@pipedream/google_drive 0.9.0 → 0.9.2
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.
@@ -7,7 +7,7 @@ export default {
|
|
7
7
|
key: "google_drive-find-folder",
|
8
8
|
name: "Find Folder",
|
9
9
|
description: "Search for a specific folder by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
|
10
|
-
version: "0.1.
|
10
|
+
version: "0.1.9",
|
11
11
|
type: "action",
|
12
12
|
props: {
|
13
13
|
googleDrive,
|
@@ -34,16 +34,24 @@ export default {
|
|
34
34
|
},
|
35
35
|
},
|
36
36
|
async run({ $ }) {
|
37
|
-
|
37
|
+
const escapedSearchTerm = this.nameSearchTerm?.replace(/'/g, "\\'") || "";
|
38
|
+
let q = `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and name contains '${escapedSearchTerm}'`.trim();
|
38
39
|
if (!this.includeTrashed) {
|
39
40
|
q += " and trashed=false";
|
40
41
|
}
|
41
42
|
const opts = getListFilesOpts(this.drive, {
|
42
43
|
q,
|
43
44
|
});
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
|
46
|
+
try {
|
47
|
+
const { files: folders } = await this.googleDrive.listFilesInPage(null, opts);
|
48
|
+
// eslint-disable-next-line multiline-ternary
|
49
|
+
$.export("$summary", `Successfully found ${folders.length} folder${folders.length === 1 ? "" : "s"} containing the term, "${this.nameSearchTerm}"`);
|
50
|
+
return folders;
|
51
|
+
|
52
|
+
} catch (error) {
|
53
|
+
console.log("Failed to find folders with query", error.response?.data?.error || error);
|
54
|
+
throw JSON.stringify(error.response?.data?.error, null, 2);
|
55
|
+
}
|
48
56
|
},
|
49
57
|
};
|
@@ -13,7 +13,7 @@ export default {
|
|
13
13
|
key: "google_drive-upload-file",
|
14
14
|
name: "Upload File",
|
15
15
|
description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
|
16
|
-
version: "1.0.
|
16
|
+
version: "1.0.2",
|
17
17
|
type: "action",
|
18
18
|
additionalProps,
|
19
19
|
props: {
|
@@ -43,7 +43,7 @@ export default {
|
|
43
43
|
googleDrive,
|
44
44
|
"fileUrl",
|
45
45
|
],
|
46
|
-
optional:
|
46
|
+
optional: true,
|
47
47
|
hidden: true,
|
48
48
|
},
|
49
49
|
filePath: {
|
@@ -51,7 +51,7 @@ export default {
|
|
51
51
|
googleDrive,
|
52
52
|
"filePath",
|
53
53
|
],
|
54
|
-
optional:
|
54
|
+
optional: true,
|
55
55
|
hidden: true,
|
56
56
|
},
|
57
57
|
name: {
|