@bilig/headless 0.10.13 → 0.10.15

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.
Files changed (2) hide show
  1. package/README.md +28 -4
  2. package/package.json +14 -5
package/README.md CHANGED
@@ -143,6 +143,10 @@ pnpm --filter @bilig/headless build
143
143
 
144
144
  ## Quickstart
145
145
 
146
+ This snippet is safe to paste into a one-file npm evaluation. It verifies formula
147
+ readback before and after a persisted restore instead of only printing a demo
148
+ value.
149
+
146
150
  ```ts
147
151
  import {
148
152
  WorkPaper,
@@ -167,6 +171,16 @@ const workbook = WorkPaper.buildFromSheets(
167
171
  },
168
172
  )
169
173
 
174
+ const numberValue = (cell: unknown): number => {
175
+ if (typeof cell === 'object' && cell !== null && 'value' in cell) {
176
+ const value = (cell as { value: unknown }).value
177
+ if (typeof value === 'number') {
178
+ return value
179
+ }
180
+ }
181
+ throw new Error(`expected numeric cell value, got ${JSON.stringify(cell)}`)
182
+ }
183
+
170
184
  const sheet = workbook.getSheetId('Sheet1')
171
185
  if (sheet === undefined) {
172
186
  throw new Error('Sheet1 was not created')
@@ -178,11 +192,15 @@ const at = (row: number, col: number): WorkPaperCellAddress => ({
178
192
  col,
179
193
  })
180
194
 
181
- console.log(workbook.getCellValue(at(0, 2))) // CellValue for 30
195
+ const initial = numberValue(workbook.getCellValue(at(0, 2)))
196
+ if (initial !== 30) {
197
+ throw new Error(`unexpected initial formula value: ${String(initial)}`)
198
+ }
182
199
 
183
200
  workbook.setCellContents(at(1, 2), '=A2+B2')
184
- console.log(workbook.getCellFormula(at(1, 2))) // "=A2+B2"
185
- console.log(workbook.getCellSerialized(at(1, 2))) // "=A2+B2"
201
+ if (workbook.getCellFormula(at(1, 2)) !== '=A2+B2') {
202
+ throw new Error('formula text was not recorded')
203
+ }
186
204
 
187
205
  const document = exportWorkPaperDocument(workbook)
188
206
  const json = serializeWorkPaperDocument(document)
@@ -192,7 +210,13 @@ if (restoredSheet === undefined) {
192
210
  throw new Error('Sheet1 was not restored')
193
211
  }
194
212
 
195
- console.log(restored.getCellValue({ sheet: restoredSheet, row: 1, col: 2 }))
213
+ const restoredValue = numberValue(restored.getCellValue({ sheet: restoredSheet, row: 1, col: 2 }))
214
+ const verified = restoredValue === 28 && restored.getSheetNames().includes('Sheet1')
215
+ if (!verified) {
216
+ throw new Error(`unexpected restored formula value: ${String(restoredValue)}`)
217
+ }
218
+
219
+ console.log({ initial, restoredValue, bytes: json.length, verified })
196
220
  ```
197
221
 
198
222
  ## Runnable Example
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@bilig/headless",
3
- "version": "0.10.13",
3
+ "version": "0.10.15",
4
4
  "description": "Headless spreadsheet engine and WorkPaper workbook facade for Node services, coding agents, and HyperFormula-style workflows.",
5
5
  "keywords": [
6
6
  "agent",
7
+ "agents",
8
+ "ai-agents",
7
9
  "automation",
8
10
  "bilig",
11
+ "coding-agents",
12
+ "excel-automation",
9
13
  "formula",
10
14
  "formula-engine",
11
15
  "headless",
@@ -13,9 +17,14 @@
13
17
  "hyperformula",
14
18
  "local-first",
15
19
  "node",
20
+ "nodejs",
16
21
  "spreadsheet",
22
+ "spreadsheet-automation",
17
23
  "spreadsheet-engine",
18
- "workbook"
24
+ "workbook",
25
+ "workbook-api",
26
+ "workbook-engine",
27
+ "workpaper"
19
28
  ],
20
29
  "homepage": "https://proompteng.github.io/bilig/",
21
30
  "bugs": {
@@ -49,9 +58,9 @@
49
58
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
50
59
  },
51
60
  "dependencies": {
52
- "@bilig/core": "0.10.13",
53
- "@bilig/formula": "0.10.13",
54
- "@bilig/protocol": "0.10.13"
61
+ "@bilig/core": "0.10.15",
62
+ "@bilig/formula": "0.10.15",
63
+ "@bilig/protocol": "0.10.15"
55
64
  },
56
65
  "engines": {
57
66
  "node": ">=24.0.0"