@divyacon/piece-google-docs 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/append-text.d.ts +8 -0
- package/dist/lib/actions/append-text.d.ts.map +1 -0
- package/dist/lib/actions/append-text.js +40 -0
- package/dist/lib/actions/append-text.js.map +1 -0
- package/dist/lib/actions/batch-update.action.d.ts +8 -0
- package/dist/lib/actions/batch-update.action.d.ts.map +1 -0
- package/dist/lib/actions/batch-update.action.js +63 -0
- package/dist/lib/actions/batch-update.action.js.map +1 -0
- package/dist/lib/actions/copy-document.action.d.ts +12 -0
- package/dist/lib/actions/copy-document.action.d.ts.map +1 -0
- package/dist/lib/actions/copy-document.action.js +72 -0
- package/dist/lib/actions/copy-document.action.js.map +1 -0
- package/dist/lib/actions/create-and-populate-table.action.d.ts +8 -0
- package/dist/lib/actions/create-and-populate-table.action.d.ts.map +1 -0
- package/dist/lib/actions/create-and-populate-table.action.js +138 -0
- package/dist/lib/actions/create-and-populate-table.action.js.map +1 -0
- package/dist/lib/actions/create-document-based-on-template.action.d.ts +10 -0
- package/dist/lib/actions/create-document-based-on-template.action.d.ts.map +1 -0
- package/dist/lib/actions/create-document-based-on-template.action.js +107 -0
- package/dist/lib/actions/create-document-based-on-template.action.js.map +1 -0
- package/dist/lib/actions/create-document-from-markdown.action.d.ts +8 -0
- package/dist/lib/actions/create-document-from-markdown.action.d.ts.map +1 -0
- package/dist/lib/actions/create-document-from-markdown.action.js +69 -0
- package/dist/lib/actions/create-document-from-markdown.action.js.map +1 -0
- package/dist/lib/actions/create-document.d.ts +8 -0
- package/dist/lib/actions/create-document.d.ts.map +1 -0
- package/dist/lib/actions/create-document.js +35 -0
- package/dist/lib/actions/create-document.js.map +1 -0
- package/dist/lib/actions/create-footer.action.d.ts +8 -0
- package/dist/lib/actions/create-footer.action.d.ts.map +1 -0
- package/dist/lib/actions/create-footer.action.js +66 -0
- package/dist/lib/actions/create-footer.action.js.map +1 -0
- package/dist/lib/actions/create-footnote.action.d.ts +8 -0
- package/dist/lib/actions/create-footnote.action.d.ts.map +1 -0
- package/dist/lib/actions/create-footnote.action.js +58 -0
- package/dist/lib/actions/create-footnote.action.js.map +1 -0
- package/dist/lib/actions/create-header.action.d.ts +8 -0
- package/dist/lib/actions/create-header.action.d.ts.map +1 -0
- package/dist/lib/actions/create-header.action.js +66 -0
- package/dist/lib/actions/create-header.action.js.map +1 -0
- package/dist/lib/actions/create-named-range.action.d.ts +10 -0
- package/dist/lib/actions/create-named-range.action.d.ts.map +1 -0
- package/dist/lib/actions/create-named-range.action.js +74 -0
- package/dist/lib/actions/create-named-range.action.js.map +1 -0
- package/dist/lib/actions/create-paragraph-bullets.action.d.ts +10 -0
- package/dist/lib/actions/create-paragraph-bullets.action.d.ts.map +1 -0
- package/dist/lib/actions/create-paragraph-bullets.action.js +98 -0
- package/dist/lib/actions/create-paragraph-bullets.action.js.map +1 -0
- package/dist/lib/actions/create-text-document.action.d.ts +8 -0
- package/dist/lib/actions/create-text-document.action.d.ts.map +1 -0
- package/dist/lib/actions/create-text-document.action.js +42 -0
- package/dist/lib/actions/create-text-document.action.js.map +1 -0
- package/dist/lib/actions/delete-content-range.action.d.ts +9 -0
- package/dist/lib/actions/delete-content-range.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-content-range.action.js +64 -0
- package/dist/lib/actions/delete-content-range.action.js.map +1 -0
- package/dist/lib/actions/delete-footer.action.d.ts +8 -0
- package/dist/lib/actions/delete-footer.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-footer.action.js +56 -0
- package/dist/lib/actions/delete-footer.action.js.map +1 -0
- package/dist/lib/actions/delete-header.action.d.ts +8 -0
- package/dist/lib/actions/delete-header.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-header.action.js +56 -0
- package/dist/lib/actions/delete-header.action.js.map +1 -0
- package/dist/lib/actions/delete-named-range.action.d.ts +9 -0
- package/dist/lib/actions/delete-named-range.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-named-range.action.js +69 -0
- package/dist/lib/actions/delete-named-range.action.js.map +1 -0
- package/dist/lib/actions/delete-paragraph-bullets.action.d.ts +9 -0
- package/dist/lib/actions/delete-paragraph-bullets.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-paragraph-bullets.action.js +66 -0
- package/dist/lib/actions/delete-paragraph-bullets.action.js.map +1 -0
- package/dist/lib/actions/delete-table-column.action.d.ts +10 -0
- package/dist/lib/actions/delete-table-column.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-table-column.action.js +72 -0
- package/dist/lib/actions/delete-table-column.action.js.map +1 -0
- package/dist/lib/actions/delete-table-row.action.d.ts +10 -0
- package/dist/lib/actions/delete-table-row.action.d.ts.map +1 -0
- package/dist/lib/actions/delete-table-row.action.js +72 -0
- package/dist/lib/actions/delete-table-row.action.js.map +1 -0
- package/dist/lib/actions/export-as-pdf.action.d.ts +7 -0
- package/dist/lib/actions/export-as-pdf.action.d.ts.map +1 -0
- package/dist/lib/actions/export-as-pdf.action.js +61 -0
- package/dist/lib/actions/export-as-pdf.action.js.map +1 -0
- package/dist/lib/actions/find-document.d.ts +16 -0
- package/dist/lib/actions/find-document.d.ts.map +1 -0
- package/dist/lib/actions/find-document.js +127 -0
- package/dist/lib/actions/find-document.js.map +1 -0
- package/dist/lib/actions/get-document-end-index.action.d.ts +7 -0
- package/dist/lib/actions/get-document-end-index.action.d.ts.map +1 -0
- package/dist/lib/actions/get-document-end-index.action.js +54 -0
- package/dist/lib/actions/get-document-end-index.action.js.map +1 -0
- package/dist/lib/actions/get-document-plaintext.action.d.ts +7 -0
- package/dist/lib/actions/get-document-plaintext.action.d.ts.map +1 -0
- package/dist/lib/actions/get-document-plaintext.action.js +76 -0
- package/dist/lib/actions/get-document-plaintext.action.js.map +1 -0
- package/dist/lib/actions/get-document.action.d.ts +7 -0
- package/dist/lib/actions/get-document.action.d.ts.map +1 -0
- package/dist/lib/actions/get-document.action.js +45 -0
- package/dist/lib/actions/get-document.action.js.map +1 -0
- package/dist/lib/actions/insert-image-in-table-cell.action.d.ts +13 -0
- package/dist/lib/actions/insert-image-in-table-cell.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-image-in-table-cell.action.js +128 -0
- package/dist/lib/actions/insert-image-in-table-cell.action.js.map +1 -0
- package/dist/lib/actions/insert-inline-image.action.d.ts +11 -0
- package/dist/lib/actions/insert-inline-image.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-inline-image.action.js +84 -0
- package/dist/lib/actions/insert-inline-image.action.js.map +1 -0
- package/dist/lib/actions/insert-page-break.action.d.ts +8 -0
- package/dist/lib/actions/insert-page-break.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-page-break.action.js +60 -0
- package/dist/lib/actions/insert-page-break.action.js.map +1 -0
- package/dist/lib/actions/insert-table-column.action.d.ts +11 -0
- package/dist/lib/actions/insert-table-column.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-table-column.action.js +86 -0
- package/dist/lib/actions/insert-table-column.action.js.map +1 -0
- package/dist/lib/actions/insert-table-row.action.d.ts +11 -0
- package/dist/lib/actions/insert-table-row.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-table-row.action.js +86 -0
- package/dist/lib/actions/insert-table-row.action.js.map +1 -0
- package/dist/lib/actions/insert-table.action.d.ts +10 -0
- package/dist/lib/actions/insert-table.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-table.action.js +72 -0
- package/dist/lib/actions/insert-table.action.js.map +1 -0
- package/dist/lib/actions/insert-text-in-table-cell.action.d.ts +11 -0
- package/dist/lib/actions/insert-text-in-table-cell.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-text-in-table-cell.action.js +115 -0
- package/dist/lib/actions/insert-text-in-table-cell.action.js.map +1 -0
- package/dist/lib/actions/insert-text.action.d.ts +9 -0
- package/dist/lib/actions/insert-text.action.d.ts.map +1 -0
- package/dist/lib/actions/insert-text.action.js +66 -0
- package/dist/lib/actions/insert-text.action.js.map +1 -0
- package/dist/lib/actions/read-document.action.d.ts +7 -0
- package/dist/lib/actions/read-document.action.d.ts.map +1 -0
- package/dist/lib/actions/read-document.action.js +44 -0
- package/dist/lib/actions/read-document.action.js.map +1 -0
- package/dist/lib/actions/replace-all-text.action.d.ts +10 -0
- package/dist/lib/actions/replace-all-text.action.d.ts.map +1 -0
- package/dist/lib/actions/replace-all-text.action.js +92 -0
- package/dist/lib/actions/replace-all-text.action.js.map +1 -0
- package/dist/lib/actions/replace-body-with-markdown.action.d.ts +8 -0
- package/dist/lib/actions/replace-body-with-markdown.action.d.ts.map +1 -0
- package/dist/lib/actions/replace-body-with-markdown.action.js +79 -0
- package/dist/lib/actions/replace-body-with-markdown.action.js.map +1 -0
- package/dist/lib/actions/replace-image.action.d.ts +9 -0
- package/dist/lib/actions/replace-image.action.d.ts.map +1 -0
- package/dist/lib/actions/replace-image.action.js +65 -0
- package/dist/lib/actions/replace-image.action.js.map +1 -0
- package/dist/lib/actions/replace-section-with-markdown.action.d.ts +10 -0
- package/dist/lib/actions/replace-section-with-markdown.action.d.ts.map +1 -0
- package/dist/lib/actions/replace-section-with-markdown.action.js +106 -0
- package/dist/lib/actions/replace-section-with-markdown.action.js.map +1 -0
- package/dist/lib/actions/search-documents.action.d.ts +11 -0
- package/dist/lib/actions/search-documents.action.d.ts.map +1 -0
- package/dist/lib/actions/search-documents.action.js +121 -0
- package/dist/lib/actions/search-documents.action.js.map +1 -0
- package/dist/lib/actions/unmerge-table-cells.action.d.ts +12 -0
- package/dist/lib/actions/unmerge-table-cells.action.d.ts.map +1 -0
- package/dist/lib/actions/unmerge-table-cells.action.js +94 -0
- package/dist/lib/actions/unmerge-table-cells.action.js.map +1 -0
- package/dist/lib/actions/update-document-style.action.d.ts +11 -0
- package/dist/lib/actions/update-document-style.action.d.ts.map +1 -0
- package/dist/lib/actions/update-document-style.action.js +95 -0
- package/dist/lib/actions/update-document-style.action.js.map +1 -0
- package/dist/lib/actions/update-table-row-style.action.d.ts +10 -0
- package/dist/lib/actions/update-table-row-style.action.d.ts.map +1 -0
- package/dist/lib/actions/update-table-row-style.action.js +78 -0
- package/dist/lib/actions/update-table-row-style.action.js.map +1 -0
- package/dist/lib/auth.d.ts +11 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +92 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/common/index.d.ts +11 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +124 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/common/props.d.ts +5 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +53 -0
- package/dist/lib/common/props.js.map +1 -0
- package/dist/lib/output-schemas.d.ts +43 -0
- package/dist/lib/output-schemas.d.ts.map +1 -0
- package/dist/lib/output-schemas.js +554 -0
- package/dist/lib/output-schemas.js.map +1 -0
- package/dist/lib/triggers/new-document.d.ts +35 -0
- package/dist/lib/triggers/new-document.d.ts.map +1 -0
- package/dist/lib/triggers/new-document.js +104 -0
- package/dist/lib/triggers/new-document.js.map +1 -0
- package/package.json +47 -3
- package/src/index.ts +120 -0
- package/src/lib/actions/append-text.ts +37 -0
- package/src/lib/actions/batch-update.action.ts +58 -0
- package/src/lib/actions/copy-document.action.ts +74 -0
- package/src/lib/actions/create-and-populate-table.action.ts +141 -0
- package/src/lib/actions/create-document-based-on-template.action.ts +110 -0
- package/src/lib/actions/create-document-from-markdown.action.ts +63 -0
- package/src/lib/actions/create-document.ts +36 -0
- package/src/lib/actions/create-footer.action.ts +59 -0
- package/src/lib/actions/create-footnote.action.ts +53 -0
- package/src/lib/actions/create-header.action.ts +59 -0
- package/src/lib/actions/create-named-range.action.ts +70 -0
- package/src/lib/actions/create-paragraph-bullets.action.ts +95 -0
- package/src/lib/actions/create-text-document.action.ts +35 -0
- package/src/lib/actions/delete-content-range.action.ts +59 -0
- package/src/lib/actions/delete-footer.action.ts +51 -0
- package/src/lib/actions/delete-header.action.ts +51 -0
- package/src/lib/actions/delete-named-range.action.ts +65 -0
- package/src/lib/actions/delete-paragraph-bullets.action.ts +62 -0
- package/src/lib/actions/delete-table-column.action.ts +67 -0
- package/src/lib/actions/delete-table-row.action.ts +67 -0
- package/src/lib/actions/export-as-pdf.action.ts +59 -0
- package/src/lib/actions/find-document.ts +136 -0
- package/src/lib/actions/get-document-end-index.action.ts +47 -0
- package/src/lib/actions/get-document-plaintext.action.ts +74 -0
- package/src/lib/actions/get-document.action.ts +37 -0
- package/src/lib/actions/insert-image-in-table-cell.action.ts +139 -0
- package/src/lib/actions/insert-inline-image.action.ts +83 -0
- package/src/lib/actions/insert-page-break.action.ts +56 -0
- package/src/lib/actions/insert-table-column.action.ts +80 -0
- package/src/lib/actions/insert-table-row.action.ts +80 -0
- package/src/lib/actions/insert-table.action.ts +68 -0
- package/src/lib/actions/insert-text-in-table-cell.action.ts +120 -0
- package/src/lib/actions/insert-text.action.ts +62 -0
- package/src/lib/actions/read-document.action.ts +40 -0
- package/src/lib/actions/replace-all-text.action.ts +95 -0
- package/src/lib/actions/replace-body-with-markdown.action.ts +76 -0
- package/src/lib/actions/replace-image.action.ts +60 -0
- package/src/lib/actions/replace-section-with-markdown.action.ts +104 -0
- package/src/lib/actions/search-documents.action.ts +131 -0
- package/src/lib/actions/unmerge-table-cells.action.ts +88 -0
- package/src/lib/actions/update-document-style.action.ts +93 -0
- package/src/lib/actions/update-table-row-style.action.ts +73 -0
- package/src/lib/auth.ts +84 -0
- package/src/lib/common/index.ts +126 -0
- package/src/lib/common/props.ts +55 -0
- package/src/lib/output-schemas.ts +593 -0
- package/src/lib/triggers/new-document.ts +108 -0
- package/README.md +0 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceImage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-docs/src/lib/actions/replace-image.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
10
|
+
const docs_1 = require("@googleapis/docs");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.replaceImage = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.googleDocsAuth,
|
|
14
|
+
name: 'replace_image',
|
|
15
|
+
displayName: 'Replace Image',
|
|
16
|
+
description: 'Replace an existing inline image in a Google Docs document with a new image from a URI.',
|
|
17
|
+
audience: 'ai',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Swaps an existing inline image (identified by its object ID) for a new image at the given URI. Use this to update a specific image in a document without altering surrounding content. The imageObjectId must come from the document\'s inlineObjects map — obtain it by calling Read Document first. Re-running with the same URI leaves the document in the same visual state, so it is idempotent.',
|
|
20
|
+
idempotent: true,
|
|
21
|
+
},
|
|
22
|
+
outputSchema: output_schemas_1.replaceImageActionOutputSchema,
|
|
23
|
+
props: {
|
|
24
|
+
documentId: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Document ID',
|
|
26
|
+
description: 'The ID of the document containing the image to replace.',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
imageObjectId: pieces_framework_1.Property.ShortText({
|
|
30
|
+
displayName: 'Image Object ID',
|
|
31
|
+
description: 'The object ID of the inline image to replace. This is a hidden ID found in the document\'s inlineObjects map — obtain it by calling Read Document and inspecting the inlineObjects field.',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
uri: pieces_framework_1.Property.ShortText({
|
|
35
|
+
displayName: 'New Image URI',
|
|
36
|
+
description: 'A publicly accessible URL of the replacement image. Google must be able to fetch this URL at the time of the call.',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
run(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const { documentId, imageObjectId, uri } = context.propsValue;
|
|
43
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
44
|
+
const docs = (0, docs_1.docs)({ version: 'v1', auth: authClient });
|
|
45
|
+
const request = {
|
|
46
|
+
replaceImage: {
|
|
47
|
+
imageObjectId,
|
|
48
|
+
uri,
|
|
49
|
+
imageReplaceMethod: 'CENTER_CROP',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
yield docs.documents.batchUpdate({
|
|
54
|
+
documentId,
|
|
55
|
+
requestBody: { requests: [request] },
|
|
56
|
+
});
|
|
57
|
+
return { success: true, documentId, imageObjectId };
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw new Error(common_1.docsCommon.formatError(error, 'replace image in'));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=replace-image.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-image.action.js","sourceRoot":"","sources":["../../../src/lib/actions/replace-image.action.ts"],"names":[],"mappings":";;;;AAAA,kHAAkH;AAClH,qEAAqE;AACrE,kCAA6D;AAC7D,sCAAuC;AACvC,gEAAmE;AACnE,2CAA+D;AAC/D,sDAAmE;AAEtD,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,yFAAyF;IACtG,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACX,WAAW,EACV,uYAAuY;QACxY,UAAU,EAA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,CAAC,CAAC;YACpE,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const replaceSectionWithMarkdown: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
documentId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
startIndex: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
7
|
+
endIndex: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
8
|
+
markdown: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=replace-section-with-markdown.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-section-with-markdown.action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/replace-section-with-markdown.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,0BAA0B;;;;;;;;EAiGrC,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceSectionWithMarkdown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-docs/src/lib/actions/replace-section-with-markdown.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
10
|
+
const docs_1 = require("@googleapis/docs");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.replaceSectionWithMarkdown = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.googleDocsAuth,
|
|
14
|
+
name: 'replace_section_with_markdown',
|
|
15
|
+
displayName: 'Replace Section with Markdown',
|
|
16
|
+
description: 'Replace a character range of a Google Docs document with Markdown content',
|
|
17
|
+
audience: 'ai',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Deletes the content between a start and end character index and replaces it with text rendered from Markdown (headings #/##/###, bullet lists -/*/+, paragraphs converted to native Google Docs formatting). Use when an agent wants to overwrite one section of a document — not the whole body — with freshly generated Markdown. Obtain start and end indices from Read Document first; indices cannot be guessed. If the end index reaches the document end it is clamped to exclude the undeletable terminal newline. Inline styling such as bold/italic is inserted as plain text. Destructive and not idempotent.',
|
|
20
|
+
idempotent: false,
|
|
21
|
+
},
|
|
22
|
+
outputSchema: output_schemas_1.replaceSectionWithMarkdownActionOutputSchema,
|
|
23
|
+
props: {
|
|
24
|
+
documentId: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Document ID',
|
|
26
|
+
description: 'The ID of the document to edit.',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
startIndex: pieces_framework_1.Property.Number({
|
|
30
|
+
displayName: 'Start Index',
|
|
31
|
+
description: 'Inclusive start character index of the section to replace. Obtain from Read Document.',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
endIndex: pieces_framework_1.Property.Number({
|
|
35
|
+
displayName: 'End Index',
|
|
36
|
+
description: 'Exclusive end character index of the section to replace. Must be greater than Start Index and obtained from Read Document.',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
markdown: pieces_framework_1.Property.LongText({
|
|
40
|
+
displayName: 'Markdown Content',
|
|
41
|
+
description: 'Markdown text. Supports headings (#/##/###), bullet lists (-/*/+), and paragraphs.',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
run(context) {
|
|
46
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
var _a, _b, _c, _d;
|
|
48
|
+
const { documentId, startIndex, markdown } = context.propsValue;
|
|
49
|
+
let { endIndex } = context.propsValue;
|
|
50
|
+
if (endIndex <= startIndex) {
|
|
51
|
+
throw new Error('End Index must be greater than Start Index.');
|
|
52
|
+
}
|
|
53
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
54
|
+
const docs = (0, docs_1.docs)({ version: 'v1', auth: authClient });
|
|
55
|
+
// The body's terminal newline cannot be deleted, so if the caller passed an
|
|
56
|
+
// end index at/after the body end (e.g. the value from Get Document End Index)
|
|
57
|
+
// clamp it to one before the end — otherwise deleteContentRange 400s.
|
|
58
|
+
let content;
|
|
59
|
+
try {
|
|
60
|
+
const response = yield docs.documents.get({ documentId });
|
|
61
|
+
content = (_b = (_a = response.data.body) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : [];
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw new Error(common_1.docsCommon.formatError(error, 'read'));
|
|
65
|
+
}
|
|
66
|
+
const bodyEnd = (_d = (_c = content[content.length - 1]) === null || _c === void 0 ? void 0 : _c.endIndex) !== null && _d !== void 0 ? _d : endIndex;
|
|
67
|
+
if (endIndex > bodyEnd - 1) {
|
|
68
|
+
endIndex = bodyEnd - 1;
|
|
69
|
+
}
|
|
70
|
+
if (endIndex <= startIndex) {
|
|
71
|
+
throw new Error('The section to replace is empty after clamping the end index to the document end.');
|
|
72
|
+
}
|
|
73
|
+
// A single deleteContentRange cannot remove a table or table of contents
|
|
74
|
+
// that the range crosses, so a section replace over one is unsupported.
|
|
75
|
+
const crossesStructuralElement = content.some((element) => {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
return (element.table || element.tableOfContents) &&
|
|
78
|
+
((_a = element.startIndex) !== null && _a !== void 0 ? _a : 0) < endIndex &&
|
|
79
|
+
((_b = element.endIndex) !== null && _b !== void 0 ? _b : 0) > startIndex;
|
|
80
|
+
});
|
|
81
|
+
if (crossesStructuralElement) {
|
|
82
|
+
throw new Error('Cannot replace this section because it contains or overlaps a table or table of contents, which deleteContentRange cannot remove. Choose a range that excludes it, or edit it with the targeted table atomics.');
|
|
83
|
+
}
|
|
84
|
+
// Delete the section first, then insert the markdown at the now-empty
|
|
85
|
+
// startIndex; the converter builds its inserts from that base index.
|
|
86
|
+
const requests = [
|
|
87
|
+
{ deleteContentRange: { range: { startIndex, endIndex } } },
|
|
88
|
+
...common_1.docsCommon.markdownToBatchRequests(markdown, startIndex),
|
|
89
|
+
];
|
|
90
|
+
try {
|
|
91
|
+
yield docs.documents.batchUpdate({ documentId, requestBody: { requests } });
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
throw new Error(common_1.docsCommon.formatError(error, 'replace a section of'));
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
success: true,
|
|
98
|
+
documentId,
|
|
99
|
+
replacedFrom: startIndex,
|
|
100
|
+
replacedTo: endIndex,
|
|
101
|
+
url: `https://docs.google.com/document/d/${documentId}/edit`,
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=replace-section-with-markdown.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-section-with-markdown.action.js","sourceRoot":"","sources":["../../../src/lib/actions/replace-section-with-markdown.action.ts"],"names":[],"mappings":";;;;AAAA,kIAAkI;AAClI,qEAAqE;AACrE,kCAA6D;AAC7D,sCAAuC;AACvC,gEAAmE;AACnE,2CAA+D;AAC/D,sDAAiF;AAEpE,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACrD,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,+BAA+B;IAC5C,WAAW,EAAE,2EAA2E;IACxF,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QAAQ,EAAE,EAAE,EAAE;gBAC3D,GAAG,mBAAU,CAAC,uBAAuB,CAAC,QAAQ,EAAE,UAAU,CAAC;aAC5D,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC9E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,mBAAU,CAAC,WAAW,CAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAC;YACzE,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,UAAU;gBACV,YAAY,EAAE,UAAU;gBACxB,UAAU,EAAE,QAAQ;gBACpB,GAAG,EAAE,sCAAsC,UAAU,OAAO;aAC7D,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const searchDocuments: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
name_contains: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
full_text_contains: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
max_results: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
8
|
+
order_by: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
9
|
+
page_token: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=search-documents.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-documents.action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/search-documents.action.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe;;;;;;;;;EA6H1B,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchDocuments = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-docs/src/lib/actions/search-documents.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
9
|
+
const drive_1 = require("@googleapis/drive");
|
|
10
|
+
const output_schemas_1 = require("../output-schemas");
|
|
11
|
+
exports.searchDocuments = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.googleDocsAuth,
|
|
13
|
+
name: 'search_documents',
|
|
14
|
+
displayName: 'Search Documents',
|
|
15
|
+
description: 'Search Google Drive for Google Docs documents by name or full-text content.',
|
|
16
|
+
audience: 'ai',
|
|
17
|
+
aiMetadata: {
|
|
18
|
+
description: "Searches Drive for Google Docs documents by name and/or full-text content, returning multiple ordered results with their IDs. Pick this over Find Document to discover documents by their content (not just an exact name) or to get more than one match; Find Document returns only the first name match and can also create-if-missing. Read-only and idempotent. At least one of name/content text is required.",
|
|
19
|
+
idempotent: true,
|
|
20
|
+
},
|
|
21
|
+
outputSchema: output_schemas_1.searchDocumentsActionOutputSchema,
|
|
22
|
+
props: {
|
|
23
|
+
name_contains: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Name Contains',
|
|
25
|
+
description: 'Return documents whose name contains this text. Provide this and/or Content Contains.',
|
|
26
|
+
required: false,
|
|
27
|
+
}),
|
|
28
|
+
full_text_contains: pieces_framework_1.Property.ShortText({
|
|
29
|
+
displayName: 'Content Contains',
|
|
30
|
+
description: 'Return documents whose full text content contains this text. Provide this and/or Name Contains.',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
max_results: pieces_framework_1.Property.Number({
|
|
34
|
+
displayName: 'Max Results',
|
|
35
|
+
description: 'Maximum number of documents to return (1-100).',
|
|
36
|
+
required: false,
|
|
37
|
+
defaultValue: 10,
|
|
38
|
+
}),
|
|
39
|
+
order_by: pieces_framework_1.Property.StaticDropdown({
|
|
40
|
+
displayName: 'Order By',
|
|
41
|
+
description: 'How to sort the results.',
|
|
42
|
+
required: false,
|
|
43
|
+
defaultValue: 'modifiedTime desc',
|
|
44
|
+
options: {
|
|
45
|
+
options: [
|
|
46
|
+
{ label: 'Last modified (newest first)', value: 'modifiedTime desc' },
|
|
47
|
+
{ label: 'Last modified (oldest first)', value: 'modifiedTime' },
|
|
48
|
+
{ label: 'Created (newest first)', value: 'createdTime desc' },
|
|
49
|
+
{ label: 'Created (oldest first)', value: 'createdTime' },
|
|
50
|
+
{ label: 'Name (A-Z)', value: 'name' },
|
|
51
|
+
{ label: 'Name (Z-A)', value: 'name desc' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
page_token: pieces_framework_1.Property.ShortText({
|
|
56
|
+
displayName: 'Page Token',
|
|
57
|
+
description: 'Token for the next page of results, taken from the nextPageToken of a previous call. Leave empty for the first page.',
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
run(context) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
const { name_contains, full_text_contains, max_results, order_by, page_token } = context.propsValue;
|
|
65
|
+
if (!name_contains && !full_text_contains) {
|
|
66
|
+
throw new Error('Provide at least one of "Name Contains" or "Content Contains" to search.');
|
|
67
|
+
}
|
|
68
|
+
const pageSize = Math.min(Math.max(max_results !== null && max_results !== void 0 ? max_results : 10, 1), 100);
|
|
69
|
+
const matchClauses = [];
|
|
70
|
+
if (name_contains) {
|
|
71
|
+
matchClauses.push(`name contains '${name_contains.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`);
|
|
72
|
+
}
|
|
73
|
+
if (full_text_contains) {
|
|
74
|
+
matchClauses.push(`fullText contains '${full_text_contains.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`);
|
|
75
|
+
}
|
|
76
|
+
const query = [
|
|
77
|
+
`mimeType='application/vnd.google-apps.document'`,
|
|
78
|
+
`(${matchClauses.join(' or ')})`,
|
|
79
|
+
'trashed=false',
|
|
80
|
+
].join(' and ');
|
|
81
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
82
|
+
const drive = (0, drive_1.drive)({ version: 'v3', auth: authClient });
|
|
83
|
+
try {
|
|
84
|
+
const response = yield drive.files.list({
|
|
85
|
+
q: query,
|
|
86
|
+
orderBy: order_by !== null && order_by !== void 0 ? order_by : 'modifiedTime desc',
|
|
87
|
+
pageSize,
|
|
88
|
+
pageToken: page_token || undefined,
|
|
89
|
+
supportsAllDrives: true,
|
|
90
|
+
includeItemsFromAllDrives: true,
|
|
91
|
+
corpora: 'allDrives',
|
|
92
|
+
fields: 'nextPageToken, files(id, name, mimeType, createdTime, modifiedTime, webViewLink, owners(emailAddress))',
|
|
93
|
+
});
|
|
94
|
+
const documents = ((_a = response.data.files) !== null && _a !== void 0 ? _a : []).map((file) => {
|
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
96
|
+
return ({
|
|
97
|
+
id: (_a = file.id) !== null && _a !== void 0 ? _a : '',
|
|
98
|
+
name: (_b = file.name) !== null && _b !== void 0 ? _b : '',
|
|
99
|
+
createdTime: (_c = file.createdTime) !== null && _c !== void 0 ? _c : '',
|
|
100
|
+
modifiedTime: (_d = file.modifiedTime) !== null && _d !== void 0 ? _d : '',
|
|
101
|
+
webViewLink: (_e = file.webViewLink) !== null && _e !== void 0 ? _e : '',
|
|
102
|
+
ownerEmail: (_h = (_g = (_f = file.owners) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.emailAddress) !== null && _h !== void 0 ? _h : '',
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
documents,
|
|
107
|
+
count: documents.length,
|
|
108
|
+
nextPageToken: (_b = response.data.nextPageToken) !== null && _b !== void 0 ? _b : null,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
const error = e;
|
|
113
|
+
if (error.code === 403) {
|
|
114
|
+
throw new Error('Permission denied searching Drive. Ensure the connected account has Drive access.');
|
|
115
|
+
}
|
|
116
|
+
throw e;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=search-documents.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-documents.action.js","sourceRoot":"","sources":["../../../src/lib/actions/search-documents.action.ts"],"names":[],"mappings":";;;;AAAA,qHAAqH;AACrH,qEAAqE;AACrE,kCAA6D;AAC7D,gEAAmE;AACnE,6CAAyD;AACzD,sDAAsE;AAEzD,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EACV,6EAA6E;IAC9E,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE;QACX,WAAW,EACV,oZAAoZ;QACrZ,UAAU,EAAE,IAAI;KAChB;IACD,YAAY,EAAE,kDAAiC;IAC/C,KAAK,EAAE;QACN,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,eAAe;YAC5B,WAAW,EACV,uFAAuF;YACxF,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtC,WAAW,EAAE,kBAAkB;YAC/B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AAC;gBAEH,MAAM,SAAS,GAAG,CAAC,MAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;oBAAC,OAAA,CAAC;wBAC5D,EAAE,EAAE,MAAA,IAAI,CAAC,EAAE,mCAAI,EAAE;wBACjB,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE;wBACrB,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,mCAAI,EAAE;wBACnC,YAAY,EAAE,MAAA,IAAI,CAAC,YAAY,mCAAI,EAAE;wBACrC,WAAW,EAAE,MAAA,IAAI,CAAC,WAAW,mCAAI,EAAE;wBACnC,UAAU,EAAE,MAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,YAAY,mCAAI,EAAE;qBAChD,CAAC,CAAA;iBAAA,CAAC,CAAC;gBAEJ,OAAO;oBACN,SAAS;oBACT,KAAK,EAAE,SAAS,CAAC,MAAM;oBACvB,aAAa,EAAE,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,mCAAI,IAAI;iBAClD,CAAC;YACH,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,MAAM,KAAK,GAAG,CAAwC,CAAC;gBACvD,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACxB,MAAM,IAAI,KAAK,CACd,mFAAmF,CACnF,CAAC;gBACH,CAAC;gBACD,MAAM,CAAC,CAAC;YACT,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const unmergeTableCells: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
documentId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tableStartIndex: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
7
|
+
rowIndex: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
8
|
+
columnIndex: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
9
|
+
rowSpan: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
10
|
+
columnSpan: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=unmerge-table-cells.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unmerge-table-cells.action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/unmerge-table-cells.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB;;;;;;;;;;EAiF5B,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unmergeTableCells = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-docs/src/lib/actions/unmerge-table-cells.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
10
|
+
const docs_1 = require("@googleapis/docs");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.unmergeTableCells = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.googleDocsAuth,
|
|
14
|
+
name: 'unmerge_table_cells',
|
|
15
|
+
displayName: 'Unmerge Table Cells',
|
|
16
|
+
description: 'Unmerge previously merged table cells in a Google Docs document',
|
|
17
|
+
audience: 'ai',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Unmerges a range of previously merged table cells in a Google Docs document. The range is specified by the anchor cell (rowIndex, columnIndex) and the span (rowSpan, columnSpan) to unmerge. Requires the table start index from Read Document — cannot be guessed. Idempotent: unmerging already-unmerged cells is a no-op.',
|
|
20
|
+
idempotent: true,
|
|
21
|
+
},
|
|
22
|
+
outputSchema: output_schemas_1.unmergeTableCellsActionOutputSchema,
|
|
23
|
+
props: {
|
|
24
|
+
documentId: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Document ID',
|
|
26
|
+
description: 'The ID of the document containing the table.',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
tableStartIndex: pieces_framework_1.Property.Number({
|
|
30
|
+
displayName: 'Table Start Index',
|
|
31
|
+
description: 'Obtain the table start index from Read Document — cannot be guessed.',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
rowIndex: pieces_framework_1.Property.Number({
|
|
35
|
+
displayName: 'Row Index',
|
|
36
|
+
description: 'Zero-based row index of the top-left anchor cell of the merged region.',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
columnIndex: pieces_framework_1.Property.Number({
|
|
40
|
+
displayName: 'Column Index',
|
|
41
|
+
description: 'Zero-based column index of the top-left anchor cell of the merged region.',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
rowSpan: pieces_framework_1.Property.Number({
|
|
45
|
+
displayName: 'Row Span',
|
|
46
|
+
description: 'Number of rows covered by the merged region to unmerge.',
|
|
47
|
+
required: true,
|
|
48
|
+
}),
|
|
49
|
+
columnSpan: pieces_framework_1.Property.Number({
|
|
50
|
+
displayName: 'Column Span',
|
|
51
|
+
description: 'Number of columns covered by the merged region to unmerge.',
|
|
52
|
+
required: true,
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
run(context) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const { documentId, tableStartIndex, rowIndex, columnIndex, rowSpan, columnSpan } = context.propsValue;
|
|
58
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
59
|
+
const docs = (0, docs_1.docs)({ version: 'v1', auth: authClient });
|
|
60
|
+
const request = {
|
|
61
|
+
unmergeTableCells: {
|
|
62
|
+
tableRange: {
|
|
63
|
+
tableCellLocation: {
|
|
64
|
+
tableStartLocation: { index: tableStartIndex },
|
|
65
|
+
rowIndex,
|
|
66
|
+
columnIndex,
|
|
67
|
+
},
|
|
68
|
+
rowSpan,
|
|
69
|
+
columnSpan,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
yield docs.documents.batchUpdate({
|
|
75
|
+
documentId,
|
|
76
|
+
requestBody: { requests: [request] },
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
documentId,
|
|
81
|
+
tableStartIndex,
|
|
82
|
+
rowIndex,
|
|
83
|
+
columnIndex,
|
|
84
|
+
rowSpan,
|
|
85
|
+
columnSpan,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
throw new Error(common_1.docsCommon.formatError(error, 'unmerge table cells in'));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=unmerge-table-cells.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unmerge-table-cells.action.js","sourceRoot":"","sources":["../../../src/lib/actions/unmerge-table-cells.action.ts"],"names":[],"mappings":";;;;AAAA,wHAAwH;AACxH,qEAAqE;AACrE,kCAA6D;AAC7D,sCAAuC;AACvC,gEAAmE;AACnE,2CAA+D;AAC/D,sDAAwE;AAE3D,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,qBAAc;IACpB,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CAAC;YAC1D,MAAM,IAAI,GAAG,IAAA,WAAU,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;YAE7D,MAAM,OAAO,GAA2B;gBACtC,iBAAiB,EAAE;oBACjB,UAAU,EAAE;wBACV,iBAAiB,EAAE;4BACjB,kBAAkB,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE;4BAC9C,QAAQ;4BACR,WAAW;yBACZ;wBACD,OAAO;wBACP,UAAU;qBACX;iBACF;aACF,CAAC;YAEF,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;oBAC/B,UAAU;oBACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;iBACrC,CAAC,CAAC;gBACH,OAAO;oBACL,OAAO,EAAE,IAAI;oBACb,UAAU;oBACV,eAAe;oBACf,QAAQ;oBACR,WAAW;oBACX,OAAO;oBACP,UAAU;iBACX,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,mBAAU,CAAC,WAAW,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const updateDocumentStyle: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
documentId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
marginTopPt: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
7
|
+
marginBottomPt: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
8
|
+
marginLeftPt: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
9
|
+
marginRightPt: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=update-document-style.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-document-style.action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/update-document-style.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB;;;;;;;;;EAsF9B,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateDocumentStyle = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/google-docs/src/lib/actions/update-document-style.action.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
10
|
+
const docs_1 = require("@googleapis/docs");
|
|
11
|
+
const output_schemas_1 = require("../output-schemas");
|
|
12
|
+
exports.updateDocumentStyle = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.googleDocsAuth,
|
|
14
|
+
name: 'update_document_style',
|
|
15
|
+
displayName: 'Update Document Style',
|
|
16
|
+
description: 'Update the page margins or other document-level style properties of a Google Docs document.',
|
|
17
|
+
audience: 'ai',
|
|
18
|
+
aiMetadata: {
|
|
19
|
+
description: 'Updates document-level style properties such as page margins. Only the properties you provide are changed — leave any margin empty to leave it unchanged. Re-applying the same values leaves the document in the same state, so it is idempotent. Use this to set consistent page margins before exporting or sharing a document.',
|
|
20
|
+
idempotent: true,
|
|
21
|
+
},
|
|
22
|
+
outputSchema: output_schemas_1.updateDocumentStyleActionOutputSchema,
|
|
23
|
+
props: {
|
|
24
|
+
documentId: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Document ID',
|
|
26
|
+
description: 'The ID of the document whose style to update.',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
marginTopPt: pieces_framework_1.Property.Number({
|
|
30
|
+
displayName: 'Top Margin (pt)',
|
|
31
|
+
description: 'Top page margin in points. Leave empty to keep the current value.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
marginBottomPt: pieces_framework_1.Property.Number({
|
|
35
|
+
displayName: 'Bottom Margin (pt)',
|
|
36
|
+
description: 'Bottom page margin in points. Leave empty to keep the current value.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
marginLeftPt: pieces_framework_1.Property.Number({
|
|
40
|
+
displayName: 'Left Margin (pt)',
|
|
41
|
+
description: 'Left page margin in points. Leave empty to keep the current value.',
|
|
42
|
+
required: false,
|
|
43
|
+
}),
|
|
44
|
+
marginRightPt: pieces_framework_1.Property.Number({
|
|
45
|
+
displayName: 'Right Margin (pt)',
|
|
46
|
+
description: 'Right page margin in points. Leave empty to keep the current value.',
|
|
47
|
+
required: false,
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
run(context) {
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const { documentId, marginTopPt, marginBottomPt, marginLeftPt, marginRightPt } = context.propsValue;
|
|
53
|
+
const documentStyle = {};
|
|
54
|
+
const fieldPaths = [];
|
|
55
|
+
if (marginTopPt !== undefined && marginTopPt !== null) {
|
|
56
|
+
documentStyle.marginTop = { magnitude: marginTopPt, unit: 'PT' };
|
|
57
|
+
fieldPaths.push('marginTop');
|
|
58
|
+
}
|
|
59
|
+
if (marginBottomPt !== undefined && marginBottomPt !== null) {
|
|
60
|
+
documentStyle.marginBottom = { magnitude: marginBottomPt, unit: 'PT' };
|
|
61
|
+
fieldPaths.push('marginBottom');
|
|
62
|
+
}
|
|
63
|
+
if (marginLeftPt !== undefined && marginLeftPt !== null) {
|
|
64
|
+
documentStyle.marginLeft = { magnitude: marginLeftPt, unit: 'PT' };
|
|
65
|
+
fieldPaths.push('marginLeft');
|
|
66
|
+
}
|
|
67
|
+
if (marginRightPt !== undefined && marginRightPt !== null) {
|
|
68
|
+
documentStyle.marginRight = { magnitude: marginRightPt, unit: 'PT' };
|
|
69
|
+
fieldPaths.push('marginRight');
|
|
70
|
+
}
|
|
71
|
+
if (fieldPaths.length === 0) {
|
|
72
|
+
throw new Error('At least one style property must be provided.');
|
|
73
|
+
}
|
|
74
|
+
const request = {
|
|
75
|
+
updateDocumentStyle: {
|
|
76
|
+
documentStyle,
|
|
77
|
+
fields: fieldPaths.join(','),
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const authClient = yield (0, auth_1.createGoogleClient)(context.auth);
|
|
81
|
+
const docs = (0, docs_1.docs)({ version: 'v1', auth: authClient });
|
|
82
|
+
try {
|
|
83
|
+
yield docs.documents.batchUpdate({
|
|
84
|
+
documentId,
|
|
85
|
+
requestBody: { requests: [request] },
|
|
86
|
+
});
|
|
87
|
+
return { success: true, documentId, updatedFields: fieldPaths };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
throw new Error(common_1.docsCommon.formatError(error, 'update the style of'));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=update-document-style.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-document-style.action.js","sourceRoot":"","sources":["../../../src/lib/actions/update-document-style.action.ts"],"names":[],"mappings":";;;;AAAA,0HAA0H;AAC1H,qEAAqE;AACrE,kCAA6D;AAC7D,sCAAuC;AACvC,gEAAmE;AACnE,2CAA+D;AAC/D,sDAA0E;AAE7D,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,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AI,CAAC,SAAS,CAAC,WAAW,CAAC;oBAChC,UAAU;oBACV,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;iBACpC,CAAC,CAAC;gBACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;YACjE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CAAC,mBAAU,CAAC,WAAW,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC;YACvE,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const updateTableRowStyle: import("@agnocon/pieces-framework").IAction<(import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props> | import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
serviceAccount: import("@agnocon/pieces-framework").LongTextProperty<true>;
|
|
3
|
+
userEmail: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
}>)[], {
|
|
5
|
+
documentId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tableStartIndex: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
7
|
+
rowIndices: import("@agnocon/pieces-framework").ArrayProperty<true>;
|
|
8
|
+
minRowHeightPt: import("@agnocon/pieces-framework").NumberProperty<true>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=update-table-row-style.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-table-row-style.action.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/update-table-row-style.action.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,mBAAmB;;;;;;;;EAkE9B,CAAC"}
|