@loradb/lora-wasm 0.5.5 → 0.6.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.
Files changed (41) hide show
  1. package/README.md +17 -16
  2. package/dist/index.d.ts +21 -31
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +27 -35
  5. package/dist/index.js.map +1 -1
  6. package/dist/loader-node.d.ts +1 -1
  7. package/dist/snapshot.d.ts +49 -16
  8. package/dist/snapshot.d.ts.map +1 -1
  9. package/dist/snapshot.js +35 -53
  10. package/dist/snapshot.js.map +1 -1
  11. package/dist/types.d.ts +13 -2
  12. package/dist/types.d.ts.map +1 -1
  13. package/dist/types.js +8 -0
  14. package/dist/types.js.map +1 -1
  15. package/dist/worker-client.d.ts +20 -20
  16. package/dist/worker-client.d.ts.map +1 -1
  17. package/dist/worker-client.js +21 -21
  18. package/dist/worker-client.js.map +1 -1
  19. package/dist/worker-protocol.d.ts +5 -2
  20. package/dist/worker-protocol.d.ts.map +1 -1
  21. package/dist/worker.js +7 -4
  22. package/dist/worker.js.map +1 -1
  23. package/package.json +1 -1
  24. package/pkg-bundler/README.md +17 -16
  25. package/pkg-bundler/lora_wasm.d.ts +13 -11
  26. package/pkg-bundler/lora_wasm_bg.js +116 -29
  27. package/pkg-bundler/lora_wasm_bg.wasm +0 -0
  28. package/pkg-bundler/lora_wasm_bg.wasm.d.ts +2 -2
  29. package/pkg-bundler/package.json +1 -1
  30. package/pkg-node/README.md +17 -16
  31. package/pkg-node/lora_wasm.d.ts +13 -11
  32. package/pkg-node/lora_wasm.js +116 -29
  33. package/pkg-node/lora_wasm_bg.wasm +0 -0
  34. package/pkg-node/lora_wasm_bg.wasm.d.ts +2 -2
  35. package/pkg-node/package.json +1 -1
  36. package/pkg-web/README.md +17 -16
  37. package/pkg-web/lora_wasm.d.ts +15 -13
  38. package/pkg-web/lora_wasm.js +99 -29
  39. package/pkg-web/lora_wasm_bg.wasm +0 -0
  40. package/pkg-web/lora_wasm_bg.wasm.d.ts +2 -2
  41. package/pkg-web/package.json +1 -1
@@ -5,7 +5,7 @@
5
5
  "LoraDB, Inc."
6
6
  ],
7
7
  "description": "WebAssembly bindings for the Lora in-memory graph database",
8
- "version": "0.5.5",
8
+ "version": "0.6.0",
9
9
  "license": "BUSL-1.1",
