@rowsncolumns/rnc-yrs-store 0.25.2 → 0.27.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.
@@ -216,8 +216,10 @@ export class SpreadsheetEngine {
216
216
  */
217
217
  importXlsx(bytes: Uint8Array): string;
218
218
  /**
219
- * Import exactly ONE sheet of the workbook — `sheet_id` is the positional (1-based) `sheetId`
220
- * from [`listXlsxSheets`](Self::list_xlsx_sheets). Pass `finalize: false` on every call but the
219
+ * Import exactly ONE sheet of the workbook — `sheet_id` is the sheet's `sheetId` in
220
+ * [`listXlsxSheets`](Self::list_xlsx_sheets): its position (1-based), unless the workbook carries
221
+ * the engine's own sheet ids (an `exportXlsx` of a document whose ids are not its tab
222
+ * positions), which the sheet then keeps. Pass `finalize: false` on every call but the
221
223
  * sequence's last: intermediate calls skip the whole-document recalc and the workbook-level
222
224
  * facets (named ranges, slicers, pivots, calcPr, Power Query), which land on the `finalize`
223
225
  * call together with the engine rebuild + recalc (or its over-cap skip — check
@@ -356,11 +358,13 @@ export class SpreadsheetEngine {
356
358
  */
357
359
  setCommitWindows(windows_json: string): void;
358
360
  /**
359
- * Create stable-ids (v5) documents with this engine; off by default. On, a document it creates
360
- * starts as v5 — its first edit or import on a fresh engine, or a loaded document that holds no
361
- * data yet. A document that holds data is never converted (existing documents stay v3), and a
362
- * v5 document always runs as v5, whatever the setting. Set it from the asset's chosen version,
363
- * for everyone who opens the asset. `true` when the call made the open (blank) document v5.
361
+ * Create stable-ids (v5) documents with this engine; off by default. On, the document this
362
+ * engine itself creates starts as v5: the first edit or import of an engine that was never
363
+ * loaded from an update and never merged one. A document the engine was handed is never made
364
+ * v5 by the setting, blank or not — a room that is to be v5 is born with the stamp
365
+ * (`docMeta.sheetDataVersion = "v5"`, written by whoever creates the room) — and a v5
366
+ * document always runs as v5, whatever the setting. `true` when the call made the document
367
+ * this engine is creating v5.
364
368
  */
365
369
  setStableIds(enabled: boolean): boolean;
366
370
  /**
@@ -470,6 +474,16 @@ export class SpreadsheetEngine {
470
474
  * Drain the merged v1 update produced by local edits since the last call (empty = nothing).
471
475
  */
472
476
  takePendingUpdates(): Uint8Array;
477
+ /**
478
+ * The positional writes that were not in the v5 planes when this session moved to the
479
+ * stable-ids store: the session was on a v3 document and an update made it v5 (a conversion
480
+ * that had not read what this session wrote or received since). JSON array of
481
+ * `{kind: "cell" | "note" | "row" | "column", sheetId, rowIndex, columnIndex, value?,
482
+ * formula?, written, current}`; the same list is on the commit the move renders, as
483
+ * `unconvertedWrites`. Taken once (`"[]"` afterwards, and for a session that never moved).
484
+ * The engine does not apply them: show them and let the person re-apply.
485
+ */
486
+ takeUnconvertedWrites(): string;
473
487
  /**
474
488
  * Resolve a `GridRange` on `sheet_id` taken at `frontier_json` (a `shiftLogFrontier` value) to
475
489
  * its current coordinates: JSON `{range: GridRange | null, status: "ok" | "gone" | "unknown"}`
@@ -477,6 +491,12 @@ export class SpreadsheetEngine {
477
491
  * cap, or the frontier names ops undone since); a malformed input is an `Err`.
478
492
  */
479
493
  transformRange(sheet_id: number, range_json: string, frontier_json: string): string;
494
+ /**
495
+ * The same list read from the document as it is now, nothing taken: what a v5 document's
496
+ * positional planes hold that its v5 planes do not. `"[]"` after a conversion that read
497
+ * everything, and for a v3 document.
498
+ */
499
+ unconvertedWrites(): string;
480
500
  undo(): string;
481
501
  /**
482
502
  * Undo / redo stack depth (`SpreadsheetEngineLike.undoDepth` / `redoDepth`).
@@ -607,6 +627,8 @@ export interface InitOutput {
607
627
  readonly spreadsheetengine_takeCappedFormulas: (a: number) => [number, number];
608
628
  readonly spreadsheetengine_takeOmittedCells: (a: number) => [number, number];
609
629
  readonly spreadsheetengine_takePendingUpdates: (a: number) => [number, number];
630
+ readonly spreadsheetengine_takeUnconvertedWrites: (a: number) => [number, number];
631
+ readonly spreadsheetengine_unconvertedWrites: (a: number) => [number, number];
610
632
  readonly spreadsheetengine_undo: (a: number) => [number, number];
611
633
  readonly spreadsheetengine_undoDepth: (a: number) => number;
612
634
  readonly spreadsheetengine_unregisterExternalFunctions: (a: number, b: number, c: number) => void;
@@ -617,15 +639,15 @@ export interface InitOutput {
617
639
  readonly yrssheetdoc_new: () => number;
618
640
  readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
619
641
  readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
620
- readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
621
- readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
622
- readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
623
- readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
624
642
  readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
625
643
  readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
626
644
  readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
627
645
  readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
628
646
  readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
647
+ readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
648
+ readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
649
+ readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
650
+ readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
629
651
  readonly __wbindgen_malloc: (a: number, b: number) => number;
630
652
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
631
653
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -723,8 +723,10 @@ export class SpreadsheetEngine {
723
723
  }
724
724
  }
725
725
  /**
726
- * Import exactly ONE sheet of the workbook — `sheet_id` is the positional (1-based) `sheetId`
727
- * from [`listXlsxSheets`](Self::list_xlsx_sheets). Pass `finalize: false` on every call but the
726
+ * Import exactly ONE sheet of the workbook — `sheet_id` is the sheet's `sheetId` in
727
+ * [`listXlsxSheets`](Self::list_xlsx_sheets): its position (1-based), unless the workbook carries
728
+ * the engine's own sheet ids (an `exportXlsx` of a document whose ids are not its tab
729
+ * positions), which the sheet then keeps. Pass `finalize: false` on every call but the
728
730
  * sequence's last: intermediate calls skip the whole-document recalc and the workbook-level
729
731
  * facets (named ranges, slicers, pivots, calcPr, Power Query), which land on the `finalize`
730
732
  * call together with the engine rebuild + recalc (or its over-cap skip — check
@@ -1228,11 +1230,13 @@ export class SpreadsheetEngine {
1228
1230
  }
1229
1231
  }
1230
1232
  /**
1231
- * Create stable-ids (v5) documents with this engine; off by default. On, a document it creates
1232
- * starts as v5 — its first edit or import on a fresh engine, or a loaded document that holds no
1233
- * data yet. A document that holds data is never converted (existing documents stay v3), and a
1234
- * v5 document always runs as v5, whatever the setting. Set it from the asset's chosen version,
1235
- * for everyone who opens the asset. `true` when the call made the open (blank) document v5.
1233
+ * Create stable-ids (v5) documents with this engine; off by default. On, the document this
1234
+ * engine itself creates starts as v5: the first edit or import of an engine that was never
1235
+ * loaded from an update and never merged one. A document the engine was handed is never made
1236
+ * v5 by the setting, blank or not — a room that is to be v5 is born with the stamp
1237
+ * (`docMeta.sheetDataVersion = "v5"`, written by whoever creates the room) — and a v5
1238
+ * document always runs as v5, whatever the setting. `true` when the call made the document
1239
+ * this engine is creating v5.
1236
1240
  * @param {boolean} enabled
1237
1241
  * @returns {boolean}
1238
1242
  */
@@ -1535,6 +1539,28 @@ export class SpreadsheetEngine {
1535
1539
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1536
1540
  return v1;
1537
1541
  }
1542
+ /**
1543
+ * The positional writes that were not in the v5 planes when this session moved to the
1544
+ * stable-ids store: the session was on a v3 document and an update made it v5 (a conversion
1545
+ * that had not read what this session wrote or received since). JSON array of
1546
+ * `{kind: "cell" | "note" | "row" | "column", sheetId, rowIndex, columnIndex, value?,
1547
+ * formula?, written, current}`; the same list is on the commit the move renders, as
1548
+ * `unconvertedWrites`. Taken once (`"[]"` afterwards, and for a session that never moved).
1549
+ * The engine does not apply them: show them and let the person re-apply.
1550
+ * @returns {string}
1551
+ */
1552
+ takeUnconvertedWrites() {
1553
+ let deferred1_0;
1554
+ let deferred1_1;
1555
+ try {
1556
+ const ret = wasm.spreadsheetengine_takeUnconvertedWrites(this.__wbg_ptr);
1557
+ deferred1_0 = ret[0];
1558
+ deferred1_1 = ret[1];
1559
+ return getStringFromWasm0(ret[0], ret[1]);
1560
+ } finally {
1561
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1562
+ }
1563
+ }
1538
1564
  /**
1539
1565
  * Resolve a `GridRange` on `sheet_id` taken at `frontier_json` (a `shiftLogFrontier` value) to
1540
1566
  * its current coordinates: JSON `{range: GridRange | null, status: "ok" | "gone" | "unknown"}`
@@ -1567,6 +1593,24 @@ export class SpreadsheetEngine {
1567
1593
  wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1568
1594
  }
1569
1595
  }
1596
+ /**
1597
+ * The same list read from the document as it is now, nothing taken: what a v5 document's
1598
+ * positional planes hold that its v5 planes do not. `"[]"` after a conversion that read
1599
+ * everything, and for a v3 document.
1600
+ * @returns {string}
1601
+ */
1602
+ unconvertedWrites() {
1603
+ let deferred1_0;
1604
+ let deferred1_1;
1605
+ try {
1606
+ const ret = wasm.spreadsheetengine_unconvertedWrites(this.__wbg_ptr);
1607
+ deferred1_0 = ret[0];
1608
+ deferred1_1 = ret[1];
1609
+ return getStringFromWasm0(ret[0], ret[1]);
1610
+ } finally {
1611
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1612
+ }
1613
+ }
1570
1614
  /**
1571
1615
  * @returns {string}
1572
1616
  */
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/rnc-yrs-store",
3
- "version": "0.25.2",
3
+ "version": "0.27.0",
4
4
  "author": "Vinay M",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "description": "Document-backed Rust→WASM spreadsheet calc engine (yrs/CRDT, canonical sheetDataV3). Ships the `SpreadsheetEngine` (a `Store<YrsStore>`): applyCommand / undo / redo / canUndo + the Yjs collaboration surface (applyUpdate / takePendingUpdates / loadFromUpdate / stateAsUpdate) the Keryx update-pump binds to. This is the 1,000,000-row engine the demo-app ships today — previously vendored, now a versioned package. The PREBUILT wasm is included (consumers need NO Rust/wasm toolchain); the glue's default init REQUIRES an explicit `module_or_path` — pass the URL of the served `rnc_yrs_store_bg.wasm` (webpack/Turbopack statically resolve a bundled `new URL`, which would 404 from this package, so the inline-default branch is intentionally a throw).",
@@ -18,7 +18,8 @@
18
18
  "comment": "The vendored wasm in `src/wasm` is built from the in-tree `rust/crates/rnc-yrs-store` with `yarn build:wasm` (pinned toolchain from rust/rust-toolchain.toml; artifacts copied verbatim, stamped by src/wasm/BUILD_INFO.json). A release never compiles Rust, so re-vendor after any change under rust/ — CI's `wasm` job fails otherwise (scripts/check-wasm-fresh.mjs). Callers pass the served wasm URL as `module_or_path` (see README).",
19
19
  "scripts": {
20
20
  "build": "rm -rf dist && mkdir -p dist && cp -f src/wasm/rnc_yrs_store.js src/wasm/rnc_yrs_store.d.ts src/wasm/rnc_yrs_store_bg.wasm dist/",
21
- "build:wasm": "node ../../scripts/build-wasm.mjs --package rnc-yrs-store"
21
+ "build:wasm": "node ../../scripts/build-wasm.mjs --package rnc-yrs-store",
22
+ "prepublishOnly": "node ../../scripts/build-native.mjs --verify --release"
22
23
  },
23
24
  "files": [
24
25
  "dist"