@particle-academy/google-docs-ui 0.3.4 → 0.5.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 +36 -0
- package/README.md +14 -0
- package/art/fancified.svg +26 -0
- package/dist/index.cjs +66 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +62 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,42 @@ 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.5.0] — 2026-11-08
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Laravel integration, in this package** (`src/Laravel/`), auto-discovered
|
|
16
|
+
through composer's `extra.laravel`. Laravel is SUGGESTED, never required:
|
|
17
|
+
outside a Laravel app none of it loads.
|
|
18
|
+
- a service provider that merges `config/google-docs.php` under
|
|
19
|
+
`connectors.google-docs` (credentials from the environment, or per call for a
|
|
20
|
+
multi-account app);
|
|
21
|
+
- the `GoogleDocs` facade: `GoogleDocs::call('<operation>', [...])` runs any action;
|
|
22
|
+
- `GoogleDocs::fake()`, answered from the connector's faker, with
|
|
23
|
+
`assertSent` / `assertNotSent` / `assertNothingSent` / `assertSentCount`;
|
|
24
|
+
- its own Pest test of all of it against a booted Laravel app.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Tests: Pest `^5`**, and `laravel/framework` `^13` as a DEV-ONLY test
|
|
29
|
+
dependency (the framework this package integrates with; nothing ships in
|
|
30
|
+
`require`).
|
|
31
|
+
|
|
32
|
+
## [0.4.0] — 2026-10-01
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **`text_insert`** — insert plain text into an existing document's body
|
|
37
|
+
(`documents.batchUpdate`, a single `insertText` request). No scope
|
|
38
|
+
change. Until now `document_create` could only make a BLANK document
|
|
39
|
+
with no way to ever put content in it.
|
|
40
|
+
- Deliberately NOT included: the general `batchUpdate` escape hatch (an
|
|
41
|
+
author-supplied array of Google's dozens of typed request kinds —
|
|
42
|
+
`deleteContentRange`, `replaceAllText`, `insertTable`, text styling,
|
|
43
|
+
...). That needs an array-of-polymorphic-objects config shape nothing
|
|
44
|
+
in this estate has used before — a real second need, not a first
|
|
45
|
+
guess, same bar as everything in `vocabulary-deferred.md`.
|
|
46
|
+
|
|
11
47
|
## [0.3.4] — 2026-09-12
|
|
12
48
|
|
|
13
49
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Google Docs
|
|
2
2
|
|
|
3
|
+
[](https://particle.academy)
|
|
4
|
+
|
|
3
5
|
Google Docs for [fancy-flow][flow] — as **four imported, versioned packages**, one
|
|
4
6
|
per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
|
|
5
7
|
change.
|
|
@@ -75,6 +77,18 @@ Create a blank Google Docs document.
|
|
|
75
77
|
|---|---|---|
|
|
76
78
|
| `title` | yes | The title of the new blank document. |
|
|
77
79
|
|
|
80
|
+
#### `text_insert` — Insert text into a Google Doc
|
|
81
|
+
|
|
82
|
+
Insert plain text at a position in an existing document's body.
|
|
83
|
+
|
|
84
|
+
`POST /v1/documents/{documentId}:batchUpdate` · **unsafe to replay** — a retried durable run does it TWICE
|
|
85
|
+
|
|
86
|
+
| Input | Required | What it is |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| `documentId` | yes | From document_create's data.documentId, or the id in the document's own URL. |
|
|
89
|
+
| `text` | yes | Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in. |
|
|
90
|
+
| `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
|
+
|
|
78
92
|
## Run it before you have credentials
|
|
79
93
|
|
|
80
94
|
Every operation ships a **faker**, whether or not Google Docs has a sandbox. Set a
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="28" role="img" aria-label="Fancified — built with Fancy UI">
|
|
2
|
+
<title>Fancified · built with Fancy UI</title>
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="fcdBg" x1="0" y1="0" x2="1" y2="1">
|
|
5
|
+
<stop offset="0" stop-color="#6d28d9"/>
|
|
6
|
+
<stop offset=".5" stop-color="#9333ea"/>
|
|
7
|
+
<stop offset="1" stop-color="#d946ef"/>
|
|
8
|
+
</linearGradient>
|
|
9
|
+
<linearGradient id="fcdGloss" x1="0" y1="0" x2="0" y2="1">
|
|
10
|
+
<stop offset="0" stop-color="#ffffff" stop-opacity=".30"/>
|
|
11
|
+
<stop offset=".55" stop-color="#ffffff" stop-opacity="0"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<clipPath id="fcdClip"><rect width="128" height="28" rx="7"/></clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
<g clip-path="url(#fcdClip)">
|
|
16
|
+
<rect width="128" height="28" fill="url(#fcdBg)"/>
|
|
17
|
+
<rect width="34" height="28" fill="#3b0764" fill-opacity=".5"/>
|
|
18
|
+
<rect width="128" height="13" fill="url(#fcdGloss)"/>
|
|
19
|
+
<g fill="#fff">
|
|
20
|
+
<path transform="translate(17 14)" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
21
|
+
<path transform="translate(25.5 7.5) scale(.34)" fill-opacity=".85" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
|
|
22
|
+
</g>
|
|
23
|
+
<text x="81" y="18.5" fill="#ffffff" text-anchor="middle" font-family="'Segoe UI',Verdana,'DejaVu Sans',sans-serif" font-size="12" font-weight="700" letter-spacing=".3">Fancified</text>
|
|
24
|
+
</g>
|
|
25
|
+
<rect x=".5" y=".5" width="127" height="27" rx="6.5" fill="none" stroke="#ffffff" stroke-opacity=".22"/>
|
|
26
|
+
</svg>
|
package/dist/index.cjs
CHANGED
|
@@ -93,10 +93,70 @@ var googleDocsDocumentKind = connectors.defineConnectorKind(GOOGLE_DOCS_DOCUMENT
|
|
|
93
93
|
},
|
|
94
94
|
renderBody: ({ config }) => connectors.summarize(GOOGLE_DOCS_DOCUMENT_META, config, "create a blank document")
|
|
95
95
|
});
|
|
96
|
+
var GOOGLE_DOCS_TEXT_INSERT_KIND = "@particle-academy/google_docs_text_insert";
|
|
97
|
+
var GOOGLE_DOCS_TEXT_INSERT_OPERATION = "text_insert";
|
|
98
|
+
var GOOGLE_DOCS_TEXT_INSERT_META = googleDocsMeta("action", "insert text", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate");
|
|
99
|
+
var GOOGLE_DOCS_TEXT_INSERT_OUTPUT = [
|
|
100
|
+
{
|
|
101
|
+
"path": "data.documentId",
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "Echoes what was sent."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"path": "data.replies",
|
|
107
|
+
"type": "array",
|
|
108
|
+
"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."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"path": "mode",
|
|
112
|
+
"type": "string",
|
|
113
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
var googleDocsTextInsertKind = connectors.defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META, {
|
|
117
|
+
name: GOOGLE_DOCS_TEXT_INSERT_KIND,
|
|
118
|
+
aliases: ["google_docs_text_insert"],
|
|
119
|
+
label: "Insert text into a Google Doc",
|
|
120
|
+
description: "Insert plain text at a position in an existing document's body.",
|
|
121
|
+
inputs: [{ id: "in" }],
|
|
122
|
+
outputs: [{ id: "out" }],
|
|
123
|
+
sideEffects: "unsafe-to-replay",
|
|
124
|
+
outputShape: GOOGLE_DOCS_TEXT_INSERT_OUTPUT,
|
|
125
|
+
configSchema: [
|
|
126
|
+
{
|
|
127
|
+
"type": "text",
|
|
128
|
+
"key": "documentId",
|
|
129
|
+
"label": "Document ID",
|
|
130
|
+
"required": true,
|
|
131
|
+
"description": "From document_create's data.documentId, or the id in the document's own URL."
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "textarea",
|
|
135
|
+
"key": "text",
|
|
136
|
+
"label": "Text",
|
|
137
|
+
"required": true,
|
|
138
|
+
"description": "Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in."
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"type": "number",
|
|
142
|
+
"key": "index",
|
|
143
|
+
"label": "Insert at index",
|
|
144
|
+
"required": true,
|
|
145
|
+
"default": 1,
|
|
146
|
+
"min": 1,
|
|
147
|
+
"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."
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
defaultConfig: {
|
|
151
|
+
"mode": "auto"
|
|
152
|
+
},
|
|
153
|
+
renderBody: ({ config }) => connectors.summarize(GOOGLE_DOCS_TEXT_INSERT_META, config, "insert text")
|
|
154
|
+
});
|
|
96
155
|
|
|
97
156
|
// src/index.ts
|
|
98
157
|
var GOOGLE_DOCS_KINDS = [
|
|
99
|
-
googleDocsDocumentKind
|
|
158
|
+
googleDocsDocumentKind,
|
|
159
|
+
googleDocsTextInsertKind
|
|
100
160
|
];
|
|
101
161
|
|
|
102
162
|
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
@@ -108,7 +168,12 @@ exports.GOOGLE_DOCS_DOCUMENT_OUTPUT = GOOGLE_DOCS_DOCUMENT_OUTPUT;
|
|
|
108
168
|
exports.GOOGLE_DOCS_KINDS = GOOGLE_DOCS_KINDS;
|
|
109
169
|
exports.GOOGLE_DOCS_OAUTH = GOOGLE_DOCS_OAUTH;
|
|
110
170
|
exports.GOOGLE_DOCS_SERVICE = GOOGLE_DOCS_SERVICE;
|
|
171
|
+
exports.GOOGLE_DOCS_TEXT_INSERT_KIND = GOOGLE_DOCS_TEXT_INSERT_KIND;
|
|
172
|
+
exports.GOOGLE_DOCS_TEXT_INSERT_META = GOOGLE_DOCS_TEXT_INSERT_META;
|
|
173
|
+
exports.GOOGLE_DOCS_TEXT_INSERT_OPERATION = GOOGLE_DOCS_TEXT_INSERT_OPERATION;
|
|
174
|
+
exports.GOOGLE_DOCS_TEXT_INSERT_OUTPUT = GOOGLE_DOCS_TEXT_INSERT_OUTPUT;
|
|
111
175
|
exports.googleDocsDocumentKind = googleDocsDocumentKind;
|
|
112
176
|
exports.googleDocsMeta = googleDocsMeta;
|
|
177
|
+
exports.googleDocsTextInsertKind = googleDocsTextInsertKind;
|
|
113
178
|
//# sourceMappingURL=index.cjs.map
|
|
114
179
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/service.ts","../src/kinds/document-create.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,uBA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,IAAM,2BAAA,GAA6C;AAAA,EACxD;AAAA,IACE,MAAA,EAAQ,iBAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA,GACjB;AAAA,EACA;AAAA,IACE,MAAA,EAAQ,YAAA;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,aAAA,EAAe;AAAA;AAEnB;AAEO,IAAM,sBAAA,GAA6CA,+BAAoB,yBAAA,EAA2B;AAAA,EACvG,IAAA,EAAM,yBAAA;AAAA,EACN,OAAA,EAAS,CAAC,sBAAsB,CAAA;AAAA,EAChC,KAAA,EAAO,sBAAA;AAAA,EACP,WAAA,EAAa,sCAAA;AAAA,EACb,MAAA,EAAQ,CAAC,EAAE,EAAA,EAAI,MAAM,CAAA;AAAA,EACrB,OAAA,EAAS,CAAC,EAAE,EAAA,EAAI,OAAO,CAAA;AAAA,EACvB,WAAA,EAAa,kBAAA;AAAA,EACb,WAAA,EAAa,2BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,OAAA;AAAA,MACP,OAAA,EAAS,OAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAA,CAAU,yBAAA,EAA2B,QAAmC,yBAAyB;AACrG,CAAC;;;AC9CM,IAAM,iBAAA,GAA0C;AAAA,EACrD;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/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\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDocsDocumentKind } from \"./kinds/document-create.js\";\n\n/** Every Google Docs kind, for a host that registers the lot. */\nexport const GOOGLE_DOCS_KINDS: NodeKindDefinition[] = [\n googleDocsDocumentKind,\n];\n"]}
|
|
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,a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AA,EAAa,iEAAA;AAAA,EACb,MAAA,EAAQ,CAAC,EAAE,EAAA,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"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -112,6 +112,20 @@ declare const GOOGLE_DOCS_DOCUMENT_META: _particle_academy_fancy_flow_connectors
|
|
|
112
112
|
declare const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[];
|
|
113
113
|
declare const googleDocsDocumentKind: NodeKindDefinition;
|
|
114
114
|
|
|
115
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_KIND = "@particle-academy/google_docs_text_insert";
|
|
116
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_OPERATION = "text_insert";
|
|
117
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
118
|
+
/**
|
|
119
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
120
|
+
*
|
|
121
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
122
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
123
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
124
|
+
* and hoping.
|
|
125
|
+
*/
|
|
126
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[];
|
|
127
|
+
declare const googleDocsTextInsertKind: NodeKindDefinition;
|
|
128
|
+
|
|
115
129
|
/**
|
|
116
130
|
* GENERATED FILE — do not edit.
|
|
117
131
|
*
|
|
@@ -133,4 +147,4 @@ declare const googleDocsDocumentKind: NodeKindDefinition;
|
|
|
133
147
|
/** Every Google Docs kind, for a host that registers the lot. */
|
|
134
148
|
declare const GOOGLE_DOCS_KINDS: NodeKindDefinition[];
|
|
135
149
|
|
|
136
|
-
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, googleDocsDocumentKind, googleDocsMeta };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -112,6 +112,20 @@ declare const GOOGLE_DOCS_DOCUMENT_META: _particle_academy_fancy_flow_connectors
|
|
|
112
112
|
declare const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[];
|
|
113
113
|
declare const googleDocsDocumentKind: NodeKindDefinition;
|
|
114
114
|
|
|
115
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_KIND = "@particle-academy/google_docs_text_insert";
|
|
116
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_OPERATION = "text_insert";
|
|
117
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
|
|
118
|
+
/**
|
|
119
|
+
* What this node emits — the "ingredients" a downstream node can reference.
|
|
120
|
+
*
|
|
121
|
+
* fancy-flow reads `outputShape` off the kind and offers it in the variable
|
|
122
|
+
* picker, so declaring it is the whole of the work: an author configuring the
|
|
123
|
+
* next node picks `{{ $json.data.id }}` off a list instead of typing a path
|
|
124
|
+
* and hoping.
|
|
125
|
+
*/
|
|
126
|
+
declare const GOOGLE_DOCS_TEXT_INSERT_OUTPUT: OutputField[];
|
|
127
|
+
declare const googleDocsTextInsertKind: NodeKindDefinition;
|
|
128
|
+
|
|
115
129
|
/**
|
|
116
130
|
* GENERATED FILE — do not edit.
|
|
117
131
|
*
|
|
@@ -133,4 +147,4 @@ declare const googleDocsDocumentKind: NodeKindDefinition;
|
|
|
133
147
|
/** Every Google Docs kind, for a host that registers the lot. */
|
|
134
148
|
declare const GOOGLE_DOCS_KINDS: NodeKindDefinition[];
|
|
135
149
|
|
|
136
|
-
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, googleDocsDocumentKind, googleDocsMeta };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -91,12 +91,72 @@ var googleDocsDocumentKind = defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {
|
|
|
91
91
|
},
|
|
92
92
|
renderBody: ({ config }) => summarize(GOOGLE_DOCS_DOCUMENT_META, config, "create a blank document")
|
|
93
93
|
});
|
|
94
|
+
var GOOGLE_DOCS_TEXT_INSERT_KIND = "@particle-academy/google_docs_text_insert";
|
|
95
|
+
var GOOGLE_DOCS_TEXT_INSERT_OPERATION = "text_insert";
|
|
96
|
+
var GOOGLE_DOCS_TEXT_INSERT_META = googleDocsMeta("action", "insert text", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate");
|
|
97
|
+
var GOOGLE_DOCS_TEXT_INSERT_OUTPUT = [
|
|
98
|
+
{
|
|
99
|
+
"path": "data.documentId",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"description": "Echoes what was sent."
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"path": "data.replies",
|
|
105
|
+
"type": "array",
|
|
106
|
+
"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."
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"path": "mode",
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Which estate this ran against. Google has no sandbox, so: fake or live."
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
var googleDocsTextInsertKind = defineConnectorKind(GOOGLE_DOCS_TEXT_INSERT_META, {
|
|
115
|
+
name: GOOGLE_DOCS_TEXT_INSERT_KIND,
|
|
116
|
+
aliases: ["google_docs_text_insert"],
|
|
117
|
+
label: "Insert text into a Google Doc",
|
|
118
|
+
description: "Insert plain text at a position in an existing document's body.",
|
|
119
|
+
inputs: [{ id: "in" }],
|
|
120
|
+
outputs: [{ id: "out" }],
|
|
121
|
+
sideEffects: "unsafe-to-replay",
|
|
122
|
+
outputShape: GOOGLE_DOCS_TEXT_INSERT_OUTPUT,
|
|
123
|
+
configSchema: [
|
|
124
|
+
{
|
|
125
|
+
"type": "text",
|
|
126
|
+
"key": "documentId",
|
|
127
|
+
"label": "Document ID",
|
|
128
|
+
"required": true,
|
|
129
|
+
"description": "From document_create's data.documentId, or the id in the document's own URL."
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "textarea",
|
|
133
|
+
"key": "text",
|
|
134
|
+
"label": "Text",
|
|
135
|
+
"required": true,
|
|
136
|
+
"description": "Inserted verbatim. A newline in it starts a new paragraph, carrying the style of whatever paragraph the insertion point sits in."
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "number",
|
|
140
|
+
"key": "index",
|
|
141
|
+
"label": "Insert at index",
|
|
142
|
+
"required": true,
|
|
143
|
+
"default": 1,
|
|
144
|
+
"min": 1,
|
|
145
|
+
"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."
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
defaultConfig: {
|
|
149
|
+
"mode": "auto"
|
|
150
|
+
},
|
|
151
|
+
renderBody: ({ config }) => summarize(GOOGLE_DOCS_TEXT_INSERT_META, config, "insert text")
|
|
152
|
+
});
|
|
94
153
|
|
|
95
154
|
// src/index.ts
|
|
96
155
|
var GOOGLE_DOCS_KINDS = [
|
|
97
|
-
googleDocsDocumentKind
|
|
156
|
+
googleDocsDocumentKind,
|
|
157
|
+
googleDocsTextInsertKind
|
|
98
158
|
];
|
|
99
159
|
|
|
100
|
-
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, googleDocsDocumentKind, googleDocsMeta };
|
|
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 };
|
|
101
161
|
//# sourceMappingURL=index.js.map
|
|
102
162
|
//# 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/index.ts"],"names":[],"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,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,EAAa,2BAAA;AAAA,EACb,YAAA,EAAc;AAAA,IACZ;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,OAAA;AAAA,MACP,OAAA,EAAS,OAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACb,SAAA,CAAU,yBAAA,EAA2B,QAAmC,yBAAyB;AACrG,CAAC;;;AC9CM,IAAM,iBAAA,GAA0C;AAAA,EACrD;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/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\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleDocsDocumentKind } from \"./kinds/document-create.js\";\n\n/** Every Google Docs kind, for a host that registers the lot. */\nexport const GOOGLE_DOCS_KINDS: NodeKindDefinition[] = [\n googleDocsDocumentKind,\n];\n"]}
|
|
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,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;AAoBO,IAAM,iBAAA,GAAoB;AAAA,EAC/B,MAAA,EAAQ,oBAAA;AAAA,EACR,cAAA,EAAgB,8CAAA;AAAA,EAChB,UAAA,EAAY,qCAAA;AAAA,EACZ,QAAA,EAAU;AAAA,IACR;AAAA,GACF;AAAA,EACA,uBAAA,EAAyB,aAAA;AAAA,EACzB,wBAAA,EAA0B,cAAA;AAAA,EAC1B,qBAAA,EAAuB,KAAA;AAAA,EACvB,uBAAA,EAAyB;AAC3B;AAGO,S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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,SAAAA,CAAU,4BAAA,EAA8B,QAAmC,aAAa;AAC5F,CAAC;;;AClEM,IAAM,iBAAA,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-academy/google-docs-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.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",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
+
"art",
|
|
31
32
|
"README.md",
|
|
32
33
|
"CHANGELOG.md",
|
|
33
34
|
"LICENSE"
|