@holistics/anfra-sdk 0.7.1 → 0.9.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.
@@ -0,0 +1,2238 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+ interface paths {
7
+ "/core.ingest": {
8
+ parameters: {
9
+ query?: never;
10
+ header?: never;
11
+ path?: never;
12
+ cookie?: never;
13
+ };
14
+ get?: never;
15
+ put?: never;
16
+ /** Build the local search catalog from context sources */
17
+ post: operations["core.ingest"];
18
+ delete?: never;
19
+ options?: never;
20
+ head?: never;
21
+ patch?: never;
22
+ trace?: never;
23
+ };
24
+ "/core.lineage": {
25
+ parameters: {
26
+ query?: never;
27
+ header?: never;
28
+ path?: never;
29
+ cookie?: never;
30
+ };
31
+ get?: never;
32
+ put?: never;
33
+ /**
34
+ * Trace fields through the local catalog: what each one is built from
35
+ * @description Trace each field through the local catalog to what it is built from (the fields, models and
36
+ * sources upstream of it), as a diagram: cards in layers, upstream first, linked by what uses it.
37
+ */
38
+ post: operations["core.lineage"];
39
+ delete?: never;
40
+ options?: never;
41
+ head?: never;
42
+ patch?: never;
43
+ trace?: never;
44
+ };
45
+ "/core.query": {
46
+ parameters: {
47
+ query?: never;
48
+ header?: never;
49
+ path?: never;
50
+ cookie?: never;
51
+ };
52
+ get?: never;
53
+ put?: never;
54
+ /** Run a query: its rows, and the SQL that produced them */
55
+ post: operations["core.query"];
56
+ delete?: never;
57
+ options?: never;
58
+ head?: never;
59
+ patch?: never;
60
+ trace?: never;
61
+ };
62
+ "/core.query.compile": {
63
+ parameters: {
64
+ query?: never;
65
+ header?: never;
66
+ path?: never;
67
+ cookie?: never;
68
+ };
69
+ get?: never;
70
+ put?: never;
71
+ /** Compile a query to SQL, without running it */
72
+ post: operations["core.query.compile"];
73
+ delete?: never;
74
+ options?: never;
75
+ head?: never;
76
+ patch?: never;
77
+ trace?: never;
78
+ };
79
+ "/core.query.export": {
80
+ parameters: {
81
+ query?: never;
82
+ header?: never;
83
+ path?: never;
84
+ cookie?: never;
85
+ };
86
+ get?: never;
87
+ put?: never;
88
+ /**
89
+ * Export a query's whole result as a file: a link to download it
90
+ * @description Export a query's whole result as a file: a link to download it.
91
+ *
92
+ * The query runs to completion before the answer, so a query that fails fails here. The CLI downloads the file, to stdout or --output; --link prints the answer instead.
93
+ */
94
+ post: operations["core.query.export"];
95
+ delete?: never;
96
+ options?: never;
97
+ head?: never;
98
+ patch?: never;
99
+ trace?: never;
100
+ };
101
+ "/core.query.validate": {
102
+ parameters: {
103
+ query?: never;
104
+ header?: never;
105
+ path?: never;
106
+ cookie?: never;
107
+ };
108
+ get?: never;
109
+ put?: never;
110
+ /** Validate a query: its diagnostics, without running it */
111
+ post: operations["core.query.validate"];
112
+ delete?: never;
113
+ options?: never;
114
+ head?: never;
115
+ patch?: never;
116
+ trace?: never;
117
+ };
118
+ "/core.search": {
119
+ parameters: {
120
+ query?: never;
121
+ header?: never;
122
+ path?: never;
123
+ cookie?: never;
124
+ };
125
+ get?: never;
126
+ put?: never;
127
+ /** Search the local catalog */
128
+ post: operations["core.search"];
129
+ delete?: never;
130
+ options?: never;
131
+ head?: never;
132
+ patch?: never;
133
+ trace?: never;
134
+ };
135
+ "/core.show": {
136
+ parameters: {
137
+ query?: never;
138
+ header?: never;
139
+ path?: never;
140
+ cookie?: never;
141
+ };
142
+ get?: never;
143
+ put?: never;
144
+ /**
145
+ * Show the repo's datasets, or one dataset: their models, fields and metrics
146
+ * @description Show an object of the repo, read from its compiled AML: with no fqn, the repo and every dataset
147
+ * in full; with a dataset's fqn, that dataset in full, as AQL can query it. Its interface, not its
148
+ * implementation: names, labels, types, roles and AQL definitions, never SQL or tables. What is
149
+ * wrong in the repo for it comes with it, as diagnostics: files that do not compile, a data source
150
+ * it does not configure.
151
+ */
152
+ post: operations["core.show"];
153
+ delete?: never;
154
+ options?: never;
155
+ head?: never;
156
+ patch?: never;
157
+ trace?: never;
158
+ };
159
+ "/core.status": {
160
+ parameters: {
161
+ query?: never;
162
+ header?: never;
163
+ path?: never;
164
+ cookie?: never;
165
+ };
166
+ get?: never;
167
+ put?: never;
168
+ /** Report whether a warm server is running and its sidecars are healthy */
169
+ post: operations["core.status"];
170
+ delete?: never;
171
+ options?: never;
172
+ head?: never;
173
+ patch?: never;
174
+ trace?: never;
175
+ };
176
+ "/core.validate": {
177
+ parameters: {
178
+ query?: never;
179
+ header?: never;
180
+ path?: never;
181
+ cookie?: never;
182
+ };
183
+ get?: never;
184
+ put?: never;
185
+ /** Validate the AML repo, optionally scoped to file globs */
186
+ post: operations["core.validate"];
187
+ delete?: never;
188
+ options?: never;
189
+ head?: never;
190
+ patch?: never;
191
+ trace?: never;
192
+ };
193
+ "/core.version": {
194
+ parameters: {
195
+ query?: never;
196
+ header?: never;
197
+ path?: never;
198
+ cookie?: never;
199
+ };
200
+ get?: never;
201
+ put?: never;
202
+ /** Print the anfra version */
203
+ post: operations["core.version"];
204
+ delete?: never;
205
+ options?: never;
206
+ head?: never;
207
+ patch?: never;
208
+ trace?: never;
209
+ };
210
+ }
211
+ interface components {
212
+ schemas: {
213
+ AQLDiagnostic: {
214
+ /** Format: int64 */
215
+ column?: number;
216
+ /** Format: int64 */
217
+ line?: number;
218
+ message: string;
219
+ severity: string;
220
+ };
221
+ Column: {
222
+ /** @description a query-local expression, not a field the dataset defines */
223
+ adhoc: boolean;
224
+ /** @description an aggregated field's aggregation, such as sum or count distinct */
225
+ aggregation?: string;
226
+ /** @description the Arrow type canal-query read the values as, by which they are written; absent before the query runs */
227
+ arrow_type?: {
228
+ /** @description the type as arrow-go spells it, such as decimal(38, 2): for people, not to decide on */
229
+ label: string;
230
+ /** @description the type's name, as Schema.fbs's Type union names it, in snake_case: int, floating_point, decimal, utf8, bool, date, timestamp, list, struct, ... */
231
+ type: string;
232
+ } & {
233
+ [key: string]: unknown;
234
+ };
235
+ /** @description the database's own name of the column's type: for debugging, never to decide on, since it varies by database and driver; absent before the query runs */
236
+ db_type?: string;
237
+ /** @description the field it draws; for an adhoc column, its name */
238
+ fieldName: string;
239
+ isMeasure: boolean;
240
+ label: string;
241
+ /** @description the model of fieldName, as the dataset names it; absent for a dataset metric or an adhoc column */
242
+ modelId?: string;
243
+ /** @description the column's key, as in fields */
244
+ name: string;
245
+ /**
246
+ * @description what the column's values mean, in AML's types, plus bit: a true or false stored as a bit, written as true and false or as "1" and "0" by how the database produced it. Decide by it. Absent when no AQL types the column (a SQL query, or AQL that is not an explore): see arrow_type. Unknown when its AQL type has no meaning in AML (time, duration, ...)
247
+ * @enum {string}
248
+ */
249
+ semantic_type?: "bit" | "date" | "datetime" | "json" | "number" | "text" | "truefalse" | "unknown";
250
+ };
251
+ CompileError: {
252
+ /** Format: int64 */
253
+ col?: number;
254
+ filePath?: string;
255
+ message: string;
256
+ /** Format: int64 */
257
+ row?: number;
258
+ };
259
+ CompiledQuery: {
260
+ /** @description the AQL compiled: the query with its Query Input applied; absent for a SQL query */
261
+ aql?: string;
262
+ /** @description what each column of an explore query's answer will be, and its semantic type; absent for other queries */
263
+ columns?: components["schemas"]["Column"][];
264
+ sql: string;
265
+ };
266
+ ContextEntry: {
267
+ params?: {
268
+ [key: string]: unknown;
269
+ };
270
+ step: string;
271
+ text: string;
272
+ };
273
+ Diagram: {
274
+ /** @description every card, in layer order */
275
+ cards: components["schemas"]["DiagramCard"][];
276
+ /** @description the cards in layers, upstream first */
277
+ layers: components["schemas"]["DiagramLayer"][];
278
+ /** @description the ids of this page's matched entities, in search order */
279
+ matched: string[];
280
+ /** @description the catalog search the lineage is */
281
+ query: string;
282
+ schema: components["schemas"]["DiagramSchema"];
283
+ /**
284
+ * Format: int64
285
+ * @description how many entities the search matched, over every page
286
+ */
287
+ total: number;
288
+ /**
289
+ * Format: int64
290
+ * @enum {integer}
291
+ */
292
+ version: 2;
293
+ };
294
+ DiagramCard: {
295
+ /** @description its type is not a top-level one, but its container is not in the lineage */
296
+ detached?: boolean;
297
+ /** @description the catalog's id of the entity */
298
+ id: string;
299
+ label: string;
300
+ /** Format: int64 */
301
+ layer: number;
302
+ /** @description the node's links; a link is on its edge's from entity */
303
+ links?: components["schemas"]["DiagramLink"][];
304
+ /** @description the entity's properties */
305
+ props?: {
306
+ [key: string]: unknown;
307
+ };
308
+ /** @description the entity this node is a copy of */
309
+ ref?: string;
310
+ /** @description the node's children, grouped by type */
311
+ sections?: components["schemas"]["DiagramSection"][];
312
+ tags?: string[];
313
+ /** @description the catalog's entity type, such as aml.model or aml.metric */
314
+ type: string;
315
+ };
316
+ DiagramLayer: {
317
+ card_ids: string[];
318
+ /** Format: int64 */
319
+ index: number;
320
+ /** @description the entity types of its cards */
321
+ types: string[];
322
+ };
323
+ DiagramLink: {
324
+ /** @description the edge's properties, when it has some */
325
+ props?: {
326
+ [key: string]: unknown;
327
+ };
328
+ /** @description the linked entity's id */
329
+ to: string;
330
+ /** @description the edge type, such as refers or includes */
331
+ type: string;
332
+ };
333
+ DiagramNode: {
334
+ /** @description the catalog's id of the entity */
335
+ id: string;
336
+ label: string;
337
+ /** @description the node's links; a link is on its edge's from entity */
338
+ links?: components["schemas"]["DiagramLink"][];
339
+ /** @description the entity's properties */
340
+ props?: {
341
+ [key: string]: unknown;
342
+ };
343
+ /** @description the entity this node is a copy of */
344
+ ref?: string;
345
+ /** @description the node's children, grouped by type */
346
+ sections?: components["schemas"]["DiagramSection"][];
347
+ tags?: string[];
348
+ /** @description the catalog's entity type, such as aml.model or aml.metric */
349
+ type: string;
350
+ };
351
+ DiagramSchema: {
352
+ /** @description edge type → what it means */
353
+ edges: {
354
+ [key: string]: string;
355
+ };
356
+ /** @description entity type → how it connects */
357
+ types: {
358
+ [key: string]: components["schemas"]["DiagramSchemaType"];
359
+ };
360
+ };
361
+ DiagramSchemaType: {
362
+ /** @description edge type → the entity types it links to */
363
+ edges: {
364
+ [key: string]: string[];
365
+ };
366
+ /** @description no entity of the type is a child in a section */
367
+ top_level: boolean;
368
+ };
369
+ DiagramSection: {
370
+ nodes: components["schemas"]["DiagramNode"][];
371
+ type: string;
372
+ };
373
+ /** @description This server cannot make exports. */
374
+ ErrorBodyExportsUnavailable: {
375
+ /** @constant */
376
+ code: "exports_unavailable";
377
+ context?: components["schemas"]["ContextEntry"][];
378
+ message: string;
379
+ request_id: string;
380
+ /** @constant */
381
+ scope: "server";
382
+ /** @constant */
383
+ status: 501;
384
+ };
385
+ /** @description Something went wrong on our side. */
386
+ ErrorBodyInternalServerError: {
387
+ /** @constant */
388
+ code: "internal_server_error";
389
+ context?: components["schemas"]["ContextEntry"][];
390
+ message: string;
391
+ request_id: string;
392
+ /** @constant */
393
+ scope: "server";
394
+ /** @constant */
395
+ status: 500;
396
+ };
397
+ /** @description The request is not valid. */
398
+ ErrorBodyInvalidRequest: {
399
+ /** @constant */
400
+ code: "invalid_request";
401
+ context?: components["schemas"]["ContextEntry"][];
402
+ details?: components["schemas"]["Violations"];
403
+ message: string;
404
+ request_id: string;
405
+ /** @constant */
406
+ scope: "client";
407
+ /** @constant */
408
+ status: 400;
409
+ };
410
+ /** @description The query failed to run on its data source. */
411
+ ErrorBodyQueryFailed: {
412
+ /** @constant */
413
+ code: "query_failed";
414
+ context?: components["schemas"]["ContextEntry"][];
415
+ message: string;
416
+ request_id: string;
417
+ /** @constant */
418
+ scope: "server";
419
+ /** @constant */
420
+ status: 502;
421
+ };
422
+ /** @description The query is invalid. */
423
+ ErrorBodyQueryInvalid: {
424
+ /** @constant */
425
+ code: "query_invalid";
426
+ context?: components["schemas"]["ContextEntry"][];
427
+ details?: components["schemas"]["QueryValidation"];
428
+ message: string;
429
+ request_id: string;
430
+ /** @constant */
431
+ scope: "user";
432
+ /** @constant */
433
+ status: 422;
434
+ };
435
+ /** @description A sidecar is unavailable. */
436
+ ErrorBodySidecarUnavailable: {
437
+ /** @constant */
438
+ code: "sidecar_unavailable";
439
+ context?: components["schemas"]["ContextEntry"][];
440
+ message: string;
441
+ request_id: string;
442
+ /** @constant */
443
+ scope: "server";
444
+ /** @constant */
445
+ status: 503;
446
+ };
447
+ /** @description Some of the input is not valid. */
448
+ ErrorBodyValidationFailed: {
449
+ /** @constant */
450
+ code: "validation_failed";
451
+ context?: components["schemas"]["ContextEntry"][];
452
+ details?: components["schemas"]["Violations"];
453
+ message: string;
454
+ request_id: string;
455
+ /** @constant */
456
+ scope: "user";
457
+ /** @constant */
458
+ status: 422;
459
+ };
460
+ ExportFormatOptions: {
461
+ /** @description csv: start the file with a UTF-8 byte-order mark, which Excel needs to read non-ASCII text; set it for a file a person will open */
462
+ bom?: boolean;
463
+ /**
464
+ * @description csv: the header row: the columns' labels (the default; what readers see), their names (their keys in a query's answer, stable for programs), or none
465
+ * @enum {string}
466
+ */
467
+ header?: "labels" | "names" | "none";
468
+ };
469
+ ExportInput: {
470
+ /** @description the data source a SQL query runs against */
471
+ data_source?: string;
472
+ /** @description the dataset an AQL query runs against */
473
+ dataset?: string;
474
+ /** @description the file's name, as a download saves it, with the format's extension added when it has none; when unset or blank, the dataset's or data source's name */
475
+ filename?: string;
476
+ /**
477
+ * @description the file's format
478
+ * @default csv
479
+ * @enum {string}
480
+ */
481
+ format?: "csv";
482
+ /** @description the format's options */
483
+ format_options?: components["schemas"]["ExportFormatOptions"];
484
+ /** @description the Query Input: filters, conditions, sorts and date drills applied to the AQL before it compiles */
485
+ input?: components["schemas"]["QueryTransforms"];
486
+ /**
487
+ * @description the language the query is written in
488
+ * @default aql
489
+ * @enum {string}
490
+ */
491
+ lang?: "aql" | "sql";
492
+ /** @description the query */
493
+ query: string;
494
+ /** @description the IANA time zone relative dates and date truncation use, such as Asia/Ho_Chi_Minh */
495
+ timezone?: string;
496
+ };
497
+ ExportLink: {
498
+ /**
499
+ * Format: date-time
500
+ * @description when the link stops working
501
+ */
502
+ expires_at: string;
503
+ /** @description the file's name, as a download saves it */
504
+ filename: string;
505
+ /** @description the file's format */
506
+ format: string;
507
+ /**
508
+ * Format: int64
509
+ * @description the rows the file holds
510
+ */
511
+ row_count: number;
512
+ /** @description where to download the file: a plain GET, with no credentials, until expires_at */
513
+ url: string;
514
+ };
515
+ FieldLineage: {
516
+ /** @description the field's lineage; absent with error */
517
+ diagram?: components["schemas"]["Diagram"];
518
+ /** @description why the field's lineage could not be traced */
519
+ error?: string;
520
+ /** @description the catalog search its lineage is, which search also takes; empty when the field could not be searched for */
521
+ query: string;
522
+ /** @description the field, as asked */
523
+ target: components["schemas"]["LineageTarget"];
524
+ };
525
+ IngestInput: {
526
+ /** @description optional context source key to ingest */
527
+ source?: string;
528
+ };
529
+ LineageInput: {
530
+ /**
531
+ * Format: int64
532
+ * @description at most this many upstream entities per field; absent, all of them
533
+ */
534
+ limit?: number;
535
+ /**
536
+ * Format: int64
537
+ * @description skip this many upstream entities first, to page with limit
538
+ */
539
+ offset?: number;
540
+ /** @description the fields to trace, each by its parent and its name in it: {"parent": "orders", "child": "amount"} */
541
+ targets?: components["schemas"]["LineageTarget"][];
542
+ };
543
+ LineageResult: {
544
+ results: components["schemas"]["FieldLineage"][];
545
+ };
546
+ LineageTarget: {
547
+ /** @description the field's name in its parent: a dimension, a measure or a metric */
548
+ child: string;
549
+ /** @description the fqn of what holds the field: a model, or a dataset */
550
+ parent: string;
551
+ };
552
+ NoInput: Record<string, never>;
553
+ QueryCondition: {
554
+ /** @description an AQL condition */
555
+ expr: string;
556
+ };
557
+ QueryDateDrill: {
558
+ /** @description model.field: a date field */
559
+ field: string;
560
+ /** @description the grain, such as month */
561
+ grain: string;
562
+ };
563
+ QueryFilter: {
564
+ /** @description the condition applies to this aggregate of field, such as sum */
565
+ aggregation?: string;
566
+ /** @description model.field for a dataset field, or the name of a dataset metric */
567
+ field: string;
568
+ /** @description the date unit of a relative operator, such as day */
569
+ modifier?: string;
570
+ /** @description the operator, such as is, contains, between, last */
571
+ operator: string;
572
+ /** @description the operator's values, by the field's type: a number as a string in JSON's number syntax, such as "9007199254740993" (a JSON number is refused, since it may have lost digits before it was sent); true or false; a date or text as a string. Empty for an operator that takes none */
573
+ values: unknown[];
574
+ };
575
+ QueryInput: {
576
+ /** @description the data source a SQL query runs against */
577
+ data_source?: string;
578
+ /** @description the dataset an AQL query runs against */
579
+ dataset?: string;
580
+ /**
581
+ * @description the language the query is written in
582
+ * @default aql
583
+ * @enum {string}
584
+ */
585
+ lang?: "aql" | "sql";
586
+ /** @description the query */
587
+ query: string;
588
+ };
589
+ QueryResult: {
590
+ /** @description the AQL that ran: the query with its Query Input applied; absent for a SQL query */
591
+ aql?: string;
592
+ /** @description one per field of result, in order */
593
+ columns: components["schemas"]["Column"][];
594
+ result: components["schemas"]["QueryRows"];
595
+ sql: string;
596
+ };
597
+ QueryRows: {
598
+ fields: string[];
599
+ /** @description one array per row, its values in fields' order, as its column's types say: every number a string, with every digit (a JSON number loses some in JavaScript), a float's NaN and infinities as "NaN", "Infinity" and "-Infinity", and so at any depth of a list, map or struct; null as null */
600
+ records: unknown[][];
601
+ };
602
+ QueryRunInput: {
603
+ /** @description the data source a SQL query runs against */
604
+ data_source?: string;
605
+ /** @description the dataset an AQL query runs against */
606
+ dataset?: string;
607
+ /** @description the Query Input: filters, conditions, sorts and date drills applied to the AQL before it compiles */
608
+ input?: components["schemas"]["QueryTransforms"];
609
+ /**
610
+ * @description the language the query is written in
611
+ * @default aql
612
+ * @enum {string}
613
+ */
614
+ lang?: "aql" | "sql";
615
+ /**
616
+ * Format: int64
617
+ * @description the 1-based page of rows to answer; needs a page size
618
+ */
619
+ page?: number;
620
+ /**
621
+ * Format: int64
622
+ * @description rows per page; alone, the first page
623
+ */
624
+ page_size?: number;
625
+ /** @description the query */
626
+ query: string;
627
+ /** @description the IANA time zone relative dates and date truncation use, such as Asia/Ho_Chi_Minh */
628
+ timezone?: string;
629
+ };
630
+ QuerySort: {
631
+ /**
632
+ * @description the direction
633
+ * @enum {string}
634
+ */
635
+ direction: "asc" | "desc";
636
+ /** @description a result column's name */
637
+ field: string;
638
+ };
639
+ QueryTransforms: {
640
+ /** @description AQL conditions ANDed with the query's own filters */
641
+ conditions?: components["schemas"]["QueryCondition"][];
642
+ /** @description date fields redrawn at another grain, their columns' names kept */
643
+ dateDrills?: components["schemas"]["QueryDateDrill"][];
644
+ /** @description conditions on fields, ANDed with the query's own filters */
645
+ filters?: components["schemas"]["QueryFilter"][];
646
+ /** @description sorts by result column, replacing the query's own */
647
+ sorts?: components["schemas"]["QuerySort"][];
648
+ };
649
+ QueryValidation: {
650
+ diagnostics: components["schemas"]["AQLDiagnostic"][];
651
+ valid: boolean;
652
+ };
653
+ RepoValidation: {
654
+ diagnostics: components["schemas"]["CompileError"][];
655
+ reports: components["schemas"]["ValidationReport"][];
656
+ valid: boolean;
657
+ };
658
+ ReportTrace: {
659
+ kind: string;
660
+ loc?: components["schemas"]["ReportTraceLoc"];
661
+ name: string;
662
+ };
663
+ ReportTraceLoc: {
664
+ /** Format: int64 */
665
+ column?: number;
666
+ filePath: string;
667
+ /** Format: int64 */
668
+ line?: number;
669
+ };
670
+ SearchInput: {
671
+ /** @description search query */
672
+ query?: string[];
673
+ };
674
+ ServerInfo: {
675
+ instance_id: string;
676
+ url: string;
677
+ version: string;
678
+ };
679
+ ShowDataset: {
680
+ description?: string;
681
+ /** @description the dataset's fully qualified name, as AQL and the catalog name it */
682
+ fqn: string;
683
+ /**
684
+ * @description discriminator enum property added by openapi-typescript
685
+ * @enum {string}
686
+ */
687
+ kind: "dataset";
688
+ label?: string;
689
+ /** @description the dataset's metrics; absent in outline */
690
+ metrics?: components["schemas"]["ShowField"][];
691
+ /** @description the models the dataset uses; absent in outline */
692
+ models?: components["schemas"]["ShowModel"][];
693
+ name: string;
694
+ };
695
+ ShowField: {
696
+ /** @description a measure's aggregation, such as sum or count distinct; custom for a custom one */
697
+ aggregation?: string;
698
+ /** @description a dimension the dataset declares on one of its models */
699
+ definedInDataset?: boolean;
700
+ /** @description the definition of a field or metric written in AQL */
701
+ definition?: string;
702
+ description?: string;
703
+ /** @description how a value displays, as the AML declares it */
704
+ format?: unknown;
705
+ /** @description the catalog's identity: <model fqn>.<name>, or <dataset fqn>.<name> for a dataset-level field or a metric */
706
+ fqn: string;
707
+ hidden: boolean;
708
+ label?: string;
709
+ /** @description AQL writes <model fqn>.<name>; a metric, its name alone */
710
+ name: string;
711
+ /** @enum {string} */
712
+ role: "dimension" | "measure" | "param" | "metric";
713
+ /** @description the compiled data type, such as number, text, date, datetime, truefalse */
714
+ type: string;
715
+ };
716
+ ShowInput: {
717
+ /** @description the fqn of the object to show; absent, the repo */
718
+ fqn?: string;
719
+ /**
720
+ * @description the catalog's entity type of fqn; aml.dataset is the only one for now
721
+ * @default aml.dataset
722
+ * @enum {string}
723
+ */
724
+ type?: "aml.dataset";
725
+ };
726
+ ShowModel: {
727
+ description?: string;
728
+ fields: components["schemas"]["ShowField"][];
729
+ /** @description the model's fully qualified name: what AQL writes before a field */
730
+ fqn: string;
731
+ label?: string;
732
+ name: string;
733
+ };
734
+ ShowRepo: {
735
+ /** @description the repo's datasets, each in full; in outline (no models or metrics) when it cannot be shown in full, which a diagnostic says why */
736
+ datasets: components["schemas"]["ShowDataset"][];
737
+ /**
738
+ * @description discriminator enum property added by openapi-typescript
739
+ * @enum {string}
740
+ */
741
+ kind: "repo";
742
+ };
743
+ ShowResult: {
744
+ /** @description what is wrong in the repo for what is shown: its files that do not compile, a dataset's data source it does not configure, a dataset it cannot show in full; empty, what is shown is complete */
745
+ diagnostics: components["schemas"]["CompileError"][];
746
+ /** @description the object shown, by kind; a client must accept a kind it does not know */
747
+ object: components["schemas"]["ShowRepo"] | components["schemas"]["ShowDataset"];
748
+ };
749
+ SidecarHealth: {
750
+ "canal-query": string;
751
+ node: string;
752
+ };
753
+ StatusResult: {
754
+ server?: components["schemas"]["ServerInfo"];
755
+ sidecars?: components["schemas"]["SidecarHealth"];
756
+ /** @enum {string} */
757
+ state: "healthy" | "degraded" | "not_running";
758
+ };
759
+ UpdateInfo: {
760
+ available: boolean;
761
+ latest: string;
762
+ };
763
+ ValidateInput: {
764
+ /** @description optional file globs; report only diagnostics for matching files */
765
+ globs?: string[];
766
+ };
767
+ ValidationReport: {
768
+ code?: unknown;
769
+ filePath: string;
770
+ fqn: string;
771
+ message: string;
772
+ severity: string;
773
+ trace?: components["schemas"]["ReportTrace"][];
774
+ type: string;
775
+ validator: string;
776
+ };
777
+ VersionResult: {
778
+ update?: components["schemas"]["UpdateInfo"];
779
+ version: string;
780
+ };
781
+ Violation: {
782
+ code: string;
783
+ field: string;
784
+ message: string;
785
+ };
786
+ Violations: {
787
+ violations: components["schemas"]["Violation"][];
788
+ };
789
+ };
790
+ responses: never;
791
+ parameters: never;
792
+ requestBodies: never;
793
+ headers: never;
794
+ pathItems: never;
795
+ }
796
+ interface operations {
797
+ "core.ingest": {
798
+ parameters: {
799
+ query?: never;
800
+ header?: never;
801
+ path?: never;
802
+ cookie?: never;
803
+ };
804
+ requestBody: {
805
+ content: {
806
+ "application/json": components["schemas"]["IngestInput"];
807
+ };
808
+ };
809
+ responses: {
810
+ /** @description OK */
811
+ 200: {
812
+ headers: {
813
+ [name: string]: unknown;
814
+ };
815
+ content: {
816
+ "application/json": string;
817
+ };
818
+ };
819
+ /** @description invalid_request */
820
+ 400: {
821
+ headers: {
822
+ [name: string]: unknown;
823
+ };
824
+ content: {
825
+ "application/json": {
826
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
827
+ };
828
+ };
829
+ };
830
+ /** @description validation_failed */
831
+ 422: {
832
+ headers: {
833
+ [name: string]: unknown;
834
+ };
835
+ content: {
836
+ "application/json": {
837
+ error: components["schemas"]["ErrorBodyValidationFailed"];
838
+ };
839
+ };
840
+ };
841
+ /** @description internal_server_error */
842
+ 500: {
843
+ headers: {
844
+ [name: string]: unknown;
845
+ };
846
+ content: {
847
+ "application/json": {
848
+ error: components["schemas"]["ErrorBodyInternalServerError"];
849
+ };
850
+ };
851
+ };
852
+ /** @description sidecar_unavailable */
853
+ 503: {
854
+ headers: {
855
+ [name: string]: unknown;
856
+ };
857
+ content: {
858
+ "application/json": {
859
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
860
+ };
861
+ };
862
+ };
863
+ };
864
+ };
865
+ "core.lineage": {
866
+ parameters: {
867
+ query?: never;
868
+ header?: never;
869
+ path?: never;
870
+ cookie?: never;
871
+ };
872
+ requestBody: {
873
+ content: {
874
+ "application/json": components["schemas"]["LineageInput"];
875
+ };
876
+ };
877
+ responses: {
878
+ /** @description OK */
879
+ 200: {
880
+ headers: {
881
+ [name: string]: unknown;
882
+ };
883
+ content: {
884
+ "application/json": components["schemas"]["LineageResult"];
885
+ };
886
+ };
887
+ /** @description invalid_request */
888
+ 400: {
889
+ headers: {
890
+ [name: string]: unknown;
891
+ };
892
+ content: {
893
+ "application/json": {
894
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
895
+ };
896
+ };
897
+ };
898
+ /** @description validation_failed */
899
+ 422: {
900
+ headers: {
901
+ [name: string]: unknown;
902
+ };
903
+ content: {
904
+ "application/json": {
905
+ error: components["schemas"]["ErrorBodyValidationFailed"];
906
+ };
907
+ };
908
+ };
909
+ /** @description internal_server_error */
910
+ 500: {
911
+ headers: {
912
+ [name: string]: unknown;
913
+ };
914
+ content: {
915
+ "application/json": {
916
+ error: components["schemas"]["ErrorBodyInternalServerError"];
917
+ };
918
+ };
919
+ };
920
+ /** @description sidecar_unavailable */
921
+ 503: {
922
+ headers: {
923
+ [name: string]: unknown;
924
+ };
925
+ content: {
926
+ "application/json": {
927
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
928
+ };
929
+ };
930
+ };
931
+ };
932
+ };
933
+ "core.query": {
934
+ parameters: {
935
+ query?: never;
936
+ header?: never;
937
+ path?: never;
938
+ cookie?: never;
939
+ };
940
+ requestBody: {
941
+ content: {
942
+ "application/json": components["schemas"]["QueryRunInput"];
943
+ };
944
+ };
945
+ responses: {
946
+ /** @description OK */
947
+ 200: {
948
+ headers: {
949
+ [name: string]: unknown;
950
+ };
951
+ content: {
952
+ "application/json": components["schemas"]["QueryResult"];
953
+ };
954
+ };
955
+ /** @description invalid_request */
956
+ 400: {
957
+ headers: {
958
+ [name: string]: unknown;
959
+ };
960
+ content: {
961
+ "application/json": {
962
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
963
+ };
964
+ };
965
+ };
966
+ /** @description validation_failed, query_invalid */
967
+ 422: {
968
+ headers: {
969
+ [name: string]: unknown;
970
+ };
971
+ content: {
972
+ "application/json": {
973
+ error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"];
974
+ };
975
+ };
976
+ };
977
+ /** @description internal_server_error */
978
+ 500: {
979
+ headers: {
980
+ [name: string]: unknown;
981
+ };
982
+ content: {
983
+ "application/json": {
984
+ error: components["schemas"]["ErrorBodyInternalServerError"];
985
+ };
986
+ };
987
+ };
988
+ /** @description query_failed */
989
+ 502: {
990
+ headers: {
991
+ [name: string]: unknown;
992
+ };
993
+ content: {
994
+ "application/json": {
995
+ error: components["schemas"]["ErrorBodyQueryFailed"];
996
+ };
997
+ };
998
+ };
999
+ /** @description sidecar_unavailable */
1000
+ 503: {
1001
+ headers: {
1002
+ [name: string]: unknown;
1003
+ };
1004
+ content: {
1005
+ "application/json": {
1006
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1007
+ };
1008
+ };
1009
+ };
1010
+ };
1011
+ };
1012
+ "core.query.compile": {
1013
+ parameters: {
1014
+ query?: never;
1015
+ header?: never;
1016
+ path?: never;
1017
+ cookie?: never;
1018
+ };
1019
+ requestBody: {
1020
+ content: {
1021
+ "application/json": components["schemas"]["QueryRunInput"];
1022
+ };
1023
+ };
1024
+ responses: {
1025
+ /** @description OK */
1026
+ 200: {
1027
+ headers: {
1028
+ [name: string]: unknown;
1029
+ };
1030
+ content: {
1031
+ "application/json": components["schemas"]["CompiledQuery"];
1032
+ };
1033
+ };
1034
+ /** @description invalid_request */
1035
+ 400: {
1036
+ headers: {
1037
+ [name: string]: unknown;
1038
+ };
1039
+ content: {
1040
+ "application/json": {
1041
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1042
+ };
1043
+ };
1044
+ };
1045
+ /** @description validation_failed, query_invalid */
1046
+ 422: {
1047
+ headers: {
1048
+ [name: string]: unknown;
1049
+ };
1050
+ content: {
1051
+ "application/json": {
1052
+ error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"];
1053
+ };
1054
+ };
1055
+ };
1056
+ /** @description internal_server_error */
1057
+ 500: {
1058
+ headers: {
1059
+ [name: string]: unknown;
1060
+ };
1061
+ content: {
1062
+ "application/json": {
1063
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1064
+ };
1065
+ };
1066
+ };
1067
+ /** @description sidecar_unavailable */
1068
+ 503: {
1069
+ headers: {
1070
+ [name: string]: unknown;
1071
+ };
1072
+ content: {
1073
+ "application/json": {
1074
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1075
+ };
1076
+ };
1077
+ };
1078
+ };
1079
+ };
1080
+ "core.query.export": {
1081
+ parameters: {
1082
+ query?: never;
1083
+ header?: never;
1084
+ path?: never;
1085
+ cookie?: never;
1086
+ };
1087
+ requestBody: {
1088
+ content: {
1089
+ "application/json": components["schemas"]["ExportInput"];
1090
+ };
1091
+ };
1092
+ responses: {
1093
+ /** @description OK */
1094
+ 200: {
1095
+ headers: {
1096
+ [name: string]: unknown;
1097
+ };
1098
+ content: {
1099
+ "application/json": components["schemas"]["ExportLink"];
1100
+ };
1101
+ };
1102
+ /** @description invalid_request */
1103
+ 400: {
1104
+ headers: {
1105
+ [name: string]: unknown;
1106
+ };
1107
+ content: {
1108
+ "application/json": {
1109
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1110
+ };
1111
+ };
1112
+ };
1113
+ /** @description validation_failed, query_invalid */
1114
+ 422: {
1115
+ headers: {
1116
+ [name: string]: unknown;
1117
+ };
1118
+ content: {
1119
+ "application/json": {
1120
+ error: components["schemas"]["ErrorBodyValidationFailed"] | components["schemas"]["ErrorBodyQueryInvalid"];
1121
+ };
1122
+ };
1123
+ };
1124
+ /** @description internal_server_error */
1125
+ 500: {
1126
+ headers: {
1127
+ [name: string]: unknown;
1128
+ };
1129
+ content: {
1130
+ "application/json": {
1131
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1132
+ };
1133
+ };
1134
+ };
1135
+ /** @description exports_unavailable */
1136
+ 501: {
1137
+ headers: {
1138
+ [name: string]: unknown;
1139
+ };
1140
+ content: {
1141
+ "application/json": {
1142
+ error: components["schemas"]["ErrorBodyExportsUnavailable"];
1143
+ };
1144
+ };
1145
+ };
1146
+ /** @description query_failed */
1147
+ 502: {
1148
+ headers: {
1149
+ [name: string]: unknown;
1150
+ };
1151
+ content: {
1152
+ "application/json": {
1153
+ error: components["schemas"]["ErrorBodyQueryFailed"];
1154
+ };
1155
+ };
1156
+ };
1157
+ /** @description sidecar_unavailable */
1158
+ 503: {
1159
+ headers: {
1160
+ [name: string]: unknown;
1161
+ };
1162
+ content: {
1163
+ "application/json": {
1164
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1165
+ };
1166
+ };
1167
+ };
1168
+ };
1169
+ };
1170
+ "core.query.validate": {
1171
+ parameters: {
1172
+ query?: never;
1173
+ header?: never;
1174
+ path?: never;
1175
+ cookie?: never;
1176
+ };
1177
+ requestBody: {
1178
+ content: {
1179
+ "application/json": components["schemas"]["QueryInput"];
1180
+ };
1181
+ };
1182
+ responses: {
1183
+ /** @description OK */
1184
+ 200: {
1185
+ headers: {
1186
+ [name: string]: unknown;
1187
+ };
1188
+ content: {
1189
+ "application/json": components["schemas"]["QueryValidation"];
1190
+ };
1191
+ };
1192
+ /** @description invalid_request */
1193
+ 400: {
1194
+ headers: {
1195
+ [name: string]: unknown;
1196
+ };
1197
+ content: {
1198
+ "application/json": {
1199
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1200
+ };
1201
+ };
1202
+ };
1203
+ /** @description validation_failed */
1204
+ 422: {
1205
+ headers: {
1206
+ [name: string]: unknown;
1207
+ };
1208
+ content: {
1209
+ "application/json": {
1210
+ error: components["schemas"]["ErrorBodyValidationFailed"];
1211
+ };
1212
+ };
1213
+ };
1214
+ /** @description internal_server_error */
1215
+ 500: {
1216
+ headers: {
1217
+ [name: string]: unknown;
1218
+ };
1219
+ content: {
1220
+ "application/json": {
1221
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1222
+ };
1223
+ };
1224
+ };
1225
+ /** @description sidecar_unavailable */
1226
+ 503: {
1227
+ headers: {
1228
+ [name: string]: unknown;
1229
+ };
1230
+ content: {
1231
+ "application/json": {
1232
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1233
+ };
1234
+ };
1235
+ };
1236
+ };
1237
+ };
1238
+ "core.search": {
1239
+ parameters: {
1240
+ query?: never;
1241
+ header?: never;
1242
+ path?: never;
1243
+ cookie?: never;
1244
+ };
1245
+ requestBody: {
1246
+ content: {
1247
+ "application/json": components["schemas"]["SearchInput"];
1248
+ };
1249
+ };
1250
+ responses: {
1251
+ /** @description OK */
1252
+ 200: {
1253
+ headers: {
1254
+ [name: string]: unknown;
1255
+ };
1256
+ content: {
1257
+ "application/json": {
1258
+ [key: string]: unknown;
1259
+ };
1260
+ };
1261
+ };
1262
+ /** @description invalid_request */
1263
+ 400: {
1264
+ headers: {
1265
+ [name: string]: unknown;
1266
+ };
1267
+ content: {
1268
+ "application/json": {
1269
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1270
+ };
1271
+ };
1272
+ };
1273
+ /** @description validation_failed */
1274
+ 422: {
1275
+ headers: {
1276
+ [name: string]: unknown;
1277
+ };
1278
+ content: {
1279
+ "application/json": {
1280
+ error: components["schemas"]["ErrorBodyValidationFailed"];
1281
+ };
1282
+ };
1283
+ };
1284
+ /** @description internal_server_error */
1285
+ 500: {
1286
+ headers: {
1287
+ [name: string]: unknown;
1288
+ };
1289
+ content: {
1290
+ "application/json": {
1291
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1292
+ };
1293
+ };
1294
+ };
1295
+ /** @description sidecar_unavailable */
1296
+ 503: {
1297
+ headers: {
1298
+ [name: string]: unknown;
1299
+ };
1300
+ content: {
1301
+ "application/json": {
1302
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1303
+ };
1304
+ };
1305
+ };
1306
+ };
1307
+ };
1308
+ "core.show": {
1309
+ parameters: {
1310
+ query?: never;
1311
+ header?: never;
1312
+ path?: never;
1313
+ cookie?: never;
1314
+ };
1315
+ requestBody: {
1316
+ content: {
1317
+ "application/json": components["schemas"]["ShowInput"];
1318
+ };
1319
+ };
1320
+ responses: {
1321
+ /** @description OK */
1322
+ 200: {
1323
+ headers: {
1324
+ [name: string]: unknown;
1325
+ };
1326
+ content: {
1327
+ "application/json": components["schemas"]["ShowResult"];
1328
+ };
1329
+ };
1330
+ /** @description invalid_request */
1331
+ 400: {
1332
+ headers: {
1333
+ [name: string]: unknown;
1334
+ };
1335
+ content: {
1336
+ "application/json": {
1337
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1338
+ };
1339
+ };
1340
+ };
1341
+ /** @description validation_failed */
1342
+ 422: {
1343
+ headers: {
1344
+ [name: string]: unknown;
1345
+ };
1346
+ content: {
1347
+ "application/json": {
1348
+ error: components["schemas"]["ErrorBodyValidationFailed"];
1349
+ };
1350
+ };
1351
+ };
1352
+ /** @description internal_server_error */
1353
+ 500: {
1354
+ headers: {
1355
+ [name: string]: unknown;
1356
+ };
1357
+ content: {
1358
+ "application/json": {
1359
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1360
+ };
1361
+ };
1362
+ };
1363
+ /** @description sidecar_unavailable */
1364
+ 503: {
1365
+ headers: {
1366
+ [name: string]: unknown;
1367
+ };
1368
+ content: {
1369
+ "application/json": {
1370
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1371
+ };
1372
+ };
1373
+ };
1374
+ };
1375
+ };
1376
+ "core.status": {
1377
+ parameters: {
1378
+ query?: never;
1379
+ header?: never;
1380
+ path?: never;
1381
+ cookie?: never;
1382
+ };
1383
+ requestBody: {
1384
+ content: {
1385
+ "application/json": components["schemas"]["NoInput"];
1386
+ };
1387
+ };
1388
+ responses: {
1389
+ /** @description OK */
1390
+ 200: {
1391
+ headers: {
1392
+ [name: string]: unknown;
1393
+ };
1394
+ content: {
1395
+ "application/json": components["schemas"]["StatusResult"];
1396
+ };
1397
+ };
1398
+ /** @description invalid_request */
1399
+ 400: {
1400
+ headers: {
1401
+ [name: string]: unknown;
1402
+ };
1403
+ content: {
1404
+ "application/json": {
1405
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1406
+ };
1407
+ };
1408
+ };
1409
+ /** @description validation_failed */
1410
+ 422: {
1411
+ headers: {
1412
+ [name: string]: unknown;
1413
+ };
1414
+ content: {
1415
+ "application/json": {
1416
+ error: components["schemas"]["ErrorBodyValidationFailed"];
1417
+ };
1418
+ };
1419
+ };
1420
+ /** @description internal_server_error */
1421
+ 500: {
1422
+ headers: {
1423
+ [name: string]: unknown;
1424
+ };
1425
+ content: {
1426
+ "application/json": {
1427
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1428
+ };
1429
+ };
1430
+ };
1431
+ };
1432
+ };
1433
+ "core.validate": {
1434
+ parameters: {
1435
+ query?: never;
1436
+ header?: never;
1437
+ path?: never;
1438
+ cookie?: never;
1439
+ };
1440
+ requestBody: {
1441
+ content: {
1442
+ "application/json": components["schemas"]["ValidateInput"];
1443
+ };
1444
+ };
1445
+ responses: {
1446
+ /** @description OK */
1447
+ 200: {
1448
+ headers: {
1449
+ [name: string]: unknown;
1450
+ };
1451
+ content: {
1452
+ "application/json": components["schemas"]["RepoValidation"];
1453
+ };
1454
+ };
1455
+ /** @description invalid_request */
1456
+ 400: {
1457
+ headers: {
1458
+ [name: string]: unknown;
1459
+ };
1460
+ content: {
1461
+ "application/json": {
1462
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1463
+ };
1464
+ };
1465
+ };
1466
+ /** @description validation_failed */
1467
+ 422: {
1468
+ headers: {
1469
+ [name: string]: unknown;
1470
+ };
1471
+ content: {
1472
+ "application/json": {
1473
+ error: components["schemas"]["ErrorBodyValidationFailed"];
1474
+ };
1475
+ };
1476
+ };
1477
+ /** @description internal_server_error */
1478
+ 500: {
1479
+ headers: {
1480
+ [name: string]: unknown;
1481
+ };
1482
+ content: {
1483
+ "application/json": {
1484
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1485
+ };
1486
+ };
1487
+ };
1488
+ /** @description sidecar_unavailable */
1489
+ 503: {
1490
+ headers: {
1491
+ [name: string]: unknown;
1492
+ };
1493
+ content: {
1494
+ "application/json": {
1495
+ error: components["schemas"]["ErrorBodySidecarUnavailable"];
1496
+ };
1497
+ };
1498
+ };
1499
+ };
1500
+ };
1501
+ "core.version": {
1502
+ parameters: {
1503
+ query?: never;
1504
+ header?: never;
1505
+ path?: never;
1506
+ cookie?: never;
1507
+ };
1508
+ requestBody: {
1509
+ content: {
1510
+ "application/json": components["schemas"]["NoInput"];
1511
+ };
1512
+ };
1513
+ responses: {
1514
+ /** @description OK */
1515
+ 200: {
1516
+ headers: {
1517
+ [name: string]: unknown;
1518
+ };
1519
+ content: {
1520
+ "application/json": components["schemas"]["VersionResult"];
1521
+ };
1522
+ };
1523
+ /** @description invalid_request */
1524
+ 400: {
1525
+ headers: {
1526
+ [name: string]: unknown;
1527
+ };
1528
+ content: {
1529
+ "application/json": {
1530
+ error: components["schemas"]["ErrorBodyInvalidRequest"];
1531
+ };
1532
+ };
1533
+ };
1534
+ /** @description validation_failed */
1535
+ 422: {
1536
+ headers: {
1537
+ [name: string]: unknown;
1538
+ };
1539
+ content: {
1540
+ "application/json": {
1541
+ error: components["schemas"]["ErrorBodyValidationFailed"];
1542
+ };
1543
+ };
1544
+ };
1545
+ /** @description internal_server_error */
1546
+ 500: {
1547
+ headers: {
1548
+ [name: string]: unknown;
1549
+ };
1550
+ content: {
1551
+ "application/json": {
1552
+ error: components["schemas"]["ErrorBodyInternalServerError"];
1553
+ };
1554
+ };
1555
+ };
1556
+ };
1557
+ };
1558
+ }
1559
+
1560
+ /**
1561
+ * The aggregations a *filter* may carry — a narrower set than a measure may, for two reasons.
1562
+ *
1563
+ * The `running *` four are window functions, and the compiler discards a result-field filter whose
1564
+ * fragment still carries `hasWindowFunction`: silently, leaving the rows unfiltered. A rejection
1565
+ * here is the only place that failure is visible.
1566
+ *
1567
+ * `custom` means "the field defines its own aggregation", which a filter never needs to say. A
1568
+ * dataset-level metric is rejected outright below, and a model field that is already a measure
1569
+ * routes through the aggregated branch on its own. The wire accepts `custom` regardless — the
1570
+ * dashboard path sends it for a metric — so this is an SDK narrowing, not a transport limit.
1571
+ *
1572
+ * Declared `satisfies readonly Aggregation[]` so the subset relationship is checked rather than
1573
+ * asserted, and the type below is derived from the one list the runtime check uses.
1574
+ */
1575
+ declare const FILTER_AGGREGATIONS: readonly ["sum", "avg", "max", "min", "count", "count distinct", "median", "stdev", "stdevp", "var", "varp"];
1576
+ type FilterAggregation = typeof FILTER_AGGREGATIONS[number];
1577
+
1578
+ /**
1579
+ * Public types. Nothing here may leak an internal wire shape: `VizSetting` in particular is never
1580
+ * part of this surface, and the query API's payload shapes are built in `execution/submitQuery.ts`
1581
+ * rather than exposed. See docs/adr/0001. What is the core API's own shape, as it publishes it
1582
+ * (`api/openapi.yaml`), is that shape: taken from `schema.d.ts`, so the two cannot drift. Types
1583
+ * only: nothing of the API client reaches `common`, nor the frame.
1584
+ */
1585
+
1586
+ type Schemas = components['schemas'];
1587
+
1588
+ /**
1589
+ * Metadata for one dataset, supplied by the provisioner. The SDK owns this type, so a provisioner
1590
+ * needs no particular metadata library to build one.
1591
+ */
1592
+ interface DatasetDescriptor {
1593
+ id: string | number;
1594
+ name: string;
1595
+ label?: string;
1596
+ data_models: {
1597
+ id: string | number;
1598
+ name: string;
1599
+ label?: string;
1600
+ fields: {
1601
+ name: string;
1602
+ label?: string;
1603
+ type: string;
1604
+ is_custom_measure: boolean;
1605
+ defined_in_dataset?: boolean;
1606
+ }[];
1607
+ }[];
1608
+ metrics: {
1609
+ name: string;
1610
+ label?: string;
1611
+ type: string;
1612
+ }[];
1613
+ }
1614
+ /**
1615
+ * Who the app is running as, supplied by the provisioner.
1616
+ *
1617
+ * Every field is copied across deliberately. The provisioner holds a much larger current-user
1618
+ * record (personal settings, client IP, shared dataset ids, tokens) and none of it belongs in
1619
+ * front of author code, so this is an allowlist rather than a projection of that record.
1620
+ *
1621
+ * Note what this is *not*: it does not authorise anything. Queries are re-authorised server-side
1622
+ * on every call, so `permissions` here is a rendering hint — an app that ignores it renders a
1623
+ * button that returns blank values, not a leak.
1624
+ */
1625
+ interface User {
1626
+ id: number;
1627
+ name: string;
1628
+ /** The external address for an embed user, whose internal one names nothing they'd recognise. */
1629
+ email: string;
1630
+ /** Free-form rather than a union: the role set is the host's to change, not this package's. */
1631
+ role: string;
1632
+ /**
1633
+ * The user's reporting timezone. Available, but not a default: an app that declares no timezone
1634
+ * still sends none and lets the server apply the tenant's. See `AppDeclaration.timezone`.
1635
+ */
1636
+ timezone: string;
1637
+ permissions: {
1638
+ canViewGeneratedSql: boolean;
1639
+ canExportData: boolean;
1640
+ };
1641
+ }
1642
+ /**
1643
+ * Server-side capabilities the host knows about, so a declaration can fail loudly instead of
1644
+ * silently.
1645
+ *
1646
+ * `dateDrill` mirrors `interactive_control:date_drill`: with it off the `transform_date_drill`
1647
+ * condition still reaches the server, which ignores it and answers at the declared grain. Every
1648
+ * request succeeds and the grain silently never changes.
1649
+ */
1650
+ interface SdkFeatures {
1651
+ dateDrill?: boolean;
1652
+ /**
1653
+ * Whether the host can export a query's result (`query.export()`): its Backend has
1654
+ * `exportQuery`. `mountDataApp` says so for every frame; `createSdk` reads it off the Backend
1655
+ * when the host does not. An author shows an export button when this and
1656
+ * `user.permissions.canExportData` are both true.
1657
+ */
1658
+ export?: boolean;
1659
+ /**
1660
+ * Whether `Anfra.render()` can save a rendering here: the host turned it on
1661
+ * (`mountDataApp({ render: true })`). An author shows a render button when this and
1662
+ * `user.permissions.canExportData` are both true.
1663
+ */
1664
+ render?: boolean;
1665
+ /**
1666
+ * Whether `Anfra.lineage()` can trace fields here: the host's Backend has `lineage`.
1667
+ * `mountDataApp` says so for every frame; `createSdk` reads it off the Backend when the host
1668
+ * does not.
1669
+ */
1670
+ lineage?: boolean;
1671
+ }
1672
+ interface SdkEnvironment {
1673
+ datasets: Record<string, DatasetDescriptor>;
1674
+ user: User;
1675
+ /** Where queries and field suggestions go. The SDK knows nothing about the server behind it. */
1676
+ backend: Backend;
1677
+ /** Absent means the host did not say, and nothing is blocked; only an explicit `false` throws. */
1678
+ features?: SdkFeatures;
1679
+ /** Draws and saves a rendering: given by the frame bootstrap, which can reach the page and the host. */
1680
+ render?: (request: RenderRequest) => Promise<Rendering>;
1681
+ }
1682
+ /** A rendering's file format. A PDF is one page the size of the rendering. */
1683
+ type RenderFormat = 'png' | 'pdf';
1684
+ /**
1685
+ * What to render, and how. `block` or `container` names one node of the structure by its id;
1686
+ * neither renders the whole app.
1687
+ */
1688
+ interface RenderRequest {
1689
+ block?: string;
1690
+ container?: string;
1691
+ format: RenderFormat;
1692
+ /** The file's name, with the format's extension added when it has none. */
1693
+ filename?: string;
1694
+ /** Device pixels per CSS pixel. Defaults to the screen's, at least 2, lowered to fit a canvas. */
1695
+ pixelRatio?: number;
1696
+ }
1697
+ /** A picture of the app, or of one node, as the reader saw it: saved for them, and handed back. */
1698
+ interface Rendering {
1699
+ filename: string;
1700
+ format: RenderFormat;
1701
+ /** In CSS pixels: what was drawn, before `pixelRatio`. */
1702
+ width: number;
1703
+ height: number;
1704
+ blob: Blob;
1705
+ /**
1706
+ * Images left blank in the picture, by URL: their servers send no CORS headers, so the browser
1707
+ * won't let them be drawn. Their space is kept. Empty when nothing was left out.
1708
+ */
1709
+ omitted: string[];
1710
+ }
1711
+ type ConditionValue = string | number | boolean;
1712
+ /**
1713
+ * Mirrors the operator discriminator of the public query API, in full — including operators no
1714
+ * control constructs. `transform_date_drill` is what `createDateDrill` spells so an author never
1715
+ * has to; the `transform_pop_*` family has no constructor here at all and is reachable only by
1716
+ * writing the condition out, which is the point of mirroring the published list rather than the
1717
+ * subset this package happens to build.
1718
+ */
1719
+ type Operator = 'is' | 'is_not' | 'is_null' | 'not_null' | 'greater_than' | 'less_than' | 'between' | 'contains' | 'does_not_contain' | 'starts_with' | 'ends_with' | 'matches' | 'is_true' | 'is_false' | 'last' | 'next' | 'before' | 'after' | 'matches_user_attribute' | 'transform_pop_relative' | 'transform_pop_absolute' | 'transform_pop_none' | 'transform_date_drill' | 'none';
1720
+ interface Condition {
1721
+ operator: Operator;
1722
+ values?: ConditionValue[];
1723
+ /** Date unit for relative operators (`last`, `next`, `transform_pop_relative`). */
1724
+ modifier?: string;
1725
+ }
1726
+ type DateGrain = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute';
1727
+ type DateTransformation = `datetrunc ${DateGrain}`;
1728
+ type Aggregation = 'sum' | 'avg' | 'max' | 'min' | 'count' | 'count distinct' | 'median' | 'stdev' | 'stdevp' | 'var' | 'varp' | 'running sum' | 'running avg' | 'running max' | 'running min' | 'custom';
1729
+ /**
1730
+ * A query is a dataset and a raw AQL body — nothing else. The SDK does not parse or validate the
1731
+ * AQL: a syntax error, an unknown field, or an ambiguous name surfaces as a `QueryError` at
1732
+ * execute, not as a `ValidationError` here. See docs/adr/0001.
1733
+ *
1734
+ * Everything the AQL text can say — dimensions, measures, adhoc fields, static filters, its own
1735
+ * sort or limit — belongs in the AQL. `pageSize` is the one exception: paging through a result is
1736
+ * a viewer interaction, not part of what the query means, so it is declared here rather than
1737
+ * re-authored on every page turn. A query that declares none isn't paged and gets every row.
1738
+ *
1739
+ * ```ts
1740
+ * app.createQuery('revenue', {
1741
+ * dataset: 'sales',
1742
+ * aql: `
1743
+ * explore {
1744
+ * dimensions { month: date_trunc(orders.created_at, "month") }
1745
+ * measures { total: orders | sum(orders.amount) }
1746
+ * filters { orders.status is "completed" }
1747
+ * }
1748
+ * `,
1749
+ * });
1750
+ * ```
1751
+ */
1752
+ interface QueryDeclaration {
1753
+ dataset: string;
1754
+ aql: string;
1755
+ /**
1756
+ * Rows per page, a whole number of at least 1. Past the first page, use `fetchMore()`. Leave it
1757
+ * out to get every row in one result. anfra can't page a pivot query (`rows { }` / `columns { }`),
1758
+ * so a pivot query must not declare one.
1759
+ */
1760
+ pageSize?: number;
1761
+ }
1762
+ /**
1763
+ * A sort applied to a query's result, independent of the query itself — the same mechanism a
1764
+ * click on a table's column header uses, and one that never re-runs the query against the
1765
+ * warehouse. `field` is a result column name, as `ColumnMeta.name` reports it, not a field
1766
+ * reference. See docs/adr/0001.
1767
+ */
1768
+ interface QuerySort {
1769
+ field: string;
1770
+ direction?: 'asc' | 'desc';
1771
+ }
1772
+ type FilterValueType = 'string' | 'number' | 'date' | 'boolean';
1773
+ interface FilterDeclaration {
1774
+ /** Present for a field-backed filter: where options come from. Absent means a manual filter. */
1775
+ field?: string;
1776
+ /** Required for a manual filter; inferred from `field` otherwise. */
1777
+ type?: FilterValueType;
1778
+ /** Static option list for a manual filter. Absent or empty means free input. */
1779
+ options?: ConditionValue[];
1780
+ label?: string;
1781
+ default?: Condition;
1782
+ }
1783
+ interface DateDrillDeclaration {
1784
+ default?: DateGrain;
1785
+ label?: string;
1786
+ }
1787
+ interface AppDeclaration {
1788
+ title?: string;
1789
+ /**
1790
+ * Omitted means the server applies the tenant reporting timezone — the SDK does not guess the
1791
+ * browser's. Part of the declaration, not the environment: two apps in one host may differ.
1792
+ */
1793
+ timezone?: string;
1794
+ }
1795
+ /**
1796
+ * Describes one result column. Classified server-side, since the SDK never parses the AQL that
1797
+ * produced it: an adhoc field first, else a real dataset field — the same order a filter's target
1798
+ * resolves in. This is what lets a control mapping or cross-filter know which columns it can
1799
+ * target. See docs/adr/0001.
1800
+ */
1801
+ interface ColumnMeta {
1802
+ /** This column's key in each result row — see `Row`. Can differ from `fieldName`; see there. */
1803
+ name: string;
1804
+ /**
1805
+ * This column's own field name — always the real one, regardless of what `name` resolved to.
1806
+ * Paired with `modelId`, this is what a control mapping or cross-filter actually targets.
1807
+ * Diverges from `name` exactly when the compiled query declared its own alias for an existing
1808
+ * field or a transformed dimension (`orders: count_i`, or
1809
+ * `time: date_trunc(beer_orders.order_time, "month")`).
1810
+ */
1811
+ fieldName: string;
1812
+ /** The model this column's field is attached to, absent for a metric-shaped reference. */
1813
+ modelId?: string;
1814
+ label: string;
1815
+ /** True when this column is a query-local AQL expression, not a field the dataset defines. */
1816
+ adhoc: boolean;
1817
+ isMeasure: boolean;
1818
+ aggregation?: string;
1819
+ /**
1820
+ * What the column's values mean: decide by it, never by `typeof`. A `number` column's values are
1821
+ * strings with every digit (`"9007199254740993"`, `"12345.67"`, `"NaN"`). `unknown` when the
1822
+ * query's type has no meaning in AML yet. See docs/designs/result-values.md.
1823
+ */
1824
+ semantic_type: SemanticType;
1825
+ /** The Arrow type the values were read as: whether a JS number would keep every digit, say. */
1826
+ arrow_type: ArrowType;
1827
+ /** The database's own name of the type: for debugging, never to decide on. */
1828
+ db_type: string;
1829
+ }
1830
+ /**
1831
+ * What a column's values mean, in AML's types, plus `bit`: a true or false stored as a bit, written
1832
+ * as `true` and `false` or as `"1"` and `"0"` by how the database produced it. `unknown` for a type
1833
+ * AML gives no meaning yet.
1834
+ */
1835
+ type SemanticType = 'text' | 'number' | 'date' | 'datetime' | 'truefalse' | 'json' | 'bit' | 'unknown';
1836
+ /**
1837
+ * An Arrow type: Arrow's `Type` of format/Schema.fbs as JSON. `type` is its name (`int`,
1838
+ * `floating_point`, `decimal`, `utf8`, `timestamp`, …), its other keys that type's fields in
1839
+ * snake_case (`bit_width`, `scale`, `unit`, …), and `label` how arrow-go spells it, for people.
1840
+ */
1841
+ interface ArrowType {
1842
+ type: string;
1843
+ label: string;
1844
+ [field: string]: unknown;
1845
+ }
1846
+ type Row = Record<string, unknown>;
1847
+ /**
1848
+ * Where a result came from.
1849
+ *
1850
+ * `executedAql` and `executedSql` are present only for readers permitted to see generated SQL —
1851
+ * absent means not permitted, rather than "there was none". `executedAt` on a cached result is
1852
+ * when the *cached* run happened, which may be hours earlier, so it should be labelled rather
1853
+ * than shown as if it just ran — the figures can be stale even though they are this reader's own.
1854
+ */
1855
+ interface QueryDebug {
1856
+ executedAql?: string;
1857
+ executedSql?: string;
1858
+ fromCache: boolean;
1859
+ executedAt?: Date;
1860
+ }
1861
+ interface QueryResult {
1862
+ columns: ColumnMeta[];
1863
+ rows: Row[];
1864
+ meta: {
1865
+ /** Present only for a query that declares a `pageSize`. */
1866
+ page?: number;
1867
+ /** Present only for a query that declares a `pageSize`. */
1868
+ pageSize?: number;
1869
+ numRows: number;
1870
+ };
1871
+ debug?: QueryDebug;
1872
+ }
1873
+ type QueryState = 'idle' | 'executing' | 'success' | 'error';
1874
+ interface ExecuteSummary {
1875
+ succeeded: string[];
1876
+ failed: string[];
1877
+ }
1878
+ interface ExecuteOptions {
1879
+ /** Re-run every query, not only dirty ones. */
1880
+ force?: boolean;
1881
+ /** Ask the server to skip its result cache. */
1882
+ bustCache?: boolean;
1883
+ }
1884
+ type Unsubscribe = () => void;
1885
+ type Listener = () => void;
1886
+ /**
1887
+ * One condition derived from a selection.
1888
+ *
1889
+ * A selection's values are never absent — a condition with nothing to match is not emitted at all —
1890
+ * and it never carries a modifier: the three operators a selection produces — `is`, `is_null` and
1891
+ * `matches` — take none.
1892
+ */
1893
+ interface SelectionCondition {
1894
+ field: string;
1895
+ operator: Operator;
1896
+ values: ConditionValue[];
1897
+ }
1898
+ /**
1899
+ * What the reader has picked out of one query's results, and the conditions it puts on that
1900
+ * query's cross-filter targets.
1901
+ *
1902
+ * App-scoped and singular: a selection belongs to no single query, and picking rows in a second
1903
+ * query replaces it. Held on the app for that reason alone — every control still owns its own
1904
+ * condition.
1905
+ */
1906
+ interface Selection {
1907
+ /** Name of the query the rows came from. */
1908
+ source: string;
1909
+ /** The rows as the author passed them, verbatim. */
1910
+ rows: readonly Row[];
1911
+ /**
1912
+ * The dimension aliases the conditions were derived from — every declared one, or those
1913
+ * `select` narrowed to. What makes a re-run of the source comparable against `rows`.
1914
+ */
1915
+ fields: readonly string[];
1916
+ conditions: readonly SelectionCondition[];
1917
+ /**
1918
+ * Set instead of `conditions` when the field-by-field collapse would have been lossy: one AQL
1919
+ * condition saying exactly what the reader picked, as an OR over the rows.
1920
+ *
1921
+ * Only reached this way. The structured form is the proven path and stays in charge whenever it
1922
+ * can say what the selection means, which is every single-dimension and every contiguous case.
1923
+ */
1924
+ expression?: string;
1925
+ /**
1926
+ * True when the conditions sent admit rows the reader did not pick, or condition on less than
1927
+ * they picked.
1928
+ *
1929
+ * Two causes, and only one is fixable. A field-by-field collapse over-selects — picking
1930
+ * `(APAC, Jan)` and `(EMEA, Feb)` ANDs to `region IN (APAC, EMEA) AND month IN (Jan, Feb)`,
1931
+ * which also admits `(APAC, Feb)` — and that case is sent as an `expression` instead, so it is
1932
+ * not lossy. What survives is a dropped query-local column: an adhoc field exists only in this
1933
+ * query's result, so no condition of any shape can name it in the target. Reported rather than
1934
+ * hidden, because otherwise it reads as a data bug.
1935
+ */
1936
+ lossy: boolean;
1937
+ }
1938
+ type EntityKind = 'query' | 'filter' | 'dateDrill';
1939
+ interface EntityRef {
1940
+ kind: EntityKind;
1941
+ name: string;
1942
+ }
1943
+ /**
1944
+ * One directed edge in the app's entity graph, tagged by kind.
1945
+ *
1946
+ * A single list rather than one per kind, mirroring Dashboard as Code's `definition.interactions`,
1947
+ * which carries all five of its interaction kinds discriminated by `type`. The tag is what makes
1948
+ * that workable: a consumer branches explicitly instead of inferring the kind from which optional
1949
+ * fields happen to be present. See docs/adr/0005.
1950
+ */
1951
+ /** A control conditioning one field of one query. */
1952
+ interface ControlMappingJson {
1953
+ kind: 'control';
1954
+ id: string;
1955
+ from: EntityRef;
1956
+ to: EntityRef;
1957
+ field: string;
1958
+ aggregation?: FilterAggregation;
1959
+ }
1960
+ /**
1961
+ * A query that may cross-filter another. Deliberately carries no field: which fields a selection
1962
+ * conditions is decided when the reader clicks, not when the edge is declared — the same asymmetry
1963
+ * that makes `CrossFilterInteraction` the one Dashboard as Code interaction without a `field_path`.
1964
+ */
1965
+ interface CrossFilterJson {
1966
+ kind: 'crossFilter';
1967
+ id: string;
1968
+ from: EntityRef;
1969
+ to: EntityRef;
1970
+ }
1971
+ type MappingJson = ControlMappingJson | CrossFilterJson;
1972
+ interface AppJson {
1973
+ title?: string;
1974
+ timezone?: string;
1975
+ queries: Record<string, QueryDeclaration>;
1976
+ filters: Record<string, FilterDeclaration>;
1977
+ dateDrills: Record<string, DateDrillDeclaration>;
1978
+ mappings: MappingJson[];
1979
+ }
1980
+ /**
1981
+ * An app's declaration and runtime state as plain data, for a host to render outside the sandbox.
1982
+ *
1983
+ * Built by reading the live objects rather than serialising them. Everything worth showing sits
1984
+ * behind a getter, and getters do not survive a structured clone; the objects holding them carry
1985
+ * an `AbortController`, a backend and a bag of closures, which do not survive one either. So this
1986
+ * is written out field by field, and stays plain all the way down. See docs/adr/0007.
1987
+ */
1988
+ interface InspectedError {
1989
+ name: string;
1990
+ message: string;
1991
+ /** The query or control the error is about. Lost if the error itself is cloned. */
1992
+ entity?: string;
1993
+ status?: number;
1994
+ stack?: string;
1995
+ }
1996
+ /** The two kinds of entity a marked element can be drawn by. */
1997
+ type LocateKind = 'query' | 'control';
1998
+ type StructureKind = 'container' | 'block' | LocateKind;
1999
+ /**
2000
+ * One node of the structure. A container or block has an `id`; a query or control node has the
2001
+ * entity's `app` index and `name`. `key` is the node's index path in the tree (`0.2.1`), what a
2002
+ * host uses to point at it; it is stable while the tree is unchanged.
2003
+ */
2004
+ interface StructureNode {
2005
+ key: string;
2006
+ kind: StructureKind;
2007
+ id?: string;
2008
+ label?: string;
2009
+ app?: number;
2010
+ name?: string;
2011
+ /** What is wrong with this node's markup, in words. Reported, never thrown. */
2012
+ problems: string[];
2013
+ children: StructureNode[];
2014
+ }
2015
+ /** Where one entity is drawn: how many marked elements, and which blocks they are in. */
2016
+ interface EntityUsage {
2017
+ markers: number;
2018
+ blocks: string[];
2019
+ }
2020
+ interface InspectedStructure {
2021
+ nodes: StructureNode[];
2022
+ /** Keyed `query:<app>/<name>` or `control:<app>/<name>`; only entities that exist. */
2023
+ usage: Record<string, EntityUsage>;
2024
+ }
2025
+ /** What a host asks a frame to locate: a node of the structure, or an entity wherever it is drawn. */
2026
+ type LocateTarget = {
2027
+ node: string;
2028
+ } | {
2029
+ app: number;
2030
+ kind: LocateKind;
2031
+ name: string;
2032
+ };
2033
+ interface InspectedQuery {
2034
+ state: QueryState;
2035
+ /** True when re-running would produce something new. */
2036
+ isDirty: boolean;
2037
+ page: number;
2038
+ hasMore: boolean;
2039
+ /** Column metadata only. Rows are deliberately absent — see docs/adr/0007. */
2040
+ columns: ColumnMeta[];
2041
+ rowCount: number;
2042
+ selectedRowCount: number;
2043
+ /** Everything that decides whether this query re-runs, which is the question a stale panel asks. */
2044
+ signature: string;
2045
+ error?: InspectedError;
2046
+ debug?: QueryDebug;
2047
+ }
2048
+ interface InspectedControl {
2049
+ kind: EntityKind;
2050
+ /** What the reader has set. */
2051
+ condition: Condition;
2052
+ /** What the query last ran with, absent before the first execution. */
2053
+ appliedCondition?: Condition;
2054
+ isDirty: boolean;
2055
+ /** Field-backed filters only, and only once loaded. */
2056
+ options?: ConditionValue[];
2057
+ }
2058
+ interface InspectedSelection {
2059
+ source: string;
2060
+ fields: readonly string[];
2061
+ rowCount: number;
2062
+ conditions: readonly SelectionCondition[];
2063
+ expression?: string;
2064
+ /** Surfaced here because it otherwise only ever reaches a `console.warn`. */
2065
+ lossy: boolean;
2066
+ }
2067
+ interface InspectedApp {
2068
+ title?: string;
2069
+ timezone?: string;
2070
+ hasChanges: boolean;
2071
+ declaration: AppJson;
2072
+ queries: Record<string, InspectedQuery>;
2073
+ controls: Record<string, InspectedControl>;
2074
+ selection?: InspectedSelection;
2075
+ appliedSelection?: InspectedSelection;
2076
+ }
2077
+ /** One control-mapping or cross-filter condition on a query, as structured data. */
2078
+ interface BackendFilter {
2079
+ /** `model.field` for a dataset field, or a bare name for a dataset metric. */
2080
+ field: string;
2081
+ operator: Operator;
2082
+ values: ConditionValue[];
2083
+ /** Date unit for relative operators (`last`, `next`). */
2084
+ modifier?: string;
2085
+ /** Present on an aggregated mapping: the condition applies to this aggregate of `field`. */
2086
+ aggregation?: FilterAggregation;
2087
+ }
2088
+ /**
2089
+ * An AQL condition applied on top of the query: the escape hatch for a cross-filter selection the
2090
+ * ANDed `filters` cannot express, such as `(A and B) or (C and D)`. Generated, never author-written.
2091
+ */
2092
+ type BackendCondition = Schemas['QueryCondition'];
2093
+ /** A reader's sort, naming a result column. Replaces the query's own `sorts` when present. */
2094
+ type BackendSort = Schemas['QuerySort'];
2095
+ /** Redraw every dimension built directly on `field` at `grain`, keeping its alias. Not a filter. */
2096
+ interface BackendDateDrill {
2097
+ field: string;
2098
+ grain: DateGrain;
2099
+ }
2100
+ /** The structured additions a query carries on this run, applied on top of its AQL. */
2101
+ interface QueryInput {
2102
+ filters: BackendFilter[];
2103
+ conditions: BackendCondition[];
2104
+ sorts: BackendSort[];
2105
+ dateDrills: BackendDateDrill[];
2106
+ }
2107
+ interface BackendQueryRequest {
2108
+ /** The dataset's `name`, as in `DatasetDescriptor.name`. */
2109
+ dataset: string;
2110
+ /** The query's AQL, verbatim. */
2111
+ aql: string;
2112
+ input: QueryInput;
2113
+ /** 1-based. Sent together with `pageSize`, and only for a query that declares one. */
2114
+ page?: number;
2115
+ /** Absent for an unpaged query: the backend returns every row. */
2116
+ pageSize?: number;
2117
+ /** Absent when the app declares none, leaving the backend's default. */
2118
+ timezone?: string;
2119
+ /** Present on `refresh()`: skip any result cache. */
2120
+ bustCache?: boolean;
2121
+ }
2122
+ /** One page of a query's rows. `values` is positional: each row lines up with `columns`. */
2123
+ interface BackendQueryResult {
2124
+ columns: ColumnMeta[];
2125
+ values: unknown[][];
2126
+ meta?: {
2127
+ page?: number;
2128
+ pageSize?: number;
2129
+ numRows?: number;
2130
+ };
2131
+ debug?: QueryDebug;
2132
+ }
2133
+ /** A file format an export can be written in. CSV is the only one yet; a server may add more. */
2134
+ type ExportFormat = 'csv' | (string & {});
2135
+ /** A format's options. Each applies to the formats it names; the server refuses one given to another. */
2136
+ type ExportFormatOptions = Schemas['ExportFormatOptions'];
2137
+ /** What `query.export()` takes. Every field is optional. */
2138
+ interface ExportOptions {
2139
+ /**
2140
+ * The file's name, with the format's extension added when it has none. Defaults to the app's
2141
+ * title and the query's name (`Sales - revenueByMonth.csv`), or the query's name alone.
2142
+ */
2143
+ filename?: string;
2144
+ /** `csv` unless given. */
2145
+ format?: ExportFormat;
2146
+ /** For CSV, `bom` defaults to `true`: a person opens what a Data App exports. */
2147
+ formatOptions?: ExportFormatOptions;
2148
+ /** Cancels the export. `query.abort()` does not: an export is not the query's run. */
2149
+ signal?: AbortSignal;
2150
+ }
2151
+ /**
2152
+ * A query's whole result as a file: what the Backend made, and the host has already started
2153
+ * saving for the reader. `url` works with a plain `GET` until `expiresAt`.
2154
+ */
2155
+ interface ExportResult {
2156
+ url: string;
2157
+ filename: string;
2158
+ format: ExportFormat;
2159
+ /** The rows the file holds. */
2160
+ rowCount: number;
2161
+ expiresAt: Date;
2162
+ }
2163
+ /**
2164
+ * An export: the same query a run sends, built by the same code so the two cannot drift, but with
2165
+ * no page (an export is every row) and no cache to bust; plus the file's format and name.
2166
+ */
2167
+ interface BackendExportRequest {
2168
+ /** The dataset's `name`, as in `DatasetDescriptor.name`. */
2169
+ dataset: string;
2170
+ /** The query's AQL, verbatim. */
2171
+ aql: string;
2172
+ input: QueryInput;
2173
+ /** Absent when the app declares none, leaving the backend's default. */
2174
+ timezone?: string;
2175
+ format?: ExportFormat;
2176
+ formatOptions?: ExportFormatOptions;
2177
+ filename?: string;
2178
+ }
2179
+ interface FieldSuggestionsRequest {
2180
+ /** The dataset's `name`. */
2181
+ dataset: string;
2182
+ model: string;
2183
+ field: string;
2184
+ /** What the reader has typed so far; empty for the first page of options. */
2185
+ q: string;
2186
+ }
2187
+ /** What `Anfra.lineage()` takes besides its fields. Every field is optional. */
2188
+ interface LineageOptions {
2189
+ /** At most this many upstream entities per field. All of them unless given. */
2190
+ limit?: number;
2191
+ /** Skip this many upstream entities first, to page with `limit`. */
2192
+ offset?: number;
2193
+ /** Cancels the call. */
2194
+ signal?: AbortSignal;
2195
+ }
2196
+ /** A field to trace: its parent, and its name in it. */
2197
+ type LineageTarget = Schemas['LineageTarget'];
2198
+ /** A lineage call: the fields to trace, and the page of what each is built from. */
2199
+ type BackendLineageRequest = Omit<Schemas['LineageInput'], 'targets'> & {
2200
+ targets: LineageTarget[];
2201
+ };
2202
+ /** Each field's lineage, in the order asked. */
2203
+ type LineageResult = Schemas['LineageResult'];
2204
+ /** One field's lineage, or why it could not be traced: exactly one of `diagram` and `error`. */
2205
+ type FieldLineage = Schemas['FieldLineage'];
2206
+ /**
2207
+ * A field's lineage, laid out to be drawn, in the API's own names: cards (the entities drawn at the
2208
+ * top level, their children nested in `sections`) in layers, upstream first, linked by what uses
2209
+ * what. `schema` says which entity types it has and how they connect.
2210
+ */
2211
+ type LineageDiagram = Schemas['Diagram'];
2212
+ /** An entity of a lineage diagram. */
2213
+ type LineageNode = Schemas['DiagramNode'];
2214
+ /** A node drawn at the top level, in its layer. */
2215
+ type LineageCard = Schemas['DiagramCard'];
2216
+ /**
2217
+ * What the SDK sends queries to, supplied by the provisioner. Each call either resolves or
2218
+ * rejects; how the backend gets there (synchronously, as polled jobs, over a bridge) is its own
2219
+ * business. A call whose `signal` aborts may reject with an `AbortError`, and its result is
2220
+ * ignored either way. Reject with a `DataAppError` (`PermissionError`, `QueryError`, ...) to choose
2221
+ * the error an author sees; anything else surfaces as a `QueryError`.
2222
+ */
2223
+ interface Backend {
2224
+ submitQuery(request: BackendQueryRequest, signal: AbortSignal): Promise<BackendQueryResult>;
2225
+ fieldSuggestions(request: FieldSuggestionsRequest, signal: AbortSignal): Promise<ConditionValue[]>;
2226
+ /**
2227
+ * Export a query's whole result as a file, and answer its link once the file is ready. Optional:
2228
+ * a host that cannot export leaves it out, and `query.export()` rejects with a `TransportError`.
2229
+ */
2230
+ exportQuery?(request: BackendExportRequest, signal: AbortSignal): Promise<ExportResult>;
2231
+ /**
2232
+ * Trace fields through the catalog: what each is built from. Optional: a host that cannot leaves
2233
+ * it out, and `Anfra.lineage()` rejects with a `TransportError`.
2234
+ */
2235
+ lineage?(request: BackendLineageRequest, signal: AbortSignal): Promise<LineageResult>;
2236
+ }
2237
+
2238
+ export { type Operator as $, type Aggregation as A, type Backend as B, type ColumnMeta as C, type DatasetDescriptor as D, type EntityKind as E, FILTER_AGGREGATIONS as F, type FieldLineage as G, type FieldSuggestionsRequest as H, type FilterAggregation as I, type FilterDeclaration as J, type FilterValueType as K, type InspectedApp as L, type InspectedControl as M, type InspectedError as N, type InspectedQuery as O, type InspectedSelection as P, type InspectedStructure as Q, type LineageCard as R, type LineageDiagram as S, type LineageNode as T, type LineageOptions as U, type LineageResult as V, type LineageTarget as W, type Listener as X, type LocateKind as Y, type LocateTarget as Z, type MappingJson as _, type AppDeclaration as a, type QueryDebug as a0, type QueryDeclaration as a1, type QueryInput as a2, type QueryResult as a3, type QuerySort as a4, type QueryState as a5, type RenderFormat as a6, type RenderRequest as a7, type Rendering as a8, type Row as a9, type SdkEnvironment as aa, type SdkFeatures as ab, type Selection as ac, type SelectionCondition as ad, type SemanticType as ae, type StructureKind as af, type StructureNode as ag, type Unsubscribe as ah, type User as ai, type paths as aj, type components as ak, type AppJson as b, type ArrowType as c, type BackendCondition as d, type BackendDateDrill as e, type BackendExportRequest as f, type BackendFilter as g, type BackendLineageRequest as h, type BackendQueryRequest as i, type BackendQueryResult as j, type BackendSort as k, type Condition as l, type ConditionValue as m, type ControlMappingJson as n, type CrossFilterJson as o, type DateDrillDeclaration as p, type DateGrain as q, type DateTransformation as r, type EntityRef as s, type EntityUsage as t, type ExecuteOptions as u, type ExecuteSummary as v, type ExportFormat as w, type ExportFormatOptions as x, type ExportOptions as y, type ExportResult as z };