@pipedream/google_drive 0.6.17 → 0.6.19

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 (35) hide show
  1. package/README.md +9 -8
  2. package/actions/add-file-sharing-preference/add-file-sharing-preference.mjs +1 -1
  3. package/actions/copy-file/copy-file.mjs +1 -1
  4. package/actions/create-file/create-file.mjs +1 -1
  5. package/actions/create-file-from-template/create-file-from-template.mjs +1 -1
  6. package/actions/create-file-from-text/create-file-from-text.mjs +1 -1
  7. package/actions/create-folder/create-folder.mjs +1 -1
  8. package/actions/create-shared-drive/create-shared-drive.mjs +1 -1
  9. package/actions/delete-file/delete-file.mjs +1 -1
  10. package/actions/delete-shared-drive/delete-shared-drive.mjs +1 -1
  11. package/actions/download-file/download-file.mjs +1 -1
  12. package/actions/find-file/find-file.mjs +1 -1
  13. package/actions/find-folder/find-folder.mjs +1 -1
  14. package/actions/find-forms/find-forms.mjs +1 -1
  15. package/actions/find-spreadsheets/find-spreadsheets.mjs +1 -1
  16. package/actions/get-folder-id-for-path/get-folder-id-for-path.mjs +1 -1
  17. package/actions/get-shared-drive/get-shared-drive.mjs +1 -1
  18. package/actions/list-files/list-files.mjs +1 -1
  19. package/actions/move-file/move-file.mjs +1 -1
  20. package/actions/move-file-to-trash/move-file-to-trash.mjs +1 -1
  21. package/actions/replace-file/replace-file.mjs +1 -1
  22. package/actions/search-shared-drives/search-shared-drives.mjs +1 -1
  23. package/actions/update-file/update-file.mjs +1 -1
  24. package/actions/update-shared-drive/update-shared-drive.mjs +1 -1
  25. package/actions/upload-file/upload-file.mjs +1 -1
  26. package/google_drive.app.mjs +14 -11
  27. package/package.json +3 -1
  28. package/sources/changes-to-specific-files/changes-to-specific-files.mjs +6 -6
  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 +1 -1
  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
package/README.md CHANGED
@@ -1,13 +1,14 @@
1
1
  # Overview
2
2
 
3
- Using the Google Drive API, you can build applications that:
4
-
5
- - Create and manage files and folders
6
- - Download and upload files
7
- - Share and organize files
8
- - Search for files
9
- - Track changes to files
10
- - And much more!
3
+ The Google Drive API on Pipedream allows you to automate various file management tasks, such as creating, reading, updating, and deleting files within your Google Drive. You can also share files, manage permissions, and monitor changes to files and folders. This opens up possibilities for creating workflows that seamlessly integrate with other apps and services, streamlining document handling, backup processes, and collaborative workflows.
4
+
5
+ # Example Use Cases
6
+
7
+ - **Automated Backup to Google Drive**: Create a workflow on Pipedream that triggers at regular intervals to back up important files from your company’s server to a designated Google Drive folder. This workflow can ensure that your data is regularly saved to a secure, cloud-based location without manual intervention.
8
+
9
+ - **Content Approval Process**: Streamline the content approval process by setting up a Pipedream workflow that watches for new files in a Google Drive "Pending Approval" folder. When a new file is detected, an email or message can be sent to the approver using an app like Gmail or Slack. Once reviewed, the file can be moved to an "Approved" folder automatically if certain conditions are met.
10
+
11
+ - **Synchronize Files Across Cloud Platforms**: Build a workflow on Pipedream that monitors a specific folder in Google Drive for new files and automatically replicates them to another cloud storage service, such as Dropbox or OneDrive. This ensures that your files are accessible across different platforms and kept in sync without needing to upload them to each service manually.
11
12
 
12
13
  # Troubleshooting
13
14
 
@@ -11,7 +11,7 @@ export default {
11
11
  name: "Add File Sharing Preference",
12
12
  description:
13
13
  "Add a [sharing](https://support.google.com/drive/answer/7166529) permission to the sharing preferences of a file or folder and provide a sharing URL. [See the docs](https://developers.google.com/drive/api/v3/reference/permissions/create) for more information",
14
- version: "0.1.2",
14
+ version: "0.1.4",
15
15
  type: "action",
16
16
  props: {
17
17
  googleDrive,
@@ -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 docs](https://developers.google.com/drive/api/v3/reference/files/copy) for more information",
7
- version: "0.1.1",
7
+ version: "0.1.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -7,7 +7,7 @@ export default {
7
7
  key: "google_drive-create-file",
8
8
  name: "Create a New File",
9
9
  description: "Create a new file from a URL or /tmp/filepath. [See the docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
10
- version: "0.1.3",
10
+ version: "0.1.5",
11
11
  type: "action",
12
12
  props: {
13
13
  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.1",
11
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
8
- version: "0.1.1",
8
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/files/create) for more information",
16
- version: "0.1.1",
16
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/drives/create) for more information",
7
- version: "0.1.1",
7
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/files/delete) for more information",
8
- version: "0.1.1",
8
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/drives/delete) for more information",
7
- version: "0.1.1",
7
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/manage-downloads) for more information",
21
- version: "0.1.1",
21
+ version: "0.1.3",
22
22
  type: "action",
