@loradb/lora-wasm 0.5.6 → 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
@@ -173,17 +173,17 @@ function takeFromExternrefTable0(idx) {
173
173
  return value;
174
174
  }
175
175
 
176
- function getArrayU8FromWasm0(ptr, len) {
177
- ptr = ptr >>> 0;
178
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
179
- }
180
-
181
176
  function passArray8ToWasm0(arg, malloc) {
182
177
  const ptr = malloc(arg.length * 1, 1) >>> 0;
183
178
  getUint8ArrayMemory0().set(arg, ptr / 1);
184
179
  WASM_VECTOR_LEN = arg.length;
185
180
  return ptr;
186
181
  }
182
+
183
+ function getArrayU8FromWasm0(ptr, len) {
184
+ ptr = ptr >>> 0;
185
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
186
+ }
187
187
  /**
188
188
  * Call once at module start to install a panic hook that routes Rust
189
189
  * panics to `console.error`. No-op if compiled without the default feature.
@@ -251,23 +251,37 @@ export class WasmDatabase {
251
251
  return takeFromExternrefTable0(ret[0]);
252
252
  }
253
253
  /**
254
- * @returns {number}
254
+ * Replace the graph state with a database snapshot decoded from `bytes`.
255
+ * Legacy store snapshot bytes are accepted for compatibility.
256
+ *
257
+ * Returns a plain object matching the shape of `SnapshotMeta`:
258
+ * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
259
+ * @param {Uint8Array} bytes
260
+ * @param {any} options
261
+ * @returns {any}
255
262
  */
256
- relationshipCount() {
257
- const ret = wasm.wasmdatabase_relationshipCount(this.__wbg_ptr);
258
- return ret >>> 0;
263
+ loadSnapshot(bytes, options) {
264
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
265
+ const len0 = WASM_VECTOR_LEN;
266
+ const ret = wasm.wasmdatabase_loadSnapshot(this.__wbg_ptr, ptr0, len0, options);
267
+ if (ret[2]) {
268
+ throw takeFromExternrefTable0(ret[1]);
269
+ }
270
+ return takeFromExternrefTable0(ret[0]);
259
271
  }
260
272
  /**
261
- * Serialize the graph into a byte buffer. The caller is responsible for
262
- * writing it to disk, IndexedDB, localStorage, or wherever — WASM does
263
- * not have direct filesystem access. The returned bytes can later be
264
- * passed to `loadSnapshotFromBytes` on any `WasmDatabase` instance.
273
+ * Serialize the graph into database snapshot bytes. The caller is
274
+ * responsible for writing them to IndexedDB, localStorage, a server, or
275
+ * another host-provided store — WASM has no direct filesystem access.
276
+ * The returned bytes can later be passed to `loadSnapshot` on any
277
+ * `WasmDatabase` instance.
265
278
  *
266
279
  * Returns the serialized bytes as a `Uint8Array`.
280
+ * @param {any} options
267
281
  * @returns {Uint8Array}
268
282
  */
269
- saveSnapshotToBytes() {
270
- const ret = wasm.wasmdatabase_saveSnapshotToBytes(this.__wbg_ptr);
283
+ saveSnapshot(options) {
284
+ const ret = wasm.wasmdatabase_saveSnapshot(this.__wbg_ptr, options);
271
285
  if (ret[3]) {
272
286
  throw takeFromExternrefTable0(ret[2]);
273
287
  }
@@ -276,21 +290,11 @@ export class WasmDatabase {
276
290
  return v1;
277
291
  }
278
292
  /**
279
- * Replace the graph state with a snapshot decoded from `bytes`.
280
- *
281
- * Returns a plain object matching the shape of `SnapshotMeta`:
282
- * `{ formatVersion, nodeCount, relationshipCount, walLsn }`.
283
- * @param {Uint8Array} bytes
284
- * @returns {any}
293
+ * @returns {number}
285
294
  */
286
- loadSnapshotFromBytes(bytes) {
287
- const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
288
- const len0 = WASM_VECTOR_LEN;
289
- const ret = wasm.wasmdatabase_loadSnapshotFromBytes(this.__wbg_ptr, ptr0, len0);
290
- if (ret[2]) {
291
- throw takeFromExternrefTable0(ret[1]);
292
- }
293
- return takeFromExternrefTable0(ret[0]);
295
+ relationshipCount() {
296
+ const ret = wasm.wasmdatabase_relationshipCount(this.__wbg_ptr);
297
+ return ret >>> 0;
294
298
  }
295
299
  constructor() {
296
300
  const ret = wasm.wasmdatabase_new();
@@ -421,6 +425,14 @@ function __wbg_get_imports() {
421
425
  const ret = arg0.call(arg1);
422
426
  return ret;
423
427
  }, arguments) };
428
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
429
+ const ret = arg0.call(arg1, arg2);
430
+ return ret;
431
+ }, arguments) };
432
+ imports.wbg.__wbg_crypto_86f2631e91b51511 = function(arg0) {
433
+ const ret = arg0.crypto;
434
+ return ret;
435
+ };
424
436
  imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
