@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.
- package/README.md +17 -16
- package/dist/index.d.ts +21 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -35
- package/dist/index.js.map +1 -1
- package/dist/loader-node.d.ts +1 -1
- package/dist/snapshot.d.ts +49 -16
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +35 -53
- package/dist/snapshot.js.map +1 -1
- package/dist/types.d.ts +13 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -1
- package/dist/worker-client.d.ts +20 -20
- package/dist/worker-client.d.ts.map +1 -1
- package/dist/worker-client.js +21 -21
- package/dist/worker-client.js.map +1 -1
- package/dist/worker-protocol.d.ts +5 -2
- package/dist/worker-protocol.d.ts.map +1 -1
- package/dist/worker.js +7 -4
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/pkg-bundler/README.md +17 -16
- package/pkg-bundler/lora_wasm.d.ts +13 -11
- package/pkg-bundler/lora_wasm_bg.js +116 -29
- package/pkg-bundler/lora_wasm_bg.wasm +0 -0
- package/pkg-bundler/lora_wasm_bg.wasm.d.ts +2 -2
- package/pkg-bundler/package.json +1 -1
- package/pkg-node/README.md +17 -16
- package/pkg-node/lora_wasm.d.ts +13 -11
- package/pkg-node/lora_wasm.js +116 -29
- package/pkg-node/lora_wasm_bg.wasm +0 -0
- package/pkg-node/lora_wasm_bg.wasm.d.ts +2 -2
- package/pkg-node/package.json +1 -1
- package/pkg-web/README.md +17 -16
- package/pkg-web/lora_wasm.d.ts +15 -13
- package/pkg-web/lora_wasm.js +99 -29
- package/pkg-web/lora_wasm_bg.wasm +0 -0
- package/pkg-web/lora_wasm_bg.wasm.d.ts +2 -2
- package/pkg-web/package.json +1 -1
package/pkg-web/lora_wasm.js
CHANGED
|
@@ -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
|
-
*
|
|
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
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
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
|
|
262
|
-
* writing
|
|
263
|
-
*
|
|
264
|
-
* passed to `
|
|
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
|
-
|
|
270
|
-
const ret = wasm.
|
|
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
|
-
*
|
|
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
|
-
|
|
287
|
-
const
|
|
288
|
-
|
|
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
|
|
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
|
|
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];
|