@perspective-dev/client 4.3.0 → 4.4.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/dist/cdn/perspective.js +2 -2
- package/dist/cdn/perspective.js.map +3 -3
- package/dist/esm/perspective.inline.js +2 -2
- package/dist/esm/perspective.inline.js.map +3 -3
- package/dist/esm/perspective.js +2 -2
- package/dist/esm/perspective.js.map +3 -3
- package/dist/esm/perspective.node.d.ts +10 -0
- package/dist/esm/perspective.node.js +95 -9
- package/dist/esm/perspective.node.js.map +2 -2
- package/dist/esm/ts-rs/JoinOptions.d.ts +9 -0
- package/dist/esm/ts-rs/JoinType.d.ts +1 -0
- package/dist/esm/virtual_server.d.ts +7 -0
- 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 +4 -0
- package/dist/esm/virtual_servers/duckdb.js +1 -1
- package/dist/esm/virtual_servers/duckdb.js.map +3 -3
- package/dist/wasm/perspective-js.d.ts +41 -5
- package/dist/wasm/perspective-js.js +89 -10
- package/dist/wasm/perspective-js.wasm +0 -0
- package/dist/wasm/perspective-js.wasm.d.ts +8 -5
- package/package.json +5 -5
- package/src/rust/client.rs +70 -1
- package/src/rust/generic_sql_model.rs +16 -0
- package/src/rust/lib.rs +4 -0
- package/src/rust/utils/errors.rs +4 -0
- package/src/rust/utils/futures.rs +4 -0
- package/src/rust/view.rs +13 -4
- package/src/rust/virtual_server.rs +68 -1
- package/src/ts/perspective.node.ts +18 -0
- package/src/ts/ts-rs/JoinOptions.ts +7 -0
- package/src/ts/ts-rs/JoinType.ts +3 -0
- package/src/ts/virtual_server.ts +5 -0
- package/src/ts/virtual_servers/clickhouse.ts +2 -13
- package/src/ts/virtual_servers/duckdb.ts +18 -64
|
@@ -35,6 +35,15 @@ export declare function on_hosted_tables_update(cb: () => void): Promise<number>
|
|
|
35
35
|
export declare function remove_hosted_tables_update(id: number): Promise<void>;
|
|
36
36
|
export declare function system_info(): Promise<perspective_client.SystemInfo>;
|
|
37
37
|
export declare function on_error(callback: Function): Promise<number>;
|
|
38
|
+
/**
|
|
39
|
+
* Create a read-only table from a JOIN of two source tables.
|
|
40
|
+
* @param left - The left source table (a Table instance or a table name string).
|
|
41
|
+
* @param right - The right source table (a Table instance or a table name string).
|
|
42
|
+
* @param on
|
|
43
|
+
* @param options - Optional join configuration: { join_type?: "inner"|"left"|"outer", name?: string }
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
export declare function join(left: perspective_client.Table | string, right: perspective_client.Table | string, on: string, options?: perspective_client.JoinOptions): Promise<perspective_client.Table>;
|
|
38
47
|
/**
|
|
39
48
|
* Create a table from the global Perspective instance.
|
|
40
49
|
* @param init_data
|
|
@@ -59,6 +68,7 @@ export declare function createMessageHandler(handler: virtual_server.VirtualServ
|
|
|
59
68
|
export { perspective_client as wasmModule };
|
|
60
69
|
declare const _default: {
|
|
61
70
|
table: typeof table;
|
|
71
|
+
join: typeof join;
|
|
62
72
|
websocket: typeof websocket;
|
|
63
73
|
worker: typeof worker;
|
|
64
74
|
get_hosted_table_names: typeof get_hosted_table_names;
|
|
@@ -102,6 +102,40 @@ var Client = class _Client {
|
|
|
102
102
|
const ret = wasm.client_handle_response(this.__wbg_ptr, addHeapObject(value));
|
|
103
103
|
return takeObject(ret);
|
|
104
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Creates a new read-only [`Table`] by performing an INNER JOIN on two
|
|
107
|
+
* source tables. The resulting table is reactive: when either source
|
|
108
|
+
* table is updated, the join is automatically recomputed.
|
|
109
|
+
*
|
|
110
|
+
* # Arguments
|
|
111
|
+
*
|
|
112
|
+
* - `left` - The left source table (a [`Table`] instance or a table name
|
|
113
|
+
* string).
|
|
114
|
+
* - `right` - The right source table (a [`Table`] instance or a table name
|
|
115
|
+
* string).
|
|
116
|
+
* - `on` - The column name to join on. Must exist in both tables with the
|
|
117
|
+
* same type.
|
|
118
|
+
* - `options` - Optional join configuration: `{ join_type?: "inner" |
|
|
119
|
+
* "left" | "outer", name?: string }`.
|
|
120
|
+
*
|
|
121
|
+
* # JavaScript Examples
|
|
122
|
+
*
|
|
123
|
+
* ```javascript
|
|
124
|
+
* const joined = await client.join(orders_table, products_table, "Product ID", { join_type: "left" });
|
|
125
|
+
* const joined = await client.join("orders", "products", "Product ID", { join_type: "left" });
|
|
126
|
+
* ```
|
|
127
|
+
* @param {any} left
|
|
128
|
+
* @param {any} right
|
|
129
|
+
* @param {string} on
|
|
130
|
+
* @param {JoinOptions | null} [options]
|
|
131
|
+
* @returns {Promise<Table>}
|
|
132
|
+
*/
|
|
133
|
+
join(left, right, on, options) {
|
|
134
|
+
const ptr0 = passStringToWasm0(on, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
135
|
+
const len0 = WASM_VECTOR_LEN;
|
|
136
|
+
const ret = wasm.client_join(this.__wbg_ptr, addHeapObject(left), addHeapObject(right), ptr0, len0, isLikeNone(options) ? 0 : addHeapObject(options));
|
|
137
|
+
return takeObject(ret);
|
|
138
|
+
}
|
|
105
139
|
/**
|
|
106
140
|
* @param {Function} send_request
|
|
107
141
|
* @param {Function | null} [close]
|
|
@@ -566,6 +600,37 @@ var GenericSQLVirtualServerModel = class {
|
|
|
566
600
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
567
601
|
}
|
|
568
602
|
}
|
|
603
|
+
/**
|
|
604
|
+
* Returns the SQL query to get the min and max values of a column.
|
|
605
|
+
* @param {string} view_id
|
|
606
|
+
* @param {string} column_name
|
|
607
|
+
* @param {any} config
|
|
608
|
+
* @returns {string}
|
|
609
|
+
*/
|
|
610
|
+
viewGetMinMax(view_id, column_name, config) {
|
|
611
|
+
try {
|
|
612
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
613
|
+
const ptr0 = passStringToWasm0(view_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
614
|
+
const len0 = WASM_VECTOR_LEN;
|
|
615
|
+
const ptr1 = passStringToWasm0(column_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
616
|
+
const len1 = WASM_VECTOR_LEN;
|
|
617
|
+
wasm.genericsqlvirtualservermodel_viewGetMinMax(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, addHeapObject(config));
|
|
618
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
619
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
620
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
621
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
622
|
+
if (r3) {
|
|
623
|
+
throw takeObject(r2);
|
|
624
|
+
}
|
|
625
|
+
var v3 = getCachedStringFromWasm0(r0, r1);
|
|
626
|
+
if (r0 !== 0) {
|
|
627
|
+
wasm.__wbindgen_export4(r0, r1, 1);
|
|
628
|
+
}
|
|
629
|
+
return v3;
|
|
630
|
+
} finally {
|
|
631
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
569
634
|
/**
|
|
570
635
|
* Returns the SQL query to describe a view's schema.
|
|
571
636
|
* @param {string} view_id
|
|
@@ -1326,6 +1391,22 @@ var VirtualDataSlice = class _VirtualDataSlice {
|
|
|
1326
1391
|
const ptr = this.__destroy_into_raw();
|
|
1327
1392
|
wasm.__wbg_virtualdataslice_free(ptr, 0);
|
|
1328
1393
|
}
|
|
1394
|
+
/**
|
|
1395
|
+
* @param {Uint8Array} ipc
|
|
1396
|
+
*/
|
|
1397
|
+
fromArrowIpc(ipc) {
|
|
1398
|
+
try {
|
|
1399
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1400
|
+
wasm.virtualdataslice_fromArrowIpc(retptr, this.__wbg_ptr, addHeapObject(ipc));
|
|
1401
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1402
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1403
|
+
if (r1) {
|
|
1404
|
+
throw takeObject(r0);
|
|
1405
|
+
}
|
|
1406
|
+
} finally {
|
|
1407
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1329
1410
|
/**
|
|
1330
1411
|
* @param {ViewConfigUpdate} config
|
|
1331
1412
|
*/
|
|
@@ -1867,7 +1948,7 @@ function __wbg_get_imports() {
|
|
|
1867
1948
|
const a = state0.a;
|
|
1868
1949
|
state0.a = 0;
|
|
1869
1950
|
try {
|
|
1870
|
-
return
|
|
1951
|
+
return __wasm_bindgen_func_elem_10782(a, state0.b, arg02, arg12);
|
|
1871
1952
|
} finally {
|
|
1872
1953
|
state0.a = a;
|
|
1873
1954
|
}
|
|
@@ -2027,11 +2108,11 @@ function __wbg_get_imports() {
|
|
|
2027
2108
|
console.warn(getObject(arg0));
|
|
2028
2109
|
},
|
|
2029
2110
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
2030
|
-
const ret = makeClosure(arg0, arg1, wasm.
|
|
2111
|
+
const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_838, __wasm_bindgen_func_elem_1727);
|
|
2031
2112
|
return addHeapObject(ret);
|
|
2032
2113
|
},
|
|
2033
2114
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
2034
|
-
const ret = makeMutClosure(arg0, arg1, wasm.
|
|
2115
|
+
const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_3910, __wasm_bindgen_func_elem_3927);
|
|
2035
2116
|
return addHeapObject(ret);
|
|
2036
2117
|
},
|
|
2037
2118
|
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
@@ -2080,15 +2161,15 @@ function __wbg_get_imports() {
|
|
|
2080
2161
|
"./perspective-js.wasm_bg.js": import0
|
|
2081
2162
|
};
|
|
2082
2163
|
}
|
|
2083
|
-
function
|
|
2084
|
-
const ret = wasm.
|
|
2164
|
+
function __wasm_bindgen_func_elem_1727(arg0, arg1) {
|
|
2165
|
+
const ret = wasm.__wasm_bindgen_func_elem_1727(arg0, arg1);
|
|
2085
2166
|
return takeObject(ret);
|
|
2086
2167
|
}
|
|
2087
|
-
function
|
|
2088
|
-
wasm.
|
|
2168
|
+
function __wasm_bindgen_func_elem_3927(arg0, arg1, arg2) {
|
|
2169
|
+
wasm.__wasm_bindgen_func_elem_3927(arg0, arg1, addHeapObject(arg2));
|
|
2089
2170
|
}
|
|
2090
|
-
function
|
|
2091
|
-
wasm.
|
|
2171
|
+
function __wasm_bindgen_func_elem_10782(arg0, arg1, arg2, arg3) {
|
|
2172
|
+
wasm.__wasm_bindgen_func_elem_10782(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
2092
2173
|
}
|
|
2093
2174
|
var ClientFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
|
|
2094
2175
|
}, unregister: () => {
|
|
@@ -3057,6 +3138,9 @@ function system_info() {
|
|
|
3057
3138
|
function on_error(callback) {
|
|
3058
3139
|
return SYNC_CLIENT.on_error(callback);
|
|
3059
3140
|
}
|
|
3141
|
+
function join(left, right, on, options) {
|
|
3142
|
+
return SYNC_CLIENT.join(left, right, on, options);
|
|
3143
|
+
}
|
|
3060
3144
|
function table(init_data, options) {
|
|
3061
3145
|
return SYNC_CLIENT.table(init_data, options);
|
|
3062
3146
|
}
|
|
@@ -3102,6 +3186,7 @@ function createMessageHandler2(handler) {
|
|
|
3102
3186
|
}
|
|
3103
3187
|
var perspective_node_default = {
|
|
3104
3188
|
table,
|
|
3189
|
+
join,
|
|
3105
3190
|
websocket: websocket2,
|
|
3106
3191
|
worker,
|
|
3107
3192
|
get_hosted_table_names,
|
|
@@ -3124,6 +3209,7 @@ export {
|
|
|
3124
3209
|
cwd_static_file_handler,
|
|
3125
3210
|
perspective_node_default as default,
|
|
3126
3211
|
get_hosted_table_names,
|
|
3212
|
+
join,
|
|
3127
3213
|
make_client,
|
|
3128
3214
|
make_session,
|
|
3129
3215
|
on_error,
|