@pipedream/google_drive 0.7.3 → 0.8.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.
Files changed (37) hide show
  1. package/actions/add-file-sharing-preference/add-file-sharing-preference.mjs +30 -8
  2. package/actions/copy-file/copy-file.mjs +2 -2
  3. package/actions/create-file-from-template/create-file-from-template.mjs +3 -3
  4. package/actions/create-file-from-text/create-file-from-text.mjs +3 -2
  5. package/actions/create-folder/create-folder.mjs +3 -2
  6. package/actions/create-shared-drive/create-shared-drive.mjs +1 -2
  7. package/actions/delete-file/delete-file.mjs +10 -3
  8. package/actions/delete-shared-drive/delete-shared-drive.mjs +7 -5
  9. package/actions/download-file/download-file.mjs +11 -6
  10. package/actions/find-file/find-file.mjs +8 -10
  11. package/actions/find-folder/find-folder.mjs +2 -2
  12. package/actions/find-forms/find-forms.mjs +22 -18
  13. package/actions/find-spreadsheets/find-spreadsheets.mjs +21 -18
  14. package/actions/get-file-by-id/get-file-by-id.mjs +1 -1
  15. package/actions/get-folder-id-for-path/get-folder-id-for-path.mjs +1 -1
  16. package/actions/get-shared-drive/get-shared-drive.mjs +8 -8
  17. package/actions/list-files/list-files.mjs +3 -3
  18. package/actions/move-file/move-file.mjs +2 -2
  19. package/actions/move-file-to-trash/move-file-to-trash.mjs +7 -2
  20. package/actions/search-shared-drives/search-shared-drives.mjs +1 -1
  21. package/actions/update-file/update-file.mjs +9 -7
  22. package/actions/update-shared-drive/update-shared-drive.mjs +11 -11
  23. package/actions/upload-file/upload-file.mjs +12 -4
  24. package/common/commonSearchQuery.mjs +48 -0
  25. package/common/constants.mjs +27 -22
  26. package/google_drive.app.mjs +41 -16
  27. package/package.json +1 -1
  28. package/sources/changes-to-specific-files/changes-to-specific-files.mjs +2 -3
  29. package/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs +1 -1
  30. package/sources/new-files-instant/new-files-instant.mjs +1 -1
  31. package/sources/new-or-modified-comments/new-or-modified-comments.mjs +23 -16
  32. package/sources/new-or-modified-files/new-or-modified-files.mjs +1 -1
  33. package/sources/new-or-modified-folders/new-or-modified-folders.mjs +1 -1
  34. package/sources/new-shared-drive/new-shared-drive.mjs +1 -1
  35. package/sources/new-spreadsheet/new-spreadsheet.mjs +1 -1
  36. package/actions/create-file/create-file.mjs +0 -242
  37. package/actions/replace-file/replace-file.mjs +0 -134
@@ -1,8 +1,11 @@
1
1
  import {
2
+ GOOGLE_DRIVE_FOLDER_MIME_TYPE,
2
3
  GOOGLE_DRIVE_GRANTEE_DOMAIN,
3
4
  GOOGLE_DRIVE_GRANTEE_GROUP,
4
5
  GOOGLE_DRIVE_GRANTEE_USER,
5
6
  GOOGLE_DRIVE_ROLE_OPTIONS,
7
+ GOOGLE_DRIVE_ROLE_OPTION_FILEORGANIZER,
8
+ GOOGLE_DRIVE_ROLE_WRITER,
6
9
  } from "../../common/constants.mjs";
7
10
  import googleDrive from "../../google_drive.app.mjs";
8
11
 
@@ -14,10 +17,10 @@ import googleDrive from "../../google_drive.app.mjs";
14
17
  */
