@particle-academy/google-sheets-js 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,18 @@ 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.4.0] — 2026-10-01
12
+
13
+ ### Added
14
+
15
+ - **`values_get`** and **`values_update`** — read a range, and overwrite
16
+ one. No scope change: this connector already holds the full
17
+ `spreadsheets` scope `row_append` needed. `values_update` OVERWRITES
18
+ the cells inside the given range; it does not push existing rows down
19
+ or search for the next empty row the way `row_append` (`values.append`)
20
+ does — the two sound alike and behave differently on data already
21
+ there, said plainly in both actions' own descriptions.
22
+
11
23
  ## [0.3.4] — 2026-09-12
12
24
 
13
25
  ### Changed
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Google Sheets
2
2
 
3
+ [![Fancified](art/fancified.svg)](https://particle.academy)
4
+
3
5
  Google Sheets for [fancy-flow][flow] — as **four imported, versioned packages**, one
4
6
  per runtime. Not vendored source: a copy cannot be upgraded, and third-party APIs
5
7
  change.
@@ -79,6 +81,32 @@ Append a row to a Google Sheet.
79
81
  | `valueInputOption` | no | USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula and 1/2/26 becomes a date. RAW stores exactly the characters given. |
80
82
  | `insertDataOption` | no | INSERT_ROWS pushes existing rows down. OVERWRITE writes into them. |
81
83
 
84
+ #### `values_get` — Read Google Sheets values
85
+
86
+ Read the cell values of a range.
87
+
88
+ `GET /v4/spreadsheets/{spreadsheetId}/values/{range}` · reads only — safe to replay
89
+
90
+ | Input | Required | What it is |
91
+ |---|---|---|
92
+ | `spreadsheetId` | yes | The long id from the sheet's URL: docs.google.com/spreadsheets/d/THIS_PART/edit. |
93
+ | `range` | yes | In A1 notation, the same shape row_append accepts. |
94
+ | `valueRenderOption` | no | How to render values |
95
+ | `majorDimension` | no | Whether the outer array of the result is rows or columns. |
96
+
97
+ #### `values_update` — Write Google Sheets values
98
+
99
+ Overwrite the cell values of a range. Existing values in that range are replaced, not pushed down.
100
+
101
+ `PUT /v4/spreadsheets/{spreadsheetId}/values/{range}` · idempotent — safe to replay
102
+
103
+ | Input | Required | What it is |
104
+ |---|---|---|
105
+ | `spreadsheetId` | yes | Spreadsheet ID |
106
+ | `range` | yes | In A1 notation. The values written fill this range from its top-left cell -- more rows or columns than the range covers are written anyway, following Google's own documented behavior; fewer leave the rest of the range untouched. |
107
+ | `values` | yes | The cells to write, comma separated, left to right, one row. For more than one row, call this action once per row. |
108
+ | `valueInputOption` | yes | USER_ENTERED parses the cells the way typing them would -- so =SUM(A1:A2) becomes a formula. RAW stores exactly the characters given. |
109
+
82
110
  ## Run it before you have credentials
83
111
 
84
112
  Every operation ships a **faker**, whether or not Google Sheets has a sandbox. Set a
@@ -0,0 +1,26 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="128" height="28" role="img" aria-label="Fancified — built with Fancy UI">
2
+ <title>Fancified · built with Fancy UI</title>
3
+ <defs>
4
+ <linearGradient id="fcdBg" x1="0" y1="0" x2="1" y2="1">
5
+ <stop offset="0" stop-color="#6d28d9"/>
6
+ <stop offset=".5" stop-color="#9333ea"/>
7
+ <stop offset="1" stop-color="#d946ef"/>
8
+ </linearGradient>
9
+ <linearGradient id="fcdGloss" x1="0" y1="0" x2="0" y2="1">
10
+ <stop offset="0" stop-color="#ffffff" stop-opacity=".30"/>
11
+ <stop offset=".55" stop-color="#ffffff" stop-opacity="0"/>
12
+ </linearGradient>
13
+ <clipPath id="fcdClip"><rect width="128" height="28" rx="7"/></clipPath>
14
+ </defs>
15
+ <g clip-path="url(#fcdClip)">
16
+ <rect width="128" height="28" fill="url(#fcdBg)"/>
17
+ <rect width="34" height="28" fill="#3b0764" fill-opacity=".5"/>
18
+ <rect width="128" height="13" fill="url(#fcdGloss)"/>
19
+ <g fill="#fff">
20
+ <path transform="translate(17 14)" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
21
+ <path transform="translate(25.5 7.5) scale(.34)" fill-opacity=".85" d="M0 -7 C.6 -2.2 2.2 -.6 7 0 C2.2 .6 .6 2.2 0 7 C-.6 2.2 -2.2 .6 -7 0 C-2.2 -.6 -.6 -2.2 0 -7 Z"/>
22
+ </g>
23
+ <text x="81" y="18.5" fill="#ffffff" text-anchor="middle" font-family="'Segoe UI',Verdana,'DejaVu Sans',sans-serif" font-size="12" font-weight="700" letter-spacing=".3">Fancified</text>
24
+ </g>
25
+ <rect x=".5" y=".5" width="127" height="27" rx="6.5" fill="none" stroke="#ffffff" stroke-opacity=".22"/>
26
+ </svg>
@@ -0,0 +1,193 @@
1
+ import { callConnector } from '@particle-academy/fancy-connector-core';
2
+
3
+ // src/faker.ts
4
+ function fakeRowAppend({ config, fake }) {
5
+ const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
6
+ return {
7
+ "spreadsheetId": boundSpreadsheetid,
8
+ "tableRange": "Sheet1!A1:D4",
9
+ "updates": {
10
+ "spreadsheetId": boundSpreadsheetid,
11
+ "updatedRange": "Sheet1!A5:D5",
12
+ "updatedRows": 1,
13
+ "updatedColumns": 4,
14
+ "updatedCells": 4
15
+ }
16
+ };
17
+ }
18
+ function fakeValuesGet({ config, fake }) {
19
+ return {
20
+ "range": config.range !== void 0 && config.range !== null && config.range !== "" ? String(config.range) : "Sheet1!A1:C2",
21
+ "majorDimension": config.majorDimension !== void 0 && config.majorDimension !== null && config.majorDimension !== "" ? String(config.majorDimension) : "ROWS",
22
+ "values": [
23
+ [
24
+ "Name",
25
+ "Email",
26
+ "Status"
27
+ ],
28
+ [
29
+ "Ada Lovelace",
30
+ "ada@example.test",
31
+ "Active"
32
+ ]
33
+ ]
34
+ };
35
+ }
36
+ function fakeValuesUpdate({ config, fake }) {
37
+ const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
38
+ return {
39
+ "spreadsheetId": boundSpreadsheetid,
40
+ "updatedRange": config.range !== void 0 && config.range !== null && config.range !== "" ? String(config.range) : "Sheet1!A1",
41
+ "updatedRows": 1,
42
+ "updatedColumns": 3,
43
+ "updatedCells": 3
44
+ };
45
+ }
46
+ var googleSheetsFaker = (operation, request) => {
47
+ switch (operation) {
48
+ case "row_append":
49
+ return fakeRowAppend(request);
50
+ case "values_get":
51
+ return fakeValuesGet(request);
52
+ case "values_update":
53
+ return fakeValuesUpdate(request);
54
+ default:
55
+ throw new Error(
56
+ `google_sheets: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
57
+ );
58
+ }
59
+ };
60
+
61
+ // src/service.ts
62
+ var CONNECTOR_API_VERSION = 1;
63
+ var GOOGLE_SHEETS_BASE_URLS = {
64
+ "live": "https://sheets.googleapis.com"
65
+ };
66
+ var GOOGLE_SHEETS_REQUIRES = [
67
+ "accessToken",
68
+ "refreshToken",
69
+ "clientId",
70
+ "clientSecret"
71
+ ];
72
+ function googleSheetsAuthorize(credentials, request, _mode) {
73
+ request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
74
+ }
75
+ var GOOGLE_SHEETS = {
76
+ service: "google_sheets",
77
+ title: "Google Sheets",
78
+ sandbox: "none",
79
+ baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },
80
+ requires: [...GOOGLE_SHEETS_REQUIRES],
81
+ authorize: googleSheetsAuthorize,
82
+ faker: googleSheetsFaker
83
+ };
84
+ var ROW_APPEND_OPERATION = "row_append";
85
+ async function googleSheetsRowAppend(options) {
86
+ const config = options.config ?? {};
87
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
88
+ throw new Error(`row_append: "spreadsheetId" is required (Spreadsheet ID).`);
89
+ }
90
+ if (config.range === void 0 || config.range === null || config.range === "") {
91
+ throw new Error(`row_append: "range" is required (Range).`);
92
+ }
93
+ if (config.values === void 0 || config.values === null || config.values === "") {
94
+ throw new Error(`row_append: "values" is required (Row values).`);
95
+ }
96
+ return callConnector(GOOGLE_SHEETS, {
97
+ operation: ROW_APPEND_OPERATION,
98
+ config,
99
+ input: options.input,
100
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
101
+ ...options.mode === void 0 ? {} : { mode: options.mode },
102
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
103
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
104
+ ...options.transport === void 0 ? {} : { transport: options.transport },
105
+ request: {
106
+ method: "POST",
107
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,
108
+ json: {
109
+ "values": [valuesList(config.values)]
110
+ },
111
+ query: {
112
+ ...config.valueInputOption !== void 0 && config.valueInputOption !== null && config.valueInputOption !== "" ? { "valueInputOption": String(config.valueInputOption) } : {},
113
+ ...config.insertDataOption !== void 0 && config.insertDataOption !== null && config.insertDataOption !== "" ? { "insertDataOption": String(config.insertDataOption) } : {}
114
+ }
115
+ }
116
+ });
117
+ }
118
+ function valuesList(value) {
119
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
120
+ return items.map((item) => item.trim()).filter(Boolean);
121
+ }
122
+ var VALUES_GET_OPERATION = "values_get";
123
+ async function googleSheetsValuesGet(options) {
124
+ const config = options.config ?? {};
125
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
126
+ throw new Error(`values_get: "spreadsheetId" is required (Spreadsheet ID).`);
127
+ }
128
+ if (config.range === void 0 || config.range === null || config.range === "") {
129
+ throw new Error(`values_get: "range" is required (Range).`);
130
+ }
131
+ return callConnector(GOOGLE_SHEETS, {
132
+ operation: VALUES_GET_OPERATION,
133
+ config,
134
+ input: options.input,
135
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
136
+ ...options.mode === void 0 ? {} : { mode: options.mode },
137
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
138
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
139
+ ...options.transport === void 0 ? {} : { transport: options.transport },
140
+ request: {
141
+ method: "GET",
142
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,
143
+ query: {
144
+ ...config.valueRenderOption !== void 0 && config.valueRenderOption !== null && config.valueRenderOption !== "" ? { "valueRenderOption": String(config.valueRenderOption) } : {},
145
+ ...config.majorDimension !== void 0 && config.majorDimension !== null && config.majorDimension !== "" ? { "majorDimension": String(config.majorDimension) } : {}
146
+ }
147
+ }
148
+ });
149
+ }
150
+ var VALUES_UPDATE_OPERATION = "values_update";
151
+ async function googleSheetsValuesUpdate(options) {
152
+ const config = options.config ?? {};
153
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
154
+ throw new Error(`values_update: "spreadsheetId" is required (Spreadsheet ID).`);
155
+ }
156
+ if (config.range === void 0 || config.range === null || config.range === "") {
157
+ throw new Error(`values_update: "range" is required (Range).`);
158
+ }
159
+ if (config.values === void 0 || config.values === null || config.values === "") {
160
+ throw new Error(`values_update: "values" is required (Row values).`);
161
+ }
162
+ if (config.valueInputOption === void 0 || config.valueInputOption === null || config.valueInputOption === "") {
163
+ throw new Error(`values_update: "valueInputOption" is required (How to interpret the values).`);
164
+ }
165
+ return callConnector(GOOGLE_SHEETS, {
166
+ operation: VALUES_UPDATE_OPERATION,
167
+ config,
168
+ input: options.input,
169
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
170
+ ...options.mode === void 0 ? {} : { mode: options.mode },
171
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
172
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
173
+ ...options.transport === void 0 ? {} : { transport: options.transport },
174
+ request: {
175
+ method: "PUT",
176
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,
177
+ json: {
178
+ "values": [valuesList2(config.values)]
179
+ },
180
+ query: {
181
+ "valueInputOption": String(config.valueInputOption)
182
+ }
183
+ }
184
+ });
185
+ }
186
+ function valuesList2(value) {
187
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
188
+ return items.map((item) => item.trim()).filter(Boolean);
189
+ }
190
+
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-L2NNYKEK.js.map
193
+ //# sourceMappingURL=chunk-L2NNYKEK.js.map
@@ -0,0 +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,EAA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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"]}
package/dist/flow.cjs CHANGED
@@ -20,10 +20,42 @@ function fakeRowAppend({ config, fake }) {
20
20
  }
21
21
  };
22
22
  }
23
+ function fakeValuesGet({ config, fake }) {
24
+ return {
25
+ "range": config.range !== void 0 && config.range !== null && config.range !== "" ? String(config.range) : "Sheet1!A1:C2",
26
+ "majorDimension": config.majorDimension !== void 0 && config.majorDimension !== null && config.majorDimension !== "" ? String(config.majorDimension) : "ROWS",
27
+ "values": [
28
+ [
29
+ "Name",
30
+ "Email",
31
+ "Status"
32
+ ],
33
+ [
34
+ "Ada Lovelace",
35
+ "ada@example.test",
36
+ "Active"
37
+ ]
38
+ ]
39
+ };
40
+ }
41
+ function fakeValuesUpdate({ config, fake }) {
42
+ const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
43
+ return {
44
+ "spreadsheetId": boundSpreadsheetid,
45
+ "updatedRange": config.range !== void 0 && config.range !== null && config.range !== "" ? String(config.range) : "Sheet1!A1",
46
+ "updatedRows": 1,
47
+ "updatedColumns": 3,
48
+ "updatedCells": 3
49
+ };
50
+ }
23
51
  var googleSheetsFaker = (operation, request) => {
24
52
  switch (operation) {
25
53
  case "row_append":
26
54
  return fakeRowAppend(request);
55
+ case "values_get":
56
+ return fakeValuesGet(request);
57
+ case "values_update":
58
+ return fakeValuesUpdate(request);
27
59
  default:
28
60
  throw new Error(
29
61
  `google_sheets: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
@@ -91,6 +123,74 @@ function valuesList(value) {
91
123
  const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
92
124
  return items.map((item) => item.trim()).filter(Boolean);
93
125
  }
126
+ var VALUES_GET_OPERATION = "values_get";
127
+ async function googleSheetsValuesGet(options) {
128
+ const config = options.config ?? {};
129
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
130
+ throw new Error(`values_get: "spreadsheetId" is required (Spreadsheet ID).`);
131
+ }
132
+ if (config.range === void 0 || config.range === null || config.range === "") {
133
+ throw new Error(`values_get: "range" is required (Range).`);
134
+ }
135
+ return fancyConnectorCore.callConnector(GOOGLE_SHEETS, {
136
+ operation: VALUES_GET_OPERATION,
137
+ config,
138
+ input: options.input,
139
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
140
+ ...options.mode === void 0 ? {} : { mode: options.mode },
141
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
142
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
143
+ ...options.transport === void 0 ? {} : { transport: options.transport },
144
+ request: {
145
+ method: "GET",
146
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,
147
+ query: {
148
+ ...config.valueRenderOption !== void 0 && config.valueRenderOption !== null && config.valueRenderOption !== "" ? { "valueRenderOption": String(config.valueRenderOption) } : {},
149
+ ...config.majorDimension !== void 0 && config.majorDimension !== null && config.majorDimension !== "" ? { "majorDimension": String(config.majorDimension) } : {}
150
+ }
151
+ }
152
+ });
153
+ }
154
+ var VALUES_UPDATE_OPERATION = "values_update";
155
+ async function googleSheetsValuesUpdate(options) {
156
+ const config = options.config ?? {};
157
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
158
+ throw new Error(`values_update: "spreadsheetId" is required (Spreadsheet ID).`);
159
+ }
160
+ if (config.range === void 0 || config.range === null || config.range === "") {
161
+ throw new Error(`values_update: "range" is required (Range).`);
162
+ }
163
+ if (config.values === void 0 || config.values === null || config.values === "") {
164
+ throw new Error(`values_update: "values" is required (Row values).`);
165
+ }
166
+ if (config.valueInputOption === void 0 || config.valueInputOption === null || config.valueInputOption === "") {
167
+ throw new Error(`values_update: "valueInputOption" is required (How to interpret the values).`);
168
+ }
169
+ return fancyConnectorCore.callConnector(GOOGLE_SHEETS, {
170
+ operation: VALUES_UPDATE_OPERATION,
171
+ config,
172
+ input: options.input,
173
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
174
+ ...options.mode === void 0 ? {} : { mode: options.mode },
175
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
176
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
177
+ ...options.transport === void 0 ? {} : { transport: options.transport },
178
+ request: {
179
+ method: "PUT",
180
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,
181
+ json: {
182
+ "values": [valuesList2(config.values)]
183
+ },
184
+ query: {
185
+ "valueInputOption": String(config.valueInputOption)
186
+ }
187
+ }
188
+ });
189
+ }
190
+ function valuesList2(value) {
191
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
192
+ return items.map((item) => item.trim()).filter(Boolean);
193
+ }
94
194
 
95
195
  // src/flow.ts
96
196
  var googleSheetsRowExecutor = async (ctx) => {
@@ -107,11 +207,43 @@ var googleSheetsRowExecutor = async (ctx) => {
107
207
  });
108
208
  return { __port: "out", value: result };
109
209
  };
210
+ var googleSheetsValuesGetExecutor = async (ctx) => {
211
+ const config = ctx.node.data?.config ?? {};
212
+ const result = await googleSheetsValuesGet({
213
+ config,
214
+ input: ctx.inputs?.in
215
+ });
216
+ ctx.emit({
217
+ type: "log",
218
+ level: "info",
219
+ nodeId: ctx.node.id,
220
+ message: `google_sheets values_get ${result.data?.id} (${result.mode})`
221
+ });
222
+ return { __port: "out", value: result };
223
+ };
224
+ var googleSheetsValuesUpdateExecutor = async (ctx) => {
225
+ const config = ctx.node.data?.config ?? {};
226
+ const result = await googleSheetsValuesUpdate({
227
+ config,
228
+ input: ctx.inputs?.in
229
+ });
230
+ ctx.emit({
231
+ type: "log",
232
+ level: "info",
233
+ nodeId: ctx.node.id,
234
+ message: `google_sheets values_update ${result.data?.id} (${result.mode})`
235
+ });
236
+ return { __port: "out", value: result };
237
+ };
110
238
  var GOOGLE_SHEETS_RUNNABLE_KINDS = [
111
- { ...googleSheetsUi.googleSheetsRowKind, executor: googleSheetsRowExecutor }
239
+ { ...googleSheetsUi.googleSheetsRowKind, executor: googleSheetsRowExecutor },
240
+ { ...googleSheetsUi.googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },
241
+ { ...googleSheetsUi.googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor }
112
242
  ];
113
243
 
114
244
  exports.GOOGLE_SHEETS_RUNNABLE_KINDS = GOOGLE_SHEETS_RUNNABLE_KINDS;
115
245
  exports.googleSheetsRowExecutor = googleSheetsRowExecutor;
246
+ exports.googleSheetsValuesGetExecutor = googleSheetsValuesGetExecutor;
247
+ exports.googleSheetsValuesUpdateExecutor = googleSheetsValuesUpdateExecutor;
116
248
  //# sourceMappingURL=flow.cjs.map
117
249
  //# sourceMappingURL=flow.cjs.map
package/dist/flow.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/row-append.ts","../src/flow.ts"],"names":["callConnector","googleSheetsRowKind"],"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;AACl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,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;AAGO,IAAM,4BAAA,GAAqD;AAAA,EAChE,EAAE,GAAGC,kCAAA,EAAqB,QAAA,EAAU,uBAAA;AACtC","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\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"row_append\":\n return fakeRowAppend(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/ + 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} from \"@particle-academy/google-sheets-ui\";\n\nimport { googleSheetsRowAppend } from \"./actions/row-append.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\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSheetsRowKind, executor: googleSheetsRowExecutor },\n];\n"]}
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,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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KAAA;AAAA,IACN,KAAA,EAAO,MAAA;AAAA,IACP,MAAA,EAAQ,IAAI,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,GAAGC,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 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"]}
package/dist/flow.d.cts CHANGED
@@ -20,7 +20,9 @@ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/e
20
20
  */
