jazz-wasm 2.0.0-alpha.13 → 2.0.0-alpha.15
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 +33 -7
- package/pkg/jazz_wasm.js +77 -25
- package/pkg/jazz_wasm_bg.wasm +0 -0
package/package.json
CHANGED
package/pkg/jazz_wasm.d.ts
CHANGED
|
@@ -123,6 +123,11 @@ export class WasmRuntime {
|
|
|
123
123
|
* before the call returns, rather than being deferred to a microtask.
|
|
124
124
|
*/
|
|
125
125
|
addServer(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Phase 1 of 2-phase subscribe: allocate a handle and store query params.
|
|
128
|
+
* No compilation, no sync, no tick — just bookkeeping.
|
|
129
|
+
*/
|
|
130
|
+
createSubscription(query_json: string, session_json?: string | null, settled_tier?: string | null, options_json?: string | null): number;
|
|
126
131
|
/**
|
|
127
132
|
* Delete a row by ObjectId.
|
|
128
133
|
*/
|
|
@@ -131,6 +136,13 @@ export class WasmRuntime {
|
|
|
131
136
|
* Delete a row and return a Promise that resolves when the tier acks.
|
|
132
137
|
*/
|
|
133
138
|
deleteDurable(object_id: string, tier: string): Promise<any>;
|
|
139
|
+
/**
|
|
140
|
+
* Phase 2 of 2-phase subscribe: compile graph, register subscription,
|
|
141
|
+
* sync to servers, attach callback, and deliver the first delta.
|
|
142
|
+
*
|
|
143
|
+
* No-ops silently if the handle was already unsubscribed.
|
|
144
|
+
*/
|
|
145
|
+
executeSubscription(handle: number, on_update: Function): void;
|
|
134
146
|
/**
|
|
135
147
|
* Flush all data to persistent storage (snapshot).
|
|
136
148
|
*/
|
|
@@ -151,9 +163,9 @@ export class WasmRuntime {
|
|
|
151
163
|
* Insert a row into a table.
|
|
152
164
|
*
|
|
153
165
|
* # Returns
|
|
154
|
-
* The
|
|
166
|
+
* The inserted row as `{ id, values }`.
|
|
155
167
|
*/
|
|
156
|
-
insert(table: string, values: any):
|
|
168
|
+
insert(table: string, values: any): any;
|
|
157
169
|
/**
|
|
158
170
|
* Insert a row and return a Promise that resolves when the tier acks.
|
|
159
171
|
*
|
|
@@ -172,8 +184,10 @@ export class WasmRuntime {
|
|
|
172
184
|
* * `user_branch` - User's branch name (e.g., "main")
|
|
173
185
|
* * `tier` - Optional node durability tier ("worker", "edge", "global").
|
|
174
186
|
* Set for server nodes to enable ack emission.
|
|
187
|
+
* * `use_binary_encoding` - Optional outgoing sync payload encoding mode.
|
|
188
|
+
* `Some(true)` emits postcard bytes (`Uint8Array`), otherwise JSON strings.
|
|
175
189
|
*/
|
|
176
|
-
constructor(schema_json: string, app_id: string, env: string, user_branch: string, tier?: string | null);
|
|
190
|
+
constructor(schema_json: string, app_id: string, env: string, user_branch: string, tier?: string | null, use_binary_encoding?: boolean | null);
|
|
177
191
|
/**
|
|
178
192
|
* Called by JS when a sync message arrives from the server.
|
|
179
193
|
*
|
|
@@ -200,7 +214,7 @@ export class WasmRuntime {
|
|
|
200
214
|
* Opens a single OPFS file namespace and restores state from the latest
|
|
201
215
|
* durable checkpoint.
|
|
202
216
|
*/
|
|
203
|
-
static openPersistent(schema_json: string, app_id: string, env: string, user_branch: string, db_name: string, tier
|
|
217
|
+
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>;
|
|
204
218
|
/**
|
|
205
219
|
* Execute a query and return results as a Promise.
|
|
206
220
|
*
|
|
@@ -244,6 +258,15 @@ export class WasmRuntime {
|
|
|
244
258
|
* Update a row and return a Promise that resolves when the tier acks.
|
|
245
259
|
*/
|
|
246
260
|
updateDurable(object_id: string, values: any, tier: string): Promise<any>;
|
|
261
|
+
/**
|
|
262
|
+
* Update a row by ObjectId as an explicit session principal.
|
|
263
|
+
*
|
|
264
|
+
* # Arguments
|
|
265
|
+
* * `object_id` - UUID string of target object
|
|
266
|
+
* * `values` - Partial update map (`{ columnName: Value }`)
|
|
267
|
+
* * `session_json` - Optional JSON-encoded Session used for policy checks
|
|
268
|
+
*/
|
|
269
|
+
updateWithSession(object_id: string, values: any, session_json?: string | null): void;
|
|
247
270
|
}
|
|
248
271
|
|
|
249
272
|
export function bench_get_cache_bytes(): number;
|
|
@@ -353,19 +376,21 @@ export interface InitOutput {
|
|
|
353
376
|
readonly wasmruntime___debugSeedLiveSchema: (a: number, b: number, c: number) => [number, number];
|
|
354
377
|
readonly wasmruntime_addClient: (a: number) => [number, number];
|
|
355
378
|
readonly wasmruntime_addServer: (a: number) => void;
|
|
379
|
+
readonly wasmruntime_createSubscription: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
356
380
|
readonly wasmruntime_delete: (a: number, b: number, c: number) => [number, number];
|
|
357
381
|
readonly wasmruntime_deleteDurable: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
382
|
+
readonly wasmruntime_executeSubscription: (a: number, b: number, c: any) => [number, number];
|
|
358
383
|
readonly wasmruntime_flush: (a: number) => void;
|
|
359
384
|
readonly wasmruntime_flushWal: (a: number) => void;
|
|
360
385
|
readonly wasmruntime_getSchema: (a: number) => [number, number, number];
|
|
361
386
|
readonly wasmruntime_getSchemaHash: (a: number) => [number, number];
|
|
362
|
-
readonly wasmruntime_insert: (a: number, b: number, c: number, d: any) => [number, number, number
|
|
387
|
+
readonly wasmruntime_insert: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
363
388
|
readonly wasmruntime_insertDurable: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
|
|
364
|
-
readonly wasmruntime_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
389
|
+
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];
|
|
365
390
|
readonly wasmruntime_onSyncMessageReceived: (a: number, b: any) => [number, number];
|
|
366
391
|
readonly wasmruntime_onSyncMessageReceivedFromClient: (a: number, b: number, c: number, d: any) => [number, number];
|
|
367
392
|
readonly wasmruntime_onSyncMessageToSend: (a: number, b: any) => void;
|
|
368
|
-
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) => any;
|
|
393
|
+
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;
|
|
369
394
|
readonly wasmruntime_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number];
|
|
370
395
|
readonly wasmruntime_removeServer: (a: number) => void;
|
|
371
396
|
readonly wasmruntime_setClientRole: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
@@ -373,6 +398,7 @@ export interface InitOutput {
|
|
|
373
398
|
readonly wasmruntime_unsubscribe: (a: number, b: number) => void;
|
|
374
399
|
readonly wasmruntime_update: (a: number, b: number, c: number, d: any) => [number, number];
|
|
375
400
|
readonly wasmruntime_updateDurable: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number, number];
|
|
401
|
+
readonly wasmruntime_updateWithSession: (a: number, b: number, c: number, d: any, e: number, f: number) => [number, number];
|
|
376
402
|
readonly bench_get_pin_internal_pages: () => number;
|
|
377
403
|
readonly bench_opfs_cold_random_read: (a: number, b: number) => any;
|
|
378
404
|
readonly bench_opfs_cold_sequential_read: (a: number, b: number) => any;
|
package/pkg/jazz_wasm.js
CHANGED
|
@@ -378,6 +378,30 @@ export class WasmRuntime {
|
|
|
378
378
|
addServer() {
|
|
379
379
|
wasm.wasmruntime_addServer(this.__wbg_ptr);
|
|
380
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Phase 1 of 2-phase subscribe: allocate a handle and store query params.
|
|
383
|
+
* No compilation, no sync, no tick — just bookkeeping.
|
|
384
|
+
* @param {string} query_json
|
|
385
|
+
* @param {string | null} [session_json]
|
|
386
|
+
* @param {string | null} [settled_tier]
|
|
387
|
+
* @param {string | null} [options_json]
|
|
388
|
+
* @returns {number}
|
|
389
|
+
*/
|
|
390
|
+
createSubscription(query_json, session_json, settled_tier, options_json) {
|
|
391
|
+
const ptr0 = passStringToWasm0(query_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
392
|
+
const len0 = WASM_VECTOR_LEN;
|
|
393
|
+
var ptr1 = isLikeNone(session_json) ? 0 : passStringToWasm0(session_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
394
|
+
var len1 = WASM_VECTOR_LEN;
|
|
395
|
+
var ptr2 = isLikeNone(settled_tier) ? 0 : passStringToWasm0(settled_tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
396
|
+
var len2 = WASM_VECTOR_LEN;
|
|
397
|
+
var ptr3 = isLikeNone(options_json) ? 0 : passStringToWasm0(options_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
398
|
+
var len3 = WASM_VECTOR_LEN;
|
|
399
|
+
const ret = wasm.wasmruntime_createSubscription(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
400
|
+
if (ret[2]) {
|
|
401
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
402
|
+
}
|
|
403
|
+
return ret[0];
|
|
404
|
+
}
|
|
381
405
|
/**
|
|
382
406
|
* Delete a row by ObjectId.
|
|
383
407
|
* @param {string} object_id
|
|
@@ -407,6 +431,20 @@ export class WasmRuntime {
|
|
|
407
431
|
}
|
|
408
432
|
return takeFromExternrefTable0(ret[0]);
|
|
409
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Phase 2 of 2-phase subscribe: compile graph, register subscription,
|
|
436
|
+
* sync to servers, attach callback, and deliver the first delta.
|
|
437
|
+
*
|
|
438
|
+
* No-ops silently if the handle was already unsubscribed.
|
|
439
|
+
* @param {number} handle
|
|
440
|
+
* @param {Function} on_update
|
|
441
|
+
*/
|
|
442
|
+
executeSubscription(handle, on_update) {
|
|
443
|
+
const ret = wasm.wasmruntime_executeSubscription(this.__wbg_ptr, handle, on_update);
|
|
444
|
+
if (ret[1]) {
|
|
445
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
410
448
|
/**
|
|
411
449
|
* Flush all data to persistent storage (snapshot).
|
|
412
450
|
*/
|
|
@@ -450,30 +488,19 @@ export class WasmRuntime {
|
|
|
450
488
|
* Insert a row into a table.
|
|
451
489
|
*
|
|
452
490
|
* # Returns
|
|
453
|
-
* The
|
|
491
|
+
* The inserted row as `{ id, values }`.
|
|
454
492
|
* @param {string} table
|
|
455
493
|
* @param {any} values
|
|
456
|
-
* @returns {
|
|
494
|
+
* @returns {any}
|
|
457
495
|
*/
|
|
458
496
|
insert(table, values) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const ret = wasm.wasmruntime_insert(this.__wbg_ptr, ptr0, len0, values);
|
|
465
|
-
var ptr2 = ret[0];
|
|
466
|
-
var len2 = ret[1];
|
|
467
|
-
if (ret[3]) {
|
|
468
|
-
ptr2 = 0; len2 = 0;
|
|
469
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
470
|
-
}
|
|
471
|
-
deferred3_0 = ptr2;
|
|
472
|
-
deferred3_1 = len2;
|
|
473
|
-
return getStringFromWasm0(ptr2, len2);
|
|
474
|
-
} finally {
|
|
475
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
497
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
498
|
+
const len0 = WASM_VECTOR_LEN;
|
|
499
|
+
const ret = wasm.wasmruntime_insert(this.__wbg_ptr, ptr0, len0, values);
|
|
500
|
+
if (ret[2]) {
|
|
501
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
476
502
|
}
|
|
503
|
+
return takeFromExternrefTable0(ret[0]);
|
|
477
504
|
}
|
|
478
505
|
/**
|
|
479
506
|
* Insert a row and return a Promise that resolves when the tier acks.
|
|
@@ -507,13 +534,16 @@ export class WasmRuntime {
|
|
|
507
534
|
* * `user_branch` - User's branch name (e.g., "main")
|
|
508
535
|
* * `tier` - Optional node durability tier ("worker", "edge", "global").
|
|
509
536
|
* Set for server nodes to enable ack emission.
|
|
537
|
+
* * `use_binary_encoding` - Optional outgoing sync payload encoding mode.
|
|
538
|
+
* `Some(true)` emits postcard bytes (`Uint8Array`), otherwise JSON strings.
|
|
510
539
|
* @param {string} schema_json
|
|
511
540
|
* @param {string} app_id
|
|
512
541
|
* @param {string} env
|
|
513
542
|
* @param {string} user_branch
|
|
514
543
|
* @param {string | null} [tier]
|
|
544
|
+
* @param {boolean | null} [use_binary_encoding]
|
|
515
545
|
*/
|
|
516
|
-
constructor(schema_json, app_id, env, user_branch, tier) {
|
|
546
|
+
constructor(schema_json, app_id, env, user_branch, tier, use_binary_encoding) {
|
|
517
547
|
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
518
548
|
const len0 = WASM_VECTOR_LEN;
|
|
519
549
|
const ptr1 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -524,7 +554,7 @@ export class WasmRuntime {
|
|
|
524
554
|
const len3 = WASM_VECTOR_LEN;
|
|
525
555
|
var ptr4 = isLikeNone(tier) ? 0 : passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
526
556
|
var len4 = WASM_VECTOR_LEN;
|
|
527
|
-
const ret = wasm.wasmruntime_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
557
|
+
const ret = wasm.wasmruntime_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, isLikeNone(use_binary_encoding) ? 0xFFFFFF : use_binary_encoding ? 1 : 0);
|
|
528
558
|
if (ret[2]) {
|
|
529
559
|
throw takeFromExternrefTable0(ret[1]);
|
|
530
560
|
}
|
|
@@ -580,10 +610,11 @@ export class WasmRuntime {
|
|
|
580
610
|
* @param {string} env
|
|
581
611
|
* @param {string} user_branch
|
|
582
612
|
* @param {string} db_name
|
|
583
|
-
* @param {string | null}
|
|
613
|
+
* @param {string | null | undefined} tier
|
|
614
|
+
* @param {boolean} use_binary_encoding
|
|
584
615
|
* @returns {Promise<WasmRuntime>}
|
|
585
616
|
*/
|
|
586
|
-
static openPersistent(schema_json, app_id, env, user_branch, db_name, tier) {
|
|
617
|
+
static openPersistent(schema_json, app_id, env, user_branch, db_name, tier, use_binary_encoding) {
|
|
587
618
|
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
588
619
|
const len0 = WASM_VECTOR_LEN;
|
|
589
620
|
const ptr1 = passStringToWasm0(app_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -596,7 +627,7 @@ export class WasmRuntime {
|
|
|
596
627
|
const len4 = WASM_VECTOR_LEN;
|
|
597
628
|
var ptr5 = isLikeNone(tier) ? 0 : passStringToWasm0(tier, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
598
629
|
var len5 = WASM_VECTOR_LEN;
|
|
599
|
-
const ret = wasm.wasmruntime_openPersistent(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5);
|
|
630
|
+
const ret = wasm.wasmruntime_openPersistent(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, use_binary_encoding);
|
|
600
631
|
return ret;
|
|
601
632
|
}
|
|
602
633
|
/**
|
|
@@ -720,6 +751,27 @@ export class WasmRuntime {
|
|
|
720
751
|
}
|
|
721
752
|
return takeFromExternrefTable0(ret[0]);
|
|
722
753
|
}
|
|
754
|
+
/**
|
|
755
|
+
* Update a row by ObjectId as an explicit session principal.
|
|
756
|
+
*
|
|
757
|
+
* # Arguments
|
|
758
|
+
* * `object_id` - UUID string of target object
|
|
759
|
+
* * `values` - Partial update map (`{ columnName: Value }`)
|
|
760
|
+
* * `session_json` - Optional JSON-encoded Session used for policy checks
|
|
761
|
+
* @param {string} object_id
|
|
762
|
+
* @param {any} values
|
|
763
|
+
* @param {string | null} [session_json]
|
|
764
|
+
*/
|
|
765
|
+
updateWithSession(object_id, values, session_json) {
|
|
766
|
+
const ptr0 = passStringToWasm0(object_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
767
|
+
const len0 = WASM_VECTOR_LEN;
|
|
768
|
+
var ptr1 = isLikeNone(session_json) ? 0 : passStringToWasm0(session_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
769
|
+
var len1 = WASM_VECTOR_LEN;
|
|
770
|
+
const ret = wasm.wasmruntime_updateWithSession(this.__wbg_ptr, ptr0, len0, values, ptr1, len1);
|
|
771
|
+
if (ret[1]) {
|
|
772
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
723
775
|
}
|
|
724
776
|
if (Symbol.dispose) WasmRuntime.prototype[Symbol.dispose] = WasmRuntime.prototype.free;
|
|
725
777
|
|
|
@@ -1505,7 +1557,7 @@ function __wbg_get_imports() {
|
|
|
1505
1557
|
return ret;
|
|
1506
1558
|
}, arguments); },
|
|
1507
1559
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1508
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1560
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 2423, function: Function { arguments: [Externref], shim_idx: 2424, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1509
1561
|
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hd6be7d355a1a4111, wasm_bindgen__convert__closures_____invoke__h293cf1e74083bd37);
|
|
1510
1562
|
return ret;
|
|
1511
1563
|
},
|
package/pkg/jazz_wasm_bg.wasm
CHANGED
|
Binary file
|