@walkeros/server-store-sheets 4.1.0-next-1778668930820 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,40 @@
1
+ # @walkeros/server-store-sheets
2
+
3
+ ## 4.1.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [e155ff8]
8
+ - Updated dependencies [e800974]
9
+ - Updated dependencies [e155ff8]
10
+ - Updated dependencies [1a8f2d7]
11
+ - Updated dependencies [1a8f2d7]
12
+ - Updated dependencies [b276173]
13
+ - Updated dependencies [dd9f5ad]
14
+ - Updated dependencies [c60ef35]
15
+ - Updated dependencies [adeebea]
16
+ - Updated dependencies [13aaeaa]
17
+ - Updated dependencies [e800974]
18
+ - Updated dependencies [adeebea]
19
+ - Updated dependencies [e800974]
20
+ - Updated dependencies [e800974]
21
+ - Updated dependencies [058f7ed]
22
+ - Updated dependencies [28a8ac2]
23
+ - Updated dependencies [fd6076e]
24
+ - @walkeros/core@4.1.0
25
+
26
+ ## 4.0.2
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [a6a0ea7]
31
+ - @walkeros/core@4.0.2
32
+
33
+ ## 4.0.1
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [381dfe7]
38
+ - Updated dependencies [1524275]
39
+ - Updated dependencies [03d7055]
40
+ - @walkeros/core@4.0.1
package/README.md CHANGED
@@ -1,56 +1,27 @@
1
- # @walkeros/server-store-sheets
2
-
3
- Google Sheets store for walkerOS server flows.
1
+ <p align="left">
2
+ <a href="https://www.walkeros.io">
3
+ <img alt="walkerOS" title="walkerOS" src="https://www.walkeros.io/img/walkerOS_logo.svg" width="256px"/>
4
+ </a>
5
+ </p>
4
6
 
5
- Zero runtime dependencies, uses raw `fetch` against the Sheets v4 REST API with
6
- built-in auth (ADC on Cloud Run / service account JWT elsewhere). Designed for
7
- demos and small-scale prototyping where the spreadsheet IS the operator-facing
8
- UI for tweaking lookup data.
9
-
10
- ## Caveats and quotas (read first)
7
+ # @walkeros/server-store-sheets
11
8
 
12
- The Sheets API is rate-limited and slow. Wiring this store directly into a
13
- high-throughput pipeline will burn quota in seconds.
9
+ Google Sheets store with zero runtime dependencies. Uses raw `fetch` against the
10
+ Sheets v4 REST API with built-in auth. Designed for demos and small-scale
11
+ prototyping, not as a production CRM substitute.
14
12
 
15
- - **Quota:** 60 read requests / minute / user / project, 60 write requests /
16
- minute / user / project. Sheets, not BigQuery.
17
- - **Latency:** 200 to 800 ms per HTTP round-trip.
18
- - **No internal cache:** the package does NOT cache reads. Cache is the
19
- consumer's job, see "Wiring with the core cache" below.
20
- - **Concurrency:** last writer wins on the same cell. There is no transactional
21
- `getAndSet`, two pipeline instances writing the same key WILL race.
22
- - **Single-writer model:** if two pipeline instances both write to the same
23
- sheet, their `keyToRow` indexes diverge. Run with one writer.
24
- - **Demo and small-prototype grade only.** Not a production CRM substitute.
13
+ [Documentation](https://www.walkeros.io/docs/stores/server/sheets) &bull;
14
+ [NPM Package](https://www.npmjs.com/package/@walkeros/server-store-sheets)
15
+ &bull;
16
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/stores/sheets)
25
17
 
26
- ## Quick Start (Bundled Mode)
18
+ ## Installation
27
19
 
28
- ```json
29
- {
30
- "version": 4,
31
- "flows": {
32
- "default": {
33
- "config": { "platform": "server" },
34
- "stores": {
35
- "crm": {
36
- "package": "@walkeros/server-store-sheets",
37
- "config": {
38
- "settings": {
39
- "id": "1AbCdEfGhIjKlMnOpQrStUvWxYz",
40
- "sheet": "Customers"
41
- }
42
- }
43
- }
44
- }
45
- }
46
- }
47
- }
20
+ ```bash
21
+ npm install @walkeros/server-store-sheets
48
22
  ```
49
23
 
50
- ## Wiring with the core cache
51
-
52
- To absorb the Sheets quota, wire the consuming transformer or destination with
53
- the core `Cache` config, backed by a fast in-memory store:
24
+ ## Quick start
54
25
 
55
26
  ```json
56
27
  {
@@ -59,171 +30,25 @@ the core `Cache` config, backed by a fast in-memory store:
59
30
  "default": {
60
31
  "config": { "platform": "server" },
61
32
  "stores": {
62
- "crm": {
63
- "package": "@walkeros/server-store-sheets",
64
- "config": {
65
- "settings": {
66
- "id": "1AbCdEfGhIjKlMnOpQrStUvWxYz",
67
- "sheet": "Customers"
68
- }
69
- }
70
- },
71
- "lookupCache": {
72
- "package": "@walkeros/store-memory",
73
- "config": { "settings": {} }
74
- }
75
- },
76
- "transformers": {
77
- "enrich": {
78
- "package": "@walkeros/transformer-enrich",
79
- "env": {
80
- "store": "$store.crm",
81
- "cache": "$store.lookupCache"
82
- },
83
- "config": {
84
- "settings": {
85
- "cache": { "ttl": 60000 }
86
- }
87
- }
88
- }
33
+ "assets": { "package": "@walkeros/server-store-sheets", "config": {} }
89
34
  }
90
35
  }
91
36
  }
92
37
  }