21
21
 
22
22
  declare const googleSheetsRowExecutor: NodeExecutor;
23
+ declare const googleSheetsValuesGetExecutor: NodeExecutor;
24
+ declare const googleSheetsValuesUpdateExecutor: NodeExecutor;
23
25
  /** The kinds a TypeScript host registers. */
24
26
  declare const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[];
25
27
 
26
- export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor };
28
+ export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
package/dist/flow.d.ts CHANGED
@@ -20,7 +20,9 @@ import { NodeKindDefinition, NodeExecutor } from '@particle-academy/fancy-flow/e
20
20
  */
21
21
 
22
22
  declare const googleSheetsRowExecutor: NodeExecutor;
23
+ declare const googleSheetsValuesGetExecutor: NodeExecutor;
24
+ declare const googleSheetsValuesUpdateExecutor: NodeExecutor;
23
25
  /** The kinds a TypeScript host registers. */
24
26
  declare const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[];
25
27
 
26
- export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor };
28
+ export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
package/dist/flow.js CHANGED
@@ -1,6 +1,6 @@
1
- import { googleSheetsRowAppend } from './chunk-7AZ3XUFX.js';
1
+ import { googleSheetsRowAppend, googleSheetsValuesGet, googleSheetsValuesUpdate } from './chunk-L2NNYKEK.js';
2
2
  import '@particle-academy/fancy-connector-core';
