@altertable/data-app 0.69.0 → 0.70.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 +4 -0
- package/dist/chunks/{index-m0gbxtgp.js → index-2ajhmsc4.js} +3 -3
- package/dist/chunks/{index-m0gbxtgp.js.map → index-2ajhmsc4.js.map} +1 -1
- package/dist/chunks/{index-2sbp9h2b.js → index-58kks6a8.js} +1 -1
- package/dist/chunks/{index-2sbp9h2b.js.map → index-58kks6a8.js.map} +2 -2
- package/dist/chunks/{index-ap60vggk.js → index-7q99hf1z.js} +18 -11
- package/dist/chunks/index-7q99hf1z.js.map +10 -0
- package/dist/chunks/{index-kwnqycjt.js → index-9zqbrv2z.js} +7 -3
- package/dist/chunks/index-9zqbrv2z.js.map +10 -0
- package/dist/chunks/{index-k766wwwr.js → index-q1w84fv9.js} +167 -24
- package/dist/chunks/index-q1w84fv9.js.map +15 -0
- package/dist/chunks/{index-zcqxfwdq.js → index-rew95tbg.js} +85 -10
- package/dist/chunks/index-rew95tbg.js.map +13 -0
- package/dist/chunks/{index-qhzdzca2.js → index-vtpygsbq.js} +2392 -991
- package/dist/chunks/index-vtpygsbq.js.map +126 -0
- package/dist/chunks/{index-r7b1ftwy.js → index-wjt6cavj.js} +5 -3
- package/dist/chunks/index-wjt6cavj.js.map +10 -0
- package/dist/chunks/{index-sx488hvs.js → index-xzb7sx6g.js} +3 -3
- package/dist/client/index.js +5 -5
- package/dist/core/config.js +2 -2
- package/dist/core/contract.js +6 -6
- package/dist/core/contract.js.map +1 -1
- package/dist/embed/index.js +5 -5
- package/dist/index.js +2 -2
- package/dist/local.js +35 -2
- package/dist/local.js.map +8 -6
- package/dist/preview.js +15 -15
- package/dist/preview.js.map +6 -6
- package/dist/react/embed/index.js +1 -1
- package/dist/react/index.js +273 -331
- package/dist/react/index.js.map +5 -8
- package/dist/react/ui/index.js +874 -502
- package/dist/react/ui/index.js.map +24 -23
- package/dist/server.js +35 -2
- package/dist/server.js.map +8 -6
- package/dist/types/client/data-client.d.ts +21 -10
- 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/keys.d.ts +2 -0
- package/dist/types/core/operation-types.d.ts +6 -5
- package/dist/types/core/queries.d.ts +75 -7
- package/dist/types/core/variables.d.ts +38 -12
- package/dist/types/embed/sql.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/react/actions.d.ts +53 -0
- package/dist/types/react/bindings.d.ts +36 -0
- package/dist/types/react/details.d.ts +46 -0
- package/dist/types/react/exploration.d.ts +44 -0
- package/dist/types/react/hooks.d.ts +76 -38
- package/dist/types/react/index.d.ts +3 -0
- package/dist/types/react/style-contract.d.ts +1 -1
- package/dist/types/react/ui/AboutData.d.ts +9 -4
- package/dist/types/react/ui/AreaChart.d.ts +2 -2
- package/dist/types/react/ui/BarChart.d.ts +2 -2
- package/dist/types/react/ui/Button.d.ts +2 -1
- package/dist/types/react/ui/ComposedChartLegend.d.ts +2 -1
- package/dist/types/react/ui/DataApp.d.ts +3 -0
- package/dist/types/react/ui/DataWidget.d.ts +3 -0
- package/dist/types/react/ui/DimensionPicker.d.ts +2 -2
- package/dist/types/react/ui/ExplorationActionControl.d.ts +60 -0
- package/dist/types/react/ui/InspectionProvider.d.ts +2 -2
- package/dist/types/react/ui/LineChart.d.ts +2 -2
- package/dist/types/react/ui/Menu.d.ts +3 -2
- package/dist/types/react/ui/MetricWidget.d.ts +2 -0
- package/dist/types/react/ui/PickerField.d.ts +9 -1
- package/dist/types/react/ui/PieChart.d.ts +2 -2
- package/dist/types/react/ui/Select.d.ts +5 -1
- package/dist/types/react/ui/Sheet.d.ts +1 -1
- package/dist/types/react/ui/TrendChart.d.ts +3 -3
- package/dist/types/react/ui/VisualizationWidget.d.ts +1 -1
- package/dist/types/react/ui/chart-data.d.ts +8 -6
- package/dist/types/react/ui/chart-date-axis.d.ts +1 -1
- package/dist/types/react/ui/chart-interaction.d.ts +15 -9
- package/dist/types/react/ui/chart-time.d.ts +8 -5
- package/dist/types/react/ui/icons.d.ts +2 -0
- package/dist/types/react/ui/index.d.ts +2 -0
- package/dist/types/react/ui/use-chart-scroll-to-end.d.ts +2 -0
- package/dist/types/react/view-control-bar.d.ts +6 -4
- package/dist/types/react/view-runtime.d.ts +5 -2
- package/dist/types/react/view.d.ts +15 -6
- package/dist/types/react/widgets.d.ts +22 -11
- package/dist/worker.js +1 -1
- package/docs/app-authoring.md +10 -3
- package/docs/client.md +5 -6
- package/docs/composition.md +84 -0
- package/docs/contract.md +41 -21
- package/docs/data-context.md +2 -0
- package/docs/server.md +1 -1
- package/docs/styling.md +4 -0
- package/docs/ui.md +12 -1
- package/docs/variables.md +83 -11
- package/docs/views.md +56 -2
- package/docs/widgets.md +93 -0
- package/examples/starter-data-app/index.tsx +10 -22
- package/examples/starter-local-data-app/app.ts +7 -1
- package/examples/starter-local-data-app/tsconfig.json +7 -1
- package/package.json +1 -1
- package/dist/chunks/index-ap60vggk.js.map +0 -10
- package/dist/chunks/index-k766wwwr.js.map +0 -13
- package/dist/chunks/index-kwnqycjt.js.map +0 -10
- package/dist/chunks/index-qhzdzca2.js.map +0 -118
- package/dist/chunks/index-r7b1ftwy.js.map +0 -10
- package/dist/chunks/index-zcqxfwdq.js.map +0 -13
- /package/dist/chunks/{index-sx488hvs.js.map → index-xzb7sx6g.js.map} +0 -0
|
@@ -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
|
+
};
|
|
@@ -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,16 +1,84 @@
|
|
|
1
|
+
import type { QueryResult } from './operation-types.js';
|
|
2
|
+
type QueryValues = {
|
|
3
|
+
string: string;
|
|
4
|
+
number: number;
|
|
5
|
+
boolean: boolean;
|
|
6
|
+
null: null;
|
|
7
|
+
};
|
|
8
|
+
/** Primitive values after decoding, independent of SQL storage types. */
|
|
9
|
+
export type QueryValueType = keyof QueryValues;
|
|
10
|
+
export type QueryField = {
|
|
11
|
+
type: QueryValueType;
|
|
12
|
+
nullable?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type QueryProjections = Readonly<Record<string, QueryField>>;
|
|
15
|
+
type QueryValue<Field extends QueryField> = QueryValues[Field['type']] | (Field extends {
|
|
16
|
+
nullable: true;
|
|
17
|
+
} ? null : never);
|
|
18
|
+
export type QueryRow<Projections extends QueryProjections> = {
|
|
19
|
+
-readonly [Name in keyof Projections]: QueryValue<Projections[Name]>;
|
|
20
|
+
};
|
|
1
21
|
export type QueryParameterValue = string | number | boolean | null;
|
|
22
|
+
/** Typed scalar parameters with optional fallback values. */
|
|
23
|
+
export type QueryParameter = {
|
|
24
|
+
[Type in QueryValueType]: {
|
|
25
|
+
type: Type;
|
|
26
|
+
nullable?: false;
|
|
27
|
+
defaultValue?: QueryValues[Type];
|
|
28
|
+
} | {
|
|
29
|
+
type: Type;
|
|
30
|
+
nullable: true;
|
|
31
|
+
defaultValue?: QueryValues[Type] | null;
|
|
32
|
+
};
|
|
33
|
+
}[QueryValueType];
|
|
34
|
+
/** Callers may omit values supplied by host context or declaration defaults. */
|
|
35
|
+
export type QueryInputParameters<Params extends Readonly<Record<string, QueryParameter>>> = {
|
|
36
|
+
[Name in keyof Params]?: QueryValue<Params[Name]>;
|
|
37
|
+
};
|
|
2
38
|
type QueryDefinition = {
|
|
3
39
|
statement: string;
|
|
4
|
-
params: Readonly<Record<string,
|
|
5
|
-
|
|
6
|
-
}>>;
|
|
40
|
+
params: Readonly<Record<string, QueryParameter>>;
|
|
41
|
+
projections: QueryProjections;
|
|
7
42
|
};
|
|
8
43
|
export type QueryDefinitions = Readonly<Record<string, QueryDefinition>>;
|
|
44
|
+
export type IsUnion<Value, Whole = Value> = Value extends Whole ? [Whole] extends [Value] ? false : true : never;
|
|
45
|
+
export type KnownRecord<RecordType> = '__proto__' extends keyof RecordType ? never : string extends keyof RecordType ? never : Exclude<keyof RecordType, string> extends never ? true extends IsUnion<RecordType> ? never : RecordType : never;
|
|
46
|
+
type CheckedField<Field extends QueryField> = true extends IsUnion<Field> ? never : true extends IsUnion<Field['type']> ? never : 'nullable' extends keyof Field ? Field extends {
|
|
47
|
+
nullable: infer Nullable;
|
|
48
|
+
} ? boolean extends Nullable ? never : Field : never : Field;
|
|
49
|
+
type CheckedParameters<Params extends Readonly<Record<string, QueryParameter>>> = KnownRecord<Params> & {
|
|
50
|
+
[Name in keyof Params]: CheckedField<Params[Name]> & ('defaultValue' extends keyof Params[Name] ? undefined extends Params[Name]['defaultValue'] ? never : Params[Name] : Params[Name]);
|
|
51
|
+
};
|
|
52
|
+
type CheckedProjections<Projections extends QueryProjections> = KnownRecord<Projections> & (keyof Projections extends never ? never : '' extends keyof Projections ? never : {
|
|
53
|
+
[Name in keyof Projections]: CheckedField<Projections[Name]>;
|
|
54
|
+
});
|
|
55
|
+
/** Author declarations preserve finite names, fixed types, and one parameter map. */
|
|
56
|
+
export type CheckedQueries<Queries extends QueryDefinitions> = KnownRecord<Queries> & ('' extends keyof Queries ? never : unknown) & {
|
|
57
|
+
[Name in keyof Queries]: KnownRecord<Queries[Name]> & {
|
|
58
|
+
statement: Queries[Name]['statement'] extends '' ? never : Queries[Name]['statement'];
|
|
59
|
+
params: CheckedParameters<Queries[Name]['params']>;
|
|
60
|
+
projections: CheckedProjections<Queries[Name]['projections']>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
type FrozenField<Field extends QueryField> = Field extends unknown ? Readonly<Field> : never;
|
|
64
|
+
export type QuerySnapshot<Queries extends QueryDefinitions> = {
|
|
65
|
+
readonly [Name in keyof Queries]: {
|
|
66
|
+
readonly statement: Queries[Name]['statement'];
|
|
67
|
+
readonly params: {
|
|
68
|
+
readonly [Param in keyof Queries[Name]['params']]: FrozenField<Queries[Name]['params'][Param]>;
|
|
69
|
+
};
|
|
70
|
+
readonly projections: {
|
|
71
|
+
readonly [Field in keyof Queries[Name]['projections']]: FrozenField<Queries[Name]['projections'][Field]>;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
9
75
|
/** Parameters are scalar SQL values, never identifiers or SQL fragments. */
|
|
10
76
|
export type QueryParameters = Readonly<Record<string, QueryParameterValue>>;
|
|
11
77
|
export declare function isQueryParameters(value: unknown): value is QueryParameters;
|
|
12
|
-
/**
|
|
13
|
-
export declare function snapshotQueries(definitions:
|
|
14
|
-
/**
|
|
15
|
-
export declare function
|
|
78
|
+
/** Snapshot the query's SQL, parameter defaults, and decoded result contract. */
|
|
79
|
+
export declare function snapshotQueries<const Queries extends QueryDefinitions>(definitions: Queries): QuerySnapshot<Queries>;
|
|
80
|
+
/** Decode each returned cell once, matching aliases independently of result order. */
|
|
81
|
+
export declare function decodeQueryResult<Projections extends QueryProjections>(result: QueryResult, projections: Projections): QueryResult<QueryRow<Projections>>;
|
|
82
|
+
/** Host context supplies protected values; callers and defaults fill the remaining parameters. */
|
|
83
|
+
export declare function resolveQueryParameters(declarations: Readonly<Record<string, QueryParameter>>, values: Partial<QueryParameters>, context: QueryParameters): QueryParameters;
|
|
16
84
|
export {};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import type { IsUnion } from './queries.js';
|
|
2
|
+
import { facetSource, type FacetVariable } from './facets.js';
|
|
3
|
+
import type { SourceDimensionVariable } from './dimension-source.js';
|
|
1
4
|
import { type DatePresetId, type DateRange } from './date-range.js';
|
|
2
5
|
import type { DateRangeContract, DateRangeRequest } from './contract.js';
|
|
3
|
-
import type { DimensionSelection, DimensionVariable } from './dimension.js';
|
|
6
|
+
import type { DimensionSelection, DimensionVariable, DimensionSelectionVariable } from './dimension.js';
|
|
4
7
|
import type { NumberFilter, BooleanFilter } from './filters.js';
|
|
5
8
|
import type { HistoryMode } from './navigation.js';
|
|
6
9
|
export type { HistoryMode } from './navigation.js';
|
|
7
10
|
export type VariablePresentation = {
|
|
8
11
|
/** Scope changes the included data; display changes its presentation. Defaults to scope. */
|
|
9
12
|
group?: 'scope' | 'display';
|
|
13
|
+
/** Widget controls render beside their visualization instead of in the toolbar.
|
|
14
|
+
* Scope filters remain available in the Filters sheet and active summaries. */
|
|
15
|
+
control?: 'toolbar' | 'widget';
|
|
10
16
|
/** Secondary scope controls live in the Filters sheet with compact pickers when active; secondary display options follow primary options. Defaults to primary. */
|
|
11
17
|
prominence?: 'primary' | 'secondary';
|
|
12
18
|
};
|
|
@@ -26,10 +32,24 @@ export type AppVariable<Value, Kind extends string = string> = {
|
|
|
26
32
|
valid: (value: Value) => boolean;
|
|
27
33
|
same: (left: Value, right: Value) => boolean;
|
|
28
34
|
};
|
|
29
|
-
export type VariableCollection = Record<string, SearchVariable | ChoiceVariable | MultiChoiceVariable | DateRangeVariable | DimensionVariable<any> | NumberFilter | BooleanFilter>;
|
|
35
|
+
export type VariableCollection = Record<string, SearchVariable | ChoiceVariable<any> | MultiChoiceVariable | DateRangeVariable | DimensionVariable<any> | FacetVariable<any, any, string, unknown> | SourceDimensionVariable<any> | NumberFilter | BooleanFilter>;
|
|
30
36
|
export type AppVariableValues<Variables> = {
|
|
31
|
-
[Key in keyof Variables]: Variables[Key] extends
|
|
37
|
+
[Key in keyof Variables]: Variables[Key] extends DimensionSelectionVariable<infer Value> ? DimensionSelection<Value> : Variables[Key] extends AppVariable<infer Value, string> ? Value : never;
|
|
32
38
|
};
|
|
39
|
+
/** Keep conditional declarations narrowed so every dependency has one contract. */
|
|
40
|
+
export type CheckedVariableDeclarations<Variables extends VariableCollection> = true extends IsUnion<Variables> ? never : string extends keyof Variables ? Variables : '__proto__' extends keyof Variables ? never : {
|
|
41
|
+
[Name in keyof Variables]: true extends IsUnion<Variables[Name]> ? never : Variables[Name];
|
|
42
|
+
};
|
|
43
|
+
/** Every facet dependency must be present with a compatible variable declaration. */
|
|
44
|
+
export type CheckedFacetContexts<Variables extends VariableCollection> = CheckedVariableDeclarations<Variables> & (string extends keyof Variables ? Extract<Variables[keyof Variables], {
|
|
45
|
+
[facetSource]: unknown;
|
|
46
|
+
}> extends never ? Variables : never : {
|
|
47
|
+
[Name in keyof Variables]: Variables[Name] extends {
|
|
48
|
+
[facetSource]: {
|
|
49
|
+
context: infer Context;
|
|
50
|
+
};
|
|
51
|
+
} ? string extends keyof Context ? never : Variables extends Context ? Variables[Name] : never : Variables[Name];
|
|
52
|
+
});
|
|
33
53
|
/** Name variables once in the app. URL keys must be unique across its controls. */
|
|
34
54
|
export declare function defineAppVariables<const Variables extends VariableCollection>(variables: Variables): Variables;
|
|
35
55
|
type ScalarVariableOptions = {
|
|
@@ -45,7 +65,7 @@ export type ChoiceOption = {
|
|
|
45
65
|
label: string;
|
|
46
66
|
description?: string;
|
|
47
67
|
};
|
|
48
|
-
export type ChoiceVariable = AppVariable<
|
|
68
|
+
export type ChoiceVariable<Value extends string = string> = AppVariable<Value, 'choice'> & {
|
|
49
69
|
options: readonly ChoiceOption[];
|
|
50
70
|
};
|
|
51
71
|
export type MultiChoiceVariable = AppVariable<readonly string[], 'multiChoice'> & {
|
|
@@ -56,15 +76,21 @@ export type MultiChoiceVariable = AppVariable<readonly string[], 'multiChoice'>
|
|
|
56
76
|
export declare function searchVariable({ key, label, defaultValue, history, }: Omit<ScalarVariableOptions, 'presentation'>): SearchVariable;
|
|
57
77
|
/** Validate labeled choices before controls or URL state consume them. */
|
|
58
78
|
export declare function validateChoiceOptions(options: readonly ChoiceOption[]): void;
|
|
59
|
-
export declare function choiceVariable({ key, label, defaultValue, options, history, presentation, }: ScalarVariableOptions & {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
export declare function choiceVariable<const Options extends readonly ChoiceOption[], const Presentation extends VariablePresentation | undefined = undefined>({ key, label, defaultValue, options, history, presentation, }: Omit<ScalarVariableOptions, 'presentation'> & {
|
|
80
|
+
presentation?: Presentation;
|
|
81
|
+
defaultValue: NoInfer<Options[number]['id']>;
|
|
82
|
+
options: Options & (Options extends readonly [] ? never : unknown);
|
|
83
|
+
}): ChoiceVariable<Options[number]['id']> & {
|
|
84
|
+
presentation?: Presentation;
|
|
85
|
+
};
|
|
86
|
+
export declare function multiChoiceVariable<const Options extends readonly ChoiceOption[], const Presentation extends VariablePresentation | undefined = undefined>({ key, label, defaultValue, options, maxSelected, history, presentation, }: Omit<ScalarVariableOptions, 'defaultValue' | 'presentation'> & {
|
|
87
|
+
presentation?: Presentation;
|
|
88
|
+
defaultValue?: readonly NoInfer<Options[number]['id']>[];
|
|
89
|
+
options: Options & (Options extends readonly [] ? never : unknown);
|
|
66
90
|
maxSelected?: number;
|
|
67
|
-
}): MultiChoiceVariable
|
|
91
|
+
}): MultiChoiceVariable & {
|
|
92
|
+
presentation?: Presentation;
|
|
93
|
+
};
|
|
68
94
|
export type DateRangeSelection = {
|
|
69
95
|
kind: 'preset';
|
|
70
96
|
id: DatePresetId;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Lakehouse } from '../core/contract.js';
|
|
2
2
|
import { type MessageContext, type SqlQueryInput } from '../core/messages.js';
|
|
3
3
|
/** Authorize every SQL request and supply a backend that independently enforces access and query limits. */
|
|
4
|
-
export declare function createSqlQueryHandler(authorize: (query: SqlQueryInput, context: MessageContext) => Promise<Lakehouse>): (input: SqlQueryInput, context: MessageContext) => Promise<import("../core/contract.js").QueryResult
|
|
4
|
+
export declare function createSqlQueryHandler(authorize: (query: SqlQueryInput, context: MessageContext) => Promise<Lakehouse>): (input: SqlQueryInput, context: MessageContext) => Promise<import("../core/contract.js").QueryResult<unknown[]>>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Portable data app declarations; safe in browser and server modules. */
|
|
2
2
|
export { defineDataApp, dataAppTitle } from './core/config.js';
|
|
3
|
-
export type { DataAppConfig, DataAppDefinition, QueryDefinitions, QueryParameterValue, } from './core/config.js';
|
|
3
|
+
export type { DataAppConfig, DataAppDefinition, QueryDefinitions, QueryParameterValue, QueryParameter, QueryValueType, QueryField, QueryProjections, QueryRow, } from './core/config.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FilterTarget, BreakdownTarget } from './exploration.js';
|
|
2
|
+
import type { DetailView } from './details.js';
|
|
3
|
+
import type { ItemActions } from './ui/ExplorationActionControl.js';
|
|
4
|
+
type ActionCondition<Row> = {
|
|
5
|
+
label: string;
|
|
6
|
+
when?: (row: Row) => boolean;
|
|
7
|
+
};
|
|
8
|
+
type DetailAction<Row, Input, DestinationInput> = ActionCondition<Row> & {
|
|
9
|
+
label: string;
|
|
10
|
+
target: DetailView<any, DestinationInput>;
|
|
11
|
+
input: (row: Row, displayedInput: Input) => DestinationInput;
|
|
12
|
+
};
|
|
13
|
+
export type ActionDeclaration<Row, Input> = ActionCondition<Row> & ({
|
|
14
|
+
kind: 'detail';
|
|
15
|
+
target: DetailView<any, any>;
|
|
16
|
+
input: (row: Row, input: Input) => unknown;
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'filter';
|
|
19
|
+
target: object;
|
|
20
|
+
values: (row: Row) => object;
|
|
21
|
+
breakdown?: {
|
|
22
|
+
target: BreakdownTarget<any>;
|
|
23
|
+
value: (row: Row) => string;
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
export declare class ActionBuilder<Row, Input> {
|
|
27
|
+
detail<DestinationInput>(config: DetailAction<Row, Input, DestinationInput>): ActionDeclaration<Row, Input>;
|
|
28
|
+
filter<Patch extends object, const Values extends NoInfer<Patch>, Value extends string = never>(config: ActionCondition<Row> & {
|
|
29
|
+
label: string;
|
|
30
|
+
target: FilterTarget<Patch>;
|
|
31
|
+
values: (row: Row) => Values & NoInfer<Patch>;
|
|
32
|
+
breakdown?: {
|
|
33
|
+
target: BreakdownTarget<Value>;
|
|
34
|
+
value: (row: Row) => NoInfer<Value>;
|
|
35
|
+
};
|
|
36
|
+
}): ActionDeclaration<Row, Input>;
|
|
37
|
+
}
|
|
38
|
+
declare const actionTypes: unique symbol;
|
|
39
|
+
/** Actions belong to one metric or dataset; its widget supplies displayed rows and input. */
|
|
40
|
+
export declare class ExplorationActions<Row, Input> {
|
|
41
|
+
readonly [actionTypes]: {
|
|
42
|
+
row: Row;
|
|
43
|
+
input: Input;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare function defineActions<Row, Input, const Actions extends Record<string, ActionDeclaration<Row, Input>>>(binding: object, build: (action: ActionBuilder<Row, Input>) => Actions, options?: {
|
|
47
|
+
primary?: keyof Actions & string;
|
|
48
|
+
}): ExplorationActions<Row, Input>;
|
|
49
|
+
export declare function resolveActions<Row, Input>(set: ExplorationActions<Row, Input> | undefined, binding: object, viewOwner: object | undefined, source: {
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
input?: Input;
|
|
52
|
+
}, open: (target: DetailView<any, any>, input: unknown, trigger?: HTMLElement | SVGElement) => void): ItemActions<Row>;
|
|
53
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type DetailNavigation } from './details.js';
|
|
2
|
+
import { type ActionBuilder, type ExplorationActions, type ActionDeclaration } from './actions.js';
|
|
1
3
|
import type { EvidenceDeclaration } from './ui/data-context.js';
|
|
2
4
|
import type { SearchSuggestion } from './ui/SearchTypeahead.js';
|
|
3
5
|
import { type ReactNode } from 'react';
|
|
@@ -11,6 +13,7 @@ import type { MetricDefinition } from './ui/metric.js';
|
|
|
11
13
|
import type { EmptyContent } from './ui/presentation.js';
|
|
12
14
|
import type { TableWidgetColumn } from './ui/TableWidget.js';
|
|
13
15
|
import type { WidgetEvidence } from './ui/WidgetEvidence.js';
|
|
16
|
+
import { DetailView } from './details.js';
|
|
14
17
|
/** Displayed data, or an initial loading reading. Pending filter values are never a source. */
|
|
15
18
|
export type ViewSource<Data, Input> = {
|
|
16
19
|
loading: true;
|
|
@@ -69,6 +72,8 @@ export type DatasetDeclaration<Data, Input, Row> = DatasetDefinition<Data, Input
|
|
|
69
72
|
export declare class RegisteredBinding {
|
|
70
73
|
#private;
|
|
71
74
|
constructor(owner?: object, evidence?: WidgetEvidence);
|
|
75
|
+
/** @internal */
|
|
76
|
+
static owner(binding: RegisteredBinding): object | undefined;
|
|
72
77
|
protected assertSource(source: object): void;
|
|
73
78
|
static evidence(binding: RegisteredBinding, owner: object): WidgetEvidence;
|
|
74
79
|
}
|
|
@@ -85,6 +90,9 @@ export declare class Dataset<Data, Input, Row> extends ExportDataset<Data, Input
|
|
|
85
90
|
#private;
|
|
86
91
|
readonly evidence: WidgetEvidence;
|
|
87
92
|
constructor(definition: DatasetDefinition<Data, Input, Row>, owner?: object, timeZone?: string);
|
|
93
|
+
actions<const Actions extends Record<string, ActionDeclaration<Row, Input>>>(build: (action: ActionBuilder<Row, Input>) => Actions, options?: {
|
|
94
|
+
primary?: keyof Actions & string;
|
|
95
|
+
}): ExplorationActions<Row, Input>;
|
|
88
96
|
readSearchSuggestions(source: ViewSource<Data, Input>): DataReading<readonly SearchSuggestion[]> | undefined;
|
|
89
97
|
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, readonly Row[]>;
|
|
90
98
|
static table<Data, Input, Row>(dataset: Dataset<Data, Input, Row>, source: ViewSource<Data, Input>): {
|
|
@@ -123,6 +131,34 @@ export declare class Metric<Data, Input> extends RegisteredBinding {
|
|
|
123
131
|
read: <Source extends ViewSource<Data, Input>>(source: Source) => SourceReading<Source, MetricValues & {
|
|
124
132
|
period?: DateRangeRequest;
|
|
125
133
|
}>;
|
|
134
|
+
records<DetailData, DetailInput>(options: {
|
|
135
|
+
target: DetailView<DetailData, DetailInput>;
|
|
136
|
+
input: (displayedInput: Input) => DetailInput;
|
|
137
|
+
}): MetricRecords<Data, Input, DetailData, DetailInput>;
|
|
138
|
+
actions<const Actions extends Record<string, ActionDeclaration<void, Input>>>(build: (action: ActionBuilder<void, Input>) => Actions, options?: {
|
|
139
|
+
primary?: keyof Actions & string;
|
|
140
|
+
}): ExplorationActions<void, Input>;
|
|
141
|
+
}
|
|
142
|
+
/** A metric-owned record destination. It can only render from that metric's displayed source. */
|
|
143
|
+
export declare class MetricRecords<Data, Input, DetailData, DetailInput> {
|
|
144
|
+
#private;
|
|
145
|
+
constructor(metric: Metric<Data, Input>, target: DetailView<DetailData, DetailInput>, input: (displayedInput: Input) => DetailInput);
|
|
146
|
+
render(source: ViewSource<Data, Input>, navigation?: DetailNavigation): {
|
|
147
|
+
scope: string;
|
|
148
|
+
content: import("react").FunctionComponentElement<{
|
|
149
|
+
content: import("./details.js").DetailContent<any, any>;
|
|
150
|
+
input: any;
|
|
151
|
+
navigation?: DetailNavigation;
|
|
152
|
+
}>;
|
|
153
|
+
} | undefined;
|
|
154
|
+
static render<Data, Input, DetailData, DetailInput>(records: MetricRecords<Data, Input, DetailData, DetailInput>, metric: Metric<Data, Input>, source: ViewSource<Data, Input>, navigation?: DetailNavigation): {
|
|
155
|
+
scope: string;
|
|
156
|
+
content: import("react").FunctionComponentElement<{
|
|
157
|
+
content: import("./details.js").DetailContent<any, any>;
|
|
158
|
+
input: any;
|
|
159
|
+
navigation?: DetailNavigation;
|
|
160
|
+
}>;
|
|
161
|
+
} | undefined;
|
|
126
162
|
}
|
|
127
163
|
export declare function bindMetric<Data, Input>(definition: MetricDefinition, select: (data: Data, input: Input) => MetricValues, date?: (input: Input) => DateRangeRequest, owner?: object): Metric<Data, Input>;
|
|
128
164
|
export declare function displayedScope<Data, Input>(view: DataView<Data, Input>, describeInput: (input: Input) => string): DataReading<string>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { EmptyContent } from './ui/presentation.js';
|
|
3
|
+
import type { ViewSource } from './bindings.js';
|
|
4
|
+
import type { ViewResult } from './view-runtime.js';
|
|
5
|
+
export type DetailViewDefinition<Data, Input> = {
|
|
6
|
+
id: string;
|
|
7
|
+
title: ReactNode;
|
|
8
|
+
/** Validates untrusted navigation input before a detail operation can run. */
|
|
9
|
+
parseInput: (input: unknown) => Input;
|
|
10
|
+
describeInput: (input: Input) => string;
|
|
11
|
+
isEmpty: (data: Data) => boolean;
|
|
12
|
+
emptyFallback: EmptyContent;
|
|
13
|
+
};
|
|
14
|
+
/** A typed, query-backed destination. */
|
|
15
|
+
export declare class DetailView<Data, Input> {
|
|
16
|
+
#private;
|
|
17
|
+
readonly definition: DetailViewDefinition<Data, Input>;
|
|
18
|
+
readonly useResult: (input: Input) => ViewResult<Data, Input>;
|
|
19
|
+
constructor(definition: DetailViewDefinition<Data, Input>, useResult: (input: Input) => ViewResult<Data, Input>);
|
|
20
|
+
content(render: (source: ViewSource<Data, Input>) => ReactNode): DetailContent<Data, Input>;
|
|
21
|
+
static content<Data, Input>(target: DetailView<Data, Input>): DetailContent<Data, Input>;
|
|
22
|
+
}
|
|
23
|
+
/** Validate destination input before it enters either navigation or a lazy records query. */
|
|
24
|
+
export declare function parseDetailInput<Data, Input>(target: DetailView<Data, Input>, value: unknown): Input;
|
|
25
|
+
/** A destination’s rendered body. Pass these to DataApp.details. */
|
|
26
|
+
export declare class DetailContent<Data, Input> {
|
|
27
|
+
readonly target: DetailView<Data, Input>;
|
|
28
|
+
readonly render: (source: ViewSource<Data, Input>) => ReactNode;
|
|
29
|
+
constructor(target: DetailView<Data, Input>, render: (source: ViewSource<Data, Input>) => ReactNode);
|
|
30
|
+
}
|
|
31
|
+
export type DetailNavigation = {
|
|
32
|
+
open<Data, Input>(target: DetailView<Data, Input>, input: Input, trigger?: HTMLElement | SVGElement | null): void;
|
|
33
|
+
};
|
|
34
|
+
/** Resolve a detail target from an interaction. The destination validates input before fetching. */
|
|
35
|
+
export declare function useDetailNavigation(): DetailNavigation;
|
|
36
|
+
/** Mounts one replacement sheet for a stack of detail destinations. */
|
|
37
|
+
export declare function DetailRoutes({ details, children, }: {
|
|
38
|
+
details: readonly DetailContent<any, any>[];
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}): import("react").JSX.Element;
|
|
41
|
+
/** Render a destination in an inspection tab. The query starts only when that tab mounts. */
|
|
42
|
+
export declare function DetailRecords({ content, input, navigation, }: {
|
|
43
|
+
content: DetailContent<any, any>;
|
|
44
|
+
input: any;
|
|
45
|
+
navigation?: DetailNavigation;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DateRangeRequest } from '../core/contract.js';
|
|
2
|
+
import type { AppVariableValues, VariableCollection } from '../core/variables.js';
|
|
3
|
+
import type { ChoiceVariable } from '../core/variables.js';
|
|
4
|
+
import { type ViewBindings } from './view.js';
|
|
5
|
+
declare const filterPatch: unique symbol;
|
|
6
|
+
declare const breakdownValue: unique symbol;
|
|
7
|
+
export declare class FilterTarget<Patch> {
|
|
8
|
+
readonly [filterPatch]: Patch;
|
|
9
|
+
}
|
|
10
|
+
export declare class BreakdownTarget<Value extends string> {
|
|
11
|
+
readonly [breakdownValue]: Value;
|
|
12
|
+
}
|
|
13
|
+
export type FilterPatch<Variables extends VariableCollection> = Partial<{
|
|
14
|
+
[Key in keyof Variables]: Extract<Variables[Key]['presentation'], {
|
|
15
|
+
group: 'display';
|
|
16
|
+
}> extends never ? AppVariableValues<Variables>[Key] : never;
|
|
17
|
+
}>;
|
|
18
|
+
type TargetDefinition = {
|
|
19
|
+
owner: object;
|
|
20
|
+
variables: VariableCollection;
|
|
21
|
+
input: (values: any) => unknown;
|
|
22
|
+
bindings?: ViewBindings<any, any>;
|
|
23
|
+
date?: {
|
|
24
|
+
variable: string;
|
|
25
|
+
input: (input: any) => DateRangeRequest;
|
|
26
|
+
};
|
|
27
|
+
key?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function createFilterTarget<Variables extends VariableCollection>(definition: TargetDefinition): FilterTarget<FilterPatch<Variables>>;
|
|
30
|
+
export declare function createBreakdownTarget<Value extends string>(definition: TargetDefinition): BreakdownTarget<Value>;
|
|
31
|
+
export declare function breakdownDefinition(target: BreakdownTarget<any>): TargetDefinition;
|
|
32
|
+
export declare function targetAvailable(target: object, displayedInput: unknown, owner: object): boolean;
|
|
33
|
+
/** Apply an explicit scope patch and optional chart choice in one history entry. */
|
|
34
|
+
export declare function applyFilter(target: object, patch: Record<string, unknown>, breakdown?: {
|
|
35
|
+
target: BreakdownTarget<any>;
|
|
36
|
+
value: string;
|
|
37
|
+
}): void;
|
|
38
|
+
export declare function breakdownState(target: BreakdownTarget<any>, owner: object | undefined, input?: unknown): {
|
|
39
|
+
variable: ChoiceVariable;
|
|
40
|
+
value: string;
|
|
41
|
+
options: readonly import("../core/variables.js").ChoiceOption[];
|
|
42
|
+
set(id: string): void;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import type { CheckedVariableDeclarations } from '../core/variables.js';
|
|
2
|
+
import type { IsUnion } from '../core/queries.js';
|
|
3
|
+
import { type FacetVariable } from '../core/facets.js';
|
|
4
|
+
import { type FilterTarget, type BreakdownTarget, type FilterPatch } from './exploration.js';
|
|
5
|
+
import type { ChoiceVariable } from '../core/variables.js';
|
|
1
6
|
import { DeclaredView } from './view-runtime.js';
|
|
2
|
-
import { type DatasetDefinition } from './bindings.js';
|
|
7
|
+
import { type DatasetDefinition, type Dataset, type Metric } from './bindings.js';
|
|
3
8
|
import type { AuthoringDataContext } from './ui/data-context.js';
|
|
4
9
|
import type { MetricValues } from '../core/reading.js';
|
|
5
10
|
import type { DisplayedSnapshot } from '../core/data-view.js';
|
|
@@ -7,12 +12,13 @@ import { type ReactNode } from 'react';
|
|
|
7
12
|
import type { DataOperations, DateRangeRequest } from '../core/contract.js';
|
|
8
13
|
import type { DataClient } from '../client/data-client.js';
|
|
9
14
|
import type { InputOf, OutputOf } from '../core/operation-types.js';
|
|
10
|
-
import { type VariableCollection } from '../core/variables.js';
|
|
15
|
+
import { type VariableCollection, type CheckedFacetContexts } from '../core/variables.js';
|
|
11
16
|
import { dateRangeVariable, type DateRangeVariable, type DateRangeVariableOptions } from './ui/variables.js';
|
|
12
|
-
import { type
|
|
17
|
+
import { type DimensionFilterSettings, type DimensionOption, type DimensionValue } from '../core/dimension.js';
|
|
13
18
|
import type { EmptyContent } from './ui/presentation.js';
|
|
14
19
|
import { ViewContent, type DataContentState } from './content.js';
|
|
15
|
-
import { type DataViewDefinition, type ResolvedVariables, type ViewBindingOptions } from './view.js';
|
|
20
|
+
import { type DataViewDefinition, type ResolvedDataViewDefinition, type ResolvedVariables, type ViewBindingOptions, type ViewDate } from './view.js';
|
|
21
|
+
import { DetailView, type DetailViewDefinition } from './details.js';
|
|
16
22
|
type TimeVariables<Additional extends VariableCollection> = {
|
|
17
23
|
period: ReturnType<typeof dateRangeVariable>;
|
|
18
24
|
} & Additional;
|
|
@@ -26,50 +32,82 @@ type TimeInputMapping<Additional extends VariableCollection, Input> = TimeInput<
|
|
|
26
32
|
type RequiredPeriodBinding<Input> = Input extends unknown ? 'period' extends keyof Input ? Input extends {
|
|
27
33
|
period: DateRangeRequest;
|
|
28
34
|
} ? never : 'period' : Input extends DateRangeRequest ? never : 'period' : never;
|
|
35
|
+
type NonEmptyColumns<Columns extends object> = keyof Columns extends never ? never : Columns;
|
|
36
|
+
type BoundDataView<Name extends string, Variables extends VariableCollection, Input, Data, Context extends AuthoringDataContext, HasDate extends boolean> = DeclaredView<Data, Input, ResolvedDataViewDefinition<Name, Variables, Input, Data> & {
|
|
37
|
+
describeInput: (input: Input) => string;
|
|
38
|
+
}> & {
|
|
39
|
+
filter(): FilterTarget<FilterPatch<Variables>>;
|
|
40
|
+
breakdown<Key extends keyof Variables & string>(key: Key & (Variables[Key] extends ChoiceVariable<any> ? Extract<Variables[Key]['presentation'], {
|
|
41
|
+
group: 'display';
|
|
42
|
+
}> extends never ? never : unknown : never)): Variables[Key] extends ChoiceVariable<infer Value> ? BreakdownTarget<Value> : never;
|
|
43
|
+
dataset<Row, const Columns extends Record<string, object> = Record<string, object>>(definition: DatasetDefinition<Data, Input, Row, Parameters<Context['evidence']>[0]> & {
|
|
44
|
+
columns: Columns & NonEmptyColumns<Columns>;
|
|
45
|
+
}): Dataset<Data, Input, Row>;
|
|
46
|
+
metric(definition: Parameters<Context['metric']>[0], select: (data: Data, input: Input) => HasDate extends true ? MetricValues : {
|
|
47
|
+
current: number;
|
|
48
|
+
previous?: never;
|
|
49
|
+
}): Metric<Data, Input>;
|
|
50
|
+
scope(snapshot: DisplayedSnapshot<Data, Input>): string;
|
|
51
|
+
content(render: (state: DataContentState<Data, Input>) => ReactNode): ViewContent<Data, Input>;
|
|
52
|
+
};
|
|
53
|
+
type FacetOperationName<Operations extends DataOperations, Value extends DimensionValue> = {
|
|
54
|
+
[Name in keyof Operations & string]: OutputOf<Operations[Name]> extends readonly DimensionOption<Value>[] ? Name : never;
|
|
55
|
+
}[keyof Operations & string];
|
|
56
|
+
type FacetConfig<Operations extends DataOperations, Value extends DimensionValue, Context extends VariableCollection, Name extends keyof Operations & string> = DimensionFilterSettings<Value> & {
|
|
57
|
+
facet: {
|
|
58
|
+
context: Context & CheckedVariableDeclarations<NoInfer<Context>> & (string extends keyof Context ? never : unknown);
|
|
59
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
60
|
+
input: (values: ResolvedVariables<NoInfer<Context>>) => InputOf<Operations[NoInfer<Name>]>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
type CheckedFacetSources<Operations extends DataOperations, Variables extends VariableCollection> = CheckedVariableDeclarations<Variables> & {
|
|
64
|
+
[Key in keyof Variables]: Variables[Key] extends FacetVariable<infer Value, infer _Context, infer Name, infer Input> ? Name extends keyof Operations ? Input extends InputOf<Operations[Name]> ? OutputOf<Operations[Name]> extends readonly DimensionOption<Value>[] ? Variables[Key] : never : never : never : Variables[Key];
|
|
65
|
+
};
|
|
66
|
+
type BoundDetailView<Data, Input, Context extends AuthoringDataContext> = DetailView<Data, Input> & {
|
|
67
|
+
dataset<Row, const Columns extends Record<string, object> = Record<string, object>>(definition: DatasetDefinition<Data, Input, Row, Parameters<Context['evidence']>[0]> & {
|
|
68
|
+
columns: Columns & NonEmptyColumns<Columns>;
|
|
69
|
+
}): Dataset<Data, Input, Row>;
|
|
70
|
+
metric(definition: Parameters<Context['metric']>[0], select: (data: Data, input: Input) => {
|
|
71
|
+
current: number;
|
|
72
|
+
previous?: never;
|
|
73
|
+
}): Metric<Data, Input>;
|
|
74
|
+
};
|
|
29
75
|
/** Bind declared operations to URL variables, displayed readings, and request feedback. */
|
|
30
76
|
export declare function createDataHooks<Operations extends DataOperations>(client: DataClient<Operations>): {
|
|
31
|
-
defineDataView:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
77
|
+
defineDataView: {
|
|
78
|
+
<Name extends keyof Operations & string, const Variables extends VariableCollection = {}, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: DataViewDefinition<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>> & {
|
|
79
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
80
|
+
variables?: Variables & CheckedFacetSources<Operations, NoInfer<Variables>>;
|
|
81
|
+
} & {
|
|
82
|
+
dataContext: Context;
|
|
83
|
+
date: ViewDate<Variables, InputOf<Operations[Name]>>;
|
|
84
|
+
}): BoundDataView<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>, Context, true>;
|
|
85
|
+
<Name extends keyof Operations & string, const Variables extends VariableCollection = {}, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: DataViewDefinition<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>> & {
|
|
86
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
87
|
+
variables?: Variables & CheckedFacetSources<Operations, NoInfer<Variables>>;
|
|
88
|
+
} & {
|
|
89
|
+
dataContext: Context;
|
|
90
|
+
}): BoundDataView<Name, Variables, InputOf<Operations[Name]>, OutputOf<Operations[Name]>, Context, false>;
|
|
42
91
|
};
|
|
43
|
-
|
|
92
|
+
defineDetailView: <Name extends keyof Operations & string, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: DetailViewDefinition<OutputOf<Operations[Name]>, InputOf<Operations[Name]>> & {
|
|
44
93
|
operation: Name;
|
|
45
94
|
dataContext: Context;
|
|
95
|
+
}) => BoundDetailView<OutputOf<Operations[Name]>, InputOf<Operations[Name]>, Context>;
|
|
96
|
+
defineTimeView: <Name extends keyof Operations & string, const Additional extends VariableCollection = {}, const Context extends AuthoringDataContext = AuthoringDataContext>(definition: {
|
|
97
|
+
operation: Name & (true extends IsUnion<NoInfer<Name>> ? never : unknown);
|
|
98
|
+
dataContext: Context;
|
|
46
99
|
time: Omit<DateRangeVariableOptions, 'key'>;
|
|
47
|
-
variables?: Additional & {
|
|
100
|
+
variables?: Additional & CheckedVariableDeclarations<NoInfer<Additional>> & {
|
|
48
101
|
period?: never;
|
|
49
|
-
}
|
|
102
|
+
} & Omit<CheckedFacetContexts<TimeVariables<NoInfer<Additional>>>, 'period'> & Omit<CheckedFacetSources<Operations, TimeVariables<NoInfer<Additional>>>, 'period'>;
|
|
50
103
|
isEmpty: (data: OutputOf<Operations[Name]>) => boolean;
|
|
51
104
|
emptyFallback: EmptyContent;
|
|
52
|
-
} & TimeInputMapping<NoInfer<Additional>, InputOf<Operations[Name]>> & ViewBindingOptions<TimeVariables<NoInfer<Additional>>, InputOf<Operations[Name]>, RequiredPeriodBinding<InputOf<Operations[Name]>>>) =>
|
|
105
|
+
} & TimeInputMapping<NoInfer<Additional>, InputOf<Operations[Name]>> & ViewBindingOptions<TimeVariables<NoInfer<Additional>>, InputOf<Operations[Name]>, RequiredPeriodBinding<InputOf<Operations[Name]>>>) => BoundDataView<Name, {
|
|
53
106
|
period: DateRangeVariable;
|
|
54
|
-
} & Additional, InputOf<Operations[Name]>, OutputOf<Operations[Name]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
input: (values: ResolvedVariables<NoInfer<{
|
|
59
|
-
period: DateRangeVariable;
|
|
60
|
-
} & Additional>>) => InputOf<Operations[Name]>;
|
|
61
|
-
describeInput: (input: InputOf<Operations[Name]>) => string;
|
|
62
|
-
}> & {
|
|
63
|
-
dataset<Row>(dataset: DatasetDefinition<OutputOf<Operations[Name]>, InputOf<Operations[Name]>, Row, Parameters<Context["evidence"]>[0]>): import("./bindings.js").Dataset<OutputOf<Operations[Name]>, InputOf<Operations[Name]>, Row>;
|
|
64
|
-
metric(metric: Parameters<Context["metric"]>[0], select: (data: OutputOf<Operations[Name]>, input: InputOf<Operations[Name]>) => MetricValues): import("./bindings.js").Metric<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>;
|
|
65
|
-
scope(snapshot: DisplayedSnapshot<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>): string;
|
|
66
|
-
content(render: (state: DataContentState<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>) => ReactNode): ViewContent<OutputOf<Operations[Name]>, InputOf<Operations[Name]>>;
|
|
107
|
+
} & Additional, InputOf<Operations[Name]>, OutputOf<Operations[Name]>, Context, true>;
|
|
108
|
+
defineFacetFilter: {
|
|
109
|
+
<const Context extends VariableCollection, const Name extends FacetOperationName<Operations, string>>(config: FacetConfig<Operations, string, Context, Name>): FacetVariable<string, Readonly<Context>, Name, InputOf<Operations[Name]>>;
|
|
110
|
+
<const Context extends VariableCollection, const Name extends FacetOperationName<Operations, number>>(config: FacetConfig<Operations, number, Context, Name>): FacetVariable<number, Readonly<Context>, Name, InputOf<Operations[Name]>>;
|
|
67
111
|
};
|
|
68
|
-
defineFacetFilter: <Name extends keyof Operations & string, const T extends DimensionValue>(config: Omit<DimensionFilterOptions<T>, 'options' | 'facet'> & {
|
|
69
|
-
facet: {
|
|
70
|
-
operation: Name;
|
|
71
|
-
input: (values: Record<string, unknown>) => InputOf<Operations[Name]>;
|
|
72
|
-
};
|
|
73
|
-
} & (OutputOf<Operations[Name]> extends readonly DimensionOption<T>[] ? object : never)) => import("../core/dimension.js").DimensionVariable<T>;
|
|
74
112
|
};
|
|
75
113
|
export {};
|