10
10
  "files": [
11
11
  "lora_wasm_bg.wasm",
@@ -116,14 +116,17 @@ useful for tests and for swapping execution backends behind the same API.
116
116
 
117
117
  ## Snapshots
118
118
 
119
- WASM has no filesystem access, so `saveSnapshot()` defaults to a `Uint8Array`.
120
- It also accepts typed formats: `"base64"` returns base64 text, `"blob"` returns
121
- a `Blob`, and `"download"` triggers a browser download from the main thread.
122
-
123
- `loadSnapshot` accepts a `WasmSnapshotSource`: `Uint8Array`, `ArrayBuffer`,
124
- `Blob`/`File`, `Response`, web `ReadableStream`, string URL, or `URL`. It does
125
- not include Node `Buffer`; use `Uint8Array` bytes when running the WASM package
126
- from Node.
119
+ WASM has no filesystem access, so snapshots never accept string paths.
120
+ `saveSnapshot()` defaults to `Uint8Array`, and can also return `ArrayBuffer`,
121
+ `Blob`, `Response`, `ReadableStream`, or an object `URL`. `loadSnapshot`
122
+ accepts `URL`, `Uint8Array`, `ArrayBuffer`, `Blob`, `Response`, and web
123
+ `ReadableStream<Uint8Array | ArrayBuffer>`. The bytes use the database
124
+ snapshot codec (`LORACOL1`) and can be loaded by native LoraDB. Older store
125
+ snapshots (`LORASNAP`) are still accepted by `loadSnapshot` for compatibility.
126
+ Snapshot bytes are uncompressed by default; pass `{ compression: "gzip" }` or
127
+ `{ compression: { format: "gzip", level: 1 } }` to save smaller
128
+ WASM-portable snapshots. Gzip levels `0..9` are supported; level `1` is the
129
+ fast default.
127
130
 
128
131
  ```ts
129
132
  import { createDatabase } from "lora-wasm";
@@ -131,20 +134,18 @@ import { createDatabase } from "lora-wasm";
131
134
  const db = await createDatabase();
132
135
  await db.execute("CREATE (:Person {name: 'Alice'})");
133
136
 
134
- const bytes = await db.saveSnapshotToBytes();
135
- const sameBytes = await db.saveSnapshot("binary");
136
- const blob = await db.saveSnapshot({ format: "blob" });
137
- await db.saveSnapshot({ format: "download", filename: "graph.lorasnap" });
137
+ const bytes = await db.saveSnapshot();
138
+ const compressed = await db.saveSnapshot({ compression: "gzip" });
139
+ const blob = await db.saveSnapshot({ format: "blob", compression: "gzip" });
140
+ const response = await db.saveSnapshot({ format: "response" });
138
141
 
139
142
  await db.loadSnapshot(bytes);
143
+ await db.loadSnapshot(compressed);
140
144
  await db.loadSnapshot(blob);
141
- await db.loadSnapshot(new Response(bytes).body!);
145
+ await db.loadSnapshot(response);
142
146
  await db.loadSnapshot(new URL("/graph.lorasnap", location.href));
143
147
  ```
144
148
 
145
- `loadSnapshotFromBytes(bytes)` remains available for the narrow
146
- `Uint8Array`-only path.
147
-
148
149
  ## Typed value model
149
150
 
150
151
  | TS type | Runtime shape |
@@ -21,23 +21,25 @@ export class WasmDatabase {
21
21
  * transaction. Returns an array of query results in statement order.
22
22
  */
23
23
  transaction(statements: any, mode?: string | null): any;
24
- relationshipCount(): number;
25
24
  /**
26
- * Serialize the graph into a byte buffer. The caller is responsible for
27
- * writing it to disk, IndexedDB, localStorage, or wherever — WASM does
28
- * not have direct filesystem access. The returned bytes can later be
29
- * passed to `loadSnapshotFromBytes` on any `WasmDatabase` instance.
25
+ * Replace the graph state with a database snapshot decoded from `bytes`.
26
+ * Legacy store snapshot bytes are accepted for compatibility.
30
27
  *
31
- * Returns the serialized bytes as a `Uint8Array`.
28
+ * Returns a plain object matching the shape of `SnapshotMeta`:
29
+ * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
32
30
  */
33
- saveSnapshotToBytes(): Uint8Array;
31
+ loadSnapshot(bytes: Uint8Array, options: any): any;
34
32
  /**
35
- * Replace the graph state with a snapshot decoded from `bytes`.
33
+ * Serialize the graph into database snapshot bytes. The caller is
34
+ * responsible for writing them to IndexedDB, localStorage, a server, or
35
+ * another host-provided store — WASM has no direct filesystem access.
36
+ * The returned bytes can later be passed to `loadSnapshot` on any
37
+ * `WasmDatabase` instance.
36
38
  *
37
- * Returns a plain object matching the shape of `SnapshotMeta`:
38
- * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
39
+ * Returns the serialized bytes as a `Uint8Array`.
39
40
  */
40
- loadSnapshotFromBytes(bytes: Uint8Array): any;
41
+ saveSnapshot(options: any): Uint8Array;
42
+ relationshipCount(): number;
41
43
  constructor();
42
44
  clear(): void;
43
45
  /**
@@ -177,17 +177,17 @@ function takeFromExternrefTable0(idx) {
177
177
  return value;
178
178
  }
179
179
 
180
- function getArrayU8FromWasm0(ptr, len) {
181
- ptr = ptr >>> 0;
182
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
183
- }
184
-
185
180
  function passArray8ToWasm0(arg, malloc) {
186
181
  const ptr = malloc(arg.length * 1, 1) >>> 0;
187
182
  getUint8ArrayMemory0().set(arg, ptr / 1);
188
183
  WASM_VECTOR_LEN = arg.length;
189
184
  return ptr;
190
185
  }
186
+
187
+ function getArrayU8FromWasm0(ptr, len) {
188
+ ptr = ptr >>> 0;
189
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
190
+ }
191
191
  /**
192
192
  * Call once at module start to install a panic hook that routes Rust
193
193
  * panics to `console.error`. No-op if compiled without the default feature.
@@ -255,23 +255,37 @@ class WasmDatabase {
255
255
  return takeFromExternrefTable0(ret[0]);
256
256
  }
257
257
  /**
258
- * @returns {number}
258
+ * Replace the graph state with a database snapshot decoded from `bytes`.
259
+ * Legacy store snapshot bytes are accepted for compatibility.
260
+ *
261
+ * Returns a plain object matching the shape of `SnapshotMeta`:
262
+ * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
263
+ * @param {Uint8Array} bytes
264
+ * @param {any} options
265
+ * @returns {any}
259
266
  */
260
- relationshipCount() {
261
- const ret = wasm.wasmdatabase_relationshipCount(this.__wbg_ptr);
262
- return ret >>> 0;
267
+ loadSnapshot(bytes, options) {
268
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ret = wasm.wasmdatabase_loadSnapshot(this.__wbg_ptr, ptr0, len0, options);
271
+ if (ret[2]) {
272
+ throw takeFromExternrefTable0(ret[1]);
273
+ }
274
+ return takeFromExternrefTable0(ret[0]);
263
275
  }
264
276
  /**
265
- * Serialize the graph into a byte buffer. The caller is responsible for
266
- * writing it to disk, IndexedDB, localStorage, or wherever — WASM does
267
- * not have direct filesystem access. The returned bytes can later be
268
- * passed to `loadSnapshotFromBytes` on any `WasmDatabase` instance.
277
+ * Serialize the graph into database snapshot bytes. The caller is
278
+ * responsible for writing them to IndexedDB, localStorage, a server, or
279
+ * another host-provided store — WASM has no direct filesystem access.
280
+ * The returned bytes can later be passed to `loadSnapshot` on any
281
+ * `WasmDatabase` instance.
269
282
  *
270
283
  * Returns the serialized bytes as a `Uint8Array`.
284
+ * @param {any} options
271
285
  * @returns {Uint8Array}
272
286
  */
273
- saveSnapshotToBytes() {
274
- const ret = wasm.wasmdatabase_saveSnapshotToBytes(this.__wbg_ptr);
287
+ saveSnapshot(options) {
288
+ const ret = wasm.wasmdatabase_saveSnapshot(this.__wbg_ptr, options);
275
289
  if (ret[3]) {
276
290
  throw takeFromExternrefTable0(ret[2]);
277
291
  }
@@ -280,21 +294,11 @@ class WasmDatabase {
280
294
  return v1;
281
295
  }
282
296
  /**
283
- * Replace the graph state with a snapshot decoded from `bytes`.
284
- *
285
- * Returns a plain object matching the shape of `SnapshotMeta`:
286
- * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
287
- * @param {Uint8Array} bytes
288
- * @returns {any}
297
+ * @returns {number}
289
298
  */
290
- loadSnapshotFromBytes(bytes) {
291
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
292
- const len0 = WASM_VECTOR_LEN;
293
- const ret = wasm.wasmdatabase_loadSnapshotFromBytes(this.__wbg_ptr, ptr0, len0);
294
- if (ret[2]) {
295
- throw takeFromExternrefTable0(ret[1]);
296
- }
297
- return takeFromExternrefTable0(ret[0]);
299
+ relationshipCount() {
300
+ const ret = wasm.wasmdatabase_relationshipCount(this.__wbg_ptr);
301
+ return ret >>> 0;
298
302
  }
299
303
  constructor() {
300
304
  const ret = wasm.wasmdatabase_new();
@@ -396,6 +400,16 @@ module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(fun
396
400
  return ret;
397
401
  }, arguments) };
398
402
 
403
+ module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
404
+ const ret = arg0.call(arg1, arg2);
405
+ return ret;
406
+ }, arguments) };
407
+
408
+ module.exports.__wbg_crypto_86f2631e91b51511 = function(arg0) {
409
+ const ret = arg0.crypto;
410
+ return ret;
411
+ };
412
+
399
413
  module.exports.__wbg_done_769e5ede4b31c67b = function(arg0) {
400
414
  const ret = arg0.done;
401
415
  return ret;
@@ -418,6 +432,10 @@ module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
418
432
  }
419
433
  };
420
434
 
435
+ module.exports.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() { return handleError(function (arg0, arg1) {
436
+ arg0.getRandomValues(arg1);
437
+ }, arguments) };
438
+
421
439
  module.exports.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
422
440
  const ret = Reflect.get(arg0, arg1);
423
441
  return ret;
@@ -486,6 +504,11 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
486
504
  return ret;
487
505
  };