3
- import { googleSheetsRowKind } from '@particle-academy/google-sheets-ui';
3
+ import { googleSheetsRowKind, googleSheetsValuesGetKind, googleSheetsValuesUpdateKind } from '@particle-academy/google-sheets-ui';
4
4
 
5
5
  var googleSheetsRowExecutor = async (ctx) => {
6
6
  const config = ctx.node.data?.config ?? {};
@@ -16,10 +16,40 @@ var googleSheetsRowExecutor = async (ctx) => {
16
16
  });
17
17
  return { __port: "out", value: result };
18
18
  };
19
+ var googleSheetsValuesGetExecutor = async (ctx) => {
20
+ const config = ctx.node.data?.config ?? {};
21
+ const result = await googleSheetsValuesGet({
22
+ config,
23
+ input: ctx.inputs?.in
24
+ });
25
+ ctx.emit({
26
+ type: "log",
27
+ level: "info",
28
+ nodeId: ctx.node.id,
29
+ message: `google_sheets values_get ${result.data?.id} (${result.mode})`
30
+ });
31
+ return { __port: "out", value: result };
32
+ };
33
+ var googleSheetsValuesUpdateExecutor = async (ctx) => {
34
+ const config = ctx.node.data?.config ?? {};
35
+ const result = await googleSheetsValuesUpdate({
36
+ config,
37
+ input: ctx.inputs?.in
38
+ });
39
+ ctx.emit({
40
+ type: "log",
41
+ level: "info",
42
+ nodeId: ctx.node.id,
43
+ message: `google_sheets values_update ${result.data?.id} (${result.mode})`
44
+ });
45
+ return { __port: "out", value: result };
46
+ };
19
47
  var GOOGLE_SHEETS_RUNNABLE_KINDS = [
20
- { ...googleSheetsRowKind, executor: googleSheetsRowExecutor }
48
+ { ...googleSheetsRowKind, executor: googleSheetsRowExecutor },
49
+ { ...googleSheetsValuesGetKind, executor: googleSheetsValuesGetExecutor },
50
+ { ...googleSheetsValuesUpdateKind, executor: googleSheetsValuesUpdateExecutor }
21
51
  ];
