@perspective-dev/client 5.6.0 → 5.7.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 +5 -1
- package/dist/cdn/perspective.js +3 -2
- package/dist/cdn/perspective.js.map +4 -4
- package/dist/esm/perspective.browser.d.ts +71 -17
- package/dist/esm/perspective.js +2 -2
- package/dist/esm/perspective.js.map +4 -4
- package/dist/esm/perspective.node.d.ts +20 -3
- package/dist/esm/perspective.node.js +694 -34
- package/dist/esm/perspective.node.js.map +4 -4
- package/dist/esm/public_types.d.ts +31 -0
- package/dist/esm/virtual_servers/clickhouse.d.ts +37 -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 +14 -9
- package/dist/esm/virtual_servers/duckdb.js +1 -1
- package/dist/esm/virtual_servers/duckdb.js.map +3 -3
- package/dist/esm/wasm/cdn.d.ts +12 -0
- package/dist/esm/wasm/decompress.d.ts +1 -0
- package/dist/esm/wasm/migrate.d.ts +40 -0
- package/dist/esm/wasm/registry.d.ts +123 -0
- package/dist/esm/wasm/registry.js +3 -0
- package/dist/esm/wasm/registry.js.map +7 -0
- package/{src/ts/ts-rs/AggSpec.ts → dist/ts-rs/AggSpec.d.ts} +1 -1
- package/{src/ts/ts-rs/Features.ts → dist/ts-rs/Features.d.ts} +16 -6
- package/{src/ts/ts-rs/Filter.ts → dist/ts-rs/Filter.d.ts} +1 -1
- package/{src/ts/ts-rs/FilterTerm.ts → dist/ts-rs/FilterTerm.d.ts} +1 -1
- package/{src/ts/ts-rs/JoinOptions.ts → dist/ts-rs/JoinOptions.d.ts} +1 -1
- package/dist/ts-rs/ListFlatten.d.ts +3 -0
- package/dist/ts-rs/MapFlatten.d.ts +3 -0
- package/{src/ts/ts-rs/OnRemoveData.ts → dist/ts-rs/OnRemoveData.d.ts} +1 -1
- package/{src/ts/ts-rs/OnUpdateData.ts → dist/ts-rs/OnUpdateData.d.ts} +1 -1
- package/{src/ts/ts-rs/OnUpdateOptions.ts → dist/ts-rs/OnUpdateOptions.d.ts} +1 -1
- package/{src/ts/ts-rs/Sort.ts → dist/ts-rs/Sort.d.ts} +1 -1
- package/dist/ts-rs/StructFlatten.d.ts +3 -0
- package/dist/ts-rs/TableIndex.d.ts +9 -0
- package/dist/ts-rs/TableInitOptions.d.ts +65 -0
- package/{src/ts/ts-rs/UpdateOptions.ts → dist/ts-rs/UpdateOptions.d.ts} +1 -1
- package/{src/ts/ts-rs/ViewConfig.ts → dist/ts-rs/ViewConfig.d.ts} +8 -8
- package/{src/ts/ts-rs/ViewConfigUpdate.ts → dist/ts-rs/ViewConfigUpdate.d.ts} +8 -8
- package/{src/ts/ts-rs/WindowAggSpec.ts → dist/ts-rs/WindowAggSpec.d.ts} +1 -1
- package/{src/ts/ts-rs/WindowSort.ts → dist/ts-rs/WindowSort.d.ts} +1 -1
- package/{src/ts/ts-rs/WindowSpec.ts → dist/ts-rs/WindowSpec.d.ts} +1 -1
- package/{src/ts/ts-rs/Windows.ts → dist/ts-rs/Windows.d.ts} +1 -1
- package/dist/wasm/perspective-js.d.ts +121 -54
- package/dist/wasm/perspective-js.js +123 -20
- package/dist/wasm/perspective-js.wasm +0 -0
- package/dist/wasm/perspective-js.wasm.d.ts +10 -6
- package/dist/wasm/perspective-migrate-js.d.ts +41 -0
- package/dist/wasm/perspective-migrate-js.js +524 -0
- package/dist/wasm/perspective-migrate-js.wasm +0 -0
- package/dist/wasm/perspective-migrate-js.wasm.d.ts +8 -0
- package/package.json +30 -15
- package/dist/esm/ts-rs/AggSpec.d.ts +0 -8
- package/dist/esm/ts-rs/Aggregate.d.ts +0 -1
- package/dist/esm/ts-rs/ColumnType.d.ts +0 -4
- package/dist/esm/ts-rs/ColumnWindow.d.ts +0 -4
- package/dist/esm/ts-rs/DeleteOptions.d.ts +0 -6
- package/dist/esm/ts-rs/Expressions.d.ts +0 -3
- package/dist/esm/ts-rs/Features.d.ts +0 -71
- package/dist/esm/ts-rs/Filter.d.ts +0 -2
- package/dist/esm/ts-rs/FilterReducer.d.ts +0 -1
- package/dist/esm/ts-rs/FilterTerm.d.ts +0 -2
- package/dist/esm/ts-rs/GroupRollupMode.d.ts +0 -1
- package/dist/esm/ts-rs/JoinOptions.d.ts +0 -9
- package/dist/esm/ts-rs/JoinType.d.ts +0 -1
- package/dist/esm/ts-rs/ListFlatten.d.ts +0 -1
- package/dist/esm/ts-rs/OnRemoveData.d.ts +0 -6
- package/dist/esm/ts-rs/OnUpdateData.d.ts +0 -6
- package/dist/esm/ts-rs/OnUpdateMode.d.ts +0 -9
- package/dist/esm/ts-rs/OnUpdateOptions.d.ts +0 -7
- package/dist/esm/ts-rs/Scalar.d.ts +0 -5
- package/dist/esm/ts-rs/Sort.d.ts +0 -2
- package/dist/esm/ts-rs/SortDir.d.ts +0 -1
- package/dist/esm/ts-rs/SplitRollupMode.d.ts +0 -9
- package/dist/esm/ts-rs/SystemInfo.d.ts +0 -40
- package/dist/esm/ts-rs/TableInitOptions.d.ts +0 -45
- package/dist/esm/ts-rs/TableReadFormat.d.ts +0 -7
- package/dist/esm/ts-rs/TypedArrayWindow.d.ts +0 -33
- package/dist/esm/ts-rs/UpdateOptions.d.ts +0 -8
- package/dist/esm/ts-rs/ViewConfig.d.ts +0 -24
- package/dist/esm/ts-rs/ViewConfigUpdate.d.ts +0 -116
- package/dist/esm/ts-rs/ViewOnRemoveResp.d.ts +0 -4
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +0 -4
- package/dist/esm/ts-rs/ViewWindow.d.ts +0 -30
- package/dist/esm/ts-rs/WindowAggSpec.d.ts +0 -25
- package/dist/esm/ts-rs/WindowSort.d.ts +0 -7
- package/dist/esm/ts-rs/WindowSortDir.d.ts +0 -6
- package/dist/esm/ts-rs/WindowSpec.d.ts +0 -47
- package/dist/esm/ts-rs/Windows.d.ts +0 -10
- package/src/rust/client.rs +0 -590
- package/src/rust/generic_sql_model.rs +0 -276
- package/src/rust/lib.rs +0 -99
- package/src/rust/table.rs +0 -397
- package/src/rust/table_data.rs +0 -164
- package/src/rust/typed_array.rs +0 -386
- package/src/rust/utils/browser.rs +0 -35
- package/src/rust/utils/console_logger.rs +0 -237
- package/src/rust/utils/errors.rs +0 -274
- package/src/rust/utils/futures.rs +0 -274
- package/src/rust/utils/json.rs +0 -252
- package/src/rust/utils/local_poll_loop.rs +0 -63
- package/src/rust/utils/mod.rs +0 -32
- package/src/rust/utils/serde.rs +0 -46
- package/src/rust/utils/trace_allocator.rs +0 -98
- package/src/rust/view.rs +0 -463
- package/src/rust/virtual_server.rs +0 -991
- package/src/ts/perspective-server.worker.ts +0 -74
- package/src/ts/perspective.browser.ts +0 -380
- package/src/ts/perspective.cdn.ts +0 -28
- package/src/ts/perspective.node.ts +0 -556
- package/src/ts/ts-rs/ListFlatten.ts +0 -3
- package/src/ts/ts-rs/TableInitOptions.ts +0 -42
- package/src/ts/virtual_server.ts +0 -83
- package/src/ts/virtual_servers/clickhouse.ts +0 -533
- package/src/ts/virtual_servers/duckdb.ts +0 -549
- package/src/ts/wasm/browser.ts +0 -134
- package/src/ts/wasm/cdn.ts +0 -32
- package/src/ts/wasm/decompress.ts +0 -64
- package/src/ts/wasm/emscripten_api.ts +0 -91
- package/src/ts/wasm/engine.ts +0 -309
- package/src/ts/wasm/features.ts +0 -31
- package/src/ts/wasm/perspective-server.poly.ts +0 -460
- package/src/ts/websocket.ts +0 -95
- package/tsconfig.json +0 -22
- /package/{src/ts/ts-rs/Aggregate.ts → dist/ts-rs/Aggregate.d.ts} +0 -0
- /package/{src/ts/ts-rs/ColumnType.ts → dist/ts-rs/ColumnType.d.ts} +0 -0
- /package/{src/ts/ts-rs/ColumnWindow.ts → dist/ts-rs/ColumnWindow.d.ts} +0 -0
- /package/{src/ts/ts-rs/DeleteOptions.ts → dist/ts-rs/DeleteOptions.d.ts} +0 -0
- /package/{src/ts/ts-rs/Expressions.ts → dist/ts-rs/Expressions.d.ts} +0 -0
- /package/{src/ts/ts-rs/FilterReducer.ts → dist/ts-rs/FilterReducer.d.ts} +0 -0
- /package/{src/ts/ts-rs/GroupRollupMode.ts → dist/ts-rs/GroupRollupMode.d.ts} +0 -0
- /package/{src/ts/ts-rs/JoinType.ts → dist/ts-rs/JoinType.d.ts} +0 -0
- /package/{src/ts/ts-rs/OnUpdateMode.ts → dist/ts-rs/OnUpdateMode.d.ts} +0 -0
- /package/{src/ts/ts-rs/Scalar.ts → dist/ts-rs/Scalar.d.ts} +0 -0
- /package/{src/ts/ts-rs/SortDir.ts → dist/ts-rs/SortDir.d.ts} +0 -0
- /package/{src/ts/ts-rs/SplitRollupMode.ts → dist/ts-rs/SplitRollupMode.d.ts} +0 -0
- /package/{src/ts/ts-rs/SystemInfo.ts → dist/ts-rs/SystemInfo.d.ts} +0 -0
- /package/{src/ts/ts-rs/TableReadFormat.ts → dist/ts-rs/TableReadFormat.d.ts} +0 -0
- /package/{src/ts/ts-rs/TypedArrayWindow.ts → dist/ts-rs/TypedArrayWindow.d.ts} +0 -0
- /package/{src/ts/ts-rs/ViewOnRemoveResp.ts → dist/ts-rs/ViewOnRemoveResp.d.ts} +0 -0
- /package/{src/ts/ts-rs/ViewOnUpdateResp.ts → dist/ts-rs/ViewOnUpdateResp.d.ts} +0 -0
- /package/{src/ts/ts-rs/ViewWindow.ts → dist/ts-rs/ViewWindow.d.ts} +0 -0
- /package/{src/ts/ts-rs/WindowSortDir.ts → dist/ts-rs/WindowSortDir.d.ts} +0 -0
|
@@ -1,549 +0,0 @@
|
|
|
1
|
-
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
-
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
-
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
-
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
-
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
-
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
-
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
-
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
-
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
-
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
-
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* An implementation of a Perspective Virtual Server for DuckDB.
|
|
15
|
-
*
|
|
16
|
-
* This import is optional, and so must be imported manually from either
|
|
17
|
-
* `@perspective-dev/client/dist/esm/virtual_servers/duckdb.js` or
|
|
18
|
-
* `@perspective-dev/client/src/ts/virtual_servers/duckdb.ts`, it is not
|
|
19
|
-
* exported from the package root `@perspective-dev/client`
|
|
20
|
-
*
|
|
21
|
-
* @module
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import type * as perspective from "@perspective-dev/client";
|
|
25
|
-
import type { ColumnType } from "@perspective-dev/client/dist/esm/ts-rs/ColumnType.d.ts";
|
|
26
|
-
import type { ViewConfig } from "@perspective-dev/client/dist/esm/ts-rs/ViewConfig.d.ts";
|
|
27
|
-
import type {
|
|
28
|
-
ExpressionError,
|
|
29
|
-
TableDescription,
|
|
30
|
-
} from "@perspective-dev/client";
|
|
31
|
-
import type { ViewConfigUpdate } from "@perspective-dev/client/dist/esm/ts-rs/ViewConfigUpdate.d.ts";
|
|
32
|
-
import type { ViewWindow } from "@perspective-dev/client/dist/esm/ts-rs/ViewWindow.d.ts";
|
|
33
|
-
import type { WindowAggSpec } from "@perspective-dev/client/dist/esm/ts-rs/WindowAggSpec.d.ts";
|
|
34
|
-
import type { Scalar } from "@perspective-dev/client/dist/esm/ts-rs/Scalar.d.ts";
|
|
35
|
-
import type * as duckdb from "@duckdb/duckdb-wasm";
|
|
36
|
-
|
|
37
|
-
const NUMBER_AGGS = [
|
|
38
|
-
"sum",
|
|
39
|
-
"count",
|
|
40
|
-
"any_value",
|
|
41
|
-
"arbitrary",
|
|
42
|
-
"array_agg",
|
|
43
|
-
"avg",
|
|
44
|
-
"bit_and",
|
|
45
|
-
"bit_or",
|
|
46
|
-
"bit_xor",
|
|
47
|
-
"bitstring_agg",
|
|
48
|
-
"bool_and",
|
|
49
|
-
"bool_or",
|
|
50
|
-
"countif",
|
|
51
|
-
"favg",
|
|
52
|
-
"fsum",
|
|
53
|
-
"geomean",
|
|
54
|
-
"kahan_sum",
|
|
55
|
-
"last",
|
|
56
|
-
"max",
|
|
57
|
-
"min",
|
|
58
|
-
"product",
|
|
59
|
-
"string_agg",
|
|
60
|
-
"sumkahan",
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
const STRING_AGGS = [
|
|
64
|
-
"count",
|
|
65
|
-
"any_value",
|
|
66
|
-
"arbitrary",
|
|
67
|
-
"first",
|
|
68
|
-
"countif",
|
|
69
|
-
"last",
|
|
70
|
-
"string_agg",
|
|
71
|
-
];
|
|
72
|
-
|
|
73
|
-
const FRAMES = ["rows", "range", "cumulative"];
|
|
74
|
-
|
|
75
|
-
const WINDOW_AGGREGATES: WindowAggSpec[] = [
|
|
76
|
-
{ name: "sum", frames: FRAMES, result_type: "float" },
|
|
77
|
-
{ name: "avg", frames: FRAMES, result_type: "float" },
|
|
78
|
-
{ name: "count", frames: FRAMES, result_type: "float" },
|
|
79
|
-
{ name: "min", frames: FRAMES },
|
|
80
|
-
{ name: "max", frames: FRAMES },
|
|
81
|
-
{ name: "product", frames: FRAMES, result_type: "float" },
|
|
82
|
-
{ name: "median", frames: FRAMES, result_type: "float" },
|
|
83
|
-
// DuckDB spells sample and population variants separately, so both are
|
|
84
|
-
// offered rather than one being picked on the user's behalf.
|
|
85
|
-
{ name: "stddev_samp", frames: FRAMES, result_type: "float" },
|
|
86
|
-
{ name: "stddev_pop", frames: FRAMES, result_type: "float" },
|
|
87
|
-
{ name: "var_samp", frames: FRAMES, result_type: "float" },
|
|
88
|
-
{ name: "var_pop", frames: FRAMES, result_type: "float" },
|
|
89
|
-
// Navigation.
|
|
90
|
-
{ name: "first_value", frames: FRAMES },
|
|
91
|
-
{ name: "last_value", frames: FRAMES },
|
|
92
|
-
{ name: "nth_value", frames: FRAMES, offset: true },
|
|
93
|
-
{ name: "lag", offset: true },
|
|
94
|
-
{ name: "lead", offset: true },
|
|
95
|
-
// Ranking. These take no source column - the window's `order_by` is their
|
|
96
|
-
// input - but Perspective requires one, so the choice of source is
|
|
97
|
-
// immaterial for them.
|
|
98
|
-
{ name: "row_number", result_type: "float" },
|
|
99
|
-
{ name: "rank", result_type: "float" },
|
|
100
|
-
{ name: "dense_rank", result_type: "float" },
|
|
101
|
-
{ name: "percent_rank", result_type: "float" },
|
|
102
|
-
{ name: "cume_dist", result_type: "float" },
|
|
103
|
-
// `ntile`'s argument is a bucket count rather than a row offset.
|
|
104
|
-
{ name: "ntile", offset: true, result_type: "float" },
|
|
105
|
-
// Perspective's own, with no DuckDB equivalent - the SQL translation
|
|
106
|
-
// synthesizes them from `lag` and `first_value`.
|
|
107
|
-
{ name: "diff", offset: true, result_type: "float" },
|
|
108
|
-
{ name: "rate", frames: ["range"], result_type: "float" },
|
|
109
|
-
];
|
|
110
|
-
|
|
111
|
-
// Arithmetic is undefined for the non-numeric types; ordering and navigation
|
|
112
|
-
// are not.
|
|
113
|
-
const WINDOW_AGGREGATES_ANY: WindowAggSpec[] = [
|
|
114
|
-
{ name: "count", frames: FRAMES, result_type: "float" },
|
|
115
|
-
{ name: "min", frames: FRAMES },
|
|
116
|
-
{ name: "max", frames: FRAMES },
|
|
117
|
-
{ name: "first_value", frames: FRAMES },
|
|
118
|
-
{ name: "last_value", frames: FRAMES },
|
|
119
|
-
{ name: "nth_value", frames: FRAMES, offset: true },
|
|
120
|
-
{ name: "lag", offset: true },
|
|
121
|
-
{ name: "lead", offset: true },
|
|
122
|
-
{ name: "row_number", result_type: "float" },
|
|
123
|
-
{ name: "rank", result_type: "float" },
|
|
124
|
-
{ name: "dense_rank", result_type: "float" },
|
|
125
|
-
{ name: "percent_rank", result_type: "float" },
|
|
126
|
-
{ name: "cume_dist", result_type: "float" },
|
|
127
|
-
{ name: "ntile", offset: true, result_type: "float" },
|
|
128
|
-
];
|
|
129
|
-
|
|
130
|
-
const FILTER_OPS = [
|
|
131
|
-
"==",
|
|
132
|
-
"!=",
|
|
133
|
-
"IS DISTINCT FROM",
|
|
134
|
-
"IS NOT DISTINCT FROM",
|
|
135
|
-
">=",
|
|
136
|
-
"<=",
|
|
137
|
-
">",
|
|
138
|
-
"<",
|
|
139
|
-
"is null",
|
|
140
|
-
"is not null",
|
|
141
|
-
];
|
|
142
|
-
|
|
143
|
-
// Perspective's canonical string ops (translated to `ILIKE` / `regexp_matches`
|
|
144
|
-
// by the SQL builder), plus DuckDB's raw infix pattern ops spliced verbatim.
|
|
145
|
-
const STRING_FILTER_OPS = [
|
|
146
|
-
...FILTER_OPS,
|
|
147
|
-
"begins with",
|
|
148
|
-
"not begins with",
|
|
149
|
-
"contains",
|
|
150
|
-
"not contains",
|
|
151
|
-
"ends with",
|
|
152
|
-
"not ends with",
|
|
153
|
-
"matches",
|
|
154
|
-
"not matches",
|
|
155
|
-
"in",
|
|
156
|
-
"not in",
|
|
157
|
-
"LIKE",
|
|
158
|
-
"NOT LIKE",
|
|
159
|
-
"ILIKE",
|
|
160
|
-
"NOT ILIKE",
|
|
161
|
-
];
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Convert a DuckDB `dtype` to a Perspective `ColumnType`.
|
|
165
|
-
*/
|
|
166
|
-
function duckdbTypeToPsp(name: string): ColumnType {
|
|
167
|
-
name = name.toLowerCase();
|
|
168
|
-
|
|
169
|
-
if (name.startsWith("bool")) {
|
|
170
|
-
return "boolean";
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// 32-bit and narrower - `coerce_column` widens these to `Int32`.
|
|
174
|
-
if (
|
|
175
|
-
["tinyint", "smallint", "integer", "utinyint", "usmallint"].includes(
|
|
176
|
-
name,
|
|
177
|
-
) ||
|
|
178
|
-
["int8", "int16", "int32", "uint8", "uint16"].includes(name)
|
|
179
|
-
) {
|
|
180
|
-
return "integer";
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Wider than `Int32`, or fractional - all coerce to `Float64`.
|
|
184
|
-
if (
|
|
185
|
-
["bigint", "hugeint", "uhugeint", "uinteger", "ubigint"].includes(
|
|
186
|
-
name,
|
|
187
|
-
) ||
|
|
188
|
-
["float", "real", "double", "varint"].includes(name) ||
|
|
189
|
-
["int64", "uint32", "uint64", "float32", "float64"].includes(name) ||
|
|
190
|
-
name.startsWith("decimal") ||
|
|
191
|
-
name.startsWith("numeric")
|
|
192
|
-
) {
|
|
193
|
-
return "float";
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (name.startsWith("date")) {
|
|
197
|
-
return "date";
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// `timestamp`, `timestamptz`, `timestamp_ns`, and `time`/`timetz`,
|
|
201
|
-
// which coerce to `Timestamp(Millisecond)` rather than to a number.
|
|
202
|
-
if (name.startsWith("time")) {
|
|
203
|
-
return "datetime";
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// Everything else renders as text: `varchar`, `enum(...)` (which
|
|
207
|
-
// arrives dictionary-encoded), `json`, `uuid`, `blob`, `interval`,
|
|
208
|
-
// and the nested types.
|
|
209
|
-
if (
|
|
210
|
-
!(
|
|
211
|
-
name.startsWith("varchar") ||
|
|
212
|
-
name === "utf8" ||
|
|
213
|
-
name.startsWith("enum") ||
|
|
214
|
-
["json", "uuid", "blob", "bit", "interval"].includes(name) ||
|
|
215
|
-
name.startsWith("struct") ||
|
|
216
|
-
name.startsWith("map") ||
|
|
217
|
-
name.startsWith("union") ||
|
|
218
|
-
name.endsWith("[]")
|
|
219
|
-
)
|
|
220
|
-
) {
|
|
221
|
-
// Unknown, not fatal - the column still renders, as text.
|
|
222
|
-
console.warn(`Unknown type '${name}'`);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return "string";
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
async function runQuery(
|
|
229
|
-
db: duckdb.AsyncDuckDBConnection,
|
|
230
|
-
query: string,
|
|
231
|
-
options: { columns: true },
|
|
232
|
-
): Promise<{
|
|
233
|
-
rows: any[];
|
|
234
|
-
columns: string[];
|
|
235
|
-
dtypes: string[];
|
|
236
|
-
}>;
|
|
237
|
-
|
|
238
|
-
async function runQuery(
|
|
239
|
-
db: duckdb.AsyncDuckDBConnection,
|
|
240
|
-
query: string,
|
|
241
|
-
options?: { columns: false },
|
|
242
|
-
): Promise<any[]>;
|
|
243
|
-
|
|
244
|
-
async function runQuery(
|
|
245
|
-
db: duckdb.AsyncDuckDBConnection,
|
|
246
|
-
query: string,
|
|
247
|
-
options: { columns?: boolean } = {},
|
|
248
|
-
) {
|
|
249
|
-
query = query.replace(/\s+/g, " ").trim();
|
|
250
|
-
try {
|
|
251
|
-
const result = await db.query(query);
|
|
252
|
-
if (options.columns) {
|
|
253
|
-
return {
|
|
254
|
-
rows: result.toArray(),
|
|
255
|
-
columns: result.schema.fields.map((f) => f.name),
|
|
256
|
-
dtypes: result.schema.fields.map((f) => f.type.toString()),
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return result.toArray();
|
|
261
|
-
} catch (error) {
|
|
262
|
-
console.error("Query error:", error);
|
|
263
|
-
console.error("Query:", query);
|
|
264
|
-
throw error;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* An implementation of Perspective's Virtual Server for `@duckdb/duckdb-wasm`.
|
|
270
|
-
*/
|
|
271
|
-
export class DuckDBHandler implements perspective.VirtualServerHandler {
|
|
272
|
-
private db: duckdb.AsyncDuckDBConnection;
|
|
273
|
-
private sqlBuilder: perspective.GenericSQLVirtualServerModel;
|
|
274
|
-
constructor(db: duckdb.AsyncDuckDBConnection, mod?: typeof perspective) {
|
|
275
|
-
if (!mod) {
|
|
276
|
-
if (customElements) {
|
|
277
|
-
const viewer_class: any =
|
|
278
|
-
customElements.get("perspective-viewer");
|
|
279
|
-
if (viewer_class) {
|
|
280
|
-
mod = viewer_class.__wasm_module__;
|
|
281
|
-
} else {
|
|
282
|
-
throw new Error("Missing perspective-client.wasm");
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
this.db = db;
|
|
289
|
-
this.sqlBuilder = new mod!.GenericSQLVirtualServerModel({
|
|
290
|
-
column_separator: "|",
|
|
291
|
-
like_escape_clause: "\\",
|
|
292
|
-
regex_fn: "regexp_matches",
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
getFeatures(): perspective.Features {
|
|
297
|
-
return {
|
|
298
|
-
group_by: true,
|
|
299
|
-
split_by: true,
|
|
300
|
-
sort: true,
|
|
301
|
-
expressions: true,
|
|
302
|
-
view_derivations: true,
|
|
303
|
-
window_aggregates: {
|
|
304
|
-
// `ema` is recursive and has no SQL window translation.
|
|
305
|
-
integer: WINDOW_AGGREGATES,
|
|
306
|
-
float: WINDOW_AGGREGATES,
|
|
307
|
-
string: WINDOW_AGGREGATES_ANY,
|
|
308
|
-
date: WINDOW_AGGREGATES_ANY,
|
|
309
|
-
datetime: WINDOW_AGGREGATES_ANY,
|
|
310
|
-
boolean: WINDOW_AGGREGATES_ANY,
|
|
311
|
-
},
|
|
312
|
-
group_rollup_mode: ["rollup", "flat", "total"],
|
|
313
|
-
split_rollup_mode: ["flat", "rollup"],
|
|
314
|
-
filter_ops: {
|
|
315
|
-
integer: FILTER_OPS,
|
|
316
|
-
float: FILTER_OPS,
|
|
317
|
-
string: STRING_FILTER_OPS,
|
|
318
|
-
boolean: FILTER_OPS,
|
|
319
|
-
date: FILTER_OPS,
|
|
320
|
-
datetime: FILTER_OPS,
|
|
321
|
-
},
|
|
322
|
-
aggregates: {
|
|
323
|
-
integer: NUMBER_AGGS,
|
|
324
|
-
float: NUMBER_AGGS,
|
|
325
|
-
string: STRING_AGGS,
|
|
326
|
-
boolean: STRING_AGGS,
|
|
327
|
-
date: STRING_AGGS,
|
|
328
|
-
datetime: STRING_AGGS,
|
|
329
|
-
},
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
async getHostedTables() {
|
|
334
|
-
const query = this.sqlBuilder.getHostedTables();
|
|
335
|
-
const results = await runQuery(this.db, query);
|
|
336
|
-
return results.map((row) => {
|
|
337
|
-
const json = row.toJSON();
|
|
338
|
-
return `${json.database || "memory"}.${json.name}`;
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
async tableSchema(tableId: string, config?: ViewConfig) {
|
|
343
|
-
const query = this.sqlBuilder.tableSchema(tableId);
|
|
344
|
-
const results = await runQuery(this.db, query);
|
|
345
|
-
const schema = {} as Record<string, ColumnType>;
|
|
346
|
-
for (const result of results) {
|
|
347
|
-
const res = result.toJSON();
|
|
348
|
-
const colName = res.column_name;
|
|
349
|
-
if (!colName.startsWith("__")) {
|
|
350
|
-
schema[colName] = duckdbTypeToPsp(
|
|
351
|
-
res.column_type,
|
|
352
|
-
) as ColumnType;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
return schema;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
async viewColumnSize(viewId: string, config: ViewConfig) {
|
|
360
|
-
const query = this.sqlBuilder.viewColumnSize(viewId);
|
|
361
|
-
const results = await runQuery(this.db, query);
|
|
362
|
-
const count = Number(Object.values(results[0].toJSON())[0]);
|
|
363
|
-
const gs = config.group_by?.length || 0;
|
|
364
|
-
const is_flat = config.group_rollup_mode === "flat";
|
|
365
|
-
return count - (gs === 0 ? 0 : is_flat ? gs : gs + 1);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
async tableSize(tableId: string) {
|
|
369
|
-
const query = this.sqlBuilder.tableSize(tableId);
|
|
370
|
-
const results = await runQuery(this.db, query);
|
|
371
|
-
return Number(results[0].toJSON()["count_star()"]);
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
async tableMakeView(
|
|
375
|
-
tableId: string,
|
|
376
|
-
viewId: string,
|
|
377
|
-
config: ViewConfigUpdate,
|
|
378
|
-
) {
|
|
379
|
-
// Window order keys need column types for `range` frame emission.
|
|
380
|
-
const schema = Object.keys(config.windows ?? {}).length
|
|
381
|
-
? await this.tableSchema(tableId)
|
|
382
|
-
: undefined;
|
|
383
|
-
|
|
384
|
-
const query = this.sqlBuilder.tableMakeView(
|
|
385
|
-
tableId,
|
|
386
|
-
viewId,
|
|
387
|
-
config,
|
|
388
|
-
schema,
|
|
389
|
-
);
|
|
390
|
-
|
|
391
|
-
await runQuery(this.db, query);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
async tableDescribe(
|
|
395
|
-
tableId: string,
|
|
396
|
-
config: ViewConfig,
|
|
397
|
-
): Promise<TableDescription> {
|
|
398
|
-
let expression_schema = {} as Record<string, ColumnType>;
|
|
399
|
-
const expressions_query = this.sqlBuilder.expressionsDescribe(
|
|
400
|
-
tableId,
|
|
401
|
-
config,
|
|
402
|
-
);
|
|
403
|
-
|
|
404
|
-
if (expressions_query !== undefined) {
|
|
405
|
-
try {
|
|
406
|
-
expression_schema = await this.describeQuery(expressions_query);
|
|
407
|
-
} catch (error) {
|
|
408
|
-
return await this.attributeExpressionErrors(
|
|
409
|
-
tableId,
|
|
410
|
-
config,
|
|
411
|
-
error,
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
const schema = Object.keys(config.windows ?? {}).length
|
|
417
|
-
? await this.tableSchema(tableId)
|
|
418
|
-
: undefined;
|
|
419
|
-
|
|
420
|
-
const view_query = this.sqlBuilder.tableDescribe(
|
|
421
|
-
tableId,
|
|
422
|
-
config,
|
|
423
|
-
schema,
|
|
424
|
-
);
|
|
425
|
-
|
|
426
|
-
let view_schema = {} as Record<string, ColumnType>;
|
|
427
|
-
if (view_query !== undefined) {
|
|
428
|
-
try {
|
|
429
|
-
view_schema = await this.describeQuery(view_query);
|
|
430
|
-
} catch (error) {
|
|
431
|
-
return { config_error: errorMessage(error) };
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
return { expression_schema, view_schema };
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
/** The planned result columns of one `DESCRIBE` query. */
|
|
439
|
-
private async describeQuery(query: string) {
|
|
440
|
-
const results = await runQuery(this.db, query);
|
|
441
|
-
const schema = {} as Record<string, ColumnType>;
|
|
442
|
-
for (const result of results) {
|
|
443
|
-
const res = result.toJSON();
|
|
444
|
-
if (!res.column_name.startsWith("__")) {
|
|
445
|
-
schema[res.column_name] = duckdbTypeToPsp(
|
|
446
|
-
res.column_type,
|
|
447
|
-
) as ColumnType;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
return schema;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/** Plans each expression on its own to name the ones at fault. */
|
|
455
|
-
private async attributeExpressionErrors(
|
|
456
|
-
tableId: string,
|
|
457
|
-
config: ViewConfig,
|
|
458
|
-
error: unknown,
|
|
459
|
-
): Promise<TableDescription> {
|
|
460
|
-
const expression_schema = {} as Record<string, ColumnType>;
|
|
461
|
-
const expression_errors = {} as Record<string, ExpressionError>;
|
|
462
|
-
for (const [name, expression] of Object.entries(config.expressions)) {
|
|
463
|
-
const query = this.sqlBuilder.expressionDescribe(
|
|
464
|
-
tableId,
|
|
465
|
-
expression!,
|
|
466
|
-
);
|
|
467
|
-
|
|
468
|
-
try {
|
|
469
|
-
const results = await runQuery(this.db, query);
|
|
470
|
-
expression_schema[name] = duckdbTypeToPsp(
|
|
471
|
-
results[0].toJSON()["column_type"],
|
|
472
|
-
) as ColumnType;
|
|
473
|
-
} catch (error) {
|
|
474
|
-
expression_errors[name] = {
|
|
475
|
-
error_message: errorMessage(error),
|
|
476
|
-
line: 0,
|
|
477
|
-
column: 0,
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
if (Object.keys(expression_errors).length === 0) {
|
|
483
|
-
return { config_error: errorMessage(error) };
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
return { expression_schema, expression_errors };
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
async viewMakeTable(
|
|
490
|
-
viewId: string,
|
|
491
|
-
tableId: string,
|
|
492
|
-
config: ViewConfig,
|
|
493
|
-
schema?: Record<string, ColumnType>,
|
|
494
|
-
) {
|
|
495
|
-
const query = this.sqlBuilder.viewMakeTable(
|
|
496
|
-
viewId,
|
|
497
|
-
tableId,
|
|
498
|
-
config,
|
|
499
|
-
await this.tableSchema(viewId),
|
|
500
|
-
schema,
|
|
501
|
-
);
|
|
502
|
-
|
|
503
|
-
await runQuery(this.db, query);
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
async viewDelete(viewId: string) {
|
|
507
|
-
const query = this.sqlBuilder.viewDelete(viewId);
|
|
508
|
-
await runQuery(this.db, query);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
async viewGetMinMax(
|
|
512
|
-
viewId: string,
|
|
513
|
-
columnName: string,
|
|
514
|
-
config: ViewConfig,
|
|
515
|
-
) {
|
|
516
|
-
const query = this.sqlBuilder.viewGetMinMax(viewId, columnName, config);
|
|
517
|
-
const results = await runQuery(this.db, query);
|
|
518
|
-
const row = results[0].toJSON();
|
|
519
|
-
let [min, max] = Object.values(row);
|
|
520
|
-
if (typeof min === "bigint") min = Number(min);
|
|
521
|
-
if (typeof max === "bigint") max = Number(max);
|
|
522
|
-
return { min: (min ?? null) as Scalar, max: (max ?? null) as Scalar };
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
async viewGetData(
|
|
526
|
-
viewId: string,
|
|
527
|
-
config: ViewConfig,
|
|
528
|
-
schema: Record<string, ColumnType>,
|
|
529
|
-
viewport: ViewWindow,
|
|
530
|
-
dataSlice: perspective.VirtualDataSlice,
|
|
531
|
-
) {
|
|
532
|
-
const query = this.sqlBuilder.viewGetData(
|
|
533
|
-
viewId,
|
|
534
|
-
config,
|
|
535
|
-
viewport,
|
|
536
|
-
schema,
|
|
537
|
-
);
|
|
538
|
-
|
|
539
|
-
const ipc = await this.db.useUnsafe((bindings, conn) =>
|
|
540
|
-
bindings.runQuery(conn, query),
|
|
541
|
-
);
|
|
542
|
-
|
|
543
|
-
dataSlice.fromArrowIpc(ipc);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
function errorMessage(error: unknown): string {
|
|
548
|
-
return error instanceof Error ? error.message : String(error);
|
|
549
|
-
}
|
package/src/ts/wasm/browser.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
-
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
-
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
-
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
-
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
-
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
-
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
-
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
-
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
-
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
-
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
-
|
|
13
|
-
import type * as psp from "../../../dist/wasm/perspective-js.d.ts";
|
|
14
|
-
|
|
15
|
-
import * as psp_websocket from "../websocket.ts";
|
|
16
|
-
|
|
17
|
-
function invert_promise<T>(): [
|
|
18
|
-
(t: T) => void,
|
|
19
|
-
Promise<T>,
|
|
20
|
-
(e: string) => void,
|
|
21
|
-
] {
|
|
22
|
-
let sender, reject;
|
|
23
|
-
let receiver: Promise<T> = new Promise((x, y) => {
|
|
24
|
-
sender = x;
|
|
25
|
-
reject = y;
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return [
|
|
29
|
-
sender as unknown as (t: T) => void,
|
|
30
|
-
receiver,
|
|
31
|
-
reject as unknown as (e: string) => void,
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function _init(
|
|
36
|
-
ws: MessagePort | Worker,
|
|
37
|
-
wasm: WebAssembly.Module | undefined,
|
|
38
|
-
) {
|
|
39
|
-
const [sender, receiver] = invert_promise();
|
|
40
|
-
ws.addEventListener("message", function listener(resp) {
|
|
41
|
-
ws.removeEventListener("message", listener);
|
|
42
|
-
sender(null);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
ws.onmessage = function listener(resp) {
|
|
46
|
-
ws.onmessage = function () {};
|
|
47
|
-
sender(null);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
ws.onmessageerror = console.error;
|
|
51
|
-
ws.postMessage(
|
|
52
|
-
{ cmd: "init", args: [wasm] },
|
|
53
|
-
{
|
|
54
|
-
transfer:
|
|
55
|
-
wasm === undefined || wasm instanceof WebAssembly.Module
|
|
56
|
-
? []
|
|
57
|
-
: [wasm],
|
|
58
|
-
},
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
await receiver;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Create a new client connected exclusively to a new Web Worker instance of
|
|
66
|
-
* the Perspective engine.
|
|
67
|
-
* @param module
|
|
68
|
-
* @returns
|
|
69
|
-
*/
|
|
70
|
-
export async function worker(
|
|
71
|
-
module: Promise<typeof psp>,
|
|
72
|
-
server_wasm: Promise<WebAssembly.Module> | undefined,
|
|
73
|
-
perspective_wasm_worker: Promise<SharedWorker | Worker | MessagePort>,
|
|
74
|
-
) {
|
|
75
|
-
const [wasm, webworker]: [
|
|
76
|
-
WebAssembly.Module | undefined,
|
|
77
|
-
SharedWorker | Worker | MessagePort,
|
|
78
|
-
] = await Promise.all([server_wasm, perspective_wasm_worker]);
|
|
79
|
-
|
|
80
|
-
const { Client } = await module;
|
|
81
|
-
let port: MessagePort | Worker;
|
|
82
|
-
let close: () => void;
|
|
83
|
-
if (
|
|
84
|
-
typeof SharedWorker !== "undefined" &&
|
|
85
|
-
webworker instanceof SharedWorker
|
|
86
|
-
) {
|
|
87
|
-
const shared_port = webworker.port;
|
|
88
|
-
port = shared_port;
|
|
89
|
-
close = () => shared_port.close();
|
|
90
|
-
} else if (typeof Worker !== "undefined" && webworker instanceof Worker) {
|
|
91
|
-
port = webworker;
|
|
92
|
-
close = () => webworker.terminate();
|
|
93
|
-
} else if (webworker instanceof MessagePort) {
|
|
94
|
-
port = webworker;
|
|
95
|
-
close = () => webworker.close();
|
|
96
|
-
} else {
|
|
97
|
-
throw new Error("Unsupported worker type");
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const client = new Client(
|
|
101
|
-
async (proto: Uint8Array) => {
|
|
102
|
-
const f = proto.slice().buffer;
|
|
103
|
-
port.postMessage(f, { transfer: [f] });
|
|
104
|
-
},
|
|
105
|
-
async () => {
|
|
106
|
-
console.debug("Closing WebWorker");
|
|
107
|
-
close();
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
await _init(port, wasm);
|
|
112
|
-
port.onmessage = (json: MessageEvent<Uint8Array>) => {
|
|
113
|
-
client.handle_response(json.data);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
return client;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Create a new client connected via WebSocket to a server implemnting the
|
|
121
|
-
* Perspective Protocol.
|
|
122
|
-
* @param module
|
|
123
|
-
* @param url
|
|
124
|
-
* @returns
|
|
125
|
-
*/
|
|
126
|
-
export async function websocket(
|
|
127
|
-
module: Promise<typeof psp>,
|
|
128
|
-
url: string | URL,
|
|
129
|
-
) {
|
|
130
|
-
const { Client } = await module;
|
|
131
|
-
return await psp_websocket.websocket(WebSocket, Client, url);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export default { websocket, worker };
|