@particle-academy/google-docs-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@particle-academy/google-docs-ui`,
4
+ `@particle-academy/google-docs-js`, `particle-academy/google-docs-php` and
5
+ `fancy-google-docs`.
6
+
7
+ The four packages share one version, because they are generated from one
8
+ `provider/` definition and a version that meant something different in each
9
+ would be a version nobody could reason about.
10
+
11
+ ## [0.1.0] — 2026-08-23
12
+
13
+ First release.
14
+
15
+ ### Added
16
+
17
+ - `document_create` — create a blank Google Docs document from a title.
18
+ `POST /v1/documents`.
19
+ - A top-level `Document` faker, so the node runs on a canvas with no Google
20
+ account.
21
+
22
+ ### Only the title is accepted
23
+
24
+ The request type is the full `Document`, but Google's discovery method says
25
+ every field other than `title` is ignored, including content. The action does
26
+ not offer fields the endpoint will silently discard.
27
+
28
+ ### No sandbox, and no idempotency
29
+
30
+ Google has no Docs test estate. A test document is a real document in a real
31
+ Drive. `documents.create` also declares no idempotency key, so a retry can
32
+ create a second document and the action is honestly `unsafe-to-replay`.
33
+
34
+ [0.1.0]: https://github.com/Fancy-Friends/google-docs/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Particle Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Google Docs
2
+
3
+ Google Docs for [fancy-flow][flow] — as **four imported, versioned packages**, one
4
+ per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
5
+ change.
6
+
7
+ [flow]: https://github.com/Particle-Academy/fancy-flow
8
+
9
+ | Runtime | Package | Install |
10
+ |---|---|---|
11
+ | Authoring surface (every host) | `@particle-academy/google-docs-ui` | `npm install @particle-academy/google-docs-ui` |
12
+ | Node | `@particle-academy/google-docs-js` | `npm install @particle-academy/google-docs-js` |
13
+ | PHP 8.4+ | `particle-academy/google-docs-php` | `composer require particle-academy/google-docs-php` |
14
+ | Python 3.11+ | `fancy-google-docs` | `pip install fancy-google-docs` |
15
+
16
+ The `ui` package is the editor surface and is React on every host — a PHP or
17
+ Python project installs it *and* its own runtime package, and never the `js` one.
18
+
19
+ ## What it costs you
20
+
21
+ One dependency: `@particle-academy/fancy-connector-core` (or
22
+ `particle-academy/fancy-connector-core` on Composer), which the `js` and `php`
23
+ packages pull in themselves. The Python package has **zero** runtime
24
+ dependencies.
25
+
26
+ **No Google Docs SDK.** Plain HTTP, deliberately: a vendor SDK is third-party code
27
+ subject to the kit's full approval bar, and one per provider is hundreds of
28
+ dependencies nobody is tracking.
29
+
30
+ ## Run it before you have credentials
31
+
32
+ Every operation ships a **faker**, whether or not Google Docs has a sandbox. Set a
33
+ node's mode to `fake` and it returns the shape Google Docs actually publishes — the
34
+ same field names, deterministically — so you can wire the downstream nodes before
35
+ touching an account, a key, or a network.
36
+
37
+ ## This repository is generated
38
+
39
+ `provider/` is the source. Everything under `packages/` is emitted from it and
40
+ **must not be hand-edited** — CI regenerates and diffs on every push, and the
41
+ next protocol sync destroys anything it finds. See [`AGENTS.md`](AGENTS.md).
42
+
43
+ ## Two namespaces, which do not match on purpose
44
+
45
+ The repo is `github.com/Fancy-Friends/google-docs`; the packages publish under
46
+ `particle-academy`. Nothing derives one from the other — the names come from
47
+ weaver's `friends.json` and nowhere else.
48
+
49
+ ## Licence
50
+
51
+ MIT.
package/dist/index.cjs ADDED
@@ -0,0 +1,113 @@
1
+ 'use strict';
2
+
3
+ var connectors = require('@particle-academy/fancy-flow/connectors');
4
+
5
+ // src/service.ts
6
+ var CONNECTOR_API_VERSION = 1;
7
+ var GOOGLE_DOCS_SERVICE = {
8
+ service: "google_docs",
9
+ serviceTitle: "Google Docs",
10
+ domain: "productivity",
11
+ sandbox: "none"
12
+ };
13
+ var GOOGLE_DOCS_CREDENTIALS = [
14
+ {
15
+ "key": "clientId",
16
+ "label": "OAuth client ID",
17
+ "scope": "provider",
18
+ "secret": false,
19
+ "help": "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account."
20
+ },
21
+ {
22
+ "key": "clientSecret",
23
+ "label": "OAuth client secret",
24
+ "scope": "provider",
25
+ "secret": true,
26
+ "help": "The client secret for the same OAuth app. One value for the whole installation."
27
+ },
28
+ {
29
+ "key": "accessToken",
30
+ "label": "Access token",
31
+ "scope": "account",
32
+ "secret": true,
33
+ "help": "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token."
34
+ },
35
+ {
36
+ "key": "refreshToken",
37
+ "label": "Refresh token",
38
+ "scope": "account",
39
+ "secret": true,
40
+ "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."
41
+ }
42
+ ];
43
+ var GOOGLE_DOCS_OAUTH = {
44
+ "flow": "authorization_code",
45
+ "authorizeUrl": "https://accounts.google.com/o/oauth2/v2/auth",
46
+ "tokenUrl": "https://oauth2.googleapis.com/token",
47
+ "scopes": [
48
+ "https://www.googleapis.com/auth/documents"
49
+ ],
50
+ "accessTokenCredential": "accessToken",
51
+ "refreshTokenCredential": "refreshToken",
52
+ "accessTokenTtlSeconds": 3600
53
+ };
54
+ function googleDocsMeta(role, operation, docs) {
55
+ return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };
56
+ }
57
+ var GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
58
+ var GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
59
+ var GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta("action", "create a blank document", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create");
60
+ var GOOGLE_DOCS_DOCUMENT_OUTPUT = [
61
+ {
62
+ "path": "data.documentId",
63
+ "type": "string",
64
+ "description": "The id of the created document."
65
+ },
66
+ {
67
+ "path": "data.title",
68
+ "type": "string",
69
+ "description": "The title Google stored."
70
+ }
71
+ ];
72
+ var googleDocsDocumentKind = connectors.defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {
73
+ name: GOOGLE_DOCS_DOCUMENT_KIND,
74
+ aliases: ["google_docs_document"],
75
+ label: "Google Docs document",
76
+ description: "Create a blank Google Docs document.",
77
+ inputs: [{ id: "in" }],
78
+ outputs: [{ id: "out" }],
79
+ sideEffects: "unsafe-to-replay",
80
+ outputShape: GOOGLE_DOCS_DOCUMENT_OUTPUT,
81
+ configSchema: [
82
+ {
83
+ "type": "text",
84
+ "key": "title",
85
+ "label": "Title",
86
+ "required": true,
87
+ "description": "The title of the new blank document."
88
+ }
89
+ ],
90
+ defaultConfig: {
91
+ "mode": "auto"
92
+ },
93
+ renderBody: ({ config }) => connectors.summarize(GOOGLE_DOCS_DOCUMENT_META, config, "create a blank document")
94
+ });
95
+
96
+ // src/index.ts
97
+ var GOOGLE_DOCS_KINDS = [
98
+ googleDocsDocumentKind
99
+ ];
100
+
101
+ exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
102
+ exports.GOOGLE_DOCS_CREDENTIALS = GOOGLE_DOCS_CREDENTIALS;
103
+ exports.GOOGLE_DOCS_DOCUMENT_KIND = GOOGLE_DOCS_DOCUMENT_KIND;
104
+ exports.GOOGLE_DOCS_DOCUMENT_META = GOOGLE_DOCS_DOCUMENT_META;
105
+ exports.GOOGLE_DOCS_DOCUMENT_OPERATION = GOOGLE_DOCS_DOCUMENT_OPERATION;
106
+ exports.GOOGLE_DOCS_DOCUMENT_OUTPUT = GOOGLE_DOCS_DOCUMENT_OUTPUT;
107
+ exports.GOOGLE_DOCS_KINDS = GOOGLE_DOCS_KINDS;
108
+ exports.GOOGLE_DOCS_OAUTH = GOOGLE_DOCS_OAUTH;
109
+ exports.GOOGLE_DOCS_SERVICE = GOOGLE_DOCS_SERVICE;
110
+ exports.googleDocsDocumentKind = googleDocsDocumentKind;
111
+ exports.googleDocsMeta = googleDocsMeta;
112
+ //# sourceMappingURL=index.cjs.map
113
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/document-create.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":"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","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 { 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/** 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 */\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 \"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"]}
@@ -0,0 +1,130 @@
1
+ import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
2
+ import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
3
+ import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
4
+
5
+ /**
6
+ * GENERATED FILE — do not edit.
7
+ *
8
+ * Emitted from provider/manifest.json by weaver's generator.
9
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
10
+ * being rejected, because it works until it silently does not. Fix
11
+ * provider/manifest.json (or weaver's template/) and regenerate:
12
+ *
13
+ * npm run provider -- google_docs
14
+ */
15
+ /**
16
+ * Google Docs's identity on the authoring surface, shared by every Google Docs
17
+ * node.
18
+ *
19
+ * This file must import nothing from the js package: a PHP or Python project
20
+ * installs the ui package and never that one, and the import would be a
21
+ * dangling module the moment it did.
22
+ *
23
+ * ## The sandbox trap
24
+ *
25
+ * Google has no sandbox for Docs. A test document is a real one in a real
26
+ * Drive, so every create is real -- use the faker while developing and clean
27
+ * up any live test documents.
28
+ */
29
+
30
+ /**
31
+ * The connector API version this package was GENERATED against.
32
+ *
33
+ * A literal, never imported — an imported constant lets an upgrade rewrite the
34
+ * very claim it exists to detect.
35
+ */
36
+ declare const CONNECTOR_API_VERSION = 1;
37
+ /** The parts of a connector's identity that belong to the SERVICE, not the node. */
38
+ declare const GOOGLE_DOCS_SERVICE: {
39
+ readonly service: "google_docs";
40
+ readonly serviceTitle: "Google Docs";
41
+ readonly domain: "productivity";
42
+ readonly sandbox: "none";
43
+ };
44
+ /** The credentials a Google Docs connection holds. */
45
+ declare const GOOGLE_DOCS_CREDENTIALS: readonly [{
46
+ readonly key: "clientId";
47
+ readonly label: "OAuth client ID";
48
+ readonly scope: "provider";
49
+ readonly secret: false;
50
+ readonly help: "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.";
51
+ }, {
52
+ readonly key: "clientSecret";
53
+ readonly label: "OAuth client secret";
54
+ readonly scope: "provider";
55
+ readonly secret: true;
56
+ readonly help: "The client secret for the same OAuth app. One value for the whole installation.";
57
+ }, {
58
+ readonly key: "accessToken";
59
+ readonly label: "Access token";
60
+ readonly scope: "account";
61
+ readonly secret: true;
62
+ readonly help: "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.";
63
+ }, {
64
+ readonly key: "refreshToken";
65
+ readonly label: "Refresh token";
66
+ readonly scope: "account";
67
+ readonly secret: true;
68
+ readonly 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.";
69
+ }];
70
+ /**
71
+ * The OAuth2 exchange Google Docs requires — DECLARED here, performed by the
72
+ * host.
73
+ *
74
+ * A consent screen needs a browser, a redirect URI and somewhere to persist
75
+ * the result, and all three belong to the host; a package that ran the dance
76
+ * itself would have to own a web server. So this says precisely enough for a
77
+ * host to do it.
78
+ *
79
+ * The access token lasts 3600 seconds. A host that never refreshes will work
80
+ * all afternoon and be broken by morning, which is why the lifetime is stated
81
+ * rather than left to be discovered.
82
+ */
83
+ declare const GOOGLE_DOCS_OAUTH: {
84
+ readonly flow: "authorization_code";
85
+ readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
86
+ readonly tokenUrl: "https://oauth2.googleapis.com/token";
87
+ readonly scopes: readonly ["https://www.googleapis.com/auth/documents"];
88
+ readonly accessTokenCredential: "accessToken";
89
+ readonly refreshTokenCredential: "refreshToken";
90
+ readonly accessTokenTtlSeconds: 3600;
91
+ };
92
+ /** Build a Google Docs node's connector metadata from the operation it performs. */
93
+ declare function googleDocsMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
94
+
95
+ declare const GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
96
+ declare const GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
97
+ declare const GOOGLE_DOCS_DOCUMENT_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
98
+ /**
99
+ * What this node emits — the "ingredients" a downstream node can reference.
100
+ *
101
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
102
+ * picker, so declaring it is the whole of the work: an author configuring the
103
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
104
+ * and hoping.
105
+ */
106
+ declare const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[];
107
+ declare const googleDocsDocumentKind: NodeKindDefinition;
108
+
109
+ /**
110
+ * GENERATED FILE — do not edit.
111
+ *
112
+ * Emitted from provider/manifest.json by weaver's generator.
113
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
114
+ * being rejected, because it works until it silently does not. Fix
115
+ * provider/manifest.json (or weaver's template/) and regenerate:
116
+ *
117
+ * npm run provider -- google_docs
118
+ */
119
+ /**
120
+ * Google Docs's node kinds for fancy-flow.
121
+ *
122
+ * Install this on every host. The TypeScript executors live in the js
123
+ * package's `./flow` subpath; PHP and Python hosts run their own and need only
124
+ * this.
125
+ */
126
+
127
+ /** Every Google Docs kind, for a host that registers the lot. */
128
+ declare const GOOGLE_DOCS_KINDS: NodeKindDefinition[];
129
+
130
+ 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 };
@@ -0,0 +1,130 @@
1
+ import * as _particle_academy_fancy_flow_connectors from '@particle-academy/fancy-flow/connectors';
2
+ import { ConnectorMeta, OutputField } from '@particle-academy/fancy-flow/connectors';
3
+ import { NodeKindDefinition } from '@particle-academy/fancy-flow/engine';
4
+
5
+ /**
6
+ * GENERATED FILE — do not edit.
7
+ *
8
+ * Emitted from provider/manifest.json by weaver's generator.
9
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
10
+ * being rejected, because it works until it silently does not. Fix
11
+ * provider/manifest.json (or weaver's template/) and regenerate:
12
+ *
13
+ * npm run provider -- google_docs
14
+ */
15
+ /**
16
+ * Google Docs's identity on the authoring surface, shared by every Google Docs
17
+ * node.
18
+ *
19
+ * This file must import nothing from the js package: a PHP or Python project
20
+ * installs the ui package and never that one, and the import would be a
21
+ * dangling module the moment it did.
22
+ *
23
+ * ## The sandbox trap
24
+ *
25
+ * Google has no sandbox for Docs. A test document is a real one in a real
26
+ * Drive, so every create is real -- use the faker while developing and clean
27
+ * up any live test documents.
28
+ */
29
+
30
+ /**
31
+ * The connector API version this package was GENERATED against.
32
+ *
33
+ * A literal, never imported — an imported constant lets an upgrade rewrite the
34
+ * very claim it exists to detect.
35
+ */
36
+ declare const CONNECTOR_API_VERSION = 1;
37
+ /** The parts of a connector's identity that belong to the SERVICE, not the node. */
38
+ declare const GOOGLE_DOCS_SERVICE: {
39
+ readonly service: "google_docs";
40
+ readonly serviceTitle: "Google Docs";
41
+ readonly domain: "productivity";
42
+ readonly sandbox: "none";
43
+ };
44
+ /** The credentials a Google Docs connection holds. */
45
+ declare const GOOGLE_DOCS_CREDENTIALS: readonly [{
46
+ readonly key: "clientId";
47
+ readonly label: "OAuth client ID";
48
+ readonly scope: "provider";
49
+ readonly secret: false;
50
+ readonly help: "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account.";
51
+ }, {
52
+ readonly key: "clientSecret";
53
+ readonly label: "OAuth client secret";
54
+ readonly scope: "provider";
55
+ readonly secret: true;
56
+ readonly help: "The client secret for the same OAuth app. One value for the whole installation.";
57
+ }, {
58
+ readonly key: "accessToken";
59
+ readonly label: "Access token";
60
+ readonly scope: "account";
61
+ readonly secret: true;
62
+ readonly help: "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token.";
63
+ }, {
64
+ readonly key: "refreshToken";
65
+ readonly label: "Refresh token";
66
+ readonly scope: "account";
67
+ readonly secret: true;
68
+ readonly 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.";
69
+ }];
70
+ /**
71
+ * The OAuth2 exchange Google Docs requires — DECLARED here, performed by the
72
+ * host.
73
+ *
74
+ * A consent screen needs a browser, a redirect URI and somewhere to persist
75
+ * the result, and all three belong to the host; a package that ran the dance
76
+ * itself would have to own a web server. So this says precisely enough for a
77
+ * host to do it.
78
+ *
79
+ * The access token lasts 3600 seconds. A host that never refreshes will work
80
+ * all afternoon and be broken by morning, which is why the lifetime is stated
81
+ * rather than left to be discovered.
82
+ */
83
+ declare const GOOGLE_DOCS_OAUTH: {
84
+ readonly flow: "authorization_code";
85
+ readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
86
+ readonly tokenUrl: "https://oauth2.googleapis.com/token";
87
+ readonly scopes: readonly ["https://www.googleapis.com/auth/documents"];
88
+ readonly accessTokenCredential: "accessToken";
89
+ readonly refreshTokenCredential: "refreshToken";
90
+ readonly accessTokenTtlSeconds: 3600;
91
+ };
92
+ /** Build a Google Docs node's connector metadata from the operation it performs. */
93
+ declare function googleDocsMeta(role: ConnectorMeta["role"], operation: string, docs: string): ConnectorMeta;
94
+
95
+ declare const GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
96
+ declare const GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
97
+ declare const GOOGLE_DOCS_DOCUMENT_META: _particle_academy_fancy_flow_connectors.ConnectorMeta;
98
+ /**
99
+ * What this node emits — the "ingredients" a downstream node can reference.
100
+ *
101
+ * fancy-flow reads `outputShape` off the kind and offers it in the variable
102
+ * picker, so declaring it is the whole of the work: an author configuring the
103
+ * next node picks `{{ $json.data.id }}` off a list instead of typing a path
104
+ * and hoping.
105
+ */
106
+ declare const GOOGLE_DOCS_DOCUMENT_OUTPUT: OutputField[];
107
+ declare const googleDocsDocumentKind: NodeKindDefinition;
108
+
109
+ /**
110
+ * GENERATED FILE — do not edit.
111
+ *
112
+ * Emitted from provider/manifest.json by weaver's generator.
113
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
114
+ * being rejected, because it works until it silently does not. Fix
115
+ * provider/manifest.json (or weaver's template/) and regenerate:
116
+ *
117
+ * npm run provider -- google_docs
118
+ */
119
+ /**
120
+ * Google Docs's node kinds for fancy-flow.
121
+ *
122
+ * Install this on every host. The TypeScript executors live in the js
123
+ * package's `./flow` subpath; PHP and Python hosts run their own and need only
124
+ * this.
125
+ */
126
+
127
+ /** Every Google Docs kind, for a host that registers the lot. */
128
+ declare const GOOGLE_DOCS_KINDS: NodeKindDefinition[];
129
+
130
+ 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 };
package/dist/index.js ADDED
@@ -0,0 +1,101 @@
1
+ import { defineConnectorKind, summarize } from '@particle-academy/fancy-flow/connectors';
2
+
3
+ // src/service.ts
4
+ var CONNECTOR_API_VERSION = 1;
5
+ var GOOGLE_DOCS_SERVICE = {
6
+ service: "google_docs",
7
+ serviceTitle: "Google Docs",
8
+ domain: "productivity",
9
+ sandbox: "none"
10
+ };
11
+ var GOOGLE_DOCS_CREDENTIALS = [
12
+ {
13
+ "key": "clientId",
14
+ "label": "OAuth client ID",
15
+ "scope": "provider",
16
+ "secret": false,
17
+ "help": "From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account."
18
+ },
19
+ {
20
+ "key": "clientSecret",
21
+ "label": "OAuth client secret",
22
+ "scope": "provider",
23
+ "secret": true,
24
+ "help": "The client secret for the same OAuth app. One value for the whole installation."
25
+ },
26
+ {
27
+ "key": "accessToken",
28
+ "label": "Access token",
29
+ "scope": "account",
30
+ "secret": true,
31
+ "help": "Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token."
32
+ },
33
+ {
34
+ "key": "refreshToken",
35
+ "label": "Refresh token",
36
+ "scope": "account",
37
+ "secret": true,
38
+ "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."
39
+ }
40
+ ];
41
+ var GOOGLE_DOCS_OAUTH = {
42
+ "flow": "authorization_code",
43
+ "authorizeUrl": "https://accounts.google.com/o/oauth2/v2/auth",
44
+ "tokenUrl": "https://oauth2.googleapis.com/token",
45
+ "scopes": [
46
+ "https://www.googleapis.com/auth/documents"
47
+ ],
48
+ "accessTokenCredential": "accessToken",
49
+ "refreshTokenCredential": "refreshToken",
50
+ "accessTokenTtlSeconds": 3600
51
+ };
52
+ function googleDocsMeta(role, operation, docs) {
53
+ return { ...GOOGLE_DOCS_SERVICE, role, operation, docs };
54
+ }
55
+ var GOOGLE_DOCS_DOCUMENT_KIND = "@particle-academy/google_docs_document";
56
+ var GOOGLE_DOCS_DOCUMENT_OPERATION = "document_create";
57
+ var GOOGLE_DOCS_DOCUMENT_META = googleDocsMeta("action", "create a blank document", "https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create");
58
+ var GOOGLE_DOCS_DOCUMENT_OUTPUT = [
59
+ {
60
+ "path": "data.documentId",
61
+ "type": "string",
62
+ "description": "The id of the created document."
63
+ },
64
+ {
65
+ "path": "data.title",
66
+ "type": "string",
67
+ "description": "The title Google stored."
68
+ }
69
+ ];
70
+ var googleDocsDocumentKind = defineConnectorKind(GOOGLE_DOCS_DOCUMENT_META, {
71
+ name: GOOGLE_DOCS_DOCUMENT_KIND,
72
+ aliases: ["google_docs_document"],
73
+ label: "Google Docs document",
74
+ description: "Create a blank Google Docs document.",
75
+ inputs: [{ id: "in" }],
76
+ outputs: [{ id: "out" }],
77
+ sideEffects: "unsafe-to-replay",
78
+ outputShape: GOOGLE_DOCS_DOCUMENT_OUTPUT,
79
+ configSchema: [
80
+ {
81
+ "type": "text",
82
+ "key": "title",
83
+ "label": "Title",
84
+ "required": true,
85
+ "description": "The title of the new blank document."
86
+ }
87
+ ],
88
+ defaultConfig: {
89
+ "mode": "auto"
90
+ },
91
+ renderBody: ({ config }) => summarize(GOOGLE_DOCS_DOCUMENT_META, config, "create a blank document")
92
+ });
93
+
94
+ // src/index.ts
95
+ var GOOGLE_DOCS_KINDS = [
96
+ googleDocsDocumentKind
97
+ ];
98
+
99
+ 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 };
100
+ //# sourceMappingURL=index.js.map
101
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/service.ts","../src/kinds/document-create.ts","../src/index.ts"],"names":[],"mappings":"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","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 { 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/** 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 */\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 \"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"]}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@particle-academy/google-docs-ui",
3
+ "version": "0.1.0",
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
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Fancy-Friends/google-docs.git"
8
+ },
9
+ "homepage": "https://github.com/Fancy-Friends/google-docs#readme",
10
+ "bugs": "https://github.com/Fancy-Friends/google-docs/issues",
11
+ "type": "module",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "require": {
22
+ "types": "./dist/index.d.cts",
23
+ "default": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md",
31
+ "CHANGELOG.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsup",
36
+ "lint": "tsc --noEmit",
37
+ "test": "node --import tsx --test tests/*.test.ts",
38
+ "prepublishOnly": "tsup"
39
+ },
40
+ "dependencies": {},
41
+ "peerDependencies": {
42
+ "@particle-academy/fancy-flow": ">=0.48.0 <2.0"
43
+ },
44
+ "devDependencies": {
45
+ "@particle-academy/fancy-flow": ">=0.48.0 <2.0",
46
+ "@types/node": "^26.2.0",
47
+ "tsup": "^8.5.0",
48
+ "tsx": "^4.19.0",
49
+ "typescript": "^5.8.0"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "keywords": [
55
+ "google_docs",
56
+ "productivity",
57
+ "connector",
58
+ "fancy-flow",
59
+ "fancy-ui",
60
+ "particle-academy"
61
+ ],
62
+ "license": "MIT",
63
+ "sideEffects": false,
64
+ "engines": {
65
+ "node": ">=22"
66
+ }
67
+ }