@taladb/web 0.1.0
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/LICENSE +21 -0
- package/README.md +93 -0
- package/package.json +37 -0
- package/pkg/README.md +93 -0
- package/pkg/taladb_web.js +1502 -0
- package/worker/taladb.worker.js +202 -0
|
@@ -0,0 +1,1502 @@
|
|
|
1
|
+
/* @ts-self-types="./taladb_web.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class CollectionWasm {
|
|
4
|
+
static __wrap(ptr) {
|
|
5
|
+
ptr = ptr >>> 0;
|
|
6
|
+
const obj = Object.create(CollectionWasm.prototype);
|
|
7
|
+
obj.__wbg_ptr = ptr;
|
|
8
|
+
CollectionWasmFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
9
|
+
return obj;
|
|
10
|
+
}
|
|
11
|
+
__destroy_into_raw() {
|
|
12
|
+
const ptr = this.__wbg_ptr;
|
|
13
|
+
this.__wbg_ptr = 0;
|
|
14
|
+
CollectionWasmFinalization.unregister(this);
|
|
15
|
+
return ptr;
|
|
16
|
+
}
|
|
17
|
+
free() {
|
|
18
|
+
const ptr = this.__destroy_into_raw();
|
|
19
|
+
wasm.__wbg_collectionwasm_free(ptr, 0);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Count documents matching the filter.
|
|
23
|
+
* @param {any} filter
|
|
24
|
+
* @returns {number}
|
|
25
|
+
*/
|
|
26
|
+
count(filter) {
|
|
27
|
+
const ret = wasm.collectionwasm_count(this.__wbg_ptr, filter);
|
|
28
|
+
if (ret[2]) {
|
|
29
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
30
|
+
}
|
|
31
|
+
return ret[0] >>> 0;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a secondary index on a field.
|
|
35
|
+
* @param {string} field
|
|
36
|
+
*/
|
|
37
|
+
createIndex(field) {
|
|
38
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
39
|
+
const len0 = WASM_VECTOR_LEN;
|
|
40
|
+
const ret = wasm.collectionwasm_createIndex(this.__wbg_ptr, ptr0, len0);
|
|
41
|
+
if (ret[1]) {
|
|
42
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Delete all matching documents. Returns the count deleted.
|
|
47
|
+
* @param {any} filter
|
|
48
|
+
* @returns {number}
|
|
49
|
+
*/
|
|
50
|
+
deleteMany(filter) {
|
|
51
|
+
const ret = wasm.collectionwasm_deleteMany(this.__wbg_ptr, filter);
|
|
52
|
+
if (ret[2]) {
|
|
53
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
54
|
+
}
|
|
55
|
+
return ret[0] >>> 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Delete the first matching document. Returns true if deleted.
|
|
59
|
+
* @param {any} filter
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
*/
|
|
62
|
+
deleteOne(filter) {
|
|
63
|
+
const ret = wasm.collectionwasm_deleteOne(this.__wbg_ptr, filter);
|
|
64
|
+
if (ret[2]) {
|
|
65
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
66
|
+
}
|
|
67
|
+
return ret[0] !== 0;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Drop a secondary index.
|
|
71
|
+
* @param {string} field
|
|
72
|
+
*/
|
|
73
|
+
dropIndex(field) {
|
|
74
|
+
const ptr0 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
75
|
+
const len0 = WASM_VECTOR_LEN;
|
|
76
|
+
const ret = wasm.collectionwasm_dropIndex(this.__wbg_ptr, ptr0, len0);
|
|
77
|
+
if (ret[1]) {
|
|
78
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Find documents matching the filter. Returns a JS array of plain objects.
|
|
83
|
+
* @param {any} filter
|
|
84
|
+
* @returns {any}
|
|
85
|
+
*/
|
|
86
|
+
find(filter) {
|
|
87
|
+
const ret = wasm.collectionwasm_find(this.__wbg_ptr, filter);
|
|
88
|
+
if (ret[2]) {
|
|
89
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
90
|
+
}
|
|
91
|
+
return takeFromExternrefTable0(ret[0]);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Find a single document. Returns the document or null.
|
|
95
|
+
* @param {any} filter
|
|
96
|
+
* @returns {any}
|
|
97
|
+
*/
|
|
98
|
+
findOne(filter) {
|
|
99
|
+
const ret = wasm.collectionwasm_findOne(this.__wbg_ptr, filter);
|
|
100
|
+
if (ret[2]) {
|
|
101
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
102
|
+
}
|
|
103
|
+
return takeFromExternrefTable0(ret[0]);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Insert a document. Accepts a plain JS object, returns the ULID string id.
|
|
107
|
+
* @param {any} doc
|
|
108
|
+
* @returns {string}
|
|
109
|
+
*/
|
|
110
|
+
insert(doc) {
|
|
111
|
+
let deferred2_0;
|
|
112
|
+
let deferred2_1;
|
|
113
|
+
try {
|
|
114
|
+
const ret = wasm.collectionwasm_insert(this.__wbg_ptr, doc);
|
|
115
|
+
var ptr1 = ret[0];
|
|
116
|
+
var len1 = ret[1];
|
|
117
|
+
if (ret[3]) {
|
|
118
|
+
ptr1 = 0; len1 = 0;
|
|
119
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
120
|
+
}
|
|
121
|
+
deferred2_0 = ptr1;
|
|
122
|
+
deferred2_1 = len1;
|
|
123
|
+
return getStringFromWasm0(ptr1, len1);
|
|
124
|
+
} finally {
|
|
125
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Insert multiple documents. Returns an array of ULID string ids.
|
|
130
|
+
* @param {any} docs
|
|
131
|
+
* @returns {any}
|
|
132
|
+
*/
|
|
133
|
+
insertMany(docs) {
|
|
134
|
+
const ret = wasm.collectionwasm_insertMany(this.__wbg_ptr, docs);
|
|
135
|
+
if (ret[2]) {
|
|
136
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
137
|
+
}
|
|
138
|
+
return takeFromExternrefTable0(ret[0]);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Update all matching documents. Returns the count updated.
|
|
142
|
+
* @param {any} filter
|
|
143
|
+
* @param {any} update
|
|
144
|
+
* @returns {number}
|
|
145
|
+
*/
|
|
146
|
+
updateMany(filter, update) {
|
|
147
|
+
const ret = wasm.collectionwasm_updateMany(this.__wbg_ptr, filter, update);
|
|
148
|
+
if (ret[2]) {
|
|
149
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
150
|
+
}
|
|
151
|
+
return ret[0] >>> 0;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Update the first matching document. Returns true if a document was updated.
|
|
155
|
+
* @param {any} filter
|
|
156
|
+
* @param {any} update
|
|
157
|
+
* @returns {boolean}
|
|
158
|
+
*/
|
|
159
|
+
updateOne(filter, update) {
|
|
160
|
+
const ret = wasm.collectionwasm_updateOne(this.__wbg_ptr, filter, update);
|
|
161
|
+
if (ret[2]) {
|
|
162
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
163
|
+
}
|
|
164
|
+
return ret[0] !== 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (Symbol.dispose) CollectionWasm.prototype[Symbol.dispose] = CollectionWasm.prototype.free;
|
|
168
|
+
|
|
169
|
+
export class TalaDBWasm {
|
|
170
|
+
static __wrap(ptr) {
|
|
171
|
+
ptr = ptr >>> 0;
|
|
172
|
+
const obj = Object.create(TalaDBWasm.prototype);
|
|
173
|
+
obj.__wbg_ptr = ptr;
|
|
174
|
+
TalaDBWasmFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
175
|
+
return obj;
|
|
176
|
+
}
|
|
177
|
+
__destroy_into_raw() {
|
|
178
|
+
const ptr = this.__wbg_ptr;
|
|
179
|
+
this.__wbg_ptr = 0;
|
|
180
|
+
TalaDBWasmFinalization.unregister(this);
|
|
181
|
+
return ptr;
|
|
182
|
+
}
|
|
183
|
+
free() {
|
|
184
|
+
const ptr = this.__destroy_into_raw();
|
|
185
|
+
wasm.__wbg_taladbwasm_free(ptr, 0);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get a collection handle by name.
|
|
189
|
+
* @param {string} name
|
|
190
|
+
* @returns {CollectionWasm}
|
|
191
|
+
*/
|
|
192
|
+
collection(name) {
|
|
193
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
194
|
+
const len0 = WASM_VECTOR_LEN;
|
|
195
|
+
const ret = wasm.taladbwasm_collection(this.__wbg_ptr, ptr0, len0);
|
|
196
|
+
return CollectionWasm.__wrap(ret);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Serialize the entire in-memory database to bytes.
|
|
200
|
+
*
|
|
201
|
+
* Pass the returned `Uint8Array` to `opfs_flush_snapshot` to persist, or
|
|
202
|
+
* store it yourself. On the next page load, pass the same bytes to
|
|
203
|
+
* `openWithSnapshot` to restore all data.
|
|
204
|
+
* @returns {Uint8Array}
|
|
205
|
+
*/
|
|
206
|
+
exportSnapshot() {
|
|
207
|
+
const ret = wasm.taladbwasm_exportSnapshot(this.__wbg_ptr);
|
|
208
|
+
if (ret[3]) {
|
|
209
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
210
|
+
}
|
|
211
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
212
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
213
|
+
return v1;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Open an in-memory database (suitable for tests and environments without OPFS).
|
|
217
|
+
* @returns {TalaDBWasm}
|
|
218
|
+
*/
|
|
219
|
+
static openInMemory() {
|
|
220
|
+
const ret = wasm.taladbwasm_openInMemory();
|
|
221
|
+
if (ret[2]) {
|
|
222
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
223
|
+
}
|
|
224
|
+
return TalaDBWasm.__wrap(ret[0]);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Open a database, restoring from a previously exported snapshot if provided.
|
|
228
|
+
*
|
|
229
|
+
* Pass the bytes returned by `opfs_load_snapshot` (or `null`/`undefined` for
|
|
230
|
+
* a fresh empty database). After each write, call `exportSnapshot()` and
|
|
231
|
+
* pass the bytes to `opfs_flush_snapshot` to persist across page reloads.
|
|
232
|
+
*
|
|
233
|
+
* ```js
|
|
234
|
+
* const bytes = await opfs_load_snapshot('myapp.db'); // null on first open
|
|
235
|
+
* const db = TalaDBWasm.openWithSnapshot(bytes);
|
|
236
|
+
* // … mutations …
|
|
237
|
+
* await opfs_flush_snapshot('myapp.db', db.exportSnapshot());
|
|
238
|
+
* ```
|
|
239
|
+
* @param {Uint8Array | null} [snapshot]
|
|
240
|
+
* @returns {TalaDBWasm}
|
|
241
|
+
*/
|
|
242
|
+
static openWithSnapshot(snapshot) {
|
|
243
|
+
var ptr0 = isLikeNone(snapshot) ? 0 : passArray8ToWasm0(snapshot, wasm.__wbindgen_malloc);
|
|
244
|
+
var len0 = WASM_VECTOR_LEN;
|
|
245
|
+
const ret = wasm.taladbwasm_openWithSnapshot(ptr0, len0);
|
|
246
|
+
if (ret[2]) {
|
|
247
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
248
|
+
}
|
|
249
|
+
return TalaDBWasm.__wrap(ret[0]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (Symbol.dispose) TalaDBWasm.prototype[Symbol.dispose] = TalaDBWasm.prototype.free;
|
|
253
|
+
|
|
254
|
+
export class WorkerDB {
|
|
255
|
+
static __wrap(ptr) {
|
|
256
|
+
ptr = ptr >>> 0;
|
|
257
|
+
const obj = Object.create(WorkerDB.prototype);
|
|
258
|
+
obj.__wbg_ptr = ptr;
|
|
259
|
+
WorkerDBFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
260
|
+
return obj;
|
|
261
|
+
}
|
|
262
|
+
__destroy_into_raw() {
|
|
263
|
+
const ptr = this.__wbg_ptr;
|
|
264
|
+
this.__wbg_ptr = 0;
|
|
265
|
+
WorkerDBFinalization.unregister(this);
|
|
266
|
+
return ptr;
|
|
267
|
+
}
|
|
268
|
+
free() {
|
|
269
|
+
const ptr = this.__destroy_into_raw();
|
|
270
|
+
wasm.__wbg_workerdb_free(ptr, 0);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Count matching documents.
|
|
274
|
+
* @param {string} collection
|
|
275
|
+
* @param {string} filter_json
|
|
276
|
+
* @returns {number}
|
|
277
|
+
*/
|
|
278
|
+
count(collection, filter_json) {
|
|
279
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
280
|
+
const len0 = WASM_VECTOR_LEN;
|
|
281
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
282
|
+
const len1 = WASM_VECTOR_LEN;
|
|
283
|
+
const ret = wasm.workerdb_count(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
284
|
+
if (ret[2]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
286
|
+
}
|
|
287
|
+
return ret[0] >>> 0;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* @param {string} collection
|
|
291
|
+
* @param {string} field
|
|
292
|
+
*/
|
|
293
|
+
createFtsIndex(collection, field) {
|
|
294
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
296
|
+
const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
297
|
+
const len1 = WASM_VECTOR_LEN;
|
|
298
|
+
const ret = wasm.workerdb_createFtsIndex(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
299
|
+
if (ret[1]) {
|
|
300
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* @param {string} collection
|
|
305
|
+
* @param {string} field
|
|
306
|
+
*/
|
|
307
|
+
createIndex(collection, field) {
|
|
308
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
309
|
+
const len0 = WASM_VECTOR_LEN;
|
|
310
|
+
const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
311
|
+
const len1 = WASM_VECTOR_LEN;
|
|
312
|
+
const ret = wasm.workerdb_createIndex(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
313
|
+
if (ret[1]) {
|
|
314
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Delete all matching documents. Returns the count deleted.
|
|
319
|
+
* @param {string} collection
|
|
320
|
+
* @param {string} filter_json
|
|
321
|
+
* @returns {number}
|
|
322
|
+
*/
|
|
323
|
+
deleteMany(collection, filter_json) {
|
|
324
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
325
|
+
const len0 = WASM_VECTOR_LEN;
|
|
326
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
327
|
+
const len1 = WASM_VECTOR_LEN;
|
|
328
|
+
const ret = wasm.workerdb_deleteMany(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
329
|
+
if (ret[2]) {
|
|
330
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
331
|
+
}
|
|
332
|
+
return ret[0] >>> 0;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Delete the first matching document. Returns `true` / `false`.
|
|
336
|
+
* @param {string} collection
|
|
337
|
+
* @param {string} filter_json
|
|
338
|
+
* @returns {boolean}
|
|
339
|
+
*/
|
|
340
|
+
deleteOne(collection, filter_json) {
|
|
341
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
const len0 = WASM_VECTOR_LEN;
|
|
343
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
344
|
+
const len1 = WASM_VECTOR_LEN;
|
|
345
|
+
const ret = wasm.workerdb_deleteOne(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
346
|
+
if (ret[2]) {
|
|
347
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
348
|
+
}
|
|
349
|
+
return ret[0] !== 0;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @param {string} collection
|
|
353
|
+
* @param {string} field
|
|
354
|
+
*/
|
|
355
|
+
dropFtsIndex(collection, field) {
|
|
356
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
357
|
+
const len0 = WASM_VECTOR_LEN;
|
|
358
|
+
const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
359
|
+
const len1 = WASM_VECTOR_LEN;
|
|
360
|
+
const ret = wasm.workerdb_dropFtsIndex(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
361
|
+
if (ret[1]) {
|
|
362
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* @param {string} collection
|
|
367
|
+
* @param {string} field
|
|
368
|
+
*/
|
|
369
|
+
dropIndex(collection, field) {
|
|
370
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
371
|
+
const len0 = WASM_VECTOR_LEN;
|
|
372
|
+
const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
373
|
+
const len1 = WASM_VECTOR_LEN;
|
|
374
|
+
const ret = wasm.workerdb_dropIndex(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
375
|
+
if (ret[1]) {
|
|
376
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Find documents. Returns a JSON array of document objects.
|
|
381
|
+
* @param {string} collection
|
|
382
|
+
* @param {string} filter_json
|
|
383
|
+
* @returns {string}
|
|
384
|
+
*/
|
|
385
|
+
find(collection, filter_json) {
|
|
386
|
+
let deferred4_0;
|
|
387
|
+
let deferred4_1;
|
|
388
|
+
try {
|
|
389
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
391
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
392
|
+
const len1 = WASM_VECTOR_LEN;
|
|
393
|
+
const ret = wasm.workerdb_find(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
394
|
+
var ptr3 = ret[0];
|
|
395
|
+
var len3 = ret[1];
|
|
396
|
+
if (ret[3]) {
|
|
397
|
+
ptr3 = 0; len3 = 0;
|
|
398
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
399
|
+
}
|
|
400
|
+
deferred4_0 = ptr3;
|
|
401
|
+
deferred4_1 = len3;
|
|
402
|
+
return getStringFromWasm0(ptr3, len3);
|
|
403
|
+
} finally {
|
|
404
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Find one document. Returns a JSON object or `"null"`.
|
|
409
|
+
* @param {string} collection
|
|
410
|
+
* @param {string} filter_json
|
|
411
|
+
* @returns {string}
|
|
412
|
+
*/
|
|
413
|
+
findOne(collection, filter_json) {
|
|
414
|
+
let deferred4_0;
|
|
415
|
+
let deferred4_1;
|
|
416
|
+
try {
|
|
417
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
418
|
+
const len0 = WASM_VECTOR_LEN;
|
|
419
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
420
|
+
const len1 = WASM_VECTOR_LEN;
|
|
421
|
+
const ret = wasm.workerdb_findOne(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
422
|
+
var ptr3 = ret[0];
|
|
423
|
+
var len3 = ret[1];
|
|
424
|
+
if (ret[3]) {
|
|
425
|
+
ptr3 = 0; len3 = 0;
|
|
426
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
427
|
+
}
|
|
428
|
+
deferred4_0 = ptr3;
|
|
429
|
+
deferred4_1 = len3;
|
|
430
|
+
return getStringFromWasm0(ptr3, len3);
|
|
431
|
+
} finally {
|
|
432
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Insert a document. Returns the new ULID as a string.
|
|
437
|
+
* @param {string} collection
|
|
438
|
+
* @param {string} doc_json
|
|
439
|
+
* @returns {string}
|
|
440
|
+
*/
|
|
441
|
+
insert(collection, doc_json) {
|
|
442
|
+
let deferred4_0;
|
|
443
|
+
let deferred4_1;
|
|
444
|
+
try {
|
|
445
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
446
|
+
const len0 = WASM_VECTOR_LEN;
|
|
447
|
+
const ptr1 = passStringToWasm0(doc_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
448
|
+
const len1 = WASM_VECTOR_LEN;
|
|
449
|
+
const ret = wasm.workerdb_insert(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
450
|
+
var ptr3 = ret[0];
|
|
451
|
+
var len3 = ret[1];
|
|
452
|
+
if (ret[3]) {
|
|
453
|
+
ptr3 = 0; len3 = 0;
|
|
454
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
455
|
+
}
|
|
456
|
+
deferred4_0 = ptr3;
|
|
457
|
+
deferred4_1 = len3;
|
|
458
|
+
return getStringFromWasm0(ptr3, len3);
|
|
459
|
+
} finally {
|
|
460
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Insert many documents. Returns a JSON array of ULID strings.
|
|
465
|
+
* @param {string} collection
|
|
466
|
+
* @param {string} docs_json
|
|
467
|
+
* @returns {string}
|
|
468
|
+
*/
|
|
469
|
+
insertMany(collection, docs_json) {
|
|
470
|
+
let deferred4_0;
|
|
471
|
+
let deferred4_1;
|
|
472
|
+
try {
|
|
473
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
474
|
+
const len0 = WASM_VECTOR_LEN;
|
|
475
|
+
const ptr1 = passStringToWasm0(docs_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
476
|
+
const len1 = WASM_VECTOR_LEN;
|
|
477
|
+
const ret = wasm.workerdb_insertMany(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
478
|
+
var ptr3 = ret[0];
|
|
479
|
+
var len3 = ret[1];
|
|
480
|
+
if (ret[3]) {
|
|
481
|
+
ptr3 = 0; len3 = 0;
|
|
482
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
483
|
+
}
|
|
484
|
+
deferred4_0 = ptr3;
|
|
485
|
+
deferred4_1 = len3;
|
|
486
|
+
return getStringFromWasm0(ptr3, len3);
|
|
487
|
+
} finally {
|
|
488
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Open an in-memory database (for tests and OPFS-unavailable fallback).
|
|
493
|
+
* @returns {WorkerDB}
|
|
494
|
+
*/
|
|
495
|
+
static openInMemory() {
|
|
496
|
+
const ret = wasm.workerdb_openInMemory();
|
|
497
|
+
if (ret[2]) {
|
|
498
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
499
|
+
}
|
|
500
|
+
return WorkerDB.__wrap(ret[0]);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Open a database backed by an OPFS `FileSystemSyncAccessHandle`.
|
|
504
|
+
*
|
|
505
|
+
* Call sequence in the SharedWorker:
|
|
506
|
+
* ```js
|
|
507
|
+
* const handle = await file_handle.createSyncAccessHandle();
|
|
508
|
+
* const workerDb = WorkerDB.openWithOpfs(handle);
|
|
509
|
+
* ```
|
|
510
|
+
* @param {FileSystemSyncAccessHandle} sync_handle
|
|
511
|
+
* @returns {WorkerDB}
|
|
512
|
+
*/
|
|
513
|
+
static openWithOpfs(sync_handle) {
|
|
514
|
+
const ret = wasm.workerdb_openWithOpfs(sync_handle);
|
|
515
|
+
if (ret[2]) {
|
|
516
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
517
|
+
}
|
|
518
|
+
return WorkerDB.__wrap(ret[0]);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Update all matching documents. Returns the count updated.
|
|
522
|
+
* @param {string} collection
|
|
523
|
+
* @param {string} filter_json
|
|
524
|
+
* @param {string} update_json
|
|
525
|
+
* @returns {number}
|
|
526
|
+
*/
|
|
527
|
+
updateMany(collection, filter_json, update_json) {
|
|
528
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
529
|
+
const len0 = WASM_VECTOR_LEN;
|
|
530
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
531
|
+
const len1 = WASM_VECTOR_LEN;
|
|
532
|
+
const ptr2 = passStringToWasm0(update_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
533
|
+
const len2 = WASM_VECTOR_LEN;
|
|
534
|
+
const ret = wasm.workerdb_updateMany(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
535
|
+
if (ret[2]) {
|
|
536
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
537
|
+
}
|
|
538
|
+
return ret[0] >>> 0;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Update the first matching document. Returns `true` / `false`.
|
|
542
|
+
* @param {string} collection
|
|
543
|
+
* @param {string} filter_json
|
|
544
|
+
* @param {string} update_json
|
|
545
|
+
* @returns {boolean}
|
|
546
|
+
*/
|
|
547
|
+
updateOne(collection, filter_json, update_json) {
|
|
548
|
+
const ptr0 = passStringToWasm0(collection, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
549
|
+
const len0 = WASM_VECTOR_LEN;
|
|
550
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
551
|
+
const len1 = WASM_VECTOR_LEN;
|
|
552
|
+
const ptr2 = passStringToWasm0(update_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
553
|
+
const len2 = WASM_VECTOR_LEN;
|
|
554
|
+
const ret = wasm.workerdb_updateOne(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
555
|
+
if (ret[2]) {
|
|
556
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
557
|
+
}
|
|
558
|
+
return ret[0] !== 0;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (Symbol.dispose) WorkerDB.prototype[Symbol.dispose] = WorkerDB.prototype.free;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Load a previous database snapshot from IndexedDB.
|
|
565
|
+
* Returns None if no snapshot exists yet.
|
|
566
|
+
* @param {string} db_name
|
|
567
|
+
* @returns {Promise<Uint8Array | undefined>}
|
|
568
|
+
*/
|
|
569
|
+
export function idb_load_snapshot(db_name) {
|
|
570
|
+
const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
571
|
+
const len0 = WASM_VECTOR_LEN;
|
|
572
|
+
const ret = wasm.idb_load_snapshot(ptr0, len0);
|
|
573
|
+
return ret;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Persist a database snapshot to IndexedDB (via localStorage for simplicity in v1).
|
|
578
|
+
* In v2 this should use a proper IDBObjectStore for binary data.
|
|
579
|
+
* @param {string} db_name
|
|
580
|
+
* @param {Uint8Array} data
|
|
581
|
+
* @returns {Promise<boolean>}
|
|
582
|
+
*/
|
|
583
|
+
export function idb_save_snapshot(db_name, data) {
|
|
584
|
+
const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
585
|
+
const len0 = WASM_VECTOR_LEN;
|
|
586
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
587
|
+
const len1 = WASM_VECTOR_LEN;
|
|
588
|
+
const ret = wasm.idb_save_snapshot(ptr0, len0, ptr1, len1);
|
|
589
|
+
return ret;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Initialize panic hook for better error messages in the browser console.
|
|
594
|
+
*/
|
|
595
|
+
export function init() {
|
|
596
|
+
wasm.init();
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Returns true if OPFS is available in the current browser context.
|
|
601
|
+
* Always returns false in Workers without storage access.
|
|
602
|
+
* @returns {Promise<boolean>}
|
|
603
|
+
*/
|
|
604
|
+
export function is_opfs_available() {
|
|
605
|
+
const ret = wasm.is_opfs_available();
|
|
606
|
+
return ret;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Delete the OPFS snapshot file for `db_name`.
|
|
611
|
+
* No-op if the file does not exist.
|
|
612
|
+
* @param {string} db_name
|
|
613
|
+
* @returns {Promise<boolean>}
|
|
614
|
+
*/
|
|
615
|
+
export function opfs_delete_snapshot(db_name) {
|
|
616
|
+
const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
617
|
+
const len0 = WASM_VECTOR_LEN;
|
|
618
|
+
const ret = wasm.opfs_delete_snapshot(ptr0, len0);
|
|
619
|
+
return ret;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Persist a database snapshot to OPFS.
|
|
624
|
+
* Creates the file on first call. Subsequent calls overwrite atomically.
|
|
625
|
+
* @param {string} db_name
|
|
626
|
+
* @param {Uint8Array} data
|
|
627
|
+
* @returns {Promise<boolean>}
|
|
628
|
+
*/
|
|
629
|
+
export function opfs_flush_snapshot(db_name, data) {
|
|
630
|
+
const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
631
|
+
const len0 = WASM_VECTOR_LEN;
|
|
632
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
633
|
+
const len1 = WASM_VECTOR_LEN;
|
|
634
|
+
const ret = wasm.opfs_flush_snapshot(ptr0, len0, ptr1, len1);
|
|
635
|
+
return ret;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Load the last persisted database snapshot from OPFS.
|
|
640
|
+
* Returns `None` if the file does not exist yet (first open).
|
|
641
|
+
* @param {string} db_name
|
|
642
|
+
* @returns {Promise<Uint8Array | undefined>}
|
|
643
|
+
*/
|
|
644
|
+
export function opfs_load_snapshot(db_name) {
|
|
645
|
+
const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
646
|
+
const len0 = WASM_VECTOR_LEN;
|
|
647
|
+
const ret = wasm.opfs_load_snapshot(ptr0, len0);
|
|
648
|
+
return ret;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Open (or create) an OPFS file and return an `OpfsBackend` for redb.
|
|
653
|
+
*
|
|
654
|
+
* This function is **async** because `getFileHandle` and `createSyncAccessHandle`
|
|
655
|
+
* are both async in the OPFS API. Call it once at worker startup.
|
|
656
|
+
* @param {string} db_name
|
|
657
|
+
* @returns {Promise<any>}
|
|
658
|
+
*/
|
|
659
|
+
export function opfs_open_backend(db_name) {
|
|
660
|
+
const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
661
|
+
const len0 = WASM_VECTOR_LEN;
|
|
662
|
+
const ret = wasm.opfs_open_backend(ptr0, len0);
|
|
663
|
+
return ret;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function __wbg_get_imports() {
|
|
667
|
+
const import0 = {
|
|
668
|
+
__proto__: null,
|
|
669
|
+
__wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
|
|
670
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
671
|
+
return ret;
|
|
672
|
+
},
|
|
673
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
674
|
+
const ret = String(arg1);
|
|
675
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
676
|
+
const len1 = WASM_VECTOR_LEN;
|
|
677
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
678
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
679
|
+
},
|
|
680
|
+
__wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
|
|
681
|
+
const v = arg1;
|
|
682
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
683
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
684
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
685
|
+
},
|
|
686
|
+
__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
|
|
687
|
+
const v = arg0;
|
|
688
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
689
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
690
|
+
},
|
|
691
|
+
__wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
|
|
692
|
+
const ret = debugString(arg1);
|
|
693
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
694
|
+
const len1 = WASM_VECTOR_LEN;
|
|
695
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
696
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
697
|
+
},
|
|
698
|
+
__wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
|
|
699
|
+
const ret = arg0 in arg1;
|
|
700
|
+
return ret;
|
|
701
|
+
},
|
|
702
|
+
__wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
|
|
703
|
+
const ret = typeof(arg0) === 'bigint';
|
|
704
|
+
return ret;
|
|
705
|
+
},
|
|
706
|
+
__wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
|
|
707
|
+
const ret = typeof(arg0) === 'function';
|
|
708
|
+
return ret;
|
|
709
|
+
},
|
|
710
|
+
__wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
|
|
711
|
+
const ret = arg0 === null;
|
|
712
|
+
return ret;
|
|
713
|
+
},
|
|
714
|
+
__wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
|
|
715
|
+
const val = arg0;
|
|
716
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
717
|
+
return ret;
|
|
718
|
+
},
|
|
719
|
+
__wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
|
|
720
|
+
const ret = typeof(arg0) === 'string';
|
|
721
|
+
return ret;
|
|
722
|
+
},
|
|
723
|
+
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
724
|
+
const ret = arg0 === undefined;
|
|
725
|
+
return ret;
|
|
726
|
+
},
|
|
727
|
+
__wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
|
|
728
|
+
const ret = arg0 === arg1;
|
|
729
|
+
return ret;
|
|
730
|
+
},
|
|
731
|
+
__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
|
|
732
|
+
const ret = arg0 == arg1;
|
|
733
|
+
return ret;
|
|
734
|
+
},
|
|
735
|
+
__wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
|
|
736
|
+
const obj = arg1;
|
|
737
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
738
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
739
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
740
|
+
},
|
|
741
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
742
|
+
const obj = arg1;
|
|
743
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
744
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
745
|
+
var len1 = WASM_VECTOR_LEN;
|
|
746
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
747
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
748
|
+
},
|
|
749
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
750
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
751
|
+
},
|
|
752
|
+
__wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
|
|
753
|
+
arg0._wbg_cb_unref();
|
|
754
|
+
},
|
|
755
|
+
__wbg_arrayBuffer_7ff5e58aa85a64f7: function(arg0) {
|
|
756
|
+
const ret = arg0.arrayBuffer();
|
|
757
|
+
return ret;
|
|
758
|
+
},
|
|
759
|
+
__wbg_buffer_60b8043cd926067d: function(arg0) {
|
|
760
|
+
const ret = arg0.buffer;
|
|
761
|
+
return ret;
|
|
762
|
+
},
|
|
763
|
+
__wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
|
|
764
|
+
const ret = arg0.call(arg1, arg2);
|
|
765
|
+
return ret;
|
|
766
|
+
}, arguments); },
|
|
767
|
+
__wbg_call_dcc2662fa17a72cf: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
768
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
769
|
+
return ret;
|
|
770
|
+
}, arguments); },
|
|
771
|
+
__wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
|
|
772
|
+
const ret = arg0.call(arg1);
|
|
773
|
+
return ret;
|
|
774
|
+
}, arguments); },
|
|
775
|
+
__wbg_close_8b24f0978d9a4917: function(arg0) {
|
|
776
|
+
const ret = arg0.close();
|
|
777
|
+
return ret;
|
|
778
|
+
},
|
|
779
|
+
__wbg_createWritable_d2f6937622592d78: function(arg0) {
|
|
780
|
+
const ret = arg0.createWritable();
|
|
781
|
+
return ret;
|
|
782
|
+
},
|
|
783
|
+
__wbg_done_08ce71ee07e3bd17: function(arg0) {
|
|
784
|
+
const ret = arg0.done;
|
|
785
|
+
return ret;
|
|
786
|
+
},
|
|
787
|
+
__wbg_entries_e8a20ff8c9757101: function(arg0) {
|
|
788
|
+
const ret = Object.entries(arg0);
|
|
789
|
+
return ret;
|
|
790
|
+
},
|
|
791
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
792
|
+
let deferred0_0;
|
|
793
|
+
let deferred0_1;
|
|
794
|
+
try {
|
|
795
|
+
deferred0_0 = arg0;
|
|
796
|
+
deferred0_1 = arg1;
|
|
797
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
798
|
+
} finally {
|
|
799
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
800
|
+
}
|
|
801
|
+
},
|
|
802
|
+
__wbg_flush_1eca046e0ff7c399: function() { return handleError(function (arg0) {
|
|
803
|
+
arg0.flush();
|
|
804
|
+
}, arguments); },
|
|
805
|
+
__wbg_from_4bdf88943703fd48: function(arg0) {
|
|
806
|
+
const ret = Array.from(arg0);
|
|
807
|
+
return ret;
|
|
808
|
+
},
|
|
809
|
+
__wbg_getDirectory_2406d369de179ff0: function(arg0) {
|
|
810
|
+
const ret = arg0.getDirectory();
|
|
811
|
+
return ret;
|
|
812
|
+
},
|
|
813
|
+
__wbg_getFileHandle_b85805519dc63efa: function(arg0, arg1, arg2, arg3) {
|
|
814
|
+
const ret = arg0.getFileHandle(getStringFromWasm0(arg1, arg2), arg3);
|
|
815
|
+
return ret;
|
|
816
|
+
},
|
|
817
|
+
__wbg_getFile_30341f4730c33225: function(arg0) {
|
|
818
|
+
const ret = arg0.getFile();
|
|
819
|
+
return ret;
|
|
820
|
+
},
|
|
821
|
+
__wbg_getItem_a7cc1d4f154f2e6f: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
822
|
+
const ret = arg1.getItem(getStringFromWasm0(arg2, arg3));
|
|
823
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
824
|
+
var len1 = WASM_VECTOR_LEN;
|
|
825
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
826
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
827
|
+
}, arguments); },
|
|
828
|
+
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
|
|
829
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
830
|
+
}, arguments); },
|
|
831
|
+
__wbg_getSize_0a16c5e2524d34aa: function() { return handleError(function (arg0) {
|
|
832
|
+
const ret = arg0.getSize();
|
|
833
|
+
return ret;
|
|
834
|
+
}, arguments); },
|
|
835
|
+
__wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
|
|
836
|
+
const ret = Reflect.get(arg0, arg1);
|
|
837
|
+
return ret;
|
|
838
|
+
}, arguments); },
|
|
839
|
+
__wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
|
|
840
|
+
const ret = Reflect.get(arg0, arg1);
|
|
841
|
+
return ret;
|
|
842
|
+
}, arguments); },
|
|
843
|
+
__wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
|
|
844
|
+
const ret = arg0[arg1 >>> 0];
|
|
845
|
+
return ret;
|
|
846
|
+
},
|
|
847
|
+
__wbg_get_index_87179971b8d350e4: function(arg0, arg1) {
|
|
848
|
+
const ret = arg0[arg1 >>> 0];
|
|
849
|
+
return ret;
|
|
850
|
+
},
|
|
851
|
+
__wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
|
|
852
|
+
const ret = arg0[arg1 >>> 0];
|
|
853
|
+
return ret;
|
|
854
|
+
},
|
|
855
|
+
__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
|
|
856
|
+
let result;
|
|
857
|
+
try {
|
|
858
|
+
result = arg0 instanceof ArrayBuffer;
|
|
859
|
+
} catch (_) {
|
|
860
|
+
result = false;
|
|
861
|
+
}
|
|
862
|
+
const ret = result;
|
|
863
|
+
return ret;
|
|
864
|
+
},
|
|
865
|
+
__wbg_instanceof_FileSystemDirectoryHandle_2944d0641b4ea10c: function(arg0) {
|
|
866
|
+
let result;
|
|
867
|
+
try {
|
|
868
|
+
result = arg0 instanceof FileSystemDirectoryHandle;
|
|
869
|
+
} catch (_) {
|
|
870
|
+
result = false;
|
|
871
|
+
}
|
|
872
|
+
const ret = result;
|
|
873
|
+
return ret;
|
|
874
|
+
},
|
|
875
|
+
__wbg_instanceof_FileSystemFileHandle_37ac45c6adcff28f: function(arg0) {
|
|
876
|
+
let result;
|
|
877
|
+
try {
|
|
878
|
+
result = arg0 instanceof FileSystemFileHandle;
|
|
879
|
+
} catch (_) {
|
|
880
|
+
result = false;
|
|
881
|
+
}
|
|
882
|
+
const ret = result;
|
|
883
|
+
return ret;
|
|
884
|
+
},
|
|
885
|
+
__wbg_instanceof_FileSystemSyncAccessHandle_dc45d7dabb2f5ad9: function(arg0) {
|
|
886
|
+
let result;
|
|
887
|
+
try {
|
|
888
|
+
result = arg0 instanceof FileSystemSyncAccessHandle;
|
|
889
|
+
} catch (_) {
|
|
890
|
+
result = false;
|
|
891
|
+
}
|
|
892
|
+
const ret = result;
|
|
893
|
+
return ret;
|
|
894
|
+
},
|
|
895
|
+
__wbg_instanceof_FileSystemWritableFileStream_4b3d3484a5ead457: function(arg0) {
|
|
896
|
+
let result;
|
|
897
|
+
try {
|
|
898
|
+
result = arg0 instanceof FileSystemWritableFileStream;
|
|
899
|
+
} catch (_) {
|
|
900
|
+
result = false;
|
|
901
|
+
}
|
|
902
|
+
const ret = result;
|
|
903
|
+
return ret;
|
|
904
|
+
},
|
|
905
|
+
__wbg_instanceof_File_a301c444111d30cb: function(arg0) {
|
|
906
|
+
let result;
|
|
907
|
+
try {
|
|
908
|
+
result = arg0 instanceof File;
|
|
909
|
+
} catch (_) {
|
|
910
|
+
result = false;
|
|
911
|
+
}
|
|
912
|
+
const ret = result;
|
|
913
|
+
return ret;
|
|
914
|
+
},
|
|
915
|
+
__wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
|
|
916
|
+
let result;
|
|
917
|
+
try {
|
|
918
|
+
result = arg0 instanceof Map;
|
|
919
|
+
} catch (_) {
|
|
920
|
+
result = false;
|
|
921
|
+
}
|
|
922
|
+
const ret = result;
|
|
923
|
+
return ret;
|
|
924
|
+
},
|
|
925
|
+
__wbg_instanceof_Promise_7c3bdd7805c2c6e6: function(arg0) {
|
|
926
|
+
let result;
|
|
927
|
+
try {
|
|
928
|
+
result = arg0 instanceof Promise;
|
|
929
|
+
} catch (_) {
|
|
930
|
+
result = false;
|
|
931
|
+
}
|
|
932
|
+
const ret = result;
|
|
933
|
+
return ret;
|
|
934
|
+
},
|
|
935
|
+
__wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
|
|
936
|
+
let result;
|
|
937
|
+
try {
|
|
938
|
+
result = arg0 instanceof Uint8Array;
|
|
939
|
+
} catch (_) {
|
|
940
|
+
result = false;
|
|
941
|
+
}
|
|
942
|
+
const ret = result;
|
|
943
|
+
return ret;
|
|
944
|
+
},
|
|
945
|
+
__wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
|
|
946
|
+
let result;
|
|
947
|
+
try {
|
|
948
|
+
result = arg0 instanceof Window;
|
|
949
|
+
} catch (_) {
|
|
950
|
+
result = false;
|
|
951
|
+
}
|
|
952
|
+
const ret = result;
|
|
953
|
+
return ret;
|
|
954
|
+
},
|
|
955
|
+
__wbg_isArray_33b91feb269ff46e: function(arg0) {
|
|
956
|
+
const ret = Array.isArray(arg0);
|
|
957
|
+
return ret;
|
|
958
|
+
},
|
|
959
|
+
__wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
|
|
960
|
+
const ret = Number.isSafeInteger(arg0);
|
|
961
|
+
return ret;
|
|
962
|
+
},
|
|
963
|
+
__wbg_iterator_d8f549ec8fb061b1: function() {
|
|
964
|
+
const ret = Symbol.iterator;
|
|
965
|
+
return ret;
|
|
966
|
+
},
|
|
967
|
+
__wbg_length_b3416cf66a5452c8: function(arg0) {
|
|
968
|
+
const ret = arg0.length;
|
|
969
|
+
return ret;
|
|
970
|
+
},
|
|
971
|
+
__wbg_length_ea16607d7b61445b: function(arg0) {
|
|
972
|
+
const ret = arg0.length;
|
|
973
|
+
return ret;
|
|
974
|
+
},
|
|
975
|
+
__wbg_localStorage_51c38b3b222e1ed2: function() { return handleError(function (arg0) {
|
|
976
|
+
const ret = arg0.localStorage;
|
|
977
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
978
|
+
}, arguments); },
|
|
979
|
+
__wbg_navigator_9cebf56f28aa719b: function(arg0) {
|
|
980
|
+
const ret = arg0.navigator;
|
|
981
|
+
return ret;
|
|
982
|
+
},
|
|
983
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
984
|
+
const ret = new Error();
|
|
985
|
+
return ret;
|
|
986
|
+
},
|
|
987
|
+
__wbg_new_49d5571bd3f0c4d4: function() {
|
|
988
|
+
const ret = new Map();
|
|
989
|
+
return ret;
|
|
990
|
+
},
|
|
991
|
+
__wbg_new_5f486cdf45a04d78: function(arg0) {
|
|
992
|
+
const ret = new Uint8Array(arg0);
|
|
993
|
+
return ret;
|
|
994
|
+
},
|
|
995
|
+
__wbg_new_a70fbab9066b301f: function() {
|
|
996
|
+
const ret = new Array();
|
|
997
|
+
return ret;
|
|
998
|
+
},
|
|
999
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
1000
|
+
const ret = new Object();
|
|
1001
|
+
return ret;
|
|
1002
|
+
},
|
|
1003
|
+
__wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
|
|
1004
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
1005
|
+
return ret;
|
|
1006
|
+
},
|
|
1007
|
+
__wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
|
|
1008
|
+
try {
|
|
1009
|
+
var state0 = {a: arg0, b: arg1};
|
|
1010
|
+
var cb0 = (arg0, arg1) => {
|
|
1011
|
+
const a = state0.a;
|
|
1012
|
+
state0.a = 0;
|
|
1013
|
+
try {
|
|
1014
|
+
return wasm_bindgen__convert__closures_____invoke__h675f15260128efbc(a, state0.b, arg0, arg1);
|
|
1015
|
+
} finally {
|
|
1016
|
+
state0.a = a;
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
const ret = new Promise(cb0);
|
|
1020
|
+
return ret;
|
|
1021
|
+
} finally {
|
|
1022
|
+
state0.a = state0.b = 0;
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
__wbg_new_with_length_825018a1616e9e55: function(arg0) {
|
|
1026
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1027
|
+
return ret;
|
|
1028
|
+
},
|
|
1029
|
+
__wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
|
|
1030
|
+
const ret = arg0.next();
|
|
1031
|
+
return ret;
|
|
1032
|
+
}, arguments); },
|
|
1033
|
+
__wbg_next_e01a967809d1aa68: function(arg0) {
|
|
1034
|
+
const ret = arg0.next;
|
|
1035
|
+
return ret;
|
|
1036
|
+
},
|
|
1037
|
+
__wbg_now_16f0c993d5dd6c27: function() {
|
|
1038
|
+
const ret = Date.now();
|
|
1039
|
+
return ret;
|
|
1040
|
+
},
|
|
1041
|
+
__wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
|
|
1042
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1043
|
+
},
|
|
1044
|
+
__wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
|
|
1045
|
+
const ret = arg0.queueMicrotask;
|
|
1046
|
+
return ret;
|
|
1047
|
+
},
|
|
1048
|
+
__wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
|
|
1049
|
+
queueMicrotask(arg0);
|
|
1050
|
+
},
|
|
1051
|
+
__wbg_removeEntry_b2a4d6d0ee2040c5: function(arg0, arg1, arg2) {
|
|
1052
|
+
const ret = arg0.removeEntry(getStringFromWasm0(arg1, arg2));
|
|
1053
|
+
return ret;
|
|
1054
|
+
},
|
|
1055
|
+
__wbg_resolve_ae8d83246e5bcc12: function(arg0) {
|
|
1056
|
+
const ret = Promise.resolve(arg0);
|
|
1057
|
+
return ret;
|
|
1058
|
+
},
|
|
1059
|
+
__wbg_setItem_5f84aeef0d7f3c17: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1060
|
+
arg0.setItem(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1061
|
+
}, arguments); },
|
|
1062
|
+
__wbg_set_282384002438957f: function(arg0, arg1, arg2) {
|
|
1063
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1064
|
+
},
|
|
1065
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1066
|
+
arg0[arg1] = arg2;
|
|
1067
|
+
},
|
|
1068
|
+
__wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1069
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1070
|
+
return ret;
|
|
1071
|
+
}, arguments); },
|
|
1072
|
+
__wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
|
|
1073
|
+
const ret = arg0.set(arg1, arg2);
|
|
1074
|
+
return ret;
|
|
1075
|
+
},
|
|
1076
|
+
__wbg_set_create_ef897736206a6f05: function(arg0, arg1) {
|
|
1077
|
+
arg0.create = arg1 !== 0;
|
|
1078
|
+
},
|
|
1079
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
1080
|
+
const ret = arg1.stack;
|
|
1081
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1082
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1083
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1084
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1085
|
+
},
|
|
1086
|
+
__wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
|
|
1087
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1088
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1089
|
+
},
|
|
1090
|
+
__wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
|
|
1091
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1092
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1093
|
+
},
|
|
1094
|
+
__wbg_static_accessor_SELF_f207c857566db248: function() {
|
|
1095
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1096
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1097
|
+
},
|
|
1098
|
+
__wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
|
|
1099
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1100
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1101
|
+
},
|
|
1102
|
+
__wbg_storage_63fa6fa9455d2153: function(arg0) {
|
|
1103
|
+
const ret = arg0.storage;
|
|
1104
|
+
return ret;
|
|
1105
|
+
},
|
|
1106
|
+
__wbg_then_098abe61755d12f6: function(arg0, arg1) {
|
|
1107
|
+
const ret = arg0.then(arg1);
|
|
1108
|
+
return ret;
|
|
1109
|
+
},
|
|
1110
|
+
__wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
|
|
1111
|
+
const ret = arg0.then(arg1, arg2);
|
|
1112
|
+
return ret;
|
|
1113
|
+
},
|
|
1114
|
+
__wbg_truncate_af8ac1613ab66393: function() { return handleError(function (arg0, arg1) {
|
|
1115
|
+
arg0.truncate(arg1);
|
|
1116
|
+
}, arguments); },
|
|
1117
|
+
__wbg_value_21fc78aab0322612: function(arg0) {
|
|
1118
|
+
const ret = arg0.value;
|
|
1119
|
+
return ret;
|
|
1120
|
+
},
|
|
1121
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1122
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 204, function: Function { arguments: [Externref], shim_idx: 205, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1123
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1411c0b1433bd547, wasm_bindgen__convert__closures_____invoke__h4bd31e7387ab665d);
|
|
1124
|
+
return ret;
|
|
1125
|
+
},
|
|
1126
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
1127
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1128
|
+
const ret = arg0;
|
|
1129
|
+
return ret;
|
|
1130
|
+
},
|
|
1131
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
1132
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1133
|
+
const ret = arg0;
|
|
1134
|
+
return ret;
|
|
1135
|
+
},
|
|
1136
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1137
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1138
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1139
|
+
return ret;
|
|
1140
|
+
},
|
|
1141
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
1142
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1143
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1144
|
+
return ret;
|
|
1145
|
+
},
|
|
1146
|
+
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
1147
|
+
var v0 = getArrayU8FromWasm0(arg0, arg1).slice();
|
|
1148
|
+
wasm.__wbindgen_free(arg0, arg1 * 1, 1);
|
|
1149
|
+
// Cast intrinsic for `Vector(U8) -> Externref`.
|
|
1150
|
+
const ret = v0;
|
|
1151
|
+
return ret;
|
|
1152
|
+
},
|
|
1153
|
+
__wbindgen_init_externref_table: function() {
|
|
1154
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1155
|
+
const offset = table.grow(4);
|
|
1156
|
+
table.set(0, undefined);
|
|
1157
|
+
table.set(offset + 0, undefined);
|
|
1158
|
+
table.set(offset + 1, null);
|
|
1159
|
+
table.set(offset + 2, true);
|
|
1160
|
+
table.set(offset + 3, false);
|
|
1161
|
+
},
|
|
1162
|
+
};
|
|
1163
|
+
return {
|
|
1164
|
+
__proto__: null,
|
|
1165
|
+
"./taladb_web_bg.js": import0,
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
function wasm_bindgen__convert__closures_____invoke__h4bd31e7387ab665d(arg0, arg1, arg2) {
|
|
1170
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h4bd31e7387ab665d(arg0, arg1, arg2);
|
|
1171
|
+
if (ret[1]) {
|
|
1172
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
function wasm_bindgen__convert__closures_____invoke__h675f15260128efbc(arg0, arg1, arg2, arg3) {
|
|
1177
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h675f15260128efbc(arg0, arg1, arg2, arg3);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
const CollectionWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1181
|
+
? { register: () => {}, unregister: () => {} }
|
|
1182
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_collectionwasm_free(ptr >>> 0, 1));
|
|
1183
|
+
const TalaDBWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1184
|
+
? { register: () => {}, unregister: () => {} }
|
|
1185
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_taladbwasm_free(ptr >>> 0, 1));
|
|
1186
|
+
const WorkerDBFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1187
|
+
? { register: () => {}, unregister: () => {} }
|
|
1188
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_workerdb_free(ptr >>> 0, 1));
|
|
1189
|
+
|
|
1190
|
+
function addToExternrefTable0(obj) {
|
|
1191
|
+
const idx = wasm.__externref_table_alloc();
|
|
1192
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1193
|
+
return idx;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
1197
|
+
? { register: () => {}, unregister: () => {} }
|
|
1198
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
1199
|
+
|
|
1200
|
+
function debugString(val) {
|
|
1201
|
+
// primitive types
|
|
1202
|
+
const type = typeof val;
|
|
1203
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1204
|
+
return `${val}`;
|
|
1205
|
+
}
|
|
1206
|
+
if (type == 'string') {
|
|
1207
|
+
return `"${val}"`;
|
|
1208
|
+
}
|
|
1209
|
+
if (type == 'symbol') {
|
|
1210
|
+
const description = val.description;
|
|
1211
|
+
if (description == null) {
|
|
1212
|
+
return 'Symbol';
|
|
1213
|
+
} else {
|
|
1214
|
+
return `Symbol(${description})`;
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
if (type == 'function') {
|
|
1218
|
+
const name = val.name;
|
|
1219
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1220
|
+
return `Function(${name})`;
|
|
1221
|
+
} else {
|
|
1222
|
+
return 'Function';
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
// objects
|
|
1226
|
+
if (Array.isArray(val)) {
|
|
1227
|
+
const length = val.length;
|
|
1228
|
+
let debug = '[';
|
|
1229
|
+
if (length > 0) {
|
|
1230
|
+
debug += debugString(val[0]);
|
|
1231
|
+
}
|
|
1232
|
+
for(let i = 1; i < length; i++) {
|
|
1233
|
+
debug += ', ' + debugString(val[i]);
|
|
1234
|
+
}
|
|
1235
|
+
debug += ']';
|
|
1236
|
+
return debug;
|
|
1237
|
+
}
|
|
1238
|
+
// Test for built-in
|
|
1239
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1240
|
+
let className;
|
|
1241
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1242
|
+
className = builtInMatches[1];
|
|
1243
|
+
} else {
|
|
1244
|
+
// Failed to match the standard '[object ClassName]'
|
|
1245
|
+
return toString.call(val);
|
|
1246
|
+
}
|
|
1247
|
+
if (className == 'Object') {
|
|
1248
|
+
// we're a user defined class or Object
|
|
1249
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1250
|
+
// easier than looping through ownProperties of `val`.
|
|
1251
|
+
try {
|
|
1252
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1253
|
+
} catch (_) {
|
|
1254
|
+
return 'Object';
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
// errors
|
|
1258
|
+
if (val instanceof Error) {
|
|
1259
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1260
|
+
}
|
|
1261
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1262
|
+
return className;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1266
|
+
ptr = ptr >>> 0;
|
|
1267
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
let cachedDataViewMemory0 = null;
|
|
1271
|
+
function getDataViewMemory0() {
|
|
1272
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1273
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1274
|
+
}
|
|
1275
|
+
return cachedDataViewMemory0;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
function getStringFromWasm0(ptr, len) {
|
|
1279
|
+
ptr = ptr >>> 0;
|
|
1280
|
+
return decodeText(ptr, len);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1284
|
+
function getUint8ArrayMemory0() {
|
|
1285
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1286
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1287
|
+
}
|
|
1288
|
+
return cachedUint8ArrayMemory0;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
function handleError(f, args) {
|
|
1292
|
+
try {
|
|
1293
|
+
return f.apply(this, args);
|
|
1294
|
+
} catch (e) {
|
|
1295
|
+
const idx = addToExternrefTable0(e);
|
|
1296
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
function isLikeNone(x) {
|
|
1301
|
+
return x === undefined || x === null;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
1305
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
1306
|
+
const real = (...args) => {
|
|
1307
|
+
|
|
1308
|
+
// First up with a closure we increment the internal reference
|
|
1309
|
+
// count. This ensures that the Rust closure environment won't
|
|
1310
|
+
// be deallocated while we're invoking it.
|
|
1311
|
+
state.cnt++;
|
|
1312
|
+
const a = state.a;
|
|
1313
|
+
state.a = 0;
|
|
1314
|
+
try {
|
|
1315
|
+
return f(a, state.b, ...args);
|
|
1316
|
+
} finally {
|
|
1317
|
+
state.a = a;
|
|
1318
|
+
real._wbg_cb_unref();
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
real._wbg_cb_unref = () => {
|
|
1322
|
+
if (--state.cnt === 0) {
|
|
1323
|
+
state.dtor(state.a, state.b);
|
|
1324
|
+
state.a = 0;
|
|
1325
|
+
CLOSURE_DTORS.unregister(state);
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
1329
|
+
return real;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1333
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1334
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1335
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1336
|
+
return ptr;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1340
|
+
if (realloc === undefined) {
|
|
1341
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1342
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1343
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1344
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1345
|
+
return ptr;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
let len = arg.length;
|
|
1349
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1350
|
+
|
|
1351
|
+
const mem = getUint8ArrayMemory0();
|
|
1352
|
+
|
|
1353
|
+
let offset = 0;
|
|
1354
|
+
|
|
1355
|
+
for (; offset < len; offset++) {
|
|
1356
|
+
const code = arg.charCodeAt(offset);
|
|
1357
|
+
if (code > 0x7F) break;
|
|
1358
|
+
mem[ptr + offset] = code;
|
|
1359
|
+
}
|
|
1360
|
+
if (offset !== len) {
|
|
1361
|
+
if (offset !== 0) {
|
|
1362
|
+
arg = arg.slice(offset);
|
|
1363
|
+
}
|
|
1364
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1365
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1366
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1367
|
+
|
|
1368
|
+
offset += ret.written;
|
|
1369
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
WASM_VECTOR_LEN = offset;
|
|
1373
|
+
return ptr;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
function takeFromExternrefTable0(idx) {
|
|
1377
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1378
|
+
wasm.__externref_table_dealloc(idx);
|
|
1379
|
+
return value;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1383
|
+
cachedTextDecoder.decode();
|
|
1384
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1385
|
+
let numBytesDecoded = 0;
|
|
1386
|
+
function decodeText(ptr, len) {
|
|
1387
|
+
numBytesDecoded += len;
|
|
1388
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1389
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1390
|
+
cachedTextDecoder.decode();
|
|
1391
|
+
numBytesDecoded = len;
|
|
1392
|
+
}
|
|
1393
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1396
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1397
|
+
|
|
1398
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1399
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1400
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1401
|
+
view.set(buf);
|
|
1402
|
+
return {
|
|
1403
|
+
read: arg.length,
|
|
1404
|
+
written: buf.length
|
|
1405
|
+
};
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
let WASM_VECTOR_LEN = 0;
|
|
1410
|
+
|
|
1411
|
+
let wasmModule, wasm;
|
|
1412
|
+
function __wbg_finalize_init(instance, module) {
|
|
1413
|
+
wasm = instance.exports;
|
|
1414
|
+
wasmModule = module;
|
|
1415
|
+
cachedDataViewMemory0 = null;
|
|
1416
|
+
cachedUint8ArrayMemory0 = null;
|
|
1417
|
+
wasm.__wbindgen_start();
|
|
1418
|
+
return wasm;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
async function __wbg_load(module, imports) {
|
|
1422
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1423
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1424
|
+
try {
|
|
1425
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1426
|
+
} catch (e) {
|
|
1427
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1428
|
+
|
|
1429
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1430
|
+
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);
|
|
1431
|
+
|
|
1432
|
+
} else { throw e; }
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
const bytes = await module.arrayBuffer();
|
|
1437
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1438
|
+
} else {
|
|
1439
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1440
|
+
|
|
1441
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1442
|
+
return { instance, module };
|
|
1443
|
+
} else {
|
|
1444
|
+
return instance;
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
function expectedResponseType(type) {
|
|
1449
|
+
switch (type) {
|
|
1450
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1451
|
+
}
|
|
1452
|
+
return false;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
function initSync(module) {
|
|
1457
|
+
if (wasm !== undefined) return wasm;
|
|
1458
|
+
|
|
1459
|
+
|
|
1460
|
+
if (module !== undefined) {
|
|
1461
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1462
|
+
({module} = module)
|
|
1463
|
+
} else {
|
|
1464
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
const imports = __wbg_get_imports();
|
|
1469
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1470
|
+
module = new WebAssembly.Module(module);
|
|
1471
|
+
}
|
|
1472
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1473
|
+
return __wbg_finalize_init(instance, module);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
async function __wbg_init(module_or_path) {
|
|
1477
|
+
if (wasm !== undefined) return wasm;
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
if (module_or_path !== undefined) {
|
|
1481
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1482
|
+
({module_or_path} = module_or_path)
|
|
1483
|
+
} else {
|
|
1484
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
if (module_or_path === undefined) {
|
|
1489
|
+
module_or_path = new URL('taladb_web_bg.wasm', import.meta.url);
|
|
1490
|
+
}
|
|
1491
|
+
const imports = __wbg_get_imports();
|
|
1492
|
+
|
|
1493
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1494
|
+
module_or_path = fetch(module_or_path);
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1498
|
+
|
|
1499
|
+
return __wbg_finalize_init(instance, module);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
export { initSync, __wbg_init as default };
|