diff --git a/components/google_drive/package.json b/components/google_drive/package.json index c61df3a50cb9e..ef2890c90152c 100644 --- a/components/google_drive/package.json +++ b/components/google_drive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_drive", - "version": "1.3.0", + "version": "1.3.1", "description": "Pipedream Google_drive Components", "main": "google_drive.app.mjs", "keywords": [ diff --git a/components/google_drive/sources/new-or-modified-files-polling/new-or-modified-files-polling.mjs b/components/google_drive/sources/new-or-modified-files-polling/new-or-modified-files-polling.mjs index 43976560dcdf7..1385bfe988588 100644 --- a/components/google_drive/sources/new-or-modified-files-polling/new-or-modified-files-polling.mjs +++ b/components/google_drive/sources/new-or-modified-files-polling/new-or-modified-files-polling.mjs @@ -8,7 +8,7 @@ export default { key: "google_drive-new-or-modified-files-polling", name: "New or Modified Files (Polling)", description: "Emit new event when a file in the selected Drive is created, modified or trashed. [See the documentation](https://developers.google.com/drive/api/v3/reference/changes/list)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", props: { @@ -29,39 +29,34 @@ export default { optional: false, }, files: { + propDefinition: [ + googleDrive, + "fileId", + ({ drive }) => ({ + drive, + }), + ], type: "string[]", label: "Files", - description: "The specific file(s) you want to watch for changes. Leave blank to watch all files in the Drive. Note that events will only be emitted for files directly in these folders (not in their subfolders, unless also selected here)", + description: "The specific file(s) to watch for changes. Leave blank to watch all files in the Drive. Note that events will only be emitted for files directly in these folders (not in their subfolders, unless also selected here)", optional: true, default: [], - options({ prevContext }) { - const { nextPageToken } = prevContext; - return this.googleDrive.listFilesOptions(nextPageToken, this.getListFilesOpts()); - }, }, folders: { + propDefinition: [ + googleDrive, + "folderId", + ({ drive }) => ({ + drive, + baseOpts: { + q: `mimeType = '${GOOGLE_DRIVE_FOLDER_MIME_TYPE}' and trashed = false`, + }, + }), + ], type: "string[]", label: "Folders", description: "The specific folder(s) to watch for changes. Leave blank to watch all folders in the Drive.", optional: true, - default: [], - options({ prevContext }) { - const { nextPageToken } = prevContext; - const baseOpts = { - q: "mimeType = 'application/vnd.google-apps.folder' and trashed = false", - }; - const isMyDrive = this.googleDrive.isMyDrive(this.drive); - const opts = isMyDrive - ? baseOpts - : { - ...baseOpts, - corpora: "drive", - driveId: this.getDriveId(), - includeItemsFromAllDrives: true, - supportsAllDrives: true, - }; - return this.googleDrive.listFilesOptions(nextPageToken, opts); - }, }, newFilesOnly: { type: "boolean", diff --git a/components/google_sheets/package.json b/components/google_sheets/package.json index 65bc7365d07b2..dc6c3074ffe3e 100644 --- a/components/google_sheets/package.json +++ b/components/google_sheets/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_sheets", - "version": "0.11.0", + "version": "0.12.0", "description": "Pipedream Google_sheets Components", "main": "google_sheets.app.mjs", "keywords": [ diff --git a/components/google_sheets/sources/new-worksheet-polling/new-worksheet-polling.mjs b/components/google_sheets/sources/new-worksheet-polling/new-worksheet-polling.mjs new file mode 100644 index 0000000000000..d1b3dcb531089 --- /dev/null +++ b/components/google_sheets/sources/new-worksheet-polling/new-worksheet-polling.mjs @@ -0,0 +1,53 @@ +import googleSheets from "../../google_sheets.app.mjs"; +import common from "../common/new-worksheet.mjs"; +import base from "../common/http-based/base.mjs"; +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "google_sheets-new-worksheet-polling", + name: "New Worksheet (Polling)", + description: "Emit new event each time a new worksheet is created in a spreadsheet.", + version: "0.0.1", + dedupe: "unique", + type: "source", + hooks: { + ...common.hooks, + }, + props: { + googleSheets, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + watchedDrive: { + propDefinition: [ + googleSheets, + "watchedDrive", + ], + }, + sheetID: { + propDefinition: [ + googleSheets, + "sheetID", + (c) => ({ + driveId: googleSheets.methods.getDriveId(c.watchedDrive), + }), + ], + }, + }, + methods: { + ...base.methods, + ...common.methods, + }, + async run() { + await this.processSpreadsheet({ + spreadsheetId: this.sheetID, + }); + }, + sampleEmit, +}; diff --git a/components/google_sheets/sources/new-worksheet-polling/test-event.mjs b/components/google_sheets/sources/new-worksheet-polling/test-event.mjs new file mode 100644 index 0000000000000..79ca23dbdf023 --- /dev/null +++ b/components/google_sheets/sources/new-worksheet-polling/test-event.mjs @@ -0,0 +1,12 @@ +export default { + "properties": { + "sheetId": 0, + "title": "Sheet1", + "index": 0, + "sheetType": "GRID", + "gridProperties": { + "rowCount": 1007, + "columnCount": 28 + } + } +}