Skip to content

Commit 04a4430

Browse files
committed
Merge branch 'master' into 16814-google-drive-improvement
2 parents 4218008 + a7211d1 commit 04a4430

File tree

88 files changed

+1295
-231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1295
-231
lines changed

components/action1/action1.app.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "action1",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/action1/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/action1",
3+
"version": "0.0.1",
4+
"description": "Pipedream Action1 Components",
5+
"main": "action1.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"action1"
9+
],
10+
"homepage": "https://pipedream.com/apps/action1",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}

components/buddy/buddy.app.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "buddy",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/buddy/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/buddy",
3+
"version": "0.0.1",
4+
"description": "Pipedream Buddy Components",
5+
"main": "buddy.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"buddy"
9+
],
10+
"homepage": "https://pipedream.com/apps/buddy",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}

components/dropbox/actions/create-a-text-file/create-a-text-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
name: "Create a Text File",
55
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)",
66
key: "dropbox-create-a-text-file",
7-
version: "0.0.10",
7+
version: "0.0.11",
88
type: "action",
99
props: {
1010
dropbox,

components/dropbox/actions/create-folder/create-folder.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
name: "Create folder",
55
description: "Create a Folder. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesCreateFolderV2__anchor)",
66
key: "dropbox-create-folder",
7-
version: "0.0.10",
7+
version: "0.0.11",
88
type: "action",
99
props: {
1010
dropbox,

components/dropbox/actions/create-or-append-to-a-text-file/create-or-append-to-a-text-file.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
name: "Create or Append to a Text File",
55
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)",
66
key: "dropbox-create-or-append-to-a-text-file",
7-
version: "0.0.10",
7+
version: "0.0.11",
88
type: "action",
99
props: {
1010
dropbox,

components/dropbox/actions/create-update-share-link/create-update-share-link.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import common from "./common.mjs";
21
import consts from "../../common/consts.mjs";
2+
import common from "./common.mjs";
33

44
export default {
55
name: "Create/Update a Share Link",
66
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)",
77
key: "dropbox-create-update-share-link",
8-
version: "0.0.10",
8+
version: "0.0.11",
99
type: "action",
1010
props: {
1111
...common.props,

components/dropbox/actions/delete-file-folder/delete-file-folder.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
name: "Delete a File/Folder",
55
description: "Permanently removes a file/folder from the server. [See documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDeleteV2__anchor)",
66
key: "dropbox-delete-file-folder",
7-
version: "0.0.10",
7+
version: "0.0.11",
88
type: "action",
99
props: {
1010
dropbox,
Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import dropbox from "../../dropbox.app.mjs";
21
import fs from "fs";
3-
import { file } from "tmp-promise";
2+
import got from "got";
3+
import stream from "stream";
4+
import { promisify } from "util";
5+
import { checkTmp } from "../../common/utils.mjs";
6+
import dropbox from "../../dropbox.app.mjs";
47

58
export default {
69
name: "Download File to TMP",
710
description: "Download a specific file to the temporary directory. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor).",
811
key: "dropbox-download-file-to-tmp",
9-
version: "0.0.6",
12+
version: "0.0.7",
1013
type: "action",
1114
props: {
1215
dropbox,
@@ -27,30 +30,40 @@ export default {
2730
},
2831
},
2932
async run({ $ }) {
30-
const { result } = await this.dropbox.downloadFile({
31-
path: this.dropbox.getNormalizedPath(this.path, false),
32-
});
33+
try {
34+
const linkResponse = await this.dropbox.filesGetTemporaryLink({
35+
path: this.dropbox.getNormalizedPath(this.path, false),
36+
});
37+
38+
console.log("linkResponse: ", linkResponse);
3339

34-
const {
35-
path, cleanup,
36-
} = await file();
40+
if (!linkResponse || !linkResponse.result) {
41+
throw new Error("Failed to get temporary download link from Dropbox");
42+
}
3743

38-
const extension = result.name.split(".").pop();
44+
const {
45+
link, metadata,
46+
} = linkResponse.result;
3947

40-
const tmpPath = this.name
41-
? `/tmp/${this.name}`
42-
: `${path}.${extension}`;
48+
const fileName = this.name || metadata.name;
49+
const cleanFileName = fileName.replace(/[?$#&{}[]<>\*!@:\+\\\/]/g, "");
4350

44-
await fs.promises.appendFile(tmpPath, Buffer.from(result.fileBinary));
45-
await cleanup();
51+
const tmpPath = checkTmp(cleanFileName);
52+
const pipeline = promisify(stream.pipeline);
4653

47-
delete result.fileBinary;
54+
await pipeline(
55+
got.stream(link),
56+
fs.createWriteStream(tmpPath),
57+
);
4858

49-
$.export("$summary", `File successfully saved in "${tmpPath}"`);
59+
$.export("$summary", `File successfully saved in "${tmpPath}"`);
5060

51-
return {
52-
tmpPath,
53-
...result,
54-
};
61+
return {
62+
tmpPath,
63+
...metadata,
64+
};
65+
} catch (error) {
66+
throw new Error(`Failed to download file: ${error.message}`);
67+
}
5568
},
5669
};

0 commit comments

Comments
 (0)