@pipedream/dropbox 0.4.1 → 1.0.1
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.
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
name: "Download File to TMP",
|
|
10
10
|
description: "Download a specific file to the temporary directory. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor).",
|
|
11
11
|
key: "dropbox-download-file-to-tmp",
|
|
12
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.8",
|
|
13
13
|
type: "action",
|
|
14
14
|
props: {
|
|
15
15
|
dropbox,
|
|
@@ -28,6 +28,11 @@ export default {
|
|
|
28
28
|
description: "The new name of the file to be saved, including it's extension. e.g: `myFile.csv`",
|
|
29
29
|
optional: true,
|
|
30
30
|
},
|
|
31
|
+
syncDir: {
|
|
32
|
+
type: "dir",
|
|
33
|
+
accessMode: "write",
|
|
34
|
+
sync: true,
|
|
35
|
+
},
|
|
31
36
|
},
|
|
32
37
|
async run({ $ }) {
|
|
33
38
|
try {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import got from "got";
|
|
1
|
+
import { getFileStream } from "@pipedream/platform";
|
|
4
2
|
import consts from "../../common/consts.mjs";
|
|
5
3
|
import dropbox from "../../dropbox.app.mjs";
|
|
6
4
|
|
|
@@ -8,7 +6,7 @@ export default {
|
|
|
8
6
|
name: "Upload a File",
|
|
9
7
|
description: "Uploads a file to a selected folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)",
|
|
10
8
|
key: "dropbox-upload-file",
|
|
11
|
-
version: "
|
|
9
|
+
version: "1.0.1",
|
|
12
10
|
type: "action",
|
|
13
11
|
props: {
|
|
14
12
|
dropbox,
|
|
@@ -27,17 +25,10 @@ export default {
|
|
|
27
25
|
label: "File Name",
|
|
28
26
|
description: "The name of your new file (make sure to include the file extension).",
|
|
29
27
|
},
|
|
30
|
-
fileUrl: {
|
|
31
|
-
type: "string",
|
|
32
|
-
label: "File URL",
|
|
33
|
-
description: "The URL of the file you want to upload to Dropbox. Must specify either File URL or File Path.",
|
|
34
|
-
optional: true,
|
|
35
|
-
},
|
|
36
28
|
filePath: {
|
|
37
29
|
type: "string",
|
|
38
|
-
label: "File Path",
|
|
39
|
-
description: "
|
|
40
|
-
optional: true,
|
|
30
|
+
label: "File Path or URL",
|
|
31
|
+
description: "Provide either a file URL or a path to a file in the /tmp directory (for example, /tmp/myFile.pdf).",
|
|
41
32
|
},
|
|
42
33
|
autorename: {
|
|
43
34
|
type: "boolean",
|
|
@@ -64,10 +55,15 @@ export default {
|
|
|
64
55
|
options: consts.UPLOAD_FILE_MODE_OPTIONS,
|
|
65
56
|
optional: true,
|
|
66
57
|
},
|
|
58
|
+
syncDir: {
|
|
59
|
+
type: "dir",
|
|
60
|
+
accessMode: "read",
|
|
61
|
+
sync: true,
|
|
62
|
+
optional: true,
|
|
63
|
+
},
|
|
67
64
|
},
|
|
68
65
|
async run({ $ }) {
|
|
69
66
|
const {
|
|
70
|
-
fileUrl,
|
|
71
67
|
filePath,
|
|
72
68
|
path,
|
|
73
69
|
name,
|
|
@@ -78,13 +74,7 @@ export default {
|
|
|
78
74
|
clientModified,
|
|
79
75
|
} = this;
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
throw new ConfigurationError("Must specify either File URL or File Path.");
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const contents = fileUrl
|
|
86
|
-
? await got.stream(fileUrl)
|
|
87
|
-
: fs.createReadStream(filePath);
|
|
77
|
+
const contents = await getFileStream(filePath);
|
|
88
78
|
|
|
89
79
|
let normalizedPath = this.dropbox.getNormalizedPath(path, true);
|
|
90
80
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
getFileStream, ConfigurationError,
|
|
3
|
+
} from "@pipedream/platform";
|
|
4
4
|
import consts from "../../common/consts.mjs";
|
|
5
5
|
import dropbox from "../../dropbox.app.mjs";
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "Upload Multiple Files",
|
|
9
9
|
description: "Uploads multiple file to a selected folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)",
|
|
10
10
|
key: "dropbox-upload-multiple-files",
|
|
11
|
-
version: "
|
|
11
|
+
version: "1.0.1",
|
|
12
12
|
type: "action",
|
|
13
13
|
props: {
|
|
14
14
|
dropbox,
|
|
@@ -22,19 +22,10 @@ export default {
|
|
|
22
22
|
],
|
|
23
23
|
description: "The folder to upload to. Type the folder name to search for it in the user's Dropbox.",
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
filesPaths: {
|
|
26
26
|
type: "string[]",
|
|
27
|
-
label: "File URLs",
|
|
28
|
-
description: "
|
|
29
|
-
default: [],
|
|
30
|
-
optional: true,
|
|
31
|
-
},
|
|
32
|
-
filePaths: {
|
|
33
|
-
type: "string[]",
|
|
34
|
-
label: "File Paths",
|
|
35
|
-
description: "The paths to the files, e.g. /tmp/myFile.csv . Must specify either File URLs or File Paths.",
|
|
36
|
-
default: [],
|
|
37
|
-
optional: true,
|
|
27
|
+
label: "File Paths or URLs",
|
|
28
|
+
description: "Provide an array of either file URLs or paths to a files in the /tmp directory (for example, /tmp/myFile.pdf).",
|
|
38
29
|
},
|
|
39
30
|
filenames: {
|
|
40
31
|
type: "string[]",
|
|
@@ -66,13 +57,18 @@ export default {
|
|
|
66
57
|
options: consts.UPLOAD_FILE_MODE_OPTIONS,
|
|
67
58
|
optional: true,
|
|
68
59
|
},
|
|
60
|
+
syncDir: {
|
|
61
|
+
type: "dir",
|
|
62
|
+
accessMode: "read",
|
|
63
|
+
sync: true,
|
|
64
|
+
optional: true,
|
|
65
|
+
},
|
|
69
66
|
},
|
|
70
67
|
async run({ $ }) {
|
|
71
68
|
const {
|
|
72
69
|
dropbox,
|
|
73
70
|
path,
|
|
74
|
-
|
|
75
|
-
filePaths,
|
|
71
|
+
filesPaths,
|
|
76
72
|
autorename,
|
|
77
73
|
mute,
|
|
78
74
|
strictConflict,
|
|
@@ -80,11 +76,7 @@ export default {
|
|
|
80
76
|
filenames,
|
|
81
77
|
} = this;
|
|
82
78
|
|
|
83
|
-
|
|
84
|
-
throw new ConfigurationError("Must specify either File URLs or File Paths.");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const numFiles = fileUrls.length + filePaths.length;
|
|
79
|
+
const numFiles = filesPaths.length;
|
|
88
80
|
if (numFiles !== filenames.length) {
|
|
89
81
|
throw new ConfigurationError(`Number of filenames must match number of files. Detected ${numFiles} file(s) and ${filenames.length} filename(s)`);
|
|
90
82
|
}
|
|
@@ -93,24 +85,13 @@ export default {
|
|
|
93
85
|
const normalizedPath = dropbox.getNormalizedPath(path, true);
|
|
94
86
|
let i = 0;
|
|
95
87
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (filePaths?.length) {
|
|
107
|
-
for (const filePath of filePaths) {
|
|
108
|
-
fileInfo.push({
|
|
109
|
-
contents: fs.createReadStream(filePath),
|
|
110
|
-
path: `${normalizedPath}${filenames[i]}`,
|
|
111
|
-
});
|
|
112
|
-
i++;
|
|
113
|
-
}
|
|
88
|
+
for (const file of filesPaths) {
|
|
89
|
+
const contents = await getFileStream(file);
|
|
90
|
+
fileInfo.push({
|
|
91
|
+
contents,
|
|
92
|
+
path: `${normalizedPath}${filenames[i]}`,
|
|
93
|
+
});
|
|
94
|
+
i++;
|
|
114
95
|
}
|
|
115
96
|
|
|
116
97
|
const responses = [];
|
package/common/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/dropbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Pipedream Dropbox Components",
|
|
5
5
|
"main": "dropbox.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"homepage": "https://pipedream.com/apps/dropbox",
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@pipedream/platform": "^3.1.0",
|
|
13
14
|
"@types/node-fetch": "^2.5.7",
|
|
14
15
|
"dropbox": "^10.34.0",
|
|
15
16
|
"got": "^13.0.0",
|