@rawdash/core 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/dist/index.d.ts CHANGED
@@ -1,192 +1,7 @@
1
+ import { E as Event, M as Metric, D as Distribution, S as StorageHandle, C as Connector, a as ServerStorage, W as WidgetEntry, b as SyncState } from './server-storage-BGSLkDoF.js';
2
+ export { B as BaseConnector, c as CredentialEntry, d as CredentialSchema, e as DistributionQuery, f as Edge, g as EdgeQuery, h as Entity, i as EntityQuery, j as EnvSecretsResolver, k as EventQuery, I as InferCredentialInput, l as InferCredentials, J as JSONValue, m as MetricQuery, n as SecretRef, o as SecretsResolver, p as SyncRequest, q as defineConnector, r as isSecretRef, s as resolveSecretRefs, t as secret } from './server-storage-BGSLkDoF.js';
1
3
  import { z } from 'zod';
2
4
 
3
- type SecretRef = {
4
- $secret: string;
5
- };
6
- declare function secret(name: string): SecretRef;
7
- declare function isSecretRef(value: unknown): value is SecretRef;
8
- interface SecretsResolver {
9
- resolve(name: string): string | undefined;
10
- }
11
- declare class EnvSecretsResolver implements SecretsResolver {
12
- resolve(name: string): string | undefined;
13
- }
14
- declare function resolveSecretRefs<T>(obj: T, resolver: SecretsResolver): T;
15
-
16
- type JSONValue = string | number | boolean | null | JSONValue[] | {
17
- [key: string]: JSONValue;
18
- };
19
- interface Event {
20
- name: string;
21
- start_ts: number;
22
- end_ts: number | null;
23
- attributes: Record<string, JSONValue>;
24
- }
25
- interface Entity {
26
- type: string;
27
- id: string;
28
- attributes: Record<string, JSONValue>;
29
- updated_at: number;
30
- }
31
- interface Metric {
32
- name: string;
33
- ts: number;
34
- value: number;
35
- attributes: Record<string, JSONValue>;
36
- }
37
- interface Edge {
38
- from_type: string;
39
- from_id: string;
40
- kind: string;
41
- to_type: string;
42
- to_id: string;
43
- attributes: Record<string, JSONValue>;
44
- updated_at: number;
45
- }
46
- type Distribution = {
47
- name: string;
48
- ts: number;
49
- kind: 'histogram';
50
- data: {
51
- buckets: Array<{
52
- le: number;
53
- count: number;
54
- }>;
55
- count: number;
56
- sum: number;
57
- };
58
- attributes: Record<string, JSONValue>;
59
- } | {
60
- name: string;
61
- ts: number;
62
- kind: 'summary';
63
- data: {
64
- quantiles: Array<{
65
- q: number;
66
- value: number;
67
- }>;
68
- count: number;
69
- sum: number;
70
- };
71
- attributes: Record<string, JSONValue>;
72
- };
73
- interface EventQuery {
74
- name?: string;
75
- start?: number;
76
- end?: number;
77
- }
78
- interface EntityQuery {
79
- type: string;
80
- }
81
- interface MetricQuery {
82
- name?: string;
83
- start?: number;
84
- end?: number;
85
- }
86
- interface EdgeQuery {
87
- fromType?: string;
88
- fromId?: string;
89
- kind?: string;
90
- toType?: string;
91
- toId?: string;
92
- }
93
- interface DistributionQuery {
94
- name?: string;
95
- start?: number;
96
- end?: number;
97
- }
98
- interface StorageHandle {
99
- event(e: Event): Promise<void>;
100
- entity(e: Entity): Promise<void>;
101
- metric(m: Metric): Promise<void>;
102
- edge(e: Edge): Promise<void>;
103
- distribution(d: Distribution): Promise<void>;
104
- events(es: Event[], scope?: {
105
- names?: string[];
106
- }): Promise<void>;
107
- entities(es: Entity[], scope?: {
108
- types?: string[];
109
- }): Promise<void>;
110
- metrics(ms: Metric[], scope?: {
111
- names?: string[];
112
- }): Promise<void>;
113
- edges(es: Edge[], scope?: {
114
- kinds?: string[];
115
- }): Promise<void>;
116
- distributions(ds: Distribution[], scope?: {
117
- names?: string[];
118
- }): Promise<void>;
119
- queryEvents(q: EventQuery): Promise<Event[]>;
120
- getEntity(type: string, id: string): Promise<Entity | null>;
121
- queryEntities(q: EntityQuery): Promise<Entity[]>;
122
- queryMetrics(q: MetricQuery): Promise<Metric[]>;
123
- traverse(q: EdgeQuery): Promise<Edge[]>;
124
- queryDistributions(q: DistributionQuery): Promise<Distribution[]>;
125
- deleteOlderThan(shape: 'events' | 'metrics' | 'distributions', tsUnixMs: number): Promise<{
126
- rowsDeleted: number;
127
- }>;
128
- }
129
- interface CredentialEntry {
130
- description: string;
131
- auth?: 'none' | 'optional' | 'required';
132
- }
133
- type CredentialSchema = Record<string, CredentialEntry>;
134
- type InferCredentials<TCreds extends CredentialSchema> = {
135
- [K in keyof TCreds]: TCreds[K] extends {
136
- auth: 'required';
137
- } ? string : string | undefined;
138
- };
139
- type InferCredentialInput<TCreds extends CredentialSchema> = {
140
- [K in keyof TCreds]: TCreds[K] extends {
141
- auth: 'required';
142
- } ? string | SecretRef : string | SecretRef | undefined;
143
- };
144
- interface SyncRequest {
145
- mode: 'full' | 'latest';
146
- since?: string;
147
- }
148
- interface Connector {
149
- readonly id: string;
150
- readonly credentials?: CredentialSchema;
151
- serializeConfig(): Record<string, unknown>;
152
- sync(request: SyncRequest, storage: StorageHandle, signal?: AbortSignal): Promise<void>;
153
- }
154
- interface RetryOptions {
155
- maxAttempts?: number;
156
- initialDelayMs?: number;
157
- maxDelayMs?: number;
158
- signal?: AbortSignal;
159
- }
160
- declare abstract class BaseConnector<TSettings = unknown, TCreds extends CredentialSchema = CredentialSchema> implements Connector {
161
- abstract readonly id: string;
162
- readonly credentials?: TCreds;
163
- protected settings: TSettings;
164
- protected creds: InferCredentials<TCreds>;
165
- private rawCredInput;
166
- constructor(settings: TSettings, creds?: InferCredentialInput<TCreds>);
167
- serializeConfig(): Record<string, unknown>;
168
- protected sleep(ms: number, signal?: AbortSignal): Promise<void>;
169
- protected withRetry<T>(fn: (signal?: AbortSignal) => Promise<{
170
- status: 'done';
171
- value: T;
172
- } | {
173
- status: 'retry';
174
- }>, options?: RetryOptions): Promise<T | null>;
175
- abstract sync(request: SyncRequest, storage: StorageHandle, signal?: AbortSignal): Promise<void>;
176
- }
177
- declare function defineConnector<TSettings>(): <TCreds extends CredentialSchema = Record<string, never>>(def: {
178
- id: string;
179
- credentials?: TCreds;
180
- sync: (this: {
181
- settings: TSettings;
182
- creds: InferCredentials<TCreds>;
183
- }, request: SyncRequest, storage: StorageHandle, signal?: AbortSignal) => Promise<void>;
184
- }) => {
185
- new (settings: TSettings, creds?: InferCredentialInput<TCreds>): Connector;
186
- readonly id: string;
187
- readonly credentials: TCreds | undefined;
188
- };
189
-
190
5
  interface RetentionConfig {
191
6
  maxAge?: number;
192
7
  maxSize?: number;
@@ -201,10 +16,408 @@ interface RetentionCandidates {
201
16
  declare function selectForDeletion<T>(rows: T[], getTs: (row: T) => number, config: RetentionConfig, nowMs?: number): T[];
202
17
  declare function computeRetention(handle: StorageHandle, config: RetentionConfig, nowMs?: number): Promise<RetentionCandidates>;
203
18
 
19
+ declare const shapeSchema: z.ZodEnum<{
20
+ event: "event";
21
+ entity: "entity";
22
+ metric: "metric";
23
+ edge: "edge";
24
+ distribution: "distribution";
25
+ }>;
26
+ declare const aggFnSchema: z.ZodEnum<{
27
+ latest: "latest";
28
+ count: "count";
29
+ sum: "sum";
30
+ avg: "avg";
31
+ min: "min";
32
+ max: "max";
33
+ first: "first";
34
+ }>;
35
+ declare const filterOperatorSchema: z.ZodEnum<{
36
+ eq: "eq";
37
+ neq: "neq";
38
+ gt: "gt";
39
+ gte: "gte";
40
+ lt: "lt";
41
+ lte: "lte";
42
+ contains: "contains";
43
+ }>;
44
+ declare const filterConditionSchema: z.ZodObject<{
45
+ field: z.ZodString;
46
+ op: z.ZodEnum<{
47
+ eq: "eq";
48
+ neq: "neq";
49
+ gt: "gt";
50
+ gte: "gte";
51
+ lt: "lt";
52
+ lte: "lte";
53
+ contains: "contains";
54
+ }>;
55
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
56
+ }, z.core.$strip>;
57
+ declare const filterClauseSchema: z.ZodUnion<readonly [z.ZodObject<{
58
+ field: z.ZodString;
59
+ op: z.ZodEnum<{
60
+ eq: "eq";
61
+ neq: "neq";
62
+ gt: "gt";
63
+ gte: "gte";
64
+ lt: "lt";
65
+ lte: "lte";
66
+ contains: "contains";
67
+ }>;
68
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
69
+ }, z.core.$strip>, z.ZodObject<{
70
+ or: z.ZodArray<z.ZodObject<{
71
+ field: z.ZodString;
72
+ op: z.ZodEnum<{
73
+ eq: "eq";
74
+ neq: "neq";
75
+ gt: "gt";
76
+ gte: "gte";
77
+ lt: "lt";
78
+ lte: "lte";
79
+ contains: "contains";
80
+ }>;
81
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
82
+ }, z.core.$strip>>;
83
+ }, z.core.$strip>]>;
84
+ declare const groupBySchema: z.ZodObject<{
85
+ field: z.ZodString;
86
+ granularity: z.ZodEnum<{
87
+ hour: "hour";
88
+ day: "day";
89
+ week: "week";
90
+ month: "month";
91
+ }>;
92
+ }, z.core.$strip>;
93
+ declare const resolvedMetricSchema: z.ZodObject<{
94
+ connectorId: z.ZodString;
95
+ shape: z.ZodEnum<{
96
+ event: "event";
97
+ entity: "entity";
98
+ metric: "metric";
99
+ edge: "edge";
100
+ distribution: "distribution";
101
+ }>;
102
+ name: z.ZodOptional<z.ZodString>;
103
+ entityType: z.ZodOptional<z.ZodString>;
104
+ field: z.ZodOptional<z.ZodString>;
105
+ fn: z.ZodEnum<{
106
+ latest: "latest";
107
+ count: "count";
108
+ sum: "sum";
109
+ avg: "avg";
110
+ min: "min";
111
+ max: "max";
112
+ first: "first";
113
+ }>;
114
+ window: z.ZodOptional<z.ZodString>;
115
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
116
+ field: z.ZodString;
117
+ op: z.ZodEnum<{
118
+ eq: "eq";
119
+ neq: "neq";
120
+ gt: "gt";
121
+ gte: "gte";
122
+ lt: "lt";
123
+ lte: "lte";
124
+ contains: "contains";
125
+ }>;
126
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
127
+ }, z.core.$strip>, z.ZodObject<{
128
+ or: z.ZodArray<z.ZodObject<{
129
+ field: z.ZodString;
130
+ op: z.ZodEnum<{
131
+ eq: "eq";
132
+ neq: "neq";
133
+ gt: "gt";
134
+ gte: "gte";
135
+ lt: "lt";
136
+ lte: "lte";
137
+ contains: "contains";
138
+ }>;
139
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
140
+ }, z.core.$strip>>;
141
+ }, z.core.$strip>]>>>;
142
+ groupBy: z.ZodOptional<z.ZodObject<{
143
+ field: z.ZodString;
144
+ granularity: z.ZodEnum<{
145
+ hour: "hour";
146
+ day: "day";
147
+ week: "week";
148
+ month: "month";
149
+ }>;
150
+ }, z.core.$strip>>;
151
+ }, z.core.$strip>;
152
+ declare const statWidgetSchema: z.ZodObject<{
153
+ kind: z.ZodLiteral<"stat">;
154
+ title: z.ZodString;
155
+ metric: z.ZodObject<{
156
+ connectorId: z.ZodString;
157
+ shape: z.ZodEnum<{
158
+ event: "event";
159
+ entity: "entity";
160
+ metric: "metric";
161
+ edge: "edge";
162
+ distribution: "distribution";
163
+ }>;
164
+ name: z.ZodOptional<z.ZodString>;
165
+ entityType: z.ZodOptional<z.ZodString>;
166
+ field: z.ZodOptional<z.ZodString>;
167
+ fn: z.ZodEnum<{
168
+ latest: "latest";
169
+ count: "count";
170
+ sum: "sum";
171
+ avg: "avg";
172
+ min: "min";
173
+ max: "max";
174
+ first: "first";
175
+ }>;
176
+ window: z.ZodOptional<z.ZodString>;
177
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
178
+ field: z.ZodString;
179
+ op: z.ZodEnum<{
180
+ eq: "eq";
181
+ neq: "neq";
182
+ gt: "gt";
183
+ gte: "gte";
184
+ lt: "lt";
185
+ lte: "lte";
186
+ contains: "contains";
187
+ }>;
188
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ or: z.ZodArray<z.ZodObject<{
191
+ field: z.ZodString;
192
+ op: z.ZodEnum<{
193
+ eq: "eq";
194
+ neq: "neq";
195
+ gt: "gt";
196
+ gte: "gte";
197
+ lt: "lt";
198
+ lte: "lte";
199
+ contains: "contains";
200
+ }>;
201
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
202
+ }, z.core.$strip>>;
203
+ }, z.core.$strip>]>>>;
204
+ groupBy: z.ZodOptional<z.ZodObject<{
205
+ field: z.ZodString;
206
+ granularity: z.ZodEnum<{
207
+ hour: "hour";
208
+ day: "day";
209
+ week: "week";
210
+ month: "month";
211
+ }>;
212
+ }, z.core.$strip>>;
213
+ }, z.core.$strip>;
214
+ window: z.ZodOptional<z.ZodString>;
215
+ compare: z.ZodDefault<z.ZodEnum<{
216
+ none: "none";
217
+ "previous-period": "previous-period";
218
+ }>>;
219
+ }, z.core.$strip>;
220
+ declare const statusWidgetSchema: z.ZodObject<{
221
+ kind: z.ZodLiteral<"status">;
222
+ title: z.ZodString;
223
+ source: z.ZodString;
224
+ }, z.core.$strip>;
225
+ declare const timeseriesWidgetSchema: z.ZodObject<{
226
+ kind: z.ZodLiteral<"timeseries">;
227
+ title: z.ZodString;
228
+ metric: z.ZodObject<{
229
+ connectorId: z.ZodString;
230
+ shape: z.ZodEnum<{
231
+ event: "event";
232
+ entity: "entity";
233
+ metric: "metric";
234
+ edge: "edge";
235
+ distribution: "distribution";
236
+ }>;
237
+ name: z.ZodOptional<z.ZodString>;
238
+ entityType: z.ZodOptional<z.ZodString>;
239
+ field: z.ZodOptional<z.ZodString>;
240
+ fn: z.ZodEnum<{
241
+ latest: "latest";
242
+ count: "count";
243
+ sum: "sum";
244
+ avg: "avg";
245
+ min: "min";
246
+ max: "max";
247
+ first: "first";
248
+ }>;
249
+ window: z.ZodOptional<z.ZodString>;
250
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
251
+ field: z.ZodString;
252
+ op: z.ZodEnum<{
253
+ eq: "eq";
254
+ neq: "neq";
255
+ gt: "gt";
256
+ gte: "gte";
257
+ lt: "lt";
258
+ lte: "lte";
259
+ contains: "contains";
260
+ }>;
261
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
262
+ }, z.core.$strip>, z.ZodObject<{
263
+ or: z.ZodArray<z.ZodObject<{
264
+ field: z.ZodString;
265
+ op: z.ZodEnum<{
266
+ eq: "eq";
267
+ neq: "neq";
268
+ gt: "gt";
269
+ gte: "gte";
270
+ lt: "lt";
271
+ lte: "lte";
272
+ contains: "contains";
273
+ }>;
274
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
275
+ }, z.core.$strip>>;
276
+ }, z.core.$strip>]>>>;
277
+ groupBy: z.ZodOptional<z.ZodObject<{
278
+ field: z.ZodString;
279
+ granularity: z.ZodEnum<{
280
+ hour: "hour";
281
+ day: "day";
282
+ week: "week";
283
+ month: "month";
284
+ }>;
285
+ }, z.core.$strip>>;
286
+ }, z.core.$strip>;
287
+ window: z.ZodString;
288
+ granularity: z.ZodDefault<z.ZodEnum<{
289
+ hour: "hour";
290
+ day: "day";
291
+ week: "week";
292
+ }>>;
293
+ }, z.core.$strip>;
294
+ declare const distributionWidgetSchema: z.ZodObject<{
295
+ kind: z.ZodLiteral<"distribution">;
296
+ title: z.ZodString;
297
+ metric: z.ZodObject<{
298
+ connectorId: z.ZodString;
299
+ shape: z.ZodEnum<{
300
+ event: "event";
301
+ entity: "entity";
302
+ metric: "metric";
303
+ edge: "edge";
304
+ distribution: "distribution";
305
+ }>;
306
+ name: z.ZodOptional<z.ZodString>;
307
+ entityType: z.ZodOptional<z.ZodString>;
308
+ field: z.ZodOptional<z.ZodString>;
309
+ fn: z.ZodEnum<{
310
+ latest: "latest";
311
+ count: "count";
312
+ sum: "sum";
313
+ avg: "avg";
314
+ min: "min";
315
+ max: "max";
316
+ first: "first";
317
+ }>;
318
+ window: z.ZodOptional<z.ZodString>;
319
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
320
+ field: z.ZodString;
321
+ op: z.ZodEnum<{
322
+ eq: "eq";
323
+ neq: "neq";
324
+ gt: "gt";
325
+ gte: "gte";
326
+ lt: "lt";
327
+ lte: "lte";
328
+ contains: "contains";
329
+ }>;
330
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
331
+ }, z.core.$strip>, z.ZodObject<{
332
+ or: z.ZodArray<z.ZodObject<{
333
+ field: z.ZodString;
334
+ op: z.ZodEnum<{
335
+ eq: "eq";
336
+ neq: "neq";
337
+ gt: "gt";
338
+ gte: "gte";
339
+ lt: "lt";
340
+ lte: "lte";
341
+ contains: "contains";
342
+ }>;
343
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
344
+ }, z.core.$strip>>;
345
+ }, z.core.$strip>]>>>;
346
+ groupBy: z.ZodOptional<z.ZodObject<{
347
+ field: z.ZodString;
348
+ granularity: z.ZodEnum<{
349
+ hour: "hour";
350
+ day: "day";
351
+ week: "week";
352
+ month: "month";
353
+ }>;
354
+ }, z.core.$strip>>;
355
+ }, z.core.$strip>;
356
+ window: z.ZodString;
357
+ }, z.core.$strip>;
204
358
  declare const widgetSchemas: {
205
359
  readonly stat: z.ZodObject<{
360
+ kind: z.ZodLiteral<"stat">;
206
361
  title: z.ZodString;
207
- metric: z.ZodString;
362
+ metric: z.ZodObject<{
363
+ connectorId: z.ZodString;
364
+ shape: z.ZodEnum<{
365
+ event: "event";
366
+ entity: "entity";
367
+ metric: "metric";
368
+ edge: "edge";
369
+ distribution: "distribution";
370
+ }>;
371
+ name: z.ZodOptional<z.ZodString>;
372
+ entityType: z.ZodOptional<z.ZodString>;
373
+ field: z.ZodOptional<z.ZodString>;
374
+ fn: z.ZodEnum<{
375
+ latest: "latest";
376
+ count: "count";
377
+ sum: "sum";
378
+ avg: "avg";
379
+ min: "min";
380
+ max: "max";
381
+ first: "first";
382
+ }>;
383
+ window: z.ZodOptional<z.ZodString>;
384
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
385
+ field: z.ZodString;
386
+ op: z.ZodEnum<{
387
+ eq: "eq";
388
+ neq: "neq";
389
+ gt: "gt";
390
+ gte: "gte";
391
+ lt: "lt";
392
+ lte: "lte";
393
+ contains: "contains";
394
+ }>;
395
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
396
+ }, z.core.$strip>, z.ZodObject<{
397
+ or: z.ZodArray<z.ZodObject<{
398
+ field: z.ZodString;
399
+ op: z.ZodEnum<{
400
+ eq: "eq";
401
+ neq: "neq";
402
+ gt: "gt";
403
+ gte: "gte";
404
+ lt: "lt";
405
+ lte: "lte";
406
+ contains: "contains";
407
+ }>;
408
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
409
+ }, z.core.$strip>>;
410
+ }, z.core.$strip>]>>>;
411
+ groupBy: z.ZodOptional<z.ZodObject<{
412
+ field: z.ZodString;
413
+ granularity: z.ZodEnum<{
414
+ hour: "hour";
415
+ day: "day";
416
+ week: "week";
417
+ month: "month";
418
+ }>;
419
+ }, z.core.$strip>>;
420
+ }, z.core.$strip>;
208
421
  window: z.ZodOptional<z.ZodString>;
