Skip to content

Commit ad84ab1

Browse files
authored
Merging pull request #17574
* add tabId prop * pnpm-lock.yaml * update
1 parent ee2408b commit ad84ab1

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

components/google_docs/actions/get-document/get-document.mjs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import googleDocs from "../../google_docs.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
23

34
export default {
45
key: "google_docs-get-document",
56
name: "Get Document",
67
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)",
7-
version: "0.1.5",
8+
version: "0.1.6",
89
type: "action",
910
props: {
1011
googleDocs,
@@ -21,10 +22,32 @@ export default {
2122
optional: true,
2223
default: false,
2324
},
25+
tabIds: {
26+
type: "string[]",
27+
label: "Tab IDs",
28+
description: "Only return content for the specified tabs",
29+
optional: true,
30+
async options() {
31+
const { tabs } = await this.googleDocs.getDocument(this.docId, true);
32+
if (!tabs?.length) return [];
33+
return tabs.map((tab) => ({
34+
label: tab.tabProperties.title,
35+
value: tab.tabProperties.tabId,
36+
}));
37+
},
38+
},
2439
},
2540
async run({ $ }) {
41+
if (this.tabIds?.length && !this.includeTabsContent) {
42+
throw new ConfigurationError("Include Tabs Content must be true if tabIds are provided");
43+
}
44+
2645
const response = await this.googleDocs.getDocument(this.docId, this.includeTabsContent);
2746

47+
if (this.tabIds?.length) {
48+
response.tabs = response.tabs.filter((tab) => this.tabIds.includes(tab.tabProperties.tabId));
49+
}
50+
2851
$.export("$summary", `Successfully retrieved document with ID: ${this.docId}`);
2952

3053
return response;

components/google_docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/google_docs",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "Pipedream Google_docs Components",
55
"main": "google_docs.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)