@particle-academy/google-docs-ui 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
package/dist/index.cjs CHANGED
@@ -50,11 +50,93 @@ var GOOGLE_DOCS_OAUTH = {
50
50
  "accessTokenCredential": "accessToken",
51
51
  "refreshTokenCredential": "refreshToken",
52
52
  "refreshTokenRotates": false,
53
- "accessTokenTtlSeconds": 3600
53
+ "accessTokenTtlSeconds": 3600,
54
+ "grant": "google",
55
+ "authorizeParams": {
56
+ "access_type": "offline",
57
+ "include_granted_scopes": "true"
58
+ },
59
+ "revoke": {
60
+ "url": "https://oauth2.googleapis.com/revoke",
61
+ "param": "token",
62
+ "scope": "grant"
63
+ },
64
+ "identity": {
65
+ "scope": "openid",
66
+ "claim": "sub",
67
+ "issuers": [
68
+ "https://accounts.google.com",
69
+ "accounts.google.com"
70
+ ],
71
+ "jwksUrl": "https://www.googleapis.com/oauth2/v3/certs",
72
+ "audienceCredential": "clientId"
73
+ },
74
+ "restrictedScopes": []
54
75
  };
55
76
  function googleDocsMeta(role, operation, docs) {
56
77
  return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };
57
78
  }
79
+ var GOOGLE_DOCS_BATCH_UPDATE_KIND = "@particle-academy/google_docs_batch_update";
80
+ var GOOGLE_DOCS_BATCH_UPDATE_OPERATION = "batch_update";
81
+ var GOOGLE_DOCS_BATCH_UPDATE_META = googleDocsMeta("action", "batch update a document", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate");
82
+ var GOOGLE_DOCS_BATCH_UPDATE_OUTPUT = [
83
+ {
84
+ "path": "data.documentId",
85
+ "type": "string",
86
+ "description": "The document updated."
87
+ },
88
+ {
89
+ "path": "data.replies",
90
+ "type": "array",
91
+ "description": "One reply per request, in order. Many kinds reply with an empty object."
92
+ },
93
+ {
94
+ "path": "data.writeControl.requiredRevisionId",
95
+ "type": "string",
96
+ "description": "The document's revision after the update; pass it to the next batch to guard it."
97
+ },
98
+ {
99
+ "path": "mode",
100
+ "type": "string",
101
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
102
+ }
103
+ ];
104
+ var googleDocsBatchUpdateKind = connectors.defineConnectorKind(GOOGLE_DOCS_BATCH_UPDATE_META, {
105
+ name: GOOGLE_DOCS_BATCH_UPDATE_KIND,
106
+ aliases: ["google_docs_batch_update"],
107
+ label: "Batch update a Google Doc",
108
+ description: "Apply a list of Google Doc API requests to a document, all or none.",
109
+ inputs: [{ id: "in" }],
110
+ outputs: [{ id: "out" }],
111
+ sideEffects: "unsafe-to-replay",
112
+ outputShape: GOOGLE_DOCS_BATCH_UPDATE_OUTPUT,
113
+ configSchema: [
114
+ {
115
+ "type": "text",
116
+ "key": "documentId",
117
+ "label": "Document ID",
118
+ "required": true,
119
+ "description": "From document_create's data.documentId, or the id in the document's own URL."
120
+ },
121
+ {
122
+ "type": "json",
123
+ "key": "requests",
124
+ "label": "Requests",
125
+ "required": true,
126
+ "description": `Google's Request objects, in order. Example: [{"replaceAllText":{"containsText":{"text":"{{name}}","matchCase":true},"replaceText":"Ada"}}].`
127
+ },
128
+ {
129
+ "type": "text",
130
+ "key": "requiredRevisionId",
131
+ "label": "Required revision ID",
132
+ "description": "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."
133
+ }
134
+ ],
135
+ defaultConfig: {
136
+ "mode": "auto"
137
+ },
138
+ renderBody: ({ config }) => connectors.summarize(GOOGLE_DOCS_BATCH_UPDATE_META, config, "batch update a document")
139
+ });
58
140
  var GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
59
141
  var GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
60
142
  var GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta("action", "create a blank document", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create");
@@ -152,14 +234,100 @@ var googleDocsTextInsertKind = connectors.defineConnectorKind(GOOGLE_DOCS_TEXT_I
152
234
  },
153
235
  renderBody: ({ config }) => connectors.summarize(GOOGLE_DOCS_TEXT_INSERT_META, config, "insert text")
154
236
  });