209
422
  compare: z.ZodDefault<z.ZodEnum<{
210
423
  none: "none";
@@ -212,12 +425,72 @@ declare const widgetSchemas: {
212
425
  }>>;
213
426
  }, z.core.$strip>;
214
427
  readonly status: z.ZodObject<{
428
+ kind: z.ZodLiteral<"status">;
215
429
  title: z.ZodString;
216
430
  source: z.ZodString;
217
431
  }, z.core.$strip>;
218
432
  readonly timeseries: z.ZodObject<{
433
+ kind: z.ZodLiteral<"timeseries">;
219
434
  title: z.ZodString;
220
- metric: z.ZodString;
435
+ metric: z.ZodObject<{
436
+ connectorId: z.ZodString;
437
+ shape: z.ZodEnum<{
438
+ event: "event";
439
+ entity: "entity";
440
+ metric: "metric";
441
+ edge: "edge";
442
+ distribution: "distribution";
443
+ }>;
444
+ name: z.ZodOptional<z.ZodString>;
445
+ entityType: z.ZodOptional<z.ZodString>;
446
+ field: z.ZodOptional<z.ZodString>;
447
+ fn: z.ZodEnum<{
448
+ latest: "latest";
449
+ count: "count";
450
+ sum: "sum";
451
+ avg: "avg";
452
+ min: "min";
453
+ max: "max";
454
+ first: "first";
455
+ }>;
456
+ window: z.ZodOptional<z.ZodString>;
457
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
458
+ field: z.ZodString;
459
+ op: z.ZodEnum<{
460
+ eq: "eq";
461
+ neq: "neq";
462
+ gt: "gt";
463
+ gte: "gte";
464
+ lt: "lt";
465
+ lte: "lte";
466
+ contains: "contains";
467
+ }>;
468
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
469
+ }, z.core.$strip>, z.ZodObject<{
470
+ or: z.ZodArray<z.ZodObject<{
471
+ field: z.ZodString;
472
+ op: z.ZodEnum<{
473
+ eq: "eq";
474
+ neq: "neq";
475
+ gt: "gt";
476
+ gte: "gte";
477
+ lt: "lt";
478
+ lte: "lte";
479
+ contains: "contains";
480
+ }>;
481
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
482
+ }, z.core.$strip>>;
483
+ }, z.core.$strip>]>>>;
484
+ groupBy: z.ZodOptional<z.ZodObject<{
485
+ field: z.ZodString;
486
+ granularity: z.ZodEnum<{
487
+ hour: "hour";
488
+ day: "day";
489
+ week: "week";
490
+ month: "month";
491
+ }>;
492
+ }, z.core.$strip>>;
493
+ }, z.core.$strip>;
221
494
  window: z.ZodString;
