diff --git a/components/google_docs/actions/append-image/append-image.mjs b/components/google_docs/actions/append-image/append-image.mjs index a18685f7e5a0e..772e357a7c527 100644 --- a/components/google_docs/actions/append-image/append-image.mjs +++ b/components/google_docs/actions/append-image/append-image.mjs @@ -4,7 +4,7 @@ export default { key: "google_docs-append-image", name: "Append Image to Document", description: "Appends an image to the end of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest)", - version: "0.0.7", + version: "0.0.8", type: "action", props: { googleDocs, diff --git a/components/google_docs/actions/append-text/append-text.mjs b/components/google_docs/actions/append-text/append-text.mjs index 522abc58eb982..cab8586ff1c9c 100644 --- a/components/google_docs/actions/append-text/append-text.mjs +++ b/components/google_docs/actions/append-text/append-text.mjs @@ -4,7 +4,7 @@ export default { key: "google_docs-append-text", name: "Append Text", description: "Append text to an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleDocs, diff --git a/components/google_docs/actions/create-document-from-template/create-document-from-template.mjs b/components/google_docs/actions/create-document-from-template/create-document-from-template.mjs index 2d71dcc2e2031..86aac9895c9c4 100644 --- a/components/google_docs/actions/create-document-from-template/create-document-from-template.mjs +++ b/components/google_docs/actions/create-document-from-template/create-document-from-template.mjs @@ -13,7 +13,7 @@ export default { ...others, key: "google_docs-create-document-from-template", name: "Create New Document From Template", - version: "0.0.2", + version: "0.0.3", description, type, props: { diff --git a/components/google_docs/actions/create-document/create-document.mjs b/components/google_docs/actions/create-document/create-document.mjs index 8ee8cd7ebd9d8..9292373fe174f 100644 --- a/components/google_docs/actions/create-document/create-document.mjs +++ b/components/google_docs/actions/create-document/create-document.mjs @@ -4,7 +4,7 @@ export default { key: "google_docs-create-document", name: "Create a New Document", description: "Create a new document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/create)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleDocs, diff --git a/components/google_docs/actions/find-document/find-document.mjs b/components/google_docs/actions/find-document/find-document.mjs index ac12ea4ef8499..269f35e495af6 100644 --- a/components/google_docs/actions/find-document/find-document.mjs +++ b/components/google_docs/actions/find-document/find-document.mjs @@ -14,7 +14,7 @@ export default { ...others, key: "google_docs-find-document", name: "Find Document", - version: "0.0.2", + version: "0.0.3", description, type, props: { diff --git a/components/google_docs/actions/get-document/get-document.mjs b/components/google_docs/actions/get-document/get-document.mjs index fec2e70086ff7..8f291fd6b1da3 100644 --- a/components/google_docs/actions/get-document/get-document.mjs +++ b/components/google_docs/actions/get-document/get-document.mjs @@ -5,7 +5,7 @@ export default { key: "google_docs-get-document", name: "Get Document", description: "Get the contents of the latest version of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)", - version: "0.1.6", + version: "0.1.7", type: "action", props: { googleDocs, diff --git a/components/google_docs/actions/get-tab-content/get-tab-content.mjs b/components/google_docs/actions/get-tab-content/get-tab-content.mjs new file mode 100644 index 0000000000000..ac26e4fa0bae3 --- /dev/null +++ b/components/google_docs/actions/get-tab-content/get-tab-content.mjs @@ -0,0 +1,37 @@ +import googleDocs from "../../google_docs.app.mjs"; + +export default { + key: "google_docs-get-tab-content", + name: "Get Tab Content", + description: "Get the content of a tab in a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)", + version: "0.0.1", + type: "action", + props: { + googleDocs, + docId: { + propDefinition: [ + googleDocs, + "docId", + ], + }, + tabIds: { + type: "string[]", + label: "Tab IDs", + description: "Return content for the specified tabs", + async options() { + const { tabs } = await this.googleDocs.getDocument(this.docId, true); + if (!tabs?.length) return []; + return tabs.map((tab) => ({ + label: tab.tabProperties.title, + value: tab.tabProperties.tabId, + })); + }, + }, + }, + async run({ $ }) { + const response = await this.googleDocs.getDocument(this.docId, true); + const tabs = response.tabs.filter((tab) => this.tabIds.includes(tab.tabProperties.tabId)); + $.export("$summary", `Successfully retrieved tab content for document with ID: ${this.docId}`); + return tabs; + }, +}; diff --git a/components/google_docs/actions/insert-page-break/insert-page-break.mjs b/components/google_docs/actions/insert-page-break/insert-page-break.mjs new file mode 100644 index 0000000000000..cf0e03bc8cfdf --- /dev/null +++ b/components/google_docs/actions/insert-page-break/insert-page-break.mjs @@ -0,0 +1,45 @@ +import googleDocs from "../../google_docs.app.mjs"; + +export default { + key: "google_docs-insert-page-break", + name: "Insert Page Break", + description: "Insert a page break into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#insertpagebreakrequest)", + version: "0.0.1", + type: "action", + props: { + googleDocs, + docId: { + propDefinition: [ + googleDocs, + "docId", + ], + }, + index: { + type: "integer", + label: "Index", + description: "The index to insert the page break at", + default: 1, + optional: true, + }, + tabId: { + propDefinition: [ + googleDocs, + "tabId", + (c) => ({ + documentId: c.docId, + }), + ], + }, + }, + async run({ $ }) { + const pageBreak = { + location: { + index: this.index, + tabId: this.tabId, + }, + }; + await this.googleDocs.insertPageBreak(this.docId, pageBreak); + $.export("$summary", "Successfully inserted page break"); + return this.googleDocs.getDocument(this.docId, !!this.tabId); + }, +}; diff --git a/components/google_docs/actions/insert-table/insert-table.mjs b/components/google_docs/actions/insert-table/insert-table.mjs new file mode 100644 index 0000000000000..fb555049706e7 --- /dev/null +++ b/components/google_docs/actions/insert-table/insert-table.mjs @@ -0,0 +1,57 @@ +import googleDocs from "../../google_docs.app.mjs"; + +export default { + key: "google_docs-insert-table", + name: "Insert Table", + description: "Insert a table into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttablerequest)", + version: "0.0.1", + type: "action", + props: { + googleDocs, + docId: { + propDefinition: [ + googleDocs, + "docId", + ], + }, + rows: { + type: "integer", + label: "Rows", + description: "The number of rows in the table", + }, + columns: { + type: "integer", + label: "Columns", + description: "The number of columns in the table", + }, + index: { + type: "integer", + label: "Index", + description: "The index to insert the table at", + default: 1, + optional: true, + }, + tabId: { + propDefinition: [ + googleDocs, + "tabId", + (c) => ({ + documentId: c.docId, + }), + ], + }, + }, + async run({ $ }) { + const table = { + rows: this.rows, + columns: this.columns, + location: { + index: this.index, + tabId: this.tabId, + }, + }; + await this.googleDocs.insertTable(this.docId, table); + $.export("$summary", "Successfully inserted table"); + return this.googleDocs.getDocument(this.docId, !!this.tabId); + }, +}; diff --git a/components/google_docs/actions/insert-text/insert-text.mjs b/components/google_docs/actions/insert-text/insert-text.mjs new file mode 100644 index 0000000000000..5919e3ee82982 --- /dev/null +++ b/components/google_docs/actions/insert-text/insert-text.mjs @@ -0,0 +1,52 @@ +import googleDocs from "../../google_docs.app.mjs"; + +export default { + key: "google_docs-insert-text", + name: "Insert Text", + description: "Insert text into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttextrequest)", + version: "0.0.1", + type: "action", + props: { + googleDocs, + docId: { + propDefinition: [ + googleDocs, + "docId", + ], + }, + text: { + propDefinition: [ + googleDocs, + "text", + ], + }, + index: { + type: "integer", + label: "Index", + description: "The index to insert the text at", + default: 1, + optional: true, + }, + tabId: { + propDefinition: [ + googleDocs, + "tabId", + (c) => ({ + documentId: c.docId, + }), + ], + }, + }, + async run({ $ }) { + const text = { + text: this.text, + location: { + index: this.index, + tabId: this.tabId, + }, + }; + await this.googleDocs._batchUpdate(this.docId, "insertText", text); + $.export("$summary", "Successfully inserted text"); + return this.googleDocs.getDocument(this.docId, !!this.tabId); + }, +}; diff --git a/components/google_docs/actions/replace-image/replace-image.mjs b/components/google_docs/actions/replace-image/replace-image.mjs index a0b4bb96d5afa..795f6a88fdb13 100644 --- a/components/google_docs/actions/replace-image/replace-image.mjs +++ b/components/google_docs/actions/replace-image/replace-image.mjs @@ -4,7 +4,7 @@ export default { key: "google_docs-replace-image", name: "Replace Image", description: "Replace image in a existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceImageRequest)", - version: "0.0.7", + version: "0.0.8", type: "action", props: { googleDocs, diff --git a/components/google_docs/actions/replace-text/replace-text.mjs b/components/google_docs/actions/replace-text/replace-text.mjs index 3b5f1a996ffaf..7e33c790e8767 100644 --- a/components/google_docs/actions/replace-text/replace-text.mjs +++ b/components/google_docs/actions/replace-text/replace-text.mjs @@ -4,7 +4,7 @@ export default { key: "google_docs-replace-text", name: "Replace Text", description: "Replace all instances of matched text in an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceAllTextRequest)", - version: "0.0.7", + version: "0.0.8", type: "action", props: { googleDocs, @@ -35,6 +35,19 @@ export default { "matchCase", ], }, + tabIds: { + propDefinition: [ + googleDocs, + "tabId", + (c) => ({ + documentId: c.docId, + }), + ], + type: "string[]", + label: "Tab IDs", + description: "The tab IDs to replace the text in", + optional: true, + }, }, async run({ $ }) { const text = { @@ -43,6 +56,11 @@ export default { text: this.replaced, matchCase: this.matchCase, }, + tabsCriteria: this.tabIds + ? { + tabIds: this.tabIds, + } + : undefined, }; await this.googleDocs.replaceText(this.docId, text); const doc = this.googleDocs.getDocument(this.docId); diff --git a/components/google_docs/google_docs.app.mjs b/components/google_docs/google_docs.app.mjs index 6f91b9c7517cd..011d4e3338160 100644 --- a/components/google_docs/google_docs.app.mjs +++ b/components/google_docs/google_docs.app.mjs @@ -34,6 +34,19 @@ export default { .filter((image) => image.label); }, }, + tabId: { + type: "string", + label: "Tab ID", + description: "The Tab ID", + optional: true, + async options({ documentId }) { + const { tabs } = await this.getDocument(documentId, true); + return Object.values(tabs).map(({ tabProperties }) => ({ + label: tabProperties.title, + value: tabProperties.tabId, + })); + }, + }, imageUri: { type: "string", label: "Image URL", @@ -134,6 +147,18 @@ export default { async replaceImage(documentId, image) { return this._batchUpdate(documentId, "replaceImage", image); }, + async insertTable(documentId, table) { + return this._batchUpdate(documentId, "insertTable", table); + }, + async insertPageBreak(documentId, request) { + return this._batchUpdate(documentId, "insertPageBreak", request); + }, + async createDocument(request) { + const { data } = await this.docs().documents.create({ + requestBody: request, + }); + return data; + }, async listDocsOptions(driveId, query, pageToken = null) { let q = "mimeType='application/vnd.google-apps.document'"; if (query) { diff --git a/components/google_docs/package.json b/components/google_docs/package.json index 9f711c5bf45ad..9d13287b73cbd 100644 --- a/components/google_docs/package.json +++ b/components/google_docs/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/google_docs", - "version": "0.4.4", + "version": "0.5.0", "description": "Pipedream Google_docs Components", "main": "google_docs.app.mjs", "keywords": [ diff --git a/components/google_docs/sources/new-document-created/new-document-created.mjs b/components/google_docs/sources/new-document-created/new-document-created.mjs index 0d12df4ef79fd..9789faa28a69e 100644 --- a/components/google_docs/sources/new-document-created/new-document-created.mjs +++ b/components/google_docs/sources/new-document-created/new-document-created.mjs @@ -5,7 +5,7 @@ export default { key: "google_docs-new-document-created", name: "New Document Created (Instant)", description: "Emit new event when a new document is created in Google Docs. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/changes/watch)", - version: "0.0.4", + version: "0.0.5", type: "source", dedupe: "unique", methods: { diff --git a/components/google_docs/sources/new-or-updated-document/new-or-updated-document.mjs b/components/google_docs/sources/new-or-updated-document/new-or-updated-document.mjs index d0d2967a5d0b9..b41cd1785f38e 100644 --- a/components/google_docs/sources/new-or-updated-document/new-or-updated-document.mjs +++ b/components/google_docs/sources/new-or-updated-document/new-or-updated-document.mjs @@ -9,7 +9,7 @@ export default { key: "google_docs-new-or-updated-document", name: "New or Updated Document (Instant)", description: "Emit new event when a document is created or updated in Google Docs. [See the documentation](https://developers.google.com/drive/api/reference/rest/v3/changes/watch)", - version: "0.0.4", + version: "0.0.5", type: "source", dedupe: "unique", methods: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 53220ec198c45..d48ba839f33bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8809,8 +8809,7 @@ importers: components/mindbody: {} - components/mindee: - specifiers: {} + components/mindee: {} components/mindmeister: {} @@ -11030,7 +11029,11 @@ importers: specifier: ^3.1.0 version: 3.1.0 - components/prisma_management_api: {} + components/prisma_management_api: + dependencies: + '@pipedream/platform': + specifier: ^1.5.1 + version: 1.6.6 components/prismic: {} @@ -16028,8 +16031,7 @@ importers: specifier: ^4.0.0 version: 4.0.1 - components/zapr_link: - specifiers: {} + components/zapr_link: {} components/zendesk: dependencies: @@ -40402,6 +40404,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: