@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
|
@@ -11,6 +11,25 @@ export interface VirtualHostedTable {
|
|
|
11
11
|
limit?: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/** One expression's compile error, as reported by `tableDescribe`. */
|
|
15
|
+
export interface ExpressionError {
|
|
16
|
+
error_message: string;
|
|
17
|
+
line: number;
|
|
18
|
+
column: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The verdict of `VirtualServerHandler.tableDescribe`. */
|
|
22
|
+
export type TableDescription =
|
|
23
|
+
| {
|
|
24
|
+
expression_schema: Record<string, ColumnType>;
|
|
25
|
+
view_schema: Record<string, ColumnType>;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
expression_schema?: Record<string, ColumnType>;
|
|
29
|
+
expression_errors: Record<string, ExpressionError>;
|
|
30
|
+
}
|
|
31
|
+
| { config_error: string };
|
|
32
|
+
|
|
14
33
|
/**
|
|
15
34
|
* Handler interface that you implement to provide custom data sources.
|
|
16
35
|
*
|
|
@@ -59,11 +78,14 @@ export interface VirtualServerHandler {
|
|
|
59
78
|
config: ViewConfig,
|
|
60
79
|
): number | Promise<number>;
|
|
61
80
|
|
|
62
|
-
/**
|
|
63
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Validate a complete view config against a table and report the schema
|
|
83
|
+
* a view built from it would have, without creating one.
|
|
84
|
+
*/
|
|
85
|
+
tableDescribe(
|
|
64
86
|
tableId: string,
|
|
65
|
-
|
|
66
|
-
):
|
|
87
|
+
config: ViewConfig,
|
|
88
|
+
): TableDescription | Promise<TableDescription>;
|
|
67
89
|
|
|
68
90
|
viewGetMinMax?(
|
|
69
91
|
viewId: string,
|
|
@@ -81,6 +103,12 @@ export interface VirtualServerHandler {
|
|
|
81
103
|
tableId: string,
|
|
82
104
|
data: string | Uint8Array,
|
|
83
105
|
): void | Promise<void>;
|
|
106
|
+
viewMakeTable?(
|
|
107
|
+
viewId: string,
|
|
108
|
+
tableId: string,
|
|
109
|
+
config: ViewConfig,
|
|
110
|
+
schema?: Record<string, ColumnType>,
|
|
111
|
+
): void | Promise<void>;
|
|
84
112
|
}
|
|
85
113
|
|
|
86
114
|
|
|
@@ -373,6 +401,17 @@ export class Client {
|
|
|
373
401
|
export class GenericSQLVirtualServerModel {
|
|
374
402
|
free(): void;
|
|
375
403
|
[Symbol.dispose](): void;
|
|
404
|
+
/**
|
|
405
|
+
* Returns the SQL query that plans ONE expression against a table - for
|
|
406
|
+
* attributing a failed `expressionsDescribe` to the expressions at fault.
|
|
407
|
+
*/
|
|
408
|
+
expressionDescribe(table_id: string, expression: string): string;
|
|
409
|
+
/**
|
|
410
|
+
* Returns the SQL query that plans every expression of `config` at once
|
|
411
|
+
* against a table, one result column per expression alias, or `undefined`
|
|
412
|
+
* when the config has no expressions.
|
|
413
|
+
*/
|
|
414
|
+
expressionsDescribe(table_id: string, config: any): string;
|
|
376
415
|
/**
|
|
377
416
|
* Returns the SQL query to list all hosted tables.
|
|
378
417
|
*/
|
|
@@ -381,6 +420,13 @@ export class GenericSQLVirtualServerModel {
|
|
|
381
420
|
* Creates a new `JsDuckDBSqlBuilder` instance.
|
|
382
421
|
*/
|
|
383
422
|
constructor(args?: any | null);
|
|
423
|
+
/**
|
|
424
|
+
* Returns the SQL query that plans the view `config` would build and
|
|
425
|
+
* reports its result columns without materializing it (`split_by` folded
|
|
426
|
+
* into `group_by`, no `PIVOT`), or `undefined` when the config selects no
|
|
427
|
+
* columns.
|
|
428
|
+
*/
|
|
429
|
+
tableDescribe(table_id: string, config: any, schema: any): string;
|
|
384
430
|
/**
|
|
385
431
|
* Returns the SQL query to create a view from a table with the given
|
|
386
432
|
* configuration.
|
|
@@ -394,10 +440,6 @@ export class GenericSQLVirtualServerModel {
|
|
|
394
440
|
* Returns the SQL query to get the row count of a table.
|
|
395
441
|
*/
|
|
396
442
|
tableSize(table_id: string): string;
|
|
397
|
-
/**
|
|
398
|
-
* Returns the SQL query to validate an expression against a table.
|
|
399
|
-
*/
|
|
400
|
-
tableValidateExpression(table_id: string, expression: string): string;
|
|
401
443
|
/**
|
|
402
444
|
* Returns the SQL query to get the column count of a view.
|
|
403
445
|
*/
|
|
@@ -414,6 +456,10 @@ export class GenericSQLVirtualServerModel {
|
|
|
414
456
|
* Returns the SQL query to get the min and max values of a column.
|
|
415
457
|
*/
|
|
416
458
|
viewGetMinMax(view_id: string, column_name: string, config: any): string;
|
|
459
|
+
/**
|
|
460
|
+
* Returns the SQL query to create a table from a view.
|
|
461
|
+
*/
|
|
462
|
+
viewMakeTable(view_id: string, table_id: string, config: any, view_schema: any, schema: any): string;
|
|
417
463
|
/**
|
|
418
464
|
* Returns the SQL query to describe a view's schema.
|
|
419
465
|
*/
|
|
@@ -486,6 +532,25 @@ export class Table {
|
|
|
486
532
|
* ```
|
|
487
533
|
*/
|
|
488
534
|
delete(options?: DeleteOptions | null): Promise<void>;
|
|
535
|
+
/**
|
|
536
|
+
* Validate a complete view config against this table and report the
|
|
537
|
+
* schema a [`View`] built from it would have, WITHOUT creating one.
|
|
538
|
+
*
|
|
539
|
+
* # JavaScript Examples
|
|
540
|
+
*
|
|
541
|
+
* ```javascript
|
|
542
|
+
* const verdict = await table.describe({
|
|
543
|
+
* columns: ["Sales", "margin"],
|
|
544
|
+
* group_by: ["Region"],
|
|
545
|
+
* expressions: { margin: '"Profit" / "Sales"' },
|
|
546
|
+
* });
|
|
547
|
+
*
|
|
548
|
+
* if ("view_schema" in verdict) {
|
|
549
|
+
* const view = await table.view(config);
|
|
550
|
+
* }
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
describe(config?: ViewConfigUpdate | null): Promise<any>;
|
|
489
554
|
/**
|
|
490
555
|
* Get a copy of the [`Client`] this [`Table`] came from.
|
|
491
556
|
*/
|
|
@@ -663,13 +728,22 @@ export class View {
|
|
|
663
728
|
*/
|
|
664
729
|
collapse(row_index: number): Promise<number>;
|
|
665
730
|
/**
|
|
666
|
-
* Returns
|
|
667
|
-
*
|
|
731
|
+
* Returns this [`View`]'s column header area for `window`, transposed as
|
|
732
|
+
* `area[level][column]`.
|
|
668
733
|
*
|
|
669
734
|
* A column path shows the columns that a given cell belongs to after
|
|
670
|
-
* pivots are applied.
|
|
735
|
+
* pivots are applied. The area is rectangular with one level per
|
|
736
|
+
* `split_by` plus one: a column's split values occupy the leading levels
|
|
737
|
+
* and its name always occupies the last, so a subtotal or grand total
|
|
738
|
+
* under `split_rollup_mode: "rollup"` reads `null` at the levels it does
|
|
739
|
+
* not pivot on. Values keep their column's type - a `datetime` split value
|
|
740
|
+
* is epoch milliseconds, not text - so formatting them is the caller's
|
|
741
|
+
* choice.
|
|
742
|
+
*
|
|
743
|
+
* `window` slices the *column* axis; the number of levels does not depend
|
|
744
|
+
* on it.
|
|
671
745
|
*/
|
|
672
|
-
column_paths(window?: ColumnWindow | null): Promise<
|
|
746
|
+
column_paths(window?: ColumnWindow | null): Promise<(string | number | boolean | null)[][]>;
|
|
673
747
|
/**
|
|
674
748
|
* Delete this [`View`] and clean up all resources associated with it.
|
|
675
749
|
* [`View`] objects do not stop consuming resources or processing
|
|
@@ -935,16 +1009,19 @@ export interface InitOutput {
|
|
|
935
1009
|
readonly client_system_info: (a: number) => number;
|
|
936
1010
|
readonly client_table: (a: number, b: number, c: number) => number;
|
|
937
1011
|
readonly client_terminate: (a: number, b: number) => void;
|
|
1012
|
+
readonly genericsqlvirtualservermodel_expressionDescribe: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
1013
|
+
readonly genericsqlvirtualservermodel_expressionsDescribe: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
938
1014
|
readonly genericsqlvirtualservermodel_getHostedTables: (a: number, b: number) => void;
|
|
939
1015
|
readonly genericsqlvirtualservermodel_new: (a: number, b: number) => void;
|
|
1016
|
+
readonly genericsqlvirtualservermodel_tableDescribe: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
940
1017
|
readonly genericsqlvirtualservermodel_tableMakeView: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
941
1018
|
readonly genericsqlvirtualservermodel_tableSchema: (a: number, b: number, c: number, d: number) => void;
|
|
942
1019
|
readonly genericsqlvirtualservermodel_tableSize: (a: number, b: number, c: number, d: number) => void;
|
|
943
|
-
readonly genericsqlvirtualservermodel_tableValidateExpression: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
944
1020
|
readonly genericsqlvirtualservermodel_viewColumnSize: (a: number, b: number, c: number, d: number) => void;
|
|
945
1021
|
readonly genericsqlvirtualservermodel_viewDelete: (a: number, b: number, c: number, d: number) => void;
|
|
946
1022
|
readonly genericsqlvirtualservermodel_viewGetData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
947
1023
|
readonly genericsqlvirtualservermodel_viewGetMinMax: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1024
|
+
readonly genericsqlvirtualservermodel_viewMakeTable: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
948
1025
|
readonly genericsqlvirtualservermodel_viewSchema: (a: number, b: number, c: number, d: number) => void;
|
|
949
1026
|
readonly genericsqlvirtualservermodel_viewSize: (a: number, b: number, c: number, d: number) => void;
|
|
950
1027
|
readonly init: () => void;
|
|
@@ -955,6 +1032,7 @@ export interface InitOutput {
|
|
|
955
1032
|
readonly table_clear: (a: number) => number;
|
|
956
1033
|
readonly table_columns: (a: number) => number;
|
|
957
1034
|
readonly table_delete: (a: number, b: number) => number;
|
|
1035
|
+
readonly table_describe: (a: number, b: number) => number;
|
|
958
1036
|
readonly table_get_client: (a: number) => number;
|
|
959
1037
|
readonly table_get_index: (a: number) => number;
|
|
960
1038
|
readonly table_get_limit: (a: number) => number;
|
|
@@ -1007,12 +1085,12 @@ export interface InitOutput {
|
|
|
1007
1085
|
readonly virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
1008
1086
|
readonly virtualserver_handleRequest: (a: number, b: number, c: number) => number;
|
|
1009
1087
|
readonly virtualserver_new: (a: number, b: number) => void;
|
|
1010
|
-
readonly
|
|
1011
|
-
readonly
|
|
1012
|
-
readonly
|
|
1013
|
-
readonly
|
|
1014
|
-
readonly
|
|
1015
|
-
readonly
|
|
1088
|
+
readonly __wasm_bindgen_func_elem_1688: (a: number, b: number) => void;
|
|
1089
|
+
readonly __wasm_bindgen_func_elem_4639: (a: number, b: number) => void;
|
|
1090
|
+
readonly __wasm_bindgen_func_elem_13018: (a: number, b: number, c: number, d: number) => void;
|
|
1091
|
+
readonly __wasm_bindgen_func_elem_4641: (a: number, b: number, c: number) => void;
|
|
1092
|
+
readonly __wasm_bindgen_func_elem_2057: (a: number, b: number) => number;
|
|
1093
|
+
readonly __wasm_bindgen_func_elem_2058: (a: number, b: number) => void;
|
|
1016
1094
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1017
1095
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
1018
1096
|
readonly __wbindgen_export3: (a: number) => void;
|
|
@@ -400,6 +400,63 @@ export class GenericSQLVirtualServerModel {
|
|
|
400
400
|
const ptr = this.__destroy_into_raw();
|
|
401
401
|
wasm.__wbg_genericsqlvirtualservermodel_free(ptr, 0);
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Returns the SQL query that plans ONE expression against a table - for
|
|
405
|
+
* attributing a failed `expressionsDescribe` to the expressions at fault.
|
|
406
|
+
* @param {string} table_id
|
|
407
|
+
* @param {string} expression
|
|
408
|
+
* @returns {string}
|
|
409
|
+
*/
|
|
410
|
+
expressionDescribe(table_id, expression) {
|
|
411
|
+
try {
|
|
412
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
413
|
+
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
414
|
+
const len0 = WASM_VECTOR_LEN;
|
|
415
|
+
const ptr1 = passStringToWasm0(expression, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
416
|
+
const len1 = WASM_VECTOR_LEN;
|
|
417
|
+
wasm.genericsqlvirtualservermodel_expressionDescribe(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
418
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
419
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
420
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
421
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
422
|
+
if (r3) {
|
|
423
|
+
throw takeObject(r2);
|
|
424
|
+
}
|
|
425
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
426
|
+
if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
|
|
427
|
+
return v3;
|
|
428
|
+
} finally {
|
|
429
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Returns the SQL query that plans every expression of `config` at once
|
|
434
|
+
* against a table, one result column per expression alias, or `undefined`
|
|
435
|
+
* when the config has no expressions.
|
|
436
|
+
* @param {string} table_id
|
|
437
|
+
* @param {any} config
|
|
438
|
+
* @returns {string}
|
|
439
|
+
*/
|
|
440
|
+
expressionsDescribe(table_id, config) {
|
|
441
|
+
try {
|
|
442
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
443
|
+
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
444
|
+
const len0 = WASM_VECTOR_LEN;
|
|
445
|
+
wasm.genericsqlvirtualservermodel_expressionsDescribe(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(config));
|
|
446
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
447
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
448
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
449
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
450
|
+
if (r3) {
|
|
451
|
+
throw takeObject(r2);
|
|
452
|
+
}
|
|
453
|
+
var v2 = getCachedStringFromWasm0(r0, r1);
|
|
454
|
+
if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
|
|
455
|
+
return v2;
|
|
456
|
+
} finally {
|
|
457
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
403
460
|
/**
|
|
404
461
|
* Returns the SQL query to list all hosted tables.
|
|
405
462
|
* @returns {string}
|
|
@@ -444,22 +501,21 @@ export class GenericSQLVirtualServerModel {
|
|
|
444
501
|
}
|
|
445
502
|
}
|
|
446
503
|
/**
|
|
447
|
-
* Returns the SQL query
|
|
448
|
-
*
|
|
504
|
+
* Returns the SQL query that plans the view `config` would build and
|
|
505
|
+
* reports its result columns without materializing it (`split_by` folded
|
|
506
|
+
* into `group_by`, no `PIVOT`), or `undefined` when the config selects no
|
|
507
|
+
* columns.
|
|
449
508
|
* @param {string} table_id
|
|
450
|
-
* @param {string} view_id
|
|
451
509
|
* @param {any} config
|
|
452
510
|
* @param {any} schema
|
|
453
511
|
* @returns {string}
|
|
454
512
|
*/
|
|
455
|
-
|
|
513
|
+
tableDescribe(table_id, config, schema) {
|
|
456
514
|
try {
|
|
457
515
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
458
516
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
459
517
|
const len0 = WASM_VECTOR_LEN;
|
|
460
|
-
|
|
461
|
-
const len1 = WASM_VECTOR_LEN;
|
|
462
|
-
wasm.genericsqlvirtualservermodel_tableMakeView(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config), addHeapObject(schema));
|
|
518
|
+
wasm.genericsqlvirtualservermodel_tableDescribe(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(config), addHeapObject(schema));
|
|
463
519
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
464
520
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
465
521
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -467,24 +523,30 @@ export class GenericSQLVirtualServerModel {
|
|
|
467
523
|
if (r3) {
|
|
468
524
|
throw takeObject(r2);
|
|
469
525
|
}
|
|
470
|
-
var
|
|
526
|
+
var v2 = getCachedStringFromWasm0(r0, r1);
|
|
471
527
|
if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
|
|
472
|
-
return
|
|
528
|
+
return v2;
|
|
473
529
|
} finally {
|
|
474
530
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
475
531
|
}
|
|
476
532
|
}
|
|
477
533
|
/**
|
|
478
|
-
* Returns the SQL query to
|
|
534
|
+
* Returns the SQL query to create a view from a table with the given
|
|
535
|
+
* configuration.
|
|
479
536
|
* @param {string} table_id
|
|
537
|
+
* @param {string} view_id
|
|
538
|
+
* @param {any} config
|
|
539
|
+
* @param {any} schema
|
|
480
540
|
* @returns {string}
|
|
481
541
|
*/
|
|
482
|
-
|
|
542
|
+
tableMakeView(table_id, view_id, config, schema) {
|
|
483
543
|
try {
|
|
484
544
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
485
545
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
486
546
|
const len0 = WASM_VECTOR_LEN;
|
|
487
|
-
|
|
547
|
+
const ptr1 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
548
|
+
const len1 = WASM_VECTOR_LEN;
|
|
549
|
+
wasm.genericsqlvirtualservermodel_tableMakeView(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config), addHeapObject(schema));
|
|
488
550
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
489
551
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
490
552
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -492,24 +554,24 @@ export class GenericSQLVirtualServerModel {
|
|
|
492
554
|
if (r3) {
|
|
493
555
|
throw takeObject(r2);
|
|
494
556
|
}
|
|
495
|
-
var
|
|
557
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
496
558
|
if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
|
|
497
|
-
return
|
|
559
|
+
return v3;
|
|
498
560
|
} finally {
|
|
499
561
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
500
562
|
}
|
|
501
563
|
}
|
|
502
564
|
/**
|
|
503
|
-
* Returns the SQL query to
|
|
565
|
+
* Returns the SQL query to describe a table's schema.
|
|
504
566
|
* @param {string} table_id
|
|
505
567
|
* @returns {string}
|
|
506
568
|
*/
|
|
507
|
-
|
|
569
|
+
tableSchema(table_id) {
|
|
508
570
|
try {
|
|
509
571
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
510
572
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
511
573
|
const len0 = WASM_VECTOR_LEN;
|
|
512
|
-
wasm.
|
|
574
|
+
wasm.genericsqlvirtualservermodel_tableSchema(retptr, this.__wbg_ptr, ptr0, len0);
|
|
513
575
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
514
576
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
515
577
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -525,19 +587,16 @@ export class GenericSQLVirtualServerModel {
|
|
|
525
587
|
}
|
|
526
588
|
}
|
|
527
589
|
/**
|
|
528
|
-
* Returns the SQL query to
|
|
590
|
+
* Returns the SQL query to get the row count of a table.
|
|
529
591
|
* @param {string} table_id
|
|
530
|
-
* @param {string} expression
|
|
531
592
|
* @returns {string}
|
|
532
593
|
*/
|
|
533
|
-
|
|
594
|
+
tableSize(table_id) {
|
|
534
595
|
try {
|
|
535
596
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
536
597
|
const ptr0 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
537
598
|
const len0 = WASM_VECTOR_LEN;
|
|
538
|
-
|
|
539
|
-
const len1 = WASM_VECTOR_LEN;
|
|
540
|
-
wasm.genericsqlvirtualservermodel_tableValidateExpression(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
599
|
+
wasm.genericsqlvirtualservermodel_tableSize(retptr, this.__wbg_ptr, ptr0, len0);
|
|
541
600
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
542
601
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
543
602
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -545,9 +604,9 @@ export class GenericSQLVirtualServerModel {
|
|
|
545
604
|
if (r3) {
|
|
546
605
|
throw takeObject(r2);
|
|
547
606
|
}
|
|
548
|
-
var
|
|
607
|
+
var v2 = getCachedStringFromWasm0(r0, r1);
|
|
549
608
|
if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
|
|
550
|
-
return
|
|
609
|
+
return v2;
|
|
551
610
|
} finally {
|
|
552
611
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
553
612
|
}
|
|
@@ -659,6 +718,37 @@ export class GenericSQLVirtualServerModel {
|
|
|
659
718
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
660
719
|
}
|
|
661
720
|
}
|
|
721
|
+
/**
|
|
722
|
+
* Returns the SQL query to create a table from a view.
|
|
723
|
+
* @param {string} view_id
|
|
724
|
+
* @param {string} table_id
|
|
725
|
+
* @param {any} config
|
|
726
|
+
* @param {any} view_schema
|
|
727
|
+
* @param {any} schema
|
|
728
|
+
* @returns {string}
|
|
729
|
+
*/
|
|
730
|
+
viewMakeTable(view_id, table_id, config, view_schema, schema) {
|
|
731
|
+
try {
|
|
732
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
733
|
+
const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
734
|
+
const len0 = WASM_VECTOR_LEN;
|
|
735
|
+
const ptr1 = passStringToWasm0(table_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
736
|
+
const len1 = WASM_VECTOR_LEN;
|
|
737
|
+
wasm.genericsqlvirtualservermodel_viewMakeTable(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config), addHeapObject(view_schema), addHeapObject(schema));
|
|
738
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
739
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
740
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
741
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
742
|
+
if (r3) {
|
|
743
|
+
throw takeObject(r2);
|
|
744
|
+
}
|
|
745
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
746
|
+
if (r0 !== 0) { wasm.__wbindgen_export4(r0, r1, 1); }
|
|
747
|
+
return v3;
|
|
748
|
+
} finally {
|
|
749
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
662
752
|
/**
|
|
663
753
|
* Returns the SQL query to describe a view's schema.
|
|
664
754
|
* @param {string} view_id
|
|
@@ -861,6 +951,30 @@ export class Table {
|
|
|
861
951
|
const ret = wasm.table_delete(ptr, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
862
952
|
return takeObject(ret);
|
|
863
953
|
}
|
|
954
|
+
/**
|
|
955
|
+
* Validate a complete view config against this table and report the
|
|
956
|
+
* schema a [`View`] built from it would have, WITHOUT creating one.
|
|
957
|
+
*
|
|
958
|
+
* # JavaScript Examples
|
|
959
|
+
*
|
|
960
|
+
* ```javascript
|
|
961
|
+
* const verdict = await table.describe({
|
|
962
|
+
* columns: ["Sales", "margin"],
|
|
963
|
+
* group_by: ["Region"],
|
|
964
|
+
* expressions: { margin: '"Profit" / "Sales"' },
|
|
965
|
+
* });
|
|
966
|
+
*
|
|
967
|
+
* if ("view_schema" in verdict) {
|
|
968
|
+
* const view = await table.view(config);
|
|
969
|
+
* }
|
|
970
|
+
* ```
|
|
971
|
+
* @param {ViewConfigUpdate | null} [config]
|
|
972
|
+
* @returns {Promise<any>}
|
|
973
|
+
*/
|
|
974
|
+
describe(config) {
|
|
975
|
+
const ret = wasm.table_describe(this.__wbg_ptr, isLikeNone(config) ? 0 : addHeapObject(config));
|
|
976
|
+
return takeObject(ret);
|
|
977
|
+
}
|
|
864
978
|
/**
|
|
865
979
|
* Get a copy of the [`Client`] this [`Table`] came from.
|
|
866
980
|
* @returns {Promise<Client>}
|
|
@@ -1151,13 +1265,22 @@ export class View {
|
|
|
1151
1265
|
return takeObject(ret);
|
|
1152
1266
|
}
|
|
1153
1267
|
/**
|
|
1154
|
-
* Returns
|
|
1155
|
-
*
|
|
1268
|
+
* Returns this [`View`]'s column header area for `window`, transposed as
|
|
1269
|
+
* `area[level][column]`.
|
|
1156
1270
|
*
|
|
1157
1271
|
* A column path shows the columns that a given cell belongs to after
|
|
1158
|
-
* pivots are applied.
|
|
1272
|
+
* pivots are applied. The area is rectangular with one level per
|
|
1273
|
+
* `split_by` plus one: a column's split values occupy the leading levels
|
|
1274
|
+
* and its name always occupies the last, so a subtotal or grand total
|
|
1275
|
+
* under `split_rollup_mode: "rollup"` reads `null` at the levels it does
|
|
1276
|
+
* not pivot on. Values keep their column's type - a `datetime` split value
|
|
1277
|
+
* is epoch milliseconds, not text - so formatting them is the caller's
|
|
1278
|
+
* choice.
|
|
1279
|
+
*
|
|
1280
|
+
* `window` slices the *column* axis; the number of levels does not depend
|
|
1281
|
+
* on it.
|
|
1159
1282
|
* @param {ColumnWindow | null} [window]
|
|
1160
|
-
* @returns {
|
|
1283
|
+
* @returns {(string | number | boolean | null)[][]}
|
|
1161
1284
|
*/
|
|
1162
1285
|
column_paths(window) {
|
|
1163
1286
|
const ret = wasm.view_column_paths(this.__wbg_ptr, isLikeNone(window) ? 0 : addHeapObject(window));
|
|
@@ -2063,7 +2186,7 @@ function __wbg_get_imports() {
|
|
|
2063
2186
|
const a = state0.a;
|
|
2064
2187
|
state0.a = 0;
|
|
2065
2188
|
try {
|
|
2066
|
-
return
|
|
2189
|
+
return __wasm_bindgen_func_elem_13018(a, state0.b, arg0, arg1);
|
|
2067
2190
|
} finally {
|
|
2068
2191
|
state0.a = a;
|
|
2069
2192
|
}
|
|
@@ -2138,7 +2261,7 @@ function __wbg_get_imports() {
|
|
|
2138
2261
|
const ret = Promise.resolve(getObject(arg0));
|
|
2139
2262
|
return addHeapObject(ret);
|
|
2140
2263
|
},
|
|
2141
|
-
|
|
2264
|
+
__wbg_run_312def04b15a0d44: function() { return handleError(function (arg0, arg1) {
|
|
2142
2265
|
const ret = getObject(arg0).run(getObject(arg1));
|
|
2143
2266
|
return addHeapObject(ret);
|
|
2144
2267
|
}, arguments); },
|
|
@@ -2149,6 +2272,10 @@ function __wbg_get_imports() {
|
|
|
2149
2272
|
__wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {
|
|
2150
2273
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
2151
2274
|
},
|
|
2275
|
+
__wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2276
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
2277
|
+
return ret;
|
|
2278
|
+
}, arguments); },
|
|
2152
2279
|
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
2153
2280
|
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
2154
2281
|
},
|
|
@@ -2225,18 +2352,18 @@ function __wbg_get_imports() {
|
|
|
2225
2352
|
console.warn(getObject(arg0));
|
|
2226
2353
|
},
|
|
2227
2354
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2228
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 12, function: Function { arguments: [], shim_idx:
|
|
2229
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2355
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 12, function: Function { arguments: [], shim_idx: 34, ret: NamedExternref("Promise<any>"), inner_ret: Some(NamedExternref("Promise<any>")) }, mutable: false }) -> Externref`.
|
|
2356
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1688, __wasm_bindgen_func_elem_2057);
|
|
2230
2357
|
return addHeapObject(ret);
|
|
2231
2358
|
},
|
|
2232
2359
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2233
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 12, function: Function { arguments: [], shim_idx:
|
|
2234
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2360
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 12, function: Function { arguments: [], shim_idx: 35, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
2361
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_1688, __wasm_bindgen_func_elem_2058);
|
|
2235
2362
|
return addHeapObject(ret);
|
|
2236
2363
|
},
|
|
2237
2364
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
2238
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
2239
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2365
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 622, function: Function { arguments: [Externref], shim_idx: 623, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2366
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4639, __wasm_bindgen_func_elem_4641);
|
|
2240
2367
|
return addHeapObject(ret);
|
|
2241
2368
|
},
|
|
2242
2369
|
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
@@ -2313,21 +2440,21 @@ function __wbg_get_imports() {
|
|
|
2313
2440
|
};
|
|
2314
2441
|
}
|
|
2315
2442
|
|
|
2316
|
-
function
|
|
2317
|
-
wasm.
|
|
2443
|
+
function __wasm_bindgen_func_elem_2058(arg0, arg1) {
|
|
2444
|
+
wasm.__wasm_bindgen_func_elem_2058(arg0, arg1);
|
|
2318
2445
|
}
|
|
2319
2446
|
|
|
2320
|
-
function
|
|
2321
|
-
const ret = wasm.
|
|
2447
|
+
function __wasm_bindgen_func_elem_2057(arg0, arg1) {
|
|
2448
|
+
const ret = wasm.__wasm_bindgen_func_elem_2057(arg0, arg1);
|
|
2322
2449
|
return takeObject(ret);
|
|
2323
2450
|
}
|
|
2324
2451
|
|
|
2325
|
-
function
|
|
2326
|
-
wasm.
|
|
2452
|
+
function __wasm_bindgen_func_elem_4641(arg0, arg1, arg2) {
|
|
2453
|
+
wasm.__wasm_bindgen_func_elem_4641(arg0, arg1, addHeapObject(arg2));
|
|
2327
2454
|
}
|
|
2328
2455
|
|
|
2329
|
-
function
|
|
2330
|
-
wasm.
|
|
2456
|
+
function __wasm_bindgen_func_elem_13018(arg0, arg1, arg2, arg3) {
|
|
2457
|
+
wasm.__wasm_bindgen_func_elem_13018(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2331
2458
|
}
|
|
2332
2459
|
|
|
2333
2460
|
const ClientFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
Binary file
|
|
@@ -23,16 +23,19 @@ export const client_remove_hosted_tables_update: (a: number, b: number) => numbe
|
|
|
23
23
|
export const client_system_info: (a: number) => number;
|
|
24
24
|
export const client_table: (a: number, b: number, c: number) => number;
|
|
25
25
|
export const client_terminate: (a: number, b: number) => void;
|
|
26
|
+
export const genericsqlvirtualservermodel_expressionDescribe: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
27
|
+
export const genericsqlvirtualservermodel_expressionsDescribe: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
26
28
|
export const genericsqlvirtualservermodel_getHostedTables: (a: number, b: number) => void;
|
|
27
29
|
export const genericsqlvirtualservermodel_new: (a: number, b: number) => void;
|
|
30
|
+
export const genericsqlvirtualservermodel_tableDescribe: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
28
31
|
export const genericsqlvirtualservermodel_tableMakeView: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
29
32
|
export const genericsqlvirtualservermodel_tableSchema: (a: number, b: number, c: number, d: number) => void;
|
|
30
33
|
export const genericsqlvirtualservermodel_tableSize: (a: number, b: number, c: number, d: number) => void;
|
|
31
|
-
export const genericsqlvirtualservermodel_tableValidateExpression: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
32
34
|
export const genericsqlvirtualservermodel_viewColumnSize: (a: number, b: number, c: number, d: number) => void;
|
|
33
35
|
export const genericsqlvirtualservermodel_viewDelete: (a: number, b: number, c: number, d: number) => void;
|
|
34
36
|
export const genericsqlvirtualservermodel_viewGetData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
35
37
|
export const genericsqlvirtualservermodel_viewGetMinMax: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
38
|
+
export const genericsqlvirtualservermodel_viewMakeTable: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
36
39
|
export const genericsqlvirtualservermodel_viewSchema: (a: number, b: number, c: number, d: number) => void;
|
|
37
40
|
export const genericsqlvirtualservermodel_viewSize: (a: number, b: number, c: number, d: number) => void;
|
|
38
41
|
export const init: () => void;
|
|
@@ -43,6 +46,7 @@ export const table___getClassname: (a: number, b: number) => void;
|
|
|
43
46
|
export const table_clear: (a: number) => number;
|
|
44
47
|
export const table_columns: (a: number) => number;
|
|
45
48
|
export const table_delete: (a: number, b: number) => number;
|
|
49
|
+
export const table_describe: (a: number, b: number) => number;
|
|
46
50
|
export const table_get_client: (a: number) => number;
|
|
47
51
|
export const table_get_index: (a: number) => number;
|
|
48
52
|
export const table_get_limit: (a: number) => number;
|
|
@@ -95,12 +99,12 @@ export const virtualdataslice_setIntegerCol: (a: number, b: number, c: number, d
|
|
|
95
99
|
export const virtualdataslice_setStringCol: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
96
100
|
export const virtualserver_handleRequest: (a: number, b: number, c: number) => number;
|
|
97
101
|
export const virtualserver_new: (a: number, b: number) => void;
|
|
98
|
-
export const
|
|
99
|
-
export const
|
|
100
|
-
export const
|
|
101
|
-
export const
|
|
102
|
-
export const
|
|
103
|
-
export const
|
|
102
|
+
export const __wasm_bindgen_func_elem_1688: (a: number, b: number) => void;
|
|
103
|
+
export const __wasm_bindgen_func_elem_4639: (a: number, b: number) => void;
|
|
104
|
+
export const __wasm_bindgen_func_elem_13018: (a: number, b: number, c: number, d: number) => void;
|
|
105
|
+
export const __wasm_bindgen_func_elem_4641: (a: number, b: number, c: number) => void;
|
|
106
|
+
export const __wasm_bindgen_func_elem_2057: (a: number, b: number) => number;
|
|
107
|
+
export const __wasm_bindgen_func_elem_2058: (a: number, b: number) => void;
|
|
104
108
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
105
109
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
106
110
|
export const __wbindgen_export3: (a: number) => void;
|