23
23
  props: {
24
24
  googleDrive,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-find-file",
6
6
  name: "Find File",
7
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.1",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  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 docs](https://developers.google.com/drive/api/v3/search-files) for more information",
10
- version: "0.1.1",
10
+ version: "0.1.3",
11
11
  type: "action",
12
12
  props: {
13
13
  googleDrive,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-find-forms",
6
6
  name: "Find Forms",
7
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.2",
8
+ version: "0.0.4",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "google_drive-find-spreadsheets",
6
6
  name: "Find Spreadsheets",
7
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.1",
8
+ version: "0.1.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 docs](https://developers.google.com/drive/api/v3/search-files) for more information",
15
- version: "0.1.1",
15
+ version: "0.1.3",
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 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.1",
7
+ version: "0.1.3",
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.5",
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-move-file",
5
5
  name: "Move File",
6
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.1",
7
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
8
- version: "0.1.1",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  googleDrive,
@@ -15,7 +15,7 @@ export default {
15
15
  key: "google_drive-replace-file",
16
16
  name: "Replace File",
17
17
  description: "Upload a file that replaces an existing file. [See the docs](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
18
- version: "0.1.1",
18
+ version: "0.1.3",
19
19
  type: "action",
20
20
  props: {
21
21
  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 docs](https://developers.google.com/drive/api/v3/search-shareddrives) for more information",
7
- version: "0.1.1",
7
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
11
- version: "0.1.1",
11
+ version: "0.1.3",
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 docs](https://developers.google.com/drive/api/v3/reference/drives/update) for more information",
7
- version: "0.1.1",
7
+ version: "0.1.3",
8
8
  type: "action",
9
9
  props: {
10
10
  googleDrive,
@@ -10,7 +10,7 @@ export default {
10
10
  key: "google_drive-upload-file",
11
11
  name: "Upload File",
12
12
  description: "Copy an existing file to Google Drive. [See the docs](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
13
- version: "0.1.3",
13
+ version: "0.1.5",
14
14
  type: "action",
15
15
  props: {
16
16
  googleDrive,
@@ -816,8 +816,6 @@ export default {
816
816
  };
817
817
  },
818
818
  async activateFileHook(channelID, url, fileId) {
819
- channelID = channelID || uuid();
820
-
821
819
  const {
822
820
  expiration,
823
821
  resourceId,
@@ -830,7 +828,6 @@ export default {
830
828
  return {
831
829
  expiration,
832
830
  resourceId,
833
- channelID,
834
831
  };
835
832
  },
836
833
  async deactivateHook(channelID, resourceId) {
@@ -851,16 +848,16 @@ export default {
851
848
  await this.stopNotifications(channelID, resourceId);
852
849
  },
853
850
  async renewSubscription(drive, subscription, url, channelID, pageToken) {
854
- const newChannelID = channelID || uuid();
855
851
  const driveId = this.getDriveId(drive);
856
852
  const newPageToken = pageToken || (await this.getPageToken(driveId));
857
853
 
858
854
  const {
859
855
  expiration,
860
856
  resourceId,
857
+ newChannelID,
861
858
  } = await this.checkResubscription(
862
859
  subscription,
863
- newChannelID,
860
+ channelID,
864
861
  newPageToken,
865
862
  url,
866
863
  drive,
@@ -880,6 +877,7 @@ export default {
880
877
  endpoint,
881
878
  drive,
882
879
  ) {
880
+ const newChannelID = uuid();
883
881
  const driveId = this.getDriveId(drive);
884
882
  if (subscription && subscription.resourceId) {
885
883
  console.log(
@@ -893,7 +891,7 @@ export default {
893
891
  expiration,
894
892
  resourceId,
895
893
  } = await this.watchDrive(
896
- channelID,
894
+ newChannelID,
897
895
  endpoint,
898
896
  pageToken,
899
897
  driveId,
@@ -901,15 +899,21 @@ export default {
901
899
  return {
902
900
  expiration,
903
901
  resourceId,
902
+ newChannelID,
904
903
  };
905
904
  },
906
- async renewFileSubscription(subscription, url, channelID, fileId, nextRunTimestamp) {
905
+ async renewFileSubscription(
906
+ subscription,
907
+ url,
908
+ channelID,
909
+ newChannelID,
910
+ fileId,
911
+ nextRunTimestamp,
912
+ ) {
907
913
  if (nextRunTimestamp && subscription?.expiration < nextRunTimestamp) {
908
914
  return subscription;
909
915
  }
910
916
 
911
- const newChannelID = channelID || uuid();
912
-
913
917
  if (subscription?.resourceId) {
914
918
  console.log(
915
919
  `Notifications for resource ${subscription.resourceId} are expiring at ${subscription.expiration}. Renewing`,
@@ -923,13 +927,12 @@ export default {
923
927
  expiration,
924
928
  resourceId,
925
929
  } = await this.watchFile(
926
- channelID,
930
+ newChannelID,
927
931
  url,
928
932
  fileId,
929
933
  );
930
934
 
931
935
  return {
932
- newChannelID,
933
936
  expiration,
934
937
  resourceId,
935
938
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_drive",
3
- "version": "0.6.17",
3
+ "version": "0.6.19",
4
4
  "description": "Pipedream Google_drive Components",
5
5
  "main": "google_drive.app.mjs",
6
6
  "keywords": [
@@ -13,6 +13,8 @@
13
13
  "@googleapis/drive": "^2.3.0",
14
14
  "@pipedream/platform": "^1.4.0",
15
15
  "cron-parser": "^4.9.0",
16
+ "google-docs-mustaches": "^1.2.2",
17
+ "got": "13.0.0",
16
18
  "lodash": "^4.17.21",
17
19
  "mime-db": "^1.51.0",
18
20
  "uuid": "^8.3.2"
@@ -17,7 +17,7 @@ export default {
17
17
  key: "google_drive-changes-to-specific-files",
18
18
  name: "Changes to Specific Files",
19
19
  description: "Watches for changes to specific files, emitting an event any time 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.",
20
- version: "0.1.3",
20
+ version: "0.1.5",
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
@@ -48,7 +48,7 @@ export default {
48
48
  // You can pass the same channel ID in watch requests for multiple files, so
49
49
  // our channel ID is fixed for this component to simplify the state we have to
50
50
  // keep track of.
51
- const channelID = this._getChannelID() || uuid();
51
+ const channelID = uuid();
52
52
 
53
53
  // Subscriptions are keyed on Google's resourceID, "an opaque value that
54
54
  // identifies the watched resource". This value is included in request
@@ -116,10 +116,9 @@ export default {
116
116
  }
117
117
  },
118
118
  async renewFileSubscriptions(event) {
119
- // Assume subscription & channelID may all be undefined at
120
- // this point Handle their absence appropriately.
121
119
  const subscriptions = this._getSubscriptions() || {};
122
- const channelID = this._getChannelID() || uuid();
120
+ const channelID = this._getChannelID();
121
+ const newChannelID = uuid();
123
122
 
124
123
  const nextRunTimestamp = this._getNextTimerEventTimestamp(event);
125
124
 
@@ -140,6 +139,7 @@ export default {
140
139
  subscription,
141
140
  this.http.endpoint,
142
141
  channelID,
142
+ newChannelID,
143
143
  fileID,
144
144
  nextRunTimestamp,
145
145
  );
@@ -149,7 +149,7 @@ export default {
149
149
  };
150
150
  }
151
151
  this._setSubscriptions(subscriptions);
152
- this._setChannelID(channelID);
152
+ this._setChannelID(newChannelID);
153
153
  },
154
154
  },
155
155
  async run(event) {
@@ -26,7 +26,7 @@ export default {
26
26
  key: "google_drive-changes-to-specific-files-shared-drive",
27
27
  name: "Changes to Specific Files (Shared Drive)",
28
28
  description: "Watches for changes to specific files in a shared drive, emitting an event any time a change is made to one of those files",
29
- version: "0.1.3",
29
+ version: "0.1.5",
30
30
  type: "source",
31
31
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
32
32
  // 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 any time a new file is added in your linked Google Drive",
13
- version: "0.1.4",
13
+ version: "0.1.6",
14
14
  type: "source",
15
15
  dedupe: "unique",
16
16
  props: {
@@ -17,7 +17,7 @@ export default {
17
17
  name: "New or Modified Comments",
18
18
  description:
19
19
  "Emits a new event any time a file comment is added, modified, or deleted in your linked Google Drive",
20
- version: "0.1.4",
20
+ version: "0.1.6",
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
@@ -21,7 +21,7 @@ export default {
21
21
  key: "google_drive-new-or-modified-files",
22
22
  name: "New or Modified Files",
23
23
  description: "Emit new event any time any file in your linked Google Drive is added, modified, or deleted",
24
- version: "0.2.0",
24
+ version: "0.2.2",
25
25
  type: "source",
26
26
  // Dedupe events based on the "x-goog-message-number" header for the target channel:
27
27
  // 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",
22
22
  description: "Emit new event any time any folder in your linked Google Drive is added, modified, or deleted",
23
- version: "0.1.2",
23
+ version: "0.1.4",
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.1",
8
+ version: "0.1.3",
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 each time a new spreadsheet is created in a drive.",
9
- version: "0.1.2",
9
+ version: "0.1.4",
10
10
  props: {
11
11
  googleDrive: newFilesInstant.props.googleDrive,
12
12
  db: newFilesInstant.props.db,