frogql-wasm 0.2.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 ADDED
@@ -0,0 +1,102 @@
1
+ # frogql-wasm
2
+
3
+ froGQL compiled to WebAssembly: an in-browser, in-RAM graph engine.
4
+
5
+ Wraps the `MemoryGraphStore` backend plus the shared compiler/runtime and
6
+ exposes a `Connection` to JavaScript via `wasm-bindgen`. There is no
7
+ filesystem in the browser, so the binding works entirely with the JSON
8
+ shape `MemoryGraphStore` understands.
9
+
10
+ ## Install & use (from any app)
11
+
12
+ Published to npm as **`frogql-wasm`** (unscoped). The package is built with
13
+ the wasm-pack `web` target, so it works in Vite / Rollup / esbuild / plain
14
+ browsers with no extra bundler plugin — call `await init()` once, then use
15
+ the API.
16
+
17
+ ```bash
18
+ npm install frogql-wasm
19
+ ```
20
+
21
+ ```js
22
+ import init, { open_json } from "frogql-wasm";
23
+
24
+ await init(); // load the .wasm (once, up front)
25
+
26
+ const conn = open_json(JSON.stringify({
27
+ nodes: [{ id: "a", labels: ["Person"], props: { name: "Alice" } }],
28
+ edges: [],
29
+ }));
30
+
31
+ conn.execute("MATCH (n:Person) RETURN n.name AS name"); // [{ name: "Alice" }]
32
+ conn.execute("INSERT (b:Person {name: 'Bob'})"); // { nodes_inserted: 1, ... }
33
+ conn.node_count; // 2
34
+
35
+ const snapshot = conn.to_json(); // persist this string (e.g. IndexedDB)
36
+ const restored = open_json(snapshot); // reload later
37
+ ```
38
+
39
+ Verified: a fresh project that `npm install`s the package and runs
40
+ `vite build` bundles the `.wasm` (≈300 kB gzip) with no plugin.
41
+
42
+ - `open_json(json)` → `Connection`. Parses `{ "nodes": [...], "edges": [...] }`.
43
+ - `Connection.execute(query, limit?)` → rows array (read queries) or a
44
+ counters object (INSERT / SET / REMOVE / DELETE). `limit` defaults to 100.
45
+ - `Connection.to_json()` → JSON string of the live merged view (base +
46
+ any mutations). Round-trips through `open_json`.
47
+ - `Connection.schema()` → `{ node_labels, edge_labels, node_count, edge_count }`.
48
+ - `Connection.node_count` / `edge_count` (getters).
49
+
50
+ Not supported in this backend (no catalog / secondary index in memory):
51
+ `CREATE/USE/DROP GRAPH TYPE`, `CREATE INDEX`. Queries typecheck against the
52
+ inferred DEFAULT schema.
53
+
54
+ ## Build
55
+
56
+ ```bash
57
+ # one-time toolchain
58
+ rustup target add wasm32-unknown-unknown
59
+ cargo install wasm-bindgen-cli --version 0.2.122 # match the wasm-bindgen crate
60
+
61
+ # generate the JS package (web target)
62
+ cargo build -p frogql-wasm --target wasm32-unknown-unknown --release
63
+ wasm-bindgen target/wasm32-unknown-unknown/release/frogql_wasm.wasm \
64
+ --out-dir <out> --target web
65
+ ```
66
+
67
+ `wasm-pack build wasm --target web` (after `cargo install wasm-pack`) is the
68
+ all-in-one alternative and additionally runs `wasm-opt` to shrink the binary
69
+ (~855 kB vs ~1 MB). This is exactly what the npm release job
70
+ (`.github/workflows/release-wasm.yml`) runs to produce the published
71
+ `frogql-wasm` package.
72
+
73
+ The playground frontend wires this up: `playground/frontend/scripts/build-wasm.sh`
74
+ (run via `npm run build:wasm`) regenerates the bindings into
75
+ `playground/frontend/src/frogql-wasm/` (gitignored), which the React app imports.
76
+
77
+ ### Marshaling note
78
+
79
+ Results are returned via `serde_wasm_bindgen::Serializer::json_compatible()`,
80
+ not `serde_wasm_bindgen::to_value`. The default serializes `serde_json` maps as
81
+ JS `Map` objects, which surface as empty `{}` under `JSON.stringify` / bracket
82
+ access. `json_compatible()` serializes them as plain objects.
83
+
84
+ ## Test
85
+
86
+ The engine core (`query_json` / `dm_json`) is unit-tested on the host
87
+ target — no browser needed:
88
+
89
+ ```bash
90
+ cargo test -p frogql-wasm
91
+ ```
92
+
93
+ The JavaScript marshaling layer on top (`JsValue` conversion) only runs in
94
+ a JS environment; exercise it with `wasm-pack test --headless --firefox`
95
+ once `wasm-pack` is installed.
96
+
97
+ ## Persistence
98
+
99
+ Phase 1 persists the graph as the `to_json()` string in IndexedDB.
100
+ Persisting the binary `.gdb` format (and on-demand paging for graphs that
101
+ do not fit in RAM) is Phase 2 — it requires abstracting the `Pager` off
102
+ `std::fs::File` onto OPFS. See `docs/internals/wasm-browser-plan.md`.
@@ -0,0 +1,79 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * A live in-memory graph plus the caches that keep query latency flat.
6
+ */
7
+ export class Connection {
8
+ private constructor();
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ /**
12
+ * Execute one GQL statement. Read queries return an array of row
13
+ * objects; data-modifying statements return a counters object.
14
+ * `limit` caps the number of rows (default 100 when omitted on the
15
+ * JS side).
16
+ */
17
+ execute(query: string, limit?: number | null): any;
18
+ /**
19
+ * `{ node_labels, edge_labels, node_count, edge_count }`, mirroring
20
+ * the Python/Node `schema()` summary.
21
+ */
22
+ schema(): any;
23
+ /**
24
+ * Serialise the live merged view (base + overlay) to a JSON string —
25
+ * the unit to hand IndexedDB for persistence. Re-open it later with
26
+ * `open_json`.
27
+ */
28
+ to_json(): string;
29
+ readonly edge_count: number;
30
+ readonly node_count: number;
31
+ }
32
+
33
+ /**
34
+ * Parse a JSON graph document (`{"nodes": [...], "edges": [...]}`) and
35
+ * open a connection over it. Warms the LTJ index eagerly so the first
36
+ * query is as fast as the rest.
37
+ */
38
+ export function open_json(json: string): Connection;
39
+
40
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
41
+
42
+ export interface InitOutput {
43
+ readonly memory: WebAssembly.Memory;
44
+ readonly __wbg_connection_free: (a: number, b: number) => void;
45
+ readonly connection_edge_count: (a: number) => number;
46
+ readonly connection_execute: (a: number, b: number, c: number, d: number) => [number, number, number];
47
+ readonly connection_node_count: (a: number) => number;
48
+ readonly connection_schema: (a: number) => [number, number, number];
49
+ readonly connection_to_json: (a: number) => [number, number];
50
+ readonly open_json: (a: number, b: number) => [number, number, number];
51
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
52
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
53
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
54
+ readonly __wbindgen_externrefs: WebAssembly.Table;
55
+ readonly __externref_table_dealloc: (a: number) => void;
56
+ readonly __wbindgen_start: () => void;
57
+ }
58
+
59
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
60
+
61
+ /**
62
+ * Instantiates the given `module`, which can either be bytes or
63
+ * a precompiled `WebAssembly.Module`.
64
+ *
65
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
66
+ *
67
+ * @returns {InitOutput}
68
+ */
69
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
70
+
71
+ /**
72
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
73
+ * for everything else, calls `WebAssembly.instantiate` directly.
74
+ *
75
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
76
+ *
77
+ * @returns {Promise<InitOutput>}
78
+ */
79
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/frogql_wasm.js ADDED
@@ -0,0 +1,397 @@
1
+ /* @ts-self-types="./frogql_wasm.d.ts" */
2
+
3
+ /**
4
+ * A live in-memory graph plus the caches that keep query latency flat.
5
+ */
6
+ export class Connection {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(Connection.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ ConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ ConnectionFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_connection_free(ptr, 0);
22
+ }
23
+ /**
24
+ * @returns {number}
25
+ */
26
+ get edge_count() {
27
+ const ret = wasm.connection_edge_count(this.__wbg_ptr);
28
+ return ret >>> 0;
29
+ }
30
+ /**
31
+ * Execute one GQL statement. Read queries return an array of row
32
+ * objects; data-modifying statements return a counters object.
33
+ * `limit` caps the number of rows (default 100 when omitted on the
34
+ * JS side).
35
+ * @param {string} query
36
+ * @param {number | null} [limit]
37
+ * @returns {any}
38
+ */
39
+ execute(query, limit) {
40
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
41
+ const len0 = WASM_VECTOR_LEN;
42
+ const ret = wasm.connection_execute(this.__wbg_ptr, ptr0, len0, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0);
43
+ if (ret[2]) {
44
+ throw takeFromExternrefTable0(ret[1]);
45
+ }
46
+ return takeFromExternrefTable0(ret[0]);
47
+ }
48
+ /**
49
+ * @returns {number}
50
+ */
51
+ get node_count() {
52
+ const ret = wasm.connection_node_count(this.__wbg_ptr);
53
+ return ret >>> 0;
54
+ }
55
+ /**
56
+ * `{ node_labels, edge_labels, node_count, edge_count }`, mirroring
57
+ * the Python/Node `schema()` summary.
58
+ * @returns {any}
59
+ */
60
+ schema() {
61
+ const ret = wasm.connection_schema(this.__wbg_ptr);
62
+ if (ret[2]) {
63
+ throw takeFromExternrefTable0(ret[1]);
64
+ }
65
+ return takeFromExternrefTable0(ret[0]);
66
+ }
67
+ /**
68
+ * Serialise the live merged view (base + overlay) to a JSON string —
69
+ * the unit to hand IndexedDB for persistence. Re-open it later with
70
+ * `open_json`.
71
+ * @returns {string}
72
+ */
73
+ to_json() {
74
+ let deferred1_0;
75
+ let deferred1_1;
76
+ try {
77
+ const ret = wasm.connection_to_json(this.__wbg_ptr);
78
+ deferred1_0 = ret[0];
79
+ deferred1_1 = ret[1];
80
+ return getStringFromWasm0(ret[0], ret[1]);
81
+ } finally {
82
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
83
+ }
84
+ }
85
+ }
86
+ if (Symbol.dispose) Connection.prototype[Symbol.dispose] = Connection.prototype.free;
87
+
88
+ /**
89
+ * Parse a JSON graph document (`{"nodes": [...], "edges": [...]}`) and
90
+ * open a connection over it. Warms the LTJ index eagerly so the first
91
+ * query is as fast as the rest.
92
+ * @param {string} json
93
+ * @returns {Connection}
94
+ */
95
+ export function open_json(json) {
96
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
97
+ const len0 = WASM_VECTOR_LEN;
98
+ const ret = wasm.open_json(ptr0, len0);
99
+ if (ret[2]) {
100
+ throw takeFromExternrefTable0(ret[1]);
101
+ }
102
+ return Connection.__wrap(ret[0]);
103
+ }
104
+ function __wbg_get_imports() {
105
+ const import0 = {
106
+ __proto__: null,
107
+ __wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
108
+ const ret = Error(getStringFromWasm0(arg0, arg1));
109
+ return ret;
110
+ },
111
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
112
+ const ret = String(arg1);
113
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
114
+ const len1 = WASM_VECTOR_LEN;
115
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
116
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
117
+ },
118
+ __wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
119
+ const ret = typeof(arg0) === 'string';
120
+ return ret;
121
+ },
122
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
123
+ throw new Error(getStringFromWasm0(arg0, arg1));
124
+ },
125
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
126
+ let deferred0_0;
127
+ let deferred0_1;
128
+ try {
129
+ deferred0_0 = arg0;
130
+ deferred0_1 = arg1;
131
+ console.error(getStringFromWasm0(arg0, arg1));
132
+ } finally {
133
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
134
+ }
135
+ },
136
+ __wbg_new_227d7c05414eb861: function() {
137
+ const ret = new Error();
138
+ return ret;
139
+ },
140
+ __wbg_new_622fc80556be2e26: function() {
141
+ const ret = new Map();
142
+ return ret;
143
+ },
144
+ __wbg_new_ce1ab61c1c2b300d: function() {
145
+ const ret = new Object();
146
+ return ret;
147
+ },
148
+ __wbg_new_d90091b82fdf5b91: function() {
149
+ const ret = new Array();
150
+ return ret;
151
+ },
152
+ __wbg_set_52b1e1eb5bed906a: function(arg0, arg1, arg2) {
153
+ const ret = arg0.set(arg1, arg2);
154
+ return ret;
155
+ },
156
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
157
+ arg0[arg1] = arg2;
158
+ },
159
+ __wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
160
+ arg0[arg1 >>> 0] = arg2;
161
+ },
162
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
163
+ const ret = arg1.stack;
164
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
165
+ const len1 = WASM_VECTOR_LEN;
166
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
167
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
168
+ },
169
+ __wbindgen_cast_0000000000000001: function(arg0) {
170
+ // Cast intrinsic for `F64 -> Externref`.
171
+ const ret = arg0;
172
+ return ret;
173
+ },
174
+ __wbindgen_cast_0000000000000002: function(arg0) {
175
+ // Cast intrinsic for `I64 -> Externref`.
176
+ const ret = arg0;
177
+ return ret;
178
+ },
179
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
180
+ // Cast intrinsic for `Ref(String) -> Externref`.
181
+ const ret = getStringFromWasm0(arg0, arg1);
182
+ return ret;
183
+ },
184
+ __wbindgen_cast_0000000000000004: function(arg0) {
185
+ // Cast intrinsic for `U64 -> Externref`.
186
+ const ret = BigInt.asUintN(64, arg0);
187
+ return ret;
188
+ },
189
+ __wbindgen_init_externref_table: function() {
190
+ const table = wasm.__wbindgen_externrefs;
191
+ const offset = table.grow(4);
192
+ table.set(0, undefined);
193
+ table.set(offset + 0, undefined);
194
+ table.set(offset + 1, null);
195
+ table.set(offset + 2, true);
196
+ table.set(offset + 3, false);
197
+ },
198
+ };
199
+ return {
200
+ __proto__: null,
201
+ "./frogql_wasm_bg.js": import0,
202
+ };
203
+ }
204
+
205
+ const ConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
206
+ ? { register: () => {}, unregister: () => {} }
207
+ : new FinalizationRegistry(ptr => wasm.__wbg_connection_free(ptr, 1));
208
+
209
+ let cachedDataViewMemory0 = null;
210
+ function getDataViewMemory0() {
211
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
212
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
213
+ }
214
+ return cachedDataViewMemory0;
215
+ }
216
+
217
+ function getStringFromWasm0(ptr, len) {
218
+ return decodeText(ptr >>> 0, len);
219
+ }
220
+
221
+ let cachedUint8ArrayMemory0 = null;
222
+ function getUint8ArrayMemory0() {
223
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
224
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
225
+ }
226
+ return cachedUint8ArrayMemory0;
227
+ }
228
+
229
+ function isLikeNone(x) {
230
+ return x === undefined || x === null;
231
+ }
232
+
233
+ function passStringToWasm0(arg, malloc, realloc) {
234
+ if (realloc === undefined) {
235
+ const buf = cachedTextEncoder.encode(arg);
236
+ const ptr = malloc(buf.length, 1) >>> 0;
237
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
238
+ WASM_VECTOR_LEN = buf.length;
239
+ return ptr;
240
+ }
241
+
242
+ let len = arg.length;
243
+ let ptr = malloc(len, 1) >>> 0;
244
+
245
+ const mem = getUint8ArrayMemory0();
246
+
247
+ let offset = 0;
248
+
249
+ for (; offset < len; offset++) {
250
+ const code = arg.charCodeAt(offset);
251
+ if (code > 0x7F) break;
252
+ mem[ptr + offset] = code;
253
+ }
254
+ if (offset !== len) {
255
+ if (offset !== 0) {
256
+ arg = arg.slice(offset);
257
+ }
258
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
259
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
260
+ const ret = cachedTextEncoder.encodeInto(arg, view);
261
+
262
+ offset += ret.written;
263
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
264
+ }
265
+
266
+ WASM_VECTOR_LEN = offset;
267
+ return ptr;
268
+ }
269
+
270
+ function takeFromExternrefTable0(idx) {
271
+ const value = wasm.__wbindgen_externrefs.get(idx);
272
+ wasm.__externref_table_dealloc(idx);
273
+ return value;
274
+ }
275
+
276
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
277
+ cachedTextDecoder.decode();
278
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
279
+ let numBytesDecoded = 0;
280
+ function decodeText(ptr, len) {
281
+ numBytesDecoded += len;
282
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
283
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
284
+ cachedTextDecoder.decode();
285
+ numBytesDecoded = len;
286
+ }
287
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
288
+ }
289
+
290
+ const cachedTextEncoder = new TextEncoder();
291
+
292
+ if (!('encodeInto' in cachedTextEncoder)) {
293
+ cachedTextEncoder.encodeInto = function (arg, view) {
294
+ const buf = cachedTextEncoder.encode(arg);
295
+ view.set(buf);
296
+ return {
297
+ read: arg.length,
298
+ written: buf.length
299
+ };
300
+ };
301
+ }
302
+
303
+ let WASM_VECTOR_LEN = 0;
304
+
305
+ let wasmModule, wasmInstance, wasm;
306
+ function __wbg_finalize_init(instance, module) {
307
+ wasmInstance = instance;
308
+ wasm = instance.exports;
309
+ wasmModule = module;
310
+ cachedDataViewMemory0 = null;
311
+ cachedUint8ArrayMemory0 = null;
312
+ wasm.__wbindgen_start();
313
+ return wasm;
314
+ }
315
+
316
+ async function __wbg_load(module, imports) {
317
+ if (typeof Response === 'function' && module instanceof Response) {
318
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
319
+ try {
320
+ return await WebAssembly.instantiateStreaming(module, imports);
321
+ } catch (e) {
322
+ const validResponse = module.ok && expectedResponseType(module.type);
323
+
324
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
325
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
326
+
327
+ } else { throw e; }
328
+ }
329
+ }
330
+
331
+ const bytes = await module.arrayBuffer();
332
+ return await WebAssembly.instantiate(bytes, imports);
333
+ } else {
334
+ const instance = await WebAssembly.instantiate(module, imports);
335
+
336
+ if (instance instanceof WebAssembly.Instance) {
337
+ return { instance, module };
338
+ } else {
339
+ return instance;
340
+ }
341
+ }
342
+
343
+ function expectedResponseType(type) {
344
+ switch (type) {
345
+ case 'basic': case 'cors': case 'default': return true;
346
+ }
347
+ return false;
348
+ }
349
+ }
350
+
351
+ function initSync(module) {
352
+ if (wasm !== undefined) return wasm;
353
+
354
+
355
+ if (module !== undefined) {
356
+ if (Object.getPrototypeOf(module) === Object.prototype) {
357
+ ({module} = module)
358
+ } else {
359
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
360
+ }
361
+ }
362
+
363
+ const imports = __wbg_get_imports();
364
+ if (!(module instanceof WebAssembly.Module)) {
365
+ module = new WebAssembly.Module(module);
366
+ }
367
+ const instance = new WebAssembly.Instance(module, imports);
368
+ return __wbg_finalize_init(instance, module);
369
+ }
370
+
371
+ async function __wbg_init(module_or_path) {
372
+ if (wasm !== undefined) return wasm;
373
+
374
+
375
+ if (module_or_path !== undefined) {
376
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
377
+ ({module_or_path} = module_or_path)
378
+ } else {
379
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
380
+ }
381
+ }
382
+
383
+ if (module_or_path === undefined) {
384
+ module_or_path = new URL('frogql_wasm_bg.wasm', import.meta.url);
385
+ }
386
+ const imports = __wbg_get_imports();
387
+
388
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
389
+ module_or_path = fetch(module_or_path);
390
+ }
391
+
392
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
393
+
394
+ return __wbg_finalize_init(instance, module);
395
+ }
396
+
397
+ export { initSync, __wbg_init as default };
Binary file
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "frogql-wasm",
3
+ "type": "module",
4
+ "description": "froGQL — embedded GQL graph database with ISO GQL path patterns (Rust core, WebAssembly bindings for the browser)",
5
+ "version": "0.2.3",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/pleiad/frogql"
10
+ },
11
+ "files": [
12
+ "frogql_wasm_bg.wasm",
13
+ "frogql_wasm.js",
14
+ "frogql_wasm.d.ts"
15
+ ],
16
+ "main": "frogql_wasm.js",
17
+ "types": "frogql_wasm.d.ts",
18
+ "sideEffects": [
19
+ "./snippets/*"
20
+ ]
21
+ }