@pipedream/google_drive 0.8.2 → 0.8.4

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 (33) hide show
  1. package/actions/add-file-sharing-preference/add-file-sharing-preference.mjs +29 -18
  2. package/actions/copy-file/copy-file.mjs +1 -1
  3. package/actions/create-file-from-template/create-file-from-template.mjs +1 -1
  4. package/actions/create-file-from-text/create-file-from-text.mjs +1 -1
  5. package/actions/create-folder/create-folder.mjs +1 -1
  6. package/actions/create-shared-drive/create-shared-drive.mjs +1 -1
  7. package/actions/delete-file/delete-file.mjs +1 -1
  8. package/actions/delete-shared-drive/delete-shared-drive.mjs +1 -1
  9. package/actions/download-file/download-file.mjs +1 -1
  10. package/actions/find-file/find-file.mjs +1 -1
  11. package/actions/find-folder/find-folder.mjs +1 -1
  12. package/actions/find-forms/find-forms.mjs +1 -1
  13. package/actions/find-spreadsheets/find-spreadsheets.mjs +1 -1
  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 +1 -1
  17. package/actions/list-files/list-files.mjs +1 -1
  18. package/actions/move-file/move-file.mjs +1 -1
  19. package/actions/move-file-to-trash/move-file-to-trash.mjs +1 -1
  20. package/actions/search-shared-drives/search-shared-drives.mjs +1 -1
  21. package/actions/update-file/update-file.mjs +1 -1
  22. package/actions/update-shared-drive/update-shared-drive.mjs +1 -1
  23. package/actions/upload-file/upload-file.mjs +1 -1
  24. package/google_drive.app.mjs +1 -0
  25. package/package.json +1 -1
  26. package/sources/changes-to-specific-files/changes-to-specific-files.mjs +1 -1
  27. package/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs +1 -1
  28. package/sources/new-files-instant/new-files-instant.mjs +1 -1
  29. package/sources/new-or-modified-comments/new-or-modified-comments.mjs +1 -1
  30. package/sources/new-or-modified-files/new-or-modified-files.mjs +1 -1
  31. package/sources/new-or-modified-folders/new-or-modified-folders.mjs +1 -1
  32. package/sources/new-shared-drive/new-shared-drive.mjs +1 -1
  33. package/sources/new-spreadsheet/new-spreadsheet.mjs +1 -1
