@rowsncolumns/rnc-yrs-store 0.29.6 → 0.29.8

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.
@@ -188,6 +188,25 @@ export class SpreadsheetEngine {
188
188
  * differs from the engine's is written.
189
189
  */
190
190
  flushRemoteDirty(): string;
191
+ /**
192
+ * Whether the document is waiting on an update it has not received: an inbound update is
193
+ * deferred on a causal gap, or the document holds content it cannot integrate yet. Read it
194
+ * after a load: a stored state that lacks the start of some session's writes is not loaded,
195
+ * and the workbook reads as empty (`sheets()` is `[]`) with this `true`. A host must not
196
+ * seed a first sheet or write into such a workbook (rowsncolumns/spreadsheet#1874).
197
+ */
198
+ hasMissingUpdates(): boolean;
199
+ /**
200
+ * Whether the workbook holds a volatile formula: a cell, or a defined name, whose formula
201
+ * calls `NOW`, `TODAY`, `RAND`, `RANDBETWEEN`, `RANDARRAY`, `OFFSET`, `INDIRECT`, `INFO` or
202
+ * `CELL`. A formula that only reads such a cell or name does not count on its own; the cell
203
+ * or name it reads does. Read from the calc engine's graph, so it follows this session's
204
+ * edits and every merged one (a collaborator's `=NOW()` turns it true once merged), and it
205
+ * is `false` while the engine holds no graph (a document past the populate caps). The cost
206
+ * is the volatile formulas and their readers, not the workbook. A host asks this before
207
+ * `recalculateVolatile`.
208
+ */
209
+ hasVolatileFormulas(): boolean;
191
210
  /**
192
211
  * Every HOST-OWNED formula cell on a sheet (registered custom-function calls + dot accessors)
193
212
  * as a `CellChange[]` JSON, row-major (`SpreadsheetEngineLike.hostOwnedCells`). The index-backed
@@ -335,6 +354,19 @@ export class SpreadsheetEngine {
335
354
  * they can discard on failure. See [`YDocEngine::rebuild_and_recalc`].
336
355
  */
337
356
  rebuildAndRecalc(): void;
357
+ /**
358
+ * Calculate the volatile formulas and what reads them, and nothing else that is up to date,
359
+ * returning the `CommitResult` JSON (the cells whose result changed, like
360
+ * `flushRemoteDirty`). For a session that only reads (a viewer, a reopen from a device
361
+ * copy, a server-side export): `NOW()` and `TODAY()` then show the present instead of what
362
+ * the last writer stored, at the cost of those formulas and their readers instead of a full
363
+ * `recalculate`. Accepted in read-only mode (`setReadOnly`), where what it computes shows
364
+ * and is held: nothing reaches the document, `takePendingUpdates` or `encodeDiffV1`. Off
365
+ * read-only mode the changed results are written back, as after any calculation. Does
366
+ * nothing when `hasVolatileFormulas()` is false, and nothing in Manual calculation, where
367
+ * volatile formulas wait for `recalculate` (F9) as in Excel.
368
+ */
369
+ recalculateVolatile(): string;
338
370
  redo(): string;
339
371
  redoDepth(): number;
340
372
  /**
@@ -374,8 +406,15 @@ export class SpreadsheetEngine {
374
406
  * and `declareExternalFunctions` (of a name the room does not declare yet) throw
375
407
  * (`read-only-mode: …`), `addSheet` adds nothing, and `anchorRange` and `compactStyleLog`
376
408
  * write nothing.
409
+ *
410
+ * Switched off after a merge in the mode, a positional room gets the repair a merge able to
411
+ * write would have made: a cell the room holds from before a row or column insert, delete
412
+ * or move its author had not heard of is moved to where that edit puts it, as a session
413
+ * that opens the room able to write moves it at open. When that moved anything the call
414
+ * returns its `CommitResult` JSON, to be painted as `syncRemote`'s is; otherwise
415
+ * `undefined`.
377
416
  */
378
- setReadOnly(on: boolean): void;
417
+ setReadOnly(on: boolean): string | undefined;
379
418
  /**
380
419
  * Create stable-ids (v5) documents with this engine; off by default. On, the document this
381
420
  * engine itself creates starts as v5: the first edit or import of an engine that was never
@@ -636,6 +675,8 @@ export interface InitOutput {
636
675
  readonly spreadsheetengine_findAll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
637
676
  readonly spreadsheetengine_findAllBounded: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
638
677
  readonly spreadsheetengine_flushRemoteDirty: (a: number) => [number, number];
678
+ readonly spreadsheetengine_hasMissingUpdates: (a: number) => number;
679
+ readonly spreadsheetengine_hasVolatileFormulas: (a: number) => number;
639
680
  readonly spreadsheetengine_hostOwnedCells: (a: number, b: number) => [number, number];
640
681
  readonly spreadsheetengine_importCsv: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
641
682
  readonly spreadsheetengine_importDelimited: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
@@ -660,12 +701,13 @@ export interface InitOutput {
660
701
  readonly spreadsheetengine_readWindowCells: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
661
702
  readonly spreadsheetengine_readWindowCommit: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
662
703
  readonly spreadsheetengine_rebuildAndRecalc: (a: number) => void;
704
+ readonly spreadsheetengine_recalculateVolatile: (a: number) => [number, number];
663
705
  readonly spreadsheetengine_redo: (a: number) => [number, number];
664
706
  readonly spreadsheetengine_redoDepth: (a: number) => number;
665
707
  readonly spreadsheetengine_registerCustomFunction: (a: number, b: number, c: number) => void;
666
708
  readonly spreadsheetengine_scenarios: (a: number) => [number, number];
667
709
  readonly spreadsheetengine_setCommitWindows: (a: number, b: number, c: number) => [number, number];
668
- readonly spreadsheetengine_setReadOnly: (a: number, b: number) => void;
710
+ readonly spreadsheetengine_setReadOnly: (a: number, b: number) => [number, number];
669
711
  readonly spreadsheetengine_setStableIds: (a: number, b: number) => [number, number, number];
670
712
  readonly spreadsheetengine_setTimezoneOffsetMinutes: (a: number, b: number) => number;
671
713
  readonly spreadsheetengine_setWindowed: (a: number, b: number) => void;
@@ -696,13 +738,13 @@ export interface InitOutput {
696
738
  readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
697
739
  readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
698
740
  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];
699
742
  readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
700
743
  readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
701
- readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
702
- readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
703
- readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
704
744
  readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
745
+ readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
705
746
  readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
747
+ readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
706
748
  readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
707
749
  readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
708
750
  readonly __wbindgen_malloc: (a: number, b: number) => number;
@@ -632,6 +632,33 @@ export class SpreadsheetEngine {
632
632
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
633
633
  }
634
634
  }
635
+ /**
636
+ * Whether the document is waiting on an update it has not received: an inbound update is
637
+ * deferred on a causal gap, or the document holds content it cannot integrate yet. Read it
638
+ * after a load: a stored state that lacks the start of some session's writes is not loaded,
639
+ * and the workbook reads as empty (`sheets()` is `[]`) with this `true`. A host must not
640
+ * seed a first sheet or write into such a workbook (rowsncolumns/spreadsheet#1874).
641
+ * @returns {boolean}
642
+ */
643
+ hasMissingUpdates() {
644
+ const ret = wasm.spreadsheetengine_hasMissingUpdates(this.__wbg_ptr);
645
+ return ret !== 0;
646
+ }
647
+ /**
648
+ * Whether the workbook holds a volatile formula: a cell, or a defined name, whose formula
649
+ * calls `NOW`, `TODAY`, `RAND`, `RANDBETWEEN`, `RANDARRAY`, `OFFSET`, `INDIRECT`, `INFO` or
650
+ * `CELL`. A formula that only reads such a cell or name does not count on its own; the cell
651
+ * or name it reads does. Read from the calc engine's graph, so it follows this session's
652
+ * edits and every merged one (a collaborator's `=NOW()` turns it true once merged), and it
653
+ * is `false` while the engine holds no graph (a document past the populate caps). The cost
654
+ * is the volatile formulas and their readers, not the workbook. A host asks this before
655
+ * `recalculateVolatile`.
656
+ * @returns {boolean}
657
+ */
658
+ hasVolatileFormulas() {
659
+ const ret = wasm.spreadsheetengine_hasVolatileFormulas(this.__wbg_ptr);
660
+ return ret !== 0;
661
+ }
635
662
  /**
636
663
  * Every HOST-OWNED formula cell on a sheet (registered custom-function calls + dot accessors)
637
664
  * as a `CellChange[]` JSON, row-major (`SpreadsheetEngineLike.hostOwnedCells`). The index-backed
@@ -1132,6 +1159,31 @@ export class SpreadsheetEngine {
1132
1159
  rebuildAndRecalc() {
1133
1160
  wasm.spreadsheetengine_rebuildAndRecalc(this.__wbg_ptr);
1134
1161
  }
1162
+ /**
1163
+ * Calculate the volatile formulas and what reads them, and nothing else that is up to date,
1164
+ * returning the `CommitResult` JSON (the cells whose result changed, like
1165
+ * `flushRemoteDirty`). For a session that only reads (a viewer, a reopen from a device
1166
+ * copy, a server-side export): `NOW()` and `TODAY()` then show the present instead of what
1167
+ * the last writer stored, at the cost of those formulas and their readers instead of a full
1168
+ * `recalculate`. Accepted in read-only mode (`setReadOnly`), where what it computes shows
1169
+ * and is held: nothing reaches the document, `takePendingUpdates` or `encodeDiffV1`. Off
1170
+ * read-only mode the changed results are written back, as after any calculation. Does
1171
+ * nothing when `hasVolatileFormulas()` is false, and nothing in Manual calculation, where
1172
+ * volatile formulas wait for `recalculate` (F9) as in Excel.
1173
+ * @returns {string}
1174
+ */
1175
+ recalculateVolatile() {
1176
+ let deferred1_0;
1177
+ let deferred1_1;
1178
+ try {
1179
+ const ret = wasm.spreadsheetengine_recalculateVolatile(this.__wbg_ptr);
1180
+ deferred1_0 = ret[0];
1181
+ deferred1_1 = ret[1];
1182
+ return getStringFromWasm0(ret[0], ret[1]);
1183
+ } finally {
1184
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1185
+ }
1186
+ }
1135
1187
  /**
1136
1188
  * @returns {string}
1137
1189
  */
@@ -1250,10 +1302,24 @@ export class SpreadsheetEngine {
1250
1302
  * and `declareExternalFunctions` (of a name the room does not declare yet) throw
1251
1303
  * (`read-only-mode: …`), `addSheet` adds nothing, and `anchorRange` and `compactStyleLog`
1252
1304
  * write nothing.
1305
+ *
1306
+ * Switched off after a merge in the mode, a positional room gets the repair a merge able to
1307
+ * write would have made: a cell the room holds from before a row or column insert, delete
1308
+ * or move its author had not heard of is moved to where that edit puts it, as a session
1309
+ * that opens the room able to write moves it at open. When that moved anything the call
1310
+ * returns its `CommitResult` JSON, to be painted as `syncRemote`'s is; otherwise
1311
+ * `undefined`.
1253
1312
  * @param {boolean} on
1313
+ * @returns {string | undefined}
1254
1314
  */
1255
1315
  setReadOnly(on) {
1256
- wasm.spreadsheetengine_setReadOnly(this.__wbg_ptr, on);
1316
+ const ret = wasm.spreadsheetengine_setReadOnly(this.__wbg_ptr, on);
1317
+ let v1;
1318
+ if (ret[0] !== 0) {
1319
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1320
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1321
+ }
1322
+ return v1;
1257
1323
  }
1258
1324
  /**
1259
1325
  * Create stable-ids (v5) documents with this engine; off by default. On, the document this
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/rnc-yrs-store",
3
- "version": "0.29.6",
3
+ "version": "0.29.8",
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).",