From 3a28233f9b7fa83e5b78ee189aa8a3a9dc5701bc Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 29 Jan 2025 19:44:20 -0300 Subject: [PATCH 1/8] Fixing typos in Google Drive --- components/google_drive/actions/update-file/update-file.mjs | 4 ++-- components/google_drive/actions/upload-file/upload-file.mjs | 6 +++--- components/google_drive/package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/google_drive/actions/update-file/update-file.mjs b/components/google_drive/actions/update-file/update-file.mjs index c8e748e618baf..6232c6df48937 100644 --- a/components/google_drive/actions/update-file/update-file.mjs +++ b/components/google_drive/actions/update-file/update-file.mjs @@ -8,14 +8,14 @@ export default { key: "google_drive-update-file", name: "Update File", description: "Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, requiredPropsAlert: { type: "alert", alertType: "info", - content: "Either `File URL` and `File Path` should be specified.", + content: "Either `File URL` or `File Path` should be specified.", }, drive: { propDefinition: [ diff --git a/components/google_drive/actions/upload-file/upload-file.mjs b/components/google_drive/actions/upload-file/upload-file.mjs index ba885430adc9d..b97fc71a719ac 100644 --- a/components/google_drive/actions/upload-file/upload-file.mjs +++ b/components/google_drive/actions/upload-file/upload-file.mjs @@ -11,14 +11,14 @@ export default { key: "google_drive-upload-file", name: "Upload File", description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information", - version: "0.1.10", + version: "0.1.11", type: "action", props: { googleDrive, infoAlert: { type: "alert", alertType: "info", - content: "Either `File URL` and `File Path` should be specified.", + content: "Either `File URL` or `File Path` should be specified.", }, drive: { propDefinition: [ @@ -95,7 +95,7 @@ export default { } = this; let { uploadType } = this; if (!fileUrl && !filePath) { - throw new ConfigurationError("Either `File URL` and `File Path` should be specified."); + throw new ConfigurationError("Either `File URL` or `File Path` should be specified."); } const driveId = this.googleDrive.getDriveId(this.drive); diff --git a/components/google_drive/package.json b/components/google_drive/package.json index cebdc29cc9759..24226df14c896 100644 --- a/components/google_drive/package.json +++ b/components/google_drive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_drive", - "version": "0.8.9", + "version": "0.8.10", "description": "Pipedream Google_drive Components", "main": "google_drive.app.mjs", "keywords": [ From 072e6dcaa7aa38e63a0d7fa60c005333f279a5e0 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 29 Jan 2025 19:46:02 -0300 Subject: [PATCH 2/8] pnpm --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3f5858a965ed2..15b4cebcd9e9e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -292,8 +292,7 @@ importers: specifier: ^3.0.1 version: 3.0.3 - components/adobe_document_generation_api: - specifiers: {} + components/adobe_document_generation_api: {} components/adobe_pdf_services: dependencies: @@ -10501,8 +10500,7 @@ importers: components/syncro: {} - components/synthflow: - specifiers: {} + components/synthflow: {} components/t2m_url_shortener: {} @@ -31754,6 +31752,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: From 8c53e2f4f6a75092246ebae53b9097fb6f67bc7e Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 29 Jan 2025 20:31:13 -0300 Subject: [PATCH 3/8] Adding selection between file URL or path --- .../actions/update-file/update-file.mjs | 12 +++++----- .../actions/upload-file/upload-file.mjs | 20 ++++++++-------- .../google_drive/common/filePathOrUrl.mjs | 24 +++++++++++++++++++ 3 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 components/google_drive/common/filePathOrUrl.mjs diff --git a/components/google_drive/actions/update-file/update-file.mjs b/components/google_drive/actions/update-file/update-file.mjs index 6232c6df48937..5ecc03f377880 100644 --- a/components/google_drive/actions/update-file/update-file.mjs +++ b/components/google_drive/actions/update-file/update-file.mjs @@ -3,20 +3,20 @@ import { toSingleLineString, getFileStream, } from "../../common/utils.mjs"; +import { + additionalProps, useFileUrlOrPath, +} from "../../common/filePathOrUrl.mjs"; export default { key: "google_drive-update-file", name: "Update File", description: "Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information", - version: "0.1.8", + version: "1.0.0", type: "action", + additionalProps, props: { googleDrive, - requiredPropsAlert: { - type: "alert", - alertType: "info", - content: "Either `File URL` or `File Path` should be specified.", - }, + useFileUrlOrPath, drive: { propDefinition: [ googleDrive, diff --git a/components/google_drive/actions/upload-file/upload-file.mjs b/components/google_drive/actions/upload-file/upload-file.mjs index b97fc71a719ac..e4a78ca5aab96 100644 --- a/components/google_drive/actions/upload-file/upload-file.mjs +++ b/components/google_drive/actions/upload-file/upload-file.mjs @@ -5,21 +5,20 @@ import { omitEmptyStringValues, } from "../../common/utils.mjs"; import { GOOGLE_DRIVE_UPLOAD_TYPE_MULTIPART } from "../../common/constants.mjs"; -import { ConfigurationError } from "@pipedream/platform"; +import { + additionalProps, useFileUrlOrPath, +} from "../../common/filePathOrUrl.mjs"; export default { key: "google_drive-upload-file", name: "Upload File", description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information", - version: "0.1.11", + version: "1.0.0", type: "action", + additionalProps, props: { googleDrive, - infoAlert: { - type: "alert", - alertType: "info", - content: "Either `File URL` or `File Path` should be specified.", - }, + useFileUrlOrPath, drive: { propDefinition: [ googleDrive, @@ -44,12 +43,16 @@ export default { googleDrive, "fileUrl", ], + optional: false, + hidden: true, }, filePath: { propDefinition: [ googleDrive, "filePath", ], + optional: false, + hidden: true, }, name: { propDefinition: [ @@ -94,9 +97,6 @@ export default { mimeType, } = this; let { uploadType } = this; - if (!fileUrl && !filePath) { - throw new ConfigurationError("Either `File URL` or `File Path` should be specified."); - } const driveId = this.googleDrive.getDriveId(this.drive); const filename = name || path.basename(fileUrl || filePath); diff --git a/components/google_drive/common/filePathOrUrl.mjs b/components/google_drive/common/filePathOrUrl.mjs new file mode 100644 index 0000000000000..15836a7ef2abb --- /dev/null +++ b/components/google_drive/common/filePathOrUrl.mjs @@ -0,0 +1,24 @@ +export const useFileUrlOrPath = { + type: "string", + label: "Use File URL or File Path", + description: "Whether to upload a file from a URL or from the `/tmp` folder", + options: [ + "File URL", + "File Path", + ], + reloadProps: true, +}; + +export async function additionalProps(previousProps) { + const { useFileUrlOrPath } = this; + + if (useFileUrlOrPath === "File URL") { + previousProps.fileUrl.hidden = false; + previousProps.filePath.hidden = true; + } else if (useFileUrlOrPath === "File Path") { + previousProps.fileUrl.hidden = true; + previousProps.filePath.hidden = false; + } + + return {}; +} From 4c7467aa20a69cd2b5ccd205d9d2d561b782abfa Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 29 Jan 2025 20:39:41 -0300 Subject: [PATCH 4/8] Adjusting props to required --- components/google_drive/actions/update-file/update-file.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/google_drive/actions/update-file/update-file.mjs b/components/google_drive/actions/update-file/update-file.mjs index 5ecc03f377880..d929f87723be7 100644 --- a/components/google_drive/actions/update-file/update-file.mjs +++ b/components/google_drive/actions/update-file/update-file.mjs @@ -40,6 +40,8 @@ export default { "fileUrl", ], description: "The URL of the file to use to update content", + optional: false, + hidden: true, }, filePath: { propDefinition: [ @@ -51,6 +53,8 @@ export default { directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory) (e.g., \`/tmp/myFile.csv\`) with which to update content `), + optional: false, + hidden: true, }, name: { propDefinition: [ From 177d045fc334be9004d294b1e42e2bddf1b84191 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Tue, 11 Feb 2025 21:16:00 -0300 Subject: [PATCH 5/8] pnpm --- pnpm-lock.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31aaa64aefcaa..7eb3daed2a689 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2454,8 +2454,7 @@ importers: specifier: ^0.1.6 version: 0.1.6 - components/current_rms: - specifiers: {} + components/current_rms: {} components/customer_fields: dependencies: @@ -7284,8 +7283,7 @@ importers: components/odoo: {} - components/office_365_management: - specifiers: {} + components/office_365_management: {} components/offlight: dependencies: @@ -12645,8 +12643,7 @@ importers: specifier: ^1.0.5 version: 1.0.5 - components/zoho_tables: - specifiers: {} + components/zoho_tables: {} components/zoho_workdrive: dependencies: From d1aadd121648f3d4469e80086b28f6a2a6d207e7 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 12 Feb 2025 06:57:44 -0300 Subject: [PATCH 6/8] Adjustments to allow updating file metadata only --- .../actions/update-file/update-file.mjs | 25 ++++++++++++++++--- .../actions/upload-file/upload-file.mjs | 4 +-- .../google_drive/common/filePathOrUrl.mjs | 11 +++++--- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/components/google_drive/actions/update-file/update-file.mjs b/components/google_drive/actions/update-file/update-file.mjs index d929f87723be7..afe384ac4412f 100644 --- a/components/google_drive/actions/update-file/update-file.mjs +++ b/components/google_drive/actions/update-file/update-file.mjs @@ -3,9 +3,7 @@ import { toSingleLineString, getFileStream, } from "../../common/utils.mjs"; -import { - additionalProps, useFileUrlOrPath, -} from "../../common/filePathOrUrl.mjs"; +import { additionalProps } from "../../common/filePathOrUrl.mjs"; export default { key: "google_drive-update-file", @@ -16,7 +14,26 @@ export default { additionalProps, props: { googleDrive, - useFileUrlOrPath, + updateType: { + type: "string", + label: "Update Type", + description: "Whether to update content or metadata only", + options: [ + { + label: "Upload content from File URL", + value: "File URL", + }, + { + label: "Upload content from File Path", + value: "File Path", + }, + { + label: "Update file metadata only", + value: "File Metadata", + }, + ], + reloadProps: true, + }, drive: { propDefinition: [ googleDrive, diff --git a/components/google_drive/actions/upload-file/upload-file.mjs b/components/google_drive/actions/upload-file/upload-file.mjs index e4a78ca5aab96..92cdbbf6e3ae4 100644 --- a/components/google_drive/actions/upload-file/upload-file.mjs +++ b/components/google_drive/actions/upload-file/upload-file.mjs @@ -6,7 +6,7 @@ import { } from "../../common/utils.mjs"; import { GOOGLE_DRIVE_UPLOAD_TYPE_MULTIPART } from "../../common/constants.mjs"; import { - additionalProps, useFileUrlOrPath, + additionalProps, updateType, } from "../../common/filePathOrUrl.mjs"; export default { @@ -18,7 +18,7 @@ export default { additionalProps, props: { googleDrive, - useFileUrlOrPath, + updateType, drive: { propDefinition: [ googleDrive, diff --git a/components/google_drive/common/filePathOrUrl.mjs b/components/google_drive/common/filePathOrUrl.mjs index 15836a7ef2abb..964f5580d917e 100644 --- a/components/google_drive/common/filePathOrUrl.mjs +++ b/components/google_drive/common/filePathOrUrl.mjs @@ -1,4 +1,4 @@ -export const useFileUrlOrPath = { +export const updateType = { type: "string", label: "Use File URL or File Path", description: "Whether to upload a file from a URL or from the `/tmp` folder", @@ -10,14 +10,17 @@ export const useFileUrlOrPath = { }; export async function additionalProps(previousProps) { - const { useFileUrlOrPath } = this; + const { updateType } = this; - if (useFileUrlOrPath === "File URL") { + if (updateType === "File URL") { previousProps.fileUrl.hidden = false; previousProps.filePath.hidden = true; - } else if (useFileUrlOrPath === "File Path") { + } else if (updateType === "File Path") { previousProps.fileUrl.hidden = true; previousProps.filePath.hidden = false; + } else { + previousProps.fileUrl.hidden = true; + previousProps.filePath.hidden = true; } return {}; From e56447d6e17526f03e1b39e3a9e2fa59ae8ffe6a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 19 Feb 2025 23:10:14 -0300 Subject: [PATCH 7/8] Fixing file path / file URL duality --- .../actions/update-file/update-file.mjs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/components/google_drive/actions/update-file/update-file.mjs b/components/google_drive/actions/update-file/update-file.mjs index afe384ac4412f..2a027e9e0b442 100644 --- a/components/google_drive/actions/update-file/update-file.mjs +++ b/components/google_drive/actions/update-file/update-file.mjs @@ -149,16 +149,21 @@ export default { ocrLanguage, useContentAsIndexableText, advanced, + updateType, } = this; - const fileStream = - fileUrl || filePath - ? await getFileStream({ - $, - fileUrl, - filePath, - }) - : undefined; + let fileStream; + if (updateType === "File URL") { + fileStream = await getFileStream({ + $, + fileUrl, + }); + } else if (updateType === "File Path") { + fileStream = await getFileStream({ + $, + filePath, + }); + } // Update file content, if set, separately from metadata to prevent // multipart upload, which `google-apis-nodejs-client` doesn't seem to From 5d566ea5afd12d9b279e52132886f008f1feb5e9 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Wed, 19 Feb 2025 23:13:27 -0300 Subject: [PATCH 8/8] pnpm --- pnpm-lock.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7eb3daed2a689..b24bc3bd143b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14272,12 +14272,12 @@ packages: '@dabh/diagnostics@2.0.3': resolution: {integrity: sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==} - '@definitelytyped/header-parser@0.2.16': - resolution: {integrity: sha512-UFsgPft5bhZn07UNGz/9ck4AhdKgLFEOmi2DNr7gXcGL89zbe3u5oVafKUT8j1HOtSBjT8ZEQsXHKlbq+wwF/Q==} + '@definitelytyped/header-parser@0.2.17': + resolution: {integrity: sha512-U0juKFkTOcbkSfO83WSzMEJHYDwoBFiq0tf/JszulL3+7UoSiqunpGmxXS54bm3eGqy7GWjV8AqPQHdeoEaWBQ==} engines: {node: '>=18.18.0'} - '@definitelytyped/typescript-versions@0.1.6': - resolution: {integrity: sha512-gQpXFteIKrOw4ldmBZQfBrD3WobaIG1SwOr/3alXWkcYbkOWa2NRxQbiaYQ2IvYTGaZK26miJw0UOAFiuIs4gA==} + '@definitelytyped/typescript-versions@0.1.7': + resolution: {integrity: sha512-sBzBi1SBn79OkSr8V0H+FzR7QumHk23syPyRxod/VRBrSkgN9rCliIe+nqLoWRAKN8EeKbp00ketnJNLZhucdA==} engines: {node: '>=18.18.0'} '@definitelytyped/utils@0.1.8': @@ -29970,13 +29970,13 @@ snapshots: enabled: 2.0.0 kuler: 2.0.0 - '@definitelytyped/header-parser@0.2.16': + '@definitelytyped/header-parser@0.2.17': dependencies: - '@definitelytyped/typescript-versions': 0.1.6 + '@definitelytyped/typescript-versions': 0.1.7 '@definitelytyped/utils': 0.1.8 semver: 7.6.3 - '@definitelytyped/typescript-versions@0.1.6': {} + '@definitelytyped/typescript-versions@0.1.7': {} '@definitelytyped/utils@0.1.8': dependencies: @@ -36653,7 +36653,7 @@ snapshots: dts-critic@3.3.11(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.16 + '@definitelytyped/header-parser': 0.2.17 command-exists: 1.2.9 rimraf: 3.0.2 semver: 6.3.1 @@ -36663,8 +36663,8 @@ snapshots: dtslint@4.2.1(typescript@5.7.2): dependencies: - '@definitelytyped/header-parser': 0.2.16 - '@definitelytyped/typescript-versions': 0.1.6 + '@definitelytyped/header-parser': 0.2.17 + '@definitelytyped/typescript-versions': 0.1.7 '@definitelytyped/utils': 0.1.8 dts-critic: 3.3.11(typescript@5.7.2) fs-extra: 6.0.1