488
506
 
507
+ module.exports.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) {
508
+ const ret = arg0.msCrypto;
509
+ return ret;
510
+ };
511
+
489
512
  module.exports.__wbg_new_405e22f390576ce2 = function() {
490
513
  const ret = new Object();
491
514
  return ret;
@@ -511,6 +534,21 @@ module.exports.__wbg_new_a12002a7f91c75be = function(arg0) {
511
534
  return ret;
512
535
  };
513
536
 
537
+ module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
538
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
539
+ return ret;
540
+ };
541
+
542
+ module.exports.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
543
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
544
+ return ret;
545
+ };
546
+
547
+ module.exports.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
548
+ const ret = new Uint8Array(arg0 >>> 0);
549
+ return ret;
550
+ };
551
+
514
552
  module.exports.__wbg_next_25feadfc0913fea9 = function(arg0) {
515
553
  const ret = arg0.next;
516
554
  return ret;
@@ -521,11 +559,30 @@ module.exports.__wbg_next_6574e1a8a62d1055 = function() { return handleError(fun
521
559
  return ret;
522
560
  }, arguments) };
523
561
 
562
+ module.exports.__wbg_node_e1f24f89a7336c2e = function(arg0) {
563
+ const ret = arg0.node;
564
+ return ret;
565
+ };
566
+
524
567
  module.exports.__wbg_now_807e54c39636c349 = function() {
525
568
  const ret = Date.now();
526
569
  return ret;
527
570
  };
