@particle-academy/google-docs-js 0.5.0 → 0.7.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/CHANGELOG.md CHANGED
@@ -8,6 +8,44 @@ The four packages share one version, because they are generated from one
8
8
  `provider/` definition and a version that meant something different in each
9
9
  would be a version nobody could reason about.
10
10
 
11
+ ## [0.7.0] — 2026-11-08
12
+
13
+ ### Added
14
+
15
+ - **`text_replace`**: replace every occurrence of a string in a document (Google's
16
+ `replaceAllText`), the template-filling case (`{{name}}` -> a value). Publishes
17
+ `occurrencesChanged`; 0 means not found, which is not an error.
18
+ - **`batch_update`**: any list of Google Docs API requests, as JSON, applied all
19
+ or none.
20
+ - Both take an optional **`requiredRevisionId`**: if the document has changed
21
+ since you read it, Google refuses the whole batch instead of applying it to
22
+ content you have not seen.
23
+
24
+ ## [0.6.0] — 2026-11-08
25
+
26
+ ### Added
27
+
28
+ - **One Google consent grant, shared by every Google connector** (`oauth.grant:
29
+ "google"`), for an org-level Google connection: one OAuth client, one consent
30
+ and one refresh token per person, with each feature's scopes asked for when it
31
+ is first used. Declared in the manifest, the `-ui` package's OAuth constant,
32
+ the README and the registry index:
33
+ - `authorizeParams`: `access_type=offline` and `include_granted_scopes=true`.
34
+ A refresh token comes back only on the FIRST code exchange, so keep the stored
35
+ one when an exchange returns none.
36
+ - `revoke`: POST `https://oauth2.googleapis.com/revoke` with `token`, and
37
+ `scope: "grant"`. **Revoking removes the person's WHOLE Google grant, every
38
+ Google connector**, so a per-feature disconnect stops using that feature's
39
+ scopes locally and only a full Google disconnect revokes.
40
+ - `identity`: identify the account by the id_token's `sub` (request `openid`;
41
+ issuer `https://accounts.google.com` or `accounts.google.com`; audience is
42
+ the `clientId`), never by email, which Google says is neither unique nor
43
+ permanent.
44
+ `restrictedScopes` is empty: none of this connector's scopes is restricted.
45
+
46
+ Nothing a request sends has changed; this is what a host needs to run the
47
+ connection.
48
+
11
49
  ## [0.5.0] — 2026-11-08
12
50
 
13
51
  ### Added
package/README.md CHANGED
@@ -55,6 +55,13 @@ Google Docs uses OAuth2 (authorization_code). The package DECLARES the exchange;
55
55
  - **Scopes** — `https://www.googleapis.com/auth/documents`
56
56
  - **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
57
57
 
58
+ **One consent grant, shared** (`grant: "google"`). Every connector declaring the same grant can run on ONE OAuth client, with one consent and one refresh token per person.
59
+
60
+ - **Authorize with** `access_type=offline`, `include_granted_scopes=true`. Ask for a feature's scopes when it is first used; the new token covers every scope granted before. A refresh token comes back only on the FIRST exchange, so keep the stored one when an exchange returns none.
61
+ - **Revoke** — POST https://oauth2.googleapis.com/revoke with `token`. **It removes the WHOLE grant**: every connector sharing it, not only this one. A per-feature disconnect stops using that feature's scopes locally; only a full disconnect revokes.
62
+ - **Identify the account by `sub`**: request `openid`, then verify the token response's id_token (issuer `https://accounts.google.com` or `accounts.google.com`, keys at https://www.googleapis.com/oauth2/v3/certs, audience = `clientId`). Never key a connection by email.
63
+ - **No restricted scopes** in this connector.
64
+
58
65
  The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
59
66
 
60
67
  ### The estate
@@ -67,6 +74,18 @@ The refresh tokens do **not** rotate: the same one is reusable, so a refresh may
67
74
 
68
75
  ### Actions
69
76
 
77
+ #### `batch_update` — Batch update a Google Doc
78
+
79
+ Apply a list of Google Doc API requests to a document, all or none.
80
+
81
+ `POST /v1/documents/{documentId}:batchUpdate` · **unsafe to replay** — a retried durable run does it TWICE
82
+
83
+ | Input | Required | What it is |
84
+ |---|---|---|
85
+ | `documentId` | yes | From document_create's data.documentId, or the id in the document's own URL. |
86
+ | `requests` | yes | Google's Request objects, in order. Example: [{"replaceAllText":{"containsText":{"text":"{{name}}","matchCase":true},"replaceText":"Ada"}}]. |
87
+ | `requiredRevisionId` | no | Optional. The document's revisionId as you last read it. If the document has changed since, Google refuses the whole batch with a 400 instead of applying it to content you have not seen. |
88
+
70
89
  #### `document_create` — Google Docs document
71
90
 
72
91
  Create a blank Google Docs document.
@@ -89,6 +108,20 @@ Insert plain text at a position in an existing document's body.
89
108
  | `text` | yes | Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in. |
90
109
  | `index` | yes | A zero-based position in UTF-16 code units, but 0 itself is never valid -- Google's body content starts at index 1. 1 is the very beginning of a freshly created blank document. To append after existing content, read the document's own length first (not yet offered by this connector) and insert there instead. |
91
110
 