22
52
 
23
- export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor };
53
+ export { GOOGLE_SHEETS_RUNNABLE_KINDS, googleSheetsRowExecutor, googleSheetsValuesGetExecutor, googleSheetsValuesUpdateExecutor };
24
54
  //# sourceMappingURL=flow.js.map
25
55
  //# sourceMappingURL=flow.js.map
package/dist/flow.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAoCO,IAAM,uBAAA,GAAwC,OAAO,GAAA,KAAQ;AAClE,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,qBAAA,CAAsB;AAAA,IACzC,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,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;AAGO,IAAM,4BAAA,GAAqD;AAAA,EAChE,EAAE,GAAG,mBAAA,EAAqB,QAAA,EAAU,uBAAA;AACtC","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 googleSheetsRowKind,\n} from \"@particle-academy/google-sheets-ui\";\n\nimport { googleSheetsRowAppend } from \"./actions/row-append.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\n/** The kinds a TypeScript host registers. */\nexport const GOOGLE_SHEETS_RUNNABLE_KINDS: NodeKindDefinition[] = [\n { ...googleSheetsRowKind, executor: googleSheetsRowExecutor },\n];\n"]}
1
+ {"version":3,"sources":["../src/flow.ts"],"names":[],"mappings":";;;;AAwCO,IAAM,uBAAA,GAAwC,OAAO,GAAA,KAAQ;AAClE,EAAA,MAAM,MAAA,GAAW,GAAA,CAAI,IAAA,CAAK,IAAA,EAA+C,UAAU,EAAC;AAEpF,EAAA,MAAM,MAAA,GAAS,MAAM,qBAAA,CAAsB;AAAA,IACzC,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,yBAAA,EAA6B,MAAA,CAAO,MAA0B,EAAE,CAAA,EAAA,EAAK,OAAO,IAAI,CAAA,CAAA;AAAA,GAC1F,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,KA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O;AACxC;AAGO,IAAM,4BAAA,GAAqD;AAAA,EAChE,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 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"]}
package/dist/index.cjs CHANGED
@@ -17,10 +17,42 @@ function fakeRowAppend({ config, fake }) {
17
17
  }
