@katerai/sdk 0.9.0 → 0.11.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.
Files changed (99) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/client.d.mts.map +1 -1
  3. package/client.d.ts.map +1 -1
  4. package/client.js +7 -0
  5. package/client.js.map +1 -1
  6. package/client.mjs +7 -0
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/v1/compiler/cache.d.mts +4 -0
  10. package/resources/v1/compiler/cache.d.mts.map +1 -0
  11. package/resources/v1/compiler/cache.d.ts +4 -0
  12. package/resources/v1/compiler/cache.d.ts.map +1 -0
  13. package/resources/v1/compiler/cache.js +9 -0
  14. package/resources/v1/compiler/cache.js.map +1 -0
  15. package/resources/v1/compiler/cache.mjs +5 -0
  16. package/resources/v1/compiler/cache.mjs.map +1 -0
  17. package/resources/v1/compiler/combination.d.mts +120 -0
  18. package/resources/v1/compiler/combination.d.mts.map +1 -0
  19. package/resources/v1/compiler/combination.d.ts +120 -0
  20. package/resources/v1/compiler/combination.d.ts.map +1 -0
  21. package/resources/v1/compiler/combination.js +30 -0
  22. package/resources/v1/compiler/combination.js.map +1 -0
  23. package/resources/v1/compiler/combination.mjs +26 -0
  24. package/resources/v1/compiler/combination.mjs.map +1 -0
  25. package/resources/v1/compiler/compiler.d.mts +2291 -0
  26. package/resources/v1/compiler/compiler.d.mts.map +1 -0
  27. package/resources/v1/compiler/compiler.d.ts +2291 -0
  28. package/resources/v1/compiler/compiler.d.ts.map +1 -0
  29. package/resources/v1/compiler/compiler.js +145 -0
  30. package/resources/v1/compiler/compiler.js.map +1 -0
  31. package/resources/v1/compiler/compiler.mjs +140 -0
  32. package/resources/v1/compiler/compiler.mjs.map +1 -0
  33. package/resources/v1/compiler/index.d.mts +5 -0
  34. package/resources/v1/compiler/index.d.mts.map +1 -0
  35. package/resources/v1/compiler/index.d.ts +5 -0
  36. package/resources/v1/compiler/index.d.ts.map +1 -0
  37. package/resources/v1/compiler/index.js +11 -0
  38. package/resources/v1/compiler/index.js.map +1 -0
  39. package/resources/v1/compiler/index.mjs +5 -0
  40. package/resources/v1/compiler/index.mjs.map +1 -0
  41. package/resources/v1/compiler/manifest.d.mts +52 -0
  42. package/resources/v1/compiler/manifest.d.mts.map +1 -0
  43. package/resources/v1/compiler/manifest.d.ts +52 -0
  44. package/resources/v1/compiler/manifest.d.ts.map +1 -0
  45. package/resources/v1/compiler/manifest.js +29 -0
  46. package/resources/v1/compiler/manifest.js.map +1 -0
  47. package/resources/v1/compiler/manifest.mjs +25 -0
  48. package/resources/v1/compiler/manifest.mjs.map +1 -0
  49. package/resources/v1/compiler.d.mts +1 -1142
  50. package/resources/v1/compiler.d.mts.map +1 -1
  51. package/resources/v1/compiler.d.ts +1 -1142
  52. package/resources/v1/compiler.d.ts.map +1 -1
  53. package/resources/v1/compiler.js +2 -66
  54. package/resources/v1/compiler.js.map +1 -1
  55. package/resources/v1/compiler.mjs +1 -64
  56. package/resources/v1/compiler.mjs.map +1 -1
  57. package/resources/v1/index.d.mts +1 -1
  58. package/resources/v1/index.d.mts.map +1 -1
  59. package/resources/v1/index.d.ts +1 -1
  60. package/resources/v1/index.d.ts.map +1 -1
  61. package/resources/v1/index.js +4 -4
  62. package/resources/v1/index.js.map +1 -1
  63. package/resources/v1/index.mjs +1 -1
  64. package/resources/v1/index.mjs.map +1 -1
  65. package/resources/v1/tenants/tenants.d.mts +66 -10
  66. package/resources/v1/tenants/tenants.d.mts.map +1 -1
  67. package/resources/v1/tenants/tenants.d.ts +66 -10
  68. package/resources/v1/tenants/tenants.d.ts.map +1 -1
  69. package/resources/v1/tenants/tenants.js +27 -4
  70. package/resources/v1/tenants/tenants.js.map +1 -1
  71. package/resources/v1/tenants/tenants.mjs +27 -4
  72. package/resources/v1/tenants/tenants.mjs.map +1 -1
  73. package/resources/v1/v1.d.mts +3 -3
  74. package/resources/v1/v1.d.mts.map +1 -1
  75. package/resources/v1/v1.d.ts +3 -3
  76. package/resources/v1/v1.d.ts.map +1 -1
  77. package/resources/v1/v1.js +2 -2
  78. package/resources/v1/v1.js.map +1 -1
  79. package/resources/v1/v1.mjs +2 -2
  80. package/resources/v1/v1.mjs.map +1 -1
  81. package/src/client.ts +9 -1
  82. package/src/resources/v1/compiler/cache.ts +5 -0
  83. package/src/resources/v1/compiler/combination.ts +157 -0
  84. package/src/resources/v1/compiler/compiler.ts +2991 -0
  85. package/src/resources/v1/compiler/index.ts +30 -0
  86. package/src/resources/v1/compiler/manifest.ts +80 -0
  87. package/src/resources/v1/compiler.ts +1 -1514
  88. package/src/resources/v1/index.ts +7 -1
  89. package/src/resources/v1/tenants/tenants.ts +99 -12
  90. package/src/resources/v1/v1.ts +21 -9
  91. package/src/version.ts +1 -1
  92. package/version.d.mts +1 -1
  93. package/version.d.mts.map +1 -1
  94. package/version.d.ts +1 -1
  95. package/version.d.ts.map +1 -1
  96. package/version.js +1 -1
  97. package/version.js.map +1 -1
  98. package/version.mjs +1 -1
  99. package/version.mjs.map +1 -1
