@pipedream/dropbox 0.3.19 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/create-a-text-file/create-a-text-file.mjs +9 -5
- package/actions/create-folder/create-folder.mjs +3 -3
- package/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs +3 -3
- package/actions/create-update-share-link/common.mjs +10 -0
- package/actions/create-update-share-link/create-update-share-link.mjs +66 -48
- package/actions/delete-file-folder/delete-file-folder.mjs +2 -2
- package/actions/download-file-to-tmp/download-file-to-tmp.mjs +6 -4
- package/actions/list-file-folders-in-a-folder/list-file-folders-in-a-folder.mjs +4 -3
- package/actions/list-file-revisions/list-file-revisions.mjs +3 -3
- package/actions/move-file-folder/move-file-folder.mjs +9 -6
- package/actions/rename-file-folder/rename-file-folder.mjs +2 -2
- package/actions/restore-a-file/restore-a-file.mjs +2 -7
- package/actions/search-files-folders/search-files-folders.mjs +8 -8
- package/actions/upload-file/upload-file.mjs +9 -4
- package/common/consts.mjs +16 -5
- package/dropbox.app.mjs +1 -1
- package/package.json +1 -1
- package/sources/all-updates/all-updates.mjs +19 -7
- package/sources/all-updates/test-event.mjs +14 -0
- package/sources/common/common.mjs +1 -1
- package/sources/new-file/new-file.mjs +1 -1
- package/sources/new-folder/new-folder.mjs +3 -1
- package/sources/new-folder/test-event.mjs +14 -0
|
@@ -2,16 +2,16 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Create a Text File",
|
|
5
|
-
description: "Creates a brand new text file from plain text content you specify. [See
|
|
5
|
+
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)",
|
|
6
6
|
key: "dropbox-create-a-text-file",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
name: {
|
|
12
12
|
type: "string",
|
|
13
|
-
label: "File
|
|
14
|
-
description: "Your new file name.",
|
|
13
|
+
label: "File Name",
|
|
14
|
+
description: "Your new file name. Example: `textfile.txt`",
|
|
15
15
|
},
|
|
16
16
|
path: {
|
|
17
17
|
propDefinition: [
|
|
@@ -36,9 +36,13 @@ export default {
|
|
|
36
36
|
path,
|
|
37
37
|
} = this;
|
|
38
38
|
|
|
39
|
+
const filename = name.includes(".txt")
|
|
40
|
+
? name
|
|
41
|
+
: `${name}.txt`;
|
|
42
|
+
|
|
39
43
|
const res = await this.dropbox.uploadFile({
|
|
40
44
|
contents: Buffer.from(content),
|
|
41
|
-
path: this.dropbox.getNormalizedPath(path, true) +
|
|
45
|
+
path: this.dropbox.getNormalizedPath(path, true) + filename,
|
|
42
46
|
autorename: true,
|
|
43
47
|
});
|
|
44
48
|
|
|
@@ -2,15 +2,15 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Create folder",
|
|
5
|
-
description: "Create a
|
|
5
|
+
description: "Create a Folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesCreateFolderV2__anchor)",
|
|
6
6
|
key: "dropbox-create-folder",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
name: {
|
|
12
12
|
type: "string",
|
|
13
|
-
label: "Folder
|
|
13
|
+
label: "Folder Name",
|
|
14
14
|
description: "Your new folder name.",
|
|
15
15
|
},
|
|
16
16
|
path: {
|
|
@@ -2,15 +2,15 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Create or Append to a Text File",
|
|
5
|
-
description: "Adds a new line to an existing text file, or creates a file if it doesn't exist. [See
|
|
5
|
+
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)",
|
|
6
6
|
key: "dropbox-create-or-append-to-a-text-file",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
name: {
|
|
12
12
|
type: "string",
|
|
13
|
-
label: "File
|
|
13
|
+
label: "File Name",
|
|
14
14
|
description: "Your new file name",
|
|
15
15
|
},
|
|
16
16
|
path: {
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import common from "./common.mjs";
|
|
2
2
|
import consts from "../../common/consts.mjs";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
name: "Create/Update a Share Link",
|
|
6
|
-
description: "Creates or updates a public share link to the file or folder (It allows to share the file or folder with anyone). [See
|
|
6
|
+
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)",
|
|
7
7
|
key: "dropbox-create-update-share-link",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
|
-
|
|
11
|
+
...common.props,
|
|
12
|
+
alert: {
|
|
13
|
+
type: "alert",
|
|
14
|
+
alertType: "warning",
|
|
15
|
+
content: `Dropbox Free and Basic users are able to create a publicly-available share link which allows downloads.
|
|
16
|
+
\nIn order to utilize advanced link sharing functionality, you must be on a Dropbox Essentials plan or higher. See the Dropbox pricing [page](https://www.dropbox.com/plans?trigger=nr#:~:text=Collaborative%20sharing) for more details.`,
|
|
17
|
+
},
|
|
12
18
|
path: {
|
|
13
19
|
propDefinition: [
|
|
14
|
-
dropbox,
|
|
20
|
+
common.props.dropbox,
|
|
15
21
|
"path",
|
|
16
22
|
() => ({
|
|
17
23
|
initialOptions: [],
|
|
@@ -23,42 +29,52 @@ export default {
|
|
|
23
29
|
],
|
|
24
30
|
description: "Type the file or folder name to search for it in the user's Dropbox.",
|
|
25
31
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
32
|
+
},
|
|
33
|
+
async additionalProps() {
|
|
34
|
+
const props = {};
|
|
35
|
+
|
|
36
|
+
const accountType = await this.getCurrentAccount();
|
|
37
|
+
if (accountType !== "basic") {
|
|
38
|
+
props.requirePassword = {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
label: "Require Password",
|
|
41
|
+
description: "Boolean flag to enable or disable password protection.",
|
|
42
|
+
default: false,
|
|
43
|
+
reloadProps: true,
|
|
44
|
+
};
|
|
45
|
+
props.linkPassword = {
|
|
46
|
+
type: "string",
|
|
47
|
+
label: "Link Password",
|
|
48
|
+
description: "If `require_password` is `true`, this is needed to specify the password to access the link.",
|
|
49
|
+
hidden: !this.requirePassword,
|
|
50
|
+
};
|
|
51
|
+
props.allowDownload = {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
label: "Allow Downloads",
|
|
54
|
+
description: "Boolean flag to allow or not allow capabilities for shared links.",
|
|
55
|
+
};
|
|
56
|
+
props.expires = {
|
|
57
|
+
type: "string",
|
|
58
|
+
label: "Expires",
|
|
59
|
+
description: "Expiration time of the shared link. By default the link never expires. Make sure to use a valid [timestamp](https://dropbox.github.io/dropbox-sdk-js/global.html#Timestamp) value. Example: `2024-07-18T20:00:00Z`",
|
|
60
|
+
optional: true,
|
|
61
|
+
};
|
|
62
|
+
props.access = {
|
|
63
|
+
type: "string",
|
|
64
|
+
label: "Access",
|
|
65
|
+
description: "Requested access level you want the audience to gain from this link. Note, modifying access level for an existing link is not supported.",
|
|
66
|
+
optional: true,
|
|
67
|
+
options: consts.CREATE_SHARED_LINK_ACCESS_OPTIONS,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return props;
|
|
72
|
+
},
|
|
73
|
+
methods: {
|
|
74
|
+
async getCurrentAccount() {
|
|
75
|
+
const dpx = await this.dropbox.sdk();
|
|
76
|
+
const { result: { account_type: accountType } } = await dpx.usersGetCurrentAccount();
|
|
77
|
+
return accountType[".tag"];
|
|
62
78
|
},
|
|
63
79
|
},
|
|
64
80
|
async run({ $ }) {
|
|
@@ -67,29 +83,31 @@ export default {
|
|
|
67
83
|
requirePassword,
|
|
68
84
|
linkPassword,
|
|
69
85
|
expires,
|
|
70
|
-
audience,
|
|
71
86
|
access,
|
|
72
|
-
requestedVisibility,
|
|
73
|
-
allowDownload,
|
|
74
|
-
removeExpiration,
|
|
75
87
|
} = this;
|
|
76
88
|
|
|
89
|
+
const accountType = await this.getCurrentAccount();
|
|
90
|
+
const allowDownload = accountType === "basic"
|
|
91
|
+
? true
|
|
92
|
+
: this.allowDownload;
|
|
93
|
+
|
|
77
94
|
if (requirePassword && !linkPassword) {
|
|
78
95
|
throw new Error("Since the password is required, please add a linkPassword");
|
|
79
96
|
}
|
|
80
97
|
|
|
98
|
+
if (expires && Date.parse(expires) < Date.now()) {
|
|
99
|
+
throw new Error("Expire date must be later than the current datetime");
|
|
100
|
+
}
|
|
101
|
+
|
|
81
102
|
const res = await this.dropbox.createSharedLink({
|
|
82
103
|
path: this.dropbox.getPath(path),
|
|
83
104
|
settings: {
|
|
84
105
|
require_password: requirePassword,
|
|
85
106
|
link_password: linkPassword,
|
|
86
107
|
expires,
|
|
87
|
-
audience,
|
|
88
108
|
access,
|
|
89
|
-
requested_visibility: requestedVisibility,
|
|
90
109
|
allow_download: allowDownload,
|
|
91
110
|
},
|
|
92
|
-
remove_expiration: removeExpiration,
|
|
93
111
|
});
|
|
94
112
|
$.export("$summary", `Shared link for "${path?.label || path}" successfully created`);
|
|
95
113
|
return res;
|
|
@@ -2,9 +2,9 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Delete a File/Folder",
|
|
5
|
-
description: "Permanently removes a file/folder from the server. [See
|
|
5
|
+
description: "Permanently removes a file/folder from the server. [See documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDeleteV2__anchor)",
|
|
6
6
|
key: "dropbox-delete-file-folder",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Download File to TMP",
|
|
7
7
|
description: "Download a specific file to the temporary directory. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor).",
|
|
8
8
|
key: "dropbox-download-file-to-tmp",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.6",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
dropbox,
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
},
|
|
22
22
|
name: {
|
|
23
23
|
type: "string",
|
|
24
|
-
label: "File
|
|
24
|
+
label: "File Name",
|
|
25
25
|
description: "The new name of the file to be saved, including it's extension. e.g: `myFile.csv`",
|
|
26
26
|
optional: true,
|
|
27
27
|
},
|
|
@@ -35,16 +35,18 @@ export default {
|
|
|
35
35
|
path, cleanup,
|
|
36
36
|
} = await file();
|
|
37
37
|
|
|
38
|
+
const extension = result.name.split(".").pop();
|
|
39
|
+
|
|
38
40
|
const tmpPath = this.name
|
|
39
41
|
? `/tmp/${this.name}`
|
|
40
|
-
: path
|
|
42
|
+
: `${path}.${extension}`;
|
|
41
43
|
|
|
42
44
|
await fs.promises.appendFile(tmpPath, Buffer.from(result.fileBinary));
|
|
43
45
|
await cleanup();
|
|
44
46
|
|
|
45
47
|
delete result.fileBinary;
|
|
46
48
|
|
|
47
|
-
$.export("$summary", `File successfully saved in "
|
|
49
|
+
$.export("$summary", `File successfully saved in "${tmpPath}"`);
|
|
48
50
|
|
|
49
51
|
return {
|
|
50
52
|
tmpPath,
|
|
@@ -2,9 +2,9 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "List All Files/Subfolders in a Folder",
|
|
5
|
-
description: "Retrieves a list of files or subfolders in a specified folder [See the
|
|
5
|
+
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)",
|
|
6
6
|
key: "dropbox-list-file-folders-in-a-folder",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -13,6 +13,7 @@ export default {
|
|
|
13
13
|
dropbox,
|
|
14
14
|
"path",
|
|
15
15
|
() => ({
|
|
16
|
+
initialOptions: [],
|
|
16
17
|
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
17
18
|
}),
|
|
18
19
|
],
|
|
@@ -26,7 +27,7 @@ export default {
|
|
|
26
27
|
},
|
|
27
28
|
includeDeleted: {
|
|
28
29
|
type: "boolean",
|
|
29
|
-
label: "Include
|
|
30
|
+
label: "Include Deleted",
|
|
30
31
|
description: "If `true`, the results will include files and folders that used to exist but were deleted.",
|
|
31
32
|
default: false,
|
|
32
33
|
},
|
|
@@ -3,9 +3,9 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
name: "List File Revisions",
|
|
6
|
-
description: "Retrieves a list of file revisions needed to recover previous content. [See
|
|
6
|
+
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)",
|
|
7
7
|
key: "dropbox-list-file-revisions",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.10",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
dropbox,
|
|
@@ -21,7 +21,7 @@ export default {
|
|
|
21
21
|
mode: {
|
|
22
22
|
type: "string",
|
|
23
23
|
label: "Mode",
|
|
24
|
-
description: "Determines the behavior of the API in listing the revisions for a given file path or id.",
|
|
24
|
+
description: "Determines the behavior of the API in listing the revisions for a given file path or id. In `path` (default) mode, all revisions at the same file path as the latest file entry are returned. If revisions with the same file id are desired, then mode must be set to `id`.",
|
|
25
25
|
optional: true,
|
|
26
26
|
options: consts.LIST_FILE_REVISIONS_OPTIONS,
|
|
27
27
|
},
|
|
@@ -2,9 +2,9 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Move a File/Folder",
|
|
5
|
-
description: "Moves a file or folder to a different location in the user's Dropbox [See the
|
|
5
|
+
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)",
|
|
6
6
|
key: "dropbox-move-file-folder",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.11",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -20,16 +20,19 @@ export default {
|
|
|
20
20
|
].includes(type),
|
|
21
21
|
}),
|
|
22
22
|
],
|
|
23
|
-
label: "Path
|
|
23
|
+
label: "Path From",
|
|
24
24
|
description: "Type the file or folder name to search for it in the user's Dropbox.",
|
|
25
25
|
},
|
|
26
26
|
pathTo: {
|
|
27
27
|
propDefinition: [
|
|
28
28
|
dropbox,
|
|
29
29
|
"path",
|
|
30
|
+
() => ({
|
|
31
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
32
|
+
}),
|
|
30
33
|
],
|
|
31
|
-
label: "Path
|
|
32
|
-
description: "Type the folder name to search for it in the user's Dropbox.
|
|
34
|
+
label: "Path To",
|
|
35
|
+
description: "Type the folder name to search for it in the user's Dropbox.",
|
|
33
36
|
},
|
|
34
37
|
autorename: {
|
|
35
38
|
type: "boolean",
|
|
@@ -39,7 +42,7 @@ export default {
|
|
|
39
42
|
},
|
|
40
43
|
allowOwnershipTransfer: {
|
|
41
44
|
type: "boolean",
|
|
42
|
-
label: "Allow
|
|
45
|
+
label: "Allow Ownership Transfer",
|
|
43
46
|
description: "Allow moves by owner even if it would result in an ownership transfer for the content being moved. This does not apply to copies.",
|
|
44
47
|
optional: true,
|
|
45
48
|
},
|
|
@@ -2,9 +2,9 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Rename a File/Folder",
|
|
5
|
-
description: "Renames a file or folder in the user's Dropbox [See the
|
|
5
|
+
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)",
|
|
6
6
|
key: "dropbox-rename-file-folder",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -2,9 +2,9 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
name: "Restore a File",
|
|
5
|
-
description: "Restores a previous file version. [See
|
|
5
|
+
description: "Restores a previous file version. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesRestore__anchor)",
|
|
6
6
|
key: "dropbox-restore-a-file",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -14,11 +14,6 @@ export default {
|
|
|
14
14
|
"path",
|
|
15
15
|
() => ({
|
|
16
16
|
initialOptions: [],
|
|
17
|
-
params: {
|
|
18
|
-
options: {
|
|
19
|
-
file_status: "deleted",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
17
|
}),
|
|
23
18
|
],
|
|
24
19
|
description: "Type the file name to search for it in the user's Dropbox.",
|
|
@@ -4,9 +4,9 @@ import consts from "../../common/consts.mjs";
|
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
name: "Search files and folders",
|
|
7
|
-
description: "Searches for files and folders by name. [See the
|
|
7
|
+
description: "Searches for files and folders by name. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesSearchV2__anchor)",
|
|
8
8
|
key: "dropbox-search-files-folders",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.10",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
dropbox,
|
|
@@ -28,40 +28,40 @@ export default {
|
|
|
28
28
|
},
|
|
29
29
|
orderBy: {
|
|
30
30
|
type: "string",
|
|
31
|
-
label: "Order
|
|
31
|
+
label: "Order By",
|
|
32
32
|
description: "By default, results are sorted by relevance.",
|
|
33
33
|
optional: true,
|
|
34
34
|
options: consts.SEARCH_FILE_FOLDER_ORDER_BY_OPTIONS,
|
|
35
35
|
},
|
|
36
36
|
fileStatus: {
|
|
37
37
|
type: "string",
|
|
38
|
-
label: "File
|
|
38
|
+
label: "File Status",
|
|
39
39
|
description: "Restricts search to the given file status.",
|
|
40
40
|
optional: true,
|
|
41
41
|
options: consts.SEARCH_FILE_FOLDER_STATUS_OPTIONS,
|
|
42
42
|
},
|
|
43
43
|
filenameOnly: {
|
|
44
44
|
type: "boolean",
|
|
45
|
-
label: "Filename
|
|
45
|
+
label: "Filename Only",
|
|
46
46
|
description: "Restricts search to only match on filenames.",
|
|
47
47
|
optional: true,
|
|
48
48
|
},
|
|
49
49
|
fileCategories: {
|
|
50
50
|
type: "string[]",
|
|
51
|
-
label: "File
|
|
51
|
+
label: "File Categories",
|
|
52
52
|
description: "Restricts search to only the file categories specified. Only supported for active file search.",
|
|
53
53
|
optional: true,
|
|
54
54
|
options: consts.FILES_CATEGORIES_OPTIONS,
|
|
55
55
|
},
|
|
56
56
|
fileExtensions: {
|
|
57
57
|
type: "string[]",
|
|
58
|
-
label: "File
|
|
58
|
+
label: "File Extensions",
|
|
59
59
|
description: "Restricts search to only the extensions specified. Only supported for active file search.",
|
|
60
60
|
optional: true,
|
|
61
61
|
},
|
|
62
62
|
includeHighlights: {
|
|
63
63
|
type: "boolean",
|
|
64
|
-
label: "Include
|
|
64
|
+
label: "Include Highlights",
|
|
65
65
|
description: "Whether to include highlight span from file title.",
|
|
66
66
|
optional: true,
|
|
67
67
|
},
|
|
@@ -2,12 +2,13 @@ import dropbox from "../../dropbox.app.mjs";
|
|
|
2
2
|
import consts from "../../common/consts.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import got from "got";
|
|
5
|
+
import { ConfigurationError } from "@pipedream/platform";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
name: "Upload a File",
|
|
8
|
-
description: "Uploads a file to a selected folder. [See
|
|
9
|
+
description: "Uploads a file to a selected folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)",
|
|
9
10
|
key: "dropbox-upload-file",
|
|
10
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.13",
|
|
11
12
|
type: "action",
|
|
12
13
|
props: {
|
|
13
14
|
dropbox,
|
|
@@ -23,8 +24,8 @@ export default {
|
|
|
23
24
|
},
|
|
24
25
|
name: {
|
|
25
26
|
type: "string",
|
|
26
|
-
label: "File
|
|
27
|
-
description: "The name of your new file.",
|
|
27
|
+
label: "File Name",
|
|
28
|
+
description: "The name of your new file (make sure to include the file extension).",
|
|
28
29
|
},
|
|
29
30
|
fileUrl: {
|
|
30
31
|
type: "string",
|
|
@@ -77,6 +78,10 @@ export default {
|
|
|
77
78
|
clientModified,
|
|
78
79
|
} = this;
|
|
79
80
|
|
|
81
|
+
if (!fileUrl && !filePath) {
|
|
82
|
+
throw new ConfigurationError("Must specify either File URL or File Path.");
|
|
83
|
+
}
|
|
84
|
+
|
|
80
85
|
const contents = fileUrl
|
|
81
86
|
? await got.stream(fileUrl)
|
|
82
87
|
: fs.createReadStream(filePath);
|
package/common/consts.mjs
CHANGED
|
@@ -23,7 +23,6 @@ export default {
|
|
|
23
23
|
LIST_FILE_REVISIONS_OPTIONS: [
|
|
24
24
|
"path",
|
|
25
25
|
"id",
|
|
26
|
-
"other",
|
|
27
26
|
],
|
|
28
27
|
CREATE_SHARED_LINK_AUDIENCE_OPTIONS: [
|
|
29
28
|
"public",
|
|
@@ -34,10 +33,22 @@ export default {
|
|
|
34
33
|
"other",
|
|
35
34
|
],
|
|
36
35
|
CREATE_SHARED_LINK_ACCESS_OPTIONS: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
{
|
|
37
|
+
value: "viewer",
|
|
38
|
+
label: "Users who use the link can view and comment on the content",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "editor",
|
|
42
|
+
label: "Users who use the link can edit, view and comment on the content. Note, not all file types support edit links yet.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: "max",
|
|
46
|
+
label: "Request for the maximum access level you can set the link to",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "default",
|
|
50
|
+
label: "Request for the default access level the user has set",
|
|
51
|
+
},
|
|
41
52
|
],
|
|
42
53
|
CREATE_SHARED_LINK_REQUESTED_VISIBILITY_OPTIONS: [
|
|
43
54
|
"public",
|
package/dropbox.app.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import common from "../common/common.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
...common,
|
|
@@ -6,7 +7,7 @@ export default {
|
|
|
6
7
|
type: "source",
|
|
7
8
|
key: "dropbox-all-updates",
|
|
8
9
|
name: "New or Modified File or Folder",
|
|
9
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.17",
|
|
10
11
|
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.",
|
|
11
12
|
props: {
|
|
12
13
|
...common.props,
|
|
@@ -25,14 +26,20 @@ export default {
|
|
|
25
26
|
},
|
|
26
27
|
hooks: {
|
|
27
28
|
async activate() {
|
|
28
|
-
await this.getHistoricalEvents(
|
|
29
|
-
"file",
|
|
30
|
-
"folder",
|
|
31
|
-
]);
|
|
29
|
+
await this.getHistoricalEvents(this.getFileTypes());
|
|
32
30
|
const state = await this.dropbox.initState(this);
|
|
33
31
|
this._setDropboxState(state);
|
|
34
32
|
},
|
|
35
33
|
},
|
|
34
|
+
methods: {
|
|
35
|
+
...common.methods,
|
|
36
|
+
getFileTypes() {
|
|
37
|
+
return [
|
|
38
|
+
"file",
|
|
39
|
+
"folder",
|
|
40
|
+
];
|
|
41
|
+
},
|
|
42
|
+
},
|
|
36
43
|
async run() {
|
|
37
44
|
const state = this._getDropboxState();
|
|
38
45
|
const {
|
|
@@ -43,10 +50,14 @@ export default {
|
|
|
43
50
|
let file = {
|
|
44
51
|
...update,
|
|
45
52
|
};
|
|
46
|
-
|
|
53
|
+
const fileTypes = this.getFileTypes();
|
|
54
|
+
if (!fileTypes.includes(file[".tag"])) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (this.includeMediaInfo && file[".tag"] === "file") {
|
|
47
58
|
file = await this.getMediaInfo(update);
|
|
48
59
|
}
|
|
49
|
-
if (this.includeLink) {
|
|
60
|
+
if (this.includeLink && file[".tag"] === "file") {
|
|
50
61
|
file.link = await this.getTemporaryLink(update);
|
|
51
62
|
}
|
|
52
63
|
// new unique identification from merging the file id and the last file revision
|
|
@@ -56,4 +67,5 @@ export default {
|
|
|
56
67
|
this.$emit(file, this.getMeta(id, file.path_display || file.id));
|
|
57
68
|
}
|
|
58
69
|
},
|
|
70
|
+
sampleEmit,
|
|
59
71
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
".tag": "file",
|
|
3
|
+
"name": "Document.docx",
|
|
4
|
+
"path_lower": "/document.docx",
|
|
5
|
+
"path_display": "/Document.docx",
|
|
6
|
+
"id": "id:yVswVBnnL7cAAAAAAAAAdg",
|
|
7
|
+
"client_modified": "2023-04-27T17:50:32Z",
|
|
8
|
+
"server_modified": "2023-07-17T19:28:05Z",
|
|
9
|
+
"rev": "01600b3cc31f26000000002574cf900",
|
|
10
|
+
"size": 10468,
|
|
11
|
+
"is_downloadable": true,
|
|
12
|
+
"content_hash": "065e09a66c9bb9264a6657083c9e7a06f8e2e9bc6a5420900c737250ed108147",
|
|
13
|
+
"link": "https://uc2aea9ca1ec13663730d4f924d1.dl.dropboxusercontent.com/cd/0/get/CWzN/file"
|
|
14
|
+
}
|
|
@@ -44,7 +44,7 @@ export default {
|
|
|
44
44
|
if (!fileTypes.includes(file[".tag"])) {
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
if (this.includeLink) {
|
|
47
|
+
if (this.includeLink && file[".tag"] === "file") {
|
|
48
48
|
file.link = await this.getTemporaryLink(file);
|
|
49
49
|
}
|
|
50
50
|
this.$emit(file, this.getMeta(file.id, file.path_display || file.id));
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
type: "source",
|
|
8
8
|
key: "dropbox-new-file",
|
|
9
9
|
name: "New File",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.18",
|
|
11
11
|
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.",
|
|
12
12
|
props: {
|
|
13
13
|
...common.props,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import common from "../common/common.mjs";
|
|
2
|
+
import sampleEmit from "./test-event.mjs";
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
...common,
|
|
@@ -6,7 +7,7 @@ export default {
|
|
|
6
7
|
type: "source",
|
|
7
8
|
key: "dropbox-new-folder",
|
|
8
9
|
name: "New Folder",
|
|
9
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.17",
|
|
10
11
|
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.",
|
|
11
12
|
hooks: {
|
|
12
13
|
async activate() {
|
|
@@ -30,4 +31,5 @@ export default {
|
|
|
30
31
|
this.$emit(update, this.getMeta(update.id, update.path_display || update.id));
|
|
31
32
|
}
|
|
32
33
|
},
|
|
34
|
+
sampleEmit,
|
|
33
35
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
".tag": "folder",
|
|
3
|
+
"name": "Clients",
|
|
4
|
+
"path_lower": "/clients",
|
|
5
|
+
"path_display": "/Clients",
|
|
6
|
+
"id": "id:yVswVBnnL7cAAAAAAAAAbQ",
|
|
7
|
+
"shared_folder_id": "4005125857",
|
|
8
|
+
"sharing_info": {
|
|
9
|
+
"read_only": false,
|
|
10
|
+
"shared_folder_id": "4005125857",
|
|
11
|
+
"traverse_only": false,
|
|
12
|
+
"no_access": false
|
|
13
|
+
}
|
|
14
|
+
}
|