jazz-wasm 2.0.0-alpha.50 → 2.0.0-alpha.51
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 +1 -1
- package/pkg/jazz_wasm.d.ts +41 -153
- package/pkg/jazz_wasm.js +66 -348
- package/pkg/jazz_wasm_bg.wasm +0 -0
package/package.json
CHANGED
package/pkg/jazz_wasm.d.ts
CHANGED
|
@@ -107,26 +107,8 @@ export class WasmRuntime {
|
|
|
107
107
|
* Debug helper: expose schema/lens state currently loaded in SchemaManager.
|
|
108
108
|
*/
|
|
109
109
|
__debugSchemaState(): any;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*/
|
|
113
|
-
__debugSeedLiveSchema(schema_json: string): void;
|
|
114
|
-
/**
|
|
115
|
-
* Add a client connection (for server-side use in tests).
|
|
116
|
-
*/
|
|
117
|
-
addClient(): string;
|
|
118
|
-
/**
|
|
119
|
-
* Add a server connection.
|
|
120
|
-
*
|
|
121
|
-
* After adding the server, immediately flushes the outbox so that
|
|
122
|
-
* catalogue sync messages (from queue_full_sync_to_server) are sent
|
|
123
|
-
* before the call returns, rather than being deferred to a microtask.
|
|
124
|
-
*/
|
|
125
|
-
addServer(server_catalogue_state_hash?: string | null, next_sync_seq?: number | null): void;
|
|
126
|
-
/**
|
|
127
|
-
* Drive the runtime's batched receive/apply/send loop immediately.
|
|
128
|
-
*/
|
|
129
|
-
batchedTick(): void;
|
|
110
|
+
beginBatch(batch_mode: string): string;
|
|
111
|
+
commitBatch(batch_id: string): void;
|
|
130
112
|
/**
|
|
131
113
|
* Connect to a Jazz server over WebSocket.
|
|
132
114
|
*
|
|
@@ -152,13 +134,8 @@ export class WasmRuntime {
|
|
|
152
134
|
/**
|
|
153
135
|
* Delete a row by ObjectId.
|
|
154
136
|
*/
|
|
155
|
-
delete(object_id: string): any;
|
|
156
|
-
/**
|
|
157
|
-
* Delete a row by ObjectId as an explicit session principal.
|
|
158
|
-
*/
|
|
159
|
-
deleteWithSession(object_id: string, write_context_json?: string | null): any;
|
|
137
|
+
delete(object_id: string, write_context_json?: string | null): any;
|
|
160
138
|
static deriveUserId(seed_b64: string): string;
|
|
161
|
-
discardLocalBatch(batch_id: string): boolean;
|
|
162
139
|
/**
|
|
163
140
|
* Disconnect from the Jazz server and drop the transport handle.
|
|
164
141
|
*/
|
|
@@ -170,15 +147,6 @@ export class WasmRuntime {
|
|
|
170
147
|
* No-ops silently if the handle was already unsubscribed.
|
|
171
148
|
*/
|
|
172
149
|
executeSubscription(handle: number, on_update: Function): void;
|
|
173
|
-
/**
|
|
174
|
-
* Flush all data to persistent storage (snapshot).
|
|
175
|
-
*/
|
|
176
|
-
flush(): void;
|
|
177
|
-
/**
|
|
178
|
-
* Flush only the WAL buffer to OPFS (not the snapshot).
|
|
179
|
-
*/
|
|
180
|
-
flushWal(): void;
|
|
181
|
-
static getPublicKeyBase64url(seed_b64: string): string;
|
|
182
150
|
/**
|
|
183
151
|
* Get the current schema as JSON.
|
|
184
152
|
*/
|
|
@@ -187,19 +155,13 @@ export class WasmRuntime {
|
|
|
187
155
|
* Get the canonical schema hash (64-char hex).
|
|
188
156
|
*/
|
|
189
157
|
getSchemaHash(): string;
|
|
190
|
-
hydrateLocalBatchRecordStorageRow(bytes: Uint8Array): void;
|
|
191
158
|
/**
|
|
192
159
|
* Insert a row into a table.
|
|
193
160
|
*
|
|
194
161
|
* # Returns
|
|
195
162
|
* The inserted row as `{ id, values, batchId }`.
|
|
196
163
|
*/
|
|
197
|
-
insert(table: string, values: any, object_id?: string | null): any;
|
|
198
|
-
/**
|
|
199
|
-
* Insert a row into a table as an explicit session principal.
|
|
200
|
-
*/
|
|
201
|
-
insertWithSession(table: string, values: any, write_context_json?: string | null, object_id?: string | null): any;
|
|
202
|
-
loadBatchFate(batch_id: string): any;
|
|
164
|
+
insert(table: string, values: any, write_context_json?: string | null, object_id?: string | null): any;
|
|
203
165
|
static mintJazzSelfSignedToken(seed_b64: string, issuer: string, audience: string, ttl_seconds: bigint, now_seconds: bigint): string;
|
|
204
166
|
/**
|
|
205
167
|
* Create a new WasmRuntime.
|
|
@@ -230,36 +192,6 @@ export class WasmRuntime {
|
|
|
230
192
|
* Register a callback for unhandled mutation errors.
|
|
231
193
|
*/
|
|
232
194
|
onMutationError(callback: Function): void;
|
|
233
|
-
/**
|
|
234
|
-
* Called by JS when a sync message arrives from the server.
|
|
235
|
-
*
|
|
236
|
-
* # Arguments
|
|
237
|
-
* * `payload` - Either postcard-encoded SyncPayload bytes (`Uint8Array`)
|
|
238
|
-
* or JSON-encoded SyncPayload (`string`)
|
|
239
|
-
*/
|
|
240
|
-
onSyncMessageReceived(payload: any, sequence?: number | null): void;
|
|
241
|
-
/**
|
|
242
|
-
* Called by JS when a sync message arrives from a client (not a server).
|
|
243
|
-
*
|
|
244
|
-
* # Arguments
|
|
245
|
-
* * `client_id` - UUID string of the sending client
|
|
246
|
-
* * `payload` - Postcard-encoded SyncPayload bytes
|
|
247
|
-
*/
|
|
248
|
-
onSyncMessageReceivedFromClient(client_id: string, payload: any): void;
|
|
249
|
-
/**
|
|
250
|
-
* Create an ephemeral WasmRuntime backed by in-memory storage.
|
|
251
|
-
*
|
|
252
|
-
* Data is not persisted across page loads. Used as a fallback when OPFS
|
|
253
|
-
* is unavailable (e.g. Firefox private browsing mode).
|
|
254
|
-
*/
|
|
255
|
-
static openEphemeral(schema_json: string, app_id: string, env: string, user_branch: string, db_name: string, tier: string | null | undefined, use_binary_encoding: boolean): WasmRuntime;
|
|
256
|
-
/**
|
|
257
|
-
* Create a persistent WasmRuntime backed by OPFS.
|
|
258
|
-
*
|
|
259
|
-
* Opens a single OPFS file namespace and restores state from the latest
|
|
260
|
-
* durable checkpoint.
|
|
261
|
-
*/
|
|
262
|
-
static openPersistent(schema_json: string, app_id: string, env: string, user_branch: string, db_name: string, tier: string | null | undefined, use_binary_encoding: boolean): Promise<WasmRuntime>;
|
|
263
195
|
/**
|
|
264
196
|
* Execute a query and return results as a Promise.
|
|
265
197
|
*
|
|
@@ -267,32 +199,10 @@ export class WasmRuntime {
|
|
|
267
199
|
*/
|
|
268
200
|
query(query_json: string, session_json?: string | null, settled_tier?: string | null, options_json?: string | null): Promise<any>;
|
|
269
201
|
/**
|
|
270
|
-
*
|
|
271
|
-
*/
|
|
272
|
-
removeServer(): void;
|
|
273
|
-
replayBatchRejection(batch_id: string, code: string, reason: string): void;
|
|
274
|
-
sealBatch(batch_id: string): void;
|
|
275
|
-
/**
|
|
276
|
-
* Set a client's role.
|
|
277
|
-
*
|
|
278
|
-
* # Arguments
|
|
279
|
-
* * `client_id` - UUID string of the client
|
|
280
|
-
* * `role` - One of "user", "admin", "peer"
|
|
281
|
-
*/
|
|
282
|
-
setClientRole(client_id: string, role: string): void;
|
|
283
|
-
/**
|
|
284
|
-
* Subscribe to a query with a callback.
|
|
285
|
-
*
|
|
286
|
-
* Default behavior matches RuntimeCore:
|
|
287
|
-
* - with upstream server: first callback waits for protocol QuerySettled convergence
|
|
288
|
-
* - without upstream server: first callback is local-immediate
|
|
289
|
-
*
|
|
290
|
-
* Pass durability options to override this default.
|
|
291
|
-
*
|
|
292
|
-
* # Returns
|
|
293
|
-
* Subscription handle (f64) for later unsubscription.
|
|
202
|
+
* Restore a soft-deleted row by ObjectId.
|
|
294
203
|
*/
|
|
295
|
-
|
|
204
|
+
restore(table: string, object_id: string, values: any, write_context_json?: string | null): any;
|
|
205
|
+
rollbackBatch(batch_id: string): boolean;
|
|
296
206
|
/**
|
|
297
207
|
* Unsubscribe from a query.
|
|
298
208
|
*/
|
|
@@ -300,20 +210,15 @@ export class WasmRuntime {
|
|
|
300
210
|
/**
|
|
301
211
|
* Update a row by ObjectId.
|
|
302
212
|
*/
|
|
303
|
-
update(object_id: string, values: any): any;
|
|
213
|
+
update(object_id: string, values: any, write_context_json?: string | null): any;
|
|
304
214
|
/**
|
|
305
215
|
* Push updated auth credentials into the live transport.
|
|
306
216
|
*/
|
|
307
217
|
updateAuth(auth_json: string): void;
|
|
308
218
|
/**
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* # Arguments
|
|
312
|
-
* * `object_id` - UUID string of target object
|
|
313
|
-
* * `values` - Partial update map (`{ columnName: Value }`)
|
|
314
|
-
* * `session_json` - Optional JSON-encoded Session used for policy checks
|
|
219
|
+
* Create or update a row using a caller-supplied ObjectId.
|
|
315
220
|
*/
|
|
316
|
-
|
|
221
|
+
upsert(table: string, object_id: string, values: any, write_context_json?: string | null): any;
|
|
317
222
|
/**
|
|
318
223
|
* Wait for a batch to settle at the requested durability tier.
|
|
319
224
|
*/
|
|
@@ -475,10 +380,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
475
380
|
|
|
476
381
|
export interface InitOutput {
|
|
477
382
|
readonly memory: WebAssembly.Memory;
|
|
478
|
-
readonly
|
|
479
|
-
readonly generateId: () => [number, number];
|
|
480
|
-
readonly parseSchema: (a: number, b: number) => [number, number, number];
|
|
481
|
-
readonly init: () => void;
|
|
383
|
+
readonly runAsWorker: (a: any, b: any) => [number, number];
|
|
482
384
|
readonly __wbg_wasmquerybuilder_free: (a: number, b: number) => void;
|
|
483
385
|
readonly wasmquerybuilder_alias: (a: number, b: number, c: number) => number;
|
|
484
386
|
readonly wasmquerybuilder_branch: (a: number, b: number, c: number) => number;
|
|
@@ -501,73 +403,59 @@ export interface InitOutput {
|
|
|
501
403
|
readonly wasmquerybuilder_orderBy: (a: number, b: number, c: number) => number;
|
|
502
404
|
readonly wasmquerybuilder_orderByDesc: (a: number, b: number, c: number) => number;
|
|
503
405
|
readonly wasmquerybuilder_select: (a: number, b: number, c: number) => number;
|
|
504
|
-
readonly runAsWorker: (a: any, b: any) => [number, number];
|
|
505
|
-
readonly __wbg_wasmworkerbridge_free: (a: number, b: number) => void;
|
|
506
|
-
readonly wasmworkerbridge_applyIncomingServerPayload: (a: number, b: any) => [number, number];
|
|
507
|
-
readonly wasmworkerbridge_attach: (a: any, b: number, c: any) => [number, number, number];
|
|
508
|
-
readonly wasmworkerbridge_closePeer: (a: number, b: number, c: number) => void;
|
|
509
|
-
readonly wasmworkerbridge_disconnectUpstream: (a: number) => void;
|
|
510
|
-
readonly wasmworkerbridge_getWorkerClientId: (a: number) => any;
|
|
511
|
-
readonly wasmworkerbridge_init: (a: number) => any;
|
|
512
|
-
readonly wasmworkerbridge_openPeer: (a: number, b: number, c: number) => void;
|
|
513
|
-
readonly wasmworkerbridge_reconnectUpstream: (a: number) => void;
|
|
514
|
-
readonly wasmworkerbridge_replayServerConnection: (a: number) => void;
|
|
515
|
-
readonly wasmworkerbridge_sendLifecycleHint: (a: number, b: number, c: number) => void;
|
|
516
|
-
readonly wasmworkerbridge_sendPeerSync: (a: number, b: number, c: number, d: number, e: any) => void;
|
|
517
|
-
readonly wasmworkerbridge_setListeners: (a: number, b: any) => void;
|
|
518
|
-
readonly wasmworkerbridge_setServerPayloadForwarder: (a: number, b: number) => void;
|
|
519
|
-
readonly wasmworkerbridge_shutdown: (a: number) => any;
|
|
520
|
-
readonly wasmworkerbridge_simulateCrash: (a: number) => any;
|
|
521
|
-
readonly wasmworkerbridge_updateAuth: (a: number, b: number, c: number) => void;
|
|
522
|
-
readonly wasmworkerbridge_waitForUpstreamServerConnection: (a: number) => any;
|
|
523
406
|
readonly decodeMainToWorkerJs: (a: any) => [number, number, number];
|
|
524
407
|
readonly decodeWorkerToMainJs: (a: any) => [number, number, number];
|
|
525
408
|
readonly encodeMainToWorkerJs: (a: any) => [number, number, number];
|
|
526
409
|
readonly encodeWorkerToMainJs: (a: any) => [number, number, number];
|
|
410
|
+
readonly currentTimestamp: () => bigint;
|
|
411
|
+
readonly generateId: () => [number, number];
|
|
412
|
+
readonly parseSchema: (a: number, b: number) => [number, number, number];
|
|
413
|
+
readonly init: () => void;
|
|
527
414
|
readonly __wbg_wasmruntime_free: (a: number, b: number) => void;
|
|
415
|
+
readonly __wbg_wasmworkerbridge_free: (a: number, b: number) => void;
|
|
528
416
|
readonly setTraceEntryCollectionEnabled: (a: number) => void;
|
|
529
417
|
readonly wasmruntime___debugSchemaState: (a: number) => [number, number, number];
|
|
530
|
-
readonly
|
|
531
|
-
readonly
|
|
532
|
-
readonly wasmruntime_addServer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
533
|
-
readonly wasmruntime_batchedTick: (a: number) => void;
|
|
418
|
+
readonly wasmruntime_beginBatch: (a: number, b: number, c: number) => [number, number, number, number];
|
|
419
|
+
readonly wasmruntime_commitBatch: (a: number, b: number, c: number) => [number, number];
|
|
534
420
|
readonly wasmruntime_connect: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
535
421
|
readonly wasmruntime_createSubscription: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
536
422
|
readonly wasmruntime_createWorkerBridge: (a: number, b: any, c: any) => [number, number, number];
|
|
537
|
-
readonly wasmruntime_delete: (a: number, b: number, c: number) => [number, number, number];
|
|
538
|
-
readonly wasmruntime_deleteWithSession: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
423
|
+
readonly wasmruntime_delete: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
539
424
|
readonly wasmruntime_deriveUserId: (a: number, b: number) => [number, number, number, number];
|
|
540
|
-
readonly wasmruntime_discardLocalBatch: (a: number, b: number, c: number) => [number, number, number];
|
|
541
425
|
readonly wasmruntime_disconnect: (a: number) => void;
|
|
542
426
|
readonly wasmruntime_executeSubscription: (a: number, b: number, c: any) => [number, number];
|
|
543
|
-
readonly wasmruntime_flush: (a: number) => [number, number];
|
|
544
|
-
readonly wasmruntime_flushWal: (a: number) => [number, number];
|
|
545
|
-
readonly wasmruntime_getPublicKeyBase64url: (a: number, b: number) => [number, number, number, number];
|
|
546
427
|
readonly wasmruntime_getSchema: (a: number) => [number, number, number];
|
|
547
428
|
readonly wasmruntime_getSchemaHash: (a: number) => [number, number];
|
|
548
|
-
readonly
|
|
549
|
-
readonly wasmruntime_insert: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
|
|
550
|
-
readonly wasmruntime_insertWithSession: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
551
|
-
readonly wasmruntime_loadBatchFate: (a: number, b: number, c: number) => [number, number, number];
|
|
429
|
+
readonly wasmruntime_insert: (a: number, b: number, c: number, d: any, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
552
430
|
readonly wasmruntime_mintJazzSelfSignedToken: (a: number, b: number, c: number, d: number, e: number, f: number, g: bigint, h: bigint) => [number, number, number, number];
|
|
553
431
|
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, l: number) => [number, number, number];
|
|
554
432
|
readonly wasmruntime_onAuthFailure: (a: number, b: any) => void;
|
|
555
433
|
readonly wasmruntime_onMutationError: (a: number, b: any) => void;
|
|
556
|
-
readonly wasmruntime_onSyncMessageReceived: (a: number, b: any, c: number, d: number) => [number, number];
|
|
557
|
-
readonly wasmruntime_onSyncMessageReceivedFromClient: (a: number, b: number, c: number, d: any) => [number, number];
|
|
558
|
-
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];
|
|
559
|
-
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;
|
|
560
434
|
readonly wasmruntime_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
561
|
-
readonly
|
|
562
|
-
readonly
|
|
563
|
-
readonly wasmruntime_sealBatch: (a: number, b: number, c: number) => [number, number];
|
|
564
|
-
readonly wasmruntime_setClientRole: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
565
|
-
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];
|
|
435
|
+
readonly wasmruntime_restore: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number) => [number, number, number];
|
|
436
|
+
readonly wasmruntime_rollbackBatch: (a: number, b: number, c: number) => [number, number, number];
|
|
566
437
|
readonly wasmruntime_unsubscribe: (a: number, b: number) => void;
|
|
567
|
-
readonly wasmruntime_update: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
438
|
+
readonly wasmruntime_update: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
|
|
568
439
|
readonly wasmruntime_updateAuth: (a: number, b: number, c: number) => [number, number];
|
|
569
|
-
readonly
|
|
440
|
+
readonly wasmruntime_upsert: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number) => [number, number, number];
|
|
570
441
|
readonly wasmruntime_waitForBatch: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
442
|
+
readonly wasmworkerbridge_applyIncomingServerPayload: (a: number, b: any) => [number, number];
|
|
443
|
+
readonly wasmworkerbridge_attach: (a: any, b: number, c: any) => [number, number, number];
|
|
444
|
+
readonly wasmworkerbridge_closePeer: (a: number, b: number, c: number) => void;
|
|
445
|
+
readonly wasmworkerbridge_disconnectUpstream: (a: number) => void;
|
|
446
|
+
readonly wasmworkerbridge_getWorkerClientId: (a: number) => any;
|
|
447
|
+
readonly wasmworkerbridge_init: (a: number) => any;
|
|
448
|
+
readonly wasmworkerbridge_openPeer: (a: number, b: number, c: number) => void;
|
|
449
|
+
readonly wasmworkerbridge_reconnectUpstream: (a: number) => void;
|
|
450
|
+
readonly wasmworkerbridge_replayServerConnection: (a: number) => void;
|
|
451
|
+
readonly wasmworkerbridge_sendLifecycleHint: (a: number, b: number, c: number) => void;
|
|
452
|
+
readonly wasmworkerbridge_sendPeerSync: (a: number, b: number, c: number, d: number, e: any) => void;
|
|
453
|
+
readonly wasmworkerbridge_setListeners: (a: number, b: any) => void;
|
|
454
|
+
readonly wasmworkerbridge_setServerPayloadForwarder: (a: number, b: number) => void;
|
|
455
|
+
readonly wasmworkerbridge_shutdown: (a: number) => any;
|
|
456
|
+
readonly wasmworkerbridge_simulateCrash: (a: number) => any;
|
|
457
|
+
readonly wasmworkerbridge_updateAuth: (a: number, b: number, c: number) => void;
|
|
458
|
+
readonly wasmworkerbridge_waitForUpstreamServerConnection: (a: number) => any;
|
|
571
459
|
readonly drainTraceEntries: () => any;
|
|
572
460
|
readonly subscribeTraceEntries: (a: any) => any;
|
|
573
461
|
readonly bench_get_pin_internal_pages: () => number;
|
package/pkg/jazz_wasm.js
CHANGED
|
@@ -312,13 +312,6 @@ if (Symbol.dispose) WasmQueryBuilder.prototype[Symbol.dispose] = WasmQueryBuilde
|
|
|
312
312
|
* Async scheduling happens via WasmScheduler.schedule_batched_tick().
|
|
313
313
|
*/
|
|
314
314
|
export class WasmRuntime {
|
|
315
|
-
static __wrap(ptr) {
|
|
316
|
-
ptr = ptr >>> 0;
|
|
317
|
-
const obj = Object.create(WasmRuntime.prototype);
|
|
318
|
-
obj.__wbg_ptr = ptr;
|
|
319
|
-
WasmRuntimeFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
320
|
-
return obj;
|
|
321
|
-
}
|
|
322
315
|
__destroy_into_raw() {
|
|
323
316
|
const ptr = this.__wbg_ptr;
|
|
324
317
|
this.__wbg_ptr = 0;
|
|
@@ -341,56 +334,40 @@ export class WasmRuntime {
|
|
|
341
334
|
return takeFromExternrefTable0(ret[0]);
|
|
342
335
|
}
|
|
343
336
|
/**
|
|
344
|
-
*
|
|
345
|
-
* @param {string} schema_json
|
|
346
|
-
*/
|
|
347
|
-
__debugSeedLiveSchema(schema_json) {
|
|
348
|
-
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
349
|
-
const len0 = WASM_VECTOR_LEN;
|
|
350
|
-
const ret = wasm.wasmruntime___debugSeedLiveSchema(this.__wbg_ptr, ptr0, len0);
|
|
351
|
-
if (ret[1]) {
|
|
352
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Add a client connection (for server-side use in tests).
|
|
337
|
+
* @param {string} batch_mode
|
|
357
338
|
* @returns {string}
|
|
358
339
|
*/
|
|
359
|
-
|
|
360
|
-
let
|
|
361
|
-
let
|
|
340
|
+
beginBatch(batch_mode) {
|
|
341
|
+
let deferred3_0;
|
|
342
|
+
let deferred3_1;
|
|
362
343
|
try {
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
344
|
+
const ptr0 = passStringToWasm0(batch_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
345
|
+
const len0 = WASM_VECTOR_LEN;
|
|
346
|
+
const ret = wasm.wasmruntime_beginBatch(this.__wbg_ptr, ptr0, len0);
|
|
347
|
+
var ptr2 = ret[0];
|
|
348
|
+
var len2 = ret[1];
|
|
349
|
+
if (ret[3]) {
|
|
350
|
+
ptr2 = 0; len2 = 0;
|
|
351
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
352
|
+
}
|
|
353
|
+
deferred3_0 = ptr2;
|
|
354
|
+
deferred3_1 = len2;
|
|
355
|
+
return getStringFromWasm0(ptr2, len2);
|
|
367
356
|
} finally {
|
|
368
|
-
wasm.__wbindgen_free(
|
|
357
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
369
358
|
}
|
|
370
359
|
}
|
|
371
360
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* After adding the server, immediately flushes the outbox so that
|
|
375
|
-
* catalogue sync messages (from queue_full_sync_to_server) are sent
|
|
376
|
-
* before the call returns, rather than being deferred to a microtask.
|
|
377
|
-
* @param {string | null} [server_catalogue_state_hash]
|
|
378
|
-
* @param {number | null} [next_sync_seq]
|
|
361
|
+
* @param {string} batch_id
|
|
379
362
|
*/
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
const ret = wasm.
|
|
363
|
+
commitBatch(batch_id) {
|
|
364
|
+
const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
365
|
+
const len0 = WASM_VECTOR_LEN;
|
|
366
|
+
const ret = wasm.wasmruntime_commitBatch(this.__wbg_ptr, ptr0, len0);
|
|
384
367
|
if (ret[1]) {
|
|
385
368
|
throw takeFromExternrefTable0(ret[0]);
|
|
386
369
|
}
|
|
387
370
|
}
|
|
388
|
-
/**
|
|
389
|
-
* Drive the runtime's batched receive/apply/send loop immediately.
|
|
390
|
-
*/
|
|
391
|
-
batchedTick() {
|
|
392
|
-
wasm.wasmruntime_batchedTick(this.__wbg_ptr);
|
|
393
|
-
}
|
|
394
371
|
/**
|
|
395
372
|
* Connect to a Jazz server over WebSocket.
|
|
396
373
|
*
|
|
@@ -455,29 +432,15 @@ export class WasmRuntime {
|
|
|
455
432
|
/**
|
|
456
433
|
* Delete a row by ObjectId.
|
|
457
434
|
* @param {string} object_id
|
|
458
|
-
* @returns {any}
|
|
459
|
-
*/
|
|
460
|
-
delete(object_id) {
|
|
461
|
-
const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
462
|
-
const len0 = WASM_VECTOR_LEN;
|
|
463
|
-
const ret = wasm.wasmruntime_delete(this.__wbg_ptr, ptr0, len0);
|
|
464
|
-
if (ret[2]) {
|
|
465
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
466
|
-
}
|
|
467
|
-
return takeFromExternrefTable0(ret[0]);
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Delete a row by ObjectId as an explicit session principal.
|
|
471
|
-
* @param {string} object_id
|
|
472
435
|
* @param {string | null} [write_context_json]
|
|
473
436
|
* @returns {any}
|
|
474
437
|
*/
|
|
475
|
-
|
|
438
|
+
delete(object_id, write_context_json) {
|
|
476
439
|
const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
477
440
|
const len0 = WASM_VECTOR_LEN;
|
|
478
441
|
var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
479
442
|
var len1 = WASM_VECTOR_LEN;
|
|
480
|
-
const ret = wasm.
|
|
443
|
+
const ret = wasm.wasmruntime_delete(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
481
444
|
if (ret[2]) {
|
|
482
445
|
throw takeFromExternrefTable0(ret[1]);
|
|
483
446
|
}
|
|
@@ -507,19 +470,6 @@ export class WasmRuntime {
|
|
|
507
470
|
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
508
471
|
}
|
|
509
472
|
}
|
|
510
|
-
/**
|
|
511
|
-
* @param {string} batch_id
|
|
512
|
-
* @returns {boolean}
|
|
513
|
-
*/
|
|
514
|
-
discardLocalBatch(batch_id) {
|
|
515
|
-
const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
516
|
-
const len0 = WASM_VECTOR_LEN;
|
|
517
|
-
const ret = wasm.wasmruntime_discardLocalBatch(this.__wbg_ptr, ptr0, len0);
|
|
518
|
-
if (ret[2]) {
|
|
519
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
520
|
-
}
|
|
521
|
-
return ret[0] !== 0;
|
|
522
|
-
}
|
|
523
473
|
/**
|
|
524
474
|
* Disconnect from the Jazz server and drop the transport handle.
|
|
525
475
|
*/
|
|
@@ -540,48 +490,6 @@ export class WasmRuntime {
|
|
|
540
490
|
throw takeFromExternrefTable0(ret[0]);
|
|
541
491
|
}
|
|
542
492
|
}
|
|
543
|
-
/**
|
|
544
|
-
* Flush all data to persistent storage (snapshot).
|
|
545
|
-
*/
|
|
546
|
-
flush() {
|
|
547
|
-
const ret = wasm.wasmruntime_flush(this.__wbg_ptr);
|
|
548
|
-
if (ret[1]) {
|
|
549
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* Flush only the WAL buffer to OPFS (not the snapshot).
|
|
554
|
-
*/
|
|
555
|
-
flushWal() {
|
|
556
|
-
const ret = wasm.wasmruntime_flushWal(this.__wbg_ptr);
|
|
557
|
-
if (ret[1]) {
|
|
558
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* @param {string} seed_b64
|
|
563
|
-
* @returns {string}
|
|
564
|
-
*/
|
|
565
|
-
static getPublicKeyBase64url(seed_b64) {
|
|
566
|
-
let deferred3_0;
|
|
567
|
-
let deferred3_1;
|
|
568
|
-
try {
|
|
569
|
-
const ptr0 = passStringToWasm0(seed_b64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
570
|
-
const len0 = WASM_VECTOR_LEN;
|
|
571
|
-
const ret = wasm.wasmruntime_getPublicKeyBase64url(ptr0, len0);
|
|
572
|
-
var ptr2 = ret[0];
|
|
573
|
-
var len2 = ret[1];
|
|
574
|
-
if (ret[3]) {
|
|
575
|
-
ptr2 = 0; len2 = 0;
|
|
576
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
577
|
-
}
|
|
578
|
-
deferred3_0 = ptr2;
|
|
579
|
-
deferred3_1 = len2;
|
|
580
|
-
return getStringFromWasm0(ptr2, len2);
|
|
581
|
-
} finally {
|
|
582
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
493
|
/**
|
|
586
494
|
* Get the current schema as JSON.
|
|
587
495
|
* @returns {any}
|
|
@@ -609,15 +517,6 @@ export class WasmRuntime {
|
|
|
609
517
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
610
518
|
}
|
|
611
519
|
}
|
|
612
|
-
/**
|
|
613
|
-
* @param {Uint8Array} bytes
|
|
614
|
-
*/
|
|
615
|
-
hydrateLocalBatchRecordStorageRow(bytes) {
|
|
616
|
-
const ret = wasm.wasmruntime_hydrateLocalBatchRecordStorageRow(this.__wbg_ptr, bytes);
|
|
617
|
-
if (ret[1]) {
|
|
618
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
520
|
/**
|
|
622
521
|
* Insert a row into a table.
|
|
623
522
|
*
|
|
@@ -625,49 +524,18 @@ export class WasmRuntime {
|
|
|
625
524
|
* The inserted row as `{ id, values, batchId }`.
|
|
626
525
|
* @param {string} table
|
|
627
526
|
* @param {any} values
|
|
628
|
-
* @param {string | null} [object_id]
|
|
629
|
-
* @returns {any}
|
|
630
|
-
*/
|
|
631
|
-
insert(table, values, object_id) {
|
|
632
|
-
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
633
|
-
const len0 = WASM_VECTOR_LEN;
|
|
634
|
-
var ptr1 = isLikeNone(object_id) ? 0 : passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
635
|
-
var len1 = WASM_VECTOR_LEN;
|
|
636
|
-
const ret = wasm.wasmruntime_insert(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
|
|
637
|
-
if (ret[2]) {
|
|
638
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
639
|
-
}
|
|
640
|
-
return takeFromExternrefTable0(ret[0]);
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Insert a row into a table as an explicit session principal.
|
|
644
|
-
* @param {string} table
|
|
645
|
-
* @param {any} values
|
|
646
527
|
* @param {string | null} [write_context_json]
|
|
647
528
|
* @param {string | null} [object_id]
|
|
648
529
|
* @returns {any}
|
|
649
530
|
*/
|
|
650
|
-
|
|
531
|
+
insert(table, values, write_context_json, object_id) {
|
|
651
532
|
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
652
533
|
const len0 = WASM_VECTOR_LEN;
|
|
653
534
|
var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
654
535
|
var len1 = WASM_VECTOR_LEN;
|
|
655
536
|
var ptr2 = isLikeNone(object_id) ? 0 : passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
656
537
|
var len2 = WASM_VECTOR_LEN;
|
|
657
|
-
const ret = wasm.
|
|
658
|
-
if (ret[2]) {
|
|
659
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
660
|
-
}
|
|
661
|
-
return takeFromExternrefTable0(ret[0]);
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* @param {string} batch_id
|
|
665
|
-
* @returns {any}
|
|
666
|
-
*/
|
|
667
|
-
loadBatchFate(batch_id) {
|
|
668
|
-
const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
669
|
-
const len0 = WASM_VECTOR_LEN;
|
|
670
|
-
const ret = wasm.wasmruntime_loadBatchFate(this.__wbg_ptr, ptr0, len0);
|
|
538
|
+
const ret = wasm.wasmruntime_insert(this.__wbg_ptr, ptr0, len0, values, ptr1, len1, ptr2, len2);
|
|
671
539
|
if (ret[2]) {
|
|
672
540
|
throw takeFromExternrefTable0(ret[1]);
|
|
673
541
|
}
|
|
@@ -765,101 +633,6 @@ export class WasmRuntime {
|
|
|
765
633
|
onMutationError(callback) {
|
|
766
634
|
wasm.wasmruntime_onMutationError(this.__wbg_ptr, callback);
|
|
767
635
|
}
|
|
768
|
-
/**
|
|
769
|
-
* Called by JS when a sync message arrives from the server.
|
|
770
|
-
*
|
|
771
|
-
* # Arguments
|
|
772
|
-
* * `payload` - Either postcard-encoded SyncPayload bytes (`Uint8Array`)
|
|
773
|
-
* or JSON-encoded SyncPayload (`string`)
|
|
774
|
-
* @param {any} payload
|
|
775
|
-
* @param {number | null} [sequence]
|
|
776
|
-
*/
|
|
777
|
-
onSyncMessageReceived(payload, sequence) {
|
|
778
|
-
const ret = wasm.wasmruntime_onSyncMessageReceived(this.__wbg_ptr, payload, !isLikeNone(sequence), isLikeNone(sequence) ? 0 : sequence);
|
|
779
|
-
if (ret[1]) {
|
|
780
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Called by JS when a sync message arrives from a client (not a server).
|
|
785
|
-
*
|
|
786
|
-
* # Arguments
|
|
787
|
-
* * `client_id` - UUID string of the sending client
|
|
788
|
-
* * `payload` - Postcard-encoded SyncPayload bytes
|
|
789
|
-
* @param {string} client_id
|
|
790
|
-
* @param {any} payload
|
|
791
|
-
*/
|
|
792
|
-
onSyncMessageReceivedFromClient(client_id, payload) {
|
|
793
|
-
const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
794
|
-
const len0 = WASM_VECTOR_LEN;
|
|
795
|
-
const ret = wasm.wasmruntime_onSyncMessageReceivedFromClient(this.__wbg_ptr, ptr0, len0, payload);
|
|
796
|
-
if (ret[1]) {
|
|
797
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Create an ephemeral WasmRuntime backed by in-memory storage.
|
|
802
|
-
*
|
|
803
|
-
* Data is not persisted across page loads. Used as a fallback when OPFS
|
|
804
|
-
* is unavailable (e.g. Firefox private browsing mode).
|
|
805
|
-
* @param {string} schema_json
|
|
806
|
-
* @param {string} app_id
|
|
807
|
-
* @param {string} env
|
|
808
|
-
* @param {string} user_branch
|
|
809
|
-
* @param {string} db_name
|
|
810
|
-
* @param {string | null | undefined} tier
|
|
811
|
-
* @param {boolean} use_binary_encoding
|
|
812
|
-
* @returns {WasmRuntime}
|
|
813
|
-
*/
|
|
814
|
-
static openEphemeral(schema_json, app_id, env, user_branch, db_name, tier, use_binary_encoding) {
|
|
815
|
-
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
816
|
-
const len0 = WASM_VECTOR_LEN;
|
|
817
|
-
const ptr1 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
818
|
-
const len1 = WASM_VECTOR_LEN;
|
|
819
|
-
const ptr2 = passStringToWasm0(env, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
820
|
-
const len2 = WASM_VECTOR_LEN;
|
|
821
|
-
const ptr3 = passStringToWasm0(user_branch, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
822
|
-
const len3 = WASM_VECTOR_LEN;
|
|
823
|
-
const ptr4 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
824
|
-
const len4 = WASM_VECTOR_LEN;
|
|
825
|
-
var ptr5 = isLikeNone(tier) ? 0 : passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
826
|
-
var len5 = WASM_VECTOR_LEN;
|
|
827
|
-
const ret = wasm.wasmruntime_openEphemeral(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, use_binary_encoding);
|
|
828
|
-
if (ret[2]) {
|
|
829
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
830
|
-
}
|
|
831
|
-
return WasmRuntime.__wrap(ret[0]);
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Create a persistent WasmRuntime backed by OPFS.
|
|
835
|
-
*
|
|
836
|
-
* Opens a single OPFS file namespace and restores state from the latest
|
|
837
|
-
* durable checkpoint.
|
|
838
|
-
* @param {string} schema_json
|
|
839
|
-
* @param {string} app_id
|
|
840
|
-
* @param {string} env
|
|
841
|
-
* @param {string} user_branch
|
|
842
|
-
* @param {string} db_name
|
|
843
|
-
* @param {string | null | undefined} tier
|
|
844
|
-
* @param {boolean} use_binary_encoding
|
|
845
|
-
* @returns {Promise<WasmRuntime>}
|
|
846
|
-
*/
|
|
847
|
-
static openPersistent(schema_json, app_id, env, user_branch, db_name, tier, use_binary_encoding) {
|
|
848
|
-
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
849
|
-
const len0 = WASM_VECTOR_LEN;
|
|
850
|
-
const ptr1 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
851
|
-
const len1 = WASM_VECTOR_LEN;
|
|
852
|
-
const ptr2 = passStringToWasm0(env, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
853
|
-
const len2 = WASM_VECTOR_LEN;
|
|
854
|
-
const ptr3 = passStringToWasm0(user_branch, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
855
|
-
const len3 = WASM_VECTOR_LEN;
|
|
856
|
-
const ptr4 = passStringToWasm0(db_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
857
|
-
const len4 = WASM_VECTOR_LEN;
|
|
858
|
-
var ptr5 = isLikeNone(tier) ? 0 : passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
859
|
-
var len5 = WASM_VECTOR_LEN;
|
|
860
|
-
const ret = wasm.wasmruntime_openPersistent(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, use_binary_encoding);
|
|
861
|
-
return ret;
|
|
862
|
-
}
|
|
863
636
|
/**
|
|
864
637
|
* Execute a query and return results as a Promise.
|
|
865
638
|
*
|
|
@@ -886,90 +659,38 @@ export class WasmRuntime {
|
|
|
886
659
|
return takeFromExternrefTable0(ret[0]);
|
|
887
660
|
}
|
|
888
661
|
/**
|
|
889
|
-
*
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
* @param {string} batch_id
|
|
896
|
-
* @param {string} code
|
|
897
|
-
* @param {string} reason
|
|
662
|
+
* Restore a soft-deleted row by ObjectId.
|
|
663
|
+
* @param {string} table
|
|
664
|
+
* @param {string} object_id
|
|
665
|
+
* @param {any} values
|
|
666
|
+
* @param {string | null} [write_context_json]
|
|
667
|
+
* @returns {any}
|
|
898
668
|
*/
|
|
899
|
-
|
|
900
|
-
const ptr0 = passStringToWasm0(
|
|
669
|
+
restore(table, object_id, values, write_context_json) {
|
|
670
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
901
671
|
const len0 = WASM_VECTOR_LEN;
|
|
902
|
-
const ptr1 = passStringToWasm0(
|
|
672
|
+
const ptr1 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
903
673
|
const len1 = WASM_VECTOR_LEN;
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
const ret = wasm.
|
|
907
|
-
if (ret[
|
|
908
|
-
throw takeFromExternrefTable0(ret[
|
|
674
|
+
var ptr2 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
675
|
+
var len2 = WASM_VECTOR_LEN;
|
|
676
|
+
const ret = wasm.wasmruntime_restore(this.__wbg_ptr, ptr0, len0, ptr1, len1, values, ptr2, len2);
|
|
677
|
+
if (ret[2]) {
|
|
678
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
909
679
|
}
|
|
680
|
+
return takeFromExternrefTable0(ret[0]);
|
|
910
681
|
}
|
|
911
682
|
/**
|
|
912
683
|
* @param {string} batch_id
|
|
684
|
+
* @returns {boolean}
|
|
913
685
|
*/
|
|
914
|
-
|
|
686
|
+
rollbackBatch(batch_id) {
|
|
915
687
|
const ptr0 = passStringToWasm0(batch_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
916
688
|
const len0 = WASM_VECTOR_LEN;
|
|
917
|
-
const ret = wasm.
|
|
918
|
-
if (ret[1]) {
|
|
919
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Set a client's role.
|
|
924
|
-
*
|
|
925
|
-
* # Arguments
|
|
926
|
-
* * `client_id` - UUID string of the client
|
|
927
|
-
* * `role` - One of "user", "admin", "peer"
|
|
928
|
-
* @param {string} client_id
|
|
929
|
-
* @param {string} role
|
|
930
|
-
*/
|
|
931
|
-
setClientRole(client_id, role) {
|
|
932
|
-
const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
933
|
-
const len0 = WASM_VECTOR_LEN;
|
|
934
|
-
const ptr1 = passStringToWasm0(role, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
935
|
-
const len1 = WASM_VECTOR_LEN;
|
|
936
|
-
const ret = wasm.wasmruntime_setClientRole(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
937
|
-
if (ret[1]) {
|
|
938
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
/**
|
|
942
|
-
* Subscribe to a query with a callback.
|
|
943
|
-
*
|
|
944
|
-
* Default behavior matches RuntimeCore:
|
|
945
|
-
* - with upstream server: first callback waits for protocol QuerySettled convergence
|
|
946
|
-
* - without upstream server: first callback is local-immediate
|
|
947
|
-
*
|
|
948
|
-
* Pass durability options to override this default.
|
|
949
|
-
*
|
|
950
|
-
* # Returns
|
|
951
|
-
* Subscription handle (f64) for later unsubscription.
|
|
952
|
-
* @param {string} query_json
|
|
953
|
-
* @param {Function} on_update
|
|
954
|
-
* @param {string | null} [session_json]
|
|
955
|
-
* @param {string | null} [settled_tier]
|
|
956
|
-
* @param {string | null} [options_json]
|
|
957
|
-
* @returns {number}
|
|
958
|
-
*/
|
|
959
|
-
subscribe(query_json, on_update, session_json, settled_tier, options_json) {
|
|
960
|
-
const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
961
|
-
const len0 = WASM_VECTOR_LEN;
|
|
962
|
-
var ptr1 = isLikeNone(session_json) ? 0 : passStringToWasm0(session_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
963
|
-
var len1 = WASM_VECTOR_LEN;
|
|
964
|
-
var ptr2 = isLikeNone(settled_tier) ? 0 : passStringToWasm0(settled_tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
965
|
-
var len2 = WASM_VECTOR_LEN;
|
|
966
|
-
var ptr3 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
967
|
-
var len3 = WASM_VECTOR_LEN;
|
|
968
|
-
const ret = wasm.wasmruntime_subscribe(this.__wbg_ptr, ptr0, len0, on_update, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
689
|
+
const ret = wasm.wasmruntime_rollbackBatch(this.__wbg_ptr, ptr0, len0);
|
|
969
690
|
if (ret[2]) {
|
|
970
691
|
throw takeFromExternrefTable0(ret[1]);
|
|
971
692
|
}
|
|
972
|
-
return ret[0];
|
|
693
|
+
return ret[0] !== 0;
|
|
973
694
|
}
|
|
974
695
|
/**
|
|
975
696
|
* Unsubscribe from a query.
|
|
@@ -982,12 +703,15 @@ export class WasmRuntime {
|
|
|
982
703
|
* Update a row by ObjectId.
|
|
983
704
|
* @param {string} object_id
|
|
984
705
|
* @param {any} values
|
|
706
|
+
* @param {string | null} [write_context_json]
|
|
985
707
|
* @returns {any}
|
|
986
708
|
*/
|
|
987
|
-
update(object_id, values) {
|
|
709
|
+
update(object_id, values, write_context_json) {
|
|
988
710
|
const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
989
711
|
const len0 = WASM_VECTOR_LEN;
|
|
990
|
-
|
|
712
|
+
var ptr1 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
713
|
+
var len1 = WASM_VECTOR_LEN;
|
|
714
|
+
const ret = wasm.wasmruntime_update(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
|
|
991
715
|
if (ret[2]) {
|
|
992
716
|
throw takeFromExternrefTable0(ret[1]);
|
|
993
717
|
}
|
|
@@ -1006,23 +730,21 @@ export class WasmRuntime {
|
|
|
1006
730
|
}
|
|
1007
731
|
}
|
|
1008
732
|
/**
|
|
1009
|
-
*
|
|
1010
|
-
*
|
|
1011
|
-
* # Arguments
|
|
1012
|
-
* * `object_id` - UUID string of target object
|
|
1013
|
-
* * `values` - Partial update map (`{ columnName: Value }`)
|
|
1014
|
-
* * `session_json` - Optional JSON-encoded Session used for policy checks
|
|
733
|
+
* Create or update a row using a caller-supplied ObjectId.
|
|
734
|
+
* @param {string} table
|
|
1015
735
|
* @param {string} object_id
|
|
1016
736
|
* @param {any} values
|
|
1017
737
|
* @param {string | null} [write_context_json]
|
|
1018
738
|
* @returns {any}
|
|
1019
739
|
*/
|
|
1020
|
-
|
|
1021
|
-
const ptr0 = passStringToWasm0(
|
|
740
|
+
upsert(table, object_id, values, write_context_json) {
|
|
741
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1022
742
|
const len0 = WASM_VECTOR_LEN;
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
743
|
+
const ptr1 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
744
|
+
const len1 = WASM_VECTOR_LEN;
|
|
745
|
+
var ptr2 = isLikeNone(write_context_json) ? 0 : passStringToWasm0(write_context_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
746
|
+
var len2 = WASM_VECTOR_LEN;
|
|
747
|
+
const ret = wasm.wasmruntime_upsert(this.__wbg_ptr, ptr0, len0, ptr1, len1, values, ptr2, len2);
|
|
1026
748
|
if (ret[2]) {
|
|
1027
749
|
throw takeFromExternrefTable0(ret[1]);
|
|
1028
750
|
}
|
|
@@ -2281,46 +2003,42 @@ function __wbg_get_imports() {
|
|
|
2281
2003
|
const ret = arg0.wasClean;
|
|
2282
2004
|
return ret;
|
|
2283
2005
|
},
|
|
2284
|
-
__wbg_wasmruntime_new: function(arg0) {
|
|
2285
|
-
const ret = WasmRuntime.__wrap(arg0);
|
|
2286
|
-
return ret;
|
|
2287
|
-
},
|
|
2288
2006
|
__wbg_write_726121caffd5fc3e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
2289
2007
|
const ret = arg0.write(getArrayU8FromWasm0(arg1, arg2), arg3);
|
|
2290
2008
|
return ret;
|
|
2291
2009
|
}, arguments); },
|
|
2292
2010
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2293
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2011
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 3372, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2294
2012
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h656199c36535c3e6);
|
|
2295
2013
|
return ret;
|
|
2296
2014
|
},
|
|
2297
2015
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2298
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2016
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 610, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2299
2017
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d);
|
|
2300
2018
|
return ret;
|
|
2301
2019
|
},
|
|
2302
2020
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2303
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2021
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 612, ret: Externref, inner_ret: Some(Externref) }, mutable: false }) -> Externref`.
|
|
2304
2022
|
const ret = makeClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h74026c82fbbbb92b);
|
|
2305
2023
|
return ret;
|
|
2306
2024
|
},
|
|
2307
2025
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
2308
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx:
|
|
2026
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 610, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2309
2027
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__ha139c643be38e81d_3);
|
|
2310
2028
|
return ret;
|
|
2311
2029
|
},
|
|
2312
2030
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
2313
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
2031
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 987, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2314
2032
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbc8b7acec5ff03a6);
|
|
2315
2033
|
return ret;
|
|
2316
2034
|
},
|
|
2317
2035
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
2318
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2036
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1470, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2319
2037
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h03757a48b3eba690);
|
|
2320
2038
|
return ret;
|
|
2321
2039
|
},
|
|
2322
2040
|
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
2323
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2041
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 944, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2324
2042
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hcc3019a61bf91992);
|
|
2325
2043
|
return ret;
|
|
2326
2044
|
},
|
package/pkg/jazz_wasm_bg.wasm
CHANGED
|
Binary file
|