528
571
 
572
+ module.exports.__wbg_process_3975fd6c72f520aa = function(arg0) {
573
+ const ret = arg0.process;
574
+ return ret;
575
+ };
576
+
577
+ module.exports.__wbg_randomFillSync_f8c153b79f285817 = function() { return handleError(function (arg0, arg1) {
578
+ arg0.randomFillSync(arg1);
579
+ }, arguments) };
580
+
581
+ module.exports.__wbg_require_b74f47fc2d022fd6 = function() { return handleError(function () {
582
+ const ret = module.require;
583
+ return ret;
584
+ }, arguments) };
585
+
529
586
  module.exports.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
530
587
  arg0[arg1 >>> 0] = arg2;
531
588
  };
@@ -551,11 +608,41 @@ module.exports.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
551
608
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
552
609
  };
553
610
 
611
+ module.exports.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
612
+ const ret = typeof global === 'undefined' ? null : global;
613
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
614
+ };
615
+
616
+ module.exports.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
617
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
618
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
619
+ };
620
+
621
+ module.exports.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
622
+ const ret = typeof self === 'undefined' ? null : self;
623
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
624
+ };
625
+
626
+ module.exports.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
627
+ const ret = typeof window === 'undefined' ? null : window;
628
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
629
+ };
630
+
631
+ module.exports.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
632
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
633
+ return ret;
634
+ };
635
+
554
636
  module.exports.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
555
637
  const ret = arg0.value;
556
638
  return ret;
557
639
  };
558
640
 
641
+ module.exports.__wbg_versions_4e31226f5e8dc909 = function(arg0) {
642
+ const ret = arg0.versions;
643
+ return ret;
644
+ };
645
+
559
646
  module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
560
647
  const ret = arg0;
561
648
  return ret;