222
495
  granularity: z.ZodDefault<z.ZodEnum<{
223
496
  hour: "hour";
@@ -226,26 +499,407 @@ declare const widgetSchemas: {
226
499
  }>>;
227
500
  }, z.core.$strip>;
228
501
  readonly distribution: z.ZodObject<{
502
+ kind: z.ZodLiteral<"distribution">;
229
503
  title: z.ZodString;
230
- metric: z.ZodString;
504
+ metric: z.ZodObject<{
505
+ connectorId: z.ZodString;
506
+ shape: z.ZodEnum<{
507
+ event: "event";
508
+ entity: "entity";
509
+ metric: "metric";
510
+ edge: "edge";
511
+ distribution: "distribution";
512
+ }>;
513
+ name: z.ZodOptional<z.ZodString>;
514
+ entityType: z.ZodOptional<z.ZodString>;
515
+ field: z.ZodOptional<z.ZodString>;
516
+ fn: z.ZodEnum<{
517
+ latest: "latest";
518
+ count: "count";
519
+ sum: "sum";
520
+ avg: "avg";
521
+ min: "min";
522
+ max: "max";
523
+ first: "first";
524
+ }>;
525
+ window: z.ZodOptional<z.ZodString>;
526
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
527
+ field: z.ZodString;
528
+ op: z.ZodEnum<{
529
+ eq: "eq";
530
+ neq: "neq";
531
+ gt: "gt";
532
+ gte: "gte";
533
+ lt: "lt";
534
+ lte: "lte";
535
+ contains: "contains";
536
+ }>;
537
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
538
+ }, z.core.$strip>, z.ZodObject<{
539
+ or: z.ZodArray<z.ZodObject<{
540
+ field: z.ZodString;
541
+ op: z.ZodEnum<{
542
+ eq: "eq";
543
+ neq: "neq";
544
+ gt: "gt";
545
+ gte: "gte";
546
+ lt: "lt";
547
+ lte: "lte";
548
+ contains: "contains";
549
+ }>;
550
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
551
+ }, z.core.$strip>>;
552
+ }, z.core.$strip>]>>>;
553
+ groupBy: z.ZodOptional<z.ZodObject<{
554
+ field: z.ZodString;
555
+ granularity: z.ZodEnum<{
556
+ hour: "hour";
557
+ day: "day";
558
+ week: "week";
559
+ month: "month";
560
+ }>;
561
+ }, z.core.$strip>>;
562
+ }, z.core.$strip>;
231
563
  window: z.ZodString;