18
18
  };
19
19
  }
20
+ function fakeValuesGet({ config, fake }) {
21
+ return {
22
+ "range": config.range !== void 0 && config.range !== null && config.range !== "" ? String(config.range) : "Sheet1!A1:C2",
23
+ "majorDimension": config.majorDimension !== void 0 && config.majorDimension !== null && config.majorDimension !== "" ? String(config.majorDimension) : "ROWS",
24
+ "values": [
25
+ [
26
+ "Name",
27
+ "Email",
28
+ "Status"
29
+ ],
30
+ [
31
+ "Ada Lovelace",
32
+ "ada@example.test",
33
+ "Active"
34
+ ]
35
+ ]
36
+ };
37
+ }
38
+ function fakeValuesUpdate({ config, fake }) {
39
+ const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
40
+ return {
41
+ "spreadsheetId": boundSpreadsheetid,
42
+ "updatedRange": config.range !== void 0 && config.range !== null && config.range !== "" ? String(config.range) : "Sheet1!A1",
43
+ "updatedRows": 1,
44
+ "updatedColumns": 3,
45
+ "updatedCells": 3
46
+ };
47
+ }
20
48
  var googleSheetsFaker = (operation, request) => {
21
49
  switch (operation) {
22
50
  case "row_append":
23
51
  return fakeRowAppend(request);
52
+ case "values_get":
53
+ return fakeValuesGet(request);
54
+ case "values_update":
55
+ return fakeValuesUpdate(request);
24
56
  default:
25
57
  throw new Error(
26
58
  `google_sheets: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
@@ -89,14 +121,86 @@ function valuesList(value) {
89
121
  const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
90
122
  return items.map((item) => item.trim()).filter(Boolean);
91
123
  }
124
+ var VALUES_GET_OPERATION = "values_get";
125
+ async function googleSheetsValuesGet(options) {
126
+ const config = options.config ?? {};
127
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
128
+ throw new Error(`values_get: "spreadsheetId" is required (Spreadsheet ID).`);
129
+ }
130
+ if (config.range === void 0 || config.range === null || config.range === "") {
131
+ throw new Error(`values_get: "range" is required (Range).`);
132
+ }
133
+ return fancyConnectorCore.callConnector(GOOGLE_SHEETS, {
134
+ operation: VALUES_GET_OPERATION,
135
+ config,
136
+ input: options.input,
137
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
138
+ ...options.mode === void 0 ? {} : { mode: options.mode },
139
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
140
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
141
+ ...options.transport === void 0 ? {} : { transport: options.transport },
142
+ request: {
143
+ method: "GET",
144
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,
145
+ query: {
146
+ ...config.valueRenderOption !== void 0 && config.valueRenderOption !== null && config.valueRenderOption !== "" ? { "valueRenderOption": String(config.valueRenderOption) } : {},
147
+ ...config.majorDimension !== void 0 && config.majorDimension !== null && config.majorDimension !== "" ? { "majorDimension": String(config.majorDimension) } : {}
148
+ }
149
+ }
150
+ });
151
+ }
152
+ var VALUES_UPDATE_OPERATION = "values_update";
153
+ async function googleSheetsValuesUpdate(options) {
154
+ const config = options.config ?? {};
155
+ if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
156
+ throw new Error(`values_update: "spreadsheetId" is required (Spreadsheet ID).`);
157
+ }
158
+ if (config.range === void 0 || config.range === null || config.range === "") {
159
+ throw new Error(`values_update: "range" is required (Range).`);
160
+ }
161
+ if (config.values === void 0 || config.values === null || config.values === "") {
162
+ throw new Error(`values_update: "values" is required (Row values).`);
163
+ }
164
+ if (config.valueInputOption === void 0 || config.valueInputOption === null || config.valueInputOption === "") {
165
+ throw new Error(`values_update: "valueInputOption" is required (How to interpret the values).`);
166
+ }
167
+ return fancyConnectorCore.callConnector(GOOGLE_SHEETS, {
168
+ operation: VALUES_UPDATE_OPERATION,
169
+ config,
170
+ input: options.input,
171
+ ...options.credentials === void 0 ? {} : { credentials: options.credentials },
172
+ ...options.mode === void 0 ? {} : { mode: options.mode },
173
+ ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
174
+ ...options.attempts === void 0 ? {} : { attempts: options.attempts },
175
+ ...options.transport === void 0 ? {} : { transport: options.transport },
176
+ request: {
177
+ method: "PUT",
178
+ path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}`,
179
+ json: {
180
+ "values": [valuesList2(config.values)]
181
+ },
182
+ query: {
183
+ "valueInputOption": String(config.valueInputOption)
184
+ }
185
+ }
186
+ });
187
+ }
188
+ function valuesList2(value) {
189
+ const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
190
+ return items.map((item) => item.trim()).filter(Boolean);
191
+ }
92
192
 