@@ -0,0 +1,2991 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as CompilerAPI from './compiler';
5
+ import * as CacheAPI from './cache';
6
+ import { Cache } from './cache';
7
+ import * as CombinationAPI from './combination';
8
+ import {
9
+ Combination as CombinationAPICombination,
10
+ CombinationPreviewParams,
11
+ CombinationPreviewResponse,
12
+ } from './combination';
13
+ import * as ManifestAPI from './manifest';
14
+ import { ManifestRegenerateAndCreatePrParams, ManifestRegenerateAndCreatePrResponse } from './manifest';
15
+ import { APIPromise } from '../../../core/api-promise';
16
+ import { buildHeaders } from '../../../internal/headers';
17
+ import { RequestOptions } from '../../../internal/request-options';
18
+
19
+ export class Compiler extends APIResource {
20
+ cache: CacheAPI.Cache = new CacheAPI.Cache(this._client);
21
+ combination: CombinationAPI.Combination = new CombinationAPI.Combination(this._client);
22
+ manifest: ManifestAPI.Manifest = new ManifestAPI.Manifest(this._client);
23
+
24
+ /**
25
+ * Compile a resolved query to SQL.
26
+ *
27
+ * Takes a previously resolved query and generates the final SQL statement for the
28
+ * target dialect.
29
+ *
30
+ * RLS: Filtered to current client (ClientRLSDB).
31
+ */
32
+ compile(params: CompilerCompileParams, options?: RequestOptions): APIPromise<CompilerCompileResponse> {
33
+ const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
34
+ return this._client.post('/api/v1/compiler/compile', {
35
+ query: { source },
36
+ body,
37
+ ...options,
38
+ headers: buildHeaders([
39
+ { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
40
+ options?.headers,
41
+ ]),
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Compile a dashboard YAML file into fully resolved widget data.
47
+ *
48
+ * Reads a dashboard YAML from the client repo, resolves all data slots, executes
49
+ * queries, applies filters, and returns renderable widget data.
50
+ *
51
+ * RLS: Filtered to current client (ClientRLSDB).
52
+ */
53
+ compileDashboard(
54
+ params: CompilerCompileDashboardParams,
55
+ options?: RequestOptions,
56
+ ): APIPromise<CompilerCompileDashboardResponse> {
57
+ const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
58
+ return this._client.post('/api/v1/compiler/dashboard', {
59
+ query: { source },
60
+ body,
61
+ ...options,
62
+ headers: buildHeaders([
63
+ { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
64
+ options?.headers,
65
+ ]),
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Enumerate every valid query configuration for a connection.
71
+ *
72
+ * Generates all valid combinations of optional dimensions, measures, calculations,
73
+ * filters, and variable values, constrained by widget category rules.
74
+ *
75
+ * RLS: Filtered to current client (ClientRLSDB).
76
+ */
77
+ enumerate(
78
+ params: CompilerEnumerateParams,
79
+ options?: RequestOptions,
80
+ ): APIPromise<CompilerEnumerateResponse> {
81
+ const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
82
+ return this._client.post('/api/v1/compiler/enumerate', {
83
+ query: { source },
84
+ body,
85
+ ...options,
86
+ headers: buildHeaders([
87
+ { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
88
+ options?.headers,
89
+ ]),
90
+ });
91
+ }
92
+
93
+ /**
94
+ * Execute a query with transparent caching.
95
+ *
96
+ * Compiles the resolved query to SQL, checks the cache for existing results,
97
+ * executes against the warehouse on cache miss, and stores the result for future
98
+ * requests. Cache failures are invisible to the caller.
99
+ *
100
+ * RLS: Filtered to current client (ClientRLSDB).
101
+ */
102
+ execute(params: CompilerExecuteParams, options?: RequestOptions): APIPromise<CompilerExecuteResponse> {
103
+ const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
104
+ return this._client.post('/api/v1/compiler/execute', {
105
+ query: { source },
106
+ body,
107
+ ...options,
108
+ headers: buildHeaders([
109
+ { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
110
+ options?.headers,
111
+ ]),
112
+ });
113
+ }
114
+
115
+ /**
116
+ * Resolve a query template with user-selected parameters.
117
+ *
118
+ * Takes a query reference and variable selections, returns the fully resolved
119
+ * query object ready for compilation.
120
+ *
121
+ * RLS: Filtered to current client (ClientRLSDB).
122
+ */
123
+ resolve(params: CompilerResolveParams, options?: RequestOptions): APIPromise<CompilerResolveResponse> {
124
+ const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
125
+ return this._client.post('/api/v1/compiler/resolve', {
126
+ query: { source },
127
+ body,
128
+ ...options,
129
+ headers: buildHeaders([
130
+ { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
131
+ options?.headers,
132
+ ]),
133
+ });
134
+ }
135
+
136
+ /**
137
+ * Validate a schema file set against a connection.
138
+ *
139
+ * Checks all views, queries, and related schemas for correctness and returns any
140
+ * errors or warnings found.
141
+ *
142
+ * RLS: Filtered to current client (ClientRLSDB).
143
+ */
144
+ validate(params: CompilerValidateParams, options?: RequestOptions): APIPromise<CompilerValidateResponse> {
145
+ const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
146
+ return this._client.post('/api/v1/compiler/validate', {
147
+ query: { source },
148
+ body,
149
+ ...options,
150
+ headers: buildHeaders([
151
+ { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
152
+ options?.headers,
153
+ ]),
154
+ });
155
+ }
156
+ }
157
+
158
+ /**
159
+ * Chart configuration with variable references
160
+ */
161
+ export interface ChartConfig {
162
+ /**
163
+ * Field or variable reference for color grouping
164
+ */
165
+ color_by?: string | null;
166
+
167
+ /**
168
+ * Comparison mode for single_value widgets (e.g., previous_period, target)
169
+ */
170
+ comparison?: 'previous_period' | 'target' | null;
171
+
172
+ /**
173
+ * Field or variable reference for size
174
+ */
175
+ size?: string | null;
176
+
177
+ /**
178
+ * Field or variable reference for stacking
179
+ */
180
+ stack_by?: string | null;
181
+
182
+ /**
183
+ * Target value for comparison: target mode
184
+ */
185
+ target_value?: string | null;
186
+
187
+ /**
188
+ * Field or variable reference for x-axis
189
+ */
190
+ x_axis?: string | null;
191
+
192
+ /**
193
+ * Field or variable reference for y-axis
194
+ */
195
+ y_axis?: string | null;
196
+ }
197
+
198
+ /**
199
+ * A single compiler validation or compilation error.
200
+ */
201
+ export interface CompilerErrorItem {
202
+ /**
203
+ * Machine-readable error code
204
+ */
205
+ code: string;
206
+
207
+ /**
208
+ * Human-readable error description
209
+ */
210
+ message: string;
211
+
212
+ /**
213
+ * Column number in the source file
214
+ */
215
+ column?: number | null;
216
+
217
+ /**
218
+ * Source file path where the error occurred
219
+ */
220
+ file?: string | null;
221
+
222
+ /**
223
+ * Line number in the source file
224
+ */
225
+ line?: number | null;
226
+
227
+ /**
228
+ * Reference to the source element (e.g. view or query name)
229
+ */
230
+ ref?: string | null;
231
+
232
+ /**
233
+ * Suggested fix for this error
234
+ */
235
+ remediation?: string | null;
236
+ }
237
+
238
+ /**
239
+ * An inline field definition for dimensions/measures/calculations
240
+ */
241
+ export interface InlineField {
242
+ /**
243
+ * Unique identifier for this inline field
244
+ */
245
+ kater_id: string;
246
+
247
+ /**
248
+ * Name of the inline field
249
+ */
250
+ name: string;
251
+
252
+ /**
253
+ * SQL expression for the field
254
+ */
255
+ sql: string;
256
+
257
+ /**
258
+ * Human-readable label
259
+ */
260
+ label?: string | null;
261
+ }
262
+
263
+ /**
264
+ * Compilation manifest with all named objects.
265
+ */
266
+ export interface Manifest {
267
+ generated_at: string;
268
+
269
+ objects: { [key: string]: ManifestEntry };
270
+
271
+ schema_version?: string;
272
+ }
273
+
274
+ /**
275
+ * A single object entry in the manifest.
276
+ */
277
+ export interface ManifestEntry {
278
+ kater_id: string;
279
+
280
+ name: string;
281
+
282
+ type: string;
283
+
284
+ label?: string | null;
285
+
286
+ parent_id?: string | null;
287
+
288
+ source_file?: string | null;
289
+ }
290
+
291
+ /**
292
+ * A reference with optional label override
293
+ */
294
+ export interface RefWithLabel {
295
+ /**
296
+ * Reference using ref(), var(), or expr() syntax
297
+ */
298
+ ref: string;
299
+
300
+ /**
301
+ * Optional label override for this reference
302
+ */
303
+ label?: string | null;
304
+ }
305
+
306
+ /**
307
+ * A subquery condition for EXISTS/NOT EXISTS filters
308
+ */
309
+ export interface SubqueryCondition {
310
+ /**
311
+ * Reference to the source view/table for the subquery
312
+ */
313
+ from: string;
314
+
315
+ /**
316
+ * WHERE conditions for the subquery
317
+ */
318
+ where: Array<string>;
319
+ }
320
+
321
+ /**
322
+ * Response model for SQL compilation.
323
+ */
324
+ export interface CompilerCompileResponse {
325
+ /**
326
+ * SQL dialect used (e.g. 'snowflake')
327
+ */
328
+ dialect: string;
329
+
330
+ /**
331
+ * Whether compilation succeeded
332
+ */
333
+ success: boolean;
334
+
335
+ /**
336
+ * Maps UUID column aliases to human-readable names and types
337
+ */
338
+ column_map?: Array<CompilerCompileResponse.ColumnMap>;
339
+
340
+ /**
341
+ * Compilation errors
342
+ */
343
+ errors?: Array<CompilerErrorItem>;
344
+
345
+ /**
346
+ * Compilation manifest with all named objects.
347
+ */
348
+ manifest?: Manifest | null;
349
+
350
+ /**
351
+ * Compilation metadata from the compiler.
352
+ */
353
+ metadata?: CompilerCompileResponse.Metadata | null;
354
+
355
+ /**
356
+ * Write-back request ID. Non-null when files were dispatched to CLI via WebSocket.
357
+ */
358
+ request_id?: string | null;
359
+
360
+ /**
361
+ * Generated SQL statement
362
+ */
363
+ sql?: string | null;
364
+ }
365
+
366
+ export namespace CompilerCompileResponse {
367
+ /**
368
+ * Maps a UUID column alias to its human-readable name and type.
369
+ */
370
+ export interface ColumnMap {
371
+ /**
372
+ * Field type: dimension, measure, or calculation
373
+ */
374
+ field_type: string;
375
+
376
+ /**
377
+ * UUID string used as SQL column alias
378
+ */
379
+ kater_id: string;
380
+
381
+ /**
382
+ * Human-readable column name
383
+ */
384
+ name: string;
385
+
386
+ /**
387
+ * Aggregation type for measures: sum, count, min, max, avg, unknown. None for
388
+ * non-measures.
389
+ */
390
+ aggregation?: string | null;
391
+
392
+ /**
393
+ * Display label
394
+ */
395
+ label?: string | null;
396
+ }
397
+
398
+ /**
399
+ * Compilation metadata from the compiler.
400
+ */
401
+ export interface Metadata {
402
+ /**
403
+ * SQL dialect used (e.g. 'snowflake')
404
+ */
405
+ dialect: string;
406
+
407
+ /**
408
+ * Reference to the compiled query
409
+ */
410
+ query_ref: string;
411
+
412
+ /**
413
+ * Dimension names used in compilation
414
+ */
415
+ dimensions_used?: Array<string>;
416
+
417
+ /**
418
+ * Filter names used in compilation
419
+ */
420
+ filters_used?: Array<string>;
421
+
422
+ /**
423
+ * Measure names used in compilation
424
+ */
425
+ measures_used?: Array<string>;
426
+
427
+ /**
428
+ * View names used in compilation
429
+ */
430
+ views_used?: Array<string>;
431
+ }
432
+ }
433
+
434
+ /**
435
+ * Response from dashboard compilation — fully resolved dashboard.
436
+ */
437
+ export interface CompilerCompileDashboardResponse {
438
+ /**
439
+ * Dashboard context for widgets
440
+ */
441
+ context: CompilerCompileDashboardResponse.Context;
442
+
443
+ /**
444
+ * Dashboard metadata
445
+ */
446
+ dashboard: CompilerCompileDashboardResponse.Dashboard;
447
+
448
+ /**
449
+ * Dashboard-level compilation errors
450
+ */
451
+ errors?: Array<CompilerErrorItem>;
452
+
453
+ /**
454
+ * Resolved filter definitions with current values
455
+ */
456
+ filters?: Array<CompilerCompileDashboardResponse.Filter>;
457
+
458
+ /**
459
+ * Fully resolved widgets with data + config
460
+ */
461
+ widgets?: Array<CompilerCompileDashboardResponse.Widget>;
462
+ }
463
+
464
+ export namespace CompilerCompileDashboardResponse {
465
+ /**
466
+ * Dashboard context for widgets
467
+ */
468
+ export interface Context {
469
+ /**
470
+ * Active filter values: {name: {value, label}}
471
+ */
472
+ filters?: { [key: string]: { [key: string]: unknown } } | null;
473
+
474
+ /**
475
+ * Active timeframe: {label, start, end}
476
+ */
477
+ timeframe?: { [key: string]: string } | null;
478
+
479
+ /**
480
+ * Dashboard topic: {label, time_dimension}
481
+ */
482
+ topic?: { [key: string]: string } | null;
483
+ }
484
+
485
+ /**
486
+ * Dashboard metadata
487
+ */
488
+ export interface Dashboard {
489
+ /**
490
+ * Dashboard name
491
+ */
492
+ name: string;
493
+
494
+ /**
495
+ * Dashboard description
496
+ */
497
+ description?: string | null;
498
+
499
+ /**
500
+ * Dashboard kater_id
501
+ */
502
+ kater_id?: string | null;
503
+
504
+ /**
505
+ * Dashboard display label
506
+ */
507
+ label?: string | null;
508
+
509
+ /**
510
+ * Dashboard topic reference
511
+ */
512
+ topic?: string | null;
513
+ }
514
+
515
+ /**
516
+ * A resolved dashboard filter with current value and presets.
517
+ */
518
+ export interface Filter {
519
+ /**
520
+ * Filter type: date_range, multi_select, select
521
+ */
522
+ filter_type: string;
523
+
524
+ /**
525
+ * Filter name
526
+ */
527
+ name: string;
528
+
529
+ /**
530
+ * Whether null (All) is allowed
531
+ */
532
+ allow_null?: boolean;
533
+
534
+ /**
535
+ * Whether filter auto-applies to queries
536
+ */
537
+ auto_apply?: boolean;
538
+
539
+ /**
540
+ * Current filter value
541
+ */
542
+ current_value?: string | Array<string> | null;
543
+
544
+ /**
545
+ * Default value specification
546
+ */
547
+ default?: { [key: string]: string } | null;
548
+
549
+ /**
550
+ * Field reference for data-driven filters
551
+ */
552
+ field?: string | null;
553
+
554
+ /**
555
+ * Label for null/All option
556
+ */
557
+ null_label?: string | null;
558
+
559
+ /**
560
+ * Available presets
561
+ */
562
+ presets?: Array<{ [key: string]: string }> | null;
563
+ }
564
+
565
+ /**
566
+ * A fully resolved widget ready for rendering.
567
+ */
568
+ export interface Widget {
569
+ /**
570
+ * Column metadata (single or multi-query)
571
+ */
572
+ column_map: Array<Widget.UnionMember0> | Array<Array<Widget.UnionMember1>>;
573
+
574
+ /**
575
+ * Fully resolved WidgetConfig
576
+ */
577
+ config: { [key: string]: unknown };
578
+
579
+ /**
580
+ * Query result data (single or multi-query)
581
+ */
582
+ data: Array<{ [key: string]: unknown }> | Array<Array<{ [key: string]: unknown }>>;
583
+
584
+ /**
585
+ * Grid position
586
+ */
587
+ grid: Widget.Grid;
588
+
589
+ /**
590
+ * Widget unique identifier
591
+ */
592
+ kater_id: string;
593
+
594
+ /**
595
+ * Widget name
596
+ */
597
+ name: string;
598
+
599
+ /**
600
+ * Display mode for multi-query: 'tabs' or 'grid'
601
+ */
602
+ display_mode?: string | null;
603
+
604
+ /**
605
+ * Per-widget compilation errors
606
+ */
607
+ errors?: Array<CompilerAPI.CompilerErrorItem>;
608
+
609
+ /**
610
+ * Per-slot configs for multi-query containers
611
+ */
612
+ slot_configs?: Array<{ [key: string]: unknown }> | null;
613
+
614
+ /**
615
+ * Resolved widget type
616
+ */
617
+ widget_type?: string | null;
618
+ }
619
+
620
+ export namespace Widget {
621
+ /**
622
+ * Maps a UUID column alias to its human-readable name and type.
623
+ */
624
+ export interface UnionMember0 {
625
+ /**
626
+ * Field type: dimension, measure, or calculation
627
+ */
628
+ field_type: string;
629
+
630
+ /**
631
+ * UUID string used as SQL column alias
632
+ */
633
+ kater_id: string;
634
+
635
+ /**
636
+ * Human-readable column name
637
+ */
638
+ name: string;
639
+
640
+ /**
641
+ * Aggregation type for measures: sum, count, min, max, avg, unknown. None for
642
+ * non-measures.
643
+ */
644
+ aggregation?: string | null;
645
+
646
+ /**
647
+ * Display label
648
+ */
649
+ label?: string | null;
650
+ }
651
+
652
+ /**
653
+ * Maps a UUID column alias to its human-readable name and type.
654
+ */
655
+ export interface UnionMember1 {
656
+ /**
657
+ * Field type: dimension, measure, or calculation
658
+ */
659
+ field_type: string;
660
+
661
+ /**
662
+ * UUID string used as SQL column alias
663
+ */
664
+ kater_id: string;
665
+
666
+ /**
667
+ * Human-readable column name
668
+ */
669
+ name: string;
670
+
671
+ /**
672
+ * Aggregation type for measures: sum, count, min, max, avg, unknown. None for
673
+ * non-measures.
674
+ */
675
+ aggregation?: string | null;
676
+
677
+ /**
678
+ * Display label
679
+ */
680
+ label?: string | null;
681
+ }
682
+
683
+ /**
684
+ * Grid position
685
+ */
686
+ export interface Grid {
687
+ h?: number;
688
+
689
+ w?: number;
690
+
691
+ x?: number;
692
+
693
+ y?: number;
694
+ }
695
+ }
696
+ }
697
+
698
+ /**
699
+ * Response model for query combination enumeration.
700
+ */
701
+ export interface CompilerEnumerateResponse {
702
+ /**
703
+ * All valid query configurations
704
+ */
705
+ combinations: Array<CompilerEnumerateResponse.Combination>;
706
+
707
+ /**
708
+ * Total number of combinations
709
+ */
710
+ total_count: number;
711
+ }
712
+
713
+ export namespace CompilerEnumerateResponse {
714
+ /**
715
+ * A single valid query configuration.
716
+ */
717
+ export interface Combination {
718
+ /**
719
+ * Query template reference (e.g. 'q:COMPLIANCE_OVERVIEW')
720
+ */
721
+ query_ref: string;
722
+
723
+ /**
724
+ * Widget category (e.g. 'axis', 'table')
725
+ */
726
+ widget_category: string;
727
+
728
+ /**
729
+ * Deterministic UUID v5 for this combination
730
+ */
731
+ combination_id?: string | null;
732
+
733
+ /**
734
+ * Human-readable label for the query
735
+ */
736
+ query_label?: string | null;
737
+
738
+ /**
739
+ * Field-to-role mapping (e.g. {'due_month': 'x_axis'})
740
+ */
741
+ roles?: { [key: string]: string };
742
+
743
+ /**
744
+ * Selected optional calculation names
745
+ */
746
+ selected_calculations?: Array<string>;
747
+
748
+ /**
749
+ * Selected optional dimension names
750
+ */
751
+ selected_dimensions?: Array<string>;
752
+
753
+ /**
754
+ * Selected optional filter names
755
+ */
756
+ selected_filters?: Array<string>;
757
+
758
+ /**
759
+ * Selected optional measure names
760
+ */
761
+ selected_measures?: Array<string>;
762
+
763
+ /**
764
+ * Variable name to value assignments
765
+ */
766
+ variable_assignments?: { [key: string]: unknown };
767
+
768
+ /**
769
+ * Resolved widget type (e.g. 'axis_metric_by_dimensiondate')
770
+ */
771
+ widget_type?: string | null;
772
+ }
773
+ }
774
+
775
+ /**
776
+ * Response model for query execution.
777
+ */
778
+ export interface CompilerExecuteResponse {
779
+ /**
780
+ * SQL dialect used
781
+ */
782
+ dialect: string;
783
+
784
+ /**
785
+ * Whether execution succeeded
786
+ */
787
+ success: boolean;
788
+
789
+ /**
790
+ * Whether the result was served from cache
791
+ */
792
+ cache_hit?: boolean;
793
+
794
+ /**
795
+ * Maps UUID column aliases to human-readable names
796
+ */
797
+ column_map?: Array<CompilerExecuteResponse.ColumnMap>;
798
+
799
+ /**
800
+ * Query result rows as list of column-value dicts
801
+ */
802
+ data?: Array<{ [key: string]: unknown }>;
803
+
804
+ /**
805
+ * Compilation errors (if any)
806
+ */
807
+ errors?: Array<CompilerErrorItem>;
808
+
809
+ /**
810
+ * Total execution time in milliseconds
811
+ */
812
+ execution_time_ms?: number;
813
+
814
+ /**
815
+ * Compilation metadata from the compiler.
816
+ */
817
+ metadata?: CompilerExecuteResponse.Metadata | null;
818
+
819
+ /**
820
+ * Number of rows returned
821
+ */
822
+ row_count?: number;
823
+
824
+ /**
825
+ * Generated SQL statement
826
+ */
827
+ sql?: string | null;
828
+ }
829
+
830
+ export namespace CompilerExecuteResponse {
831
+ /**
832
+ * Maps a UUID column alias to its human-readable name and type.
833
+ */
834
+ export interface ColumnMap {
835
+ /**
836
+ * Field type: dimension, measure, or calculation
837
+ */
838
+ field_type: string;
839
+
840
+ /**
841
+ * UUID string used as SQL column alias
842
+ */
843
+ kater_id: string;
844
+
845
+ /**
846
+ * Human-readable column name
847
+ */
848
+ name: string;
849
+
850
+ /**
851
+ * Aggregation type for measures: sum, count, min, max, avg, unknown. None for
852
+ * non-measures.
853
+ */
854
+ aggregation?: string | null;
855
+
856
+ /**
857
+ * Display label
858
+ */
859
+ label?: string | null;
860
+ }
861
+
862
+ /**
863
+ * Compilation metadata from the compiler.
864
+ */
865
+ export interface Metadata {
866
+ /**
867
+ * SQL dialect used (e.g. 'snowflake')
868
+ */
869
+ dialect: string;
870
+
871
+ /**
872
+ * Reference to the compiled query
873
+ */
874
+ query_ref: string;
875
+
876
+ /**
877
+ * Dimension names used in compilation
878
+ */
879
+ dimensions_used?: Array<string>;
880
+
881
+ /**
882
+ * Filter names used in compilation
883
+ */
884
+ filters_used?: Array<string>;
885
+
886
+ /**
887
+ * Measure names used in compilation
888
+ */
889
+ measures_used?: Array<string>;
890
+
891
+ /**
892
+ * View names used in compilation
893
+ */
894
+ views_used?: Array<string>;
895
+ }
896
+ }
897
+
898
+ /**
899
+ * Response model for a resolved query.
900
+ */
901
+ export interface CompilerResolveResponse {
902
+ /**
903
+ * The fully resolved query object
904
+ */
905
+ resolved_query: CompilerResolveResponse.ResolvedQuery;
906
+
907
+ /**
908
+ * Dependency graph between schema objects.
909
+ */
910
+ dependency_graph?: CompilerResolveResponse.DependencyGraph | null;
911
+
912
+ /**
913
+ * Compilation manifest with all named objects.
914
+ */
915
+ manifest?: Manifest | null;
916
+
917
+ /**
918
+ * Files auto-fixed due to renamed refs. None when no renames detected.
919
+ */
920
+ ref_fixes?: Array<CompilerResolveResponse.RefFix> | null;
921
+
922
+ /**
923
+ * Write-back request ID. Non-null when ref-fix files were dispatched to CLI via
924
+ * WebSocket.
925
+ */
926
+ request_id?: string | null;
927
+ }
928
+
929
+ export namespace CompilerResolveResponse {
930
+ /**
931
+ * The fully resolved query object
932
+ */
933
+ export interface ResolvedQuery {
934
+ /**
935
+ * Unique identifier for this resolved query instance
936
+ */
937
+ kater_id: string;
938
+
939
+ /**
940
+ * Name from the leaf query in the inheritance chain
941
+ */
942
+ name: string;
943
+
944
+ /**
945
+ * Reference to the original query template this was resolved from
946
+ */
947
+ source_query: string;
948
+
949
+ /**
950
+ * Reference to the topic this query uses (always known after inheritance
951
+ * resolution)
952
+ */
953
+ topic: string;
954
+
955
+ /**
956
+ * Widget category that determines data shape constraints
957
+ */
958
+ widget_category: 'axis' | 'funnel' | 'heatmap' | 'image' | 'kpi_card' | 'pie' | 'table' | 'text';
959
+
960
+ /**
961
+ * Usage guidance for AI processing
962
+ */
963
+ ai_context?: string | null;
964
+
965
+ /**
966
+ * Merged required + selected optional calculations
967
+ */
968
+ calculations?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
969
+
970
+ /**
971
+ * Chart recommendations preserved for evaluation
972
+ */
973
+ chart_hints?: Array<ResolvedQuery.ChartHint1Output | ResolvedQuery.ChartHint2Output> | null;
974
+
975
+ /**
976
+ * Custom properties
977
+ */
978
+ custom_properties?: { [key: string]: unknown } | null;
979
+
980
+ /**
981
+ * Description of the query
982
+ */
983
+ description?: string | null;
984
+
985
+ /**
986
+ * Merged required + selected optional dimensions
987
+ */
988
+ dimensions?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
989
+
990
+ /**
991
+ * Widget types within the declared widget_category that must NOT render this query
992
+ */
993
+ disallowed_widget_types?: Array<
994
+ | 'axis_metric_by_dimension'
995
+ | 'axis_metric_by_dimensiondate'
996
+ | 'axis_metric_by_dimensiondate_sliced_by_dimension'
997
+ | 'axis_scatter_plot'
998
+ | 'funnel_funnel_chart'
999
+ | 'heatmap_heatmap'
1000
+ | 'image_image_grid'
1001
+ | 'image_single_image'
1002
+ | 'kpi_measure_with_dimension_expression'
1003
+ | 'kpi_measure_with_secondary_metric'
1004
+ | 'kpi_single_measure_compared_to_prev_period_sparkline'
1005
+ | 'kpi_single_value'
1006
+ | 'pie_pie_chart'
1007
+ | 'table_data_table'
1008
+ | 'table_fancy_subtotal_table'
1009
+ | 'table_key_value_list'
1010
+ | 'table_styled_table'
1011
+ | 'text_data_readout_with_sparkline'
1012
+ | 'text_narrative_text'
1013
+ > | null;
1014
+
1015
+ /**
1016
+ * Merged required + selected optional filters
1017
+ */
1018
+ filters?: Array<
1019
+ | ResolvedQuery.InlineFormulaFilter
1020
+ | string
1021
+ | ResolvedQuery.InlineExistsFilter1
1022
+ | ResolvedQuery.InlineExistsFilter2
1023
+ > | null;
1024
+
1025
+ /**
1026
+ * Ordered list of query refs that were merged during inheritance resolution
1027
+ */
1028
+ inheritance_chain?: Array<string> | null;
1029
+
1030
+ /**
1031
+ * Human-readable label with var() values substituted
1032
+ */
1033
+ label?: string | null;
1034
+
1035
+ /**
1036
+ * Maximum number of rows to return
1037
+ */
1038
+ limit?: number | null;
1039
+
1040
+ /**
1041
+ * Merged required + selected optional measures
1042
+ */
1043
+ measures?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1044
+
1045
+ /**
1046
+ * Sort order specification for query results. Use desc for descending
1047
+ * (highest/newest first) and asc for ascending (lowest/oldest first).
1048
+ */
1049
+ order_by?: ResolvedQuery.OrderBy | null;
1050
+
1051
+ /**
1052
+ * The matched chart recommendation after evaluating chart hints
1053
+ */
1054
+ resolved_chart?: ResolvedQuery.ResolvedChart | null;
1055
+
1056
+ /**
1057
+ * Full variable definitions with bound values
1058
+ */
1059
+ resolved_variables?: Array<ResolvedQuery.ResolvedVariable> | null;
1060
+
1061
+ /**
1062
+ * Resolved select_from entries with CTE metadata
1063
+ */
1064
+ select_from?: Array<ResolvedQuery.SelectFrom> | null;
1065
+ }
1066
+
1067
+ export namespace ResolvedQuery {
1068
+ /**
1069
+ * A chart recommendation rule
1070
+ */
1071
+ export interface ChartHint1Output {
1072
+ /**
1073
+ * Chart configuration with variable references
1074
+ */
1075
+ config: CompilerAPI.ChartConfig;
1076
+
1077
+ /**
1078
+ * Type of chart visualization
1079
+ */
1080
+ recommend:
1081
+ | 'line'
1082
+ | 'bar'
1083
+ | 'stacked_bar'
1084
+ | 'area'
1085
+ | 'pie'
1086
+ | 'donut'
1087
+ | 'scatter'
1088
+ | 'table'
1089
+ | 'heatmap'
1090
+ | 'single_value';
1091
+
1092
+ /**
1093
+ * Conditions based on variable values - can be single value (string) or multiple
1094
+ * values (array)
1095
+ */
1096
+ when: { [key: string]: string | Array<string> };
1097
+ }
1098
+
1099
+ /**
1100
+ * A chart recommendation rule
1101
+ */
1102
+ export interface ChartHint2Output {
1103
+ default: ChartHint2Output.Default;
1104
+ }
1105
+
1106
+ export namespace ChartHint2Output {
1107
+ export interface Default {
1108
+ /**
1109
+ * Chart configuration with variable references
1110
+ */
1111
+ config: CompilerAPI.ChartConfig;
1112
+
1113
+ /**
1114
+ * Type of chart visualization
1115
+ */
1116
+ recommend:
1117
+ | 'line'
1118
+ | 'bar'
1119
+ | 'stacked_bar'
1120
+ | 'area'
1121
+ | 'pie'
1122
+ | 'donut'
1123
+ | 'scatter'
1124
+ | 'table'
1125
+ | 'heatmap'
1126
+ | 'single_value';
1127
+ }
1128
+ }
1129
+
1130
+ /**
1131
+ * An inline filter using a SQL/expression formula
1132
+ */
1133
+ export interface InlineFormulaFilter {
1134
+ /**
1135
+ * Name of the inline filter
1136
+ */
1137
+ name: string;
1138
+
1139
+ /**
1140
+ * SQL expression for the filter condition
1141
+ */
1142
+ sql: string;
1143
+ }
1144
+
1145
+ /**
1146
+ * An inline filter using EXISTS or NOT EXISTS with a subquery
1147
+ */
1148
+ export interface InlineExistsFilter1 {
1149
+ /**
1150
+ * EXISTS subquery condition
1151
+ */
1152
+ exists: CompilerAPI.SubqueryCondition;
1153
+
1154
+ /**
1155
+ * Name of the inline filter
1156
+ */
1157
+ name: string;
1158
+
1159
+ /**
1160
+ * Description of the filter
1161
+ */
1162
+ description?: string | null;
1163
+
1164
+ /**
1165
+ * Human-readable label
1166
+ */
1167
+ label?: string | null;
1168
+
1169
+ /**
1170
+ * A subquery condition for EXISTS/NOT EXISTS filters
1171
+ */
1172
+ not_exists?: CompilerAPI.SubqueryCondition | null;
1173
+ }
1174
+
1175
+ /**
1176
+ * An inline filter using EXISTS or NOT EXISTS with a subquery
1177
+ */
1178
+ export interface InlineExistsFilter2 {
1179
+ /**
1180
+ * Name of the inline filter
1181
+ */
1182
+ name: string;
1183
+
1184
+ /**
1185
+ * NOT EXISTS subquery condition
1186
+ */
1187
+ not_exists: CompilerAPI.SubqueryCondition;
1188
+
1189
+ /**
1190
+ * Description of the filter
1191
+ */
1192
+ description?: string | null;
1193
+
1194
+ /**
1195
+ * A subquery condition for EXISTS/NOT EXISTS filters
1196
+ */
1197
+ exists?: CompilerAPI.SubqueryCondition | null;
1198
+
1199
+ /**
1200
+ * Human-readable label
1201
+ */
1202
+ label?: string | null;
1203
+ }
1204
+
1205
+ /**
1206
+ * Sort order specification for query results. Use desc for descending
1207
+ * (highest/newest first) and asc for ascending (lowest/oldest first).
1208
+ */
1209
+ export interface OrderBy {
1210
+ /**
1211
+ * Fields to sort in ascending order (lowest/oldest first)
1212
+ */
1213
+ asc?: Array<string> | null;
1214
+
1215
+ /**
1216
+ * Fields to sort in descending order (highest/newest first)
1217
+ */
1218
+ desc?: Array<string> | null;
1219
+ }
1220
+
1221
+ /**
1222
+ * The matched chart recommendation after evaluating chart hints
1223
+ */
1224
+ export interface ResolvedChart {
1225
+ /**
1226
+ * Chart configuration
1227
+ */
1228
+ config: CompilerAPI.ChartConfig;
1229
+
1230
+ /**
1231
+ * Recommended chart type
1232
+ */
1233
+ recommend:
1234
+ | 'line'
1235
+ | 'bar'
1236
+ | 'stacked_bar'
1237
+ | 'area'
1238
+ | 'pie'
1239
+ | 'donut'
1240
+ | 'scatter'
1241
+ | 'table'
1242
+ | 'heatmap'
1243
+ | 'single_value';
1244
+ }
1245
+
1246
+ /**
1247
+ * A variable definition with its bound value
1248
+ */
1249
+ export interface ResolvedVariable {
1250
+ /**
1251
+ * The concrete value bound for this resolution
1252
+ */
1253
+ bound_value: string | number | boolean | Array<string | number | boolean>;
1254
+
1255
+ /**
1256
+ * Default value for this variable
1257
+ */
1258
+ default: string | number | boolean | Array<string | number | boolean>;
1259
+
1260
+ /**
1261
+ * Unique identifier for this variable
1262
+ */
1263
+ kater_id: string;
1264
+
1265
+ /**
1266
+ * Variable name identifier
1267
+ */
1268
+ name: string;
1269
+
1270
+ /**
1271
+ * Data type of the variable
1272
+ */
1273
+ type:
1274
+ | 'STRING'
1275
+ | 'INT'
1276
+ | 'FLOAT'
1277
+ | 'DATE'
1278
+ | 'TIMESTAMP'
1279
+ | 'BOOL'
1280
+ | 'STRING[]'
1281
+ | 'INT[]'
1282
+ | 'FLOAT[]'
1283
+ | 'DATE[]'
1284
+ | 'DIMENSION'
1285
+ | 'MEASURE'
1286
+ | 'CALCULATION'
1287
+ | 'FILTER';
1288
+
1289
+ /**
1290
+ * Allowed values configuration
1291
+ */
1292
+ allowed_values?:
1293
+ | ResolvedVariable.VariableAllowedValues1
1294
+ | ResolvedVariable.VariableAllowedValues2
1295
+ | null;
1296
+
1297
+ /**
1298
+ * Constraints for variable types
1299
+ */
1300
+ constraints?: ResolvedVariable.Constraints | null;
1301
+
1302
+ /**
1303
+ * Description of the variable's purpose
1304
+ */
1305
+ description?: string | null;
1306
+
1307
+ /**
1308
+ * True if bound_value equals the default value
1309
+ */
1310
+ is_default?: boolean | null;
1311
+
1312
+ /**
1313
+ * True if this is a runtime variable (not resolved at compile time). Runtime
1314
+ * variables have var() placeholders left in compiled SQL for literal substitution
1315
+ * at execution time.
1316
+ */
1317
+ is_runtime?: boolean | null;
1318
+
1319
+ /**
1320
+ * Human-readable label for the variable
1321
+ */
1322
+ label?: string | null;
1323
+ }
1324
+
1325
+ export namespace ResolvedVariable {
1326
+ /**
1327
+ * Allowed values for a variable - either static list or from column
1328
+ */
1329
+ export interface VariableAllowedValues1 {
1330
+ /**
1331
+ * Static list of allowed values with optional labels
1332
+ */
1333
+ static: Array<VariableAllowedValues1.Static>;
1334
+ }
1335
+
1336
+ export namespace VariableAllowedValues1 {
1337
+ /**
1338
+ * A value with optional display label
1339
+ */
1340
+ export interface Static {
1341
+ /**
1342
+ * The actual value
1343
+ */
1344
+ value: string | number | boolean;
1345
+
1346
+ /**
1347
+ * Human-readable label for the value
1348
+ */
1349
+ label?: string | null;
1350
+ }
1351
+ }
1352
+
1353
+ /**
1354
+ * Allowed values for a variable - either static list or from column
1355
+ */
1356
+ export interface VariableAllowedValues2 {
1357
+ /**
1358
+ * Reference to column for dynamic values
1359
+ */
1360
+ from_column: string;
1361
+
1362
+ /**
1363
+ * Cache time-to-live in seconds
1364
+ */
1365
+ cache_ttl?: number;
1366
+
1367
+ /**
1368
+ * Maximum number of values to retrieve
1369
+ */
1370
+ limit?: number;
1371
+
1372
+ /**
1373
+ * Sort order for values
1374
+ */
1375
+ order_by?: 'asc' | 'desc';
1376
+ }
1377
+
1378
+ /**
1379
+ * Constraints for variable types
1380
+ */
1381
+ export interface Constraints {
1382
+ /**
1383
+ * Maximum allowed value
1384
+ */
1385
+ max?: number | null;
1386
+
1387
+ /**
1388
+ * Maximum length for STRING variables
1389
+ */
1390
+ max_length?: number | null;
1391
+
1392
+ /**
1393
+ * Minimum allowed value
1394
+ */
1395
+ min?: number | null;
1396
+
1397
+ /**
1398
+ * Step increment for numeric input
1399
+ */
1400
+ step?: number | null;
1401
+ }
1402
+ }
1403
+
1404
+ /**
1405
+ * A resolved select_from entry with CTE metadata
1406
+ */
1407
+ export interface SelectFrom {
1408
+ /**
1409
+ * CTE alias used in the WITH clause (e.g., **sf_compliance_rate**base)
1410
+ */
1411
+ cte_alias: string;
1412
+
1413
+ /**
1414
+ * Columns produced by the CTE, available as q:query_name.field_name in the parent
1415
+ */
1416
+ output_columns: Array<SelectFrom.OutputColumn>;
1417
+
1418
+ /**
1419
+ * Reference to the source query
1420
+ */
1421
+ ref: string;
1422
+
1423
+ /**
1424
+ * Variable overrides passed to the referenced query
1425
+ */
1426
+ variables?: { [key: string]: string | number | boolean } | null;
1427
+ }
1428
+
1429
+ export namespace SelectFrom {
1430
+ /**
1431
+ * A column produced by a select_from CTE
1432
+ */
1433
+ export interface OutputColumn {
1434
+ /**
1435
+ * The SQL column alias in the CTE output
1436
+ */
1437
+ column_alias: string;
1438
+
1439
+ /**
1440
+ * The field name used in q:query_name.field_name references
1441
+ */
1442
+ field_name: string;
1443
+
1444
+ /**
1445
+ * Original type of the field in the source query
1446
+ */
1447
+ source_type: 'dimension' | 'dimension_date' | 'measure' | 'calculation';
1448
+ }
1449
+ }
1450
+ }
1451
+
1452
+ /**
1453
+ * Dependency graph between schema objects.
1454
+ */
1455
+ export interface DependencyGraph {
1456
+ /**
1457
+ * Edge relationships with UUID string keys
1458
+ */
1459
+ edges: { [key: string]: { [key: string]: Array<string> } };
1460
+
1461
+ /**
1462
+ * UUID string to node mapping
1463
+ */
1464
+ nodes: { [key: string]: DependencyGraph.Nodes };
1465
+ }
1466
+
1467
+ export namespace DependencyGraph {
1468
+ /**
1469
+ * A node in the dependency graph.
1470
+ */
1471
+ export interface Nodes {
1472
+ /**
1473
+ * Source file path
1474
+ */
1475
+ file: string;
1476
+
1477
+ /**
1478
+ * Fully qualified name (e.g. 'dim_customer.region')
1479
+ */
1480
+ fqn: string;
1481
+
1482
+ /**
1483
+ * UUID of the schema object
1484
+ */
1485
+ kater_id: string;
1486
+
1487
+ /**
1488
+ * Line number in source file
1489
+ */
1490
+ line: number;
1491
+
1492
+ /**
1493
+ * Node type: QUERY, VIEW, DIMENSION, MEASURE, FILTER, EXPRESSION
1494
+ */
1495
+ node_type: string;
1496
+
1497
+ /**
1498
+ * Column number in source file
1499
+ */
1500
+ column?: number;
1501
+ }
1502
+ }
1503
+
1504
+ /**
1505
+ * A file that was modified by auto-fix with its replacements.
1506
+ */
1507
+ export interface RefFix {
1508
+ /**
1509
+ * Path to the modified file
1510
+ */
1511
+ file_path: string;
1512
+
1513
+ /**
1514
+ * Full updated file content after fixes
1515
+ */
1516
+ new_content: string;
1517
+
1518
+ /**
1519
+ * Individual ref replacements made in this file
1520
+ */
1521
+ replacements: Array<RefFix.Replacement>;
1522
+ }
1523
+
1524
+ export namespace RefFix {
1525
+ /**
1526
+ * A single ref replacement within a file.
1527
+ */
1528
+ export interface Replacement {
1529
+ /**
1530
+ * Path to the file containing the replaced ref
1531
+ */
1532
+ file_path: string;
1533
+
1534
+ /**
1535
+ * Line number where the replacement occurred
1536
+ */
1537
+ line_number: number;
1538
+
1539
+ /**
1540
+ * Updated reference string
1541
+ */
1542
+ new_ref: string;
1543
+
1544
+ /**
1545
+ * Original reference string
1546
+ */
1547
+ old_ref: string;
1548
+ }
1549
+ }
1550
+ }
1551
+
1552
+ /**
1553
+ * Response model for schema validation.
1554
+ */
1555
+ export interface CompilerValidateResponse {
1556
+ /**
1557
+ * Whether validation passed without errors
1558
+ */
1559
+ success: boolean;
1560
+
1561
+ /**
1562
+ * Per-connection validation results with dependency graphs
1563
+ */
1564
+ connection_results?: Array<CompilerValidateResponse.ConnectionResult>;
1565
+
1566
+ /**
1567
+ * Validation errors
1568
+ */
1569
+ errors?: Array<CompilerErrorItem>;
1570
+
1571
+ /**
1572
+ * Write-back request ID. Non-null when files were dispatched to CLI via WebSocket.
1573
+ */
1574
+ request_id?: string | null;
1575
+
1576
+ /**
1577
+ * Validation warnings
1578
+ */
1579
+ warnings?: Array<CompilerErrorItem>;
1580
+ }
1581
+
1582
+ export namespace CompilerValidateResponse {
1583
+ /**
1584
+ * Validation result for a single connection.
1585
+ */
1586
+ export interface ConnectionResult {
1587
+ /**
1588
+ * Connection UUID
1589
+ */
1590
+ connection_id: string;
1591
+
1592
+ /**
1593
+ * Connection name
1594
+ */
1595
+ connection_name: string;
1596
+
1597
+ /**
1598
+ * Whether this connection validated without errors
1599
+ */
1600
+ success: boolean;
1601
+
1602
+ /**
1603
+ * Dependency graph between schema objects.
1604
+ */
1605
+ dependency_graph?: ConnectionResult.DependencyGraph | null;
1606
+
1607
+ /**
1608
+ * Validation errors for this connection
1609
+ */
1610
+ errors?: Array<CompilerAPI.CompilerErrorItem>;
1611
+
1612
+ /**
1613
+ * Compilation manifest with all named objects.
1614
+ */
1615
+ manifest?: CompilerAPI.Manifest | null;
1616
+
1617
+ /**
1618
+ * Files auto-fixed due to renamed refs. None when no renames detected.
1619
+ */
1620
+ ref_fixes?: Array<ConnectionResult.RefFix> | null;
1621
+
1622
+ /**
1623
+ * Validation warnings for this connection
1624
+ */
1625
+ warnings?: Array<CompilerAPI.CompilerErrorItem>;
1626
+ }
1627
+
1628
+ export namespace ConnectionResult {
1629
+ /**
1630
+ * Dependency graph between schema objects.
1631
+ */
1632
+ export interface DependencyGraph {
1633
+ /**
1634
+ * Edge relationships with UUID string keys
1635
+ */
1636
+ edges: { [key: string]: { [key: string]: Array<string> } };
1637
+
1638
+ /**
1639
+ * UUID string to node mapping
1640
+ */
1641
+ nodes: { [key: string]: DependencyGraph.Nodes };
1642
+ }
1643
+
1644
+ export namespace DependencyGraph {
1645
+ /**
1646
+ * A node in the dependency graph.
1647
+ */
1648
+ export interface Nodes {
1649
+ /**
1650
+ * Source file path
1651
+ */
1652
+ file: string;
1653
+
1654
+ /**
1655
+ * Fully qualified name (e.g. 'dim_customer.region')
1656
+ */
1657
+ fqn: string;
1658
+
1659
+ /**
1660
+ * UUID of the schema object
1661
+ */
1662
+ kater_id: string;
1663
+
1664
+ /**
1665
+ * Line number in source file
1666
+ */
1667
+ line: number;
1668
+
1669
+ /**
1670
+ * Node type: QUERY, VIEW, DIMENSION, MEASURE, FILTER, EXPRESSION
1671
+ */
1672
+ node_type: string;
1673
+
1674
+ /**
1675
+ * Column number in source file
1676
+ */
1677
+ column?: number;
1678
+ }
1679
+ }
1680
+
1681
+ /**
1682
+ * A file that was modified by auto-fix with its replacements.
1683
+ */
1684
+ export interface RefFix {
1685
+ /**
1686
+ * Path to the modified file
1687
+ */
1688
+ file_path: string;
1689
+
1690
+ /**
1691
+ * Full updated file content after fixes
1692
+ */
1693
+ new_content: string;
1694
+
1695
+ /**
1696
+ * Individual ref replacements made in this file
1697
+ */
1698
+ replacements: Array<RefFix.Replacement>;
1699
+ }
1700
+
1701
+ export namespace RefFix {
1702
+ /**
1703
+ * A single ref replacement within a file.
1704
+ */
1705
+ export interface Replacement {
1706
+ /**
1707
+ * Path to the file containing the replaced ref
1708
+ */
1709
+ file_path: string;
1710
+
1711
+ /**
1712
+ * Line number where the replacement occurred
1713
+ */
1714
+ line_number: number;
1715
+
1716
+ /**
1717
+ * Updated reference string
1718
+ */
1719
+ new_ref: string;
1720
+
1721
+ /**
1722
+ * Original reference string
1723
+ */
1724
+ old_ref: string;
1725
+ }
1726
+ }
1727
+ }
1728
+ }
1729
+
1730
+ export interface CompilerCompileParams {
1731
+ /**
1732
+ * Body param: Connection to compile against
1733
+ */
1734
+ connection_id: string;
1735
+
1736
+ /**
1737
+ * Body param: Previously resolved query object from /resolve
1738
+ */
1739
+ resolved_query: CompilerCompileParams.ResolvedQuery;
1740
+
1741
+ /**
1742
+ * Query param
1743
+ */
1744
+ source?: string | null;
1745
+
1746
+ /**
1747
+ * Body param: Tenant key for multi-tenant compilation. For database tenancy, maps
1748
+ * to the tenant's database. For row tenancy, used as the row-level filter value.
1749
+ */
1750
+ tenant_key?: string | null;
1751
+
1752
+ /**
1753
+ * Header param
1754
+ */
1755
+ 'X-Kater-CLI-ID'?: string;
1756
+ }
1757
+
1758
+ export namespace CompilerCompileParams {
1759
+ /**
1760
+ * Previously resolved query object from /resolve
1761
+ */
1762
+ export interface ResolvedQuery {
1763
+ /**
1764
+ * Unique identifier for this resolved query instance
1765
+ */
1766
+ kater_id: string;
1767
+
1768
+ /**
1769
+ * Name from the leaf query in the inheritance chain
1770
+ */
1771
+ name: string;
1772
+
1773
+ /**
1774
+ * Reference to the original query template this was resolved from
1775
+ */
1776
+ source_query: string;
1777
+
1778
+ /**
1779
+ * Reference to the topic this query uses (always known after inheritance
1780
+ * resolution)
1781
+ */
1782
+ topic: string;
1783
+
1784
+ /**
1785
+ * Widget category that determines data shape constraints
1786
+ */
1787
+ widget_category: 'axis' | 'funnel' | 'heatmap' | 'image' | 'kpi_card' | 'pie' | 'table' | 'text';
1788
+
1789
+ /**
1790
+ * Usage guidance for AI processing
1791
+ */
1792
+ ai_context?: string | null;
1793
+
1794
+ /**
1795
+ * Merged required + selected optional calculations
1796
+ */
1797
+ calculations?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1798
+
1799
+ /**
1800
+ * Chart recommendations preserved for evaluation
1801
+ */
1802
+ chart_hints?: Array<ResolvedQuery.ChartHint1Input | ResolvedQuery.ChartHint2Input> | null;
1803
+
1804
+ /**
1805
+ * Custom properties
1806
+ */
1807
+ custom_properties?: { [key: string]: unknown } | null;
1808
+
1809
+ /**
1810
+ * Description of the query
1811
+ */
1812
+ description?: string | null;
1813
+
1814
+ /**
1815
+ * Merged required + selected optional dimensions
1816
+ */
1817
+ dimensions?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1818
+
1819
+ /**
1820
+ * Widget types within the declared widget_category that must NOT render this query
1821
+ */
1822
+ disallowed_widget_types?: Array<
1823
+ | 'axis_metric_by_dimension'
1824
+ | 'axis_metric_by_dimensiondate'
1825
+ | 'axis_metric_by_dimensiondate_sliced_by_dimension'
1826
+ | 'axis_scatter_plot'
1827
+ | 'funnel_funnel_chart'
1828
+ | 'heatmap_heatmap'
1829
+ | 'image_image_grid'
1830
+ | 'image_single_image'
1831
+ | 'kpi_measure_with_dimension_expression'
1832
+ | 'kpi_measure_with_secondary_metric'
1833
+ | 'kpi_single_measure_compared_to_prev_period_sparkline'
1834
+ | 'kpi_single_value'
1835
+ | 'pie_pie_chart'
1836
+ | 'table_data_table'
1837
+ | 'table_fancy_subtotal_table'
1838
+ | 'table_key_value_list'
1839
+ | 'table_styled_table'
1840
+ | 'text_data_readout_with_sparkline'
1841
+ | 'text_narrative_text'
1842
+ > | null;
1843
+
1844
+ /**
1845
+ * Merged required + selected optional filters
1846
+ */
1847
+ filters?: Array<
1848
+ | ResolvedQuery.InlineFormulaFilter
1849
+ | string
1850
+ | ResolvedQuery.InlineExistsFilter1
1851
+ | ResolvedQuery.InlineExistsFilter2
1852
+ > | null;
1853
+
1854
+ /**
1855
+ * Ordered list of query refs that were merged during inheritance resolution
1856
+ */
1857
+ inheritance_chain?: Array<string> | null;
1858
+
1859
+ /**
1860
+ * Human-readable label with var() values substituted
1861
+ */
1862
+ label?: string | null;
1863
+
1864
+ /**
1865
+ * Maximum number of rows to return
1866
+ */
1867
+ limit?: number | null;
1868
+
1869
+ /**
1870
+ * Merged required + selected optional measures
1871
+ */
1872
+ measures?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1873
+
1874
+ /**
1875
+ * Sort order specification for query results. Use desc for descending
1876
+ * (highest/newest first) and asc for ascending (lowest/oldest first).
1877
+ */
1878
+ order_by?: ResolvedQuery.OrderBy | null;
1879
+
1880
+ /**
1881
+ * The matched chart recommendation after evaluating chart hints
1882
+ */
1883
+ resolved_chart?: ResolvedQuery.ResolvedChart | null;
1884
+
1885
+ /**
1886
+ * Full variable definitions with bound values
1887
+ */
1888
+ resolved_variables?: Array<ResolvedQuery.ResolvedVariable> | null;
1889
+
1890
+ /**
1891
+ * Resolved select_from entries with CTE metadata
1892
+ */
1893
+ select_from?: Array<ResolvedQuery.SelectFrom> | null;
1894
+ }
1895
+
1896
+ export namespace ResolvedQuery {
1897
+ /**
1898
+ * A chart recommendation rule
1899
+ */
1900
+ export interface ChartHint1Input {
1901
+ /**
1902
+ * Chart configuration with variable references
1903
+ */
1904
+ config: CompilerAPI.ChartConfig;
1905
+
1906
+ /**
1907
+ * Type of chart visualization
1908
+ */
1909
+ recommend:
1910
+ | 'line'
1911
+ | 'bar'
1912
+ | 'stacked_bar'
1913
+ | 'area'
1914
+ | 'pie'
1915
+ | 'donut'
1916
+ | 'scatter'
1917
+ | 'table'
1918
+ | 'heatmap'
1919
+ | 'single_value';
1920
+
1921
+ /**
1922
+ * Conditions based on variable values - can be single value (string) or multiple
1923
+ * values (array)
1924
+ */
1925
+ when: { [key: string]: string | Array<string> };
1926
+ }
1927
+
1928
+ /**
1929
+ * A chart recommendation rule
1930
+ */
1931
+ export interface ChartHint2Input {
1932
+ default: ChartHint2Input.Default;
1933
+ }
1934
+
1935
+ export namespace ChartHint2Input {
1936
+ export interface Default {
1937
+ /**
1938
+ * Chart configuration with variable references
1939
+ */
1940
+ config: CompilerAPI.ChartConfig;
1941
+
1942
+ /**
1943
+ * Type of chart visualization
1944
+ */
1945
+ recommend:
1946
+ | 'line'
1947
+ | 'bar'
1948
+ | 'stacked_bar'
1949
+ | 'area'
1950
+ | 'pie'
1951
+ | 'donut'
1952
+ | 'scatter'
1953
+ | 'table'
1954
+ | 'heatmap'
1955
+ | 'single_value';
1956
+ }
1957
+ }
1958
+
1959
+ /**
1960
+ * An inline filter using a SQL/expression formula
1961
+ */
1962
+ export interface InlineFormulaFilter {
1963
+ /**
1964
+ * Name of the inline filter
1965
+ */
1966
+ name: string;
1967
+
1968
+ /**
1969
+ * SQL expression for the filter condition
1970
+ */
1971
+ sql: string;
1972
+ }
1973
+
1974
+ /**
1975
+ * An inline filter using EXISTS or NOT EXISTS with a subquery
1976
+ */
1977
+ export interface InlineExistsFilter1 {
1978
+ /**
1979
+ * EXISTS subquery condition
1980
+ */
1981
+ exists: CompilerAPI.SubqueryCondition;
1982
+
1983
+ /**
1984
+ * Name of the inline filter
1985
+ */
1986
+ name: string;
1987
+
1988
+ /**
1989
+ * Description of the filter
1990
+ */
1991
+ description?: string | null;
1992
+
1993
+ /**
1994
+ * Human-readable label
1995
+ */
1996
+ label?: string | null;
1997
+
1998
+ /**
1999
+ * A subquery condition for EXISTS/NOT EXISTS filters
2000
+ */
2001
+ not_exists?: CompilerAPI.SubqueryCondition | null;
2002
+ }
2003
+
2004
+ /**
2005
+ * An inline filter using EXISTS or NOT EXISTS with a subquery
2006
+ */
2007
+ export interface InlineExistsFilter2 {
2008
+ /**
2009
+ * Name of the inline filter
2010
+ */
2011
+ name: string;
2012
+
2013
+ /**
2014
+ * NOT EXISTS subquery condition
2015
+ */
2016
+ not_exists: CompilerAPI.SubqueryCondition;
2017
+
2018
+ /**
2019
+ * Description of the filter
2020
+ */
2021
+ description?: string | null;
2022
+
2023
+ /**
2024
+ * A subquery condition for EXISTS/NOT EXISTS filters
2025
+ */
2026
+ exists?: CompilerAPI.SubqueryCondition | null;
2027
+
2028
+ /**
2029
+ * Human-readable label
2030
+ */
2031
+ label?: string | null;
2032
+ }
2033
+
2034
+ /**
2035
+ * Sort order specification for query results. Use desc for descending
2036
+ * (highest/newest first) and asc for ascending (lowest/oldest first).
2037
+ */
2038
+ export interface OrderBy {
2039
+ /**
2040
+ * Fields to sort in ascending order (lowest/oldest first)
2041
+ */
2042
+ asc?: Array<string> | null;
2043
+
2044
+ /**
2045
+ * Fields to sort in descending order (highest/newest first)
2046
+ */
2047
+ desc?: Array<string> | null;
2048
+ }
2049
+
2050
+ /**
2051
+ * The matched chart recommendation after evaluating chart hints
2052
+ */
2053
+ export interface ResolvedChart {
2054
+ /**
2055
+ * Chart configuration
2056
+ */
2057
+ config: CompilerAPI.ChartConfig;
2058
+
2059
+ /**
2060
+ * Recommended chart type
2061
+ */
2062
+ recommend:
2063
+ | 'line'
2064
+ | 'bar'
2065
+ | 'stacked_bar'
2066
+ | 'area'
2067
+ | 'pie'
2068
+ | 'donut'
2069
+ | 'scatter'
2070
+ | 'table'
2071
+ | 'heatmap'
2072
+ | 'single_value';
2073
+ }
2074
+
2075
+ /**
2076
+ * A variable definition with its bound value
2077
+ */
2078
+ export interface ResolvedVariable {
2079
+ /**
2080
+ * The concrete value bound for this resolution
2081
+ */
2082
+ bound_value: string | number | boolean | Array<string | number | boolean>;
2083
+
2084
+ /**
2085
+ * Default value for this variable
2086
+ */
2087
+ default: string | number | boolean | Array<string | number | boolean>;
2088
+
2089
+ /**
2090
+ * Unique identifier for this variable
2091
+ */
2092
+ kater_id: string;
2093
+
2094
+ /**
2095
+ * Variable name identifier
2096
+ */
2097
+ name: string;
2098
+
2099
+ /**
2100
+ * Data type of the variable
2101
+ */
2102
+ type:
2103
+ | 'STRING'
2104
+ | 'INT'
2105
+ | 'FLOAT'
2106
+ | 'DATE'
2107
+ | 'TIMESTAMP'
2108
+ | 'BOOL'
2109
+ | 'STRING[]'
2110
+ | 'INT[]'
2111
+ | 'FLOAT[]'
2112
+ | 'DATE[]'
2113
+ | 'DIMENSION'
2114
+ | 'MEASURE'
2115
+ | 'CALCULATION'
2116
+ | 'FILTER';
2117
+
2118
+ /**
2119
+ * Allowed values configuration
2120
+ */
2121
+ allowed_values?:
2122
+ | ResolvedVariable.VariableAllowedValues1
2123
+ | ResolvedVariable.VariableAllowedValues2
2124
+ | null;
2125
+
2126
+ /**
2127
+ * Constraints for variable types
2128
+ */
2129
+ constraints?: ResolvedVariable.Constraints | null;
2130
+
2131
+ /**
2132
+ * Description of the variable's purpose
2133
+ */
2134
+ description?: string | null;
2135
+
2136
+ /**
2137
+ * True if bound_value equals the default value
2138
+ */
2139
+ is_default?: boolean | null;
2140
+
2141
+ /**
2142
+ * True if this is a runtime variable (not resolved at compile time). Runtime
2143
+ * variables have var() placeholders left in compiled SQL for literal substitution
2144
+ * at execution time.
2145
+ */
2146
+ is_runtime?: boolean | null;
2147
+
2148
+ /**
2149
+ * Human-readable label for the variable
2150
+ */
2151
+ label?: string | null;
2152
+ }
2153
+
2154
+ export namespace ResolvedVariable {
2155
+ /**
2156
+ * Allowed values for a variable - either static list or from column
2157
+ */
2158
+ export interface VariableAllowedValues1 {
2159
+ /**
2160
+ * Static list of allowed values with optional labels
2161
+ */
2162
+ static: Array<VariableAllowedValues1.Static>;
2163
+ }
2164
+
2165
+ export namespace VariableAllowedValues1 {
2166
+ /**
2167
+ * A value with optional display label
2168
+ */
2169
+ export interface Static {
2170
+ /**
2171
+ * The actual value
2172
+ */
2173
+ value: string | number | boolean;
2174
+
2175
+ /**
2176
+ * Human-readable label for the value
2177
+ */
2178
+ label?: string | null;
2179
+ }
2180
+ }
2181
+
2182
+ /**
2183
+ * Allowed values for a variable - either static list or from column
2184
+ */
2185
+ export interface VariableAllowedValues2 {
2186
+ /**
2187
+ * Reference to column for dynamic values
2188
+ */
2189
+ from_column: string;
2190
+
2191
+ /**
2192
+ * Cache time-to-live in seconds
2193
+ */
2194
+ cache_ttl?: number;
2195
+
2196
+ /**
2197
+ * Maximum number of values to retrieve
2198
+ */
2199
+ limit?: number;
2200
+
2201
+ /**
2202
+ * Sort order for values
2203
+ */
2204
+ order_by?: 'asc' | 'desc';
2205
+ }
2206
+
2207
+ /**
2208
+ * Constraints for variable types
2209
+ */
2210
+ export interface Constraints {
2211
+ /**
2212
+ * Maximum allowed value
2213
+ */
2214
+ max?: number | null;
2215
+
2216
+ /**
2217
+ * Maximum length for STRING variables
2218
+ */
2219
+ max_length?: number | null;
2220
+
2221
+ /**
2222
+ * Minimum allowed value
2223
+ */
2224
+ min?: number | null;
2225
+
2226
+ /**
2227
+ * Step increment for numeric input
2228
+ */
2229
+ step?: number | null;
2230
+ }
2231
+ }
2232
+
2233
+ /**
2234
+ * A resolved select_from entry with CTE metadata
2235
+ */
2236
+ export interface SelectFrom {
2237
+ /**
2238
+ * CTE alias used in the WITH clause (e.g., **sf_compliance_rate**base)
2239
+ */
2240
+ cte_alias: string;
2241
+
2242
+ /**
2243
+ * Columns produced by the CTE, available as q:query_name.field_name in the parent
2244
+ */
2245
+ output_columns: Array<SelectFrom.OutputColumn>;
2246
+
2247
+ /**
2248
+ * Reference to the source query
2249
+ */
2250
+ ref: string;
2251
+
2252
+ /**
2253
+ * Variable overrides passed to the referenced query
2254
+ */
2255
+ variables?: { [key: string]: string | number | boolean } | null;
2256
+ }
2257
+
2258
+ export namespace SelectFrom {
2259
+ /**
2260
+ * A column produced by a select_from CTE
2261
+ */
2262
+ export interface OutputColumn {
2263
+ /**
2264
+ * The SQL column alias in the CTE output
2265
+ */
2266
+ column_alias: string;
2267
+
2268
+ /**
2269
+ * The field name used in q:query_name.field_name references
2270
+ */
2271
+ field_name: string;
2272
+
2273
+ /**
2274
+ * Original type of the field in the source query
2275
+ */
2276
+ source_type: 'dimension' | 'dimension_date' | 'measure' | 'calculation';
2277
+ }
2278
+ }
2279
+ }
2280
+ }
2281
+
2282
+ export interface CompilerCompileDashboardParams {
2283
+ /**
2284
+ * Body param: Connection to compile against
2285
+ */
2286
+ connection_id: string;
2287
+
2288
+ /**
2289
+ * Body param: Relative path within the connection (e.g.
2290
+ * 'dashboards/compliance_overview')
2291
+ */
2292
+ dashboard_path: string;
2293
+
2294
+ /**
2295
+ * Query param
2296
+ */
2297
+ source?: string | null;
2298
+
2299
+ /**
2300
+ * Body param: Optional filter overrides from UI
2301
+ */
2302
+ filters?: { [key: string]: string | Array<string> | null } | null;
2303
+
2304
+ /**
2305
+ * Body param: Optional tenant key for multi-tenant execution
2306
+ */
2307
+ tenant_key?: string | null;
2308
+
2309
+ /**
2310
+ * Header param
2311
+ */
2312
+ 'X-Kater-CLI-ID'?: string;
2313
+ }
2314
+
2315
+ export interface CompilerEnumerateParams {
2316
+ /**
2317
+ * Body param: Connection to enumerate against
2318
+ */
2319
+ connection_id: string;
2320
+
2321
+ /**
2322
+ * Query param
2323
+ */
2324
+ source?: string | null;
2325
+
2326
+ /**
2327
+ * Body param: Optional query refs to limit enumeration. If omitted, enumerates all
2328
+ * queries.
2329
+ */
2330
+ query_refs?: Array<string> | null;
2331
+
2332
+ /**
2333
+ * Body param: Tenant key for multi-tenant clients. Required when the client uses
2334
+ * row or database tenancy.
2335
+ */
2336
+ tenant_key?: string | null;
2337
+
2338
+ /**
2339
+ * Header param
2340
+ */
2341
+ 'X-Kater-CLI-ID'?: string;
2342
+ }
2343
+
2344
+ export interface CompilerExecuteParams {
2345
+ /**
2346
+ * Body param: Connection to execute against
2347
+ */
2348
+ connection_id: string;
2349
+
2350
+ /**
2351
+ * Body param: Previously resolved query object from /resolve
2352
+ */
2353
+ resolved_query: CompilerExecuteParams.ResolvedQuery;
2354
+
2355
+ /**
2356
+ * Query param
2357
+ */
2358
+ source?: string | null;
2359
+
2360
+ /**
2361
+ * Body param: Tenant key for multi-tenant execution
2362
+ */
2363
+ tenant_key?: string | null;
2364
+
2365
+ /**
2366
+ * Header param
2367
+ */
2368
+ 'X-Kater-CLI-ID'?: string;
2369
+ }
2370
+
2371
+ export namespace CompilerExecuteParams {
2372
+ /**
2373
+ * Previously resolved query object from /resolve
2374
+ */
2375
+ export interface ResolvedQuery {
2376
+ /**
2377
+ * Unique identifier for this resolved query instance
2378
+ */
2379
+ kater_id: string;
2380
+
2381
+ /**
2382
+ * Name from the leaf query in the inheritance chain
2383
+ */
2384
+ name: string;
2385
+
2386
+ /**
2387
+ * Reference to the original query template this was resolved from
2388
+ */
2389
+ source_query: string;
2390
+
2391
+ /**
2392
+ * Reference to the topic this query uses (always known after inheritance
2393
+ * resolution)
2394
+ */
2395
+ topic: string;
2396
+
2397
+ /**
2398
+ * Widget category that determines data shape constraints
2399
+ */
2400
+ widget_category: 'axis' | 'funnel' | 'heatmap' | 'image' | 'kpi_card' | 'pie' | 'table' | 'text';
2401
+
2402
+ /**
2403
+ * Usage guidance for AI processing
2404
+ */
2405
+ ai_context?: string | null;
2406
+
2407
+ /**
2408
+ * Merged required + selected optional calculations
2409
+ */
2410
+ calculations?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
2411
+
2412
+ /**
2413
+ * Chart recommendations preserved for evaluation
2414
+ */
2415
+ chart_hints?: Array<ResolvedQuery.ChartHint1Input | ResolvedQuery.ChartHint2Input> | null;
2416
+
2417
+ /**
2418
+ * Custom properties
2419
+ */
2420
+ custom_properties?: { [key: string]: unknown } | null;
2421
+
2422
+ /**
2423
+ * Description of the query
2424
+ */
2425
+ description?: string | null;
2426
+
2427
+ /**
2428
+ * Merged required + selected optional dimensions
2429
+ */
2430
+ dimensions?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
2431
+
2432
+ /**
2433
+ * Widget types within the declared widget_category that must NOT render this query
2434
+ */
2435
+ disallowed_widget_types?: Array<
2436
+ | 'axis_metric_by_dimension'
2437
+ | 'axis_metric_by_dimensiondate'
2438
+ | 'axis_metric_by_dimensiondate_sliced_by_dimension'
2439
+ | 'axis_scatter_plot'
2440
+ | 'funnel_funnel_chart'
2441
+ | 'heatmap_heatmap'
2442
+ | 'image_image_grid'
2443
+ | 'image_single_image'
2444
+ | 'kpi_measure_with_dimension_expression'
2445
+ | 'kpi_measure_with_secondary_metric'
2446
+ | 'kpi_single_measure_compared_to_prev_period_sparkline'
2447
+ | 'kpi_single_value'
2448
+ | 'pie_pie_chart'
2449
+ | 'table_data_table'
2450
+ | 'table_fancy_subtotal_table'
2451
+ | 'table_key_value_list'
2452
+ | 'table_styled_table'
2453
+ | 'text_data_readout_with_sparkline'
2454
+ | 'text_narrative_text'
2455
+ > | null;
2456
+
2457
+ /**
2458
+ * Merged required + selected optional filters
2459
+ */
2460
+ filters?: Array<
2461
+ | ResolvedQuery.InlineFormulaFilter
2462
+ | string
2463
+ | ResolvedQuery.InlineExistsFilter1
2464
+ | ResolvedQuery.InlineExistsFilter2
2465
+ > | null;
2466
+
2467
+ /**
2468
+ * Ordered list of query refs that were merged during inheritance resolution
2469
+ */
2470
+ inheritance_chain?: Array<string> | null;
2471
+
2472
+ /**
2473
+ * Human-readable label with var() values substituted
2474
+ */
2475
+ label?: string | null;
2476
+
2477
+ /**
2478
+ * Maximum number of rows to return
2479
+ */
2480
+ limit?: number | null;
2481
+
2482
+ /**
2483
+ * Merged required + selected optional measures
2484
+ */
2485
+ measures?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
2486
+
2487
+ /**
2488
+ * Sort order specification for query results. Use desc for descending
2489
+ * (highest/newest first) and asc for ascending (lowest/oldest first).
2490
+ */
2491
+ order_by?: ResolvedQuery.OrderBy | null;
2492
+
2493
+ /**
2494
+ * The matched chart recommendation after evaluating chart hints
2495
+ */
2496
+ resolved_chart?: ResolvedQuery.ResolvedChart | null;
2497
+
2498
+ /**
2499
+ * Full variable definitions with bound values
2500
+ */
2501
+ resolved_variables?: Array<ResolvedQuery.ResolvedVariable> | null;
2502
+
2503
+ /**
2504
+ * Resolved select_from entries with CTE metadata
2505
+ */
2506
+ select_from?: Array<ResolvedQuery.SelectFrom> | null;
2507
+ }
2508
+
2509
+ export namespace ResolvedQuery {
2510
+ /**
2511
+ * A chart recommendation rule
2512
+ */
2513
+ export interface ChartHint1Input {
2514
+ /**
2515
+ * Chart configuration with variable references
2516
+ */
2517
+ config: CompilerAPI.ChartConfig;
2518
+
2519
+ /**
2520
+ * Type of chart visualization
2521
+ */
2522
+ recommend:
2523
+ | 'line'
2524
+ | 'bar'
2525
+ | 'stacked_bar'
2526
+ | 'area'
2527
+ | 'pie'
2528
+ | 'donut'
2529
+ | 'scatter'
2530
+ | 'table'
2531
+ | 'heatmap'
2532
+ | 'single_value';
2533
+
2534
+ /**
2535
+ * Conditions based on variable values - can be single value (string) or multiple
2536
+ * values (array)
2537
+ */
2538
+ when: { [key: string]: string | Array<string> };
2539
+ }
2540
+
2541
+ /**
2542
+ * A chart recommendation rule
2543
+ */
2544
+ export interface ChartHint2Input {
2545
+ default: ChartHint2Input.Default;
2546
+ }
2547
+
2548
+ export namespace ChartHint2Input {
2549
+ export interface Default {
2550
+ /**
2551
+ * Chart configuration with variable references
2552
+ */
2553
+ config: CompilerAPI.ChartConfig;
2554
+
2555
+ /**
2556
+ * Type of chart visualization
2557
+ */
2558
+ recommend:
2559
+ | 'line'
2560
+ | 'bar'
2561
+ | 'stacked_bar'
2562
+ | 'area'
2563
+ | 'pie'
2564
+ | 'donut'
2565
+ | 'scatter'
2566
+ | 'table'
2567
+ | 'heatmap'
2568
+ | 'single_value';
2569
+ }
2570
+ }
2571
+
2572
+ /**
2573
+ * An inline filter using a SQL/expression formula
2574
+ */
2575
+ export interface InlineFormulaFilter {
2576
+ /**
2577
+ * Name of the inline filter
2578
+ */
2579
+ name: string;
2580
+
2581
+ /**
2582
+ * SQL expression for the filter condition
2583
+ */
2584
+ sql: string;
2585
+ }
2586
+
2587
+ /**
2588
+ * An inline filter using EXISTS or NOT EXISTS with a subquery
2589
+ */
2590
+ export interface InlineExistsFilter1 {
2591
+ /**
2592
+ * EXISTS subquery condition
2593
+ */
2594
+ exists: CompilerAPI.SubqueryCondition;
2595
+
2596
+ /**
2597
+ * Name of the inline filter
2598
+ */
2599
+ name: string;
2600
+
2601
+ /**
2602
+ * Description of the filter
2603
+ */
2604
+ description?: string | null;
2605
+
2606
+ /**
2607
+ * Human-readable label
2608
+ */
2609
+ label?: string | null;
2610
+
2611
+ /**
2612
+ * A subquery condition for EXISTS/NOT EXISTS filters
2613
+ */
2614
+ not_exists?: CompilerAPI.SubqueryCondition | null;
2615
+ }
2616
+
2617
+ /**
2618
+ * An inline filter using EXISTS or NOT EXISTS with a subquery
2619
+ */
2620
+ export interface InlineExistsFilter2 {
2621
+ /**
2622
+ * Name of the inline filter
2623
+ */
2624
+ name: string;
2625
+
2626
+ /**
2627
+ * NOT EXISTS subquery condition
2628
+ */
2629
+ not_exists: CompilerAPI.SubqueryCondition;
2630
+
2631
+ /**
2632
+ * Description of the filter
2633
+ */
2634
+ description?: string | null;
2635
+
2636
+ /**
2637
+ * A subquery condition for EXISTS/NOT EXISTS filters
2638
+ */
2639
+ exists?: CompilerAPI.SubqueryCondition | null;
2640
+
2641
+ /**
2642
+ * Human-readable label
2643
+ */
2644
+ label?: string | null;
2645
+ }
2646
+
2647
+ /**
2648
+ * Sort order specification for query results. Use desc for descending
2649
+ * (highest/newest first) and asc for ascending (lowest/oldest first).
2650
+ */
2651
+ export interface OrderBy {
2652
+ /**
2653
+ * Fields to sort in ascending order (lowest/oldest first)
2654
+ */
2655
+ asc?: Array<string> | null;
2656
+
2657
+ /**
2658
+ * Fields to sort in descending order (highest/newest first)
2659
+ */
2660
+ desc?: Array<string> | null;
2661
+ }
2662
+
2663
+ /**
2664
+ * The matched chart recommendation after evaluating chart hints
2665
+ */
2666
+ export interface ResolvedChart {
2667
+ /**
2668
+ * Chart configuration
2669
+ */
2670
+ config: CompilerAPI.ChartConfig;
2671
+
2672
+ /**
2673
+ * Recommended chart type
2674
+ */
2675
+ recommend:
2676
+ | 'line'
2677
+ | 'bar'
2678
+ | 'stacked_bar'
2679
+ | 'area'
2680
+ | 'pie'
2681
+ | 'donut'
2682
+ | 'scatter'
2683
+ | 'table'
2684
+ | 'heatmap'
2685
+ | 'single_value';
2686
+ }
2687
+
2688
+ /**
2689
+ * A variable definition with its bound value
2690
+ */
2691
+ export interface ResolvedVariable {
2692
+ /**
2693
+ * The concrete value bound for this resolution
2694
+ */
2695
+ bound_value: string | number | boolean | Array<string | number | boolean>;
2696
+
2697
+ /**
2698
+ * Default value for this variable
2699
+ */
2700
+ default: string | number | boolean | Array<string | number | boolean>;
2701
+
2702
+ /**
2703
+ * Unique identifier for this variable
2704
+ */
2705
+ kater_id: string;
2706
+
2707
+ /**
2708
+ * Variable name identifier
2709
+ */
2710
+ name: string;
2711
+
2712
+ /**
2713
+ * Data type of the variable
2714
+ */
2715
+ type:
2716
+ | 'STRING'
2717
+ | 'INT'
2718
+ | 'FLOAT'
2719
+ | 'DATE'
2720
+ | 'TIMESTAMP'
2721
+ | 'BOOL'
2722
+ | 'STRING[]'
2723
+ | 'INT[]'
2724
+ | 'FLOAT[]'
2725
+ | 'DATE[]'
2726
+ | 'DIMENSION'
2727
+ | 'MEASURE'
2728
+ | 'CALCULATION'
2729
+ | 'FILTER';
2730
+
2731
+ /**
2732
+ * Allowed values configuration
2733
+ */
2734
+ allowed_values?:
2735
+ | ResolvedVariable.VariableAllowedValues1
2736
+ | ResolvedVariable.VariableAllowedValues2
2737
+ | null;
2738
+
2739
+ /**
2740
+ * Constraints for variable types
2741
+ */
2742
+ constraints?: ResolvedVariable.Constraints | null;
2743
+
2744
+ /**
2745
+ * Description of the variable's purpose
2746
+ */
2747
+ description?: string | null;
2748
+
2749
+ /**
2750
+ * True if bound_value equals the default value
2751
+ */
2752
+ is_default?: boolean | null;
2753
+
2754
+ /**
2755
+ * True if this is a runtime variable (not resolved at compile time). Runtime
2756
+ * variables have var() placeholders left in compiled SQL for literal substitution
2757
+ * at execution time.
2758
+ */
2759
+ is_runtime?: boolean | null;
2760
+
2761
+ /**
2762
+ * Human-readable label for the variable
2763
+ */
2764
+ label?: string | null;
2765
+ }
2766
+
2767
+ export namespace ResolvedVariable {
2768
+ /**
2769
+ * Allowed values for a variable - either static list or from column
2770
+ */
2771
+ export interface VariableAllowedValues1 {
2772
+ /**
2773
+ * Static list of allowed values with optional labels
2774
+ */
2775
+ static: Array<VariableAllowedValues1.Static>;
2776
+ }
2777
+
2778
+ export namespace VariableAllowedValues1 {
2779
+ /**
2780
+ * A value with optional display label
2781
+ */
2782
+ export interface Static {
2783
+ /**
2784
+ * The actual value
2785
+ */
2786
+ value: string | number | boolean;
2787
+
2788
+ /**
2789
+ * Human-readable label for the value
2790
+ */
2791
+ label?: string | null;
2792
+ }
2793
+ }
2794
+
2795
+ /**
2796
+ * Allowed values for a variable - either static list or from column
2797
+ */
2798
+ export interface VariableAllowedValues2 {
2799
+ /**
2800
+ * Reference to column for dynamic values
2801
+ */
2802
+ from_column: string;
2803
+
2804
+ /**
2805
+ * Cache time-to-live in seconds
2806
+ */
2807
+ cache_ttl?: number;
2808
+
2809
+ /**
2810
+ * Maximum number of values to retrieve
2811
+ */
2812
+ limit?: number;
2813
+
2814
+ /**
2815
+ * Sort order for values
2816
+ */
2817
+ order_by?: 'asc' | 'desc';
2818
+ }
2819
+
2820
+ /**
2821
+ * Constraints for variable types
2822
+ */
2823
+ export interface Constraints {
2824
+ /**
2825
+ * Maximum allowed value
2826
+ */
2827
+ max?: number | null;
2828
+
2829
+ /**
2830
+ * Maximum length for STRING variables
2831
+ */
2832
+ max_length?: number | null;
2833
+
2834
+ /**
2835
+ * Minimum allowed value
2836
+ */
2837
+ min?: number | null;
2838
+
2839
+ /**
2840
+ * Step increment for numeric input
2841
+ */
2842
+ step?: number | null;
2843
+ }
2844
+ }
2845
+
2846
+ /**
2847
+ * A resolved select_from entry with CTE metadata
2848
+ */
2849
+ export interface SelectFrom {
2850
+ /**
2851
+ * CTE alias used in the WITH clause (e.g., **sf_compliance_rate**base)
2852
+ */
2853
+ cte_alias: string;
2854
+
2855
+ /**
2856
+ * Columns produced by the CTE, available as q:query_name.field_name in the parent
2857
+ */
2858
+ output_columns: Array<SelectFrom.OutputColumn>;
2859
+
2860
+ /**
2861
+ * Reference to the source query
2862
+ */
2863
+ ref: string;
2864
+
2865
+ /**
2866
+ * Variable overrides passed to the referenced query
2867
+ */
2868
+ variables?: { [key: string]: string | number | boolean } | null;
2869
+ }
2870
+
2871
+ export namespace SelectFrom {
2872
+ /**
2873
+ * A column produced by a select_from CTE
2874
+ */
2875
+ export interface OutputColumn {
2876
+ /**
2877
+ * The SQL column alias in the CTE output
2878
+ */
2879
+ column_alias: string;
2880
+
2881
+ /**
2882
+ * The field name used in q:query_name.field_name references
2883
+ */
2884
+ field_name: string;
2885
+
2886
+ /**
2887
+ * Original type of the field in the source query
2888
+ */
2889
+ source_type: 'dimension' | 'dimension_date' | 'measure' | 'calculation';
2890
+ }
2891
+ }
2892
+ }
2893
+ }
2894
+
2895
+ export interface CompilerResolveParams {
2896
+ /**
2897
+ * Body param: Connection to resolve against
2898
+ */
2899
+ connection_id: string;
2900
+
2901
+ /**
2902
+ * Body param: Reference to the query template (e.g. 'ref(MY_QUERY)')
2903
+ */
2904
+ query_ref: string;
2905
+
2906
+ /**
2907
+ * Query param
2908
+ */
2909
+ source?: string | null;
2910
+
2911
+ /**
2912
+ * Body param: Automatically fix broken refs caused by renames. Defaults to True.
2913
+ */
2914
+ auto_fix?: boolean;
2915
+
2916
+ /**
2917
+ * Body param: Comma-separated slot selections and variable assignments. Reserved
2918
+ * keys: measure, dimension, filter, calculation. All other keys are variable
2919
+ * assignments. Example: 'measure=Compliance
2920
+ * Rate,dimension=Department,breakdown=region'
2921
+ */
2922
+ combination?: string;
2923
+
2924
+ /**
2925
+ * Header param
2926
+ */
2927
+ 'X-Kater-CLI-ID'?: string;
2928
+ }
2929
+
2930
+ export interface CompilerValidateParams {
2931
+ /**
2932
+ * Query param
2933
+ */
2934
+ source?: string | null;
2935
+
2936
+ /**
2937
+ * Body param: Automatically fix broken refs caused by renames. Defaults to True.
2938
+ */
2939
+ auto_fix?: boolean;
2940
+
2941
+ /**
2942
+ * Body param: Optional connection IDs to validate. If omitted, validates all
2943
+ * connections.
2944
+ */
2945
+ connection_ids?: Array<string> | null;
2946
+
2947
+ /**
2948
+ * Header param
2949
+ */
2950
+ 'X-Kater-CLI-ID'?: string;
2951
+ }
2952
+
2953
+ Compiler.Cache = Cache;
2954
+ Compiler.Combination = CombinationAPICombination;
2955
+
2956
+ export declare namespace Compiler {
2957
+ export {
2958
+ type ChartConfig as ChartConfig,
2959
+ type CompilerErrorItem as CompilerErrorItem,
2960
+ type InlineField as InlineField,
2961
+ type Manifest as Manifest,
2962
+ type ManifestEntry as ManifestEntry,
2963
+ type RefWithLabel as RefWithLabel,
2964
+ type SubqueryCondition as SubqueryCondition,
2965
+ type CompilerCompileResponse as CompilerCompileResponse,
2966
+ type CompilerCompileDashboardResponse as CompilerCompileDashboardResponse,
2967
+ type CompilerEnumerateResponse as CompilerEnumerateResponse,
2968
+ type CompilerExecuteResponse as CompilerExecuteResponse,
2969
+ type CompilerResolveResponse as CompilerResolveResponse,
2970
+ type CompilerValidateResponse as CompilerValidateResponse,
2971
+ type CompilerCompileParams as CompilerCompileParams,
2972
+ type CompilerCompileDashboardParams as CompilerCompileDashboardParams,
2973
+ type CompilerEnumerateParams as CompilerEnumerateParams,
2974
+ type CompilerExecuteParams as CompilerExecuteParams,
2975
+ type CompilerResolveParams as CompilerResolveParams,
2976
+ type CompilerValidateParams as CompilerValidateParams,
2977
+ };
2978
+
2979
+ export { Cache as Cache };
2980
+
2981
+ export {
2982
+ CombinationAPICombination as Combination,
2983
+ type CombinationPreviewResponse as CombinationPreviewResponse,
2984
+ type CombinationPreviewParams as CombinationPreviewParams,
2985
+ };
2986
+
2987
+ export {
2988
+ type ManifestRegenerateAndCreatePrResponse as ManifestRegenerateAndCreatePrResponse,
2989
+ type ManifestRegenerateAndCreatePrParams as ManifestRegenerateAndCreatePrParams,
2990
+ };
2991
+ }