@rowsncolumns/rnc-yrs-store 0.29.0 → 0.29.2

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.
@@ -554,31 +554,32 @@ export class YrsSheetDoc {
554
554
  * `positional_state` is the document's whole state as one v1 update (what `encodeStateAsUpdate`
555
555
  * gives). The result is the converted document's whole state as one v1 update. It loads in a
556
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.
557
+ * input read on the positional store. The result is a document of its own: read its content and
558
+ * copy it into a room, never merge its bytes into one. Two conversions of the same input read the
559
+ * same; their bytes are not the same.
560
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.
561
+ * Without `line_ids_json` (`undefined` or `null`) each line takes the client-0 id of its position,
562
+ * as a room's own conversion names them ([`convert_to_stable_ids`]). With it, each line takes the
563
+ * id the map gives its position and a fresh id `make_id(freshClient, n)` where it gives none
564
+ * ([`convert_to_stable_ids_with_line_ids`]): `{"freshClient": <1..=2^32-1>, "sheets":
565
+ * {"<sheetId>": {"rowIds": [<id> | null, …], "columnIds": [<id> | null, …]}}}`, an id as its
566
+ * decimal string (as `rowIds` / `columnIds` give them). A host restoring a version saved before its
567
+ * room was converted gives the room's ids to the lines the room still has, so a reference the room
568
+ * keeps on a line stays on that line, and fresh ids to the rest (a `freshClient` the room never
569
+ * used), so a reference never lands on another line.
564
570
  *
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`).
571
+ * Throws, with no result, a message that starts with:
572
+ * * `already-stable-ids`: the input is already v5;
573
+ * * `newer-format`: the input is stamped with a data format after v5;
574
+ * * `migration-refused`: a `sheet-format.cells` the migration of this engine does not convert;
575
+ * * `invalid-document`: bytes that are not a v1 update, an update that is not a whole state, a
576
+ * document that holds no sheet and no cell, or a positional entry outside the grid;
577
+ * * `convert-failed`: the migration would leave a positional entry out, or the engine failed;
578
+ * * `invalid-line-ids`: a map that is not the shape above, a fresh client of 0 or past 32 bits, an
579
+ * id that is no line id, an id of the fresh client, one id named twice on an axis, a sheet the
580
+ * document does not hold, or a sheet whose lines are already named.
580
581
  */
581
- export function convertToStableIds(positional_state: Uint8Array): Uint8Array;
582
+ export function convertToStableIds(positional_state: Uint8Array, line_ids_json?: string | null): Uint8Array;
582
583
 
583
584
  /**
584
585
  * Engine-less resolution of a `GridRange` on `sheet_id` through an op list in application order
@@ -688,14 +689,14 @@ export interface InitOutput {
688
689
  readonly yrssheetdoc_new: () => number;
689
690
  readonly yrssheetdoc_setCell: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
690
691
  readonly spreadsheetengine_stateAsUpdate: (a: number) => [number, number];
691
- readonly convertToStableIds: (a: number, b: number) => [number, number, number, number];
692
- readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
692
+ readonly convertToStableIds: (a: number, b: number, c: number, d: number) => [number, number, number, number];
693
693
  readonly spreadsheetengine_columnIds: (a: number, b: number) => [number, number];
694
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];
696
695
  readonly spreadsheetengine_rowIds: (a: number, b: number) => [number, number];
697
- readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
698
696
  readonly spreadsheetengine_stableCellKey: (a: number, b: number, c: number, d: number) => [number, number];
697
+ readonly spreadsheetengine_anchorRange: (a: number, b: number, c: number, d: number) => [number, number, number, number];
698
+ readonly spreadsheetengine_resolveAnchor: (a: number, b: number, c: number) => [number, number, number, number];
699
+ readonly spreadsheetengine_shiftLogFrontier: (a: number) => [number, number];
699
700
  readonly spreadsheetengine_transformRange: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
700
701
  readonly transformRangeThroughOps: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
701
702
  readonly __wbindgen_malloc: (a: number, b: number) => number;
@@ -1779,42 +1779,46 @@ if (Symbol.dispose) YrsSheetDoc.prototype[Symbol.dispose] = YrsSheetDoc.prototyp
1779
1779
  * `positional_state` is the document's whole state as one v1 update (what `encodeStateAsUpdate`
1780
1780
  * gives). The result is the converted document's whole state as one v1 update. It loads in a
1781
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.
1782
+ * input read on the positional store. The result is a document of its own: read its content and
1783
+ * copy it into a room, never merge its bytes into one. Two conversions of the same input read the
1784
+ * same; their bytes are not the same.
1785
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.
1786
+ * Without `line_ids_json` (`undefined` or `null`) each line takes the client-0 id of its position,
1787
+ * as a room's own conversion names them ([`convert_to_stable_ids`]). With it, each line takes the
1788
+ * id the map gives its position and a fresh id `make_id(freshClient, n)` where it gives none
1789
+ * ([`convert_to_stable_ids_with_line_ids`]): `{"freshClient": <1..=2^32-1>, "sheets":
1790
+ * {"<sheetId>": {"rowIds": [<id> | null, …], "columnIds": [<id> | null, …]}}}`, an id as its
1791
+ * decimal string (as `rowIds` / `columnIds` give them). A host restoring a version saved before its
1792
+ * room was converted gives the room's ids to the lines the room still has, so a reference the room
1793
+ * keeps on a line stays on that line, and fresh ids to the rest (a `freshClient` the room never
1794
+ * used), so a reference never lands on another line.
1789
1795
  *
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`).
1796
+ * Throws, with no result, a message that starts with:
1797
+ * * `already-stable-ids`: the input is already v5;
1798
+ * * `newer-format`: the input is stamped with a data format after v5;
1799
+ * * `migration-refused`: a `sheet-format.cells` the migration of this engine does not convert;
1800
+ * * `invalid-document`: bytes that are not a v1 update, an update that is not a whole state, a
1801
+ * document that holds no sheet and no cell, or a positional entry outside the grid;
1802
+ * * `convert-failed`: the migration would leave a positional entry out, or the engine failed;
1803
+ * * `invalid-line-ids`: a map that is not the shape above, a fresh client of 0 or past 32 bits, an
1804
+ * id that is no line id, an id of the fresh client, one id named twice on an axis, a sheet the
1805
+ * document does not hold, or a sheet whose lines are already named.
1805
1806
  * @param {Uint8Array} positional_state
1807
+ * @param {string | null} [line_ids_json]
1806
1808
  * @returns {Uint8Array}
1807
1809
  */
1808
- export function convertToStableIds(positional_state) {
1810
+ export function convertToStableIds(positional_state, line_ids_json) {
1809
1811
  const ptr0 = passArray8ToWasm0(positional_state, wasm.__wbindgen_malloc);
1810
1812
  const len0 = WASM_VECTOR_LEN;
1811
- const ret = wasm.convertToStableIds(ptr0, len0);
1813
+ var ptr1 = isLikeNone(line_ids_json) ? 0 : passStringToWasm0(line_ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1814
+ var len1 = WASM_VECTOR_LEN;
1815
+ const ret = wasm.convertToStableIds(ptr0, len0, ptr1, len1);
1812
1816
  if (ret[3]) {
1813
1817
  throw takeFromExternrefTable0(ret[2]);
1814
1818
  }
1815
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1819
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1816
1820
  wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1817
- return v2;
1821
+ return v3;
1818
1822
  }
1819
1823
 
1820
1824
  /**
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rowsncolumns/rnc-yrs-store",
3
- "version": "0.29.0",
3
+ "version": "0.29.2",
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).",