@quarb/wasm 0.12.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/quai_wasm.d.ts ADDED
@@ -0,0 +1,130 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class QuaiSession {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ /**
8
+ * The macro table (`def &1: …;` lines), for a history panel.
9
+ */
10
+ history(): string;
11
+ /**
12
+ * Open a session over *several* documents mounted as named
13
+ * children of one root, so a single query — including a `<=>`
14
+ * join — spans them all (`/name/...` paths). `sources_json` is a
15
+ * JSON array of `{"name", "format", "text"}` objects — or, for
16
+ * binary sources (an uploaded `.db`), `{"name", "format":
17
+ * "sqlite", "bytes_b64"}`. Names must be distinct. A single
18
+ * source mounts at the root, path-bare, exactly as the
19
+ * one-document constructor does.
20
+ */
21
+ static mount(sources_json: string, now_millis: number): QuaiSession;
22
+ /**
23
+ * Open a session over `input` parsed as `format` (json, yaml,
24
+ * toml, csv, tsv, xml, html, markdown). `now_millis` pins the
25
+ * session's `now()` (pass `Date.now()`).
26
+ */
27
+ constructor(format: string, input: string, now_millis: number);
28
+ /**
29
+ * Clear the history and restart numbering.
30
+ */
31
+ reset(): void;
32
+ /**
33
+ * Restore a persisted state (from localStorage).
34
+ */
35
+ restore(state_json: string): void;
36
+ /**
37
+ * Run one input line, returning a JSON envelope (label, lines,
38
+ * note, error). Mirrors the native REPL's dispatch: `def`/`macro`
39
+ * definitions, `&N#` frozen recall, `&N!` live re-read, and
40
+ * ordinary queries.
41
+ */
42
+ run(line: string): string;
43
+ /**
44
+ * Run one notebook-shaped cell, mirroring the Quarb kernel: a
45
+ * defs-only cell (allowing `#` comment lines) extends the macro
46
+ * table; anything else runs whole as a query — newlines are
47
+ * whitespace to the engine, and a cell may carry inline `def`s
48
+ * ahead of its query (the pivot-macro shape).
49
+ */
50
+ run_cell(text: string): string;
51
+ /**
52
+ * Serialize the durable state for localStorage.
53
+ */
54
+ state(): string;
55
+ /**
56
+ * The `&N` a fresh line will claim.
57
+ */
58
+ readonly line: number;
59
+ }
60
+
61
+ /**
62
+ * Highlight a query as HTML `<span class="qh-…">` markup — the same
63
+ * token model as the terminal (`highlight_ansi`) and the JupyterLab
64
+ * CodeMirror extension. The playground uses it to color the input
65
+ * line and the transcript echo.
66
+ */
67
+ export function highlight(query: string): string;
68
+
69
+ /**
70
+ * The engine version string, for the playground footer.
71
+ */
72
+ export function version(): string;
73
+
74
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
75
+
76
+ export interface InitOutput {
77
+ readonly memory: WebAssembly.Memory;
78
+ readonly __wbg_quaisession_free: (a: number, b: number) => void;
79
+ readonly highlight: (a: number, b: number) => [number, number];
80
+ readonly quaisession_history: (a: number) => [number, number];
81
+ readonly quaisession_line: (a: number) => number;
82
+ readonly quaisession_mount: (a: number, b: number, c: number) => [number, number, number];
83
+ readonly quaisession_new: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
84
+ readonly quaisession_reset: (a: number) => void;
85
+ readonly quaisession_restore: (a: number, b: number, c: number) => void;
86
+ readonly quaisession_run: (a: number, b: number, c: number) => [number, number];
87
+ readonly quaisession_run_cell: (a: number, b: number, c: number) => [number, number];
88
+ readonly quaisession_state: (a: number) => [number, number];
89
+ readonly version: () => [number, number];
90
+ readonly rust_sqlite_wasm_abort: () => void;
91
+ readonly rust_sqlite_wasm_assert_fail: (a: number, b: number, c: number, d: number) => void;
92
+ readonly rust_sqlite_wasm_calloc: (a: number, b: number) => number;
93
+ readonly rust_sqlite_wasm_free: (a: number) => void;
94
+ readonly rust_sqlite_wasm_getentropy: (a: number, b: number) => number;
95
+ readonly rust_sqlite_wasm_localtime: (a: number) => number;
96
+ readonly rust_sqlite_wasm_malloc: (a: number) => number;
97
+ readonly rust_sqlite_wasm_realloc: (a: number, b: number) => number;
98
+ readonly sqlite3_os_end: () => number;
99
+ readonly sqlite3_os_init: () => number;
100
+ readonly __wbindgen_exn_store: (a: number) => void;
101
+ readonly __externref_table_alloc: () => number;
102
+ readonly __wbindgen_externrefs: WebAssembly.Table;
103
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
104
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
105
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
106
+ readonly __externref_table_dealloc: (a: number) => void;
107
+ readonly __wbindgen_start: () => void;
108
+ }
109
+
110
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
111
+
112
+ /**
113
+ * Instantiates the given `module`, which can either be bytes or
114
+ * a precompiled `WebAssembly.Module`.
115
+ *
116
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
117
+ *
118
+ * @returns {InitOutput}
119
+ */
120
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
121
+
122
+ /**
123
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
124
+ * for everything else, calls `WebAssembly.instantiate` directly.
125
+ *
126
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
127
+ *
128
+ * @returns {Promise<InitOutput>}
129
+ */
130
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/quai_wasm.js ADDED
@@ -0,0 +1,493 @@
1
+ /* @ts-self-types="./quai_wasm.d.ts" */
2
+
3
+ export class QuaiSession {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(QuaiSession.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ QuaiSessionFinalization.register(obj, obj.__wbg_ptr, obj);
8
+ return obj;
9
+ }
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ QuaiSessionFinalization.unregister(this);
14
+ return ptr;
15
+ }
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_quaisession_free(ptr, 0);
19
+ }
20
+ /**
21
+ * The macro table (`def &1: …;` lines), for a history panel.
22
+ * @returns {string}
23
+ */
24
+ history() {
25
+ let deferred1_0;
26
+ let deferred1_1;
27
+ try {
28
+ const ret = wasm.quaisession_history(this.__wbg_ptr);
29
+ deferred1_0 = ret[0];
30
+ deferred1_1 = ret[1];
31
+ return getStringFromWasm0(ret[0], ret[1]);
32
+ } finally {
33
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
34
+ }
35
+ }
36
+ /**
37
+ * The `&N` a fresh line will claim.
38
+ * @returns {number}
39
+ */
40
+ get line() {
41
+ const ret = wasm.quaisession_line(this.__wbg_ptr);
42
+ return ret >>> 0;
43
+ }
44
+ /**
45
+ * Open a session over *several* documents mounted as named
46
+ * children of one root, so a single query — including a `<=>`
47
+ * join — spans them all (`/name/...` paths). `sources_json` is a
48
+ * JSON array of `{"name", "format", "text"}` objects — or, for
49
+ * binary sources (an uploaded `.db`), `{"name", "format":
50
+ * "sqlite", "bytes_b64"}`. Names must be distinct. A single
51
+ * source mounts at the root, path-bare, exactly as the
52
+ * one-document constructor does.
53
+ * @param {string} sources_json
54
+ * @param {number} now_millis
55
+ * @returns {QuaiSession}
56
+ */
57
+ static mount(sources_json, now_millis) {
58
+ const ptr0 = passStringToWasm0(sources_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
59
+ const len0 = WASM_VECTOR_LEN;
60
+ const ret = wasm.quaisession_mount(ptr0, len0, now_millis);
61
+ if (ret[2]) {
62
+ throw takeFromExternrefTable0(ret[1]);
63
+ }
64
+ return QuaiSession.__wrap(ret[0]);
65
+ }
66
+ /**
67
+ * Open a session over `input` parsed as `format` (json, yaml,
68
+ * toml, csv, tsv, xml, html, markdown). `now_millis` pins the
69
+ * session's `now()` (pass `Date.now()`).
70
+ * @param {string} format
71
+ * @param {string} input
72
+ * @param {number} now_millis
73
+ */
74
+ constructor(format, input, now_millis) {
75
+ const ptr0 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
76
+ const len0 = WASM_VECTOR_LEN;
77
+ const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
+ const len1 = WASM_VECTOR_LEN;
79
+ const ret = wasm.quaisession_new(ptr0, len0, ptr1, len1, now_millis);
80
+ if (ret[2]) {
81
+ throw takeFromExternrefTable0(ret[1]);
82
+ }
83
+ this.__wbg_ptr = ret[0];
84
+ QuaiSessionFinalization.register(this, this.__wbg_ptr, this);
85
+ return this;
86
+ }
87
+ /**
88
+ * Clear the history and restart numbering.
89
+ */
90
+ reset() {
91
+ wasm.quaisession_reset(this.__wbg_ptr);
92
+ }
93
+ /**
94
+ * Restore a persisted state (from localStorage).
95
+ * @param {string} state_json
96
+ */
97
+ restore(state_json) {
98
+ const ptr0 = passStringToWasm0(state_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
99
+ const len0 = WASM_VECTOR_LEN;
100
+ wasm.quaisession_restore(this.__wbg_ptr, ptr0, len0);
101
+ }
102
+ /**
103
+ * Run one input line, returning a JSON envelope (label, lines,
104
+ * note, error). Mirrors the native REPL's dispatch: `def`/`macro`
105
+ * definitions, `&N#` frozen recall, `&N!` live re-read, and
106
+ * ordinary queries.
107
+ * @param {string} line
108
+ * @returns {string}
109
+ */
110
+ run(line) {
111
+ let deferred2_0;
112
+ let deferred2_1;
113
+ try {
114
+ const ptr0 = passStringToWasm0(line, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
115
+ const len0 = WASM_VECTOR_LEN;
116
+ const ret = wasm.quaisession_run(this.__wbg_ptr, ptr0, len0);
117
+ deferred2_0 = ret[0];
118
+ deferred2_1 = ret[1];
119
+ return getStringFromWasm0(ret[0], ret[1]);
120
+ } finally {
121
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
122
+ }
123
+ }
124
+ /**
125
+ * Run one notebook-shaped cell, mirroring the Quarb kernel: a
126
+ * defs-only cell (allowing `#` comment lines) extends the macro
127
+ * table; anything else runs whole as a query — newlines are
128
+ * whitespace to the engine, and a cell may carry inline `def`s
129
+ * ahead of its query (the pivot-macro shape).
130
+ * @param {string} text
131
+ * @returns {string}
132
+ */
133
+ run_cell(text) {
134
+ let deferred2_0;
135
+ let deferred2_1;
136
+ try {
137
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ const len0 = WASM_VECTOR_LEN;
139
+ const ret = wasm.quaisession_run_cell(this.__wbg_ptr, ptr0, len0);
140
+ deferred2_0 = ret[0];
141
+ deferred2_1 = ret[1];
142
+ return getStringFromWasm0(ret[0], ret[1]);
143
+ } finally {
144
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
145
+ }
146
+ }
147
+ /**
148
+ * Serialize the durable state for localStorage.
149
+ * @returns {string}
150
+ */
151
+ state() {
152
+ let deferred1_0;
153
+ let deferred1_1;
154
+ try {
155
+ const ret = wasm.quaisession_state(this.__wbg_ptr);
156
+ deferred1_0 = ret[0];
157
+ deferred1_1 = ret[1];
158
+ return getStringFromWasm0(ret[0], ret[1]);
159
+ } finally {
160
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
161
+ }
162
+ }
163
+ }
164
+ if (Symbol.dispose) QuaiSession.prototype[Symbol.dispose] = QuaiSession.prototype.free;
165
+
166
+ /**
167
+ * Highlight a query as HTML `<span class="qh-…">` markup — the same
168
+ * token model as the terminal (`highlight_ansi`) and the JupyterLab
169
+ * CodeMirror extension. The playground uses it to color the input
170
+ * line and the transcript echo.
171
+ * @param {string} query
172
+ * @returns {string}
173
+ */
174
+ export function highlight(query) {
175
+ let deferred2_0;
176
+ let deferred2_1;
177
+ try {
178
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
179
+ const len0 = WASM_VECTOR_LEN;
180
+ const ret = wasm.highlight(ptr0, len0);
181
+ deferred2_0 = ret[0];
182
+ deferred2_1 = ret[1];
183
+ return getStringFromWasm0(ret[0], ret[1]);
184
+ } finally {
185
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
186
+ }
187
+ }
188
+
189
+ /**
190
+ * The engine version string, for the playground footer.
191
+ * @returns {string}
192
+ */
193
+ export function version() {
194
+ let deferred1_0;
195
+ let deferred1_1;
196
+ try {
197
+ const ret = wasm.version();
198
+ deferred1_0 = ret[0];
199
+ deferred1_1 = ret[1];
200
+ return getStringFromWasm0(ret[0], ret[1]);
201
+ } finally {
202
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
203
+ }
204
+ }
205
+ function __wbg_get_imports() {
206
+ const import0 = {
207
+ __proto__: null,
208
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
209
+ const ret = Error(getStringFromWasm0(arg0, arg1));
210
+ return ret;
211
+ },
212
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
213
+ throw new Error(getStringFromWasm0(arg0, arg1));
214
+ },
215
+ __wbg_getDate_a1a40c1c5f40fe3b: function(arg0) {
216
+ const ret = arg0.getDate();
217
+ return ret;
218
+ },
219
+ __wbg_getDay_aa318cce5da74c49: function(arg0) {
220
+ const ret = arg0.getDay();
221
+ return ret;
222
+ },
223
+ __wbg_getFullYear_6af8b229792ae254: function(arg0) {
224
+ const ret = arg0.getFullYear();
225
+ return ret;
226
+ },
227
+ __wbg_getHours_9f6561095682ce51: function(arg0) {
228
+ const ret = arg0.getHours();
229
+ return ret;
230
+ },
231
+ __wbg_getMinutes_b0d5cd90bf9b8f22: function(arg0) {
232
+ const ret = arg0.getMinutes();
233
+ return ret;
234
+ },
235
+ __wbg_getMonth_fffe29d654d5eb69: function(arg0) {
236
+ const ret = arg0.getMonth();
237
+ return ret;
238
+ },
239
+ __wbg_getRandomValues_15134f5c0ae6b0d0: function() { return handleError(function (arg0, arg1) {
240
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
241
+ }, arguments); },
242
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
243
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
244
+ }, arguments); },
245
+ __wbg_getSeconds_40c565b3a6cb05fe: function(arg0) {
246
+ const ret = arg0.getSeconds();
247
+ return ret;
248
+ },
249
+ __wbg_getTime_d6f070c088c9b5ed: function(arg0) {
250
+ const ret = arg0.getTime();
251
+ return ret;
252
+ },
253
+ __wbg_getTimezoneOffset_dc9862c79e5a81a3: function(arg0) {
254
+ const ret = arg0.getTimezoneOffset();
255
+ return ret;
256
+ },
257
+ __wbg_new_0_3da9e97f24fc69be: function() {
258
+ const ret = new Date();
259
+ return ret;
260
+ },
261
+ __wbg_new_cc984128914cfc6f: function(arg0) {
262
+ const ret = new Date(arg0);
263
+ return ret;
264
+ },
265
+ __wbg_new_with_year_month_day_f2354b74b4b2a4f3: function(arg0, arg1, arg2) {
266
+ const ret = new Date(arg0 >>> 0, arg1, arg2);
267
+ return ret;
268
+ },
269
+ __wbg_random_039a7d5d06e0d333: function() {
270
+ const ret = Math.random();
271
+ return ret;
272
+ },
273
+ __wbindgen_cast_0000000000000001: function(arg0) {
274
+ // Cast intrinsic for `F64 -> Externref`.
275
+ const ret = arg0;
276
+ return ret;
277
+ },
278
+ __wbindgen_init_externref_table: function() {
279
+ const table = wasm.__wbindgen_externrefs;
280
+ const offset = table.grow(4);
281
+ table.set(0, undefined);
282
+ table.set(offset + 0, undefined);
283
+ table.set(offset + 1, null);
284
+ table.set(offset + 2, true);
285
+ table.set(offset + 3, false);
286
+ },
287
+ };
288
+ return {
289
+ __proto__: null,
290
+ "./quai_wasm_bg.js": import0,
291
+ };
292
+ }
293
+
294
+ const QuaiSessionFinalization = (typeof FinalizationRegistry === 'undefined')
295
+ ? { register: () => {}, unregister: () => {} }
296
+ : new FinalizationRegistry(ptr => wasm.__wbg_quaisession_free(ptr, 1));
297
+
298
+ function addToExternrefTable0(obj) {
299
+ const idx = wasm.__externref_table_alloc();
300
+ wasm.__wbindgen_externrefs.set(idx, obj);
301
+ return idx;
302
+ }
303
+
304
+ function getArrayU8FromWasm0(ptr, len) {
305
+ ptr = ptr >>> 0;
306
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
307
+ }
308
+
309
+ function getStringFromWasm0(ptr, len) {
310
+ return decodeText(ptr >>> 0, len);
311
+ }
312
+
313
+ let cachedUint8ArrayMemory0 = null;
314
+ function getUint8ArrayMemory0() {
315
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
316
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
317
+ }
318
+ return cachedUint8ArrayMemory0;
319
+ }
320
+
321
+ function handleError(f, args) {
322
+ try {
323
+ return f.apply(this, args);
324
+ } catch (e) {
325
+ const idx = addToExternrefTable0(e);
326
+ wasm.__wbindgen_exn_store(idx);
327
+ }
328
+ }
329
+
330
+ function passStringToWasm0(arg, malloc, realloc) {
331
+ if (realloc === undefined) {
332
+ const buf = cachedTextEncoder.encode(arg);
333
+ const ptr = malloc(buf.length, 1) >>> 0;
334
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
335
+ WASM_VECTOR_LEN = buf.length;
336
+ return ptr;
337
+ }
338
+
339
+ let len = arg.length;
340
+ let ptr = malloc(len, 1) >>> 0;
341
+
342
+ const mem = getUint8ArrayMemory0();
343
+
344
+ let offset = 0;
345
+
346
+ for (; offset < len; offset++) {
347
+ const code = arg.charCodeAt(offset);
348
+ if (code > 0x7F) break;
349
+ mem[ptr + offset] = code;
350
+ }
351
+ if (offset !== len) {
352
+ if (offset !== 0) {
353
+ arg = arg.slice(offset);
354
+ }
355
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
356
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
357
+ const ret = cachedTextEncoder.encodeInto(arg, view);
358
+
359
+ offset += ret.written;
360
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
361
+ }
362
+
363
+ WASM_VECTOR_LEN = offset;
364
+ return ptr;
365
+ }
366
+
367
+ function takeFromExternrefTable0(idx) {
368
+ const value = wasm.__wbindgen_externrefs.get(idx);
369
+ wasm.__externref_table_dealloc(idx);
370
+ return value;
371
+ }
372
+
373
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
374
+ cachedTextDecoder.decode();
375
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
376
+ let numBytesDecoded = 0;
377
+ function decodeText(ptr, len) {
378
+ numBytesDecoded += len;
379
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
380
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
381
+ cachedTextDecoder.decode();
382
+ numBytesDecoded = len;
383
+ }
384
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
385
+ }
386
+
387
+ const cachedTextEncoder = new TextEncoder();
388
+
389
+ if (!('encodeInto' in cachedTextEncoder)) {
390
+ cachedTextEncoder.encodeInto = function (arg, view) {
391
+ const buf = cachedTextEncoder.encode(arg);
392
+ view.set(buf);
393
+ return {
394
+ read: arg.length,
395
+ written: buf.length
396
+ };
397
+ };
398
+ }
399
+
400
+ let WASM_VECTOR_LEN = 0;
401
+
402
+ let wasmModule, wasmInstance, wasm;
403
+ function __wbg_finalize_init(instance, module) {
404
+ wasmInstance = instance;
405
+ wasm = instance.exports;
406
+ wasmModule = module;
407
+ cachedUint8ArrayMemory0 = null;
408
+ wasm.__wbindgen_start();
409
+ return wasm;
410
+ }
411
+
412
+ async function __wbg_load(module, imports) {
413
+ if (typeof Response === 'function' && module instanceof Response) {
414
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
415
+ try {
416
+ return await WebAssembly.instantiateStreaming(module, imports);
417
+ } catch (e) {
418
+ const validResponse = module.ok && expectedResponseType(module.type);
419
+
420
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
421
+ 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);
422
+
423
+ } else { throw e; }
424
+ }
425
+ }
426
+
427
+ const bytes = await module.arrayBuffer();
428
+ return await WebAssembly.instantiate(bytes, imports);
429
+ } else {
430
+ const instance = await WebAssembly.instantiate(module, imports);
431
+
432
+ if (instance instanceof WebAssembly.Instance) {
433
+ return { instance, module };
434
+ } else {
435
+ return instance;
436
+ }
437
+ }
438
+
439
+ function expectedResponseType(type) {
440
+ switch (type) {
441
+ case 'basic': case 'cors': case 'default': return true;
442
+ }
443
+ return false;
444
+ }
445
+ }
446
+
447
+ function initSync(module) {
448
+ if (wasm !== undefined) return wasm;
449
+
450
+
451
+ if (module !== undefined) {
452
+ if (Object.getPrototypeOf(module) === Object.prototype) {
453
+ ({module} = module)
454
+ } else {
455
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
456
+ }
457
+ }
458
+
459
+ const imports = __wbg_get_imports();
460
+ if (!(module instanceof WebAssembly.Module)) {
461
+ module = new WebAssembly.Module(module);
462
+ }
463
+ const instance = new WebAssembly.Instance(module, imports);
464
+ return __wbg_finalize_init(instance, module);
465
+ }
466
+
467
+ async function __wbg_init(module_or_path) {
468
+ if (wasm !== undefined) return wasm;
469
+
470
+
471
+ if (module_or_path !== undefined) {
472
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
473
+ ({module_or_path} = module_or_path)
474
+ } else {
475
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
476
+ }
477
+ }
478
+
479
+ if (module_or_path === undefined) {
480
+ module_or_path = new URL('quai_wasm_bg.wasm', import.meta.url);
481
+ }
482
+ const imports = __wbg_get_imports();
483
+
484
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
485
+ module_or_path = fetch(module_or_path);
486
+ }
487
+
488
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
489
+
490
+ return __wbg_finalize_init(instance, module);
491
+ }
492
+
493
+ export { initSync, __wbg_init as default };
Binary file
@@ -0,0 +1,52 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Execute `query` against `input` parsed as `format`
6
+ * (json | yaml | toml | csv | tsv | xml | html | markdown).
7
+ * `now_millis` is the invocation instant for `now()`, as from
8
+ * `Date.now()`. Returns a JSON envelope; never throws.
9
+ */
10
+ export function run(format: string, input: string, query: string, now_millis: number): string;
11
+
12
+ /**
13
+ * The engine version shown in the playground footer.
14
+ */
15
+ export function version(): string;
16
+
17
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
18
+
19
+ export interface InitOutput {
20
+ readonly memory: WebAssembly.Memory;
21
+ readonly run: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
22
+ readonly version: () => [number, number];
23
+ readonly __wbindgen_exn_store: (a: number) => void;
24
+ readonly __externref_table_alloc: () => number;
25
+ readonly __wbindgen_externrefs: WebAssembly.Table;
26
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
27
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
29
+ readonly __wbindgen_start: () => void;
30
+ }
31
+
32
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
33
+
34
+ /**
35
+ * Instantiates the given `module`, which can either be bytes or
36
+ * a precompiled `WebAssembly.Module`.
37
+ *
38
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
39
+ *
40
+ * @returns {InitOutput}
41
+ */
42
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
43
+
44
+ /**
45
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
46
+ * for everything else, calls `WebAssembly.instantiate` directly.
47
+ *
48
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
49
+ *
50
+ * @returns {Promise<InitOutput>}
51
+ */
52
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;