@perspective-dev/client 5.6.1 → 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 +664 -35
- 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/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 -83
- 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,71 +0,0 @@
|
|
|
1
|
-
import type { AggSpec } from "./AggSpec.js";
|
|
2
|
-
import type { ColumnType } from "./ColumnType.js";
|
|
3
|
-
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
4
|
-
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
5
|
-
import type { WindowAggSpec } from "./WindowAggSpec.js";
|
|
6
|
-
/**
|
|
7
|
-
* Describes the capabilities supported by a virtual server handler.
|
|
8
|
-
*
|
|
9
|
-
* This struct is returned by
|
|
10
|
-
* [`VirtualServerHandler::get_features`](super::VirtualServerHandler::get_features)
|
|
11
|
-
* to inform clients about which operations are available.
|
|
12
|
-
*/
|
|
13
|
-
export type Features = {
|
|
14
|
-
/**
|
|
15
|
-
* Whether group-by aggregation is supported.
|
|
16
|
-
*/
|
|
17
|
-
group_by?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Which `group_by_rollup_mode` options are supported
|
|
20
|
-
*/
|
|
21
|
-
group_rollup_mode?: Array<GroupRollupMode>;
|
|
22
|
-
/**
|
|
23
|
-
* Whether split-by (pivot) operations are supported.
|
|
24
|
-
*/
|
|
25
|
-
split_by?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Which `split_rollup_mode` options are supported. Empty (the default)
|
|
28
|
-
* means `["flat"]` - a server must opt in to `"rollup"` explicitly, as
|
|
29
|
-
* it requires emitting subtotal and grand-total column groups.
|
|
30
|
-
*/
|
|
31
|
-
split_rollup_mode?: Array<SplitRollupMode>;
|
|
32
|
-
/**
|
|
33
|
-
* Available filter operators per column type.
|
|
34
|
-
*/
|
|
35
|
-
filter_ops?: {
|
|
36
|
-
[key in ColumnType]?: Array<string>;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Available aggregate functions per column type.
|
|
40
|
-
*/
|
|
41
|
-
aggregates?: {
|
|
42
|
-
[key in ColumnType]?: Array<AggSpec>;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Whether sorting is supported.
|
|
46
|
-
*/
|
|
47
|
-
sort?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Whether computed expressions are supported.
|
|
50
|
-
*/
|
|
51
|
-
expressions?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Available window aggregates per column type.
|
|
54
|
-
*/
|
|
55
|
-
window_aggregates?: {
|
|
56
|
-
[key in ColumnType]?: Array<WindowAggSpec>;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Whether update callbacks are supported.
|
|
60
|
-
*/
|
|
61
|
-
on_update?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* The data store has no reliable natural row order
|
|
64
|
-
*/
|
|
65
|
-
unordered?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Whether a `Table` can be derived from a `View`, which requires
|
|
68
|
-
* [`VirtualServerHandler::view_make_table`](super::VirtualServerHandler::view_make_table).
|
|
69
|
-
*/
|
|
70
|
-
view_derivations?: boolean;
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type FilterReducer = "and" | "or";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type GroupRollupMode = "rollup" | "flat" | "total";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type JoinType = "inner" | "left" | "outer";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ListFlatten = "zip" | "cartesian" | "stringify";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The update mode for [`View::on_update`].
|
|
3
|
-
*
|
|
4
|
-
* `Row` mode calculates and provides the update batch new rows/columns as an
|
|
5
|
-
* Apache Arrow to the callback provided to [`View::on_update`]. This allows
|
|
6
|
-
* incremental updates if your callbakc can read this format, but should be
|
|
7
|
-
* disabled otherwise.
|
|
8
|
-
*/
|
|
9
|
-
export type OnUpdateMode = "row";
|
package/dist/esm/ts-rs/Sort.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type SortDir = "none" | "desc" | "asc" | "col desc" | "col asc" | "desc abs" | "asc abs" | "col desc abs" | "col asc abs";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `split_by` corollary to [`GroupRollupMode`]. `Flat` (the default,
|
|
3
|
-
* matching this crate's historical behavior) emits only full-depth split
|
|
4
|
-
* combinations as columns; `Rollup` additionally emits grand-total and
|
|
5
|
-
* subtotal column groups in "totals before" order. There is no `Total`
|
|
6
|
-
* variant - an empty `split_by` already expresses a single grand-total
|
|
7
|
-
* column group.
|
|
8
|
-
*/
|
|
9
|
-
export type SplitRollupMode = "flat" | "rollup";
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Metadata about the engine runtime (such as total heap utilization).
|
|
3
|
-
*/
|
|
4
|
-
export type SystemInfo<T = bigint> = {
|
|
5
|
-
/**
|
|
6
|
-
* Total available bytes for allocation on the [`Server`].
|
|
7
|
-
*/
|
|
8
|
-
heap_size: T;
|
|
9
|
-
/**
|
|
10
|
-
* Bytes allocated for use on the [`Server`].
|
|
11
|
-
*/
|
|
12
|
-
used_size: T;
|
|
13
|
-
/**
|
|
14
|
-
* Wall-clock time spent processing requests on the [`Server`], in
|
|
15
|
-
* milliseconds (estimated). This does not properly account for the
|
|
16
|
-
* internal thread pool (which enables column-parallel processing of
|
|
17
|
-
* individual requests).
|
|
18
|
-
*/
|
|
19
|
-
cpu_time: number;
|
|
20
|
-
/**
|
|
21
|
-
* Milliseconds since internal CPU time accumulator was reset.
|
|
22
|
-
*/
|
|
23
|
-
cpu_time_epoch: number;
|
|
24
|
-
/**
|
|
25
|
-
* Timestamp (POSIX) this request was made. This field may be omitted
|
|
26
|
-
* for wasm due to `perspective-client` lacking a dependency on
|
|
27
|
-
* `wasm_bindgen`.
|
|
28
|
-
*/
|
|
29
|
-
timestamp: T | null;
|
|
30
|
-
/**
|
|
31
|
-
* Total available bytes for allocation on the [`Client`]. This is only
|
|
32
|
-
* available if `trace-allocator` is enabled.
|
|
33
|
-
*/
|
|
34
|
-
client_heap: T | null;
|
|
35
|
-
/**
|
|
36
|
-
* Bytes allocated for use on the [`Client`]. This is only
|
|
37
|
-
* available if `trace-allocator` is enabled.
|
|
38
|
-
*/
|
|
39
|
-
client_used: T | null;
|
|
40
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { ColumnType } from "./ColumnType.js";
|
|
2
|
-
import type { ListFlatten } from "./ListFlatten.js";
|
|
3
|
-
import type { TableReadFormat } from "./TableReadFormat.js";
|
|
4
|
-
/**
|
|
5
|
-
* Options which impact the behavior of [`Client::table`], as well as
|
|
6
|
-
* subsequent calls to [`Table::update`].
|
|
7
|
-
*/
|
|
8
|
-
export type TableInitOptions = {
|
|
9
|
-
name?: string;
|
|
10
|
-
format?: TableReadFormat;
|
|
11
|
-
/**
|
|
12
|
-
* This [`Table`] should use the column named by the `index` parameter as
|
|
13
|
-
* the `index`, which causes [`Table::update`] and [`Client::table`] input
|
|
14
|
-
* to either insert or update existing rows based on `index` column
|
|
15
|
-
* value equality.
|
|
16
|
-
*/
|
|
17
|
-
index?: string;
|
|
18
|
-
/**
|
|
19
|
-
* This [`Table`] should be limited to `limit` rows, after which the
|
|
20
|
-
* _earliest_ rows will be overwritten (where _earliest_ is defined as
|
|
21
|
-
* relative to insertion order).
|
|
22
|
-
*/
|
|
23
|
-
limit?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Back this [`Table`]'s canonical data with the on-disk storage backend
|
|
26
|
-
* instead of memory. On native targets this is a memory-mapped file; on
|
|
27
|
-
* WASM it is OPFS (Worker only). Defaults to in-memory.
|
|
28
|
-
*/
|
|
29
|
-
page_to_disk?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* How Arrow `LIST` and JSON `Array` columns are ingested. `zip` (the
|
|
32
|
-
* default) and `cartesian` expand a row into one row per list element,
|
|
33
|
-
* and are incompatible with `index`, as the rows of an expansion
|
|
34
|
-
* repeat their index. `stringify` encodes each list as a JSON array in
|
|
35
|
-
* a single string column instead.
|
|
36
|
-
*/
|
|
37
|
-
list_flatten?: ListFlatten;
|
|
38
|
-
/**
|
|
39
|
-
* The columns of a [`Table`] made from a [`View`], in place of the ones
|
|
40
|
-
* inferred from it.
|
|
41
|
-
*/
|
|
42
|
-
schema?: {
|
|
43
|
-
[key in string]?: ColumnType;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for `with_typed_arrays`, extending `ViewWindow` with
|
|
3
|
-
* typed-array-specific options.
|
|
4
|
-
*/
|
|
5
|
-
export type TypedArrayWindow = {
|
|
6
|
-
/**
|
|
7
|
-
* When `true`, Float64/Date32/Timestamp columns are output as
|
|
8
|
-
* `Float32Array` instead of `Float64Array`.
|
|
9
|
-
*/
|
|
10
|
-
float32: boolean;
|
|
11
|
-
start_row?: number;
|
|
12
|
-
start_col?: number;
|
|
13
|
-
end_row?: number;
|
|
14
|
-
end_col?: number;
|
|
15
|
-
id?: boolean;
|
|
16
|
-
index?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Only impacts [`View::to_csv`]
|
|
19
|
-
*/
|
|
20
|
-
formatted?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Arrow IPC body compression for [`View::to_arrow`], `"lz4"` or `"zstd"`
|
|
23
|
-
* (uncompressed when omitted).
|
|
24
|
-
*/
|
|
25
|
-
compression?: "lz4" | "zstd";
|
|
26
|
-
/**
|
|
27
|
-
* When `true`, [`View::to_arrow`] names `group_by` key columns
|
|
28
|
-
* `__ROW_PATH_N__` and never qualifies an aggregate, instead of the
|
|
29
|
-
* human-readable names a key column and its aggregate would otherwise
|
|
30
|
-
* take.
|
|
31
|
-
*/
|
|
32
|
-
machine_column_names?: boolean;
|
|
33
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Aggregate } from "./Aggregate.js";
|
|
2
|
-
import type { Expressions } from "./Expressions.js";
|
|
3
|
-
import type { Filter } from "./Filter.js";
|
|
4
|
-
import type { FilterReducer } from "./FilterReducer.js";
|
|
5
|
-
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
|
-
import type { Sort } from "./Sort.js";
|
|
7
|
-
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
8
|
-
import type { Windows } from "./Windows.js";
|
|
9
|
-
export type ViewConfig = {
|
|
10
|
-
group_by: Array<string>;
|
|
11
|
-
split_by: Array<string>;
|
|
12
|
-
sort: Array<Sort>;
|
|
13
|
-
filter: Array<Filter>;
|
|
14
|
-
group_rollup_mode: GroupRollupMode;
|
|
15
|
-
split_rollup_mode: SplitRollupMode;
|
|
16
|
-
filter_op?: FilterReducer;
|
|
17
|
-
expressions: Expressions;
|
|
18
|
-
windows?: Windows;
|
|
19
|
-
columns: Array<string | null>;
|
|
20
|
-
aggregates: {
|
|
21
|
-
[key in string]?: Aggregate;
|
|
22
|
-
};
|
|
23
|
-
group_by_depth?: number | null;
|
|
24
|
-
};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import type { Aggregate } from "./Aggregate.js";
|
|
2
|
-
import type { Expressions } from "./Expressions.js";
|
|
3
|
-
import type { Filter } from "./Filter.js";
|
|
4
|
-
import type { FilterReducer } from "./FilterReducer.js";
|
|
5
|
-
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
6
|
-
import type { Sort } from "./Sort.js";
|
|
7
|
-
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
8
|
-
import type { Windows } from "./Windows.js";
|
|
9
|
-
export type ViewConfigUpdate = {
|
|
10
|
-
/**
|
|
11
|
-
* A group by _groups_ the dataset by the unique values of each column used
|
|
12
|
-
* as a group by - a close analogue in SQL to the `GROUP BY` statement.
|
|
13
|
-
* The underlying dataset is aggregated to show the values belonging to
|
|
14
|
-
* each group, and a total row is calculated for each group, showing
|
|
15
|
-
* the currently selected aggregated value (e.g. `sum`) of the column.
|
|
16
|
-
* Group by are useful for hierarchies, categorizing data and
|
|
17
|
-
* attributing values, i.e. showing the number of units sold based on
|
|
18
|
-
* State and City. In Perspective, group by are represented as an array
|
|
19
|
-
* of string column names to pivot, are applied in the order provided;
|
|
20
|
-
* For example, a group by of `["State", "City", "Postal Code"]` shows
|
|
21
|
-
* the values for each Postal Code, which are grouped by City,
|
|
22
|
-
* which are in turn grouped by State.
|
|
23
|
-
*/
|
|
24
|
-
group_by?: Array<string>;
|
|
25
|
-
/**
|
|
26
|
-
* A split by _splits_ the dataset by the unique values of each column used
|
|
27
|
-
* as a split by. The underlying dataset is not aggregated, and a new
|
|
28
|
-
* column is created for each unique value of the split by. Each newly
|
|
29
|
-
* created column contains the parts of the dataset that correspond to
|
|
30
|
-
* the column header, i.e. a `View` that has `["State"]` as its split
|
|
31
|
-
* by will have a new column for each state. In Perspective, Split By
|
|
32
|
-
* are represented as an array of string column names to pivot.
|
|
33
|
-
*/
|
|
34
|
-
split_by?: Array<string>;
|
|
35
|
-
/**
|
|
36
|
-
* The `columns` property specifies which columns should be included in the
|
|
37
|
-
* [`crate::View`]'s output. This allows users to show or hide a specific
|
|
38
|
-
* subset of columns, as well as control the order in which columns
|
|
39
|
-
* appear to the user. This is represented in Perspective as an array
|
|
40
|
-
* of string column names.
|
|
41
|
-
*/
|
|
42
|
-
columns?: Array<string | null>;
|
|
43
|
-
/**
|
|
44
|
-
* The `filter` property specifies columns on which the query can be
|
|
45
|
-
* filtered, returning rows that pass the specified filter condition.
|
|
46
|
-
* This is analogous to the `WHERE` clause in SQL. There is no limit on
|
|
47
|
-
* the number of columns where `filter` is applied, but the resulting
|
|
48
|
-
* dataset is one that passes all the filter conditions, i.e. the
|
|
49
|
-
* filters are joined with an `AND` condition.
|
|
50
|
-
*
|
|
51
|
-
* Perspective represents `filter` as an array of arrays, with the values
|
|
52
|
-
* of each inner array being a string column name, a string filter
|
|
53
|
-
* operator, and a filter operand in the type of the column.
|
|
54
|
-
*/
|
|
55
|
-
filter?: Array<Filter>;
|
|
56
|
-
/**
|
|
57
|
-
* The `sort` property specifies columns on which the query should be
|
|
58
|
-
* sorted, analogous to `ORDER BY` in SQL. A column can be sorted
|
|
59
|
-
* regardless of its data type, and sorts can be applied in ascending
|
|
60
|
-
* or descending order. Perspective represents `sort` as an array of
|
|
61
|
-
* arrays, with the values of each inner array being a string column
|
|
62
|
-
* name and a string sort direction. When `column-pivots` are applied,
|
|
63
|
-
* the additional sort directions `"col asc"` and `"col desc"` will
|
|
64
|
-
* determine the order of pivot columns groups.
|
|
65
|
-
*
|
|
66
|
-
* `sort` is the ONLY thing that orders a `View`'s rows — without it
|
|
67
|
-
* they keep the `Table`'s natural (insertion) order, which any
|
|
68
|
-
* consumer reading rows sequentially will reflect. Not to be
|
|
69
|
-
* confused with a window column's `order_by`, which orders rows
|
|
70
|
-
* WITHIN a window frame and does not reorder the `View`.
|
|
71
|
-
*/
|
|
72
|
-
sort?: Array<Sort>;
|
|
73
|
-
/**
|
|
74
|
-
* The `expressions` property specifies _new_ columns in Perspective that
|
|
75
|
-
* are created using existing column values or arbitary scalar values
|
|
76
|
-
* defined within the expression. In `<perspective-viewer>`,
|
|
77
|
-
* expressions are added using the "New Column" button in the side
|
|
78
|
-
* panel.
|
|
79
|
-
*/
|
|
80
|
-
expressions?: Expressions;
|
|
81
|
-
/**
|
|
82
|
-
* The `windows` property declares ordered, partitioned rolling
|
|
83
|
-
* computations (moving aggregates, cumulative sums) as _new_ columns
|
|
84
|
-
* keyed by output alias (`{"name": {...spec}}`, symmetric with
|
|
85
|
-
* `expressions`), analogous to SQL window functions. See
|
|
86
|
-
* [`crate::config::WindowSpec`].
|
|
87
|
-
*/
|
|
88
|
-
windows?: Windows;
|
|
89
|
-
/**
|
|
90
|
-
* Aggregates perform a calculation over an entire column, and are
|
|
91
|
-
* displayed when one or more [Group By](#group-by) are applied to the
|
|
92
|
-
* `View`. Aggregates can be specified by the user, or Perspective will
|
|
93
|
-
* use the following sensible default aggregates based on column type:
|
|
94
|
-
*
|
|
95
|
-
* - "sum" for `integer` and `float` columns
|
|
96
|
-
* - "count" for all other columns
|
|
97
|
-
*
|
|
98
|
-
* Perspective provides a selection of aggregate functions that can be
|
|
99
|
-
* applied to columns in the `View` constructor using a dictionary of
|
|
100
|
-
* column name to aggregate function name.
|
|
101
|
-
*
|
|
102
|
-
* An aggregate also determines the column's RESULT TYPE, which need
|
|
103
|
-
* not match the input: `"count"` yields an `integer` whatever it
|
|
104
|
-
* counts, so a `date` column left on the default `"count"` is an
|
|
105
|
-
* `integer` in the resulting `View` — no longer a date. Set an
|
|
106
|
-
* aggregate that preserves the type (e.g. `"any"`, `"last"`) when
|
|
107
|
-
* the original type matters, such as a date used as a chart axis.
|
|
108
|
-
*/
|
|
109
|
-
aggregates?: {
|
|
110
|
-
[key in string]?: Aggregate;
|
|
111
|
-
};
|
|
112
|
-
group_by_depth?: number;
|
|
113
|
-
filter_op?: FilterReducer;
|
|
114
|
-
group_rollup_mode?: GroupRollupMode;
|
|
115
|
-
split_rollup_mode?: SplitRollupMode;
|
|
116
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Options for serializing a window of data from a [`View`].
|
|
3
|
-
*
|
|
4
|
-
* Some fields of [`ViewWindow`] are only applicable to specific methods of
|
|
5
|
-
* [`View`].
|
|
6
|
-
*/
|
|
7
|
-
export type ViewWindow = {
|
|
8
|
-
start_row?: number;
|
|
9
|
-
start_col?: number;
|
|
10
|
-
end_row?: number;
|
|
11
|
-
end_col?: number;
|
|
12
|
-
id?: boolean;
|
|
13
|
-
index?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Only impacts [`View::to_csv`]
|
|
16
|
-
*/
|
|
17
|
-
formatted?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Arrow IPC body compression for [`View::to_arrow`], `"lz4"` or `"zstd"`
|
|
20
|
-
* (uncompressed when omitted).
|
|
21
|
-
*/
|
|
22
|
-
compression?: "lz4" | "zstd";
|
|
23
|
-
/**
|
|
24
|
-
* When `true`, [`View::to_arrow`] names `group_by` key columns
|
|
25
|
-
* `__ROW_PATH_N__` and never qualifies an aggregate, instead of the
|
|
26
|
-
* human-readable names a key column and its aggregate would otherwise
|
|
27
|
-
* take.
|
|
28
|
-
*/
|
|
29
|
-
machine_column_names?: boolean;
|
|
30
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ColumnType } from "./ColumnType.js";
|
|
2
|
-
/**
|
|
3
|
-
* Specification for a window aggregate.
|
|
4
|
-
*/
|
|
5
|
-
export type WindowAggSpec = {
|
|
6
|
-
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* Frame kinds this aggregate accepts (`rows`, `range`, `cumulative`).
|
|
9
|
-
* Empty means it takes no frame at all.
|
|
10
|
-
*/
|
|
11
|
-
frames?: Array<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Takes a row offset, as `lag` / `lead` / `diff` do.
|
|
14
|
-
*/
|
|
15
|
-
offset?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Takes a smoothing factor, as `ema` does.
|
|
18
|
-
*/
|
|
19
|
-
alpha?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* The output column type. `None` means the source column's type, which
|
|
22
|
-
* is what `min` / `max` / `lag` do.
|
|
23
|
-
*/
|
|
24
|
-
result_type?: ColumnType;
|
|
25
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { WindowSortDir } from "./WindowSortDir.js";
|
|
2
|
-
/**
|
|
3
|
-
* The `Table` column which orders each partition, with its direction -
|
|
4
|
-
* serialized as a two-element array (`["ts", "desc"]`), symmetric with the
|
|
5
|
-
* `ViewConfig`'s `sort` field.
|
|
6
|
-
*/
|
|
7
|
-
export type WindowSort = [string, WindowSortDir];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A window's order direction. A dedicated two-variant enum rather than
|
|
3
|
-
* [`crate::config::SortDir`] - the column-sort extras (`col asc`, `abs`,
|
|
4
|
-
* `none`) are meaningless inside a window frame and unrepresentable here.
|
|
5
|
-
*/
|
|
6
|
-
export type WindowSortDir = "asc" | "desc";
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { WindowSort } from "./WindowSort.js";
|
|
2
|
-
/**
|
|
3
|
-
* The serialized form of [`WindowSpec`].
|
|
4
|
-
*/
|
|
5
|
-
export type WindowSpec = {
|
|
6
|
-
/**
|
|
7
|
-
* The input column - either a real `Table` column or an expression
|
|
8
|
-
* alias from the same `ViewConfig`.
|
|
9
|
-
*/
|
|
10
|
-
column: string;
|
|
11
|
-
aggregate: string;
|
|
12
|
-
/**
|
|
13
|
-
* Columns whose distinct value tuples partition the rows; empty
|
|
14
|
-
* partitions the whole `Table` as one group.
|
|
15
|
-
*/
|
|
16
|
-
partition_by?: Array<string>;
|
|
17
|
-
/**
|
|
18
|
-
* The `Table` column which orders each partition, and the direction.
|
|
19
|
-
* This orders rows WITHIN the window frame only — it does not
|
|
20
|
-
* reorder the `View`, which is what the view-level `sort` does.
|
|
21
|
-
*/
|
|
22
|
-
order_by?: WindowSort | null;
|
|
23
|
-
/**
|
|
24
|
-
* A frame of the `rows` preceding each row, plus the row itself.
|
|
25
|
-
* Mutually exclusive with `range` and `cumulative`.
|
|
26
|
-
*/
|
|
27
|
-
rows?: number | null;
|
|
28
|
-
/**
|
|
29
|
-
* A frame of the rows whose `order_by` value lies within `range` of
|
|
30
|
-
* each row's, requiring a numeric or temporal `order_by`. Mutually
|
|
31
|
-
* exclusive with `rows` and `cumulative`.
|
|
32
|
-
*/
|
|
33
|
-
range?: number | null;
|
|
34
|
-
/**
|
|
35
|
-
* `true` frames all rows from the partition start through each row.
|
|
36
|
-
* Default can be omitted.
|
|
37
|
-
*/
|
|
38
|
-
cumulative?: boolean | null;
|
|
39
|
-
/**
|
|
40
|
-
* Row offset for `lag`/`lead` (default 1).
|
|
41
|
-
*/
|
|
42
|
-
offset?: number | null;
|
|
43
|
-
/**
|
|
44
|
-
* Smoothing factor in `(0, 1]` for `ema`.
|
|
45
|
-
*/
|
|
46
|
-
alpha?: number | null;
|
|
47
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { WindowSpec } from "./WindowSpec.js";
|
|
2
|
-
/**
|
|
3
|
-
* The window columns of a `ViewConfig`, keyed by output column alias -
|
|
4
|
-
* symmetric with `expressions` (`{"name": {...spec}}`). An alias must not
|
|
5
|
-
* collide with a `Table` column, expression alias, or another window's
|
|
6
|
-
* key.
|
|
7
|
-
*/
|
|
8
|
-
export type Windows = {
|
|
9
|
-
[key in string]?: WindowSpec;
|
|
10
|
-
};
|