@perspective-dev/viewer 5.0.0 → 5.2.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-viewer.js +9 -9
- package/dist/cdn/perspective-viewer.js.map +4 -4
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/gruvbox.css +1 -1
- package/dist/css/icons.css +1 -1
- package/dist/css/intl/de.css +1 -1
- package/dist/css/intl/es.css +1 -1
- package/dist/css/intl/fr.css +1 -1
- package/dist/css/intl/ja.css +1 -1
- package/dist/css/intl/pt.css +1 -1
- package/dist/css/intl/zh.css +1 -1
- package/dist/css/intl.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/phosphor.css +1 -1
- package/dist/css/pro-dark.css +1 -1
- package/dist/css/pro.css +1 -1
- package/dist/css/solarized-dark.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/docs/perspective-docs.json +1 -0
- package/dist/esm/column-format.d.ts +19 -28
- package/dist/esm/perspective-viewer.d.ts +2 -0
- package/dist/esm/perspective-viewer.inline.js +8 -8
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +9 -9
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/providers.d.ts +79 -0
- package/dist/esm/ts-rs/CompactDisplay.d.ts +5 -0
- package/dist/esm/ts-rs/CurrencyCode.d.ts +1 -0
- package/dist/esm/ts-rs/CurrencyDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/CurrencyNumberFormatStyle.d.ts +8 -0
- package/dist/esm/ts-rs/CurrencySign.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +54 -0
- package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +34 -0
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/DatetimeFormatType.d.ts +6 -0
- package/dist/esm/ts-rs/FormatMode.d.ts +1 -0
- package/dist/esm/ts-rs/FormatUnit.d.ts +1 -0
- package/dist/esm/ts-rs/Notation.d.ts +17 -0
- package/dist/esm/ts-rs/NumberFormatStyle.d.ts +18 -0
- package/dist/esm/ts-rs/PanelViewerConfig.d.ts +43 -1
- package/dist/esm/ts-rs/PluginStaticConfig.d.ts +35 -0
- package/dist/esm/ts-rs/RestoreOptions.d.ts +19 -0
- package/dist/esm/ts-rs/RoundingMode.d.ts +1 -0
- package/dist/esm/ts-rs/RoundingPriority.d.ts +1 -0
- package/dist/esm/ts-rs/SignDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +24 -0
- package/dist/esm/ts-rs/SplitRollupMode.d.ts +9 -0
- package/dist/esm/ts-rs/StringColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/Unit.d.ts +1 -0
- package/dist/esm/ts-rs/UnitDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/UnitNumberFormatStyle.d.ts +6 -0
- package/dist/esm/ts-rs/UseGrouping.d.ts +1 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +43 -1
- package/dist/esm/ts-rs/ViewerConfigInitial.d.ts +175 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +72 -0
- package/dist/esm/ts-rs/WindowSort.d.ts +7 -0
- package/dist/esm/ts-rs/WindowSortDir.d.ts +6 -0
- package/dist/esm/ts-rs/WindowSpec.d.ts +47 -0
- package/dist/esm/ts-rs/Windows.d.ts +10 -0
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +7 -6
- package/dist/wasm/perspective-viewer.d.ts +222 -26
- package/dist/wasm/perspective-viewer.js +378 -125
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +18 -15
- package/package.json +2 -1
- package/src/css/_viewer_bundle.css +1 -0
- package/src/css/column-selector.css +9 -0
- package/src/css/column-settings-panel.css +67 -2
- package/src/css/column-style.css +4 -3
- package/src/css/config-selector.css +60 -4
- package/src/css/containers/context-menu.css +12 -6
- package/src/css/containers/tabs.css +2 -2
- package/src/css/form/code-editor.css +2 -3
- package/src/css/form/mirrored-textarea.css +81 -0
- package/src/css/viewer.css +336 -0
- package/src/rust/agent/client/mod.rs +19 -0
- package/src/rust/agent/client/protocol.rs +320 -0
- package/src/rust/agent/client/transport.rs +287 -0
- package/src/rust/agent/client/turn.rs +174 -0
- package/src/rust/agent/config.rs +159 -0
- package/src/rust/agent/docs.rs +293 -0
- package/src/rust/agent/markdown/block.rs +509 -0
- package/src/rust/agent/markdown/entity.rs +52 -0
- package/src/rust/agent/markdown/events.rs +71 -0
- package/src/rust/agent/markdown/inline.rs +497 -0
- package/src/rust/agent/markdown/mod.rs +466 -0
- package/src/rust/agent/mod.rs +23 -0
- package/src/rust/agent/preamble.md +16 -0
- package/src/rust/agent/runtime.rs +201 -0
- package/src/rust/agent/slot.rs +236 -0
- package/src/rust/agent/tools.rs +1110 -0
- package/src/rust/components/chat_panel.rs +289 -0
- package/src/rust/components/column_selector/active_column.rs +21 -27
- package/src/rust/components/column_selector/column_selector_column_row.rs +73 -0
- package/src/rust/components/column_selector/config_selector.rs +83 -8
- package/src/rust/components/column_selector/expr_edit_button.rs +7 -1
- package/src/rust/components/column_selector/inactive_column.rs +8 -1
- package/src/rust/components/column_selector.rs +27 -3
- package/src/rust/components/column_settings_sidebar/style_tab.rs +2 -1
- package/src/rust/components/column_settings_sidebar/window_tab.rs +34 -0
- package/src/rust/components/column_settings_sidebar.rs +163 -16
- package/src/rust/components/containers/dragdrop_list.rs +110 -3
- package/src/rust/components/containers/sidebar.rs +99 -22
- package/src/rust/components/containers/split_panel.rs +6 -0
- package/src/rust/components/editable_header.rs +2 -0
- package/src/rust/components/form/code_editor.rs +14 -23
- package/src/rust/components/form/debug.rs +8 -5
- package/src/rust/components/form/mirrored_textarea.rs +165 -0
- package/src/rust/components/form/mod.rs +1 -0
- package/src/rust/components/main_panel.rs +5 -0
- package/src/rust/components/mod.rs +3 -0
- package/src/rust/components/panel_menu.rs +7 -0
- package/src/rust/components/panel_tab.rs +5 -0
- package/src/rust/components/portal.rs +7 -0
- package/src/rust/components/settings_panel.rs +80 -2
- package/src/rust/components/viewer/msg.rs +2 -0
- package/src/rust/components/viewer/panels.rs +9 -14
- package/src/rust/components/viewer/render.rs +14 -0
- package/src/rust/components/viewer/settings.rs +33 -1
- package/src/rust/components/viewer.rs +2 -0
- package/src/rust/components/window_editor.rs +985 -0
- package/src/rust/config/datetime_column_style/custom.rs +17 -0
- package/src/rust/config/datetime_column_style/simple.rs +10 -0
- package/src/rust/config/number_string_format.rs +33 -0
- package/src/rust/config/options.rs +18 -0
- package/src/rust/config/plugin_static_config.rs +120 -5
- package/src/rust/config/viewer_config.rs +220 -1
- package/src/rust/config/workspace_config.rs +7 -6
- package/src/rust/custom_elements/viewer.rs +209 -18
- package/src/rust/custom_events.rs +29 -0
- package/src/rust/lib.rs +17 -1
- package/src/rust/presentation/column_locator.rs +16 -1
- package/src/rust/presentation.rs +8 -0
- package/src/rust/queries/columns_iter_set.rs +7 -1
- package/src/rust/queries/get_viewer_config.rs +5 -1
- package/src/rust/renderer/dispatch.rs +85 -58
- package/src/rust/renderer.rs +34 -1
- package/src/rust/session/column_defaults_update.rs +18 -0
- package/src/rust/session/drag_drop_update.rs +18 -0
- package/src/rust/session/metadata.rs +64 -9
- package/src/rust/session/replace_expression_update.rs +2 -0
- package/src/rust/session.rs +7 -5
- package/src/rust/tasks/create_panel.rs +18 -8
- package/src/rust/tasks/edit_window.rs +155 -0
- package/src/rust/tasks/mod.rs +2 -0
- package/src/rust/tasks/restore_panel.rs +34 -17
- package/src/rust/tasks/sync_update_panels.rs +7 -23
- package/src/rust/utils/browser/dragdrop.rs +12 -0
- package/src/rust/utils/browser/tests/debounce.rs +49 -0
- package/src/rust/utils/debounce.rs +76 -27
- package/src/rust/workspace.rs +112 -20
- package/src/svg/pin-icon.svg +5 -0
- package/src/themes/icons.css +1 -0
- package/src/themes/intl/de.css +23 -0
- package/src/themes/intl/es.css +23 -0
- package/src/themes/intl/fr.css +23 -0
- package/src/themes/intl/ja.css +23 -0
- package/src/themes/intl/pt.css +23 -0
- package/src/themes/intl/zh.css +23 -0
- package/src/themes/intl.css +26 -1
- package/src/ts/column-format.ts +67 -46
- package/src/ts/perspective-viewer.ts +2 -0
- package/src/ts/providers.ts +96 -0
- package/src/ts/ts-rs/CompactDisplay.ts +3 -0
- package/src/ts/ts-rs/CurrencyCode.ts +3 -0
- package/src/ts/ts-rs/CurrencyDisplay.ts +3 -0
- package/src/ts/ts-rs/CurrencyNumberFormatStyle.ts +6 -0
- package/src/ts/ts-rs/CurrencySign.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +54 -0
- package/src/ts/ts-rs/CustomNumberFormatConfig.ts +25 -0
- package/src/ts/ts-rs/DatetimeColorMode.ts +3 -0
- package/src/ts/ts-rs/DatetimeFormatType.ts +8 -0
- package/src/ts/ts-rs/FormatMode.ts +3 -0
- package/src/ts/ts-rs/FormatUnit.ts +3 -0
- package/src/ts/ts-rs/Notation.ts +11 -0
- package/src/ts/ts-rs/NumberFormatStyle.ts +12 -0
- package/src/ts/ts-rs/PanelViewerConfig.ts +48 -1
- package/src/ts/ts-rs/PluginStaticConfig.ts +36 -1
- package/src/ts/ts-rs/RestoreOptions.ts +20 -0
- package/src/ts/ts-rs/RoundingMode.ts +3 -0
- package/src/ts/ts-rs/RoundingPriority.ts +3 -0
- package/src/ts/ts-rs/SignDisplay.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +25 -0
- package/src/ts/ts-rs/SplitRollupMode.ts +11 -0
- package/src/ts/ts-rs/StringColorMode.ts +3 -0
- package/src/ts/ts-rs/TrailingZeroDisplay.ts +3 -0
- package/src/ts/ts-rs/Unit.ts +3 -0
- package/src/ts/ts-rs/UnitDisplay.ts +3 -0
- package/src/ts/ts-rs/UnitNumberFormatStyle.ts +5 -0
- package/src/ts/ts-rs/UseGrouping.ts +3 -0
- package/src/ts/ts-rs/ViewerConfig.ts +48 -1
- package/src/ts/ts-rs/ViewerConfigInitial.ts +164 -0
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +81 -2
- package/src/ts/ts-rs/WindowSort.ts +9 -0
- package/src/ts/ts-rs/WindowSortDir.ts +8 -0
- package/src/ts/ts-rs/WindowSpec.ts +47 -0
- package/src/ts/ts-rs/Windows.ts +10 -0
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +7 -6
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-daeef4ceb066e6c7 → perspective-viewer-02e461f3d7062b26}/inline5.js +0 -0
|
@@ -5,6 +5,8 @@ import type { Filter } from "./Filter.js";
|
|
|
5
5
|
import type { FilterReducer } from "./FilterReducer.js";
|
|
6
6
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
7
7
|
import type { Sort } from "./Sort.js";
|
|
8
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
9
|
+
import type { Windows } from "./Windows.js";
|
|
8
10
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -12,4 +14,49 @@ import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
|
12
14
|
* element-level `settings` flag. This is the `panels` entry type of the
|
|
13
15
|
* whole-element config format.
|
|
14
16
|
*/
|
|
15
|
-
export type PanelViewerConfig<V = string> = {
|
|
17
|
+
export type PanelViewerConfig<V = string> = {
|
|
18
|
+
/**
|
|
19
|
+
* The `@perspective-dev/viewer` version that wrote this config,
|
|
20
|
+
* stamped on save and used to migrate older tokens. Callers do not
|
|
21
|
+
* set it.
|
|
22
|
+
*/
|
|
23
|
+
version: V,
|
|
24
|
+
/**
|
|
25
|
+
* Per-column styling, keyed by column name. The viewer treats the
|
|
26
|
+
* values as opaque — their shape is defined by the ACTIVE plugin,
|
|
27
|
+
* so a config written for one plugin may carry keys another
|
|
28
|
+
* ignores. Query the live shape with the `get_style_schema` agent
|
|
29
|
+
* tool, or the plugin's `column_config_schema()`.
|
|
30
|
+
*/
|
|
31
|
+
columns_config: { [key in string]?: { [key in string]?: JsonValue } },
|
|
32
|
+
/**
|
|
33
|
+
* Name of the visualization plugin, from the set registered on the
|
|
34
|
+
* page (the `list_plugins` agent tool, or the plugin picker). This
|
|
35
|
+
* also decides what the view fields MEAN visually: `columns` is
|
|
36
|
+
* positional and each plugin reads the positions differently, and
|
|
37
|
+
* `group_by`/`split_by` draw different things per plugin.
|
|
38
|
+
*/
|
|
39
|
+
plugin: string,
|
|
40
|
+
/**
|
|
41
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
42
|
+
* [`Self::columns_config`]). Opaque to the viewer and defined by
|
|
43
|
+
* the active plugin; see `get_style_schema`.
|
|
44
|
+
*/
|
|
45
|
+
plugin_config: { [key in string]?: JsonValue },
|
|
46
|
+
/**
|
|
47
|
+
* Name of the `Table` this panel renders, as hosted on the panel's
|
|
48
|
+
* `Client`. Every placed panel has a table binding (creation
|
|
49
|
+
* requires one by type — [`ViewerConfigInitial`]), so the saved
|
|
50
|
+
* config carries it unconditionally.
|
|
51
|
+
*/
|
|
52
|
+
table: string,
|
|
53
|
+
/**
|
|
54
|
+
* Selected theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid
|
|
55
|
+
* names are the Perspective themes loaded on the page, which
|
|
56
|
+
* `resetThemes()` re-scans. `None` selects the first available.
|
|
57
|
+
*/
|
|
58
|
+
theme: string | null,
|
|
59
|
+
/**
|
|
60
|
+
* Panel title, shown in its tab. `None` renders the default title.
|
|
61
|
+
*/
|
|
62
|
+
title: string | null, group_by: Array<string>, split_by: Array<string>, sort: Array<Sort>, filter: Array<Filter>, group_rollup_mode: GroupRollupMode, split_rollup_mode: SplitRollupMode, filter_op?: FilterReducer, expressions: Expressions, windows?: Windows, columns: Array<string | null>, aggregates: { [key in string]?: Aggregate }, group_by_depth?: number | null, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
2
|
import type { ColumnSelectMode } from "./ColumnSelectMode.js";
|
|
3
3
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
4
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Static, immutable configuration for a plugin.
|
|
@@ -62,6 +63,11 @@ config_column_names?: Array<string>,
|
|
|
62
63
|
* The first entry that matches a feature flag becomes the default.
|
|
63
64
|
*/
|
|
64
65
|
group_rollup_modes?: Array<GroupRollupMode> | null,
|
|
66
|
+
/**
|
|
67
|
+
* Split-rollup modes the plugin accepts, in preference order.
|
|
68
|
+
* The first entry that matches a feature flag becomes the default.
|
|
69
|
+
*/
|
|
70
|
+
split_rollup_modes?: Array<SplitRollupMode> | null,
|
|
65
71
|
/**
|
|
66
72
|
* Plugin load priority. Higher numbers win; ties resolve in
|
|
67
73
|
* registration order. The highest-priority plugin is loaded by
|
|
@@ -75,4 +81,33 @@ priority?: number | null,
|
|
|
75
81
|
* the per-column field set. When `false` or omitted, no StyleTab
|
|
76
82
|
* is shown.
|
|
77
83
|
*/
|
|
78
|
-
can_render_column_styles?: boolean,
|
|
84
|
+
can_render_column_styles?: boolean,
|
|
85
|
+
/**
|
|
86
|
+
* What `group_by` MEANS visually for this plugin, e.g. `"X Axis"`
|
|
87
|
+
* for the Y-series charts or `"Hierarchy"` for treemap/sunburst.
|
|
88
|
+
* `None` where the field has no visual role of its own and is a
|
|
89
|
+
* plain aggregation key (the X/Y charts, whose axes both come from
|
|
90
|
+
* `columns`).
|
|
91
|
+
*
|
|
92
|
+
* This is the `group_by` counterpart of [`Self::config_column_names`]:
|
|
93
|
+
* the same declaration that names the positional `columns` slots
|
|
94
|
+
* should say what the other view fields draw, so that consumers —
|
|
95
|
+
* the settings UI's field labels, and the agent's `list_plugins`
|
|
96
|
+
* contract — read one source instead of restating the mapping.
|
|
97
|
+
*/
|
|
98
|
+
group_by_role?: string | null,
|
|
99
|
+
/**
|
|
100
|
+
* What `split_by` MEANS visually for this plugin, e.g. `"Series"`.
|
|
101
|
+
* See [`Self::group_by_role`].
|
|
102
|
+
*/
|
|
103
|
+
split_by_role?: string | null,
|
|
104
|
+
/**
|
|
105
|
+
* `true` when this plugin CONNECTS its points in row order, so the
|
|
106
|
+
* `View`'s row order is visible in the drawing: an unsorted config
|
|
107
|
+
* renders the table's natural order, which reads as a tangle unless
|
|
108
|
+
* the rows already arrive ordered along the axis. Declared rather
|
|
109
|
+
* than inferred, because "unsorted" is not itself a mistake — a
|
|
110
|
+
* pre-ordered table needs no `sort`, and the point plugins
|
|
111
|
+
* (scatter, density) do not care at all.
|
|
112
|
+
*/
|
|
113
|
+
connects_row_order?: boolean, };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for the `restore()` method.
|
|
5
|
+
*/
|
|
6
|
+
export type RestoreOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* The target panel; the active panel when omitted.
|
|
9
|
+
*/
|
|
10
|
+
panel?: string,
|
|
11
|
+
/**
|
|
12
|
+
* When `true`, a failed restore only REJECTS the returned `Promise` —
|
|
13
|
+
* the error is not committed to the viewer's visible error state, and
|
|
14
|
+
* the session remains usable for subsequent calls. For programmatic
|
|
15
|
+
* callers (e.g. the LLM agent's `set_view_config` tool) for whom a
|
|
16
|
+
* failed config patch is feedback rather than a user-facing fault.
|
|
17
|
+
* The config may be partially applied on failure; restore a
|
|
18
|
+
* known-good config to recover exactly.
|
|
19
|
+
*/
|
|
20
|
+
suppress_errors?: boolean, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { SimpleDatetimeFormat } from "./SimpleDatetimeFormat.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A datetime column's `date_format` in its `Simple` preset form:
|
|
6
|
+
* `Intl.DateTimeFormatOptions`' `dateStyle`/`timeStyle` presets. This is
|
|
7
|
+
* the default form (no `format` key); setting `format: "custom"` selects
|
|
8
|
+
* the per-part `CustomDatetimeStyleConfig` instead.
|
|
9
|
+
*/
|
|
10
|
+
export type SimpleDatetimeStyleConfig = {
|
|
11
|
+
/**
|
|
12
|
+
* An IANA time zone name (e.g. `"America/New_York"`); defaults to the
|
|
13
|
+
* browser's local time zone.
|
|
14
|
+
*/
|
|
15
|
+
timeZone?: string | null,
|
|
16
|
+
/**
|
|
17
|
+
* Date preset breadth, or `"disabled"` to omit the date entirely;
|
|
18
|
+
* defaults to `"short"`.
|
|
19
|
+
*/
|
|
20
|
+
dateStyle?: SimpleDatetimeFormat,
|
|
21
|
+
/**
|
|
22
|
+
* Time preset breadth, or `"disabled"` to omit the time entirely;
|
|
23
|
+
* defaults to `"medium"`.
|
|
24
|
+
*/
|
|
25
|
+
timeStyle?: SimpleDatetimeFormat, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The `split_by` corollary to [`GroupRollupMode`]. `Flat` (the default,
|
|
5
|
+
* matching this crate's historical behavior) emits only full-depth split
|
|
6
|
+
* combinations as columns; `Rollup` additionally emits grand-total and
|
|
7
|
+
* subtotal column groups in "totals before" order. There is no `Total`
|
|
8
|
+
* variant - an empty `split_by` already expresses a single grand-total
|
|
9
|
+
* column group.
|
|
10
|
+
*/
|
|
11
|
+
export type SplitRollupMode = "flat" | "rollup";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
|
|
3
|
+
export type Unit = "acre" | "bit" | "byte" | "celsius" | "centimeter" | "day" | "degree" | "fahrenheit" | "fluid-ounce" | "foot" | "gallob" | "gigabit" | "gigabyte" | "gram" | "hectare" | "hour" | "inch" | "kilobit" | "kilobyte" | "kilogram" | "kilometer" | "liter" | "megabit" | "megabyte" | "meter" | "microsecond" | "mile" | "mile-scandinavian" | "milliliter" | "millimeter" | "millisecond" | "minute" | "month" | "nanosecond" | "ounce" | "percent" | "petabyte" | "pound" | "second" | "stone" | "terabit" | "terabyte" | "week" | "yard" | "year";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { Unit } from "./Unit.js";
|
|
3
|
+
import type { UnitDisplay } from "./UnitDisplay.js";
|
|
4
|
+
|
|
5
|
+
export type UnitNumberFormatStyle = { unit: Unit, unitDisplay: UnitDisplay | null, };
|
|
@@ -5,6 +5,8 @@ import type { Filter } from "./Filter.js";
|
|
|
5
5
|
import type { FilterReducer } from "./FilterReducer.js";
|
|
6
6
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
7
7
|
import type { Sort } from "./Sort.js";
|
|
8
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
9
|
+
import type { Windows } from "./Windows.js";
|
|
8
10
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -15,4 +17,49 @@ import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
|
15
17
|
* state there, carried by the top-level `active` field instead), while the
|
|
16
18
|
* single-panel format flattens back to the legacy shape.
|
|
17
19
|
*/
|
|
18
|
-
export type ViewerConfig<V = string> = { settings: boolean,
|
|
20
|
+
export type ViewerConfig<V = string> = { settings: boolean,
|
|
21
|
+
/**
|
|
22
|
+
* The `@perspective-dev/viewer` version that wrote this config,
|
|
23
|
+
* stamped on save and used to migrate older tokens. Callers do not
|
|
24
|
+
* set it.
|
|
25
|
+
*/
|
|
26
|
+
version: V,
|
|
27
|
+
/**
|
|
28
|
+
* Per-column styling, keyed by column name. The viewer treats the
|
|
29
|
+
* values as opaque — their shape is defined by the ACTIVE plugin,
|
|
30
|
+
* so a config written for one plugin may carry keys another
|
|
31
|
+
* ignores. Query the live shape with the `get_style_schema` agent
|
|
32
|
+
* tool, or the plugin's `column_config_schema()`.
|
|
33
|
+
*/
|
|
34
|
+
columns_config: { [key in string]?: { [key in string]?: JsonValue } },
|
|
35
|
+
/**
|
|
36
|
+
* Name of the visualization plugin, from the set registered on the
|
|
37
|
+
* page (the `list_plugins` agent tool, or the plugin picker). This
|
|
38
|
+
* also decides what the view fields MEAN visually: `columns` is
|
|
39
|
+
* positional and each plugin reads the positions differently, and
|
|
40
|
+
* `group_by`/`split_by` draw different things per plugin.
|
|
41
|
+
*/
|
|
42
|
+
plugin: string,
|
|
43
|
+
/**
|
|
44
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
45
|
+
* [`Self::columns_config`]). Opaque to the viewer and defined by
|
|
46
|
+
* the active plugin; see `get_style_schema`.
|
|
47
|
+
*/
|
|
48
|
+
plugin_config: { [key in string]?: JsonValue },
|
|
49
|
+
/**
|
|
50
|
+
* Name of the `Table` this panel renders, as hosted on the panel's
|
|
51
|
+
* `Client`. Every placed panel has a table binding (creation
|
|
52
|
+
* requires one by type — [`ViewerConfigInitial`]), so the saved
|
|
53
|
+
* config carries it unconditionally.
|
|
54
|
+
*/
|
|
55
|
+
table: string,
|
|
56
|
+
/**
|
|
57
|
+
* Selected theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid
|
|
58
|
+
* names are the Perspective themes loaded on the page, which
|
|
59
|
+
* `resetThemes()` re-scans. `None` selects the first available.
|
|
60
|
+
*/
|
|
61
|
+
theme: string | null,
|
|
62
|
+
/**
|
|
63
|
+
* Panel title, shown in its tab. `None` renders the default title.
|
|
64
|
+
*/
|
|
65
|
+
title: string | null, group_by: Array<string>, split_by: Array<string>, sort: Array<Sort>, filter: Array<Filter>, group_rollup_mode: GroupRollupMode, split_rollup_mode: SplitRollupMode, filter_op?: FilterReducer, expressions: Expressions, windows?: Windows, columns: Array<string | null>, aggregates: { [key in string]?: Aggregate }, group_by_depth?: number | null, };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { Aggregate } from "./Aggregate.js";
|
|
3
|
+
import type { Expressions } from "./Expressions.js";
|
|
4
|
+
import type { Filter } from "./Filter.js";
|
|
5
|
+
import type { FilterReducer } from "./FilterReducer.js";
|
|
6
|
+
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
7
|
+
import type { Sort } from "./Sort.js";
|
|
8
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
9
|
+
import type { Windows } from "./Windows.js";
|
|
10
|
+
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The initial configuration of a NEW panel (`addPanel`, `restore`'s
|
|
14
|
+
* panel-creating upsert, `restoreWorkspace` `panels` entries). Unlike
|
|
15
|
+
* [`ViewerConfigUpdate`] — a patch against existing state — creation has
|
|
16
|
+
* no prior state: `table` is REQUIRED (a placed panel without a table
|
|
17
|
+
* binding would be permanently blank), absent fields mean "default"
|
|
18
|
+
* rather than "leave unchanged" (so no [`OptionalUpdate`] tri-state), and
|
|
19
|
+
* there is no `settings` field (element-level, not per-panel).
|
|
20
|
+
*/
|
|
21
|
+
export type ViewerConfigInitial = {
|
|
22
|
+
/**
|
|
23
|
+
* Name of the `Table` the new panel renders, as hosted on the
|
|
24
|
+
* `Client`. REQUIRED: a placed panel with no table binding would be
|
|
25
|
+
* permanently blank.
|
|
26
|
+
*/
|
|
27
|
+
table: string,
|
|
28
|
+
/**
|
|
29
|
+
* The `@perspective-dev/viewer` version a saved config was written
|
|
30
|
+
* by. Omit it when creating a panel.
|
|
31
|
+
*/
|
|
32
|
+
version?: string,
|
|
33
|
+
/**
|
|
34
|
+
* Name of the visualization plugin, from the set registered on the
|
|
35
|
+
* page (the `list_plugins` agent tool, or the plugin picker).
|
|
36
|
+
* Decides what the view fields MEAN: `columns` is positional and
|
|
37
|
+
* every plugin reads the positions differently, and
|
|
38
|
+
* `group_by`/`split_by` draw different things per plugin. Absent
|
|
39
|
+
* uses the default plugin.
|
|
40
|
+
*/
|
|
41
|
+
plugin?: string,
|
|
42
|
+
/**
|
|
43
|
+
* Panel title, shown in its tab. Absent renders the default title.
|
|
44
|
+
*/
|
|
45
|
+
title?: string,
|
|
46
|
+
/**
|
|
47
|
+
* Theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid names are
|
|
48
|
+
* the Perspective themes loaded on the page. Absent uses the
|
|
49
|
+
* default.
|
|
50
|
+
*/
|
|
51
|
+
theme?: string,
|
|
52
|
+
/**
|
|
53
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
54
|
+
* [`Self::columns_config`]). Opaque to the viewer and defined by
|
|
55
|
+
* the ACTIVE plugin; query the valid keys with `get_style_schema`
|
|
56
|
+
* rather than guessing.
|
|
57
|
+
*/
|
|
58
|
+
plugin_config?: { [key in string]?: JsonValue },
|
|
59
|
+
/**
|
|
60
|
+
* Per-column styling — formatting, colors, and other per-column
|
|
61
|
+
* controls — keyed by column name. Plugin-defined like
|
|
62
|
+
* [`Self::plugin_config`]; see `get_style_schema`.
|
|
63
|
+
*/
|
|
64
|
+
columns_config?: { [key in string]?: { [key in string]?: JsonValue } },
|
|
65
|
+
/**
|
|
66
|
+
* A group by _groups_ the dataset by the unique values of each column used
|
|
67
|
+
* as a group by - a close analogue in SQL to the `GROUP BY` statement.
|
|
68
|
+
* The underlying dataset is aggregated to show the values belonging to
|
|
69
|
+
* each group, and a total row is calculated for each group, showing
|
|
70
|
+
* the currently selected aggregated value (e.g. `sum`) of the column.
|
|
71
|
+
* Group by are useful for hierarchies, categorizing data and
|
|
72
|
+
* attributing values, i.e. showing the number of units sold based on
|
|
73
|
+
* State and City. In Perspective, group by are represented as an array
|
|
74
|
+
* of string column names to pivot, are applied in the order provided;
|
|
75
|
+
* For example, a group by of `["State", "City", "Postal Code"]` shows
|
|
76
|
+
* the values for each Postal Code, which are grouped by City,
|
|
77
|
+
* which are in turn grouped by State.
|
|
78
|
+
*/
|
|
79
|
+
group_by?: Array<string>,
|
|
80
|
+
/**
|
|
81
|
+
* A split by _splits_ the dataset by the unique values of each column used
|
|
82
|
+
* as a split by. The underlying dataset is not aggregated, and a new
|
|
83
|
+
* column is created for each unique value of the split by. Each newly
|
|
84
|
+
* created column contains the parts of the dataset that correspond to
|
|
85
|
+
* the column header, i.e. a `View` that has `["State"]` as its split
|
|
86
|
+
* by will have a new column for each state. In Perspective, Split By
|
|
87
|
+
* are represented as an array of string column names to pivot.
|
|
88
|
+
*/
|
|
89
|
+
split_by?: Array<string>,
|
|
90
|
+
/**
|
|
91
|
+
* The `columns` property specifies which columns should be included in the
|
|
92
|
+
* [`crate::View`]'s output. This allows users to show or hide a specific
|
|
93
|
+
* subset of columns, as well as control the order in which columns
|
|
94
|
+
* appear to the user. This is represented in Perspective as an array
|
|
95
|
+
* of string column names.
|
|
96
|
+
*/
|
|
97
|
+
columns?: Array<string | null>,
|
|
98
|
+
/**
|
|
99
|
+
* The `filter` property specifies columns on which the query can be
|
|
100
|
+
* filtered, returning rows that pass the specified filter condition.
|
|
101
|
+
* This is analogous to the `WHERE` clause in SQL. There is no limit on
|
|
102
|
+
* the number of columns where `filter` is applied, but the resulting
|
|
103
|
+
* dataset is one that passes all the filter conditions, i.e. the
|
|
104
|
+
* filters are joined with an `AND` condition.
|
|
105
|
+
*
|
|
106
|
+
* Perspective represents `filter` as an array of arrays, with the values
|
|
107
|
+
* of each inner array being a string column name, a string filter
|
|
108
|
+
* operator, and a filter operand in the type of the column.
|
|
109
|
+
*/
|
|
110
|
+
filter?: Array<Filter>,
|
|
111
|
+
/**
|
|
112
|
+
* The `sort` property specifies columns on which the query should be
|
|
113
|
+
* sorted, analogous to `ORDER BY` in SQL. A column can be sorted
|
|
114
|
+
* regardless of its data type, and sorts can be applied in ascending
|
|
115
|
+
* or descending order. Perspective represents `sort` as an array of
|
|
116
|
+
* arrays, with the values of each inner array being a string column
|
|
117
|
+
* name and a string sort direction. When `column-pivots` are applied,
|
|
118
|
+
* the additional sort directions `"col asc"` and `"col desc"` will
|
|
119
|
+
* determine the order of pivot columns groups.
|
|
120
|
+
*
|
|
121
|
+
* `sort` is the ONLY thing that orders a `View`'s rows — without it
|
|
122
|
+
* they keep the `Table`'s natural (insertion) order, which any
|
|
123
|
+
* consumer reading rows sequentially will reflect. Not to be
|
|
124
|
+
* confused with a window column's `order_by`, which orders rows
|
|
125
|
+
* WITHIN a window frame and does not reorder the `View`.
|
|
126
|
+
*/
|
|
127
|
+
sort?: Array<Sort>,
|
|
128
|
+
/**
|
|
129
|
+
* The `expressions` property specifies _new_ columns in Perspective that
|
|
130
|
+
* are created using existing column values or arbitary scalar values
|
|
131
|
+
* defined within the expression. In `<perspective-viewer>`,
|
|
132
|
+
* expressions are added using the "New Column" button in the side
|
|
133
|
+
* panel.
|
|
134
|
+
*/
|
|
135
|
+
expressions?: Expressions,
|
|
136
|
+
/**
|
|
137
|
+
* The `windows` property declares ordered, partitioned rolling
|
|
138
|
+
* computations (moving aggregates, cumulative sums) as _new_ columns
|
|
139
|
+
* keyed by output alias (`{"name": {...spec}}`, symmetric with
|
|
140
|
+
* `expressions`), analogous to SQL window functions. See
|
|
141
|
+
* [`crate::config::WindowSpec`].
|
|
142
|
+
*/
|
|
143
|
+
windows?: Windows,
|
|
144
|
+
/**
|
|
145
|
+
* Aggregates perform a calculation over an entire column, and are
|
|
146
|
+
* displayed when one or more [Group By](#group-by) are applied to the
|
|
147
|
+
* `View`. Aggregates can be specified by the user, or Perspective will
|
|
148
|
+
* use the following sensible default aggregates based on column type:
|
|
149
|
+
*
|
|
150
|
+
* - "sum" for `integer` and `float` columns
|
|
151
|
+
* - "count" for all other columns
|
|
152
|
+
*
|
|
153
|
+
* Perspective provides a selection of aggregate functions that can be
|
|
154
|
+
* applied to columns in the `View` constructor using a dictionary of
|
|
155
|
+
* column name to aggregate function name.
|
|
156
|
+
*
|
|
157
|
+
* An aggregate also determines the column's RESULT TYPE, which need
|
|
158
|
+
* not match the input: `"count"` yields an `integer` whatever it
|
|
159
|
+
* counts, so a `date` column left on the default `"count"` is an
|
|
160
|
+
* `integer` in the resulting `View` — no longer a date. Set an
|
|
161
|
+
* aggregate that preserves the type (e.g. `"any"`, `"last"`) when
|
|
162
|
+
* the original type matters, such as a date used as a chart axis.
|
|
163
|
+
*/
|
|
164
|
+
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, split_rollup_mode?: SplitRollupMode, };
|
|
@@ -6,9 +6,67 @@ import type { FilterReducer } from "./FilterReducer.js";
|
|
|
6
6
|
import type { GroupRollupMode } from "./GroupRollupMode.js";
|
|
7
7
|
import type { OptionalUpdate } from "./OptionalUpdate.js";
|
|
8
8
|
import type { Sort } from "./Sort.js";
|
|
9
|
+
import type { SplitRollupMode } from "./SplitRollupMode.js";
|
|
10
|
+
import type { Windows } from "./Windows.js";
|
|
9
11
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
10
12
|
|
|
11
|
-
export type ViewerConfigUpdate = {
|
|
13
|
+
export type ViewerConfigUpdate = {
|
|
14
|
+
/**
|
|
15
|
+
* The `@perspective-dev/viewer` version a saved config was written
|
|
16
|
+
* by, used to migrate older tokens. Omit it — the viewer stamps
|
|
17
|
+
* the current version on save.
|
|
18
|
+
*/
|
|
19
|
+
version?: OptionalUpdate<string>,
|
|
20
|
+
/**
|
|
21
|
+
* Name of the visualization plugin to switch to, from the set
|
|
22
|
+
* registered on the page (the `list_plugins` agent tool, or the
|
|
23
|
+
* plugin picker). Changing it changes what the view fields MEAN:
|
|
24
|
+
* `columns` is positional and every plugin reads the positions
|
|
25
|
+
* differently, and `group_by`/`split_by` draw different things per
|
|
26
|
+
* plugin — so read the new plugin's roles before writing `columns`
|
|
27
|
+
* for it.
|
|
28
|
+
*/
|
|
29
|
+
plugin?: OptionalUpdate<string>,
|
|
30
|
+
/**
|
|
31
|
+
* Panel title, shown in its tab. `null` restores the default
|
|
32
|
+
* title; omitting the field leaves the current one.
|
|
33
|
+
*/
|
|
34
|
+
title?: OptionalUpdate<string>,
|
|
35
|
+
/**
|
|
36
|
+
* Name of the `Table` to render, as hosted on this panel's
|
|
37
|
+
* `Client`. Rebinding an existing panel to another table keeps the
|
|
38
|
+
* rest of the config, so column names that do not exist in the new
|
|
39
|
+
* table will fail validation.
|
|
40
|
+
*/
|
|
41
|
+
table?: OptionalUpdate<string>,
|
|
42
|
+
/**
|
|
43
|
+
* Theme NAME (e.g. `"Pro Dark"`) — not a CSS value. Valid names are
|
|
44
|
+
* the Perspective themes loaded on the page, re-scanned by
|
|
45
|
+
* `resetThemes()`. `null` selects the default.
|
|
46
|
+
*/
|
|
47
|
+
theme?: OptionalUpdate<string>,
|
|
48
|
+
/**
|
|
49
|
+
* Whether the settings sidebar is OPEN. Purely cosmetic chrome —
|
|
50
|
+
* it does not affect what the viewer renders, and it is
|
|
51
|
+
* element-level rather than per-panel.
|
|
52
|
+
*/
|
|
53
|
+
settings?: OptionalUpdate<boolean>,
|
|
54
|
+
/**
|
|
55
|
+
* Plugin-wide settings (as opposed to the per-column
|
|
56
|
+
* [`Self::columns_config`]). The viewer passes these through
|
|
57
|
+
* opaquely — their valid keys are defined by the ACTIVE plugin and
|
|
58
|
+
* vary by plugin and by state, so query them with the
|
|
59
|
+
* `get_style_schema` agent tool rather than guessing.
|
|
60
|
+
*/
|
|
61
|
+
plugin_config?: OptionalUpdate<{ [key in string]?: JsonValue }>,
|
|
62
|
+
/**
|
|
63
|
+
* Per-column styling — formatting, colors, and other per-column
|
|
64
|
+
* controls — keyed by column name. Opaque to the viewer and
|
|
65
|
+
* plugin-defined like [`Self::plugin_config`]; `get_style_schema`
|
|
66
|
+
* reports the valid keys for a given column under the active
|
|
67
|
+
* plugin.
|
|
68
|
+
*/
|
|
69
|
+
columns_config?: OptionalUpdate<{ [key in string]?: { [key in string]?: JsonValue } }>,
|
|
12
70
|
/**
|
|
13
71
|
* A group by _groups_ the dataset by the unique values of each column used
|
|
14
72
|
* as a group by - a close analogue in SQL to the `GROUP BY` statement.
|
|
@@ -64,6 +122,12 @@ filter?: Array<Filter>,
|
|
|
64
122
|
* name and a string sort direction. When `column-pivots` are applied,
|
|
65
123
|
* the additional sort directions `"col asc"` and `"col desc"` will
|
|
66
124
|
* determine the order of pivot columns groups.
|
|
125
|
+
*
|
|
126
|
+
* `sort` is the ONLY thing that orders a `View`'s rows — without it
|
|
127
|
+
* they keep the `Table`'s natural (insertion) order, which any
|
|
128
|
+
* consumer reading rows sequentially will reflect. Not to be
|
|
129
|
+
* confused with a window column's `order_by`, which orders rows
|
|
130
|
+
* WITHIN a window frame and does not reorder the `View`.
|
|
67
131
|
*/
|
|
68
132
|
sort?: Array<Sort>,
|
|
69
133
|
/**
|
|
@@ -74,6 +138,14 @@ sort?: Array<Sort>,
|
|
|
74
138
|
* panel.
|
|
75
139
|
*/
|
|
76
140
|
expressions?: Expressions,
|
|
141
|
+
/**
|
|
142
|
+
* The `windows` property declares ordered, partitioned rolling
|
|
143
|
+
* computations (moving aggregates, cumulative sums) as _new_ columns
|
|
144
|
+
* keyed by output alias (`{"name": {...spec}}`, symmetric with
|
|
145
|
+
* `expressions`), analogous to SQL window functions. See
|
|
146
|
+
* [`crate::config::WindowSpec`].
|
|
147
|
+
*/
|
|
148
|
+
windows?: Windows,
|
|
77
149
|
/**
|
|
78
150
|
* Aggregates perform a calculation over an entire column, and are
|
|
79
151
|
* displayed when one or more [Group By](#group-by) are applied to the
|
|
@@ -86,5 +158,12 @@ expressions?: Expressions,
|
|
|
86
158
|
* Perspective provides a selection of aggregate functions that can be
|
|
87
159
|
* applied to columns in the `View` constructor using a dictionary of
|
|
88
160
|
* column name to aggregate function name.
|
|
161
|
+
*
|
|
162
|
+
* An aggregate also determines the column's RESULT TYPE, which need
|
|
163
|
+
* not match the input: `"count"` yields an `integer` whatever it
|
|
164
|
+
* counts, so a `date` column left on the default `"count"` is an
|
|
165
|
+
* `integer` in the resulting `View` — no longer a date. Set an
|
|
166
|
+
* aggregate that preserves the type (e.g. `"any"`, `"last"`) when
|
|
167
|
+
* the original type matters, such as a date used as a chart axis.
|
|
89
168
|
*/
|
|
90
|
-
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, };
|
|
169
|
+
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, group_rollup_mode?: GroupRollupMode, split_rollup_mode?: SplitRollupMode, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { WindowSortDir } from "./WindowSortDir.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The `Table` column which orders each partition, with its direction -
|
|
6
|
+
* serialized as a two-element array (`["ts", "desc"]`), symmetric with the
|
|
7
|
+
* `ViewConfig`'s `sort` field.
|
|
8
|
+
*/
|
|
9
|
+
export type WindowSort = [string, WindowSortDir];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A window's order direction. A dedicated two-variant enum rather than
|
|
5
|
+
* [`crate::config::SortDir`] - the column-sort extras (`col asc`, `abs`,
|
|
6
|
+
* `none`) are meaningless inside a window frame and unrepresentable here.
|
|
7
|
+
*/
|
|
8
|
+
export type WindowSortDir = "asc" | "desc";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { WindowSort } from "./WindowSort.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The serialized form of [`WindowSpec`].
|
|
6
|
+
*/
|
|
7
|
+
export type WindowSpec = {
|
|
8
|
+
/**
|
|
9
|
+
* The input column - either a real `Table` column or an expression
|
|
10
|
+
* alias from the same `ViewConfig`.
|
|
11
|
+
*/
|
|
12
|
+
column: string, aggregate: string,
|
|
13
|
+
/**
|
|
14
|
+
* Columns whose distinct value tuples partition the rows; empty
|
|
15
|
+
* partitions the whole `Table` as one group.
|
|
16
|
+
*/
|
|
17
|
+
partition_by?: Array<string>,
|
|
18
|
+
/**
|
|
19
|
+
* The `Table` column which orders each partition, and the direction.
|
|
20
|
+
* This orders rows WITHIN the window frame only — it does not
|
|
21
|
+
* reorder the `View`, which is what the view-level `sort` does.
|
|
22
|
+
*/
|
|
23
|
+
order_by?: WindowSort | null,
|
|
24
|
+
/**
|
|
25
|
+
* A frame of the `rows` preceding each row, plus the row itself.
|
|
26
|
+
* Mutually exclusive with `range` and `cumulative`.
|
|
27
|
+
*/
|
|
28
|
+
rows?: number | null,
|
|
29
|
+
/**
|
|
30
|
+
* A frame of the rows whose `order_by` value lies within `range` of
|
|
31
|
+
* each row's, requiring a numeric or temporal `order_by`. Mutually
|
|
32
|
+
* exclusive with `rows` and `cumulative`.
|
|
33
|
+
*/
|
|
34
|
+
range?: number | null,
|
|
35
|
+
/**
|
|
36
|
+
* `true` frames all rows from the partition start through each row.
|
|
37
|
+
* Default can be omitted.
|
|
38
|
+
*/
|
|
39
|
+
cumulative?: boolean | null,
|
|
40
|
+
/**
|
|
41
|
+
* Row offset for `lag`/`lead` (default 1).
|
|
42
|
+
*/
|
|
43
|
+
offset?: number | null,
|
|
44
|
+
/**
|
|
45
|
+
* Smoothing factor in `(0, 1]` for `ema`.
|
|
46
|
+
*/
|
|
47
|
+
alpha?: number | null, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { WindowSpec } from "./WindowSpec.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The window columns of a `ViewConfig`, keyed by output column alias -
|
|
6
|
+
* symmetric with `expressions` (`{"name": {...spec}}`). An alias must not
|
|
7
|
+
* collide with a `Table` column, expression alias, or another window's
|
|
8
|
+
* key.
|
|
9
|
+
*/
|
|
10
|
+
export type Windows = { [key in string]?: WindowSpec };
|