@@ -1,5 +1,5 @@
1
+ import { ConfigurationError } from "@pipedream/platform";
1
2
  import {
2
- GOOGLE_DRIVE_FOLDER_MIME_TYPE,
3
3
  GOOGLE_DRIVE_GRANTEE_DOMAIN,
4
4
  GOOGLE_DRIVE_GRANTEE_GROUP,
5
5
  GOOGLE_DRIVE_GRANTEE_USER,
@@ -20,7 +20,7 @@ export default {
20
20
  name: "Share File or Folder",
21
21
  description:
22
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)",
23
- version: "0.1.6",
23
+ version: "0.1.8",
24
24
  type: "action",
25
25
  props: {
26
26
  googleDrive,
@@ -31,17 +31,27 @@ export default {
31
31
  ],
32
32
  optional: true,
33
33
  },
34
- fileOrFolderId: {
34
+ fileId: {
35
35
  propDefinition: [
36
36
  googleDrive,
37
- "fileOrFolderId",
37
+ "fileId",
38
38
  (c) => ({
39
39
  drive: c.drive,
40
40
  }),
41
41
  ],
42
- optional: false,
43
- description: "The file or folder to share",
44
- reloadProps: true,
42
+ optional: true,
43
+ description: "The file to share. You must specify either a file or a folder.",
44
+ },
45
+ folderId: {
46
+ propDefinition: [
47
+ googleDrive,
48
+ "folderId",
49
+ (c) => ({
50
+ drive: c.drive,
51
+ }),
52
+ ],
53
+ optional: true,
54
+ description: "The folder to share. You must specify either a file or a folder.",
45
55
  },
46
56
  type: {
47
57
  propDefinition: [
@@ -54,13 +64,9 @@ export default {
54
64
  async additionalProps() {
55
65
  const obj = {};
56
66
  const {
57
- fileOrFolderId, type,
67
+ fileId, folderId, type,
58
68
  } = this;
59
- if (!fileOrFolderId || !type) return obj;
60
-
61
- const { mimeType } = await this.googleDrive.getFile(this.fileOrFolderId, {
62
- fields: "mimeType",
63
- });
69
+ if (!(fileId || folderId) || !type) return obj;
64
70
 
65
71
  const emailAddress = {
66
72
  type: "string",
@@ -93,7 +99,7 @@ export default {
93
99
  break;
94
100
  }
95
101
 
96
- const isFolder = mimeType === GOOGLE_DRIVE_FOLDER_MIME_TYPE;
102
+ const isFolder = !!folderId;
97
103
  const options = GOOGLE_DRIVE_ROLE_OPTIONS;
98
104
 
99
105
  if (isFolder) {
@@ -114,10 +120,13 @@ export default {
114
120
  },
115
121
  async run({ $ }) {
116
122
  const {
117
- fileOrFolderId, role, type, domain, emailAddress,
123
+ fileId, folderId, role, type, domain, emailAddress,
118
124
  } = this;
125
+ if (!(fileId || folderId)) {
126
+ throw new ConfigurationError("You must specify either a file or a folder");
127
+ }
119
128
  // Create the permission for the file
120
- await this.googleDrive.createPermission(fileOrFolderId, {
129
+ await this.googleDrive.createPermission(folderId ?? fileId, {
121
130
  role,
122
131
  type,
123
132
  domain,
@@ -125,11 +134,13 @@ export default {
125
134
  });
126
135
 
127
136
  // Get the file to get the `webViewLink` sharing URL
128
- const resp = await this.googleDrive.getFile(this.fileOrFolderId);
137
+ const resp = await this.googleDrive.getFile(folderId ?? fileId);
129
138
  const webViewLink = resp.webViewLink;
130
139
  $.export(
131
140
  "$summary",
132
- `Successfully shared file "${resp.name}" with ${type} "${
141
+ `Successfully shared ${folderId
142
+ ? "folder"
143
+ : "file"} "${resp.name}" with ${type} "${
133
144
  emailAddress ?? domain ?? ""
134
145
  }" with role '${role}'`,
135
146
  );
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-copy-file",
5
5
  name: "Copy File",
6
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",
7
+ version: "0.1.6",
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.5",
11
+ version: "0.1.6",
12
12
  type: "action",
13
13
  props: {
14
14
  googleDrive,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-create-file-from-text",
6
6
  name: "Create New File From Text",
7
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",
8
+ version: "0.1.6",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -13,7 +13,7 @@ export default {
13
13
  key: "google_drive-create-folder",
14
14
  name: "Create Folder",
15
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",
16
+ version: "0.1.6",
17
17
  type: "action",
18
18
  props: {
19
19
  googleDrive,
@@ -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.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -5,7 +5,7 @@ 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.6",
8
+ version: "0.1.7",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-delete-shared-drive",
5
5
  name: "Delete Shared Drive",
6
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",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -18,7 +18,7 @@ export default {
18
18
  key: "google_drive-download-file",
19
19
  name: "Download File",
20
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",
21
+ version: "0.1.6",
22
22
  type: "action",
23
23
  props: {
24
24
  googleDrive,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_drive-find-file",
7
7
  name: "Find File",
8
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
+ version: "0.1.6",
10
10
  type: "action",
11
11
  props: {
12
12
  googleDrive,
@@ -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.5",
10
+ version: "0.1.6",
11
11
  type: "action",
12
12
  props: {
13
13
  googleDrive,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_drive-find-forms",
7
7
  name: "Find Forms",
8
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
+ version: "0.0.7",
10
10
  type: "action",
11
11
  props: {
12
12
  googleDrive,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_drive-find-spreadsheets",
7
7
  name: "Find Spreadsheets",
8
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
+ version: "0.1.6",
10
10
  type: "action",
11
11
  props: {
12
12
  googleDrive,
@@ -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.2",
8
+ version: "0.0.3",
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.7",
15
+ version: "0.1.8",
16
16
  type: "action",
17
17
  props: {
18
18
  googleDrive,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-get-shared-drive",
5
5
  name: "Get Shared Drive",
6
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",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -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.9",
8
+ version: "0.1.10",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-move-file",
5
5
  name: "Move File",
6
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",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-move-file-to-trash",
6
6
  name: "Move File to Trash",
7
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",
8
+ version: "0.1.6",
9
9
  type: "action",
10
10
  props: {
11
11
  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.6",
7
+ version: "0.1.7",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "google_drive-update-file",
9
9
  name: "Update File",
10
10
  description: "Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
11
- version: "0.1.5",
11
+ version: "0.1.6",
12
12
  type: "action",
13
13
  props: {
14
14
  googleDrive,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_drive-update-shared-drive",
5
5
  name: "Update Shared Drive",
6
6
  description: "Update an existing shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/update) for more information",
7
- version: "0.1.5",
7
+ version: "0.1.6",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -11,7 +11,7 @@ export default {
11
11
  key: "google_drive-upload-file",
12
12
  name: "Upload File",
13
13
  description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
14
- version: "0.1.8",
14
+ version: "0.1.9",
15
15
  type: "action",
16
16
  props: {
17
17
  googleDrive,
@@ -74,6 +74,7 @@ export default {
74
74
  drive,
75
75
  baseOpts = {
76
76
  q: `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}'`,
77
+ sharedWithMe: true,
77
78
  },
78
79
  }) {
79
80
  const { nextPageToken } = prevContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_drive",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Pipedream Google_drive Components",
5
5
  "main": "google_drive.app.mjs",
6
6
  "keywords": [
@@ -15,7 +15,7 @@ export default {
15
15
  key: "google_drive-changes-to-specific-files",
16
16
  name: "Changes to Specific Files",
17
17
  description: "Watches for changes to specific files, emitting an event when a change is made to one of those files. To watch for changes to [shared drive](https://support.google.com/a/users/answer/9310351) files, use the **Changes to Specific Files (Shared Drive)** source instead.",
18
- version: "0.2.1",
18
+ version: "0.2.2",
19
19
  type: "source",
20
20
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
21
21
  // https://developers.google.com/drive/api/v3/push#making-watch-requests
@@ -27,7 +27,7 @@ export default {
27
27
  key: "google_drive-changes-to-specific-files-shared-drive",
28
28
  name: "Changes to Specific Files (Shared Drive)",
29
29
  description: "Watches for changes to specific files in a shared drive, emitting an event when a change is made to one of those files",
30
- version: "0.2.1",
30
+ version: "0.2.2",
31
31
  type: "source",
32
32
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
33
33
  // https://developers.google.com/drive/api/v3/push#making-watch-requests
@@ -10,7 +10,7 @@ export default {
10
10
  key: "google_drive-new-files-instant",
11
11
  name: "New Files (Instant)",
12
12
  description: "Emit new event when a new file is added in your linked Google Drive",
13
- version: "0.1.8",
13
+ version: "0.1.9",
14
14
  type: "source",
15
15
  dedupe: "unique",
16
16
  props: {
@@ -17,7 +17,7 @@ export default {
17
17
  name: "New or Modified Comments (Instant)",
18
18
  description:
19
19
  "Emit new event when a comment is created or modified in the selected file",
20
- version: "1.0.0",
20
+ version: "1.0.1",
21
21
  type: "source",
22
22
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
23
23
  // https://developers.google.com/drive/api/v3/push#making-watch-requests
@@ -24,7 +24,7 @@ export default {
24
24
  key: "google_drive-new-or-modified-files",
25
25
  name: "New or Modified Files (Instant)",
26
26
  description: "Emit new event when a file in the selected Drive is created, modified or trashed.",
27
- version: "0.3.1",
27
+ version: "0.3.2",
28
28
  type: "source",
29
29
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
30
30
  // https://developers.google.com/drive/api/v3/push#making-watch-requests
@@ -20,7 +20,7 @@ export default {
20
20
  key: "google_drive-new-or-modified-folders",
21
21
  name: "New or Modified Folders (Instant)",
22
22
  description: "Emit new event when a folder is created or modified in the selected Drive",
23
- version: "0.1.6",
23
+ version: "0.1.7",
24
24
  type: "source",
25
25
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
26
26
  // https://developers.google.com/drive/api/v3/push#making-watch-requests
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-new-shared-drive",
6
6
  name: "New Shared Drive",
7
7
  description: "Emits a new event any time a shared drive is created.",
8
- version: "0.1.5",
8
+ version: "0.1.6",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -6,7 +6,7 @@ export default {
6
6
  type: "source",
7
7
  name: "New Spreadsheet (Instant)",
8
8
  description: "Emit new event when a new spreadsheet is created in a drive.",
9
- version: "0.1.6",
9
+ version: "0.1.7",
10
10
  props: {
11
11
  googleDrive: newFilesInstant.props.googleDrive,
12
12
  db: newFilesInstant.props.db,