metrickit 0.1.2
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/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +379 -0
- package/dist/cache-redis.d.ts +10 -0
- package/dist/cache-redis.js +24 -0
- package/dist/cache-utils.d.ts +5 -0
- package/dist/cache.d.ts +18 -0
- package/dist/catalog.d.ts +12 -0
- package/dist/define-metric.d.ts +37 -0
- package/dist/engine.d.ts +200 -0
- package/dist/filters/default-metadata.d.ts +28 -0
- package/dist/filters/index.d.ts +3 -0
- package/dist/filters/parse.d.ts +7 -0
- package/dist/filters/types.d.ts +19 -0
- package/dist/frontend/catalog.d.ts +24 -0
- package/dist/frontend/dashboard.d.ts +12 -0
- package/dist/frontend/format.d.ts +10 -0
- package/dist/frontend/index.d.ts +10 -0
- package/dist/frontend/markers.d.ts +19 -0
- package/dist/frontend/renderers.d.ts +14 -0
- package/dist/frontend/requests.d.ts +17 -0
- package/dist/frontend/stream-state.d.ts +14 -0
- package/dist/frontend/time.d.ts +5 -0
- package/dist/frontend/transport.d.ts +19 -0
- package/dist/frontend/types.d.ts +108 -0
- package/dist/frontend.d.ts +1 -0
- package/dist/frontend.js +752 -0
- package/dist/helpers/clickhouse.d.ts +27 -0
- package/dist/helpers/distribution.d.ts +15 -0
- package/dist/helpers/index.d.ts +6 -0
- package/dist/helpers/metric-type.d.ts +21 -0
- package/dist/helpers/pivot.d.ts +15 -0
- package/dist/helpers/prisma.d.ts +20 -0
- package/dist/helpers/timeseries.d.ts +6 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.js +668 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1322 -0
- package/dist/orpc.d.ts +36 -0
- package/dist/orpc.js +1157 -0
- package/dist/registry.d.ts +269 -0
- package/dist/run-metrics.d.ts +14 -0
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/inputs.d.ts +19 -0
- package/dist/schemas/metric-type.d.ts +7 -0
- package/dist/schemas/output.d.ts +842 -0
- package/dist/schemas/time.d.ts +24 -0
- package/dist/time.d.ts +6 -0
- package/dist/type-guards.d.ts +7 -0
- package/package.json +91 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const OutputKindSchema: z.ZodEnum<{
|
|
3
|
+
kpi: "kpi";
|
|
4
|
+
timeseries: "timeseries";
|
|
5
|
+
distribution: "distribution";
|
|
6
|
+
table: "table";
|
|
7
|
+
leaderboard: "leaderboard";
|
|
8
|
+
pivot: "pivot";
|
|
9
|
+
}>;
|
|
10
|
+
export type OutputKind = z.infer<typeof OutputKindSchema>;
|
|
11
|
+
export declare const MetricUnitSchema: z.ZodEnum<{
|
|
12
|
+
DKK: "DKK";
|
|
13
|
+
EUR: "EUR";
|
|
14
|
+
USD: "USD";
|
|
15
|
+
GBP: "GBP";
|
|
16
|
+
SEK: "SEK";
|
|
17
|
+
NOK: "NOK";
|
|
18
|
+
PERCENTAGE: "PERCENTAGE";
|
|
19
|
+
}>;
|
|
20
|
+
export type MetricUnit = z.infer<typeof MetricUnitSchema>;
|
|
21
|
+
export declare const KpiOutputSchema: z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"kpi">;
|
|
23
|
+
value: z.ZodNumber;
|
|
24
|
+
label: z.ZodOptional<z.ZodString>;
|
|
25
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
DKK: "DKK";
|
|
27
|
+
EUR: "EUR";
|
|
28
|
+
USD: "USD";
|
|
29
|
+
GBP: "GBP";
|
|
30
|
+
SEK: "SEK";
|
|
31
|
+
NOK: "NOK";
|
|
32
|
+
PERCENTAGE: "PERCENTAGE";
|
|
33
|
+
}>>;
|
|
34
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
35
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
36
|
+
trend: z.ZodOptional<z.ZodEnum<{
|
|
37
|
+
up: "up";
|
|
38
|
+
down: "down";
|
|
39
|
+
flat: "flat";
|
|
40
|
+
}>>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type KpiOutput = z.infer<typeof KpiOutputSchema>;
|
|
43
|
+
export declare function defineKpiOutput(output: Omit<KpiOutput, 'kind'> & {
|
|
44
|
+
kind?: 'kpi';
|
|
45
|
+
}): KpiOutput;
|
|
46
|
+
export declare const TimeSeriesPointSchema: z.ZodObject<{
|
|
47
|
+
ts: z.ZodDate;
|
|
48
|
+
value: z.ZodNumber;
|
|
49
|
+
label: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type TimeSeriesPoint = z.infer<typeof TimeSeriesPointSchema>;
|
|
52
|
+
export declare const TimeSeriesSeriesSchema: z.ZodObject<{
|
|
53
|
+
key: z.ZodString;
|
|
54
|
+
label: z.ZodOptional<z.ZodString>;
|
|
55
|
+
points: z.ZodArray<z.ZodObject<{
|
|
56
|
+
ts: z.ZodDate;
|
|
57
|
+
value: z.ZodNumber;
|
|
58
|
+
label: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
61
|
+
line: "line";
|
|
62
|
+
bar: "bar";
|
|
63
|
+
}>>;
|
|
64
|
+
axis: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
left: "left";
|
|
66
|
+
right: "right";
|
|
67
|
+
}>>;
|
|
68
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
type TimeSeriesSeriesSchemaType = z.infer<typeof TimeSeriesSeriesSchema>;
|
|
71
|
+
export type TimeSeriesSeries<SeriesKey extends string = string, SeriesMeta = Record<string, unknown> | undefined> = Omit<TimeSeriesSeriesSchemaType, 'key' | 'meta'> & {
|
|
72
|
+
key: SeriesKey;
|
|
73
|
+
meta?: SeriesMeta;
|
|
74
|
+
};
|
|
75
|
+
export declare const TimeSeriesOutputSchema: z.ZodObject<{
|
|
76
|
+
kind: z.ZodLiteral<"timeseries">;
|
|
77
|
+
granularity: z.ZodEnum<{
|
|
78
|
+
hour: "hour";
|
|
79
|
+
day: "day";
|
|
80
|
+
week: "week";
|
|
81
|
+
month: "month";
|
|
82
|
+
quarter: "quarter";
|
|
83
|
+
year: "year";
|
|
84
|
+
}>;
|
|
85
|
+
series: z.ZodArray<z.ZodObject<{
|
|
86
|
+
key: z.ZodString;
|
|
87
|
+
label: z.ZodOptional<z.ZodString>;
|
|
88
|
+
points: z.ZodArray<z.ZodObject<{
|
|
89
|
+
ts: z.ZodDate;
|
|
90
|
+
value: z.ZodNumber;
|
|
91
|
+
label: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>>;
|
|
93
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
line: "line";
|
|
95
|
+
bar: "bar";
|
|
96
|
+
}>>;
|
|
97
|
+
axis: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
left: "left";
|
|
99
|
+
right: "right";
|
|
100
|
+
}>>;
|
|
101
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
102
|
+
}, z.core.$strip>>;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
type TimeSeriesOutputSchemaType = z.infer<typeof TimeSeriesOutputSchema>;
|
|
105
|
+
export type TimeSeriesOutput<SeriesKey extends string = string, SeriesMeta = Record<string, unknown> | undefined> = Omit<TimeSeriesOutputSchemaType, 'series'> & {
|
|
106
|
+
series: Array<TimeSeriesSeries<SeriesKey, SeriesMeta>>;
|
|
107
|
+
};
|
|
108
|
+
type TimeSeriesSeriesInput<SeriesMeta = Record<string, unknown> | undefined> = Omit<TimeSeriesSeries<string, SeriesMeta>, 'key'> & {
|
|
109
|
+
key: string;
|
|
110
|
+
};
|
|
111
|
+
type TimeSeriesSeriesMapValue<SeriesMeta = Record<string, unknown> | undefined> = Omit<TimeSeriesSeries<string, SeriesMeta>, 'key'>;
|
|
112
|
+
type TimeSeriesSeriesMap<SeriesMeta = Record<string, unknown> | undefined> = Record<string, TimeSeriesSeriesMapValue<SeriesMeta>>;
|
|
113
|
+
type NormalizeSeriesMeta<SeriesMeta> = unknown extends SeriesMeta ? Record<string, unknown> | undefined : SeriesMeta;
|
|
114
|
+
type TimeSeriesSeriesMetaFromArray<Series extends readonly TimeSeriesSeriesInput[]> = Series[number] extends TimeSeriesSeriesInput<infer SeriesMeta> ? NormalizeSeriesMeta<SeriesMeta> : Record<string, unknown> | undefined;
|
|
115
|
+
type TimeSeriesSeriesMetaFromMap<SeriesMap extends TimeSeriesSeriesMap> = SeriesMap[keyof SeriesMap] extends {
|
|
116
|
+
meta?: infer SeriesMeta;
|
|
117
|
+
} ? NormalizeSeriesMeta<SeriesMeta> : Record<string, unknown> | undefined;
|
|
118
|
+
export declare function defineTimeSeriesOutput<const Series extends readonly TimeSeriesSeriesInput[]>(output: Omit<TimeSeriesOutput<Series[number]['key'], TimeSeriesSeriesMetaFromArray<Series>>, 'kind' | 'series'> & {
|
|
119
|
+
kind?: 'timeseries';
|
|
120
|
+
series: Series;
|
|
121
|
+
}): TimeSeriesOutput<Series[number]['key'], TimeSeriesSeriesMetaFromArray<Series>>;
|
|
122
|
+
export declare function defineTimeSeriesOutput<const SeriesMap extends TimeSeriesSeriesMap>(output: Omit<TimeSeriesOutput<Extract<keyof SeriesMap, string>, TimeSeriesSeriesMetaFromMap<SeriesMap>>, 'kind' | 'series'> & {
|
|
123
|
+
kind?: 'timeseries';
|
|
124
|
+
series: SeriesMap;
|
|
125
|
+
}): TimeSeriesOutput<Extract<keyof SeriesMap, string>, TimeSeriesSeriesMetaFromMap<SeriesMap>>;
|
|
126
|
+
export declare function defineTimeSeriesOutput(output: TimeSeriesMetricOutputInput): TimeSeriesOutput<string>;
|
|
127
|
+
export declare const DistributionSegmentSchema: z.ZodObject<{
|
|
128
|
+
key: z.ZodString;
|
|
129
|
+
label: z.ZodString;
|
|
130
|
+
value: z.ZodNumber;
|
|
131
|
+
percent: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
type DistributionSegmentSchemaType = z.infer<typeof DistributionSegmentSchema>;
|
|
134
|
+
export type DistributionSegment<Key extends string = string> = Omit<DistributionSegmentSchemaType, 'key'> & {
|
|
135
|
+
key: Key;
|
|
136
|
+
};
|
|
137
|
+
export declare const DistributionChartTypeSchema: z.ZodEnum<{
|
|
138
|
+
bar: "bar";
|
|
139
|
+
donut: "donut";
|
|
140
|
+
pie: "pie";
|
|
141
|
+
funnel: "funnel";
|
|
142
|
+
}>;
|
|
143
|
+
export type DistributionChartType = z.infer<typeof DistributionChartTypeSchema>;
|
|
144
|
+
export declare const DistributionOutputSchema: z.ZodObject<{
|
|
145
|
+
kind: z.ZodLiteral<"distribution">;
|
|
146
|
+
total: z.ZodNumber;
|
|
147
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
148
|
+
key: z.ZodString;
|
|
149
|
+
label: z.ZodString;
|
|
150
|
+
value: z.ZodNumber;
|
|
151
|
+
percent: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
154
|
+
bar: "bar";
|
|
155
|
+
donut: "donut";
|
|
156
|
+
pie: "pie";
|
|
157
|
+
funnel: "funnel";
|
|
158
|
+
}>>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
type DistributionOutputSchemaType = z.infer<typeof DistributionOutputSchema>;
|
|
161
|
+
export type DistributionOutput<Key extends string = string> = Omit<DistributionOutputSchemaType, 'segments'> & {
|
|
162
|
+
segments: Array<DistributionSegment<Key>>;
|
|
163
|
+
};
|
|
164
|
+
type DistributionSegmentInput = Omit<DistributionSegment<string>, 'key'> & {
|
|
165
|
+
key: string;
|
|
166
|
+
};
|
|
167
|
+
export declare function defineDistributionOutput<const Segments extends readonly DistributionSegmentInput[]>(output: Omit<DistributionOutput<Segments[number]['key']>, 'kind' | 'segments'> & {
|
|
168
|
+
kind?: 'distribution';
|
|
169
|
+
segments: Segments;
|
|
170
|
+
chartType?: DistributionChartType;
|
|
171
|
+
}): DistributionOutput<Segments[number]['key']>;
|
|
172
|
+
export declare const TableColumnSchema: z.ZodObject<{
|
|
173
|
+
key: z.ZodString;
|
|
174
|
+
label: z.ZodString;
|
|
175
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
176
|
+
string: "string";
|
|
177
|
+
number: "number";
|
|
178
|
+
boolean: "boolean";
|
|
179
|
+
date: "date";
|
|
180
|
+
}>>;
|
|
181
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
type TableColumnSchemaType = z.infer<typeof TableColumnSchema>;
|
|
184
|
+
export type TableColumn<Key extends string = string> = Omit<TableColumnSchemaType, 'key'> & {
|
|
185
|
+
key: Key;
|
|
186
|
+
};
|
|
187
|
+
export declare const TableOutputSchema: z.ZodObject<{
|
|
188
|
+
kind: z.ZodLiteral<"table">;
|
|
189
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
190
|
+
key: z.ZodString;
|
|
191
|
+
label: z.ZodString;
|
|
192
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
193
|
+
string: "string";
|
|
194
|
+
number: "number";
|
|
195
|
+
boolean: "boolean";
|
|
196
|
+
date: "date";
|
|
197
|
+
}>>;
|
|
198
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
201
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
}, z.core.$strip>;
|
|
203
|
+
type TableOutputSchemaType = z.infer<typeof TableOutputSchema>;
|
|
204
|
+
export type TableOutput<Row = Record<string, unknown>, ColumnKey extends string = string> = Omit<TableOutputSchemaType, 'columns' | 'rows'> & {
|
|
205
|
+
columns: Array<TableColumn<ColumnKey>>;
|
|
206
|
+
rows: Array<Row>;
|
|
207
|
+
};
|
|
208
|
+
type TableColumnInput = Omit<TableColumn<string>, 'key'> & {
|
|
209
|
+
key: string;
|
|
210
|
+
};
|
|
211
|
+
type TableRowInput = Record<string, unknown>;
|
|
212
|
+
type TableColumnValueTypeBase<Column> = Column extends {
|
|
213
|
+
type: 'string';
|
|
214
|
+
} ? string : Column extends {
|
|
215
|
+
type: 'number';
|
|
216
|
+
} ? number : Column extends {
|
|
217
|
+
type: 'boolean';
|
|
218
|
+
} ? boolean : Column extends {
|
|
219
|
+
type: 'date';
|
|
220
|
+
} ? Date : unknown;
|
|
221
|
+
type TableColumnValueType<Column> = Column extends {
|
|
222
|
+
nullable: true;
|
|
223
|
+
} ? TableColumnValueTypeBase<Column> | null : TableColumnValueTypeBase<Column>;
|
|
224
|
+
type TableRowFromColumns<Columns extends readonly TableColumnInput[]> = {
|
|
225
|
+
[Column in Columns[number] as Column['key']]: TableColumnValueType<Column>;
|
|
226
|
+
} & Record<string, unknown>;
|
|
227
|
+
export declare function defineTableOutput<const Columns extends readonly TableColumnInput[], const Rows extends readonly TableRowFromColumns<Columns>[]>(output: Omit<TableOutput<Rows[number], Columns[number]['key']>, 'kind' | 'columns' | 'rows'> & {
|
|
228
|
+
kind?: 'table';
|
|
229
|
+
columns: Columns;
|
|
230
|
+
rows: Rows;
|
|
231
|
+
}): TableOutput<Rows[number], Columns[number]['key']>;
|
|
232
|
+
export declare const PivotDimensionSchema: z.ZodObject<{
|
|
233
|
+
key: z.ZodString;
|
|
234
|
+
label: z.ZodString;
|
|
235
|
+
}, z.core.$strip>;
|
|
236
|
+
export type PivotDimension = z.infer<typeof PivotDimensionSchema>;
|
|
237
|
+
export declare const PivotTotalsSchema: z.ZodObject<{
|
|
238
|
+
rowTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
239
|
+
columnTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
240
|
+
grandTotal: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
export type PivotTotals = z.infer<typeof PivotTotalsSchema>;
|
|
243
|
+
export declare const PivotOutputSchema: z.ZodObject<{
|
|
244
|
+
kind: z.ZodLiteral<"pivot">;
|
|
245
|
+
rowDimension: z.ZodObject<{
|
|
246
|
+
key: z.ZodString;
|
|
247
|
+
label: z.ZodString;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
columnDimension: z.ZodObject<{
|
|
250
|
+
key: z.ZodString;
|
|
251
|
+
label: z.ZodString;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
rows: z.ZodArray<z.ZodString>;
|
|
254
|
+
columns: z.ZodArray<z.ZodString>;
|
|
255
|
+
values: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
256
|
+
cellTooltips: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
257
|
+
totals: z.ZodOptional<z.ZodObject<{
|
|
258
|
+
rowTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
259
|
+
columnTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
260
|
+
grandTotal: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
}, z.core.$strip>>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
export type PivotOutput = z.infer<typeof PivotOutputSchema>;
|
|
264
|
+
export declare function definePivotOutput(output: Omit<PivotOutput, 'kind'> & {
|
|
265
|
+
kind?: 'pivot';
|
|
266
|
+
}): PivotOutput;
|
|
267
|
+
export declare const LeaderboardItemSchema: z.ZodObject<{
|
|
268
|
+
rank: z.ZodNumber;
|
|
269
|
+
id: z.ZodString;
|
|
270
|
+
label: z.ZodString;
|
|
271
|
+
value: z.ZodNumber;
|
|
272
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
type LeaderboardItemSchemaType = z.infer<typeof LeaderboardItemSchema>;
|
|
275
|
+
export type LeaderboardItem<Meta = Record<string, unknown> | undefined> = Omit<LeaderboardItemSchemaType, 'meta'> & {
|
|
276
|
+
meta?: Meta;
|
|
277
|
+
};
|
|
278
|
+
export declare const LeaderboardOutputSchema: z.ZodObject<{
|
|
279
|
+
kind: z.ZodLiteral<"leaderboard">;
|
|
280
|
+
items: z.ZodArray<z.ZodObject<{
|
|
281
|
+
rank: z.ZodNumber;
|
|
282
|
+
id: z.ZodString;
|
|
283
|
+
label: z.ZodString;
|
|
284
|
+
value: z.ZodNumber;
|
|
285
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
286
|
+
}, z.core.$strip>>;
|
|
287
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
}, z.core.$strip>;
|
|
289
|
+
type LeaderboardOutputSchemaType = z.infer<typeof LeaderboardOutputSchema>;
|
|
290
|
+
export type LeaderboardOutput<Meta = Record<string, unknown> | undefined> = Omit<LeaderboardOutputSchemaType, 'items'> & {
|
|
291
|
+
items: Array<LeaderboardItem<Meta>>;
|
|
292
|
+
};
|
|
293
|
+
type LeaderboardItemInput<Meta = Record<string, unknown> | undefined> = Omit<LeaderboardItem<Meta>, 'meta'> & {
|
|
294
|
+
meta?: Meta;
|
|
295
|
+
};
|
|
296
|
+
type LeaderboardMetaFromItems<Items extends readonly LeaderboardItemInput[]> = Items[number] extends LeaderboardItemInput<infer Meta> ? Meta : undefined;
|
|
297
|
+
export declare function defineLeaderboardOutput<const Items extends readonly LeaderboardItemInput[]>(output: Omit<LeaderboardOutput<LeaderboardMetaFromItems<Items>>, 'kind' | 'items'> & {
|
|
298
|
+
kind?: 'leaderboard';
|
|
299
|
+
items: Items;
|
|
300
|
+
}): LeaderboardOutput<LeaderboardMetaFromItems<Items>>;
|
|
301
|
+
export interface OutputKindMap {
|
|
302
|
+
kpi: KpiOutput;
|
|
303
|
+
timeseries: TimeSeriesOutput;
|
|
304
|
+
distribution: DistributionOutput;
|
|
305
|
+
table: TableOutput;
|
|
306
|
+
leaderboard: LeaderboardOutput;
|
|
307
|
+
pivot: PivotOutput;
|
|
308
|
+
}
|
|
309
|
+
export type OutputForKind<K extends OutputKind> = OutputKindMap[K];
|
|
310
|
+
type KpiMetricOutputInput = Omit<KpiOutput, 'kind'> & {
|
|
311
|
+
kind?: 'kpi';
|
|
312
|
+
};
|
|
313
|
+
type TimeSeriesMetricOutputArrayInput = Omit<TimeSeriesOutput<string>, 'kind' | 'series'> & {
|
|
314
|
+
kind?: 'timeseries';
|
|
315
|
+
series: ReadonlyArray<TimeSeriesSeriesInput>;
|
|
316
|
+
};
|
|
317
|
+
type TimeSeriesMetricOutputMapInput = Omit<TimeSeriesOutput<string>, 'kind' | 'series'> & {
|
|
318
|
+
kind?: 'timeseries';
|
|
319
|
+
series: TimeSeriesSeriesMap;
|
|
320
|
+
};
|
|
321
|
+
type TimeSeriesMetricOutputInput = TimeSeriesMetricOutputArrayInput | TimeSeriesMetricOutputMapInput;
|
|
322
|
+
type DistributionMetricOutputInput = Omit<DistributionOutput<string>, 'kind' | 'segments'> & {
|
|
323
|
+
kind?: 'distribution';
|
|
324
|
+
segments: readonly DistributionSegmentInput[];
|
|
325
|
+
chartType?: DistributionChartType;
|
|
326
|
+
};
|
|
327
|
+
type TableMetricOutputInput = Omit<TableOutput<Record<string, unknown>, string>, 'kind' | 'columns' | 'rows'> & {
|
|
328
|
+
kind?: 'table';
|
|
329
|
+
columns: readonly TableColumnInput[];
|
|
330
|
+
rows: readonly TableRowInput[];
|
|
331
|
+
};
|
|
332
|
+
type LeaderboardMetricOutputInput = Omit<LeaderboardOutput<Record<string, unknown> | undefined>, 'kind' | 'items'> & {
|
|
333
|
+
kind?: 'leaderboard';
|
|
334
|
+
items: readonly LeaderboardItemInput[];
|
|
335
|
+
};
|
|
336
|
+
type PivotMetricOutputInput = Omit<PivotOutput, 'kind'> & {
|
|
337
|
+
kind?: 'pivot';
|
|
338
|
+
};
|
|
339
|
+
interface MetricOutputInputByKind {
|
|
340
|
+
kpi: KpiMetricOutputInput;
|
|
341
|
+
timeseries: TimeSeriesMetricOutputInput;
|
|
342
|
+
distribution: DistributionMetricOutputInput;
|
|
343
|
+
table: TableMetricOutputInput;
|
|
344
|
+
leaderboard: LeaderboardMetricOutputInput;
|
|
345
|
+
pivot: PivotMetricOutputInput;
|
|
346
|
+
}
|
|
347
|
+
type MetricOutputInput<K extends OutputKind> = MetricOutputInputByKind[K];
|
|
348
|
+
export declare function defineMetricOutput<K extends OutputKind>(kind: K, output: MetricOutputInput<K>): OutputForKind<K>;
|
|
349
|
+
export declare function validateOutput<K extends OutputKind>(kind: K, output: unknown): OutputForKind<K>;
|
|
350
|
+
export declare const MetricOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
351
|
+
kind: z.ZodLiteral<"kpi">;
|
|
352
|
+
value: z.ZodNumber;
|
|
353
|
+
label: z.ZodOptional<z.ZodString>;
|
|
354
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
355
|
+
DKK: "DKK";
|
|
356
|
+
EUR: "EUR";
|
|
357
|
+
USD: "USD";
|
|
358
|
+
GBP: "GBP";
|
|
359
|
+
SEK: "SEK";
|
|
360
|
+
NOK: "NOK";
|
|
361
|
+
PERCENTAGE: "PERCENTAGE";
|
|
362
|
+
}>>;
|
|
363
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
364
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
365
|
+
trend: z.ZodOptional<z.ZodEnum<{
|
|
366
|
+
up: "up";
|
|
367
|
+
down: "down";
|
|
368
|
+
flat: "flat";
|
|
369
|
+
}>>;
|
|
370
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
371
|
+
kind: z.ZodLiteral<"timeseries">;
|
|
372
|
+
granularity: z.ZodEnum<{
|
|
373
|
+
hour: "hour";
|
|
374
|
+
day: "day";
|
|
375
|
+
week: "week";
|
|
376
|
+
month: "month";
|
|
377
|
+
quarter: "quarter";
|
|
378
|
+
year: "year";
|
|
379
|
+
}>;
|
|
380
|
+
series: z.ZodArray<z.ZodObject<{
|
|
381
|
+
key: z.ZodString;
|
|
382
|
+
label: z.ZodOptional<z.ZodString>;
|
|
383
|
+
points: z.ZodArray<z.ZodObject<{
|
|
384
|
+
ts: z.ZodDate;
|
|
385
|
+
value: z.ZodNumber;
|
|
386
|
+
label: z.ZodOptional<z.ZodString>;
|
|
387
|
+
}, z.core.$strip>>;
|
|
388
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
389
|
+
line: "line";
|
|
390
|
+
bar: "bar";
|
|
391
|
+
}>>;
|
|
392
|
+
axis: z.ZodOptional<z.ZodEnum<{
|
|
393
|
+
left: "left";
|
|
394
|
+
right: "right";
|
|
395
|
+
}>>;
|
|
396
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
397
|
+
}, z.core.$strip>>;
|
|
398
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
399
|
+
kind: z.ZodLiteral<"distribution">;
|
|
400
|
+
total: z.ZodNumber;
|
|
401
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
402
|
+
key: z.ZodString;
|
|
403
|
+
label: z.ZodString;
|
|
404
|
+
value: z.ZodNumber;
|
|
405
|
+
percent: z.ZodOptional<z.ZodNumber>;
|
|
406
|
+
}, z.core.$strip>>;
|
|
407
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
408
|
+
bar: "bar";
|
|
409
|
+
donut: "donut";
|
|
410
|
+
pie: "pie";
|
|
411
|
+
funnel: "funnel";
|
|
412
|
+
}>>;
|
|
413
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
414
|
+
kind: z.ZodLiteral<"table">;
|
|
415
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
416
|
+
key: z.ZodString;
|
|
417
|
+
label: z.ZodString;
|
|
418
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
419
|
+
string: "string";
|
|
420
|
+
number: "number";
|
|
421
|
+
boolean: "boolean";
|
|
422
|
+
date: "date";
|
|
423
|
+
}>>;
|
|
424
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
425
|
+
}, z.core.$strip>>;
|
|
426
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
427
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
428
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
429
|
+
kind: z.ZodLiteral<"leaderboard">;
|
|
430
|
+
items: z.ZodArray<z.ZodObject<{
|
|
431
|
+
rank: z.ZodNumber;
|
|
432
|
+
id: z.ZodString;
|
|
433
|
+
label: z.ZodString;
|
|
434
|
+
value: z.ZodNumber;
|
|
435
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
436
|
+
}, z.core.$strip>>;
|
|
437
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
438
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
439
|
+
kind: z.ZodLiteral<"pivot">;
|
|
440
|
+
rowDimension: z.ZodObject<{
|
|
441
|
+
key: z.ZodString;
|
|
442
|
+
label: z.ZodString;
|
|
443
|
+
}, z.core.$strip>;
|
|
444
|
+
columnDimension: z.ZodObject<{
|
|
445
|
+
key: z.ZodString;
|
|
446
|
+
label: z.ZodString;
|
|
447
|
+
}, z.core.$strip>;
|
|
448
|
+
rows: z.ZodArray<z.ZodString>;
|
|
449
|
+
columns: z.ZodArray<z.ZodString>;
|
|
450
|
+
values: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
451
|
+
cellTooltips: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
452
|
+
totals: z.ZodOptional<z.ZodObject<{
|
|
453
|
+
rowTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
454
|
+
columnTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
455
|
+
grandTotal: z.ZodOptional<z.ZodNumber>;
|
|
456
|
+
}, z.core.$strip>>;
|
|
457
|
+
}, z.core.$strip>], "kind">;
|
|
458
|
+
export type MetricOutput = z.infer<typeof MetricOutputSchema>;
|
|
459
|
+
export declare const OutputSchemaMap: {
|
|
460
|
+
readonly kpi: z.ZodObject<{
|
|
461
|
+
kind: z.ZodLiteral<"kpi">;
|
|
462
|
+
value: z.ZodNumber;
|
|
463
|
+
label: z.ZodOptional<z.ZodString>;
|
|
464
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
465
|
+
DKK: "DKK";
|
|
466
|
+
EUR: "EUR";
|
|
467
|
+
USD: "USD";
|
|
468
|
+
GBP: "GBP";
|
|
469
|
+
SEK: "SEK";
|
|
470
|
+
NOK: "NOK";
|
|
471
|
+
PERCENTAGE: "PERCENTAGE";
|
|
472
|
+
}>>;
|
|
473
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
474
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
475
|
+
trend: z.ZodOptional<z.ZodEnum<{
|
|
476
|
+
up: "up";
|
|
477
|
+
down: "down";
|
|
478
|
+
flat: "flat";
|
|
479
|
+
}>>;
|
|
480
|
+
}, z.core.$strip>;
|
|
481
|
+
readonly timeseries: z.ZodObject<{
|
|
482
|
+
kind: z.ZodLiteral<"timeseries">;
|
|
483
|
+
granularity: z.ZodEnum<{
|
|
484
|
+
hour: "hour";
|
|
485
|
+
day: "day";
|
|
486
|
+
week: "week";
|
|
487
|
+
month: "month";
|
|
488
|
+
quarter: "quarter";
|
|
489
|
+
year: "year";
|
|
490
|
+
}>;
|
|
491
|
+
series: z.ZodArray<z.ZodObject<{
|
|
492
|
+
key: z.ZodString;
|
|
493
|
+
label: z.ZodOptional<z.ZodString>;
|
|
494
|
+
points: z.ZodArray<z.ZodObject<{
|
|
495
|
+
ts: z.ZodDate;
|
|
496
|
+
value: z.ZodNumber;
|
|
497
|
+
label: z.ZodOptional<z.ZodString>;
|
|
498
|
+
}, z.core.$strip>>;
|
|
499
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
500
|
+
line: "line";
|
|
501
|
+
bar: "bar";
|
|
502
|
+
}>>;
|
|
503
|
+
axis: z.ZodOptional<z.ZodEnum<{
|
|
504
|
+
left: "left";
|
|
505
|
+
right: "right";
|
|
506
|
+
}>>;
|
|
507
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
508
|
+
}, z.core.$strip>>;
|
|
509
|
+
}, z.core.$strip>;
|
|
510
|
+
readonly distribution: z.ZodObject<{
|
|
511
|
+
kind: z.ZodLiteral<"distribution">;
|
|
512
|
+
total: z.ZodNumber;
|
|
513
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
514
|
+
key: z.ZodString;
|
|
515
|
+
label: z.ZodString;
|
|
516
|
+
value: z.ZodNumber;
|
|
517
|
+
percent: z.ZodOptional<z.ZodNumber>;
|
|
518
|
+
}, z.core.$strip>>;
|
|
519
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
520
|
+
bar: "bar";
|
|
521
|
+
donut: "donut";
|
|
522
|
+
pie: "pie";
|
|
523
|
+
funnel: "funnel";
|
|
524
|
+
}>>;
|
|
525
|
+
}, z.core.$strip>;
|
|
526
|
+
readonly table: z.ZodObject<{
|
|
527
|
+
kind: z.ZodLiteral<"table">;
|
|
528
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
529
|
+
key: z.ZodString;
|
|
530
|
+
label: z.ZodString;
|
|
531
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
532
|
+
string: "string";
|
|
533
|
+
number: "number";
|
|
534
|
+
boolean: "boolean";
|
|
535
|
+
date: "date";
|
|
536
|
+
}>>;
|
|
537
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
538
|
+
}, z.core.$strip>>;
|
|
539
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
540
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
541
|
+
}, z.core.$strip>;
|
|
542
|
+
readonly leaderboard: z.ZodObject<{
|
|
543
|
+
kind: z.ZodLiteral<"leaderboard">;
|
|
544
|
+
items: z.ZodArray<z.ZodObject<{
|
|
545
|
+
rank: z.ZodNumber;
|
|
546
|
+
id: z.ZodString;
|
|
547
|
+
label: z.ZodString;
|
|
548
|
+
value: z.ZodNumber;
|
|
549
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
550
|
+
}, z.core.$strip>>;
|
|
551
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
552
|
+
}, z.core.$strip>;
|
|
553
|
+
readonly pivot: z.ZodObject<{
|
|
554
|
+
kind: z.ZodLiteral<"pivot">;
|
|
555
|
+
rowDimension: z.ZodObject<{
|
|
556
|
+
key: z.ZodString;
|
|
557
|
+
label: z.ZodString;
|
|
558
|
+
}, z.core.$strip>;
|
|
559
|
+
columnDimension: z.ZodObject<{
|
|
560
|
+
key: z.ZodString;
|
|
561
|
+
label: z.ZodString;
|
|
562
|
+
}, z.core.$strip>;
|
|
563
|
+
rows: z.ZodArray<z.ZodString>;
|
|
564
|
+
columns: z.ZodArray<z.ZodString>;
|
|
565
|
+
values: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
566
|
+
cellTooltips: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
567
|
+
totals: z.ZodOptional<z.ZodObject<{
|
|
568
|
+
rowTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
569
|
+
columnTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
570
|
+
grandTotal: z.ZodOptional<z.ZodNumber>;
|
|
571
|
+
}, z.core.$strip>>;
|
|
572
|
+
}, z.core.$strip>;
|
|
573
|
+
};
|
|
574
|
+
export type OutputSchemaForKind<K extends OutputKind> = (typeof OutputSchemaMap)[K];
|
|
575
|
+
export declare const MetricExecutionCacheStatusSchema: z.ZodEnum<{
|
|
576
|
+
hit: "hit";
|
|
577
|
+
partialHit: "partialHit";
|
|
578
|
+
miss: "miss";
|
|
579
|
+
bypassed: "bypassed";
|
|
580
|
+
}>;
|
|
581
|
+
export type MetricExecutionCacheStatus = z.infer<typeof MetricExecutionCacheStatusSchema>;
|
|
582
|
+
export declare const MetricExecutionSchema: z.ZodObject<{
|
|
583
|
+
cacheStatus: z.ZodEnum<{
|
|
584
|
+
hit: "hit";
|
|
585
|
+
partialHit: "partialHit";
|
|
586
|
+
miss: "miss";
|
|
587
|
+
bypassed: "bypassed";
|
|
588
|
+
}>;
|
|
589
|
+
durationMs: z.ZodNumber;
|
|
590
|
+
granularity: z.ZodOptional<z.ZodEnum<{
|
|
591
|
+
hour: "hour";
|
|
592
|
+
day: "day";
|
|
593
|
+
week: "week";
|
|
594
|
+
month: "month";
|
|
595
|
+
quarter: "quarter";
|
|
596
|
+
year: "year";
|
|
597
|
+
}>>;
|
|
598
|
+
}, z.core.$strip>;
|
|
599
|
+
export type MetricExecution = z.infer<typeof MetricExecutionSchema>;
|
|
600
|
+
export declare const MetricResultSchema: z.ZodObject<{
|
|
601
|
+
current: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
602
|
+
kind: z.ZodLiteral<"kpi">;
|
|
603
|
+
value: z.ZodNumber;
|
|
604
|
+
label: z.ZodOptional<z.ZodString>;
|
|
605
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
606
|
+
DKK: "DKK";
|
|
607
|
+
EUR: "EUR";
|
|
608
|
+
USD: "USD";
|
|
609
|
+
GBP: "GBP";
|
|
610
|
+
SEK: "SEK";
|
|
611
|
+
NOK: "NOK";
|
|
612
|
+
PERCENTAGE: "PERCENTAGE";
|
|
613
|
+
}>>;
|
|
614
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
615
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
616
|
+
trend: z.ZodOptional<z.ZodEnum<{
|
|
617
|
+
up: "up";
|
|
618
|
+
down: "down";
|
|
619
|
+
flat: "flat";
|
|
620
|
+
}>>;
|
|
621
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
622
|
+
kind: z.ZodLiteral<"timeseries">;
|
|
623
|
+
granularity: z.ZodEnum<{
|
|
624
|
+
hour: "hour";
|
|
625
|
+
day: "day";
|
|
626
|
+
week: "week";
|
|
627
|
+
month: "month";
|
|
628
|
+
quarter: "quarter";
|
|
629
|
+
year: "year";
|
|
630
|
+
}>;
|
|
631
|
+
series: z.ZodArray<z.ZodObject<{
|
|
632
|
+
key: z.ZodString;
|
|
633
|
+
label: z.ZodOptional<z.ZodString>;
|
|
634
|
+
points: z.ZodArray<z.ZodObject<{
|
|
635
|
+
ts: z.ZodDate;
|
|
636
|
+
value: z.ZodNumber;
|
|
637
|
+
label: z.ZodOptional<z.ZodString>;
|
|
638
|
+
}, z.core.$strip>>;
|
|
639
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
640
|
+
line: "line";
|
|
641
|
+
bar: "bar";
|
|
642
|
+
}>>;
|
|
643
|
+
axis: z.ZodOptional<z.ZodEnum<{
|
|
644
|
+
left: "left";
|
|
645
|
+
right: "right";
|
|
646
|
+
}>>;
|
|
647
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
648
|
+
}, z.core.$strip>>;
|
|
649
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
650
|
+
kind: z.ZodLiteral<"distribution">;
|
|
651
|
+
total: z.ZodNumber;
|
|
652
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
653
|
+
key: z.ZodString;
|
|
654
|
+
label: z.ZodString;
|
|
655
|
+
value: z.ZodNumber;
|
|
656
|
+
percent: z.ZodOptional<z.ZodNumber>;
|
|
657
|
+
}, z.core.$strip>>;
|
|
658
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
659
|
+
bar: "bar";
|
|
660
|
+
donut: "donut";
|
|
661
|
+
pie: "pie";
|
|
662
|
+
funnel: "funnel";
|
|
663
|
+
}>>;
|
|
664
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
665
|
+
kind: z.ZodLiteral<"table">;
|
|
666
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
667
|
+
key: z.ZodString;
|
|
668
|
+
label: z.ZodString;
|
|
669
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
670
|
+
string: "string";
|
|
671
|
+
number: "number";
|
|
672
|
+
boolean: "boolean";
|
|
673
|
+
date: "date";
|
|
674
|
+
}>>;
|
|
675
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
676
|
+
}, z.core.$strip>>;
|
|
677
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
678
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
679
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
680
|
+
kind: z.ZodLiteral<"leaderboard">;
|
|
681
|
+
items: z.ZodArray<z.ZodObject<{
|
|
682
|
+
rank: z.ZodNumber;
|
|
683
|
+
id: z.ZodString;
|
|
684
|
+
label: z.ZodString;
|
|
685
|
+
value: z.ZodNumber;
|
|
686
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
687
|
+
}, z.core.$strip>>;
|
|
688
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
689
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
690
|
+
kind: z.ZodLiteral<"pivot">;
|
|
691
|
+
rowDimension: z.ZodObject<{
|
|
692
|
+
key: z.ZodString;
|
|
693
|
+
label: z.ZodString;
|
|
694
|
+
}, z.core.$strip>;
|
|
695
|
+
columnDimension: z.ZodObject<{
|
|
696
|
+
key: z.ZodString;
|
|
697
|
+
label: z.ZodString;
|
|
698
|
+
}, z.core.$strip>;
|
|
699
|
+
rows: z.ZodArray<z.ZodString>;
|
|
700
|
+
columns: z.ZodArray<z.ZodString>;
|
|
701
|
+
values: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
702
|
+
cellTooltips: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
703
|
+
totals: z.ZodOptional<z.ZodObject<{
|
|
704
|
+
rowTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
705
|
+
columnTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
706
|
+
grandTotal: z.ZodOptional<z.ZodNumber>;
|
|
707
|
+
}, z.core.$strip>>;
|
|
708
|
+
}, z.core.$strip>], "kind">;
|
|
709
|
+
previous: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
710
|
+
kind: z.ZodLiteral<"kpi">;
|
|
711
|
+
value: z.ZodNumber;
|
|
712
|
+
label: z.ZodOptional<z.ZodString>;
|
|
713
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
714
|
+
DKK: "DKK";
|
|
715
|
+
EUR: "EUR";
|
|
716
|
+
USD: "USD";
|
|
717
|
+
GBP: "GBP";
|
|
718
|
+
SEK: "SEK";
|
|
719
|
+
NOK: "NOK";
|
|
720
|
+
PERCENTAGE: "PERCENTAGE";
|
|
721
|
+
}>>;
|
|
722
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
723
|
+
suffix: z.ZodOptional<z.ZodString>;
|
|
724
|
+
trend: z.ZodOptional<z.ZodEnum<{
|
|
725
|
+
up: "up";
|
|
726
|
+
down: "down";
|
|
727
|
+
flat: "flat";
|
|
728
|
+
}>>;
|
|
729
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
730
|
+
kind: z.ZodLiteral<"timeseries">;
|
|
731
|
+
granularity: z.ZodEnum<{
|
|
732
|
+
hour: "hour";
|
|
733
|
+
day: "day";
|
|
734
|
+
week: "week";
|
|
735
|
+
month: "month";
|
|
736
|
+
quarter: "quarter";
|
|
737
|
+
year: "year";
|
|
738
|
+
}>;
|
|
739
|
+
series: z.ZodArray<z.ZodObject<{
|
|
740
|
+
key: z.ZodString;
|
|
741
|
+
label: z.ZodOptional<z.ZodString>;
|
|
742
|
+
points: z.ZodArray<z.ZodObject<{
|
|
743
|
+
ts: z.ZodDate;
|
|
744
|
+
value: z.ZodNumber;
|
|
745
|
+
label: z.ZodOptional<z.ZodString>;
|
|
746
|
+
}, z.core.$strip>>;
|
|
747
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
748
|
+
line: "line";
|
|
749
|
+
bar: "bar";
|
|
750
|
+
}>>;
|
|
751
|
+
axis: z.ZodOptional<z.ZodEnum<{
|
|
752
|
+
left: "left";
|
|
753
|
+
right: "right";
|
|
754
|
+
}>>;
|
|
755
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
756
|
+
}, z.core.$strip>>;
|
|
757
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
758
|
+
kind: z.ZodLiteral<"distribution">;
|
|
759
|
+
total: z.ZodNumber;
|
|
760
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
761
|
+
key: z.ZodString;
|
|
762
|
+
label: z.ZodString;
|
|
763
|
+
value: z.ZodNumber;
|
|
764
|
+
percent: z.ZodOptional<z.ZodNumber>;
|
|
765
|
+
}, z.core.$strip>>;
|
|
766
|
+
chartType: z.ZodOptional<z.ZodEnum<{
|
|
767
|
+
bar: "bar";
|
|
768
|
+
donut: "donut";
|
|
769
|
+
pie: "pie";
|
|
770
|
+
funnel: "funnel";
|
|
771
|
+
}>>;
|
|
772
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
773
|
+
kind: z.ZodLiteral<"table">;
|
|
774
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
775
|
+
key: z.ZodString;
|
|
776
|
+
label: z.ZodString;
|
|
777
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
778
|
+
string: "string";
|
|
779
|
+
number: "number";
|
|
780
|
+
boolean: "boolean";
|
|
781
|
+
date: "date";
|
|
782
|
+
}>>;
|
|
783
|
+
nullable: z.ZodOptional<z.ZodBoolean>;
|
|
784
|
+
}, z.core.$strip>>;
|
|
785
|
+
rows: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
786
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
787
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
788
|
+
kind: z.ZodLiteral<"leaderboard">;
|
|
789
|
+
items: z.ZodArray<z.ZodObject<{
|
|
790
|
+
rank: z.ZodNumber;
|
|
791
|
+
id: z.ZodString;
|
|
792
|
+
label: z.ZodString;
|
|
793
|
+
value: z.ZodNumber;
|
|
794
|
+
meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
795
|
+
}, z.core.$strip>>;
|
|
796
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
797
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
798
|
+
kind: z.ZodLiteral<"pivot">;
|
|
799
|
+
rowDimension: z.ZodObject<{
|
|
800
|
+
key: z.ZodString;
|
|
801
|
+
label: z.ZodString;
|
|
802
|
+
}, z.core.$strip>;
|
|
803
|
+
columnDimension: z.ZodObject<{
|
|
804
|
+
key: z.ZodString;
|
|
805
|
+
label: z.ZodString;
|
|
806
|
+
}, z.core.$strip>;
|
|
807
|
+
rows: z.ZodArray<z.ZodString>;
|
|
808
|
+
columns: z.ZodArray<z.ZodString>;
|
|
809
|
+
values: z.ZodArray<z.ZodArray<z.ZodNumber>>;
|
|
810
|
+
cellTooltips: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodString>>>;
|
|
811
|
+
totals: z.ZodOptional<z.ZodObject<{
|
|
812
|
+
rowTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
813
|
+
columnTotals: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
814
|
+
grandTotal: z.ZodOptional<z.ZodNumber>;
|
|
815
|
+
}, z.core.$strip>>;
|
|
816
|
+
}, z.core.$strip>], "kind">>;
|
|
817
|
+
supportsTimeRange: z.ZodBoolean;
|
|
818
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
819
|
+
cacheStatus: z.ZodEnum<{
|
|
820
|
+
hit: "hit";
|
|
821
|
+
partialHit: "partialHit";
|
|
822
|
+
miss: "miss";
|
|
823
|
+
bypassed: "bypassed";
|
|
824
|
+
}>;
|
|
825
|
+
durationMs: z.ZodNumber;
|
|
826
|
+
granularity: z.ZodOptional<z.ZodEnum<{
|
|
827
|
+
hour: "hour";
|
|
828
|
+
day: "day";
|
|
829
|
+
week: "week";
|
|
830
|
+
month: "month";
|
|
831
|
+
quarter: "quarter";
|
|
832
|
+
year: "year";
|
|
833
|
+
}>>;
|
|
834
|
+
}, z.core.$strip>>;
|
|
835
|
+
}, z.core.$strip>;
|
|
836
|
+
export interface MetricResult<TOutput = unknown> {
|
|
837
|
+
current: TOutput;
|
|
838
|
+
previous: TOutput | undefined;
|
|
839
|
+
supportsTimeRange: boolean;
|
|
840
|
+
execution?: MetricExecution;
|
|
841
|
+
}
|
|
842
|
+
export {};
|