@altertable/data-app 0.77.0 → 0.78.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.
Files changed (68) hide show
  1. package/CONTRIBUTING.md +3 -0
  2. package/REFERENCE.md +45 -37
  3. package/dist/chunks/contract-gu1rDsV0.js +1588 -0
  4. package/dist/chunks/contract-gu1rDsV0.js.map +1 -0
  5. package/dist/chunks/data-client-BMdL73Ab.js +122 -0
  6. package/dist/chunks/data-client-BMdL73Ab.js.map +1 -0
  7. package/dist/chunks/{date-time-range-value-CnlTr1U1.js → date-time-range-value-D-XfqVTT.js} +21 -24
  8. package/dist/chunks/date-time-range-value-D-XfqVTT.js.map +1 -0
  9. package/dist/chunks/{diagnostics-Dyj-rUsY.js → diagnostics-CX9SsU79.js} +240 -63
  10. package/dist/chunks/diagnostics-CX9SsU79.js.map +1 -0
  11. package/dist/chunks/record-Cr4Uk1K3.js +9 -0
  12. package/dist/chunks/record-Cr4Uk1K3.js.map +1 -0
  13. package/dist/client/index.js +4 -101
  14. package/dist/client/index.js.map +1 -1
  15. package/dist/core/appearance.js +3 -5
  16. package/dist/core/appearance.js.map +1 -1
  17. package/dist/core/config.js +11 -3
  18. package/dist/core/config.js.map +1 -1
  19. package/dist/core/contract.js +3 -4
  20. package/dist/core/format.js +1 -1
  21. package/dist/internal.js +63 -11
  22. package/dist/internal.js.map +1 -1
  23. package/dist/types/chunks/contract.d.ts +254 -19
  24. package/dist/types/chunks/data-client.d.ts +46 -0
  25. package/dist/types/chunks/date-time-range-value.d.ts +28 -2
  26. package/dist/types/chunks/index.d.ts +65 -80
  27. package/dist/types/client/index.d.ts +4 -3
  28. package/dist/types/core/config.d.ts +10 -4
  29. package/dist/types/core/contract.d.ts +3 -5
  30. package/dist/types/core/format.d.ts +1 -2
  31. package/dist/types/index.d.ts +4 -4
  32. package/dist/types/internal.d.ts +25 -6
  33. package/docs/app-authoring.md +13 -9
  34. package/docs/client.md +14 -53
  35. package/docs/contract.md +35 -15
  36. package/docs/data-context.md +5 -2
  37. package/docs/diagnostics.md +16 -23
  38. package/docs/embed.md +60 -25
  39. package/docs/filters.md +33 -57
  40. package/docs/hosted-apps.md +9 -9
  41. package/docs/layout.md +21 -0
  42. package/docs/local-data-apps.md +5 -6
  43. package/docs/react-embed.md +44 -2
  44. package/docs/react.md +1 -2
  45. package/docs/server-bun.md +8 -5
  46. package/docs/stories-and-export.md +4 -4
  47. package/docs/styling.md +2 -1
  48. package/docs/ui.md +12 -3
  49. package/docs/views.md +12 -11
  50. package/docs/widgets.md +3 -3
  51. package/docs/worker.md +1 -1
  52. package/package.json +1 -5
  53. package/dist/chunks/contract-BQsFReRp.js +0 -780
  54. package/dist/chunks/contract-BQsFReRp.js.map +0 -1
  55. package/dist/chunks/contract-VhY9V9wd.js +0 -806
  56. package/dist/chunks/contract-VhY9V9wd.js.map +0 -1
  57. package/dist/chunks/date-time-range-value-CnlTr1U1.js.map +0 -1
  58. package/dist/chunks/diagnostics-Dyj-rUsY.js.map +0 -1
  59. package/dist/chunks/operation-BVRM-A5Y.js +0 -134
  60. package/dist/chunks/operation-BVRM-A5Y.js.map +0 -1
  61. package/dist/chunks/request-body-H1qPmmTN.js +0 -50
  62. package/dist/chunks/request-body-H1qPmmTN.js.map +0 -1
  63. package/dist/server/index.js +0 -90
  64. package/dist/server/index.js.map +0 -1
  65. package/dist/types/chunks/contract2.d.ts +0 -221
  66. package/dist/types/chunks/date-time-range.d.ts +0 -29
  67. package/dist/types/server/index.d.ts +0 -17
  68. package/docs/server.md +0 -41
@@ -1,4 +1,30 @@
1
- import { n as DateTimeRange, t as AbsoluteOrRelativeDateTime } from "./date-time-range.js";
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
2
28
  //#region src/core/date-time-range-value.d.ts
3
29
  /** Validate and restore UTC-rebased dates from JSON, without resolving relative bounds. */
