@perspective-dev/client 5.5.1 → 5.6.1
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 +232 -67
- package/dist/esm/perspective.node.js.map +2 -2
- 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 +5 -4
- package/dist/esm/ts-rs/ViewWindow.d.ts +5 -4
- 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/decompress.d.ts +1 -0
- package/dist/wasm/perspective-js.d.ts +97 -19
- package/dist/wasm/perspective-js.js +172 -45
- package/dist/wasm/perspective-js.wasm +0 -0
- package/dist/wasm/perspective-js.wasm.d.ts +11 -7
- package/package.json +21 -16
- 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 +14 -5
- package/src/rust/virtual_server.rs +101 -23
- 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 +5 -4
- package/src/ts/ts-rs/ViewWindow.ts +5 -4
- package/src/ts/virtual_servers/clickhouse.ts +99 -4
- package/src/ts/virtual_servers/duckdb.ts +117 -7
- package/src/ts/wasm/decompress.ts +42 -23
- package/src/ts/wasm/engine.ts +26 -35
- 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));
|
|
@@ -2082,7 +2211,7 @@ function __wbg_get_imports() {
|
|
|
2082
2211
|
const a = state0.a;
|
|
2083
2212
|
state0.a = 0;
|
|
2084
2213
|
try {
|
|
2085
|
-
return
|
|
2214
|
+
return __wasm_bindgen_func_elem_13018(a, state0.b, arg02, arg12);
|
|
2086
2215
|
} finally {
|
|
2087
2216
|
state0.a = a;
|
|
2088
2217
|
}
|
|
@@ -2161,7 +2290,7 @@ function __wbg_get_imports() {
|
|
|
2161
2290
|
const ret = Promise.resolve(getObject(arg0));
|
|
2162
2291
|
return addHeapObject(ret);
|
|
2163
2292
|
},
|
|
2164
|
-
|
|
2293
|
+
__wbg_run_312def04b15a0d44: function() {
|
|
2165
2294
|
return handleError(function(arg0, arg1) {
|
|
2166
2295
|
const ret = getObject(arg0).run(getObject(arg1));
|
|
2167
2296
|
return addHeapObject(ret);
|
|
@@ -2174,6 +2303,12 @@ function __wbg_get_imports() {
|
|
|
2174
2303
|
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
2175
2304
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
2176
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
|
+
},
|
|
2177
2312
|
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
2178
2313
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
2179
2314
|
},
|
|
@@ -2252,15 +2387,15 @@ function __wbg_get_imports() {
|
|
|
2252
2387
|
console.warn(getObject(arg0));
|
|
2253
2388
|
},
|
|
2254
2389
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2255
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2390
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1688, __wasm_bindgen_func_elem_2057);
|
|
2256
2391
|
return addHeapObject(ret);
|
|
2257
2392
|
},
|
|
2258
2393
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2259
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2394
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1688, __wasm_bindgen_func_elem_2058);
|
|
2260
2395
|
return addHeapObject(ret);
|
|
2261
2396
|
},
|
|
2262
2397
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2263
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2398
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4639, __wasm_bindgen_func_elem_4641);
|
|
2264
2399
|
return addHeapObject(ret);
|
|
2265
2400
|
},
|
|
2266
2401
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -2325,18 +2460,18 @@ function __wbg_get_imports() {
|
|
|
2325
2460
|
"./perspective-js.wasm_bg.js": import0
|
|
2326
2461
|
};
|
|
2327
2462
|
}
|
|
2328
|
-
function
|
|
2329
|
-
wasm.
|
|
2463
|
+
function __wasm_bindgen_func_elem_2058(arg0, arg1) {
|
|
2464
|
+
wasm.__wasm_bindgen_func_elem_2058(arg0, arg1);
|
|
2330
2465
|
}
|
|
2331
|
-
function
|
|
2332
|
-
const ret = wasm.
|
|
2466
|
+
function __wasm_bindgen_func_elem_2057(arg0, arg1) {
|
|
2467
|
+
const ret = wasm.__wasm_bindgen_func_elem_2057(arg0, arg1);
|
|
2333
2468
|
return takeObject(ret);
|
|
2334
2469
|
}
|
|
2335
|
-
function
|
|
2336
|
-
wasm.
|
|
2470
|
+
function __wasm_bindgen_func_elem_4641(arg0, arg1, arg2) {
|
|
2471
|
+
wasm.__wasm_bindgen_func_elem_4641(arg0, arg1, addHeapObject(arg2));
|
|
2337
2472
|
}
|
|
2338
|
-
function
|
|
2339
|
-
wasm.
|
|
2473
|
+
function __wasm_bindgen_func_elem_13018(arg0, arg1, arg2, arg3) {
|
|
2474
|
+
wasm.__wasm_bindgen_func_elem_13018(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2340
2475
|
}
|
|
2341
2476
|
var ClientFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
2342
2477
|
}, unregister: () => {
|
|
@@ -2719,7 +2854,35 @@ async function __wbg_init(module_or_path) {
|
|
|
2719
2854
|
}
|
|
2720
2855
|
|
|
2721
2856
|
// src/ts/wasm/decompress.ts
|
|
2722
|
-
|
|
2857
|
+
async function extract(input) {
|
|
2858
|
+
let bin;
|
|
2859
|
+
if (input instanceof Response) {
|
|
2860
|
+
bin = await WebAssembly.instantiateStreaming(input);
|
|
2861
|
+
} else if (typeof input === "string") {
|
|
2862
|
+
bin = await WebAssembly.instantiateStreaming(fetch(input));
|
|
2863
|
+
} else if (input instanceof ArrayBuffer) {
|
|
2864
|
+
bin = await WebAssembly.instantiate(input);
|
|
2865
|
+
} else {
|
|
2866
|
+
bin = input;
|
|
2867
|
+
}
|
|
2868
|
+
const inst = bin.instance.exports;
|
|
2869
|
+
const [payload] = WebAssembly.Module.customSections(
|
|
2870
|
+
bin.module,
|
|
2871
|
+
"psp-runtime"
|
|
2872
|
+
);
|
|
2873
|
+
const [raw_length_view] = WebAssembly.Module.customSections(
|
|
2874
|
+
bin.module,
|
|
2875
|
+
"psp-len"
|
|
2876
|
+
);
|
|
2877
|
+
const raw_length = new DataView(raw_length_view).getUint32(0, true);
|
|
2878
|
+
const ptr = inst.resize(payload.byteLength);
|
|
2879
|
+
new Uint8Array(inst.memory.buffer).set(new Uint8Array(payload), ptr);
|
|
2880
|
+
const offset = inst.compile(payload.byteLength, raw_length);
|
|
2881
|
+
return new Uint8Array(inst.memory.buffer).slice(
|
|
2882
|
+
offset,
|
|
2883
|
+
raw_length + offset
|
|
2884
|
+
);
|
|
2885
|
+
}
|
|
2723
2886
|
if (typeof WebAssembly === "undefined") {
|
|
2724
2887
|
throw new Error("WebAssembly not supported.");
|
|
2725
2888
|
}
|
|
@@ -2727,6 +2890,9 @@ async function load_wasm_stage_0(wasm2) {
|
|
|
2727
2890
|
if (wasm2 instanceof Function) {
|
|
2728
2891
|
wasm2 = await wasm2();
|
|
2729
2892
|
}
|
|
2893
|
+
if (wasm2 instanceof Promise) {
|
|
2894
|
+
wasm2 = await wasm2;
|
|
2895
|
+
}
|
|
2730
2896
|
try {
|
|
2731
2897
|
return await extract(wasm2);
|
|
2732
2898
|
} catch (e) {
|
|
@@ -2892,48 +3058,47 @@ async function convert_typed_array_to_pointer(core, array, callback) {
|
|
|
2892
3058
|
}
|
|
2893
3059
|
async function decode_api_responses(core, ptr, callback) {
|
|
2894
3060
|
const is_64 = core._psp_is_memory64();
|
|
3061
|
+
const response_ptr = is_64 ? Number(ptr) : Number(ptr) >>> 0;
|
|
2895
3062
|
const response = new DataView(
|
|
2896
3063
|
core.HEAPU8.buffer,
|
|
2897
|
-
|
|
3064
|
+
response_ptr,
|
|
2898
3065
|
is_64 ? 12 : 8
|
|
2899
3066
|
);
|
|
2900
3067
|
const num_msgs = response.getUint32(0, true);
|
|
2901
|
-
const msgs_ptr =
|
|
3068
|
+
const msgs_ptr = Number(
|
|
3069
|
+
is_64 ? response.getBigInt64(4, true) : response.getUint32(4, true)
|
|
3070
|
+
);
|
|
2902
3071
|
const messages = new DataView(
|
|
2903
3072
|
core.HEAPU8.buffer,
|
|
2904
|
-
|
|
3073
|
+
msgs_ptr,
|
|
2905
3074
|
num_msgs * (is_64 ? 16 : 12)
|
|
2906
3075
|
);
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
3076
|
+
const free = (x) => core._psp_free(is_64 ? BigInt(x) : x);
|
|
3077
|
+
const descriptors = [];
|
|
3078
|
+
for (let i = 0; i < num_msgs; i++) {
|
|
3079
|
+
descriptors.push(
|
|
3080
|
+
is_64 ? [
|
|
3081
|
+
Number(messages.getBigInt64(i * 16, true)),
|
|
2911
3082
|
messages.getInt32(i * 16 + 8, true),
|
|
2912
3083
|
messages.getInt32(i * 16 + 12, true)
|
|
2913
3084
|
] : [
|
|
2914
3085
|
messages.getUint32(i * 12, true),
|
|
2915
3086
|
messages.getUint32(i * 12 + 4, true),
|
|
2916
3087
|
messages.getInt32(i * 12 + 8, true)
|
|
2917
|
-
]
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
);
|
|
2923
|
-
|
|
2924
|
-
await callback(resp);
|
|
3088
|
+
]
|
|
3089
|
+
);
|
|
3090
|
+
}
|
|
3091
|
+
try {
|
|
3092
|
+
for (const [data_ptr, data_len, client_id] of descriptors) {
|
|
3093
|
+
const data = new Uint8Array(core.HEAPU8.buffer, data_ptr, data_len);
|
|
3094
|
+
await callback({ client_id, data });
|
|
2925
3095
|
}
|
|
2926
3096
|
} finally {
|
|
2927
|
-
for (
|
|
2928
|
-
|
|
2929
|
-
core._psp_free(data_ptr);
|
|
3097
|
+
for (const [data_ptr] of descriptors) {
|
|
3098
|
+
free(data_ptr);
|
|
2930
3099
|
}
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
);
|
|
2934
|
-
core._psp_free(
|
|
2935
|
-
is_64 ? BigInt(response.byteOffset) : response.byteOffset
|
|
2936
|
-
);
|
|
3100
|
+
free(msgs_ptr);
|
|
3101
|
+
free(response_ptr);
|
|
2937
3102
|
}
|
|
2938
3103
|
}
|
|
2939
3104
|
|