237
+ var GOOGLE_DOCS_TEXT_REPLACE_KIND = "@particle-academy/google_docs_text_replace";
238
+ var GOOGLE_DOCS_TEXT_REPLACE_OPERATION = "text_replace";
239
+ var GOOGLE_DOCS_TEXT_REPLACE_META = googleDocsMeta("action", "replace text", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate");
240
+ var GOOGLE_DOCS_TEXT_REPLACE_OUTPUT = [
241
+ {
242
+ "path": "data.documentId",
243
+ "type": "string",
244
+ "description": "The document updated."
245
+ },
246
+ {
247
+ "path": "data.replies",
248
+ "type": "array",
249
+ "description": "One reply."
250
+ },
251
+ {
252
+ "path": "data.replies.0.replaceAllText.occurrencesChanged",
253
+ "type": "number",
254
+ "description": "How many occurrences were replaced. 0 means the text was not found, which is not an error."
255
+ },
256
+ {
257
+ "path": "data.writeControl.requiredRevisionId",
258
+ "type": "string",
259
+ "description": "The document's revision after the update."
260
+ },
261
+ {
262
+ "path": "mode",
263
+ "type": "string",
264
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
265
+ }
266
+ ];
267
+ var googleDocsTextReplaceKind = connectors.defineConnectorKind(GOOGLE_DOCS_TEXT_REPLACE_META, {
268
+ name: GOOGLE_DOCS_TEXT_REPLACE_KIND,
269
+ aliases: ["google_docs_text_replace"],
270
+ label: "Replace text in a Google Doc",
271
+ description: "Replace every occurrence of a string in a document.",
272
+ inputs: [{ id: "in" }],
273
+ outputs: [{ id: "out" }],
274
+ sideEffects: "unsafe-to-replay",
275
+ outputShape: GOOGLE_DOCS_TEXT_REPLACE_OUTPUT,
276
+ configSchema: [
277
+ {
278
+ "type": "text",
279
+ "key": "documentId",
280
+ "label": "Document ID",
281
+ "required": true,
282
+ "description": "From document_create's data.documentId, or the id in the document's own URL."
283
+ },
284
+ {
285
+ "type": "text",
286
+ "key": "find",
287
+ "label": "Find",
288
+ "required": true,
289
+ "description": "The exact text to find, e.g. {{name}}. Not a regular expression."
290
+ },
291
+ {
292
+ "type": "textarea",
293
+ "key": "replaceWith",
294
+ "label": "Replace with",
295
+ "required": true,
296
+ "description": "Inserted in place of every match. Empty is refused: to delete text, use batch_update."
297
+ },
298
+ {
299
+ "type": "switch",
300
+ "key": "matchCase",
301
+ "label": "Match case",
302
+ "default": false,
303
+ "description": "Off matches case-insensitively, which is also what Google does when it is not sent."
304
+ },
305
+ {
306
+ "type": "text",
307
+ "key": "requiredRevisionId",
308
+ "label": "Required revision ID",
309
+ "description": "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."
310
+ }
311
+ ],
312
+ defaultConfig: {
313
+ "mode": "auto"
314
+ },
315
+ renderBody: ({ config }) => connectors.summarize(GOOGLE_DOCS_TEXT_REPLACE_META, config, "replace text")
316
+ });
155
317
 
156
318
  // src/index.ts
157
319
  var GOOGLE_DOCS_KINDS = [
320
+ googleDocsBatchUpdateKind,
158
321
  googleDocsDocumentKind,
159
- googleDocsTextInsertKind
322
+ googleDocsTextInsertKind,
323
+ googleDocsTextReplaceKind
160
324
  ];
161
325
 
162
326
  exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
327
+ exports.GOOGLE_DOCS_BATCH_UPDATE_KIND = GOOGLE_DOCS_BATCH_UPDATE_KIND;
328
+ exports.GOOGLE_DOCS_BATCH_UPDATE_META = GOOGLE_DOCS_BATCH_UPDATE_META;
329
+ exports.GOOGLE_DOCS_BATCH_UPDATE_OPERATION = GOOGLE_DOCS_BATCH_UPDATE_OPERATION;
330
+ exports.GOOGLE_DOCS_BATCH_UPDATE_OUTPUT = GOOGLE_DOCS_BATCH_UPDATE_OUTPUT;
163
331
  exports.GOOGLE_DOCS_CREDENTIALS = GOOGLE_DOCS_CREDENTIALS;
164
332
  exports.GOOGLE_DOCS_DOCUMENT_KIND = GOOGLE_DOCS_DOCUMENT_KIND;
165
333
  exports.GOOGLE_DOCS_DOCUMENT_META = GOOGLE_DOCS_DOCUMENT_META;
@@ -172,8 +340,14 @@ exports.GOOGLE_DOCS_TEXT_INSERT_KIND = GOOGLE_DOCS_TEXT_INSERT_KIND;
172
340
  exports.GOOGLE_DOCS_TEXT_INSERT_META = GOOGLE_DOCS_TEXT_INSERT_META;
173
341
  exports.GOOGLE_DOCS_TEXT_INSERT_OPERATION = GOOGLE_DOCS_TEXT_INSERT_OPERATION;
174
342
  exports.GOOGLE_DOCS_TEXT_INSERT_OUTPUT = GOOGLE_DOCS_TEXT_INSERT_OUTPUT;
343
+ exports.GOOGLE_DOCS_TEXT_REPLACE_KIND = GOOGLE_DOCS_TEXT_REPLACE_KIND;
344
+ exports.GOOGLE_DOCS_TEXT_REPLACE_META = GOOGLE_DOCS_TEXT_REPLACE_META;
345
+ exports.GOOGLE_DOCS_TEXT_REPLACE_OPERATION = GOOGLE_DOCS_TEXT_REPLACE_OPERATION;
346
+ exports.GOOGLE_DOCS_TEXT_REPLACE_OUTPUT = GOOGLE_DOCS_TEXT_REPLACE_OUTPUT;
347
+ exports.googleDocsBatchUpdateKind = googleDocsBatchUpdateKind;
175
348
  exports.googleDocsDocumentKind = googleDocsDocumentKind;
176
349
  exports.googleDocsMeta = googleDocsMeta;
177
350
  exports.googleDocsTextInsertKind = googleDocsTextInsertKind;
351
+ exports.googleDocsTextReplaceKind = googleDocsTextReplaceKind;
178
352
  //# sourceMappingURL=index.cjs.map
179
353
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service.ts","../src/kinds/document-create.ts","../src/kinds/text-insert.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS,aAAA;AAAA,EACT,YAAA,EAAc,aAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,uBAAA,GAA0B;AAAA,EACrC;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS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AA,EAAI,MAAM,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,EAAE,EAAA,EAAI,OAAO,CAAA;AAAA,EACvB,WAAA,EAAa,kBAAA;AAAA,EACb,WAAA,EAAa,8BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,YAAA;AAAA,MACP,OAAA,EAAS,aAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,UAAA;AAAA,MACR,KAAA,EAAO,MAAA;AAAA,MACP,OAAA,EAAS,MAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,QAAA;AAAA,MACR,KAAA,EAAO,OAAA;AAAA,MACP,OAAA,EAAS,iBAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,SAAA,EAAW,CAAA;AAAA,MACX,KAAA,EAAO,CAAA;AAAA,MACP,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAAA,CAAU,4BAAA,EAA8B,QAAmC,aAAa;AAC5F,CAAC;;;AClEM,IAAM,iBAAA,GAA0C;AAAA,EACrD,sBAAA;AAAA,EACA;AACF","file":"index.cjs","sourcesContent":["/**\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's identity on the authoring surface, shared by every Google Docs\n * node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\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 { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_DOCS_SERVICE = {\n service: \"google_docs\",\n serviceTitle: \"Google Docs\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Google Docs connection holds. */\nexport const GOOGLE_DOCS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Docs requires — DECLARED here, performed by the\n * host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n */\nexport const GOOGLE_DOCS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/documents\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Docs node's connector metadata from the operation it performs. */\nexport function googleDocsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };\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 * Google Docs document — Create a blank Google Docs document.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_DOCUMENT_KIND = \"@particle-academy/google_docs_document\";\nexport const GOOGLE_DOCS_DOCUMENT_OPERATION = \"document_create\";\n\nexport const GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta(\"action\", \"create a blank document\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The id of the created document.\"\n },\n {\n \"path\": \"data.title\",\n \"type\": \"string\",\n \"description\": \"The title Google stored.\"\n }\n];\n\nexport const googleDocsDocumentKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {\n name: GOOGLE_DOCS_DOCUMENT_KIND,\n aliases: [\"google_docs_document\"],\n label: \"Google Docs document\",\n description: \"Create a blank Google Docs document.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_DOCUMENT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"title\",\n \"label\": \"Title\",\n \"required\": true,\n \"description\": \"The title of the new blank document.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_DOCUMENT_META, config as Record<string, unknown>, \"create a blank document\"),\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 text into a Google Doc — Insert plain text at a position in an\n * existing document's body.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_KIND = \"@particle-academy/google_docs_text_insert\";\nexport const GOOGLE_DOCS_TEXT_INSERT_OPERATION = \"text_insert\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_META = googleDocsMeta(\"action\", \"insert text\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"Echoes what was sent.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One entry per request sent -- one here. insertText's own reply carries nothing; the array is present and empty-shaped rather than a usable result.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsTextInsertKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META, {\n name: GOOGLE_DOCS_TEXT_INSERT_KIND,\n aliases: [\"google_docs_text_insert\"],\n label: \"Insert text into a Google Doc\",\n description: \"Insert plain text at a position in an existing document's body.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_TEXT_INSERT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"text\",\n \"label\": \"Text\",\n \"required\": true,\n \"description\": \"Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in.\"\n },\n {\n \"type\": \"number\",\n \"key\": \"index\",\n \"label\": \"Insert at index\",\n \"required\": true,\n \"default\": 1,\n \"min\": 1,\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_TEXT_INSERT_META, config as Record<string, unknown>, \"insert text\"),\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's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/document-create.js\";\nexport * from \"./kinds/text-insert.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDocsDocumentKind } from \"./kinds/document-create.js\";\nimport { googleDocsTextInsertKind } from \"./kinds/text-insert.js\";\n\n/** Every Google Docs kind, for a host that registers the lot. */\nexport const GOOGLE_DOCS_KINDS: NodeKindDefinition[] = [\n googleDocsDocumentKind,\n googleDocsTextInsertKind,\n];\n"]}
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/batch-update.ts","../src/kinds/document-create.ts","../src/kinds/text-insert.ts","../src/kinds/text-replace.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS,aAAA;AAAA,EACT,YAAA,EAAc,aAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,uBAAA,GAA0B;AAAA,EACrC;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,eAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA;AAEZ;AA2BO,IAAM,iBAAA,GAAoB;AAAA,EAC/B,MAAA,EAAQ,oBAAA;AAAA,EACR,cAAA,EAAgB,8CAAA;AAAA,EAChB,UAAA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AA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,YAAA;AAAA,MACP,OAAA,EAAS,aAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,MAAA;AAAA,MACP,OAAA,EAAS,MAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,UAAA;AAAA,MACR,KAAA,EAAO,aAAA;AAAA,MACP,OAAA,EAAS,cAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,QAAA;AAAA,MACR,KAAA,EAAO,WAAA;AAAA,MACP,OAAA,EAAS,YAAA;AAAA,MACT,SAAA,EAAW,KAAA;AAAA,MACX,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,oBAAA;AAAA,MACP,OAAA,EAAS,sBAAA;AAAA,MACT,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAAA,CAAU,6BAAA,EAA+B,QAAmC,cAAc;AAC9F,CAAC;;;ACnFM,IAAM,iBAAA,GAA0C;AAAA,EACrD,yBAAA;AAAA,EACA,sBAAA;AAAA,EACA,wBAAA;AAAA,EACA;AACF","file":"index.cjs","sourcesContent":["/**\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's identity on the authoring surface, shared by every Google Docs\n * node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\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 { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_DOCS_SERVICE = {\n service: \"google_docs\",\n serviceTitle: \"Google Docs\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Google Docs connection holds. */\nexport const GOOGLE_DOCS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Docs requires — DECLARED here, performed by the\n * host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n *\n * Its consent grant is SHARED with every connector declaring grant \"google\":\n * one OAuth client, one consent and one refresh token per person, scopes added\n * as features are first used (authorizeParams). Revoking removes the WHOLE\n * grant, so only a full disconnect revokes; a per-feature disconnect stops\n * using the scope locally. Identify the account by the id_token's sub, never\n * by email.\n */\nexport const GOOGLE_DOCS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/documents\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600,\n \"grant\": \"google\",\n \"authorizeParams\": {\n \"access_type\": \"offline\",\n \"include_granted_scopes\": \"true\"\n },\n \"revoke\": {\n \"url\": \"https://oauth2.googleapis.com/revoke\",\n \"param\": \"token\",\n \"scope\": \"grant\"\n },\n \"identity\": {\n \"scope\": \"openid\",\n \"claim\": \"sub\",\n \"issuers\": [\n \"https://accounts.google.com\",\n \"accounts.google.com\"\n ],\n \"jwksUrl\": \"https://www.googleapis.com/oauth2/v3/certs\",\n \"audienceCredential\": \"clientId\"\n },\n \"restrictedScopes\": []\n} as const;\n\n/** Build a Google Docs node's connector metadata from the operation it performs. */\nexport function googleDocsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };\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 * Batch update a Google Doc — Apply a list of Google Doc API requests to a\n * document, all or none.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_BATCH_UPDATE_KIND = \"@particle-academy/google_docs_batch_update\";\nexport const GOOGLE_DOCS_BATCH_UPDATE_OPERATION = \"batch_update\";\n\nexport const GOOGLE_DOCS_BATCH_UPDATE_META = googleDocsMeta(\"action\", \"batch update a document\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_BATCH_UPDATE_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The document updated.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One reply per request, in order. Many kinds reply with an empty object.\"\n },\n {\n \"path\": \"data.writeControl.requiredRevisionId\",\n \"type\": \"string\",\n \"description\": \"The document's revision after the update; pass it to the next batch to guard it.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsBatchUpdateKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_BATCH_UPDATE_META, {\n name: GOOGLE_DOCS_BATCH_UPDATE_KIND,\n aliases: [\"google_docs_batch_update\"],\n label: \"Batch update a Google Doc\",\n description: \"Apply a list of Google Doc API requests to a document, all or none.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_BATCH_UPDATE_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"json\",\n \"key\": \"requests\",\n \"label\": \"Requests\",\n \"required\": true,\n \"description\": \"Google's Request objects, in order. Example: [{\\\"replaceAllText\\\":{\\\"containsText\\\":{\\\"text\\\":\\\"{{name}}\\\",\\\"matchCase\\\":true},\\\"replaceText\\\":\\\"Ada\\\"}}].\"\n },\n {\n \"type\": \"text\",\n \"key\": \"requiredRevisionId\",\n \"label\": \"Required revision ID\",\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_BATCH_UPDATE_META, config as Record<string, unknown>, \"batch update a document\"),\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 * Google Docs document — Create a blank Google Docs document.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_DOCUMENT_KIND = \"@particle-academy/google_docs_document\";\nexport const GOOGLE_DOCS_DOCUMENT_OPERATION = \"document_create\";\n\nexport const GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta(\"action\", \"create a blank document\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The id of the created document.\"\n },\n {\n \"path\": \"data.title\",\n \"type\": \"string\",\n \"description\": \"The title Google stored.\"\n }\n];\n\nexport const googleDocsDocumentKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {\n name: GOOGLE_DOCS_DOCUMENT_KIND,\n aliases: [\"google_docs_document\"],\n label: \"Google Docs document\",\n description: \"Create a blank Google Docs document.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_DOCUMENT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"title\",\n \"label\": \"Title\",\n \"required\": true,\n \"description\": \"The title of the new blank document.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_DOCUMENT_META, config as Record<string, unknown>, \"create a blank document\"),\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 text into a Google Doc — Insert plain text at a position in an\n * existing document's body.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_KIND = \"@particle-academy/google_docs_text_insert\";\nexport const GOOGLE_DOCS_TEXT_INSERT_OPERATION = \"text_insert\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_META = googleDocsMeta(\"action\", \"insert text\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"Echoes what was sent.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One entry per request sent -- one here. insertText's own reply carries nothing; the array is present and empty-shaped rather than a usable result.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsTextInsertKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META, {\n name: GOOGLE_DOCS_TEXT_INSERT_KIND,\n aliases: [\"google_docs_text_insert\"],\n label: \"Insert text into a Google Doc\",\n description: \"Insert plain text at a position in an existing document's body.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_TEXT_INSERT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"text\",\n \"label\": \"Text\",\n \"required\": true,\n \"description\": \"Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in.\"\n },\n {\n \"type\": \"number\",\n \"key\": \"index\",\n \"label\": \"Insert at index\",\n \"required\": true,\n \"default\": 1,\n \"min\": 1,\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_TEXT_INSERT_META, config as Record<string, unknown>, \"insert text\"),\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 text in a Google Doc — Replace every occurrence of a string in a\n * document.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_TEXT_REPLACE_KIND = \"@particle-academy/google_docs_text_replace\";\nexport const GOOGLE_DOCS_TEXT_REPLACE_OPERATION = \"text_replace\";\n\nexport const GOOGLE_DOCS_TEXT_REPLACE_META = googleDocsMeta(\"action\", \"replace text\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_TEXT_REPLACE_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The document updated.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One reply.\"\n },\n {\n \"path\": \"data.replies.0.replaceAllText.occurrencesChanged\",\n \"type\": \"number\",\n \"description\": \"How many occurrences were replaced. 0 means the text was not found, which is not an error.\"\n },\n {\n \"path\": \"data.writeControl.requiredRevisionId\",\n \"type\": \"string\",\n \"description\": \"The document's revision after the update.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsTextReplaceKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_TEXT_REPLACE_META, {\n name: GOOGLE_DOCS_TEXT_REPLACE_KIND,\n aliases: [\"google_docs_text_replace\"],\n label: \"Replace text in a Google Doc\",\n description: \"Replace every occurrence of a string in a document.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_TEXT_REPLACE_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"find\",\n \"label\": \"Find\",\n \"required\": true,\n \"description\": \"The exact text to find, e.g. {{name}}. Not a regular expression.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"replaceWith\",\n \"label\": \"Replace with\",\n \"required\": true,\n \"description\": \"Inserted in place of every match. Empty is refused: to delete text, use batch_update.\"\n },\n {\n \"type\": \"switch\",\n \"key\": \"matchCase\",\n \"label\": \"Match case\",\n \"default\": false,\n \"description\": \"Off matches case-insensitively, which is also what Google does when it is not sent.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"requiredRevisionId\",\n \"label\": \"Required revision ID\",\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_TEXT_REPLACE_META, config as Record<string, unknown>, \"replace text\"),\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's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/batch-update.js\";\nexport * from \"./kinds/document-create.js\";\nexport * from \"./kinds/text-insert.js\";\nexport * from \"./kinds/text-replace.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDocsBatchUpdateKind } from \"./kinds/batch-update.js\";\nimport { googleDocsDocumentKind } from \"./kinds/document-create.js\";\nimport { googleDocsTextInsertKind } from \"./kinds/text-insert.js\";\nimport { googleDocsTextReplaceKind } from \"./kinds/text-replace.js\";\n\n/** Every Google Docs kind, for a host that registers the lot. */\nexport const GOOGLE_DOCS_KINDS: NodeKindDefinition[] = [\n googleDocsBatchUpdateKind,\n googleDocsDocumentKind,\n googleDocsTextInsertKind,\n googleDocsTextReplaceKind,\n];\n"]}
package/dist/index.d.cts CHANGED
@@ -84,6 +84,13 @@ declare const GOOGLE_DOCS_CREDENTIALS: readonly [{
84
84
  * safely be retried and may run concurrently. That is stated rather than
85
85
  * assumed because the opposite — a provider that spends the token and revokes
86
86
  * the grant on a replay — looks identical until it happens.
87
+ *
88
+ * Its consent grant is SHARED with every connector declaring grant "google":
89
+ * one OAuth client, one consent and one refresh token per person, scopes added
90
+ * as features are first used (authorizeParams). Revoking removes the WHOLE
91
+ * grant, so only a full disconnect revokes; a per-feature disconnect stops
92
+ * using the scope locally. Identify the account by the id_token's sub, never
93
+ * by email.
87
94
  */
88
95
  declare const GOOGLE_DOCS_OAUTH: {
89
96
  readonly flow: "authorization_code";
@@ -94,10 +101,42 @@ declare const GOOGLE_DOCS_OAUTH: {
94
101
  readonly refreshTokenCredential: "refreshToken";
95
102
  readonly refreshTokenRotates: false;
96
103
  readonly accessTokenTtlSeconds: 3600;
104
+ readonly grant: "google";
105
+ readonly authorizeParams: {
106
+ readonly access_type: "offline";
107
+ readonly include_granted_scopes: "true";
108
+ };
109
+ readonly revoke: {
110
+ readonly url: "https://oauth2.googleapis.com/revoke";
111
+ readonly param: "token";
112
+ readonly scope: "grant";
113
+ };
114
+ readonly identity: {
115
+ readonly scope: "openid";
116
+ readonly claim: "sub";
117
+ readonly issuers: readonly ["https://accounts.google.com", "accounts.google.com"];
118
+ readonly jwksUrl: "https://www.googleapis.com/oauth2/v3/certs";
119
+ readonly audienceCredential: "clientId";
120
+ };
121
+ readonly restrictedScopes: readonly [];
97
122
  };
98
123
  /** Build a Google Docs node's connector metadata from the operation it performs. */
99
124
  declare function googleDocsMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
100
125
 
126
+ declare const GOOGLE_DOCS_BATCH_UPDATE_KIND = "@particle-academy/google_docs_batch_update";
127
+ declare const GOOGLE_DOCS_BATCH_UPDATE_OPERATION = "batch_update";
128
+ declare const GOOGLE_DOCS_BATCH_UPDATE_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
129
+ /**
130
+ * What this node emits — the "ingredients" a downstream node can reference.
131
+ *
132
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
133
+ * picker, so declaring it is the whole of the work: an author configuring the
134
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
135
+ * and hoping.
136
+ */
137
+ declare const GOOGLE_DOCS_BATCH_UPDATE_OUTPUT: OutputField[];
138
+ declare const googleDocsBatchUpdateKind: NodeKindDefinition;
139
+
101
140
  declare const GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
102
141
  declare const GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
103
142
  declare const GOOGLE_DOCS_DOCUMENT_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
@@ -126,6 +165,20 @@ declare const GOOGLE_DOCS_TEXT_INSERT_META: _particle_academy_fancy_flow_connect
126
165
  declare const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[];
127
166
  declare const googleDocsTextInsertKind: NodeKindDefinition;
128
167
 
168
+ declare const GOOGLE_DOCS_TEXT_REPLACE_KIND = "@particle-academy/google_docs_text_replace";
169
+ declare const GOOGLE_DOCS_TEXT_REPLACE_OPERATION = "text_replace";
170
+ declare const GOOGLE_DOCS_TEXT_REPLACE_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
171
+ /**
172
+ * What this node emits — the "ingredients" a downstream node can reference.
173
+ *
174
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
175
+ * picker, so declaring it is the whole of the work: an author configuring the
176
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
177
+ * and hoping.
178
+ */
179
+ declare const GOOGLE_DOCS_TEXT_REPLACE_OUTPUT: OutputField[];
180
+ declare const googleDocsTextReplaceKind: NodeKindDefinition;
181
+
129
182
  /**
130
183
  * GENERATED FILE — do not edit.
131
184
  *
@@ -147,4 +200,4 @@ declare const googleDocsTextInsertKind: NodeKindDefinition;
147
200
  /** Every Google Docs kind, for a host that registers the lot. */
148
201
  declare const GOOGLE_DOCS_KINDS: NodeKindDefinition[];
149
202
 
150
- export { CONNECTOR_API_VERSION, GOOGLE_DOCS_CREDENTIALS, GOOGLE_DOCS_DOCUMENT_KIND, GOOGLE_DOCS_DOCUMENT_META, GOOGLE_DOCS_DOCUMENT_OPERATION, GOOGLE_DOCS_DOCUMENT_OUTPUT, GOOGLE_DOCS_KINDS, GOOGLE_DOCS_OAUTH, GOOGLE_DOCS_SERVICE, GOOGLE_DOCS_TEXT_INSERT_KIND, GOOGLE_DOCS_TEXT_INSERT_META, GOOGLE_DOCS_TEXT_INSERT_OPERATION, GOOGLE_DOCS_TEXT_INSERT_OUTPUT, googleDocsDocumentKind, googleDocsMeta, googleDocsTextInsertKind };
203
+ export { CONNECTOR_API_VERSION, GOOGLE_DOCS_BATCH_UPDATE_KIND, GOOGLE_DOCS_BATCH_UPDATE_META, GOOGLE_DOCS_BATCH_UPDATE_OPERATION, GOOGLE_DOCS_BATCH_UPDATE_OUTPUT, GOOGLE_DOCS_CREDENTIALS, GOOGLE_DOCS_DOCUMENT_KIND, GOOGLE_DOCS_DOCUMENT_META, GOOGLE_DOCS_DOCUMENT_OPERATION, GOOGLE_DOCS_DOCUMENT_OUTPUT, GOOGLE_DOCS_KINDS, GOOGLE_DOCS_OAUTH, GOOGLE_DOCS_SERVICE, GOOGLE_DOCS_TEXT_INSERT_KIND, GOOGLE_DOCS_TEXT_INSERT_META, GOOGLE_DOCS_TEXT_INSERT_OPERATION, GOOGLE_DOCS_TEXT_INSERT_OUTPUT, GOOGLE_DOCS_TEXT_REPLACE_KIND, GOOGLE_DOCS_TEXT_REPLACE_META, GOOGLE_DOCS_TEXT_REPLACE_OPERATION, GOOGLE_DOCS_TEXT_REPLACE_OUTPUT, googleDocsBatchUpdateKind, googleDocsDocumentKind, googleDocsMeta, googleDocsTextInsertKind, googleDocsTextReplaceKind };
package/dist/index.d.ts CHANGED
@@ -84,6 +84,13 @@ declare const GOOGLE_DOCS_CREDENTIALS: readonly [{
84
84
  * safely be retried and may run concurrently. That is stated rather than
85
85
  * assumed because the opposite — a provider that spends the token and revokes
86
86
  * the grant on a replay — looks identical until it happens.
87
+ *
88
+ * Its consent grant is SHARED with every connector declaring grant "google":
89
+ * one OAuth client, one consent and one refresh token per person, scopes added
90
+ * as features are first used (authorizeParams). Revoking removes the WHOLE
91
+ * grant, so only a full disconnect revokes; a per-feature disconnect stops
92
+ * using the scope locally. Identify the account by the id_token's sub, never
93
+ * by email.
87
94
  */
88
95
  declare const GOOGLE_DOCS_OAUTH: {
89
96
  readonly flow: "authorization_code";
@@ -94,10 +101,42 @@ declare const GOOGLE_DOCS_OAUTH: {
94
101
  readonly refreshTokenCredential: "refreshToken";
95
102
  readonly refreshTokenRotates: false;
96
103
  readonly accessTokenTtlSeconds: 3600;
104
+ readonly grant: "google";
105
+ readonly authorizeParams: {
106
+ readonly access_type: "offline";
107
+ readonly include_granted_scopes: "true";
108
+ };
109
+ readonly revoke: {
110
+ readonly url: "https://oauth2.googleapis.com/revoke";
111
+ readonly param: "token";
112
+ readonly scope: "grant";
113
+ };
114
+ readonly identity: {
115
+ readonly scope: "openid";
116
+ readonly claim: "sub";
117
+ readonly issuers: readonly ["https://accounts.google.com", "accounts.google.com"];
118
+ readonly jwksUrl: "https://www.googleapis.com/oauth2/v3/certs";
119
+ readonly audienceCredential: "clientId";
120
+ };
121
+ readonly restrictedScopes: readonly [];
97
122
  };
98
123
  /** Build a Google Docs node's connector metadata from the operation it performs. */
99
124
  declare function googleDocsMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
100
125
 
126
+ declare const GOOGLE_DOCS_BATCH_UPDATE_KIND = "@particle-academy/google_docs_batch_update";
127
+ declare const GOOGLE_DOCS_BATCH_UPDATE_OPERATION = "batch_update";
128
+ declare const GOOGLE_DOCS_BATCH_UPDATE_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
129
+ /**
130
+ * What this node emits — the "ingredients" a downstream node can reference.
131
+ *
132
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
133
+ * picker, so declaring it is the whole of the work: an author configuring the
134
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
135
+ * and hoping.
136
+ */
137
+ declare const GOOGLE_DOCS_BATCH_UPDATE_OUTPUT: OutputField[];
138
+ declare const googleDocsBatchUpdateKind: NodeKindDefinition;
139
+
101
140
  declare const GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
102
141
  declare const GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
103
142
  declare const GOOGLE_DOCS_DOCUMENT_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
@@ -126,6 +165,20 @@ declare const GOOGLE_DOCS_TEXT_INSERT_META: _particle_academy_fancy_flow_connect
126
165
  declare const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[];
127
166
  declare const googleDocsTextInsertKind: NodeKindDefinition;
128
167
 
168
+ declare const GOOGLE_DOCS_TEXT_REPLACE_KIND = "@particle-academy/google_docs_text_replace";
169
+ declare const GOOGLE_DOCS_TEXT_REPLACE_OPERATION = "text_replace";
170
+ declare const GOOGLE_DOCS_TEXT_REPLACE_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
171
+ /**
172
+ * What this node emits — the "ingredients" a downstream node can reference.
173
+ *
174
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
175
+ * picker, so declaring it is the whole of the work: an author configuring the
176
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
177
+ * and hoping.
178
+ */
179
+ declare const GOOGLE_DOCS_TEXT_REPLACE_OUTPUT: OutputField[];
180
+ declare const googleDocsTextReplaceKind: NodeKindDefinition;
181
+
129
182
  /**
130
183
  * GENERATED FILE — do not edit.
131
184
  *
@@ -147,4 +200,4 @@ declare const googleDocsTextInsertKind: NodeKindDefinition;
147
200
  /** Every Google Docs kind, for a host that registers the lot. */
148
201
  declare const GOOGLE_DOCS_KINDS: NodeKindDefinition[];
149
202
 
150
- export { CONNECTOR_API_VERSION, GOOGLE_DOCS_CREDENTIALS, GOOGLE_DOCS_DOCUMENT_KIND, GOOGLE_DOCS_DOCUMENT_META, GOOGLE_DOCS_DOCUMENT_OPERATION, GOOGLE_DOCS_DOCUMENT_OUTPUT, GOOGLE_DOCS_KINDS, GOOGLE_DOCS_OAUTH, GOOGLE_DOCS_SERVICE, GOOGLE_DOCS_TEXT_INSERT_KIND, GOOGLE_DOCS_TEXT_INSERT_META, GOOGLE_DOCS_TEXT_INSERT_OPERATION, GOOGLE_DOCS_TEXT_INSERT_OUTPUT, googleDocsDocumentKind, googleDocsMeta, googleDocsTextInsertKind };
203
+ export { CONNECTOR_API_VERSION, GOOGLE_DOCS_BATCH_UPDATE_KIND, GOOGLE_DOCS_BATCH_UPDATE_META, GOOGLE_DOCS_BATCH_UPDATE_OPERATION, GOOGLE_DOCS_BATCH_UPDATE_OUTPUT, GOOGLE_DOCS_CREDENTIALS, GOOGLE_DOCS_DOCUMENT_KIND, GOOGLE_DOCS_DOCUMENT_META, GOOGLE_DOCS_DOCUMENT_OPERATION, GOOGLE_DOCS_DOCUMENT_OUTPUT, GOOGLE_DOCS_KINDS, GOOGLE_DOCS_OAUTH, GOOGLE_DOCS_SERVICE, GOOGLE_DOCS_TEXT_INSERT_KIND, GOOGLE_DOCS_TEXT_INSERT_META, GOOGLE_DOCS_TEXT_INSERT_OPERATION, GOOGLE_DOCS_TEXT_INSERT_OUTPUT, GOOGLE_DOCS_TEXT_REPLACE_KIND, GOOGLE_DOCS_TEXT_REPLACE_META, GOOGLE_DOCS_TEXT_REPLACE_OPERATION, GOOGLE_DOCS_TEXT_REPLACE_OUTPUT, googleDocsBatchUpdateKind, googleDocsDocumentKind, googleDocsMeta, googleDocsTextInsertKind, googleDocsTextReplaceKind };
package/dist/index.js CHANGED
@@ -48,11 +48,93 @@ var GOOGLE_DOCS_OAUTH = {
48
48
  "accessTokenCredential": "accessToken",
49
49
  "refreshTokenCredential": "refreshToken",
50
50
  "refreshTokenRotates": false,
51
- "accessTokenTtlSeconds": 3600
51
+ "accessTokenTtlSeconds": 3600,
52
+ "grant": "google",
53
+ "authorizeParams": {
54
+ "access_type": "offline",
55
+ "include_granted_scopes": "true"
56
+ },
57
+ "revoke": {
58
+ "url": "https://oauth2.googleapis.com/revoke",
59
+ "param": "token",
60
+ "scope": "grant"
61
+ },
62
+ "identity": {
63
+ "scope": "openid",
64
+ "claim": "sub",
65
+ "issuers": [
66
+ "https://accounts.google.com",
67
+ "accounts.google.com"
68
+ ],
69
+ "jwksUrl": "https://www.googleapis.com/oauth2/v3/certs",
70
+ "audienceCredential": "clientId"
71
+ },
72
+ "restrictedScopes": []
52
73
  };
53
74
  function googleDocsMeta(role, operation, docs) {
54
75
  return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };
55
76
  }
77
+ var GOOGLE_DOCS_BATCH_UPDATE_KIND = "@particle-academy/google_docs_batch_update";
78
+ var GOOGLE_DOCS_BATCH_UPDATE_OPERATION = "batch_update";
79
+ var GOOGLE_DOCS_BATCH_UPDATE_META = googleDocsMeta("action", "batch update a document", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate");
80
+ var GOOGLE_DOCS_BATCH_UPDATE_OUTPUT = [
81
+ {
82
+ "path": "data.documentId",
83
+ "type": "string",
84
+ "description": "The document updated."
85
+ },
86
+ {
87
+ "path": "data.replies",
88
+ "type": "array",
89
+ "description": "One reply per request, in order. Many kinds reply with an empty object."
90
+ },
91
+ {
92
+ "path": "data.writeControl.requiredRevisionId",
93
+ "type": "string",
94
+ "description": "The document's revision after the update; pass it to the next batch to guard it."
95
+ },
96
+ {
97
+ "path": "mode",
98
+ "type": "string",
99
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
100
+ }
101
+ ];
102
+ var googleDocsBatchUpdateKind = defineConnectorKind(GOOGLE_DOCS_BATCH_UPDATE_META, {
103
+ name: GOOGLE_DOCS_BATCH_UPDATE_KIND,
104
+ aliases: ["google_docs_batch_update"],
105
+ label: "Batch update a Google Doc",
106
+ description: "Apply a list of Google Doc API requests to a document, all or none.",
107
+ inputs: [{ id: "in" }],
108
+ outputs: [{ id: "out" }],
109
+ sideEffects: "unsafe-to-replay",
110
+ outputShape: GOOGLE_DOCS_BATCH_UPDATE_OUTPUT,
111
+ configSchema: [
112
+ {
113
+ "type": "text",
114
+ "key": "documentId",
115
+ "label": "Document ID",
116
+ "required": true,
117
+ "description": "From document_create's data.documentId, or the id in the document's own URL."
118
+ },
119
+ {
120
+ "type": "json",
121
+ "key": "requests",
122
+ "label": "Requests",
123
+ "required": true,
124
+ "description": `Google's Request objects, in order. Example: [{"replaceAllText":{"containsText":{"text":"{{name}}","matchCase":true},"replaceText":"Ada"}}].`
125
+ },
126
+ {
127
+ "type": "text",
128
+ "key": "requiredRevisionId",
129
+ "label": "Required revision ID",
130
+ "description": "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."
131
+ }
132
+ ],
133
+ defaultConfig: {
134
+ "mode": "auto"
135
+ },
136
+ renderBody: ({ config }) => summarize(GOOGLE_DOCS_BATCH_UPDATE_META, config, "batch update a document")
137
+ });
56
138
  var GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
57
139
  var GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
58
140
  var GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta("action", "create a blank document", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create");
@@ -150,13 +232,95 @@ var googleDocsTextInsertKind = defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META,
150
232
  },
151
233
  renderBody: ({ config }) => summarize(GOOGLE_DOCS_TEXT_INSERT_META, config, "insert text")
152
234
  });
235
+ var GOOGLE_DOCS_TEXT_REPLACE_KIND = "@particle-academy/google_docs_text_replace";
236
+ var GOOGLE_DOCS_TEXT_REPLACE_OPERATION = "text_replace";
237
+ var GOOGLE_DOCS_TEXT_REPLACE_META = googleDocsMeta("action", "replace text", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate");
238
+ var GOOGLE_DOCS_TEXT_REPLACE_OUTPUT = [
239
+ {
240
+ "path": "data.documentId",
241
+ "type": "string",
242
+ "description": "The document updated."
243
+ },
244
+ {
245
+ "path": "data.replies",
246
+ "type": "array",
247
+ "description": "One reply."
248
+ },
249
+ {
250
+ "path": "data.replies.0.replaceAllText.occurrencesChanged",
251
+ "type": "number",
252
+ "description": "How many occurrences were replaced. 0 means the text was not found, which is not an error."
253
+ },
254
+ {
255
+ "path": "data.writeControl.requiredRevisionId",
256
+ "type": "string",
257
+ "description": "The document's revision after the update."
258
+ },
259
+ {
260
+ "path": "mode",
261
+ "type": "string",
262
+ "description": "Which estate this ran against. Google has no sandbox, so: fake or live."
263
+ }
264
+ ];
265
+ var googleDocsTextReplaceKind = defineConnectorKind(GOOGLE_DOCS_TEXT_REPLACE_META, {
266
+ name: GOOGLE_DOCS_TEXT_REPLACE_KIND,
267
+ aliases: ["google_docs_text_replace"],
268
+ label: "Replace text in a Google Doc",
269
+ description: "Replace every occurrence of a string in a document.",
270
+ inputs: [{ id: "in" }],
271
+ outputs: [{ id: "out" }],
272
+ sideEffects: "unsafe-to-replay",
273
+ outputShape: GOOGLE_DOCS_TEXT_REPLACE_OUTPUT,
274
+ configSchema: [
275
+ {
276
+ "type": "text",
277
+ "key": "documentId",
278
+ "label": "Document ID",
279
+ "required": true,
280
+ "description": "From document_create's data.documentId, or the id in the document's own URL."
281
+ },
282
+ {
283
+ "type": "text",
284
+ "key": "find",
285
+ "label": "Find",
286
+ "required": true,
287
+ "description": "The exact text to find, e.g. {{name}}. Not a regular expression."
288
+ },
289
+ {
290
+ "type": "textarea",
291
+ "key": "replaceWith",
292
+ "label": "Replace with",
293
+ "required": true,
294
+ "description": "Inserted in place of every match. Empty is refused: to delete text, use batch_update."
295
+ },
296
+ {
297
+ "type": "switch",
298
+ "key": "matchCase",
299
+ "label": "Match case",
300
+ "default": false,
301
+ "description": "Off matches case-insensitively, which is also what Google does when it is not sent."
302
+ },
303
+ {
304
+ "type": "text",
305
+ "key": "requiredRevisionId",
306
+ "label": "Required revision ID",
307
+ "description": "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."
308
+ }
309
+ ],
310
+ defaultConfig: {
311
+ "mode": "auto"
312
+ },
313
+ renderBody: ({ config }) => summarize(GOOGLE_DOCS_TEXT_REPLACE_META, config, "replace text")
314
+ });
153
315
 
154
316
  // src/index.ts
155
317
  var GOOGLE_DOCS_KINDS = [
318
+ googleDocsBatchUpdateKind,
156
319
  googleDocsDocumentKind,
157
- googleDocsTextInsertKind
320
+ googleDocsTextInsertKind,
321
+ googleDocsTextReplaceKind
158
322
  ];
159
323
 
160
- export { CONNECTOR_API_VERSION, GOOGLE_DOCS_CREDENTIALS, GOOGLE_DOCS_DOCUMENT_KIND, GOOGLE_DOCS_DOCUMENT_META, GOOGLE_DOCS_DOCUMENT_OPERATION, GOOGLE_DOCS_DOCUMENT_OUTPUT, GOOGLE_DOCS_KINDS, GOOGLE_DOCS_OAUTH, GOOGLE_DOCS_SERVICE, GOOGLE_DOCS_TEXT_INSERT_KIND, GOOGLE_DOCS_TEXT_INSERT_META, GOOGLE_DOCS_TEXT_INSERT_OPERATION, GOOGLE_DOCS_TEXT_INSERT_OUTPUT, googleDocsDocumentKind, googleDocsMeta, googleDocsTextInsertKind };
324
+ export { CONNECTOR_API_VERSION, GOOGLE_DOCS_BATCH_UPDATE_KIND, GOOGLE_DOCS_BATCH_UPDATE_META, GOOGLE_DOCS_BATCH_UPDATE_OPERATION, GOOGLE_DOCS_BATCH_UPDATE_OUTPUT, GOOGLE_DOCS_CREDENTIALS, GOOGLE_DOCS_DOCUMENT_KIND, GOOGLE_DOCS_DOCUMENT_META, GOOGLE_DOCS_DOCUMENT_OPERATION, GOOGLE_DOCS_DOCUMENT_OUTPUT, GOOGLE_DOCS_KINDS, GOOGLE_DOCS_OAUTH, GOOGLE_DOCS_SERVICE, GOOGLE_DOCS_TEXT_INSERT_KIND, GOOGLE_DOCS_TEXT_INSERT_META, GOOGLE_DOCS_TEXT_INSERT_OPERATION, GOOGLE_DOCS_TEXT_INSERT_OUTPUT, GOOGLE_DOCS_TEXT_REPLACE_KIND, GOOGLE_DOCS_TEXT_REPLACE_META, GOOGLE_DOCS_TEXT_REPLACE_OPERATION, GOOGLE_DOCS_TEXT_REPLACE_OUTPUT, googleDocsBatchUpdateKind, googleDocsDocumentKind, googleDocsMeta, googleDocsTextInsertKind, googleDocsTextReplaceKind };
161
325
  //# sourceMappingURL=index.js.map
162
326
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/service.ts","../src/kinds/document-create.ts","../src/kinds/text-insert.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS,aAAA;AAAA,EACT,YAAA,EAAc,aAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,uBAAA,GAA0B;AAAA,EACrC;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,I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AAA,GAA0C;AAAA,EACrD,sBAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["/**\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's identity on the authoring surface, shared by every Google Docs\n * node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\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 { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_DOCS_SERVICE = {\n service: \"google_docs\",\n serviceTitle: \"Google Docs\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Google Docs connection holds. */\nexport const GOOGLE_DOCS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Docs requires — DECLARED here, performed by the\n * host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n */\nexport const GOOGLE_DOCS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/documents\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Docs node's connector metadata from the operation it performs. */\nexport function googleDocsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };\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 * Google Docs document — Create a blank Google Docs document.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_DOCUMENT_KIND = \"@particle-academy/google_docs_document\";\nexport const GOOGLE_DOCS_DOCUMENT_OPERATION = \"document_create\";\n\nexport const GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta(\"action\", \"create a blank document\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The id of the created document.\"\n },\n {\n \"path\": \"data.title\",\n \"type\": \"string\",\n \"description\": \"The title Google stored.\"\n }\n];\n\nexport const googleDocsDocumentKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {\n name: GOOGLE_DOCS_DOCUMENT_KIND,\n aliases: [\"google_docs_document\"],\n label: \"Google Docs document\",\n description: \"Create a blank Google Docs document.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_DOCUMENT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"title\",\n \"label\": \"Title\",\n \"required\": true,\n \"description\": \"The title of the new blank document.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_DOCUMENT_META, config as Record<string, unknown>, \"create a blank document\"),\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 text into a Google Doc — Insert plain text at a position in an\n * existing document's body.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_KIND = \"@particle-academy/google_docs_text_insert\";\nexport const GOOGLE_DOCS_TEXT_INSERT_OPERATION = \"text_insert\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_META = googleDocsMeta(\"action\", \"insert text\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"Echoes what was sent.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One entry per request sent -- one here. insertText's own reply carries nothing; the array is present and empty-shaped rather than a usable result.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsTextInsertKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META, {\n name: GOOGLE_DOCS_TEXT_INSERT_KIND,\n aliases: [\"google_docs_text_insert\"],\n label: \"Insert text into a Google Doc\",\n description: \"Insert plain text at a position in an existing document's body.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_TEXT_INSERT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"text\",\n \"label\": \"Text\",\n \"required\": true,\n \"description\": \"Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in.\"\n },\n {\n \"type\": \"number\",\n \"key\": \"index\",\n \"label\": \"Insert at index\",\n \"required\": true,\n \"default\": 1,\n \"min\": 1,\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_TEXT_INSERT_META, config as Record<string, unknown>, \"insert text\"),\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's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/document-create.js\";\nexport * from \"./kinds/text-insert.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDocsDocumentKind } from \"./kinds/document-create.js\";\nimport { googleDocsTextInsertKind } from \"./kinds/text-insert.js\";\n\n/** Every Google Docs kind, for a host that registers the lot. */\nexport const GOOGLE_DOCS_KINDS: NodeKindDefinition[] = [\n googleDocsDocumentKind,\n googleDocsTextInsertKind,\n];\n"]}
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/batch-update.ts","../src/kinds/document-create.ts","../src/kinds/text-insert.ts","../src/kinds/text-replace.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,mBAAA,GAAsB;AAAA,EACjC,OAAA,EAAS,aAAA;AAAA,EACT,YAAA,EAAc,aAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AA+BO,IAAM,uBAAA,GAA0B;AAAA,EACrC;AAAA,IACE,KAAA,EAAO,UAAA;AAAA,IACP,OAAA,EAAS,iBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,KAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,cAAA;AAAA,IACP,OAAA,EAAS,qBAAA;AAAA,IACT,OAAA,EAAS,UAAA;AAAA,IACT,QAAA,EAAU,IAAA;AAAA,IACV,MAAA,EAAQ;AAAA,GACV;AAAA,EACA;AAAA,IACE,KAAA,EAAO,aAAA;AAAA,IACP,OAAA,EAAS,cAAA;AAAA,IACT,OAAA,EAAS,SAAA;AAAA,IAC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AAA,OACbC,SAAAA,CAAU,6BAAA,EAA+B,QAAmC,cAAc;AAC9F,CAAC;;;ACnFM,IAAM,iBAAA,GAA0C;AAAA,EACrD,yBAAA;AAAA,EACA,sBAAA;AAAA,EACA,wBAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["/**\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's identity on the authoring surface, shared by every Google Docs\n * node.\n *\n * This file must import nothing from the js package: a PHP or Python project\n * installs the ui package and never that one, and the import would be a\n * dangling module the moment it did.\n *\n * ## The sandbox trap\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 { ConnectorDomain, ConnectorMeta } from \"@particle-academy/fancy-flow/connectors\";\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.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\n/** The parts of a connector's identity that belong to the SERVICE, not the node. */\nexport const GOOGLE_DOCS_SERVICE = {\n service: \"google_docs\",\n serviceTitle: \"Google Docs\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/**\n * Every connector domain weaver knows, pinned against fancy-flow's union.\n *\n * A closed set copied into three codebases stays correct only while something\n * MAKES it: this line fails to compile the moment weaver carries a value\n * fancy-flow does not, including the values no provider uses yet.\n */\nconst WEAVER_DOMAINS: readonly ConnectorDomain[] = [\n \"payments\",\n \"commerce\",\n \"messaging\",\n \"email\",\n \"crm\",\n \"support\",\n \"storage\",\n \"calendar\",\n \"productivity\",\n \"database\",\n \"devtools\",\n \"analytics\",\n \"marketing\",\n \"ai\",\n \"forms\",\n \"hr\",\n \"geo\"\n];\nvoid WEAVER_DOMAINS;\n\n/** The credentials a Google Docs connection holds. */\nexport const GOOGLE_DOCS_CREDENTIALS = [\n {\n \"key\": \"clientId\",\n \"label\": \"OAuth client ID\",\n \"scope\": \"provider\",\n \"secret\": false,\n \"help\": \"From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.\"\n },\n {\n \"key\": \"clientSecret\",\n \"label\": \"OAuth client secret\",\n \"scope\": \"provider\",\n \"secret\": true,\n \"help\": \"The client secret for the same OAuth app. One value for the whole installation.\"\n },\n {\n \"key\": \"accessToken\",\n \"label\": \"Access token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.\"\n },\n {\n \"key\": \"refreshToken\",\n \"label\": \"Refresh token\",\n \"scope\": \"account\",\n \"secret\": true,\n \"help\": \"Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour.\"\n }\n] as const;\n\n/**\n * The OAuth2 exchange Google Docs requires — DECLARED here, performed by the\n * host.\n *\n * A consent screen needs a browser, a redirect URI and somewhere to persist\n * the result, and all three belong to the host; a package that ran the dance\n * itself would have to own a web server. So this says precisely enough for a\n * host to do it.\n *\n * The access token lasts 3600 seconds. A host that never refreshes will work\n * all afternoon and be broken by morning, which is why the lifetime is stated\n * rather than left to be discovered.\n *\n * Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may\n * safely be retried and may run concurrently. That is stated rather than\n * assumed because the opposite — a provider that spends the token and revokes\n * the grant on a replay — looks identical until it happens.\n *\n * Its consent grant is SHARED with every connector declaring grant \"google\":\n * one OAuth client, one consent and one refresh token per person, scopes added\n * as features are first used (authorizeParams). Revoking removes the WHOLE\n * grant, so only a full disconnect revokes; a per-feature disconnect stops\n * using the scope locally. Identify the account by the id_token's sub, never\n * by email.\n */\nexport const GOOGLE_DOCS_OAUTH = {\n \"flow\": \"authorization_code\",\n \"authorizeUrl\": \"https://accounts.google.com/o/oauth2/v2/auth\",\n \"tokenUrl\": \"https://oauth2.googleapis.com/token\",\n \"scopes\": [\n \"https://www.googleapis.com/auth/documents\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600,\n \"grant\": \"google\",\n \"authorizeParams\": {\n \"access_type\": \"offline\",\n \"include_granted_scopes\": \"true\"\n },\n \"revoke\": {\n \"url\": \"https://oauth2.googleapis.com/revoke\",\n \"param\": \"token\",\n \"scope\": \"grant\"\n },\n \"identity\": {\n \"scope\": \"openid\",\n \"claim\": \"sub\",\n \"issuers\": [\n \"https://accounts.google.com\",\n \"accounts.google.com\"\n ],\n \"jwksUrl\": \"https://www.googleapis.com/oauth2/v3/certs\",\n \"audienceCredential\": \"clientId\"\n },\n \"restrictedScopes\": []\n} as const;\n\n/** Build a Google Docs node's connector metadata from the operation it performs. */\nexport function googleDocsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };\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 * Batch update a Google Doc — Apply a list of Google Doc API requests to a\n * document, all or none.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_BATCH_UPDATE_KIND = \"@particle-academy/google_docs_batch_update\";\nexport const GOOGLE_DOCS_BATCH_UPDATE_OPERATION = \"batch_update\";\n\nexport const GOOGLE_DOCS_BATCH_UPDATE_META = googleDocsMeta(\"action\", \"batch update a document\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_BATCH_UPDATE_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The document updated.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One reply per request, in order. Many kinds reply with an empty object.\"\n },\n {\n \"path\": \"data.writeControl.requiredRevisionId\",\n \"type\": \"string\",\n \"description\": \"The document's revision after the update; pass it to the next batch to guard it.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsBatchUpdateKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_BATCH_UPDATE_META, {\n name: GOOGLE_DOCS_BATCH_UPDATE_KIND,\n aliases: [\"google_docs_batch_update\"],\n label: \"Batch update a Google Doc\",\n description: \"Apply a list of Google Doc API requests to a document, all or none.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_BATCH_UPDATE_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"json\",\n \"key\": \"requests\",\n \"label\": \"Requests\",\n \"required\": true,\n \"description\": \"Google's Request objects, in order. Example: [{\\\"replaceAllText\\\":{\\\"containsText\\\":{\\\"text\\\":\\\"{{name}}\\\",\\\"matchCase\\\":true},\\\"replaceText\\\":\\\"Ada\\\"}}].\"\n },\n {\n \"type\": \"text\",\n \"key\": \"requiredRevisionId\",\n \"label\": \"Required revision ID\",\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_BATCH_UPDATE_META, config as Record<string, unknown>, \"batch update a document\"),\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 * Google Docs document — Create a blank Google Docs document.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_DOCUMENT_KIND = \"@particle-academy/google_docs_document\";\nexport const GOOGLE_DOCS_DOCUMENT_OPERATION = \"document_create\";\n\nexport const GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta(\"action\", \"create a blank document\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The id of the created document.\"\n },\n {\n \"path\": \"data.title\",\n \"type\": \"string\",\n \"description\": \"The title Google stored.\"\n }\n];\n\nexport const googleDocsDocumentKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {\n name: GOOGLE_DOCS_DOCUMENT_KIND,\n aliases: [\"google_docs_document\"],\n label: \"Google Docs document\",\n description: \"Create a blank Google Docs document.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_DOCUMENT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"title\",\n \"label\": \"Title\",\n \"required\": true,\n \"description\": \"The title of the new blank document.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_DOCUMENT_META, config as Record<string, unknown>, \"create a blank document\"),\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 text into a Google Doc — Insert plain text at a position in an\n * existing document's body.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_KIND = \"@particle-academy/google_docs_text_insert\";\nexport const GOOGLE_DOCS_TEXT_INSERT_OPERATION = \"text_insert\";\n\nexport const GOOGLE_DOCS_TEXT_INSERT_META = googleDocsMeta(\"action\", \"insert text\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"Echoes what was sent.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One entry per request sent -- one here. insertText's own reply carries nothing; the array is present and empty-shaped rather than a usable result.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsTextInsertKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META, {\n name: GOOGLE_DOCS_TEXT_INSERT_KIND,\n aliases: [\"google_docs_text_insert\"],\n label: \"Insert text into a Google Doc\",\n description: \"Insert plain text at a position in an existing document's body.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_TEXT_INSERT_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"text\",\n \"label\": \"Text\",\n \"required\": true,\n \"description\": \"Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in.\"\n },\n {\n \"type\": \"number\",\n \"key\": \"index\",\n \"label\": \"Insert at index\",\n \"required\": true,\n \"default\": 1,\n \"min\": 1,\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_TEXT_INSERT_META, config as Record<string, unknown>, \"insert text\"),\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 text in a Google Doc — Replace every occurrence of a string in a\n * document.\n *\n * https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\n *\n * `unsafe-to-replay`.\n */\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { defineConnectorKind, summarize, type OutputField } from \"@particle-academy/fancy-flow/connectors\";\nimport { googleDocsMeta } from \"../service.js\";\n\nexport const GOOGLE_DOCS_TEXT_REPLACE_KIND = \"@particle-academy/google_docs_text_replace\";\nexport const GOOGLE_DOCS_TEXT_REPLACE_OPERATION = \"text_replace\";\n\nexport const GOOGLE_DOCS_TEXT_REPLACE_META = googleDocsMeta(\"action\", \"replace text\", \"https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate\");\n\n/**\n * What this node emits — the \"ingredients\" a downstream node can reference.\n *\n * fancy-flow reads `outputShape` off the kind and offers it in the variable\n * picker, so declaring it is the whole of the work: an author configuring the\n * next node picks `{{ $json.data.id }}` off a list instead of typing a path\n * and hoping.\n */\nexport const GOOGLE_DOCS_TEXT_REPLACE_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.documentId\",\n \"type\": \"string\",\n \"description\": \"The document updated.\"\n },\n {\n \"path\": \"data.replies\",\n \"type\": \"array\",\n \"description\": \"One reply.\"\n },\n {\n \"path\": \"data.replies.0.replaceAllText.occurrencesChanged\",\n \"type\": \"number\",\n \"description\": \"How many occurrences were replaced. 0 means the text was not found, which is not an error.\"\n },\n {\n \"path\": \"data.writeControl.requiredRevisionId\",\n \"type\": \"string\",\n \"description\": \"The document's revision after the update.\"\n },\n {\n \"path\": \"mode\",\n \"type\": \"string\",\n \"description\": \"Which estate this ran against. Google has no sandbox, so: fake or live.\"\n }\n];\n\nexport const googleDocsTextReplaceKind: NodeKindDefinition = defineConnectorKind(GOOGLE_DOCS_TEXT_REPLACE_META, {\n name: GOOGLE_DOCS_TEXT_REPLACE_KIND,\n aliases: [\"google_docs_text_replace\"],\n label: \"Replace text in a Google Doc\",\n description: \"Replace every occurrence of a string in a document.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_DOCS_TEXT_REPLACE_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"documentId\",\n \"label\": \"Document ID\",\n \"required\": true,\n \"description\": \"From document_create's data.documentId, or the id in the document's own URL.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"find\",\n \"label\": \"Find\",\n \"required\": true,\n \"description\": \"The exact text to find, e.g. {{name}}. Not a regular expression.\"\n },\n {\n \"type\": \"textarea\",\n \"key\": \"replaceWith\",\n \"label\": \"Replace with\",\n \"required\": true,\n \"description\": \"Inserted in place of every match. Empty is refused: to delete text, use batch_update.\"\n },\n {\n \"type\": \"switch\",\n \"key\": \"matchCase\",\n \"label\": \"Match case\",\n \"default\": false,\n \"description\": \"Off matches case-insensitively, which is also what Google does when it is not sent.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"requiredRevisionId\",\n \"label\": \"Required revision ID\",\n \"description\": \"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.\"\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_DOCS_TEXT_REPLACE_META, config as Record<string, unknown>, \"replace text\"),\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's node kinds for fancy-flow.\n *\n * Install this on every host. The TypeScript executors live in the js\n * package's `./flow` subpath; PHP and Python hosts run their own and need only\n * this.\n */\n\nexport * from \"./service.js\";\nexport * from \"./kinds/batch-update.js\";\nexport * from \"./kinds/document-create.js\";\nexport * from \"./kinds/text-insert.js\";\nexport * from \"./kinds/text-replace.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDocsBatchUpdateKind } from \"./kinds/batch-update.js\";\nimport { googleDocsDocumentKind } from \"./kinds/document-create.js\";\nimport { googleDocsTextInsertKind } from \"./kinds/text-insert.js\";\nimport { googleDocsTextReplaceKind } from \"./kinds/text-replace.js\";\n\n/** Every Google Docs kind, for a host that registers the lot. */\nexport const GOOGLE_DOCS_KINDS: NodeKindDefinition[] = [\n googleDocsBatchUpdateKind,\n googleDocsDocumentKind,\n googleDocsTextInsertKind,\n googleDocsTextReplaceKind,\n];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle-academy/google-docs-ui",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Google Docs's authoring surface for fancy-flow — the node kinds, their config schemas and their declared output shapes. React on every host; carries no executor.",
5
5
  "repository": {
6
6
  "type": "git",