@particle-academy/google-sheets-js 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +18 -0
- package/dist/{chunk-L2NNYKEK.js → chunk-Q7SFJ5VK.js} +47 -3
- package/dist/chunk-Q7SFJ5VK.js.map +1 -0
- package/dist/flow.cjs +60 -0
- package/dist/flow.cjs.map +1 -1
- package/dist/flow.d.cts +2 -1
- package/dist/flow.d.ts +2 -1
- package/dist/flow.js +18 -3
- package/dist/flow.js.map +1 -1
- package/dist/index.cjs +46 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-L2NNYKEK.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,43 @@ The four packages share one version, because they are generated from one
|
|
|
8
8
|
`provider/` definition and a version that meant something different in each
|
|
9
9
|
would be a version nobody could reason about.
|
|
10
10
|
|
|
11
|
+
## [0.7.0] — 2026-11-08
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`batch_update`**: any list of Google Sheets API requests, as JSON, applied
|
|
16
|
+
all or none. Text replacement is a `findReplace` request, for example
|
|
17
|
+
`[{"findReplace":{"find":"{{name}}","replacement":"Ada","allSheets":true}}]`.
|
|
18
|
+
There is no separate `text_replace` for Sheets: `findReplace` needs exactly
|
|
19
|
+
one of `range`, `sheetId` and `allSheets`, which config fields cannot express
|
|
20
|
+
safely. Unlike Docs and Slides, Google offers **no revision guard** on a
|
|
21
|
+
Sheets batch.
|
|
22
|
+
|
|
23
|
+
## [0.6.0] — 2026-11-08
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- **One Google consent grant, shared by every Google connector** (`oauth.grant:
|
|
28
|
+
"google"`), for an org-level Google connection: one OAuth client, one consent
|
|
29
|
+
and one refresh token per person, with each feature's scopes asked for when it
|
|
30
|
+
is first used. Declared in the manifest, the `-ui` package's OAuth constant,
|
|
31
|
+
the README and the registry index:
|
|
32
|
+
- `authorizeParams`: `access_type=offline` and `include_granted_scopes=true`.
|
|
33
|
+
A refresh token comes back only on the FIRST code exchange, so keep the stored
|
|
34
|
+
one when an exchange returns none.
|
|
35
|
+
- `revoke`: POST `https://oauth2.googleapis.com/revoke` with `token`, and
|
|
36
|
+
`scope: "grant"`. **Revoking removes the person's WHOLE Google grant, every
|
|
37
|
+
Google connector**, so a per-feature disconnect stops using that feature's
|
|
38
|
+
scopes locally and only a full Google disconnect revokes.
|
|
39
|
+
- `identity`: identify the account by the id_token's `sub` (request `openid`;
|
|
40
|
+
issuer `https://accounts.google.com` or `accounts.google.com`; audience is
|
|
41
|
+
the `clientId`), never by email, which Google says is neither unique nor
|
|
42
|
+
permanent.
|
|
43
|
+
`restrictedScopes` is empty: none of this connector's scopes is restricted.
|
|
44
|
+
|
|
45
|
+
Nothing a request sends has changed; this is what a host needs to run the
|
|
46
|
+
connection.
|
|
47
|
+
|
|
11
48
|
## [0.5.0] — 2026-11-08
|
|
12
49
|
|
|
13
50
|
### Added
|
package/README.md
CHANGED
|
@@ -55,6 +55,13 @@ Google Sheets uses OAuth2 (authorization_code). The package DECLARES the exchang
|
|
|
55
55
|
- **Scopes** — `https://www.googleapis.com/auth/spreadsheets`
|
|
56
56
|
- **Access token lifetime** — 3600 seconds (1 hours). A host that never refreshes works all afternoon and is broken by morning.
|
|
57
57
|
|
|
58
|
+
**One consent grant, shared** (`grant: "google"`). Every connector declaring the same grant can run on ONE OAuth client, with one consent and one refresh token per person.
|
|
59
|
+
|
|
60
|
+
- **Authorize with** `access_type=offline`, `include_granted_scopes=true`. Ask for a feature's scopes when it is first used; the new token covers every scope granted before. A refresh token comes back only on the FIRST exchange, so keep the stored one when an exchange returns none.
|
|
61
|
+
- **Revoke** — POST https://oauth2.googleapis.com/revoke with `token`. **It removes the WHOLE grant**: every connector sharing it, not only this one. A per-feature disconnect stops using that feature's scopes locally; only a full disconnect revokes.
|
|
62
|
+
- **Identify the account by `sub`**: request `openid`, then verify the token response's id_token (issuer `https://accounts.google.com` or `accounts.google.com`, keys at https://www.googleapis.com/oauth2/v3/certs, audience = `clientId`). Never key a connection by email.
|
|
63
|
+
- **No restricted scopes** in this connector.
|
|
64
|
+
|
|
58
65
|
The refresh tokens do **not** rotate: the same one is reusable, so a refresh may safely be retried and may run concurrently. Stated rather than assumed, because the opposite — a provider that spends the token and revokes the grant on a replay — looks identical until it happens.
|
|
59
66
|
|
|
60
67
|
### The estate
|
|
@@ -67,6 +74,17 @@ The refresh tokens do **not** rotate: the same one is reusable, so a refresh may
|
|
|
67
74
|
|
|
68
75
|
### Actions
|
|
69
76
|
|
|
77
|
+
#### `batch_update` — Batch update a Google Sheet
|
|
78
|
+
|
|
79
|
+
Apply a list of Google Sheet API requests to a spreadsheet, all or none.
|
|
80
|
+
|
|
81
|
+
`POST /v4/spreadsheets/{spreadsheetId}:batchUpdate` · **unsafe to replay** — a retried durable run does it TWICE
|
|
82
|
+
|
|
83
|
+
| Input | Required | What it is |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| `spreadsheetId` | yes | The id in the spreadsheet's own URL. |
|
|
86
|
+
| `requests` | yes | Google's Request objects, in order. Example: [{"findReplace":{"find":"{{name}}","replacement":"Ada","allSheets":true}}]. |
|
|
87
|
+
|
|
70
88
|
#### `row_append` — Google Sheets row
|
|
71
89
|
|
|
72
90
|
Append a row to a Google Sheet.
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { callConnector } from '@particle-academy/fancy-connector-core';
|
|
2
2
|
|
|
3
3
|
// src/faker.ts
|
|
4
|
+
function fakeBatchUpdate({ config, fake }) {
|
|
5
|
+
return {
|
|
6
|
+
"spreadsheetId": config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet"),
|
|
7
|
+
"replies": [
|
|
8
|
+
{}
|
|
9
|
+
]
|
|
10
|
+
};
|
|
11
|
+
}
|
|
4
12
|
function fakeRowAppend({ config, fake }) {
|
|
5
13
|
const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
|
|
6
14
|
return {
|
|
@@ -45,6 +53,8 @@ function fakeValuesUpdate({ config, fake }) {
|
|
|
45
53
|
}
|
|
46
54
|
var googleSheetsFaker = (operation, request) => {
|
|
47
55
|
switch (operation) {
|
|
56
|
+
case "batch_update":
|
|
57
|
+
return fakeBatchUpdate(request);
|
|
48
58
|
case "row_append":
|
|
49
59
|
return fakeRowAppend(request);
|
|
50
60
|
case "values_get":
|
|
@@ -81,6 +91,40 @@ var GOOGLE_SHEETS = {
|
|
|
81
91
|
authorize: googleSheetsAuthorize,
|
|
82
92
|
faker: googleSheetsFaker
|
|
83
93
|
};
|
|
94
|
+
var BATCH_UPDATE_OPERATION = "batch_update";
|
|
95
|
+
async function googleSheetsBatchUpdate(options) {
|
|
96
|
+
const config = options.config ?? {};
|
|
97
|
+
if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
|
|
98
|
+
throw new Error(`batch_update: "spreadsheetId" is required (Spreadsheet ID).`);
|
|
99
|
+
}
|
|
100
|
+
if (config.requests === void 0 || config.requests === null || config.requests === "") {
|
|
101
|
+
throw new Error(`batch_update: "requests" is required (Requests).`);
|
|
102
|
+
}
|
|
103
|
+
if (typeof config.requests === "string" && config.requests !== "") {
|
|
104
|
+
try {
|
|
105
|
+
JSON.parse(config.requests);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
throw new Error(`batch_update: "requests" must be JSON: ${error.message}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return callConnector(GOOGLE_SHEETS, {
|
|
111
|
+
operation: BATCH_UPDATE_OPERATION,
|
|
112
|
+
config,
|
|
113
|
+
input: options.input,
|
|
114
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
115
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
116
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
117
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
118
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
119
|
+
request: {
|
|
120
|
+
method: "POST",
|
|
121
|
+
path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}:batchUpdate`,
|
|
122
|
+
json: {
|
|
123
|
+
...config.requests !== void 0 && config.requests !== null && config.requests !== "" ? { "requests": typeof config.requests === "string" ? JSON.parse(config.requests) : config.requests } : {}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
84
128
|
var ROW_APPEND_OPERATION = "row_append";
|
|
85
129
|
async function googleSheetsRowAppend(options) {
|
|
86
130
|
const config = options.config ?? {};
|
|
@@ -188,6 +232,6 @@ function valuesList2(value) {
|
|
|
188
232
|
return items.map((item) => item.trim()).filter(Boolean);
|
|
189
233
|
}
|
|
190
234
|
|
|
191
|
-
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate };
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
193
|
-
//# sourceMappingURL=chunk-
|
|
235
|
+
export { BATCH_UPDATE_OPERATION, CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, googleSheetsAuthorize, googleSheetsBatchUpdate, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate };
|
|
236
|
+
//# sourceMappingURL=chunk-Q7SFJ5VK.js.map
|
|
237
|
+
//# sourceMappingURL=chunk-Q7SFJ5VK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/batch-update.ts","../src/actions/row-append.ts","../src/actions/values-get.ts","../src/actions/values-update.ts"],"names":["callConnector","valuesList"],"mappings":";;;AA0BA,SAAS,eAAA,CAAgB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC/D,EAAA,OAAO;AAAA,IACL,iBAAkB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GAAG,QAAQ,CAAA;AAAA,IACtK,SAAA,EAAW;AAAA,MACT;AAAC;AACH,GACF;AACF;AAEA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,MAAM,qBAAsB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GAAG,QAAQ,CAAA;AAEhL,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB,kBAAA;AAAA,IACjB,YAAA,EAAc,cAAA;AAAA,IACd,SAAA,EAAW;AAAA,MACT,eAAA,EAAiB,kBAAA;AAAA,MACjB,cAAA,EAAgB,cAAA;AAAA,MAChB,aAAA,EAAe,CAAA;AAAA,MACf,gBAAA,EAAkB,CAAA;AAAA,MAClB,cAAA,EAAgB;AAAA;AAClB,GACF;AACF;AAEA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC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CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,CAAA,iBAAA,EAAoB,kBAAA,CAAmB,MAAA,CAAO,OAAO,aAAa,CAAC,CAAC,CAAA,QAAA,EAAW,kBAAA,CAAmB,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAC,CAAA,CAAA;AAAA,MAC7H,IAAA,EAAM;AAAA,QACJ,QAAA,EAAU,CAACC,WAAAA,CAAW,MAAA,CAAO,MAAM,CAAC;AAAA,OACtC;AAAA,MACA,KAAA,EAAO;AAAA,QACL,kBAAA,EAAoB,MAAA,CAAO,MAAA,CAAO,gBAAgB;AAAA;AACpD;AACF,GACD,CAAA;AACH;AAGA,SAASA,YAAW,KAAA,EAA0B;AAC5C,EAAA,MAAM,QAAQ,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAC7B,MAAM,GAAA,CAAI,MAAM,CAAA,GAChB,OAAO,UAAU,QAAA,GACf,KAAA,CAAM,KAAA,CAAM,GAAG,IACf,EAAC;AAEP,EAAA,OAAO,KAAA,CAAM,IAAI,CAAC,IAAA,KAAS,KAAK,IAAA,EAAM,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AACxD","file":"chunk-Q7SFJ5VK.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * The Google Sheets faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Sheets actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeBatchUpdate({ config, fake }: FakeRequest): unknown {\n return {\n \"spreadsheetId\": (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\")),\n \"replies\": [\n {},\n ],\n };\n}\n\nfunction fakeRowAppend({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"tableRange\": \"Sheet1!A1:D4\",\n \"updates\": {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": \"Sheet1!A5:D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 4,\n \"updatedCells\": 4,\n },\n };\n}\n\nfunction fakeValuesGet({ config, fake }: FakeRequest): unknown {\n return {\n \"range\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1:C2\"),\n \"majorDimension\": (config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? String(config.majorDimension) : \"ROWS\"),\n \"values\": [\n [\n \"Name\",\n \"Email\",\n \"Status\",\n ],\n [\n \"Ada Lovelace\",\n \"ada@example.test\",\n \"Active\",\n ],\n ],\n };\n}\n\nfunction fakeValuesUpdate({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1\"),\n \"updatedRows\": 1,\n \"updatedColumns\": 3,\n \"updatedCells\": 3,\n };\n}\n\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"batch_update\":\n return fakeBatchUpdate(request);\n\n case \"row_append\":\n return fakeRowAppend(request);\n\n case \"values_get\":\n return fakeValuesGet(request);\n\n case \"values_update\":\n return fakeValuesUpdate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_sheets: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets, as one service descriptor shared by every Google Sheets\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Sheets: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for 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 { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSheetsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SHEETS_BASE_URLS = {\n \"live\": \"https://sheets.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SHEETS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Sheets's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSheetsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Sheets service, for the TypeScript runtime. */\nexport const GOOGLE_SHEETS: ServiceDescriptor = {\n service: \"google_sheets\",\n title: \"Google Sheets\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },\n requires: [...GOOGLE_SHEETS_REQUIRES],\n authorize: googleSheetsAuthorize,\n faker: googleSheetsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/batch-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/batch-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Apply a list of Google Sheet API requests to a spreadsheet, all or none.\n *\n * POST /v4/spreadsheets/{spreadsheetId}:batchUpdate —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const BATCH_UPDATE_OPERATION = \"batch_update\";\n\nexport type BatchUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, requests. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsBatchUpdate(options: BatchUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`batch_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.requests === undefined || config.requests === null || config.requests === \"\") {\n throw new Error(`batch_update: \"requests\" is required (Requests).`);\n }\n if (typeof config.requests === \"string\" && config.requests !== \"\") {\n try {\n JSON.parse(config.requests);\n } catch (error) {\n throw new Error(`batch_update: \"requests\" must be JSON: ${(error as Error).message}`);\n }\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: BATCH_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}:batchUpdate`,\n json: {\n ...(config.requests !== undefined && config.requests !== null && config.requests !== \"\" ? { \"requests\": typeof config.requests === \"string\" ? JSON.parse(config.requests) : config.requests } : {}),\n },\n },\n });\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 * Append a row to a Google Sheet.\n *\n * POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append —\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const ROW_APPEND_OPERATION = \"row_append\";\n\nexport type RowAppendOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption, insertDataOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`row_append: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`row_append: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`row_append: \"values\" is required (Row values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: ROW_APPEND_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n ...(config.valueInputOption !== undefined && config.valueInputOption !== null && config.valueInputOption !== \"\" ? { \"valueInputOption\": String(config.valueInputOption) } : {}),\n ...(config.insertDataOption !== undefined && config.insertDataOption !== null && config.insertDataOption !== \"\" ? { \"insertDataOption\": String(config.insertDataOption) } : {}),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-get.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/values-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Read the cell values of a range.\n *\n * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_GET_OPERATION = \"values_get\";\n\nexport type ValuesGetOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_get: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_get: \"range\" is required (Range).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n query: {\n ...(config.valueRenderOption !== undefined && config.valueRenderOption !== null && config.valueRenderOption !== \"\" ? { \"valueRenderOption\": String(config.valueRenderOption) } : {}),\n ...(config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? { \"majorDimension\": String(config.majorDimension) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/values-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Overwrite the cell values of a range. Existing values in that range are\n * replaced, not pushed down.\n *\n * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_UPDATE_OPERATION = \"values_update\";\n\nexport type ValuesUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_update: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`values_update: \"values\" is required (Row values).`);\n }\n\n if (config.valueInputOption === undefined || config.valueInputOption === null || config.valueInputOption === \"\") {\n throw new Error(`values_update: \"valueInputOption\" is required (How to interpret the values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"PUT\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n \"valueInputOption\": String(config.valueInputOption),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n"]}
|
package/dist/flow.cjs
CHANGED
|
@@ -6,6 +6,14 @@ var googleSheetsUi = require('@particle-academy/google-sheets-ui');
|
|
|
6
6
|
// src/flow.ts
|
|
7
7
|
|
|
8
8
|
// src/faker.ts
|
|
9
|
+
function fakeBatchUpdate({ config, fake }) {
|
|
10
|
+
return {
|
|
11
|
+
"spreadsheetId": config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet"),
|
|
12
|
+
"replies": [
|
|
13
|
+
{}
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
9
17
|
function fakeRowAppend({ config, fake }) {
|
|
10
18
|
const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
|
|
11
19
|
return {
|
|
@@ -50,6 +58,8 @@ function fakeValuesUpdate({ config, fake }) {
|
|
|
50
58
|
}
|
|
51
59
|
var googleSheetsFaker = (operation, request) => {
|
|
52
60
|
switch (operation) {
|
|
61
|
+
case "batch_update":
|
|
62
|
+
return fakeBatchUpdate(request);
|
|
53
63
|
case "row_append":
|
|
54
64
|
return fakeRowAppend(request);
|
|
55
65
|
case "values_get":
|
|
@@ -85,6 +95,40 @@ var GOOGLE_SHEETS = {
|
|
|
85
95
|
authorize: googleSheetsAuthorize,
|
|
86
96
|
faker: googleSheetsFaker
|
|
87
97
|
};
|
|
98
|
+
var BATCH_UPDATE_OPERATION = "batch_update";
|
|
99
|
+
async function googleSheetsBatchUpdate(options) {
|
|
100
|
+
const config = options.config ?? {};
|
|
101
|
+
if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
|
|
102
|
+
throw new Error(`batch_update: "spreadsheetId" is required (Spreadsheet ID).`);
|
|
103
|
+
}
|
|
104
|
+
if (config.requests === void 0 || config.requests === null || config.requests === "") {
|
|
105
|
+
throw new Error(`batch_update: "requests" is required (Requests).`);
|
|
106
|
+
}
|
|
107
|
+
if (typeof config.requests === "string" && config.requests !== "") {
|
|
108
|
+
try {
|
|
109
|
+
JSON.parse(config.requests);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
throw new Error(`batch_update: "requests" must be JSON: ${error.message}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return fancyConnectorCore.callConnector(GOOGLE_SHEETS, {
|
|
115
|
+
operation: BATCH_UPDATE_OPERATION,
|
|
116
|
+
config,
|
|
117
|
+
input: options.input,
|
|
118
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
119
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
120
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
121
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
122
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
123
|
+
request: {
|
|
124
|
+
method: "POST",
|
|
125
|
+
path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}:batchUpdate`,
|
|
126
|
+
json: {
|
|
127
|
+
...config.requests !== void 0 && config.requests !== null && config.requests !== "" ? { "requests": typeof config.requests === "string" ? JSON.parse(config.requests) : config.requests } : {}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
88
132
|
var ROW_APPEND_OPERATION = "row_append";
|
|
89
133
|
async function googleSheetsRowAppend(options) {
|
|
90
134
|
const config = options.config ?? {};
|
|
@@ -193,6 +237,20 @@ function valuesList2(value) {
|
|
|
193
237
|
}
|
|
194
238
|
|
|
195
239
|
// src/flow.ts
|
|
240
|
+
var googleSheetsBatchUpdateExecutor = async (ctx) => {
|
|
241
|
+
const config = ctx.node.data?.config ?? {};
|
|
242
|
+
const result = await googleSheetsBatchUpdate({
|
|
243
|
+
config,
|
|
244
|
+
input: ctx.inputs?.in
|
|
245
|
+
});
|
|
246
|
+
ctx.emit({
|
|
247
|
+
type: "log",
|
|
248
|
+
level: "info",
|
|
249
|
+
nodeId: ctx.node.id,
|
|
250
|
+
message: `google_sheets batch_update ${result.data?.id} (${result.mode})`
|
|
251
|
+
});
|
|
252
|
+
return { __port: "out", value: result };
|
|
253
|
+
};
|
|
196
254
|
var googleSheetsRowExecutor = async (ctx) => {
|
|
197
255
|
const config = ctx.node.data?.config ?? {};
|
|
198
256
|
const result = await googleSheetsRowAppend({
|
|
@@ -236,12 +294,14 @@ var googleSheetsValuesUpdateExecutor = async (ctx) => {
|
|
|
236
294
|
return { __port: "out", value: result };
|
|
237
295
|
};
|
|
238
296
|
var GOOGLE_SHEETS_RUNNABLE_KINDS = [
|
|
297
|
+
{ ...googleSheetsUi.googleSheetsBatchUpdateKind, executor: googleSheetsBatchUpdateExecutor },
|
|
239
298
|
{ ...googleSheetsUi.googleSheetsRowKind, executor: googleSheetsRowExecutor },
|
|
240
299
|
{ ...googleSheetsUi.googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },
|
|
241
300
|
{ ...googleSheetsUi.googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor }
|
|
242
301
|
];
|
|
243
302
|
|
|
244
303
|
exports.GOOGLE_SHEETS_RUNNABLE_KINDS = GOOGLE_SHEETS_RUNNABLE_KINDS;
|
|
304
|
+
exports.googleSheetsBatchUpdateExecutor = googleSheetsBatchUpdateExecutor;
|
|
245
305
|
exports.googleSheetsRowExecutor = googleSheetsRowExecutor;
|
|
246
306
|
exports.googleSheetsValuesGetExecutor = googleSheetsValuesGetExecutor;
|
|
247
307
|
exports.googleSheetsValuesUpdateExecutor = googleSheetsValuesUpdateExecutor;
|
package/dist/flow.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/row-append.ts","../src/actions/values-get.ts","../src/actions/values-update.ts","../src/flow.ts"],"names":["callConnector","valuesList","googleSheetsRowKind","googleSheetsValuesGetKind","googleSheetsValuesUpdateKind"],"mappings":";;;;;;;;AA0BA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAA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uBAAA,EAAwB;AAAA,EAC5D,EAAE,GAAGC,wCAAA,EAA2B,QAAA,EAAU,6BAAA,EAA8B;AAAA,EACxE,EAAE,GAAGC,2CAAA,EAA8B,QAAA,EAAU,gCAAA;AAC/C","file":"flow.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * The Google Sheets faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Sheets actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeRowAppend({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"tableRange\": \"Sheet1!A1:D4\",\n \"updates\": {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": \"Sheet1!A5:D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 4,\n \"updatedCells\": 4,\n },\n };\n}\n\nfunction fakeValuesGet({ config, fake }: FakeRequest): unknown {\n return {\n \"range\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1:C2\"),\n \"majorDimension\": (config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? String(config.majorDimension) : \"ROWS\"),\n \"values\": [\n [\n \"Name\",\n \"Email\",\n \"Status\",\n ],\n [\n \"Ada Lovelace\",\n \"ada@example.test\",\n \"Active\",\n ],\n ],\n };\n}\n\nfunction fakeValuesUpdate({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1\"),\n \"updatedRows\": 1,\n \"updatedColumns\": 3,\n \"updatedCells\": 3,\n };\n}\n\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"row_append\":\n return fakeRowAppend(request);\n\n case \"values_get\":\n return fakeValuesGet(request);\n\n case \"values_update\":\n return fakeValuesUpdate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_sheets: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets, as one service descriptor shared by every Google Sheets\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Sheets: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for 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 { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSheetsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SHEETS_BASE_URLS = {\n \"live\": \"https://sheets.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SHEETS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Sheets's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSheetsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Sheets service, for the TypeScript runtime. */\nexport const GOOGLE_SHEETS: ServiceDescriptor = {\n service: \"google_sheets\",\n title: \"Google Sheets\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },\n requires: [...GOOGLE_SHEETS_REQUIRES],\n authorize: googleSheetsAuthorize,\n faker: googleSheetsFaker,\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 * Append a row to a Google Sheet.\n *\n * POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append —\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const ROW_APPEND_OPERATION = \"row_append\";\n\nexport type RowAppendOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption, insertDataOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`row_append: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`row_append: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`row_append: \"values\" is required (Row values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: ROW_APPEND_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n ...(config.valueInputOption !== undefined && config.valueInputOption !== null && config.valueInputOption !== \"\" ? { \"valueInputOption\": String(config.valueInputOption) } : {}),\n ...(config.insertDataOption !== undefined && config.insertDataOption !== null && config.insertDataOption !== \"\" ? { \"insertDataOption\": String(config.insertDataOption) } : {}),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-get.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/values-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Read the cell values of a range.\n *\n * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_GET_OPERATION = \"values_get\";\n\nexport type ValuesGetOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_get: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_get: \"range\" is required (Range).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n query: {\n ...(config.valueRenderOption !== undefined && config.valueRenderOption !== null && config.valueRenderOption !== \"\" ? { \"valueRenderOption\": String(config.valueRenderOption) } : {}),\n ...(config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? { \"majorDimension\": String(config.majorDimension) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/values-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Overwrite the cell values of a range. Existing values in that range are\n * replaced, not pushed down.\n *\n * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_UPDATE_OPERATION = \"values_update\";\n\nexport type ValuesUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_update: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`values_update: \"values\" is required (Row values).`);\n }\n\n if (config.valueInputOption === undefined || config.valueInputOption === null || config.valueInputOption === \"\") {\n throw new Error(`values_update: \"valueInputOption\" is required (How to interpret the values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"PUT\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n \"valueInputOption\": String(config.valueInputOption),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ 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/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets's node kinds with their TypeScript executors attached — for\n * hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-sheets-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"./service.js\";\n\nimport {\n googleSheetsRowKind,\n googleSheetsValuesGetKind,\n googleSheetsValuesUpdateKind,\n} from \"@particle-academy/google-sheets-ui\";\n\nimport { googleSheetsRowAppend } from \"./actions/row-append.js\";\nimport { googleSheetsValuesGet } from \"./actions/values-get.js\";\nimport { googleSheetsValuesUpdate } from \"./actions/values-update.js\";\n\nexport const googleSheetsRowExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsRowAppend({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets row_append ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsValuesGetExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsValuesGet({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets values_get ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsValuesUpdateExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsValuesUpdate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets values_update ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSheetsRowKind, executor: googleSheetsRowExecutor },\n { ...googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },\n { ...googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor },\n];\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/batch-update.ts","../src/actions/row-append.ts","../src/actions/values-get.ts","../src/actions/values-update.ts","../src/flow.ts"],"names":["callConnector","valuesList","googleSheetsBatchUpdateKind","googleSheetsRowKind","googleSheetsValuesGetKind","googleSheetsValuesUpdateKind"],"mappings":";;;;;;;;AA0BA,SAAS,eAAA,CAAgB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC/D,EAAA,OAAO;AAAA,IACL,iBAAkB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GAAG,QAAQ,CAAA;AAAA,IACtK,SAAA,EAAW;AAAA,MACT;AAAC;AACH,GACF;AACF;AAEA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,MAAM,qBAAsB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GA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kCAAA,EAAqB,QAAA,EAAU,uBAAA,EAAwB;AAAA,EAC5D,EAAE,GAAGC,wCAAA,EAA2B,QAAA,EAAU,6BAAA,EAA8B;AAAA,EACxE,EAAE,GAAGC,2CAAA,EAA8B,QAAA,EAAU,gCAAA;AAC/C","file":"flow.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * The Google Sheets faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Sheets actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeBatchUpdate({ config, fake }: FakeRequest): unknown {\n return {\n \"spreadsheetId\": (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\")),\n \"replies\": [\n {},\n ],\n };\n}\n\nfunction fakeRowAppend({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"tableRange\": \"Sheet1!A1:D4\",\n \"updates\": {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": \"Sheet1!A5:D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 4,\n \"updatedCells\": 4,\n },\n };\n}\n\nfunction fakeValuesGet({ config, fake }: FakeRequest): unknown {\n return {\n \"range\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1:C2\"),\n \"majorDimension\": (config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? String(config.majorDimension) : \"ROWS\"),\n \"values\": [\n [\n \"Name\",\n \"Email\",\n \"Status\",\n ],\n [\n \"Ada Lovelace\",\n \"ada@example.test\",\n \"Active\",\n ],\n ],\n };\n}\n\nfunction fakeValuesUpdate({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1\"),\n \"updatedRows\": 1,\n \"updatedColumns\": 3,\n \"updatedCells\": 3,\n };\n}\n\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"batch_update\":\n return fakeBatchUpdate(request);\n\n case \"row_append\":\n return fakeRowAppend(request);\n\n case \"values_get\":\n return fakeValuesGet(request);\n\n case \"values_update\":\n return fakeValuesUpdate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_sheets: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets, as one service descriptor shared by every Google Sheets\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Sheets: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for 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 { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSheetsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SHEETS_BASE_URLS = {\n \"live\": \"https://sheets.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SHEETS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Sheets's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSheetsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Sheets service, for the TypeScript runtime. */\nexport const GOOGLE_SHEETS: ServiceDescriptor = {\n service: \"google_sheets\",\n title: \"Google Sheets\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },\n requires: [...GOOGLE_SHEETS_REQUIRES],\n authorize: googleSheetsAuthorize,\n faker: googleSheetsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/batch-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/batch-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Apply a list of Google Sheet API requests to a spreadsheet, all or none.\n *\n * POST /v4/spreadsheets/{spreadsheetId}:batchUpdate —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const BATCH_UPDATE_OPERATION = \"batch_update\";\n\nexport type BatchUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, requests. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsBatchUpdate(options: BatchUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`batch_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.requests === undefined || config.requests === null || config.requests === \"\") {\n throw new Error(`batch_update: \"requests\" is required (Requests).`);\n }\n if (typeof config.requests === \"string\" && config.requests !== \"\") {\n try {\n JSON.parse(config.requests);\n } catch (error) {\n throw new Error(`batch_update: \"requests\" must be JSON: ${(error as Error).message}`);\n }\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: BATCH_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}:batchUpdate`,\n json: {\n ...(config.requests !== undefined && config.requests !== null && config.requests !== \"\" ? { \"requests\": typeof config.requests === \"string\" ? JSON.parse(config.requests) : config.requests } : {}),\n },\n },\n });\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 * Append a row to a Google Sheet.\n *\n * POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append —\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const ROW_APPEND_OPERATION = \"row_append\";\n\nexport type RowAppendOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption, insertDataOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`row_append: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`row_append: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`row_append: \"values\" is required (Row values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: ROW_APPEND_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n ...(config.valueInputOption !== undefined && config.valueInputOption !== null && config.valueInputOption !== \"\" ? { \"valueInputOption\": String(config.valueInputOption) } : {}),\n ...(config.insertDataOption !== undefined && config.insertDataOption !== null && config.insertDataOption !== \"\" ? { \"insertDataOption\": String(config.insertDataOption) } : {}),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-get.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/values-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Read the cell values of a range.\n *\n * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_GET_OPERATION = \"values_get\";\n\nexport type ValuesGetOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_get: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_get: \"range\" is required (Range).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n query: {\n ...(config.valueRenderOption !== undefined && config.valueRenderOption !== null && config.valueRenderOption !== \"\" ? { \"valueRenderOption\": String(config.valueRenderOption) } : {}),\n ...(config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? { \"majorDimension\": String(config.majorDimension) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/values-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Overwrite the cell values of a range. Existing values in that range are\n * replaced, not pushed down.\n *\n * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_UPDATE_OPERATION = \"values_update\";\n\nexport type ValuesUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_update: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`values_update: \"values\" is required (Row values).`);\n }\n\n if (config.valueInputOption === undefined || config.valueInputOption === null || config.valueInputOption === \"\") {\n throw new Error(`values_update: \"valueInputOption\" is required (How to interpret the values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"PUT\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n \"valueInputOption\": String(config.valueInputOption),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ 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/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets's node kinds with their TypeScript executors attached — for\n * hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-sheets-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"./service.js\";\n\nimport {\n googleSheetsBatchUpdateKind,\n googleSheetsRowKind,\n googleSheetsValuesGetKind,\n googleSheetsValuesUpdateKind,\n} from \"@particle-academy/google-sheets-ui\";\n\nimport { googleSheetsBatchUpdate } from \"./actions/batch-update.js\";\nimport { googleSheetsRowAppend } from \"./actions/row-append.js\";\nimport { googleSheetsValuesGet } from \"./actions/values-get.js\";\nimport { googleSheetsValuesUpdate } from \"./actions/values-update.js\";\n\nexport const googleSheetsBatchUpdateExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsBatchUpdate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets batch_update ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsRowExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsRowAppend({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets row_append ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsValuesGetExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsValuesGet({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets values_get ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsValuesUpdateExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsValuesUpdate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets values_update ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSheetsBatchUpdateKind, executor: googleSheetsBatchUpdateExecutor },\n { ...googleSheetsRowKind, executor: googleSheetsRowExecutor },\n { ...googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },\n { ...googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor },\n];\n"]}
|
package/dist/flow.d.cts
CHANGED
|
@@ -19,10 +19,11 @@ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/e
|
|
|
19
19
|
* installs the ui package and never this one.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
declare const googleSheetsBatchUpdateExecutor: NodeExecutor;
|
|
22
23
|
declare const googleSheetsRowExecutor: NodeExecutor;
|
|
23
24
|
declare const googleSheetsValuesGetExecutor: NodeExecutor;
|
|
24
25
|
declare const googleSheetsValuesUpdateExecutor: NodeExecutor;
|
|
25
26
|
/** The kinds a TypeScript host registers. */
|
|
26
27
|
declare const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[];
|
|
27
28
|
|
|
28
|
-
export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
|
|
29
|
+
export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsBatchUpdateExecutor, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
|
package/dist/flow.d.ts
CHANGED
|
@@ -19,10 +19,11 @@ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/e
|
|
|
19
19
|
* installs the ui package and never this one.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
declare const googleSheetsBatchUpdateExecutor: NodeExecutor;
|
|
22
23
|
declare const googleSheetsRowExecutor: NodeExecutor;
|
|
23
24
|
declare const googleSheetsValuesGetExecutor: NodeExecutor;
|
|
24
25
|
declare const googleSheetsValuesUpdateExecutor: NodeExecutor;
|
|
25
26
|
/** The kinds a TypeScript host registers. */
|
|
26
27
|
declare const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[];
|
|
27
28
|
|
|
28
|
-
export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
|
|
29
|
+
export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsBatchUpdateExecutor, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
|
package/dist/flow.js
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import { googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate } from './chunk-
|
|
1
|
+
import { googleSheetsBatchUpdate, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate } from './chunk-Q7SFJ5VK.js';
|
|
2
2
|
import '@particle-academy/fancy-connector-core';
|
|
3
|
-
import { googleSheetsRowKind, googleSheetsValuesGetKind, googleSheetsValuesUpdateKind } from '@particle-academy/google-sheets-ui';
|
|
3
|
+
import { googleSheetsBatchUpdateKind, googleSheetsRowKind, googleSheetsValuesGetKind, googleSheetsValuesUpdateKind } from '@particle-academy/google-sheets-ui';
|
|
4
4
|
|
|
5
|
+
var googleSheetsBatchUpdateExecutor = async (ctx) => {
|
|
6
|
+
const config = ctx.node.data?.config ?? {};
|
|
7
|
+
const result = await googleSheetsBatchUpdate({
|
|
8
|
+
config,
|
|
9
|
+
input: ctx.inputs?.in
|
|
10
|
+
});
|
|
11
|
+
ctx.emit({
|
|
12
|
+
type: "log",
|
|
13
|
+
level: "info",
|
|
14
|
+
nodeId: ctx.node.id,
|
|
15
|
+
message: `google_sheets batch_update ${result.data?.id} (${result.mode})`
|
|
16
|
+
});
|
|
17
|
+
return { __port: "out", value: result };
|
|
18
|
+
};
|
|
5
19
|
var googleSheetsRowExecutor = async (ctx) => {
|
|
6
20
|
const config = ctx.node.data?.config ?? {};
|
|
7
21
|
const result = await googleSheetsRowAppend({
|
|
@@ -45,11 +59,12 @@ var googleSheetsValuesUpdateExecutor = async (ctx) => {
|
|
|
45
59
|
return { __port: "out", value: result };
|
|
46
60
|
};
|
|
47
61
|
var GOOGLE_SHEETS_RUNNABLE_KINDS = [
|
|
62
|
+
{ ...googleSheetsBatchUpdateKind, executor: googleSheetsBatchUpdateExecutor },
|
|
48
63
|
{ ...googleSheetsRowKind, executor: googleSheetsRowExecutor },
|
|
49
64
|
{ ...googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },
|
|
50
65
|
{ ...googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor }
|
|
51
66
|
];
|
|
52
67
|
|
|
53
|
-
export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
|
|
68
|
+
export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsBatchUpdateExecutor, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
|
|
54
69
|
//# sourceMappingURL=flow.js.map
|
|
55
70
|
//# sourceMappingURL=flow.js.map
|
package/dist/flow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AA0CO,IAAM,+BAAA,GAAgD,OAAO,GAAA,KAAQ;AAC1E,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,uBAAA,CAAwB;AAAA,IAC3C,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,M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,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,yBAAA,EAA6B,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAC1F,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAEO,IAAM,gCAAA,GAAiD,OAAO,GAAA,KAAQ;AAC3E,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,wBAAA,CAAyB;AAAA,IAC5C,MAAA;AAAA,IACA,KAAA,EAAO,IAAI,MAAA,EAAQ;AAAA,GACpB,CAAA;AAED,EAAA,GAAA,CAAI,IAAA,CAAK;AAAA,IACP,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,IAAA,CAAK,EAAA;AAAA,IACjB,SAAS,CAAA,4BAAA,EAAgC,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAC7F,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,MAAA,EAAO;AACxC;AAGO,IAAM,4BAAA,GAAqD;AAAA,EAChE,EAAE,GAAG,2BAAA,EAA6B,QAAA,EAAU,+BAAA,EAAgC;AAAA,EAC5E,EAAE,GAAG,mBAAA,EAAqB,QAAA,EAAU,uBAAA,EAAwB;AAAA,EAC5D,EAAE,GAAG,yBAAA,EAA2B,QAAA,EAAU,6BAAA,EAA8B;AAAA,EACxE,EAAE,GAAG,4BAAA,EAA8B,QAAA,EAAU,gCAAA;AAC/C","file":"flow.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/ + triggers/ 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/ + triggers/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets's node kinds with their TypeScript executors attached — for\n * hosts that EXECUTE on TS.\n *\n * The authoring surface in @particle-academy/google-sheets-ui carries no\n * executor: the editor is React on every host, so a PHP or Python project\n * installs the ui package and never this one.\n */\n\nimport type { NodeExecutor, NodeKindDefinition } from \"@particle-academy/fancy-flow/engine\";\nimport {\n idempotencyKeyFor,\n NO_IDEMPOTENCY_KEY_WARNING,\n resolveConnection,\n triggerEvent,\n type RequestedMode,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"./service.js\";\n\nimport {\n googleSheetsBatchUpdateKind,\n googleSheetsRowKind,\n googleSheetsValuesGetKind,\n googleSheetsValuesUpdateKind,\n} from \"@particle-academy/google-sheets-ui\";\n\nimport { googleSheetsBatchUpdate } from \"./actions/batch-update.js\";\nimport { googleSheetsRowAppend } from \"./actions/row-append.js\";\nimport { googleSheetsValuesGet } from \"./actions/values-get.js\";\nimport { googleSheetsValuesUpdate } from \"./actions/values-update.js\";\n\nexport const googleSheetsBatchUpdateExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsBatchUpdate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets batch_update ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsRowExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsRowAppend({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets row_append ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsValuesGetExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsValuesGet({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets values_get ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\nexport const googleSheetsValuesUpdateExecutor: NodeExecutor = async (ctx) => {\n const config = ((ctx.node.data as { config?: Record<string, unknown> })?.config ?? {});\n\n const result = await googleSheetsValuesUpdate({\n config,\n input: ctx.inputs?.in,\n });\n\n ctx.emit({\n type: \"log\",\n level: \"info\",\n nodeId: ctx.node.id,\n message: `google_sheets values_update ${(result.data as { id?: string })?.id} (${result.mode})`,\n });\n\n return { __port: \"out\", value: result };\n};\n\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSheetsBatchUpdateKind, executor: googleSheetsBatchUpdateExecutor },\n { ...googleSheetsRowKind, executor: googleSheetsRowExecutor },\n { ...googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },\n { ...googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor },\n];\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
var fancyConnectorCore = require('@particle-academy/fancy-connector-core');
|
|
4
4
|
|
|
5
5
|
// src/faker.ts
|
|
6
|
+
function fakeBatchUpdate({ config, fake }) {
|
|
7
|
+
return {
|
|
8
|
+
"spreadsheetId": config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet"),
|
|
9
|
+
"replies": [
|
|
10
|
+
{}
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
6
14
|
function fakeRowAppend({ config, fake }) {
|
|
7
15
|
const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
|
|
8
16
|
return {
|
|
@@ -47,6 +55,8 @@ function fakeValuesUpdate({ config, fake }) {
|
|
|
47
55
|
}
|
|
48
56
|
var googleSheetsFaker = (operation, request) => {
|
|
49
57
|
switch (operation) {
|
|
58
|
+
case "batch_update":
|
|
59
|
+
return fakeBatchUpdate(request);
|
|
50
60
|
case "row_append":
|
|
51
61
|
return fakeRowAppend(request);
|
|
52
62
|
case "values_get":
|
|
@@ -83,6 +93,40 @@ var GOOGLE_SHEETS = {
|
|
|
83
93
|
authorize: googleSheetsAuthorize,
|
|
84
94
|
faker: googleSheetsFaker
|
|
85
95
|
};
|
|
96
|
+
var BATCH_UPDATE_OPERATION = "batch_update";
|
|
97
|
+
async function googleSheetsBatchUpdate(options) {
|
|
98
|
+
const config = options.config ?? {};
|
|
99
|
+
if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
|
|
100
|
+
throw new Error(`batch_update: "spreadsheetId" is required (Spreadsheet ID).`);
|
|
101
|
+
}
|
|
102
|
+
if (config.requests === void 0 || config.requests === null || config.requests === "") {
|
|
103
|
+
throw new Error(`batch_update: "requests" is required (Requests).`);
|
|
104
|
+
}
|
|
105
|
+
if (typeof config.requests === "string" && config.requests !== "") {
|
|
106
|
+
try {
|
|
107
|
+
JSON.parse(config.requests);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
throw new Error(`batch_update: "requests" must be JSON: ${error.message}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return fancyConnectorCore.callConnector(GOOGLE_SHEETS, {
|
|
113
|
+
operation: BATCH_UPDATE_OPERATION,
|
|
114
|
+
config,
|
|
115
|
+
input: options.input,
|
|
116
|
+
...options.credentials === void 0 ? {} : { credentials: options.credentials },
|
|
117
|
+
...options.mode === void 0 ? {} : { mode: options.mode },
|
|
118
|
+
...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
|
|
119
|
+
...options.attempts === void 0 ? {} : { attempts: options.attempts },
|
|
120
|
+
...options.transport === void 0 ? {} : { transport: options.transport },
|
|
121
|
+
request: {
|
|
122
|
+
method: "POST",
|
|
123
|
+
path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}:batchUpdate`,
|
|
124
|
+
json: {
|
|
125
|
+
...config.requests !== void 0 && config.requests !== null && config.requests !== "" ? { "requests": typeof config.requests === "string" ? JSON.parse(config.requests) : config.requests } : {}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
86
130
|
var ROW_APPEND_OPERATION = "row_append";
|
|
87
131
|
async function googleSheetsRowAppend(options) {
|
|
88
132
|
const config = options.config ?? {};
|
|
@@ -190,6 +234,7 @@ function valuesList2(value) {
|
|
|
190
234
|
return items.map((item) => item.trim()).filter(Boolean);
|
|
191
235
|
}
|
|
192
236
|
|
|
237
|
+
exports.BATCH_UPDATE_OPERATION = BATCH_UPDATE_OPERATION;
|
|
193
238
|
exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
|
|
194
239
|
exports.GOOGLE_SHEETS = GOOGLE_SHEETS;
|
|
195
240
|
exports.GOOGLE_SHEETS_BASE_URLS = GOOGLE_SHEETS_BASE_URLS;
|
|
@@ -198,6 +243,7 @@ exports.ROW_APPEND_OPERATION = ROW_APPEND_OPERATION;
|
|
|
198
243
|
exports.VALUES_GET_OPERATION = VALUES_GET_OPERATION;
|
|
199
244
|
exports.VALUES_UPDATE_OPERATION = VALUES_UPDATE_OPERATION;
|
|
200
245
|
exports.googleSheetsAuthorize = googleSheetsAuthorize;
|
|
246
|
+
exports.googleSheetsBatchUpdate = googleSheetsBatchUpdate;
|
|
201
247
|
exports.googleSheetsFaker = googleSheetsFaker;
|
|
202
248
|
exports.googleSheetsRowAppend = googleSheetsRowAppend;
|
|
203
249
|
exports.googleSheetsValuesGet = googleSheetsValuesGet;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/row-append.ts","../src/actions/values-get.ts","../src/actions/values-update.ts"],"names":["callConnector","valuesList"],"mappings":";;;;;AA0BA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,MAAM,qBAAsB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GAAG,QAAQ,CAAA;AAEhL,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB,kBAAA;AAAA,IACjB,YAAA,EAAc,cAAA;AAAA,IACd,SAAA,EAAW;AAAA,MACT,eAAA,EAAiB,kBAAA;AAAA,MACjB,cAAA,EAAgB,cAAA;AAAA,MAChB,aAAA,EAAe,CAAA;AAAA,MACf,gBAAA,EAAkB,CAAA;AAAA,MAClB,cAAA,EAAgB;AAAA;AAClB,GACF;AACF;AAEA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,OAAO;AAAA,IACL,OAAA,EAAU,MAAA,CAAO,KAAA,KAAU,MAAA,IAAa,MAAA,CAAO,KAAA,KAAU,IAAA,IAAQ,MAAA,CAAO,KAAA,KAAU,EAAA,GAAK,MAAA,CAAO,MAAA,CAAO,KAAK,CAAA,GAAI,cAAA;AAAA,IAC9G,gBAAA,EAAmB,MAAA,CAAO,cAAA,KAAmB,MAAA,IAAa,MAAA,CAAO,cAAA,KAAmB,IAAA,IAAQ,MAAA,CAAO,cAAA,KAAmB,EAAA,GAAK,MAAA,CAAO,MAAA,CAAO,cAAc,CAAA,GAAI,MAAA;AAAA,IAC3J,QAAA,EAAU;AAAA,MACR;AAAA,QACE,MAA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GAAY,EAAC,GAAI,EAAE,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAU;AAAA,IAC1E,OAAA,EAAS;AAAA,MACP,MAAA,EAAQ,KAAA;AAAA,MACR,IAAA,EAAM,CAAA,iBAAA,EAAoB,kBAAA,CAAmB,MAAA,CAAO,OAAO,aAAa,CAAC,CAAC,CAAA,QAAA,EAAW,kBAAA,CAAmB,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAC,CAAA,CAAA;AAAA,MAC7H,IAAA,EAAM;AAAA,QACJ,QAAA,EAAU,CAACC,WAAAA,CAAW,MAAA,CAAO,MAAM,CAAC;AAAA,OACtC;AAAA,MACA,KAAA,EAAO;AAAA,QACL,kBAAA,EAAoB,MAAA,CAAO,MAAA,CAAO,gBAAgB;AAAA;AACpD;AACF,GACD,CAAA;AACH;AAGA,SAASA,YAAW,KAAA,EAA0B;AAC5C,EAAA,MAAM,QAAQ,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAC7B,MAAM,GAAA,CAAI,MAAM,CAAA,GAChB,OAAO,UAAU,QAAA,GACf,KAAA,CAAM,KAAA,CAAM,GAAG,IACf,EAAC;AAEP,EAAA,OAAO,KAAA,CAAM,IAAI,CAAC,IAAA,KAAS,KAAK,IAAA,EAAM,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AACxD","file":"index.cjs","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * The Google Sheets faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Sheets actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeRowAppend({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"tableRange\": \"Sheet1!A1:D4\",\n \"updates\": {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": \"Sheet1!A5:D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 4,\n \"updatedCells\": 4,\n },\n };\n}\n\nfunction fakeValuesGet({ config, fake }: FakeRequest): unknown {\n return {\n \"range\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1:C2\"),\n \"majorDimension\": (config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? String(config.majorDimension) : \"ROWS\"),\n \"values\": [\n [\n \"Name\",\n \"Email\",\n \"Status\",\n ],\n [\n \"Ada Lovelace\",\n \"ada@example.test\",\n \"Active\",\n ],\n ],\n };\n}\n\nfunction fakeValuesUpdate({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1\"),\n \"updatedRows\": 1,\n \"updatedColumns\": 3,\n \"updatedCells\": 3,\n };\n}\n\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"row_append\":\n return fakeRowAppend(request);\n\n case \"values_get\":\n return fakeValuesGet(request);\n\n case \"values_update\":\n return fakeValuesUpdate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_sheets: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets, as one service descriptor shared by every Google Sheets\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Sheets: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for 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 { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSheetsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SHEETS_BASE_URLS = {\n \"live\": \"https://sheets.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SHEETS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Sheets's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSheetsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Sheets service, for the TypeScript runtime. */\nexport const GOOGLE_SHEETS: ServiceDescriptor = {\n service: \"google_sheets\",\n title: \"Google Sheets\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },\n requires: [...GOOGLE_SHEETS_REQUIRES],\n authorize: googleSheetsAuthorize,\n faker: googleSheetsFaker,\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 * Append a row to a Google Sheet.\n *\n * POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append —\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const ROW_APPEND_OPERATION = \"row_append\";\n\nexport type RowAppendOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption, insertDataOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`row_append: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`row_append: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`row_append: \"values\" is required (Row values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: ROW_APPEND_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n ...(config.valueInputOption !== undefined && config.valueInputOption !== null && config.valueInputOption !== \"\" ? { \"valueInputOption\": String(config.valueInputOption) } : {}),\n ...(config.insertDataOption !== undefined && config.insertDataOption !== null && config.insertDataOption !== \"\" ? { \"insertDataOption\": String(config.insertDataOption) } : {}),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-get.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/values-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Read the cell values of a range.\n *\n * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_GET_OPERATION = \"values_get\";\n\nexport type ValuesGetOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_get: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_get: \"range\" is required (Range).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n query: {\n ...(config.valueRenderOption !== undefined && config.valueRenderOption !== null && config.valueRenderOption !== \"\" ? { \"valueRenderOption\": String(config.valueRenderOption) } : {}),\n ...(config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? { \"majorDimension\": String(config.majorDimension) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/values-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Overwrite the cell values of a range. Existing values in that range are\n * replaced, not pushed down.\n *\n * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_UPDATE_OPERATION = \"values_update\";\n\nexport type ValuesUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_update: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`values_update: \"values\" is required (Row values).`);\n }\n\n if (config.valueInputOption === undefined || config.valueInputOption === null || config.valueInputOption === \"\") {\n throw new Error(`values_update: \"valueInputOption\" is required (How to interpret the values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"PUT\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n \"valueInputOption\": String(config.valueInputOption),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/batch-update.ts","../src/actions/row-append.ts","../src/actions/values-get.ts","../src/actions/values-update.ts"],"names":["callConnector","valuesList"],"mappings":";;;;;AA0BA,SAAS,eAAA,CAAgB,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC/D,EAAA,OAAO;AAAA,IACL,iBAAkB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GAAG,QAAQ,CAAA;AAAA,IACtK,SAAA,EAAW;AAAA,MACT;AAAC;AACH,GACF;AACF;AAEA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,MAAM,qBAAsB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,G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n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * The Google Sheets faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Sheets actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeBatchUpdate({ config, fake }: FakeRequest): unknown {\n return {\n \"spreadsheetId\": (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\")),\n \"replies\": [\n {},\n ],\n };\n}\n\nfunction fakeRowAppend({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"tableRange\": \"Sheet1!A1:D4\",\n \"updates\": {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": \"Sheet1!A5:D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 4,\n \"updatedCells\": 4,\n },\n };\n}\n\nfunction fakeValuesGet({ config, fake }: FakeRequest): unknown {\n return {\n \"range\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1:C2\"),\n \"majorDimension\": (config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? String(config.majorDimension) : \"ROWS\"),\n \"values\": [\n [\n \"Name\",\n \"Email\",\n \"Status\",\n ],\n [\n \"Ada Lovelace\",\n \"ada@example.test\",\n \"Active\",\n ],\n ],\n };\n}\n\nfunction fakeValuesUpdate({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1\"),\n \"updatedRows\": 1,\n \"updatedColumns\": 3,\n \"updatedCells\": 3,\n };\n}\n\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"batch_update\":\n return fakeBatchUpdate(request);\n\n case \"row_append\":\n return fakeRowAppend(request);\n\n case \"values_get\":\n return fakeValuesGet(request);\n\n case \"values_update\":\n return fakeValuesUpdate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_sheets: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets, as one service descriptor shared by every Google Sheets\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Sheets: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for 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 { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSheetsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SHEETS_BASE_URLS = {\n \"live\": \"https://sheets.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SHEETS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Sheets's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSheetsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Sheets service, for the TypeScript runtime. */\nexport const GOOGLE_SHEETS: ServiceDescriptor = {\n service: \"google_sheets\",\n title: \"Google Sheets\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },\n requires: [...GOOGLE_SHEETS_REQUIRES],\n authorize: googleSheetsAuthorize,\n faker: googleSheetsFaker,\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/batch-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/batch-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Apply a list of Google Sheet API requests to a spreadsheet, all or none.\n *\n * POST /v4/spreadsheets/{spreadsheetId}:batchUpdate —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const BATCH_UPDATE_OPERATION = \"batch_update\";\n\nexport type BatchUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, requests. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsBatchUpdate(options: BatchUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`batch_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.requests === undefined || config.requests === null || config.requests === \"\") {\n throw new Error(`batch_update: \"requests\" is required (Requests).`);\n }\n if (typeof config.requests === \"string\" && config.requests !== \"\") {\n try {\n JSON.parse(config.requests);\n } catch (error) {\n throw new Error(`batch_update: \"requests\" must be JSON: ${(error as Error).message}`);\n }\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: BATCH_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}:batchUpdate`,\n json: {\n ...(config.requests !== undefined && config.requests !== null && config.requests !== \"\" ? { \"requests\": typeof config.requests === \"string\" ? JSON.parse(config.requests) : config.requests } : {}),\n },\n },\n });\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 * Append a row to a Google Sheet.\n *\n * POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append —\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const ROW_APPEND_OPERATION = \"row_append\";\n\nexport type RowAppendOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption, insertDataOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`row_append: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`row_append: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`row_append: \"values\" is required (Row values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: ROW_APPEND_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n ...(config.valueInputOption !== undefined && config.valueInputOption !== null && config.valueInputOption !== \"\" ? { \"valueInputOption\": String(config.valueInputOption) } : {}),\n ...(config.insertDataOption !== undefined && config.insertDataOption !== null && config.insertDataOption !== \"\" ? { \"insertDataOption\": String(config.insertDataOption) } : {}),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-get.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/values-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Read the cell values of a range.\n *\n * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_GET_OPERATION = \"values_get\";\n\nexport type ValuesGetOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_get: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_get: \"range\" is required (Range).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n query: {\n ...(config.valueRenderOption !== undefined && config.valueRenderOption !== null && config.valueRenderOption !== \"\" ? { \"valueRenderOption\": String(config.valueRenderOption) } : {}),\n ...(config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? { \"majorDimension\": String(config.majorDimension) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/values-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Overwrite the cell values of a range. Existing values in that range are\n * replaced, not pushed down.\n *\n * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_UPDATE_OPERATION = \"values_update\";\n\nexport type ValuesUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_update: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`values_update: \"values\" is required (Row values).`);\n }\n\n if (config.valueInputOption === undefined || config.valueInputOption === null || config.valueInputOption === \"\") {\n throw new Error(`values_update: \"valueInputOption\" is required (How to interpret the values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"PUT\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n \"valueInputOption\": String(config.valueInputOption),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -77,6 +77,44 @@ declare const GOOGLE_SHEETS: ServiceDescriptor;
|
|
|
77
77
|
|
|
78
78
|
declare const googleSheetsFaker: ConnectorFaker;
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* GENERATED FILE — do not edit.
|
|
82
|
+
*
|
|
83
|
+
* Emitted from provider/actions/batch-update.json by weaver's generator.
|
|
84
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
85
|
+
* being rejected, because it works until it silently does not. Fix
|
|
86
|
+
* provider/actions/batch-update.json (or weaver's template/) and regenerate:
|
|
87
|
+
*
|
|
88
|
+
* npm run provider -- google_sheets
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Apply a list of Google Sheet API requests to a spreadsheet, all or none.
|
|
92
|
+
*
|
|
93
|
+
* POST /v4/spreadsheets/{spreadsheetId}:batchUpdate —
|
|
94
|
+
* https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
|
|
95
|
+
*
|
|
96
|
+
* Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
|
|
97
|
+
* no fake/real branch. This describes the request; callConnector resolves the
|
|
98
|
+
* connection, picks the estate, and either calls Google Sheets or calls the
|
|
99
|
+
* faker.
|
|
100
|
+
*
|
|
101
|
+
* sideEffects: unsafe-to-replay.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
declare const BATCH_UPDATE_OPERATION = "batch_update";
|
|
105
|
+
type BatchUpdateOptions = {
|
|
106
|
+
/** The node's resolved config. Keys: spreadsheetId, requests. */
|
|
107
|
+
config: Record<string, unknown>;
|
|
108
|
+
credentials?: Record<string, string | undefined>;
|
|
109
|
+
mode?: RequestedMode;
|
|
110
|
+
connectionId?: string | null;
|
|
111
|
+
input?: unknown;
|
|
112
|
+
attempts?: number;
|
|
113
|
+
/** Override the transport. The only way to exercise this without a network. */
|
|
114
|
+
transport?: Transport;
|
|
115
|
+
};
|
|
116
|
+
declare function googleSheetsBatchUpdate(options: BatchUpdateOptions): Promise<ConnectorResult>;
|
|
117
|
+
|
|
80
118
|
/**
|
|
81
119
|
* GENERATED FILE — do not edit.
|
|
82
120
|
*
|
|
@@ -188,4 +226,4 @@ type ValuesUpdateOptions = {
|
|
|
188
226
|
};
|
|
189
227
|
declare function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult>;
|
|
190
228
|
|
|
191
|
-
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, type RowAppendOptions, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, type ValuesGetOptions, type ValuesUpdateOptions, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate };
|
|
229
|
+
export { BATCH_UPDATE_OPERATION, type BatchUpdateOptions, CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, type RowAppendOptions, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, type ValuesGetOptions, type ValuesUpdateOptions, googleSheetsAuthorize, googleSheetsBatchUpdate, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate };
|
package/dist/index.d.ts
CHANGED
|
@@ -77,6 +77,44 @@ declare const GOOGLE_SHEETS: ServiceDescriptor;
|
|
|
77
77
|
|
|
78
78
|
declare const googleSheetsFaker: ConnectorFaker;
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* GENERATED FILE — do not edit.
|
|
82
|
+
*
|
|
83
|
+
* Emitted from provider/actions/batch-update.json by weaver's generator.
|
|
84
|
+
* A hand-edit here is destroyed by the next protocol sync, which is worse than
|
|
85
|
+
* being rejected, because it works until it silently does not. Fix
|
|
86
|
+
* provider/actions/batch-update.json (or weaver's template/) and regenerate:
|
|
87
|
+
*
|
|
88
|
+
* npm run provider -- google_sheets
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Apply a list of Google Sheet API requests to a spreadsheet, all or none.
|
|
92
|
+
*
|
|
93
|
+
* POST /v4/spreadsheets/{spreadsheetId}:batchUpdate —
|
|
94
|
+
* https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/batchUpdate
|
|
95
|
+
*
|
|
96
|
+
* Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
|
|
97
|
+
* no fake/real branch. This describes the request; callConnector resolves the
|
|
98
|
+
* connection, picks the estate, and either calls Google Sheets or calls the
|
|
99
|
+
* faker.
|
|
100
|
+
*
|
|
101
|
+
* sideEffects: unsafe-to-replay.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
declare const BATCH_UPDATE_OPERATION = "batch_update";
|
|
105
|
+
type BatchUpdateOptions = {
|
|
106
|
+
/** The node's resolved config. Keys: spreadsheetId, requests. */
|
|
107
|
+
config: Record<string, unknown>;
|
|
108
|
+
credentials?: Record<string, string | undefined>;
|
|
109
|
+
mode?: RequestedMode;
|
|
110
|
+
connectionId?: string | null;
|
|
111
|
+
input?: unknown;
|
|
112
|
+
attempts?: number;
|
|
113
|
+
/** Override the transport. The only way to exercise this without a network. */
|
|
114
|
+
transport?: Transport;
|
|
115
|
+
};
|
|
116
|
+
declare function googleSheetsBatchUpdate(options: BatchUpdateOptions): Promise<ConnectorResult>;
|
|
117
|
+
|
|
80
118
|
/**
|
|
81
119
|
* GENERATED FILE — do not edit.
|
|
82
120
|
*
|
|
@@ -188,4 +226,4 @@ type ValuesUpdateOptions = {
|
|
|
188
226
|
};
|
|
189
227
|
declare function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult>;
|
|
190
228
|
|
|
191
|
-
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, type RowAppendOptions, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, type ValuesGetOptions, type ValuesUpdateOptions, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate };
|
|
229
|
+
export { BATCH_UPDATE_OPERATION, type BatchUpdateOptions, CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, type RowAppendOptions, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, type ValuesGetOptions, type ValuesUpdateOptions, googleSheetsAuthorize, googleSheetsBatchUpdate, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate } from './chunk-
|
|
1
|
+
export { BATCH_UPDATE_OPERATION, CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, VALUES_GET_OPERATION, VALUES_UPDATE_OPERATION, googleSheetsAuthorize, googleSheetsBatchUpdate, googleSheetsFaker, googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate } from './chunk-Q7SFJ5VK.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-academy/google-sheets-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Google Sheets for Node — the service descriptor, its faker, its webhook verification, and one function per operation. Plain HTTP on @particle-academy/fancy-connector-core; no vendor SDK.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@particle-academy/fancy-flow": ">=0.47.1 <2.0",
|
|
57
|
-
"@particle-academy/google-sheets-ui": ">=0.
|
|
57
|
+
"@particle-academy/google-sheets-ui": ">=0.7.0 <0.8.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"@particle-academy/fancy-flow": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/row-append.ts","../src/actions/values-get.ts","../src/actions/values-update.ts"],"names":["callConnector","valuesList"],"mappings":";;;AA0BA,SAAS,aAAA,CAAc,EAAE,MAAA,EAAQ,IAAA,EAAK,EAAyB;AAC7D,EAAA,MAAM,qBAAsB,MAAA,CAAO,aAAA,KAAkB,MAAA,IAAa,MAAA,CAAO,kBAAkB,IAAA,IAAQ,MAAA,CAAO,aAAA,KAAkB,EAAA,GAAK,OAAO,MAAA,CAAO,aAAa,CAAA,GAAI,IAAA,CAAK,GAAG,QAAQ,CAAA;AAEhL,EAAA,OAAO;AAAA,IACL,eAAA,EAAiB,kBAAA;AAAA,IACjB,YAAA,EAAc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AAA,EAA0B;AAC5C,EAAA,MAAM,QAAQ,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAC7B,MAAM,GAAA,CAAI,MAAM,CAAA,GAChB,OAAO,UAAU,QAAA,GACf,KAAA,CAAM,KAAA,CAAM,GAAG,IACf,EAAC;AAEP,EAAA,OAAO,KAAA,CAAM,IAAI,CAAC,IAAA,KAAS,KAAK,IAAA,EAAM,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AACxD","file":"chunk-L2NNYKEK.js","sourcesContent":["/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/fixtures/ by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/fixtures/ (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * The Google Sheets faker.\n *\n * Shapes, not behaviour: the goal is that a downstream node sees the field\n * NAMES Google Sheets actually publishes, so an author can wire {{\n * $json.data.id }} against a fake and have it keep working against the real\n * thing.\n *\n * Deterministic — same inputs, same output. A faker returning a fresh uuid\n * every call cannot be asserted on, so its fixtures degrade to \"it did not\n * throw\", which is the assertion that catches nothing.\n */\n\nimport type { ConnectorFaker, FakeRequest } from \"@particle-academy/fancy-connector-core\";\n\nfunction fakeRowAppend({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"tableRange\": \"Sheet1!A1:D4\",\n \"updates\": {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": \"Sheet1!A5:D5\",\n \"updatedRows\": 1,\n \"updatedColumns\": 4,\n \"updatedCells\": 4,\n },\n };\n}\n\nfunction fakeValuesGet({ config, fake }: FakeRequest): unknown {\n return {\n \"range\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1:C2\"),\n \"majorDimension\": (config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? String(config.majorDimension) : \"ROWS\"),\n \"values\": [\n [\n \"Name\",\n \"Email\",\n \"Status\",\n ],\n [\n \"Ada Lovelace\",\n \"ada@example.test\",\n \"Active\",\n ],\n ],\n };\n}\n\nfunction fakeValuesUpdate({ config, fake }: FakeRequest): unknown {\n const boundSpreadsheetid = (config.spreadsheetId !== undefined && config.spreadsheetId !== null && config.spreadsheetId !== \"\" ? String(config.spreadsheetId) : fake.id(\"1Sheet\"));\n\n return {\n \"spreadsheetId\": boundSpreadsheetid,\n \"updatedRange\": (config.range !== undefined && config.range !== null && config.range !== \"\" ? String(config.range) : \"Sheet1!A1\"),\n \"updatedRows\": 1,\n \"updatedColumns\": 3,\n \"updatedCells\": 3,\n };\n}\n\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"row_append\":\n return fakeRowAppend(request);\n\n case \"values_get\":\n return fakeValuesGet(request);\n\n case \"values_update\":\n return fakeValuesUpdate(request);\n\n default:\n // A faker asked for an operation it has no shape for must SAY so. Making\n // something up would produce a green run whose output silently has none\n // of the fields the author is about to reference.\n throw new Error(\n `google_sheets: no fake response is defined for \"${operation}\". ` +\n \"Add a fixture under provider/fixtures/ and regenerate — a connector without a faker \" +\n \"cannot be developed against, tested, or demonstrated.\",\n );\n }\n};\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/manifest.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/manifest.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Google Sheets, as one service descriptor shared by every Google Sheets\n * operation.\n *\n * @particle-academy/fancy-connector-core carries what is true of ALL\n * connectors. This carries what is true of Google Sheets: its base URL, its\n * auth scheme, its idempotency header, and its faker.\n *\n * ## The sandbox trap, written down where it is used\n *\n * Google has no sandbox for 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 { ConnectorMode, PreparedRequest, ServiceDescriptor } from \"@particle-academy/fancy-connector-core\";\n\nimport { googleSheetsFaker } from \"./faker.js\";\n\n/**\n * The connector API version this package was GENERATED against.\n *\n * A literal, never imported. An imported constant lets an upgrade rewrite the\n * very claim it exists to detect, after which the copy agrees with itself\n * forever.\n */\nexport const CONNECTOR_API_VERSION = 1;\n\nexport const GOOGLE_SHEETS_BASE_URLS = {\n \"live\": \"https://sheets.googleapis.com\"\n} as const;\n\n/** Credential keys a remote call cannot proceed without. */\nexport const GOOGLE_SHEETS_REQUIRES = [\n \"accessToken\",\n \"refreshToken\",\n \"clientId\",\n \"clientSecret\"\n] as const;\n\n/**\n * Apply Google Sheets's auth scheme to an outgoing request.\n *\n *\n *\n * The mode is passed in because for some providers auth and estate are the\n * same decision expressed in the URL; here it is unused, and saying so is\n * cheaper than wondering later whether it was forgotten.\n */\nexport function googleSheetsAuthorize(\n credentials: Record<string, string | undefined>,\n request: PreparedRequest,\n _mode: ConnectorMode,\n): void {\n request.headers.Authorization = `Bearer ${credentials.accessToken ?? \"\"}`;\n}\n\n/** The Google Sheets service, for the TypeScript runtime. */\nexport const GOOGLE_SHEETS: ServiceDescriptor = {\n service: \"google_sheets\",\n title: \"Google Sheets\",\n sandbox: \"none\",\n baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },\n requires: [...GOOGLE_SHEETS_REQUIRES],\n authorize: googleSheetsAuthorize,\n faker: googleSheetsFaker,\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 * Append a row to a Google Sheet.\n *\n * POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append —\n * https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n *\n * sideEffects: unsafe-to-replay.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const ROW_APPEND_OPERATION = \"row_append\";\n\nexport type RowAppendOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption, insertDataOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`row_append: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`row_append: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`row_append: \"values\" is required (Row values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: ROW_APPEND_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"POST\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n ...(config.valueInputOption !== undefined && config.valueInputOption !== null && config.valueInputOption !== \"\" ? { \"valueInputOption\": String(config.valueInputOption) } : {}),\n ...(config.insertDataOption !== undefined && config.insertDataOption !== null && config.insertDataOption !== \"\" ? { \"insertDataOption\": String(config.insertDataOption) } : {}),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-get.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/values-get.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Read the cell values of a range.\n *\n * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_GET_OPERATION = \"values_get\";\n\nexport type ValuesGetOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_get: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_get: \"range\" is required (Range).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_GET_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"GET\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n query: {\n ...(config.valueRenderOption !== undefined && config.valueRenderOption !== null && config.valueRenderOption !== \"\" ? { \"valueRenderOption\": String(config.valueRenderOption) } : {}),\n ...(config.majorDimension !== undefined && config.majorDimension !== null && config.majorDimension !== \"\" ? { \"majorDimension\": String(config.majorDimension) } : {}),\n },\n },\n });\n}\n","/**\n * GENERATED FILE — do not edit.\n *\n * Emitted from provider/actions/values-update.json by weaver's generator.\n * A hand-edit here is destroyed by the next protocol sync, which is worse than\n * being rejected, because it works until it silently does not. Fix\n * provider/actions/values-update.json (or weaver's template/) and regenerate:\n *\n * npm run provider -- google_sheets\n */\n\n/**\n * Overwrite the cell values of a range. Existing values in that range are\n * replaced, not pushed down.\n *\n * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —\n * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update\n *\n * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,\n * no fake/real branch. This describes the request; callConnector resolves the\n * connection, picks the estate, and either calls Google Sheets or calls the\n * faker.\n */\n\nimport {\n callConnector,\n type ConnectorResult,\n type RequestedMode,\n type Transport,\n} from \"@particle-academy/fancy-connector-core\";\nimport { GOOGLE_SHEETS } from \"../service.js\";\n\nexport const VALUES_UPDATE_OPERATION = \"values_update\";\n\nexport type ValuesUpdateOptions = {\n /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */\n config: Record<string, unknown>;\n credentials?: Record<string, string | undefined>;\n mode?: RequestedMode;\n connectionId?: string | null;\n input?: unknown;\n attempts?: number;\n /** Override the transport. The only way to exercise this without a network. */\n transport?: Transport;\n};\n\nexport async function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult> {\n const config = options.config ?? {};\n\n if (config.spreadsheetId === undefined || config.spreadsheetId === null || config.spreadsheetId === \"\") {\n throw new Error(`values_update: \"spreadsheetId\" is required (Spreadsheet ID).`);\n }\n\n if (config.range === undefined || config.range === null || config.range === \"\") {\n throw new Error(`values_update: \"range\" is required (Range).`);\n }\n\n if (config.values === undefined || config.values === null || config.values === \"\") {\n throw new Error(`values_update: \"values\" is required (Row values).`);\n }\n\n if (config.valueInputOption === undefined || config.valueInputOption === null || config.valueInputOption === \"\") {\n throw new Error(`values_update: \"valueInputOption\" is required (How to interpret the values).`);\n }\n\n return callConnector(GOOGLE_SHEETS, {\n operation: VALUES_UPDATE_OPERATION,\n config,\n input: options.input,\n ...(options.credentials === undefined ? {} : { credentials: options.credentials }),\n ...(options.mode === undefined ? {} : { mode: options.mode }),\n ...(options.connectionId === undefined ? {} : { connectionId: options.connectionId }),\n ...(options.attempts === undefined ? {} : { attempts: options.attempts }),\n ...(options.transport === undefined ? {} : { transport: options.transport }),\n request: {\n method: \"PUT\",\n path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,\n json: {\n \"values\": [valuesList(config.values)],\n },\n query: {\n \"valueInputOption\": String(config.valueInputOption),\n },\n },\n });\n}\n\n/** One value, a \",\"-separated string, or an array — all end up a list. */\nfunction valuesList(value: unknown): string[] {\n const items = Array.isArray(value)\n ? value.map(String)\n : typeof value === \"string\"\n ? value.split(\",\")\n : [];\n\n return items.map((item) => item.trim()).filter(Boolean);\n}\n"]}
|