4
30
  declare function parseDateTimeRange(value: unknown, { maxRangeDays }?: {
@@ -16,5 +42,5 @@ declare function formatDateTimeRange(value: DateTimeRange): string;
16
42
  /** Parse one bound without resolving relative anchors or offsets. */
17
43
  declare function parseDateTimeBound(text: string): AbsoluteOrRelativeDateTime | null;
18
44
  //#endregion
19
- export { resolveDateTimeRange as a, parseDateTimeRange as i, formatDateTimeRange as n, serializeDateTimeRange as o, parseDateTimeBound as r, formatDateTimeBound as t };
45
+ export { resolveDateTimeRange as a, DateTimeRange as c, RelativeOffset as d, RelativeUnit as f, parseDateTimeRange as i, RelativeAnchor as l, formatDateTimeRange as n, serializeDateTimeRange as o, ResolvedDateTimeRange as p, parseDateTimeBound as r, AbsoluteOrRelativeDateTime as s, formatDateTimeBound as t, RelativeDateTime as u };
20
46
  //# sourceMappingURL=date-time-range-value.d.ts.map
@@ -1,5 +1,4 @@
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";
1
+ import { E as MessageTransport, O as RoutedMessage, Rt as HostedLakehouse, S as MessageOutput, Wt as QueryResult, _t as HistoryMode, gt as AppLocation, l as DataAppAnnotationDraft, n as ExternalLinkModifiers, r as ExternalLinkResult, tn as QueryParameters, w as MessageRoutes, x as MessageInput } from "./contract.js";
3
2
  //#region src/core/logger.d.ts
4
3
  /** Host-owned log sink; compatible with console and frontend createLogger(). */
5
4
  type DataAppLogger = {
@@ -13,8 +12,49 @@ type LogEntry = {
13
12
  args: unknown[];
14
13
  };
15
14
  //#endregion
15
+ //#region src/core/actions.d.ts
16
+ /** Page actions an embedded app offers its host, replaced as a whole on every change.
17
+ * An absent key means the app does not offer that action. */
18
+ type DataAppActions = {
19
+ /** Run `refresh`; while `refreshing`, run `cancelRefresh` if `cancellable`. */
20
+ refresh?: {
21
+ refreshing: boolean;
22
+ cancellable: boolean;
23
+ };
24
+ /** Run `exportCsv`. `tables` names the datasets an action's `table` may select. */
25
+ exportCsv?: {
26
+ enabled: boolean;
27
+ tables: readonly string[];
28
+ };
29
+ /** Run `presentStory`; while `presenting`, run `closeStory`. */
30
+ presentStory?: {
31
+ enabled: boolean;
32
+ presenting: boolean;
33
+ };
34
+ /** Run `aboutData` to open the data inspector. */
35
+ aboutData?: {
36
+ enabled: boolean;
37
+ };
38
+ };
39
+ /** A host request to run an offered page action. The app ignores unavailable actions. */
40
+ type DataAppAction = {
41
+ type: 'refresh';
42
+ } | {
43
+ type: 'cancelRefresh';
44
+ } |
45
+ /** Omit `table` to export every dataset, as a ZIP when there are several. */
46
+ {
47
+ type: 'exportCsv';
48
+ table?: string;
49
+ } | {
50
+ type: 'presentStory';
51
+ } | {
52
+ type: 'closeStory';
53
+ } | {
54
+ type: 'aboutData';
55
+ };
56
+ //#endregion
16
57
  //#region src/client/transport.d.ts
17
- type DataTransport = (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
18
58
  declare const errorBrand: unique symbol;
19
59
  declare class DataAppError extends Error {
20
60
  readonly code: string;
@@ -23,75 +63,12 @@ declare class DataAppError extends Error {
23
63
  static [Symbol.hasInstance](value: unknown): boolean;
24
64
  constructor(message: string, code: string, requestId?: string | undefined);
25
65
  }
26
- declare function createHttpTransport({ endpoint, fetch: request }?: {
27
- endpoint?: string;
28
- fetch?: typeof fetch;
29
- }): DataTransport;
30
66
  //#endregion
31
- //#region src/client/data-client.d.ts
32
- /**
33
- * Parsed operation data and query evidence.
34
- */
35
- type DataResponse<Output, Input = unknown> = DataQueryBody<Output> & {
36
- /** The exact browser input that produced this response. */
37
- input: Input;
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; };
45
- declare const clientContract: unique symbol;
46
- type DataClient<Operations extends DataOperations> = {
47
- /** Preserve the operation registry when passing clients through helpers. */
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>>;
51
- query<Name extends keyof Operations & string>(this: void, name: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown), input: InputOf<Operations[NoInfer<Name>]>, options?: {
52
- signal?: AbortSignal;
53
- }): Promise<DataResponse<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>>;
54
- };
55
- type TransportOptions = {
56
- operations?: never;
57
- lakehouse?: never;
58
- transport?: DataTransport;
59
- endpoint?: string;
60
- fetch?: typeof fetch;
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
- };
80
- /** Browser operations and named-operation delivery are mutually exclusive. */
81
- type DataClientOptions<Operations extends DataOperations> = (KnownRecord<Operations> extends never ? never : true extends { [Name in keyof Operations]: IsUnion<Operations[Name]>; }[keyof Operations] ? never : unknown) & ({
82
- operations: Operations;
83
- lakehouse?: Lakehouse;
84
- transport?: never;
85
- endpoint?: never;
86
- fetch?: never;
87
- filters?: never;
88
- } | (TransportOptions & TransportFilters<Operations>)) & CheckedFacets<Operations>;
89
- /** Named HTTP operations, or browser-owned operations executed through an authorized SQL bridge. */
90
- /** Named clients derive data from the declared operations' run return types. */
91
- declare function createDataClient<Operations extends DataOperations>(...args: DataClientOptions<Operations> extends never ? [options: never] : keyof OperationFilters<Operations> extends never ? [] : [options: never]): DataClient<Operations>;
92
- /** Without an operation contract, external operation data remains unknown. */
93
- declare function createDataClient(options?: TransportOptions): DataClient<DataOperations>;
94
- declare function createDataClient<Operations extends DataOperations>(options: DataClientOptions<Operations>): DataClient<Operations>;
67
+ //#region src/client/local-query.d.ts
68
+ /** Send registered query IDs to the local Bun server; SQL never crosses this request. */
69
+ declare function createLocalQueryLakehouse(endpoint?: string, request?: typeof fetch): HostedLakehouse;
70
+ /** Install the local query adapter before mounting an app with browser-run operations. */
71
+ declare function installLocalQueryLakehouse(frame?: Window, lakehouse?: HostedLakehouse): () => void;
95
72
  //#endregion
96
73
  //#region src/client/location.d.ts
97
74
  type DataAppLocation = {
@@ -118,12 +95,10 @@ declare function createIframeTransport({ parentOrigin, window: frame, timeoutMs,
118
95
  };
119
96
  logger: DataAppLogger;
120
97
  request: (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
121
- transport: (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
122
98
  lakehouse: {
123
- queryAll(statement: string, { limit, signal, params }: {
99
+ queryAllById(queryId: string, { limit, signal, params }: {
124
100
  limit: number;
125
101
  signal: AbortSignal;
126
- name?: string;
127
102
  params?: QueryParameters;
128
103
  }): Promise<QueryResult>;
129
104
  };
@@ -132,6 +107,12 @@ declare function createIframeTransport({ parentOrigin, window: frame, timeoutMs,
132
107
  snapshot(): unknown;
133
108
  subscribe(listener: (state: unknown) => void): () => void;
134
109
  ready(): void;
110
+ /** Offers page actions to the host, replacing the previous set; `{}` withdraws them.
111
+ * Unchanged sets are not resent, so callers can report their latest set on every render.
112
+ * The current set is resent when the host reconnects. */
113
+ setActions(value: DataAppActions): void;
114
+ /** Receives host requests to run offered page actions. */
115
+ onAction(listener: (action: DataAppAction) => void): () => void;
135
116
  /** The UI owner calls this once its styles support content sizing; the parent's
136
117
  * `sizing: 'content'` presentation then applies until the returned release runs. */
137
118
  supportContentSizing(): () => void;
@@ -139,8 +120,8 @@ declare function createIframeTransport({ parentOrigin, window: frame, timeoutMs,
139
120
  fail(cause?: unknown): void;
140
121
  };
141
122
  type IframeTransport = ReturnType<typeof createIframeTransport>;
142
- type LocalBridge = Pick<ReturnType<typeof createIframeTransport>, 'transport'> & {
143
- connect?: () => Promise<ReturnType<typeof createIframeTransport>>;
123
+ type LocalBridge = Partial<Pick<IframeTransport, 'request'>> & {
124
+ connect?: () => Promise<IframeTransport>;
144
125
  };
145
126
  /** The URL opts into local preview; only same-origin server configuration establishes trust. */
146
127
  declare function localFrameBridge(window?: Window): LocalBridge | undefined;
@@ -157,12 +138,10 @@ declare function getDataAppTransport(frame?: Window): {
157
138
  };
158
139
  logger: DataAppLogger;
159
140
  request: (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
160
- transport: (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
161
141
  lakehouse: {
162
- queryAll(statement: string, { limit, signal, params }: {
142
+ queryAllById(queryId: string, { limit, signal, params }: {
163
143
  limit: number;
164
144
  signal: AbortSignal;
165
- name?: string;
166
145
  params?: QueryParameters;
167
146
  }): Promise<QueryResult>;
168
147
  };
@@ -171,6 +150,12 @@ declare function getDataAppTransport(frame?: Window): {
171
150
  snapshot(): unknown;
172
151
  subscribe(listener: (state: unknown) => void): () => void;
173
152
  ready(): void;
153
+ /** Offers page actions to the host, replacing the previous set; `{}` withdraws them.
154
+ * Unchanged sets are not resent, so callers can report their latest set on every render.
155
+ * The current set is resent when the host reconnects. */
156
+ setActions(value: DataAppActions): void;
157
+ /** Receives host requests to run offered page actions. */
158
+ onAction(listener: (action: DataAppAction) => void): () => void;
174
159
  /** The UI owner calls this once its styles support content sizing; the parent's
175
160
  * `sizing: 'content'` presentation then applies until the returned release runs. */
176
161
  supportContentSizing(): () => void;
@@ -275,5 +260,5 @@ declare function navigateNewWindow(url: string, options?: NavigationOptions): Pr
275
260
  /** Send only modifier keys, never the DOM/React event. Shift requests a window, Ctrl/Cmd a tab; otherwise no navigation. */
276
261
  declare function navigateNewWindowOrTab(url: string, event: ExternalLinkModifiers, options?: NavigationOptions): Promise<ExternalLinkResult>;
277
262
  //#endregion
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 };
263
+ export { DataAppActions as C, DataAppAction as S, LogEntry as T, localFrameBridge as _, AppDiagnosticReport as a, installLocalQueryLakehouse 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, DataAppLogger as w, DataAppError as x, createLocalQueryLakehouse as y };
279
264
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,4 @@
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
+ import { Ut as OutputOf, gt as AppLocation, zt as InputOf } from "../chunks/contract.js";
2
+ import { C as DataAppActions, S as DataAppAction, a as AppDiagnosticReport, b as installLocalQueryLakehouse, 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 DataAppLogger, x as DataAppError, y as createLocalQueryLakehouse } from "../chunks/index.js";
3
+ import { a as createDataClient, i as OperationFilters, n as DataClientOptions, r as DataResponse, t as DataClient } from "../chunks/data-client.js";
4
+ export { type AppDiagnosticReport, type AppFailure, type AppLocation, type DataAppAction, type DataAppActions, DataAppError, type DataAppLocation, type DataAppLogger, type DataAppNavigation, type DataClient, type DataClientOptions, type DataResponse, type IframeTransport, type InputOf, type OperationFilters, type OutputOf, appDiagnostics, createAnnotationClient, createDataAppNavigation, createDataClient, createIframeTransport, createLocalQueryLakehouse, createMessageClient, getDataAppNavigation, getDataAppTransport, installDataAppTransport, installLocalQueryLakehouse, navigateNewTab, navigateNewWindow, navigateNewWindowOrTab };
@@ -1,5 +1,6 @@
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";
1
+ import { c as DateTimeRange, d as RelativeOffset, f as RelativeUnit, l as RelativeAnchor, s as AbsoluteOrRelativeDateTime, u as RelativeDateTime } from "../chunks/date-time-range-value.js";
2
+ import { $t as QueryParameter, At as DimensionSourceQueryName, I as DefinedOperation, L as FilterOperationDefinition, Pt as DataOperations, Qt as QueryField, R as InputOperationDefinition, V as WithFilterInput, Z as FilterInput, Zt as QueryDefinitions, an as QueryValueType, at as FilterCollection, en as QueryParameterValue, in as QuerySnapshot, jt as SourceDimensionFilter, kt as DimensionSourceConfig, nn as QueryProjections, qt as CheckedQueries, rn as QueryRow } from "../chunks/contract.js";
3
+ import { t as DataClient } from "../chunks/data-client.js";
3
4
  import { o as AppearanceOptions } from "../chunks/appearance.js";
4
5
  //#region src/core/config.d.ts
5
6
  export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> = {
@@ -21,6 +22,10 @@ export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> =
21
22
  /** Named SQL statements with typed parameters and result projections. */
22
23
  queries: Queries;
23
24
  };
25
+ export type DataAppOperationRegistry<Operations extends DataOperations> = Operations & {
26
+ /** Run operations in the browser using its installed query bridge. */
27
+ createDataClient(): DataClient<Operations>;
28
+ };
24
29
  /** An app declaration with operations bound to its query registry. */
25
30
  export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinitions> = Readonly<Omit<DataAppConfig<Queries>, 'queries'>> & {
26
31
  readonly queries: QuerySnapshot<Queries>;
@@ -37,6 +42,8 @@ export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinition
37
42
  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
43
  /** Declare the filters the operation reads; its input, checks, and views derive from them. */
39
44
  defineOperation<const Filters extends FilterCollection = {}, Output = unknown>(operation: FilterOperationDefinition<Filters, Output, Queries>): DefinedOperation<FilterInput<Filters>, Output, Queries, Filters>;
45
+ /** Bind a named registry to these queries and derive its client and filters. */
46
+ defineOperations<const Operations extends DataOperations>(operations: Operations): DataAppOperationRegistry<Operations>;
40
47
  };
41
48
  /**
42
49
  * Define the app's query source of truth while preserving exact query and parameter names.
@@ -54,8 +61,7 @@ export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinition
54
61
  * references, and callbacks. Extraction reads literals without executing app code.
55
62
  * TypeScript and runtime query rules own configuration validation.
56
63
  *
57
- * Scalar placeholders pass to the backend. Datetime-range bound references ($period.from/to)
58
- * expand to DuckDB timestamp expressions while the range is bound as JSON.
64
+ * Statements use DuckDB SQL and bound parameters without SDK-only SQL syntax.
59
65
  * Declare each parameter's type and optional defaultValue.
60
66
  * Values are scalars or declared datetime ranges, never SQL fragments or identifiers.
61
67
  * Host queryParams supply protected values; callers cannot override them.
@@ -1,5 +1,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
+ import { a as resolveDateTimeRange, c as DateTimeRange, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, p as ResolvedDateTimeRange, r as parseDateTimeBound, s as AbsoluteOrRelativeDateTime, t as formatDateTimeBound, u as RelativeDateTime } from "../chunks/date-time-range-value.js";
2
+ import { $t as QueryParameter, A as dataAppRoutes, An as dateTimeRangePresets, B as ReportingPeriod, Bt as Lakehouse, C as MessageRoute, Cn as DateTimeRangeComparison, Ct as NumberSelection, D as RegisteredQueryInput, Dt as parseBooleanSelection, E as MessageTransport, En as DateTimeRangePreset, F as ConnectionOperation, Ft as DataQueryBody, G as parseCount, Gt as SqlLakehouse, H as connectionCheck, Ht as OperationContracts, I as DefinedOperation, It as DataQueryInput, J as dateTimeRangeSql, K as parseLabel, Kt as TransportResponse, L as FilterOperationDefinition, Lt as DisclosedQuery, M as defineMessageRoute, Mn as DateTimeRangeInput, N as navigationUpdateRoute, Nn as DateTimeRangePolicy, Nt as DataOperation, O as RoutedMessage, On as DateTimeRangeSelection, Ot as parseNumberSelection, P as registeredQueryRoute, Pt as DataOperations, Qt as QueryField, R as InputOperationDefinition, Rt as HostedLakehouse, S as MessageOutput, St as NumberOperator, T as MessageRoutingError, Tn as DateTimeRangeFilterOptions, Tt as numberFilter, U as defineOperation, V as WithFilterInput, Vt as OperationContext, W as defineQueryNames, Wt as QueryResult, X as facetFilter, Y as resolvedDateTimeRangeParams, Z as FilterInput, Zt as QueryDefinitions, _ as DataOperationRoute, a as OpenExternalLink, an as QueryValueType, at as FilterCollection, b as MessageHandlers, bn as parseFacetOptions, bt as BooleanSelection, c as resolveExternalLinkTarget, cn as DimensionFilterOptions, ct as MultiChoiceFilter, d as annotationDraftRoute, dn as DimensionOption, en as QueryParameterValue, f as annotationEditorStateRoute, fn as DimensionSelection, ft as displayChoice, g as parseDataAppAnnotationDraft, gn as dimensionFilter, h as annotationUpdateRoute, i as ExternalLinkTarget, it as ChoiceOption, j as defineDataOperationRoute, jn as queryDateTimeRangeParams, k as createMessageRouter, kn as dateTimeRangeFilter, l as DataAppAnnotationDraft, lt as SearchFilter, m as annotationSendRoute, mt as searchFilter, n as ExternalLinkModifiers, nn as QueryProjections, o as openExternalLinkRoute, ot as FilterPresentation, p as annotationModeRoute, pt as multiChoiceFilter, q as parseTrue, r as ExternalLinkResult, rn as QueryRow, rt as ChoiceFilter, s as parseExternalUrl, sn as DimensionFilter, st as FilterValues, t as DataSourceError, tn as QueryParameters, tt as AppFilter, u as DataAppAnnotationPresentation, un as DimensionMember, ut as choiceFilter, v as MessageContext, vn as dimensionPredicate, vt as NavigationUpdate, w as MessageRoutes, wn as DateTimeRangeFilter, wt as booleanFilter, x as MessageInput, xn as FacetFilter, xt as NumberFilter, y as MessageDispatcher, yn as parseDimensionSelection, yt as BooleanFilter, z as RegisteredQuery } from "../chunks/contract.js";
3
+ export { type AbsoluteOrRelativeDateTime, type AppFilter, type BooleanFilter, type BooleanSelection, type ChoiceFilter, type ChoiceOption, type ConnectionOperation, type DataAppAnnotationDraft, type DataAppAnnotationPresentation, type DataOperation, type DataOperationRoute, type DataOperations, type DataQueryBody, type DataQueryInput, 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 HostedLakehouse, 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 RegisteredQueryInput, type RelativeDateTime, type ReportingPeriod, type ResolvedDateTimeRange, type RoutedMessage, type SearchFilter, type SqlLakehouse, type TransportResponse, type WithFilterInput, annotationDraftRoute, annotationEditorStateRoute, annotationModeRoute, annotationSendRoute, annotationUpdateRoute, booleanFilter, choiceFilter, connectionCheck, createMessageRouter, dataAppRoutes, dateTimeRangeFilter, dateTimeRangePresets, dateTimeRangeSql, defineDataOperationRoute, defineMessageRoute, defineOperation, defineQueryNames, dimensionFilter, dimensionPredicate, displayChoice, facetFilter, formatDateTimeBound, formatDateTimeRange, multiChoiceFilter, navigationUpdateRoute, numberFilter, openExternalLinkRoute, parseBooleanSelection, parseCount, parseDataAppAnnotationDraft, parseDateTimeBound, parseDateTimeRange, parseDimensionSelection, parseExternalUrl, parseFacetOptions, parseLabel, parseNumberSelection, parseTrue, queryDateTimeRangeParams, registeredQueryRoute, resolveDateTimeRange, resolveExternalLinkTarget, resolvedDateTimeRangeParams, searchFilter, serializeDateTimeRange };
@@ -1,5 +1,4 @@
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";
1
+ import { c as DateTimeRange, d as RelativeOffset, f as RelativeUnit, l as RelativeAnchor, n as formatDateTimeRange, s as AbsoluteOrRelativeDateTime, u as RelativeDateTime } from "../chunks/date-time-range-value.js";
3
2
  //#region src/core/date-time-range-parser.d.ts
4
3
  type DateTimeRangeParseFailureReason = 'empty' | 'unrecognized' | 'invalid-range' | 'ambiguous';
5
4
  type DateTimeRangeParserOptions = {
@@ -1,4 +1,4 @@
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
- import { DataAppConfig, DataAppDefinition, dataAppTitle, defineDataApp } from "./core/config.js";
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 };
1
+ import { c as DateTimeRange, d as RelativeOffset, f as RelativeUnit, l as RelativeAnchor, s as AbsoluteOrRelativeDateTime, u as RelativeDateTime } from "./chunks/date-time-range-value.js";
2
+ import { $t as QueryParameter, Qt as QueryField, Zt as QueryDefinitions, an as QueryValueType, en as QueryParameterValue, nn as QueryProjections, rn as QueryRow } from "./chunks/contract.js";
3
+ import { DataAppConfig, DataAppDefinition, DataAppOperationRegistry, dataAppTitle, defineDataApp } from "./core/config.js";
4
+ export { type AbsoluteOrRelativeDateTime, type DataAppConfig, type DataAppDefinition, type DataAppOperationRegistry, 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 };
@@ -1,8 +1,6 @@
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";
1
+ import { a as resolveDateTimeRange, c as DateTimeRange, f as RelativeUnit, i as parseDateTimeRange, n as formatDateTimeRange, o as serializeDateTimeRange, r as parseDateTimeBound, s as AbsoluteOrRelativeDateTime, t as formatDateTimeBound, u as RelativeDateTime } from "./chunks/date-time-range-value.js";
2
+ import { $ as dateFilterName, An as dateTimeRangePresets, Cn as DateTimeRangeComparison, Dn as DateTimeRangeRequest, En as DateTimeRangePreset, Et as numberOperatorLabels, Jt as IsUnion, Mn as DateTimeRangeInput, Mt as dimensionSource, On as DateTimeRangeSelection, Q as combineOperationFilters, Sn as facetSource, Tn as DateTimeRangeFilterOptions, Xt as MAX_QUERY_ROWS, Z as FilterInput, _n as dimensionMemberKey, _t as HistoryMode, at as FilterCollection, ct as MultiChoiceFilter, dt as defineAppFilters, et as resolveFilterInput, ft as displayChoice, hn as createDimensionFilter, ht as validateChoiceOptions, it as ChoiceOption, jt as SourceDimensionFilter, kn as dateTimeRangeFilter, ln as DimensionFilterSettings, lt as SearchFilter, mn as DimensionValue, mt as searchFilter, nt as CheckedFilterDeclarations, on as REGISTERED_QUERY_ID_PATTERN, ot as FilterPresentation, pn as DimensionSelectionFilter, pt as multiChoiceFilter, rt as ChoiceFilter, st as FilterValues, tt as AppFilter, u as DataAppAnnotationPresentation, ut as choiceFilter, wn as DateTimeRangeFilter, xn as FacetFilter } from "./chunks/contract.js";
3
+ import { C as DataAppActions, S as DataAppAction, T as LogEntry, _ as localFrameBridge, s as parseAppDiagnosticReport } from "./chunks/index.js";
6
4
  import { c as Theme } from "./chunks/appearance.js";
7
5
  //#region src/core/bridge.d.ts
8
6
  /** Data app delivery protocol. IDs identify a document, a shell session, and an individual call. */
@@ -129,6 +127,23 @@ declare const bridgeProtocol: {
129
127
  height: number;
130
128
  };
131
129
  };
130
+ /** The page actions the app currently offers; replaces the previous set. */
131
+ readonly actionsUpdate: {
132
+ wire: "actions:update";
133
+ from: "app";
134
+ session: "current";
135
+ parse: (fields: Fields) => {
136
+ actions: DataAppActions;
137
+ };
138
+ };
139
+ readonly actionRun: {
140
+ wire: "action:run";
141
+ from: "host";
142
+ session: "current";
143
+ parse: (fields: Fields) => {
144
+ action: DataAppAction;
145
+ };
146
+ };
132
147
  /** CSS pixels of a content-sized frame hidden above and below the parent's visible area. */
133
148
  readonly viewportUpdate: {
134
149
  wire: "viewport:update";
@@ -311,9 +326,13 @@ export declare function readRequestBody(request: Request, maxBytes: number): Pro
311
326
  /** Separator for opaque composite keys, independent of URL and DOM ID formats. */
312
327
  export declare const KEY_SEPARATOR = ":";
313
328
  //#endregion
329
+ //#region src/core/parameter-sql.d.ts
330
+ /** Find SDK-only parameter syntax in SQL code, ignoring strings and comments. */
331
+ export declare function unsupportedParameterReference(statement: string): string | null;
332
+ //#endregion
314
333
  //#region src/core/time-units.d.ts
315
334
  /** Fixed durations in UTC-rebased arithmetic; months and years are calendar-dependent. */
316
335
  export declare const fixedUnitMilliseconds: Partial<Record<RelativeUnit, number>> & Record<'SECOND' | 'MINUTE' | 'HOUR' | 'DAY' | 'WEEK', number>;
317
336
  //#endregion
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 };
337
+ 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, REGISTERED_QUERY_ID_PATTERN, 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 };
319
338
  //# sourceMappingURL=internal.d.ts.map
@@ -19,11 +19,11 @@ for the requested change. For a new app, use the starter supplied by the authori
19
19
  | Local Finding | `starter-local-finding-data-app` |
20
20
 
21
21
  Choose the runtime and use case supplied by the app brief. Each starter is editable
22
- source; replace fixture queries and sample content before publishing. The hosted starter demonstrates query → operation
23
- → context → view → dataset → widget composition, including a story example.
22
+ source; replace fixture queries and sample content before publishing. The starters demonstrate query → operation
23
+ → context → view → dataset → widget composition.
24
24
  Hosted apps stay in one file with public package imports
25
25
  and a literal `defineDataApp()` declaration. Local apps use the same composition
26
- with their existing server/client wiring. Replace fixture data and connectivity screens; edit
26
+ with their existing server/client wiring. Replace fixture queries and example content; edit
27
27
  app-owned files, not installed packages.
28
28
 
29
29
  ## Connect data and components
@@ -31,10 +31,13 @@ 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. **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`.
34
+ 2. **Separate independent results.** Give each independently queried result its
35
+ own named query and operation. Widgets may share one result when they show
36
+ the same rows or derive related metrics from the same summary, such as total
37
+ cost, customer count, and average cost. Keep unrelated results separate.
38
+ Write queries against inspected data and preserve supplied
39
+ metric definitions. Write DuckDB SQL with named parameters; declare `params`
40
+ and result aliases in `projections`.
38
41
  Execute named queries with `query()` and derive results from its typed rows.
39
42
  3. **Update context and bindings.** Describe definitions and coverage in the data
40
43
  context, using the operation's `queryNames` for evidence. Declare each dataset
@@ -46,13 +49,14 @@ app-owned files, not installed packages.
46
49
  reporting period, and scope derive from the operation. Pass the headline view
47
50
  to `<DataApp view>`, which renders every filter's control, and render each
48
51
  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
52
+ backend-owned. See [views](views.md#give-each-independent-result-its-own-view) and
50
53
  [filters](filters.md).
51
54
  5. **Compose the content.** Follow the app brief for section order and narrative.
52
55
  Use `<Stack>` for sections, `<Grid>` for peers, and bound widgets
53
56
  from `@altertable/data-app-react`. Keep static explanations outside loading
54
57
  boundaries. Use app tabs only for distinct questions and widget `views` only
55
- for alternate representations of one dataset. Keep default appearance;
58
+ for alternate representations of one dataset. See [layout](layout.md#adapt-to-the-available-container)
59
+ for container-based sizing. Keep default appearance;
56
60
  customize when requested. Use custom UI only when bound components cannot
57
61
  express the requirement.
58
62
  6. **Connect shell features.** See [stories and export](stories-and-export.md)
package/docs/client.md CHANGED
@@ -1,71 +1,32 @@
1
1
  # Client
2
2
 
3
3
  Use this guide when customizing client delivery. Standard apps keep the
4
- starter's client. Import `createDataClient()` from `@altertable/data-app/client`.
4
+ starter's client.
5
5
 
6
- ## HTTP operations
6
+ ## Registered operations
7
7
 
8
- ```ts
9
- import { createDataClient } from '@altertable/data-app/client';
10
- import { operationFilters } from './filters.ts';
11
- import type { operations } from './operations.ts';
8
+ Hosted and local metric/finding starters use the same operation client:
12
9
 
13
- const client = createDataClient<typeof operations>({
14
- filters: operationFilters,
15
- });
16
- const response = await client.query(
17
- 'sampleCountsByGroup',
18
- { groupName: '' },
19
- { signal }
20
- );
10
+ ```ts
11
+ const operations = dataApp.defineOperations({ sampleCountsByGroup });
12
+ const client = operations.createDataClient();
21
13
  ```
22
14
 
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()`.
27
-
28
- The default endpoint is `/api/data`. Override it with
29
- `createDataClient<typeof operations>({ filters, endpoint, fetch })` to change the base URL or supply a Fetch
30
- implementation. Calls POST JSON to `/api/data/:operation`; the client sends
31
- operation inputs rather than SQL or credentials.
15
+ `run()` executes in the browser. Hosted apps send each named query through
16
+ `data:query`; local apps install `installLocalQueryLakehouse()` before mounting
17
+ and send it to `POST /api/query/:queryId`. Both backends execute only registered
18
+ SQL. The local Bun server receives `app: dataApp` through `serveLocalApp()`.
19
+ Keep `run()` and its imports browser-safe in this mode.
32
20
 
33
21
  For direct client calls, render `response.data` and label it with `response.input`
34
22
  so retained results keep their original scope during refresh. React views handle
35
- this automatically. For custom error handling, import `DataAppError` from the same
36
- entry for public codes and request IDs. Pass an abort signal to cancel a request.
23
+ this automatically. Import `DataAppError` for public codes and request IDs.
24
+ Pass an abort signal to cancel a query.
37
25
 
38
- See [contracts](contract.md), [server handlers](server.md), and
39
- [React bindings](react.md).
40
-
41
- ## Browser-owned operations for bundle apps
42
-
43
- Bundle apps pass their operation registry as a value, which also supplies its
44
- filters:
45
-
46
- ```ts
47
- import { createDataClient } from '@altertable/data-app/client';
48
-
49
- // ... operations declared with dataApp.defineOperation()
50
- const client = createDataClient({ operations });
51
- const response = await client.query('sampleCountsByGroup', { groupName: '' });
52
- ```
53
-
54
- Operations run in the browser and query through the host's `data:sql` route.
55
- The trusted bootstrap installs the bridge before app execution. A custom runtime
56
- must install it first or supply an authorized `lakehouse` adapter.
57
-
58
- Do not combine `operations` with `transport`, `endpoint`, or `fetch`. Browser
59
- policy bounds app requests; the [host SQL handler](embed.md#sql-query-route)
60
- must independently enforce access and resource limits.
26
+ See [contracts](contract.md) and [React bindings](react.md).
61
27
 
62
28
  ## Iframe transport
63
29
 
64
- `createDataClient<typeof operations>({ filters, transport })` accepts a `DataTransport`. Without an explicit
65
- transport, endpoint, or Fetch implementation, it discovers an installed iframe
66
- transport before falling back to HTTP. Explicit endpoint/Fetch options select
67
- HTTP. `createHttpTransport()` provides the underlying operation delivery adapter.
68
-
69
30
  A URL-hosted app configures trust and installs the bridge before mounting:
70
31
 
71
32
  ```ts