@perspective-dev/client 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -2
- package/dist/cdn/perspective-server.worker.js +1 -1
- package/dist/cdn/perspective-server.worker.js.map +3 -3
- package/dist/cdn/perspective.js +2 -2
- package/dist/cdn/perspective.js.map +4 -4
- package/dist/esm/perspective.js +2 -2
- package/dist/esm/perspective.js.map +4 -4
- package/dist/esm/perspective.node.js +254 -70
- package/dist/esm/perspective.node.js.map +3 -3
- package/dist/esm/ts-rs/Features.d.ts +5 -0
- package/dist/esm/ts-rs/TableInitOptions.d.ts +8 -0
- package/dist/esm/ts-rs/TypedArrayWindow.d.ts +8 -6
- package/dist/esm/ts-rs/ViewWindow.d.ts +8 -6
- package/dist/esm/virtual_servers/clickhouse.js +1 -1
- package/dist/esm/virtual_servers/clickhouse.js.map +3 -3
- package/dist/esm/virtual_servers/duckdb.d.ts +7 -1
- package/dist/esm/virtual_servers/duckdb.js +1 -1
- package/dist/esm/virtual_servers/duckdb.js.map +3 -3
- package/dist/esm/wasm/emscripten_api.d.ts +1 -0
- package/dist/wasm/perspective-js.d.ts +108 -19
- package/dist/wasm/perspective-js.js +183 -45
- package/dist/wasm/perspective-js.wasm +0 -0
- package/dist/wasm/perspective-js.wasm.d.ts +11 -7
- package/package.json +22 -17
- package/src/rust/client.rs +2 -1
- package/src/rust/generic_sql_model.rs +70 -6
- package/src/rust/table.rs +33 -1
- package/src/rust/view.rs +25 -5
- package/src/rust/virtual_server.rs +101 -23
- package/src/ts/perspective.node.ts +1 -0
- package/src/ts/ts-rs/Features.ts +6 -1
- package/src/ts/ts-rs/TableInitOptions.ts +7 -1
- package/src/ts/ts-rs/TypedArrayWindow.ts +8 -6
- package/src/ts/ts-rs/ViewWindow.ts +8 -6
- package/src/ts/virtual_servers/clickhouse.ts +99 -4
- package/src/ts/virtual_servers/duckdb.ts +116 -6
- package/src/ts/wasm/emscripten_api.ts +3 -0
- package/src/ts/wasm/engine.ts +26 -35
- package/src/ts/wasm/perspective-server.poly.ts +49 -3
- package/dist/esm/perspective.inline.js +0 -3
- package/dist/esm/perspective.inline.js.map +0 -7
- package/src/ts/perspective.inline.ts +0 -27
|
@@ -395,6 +395,67 @@ var GenericSQLVirtualServerModel = class {
|
|
|
395
395
|
const ptr = this.__destroy_into_raw();
|
|
396
396
|
wasm.__wbg_genericsqlvirtualservermodel_free(ptr, 0);
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Returns the SQL query that plans ONE expression against a table - for
|
|
400
|
+
* attributing a failed `expressionsDescribe` to the expressions at fault.
|
|
401
|
+
* @param {string} table_id
|
|
402
|
+
* @param {string} expression
|
|
403
|
+
* @returns {string}
|
|
404
|
+
*/
|
|
405
|
+
expressionDescribe(table_id, expression) {
|
|
406
|
+
try {
|
|
407
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
408
|
+
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
409
|
+
const len0 = WASM_VECTOR_LEN;
|
|
410
|
+
const ptr1 = passStringToWasm0(expression, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
411
|
+
const len1 = WASM_VECTOR_LEN;
|
|
412
|
+
wasm.genericsqlvirtualservermodel_expressionDescribe(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
413
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
414
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
415
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
416
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
417
|
+
if (r3) {
|
|
418
|
+
throw takeObject(r2);
|
|
419
|
+
}
|
|
420
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
421
|
+
if (r0 !== 0) {
|
|
422
|
+
wasm.__wbindgen_export4(r0, r1, 1);
|
|
423
|
+
}
|
|
424
|
+
return v3;
|
|
425
|
+
} finally {
|
|
426
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Returns the SQL query that plans every expression of `config` at once
|
|
431
|
+
* against a table, one result column per expression alias, or `undefined`
|
|
432
|
+
* when the config has no expressions.
|
|
433
|
+
* @param {string} table_id
|
|
434
|
+
* @param {any} config
|
|
435
|
+
* @returns {string}
|
|
436
|
+
*/
|
|
437
|
+
expressionsDescribe(table_id, config) {
|
|
438
|
+
try {
|
|
439
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
440
|
+
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
441
|
+
const len0 = WASM_VECTOR_LEN;
|
|
442
|
+
wasm.genericsqlvirtualservermodel_expressionsDescribe(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(config));
|
|
443
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
444
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
445
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
446
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
447
|
+
if (r3) {
|
|
448
|
+
throw takeObject(r2);
|
|
449
|
+
}
|
|
450
|
+
var v2 = getCachedStringFromWasm0(r0, r1);
|
|
451
|
+
if (r0 !== 0) {
|
|
452
|
+
wasm.__wbindgen_export4(r0, r1, 1);
|
|
453
|
+
}
|
|
454
|
+
return v2;
|
|
455
|
+
} finally {
|
|
456
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
398
459
|
/**
|
|
399
460
|
* Returns the SQL query to list all hosted tables.
|
|
400
461
|
* @returns {string}
|
|
@@ -441,22 +502,21 @@ var GenericSQLVirtualServerModel = class {
|
|
|
441
502
|
}
|
|
442
503
|
}
|
|
443
504
|
/**
|
|
444
|
-
* Returns the SQL query
|
|
445
|
-
*
|
|
505
|
+
* Returns the SQL query that plans the view `config` would build and
|
|
506
|
+
* reports its result columns without materializing it (`split_by` folded
|
|
507
|
+
* into `group_by`, no `PIVOT`), or `undefined` when the config selects no
|
|
508
|
+
* columns.
|
|
446
509
|
* @param {string} table_id
|
|
447
|
-
* @param {string} view_id
|
|
448
510
|
* @param {any} config
|
|
449
511
|
* @param {any} schema
|
|
450
512
|
* @returns {string}
|
|
451
513
|
*/
|
|
452
|
-
|
|
514
|
+
tableDescribe(table_id, config, schema) {
|
|
453
515
|
try {
|
|
454
516
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
455
517
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
456
518
|
const len0 = WASM_VECTOR_LEN;
|
|
457
|
-
|
|
458
|
-
const len1 = WASM_VECTOR_LEN;
|
|
459
|
-
wasm.genericsqlvirtualservermodel_tableMakeView(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config), addHeapObject(schema));
|
|
519
|
+
wasm.genericsqlvirtualservermodel_tableDescribe(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(config), addHeapObject(schema));
|
|
460
520
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
461
521
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
462
522
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -464,26 +524,32 @@ var GenericSQLVirtualServerModel = class {
|
|
|
464
524
|
if (r3) {
|
|
465
525
|
throw takeObject(r2);
|
|
466
526
|
}
|
|
467
|
-
var
|
|
527
|
+
var v2 = getCachedStringFromWasm0(r0, r1);
|
|
468
528
|
if (r0 !== 0) {
|
|
469
529
|
wasm.__wbindgen_export4(r0, r1, 1);
|
|
470
530
|
}
|
|
471
|
-
return
|
|
531
|
+
return v2;
|
|
472
532
|
} finally {
|
|
473
533
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
474
534
|
}
|
|
475
535
|
}
|
|
476
536
|
/**
|
|
477
|
-
* Returns the SQL query to
|
|
537
|
+
* Returns the SQL query to create a view from a table with the given
|
|
538
|
+
* configuration.
|
|
478
539
|
* @param {string} table_id
|
|
540
|
+
* @param {string} view_id
|
|
541
|
+
* @param {any} config
|
|
542
|
+
* @param {any} schema
|
|
479
543
|
* @returns {string}
|
|
480
544
|
*/
|
|
481
|
-
|
|
545
|
+
tableMakeView(table_id, view_id, config, schema) {
|
|
482
546
|
try {
|
|
483
547
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
484
548
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
485
549
|
const len0 = WASM_VECTOR_LEN;
|
|
486
|
-
|
|
550
|
+
const ptr1 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
551
|
+
const len1 = WASM_VECTOR_LEN;
|
|
552
|
+
wasm.genericsqlvirtualservermodel_tableMakeView(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config), addHeapObject(schema));
|
|
487
553
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
488
554
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
489
555
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -491,26 +557,26 @@ var GenericSQLVirtualServerModel = class {
|
|
|
491
557
|
if (r3) {
|
|
492
558
|
throw takeObject(r2);
|
|
493
559
|
}
|
|
494
|
-
var
|
|
560
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
495
561
|
if (r0 !== 0) {
|
|
496
562
|
wasm.__wbindgen_export4(r0, r1, 1);
|
|
497
563
|
}
|
|
498
|
-
return
|
|
564
|
+
return v3;
|
|
499
565
|
} finally {
|
|
500
566
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
501
567
|
}
|
|
502
568
|
}
|
|
503
569
|
/**
|
|
504
|
-
* Returns the SQL query to
|
|
570
|
+
* Returns the SQL query to describe a table's schema.
|
|
505
571
|
* @param {string} table_id
|
|
506
572
|
* @returns {string}
|
|
507
573
|
*/
|
|
508
|
-
|
|
574
|
+
tableSchema(table_id) {
|
|
509
575
|
try {
|
|
510
576
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
511
577
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
512
578
|
const len0 = WASM_VECTOR_LEN;
|
|
513
|
-
wasm.
|
|
579
|
+
wasm.genericsqlvirtualservermodel_tableSchema(retptr, this.__wbg_ptr, ptr0, len0);
|
|
514
580
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
515
581
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
516
582
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -528,19 +594,16 @@ var GenericSQLVirtualServerModel = class {
|
|
|
528
594
|
}
|
|
529
595
|
}
|
|
530
596
|
/**
|
|
531
|
-
* Returns the SQL query to
|
|
597
|
+
* Returns the SQL query to get the row count of a table.
|
|
532
598
|
* @param {string} table_id
|
|
533
|
-
* @param {string} expression
|
|
534
599
|
* @returns {string}
|
|
535
600
|
*/
|
|
536
|
-
|
|
601
|
+
tableSize(table_id) {
|
|
537
602
|
try {
|
|
538
603
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
539
604
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
540
605
|
const len0 = WASM_VECTOR_LEN;
|
|
541
|
-
|
|
542
|
-
const len1 = WASM_VECTOR_LEN;
|
|
543
|
-
wasm.genericsqlvirtualservermodel_tableValidateExpression(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
606
|
+
wasm.genericsqlvirtualservermodel_tableSize(retptr, this.__wbg_ptr, ptr0, len0);
|
|
544
607
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
545
608
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
546
609
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -548,11 +611,11 @@ var GenericSQLVirtualServerModel = class {
|
|
|
548
611
|
if (r3) {
|
|
549
612
|
throw takeObject(r2);
|
|
550
613
|
}
|
|
551
|
-
var
|
|
614
|
+
var v2 = getCachedStringFromWasm0(r0, r1);
|
|
552
615
|
if (r0 !== 0) {
|
|
553
616
|
wasm.__wbindgen_export4(r0, r1, 1);
|
|
554
617
|
}
|
|
555
|
-
return
|
|
618
|
+
return v2;
|
|
556
619
|
} finally {
|
|
557
620
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
558
621
|
}
|
|
@@ -672,6 +735,39 @@ var GenericSQLVirtualServerModel = class {
|
|
|
672
735
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
673
736
|
}
|
|
674
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Returns the SQL query to create a table from a view.
|
|
740
|
+
* @param {string} view_id
|
|
741
|
+
* @param {string} table_id
|
|
742
|
+
* @param {any} config
|
|
743
|
+
* @param {any} view_schema
|
|
744
|
+
* @param {any} schema
|
|
745
|
+
* @returns {string}
|
|
746
|
+
*/
|
|
747
|
+
viewMakeTable(view_id, table_id, config, view_schema, schema) {
|
|
748
|
+
try {
|
|
749
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
750
|
+
const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
751
|
+
const len0 = WASM_VECTOR_LEN;
|
|
752
|
+
const ptr1 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
753
|
+
const len1 = WASM_VECTOR_LEN;
|
|
754
|
+
wasm.genericsqlvirtualservermodel_viewMakeTable(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config), addHeapObject(view_schema), addHeapObject(schema));
|
|
755
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
756
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
757
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
758
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
759
|
+
if (r3) {
|
|
760
|
+
throw takeObject(r2);
|
|
761
|
+
}
|
|
762
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
763
|
+
if (r0 !== 0) {
|
|
764
|
+
wasm.__wbindgen_export4(r0, r1, 1);
|
|
765
|
+
}
|
|
766
|
+
return v3;
|
|
767
|
+
} finally {
|
|
768
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
675
771
|
/**
|
|
676
772
|
* Returns the SQL query to describe a view's schema.
|
|
677
773
|
* @param {string} view_id
|
|
@@ -878,6 +974,30 @@ var Table = class _Table {
|
|
|
878
974
|
const ret = wasm.table_delete(ptr, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
879
975
|
return takeObject(ret);
|
|
880
976
|
}
|
|
977
|
+
/**
|
|
978
|
+
* Validate a complete view config against this table and report the
|
|
979
|
+
* schema a [`View`] built from it would have, WITHOUT creating one.
|
|
980
|
+
*
|
|
981
|
+
* # JavaScript Examples
|
|
982
|
+
*
|
|
983
|
+
* ```javascript
|
|
984
|
+
* const verdict = await table.describe({
|
|
985
|
+
* columns: ["Sales", "margin"],
|
|
986
|
+
* group_by: ["Region"],
|
|
987
|
+
* expressions: { margin: '"Profit" / "Sales"' },
|
|
988
|
+
* });
|
|
989
|
+
*
|
|
990
|
+
* if ("view_schema" in verdict) {
|
|
991
|
+
* const view = await table.view(config);
|
|
992
|
+
* }
|
|
993
|
+
* ```
|
|
994
|
+
* @param {ViewConfigUpdate | null} [config]
|
|
995
|
+
* @returns {Promise<any>}
|
|
996
|
+
*/
|
|
997
|
+
describe(config) {
|
|
998
|
+
const ret = wasm.table_describe(this.__wbg_ptr, isLikeNone(config) ? 0 : addHeapObject(config));
|
|
999
|
+
return takeObject(ret);
|
|
1000
|
+
}
|
|
881
1001
|
/**
|
|
882
1002
|
* Get a copy of the [`Client`] this [`Table`] came from.
|
|
883
1003
|
* @returns {Promise<Client>}
|
|
@@ -1154,13 +1274,22 @@ var View = class _View {
|
|
|
1154
1274
|
return takeObject(ret);
|
|
1155
1275
|
}
|
|
1156
1276
|
/**
|
|
1157
|
-
* Returns
|
|
1158
|
-
*
|
|
1277
|
+
* Returns this [`View`]'s column header area for `window`, transposed as
|
|
1278
|
+
* `area[level][column]`.
|
|
1159
1279
|
*
|
|
1160
1280
|
* A column path shows the columns that a given cell belongs to after
|
|
1161
|
-
* pivots are applied.
|
|
1281
|
+
* pivots are applied. The area is rectangular with one level per
|
|
1282
|
+
* `split_by` plus one: a column's split values occupy the leading levels
|
|
1283
|
+
* and its name always occupies the last, so a subtotal or grand total
|
|
1284
|
+
* under `split_rollup_mode: "rollup"` reads `null` at the levels it does
|
|
1285
|
+
* not pivot on. Values keep their column's type - a `datetime` split value
|
|
1286
|
+
* is epoch milliseconds, not text - so formatting them is the caller's
|
|
1287
|
+
* choice.
|
|
1288
|
+
*
|
|
1289
|
+
* `window` slices the *column* axis; the number of levels does not depend
|
|
1290
|
+
* on it.
|
|
1162
1291
|
* @param {ColumnWindow | null} [window]
|
|
1163
|
-
* @returns {
|
|
1292
|
+
* @returns {(string | number | boolean | null)[][]}
|
|
1164
1293
|
*/
|
|
1165
1294
|
column_paths(window2) {
|
|
1166
1295
|
const ret = wasm.view_column_paths(this.__wbg_ptr, isLikeNone(window2) ? 0 : addHeapObject(window2));
|
|
@@ -1400,6 +1529,17 @@ var View = class _View {
|
|
|
1400
1529
|
}
|
|
1401
1530
|
/**
|
|
1402
1531
|
* Serializes a [`View`] to the Apache Arrow data format.
|
|
1532
|
+
*
|
|
1533
|
+
* # Arguments
|
|
1534
|
+
*
|
|
1535
|
+
* - `window` - a [`ViewWindow`]; its `compression` key selects Arrow IPC
|
|
1536
|
+
* body compression, `"lz4"` or `"zstd"` (uncompressed when omitted).
|
|
1537
|
+
*
|
|
1538
|
+
* # JavaScript Examples
|
|
1539
|
+
*
|
|
1540
|
+
* ```javascript
|
|
1541
|
+
* const arrow = await view.to_arrow({ compression: "zstd" });
|
|
1542
|
+
* ```
|
|
1403
1543
|
* @param {ViewWindow | null} [window]
|
|
1404
1544
|
* @returns {Promise<ArrayBuffer>}
|
|
1405
1545
|
*/
|
|
@@ -2071,7 +2211,7 @@ function __wbg_get_imports() {
|
|
|
2071
2211
|
const a = state0.a;
|
|
2072
2212
|
state0.a = 0;
|
|
2073
2213
|
try {
|
|
2074
|
-
return
|
|
2214
|
+
return __wasm_bindgen_func_elem_13017(a, state0.b, arg02, arg12);
|
|
2075
2215
|
} finally {
|
|
2076
2216
|
state0.a = a;
|
|
2077
2217
|
}
|
|
@@ -2150,7 +2290,7 @@ function __wbg_get_imports() {
|
|
|
2150
2290
|
const ret = Promise.resolve(getObject(arg0));
|
|
2151
2291
|
return addHeapObject(ret);
|
|
2152
2292
|
},
|
|
2153
|
-
|
|
2293
|
+
__wbg_run_56500aec144102b2: function() {
|
|
2154
2294
|
return handleError(function(arg0, arg1) {
|
|
2155
2295
|
const ret = getObject(arg0).run(getObject(arg1));
|
|
2156
2296
|
return addHeapObject(ret);
|
|
@@ -2163,6 +2303,12 @@ function __wbg_get_imports() {
|
|
|
2163
2303
|
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
2164
2304
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
2165
2305
|
},
|
|
2306
|
+
__wbg_set_6cb8631f80447a67: function() {
|
|
2307
|
+
return handleError(function(arg0, arg1, arg2) {
|
|
2308
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
2309
|
+
return ret;
|
|
2310
|
+
}, arguments);
|
|
2311
|
+
},
|
|
2166
2312
|
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
2167
2313
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
2168
2314
|
},
|
|
@@ -2241,15 +2387,15 @@ function __wbg_get_imports() {
|
|
|
2241
2387
|
console.warn(getObject(arg0));
|
|
2242
2388
|
},
|
|
2243
2389
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2244
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2390
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1688, __wasm_bindgen_func_elem_2057);
|
|
2245
2391
|
return addHeapObject(ret);
|
|
2246
2392
|
},
|
|
2247
2393
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2248
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2394
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1688, __wasm_bindgen_func_elem_2058);
|
|
2249
2395
|
return addHeapObject(ret);
|
|
2250
2396
|
},
|
|
2251
2397
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2252
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2398
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4639, __wasm_bindgen_func_elem_4641);
|
|
2253
2399
|
return addHeapObject(ret);
|
|
2254
2400
|
},
|
|
2255
2401
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -2314,18 +2460,18 @@ function __wbg_get_imports() {
|
|
|
2314
2460
|
"./perspective-js.wasm_bg.js": import0
|
|
2315
2461
|
};
|
|
2316
2462
|
}
|
|
2317
|
-
function
|
|
2318
|
-
wasm.
|
|
2463
|
+
function __wasm_bindgen_func_elem_2058(arg0, arg1) {
|
|
2464
|
+
wasm.__wasm_bindgen_func_elem_2058(arg0, arg1);
|
|
2319
2465
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const ret = wasm.
|
|
2466
|
+
function __wasm_bindgen_func_elem_2057(arg0, arg1) {
|
|
2467
|
+
const ret = wasm.__wasm_bindgen_func_elem_2057(arg0, arg1);
|
|
2322
2468
|
return takeObject(ret);
|
|
2323
2469
|
}
|
|
2324
|
-
function
|
|
2325
|
-
wasm.
|
|
2470
|
+
function __wasm_bindgen_func_elem_4641(arg0, arg1, arg2) {
|
|
2471
|
+
wasm.__wasm_bindgen_func_elem_4641(arg0, arg1, addHeapObject(arg2));
|
|
2326
2472
|
}
|
|
2327
|
-
function
|
|
2328
|
-
wasm.
|
|
2473
|
+
function __wasm_bindgen_func_elem_13017(arg0, arg1, arg2, arg3) {
|
|
2474
|
+
wasm.__wasm_bindgen_func_elem_13017(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2329
2475
|
}
|
|
2330
2476
|
var ClientFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
2331
2477
|
}, unregister: () => {
|
|
@@ -2881,48 +3027,47 @@ async function convert_typed_array_to_pointer(core, array, callback) {
|
|
|
2881
3027
|
}
|
|
2882
3028
|
async function decode_api_responses(core, ptr, callback) {
|
|
2883
3029
|
const is_64 = core._psp_is_memory64();
|
|
3030
|
+
const response_ptr = is_64 ? Number(ptr) : Number(ptr) >>> 0;
|
|
2884
3031
|
const response = new DataView(
|
|
2885
3032
|
core.HEAPU8.buffer,
|
|
2886
|
-
|
|
3033
|
+
response_ptr,
|
|
2887
3034
|
is_64 ? 12 : 8
|
|
2888
3035
|
);
|
|
2889
3036
|
const num_msgs = response.getUint32(0, true);
|
|
2890
|
-
const msgs_ptr =
|
|
3037
|
+
const msgs_ptr = Number(
|
|
3038
|
+
is_64 ? response.getBigInt64(4, true) : response.getUint32(4, true)
|
|
3039
|
+
);
|
|
2891
3040
|
const messages = new DataView(
|
|
2892
3041
|
core.HEAPU8.buffer,
|
|
2893
|
-
|
|
3042
|
+
msgs_ptr,
|
|
2894
3043
|
num_msgs * (is_64 ? 16 : 12)
|
|
2895
3044
|
);
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
3045
|
+
const free = (x) => core._psp_free(is_64 ? BigInt(x) : x);
|
|
3046
|
+
const descriptors = [];
|
|
3047
|
+
for (let i = 0; i < num_msgs; i++) {
|
|
3048
|
+
descriptors.push(
|
|
3049
|
+
is_64 ? [
|
|
3050
|
+
Number(messages.getBigInt64(i * 16, true)),
|
|
2900
3051
|
messages.getInt32(i * 16 + 8, true),
|
|
2901
3052
|
messages.getInt32(i * 16 + 12, true)
|
|
2902
3053
|
] : [
|
|
2903
3054
|
messages.getUint32(i * 12, true),
|
|
2904
3055
|
messages.getUint32(i * 12 + 4, true),
|
|
2905
3056
|
messages.getInt32(i * 12 + 8, true)
|
|
2906
|
-
]
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
);
|
|
2912
|
-
|
|
2913
|
-
await callback(resp);
|
|
3057
|
+
]
|
|
3058
|
+
);
|
|
3059
|
+
}
|
|
3060
|
+
try {
|
|
3061
|
+
for (const [data_ptr, data_len, client_id] of descriptors) {
|
|
3062
|
+
const data = new Uint8Array(core.HEAPU8.buffer, data_ptr, data_len);
|
|
3063
|
+
await callback({ client_id, data });
|
|
2914
3064
|
}
|
|
2915
3065
|
} finally {
|
|
2916
|
-
for (
|
|
2917
|
-
|
|
2918
|
-
core._psp_free(data_ptr);
|
|
3066
|
+
for (const [data_ptr] of descriptors) {
|
|
3067
|
+
free(data_ptr);
|
|
2919
3068
|
}
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
);
|
|
2923
|
-
core._psp_free(
|
|
2924
|
-
is_64 ? BigInt(response.byteOffset) : response.byteOffset
|
|
2925
|
-
);
|
|
3069
|
+
free(msgs_ptr);
|
|
3070
|
+
free(response_ptr);
|
|
2926
3071
|
}
|
|
2927
3072
|
}
|
|
2928
3073
|
|
|
@@ -2962,6 +3107,7 @@ async function perspective_server_poly_default(obj) {
|
|
|
2962
3107
|
return UTF8Decoder.decode(h.subarray(addr, end));
|
|
2963
3108
|
}
|
|
2964
3109
|
const disk_helpers = { heap: heap2, toAddr, readCString };
|
|
3110
|
+
const environ_entries = Object.entries(obj.env ?? {}).filter(([, value]) => typeof value === "string").map(([key, value]) => new TextEncoder().encode(`${key}=${value}\0`));
|
|
2965
3111
|
function makeOpfsBridge() {
|
|
2966
3112
|
async function opfsOpenFile(name, create) {
|
|
2967
3113
|
const parts = name.split("/").filter((s) => s.length > 0);
|
|
@@ -3124,10 +3270,45 @@ async function perspective_server_poly_default(obj) {
|
|
|
3124
3270
|
console.error("abort");
|
|
3125
3271
|
}
|
|
3126
3272
|
},
|
|
3127
|
-
environ_get(
|
|
3273
|
+
environ_get(environ, environ_buf) {
|
|
3274
|
+
const view = new DataView(wasm_memory.buffer);
|
|
3275
|
+
let entry = toAddr(environ);
|
|
3276
|
+
let cursor = toAddr(environ_buf);
|
|
3277
|
+
for (const bytes of environ_entries) {
|
|
3278
|
+
if (is_memory64) {
|
|
3279
|
+
view.setBigUint64(entry, BigInt(cursor), true);
|
|
3280
|
+
entry += 8;
|
|
3281
|
+
} else {
|
|
3282
|
+
view.setUint32(entry, cursor, true);
|
|
3283
|
+
entry += 4;
|
|
3284
|
+
}
|
|
3285
|
+
heap2().set(bytes, cursor);
|
|
3286
|
+
cursor += bytes.length;
|
|
3287
|
+
}
|
|
3128
3288
|
return 0;
|
|
3129
3289
|
},
|
|
3130
|
-
environ_sizes_get(
|
|
3290
|
+
environ_sizes_get(environ_count, environ_buf_size) {
|
|
3291
|
+
const view = new DataView(wasm_memory.buffer);
|
|
3292
|
+
const total = environ_entries.reduce((n, x2) => n + x2.length, 0);
|
|
3293
|
+
if (is_memory64) {
|
|
3294
|
+
view.setBigUint64(
|
|
3295
|
+
toAddr(environ_count),
|
|
3296
|
+
BigInt(environ_entries.length),
|
|
3297
|
+
true
|
|
3298
|
+
);
|
|
3299
|
+
view.setBigUint64(
|
|
3300
|
+
toAddr(environ_buf_size),
|
|
3301
|
+
BigInt(total),
|
|
3302
|
+
true
|
|
3303
|
+
);
|
|
3304
|
+
} else {
|
|
3305
|
+
view.setUint32(
|
|
3306
|
+
toAddr(environ_count),
|
|
3307
|
+
environ_entries.length,
|
|
3308
|
+
true
|
|
3309
|
+
);
|
|
3310
|
+
view.setUint32(toAddr(environ_buf_size), total, true);
|
|
3311
|
+
}
|
|
3131
3312
|
return 0;
|
|
3132
3313
|
},
|
|
3133
3314
|
fd_close(...args) {
|
|
@@ -3209,8 +3390,9 @@ async function perspective_server_poly_default(obj) {
|
|
|
3209
3390
|
}
|
|
3210
3391
|
const n = Number(mod.psp_residency_prepare(server));
|
|
3211
3392
|
for (let i = 0; i < n; i++) {
|
|
3393
|
+
const index = is_memory64 ? BigInt(i) : i;
|
|
3212
3394
|
const fname = readCString(
|
|
3213
|
-
mod.psp_residency_victim_fname(server,
|
|
3395
|
+
mod.psp_residency_victim_fname(server, index)
|
|
3214
3396
|
);
|
|
3215
3397
|
if (fname) {
|
|
3216
3398
|
await disk.ensureOpen(fname);
|
|
@@ -3235,6 +3417,7 @@ async function compile_perspective(wasmBinary, opts) {
|
|
|
3235
3417
|
return x;
|
|
3236
3418
|
},
|
|
3237
3419
|
make_disk_bridge: opts?.make_disk_bridge,
|
|
3420
|
+
env: opts?.env,
|
|
3238
3421
|
instantiateWasm: async (imports, receive) => {
|
|
3239
3422
|
imports["env"] = {
|
|
3240
3423
|
...imports["env"],
|
|
@@ -3456,7 +3639,8 @@ async function compile_server_module(wasm_path) {
|
|
|
3456
3639
|
const buffer = await fs.readFile(wasm_path);
|
|
3457
3640
|
const bytes = await load_wasm_stage_0(buffer.buffer);
|
|
3458
3641
|
return await compile_perspective(bytes.buffer, {
|
|
3459
|
-
make_disk_bridge: make_node_disk_bridge
|
|
3642
|
+
make_disk_bridge: make_node_disk_bridge,
|
|
3643
|
+
env: process.env
|
|
3460
3644
|
});
|
|
3461
3645
|
}
|
|
3462
3646
|
async function load_server_module() {
|