93
193
  exports.CONNECTOR_API_VERSION = CONNECTOR_API_VERSION;
94
194
  exports.GOOGLE_SHEETS = GOOGLE_SHEETS;
95
195
  exports.GOOGLE_SHEETS_BASE_URLS = GOOGLE_SHEETS_BASE_URLS;
96
196
  exports.GOOGLE_SHEETS_REQUIRES = GOOGLE_SHEETS_REQUIRES;
97
197
  exports.ROW_APPEND_OPERATION = ROW_APPEND_OPERATION;
198
+ exports.VALUES_GET_OPERATION = VALUES_GET_OPERATION;
199
+ exports.VALUES_UPDATE_OPERATION = VALUES_UPDATE_OPERATION;
98
200
  exports.googleSheetsAuthorize = googleSheetsAuthorize;
99
201
  exports.googleSheetsFaker = googleSheetsFaker;
100
202
  exports.googleSheetsRowAppend = googleSheetsRowAppend;
203
+ exports.googleSheetsValuesGet = googleSheetsValuesGet;
204
+ exports.googleSheetsValuesUpdate = googleSheetsValuesUpdate;
101
205
  //# sourceMappingURL=index.cjs.map
102
206
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/row-append.ts"],"names":["callConnector"],"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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AAO,aAAa,CAAC,CAAC,CAAA,QAAA,EAAW,kBAAA,CAAmB,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAC,CAAA,OAAA,CAAA;AAAA,MAC7H,IAAA,EAAM;AAAA,QACJ,QAAA,EAAU,CAAC,UAAA,CAAW,MAAA,CAAO,MAAM,CAAC;AAAA,OACtC;AAAA,MACA,KAAA,EAAO;AAAA,QACL,GAAI,MAAA,CAAO,gBAAA,KAAqB,MAAA,IAAa,MAAA,CAAO,qBAAqB,IAAA,IAAQ,MAAA,CAAO,gBAAA,KAAqB,EAAA,GAAK,EAAE,kBAAA,EAAoB,MAAA,CAAO,OAAO,gBAAgB,CAAA,KAAM,EAAC;AAAA,QAC7K,GAAI,MAAA,CAAO,gBAAA,KAAqB,MAAA,IAAa,MAAA,CAAO,qBAAqB,IAAA,IAAQ,MAAA,CAAO,gBAAA,KAAqB,EAAA,GAAK,EAAE,kBAAA,EAAoB,MAAA,CAAO,OAAO,gBAAgB,CAAA,KAAM;AAAC;AAC/K;AACF,GACD,CAAA;AACH;AAGA,SAAS,WAAW,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\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"row_append\":\n return fakeRowAppend(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"]}
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,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,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAK;AAAA,IAC3D,GAAI,QAAQ,YAAA,KAAiB,MAAA,GAAY,EAAC,GAAI,EAAE,YAAA,EAAc,OAAA,CAAQ,YAAA,EAAa;AAAA,IACnF,GAAI,QAAQ,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAS;AAAA,IACvE,GAAI,QAAQ,SAAA,KAAc,MAAA,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"]}
package/dist/index.d.cts CHANGED
@@ -115,4 +115,77 @@ type RowAppendOptions = {
115
115
  };
116
116
  declare function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult>;
117
117
 