232
564
  }, z.core.$strip>;
233
565
  };
566
+ declare const widgetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
567
+ kind: z.ZodLiteral<"stat">;
568
+ title: z.ZodString;
569
+ metric: z.ZodObject<{
570
+ connectorId: z.ZodString;
571
+ shape: z.ZodEnum<{
572
+ event: "event";
573
+ entity: "entity";
574
+ metric: "metric";
575
+ edge: "edge";
576
+ distribution: "distribution";
577
+ }>;
578
+ name: z.ZodOptional<z.ZodString>;
579
+ entityType: z.ZodOptional<z.ZodString>;
580
+ field: z.ZodOptional<z.ZodString>;
581
+ fn: z.ZodEnum<{
582
+ latest: "latest";
583
+ count: "count";
584
+ sum: "sum";
585
+ avg: "avg";
586
+ min: "min";
587
+ max: "max";
588
+ first: "first";
589
+ }>;
590
+ window: z.ZodOptional<z.ZodString>;
591
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
592
+ field: z.ZodString;
593
+ op: z.ZodEnum<{
594
+ eq: "eq";
595
+ neq: "neq";
596
+ gt: "gt";
597
+ gte: "gte";
598
+ lt: "lt";
599
+ lte: "lte";
600
+ contains: "contains";
601
+ }>;
602
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
603
+ }, z.core.$strip>, z.ZodObject<{
604
+ or: z.ZodArray<z.ZodObject<{
605
+ field: z.ZodString;
606
+ op: z.ZodEnum<{
607
+ eq: "eq";
608
+ neq: "neq";
609
+ gt: "gt";
610
+ gte: "gte";
611
+ lt: "lt";
612
+ lte: "lte";
613
+ contains: "contains";
614
+ }>;
615
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
616
+ }, z.core.$strip>>;
617
+ }, z.core.$strip>]>>>;
618
+ groupBy: z.ZodOptional<z.ZodObject<{
619
+ field: z.ZodString;
620
+ granularity: z.ZodEnum<{
621
+ hour: "hour";
622
+ day: "day";
623
+ week: "week";
624
+ month: "month";
625
+ }>;
626
+ }, z.core.$strip>>;
627
+ }, z.core.$strip>;
628
+ window: z.ZodOptional<z.ZodString>;
629
+ compare: z.ZodDefault<z.ZodEnum<{
630
+ none: "none";
631
+ "previous-period": "previous-period";
632
+ }>>;
633
+ }, z.core.$strip>, z.ZodObject<{
634
+ kind: z.ZodLiteral<"status">;
635
+ title: z.ZodString;
636
+ source: z.ZodString;
637
+ }, z.core.$strip>, z.ZodObject<{
638
+ kind: z.ZodLiteral<"timeseries">;
639
+ title: z.ZodString;
640
+ metric: z.ZodObject<{
641
+ connectorId: z.ZodString;
642
+ shape: z.ZodEnum<{
643
+ event: "event";
644
+ entity: "entity";
645
+ metric: "metric";
646
+ edge: "edge";
647
+ distribution: "distribution";
648
+ }>;
649
+ name: z.ZodOptional<z.ZodString>;
650
+ entityType: z.ZodOptional<z.ZodString>;
651
+ field: z.ZodOptional<z.ZodString>;
652
+ fn: z.ZodEnum<{
653
+ latest: "latest";
654
+ count: "count";
655
+ sum: "sum";
656
+ avg: "avg";
657
+ min: "min";
658
+ max: "max";
659
+ first: "first";
660
+ }>;
661
+ window: z.ZodOptional<z.ZodString>;
662
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
663
+ field: z.ZodString;
664
+ op: z.ZodEnum<{
665
+ eq: "eq";
666
+ neq: "neq";
667
+ gt: "gt";
668
+ gte: "gte";
669
+ lt: "lt";
670
+ lte: "lte";
671
+ contains: "contains";
672
+ }>;
673
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
674
+ }, z.core.$strip>, z.ZodObject<{
675
+ or: z.ZodArray<z.ZodObject<{
676
+ field: z.ZodString;
677
+ op: z.ZodEnum<{
678
+ eq: "eq";
679
+ neq: "neq";
680
+ gt: "gt";
681
+ gte: "gte";
682
+ lt: "lt";
683
+ lte: "lte";
684
+ contains: "contains";
685
+ }>;
686
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
687
+ }, z.core.$strip>>;
688
+ }, z.core.$strip>]>>>;
689
+ groupBy: z.ZodOptional<z.ZodObject<{
690
+ field: z.ZodString;
691
+ granularity: z.ZodEnum<{
692
+ hour: "hour";
693
+ day: "day";
694
+ week: "week";
695
+ month: "month";
696
+ }>;
697
+ }, z.core.$strip>>;
698
+ }, z.core.$strip>;
699
+ window: z.ZodString;
700
+ granularity: z.ZodDefault<z.ZodEnum<{
701
+ hour: "hour";
702
+ day: "day";
703
+ week: "week";
704
+ }>>;
705
+ }, z.core.$strip>, z.ZodObject<{
706
+ kind: z.ZodLiteral<"distribution">;
707
+ title: z.ZodString;
708
+ metric: z.ZodObject<{
709
+ connectorId: z.ZodString;
710
+ shape: z.ZodEnum<{
711
+ event: "event";
712
+ entity: "entity";
713
+ metric: "metric";
714
+ edge: "edge";
715
+ distribution: "distribution";
716
+ }>;
717
+ name: z.ZodOptional<z.ZodString>;
718
+ entityType: z.ZodOptional<z.ZodString>;
719
+ field: z.ZodOptional<z.ZodString>;
720
+ fn: z.ZodEnum<{
721
+ latest: "latest";
722
+ count: "count";
723
+ sum: "sum";
724
+ avg: "avg";
725
+ min: "min";
726
+ max: "max";
727
+ first: "first";
728
+ }>;
729
+ window: z.ZodOptional<z.ZodString>;
730
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
731
+ field: z.ZodString;
732
+ op: z.ZodEnum<{
733
+ eq: "eq";
734
+ neq: "neq";
735
+ gt: "gt";
736
+ gte: "gte";
737
+ lt: "lt";
738
+ lte: "lte";
739
+ contains: "contains";
740
+ }>;
741
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
742
+ }, z.core.$strip>, z.ZodObject<{
743
+ or: z.ZodArray<z.ZodObject<{
744
+ field: z.ZodString;
745
+ op: z.ZodEnum<{
746
+ eq: "eq";
747
+ neq: "neq";
748
+ gt: "gt";
749
+ gte: "gte";
750
+ lt: "lt";
751
+ lte: "lte";
752
+ contains: "contains";
753
+ }>;
754
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
755
+ }, z.core.$strip>>;
756
+ }, z.core.$strip>]>>>;
757
+ groupBy: z.ZodOptional<z.ZodObject<{
758
+ field: z.ZodString;
759
+ granularity: z.ZodEnum<{
760
+ hour: "hour";
761
+ day: "day";
762
+ week: "week";
763
+ month: "month";
764
+ }>;
765
+ }, z.core.$strip>>;
766
+ }, z.core.$strip>;
767
+ window: z.ZodString;
768
+ }, z.core.$strip>], "kind">;
234
769
  type WidgetKind = keyof typeof widgetSchemas;
