Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion components/dropbox/actions/create-folder/create-folder.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
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,
alert: {

Check warning on line 12 in components/dropbox/actions/create-update-share-link/create-update-share-link.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 12 in components/dropbox/actions/create-update-share-link/create-update-share-link.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "warning",
content: `Dropbox Free and Basic users are able to create a publicly-available share link which allows downloads.
Expand Down Expand Up @@ -66,6 +66,13 @@
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;
Expand All @@ -84,6 +91,7 @@
linkPassword,
expires,
access,
audience,
} = this;

const accountType = await this.getCurrentAccount();
Expand All @@ -107,6 +115,7 @@
expires,
access,
allow_download: allowDownload,
audience,
},
});
$.export("$summary", `Shared link for "${path?.label || path}" successfully created`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
link_password: this.linkPassword,
});
$.export("$summary", "Successfully retrieved shared link file");
return result;
},
};
Original file line number Diff line number Diff line change
@@ -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;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
50 changes: 50 additions & 0 deletions components/dropbox/actions/list-shared-links/list-shared-links.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion components/dropbox/actions/upload-file/upload-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions components/dropbox/common/consts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ export default {
"public",
"team",
"no_one",
"password",
"members",
"other",
],
CREATE_SHARED_LINK_ACCESS_OPTIONS: [
{
Expand Down
61 changes: 59 additions & 2 deletions components/dropbox/dropbox.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -363,11 +395,12 @@ export default {
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);
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,
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion components/dropbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/dropbox",
"version": "1.0.1",
"version": "1.1.0",
"description": "Pipedream Dropbox Components",
"main": "dropbox.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/dropbox/sources/all-updates/all-updates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion components/dropbox/sources/new-file/new-file.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading
Loading