derive-dashboards 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/cache.mjs +2 -1
- package/dist/cli/add.mjs +130 -0
- package/dist/cli/cli.mjs +14 -12
- package/dist/cli/config.mjs +12 -1
- package/dist/cli/doctor.mjs +162 -0
- package/dist/cli/init.mjs +3 -2
- package/dist/cli/json.mjs +21 -0
- package/dist/cli/layers.mjs +33 -0
- package/dist/core/document/display.d.mts +63 -0
- package/dist/core/document/display.mjs +139 -0
- package/dist/core/document/layout.mjs +1 -1
- package/dist/core/document/view-layout.d.mts +14 -0
- package/dist/core/document/view-layout.mjs +157 -0
- package/dist/core/engine/filter.mjs +2 -2
- package/dist/core/engine/leaf.mjs +9 -4
- package/dist/core/engine/members.mjs +1 -1
- package/dist/core/engine/version.d.mts +5 -4
- package/dist/core/engine/version.mjs +5 -4
- package/dist/core/error/codes.d.mts +4 -1
- package/dist/core/error/codes.mjs +4 -1
- package/dist/core/index.d.mts +12 -8
- package/dist/core/index.mjs +11 -7
- package/dist/core/model/member.mjs +5 -2
- package/dist/core/model/types.d.mts +13 -13
- package/dist/core/model/validate/drill.mjs +6 -15
- package/dist/core/model/validate/fields.mjs +130 -0
- package/dist/core/model/validate/index.mjs +11 -3
- package/dist/core/model/validate/known-members.mjs +133 -0
- package/dist/core/model/validate/known-nested.mjs +85 -0
- package/dist/core/model/validate/known.mjs +94 -0
- package/dist/core/model/validate/members.mjs +7 -4
- package/dist/core/model/validate/source.mjs +8 -1
- package/dist/core/policy/bind-query.d.mts +12 -0
- package/dist/core/policy/bind-query.mjs +53 -0
- package/dist/core/query/alias.mjs +11 -1
- package/dist/core/query/drill/selection.d.mts +7 -2
- package/dist/core/query/drill/selection.mjs +18 -15
- package/dist/core/query/filter.d.mts +6 -0
- package/dist/core/query/picks.d.mts +8 -2
- package/dist/core/query/picks.mjs +11 -4
- package/dist/core/query/segments.mjs +2 -1
- package/dist/core/result/columns.d.mts +10 -1
- package/dist/core/result/columns.mjs +27 -5
- package/dist/core/result/time-axis.d.mts +23 -0
- package/dist/core/result/time-axis.mjs +72 -0
- package/dist/core/result/types.d.mts +36 -1
- package/dist/core/schema/aliases.d.mts +7 -0
- package/dist/core/schema/aliases.mjs +77 -0
- package/dist/core/schema/answer-parts.mjs +23 -1
- package/dist/core/schema/answers.d.mts +204 -0
- package/dist/core/schema/answers.mjs +2 -0
- package/dist/core/schema/index.d.mts +3 -2
- package/dist/core/schema/index.mjs +3 -2
- package/dist/core/schema/query.d.mts +81 -0
- package/dist/core/schema/query.mjs +9 -5
- package/dist/core/schema/tools.d.mts +2 -0
- package/dist/core/schema/tools.mjs +27 -1
- package/dist/core/time/bucket.mjs +8 -2
- package/dist/core/types/api.d.mts +7 -1
- package/dist/core/types/api.mjs +1 -1
- package/dist/dashboards.mjs +4 -0
- package/dist/drill-change.mjs +1 -1
- package/dist/drill-seal.mjs +1 -0
- package/dist/editing.mjs +2 -2
- package/dist/endpoints/dashboards.mjs +17 -2
- package/dist/endpoints/index.d.mts +15 -2
- package/dist/endpoints/meta.mjs +10 -1
- package/dist/execute.mjs +32 -17
- package/dist/handler.mjs +5 -1
- package/dist/index.mjs +6 -1
- package/dist/llms.txt +22 -0
- package/dist/mcp/format.mjs +42 -8
- package/dist/mcp/query.mjs +34 -4
- package/dist/postgres-store.mjs +1 -0
- package/dist/react/Canvas.mjs +28 -5
- package/dist/react/Cell.mjs +2 -1
- package/dist/react/Dashboard.d.mts +4 -0
- package/dist/react/Dashboard.mjs +27 -4
- package/dist/react/DashboardList.mjs +22 -22
- package/dist/react/DashboardListRow.mjs +49 -0
- package/dist/react/Discard.mjs +5 -2
- package/dist/react/Editing.mjs +19 -5
- package/dist/react/FilterBar.d.mts +7 -9
- package/dist/react/Grid.mjs +7 -19
- package/dist/react/Header.mjs +1 -1
- package/dist/react/History.mjs +5 -0
- package/dist/react/ReadFailed.mjs +23 -0
- package/dist/react/Spaces.mjs +15 -1
- package/dist/react/Tile.d.mts +2 -0
- package/dist/react/Tile.mjs +45 -10
- package/dist/react/_virtual/_rolldown/runtime.mjs +12 -0
- package/dist/react/arrange-steps.mjs +16 -13
- package/dist/react/arrange.mjs +10 -3
- package/dist/react/builder/Calcs.mjs +35 -11
- package/dist/react/builder/FilterEditor.mjs +196 -0
- package/dist/react/builder/Filters.mjs +172 -116
- package/dist/react/builder/Formula.mjs +82 -0
- package/dist/react/builder/Groups.mjs +1 -0
- package/dist/react/builder/Preview.mjs +1 -1
- package/dist/react/builder/RangeEditor.mjs +184 -0
- package/dist/react/builder/Sections.mjs +41 -6
- package/dist/react/builder/Time.mjs +138 -60
- package/dist/react/builder/Values.mjs +85 -0
- package/dist/react/builder/WidgetBuilder.mjs +50 -49
- package/dist/react/builder/base.d.mts +5 -0
- package/dist/react/builder/base.mjs +33 -8
- package/dist/react/builder/calc.mjs +15 -1
- package/dist/react/builder/escape.d.mts +1 -0
- package/dist/react/builder/escape.mjs +62 -0
- package/dist/react/builder/filter-tree.d.mts +9 -0
- package/dist/react/builder/filter-tree.mjs +186 -0
- package/dist/react/builder/formula-parse.d.mts +18 -0
- package/dist/react/builder/formula-parse.mjs +136 -0
- package/dist/react/builder/labels.d.mts +1 -1
- package/dist/react/builder/state.d.mts +2 -1
- package/dist/react/builder/state.mjs +23 -37
- package/dist/react/builder/useBuilder.d.mts +12 -1
- package/dist/react/builder/useBuilder.mjs +6 -3
- package/dist/react/builder/words.d.mts +59 -0
- package/dist/react/builder/words.mjs +73 -0
- package/dist/react/context.d.mts +15 -1
- package/dist/react/context.mjs +9 -3
- package/dist/react/drill/Bars.mjs +2 -2
- package/dist/react/drill/props.mjs +2 -1
- package/dist/react/drill/useDrill.d.mts +1 -1
- package/dist/react/drill/words.d.mts +3 -0
- package/dist/react/drill/words.mjs +2 -0
- package/dist/react/english.mjs +20 -5
- package/dist/react/filters/bar.d.mts +12 -0
- package/dist/react/filters/bar.mjs +135 -0
- package/dist/react/filters/calendar.mjs +193 -0
- package/dist/react/filters/chip.mjs +174 -0
- package/dist/react/filters/context.d.mts +22 -0
- package/dist/react/filters/context.mjs +78 -0
- package/dist/react/filters/dates.mjs +89 -0
- package/dist/react/filters/days.d.mts +36 -0
- package/dist/react/filters/days.mjs +87 -0
- package/dist/react/filters/field-step.mjs +81 -0
- package/dist/react/filters/hooks.d.mts +34 -0
- package/dist/react/filters/hooks.mjs +94 -0
- package/dist/react/filters/listbox.mjs +131 -0
- package/dist/react/filters/logic.d.mts +59 -0
- package/dist/react/filters/logic.mjs +109 -0
- package/dist/react/filters/menu-search.mjs +211 -0
- package/dist/react/filters/menu.mjs +85 -0
- package/dist/react/filters/number.mjs +127 -0
- package/dist/react/filters/numbers.d.mts +47 -0
- package/dist/react/filters/numbers.mjs +151 -0
- package/dist/react/filters/operator.mjs +104 -0
- package/dist/react/filters/phone.mjs +104 -0
- package/dist/react/filters/popover.d.mts +19 -0
- package/dist/react/filters/popover.mjs +153 -0
- package/dist/react/filters/rules.d.mts +8 -0
- package/dist/react/filters/rules.mjs +55 -0
- package/dist/react/filters/sheet.mjs +196 -0
- package/dist/react/filters/state.mjs +132 -0
- package/dist/react/filters/suggest.d.mts +47 -0
- package/dist/react/filters/suggest.mjs +97 -0
- package/dist/react/filters/values.mjs +166 -0
- package/dist/react/filters/words.d.mts +81 -0
- package/dist/react/filters/words.mjs +73 -0
- package/dist/react/format.mjs +11 -4
- package/dist/react/index.d.mts +15 -6
- package/dist/react/index.mjs +10 -4
- package/dist/react/messages.d.mts +34 -2
- package/dist/react/place.mjs +7 -3
- package/dist/react/renderers/index.d.mts +3 -21
- package/dist/react/renderers/index.mjs +68 -6
- package/dist/react/renderers/list.d.mts +2 -1
- package/dist/react/renderers/list.mjs +9 -12
- package/dist/react/renderers/props.d.mts +26 -0
- package/dist/react/scope.d.mts +4 -0
- package/dist/react/scope.mjs +19 -2
- package/dist/react/series-slots.d.mts +37 -0
- package/dist/react/series-slots.mjs +71 -0
- package/dist/react/series.d.mts +39 -9
- package/dist/react/series.mjs +144 -47
- package/dist/react/theme.css +930 -19
- package/dist/react/useBoard.d.mts +2 -0
- package/dist/react/useDashboard.d.mts +3 -0
- package/dist/react/useDashboard.mjs +6 -0
- package/dist/react/view-grid.mjs +16 -0
- package/dist/recharts/axes.mjs +28 -0
- package/dist/recharts/axis.mjs +84 -0
- package/dist/recharts/bar.d.mts +7 -0
- package/dist/recharts/bar.mjs +141 -0
- package/dist/recharts/charts.d.mts +4 -5
- package/dist/recharts/charts.mjs +2 -208
- package/dist/recharts/index.d.mts +3 -1
- package/dist/recharts/index.mjs +4 -1
- package/dist/recharts/line.d.mts +2 -0
- package/dist/recharts/line.mjs +112 -0
- package/dist/recharts/marks.mjs +47 -18
- package/dist/recharts/parts.mjs +103 -0
- package/dist/recharts/table.mjs +71 -0
- package/dist/records-read.mjs +1 -1
- package/dist/registry/filter-bar.json +26 -0
- package/dist/skills/derive-dashboards/SKILL.md +69 -0
- package/dist/store/apply.mjs +3 -1
- package/package.json +6 -2
- package/dist/react/FilterBar.mjs +0 -119
|
@@ -23,6 +23,12 @@ export declare const tileLineSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
23
23
|
}, z.core.$loose>]>>>>>;
|
|
24
24
|
columns: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
25
25
|
id: z.ZodString;
|
|
26
|
+
role: z.ZodEnum<{
|
|
27
|
+
time: "time";
|
|
28
|
+
dimension: "dimension";
|
|
29
|
+
measure: "measure";
|
|
30
|
+
calc: "calc";
|
|
31
|
+
}>;
|
|
26
32
|
label: z.ZodString;
|
|
27
33
|
type: z.ZodEnum<{
|
|
28
34
|
string: "string";
|
|
@@ -43,6 +49,7 @@ export declare const tileLineSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
43
49
|
quarter: "quarter";
|
|
44
50
|
year: "year";
|
|
45
51
|
}>>;
|
|
52
|
+
values: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
46
53
|
format: z.ZodExactOptional<z.ZodEnum<{
|
|
47
54
|
number: "number";
|
|
48
55
|
percent: "percent";
|
|
@@ -52,6 +59,26 @@ export declare const tileLineSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
52
59
|
signed: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
53
60
|
fraction: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
54
61
|
}, z.core.$loose>>>;
|
|
62
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
63
|
+
grain: z.ZodEnum<{
|
|
64
|
+
hour: "hour";
|
|
65
|
+
day: "day";
|
|
66
|
+
week: "week";
|
|
67
|
+
month: "month";
|
|
68
|
+
quarter: "quarter";
|
|
69
|
+
year: "year";
|
|
70
|
+
}>;
|
|
71
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
72
|
+
label: z.ZodString;
|
|
73
|
+
from: z.ZodString;
|
|
74
|
+
to: z.ZodString;
|
|
75
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
76
|
+
start: "start";
|
|
77
|
+
end: "end";
|
|
78
|
+
both: "both";
|
|
79
|
+
}>>;
|
|
80
|
+
}, z.core.$loose>>>;
|
|
81
|
+
}, z.core.$loose>>;
|
|
55
82
|
compare: z.ZodExactOptional<z.ZodObject<{
|
|
56
83
|
rows: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
57
84
|
t: z.ZodEnum<{
|
|
@@ -69,6 +96,26 @@ export declare const tileLineSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
69
96
|
from: z.ZodString;
|
|
70
97
|
to: z.ZodString;
|
|
71
98
|
}, z.core.$loose>;
|
|
99
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
100
|
+
grain: z.ZodEnum<{
|
|
101
|
+
hour: "hour";
|
|
102
|
+
day: "day";
|
|
103
|
+
week: "week";
|
|
104
|
+
month: "month";
|
|
105
|
+
quarter: "quarter";
|
|
106
|
+
year: "year";
|
|
107
|
+
}>;
|
|
108
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
109
|
+
label: z.ZodString;
|
|
110
|
+
from: z.ZodString;
|
|
111
|
+
to: z.ZodString;
|
|
112
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
113
|
+
start: "start";
|
|
114
|
+
end: "end";
|
|
115
|
+
both: "both";
|
|
116
|
+
}>>;
|
|
117
|
+
}, z.core.$loose>>>;
|
|
118
|
+
}, z.core.$loose>>;
|
|
72
119
|
}, z.core.$loose>>;
|
|
73
120
|
status: z.ZodEnum<{
|
|
74
121
|
complete: "complete";
|
|
@@ -1841,6 +1888,7 @@ export declare const answerSchemas: {
|
|
|
1841
1888
|
command: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1842
1889
|
query: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1843
1890
|
picks: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1891
|
+
display: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1844
1892
|
bodies: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1845
1893
|
}, z.core.$loose>;
|
|
1846
1894
|
"/meta/values": z.ZodObject<{
|
|
@@ -1851,6 +1899,7 @@ export declare const answerSchemas: {
|
|
|
1851
1899
|
dashboards: z.ZodArray<z.ZodObject<{
|
|
1852
1900
|
id: z.ZodString;
|
|
1853
1901
|
title: z.ZodString;
|
|
1902
|
+
description: z.ZodExactOptional<z.ZodString>;
|
|
1854
1903
|
version: z.ZodNumber;
|
|
1855
1904
|
unpublished: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
1856
1905
|
}, z.core.$loose>>;
|
|
@@ -2223,6 +2272,12 @@ export declare const answerSchemas: {
|
|
|
2223
2272
|
}, z.core.$loose>;
|
|
2224
2273
|
column: z.ZodExactOptional<z.ZodObject<{
|
|
2225
2274
|
id: z.ZodString;
|
|
2275
|
+
role: z.ZodEnum<{
|
|
2276
|
+
time: "time";
|
|
2277
|
+
dimension: "dimension";
|
|
2278
|
+
measure: "measure";
|
|
2279
|
+
calc: "calc";
|
|
2280
|
+
}>;
|
|
2226
2281
|
label: z.ZodString;
|
|
2227
2282
|
type: z.ZodEnum<{
|
|
2228
2283
|
string: "string";
|
|
@@ -2243,6 +2298,7 @@ export declare const answerSchemas: {
|
|
|
2243
2298
|
quarter: "quarter";
|
|
2244
2299
|
year: "year";
|
|
2245
2300
|
}>>;
|
|
2301
|
+
values: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
2246
2302
|
format: z.ZodExactOptional<z.ZodEnum<{
|
|
2247
2303
|
number: "number";
|
|
2248
2304
|
percent: "percent";
|
|
@@ -2506,6 +2562,12 @@ export declare const answerSchemas: {
|
|
|
2506
2562
|
}, z.core.$loose>]>>>>>;
|
|
2507
2563
|
columns: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
2508
2564
|
id: z.ZodString;
|
|
2565
|
+
role: z.ZodEnum<{
|
|
2566
|
+
time: "time";
|
|
2567
|
+
dimension: "dimension";
|
|
2568
|
+
measure: "measure";
|
|
2569
|
+
calc: "calc";
|
|
2570
|
+
}>;
|
|
2509
2571
|
label: z.ZodString;
|
|
2510
2572
|
type: z.ZodEnum<{
|
|
2511
2573
|
string: "string";
|
|
@@ -2526,6 +2588,7 @@ export declare const answerSchemas: {
|
|
|
2526
2588
|
quarter: "quarter";
|
|
2527
2589
|
year: "year";
|
|
2528
2590
|
}>>;
|
|
2591
|
+
values: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
2529
2592
|
format: z.ZodExactOptional<z.ZodEnum<{
|
|
2530
2593
|
number: "number";
|
|
2531
2594
|
percent: "percent";
|
|
@@ -2535,6 +2598,26 @@ export declare const answerSchemas: {
|
|
|
2535
2598
|
signed: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
2536
2599
|
fraction: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
2537
2600
|
}, z.core.$loose>>>;
|
|
2601
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
2602
|
+
grain: z.ZodEnum<{
|
|
2603
|
+
hour: "hour";
|
|
2604
|
+
day: "day";
|
|
2605
|
+
week: "week";
|
|
2606
|
+
month: "month";
|
|
2607
|
+
quarter: "quarter";
|
|
2608
|
+
year: "year";
|
|
2609
|
+
}>;
|
|
2610
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
2611
|
+
label: z.ZodString;
|
|
2612
|
+
from: z.ZodString;
|
|
2613
|
+
to: z.ZodString;
|
|
2614
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
2615
|
+
start: "start";
|
|
2616
|
+
end: "end";
|
|
2617
|
+
both: "both";
|
|
2618
|
+
}>>;
|
|
2619
|
+
}, z.core.$loose>>>;
|
|
2620
|
+
}, z.core.$loose>>;
|
|
2538
2621
|
compare: z.ZodExactOptional<z.ZodObject<{
|
|
2539
2622
|
rows: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
2540
2623
|
t: z.ZodEnum<{
|
|
@@ -2552,6 +2635,26 @@ export declare const answerSchemas: {
|
|
|
2552
2635
|
from: z.ZodString;
|
|
2553
2636
|
to: z.ZodString;
|
|
2554
2637
|
}, z.core.$loose>;
|
|
2638
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
2639
|
+
grain: z.ZodEnum<{
|
|
2640
|
+
hour: "hour";
|
|
2641
|
+
day: "day";
|
|
2642
|
+
week: "week";
|
|
2643
|
+
month: "month";
|
|
2644
|
+
quarter: "quarter";
|
|
2645
|
+
year: "year";
|
|
2646
|
+
}>;
|
|
2647
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
2648
|
+
label: z.ZodString;
|
|
2649
|
+
from: z.ZodString;
|
|
2650
|
+
to: z.ZodString;
|
|
2651
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
2652
|
+
start: "start";
|
|
2653
|
+
end: "end";
|
|
2654
|
+
both: "both";
|
|
2655
|
+
}>>;
|
|
2656
|
+
}, z.core.$loose>>>;
|
|
2657
|
+
}, z.core.$loose>>;
|
|
2555
2658
|
}, z.core.$loose>>;
|
|
2556
2659
|
status: z.ZodEnum<{
|
|
2557
2660
|
complete: "complete";
|
|
@@ -2962,6 +3065,12 @@ export declare const answerSchemas: {
|
|
|
2962
3065
|
}, z.core.$loose>]>>>>>;
|
|
2963
3066
|
columns: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
2964
3067
|
id: z.ZodString;
|
|
3068
|
+
role: z.ZodEnum<{
|
|
3069
|
+
time: "time";
|
|
3070
|
+
dimension: "dimension";
|
|
3071
|
+
measure: "measure";
|
|
3072
|
+
calc: "calc";
|
|
3073
|
+
}>;
|
|
2965
3074
|
label: z.ZodString;
|
|
2966
3075
|
type: z.ZodEnum<{
|
|
2967
3076
|
string: "string";
|
|
@@ -2982,6 +3091,7 @@ export declare const answerSchemas: {
|
|
|
2982
3091
|
quarter: "quarter";
|
|
2983
3092
|
year: "year";
|
|
2984
3093
|
}>>;
|
|
3094
|
+
values: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
2985
3095
|
format: z.ZodExactOptional<z.ZodEnum<{
|
|
2986
3096
|
number: "number";
|
|
2987
3097
|
percent: "percent";
|
|
@@ -2991,6 +3101,26 @@ export declare const answerSchemas: {
|
|
|
2991
3101
|
signed: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
2992
3102
|
fraction: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
2993
3103
|
}, z.core.$loose>>>;
|
|
3104
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
3105
|
+
grain: z.ZodEnum<{
|
|
3106
|
+
hour: "hour";
|
|
3107
|
+
day: "day";
|
|
3108
|
+
week: "week";
|
|
3109
|
+
month: "month";
|
|
3110
|
+
quarter: "quarter";
|
|
3111
|
+
year: "year";
|
|
3112
|
+
}>;
|
|
3113
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
3114
|
+
label: z.ZodString;
|
|
3115
|
+
from: z.ZodString;
|
|
3116
|
+
to: z.ZodString;
|
|
3117
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
3118
|
+
start: "start";
|
|
3119
|
+
end: "end";
|
|
3120
|
+
both: "both";
|
|
3121
|
+
}>>;
|
|
3122
|
+
}, z.core.$loose>>>;
|
|
3123
|
+
}, z.core.$loose>>;
|
|
2994
3124
|
compare: z.ZodExactOptional<z.ZodObject<{
|
|
2995
3125
|
rows: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
2996
3126
|
t: z.ZodEnum<{
|
|
@@ -3008,6 +3138,26 @@ export declare const answerSchemas: {
|
|
|
3008
3138
|
from: z.ZodString;
|
|
3009
3139
|
to: z.ZodString;
|
|
3010
3140
|
}, z.core.$loose>;
|
|
3141
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
3142
|
+
grain: z.ZodEnum<{
|
|
3143
|
+
hour: "hour";
|
|
3144
|
+
day: "day";
|
|
3145
|
+
week: "week";
|
|
3146
|
+
month: "month";
|
|
3147
|
+
quarter: "quarter";
|
|
3148
|
+
year: "year";
|
|
3149
|
+
}>;
|
|
3150
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
3151
|
+
label: z.ZodString;
|
|
3152
|
+
from: z.ZodString;
|
|
3153
|
+
to: z.ZodString;
|
|
3154
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
3155
|
+
start: "start";
|
|
3156
|
+
end: "end";
|
|
3157
|
+
both: "both";
|
|
3158
|
+
}>>;
|
|
3159
|
+
}, z.core.$loose>>>;
|
|
3160
|
+
}, z.core.$loose>>;
|
|
3011
3161
|
}, z.core.$loose>>;
|
|
3012
3162
|
status: z.ZodEnum<{
|
|
3013
3163
|
complete: "complete";
|
|
@@ -3323,6 +3473,12 @@ export declare const answerSchemas: {
|
|
|
3323
3473
|
}, z.core.$loose>;
|
|
3324
3474
|
column: z.ZodExactOptional<z.ZodObject<{
|
|
3325
3475
|
id: z.ZodString;
|
|
3476
|
+
role: z.ZodEnum<{
|
|
3477
|
+
time: "time";
|
|
3478
|
+
dimension: "dimension";
|
|
3479
|
+
measure: "measure";
|
|
3480
|
+
calc: "calc";
|
|
3481
|
+
}>;
|
|
3326
3482
|
label: z.ZodString;
|
|
3327
3483
|
type: z.ZodEnum<{
|
|
3328
3484
|
string: "string";
|
|
@@ -3343,6 +3499,7 @@ export declare const answerSchemas: {
|
|
|
3343
3499
|
quarter: "quarter";
|
|
3344
3500
|
year: "year";
|
|
3345
3501
|
}>>;
|
|
3502
|
+
values: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
3346
3503
|
format: z.ZodExactOptional<z.ZodEnum<{
|
|
3347
3504
|
number: "number";
|
|
3348
3505
|
percent: "percent";
|
|
@@ -3606,6 +3763,12 @@ export declare const answerSchemas: {
|
|
|
3606
3763
|
}, z.core.$loose>]>>>>>;
|
|
3607
3764
|
columns: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
3608
3765
|
id: z.ZodString;
|
|
3766
|
+
role: z.ZodEnum<{
|
|
3767
|
+
time: "time";
|
|
3768
|
+
dimension: "dimension";
|
|
3769
|
+
measure: "measure";
|
|
3770
|
+
calc: "calc";
|
|
3771
|
+
}>;
|
|
3609
3772
|
label: z.ZodString;
|
|
3610
3773
|
type: z.ZodEnum<{
|
|
3611
3774
|
string: "string";
|
|
@@ -3626,6 +3789,7 @@ export declare const answerSchemas: {
|
|
|
3626
3789
|
quarter: "quarter";
|
|
3627
3790
|
year: "year";
|
|
3628
3791
|
}>>;
|
|
3792
|
+
values: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
3629
3793
|
format: z.ZodExactOptional<z.ZodEnum<{
|
|
3630
3794
|
number: "number";
|
|
3631
3795
|
percent: "percent";
|
|
@@ -3635,6 +3799,26 @@ export declare const answerSchemas: {
|
|
|
3635
3799
|
signed: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
3636
3800
|
fraction: z.ZodExactOptional<z.ZodLiteral<true>>;
|
|
3637
3801
|
}, z.core.$loose>>>;
|
|
3802
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
3803
|
+
grain: z.ZodEnum<{
|
|
3804
|
+
hour: "hour";
|
|
3805
|
+
day: "day";
|
|
3806
|
+
week: "week";
|
|
3807
|
+
month: "month";
|
|
3808
|
+
quarter: "quarter";
|
|
3809
|
+
year: "year";
|
|
3810
|
+
}>;
|
|
3811
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
3812
|
+
label: z.ZodString;
|
|
3813
|
+
from: z.ZodString;
|
|
3814
|
+
to: z.ZodString;
|
|
3815
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
3816
|
+
start: "start";
|
|
3817
|
+
end: "end";
|
|
3818
|
+
both: "both";
|
|
3819
|
+
}>>;
|
|
3820
|
+
}, z.core.$loose>>>;
|
|
3821
|
+
}, z.core.$loose>>;
|
|
3638
3822
|
compare: z.ZodExactOptional<z.ZodObject<{
|
|
3639
3823
|
rows: z.ZodReadonly<z.ZodArray<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodObject<{
|
|
3640
3824
|
t: z.ZodEnum<{
|
|
@@ -3652,6 +3836,26 @@ export declare const answerSchemas: {
|
|
|
3652
3836
|
from: z.ZodString;
|
|
3653
3837
|
to: z.ZodString;
|
|
3654
3838
|
}, z.core.$loose>;
|
|
3839
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
3840
|
+
grain: z.ZodEnum<{
|
|
3841
|
+
hour: "hour";
|
|
3842
|
+
day: "day";
|
|
3843
|
+
week: "week";
|
|
3844
|
+
month: "month";
|
|
3845
|
+
quarter: "quarter";
|
|
3846
|
+
year: "year";
|
|
3847
|
+
}>;
|
|
3848
|
+
buckets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
3849
|
+
label: z.ZodString;
|
|
3850
|
+
from: z.ZodString;
|
|
3851
|
+
to: z.ZodString;
|
|
3852
|
+
partial: z.ZodExactOptional<z.ZodEnum<{
|
|
3853
|
+
start: "start";
|
|
3854
|
+
end: "end";
|
|
3855
|
+
both: "both";
|
|
3856
|
+
}>>;
|
|
3857
|
+
}, z.core.$loose>>>;
|
|
3858
|
+
}, z.core.$loose>>;
|
|
3655
3859
|
}, z.core.$loose>>;
|
|
3656
3860
|
status: z.ZodEnum<{
|
|
3657
3861
|
complete: "complete";
|
|
@@ -60,6 +60,7 @@ const list = z.looseObject({
|
|
|
60
60
|
dashboards: z.array(z.looseObject({
|
|
61
61
|
id: z.string(),
|
|
62
62
|
title: z.string(),
|
|
63
|
+
description: z.string().exactOptional(),
|
|
63
64
|
version: z.number(),
|
|
64
65
|
unpublished: z.literal(true).exactOptional()
|
|
65
66
|
})),
|
|
@@ -99,6 +100,7 @@ const answerSchemas = {
|
|
|
99
100
|
command: z.record(z.string(), z.unknown()),
|
|
100
101
|
query: z.record(z.string(), z.unknown()),
|
|
101
102
|
picks: z.record(z.string(), z.unknown()),
|
|
103
|
+
display: z.record(z.string(), z.record(z.string(), z.unknown())),
|
|
102
104
|
bodies: z.record(z.string(), z.record(z.string(), z.unknown()))
|
|
103
105
|
}),
|
|
104
106
|
"/meta/values": values,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DOCUMENT_UPGRADES, Loaded, SPEC_VERSION, Upgrade, loadDocument } from "../document/upgrade.mjs";
|
|
2
|
+
import { positional } from "./aliases.mjs";
|
|
2
3
|
import { AnswerSchemas, answerSchemas, tileLineSchema } from "./answers.mjs";
|
|
3
4
|
import { ParsedCommands, commandSchema, parseCommands } from "./commands.mjs";
|
|
4
5
|
import { customReadSchemas, groupedReadSchema, recordsReadSchema } from "./custom.mjs";
|
|
5
6
|
import { ParsedDocument, documentSchema, parseDocument } from "./document.mjs";
|
|
6
7
|
import { drillStateSchema, drillViewSchema, pinnedSchema, selectionSchema } from "./drill.mjs";
|
|
7
8
|
import { picksSchema } from "./picks.mjs";
|
|
8
|
-
import { ParsedQuery, parseWireQuery, wireQuerySchema } from "./query.mjs";
|
|
9
|
+
import { ParsedQuery, parseWireQuery, wireQuerySchema, wireQueryShape } from "./query.mjs";
|
|
9
10
|
import { JsonSchema, jsonSchema, toolSchemas } from "./tools.mjs";
|
|
10
11
|
import { decodeView } from "./view.mjs";
|
|
11
|
-
export { type AnswerSchemas, DOCUMENT_UPGRADES, type JsonSchema, type Loaded, type ParsedCommands, type ParsedDocument, type ParsedQuery, SPEC_VERSION, type Upgrade, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, drillStateSchema, drillViewSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, pinnedSchema, recordsReadSchema, selectionSchema, tileLineSchema, toolSchemas, wireQuerySchema };
|
|
12
|
+
export { type AnswerSchemas, DOCUMENT_UPGRADES, type JsonSchema, type Loaded, type ParsedCommands, type ParsedDocument, type ParsedQuery, SPEC_VERSION, type Upgrade, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, drillStateSchema, drillViewSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, pinnedSchema, positional, recordsReadSchema, selectionSchema, tileLineSchema, toolSchemas, wireQuerySchema, wireQueryShape };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DOCUMENT_UPGRADES, SPEC_VERSION, loadDocument } from "../document/upgrade.mjs";
|
|
2
|
+
import { positional } from "./aliases.mjs";
|
|
2
3
|
import { answerSchemas, tileLineSchema } from "./answers.mjs";
|
|
3
4
|
import { commandSchema, parseCommands } from "./commands.mjs";
|
|
4
5
|
import { customReadSchemas, groupedReadSchema, recordsReadSchema } from "./custom.mjs";
|
|
5
6
|
import { documentSchema, parseDocument } from "./document.mjs";
|
|
6
7
|
import { drillStateSchema, drillViewSchema, pinnedSchema, selectionSchema } from "./drill.mjs";
|
|
7
8
|
import { picksSchema } from "./picks.mjs";
|
|
8
|
-
import { parseWireQuery, wireQuerySchema } from "./query.mjs";
|
|
9
|
+
import { parseWireQuery, wireQuerySchema, wireQueryShape } from "./query.mjs";
|
|
9
10
|
import { jsonSchema, toolSchemas } from "./tools.mjs";
|
|
10
11
|
import { decodeView } from "./view.mjs";
|
|
11
|
-
export { DOCUMENT_UPGRADES, SPEC_VERSION, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, drillStateSchema, drillViewSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, pinnedSchema, recordsReadSchema, selectionSchema, tileLineSchema, toolSchemas, wireQuerySchema };
|
|
12
|
+
export { DOCUMENT_UPGRADES, SPEC_VERSION, answerSchemas, commandSchema, customReadSchemas, decodeView, documentSchema, drillStateSchema, drillViewSchema, groupedReadSchema, jsonSchema, loadDocument, parseCommands, parseDocument, parseWireQuery, picksSchema, pinnedSchema, positional, recordsReadSchema, selectionSchema, tileLineSchema, toolSchemas, wireQuerySchema, wireQueryShape };
|
|
@@ -2,6 +2,87 @@ import { WireFilter } from "../query/filter.mjs";
|
|
|
2
2
|
import { FormulaNode, WireQuery } from "../query/types.mjs";
|
|
3
3
|
import { Issue } from "../types/primitives.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
/** The query's fields, before its ids are checked against each other; extend this, not the schema. */
|
|
6
|
+
export declare const wireQueryShape: z.ZodObject<{
|
|
7
|
+
kind: z.ZodLiteral<"aggregate">;
|
|
8
|
+
source: z.ZodString;
|
|
9
|
+
measures: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
10
|
+
id: z.ZodTemplateLiteral<`m${number}`>;
|
|
11
|
+
measure: z.ZodString;
|
|
12
|
+
filter: z.ZodExactOptional<z.ZodType<WireFilter, unknown, z.core.$ZodTypeInternals<WireFilter, unknown>>>;
|
|
13
|
+
label: z.ZodExactOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strict>>>;
|
|
15
|
+
dimensions: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodTemplateLiteral<`d${number}`>;
|
|
17
|
+
member: z.ZodString;
|
|
18
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
19
|
+
other: z.ZodExactOptional<z.ZodBoolean>;
|
|
20
|
+
rankBy: z.ZodExactOptional<z.ZodObject<{
|
|
21
|
+
by: z.ZodUnion<readonly [z.ZodTemplateLiteral<`m${number}`>, z.ZodTemplateLiteral<`c${number}`>]>;
|
|
22
|
+
dir: z.ZodEnum<{
|
|
23
|
+
asc: "asc";
|
|
24
|
+
desc: "desc";
|
|
25
|
+
}>;
|
|
26
|
+
}, z.core.$strict>>;
|
|
27
|
+
}, z.core.$strict>>>>;
|
|
28
|
+
time: z.ZodExactOptional<z.ZodObject<{
|
|
29
|
+
dimension: z.ZodString;
|
|
30
|
+
grain: z.ZodExactOptional<z.ZodEnum<{
|
|
31
|
+
hour: "hour";
|
|
32
|
+
day: "day";
|
|
33
|
+
week: "week";
|
|
34
|
+
month: "month";
|
|
35
|
+
quarter: "quarter";
|
|
36
|
+
year: "year";
|
|
37
|
+
}>>;
|
|
38
|
+
range: z.ZodUnion<readonly [z.ZodObject<{
|
|
39
|
+
last: z.ZodNumber;
|
|
40
|
+
unit: z.ZodEnum<{
|
|
41
|
+
hour: "hour";
|
|
42
|
+
day: "day";
|
|
43
|
+
week: "week";
|
|
44
|
+
month: "month";
|
|
45
|
+
quarter: "quarter";
|
|
46
|
+
year: "year";
|
|
47
|
+
}>;
|
|
48
|
+
includeCurrent: z.ZodBoolean;
|
|
49
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
50
|
+
from: z.ZodString;
|
|
51
|
+
to: z.ZodString;
|
|
52
|
+
}, z.core.$strict>]>;
|
|
53
|
+
compare: z.ZodExactOptional<z.ZodEnum<{
|
|
54
|
+
previous_period: "previous_period";
|
|
55
|
+
previous_year: "previous_year";
|
|
56
|
+
}>>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
filters: z.ZodExactOptional<z.ZodType<WireFilter, unknown, z.core.$ZodTypeInternals<WireFilter, unknown>>>;
|
|
59
|
+
calc: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
60
|
+
id: z.ZodTemplateLiteral<`c${number}`>;
|
|
61
|
+
formula: z.ZodType<FormulaNode, unknown, z.core.$ZodTypeInternals<FormulaNode, unknown>>;
|
|
62
|
+
format: z.ZodExactOptional<z.ZodEnum<{
|
|
63
|
+
number: "number";
|
|
64
|
+
percent: "percent";
|
|
65
|
+
currency: "currency";
|
|
66
|
+
duration: "duration";
|
|
67
|
+
}>>;
|
|
68
|
+
label: z.ZodExactOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>>>>;
|
|
70
|
+
order: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
71
|
+
by: z.ZodUnion<readonly [z.ZodTemplateLiteral<`m${number}`>, z.ZodTemplateLiteral<`c${number}`>, z.ZodTemplateLiteral<`d${number}`>]>;
|
|
72
|
+
dir: z.ZodEnum<{
|
|
73
|
+
asc: "asc";
|
|
74
|
+
desc: "desc";
|
|
75
|
+
}>;
|
|
76
|
+
}, z.core.$strict>>>>;
|
|
77
|
+
limit: z.ZodExactOptional<z.ZodNumber>;
|
|
78
|
+
other: z.ZodExactOptional<z.ZodBoolean>;
|
|
79
|
+
total: z.ZodExactOptional<z.ZodBoolean>;
|
|
80
|
+
fill: z.ZodExactOptional<z.ZodEnum<{
|
|
81
|
+
none: "none";
|
|
82
|
+
zero: "zero";
|
|
83
|
+
}>>;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
/** A query from outside: its fields, then each id checked to be its entry's position. */
|
|
5
86
|
export declare const wireQuerySchema: z.ZodObject<{
|
|
6
87
|
kind: z.ZodLiteral<"aggregate">;
|
|
7
88
|
source: z.ZodString;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NEGATIVE_OPS, NULL_OPS, POSITIVE_OPS } from "../query/filter.mjs";
|
|
2
2
|
import { parseDate, parseTextTime } from "../time/instant.mjs";
|
|
3
|
+
import { checkPositions } from "./aliases.mjs";
|
|
3
4
|
import { z } from "zod";
|
|
4
5
|
// src/schema/query.ts
|
|
5
6
|
/**
|
|
@@ -61,9 +62,9 @@ const filter = z.lazy(() => z.union([
|
|
|
61
62
|
where: filter
|
|
62
63
|
}) })
|
|
63
64
|
]));
|
|
64
|
-
const measureAlias = z.templateLiteral(["m", z.number().int().nonnegative()], { error: "A measure's id in a query is m and a number:
|
|
65
|
-
const dimensionAlias = z.templateLiteral(["d", z.number().int().nonnegative()], { error: "A dimension's id in a query is d and a number:
|
|
66
|
-
const calcAlias = z.templateLiteral(["c", z.number().int().nonnegative()], { error: "A calculation's id in a query is c and a number:
|
|
65
|
+
const measureAlias = z.templateLiteral(["m", z.number().int().nonnegative()], { error: "A measure's id in a query is m and a number: m1, m2." });
|
|
66
|
+
const dimensionAlias = z.templateLiteral(["d", z.number().int().nonnegative()], { error: "A dimension's id in a query is d and a number: d1, d2." });
|
|
67
|
+
const calcAlias = z.templateLiteral(["c", z.number().int().nonnegative()], { error: "A calculation's id in a query is c and a number: c1, c2." });
|
|
67
68
|
const formula = z.lazy(() => z.union([
|
|
68
69
|
z.strictObject({
|
|
69
70
|
ref: z.union([measureAlias, calcAlias]),
|
|
@@ -105,7 +106,8 @@ const range = z.union([z.strictObject({
|
|
|
105
106
|
from: rangeEnd,
|
|
106
107
|
to: rangeEnd
|
|
107
108
|
})]);
|
|
108
|
-
|
|
109
|
+
/** The query's fields, before its ids are checked against each other; extend this, not the schema. */
|
|
110
|
+
const wireQueryShape = z.strictObject({
|
|
109
111
|
kind: z.literal("aggregate"),
|
|
110
112
|
source: name,
|
|
111
113
|
measures: z.array(z.strictObject({
|
|
@@ -155,6 +157,8 @@ const wireQuerySchema = z.strictObject({
|
|
|
155
157
|
total: z.boolean().exactOptional(),
|
|
156
158
|
fill: z.enum(["zero", "none"]).exactOptional()
|
|
157
159
|
});
|
|
160
|
+
/** A query from outside: its fields, then each id checked to be its entry's position. */
|
|
161
|
+
const wireQuerySchema = wireQueryShape.superRefine(checkPositions);
|
|
158
162
|
/** Checks an untrusted query. Every problem is reported, with the path to it. */
|
|
159
163
|
function parseWireQuery(input) {
|
|
160
164
|
const result = wireQuerySchema.safeParse(input);
|
|
@@ -171,4 +175,4 @@ function parseWireQuery(input) {
|
|
|
171
175
|
}))
|
|
172
176
|
};
|
|
173
177
|
}
|
|
174
|
-
export { grain, idSchema, name, op, parseWireQuery, primitive, range, viewerRef, wireQuerySchema };
|
|
178
|
+
export { grain, idSchema, name, op, parseWireQuery, primitive, range, viewerRef, wireQuerySchema, wireQueryShape };
|
|
@@ -12,6 +12,8 @@ export declare function toolSchemas(): {
|
|
|
12
12
|
command: JsonSchema;
|
|
13
13
|
query: JsonSchema;
|
|
14
14
|
picks: JsonSchema;
|
|
15
|
+
/** The display options of each kind of widget the library draws, by kind. */
|
|
16
|
+
display: Record<string, JsonSchema>;
|
|
15
17
|
};
|
|
16
18
|
/** A Zod schema as JSON Schema, as an agent sends it (the input side). */
|
|
17
19
|
export declare function jsonSchema(schema: z.ZodType): JsonSchema;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DISPLAY_HELP, DISPLAY_OPTIONS } from "../document/display.mjs";
|
|
1
2
|
import { commandSchema } from "./commands.mjs";
|
|
2
3
|
import { picksSchema } from "./picks.mjs";
|
|
3
4
|
import { wireQuerySchema } from "./query.mjs";
|
|
@@ -14,7 +15,32 @@ function toolSchemas() {
|
|
|
14
15
|
return {
|
|
15
16
|
command: described(jsonSchema(commandSchema)),
|
|
16
17
|
query: jsonSchema(wireQuerySchema),
|
|
17
|
-
picks: jsonSchema(picksSchema)
|
|
18
|
+
picks: jsonSchema(picksSchema),
|
|
19
|
+
display: Object.fromEntries(Object.entries(DISPLAY_OPTIONS).map(([kind, options]) => [kind, optionsSchema(options)]))
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** What each type of display option is, as JSON Schema. */
|
|
23
|
+
const OPTION_TYPES = {
|
|
24
|
+
boolean: { type: "boolean" },
|
|
25
|
+
text: { type: "string" },
|
|
26
|
+
texts: {
|
|
27
|
+
type: "array",
|
|
28
|
+
items: { type: "string" }
|
|
29
|
+
},
|
|
30
|
+
colors: {
|
|
31
|
+
type: "object",
|
|
32
|
+
additionalProperties: { type: "string" }
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/** A kind's display options as JSON Schema: each option typed and described, any other left open. */
|
|
36
|
+
function optionsSchema(options) {
|
|
37
|
+
return {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: Object.fromEntries(Object.entries(options).map(([name, type]) => [name, {
|
|
40
|
+
...OPTION_TYPES[type],
|
|
41
|
+
description: DISPLAY_HELP[name]
|
|
42
|
+
}])),
|
|
43
|
+
additionalProperties: true
|
|
18
44
|
};
|
|
19
45
|
}
|
|
20
46
|
/** A Zod schema as JSON Schema, as an agent sends it (the input side). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MICROS_PER_HOUR, formatTextTime } from "./instant.mjs";
|
|
1
|
+
import { MICROS_PER_HOUR, formatTextTime, parseDate, parseTextTime } from "./instant.mjs";
|
|
2
2
|
import { Temporal, zonedAt } from "./temporal.mjs";
|
|
3
3
|
import { lastChange, nextChange, startOfDate } from "./zone.mjs";
|
|
4
4
|
// src/time/bucket.ts
|
|
@@ -87,6 +87,12 @@ function bucketLabel(instant, grain, calendar) {
|
|
|
87
87
|
if (grain === "hour") return formatTextTime(start);
|
|
88
88
|
return zonedAt(start, calendar.timezone).toPlainDate().toString();
|
|
89
89
|
}
|
|
90
|
+
/** The instant a bucket's label starts at: a local date in the zone, or an hour's instant. */
|
|
91
|
+
function labelStart(label, grain, calendar) {
|
|
92
|
+
if (grain === "hour") return parseTextTime(label);
|
|
93
|
+
const date = parseDate(label);
|
|
94
|
+
return date === void 0 ? void 0 : startOfDate(date, calendar.timezone);
|
|
95
|
+
}
|
|
90
96
|
/** Every bucket label a span touches, in order, including a partial first bucket. */
|
|
91
97
|
function bucketLabels(span, grain, calendar) {
|
|
92
98
|
const labels = [];
|
|
@@ -100,4 +106,4 @@ function bucketLabels(span, grain, calendar) {
|
|
|
100
106
|
function epochDayLabel(epochDay) {
|
|
101
107
|
return new Temporal.PlainDate(1970, 1, 1).add({ days: epochDay }).toString();
|
|
102
108
|
}
|
|
103
|
-
export { bucketLabel, bucketLabels, bucketStart, epochDayLabel, hourStart, nextBucketStart, shiftBucket };
|
|
109
|
+
export { bucketLabel, bucketLabels, bucketStart, epochDayLabel, hourStart, labelStart, nextBucketStart, shiftBucket };
|
|
@@ -19,6 +19,10 @@ export type MetaMember = {
|
|
|
19
19
|
/** On a measure: how it aggregates ("count", "sum", "ratio" and so on) and its unit. */
|
|
20
20
|
aggregate?: string;
|
|
21
21
|
unit?: string;
|
|
22
|
+
/** On a dimension: the tone of each value, from the model's hints. */
|
|
23
|
+
tones?: Readonly<Record<string, "positive" | "negative" | "warning" | "neutral">>;
|
|
24
|
+
/** On a number dimension: its bucket edges, ascending, from the model's hints. */
|
|
25
|
+
buckets?: readonly number[];
|
|
22
26
|
};
|
|
23
27
|
/** A join a query can group by: `<source>.<join>.<dimension>` names a dimension of `source`. */
|
|
24
28
|
export type MetaJoin = {
|
|
@@ -41,6 +45,8 @@ export type DashboardListResponse = {
|
|
|
41
45
|
dashboards: {
|
|
42
46
|
id: string;
|
|
43
47
|
title: string;
|
|
48
|
+
/** What the dashboard shows, in a sentence, when it has one. */
|
|
49
|
+
description?: string;
|
|
44
50
|
version: number;
|
|
45
51
|
unpublished?: true;
|
|
46
52
|
}[];
|
|
@@ -338,4 +344,4 @@ export type CoreContract = {
|
|
|
338
344
|
* than reading a shape it does not know. A test recomputes it from the answer schemas, so a
|
|
339
345
|
* change to an answer fails until this is updated.
|
|
340
346
|
*/
|
|
341
|
-
export declare const CONTRACT_VERSION = "
|
|
347
|
+
export declare const CONTRACT_VERSION = "ed1ec2bd454a1d16";
|
package/dist/core/types/api.mjs
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* than reading a shape it does not know. A test recomputes it from the answer schemas, so a
|
|
6
6
|
* change to an answer fails until this is updated.
|
|
7
7
|
*/
|
|
8
|
-
const CONTRACT_VERSION = "
|
|
8
|
+
const CONTRACT_VERSION = "ed1ec2bd454a1d16";
|
|
9
9
|
export { CONTRACT_VERSION };
|
package/dist/dashboards.mjs
CHANGED
|
@@ -30,6 +30,8 @@ function adapterFor(options, request) {
|
|
|
30
30
|
const { database } = options;
|
|
31
31
|
return typeof database === "function" ? database(request) : database;
|
|
32
32
|
}
|
|
33
|
+
/** A description the list carries only when there is one to show. */
|
|
34
|
+
const described = (description) => description === void 0 || description.trim() === "" ? {} : { description };
|
|
33
35
|
async function listDashboards(options, request, principal) {
|
|
34
36
|
const adapter = adapterFor(options, request);
|
|
35
37
|
const stored = adapter === void 0 ? [] : await allStored(adapter, principalTenant(principal));
|
|
@@ -37,11 +39,13 @@ async function listDashboards(options, request, principal) {
|
|
|
37
39
|
const defaults = (options.dashboards ?? []).filter((d) => !customized.has(d.key)).map((d) => ({
|
|
38
40
|
id: builtInId(d.key),
|
|
39
41
|
title: d.document.meta.title,
|
|
42
|
+
...described(d.document.meta.description),
|
|
40
43
|
version: 0
|
|
41
44
|
}));
|
|
42
45
|
return [...stored.map((d) => ({
|
|
43
46
|
id: d.defaultOf === void 0 ? d.id : builtInId(d.defaultOf),
|
|
44
47
|
title: d.title,
|
|
48
|
+
...described(d.description),
|
|
45
49
|
version: d.currentVersion,
|
|
46
50
|
...d.defaultOf === void 0 ? { owner: {
|
|
47
51
|
id: d.ownerId,
|
package/dist/drill-change.mjs
CHANGED
|
@@ -45,7 +45,7 @@ function otherChange(answer) {
|
|
|
45
45
|
};
|
|
46
46
|
const total = answer.rows.find((r) => isAll(r));
|
|
47
47
|
const other = answer.rows.findIndex((r) => isOther(r));
|
|
48
|
-
const now = answer.columns.findIndex((c) => c.
|
|
48
|
+
const now = answer.columns.findIndex((c) => c.role === "measure");
|
|
49
49
|
if (places.before < 0 || total === void 0 || other < 0 || now < 0) return answer;
|
|
50
50
|
const kept = answer.rows.filter((r) => !isAll(r) && !isOther(r));
|
|
51
51
|
const row = answer.rows[other] ?? [];
|