@reifydb/wasm 0.3.0 → 0.4.1
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/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-License-Identifier:
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n// Copyright (c) 2025 ReifyDB\n\nimport { decode, type TypeValuePair } from '@reifydb/core';\nimport type { WasmDB as RawWasmDB } from '../wasm/reifydb_webassembly';\n\nexport { decode } from '@reifydb/core';\nexport type { TypeValuePair, Value } from '@reifydb/core';\n\n/**\n * Recursively transforms raw WASM output into decoded Value instances.\n *\n * The WASM engine returns typed values as `{type, value}` pairs.\n * This function walks the result tree and decodes each pair using `@reifydb/core`'s `decode()`.\n */\nexport function transformToValueInstances(result: unknown): unknown {\n if (result === null || result === undefined) return result;\n if (typeof result !== 'object') return result;\n if (Array.isArray(result)) {\n return result.map(transformToValueInstances);\n }\n const obj = result as Record<string, unknown>;\n if ('type' in obj && 'value' in obj && Object.keys(obj).length === 2) {\n return decode(obj as unknown as TypeValuePair);\n }\n const transformed: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n transformed[key] = transformToValueInstances(value);\n }\n return transformed;\n}\n\n/**\n * High-level wrapper around the raw WASM database engine.\n *\n * Provides typed methods for admin, command, and query operations,\n * automatically decoding WASM type-value pairs into Value instances.\n */\nexport class WasmDB {\n private db: RawWasmDB;\n\n constructor(db: RawWasmDB) {\n this.db = db;\n }\n\n admin(rql: string): unknown {\n return transformToValueInstances(this.db.admin(rql));\n }\n\n adminWithParams(rql: string, params: unknown): unknown {\n return transformToValueInstances(this.db.adminWithParams(rql, params));\n }\n\n command(rql: string): unknown {\n return transformToValueInstances(this.db.command(rql));\n }\n\n commandWithParams(rql: string, params: unknown): unknown {\n return transformToValueInstances(this.db.commandWithParams(rql, params));\n }\n\n query(rql: string): unknown {\n return transformToValueInstances(this.db.query(rql));\n }\n\n queryWithParams(rql: string, params: unknown): unknown {\n return transformToValueInstances(this.db.queryWithParams(rql, params));\n }\n\n free(): void {\n this.db.free();\n }\n}\n\n/**\n * Creates a new WasmDB instance by dynamically importing the WASM module.\n *\n * The dynamic import ensures the WASM glue code is not bundled by tsup\n * and is instead resolved by the consumer's bundler (Vite, webpack, etc.).\n *\n * @example\n * ```typescript\n * import { createWasmDB } from '@reifydb/wasm';\n *\n * const db = await createWasmDB();\n * db.admin('CREATE NAMESPACE demo');\n * const results = db.query('FROM demo.users');\n * db.free();\n * ```\n */\nexport async function createWasmDB(): Promise<WasmDB> {\n const mod = await import('../wasm/reifydb_webassembly.js');\n return new WasmDB(new mod.WasmDB());\n}\n"],"mappings":";AAGA,SAAS,cAAkC;AAG3C,SAAS,UAAAA,eAAc;AAShB,SAAS,0BAA0B,QAA0B;AAClE,MAAI,WAAW,QAAQ,WAAW,OAAW,QAAO;AACpD,MAAI,OAAO,WAAW,SAAU,QAAO;AACvC,MAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,WAAO,OAAO,IAAI,yBAAyB;AAAA,EAC7C;AACA,QAAM,MAAM;AACZ,MAAI,UAAU,OAAO,WAAW,OAAO,OAAO,KAAK,GAAG,EAAE,WAAW,GAAG;AACpE,WAAO,OAAO,GAA+B;AAAA,EAC/C;AACA,QAAM,cAAuC,CAAC;AAC9C,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,gBAAY,GAAG,IAAI,0BAA0B,KAAK;AAAA,EACpD;AACA,SAAO;AACT;AAQO,IAAM,SAAN,MAAa;AAAA,EACV;AAAA,EAER,YAAY,IAAe;AACzB,SAAK,KAAK;AAAA,EACZ;AAAA,EAEA,MAAM,KAAsB;AAC1B,WAAO,0BAA0B,KAAK,GAAG,MAAM,GAAG,CAAC;AAAA,EACrD;AAAA,EAEA,gBAAgB,KAAa,QAA0B;AACrD,WAAO,0BAA0B,KAAK,GAAG,gBAAgB,KAAK,MAAM,CAAC;AAAA,EACvE;AAAA,EAEA,QAAQ,KAAsB;AAC5B,WAAO,0BAA0B,KAAK,GAAG,QAAQ,GAAG,CAAC;AAAA,EACvD;AAAA,EAEA,kBAAkB,KAAa,QAA0B;AACvD,WAAO,0BAA0B,KAAK,GAAG,kBAAkB,KAAK,MAAM,CAAC;AAAA,EACzE;AAAA,EAEA,MAAM,KAAsB;AAC1B,WAAO,0BAA0B,KAAK,GAAG,MAAM,GAAG,CAAC;AAAA,EACrD;AAAA,EAEA,gBAAgB,KAAa,QAA0B;AACrD,WAAO,0BAA0B,KAAK,GAAG,gBAAgB,KAAK,MAAM,CAAC;AAAA,EACvE;AAAA,EAEA,OAAa;AACX,SAAK,GAAG,KAAK;AAAA,EACf;AACF;AAkBA,eAAsB,eAAgC;AACpD,QAAM,MAAM,MAAM,OAAO,gCAAgC;AACzD,SAAO,IAAI,OAAO,IAAI,IAAI,OAAO,CAAC;AACpC;","names":["decode"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reifydb/wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@reifydb/core": "0.
|
|
8
|
+
"@reifydb/core": "0.4.1"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@types/node": "^24.0.10",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"license": "
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "https://github.com/reifydb/reifydb.git",
|
package/wasm/package.json
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"Dominique Chuo <dominique@reifydb.com>"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for ReifyDB query engine",
|
|
8
|
-
"version": "0.
|
|
9
|
-
"license": "
|
|
8
|
+
"version": "0.4.0",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/reifydb/reifydb"
|
|
@@ -336,8 +336,8 @@ export function __wbg_stringify_8d1cc6ff383e8bae() { return handleError(function
|
|
|
336
336
|
return ret;
|
|
337
337
|
}, arguments); }
|
|
338
338
|
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
339
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
340
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
339
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2617, function: Function { arguments: [], shim_idx: 2618, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
340
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8b1ea05c1c073803, wasm_bindgen__convert__closures_____invoke__h205d784230941d7a);
|
|
341
341
|
return ret;
|
|
342
342
|
}
|
|
343
343
|
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
@@ -359,8 +359,8 @@ export function __wbindgen_init_externref_table() {
|
|
|
359
359
|
table.set(offset + 2, true);
|
|
360
360
|
table.set(offset + 3, false);
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
wasm.
|
|
362
|
+
function wasm_bindgen__convert__closures_____invoke__h205d784230941d7a(arg0, arg1) {
|
|
363
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h205d784230941d7a(arg0, arg1);
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
const JsErrorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
Binary file
|
|
@@ -27,8 +27,8 @@ export const test_state_prefix: (a: bigint, b: number, c: number, d: number, e:
|
|
|
27
27
|
export const test_state_range: (a: bigint, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
28
28
|
export const test_state_remove: (a: bigint, b: number, c: number, d: number) => number;
|
|
29
29
|
export const test_state_set: (a: bigint, b: number, c: number, d: number, e: number, f: number) => number;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
30
|
+
export const wasm_bindgen__closure__destroy__h8b1ea05c1c073803: (a: number, b: number) => void;
|
|
31
|
+
export const wasm_bindgen__convert__closures_____invoke__h205d784230941d7a: (a: number, b: number) => void;
|
|
32
32
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
33
33
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
34
34
|
export const __wbindgen_exn_store: (a: number) => void;
|