Binary file
@@ -5,12 +5,12 @@ export const __wbg_wasmdatabase_free: (a: number, b: number) => void;
5
5
  export const __wbg_wasmquerystream_free: (a: number, b: number) => void;
6
6
  export const wasmdatabase_clear: (a: number) => void;
7
7
  export const wasmdatabase_execute: (a: number, b: number, c: number, d: any) => [number, number, number];
8
- export const wasmdatabase_loadSnapshotFromBytes: (a: number, b: number, c: number) => [number, number, number];
8
+ export const wasmdatabase_loadSnapshot: (a: number, b: number, c: number, d: any) => [number, number, number];
9
9
  export const wasmdatabase_new: () => number;
10
10
  export const wasmdatabase_nodeCount: (a: number) => number;
11
11
  export const wasmdatabase_openStream: (a: number, b: number, c: number, d: any) => [number, number, number];
12
12
  export const wasmdatabase_relationshipCount: (a: number) => number;
13
- export const wasmdatabase_saveSnapshotToBytes: (a: number) => [number, number, number, number];
13
+ export const wasmdatabase_saveSnapshot: (a: number, b: any) => [number, number, number, number];
14
14
  export const wasmdatabase_transaction: (a: number, b: any, c: number, d: number) => [number, number, number];
15
15
  export const wasmquerystream_close: (a: number) => void;
16
16
  export const wasmquerystream_columns: (a: number) => [number, number, number];
@@ -4,7 +4,7 @@
4
4
  "LoraDB, Inc."
5
5
  ],
6
6
  "description": "WebAssembly bindings for the Lora in-memory graph database",
7
- "version": "0.5.5",
7
+ "version": "0.6.0",
8
8
  "license": "BUSL-1.1",
