@surrealdb/wasm-native 3.3.0-beta.1 → 3.3.0-beta.3
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 +29 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +33 -33
- package/dist/index_bg.wasm +0 -0
- package/dist/index_bg.wasm.d.ts +5 -5
- package/package.json +1 -1
- /package/dist/snippets/{surrealdb-kvs-indxdb-504dbe645a68d418 → surrealdb-kvs-indxdb-4dc16250e3190622}/src/js/db.js +0 -0
package/README.md
CHANGED
|
@@ -63,10 +63,39 @@ engine.free();
|
|
|
63
63
|
| `init` | Instantiates the module; must resolve before anything else is called |
|
|
64
64
|
| `SurrealWasmEngine` | One embedded instance: `connect`, `execute`, `notifications`, `export`, `import`, `version`, `free` |
|
|
65
65
|
| `ConnectionOptions` | Capabilities, timeouts, and the namespace/database created on new storage |
|
|
66
|
+
| `./module` | The `.wasm` file itself, for a caller that resolves the module source itself |
|
|
66
67
|
|
|
67
68
|
Storage backends are selected by the endpoint: `mem://` and `indxdb://name`, the latter backed by
|
|
68
69
|
the browser's IndexedDB.
|
|
69
70
|
|
|
71
|
+
### Where `init` reads the module from
|
|
72
|
+
|
|
73
|
+
`init()` with no argument resolves `index_bg.wasm` against the loader's own URL, which is right
|
|
74
|
+
only while the loader and the module sit beside each other. A bundler that copies the loader
|
|
75
|
+
elsewhere — Vite's dependency pre-bundling moves it into `node_modules/.vite/deps/` — leaves the
|
|
76
|
+
fetch pointing at a path the dev server answers with its HTML fallback, and instantiation fails on
|
|
77
|
+
the bytes not being a module (`expected magic word 00 61 73 6d, found 3c 21 64 6f`, which is
|
|
78
|
+
`<!do`).
|
|
79
|
+
|
|
80
|
+
`init` therefore accepts an explicit module source, and this package exports the `.wasm` under
|
|
81
|
+
`./module` so a caller can own the resolution rather than inherit the loader's location:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import init from "@surrealdb/wasm-native";
|
|
85
|
+
import wasmUrl from "@surrealdb/wasm-native/module?url";
|
|
86
|
+
|
|
87
|
+
await init({ module_or_path: wasmUrl });
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Both are part of this package's surface and will keep working: the argument form is wasm-bindgen's
|
|
91
|
+
own `--target web` entry point, and `./module` is a subpath export declared here. Leaving the loader
|
|
92
|
+
where it was put works too, with Vite:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// vite.config.ts
|
|
96
|
+
optimizeDeps: { exclude: ["@surrealdb/wasm", "@surrealdb/wasm-native"] }
|
|
97
|
+
```
|
|
98
|
+
|
|
70
99
|
A reply is the method's value; only a failure is wrapped, in an `{ error }` envelope.
|
|
71
100
|
`notifications()` returns a `ReadableStream` of encoded live-query notifications, which ends when
|
|
72
101
|
the engine is freed. Every instance must be released with `free()`.
|
package/dist/index.d.ts
CHANGED
|
@@ -141,11 +141,11 @@ export interface InitOutput {
|
|
|
141
141
|
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
142
142
|
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
143
143
|
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
144
|
-
readonly
|
|
145
|
-
readonly
|
|
146
|
-
readonly
|
|
147
|
-
readonly
|
|
148
|
-
readonly
|
|
144
|
+
readonly __wasm_bindgen_func_elem_27670: (a: number, b: number, c: number, d: number) => void;
|
|
145
|
+
readonly __wasm_bindgen_func_elem_4272: (a: number, b: number, c: number, d: number) => void;
|
|
146
|
+
readonly __wasm_bindgen_func_elem_27668: (a: number, b: number, c: number, d: number) => void;
|
|
147
|
+
readonly __wasm_bindgen_func_elem_4345: (a: number, b: number, c: number, d: number) => void;
|
|
148
|
+
readonly __wasm_bindgen_func_elem_7494: (a: number, b: number) => void;
|
|
149
149
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
150
150
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
151
151
|
readonly __wbindgen_export3: (a: number) => void;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @ts-self-types="./index.d.ts" */
|
|
2
|
-
import { open, to_string } from './snippets/surrealdb-kvs-indxdb-
|
|
2
|
+
import { open, to_string } from './snippets/surrealdb-kvs-indxdb-4dc16250e3190622/src/js/db.js';
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
export class IntoUnderlyingByteSource {
|
|
@@ -360,7 +360,7 @@ function __wbg_get_imports() {
|
|
|
360
360
|
const ret = getObject(arg0).arrayBuffer();
|
|
361
361
|
return addHeapObject(ret);
|
|
362
362
|
}, arguments); },
|
|
363
|
-
|
|
363
|
+
__wbg_begin_e3594ac63cd2b2e5: function() { return handleError(function (arg0) {
|
|
364
364
|
const ret = getObject(arg0).begin();
|
|
365
365
|
return addHeapObject(ret);
|
|
366
366
|
}, arguments); },
|
|
@@ -398,10 +398,10 @@ function __wbg_get_imports() {
|
|
|
398
398
|
__wbg_close_72d318d9c16e83ef: function() { return handleError(function (arg0) {
|
|
399
399
|
getObject(arg0).close();
|
|
400
400
|
}, arguments); },
|
|
401
|
-
|
|
401
|
+
__wbg_close_e431942a95b59335: function() { return handleError(function (arg0) {
|
|
402
402
|
getObject(arg0).close();
|
|
403
403
|
}, arguments); },
|
|
404
|
-
|
|
404
|
+
__wbg_commit_c79b56849637d2ca: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) {
|
|
405
405
|
const ret = getObject(arg0).commit(getArrayU8FromWasm0(arg1, arg2), getArrayU32FromWasm0(arg3, arg4), getArrayU8FromWasm0(arg5, arg6), getArrayU32FromWasm0(arg7, arg8), getArrayU8FromWasm0(arg9, arg10), getArrayU32FromWasm0(arg11, arg12), getArrayU8FromWasm0(arg13, arg14));
|
|
406
406
|
return addHeapObject(ret);
|
|
407
407
|
},
|
|
@@ -469,14 +469,14 @@ function __wbg_get_imports() {
|
|
|
469
469
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
470
470
|
return addHeapObject(ret);
|
|
471
471
|
},
|
|
472
|
-
__wbg_has_73acff3aa1153f21: function(arg0, arg1, arg2) {
|
|
473
|
-
const ret = getObject(arg0).has(getArrayU8FromWasm0(arg1, arg2));
|
|
474
|
-
return addHeapObject(ret);
|
|
475
|
-
},
|
|
476
472
|
__wbg_has_8374cf06984d8bfc: function() { return handleError(function (arg0, arg1) {
|
|
477
473
|
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
478
474
|
return ret;
|
|
479
475
|
}, arguments); },
|
|
476
|
+
__wbg_has_a7ab29ab80428287: function(arg0, arg1, arg2) {
|
|
477
|
+
const ret = getObject(arg0).has(getArrayU8FromWasm0(arg1, arg2));
|
|
478
|
+
return addHeapObject(ret);
|
|
479
|
+
},
|
|
480
480
|
__wbg_headers_cf9c80f30e2a4eff: function(arg0) {
|
|
481
481
|
const ret = getObject(arg0).headers;
|
|
482
482
|
return addHeapObject(ret);
|
|
@@ -533,11 +533,11 @@ function __wbg_get_imports() {
|
|
|
533
533
|
const ret = Symbol.iterator;
|
|
534
534
|
return addHeapObject(ret);
|
|
535
535
|
},
|
|
536
|
-
|
|
536
|
+
__wbg_keyEnds_f5754a2fb464d0b7: function(arg0) {
|
|
537
537
|
const ret = getObject(arg0).keyEnds;
|
|
538
538
|
return addHeapObject(ret);
|
|
539
539
|
},
|
|
540
|
-
|
|
540
|
+
__wbg_keys_db719abaf17d49a0: function(arg0) {
|
|
541
541
|
const ret = getObject(arg0).keys;
|
|
542
542
|
return addHeapObject(ret);
|
|
543
543
|
},
|
|
@@ -604,7 +604,7 @@ function __wbg_get_imports() {
|
|
|
604
604
|
const a = state0.a;
|
|
605
605
|
state0.a = 0;
|
|
606
606
|
try {
|
|
607
|
-
return
|
|
607
|
+
return __wasm_bindgen_func_elem_4345(a, state0.b, arg0, arg1);
|
|
608
608
|
} finally {
|
|
609
609
|
state0.a = a;
|
|
610
610
|
}
|
|
@@ -667,7 +667,7 @@ function __wbg_get_imports() {
|
|
|
667
667
|
const ret = getObject(arg0).now();
|
|
668
668
|
return ret;
|
|
669
669
|
},
|
|
670
|
-
|
|
670
|
+
__wbg_open_d3c7a73988c337d0: function(arg0, arg1) {
|
|
671
671
|
const ret = open(getStringFromWasm0(arg0, arg1));
|
|
672
672
|
return addHeapObject(ret);
|
|
673
673
|
},
|
|
@@ -703,7 +703,7 @@ function __wbg_get_imports() {
|
|
|
703
703
|
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
704
704
|
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
705
705
|
}, arguments); },
|
|
706
|
-
|
|
706
|
+
__wbg_read_9777c38c7aa2eadf: function(arg0, arg1, arg2) {
|
|
707
707
|
const ret = getObject(arg0).read(getArrayU8FromWasm0(arg1, arg2));
|
|
708
708
|
return addHeapObject(ret);
|
|
709
709
|
},
|
|
@@ -718,7 +718,7 @@ function __wbg_get_imports() {
|
|
|
718
718
|
__wbg_respond_510e32df8aeb6817: function() { return handleError(function (arg0, arg1) {
|
|
719
719
|
getObject(arg0).respond(arg1 >>> 0);
|
|
720
720
|
}, arguments); },
|
|
721
|
-
|
|
721
|
+
__wbg_scan_f620185042d6f9dd: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
|
|
722
722
|
const ret = getObject(arg0).scan(getArrayU8FromWasm0(arg1, arg2), getArrayU8FromWasm0(arg3, arg4), arg5 !== 0, arg6 >>> 0, arg7 !== 0);
|
|
723
723
|
return addHeapObject(ret);
|
|
724
724
|
},
|
|
@@ -804,7 +804,7 @@ function __wbg_get_imports() {
|
|
|
804
804
|
const ret = getObject(arg0).then(getObject(arg1));
|
|
805
805
|
return addHeapObject(ret);
|
|
806
806
|
},
|
|
807
|
-
|
|
807
|
+
__wbg_to_string_e3969f722f4c9536: function(arg0) {
|
|
808
808
|
const ret = to_string(takeObject(arg0));
|
|
809
809
|
return addHeapObject(ret);
|
|
810
810
|
},
|
|
@@ -815,7 +815,7 @@ function __wbg_get_imports() {
|
|
|
815
815
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
816
816
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
817
817
|
},
|
|
818
|
-
|
|
818
|
+
__wbg_valueEnds_9c9adcd836a17842: function(arg0) {
|
|
819
819
|
const ret = getObject(arg0).valueEnds;
|
|
820
820
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
821
821
|
},
|
|
@@ -823,7 +823,7 @@ function __wbg_get_imports() {
|
|
|
823
823
|
const ret = getObject(arg0).value;
|
|
824
824
|
return addHeapObject(ret);
|
|
825
825
|
},
|
|
826
|
-
|
|
826
|
+
__wbg_values_2a62516a54768553: function(arg0) {
|
|
827
827
|
const ret = getObject(arg0).values;
|
|
828
828
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
829
829
|
},
|
|
@@ -836,23 +836,23 @@ function __wbg_get_imports() {
|
|
|
836
836
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
837
837
|
},
|
|
838
838
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
839
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Boolean], shim_idx:
|
|
840
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
839
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Boolean], shim_idx: 1390, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
840
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_27670);
|
|
841
841
|
return addHeapObject(ret);
|
|
842
842
|
},
|
|
843
843
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
844
844
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 284, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
845
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
845
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_4272);
|
|
846
846
|
return addHeapObject(ret);
|
|
847
847
|
},
|
|
848
848
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
849
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Option(NamedExternref("Uint8Array"))], shim_idx:
|
|
850
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
849
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Option(NamedExternref("Uint8Array"))], shim_idx: 1388, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
850
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_27668);
|
|
851
851
|
return addHeapObject(ret);
|
|
852
852
|
},
|
|
853
853
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
854
854
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 487, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
855
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
855
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7494);
|
|
856
856
|
return addHeapObject(ret);
|
|
857
857
|
},
|
|
858
858
|
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
@@ -901,14 +901,14 @@ function __wbg_get_imports() {
|
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
903
|
|
|
904
|
-
function
|
|
905
|
-
wasm.
|
|
904
|
+
function __wasm_bindgen_func_elem_7494(arg0, arg1) {
|
|
905
|
+
wasm.__wasm_bindgen_func_elem_7494(arg0, arg1);
|
|
906
906
|
}
|
|
907
907
|
|
|
908
|
-
function
|
|
908
|
+
function __wasm_bindgen_func_elem_27670(arg0, arg1, arg2) {
|
|
909
909
|
try {
|
|
910
910
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
911
|
-
wasm.
|
|
911
|
+
wasm.__wasm_bindgen_func_elem_27670(retptr, arg0, arg1, arg2);
|
|
912
912
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
913
913
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
914
914
|
if (r1) {
|
|
@@ -919,10 +919,10 @@ function __wasm_bindgen_func_elem_27711(arg0, arg1, arg2) {
|
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
921
|
|
|
922
|
-
function
|
|
922
|
+
function __wasm_bindgen_func_elem_4272(arg0, arg1, arg2) {
|
|
923
923
|
try {
|
|
924
924
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
925
|
-
wasm.
|
|
925
|
+
wasm.__wasm_bindgen_func_elem_4272(retptr, arg0, arg1, addHeapObject(arg2));
|
|
926
926
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
927
927
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
928
928
|
if (r1) {
|
|
@@ -933,10 +933,10 @@ function __wasm_bindgen_func_elem_4262(arg0, arg1, arg2) {
|
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
935
|
|
|
936
|
-
function
|
|
936
|
+
function __wasm_bindgen_func_elem_27668(arg0, arg1, arg2) {
|
|
937
937
|
try {
|
|
938
938
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
939
|
-
wasm.
|
|
939
|
+
wasm.__wasm_bindgen_func_elem_27668(retptr, arg0, arg1, isLikeNone(arg2) ? 0 : addHeapObject(arg2));
|
|
940
940
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
941
941
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
942
942
|
if (r1) {
|
|
@@ -947,8 +947,8 @@ function __wasm_bindgen_func_elem_27709(arg0, arg1, arg2) {
|
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
949
|
|
|
950
|
-
function
|
|
951
|
-
wasm.
|
|
950
|
+
function __wasm_bindgen_func_elem_4345(arg0, arg1, arg2, arg3) {
|
|
951
|
+
wasm.__wasm_bindgen_func_elem_4345(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
952
952
|
}
|
|
953
953
|
|
|
954
954
|
|
package/dist/index_bg.wasm
CHANGED
|
Binary file
|
package/dist/index_bg.wasm.d.ts
CHANGED
|
@@ -22,11 +22,11 @@ export const intounderlyingsink_close: (a: number) => number;
|
|
|
22
22
|
export const intounderlyingsink_write: (a: number, b: number) => number;
|
|
23
23
|
export const intounderlyingsource_cancel: (a: number) => void;
|
|
24
24
|
export const intounderlyingsource_pull: (a: number, b: number) => number;
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
25
|
+
export const __wasm_bindgen_func_elem_27670: (a: number, b: number, c: number, d: number) => void;
|
|
26
|
+
export const __wasm_bindgen_func_elem_4272: (a: number, b: number, c: number, d: number) => void;
|
|
27
|
+
export const __wasm_bindgen_func_elem_27668: (a: number, b: number, c: number, d: number) => void;
|
|
28
|
+
export const __wasm_bindgen_func_elem_4345: (a: number, b: number, c: number, d: number) => void;
|
|
29
|
+
export const __wasm_bindgen_func_elem_7494: (a: number, b: number) => void;
|
|
30
30
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
31
31
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
32
32
|
export const __wbindgen_export3: (a: number) => void;
|
package/package.json
CHANGED
|
File without changes
|