@rowsncolumns/rnc-yrs-store 0.27.1 → 0.29.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.
- package/dist/rnc_yrs_store.d.ts +55 -5
- package/dist/rnc_yrs_store.js +67 -1
- package/dist/rnc_yrs_store_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/rnc_yrs_store.d.ts
CHANGED
|
@@ -311,6 +311,10 @@ export class SpreadsheetEngine {
|
|
|
311
311
|
* sheet registry is non-empty and contains no `sheetId: 1`. Returns `true` when pruned.
|
|
312
312
|
*/
|
|
313
313
|
pruneDanglingDefaultSeed(): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Whether read-only mode is on (`setReadOnly`).
|
|
316
|
+
*/
|
|
317
|
+
readOnly(): boolean;
|
|
314
318
|
readWindow(sheet_id: number, start_row: number, start_col: number, end_row: number, end_col: number): string;
|
|
315
319
|
/**
|
|
316
320
|
* A window's cells + effective styles as COMPACT JSON —
|
|
@@ -357,6 +361,16 @@ export class SpreadsheetEngine {
|
|
|
357
361
|
* clears them (commits whole again). Takes effect from the next commit.
|
|
358
362
|
*/
|
|
359
363
|
setCommitWindows(windows_json: string): void;
|
|
364
|
+
/**
|
|
365
|
+
* Read-only mode, which the host sets from the room's grant: while on, the engine writes
|
|
366
|
+
* nothing to the document. Recalculations still run and show what they compute (a volatile
|
|
367
|
+
* `NOW()` included), held in the engine; no write-back, display refresh, link, computed
|
|
368
|
+
* value or merge repair reaches `takePendingUpdates` or `encodeDiffV1`, and every command but
|
|
369
|
+
* a calculation (`recalculate`, `calculate-sheet`, `calculate-full`) is refused (rejection
|
|
370
|
+
* code `read-only-mode`). Off again, the held results are dropped and the document's values
|
|
371
|
+
* show. Off by default.
|
|
372
|
+
*/
|
|
373
|
+
setReadOnly(on: boolean): void;
|
|
360
374
|
/**
|
|
361
375
|
* Create stable-ids (v5) documents with this engine; off by default. On, the document this
|
|
362
376
|
* engine itself creates starts as v5: the first edit or import of an engine that was never
|
|
@@ -410,7 +424,8 @@ export class SpreadsheetEngine {
|
|
|
410
424
|
sheetIds(): Int32Array;
|
|
411
425
|
/**
|
|
412
426
|
* Every sheet's view metadata as JSON `{"<sheetId>": SheetMeta}`, with a stable-ids sheet's
|
|
413
|
-
* print area, print titles, page breaks and ignored-error ranges at their current positions
|
|
427
|
+
* print area, print titles, page breaks and ignored-error ranges at their current positions
|
|
428
|
+
* and its frozen counts as they are now.
|
|
414
429
|
*/
|
|
415
430
|
sheetMetas(): string;
|
|
416
431
|
/**
|
|
@@ -533,6 +548,38 @@ export class YrsSheetDoc {
|
|
|
533
548
|
setCell(sheet_id: number, row: number, col: number, cell_json: string): void;
|
|
534
549
|
}
|
|
535
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Converts a positional (v3) document to stable ids (v5), outside any room.
|
|
553
|
+
*
|
|
554
|
+
* `positional_state` is the document's whole state as one v1 update (what `encodeStateAsUpdate`
|
|
555
|
+
* gives). The result is the converted document's whole state as one v1 update. It loads in a
|
|
556
|
+
* fresh engine as an ordinary v5 document and reads, cell for cell and facet for facet, what the
|
|
557
|
+
* input read on the positional store. The positional entries the conversion read are not in the
|
|
558
|
+
* result; an entry of a shape this engine does not know stays where it is and reads `#UNKNOWN!`,
|
|
559
|
+
* as it does on both stores.
|
|
560
|
+
*
|
|
561
|
+
* The result is a document of its own: read its content and copy it into a room, never merge
|
|
562
|
+
* its bytes into one (the room was converted by another run, under other ids). Two conversions
|
|
563
|
+
* of the same input read the same; their bytes are not the same.
|
|
564
|
+
*
|
|
565
|
+
* Refuses with no result (wasm: throws the message; Rust: `Err`). The message starts with:
|
|
566
|
+
* * `already-stable-ids` ([`CONVERT_ALREADY_STABLE_IDS`]): the input is already v5;
|
|
567
|
+
* * `newer-format` ([`CONVERT_NEWER_FORMAT`]): the input is stamped with a data format after v5;
|
|
568
|
+
* * `migration-refused` ([`crate::MIGRATION_REFUSED`]): a `sheet-format.cells` the migration of
|
|
569
|
+
* this engine does not convert;
|
|
570
|
+
* * `invalid-document` ([`CONVERT_INVALID_DOCUMENT`]): bytes that are not a v1 update, an update
|
|
571
|
+
* that is not a whole state, a document that holds no sheet and no cell, or a positional
|
|
572
|
+
* entry outside the grid (row 0, or past row 1,048,576 or column 16,384);
|
|
573
|
+
* * `convert-failed` ([`CONVERT_FAILED`]): the migration would leave a positional entry out of
|
|
574
|
+
* the converted document (two entries for one cell, for one), or the engine failed.
|
|
575
|
+
*
|
|
576
|
+
* It runs the migration a load into the v5 store runs ([`YrsStore::migrate_to_v5`]) on a store
|
|
577
|
+
* of its own, twice: once keeping the positional plane, to check that the v5 document holds
|
|
578
|
+
* every positional entry, then once deleting what it read, for the result. No engine session,
|
|
579
|
+
* no calc engine. An engine still never converts a document it is handed (`dual.rs`).
|
|
580
|
+
*/
|
|
581
|
+
export function convertToStableIds(positional_state: Uint8Array): Uint8Array;
|
|
582
|
+
|
|
536
583
|
/**
|
|
537
584
|
* Engine-less resolution of a `GridRange` on `sheet_id` through an op list in application order
|
|
538
585
|
* (`[{sheetId, index, delta, axis: "row" | "column"}]` — the shift-log wire shape; the Keryx
|
|
@@ -601,6 +648,7 @@ export interface InitOutput {
|
|
|
601
648
|
readonly spreadsheetengine_parseCsv: (a: number, b: number, c: number) => [number, number, number, number];
|
|
602
649
|
readonly spreadsheetengine_precedents: (a: number, b: number, c: number, d: number) => [number, number];
|
|
603
650
|
readonly spreadsheetengine_pruneDanglingDefaultSeed: (a: number) => number;
|
|
651
|
+
readonly spreadsheetengine_readOnly: (a: number) => number;
|
|
604
652
|
readonly spreadsheetengine_readWindow: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
605
653
|
readonly spreadsheetengine_readWindowCells: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
606
654
|
readonly spreadsheetengine_readWindowCommit: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
@@ -610,6 +658,7 @@ export interface InitOutput {
|
|
|
610
658
|
readonly spreadsheetengine_registerCustomFunction: (a: number, b: number, c: number) => void;
|
|
611
659
|
readonly spreadsheetengine_scenarios: (a: number) => [number, number];
|
|
612
660
|
readonly spreadsheetengine_setCommitWindows: (a: number, b: number, c: number) => [number, number];
|
|
661
|
+
readonly spreadsheetengine_setReadOnly: (a: number, b: number) => void;
|
|
613
662
|
readonly spreadsheetengine_setStableIds: (a: number, b: number) => [number, number, number];
|
|
614
663
|
readonly spreadsheetengine_setTimezoneOffsetMinutes: (a: number, b: number) => number;
|
|
615
664
|
readonly spreadsheetengine_setWindowed: (a: number, b: number) => void;
|
|
@@ -639,15 +688,16 @@ export interface InitOutput {
|
|
|
639
688
|
readonly yrssheetdoc_new: () => number;
|
|
640
689
|
readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
641
690
|
readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
|
|
691
|
+
readonly convertToStableIds: (a: number, b: number) => [number, number, number, number];
|
|
642
692
|
readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
643
|
-
readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
|
|
644
|
-
readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
|
|
645
|
-
readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
646
|
-
readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
647
693
|
readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
|
|
648
694
|
readonly spreadsheetengine_parseStableCellKey: (a: number, b: number, c: number) => [number, number];
|
|
695
|
+
readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
|
|
649
696
|
readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
|
|
697
|
+
readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
|
|
650
698
|
readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
|
|
699
|
+
readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
700
|
+
readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
651
701
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
652
702
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
653
703
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
package/dist/rnc_yrs_store.js
CHANGED
|
@@ -1049,6 +1049,14 @@ export class SpreadsheetEngine {
|
|
|
1049
1049
|
const ret = wasm.spreadsheetengine_pruneDanglingDefaultSeed(this.__wbg_ptr);
|
|
1050
1050
|
return ret !== 0;
|
|
1051
1051
|
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Whether read-only mode is on (`setReadOnly`).
|
|
1054
|
+
* @returns {boolean}
|
|
1055
|
+
*/
|
|
1056
|
+
readOnly() {
|
|
1057
|
+
const ret = wasm.spreadsheetengine_readOnly(this.__wbg_ptr);
|
|
1058
|
+
return ret !== 0;
|
|
1059
|
+
}
|
|
1052
1060
|
/**
|
|
1053
1061
|
* @param {number} sheet_id
|
|
1054
1062
|
* @param {number} start_row
|
|
@@ -1229,6 +1237,19 @@ export class SpreadsheetEngine {
|
|
|
1229
1237
|
throw takeFromExternrefTable0(ret[0]);
|
|
1230
1238
|
}
|
|
1231
1239
|
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Read-only mode, which the host sets from the room's grant: while on, the engine writes
|
|
1242
|
+
* nothing to the document. Recalculations still run and show what they compute (a volatile
|
|
1243
|
+
* `NOW()` included), held in the engine; no write-back, display refresh, link, computed
|
|
1244
|
+
* value or merge repair reaches `takePendingUpdates` or `encodeDiffV1`, and every command but
|
|
1245
|
+
* a calculation (`recalculate`, `calculate-sheet`, `calculate-full`) is refused (rejection
|
|
1246
|
+
* code `read-only-mode`). Off again, the held results are dropped and the document's values
|
|
1247
|
+
* show. Off by default.
|
|
1248
|
+
* @param {boolean} on
|
|
1249
|
+
*/
|
|
1250
|
+
setReadOnly(on) {
|
|
1251
|
+
wasm.spreadsheetengine_setReadOnly(this.__wbg_ptr, on);
|
|
1252
|
+
}
|
|
1232
1253
|
/**
|
|
1233
1254
|
* Create stable-ids (v5) documents with this engine; off by default. On, the document this
|
|
1234
1255
|
* engine itself creates starts as v5: the first edit or import of an engine that was never
|
|
@@ -1346,7 +1367,8 @@ export class SpreadsheetEngine {
|
|
|
1346
1367
|
}
|
|
1347
1368
|
/**
|
|
1348
1369
|
* Every sheet's view metadata as JSON `{"<sheetId>": SheetMeta}`, with a stable-ids sheet's
|
|
1349
|
-
* print area, print titles, page breaks and ignored-error ranges at their current positions
|
|
1370
|
+
* print area, print titles, page breaks and ignored-error ranges at their current positions
|
|
1371
|
+
* and its frozen counts as they are now.
|
|
1350
1372
|
* @returns {string}
|
|
1351
1373
|
*/
|
|
1352
1374
|
sheetMetas() {
|
|
@@ -1751,6 +1773,50 @@ export class YrsSheetDoc {
|
|
|
1751
1773
|
}
|
|
1752
1774
|
if (Symbol.dispose) YrsSheetDoc.prototype[Symbol.dispose] = YrsSheetDoc.prototype.free;
|
|
1753
1775
|
|
|
1776
|
+
/**
|
|
1777
|
+
* Converts a positional (v3) document to stable ids (v5), outside any room.
|
|
1778
|
+
*
|
|
1779
|
+
* `positional_state` is the document's whole state as one v1 update (what `encodeStateAsUpdate`
|
|
1780
|
+
* gives). The result is the converted document's whole state as one v1 update. It loads in a
|
|
1781
|
+
* fresh engine as an ordinary v5 document and reads, cell for cell and facet for facet, what the
|
|
1782
|
+
* input read on the positional store. The positional entries the conversion read are not in the
|
|
1783
|
+
* result; an entry of a shape this engine does not know stays where it is and reads `#UNKNOWN!`,
|
|
1784
|
+
* as it does on both stores.
|
|
1785
|
+
*
|
|
1786
|
+
* The result is a document of its own: read its content and copy it into a room, never merge
|
|
1787
|
+
* its bytes into one (the room was converted by another run, under other ids). Two conversions
|
|
1788
|
+
* of the same input read the same; their bytes are not the same.
|
|
1789
|
+
*
|
|
1790
|
+
* Refuses with no result (wasm: throws the message; Rust: `Err`). The message starts with:
|
|
1791
|
+
* * `already-stable-ids` ([`CONVERT_ALREADY_STABLE_IDS`]): the input is already v5;
|
|
1792
|
+
* * `newer-format` ([`CONVERT_NEWER_FORMAT`]): the input is stamped with a data format after v5;
|
|
1793
|
+
* * `migration-refused` ([`crate::MIGRATION_REFUSED`]): a `sheet-format.cells` the migration of
|
|
1794
|
+
* this engine does not convert;
|
|
1795
|
+
* * `invalid-document` ([`CONVERT_INVALID_DOCUMENT`]): bytes that are not a v1 update, an update
|
|
1796
|
+
* that is not a whole state, a document that holds no sheet and no cell, or a positional
|
|
1797
|
+
* entry outside the grid (row 0, or past row 1,048,576 or column 16,384);
|
|
1798
|
+
* * `convert-failed` ([`CONVERT_FAILED`]): the migration would leave a positional entry out of
|
|
1799
|
+
* the converted document (two entries for one cell, for one), or the engine failed.
|
|
1800
|
+
*
|
|
1801
|
+
* It runs the migration a load into the v5 store runs ([`YrsStore::migrate_to_v5`]) on a store
|
|
1802
|
+
* of its own, twice: once keeping the positional plane, to check that the v5 document holds
|
|
1803
|
+
* every positional entry, then once deleting what it read, for the result. No engine session,
|
|
1804
|
+
* no calc engine. An engine still never converts a document it is handed (`dual.rs`).
|
|
1805
|
+
* @param {Uint8Array} positional_state
|
|
1806
|
+
* @returns {Uint8Array}
|
|
1807
|
+
*/
|
|
1808
|
+
export function convertToStableIds(positional_state) {
|
|
1809
|
+
const ptr0 = passArray8ToWasm0(positional_state, wasm.__wbindgen_malloc);
|
|
1810
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1811
|
+
const ret = wasm.convertToStableIds(ptr0, len0);
|
|
1812
|
+
if (ret[3]) {
|
|
1813
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1814
|
+
}
|
|
1815
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1816
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1817
|
+
return v2;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1754
1820
|
/**
|
|
1755
1821
|
* Engine-less resolution of a `GridRange` on `sheet_id` through an op list in application order
|
|
1756
1822
|
* (`[{sheetId, index, delta, axis: "row" | "column"}]` — the shift-log wire shape; the Keryx
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rowsncolumns/rnc-yrs-store",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.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).",
|