@particle-academy/google-sheets-ui 0.1.0 → 0.3.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 +61 -0
- package/README.md +52 -0
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,65 @@ 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.3.0] — 2026-08-24
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **The README now says how to SET THIS CONNECTOR UP**, in the package itself.
|
|
16
|
+
|
|
17
|
+
Until now it explained what the four packages are, what they cost and why the
|
|
18
|
+
repo is generated — and said nothing about credentials, scopes, sandboxes or
|
|
19
|
+
operations. Somebody who installed it could not learn from it which credentials
|
|
20
|
+
a connection needs, where a human GETS them, which scopes to request, or what
|
|
21
|
+
the connector can actually do. All of that was already in the definition; the
|
|
22
|
+
one document a consumer reads was the one that omitted everything actionable.
|
|
23
|
+
|
|
24
|
+
The new **Setting it up** section carries:
|
|
25
|
+
|
|
26
|
+
- every credential, with the text saying where the value comes from, whether it
|
|
27
|
+
is **per installation** or **per connected account**, and whether it is secret;
|
|
28
|
+
- the OAuth authorize and token URLs and the exact scopes, verbatim;
|
|
29
|
+
- the access-token lifetime, and where refresh tokens ROTATE, the two things a
|
|
30
|
+
host must not do — retry a failed refresh, or refresh concurrently — because a
|
|
31
|
+
replay revokes the entire grant and nothing in the failure says why;
|
|
32
|
+
- the estate in this provider's own terms, including the cases where a
|
|
33
|
+
successful-looking run reaches nobody, or reaches the real one;
|
|
34
|
+
- every action and trigger with its method, path, inputs, and whether it is safe
|
|
35
|
+
to replay;
|
|
36
|
+
- a trigger's provider-side setup, which nobody can derive from anything else.
|
|
37
|
+
|
|
38
|
+
It is **generated from `provider/manifest.json`**, so it cannot drift from what
|
|
39
|
+
the packages do — which is the point at a few hundred providers, where a
|
|
40
|
+
hand-written setup section is a few hundred documents going quietly stale.
|
|
41
|
+
|
|
42
|
+
No code changed. This release exists because a registry and an installing agent
|
|
43
|
+
read the PUBLISHED artifact, and the artifact carried the old README.
|
|
44
|
+
|
|
45
|
+
## [0.2.0] — 2026-08-24
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- **`@particle-academy/google-sheets-ui` is now an OPTIONAL PEER dependency of `@particle-academy/google-sheets-js`, not a hard one.**
|
|
50
|
+
|
|
51
|
+
`./flow` needs it; nothing else does. It was a hard dependency, and because
|
|
52
|
+
`@particle-academy/google-sheets-ui` itself peer-depends on `fancy-flow` — which npm 7+ installs
|
|
53
|
+
automatically — `npm install @particle-academy/google-sheets-js` pulled the **entire flow engine**
|
|
54
|
+
onto disk for a consumer who only wanted to call the API. Roughly **18 MB
|
|
55
|
+
became 874 KB**, and the package works exactly as before:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
import { googleSheets… } from "@particle-academy/google-sheets-js";
|
|
59
|
+
// an injected transport, no flow engine anywhere
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**This is breaking if you use `@particle-academy/google-sheets-js/flow`.** Add `@particle-academy/google-sheets-ui` to your own
|
|
63
|
+
dependencies — it was always being installed for you, and now it is declared.
|
|
64
|
+
Everything importing only the main entry point is unaffected.
|
|
65
|
+
|
|
66
|
+
The fix is on this edge rather than on `@particle-academy/google-sheets-ui` → `fancy-flow`: the ui package
|
|
67
|
+
genuinely requires fancy-flow, since it calls `defineConnectorKind`, and marking
|
|
68
|
+
that peer optional would be a lie about what it needs.
|
|
69
|
+
|
|
11
70
|
## [0.1.0] — 2026-08-23
|
|
12
71
|
|
|
13
72
|
First release. Provider eight, and the first Google connector.
|
|
@@ -72,3 +131,5 @@ which is why `refreshToken` is required rather than optional — and Google only
|
|
|
72
131
|
issues one when the consent request asked for offline access.
|
|
73
132
|
|
|
74
133
|
[0.1.0]: https://github.com/Fancy-Friends/google-sheets/releases/tag/v0.1.0
|
|
134
|
+
[0.2.0]: https://github.com/Fancy-Friends/google-sheets/releases/tag/v0.2.0
|
|
135
|
+
[0.3.0]: https://github.com/Fancy-Friends/google-sheets/releases/tag/v0.3.0
|
package/README.md
CHANGED
|
@@ -27,6 +27,58 @@ dependencies.
|
|
|
27
27
|
subject to the kit's full approval bar, and one per provider is hundreds of
|
|
28
28
|
dependencies nobody is tracking.
|
|
29
29
|
|
|
30
|
+
## Setting it up
|
|
31
|
+
|
|
32
|
+
Everything below is generated from `provider/manifest.json`, so it cannot disagree with what the packages do.
|
|
33
|
+
|
|
34
|
+
### Credentials
|
|
35
|
+
|
|
36
|
+
A Google Sheets connection holds 4 values.
|
|
37
|
+
|
|
38
|
+
**Two kinds of value, and mixing them up matters.** A `provider` credential is ONE value for the whole installation — an OAuth app's client secret serves every connected account. An `account` credential is one per connected account. A host that stores the second where it stores the first lets one account's credentials reach another's.
|
|
39
|
+
|
|
40
|
+
| Field | Scope | Secret | Where it comes from |
|
|
41
|
+
|---|---|---|---|
|
|
42
|
+
| **OAuth client ID** | per installation | not secret | From Google Cloud Console -> APIs & Services -> Credentials. ONE value for the whole installation, not per connected account. |
|
|
43
|
+
| **OAuth client secret** | per installation | **secret** | The client secret for the same OAuth app. One value for the whole installation. |
|
|
44
|
+
| **Access token** | per connected account | **secret** | Per connected Google account, and it expires after ONE HOUR. The host refreshes it with the refresh token. |
|
|
45
|
+
| **Refresh token** | per connected account | **secret** | Per connected Google account. Google issues one only when the consent request asks for offline access; without it the connection dies within the hour. |
|
|
46
|
+
|
|
47
|
+
### Authorising
|
|
48
|
+
|
|
49
|
+
Google Sheets uses OAuth2 (authorization_code). The package DECLARES the exchange; the HOST performs it — a consent screen needs a browser, a redirect URI and somewhere to persist the result, and all three belong to the host.
|
|
50
|
+
|
|
51
|
+
- **Authorize URL** — https://accounts.google.com/o/oauth2/v2/auth
|
|
52
|
+
- **Token URL** — https://oauth2.googleapis.com/token
|
|
53
|
+
- **Scopes** — `https://www.googleapis.com/auth/spreadsheets`
|
|
54
|
+
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
55
|
+
|
|
56
|
+
The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
|
|
57
|
+
|
|
58
|
+
### The estate
|
|
59
|
+
|
|
60
|
+
**Google Sheets has no test estate, and somebody checked.** Everything this connector does is real. Use the faker to build against it.
|
|
61
|
+
|
|
62
|
+
> Google has no sandbox for Sheets. A test spreadsheet is a real one in a real Drive, so every append is real -- point this at a scratch sheet, not a production one. The faker is the only way to develop against it without touching a document.
|
|
63
|
+
|
|
64
|
+
## What it can do
|
|
65
|
+
|
|
66
|
+
### Actions
|
|
67
|
+
|
|
68
|
+
#### `row_append` — Google Sheets row
|
|
69
|
+
|
|
70
|
+
Append a row to a Google Sheet.
|
|
71
|
+
|
|
72
|
+
`POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append` · **unsafe to replay** — a retried durable run does it TWICE
|
|
73
|
+
|
|
74
|
+
| Input | Required | What it is |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `spreadsheetId` | yes | The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit. |
|
|
77
|
+
| `range` | yes | Where to append, in A1 notation. Google finds the last row of this range and writes below it. |
|
|
78
|
+
| `values` | yes | The cells of the row, comma separated. Left to right from the start of the range. |
|
|
79
|
+
| `valueInputOption` | no | USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given. |
|
|
80
|
+
| `insertDataOption` | no | INSERT_ROWS pushes existing rows down. OVERWRITE writes into them. |
|
|
81
|
+
|
|
30
82
|
## Run it before you have credentials
|
|
31
83
|
|
|
32
84
|
Every operation ships a **faker**, whether or not Google Sheets has a sandbox. Set a
|
package/dist/index.cjs
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/service.ts","../src/kinds/row-append.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAmCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,eAAA;AAAA,EACT,YAAA,EAAc,eAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,yBAAA,GAA4B;AAAA,EACvC;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;AAeO,IAAM,mBAAA,GAAsB;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,cAAA,EAAgB,8CAAA;AAAA,E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AS;AAAA;AACX;AACF;AACF,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAA,CAAU,sBAAA,EAAwB,QAAmC,cAAc;AACvF,CAAC;;;ACzGM,IAAM,mBAAA,GAA4C;AAAA,EACvD;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_sheets\n */\n\n/**\n * Google Sheets's identity on the authoring surface, shared by every Google\n * Sheets 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 Sheets. A test spreadsheet is a real one in a real\n * Drive, so every append is real -- point this at a scratch sheet, not a\n * production one. The faker is the only way to develop against it without\n * touching a document.\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_SHEETS_SERVICE = {\n service: \"google_sheets\",\n serviceTitle: \"Google Sheets\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Sheets connection holds. */\nexport const GOOGLE_SHEETS_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 Sheets 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_SHEETS_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/spreadsheets\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Sheets node's connector metadata from the operation it performs. */\nexport function googleSheetsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/row-append.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/row-append.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets row — Append a row to a Google Sheet.\n *\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\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 { googleSheetsMeta } from \"../service.js\";\n\nexport const GOOGLE_SHEETS_ROW_KIND = \"@particle-academy/google_sheets_row\";\nexport const GOOGLE_SHEETS_ROW_OPERATION = \"row_append\";\n\nexport const GOOGLE_SHEETS_ROW_META = googleSheetsMeta(\"action\", \"append a row\", \"https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\");\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_SHEETS_ROW_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.spreadsheetId\",\n \"type\": \"string\",\n \"description\": \"The spreadsheet that was written to.\"\n },\n {\n \"path\": \"data.updates.updatedRange\",\n \"type\": \"string\",\n \"description\": \"The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it.\"\n },\n {\n \"path\": \"data.updates.updatedRows\",\n \"type\": \"number\",\n \"description\": \"How many rows were added.\"\n },\n {\n \"path\": \"data.updates.updatedCells\",\n \"type\": \"number\",\n \"description\": \"How many cells were written.\"\n }\n];\n\nexport const googleSheetsRowKind: NodeKindDefinition = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {\n name: GOOGLE_SHEETS_ROW_KIND,\n aliases: [\"google_sheets_row\"],\n label: \"Google Sheets row\",\n description: \"Append a row to a Google Sheet.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_SHEETS_ROW_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"spreadsheetId\",\n \"label\": \"Spreadsheet ID\",\n \"required\": true,\n \"description\": \"The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"range\",\n \"label\": \"Range\",\n \"required\": true,\n \"default\": \"Sheet1!A:Z\",\n \"description\": \"Where to append, in A1 notation. Google finds the last row of this range and writes below it.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"values\",\n \"label\": \"Row values\",\n \"required\": true,\n \"description\": \"The cells of the row, comma separated. Left to right from the start of the range.\"\n },\n {\n \"type\": \"select\",\n \"key\": \"valueInputOption\",\n \"label\": \"How to interpret the values\",\n \"default\": \"USER_ENTERED\",\n \"description\": \"USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.\",\n \"options\": [\n {\n \"value\": \"USER_ENTERED\",\n \"label\": \"As if typed (formulas and dates parsed)\"\n },\n {\n \"value\": \"RAW\",\n \"label\": \"Exactly as given\"\n }\n ]\n },\n {\n \"type\": \"select\",\n \"key\": \"insertDataOption\",\n \"label\": \"When the range already has data below\",\n \"default\": \"INSERT_ROWS\",\n \"description\": \"INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.\",\n \"options\": [\n {\n \"value\": \"INSERT_ROWS\",\n \"label\": \"Insert new rows\"\n },\n {\n \"value\": \"OVERWRITE\",\n \"label\": \"Overwrite what is there\"\n }\n ]\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_SHEETS_ROW_META, config as Record<string, unknown>, \"append a row\"),\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_sheets\n */\n\n/**\n * Google Sheets'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/row-append.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleSheetsRowKind } from \"./kinds/row-append.js\";\n\n/** Every Google Sheets kind, for a host that registers the lot. */\nexport const GOOGLE_SHEETS_KINDS: NodeKindDefinition[] = [\n googleSheetsRowKind,\n];\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/row-append.ts","../src/index.ts"],"names":["defineConnectorKind","summarize"],"mappings":";;;;;AAmCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,eAAA;AAAA,EACT,YAAA,EAAc,eAAA;AAAA,EACd,MAAA,EAAQ,cAAA;AAAA,EACR,OAAA,EAAS;AACX;AAGO,IAAM,yBAAA,GAA4B;AAAA,EACvC;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,IAC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AA;AAAA,MACX,aAAA,EAAe,oEAAA;AAAA,MACf,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,aAAA;AAAA,UACT,OAAA,EAAS;AAAA,SACX;AAAA,QACA;AAAA,UACE,OAAA,EAAS,WAAA;AAAA,UACT,OAAA,EAAS;AAAA;AACX;AACF;AACF,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACbC,oBAAA,CAAU,sBAAA,EAAwB,QAAmC,cAAc;AACvF,CAAC;;;ACzGM,IAAM,mBAAA,GAA4C;AAAA,EACvD;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_sheets\n */\n\n/**\n * Google Sheets's identity on the authoring surface, shared by every Google\n * Sheets 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 Sheets. A test spreadsheet is a real one in a real\n * Drive, so every append is real -- point this at a scratch sheet, not a\n * production one. The faker is the only way to develop against it without\n * touching a document.\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_SHEETS_SERVICE = {\n service: \"google_sheets\",\n serviceTitle: \"Google Sheets\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Sheets connection holds. */\nexport const GOOGLE_SHEETS_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 Sheets 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_SHEETS_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/spreadsheets\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Sheets node's connector metadata from the operation it performs. */\nexport function googleSheetsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/row-append.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/row-append.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets row — Append a row to a Google Sheet.\n *\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\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 { googleSheetsMeta } from \"../service.js\";\n\nexport const GOOGLE_SHEETS_ROW_KIND = \"@particle-academy/google_sheets_row\";\nexport const GOOGLE_SHEETS_ROW_OPERATION = \"row_append\";\n\nexport const GOOGLE_SHEETS_ROW_META = googleSheetsMeta(\"action\", \"append a row\", \"https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\");\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_SHEETS_ROW_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.spreadsheetId\",\n \"type\": \"string\",\n \"description\": \"The spreadsheet that was written to.\"\n },\n {\n \"path\": \"data.updates.updatedRange\",\n \"type\": \"string\",\n \"description\": \"The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it.\"\n },\n {\n \"path\": \"data.updates.updatedRows\",\n \"type\": \"number\",\n \"description\": \"How many rows were added.\"\n },\n {\n \"path\": \"data.updates.updatedCells\",\n \"type\": \"number\",\n \"description\": \"How many cells were written.\"\n }\n];\n\nexport const googleSheetsRowKind: NodeKindDefinition = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {\n name: GOOGLE_SHEETS_ROW_KIND,\n aliases: [\"google_sheets_row\"],\n label: \"Google Sheets row\",\n description: \"Append a row to a Google Sheet.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_SHEETS_ROW_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"spreadsheetId\",\n \"label\": \"Spreadsheet ID\",\n \"required\": true,\n \"description\": \"The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"range\",\n \"label\": \"Range\",\n \"required\": true,\n \"default\": \"Sheet1!A:Z\",\n \"description\": \"Where to append, in A1 notation. Google finds the last row of this range and writes below it.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"values\",\n \"label\": \"Row values\",\n \"required\": true,\n \"description\": \"The cells of the row, comma separated. Left to right from the start of the range.\"\n },\n {\n \"type\": \"select\",\n \"key\": \"valueInputOption\",\n \"label\": \"How to interpret the values\",\n \"default\": \"USER_ENTERED\",\n \"description\": \"USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.\",\n \"options\": [\n {\n \"value\": \"USER_ENTERED\",\n \"label\": \"As if typed (formulas and dates parsed)\"\n },\n {\n \"value\": \"RAW\",\n \"label\": \"Exactly as given\"\n }\n ]\n },\n {\n \"type\": \"select\",\n \"key\": \"insertDataOption\",\n \"label\": \"When the range already has data below\",\n \"default\": \"INSERT_ROWS\",\n \"description\": \"INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.\",\n \"options\": [\n {\n \"value\": \"INSERT_ROWS\",\n \"label\": \"Insert new rows\"\n },\n {\n \"value\": \"OVERWRITE\",\n \"label\": \"Overwrite what is there\"\n }\n ]\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_SHEETS_ROW_META, config as Record<string, unknown>, \"append a row\"),\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_sheets\n */\n\n/**\n * Google Sheets'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/row-append.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleSheetsRowKind } from \"./kinds/row-append.js\";\n\n/** Every Google Sheets kind, for a host that registers the lot. */\nexport const GOOGLE_SHEETS_KINDS: NodeKindDefinition[] = [\n googleSheetsRowKind,\n];\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -80,6 +80,11 @@ declare const GOOGLE_SHEETS_CREDENTIALS: readonly [{
|
|
|
80
80
|
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
81
81
|
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
82
82
|
* rather than left to be discovered.
|
|
83
|
+
*
|
|
84
|
+
* Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may
|
|
85
|
+
* safely be retried and may run concurrently. That is stated rather than
|
|
86
|
+
* assumed because the opposite — a provider that spends the token and revokes
|
|
87
|
+
* the grant on a replay — looks identical until it happens.
|
|
83
88
|
*/
|
|
84
89
|
declare const GOOGLE_SHEETS_OAUTH: {
|
|
85
90
|
readonly flow: "authorization_code";
|
|
@@ -88,6 +93,7 @@ declare const GOOGLE_SHEETS_OAUTH: {
|
|
|
88
93
|
readonly scopes: readonly ["https://www.googleapis.com/auth/spreadsheets"];
|
|
89
94
|
readonly accessTokenCredential: "accessToken";
|
|
90
95
|
readonly refreshTokenCredential: "refreshToken";
|
|
96
|
+
readonly refreshTokenRotates: false;
|
|
91
97
|
readonly accessTokenTtlSeconds: 3600;
|
|
92
98
|
};
|
|
93
99
|
/** Build a Google Sheets node's connector metadata from the operation it performs. */
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,11 @@ declare const GOOGLE_SHEETS_CREDENTIALS: readonly [{
|
|
|
80
80
|
* The access token lasts 3600 seconds. A host that never refreshes will work
|
|
81
81
|
* all afternoon and be broken by morning, which is why the lifetime is stated
|
|
82
82
|
* rather than left to be discovered.
|
|
83
|
+
*
|
|
84
|
+
* Its refresh tokens do NOT rotate: the same one is reusable, so a refresh may
|
|
85
|
+
* safely be retried and may run concurrently. That is stated rather than
|
|
86
|
+
* assumed because the opposite — a provider that spends the token and revokes
|
|
87
|
+
* the grant on a replay — looks identical until it happens.
|
|
83
88
|
*/
|
|
84
89
|
declare const GOOGLE_SHEETS_OAUTH: {
|
|
85
90
|
readonly flow: "authorization_code";
|
|
@@ -88,6 +93,7 @@ declare const GOOGLE_SHEETS_OAUTH: {
|
|
|
88
93
|
readonly scopes: readonly ["https://www.googleapis.com/auth/spreadsheets"];
|
|
89
94
|
readonly accessTokenCredential: "accessToken";
|
|
90
95
|
readonly refreshTokenCredential: "refreshToken";
|
|
96
|
+
readonly refreshTokenRotates: false;
|
|
91
97
|
readonly accessTokenTtlSeconds: 3600;
|
|
92
98
|
};
|
|
93
99
|
/** Build a Google Sheets node's connector metadata from the operation it performs. */
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/service.ts","../src/kinds/row-append.ts","../src/index.ts"],"names":[],"mappings":";;;AAmCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,qBAAA,GAAwB;AAAA,EACnC,OAAA,EAAS,eAAA;AAAA,EACT,YAAA,E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aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,MAAA;AAAA,MACR,KAAA,EAAO,QAAA;AAAA,MACP,OAAA,EAAS,YAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,aAAA,EAAe;AAAA,KACjB;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,QAAA;AAAA,MACR,KAAA,EAAO,kBAAA;AAAA,MACP,OAAA,EAAS,6BAAA;AAAA,MACT,SAAA,EAAW,cAAA;AAAA,MACX,aAAA,EAAe,iKAAA;AAAA,MACf,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,cAAA;AAAA,UACT,OAAA,EAAS;AAAA,SACX;AAAA,QACA;AAAA,UACE,OAAA,EAAS,KAAA;AAAA,UACT,OAAA,EAAS;AAAA;AACX;AACF,KACF;AAAA,IACA;AAAA,MACE,MAAA,EAAQ,QAAA;AAAA,MACR,KAAA,EAAO,kBAAA;AAAA,MACP,OAAA,EAAS,uCAAA;AAAA,MACT,SAAA,EAAW,aAAA;AAAA,MACX,aAAA,EAAe,oEAAA;AAAA,MACf,SAAA,EAAW;AAAA,QACT;AAAA,UACE,OAAA,EAAS,aAAA;AAAA,UACT,OAAA,EAAS;AAAA,SACX;AAAA,QACA;AAAA,UACE,OAAA,EAAS,WAAA;AAAA,UACT,OAAA,EAAS;AAAA;AACX;AACF;AACF,GACF;AAAA,EACA,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,UAAA,EAAY,CAAC,EAAE,MAAA,OACb,SAAA,CAAU,sBAAA,EAAwB,QAAmC,cAAc;AACvF,CAAC;;;ACzGM,IAAM,mBAAA,GAA4C;AAAA,EACvD;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_sheets\n */\n\n/**\n * Google Sheets's identity on the authoring surface, shared by every Google\n * Sheets 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 Sheets. A test spreadsheet is a real one in a real\n * Drive, so every append is real -- point this at a scratch sheet, not a\n * production one. The faker is the only way to develop against it without\n * touching a document.\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_SHEETS_SERVICE = {\n service: \"google_sheets\",\n serviceTitle: \"Google Sheets\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Sheets connection holds. */\nexport const GOOGLE_SHEETS_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 Sheets 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_SHEETS_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/spreadsheets\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Sheets node's connector metadata from the operation it performs. */\nexport function googleSheetsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/row-append.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/row-append.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets row — Append a row to a Google Sheet.\n *\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\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 { googleSheetsMeta } from \"../service.js\";\n\nexport const GOOGLE_SHEETS_ROW_KIND = \"@particle-academy/google_sheets_row\";\nexport const GOOGLE_SHEETS_ROW_OPERATION = \"row_append\";\n\nexport const GOOGLE_SHEETS_ROW_META = googleSheetsMeta(\"action\", \"append a row\", \"https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\");\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_SHEETS_ROW_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.spreadsheetId\",\n \"type\": \"string\",\n \"description\": \"The spreadsheet that was written to.\"\n },\n {\n \"path\": \"data.updates.updatedRange\",\n \"type\": \"string\",\n \"description\": \"The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it.\"\n },\n {\n \"path\": \"data.updates.updatedRows\",\n \"type\": \"number\",\n \"description\": \"How many rows were added.\"\n },\n {\n \"path\": \"data.updates.updatedCells\",\n \"type\": \"number\",\n \"description\": \"How many cells were written.\"\n }\n];\n\nexport const googleSheetsRowKind: NodeKindDefinition = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {\n name: GOOGLE_SHEETS_ROW_KIND,\n aliases: [\"google_sheets_row\"],\n label: \"Google Sheets row\",\n description: \"Append a row to a Google Sheet.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_SHEETS_ROW_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"spreadsheetId\",\n \"label\": \"Spreadsheet ID\",\n \"required\": true,\n \"description\": \"The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"range\",\n \"label\": \"Range\",\n \"required\": true,\n \"default\": \"Sheet1!A:Z\",\n \"description\": \"Where to append, in A1 notation. Google finds the last row of this range and writes below it.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"values\",\n \"label\": \"Row values\",\n \"required\": true,\n \"description\": \"The cells of the row, comma separated. Left to right from the start of the range.\"\n },\n {\n \"type\": \"select\",\n \"key\": \"valueInputOption\",\n \"label\": \"How to interpret the values\",\n \"default\": \"USER_ENTERED\",\n \"description\": \"USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.\",\n \"options\": [\n {\n \"value\": \"USER_ENTERED\",\n \"label\": \"As if typed (formulas and dates parsed)\"\n },\n {\n \"value\": \"RAW\",\n \"label\": \"Exactly as given\"\n }\n ]\n },\n {\n \"type\": \"select\",\n \"key\": \"insertDataOption\",\n \"label\": \"When the range already has data below\",\n \"default\": \"INSERT_ROWS\",\n \"description\": \"INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.\",\n \"options\": [\n {\n \"value\": \"INSERT_ROWS\",\n \"label\": \"Insert new rows\"\n },\n {\n \"value\": \"OVERWRITE\",\n \"label\": \"Overwrite what is there\"\n }\n ]\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_SHEETS_ROW_META, config as Record<string, unknown>, \"append a row\"),\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_sheets\n */\n\n/**\n * Google Sheets'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/row-append.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleSheetsRowKind } from \"./kinds/row-append.js\";\n\n/** Every Google Sheets kind, for a host that registers the lot. */\nexport const GOOGLE_SHEETS_KINDS: NodeKindDefinition[] = [\n googleSheetsRowKind,\n];\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/service.ts","../src/kinds/row-append.ts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;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_sheets\n */\n\n/**\n * Google Sheets's identity on the authoring surface, shared by every Google\n * Sheets 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 Sheets. A test spreadsheet is a real one in a real\n * Drive, so every append is real -- point this at a scratch sheet, not a\n * production one. The faker is the only way to develop against it without\n * touching a document.\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_SHEETS_SERVICE = {\n service: \"google_sheets\",\n serviceTitle: \"Google Sheets\",\n domain: \"productivity\",\n sandbox: \"none\",\n} as const satisfies Pick<ConnectorMeta, \"service\" | \"serviceTitle\" | \"domain\" | \"sandbox\">;\n\n/** The credentials a Google Sheets connection holds. */\nexport const GOOGLE_SHEETS_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 Sheets 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_SHEETS_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/spreadsheets\"\n ],\n \"accessTokenCredential\": \"accessToken\",\n \"refreshTokenCredential\": \"refreshToken\",\n \"refreshTokenRotates\": false,\n \"accessTokenTtlSeconds\": 3600\n} as const;\n\n/** Build a Google Sheets node's connector metadata from the operation it performs. */\nexport function googleSheetsMeta(\n role: ConnectorMeta[\"role\"],\n operation: string,\n docs: string,\n): ConnectorMeta {\n return { ...GOOGLE_SHEETS_SERVICE, role, operation, docs };\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/row-append.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/row-append.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets row — Append a row to a Google Sheet.\n *\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\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 { googleSheetsMeta } from \"../service.js\";\n\nexport const GOOGLE_SHEETS_ROW_KIND = \"@particle-academy/google_sheets_row\";\nexport const GOOGLE_SHEETS_ROW_OPERATION = \"row_append\";\n\nexport const GOOGLE_SHEETS_ROW_META = googleSheetsMeta(\"action\", \"append a row\", \"https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\");\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_SHEETS_ROW_OUTPUT: OutputField[] = [\n {\n \"path\": \"data.spreadsheetId\",\n \"type\": \"string\",\n \"description\": \"The spreadsheet that was written to.\"\n },\n {\n \"path\": \"data.updates.updatedRange\",\n \"type\": \"string\",\n \"description\": \"The range Google actually wrote, in A1 notation. NOT the range that was asked for -- append finds the first empty row below it.\"\n },\n {\n \"path\": \"data.updates.updatedRows\",\n \"type\": \"number\",\n \"description\": \"How many rows were added.\"\n },\n {\n \"path\": \"data.updates.updatedCells\",\n \"type\": \"number\",\n \"description\": \"How many cells were written.\"\n }\n];\n\nexport const googleSheetsRowKind: NodeKindDefinition = defineConnectorKind(GOOGLE_SHEETS_ROW_META, {\n name: GOOGLE_SHEETS_ROW_KIND,\n aliases: [\"google_sheets_row\"],\n label: \"Google Sheets row\",\n description: \"Append a row to a Google Sheet.\",\n inputs: [{ id: \"in\" }],\n outputs: [{ id: \"out\" }],\n sideEffects: \"unsafe-to-replay\",\n outputShape: GOOGLE_SHEETS_ROW_OUTPUT,\n configSchema: [\n {\n \"type\": \"text\",\n \"key\": \"spreadsheetId\",\n \"label\": \"Spreadsheet ID\",\n \"required\": true,\n \"description\": \"The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"range\",\n \"label\": \"Range\",\n \"required\": true,\n \"default\": \"Sheet1!A:Z\",\n \"description\": \"Where to append, in A1 notation. Google finds the last row of this range and writes below it.\"\n },\n {\n \"type\": \"text\",\n \"key\": \"values\",\n \"label\": \"Row values\",\n \"required\": true,\n \"description\": \"The cells of the row, comma separated. Left to right from the start of the range.\"\n },\n {\n \"type\": \"select\",\n \"key\": \"valueInputOption\",\n \"label\": \"How to interpret the values\",\n \"default\": \"USER_ENTERED\",\n \"description\": \"USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given.\",\n \"options\": [\n {\n \"value\": \"USER_ENTERED\",\n \"label\": \"As if typed (formulas and dates parsed)\"\n },\n {\n \"value\": \"RAW\",\n \"label\": \"Exactly as given\"\n }\n ]\n },\n {\n \"type\": \"select\",\n \"key\": \"insertDataOption\",\n \"label\": \"When the range already has data below\",\n \"default\": \"INSERT_ROWS\",\n \"description\": \"INSERT_ROWS pushes existing rows down. OVERWRITE writes into them.\",\n \"options\": [\n {\n \"value\": \"INSERT_ROWS\",\n \"label\": \"Insert new rows\"\n },\n {\n \"value\": \"OVERWRITE\",\n \"label\": \"Overwrite what is there\"\n }\n ]\n }\n ],\n defaultConfig: {\n \"mode\": \"auto\"\n },\n renderBody: ({ config }) =>\n summarize(GOOGLE_SHEETS_ROW_META, config as Record<string, unknown>, \"append a row\"),\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_sheets\n */\n\n/**\n * Google Sheets'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/row-append.js\";\n\nimport type { NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport { googleSheetsRowKind } from \"./kinds/row-append.js\";\n\n/** Every Google Sheets kind, for a host that registers the lot. */\nexport const GOOGLE_SHEETS_KINDS: NodeKindDefinition[] = [\n googleSheetsRowKind,\n];\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-academy/google-sheets-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Google Sheets'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",
|