@altertable/data-app 0.75.0 → 0.77.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 +56 -9
- package/REFERENCE.md +387 -333
- package/dist/chunks/{contract-B3s0ybE2.js → contract-BQsFReRp.js} +314 -237
- package/dist/chunks/contract-BQsFReRp.js.map +1 -0
- package/dist/chunks/{contract-DcPjfm0R.js → contract-VhY9V9wd.js} +184 -91
- package/dist/chunks/contract-VhY9V9wd.js.map +1 -0
- package/dist/chunks/{format-5hMYUWk3.js → date-time-range-value-CnlTr1U1.js} +8 -153
- package/dist/chunks/date-time-range-value-CnlTr1U1.js.map +1 -0
- package/dist/chunks/{diagnostics-DVwQ5PDK.js → diagnostics-Dyj-rUsY.js} +2 -2
- package/dist/chunks/{diagnostics-DVwQ5PDK.js.map → diagnostics-Dyj-rUsY.js.map} +1 -1
- package/dist/chunks/{operation-CGuN7Zcb.js → operation-BVRM-A5Y.js} +3 -3
- package/dist/chunks/{operation-CGuN7Zcb.js.map → operation-BVRM-A5Y.js.map} +1 -1
- package/dist/client/index.js +65 -50
- package/dist/client/index.js.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/contract.js +4 -4
- package/dist/core/format.js +149 -1
- package/dist/core/format.js.map +1 -0
- package/dist/internal.js +6 -308
- package/dist/internal.js.map +1 -1
- package/dist/server/index.js +3 -3
- package/dist/types/chunks/contract.d.ts +359 -599
- package/dist/types/chunks/contract2.d.ts +221 -0
- package/dist/types/chunks/date-time-range-value.d.ts +2 -28
- package/dist/types/chunks/date-time-range.d.ts +29 -0
- package/dist/types/chunks/index.d.ts +33 -5
- package/dist/types/client/index.d.ts +3 -3
- package/dist/types/core/config.d.ts +8 -4
- package/dist/types/core/contract.d.ts +5 -3
- package/dist/types/core/format.d.ts +2 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/internal.d.ts +7 -5
- package/dist/types/server/index.d.ts +1 -1
- package/docs/app-authoring.md +15 -10
- package/docs/client.md +12 -7
- package/docs/contract.md +33 -50
- package/docs/data-context.md +9 -5
- package/docs/filters.md +295 -0
- package/docs/hosted-apps.md +4 -3
- package/docs/layout.md +24 -18
- package/docs/stories-and-export.md +19 -10
- package/docs/ui.md +7 -6
- package/docs/views.md +62 -26
- package/docs/widgets.md +38 -14
- package/package.json +16 -5
- package/dist/chunks/contract-B3s0ybE2.js.map +0 -1
- package/dist/chunks/contract-DcPjfm0R.js.map +0 -1
- package/dist/chunks/format-5hMYUWk3.js.map +0 -1
- package/docs/variables.md +0 -269
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { n as DateTimeRange } from "./date-time-range.js";
|
|
2
|
+
import { $ as DataQueryInput, Ct as DimensionFilterSettings, F as NavigationUpdate, Ft as FacetFilter, Ot as DimensionValue, Q as DataQueryBody, at as OutputOf, gt as QueryParameters, it as OperationContracts, ot as QueryResult, st as TransportResponse } from "./contract.js";
|
|
3
|
+
//#region src/core/facet-filter.d.ts
|
|
4
|
+
type FacetFilterOptions<Value extends DimensionValue, Operation extends string> = DimensionFilterSettings<Value> & {
|
|
5
|
+
/** The registered operation that returns this dimension's options. */
|
|
6
|
+
options: Operation;
|
|
7
|
+
};
|
|
8
|
+
/** Options load from `options`, an operation returning `DimensionOption[]`; the
|
|
9
|
+
* client checks that it is registered. Validate selections like any dimension. */
|
|
10
|
+
declare function facetFilter<const Operation extends string>(config: FacetFilterOptions<string, Operation> & {
|
|
11
|
+
valueType: 'string';
|
|
12
|
+
}): FacetFilter<string, Operation>;
|
|
13
|
+
declare function facetFilter<const Operation extends string>(config: FacetFilterOptions<number, Operation> & {
|
|
14
|
+
valueType: 'number';
|
|
15
|
+
}): FacetFilter<number, Operation>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/core/date-time-range-sql.d.ts
|
|
18
|
+
/** DuckDB timestamp expressions using the query session's timezone for relative anchors.
|
|
19
|
+
* Absolute fields remain UTC-rebased TIMESTAMP values. Start is inclusive, end exclusive.
|
|
20
|
+
*/
|
|
21
|
+
declare function dateTimeRangeSql(range: DateTimeRange, parameter?: string): {
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
params: Record<string, string>;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/core/messages.d.ts
|
|
28
|
+
type MessageContext = {
|
|
29
|
+
signal: AbortSignal;
|
|
30
|
+
};
|
|
31
|
+
type RoutedMessage = {
|
|
32
|
+
route: string;
|
|
33
|
+
payload: unknown;
|
|
34
|
+
};
|
|
35
|
+
type MessageDispatcher = (message: unknown, context: MessageContext) => Promise<unknown>;
|
|
36
|
+
type MessageTransport = (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
|
|
37
|
+
type MessageRoute<Input, Output> = {
|
|
38
|
+
input: (value: unknown) => Input;
|
|
39
|
+
output: (value: unknown, input: Input) => Output;
|
|
40
|
+
};
|
|
41
|
+
type MessageRoutes = Record<string, {
|
|
42
|
+
input: (value: unknown) => unknown;
|
|
43
|
+
output: (value: unknown, input: never) => unknown;
|
|
44
|
+
}>;
|
|
45
|
+
type MessageInput<Route extends MessageRoutes[string]> = ReturnType<Route['input']>;
|
|
46
|
+
type MessageHandlers<Routes extends MessageRoutes> = { [Name in keyof Routes]: (payload: MessageInput<Routes[Name]>, context: MessageContext) => ReturnType<Routes[Name]['output']> | Promise<ReturnType<Routes[Name]['output']>>; };
|
|
47
|
+
declare const errorBrand: unique symbol;
|
|
48
|
+
/** Only these deliberate, public failures cross the message boundary. Other errors stay private. */
|
|
49
|
+
declare class MessageRoutingError extends Error {
|
|
50
|
+
readonly code: string;
|
|
51
|
+
readonly requestId?: string | undefined;
|
|
52
|
+
readonly [errorBrand] = true;
|
|
53
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
54
|
+
constructor(code: string, message: string, requestId?: string | undefined,
|
|
55
|
+
/** `cause` stays with the host for logs; the bridge sends only code, message, and request ID. */
|
|
56
|
+
options?: ErrorOptions);
|
|
57
|
+
}
|
|
58
|
+
declare function defineMessageRoute<Input, Output>(route: MessageRoute<Input, Output>): MessageRoute<Input, Output>;
|
|
59
|
+
/** Contracts are shared; handlers are supplied by the host and never belong in the app bundle. */
|
|
60
|
+
declare function createMessageRouter<const Routes extends MessageRoutes>(routes: Routes, handlers: MessageHandlers<NoInfer<Routes>>): {
|
|
61
|
+
dispatch: (value: unknown, context: MessageContext) => Promise<unknown>;
|
|
62
|
+
};
|
|
63
|
+
type DataQueryRoute<Operations extends OperationContracts> = MessageRoute<DataQueryInput<Operations>, TransportResponse> & {
|
|
64
|
+
operations: Operations | undefined;
|
|
65
|
+
};
|
|
66
|
+
type MessageOutput<Route extends MessageRoutes[string], Input> = Route extends DataQueryRoute<infer Operations> ? Input extends {
|
|
67
|
+
operation: infer Name extends keyof Operations;
|
|
68
|
+
} ? TransportResponse<DataQueryBody<OutputOf<Operations[Name]>>> : never : ReturnType<Route['output']>;
|
|
69
|
+
/** Omit contracts only in generic hosts such as the CLI shell, where Bun validates operations. */
|
|
70
|
+
declare function defineDataQueryRoute<Operations extends OperationContracts = OperationContracts>(operations?: Operations): DataQueryRoute<Operations>;
|
|
71
|
+
declare const navigationUpdateRoute: MessageRoute<NavigationUpdate, null>;
|
|
72
|
+
type SqlQueryInput = {
|
|
73
|
+
statement: string;
|
|
74
|
+
limit: number;
|
|
75
|
+
params?: QueryParameters;
|
|
76
|
+
};
|
|
77
|
+
/** SQL delivery for browser-owned operations. Hosts must enforce backend access and resource limits. */
|
|
78
|
+
declare const sqlQueryRoute: MessageRoute<SqlQueryInput, QueryResult>;
|
|
79
|
+
declare const dataAppRoutes: {
|
|
80
|
+
'data:query': DataQueryRoute<OperationContracts>;
|
|
81
|
+
'navigation:update': MessageRoute<NavigationUpdate, null>;
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/core/annotations.d.ts
|
|
85
|
+
type DataAppAnnotationDraft = {
|
|
86
|
+
id: string;
|
|
87
|
+
target: {
|
|
88
|
+
id: string;
|
|
89
|
+
label: string;
|
|
90
|
+
kind: 'widget' | 'element' | 'app';
|
|
91
|
+
text: string;
|
|
92
|
+
queryNames: string[];
|
|
93
|
+
glossaryIds: string[];
|
|
94
|
+
};
|
|
95
|
+
context: {
|
|
96
|
+
search: string;
|
|
97
|
+
hash: string;
|
|
98
|
+
displayedInput?: unknown;
|
|
99
|
+
/** Normalized position within the selected target, stable across scrolling/resizing. */
|
|
100
|
+
anchor?: {
|
|
101
|
+
x: number;
|
|
102
|
+
y: number;
|
|
103
|
+
};
|
|
104
|
+
cursor?: {
|
|
105
|
+
x: number;
|
|
106
|
+
y: number;
|
|
107
|
+
};
|
|
108
|
+
/** Normalized custom selection rectangle within the iframe document. */
|
|
109
|
+
region?: {
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
112
|
+
width: number;
|
|
113
|
+
height: number;
|
|
114
|
+
};
|
|
115
|
+
screenshot?: {
|
|
116
|
+
mimeType: 'image/png';
|
|
117
|
+
dataUrl: string;
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
};
|
|
121
|
+
view?: string;
|
|
122
|
+
viewport: {
|
|
123
|
+
width: number;
|
|
124
|
+
height: number;
|
|
125
|
+
};
|
|
126
|
+
rect: {
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
width: number;
|
|
130
|
+
height: number;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
comment: string;
|
|
134
|
+
};
|
|
135
|
+
type DataAppAnnotationPresentation = {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
/** When provided, the host owns the mode and renders the annotation trigger. */
|
|
138
|
+
active?: boolean;
|
|
139
|
+
pinsVisible?: boolean;
|
|
140
|
+
showHint?: boolean;
|
|
141
|
+
readOnly?: boolean;
|
|
142
|
+
targets?: {
|
|
143
|
+
id: string;
|
|
144
|
+
targetId: string;
|
|
145
|
+
number: number;
|
|
146
|
+
comment?: string;
|
|
147
|
+
anchor?: {
|
|
148
|
+
x: number;
|
|
149
|
+
y: number;
|
|
150
|
+
};
|
|
151
|
+
region?: {
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
width: number;
|
|
155
|
+
height: number;
|
|
156
|
+
};
|
|
157
|
+
}[];
|
|
158
|
+
selectedAnnotationId?: string;
|
|
159
|
+
selectedTargetId?: string;
|
|
160
|
+
selectionId?: string;
|
|
161
|
+
/** Confirmed host click outside the iframe; occurredAt is epoch milliseconds. */
|
|
162
|
+
dismissal?: {
|
|
163
|
+
id: string;
|
|
164
|
+
occurredAt: number;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
/** Reconstruct at the boundary; discard extra fields and bound the entire JSON payload. */
|
|
168
|
+
declare function parseDataAppAnnotationDraft(value: unknown): DataAppAnnotationDraft;
|
|
169
|
+
declare const annotationDraftRoute: MessageRoute<DataAppAnnotationDraft, null>;
|
|
170
|
+
declare const annotationEditorStateRoute: MessageRoute<{
|
|
171
|
+
hasUnsavedChanges: boolean;
|
|
172
|
+
}, null>;
|
|
173
|
+
/** Request host-owned batch submission without transferring ownership of drafts. */
|
|
174
|
+
declare const annotationSendRoute: MessageRoute<null, null>;
|
|
175
|
+
declare const annotationUpdateRoute: MessageRoute<{
|
|
176
|
+
id: string;
|
|
177
|
+
comment: string;
|
|
178
|
+
}, null>;
|
|
179
|
+
/** A controlled shell acknowledges local exits (for example Escape). */
|
|
180
|
+
declare const annotationModeRoute: MessageRoute<{
|
|
181
|
+
active: boolean;
|
|
182
|
+
}, null>;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/core/external-link.d.ts
|
|
185
|
+
/** Absolute HTTPS destinations only; URLs must not contain embedded credentials. */
|
|
186
|
+
declare function parseExternalUrl(value: unknown): string;
|
|
187
|
+
type ExternalLinkTarget = 'tab' | 'window';
|
|
188
|
+
type ExternalLinkModifiers = {
|
|
189
|
+
shiftKey: boolean;
|
|
190
|
+
metaKey: boolean;
|
|
191
|
+
ctrlKey: boolean;
|
|
192
|
+
};
|
|
193
|
+
type OpenExternalLink = {
|
|
194
|
+
url: string;
|
|
195
|
+
} & ({
|
|
196
|
+
target?: ExternalLinkTarget;
|
|
197
|
+
} | {
|
|
198
|
+
target: 'event';
|
|
199
|
+
keys: ExternalLinkModifiers;
|
|
200
|
+
});
|
|
201
|
+
type ExternalLinkResult = 'opened' | 'cancelled' | 'ignored';
|
|
202
|
+
/** Shift takes precedence over Ctrl/Cmd; an unmodified event requests no navigation. */
|
|
203
|
+
declare function resolveExternalLinkTarget(input: OpenExternalLink): ExternalLinkTarget | null;
|
|
204
|
+
/** Opt-in host route. Validation does not replace the host's destination policy. */
|
|
205
|
+
declare const openExternalLinkRoute: MessageRoute<OpenExternalLink, ExternalLinkResult>;
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/core/contract.d.ts
|
|
208
|
+
declare const sourceErrorBrand: unique symbol;
|
|
209
|
+
declare class DataSourceError extends Error {
|
|
210
|
+
readonly reason: 'unauthorized' | 'forbidden' | 'rate_limited' | 'query_rejected' | 'unavailable';
|
|
211
|
+
readonly status?: number | undefined;
|
|
212
|
+
readonly [sourceErrorBrand] = true;
|
|
213
|
+
queryName?: string;
|
|
214
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
215
|
+
constructor(reason: 'unauthorized' | 'forbidden' | 'rate_limited' | 'query_rejected' | 'unavailable', status?: number | undefined,
|
|
216
|
+
/** `cause` stays on the server or host for logs; responses carry only the reason. */
|
|
217
|
+
options?: ErrorOptions);
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
export { dataAppRoutes as A, MessageRoute as C, RoutedMessage as D, MessageTransport as E, dateTimeRangeSql as F, facetFilter as I, defineMessageRoute as M, navigationUpdateRoute as N, SqlQueryInput as O, sqlQueryRoute as P, MessageOutput as S, MessageRoutingError as T, DataQueryRoute as _, OpenExternalLink as a, MessageHandlers as b, resolveExternalLinkTarget as c, annotationDraftRoute as d, annotationEditorStateRoute as f, parseDataAppAnnotationDraft as g, annotationUpdateRoute as h, ExternalLinkTarget as i, defineDataQueryRoute as j, createMessageRouter as k, DataAppAnnotationDraft as l, annotationSendRoute as m, ExternalLinkModifiers as n, openExternalLinkRoute as o, annotationModeRoute as p, ExternalLinkResult as r, parseExternalUrl as s, DataSourceError as t, DataAppAnnotationPresentation as u, MessageContext as v, MessageRoutes as w, MessageInput as x, MessageDispatcher as y };
|
|
221
|
+
//# sourceMappingURL=contract2.d.ts.map
|
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** Frontend-compatible range values. Absolute dates encode wall-clock fields as UTC,
|
|
3
|
-
* not instants converted from a reporting timezone. The backend interprets that zone.
|
|
4
|
-
*/
|
|
5
|
-
type AbsoluteOrRelativeDateTime = Date | RelativeDateTime;
|
|
6
|
-
type DateTimeRange = {
|
|
7
|
-
/** Inclusive start; null or omitted means unbounded. */
|
|
8
|
-
from?: AbsoluteOrRelativeDateTime | null;
|
|
9
|
-
/** Exclusive end; null or omitted means now. */
|
|
10
|
-
to?: AbsoluteOrRelativeDateTime | null;
|
|
11
|
-
};
|
|
12
|
-
type RelativeDateTime = {
|
|
13
|
-
anchor: RelativeAnchor;
|
|
14
|
-
offset: RelativeOffset[];
|
|
15
|
-
};
|
|
16
|
-
type RelativeOffset = {
|
|
17
|
-
amount: number;
|
|
18
|
-
unit: RelativeUnit;
|
|
19
|
-
};
|
|
20
|
-
type RelativeAnchor = 'RELATIVE_ANCHOR_NOW' | 'RELATIVE_ANCHOR_START_OF_TODAY' | 'RELATIVE_ANCHOR_START_OF_YESTERDAY' | 'RELATIVE_ANCHOR_START_OF_TOMORROW' | 'RELATIVE_ANCHOR_START_OF_WEEK' | 'RELATIVE_ANCHOR_START_OF_MONTH' | 'RELATIVE_ANCHOR_START_OF_YEAR';
|
|
21
|
-
type RelativeUnit = 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
22
|
-
/** Bounded, resolved wall-clock dates encoded in UTC, with an exclusive end. */
|
|
23
|
-
type ResolvedDateTimeRange = {
|
|
24
|
-
from: Date;
|
|
25
|
-
to: Date;
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
1
|
+
import { n as DateTimeRange, t as AbsoluteOrRelativeDateTime } from "./date-time-range.js";
|
|
28
2
|
//#region src/core/date-time-range-value.d.ts
|
|
29
3
|
/** Validate and restore UTC-rebased dates from JSON, without resolving relative bounds. */
|
|
30
4
|
declare function parseDateTimeRange(value: unknown, { maxRangeDays }?: {
|
|
@@ -42,5 +16,5 @@ declare function formatDateTimeRange(value: DateTimeRange): string;
|
|
|
42
16
|
/** Parse one bound without resolving relative anchors or offsets. */
|
|
43
17
|
declare function parseDateTimeBound(text: string): AbsoluteOrRelativeDateTime | null;
|
|
44
18
|
//#endregion
|
|
45
|
-
export { resolveDateTimeRange as a,
|
|
19
|
+
export { resolveDateTimeRange as a, parseDateTimeRange as i, formatDateTimeRange as n, serializeDateTimeRange as o, parseDateTimeBound as r, formatDateTimeBound as t };
|
|
46
20
|
//# sourceMappingURL=date-time-range-value.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/core/date-time-range.d.ts
|
|
2
|
+
/** Frontend-compatible range values. Absolute dates encode wall-clock fields as UTC,
|
|
3
|
+
* not instants converted from a reporting timezone. The backend interprets that zone.
|
|
4
|
+
*/
|
|
5
|
+
type AbsoluteOrRelativeDateTime = Date | RelativeDateTime;
|
|
6
|
+
type DateTimeRange = {
|
|
7
|
+
/** Inclusive start; null or omitted means unbounded. */
|
|
8
|
+
from?: AbsoluteOrRelativeDateTime | null;
|
|
9
|
+
/** Exclusive end; null or omitted means now. */
|
|
10
|
+
to?: AbsoluteOrRelativeDateTime | null;
|
|
11
|
+
};
|
|
12
|
+
type RelativeDateTime = {
|
|
13
|
+
anchor: RelativeAnchor;
|
|
14
|
+
offset: RelativeOffset[];
|
|
15
|
+
};
|
|
16
|
+
type RelativeOffset = {
|
|
17
|
+
amount: number;
|
|
18
|
+
unit: RelativeUnit;
|
|
19
|
+
};
|
|
20
|
+
type RelativeAnchor = 'RELATIVE_ANCHOR_NOW' | 'RELATIVE_ANCHOR_START_OF_TODAY' | 'RELATIVE_ANCHOR_START_OF_YESTERDAY' | 'RELATIVE_ANCHOR_START_OF_TOMORROW' | 'RELATIVE_ANCHOR_START_OF_WEEK' | 'RELATIVE_ANCHOR_START_OF_MONTH' | 'RELATIVE_ANCHOR_START_OF_YEAR';
|
|
21
|
+
type RelativeUnit = 'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
22
|
+
/** Bounded, resolved wall-clock dates encoded in UTC, with an exclusive end. */
|
|
23
|
+
type ResolvedDateTimeRange = {
|
|
24
|
+
from: Date;
|
|
25
|
+
to: Date;
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { RelativeOffset as a, RelativeDateTime as i, DateTimeRange as n, RelativeUnit as o, RelativeAnchor as r, ResolvedDateTimeRange as s, AbsoluteOrRelativeDateTime as t };
|
|
29
|
+
//# sourceMappingURL=date-time-range.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ft as FacetFilter, N as AppLocation, P as HistoryMode, Q as DataQueryBody, S as FilterCollection, Tt as DimensionOption, Z as DataOperations, at as OutputOf, gt as QueryParameters, lt as IsUnion, nt as Lakehouse, ot as QueryResult, st as TransportResponse, tt as InputOf, ut as KnownRecord } from "./contract.js";
|
|
2
|
+
import { D as RoutedMessage, E as MessageTransport, S as MessageOutput, l as DataAppAnnotationDraft, n as ExternalLinkModifiers, r as ExternalLinkResult, w as MessageRoutes, x as MessageInput } from "./contract2.js";
|
|
2
3
|
//#region src/core/logger.d.ts
|
|
3
4
|
/** Host-owned log sink; compatible with console and frontend createLogger(). */
|
|
4
5
|
type DataAppLogger = {
|
|
@@ -35,10 +36,18 @@ type DataResponse<Output, Input = unknown> = DataQueryBody<Output> & {
|
|
|
35
36
|
/** The exact browser input that produced this response. */
|
|
36
37
|
input: Input;
|
|
37
38
|
};
|
|
39
|
+
/** The filters each operation reads, for operations that read any. */
|
|
40
|
+
type OperationFilters<Operations extends DataOperations> = { readonly [Name in keyof Operations as Operations[Name] extends {
|
|
41
|
+
filters: infer Filters extends FilterCollection;
|
|
42
|
+
} ? keyof Filters extends never ? never : Name : never]: Operations[Name] extends {
|
|
43
|
+
filters: infer Filters;
|
|
44
|
+
} ? Filters : never; };
|
|
38
45
|
declare const clientContract: unique symbol;
|
|
39
46
|
type DataClient<Operations extends DataOperations> = {
|
|
40
47
|
/** Preserve the operation registry when passing clients through helpers. */
|
|
41
48
|
readonly [clientContract]: (operations: Operations) => Operations;
|
|
49
|
+
/** Each operation's filters; views derive their inputs and controls from them. */
|
|
50
|
+
readonly filters: Readonly<Record<string, FilterCollection>>;
|
|
42
51
|
query<Name extends keyof Operations & string>(this: void, name: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown), input: InputOf<Operations[NoInfer<Name>]>, options?: {
|
|
43
52
|
signal?: AbortSignal;
|
|
44
53
|
}): Promise<DataResponse<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>>;
|
|
@@ -50,6 +59,24 @@ type TransportOptions = {
|
|
|
50
59
|
endpoint?: string;
|
|
51
60
|
fetch?: typeof fetch;
|
|
52
61
|
};
|
|
62
|
+
/** Server-owned operations stay type-only, so the browser receives their filters. */
|
|
63
|
+
type TransportFilters<Operations extends DataOperations> = keyof OperationFilters<Operations> extends never ? {
|
|
64
|
+
filters?: OperationFilters<Operations>;
|
|
65
|
+
} : {
|
|
66
|
+
/** Pass the same filter declarations the server operations read. */
|
|
67
|
+
filters: OperationFilters<Operations>;
|
|
68
|
+
};
|
|
69
|
+
/** Distribute over conditional filter members so each possible facet is checked. */
|
|
70
|
+
type UncheckedFacet<Operations extends DataOperations, Filter, Key> = Filter extends FacetFilter<infer Value, infer Source> ? Source extends keyof Operations ? OutputOf<Operations[Source]> extends readonly DimensionOption<Value>[] ? never : Key : Key : never;
|
|
71
|
+
/** The filter names whose facet options are missing or mistyped. Only known names:
|
|
72
|
+
* a typed contract may widen `filters` with an index signature. */
|
|
73
|
+
type UncheckedFacetNames<Operations extends DataOperations, Filters> = { [Key in keyof Filters as string extends Key ? never : Key]: UncheckedFacet<Operations, Filters[Key], Key>; } extends (infer Checked) ? Checked[keyof Checked] : never;
|
|
74
|
+
/** Every facet filter loads its options from a registered operation returning them. */
|
|
75
|
+
type CheckedFacets<Operations extends DataOperations> = { [Name in keyof Operations]: Operations[Name] extends {
|
|
76
|
+
filters: infer Filters;
|
|
77
|
+
} ? UncheckedFacetNames<Operations, Filters> : never; }[keyof Operations] extends never ? unknown : {
|
|
78
|
+
'Facet filter options must name a registered operation returning DimensionOption[]': never;
|
|
79
|
+
};
|
|
53
80
|
/** Browser operations and named-operation delivery are mutually exclusive. */
|
|
54
81
|
type DataClientOptions<Operations extends DataOperations> = (KnownRecord<Operations> extends never ? never : true extends { [Name in keyof Operations]: IsUnion<Operations[Name]>; }[keyof Operations] ? never : unknown) & ({
|
|
55
82
|
operations: Operations;
|
|
@@ -57,13 +84,14 @@ type DataClientOptions<Operations extends DataOperations> = (KnownRecord<Operati
|
|
|
57
84
|
transport?: never;
|
|
58
85
|
endpoint?: never;
|
|
59
86
|
fetch?: never;
|
|
60
|
-
|
|
87
|
+
filters?: never;
|
|
88
|
+
} | (TransportOptions & TransportFilters<Operations>)) & CheckedFacets<Operations>;
|
|
61
89
|
/** Named HTTP operations, or browser-owned operations executed through an authorized SQL bridge. */
|
|
62
|
-
declare function createDataClient<Operations extends DataOperations>(options: DataClientOptions<Operations>): DataClient<Operations>;
|
|
63
90
|
/** Named clients derive data from the declared operations' run return types. */
|
|
64
|
-
declare function createDataClient<Operations extends DataOperations>(...args: DataClientOptions<Operations> extends never ? [options: never] : []): DataClient<Operations>;
|
|
91
|
+
declare function createDataClient<Operations extends DataOperations>(...args: DataClientOptions<Operations> extends never ? [options: never] : keyof OperationFilters<Operations> extends never ? [] : [options: never]): DataClient<Operations>;
|
|
65
92
|
/** Without an operation contract, external operation data remains unknown. */
|
|
66
93
|
declare function createDataClient(options?: TransportOptions): DataClient<DataOperations>;
|
|
94
|
+
declare function createDataClient<Operations extends DataOperations>(options: DataClientOptions<Operations>): DataClient<Operations>;
|
|
67
95
|
//#endregion
|
|
68
96
|
//#region src/client/location.d.ts
|
|
69
97
|
type DataAppLocation = {
|
|
@@ -247,5 +275,5 @@ declare function navigateNewWindow(url: string, options?: NavigationOptions): Pr
|
|
|
247
275
|
/** Send only modifier keys, never the DOM/React event. Shift requests a window, Ctrl/Cmd a tab; otherwise no navigation. */
|
|
248
276
|
declare function navigateNewWindowOrTab(url: string, event: ExternalLinkModifiers, options?: NavigationOptions): Promise<ExternalLinkResult>;
|
|
249
277
|
//#endregion
|
|
250
|
-
export {
|
|
278
|
+
export { createDataClient as C, DataAppLogger as D, createHttpTransport as E, LogEntry as O, OperationFilters as S, DataTransport as T, localFrameBridge as _, AppDiagnosticReport as a, DataClientOptions as b, createAnnotationClient as c, createDataAppNavigation as d, getDataAppNavigation as f, installDataAppTransport as g, getDataAppTransport as h, appDiagnostics as i, createMessageClient as l, createIframeTransport as m, navigateNewWindow as n, AppFailure as o, IframeTransport as p, navigateNewWindowOrTab as r, parseAppDiagnosticReport as s, navigateNewTab as t, DataAppNavigation as u, DataAppLocation as v, DataAppError as w, DataResponse as x, DataClient as y };
|
|
251
279
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
export { type AppDiagnosticReport, type AppFailure, type AppLocation, DataAppError, type DataAppLocation, type DataAppLogger, type DataAppNavigation, type DataClient, type DataClientOptions, type DataResponse, type DataTransport, type IframeTransport, type InputOf, type OutputOf, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createHttpTransport, createIframeTransport, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport, navigateNewTab, navigateNewWindow, navigateNewWindowOrTab };
|
|
1
|
+
import { N as AppLocation, at as OutputOf, tt as InputOf } from "../chunks/contract.js";
|
|
2
|
+
import { C as createDataClient, D as DataAppLogger, E as createHttpTransport, S as OperationFilters, T as DataTransport, a as AppDiagnosticReport, b as DataClientOptions, c as createAnnotationClient, d as createDataAppNavigation, f as getDataAppNavigation, g as installDataAppTransport, h as getDataAppTransport, i as appDiagnostics, l as createMessageClient, m as createIframeTransport, n as navigateNewWindow, o as AppFailure, p as IframeTransport, r as navigateNewWindowOrTab, t as navigateNewTab, u as DataAppNavigation, v as DataAppLocation, w as DataAppError, x as DataResponse, y as DataClient } from "../chunks/index.js";
|
|
3
|
+
export { type AppDiagnosticReport, type AppFailure, type AppLocation, DataAppError, type DataAppLocation, type DataAppLogger, type DataAppNavigation, type DataClient, type DataClientOptions, type DataResponse, type DataTransport, type IframeTransport, type InputOf, type OperationFilters, type OutputOf, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createHttpTransport, createIframeTransport, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport, navigateNewTab, navigateNewWindow, navigateNewWindowOrTab };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as RelativeOffset, i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, r as RelativeAnchor, t as AbsoluteOrRelativeDateTime } from "../chunks/date-time-range.js";
|
|
2
|
+
import { J as SourceDimensionFilter, K as DimensionSourceConfig, S as FilterCollection, _t as QueryProjections, bt as QueryValueType, ct as CheckedQueries, ft as QueryDefinitions, ht as QueryParameterValue, i as InputOperationDefinition, m as FilterInput, mt as QueryParameter, n as DefinedOperation, pt as QueryField, q as DimensionSourceQueryName, r as FilterOperationDefinition, s as WithFilterInput, vt as QueryRow, yt as QuerySnapshot } from "../chunks/contract.js";
|
|
3
3
|
import { o as AppearanceOptions } from "../chunks/appearance.js";
|
|
4
4
|
//#region src/core/config.d.ts
|
|
5
5
|
export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> = {
|
|
@@ -28,11 +28,15 @@ export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinition
|
|
|
28
28
|
source: {
|
|
29
29
|
query: DimensionSourceQueryName<Queries, NoInfer<Type>>;
|
|
30
30
|
};
|
|
31
|
-
}):
|
|
31
|
+
}): SourceDimensionFilter<{
|
|
32
32
|
string: string;
|
|
33
33
|
number: number;
|
|
34
34
|
}[Type]>;
|
|
35
|
-
|
|
35
|
+
/** Parse a destination's own input, such as a record id, and list valid `checks`.
|
|
36
|
+
* Declare `filters` too when it reads the displayed scope. */
|
|
37
|
+
defineOperation<Input, Output, const Filters extends FilterCollection = {}>(operation: InputOperationDefinition<Input, Output, Queries, Filters>): DefinedOperation<WithFilterInput<Filters, Input>, Output, Queries, keyof Filters extends never ? undefined : Filters>;
|
|
38
|
+
/** Declare the filters the operation reads; its input, checks, and views derive from them. */
|
|
39
|
+
defineOperation<const Filters extends FilterCollection = {}, Output = unknown>(operation: FilterOperationDefinition<Filters, Output, Queries>): DefinedOperation<FilterInput<Filters>, Output, Queries, Filters>;
|
|
36
40
|
};
|
|
37
41
|
/**
|
|
38
42
|
* Define the app's query source of truth while preserving exact query and parameter names.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as
|
|
3
|
-
|
|
1
|
+
import { i as RelativeDateTime, n as DateTimeRange, s as ResolvedDateTimeRange, t as AbsoluteOrRelativeDateTime } from "../chunks/date-time-range.js";
|
|
2
|
+
import { $ as DataQueryInput, A as multiChoiceFilter, At as dimensionFilter, B as NumberSelection, Bt as DateTimeRangePreset, C as FilterPresentation, D as choiceFilter, E as SearchFilter, Et as DimensionSelection, F as NavigationUpdate, Ft as FacetFilter, G as parseNumberSelection, Gt as DateTimeRangeInput, H as numberFilter, Ht as DateTimeRangeSelection, I as BooleanFilter, Kt as DateTimeRangePolicy, L as BooleanSelection, Lt as DateTimeRangeComparison, Mt as dimensionPredicate, Nt as parseDimensionSelection, Pt as parseFacetOptions, Q as DataQueryBody, R as NumberFilter, Rt as DateTimeRangeFilter, S as FilterCollection, St as DimensionFilterOptions, T as MultiChoiceFilter, Tt as DimensionOption, Ut as dateTimeRangeFilter, V as booleanFilter, W as parseBooleanSelection, Wt as dateTimeRangePresets, X as DataOperation, Z as DataOperations, _t as QueryProjections, a as RegisteredQuery, b as ChoiceFilter, bt as QueryValueType, c as connectionCheck, d as parseCount, et as DisclosedQuery, f as parseLabel, ft as QueryDefinitions, gt as QueryParameters, ht as QueryParameterValue, i as InputOperationDefinition, it as OperationContracts, j as searchFilter, k as displayChoice, l as defineOperation, m as FilterInput, mt as QueryParameter, n as DefinedOperation, nt as Lakehouse, o as ReportingPeriod, ot as QueryResult, p as parseTrue, pt as QueryField, r as FilterOperationDefinition, rt as OperationContext, s as WithFilterInput, st as TransportResponse, t as ConnectionOperation, u as defineQueryNames, v as AppFilter, vt as QueryRow, w as FilterValues, wt as DimensionMember, x as ChoiceOption, xt as DimensionFilter, z as NumberOperator, zt as DateTimeRangeFilterOptions } from "../chunks/contract.js";
|
|
3
|
+
import { A as dataAppRoutes, C as MessageRoute, D as RoutedMessage, E as MessageTransport, F as dateTimeRangeSql, I as facetFilter, M as defineMessageRoute, N as navigationUpdateRoute, O as SqlQueryInput, P as sqlQueryRoute, S as MessageOutput, T as MessageRoutingError, _ as DataQueryRoute, a as OpenExternalLink, b as MessageHandlers, c as resolveExternalLinkTarget, d as annotationDraftRoute, f as annotationEditorStateRoute, g as parseDataAppAnnotationDraft, h as annotationUpdateRoute, i as ExternalLinkTarget, j as defineDataQueryRoute, k as createMessageRouter, l as DataAppAnnotationDraft, m as annotationSendRoute, n as ExternalLinkModifiers, o as openExternalLinkRoute, p as annotationModeRoute, r as ExternalLinkResult, s as parseExternalUrl, t as DataSourceError, u as DataAppAnnotationPresentation, v as MessageContext, w as MessageRoutes, x as MessageInput, y as MessageDispatcher } from "../chunks/contract2.js";
|
|
4
|
+
import { a as resolveDateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "../chunks/date-time-range-value.js";
|
|
5
|
+
export { type AbsoluteOrRelativeDateTime, type AppFilter, type BooleanFilter, type BooleanSelection, type ChoiceFilter, type ChoiceOption, type ConnectionOperation, type DataAppAnnotationDraft, type DataAppAnnotationPresentation, type DataOperation, type DataOperations, type DataQueryBody, type DataQueryInput, type DataQueryRoute, DataSourceError, type DateTimeRange, type DateTimeRangeComparison, type DateTimeRangeFilter, type DateTimeRangeFilterOptions, type DateTimeRangeInput, type DateTimeRangePolicy, type DateTimeRangePreset, type DateTimeRangeSelection, type DefinedOperation, type DimensionFilter, type DimensionFilterOptions, type DimensionMember, type DimensionOption, type DimensionSelection, type DisclosedQuery, type ExternalLinkModifiers, type ExternalLinkResult, type ExternalLinkTarget, type FacetFilter, type FilterCollection, type FilterInput, type FilterOperationDefinition, type FilterPresentation, type FilterValues, type InputOperationDefinition, type Lakehouse, type MessageContext, type MessageDispatcher, type MessageHandlers, type MessageInput, type MessageOutput, type MessageRoute, type MessageRoutes, MessageRoutingError, type MessageTransport, type MultiChoiceFilter, type NavigationUpdate, type NumberFilter, type NumberOperator, type NumberSelection, type OpenExternalLink, type OperationContext, type OperationContracts, type QueryDefinitions, type QueryField, type QueryParameter, type QueryParameterValue, type QueryParameters, type QueryProjections, type QueryResult, type QueryRow, type QueryValueType, type RegisteredQuery, type RelativeDateTime, type ReportingPeriod, type ResolvedDateTimeRange, type RoutedMessage, type SearchFilter, type SqlQueryInput, type TransportResponse, type WithFilterInput, annotationDraftRoute, annotationEditorStateRoute, annotationModeRoute, annotationSendRoute, annotationUpdateRoute, booleanFilter, choiceFilter, connectionCheck, createMessageRouter, dataAppRoutes, dateTimeRangeFilter, dateTimeRangePresets, dateTimeRangeSql, defineDataQueryRoute, defineMessageRoute, defineOperation, defineQueryNames, dimensionFilter, dimensionPredicate, displayChoice, facetFilter, formatDateTimeBound, formatDateTimeRange, multiChoiceFilter, navigationUpdateRoute, numberFilter, openExternalLinkRoute, parseBooleanSelection, parseCount, parseDataAppAnnotationDraft, parseDateTimeBound, parseDateTimeRange, parseDimensionSelection, parseExternalUrl, parseFacetOptions, parseLabel, parseNumberSelection, parseTrue, resolveDateTimeRange, resolveExternalLinkTarget, searchFilter, serializeDateTimeRange, sqlQueryRoute };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as RelativeOffset, i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, r as RelativeAnchor, t as AbsoluteOrRelativeDateTime } from "../chunks/date-time-range.js";
|
|
2
|
+
import { n as formatDateTimeRange } from "../chunks/date-time-range-value.js";
|
|
2
3
|
//#region src/core/date-time-range-parser.d.ts
|
|
3
4
|
type DateTimeRangeParseFailureReason = 'empty' | 'unrecognized' | 'invalid-range' | 'ambiguous';
|
|
4
5
|
type DateTimeRangeParserOptions = {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as RelativeOffset, i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, r as RelativeAnchor, t as AbsoluteOrRelativeDateTime } from "./chunks/date-time-range.js";
|
|
2
|
+
import { _t as QueryProjections, bt as QueryValueType, ft as QueryDefinitions, ht as QueryParameterValue, mt as QueryParameter, pt as QueryField, vt as QueryRow } from "./chunks/contract.js";
|
|
3
3
|
import { DataAppConfig, DataAppDefinition, dataAppTitle, defineDataApp } from "./core/config.js";
|
|
4
4
|
export { type AbsoluteOrRelativeDateTime, type DataAppConfig, type DataAppDefinition, type DateTimeRange, type QueryDefinitions, type QueryField, type QueryParameter, type QueryParameterValue, type QueryProjections, type QueryRow, type QueryValueType, type RelativeAnchor, type RelativeDateTime, type RelativeOffset, type RelativeUnit, dataAppTitle, defineDataApp };
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as RelativeDateTime, n as DateTimeRange, o as RelativeUnit, t as AbsoluteOrRelativeDateTime } from "./chunks/date-time-range.js";
|
|
2
|
+
import { A as multiChoiceFilter, Bt as DateTimeRangePreset, C as FilterPresentation, Ct as DimensionFilterSettings, D as choiceFilter, Dt as DimensionSelectionFilter, E as SearchFilter, Ft as FacetFilter, Gt as DateTimeRangeInput, Ht as DateTimeRangeSelection, It as facetSource, J as SourceDimensionFilter, Lt as DateTimeRangeComparison, M as validateChoiceOptions, O as defineAppFilters, Ot as DimensionValue, P as HistoryMode, Rt as DateTimeRangeFilter, S as FilterCollection, T as MultiChoiceFilter, U as numberOperatorLabels, Ut as dateTimeRangeFilter, Vt as DateTimeRangeRequest, Wt as dateTimeRangePresets, Y as dimensionSource, _ as resolveFilterInput, b as ChoiceFilter, dt as MAX_QUERY_ROWS, g as dateFilterName, h as combineOperationFilters, j as searchFilter, jt as dimensionMemberKey, k as displayChoice, kt as createDimensionFilter, lt as IsUnion, m as FilterInput, v as AppFilter, w as FilterValues, x as ChoiceOption, y as CheckedFilterDeclarations, zt as DateTimeRangeFilterOptions } from "./chunks/contract.js";
|
|
3
|
+
import { u as DataAppAnnotationPresentation } from "./chunks/contract2.js";
|
|
4
|
+
import { a as resolveDateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, t as formatDateTimeBound } from "./chunks/date-time-range-value.js";
|
|
5
|
+
import { O as LogEntry, _ as localFrameBridge, s as parseAppDiagnosticReport } from "./chunks/index.js";
|
|
4
6
|
import { c as Theme } from "./chunks/appearance.js";
|
|
5
7
|
//#region src/core/bridge.d.ts
|
|
6
8
|
/** Data app delivery protocol. IDs identify a document, a shell session, and an individual call. */
|
|
@@ -293,7 +295,7 @@ type MetricValues = {
|
|
|
293
295
|
previous?: number | null;
|
|
294
296
|
};
|
|
295
297
|
type MetricReading = DataReading<MetricValues & {
|
|
296
|
-
period?:
|
|
298
|
+
period?: DateTimeRangeInput;
|
|
297
299
|
}>;
|
|
298
300
|
//#endregion
|
|
299
301
|
//#region src/core/uuid.d.ts
|
|
@@ -313,5 +315,5 @@ export declare const KEY_SEPARATOR = ":";
|
|
|
313
315
|
/** Fixed durations in UTC-rebased arithmetic; months and years are calendar-dependent. */
|
|
314
316
|
export declare const fixedUnitMilliseconds: Partial<Record<RelativeUnit, number>> & Record<'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK', number>;
|
|
315
317
|
//#endregion
|
|
316
|
-
export { type AbsoluteOrRelativeDateTime, type
|
|
318
|
+
export { type AbsoluteOrRelativeDateTime, type AppFilter, type BridgeDiagnostic, type BridgeEventMessage, type CheckedFilterDeclarations, type ChoiceFilter, type ChoiceOption, type DataAppPresentation, type DataReading, type DataView, type DateTimeRange, type DateTimeRangeComparison, type DateTimeRangeFilter, type DateTimeRangeFilterOptions, type DateTimeRangePreset, type DateTimeRangeRequest, type DateTimeRangeSelection, type DimensionFilterSettings, type DimensionSelectionFilter, type DimensionValue, type DisplayedSnapshot, type FacetFilter, type FilterCollection, type FilterInput, type FilterPresentation, type FilterValues, type HistoryMode, type IsUnion, MAX_QUERY_ROWS, type MetricReading, type MetricValues, type MultiChoiceFilter, type RelativeDateTime, type SearchFilter, type SourceDimensionFilter, choiceFilter, combineOperationFilters, createDimensionFilter, dateFilterName, dateTimeRangeFilter, dateTimeRangePresets, defineAppFilters, dimensionMemberKey, dimensionSource, displayChoice, facetSource, formatDateTimeBound, formatDateTimeRange, localFrameBridge, multiChoiceFilter, numberOperatorLabels, parseAppDiagnosticReport, parseDateTimeBound, parseDateTimeRange, resolveDateTimeRange, resolveFilterInput, searchFilter, serializeDateTimeRange, validateChoiceOptions };
|
|
317
319
|
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as DataOperations, gt as QueryParameters, nt as Lakehouse } from "../chunks/contract.js";
|
|
2
2
|
//#region src/server/handler.d.ts
|
|
3
3
|
/** Authorization result for one viewer request. A hosted adapter must scope its lakehouse client. */
|
|
4
4
|
type RequestAccess = {
|
package/docs/app-authoring.md
CHANGED
|
@@ -31,18 +31,23 @@ app-owned files, not installed packages.
|
|
|
31
31
|
1. **Define the question and scope.** Inspect relevant fields, definitions, time
|
|
32
32
|
coverage, and missing or incomplete observations. Establish the population,
|
|
33
33
|
grain, measures, and comparison. Choose a chart that answers the question.
|
|
34
|
-
2. **
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
2. **Write one query and operation per widget.** Give each metric, chart, and
|
|
35
|
+
table its own named query and operation; do not combine unrelated results
|
|
36
|
+
into one query. Write queries against inspected data and preserve supplied
|
|
37
|
+
metric definitions. Declare `params` and result aliases in `projections`.
|
|
38
|
+
Execute named queries with `query()` and derive results from its typed rows.
|
|
38
39
|
3. **Update context and bindings.** Describe definitions and coverage in the data
|
|
39
40
|
context, using the operation's `queryNames` for evidence. Declare each dataset
|
|
40
41
|
and metric once, with stable row keys, raw column values, and shared formats.
|
|
41
|
-
4. **
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
4. **Declare filters once, then one view per operation.** Declare each filter
|
|
43
|
+
and display choice as a constant and list the ones each operation reads in
|
|
44
|
+
its `filters`; the operation receives one flat input field per filter. Define
|
|
45
|
+
each view with `defineView({ operation, dataContext })`: its filters,
|
|
46
|
+
reporting period, and scope derive from the operation. Pass the headline view
|
|
47
|
+
to `<DataApp view>`, which renders every filter's control, and render each
|
|
48
|
+
view in its own `<DataSection>`. Keep protected values such as `orgId`
|
|
49
|
+
backend-owned. See [views](views.md#give-each-widget-its-own-view) and
|
|
50
|
+
[filters](filters.md).
|
|
46
51
|
5. **Compose the content.** Follow the app brief for section order and narrative.
|
|
47
52
|
Use `<Stack>` for sections, `<Grid>` for peers, and bound widgets
|
|
48
53
|
from `@altertable/data-app-react`. Keep static explanations outside loading
|
|
@@ -113,7 +118,7 @@ Open only the section needed for a requirement the starter does not cover:
|
|
|
113
118
|
|
|
114
119
|
| When | Read |
|
|
115
120
|
| -------------------------------------------- | ----------------------------------------------------------------- |
|
|
116
|
-
| Adding categorical, numeric, or time filters | [
|
|
121
|
+
| Adding categorical, numeric, or time filters | [Filters](filters.md) |
|
|
117
122
|
| Adding a chart or narrative binding | [Widgets](widgets.md) |
|
|
118
123
|
| Adding supplemental control hints | [Tooltips](ui.md#tooltips-and-explanations) |
|
|
119
124
|
| Adding a detail destination | [Detail views](views.md#detail-destinations) |
|
package/docs/client.md
CHANGED
|
@@ -7,9 +7,12 @@ starter's client. Import `createDataClient()` from `@altertable/data-app/client`
|
|
|
7
7
|
|
|
8
8
|
```ts
|
|
9
9
|
import { createDataClient } from '@altertable/data-app/client';
|
|
10
|
+
import { operationFilters } from './filters.ts';
|
|
10
11
|
import type { operations } from './operations.ts';
|
|
11
12
|
|
|
12
|
-
const client = createDataClient<typeof operations>(
|
|
13
|
+
const client = createDataClient<typeof operations>({
|
|
14
|
+
filters: operationFilters,
|
|
15
|
+
});
|
|
13
16
|
const response = await client.query(
|
|
14
17
|
'sampleCountsByGroup',
|
|
15
18
|
{ groupName: '' },
|
|
@@ -17,12 +20,13 @@ const response = await client.query(
|
|
|
17
20
|
);
|
|
18
21
|
```
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
Keep the operations import type-only so implementations stay on the server.
|
|
24
|
+
Pass the filters each operation reads from a browser-safe module both sides
|
|
25
|
+
import ([shared filters](filters.md#share-filters-with-http-and-local-apps)).
|
|
26
|
+
Inputs and data are inferred from the operation map and `run()`.
|
|
23
27
|
|
|
24
28
|
The default endpoint is `/api/data`. Override it with
|
|
25
|
-
`createDataClient<typeof operations>({ endpoint, fetch })` to change the base URL or supply a Fetch
|
|
29
|
+
`createDataClient<typeof operations>({ filters, endpoint, fetch })` to change the base URL or supply a Fetch
|
|
26
30
|
implementation. Calls POST JSON to `/api/data/:operation`; the client sends
|
|
27
31
|
operation inputs rather than SQL or credentials.
|
|
28
32
|
|
|
@@ -36,7 +40,8 @@ See [contracts](contract.md), [server handlers](server.md), and
|
|
|
36
40
|
|
|
37
41
|
## Browser-owned operations for bundle apps
|
|
38
42
|
|
|
39
|
-
Bundle apps pass their operation registry as a value
|
|
43
|
+
Bundle apps pass their operation registry as a value, which also supplies its
|
|
44
|
+
filters:
|
|
40
45
|
|
|
41
46
|
```ts
|
|
42
47
|
import { createDataClient } from '@altertable/data-app/client';
|
|
@@ -56,7 +61,7 @@ must independently enforce access and resource limits.
|
|
|
56
61
|
|
|
57
62
|
## Iframe transport
|
|
58
63
|
|
|
59
|
-
`createDataClient<typeof operations>({ transport })` accepts a `DataTransport`. Without an explicit
|
|
64
|
+
`createDataClient<typeof operations>({ filters, transport })` accepts a `DataTransport`. Without an explicit
|
|
60
65
|
transport, endpoint, or Fetch implementation, it discovers an installed iframe
|
|
61
66
|
transport before falling back to HTTP. Explicit endpoint/Fetch options select
|
|
62
67
|
HTTP. `createHttpTransport()` provides the underlying operation delivery adapter.
|