@rainlanguage/sqlite-web 0.0.2 → 0.0.4

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/sqlite_web.js CHANGED
@@ -1,137 +1,613 @@
1
- let wasm;
1
+ /* @ts-self-types="./sqlite_web.d.ts" */
2
2
 
3
- let WASM_VECTOR_LEN = 0;
4
-
5
- let cachedUint8ArrayMemory0 = null;
6
-
7
- function getUint8ArrayMemory0() {
8
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
9
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
3
+ export class SQLiteWasmDatabase {
4
+ static __wrap(ptr) {
5
+ const obj = Object.create(SQLiteWasmDatabase.prototype);
6
+ obj.__wbg_ptr = ptr;
7
+ SQLiteWasmDatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
8
+ return obj;
10
9
  }
11
- return cachedUint8ArrayMemory0;
12
- }
13
-
14
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
15
-
16
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
17
- ? function (arg, view) {
18
- return cachedTextEncoder.encodeInto(arg, view);
19
- }
20
- : function (arg, view) {
21
- const buf = cachedTextEncoder.encode(arg);
22
- view.set(buf);
23
- return {
24
- read: arg.length,
25
- written: buf.length
26
- };
27
- });
28
-
29
- function passStringToWasm0(arg, malloc, realloc) {
30
-
31
- if (realloc === undefined) {
32
- const buf = cachedTextEncoder.encode(arg);
33
- const ptr = malloc(buf.length, 1) >>> 0;
34
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
35
- WASM_VECTOR_LEN = buf.length;
10
+ __destroy_into_raw() {
11
+ const ptr = this.__wbg_ptr;
12
+ this.__wbg_ptr = 0;
13
+ SQLiteWasmDatabaseFinalization.unregister(this);
36
14
  return ptr;
37
15
  }
38
-
39
- let len = arg.length;
40
- let ptr = malloc(len, 1) >>> 0;
41
-
42
- const mem = getUint8ArrayMemory0();
43
-
44
- let offset = 0;
45
-
46
- for (; offset < len; offset++) {
47
- const code = arg.charCodeAt(offset);
48
- if (code > 0x7F) break;
49
- mem[ptr + offset] = code;
16
+ free() {
17
+ const ptr = this.__destroy_into_raw();
18
+ wasm.__wbg_sqlitewasmdatabase_free(ptr, 0);
50
19
  }
51
-
52
- if (offset !== len) {
53
- if (offset !== 0) {
54
- arg = arg.slice(offset);
55
- }
56
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
57
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
58
- const ret = encodeString(arg, view);
59
-
60
- offset += ret.written;
61
- ptr = realloc(ptr, len, offset, 1) >>> 0;
20
+ /**
21
+ * Append up to 512 KiB of SQL text. Chunks may split a SQL statement,
22
+ * but must contain valid UTF-16 without splitting a surrogate pair.
23
+ * The dump's outer BEGIN/COMMIT statements are accepted but owned by the worker.
24
+ * @param {string} id
25
+ * @param {any} sql
26
+ * @returns {WasmEncodedResult<string>}
27
+ */
28
+ appendSqlDumpChunk(id, sql) {
29
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
30
+ const len0 = WASM_VECTOR_LEN;
31
+ const ret = wasm.sqlitewasmdatabase_appendSqlDumpChunk(this.__wbg_ptr, ptr0, len0, sql);
32
+ return ret;
33
+ }
34
+ /**
35
+ * Begin an atomic SQL dump import. Append bounded text chunks, then finish
36
+ * to commit. SQL validation/execution failures and cancellation roll back.
37
+ * Worker loss during finish can leave the commit outcome unknown, including
38
+ * when the coordinator returns an error; check or reset before retrying.
39
+ * @returns {WasmEncodedResult<string>}
40
+ */
41
+ beginSqlDumpImport() {
42
+ const ret = wasm.sqlitewasmdatabase_beginSqlDumpImport(this.__wbg_ptr);
43
+ return ret;
44
+ }
45
+ /**
46
+ * Roll back the active import.
47
+ * @param {string} id
48
+ * @returns {WasmEncodedResult<string>}
49
+ */
50
+ cancelSqlDumpImport(id) {
51
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
52
+ const len0 = WASM_VECTOR_LEN;
53
+ const ret = wasm.sqlitewasmdatabase_cancelSqlDumpImport(this.__wbg_ptr, ptr0, len0);
54
+ return ret;
55
+ }
56
+ /**
57
+ * Commit all imported statements. A partial trailing statement rolls back.
58
+ * @param {string} id
59
+ * @returns {WasmEncodedResult<string>}
60
+ */
61
+ finishSqlDumpImport(id) {
62
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
63
+ const len0 = WASM_VECTOR_LEN;
64
+ const ret = wasm.sqlitewasmdatabase_finishSqlDumpImport(this.__wbg_ptr, ptr0, len0);
65
+ return ret;
66
+ }
67
+ /**
68
+ * Create a new database connection with fully embedded worker
69
+ * @param {string} db_name
70
+ * @returns {WasmEncodedResult<SQLiteWasmDatabase>}
71
+ */
72
+ static new(db_name) {
73
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
74
+ const len0 = WASM_VECTOR_LEN;
75
+ const ret = wasm.sqlitewasmdatabase_new(ptr0, len0);
76
+ return ret;
77
+ }
78
+ /**
79
+ * Execute a SQL query (optionally parameterized via JS Array)
80
+ *
81
+ * Passing `undefined`/`null` from JS maps to `None`.
82
+ * @param {string} sql
83
+ * @param {Array<any> | null} [params]
84
+ * @returns {WasmEncodedResult<string>}
85
+ */
86
+ query(sql, params) {
87
+ const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
88
+ const len0 = WASM_VECTOR_LEN;
89
+ const ret = wasm.sqlitewasmdatabase_query(this.__wbg_ptr, ptr0, len0, isLikeNone(params) ? 0 : addToExternrefTable0(params));
90
+ return ret;
91
+ }
92
+ /**
93
+ * Execute a list of single SQL statements atomically as one worker job.
94
+ *
95
+ * Each item must be `{ sql: string, params?: Array }`. Do not include
96
+ * transaction-control statements; the worker owns the transaction.
97
+ * @param {Array<any>} statements
98
+ * @returns {WasmEncodedResult<string>}
99
+ */
100
+ transaction(statements) {
101
+ const ret = wasm.sqlitewasmdatabase_transaction(this.__wbg_ptr, statements);
102
+ return ret;
103
+ }
104
+ /**
105
+ * @returns {WasmEncodedResult<void>}
106
+ */
107
+ wipeAndRecreate() {
108
+ const ret = wasm.sqlitewasmdatabase_wipeAndRecreate(this.__wbg_ptr);
109
+ return ret;
62
110
  }
63
-
64
- WASM_VECTOR_LEN = offset;
65
- return ptr;
111
+ }
112
+ if (Symbol.dispose) SQLiteWasmDatabase.prototype[Symbol.dispose] = SQLiteWasmDatabase.prototype.free;
113
+ function __wbg_get_imports() {
114
+ const import0 = {
115
+ __proto__: null,
116
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
117
+ const ret = Error(getStringFromWasm0(arg0, arg1));
118
+ return ret;
119
+ },
120
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
121
+ const ret = String(arg1);
122
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
123
+ const len1 = WASM_VECTOR_LEN;
124
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
125
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
126
+ },
127
+ __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
128
+ const v = arg1;
129
+ const ret = typeof(v) === 'bigint' ? v : undefined;
130
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
131
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
132
+ },
133
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
134
+ const v = arg0;
135
+ const ret = typeof(v) === 'boolean' ? v : undefined;
136
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
137
+ },
138
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
139
+ const ret = debugString(arg1);
140
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
141
+ const len1 = WASM_VECTOR_LEN;
142
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
143
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
144
+ },
145
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
146
+ const ret = arg0 in arg1;
147
+ return ret;
148
+ },
149
+ __wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
150
+ const ret = typeof(arg0) === 'bigint';
151
+ return ret;
152
+ },
153
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
154
+ const ret = typeof(arg0) === 'function';
155
+ return ret;
156
+ },
157
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
158
+ const ret = arg0 === null;
159
+ return ret;
160
+ },
161
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
162
+ const val = arg0;
163
+ const ret = typeof(val) === 'object' && val !== null;
164
+ return ret;
165
+ },
166
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
167
+ const ret = typeof(arg0) === 'string';
168
+ return ret;
169
+ },
170
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
171
+ const ret = arg0 === undefined;
172
+ return ret;
173
+ },
174
+ __wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
175
+ const ret = arg0 === arg1;
176
+ return ret;
177
+ },
178
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
179
+ const ret = arg0 == arg1;
180
+ return ret;
181
+ },
182
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
183
+ const obj = arg1;
184
+ const ret = typeof(obj) === 'number' ? obj : undefined;
185
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
186
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
187
+ },
188
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
189
+ const obj = arg1;
190
+ const ret = typeof(obj) === 'string' ? obj : undefined;
191
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
192
+ var len1 = WASM_VECTOR_LEN;
193
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
194
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
195
+ },
196
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
197
+ throw new Error(getStringFromWasm0(arg0, arg1));
198
+ },
199
+ __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
200
+ arg0._wbg_cb_unref();
201
+ },
202
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
203
+ const ret = arg0.call(arg1);
204
+ return ret;
205
+ }, arguments); },
206
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
207
+ const ret = arg0.call(arg1, arg2);
208
+ return ret;
209
+ }, arguments); },
210
+ __wbg_createObjectURL_416e527781e6fd6d: function() { return handleError(function (arg0, arg1) {
211
+ const ret = URL.createObjectURL(arg1);
212
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
+ const len1 = WASM_VECTOR_LEN;
214
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
215
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
216
+ }, arguments); },
217
+ __wbg_data_328de4280640da92: function(arg0) {
218
+ const ret = arg0.data;
219
+ return ret;
220
+ },
221
+ __wbg_done_89b2b13e91a60321: function(arg0) {
222
+ const ret = arg0.done;
223
+ return ret;
224
+ },
225
+ __wbg_entries_015dc610cd81ede0: function(arg0) {
226
+ const ret = Object.entries(arg0);
227
+ return ret;
228
+ },
229
+ __wbg_entries_3d99c52a47728e2f: function(arg0) {
230
+ const ret = arg0.entries();
231
+ return ret;
232
+ },
233
+ __wbg_getDirectoryHandle_cf175faf1a75a384: function(arg0, arg1, arg2, arg3) {
234
+ const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
235
+ return ret;
236
+ },
237
+ __wbg_getDirectory_389283588dfb8117: function(arg0) {
238
+ const ret = arg0.getDirectory();
239
+ return ret;
240
+ },
241
+ __wbg_get_507a50627bffa49b: function(arg0, arg1) {
242
+ const ret = arg0[arg1 >>> 0];
243
+ return ret;
244
+ },
245
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
246
+ const ret = Reflect.get(arg0, arg1);
247
+ return ret;
248
+ }, arguments); },
249
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
250
+ const ret = Reflect.get(arg0, arg1);
251
+ return ret;
252
+ }, arguments); },
253
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
254
+ const ret = arg0[arg1 >>> 0];
255
+ return ret;
256
+ },
257
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
258
+ let result;
259
+ try {
260
+ result = arg0 instanceof ArrayBuffer;
261
+ } catch (_) {
262
+ result = false;
263
+ }
264
+ const ret = result;
265
+ return ret;
266
+ },
267
+ __wbg_instanceof_DomException_952faa8037702c00: function(arg0) {
268
+ let result;
269
+ try {
270
+ result = arg0 instanceof DOMException;
271
+ } catch (_) {
272
+ result = false;
273
+ }
274
+ const ret = result;
275
+ return ret;
276
+ },
277
+ __wbg_instanceof_FileSystemDirectoryHandle_c9ab7c5cdb7a7c30: function(arg0) {
278
+ let result;
279
+ try {
280
+ result = arg0 instanceof FileSystemDirectoryHandle;
281
+ } catch (_) {
282
+ result = false;
283
+ }
284
+ const ret = result;
285
+ return ret;
286
+ },
287
+ __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
288
+ let result;
289
+ try {
290
+ result = arg0 instanceof Map;
291
+ } catch (_) {
292
+ result = false;
293
+ }
294
+ const ret = result;
295
+ return ret;
296
+ },
297
+ __wbg_instanceof_Navigator_51c4c7741403f34f: function(arg0) {
298
+ let result;
299
+ try {
300
+ result = arg0 instanceof Navigator;
301
+ } catch (_) {
302
+ result = false;
303
+ }
304
+ const ret = result;
305
+ return ret;
306
+ },
307
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
308
+ let result;
309
+ try {
310
+ result = arg0 instanceof Uint8Array;
311
+ } catch (_) {
312
+ result = false;
313
+ }
314
+ const ret = result;
315
+ return ret;
316
+ },
317
+ __wbg_instanceof_Window_05ba1ee4f6781663: function(arg0) {
318
+ let result;
319
+ try {
320
+ result = arg0 instanceof Window;
321
+ } catch (_) {
322
+ result = false;
323
+ }
324
+ const ret = result;
325
+ return ret;
326
+ },
327
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
328
+ const ret = Array.isArray(arg0);
329
+ return ret;
330
+ },
331
+ __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
332
+ const ret = Number.isSafeInteger(arg0);
333
+ return ret;
334
+ },
335
+ __wbg_iterator_6f722e4a93058b71: function() {
336
+ const ret = Symbol.iterator;
337
+ return ret;
338
+ },
339
+ __wbg_length_02c64e687322fa34: function(arg0) {
340
+ const ret = arg0.length;
341
+ return ret;
342
+ },
343
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
344
+ const ret = arg0.length;
345
+ return ret;
346
+ },
347
+ __wbg_length_370319915dc99107: function(arg0) {
348
+ const ret = arg0.length;
349
+ return ret;
350
+ },
351
+ __wbg_name_9d2bcd24d4433cef: function(arg0, arg1) {
352
+ const ret = arg1.name;
353
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
354
+ const len1 = WASM_VECTOR_LEN;
355
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
356
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
357
+ },
358
+ __wbg_navigator_99621db14b3f1099: function(arg0) {
359
+ const ret = arg0.navigator;
360
+ return ret;
361
+ },
362
+ __wbg_new_2b7eedd63d35ebab: function(arg0, arg1) {
363
+ const ret = new RegExp(getStringFromWasm0(arg0, arg1));
364
+ return ret;
365
+ },
366
+ __wbg_new_32b398fb48b6d94a: function() {
367
+ const ret = new Array();
368
+ return ret;
369
+ },
370
+ __wbg_new_8f0c2d11e48a4727: function() { return handleError(function (arg0, arg1) {
371
+ const ret = new Worker(getStringFromWasm0(arg0, arg1));
372
+ return ret;
373
+ }, arguments); },
374
+ __wbg_new_aec3e25493d729fe: function(arg0, arg1) {
375
+ try {
376
+ var state0 = {a: arg0, b: arg1};
377
+ var cb0 = (arg0, arg1) => {
378
+ const a = state0.a;
379
+ state0.a = 0;
380
+ try {
381
+ return wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(a, state0.b, arg0, arg1);
382
+ } finally {
383
+ state0.a = a;
384
+ }
385
+ };
386
+ const ret = new Promise(cb0);
387
+ return ret;
388
+ } finally {
389
+ state0.a = 0;
390
+ }
391
+ },
392
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
393
+ const ret = new Uint8Array(arg0);
394
+ return ret;
395
+ },
396
+ __wbg_new_da52cf8fe3429cb2: function() {
397
+ const ret = new Object();
398
+ return ret;
399
+ },
400
+ __wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
401
+ try {
402
+ var state0 = {a: arg0, b: arg1};
403
+ var cb0 = (arg0, arg1) => {
404
+ const a = state0.a;
405
+ state0.a = 0;
406
+ try {
407
+ return wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(a, state0.b, arg0, arg1);
408
+ } finally {
409
+ state0.a = a;
410
+ }
411
+ };
412
+ const ret = new Promise(cb0);
413
+ return ret;
414
+ } finally {
415
+ state0.a = 0;
416
+ }
417
+ },
418
+ __wbg_new_with_str_sequence_and_options_9db076dc44ddbeb0: function() { return handleError(function (arg0, arg1) {
419
+ const ret = new Blob(arg0, arg1);
420
+ return ret;
421
+ }, arguments); },
422
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
423
+ const ret = arg0.next;
424
+ return ret;
425
+ },
426
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
427
+ const ret = arg0.next();
428
+ return ret;
429
+ }, arguments); },
430
+ __wbg_postMessage_56396682c54d5757: function() { return handleError(function (arg0, arg1) {
431
+ arg0.postMessage(arg1);
432
+ }, arguments); },
433
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
434
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
435
+ },
436
+ __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
437
+ const ret = arg0.push(arg1);
438
+ return ret;
439
+ },
440
+ __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
441
+ const ret = arg0.queueMicrotask;
442
+ return ret;
443
+ },
444
+ __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
445
+ queueMicrotask(arg0);
446
+ },
447
+ __wbg_removeEntry_6716e344f14ec77f: function(arg0, arg1, arg2, arg3) {
448
+ const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
449
+ return ret;
450
+ },
451
+ __wbg_resolve_2191a4dfe481c25b: function(arg0) {
452
+ const ret = Promise.resolve(arg0);
453
+ return ret;
454
+ },
455
+ __wbg_revokeObjectURL_e010fb0b45f93f3f: function() { return handleError(function (arg0, arg1) {
456
+ URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
457
+ }, arguments); },
458
+ __wbg_setTimeout_cfa2cf195c3738db: function() { return handleError(function (arg0, arg1, arg2) {
459
+ const ret = arg0.setTimeout(arg1, arg2);
460
+ return ret;
461
+ }, arguments); },
462
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
463
+ arg0[arg1] = arg2;
464
+ },
465
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
466
+ const ret = Reflect.set(arg0, arg1, arg2);
467
+ return ret;
468
+ }, arguments); },
469
+ __wbg_set_create_fa1dfa475fac91e9: function(arg0, arg1) {
470
+ arg0.create = arg1 !== 0;
471
+ },
472
+ __wbg_set_onmessage_57d6a01ac0bfd3a3: function(arg0, arg1) {
473
+ arg0.onmessage = arg1;
474
+ },
475
+ __wbg_set_recursive_a4f915c7492b89e8: function(arg0, arg1) {
476
+ arg0.recursive = arg1 !== 0;
477
+ },
478
+ __wbg_set_type_8ce203e412e28cf6: function(arg0, arg1, arg2) {
479
+ arg0.type = getStringFromWasm0(arg1, arg2);
480
+ },
481
+ __wbg_sqlitewasmdatabase_new: function(arg0) {
482
+ const ret = SQLiteWasmDatabase.__wrap(arg0);
483
+ return ret;
484
+ },
485
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
486
+ const ret = typeof global === 'undefined' ? null : global;
487
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
488
+ },
489
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
490
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
491
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
492
+ },
493
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
494
+ const ret = typeof self === 'undefined' ? null : self;
495
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
496
+ },
497
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
498
+ const ret = typeof window === 'undefined' ? null : window;
499
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
500
+ },
501
+ __wbg_storage_756400487605531a: function(arg0) {
502
+ const ret = arg0.storage;
503
+ return ret;
504
+ },
505
+ __wbg_terminate_13d19661bbbf7d2b: function(arg0) {
506
+ arg0.terminate();
507
+ },
508
+ __wbg_test_60ff07719dbfcda2: function(arg0, arg1) {
509
+ const ret = arg0.test(arg1);
510
+ return ret;
511
+ },
512
+ __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
513
+ const ret = arg0.then(arg1, arg2);
514
+ return ret;
515
+ },
516
+ __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
517
+ const ret = arg0.then(arg1);
518
+ return ret;
519
+ },
520
+ __wbg_toString_34387d7c1df9ca1e: function() { return handleError(function (arg0, arg1) {
521
+ const ret = arg0.toString(arg1);
522
+ return ret;
523
+ }, arguments); },
524
+ __wbg_value_a5d5488a9589444a: function(arg0) {
525
+ const ret = arg0.value;
526
+ return ret;
527
+ },
528
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
529
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 32, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
530
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7);
531
+ return ret;
532
+ },
533
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
534
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 55, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
535
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50);
536
+ return ret;
537
+ },
538
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
539
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 53, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
540
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364);
541
+ return ret;
542
+ },
543
+ __wbindgen_cast_0000000000000004: function(arg0) {
544
+ // Cast intrinsic for `F64 -> Externref`.
545
+ const ret = arg0;
546
+ return ret;
547
+ },
548
+ __wbindgen_cast_0000000000000005: function(arg0) {
549
+ // Cast intrinsic for `I64 -> Externref`.
550
+ const ret = arg0;
551
+ return ret;
552
+ },
553
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
554
+ // Cast intrinsic for `Ref(String) -> Externref`.
555
+ const ret = getStringFromWasm0(arg0, arg1);
556
+ return ret;
557
+ },
558
+ __wbindgen_cast_0000000000000007: function(arg0) {
559
+ // Cast intrinsic for `U64 -> Externref`.
560
+ const ret = BigInt.asUintN(64, arg0);
561
+ return ret;
562
+ },
563
+ __wbindgen_init_externref_table: function() {
564
+ const table = wasm.__wbindgen_externrefs;
565
+ const offset = table.grow(4);
566
+ table.set(0, undefined);
567
+ table.set(offset + 0, undefined);
568
+ table.set(offset + 1, null);
569
+ table.set(offset + 2, true);
570
+ table.set(offset + 3, false);
571
+ },
572
+ };
573
+ return {
574
+ __proto__: null,
575
+ "./sqlite_web_bg.js": import0,
576
+ };
66
577
  }
