From b23c59042e54d92b3a7dd609f80191ac3f0b4453 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 17 Sep 2025 13:19:17 -0400 Subject: [PATCH 1/4] new components --- .../create-update-share-link.mjs | 11 +++- .../get-shared-link-file.mjs | 32 ++++++++++ .../get-shared-link-metadata.mjs | 32 ++++++++++ .../list-shared-links/list-shared-links.mjs | 50 +++++++++++++++ components/dropbox/common/consts.mjs | 3 - components/dropbox/dropbox.app.mjs | 63 ++++++++++++++++++- components/dropbox/package.json | 2 +- 7 files changed, 185 insertions(+), 8 deletions(-) create mode 100644 components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs create mode 100644 components/dropbox/actions/get-shared-link-metadata/get-shared-link-metadata.mjs create mode 100644 components/dropbox/actions/list-shared-links/list-shared-links.mjs diff --git a/components/dropbox/actions/create-update-share-link/create-update-share-link.mjs b/components/dropbox/actions/create-update-share-link/create-update-share-link.mjs index ba83351f5e9ee..4656f0c91cbcd 100644 --- a/components/dropbox/actions/create-update-share-link/create-update-share-link.mjs +++ b/components/dropbox/actions/create-update-share-link/create-update-share-link.mjs @@ -5,7 +5,7 @@ export default { name: "Create/Update a Share Link", description: "Creates or updates a public share link to the file or folder (It allows you to share the file or folder with anyone). [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#sharingCreateSharedLinkWithSettings__anchor)", key: "dropbox-create-update-share-link", - version: "0.0.11", + version: "0.0.12", type: "action", props: { ...common.props, @@ -66,6 +66,13 @@ export default { optional: true, options: consts.CREATE_SHARED_LINK_ACCESS_OPTIONS, }; + props.audience = { + type: "string", + label: "Audience", + description: "The audience for the shared link", + optional: true, + options: consts.CREATE_SHARED_LINK_AUDIENCE_OPTIONS, + }; } return props; @@ -84,6 +91,7 @@ export default { linkPassword, expires, access, + audience, } = this; const accountType = await this.getCurrentAccount(); @@ -107,6 +115,7 @@ export default { expires, access, allow_download: allowDownload, + audience, }, }); $.export("$summary", `Shared link for "${path?.label || path}" successfully created`); diff --git a/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs b/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs new file mode 100644 index 0000000000000..c996c85eca54a --- /dev/null +++ b/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs @@ -0,0 +1,32 @@ +import dropbox from "../../dropbox.app.mjs"; + +export default { + name: "Get Shared Link File", + description: "Get a file from a shared link. [See the documentation](https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file)", + key: "dropbox-get-shared-link-file", + version: "0.0.1", + type: "action", + props: { + dropbox, + sharedLinkUrl: { + propDefinition: [ + dropbox, + "sharedLinkUrl", + ], + }, + linkPassword: { + propDefinition: [ + dropbox, + "linkPassword", + ], + }, + }, + async run({ $ }) { + const { result } = await this.dropbox.getSharedLinkFile({ + url: this.sharedLinkUrl, + password: this.linkPassword, + }); + $.export("$summary", "Successfully retrieved shared link file"); + return result; + }, +}; diff --git a/components/dropbox/actions/get-shared-link-metadata/get-shared-link-metadata.mjs b/components/dropbox/actions/get-shared-link-metadata/get-shared-link-metadata.mjs new file mode 100644 index 0000000000000..486b256e0f86b --- /dev/null +++ b/components/dropbox/actions/get-shared-link-metadata/get-shared-link-metadata.mjs @@ -0,0 +1,32 @@ +import dropbox from "../../dropbox.app.mjs"; + +export default { + name: "Get Shared Link Metadata", + description: "Retrieves the shared link metadata for a given shared link. [See the documentation](https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata)", + key: "dropbox-get-shared-link-metadata", + version: "0.0.1", + type: "action", + props: { + dropbox, + sharedLinkUrl: { + propDefinition: [ + dropbox, + "sharedLinkUrl", + ], + }, + linkPassword: { + propDefinition: [ + dropbox, + "linkPassword", + ], + }, + }, + async run({ $ }) { + const { result } = await this.dropbox.getSharedLinkMetadata({ + url: this.sharedLinkUrl, + link_password: this.linkPassword, + }); + $.export("$summary", "Successfully retrieved shared link metadata"); + return result; + }, +}; diff --git a/components/dropbox/actions/list-shared-links/list-shared-links.mjs b/components/dropbox/actions/list-shared-links/list-shared-links.mjs new file mode 100644 index 0000000000000..e51917b2215de --- /dev/null +++ b/components/dropbox/actions/list-shared-links/list-shared-links.mjs @@ -0,0 +1,50 @@ +import dropbox from "../../dropbox.app.mjs"; + +export default { + key: "dropbox-list-shared-links", + name: "List Shared Links", + description: "Retrieves a list of shared links for a given path. [See the documentation](https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links)", + version: "0.0.1", + type: "action", + props: { + dropbox, + path: { + propDefinition: [ + dropbox, + "path", + () => ({ + initialOptions: [], + filter: ({ metadata: { metadata: { [".tag"]: type } } }) => [ + "file", + "folder", + ].includes(type), + }), + ], + optional: true, + description: "Type the file or folder name to search for it in the user's Dropbox", + }, + }, + async run({ $ }) { + const sharedLinks = []; + let hasMore; + const args = { + path: this.path?.value || this.path, + }; + + do { + const { + result: { + links, cursor, has_more, + }, + } = await this.dropbox.listSharedLinks(args); + sharedLinks.push(...links); + args.cursor = cursor; + hasMore = has_more; + } while (hasMore); + + $.export("$summary", `Successfully retrieved ${sharedLinks.length} shared link${sharedLinks.length === 1 + ? "" + : "s"}.`); + return sharedLinks; + }, +}; diff --git a/components/dropbox/common/consts.mjs b/components/dropbox/common/consts.mjs index 0edd17b699b4f..3e16c214b14fb 100644 --- a/components/dropbox/common/consts.mjs +++ b/components/dropbox/common/consts.mjs @@ -28,9 +28,6 @@ export default { "public", "team", "no_one", - "password", - "members", - "other", ], CREATE_SHARED_LINK_ACCESS_OPTIONS: [ { diff --git a/components/dropbox/dropbox.app.mjs b/components/dropbox/dropbox.app.mjs index 21271a7e83933..7ecd5d87a8522 100644 --- a/components/dropbox/dropbox.app.mjs +++ b/components/dropbox/dropbox.app.mjs @@ -96,6 +96,38 @@ export default { } }, }, + sharedLinkUrl: { + type: "string", + label: "Shared Link URL", + description: "The URL of a shared link", + async options({ prevContext }) { + const { + result: { + links, cursor, + }, + } = await this.listSharedLinks({ + cursor: prevContext?.cursor, + }); + const options = links?.map(({ + url: value, name: label, + }) => ({ + value, + label: `${label} - ${value}`, + })) || []; + return { + options, + context: { + cursor, + }, + }; + }, + }, + linkPassword: { + type: "string", + label: "Link Password", + description: "The password required to access the shared link", + optional: true, + }, fileRevision: { type: "string", label: "Revision", @@ -357,17 +389,18 @@ export default { this.normalizeError(err); } }, - async createSharedLink(args) { + async createSharedLink(args) { console.log(args); try { const dpx = await this.sdk(); const links = await dpx.sharingListSharedLinks({ path: args.path, }); - if (links.result?.links.length > 0) { + const link = links.result?.links.find((l) => l.path_lower === args.path); console.log(link); + if (link) { return await dpx.sharingModifySharedLinkSettings({ ...args, path: undefined, - url: links.result?.links[0].url, + url: link.url, remove_expiration: isEmpty(args.remove_expiration) ? false : args.remove_expiration, @@ -382,6 +415,30 @@ export default { this.normalizeError(err); } }, + async listSharedLinks(args) { + try { + const dpx = await this.sdk(); + return await dpx.sharingListSharedLinks(args); + } catch (err) { + this.normalizeError(err); + } + }, + async getSharedLinkMetadata(args) { + try { + const dpx = await this.sdk(); + return await dpx.sharingGetSharedLinkMetadata(args); + } catch (err) { + this.normalizeError(err); + } + }, + async getSharedLinkFile(args) { + try { + const dpx = await this.sdk(); + return await dpx.sharingGetSharedLinkFile(args); + } catch (err) { + this.normalizeError(err); + } + }, async deleteFileFolder(args) { try { const dpx = await this.sdk(); diff --git a/components/dropbox/package.json b/components/dropbox/package.json index 76a49336c1dcf..7d3ad1ec7817e 100644 --- a/components/dropbox/package.json +++ b/components/dropbox/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/dropbox", - "version": "1.0.1", + "version": "1.1.0", "description": "Pipedream Dropbox Components", "main": "dropbox.app.mjs", "keywords": [ From 556f13dbd37460b0b4224177d481344270d6b9ea Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 17 Sep 2025 13:21:29 -0400 Subject: [PATCH 2/4] remove console.log --- components/dropbox/dropbox.app.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dropbox/dropbox.app.mjs b/components/dropbox/dropbox.app.mjs index 7ecd5d87a8522..ee5e40a85068a 100644 --- a/components/dropbox/dropbox.app.mjs +++ b/components/dropbox/dropbox.app.mjs @@ -389,13 +389,13 @@ export default { this.normalizeError(err); } }, - async createSharedLink(args) { console.log(args); + async createSharedLink(args) { try { const dpx = await this.sdk(); const links = await dpx.sharingListSharedLinks({ path: args.path, }); - const link = links.result?.links.find((l) => l.path_lower === args.path); console.log(link); + const link = links.result?.links.find((l) => l.path_lower === args.path); if (link) { return await dpx.sharingModifySharedLinkSettings({ ...args, From 671d72519e3dcc9053f9322f54f51fba8849dc9b Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 17 Sep 2025 13:23:45 -0400 Subject: [PATCH 3/4] versions --- .../dropbox/actions/create-a-text-file/create-a-text-file.mjs | 2 +- components/dropbox/actions/create-folder/create-folder.mjs | 2 +- .../create-or-append-to-a-text-file.mjs | 2 +- .../dropbox/actions/delete-file-folder/delete-file-folder.mjs | 2 +- .../actions/download-file-to-tmp/download-file-to-tmp.mjs | 2 +- .../list-file-folders-in-a-folder.mjs | 2 +- .../dropbox/actions/list-file-revisions/list-file-revisions.mjs | 2 +- .../dropbox/actions/move-file-folder/move-file-folder.mjs | 2 +- .../dropbox/actions/rename-file-folder/rename-file-folder.mjs | 2 +- components/dropbox/actions/restore-a-file/restore-a-file.mjs | 2 +- .../actions/search-files-folders/search-files-folders.mjs | 2 +- components/dropbox/actions/upload-file/upload-file.mjs | 2 +- .../actions/upload-multiple-files/upload-multiple-files.mjs | 2 +- components/dropbox/sources/all-updates/all-updates.mjs | 2 +- components/dropbox/sources/new-file/new-file.mjs | 2 +- components/dropbox/sources/new-folder/new-folder.mjs | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/components/dropbox/actions/create-a-text-file/create-a-text-file.mjs b/components/dropbox/actions/create-a-text-file/create-a-text-file.mjs index e46715b168958..951a896c9b3dd 100644 --- a/components/dropbox/actions/create-a-text-file/create-a-text-file.mjs +++ b/components/dropbox/actions/create-a-text-file/create-a-text-file.mjs @@ -4,7 +4,7 @@ export default { name: "Create a Text File", description: "Creates a brand new text file from plain text content you specify. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)", key: "dropbox-create-a-text-file", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/create-folder/create-folder.mjs b/components/dropbox/actions/create-folder/create-folder.mjs index 289b9a040fbc2..e92451db9a631 100644 --- a/components/dropbox/actions/create-folder/create-folder.mjs +++ b/components/dropbox/actions/create-folder/create-folder.mjs @@ -4,7 +4,7 @@ export default { name: "Create folder", description: "Create a Folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesCreateFolderV2__anchor)", key: "dropbox-create-folder", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs b/components/dropbox/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs index 5a65d54eddaf2..48fca85804eb3 100644 --- a/components/dropbox/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs +++ b/components/dropbox/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs @@ -4,7 +4,7 @@ export default { name: "Create or Append to a Text File", description: "Adds a new line to an existing text file, or creates a file if it doesn't exist. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)", key: "dropbox-create-or-append-to-a-text-file", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/delete-file-folder/delete-file-folder.mjs b/components/dropbox/actions/delete-file-folder/delete-file-folder.mjs index 9f145826ed36e..f255cf802675f 100644 --- a/components/dropbox/actions/delete-file-folder/delete-file-folder.mjs +++ b/components/dropbox/actions/delete-file-folder/delete-file-folder.mjs @@ -4,7 +4,7 @@ export default { name: "Delete a File/Folder", description: "Permanently removes a file/folder from the server. [See documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDeleteV2__anchor)", key: "dropbox-delete-file-folder", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/download-file-to-tmp/download-file-to-tmp.mjs b/components/dropbox/actions/download-file-to-tmp/download-file-to-tmp.mjs index dd0c327998062..f43d5c52c6cff 100644 --- a/components/dropbox/actions/download-file-to-tmp/download-file-to-tmp.mjs +++ b/components/dropbox/actions/download-file-to-tmp/download-file-to-tmp.mjs @@ -9,7 +9,7 @@ export default { name: "Download File to TMP", description: "Download a specific file to the temporary directory. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor).", key: "dropbox-download-file-to-tmp", - version: "0.0.8", + version: "0.0.9", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/list-file-folders-in-a-folder/list-file-folders-in-a-folder.mjs b/components/dropbox/actions/list-file-folders-in-a-folder/list-file-folders-in-a-folder.mjs index dbccae8d5ea29..b64d1d92b3fcd 100644 --- a/components/dropbox/actions/list-file-folders-in-a-folder/list-file-folders-in-a-folder.mjs +++ b/components/dropbox/actions/list-file-folders-in-a-folder/list-file-folders-in-a-folder.mjs @@ -4,7 +4,7 @@ export default { name: "List All Files/Subfolders in a Folder", description: "Retrieves a list of files or subfolders in a specified folder [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListFolder__anchor)", key: "dropbox-list-file-folders-in-a-folder", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/list-file-revisions/list-file-revisions.mjs b/components/dropbox/actions/list-file-revisions/list-file-revisions.mjs index 84e7257ba8027..26a6fe87ada33 100644 --- a/components/dropbox/actions/list-file-revisions/list-file-revisions.mjs +++ b/components/dropbox/actions/list-file-revisions/list-file-revisions.mjs @@ -5,7 +5,7 @@ export default { name: "List File Revisions", description: "Retrieves a list of file revisions needed to recover previous content. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesListRevisions__anchor)", key: "dropbox-list-file-revisions", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/move-file-folder/move-file-folder.mjs b/components/dropbox/actions/move-file-folder/move-file-folder.mjs index 5dfb2422b2cb2..e79c25e419c4a 100644 --- a/components/dropbox/actions/move-file-folder/move-file-folder.mjs +++ b/components/dropbox/actions/move-file-folder/move-file-folder.mjs @@ -4,7 +4,7 @@ export default { name: "Move a File/Folder", description: "Moves a file or folder to a different location in the user's Dropbox [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesMoveV2__anchor)", key: "dropbox-move-file-folder", - version: "0.0.12", + version: "0.0.13", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/rename-file-folder/rename-file-folder.mjs b/components/dropbox/actions/rename-file-folder/rename-file-folder.mjs index 49b15eb31a2d1..ee200686863dd 100644 --- a/components/dropbox/actions/rename-file-folder/rename-file-folder.mjs +++ b/components/dropbox/actions/rename-file-folder/rename-file-folder.mjs @@ -4,7 +4,7 @@ export default { name: "Rename a File/Folder", description: "Renames a file or folder in the user's Dropbox [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesMoveV2__anchor)", key: "dropbox-rename-file-folder", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/restore-a-file/restore-a-file.mjs b/components/dropbox/actions/restore-a-file/restore-a-file.mjs index ff883ba865881..8a7713d499f98 100644 --- a/components/dropbox/actions/restore-a-file/restore-a-file.mjs +++ b/components/dropbox/actions/restore-a-file/restore-a-file.mjs @@ -4,7 +4,7 @@ export default { name: "Restore a File", description: "Restores a previous file version. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesRestore__anchor)", key: "dropbox-restore-a-file", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/search-files-folders/search-files-folders.mjs b/components/dropbox/actions/search-files-folders/search-files-folders.mjs index 37b32ed1c4723..de05a63b75f64 100644 --- a/components/dropbox/actions/search-files-folders/search-files-folders.mjs +++ b/components/dropbox/actions/search-files-folders/search-files-folders.mjs @@ -6,7 +6,7 @@ export default { name: "Search files and folders", description: "Searches for files and folders by name. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesSearchV2__anchor)", key: "dropbox-search-files-folders", - version: "0.0.11", + version: "0.0.12", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/upload-file/upload-file.mjs b/components/dropbox/actions/upload-file/upload-file.mjs index 748bd976b3e93..6e66a8aa0ff38 100644 --- a/components/dropbox/actions/upload-file/upload-file.mjs +++ b/components/dropbox/actions/upload-file/upload-file.mjs @@ -6,7 +6,7 @@ export default { name: "Upload a File", description: "Uploads a file to a selected folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)", key: "dropbox-upload-file", - version: "1.0.1", + version: "1.0.2", type: "action", props: { dropbox, diff --git a/components/dropbox/actions/upload-multiple-files/upload-multiple-files.mjs b/components/dropbox/actions/upload-multiple-files/upload-multiple-files.mjs index 04ea58f50da97..1993adb8828af 100644 --- a/components/dropbox/actions/upload-multiple-files/upload-multiple-files.mjs +++ b/components/dropbox/actions/upload-multiple-files/upload-multiple-files.mjs @@ -8,7 +8,7 @@ export default { name: "Upload Multiple Files", description: "Uploads multiple file to a selected folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)", key: "dropbox-upload-multiple-files", - version: "1.0.1", + version: "1.0.2", type: "action", props: { dropbox, diff --git a/components/dropbox/sources/all-updates/all-updates.mjs b/components/dropbox/sources/all-updates/all-updates.mjs index 1405f9b083d75..520902690631d 100644 --- a/components/dropbox/sources/all-updates/all-updates.mjs +++ b/components/dropbox/sources/all-updates/all-updates.mjs @@ -7,7 +7,7 @@ export default { type: "source", key: "dropbox-all-updates", name: "New or Modified File or Folder", - version: "0.0.18", + version: "0.0.19", description: "Emit new event when a file or folder is added or modified. Make sure the number of files/folders in the watched folder does not exceed 4000.", props: { ...common.props, diff --git a/components/dropbox/sources/new-file/new-file.mjs b/components/dropbox/sources/new-file/new-file.mjs index 8d45236bf468f..edc10c61d4006 100644 --- a/components/dropbox/sources/new-file/new-file.mjs +++ b/components/dropbox/sources/new-file/new-file.mjs @@ -7,7 +7,7 @@ export default { type: "source", key: "dropbox-new-file", name: "New File", - version: "0.0.19", + version: "0.0.20", description: "Emit new event when a new file is added to your account or a specific folder. Make sure the number of files/folders in the watched folder does not exceed 4000.", props: { ...common.props, diff --git a/components/dropbox/sources/new-folder/new-folder.mjs b/components/dropbox/sources/new-folder/new-folder.mjs index 39a2cc9ebd0c2..8744c60e0bf0d 100644 --- a/components/dropbox/sources/new-folder/new-folder.mjs +++ b/components/dropbox/sources/new-folder/new-folder.mjs @@ -7,7 +7,7 @@ export default { type: "source", key: "dropbox-new-folder", name: "New Folder", - version: "0.0.18", + version: "0.0.19", description: "Emit new event when a new folder is created. Make sure the number of files/folders in the watched folder does not exceed 4000.", hooks: { async activate() { From fb3965db22d31ed06b6102454de3b6668cd5b96c Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 17 Sep 2025 13:40:52 -0400 Subject: [PATCH 4/4] update --- .../actions/get-shared-link-file/get-shared-link-file.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs b/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs index c996c85eca54a..11044b1234cd9 100644 --- a/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs +++ b/components/dropbox/actions/get-shared-link-file/get-shared-link-file.mjs @@ -24,7 +24,7 @@ export default { async run({ $ }) { const { result } = await this.dropbox.getSharedLinkFile({ url: this.sharedLinkUrl, - password: this.linkPassword, + link_password: this.linkPassword, }); $.export("$summary", "Successfully retrieved shared link file"); return result;