118
- export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, type RowAppendOptions, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend };
118
+ /**
119
+ * GENERATED FILE — do not edit.
120
+ *
121
+ * Emitted from provider/actions/values-get.json by weaver's generator.
122
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
123
+ * being rejected, because it works until it silently does not. Fix
124
+ * provider/actions/values-get.json (or weaver's template/) and regenerate:
125
+ *
126
+ * npm run provider -- google_sheets
127
+ */
128
+ /**
129
+ * Read the cell values of a range.
130
+ *
131
+ * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —
132
+ * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get
133
+ *
134
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
135
+ * no fake/real branch. This describes the request; callConnector resolves the
136
+ * connection, picks the estate, and either calls Google Sheets or calls the
137
+ * faker.
138
+ */
139
+
140
+ declare const VALUES_GET_OPERATION = "values_get";
141
+ type ValuesGetOptions = {
142
+ /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */
143
+ config: Record<string, unknown>;
144
+ credentials?: Record<string, string | undefined>;
145
+ mode?: RequestedMode;
146
+ connectionId?: string | null;
147
+ input?: unknown;
148
+ attempts?: number;
149
+ /** Override the transport. The only way to exercise this without a network. */
150
+ transport?: Transport;
151
+ };
152
+ declare function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult>;
153
+
154
+ /**
155
+ * GENERATED FILE — do not edit.
156
+ *
157
+ * Emitted from provider/actions/values-update.json by weaver's generator.
158
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
159
+ * being rejected, because it works until it silently does not. Fix
160
+ * provider/actions/values-update.json (or weaver's template/) and regenerate:
161
+ *
162
+ * npm run provider -- google_sheets
163
+ */
164
+ /**
165
+ * Overwrite the cell values of a range. Existing values in that range are
166
+ * replaced, not pushed down.
167
+ *
168
+ * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —
169
+ * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update
170
+ *
171
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
172
+ * no fake/real branch. This describes the request; callConnector resolves the
173
+ * connection, picks the estate, and either calls Google Sheets or calls the
174
+ * faker.
175
+ */
176
+
177
+ declare const VALUES_UPDATE_OPERATION = "values_update";
178
+ type ValuesUpdateOptions = {
179
+ /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */
180
+ config: Record<string, unknown>;
181
+ credentials?: Record<string, string | undefined>;
182
+ mode?: RequestedMode;
183
+ connectionId?: string | null;
184
+ input?: unknown;
185
+ attempts?: number;
186
+ /** Override the transport. The only way to exercise this without a network. */
187
+ transport?: Transport;
188
+ };
189
+ declare function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult>;
190
+
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 };
package/dist/index.d.ts CHANGED
@@ -115,4 +115,77 @@ type RowAppendOptions = {
115
115
  };
116
116
  declare function googleSheetsRowAppend(options: RowAppendOptions): Promise<ConnectorResult>;
117
117
 
118
- export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, type RowAppendOptions, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend };
118
+ /**
119
+ * GENERATED FILE — do not edit.
120
+ *
121
+ * Emitted from provider/actions/values-get.json by weaver's generator.
122
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
123
+ * being rejected, because it works until it silently does not. Fix
124
+ * provider/actions/values-get.json (or weaver's template/) and regenerate:
125
+ *
126
+ * npm run provider -- google_sheets
127
+ */
128
+ /**
129
+ * Read the cell values of a range.
130
+ *
131
+ * GET /v4/spreadsheets/{spreadsheetId}/values/{range} —
132
+ * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/get
133
+ *
134
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
135
+ * no fake/real branch. This describes the request; callConnector resolves the
136
+ * connection, picks the estate, and either calls Google Sheets or calls the
137
+ * faker.
138
+ */
139
+
140
+ declare const VALUES_GET_OPERATION = "values_get";
141
+ type ValuesGetOptions = {
142
+ /** The node's resolved config. Keys: spreadsheetId, range, valueRenderOption, majorDimension. */
143
+ config: Record<string, unknown>;
144
+ credentials?: Record<string, string | undefined>;
145
+ mode?: RequestedMode;
146
+ connectionId?: string | null;
147
+ input?: unknown;
148
+ attempts?: number;
149
+ /** Override the transport. The only way to exercise this without a network. */
150
+ transport?: Transport;
151
+ };
152
+ declare function googleSheetsValuesGet(options: ValuesGetOptions): Promise<ConnectorResult>;
153
+
154
+ /**
155
+ * GENERATED FILE — do not edit.
156
+ *
157
+ * Emitted from provider/actions/values-update.json by weaver's generator.
158
+ * A hand-edit here is destroyed by the next protocol sync, which is worse than
159
+ * being rejected, because it works until it silently does not. Fix
160
+ * provider/actions/values-update.json (or weaver's template/) and regenerate:
161
+ *
162
+ * npm run provider -- google_sheets
163
+ */
164
+ /**
165
+ * Overwrite the cell values of a range. Existing values in that range are
166
+ * replaced, not pushed down.
167
+ *
168
+ * PUT /v4/spreadsheets/{spreadsheetId}/values/{range} —
169
+ * https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values/update
170
+ *
171
+ * Notice what is NOT here: no key, no base URL, no mode check, no retry loop,
172
+ * no fake/real branch. This describes the request; callConnector resolves the
173
+ * connection, picks the estate, and either calls Google Sheets or calls the
174
+ * faker.
175
+ */
176
+
177
+ declare const VALUES_UPDATE_OPERATION = "values_update";
178
+ type ValuesUpdateOptions = {
179
+ /** The node's resolved config. Keys: spreadsheetId, range, values, valueInputOption. */
180
+ config: Record<string, unknown>;
181
+ credentials?: Record<string, string | undefined>;
182
+ mode?: RequestedMode;
183
+ connectionId?: string | null;
184
+ input?: unknown;
185
+ attempts?: number;
186
+ /** Override the transport. The only way to exercise this without a network. */
187
+ transport?: Transport;
188
+ };
189
+ declare function googleSheetsValuesUpdate(options: ValuesUpdateOptions): Promise<ConnectorResult>;
190
+
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 };
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, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend } from './chunk-7AZ3XUFX.js';
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-L2NNYKEK.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.4",
3
+ "version": "0.4.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",
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "files": [
40
40
  "dist",
41
+ "art",
41
42
  "README.md",
42
43
  "CHANGELOG.md",
43
44
  "LICENSE"
@@ -53,7 +54,7 @@
53
54
  },
54
55
  "peerDependencies": {
55
56
  "@particle-academy/fancy-flow": ">=0.47.1 <2.0",
56
- "@particle-academy/google-sheets-ui": ">=0.3.0 <0.4.0"
57
+ "@particle-academy/google-sheets-ui": ">=0.4.0 <0.5.0"
57
58
  },