67
578
 
68
- let cachedDataViewMemory0 = null;
69
-
70
- function getDataViewMemory0() {
71
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
72
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
73
- }
74
- return cachedDataViewMemory0;
579
+ function wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364(arg0, arg1) {
580
+ wasm.wasm_bindgen__convert__closures_____invoke__h78dad3b4b0b34364(arg0, arg1);
75
581
  }
76
582
 
77
- function addToExternrefTable0(obj) {
78
- const idx = wasm.__externref_table_alloc();
79
- wasm.__wbindgen_export_4.set(idx, obj);
80
- return idx;
583
+ function wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50(arg0, arg1, arg2) {
584
+ wasm.wasm_bindgen__convert__closures_____invoke__h27ec19c17abe8f50(arg0, arg1, arg2);
81
585
  }
82
586
 
83
- function handleError(f, args) {
84
- try {
85
- return f.apply(this, args);
86
- } catch (e) {
87
- const idx = addToExternrefTable0(e);
88
- wasm.__wbindgen_exn_store(idx);
587
+ function wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7(arg0, arg1, arg2) {
588
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h662cc5297105c4a7(arg0, arg1, arg2);
589
+ if (ret[1]) {
590
+ throw takeFromExternrefTable0(ret[0]);
89
591
  }
90
592
  }
91
593
 
92
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
93
-
94
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
95
-
96
- function getStringFromWasm0(ptr, len) {
97
- ptr = ptr >>> 0;
98
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
594
+ function wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(arg0, arg1, arg2, arg3) {
595
+ wasm.wasm_bindgen__convert__closures_____invoke__h3fea4067346f5309(arg0, arg1, arg2, arg3);
99
596
  }
100
597
 
101
- function isLikeNone(x) {
102
- return x === undefined || x === null;
598
+ const SQLiteWasmDatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
599
+ ? { register: () => {}, unregister: () => {} }
600
+ : new FinalizationRegistry(ptr => wasm.__wbg_sqlitewasmdatabase_free(ptr, 1));
601
+
602
+ function addToExternrefTable0(obj) {
603
+ const idx = wasm.__externref_table_alloc();
604
+ wasm.__wbindgen_externrefs.set(idx, obj);
605
+ return idx;
103
606
  }
104
607
 
105
608
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
106
609
  ? { register: () => {}, unregister: () => {} }
107
- : new FinalizationRegistry(state => {
108
- wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b)
109
- });
110
-
111
- function makeMutClosure(arg0, arg1, dtor, f) {
112
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
113
- const real = (...args) => {
114
- // First up with a closure we increment the internal reference
115
- // count. This ensures that the Rust closure environment won't
116
- // be deallocated while we're invoking it.
117
- state.cnt++;
118
- const a = state.a;
119
- state.a = 0;
120
- try {
121
- return f(a, state.b, ...args);
122
- } finally {
123
- if (--state.cnt === 0) {
124
- wasm.__wbindgen_export_5.get(state.dtor)(a, state.b);
125
- CLOSURE_DTORS.unregister(state);
126
- } else {
127
- state.a = a;
128
- }
129
- }
130
- };
131
- real.original = state;
132
- CLOSURE_DTORS.register(real, state, state);
133
- return real;
134
- }
610
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
135
611
 
136
612
  function debugString(val) {
137
613
  // primitive types
@@ -197,71 +673,154 @@ function debugString(val) {
197
673
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
674
  return className;
199
675
  }
200
- function __wbg_adapter_50(arg0, arg1, arg2) {
201
- wasm.closure37_externref_shim(arg0, arg1, arg2);
202
- }
203
676
 
204
- function __wbg_adapter_91(arg0, arg1, arg2, arg3) {
205
- wasm.closure21_externref_shim(arg0, arg1, arg2, arg3);
677
+ function getArrayU8FromWasm0(ptr, len) {
678
+ ptr = ptr >>> 0;
679
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
206
680
  }
207
681
 
208
- const SQLiteWasmDatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
209
- ? { register: () => {}, unregister: () => {} }
210
- : new FinalizationRegistry(ptr => wasm.__wbg_sqlitewasmdatabase_free(ptr >>> 0, 1));
682
+ let cachedDataViewMemory0 = null;
683
+ function getDataViewMemory0() {
684
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
685
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
686
+ }
687
+ return cachedDataViewMemory0;
688
+ }
211
689
 
212
- export class SQLiteWasmDatabase {
690
+ function getStringFromWasm0(ptr, len) {
691
+ return decodeText(ptr >>> 0, len);
692
+ }
213
693
 
214
- static __wrap(ptr) {
215
- ptr = ptr >>> 0;
216
- const obj = Object.create(SQLiteWasmDatabase.prototype);
217
- obj.__wbg_ptr = ptr;
218
- SQLiteWasmDatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
219
- return obj;
694
+ let cachedUint8ArrayMemory0 = null;
695
+ function getUint8ArrayMemory0() {
696
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
697
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
220
698
  }
699
+ return cachedUint8ArrayMemory0;
700
+ }
221
701
 
222
- __destroy_into_raw() {
223
- const ptr = this.__wbg_ptr;
224
- this.__wbg_ptr = 0;
225
- SQLiteWasmDatabaseFinalization.unregister(this);
226
- return ptr;
702
+ function handleError(f, args) {
703
+ try {
704
+ return f.apply(this, args);
705
+ } catch (e) {
706
+ const idx = addToExternrefTable0(e);
707
+ wasm.__wbindgen_exn_store(idx);
227
708
  }
709
+ }
228
710
 
229
- free() {
230
- const ptr = this.__destroy_into_raw();
231
- wasm.__wbg_sqlitewasmdatabase_free(ptr, 0);
711
+ function isLikeNone(x) {
712
+ return x === undefined || x === null;
713
+ }
714
+
715
+ function makeMutClosure(arg0, arg1, f) {
716
+ const state = { a: arg0, b: arg1, cnt: 1 };
717
+ const real = (...args) => {
718
+
719
+ // First up with a closure we increment the internal reference
720
+ // count. This ensures that the Rust closure environment won't
721
+ // be deallocated while we're invoking it.
722
+ state.cnt++;
723
+ const a = state.a;
724
+ state.a = 0;
725
+ try {
726
+ return f(a, state.b, ...args);
727
+ } finally {
728
+ state.a = a;
729
+ real._wbg_cb_unref();
730
+ }
731
+ };
732
+ real._wbg_cb_unref = () => {
733
+ if (--state.cnt === 0) {
734
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
735
+ state.a = 0;
736
+ CLOSURE_DTORS.unregister(state);
737
+ }
738
+ };
739
+ CLOSURE_DTORS.register(real, state, state);
740
+ return real;
741
+ }
742
+
743
+ function passStringToWasm0(arg, malloc, realloc) {
744
+ if (realloc === undefined) {
745
+ const buf = cachedTextEncoder.encode(arg);
746
+ const ptr = malloc(buf.length, 1) >>> 0;
747
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
748
+ WASM_VECTOR_LEN = buf.length;
749
+ return ptr;
232
750
  }
233
- /**
234
- * Create a new database connection with fully embedded worker
235
- * @param {string} db_name
236
- * @returns {WasmEncodedResult<SQLiteWasmDatabase>}
237
- */
238
- static new(db_name) {
239
- const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
- const len0 = WASM_VECTOR_LEN;
241
- const ret = wasm.sqlitewasmdatabase_new(ptr0, len0);
242
- return ret;
751
+
752
+ let len = arg.length;
753
+ let ptr = malloc(len, 1) >>> 0;
754
+
755
+ const mem = getUint8ArrayMemory0();
756
+
757
+ let offset = 0;
758
+
759
+ for (; offset < len; offset++) {
760
+ const code = arg.charCodeAt(offset);
761
+ if (code > 0x7F) break;
762
+ mem[ptr + offset] = code;
243
763
  }
244
- /**
245
- * Execute a SQL query (optionally parameterized via JS Array)
246
- *
247
- * Passing `undefined`/`null` from JS maps to `None`.
248
- * @param {string} sql
249
- * @param {Array<any> | null} [params]
250
- * @returns {WasmEncodedResult<string>}
251
- */
252
- query(sql, params) {
253
- const ptr0 = passStringToWasm0(sql, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.sqlitewasmdatabase_query(this.__wbg_ptr, ptr0, len0, isLikeNone(params) ? 0 : addToExternrefTable0(params));
256
- return ret;
764
+ if (offset !== len) {
765
+ if (offset !== 0) {
766
+ arg = arg.slice(offset);
767
+ }
768
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
769
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
770
+ const ret = cachedTextEncoder.encodeInto(arg, view);
771
+
772
+ offset += ret.written;
773
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
257
774
  }
258
- /**
259
- * @returns {WasmEncodedResult<void>}
260
- */
261
- wipeAndRecreate() {
262
- const ret = wasm.sqlitewasmdatabase_wipeAndRecreate(this.__wbg_ptr);
263
- return ret;
775
+
776
+ WASM_VECTOR_LEN = offset;
777
+ return ptr;
778
+ }
779
+
780
+ function takeFromExternrefTable0(idx) {
781
+ const value = wasm.__wbindgen_externrefs.get(idx);
782
+ wasm.__externref_table_dealloc(idx);
783
+ return value;
784
+ }
785
+
786
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
787
+ cachedTextDecoder.decode();
788
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
789
+ let numBytesDecoded = 0;
790
+ function decodeText(ptr, len) {
791
+ numBytesDecoded += len;
792
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
793
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
794
+ cachedTextDecoder.decode();
795
+ numBytesDecoded = len;
264
796
  }
797
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
798
+ }
799
+
800
+ const cachedTextEncoder = new TextEncoder();
801
+
802
+ if (!('encodeInto' in cachedTextEncoder)) {
803
+ cachedTextEncoder.encodeInto = function (arg, view) {
804
+ const buf = cachedTextEncoder.encode(arg);
805
+ view.set(buf);
806
+ return {
807
+ read: arg.length,
808
+ written: buf.length
809
+ };
810
+ };
811
+ }
812
+
813
+ let WASM_VECTOR_LEN = 0;
814
+
815
+ let wasmModule, wasmInstance, wasm;
816
+ function __wbg_finalize_init(instance, module) {
817
+ wasmInstance = instance;
818
+ wasm = instance.exports;
819
+ wasmModule = module;
820
+ cachedDataViewMemory0 = null;
821
+ cachedUint8ArrayMemory0 = null;
822
+ wasm.__wbindgen_start();
823
+ return wasm;
265
824
  }
266
825
 
267
826
  async function __wbg_load(module, imports) {
@@ -269,477 +828,41 @@ async function __wbg_load(module, imports) {
269
828
  if (typeof WebAssembly.instantiateStreaming === 'function') {
270
829
  try {
271
830
  return await WebAssembly.instantiateStreaming(module, imports);
272
-
273
831
  } catch (e) {
274
- if (module.headers.get('Content-Type') != 'application/wasm') {
832
+ const validResponse = module.ok && expectedResponseType(module.type);
833
+
834
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
275
835
  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);
276
836
 
277
- } else {
278
- throw e;
279
- }
837
+ } else { throw e; }
280
838
  }
281
839
  }
282
840
 
283
841
  const bytes = await module.arrayBuffer();
284
842
  return await WebAssembly.instantiate(bytes, imports);
285
-
286
843
  } else {
287
844
  const instance = await WebAssembly.instantiate(module, imports);
288
845
 
289
846
  if (instance instanceof WebAssembly.Instance) {
290
847
  return { instance, module };
291
-
292
848
  } else {
293
849
  return instance;
294
850
  }
295
851
  }
296
- }
297
852
 
298
- function __wbg_get_imports() {
299
- const imports = {};
300
- imports.wbg = {};
301
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
302
- const ret = String(arg1);
303
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
304
- const len1 = WASM_VECTOR_LEN;
305
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
306
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
307
- };
308
- imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
309
- const ret = arg0.buffer;
310
- return ret;
311
- };
312
- imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
313
- const ret = arg0.call(arg1);
314
- return ret;
315
- }, arguments) };
316
- imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
317
- const ret = arg0.call(arg1, arg2);
318
- return ret;
319
- }, arguments) };
320
- imports.wbg.__wbg_createObjectURL_6e98d2f9c7bd9764 = function() { return handleError(function (arg0, arg1) {
321
- const ret = URL.createObjectURL(arg1);
322
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
323
- const len1 = WASM_VECTOR_LEN;
324
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
325
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
326
- }, arguments) };
327
- imports.wbg.__wbg_data_432d9c3df2630942 = function(arg0) {
328
- const ret = arg0.data;
329
- return ret;
330
- };
331
- imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
332
- const ret = arg0.done;
333
- return ret;
334
- };
335
- imports.wbg.__wbg_entries_19efe296f7d36df9 = function(arg0) {
336
- const ret = arg0.entries();
337
- return ret;
338
- };
339
- imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
340
- const ret = Object.entries(arg0);
341
- return ret;
342
- };
343
- imports.wbg.__wbg_getDirectoryHandle_c48a138373d79b3d = function(arg0, arg1, arg2, arg3) {
344
- const ret = arg0.getDirectoryHandle(getStringFromWasm0(arg1, arg2), arg3);
345
- return ret;
346
- };
347
- imports.wbg.__wbg_getDirectory_c206b0540c9acc0f = function(arg0) {
348
- const ret = arg0.getDirectory();
349
- return ret;
350
- };
351
- imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
352
- const ret = Reflect.get(arg0, arg1);
353
- return ret;
354
- }, arguments) };
355
- imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
356
- const ret = arg0[arg1 >>> 0];
357
- return ret;
358
- };
359
- imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
360
- let result;
361
- try {
362
- result = arg0 instanceof ArrayBuffer;
363
- } catch (_) {
364
- result = false;
365
- }
366
- const ret = result;
367
- return ret;
368
- };
369
- imports.wbg.__wbg_instanceof_DomException_ed1ccb7aaf39034c = function(arg0) {
370
- let result;
371
- try {
372
- result = arg0 instanceof DOMException;
373
- } catch (_) {
374
- result = false;
375
- }
376
- const ret = result;
377
- return ret;
378
- };
379
- imports.wbg.__wbg_instanceof_FileSystemDirectoryHandle_0906fc139d75557b = function(arg0) {
380
- let result;
381
- try {
382
- result = arg0 instanceof FileSystemDirectoryHandle;
383
- } catch (_) {
384
- result = false;
385
- }
386
- const ret = result;
387
- return ret;
388
- };
389
- imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
390
- let result;
391
- try {
392
- result = arg0 instanceof Map;
393
- } catch (_) {
394
- result = false;
395
- }
396
- const ret = result;
397
- return ret;
398
- };
399
- imports.wbg.__wbg_instanceof_Navigator_1a0ee377f1057fd4 = function(arg0) {
400
- let result;
401
- try {
402
- result = arg0 instanceof Navigator;
403
- } catch (_) {
404
- result = false;
405
- }
406
- const ret = result;
407
- return ret;
408
- };
409
- imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
410
- let result;
411
- try {
412
- result = arg0 instanceof Uint8Array;
413
- } catch (_) {
414
- result = false;
415
- }
416
- const ret = result;
417
- return ret;
418
- };
419
- imports.wbg.__wbg_instanceof_Window_def73ea0955fc569 = function(arg0) {
420
- let result;
421
- try {
422
- result = arg0 instanceof Window;
423
- } catch (_) {
424
- result = false;
425
- }
426
- const ret = result;
427
- return ret;
428
- };
429
- imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
430
- const ret = Array.isArray(arg0);
431
- return ret;
432
- };
433
- imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
434
- const ret = Number.isSafeInteger(arg0);
435
- return ret;
436
- };
437
- imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
438
- const ret = Symbol.iterator;
439
- return ret;
440
- };
441
- imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
442
- const ret = arg0.length;
443
- return ret;
444
- };
445
- imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
446
- const ret = arg0.length;
447
- return ret;
448
- };
449
- imports.wbg.__wbg_name_f2d27098bfd843e7 = function(arg0, arg1) {
450
- const ret = arg1.name;
451
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
452
- const len1 = WASM_VECTOR_LEN;
453
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
454
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
455
- };
456
- imports.wbg.__wbg_navigator_1577371c070c8947 = function(arg0) {
457
- const ret = arg0.navigator;
458
- return ret;
459
- };
460
- imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
461
- try {
462
- var state0 = {a: arg0, b: arg1};
463
- var cb0 = (arg0, arg1) => {
464
- const a = state0.a;
465
- state0.a = 0;
466
- try {
467
- return __wbg_adapter_91(a, state0.b, arg0, arg1);
468
- } finally {
469
- state0.a = a;
470
- }
471
- };
472
- const ret = new Promise(cb0);
473
- return ret;
474
- } finally {
475
- state0.a = state0.b = 0;
476
- }
477
- };
478
- imports.wbg.__wbg_new_405e22f390576ce2 = function() {
479
- const ret = new Object();
480
- return ret;
481
- };
482
- imports.wbg.__wbg_new_78feb108b6472713 = function() {
483
- const ret = new Array();
484
- return ret;
485
- };
486
- imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
487
- const ret = new Uint8Array(arg0);
488
- return ret;
489
- };
490
- imports.wbg.__wbg_new_b1a33e5095abf678 = function() { return handleError(function (arg0, arg1) {
491
- const ret = new Worker(getStringFromWasm0(arg0, arg1));
492
- return ret;
493
- }, arguments) };
494
- imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
495
- const ret = new Function(getStringFromWasm0(arg0, arg1));
496
- return ret;
497
- };
498
- imports.wbg.__wbg_newwithstrsequenceandoptions_aaff55b467c81b63 = function() { return handleError(function (arg0, arg1) {
499
- const ret = new Blob(arg0, arg1);
500
- return ret;
501
- }, arguments) };
502
- imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
503
- const ret = arg0.next;
504
- return ret;
505
- };
506
- imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
507
- const ret = arg0.next();
508
- return ret;
509
- }, arguments) };
510
- imports.wbg.__wbg_postMessage_6edafa8f7b9c2f52 = function() { return handleError(function (arg0, arg1) {
511
- arg0.postMessage(arg1);
512
- }, arguments) };
513
- imports.wbg.__wbg_push_737cfc8c1432c2c6 = function(arg0, arg1) {
514
- const ret = arg0.push(arg1);
515
- return ret;
516
- };
517
- imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
518
- queueMicrotask(arg0);
519
- };
520
- imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
521
- const ret = arg0.queueMicrotask;
522
- return ret;
523
- };
524
- imports.wbg.__wbg_removeEntry_a424e90dff229b19 = function(arg0, arg1, arg2, arg3) {
525
- const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2), arg3);
526
- return ret;
527
- };
528
- imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
529
- const ret = Promise.resolve(arg0);
530
- return ret;
531
- };
532
- imports.wbg.__wbg_revokeObjectURL_27267efebeb457c7 = function() { return handleError(function (arg0, arg1) {
533
- URL.revokeObjectURL(getStringFromWasm0(arg0, arg1));
534
- }, arguments) };
535
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
536
- arg0[arg1] = arg2;
537
- };
538
- imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
539
- arg0.set(arg1, arg2 >>> 0);
540
- };
541
- imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
542
- const ret = Reflect.set(arg0, arg1, arg2);
543
- return ret;
544
- }, arguments) };
545
- imports.wbg.__wbg_setcreate_4ca762e23d9f78da = function(arg0, arg1) {
546
- arg0.create = arg1 !== 0;
547
- };
548
- imports.wbg.__wbg_setonmessage_5a885b16bdc6dca6 = function(arg0, arg1) {
549
- arg0.onmessage = arg1;
550
- };
551
- imports.wbg.__wbg_setrecursive_536113a081d6177a = function(arg0, arg1) {
552
- arg0.recursive = arg1 !== 0;
553
- };
554
- imports.wbg.__wbg_settype_39ed370d3edd403c = function(arg0, arg1, arg2) {
555
- arg0.type = getStringFromWasm0(arg1, arg2);
556
- };
557
- imports.wbg.__wbg_sqlitewasmdatabase_new = function(arg0) {
558
- const ret = SQLiteWasmDatabase.__wrap(arg0);
559
- return ret;
560
- };
561
- imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
562
- const ret = typeof global === 'undefined' ? null : global;
563
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
564
- };
565
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
566
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
567
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
568
- };
569
- imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
570
- const ret = typeof self === 'undefined' ? null : self;
571
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
572
- };
573
- imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
574
- const ret = typeof window === 'undefined' ? null : window;
575
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
576
- };
577
- imports.wbg.__wbg_storage_89a3fec18b19e1aa = function(arg0) {
578
- const ret = arg0.storage;
579
- return ret;
580
- };
581
- imports.wbg.__wbg_terminate_e8eab2977ce01111 = function(arg0) {
582
- arg0.terminate();
583
- };
584
- imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
585
- const ret = arg0.then(arg1);
586
- return ret;
587
- };
588
- imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
589
- const ret = arg0.then(arg1, arg2);
590
- return ret;
591
- };
592
- imports.wbg.__wbg_toString_b5d4438bc26b267c = function() { return handleError(function (arg0, arg1) {
593
- const ret = arg0.toString(arg1);
594
- return ret;
595
- }, arguments) };
596
- imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
597
- const ret = arg0.value;
598
- return ret;
599
- };
600
- imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
601
- const ret = arg0;
602
- return ret;
603
- };
604
- imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
605
- const ret = BigInt.asUintN(64, arg0);
606
- return ret;
607
- };
608
- imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
609
- const v = arg1;
610
- const ret = typeof(v) === 'bigint' ? v : undefined;
611
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
612
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
613
- };
614
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
615
- const v = arg0;
616
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
617
- return ret;
618
- };
619
- imports.wbg.__wbindgen_cb_drop = function(arg0) {
620
- const obj = arg0.original;
621
- if (obj.cnt-- == 1) {
622
- obj.a = 0;
623
- return true;
853
+ function expectedResponseType(type) {
854
+ switch (type) {
855
+ case 'basic': case 'cors': case 'default': return true;
624
856
  }
625
- const ret = false;
626
- return ret;
627
- };
628
- imports.wbg.__wbindgen_closure_wrapper1119 = function(arg0, arg1, arg2) {
629
- const ret = makeMutClosure(arg0, arg1, 49, __wbg_adapter_50);
630
- return ret;
631
- };
632
- imports.wbg.__wbindgen_closure_wrapper990 = function(arg0, arg1, arg2) {
633
- const ret = makeMutClosure(arg0, arg1, 38, __wbg_adapter_50);
634
- return ret;
635
- };
636
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
637
- const ret = debugString(arg1);
638
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
639
- const len1 = WASM_VECTOR_LEN;
640
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
641
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
642
- };
643
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
644
- const ret = new Error(getStringFromWasm0(arg0, arg1));
645
- return ret;
646
- };
647
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
648
- const ret = arg0 in arg1;
649
- return ret;
650
- };
651
- imports.wbg.__wbindgen_init_externref_table = function() {
652
- const table = wasm.__wbindgen_export_4;
653
- const offset = table.grow(4);
654
- table.set(0, undefined);
655
- table.set(offset + 0, undefined);
656
- table.set(offset + 1, null);
657
- table.set(offset + 2, true);
658
- table.set(offset + 3, false);
659
- ;
660
- };
661
- imports.wbg.__wbindgen_is_bigint = function(arg0) {
662
- const ret = typeof(arg0) === 'bigint';
663
- return ret;
664
- };
665
- imports.wbg.__wbindgen_is_function = function(arg0) {
666
- const ret = typeof(arg0) === 'function';
667
- return ret;
668
- };
669
- imports.wbg.__wbindgen_is_null = function(arg0) {
670
- const ret = arg0 === null;
671
- return ret;
672
- };
673
- imports.wbg.__wbindgen_is_object = function(arg0) {
674
- const val = arg0;
675
- const ret = typeof(val) === 'object' && val !== null;
676
- return ret;
677
- };
678
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
679
- const ret = arg0 === undefined;
680
- return ret;
681
- };
682
- imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
683
- const ret = arg0 === arg1;
684
- return ret;
685
- };
686
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
687
- const ret = arg0 == arg1;
688
- return ret;
689
- };
690
- imports.wbg.__wbindgen_memory = function() {
691
- const ret = wasm.memory;
692
- return ret;
693
- };
694
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
695
- const obj = arg1;
696
- const ret = typeof(obj) === 'number' ? obj : undefined;
697
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
698
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
699
- };
700
- imports.wbg.__wbindgen_number_new = function(arg0) {
701
- const ret = arg0;
702
- return ret;
703
- };
704
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
705
- const obj = arg1;
706
- const ret = typeof(obj) === 'string' ? obj : undefined;
707
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
708
- var len1 = WASM_VECTOR_LEN;
709
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
710
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
711
- };
712
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
713
- const ret = getStringFromWasm0(arg0, arg1);
714
- return ret;
715
- };
716
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
717
- throw new Error(getStringFromWasm0(arg0, arg1));
718
- };
719
-
720
- return imports;
721
- }
722
-
723
- function __wbg_init_memory(imports, memory) {
724
-
725
- }
726
-
727
- function __wbg_finalize_init(instance, module) {
728
- wasm = instance.exports;
729
- __wbg_init.__wbindgen_wasm_module = module;
730
- cachedDataViewMemory0 = null;
731
- cachedUint8ArrayMemory0 = null;
732
-
733
-
734
- wasm.__wbindgen_start();
735
- return wasm;
857
+ return false;
858
+ }
736
859
  }
