jazz-wasm 2.0.0-alpha.45 → 2.0.0-alpha.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jazz-wasm",
3
- "version": "2.0.0-alpha.45",
3
+ "version": "2.0.0-alpha.47",
4
4
  "description": "WebAssembly bindings for the Jazz database engine",
5
5
  "keywords": [
6
6
  "crdt",
@@ -26,6 +26,7 @@
26
26
  "tag": "alpha"
27
27
  },
28
28
  "scripts": {
29
- "build": "wasm-pack build --target web --profiling"
29
+ "build": "wasm-pack build --target web --release",
30
+ "build:profiling": "wasm-pack build --target web --profiling"
30
31
  }
31
32
  }
@@ -124,6 +124,10 @@ export class WasmRuntime {
124
124
  * before the call returns, rather than being deferred to a microtask.
125
125
  */
126
126
  addServer(server_catalogue_state_hash?: string | null, next_sync_seq?: number | null): void;
127
+ /**
128
+ * Drive the runtime's batched receive/apply/send loop immediately.
129
+ */
130
+ batchedTick(): void;
127
131
  /**
128
132
  * Connect to a Jazz server over WebSocket.
129
133
  *
@@ -137,30 +141,29 @@ export class WasmRuntime {
137
141
  */
138
142
  createSubscription(query_json: string, session_json?: string | null, settled_tier?: string | null, options_json?: string | null): number;
139
143
  /**
140
- * Delete a row by ObjectId.
141
- */
142
- delete(object_id: string): any;
143
- /**
144
- * Delete a row immediately, returning the logical batch id that tracks
145
- * replayable persisted fate for this write.
144
+ * Attach a `WasmWorkerBridge` to this runtime. Convenience helper so the
145
+ * TS-side `WorkerBridge` adapter can construct the Rust bridge without
146
+ * importing `WasmWorkerBridge` directly — it gets it back from the
147
+ * runtime instance.
148
+ *
149
+ * `options` is the `WorkerBridgeOptions` JS object (parsed at attach
150
+ * time per spec; `init` no longer takes options).
146
151
  */
147
- deletePersisted(object_id: string, tier: string): any;
152
+ createWorkerBridge(worker: Worker, options: any): WasmWorkerBridge;
148
153
  /**
149
- * Delete a row immediately, returning the logical batch id that tracks
150
- * replayable persisted fate for this write, scoped to an explicit session
151
- * principal or transactional write context.
154
+ * Delete a row by ObjectId.
152
155
  */
153
- deletePersistedWithSession(object_id: string, write_context_json: string | null | undefined, tier: string): any;
156
+ delete(object_id: string): any;
154
157
  /**
155
158
  * Delete a row by ObjectId as an explicit session principal.
156
159
  */
157
160
  deleteWithSession(object_id: string, write_context_json?: string | null): any;
158
161
  static deriveUserId(seed_b64: string): string;
162
+ discardLocalBatch(batch_id: string): boolean;
159
163
  /**
160
164
  * Disconnect from the Jazz server and drop the transport handle.
161
165
  */
162
166
  disconnect(): void;
163
- drainRejectedBatchIds(): any;
164
167
  /**
165
168
  * Phase 2 of 2-phase subscribe: compile graph, register subscription,
166
169
  * sync to servers, attach callback, and deliver the first delta.
@@ -185,6 +188,7 @@ export class WasmRuntime {
185
188
  * Get the canonical schema hash (64-char hex).
186
189
  */
187
190
  getSchemaHash(): string;
191
+ hydrateLocalBatchRecordStorageRow(bytes: Uint8Array): void;
188
192
  /**
189
193
  * Insert a row into a table.
190
194
  *
@@ -192,22 +196,13 @@ export class WasmRuntime {
192
196
  * The inserted row as `{ id, values, batchId }`.
193
197
  */
194
198
  insert(table: string, values: any, object_id?: string | null): any;
195
- /**
196
- * Insert a row immediately, returning the logical batch id that tracks
197
- * replayable persisted fate for this write.
198
- */
199
- insertPersisted(table: string, values: any, tier: string): any;
200
- /**
201
- * Insert a row immediately, returning the logical batch id that tracks
202
- * replayable persisted fate for this write, scoped to an explicit session
203
- * principal or transactional write context.
204
- */
205
- insertPersistedWithSession(table: string, values: any, write_context_json: string | null | undefined, tier: string): any;
206
199
  /**
207
200
  * Insert a row into a table as an explicit session principal.
208
201
  */
209
202
  insertWithSession(table: string, values: any, write_context_json?: string | null, object_id?: string | null): any;
203
+ loadBatchFate(batch_id: string): any;
210
204
  loadLocalBatchRecord(batch_id: string): any;
205
+ loadLocalBatchRecordStorageRow(batch_id: string): any;
211
206
  loadLocalBatchRecords(): any;
212
207
  static mintJazzSelfSignedToken(seed_b64: string, issuer: string, audience: string, ttl_seconds: bigint, now_seconds: bigint): string;
213
208
  /**
@@ -233,6 +228,10 @@ export class WasmRuntime {
233
228
  * The callback receives a single string argument: a human-readable reason.
234
229
  */
235
230
  onAuthFailure(callback: Function): void;
231
+ /**
232
+ * Register a callback for unhandled mutation errors.
233
+ */
234
+ onMutationError(callback: Function): void;
236
235
  /**
237
236
  * Called by JS when a sync message arrives from the server.
238
237
  *
@@ -249,10 +248,6 @@ export class WasmRuntime {
249
248
  * * `payload` - Postcard-encoded SyncPayload bytes
250
249
  */
251
250
  onSyncMessageReceivedFromClient(client_id: string, payload: any): void;
252
- /**
253
- * Register a callback for outgoing sync messages.
254
- */
255
- onSyncMessageToSend(callback: Function): void;
256
251
  /**
257
252
  * Create an ephemeral WasmRuntime backed by in-memory storage.
258
253
  *
@@ -273,10 +268,14 @@ export class WasmRuntime {
273
268
  * Optional durability tier controls remote settlement behavior.
274
269
  */
275
270
  query(query_json: string, session_json?: string | null, settled_tier?: string | null, options_json?: string | null): Promise<any>;
271
+ reconcileLocalBatchWithServer(batch_id: string): void;
276
272
  /**
277
273
  * Remove the current upstream server connection.
278
274
  */
279
275
  removeServer(): void;
276
+ replayBatchRejection(batch_id: string, code: string, reason: string): void;
277
+ replayLocalBatchPayloads(batch_id: string): Array<any>;
278
+ retransmitLocalBatch(batch_id: string): void;
280
279
  sealBatch(batch_id: string): void;
281
280
  /**
282
281
  * Set a client's role.
@@ -311,17 +310,6 @@ export class WasmRuntime {
311
310
  * Push updated auth credentials into the live transport.
312
311
  */
313
312
  updateAuth(auth_json: string): void;
314
- /**
315
- * Update a row immediately, returning the logical batch id that tracks
316
- * replayable persisted fate for this write.
317
- */
318
- updatePersisted(object_id: string, values: any, tier: string): any;
319
- /**
320
- * Update a row immediately, returning the logical batch id that tracks
321
- * replayable persisted fate for this write, scoped to an explicit session
322
- * principal or transactional write context.
323
- */
324
- updatePersistedWithSession(object_id: string, values: any, write_context_json: string | null | undefined, tier: string): any;
325
313
  /**
326
314
  * Update a row by ObjectId as an explicit session principal.
327
315
  *
@@ -331,6 +319,72 @@ export class WasmRuntime {
331
319
  * * `session_json` - Optional JSON-encoded Session used for policy checks
332
320
  */
333
321
  updateWithSession(object_id: string, values: any, write_context_json?: string | null): any;
322
+ /**
323
+ * Wait for a batch to settle at the requested durability tier.
324
+ */
325
+ waitForBatch(batch_id: string, tier: string): Promise<any>;
326
+ }
327
+
328
+ export class WasmWorkerBridge {
329
+ private constructor();
330
+ free(): void;
331
+ [Symbol.dispose](): void;
332
+ acknowledgeRejectedBatch(batch_id: string): void;
333
+ applyIncomingServerPayload(payload: Uint8Array): void;
334
+ /**
335
+ * Attach a Rust bridge to an externally-constructed Worker.
336
+ *
337
+ * Options are parsed at attach time; `init()` is parameter-less.
338
+ */
339
+ static attach(worker: Worker, runtime: WasmRuntime, options: any): WasmWorkerBridge;
340
+ closePeer(peer_id: string): void;
341
+ disconnectUpstream(): void;
342
+ /**
343
+ * Get the worker-assigned client id (post-init), or `null`.
344
+ */
345
+ getWorkerClientId(): any;
346
+ /**
347
+ * Send the init message and resolve when the worker reports `init-ok`.
348
+ * Memoized — repeated calls return the same in-flight `Promise`.
349
+ *
350
+ * State setup + the init `postMessage` happen *synchronously* before
351
+ * this returns. Only the `init-ok | error | timeout` race awaits inside
352
+ * the returned `Promise`. Callers that emit a synthetic `init-ok`
353
+ * straight after this call (tests) don't need a microtask yield to see
354
+ * the resolver installed.
355
+ */
356
+ init(): Promise<any>;
357
+ openPeer(peer_id: string): void;
358
+ reconnectUpstream(): void;
359
+ replayServerConnection(): void;
360
+ sendLifecycleHint(event: string): void;
361
+ sendPeerSync(peer_id: string, term: number, payload: Array<any>): void;
362
+ setListeners(listeners: any): void;
363
+ setServerPayloadForwarder(callback?: Function | null): void;
364
+ /**
365
+ * Tear the bridge down. Synchronous side-effects (final outbox flush,
366
+ * noop sender install, edge removal, `Shutdown` posted) happen before
367
+ * this returns. The returned `Promise` resolves on `shutdown-ok` or
368
+ * after `SHUTDOWN_ACK_TIMEOUT_MS`.
369
+ */
370
+ shutdown(): Promise<any>;
371
+ /**
372
+ * Test-only: post `MainToWorkerWire::SimulateCrash` to the worker. The
373
+ * worker host releases OPFS handles without flushing a snapshot and
374
+ * posts `ShutdownOk`. Returns a Promise that resolves when the ack
375
+ * arrives (or after `SHUTDOWN_ACK_TIMEOUT_MS` regardless). Used by
376
+ * browser tests to validate WAL replay.
377
+ */
378
+ simulateCrash(): Promise<any>;
379
+ updateAuth(jwt_token?: string | null): void;
380
+ /**
381
+ * Mirror of the TS-side `waitForLocalSyncFlush(batchId?)` from main: drive
382
+ * the main runtime's outbox to the worker, await a `SyncAck`, optionally
383
+ * retry while the batch is still reconciling. Returns once the worker
384
+ * confirms reconciliation, the 2s budget expires, or any ack times out.
385
+ */
386
+ waitForLocalSyncFlush(batch_id?: string | null): Promise<any>;
387
+ waitForUpstreamServerConnection(): Promise<void>;
334
388
  }
