@rowsncolumns/rnc-yrs-store 0.29.8 → 0.30.1

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.
@@ -330,6 +330,18 @@ export class SpreadsheetEngine {
330
330
  * sheet registry is non-empty and contains no `sheetId: 1`. Returns `true` when pruned.
331
331
  */
332
332
  pruneDanglingDefaultSeed(): boolean;
333
+ /**
334
+ * The record another replica holds under an `rncCells` key, as it reads on this engine's
335
+ * rows and columns: JSON `{sheetId, row, col, cell: {ue, ev, fv, ..} | null, derived}`,
336
+ * or `{"status":"gone"}` when a row or column of the key was deleted here.
337
+ * `foreign` is the other replica's whole state (`encodeStateAsUpdate`); a diff throws.
338
+ * Read-only: this engine's document is not changed. `cell` is `null` when the replica
339
+ * holds no typed record under the key (nothing typed, or cleared); `derived` says
340
+ * the engine wrote the record (a result, a formula's rewrite), not a person. The formula
341
+ * is rendered on this engine's lines and names; the result is the replica's own. Throws on
342
+ * a document that is not stable-ids.
343
+ */
344
+ readForeignCell(foreign: Uint8Array, key: string): string;
333
345
  /**
334
346
  * Whether read-only mode is on (`setReadOnly`).
335
347
  */
@@ -492,6 +504,35 @@ export class SpreadsheetEngine {
492
504
  * [`YrsStore::shift_log_frontier`]).
493
505
  */
494
506
  shiftLogFrontier(): string;
507
+ /**
508
+ * The commit a load returns, WITHOUT ITS CELLS: every channel of `loadFromUpdate`'s answer
509
+ * but `changes` (`styleChanges`: the formats cells hold of their own; `noteChanges`;
510
+ * `rowChanges` / `columnChanges`; `merges`; `chartChanges`; `pivotChanges`;
511
+ * `conditionalFormats`; `dataValidations`; `citations`), read from the document as it stands
512
+ * now. No cell is read to build it, so it costs what those channels hold, not what the room
513
+ * holds: load with `loadFromUpdateQuiet`, take this, and read the cells in bands
514
+ * (`readWindowCells`) or not at all. A windowed load followed by `takeOmittedCells` returns
515
+ * the same channels and every cell of the room with them.
516
+ *
517
+ * Two exceptions. On a sheet with a filter applied it lists one `rowChanges` entry per row
518
+ * of the filter and reads the filtered column to do so, as a load's commit does. In a room
519
+ * imported from xlsx the formats and the notes are on the cells and are not listed here:
520
+ * read them with the cells (`readWindowCells`).
521
+ *
522
+ * The per-cell channels are whole whatever `setCommitWindows` says. Taking this moves no
523
+ * value and takes nothing: `takeOmittedCells` still hands over what the last commit left
524
+ * out, and the load's capped formulas stay to be taken. It does derive the rows a filter
525
+ * hides if nothing had derived them yet, as `documentFacets` does: on a sheet with a filter
526
+ * and no formula, a later retype of a filtered cell can then hide other rows than it would
527
+ * have. And a session that goes on afterwards can list its answers and send its updates in
528
+ * another order. A session that loads quietly, reads and ends has nothing later to change.
529
+ *
530
+ * Formats, notes, charts and pivots are listed in a fixed order (by place, by id), where a
531
+ * load's commit lists them in the order its maps iterate. Like a load's commit it carries no
532
+ * `validations` and no `derivedFormatChanges`: a load reports no cell's validity, even for
533
+ * a cell that breaks its rule (the rules themselves are in `dataValidations`).
534
+ */
535
+ snapshotWithoutCells(): string;
495
536
  /**
496
537
  * The `rncCells` key (`"{sheetId}:{rowId}:{colId}"`) of 1-based `(row, col)`; `undefined`
497
538
  * while the row or column is unnamed (past the sheet's named extent). Never names lines.
@@ -719,6 +760,7 @@ export interface InitOutput {
719
760
  readonly spreadsheetengine_sheetMetas: (a: number) => [number, number];
720
761
  readonly spreadsheetengine_sheetStats: (a: number) => [number, number];
721
762
  readonly spreadsheetengine_sheets: (a: number) => [number, number];
763
+ readonly spreadsheetengine_snapshotWithoutCells: (a: number) => [number, number, number, number];
722
764
  readonly spreadsheetengine_staleFormulaCells: (a: number, b: number) => [number, number];
723
765
  readonly spreadsheetengine_styleLogStats: (a: number) => [number, number];
724
766
  readonly spreadsheetengine_syncRemote: (a: number) => [number, number];
@@ -738,13 +780,14 @@ export interface InitOutput {
738
780
  readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
739
781
  readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
740
782
  readonly convertToStableIds: (a: number, b: number, c: number, d: number) => [number, number, number, number];
741
- readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
742
783
  readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
743
784
  readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
744
- readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
785
+ readonly spreadsheetengine_readForeignCell: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
745
786
  readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
746
- readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
747
787
  readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
788
+ readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
789
+ readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
790
+ readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
748
791
  readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
749
792
  readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
750
793
  readonly __wbindgen_malloc: (a: number, b: number) => number;
@@ -1076,6 +1076,42 @@ export class SpreadsheetEngine {
1076
1076
  const ret = wasm.spreadsheetengine_pruneDanglingDefaultSeed(this.__wbg_ptr);
1077
1077
  return ret !== 0;
1078
1078
  }
1079
+ /**
1080
+ * The record another replica holds under an `rncCells` key, as it reads on this engine's
1081
+ * rows and columns: JSON `{sheetId, row, col, cell: {ue, ev, fv, ..} | null, derived}`,
1082
+ * or `{"status":"gone"}` when a row or column of the key was deleted here.
1083
+ * `foreign` is the other replica's whole state (`encodeStateAsUpdate`); a diff throws.
1084
+ * Read-only: this engine's document is not changed. `cell` is `null` when the replica
1085
+ * holds no typed record under the key (nothing typed, or cleared); `derived` says
1086
+ * the engine wrote the record (a result, a formula's rewrite), not a person. The formula
1087
+ * is rendered on this engine's lines and names; the result is the replica's own. Throws on
1088
+ * a document that is not stable-ids.
1089
+ * @param {Uint8Array} foreign
1090
+ * @param {string} key
1091
+ * @returns {string}
1092
+ */
1093
+ readForeignCell(foreign, key) {
1094
+ let deferred4_0;
1095
+ let deferred4_1;
1096
+ try {
1097
+ const ptr0 = passArray8ToWasm0(foreign, wasm.__wbindgen_malloc);
1098
+ const len0 = WASM_VECTOR_LEN;
1099
+ const ptr1 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1100
+ const len1 = WASM_VECTOR_LEN;
1101
+ const ret = wasm.spreadsheetengine_readForeignCell(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1102
+ var ptr3 = ret[0];
1103
+ var len3 = ret[1];
1104
+ if (ret[3]) {
1105
+ ptr3 = 0; len3 = 0;
1106
+ throw takeFromExternrefTable0(ret[2]);
1107
+ }
1108
+ deferred4_0 = ptr3;
1109
+ deferred4_1 = len3;
1110
+ return getStringFromWasm0(ptr3, len3);
1111
+ } finally {
1112
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
1113
+ }
1114
+ }
1079
1115
  /**
1080
1116
  * Whether read-only mode is on (`setReadOnly`).
1081
1117
  * @returns {boolean}
@@ -1510,6 +1546,53 @@ export class SpreadsheetEngine {
1510
1546
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1511
1547
  }
1512
1548
  }
1549
+ /**
1550
+ * The commit a load returns, WITHOUT ITS CELLS: every channel of `loadFromUpdate`'s answer
1551
+ * but `changes` (`styleChanges`: the formats cells hold of their own; `noteChanges`;
1552
+ * `rowChanges` / `columnChanges`; `merges`; `chartChanges`; `pivotChanges`;
1553
+ * `conditionalFormats`; `dataValidations`; `citations`), read from the document as it stands
1554
+ * now. No cell is read to build it, so it costs what those channels hold, not what the room
1555
+ * holds: load with `loadFromUpdateQuiet`, take this, and read the cells in bands
1556
+ * (`readWindowCells`) or not at all. A windowed load followed by `takeOmittedCells` returns
1557
+ * the same channels and every cell of the room with them.
1558
+ *
1559
+ * Two exceptions. On a sheet with a filter applied it lists one `rowChanges` entry per row
1560
+ * of the filter and reads the filtered column to do so, as a load's commit does. In a room
1561
+ * imported from xlsx the formats and the notes are on the cells and are not listed here:
1562
+ * read them with the cells (`readWindowCells`).
1563
+ *
1564
+ * The per-cell channels are whole whatever `setCommitWindows` says. Taking this moves no
1565
+ * value and takes nothing: `takeOmittedCells` still hands over what the last commit left
1566
+ * out, and the load's capped formulas stay to be taken. It does derive the rows a filter
1567
+ * hides if nothing had derived them yet, as `documentFacets` does: on a sheet with a filter
1568
+ * and no formula, a later retype of a filtered cell can then hide other rows than it would
1569
+ * have. And a session that goes on afterwards can list its answers and send its updates in
1570
+ * another order. A session that loads quietly, reads and ends has nothing later to change.
1571
+ *
1572
+ * Formats, notes, charts and pivots are listed in a fixed order (by place, by id), where a
1573
+ * load's commit lists them in the order its maps iterate. Like a load's commit it carries no
1574
+ * `validations` and no `derivedFormatChanges`: a load reports no cell's validity, even for
1575
+ * a cell that breaks its rule (the rules themselves are in `dataValidations`).
1576
+ * @returns {string}
1577
+ */
1578
+ snapshotWithoutCells() {
1579
+ let deferred2_0;
1580
+ let deferred2_1;
1581
+ try {
1582
+ const ret = wasm.spreadsheetengine_snapshotWithoutCells(this.__wbg_ptr);
1583
+ var ptr1 = ret[0];
1584
+ var len1 = ret[1];
1585
+ if (ret[3]) {
1586
+ ptr1 = 0; len1 = 0;
1587
+ throw takeFromExternrefTable0(ret[2]);
1588
+ }
1589
+ deferred2_0 = ptr1;
1590
+ deferred2_1 = len1;
1591
+ return getStringFromWasm0(ptr1, len1);
1592
+ } finally {
1593
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1594
+ }
1595
+ }
1513
1596
  /**
1514
1597
  * The `rncCells` key (`"{sheetId}:{rowId}:{colId}"`) of 1-based `(row, col)`; `undefined`
1515
1598
  * while the row or column is unnamed (past the sheet's named extent). Never names lines.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/rnc-yrs-store",
3
- "version": "0.29.8",
3
+ "version": "0.30.1",
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).",