235
770
  declare function getWidgetSchema(kind: WidgetKind): z.ZodObject<{
771
+ kind: z.ZodLiteral<"stat">;
236
772
  title: z.ZodString;
237
- metric: z.ZodString;
773
+ metric: z.ZodObject<{
774
+ connectorId: z.ZodString;
775
+ shape: z.ZodEnum<{
776
+ event: "event";
777
+ entity: "entity";
778
+ metric: "metric";
779
+ edge: "edge";
780
+ distribution: "distribution";
781
+ }>;
782
+ name: z.ZodOptional<z.ZodString>;
783
+ entityType: z.ZodOptional<z.ZodString>;
784
+ field: z.ZodOptional<z.ZodString>;
785
+ fn: z.ZodEnum<{
786
+ latest: "latest";
787
+ count: "count";
788
+ sum: "sum";
789
+ avg: "avg";
790
+ min: "min";
791
+ max: "max";
792
+ first: "first";
793
+ }>;
794
+ window: z.ZodOptional<z.ZodString>;
795
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
796
+ field: z.ZodString;
797
+ op: z.ZodEnum<{
798
+ eq: "eq";
799
+ neq: "neq";
800
+ gt: "gt";
801
+ gte: "gte";
802
+ lt: "lt";
803
+ lte: "lte";
804
+ contains: "contains";
805
+ }>;
806
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
807
+ }, z.core.$strip>, z.ZodObject<{
808
+ or: z.ZodArray<z.ZodObject<{
809
+ field: z.ZodString;
810
+ op: z.ZodEnum<{
811
+ eq: "eq";
812
+ neq: "neq";
813
+ gt: "gt";
814
+ gte: "gte";
815
+ lt: "lt";
816
+ lte: "lte";
817
+ contains: "contains";
818
+ }>;
819
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
820
+ }, z.core.$strip>>;
821
+ }, z.core.$strip>]>>>;
822
+ groupBy: z.ZodOptional<z.ZodObject<{
823
+ field: z.ZodString;
824
+ granularity: z.ZodEnum<{
825
+ hour: "hour";
826
+ day: "day";
827
+ week: "week";
828
+ month: "month";
829
+ }>;
830
+ }, z.core.$strip>>;
831
+ }, z.core.$strip>;
238
832
  window: z.ZodOptional<z.ZodString>;