335
389
 
336
390
  export function bench_get_cache_bytes(): number;
@@ -384,6 +438,19 @@ export function bench_set_read_coalesce_pages(read_coalesce_pages: number): void
384
438
  */
385
439
  export function currentTimestamp(): bigint;
386
440
 
441
+ export function decodeMainToWorkerJs(bytes: Uint8Array): any;
442
+
443
+ export function decodeWorkerToMainJs(bytes: Uint8Array): any;
444
+
445
+ /**
446
+ * Drain buffered tracing entries collected by the wasm tracing layer.
447
+ */
448
+ export function drainTraceEntries(): any;
449
+
450
+ export function encodeMainToWorkerJs(value: any): Uint8Array;
451
+
452
+ export function encodeWorkerToMainJs(value: any): Uint8Array;
453
+
387
454
  /**
388
455
  * Generate a new UUID v7 (time-ordered).
389
456
  *
@@ -405,6 +472,18 @@ export function init(): void;
405
472
  */
406
473
  export function parseSchema(json: string): any;
407
474
 
475
+ export function runAsWorker(init_message: any, pending_messages: Array<any>): void;
476
+
477
+ /**
478
+ * Enable or disable collection of buffered tracing entries for JavaScript drains.
479
+ */
480
+ export function setTraceEntryCollectionEnabled(enabled: boolean): void;
481
+
482
+ /**
483
+ * Subscribe to notifications that buffered tracing entries are ready to drain.
484
+ */
485
+ export function subscribeTraceEntries(callback: Function): Function;
486
+
408
487
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
409
488
 
410
489
  export interface InitOutput {
@@ -412,53 +491,85 @@ export interface InitOutput {
412
491
  readonly currentTimestamp: () => bigint;
413
492
  readonly generateId: () => [number, number];
414
493
  readonly parseSchema: (a: number, b: number) => [number, number, number];
494
+ readonly runAsWorker: (a: any, b: any) => [number, number];
415
495
  readonly init: () => void;
496
+ readonly decodeMainToWorkerJs: (a: any) => [number, number, number];
497
+ readonly decodeWorkerToMainJs: (a: any) => [number, number, number];
498
+ readonly encodeMainToWorkerJs: (a: any) => [number, number, number];
499
+ readonly encodeWorkerToMainJs: (a: any) => [number, number, number];
416
500
  readonly __wbg_wasmruntime_free: (a: number, b: number) => void;
501
+ readonly __wbg_wasmworkerbridge_free: (a: number, b: number) => void;
502
+ readonly setTraceEntryCollectionEnabled: (a: number) => void;
417
503
  readonly wasmruntime___debugSchemaState: (a: number) => [number, number, number];
418
504
  readonly wasmruntime___debugSeedLiveSchema: (a: number, b: number, c: number) => [number, number];
419
505
  readonly wasmruntime_acknowledgeRejectedBatch: (a: number, b: number, c: number) => [number, number, number];
420
506
  readonly wasmruntime_addClient: (a: number) => [number, number];
421
507
  readonly wasmruntime_addServer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
508
+ readonly wasmruntime_batchedTick: (a: number) => void;
422
509
  readonly wasmruntime_connect: (a: number, b: number, c: number, d: number, e: number) => [number, number];
423
510
  readonly wasmruntime_createSubscription: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
511
+ readonly wasmruntime_createWorkerBridge: (a: number, b: any, c: any) => [number, number, number];
424
512
  readonly wasmruntime_delete: (a: number, b: number, c: number) => [number, number, number];
425
- readonly wasmruntime_deletePersisted: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
426
- readonly wasmruntime_deletePersistedWithSession: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
427
513
  readonly wasmruntime_deleteWithSession: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
428
514
  readonly wasmruntime_deriveUserId: (a: number, b: number) => [number, number, number, number];
515
+ readonly wasmruntime_discardLocalBatch: (a: number, b: number, c: number) => [number, number, number];
429
516
  readonly wasmruntime_disconnect: (a: number) => void;
430
- readonly wasmruntime_drainRejectedBatchIds: (a: number) => [number, number, number];
431
517
  readonly wasmruntime_executeSubscription: (a: number, b: number, c: any) => [number, number];
432
518
  readonly wasmruntime_flush: (a: number) => void;
433
519
  readonly wasmruntime_flushWal: (a: number) => void;
434
520
  readonly wasmruntime_getPublicKeyBase64url: (a: number, b: number) => [number, number, number, number];
435
521
  readonly wasmruntime_getSchema: (a: number) => [number, number, number];
436
522
  readonly wasmruntime_getSchemaHash: (a: number) => [number, number];
523
+ readonly wasmruntime_hydrateLocalBatchRecordStorageRow: (a: number, b: any) => [number, number];
437
524
  readonly wasmruntime_insert: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
438
- readonly wasmruntime_insertPersisted: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
439
- readonly wasmruntime_insertPersistedWithSession: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number) => [number, number, number];
440
525
  readonly wasmruntime_insertWithSession: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number) => [number, number, number];
526
+ readonly wasmruntime_loadBatchFate: (a: number, b: number, c: number) => [number, number, number];
441
527
  readonly wasmruntime_loadLocalBatchRecord: (a: number, b: number, c: number) => [number, number, number];
528
+ readonly wasmruntime_loadLocalBatchRecordStorageRow: (a: number, b: number, c: number) => [number, number, number];
442
529
  readonly wasmruntime_loadLocalBatchRecords: (a: number) => [number, number, number];