111
+ #### `text_replace` — Replace text in a Google Doc
112
+
113
+ Replace every occurrence of a string in a document.
114
+
115
+ `POST /v1/documents/{documentId}:batchUpdate` · **unsafe to replay** — a retried durable run does it TWICE
116
+
117
+ | Input | Required | What it is |
118
+ |---|---|---|
119
+ | `documentId` | yes | From document_create's data.documentId, or the id in the document's own URL. |
120
+ | `find` | yes | The exact text to find, e.g. {{name}}. Not a regular expression. |
121
+ | `replaceWith` | yes | Inserted in place of every match. Empty is refused: to delete text, use batch_update. |
122
+ | `matchCase` | no | Off matches case-insensitively, which is also what Google does when it is not sent. |
123
+ | `requiredRevisionId` | no | Optional. The document's revisionId as you last read it. If the document has changed since, Google refuses the whole batch with a 400 instead of applying it to content you have not seen. |
124
+
92
125
  ## Run it before you have credentials
93
126
 
94
127
  Every operation ships a **faker**, whether or not Google Docs has a sandbox. Set a
@@ -0,0 +1,260 @@
1
+ import { callConnector } from '@particle-academy/fancy-connector-core';
2
+
3
+ // src/faker.ts
4
+ function fakeBatchUpdate({ config, fake }) {
5
+ return {
6
+ "documentId": config.documentId !== void 0 && config.documentId !== null && config.documentId !== "" ? String(config.documentId) : fake.id("1Doc"),
7
+ "replies": [
8
+ {}
9
+ ],
10
+ "writeControl": {
11
+ "requiredRevisionId": fake.hex(16)
12
+ }
13
+ };
14
+ }
15
+ function fakeDocumentCreate({ config, fake }) {
16
+ return {
17
+ "documentId": fake.id("1Doc"),
18
+ "title": config.title !== void 0 && config.title !== null && config.title !== "" ? String(config.title) : "Untitled document"
19
+ };
20
+ }
21
+ function fakeTextInsert({ config, fake }) {
22
+ return {
23
+ "documentId": config.documentId !== void 0 && config.documentId !== null && config.documentId !== "" ? String(config.documentId) : fake.id("1Doc"),
24
+ "replies": [
25
+ {}
26
+ ]
27
+ };
28
+ }
29
+ function fakeTextReplace({ config, fake }) {
30
+ return {
31
+ "documentId": config.documentId !== void 0 && config.documentId !== null && config.documentId !== "" ? String(config.documentId) : fake.id("1Doc"),
32
+ "replies": [
33
+ {
34
+ "replaceAllText": {
35
+ "occurrencesChanged": fake.int(1, 9)
36
+ }
37
+ }
38
+ ],
39
+ "writeControl": {
40
+ "requiredRevisionId": fake.hex(16)
41
+ }
42
+ };
43
+ }
44
+ var googleDocsFaker = (operation, request) => {
45
+ switch (operation) {
46
+ case "batch_update":
47
+ return fakeBatchUpdate(request);
48
+ case "document_create":
49
+ return fakeDocumentCreate(request);
50
+ case "text_insert":
51
+ return fakeTextInsert(request);
52
+ case "text_replace":
53
+ return fakeTextReplace(request);
54
+ default:
55
+ throw new Error(
56
+ `google_docs: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
57
+ );
58
+ }
59
+ };
60
+
61
+ // src/service.ts
62
+ var CONNECTOR_API_VERSION = 1;
63
+ var GOOGLE_DOCS_BASE_URLS = {
64
+ "live": "https://docs.googleapis.com"
65
+ };
66
+ var GOOGLE_DOCS_REQUIRES = [
67
+ "accessToken",
68
+ "refreshToken",
69
+ "clientId",
70
+ "clientSecret"
71
+ ];
72
+ function googleDocsAuthorize(credentials, request, _mode) {
73
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
74
+ }
75
+ var GOOGLE_DOCS = {
76
+ service: "google_docs",
77
+ title: "Google Docs",
78
+ sandbox: "none",
79
+ baseUrls: { ...GOOGLE_DOCS_BASE_URLS },
80
+ requires: [...GOOGLE_DOCS_REQUIRES],
81
+ authorize: googleDocsAuthorize,
82
+ faker: googleDocsFaker
83
+ };
84
+ var BATCH_UPDATE_OPERATION = "batch_update";
85
+ async function googleDocsBatchUpdate(options) {
86
+ const config = options.config ?? {};
87
+ if (config.documentId === void 0 || config.documentId === null || config.documentId === "") {
88
+ throw new Error(`batch_update: "documentId" is required (Document ID).`);
89
+ }
90
+ if (config.requests === void 0 || config.requests === null || config.requests === "") {
91
+ throw new Error(`batch_update: "requests" is required (Requests).`);
92
+ }
93
+ if (typeof config.requests === "string" && config.requests !== "") {
94
+ try {
95
+ JSON.parse(config.requests);
96
+ } catch (error) {
97
+ throw new Error(`batch_update: "requests" must be JSON: ${error.message}`);
98
+ }
99
+ }
100
+ return callConnector(GOOGLE_DOCS, {
101
+ operation: BATCH_UPDATE_OPERATION,
102
+ config,
103
+ input: options.input,
104
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
105
+ ...options.mode === void 0 ? {} : { mode: options.mode },
106
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
107
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
108
+ ...options.transport === void 0 ? {} : { transport: options.transport },
109
+ request: {
110
+ method: "POST",
111
+ path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,
112
+ json: nestFields({
113
+ ...config.requests !== void 0 && config.requests !== null && config.requests !== "" ? { "requests": typeof config.requests === "string" ? JSON.parse(config.requests) : config.requests } : {},
114
+ ...config.requiredRevisionId !== void 0 && config.requiredRevisionId !== null && config.requiredRevisionId !== "" ? { "writeControl.requiredRevisionId": String(config.requiredRevisionId) } : {}
115
+ })
116
+ }
117
+ });
118
+ }
119
+ function nestFields(flat) {
120
+ const out = {};
121
+ for (const [path, value] of Object.entries(flat)) {
122
+ const parts = path.split(".");
123
+ let node = out;
124
+ while (parts.length > 1) {
125
+ const key = parts.shift();
126
+ const wantsArray = /^\d+$/.test(parts[0] ?? "");
127
+ if (typeof node[key] !== "object" || node[key] === null) node[key] = wantsArray ? [] : {};
128
+ node = node[key];
129
+ }
130
+ node[parts[0]] = value;
131
+ }
132
+ return out;
133
+ }
134
+ var DOCUMENT_CREATE_OPERATION = "document_create";
135
+ async function googleDocsDocumentCreate(options) {
136
+ const config = options.config ?? {};
137
+ if (config.title === void 0 || config.title === null || config.title === "") {
138
+ throw new Error(`document_create: "title" is required (Title).`);
139
+ }
140
+ return callConnector(GOOGLE_DOCS, {
141
+ operation: DOCUMENT_CREATE_OPERATION,
142
+ config,
143
+ input: options.input,
144
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
145
+ ...options.mode === void 0 ? {} : { mode: options.mode },
146
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
147
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
148
+ ...options.transport === void 0 ? {} : { transport: options.transport },
149
+ request: {
150
+ method: "POST",
151
+ path: "/v1/documents",
152
+ json: {
153
+ "title": String(config.title)
154
+ }
155
+ }
156
+ });
157
+ }
158
+ var TEXT_INSERT_OPERATION = "text_insert";
159
+ async function googleDocsTextInsert(options) {
160
+ const config = options.config ?? {};
161
+ if (config.documentId === void 0 || config.documentId === null || config.documentId === "") {
162
+ throw new Error(`text_insert: "documentId" is required (Document ID).`);
163
+ }
164
+ if (config.text === void 0 || config.text === null || config.text === "") {
165
+ throw new Error(`text_insert: "text" is required (Text).`);
166
+ }
167
+ {
168
+ const n = Number(config.index);
169
+ if (!(Number.isInteger(n) && n >= 1)) {
170
+ throw new Error(
171
+ `text_insert: "index" must be a integer, got ${JSON.stringify(config.index)}.`
172
+ );
173
+ }
174
+ }
175
+ return callConnector(GOOGLE_DOCS, {
176
+ operation: TEXT_INSERT_OPERATION,
177
+ config,
178
+ input: options.input,
179
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
180
+ ...options.mode === void 0 ? {} : { mode: options.mode },
181
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
182
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
183
+ ...options.transport === void 0 ? {} : { transport: options.transport },
184
+ request: {
185
+ method: "POST",
186
+ path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,
187
+ json: nestFields2({
188
+ "requests.0.insertText.text": String(config.text),
189
+ "requests.0.insertText.location.index": Math.trunc(Number(config.index))
190
+ })
191
+ }
192
+ });
193
+ }
194
+ function nestFields2(flat) {
195
+ const out = {};
196
+ for (const [path, value] of Object.entries(flat)) {
197
+ const parts = path.split(".");
198
+ let node = out;
199
+ while (parts.length > 1) {
200
+ const key = parts.shift();
201
+ const wantsArray = /^\d+$/.test(parts[0] ?? "");
202
+ if (typeof node[key] !== "object" || node[key] === null) node[key] = wantsArray ? [] : {};
203
+ node = node[key];
204
+ }
205
+ node[parts[0]] = value;
206
+ }
207
+ return out;
208
+ }
209
+ var TEXT_REPLACE_OPERATION = "text_replace";
210
+ async function googleDocsTextReplace(options) {
211
+ const config = options.config ?? {};
212
+ if (config.documentId === void 0 || config.documentId === null || config.documentId === "") {
213
+ throw new Error(`text_replace: "documentId" is required (Document ID).`);
214
+ }
215
+ if (config.find === void 0 || config.find === null || config.find === "") {
216
+ throw new Error(`text_replace: "find" is required (Find).`);
217
+ }
218
+ if (config.replaceWith === void 0 || config.replaceWith === null || config.replaceWith === "") {
219
+ throw new Error(`text_replace: "replaceWith" is required (Replace with).`);
220
+ }
221
+ return callConnector(GOOGLE_DOCS, {
222
+ operation: TEXT_REPLACE_OPERATION,
223
+ config,
224
+ input: options.input,
225
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
226
+ ...options.mode === void 0 ? {} : { mode: options.mode },
227
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
228
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
229
+ ...options.transport === void 0 ? {} : { transport: options.transport },
230
+ request: {
231
+ method: "POST",
232
+ path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,
233
+ json: nestFields3({
234
+ "requests.0.replaceAllText.containsText.text": String(config.find),
235
+ "requests.0.replaceAllText.replaceText": String(config.replaceWith),
236
+ ...config.matchCase !== void 0 && config.matchCase !== null && config.matchCase !== "" ? { "requests.0.replaceAllText.containsText.matchCase": Boolean(config.matchCase) } : {},
237
+ ...config.requiredRevisionId !== void 0 && config.requiredRevisionId !== null && config.requiredRevisionId !== "" ? { "writeControl.requiredRevisionId": String(config.requiredRevisionId) } : {}
238
+ })
239
+ }
240
+ });
241
+ }
242
+ function nestFields3(flat) {
243
+ const out = {};
244
+ for (const [path, value] of Object.entries(flat)) {
245
+ const parts = path.split(".");
246
+ let node = out;
247
+ while (parts.length > 1) {
248
+ const key = parts.shift();
249
+ const wantsArray = /^\d+$/.test(parts[0] ?? "");
250
+ if (typeof node[key] !== "object" || node[key] === null) node[key] = wantsArray ? [] : {};
251
+ node = node[key];
252
+ }
253
+ node[parts[0]] = value;
254
+ }
255
+ return out;
256
+ }
257
+
258
+ export { BATCH_UPDATE_OPERATION, CONNECTOR_API_VERSION, DOCUMENT_CREATE_OPERATION, GOOGLE_DOCS, GOOGLE_DOCS_BASE_URLS, GOOGLE_DOCS_REQUIRES, TEXT_INSERT_OPERATION, TEXT_REPLACE_OPERATION, googleDocsAuthorize, googleDocsBatchUpdate, googleDocsDocumentCreate, googleDocsFaker, googleDocsTextInsert, googleDocsTextReplace };
259
+ //# sourceMappingURL=chunk-VLBBKMA4.js.map
260
+ //# sourceMappingURL=chunk-VLBBKMA4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/batch-update.ts","../src/actions/document-create.ts","../src/actions/text-insert.ts","../src/actions/text-replace.ts"],"names":["callConnector","nestFields"],"mappings":";;;AAyBA,SAAS,eAAA,CAAgB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC/D,EAAA,OAAO;AAAA,IACL,cAAe,MAAA,CAAO,UAAA,KAAe,MAAA,IAAa,MAAA,CAAO,eAAe,IAAA,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,OAAO,kBAAkB,CAAA,KAAM;AAAC,OACrM;AAAA;AACH,GACD,CAAA;AACH;AASA,SAASA,YAAW,IAAA,EAAwD;AAC1E,EAAA,MAAM,MAA+B,EAAC;AAEtC,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,IAAI,CAAA,EAAG;AAChD,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA;AAC5B,IAAA,IAAI,IAAA,GAAO,GAAA;AAEX,IAAA,OAAO,KAAA,CAAM,SAAS,CAAA,EAAG;AACvB,MAAA,MAAM,GAAA,GAAM,MAAM,KAAA,EAAM;AAMxB,MAAA,MAAM,aAAa,OAAA,CAAQ,IAAA,CAAK,KAAA,CAAM,CAAC,KAAK,EAAE,CAAA;AAE9C,MAAA,IAAI,OAAO,IAAA,CAAK,GAAG,CAAA,KAAM,YAAY,IAAA,CAAK,GAAG,CAAA,KAAM,IAAA,OAAW,GAAG,CAAA,GAAI,UAAA,GAAa,KAAK,EAAC;AACxF,MAAA,IAAA,GAAO,KAAK,GAAG,CAAA;AAAA,IACjB;AAEA,IAAA,IAAA,CAAK,KAAA,CAAM,CAAC,CAAW,CAAA,GAAI,KAAA;AAAA,EAC7B;AAEA,EAAA,OAAO,GAAA;AACT","file":"chunk-VLBBKMA4.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_docs\n */\n\n/**\n * The Google Docs faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Docs actually publishes, so an author can wire {{ $json.data.id\n * }} against a fake and have it keep working against the real thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeBatchUpdate({ config, fake }: FakeRequest): unknown {\n return {\n \"documentId\": (config.documentId !== undefined && config.documentId !== null && config.documentId !== \"\" ? String(config.documentId) : fake.id(\"1Doc\")),\n \"replies\": [\n {},\n ],\n \"writeControl\": {\n \"requiredRevisionId\": fake.hex(16),\n },\n };\n}\n\nfunction fakeDocumentCreate({ config, fake }: FakeRequest): unknown {\n return {\n \"documentId\": fake.id(\"1Doc\"),\n \"title\": (config.title !== undefined && config.title !== null && config.title !== \"\" ? String(config.title) : \"Untitled document\"),\n };\n}\n\nfunction fakeTextInsert({ config, fake }: FakeRequest): unknown {\n return {\n \"documentId\": (config.documentId !== undefined && config.documentId !== null && config.documentId !== \"\" ? String(config.documentId) : fake.id(\"1Doc\")),\n \"replies\": [\n {},\n ],\n };\n}\n\nfunction fakeTextReplace({ config, fake }: FakeRequest): unknown {\n return {\n \"documentId\": (config.documentId !== undefined && config.documentId !== null && config.documentId !== \"\" ? String(config.documentId) : fake.id(\"1Doc\")),\n \"replies\": [\n {\n \"replaceAllText\": {\n \"occurrencesChanged\": fake.int(1, 9),\n },\n },\n ],\n \"writeControl\": {\n \"requiredRevisionId\": fake.hex(16),\n },\n };\n}\n\nexport const googleDocsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"batch_update\":\n return fakeBatchUpdate(request);\n\n case \"document_create\":\n return fakeDocumentCreate(request);\n\n case \"text_insert\":\n return fakeTextInsert(request);\n\n case \"text_replace\":\n return fakeTextReplace(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_docs: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_docs\n */\n\n/**\n * Google Docs, as one service descriptor shared by every Google Docs\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Docs: its base URL, its auth\n * scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for Docs. A test document is a real one in a real\n * Drive, so every create is real -- use the faker while developing and clean\n * up any live test documents.\n */\n\nimport type { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleDocsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_DOCS_BASE_URLS = {\n \"live\": \"https://docs.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_DOCS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Docs's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleDocsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Docs service, for the TypeScript runtime. */\nexport const GOOGLE_DOCS: ServiceDescriptor = {\n service: \"google_docs\",\n title: \"Google Docs\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_DOCS_BASE_URLS },\n requires: [...GOOGLE_DOCS_REQUIRES],\n authorize: googleDocsAuthorize,\n faker: googleDocsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/batch-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/batch-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_docs\n */\n\n/**\n * Apply a list of Google Doc API requests to a document, all or none.\n *\n * POST /v1/documents/{documentId}:batchUpdate —\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Docs or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_DOCS } from \"../service.js\";\n\nexport const BATCH_UPDATE_OPERATION = \"batch_update\";\n\nexport type BatchUpdateOptions = {\n /** The node's resolved config. Keys: documentId, requests, requiredRevisionId. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleDocsBatchUpdate(options: BatchUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.documentId === undefined || config.documentId === null || config.documentId === \"\") {\n throw new Error(`batch_update: \"documentId\" is required (Document ID).`);\n }\n\n if (config.requests === undefined || config.requests === null || config.requests === \"\") {\n throw new Error(`batch_update: \"requests\" is required (Requests).`);\n }\n if (typeof config.requests === \"string\" && config.requests !== \"\") {\n try {\n JSON.parse(config.requests);\n } catch (error) {\n throw new Error(`batch_update: \"requests\" must be JSON: ${(error as Error).message}`);\n }\n }\n\n return callConnector(GOOGLE_DOCS, {\n operation: BATCH_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,\n json: nestFields({\n ...(config.requests !== undefined && config.requests !== null && config.requests !== \"\" ? { \"requests\": typeof config.requests === \"string\" ? JSON.parse(config.requests) : config.requests } : {}),\n ...(config.requiredRevisionId !== undefined && config.requiredRevisionId !== null && config.requiredRevisionId !== \"\" ? { \"writeControl.requiredRevisionId\": String(config.requiredRevisionId) } : {}),\n }),\n },\n });\n}\n\n/**\n * `{\"properties.email\": x}` -> `{properties: {email: x}}`.\n *\n * A dotted `as` means NESTING, and only a JSON body can nest. The validator\n * refuses that spelling anywhere else, because in a form body it already means\n * something different — a literal dotted key.\n */\nfunction nestFields(flat: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n\n for (const [path, value] of Object.entries(flat)) {\n const parts = path.split(\".\");\n let node = out;\n\n while (parts.length > 1) {\n const key = parts.shift() as string;\n // A NUMERIC segment is an array index: `dateRanges.0.startDate` has to\n // become `[{startDate}]`, not `{\"0\": {startDate}}`. PHP produced the\n // array by accident (its integer-keyed arrays serialise as JSON lists)\n // and the other two produced an object, which the provider rejects as\n // the wrong type. The parity suite is what caught the disagreement.\n const wantsArray = /^\\d+$/.test(parts[0] ?? \"\");\n\n if (typeof node[key] !== \"object\" || node[key] === null) node[key] = wantsArray ? [] : {};\n node = node[key] as Record<string, unknown>;\n }\n\n node[parts[0] as string] = value;\n }\n\n return out;\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/document-create.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/document-create.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_docs\n */\n\n/**\n * Create a blank Google Docs document.\n *\n * POST /v1/documents —\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Docs or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_DOCS } from \"../service.js\";\n\nexport const DOCUMENT_CREATE_OPERATION = \"document_create\";\n\nexport type DocumentCreateOptions = {\n /** The node's resolved config. Keys: title. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleDocsDocumentCreate(options: DocumentCreateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.title === undefined || config.title === null || config.title === \"\") {\n throw new Error(`document_create: \"title\" is required (Title).`);\n }\n\n return callConnector(GOOGLE_DOCS, {\n operation: DOCUMENT_CREATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: \"/v1/documents\",\n json: {\n \"title\": String(config.title),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/text-insert.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/text-insert.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_docs\n */\n\n/**\n * Insert plain text at a position in an existing document's body.\n *\n * POST /v1/documents/{documentId}:batchUpdate —\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Docs or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_DOCS } from \"../service.js\";\n\nexport const TEXT_INSERT_OPERATION = \"text_insert\";\n\nexport type TextInsertOptions = {\n /** The node's resolved config. Keys: documentId, text, index. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleDocsTextInsert(options: TextInsertOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.documentId === undefined || config.documentId === null || config.documentId === \"\") {\n throw new Error(`text_insert: \"documentId\" is required (Document ID).`);\n }\n\n if (config.text === undefined || config.text === null || config.text === \"\") {\n throw new Error(`text_insert: \"text\" is required (Text).`);\n }\n\n {\n const n = Number(config.index);\n if (!(Number.isInteger(n) && n >= 1)) {\n throw new Error(\n `text_insert: \"index\" must be a integer, got ${JSON.stringify(config.index)}.`,\n );\n }\n }\n\n return callConnector(GOOGLE_DOCS, {\n operation: TEXT_INSERT_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,\n json: nestFields({\n \"requests.0.insertText.text\": String(config.text),\n \"requests.0.insertText.location.index\": Math.trunc(Number(config.index)),\n }),\n },\n });\n}\n\n/**\n * `{\"properties.email\": x}` -> `{properties: {email: x}}`.\n *\n * A dotted `as` means NESTING, and only a JSON body can nest. The validator\n * refuses that spelling anywhere else, because in a form body it already means\n * something different — a literal dotted key.\n */\nfunction nestFields(flat: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n\n for (const [path, value] of Object.entries(flat)) {\n const parts = path.split(\".\");\n let node = out;\n\n while (parts.length > 1) {\n const key = parts.shift() as string;\n // A NUMERIC segment is an array index: `dateRanges.0.startDate` has to\n // become `[{startDate}]`, not `{\"0\": {startDate}}`. PHP produced the\n // array by accident (its integer-keyed arrays serialise as JSON lists)\n // and the other two produced an object, which the provider rejects as\n // the wrong type. The parity suite is what caught the disagreement.\n const wantsArray = /^\\d+$/.test(parts[0] ?? \"\");\n\n if (typeof node[key] !== \"object\" || node[key] === null) node[key] = wantsArray ? [] : {};\n node = node[key] as Record<string, unknown>;\n }\n\n node[parts[0] as string] = value;\n }\n\n return out;\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/text-replace.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/text-replace.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_docs\n */\n\n/**\n * Replace every occurrence of a string in a document.\n *\n * POST /v1/documents/{documentId}:batchUpdate —\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Docs or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_DOCS } from \"../service.js\";\n\nexport const TEXT_REPLACE_OPERATION = \"text_replace\";\n\nexport type TextReplaceOptions = {\n /** The node's resolved config. Keys: documentId, find, replaceWith, matchCase, requiredRevisionId. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleDocsTextReplace(options: TextReplaceOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.documentId === undefined || config.documentId === null || config.documentId === \"\") {\n throw new Error(`text_replace: \"documentId\" is required (Document ID).`);\n }\n\n if (config.find === undefined || config.find === null || config.find === \"\") {\n throw new Error(`text_replace: \"find\" is required (Find).`);\n }\n\n if (config.replaceWith === undefined || config.replaceWith === null || config.replaceWith === \"\") {\n throw new Error(`text_replace: \"replaceWith\" is required (Replace with).`);\n }\n\n return callConnector(GOOGLE_DOCS, {\n operation: TEXT_REPLACE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,\n json: nestFields({\n \"requests.0.replaceAllText.containsText.text\": String(config.find),\n \"requests.0.replaceAllText.replaceText\": String(config.replaceWith),\n ...(config.matchCase !== undefined && config.matchCase !== null && config.matchCase !== \"\" ? { \"requests.0.replaceAllText.containsText.matchCase\": Boolean(config.matchCase) } : {}),\n ...(config.requiredRevisionId !== undefined && config.requiredRevisionId !== null && config.requiredRevisionId !== \"\" ? { \"writeControl.requiredRevisionId\": String(config.requiredRevisionId) } : {}),\n }),\n },\n });\n}\n\n/**\n * `{\"properties.email\": x}` -> `{properties: {email: x}}`.\n *\n * A dotted `as` means NESTING, and only a JSON body can nest. The validator\n * refuses that spelling anywhere else, because in a form body it already means\n * something different — a literal dotted key.\n */\nfunction nestFields(flat: Record<string, unknown>): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n\n for (const [path, value] of Object.entries(flat)) {\n const parts = path.split(\".\");\n let node = out;\n\n while (parts.length > 1) {\n const key = parts.shift() as string;\n // A NUMERIC segment is an array index: `dateRanges.0.startDate` has to\n // become `[{startDate}]`, not `{\"0\": {startDate}}`. PHP produced the\n // array by accident (its integer-keyed arrays serialise as JSON lists)\n // and the other two produced an object, which the provider rejects as\n // the wrong type. The parity suite is what caught the disagreement.\n const wantsArray = /^\\d+$/.test(parts[0] ?? \"\");\n\n if (typeof node[key] !== \"object\" || node[key] === null) node[key] = wantsArray ? [] : {};\n node = node[key] as Record<string, unknown>;\n }\n\n node[parts[0] as string] = value;\n }\n\n return out;\n}\n"]}
package/dist/flow.cjs CHANGED
@@ -6,6 +6,17 @@ var googleDocsUi = require('@particle-academy/google-docs-ui');
6
6
  // src/flow.ts
7
7
 
8
8
  // src/faker.ts
9
+ function fakeBatchUpdate({ config, fake }) {
10
+ return {
11
+ "documentId": config.documentId !== void 0 && config.documentId !== null && config.documentId !== "" ? String(config.documentId) : fake.id("1Doc"),
12
+ "replies": [
13
+ {}
14
+ ],
15
+ "writeControl": {
16
+ "requiredRevisionId": fake.hex(16)
17
+ }
18
+ };
19
+ }
9
20
  function fakeDocumentCreate({ config, fake }) {
10
21
  return {
11
22
  "documentId": fake.id("1Doc"),
@@ -20,12 +31,31 @@ function fakeTextInsert({ config, fake }) {
20
31
  ]
21
32
  };
22
33
  }
34
+ function fakeTextReplace({ config, fake }) {
35
+ return {
36
+ "documentId": config.documentId !== void 0 && config.documentId !== null && config.documentId !== "" ? String(config.documentId) : fake.id("1Doc"),
37
+ "replies": [
38
+ {
39
+ "replaceAllText": {
40
+ "occurrencesChanged": fake.int(1, 9)
41
+ }
42
+ }
43
+ ],
44
+ "writeControl": {
45
+ "requiredRevisionId": fake.hex(16)
46
+ }
47
+ };
48
+ }
23
49
  var googleDocsFaker = (operation, request) => {
24
50
  switch (operation) {
51
+ case "batch_update":
52
+ return fakeBatchUpdate(request);
25
53
  case "document_create":
26
54
  return fakeDocumentCreate(request);
27
55
  case "text_insert":
28
56
  return fakeTextInsert(request);
57
+ case "text_replace":
58
+ return fakeTextReplace(request);
29
59
  default:
30
60
  throw new Error(
31
61
  `google_docs: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
@@ -55,6 +85,56 @@ var GOOGLE_DOCS = {
55
85
  authorize: googleDocsAuthorize,
56
86
  faker: googleDocsFaker
57
87
  };
88
+ var BATCH_UPDATE_OPERATION = "batch_update";
89
+ async function googleDocsBatchUpdate(options) {
90
+ const config = options.config ?? {};
91
+ if (config.documentId === void 0 || config.documentId === null || config.documentId === "") {
92
+ throw new Error(`batch_update: "documentId" is required (Document ID).`);
93
+ }
94
+ if (config.requests === void 0 || config.requests === null || config.requests === "") {
95
+ throw new Error(`batch_update: "requests" is required (Requests).`);
96
+ }
97
+ if (typeof config.requests === "string" && config.requests !== "") {
98
+ try {
99
+ JSON.parse(config.requests);
100
+ } catch (error) {
101
+ throw new Error(`batch_update: "requests" must be JSON: ${error.message}`);
102
+ }
103
+ }
104
+ return fancyConnectorCore.callConnector(GOOGLE_DOCS, {
105
+ operation: BATCH_UPDATE_OPERATION,
106
+ config,
107
+ input: options.input,
108
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
109
+ ...options.mode === void 0 ? {} : { mode: options.mode },
110
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
111
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
112
+ ...options.transport === void 0 ? {} : { transport: options.transport },
113
+ request: {
114
+ method: "POST",
115
+ path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,
116
+ json: nestFields({
117
+ ...config.requests !== void 0 && config.requests !== null && config.requests !== "" ? { "requests": typeof config.requests === "string" ? JSON.parse(config.requests) : config.requests } : {},
118
+ ...config.requiredRevisionId !== void 0 && config.requiredRevisionId !== null && config.requiredRevisionId !== "" ? { "writeControl.requiredRevisionId": String(config.requiredRevisionId) } : {}
119
+ })
120
+ }
121
+ });
122
+ }
123
+ function nestFields(flat) {
124
+ const out = {};
125
+ for (const [path, value] of Object.entries(flat)) {
126
+ const parts = path.split(".");
127
+ let node = out;
128
+ while (parts.length > 1) {
129
+ const key = parts.shift();
130
+ const wantsArray = /^\d+$/.test(parts[0] ?? "");
131
+ if (typeof node[key] !== "object" || node[key] === null) node[key] = wantsArray ? [] : {};
132
+ node = node[key];
133
+ }
134
+ node[parts[0]] = value;
135
+ }
136
+ return out;
137
+ }
58
138
  var DOCUMENT_CREATE_OPERATION = "document_create";
59
139
  async function googleDocsDocumentCreate(options) {
60
140
  const config = options.config ?? {};
@@ -108,14 +188,62 @@ async function googleDocsTextInsert(options) {
108
188
  request: {
109
189
  method: "POST",
110
190
  path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,
111
- json: nestFields({
191
+ json: nestFields2({
112
192
  "requests.0.insertText.text": String(config.text),
113
193
  "requests.0.insertText.location.index": Math.trunc(Number(config.index))
114
194
  })
115
195
  }
116
196
  });
117
197
  }
118
- function nestFields(flat) {
198
+ function nestFields2(flat) {
199
+ const out = {};
200
+ for (const [path, value] of Object.entries(flat)) {
201
+ const parts = path.split(".");
202
+ let node = out;
203
+ while (parts.length > 1) {
204
+ const key = parts.shift();
205
+ const wantsArray = /^\d+$/.test(parts[0] ?? "");
206
+ if (typeof node[key] !== "object" || node[key] === null) node[key] = wantsArray ? [] : {};
207
+ node = node[key];
208
+ }
209
+ node[parts[0]] = value;
210
+ }
211
+ return out;
212
+ }
213
+ var TEXT_REPLACE_OPERATION = "text_replace";
214
+ async function googleDocsTextReplace(options) {
215
+ const config = options.config ?? {};
216
+ if (config.documentId === void 0 || config.documentId === null || config.documentId === "") {
217
+ throw new Error(`text_replace: "documentId" is required (Document ID).`);
218
+ }
219
+ if (config.find === void 0 || config.find === null || config.find === "") {
220
+ throw new Error(`text_replace: "find" is required (Find).`);
221
+ }
222
+ if (config.replaceWith === void 0 || config.replaceWith === null || config.replaceWith === "") {
223
+ throw new Error(`text_replace: "replaceWith" is required (Replace with).`);
224
+ }
225
+ return fancyConnectorCore.callConnector(GOOGLE_DOCS, {
226
+ operation: TEXT_REPLACE_OPERATION,
227
+ config,
228
+ input: options.input,
229
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
230
+ ...options.mode === void 0 ? {} : { mode: options.mode },
231
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
232
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
233
+ ...options.transport === void 0 ? {} : { transport: options.transport },
234
+ request: {
235
+ method: "POST",
236
+ path: `/v1/documents/${encodeURIComponent(String(config.documentId))}:batchUpdate`,
237
+ json: nestFields3({
238
+ "requests.0.replaceAllText.containsText.text": String(config.find),
239
+ "requests.0.replaceAllText.replaceText": String(config.replaceWith),
240
+ ...config.matchCase !== void 0 && config.matchCase !== null && config.matchCase !== "" ? { "requests.0.replaceAllText.containsText.matchCase": Boolean(config.matchCase) } : {},
241
+ ...config.requiredRevisionId !== void 0 && config.requiredRevisionId !== null && config.requiredRevisionId !== "" ? { "writeControl.requiredRevisionId": String(config.requiredRevisionId) } : {}
242
+ })
243
+ }
244
+ });
245
+ }
246
+ function nestFields3(flat) {
119
247
  const out = {};
120
248
  for (const [path, value] of Object.entries(flat)) {
121
249
  const parts = path.split(".");
@@ -132,6 +260,20 @@ function nestFields(flat) {
132
260
  }
133
261
 
134
262
  // src/flow.ts
263
+ var googleDocsBatchUpdateExecutor = async (ctx) => {
264
+ const config = ctx.node.data?.config ?? {};
265
+ const result = await googleDocsBatchUpdate({
266
+ config,
267
+ input: ctx.inputs?.in
268
+ });
269
+ ctx.emit({
270
+ type: "log",
271
+ level: "info",
272
+ nodeId: ctx.node.id,
273
+ message: `google_docs batch_update ${result.data?.id} (${result.mode})`
274
+ });
275
+ return { __port: "out", value: result };
276
+ };
135
277
  var googleDocsDocumentExecutor = async (ctx) => {
136
278
  const config = ctx.node.data?.config ?? {};
137
279
  const result = await googleDocsDocumentCreate({
@@ -160,13 +302,31 @@ var googleDocsTextInsertExecutor = async (ctx) => {
160
302
  });
161
303
  return { __port: "out", value: result };
162
304
  };
305
+ var googleDocsTextReplaceExecutor = async (ctx) => {
306
+ const config = ctx.node.data?.config ?? {};
307
+ const result = await googleDocsTextReplace({
308
+ config,
309
+ input: ctx.inputs?.in
310
+ });
311
+ ctx.emit({
312
+ type: "log",
313
+ level: "info",
314
+ nodeId: ctx.node.id,
315
+ message: `google_docs text_replace ${result.data?.id} (${result.mode})`
316
+ });
317
+ return { __port: "out", value: result };
318
+ };
163
319
  var GOOGLE_DOCS_RUNNABLE_KINDS = [
320
+ { ...googleDocsUi.googleDocsBatchUpdateKind, executor: googleDocsBatchUpdateExecutor },
164
321
  { ...googleDocsUi.googleDocsDocumentKind, executor: googleDocsDocumentExecutor },
165
- { ...googleDocsUi.googleDocsTextInsertKind, executor: googleDocsTextInsertExecutor }
322
+ { ...googleDocsUi.googleDocsTextInsertKind, executor: googleDocsTextInsertExecutor },
323
+ { ...googleDocsUi.googleDocsTextReplaceKind, executor: googleDocsTextReplaceExecutor }
166
324
  ];
167
325
 
168
326
  exports.GOOGLE_DOCS_RUNNABLE_KINDS = GOOGLE_DOCS_RUNNABLE_KINDS;
327
+ exports.googleDocsBatchUpdateExecutor = googleDocsBatchUpdateExecutor;
169
328
  exports.googleDocsDocumentExecutor = googleDocsDocumentExecutor;
170
329
  exports.googleDocsTextInsertExecutor = googleDocsTextInsertExecutor;
330
+ exports.googleDocsTextReplaceExecutor = googleDocsTextReplaceExecutor;
171
331
  //# sourceMappingURL=flow.cjs.map
172
332
  //# sourceMappingURL=flow.cjs.map