239
833
  compare: z.ZodDefault<z.ZodEnum<{
240
834
  none: "none";
241
835
  "previous-period": "previous-period";
242
836
  }>>;
243
837
  }, z.core.$strip> | z.ZodObject<{
838
+ kind: z.ZodLiteral<"status">;
244
839
  title: z.ZodString;
245
840
  source: z.ZodString;
246
841
  }, z.core.$strip> | z.ZodObject<{
842
+ kind: z.ZodLiteral<"timeseries">;
247
843
  title: z.ZodString;
248
- metric: z.ZodString;
844
+ metric: z.ZodObject<{
845
+ connectorId: z.ZodString;
846
+ shape: z.ZodEnum<{
847
+ event: "event";
848
+ entity: "entity";
849
+ metric: "metric";
850
+ edge: "edge";
851
+ distribution: "distribution";
852
+ }>;
853
+ name: z.ZodOptional<z.ZodString>;
854
+ entityType: z.ZodOptional<z.ZodString>;
855
+ field: z.ZodOptional<z.ZodString>;
856
+ fn: z.ZodEnum<{
857
+ latest: "latest";
858
+ count: "count";
859
+ sum: "sum";
860
+ avg: "avg";
861
+ min: "min";
862
+ max: "max";
863
+ first: "first";
864
+ }>;
865
+ window: z.ZodOptional<z.ZodString>;
866
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
867
+ field: z.ZodString;
868
+ op: z.ZodEnum<{
869
+ eq: "eq";
870
+ neq: "neq";
871
+ gt: "gt";
872
+ gte: "gte";
873
+ lt: "lt";
874
+ lte: "lte";
875
+ contains: "contains";
876
+ }>;
877
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
878
+ }, z.core.$strip>, z.ZodObject<{
879
+ or: z.ZodArray<z.ZodObject<{
880
+ field: z.ZodString;
881
+ op: z.ZodEnum<{
882
+ eq: "eq";
883
+ neq: "neq";
884
+ gt: "gt";
885
+ gte: "gte";
886
+ lt: "lt";
887
+ lte: "lte";
888
+ contains: "contains";
889
+ }>;
890
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
891
+ }, z.core.$strip>>;
892
+ }, z.core.$strip>]>>>;
893
+ groupBy: z.ZodOptional<z.ZodObject<{
894
+ field: z.ZodString;
895
+ granularity: z.ZodEnum<{
896
+ hour: "hour";
897
+ day: "day";
898
+ week: "week";
899
+ month: "month";
900
+ }>;
901
+ }, z.core.$strip>>;
902
+ }, z.core.$strip>;
249
903
  window: z.ZodString;