93
38
  ```
94
39
 
95
- Use `ttl: 5000` for demos (fast iteration), `ttl: 60000` or higher for
96
- production-ish loads. Without a cache, every event hits Sheets directly and
97
- trips the 60 req/min quota in under one second.
98
-
99
- ## Integrated Mode
100
-
101
- ```typescript
102
- import { storeSheetsInit } from '@walkeros/server-store-sheets';
103
-
104
- const store = await storeSheetsInit({
105
- collector,
106
- logger,
107
- id: 'crm',
108
- config: {
109
- settings: {
110
- id: '1AbCdEfGhIjKlMnOpQrStUvWxYz',
111
- sheet: 'Customers',
112
- // Omit credentials for ADC on Cloud Run / GKE,
113
- // or pass SA JSON: credentials: process.env.SHEETS_SA_KEY
114
- },
115
- },
116
- env: {},
117
- });
118
-
119
- const customer = await store.get('alice'); // unknown (parsed JSON) | undefined
120
- await store.set('bob', { tier: 'silver' });
121
- await store.delete('charlie');
122
- ```
123
-
124
- Each value is JSON-stringified into one cell (the `value` column). Reads
125
- JSON-parse the cell back. A non-parseable cell logs a debug line and returns
126
- `undefined`.
127
-
128
- ## Configuration
129
-
130
- | Setting | Type | Required | Default | Description |
131
- | ------------- | ------------------ | -------- | ---------- | --------------------------------------------------------- |
132
- | `id` | `string` | Yes | (none) | Spreadsheet ID, the segment between `/d/` and `/edit` |
133
- | `sheet` | `string` | No | `'Sheet1'` | Sheet (tab) name within the spreadsheet |
134
- | `key` | `string` | No | `'A'` | Column letter for keys (the lookup column) |
135
- | `value` | `string` | No | `'B'` | Column letter for values (JSON-serialized blob) |
136
- | `headerRows` | `number` | No | `1` | Number of header rows to skip when reading the key column |
137
- | `credentials` | `string \| object` | No | ADC | Service account JSON or string. Omit on GCP for ADC |
138
-
139
- ## Provisioning
140
-
141
- The package ships an idempotent `setup()` lifecycle, invoked only by the
142
- explicit operator command:
143
-
144
- ```bash
145
- walkeros setup store.<id>
146
- ```
147
-
148
- It never runs automatically. It verifies the spreadsheet exists and (if
149
- configured) writes the `setup.headers` row.
150
-
151
- ### `Setup` options
152
-
153
- | Option | Type | Default | Notes |
154
- | --------- | ---------- | ------- | ---------------------------------------------------------------------------------------------- |
155
- | `headers` | `string[]` | (none) | Header values written to row 1 of the configured sheet. Idempotent overwrite, no drift detect. |
156
-
157
- `id` is taken from `settings.id` and is NOT duplicated under `setup`.
158
-
159
- ### Behavior
160
-
161
- - **Existence probe:** setup issues
162
- `GET /spreadsheets/<id>?fields=spreadsheetId` and throws an actionable error
163
- on 404.
164
- - **Header write:** when `setup.headers` is provided, setup issues
165
- `PUT /values/<sheet>!A1:<lastCol>1?valueInputOption=RAW` with the headers as
166
- the row values. Re-running with the same headers is a no-op overwrite.
167
- - **No `shareWith`:** Drive API integration is intentionally out of scope in
168
- this version (it requires a separate OAuth scope). Share the spreadsheet
169
- manually with the service account email before running setup.
170
-
171
- ### Runtime hard-fail
172
-
173
- The first call to `init()` issues a single
174
- `GET /spreadsheets/<id>?fields=spreadsheetId` per process per spreadsheet ID. On
175
- 404 it throws:
176
-
177
- ```
178
- Spreadsheet not found: <id>. Run "walkeros setup store.<id>" to ensure the sheet exists and is shared with the service account.
179
- ```
180
-
181
- Operators see the error pointing at the exact command to fix it. Subsequent
182
- calls in the same process skip the check via an in-memory cache.
183
-
184
- ## Authentication
185
-
186
- ### Cloud Run / GKE (ADC)
187
-
188
- When running on GCP infrastructure, omit `credentials`. The store fetches tokens
189
- from the metadata server automatically. Required OAuth scope:
190
- `https://www.googleapis.com/auth/spreadsheets`.
191
-
192
- ### Non-GCP (Service Account)
193
-
194
- Pass a service account JSON as a string (from `$env.SHEETS_SA_KEY`) or as an
195
- object with `client_email` and `private_key` fields. The store signs JWTs
196
- locally and exchanges them for access tokens.
197
-
198
- ```json
199
- {
200
- "credentials": "$env.SHEETS_SA_KEY"
201
- }
202
- ```
203
-
204
- The service account email needs Editor (or at least Viewer plus the explicit
205
- `setup.headers` cells) access to the spreadsheet. Share the sheet with the
206
- service account email before running setup.
40
+ ## Documentation
207
41
 
