@altertable/data-app 0.69.0 → 0.71.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/AGENTS.md +11 -1
- package/CONTRIBUTING.md +59 -26
- package/README.md +22 -26
- package/REFERENCE.md +1900 -0
- package/dist/chunks/index-5a27erdg.js +54 -0
- package/dist/chunks/index-5a27erdg.js.map +10 -0
- package/dist/chunks/{index-2sbp9h2b.js → index-9yxr7nmm.js} +330 -21
- package/dist/chunks/index-9yxr7nmm.js.map +17 -0
- package/dist/chunks/{index-r7b1ftwy.js → index-j5q5n3ra.js} +8 -6
- package/dist/chunks/index-j5q5n3ra.js.map +10 -0
- package/dist/chunks/{index-22d576sn.js → index-q75zm3a7.js} +3 -3
- package/dist/chunks/{index-22d576sn.js.map → index-q75zm3a7.js.map} +3 -3
- package/dist/chunks/{index-kwnqycjt.js → index-vhaec7m5.js} +8 -6
- package/dist/chunks/index-vhaec7m5.js.map +10 -0
- package/dist/chunks/index-zp78caex.js +1047 -0
- package/dist/chunks/index-zp78caex.js.map +19 -0
- package/dist/client/index.js +284 -16
- package/dist/client/index.js.map +7 -3
- package/dist/core/appearance.js +181 -11
- package/dist/core/appearance.js.map +4 -3
- package/dist/core/config.js +3 -3
- package/dist/core/contract.js +13 -15
- package/dist/core/contract.js.map +1 -1
- package/dist/core/format.js +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/internal.js +418 -0
- package/dist/internal.js.map +15 -0
- package/dist/server/index.js +102 -0
- package/dist/server/index.js.map +10 -0
- package/dist/types/client/annotations.d.ts +1 -1
- package/dist/types/client/data-client.d.ts +21 -10
- package/dist/types/client/iframe.d.ts +6 -6
- package/dist/types/client/index.d.ts +3 -4
- package/dist/types/client/location.d.ts +2 -2
- package/dist/types/client/logger.d.ts +1 -1
- package/dist/types/client/navigation.d.ts +1 -1
- package/dist/types/client/transport.d.ts +1 -1
- package/dist/types/core/bridge.d.ts +1 -1
- package/dist/types/core/config.d.ts +20 -17
- package/dist/types/core/contract.d.ts +23 -13
- package/dist/types/core/dimension-source.d.ts +64 -0
- package/dist/types/core/dimension.d.ts +31 -23
- package/dist/types/core/facets.d.ts +13 -0
- package/dist/types/core/filters.d.ts +1 -1
- package/dist/types/core/format.d.ts +1 -2
- package/dist/types/core/keys.d.ts +2 -0
- package/dist/types/core/messages.d.ts +3 -3
- package/dist/types/core/operation-types.d.ts +7 -6
- package/dist/types/core/presentation.d.ts +1 -1
- package/dist/types/core/queries.d.ts +75 -7
- package/dist/types/core/reading.d.ts +1 -1
- package/dist/types/core/variables.d.ts +38 -12
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal.d.ts +22 -0
- package/dist/types/server/index.d.ts +1 -2
- package/docs/app-authoring.md +12 -4
- package/docs/client.md +5 -6
- package/docs/composition.md +84 -0
- package/docs/contract.md +41 -21
- package/docs/data-context.md +5 -3
- package/docs/embed.md +4 -4
- package/docs/formatting-and-appearance.md +1 -1
- package/docs/hosted-apps.md +4 -0
- package/docs/react-embed.md +7 -6
- package/docs/react.md +5 -5
- package/docs/server-bun.md +5 -5
- package/docs/server.md +1 -1
- package/docs/stories-and-export.md +3 -3
- package/docs/styling.md +6 -2
- package/docs/ui.md +18 -7
- package/docs/variables.md +83 -11
- package/docs/views.md +57 -3
- package/docs/widgets.md +97 -4
- package/docs/worker.md +4 -4
- package/examples/starter-data-app/index.tsx +11 -23
- package/examples/starter-local-data-app/AGENTS.md +1 -1
- package/examples/starter-local-data-app/README.md +12 -10
- package/examples/starter-local-data-app/app.ts +7 -1
- package/examples/starter-local-data-app/package.json +3 -1
- package/examples/starter-local-data-app/src/App.tsx +1 -1
- package/examples/starter-local-data-app/src/data-context.ts +1 -1
- package/examples/starter-local-data-app/src/main.tsx +1 -1
- package/examples/starter-local-data-app/src/server.ts +1 -1
- package/examples/starter-local-data-app/tsconfig.json +7 -1
- package/package.json +16 -92
- package/THIRD_PARTY_NOTICES +0 -18
- package/dist/chunks/index-2sbp9h2b.js.map +0 -13
- package/dist/chunks/index-ap60vggk.js +0 -80
- package/dist/chunks/index-ap60vggk.js.map +0 -10
- package/dist/chunks/index-cv36cyna.js +0 -180
- package/dist/chunks/index-cv36cyna.js.map +0 -10
- package/dist/chunks/index-k766wwwr.js +0 -643
- package/dist/chunks/index-k766wwwr.js.map +0 -13
- package/dist/chunks/index-kwnqycjt.js.map +0 -10
- package/dist/chunks/index-m0gbxtgp.js +0 -355
- package/dist/chunks/index-m0gbxtgp.js.map +0 -13
- package/dist/chunks/index-qhzdzca2.js +0 -15869
- package/dist/chunks/index-qhzdzca2.js.map +0 -118
- package/dist/chunks/index-r7b1ftwy.js.map +0 -10
- package/dist/chunks/index-sx488hvs.js +0 -221
- package/dist/chunks/index-sx488hvs.js.map +0 -12
- package/dist/chunks/index-wss3gd3h.js +0 -319
- package/dist/chunks/index-wss3gd3h.js.map +0 -13
- package/dist/chunks/index-zcqxfwdq.js +0 -197
- package/dist/chunks/index-zcqxfwdq.js.map +0 -13
- package/dist/embed/index.js +0 -138
- package/dist/embed/index.js.map +0 -12
- package/dist/local.js +0 -432
- package/dist/local.js.map +0 -14
- package/dist/preview.js +0 -1456
- package/dist/preview.js.map +0 -17
- package/dist/react/embed/index.js +0 -117
- package/dist/react/embed/index.js.map +0 -10
- package/dist/react/index.js +0 -2948
- package/dist/react/index.js.map +0 -26
- package/dist/react/ui/index.js +0 -3142
- package/dist/react/ui/index.js.map +0 -35
- package/dist/server.js +0 -301
- package/dist/server.js.map +0 -13
- package/dist/types/core/time-interval.d.ts +0 -96
- package/dist/types/embed/bootstrap.d.ts +0 -5
- package/dist/types/embed/bridge.d.ts +0 -12
- package/dist/types/embed/host.d.ts +0 -36
- package/dist/types/embed/index.d.ts +0 -14
- package/dist/types/embed/navigation.d.ts +0 -6
- package/dist/types/embed/runtime-html.d.ts +0 -2
- package/dist/types/embed/source.d.ts +0 -16
- package/dist/types/embed/sql.d.ts +0 -4
- package/dist/types/react/annotations/AnnotationBar.d.ts +0 -30
- package/dist/types/react/annotations/AnnotationControls.d.ts +0 -10
- package/dist/types/react/annotations/AnnotationEditor.d.ts +0 -16
- package/dist/types/react/annotations/AnnotationMarkers.d.ts +0 -19
- package/dist/types/react/annotations/AnnotationSelectionLayer.d.ts +0 -12
- package/dist/types/react/annotations/AnnotationTarget.d.ts +0 -9
- package/dist/types/react/annotations/AnnotationTooltip.d.ts +0 -9
- package/dist/types/react/annotations/AnnotationTrigger.d.ts +0 -10
- package/dist/types/react/annotations/annotation-editor-state.d.ts +0 -58
- package/dist/types/react/annotations/annotation-screenshot.d.ts +0 -4
- package/dist/types/react/annotations/annotation-targets.d.ts +0 -34
- package/dist/types/react/annotations/getAnnotationProps.d.ts +0 -17
- package/dist/types/react/annotations/styles.d.ts +0 -3
- package/dist/types/react/annotations/useAnnotationGeometry.d.ts +0 -22
- package/dist/types/react/annotations/useDataAppAnnotations.d.ts +0 -22
- package/dist/types/react/app-context.d.ts +0 -3
- package/dist/types/react/bindings.d.ts +0 -133
- package/dist/types/react/content.d.ts +0 -36
- package/dist/types/react/date-formatting.d.ts +0 -12
- package/dist/types/react/embed/bridge.d.ts +0 -21
- package/dist/types/react/embed/index.d.ts +0 -7
- package/dist/types/react/hooks.d.ts +0 -75
- package/dist/types/react/index.d.ts +0 -75
- package/dist/types/react/injectStyles.d.ts +0 -7
- package/dist/types/react/mount.d.ts +0 -13
- package/dist/types/react/search-suggestions.d.ts +0 -8
- package/dist/types/react/source-owner.d.ts +0 -2
- package/dist/types/react/style-contract.d.ts +0 -88
- package/dist/types/react/style-validation.d.ts +0 -2
- package/dist/types/react/styles.d.ts +0 -8
- package/dist/types/react/ui/AboutData.d.ts +0 -68
- package/dist/types/react/ui/AltertableLogo.d.ts +0 -3
- package/dist/types/react/ui/AppFooter.d.ts +0 -6
- package/dist/types/react/ui/AppHeader.d.ts +0 -10
- package/dist/types/react/ui/AppLayout.d.ts +0 -10
- package/dist/types/react/ui/AppScope.d.ts +0 -7
- package/dist/types/react/ui/AppToolbar.d.ts +0 -30
- package/dist/types/react/ui/AreaChart.d.ts +0 -7
- package/dist/types/react/ui/BarChart.d.ts +0 -6
- package/dist/types/react/ui/Breakdown.d.ts +0 -13
- package/dist/types/react/ui/Button.d.ts +0 -11
- package/dist/types/react/ui/ChartLegend.d.ts +0 -32
- package/dist/types/react/ui/Checkbox.d.ts +0 -21
- package/dist/types/react/ui/CheckboxGroup.d.ts +0 -7
- package/dist/types/react/ui/ChoicePicker.d.ts +0 -39
- package/dist/types/react/ui/Comparison.d.ts +0 -14
- package/dist/types/react/ui/ComposedChart.d.ts +0 -41
- package/dist/types/react/ui/ComposedChartLegend.d.ts +0 -8
- package/dist/types/react/ui/ContentSkeleton.d.ts +0 -7
- package/dist/types/react/ui/DataApp.d.ts +0 -21
- package/dist/types/react/ui/DataAppFrame.d.ts +0 -52
- package/dist/types/react/ui/DataBoundary.d.ts +0 -14
- package/dist/types/react/ui/DataSection.d.ts +0 -14
- package/dist/types/react/ui/DataSectionBoundary.d.ts +0 -30
- package/dist/types/react/ui/DataTable.d.ts +0 -29
- package/dist/types/react/ui/DataValue.d.ts +0 -9
- package/dist/types/react/ui/DataViewToast.d.ts +0 -11
- package/dist/types/react/ui/DataWidget.d.ts +0 -34
- package/dist/types/react/ui/DateDisplay.d.ts +0 -9
- package/dist/types/react/ui/DateRangePicker.d.ts +0 -30
- package/dist/types/react/ui/DateTimeTooltip.d.ts +0 -10
- package/dist/types/react/ui/DimensionPicker.d.ts +0 -13
- package/dist/types/react/ui/EmptyState.d.ts +0 -6
- package/dist/types/react/ui/ExportControl.d.ts +0 -4
- package/dist/types/react/ui/FilterActions.d.ts +0 -10
- package/dist/types/react/ui/FilterBar.d.ts +0 -3
- package/dist/types/react/ui/FunnelChart.d.ts +0 -20
- package/dist/types/react/ui/GettingStarted.d.ts +0 -6
- package/dist/types/react/ui/GlossaryDefinition.d.ts +0 -7
- package/dist/types/react/ui/GlossaryExplanation.d.ts +0 -16
- package/dist/types/react/ui/GradientScroll.d.ts +0 -23
- package/dist/types/react/ui/Grid.d.ts +0 -12
- package/dist/types/react/ui/GridItem.d.ts +0 -7
- package/dist/types/react/ui/HelpPopover.d.ts +0 -21
- package/dist/types/react/ui/IconButton.d.ts +0 -19
- package/dist/types/react/ui/InspectionContext.d.ts +0 -12
- package/dist/types/react/ui/InspectionProvider.d.ts +0 -29
- package/dist/types/react/ui/JourneyChart.d.ts +0 -10
- package/dist/types/react/ui/Kbd.d.ts +0 -7
- package/dist/types/react/ui/LineChart.d.ts +0 -7
- package/dist/types/react/ui/LiveControl.d.ts +0 -10
- package/dist/types/react/ui/Menu.d.ts +0 -12
- package/dist/types/react/ui/MetricWidget.d.ts +0 -49
- package/dist/types/react/ui/NumberField.d.ts +0 -27
- package/dist/types/react/ui/NumberFilterPicker.d.ts +0 -11
- package/dist/types/react/ui/PeriodSummary.d.ts +0 -17
- package/dist/types/react/ui/PickerField.d.ts +0 -15
- package/dist/types/react/ui/PieChart.d.ts +0 -11
- package/dist/types/react/ui/PopoverSurface.d.ts +0 -5
- package/dist/types/react/ui/PresentStory.d.ts +0 -30
- package/dist/types/react/ui/QueryList.d.ts +0 -14
- package/dist/types/react/ui/RadioGroup.d.ts +0 -18
- package/dist/types/react/ui/Ranking.d.ts +0 -13
- package/dist/types/react/ui/RefreshControl.d.ts +0 -9
- package/dist/types/react/ui/RequestHint.d.ts +0 -20
- package/dist/types/react/ui/RetentionChart.d.ts +0 -27
- package/dist/types/react/ui/ScatterChart.d.ts +0 -17
- package/dist/types/react/ui/SearchField.d.ts +0 -23
- package/dist/types/react/ui/SearchInput.d.ts +0 -10
- package/dist/types/react/ui/SearchMatch.d.ts +0 -6
- package/dist/types/react/ui/SearchTypeahead.d.ts +0 -15
- package/dist/types/react/ui/SectionHeading.d.ts +0 -8
- package/dist/types/react/ui/Select.d.ts +0 -18
- package/dist/types/react/ui/SelectionMark.d.ts +0 -5
- package/dist/types/react/ui/Sheet.d.ts +0 -21
- package/dist/types/react/ui/Skeleton.d.ts +0 -8
- package/dist/types/react/ui/Stack.d.ts +0 -7
- package/dist/types/react/ui/StaticDataApp.d.ts +0 -4
- package/dist/types/react/ui/StatusPanel.d.ts +0 -10
- package/dist/types/react/ui/TableWidget.d.ts +0 -67
- package/dist/types/react/ui/Tabs.d.ts +0 -10
- package/dist/types/react/ui/TextContent.d.ts +0 -4
- package/dist/types/react/ui/TextWidget.d.ts +0 -20
- package/dist/types/react/ui/ThemeSelector.d.ts +0 -12
- package/dist/types/react/ui/Toast.d.ts +0 -8
- package/dist/types/react/ui/Tooltip.d.ts +0 -23
- package/dist/types/react/ui/TooltipSurface.d.ts +0 -3
- package/dist/types/react/ui/TrendChart.d.ts +0 -5
- package/dist/types/react/ui/UpdatedAt.d.ts +0 -9
- package/dist/types/react/ui/VariableBar.d.ts +0 -6
- package/dist/types/react/ui/VisualizationWidget.d.ts +0 -43
- package/dist/types/react/ui/WidgetDisclosure.d.ts +0 -6
- package/dist/types/react/ui/WidgetEvidence.d.ts +0 -12
- package/dist/types/react/ui/WidgetViewTabs.d.ts +0 -16
- package/dist/types/react/ui/chart-data.d.ts +0 -34
- package/dist/types/react/ui/chart-date-axis.d.ts +0 -15
- package/dist/types/react/ui/chart-interaction.d.ts +0 -21
- package/dist/types/react/ui/chart-primitives.d.ts +0 -22
- package/dist/types/react/ui/chart-time.d.ts +0 -16
- package/dist/types/react/ui/chartColor.d.ts +0 -2
- package/dist/types/react/ui/classNames.d.ts +0 -1
- package/dist/types/react/ui/csv-export.d.ts +0 -19
- package/dist/types/react/ui/data-context.d.ts +0 -76
- package/dist/types/react/ui/data-identifiers.d.ts +0 -32
- package/dist/types/react/ui/icons.d.ts +0 -47
- package/dist/types/react/ui/index.d.ts +0 -109
- package/dist/types/react/ui/journey-flow.d.ts +0 -49
- package/dist/types/react/ui/keyboard.d.ts +0 -6
- package/dist/types/react/ui/metric-comparison.d.ts +0 -30
- package/dist/types/react/ui/metric.d.ts +0 -11
- package/dist/types/react/ui/presentation.d.ts +0 -25
- package/dist/types/react/ui/search.d.ts +0 -6
- package/dist/types/react/ui/searchItems.d.ts +0 -36
- package/dist/types/react/ui/shortcuts.d.ts +0 -45
- package/dist/types/react/ui/story.d.ts +0 -20
- package/dist/types/react/ui/useAppAppearance.d.ts +0 -3
- package/dist/types/react/ui/useDataAppPresentation.d.ts +0 -3
- package/dist/types/react/ui/useSvgId.d.ts +0 -2
- package/dist/types/react/ui/variables.d.ts +0 -38
- package/dist/types/react/ui/widget-views.d.ts +0 -3
- package/dist/types/react/view-control-bar.d.ts +0 -16
- package/dist/types/react/view-controls.d.ts +0 -20
- package/dist/types/react/view-runtime.d.ts +0 -31
- package/dist/types/react/view.d.ts +0 -78
- package/dist/types/react/widgets.d.ts +0 -79
- package/dist/types/server/local.d.ts +0 -19
- package/dist/types/server/preview/host.d.ts +0 -1
- package/dist/types/server/preview/index.d.ts +0 -16
- package/dist/types/server/reload-channel.d.ts +0 -6
- package/dist/worker.js +0 -106
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IsUnion, KnownRecord } from '../core/queries.js';
|
|
1
2
|
import type { DataOperations, Lakehouse } from '../core/contract.js';
|
|
2
3
|
import type { DataTransport } from './transport.js';
|
|
3
4
|
import type { DataQueryBody, InputOf, OutputOf } from '../core/operation-types.js';
|
|
@@ -9,24 +10,34 @@ export type DataResponse<Output, Input = unknown> = DataQueryBody<Output> & {
|
|
|
9
10
|
/** The exact browser input that produced this response. */
|
|
10
11
|
input: Input;
|
|
11
12
|
};
|
|
13
|
+
declare const clientContract: unique symbol;
|
|
12
14
|
export type DataClient<Operations extends DataOperations> = {
|
|
13
|
-
|
|
15
|
+
/** Preserve the operation registry when passing clients through helpers. */
|
|
16
|
+
readonly [clientContract]: (operations: Operations) => Operations;
|
|
17
|
+
query<Name extends keyof Operations & string>(this: void, name: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown), input: InputOf<Operations[NoInfer<Name>]>, options?: {
|
|
14
18
|
signal?: AbortSignal;
|
|
15
19
|
}): Promise<DataResponse<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>>;
|
|
16
20
|
};
|
|
17
|
-
|
|
18
|
-
export type DataClientOptions<Operations extends DataOperations> = {
|
|
19
|
-
operations: Operations;
|
|
20
|
-
lakehouse?: Lakehouse;
|
|
21
|
-
transport?: never;
|
|
22
|
-
endpoint?: never;
|
|
23
|
-
fetch?: never;
|
|
24
|
-
} | {
|
|
21
|
+
type TransportOptions = {
|
|
25
22
|
operations?: never;
|
|
26
23
|
lakehouse?: never;
|
|
27
24
|
transport?: DataTransport;
|
|
28
25
|
endpoint?: string;
|
|
29
26
|
fetch?: typeof fetch;
|
|
30
27
|
};
|
|
28
|
+
/** Browser operations and named-operation delivery are mutually exclusive. */
|
|
29
|
+
export type DataClientOptions<Operations extends DataOperations> = (KnownRecord<Operations> extends never ? never : true extends {
|
|
30
|
+
[Name in keyof Operations]: IsUnion<Operations[Name]>;
|
|
31
|
+
}[keyof Operations] ? never : unknown) & ({
|
|
32
|
+
operations: Operations;
|
|
33
|
+
lakehouse?: Lakehouse;
|
|
34
|
+
transport?: never;
|
|
35
|
+
endpoint?: never;
|
|
36
|
+
fetch?: never;
|
|
37
|
+
} | TransportOptions);
|
|
31
38
|
/** Named HTTP operations, or browser-owned operations executed through an authorized SQL bridge. */
|
|
32
|
-
export declare function createDataClient<Operations extends DataOperations>(options
|
|
39
|
+
export declare function createDataClient<Operations extends DataOperations>(options: DataClientOptions<Operations>): DataClient<Operations>;
|
|
40
|
+
/** Named clients derive data from the declared operations' run return types. */
|
|
41
|
+
export declare function createDataClient<Operations extends DataOperations>(...args: DataClientOptions<Operations> extends never ? [options: never] : []): DataClient<Operations>;
|
|
42
|
+
/** Without an operation contract, external operation data remains unknown. */
|
|
43
|
+
export declare function createDataClient(options?: TransportOptions): DataClient<DataOperations>;
|
|
@@ -8,7 +8,7 @@ export declare function createIframeTransport({ parentOrigin, window: frame, tim
|
|
|
8
8
|
mode?: 'url' | 'bundle';
|
|
9
9
|
loadScript?: (javascript: string) => void;
|
|
10
10
|
}): {
|
|
11
|
-
logger: import(".").DataAppLogger;
|
|
11
|
+
logger: import("./index.js").DataAppLogger;
|
|
12
12
|
request: (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
|
|
13
13
|
transport: (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
|
|
14
14
|
lakehouse: {
|
|
@@ -16,8 +16,8 @@ export declare function createIframeTransport({ parentOrigin, window: frame, tim
|
|
|
16
16
|
limit: number;
|
|
17
17
|
signal: AbortSignal;
|
|
18
18
|
name?: string;
|
|
19
|
-
params?: import("../core/
|
|
20
|
-
}): Promise<import("../core/
|
|
19
|
+
params?: import("../core/queries.js").QueryParameters;
|
|
20
|
+
}): Promise<import("../core/operation-types.js").QueryResult>;
|
|
21
21
|
};
|
|
22
22
|
dispose: () => void;
|
|
23
23
|
mode: "bundle" | "url";
|
|
@@ -37,7 +37,7 @@ export declare function localFrameBridge(window?: Window): LocalBridge | undefin
|
|
|
37
37
|
export declare function installDataAppTransport(bridge: ReturnType<typeof createIframeTransport>, frame?: Window): () => void;
|
|
38
38
|
/** The bootstrap installs this before executing app code. URL apps can install an explicit connection. */
|
|
39
39
|
export declare function getDataAppTransport(frame?: Window): {
|
|
40
|
-
logger: import(".").DataAppLogger;
|
|
40
|
+
logger: import("./index.js").DataAppLogger;
|
|
41
41
|
request: (message: RoutedMessage, signal?: AbortSignal) => Promise<unknown>;
|
|
42
42
|
transport: (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
|
|
43
43
|
lakehouse: {
|
|
@@ -45,8 +45,8 @@ export declare function getDataAppTransport(frame?: Window): {
|
|
|
45
45
|
limit: number;
|
|
46
46
|
signal: AbortSignal;
|
|
47
47
|
name?: string;
|
|
48
|
-
params?: import("../core/
|
|
49
|
-
}): Promise<import("../core/
|
|
48
|
+
params?: import("../core/queries.js").QueryParameters;
|
|
49
|
+
}): Promise<import("../core/operation-types.js").QueryResult>;
|
|
50
50
|
};
|
|
51
51
|
dispose: () => void;
|
|
52
52
|
mode: "bundle" | "url";
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
* @module @altertable/data-app/client
|
|
4
4
|
* @see https://github.com/altertable-ai/data-app/blob/main/docs/client.md
|
|
5
5
|
*/
|
|
6
|
-
export { createDataClient } from './data-client.js';
|
|
7
|
-
export
|
|
8
|
-
export type { DataAppLocation, AppLocation } from './location.js';
|
|
6
|
+
export { createDataClient, type InputOf, type OutputOf, type DataResponse, type DataClient, type DataClientOptions, } from './data-client.js';
|
|
7
|
+
export { type DataAppLocation, type AppLocation } from './location.js';
|
|
9
8
|
export { createDataAppNavigation, getDataAppNavigation, type DataAppNavigation, } from './navigation.js';
|
|
10
9
|
export { createHttpTransport, DataAppError, type DataTransport, } from './transport.js';
|
|
11
10
|
export { createIframeTransport, installDataAppTransport, getDataAppTransport, type IframeTransport, } from './iframe.js';
|
|
12
11
|
export { createMessageClient } from './messages.js';
|
|
13
|
-
export type
|
|
12
|
+
export { type DataAppLogger } from '../core/logger.js';
|
|
14
13
|
export { createAnnotationClient } from './annotations.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export type
|
|
1
|
+
import { type AppLocation, type HistoryMode } from '../core/navigation.js';
|
|
2
|
+
export { type AppLocation } from '../core/navigation.js';
|
|
3
3
|
export type DataAppLocation = {
|
|
4
4
|
snapshot(): AppLocation;
|
|
5
5
|
subscribe(listener: () => void): () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BridgeDiagnostic } from '../core/bridge.js';
|
|
2
2
|
import { type DataAppLogger, type LogEntry } from '../core/logger.js';
|
|
3
3
|
/** Lazy arguments run in the iframe; only resolved values cross the bridge. */
|
|
4
4
|
export declare function createBridgeLogger(enabled: () => boolean, send: (entry: LogEntry) => void): DataAppLogger;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HistoryMode } from '../core/navigation.js';
|
|
2
2
|
import { type DataAppLocation } from './location.js';
|
|
3
3
|
import { type IframeTransport } from './iframe.js';
|
|
4
4
|
export type DataAppNavigation = DataAppLocation & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TransportResponse } from '../core/bridge.js';
|
|
2
2
|
export type DataTransport = (operation: string, input: unknown, signal?: AbortSignal) => Promise<TransportResponse>;
|
|
3
3
|
declare const errorBrand: unique symbol;
|
|
4
4
|
export declare class DataAppError extends Error {
|
|
@@ -5,7 +5,7 @@ export declare const PARENT_PARAM = "__altertable_parent";
|
|
|
5
5
|
* The host enforces its own limit because frames can send messages directly. */
|
|
6
6
|
export declare const MAX_PENDING = 128;
|
|
7
7
|
export declare const REQUEST_TIMEOUT_MS = 60000;
|
|
8
|
-
export type
|
|
8
|
+
export { type TransportResponse } from './operation-types.js';
|
|
9
9
|
export declare function validId(value: unknown): value is string;
|
|
10
10
|
type Fields = Record<string, unknown>;
|
|
11
11
|
export type BridgeRole = 'host' | 'app';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { type DimensionSourceConfig, type DimensionSourceQueryName, type SourceDimensionVariable } from './dimension-source.js';
|
|
1
2
|
/**
|
|
2
3
|
* App configuration shared by browser and server.
|
|
3
4
|
* @module @altertable/data-app
|
|
4
5
|
*/
|
|
5
|
-
import { defineOperation } from './contract.js';
|
|
6
|
+
import { defineOperation, type OperationDefinition } from './contract.js';
|
|
6
7
|
import type { AppearanceOptions } from './appearance.js';
|
|
7
|
-
import { type QueryDefinitions } from './queries.js';
|
|
8
|
-
export type { QueryDefinitions, QueryParameterValue } from './queries.js';
|
|
8
|
+
import { type QueryDefinitions, type CheckedQueries, type QuerySnapshot } from './queries.js';
|
|
9
|
+
export type { QueryDefinitions, QueryParameterValue, QueryParameter, QueryValueType, QueryField, QueryProjections, QueryRow, } from './queries.js';
|
|
9
10
|
export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> = {
|
|
10
11
|
title: string;
|
|
11
12
|
/** Display labels; scope does not grant data access. */
|
|
@@ -22,21 +23,21 @@ export type DataAppConfig<Queries extends QueryDefinitions = QueryDefinitions> =
|
|
|
22
23
|
locale?: string;
|
|
23
24
|
timeZone?: string;
|
|
24
25
|
};
|
|
25
|
-
/** Named SQL statements
|
|
26
|
+
/** Named SQL statements with typed parameters and result projections. */
|
|
26
27
|
queries: Queries;
|
|
27
28
|
};
|
|
28
|
-
type ImmutableQueries<Queries extends QueryDefinitions> = {
|
|
29
|
-
readonly [Name in keyof Queries]: {
|
|
30
|
-
readonly statement: Queries[Name]['statement'];
|
|
31
|
-
readonly params: {
|
|
32
|
-
readonly [Param in keyof Queries[Name]['params']]: Readonly<Queries[Name]['params'][Param]>;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
29
|
/** An app declaration with operations bound to its query registry. */
|
|
37
30
|
export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinitions> = Readonly<Omit<DataAppConfig<Queries>, 'queries'>> & {
|
|
38
|
-
readonly queries:
|
|
39
|
-
|
|
31
|
+
readonly queries: QuerySnapshot<Queries>;
|
|
32
|
+
defineDimension<const Type extends 'string' | 'number'>(config: DimensionSourceConfig<Type> & {
|
|
33
|
+
source: {
|
|
34
|
+
query: DimensionSourceQueryName<Queries, NoInfer<Type>>;
|
|
35
|
+
};
|
|
36
|
+
}): SourceDimensionVariable<{
|
|
37
|
+
string: string;
|
|
38
|
+
number: number;
|
|
39
|
+
}[Type]>;
|
|
40
|
+
defineOperation<Input, Output>(operation: OperationDefinition<Input, Output, Queries>): ReturnType<typeof defineOperation<Input, Output, Queries>>;
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
42
43
|
* Define the app's query source of truth while preserving exact query and parameter names.
|
|
@@ -56,9 +57,11 @@ export type DataAppDefinition<Queries extends QueryDefinitions = QueryDefinition
|
|
|
56
57
|
* TypeScript checks the shape, not AST syntax. Keep executable composition outside the call.
|
|
57
58
|
*
|
|
58
59
|
* SQL passes unchanged to the backend, which interprets placeholders such as `$orgId`.
|
|
59
|
-
* Declare
|
|
60
|
+
* Declare each parameter's type and optional defaultValue.
|
|
60
61
|
* Values are finite numbers, strings, booleans, or null, never SQL fragments or identifiers.
|
|
61
|
-
*
|
|
62
|
+
* Host queryParams supply protected values; callers cannot override them.
|
|
62
63
|
*/
|
|
63
|
-
export declare function defineDataApp<const Queries extends QueryDefinitions>(config: DataAppConfig<Queries>
|
|
64
|
+
export declare function defineDataApp<const Queries extends QueryDefinitions>(config: DataAppConfig<Queries> & {
|
|
65
|
+
queries: CheckedQueries<Queries>;
|
|
66
|
+
}): DataAppDefinition<Queries>;
|
|
64
67
|
export declare function dataAppTitle(config: Pick<DataAppConfig, 'title' | 'scope'>): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type QueryDefinitions, type
|
|
2
|
-
export type { QueryDefinitions, QueryParameters, QueryParameterValue, } from './queries.js';
|
|
1
|
+
import { type QueryDefinitions, type CheckedQueries, type QueryInputParameters, type QueryRow, type IsUnion } from './queries.js';
|
|
2
|
+
export type { QueryDefinitions, QueryParameters, QueryParameterValue, QueryParameter, QueryValueType, QueryField, QueryProjections, QueryRow, } from './queries.js';
|
|
3
3
|
import type { DateRange as DateRangeInput } from './date-range.js';
|
|
4
4
|
import type { QueryResult, DataOperation, OperationContext } from './operation-types.js';
|
|
5
5
|
export type { QueryResult, DisclosedQuery, Lakehouse, OperationContext, DataOperation, DataOperations, } from './operation-types.js';
|
|
@@ -59,8 +59,6 @@ export declare function parseDateRangeInput(value: unknown, { minDate, maxDate,
|
|
|
59
59
|
/** Accepts numeric strings from DuckDB; rejects negative, fractional, and unsafe integers. */
|
|
60
60
|
export declare function parseCount(value: unknown): number;
|
|
61
61
|
export declare function parseLabel(value: unknown, maxLength?: number): string;
|
|
62
|
-
/** Rejects missing or duplicate columns and rows whose width differs from the column list. */
|
|
63
|
-
export declare function rowsAsRecords(result: QueryResult, requiredColumns: readonly string[]): Record<string, unknown>[];
|
|
64
62
|
export declare function defineQueryNames<const Names extends Record<string, string>>(names: Names): Names;
|
|
65
63
|
declare const sourceErrorBrand: unique symbol;
|
|
66
64
|
export declare class DataSourceError extends Error {
|
|
@@ -73,26 +71,37 @@ export declare class DataSourceError extends Error {
|
|
|
73
71
|
/** `cause` stays on the server or host for logs; responses carry only the reason. */
|
|
74
72
|
options?: ErrorOptions);
|
|
75
73
|
}
|
|
76
|
-
type RegisteredQueryParameters<Queries extends QueryDefinitions, Name extends keyof Queries> =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
type RegisteredQueryParameters<Queries extends QueryDefinitions, Name extends keyof Queries> = QueryInputParameters<Queries[Name]['params']>;
|
|
75
|
+
type ExactQueryParameters<Expected, Params extends object> = Params & Expected & Record<Exclude<keyof Params, keyof Expected>, never> & (Params extends (...args: never[]) => unknown ? never : object);
|
|
76
|
+
type ParameterNames<Queries extends QueryDefinitions, Name extends keyof Queries> = Name extends keyof Queries ? keyof RegisteredQueryParameters<Queries, Name> : never;
|
|
77
|
+
/** Dynamic limits are checked at execution; known limits must be positive integers. */
|
|
78
|
+
type QueryLimit<Limit extends number> = number extends Limit ? number : `${Limit}` extends '0' | `-${string}` ? never : `${Limit}` extends `${bigint}` ? Limit : never;
|
|
79
|
+
export type RegisteredQuery<Queries extends QueryDefinitions> = <Name extends keyof Queries & string, const Params extends object = {}, const Limit extends number = number>(name: Name & (true extends IsUnion<NoInfer<Name>> ? [ParameterNames<Queries, Name>] extends [never] ? unknown : never : unknown), params?: ExactQueryParameters<RegisteredQueryParameters<Queries, NoInfer<Name>>, Params>, options?: {
|
|
80
|
+
limit?: Limit & QueryLimit<NoInfer<Limit>>;
|
|
81
|
+
}) => Promise<QueryResult<QueryRow<Queries[Name]['projections']>>>;
|
|
82
|
+
/** Infer operation data from run(). */
|
|
83
|
+
export type OperationDefinition<Input, Output, Queries extends QueryDefinitions> = Omit<DataOperation<Input, Output>, 'run' | 'queryNames'> & {
|
|
82
84
|
run: (context: Pick<OperationContext, 'signal'> & {
|
|
83
85
|
query: RegisteredQuery<NoInfer<Queries>>;
|
|
84
86
|
}, input: Input) => Promise<Output>;
|
|
87
|
+
};
|
|
88
|
+
export declare function defineOperation<Input, Output, const Queries extends QueryDefinitions>(operation: OperationDefinition<Input, Output, Queries> & {
|
|
89
|
+
queries: CheckedQueries<Queries>;
|
|
85
90
|
}): Omit<DataOperation<Input, Output>, 'queryNames'> & {
|
|
86
91
|
queryNames: {
|
|
87
92
|
readonly [Name in keyof Queries & string]: Name;
|
|
88
93
|
};
|
|
89
94
|
};
|
|
95
|
+
/** The built-in connection operation shares one contract with setup clients. */
|
|
96
|
+
export type ConnectionOperation = Omit<DataOperation<Record<string, never>, true>, 'queryNames'> & {
|
|
97
|
+
queryNames: {
|
|
98
|
+
readonly connection: 'connection';
|
|
99
|
+
};
|
|
100
|
+
};
|
|
90
101
|
/** A connectivity probe uses the app's registered connection query. */
|
|
91
102
|
export declare function connectionCheck<const Queries extends QueryDefinitions & {
|
|
92
103
|
connection: QueryDefinitions[string];
|
|
93
|
-
}>(queries: Queries):
|
|
94
|
-
queryNames: { readonly [Name in keyof Queries & string]: Name; };
|
|
95
|
-
};
|
|
104
|
+
}>(queries: CheckedQueries<Queries>): ConnectionOperation;
|
|
96
105
|
export { dimensionFilter, parseDimensionSelection, parseFacetOptions, dimensionPredicate, } from './dimension.js';
|
|
97
106
|
export type { DimensionSelection, DimensionMember, DimensionOption, DimensionVariable, DimensionFilterOptions, } from './dimension.js';
|
|
98
107
|
export { createMessageRouter, defineMessageRoute, defineDataQueryRoute, MessageRoutingError, dataAppRoutes, navigationUpdateRoute, sqlQueryRoute, } from './messages.js';
|
|
@@ -102,3 +111,4 @@ export { annotationDraftRoute, annotationModeRoute, annotationEditorStateRoute,
|
|
|
102
111
|
export type { DataAppAnnotationDraft, DataAppAnnotationPresentation, } from './annotations.js';
|
|
103
112
|
export { numberFilter, booleanFilter, parseNumberSelection, parseBooleanSelection, } from './filters.js';
|
|
104
113
|
export type { NumberSelection, NumberOperator, NumberFilter, BooleanSelection, BooleanFilter, } from './filters.js';
|
|
114
|
+
export { variableInput } from './dimension-source.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type DimensionSettings, type DimensionSelectionVariable, type DimensionValue } from './dimension.js';
|
|
2
|
+
import type { AppVariableValues, VariableCollection } from './variables.js';
|
|
3
|
+
import { type QueryDefinitions, type QueryParameters } from './queries.js';
|
|
4
|
+
import type { DataOperation, DataOperations, QueryResult } from './operation-types.js';
|
|
5
|
+
export declare const dimensionSource: unique symbol;
|
|
6
|
+
export type SourceDimensionVariable<Value extends DimensionValue> = DimensionSelectionVariable<Value> & {
|
|
7
|
+
readonly optionsSource: 'query';
|
|
8
|
+
readonly [dimensionSource]: {
|
|
9
|
+
readonly operation: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
declare const invalidMemberKey: unique symbol;
|
|
13
|
+
export declare class DimensionMembershipError extends Error {
|
|
14
|
+
readonly [invalidMemberKey] = true;
|
|
15
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Validate named variable values at the operation boundary. Date inputs belong to the base parser. */
|
|
18
|
+
export declare function variableInput<Input extends object, const Variables extends VariableCollection>(parse: (value: unknown) => Input, variables: Variables & {
|
|
19
|
+
[Key in keyof Variables]: Variables[Key] extends {
|
|
20
|
+
kind: 'dateRange';
|
|
21
|
+
} ? never : Variables[Key];
|
|
22
|
+
}): (value: unknown) => Input & AppVariableValues<Variables>;
|
|
23
|
+
export type DimensionSourceConfig<Type extends 'string' | 'number'> = DimensionSettings & {
|
|
24
|
+
allowMissing?: false;
|
|
25
|
+
valueType: Type;
|
|
26
|
+
source: {
|
|
27
|
+
query: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type DimensionSourceQueryName<Queries extends QueryDefinitions, Type extends 'string' | 'number'> = {
|
|
31
|
+
[Name in keyof Queries & string]: Queries[Name] extends {
|
|
32
|
+
params: {
|
|
33
|
+
member: {
|
|
34
|
+
type: Type;
|
|
35
|
+
nullable: true;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
projections: {
|
|
39
|
+
value: {
|
|
40
|
+
type: Type;
|
|
41
|
+
nullable?: false;
|
|
42
|
+
};
|
|
43
|
+
label: {
|
|
44
|
+
type: 'string';
|
|
45
|
+
nullable?: false;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} ? 'count' extends keyof Queries[Name]['projections'] ? Queries[Name]['projections']['count'] extends {
|
|
49
|
+
type: 'number';
|
|
50
|
+
nullable?: false;
|
|
51
|
+
} ? Name : never : Name : never;
|
|
52
|
+
}[keyof Queries & string];
|
|
53
|
+
/** A query supplies independent options and exact member lookup; it declares a nullable `member` parameter. */
|
|
54
|
+
export declare function bindDimensionSource<const Type extends 'string' | 'number'>(config: DimensionSourceConfig<Type>, queries: QueryDefinitions): SourceDimensionVariable<{
|
|
55
|
+
string: string;
|
|
56
|
+
number: number;
|
|
57
|
+
}[Type]>;
|
|
58
|
+
type Query = (name: string, params: QueryParameters, options: {
|
|
59
|
+
limit: number;
|
|
60
|
+
}) => Promise<QueryResult<Record<string, unknown>>>;
|
|
61
|
+
export declare function validateVariableInput(parser: Function, input: unknown, query: Query): Promise<void>;
|
|
62
|
+
export declare function attachDimensionSelectors(operation: DataOperation<any, any>, queries: QueryDefinitions): void;
|
|
63
|
+
export declare function withDimensionSelectors<Operations extends DataOperations>(operations: Operations): Operations;
|
|
64
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { facetSource } from './facets.js';
|
|
1
2
|
import type { AppVariable, HistoryMode, VariablePresentation } from './variables.js';
|
|
2
3
|
export type DimensionValue = string | number;
|
|
3
4
|
export type DimensionMember<T extends DimensionValue = DimensionValue> = {
|
|
@@ -17,47 +18,54 @@ export type DimensionOption<T extends DimensionValue = DimensionValue> = {
|
|
|
17
18
|
label: string;
|
|
18
19
|
count?: number;
|
|
19
20
|
};
|
|
20
|
-
export type
|
|
21
|
+
export type DimensionSelectionVariable<T extends DimensionValue = DimensionValue> = AppVariable<DimensionSelection<T>, 'dimension'> & {
|
|
22
|
+
readonly optionsSource: 'fixed' | 'query';
|
|
21
23
|
label: string;
|
|
22
24
|
selectionMode: 'single' | 'multiple';
|
|
23
|
-
valueType: '
|
|
25
|
+
readonly valueType: T extends number ? 'number' : 'string';
|
|
24
26
|
allowMissing: boolean;
|
|
25
27
|
allowExclusion: boolean;
|
|
26
28
|
maxSelected: number;
|
|
27
29
|
options: readonly DimensionOption<T>[];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
describe: (selection: DimensionSelection<T>, options?: readonly DimensionOption<T>[]) => string;
|
|
31
|
+
};
|
|
32
|
+
/** A fixed-option dimension retains its distinction from query-backed facets. */
|
|
33
|
+
export type DimensionVariable<T extends DimensionValue = DimensionValue> = DimensionSelectionVariable<T> & {
|
|
34
|
+
readonly optionsSource: 'fixed';
|
|
35
|
+
readonly [facetSource]?: never;
|
|
33
36
|
};
|
|
34
37
|
export declare function dimensionMemberKey(member: DimensionMember): string;
|
|
35
|
-
export type
|
|
38
|
+
export type DimensionSettings = {
|
|
36
39
|
key: string;
|
|
37
40
|
label: string;
|
|
38
|
-
valueType: T extends number ? 'number' : 'string';
|
|
39
|
-
selectionMode: 'single' | 'multiple';
|
|
40
41
|
allowMissing?: boolean;
|
|
41
42
|
allowExclusion?: boolean;
|
|
42
|
-
maxSelected?: number;
|
|
43
43
|
history?: HistoryMode;
|
|
44
44
|
presentation?: VariablePresentation;
|
|
45
45
|
} & ({
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
selectionMode: 'single';
|
|
47
|
+
maxSelected?: 1;
|
|
48
48
|
} | {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
operation: string;
|
|
52
|
-
input: (values: Record<string, unknown>) => unknown;
|
|
53
|
-
};
|
|
54
|
-
options?: never;
|
|
49
|
+
selectionMode: 'multiple';
|
|
50
|
+
maxSelected?: number;
|
|
55
51
|
});
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
export type DimensionFilterSettings<T extends DimensionValue> = DimensionSettings & {
|
|
53
|
+
valueType: T extends number ? 'number' : 'string';
|
|
54
|
+
};
|
|
55
|
+
export type DimensionFilterOptions<T extends DimensionValue> = DimensionFilterSettings<T> & {
|
|
56
|
+
options: readonly DimensionOption<T>[];
|
|
57
|
+
facet?: never;
|
|
58
|
+
};
|
|
59
|
+
/** A bounded categorical filter with app-owned fixed options. */
|
|
60
|
+
export declare function dimensionFilter<const T extends string>(config: DimensionFilterOptions<T>): DimensionVariable<T>;
|
|
61
|
+
export declare function dimensionFilter<const T extends number>(config: DimensionFilterOptions<T>): DimensionVariable<T>;
|
|
62
|
+
/** Shared fixed-option and query-backed selection behavior. */
|
|
63
|
+
export declare function createDimensionFilter<const T extends DimensionValue>(config: DimensionFilterSettings<T> & {
|
|
64
|
+
options: readonly DimensionOption<T>[];
|
|
65
|
+
}, dynamic?: boolean): DimensionSelectionVariable<T>;
|
|
58
66
|
/** Server-side parser; call from the operation input parser before building SQL. */
|
|
59
|
-
export declare function parseDimensionSelection<T extends DimensionValue>(value: unknown, filter:
|
|
67
|
+
export declare function parseDimensionSelection<T extends DimensionValue>(value: unknown, filter: DimensionSelectionVariable<T>): DimensionSelection<T>;
|
|
60
68
|
/** Validate bounded facet results before showing them in a picker. */
|
|
61
|
-
export declare function parseFacetOptions<T extends DimensionValue>(value: unknown, filter:
|
|
69
|
+
export declare function parseFacetOptions<T extends DimensionValue>(value: unknown, filter: DimensionSelectionVariable<T>): DimensionOption<T>[];
|
|
62
70
|
/** Central SQL literal encoding for transports without bound parameters. Column is an allowlisted identifier. */
|
|
63
71
|
export declare function dimensionPredicate<T extends DimensionValue, const Columns extends readonly string[]>(column: Columns[number], selection: DimensionSelection<T>, allowedColumns: Columns): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VariableCollection } from './variables.js';
|
|
2
|
+
import type { DimensionSelectionVariable, DimensionValue } from './dimension.js';
|
|
3
|
+
/** Executable facet sources are attached only by the typed hooks factory. */
|
|
4
|
+
export declare const facetSource: unique symbol;
|
|
5
|
+
export type FacetSourceDefinition<Context extends VariableCollection = VariableCollection, Name extends string = string, Input = unknown> = {
|
|
6
|
+
readonly context: Context;
|
|
7
|
+
readonly operation: Name;
|
|
8
|
+
readonly input: (values: Record<string, unknown>) => Input;
|
|
9
|
+
};
|
|
10
|
+
export type FacetVariable<Value extends DimensionValue, Context extends VariableCollection, Name extends string, Input> = DimensionSelectionVariable<Value> & {
|
|
11
|
+
readonly optionsSource: 'query';
|
|
12
|
+
readonly [facetSource]: FacetSourceDefinition<Context, Name, Input>;
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AppVariable, type HistoryMode, type VariablePresentation } from './variables.js';
|
|
2
2
|
export type NumberOperator = 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
3
3
|
export type NumberSelection = {
|
|
4
4
|
kind: 'all';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type DateFormatOptions } from './date-format.js';
|
|
2
|
-
export { formatDate, formatDateTime, formatTime, parseDateTime, } from './date-format.js';
|
|
3
|
-
export type { DateFormat, DateFormatOptions, DateTimeFormatOptions, } from './date-format.js';
|
|
2
|
+
export { formatDate, formatDateTime, formatTime, parseDateTime, type DateFormat, type DateFormatOptions, type DateTimeFormatOptions, } from './date-format.js';
|
|
4
3
|
/**
|
|
5
4
|
* Date and number formatting with explicit units and missing-value behavior.
|
|
6
5
|
* @module @altertable/data-app/format
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type QueryParameters } from './queries.js';
|
|
2
|
-
import type
|
|
3
|
-
export type
|
|
2
|
+
import { type TransportResponse, type QueryResult, type OperationContracts, type DataQueryInput, type DataQueryBody, type OutputOf } from './operation-types.js';
|
|
3
|
+
export { type OperationContracts, type DataQueryInput, type DataQueryBody, } from './operation-types.js';
|
|
4
4
|
import { type NavigationUpdate } from './navigation.js';
|
|
5
|
-
export type
|
|
5
|
+
export { type NavigationUpdate } from './navigation.js';
|
|
6
6
|
export type MessageContext = {
|
|
7
7
|
signal: AbortSignal;
|
|
8
8
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Shared operation, query, and response contracts; independent of delivery adapters. */
|
|
2
|
-
import type
|
|
2
|
+
import { type QueryParameters } from './queries.js';
|
|
3
3
|
export type OperationContracts = Record<string, {
|
|
4
4
|
input: (value: unknown) => unknown;
|
|
5
5
|
}>;
|
|
@@ -10,12 +10,13 @@ export type InputOf<T> = T extends {
|
|
|
10
10
|
export type OutputOf<T> = T extends {
|
|
11
11
|
run: (...args: never[]) => Promise<infer Output>;
|
|
12
12
|
} ? Output : unknown;
|
|
13
|
-
|
|
13
|
+
/** Lakehouse results contain positional unknown cells; registered queries supply decoded records. */
|
|
14
|
+
export type QueryResult<Row = unknown[]> = {
|
|
14
15
|
columns: {
|
|
15
16
|
name: string;
|
|
16
17
|
type?: string;
|
|
17
18
|
}[];
|
|
18
|
-
rows:
|
|
19
|
+
rows: Row[];
|
|
19
20
|
queryId?: string;
|
|
20
21
|
};
|
|
21
22
|
/** One registered statement an operation ran, with its parameter values. */
|
|
@@ -42,12 +43,12 @@ export type OperationContext = {
|
|
|
42
43
|
/**
|
|
43
44
|
* The input parser runs in the operation executor's runtime: server for HTTP apps, browser for
|
|
44
45
|
* bundle apps. Browser validation does not replace backend authorization or query limits.
|
|
45
|
-
*
|
|
46
|
+
* Registered queries decode rows from their declared projections; `run` derives the operation's data.
|
|
46
47
|
*/
|
|
47
48
|
export type DataOperation<Input, Output> = {
|
|
48
49
|
input: (value: unknown) => Input;
|
|
49
50
|
run: (context: OperationContext, input: Input) => Promise<Output>;
|
|
50
|
-
checks: readonly Input[];
|
|
51
|
+
checks: readonly [Input, ...Input[]];
|
|
51
52
|
queryNames?: Readonly<Record<string, string>>;
|
|
52
53
|
policy: {
|
|
53
54
|
maxQueryRows: number;
|
|
@@ -57,7 +58,7 @@ export type DataOperation<Input, Output> = {
|
|
|
57
58
|
};
|
|
58
59
|
/** Heterogeneous registry: inputs vary per operation, so checks retain unknown values. */
|
|
59
60
|
export type DataOperations = Record<string, OperationContracts[string] & Omit<DataOperation<never, unknown>, 'input' | 'checks'> & {
|
|
60
|
-
checks: readonly unknown[];
|
|
61
|
+
checks: readonly [unknown, ...unknown[]];
|
|
61
62
|
}>;
|
|
62
63
|
export type DataQueryInput<Operations extends OperationContracts> = {
|
|
63
64
|
[Name in keyof Operations & string]: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DataAppAnnotationPresentation } from './annotations.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Theme } from './appearance.js';
|
|
3
3
|
/** Presentation owned by the parent shell, delivered only over a trusted bridge. */
|
|
4
4
|
export type DataAppPresentation = {
|
|
5
5
|
surface: 'embedded' | 'standalone';
|