443
530
  readonly wasmruntime_mintJazzSelfSignedToken: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: bigint) => [number, number, number, number];
444
531
  readonly wasmruntime_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number, number];
445
532
  readonly wasmruntime_onAuthFailure: (a: number, b: any) => void;
533
+ readonly wasmruntime_onMutationError: (a: number, b: any) => void;
446
534
  readonly wasmruntime_onSyncMessageReceived: (a: number, b: any, c: number, d: number) => [number, number];
447
535
  readonly wasmruntime_onSyncMessageReceivedFromClient: (a: number, b: number, c: number, d: any) => [number, number];
448
- readonly wasmruntime_onSyncMessageToSend: (a: number, b: any) => void;
449
536
  readonly wasmruntime_openEphemeral: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => [number, number, number];
450
537
  readonly wasmruntime_openPersistent: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => any;
451
538
  readonly wasmruntime_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
539
+ readonly wasmruntime_reconcileLocalBatchWithServer: (a: number, b: number, c: number) => [number, number];
452
540
  readonly wasmruntime_removeServer: (a: number) => void;
541
+ readonly wasmruntime_replayBatchRejection: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
542
+ readonly wasmruntime_replayLocalBatchPayloads: (a: number, b: number, c: number) => [number, number, number];
543
+ readonly wasmruntime_retransmitLocalBatch: (a: number, b: number, c: number) => [number, number];
453
544
  readonly wasmruntime_sealBatch: (a: number, b: number, c: number) => [number, number];
454
545
  readonly wasmruntime_setClientRole: (a: number, b: number, c: number, d: number, e: number) => [number, number];
455
546
  readonly wasmruntime_subscribe: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
456
547
  readonly wasmruntime_unsubscribe: (a: number, b: number) => void;
457
548
  readonly wasmruntime_update: (a: number, b: number, c: number, d: any) => [number, number, number];
458
549
  readonly wasmruntime_updateAuth: (a: number, b: number, c: number) => [number, number];
459
- readonly wasmruntime_updatePersisted: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
460
- readonly wasmruntime_updatePersistedWithSession: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number) => [number, number, number];
461
550
  readonly wasmruntime_updateWithSession: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
551
+ readonly wasmruntime_waitForBatch: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
552
+ readonly wasmworkerbridge_acknowledgeRejectedBatch: (a: number, b: number, c: number) => void;
553
+ readonly wasmworkerbridge_applyIncomingServerPayload: (a: number, b: any) => [number, number];
554
+ readonly wasmworkerbridge_attach: (a: any, b: number, c: any) => [number, number, number];
555
+ readonly wasmworkerbridge_closePeer: (a: number, b: number, c: number) => void;
556
+ readonly wasmworkerbridge_disconnectUpstream: (a: number) => void;
557
+ readonly wasmworkerbridge_getWorkerClientId: (a: number) => any;
558
+ readonly wasmworkerbridge_init: (a: number) => any;
559
+ readonly wasmworkerbridge_openPeer: (a: number, b: number, c: number) => void;
560
+ readonly wasmworkerbridge_reconnectUpstream: (a: number) => void;
561
+ readonly wasmworkerbridge_replayServerConnection: (a: number) => void;
562
+ readonly wasmworkerbridge_sendLifecycleHint: (a: number, b: number, c: number) => void;
563
+ readonly wasmworkerbridge_sendPeerSync: (a: number, b: number, c: number, d: number, e: any) => void;
564
+ readonly wasmworkerbridge_setListeners: (a: number, b: any) => void;
565
+ readonly wasmworkerbridge_setServerPayloadForwarder: (a: number, b: number) => void;
566
+ readonly wasmworkerbridge_shutdown: (a: number) => any;
567
+ readonly wasmworkerbridge_simulateCrash: (a: number) => any;
568
+ readonly wasmworkerbridge_updateAuth: (a: number, b: number, c: number) => void;
569
+ readonly wasmworkerbridge_waitForLocalSyncFlush: (a: number, b: number, c: number) => any;
570
+ readonly wasmworkerbridge_waitForUpstreamServerConnection: (a: number) => any;
571
+ readonly drainTraceEntries: () => any;
572
+ readonly subscribeTraceEntries: (a: any) => any;
462
573
  readonly __wbg_wasmquerybuilder_free: (a: number, b: number) => void;
463
574
  readonly wasmquerybuilder_alias: (a: number, b: number, c: number) => number;
464
575
  readonly wasmquerybuilder_branch: (a: number, b: number, c: number) => number;
@@ -506,9 +617,12 @@ export interface InitOutput {
506
617
  readonly bench_reset_read_coalesce_pages: () => void;
507
618
  readonly wasm_bindgen__convert__closures_____invoke__h656199c36535c3e6: (a: number, b: number, c: any) => [number, number];
508
619
  readonly wasm_bindgen__convert__closures_____invoke__h250bbd6a67e0e1e6: (a: number, b: number, c: any, d: any) => void;
509
- readonly wasm_bindgen__convert__closures_____invoke__hf7ddf3622752ec36: (a: number, b: number, c: any) => void;
510
- readonly wasm_bindgen__convert__closures_____invoke__hc18e08680cddc2e5: (a: number, b: number, c: any) => void;
620
+ readonly wasm_bindgen__convert__closures_____invoke__h74026c82fbbbb92b: (a: number, b: number, c: any) => any;
621
+ readonly wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d: (a: number, b: number, c: any) => void;
622
+ readonly wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d_3: (a: number, b: number, c: any) => void;
623
+ readonly wasm_bindgen__convert__closures_____invoke__hbc8b7acec5ff03a6: (a: number, b: number, c: any) => void;
511
624
  readonly wasm_bindgen__convert__closures_____invoke__h03757a48b3eba690: (a: number, b: number) => void;
625
+ readonly wasm_bindgen__convert__closures_____invoke__hcc3019a61bf91992: (a: number, b: number) => void;
512
626
  readonly __wbindgen_malloc: (a: number, b: number) => number;
513
627
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
514
628
  readonly __wbindgen_exn_store: (a: number) => void;
package/pkg/jazz_wasm.js CHANGED
@@ -398,6 +398,12 @@ export class WasmRuntime {
398
398
  throw takeFromExternrefTable0(ret[0]);
399
399
  }
400
400
  }
