From a01d796cbddafe10a0fcd428dec56154fcf1a604 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Fri, 21 Feb 2025 17:33:55 -0500 Subject: [PATCH] new-row-added-polling source --- components/google_sheets/package.json | 2 +- .../new-row-added-polling.mjs | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs diff --git a/components/google_sheets/package.json b/components/google_sheets/package.json index 7beb5705bc674..5064d9d83bad9 100644 --- a/components/google_sheets/package.json +++ b/components/google_sheets/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_sheets", - "version": "0.7.12", + "version": "0.8.0", "description": "Pipedream Google_sheets Components", "main": "google_sheets.app.mjs", "keywords": [ diff --git a/components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs b/components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs new file mode 100644 index 0000000000000..02c4ba05c557a --- /dev/null +++ b/components/google_sheets/sources/new-row-added-polling/new-row-added-polling.mjs @@ -0,0 +1,49 @@ +import googleSheets from "../../google_sheets.app.mjs"; +import common from "../common/new-row-added.mjs"; +import base from "../common/http-based/base.mjs"; +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; + +export default { + ...common, + key: "google_sheets-new-row-added-polling", + name: "New Row Added", + description: "Emit new event each time a row or rows are added to the bottom of a spreadsheet.", + version: "0.0.1", + dedupe: "unique", + type: "source", + props: { + googleSheets, + db: "$.service.db", + timer: { + type: "$.interface.timer", + static: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + watchedDrive: { + propDefinition: [ + googleSheets, + "watchedDrive", + ], + description: "Defaults to My Drive. To select a [Shared Drive](https://support.google.com/a/users/answer/9310351) instead, select it from this list.", + }, + sheetID: { + propDefinition: [ + googleSheets, + "sheetID", + (c) => ({ + driveId: googleSheets.methods.getDriveId(c.watchedDrive), + }), + ], + }, + ...common.props, + }, + methods: { + ...base.methods, + ...common.methods, + }, + async run() { + const spreadsheet = await this.googleSheets.getSpreadsheet(this.sheetID); + return this.processSpreadsheet(spreadsheet); + }, +};