15
18
  export default {
16
19
  key: "google_drive-add-file-sharing-preference",
17
- name: "Share File",
20
+ name: "Share File or Folder",
18
21
  description:
19
22
  "Add a [sharing permission](https://support.google.com/drive/answer/7166529) to the sharing preferences of a file or folder and provide a sharing URL. [See the documentation](https://developers.google.com/drive/api/v3/reference/permissions/create)",
20
- version: "0.1.5",
23
+ version: "0.1.6",
21
24
  type: "action",
22
25
  props: {
23
26
  googleDrive,
@@ -38,6 +41,7 @@ export default {
38
41
  ],
39
42
  optional: false,
40
43
  description: "The file or folder to share",
44
+ reloadProps: true,
41
45
  },
42
46
  type: {
43
47
  propDefinition: [
@@ -47,8 +51,17 @@ export default {
47
51
  reloadProps: true,
48
52
  },
49
53
  },
50
- additionalProps() {
54
+ async additionalProps() {
51
55
  const obj = {};
56
+ const {
57
+ fileOrFolderId, type,
58
+ } = this;
59
+ if (!fileOrFolderId || !type) return obj;
60
+
61
+ const { mimeType } = await this.googleDrive.getFile(this.fileOrFolderId, {
62
+ fields: "mimeType",
63
+ });
64
+
52
65
  const emailAddress = {
53
66
  type: "string",
54
67
  label: "Email Address",
@@ -56,7 +69,7 @@ export default {
56
69
  "Enter the email address of the user that you'd like to share the file or folder with (e.g. `alex@altostrat.com`).",
57
70
  };
58
71
 
59
- switch (this.type) {
72
+ switch (type) {
60
73
  case GOOGLE_DRIVE_GRANTEE_DOMAIN:
61
74
  obj.domain = {
62
75
  type: "string",
@@ -80,13 +93,22 @@ export default {
80
93
  break;
81
94
  }
82
95
 
96
+ const isFolder = mimeType === GOOGLE_DRIVE_FOLDER_MIME_TYPE;
97
+ const options = GOOGLE_DRIVE_ROLE_OPTIONS;
98
+
99
+ if (isFolder) {
100
+ const writerOpt = options.find(({ value }) => value === GOOGLE_DRIVE_ROLE_WRITER);
101
+ writerOpt.label = writerOpt.label.replace(/Writer/, "Contributor");
102
+ options.push(GOOGLE_DRIVE_ROLE_OPTION_FILEORGANIZER);
103
+ }
104
+
83
105
  return {
84
106
  ...obj,
85
107
  role: {
86
108
  type: "string",
87
109
  label: "Role",
88
110
  description: "The role granted by this permission",
89
- options: GOOGLE_DRIVE_ROLE_OPTIONS,
111
+ options,
90
112
  },
91
113
  };
92
114
  },
@@ -107,9 +129,9 @@ export default {
107
129
  const webViewLink = resp.webViewLink;
108
130
  $.export(
109
131
  "$summary",
110
- `Successfully shared file "${resp.name}" with ${this.type} "${
111
- this.emailAddress ?? this.domain ?? ""
112
- }"`,
132
+ `Successfully shared file "${resp.name}" with ${type} "${
133
+ emailAddress ?? domain ?? ""
134
+ }" with role '${role}'`,
113
135
  );
114
136
  return webViewLink;
115
137
  },
@@ -3,8 +3,8 @@ import googleDrive from "../../google_drive.app.mjs";
3
3
  export default {
4
4
  key: "google_drive-copy-file",
5
5
  name: "Copy File",
6
- description: "Create a copy of the specified file. [See the docs](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
7
- version: "0.1.4",
6
+ description: "Create a copy of the specified file. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
7
+ version: "0.1.5",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "google_drive-create-file-from-template",
9
9
  name: "Create New File From Template",
10
10
  description: "Create a new Google Docs file from a template. Optionally include placeholders in the template document that will get replaced from this action. [See documentation](https://www.npmjs.com/package/google-docs-mustaches)",
11
- version: "0.1.4",
11
+ version: "0.1.5",
12
12
  type: "action",
13
13
  props: {
14
14
  googleDrive,
@@ -18,7 +18,7 @@ export default {
18
18
  "fileId",
19
19
  ],
20
20
  description:
21
- "Select the template document you'd like to use as the template, or use a custom expression to reference a document ID from a previous step. Template documents should contain placeholders in the format {{xyz}}.",
21
+ "Select the template document you'd like to use as the template, or use a custom expression to reference a document ID from a previous step. Template documents should contain placeholders in the format `{{xyz}}`.",
22
22
  },
23
23
  folderId: {
24
24
  propDefinition: [
@@ -49,7 +49,7 @@ export default {
49
49
  replaceValues: {
50
50
  type: "object",
51
51
  label: "Replace text placeholders",
52
- description: "Replace text placeholders in the document. Use the format {{xyz}} in the document but exclude the curly braces in the key. (eg. `{{myPlaceholder}}` in the document will be replaced by the value of the key `myPlaceholder` in the action.",
52
+ description: "Replace text placeholders in the document. Use the format `{{xyz}}` in the document but exclude the curly braces in the key. (eg. `{{myPlaceholder}}` in the document will be replaced by the value of the key `myPlaceholder` in the action.",
53
53
  },
54
54
  },
55
55
  async run({ $ }) {
@@ -4,8 +4,8 @@ import { Readable } from "stream";
4
4
  export default {
5
5
  key: "google_drive-create-file-from-text",
6
6
  name: "Create New File From Text",
7
- description: "Create a new file from plain text. [See the docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
8
- version: "0.1.4",
7
+ description: "Create a new file from plain text. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
8
+ version: "0.1.5",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -33,6 +33,7 @@ export default {
33
33
  googleDrive,
34
34
  "fileName",
35
35
  ],
36
+ label: "File Name",
36
37
  description:
37
38
  "The name of the file you want to create (e.g., `myFile.txt`)",
38
39
  },
@@ -12,8 +12,8 @@ import {
12
12
  export default {
13
13
  key: "google_drive-create-folder",
14
14
  name: "Create Folder",
15
- description: "Create a new empty folder. [See the docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
16
- version: "0.1.4",
15
+ description: "Create a new empty folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
16
+ version: "0.1.5",
17
17
  type: "action",
18
18
  props: {
19
19
  googleDrive,
@@ -32,6 +32,7 @@ export default {
32
32
  drive: c.drive,
33
33
  }),
34
34
  ],
35
+ label: "Parent Folder",
35
36
  description: toSingleLineString(`
36
37
  Select a folder in which to place the new folder.
37
38
  If not specified, the folder will be placed directly in the drive's top-level folder.
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-create-shared-drive",
5
5
  name: "Create Shared Drive",
6
6
  description: "Create a new shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/create) for more information",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -12,7 +12,6 @@ export default {
12
12
  type: "string",
13
13
  label: "Name",
14
14
  description: "The name of the new shared drive",
15
- optional: true,
16
15
  },
17
16
  },
18
17
  async run({ $ }) {
@@ -5,10 +5,15 @@ export default {
5
5
  name: "Delete File",
6
6
  description:
7
7
  "Permanently delete a file or folder without moving it to the trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/delete) for more information",
8
- version: "0.1.5",
8
+ version: "0.1.6",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
12
+ infoAlert: {
13
+ type: "alert",
14
+ alertType: "warning",
15
+ content: "This action will **permanently** delete a file. If you want to move it to the trash instead, use the **[Move File to Trash](https://pipedream.com/apps/google-drive/actions/move-file-to-trash)** action.",
16
+ },
12
17
  drive: {
13
18
  propDefinition: [
14
19
  googleDrive,
@@ -28,10 +33,12 @@ export default {
28
33
  },
29
34
  },
30
35
  async run({ $ }) {
31
- await this.googleDrive.deleteFile(this.fileId);
32
- $.export("$summary", "Successfully deleted the file");
36
+ const { fileId } = this;
37
+ await this.googleDrive.deleteFile(fileId);
38
+ $.export("$summary", `Successfully deleted file (ID: ${fileId}`);
33
39
  return {
34
40
  success: true,
41
+ fileId,
35
42
  };
36
43
  },
37
44
  };
@@ -3,28 +3,30 @@ import googleDrive from "../../google_drive.app.mjs";
3
3
  export default {
4
4
  key: "google_drive-delete-shared-drive",
5
5
  name: "Delete Shared Drive",
6
- description: "Delete a shared drive without any content. [See the docs](https://developers.google.com/drive/api/v3/reference/drives/delete) for more information",
7
- version: "0.1.4",
6
+ description: "Delete a shared drive without any content. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/delete) for more information",
7
+ version: "0.1.5",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
11
11
  drive: {
12
12
  propDefinition: [
13
13
  googleDrive,
14
- "watchedDrive",
14
+ "sharedDrive",
15
15
  ],
16
16
  description:
17
17
  "Select a [shared drive](https://support.google.com/a/users/answer/9310351) to delete.",
18
- default: "",
18
+ optional: false,
19
19
  },
20
20
  },
21
21
  async run({ $ }) {
22
+ const { drive } = this;
22
23
  await this.googleDrive.deleteSharedDrive(
23
- this.googleDrive.getDriveId(this.drive),
24
+ this.googleDrive.getDriveId(drive),
24
25
  );
25
26
  $.export("$summary", "Successfully deleted the shared drive");
26
27
  return {
27
28
  success: true,
29
+ drive,
28
30
  };
29
31
  },
30
32
  };
@@ -17,8 +17,8 @@ import { toSingleLineString } from "../../common/utils.mjs";
17
17
  export default {
18
18
  key: "google_drive-download-file",
19
19
  name: "Download File",
20
- description: "Download a file. [See the docs](https://developers.google.com/drive/api/v3/manage-downloads) for more information",
21
- version: "0.1.4",
20
+ description: "Download a file. [See the documentation](https://developers.google.com/drive/api/v3/manage-downloads) for more information",
21
+ version: "0.1.5",
22
22
  type: "action",
23
23
  props: {
24
24
  googleDrive,
@@ -27,7 +27,6 @@ export default {
27
27
  googleDrive,
28
28
  "watchedDrive",
29
29
  ],
30
-
31
30
  optional: true,
32
31
  },
33
32
  fileId: {
@@ -44,7 +43,7 @@ export default {
44
43
  type: "string",
45
44
  label: "Destination File Path",
46
45
  description: toSingleLineString(`
47
- The destination path for the file in the [\`/tmp\`
46
+ The destination file name or path [in the \`/tmp\`
48
47
  directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)
49
48
  (e.g., \`/tmp/myFile.csv\`)
50
49
  `),
@@ -113,8 +112,14 @@ export default {
113
112
 
114
113
  // Stream file to `filePath`
115
114
  const pipeline = promisify(stream.pipeline);
116
- await pipeline(file, fs.createWriteStream(this.filePath));
115
+ const filePath = this.filePath.includes("tmp/")
116
+ ? this.filePath
117
+ : `/tmp/${this.filePath}`;
118
+ await pipeline(file, fs.createWriteStream(filePath));
117
119
  $.export("$summary", `Successfully downloaded the file, "${fileMetadata.name}"`);
118
- return fileMetadata;
120
+ return {
121
+ fileMetadata,
122
+ filePath,
123
+ };
119
124
  },
120
125
  };
@@ -1,11 +1,12 @@
1
1
  import googleDrive from "../../google_drive.app.mjs";
2
2
  import { getListFilesOpts } from "../../common/utils.mjs";
3
+ import commonSearchQuery from "../../common/commonSearchQuery.mjs";
3
4
 
4
5
  export default {
5
6
  key: "google_drive-find-file",
6
7
  name: "Find File",
7
- description: "Search for a specific file by name. [See the docs](https://developers.google.com/drive/api/v3/search-files) for more information",
8
- version: "0.1.4",
8
+ description: "Search for a specific file by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
9
+ version: "0.1.5",
9
10
  type: "action",
10
11
  props: {
11
12
  googleDrive,
@@ -16,20 +17,17 @@ export default {
16
17
  ],
17
18
  optional: true,
18
19
  },
19
- nameSearchTerm: {
20
- propDefinition: [
21
- googleDrive,
22
- "fileNameSearchTerm",
23
- ],
24
- },
20
+ ...commonSearchQuery.props,
25
21
  },
22
+ methods: commonSearchQuery.methods,
26
23
  async run({ $ }) {
24
+ const q = this.getQuery();
27
25
  const opts = getListFilesOpts(this.drive, {
28
- q: `name contains '${this.nameSearchTerm}'`,
26
+ q,
29
27
  });
30
28
  const files = (await this.googleDrive.listFilesInPage(null, opts)).files;
31
29
  // eslint-disable-next-line multiline-ternary
32
- $.export("$summary", `Successfully found ${files.length} file${files.length === 1 ? "" : "s"} containing the term, "${this.nameSearchTerm}"`);
30
+ $.export("$summary", `Successfully found ${files.length} file${files.length === 1 ? "" : "s"} with the query "${q}"`);
33
31
  return files;
34
32
  },
35
33
  };
@@ -6,8 +6,8 @@ import { GOOGLE_DRIVE_FOLDER_MIME_TYPE } from "../../common/constants.mjs";
6
6
  export default {
7
7
  key: "google_drive-find-folder",
8
8
  name: "Find Folder",
9
- description: "Search for a specific folder by name. [See the docs](https://developers.google.com/drive/api/v3/search-files) for more information",
10
- version: "0.1.4",
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.5",
11
11
  type: "action",
12
12
  props: {
13
13
  googleDrive,
@@ -1,11 +1,12 @@
1
1
  import googleDrive from "../../google_drive.app.mjs";
2
2
  import { getListFilesOpts } from "../../common/utils.mjs";
3
+ import commonSearchQuery from "../../common/commonSearchQuery.mjs";
3
4
 
4
5
  export default {
5
6
  key: "google_drive-find-forms",
6
7
  name: "Find Forms",
7
- description: "List Google Form documents or search for a Form by name. [See the docs](https://developers.google.com/drive/api/v3/search-files) for more information",
8
- version: "0.0.5",
8
+ description: "List Google Form documents or search for a Form by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
9
+ version: "0.0.6",
9
10
  type: "action",
10
11
  props: {
11
12
  googleDrive,
@@ -28,27 +29,30 @@ export default {
28
29
  description: "The ID of the parent folder which contains the file. If not specified, it will list files from the drive's top-level folder.",
29
30
  optional: true,
30
31
  },
31
- nameSearchTerm: {
32
- propDefinition: [
33
- googleDrive,
34
- "fileNameSearchTerm",
35
- ],
36
- optional: true,
32
+ queryAlert: {
33
+ type: "alert",
34
+ alertType: "info",
35
+ content: "If no query or search name is specified, all forms in the selected drive/folder will be returned.",
36
+ },
37
+ ...commonSearchQuery.props,
38
+ searchQuery: {
39
+ ...commonSearchQuery.props.searchQuery,
40
+ description:
41
+ "Search for a file with a query. [See the documentation](https://developers.google.com/drive/api/guides/ref-search-terms) for more information. If specified, `Search Name` and `Parent Folder` will be ignored.",
37
42
  },
38
43
  },
44
+ methods: commonSearchQuery.methods,
39
45
  async run({ $ }) {
40
- let q = "mimeType = 'application/vnd.google-apps.form'";
41
- if (this.nameSearchTerm) {
42
- q = `${q} and name contains '${this.nameSearchTerm}'`;
43
- }
44
- if (this.folderId) {
45
- q = `${q} and "${this.folderId}" in parents`;
46
- }
46
+ const q = this.getQuery("form", this.folderId);
47
47
  const opts = getListFilesOpts(this.drive, {
48
- q: q.trim(),
48
+ q,
49
49
  });
50
50
  const files = (await this.googleDrive.listFilesInPage(null, opts)).files;
51
- $.export("$summary", `Successfully found ${files.length} form(s)`);
52
- return files;
51
+ $.export("$summary", `Successfully found ${files.length} form(s) with the query "${q}"`);
52
+ return files.map((file) => ({
53
+ ...file,
54
+ url: `https://docs.google.com/forms/d/${file.id}`,
55
+ }))
56
+ ;
53
57
  },
54
58
  };
@@ -1,11 +1,12 @@
1
1
  import googleDrive from "../../google_drive.app.mjs";
2
2
  import { getListFilesOpts } from "../../common/utils.mjs";
3
+ import commonSearchQuery from "../../common/commonSearchQuery.mjs";
3
4
 
4
5
  export default {
5
6
  key: "google_drive-find-spreadsheets",
6
7
  name: "Find Spreadsheets",
7
- description: "Search for a specific spreadsheet by name. [See the docs](https://developers.google.com/drive/api/v3/search-files) for more information",
8
- version: "0.1.4",
8
+ description: "Search for a specific spreadsheet by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
9
+ version: "0.1.5",
9
10
  type: "action",
10
11
  props: {
11
12
  googleDrive,
@@ -28,27 +29,29 @@ export default {
28
29
  description: "The ID of the parent folder which contains the file. If not specified, it will list files from the drive's top-level folder.",
29
30
  optional: true,
30
31
  },
31
- nameSearchTerm: {
32
- propDefinition: [
33
- googleDrive,
34
- "fileNameSearchTerm",
35
- ],
36
- optional: true,
32
+ queryAlert: {
33
+ type: "alert",
34
+ alertType: "info",
35
+ content: "If no query or search name is specified, all spreadsheets in the selected drive/folder will be returned.",
36
+ },
37
+ ...commonSearchQuery.props,
38
+ searchQuery: {
39
+ ...commonSearchQuery.props.searchQuery,
40
+ description:
41
+ "Search for a file with a query. [See the documentation](https://developers.google.com/drive/api/guides/ref-search-terms) for more information. If specified, `Search Name` and `Parent Folder` will be ignored.",
37
42
  },
38
43
  },
44
+ methods: commonSearchQuery.methods,
39
45
  async run({ $ }) {
40
- let q = "mimeType = 'application/vnd.google-apps.spreadsheet'";
41
- if (this.nameSearchTerm) {
42
- q = `${q} and name contains '${this.nameSearchTerm}'`;
43
- }
44
- if (this.folderId) {
45
- q = `${q} and "${this.folderId}" in parents`;
46
- }
46
+ const q = this.getQuery("spreadsheet", this.folderId);
47
47
  const opts = getListFilesOpts(this.drive, {
48
- q: q.trim(),
48
+ q,
49
49
  });
50
50
  const files = (await this.googleDrive.listFilesInPage(null, opts)).files;
51
- $.export("$summary", `Successfully found ${files.length} spreadsheet(s)`);
52
- return files;
51
+ $.export("$summary", `Successfully found ${files.length} spreadsheet(s) with the query "${q}"`);
52
+ return files.map((file) => ({
53
+ ...file,
54
+ url: `https://docs.google.com/spreadsheets/d/${file.id}`,
55
+ }));
53
56
  },
54
57
  };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-get-file-by-id",
6
6
  name: "Get File By ID",
7
7
  description: "Get info on a specific file. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/files/get) for more information",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -12,7 +12,7 @@ export default {
12
12
  key: "google_drive-get-folder-id-for-path",
13
13
  name: "Get Folder ID for a Path",
14
14
  description: "Retrieve a folderId for a path. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information",
15
- version: "0.1.6",
15
+ version: "0.1.7",
16
16
  type: "action",
17
17
  props: {
18
18
  googleDrive,
@@ -3,19 +3,16 @@ import googleDrive from "../../google_drive.app.mjs";
3
3
  export default {
4
4
  key: "google_drive-get-shared-drive",
5
5
  name: "Get Shared Drive",
6
- description: "Get a shared drive's metadata by ID. [See the docs](https://developers.google.com/drive/api/v3/reference/drives/get) for more information",
7
- version: "0.1.4",
6
+ description: "Get metadata for one or all shared drives. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/get) for more information",
7
+ version: "0.1.5",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
11
11
  drive: {
12
12
  propDefinition: [
13
13
  googleDrive,
14
- "watchedDrive",
14
+ "sharedDrive",
15
15
  ],
16
- description:
17
- "Select a [shared drive](https://support.google.com/a/users/answer/9310351).",
18
- default: "",
19
16
  },
20
17
  useDomainAdminAccess: {
21
18
  propDefinition: [
@@ -26,12 +23,15 @@ export default {
26
23
  },
27
24
  async run({ $ }) {
28
25
  const resp = await this.googleDrive.getSharedDrive(
29
- this.googleDrive.getDriveId(this.drive),
26
+ this.drive ?? null,
30
27
  {
31
28
  useDomainAdminAccess: this.useDomainAdminAccess,
32
29
  },
33
30
  );
34
- $.export("$summary", `Successfully fetched the shared drive, "${resp.name}"`);
31
+ const summary = resp.drives
32
+ ? `${resp.drives.length} shared drives`
33
+ : `the shared drive "${resp.name}"`;
34
+ $.export("$summary", `Successfully fetched ${summary}`);
35
35
  return resp;
36
36
  },
37
37
  };
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-list-files",
6
6
  name: "List Files",
7
7
  description: "List files from a specific folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/list) for more information",
8
- version: "0.1.8",
8
+ version: "0.1.9",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -31,7 +31,7 @@ export default {
31
31
  fields: {
32
32
  type: "string",
33
33
  label: "Fields",
34
- description: "The paths of the fields you want included in the response. If not specified, the response includes a default set of fields specific to this method. For development you can use the special value `*` to return all fields, but you'll achieve greater performance by only selecting the fields you need.\n\n**eg:** `files(id,mimeType,name,webContentLink,webViewLink)`",
34
+ description: "The fields you want included in the response [(see the documentation for available fields)](https://developers.google.com/drive/api/reference/rest/v3/files). If not specified, the response includes a default set of fields specific to this method. For development you can use the special value `*` to return all fields, but you'll achieve greater performance by only selecting the fields you need.\n\n**eg:** `files(id,mimeType,name,webContentLink,webViewLink)`",
35
35
  optional: true,
36
36
  },
37
37
  filterText: {
@@ -44,7 +44,7 @@ export default {
44
44
  trashed: {
45
45
  label: "Trashed",
46
46
  type: "boolean",
47
- description: "List trashed files or non-trashed files. Keep it empty to include both.",
47
+ description: "If `true`, list **only** trashed files. If `false`, list **only** non-trashed files. Keep it empty to include both.",
48
48
  optional: true,
49
49
  },
50
50
  },
@@ -3,8 +3,8 @@ import googleDrive from "../../google_drive.app.mjs";
3
3
  export default {
4
4
  key: "google_drive-move-file",
5
5
  name: "Move File",
6
- description: "Move a file from one folder to another. [See the docs](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
7
- version: "0.1.4",
6
+ description: "Move a file from one folder to another. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
7
+ version: "0.1.5",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -4,11 +4,16 @@ import { GOOGLE_DRIVE_FOLDER_MIME_TYPE } from "../../common/constants.mjs";
4
4
  export default {
5
5
  key: "google_drive-move-file-to-trash",
6
6
  name: "Move File to Trash",
7
- description: "Move a file or folder to trash. [See the docs](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
8
- version: "0.1.4",
7
+ description: "Move a file or folder to trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
8
+ version: "0.1.5",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
12
+ infoAlert: {
13
+ type: "alert",
14
+ alertType: "info",
15
+ content: "If you want to **permanently** delete a file instead, use the **[Move File to Trash](https://pipedream.com/apps/google-drive/actions/delete-file)** action.",
16
+ },
12
17
  drive: {
13
18
  propDefinition: [
14
19
  googleDrive,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-search-shared-drives",
5
5
  name: "Search for Shared Drives",
6
6
  description: "Search for shared drives with query options. [See the documentation](https://developers.google.com/drive/api/v3/search-shareddrives) for more information",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,