@laboverwire/stitch-wasm 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.
@@ -0,0 +1,3536 @@
1
+ export class ConnectOptions {
2
+ __destroy_into_raw() {
3
+ const ptr = this.__wbg_ptr;
4
+ this.__wbg_ptr = 0;
5
+ ConnectOptionsFinalization.unregister(this);
6
+ return ptr;
7
+ }
8
+ free() {
9
+ const ptr = this.__destroy_into_raw();
10
+ wasm.__wbg_connectoptions_free(ptr, 0);
11
+ }
12
+ /**
13
+ * @param {string} url
14
+ */
15
+ addBackupUrl(url) {
16
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
17
+ const len0 = WASM_VECTOR_LEN;
18
+ wasm.connectoptions_addBackupUrl(this.__wbg_ptr, ptr0, len0);
19
+ }
20
+ /**
21
+ * @param {string} key
22
+ * @param {string} value
23
+ */
24
+ addUserProperty(key, value) {
25
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
26
+ const len0 = WASM_VECTOR_LEN;
27
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
28
+ const len1 = WASM_VECTOR_LEN;
29
+ wasm.connectoptions_addUserProperty(this.__wbg_ptr, ptr0, len0, ptr1, len1);
30
+ }
31
+ /**
32
+ * @returns {string | undefined}
33
+ */
34
+ get authenticationMethod() {
35
+ const ret = wasm.connectoptions_authenticationMethod(this.__wbg_ptr);
36
+ let v1;
37
+ if (ret[0] !== 0) {
38
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
39
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
40
+ }
41
+ return v1;
42
+ }
43
+ /**
44
+ * @returns {boolean}
45
+ */
46
+ get cleanStart() {
47
+ const ret = wasm.connectoptions_cleanStart(this.__wbg_ptr);
48
+ return ret !== 0;
49
+ }
50
+ clearBackupUrls() {
51
+ wasm.connectoptions_clearBackupUrls(this.__wbg_ptr);
52
+ }
53
+ clearUserProperties() {
54
+ wasm.connectoptions_clearUserProperties(this.__wbg_ptr);
55
+ }
56
+ clearWill() {
57
+ wasm.connectoptions_clearWill(this.__wbg_ptr);
58
+ }
59
+ /**
60
+ * @returns {string[]}
61
+ */
62
+ getBackupUrls() {
63
+ const ret = wasm.connectoptions_getBackupUrls(this.__wbg_ptr);
64
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
65
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
66
+ return v1;
67
+ }
68
+ /**
69
+ * @returns {number}
70
+ */
71
+ get keepAlive() {
72
+ const ret = wasm.connectoptions_keepAlive(this.__wbg_ptr);
73
+ return ret;
74
+ }
75
+ /**
76
+ * @returns {number | undefined}
77
+ */
78
+ get maximumPacketSize() {
79
+ const ret = wasm.connectoptions_maximumPacketSize(this.__wbg_ptr);
80
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
81
+ }
82
+ constructor() {
83
+ const ret = wasm.connectoptions_new();
84
+ this.__wbg_ptr = ret;
85
+ ConnectOptionsFinalization.register(this, this.__wbg_ptr, this);
86
+ return this;
87
+ }
88
+ /**
89
+ * @returns {number}
90
+ */
91
+ get protocolVersion() {
92
+ const ret = wasm.connectoptions_protocolVersion(this.__wbg_ptr);
93
+ return ret;
94
+ }
95
+ /**
96
+ * @returns {number | undefined}
97
+ */
98
+ get receiveMaximum() {
99
+ const ret = wasm.connectoptions_receiveMaximum(this.__wbg_ptr);
100
+ return ret === 0xFFFFFF ? undefined : ret;
101
+ }
102
+ /**
103
+ * @returns {boolean | undefined}
104
+ */
105
+ get requestProblemInformation() {
106
+ const ret = wasm.connectoptions_requestProblemInformation(this.__wbg_ptr);
107
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
108
+ }
109
+ /**
110
+ * @returns {boolean | undefined}
111
+ */
112
+ get requestResponseInformation() {
113
+ const ret = wasm.connectoptions_requestResponseInformation(this.__wbg_ptr);
114
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
115
+ }
116
+ /**
117
+ * @returns {number | undefined}
118
+ */
119
+ get sessionExpiryInterval() {
120
+ const ret = wasm.connectoptions_sessionExpiryInterval(this.__wbg_ptr);
121
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
122
+ }
123
+ /**
124
+ * @param {WillMessage} will
125
+ */
126
+ setWill(will) {
127
+ _assertClass(will, WillMessage);
128
+ var ptr0 = will.__destroy_into_raw();
129
+ wasm.connectoptions_setWill(this.__wbg_ptr, ptr0);
130
+ }
131
+ /**
132
+ * @param {Uint8Array} value
133
+ */
134
+ set authenticationData(value) {
135
+ const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
136
+ const len0 = WASM_VECTOR_LEN;
137
+ wasm.connectoptions_set_authenticationData(this.__wbg_ptr, ptr0, len0);
138
+ }
139
+ /**
140
+ * @param {string | null} [value]
141
+ */
142
+ set authenticationMethod(value) {
143
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
144
+ var len0 = WASM_VECTOR_LEN;
145
+ wasm.connectoptions_set_authenticationMethod(this.__wbg_ptr, ptr0, len0);
146
+ }
147
+ /**
148
+ * @param {boolean} value
149
+ */
150
+ set cleanStart(value) {
151
+ wasm.connectoptions_set_cleanStart(this.__wbg_ptr, value);
152
+ }
153
+ /**
154
+ * @param {number} value
155
+ */
156
+ set keepAlive(value) {
157
+ wasm.connectoptions_set_keepAlive(this.__wbg_ptr, value);
158
+ }
159
+ /**
160
+ * @param {number | null} [value]
161
+ */
162
+ set maximumPacketSize(value) {
163
+ wasm.connectoptions_set_maximumPacketSize(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
164
+ }
165
+ /**
166
+ * @param {Uint8Array} value
167
+ */
168
+ set password(value) {
169
+ const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
170
+ const len0 = WASM_VECTOR_LEN;
171
+ wasm.connectoptions_set_password(this.__wbg_ptr, ptr0, len0);
172
+ }
173
+ /**
174
+ * @param {number} value
175
+ */
176
+ set protocolVersion(value) {
177
+ wasm.connectoptions_set_protocolVersion(this.__wbg_ptr, value);
178
+ }
179
+ /**
180
+ * @param {number | null} [value]
181
+ */
182
+ set receiveMaximum(value) {
183
+ wasm.connectoptions_set_receiveMaximum(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value);
184
+ }
185
+ /**
186
+ * @param {boolean | null} [value]
187
+ */
188
+ set requestProblemInformation(value) {
189
+ wasm.connectoptions_set_requestProblemInformation(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
190
+ }
191
+ /**
192
+ * @param {boolean | null} [value]
193
+ */
194
+ set requestResponseInformation(value) {
195
+ wasm.connectoptions_set_requestResponseInformation(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
196
+ }
197
+ /**
198
+ * @param {number | null} [value]
199
+ */
200
+ set sessionExpiryInterval(value) {
201
+ wasm.connectoptions_set_sessionExpiryInterval(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
202
+ }
203
+ /**
204
+ * @param {number | null} [value]
205
+ */
206
+ set topicAliasMaximum(value) {
207
+ wasm.connectoptions_set_topicAliasMaximum(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value);
208
+ }
209
+ /**
210
+ * @param {string | null} [value]
211
+ */
212
+ set username(value) {
213
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
214
+ var len0 = WASM_VECTOR_LEN;
215
+ wasm.connectoptions_set_username(this.__wbg_ptr, ptr0, len0);
216
+ }
217
+ /**
218
+ * @returns {number | undefined}
219
+ */
220
+ get topicAliasMaximum() {
221
+ const ret = wasm.connectoptions_topicAliasMaximum(this.__wbg_ptr);
222
+ return ret === 0xFFFFFF ? undefined : ret;
223
+ }
224
+ /**
225
+ * @returns {string | undefined}
226
+ */
227
+ get username() {
228
+ const ret = wasm.connectoptions_username(this.__wbg_ptr);
229
+ let v1;
230
+ if (ret[0] !== 0) {
231
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
232
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
233
+ }
234
+ return v1;
235
+ }
236
+ }
237
+ if (Symbol.dispose) ConnectOptions.prototype[Symbol.dispose] = ConnectOptions.prototype.free;
238
+
239
+ export class Cursor {
240
+ static __wrap(ptr) {
241
+ const obj = Object.create(Cursor.prototype);
242
+ obj.__wbg_ptr = ptr;
243
+ CursorFinalization.register(obj, obj.__wbg_ptr, obj);
244
+ return obj;
245
+ }
246
+ __destroy_into_raw() {
247
+ const ptr = this.__wbg_ptr;
248
+ this.__wbg_ptr = 0;
249
+ CursorFinalization.unregister(this);
250
+ return ptr;
251
+ }
252
+ free() {
253
+ const ptr = this.__destroy_into_raw();
254
+ wasm.__wbg_cursor_free(ptr, 0);
255
+ }
256
+ /**
257
+ * @returns {number}
258
+ */
259
+ count() {
260
+ const ret = wasm.cursor_count(this.__wbg_ptr);
261
+ return ret >>> 0;
262
+ }
263
+ /**
264
+ * @returns {boolean}
265
+ */
266
+ hasMore() {
267
+ const ret = wasm.cursor_hasMore(this.__wbg_ptr);
268
+ return ret !== 0;
269
+ }
270
+ /**
271
+ * Returns up to N items from the cursor as an array.
272
+ *
273
+ * # Errors
274
+ * Returns an error if serialization fails.
275
+ * @param {number} size
276
+ * @returns {any}
277
+ */
278
+ nextBatch(size) {
279
+ const ret = wasm.cursor_nextBatch(this.__wbg_ptr, size);
280
+ if (ret[2]) {
281
+ throw takeFromExternrefTable0(ret[1]);
282
+ }
283
+ return takeFromExternrefTable0(ret[0]);
284
+ }
285
+ /**
286
+ * Returns the next item from the cursor.
287
+ *
288
+ * # Errors
289
+ * Returns an error if serialization fails.
290
+ * @returns {any}
291
+ */
292
+ nextItem() {
293
+ const ret = wasm.cursor_nextItem(this.__wbg_ptr);
294
+ if (ret[2]) {
295
+ throw takeFromExternrefTable0(ret[1]);
296
+ }
297
+ return takeFromExternrefTable0(ret[0]);
298
+ }
299
+ /**
300
+ * @returns {number}
301
+ */
302
+ position() {
303
+ const ret = wasm.cursor_position(this.__wbg_ptr);
304
+ return ret >>> 0;
305
+ }
306
+ reset() {
307
+ wasm.cursor_reset(this.__wbg_ptr);
308
+ }
309
+ }
310
+ if (Symbol.dispose) Cursor.prototype[Symbol.dispose] = Cursor.prototype.free;
311
+
312
+ export class Database {
313
+ static __wrap(ptr) {
314
+ const obj = Object.create(Database.prototype);
315
+ obj.__wbg_ptr = ptr;
316
+ DatabaseFinalization.register(obj, obj.__wbg_ptr, obj);
317
+ return obj;
318
+ }
319
+ __destroy_into_raw() {
320
+ const ptr = this.__wbg_ptr;
321
+ this.__wbg_ptr = 0;
322
+ DatabaseFinalization.unregister(this);
323
+ return ptr;
324
+ }
325
+ free() {
326
+ const ptr = this.__destroy_into_raw();
327
+ wasm.__wbg_database_free(ptr, 0);
328
+ }
329
+ /**
330
+ * Adds a foreign key constraint.
331
+ *
332
+ * # Errors
333
+ * This function does not currently return errors but the signature allows for future validation.
334
+ * @param {string} source_entity
335
+ * @param {string} source_field
336
+ * @param {string} target_entity
337
+ * @param {string} target_field
338
+ * @param {string} on_delete
339
+ */
340
+ addForeignKey(source_entity, source_field, target_entity, target_field, on_delete) {
341
+ const ptr0 = passStringToWasm0(source_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ const ptr1 = passStringToWasm0(source_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
344
+ const len1 = WASM_VECTOR_LEN;
345
+ const ptr2 = passStringToWasm0(target_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
346
+ const len2 = WASM_VECTOR_LEN;
347
+ const ptr3 = passStringToWasm0(target_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
+ const len3 = WASM_VECTOR_LEN;
349
+ const ptr4 = passStringToWasm0(on_delete, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
+ const len4 = WASM_VECTOR_LEN;
351
+ const ret = wasm.database_addForeignKey(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
352
+ if (ret[1]) {
353
+ throw takeFromExternrefTable0(ret[0]);
354
+ }
355
+ }
356
+ /**
357
+ * Adds a foreign key constraint and persists to storage.
358
+ *
359
+ * # Errors
360
+ * Returns an error if storage fails.
361
+ * @param {string} source_entity
362
+ * @param {string} source_field
363
+ * @param {string} target_entity
364
+ * @param {string} target_field
365
+ * @param {string} on_delete
366
+ * @returns {Promise<void>}
367
+ */
368
+ addForeignKeyAsync(source_entity, source_field, target_entity, target_field, on_delete) {
369
+ const ptr0 = passStringToWasm0(source_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
370
+ const len0 = WASM_VECTOR_LEN;
371
+ const ptr1 = passStringToWasm0(source_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
372
+ const len1 = WASM_VECTOR_LEN;
373
+ const ptr2 = passStringToWasm0(target_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
374
+ const len2 = WASM_VECTOR_LEN;
375
+ const ptr3 = passStringToWasm0(target_field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
376
+ const len3 = WASM_VECTOR_LEN;
377
+ const ptr4 = passStringToWasm0(on_delete, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
378
+ const len4 = WASM_VECTOR_LEN;
379
+ const ret = wasm.database_addForeignKeyAsync(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
380
+ return ret;
381
+ }
382
+ /**
383
+ * Adds an index on the specified fields and backfills from existing records (sync, memory only).
384
+ *
385
+ * # Errors
386
+ * Returns an error if the backend is not memory-based or backfill fails.
387
+ * @param {string} entity
388
+ * @param {string[]} fields
389
+ */
390
+ addIndex(entity, fields) {
391
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
392
+ const len0 = WASM_VECTOR_LEN;
393
+ const ptr1 = passArrayJsValueToWasm0(fields, wasm.__wbindgen_malloc);
394
+ const len1 = WASM_VECTOR_LEN;
395
+ const ret = wasm.database_addIndex(this.__wbg_ptr, ptr0, len0, ptr1, len1);
396
+ if (ret[1]) {
397
+ throw takeFromExternrefTable0(ret[0]);
398
+ }
399
+ }
400
+ /**
401
+ * Adds an index on the specified fields and backfills from existing records (async).
402
+ *
403
+ * # Errors
404
+ * Returns an error if the storage operation fails during backfill.
405
+ * @param {string} entity
406
+ * @param {string[]} fields
407
+ * @returns {Promise<void>}
408
+ */
409
+ addIndexAsync(entity, fields) {
410
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
411
+ const len0 = WASM_VECTOR_LEN;
412
+ const ptr1 = passArrayJsValueToWasm0(fields, wasm.__wbindgen_malloc);
413
+ const len1 = WASM_VECTOR_LEN;
414
+ const ret = wasm.database_addIndexAsync(this.__wbg_ptr, ptr0, len0, ptr1, len1);
415
+ return ret;
416
+ }
417
+ /**
418
+ * Adds a NOT NULL constraint on the specified field.
419
+ *
420
+ * # Errors
421
+ * This function does not currently return errors but the signature allows for future validation.
422
+ * @param {string} entity
423
+ * @param {string} field
424
+ */
425
+ addNotNull(entity, field) {
426
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
427
+ const len0 = WASM_VECTOR_LEN;
428
+ const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
429
+ const len1 = WASM_VECTOR_LEN;
430
+ const ret = wasm.database_addNotNull(this.__wbg_ptr, ptr0, len0, ptr1, len1);
431
+ if (ret[1]) {
432
+ throw takeFromExternrefTable0(ret[0]);
433
+ }
434
+ }
435
+ /**
436
+ * Adds a NOT NULL constraint and persists to storage.
437
+ *
438
+ * # Errors
439
+ * Returns an error if storage fails.
440
+ * @param {string} entity
441
+ * @param {string} field
442
+ * @returns {Promise<void>}
443
+ */
444
+ addNotNullAsync(entity, field) {
445
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
446
+ const len0 = WASM_VECTOR_LEN;
447
+ const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
448
+ const len1 = WASM_VECTOR_LEN;
449
+ const ret = wasm.database_addNotNullAsync(this.__wbg_ptr, ptr0, len0, ptr1, len1);
450
+ return ret;
451
+ }
452
+ /**
453
+ * Adds a relationship definition for eager loading.
454
+ *
455
+ * # Errors
456
+ * This function does not currently return errors but the signature allows for future validation.
457
+ * @param {string} source_entity
458
+ * @param {string} field
459
+ * @param {string} target_entity
460
+ */
461
+ addRelationship(source_entity, field, target_entity) {
462
+ const ptr0 = passStringToWasm0(source_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
463
+ const len0 = WASM_VECTOR_LEN;
464
+ const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
+ const len1 = WASM_VECTOR_LEN;
466
+ const ptr2 = passStringToWasm0(target_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
467
+ const len2 = WASM_VECTOR_LEN;
468
+ const ret = wasm.database_addRelationship(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
469
+ if (ret[1]) {
470
+ throw takeFromExternrefTable0(ret[0]);
471
+ }
472
+ }
473
+ /**
474
+ * Adds a relationship definition and persists to storage.
475
+ *
476
+ * # Errors
477
+ * Returns an error if storage fails.
478
+ * @param {string} source_entity
479
+ * @param {string} field
480
+ * @param {string} target_entity
481
+ * @returns {Promise<void>}
482
+ */
483
+ addRelationshipAsync(source_entity, field, target_entity) {
484
+ const ptr0 = passStringToWasm0(source_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ptr1 = passStringToWasm0(field, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
487
+ const len1 = WASM_VECTOR_LEN;
488
+ const ptr2 = passStringToWasm0(target_entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
489
+ const len2 = WASM_VECTOR_LEN;
490
+ const ret = wasm.database_addRelationshipAsync(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
491
+ return ret;
492
+ }
493
+ /**
494
+ * Adds a schema definition for an entity (sync, memory backend only).
495
+ *
496
+ * # Errors
497
+ * Returns an error if the schema definition is invalid.
498
+ * @param {string} entity
499
+ * @param {any} schema_js
500
+ */
501
+ addSchema(entity, schema_js) {
502
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
503
+ const len0 = WASM_VECTOR_LEN;
504
+ const ret = wasm.database_addSchema(this.__wbg_ptr, ptr0, len0, schema_js);
505
+ if (ret[1]) {
506
+ throw takeFromExternrefTable0(ret[0]);
507
+ }
508
+ }
509
+ /**
510
+ * Adds a schema definition for an entity and persists to storage.
511
+ *
512
+ * # Errors
513
+ * Returns an error if the schema definition is invalid or storage fails.
514
+ * @param {string} entity
515
+ * @param {any} schema_js
516
+ * @returns {Promise<void>}
517
+ */
518
+ addSchemaAsync(entity, schema_js) {
519
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
520
+ const len0 = WASM_VECTOR_LEN;
521
+ const ret = wasm.database_addSchemaAsync(this.__wbg_ptr, ptr0, len0, schema_js);
522
+ return ret;
523
+ }
524
+ /**
525
+ * Adds a unique constraint on the specified fields.
526
+ *
527
+ * # Errors
528
+ * This function does not currently return errors but the signature allows for future validation.
529
+ * @param {string} entity
530
+ * @param {string[]} fields
531
+ */
532
+ addUniqueConstraint(entity, fields) {
533
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
534
+ const len0 = WASM_VECTOR_LEN;
535
+ const ptr1 = passArrayJsValueToWasm0(fields, wasm.__wbindgen_malloc);
536
+ const len1 = WASM_VECTOR_LEN;
537
+ const ret = wasm.database_addUniqueConstraint(this.__wbg_ptr, ptr0, len0, ptr1, len1);
538
+ if (ret[1]) {
539
+ throw takeFromExternrefTable0(ret[0]);
540
+ }
541
+ }
542
+ /**
543
+ * Adds a unique constraint and persists to storage.
544
+ *
545
+ * # Errors
546
+ * Returns an error if storage fails.
547
+ * @param {string} entity
548
+ * @param {string[]} fields
549
+ * @returns {Promise<void>}
550
+ */
551
+ addUniqueConstraintAsync(entity, fields) {
552
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
553
+ const len0 = WASM_VECTOR_LEN;
554
+ const ptr1 = passArrayJsValueToWasm0(fields, wasm.__wbindgen_malloc);
555
+ const len1 = WASM_VECTOR_LEN;
556
+ const ret = wasm.database_addUniqueConstraintAsync(this.__wbg_ptr, ptr0, len0, ptr1, len1);
557
+ return ret;
558
+ }
559
+ /**
560
+ * Counts records matching optional filters, using indexes when available.
561
+ *
562
+ * # Errors
563
+ * Returns an error if options are invalid or the storage operation fails.
564
+ * @param {string} entity
565
+ * @param {any} options
566
+ * @returns {Promise<number>}
567
+ */
568
+ count(entity, options) {
569
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
570
+ const len0 = WASM_VECTOR_LEN;
571
+ const ret = wasm.database_count(this.__wbg_ptr, ptr0, len0, options);
572
+ return ret;
573
+ }
574
+ /**
575
+ * # Errors
576
+ * Returns an error if options are invalid or the backend is not memory-based.
577
+ * @param {string} entity
578
+ * @param {any} options
579
+ * @returns {number}
580
+ */
581
+ countSync(entity, options) {
582
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
583
+ const len0 = WASM_VECTOR_LEN;
584
+ const ret = wasm.database_countSync(this.__wbg_ptr, ptr0, len0, options);
585
+ if (ret[2]) {
586
+ throw takeFromExternrefTable0(ret[1]);
587
+ }
588
+ return ret[0] >>> 0;
589
+ }
590
+ /**
591
+ * Creates a new record in the specified entity.
592
+ *
593
+ * # Errors
594
+ * Returns an error if validation fails or the storage operation fails.
595
+ * @param {string} entity
596
+ * @param {any} data
597
+ * @returns {Promise<any>}
598
+ */
599
+ create(entity, data) {
600
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
601
+ const len0 = WASM_VECTOR_LEN;
602
+ const ret = wasm.database_create(this.__wbg_ptr, ptr0, len0, data);
603
+ return ret;
604
+ }
605
+ /**
606
+ * # Errors
607
+ * Returns an error if validation fails or the backend is not memory-based.
608
+ * @param {string} entity
609
+ * @param {any} data
610
+ * @returns {any}
611
+ */
612
+ createSync(entity, data) {
613
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
614
+ const len0 = WASM_VECTOR_LEN;
615
+ const ret = wasm.database_createSync(this.__wbg_ptr, ptr0, len0, data);
616
+ if (ret[2]) {
617
+ throw takeFromExternrefTable0(ret[1]);
618
+ }
619
+ return takeFromExternrefTable0(ret[0]);
620
+ }
621
+ /**
622
+ * Creates a cursor for streaming iteration over records.
623
+ *
624
+ * # Errors
625
+ * Returns an error if options are invalid or the storage operation fails.
626
+ * @param {string} entity
627
+ * @param {any} options
628
+ * @returns {Promise<Cursor>}
629
+ */
630
+ cursor(entity, options) {
631
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
632
+ const len0 = WASM_VECTOR_LEN;
633
+ const ret = wasm.database_cursor(this.__wbg_ptr, ptr0, len0, options);
634
+ return ret;
635
+ }
636
+ /**
637
+ * Deletes a record by entity and ID.
638
+ *
639
+ * # Errors
640
+ * Returns an error if the record is not found or foreign key constraints prevent deletion.
641
+ * @param {string} entity
642
+ * @param {string} id
643
+ * @returns {Promise<void>}
644
+ */
645
+ delete(entity, id) {
646
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
647
+ const len0 = WASM_VECTOR_LEN;
648
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
649
+ const len1 = WASM_VECTOR_LEN;
650
+ const ret = wasm.database_delete(this.__wbg_ptr, ptr0, len0, ptr1, len1);
651
+ return ret;
652
+ }
653
+ /**
654
+ * # Errors
655
+ * Returns an error if the record is not found, foreign key constraints prevent deletion, or the backend is not memory-based.
656
+ * @param {string} entity
657
+ * @param {string} id
658
+ */
659
+ deleteSync(entity, id) {
660
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
661
+ const len0 = WASM_VECTOR_LEN;
662
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
663
+ const len1 = WASM_VECTOR_LEN;
664
+ const ret = wasm.database_deleteSync(this.__wbg_ptr, ptr0, len0, ptr1, len1);
665
+ if (ret[1]) {
666
+ throw takeFromExternrefTable0(ret[0]);
667
+ }
668
+ }
669
+ /**
670
+ * Executes a database operation based on an MQTT-style topic.
671
+ *
672
+ * # Errors
673
+ * Returns an error if the topic is invalid or the operation fails.
674
+ * @param {string} topic
675
+ * @param {any} payload
676
+ * @returns {Promise<any>}
677
+ */
678
+ execute(topic, payload) {
679
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
680
+ const len0 = WASM_VECTOR_LEN;
681
+ const ret = wasm.database_execute(this.__wbg_ptr, ptr0, len0, payload);
682
+ return ret;
683
+ }
684
+ /**
685
+ * # Errors
686
+ * Returns `JsValue` if the database is currently borrowed.
687
+ * @param {string} group_name
688
+ * @returns {any}
689
+ */
690
+ getConsumerGroup(group_name) {
691
+ const ptr0 = passStringToWasm0(group_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
692
+ const len0 = WASM_VECTOR_LEN;
693
+ const ret = wasm.database_getConsumerGroup(this.__wbg_ptr, ptr0, len0);
694
+ if (ret[2]) {
695
+ throw takeFromExternrefTable0(ret[1]);
696
+ }
697
+ return takeFromExternrefTable0(ret[0]);
698
+ }
699
+ /**
700
+ * Gets the schema definition for an entity.
701
+ *
702
+ * # Errors
703
+ * Returns an error if serialization fails.
704
+ * @param {string} entity
705
+ * @returns {any}
706
+ */
707
+ getSchema(entity) {
708
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
709
+ const len0 = WASM_VECTOR_LEN;
710
+ const ret = wasm.database_getSchema(this.__wbg_ptr, ptr0, len0);
711
+ if (ret[2]) {
712
+ throw takeFromExternrefTable0(ret[1]);
713
+ }
714
+ return takeFromExternrefTable0(ret[0]);
715
+ }
716
+ /**
717
+ * # Errors
718
+ * Returns `JsValue` if the database is currently borrowed.
719
+ * @param {string} sub_id
720
+ * @returns {any}
721
+ */
722
+ getSubscriptionInfo(sub_id) {
723
+ const ptr0 = passStringToWasm0(sub_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
724
+ const len0 = WASM_VECTOR_LEN;
725
+ const ret = wasm.database_getSubscriptionInfo(this.__wbg_ptr, ptr0, len0);
726
+ if (ret[2]) {
727
+ throw takeFromExternrefTable0(ret[1]);
728
+ }
729
+ return takeFromExternrefTable0(ret[0]);
730
+ }
731
+ /**
732
+ * # Errors
733
+ * Returns `JsValue` if the database is currently borrowed.
734
+ * @param {string} sub_id
735
+ * @returns {boolean}
736
+ */
737
+ heartbeat(sub_id) {
738
+ const ptr0 = passStringToWasm0(sub_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
739
+ const len0 = WASM_VECTOR_LEN;
740
+ const ret = wasm.database_heartbeat(this.__wbg_ptr, ptr0, len0);
741
+ if (ret[2]) {
742
+ throw takeFromExternrefTable0(ret[1]);
743
+ }
744
+ return ret[0] !== 0;
745
+ }
746
+ /**
747
+ * @returns {boolean}
748
+ */
749
+ isMemoryBackend() {
750
+ const ret = wasm.database_isMemoryBackend(this.__wbg_ptr);
751
+ return ret !== 0;
752
+ }
753
+ /**
754
+ * Lists records from an entity with optional filtering, sorting, and pagination.
755
+ *
756
+ * # Errors
757
+ * Returns an error if options are invalid or the storage operation fails.
758
+ * @param {string} entity
759
+ * @param {any} options
760
+ * @returns {Promise<any>}
761
+ */
762
+ list(entity, options) {
763
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
764
+ const len0 = WASM_VECTOR_LEN;
765
+ const ret = wasm.database_list(this.__wbg_ptr, ptr0, len0, options);
766
+ return ret;
767
+ }
768
+ /**
769
+ * @param {string} entity
770
+ * @returns {any}
771
+ */
772
+ listConstraints(entity) {
773
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
774
+ const len0 = WASM_VECTOR_LEN;
775
+ const ret = wasm.database_listConstraints(this.__wbg_ptr, ptr0, len0);
776
+ return ret;
777
+ }
778
+ /**
779
+ * # Errors
780
+ * Returns `JsValue` if the database is currently borrowed.
781
+ * @returns {any}
782
+ */
783
+ listConsumerGroups() {
784
+ const ret = wasm.database_listConsumerGroups(this.__wbg_ptr);
785
+ if (ret[2]) {
786
+ throw takeFromExternrefTable0(ret[1]);
787
+ }
788
+ return takeFromExternrefTable0(ret[0]);
789
+ }
790
+ /**
791
+ * @param {string} entity
792
+ * @returns {any}
793
+ */
794
+ listRelationships(entity) {
795
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
796
+ const len0 = WASM_VECTOR_LEN;
797
+ const ret = wasm.database_listRelationships(this.__wbg_ptr, ptr0, len0);
798
+ return ret;
799
+ }
800
+ /**
801
+ * # Errors
802
+ * Returns an error if options are invalid or the backend is not memory-based.
803
+ * @param {string} entity
804
+ * @param {any} options
805
+ * @returns {any}
806
+ */
807
+ listSync(entity, options) {
808
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
809
+ const len0 = WASM_VECTOR_LEN;
810
+ const ret = wasm.database_listSync(this.__wbg_ptr, ptr0, len0, options);
811
+ if (ret[2]) {
812
+ throw takeFromExternrefTable0(ret[1]);
813
+ }
814
+ return takeFromExternrefTable0(ret[0]);
815
+ }
816
+ constructor() {
817
+ const ret = wasm.database_new();
818
+ this.__wbg_ptr = ret;
819
+ DatabaseFinalization.register(this, this.__wbg_ptr, this);
820
+ return this;
821
+ }
822
+ /**
823
+ * @param {string} db_name
824
+ * @param {string} passphrase
825
+ * @returns {Promise<Database>}
826
+ */
827
+ static openEncrypted(db_name, passphrase) {
828
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
829
+ const len0 = WASM_VECTOR_LEN;
830
+ const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
831
+ const len1 = WASM_VECTOR_LEN;
832
+ const ret = wasm.database_openEncrypted(ptr0, len0, ptr1, len1);
833
+ return ret;
834
+ }
835
+ /**
836
+ * @param {string} db_name
837
+ * @returns {Promise<Database>}
838
+ */
839
+ static openPersistent(db_name) {
840
+ const ptr0 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
841
+ const len0 = WASM_VECTOR_LEN;
842
+ const ret = wasm.database_openPersistent(ptr0, len0);
843
+ return ret;
844
+ }
845
+ /**
846
+ * Reads a record by entity and ID.
847
+ *
848
+ * # Errors
849
+ * Returns an error if the record is not found or deserialization fails.
850
+ * @param {string} entity
851
+ * @param {string} id
852
+ * @returns {Promise<any>}
853
+ */
854
+ read(entity, id) {
855
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
856
+ const len0 = WASM_VECTOR_LEN;
857
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
858
+ const len1 = WASM_VECTOR_LEN;
859
+ const ret = wasm.database_read(this.__wbg_ptr, ptr0, len0, ptr1, len1);
860
+ return ret;
861
+ }
862
+ /**
863
+ * # Errors
864
+ * Returns an error if the record is not found or the backend is not memory-based.
865
+ * @param {string} entity
866
+ * @param {string} id
867
+ * @returns {any}
868
+ */
869
+ readSync(entity, id) {
870
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
871
+ const len0 = WASM_VECTOR_LEN;
872
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
873
+ const len1 = WASM_VECTOR_LEN;
874
+ const ret = wasm.database_readSync(this.__wbg_ptr, ptr0, len0, ptr1, len1);
875
+ if (ret[2]) {
876
+ throw takeFromExternrefTable0(ret[1]);
877
+ }
878
+ return takeFromExternrefTable0(ret[0]);
879
+ }
880
+ /**
881
+ * Reads a record with related entities eagerly loaded.
882
+ *
883
+ * # Errors
884
+ * Returns an error if the record is not found or includes cannot be loaded.
885
+ * @param {string} entity
886
+ * @param {string} id
887
+ * @param {any} includes
888
+ * @returns {Promise<any>}
889
+ */
890
+ readWithIncludes(entity, id, includes) {
891
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
892
+ const len0 = WASM_VECTOR_LEN;
893
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
894
+ const len1 = WASM_VECTOR_LEN;
895
+ const ret = wasm.database_readWithIncludes(this.__wbg_ptr, ptr0, len0, ptr1, len1, includes);
896
+ return ret;
897
+ }
898
+ /**
899
+ * # Errors
900
+ * Returns `JsValue` if the database is currently borrowed.
901
+ * @param {string} pattern
902
+ * @param {string | null | undefined} entity
903
+ * @param {Function} callback
904
+ * @returns {string}
905
+ */
906
+ subscribe(pattern, entity, callback) {
907
+ let deferred4_0;
908
+ let deferred4_1;
909
+ try {
910
+ const ptr0 = passStringToWasm0(pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
911
+ const len0 = WASM_VECTOR_LEN;
912
+ var ptr1 = isLikeNone(entity) ? 0 : passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
913
+ var len1 = WASM_VECTOR_LEN;
914
+ const ret = wasm.database_subscribe(this.__wbg_ptr, ptr0, len0, ptr1, len1, callback);
915
+ var ptr3 = ret[0];
916
+ var len3 = ret[1];
917
+ if (ret[3]) {
918
+ ptr3 = 0; len3 = 0;
919
+ throw takeFromExternrefTable0(ret[2]);
920
+ }
921
+ deferred4_0 = ptr3;
922
+ deferred4_1 = len3;
923
+ return getStringFromWasm0(ptr3, len3);
924
+ } finally {
925
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
926
+ }
927
+ }
928
+ /**
929
+ * # Errors
930
+ * Returns `JsValue` if the database is currently borrowed.
931
+ * @param {string} pattern
932
+ * @param {string | null | undefined} entity
933
+ * @param {string} group
934
+ * @param {string} mode
935
+ * @param {Function} callback
936
+ * @returns {string}
937
+ */
938
+ subscribeShared(pattern, entity, group, mode, callback) {
939
+ let deferred6_0;
940
+ let deferred6_1;
941
+ try {
942
+ const ptr0 = passStringToWasm0(pattern, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
943
+ const len0 = WASM_VECTOR_LEN;
944
+ var ptr1 = isLikeNone(entity) ? 0 : passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
945
+ var len1 = WASM_VECTOR_LEN;
946
+ const ptr2 = passStringToWasm0(group, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
947
+ const len2 = WASM_VECTOR_LEN;
948
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
949
+ const len3 = WASM_VECTOR_LEN;
950
+ const ret = wasm.database_subscribeShared(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, callback);
951
+ var ptr5 = ret[0];
952
+ var len5 = ret[1];
953
+ if (ret[3]) {
954
+ ptr5 = 0; len5 = 0;
955
+ throw takeFromExternrefTable0(ret[2]);
956
+ }
957
+ deferred6_0 = ptr5;
958
+ deferred6_1 = len5;
959
+ return getStringFromWasm0(ptr5, len5);
960
+ } finally {
961
+ wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
962
+ }
963
+ }
964
+ /**
965
+ * # Errors
966
+ * Returns `JsValue` if the database is currently borrowed.
967
+ * @param {string} sub_id
968
+ * @returns {boolean}
969
+ */
970
+ unsubscribe(sub_id) {
971
+ const ptr0 = passStringToWasm0(sub_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
972
+ const len0 = WASM_VECTOR_LEN;
973
+ const ret = wasm.database_unsubscribe(this.__wbg_ptr, ptr0, len0);
974
+ if (ret[2]) {
975
+ throw takeFromExternrefTable0(ret[1]);
976
+ }
977
+ return ret[0] !== 0;
978
+ }
979
+ /**
980
+ * Updates an existing record with new field values.
981
+ *
982
+ * # Errors
983
+ * Returns an error if the record is not found or validation fails.
984
+ * @param {string} entity
985
+ * @param {string} id
986
+ * @param {any} fields
987
+ * @returns {Promise<any>}
988
+ */
989
+ update(entity, id, fields) {
990
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
991
+ const len0 = WASM_VECTOR_LEN;
992
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
993
+ const len1 = WASM_VECTOR_LEN;
994
+ const ret = wasm.database_update(this.__wbg_ptr, ptr0, len0, ptr1, len1, fields);
995
+ return ret;
996
+ }
997
+ /**
998
+ * # Errors
999
+ * Returns an error if the record is not found, validation fails, or the backend is not memory-based.
1000
+ * @param {string} entity
1001
+ * @param {string} id
1002
+ * @param {any} fields
1003
+ * @returns {any}
1004
+ */
1005
+ updateSync(entity, id, fields) {
1006
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1007
+ const len0 = WASM_VECTOR_LEN;
1008
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1009
+ const len1 = WASM_VECTOR_LEN;
1010
+ const ret = wasm.database_updateSync(this.__wbg_ptr, ptr0, len0, ptr1, len1, fields);
1011
+ if (ret[2]) {
1012
+ throw takeFromExternrefTable0(ret[1]);
1013
+ }
1014
+ return takeFromExternrefTable0(ret[0]);
1015
+ }
1016
+ }
1017
+ if (Symbol.dispose) Database.prototype[Symbol.dispose] = Database.prototype.free;
1018
+
1019
+ export class MessageProperties {
1020
+ static __wrap(ptr) {
1021
+ const obj = Object.create(MessageProperties.prototype);
1022
+ obj.__wbg_ptr = ptr;
1023
+ MessagePropertiesFinalization.register(obj, obj.__wbg_ptr, obj);
1024
+ return obj;
1025
+ }
1026
+ __destroy_into_raw() {
1027
+ const ptr = this.__wbg_ptr;
1028
+ this.__wbg_ptr = 0;
1029
+ MessagePropertiesFinalization.unregister(this);
1030
+ return ptr;
1031
+ }
1032
+ free() {
1033
+ const ptr = this.__destroy_into_raw();
1034
+ wasm.__wbg_messageproperties_free(ptr, 0);
1035
+ }
1036
+ /**
1037
+ * @returns {string | undefined}
1038
+ */
1039
+ get contentType() {
1040
+ const ret = wasm.messageproperties_contentType(this.__wbg_ptr);
1041
+ let v1;
1042
+ if (ret[0] !== 0) {
1043
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1044
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1045
+ }
1046
+ return v1;
1047
+ }
1048
+ /**
1049
+ * @returns {Uint8Array | undefined}
1050
+ */
1051
+ get correlationData() {
1052
+ const ret = wasm.messageproperties_correlationData(this.__wbg_ptr);
1053
+ let v1;
1054
+ if (ret[0] !== 0) {
1055
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1056
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1057
+ }
1058
+ return v1;
1059
+ }
1060
+ /**
1061
+ * @returns {Array<any>}
1062
+ */
1063
+ getUserProperties() {
1064
+ const ret = wasm.messageproperties_getUserProperties(this.__wbg_ptr);
1065
+ return ret;
1066
+ }
1067
+ /**
1068
+ * @returns {number | undefined}
1069
+ */
1070
+ get messageExpiryInterval() {
1071
+ const ret = wasm.messageproperties_messageExpiryInterval(this.__wbg_ptr);
1072
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
1073
+ }
1074
+ /**
1075
+ * @returns {boolean | undefined}
1076
+ */
1077
+ get payloadFormatIndicator() {
1078
+ const ret = wasm.messageproperties_payloadFormatIndicator(this.__wbg_ptr);
1079
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
1080
+ }
1081
+ /**
1082
+ * @returns {string | undefined}
1083
+ */
1084
+ get responseTopic() {
1085
+ const ret = wasm.messageproperties_responseTopic(this.__wbg_ptr);
1086
+ let v1;
1087
+ if (ret[0] !== 0) {
1088
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1089
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1090
+ }
1091
+ return v1;
1092
+ }
1093
+ /**
1094
+ * @returns {Uint32Array}
1095
+ */
1096
+ get subscriptionIdentifiers() {
1097
+ const ret = wasm.messageproperties_subscriptionIdentifiers(this.__wbg_ptr);
1098
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1099
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1100
+ return v1;
1101
+ }
1102
+ }
1103
+ if (Symbol.dispose) MessageProperties.prototype[Symbol.dispose] = MessageProperties.prototype.free;
1104
+
1105
+ export class MqttClient {
1106
+ __destroy_into_raw() {
1107
+ const ptr = this.__wbg_ptr;
1108
+ this.__wbg_ptr = 0;
1109
+ MqttClientFinalization.unregister(this);
1110
+ return ptr;
1111
+ }
1112
+ free() {
1113
+ const ptr = this.__destroy_into_raw();
1114
+ wasm.__wbg_mqttclient_free(ptr, 0);
1115
+ }
1116
+ /**
1117
+ * # Errors
1118
+ * Returns an error if connection fails.
1119
+ * @param {string} url
1120
+ * @returns {Promise<void>}
1121
+ */
1122
+ connect(url) {
1123
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1124
+ const len0 = WASM_VECTOR_LEN;
1125
+ const ret = wasm.mqttclient_connect(this.__wbg_ptr, ptr0, len0);
1126
+ return ret;
1127
+ }
1128
+ /**
1129
+ * # Errors
1130
+ * Returns an error if connection fails.
1131
+ * @param {string} channelName
1132
+ * @returns {Promise<void>}
1133
+ */
1134
+ connectBroadcastChannel(channelName) {
1135
+ const ptr0 = passStringToWasm0(channelName, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1136
+ const len0 = WASM_VECTOR_LEN;
1137
+ const ret = wasm.mqttclient_connectBroadcastChannel(this.__wbg_ptr, ptr0, len0);
1138
+ return ret;
1139
+ }
1140
+ /**
1141
+ * # Errors
1142
+ * Returns an error if connection fails.
1143
+ * @param {MessagePort} port
1144
+ * @returns {Promise<void>}
1145
+ */
1146
+ connectMessagePort(port) {
1147
+ const ret = wasm.mqttclient_connectMessagePort(this.__wbg_ptr, port);
1148
+ return ret;
1149
+ }
1150
+ /**
1151
+ * # Errors
1152
+ * Returns an error if connection fails.
1153
+ * @param {MessagePort} port
1154
+ * @param {ConnectOptions} config
1155
+ * @returns {Promise<void>}
1156
+ */
1157
+ connectMessagePortWithOptions(port, config) {
1158
+ _assertClass(config, ConnectOptions);
1159
+ const ret = wasm.mqttclient_connectMessagePortWithOptions(this.__wbg_ptr, port, config.__wbg_ptr);
1160
+ return ret;
1161
+ }
1162
+ /**
1163
+ * # Errors
1164
+ * Returns an error if connection fails.
1165
+ * @param {string} url
1166
+ * @param {ConnectOptions} config
1167
+ * @returns {Promise<void>}
1168
+ */
1169
+ connectWithOptions(url, config) {
1170
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1171
+ const len0 = WASM_VECTOR_LEN;
1172
+ _assertClass(config, ConnectOptions);
1173
+ const ret = wasm.mqttclient_connectWithOptions(this.__wbg_ptr, ptr0, len0, config.__wbg_ptr);
1174
+ return ret;
1175
+ }
1176
+ destroy() {
1177
+ wasm.mqttclient_destroy(this.__wbg_ptr);
1178
+ }
1179
+ /**
1180
+ * # Errors
1181
+ * Returns an error if disconnect fails.
1182
+ * @returns {Promise<void>}
1183
+ */
1184
+ disconnect() {
1185
+ const ret = wasm.mqttclient_disconnect(this.__wbg_ptr);
1186
+ return ret;
1187
+ }
1188
+ /**
1189
+ * @param {boolean} enabled
1190
+ */
1191
+ enableAutoReconnect(enabled) {
1192
+ wasm.mqttclient_enableAutoReconnect(this.__wbg_ptr, enabled);
1193
+ }
1194
+ /**
1195
+ * @returns {boolean}
1196
+ */
1197
+ isBrowserOnline() {
1198
+ const ret = wasm.mqttclient_isBrowserOnline(this.__wbg_ptr);
1199
+ return ret !== 0;
1200
+ }
1201
+ /**
1202
+ * @returns {boolean}
1203
+ */
1204
+ isConnected() {
1205
+ const ret = wasm.mqttclient_isConnected(this.__wbg_ptr);
1206
+ return ret !== 0;
1207
+ }
1208
+ /**
1209
+ * @returns {boolean}
1210
+ */
1211
+ isReconnecting() {
1212
+ const ret = wasm.mqttclient_isReconnecting(this.__wbg_ptr);
1213
+ return ret !== 0;
1214
+ }
1215
+ /**
1216
+ * @param {string} clientId
1217
+ */
1218
+ constructor(clientId) {
1219
+ const ptr0 = passStringToWasm0(clientId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1220
+ const len0 = WASM_VECTOR_LEN;
1221
+ const ret = wasm.mqttclient_new(ptr0, len0);
1222
+ this.__wbg_ptr = ret;
1223
+ MqttClientFinalization.register(this, this.__wbg_ptr, this);
1224
+ return this;
1225
+ }
1226
+ /**
1227
+ * @param {Function} callback
1228
+ */
1229
+ onAuthChallenge(callback) {
1230
+ wasm.mqttclient_onAuthChallenge(this.__wbg_ptr, callback);
1231
+ }
1232
+ /**
1233
+ * @param {Function} callback
1234
+ */
1235
+ onConnect(callback) {
1236
+ wasm.mqttclient_onConnect(this.__wbg_ptr, callback);
1237
+ }
1238
+ /**
1239
+ * @param {Function} callback
1240
+ */
1241
+ onConnectivityChange(callback) {
1242
+ wasm.mqttclient_onConnectivityChange(this.__wbg_ptr, callback);
1243
+ }
1244
+ /**
1245
+ * @param {Function} callback
1246
+ */
1247
+ onDisconnect(callback) {
1248
+ wasm.mqttclient_onDisconnect(this.__wbg_ptr, callback);
1249
+ }
1250
+ /**
1251
+ * @param {Function} callback
1252
+ */
1253
+ onError(callback) {
1254
+ wasm.mqttclient_onError(this.__wbg_ptr, callback);
1255
+ }
1256
+ /**
1257
+ * @param {Function} callback
1258
+ */
1259
+ onReconnectFailed(callback) {
1260
+ wasm.mqttclient_onReconnectFailed(this.__wbg_ptr, callback);
1261
+ }
1262
+ /**
1263
+ * @param {Function} callback
1264
+ */
1265
+ onReconnecting(callback) {
1266
+ wasm.mqttclient_onReconnecting(this.__wbg_ptr, callback);
1267
+ }
1268
+ /**
1269
+ * # Errors
1270
+ * Returns an error if not connected or publish fails.
1271
+ * @param {string} topic
1272
+ * @param {Uint8Array} payload
1273
+ * @returns {Promise<void>}
1274
+ */
1275
+ publish(topic, payload) {
1276
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1277
+ const len0 = WASM_VECTOR_LEN;
1278
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1279
+ const len1 = WASM_VECTOR_LEN;
1280
+ const ret = wasm.mqttclient_publish(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1281
+ return ret;
1282
+ }
1283
+ /**
1284
+ * # Errors
1285
+ * Returns an error if not connected or publish fails.
1286
+ * @param {string} topic
1287
+ * @param {Uint8Array} payload
1288
+ * @param {Function} callback
1289
+ * @returns {Promise<number>}
1290
+ */
1291
+ publishQos1(topic, payload, callback) {
1292
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1293
+ const len0 = WASM_VECTOR_LEN;
1294
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1295
+ const len1 = WASM_VECTOR_LEN;
1296
+ const ret = wasm.mqttclient_publishQos1(this.__wbg_ptr, ptr0, len0, ptr1, len1, callback);
1297
+ return ret;
1298
+ }
1299
+ /**
1300
+ * # Errors
1301
+ * Returns an error if not connected or publish fails.
1302
+ * @param {string} topic
1303
+ * @param {Uint8Array} payload
1304
+ * @param {Function} callback
1305
+ * @returns {Promise<number>}
1306
+ */
1307
+ publishQos2(topic, payload, callback) {
1308
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1309
+ const len0 = WASM_VECTOR_LEN;
1310
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1311
+ const len1 = WASM_VECTOR_LEN;
1312
+ const ret = wasm.mqttclient_publishQos2(this.__wbg_ptr, ptr0, len0, ptr1, len1, callback);
1313
+ return ret;
1314
+ }
1315
+ /**
1316
+ * # Errors
1317
+ * Returns an error if not connected or publish fails.
1318
+ * @param {string} topic
1319
+ * @param {Uint8Array} payload
1320
+ * @param {PublishOptions} options
1321
+ * @returns {Promise<void>}
1322
+ */
1323
+ publishWithOptions(topic, payload, options) {
1324
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1325
+ const len0 = WASM_VECTOR_LEN;
1326
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1327
+ const len1 = WASM_VECTOR_LEN;
1328
+ _assertClass(options, PublishOptions);
1329
+ const ret = wasm.mqttclient_publishWithOptions(this.__wbg_ptr, ptr0, len0, ptr1, len1, options.__wbg_ptr);
1330
+ return ret;
1331
+ }
1332
+ /**
1333
+ * # Errors
1334
+ * Returns an error if no auth method is set or send fails.
1335
+ * @param {Uint8Array} authData
1336
+ */
1337
+ respondAuth(authData) {
1338
+ const ptr0 = passArray8ToWasm0(authData, wasm.__wbindgen_malloc);
1339
+ const len0 = WASM_VECTOR_LEN;
1340
+ const ret = wasm.mqttclient_respondAuth(this.__wbg_ptr, ptr0, len0);
1341
+ if (ret[1]) {
1342
+ throw takeFromExternrefTable0(ret[0]);
1343
+ }
1344
+ }
1345
+ /**
1346
+ * @param {ReconnectOptions} options
1347
+ */
1348
+ setReconnectOptions(options) {
1349
+ _assertClass(options, ReconnectOptions);
1350
+ wasm.mqttclient_setReconnectOptions(this.__wbg_ptr, options.__wbg_ptr);
1351
+ }
1352
+ /**
1353
+ * # Errors
1354
+ * Returns an error if not connected or subscribe fails.
1355
+ * @param {string} topic
1356
+ * @returns {Promise<number>}
1357
+ */
1358
+ subscribe(topic) {
1359
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1360
+ const len0 = WASM_VECTOR_LEN;
1361
+ const ret = wasm.mqttclient_subscribe(this.__wbg_ptr, ptr0, len0);
1362
+ return ret;
1363
+ }
1364
+ /**
1365
+ * # Errors
1366
+ * Returns an error if not connected or subscribe fails.
1367
+ * @param {string} topic
1368
+ * @param {Function} callback
1369
+ * @returns {Promise<number>}
1370
+ */
1371
+ subscribeWithCallback(topic, callback) {
1372
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1373
+ const len0 = WASM_VECTOR_LEN;
1374
+ const ret = wasm.mqttclient_subscribeWithCallback(this.__wbg_ptr, ptr0, len0, callback);
1375
+ return ret;
1376
+ }
1377
+ /**
1378
+ * # Errors
1379
+ * Returns an error if not connected or subscribe fails.
1380
+ * @param {string} topic
1381
+ * @param {Function} callback
1382
+ * @param {SubscribeOptions} options
1383
+ * @returns {Promise<number>}
1384
+ */
1385
+ subscribeWithOptions(topic, callback, options) {
1386
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1387
+ const len0 = WASM_VECTOR_LEN;
1388
+ _assertClass(options, SubscribeOptions);
1389
+ const ret = wasm.mqttclient_subscribeWithOptions(this.__wbg_ptr, ptr0, len0, callback, options.__wbg_ptr);
1390
+ return ret;
1391
+ }
1392
+ /**
1393
+ * # Errors
1394
+ * Returns an error if not connected or unsubscribe fails.
1395
+ * @param {string} topic
1396
+ * @returns {Promise<number>}
1397
+ */
1398
+ unsubscribe(topic) {
1399
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1400
+ const len0 = WASM_VECTOR_LEN;
1401
+ const ret = wasm.mqttclient_unsubscribe(this.__wbg_ptr, ptr0, len0);
1402
+ return ret;
1403
+ }
1404
+ }
1405
+ if (Symbol.dispose) MqttClient.prototype[Symbol.dispose] = MqttClient.prototype.free;
1406
+
1407
+ export class PublishOptions {
1408
+ __destroy_into_raw() {
1409
+ const ptr = this.__wbg_ptr;
1410
+ this.__wbg_ptr = 0;
1411
+ PublishOptionsFinalization.unregister(this);
1412
+ return ptr;
1413
+ }
1414
+ free() {
1415
+ const ptr = this.__destroy_into_raw();
1416
+ wasm.__wbg_publishoptions_free(ptr, 0);
1417
+ }
1418
+ /**
1419
+ * @param {string} key
1420
+ * @param {string} value
1421
+ */
1422
+ addUserProperty(key, value) {
1423
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1424
+ const len0 = WASM_VECTOR_LEN;
1425
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1426
+ const len1 = WASM_VECTOR_LEN;
1427
+ wasm.publishoptions_addUserProperty(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1428
+ }
1429
+ clearUserProperties() {
1430
+ wasm.publishoptions_clearUserProperties(this.__wbg_ptr);
1431
+ }
1432
+ /**
1433
+ * @returns {string | undefined}
1434
+ */
1435
+ get contentType() {
1436
+ const ret = wasm.publishoptions_contentType(this.__wbg_ptr);
1437
+ let v1;
1438
+ if (ret[0] !== 0) {
1439
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1440
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1441
+ }
1442
+ return v1;
1443
+ }
1444
+ /**
1445
+ * @returns {number | undefined}
1446
+ */
1447
+ get messageExpiryInterval() {
1448
+ const ret = wasm.publishoptions_messageExpiryInterval(this.__wbg_ptr);
1449
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
1450
+ }
1451
+ constructor() {
1452
+ const ret = wasm.publishoptions_new();
1453
+ this.__wbg_ptr = ret;
1454
+ PublishOptionsFinalization.register(this, this.__wbg_ptr, this);
1455
+ return this;
1456
+ }
1457
+ /**
1458
+ * @returns {boolean | undefined}
1459
+ */
1460
+ get payloadFormatIndicator() {
1461
+ const ret = wasm.publishoptions_payloadFormatIndicator(this.__wbg_ptr);
1462
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
1463
+ }
1464
+ /**
1465
+ * @returns {number}
1466
+ */
1467
+ get qos() {
1468
+ const ret = wasm.publishoptions_qos(this.__wbg_ptr);
1469
+ return ret;
1470
+ }
1471
+ /**
1472
+ * @returns {string | undefined}
1473
+ */
1474
+ get responseTopic() {
1475
+ const ret = wasm.publishoptions_responseTopic(this.__wbg_ptr);
1476
+ let v1;
1477
+ if (ret[0] !== 0) {
1478
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1479
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1480
+ }
1481
+ return v1;
1482
+ }
1483
+ /**
1484
+ * @returns {boolean}
1485
+ */
1486
+ get retain() {
1487
+ const ret = wasm.publishoptions_retain(this.__wbg_ptr);
1488
+ return ret !== 0;
1489
+ }
1490
+ /**
1491
+ * @param {string | null} [value]
1492
+ */
1493
+ set contentType(value) {
1494
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1495
+ var len0 = WASM_VECTOR_LEN;
1496
+ wasm.publishoptions_set_contentType(this.__wbg_ptr, ptr0, len0);
1497
+ }
1498
+ /**
1499
+ * @param {Uint8Array} value
1500
+ */
1501
+ set correlationData(value) {
1502
+ const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
1503
+ const len0 = WASM_VECTOR_LEN;
1504
+ wasm.publishoptions_set_correlationData(this.__wbg_ptr, ptr0, len0);
1505
+ }
1506
+ /**
1507
+ * @param {number | null} [value]
1508
+ */
1509
+ set messageExpiryInterval(value) {
1510
+ wasm.publishoptions_set_messageExpiryInterval(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
1511
+ }
1512
+ /**
1513
+ * @param {boolean | null} [value]
1514
+ */
1515
+ set payloadFormatIndicator(value) {
1516
+ wasm.publishoptions_set_payloadFormatIndicator(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
1517
+ }
1518
+ /**
1519
+ * @param {number} value
1520
+ */
1521
+ set qos(value) {
1522
+ wasm.publishoptions_set_qos(this.__wbg_ptr, value);
1523
+ }
1524
+ /**
1525
+ * @param {string | null} [value]
1526
+ */
1527
+ set responseTopic(value) {
1528
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1529
+ var len0 = WASM_VECTOR_LEN;
1530
+ wasm.publishoptions_set_responseTopic(this.__wbg_ptr, ptr0, len0);
1531
+ }
1532
+ /**
1533
+ * @param {boolean} value
1534
+ */
1535
+ set retain(value) {
1536
+ wasm.publishoptions_set_retain(this.__wbg_ptr, value);
1537
+ }
1538
+ /**
1539
+ * @param {number | null} [value]
1540
+ */
1541
+ set topicAlias(value) {
1542
+ wasm.publishoptions_set_topicAlias(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value);
1543
+ }
1544
+ /**
1545
+ * @returns {number | undefined}
1546
+ */
1547
+ get topicAlias() {
1548
+ const ret = wasm.publishoptions_topicAlias(this.__wbg_ptr);
1549
+ return ret === 0xFFFFFF ? undefined : ret;
1550
+ }
1551
+ }
1552
+ if (Symbol.dispose) PublishOptions.prototype[Symbol.dispose] = PublishOptions.prototype.free;
1553
+
1554
+ export class ReconnectOptions {
1555
+ static __wrap(ptr) {
1556
+ const obj = Object.create(ReconnectOptions.prototype);
1557
+ obj.__wbg_ptr = ptr;
1558
+ ReconnectOptionsFinalization.register(obj, obj.__wbg_ptr, obj);
1559
+ return obj;
1560
+ }
1561
+ __destroy_into_raw() {
1562
+ const ptr = this.__wbg_ptr;
1563
+ this.__wbg_ptr = 0;
1564
+ ReconnectOptionsFinalization.unregister(this);
1565
+ return ptr;
1566
+ }
1567
+ free() {
1568
+ const ptr = this.__destroy_into_raw();
1569
+ wasm.__wbg_reconnectoptions_free(ptr, 0);
1570
+ }
1571
+ /**
1572
+ * @returns {number}
1573
+ */
1574
+ get backoffFactor() {
1575
+ const ret = wasm.reconnectoptions_backoffFactor(this.__wbg_ptr);
1576
+ return ret;
1577
+ }
1578
+ /**
1579
+ * @returns {ReconnectOptions}
1580
+ */
1581
+ static disabled() {
1582
+ const ret = wasm.reconnectoptions_disabled();
1583
+ return ReconnectOptions.__wrap(ret);
1584
+ }
1585
+ /**
1586
+ * @returns {boolean}
1587
+ */
1588
+ get enabled() {
1589
+ const ret = wasm.reconnectoptions_enabled(this.__wbg_ptr);
1590
+ return ret !== 0;
1591
+ }
1592
+ /**
1593
+ * @returns {number}
1594
+ */
1595
+ get initialDelayMs() {
1596
+ const ret = wasm.reconnectoptions_initialDelayMs(this.__wbg_ptr);
1597
+ return ret >>> 0;
1598
+ }
1599
+ /**
1600
+ * @returns {number | undefined}
1601
+ */
1602
+ get maxAttempts() {
1603
+ const ret = wasm.reconnectoptions_maxAttempts(this.__wbg_ptr);
1604
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
1605
+ }
1606
+ /**
1607
+ * @returns {number}
1608
+ */
1609
+ get maxDelayMs() {
1610
+ const ret = wasm.reconnectoptions_maxDelayMs(this.__wbg_ptr);
1611
+ return ret >>> 0;
1612
+ }
1613
+ constructor() {
1614
+ const ret = wasm.reconnectoptions_new();
1615
+ this.__wbg_ptr = ret;
1616
+ ReconnectOptionsFinalization.register(this, this.__wbg_ptr, this);
1617
+ return this;
1618
+ }
1619
+ /**
1620
+ * @param {number} value
1621
+ */
1622
+ set backoffFactor(value) {
1623
+ wasm.reconnectoptions_set_backoffFactor(this.__wbg_ptr, value);
1624
+ }
1625
+ /**
1626
+ * @param {boolean} value
1627
+ */
1628
+ set enabled(value) {
1629
+ wasm.reconnectoptions_set_enabled(this.__wbg_ptr, value);
1630
+ }
1631
+ /**
1632
+ * @param {number} value
1633
+ */
1634
+ set initialDelayMs(value) {
1635
+ wasm.reconnectoptions_set_initialDelayMs(this.__wbg_ptr, value);
1636
+ }
1637
+ /**
1638
+ * @param {number | null} [value]
1639
+ */
1640
+ set maxAttempts(value) {
1641
+ wasm.reconnectoptions_set_maxAttempts(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
1642
+ }
1643
+ /**
1644
+ * @param {number} value
1645
+ */
1646
+ set maxDelayMs(value) {
1647
+ wasm.reconnectoptions_set_maxDelayMs(this.__wbg_ptr, value);
1648
+ }
1649
+ }
1650
+ if (Symbol.dispose) ReconnectOptions.prototype[Symbol.dispose] = ReconnectOptions.prototype.free;
1651
+
1652
+ /**
1653
+ * Reactive state-sync store, browser flavour. Construct with [`create_store`],
1654
+ * call [`Store::initialize`] once, then issue CRUD calls.
1655
+ */
1656
+ export class Store {
1657
+ static __wrap(ptr) {
1658
+ const obj = Object.create(Store.prototype);
1659
+ obj.__wbg_ptr = ptr;
1660
+ StoreFinalization.register(obj, obj.__wbg_ptr, obj);
1661
+ return obj;
1662
+ }
1663
+ __destroy_into_raw() {
1664
+ const ptr = this.__wbg_ptr;
1665
+ this.__wbg_ptr = 0;
1666
+ StoreFinalization.unregister(this);
1667
+ return ptr;
1668
+ }
1669
+ free() {
1670
+ const ptr = this.__destroy_into_raw();
1671
+ wasm.__wbg_store_free(ptr, 0);
1672
+ }
1673
+ /**
1674
+ * Defer memory-bus notifications until [`Store::end_batch`]; rapid bursts
1675
+ * collapse to one event per `(scope, entity)`.
1676
+ *
1677
+ * # Errors
1678
+ * Returns an error if the store is not initialized.
1679
+ */
1680
+ beginBatch() {
1681
+ const ret = wasm.store_beginBatch(this.__wbg_ptr);
1682
+ if (ret[1]) {
1683
+ throw takeFromExternrefTable0(ret[0]);
1684
+ }
1685
+ }
1686
+ /**
1687
+ * Clear a scope from the in-memory cache. Equivalent to TS `clearScope`.
1688
+ *
1689
+ * # Errors
1690
+ * Returns an error if the operation fails.
1691
+ * @param {string} scope_id
1692
+ * @returns {Promise<void>}
1693
+ */
1694
+ clearScope(scope_id) {
1695
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1696
+ const len0 = WASM_VECTOR_LEN;
1697
+ const ret = wasm.store_clearScope(this.__wbg_ptr, ptr0, len0);
1698
+ return ret;
1699
+ }
1700
+ /**
1701
+ * Unsubscribe from a scope's remote topics and clear it from the active
1702
+ * scope if it was current.
1703
+ *
1704
+ * # Errors
1705
+ * Returns an error if the operation fails.
1706
+ * @param {string} scope_id
1707
+ * @returns {Promise<void>}
1708
+ */
1709
+ closeScope(scope_id) {
1710
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1711
+ const len0 = WASM_VECTOR_LEN;
1712
+ const ret = wasm.store_closeScope(this.__wbg_ptr, ptr0, len0);
1713
+ return ret;
1714
+ }
1715
+ /**
1716
+ * Current remote connection status as a string (`"Offline"`,
1717
+ * `"Connecting"`, `"Connected"`, `"Disconnected"`, `"Error"`). `"Offline"`
1718
+ * when no remote is configured.
1719
+ *
1720
+ * # Errors
1721
+ * Returns an error if the store is not initialized.
1722
+ * @returns {string}
1723
+ */
1724
+ connectionStatus() {
1725
+ let deferred2_0;
1726
+ let deferred2_1;
1727
+ try {
1728
+ const ret = wasm.store_connectionStatus(this.__wbg_ptr);
1729
+ var ptr1 = ret[0];
1730
+ var len1 = ret[1];
1731
+ if (ret[3]) {
1732
+ ptr1 = 0; len1 = 0;
1733
+ throw takeFromExternrefTable0(ret[2]);
1734
+ }
1735
+ deferred2_0 = ptr1;
1736
+ deferred2_1 = len1;
1737
+ return getStringFromWasm0(ptr1, len1);
1738
+ } finally {
1739
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1740
+ }
1741
+ }
1742
+ /**
1743
+ * Insert a row into `entity` under `scopeId`. Returns the new row's id.
1744
+ *
1745
+ * # Errors
1746
+ * Returns an error if the write fails.
1747
+ * @param {string} entity
1748
+ * @param {string} scope_id
1749
+ * @param {any} data
1750
+ * @param {string | null} [tag]
1751
+ * @returns {Promise<string>}
1752
+ */
1753
+ create(entity, scope_id, data, tag) {
1754
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1755
+ const len0 = WASM_VECTOR_LEN;
1756
+ const ptr1 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1757
+ const len1 = WASM_VECTOR_LEN;
1758
+ var ptr2 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1759
+ var len2 = WASM_VECTOR_LEN;
1760
+ const ret = wasm.store_create(this.__wbg_ptr, ptr0, len0, ptr1, len1, data, ptr2, len2);
1761
+ return ret;
1762
+ }
1763
+ /**
1764
+ * Delete a row. No-op if absent.
1765
+ *
1766
+ * # Errors
1767
+ * Returns an error if the write fails.
1768
+ * @param {string} entity
1769
+ * @param {string} id
1770
+ * @param {string | null} [tag]
1771
+ * @returns {Promise<void>}
1772
+ */
1773
+ delete(entity, id, tag) {
1774
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1775
+ const len0 = WASM_VECTOR_LEN;
1776
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1777
+ const len1 = WASM_VECTOR_LEN;
1778
+ var ptr2 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1779
+ var len2 = WASM_VECTOR_LEN;
1780
+ const ret = wasm.store_delete(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
1781
+ return ret;
1782
+ }
1783
+ /**
1784
+ * Disconnect the remote, close persistence, and abort background tasks.
1785
+ *
1786
+ * # Errors
1787
+ * Returns an error if the operation fails.
1788
+ * @returns {Promise<void>}
1789
+ */
1790
+ destroy() {
1791
+ const ret = wasm.store_destroy(this.__wbg_ptr);
1792
+ return ret;
1793
+ }
1794
+ /**
1795
+ * Disconnect the remote client. Memory and persistence are unaffected.
1796
+ *
1797
+ * # Errors
1798
+ * Returns an error if the disconnect fails.
1799
+ * @returns {Promise<void>}
1800
+ */
1801
+ disconnect() {
1802
+ const ret = wasm.store_disconnect(this.__wbg_ptr);
1803
+ return ret;
1804
+ }
1805
+ /**
1806
+ * Flush the batch opened by [`Store::begin_batch`].
1807
+ *
1808
+ * # Errors
1809
+ * Returns an error if the store is not initialized.
1810
+ */
1811
+ endBatch() {
1812
+ const ret = wasm.store_endBatch(this.__wbg_ptr);
1813
+ if (ret[1]) {
1814
+ throw takeFromExternrefTable0(ret[0]);
1815
+ }
1816
+ }
1817
+ /**
1818
+ * Count of rows of `entity` within `scopeId`.
1819
+ *
1820
+ * # Errors
1821
+ * Returns an error if the read fails.
1822
+ * @param {string} entity
1823
+ * @param {string} scope_id
1824
+ * @returns {number}
1825
+ */
1826
+ getChildCount(entity, scope_id) {
1827
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1828
+ const len0 = WASM_VECTOR_LEN;
1829
+ const ptr1 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1830
+ const len1 = WASM_VECTOR_LEN;
1831
+ const ret = wasm.store_getChildCount(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1832
+ if (ret[2]) {
1833
+ throw takeFromExternrefTable0(ret[1]);
1834
+ }
1835
+ return ret[0] >>> 0;
1836
+ }
1837
+ /**
1838
+ * Snapshot of all rows for `entity` within `scopeId`. Equivalent to TS
1839
+ * `getSnapshot`.
1840
+ *
1841
+ * # Errors
1842
+ * Returns an error if the read fails.
1843
+ * @param {string} entity
1844
+ * @param {string} scope_id
1845
+ * @returns {any}
1846
+ */
1847
+ getSnapshot(entity, scope_id) {
1848
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1849
+ const len0 = WASM_VECTOR_LEN;
1850
+ const ptr1 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1851
+ const len1 = WASM_VECTOR_LEN;
1852
+ const ret = wasm.store_getSnapshot(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1853
+ if (ret[2]) {
1854
+ throw takeFromExternrefTable0(ret[1]);
1855
+ }
1856
+ return takeFromExternrefTable0(ret[0]);
1857
+ }
1858
+ /**
1859
+ * Snapshot of `entity` within `scopeId` as an object keyed by row id.
1860
+ *
1861
+ * # Errors
1862
+ * Returns an error if the read fails.
1863
+ * @param {string} entity
1864
+ * @param {string} scope_id
1865
+ * @returns {any}
1866
+ */
1867
+ getSnapshotAsMap(entity, scope_id) {
1868
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1869
+ const len0 = WASM_VECTOR_LEN;
1870
+ const ptr1 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1871
+ const len1 = WASM_VECTOR_LEN;
1872
+ const ret = wasm.store_getSnapshotAsMap(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1873
+ if (ret[2]) {
1874
+ throw takeFromExternrefTable0(ret[1]);
1875
+ }
1876
+ return takeFromExternrefTable0(ret[0]);
1877
+ }
1878
+ /**
1879
+ * Change token for `(scopeId, entity)`: increments on every mutation and on
1880
+ * scope load, and resets to `0` when the scope is cleared or replaced by
1881
+ * loading another scope. Top-level (global) entities are versioned under the
1882
+ * empty scope. Lets the JS layer cache snapshots and re-fetch whenever this
1883
+ * differs from the last seen value (referential stability for React).
1884
+ *
1885
+ * # Errors
1886
+ * Returns an error if the store is not initialized.
1887
+ * @param {string} scope_id
1888
+ * @param {string} entity
1889
+ * @returns {number}
1890
+ */
1891
+ getVersion(scope_id, entity) {
1892
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1893
+ const len0 = WASM_VECTOR_LEN;
1894
+ const ptr1 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1895
+ const len1 = WASM_VECTOR_LEN;
1896
+ const ret = wasm.store_getVersion(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1897
+ if (ret[2]) {
1898
+ throw takeFromExternrefTable0(ret[1]);
1899
+ }
1900
+ return ret[0];
1901
+ }
1902
+ /**
1903
+ * `true` if durable IndexedDB persistence is configured.
1904
+ *
1905
+ * # Errors
1906
+ * Returns an error if the store is not initialized.
1907
+ * @returns {boolean}
1908
+ */
1909
+ hasPersistence() {
1910
+ const ret = wasm.store_hasPersistence(this.__wbg_ptr);
1911
+ if (ret[2]) {
1912
+ throw takeFromExternrefTable0(ret[1]);
1913
+ }
1914
+ return ret[0] !== 0;
1915
+ }
1916
+ /**
1917
+ * `true` if remote sync is configured.
1918
+ *
1919
+ * # Errors
1920
+ * Returns an error if the store is not initialized.
1921
+ * @returns {boolean}
1922
+ */
1923
+ hasRemote() {
1924
+ const ret = wasm.store_hasRemote(this.__wbg_ptr);
1925
+ if (ret[2]) {
1926
+ throw takeFromExternrefTable0(ret[1]);
1927
+ }
1928
+ return ret[0] !== 0;
1929
+ }
1930
+ /**
1931
+ * Open the store (in-memory + persistence) and, when a remote is
1932
+ * configured, connect to the broker. Idempotent.
1933
+ *
1934
+ * # Errors
1935
+ * Returns an error if the underlying database fails to open.
1936
+ * @returns {Promise<void>}
1937
+ */
1938
+ initialize() {
1939
+ const ret = wasm.store_initialize(this.__wbg_ptr);
1940
+ return ret;
1941
+ }
1942
+ /**
1943
+ * `true` while the remote client is between connections.
1944
+ *
1945
+ * # Errors
1946
+ * Returns an error if the store is not initialized.
1947
+ * @returns {boolean}
1948
+ */
1949
+ isReconnecting() {
1950
+ const ret = wasm.store_isReconnecting(this.__wbg_ptr);
1951
+ if (ret[2]) {
1952
+ throw takeFromExternrefTable0(ret[1]);
1953
+ }
1954
+ return ret[0] !== 0;
1955
+ }
1956
+ /**
1957
+ * List rows of `entity`, optionally filtered/sorted. `filter` is
1958
+ * `{ scopeId?, sort?: [{ field, direction }], projection?: [string] }`.
1959
+ *
1960
+ * # Errors
1961
+ * Returns an error if the read fails or `filter` is malformed.
1962
+ * @param {string} entity
1963
+ * @param {any} filter
1964
+ * @returns {Promise<any>}
1965
+ */
1966
+ list(entity, filter) {
1967
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1968
+ const len0 = WASM_VECTOR_LEN;
1969
+ const ret = wasm.store_list(this.__wbg_ptr, ptr0, len0, filter);
1970
+ return ret;
1971
+ }
1972
+ /**
1973
+ * List all root entities across scopes, optionally sorted (`[{ field,
1974
+ * direction }]`).
1975
+ *
1976
+ * # Errors
1977
+ * Returns an error if the read fails or `sort` is malformed.
1978
+ * @param {any} sort
1979
+ * @returns {Promise<any>}
1980
+ */
1981
+ listRootEntities(sort) {
1982
+ const ret = wasm.store_listRootEntities(this.__wbg_ptr, sort);
1983
+ return ret;
1984
+ }
1985
+ /**
1986
+ * Load a scope's rows into the in-memory cache from caller-supplied data,
1987
+ * `{ entity: [records] }`, replacing any currently-loaded scope. Equivalent
1988
+ * to TS `loadScope`.
1989
+ *
1990
+ * # Errors
1991
+ * Returns an error if `data` is malformed or the load fails.
1992
+ * @param {string} scope_id
1993
+ * @param {any} data
1994
+ * @returns {Promise<void>}
1995
+ */
1996
+ loadScope(scope_id, data) {
1997
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1998
+ const len0 = WASM_VECTOR_LEN;
1999
+ const ret = wasm.store_loadScope(this.__wbg_ptr, ptr0, len0, data);
2000
+ return ret;
2001
+ }
2002
+ /**
2003
+ * Number of offline-queued mutations buffered for `scopeId` (the
2004
+ * authenticated user's pending writes). `0` when no remote/queue is
2005
+ * configured.
2006
+ *
2007
+ * # Errors
2008
+ * Returns an error if the store is not initialized.
2009
+ * @param {string} scope_id
2010
+ * @returns {Promise<number>}
2011
+ */
2012
+ pendingMutationCount(scope_id) {
2013
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2014
+ const len0 = WASM_VECTOR_LEN;
2015
+ const ret = wasm.store_pendingMutationCount(this.__wbg_ptr, ptr0, len0);
2016
+ return ret;
2017
+ }
2018
+ /**
2019
+ * Read a single row from the in-memory cache, or `null` if absent.
2020
+ *
2021
+ * # Errors
2022
+ * Returns an error if the read fails.
2023
+ * @param {string} entity
2024
+ * @param {string} id
2025
+ * @returns {any}
2026
+ */
2027
+ read(entity, id) {
2028
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2029
+ const len0 = WASM_VECTOR_LEN;
2030
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2031
+ const len1 = WASM_VECTOR_LEN;
2032
+ const ret = wasm.store_read(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2033
+ if (ret[2]) {
2034
+ throw takeFromExternrefTable0(ret[1]);
2035
+ }
2036
+ return takeFromExternrefTable0(ret[0]);
2037
+ }
2038
+ /**
2039
+ * Read a row straight from durable persistence, bypassing the in-memory
2040
+ * cache. Returns `null` if absent. Falls back to memory when the store has
2041
+ * no persistence configured.
2042
+ *
2043
+ * # Errors
2044
+ * Returns an error if the read fails.
2045
+ * @param {string} entity
2046
+ * @param {string} id
2047
+ * @returns {Promise<any>}
2048
+ */
2049
+ readLocalState(entity, id) {
2050
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2051
+ const len0 = WASM_VECTOR_LEN;
2052
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2053
+ const len1 = WASM_VECTOR_LEN;
2054
+ const ret = wasm.store_readLocalState(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2055
+ return ret;
2056
+ }
2057
+ /**
2058
+ * `true` once [`Store::initialize`] has completed.
2059
+ * @returns {boolean}
2060
+ */
2061
+ ready() {
2062
+ const ret = wasm.store_ready(this.__wbg_ptr);
2063
+ return ret !== 0;
2064
+ }
2065
+ /**
2066
+ * Reconnect the remote client, optionally with a fresh JWT ticket or
2067
+ * fresh username + password.
2068
+ *
2069
+ * # Errors
2070
+ * Returns an error if no remote is configured or the reconnect fails.
2071
+ * @param {string} server_url
2072
+ * @param {string | null} [ticket]
2073
+ * @param {string | null} [username]
2074
+ * @param {string | null} [password]
2075
+ * @returns {Promise<void>}
2076
+ */
2077
+ reconnect(server_url, ticket, username, password) {
2078
+ const ptr0 = passStringToWasm0(server_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2079
+ const len0 = WASM_VECTOR_LEN;
2080
+ var ptr1 = isLikeNone(ticket) ? 0 : passStringToWasm0(ticket, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2081
+ var len1 = WASM_VECTOR_LEN;
2082
+ var ptr2 = isLikeNone(username) ? 0 : passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2083
+ var len2 = WASM_VECTOR_LEN;
2084
+ var ptr3 = isLikeNone(password) ? 0 : passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2085
+ var len3 = WASM_VECTOR_LEN;
2086
+ const ret = wasm.store_reconnect(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
2087
+ return ret;
2088
+ }
2089
+ /**
2090
+ * Switch the active scope, loading its rows from persistence into the
2091
+ * in-memory cache. Use after reopening a persistent store to rehydrate a
2092
+ * scope's snapshot.
2093
+ *
2094
+ * # Errors
2095
+ * Returns an error if the load fails.
2096
+ * @param {string} scope_id
2097
+ * @returns {Promise<void>}
2098
+ */
2099
+ replaceScope(scope_id) {
2100
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2101
+ const len0 = WASM_VECTOR_LEN;
2102
+ const ret = wasm.store_replaceScope(this.__wbg_ptr, ptr0, len0);
2103
+ return ret;
2104
+ }
2105
+ /**
2106
+ * Send an arbitrary MQTT request and await the broker's response.
2107
+ *
2108
+ * # Errors
2109
+ * Returns an error if no remote is configured or the request fails.
2110
+ * @param {string} topic
2111
+ * @param {any} payload
2112
+ * @returns {Promise<any>}
2113
+ */
2114
+ request(topic, payload) {
2115
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2116
+ const len0 = WASM_VECTOR_LEN;
2117
+ const ret = wasm.store_request(this.__wbg_ptr, ptr0, len0, payload);
2118
+ return ret;
2119
+ }
2120
+ /**
2121
+ * Disconnect, clear auth + sync state. Persistence and the offline queue
2122
+ * stay alive; drop the store to fully reset.
2123
+ *
2124
+ * # Errors
2125
+ * Returns an error if the operation fails.
2126
+ * @returns {Promise<void>}
2127
+ */
2128
+ resetForLogout() {
2129
+ const ret = wasm.store_resetForLogout(this.__wbg_ptr);
2130
+ return ret;
2131
+ }
2132
+ /**
2133
+ * Set (or clear, with `null`/`undefined`) the authenticated user. Offline
2134
+ * writes are scoped to this user and are dropped while it is unset, so call
2135
+ * this before issuing writes you want queued for replay.
2136
+ *
2137
+ * # Errors
2138
+ * Returns an error if the store is not initialized.
2139
+ * @param {string | null} [user_id]
2140
+ */
2141
+ setAuthenticatedUser(user_id) {
2142
+ var ptr0 = isLikeNone(user_id) ? 0 : passStringToWasm0(user_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2143
+ var len0 = WASM_VECTOR_LEN;
2144
+ const ret = wasm.store_setAuthenticatedUser(this.__wbg_ptr, ptr0, len0);
2145
+ if (ret[1]) {
2146
+ throw takeFromExternrefTable0(ret[0]);
2147
+ }
2148
+ }
2149
+ /**
2150
+ * Register a callback fired when the broker rejects the session
2151
+ * (`MQTT_DISCONNECT_AUTH_FAILURE`). Use it to clear cached auth and route
2152
+ * the user to re-login. No-op if no remote is configured.
2153
+ *
2154
+ * # Errors
2155
+ * Returns an error if the store is not initialized.
2156
+ * @param {Function} callback
2157
+ */
2158
+ setSessionInvalidHandler(callback) {
2159
+ const ret = wasm.store_setSessionInvalidHandler(this.__wbg_ptr, callback);
2160
+ if (ret[1]) {
2161
+ throw takeFromExternrefTable0(ret[0]);
2162
+ }
2163
+ }
2164
+ /**
2165
+ * Subscribe to remote connection-status changes; the callback receives the
2166
+ * status string. Returns an unsubscribe function (a no-op when no remote is
2167
+ * configured).
2168
+ *
2169
+ * # Errors
2170
+ * Returns an error if the store is not initialized.
2171
+ * @param {Function} callback
2172
+ * @returns {any}
2173
+ */
2174
+ subscribeToConnectionStatus(callback) {
2175
+ const ret = wasm.store_subscribeToConnectionStatus(this.__wbg_ptr, callback);
2176
+ if (ret[2]) {
2177
+ throw takeFromExternrefTable0(ret[1]);
2178
+ }
2179
+ return takeFromExternrefTable0(ret[0]);
2180
+ }
2181
+ /**
2182
+ * Subscribe to mutations for `entity`. The callback receives
2183
+ * `(data | null, op)` where `op` is `"insert" | "update" | "delete"`.
2184
+ * Returns an unsubscribe function.
2185
+ *
2186
+ * # Errors
2187
+ * Returns an error if the store is not initialized.
2188
+ * @param {string} entity
2189
+ * @param {Function} callback
2190
+ * @returns {any}
2191
+ */
2192
+ subscribeToEntity(entity, callback) {
2193
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2194
+ const len0 = WASM_VECTOR_LEN;
2195
+ const ret = wasm.store_subscribeToEntity(this.__wbg_ptr, ptr0, len0, callback);
2196
+ if (ret[2]) {
2197
+ throw takeFromExternrefTable0(ret[1]);
2198
+ }
2199
+ return takeFromExternrefTable0(ret[0]);
2200
+ }
2201
+ /**
2202
+ * Subscribe to mutations for `(scopeId, entity)`. The callback takes no
2203
+ * args (a "scope changed" signal). Returns an unsubscribe function.
2204
+ *
2205
+ * # Errors
2206
+ * Returns an error if the store is not initialized.
2207
+ * @param {string} scope_id
2208
+ * @param {string} entity
2209
+ * @param {Function} callback
2210
+ * @returns {any}
2211
+ */
2212
+ subscribeToScope(scope_id, entity, callback) {
2213
+ const ptr0 = passStringToWasm0(scope_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2214
+ const len0 = WASM_VECTOR_LEN;
2215
+ const ptr1 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2216
+ const len1 = WASM_VECTOR_LEN;
2217
+ const ret = wasm.store_subscribeToScope(this.__wbg_ptr, ptr0, len0, ptr1, len1, callback);
2218
+ if (ret[2]) {
2219
+ throw takeFromExternrefTable0(ret[1]);
2220
+ }
2221
+ return takeFromExternrefTable0(ret[0]);
2222
+ }
2223
+ /**
2224
+ * Partial-update a row.
2225
+ *
2226
+ * # Errors
2227
+ * Returns an error if the write fails.
2228
+ * @param {string} entity
2229
+ * @param {string} id
2230
+ * @param {any} fields
2231
+ * @param {string | null} [tag]
2232
+ * @returns {Promise<void>}
2233
+ */
2234
+ update(entity, id, fields, tag) {
2235
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2236
+ const len0 = WASM_VECTOR_LEN;
2237
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2238
+ const len1 = WASM_VECTOR_LEN;
2239
+ var ptr2 = isLikeNone(tag) ? 0 : passStringToWasm0(tag, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2240
+ var len2 = WASM_VECTOR_LEN;
2241
+ const ret = wasm.store_update(this.__wbg_ptr, ptr0, len0, ptr1, len1, fields, ptr2, len2);
2242
+ return ret;
2243
+ }
2244
+ /**
2245
+ * Upsert into persistence directly, bypassing memory and remote.
2246
+ *
2247
+ * # Errors
2248
+ * Returns an error if the write fails.
2249
+ * @param {string} entity
2250
+ * @param {string} id
2251
+ * @param {any} fields
2252
+ * @returns {Promise<void>}
2253
+ */
2254
+ updateLocalState(entity, id, fields) {
2255
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2256
+ const len0 = WASM_VECTOR_LEN;
2257
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2258
+ const len1 = WASM_VECTOR_LEN;
2259
+ const ret = wasm.store_updateLocalState(this.__wbg_ptr, ptr0, len0, ptr1, len1, fields);
2260
+ return ret;
2261
+ }
2262
+ }
2263
+ if (Symbol.dispose) Store.prototype[Symbol.dispose] = Store.prototype.free;
2264
+
2265
+ export class SubscribeOptions {
2266
+ __destroy_into_raw() {
2267
+ const ptr = this.__wbg_ptr;
2268
+ this.__wbg_ptr = 0;
2269
+ SubscribeOptionsFinalization.unregister(this);
2270
+ return ptr;
2271
+ }
2272
+ free() {
2273
+ const ptr = this.__destroy_into_raw();
2274
+ wasm.__wbg_subscribeoptions_free(ptr, 0);
2275
+ }
2276
+ constructor() {
2277
+ const ret = wasm.subscribeoptions_new();
2278
+ this.__wbg_ptr = ret;
2279
+ SubscribeOptionsFinalization.register(this, this.__wbg_ptr, this);
2280
+ return this;
2281
+ }
2282
+ /**
2283
+ * @returns {boolean}
2284
+ */
2285
+ get noLocal() {
2286
+ const ret = wasm.subscribeoptions_noLocal(this.__wbg_ptr);
2287
+ return ret !== 0;
2288
+ }
2289
+ /**
2290
+ * @returns {number}
2291
+ */
2292
+ get qos() {
2293
+ const ret = wasm.subscribeoptions_qos(this.__wbg_ptr);
2294
+ return ret;
2295
+ }
2296
+ /**
2297
+ * @returns {boolean}
2298
+ */
2299
+ get retainAsPublished() {
2300
+ const ret = wasm.subscribeoptions_retainAsPublished(this.__wbg_ptr);
2301
+ return ret !== 0;
2302
+ }
2303
+ /**
2304
+ * @returns {number}
2305
+ */
2306
+ get retainHandling() {
2307
+ const ret = wasm.subscribeoptions_retainHandling(this.__wbg_ptr);
2308
+ return ret;
2309
+ }
2310
+ /**
2311
+ * @param {boolean} value
2312
+ */
2313
+ set noLocal(value) {
2314
+ wasm.subscribeoptions_set_noLocal(this.__wbg_ptr, value);
2315
+ }
2316
+ /**
2317
+ * @param {number} value
2318
+ */
2319
+ set qos(value) {
2320
+ wasm.subscribeoptions_set_qos(this.__wbg_ptr, value);
2321
+ }
2322
+ /**
2323
+ * @param {boolean} value
2324
+ */
2325
+ set retainAsPublished(value) {
2326
+ wasm.subscribeoptions_set_retainAsPublished(this.__wbg_ptr, value);
2327
+ }
2328
+ /**
2329
+ * @param {number} value
2330
+ */
2331
+ set retainHandling(value) {
2332
+ wasm.subscribeoptions_set_retainHandling(this.__wbg_ptr, value);
2333
+ }
2334
+ /**
2335
+ * @param {number | null} [value]
2336
+ */
2337
+ set subscriptionIdentifier(value) {
2338
+ wasm.subscribeoptions_set_subscriptionIdentifier(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
2339
+ }
2340
+ /**
2341
+ * @returns {number | undefined}
2342
+ */
2343
+ get subscriptionIdentifier() {
2344
+ const ret = wasm.subscribeoptions_subscriptionIdentifier(this.__wbg_ptr);
2345
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
2346
+ }
2347
+ }
2348
+ if (Symbol.dispose) SubscribeOptions.prototype[Symbol.dispose] = SubscribeOptions.prototype.free;
2349
+
2350
+ export class WillMessage {
2351
+ __destroy_into_raw() {
2352
+ const ptr = this.__wbg_ptr;
2353
+ this.__wbg_ptr = 0;
2354
+ WillMessageFinalization.unregister(this);
2355
+ return ptr;
2356
+ }
2357
+ free() {
2358
+ const ptr = this.__destroy_into_raw();
2359
+ wasm.__wbg_willmessage_free(ptr, 0);
2360
+ }
2361
+ /**
2362
+ * @returns {string | undefined}
2363
+ */
2364
+ get contentType() {
2365
+ const ret = wasm.willmessage_contentType(this.__wbg_ptr);
2366
+ let v1;
2367
+ if (ret[0] !== 0) {
2368
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2369
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2370
+ }
2371
+ return v1;
2372
+ }
2373
+ /**
2374
+ * @returns {number | undefined}
2375
+ */
2376
+ get messageExpiryInterval() {
2377
+ const ret = wasm.willmessage_messageExpiryInterval(this.__wbg_ptr);
2378
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
2379
+ }
2380
+ /**
2381
+ * @param {string} topic
2382
+ * @param {Uint8Array} payload
2383
+ */
2384
+ constructor(topic, payload) {
2385
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2386
+ const len0 = WASM_VECTOR_LEN;
2387
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
2388
+ const len1 = WASM_VECTOR_LEN;
2389
+ const ret = wasm.willmessage_new(ptr0, len0, ptr1, len1);
2390
+ this.__wbg_ptr = ret;
2391
+ WillMessageFinalization.register(this, this.__wbg_ptr, this);
2392
+ return this;
2393
+ }
2394
+ /**
2395
+ * @returns {number}
2396
+ */
2397
+ get qos() {
2398
+ const ret = wasm.willmessage_qos(this.__wbg_ptr);
2399
+ return ret;
2400
+ }
2401
+ /**
2402
+ * @returns {string | undefined}
2403
+ */
2404
+ get responseTopic() {
2405
+ const ret = wasm.willmessage_responseTopic(this.__wbg_ptr);
2406
+ let v1;
2407
+ if (ret[0] !== 0) {
2408
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2409
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2410
+ }
2411
+ return v1;
2412
+ }
2413
+ /**
2414
+ * @returns {boolean}
2415
+ */
2416
+ get retain() {
2417
+ const ret = wasm.willmessage_retain(this.__wbg_ptr);
2418
+ return ret !== 0;
2419
+ }
2420
+ /**
2421
+ * @param {string | null} [value]
2422
+ */
2423
+ set contentType(value) {
2424
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2425
+ var len0 = WASM_VECTOR_LEN;
2426
+ wasm.willmessage_set_contentType(this.__wbg_ptr, ptr0, len0);
2427
+ }
2428
+ /**
2429
+ * @param {number | null} [value]
2430
+ */
2431
+ set messageExpiryInterval(value) {
2432
+ wasm.willmessage_set_messageExpiryInterval(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
2433
+ }
2434
+ /**
2435
+ * @param {number} value
2436
+ */
2437
+ set qos(value) {
2438
+ wasm.willmessage_set_qos(this.__wbg_ptr, value);
2439
+ }
2440
+ /**
2441
+ * @param {string | null} [value]
2442
+ */
2443
+ set responseTopic(value) {
2444
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2445
+ var len0 = WASM_VECTOR_LEN;
2446
+ wasm.willmessage_set_responseTopic(this.__wbg_ptr, ptr0, len0);
2447
+ }
2448
+ /**
2449
+ * @param {boolean} value
2450
+ */
2451
+ set retain(value) {
2452
+ wasm.willmessage_set_retain(this.__wbg_ptr, value);
2453
+ }
2454
+ /**
2455
+ * @param {string} value
2456
+ */
2457
+ set topic(value) {
2458
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2459
+ const len0 = WASM_VECTOR_LEN;
2460
+ wasm.willmessage_set_topic(this.__wbg_ptr, ptr0, len0);
2461
+ }
2462
+ /**
2463
+ * @param {number | null} [value]
2464
+ */
2465
+ set willDelayInterval(value) {
2466
+ wasm.willmessage_set_willDelayInterval(this.__wbg_ptr, isLikeNone(value) ? Number.MAX_SAFE_INTEGER : (value) >>> 0);
2467
+ }
2468
+ /**
2469
+ * @returns {string}
2470
+ */
2471
+ get topic() {
2472
+ let deferred1_0;
2473
+ let deferred1_1;
2474
+ try {
2475
+ const ret = wasm.willmessage_topic(this.__wbg_ptr);
2476
+ deferred1_0 = ret[0];
2477
+ deferred1_1 = ret[1];
2478
+ return getStringFromWasm0(ret[0], ret[1]);
2479
+ } finally {
2480
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
2481
+ }
2482
+ }
2483
+ /**
2484
+ * @returns {number | undefined}
2485
+ */
2486
+ get willDelayInterval() {
2487
+ const ret = wasm.willmessage_willDelayInterval(this.__wbg_ptr);
2488
+ return ret === Number.MAX_SAFE_INTEGER ? undefined : ret;
2489
+ }
2490
+ }
2491
+ if (Symbol.dispose) WillMessage.prototype[Symbol.dispose] = WillMessage.prototype.free;
2492
+
2493
+ /**
2494
+ * Build an unopened [`Store`] from a config object
2495
+ * (`{ entities, scope: { rootEntity, childEntities, scopeField } }`).
2496
+ *
2497
+ * Pass an optional second argument to enable durable IndexedDB persistence
2498
+ * and/or remote MQTT-over-WebSocket sync:
2499
+ * `{ persistence: { dbName, passphrase? }, remote: { url, clientId?, ticket?, username?, password? } }`.
2500
+ * With a persistence `passphrase` the store is AES-GCM encrypted. `remote.url`
2501
+ * must be a `ws://`/`wss://` endpoint; `remote.ticket` is a JWT used for MQTT v5
2502
+ * enhanced auth, and `remote.username` + `remote.password` drive classic MQTT
2503
+ * password auth when the broker isn't in JWT mode (ticket takes precedence).
2504
+ * `initialize` then connects and live
2505
+ * mutations flow through `subscribeToEntity`/`getSnapshot`. Omit the argument
2506
+ * for an in-memory store.
2507
+ *
2508
+ * # Errors
2509
+ * Returns an error if the config or options object is malformed.
2510
+ * @param {any} config
2511
+ * @param {any} options
2512
+ * @returns {Store}
2513
+ */
2514
+ export function createStore(config, options) {
2515
+ const ret = wasm.createStore(config, options);
2516
+ if (ret[2]) {
2517
+ throw takeFromExternrefTable0(ret[1]);
2518
+ }
2519
+ return Store.__wrap(ret[0]);
2520
+ }
2521
+
2522
+ export function init() {
2523
+ wasm.init();
2524
+ }
2525
+ export function __wbg_Error_92b29b0548f8b746(arg0, arg1) {
2526
+ const ret = Error(getStringFromWasm0(arg0, arg1));
2527
+ return ret;
2528
+ }
2529
+ export function __wbg_Number_9a4e0ecb0fa16705(arg0) {
2530
+ const ret = Number(arg0);
2531
+ return ret;
2532
+ }
2533
+ export function __wbg_String_8564e559799eccda(arg0, arg1) {
2534
+ const ret = String(arg1);
2535
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2536
+ const len1 = WASM_VECTOR_LEN;
2537
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2538
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2539
+ }
2540
+ export function __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f(arg0, arg1) {
2541
+ const v = arg1;
2542
+ const ret = typeof(v) === 'bigint' ? v : undefined;
2543
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
2544
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2545
+ }
2546
+ export function __wbg___wbindgen_boolean_get_fa956cfa2d1bd751(arg0) {
2547
+ const v = arg0;
2548
+ const ret = typeof(v) === 'boolean' ? v : undefined;
2549
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
2550
+ }
2551
+ export function __wbg___wbindgen_debug_string_c25d447a39f5578f(arg0, arg1) {
2552
+ const ret = debugString(arg1);
2553
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2554
+ const len1 = WASM_VECTOR_LEN;
2555
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2556
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2557
+ }
2558
+ export function __wbg___wbindgen_in_aca499c5de7ff5e5(arg0, arg1) {
2559
+ const ret = arg0 in arg1;
2560
+ return ret;
2561
+ }
2562
+ export function __wbg___wbindgen_is_bigint_2f76dc55065b4273(arg0) {
2563
+ const ret = typeof(arg0) === 'bigint';
2564
+ return ret;
2565
+ }
2566
+ export function __wbg___wbindgen_is_function_1ff95bcc5517c252(arg0) {
2567
+ const ret = typeof(arg0) === 'function';
2568
+ return ret;
2569
+ }
2570
+ export function __wbg___wbindgen_is_null_ea9085d691f535d3(arg0) {
2571
+ const ret = arg0 === null;
2572
+ return ret;
2573
+ }
2574
+ export function __wbg___wbindgen_is_object_a27215656b807791(arg0) {
2575
+ const val = arg0;
2576
+ const ret = typeof(val) === 'object' && val !== null;
2577
+ return ret;
2578
+ }
2579
+ export function __wbg___wbindgen_is_undefined_c05833b95a3cf397(arg0) {
2580
+ const ret = arg0 === undefined;
2581
+ return ret;
2582
+ }
2583
+ export function __wbg___wbindgen_jsval_eq_e659fcf7b0e32763(arg0, arg1) {
2584
+ const ret = arg0 === arg1;
2585
+ return ret;
2586
+ }
2587
+ export function __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170(arg0, arg1) {
2588
+ const ret = arg0 == arg1;
2589
+ return ret;
2590
+ }
2591
+ export function __wbg___wbindgen_number_get_394265ed1e1b84ee(arg0, arg1) {
2592
+ const obj = arg1;
2593
+ const ret = typeof(obj) === 'number' ? obj : undefined;
2594
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
2595
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
2596
+ }
2597
+ export function __wbg___wbindgen_string_get_b0ca35b86a603356(arg0, arg1) {
2598
+ const obj = arg1;
2599
+ const ret = typeof(obj) === 'string' ? obj : undefined;
2600
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2601
+ var len1 = WASM_VECTOR_LEN;
2602
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2603
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2604
+ }
2605
+ export function __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {
2606
+ throw new Error(getStringFromWasm0(arg0, arg1));
2607
+ }
2608
+ export function __wbg__wbg_cb_unref_fffb441def202758(arg0) {
2609
+ arg0._wbg_cb_unref();
2610
+ }
2611
+ export function __wbg_abort_8a4b90d8b05efcf8() { return handleError(function (arg0) {
2612
+ arg0.abort();
2613
+ }, arguments); }
2614
+ export function __wbg_addEventListener_520e749bbae24529() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2615
+ arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3, arg4);
2616
+ }, arguments); }
2617
+ export function __wbg_addEventListener_d85450ee1320c989() { return handleError(function (arg0, arg1, arg2, arg3) {
2618
+ arg0.addEventListener(getStringFromWasm0(arg1, arg2), arg3);
2619
+ }, arguments); }
2620
+ export function __wbg_bound_0382866a50c2df81() { return handleError(function (arg0, arg1) {
2621
+ const ret = IDBKeyRange.bound(arg0, arg1);
2622
+ return ret;
2623
+ }, arguments); }
2624
+ export function __wbg_buffer_54b87055582c8a81(arg0) {
2625
+ const ret = arg0.buffer;
2626
+ return ret;
2627
+ }
2628
+ export function __wbg_call_44b7209e1e252e6a() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2629
+ const ret = arg0.call(arg1, arg2, arg3, arg4);
2630
+ return ret;
2631
+ }, arguments); }
2632
+ export function __wbg_call_8a2dd23819f8a60a() { return handleError(function (arg0, arg1) {
2633
+ const ret = arg0.call(arg1);
2634
+ return ret;
2635
+ }, arguments); }
2636
+ export function __wbg_call_a6e5c5dce5018821() { return handleError(function (arg0, arg1, arg2) {
2637
+ const ret = arg0.call(arg1, arg2);
2638
+ return ret;
2639
+ }, arguments); }
2640
+ export function __wbg_call_e3b662382210db98() { return handleError(function (arg0, arg1, arg2, arg3) {
2641
+ const ret = arg0.call(arg1, arg2, arg3);
2642
+ return ret;
2643
+ }, arguments); }
2644
+ export function __wbg_clearTimeout_3629d6209dfcc46e(arg0) {
2645
+ const ret = clearTimeout(arg0);
2646
+ return ret;
2647
+ }
2648
+ export function __wbg_close_3423cc7dafc477bb(arg0) {
2649
+ arg0.close();
2650
+ }
2651
+ export function __wbg_close_463f5a813b1d0317(arg0) {
2652
+ arg0.close();
2653
+ }
2654
+ export function __wbg_close_c65ca0257e895318() { return handleError(function (arg0) {
2655
+ arg0.close();
2656
+ }, arguments); }
2657
+ export function __wbg_contains_72b3d3ec2e94729e(arg0, arg1, arg2) {
2658
+ const ret = arg0.contains(getStringFromWasm0(arg1, arg2));
2659
+ return ret;
2660
+ }
2661
+ export function __wbg_continue_97ad9c8cd4cf7f86() { return handleError(function (arg0) {
2662
+ arg0.continue();
2663
+ }, arguments); }
2664
+ export function __wbg_createObjectStore_c7a1db4a996dc8ac() { return handleError(function (arg0, arg1, arg2, arg3) {
2665
+ const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2), arg3);
2666
+ return ret;
2667
+ }, arguments); }
2668
+ export function __wbg_crypto_29a13c24f21f7c72() { return handleError(function (arg0) {
2669
+ const ret = arg0.crypto;
2670
+ return ret;
2671
+ }, arguments); }
2672
+ export function __wbg_cursor_new(arg0) {
2673
+ const ret = Cursor.__wrap(arg0);
2674
+ return ret;
2675
+ }
2676
+ export function __wbg_data_328de4280640da92(arg0) {
2677
+ const ret = arg0.data;
2678
+ return ret;
2679
+ }
2680
+ export function __wbg_database_new(arg0) {
2681
+ const ret = Database.__wrap(arg0);
2682
+ return ret;
2683
+ }
2684
+ export function __wbg_decrypt_beffd62d32dfd2ac() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2685
+ const ret = arg0.decrypt(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
2686
+ return ret;
2687
+ }, arguments); }
2688
+ export function __wbg_delete_e7e50168de5ef96e() { return handleError(function (arg0, arg1) {
2689
+ const ret = arg0.delete(arg1);
2690
+ return ret;
2691
+ }, arguments); }
2692
+ export function __wbg_deriveKey_ea5de45ca2f3aac6() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
2693
+ const ret = arg0.deriveKey(arg1, arg2, arg3, arg4 !== 0, arg5);
2694
+ return ret;
2695
+ }, arguments); }
2696
+ export function __wbg_done_89b2b13e91a60321(arg0) {
2697
+ const ret = arg0.done;
2698
+ return ret;
2699
+ }
2700
+ export function __wbg_encrypt_e5b8f6e6306e1edf() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
2701
+ const ret = arg0.encrypt(arg1, arg2, getArrayU8FromWasm0(arg3, arg4));
2702
+ return ret;
2703
+ }, arguments); }
2704
+ export function __wbg_entries_015dc610cd81ede0(arg0) {
2705
+ const ret = Object.entries(arg0);
2706
+ return ret;
2707
+ }
2708
+ export function __wbg_error_744744ff0c9861e6(arg0) {
2709
+ console.error(arg0);
2710
+ }
2711
+ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
2712
+ let deferred0_0;
2713
+ let deferred0_1;
2714
+ try {
2715
+ deferred0_0 = arg0;
2716
+ deferred0_1 = arg1;
2717
+ console.error(getStringFromWasm0(arg0, arg1));
2718
+ } finally {
2719
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
2720
+ }
2721
+ }
2722
+ export function __wbg_from_13e323c65fc8f464(arg0) {
2723
+ const ret = Array.from(arg0);
2724
+ return ret;
2725
+ }
2726
+ export function __wbg_getRandomValues_4d75c4f1f63e1972() { return handleError(function (arg0, arg1, arg2) {
2727
+ const ret = arg0.getRandomValues(getArrayU8FromWasm0(arg1, arg2));
2728
+ return ret;
2729
+ }, arguments); }
2730
+ export function __wbg_getRandomValues_ef12552bf5acd2fe() { return handleError(function (arg0, arg1) {
2731
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
2732
+ }, arguments); }
2733
+ export function __wbg_get_507a50627bffa49b(arg0, arg1) {
2734
+ const ret = arg0[arg1 >>> 0];
2735
+ return ret;
2736
+ }
2737
+ export function __wbg_get_c7eb1f358a7654df() { return handleError(function (arg0, arg1) {
2738
+ const ret = Reflect.get(arg0, arg1);
2739
+ return ret;
2740
+ }, arguments); }
2741
+ export function __wbg_get_cefddcaffca4fbb7() { return handleError(function (arg0, arg1) {
2742
+ const ret = arg0.get(arg1);
2743
+ return ret;
2744
+ }, arguments); }
2745
+ export function __wbg_get_unchecked_6e0ad6d2a41b06f6(arg0, arg1) {
2746
+ const ret = arg0[arg1 >>> 0];
2747
+ return ret;
2748
+ }
2749
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
2750
+ const ret = arg0[arg1];
2751
+ return ret;
2752
+ }
2753
+ export function __wbg_importKey_10a137b5a53c66ba() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
2754
+ const ret = arg0.importKey(getStringFromWasm0(arg1, arg2), arg3, getStringFromWasm0(arg4, arg5), arg6 !== 0, arg7);
2755
+ return ret;
2756
+ }, arguments); }
2757
+ export function __wbg_indexedDB_c7dd741e3b661da5() { return handleError(function (arg0) {
2758
+ const ret = arg0.indexedDB;
2759
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2760
+ }, arguments); }
2761
+ export function __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb(arg0) {
2762
+ let result;
2763
+ try {
2764
+ result = arg0 instanceof ArrayBuffer;
2765
+ } catch (_) {
2766
+ result = false;
2767
+ }
2768
+ const ret = result;
2769
+ return ret;
2770
+ }
2771
+ export function __wbg_instanceof_Map_e5b5e3db98422fcc(arg0) {
2772
+ let result;
2773
+ try {
2774
+ result = arg0 instanceof Map;
2775
+ } catch (_) {
2776
+ result = false;
2777
+ }
2778
+ const ret = result;
2779
+ return ret;
2780
+ }
2781
+ export function __wbg_instanceof_Uint8Array_309b927aaf7a3fc7(arg0) {
2782
+ let result;
2783
+ try {
2784
+ result = arg0 instanceof Uint8Array;
2785
+ } catch (_) {
2786
+ result = false;
2787
+ }
2788
+ const ret = result;
2789
+ return ret;
2790
+ }
2791
+ export function __wbg_instanceof_Window_05ba1ee4f6781663(arg0) {
2792
+ let result;
2793
+ try {
2794
+ result = arg0 instanceof Window;
2795
+ } catch (_) {
2796
+ result = false;
2797
+ }
2798
+ const ret = result;
2799
+ return ret;
2800
+ }
2801
+ export function __wbg_isArray_0677c962b281d01a(arg0) {
2802
+ const ret = Array.isArray(arg0);
2803
+ return ret;
2804
+ }
2805
+ export function __wbg_isSafeInteger_04f36e4056f1b851(arg0) {
2806
+ const ret = Number.isSafeInteger(arg0);
2807
+ return ret;
2808
+ }
2809
+ export function __wbg_iterator_6f722e4a93058b71() {
2810
+ const ret = Symbol.iterator;
2811
+ return ret;
2812
+ }
2813
+ export function __wbg_key_b74c6cd401e5906b() { return handleError(function (arg0) {
2814
+ const ret = arg0.key;
2815
+ return ret;
2816
+ }, arguments); }
2817
+ export function __wbg_length_1f0964f4a5e2c6d8(arg0) {
2818
+ const ret = arg0.length;
2819
+ return ret;
2820
+ }
2821
+ export function __wbg_length_370319915dc99107(arg0) {
2822
+ const ret = arg0.length;
2823
+ return ret;
2824
+ }
2825
+ export function __wbg_log_d267660666346fb3(arg0) {
2826
+ console.log(arg0);
2827
+ }
2828
+ export function __wbg_messageproperties_new(arg0) {
2829
+ const ret = MessageProperties.__wrap(arg0);
2830
+ return ret;
2831
+ }
2832
+ export function __wbg_navigator_99621db14b3f1099(arg0) {
2833
+ const ret = arg0.navigator;
2834
+ return ret;
2835
+ }
2836
+ export function __wbg_new_227d7c05414eb861() {
2837
+ const ret = new Error();
2838
+ return ret;
2839
+ }
2840
+ export function __wbg_new_245322ac8cd2a4ae() { return handleError(function (arg0, arg1) {
2841
+ const ret = new BroadcastChannel(getStringFromWasm0(arg0, arg1));
2842
+ return ret;
2843
+ }, arguments); }
2844
+ export function __wbg_new_32b398fb48b6d94a() {
2845
+ const ret = new Array();
2846
+ return ret;
2847
+ }
2848
+ export function __wbg_new_aec3e25493d729fe(arg0, arg1) {
2849
+ try {
2850
+ var state0 = {a: arg0, b: arg1};
2851
+ var cb0 = (arg0, arg1) => {
2852
+ const a = state0.a;
2853
+ state0.a = 0;
2854
+ try {
2855
+ return wasm_bindgen__convert__closures_____invoke__h6cdd13954d61bb31(a, state0.b, arg0, arg1);
2856
+ } finally {
2857
+ state0.a = a;
2858
+ }
2859
+ };
2860
+ const ret = new Promise(cb0);
2861
+ return ret;
2862
+ } finally {
2863
+ state0.a = 0;
2864
+ }
2865
+ }
2866
+ export function __wbg_new_cd45aabdf6073e84(arg0) {
2867
+ const ret = new Uint8Array(arg0);
2868
+ return ret;
2869
+ }
2870
+ export function __wbg_new_da52cf8fe3429cb2() {
2871
+ const ret = new Object();
2872
+ return ret;
2873
+ }
2874
+ export function __wbg_new_from_slice_77cdfb7977362f3c(arg0, arg1) {
2875
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2876
+ return ret;
2877
+ }
2878
+ export function __wbg_new_no_args_ae97b3efc0e29062(arg0, arg1) {
2879
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
2880
+ return ret;
2881
+ }
2882
+ export function __wbg_new_typed_1824d93f294193e5(arg0, arg1) {
2883
+ try {
2884
+ var state0 = {a: arg0, b: arg1};
2885
+ var cb0 = (arg0, arg1) => {
2886
+ const a = state0.a;
2887
+ state0.a = 0;
2888
+ try {
2889
+ return wasm_bindgen__convert__closures_____invoke__h6cdd13954d61bb31(a, state0.b, arg0, arg1);
2890
+ } finally {
2891
+ state0.a = a;
2892
+ }
2893
+ };
2894
+ const ret = new Promise(cb0);
2895
+ return ret;
2896
+ } finally {
2897
+ state0.a = 0;
2898
+ }
2899
+ }
2900
+ export function __wbg_new_with_str_3f0451631559a818() { return handleError(function (arg0, arg1, arg2, arg3) {
2901
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
2902
+ return ret;
2903
+ }, arguments); }
2904
+ export function __wbg_next_6dbf2c0ac8cde20f(arg0) {
2905
+ const ret = arg0.next;
2906
+ return ret;
2907
+ }
2908
+ export function __wbg_next_71f2aa1cb3d1e37e() { return handleError(function (arg0) {
2909
+ const ret = arg0.next();
2910
+ return ret;
2911
+ }, arguments); }
2912
+ export function __wbg_now_0cce8c6798af1870() { return handleError(function () {
2913
+ const ret = Date.now();
2914
+ return ret;
2915
+ }, arguments); }
2916
+ export function __wbg_now_86c0d4ba3fa605b8() {
2917
+ const ret = Date.now();
2918
+ return ret;
2919
+ }
2920
+ export function __wbg_objectStoreNames_146ab25540bff6db(arg0) {
2921
+ const ret = arg0.objectStoreNames;
2922
+ return ret;
2923
+ }
2924
+ export function __wbg_objectStore_d5f47956b6c741e3() { return handleError(function (arg0, arg1, arg2) {
2925
+ const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));
2926
+ return ret;
2927
+ }, arguments); }
2928
+ export function __wbg_onLine_37be2d67e8996819(arg0) {
2929
+ const ret = arg0.onLine;
2930
+ return ret;
2931
+ }
2932
+ export function __wbg_openCursor_04059a89749928f3() { return handleError(function (arg0, arg1) {
2933
+ const ret = arg0.openCursor(arg1);
2934
+ return ret;
2935
+ }, arguments); }
2936
+ export function __wbg_open_72e5234a49d5f85d() { return handleError(function (arg0, arg1, arg2, arg3) {
2937
+ const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
2938
+ return ret;
2939
+ }, arguments); }
2940
+ export function __wbg_parse_1c0d8a8656d7e016() { return handleError(function (arg0, arg1) {
2941
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2942
+ return ret;
2943
+ }, arguments); }
2944
+ export function __wbg_postMessage_b80f20949a4b4f55() { return handleError(function (arg0, arg1) {
2945
+ arg0.postMessage(arg1);
2946
+ }, arguments); }
2947
+ export function __wbg_postMessage_dd820b768b365613() { return handleError(function (arg0, arg1) {
2948
+ arg0.postMessage(arg1);
2949
+ }, arguments); }
2950
+ export function __wbg_prototypesetcall_4770620bbe4688a0(arg0, arg1, arg2) {
2951
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2952
+ }
2953
+ export function __wbg_push_d2ae3af0c1217ae6(arg0, arg1) {
2954
+ const ret = arg0.push(arg1);
2955
+ return ret;
2956
+ }
2957
+ export function __wbg_put_a368805e3dcab3a7() { return handleError(function (arg0, arg1, arg2) {
2958
+ const ret = arg0.put(arg1, arg2);
2959
+ return ret;
2960
+ }, arguments); }
2961
+ export function __wbg_queueMicrotask_0ab5b2d2393e99b9(arg0) {
2962
+ const ret = arg0.queueMicrotask;
2963
+ return ret;
2964
+ }
2965
+ export function __wbg_queueMicrotask_6a09b7bc46549209(arg0) {
2966
+ queueMicrotask(arg0);
2967
+ }
2968
+ export function __wbg_random_039a7d5d06e0d333() {
2969
+ const ret = Math.random();
2970
+ return ret;
2971
+ }
2972
+ export function __wbg_removeEventListener_a3f23c70077bdcc1() { return handleError(function (arg0, arg1, arg2, arg3) {
2973
+ arg0.removeEventListener(getStringFromWasm0(arg1, arg2), arg3);
2974
+ }, arguments); }
2975
+ export function __wbg_resolve_2191a4dfe481c25b(arg0) {
2976
+ const ret = Promise.resolve(arg0);
2977
+ return ret;
2978
+ }
2979
+ export function __wbg_result_2b1294a2bf8dc773() { return handleError(function (arg0) {
2980
+ const ret = arg0.result;
2981
+ return ret;
2982
+ }, arguments); }
2983
+ export function __wbg_send_a321b376d40ec867() { return handleError(function (arg0, arg1, arg2) {
2984
+ arg0.send(getArrayU8FromWasm0(arg1, arg2));
2985
+ }, arguments); }
2986
+ export function __wbg_setTimeout_56bcdccbad22fd44() { return handleError(function (arg0, arg1) {
2987
+ const ret = setTimeout(arg0, arg1);
2988
+ return ret;
2989
+ }, arguments); }
2990
+ export function __wbg_setTimeout_e28675318d4194f4(arg0, arg1) {
2991
+ const ret = setTimeout(arg0, arg1);
2992
+ return ret;
2993
+ }
2994
+ export function __wbg_set_8535240470bf2500() { return handleError(function (arg0, arg1, arg2) {
2995
+ const ret = Reflect.set(arg0, arg1, arg2);
2996
+ return ret;
2997
+ }, arguments); }
2998
+ export function __wbg_set_additional_data_18e1cb74f3f32864(arg0, arg1) {
2999
+ arg0.additionalData = arg1;
3000
+ }
3001
+ export function __wbg_set_binaryType_a37b086c78ca7c29(arg0, arg1) {
3002
+ arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
3003
+ }
3004
+ export function __wbg_set_hash_8fcaef147d95108f(arg0, arg1) {
3005
+ arg0.hash = arg1;
3006
+ }
3007
+ export function __wbg_set_iterations_37c9c9d5d631e5d7(arg0, arg1) {
3008
+ arg0.iterations = arg1 >>> 0;
3009
+ }
3010
+ export function __wbg_set_iv_3e6d5e431df58a93(arg0, arg1) {
3011
+ arg0.iv = arg1;
3012
+ }
3013
+ export function __wbg_set_length_ee8e5a826b98e0c4(arg0, arg1) {
3014
+ arg0.length = arg1;
3015
+ }
3016
+ export function __wbg_set_name_35acf0ca654b7d26(arg0, arg1, arg2) {
3017
+ arg0.name = getStringFromWasm0(arg1, arg2);
3018
+ }
3019
+ export function __wbg_set_name_6ff1f3d52f53eda3(arg0, arg1, arg2) {
3020
+ arg0.name = getStringFromWasm0(arg1, arg2);
3021
+ }
3022
+ export function __wbg_set_name_ca0910cc3b07587b(arg0, arg1, arg2) {
3023
+ arg0.name = getStringFromWasm0(arg1, arg2);
3024
+ }
3025
+ export function __wbg_set_once_51a9fb6b8af8a72b(arg0, arg1) {
3026
+ arg0.once = arg1 !== 0;
3027
+ }
3028
+ export function __wbg_set_onclose_f706475385ecce07(arg0, arg1) {
3029
+ arg0.onclose = arg1;
3030
+ }
3031
+ export function __wbg_set_onerror_3488a474171ed56d(arg0, arg1) {
3032
+ arg0.onerror = arg1;
3033
+ }
3034
+ export function __wbg_set_onerror_9f5773fd31512333(arg0, arg1) {
3035
+ arg0.onerror = arg1;
3036
+ }
3037
+ export function __wbg_set_onmessage_7fa6f7ccf8ee2d7a(arg0, arg1) {
3038
+ arg0.onmessage = arg1;
3039
+ }
3040
+ export function __wbg_set_onmessage_836d2f72130b4706(arg0, arg1) {
3041
+ arg0.onmessage = arg1;
3042
+ }
3043
+ export function __wbg_set_onmessage_d511b70365304094(arg0, arg1) {
3044
+ arg0.onmessage = arg1;
3045
+ }
3046
+ export function __wbg_set_onopen_4f65470ae522a61a(arg0, arg1) {
3047
+ arg0.onopen = arg1;
3048
+ }
3049
+ export function __wbg_set_onsuccess_cd0c3642a2873e66(arg0, arg1) {
3050
+ arg0.onsuccess = arg1;
3051
+ }
3052
+ export function __wbg_set_onupgradeneeded_7b2cf4ba1c57e655(arg0, arg1) {
3053
+ arg0.onupgradeneeded = arg1;
3054
+ }
3055
+ export function __wbg_set_salt_d41a4905149f81e2(arg0, arg1) {
3056
+ arg0.salt = arg1;
3057
+ }
3058
+ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
3059
+ const ret = arg1.stack;
3060
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3061
+ const len1 = WASM_VECTOR_LEN;
3062
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3063
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3064
+ }
3065
+ export function __wbg_start_d0cdf16ff965b3f3(arg0) {
3066
+ arg0.start();
3067
+ }
3068
+ export function __wbg_static_accessor_GLOBAL_4ef717fb391d88b7() {
3069
+ const ret = typeof global === 'undefined' ? null : global;
3070
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3071
+ }
3072
+ export function __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4() {
3073
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
3074
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3075
+ }
3076
+ export function __wbg_static_accessor_SELF_146583524fe1469b() {
3077
+ const ret = typeof self === 'undefined' ? null : self;
3078
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3079
+ }
3080
+ export function __wbg_static_accessor_WINDOW_f2829a2234d7819e() {
3081
+ const ret = typeof window === 'undefined' ? null : window;
3082
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3083
+ }
3084
+ export function __wbg_stringify_b54333f60f1e4dad() { return handleError(function (arg0) {
3085
+ const ret = JSON.stringify(arg0);
3086
+ return ret;
3087
+ }, arguments); }
3088
+ export function __wbg_subtle_ed1dfcaede24af07(arg0) {
3089
+ const ret = arg0.subtle;
3090
+ return ret;
3091
+ }
3092
+ export function __wbg_target_e759594a8d965ed7(arg0) {
3093
+ const ret = arg0.target;
3094
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
3095
+ }
3096
+ export function __wbg_then_16d107c451e9905d(arg0, arg1, arg2) {
3097
+ const ret = arg0.then(arg1, arg2);
3098
+ return ret;
3099
+ }
3100
+ export function __wbg_then_6ec10ae38b3e92f7(arg0, arg1) {
3101
+ const ret = arg0.then(arg1);
3102
+ return ret;
3103
+ }
3104
+ export function __wbg_transaction_d911d96b4b0af154() { return handleError(function (arg0, arg1, arg2, arg3) {
3105
+ const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
3106
+ return ret;
3107
+ }, arguments); }
3108
+ export function __wbg_value_361064aa58a53344() { return handleError(function (arg0) {
3109
+ const ret = arg0.value;
3110
+ return ret;
3111
+ }, arguments); }
3112
+ export function __wbg_value_a5d5488a9589444a(arg0) {
3113
+ const ret = arg0.value;
3114
+ return ret;
3115
+ }
3116
+ export function __wbg_warn_b1370d804fa3e259(arg0) {
3117
+ console.warn(arg0);
3118
+ }
3119
+ export function __wbindgen_cast_0000000000000001(arg0, arg1) {
3120
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1012, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3121
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9efe92496f0b7d96);
3122
+ return ret;
3123
+ }
3124
+ export function __wbindgen_cast_0000000000000002(arg0, arg1) {
3125
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3126
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033);
3127
+ return ret;
3128
+ }
3129
+ export function __wbindgen_cast_0000000000000003(arg0, arg1) {
3130
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3131
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_2);
3132
+ return ret;
3133
+ }
3134
+ export function __wbindgen_cast_0000000000000004(arg0, arg1) {
3135
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3136
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_3);
3137
+ return ret;
3138
+ }
3139
+ export function __wbindgen_cast_0000000000000005(arg0, arg1) {
3140
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 979, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3141
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h80d264b987904cc4);
3142
+ return ret;
3143
+ }
3144
+ export function __wbindgen_cast_0000000000000006(arg0, arg1) {
3145
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 979, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3146
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h80d264b987904cc4_5);
3147
+ return ret;
3148
+ }
3149
+ export function __wbindgen_cast_0000000000000007(arg0, arg1) {
3150
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3151
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_6);
3152
+ return ret;
3153
+ }
3154
+ export function __wbindgen_cast_0000000000000008(arg0, arg1) {
3155
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 524, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3156
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hee5f925a602b3a9a);
3157
+ return ret;
3158
+ }
3159
+ export function __wbindgen_cast_0000000000000009(arg0, arg1) {
3160
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 537, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3161
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd5b519e296d8647e);
3162
+ return ret;
3163
+ }
3164
+ export function __wbindgen_cast_000000000000000a(arg0) {
3165
+ // Cast intrinsic for `F64 -> Externref`.
3166
+ const ret = arg0;
3167
+ return ret;
3168
+ }
3169
+ export function __wbindgen_cast_000000000000000b(arg0) {
3170
+ // Cast intrinsic for `I64 -> Externref`.
3171
+ const ret = arg0;
3172
+ return ret;
3173
+ }
3174
+ export function __wbindgen_cast_000000000000000c(arg0, arg1) {
3175
+ // Cast intrinsic for `Ref(String) -> Externref`.
3176
+ const ret = getStringFromWasm0(arg0, arg1);
3177
+ return ret;
3178
+ }
3179
+ export function __wbindgen_cast_000000000000000d(arg0) {
3180
+ // Cast intrinsic for `U64 -> Externref`.
3181
+ const ret = BigInt.asUintN(64, arg0);
3182
+ return ret;
3183
+ }
3184
+ export function __wbindgen_init_externref_table() {
3185
+ const table = wasm.__wbindgen_externrefs;
3186
+ const offset = table.grow(4);
3187
+ table.set(0, undefined);
3188
+ table.set(offset + 0, undefined);
3189
+ table.set(offset + 1, null);
3190
+ table.set(offset + 2, true);
3191
+ table.set(offset + 3, false);
3192
+ }
3193
+ function wasm_bindgen__convert__closures_____invoke__hee5f925a602b3a9a(arg0, arg1) {
3194
+ wasm.wasm_bindgen__convert__closures_____invoke__hee5f925a602b3a9a(arg0, arg1);
3195
+ }
3196
+
3197
+ function wasm_bindgen__convert__closures_____invoke__hd5b519e296d8647e(arg0, arg1) {
3198
+ wasm.wasm_bindgen__convert__closures_____invoke__hd5b519e296d8647e(arg0, arg1);
3199
+ }
3200
+
3201
+ function wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033(arg0, arg1, arg2) {
3202
+ wasm.wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033(arg0, arg1, arg2);
3203
+ }
3204
+
3205
+ function wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_2(arg0, arg1, arg2) {
3206
+ wasm.wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_2(arg0, arg1, arg2);
3207
+ }
3208
+
3209
+ function wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_3(arg0, arg1, arg2) {
3210
+ wasm.wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_3(arg0, arg1, arg2);
3211
+ }
3212
+
3213
+ function wasm_bindgen__convert__closures_____invoke__h80d264b987904cc4(arg0, arg1, arg2) {
3214
+ wasm.wasm_bindgen__convert__closures_____invoke__h80d264b987904cc4(arg0, arg1, arg2);
3215
+ }
3216
+
3217
+ function wasm_bindgen__convert__closures_____invoke__h80d264b987904cc4_5(arg0, arg1, arg2) {
3218
+ wasm.wasm_bindgen__convert__closures_____invoke__h80d264b987904cc4_5(arg0, arg1, arg2);
3219
+ }
3220
+
3221
+ function wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_6(arg0, arg1, arg2) {
3222
+ wasm.wasm_bindgen__convert__closures_____invoke__h09f8c77406c99033_6(arg0, arg1, arg2);
3223
+ }
3224
+
3225
+ function wasm_bindgen__convert__closures_____invoke__h9efe92496f0b7d96(arg0, arg1, arg2) {
3226
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h9efe92496f0b7d96(arg0, arg1, arg2);
3227
+ if (ret[1]) {
3228
+ throw takeFromExternrefTable0(ret[0]);
3229
+ }
3230
+ }
3231
+
3232
+ function wasm_bindgen__convert__closures_____invoke__h6cdd13954d61bb31(arg0, arg1, arg2, arg3) {
3233
+ wasm.wasm_bindgen__convert__closures_____invoke__h6cdd13954d61bb31(arg0, arg1, arg2, arg3);
3234
+ }
3235
+
3236
+
3237
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
3238
+
3239
+
3240
+ const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
3241
+ const ConnectOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
3242
+ ? { register: () => {}, unregister: () => {} }
3243
+ : new FinalizationRegistry(ptr => wasm.__wbg_connectoptions_free(ptr, 1));
3244
+ const CursorFinalization = (typeof FinalizationRegistry === 'undefined')
3245
+ ? { register: () => {}, unregister: () => {} }
3246
+ : new FinalizationRegistry(ptr => wasm.__wbg_cursor_free(ptr, 1));
3247
+ const DatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
3248
+ ? { register: () => {}, unregister: () => {} }
3249
+ : new FinalizationRegistry(ptr => wasm.__wbg_database_free(ptr, 1));
3250
+ const MessagePropertiesFinalization = (typeof FinalizationRegistry === 'undefined')
3251
+ ? { register: () => {}, unregister: () => {} }
3252
+ : new FinalizationRegistry(ptr => wasm.__wbg_messageproperties_free(ptr, 1));
3253
+ const MqttClientFinalization = (typeof FinalizationRegistry === 'undefined')
3254
+ ? { register: () => {}, unregister: () => {} }
3255
+ : new FinalizationRegistry(ptr => wasm.__wbg_mqttclient_free(ptr, 1));
3256
+ const PublishOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
3257
+ ? { register: () => {}, unregister: () => {} }
3258
+ : new FinalizationRegistry(ptr => wasm.__wbg_publishoptions_free(ptr, 1));
3259
+ const ReconnectOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
3260
+ ? { register: () => {}, unregister: () => {} }
3261
+ : new FinalizationRegistry(ptr => wasm.__wbg_reconnectoptions_free(ptr, 1));
3262
+ const StoreFinalization = (typeof FinalizationRegistry === 'undefined')
3263
+ ? { register: () => {}, unregister: () => {} }
3264
+ : new FinalizationRegistry(ptr => wasm.__wbg_store_free(ptr, 1));
3265
+ const SubscribeOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
3266
+ ? { register: () => {}, unregister: () => {} }
3267
+ : new FinalizationRegistry(ptr => wasm.__wbg_subscribeoptions_free(ptr, 1));
3268
+ const WillMessageFinalization = (typeof FinalizationRegistry === 'undefined')
3269
+ ? { register: () => {}, unregister: () => {} }
3270
+ : new FinalizationRegistry(ptr => wasm.__wbg_willmessage_free(ptr, 1));
3271
+
3272
+ function addToExternrefTable0(obj) {
3273
+ const idx = wasm.__externref_table_alloc();
3274
+ wasm.__wbindgen_externrefs.set(idx, obj);
3275
+ return idx;
3276
+ }
3277
+
3278
+ function _assertClass(instance, klass) {
3279
+ if (!(instance instanceof klass)) {
3280
+ throw new Error(`expected instance of ${klass.name}`);
3281
+ }
3282
+ }
3283
+
3284
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
3285
+ ? { register: () => {}, unregister: () => {} }
3286
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
3287
+
3288
+ function debugString(val) {
3289
+ // primitive types
3290
+ const type = typeof val;
3291
+ if (type == 'number' || type == 'boolean' || val == null) {
3292
+ return `${val}`;
3293
+ }
3294
+ if (type == 'string') {
3295
+ return `"${val}"`;
3296
+ }
3297
+ if (type == 'symbol') {
3298
+ const description = val.description;
3299
+ if (description == null) {
3300
+ return 'Symbol';
3301
+ } else {
3302
+ return `Symbol(${description})`;
3303
+ }
3304
+ }
3305
+ if (type == 'function') {
3306
+ const name = val.name;
3307
+ if (typeof name == 'string' && name.length > 0) {
3308
+ return `Function(${name})`;
3309
+ } else {
3310
+ return 'Function';
3311
+ }
3312
+ }
3313
+ // objects
3314
+ if (Array.isArray(val)) {
3315
+ const length = val.length;
3316
+ let debug = '[';
3317
+ if (length > 0) {
3318
+ debug += debugString(val[0]);
3319
+ }
3320
+ for(let i = 1; i < length; i++) {
3321
+ debug += ', ' + debugString(val[i]);
3322
+ }
3323
+ debug += ']';
3324
+ return debug;
3325
+ }
3326
+ // Test for built-in
3327
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
3328
+ let className;
3329
+ if (builtInMatches && builtInMatches.length > 1) {
3330
+ className = builtInMatches[1];
3331
+ } else {
3332
+ // Failed to match the standard '[object ClassName]'
3333
+ return toString.call(val);
3334
+ }
3335
+ if (className == 'Object') {
3336
+ // we're a user defined class or Object
3337
+ // JSON.stringify avoids problems with cycles, and is generally much
3338
+ // easier than looping through ownProperties of `val`.
3339
+ try {
3340
+ return 'Object(' + JSON.stringify(val) + ')';
3341
+ } catch (_) {
3342
+ return 'Object';
3343
+ }
3344
+ }
3345
+ // errors
3346
+ if (val instanceof Error) {
3347
+ return `${val.name}: ${val.message}\n${val.stack}`;
3348
+ }
3349
+ // TODO we could test for more things here, like `Set`s and `Map`s.
3350
+ return className;
3351
+ }
3352
+
3353
+ function getArrayJsValueFromWasm0(ptr, len) {
3354
+ ptr = ptr >>> 0;
3355
+ const mem = getDataViewMemory0();
3356
+ const result = [];
3357
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
3358
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
3359
+ }
3360
+ wasm.__externref_drop_slice(ptr, len);
3361
+ return result;
3362
+ }
3363
+
3364
+ function getArrayU32FromWasm0(ptr, len) {
3365
+ ptr = ptr >>> 0;
3366
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
3367
+ }
3368
+
3369
+ function getArrayU8FromWasm0(ptr, len) {
3370
+ ptr = ptr >>> 0;
3371
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
3372
+ }
3373
+
3374
+ let cachedDataViewMemory0 = null;
3375
+ function getDataViewMemory0() {
3376
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
3377
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
3378
+ }
3379
+ return cachedDataViewMemory0;
3380
+ }
3381
+
3382
+ function getStringFromWasm0(ptr, len) {
3383
+ return decodeText(ptr >>> 0, len);
3384
+ }
3385
+
3386
+ let cachedUint32ArrayMemory0 = null;
3387
+ function getUint32ArrayMemory0() {
3388
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
3389
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
3390
+ }
3391
+ return cachedUint32ArrayMemory0;
3392
+ }
3393
+
3394
+ let cachedUint8ArrayMemory0 = null;
3395
+ function getUint8ArrayMemory0() {
3396
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
3397
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
3398
+ }
3399
+ return cachedUint8ArrayMemory0;
3400
+ }
3401
+
3402
+ function handleError(f, args) {
3403
+ try {
3404
+ return f.apply(this, args);
3405
+ } catch (e) {
3406
+ const idx = addToExternrefTable0(e);
3407
+ wasm.__wbindgen_exn_store(idx);
3408
+ }
3409
+ }
3410
+
3411
+ function isLikeNone(x) {
3412
+ return x === undefined || x === null;
3413
+ }
3414
+
3415
+ function makeMutClosure(arg0, arg1, f) {
3416
+ const state = { a: arg0, b: arg1, cnt: 1 };
3417
+ const real = (...args) => {
3418
+
3419
+ // First up with a closure we increment the internal reference
3420
+ // count. This ensures that the Rust closure environment won't
3421
+ // be deallocated while we're invoking it.
3422
+ state.cnt++;
3423
+ const a = state.a;
3424
+ state.a = 0;
3425
+ try {
3426
+ return f(a, state.b, ...args);
3427
+ } finally {
3428
+ state.a = a;
3429
+ real._wbg_cb_unref();
3430
+ }
3431
+ };
3432
+ real._wbg_cb_unref = () => {
3433
+ if (--state.cnt === 0) {
3434
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
3435
+ state.a = 0;
3436
+ CLOSURE_DTORS.unregister(state);
3437
+ }
3438
+ };
3439
+ CLOSURE_DTORS.register(real, state, state);
3440
+ return real;
3441
+ }
3442
+
3443
+ function passArray8ToWasm0(arg, malloc) {
3444
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
3445
+ getUint8ArrayMemory0().set(arg, ptr / 1);
3446
+ WASM_VECTOR_LEN = arg.length;
3447
+ return ptr;
3448
+ }
3449
+
3450
+ function passArrayJsValueToWasm0(array, malloc) {
3451
+ const ptr = malloc(array.length * 4, 4) >>> 0;
3452
+ for (let i = 0; i < array.length; i++) {
3453
+ const add = addToExternrefTable0(array[i]);
3454
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
3455
+ }
3456
+ WASM_VECTOR_LEN = array.length;
3457
+ return ptr;
3458
+ }
3459
+
3460
+ function passStringToWasm0(arg, malloc, realloc) {
3461
+ if (realloc === undefined) {
3462
+ const buf = cachedTextEncoder.encode(arg);
3463
+ const ptr = malloc(buf.length, 1) >>> 0;
3464
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
3465
+ WASM_VECTOR_LEN = buf.length;
3466
+ return ptr;
3467
+ }
3468
+
3469
+ let len = arg.length;
3470
+ let ptr = malloc(len, 1) >>> 0;
3471
+
3472
+ const mem = getUint8ArrayMemory0();
3473
+
3474
+ let offset = 0;
3475
+
3476
+ for (; offset < len; offset++) {
3477
+ const code = arg.charCodeAt(offset);
3478
+ if (code > 0x7F) break;
3479
+ mem[ptr + offset] = code;
3480
+ }
3481
+ if (offset !== len) {
3482
+ if (offset !== 0) {
3483
+ arg = arg.slice(offset);
3484
+ }
3485
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
3486
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
3487
+ const ret = cachedTextEncoder.encodeInto(arg, view);
3488
+
3489
+ offset += ret.written;
3490
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
3491
+ }
3492
+
3493
+ WASM_VECTOR_LEN = offset;
3494
+ return ptr;
3495
+ }
3496
+
3497
+ function takeFromExternrefTable0(idx) {
3498
+ const value = wasm.__wbindgen_externrefs.get(idx);
3499
+ wasm.__externref_table_dealloc(idx);
3500
+ return value;
3501
+ }
3502
+
3503
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
3504
+ cachedTextDecoder.decode();
3505
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
3506
+ let numBytesDecoded = 0;
3507
+ function decodeText(ptr, len) {
3508
+ numBytesDecoded += len;
3509
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
3510
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
3511
+ cachedTextDecoder.decode();
3512
+ numBytesDecoded = len;
3513
+ }
3514
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
3515
+ }
3516
+
3517
+ const cachedTextEncoder = new TextEncoder();
3518
+
3519
+ if (!('encodeInto' in cachedTextEncoder)) {
3520
+ cachedTextEncoder.encodeInto = function (arg, view) {
3521
+ const buf = cachedTextEncoder.encode(arg);
3522
+ view.set(buf);
3523
+ return {
3524
+ read: arg.length,
3525
+ written: buf.length
3526
+ };
3527
+ };
3528
+ }
3529
+
3530
+ let WASM_VECTOR_LEN = 0;
3531
+
3532
+
3533
+ let wasm;
3534
+ export function __wbg_set_wasm(val) {
3535
+ wasm = val;
3536
+ }