58
59
  "peerDependenciesMeta": {
59
60
  "@particle-academy/fancy-flow": {
@@ -1,93 +0,0 @@
1
- import { callConnector } from '@particle-academy/fancy-connector-core';
2
-
3
- // src/faker.ts
4
- function fakeRowAppend({ config, fake }) {
5
- const boundSpreadsheetid = config.spreadsheetId !== void 0 && config.spreadsheetId !== null && config.spreadsheetId !== "" ? String(config.spreadsheetId) : fake.id("1Sheet");
6
- return {
7
- "spreadsheetId": boundSpreadsheetid,
8
- "tableRange": "Sheet1!A1:D4",
9
- "updates": {
10
- "spreadsheetId": boundSpreadsheetid,
11
- "updatedRange": "Sheet1!A5:D5",
12
- "updatedRows": 1,
13
- "updatedColumns": 4,
14
- "updatedCells": 4
15
- }
16
- };
17
- }
18
- var googleSheetsFaker = (operation, request) => {
19
- switch (operation) {
20
- case "row_append":
21
- return fakeRowAppend(request);
22
- default:
23
- throw new Error(
24
- `google_sheets: no fake response is defined for "${operation}". Add a fixture under provider/fixtures/ and regenerate \u2014 a connector without a faker cannot be developed against, tested, or demonstrated.`
25
- );
26
- }
27
- };
28
-
29
- // src/service.ts
30
- var CONNECTOR_API_VERSION = 1;
31
- var GOOGLE_SHEETS_BASE_URLS = {
32
- "live": "https://sheets.googleapis.com"
33
- };
34
- var GOOGLE_SHEETS_REQUIRES = [
35
- "accessToken",
36
- "refreshToken",
37
- "clientId",
38
- "clientSecret"
39
- ];
40
- function googleSheetsAuthorize(credentials, request, _mode) {
41
- request.headers.Authorization = `Bearer ${credentials.accessToken ?? ""}`;
42
- }
43
- var GOOGLE_SHEETS = {
44
- service: "google_sheets",
45
- title: "Google Sheets",
46
- sandbox: "none",
47
- baseUrls: { ...GOOGLE_SHEETS_BASE_URLS },
48
- requires: [...GOOGLE_SHEETS_REQUIRES],
49
- authorize: googleSheetsAuthorize,
50
- faker: googleSheetsFaker
51
- };
52
- var ROW_APPEND_OPERATION = "row_append";
53
- async function googleSheetsRowAppend(options) {
54
- const config = options.config ?? {};
55
- if (config.spreadsheetId === void 0 || config.spreadsheetId === null || config.spreadsheetId === "") {
56
- throw new Error(`row_append: "spreadsheetId" is required (Spreadsheet ID).`);
57
- }
58
- if (config.range === void 0 || config.range === null || config.range === "") {
59
- throw new Error(`row_append: "range" is required (Range).`);
60
- }
61
- if (config.values === void 0 || config.values === null || config.values === "") {
62
- throw new Error(`row_append: "values" is required (Row values).`);
63
- }
64
- return callConnector(GOOGLE_SHEETS, {
65
- operation: ROW_APPEND_OPERATION,
66
- config,
67
- input: options.input,
68
- ...options.credentials === void 0 ? {} : { credentials: options.credentials },
69
- ...options.mode === void 0 ? {} : { mode: options.mode },
70
- ...options.connectionId === void 0 ? {} : { connectionId: options.connectionId },
71
- ...options.attempts === void 0 ? {} : { attempts: options.attempts },
72
- ...options.transport === void 0 ? {} : { transport: options.transport },
73
- request: {
74
- method: "POST",
75
- path: `/v4/spreadsheets/${encodeURIComponent(String(config.spreadsheetId))}/values/${encodeURIComponent(String(config.range))}:append`,
76
- json: {
77
- "values": [valuesList(config.values)]
78
- },
79
- query: {
80
- ...config.valueInputOption !== void 0 && config.valueInputOption !== null && config.valueInputOption !== "" ? { "valueInputOption": String(config.valueInputOption) } : {},
81
- ...config.insertDataOption !== void 0 && config.insertDataOption !== null && config.insertDataOption !== "" ? { "insertDataOption": String(config.insertDataOption) } : {}
82
- }
83
- }
84
- });
85
- }
86
- function valuesList(value) {
87
- const items = Array.isArray(value) ? value.map(String) : typeof value === "string" ? value.split(",") : [];
88
- return items.map((item) => item.trim()).filter(Boolean);
89
- }
90
-
91
- export { CONNECTOR_API_VERSION, GOOGLE_SHEETS, GOOGLE_SHEETS_BASE_URLS, GOOGLE_SHEETS_REQUIRES, ROW_APPEND_OPERATION, googleSheetsAuthorize, googleSheetsFaker, googleSheetsRowAppend };
92
- //# sourceMappingURL=chunk-7AZ3XUFX.js.map
93
- //# sourceMappingURL=chunk-7AZ3XUFX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/faker.ts","../src/service.ts","../src/actions/row-append.ts"],"names":[],"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;AAEO,IAAM,iBAAA,GAAoC,CAAC,SAAA,EAAW,OAAA,KAAY;AACvE,EAAA,QAAQ,SAAA;AAAW,IACjB,KAAK,YAAA;AACH,MAAA,OAAO,cAAc,OAAO,CAAA;AAAA,IAE9B;AAIE,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,mDAAmD,SAAS,CAAA,iJAAA;AAAA,OAG9D;AAAA;AAEN;;;ACnBO,IAAM,qBAAA,GAAwB;AAE9B,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ;AACV;AAGO,IAAM,sBAAA,GAAyB;AAAA,EACpC,aAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AAWO,SAAS,qBAAA,CACd,WAAA,EACA,OAAA,EACA,KAAA,EACM;AACN,EAAA,OAAA,CA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;AAGA,SAAS,WAAW,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-7AZ3XUFX.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\nexport const googleSheetsFaker: ConnectorFaker = (operation, request) => {\n switch (operation) {\n case \"row_append\":\n return fakeRowAppend(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"]}