250
904
  granularity: z.ZodDefault<z.ZodEnum<{
251
905
  hour: "hour";
@@ -253,8 +907,67 @@ declare function getWidgetSchema(kind: WidgetKind): z.ZodObject<{
253
907
  week: "week";
254
908
  }>>;
255
909
  }, z.core.$strip> | z.ZodObject<{
910
+ kind: z.ZodLiteral<"distribution">;
256
911
  title: z.ZodString;
257
- metric: z.ZodString;
912
+ metric: z.ZodObject<{
913
+ connectorId: z.ZodString;
914
+ shape: z.ZodEnum<{
915
+ event: "event";
916
+ entity: "entity";
917
+ metric: "metric";
918
+ edge: "edge";
919
+ distribution: "distribution";
920
+ }>;
921
+ name: z.ZodOptional<z.ZodString>;
922
+ entityType: z.ZodOptional<z.ZodString>;
923
+ field: z.ZodOptional<z.ZodString>;
924
+ fn: z.ZodEnum<{
925
+ latest: "latest";
926
+ count: "count";
927
+ sum: "sum";
928
+ avg: "avg";
929
+ min: "min";
930
+ max: "max";
931
+ first: "first";
932
+ }>;
933
+ window: z.ZodOptional<z.ZodString>;
934
+ filter: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
935
+ field: z.ZodString;
936
+ op: z.ZodEnum<{
937
+ eq: "eq";
938
+ neq: "neq";
939
+ gt: "gt";
940
+ gte: "gte";
941
+ lt: "lt";
942
+ lte: "lte";
943
+ contains: "contains";
944
+ }>;
945
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
946
+ }, z.core.$strip>, z.ZodObject<{
947
+ or: z.ZodArray<z.ZodObject<{
948
+ field: z.ZodString;
949
+ op: z.ZodEnum<{
950
+ eq: "eq";
951
+ neq: "neq";
952
+ gt: "gt";
953
+ gte: "gte";
954
+ lt: "lt";
955
+ lte: "lte";
956
+ contains: "contains";
957
+ }>;
958
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
959
+ }, z.core.$strip>>;
960
+ }, z.core.$strip>]>>>;
961
+ groupBy: z.ZodOptional<z.ZodObject<{
962
+ field: z.ZodString;
963
+ granularity: z.ZodEnum<{
964
+ hour: "hour";
965
+ day: "day";
966
+ week: "week";
967
+ month: "month";
968
+ }>;
969
+ }, z.core.$strip>>;
970
+ }, z.core.$strip>;
258
971
  window: z.ZodString;