425
437
  const ret = arg0.done;
426
438
  return ret;
@@ -440,6 +452,9 @@ function __wbg_get_imports() {
440
452
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
441
453
  }
442
454
  };
455
+ imports.wbg.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() { return handleError(function (arg0, arg1) {
456
+ arg0.getRandomValues(arg1);
457
+ }, arguments) };
443
458
  imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
444
459
  const ret = Reflect.get(arg0, arg1);
445
460
  return ret;
@@ -498,6 +513,10 @@ function __wbg_get_imports() {
498
513
  const ret = arg0.length;
499
514
  return ret;
500
515
  };
516
+ imports.wbg.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) {
517
+ const ret = arg0.msCrypto;
518
+ return ret;
519
+ };
501
520
  imports.wbg.__wbg_new_405e22f390576ce2 = function() {
502
521
  const ret = new Object();
503
522
  return ret;
@@ -518,6 +537,18 @@ function __wbg_get_imports() {
518
537
  const ret = new Uint8Array(arg0);
519
538
  return ret;
520
539
  };
540
+ imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
541
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
542
+ return ret;
543
+ };
544
+ imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) {
545
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
546
+ return ret;
547
+ };
548
+ imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) {
549
+ const ret = new Uint8Array(arg0 >>> 0);
550
+ return ret;
551
+ };
521
552
  imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
522
553
  const ret = arg0.next;
523
554
  return ret;
@@ -526,10 +557,25 @@ function __wbg_get_imports() {
526
557
  const ret = arg0.next();
527
558
  return ret;
528
559
  }, arguments) };
560
+ imports.wbg.__wbg_node_e1f24f89a7336c2e = function(arg0) {
561
+ const ret = arg0.node;
562
+ return ret;
563
+ };
529
564
  imports.wbg.__wbg_now_807e54c39636c349 = function() {
530
565
  const ret = Date.now();
531
566
  return ret;
532
567
  };
568
+ imports.wbg.__wbg_process_3975fd6c72f520aa = function(arg0) {
569
+ const ret = arg0.process;
570
+ return ret;
571
+ };
572
+ imports.wbg.__wbg_randomFillSync_f8c153b79f285817 = function() { return handleError(function (arg0, arg1) {
573
+ arg0.randomFillSync(arg1);
574
+ }, arguments) };
575
+ imports.wbg.__wbg_require_b74f47fc2d022fd6 = function() { return handleError(function () {
576
+ const ret = module.require;
577
+ return ret;
578
+ }, arguments) };
533
579
  imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
534
580
  arg0[arg1 >>> 0] = arg2;
535
581
  };
@@ -550,10 +596,34 @@ function __wbg_get_imports() {
550
596
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
551
597
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
552
598
  };
599
+ imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
600
+ const ret = typeof global === 'undefined' ? null : global;
601
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
602
+ };
603
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
604
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
605
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
606
+ };
607
+ imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
608
+ const ret = typeof self === 'undefined' ? null : self;
609
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
610
+ };
611
+ imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
612
+ const ret = typeof window === 'undefined' ? null : window;
613
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
614
+ };
615
+ imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) {
616
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
617
+ return ret;
618
+ };
553
619
  imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
554
620
  const ret = arg0.value;
555
621
  return ret;
556
622
  };
623
+ imports.wbg.__wbg_versions_4e31226f5e8dc909 = function(arg0) {
624
+ const ret = arg0.versions;
625
+ return ret;
626
+ };
557
627
  imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
558
628
  const ret = arg0;
559
629
  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];
@@ -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.6",
8
+ "version": "0.6.0",
9
9
  "license": "BUSL-1.1",
10
10
  "files": [
11
11
  "lora_wasm_bg.wasm",