@pipedream/dropbox 0.3.17 → 0.3.19
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/README.md +9 -13
- package/actions/create-a-text-file/create-a-text-file.mjs +6 -3
- package/actions/create-folder/create-folder.mjs +6 -3
- package/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs +6 -3
- package/actions/create-update-share-link/create-update-share-link.mjs +8 -4
- package/actions/delete-file-folder/delete-file-folder.mjs +8 -4
- package/actions/download-file-to-tmp/download-file-to-tmp.mjs +5 -3
- package/actions/list-file-folders-in-a-folder/list-file-folders-in-a-folder.mjs +6 -3
- package/actions/list-file-revisions/list-file-revisions.mjs +5 -3
- package/actions/move-file-folder/move-file-folder.mjs +10 -6
- package/actions/rename-file-folder/rename-file-folder.mjs +8 -4
- package/actions/restore-a-file/restore-a-file.mjs +9 -4
- package/actions/search-files-folders/search-files-folders.mjs +6 -4
- package/actions/upload-file/upload-file.mjs +7 -4
- package/common/config.mjs +1 -1
- package/dropbox.app.mjs +74 -165
- package/package.json +4 -3
- package/sources/all-updates/all-updates.mjs +1 -1
- package/sources/common/common.mjs +5 -1
- package/sources/new-file/new-file.mjs +1 -1
- package/sources/new-folder/new-folder.mjs +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
# Overview
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
- A task management application that allows users to manage and share tasks and
|
|
13
|
-
files
|
|
14
|
-
- A document management application that allows users to manage and share
|
|
15
|
-
documents and files
|
|
3
|
+
The Dropbox API on Pipedream enables you to automate file and folder operations, streamlining workflows that involve storing, syncing, and sharing content. With this API, you can programmatically manage files, set up event-driven triggers based on changes within Dropbox, and leverage Pipedream's capabilities to connect with hundreds of other apps for extended automation scenarios. It's ideal for building custom file management solutions, archiving systems, or collaborative content workflows without writing extensive code.
|
|
4
|
+
|
|
5
|
+
# Example Use Cases
|
|
6
|
+
|
|
7
|
+
- **Automated Backup to Dropbox**: Whenever a new file is uploaded to an FTP server, trigger a Pipedream workflow that automatically uploads this file to a specified Dropbox folder. This can serve as an off-site backup system for important documents or media files, ensuring they are safe and accessible from anywhere.
|
|
8
|
+
|
|
9
|
+
- **Content Approval Workflow**: Create a system where new files added to a specific Dropbox folder trigger a Pipedream workflow, sending an approval request via Slack to a designated approver. Once the approver responds with approval, the workflow moves the file to a 'Published' folder within Dropbox, or if rejected, sends a notification back to the submitter with feedback.
|
|
10
|
+
|
|
11
|
+
- **Dropbox to Google Sheets Logging**: Every time a new file is added to a Dropbox folder, a Pipedream workflow extracts relevant metadata (like filename, size, and upload date) and appends it to a Google Sheets spreadsheet. This creates an ongoing log for tracking uploads, which is particularly useful for teams needing to maintain records of content updates and revisions.
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
name: "Create a Text File",
|
|
5
5
|
description: "Creates a brand new text file from plain text content you specify. [See docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -16,9 +16,12 @@ export default {
|
|
|
16
16
|
path: {
|
|
17
17
|
propDefinition: [
|
|
18
18
|
dropbox,
|
|
19
|
-
"
|
|
19
|
+
"path",
|
|
20
|
+
() => ({
|
|
21
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
22
|
+
}),
|
|
20
23
|
],
|
|
21
|
-
description: "
|
|
24
|
+
description: "Type the folder name to search for it in the user's Dropbox. If not filled, it will be created in the root folder.",
|
|
22
25
|
},
|
|
23
26
|
content: {
|
|
24
27
|
type: "string",
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
name: "Create folder",
|
|
5
5
|
description: "Create a folder. [See docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -16,10 +16,13 @@ export default {
|
|
|
16
16
|
path: {
|
|
17
17
|
propDefinition: [
|
|
18
18
|
dropbox,
|
|
19
|
-
"
|
|
19
|
+
"path",
|
|
20
|
+
() => ({
|
|
21
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
22
|
+
}),
|
|
20
23
|
],
|
|
21
24
|
optional: true,
|
|
22
|
-
description: "
|
|
25
|
+
description: "Type the folder name to search for it in the user's Dropbox. If not filled, it will be created in the root folder.",
|
|
23
26
|
},
|
|
24
27
|
autorename: {
|
|
25
28
|
type: "boolean",
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
name: "Create or Append to a Text File",
|
|
5
5
|
description: "Adds a new line to an existing text file, or creates a file if it doesn't exist. [See docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
@@ -16,10 +16,13 @@ export default {
|
|
|
16
16
|
path: {
|
|
17
17
|
propDefinition: [
|
|
18
18
|
dropbox,
|
|
19
|
-
"
|
|
19
|
+
"path",
|
|
20
|
+
() => ({
|
|
21
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
22
|
+
}),
|
|
20
23
|
],
|
|
21
24
|
optional: true,
|
|
22
|
-
description: "
|
|
25
|
+
description: "Type the folder name to search for it in the user's Dropbox. If not filled, it will be created in the root folder.",
|
|
23
26
|
},
|
|
24
27
|
content: {
|
|
25
28
|
type: "string",
|
|
@@ -5,19 +5,23 @@ export default {
|
|
|
5
5
|
name: "Create/Update a Share Link",
|
|
6
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 docs here](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.9",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
dropbox,
|
|
12
12
|
path: {
|
|
13
13
|
propDefinition: [
|
|
14
14
|
dropbox,
|
|
15
|
-
"
|
|
15
|
+
"path",
|
|
16
16
|
() => ({
|
|
17
|
-
|
|
17
|
+
initialOptions: [],
|
|
18
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => [
|
|
19
|
+
"file",
|
|
20
|
+
"folder",
|
|
21
|
+
].includes(type),
|
|
18
22
|
}),
|
|
19
23
|
],
|
|
20
|
-
description: "
|
|
24
|
+
description: "Type the file or folder name to search for it in the user's Dropbox.",
|
|
21
25
|
},
|
|
22
26
|
requirePassword: {
|
|
23
27
|
type: "boolean",
|
|
@@ -4,19 +4,23 @@ export default {
|
|
|
4
4
|
name: "Delete a File/Folder",
|
|
5
5
|
description: "Permanently removes a file/folder from the server. [See docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
path: {
|
|
12
12
|
propDefinition: [
|
|
13
13
|
dropbox,
|
|
14
|
-
"
|
|
14
|
+
"path",
|
|
15
15
|
() => ({
|
|
16
|
-
|
|
16
|
+
initialOptions: [],
|
|
17
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => [
|
|
18
|
+
"file",
|
|
19
|
+
"folder",
|
|
20
|
+
].includes(type),
|
|
17
21
|
}),
|
|
18
22
|
],
|
|
19
|
-
description: "
|
|
23
|
+
description: "Type the file or folder name to search for it in the user's Dropbox.",
|
|
20
24
|
},
|
|
21
25
|
},
|
|
22
26
|
async run({ $ }) {
|
|
@@ -6,16 +6,18 @@ 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.5",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
dropbox,
|
|
13
13
|
path: {
|
|
14
14
|
propDefinition: [
|
|
15
15
|
dropbox,
|
|
16
|
-
"
|
|
16
|
+
"path",
|
|
17
|
+
() => ({
|
|
18
|
+
initialOptions: [],
|
|
19
|
+
}),
|
|
17
20
|
],
|
|
18
|
-
description: "The file path in the user's Dropbox to download.",
|
|
19
21
|
},
|
|
20
22
|
name: {
|
|
21
23
|
type: "string",
|
|
@@ -4,16 +4,19 @@ export default {
|
|
|
4
4
|
name: "List All Files/Subfolders in a Folder",
|
|
5
5
|
description: "Retrieves a list of files or subfolders in a specified folder [See the docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
path: {
|
|
12
12
|
propDefinition: [
|
|
13
13
|
dropbox,
|
|
14
|
-
"
|
|
14
|
+
"path",
|
|
15
|
+
() => ({
|
|
16
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
17
|
+
}),
|
|
15
18
|
],
|
|
16
|
-
description: "
|
|
19
|
+
description: "Type the folder name to search for it in the user's Dropbox.",
|
|
17
20
|
},
|
|
18
21
|
recursive: {
|
|
19
22
|
type: "boolean",
|
|
@@ -5,16 +5,18 @@ export default {
|
|
|
5
5
|
name: "List File Revisions",
|
|
6
6
|
description: "Retrieves a list of file revisions needed to recover previous content. [See docs here](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.9",
|
|
9
9
|
type: "action",
|
|
10
10
|
props: {
|
|
11
11
|
dropbox,
|
|
12
12
|
path: {
|
|
13
13
|
propDefinition: [
|
|
14
14
|
dropbox,
|
|
15
|
-
"
|
|
15
|
+
"path",
|
|
16
|
+
() => ({
|
|
17
|
+
initialOptions: [],
|
|
18
|
+
}),
|
|
16
19
|
],
|
|
17
|
-
description: "The file path for the file whose revisions you'd like to list.",
|
|
18
20
|
},
|
|
19
21
|
mode: {
|
|
20
22
|
type: "string",
|
|
@@ -4,28 +4,32 @@ export default {
|
|
|
4
4
|
name: "Move a File/Folder",
|
|
5
5
|
description: "Moves a file or folder to a different location in the user's Dropbox [See the docs here](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.10",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
pathFrom: {
|
|
12
12
|
propDefinition: [
|
|
13
13
|
dropbox,
|
|
14
|
-
"
|
|
14
|
+
"path",
|
|
15
15
|
() => ({
|
|
16
|
-
|
|
16
|
+
initialOptions: [],
|
|
17
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => [
|
|
18
|
+
"file",
|
|
19
|
+
"folder",
|
|
20
|
+
].includes(type),
|
|
17
21
|
}),
|
|
18
22
|
],
|
|
19
23
|
label: "Path from",
|
|
20
|
-
description: "
|
|
24
|
+
description: "Type the file or folder name to search for it in the user's Dropbox.",
|
|
21
25
|
},
|
|
22
26
|
pathTo: {
|
|
23
27
|
propDefinition: [
|
|
24
28
|
dropbox,
|
|
25
|
-
"
|
|
29
|
+
"path",
|
|
26
30
|
],
|
|
27
31
|
label: "Path to",
|
|
28
|
-
description: "
|
|
32
|
+
description: "Type the folder name to search for it in the user's Dropbox. If not filled, it will be moved in the root folder.",
|
|
29
33
|
},
|
|
30
34
|
autorename: {
|
|
31
35
|
type: "boolean",
|
|
@@ -4,20 +4,24 @@ export default {
|
|
|
4
4
|
name: "Rename a File/Folder",
|
|
5
5
|
description: "Renames a file or folder in the user's Dropbox [See the docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
pathFrom: {
|
|
12
12
|
propDefinition: [
|
|
13
13
|
dropbox,
|
|
14
|
-
"
|
|
14
|
+
"path",
|
|
15
15
|
() => ({
|
|
16
|
-
|
|
16
|
+
initialOptions: [],
|
|
17
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => [
|
|
18
|
+
"file",
|
|
19
|
+
"folder",
|
|
20
|
+
].includes(type),
|
|
17
21
|
}),
|
|
18
22
|
],
|
|
19
23
|
label: "Path From",
|
|
20
|
-
description: "
|
|
24
|
+
description: "Type the file or folder name to search for it in the user's Dropbox.",
|
|
21
25
|
},
|
|
22
26
|
newName: {
|
|
23
27
|
type: "string",
|
|
@@ -4,19 +4,24 @@ export default {
|
|
|
4
4
|
name: "Restore a File",
|
|
5
5
|
description: "Restores a previous file version. [See docs here](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.9",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
dropbox,
|
|
11
11
|
path: {
|
|
12
12
|
propDefinition: [
|
|
13
13
|
dropbox,
|
|
14
|
-
"
|
|
14
|
+
"path",
|
|
15
15
|
() => ({
|
|
16
|
-
|
|
16
|
+
initialOptions: [],
|
|
17
|
+
params: {
|
|
18
|
+
options: {
|
|
19
|
+
file_status: "deleted",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
17
22
|
}),
|
|
18
23
|
],
|
|
19
|
-
description: "
|
|
24
|
+
description: "Type the file name to search for it in the user's Dropbox.",
|
|
20
25
|
},
|
|
21
26
|
rev: {
|
|
22
27
|
propDefinition: [
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
name: "Search files and folders",
|
|
7
7
|
description: "Searches for files and folders by name. [See the docs here](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.9",
|
|
10
10
|
type: "action",
|
|
11
11
|
props: {
|
|
12
12
|
dropbox,
|
|
@@ -19,10 +19,12 @@ export default {
|
|
|
19
19
|
path: {
|
|
20
20
|
propDefinition: [
|
|
21
21
|
dropbox,
|
|
22
|
-
"
|
|
22
|
+
"path",
|
|
23
|
+
() => ({
|
|
24
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
25
|
+
}),
|
|
23
26
|
],
|
|
24
|
-
|
|
25
|
-
description: "Scopes the search to a path in the user's Dropbox. Searches the entire Dropbox if not specified.",
|
|
27
|
+
description: "Type the folder name to search for it in the user's Dropbox.",
|
|
26
28
|
},
|
|
27
29
|
orderBy: {
|
|
28
30
|
type: "string",
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import dropbox from "../../dropbox.app.mjs";
|
|
2
2
|
import consts from "../../common/consts.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import got from "got
|
|
4
|
+
import got from "got";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
name: "Upload a File",
|
|
8
8
|
description: "Uploads a file to a selected folder. [See docs here](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)",
|
|
9
9
|
key: "dropbox-upload-file",
|
|
10
|
-
version: "0.0.
|
|
10
|
+
version: "0.0.12",
|
|
11
11
|
type: "action",
|
|
12
12
|
props: {
|
|
13
13
|
dropbox,
|
|
14
14
|
path: {
|
|
15
15
|
propDefinition: [
|
|
16
16
|
dropbox,
|
|
17
|
-
"
|
|
17
|
+
"path",
|
|
18
|
+
() => ({
|
|
19
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
20
|
+
}),
|
|
18
21
|
],
|
|
19
|
-
description: "
|
|
22
|
+
description: "Type the folder name to search for it in the user's Dropbox. If not filled, it will be created in the root folder.",
|
|
20
23
|
},
|
|
21
24
|
name: {
|
|
22
25
|
type: "string",
|
package/common/config.mjs
CHANGED
package/dropbox.app.mjs
CHANGED
|
@@ -12,81 +12,90 @@ export default {
|
|
|
12
12
|
type: "app",
|
|
13
13
|
app: "dropbox",
|
|
14
14
|
propDefinitions: {
|
|
15
|
-
|
|
15
|
+
path: {
|
|
16
16
|
type: "string",
|
|
17
17
|
label: "Path",
|
|
18
|
-
description: "
|
|
18
|
+
description: "Type the file name to search for it in the user's Dropbox.",
|
|
19
19
|
useQuery: true,
|
|
20
20
|
withLabel: true,
|
|
21
21
|
async options({
|
|
22
|
-
prevContext,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
omitRootFolder,
|
|
26
|
-
}) {
|
|
27
|
-
if (prevContext?.reachedLastPage) {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
return this.getPathOptions(
|
|
31
|
-
query,
|
|
32
|
-
prevContext?.cursor,
|
|
22
|
+
query, prevContext: { cursor },
|
|
23
|
+
params,
|
|
24
|
+
initialOptions = [
|
|
33
25
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
omitRootFolder,
|
|
26
|
+
label: "Root Folder",
|
|
27
|
+
value: "",
|
|
37
28
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
description: "The file path. (Please use a valid path to filter the values)",
|
|
45
|
-
useQuery: true,
|
|
46
|
-
withLabel: true,
|
|
47
|
-
async options({
|
|
48
|
-
prevContext,
|
|
49
|
-
query,
|
|
50
|
-
returnSimpleString,
|
|
51
|
-
omitRootFolder,
|
|
29
|
+
],
|
|
30
|
+
filter = ({ metadata: { metadata: { [".tag"]: type } } }) => type === "file",
|
|
31
|
+
mapper = ({ metadata: { metadata } }) => ({
|
|
32
|
+
label: metadata.path_display,
|
|
33
|
+
value: metadata.path_lower,
|
|
34
|
+
}),
|
|
52
35
|
}) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
36
|
+
try {
|
|
37
|
+
const dpx = await this.sdk();
|
|
38
|
+
|
|
39
|
+
if (cursor === null) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (cursor) {
|
|
44
|
+
const {
|
|
45
|
+
result: {
|
|
46
|
+
matches,
|
|
47
|
+
cursor: nextCursor,
|
|
48
|
+
has_more: hasMore,
|
|
49
|
+
},
|
|
50
|
+
} = await dpx.filesSearchContinueV2({
|
|
51
|
+
cursor,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
options: matches
|
|
56
|
+
.filter(filter)
|
|
57
|
+
.map(mapper),
|
|
58
|
+
context: {
|
|
59
|
+
cursor: hasMore
|
|
60
|
+
? nextCursor
|
|
61
|
+
: null,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
result: {
|
|
68
|
+
matches,
|
|
69
|
+
cursor: nextCursor,
|
|
70
|
+
has_more: hasMore,
|
|
71
|
+
},
|
|
72
|
+
} = await dpx.filesSearchV2({
|
|
73
|
+
...params,
|
|
74
|
+
query: query || "text",
|
|
75
|
+
options: {
|
|
76
|
+
path: params?.path || "",
|
|
77
|
+
max_results: config.SEARCH_FILE_FOLDERS.DEFAULT_MAX_RESULTS,
|
|
78
|
+
...params?.options,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
options: initialOptions.concat(
|
|
84
|
+
matches
|
|
85
|
+
.filter(filter)
|
|
86
|
+
.map(mapper),
|
|
87
|
+
),
|
|
88
|
+
context: {
|
|
89
|
+
cursor: hasMore
|
|
90
|
+
? nextCursor
|
|
91
|
+
: null,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.log("Error searching for files/folders", error);
|
|
80
97
|
return [];
|
|
81
98
|
}
|
|
82
|
-
return this.getPathOptions(
|
|
83
|
-
query,
|
|
84
|
-
prevContext?.cursor,
|
|
85
|
-
{
|
|
86
|
-
returnSimpleString,
|
|
87
|
-
omitRootFolder,
|
|
88
|
-
},
|
|
89
|
-
);
|
|
90
99
|
},
|
|
91
100
|
},
|
|
92
101
|
fileRevision: {
|
|
@@ -192,106 +201,6 @@ export default {
|
|
|
192
201
|
this.normalizeError(err);
|
|
193
202
|
}
|
|
194
203
|
},
|
|
195
|
-
async getPathOptions(path, prevCursor, opts = {}) {
|
|
196
|
-
try {
|
|
197
|
-
const {
|
|
198
|
-
omitFolders,
|
|
199
|
-
omitFiles,
|
|
200
|
-
omitRootFolder,
|
|
201
|
-
} = opts;
|
|
202
|
-
|
|
203
|
-
let data = [];
|
|
204
|
-
let res = null;
|
|
205
|
-
path = path === "/" || path === null
|
|
206
|
-
? ""
|
|
207
|
-
: path;
|
|
208
|
-
|
|
209
|
-
if (path.length > 0 && !path.startsWith("/")) {
|
|
210
|
-
path = "/" + path;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const dpx = await this.sdk();
|
|
214
|
-
if (path === "") {
|
|
215
|
-
res = await dpx.filesListFolder({
|
|
216
|
-
path,
|
|
217
|
-
limit: config.GET_PATH_OPTIONS.DEFAULT_MAX_RESULTS,
|
|
218
|
-
recursive: true,
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
data = res.result.entries.map((item) => ({
|
|
222
|
-
path: item.path_display,
|
|
223
|
-
type: item[".tag"],
|
|
224
|
-
}));
|
|
225
|
-
} else {
|
|
226
|
-
let subpath = "";
|
|
227
|
-
let query = path;
|
|
228
|
-
if ((path.match(/\//g) || []).length > 1) {
|
|
229
|
-
const splitPath = path.split("/");
|
|
230
|
-
query = splitPath.pop();
|
|
231
|
-
subpath = splitPath.join("/");
|
|
232
|
-
}
|
|
233
|
-
res = await this.searchFilesFolders({
|
|
234
|
-
query,
|
|
235
|
-
options: {
|
|
236
|
-
path: subpath,
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
data = res.map(({ metadata }) => ({
|
|
241
|
-
path: metadata.metadata.path_display,
|
|
242
|
-
type: metadata.metadata[".tag"],
|
|
243
|
-
}));
|
|
244
|
-
|
|
245
|
-
const folders = data.filter((item) => item.type !== "file");
|
|
246
|
-
for (const folder of folders) {
|
|
247
|
-
res = await dpx.filesListFolder({
|
|
248
|
-
path: folder.path,
|
|
249
|
-
recursive: true,
|
|
250
|
-
});
|
|
251
|
-
const folderData = res.result?.entries?.map((item) => ({
|
|
252
|
-
path: item.path_display,
|
|
253
|
-
type: item[".tag"],
|
|
254
|
-
}));
|
|
255
|
-
data.push(...folderData);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (omitFiles) {
|
|
260
|
-
data = data.filter((item) => item.type !== "file");
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (omitFolders) {
|
|
264
|
-
data = data.filter((item) => item.type !== "folder");
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
data = data.map((item) => ({
|
|
268
|
-
label: item.path,
|
|
269
|
-
value: item.path,
|
|
270
|
-
}));
|
|
271
|
-
|
|
272
|
-
if (path === "" && !omitFolders && !omitRootFolder) {
|
|
273
|
-
data = [
|
|
274
|
-
{
|
|
275
|
-
label: "Root Folder",
|
|
276
|
-
value: "",
|
|
277
|
-
},
|
|
278
|
-
...data,
|
|
279
|
-
];
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
data.sort((a, b) => {
|
|
283
|
-
return a > b ?
|
|
284
|
-
1 :
|
|
285
|
-
-1;
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
return data;
|
|
289
|
-
|
|
290
|
-
} catch (err) {
|
|
291
|
-
console.log(err);
|
|
292
|
-
return [];
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
204
|
async initState(context) {
|
|
296
205
|
const {
|
|
297
206
|
path,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/dropbox",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "Pipedream Dropbox Components",
|
|
5
5
|
"main": "dropbox.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
"homepage": "https://pipedream.com/apps/dropbox",
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@types/node-fetch": "^2.5.7",
|
|
13
14
|
"dropbox": "^10.34.0",
|
|
14
|
-
"
|
|
15
|
+
"got": "^14.0.0",
|
|
15
16
|
"isomorphic-fetch": "^3.0.0",
|
|
16
17
|
"lodash": "^4.17.21",
|
|
17
|
-
"
|
|
18
|
+
"tmp-promise": "^3.0.3"
|
|
18
19
|
},
|
|
19
20
|
"gitHead": "e12480b94cc03bed4808ebc6b13e7fdb3a1ba535",
|
|
20
21
|
"publishConfig": {
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
type: "source",
|
|
7
7
|
key: "dropbox-all-updates",
|
|
8
8
|
name: "New or Modified File or Folder",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.16",
|
|
10
10
|
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
11
|
props: {
|
|
12
12
|
...common.props,
|
|
@@ -7,8 +7,12 @@ export default {
|
|
|
7
7
|
path: {
|
|
8
8
|
propDefinition: [
|
|
9
9
|
dropbox,
|
|
10
|
-
"
|
|
10
|
+
"path",
|
|
11
|
+
() => ({
|
|
12
|
+
filter: ({ metadata: { metadata: { [".tag"]: type } } }) => type === "folder",
|
|
13
|
+
}),
|
|
11
14
|
],
|
|
15
|
+
description: "Type the folder name to search for it in the user's Dropbox.",
|
|
12
16
|
},
|
|
13
17
|
recursive: {
|
|
14
18
|
propDefinition: [
|
|
@@ -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.17",
|
|
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,
|
|
@@ -6,7 +6,7 @@ export default {
|
|
|
6
6
|
type: "source",
|
|
7
7
|
key: "dropbox-new-folder",
|
|
8
8
|
name: "New Folder",
|
|
9
|
-
version: "0.0.
|
|
9
|
+
version: "0.0.16",
|
|
10
10
|
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
11
|
hooks: {
|
|
12
12
|
async activate() {
|