401
+ /**
402
+ * Drive the runtime's batched receive/apply/send loop immediately.
403
+ */
404
+ batchedTick() {
405
+ wasm.wasmruntime_batchedTick(this.__wbg_ptr);
406
+ }
401
407
  /**
402
408
  * Connect to a Jazz server over WebSocket.
403
409
  *
@@ -441,54 +447,33 @@ export class WasmRuntime {
441
447
  return ret[0];
442
448
  }
443
449
  /**
444
- * Delete a row by ObjectId.
445
- * @param {string} object_id
446
- * @returns {any}
447
- */
448
- delete(object_id) {
449
- const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
450
- const len0 = WASM_VECTOR_LEN;
451
- const ret = wasm.wasmruntime_delete(this.__wbg_ptr, ptr0, len0);
450
+ * Attach a `WasmWorkerBridge` to this runtime. Convenience helper so the
451
+ * TS-side `WorkerBridge` adapter can construct the Rust bridge without
452
+ * importing `WasmWorkerBridge` directly — it gets it back from the
453
+ * runtime instance.
454
+ *
455
+ * `options` is the `WorkerBridgeOptions` JS object (parsed at attach
456
+ * time per spec; `init` no longer takes options).
457
+ * @param {Worker} worker
458
+ * @param {any} options
459
+ * @returns {WasmWorkerBridge}
460
+ */
461
+ createWorkerBridge(worker, options) {
462
+ const ret = wasm.wasmruntime_createWorkerBridge(this.__wbg_ptr, worker, options);
452
463
  if (ret[2]) {
453
464
  throw takeFromExternrefTable0(ret[1]);
454
465
  }
455
- return takeFromExternrefTable0(ret[0]);
466
+ return WasmWorkerBridge.__wrap(ret[0]);
456
467
  }
457
468
  /**
458
- * Delete a row immediately, returning the logical batch id that tracks
459
- * replayable persisted fate for this write.
460
- * @param {string} object_id
461
- * @param {string} tier
462
- * @returns {any}
463
- */
464
- deletePersisted(object_id, tier) {
465
- const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
466
- const len0 = WASM_VECTOR_LEN;
467
- const ptr1 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
- const len1 = WASM_VECTOR_LEN;
469
- const ret = wasm.wasmruntime_deletePersisted(this.__wbg_ptr, ptr0, len0, ptr1, len1);
470
- if (ret[2]) {
471
- throw takeFromExternrefTable0(ret[1]);
472
- }
473
- return takeFromExternrefTable0(ret[0]);
474
- }
475
- /**
476
- * Delete a row immediately, returning the logical batch id that tracks
477
- * replayable persisted fate for this write, scoped to an explicit session
478
- * principal or transactional write context.
469
+ * Delete a row by ObjectId.
479
470
  * @param {string} object_id
480
- * @param {string | null | undefined} write_context_json
481
- * @param {string} tier
482
471
  * @returns {any}
483
472
  */
484
- deletePersistedWithSession(object_id, write_context_json, tier) {
473
+ delete(object_id) {
485
474
  const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
486
475
  const len0 = WASM_VECTOR_LEN;
487
- var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
488
- var len1 = WASM_VECTOR_LEN;
489
- const ptr2 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
490
- const len2 = WASM_VECTOR_LEN;
491
- const ret = wasm.wasmruntime_deletePersistedWithSession(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
476
+ const ret = wasm.wasmruntime_delete(this.__wbg_ptr, ptr0, len0);
492
477
  if (ret[2]) {
493
478
  throw takeFromExternrefTable0(ret[1]);
494
479
  }
@@ -536,20 +521,23 @@ export class WasmRuntime {
536
521
  }
537
522
  }
538
523
  /**
539
- * Disconnect from the Jazz server and drop the transport handle.
540
- */
541
- disconnect() {
542
- wasm.wasmruntime_disconnect(this.__wbg_ptr);
543
- }
544
- /**
545
- * @returns {any}
524
+ * @param {string} batch_id
525
+ * @returns {boolean}
546
526
  */
547
- drainRejectedBatchIds() {
548
- const ret = wasm.wasmruntime_drainRejectedBatchIds(this.__wbg_ptr);
527
+ discardLocalBatch(batch_id) {
528
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
529
+ const len0 = WASM_VECTOR_LEN;
530
+ const ret = wasm.wasmruntime_discardLocalBatch(this.__wbg_ptr, ptr0, len0);
549
531
  if (ret[2]) {
550
532
  throw takeFromExternrefTable0(ret[1]);
551
533
  }
552
- return takeFromExternrefTable0(ret[0]);
534
+ return ret[0] !== 0;
535
+ }
536
+ /**
537
+ * Disconnect from the Jazz server and drop the transport handle.
538
+ */
539
+ disconnect() {
540
+ wasm.wasmruntime_disconnect(this.__wbg_ptr);
553
541
  }
554
542
  /**
555
543
  * Phase 2 of 2-phase subscribe: compile graph, register subscription,
@@ -628,6 +616,15 @@ export class WasmRuntime {
628
616
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
629
617
  }
630
618
  }
619
+ /**
620
+ * @param {Uint8Array} bytes
621
+ */
622
+ hydrateLocalBatchRecordStorageRow(bytes) {
623
+ const ret = wasm.wasmruntime_hydrateLocalBatchRecordStorageRow(this.__wbg_ptr, bytes);
624
+ if (ret[1]) {
625
+ throw takeFromExternrefTable0(ret[0]);
626
+ }
627
+ }
631
628
  /**
632
629
  * Insert a row into a table.
633
630
  *
@@ -650,63 +647,47 @@ export class WasmRuntime {
650
647
  return takeFromExternrefTable0(ret[0]);
651
648
  }
652
649
  /**
653
- * Insert a row immediately, returning the logical batch id that tracks
654
- * replayable persisted fate for this write.
650
+ * Insert a row into a table as an explicit session principal.
655
651
  * @param {string} table
656
652
  * @param {any} values
657
- * @param {string} tier
653
+ * @param {string | null} [write_context_json]
654
+ * @param {string | null} [object_id]
658
655
  * @returns {any}
659
656
  */
660
- insertPersisted(table, values, tier) {
657
+ insertWithSession(table, values, write_context_json, object_id) {
661
658
  const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
662
659
  const len0 = WASM_VECTOR_LEN;
663
- const ptr1 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
664
- const len1 = WASM_VECTOR_LEN;
665
- const ret = wasm.wasmruntime_insertPersisted(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
660
+ var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
661
+ var len1 = WASM_VECTOR_LEN;
662
+ var ptr2 = isLikeNone(object_id) ? 0 : passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
663
+ var len2 = WASM_VECTOR_LEN;
664
+ const ret = wasm.wasmruntime_insertWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1, ptr2, len2);
666
665
  if (ret[2]) {
667
666
  throw takeFromExternrefTable0(ret[1]);
668
667
  }
669
668
  return takeFromExternrefTable0(ret[0]);
670
669
  }
671
670
  /**
672
- * Insert a row immediately, returning the logical batch id that tracks
673
- * replayable persisted fate for this write, scoped to an explicit session
674
- * principal or transactional write context.
675
- * @param {string} table
676
- * @param {any} values
677
- * @param {string | null | undefined} write_context_json
678
- * @param {string} tier
671
+ * @param {string} batch_id
679
672
  * @returns {any}
680
673
  */
681
- insertPersistedWithSession(table, values, write_context_json, tier) {
682
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
674
+ loadBatchFate(batch_id) {
675
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
683
676
  const len0 = WASM_VECTOR_LEN;
684
- var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
685
- var len1 = WASM_VECTOR_LEN;
686
- const ptr2 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
687
- const len2 = WASM_VECTOR_LEN;
688
- const ret = wasm.wasmruntime_insertPersistedWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1, ptr2, len2);
677
+ const ret = wasm.wasmruntime_loadBatchFate(this.__wbg_ptr, ptr0, len0);
689
678
  if (ret[2]) {
690
679
  throw takeFromExternrefTable0(ret[1]);
691
680
  }
692
681
  return takeFromExternrefTable0(ret[0]);
693
682
  }
694
683
  /**
695
- * Insert a row into a table as an explicit session principal.
696
- * @param {string} table
697
- * @param {any} values
698
- * @param {string | null} [write_context_json]
699
- * @param {string | null} [object_id]
684
+ * @param {string} batch_id
700
685
  * @returns {any}
701
686
  */
702
- insertWithSession(table, values, write_context_json, object_id) {
703
- const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
687
+ loadLocalBatchRecord(batch_id) {
688
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
704
689
  const len0 = WASM_VECTOR_LEN;
705
- var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
706
- var len1 = WASM_VECTOR_LEN;
707
- var ptr2 = isLikeNone(object_id) ? 0 : passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
708
- var len2 = WASM_VECTOR_LEN;
709
- const ret = wasm.wasmruntime_insertWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1, ptr2, len2);
690
+ const ret = wasm.wasmruntime_loadLocalBatchRecord(this.__wbg_ptr, ptr0, len0);
710
691
  if (ret[2]) {
711
692
  throw takeFromExternrefTable0(ret[1]);
712
693
  }
@@ -716,10 +697,10 @@ export class WasmRuntime {
716
697
  * @param {string} batch_id
717
698
  * @returns {any}
718
699
  */
719
- loadLocalBatchRecord(batch_id) {
700
+ loadLocalBatchRecordStorageRow(batch_id) {
720
701
  const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
721
702
  const len0 = WASM_VECTOR_LEN;
722
- const ret = wasm.wasmruntime_loadLocalBatchRecord(this.__wbg_ptr, ptr0, len0);
703
+ const ret = wasm.wasmruntime_loadLocalBatchRecordStorageRow(this.__wbg_ptr, ptr0, len0);
723
704
  if (ret[2]) {
724
705
  throw takeFromExternrefTable0(ret[1]);
725
706
  }
@@ -817,6 +798,13 @@ export class WasmRuntime {
817
798
  onAuthFailure(callback) {
818
799
  wasm.wasmruntime_onAuthFailure(this.__wbg_ptr, callback);
819
800
  }
801
+ /**
802
+ * Register a callback for unhandled mutation errors.
803
+ * @param {Function} callback
804
+ */
805
+ onMutationError(callback) {
806
+ wasm.wasmruntime_onMutationError(this.__wbg_ptr, callback);
807
+ }
820
808
  /**
821
809
  * Called by JS when a sync message arrives from the server.
822
810
  *
@@ -849,13 +837,6 @@ export class WasmRuntime {
849
837
  throw takeFromExternrefTable0(ret[0]);
850
838
  }
851
839
  }
852
- /**
853
- * Register a callback for outgoing sync messages.
854
- * @param {Function} callback
855
- */
856
- onSyncMessageToSend(callback) {
857
- wasm.wasmruntime_onSyncMessageToSend(this.__wbg_ptr, callback);
858
- }
859
840
  /**
860
841
  * Create an ephemeral WasmRuntime backed by in-memory storage.
861
842
  *
@@ -944,12 +925,64 @@ export class WasmRuntime {
944
925
  }
945
926
  return takeFromExternrefTable0(ret[0]);
946
927
  }
928
+ /**
929
+ * @param {string} batch_id
930
+ */
931
+ reconcileLocalBatchWithServer(batch_id) {
932
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
933
+ const len0 = WASM_VECTOR_LEN;
934
+ const ret = wasm.wasmruntime_reconcileLocalBatchWithServer(this.__wbg_ptr, ptr0, len0);
935
+ if (ret[1]) {
936
+ throw takeFromExternrefTable0(ret[0]);
937
+ }
938
+ }
947
939
  /**
948
940
  * Remove the current upstream server connection.
949
941
  */
950
942
  removeServer() {
951
943
  wasm.wasmruntime_removeServer(this.__wbg_ptr);
952
944
  }
945
+ /**
946
+ * @param {string} batch_id
947
+ * @param {string} code
948
+ * @param {string} reason
949
+ */
950
+ replayBatchRejection(batch_id, code, reason) {
951
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
952
+ const len0 = WASM_VECTOR_LEN;
953
+ const ptr1 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
954
+ const len1 = WASM_VECTOR_LEN;
955
+ const ptr2 = passStringToWasm0(reason, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
956
+ const len2 = WASM_VECTOR_LEN;
957
+ const ret = wasm.wasmruntime_replayBatchRejection(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
958
+ if (ret[1]) {
959
+ throw takeFromExternrefTable0(ret[0]);
960
+ }
961
+ }
962
+ /**
963
+ * @param {string} batch_id
964
+ * @returns {Array<any>}
965
+ */
966
+ replayLocalBatchPayloads(batch_id) {
967
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
968
+ const len0 = WASM_VECTOR_LEN;
969
+ const ret = wasm.wasmruntime_replayLocalBatchPayloads(this.__wbg_ptr, ptr0, len0);
970
+ if (ret[2]) {
971
+ throw takeFromExternrefTable0(ret[1]);
972
+ }
973
+ return takeFromExternrefTable0(ret[0]);
974
+ }
975
+ /**
976
+ * @param {string} batch_id
977
+ */
978
+ retransmitLocalBatch(batch_id) {
979
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
980
+ const len0 = WASM_VECTOR_LEN;
981
+ const ret = wasm.wasmruntime_retransmitLocalBatch(this.__wbg_ptr, ptr0, len0);
982
+ if (ret[1]) {
983
+ throw takeFromExternrefTable0(ret[0]);
984
+ }
985
+ }
953
986
  /**
954
987
  * @param {string} batch_id
955
988
  */
@@ -1048,72 +1081,232 @@ export class WasmRuntime {
1048
1081
  }
1049
1082
  }
1050
1083
  /**
1051
- * Update a row immediately, returning the logical batch id that tracks
1052
- * replayable persisted fate for this write.
1084
+ * Update a row by ObjectId as an explicit session principal.
1085
+ *
1086
+ * # Arguments
1087
+ * * `object_id` - UUID string of target object
1088
+ * * `values` - Partial update map (`{ columnName: Value }`)
1089
+ * * `session_json` - Optional JSON-encoded Session used for policy checks
1053
1090
  * @param {string} object_id
1054
1091
  * @param {any} values
1055
- * @param {string} tier
1092
+ * @param {string | null} [write_context_json]
1056
1093
  * @returns {any}
1057
1094
  */
1058
- updatePersisted(object_id, values, tier) {
1095
+ updateWithSession(object_id, values, write_context_json) {
1059
1096
  const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1060
1097
  const len0 = WASM_VECTOR_LEN;
1061
- const ptr1 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1062
- const len1 = WASM_VECTOR_LEN;
1063
- const ret = wasm.wasmruntime_updatePersisted(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
1098
+ var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1099
+ var len1 = WASM_VECTOR_LEN;
1100
+ const ret = wasm.wasmruntime_updateWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
1064
1101
  if (ret[2]) {
1065
1102
  throw takeFromExternrefTable0(ret[1]);
1066
1103
  }
1067
1104
  return takeFromExternrefTable0(ret[0]);
1068
1105
  }
1069
1106
  /**
1070
- * Update a row immediately, returning the logical batch id that tracks
1071
- * replayable persisted fate for this write, scoped to an explicit session
1072
- * principal or transactional write context.
1073
- * @param {string} object_id
1074
- * @param {any} values
1075
- * @param {string | null | undefined} write_context_json
1107
+ * Wait for a batch to settle at the requested durability tier.
1108
+ * @param {string} batch_id
1076
1109
  * @param {string} tier
1077
- * @returns {any}
1110
+ * @returns {Promise<any>}
1078
1111
  */
1079
- updatePersistedWithSession(object_id, values, write_context_json, tier) {
1080
- const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1112
+ waitForBatch(batch_id, tier) {
1113
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1081
1114
  const len0 = WASM_VECTOR_LEN;
1082
- var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1083
- var len1 = WASM_VECTOR_LEN;
1084
- const ptr2 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1085
- const len2 = WASM_VECTOR_LEN;
1086
- const ret = wasm.wasmruntime_updatePersistedWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1, ptr2, len2);
1115
+ const ptr1 = passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1116
+ const len1 = WASM_VECTOR_LEN;
1117
+ const ret = wasm.wasmruntime_waitForBatch(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1087
1118
  if (ret[2]) {
1088
1119
  throw takeFromExternrefTable0(ret[1]);
1089
1120
  }
1090
1121
  return takeFromExternrefTable0(ret[0]);
1091
1122
  }
1123
+ }
1124
+ if (Symbol.dispose) WasmRuntime.prototype[Symbol.dispose] = WasmRuntime.prototype.free;
1125
+
1126
+ export class WasmWorkerBridge {
1127
+ static __wrap(ptr) {
1128
+ ptr = ptr >>> 0;
1129
+ const obj = Object.create(WasmWorkerBridge.prototype);
1130
+ obj.__wbg_ptr = ptr;
1131
+ WasmWorkerBridgeFinalization.register(obj, obj.__wbg_ptr, obj);
1132
+ return obj;
1133
+ }
1134
+ __destroy_into_raw() {
1135
+ const ptr = this.__wbg_ptr;
1136
+ this.__wbg_ptr = 0;
1137
+ WasmWorkerBridgeFinalization.unregister(this);
1138
+ return ptr;
1139
+ }
1140
+ free() {
1141
+ const ptr = this.__destroy_into_raw();
1142
+ wasm.__wbg_wasmworkerbridge_free(ptr, 0);
1143
+ }
1092
1144
  /**
1093
- * Update a row by ObjectId as an explicit session principal.
1094
- *
1095
- * # Arguments
1096
- * * `object_id` - UUID string of target object
1097
- * * `values` - Partial update map (`{ columnName: Value }`)
1098
- * * `session_json` - Optional JSON-encoded Session used for policy checks
1099
- * @param {string} object_id
1100
- * @param {any} values
1101
- * @param {string | null} [write_context_json]
1102
- * @returns {any}
1145
+ * @param {string} batch_id
1103
1146
  */
1104
- updateWithSession(object_id, values, write_context_json) {
1105
- const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1147
+ acknowledgeRejectedBatch(batch_id) {
1148
+ const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1106
1149
  const len0 = WASM_VECTOR_LEN;
1107
- var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1108
- var len1 = WASM_VECTOR_LEN;
1109
- const ret = wasm.wasmruntime_updateWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
1150
+ wasm.wasmworkerbridge_acknowledgeRejectedBatch(this.__wbg_ptr, ptr0, len0);
1151
+ }
1152
+ /**
1153
+ * @param {Uint8Array} payload
1154
+ */
1155
+ applyIncomingServerPayload(payload) {
1156
+ const ret = wasm.wasmworkerbridge_applyIncomingServerPayload(this.__wbg_ptr, payload);
1157
+ if (ret[1]) {
1158
+ throw takeFromExternrefTable0(ret[0]);
1159
+ }
1160
+ }
1161
+ /**
1162
+ * Attach a Rust bridge to an externally-constructed Worker.
1163
+ *
1164
+ * Options are parsed at attach time; `init()` is parameter-less.
1165
+ * @param {Worker} worker
1166
+ * @param {WasmRuntime} runtime
1167
+ * @param {any} options
1168
+ * @returns {WasmWorkerBridge}
1169
+ */
1170
+ static attach(worker, runtime, options) {
1171
+ _assertClass(runtime, WasmRuntime);
1172
+ const ret = wasm.wasmworkerbridge_attach(worker, runtime.__wbg_ptr, options);
1110
1173
  if (ret[2]) {
1111
1174
  throw takeFromExternrefTable0(ret[1]);
1112
1175
  }
1113
- return takeFromExternrefTable0(ret[0]);
1176
+ return WasmWorkerBridge.__wrap(ret[0]);
1177
+ }
1178
+ /**
1179
+ * @param {string} peer_id
1180
+ */
1181
+ closePeer(peer_id) {
1182
+ const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1183
+ const len0 = WASM_VECTOR_LEN;
1184
+ wasm.wasmworkerbridge_closePeer(this.__wbg_ptr, ptr0, len0);
1185
+ }
1186
+ disconnectUpstream() {
1187
+ wasm.wasmworkerbridge_disconnectUpstream(this.__wbg_ptr);
1188
+ }
1189
+ /**
1190
+ * Get the worker-assigned client id (post-init), or `null`.
1191
+ * @returns {any}
1192
+ */
1193
+ getWorkerClientId() {
1194
+ const ret = wasm.wasmworkerbridge_getWorkerClientId(this.__wbg_ptr);
1195
+ return ret;
1196
+ }
1197
+ /**
1198
+ * Send the init message and resolve when the worker reports `init-ok`.
1199
+ * Memoized — repeated calls return the same in-flight `Promise`.
1200
+ *
1201
+ * State setup + the init `postMessage` happen *synchronously* before
1202
+ * this returns. Only the `init-ok | error | timeout` race awaits inside
1203
+ * the returned `Promise`. Callers that emit a synthetic `init-ok`
1204
+ * straight after this call (tests) don't need a microtask yield to see
1205
+ * the resolver installed.
1206
+ * @returns {Promise<any>}
1207
+ */
1208
+ init() {
1209
+ const ret = wasm.wasmworkerbridge_init(this.__wbg_ptr);
1210
+ return ret;
1211
+ }
1212
+ /**
1213
+ * @param {string} peer_id
1214
+ */
1215
+ openPeer(peer_id) {
1216
+ const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1217
+ const len0 = WASM_VECTOR_LEN;
1218
+ wasm.wasmworkerbridge_openPeer(this.__wbg_ptr, ptr0, len0);
1219
+ }
1220
+ reconnectUpstream() {
1221
+ wasm.wasmworkerbridge_reconnectUpstream(this.__wbg_ptr);
1222
+ }
1223
+ replayServerConnection() {
1224
+ wasm.wasmworkerbridge_replayServerConnection(this.__wbg_ptr);
1225
+ }
1226
+ /**
1227
+ * @param {string} event
1228
+ */
1229
+ sendLifecycleHint(event) {
1230
+ const ptr0 = passStringToWasm0(event, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1231
+ const len0 = WASM_VECTOR_LEN;
1232
+ wasm.wasmworkerbridge_sendLifecycleHint(this.__wbg_ptr, ptr0, len0);
1233
+ }
1234
+ /**
1235
+ * @param {string} peer_id
1236
+ * @param {number} term
1237
+ * @param {Array<any>} payload
1238
+ */
1239
+ sendPeerSync(peer_id, term, payload) {
1240
+ const ptr0 = passStringToWasm0(peer_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1241
+ const len0 = WASM_VECTOR_LEN;
1242
+ wasm.wasmworkerbridge_sendPeerSync(this.__wbg_ptr, ptr0, len0, term, payload);
1243
+ }
1244
+ /**
1245
+ * @param {any} listeners
1246
+ */
1247
+ setListeners(listeners) {
1248
+ wasm.wasmworkerbridge_setListeners(this.__wbg_ptr, listeners);
1249
+ }
1250
+ /**
1251
+ * @param {Function | null} [callback]
1252
+ */
1253
+ setServerPayloadForwarder(callback) {
1254
+ wasm.wasmworkerbridge_setServerPayloadForwarder(this.__wbg_ptr, isLikeNone(callback) ? 0 : addToExternrefTable0(callback));
1255
+ }
1256
+ /**
1257
+ * Tear the bridge down. Synchronous side-effects (final outbox flush,
1258
+ * noop sender install, edge removal, `Shutdown` posted) happen before
1259
+ * this returns. The returned `Promise` resolves on `shutdown-ok` or
1260
+ * after `SHUTDOWN_ACK_TIMEOUT_MS`.
1261
+ * @returns {Promise<any>}
1262
+ */
1263
+ shutdown() {
1264
+ const ret = wasm.wasmworkerbridge_shutdown(this.__wbg_ptr);
1265
+ return ret;
1266
+ }
1267
+ /**
1268
+ * Test-only: post `MainToWorkerWire::SimulateCrash` to the worker. The
1269
+ * worker host releases OPFS handles without flushing a snapshot and
1270
+ * posts `ShutdownOk`. Returns a Promise that resolves when the ack
1271
+ * arrives (or after `SHUTDOWN_ACK_TIMEOUT_MS` regardless). Used by
1272
+ * browser tests to validate WAL replay.
1273
+ * @returns {Promise<any>}
1274
+ */
1275
+ simulateCrash() {
1276
+ const ret = wasm.wasmworkerbridge_simulateCrash(this.__wbg_ptr);
1277
+ return ret;
1278
+ }
1279
+ /**
1280
+ * @param {string | null} [jwt_token]
1281
+ */
1282
+ updateAuth(jwt_token) {
1283
+ var ptr0 = isLikeNone(jwt_token) ? 0 : passStringToWasm0(jwt_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1284
+ var len0 = WASM_VECTOR_LEN;
1285
+ wasm.wasmworkerbridge_updateAuth(this.__wbg_ptr, ptr0, len0);
1286
+ }
1287
+ /**
1288
+ * Mirror of the TS-side `waitForLocalSyncFlush(batchId?)` from main: drive
1289
+ * the main runtime's outbox to the worker, await a `SyncAck`, optionally
1290
+ * retry while the batch is still reconciling. Returns once the worker
1291
+ * confirms reconciliation, the 2s budget expires, or any ack times out.
1292
+ * @param {string | null} [batch_id]
1293
+ * @returns {Promise<any>}
1294
+ */
1295
+ waitForLocalSyncFlush(batch_id) {
1296
+ var ptr0 = isLikeNone(batch_id) ? 0 : passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1297
+ var len0 = WASM_VECTOR_LEN;
1298
+ const ret = wasm.wasmworkerbridge_waitForLocalSyncFlush(this.__wbg_ptr, ptr0, len0);
1299
+ return ret;
1300
+ }
1301
+ /**
1302
+ * @returns {Promise<void>}
1303
+ */
1304
+ waitForUpstreamServerConnection() {
1305
+ const ret = wasm.wasmworkerbridge_waitForUpstreamServerConnection(this.__wbg_ptr);
1306
+ return ret;
1114
1307
  }
1115
1308
  }
1116
- if (Symbol.dispose) WasmRuntime.prototype[Symbol.dispose] = WasmRuntime.prototype.free;
1309
+ if (Symbol.dispose) WasmWorkerBridge.prototype[Symbol.dispose] = WasmWorkerBridge.prototype.free;
1117
1310
 
1118
1311
  /**
1119
1312
  * @returns {number}
@@ -1321,6 +1514,63 @@ export function currentTimestamp() {
1321
1514
  return BigInt.asUintN(64, ret);
1322
1515
  }
1323
1516
 
1517
+ /**
1518
+ * @param {Uint8Array} bytes
1519
+ * @returns {any}
1520
+ */
1521
+ export function decodeMainToWorkerJs(bytes) {
1522
+ const ret = wasm.decodeMainToWorkerJs(bytes);
1523
+ if (ret[2]) {
1524
+ throw takeFromExternrefTable0(ret[1]);
1525
+ }
1526
+ return takeFromExternrefTable0(ret[0]);
1527
+ }
1528
+
1529
+ /**
1530
+ * @param {Uint8Array} bytes
1531
+ * @returns {any}
1532
+ */
1533
+ export function decodeWorkerToMainJs(bytes) {
1534
+ const ret = wasm.decodeWorkerToMainJs(bytes);
1535
+ if (ret[2]) {
1536
+ throw takeFromExternrefTable0(ret[1]);
1537
+ }
1538
+ return takeFromExternrefTable0(ret[0]);
1539
+ }
1540
+
1541
+ /**
1542
+ * Drain buffered tracing entries collected by the wasm tracing layer.
1543
+ * @returns {any}
1544
+ */
1545
+ export function drainTraceEntries() {
1546
+ const ret = wasm.drainTraceEntries();
1547
+ return ret;
1548
+ }
1549
+
1550
+ /**
1551
+ * @param {any} value
1552
+ * @returns {Uint8Array}
1553
+ */
1554
+ export function encodeMainToWorkerJs(value) {
1555
+ const ret = wasm.encodeMainToWorkerJs(value);
1556
+ if (ret[2]) {
1557
+ throw takeFromExternrefTable0(ret[1]);
1558
+ }
1559
+ return takeFromExternrefTable0(ret[0]);
1560
+ }
1561
+
1562
+ /**
1563
+ * @param {any} value
1564
+ * @returns {Uint8Array}
1565
+ */
1566
+ export function encodeWorkerToMainJs(value) {
1567
+ const ret = wasm.encodeWorkerToMainJs(value);
1568
+ if (ret[2]) {
1569
+ throw takeFromExternrefTable0(ret[1]);
1570
+ }
1571
+ return takeFromExternrefTable0(ret[0]);
1572
+ }
1573
+
1324
1574
  /**
1325
1575
  * Generate a new UUID v7 (time-ordered).
1326
1576
  *
@@ -1366,6 +1616,35 @@ export function parseSchema(json) {
1366
1616
  return takeFromExternrefTable0(ret[0]);
1367
1617
  }
1368
1618
 
1619
+ /**
1620
+ * @param {any} init_message
1621
+ * @param {Array<any>} pending_messages
1622
+ */
1623
+ export function runAsWorker(init_message, pending_messages) {
1624
+ const ret = wasm.runAsWorker(init_message, pending_messages);
1625
+ if (ret[1]) {
1626
+ throw takeFromExternrefTable0(ret[0]);
1627
+ }
1628
+ }
1629
+
1630
+ /**
1631
+ * Enable or disable collection of buffered tracing entries for JavaScript drains.
1632
+ * @param {boolean} enabled
1633
+ */
1634
+ export function setTraceEntryCollectionEnabled(enabled) {
1635
+ wasm.setTraceEntryCollectionEnabled(enabled);
1636
+ }
1637
+
1638
+ /**
1639
+ * Subscribe to notifications that buffered tracing entries are ready to drain.
1640
+ * @param {Function} callback
1641
+ * @returns {Function}
1642
+ */
1643
+ export function subscribeTraceEntries(callback) {
1644
+ const ret = wasm.subscribeTraceEntries(callback);
1645
+ return ret;
1646
+ }
1647
+
1369
1648
  function __wbg_get_imports() {
1370
1649
  const import0 = {
1371
1650
  __proto__: null,
@@ -1459,6 +1738,10 @@ function __wbg_get_imports() {
1459
1738
  __wbg__wbg_cb_unref_3c3b4f651835fbcb: function(arg0) {
1460
1739
  arg0._wbg_cb_unref();
1461
1740
  },
1741
+ __wbg_buffer_a77cc90da4bdb503: function(arg0) {
1742
+ const ret = arg0.buffer;
1743
+ return ret;
1744
+ },
1462
1745
  __wbg_call_368fa9c372d473ba: function() { return handleError(function (arg0, arg1, arg2, arg3) {
1463
1746
  const ret = arg0.call(arg1, arg2, arg3);
1464
1747
  return ret;
@@ -1471,14 +1754,13 @@ function __wbg_get_imports() {
1471
1754
  const ret = arg0.call(arg1, arg2);
1472
1755
  return ret;
1473
1756
  }, arguments); },
1474
- __wbg_call_e0f65243b4670302: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
1475
- const ret = arg0.call(arg1, arg2, arg3, arg4, arg5, arg6);
1476
- return ret;
1477
- }, arguments); },
1478
1757
  __wbg_clearTimeout_113b1cde814ec762: function(arg0) {
1479
1758
  const ret = clearTimeout(arg0);
1480
1759
  return ret;
1481
1760
  },
1761
+ __wbg_close_3f24d94e71812912: function(arg0) {
1762
+ arg0.close();
1763
+ },
1482
1764
  __wbg_close_e526ab9e090e8cc1: function(arg0) {
1483
1765
  arg0.close();
1484
1766
  },
@@ -1632,6 +1914,16 @@ function __wbg_get_imports() {
1632
1914
  const ret = result;
1633
1915
  return ret;
1634
1916
  },
1917
+ __wbg_instanceof_DedicatedWorkerGlobalScope_507cf7649cc12be1: function(arg0) {
1918
+ let result;
1919
+ try {
1920
+ result = arg0 instanceof DedicatedWorkerGlobalScope;
1921
+ } catch (_) {
1922
+ result = false;
1923
+ }
1924
+ const ret = result;
1925
+ return ret;
1926
+ },
1635
1927
  __wbg_instanceof_DomException_37f96d3fb69189bd: function(arg0) {
1636
1928
  let result;
1637
1929
  try {
@@ -1895,10 +2187,23 @@ function __wbg_get_imports() {
1895
2187
  const ret = arg0.now();
1896
2188
  return ret;
1897
2189
  },
2190
+ __wbg_parse_545d11396395fbbd: function() { return handleError(function (arg0, arg1) {
2191
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
2192
+ return ret;
2193
+ }, arguments); },
1898
2194
  __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
1899
2195
  const ret = arg0.performance;
1900
2196
  return ret;
1901
2197
  },
2198
+ __wbg_postMessage_8723ae329b15c28a: function() { return handleError(function (arg0, arg1, arg2) {
2199
+ arg0.postMessage(arg1, arg2);
2200
+ }, arguments); },
2201
+ __wbg_postMessage_b2f3a9b43857bbfb: function() { return handleError(function (arg0, arg1) {
2202
+ arg0.postMessage(arg1);
2203
+ }, arguments); },
2204
+ __wbg_postMessage_e8bbce1174c34f30: function() { return handleError(function (arg0, arg1, arg2) {
2205
+ arg0.postMessage(arg1, arg2);
2206
+ }, arguments); },
1902
2207
  __wbg_process_44c7a14e11e9f69e: function(arg0) {
1903
2208
  const ret = arg0.process;
1904
2209
  return ret;
@@ -1939,6 +2244,10 @@ function __wbg_get_imports() {
1939
2244
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1940
2245
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1941
2246
  },
2247
+ __wbg_reject_1340e1211c01825b: function(arg0) {
2248
+ const ret = Promise.reject(arg0);
2249
+ return ret;
2250
+ },
1942
2251
  __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
1943
2252
  const ret = module.require;
1944
2253
  return ret;
@@ -1995,6 +2304,12 @@ function __wbg_get_imports() {
1995
2304
  __wbg_set_onmessage_45bd33b110c54f5b: function(arg0, arg1) {
1996
2305
  arg0.onmessage = arg1;
1997
2306
  },
2307
+ __wbg_set_onmessage_63e13b226483da6a: function(arg0, arg1) {
2308
+ arg0.onmessage = arg1;
2309
+ },
2310
+ __wbg_set_onmessage_ee8dfb13200d93b8: function(arg0, arg1) {
2311
+ arg0.onmessage = arg1;
2312
+ },
1998
2313
  __wbg_set_onopen_7ffeb01f8a628209: function(arg0, arg1) {
1999
2314
  arg0.onopen = arg1;
2000
2315
  },
@@ -2025,6 +2340,10 @@ function __wbg_get_imports() {
2025
2340
  const ret = arg0.storage;
2026
2341
  return ret;
2027
2342
  },
2343
+ __wbg_stringify_a2c39d991e1bf91d: function() { return handleError(function (arg0) {
2344
+ const ret = JSON.stringify(arg0);
2345
+ return ret;
2346
+ }, arguments); },
2028
2347
  __wbg_subarray_0f98d3fb634508ad: function(arg0, arg1, arg2) {
2029
2348
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
2030
2349
  return ret;
@@ -2087,46 +2406,61 @@ function __wbg_get_imports() {
2087
2406
  return ret;
2088
2407
  }, arguments); },
2089
2408
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2090
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3162, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2409
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3293, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2091
2410
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h656199c36535c3e6);
2092
2411
  return ret;
2093
2412
  },
2094
2413
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2095
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 461, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2096
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hf7ddf3622752ec36);
2414
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 620, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2415
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d);
2097
2416
  return ret;
2098
2417
  },
2099
2418
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2100
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 876, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2101
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hc18e08680cddc2e5);
2419
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 622, ret: Externref, inner_ret: Some(Externref) }, mutable: false }) -> Externref`.
2420
+ const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h74026c82fbbbb92b);
2102
2421
  return ret;
2103
2422
  },
2104
2423
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
2105
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1260, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2424
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 620, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2425
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d_3);
2426
+ return ret;
2427
+ },
2428
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
2429
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 998, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2430
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbc8b7acec5ff03a6);
2431
+ return ret;
2432
+ },
2433
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
2434
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1393, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2106
2435
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h03757a48b3eba690);
2107
2436
  return ret;
2108
2437
  },
2109
- __wbindgen_cast_0000000000000005: function(arg0) {
2438
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
2439
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 975, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2440
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc3019a61bf91992);
2441
+ return ret;
2442
+ },
2443
+ __wbindgen_cast_0000000000000008: function(arg0) {
2110
2444
  // Cast intrinsic for `F64 -> Externref`.
2111
2445
  const ret = arg0;
2112
2446
  return ret;
2113
2447
  },
2114
- __wbindgen_cast_0000000000000006: function(arg0) {
2448
+ __wbindgen_cast_0000000000000009: function(arg0) {
2115
2449
  // Cast intrinsic for `I64 -> Externref`.
2116
2450
  const ret = arg0;
2117
2451
  return ret;
2118
2452
  },
2119
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
2453
+ __wbindgen_cast_000000000000000a: function(arg0, arg1) {
2120
2454
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
2121
2455
  const ret = getArrayU8FromWasm0(arg0, arg1);
2122
2456
  return ret;
2123
2457
  },
2124
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
2458
+ __wbindgen_cast_000000000000000b: function(arg0, arg1) {
2125
2459
  // Cast intrinsic for `Ref(String) -> Externref`.
2126
2460
  const ret = getStringFromWasm0(arg0, arg1);
2127
2461
  return ret;
2128
2462
  },
2129
- __wbindgen_cast_0000000000000009: function(arg0) {
2463
+ __wbindgen_cast_000000000000000c: function(arg0) {
2130
2464
  // Cast intrinsic for `U64 -> Externref`.
2131
2465
  const ret = BigInt.asUintN(64, arg0);
2132
2466
  return ret;
@@ -2151,12 +2485,25 @@ function wasm_bindgen__convert__closures_____invoke__h03757a48b3eba690(arg0, arg
2151
2485
  wasm.wasm_bindgen__convert__closures_____invoke__h03757a48b3eba690(arg0, arg1);
2152
2486
  }
2153
2487
 
2154
- function wasm_bindgen__convert__closures_____invoke__hf7ddf3622752ec36(arg0, arg1, arg2) {
2155
- wasm.wasm_bindgen__convert__closures_____invoke__hf7ddf3622752ec36(arg0, arg1, arg2);
2488
+ function wasm_bindgen__convert__closures_____invoke__hcc3019a61bf91992(arg0, arg1) {
2489
+ wasm.wasm_bindgen__convert__closures_____invoke__hcc3019a61bf91992(arg0, arg1);
2490
+ }
2491
+
2492
+ function wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d(arg0, arg1, arg2) {
2493
+ wasm.wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d(arg0, arg1, arg2);
2494
+ }
2495
+
2496
+ function wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d_3(arg0, arg1, arg2) {
2497
+ wasm.wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d_3(arg0, arg1, arg2);
2498
+ }
2499
+
2500
+ function wasm_bindgen__convert__closures_____invoke__hbc8b7acec5ff03a6(arg0, arg1, arg2) {
2501
+ wasm.wasm_bindgen__convert__closures_____invoke__hbc8b7acec5ff03a6(arg0, arg1, arg2);
2156
2502
  }
2157
2503
 
2158
- function wasm_bindgen__convert__closures_____invoke__hc18e08680cddc2e5(arg0, arg1, arg2) {
2159
- wasm.wasm_bindgen__convert__closures_____invoke__hc18e08680cddc2e5(arg0, arg1, arg2);
2504
+ function wasm_bindgen__convert__closures_____invoke__h74026c82fbbbb92b(arg0, arg1, arg2) {
2505
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h74026c82fbbbb92b(arg0, arg1, arg2);
2506
+ return ret;
2160
2507
  }
2161
2508
 
2162
2509
  function wasm_bindgen__convert__closures_____invoke__h656199c36535c3e6(arg0, arg1, arg2) {
@@ -2178,6 +2525,9 @@ const WasmQueryBuilderFinalization = (typeof FinalizationRegistry === 'undefined
2178
2525
  const WasmRuntimeFinalization = (typeof FinalizationRegistry === 'undefined')
2179
2526
  ? { register: () => {}, unregister: () => {} }
2180
2527
  : new FinalizationRegistry(ptr => wasm.__wbg_wasmruntime_free(ptr >>> 0, 1));
2528
+ const WasmWorkerBridgeFinalization = (typeof FinalizationRegistry === 'undefined')
2529
+ ? { register: () => {}, unregister: () => {} }
2530
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmworkerbridge_free(ptr >>> 0, 1));
2181
2531
 
2182
2532
  function addToExternrefTable0(obj) {
2183
2533
  const idx = wasm.__externref_table_alloc();
@@ -2185,6 +2535,12 @@ function addToExternrefTable0(obj) {
2185
2535
  return idx;
2186
2536
  }
2187
2537
 
2538
+ function _assertClass(instance, klass) {
2539
+ if (!(instance instanceof klass)) {
2540
+ throw new Error(`expected instance of ${klass.name}`);
2541
+ }
2542
+ }
2543
+
2188
2544
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
2189
2545
  ? { register: () => {}, unregister: () => {} }
2190
2546
  : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
@@ -2293,6 +2649,31 @@ function isLikeNone(x) {
2293
2649
  return x === undefined || x === null;
2294
2650
  }
2295
2651
 
2652
+ function makeClosure(arg0, arg1, f) {
2653
+ const state = { a: arg0, b: arg1, cnt: 1 };
2654
+ const real = (...args) => {
2655
+
2656
+ // First up with a closure we increment the internal reference
2657
+ // count. This ensures that the Rust closure environment won't
2658
+ // be deallocated while we're invoking it.
2659
+ state.cnt++;
2660
+ try {
2661
+ return f(state.a, state.b, ...args);
2662
+ } finally {
2663
+ real._wbg_cb_unref();
2664
+ }
2665
+ };
2666
+ real._wbg_cb_unref = () => {
2667
+ if (--state.cnt === 0) {
2668
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
2669
+ state.a = 0;
2670
+ CLOSURE_DTORS.unregister(state);
2671
+ }
2672
+ };
2673
+ CLOSURE_DTORS.register(real, state, state);
2674
+ return real;
2675
+ }
2676
+
2296
2677
  function makeMutClosure(arg0, arg1, f) {
2297
2678
  const state = { a: arg0, b: arg1, cnt: 1 };
2298
2679
  const real = (...args) => {
Binary file