diff --git a/components/google_drive/actions/add-file-sharing-preference/add-file-sharing-preference.mjs b/components/google_drive/actions/add-file-sharing-preference/add-file-sharing-preference.mjs index effc1cfdbfb95..ea6bcc82a55c8 100644 --- a/components/google_drive/actions/add-file-sharing-preference/add-file-sharing-preference.mjs +++ b/components/google_drive/actions/add-file-sharing-preference/add-file-sharing-preference.mjs @@ -20,7 +20,7 @@ export default { name: "Share File or Folder", description: "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)", - version: "0.2.0", + version: "0.2.1", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/copy-file/copy-file.mjs b/components/google_drive/actions/copy-file/copy-file.mjs index a3b2b97595fca..a8a0039d2a806 100644 --- a/components/google_drive/actions/copy-file/copy-file.mjs +++ b/components/google_drive/actions/copy-file/copy-file.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-copy-file", name: "Copy File", description: "Create a copy of the specified file. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/copy) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/create-file-from-template/create-file-from-template.mjs b/components/google_drive/actions/create-file-from-template/create-file-from-template.mjs index a6129e2a89815..02ab26b5b24c7 100644 --- a/components/google_drive/actions/create-file-from-template/create-file-from-template.mjs +++ b/components/google_drive/actions/create-file-from-template/create-file-from-template.mjs @@ -8,7 +8,7 @@ export default { key: "google_drive-create-file-from-template", name: "Create New File From Template", 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)", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/create-file-from-text/create-file-from-text.mjs b/components/google_drive/actions/create-file-from-text/create-file-from-text.mjs index 8114e26e48f1f..21e5018cae7a5 100644 --- a/components/google_drive/actions/create-file-from-text/create-file-from-text.mjs +++ b/components/google_drive/actions/create-file-from-text/create-file-from-text.mjs @@ -5,7 +5,7 @@ export default { key: "google_drive-create-file-from-text", name: "Create New File From Text", description: "Create a new file from plain text. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information", - version: "0.2.0", + version: "0.2.1", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/create-folder/create-folder.mjs b/components/google_drive/actions/create-folder/create-folder.mjs index 37769355cd5f6..1052c3413632f 100644 --- a/components/google_drive/actions/create-folder/create-folder.mjs +++ b/components/google_drive/actions/create-folder/create-folder.mjs @@ -13,7 +13,7 @@ export default { key: "google_drive-create-folder", name: "Create Folder", description: "Create a new empty folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/create) for more information", - version: "0.1.8", + version: "0.1.9", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/create-shared-drive/create-shared-drive.mjs b/components/google_drive/actions/create-shared-drive/create-shared-drive.mjs index 5a918522d3ee7..b3b84092c98d8 100644 --- a/components/google_drive/actions/create-shared-drive/create-shared-drive.mjs +++ b/components/google_drive/actions/create-shared-drive/create-shared-drive.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-create-shared-drive", name: "Create Shared Drive", description: "Create a new shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/create) for more information", - version: "0.1.8", + version: "0.1.9", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/delete-file/delete-file.mjs b/components/google_drive/actions/delete-file/delete-file.mjs index e6b13489050dd..26a710a412685 100644 --- a/components/google_drive/actions/delete-file/delete-file.mjs +++ b/components/google_drive/actions/delete-file/delete-file.mjs @@ -5,7 +5,7 @@ export default { name: "Delete File", description: "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", - version: "0.1.8", + version: "0.1.9", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/delete-shared-drive/delete-shared-drive.mjs b/components/google_drive/actions/delete-shared-drive/delete-shared-drive.mjs index 927f4048ea6aa..05a814b7a39fe 100644 --- a/components/google_drive/actions/delete-shared-drive/delete-shared-drive.mjs +++ b/components/google_drive/actions/delete-shared-drive/delete-shared-drive.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-delete-shared-drive", name: "Delete Shared Drive", description: "Delete a shared drive without any content. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/delete) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/download-file/download-file.mjs b/components/google_drive/actions/download-file/download-file.mjs index 37e7989b8a921..eca387427a84d 100644 --- a/components/google_drive/actions/download-file/download-file.mjs +++ b/components/google_drive/actions/download-file/download-file.mjs @@ -18,7 +18,7 @@ export default { key: "google_drive-download-file", name: "Download File", description: "Download a file. [See the documentation](https://developers.google.com/drive/api/v3/manage-downloads) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/find-file/find-file.mjs b/components/google_drive/actions/find-file/find-file.mjs index 261eabaee5db5..924933cda7843 100644 --- a/components/google_drive/actions/find-file/find-file.mjs +++ b/components/google_drive/actions/find-file/find-file.mjs @@ -6,7 +6,7 @@ export default { key: "google_drive-find-file", name: "Find File", description: "Search for a specific file by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/find-folder/find-folder.mjs b/components/google_drive/actions/find-folder/find-folder.mjs index 8d57a5db04e65..7e6b0481aabae 100644 --- a/components/google_drive/actions/find-folder/find-folder.mjs +++ b/components/google_drive/actions/find-folder/find-folder.mjs @@ -7,7 +7,7 @@ export default { key: "google_drive-find-folder", name: "Find Folder", description: "Search for a specific folder by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/find-forms/find-forms.mjs b/components/google_drive/actions/find-forms/find-forms.mjs index 588cf528a579c..c9d1c9b3c03ec 100644 --- a/components/google_drive/actions/find-forms/find-forms.mjs +++ b/components/google_drive/actions/find-forms/find-forms.mjs @@ -6,7 +6,7 @@ export default { key: "google_drive-find-forms", name: "Find Forms", 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", - version: "0.0.8", + version: "0.0.9", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs b/components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs index d38e6b625be01..3cfa064bcc8b6 100644 --- a/components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs +++ b/components/google_drive/actions/find-spreadsheets/find-spreadsheets.mjs @@ -6,7 +6,7 @@ export default { key: "google_drive-find-spreadsheets", name: "Find Spreadsheets", description: "Search for a specific spreadsheet by name. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/get-file-by-id/get-file-by-id.mjs b/components/google_drive/actions/get-file-by-id/get-file-by-id.mjs index cb8723dea9b1a..df5d4f3af6d5f 100644 --- a/components/google_drive/actions/get-file-by-id/get-file-by-id.mjs +++ b/components/google_drive/actions/get-file-by-id/get-file-by-id.mjs @@ -5,7 +5,7 @@ export default { key: "google_drive-get-file-by-id", name: "Get File By ID", description: "Get info on a specific file. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/files/get) for more information", - version: "0.0.4", + version: "0.0.5", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/get-folder-id-for-path/get-folder-id-for-path.mjs b/components/google_drive/actions/get-folder-id-for-path/get-folder-id-for-path.mjs index 4ad1c908aa6c7..c1d843b2f0ad3 100644 --- a/components/google_drive/actions/get-folder-id-for-path/get-folder-id-for-path.mjs +++ b/components/google_drive/actions/get-folder-id-for-path/get-folder-id-for-path.mjs @@ -12,7 +12,7 @@ export default { key: "google_drive-get-folder-id-for-path", name: "Get Folder ID for a Path", description: "Retrieve a folderId for a path. [See the documentation](https://developers.google.com/drive/api/v3/search-files) for more information", - version: "0.1.9", + version: "0.1.10", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/get-shared-drive/get-shared-drive.mjs b/components/google_drive/actions/get-shared-drive/get-shared-drive.mjs index c9d8471cdec84..31399982aa955 100644 --- a/components/google_drive/actions/get-shared-drive/get-shared-drive.mjs +++ b/components/google_drive/actions/get-shared-drive/get-shared-drive.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-get-shared-drive", name: "Get Shared Drive", 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", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/list-access-proposals/list-access-proposals.mjs b/components/google_drive/actions/list-access-proposals/list-access-proposals.mjs new file mode 100644 index 0000000000000..51258cc0f4d57 --- /dev/null +++ b/components/google_drive/actions/list-access-proposals/list-access-proposals.mjs @@ -0,0 +1,61 @@ +import googleDrive from "../../google_drive.app.mjs"; + +export default { + key: "google_drive-list-access-proposals", + name: "List Access Proposals", + description: "List access proposals for a file or folder. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/accessproposals/list)", + version: "0.0.1", + type: "action", + props: { + googleDrive, + drive: { + propDefinition: [ + googleDrive, + "watchedDrive", + ], + }, + fileOrFolderId: { + propDefinition: [ + googleDrive, + "fileOrFolderId", + (c) => ({ + drive: c.drive, + }), + ], + }, + maxResults: { + type: "integer", + label: "Max Results", + description: "The maximum number of results to return", + default: 100, + optional: true, + }, + }, + async run({ $ }) { + const results = []; + let pageToken; + + do { + const { + accessProposals, nextPageToken, + } = await this.googleDrive.listAccessProposals({ + fileId: this.fileOrFolderId, + pageToken, + }); + if (!accessProposals) { + break; + } + results.push(...accessProposals); + if (this.maxResults && results.length >= this.maxResults) { + results.length = this.maxResults; + break; + } + pageToken = nextPageToken; + } while (pageToken); + + $.export("$summary", `Successfully retrieved ${results.length} access proposal${results.length === 1 + ? "" + : "s"}.`); + return results; + }, +}; diff --git a/components/google_drive/actions/list-files/list-files.mjs b/components/google_drive/actions/list-files/list-files.mjs index ba1a569af9686..277328e68a571 100644 --- a/components/google_drive/actions/list-files/list-files.mjs +++ b/components/google_drive/actions/list-files/list-files.mjs @@ -5,7 +5,7 @@ export default { key: "google_drive-list-files", name: "List Files", description: "List files from a specific folder. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/list) for more information", - version: "0.1.11", + version: "0.1.12", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/move-file-to-trash/move-file-to-trash.mjs b/components/google_drive/actions/move-file-to-trash/move-file-to-trash.mjs index ab16df984a109..98ab12c1648bd 100644 --- a/components/google_drive/actions/move-file-to-trash/move-file-to-trash.mjs +++ b/components/google_drive/actions/move-file-to-trash/move-file-to-trash.mjs @@ -5,7 +5,7 @@ export default { key: "google_drive-move-file-to-trash", name: "Move File to Trash", description: "Move a file or folder to trash. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/move-file/move-file.mjs b/components/google_drive/actions/move-file/move-file.mjs index 6977ccf850979..2d6c229318bd9 100644 --- a/components/google_drive/actions/move-file/move-file.mjs +++ b/components/google_drive/actions/move-file/move-file.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-move-file", name: "Move File", 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", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/resolve-access-proposal/resolve-access-proposal.mjs b/components/google_drive/actions/resolve-access-proposal/resolve-access-proposal.mjs new file mode 100644 index 0000000000000..a81496729d22a --- /dev/null +++ b/components/google_drive/actions/resolve-access-proposal/resolve-access-proposal.mjs @@ -0,0 +1,79 @@ +import googleDrive from "../../google_drive.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; + +export default { + key: "google_drive-resolve-access-proposal", + name: "Resolve Access Proposals", + description: "Accept or deny a request for access to a file or folder in Google Drive. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/accessproposals/resolve)", + version: "0.0.1", + type: "action", + props: { + googleDrive, + drive: { + propDefinition: [ + googleDrive, + "watchedDrive", + ], + }, + fileOrFolderId: { + propDefinition: [ + googleDrive, + "fileOrFolderId", + (c) => ({ + drive: c.drive, + }), + ], + }, + accessProposalId: { + propDefinition: [ + googleDrive, + "accessProposalId", + (c) => ({ + fileId: c.fileOrFolderId, + }), + ], + }, + action: { + type: "string", + label: "Action", + description: "The action to take on the AccessProposal", + options: [ + "ACCEPT", + "DENY", + ], + }, + roles: { + type: "string[]", + label: "Roles", + description: "The roles to allow. Note: This field is required for the `ACCEPT` action.", + options: [ + "writer", + "commenter", + "reader", + ], + optional: true, + }, + sendNotification: { + type: "boolean", + label: "Send Notification", + description: "Whether to send an email to the requester when the AccessProposal is denied or accepted", + optional: true, + }, + }, + async run({ $ }) { + if (this.action === "ACCEPT" && !this.roles?.length) { + throw new ConfigurationError("A Role is required for the `ACCEPT` action"); + } + + const response = await this.googleDrive.resolveAccessProposal({ + fileId: this.fileOrFolderId, + proposalId: this.accessProposalId, + action: this.action, + role: this.roles, + sendNotification: this.sendNotification, + }); + + $.export("$summary", `Successfully resolved proposal with ID: ${this.accessProposalId}`); + return response; + }, +}; diff --git a/components/google_drive/actions/search-shared-drives/search-shared-drives.mjs b/components/google_drive/actions/search-shared-drives/search-shared-drives.mjs index d696f213e0882..f194c6748bbe3 100644 --- a/components/google_drive/actions/search-shared-drives/search-shared-drives.mjs +++ b/components/google_drive/actions/search-shared-drives/search-shared-drives.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-search-shared-drives", name: "Search for Shared Drives", description: "Search for shared drives with query options. [See the documentation](https://developers.google.com/drive/api/v3/search-shareddrives) for more information", - version: "0.1.8", + version: "0.1.9", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/update-file/update-file.mjs b/components/google_drive/actions/update-file/update-file.mjs index 2a027e9e0b442..1157032adb998 100644 --- a/components/google_drive/actions/update-file/update-file.mjs +++ b/components/google_drive/actions/update-file/update-file.mjs @@ -9,7 +9,7 @@ export default { key: "google_drive-update-file", name: "Update File", 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", - version: "1.0.0", + version: "1.0.1", type: "action", additionalProps, props: { diff --git a/components/google_drive/actions/update-shared-drive/update-shared-drive.mjs b/components/google_drive/actions/update-shared-drive/update-shared-drive.mjs index f15353d1aedd4..9a6804f67d790 100644 --- a/components/google_drive/actions/update-shared-drive/update-shared-drive.mjs +++ b/components/google_drive/actions/update-shared-drive/update-shared-drive.mjs @@ -4,7 +4,7 @@ export default { key: "google_drive-update-shared-drive", name: "Update Shared Drive", description: "Update an existing shared drive. [See the documentation](https://developers.google.com/drive/api/v3/reference/drives/update) for more information", - version: "0.1.7", + version: "0.1.8", type: "action", props: { googleDrive, diff --git a/components/google_drive/actions/upload-file/upload-file.mjs b/components/google_drive/actions/upload-file/upload-file.mjs index 92cdbbf6e3ae4..57d5376f7ec73 100644 --- a/components/google_drive/actions/upload-file/upload-file.mjs +++ b/components/google_drive/actions/upload-file/upload-file.mjs @@ -13,7 +13,7 @@ export default { key: "google_drive-upload-file", name: "Upload File", description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information", - version: "1.0.0", + version: "1.0.1", type: "action", additionalProps, props: { diff --git a/components/google_drive/google_drive.app.mjs b/components/google_drive/google_drive.app.mjs index f36a9b4ec744c..2d8404bf6cd64 100644 --- a/components/google_drive/google_drive.app.mjs +++ b/components/google_drive/google_drive.app.mjs @@ -255,6 +255,36 @@ export default { `), optional: true, }, + accessProposalId: { + type: "string", + label: "Access Proposal ID", + description: "The identifier of an access proposal (when a user requests access to a file/folder)", + async options({ + fileId, prevContext, + }) { + if (!fileId) { + return []; + } + const { pageToken } = prevContext; + const { + accessProposals, nextPageToken, + } = await this.listAccessProposals({ + fileId, + pageToken, + }); + return { + options: accessProposals?.map(({ + proposalId: value, requesterEmailAddress: label, + }) => ({ + label, + value, + })) || [], + context: { + pageToken: nextPageToken, + }, + }; + }, + }, }, methods: { // Static methods @@ -1437,5 +1467,13 @@ export default { async getExportFormats() { return (await this.getAbout("exportFormats")).exportFormats; }, + async listAccessProposals(opts = {}) { + const drive = this.drive(); + return (await drive.accessproposals.list(opts)).data; + }, + async resolveAccessProposal(opts = {}) { + const drive = this.drive(); + return (await drive.accessproposals.resolve(opts)).data; + }, }, }; diff --git a/components/google_drive/package.json b/components/google_drive/package.json index c718a5cdc4174..6914de3452ab5 100644 --- a/components/google_drive/package.json +++ b/components/google_drive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_drive", - "version": "0.8.11", + "version": "0.9.0", "description": "Pipedream Google_drive Components", "main": "google_drive.app.mjs", "keywords": [ @@ -11,7 +11,7 @@ "author": "Pipedream (https://pipedream.com/)", "dependencies": { "@googleapis/drive": "^2.3.0", - "@pipedream/platform": "^1.4.0", + "@pipedream/platform": "^3.0.3", "cron-parser": "^4.9.0", "google-docs-mustaches": "^1.2.2", "got": "13.0.0", diff --git a/components/google_drive/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs b/components/google_drive/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs index e69ea6d2b0dc9..b13e72c1ef903 100644 --- a/components/google_drive/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs +++ b/components/google_drive/sources/changes-to-specific-files-shared-drive/changes-to-specific-files-shared-drive.mjs @@ -27,7 +27,7 @@ export default { key: "google_drive-changes-to-specific-files-shared-drive", name: "Changes to Specific Files (Shared Drive)", description: "Watches for changes to specific files in a shared drive, emitting an event when a change is made to one of those files", - version: "0.2.4", + version: "0.2.5", type: "source", // Dedupe events based on the "x-goog-message-number" header for the target channel: // https://developers.google.com/drive/api/v3/push#making-watch-requests diff --git a/components/google_drive/sources/changes-to-specific-files/changes-to-specific-files.mjs b/components/google_drive/sources/changes-to-specific-files/changes-to-specific-files.mjs index 0939d3d9f591d..e0fd0414f0039 100644 --- a/components/google_drive/sources/changes-to-specific-files/changes-to-specific-files.mjs +++ b/components/google_drive/sources/changes-to-specific-files/changes-to-specific-files.mjs @@ -15,7 +15,7 @@ export default { key: "google_drive-changes-to-specific-files", name: "Changes to Specific Files", 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.", - version: "0.2.4", + version: "0.2.5", type: "source", // Dedupe events based on the "x-goog-message-number" header for the target channel: // https://developers.google.com/drive/api/v3/push#making-watch-requests diff --git a/components/google_drive/sources/new-access-proposal/new-access-proposal.mjs b/components/google_drive/sources/new-access-proposal/new-access-proposal.mjs new file mode 100644 index 0000000000000..e94937f9b555f --- /dev/null +++ b/components/google_drive/sources/new-access-proposal/new-access-proposal.mjs @@ -0,0 +1,81 @@ +import googleDrive from "../../google_drive.app.mjs"; +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import sampleEmit from "./test-event.mjs"; + +export default { + key: "google_drive-new-access-proposal", + name: "New Access Proposal", + description: "Emit new event when a new access proposal is requested in Google Drive", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + googleDrive, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + drive: { + propDefinition: [ + googleDrive, + "watchedDrive", + ], + }, + fileOrFolderId: { + propDefinition: [ + googleDrive, + "fileOrFolderId", + (c) => ({ + drive: c.drive, + }), + ], + }, + }, + methods: { + _getLastTs() { + return this.db.get("lastTs") || 0; + }, + _setLastTs(lastTs) { + this.db.set("lastTs", lastTs); + }, + generateMeta(item) { + return { + id: item.proposalId, + summary: `New Request From: ${item.requesterEmailAddress}`, + ts: Date.parse(item.createTime), + }; + }, + }, + async run() { + const lastTs = this._getLastTs(); + let maxTs = lastTs; + let pageToken; + + do { + const { + accessProposals, nextPageToken, + } = await this.googleDrive.listAccessProposals({ + fileId: this.fileOrFolderId, + pageToken, + }); + if (!accessProposals) { + break; + } + for (const proposal of accessProposals) { + const ts = Date.parse(proposal.createTime); + if (ts > lastTs) { + const meta = this.generateMeta(proposal); + this.$emit(proposal, meta); + maxTs = Math.max(ts, maxTs); + } + } + pageToken = nextPageToken; + } while (pageToken); + + this._setLastTs(maxTs); + }, + sampleEmit, +}; diff --git a/components/google_drive/sources/new-access-proposal/test-event.mjs b/components/google_drive/sources/new-access-proposal/test-event.mjs new file mode 100644 index 0000000000000..7d295eb4fc28c --- /dev/null +++ b/components/google_drive/sources/new-access-proposal/test-event.mjs @@ -0,0 +1,13 @@ +export default { + "fileId": "", + "proposalId": "", + "requesterEmailAddress": "", + "recipientEmailAddress": "", + "rolesAndViews": [ + { + "role": "writer" + } + ], + "requestMessage": "", + "createTime": "2025-04-11T18:36:28.979859Z" +} \ No newline at end of file diff --git a/components/google_drive/sources/new-files-instant/new-files-instant.mjs b/components/google_drive/sources/new-files-instant/new-files-instant.mjs index 4dcb36e9294fe..5b12cea1d46ba 100644 --- a/components/google_drive/sources/new-files-instant/new-files-instant.mjs +++ b/components/google_drive/sources/new-files-instant/new-files-instant.mjs @@ -10,7 +10,7 @@ export default { key: "google_drive-new-files-instant", name: "New Files (Instant)", description: "Emit new event when a new file is added in your linked Google Drive", - version: "0.1.12", + version: "0.1.13", type: "source", dedupe: "unique", props: { diff --git a/components/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs b/components/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs index 8d02ae7b5fb85..5cdfc1eaec7b7 100644 --- a/components/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs +++ b/components/google_drive/sources/new-files-shared-drive/new-files-shared-drive.mjs @@ -7,7 +7,7 @@ export default { key: "google_drive-new-files-shared-drive", name: "New Files (Shared Drive)", description: "Emit new event when a new file is added in your shared Google Drive", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", props: { diff --git a/components/google_drive/sources/new-or-modified-comments/new-or-modified-comments.mjs b/components/google_drive/sources/new-or-modified-comments/new-or-modified-comments.mjs index c094923910762..8cb551e06d47d 100644 --- a/components/google_drive/sources/new-or-modified-comments/new-or-modified-comments.mjs +++ b/components/google_drive/sources/new-or-modified-comments/new-or-modified-comments.mjs @@ -17,7 +17,7 @@ export default { name: "New or Modified Comments (Instant)", description: "Emit new event when a comment is created or modified in the selected file", - version: "1.0.3", + version: "1.0.4", type: "source", // Dedupe events based on the "x-goog-message-number" header for the target channel: // https://developers.google.com/drive/api/v3/push#making-watch-requests diff --git a/components/google_drive/sources/new-or-modified-files/new-or-modified-files.mjs b/components/google_drive/sources/new-or-modified-files/new-or-modified-files.mjs index 21f5bb4461651..88dab163435fb 100644 --- a/components/google_drive/sources/new-or-modified-files/new-or-modified-files.mjs +++ b/components/google_drive/sources/new-or-modified-files/new-or-modified-files.mjs @@ -24,7 +24,7 @@ export default { key: "google_drive-new-or-modified-files", name: "New or Modified Files (Instant)", description: "Emit new event when a file in the selected Drive is created, modified or trashed.", - version: "0.3.4", + version: "0.3.5", type: "source", // Dedupe events based on the "x-goog-message-number" header for the target channel: // https://developers.google.com/drive/api/v3/push#making-watch-requests diff --git a/components/google_drive/sources/new-or-modified-folders/new-or-modified-folders.mjs b/components/google_drive/sources/new-or-modified-folders/new-or-modified-folders.mjs index 1a6e4ccee51c8..be312b35a4cfb 100644 --- a/components/google_drive/sources/new-or-modified-folders/new-or-modified-folders.mjs +++ b/components/google_drive/sources/new-or-modified-folders/new-or-modified-folders.mjs @@ -20,7 +20,7 @@ export default { key: "google_drive-new-or-modified-folders", name: "New or Modified Folders (Instant)", description: "Emit new event when a folder is created or modified in the selected Drive", - version: "0.1.9", + version: "0.1.10", type: "source", // Dedupe events based on the "x-goog-message-number" header for the target channel: // https://developers.google.com/drive/api/v3/push#making-watch-requests diff --git a/components/google_drive/sources/new-shared-drive/new-shared-drive.mjs b/components/google_drive/sources/new-shared-drive/new-shared-drive.mjs index 08084b2de4c17..0dd1a5f322615 100644 --- a/components/google_drive/sources/new-shared-drive/new-shared-drive.mjs +++ b/components/google_drive/sources/new-shared-drive/new-shared-drive.mjs @@ -5,7 +5,7 @@ export default { key: "google_drive-new-shared-drive", name: "New Shared Drive", description: "Emits a new event any time a shared drive is created.", - version: "0.1.7", + version: "0.1.8", type: "source", dedupe: "unique", props: { diff --git a/components/google_drive/sources/new-spreadsheet/new-spreadsheet.mjs b/components/google_drive/sources/new-spreadsheet/new-spreadsheet.mjs index 461bdf22c3d7f..8fbc91f1b9ee4 100644 --- a/components/google_drive/sources/new-spreadsheet/new-spreadsheet.mjs +++ b/components/google_drive/sources/new-spreadsheet/new-spreadsheet.mjs @@ -6,7 +6,7 @@ export default { type: "source", name: "New Spreadsheet (Instant)", description: "Emit new event when a new spreadsheet is created in a drive.", - version: "0.1.9", + version: "0.1.10", props: { googleDrive: newFilesInstant.props.googleDrive, db: newFilesInstant.props.db, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c257e350a5fb5..164a04a964049 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5415,8 +5415,8 @@ importers: specifier: ^2.3.0 version: 2.4.0 '@pipedream/platform': - specifier: ^1.4.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 cron-parser: specifier: ^4.9.0 version: 4.9.0 @@ -8656,8 +8656,7 @@ importers: components/notiff: {} - components/notiff_io: - specifiers: {} + components/notiff_io: {} components/notion: dependencies: @@ -12000,8 +11999,7 @@ importers: components/smartengage: {} - components/smartlead: - specifiers: {} + components/smartlead: {} components/smartproxy: {}