259
972
  }, z.core.$strip>;
260
973
 
@@ -280,7 +993,7 @@ interface MetricDef {
280
993
  shape: Shape;
281
994
  name?: string;
282
995
  entityType?: string;
283
- field: string;
996
+ field?: string;
284
997
  fn: AggFn;
285
998
  window?: string;
286
999
  filter?: FilterClause[];
@@ -291,8 +1004,8 @@ interface ResolvedMetric {
291
1004
  readonly shape: Shape;
292
1005
  readonly name?: string;
293
1006
  readonly entityType?: string;
294
- readonly field: string;
295
- readonly fn: string;
1007
+ readonly field?: string;
1008
+ readonly fn: AggFn;
296
1009
  readonly window?: string;
297
1010
  readonly filter?: FilterClause[];
298
1011
  readonly groupBy?: GroupBy;
@@ -341,20 +1054,25 @@ declare function defineDashboard(options: {
341
1054
  declare function defineMetric(options: MetricDef): ResolvedMetric;
342
1055
  declare function defineConfig(config: DashboardConfig): DashboardConfig;
343
1056
 
344
- interface WidgetEntry {
345
- id: string;
346
- widgetId: string;
347
- connectorId: string;
348
- data: unknown;
349
- cachedAt: string | null;
350
- }
351
- interface SyncState {
352
- status: 'idle' | 'syncing' | 'error';
353
- lastSyncAt: string | null;
354
- lastError: string | null;
355
- }
356
-
357
1057
  type ConfigFieldsSchema = z.ZodObject<z.ZodRawShape>;
358
1058
  declare function defineConfigFields<T extends z.ZodRawShape>(schema: z.ZodObject<T>): z.ZodObject<T>;
359
1059
 
360
- export { type AggFn, BaseConnector, type ConfigFieldsSchema, type Connector, type ConnectorEntry, type CredentialEntry, type CredentialSchema, type Dashboard, type DashboardConfig, type Distribution, type DistributionQuery, type DistributionWidget, type Edge, type EdgeQuery, type Entity, type EntityQuery, EnvSecretsResolver, type Event, type EventQuery, type FilterClause, type FilterCondition, type FilterOperator, type GroupBy, type InferCredentialInput, type InferCredentials, type JSONValue, type Metric, type MetricDef, type MetricQuery, type ResolvedMetric, type RetentionCandidates, type RetentionConfig, type SecretRef, type SecretsResolver, type Shape, type StatWidget, type StatusWidget, type StorageHandle, type SyncRequest, type SyncState, type TimeseriesWidget, type Widget, type WidgetEntry, type WidgetKind, computeRetention, defineConfig, defineConfigFields, defineConnector, defineDashboard, defineMetric, getWidgetSchema, isSecretRef, resolveSecretRefs, secret, selectForDeletion, widgetSchemas };
1060
+ declare function computeMetric(storage: StorageHandle, metric: ResolvedMetric): Promise<unknown>;
1061
+
1062
+ declare function resolveWidget(id: string, widget: Widget, connectors: ConnectorEntry[] | readonly string[] | undefined, storage: ServerStorage): Promise<WidgetEntry | undefined>;
1063
+
1064
+ declare class InMemoryStorage implements ServerStorage {
1065
+ private eventStore;
1066
+ private entityStore;
1067
+ private metricStore;
1068
+ private edgeStore;
1069
+ private distributionStore;
1070
+ private syncState;
1071
+ getStorageHandle(connectorId: string): StorageHandle;
1072
+ getSyncState(): Promise<SyncState>;
1073
+ setSyncing(): Promise<boolean>;
1074
+ setSyncSuccess(): Promise<void>;
1075
+ setSyncError(error: string): Promise<void>;
1076
+ }
1077
+
1078
+ export { type AggFn, type ConfigFieldsSchema, Connector, type ConnectorEntry, type Dashboard, type DashboardConfig, Distribution, type DistributionWidget, Event, type FilterClause, type FilterCondition, type FilterOperator, type GroupBy, InMemoryStorage, Metric, type MetricDef, type ResolvedMetric, type RetentionCandidates, type RetentionConfig, ServerStorage, type Shape, type StatWidget, type StatusWidget, StorageHandle, SyncState, type TimeseriesWidget, type Widget, WidgetEntry, type WidgetKind, aggFnSchema, computeMetric, computeRetention, defineConfig, defineConfigFields, defineDashboard, defineMetric, distributionWidgetSchema, filterClauseSchema, filterConditionSchema, filterOperatorSchema, getWidgetSchema, groupBySchema, resolveWidget, resolvedMetricSchema, selectForDeletion, shapeSchema, statWidgetSchema, statusWidgetSchema, timeseriesWidgetSchema, widgetSchema, widgetSchemas };