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