737
860
 
738
861
  function initSync(module) {
739
862
  if (wasm !== undefined) return wasm;
740
863
 
741
864
 
742
- if (typeof module !== 'undefined') {
865
+ if (module !== undefined) {
743
866
  if (Object.getPrototypeOf(module) === Object.prototype) {
744
867
  ({module} = module)
745
868
  } else {
@@ -748,15 +871,10 @@ function initSync(module) {
748
871
  }
749
872
 
750
873
  const imports = __wbg_get_imports();
751
-
752
- __wbg_init_memory(imports);
753
-
754
874
  if (!(module instanceof WebAssembly.Module)) {
755
875
  module = new WebAssembly.Module(module);
756
876
  }
757
-
758
877
  const instance = new WebAssembly.Instance(module, imports);
759
-
760
878
  return __wbg_finalize_init(instance, module);
761
879
  }
762
880
 
@@ -764,7 +882,7 @@ async function __wbg_init(module_or_path) {
764
882
  if (wasm !== undefined) return wasm;
765
883
 
766
884
 
767
- if (typeof module_or_path !== 'undefined') {
885
+ if (module_or_path !== undefined) {
768
886
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
769
887
  ({module_or_path} = module_or_path)
770
888
  } else {
@@ -772,7 +890,7 @@ async function __wbg_init(module_or_path) {
772
890
  }
773
891
  }
774
892
 
775
- if (typeof module_or_path === 'undefined') {
893
+ if (module_or_path === undefined) {
776
894
  module_or_path = new URL('sqlite_web_bg.wasm', import.meta.url);
777
895
  }
778
896
  const imports = __wbg_get_imports();
@@ -781,12 +899,9 @@ async function __wbg_init(module_or_path) {
781
899
  module_or_path = fetch(module_or_path);
782
900
  }
783
901
 
784
- __wbg_init_memory(imports);
785
-
786
902
  const { instance, module } = await __wbg_load(await module_or_path, imports);
787
903
 
788
904
  return __wbg_finalize_init(instance, module);
789
905
  }
790
906
 
791
- export { initSync };
792
- export default __wbg_init;
907
+ export { initSync, __wbg_init as default };