@rowsncolumns/rnc-yrs-store 0.10.4 → 0.10.6

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.
@@ -33,6 +33,13 @@ export class SpreadsheetEngine {
33
33
  * Drop the entire undo/redo history (`SpreadsheetEngineLike.clearHistory`).
34
34
  */
35
35
  clearHistory(): void;
36
+ /**
37
+ * Fold the style log into a base, keeping the newest `keep_tail` buffers live (see
38
+ * `YrsStore::compact_style_log`). Meant for a host holding the workbook write lease (a server
39
+ * or warm room), not for every browser. JSON `{before, after, folded, keptTail, baseBuffers,
40
+ * seedRemoved, cells, skipped?}`.
41
+ */
42
+ compactStyleLog(keep_tail: number): string;
36
43
  /**
37
44
  * Parse CSV text into a row-major grid of cell strings using the fast Rust `csv` reader, returned
38
45
  * as JSON `Vec<Vec<String>>`. The host writes the grid into the sheet via a `change-batch` command
@@ -264,6 +271,11 @@ export class SpreadsheetEngine {
264
271
  */
265
272
  sheets(): string;
266
273
  stateAsUpdate(): Uint8Array;
274
+ /**
275
+ * JSON `{buffers, baseBuffers, bytes, seedEntries, styledCells}` — the style history a load
276
+ * replays. Hosts call this to decide when `compactStyleLog` is worth running.
277
+ */
278
+ styleLogStats(): string;
267
279
  /**
268
280
  * Project the cells touched by the preceding `applyUpdate` and return the `CommitResult` JSON
269
281
  * (`CollabSync.syncRemote`).
@@ -312,6 +324,7 @@ export interface InitOutput {
312
324
  readonly spreadsheetengine_canRedo: (a: number) => number;
313
325
  readonly spreadsheetengine_canUndo: (a: number) => number;
314
326
  readonly spreadsheetengine_clearHistory: (a: number) => void;
327
+ readonly spreadsheetengine_compactStyleLog: (a: number, b: number) => [number, number];
315
328
  readonly spreadsheetengine_dataEdge: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
316
329
  readonly spreadsheetengine_dataRegion: (a: number, b: number, c: number, d: number) => [number, number];
317
330
  readonly spreadsheetengine_deferredRemoteUpdates: (a: number) => number;
@@ -355,6 +368,7 @@ export interface InitOutput {
355
368
  readonly spreadsheetengine_sheetIds: (a: number) => [number, number];
356
369
  readonly spreadsheetengine_sheetStats: (a: number) => [number, number];
357
370
  readonly spreadsheetengine_sheets: (a: number) => [number, number];
371
+ readonly spreadsheetengine_styleLogStats: (a: number) => [number, number];
358
372
  readonly spreadsheetengine_syncRemote: (a: number) => [number, number];
359
373
  readonly spreadsheetengine_takeCappedFormulas: (a: number) => [number, number];
360
374
  readonly spreadsheetengine_takePendingUpdates: (a: number) => [number, number];
@@ -113,6 +113,26 @@ export class SpreadsheetEngine {
113
113
  clearHistory() {
114
114
  wasm.spreadsheetengine_clearHistory(this.__wbg_ptr);
115
115
  }
116
+ /**
117
+ * Fold the style log into a base, keeping the newest `keep_tail` buffers live (see
118
+ * `YrsStore::compact_style_log`). Meant for a host holding the workbook write lease (a server
119
+ * or warm room), not for every browser. JSON `{before, after, folded, keptTail, baseBuffers,
120
+ * seedRemoved, cells, skipped?}`.
121
+ * @param {number} keep_tail
122
+ * @returns {string}
123
+ */
124
+ compactStyleLog(keep_tail) {
125
+ let deferred1_0;
126
+ let deferred1_1;
127
+ try {
128
+ const ret = wasm.spreadsheetengine_compactStyleLog(this.__wbg_ptr, keep_tail);
129
+ deferred1_0 = ret[0];
130
+ deferred1_1 = ret[1];
131
+ return getStringFromWasm0(ret[0], ret[1]);
132
+ } finally {
133
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
134
+ }
135
+ }
116
136
  /**
117
137
  * Parse CSV text into a row-major grid of cell strings using the fast Rust `csv` reader, returned
118
138
  * as JSON `Vec<Vec<String>>`. The host writes the grid into the sheet via a `change-batch` command
@@ -913,6 +933,23 @@ export class SpreadsheetEngine {
913
933
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
914
934
  return v1;
915
935
  }
936
+ /**
937
+ * JSON `{buffers, baseBuffers, bytes, seedEntries, styledCells}` — the style history a load
938
+ * replays. Hosts call this to decide when `compactStyleLog` is worth running.
939
+ * @returns {string}
940
+ */
941
+ styleLogStats() {
942
+ let deferred1_0;
943
+ let deferred1_1;
944
+ try {
945
+ const ret = wasm.spreadsheetengine_styleLogStats(this.__wbg_ptr);
946
+ deferred1_0 = ret[0];
947
+ deferred1_1 = ret[1];
948
+ return getStringFromWasm0(ret[0], ret[1]);
949
+ } finally {
950
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
951
+ }
952
+ }
916
953
  /**
917
954
  * Project the cells touched by the preceding `applyUpdate` and return the `CommitResult` JSON
918
955
  * (`CollabSync.syncRemote`).
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/rnc-yrs-store",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
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).",