serverside_pivot 0.0.96 → 0.0.98
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 -4
- package/dist/react/chunks/ContextMenu-DQGCdUhU.mjs +211 -0
- package/dist/react/chunks/{DetailDrawer-DgKSC5Vu.mjs → DetailDrawer-yMFRd6Td.mjs} +1 -1
- package/dist/react/chunks/{DetailSidePanel-CC5Dugyl.mjs → DetailSidePanel-B6fYMnn7.mjs} +1 -1
- package/dist/react/chunks/{DetailSurfaceContent-CrQVHlcU.mjs → DetailSurfaceContent-B9cfLYti.mjs} +1 -1
- package/dist/react/chunks/{ECharts2dRenderer-46gLrUdf.mjs → ECharts2dRenderer-ER6rHtch.mjs} +1 -1
- package/dist/react/chunks/{ECharts3dRenderer-Dg4ta5Bl.mjs → ECharts3dRenderer-BMVfbpXH.mjs} +1 -1
- package/dist/react/chunks/{EditSidePanel-CkShaByb.mjs → EditSidePanel-BjJd5BaX.mjs} +1 -1
- package/dist/react/chunks/{InlineDetailPanel-mnwjoD0I.mjs → InlineDetailPanel-Bbkpv9jz.mjs} +1 -1
- package/dist/react/chunks/{PivotCharts-MX-Z7DlR.mjs → PivotCharts-P5cBJcwu.mjs} +5 -3
- package/dist/react/chunks/{ReportEditor-U0E42xKL.mjs → ReportEditor-P4UZ97Ik.mjs} +174 -175
- package/dist/react/chunks/{SidebarPanel-BzRW1Kgq.mjs → SidebarPanel-DRoxHRhK.mjs} +1039 -1024
- package/dist/react/chunks/{SparklineDetailGraph-35Tim_8B.mjs → SparklineDetailGraph-C9UX-feP.mjs} +22 -22
- package/dist/react/chunks/clientCoreRuntime-n2guUxhp.mjs +790 -0
- package/dist/react/chunks/{installCanvasRenderer-DRq0xpXO.mjs → installCanvasRenderer-BR0XmdVX.mjs} +1 -1
- package/dist/react/chunks/{react-CL4GbEOd.mjs → react-B5JcZShu.mjs} +17394 -13825
- package/dist/react/chunks/{xlsx.mini.min-kfIgXMVB.mjs → xlsx.mini.min-YUTWASKG.mjs} +1 -1
- package/dist/react/components/DashTanstackPivot.react.d.ts +6 -0
- package/dist/react/components/GlobalSearchInput.d.ts +17 -0
- package/dist/react/components/LiveCellDisplay.d.ts +25 -0
- package/dist/react/components/LiveExplainSidePanel.d.ts +15 -0
- package/dist/react/components/LiveStreamDiffBar.d.ts +15 -0
- package/dist/react/hooks/useDismiss.d.ts +43 -0
- package/dist/react/hooks/usePivotNormalization.d.ts +4 -0
- package/dist/react/hooks/usePrefersReducedMotion.d.ts +8 -0
- package/dist/react/hooks/useRenderHelpers.d.ts +1 -1
- package/dist/react/hooks/useRowCache.d.ts +2 -0
- package/dist/react/hooks/useServerSideRowModel.d.ts +1 -1
- package/dist/react/index.mjs +28 -19
- package/dist/react/react.d.ts +6 -1
- package/dist/react/runtime/client/clientPivotTransport.d.ts +16 -0
- package/dist/react/runtime/client/clientResponsePostProcessor.d.ts +8 -1
- package/dist/react/runtime/client/clientSubscriptionEngine.d.ts +88 -0
- package/dist/react/runtime/client/duckdbWasmExecutor.d.ts +22 -0
- package/dist/react/runtime/client/index.d.ts +1 -0
- package/dist/react/runtime/client/types.d.ts +6 -0
- package/dist/react/runtime/core/clientCoreRuntime.d.ts +46 -0
- package/dist/react/runtime/core/duckdbSqlEmitter.d.ts +37 -0
- package/dist/react/runtime/core/semanticIr.generated.d.ts +196 -0
- package/dist/react/runtime/responseQueue.d.ts +21 -0
- package/dist/react/runtime/rowIdentity.d.ts +20 -0
- package/dist/react/runtime/runtimeDomains.d.ts +8 -1
- package/dist/react/runtime/streamingTypes.d.ts +182 -0
- package/dist/react/runtime/useRuntimeViewportTableData.d.ts +1 -1
- package/dist/react/runtime/useViewportSubscriptionStore.d.ts +112 -0
- package/dist/react/runtime/useWorkspaceStatusPresentation.d.ts +1 -1
- package/dist/react/utils/helpers.d.ts +1 -1
- package/dist/react/utils/pivotLayoutUtils.d.ts +3 -3
- package/dist/react/utils/rowMotion.d.ts +108 -0
- package/dist/react/utils/styles.d.ts +1 -0
- package/package.json +6 -8
- package/dist/react/chunks/ContextMenu-DJuS4qTZ.mjs +0 -198
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
3
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
4
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
5
|
+
*/
|
|
6
|
+
export type Filter = Predicate | Group;
|
|
7
|
+
/**
|
|
8
|
+
* Wire form of the semantic IR (pivot_engine.core.ir.PivotQuery). Shared by the Python core, the TS emitter (M3) and the conformance vectors. Aggregation names come from aggregation-registry.json.
|
|
9
|
+
*/
|
|
10
|
+
export interface PivotQuery {
|
|
11
|
+
dataset?: string;
|
|
12
|
+
rows: string[];
|
|
13
|
+
/**
|
|
14
|
+
* @minItems 1
|
|
15
|
+
*/
|
|
16
|
+
measures: [
|
|
17
|
+
{
|
|
18
|
+
alias: string;
|
|
19
|
+
agg: string;
|
|
20
|
+
field?: string | null;
|
|
21
|
+
weight?: string | null;
|
|
22
|
+
q?: number | null;
|
|
23
|
+
/**
|
|
24
|
+
* first / last (REQ-AGG-008): the field whose smallest / largest value picks the record.
|
|
25
|
+
*/
|
|
26
|
+
orderBy?: string;
|
|
27
|
+
/**
|
|
28
|
+
* REQ-AGG-010: a formula's expression tree {op, args}, evaluated on each node's measures (agg 'formula').
|
|
29
|
+
*/
|
|
30
|
+
expr?: {
|
|
31
|
+
[k: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
...{
|
|
35
|
+
alias: string;
|
|
36
|
+
agg: string;
|
|
37
|
+
field?: string | null;
|
|
38
|
+
weight?: string | null;
|
|
39
|
+
q?: number | null;
|
|
40
|
+
/**
|
|
41
|
+
* first / last (REQ-AGG-008): the field whose smallest / largest value picks the record.
|
|
42
|
+
*/
|
|
43
|
+
orderBy?: string;
|
|
44
|
+
/**
|
|
45
|
+
* REQ-AGG-010: a formula's expression tree {op, args}, evaluated on each node's measures (agg 'formula').
|
|
46
|
+
*/
|
|
47
|
+
expr?: {
|
|
48
|
+
[k: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
}[]
|
|
51
|
+
];
|
|
52
|
+
filters?: Filter[];
|
|
53
|
+
measureFilters?: {
|
|
54
|
+
level: number;
|
|
55
|
+
measure: string;
|
|
56
|
+
op: "=" | "!=" | ">" | ">=" | "<" | "<=";
|
|
57
|
+
value: unknown;
|
|
58
|
+
/**
|
|
59
|
+
* REQ-DIM-006: group by the level's path and every column dimension (a pivot cell's grain). Omitted when false.
|
|
60
|
+
*/
|
|
61
|
+
cells?: boolean;
|
|
62
|
+
}[];
|
|
63
|
+
sort?: {
|
|
64
|
+
field: string;
|
|
65
|
+
desc?: boolean;
|
|
66
|
+
absolute?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* REQ-SORT-003: order a row dimension's members by MIN of this column over each member's records.
|
|
69
|
+
*/
|
|
70
|
+
by?: string;
|
|
71
|
+
/**
|
|
72
|
+
* REQ-SORT-004: order a measure by the node's value within this column member (a pivot cell).
|
|
73
|
+
*/
|
|
74
|
+
member?: unknown[];
|
|
75
|
+
/**
|
|
76
|
+
* REQ-SORT-005: order a text row dimension's members by a key computed from the member value.
|
|
77
|
+
*/
|
|
78
|
+
semantic?: "tenor";
|
|
79
|
+
/**
|
|
80
|
+
* REQ-SORT-006: NULLs before every value, in both directions. Omitted when false.
|
|
81
|
+
*/
|
|
82
|
+
nullsFirst?: boolean;
|
|
83
|
+
}[];
|
|
84
|
+
totals?: "visible" | "all_data";
|
|
85
|
+
/**
|
|
86
|
+
* REQ-LAYOUT-001: a group row before its descendants (pre-order, default) or after them (post-order). 'none' (REQ-LAYOUT-002): no group rows, the leaves as a flat table ordered by the sort entries.
|
|
87
|
+
*/
|
|
88
|
+
subtotals?: "before" | "after" | "none";
|
|
89
|
+
expanded?: [unknown, ...unknown[]][] | null;
|
|
90
|
+
window?: {
|
|
91
|
+
offset?: number;
|
|
92
|
+
limit?: number | null;
|
|
93
|
+
};
|
|
94
|
+
columns?: string[];
|
|
95
|
+
columnMembers?: unknown[][];
|
|
96
|
+
derived?: {
|
|
97
|
+
alias: string;
|
|
98
|
+
func: "ratio" | "percent_of_total" | "rank" | "dense_rank" | "cumulative" | "moving_avg";
|
|
99
|
+
of: string;
|
|
100
|
+
of2?: string | null;
|
|
101
|
+
desc?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* @minItems 2
|
|
104
|
+
* @maxItems 2
|
|
105
|
+
*/
|
|
106
|
+
frame?: [number | null, number | null] | null;
|
|
107
|
+
nullValue?: number | null;
|
|
108
|
+
}[];
|
|
109
|
+
/**
|
|
110
|
+
* REQ-DIM-001: user-defined dimension columns, computed in order before filters. Each record gets the label of the first rule whose condition holds, else the fallback.
|
|
111
|
+
*/
|
|
112
|
+
categories?: {
|
|
113
|
+
name: string;
|
|
114
|
+
rules: {
|
|
115
|
+
when: Filter;
|
|
116
|
+
label: string | number;
|
|
117
|
+
}[];
|
|
118
|
+
fallback: string | number;
|
|
119
|
+
}[];
|
|
120
|
+
/**
|
|
121
|
+
* REQ-DIM-002: the measure axis. Each record becomes one record per member, with the member's label, its source value and its order; applied after the categories, before the row filters.
|
|
122
|
+
*/
|
|
123
|
+
unpivot?: {
|
|
124
|
+
label: string;
|
|
125
|
+
value: string;
|
|
126
|
+
key: string;
|
|
127
|
+
dropNulls?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* @minItems 1
|
|
130
|
+
*/
|
|
131
|
+
members: [
|
|
132
|
+
{
|
|
133
|
+
label: string;
|
|
134
|
+
field: string | null;
|
|
135
|
+
order: number;
|
|
136
|
+
/**
|
|
137
|
+
* REQ-DIM-003: the member's own aggregation (all members or none); the value measure is then agg 'member'.
|
|
138
|
+
*/
|
|
139
|
+
agg?: string;
|
|
140
|
+
weight?: string;
|
|
141
|
+
q?: number;
|
|
142
|
+
orderBy?: string;
|
|
143
|
+
/**
|
|
144
|
+
* REQ-DIM-007: a formula member's expression (agg 'formula', no field).
|
|
145
|
+
*/
|
|
146
|
+
expr?: {
|
|
147
|
+
[k: string]: unknown;
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
...{
|
|
151
|
+
label: string;
|
|
152
|
+
field: string | null;
|
|
153
|
+
order: number;
|
|
154
|
+
/**
|
|
155
|
+
* REQ-DIM-003: the member's own aggregation (all members or none); the value measure is then agg 'member'.
|
|
156
|
+
*/
|
|
157
|
+
agg?: string;
|
|
158
|
+
weight?: string;
|
|
159
|
+
q?: number;
|
|
160
|
+
orderBy?: string;
|
|
161
|
+
/**
|
|
162
|
+
* REQ-DIM-007: a formula member's expression (agg 'formula', no field).
|
|
163
|
+
*/
|
|
164
|
+
expr?: {
|
|
165
|
+
[k: string]: unknown;
|
|
166
|
+
};
|
|
167
|
+
}[]
|
|
168
|
+
];
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* REQ-DIM-005: a ragged hierarchy over these fields; the rows are its positional columns __rag1..n (a NULL there is no node).
|
|
172
|
+
*/
|
|
173
|
+
ragged?: {
|
|
174
|
+
/**
|
|
175
|
+
* @minItems 1
|
|
176
|
+
*/
|
|
177
|
+
fields: [string, ...string[]];
|
|
178
|
+
/**
|
|
179
|
+
* values that count as missing (default: the empty text); NULL and NaN always do
|
|
180
|
+
*/
|
|
181
|
+
missing?: unknown[];
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export interface Predicate {
|
|
185
|
+
field: string;
|
|
186
|
+
op: "!=" | "<" | "<=" | "=" | ">" | ">=" | "between" | "contains" | "ends_with" | "in" | "is_empty" | "is_not_empty" | "is_not_null" | "is_null" | "not_contains" | "not_in" | "starts_with";
|
|
187
|
+
value?: unknown;
|
|
188
|
+
caseSensitive?: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface Group {
|
|
191
|
+
op: "and" | "or";
|
|
192
|
+
/**
|
|
193
|
+
* @minItems 1
|
|
194
|
+
*/
|
|
195
|
+
conditions: [Filter, ...Filter[]];
|
|
196
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ordered delivery of runtime responses (M3).
|
|
3
|
+
*
|
|
4
|
+
* Responses of every kind (data, filter options, chart, detail, export...) reach
|
|
5
|
+
* the UI through one `runtimeResponse` value. Writing it as a single slot loses
|
|
6
|
+
* responses: two arriving in the same tick are batched by React and only the
|
|
7
|
+
* last is ever rendered, so e.g. filter options or a detail page vanish when a
|
|
8
|
+
* viewport response lands with them. The queue delivers each response, in
|
|
9
|
+
* arrival order, for one commit each; consumers keep their per-kind requestId
|
|
10
|
+
* and state-epoch checks, which reject superseded responses.
|
|
11
|
+
*/
|
|
12
|
+
export interface ResponseQueueState<T> {
|
|
13
|
+
head: T | null;
|
|
14
|
+
pending: T[];
|
|
15
|
+
}
|
|
16
|
+
export declare const EMPTY_RESPONSE_QUEUE: ResponseQueueState<never>;
|
|
17
|
+
export declare function enqueueResponse<T>(state: ResponseQueueState<T>, response: T): ResponseQueueState<T>;
|
|
18
|
+
/** After consumers have seen `head`, move to the next pending response (no change when none is pending). */
|
|
19
|
+
export declare function advanceResponse<T>(state: ResponseQueueState<T>): ResponseQueueState<T>;
|
|
20
|
+
/** [response to render, enqueue]. Each queued response is rendered for at least one commit. */
|
|
21
|
+
export declare function useResponseQueue<T>(): [T | null, (response: T) => void];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One row identity for the whole frontend (REQ-ID-001).
|
|
3
|
+
*
|
|
4
|
+
* The canonical key is the typed path encoded by `CanonicalPathCodec`
|
|
5
|
+
* (`_rowKey` from the core, `_canonicalPath` from the live engine; same
|
|
6
|
+
* encoding, "[]" for the grand total). Display paths (`a|||b`) are ambiguous:
|
|
7
|
+
* NULL and "" render alike and members may contain the separator, so they are
|
|
8
|
+
* used only for rows that carry no canonical key (legacy responses).
|
|
9
|
+
*/
|
|
10
|
+
type RowLike = {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
} | null | undefined;
|
|
13
|
+
export declare function canonicalRowKey(row: RowLike): string;
|
|
14
|
+
/** The display path, or null when the row has none ("" is a real, ambiguous display path). */
|
|
15
|
+
export declare function displayRowKey(row: RowLike): string | null;
|
|
16
|
+
/** The key to index and look up a row by: canonical when known, else its display path. */
|
|
17
|
+
export declare function rowIdentity(row: RowLike): string;
|
|
18
|
+
/** Display keys shared by more than one canonical row in a frame (they cannot identify a row). */
|
|
19
|
+
export declare function ambiguousDisplayKeys(rows: RowLike[]): Set<string>;
|
|
20
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { DiffConfig, StreamUpdateBatch, StreamingConfig } from './streamingTypes';
|
|
2
3
|
import type { JsonObject, RuntimeCommandKind, RuntimeRequestV1, RuntimeResponseV1 } from './runtimeContract';
|
|
4
|
+
import type { ViewportSubscriptionStore } from './useViewportSubscriptionStore';
|
|
3
5
|
/** Public Dash props accepted by the runtime root. */
|
|
4
6
|
export interface PivotRuntimeProps {
|
|
5
7
|
id?: string;
|
|
@@ -69,6 +71,7 @@ export interface PivotRuntimeProps {
|
|
|
69
71
|
defaultTheme?: PivotThemeName;
|
|
70
72
|
theme?: PivotThemeName;
|
|
71
73
|
themeOverrides?: PivotThemeOverrides | PivotObject;
|
|
74
|
+
/** Opt in to loading Inter, JetBrains Mono and Plus Jakarta Sans from Google Fonts. Default false: no third-party requests; system UI fonts are used unless the host loads them. */
|
|
72
75
|
loadWebFonts?: boolean;
|
|
73
76
|
immersiveExitPosition?: 'top-right' | 'bottom-right' | 'hidden';
|
|
74
77
|
groupAllowUnbalanced?: boolean;
|
|
@@ -77,7 +80,7 @@ export interface PivotRuntimeProps {
|
|
|
77
80
|
rowHeaderLabel?: string | ((rowFields: readonly string[]) => string);
|
|
78
81
|
valueScale?: number;
|
|
79
82
|
unitSuffix?: string;
|
|
80
|
-
/** Fits
|
|
83
|
+
/** Fits columns to the container using formatted, loaded rows. At the font floor, wide values can require horizontal scrolling. */
|
|
81
84
|
fitToWidth?: boolean | {
|
|
82
85
|
enabled?: boolean;
|
|
83
86
|
minFontSize?: number;
|
|
@@ -96,6 +99,9 @@ export interface PivotRuntimeProps {
|
|
|
96
99
|
activeReportId?: string;
|
|
97
100
|
rowSelection?: 'single' | 'multiple' | boolean;
|
|
98
101
|
selectedRows?: readonly string[];
|
|
102
|
+
streamingConfig?: StreamingConfig;
|
|
103
|
+
streamUpdates?: StreamUpdateBatch;
|
|
104
|
+
diffConfig?: DiffConfig;
|
|
99
105
|
}
|
|
100
106
|
export interface PivotRuntimeRow {
|
|
101
107
|
readonly id?: string | number;
|
|
@@ -701,6 +707,7 @@ export interface WorkspacePresentation {
|
|
|
701
707
|
readonly virtualRows: WorkspaceCollection;
|
|
702
708
|
readonly visibleLeafColumns: WorkspaceCollection;
|
|
703
709
|
readonly zoomLevel: number;
|
|
710
|
+
readonly liveSubscriptionStore?: ViewportSubscriptionStore | null;
|
|
704
711
|
}
|
|
705
712
|
/** Narrow workspace-to-transport port for server chart request scheduling. */
|
|
706
713
|
export interface WorkspaceChartRequestPort {
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol V2 streaming & baseline diff contracts shared across:
|
|
3
|
+
* - Server-side FastAPI SSE (`/v1/runtime/stream` + `/v1/runtime/subscription`)
|
|
4
|
+
* - Server-side Dash same-origin fast-lane (`/_serverside_pivot/subscription`)
|
|
5
|
+
* - Client-side in-browser engine (`ClientSubscriptionEngine` over DuckDB-Wasm / memory)
|
|
6
|
+
*/
|
|
7
|
+
export type DiffDisplayMode = 'value' | 'delta' | 'pctDelta' | 'split';
|
|
8
|
+
export type SortLockMode = 'in_place' | 'live_rank';
|
|
9
|
+
export type SourceCapabilityTier = 'exact_cdc' | 'tier_1_exact_cdc' | 'change_token' | 'tier_2_change_token' | 'time_travel_only' | 'tier_3_time_travel_only' | 'periodic_refresh' | 'tier_4_periodic_refresh';
|
|
10
|
+
export type SubscriptionTransportKind = 'auto' | 'sse' | 'dash' | 'client';
|
|
11
|
+
export interface WireDecimal {
|
|
12
|
+
readonly __decimal__: string;
|
|
13
|
+
readonly scale?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function isWireDecimal(value: unknown): value is WireDecimal;
|
|
16
|
+
/** Decode a Protocol V2 wire value into a JS number (for charts/bars) or keep primitive. */
|
|
17
|
+
export declare function decodeWireNumeric(value: unknown): number | null;
|
|
18
|
+
/** Format an exact WireDecimal string with optional grouping without IEEE-754 rounding loss. */
|
|
19
|
+
export declare function formatWireDecimalString(wire: WireDecimal, decimalPlaces?: number | null): string;
|
|
20
|
+
export interface StreamingConfig {
|
|
21
|
+
readonly enabled?: boolean;
|
|
22
|
+
readonly transport?: SubscriptionTransportKind;
|
|
23
|
+
/** FastAPI subscription endpoint (default `/v1/runtime/subscription`). */
|
|
24
|
+
readonly subscriptionEndpoint?: string;
|
|
25
|
+
/** FastAPI SSE endpoint (default `/v1/runtime/stream`). */
|
|
26
|
+
readonly streamEndpoint?: string;
|
|
27
|
+
/** Dash fast-lane endpoint (default `/_serverside_pivot/subscription`). */
|
|
28
|
+
readonly dashEndpoint?: string;
|
|
29
|
+
/** Flush / poll cadence in milliseconds (default 250). */
|
|
30
|
+
readonly cadenceMs?: number;
|
|
31
|
+
/** Default sort lock mode (`in_place` prevents row jumping during live ticks). */
|
|
32
|
+
readonly sortLock?: SortLockMode;
|
|
33
|
+
/** Enable GPU directional flash animations on cell ticks (default true). */
|
|
34
|
+
readonly flashEnabled?: boolean;
|
|
35
|
+
/** Flash duration in milliseconds (default 550). */
|
|
36
|
+
readonly flashDurationMs?: number;
|
|
37
|
+
/** Show live rolling 30-point sparkline inside cell hover tooltip (default true). */
|
|
38
|
+
readonly showSparklineTooltip?: boolean;
|
|
39
|
+
/** Primary key fields for client-side stream mutation batches. */
|
|
40
|
+
readonly keyFields?: readonly string[];
|
|
41
|
+
/** Optional HTTP headers forwarded to FastAPI endpoints. */
|
|
42
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
43
|
+
}
|
|
44
|
+
export interface DiffConfig {
|
|
45
|
+
readonly enabled?: boolean;
|
|
46
|
+
readonly baselineId?: string | null;
|
|
47
|
+
readonly baselineLabel?: string | null;
|
|
48
|
+
readonly displayMode?: DiffDisplayMode;
|
|
49
|
+
readonly changedOnly?: boolean;
|
|
50
|
+
readonly showPnlExplain?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface StreamUpdateBatch {
|
|
53
|
+
readonly mode?: 'insert' | 'update' | 'upsert' | 'delete';
|
|
54
|
+
readonly rows?: readonly Record<string, unknown>[];
|
|
55
|
+
readonly keyFields?: readonly string[];
|
|
56
|
+
readonly batchId?: string | number;
|
|
57
|
+
}
|
|
58
|
+
export interface VarianceDriver {
|
|
59
|
+
readonly path: string;
|
|
60
|
+
readonly label: string;
|
|
61
|
+
readonly delta: unknown;
|
|
62
|
+
readonly pctDelta?: number | null;
|
|
63
|
+
}
|
|
64
|
+
export interface BaselineCellDiff {
|
|
65
|
+
readonly baselineValue: unknown;
|
|
66
|
+
readonly delta: unknown;
|
|
67
|
+
readonly pctDelta: number | null;
|
|
68
|
+
readonly deltaUnit?: 'abs' | 'pp';
|
|
69
|
+
}
|
|
70
|
+
export interface StreamCellPatch {
|
|
71
|
+
readonly rowKey: string;
|
|
72
|
+
readonly displayPath?: string;
|
|
73
|
+
readonly colId: string;
|
|
74
|
+
readonly value: unknown;
|
|
75
|
+
readonly prevValue?: unknown;
|
|
76
|
+
readonly delta?: unknown;
|
|
77
|
+
readonly pctDelta?: number | null;
|
|
78
|
+
readonly direction?: 'up' | 'down' | 'flat' | null;
|
|
79
|
+
readonly baseline?: BaselineCellDiff | null;
|
|
80
|
+
}
|
|
81
|
+
export interface StreamRowPatch {
|
|
82
|
+
readonly op: 'insert' | 'update' | 'remove';
|
|
83
|
+
readonly rowKey: string;
|
|
84
|
+
readonly displayPath?: string;
|
|
85
|
+
readonly row?: Record<string, unknown>;
|
|
86
|
+
readonly index?: number;
|
|
87
|
+
}
|
|
88
|
+
export interface BaselineDescriptor {
|
|
89
|
+
readonly snapshotId: string;
|
|
90
|
+
readonly label: string;
|
|
91
|
+
readonly kind: 'baseline' | 'freeze_snapshot';
|
|
92
|
+
readonly sourceRevision: number;
|
|
93
|
+
readonly schemaVersion?: string;
|
|
94
|
+
readonly strategy?: string;
|
|
95
|
+
readonly createdAt: number;
|
|
96
|
+
readonly expiresAt?: number;
|
|
97
|
+
readonly immutableVerified?: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface ProtocolV2Frame {
|
|
100
|
+
readonly type: 'SNAPSHOT' | 'PATCH' | 'HEARTBEAT' | 'INVALIDATE' | 'AUTH_REVOKED' | 'ERROR';
|
|
101
|
+
readonly protocolVersion?: number;
|
|
102
|
+
readonly subscriptionId?: string;
|
|
103
|
+
readonly serverEpochId?: string;
|
|
104
|
+
readonly queryEpoch?: number;
|
|
105
|
+
readonly schemaVersion?: string;
|
|
106
|
+
readonly sourceRevision?: number;
|
|
107
|
+
readonly seq?: number;
|
|
108
|
+
readonly baseSeq?: number;
|
|
109
|
+
readonly totalRows?: number;
|
|
110
|
+
readonly rows?: readonly Record<string, unknown>[];
|
|
111
|
+
readonly grandTotal?: Record<string, unknown> | null;
|
|
112
|
+
readonly cellPatches?: readonly StreamCellPatch[];
|
|
113
|
+
readonly rowPatches?: readonly StreamRowPatch[];
|
|
114
|
+
readonly bufferedUpdates?: number;
|
|
115
|
+
readonly paused?: boolean;
|
|
116
|
+
readonly frozenSnapshotId?: string | null;
|
|
117
|
+
readonly baselineId?: string | null;
|
|
118
|
+
readonly baselineLabel?: string | null;
|
|
119
|
+
readonly sortLock?: SortLockMode;
|
|
120
|
+
readonly capabilityTier?: SourceCapabilityTier;
|
|
121
|
+
readonly supportsExactRowDeltas?: boolean;
|
|
122
|
+
readonly reason?: string;
|
|
123
|
+
readonly error?: string;
|
|
124
|
+
readonly timestamp?: number;
|
|
125
|
+
}
|
|
126
|
+
export type RowLifecycleKind = 'normal' | 'new' | 'removed';
|
|
127
|
+
export interface CellLiveMeta {
|
|
128
|
+
readonly rowKey: string;
|
|
129
|
+
readonly colId: string;
|
|
130
|
+
readonly value: unknown;
|
|
131
|
+
readonly prevValue: unknown;
|
|
132
|
+
readonly tickSeq: number;
|
|
133
|
+
readonly tickDir: 'up' | 'down' | null;
|
|
134
|
+
readonly tickDelta: unknown;
|
|
135
|
+
readonly tickPct: number | null;
|
|
136
|
+
readonly baselineValue: unknown;
|
|
137
|
+
readonly baselineDelta: unknown;
|
|
138
|
+
readonly baselinePct: number | null;
|
|
139
|
+
readonly deltaUnit: 'abs' | 'pp';
|
|
140
|
+
readonly sparklineHistory: readonly number[];
|
|
141
|
+
readonly varianceDrivers: readonly VarianceDriver[];
|
|
142
|
+
readonly rowLifecycle: RowLifecycleKind;
|
|
143
|
+
readonly softStale: boolean;
|
|
144
|
+
readonly updatedAt: number;
|
|
145
|
+
}
|
|
146
|
+
export type ConnectionStatus = 'idle' | 'connecting' | 'live' | 'paused' | 'frozen' | 'resyncing' | 'auth_revoked' | 'error';
|
|
147
|
+
export interface PinnedExplainCell {
|
|
148
|
+
readonly rowKey: string;
|
|
149
|
+
readonly colId: string;
|
|
150
|
+
readonly rowLabel: string;
|
|
151
|
+
readonly colLabel: string;
|
|
152
|
+
}
|
|
153
|
+
export interface SubscriptionStatusSnapshot {
|
|
154
|
+
readonly active: boolean;
|
|
155
|
+
readonly connectionStatus: ConnectionStatus;
|
|
156
|
+
readonly capabilityTier: SourceCapabilityTier;
|
|
157
|
+
readonly supportsExactRowDeltas: boolean;
|
|
158
|
+
readonly subscriptionId: string | null;
|
|
159
|
+
readonly serverEpochId: string | null;
|
|
160
|
+
readonly sourceRevision: number;
|
|
161
|
+
readonly lastAckSeq: number;
|
|
162
|
+
readonly queryEpoch: number;
|
|
163
|
+
readonly paused: boolean;
|
|
164
|
+
readonly bufferedUpdates: number;
|
|
165
|
+
readonly frozenSnapshotId: string | null;
|
|
166
|
+
readonly frozenRevision: number | null;
|
|
167
|
+
readonly cadenceMs: number;
|
|
168
|
+
readonly sortLock: SortLockMode;
|
|
169
|
+
readonly diffDisplayMode: DiffDisplayMode;
|
|
170
|
+
readonly changedOnly: boolean;
|
|
171
|
+
readonly activeBaselineId: string | null;
|
|
172
|
+
readonly activeBaselineLabel: string | null;
|
|
173
|
+
readonly baselines: readonly BaselineDescriptor[];
|
|
174
|
+
readonly lastError: string | null;
|
|
175
|
+
readonly lastFrameAt: number | null;
|
|
176
|
+
readonly tickCount: number;
|
|
177
|
+
readonly flashEnabled: boolean;
|
|
178
|
+
readonly flashDurationMs: number;
|
|
179
|
+
readonly showSparklineTooltip: boolean;
|
|
180
|
+
readonly showPnlExplain: boolean;
|
|
181
|
+
readonly pinnedExplainCell: PinnedExplainCell | null;
|
|
182
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Builds the table's rendered rows while preserving server pinning and edit comparison state. @param {any} p0 @returns {any} */
|
|
2
|
-
export function useRuntimeViewportTableData({ comparisonCellCountsRef, comparisonCellEpoch, comparisonCellOriginalValuesRef, comparisonValueState, editValueDisplayMode, filteredData, grandTotalRow, nodes, pinnedRowCacheRef, renderedData, rowPinning, serverSide, serverSidePinsGrandTotal, showColTotals, tableDataRef, total, }: any): any;
|
|
2
|
+
export function useRuntimeViewportTableData({ comparisonCellCountsRef, comparisonCellEpoch, comparisonCellOriginalValuesRef, comparisonValueState, editValueDisplayMode, filteredData, grandTotalRow, nodes, pinnedRowCacheRef, renderedData, rowPinning, serverSide, serverSidePinsGrandTotal, showColTotals, tableDataRef, total, liveSubscriptionStore, liveChangedOnly, liveChangedRevision, }: any): any;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive External Viewport Subscription Store & Transport Orchestrator (Component 6).
|
|
3
|
+
*
|
|
4
|
+
* Design principles:
|
|
5
|
+
* - Single Value Truth: incoming PATCH cell values are written directly into `useRowCache`
|
|
6
|
+
* (via `onPatchRows`) while visual diff/tick/sparkline metadata lives in this external store.
|
|
7
|
+
* - Per-Cell Granular Subscription: each rendered leaf cell subscribes ONLY to its own
|
|
8
|
+
* `cellKey = `${rowId}::${colId}`` so ticking 3 cells triggers 3 leaf re-renders, never a
|
|
9
|
+
* full-table re-render.
|
|
10
|
+
* - React 16/17/18/19 compatible (`useSyncExternalStore` when present, safe state fallback otherwise).
|
|
11
|
+
* - Unified across all 3 transports:
|
|
12
|
+
* 1. FastAPI SSE (`POST /v1/runtime/stream` + `POST /v1/runtime/subscription`)
|
|
13
|
+
* 2. Dash Same-Origin Fast-Lane (`POST /_serverside_pivot/subscription`)
|
|
14
|
+
* 3. Client-Side Engine (`ClientPivotTransport.getSubscriptionEngine()`)
|
|
15
|
+
*/
|
|
16
|
+
import { type CellLiveMeta, type DiffConfig, type DiffDisplayMode, type PinnedExplainCell, type ProtocolV2Frame, type RowLifecycleKind, type SortLockMode, type StreamingConfig, type StreamUpdateBatch, type SubscriptionStatusSnapshot } from './streamingTypes';
|
|
17
|
+
import type { ClientPivotTransport } from './client/clientPivotTransport';
|
|
18
|
+
import type { NormalizedValConfig } from './client/types';
|
|
19
|
+
export declare function makeLiveCellKey(rowKey: string, colId: string): string;
|
|
20
|
+
/** React 16/17/18/19 safe external-store subscription hook. */
|
|
21
|
+
export declare function useExternalStoreSnapshot<T>(subscribe: (listener: () => void) => () => void, getSnapshot: () => T): T;
|
|
22
|
+
export interface ViewportSubscriptionCallbacks {
|
|
23
|
+
onPatchRows?: (patchesByRowKey: Map<string, Record<string, unknown>>, sourceRevision: number, visibleRowKeys: Set<string>) => void;
|
|
24
|
+
onAuthoritativeSnapshot?: (frame: ProtocolV2Frame) => void;
|
|
25
|
+
onTriggerViewportRefresh?: () => void;
|
|
26
|
+
}
|
|
27
|
+
export interface SubscriptionQueryContext {
|
|
28
|
+
readonly table: string;
|
|
29
|
+
readonly rowFields: readonly string[];
|
|
30
|
+
readonly colFields: readonly string[];
|
|
31
|
+
readonly valConfigs: readonly NormalizedValConfig[];
|
|
32
|
+
readonly filters?: Record<string, unknown>;
|
|
33
|
+
readonly sorting?: readonly {
|
|
34
|
+
id: string;
|
|
35
|
+
desc?: boolean;
|
|
36
|
+
}[];
|
|
37
|
+
readonly expanded?: boolean | Record<string, unknown>;
|
|
38
|
+
readonly viewportStart?: number;
|
|
39
|
+
readonly viewportEnd?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Imperative external store managing per-cell tick/diff metadata, rolling sparklines,
|
|
43
|
+
* row lifecycle badges, and toolbar control state.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ViewportSubscriptionStore {
|
|
46
|
+
/** Display keys of the last snapshot that name more than one canonical row. */
|
|
47
|
+
private ambiguousDisplay;
|
|
48
|
+
private cellMap;
|
|
49
|
+
private rowLifecycleMap;
|
|
50
|
+
private currentViewportRowKeys;
|
|
51
|
+
private changedRowKeys;
|
|
52
|
+
private cellListeners;
|
|
53
|
+
private rowListeners;
|
|
54
|
+
private statusListeners;
|
|
55
|
+
private status;
|
|
56
|
+
private callbacks;
|
|
57
|
+
private controlHandlers;
|
|
58
|
+
private transitionInFlight;
|
|
59
|
+
constructor(initial?: Partial<SubscriptionStatusSnapshot>);
|
|
60
|
+
setCallbacks(callbacks: ViewportSubscriptionCallbacks): void;
|
|
61
|
+
setControlHandlers(handlers: ViewportSubscriptionStore['controlHandlers']): void;
|
|
62
|
+
setTransitionInFlight(inFlight: boolean): void;
|
|
63
|
+
isTransitionInFlight(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Clear cell/row maps on structural query changes (filter, sort, dimensions)
|
|
66
|
+
* so cells immediately display the authoritative new grid response without
|
|
67
|
+
* lingering pre-filter/pre-sort values.
|
|
68
|
+
*/
|
|
69
|
+
resetForQueryChange(): void;
|
|
70
|
+
syncViewport: () => void;
|
|
71
|
+
getStatus: () => SubscriptionStatusSnapshot;
|
|
72
|
+
subscribeStatus: (listener: () => void) => (() => void);
|
|
73
|
+
getCellMeta(rowKey: string, colId: string): CellLiveMeta | null;
|
|
74
|
+
subscribeCell(rowKey: string, colId: string, listener: () => void): () => void;
|
|
75
|
+
getRowLifecycle(rowKey: string): RowLifecycleKind;
|
|
76
|
+
hasRowChanged(rowKey: string): boolean;
|
|
77
|
+
getChangedRowKeyCount(): number;
|
|
78
|
+
subscribeRow(rowKey: string, listener: () => void): () => void;
|
|
79
|
+
patchStatus(partial: Partial<SubscriptionStatusSnapshot>): void;
|
|
80
|
+
private emitCell;
|
|
81
|
+
private emitRow;
|
|
82
|
+
setDiffDisplayMode: (mode: DiffDisplayMode) => void;
|
|
83
|
+
pauseLive: () => void;
|
|
84
|
+
resumeLive: () => void;
|
|
85
|
+
freezeSnapshot: () => void;
|
|
86
|
+
unfreezeSnapshot: () => void;
|
|
87
|
+
captureBaseline: (label?: string) => void;
|
|
88
|
+
selectBaseline: (baselineId: string | null) => void;
|
|
89
|
+
setCadenceMs: (ms: number) => void;
|
|
90
|
+
setSortLock: (mode: SortLockMode) => void;
|
|
91
|
+
setChangedOnly: (enabled: boolean) => void;
|
|
92
|
+
reconnect: () => void;
|
|
93
|
+
openExplainPanel: (cell: PinnedExplainCell) => void;
|
|
94
|
+
closeExplainPanel: () => void;
|
|
95
|
+
/** Ingest any Protocol V2 frame (`SNAPSHOT`, `PATCH`, `HEARTBEAT`, `INVALIDATE`, `AUTH_REVOKED`). */
|
|
96
|
+
ingestFrame(frame: ProtocolV2Frame): void;
|
|
97
|
+
}
|
|
98
|
+
export interface UseViewportSubscriptionOptions {
|
|
99
|
+
readonly streamingConfig?: StreamingConfig | null;
|
|
100
|
+
readonly diffConfig?: DiffConfig | null;
|
|
101
|
+
readonly streamUpdates?: StreamUpdateBatch | null;
|
|
102
|
+
readonly serverSide: boolean;
|
|
103
|
+
readonly clientTransport?: ClientPivotTransport | null;
|
|
104
|
+
readonly transitionInFlight?: boolean;
|
|
105
|
+
readonly queryContext: SubscriptionQueryContext;
|
|
106
|
+
readonly callbacks?: ViewportSubscriptionCallbacks;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* React hook owning a stable `ViewportSubscriptionStore` and binding it to
|
|
110
|
+
* FastAPI SSE, Dash fast-lane, or ClientPivotTransport depending on runtime mode.
|
|
111
|
+
*/
|
|
112
|
+
export declare function useViewportSubscriptionStore(options: UseViewportSubscriptionOptions): ViewportSubscriptionStore;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* status presentation from becoming a back-channel between grid, editing,
|
|
6
6
|
* transport and chart coordination.
|
|
7
7
|
@param {any} p0 @returns {any} */
|
|
8
|
-
export function useWorkspaceStatusPresentation({ chartCanvasPanes, clearAllComparisonValueState, clearAllEditedCellMarkers, clearAllOptimisticCellValues, colFields, columnAdvisory, comparisonCellOriginalValuesRef, comparisonValueState, dispatchTransactionRequest, editedCellMarkersRef, editValueDisplayMode, filters, handleClearStatusFilters, handleClearStatusSelection, handleRedo, handleRefreshStatusViewport, handleUndo, isRequestPending, loadedRows, managedChartDefinitions, openSelectionChart, propagationLogRef, propagationLogEpoch, requestVisibleViewportRefresh, rowEditStatusSummary, rowFields, rows, selectedCells, serverSide, setEditValueDisplayMode, setPropagationLogEpoch, setPropsRef, showNotification, sorting, statusRowCount, supportsPatchTransactionRefresh, syncComparisonValueState, syncTransactionHistoryState, totalCenterCols, transactionHistoryState, valConfigs, viewMode, }: any): any;
|
|
8
|
+
export function useWorkspaceStatusPresentation({ chartCanvasPanes, clearAllComparisonValueState, clearAllEditedCellMarkers, clearAllOptimisticCellValues, colFields, columnAdvisory, comparisonCellOriginalValuesRef, comparisonValueState, dispatchTransactionRequest, editedCellMarkersRef, editValueDisplayMode, filters, handleClearStatusFilters, handleClearStatusSelection, handleRedo, handleRefreshStatusViewport, handleUndo, isRequestPending, loadedRows, managedChartDefinitions, openSelectionChart, propagationLogRef, propagationLogEpoch, requestVisibleViewportRefresh, resolveColumnValueFormat, numberGroupSeparator, rowEditStatusSummary, rowFields, rows, selectedCells, serverSide, setEditValueDisplayMode, setPropagationLogEpoch, setPropsRef, showNotification, sorting, statusRowCount, supportsPatchTransactionRefresh, syncComparisonValueState, syncTransactionHistoryState, totalCenterCols, transactionHistoryState, valConfigs, viewMode, }: any): any;
|
|
@@ -3,7 +3,7 @@ export function formatDisplayLabel(value?: any): any;
|
|
|
3
3
|
export function isWeightedAverageAgg(agg?: any): any;
|
|
4
4
|
export function formatAggLabel(agg?: any, weightField?: any): any;
|
|
5
5
|
export function stripAggLabelSuffix(label?: any): string;
|
|
6
|
-
export const DEFAULT_NUMBER_GROUP_SEPARATOR: "
|
|
6
|
+
export const DEFAULT_NUMBER_GROUP_SEPARATOR: "comma";
|
|
7
7
|
export const DEFAULT_CURRENCY_SYMBOL: "$";
|
|
8
8
|
export function normalizeNumberGroupSeparator(value?: any): any;
|
|
9
9
|
export function normalizeNegativeZero(value?: any): any;
|
|
@@ -2,6 +2,6 @@ export function getStickyHeaderHeight(headerGroupCount?: any, rowHeight?: any, s
|
|
|
2
2
|
export function formatLocaleTextTemplate(template?: any, values?: any): any;
|
|
3
3
|
export function createTextWidthMeasurer(font?: any, fallbackCharPx?: any): any;
|
|
4
4
|
export function measureLongestHeaderWord(text?: any, measureFn?: any): any;
|
|
5
|
-
export function measureColumnFitMetric({ columnId, baseSize, rows, getCellRawValue, formatCellText, formatHierarchyLabel, headerLines, shortLabel, headerWrap, headerControlsMode, canSort, sortIndicator, measureBodyText, measureHeaderText, cellPaddingX, headerPaddingX, numericPaddingRight, hierarchyIndentPx, hierarchyExpandPx, cellOverscan, headerOverscan, }?: any): any;
|
|
6
|
-
export function computeCompactFitThemeOverrides(theme?: any, fitScale?: any, fittedFontSize?: any, minFontSize?: any): any;
|
|
7
|
-
export function computeFitToWidthLayout({ columns, containerWidth, baseFontSize, minFontSize, }?: any): any;
|
|
5
|
+
export function measureColumnFitMetric({ columnId, baseSize, minSize, rows, getCellRawValue, formatCellText, formatHierarchyLabel, getHierarchyLabel, headerLines, shortLabel, headerWrap, headerControlsMode, canSort, sortIndicator, measureBodyText, measureHeaderText, measureGroupHeaderText, cellPaddingX, headerPaddingX, numericPaddingRight, hierarchyIndentPx, hierarchyExpandPx, hierarchyLeafPx, cellOverscan, headerOverscan, }?: any): any;
|
|
6
|
+
export function computeCompactFitThemeOverrides(theme?: any, fitScale?: any, fittedFontSize?: any, minFontSize?: any, paddingScale?: number): any;
|
|
7
|
+
export function computeFitToWidthLayout({ columns, containerWidth, baseFontSize, minFontSize, theme, getFixedColumnSize, }?: any): any;
|