208
- ## API
42
+ Full configuration, mapping, and examples live in the docs:
43
+ **https://www.walkeros.io/docs/stores/server/sheets**
209
44
 
210
- ```typescript
211
- const value = await store.get('alice'); // unknown | undefined
212
- await store.set('bob', { tier: 'silver' }); // void
213
- await store.delete('charlie'); // void
214
- ```
45
+ ## Contribute
215
46
 
216
- `get()` returns the JSON-parsed value, or `undefined` if the key is unknown, the
217
- value cell is empty, or the cell is not valid JSON. `set()` for an unknown key
218
- appends a new row, capturing the row index from the API response. `set()` for a
219
- known key updates the existing value cell. `delete()` blanks the value cell, the
220
- row stays in place to keep `keyToRow` indexes stable.
47
+ Feel free to contribute by submitting an
48
+ [issue](https://github.com/elbwalker/walkerOS/issues), starting a
49
+ [discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
50
+ [contact](https://calendly.com/elb-alexander/30min).
221
51
 
222
- ## Limitations
52
+ ## License
223
53
 
224
- - **Single-cell value shape.** Multi-column structured rows are out of scope,
225
- ship a richer schema in a later phase if customers ask.
226
- - **No drift detection on header content.** If an operator manually edits row 1,
227
- the next `walkeros setup store.<id>` overwrites it without warning.
228
- - **No transactional updates.** `set` is two HTTP calls (read index, write
229
- cell). Concurrent writers can interleave.
54
+ MIT
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/server-store-sheets",
4
- "version": "4.1.0-next-1778668930820",
4
+ "version": "4.1.0",
5
5
  "type": "store",
6
6
  "platform": [
7
7
  "server"
@@ -69,11 +69,7 @@
69
69
  }
70
70
  },
71
71
  "required": [
72
- "id",
73
- "sheet",
74
- "key",
75
- "value",
76
- "headerRows"
72
+ "id"
77
73
  ],
78
74
  "additionalProperties": false
79
75
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-store-sheets",
3
3
  "description": "Google Sheets store for walkerOS server flows",
4
- "version": "4.1.0-next-1778668930820",
4
+ "version": "4.1.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -20,7 +20,8 @@
20
20
  "./walkerOS.json": "./dist/walkerOS.json"
21
21
  },
22
22
  "files": [
23
- "dist/**"
23
+ "dist/**",
24
+ "CHANGELOG.md"
24
25
  ],
25
26
  "scripts": {
26
27
  "build": "tsup --silent",
@@ -32,7 +33,7 @@
32
33
  "update": "npx npm-check-updates -u && npm update"
33
34
  },
34
35
  "dependencies": {
35
- "@walkeros/core": "4.1.0-next-1778668930820"
36
+ "@walkeros/core": "4.1.0"
36
37
  },
37
38
  "devDependencies": {},
38
39
  "repository": {