@bilig/headless 0.11.15 → 0.11.18

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 +31 -1
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -35,7 +35,12 @@ pnpm --filter @bilig/headless build
35
35
  smoke test.
36
36
  - Try the runnable examples:
37
37
  [`examples/headless-workpaper`](https://github.com/proompteng/bilig/tree/main/examples/headless-workpaper) and
38
- [`npm run json-records`](https://github.com/proompteng/bilig/tree/main/examples/headless-workpaper#json-records-input).
38
+ [`npm run json-records`](https://github.com/proompteng/bilig/tree/main/examples/headless-workpaper#json-records-input)
39
+ for in-process records, or
40
+ [`npm run json-file`](https://github.com/proompteng/bilig/tree/main/examples/headless-workpaper#json-file-input)
41
+ for records already saved on disk, or
42
+ [`npm run http-json-summary`](https://github.com/proompteng/bilig/tree/main/examples/headless-workpaper#http-json-summary)
43
+ for a no-framework Node HTTP boundary.
39
44
  - Run the
40
45
  [serverless WorkPaper API example](https://github.com/proompteng/bilig/tree/main/examples/serverless-workpaper-api)
41
46
  when the workbook belongs behind an HTTP or agent-tool boundary.
@@ -259,6 +264,7 @@ restores the workbook, and verifies the final result.
259
264
  cd examples/headless-workpaper
260
265
  npm install
261
266
  npm start
267
+ npm run http-json-summary
262
268
  npm run agent:tool-call
263
269
  ```
264
270
 
@@ -332,6 +338,30 @@ npm run persistence
332
338
  - Mutation methods return WorkPaper change arrays. Empty arrays are valid when
333
339
  evaluation is suspended or a batch defers change publication.
334
340
 
341
+ ## WorkPaper Read/Write Cheat Sheet
342
+
343
+ The common service and agent calls use the same zero-based address object:
344
+
345
+ ```ts
346
+ const sheet = workbook.getSheetId('Sheet1')
347
+ if (sheet === undefined) throw new Error('Sheet1 was not created')
348
+ const at = (row: number, col: number) => ({ sheet, row, col })
349
+ ```
350
+
351
+ | Operation | Public API | Tiny snippet |
352
+ | ----------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
353
+ | Create a workbook | `WorkPaper.buildFromSheets()` | `const workbook = WorkPaper.buildFromSheets({ Sheet1: [[1, '=A1*2']] })` |
354
+ | Set a value | `workbook.setCellContents()` | `workbook.setCellContents(at(0, 0), 42)` |
355
+ | Set a formula | `workbook.setCellContents()` | `workbook.setCellContents(at(0, 1), '=A1*2')` |
356
+ | Read a calculated value | `workbook.getCellValue()` | `const value = workbook.getCellValue(at(0, 1))` |
357
+ | Read formula text | `workbook.getCellFormula()` | `const formula = workbook.getCellFormula(at(0, 1))` |
358
+ | Export/persist state | `exportWorkPaperDocument()` and `serializeWorkPaperDocument()` | `const json = serializeWorkPaperDocument(exportWorkPaperDocument(workbook, { includeConfig: true }))` |
359
+ | Restore persisted state | `parseWorkPaperDocument()` and `createWorkPaperFromDocument()` | `const restored = createWorkPaperFromDocument(parseWorkPaperDocument(json))` |
360
+
361
+ Use `getCellDisplayValue()` for user-facing text, `getCellSerialized()` for the
362
+ stored input shape, and range helpers such as `getRangeValues()` when an API
363
+ response needs more than one cell.
364
+
335
365
  ## Common API Recipes
336
366
 
337
367
  Create an empty workbook:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/headless",
3
- "version": "0.11.15",
3
+ "version": "0.11.18",
4
4
  "description": "Headless spreadsheet engine for Node.js formulas, workbook JSON persistence, and service-side spreadsheet automation.",
5
5
  "keywords": [
6
6
  "agent",
@@ -66,9 +66,9 @@
66
66
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
67
67
  },
68
68
  "dependencies": {
69
- "@bilig/core": "0.11.15",
70
- "@bilig/formula": "0.11.15",
71
- "@bilig/protocol": "0.11.15"
69
+ "@bilig/core": "0.11.18",
70
+ "@bilig/formula": "0.11.18",
71
+ "@bilig/protocol": "0.11.18"
72
72
  },
73
73
  "engines": {
74
74
  "node": ">=24.0.0"