9
9
  "files": [
10
10
  "lora_wasm_bg.wasm",
package/pkg-web/README.md CHANGED
@@ -116,14 +116,17 @@ useful for tests and for swapping execution backends behind the same API.
116
116
 
117
117
  ## Snapshots
118
118
 
119
- WASM has no filesystem access, so `saveSnapshot()` defaults to a `Uint8Array`.
120
- It also accepts typed formats: `"base64"` returns base64 text, `"blob"` returns
121
- a `Blob`, and `"download"` triggers a browser download from the main thread.
122
-
123
- `loadSnapshot` accepts a `WasmSnapshotSource`: `Uint8Array`, `ArrayBuffer`,
124
- `Blob`/`File`, `Response`, web `ReadableStream`, string URL, or `URL`. It does
125
- not include Node `Buffer`; use `Uint8Array` bytes when running the WASM package
126
- from Node.
119
+ WASM has no filesystem access, so snapshots never accept string paths.
120
+ `saveSnapshot()` defaults to `Uint8Array`, and can also return `ArrayBuffer`,
121
+ `Blob`, `Response`, `ReadableStream`, or an object `URL`. `loadSnapshot`
122
+ accepts `URL`, `Uint8Array`, `ArrayBuffer`, `Blob`, `Response`, and web
123
+ `ReadableStream<Uint8Array | ArrayBuffer>`. The bytes use the database
124
+ snapshot codec (`LORACOL1`) and can be loaded by native LoraDB. Older store
125
+ snapshots (`LORASNAP`) are still accepted by `loadSnapshot` for compatibility.
126
+ Snapshot bytes are uncompressed by default; pass `{ compression: "gzip" }` or
127
+ `{ compression: { format: "gzip", level: 1 } }` to save smaller
128
+ WASM-portable snapshots. Gzip levels `0..9` are supported; level `1` is the
129
+ fast default.
127
130
 
128
131
  ```ts
129
132
  import { createDatabase } from "lora-wasm";
@@ -131,20 +134,18 @@ import { createDatabase } from "lora-wasm";
131
134
  const db = await createDatabase();
132
135
  await db.execute("CREATE (:Person {name: 'Alice'})");
133
136
 
134
- const bytes = await db.saveSnapshotToBytes();
135
- const sameBytes = await db.saveSnapshot("binary");
136
- const blob = await db.saveSnapshot({ format: "blob" });
137
- await db.saveSnapshot({ format: "download", filename: "graph.lorasnap" });
137
+ const bytes = await db.saveSnapshot();
138
+ const compressed = await db.saveSnapshot({ compression: "gzip" });
139
+ const blob = await db.saveSnapshot({ format: "blob", compression: "gzip" });
140
+ const response = await db.saveSnapshot({ format: "response" });
138
141
 
139
142
  await db.loadSnapshot(bytes);
143
+ await db.loadSnapshot(compressed);
140
144
  await db.loadSnapshot(blob);
141
- await db.loadSnapshot(new Response(bytes).body!);
145
+ await db.loadSnapshot(response);
142
146
  await db.loadSnapshot(new URL("/graph.lorasnap", location.href));
143
147
  ```
144
148
 
145
- `loadSnapshotFromBytes(bytes)` remains available for the narrow
146
- `Uint8Array`-only path.
147
-
148
149
  ## Typed value model
149
150
 
150
151
  | TS type | Runtime shape |
@@ -21,23 +21,25 @@ export class WasmDatabase {
21
21
  * transaction. Returns an array of query results in statement order.
22
22
  */
23
23
  transaction(statements: any, mode?: string | null): any;
24
- relationshipCount(): number;
25
24
  /**
26
- * Serialize the graph into a byte buffer. The caller is responsible for
27
- * writing it to disk, IndexedDB, localStorage, or wherever — WASM does
28
- * not have direct filesystem access. The returned bytes can later be
29
- * passed to `loadSnapshotFromBytes` on any `WasmDatabase` instance.
25
+ * Replace the graph state with a database snapshot decoded from `bytes`.
26
+ * Legacy store snapshot bytes are accepted for compatibility.
30
27
  *
31
- * Returns the serialized bytes as a `Uint8Array`.
28
+ * Returns a plain object matching the shape of `SnapshotMeta`:
29
+ * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
32
30
  */
33
- saveSnapshotToBytes(): Uint8Array;
31
+ loadSnapshot(bytes: Uint8Array, options: any): any;
34
32
  /**
35
- * Replace the graph state with a snapshot decoded from `bytes`.
33
+ * Serialize the graph into database snapshot bytes. The caller is
34
+ * responsible for writing them to IndexedDB, localStorage, a server, or
35
+ * another host-provided store — WASM has no direct filesystem access.
36
+ * The returned bytes can later be passed to `loadSnapshot` on any
37
+ * `WasmDatabase` instance.
36
38
  *
37
- * Returns a plain object matching the shape of `SnapshotMeta`:
38
- * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
39
+ * Returns the serialized bytes as a `Uint8Array`.
39
40
  */
40
- loadSnapshotFromBytes(bytes: Uint8Array): any;
41
+ saveSnapshot(options: any): Uint8Array;
42
+ relationshipCount(): number;
41
43
  constructor();
42
44
  clear(): void;
43
45
  /**
@@ -65,12 +67,12 @@ export interface InitOutput {
65
67
  readonly __wbg_wasmquerystream_free: (a: number, b: number) => void;
66
68
  readonly wasmdatabase_clear: (a: number) => void;
67
69
  readonly wasmdatabase_execute: (a: number, b: number, c: number, d: any) => [number, number, number];
68
- readonly wasmdatabase_loadSnapshotFromBytes: (a: number, b: number, c: number) => [number, number, number];
70
+ readonly wasmdatabase_loadSnapshot: (a: number, b: number, c: number, d: any) => [number, number, number];
69
71
  readonly wasmdatabase_new: () => number;
70
72
  readonly wasmdatabase_nodeCount: (a: number) => number;
71
73
  readonly wasmdatabase_openStream: (a: number, b: number, c: number, d: any) => [number, number, number];
72
74
  readonly wasmdatabase_relationshipCount: (a: number) => number;
73
- readonly wasmdatabase_saveSnapshotToBytes: (a: number) => [number, number, number, number];
75
+ readonly wasmdatabase_saveSnapshot: (a: number, b: any) => [number, number, number, number];
74
76
  readonly wasmdatabase_transaction: (a: number, b: any, c: number, d: number) => [number, number, number];
75
77
  readonly wasmquerystream_close: (a: number) => void;
76
78
  readonly wasmquerystream_columns: (a: number) => [number, number, number];