@katerai/sdk 0.9.0 → 0.10.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 (68) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/client.js.map +1 -1
  3. package/client.mjs.map +1 -1
  4. package/package.json +1 -1
  5. package/resources/v1/compiler/cache.d.mts +39 -0
  6. package/resources/v1/compiler/cache.d.mts.map +1 -0
  7. package/resources/v1/compiler/cache.d.ts +39 -0
  8. package/resources/v1/compiler/cache.d.ts.map +1 -0
  9. package/resources/v1/compiler/cache.js +18 -0
  10. package/resources/v1/compiler/cache.js.map +1 -0
  11. package/resources/v1/compiler/cache.mjs +14 -0
  12. package/resources/v1/compiler/cache.mjs.map +1 -0
  13. package/resources/v1/compiler/compiler.d.mts +1893 -0
  14. package/resources/v1/compiler/compiler.d.mts.map +1 -0
  15. package/resources/v1/compiler/compiler.d.ts +1893 -0
  16. package/resources/v1/compiler/compiler.d.ts.map +1 -0
  17. package/resources/v1/compiler/compiler.js +119 -0
  18. package/resources/v1/compiler/compiler.js.map +1 -0
  19. package/resources/v1/compiler/compiler.mjs +114 -0
  20. package/resources/v1/compiler/compiler.mjs.map +1 -0
  21. package/resources/v1/compiler/index.d.mts +3 -0
  22. package/resources/v1/compiler/index.d.mts.map +1 -0
  23. package/resources/v1/compiler/index.d.ts +3 -0
  24. package/resources/v1/compiler/index.d.ts.map +1 -0
  25. package/resources/v1/compiler/index.js +9 -0
  26. package/resources/v1/compiler/index.js.map +1 -0
  27. package/resources/v1/compiler/index.mjs +4 -0
  28. package/resources/v1/compiler/index.mjs.map +1 -0
  29. package/resources/v1/compiler.d.mts +1 -1142
  30. package/resources/v1/compiler.d.mts.map +1 -1
  31. package/resources/v1/compiler.d.ts +1 -1142
  32. package/resources/v1/compiler.d.ts.map +1 -1
  33. package/resources/v1/compiler.js +2 -66
  34. package/resources/v1/compiler.js.map +1 -1
  35. package/resources/v1/compiler.mjs +1 -64
  36. package/resources/v1/compiler.mjs.map +1 -1
  37. package/resources/v1/index.d.mts +1 -1
  38. package/resources/v1/index.d.mts.map +1 -1
  39. package/resources/v1/index.d.ts +1 -1
  40. package/resources/v1/index.d.ts.map +1 -1
  41. package/resources/v1/index.js +4 -4
  42. package/resources/v1/index.js.map +1 -1
  43. package/resources/v1/index.mjs +1 -1
  44. package/resources/v1/index.mjs.map +1 -1
  45. package/resources/v1/v1.d.mts +3 -3
  46. package/resources/v1/v1.d.mts.map +1 -1
  47. package/resources/v1/v1.d.ts +3 -3
  48. package/resources/v1/v1.d.ts.map +1 -1
  49. package/resources/v1/v1.js +2 -2
  50. package/resources/v1/v1.js.map +1 -1
  51. package/resources/v1/v1.mjs +2 -2
  52. package/resources/v1/v1.mjs.map +1 -1
  53. package/src/client.ts +1 -1
  54. package/src/resources/v1/compiler/cache.ts +51 -0
  55. package/src/resources/v1/compiler/compiler.ts +2548 -0
  56. package/src/resources/v1/compiler/index.ts +23 -0
  57. package/src/resources/v1/compiler.ts +1 -1514
  58. package/src/resources/v1/index.ts +5 -1
  59. package/src/resources/v1/v1.ts +17 -9
  60. package/src/version.ts +1 -1
  61. package/version.d.mts +1 -1
  62. package/version.d.mts.map +1 -1
  63. package/version.d.ts +1 -1
  64. package/version.d.ts.map +1 -1
  65. package/version.js +1 -1
  66. package/version.js.map +1 -1
  67. package/version.mjs +1 -1
  68. package/version.mjs.map +1 -1
@@ -1,1516 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../core/resource';
4
- import * as CompilerAPI from './compiler';
5
- import { APIPromise } from '../../core/api-promise';
6
- import { buildHeaders } from '../../internal/headers';
7
- import { RequestOptions } from '../../internal/request-options';
8
-
9
- export class Compiler extends APIResource {
10
- /**
11
- * Compile a resolved query to SQL.
12
- *
13
- * Takes a previously resolved query and generates the final SQL statement for the
14
- * target dialect.
15
- *
16
- * RLS: Filtered to current client (ClientRLSDB).
17
- */
18
- compile(params: CompilerCompileParams, options?: RequestOptions): APIPromise<CompilerCompileResponse> {
19
- const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
20
- return this._client.post('/api/v1/compiler/compile', {
21
- query: { source },
22
- body,
23
- ...options,
24
- headers: buildHeaders([
25
- { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
26
- options?.headers,
27
- ]),
28
- });
29
- }
30
-
31
- /**
32
- * Resolve a query template with user-selected parameters.
33
- *
34
- * Takes a query reference and variable selections, returns the fully resolved
35
- * query object ready for compilation.
36
- *
37
- * RLS: Filtered to current client (ClientRLSDB).
38
- */
39
- resolve(params: CompilerResolveParams, options?: RequestOptions): APIPromise<CompilerResolveResponse> {
40
- const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
41
- return this._client.post('/api/v1/compiler/resolve', {
42
- query: { source },
43
- body,
44
- ...options,
45
- headers: buildHeaders([
46
- { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
47
- options?.headers,
48
- ]),
49
- });
50
- }
51
-
52
- /**
53
- * Validate a schema file set against a connection.
54
- *
55
- * Checks all views, queries, and related schemas for correctness and returns any
56
- * errors or warnings found.
57
- *
58
- * RLS: Filtered to current client (ClientRLSDB).
59
- */
60
- validate(params: CompilerValidateParams, options?: RequestOptions): APIPromise<CompilerValidateResponse> {
61
- const { source, 'X-Kater-CLI-ID': xKaterCliID, ...body } = params;
62
- return this._client.post('/api/v1/compiler/validate', {
63
- query: { source },
64
- body,
65
- ...options,
66
- headers: buildHeaders([
67
- { ...(xKaterCliID != null ? { 'X-Kater-CLI-ID': xKaterCliID } : undefined) },
68
- options?.headers,
69
- ]),
70
- });
71
- }
72
- }
73
-
74
- /**
75
- * Chart configuration with variable references
76
- */
77
- export interface ChartConfig {
78
- /**
79
- * Field or variable reference for color grouping
80
- */
81
- color_by?: string | null;
82
-
83
- /**
84
- * Field or variable reference for size
85
- */
86
- size?: string | null;
87
-
88
- /**
89
- * Field or variable reference for stacking
90
- */
91
- stack_by?: string | null;
92
-
93
- /**
94
- * Field or variable reference for x-axis
95
- */
96
- x_axis?: string | null;
97
-
98
- /**
99
- * Field or variable reference for y-axis
100
- */
101
- y_axis?: string | null;
102
- }
103
-
104
- /**
105
- * A single compiler validation or compilation error.
106
- */
107
- export interface CompilerErrorItem {
108
- /**
109
- * Machine-readable error code
110
- */
111
- code: string;
112
-
113
- /**
114
- * Human-readable error description
115
- */
116
- message: string;
117
-
118
- /**
119
- * Source file path where the error occurred
120
- */
121
- file?: string | null;
122
-
123
- /**
124
- * Line number in the source file
125
- */
126
- line?: number | null;
127
-
128
- /**
129
- * Reference to the source element (e.g. view or query name)
130
- */
131
- ref?: string | null;
132
-
133
- /**
134
- * Suggested fix for this error
135
- */
136
- remediation?: string | null;
137
- }
138
-
139
- /**
140
- * An inline field definition for dimensions/measures/calculations
141
- */
142
- export interface InlineField {
143
- /**
144
- * Unique identifier for this inline field
145
- */
146
- kater_id: string;
147
-
148
- /**
149
- * Name of the inline field
150
- */
151
- name: string;
152
-
153
- /**
154
- * SQL expression for the field
155
- */
156
- sql: string;
157
-
158
- /**
159
- * Human-readable label
160
- */
161
- label?: string | null;
162
- }
163
-
164
- /**
165
- * Compilation manifest with all named objects.
166
- */
167
- export interface Manifest {
168
- generated_at: string;
169
-
170
- objects: { [key: string]: ManifestEntry };
171
-
172
- schema_version?: string;
173
- }
174
-
175
- /**
176
- * A single object entry in the manifest.
177
- */
178
- export interface ManifestEntry {
179
- kater_id: string;
180
-
181
- name: string;
182
-
183
- type: string;
184
-
185
- label?: string | null;
186
-
187
- parent_id?: string | null;
188
-
189
- source_file?: string | null;
190
- }
191
-
192
- /**
193
- * A reference with optional label override
194
- */
195
- export interface RefWithLabel {
196
- /**
197
- * Reference using ref(), var(), or expr() syntax
198
- */
199
- ref: string;
200
-
201
- /**
202
- * Optional label override for this reference
203
- */
204
- label?: string | null;
205
- }
206
-
207
- /**
208
- * A subquery condition for EXISTS/NOT EXISTS filters
209
- */
210
- export interface SubqueryCondition {
211
- /**
212
- * Reference to the source view/table for the subquery
213
- */
214
- from: string;
215
-
216
- /**
217
- * WHERE conditions for the subquery
218
- */
219
- where: Array<string>;
220
- }
221
-
222
- /**
223
- * Response model for SQL compilation.
224
- */
225
- export interface CompilerCompileResponse {
226
- /**
227
- * SQL dialect used (e.g. 'snowflake')
228
- */
229
- dialect: string;
230
-
231
- /**
232
- * Whether compilation succeeded
233
- */
234
- success: boolean;
235
-
236
- /**
237
- * Compilation errors
238
- */
239
- errors?: Array<CompilerErrorItem>;
240
-
241
- /**
242
- * Compilation manifest with all named objects.
243
- */
244
- manifest?: Manifest | null;
245
-
246
- /**
247
- * Compilation metadata from the compiler.
248
- */
249
- metadata?: CompilerCompileResponse.Metadata | null;
250
-
251
- /**
252
- * Generated SQL statement
253
- */
254
- sql?: string | null;
255
- }
256
-
257
- export namespace CompilerCompileResponse {
258
- /**
259
- * Compilation metadata from the compiler.
260
- */
261
- export interface Metadata {
262
- /**
263
- * SQL dialect used (e.g. 'snowflake')
264
- */
265
- dialect: string;
266
-
267
- /**
268
- * Reference to the compiled query
269
- */
270
- query_ref: string;
271
-
272
- /**
273
- * Dimension names used in compilation
274
- */
275
- dimensions_used?: Array<string>;
276
-
277
- /**
278
- * Filter names used in compilation
279
- */
280
- filters_used?: Array<string>;
281
-
282
- /**
283
- * Measure names used in compilation
284
- */
285
- measures_used?: Array<string>;
286
-
287
- /**
288
- * View names used in compilation
289
- */
290
- views_used?: Array<string>;
291
- }
292
- }
293
-
294
- /**
295
- * Response model for a resolved query.
296
- */
297
- export interface CompilerResolveResponse {
298
- /**
299
- * The fully resolved query object
300
- */
301
- resolved_query: CompilerResolveResponse.ResolvedQuery;
302
-
303
- /**
304
- * Dependency graph between schema objects.
305
- */
306
- dependency_graph?: CompilerResolveResponse.DependencyGraph | null;
307
-
308
- /**
309
- * Compilation manifest with all named objects.
310
- */
311
- manifest?: Manifest | null;
312
- }
313
-
314
- export namespace CompilerResolveResponse {
315
- /**
316
- * The fully resolved query object
317
- */
318
- export interface ResolvedQuery {
319
- /**
320
- * Unique identifier for this resolved query instance
321
- */
322
- kater_id: string;
323
-
324
- /**
325
- * Name from the leaf query in the inheritance chain
326
- */
327
- name: string;
328
-
329
- /**
330
- * Reference to the original query template this was resolved from
331
- */
332
- source_query: string;
333
-
334
- /**
335
- * Reference to the topic this query uses (always known after inheritance
336
- * resolution)
337
- */
338
- topic: string;
339
-
340
- /**
341
- * Usage guidance for AI processing
342
- */
343
- ai_context?: string | null;
344
-
345
- /**
346
- * Merged required + selected optional calculations
347
- */
348
- calculations?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
349
-
350
- /**
351
- * Chart recommendations preserved for evaluation
352
- */
353
- chart_hints?: Array<ResolvedQuery.ChartHint1 | ResolvedQuery.ChartHint2Output> | null;
354
-
355
- /**
356
- * Custom properties
357
- */
358
- custom_properties?: { [key: string]: unknown } | null;
359
-
360
- /**
361
- * Description of the query
362
- */
363
- description?: string | null;
364
-
365
- /**
366
- * Merged required + selected optional dimensions
367
- */
368
- dimensions?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
369
-
370
- /**
371
- * Merged required + selected optional filters
372
- */
373
- filters?: Array<
374
- | ResolvedQuery.InlineFieldFilter
375
- | string
376
- | ResolvedQuery.InlineExistsFilter1
377
- | ResolvedQuery.InlineExistsFilter2
378
- > | null;
379
-
380
- /**
381
- * Ordered list of query refs that were merged during inheritance resolution
382
- */
383
- inheritance_chain?: Array<string> | null;
384
-
385
- /**
386
- * Human-readable label with var() values substituted
387
- */
388
- label?: string | null;
389
-
390
- /**
391
- * Maximum number of rows to return
392
- */
393
- limit?: number | null;
394
-
395
- /**
396
- * Merged required + selected optional measures
397
- */
398
- measures?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
399
-
400
- /**
401
- * Sort order specification for query results. Use desc for descending
402
- * (highest/newest first) and asc for ascending (lowest/oldest first).
403
- */
404
- order_by?: ResolvedQuery.OrderBy | null;
405
-
406
- /**
407
- * Access grants required to use this query
408
- */
409
- required_access_grants?: Array<string> | null;
410
-
411
- /**
412
- * The matched chart recommendation after evaluating chart hints
413
- */
414
- resolved_chart?: ResolvedQuery.ResolvedChart | null;
415
-
416
- /**
417
- * Full variable definitions with bound values
418
- */
419
- resolved_variables?: Array<ResolvedQuery.ResolvedVariable> | null;
420
-
421
- /**
422
- * Category of widget that determines data shape constraints for queries
423
- */
424
- widget_category?: 'axis' | 'pie' | 'single_value' | 'heatmap' | 'table' | 'static' | null;
425
- }
426
-
427
- export namespace ResolvedQuery {
428
- /**
429
- * A chart recommendation rule
430
- */
431
- export interface ChartHint1 {
432
- /**
433
- * Chart configuration with variable references
434
- */
435
- config: CompilerAPI.ChartConfig;
436
-
437
- /**
438
- * Type of chart visualization
439
- */
440
- recommend:
441
- | 'line'
442
- | 'bar'
443
- | 'stacked_bar'
444
- | 'area'
445
- | 'pie'
446
- | 'donut'
447
- | 'scatter'
448
- | 'table'
449
- | 'heatmap'
450
- | 'single_value';
451
-
452
- /**
453
- * Conditions based on variable values - can be single value (string) or multiple
454
- * values (array)
455
- */
456
- when: { [key: string]: string | Array<string> };
457
- }
458
-
459
- /**
460
- * A chart recommendation rule
461
- */
462
- export interface ChartHint2Output {
463
- default: ChartHint2Output.Default;
464
- }
465
-
466
- export namespace ChartHint2Output {
467
- export interface Default {
468
- /**
469
- * Chart configuration with variable references
470
- */
471
- config: CompilerAPI.ChartConfig;
472
-
473
- /**
474
- * Type of chart visualization
475
- */
476
- recommend:
477
- | 'line'
478
- | 'bar'
479
- | 'stacked_bar'
480
- | 'area'
481
- | 'pie'
482
- | 'donut'
483
- | 'scatter'
484
- | 'table'
485
- | 'heatmap'
486
- | 'single_value';
487
- }
488
- }
489
-
490
- /**
491
- * An inline filter using field + operator + values
492
- */
493
- export interface InlineFieldFilter {
494
- /**
495
- * Reference to the field to filter on
496
- */
497
- field: string;
498
-
499
- /**
500
- * Name of the inline filter
501
- */
502
- name: string;
503
-
504
- /**
505
- * Filter operator to apply
506
- */
507
- operator:
508
- | 'equals'
509
- | 'not_equals'
510
- | 'in'
511
- | 'not_in'
512
- | 'greater_than'
513
- | 'less_than'
514
- | 'greater_than_or_equals'
515
- | 'less_than_or_equals'
516
- | 'between'
517
- | 'in_the_last'
518
- | 'in_the_next'
519
- | 'contains'
520
- | 'not_contains'
521
- | 'starts_with'
522
- | 'ends_with'
523
- | 'is_null'
524
- | 'is_not_null';
525
-
526
- /**
527
- * SQL expression for the filter value
528
- */
529
- sql_value?: string | null;
530
-
531
- /**
532
- * Fixed values for the filter
533
- */
534
- static_values?: Array<string | number | boolean> | null;
535
- }
536
-
537
- /**
538
- * An inline filter using EXISTS or NOT EXISTS with a subquery
539
- */
540
- export interface InlineExistsFilter1 {
541
- /**
542
- * EXISTS subquery condition
543
- */
544
- exists: CompilerAPI.SubqueryCondition;
545
-
546
- /**
547
- * Name of the inline filter
548
- */
549
- name: string;
550
-
551
- /**
552
- * Description of the filter
553
- */
554
- description?: string | null;
555
-
556
- /**
557
- * Human-readable label
558
- */
559
- label?: string | null;
560
-
561
- /**
562
- * A subquery condition for EXISTS/NOT EXISTS filters
563
- */
564
- not_exists?: CompilerAPI.SubqueryCondition | null;
565
- }
566
-
567
- /**
568
- * An inline filter using EXISTS or NOT EXISTS with a subquery
569
- */
570
- export interface InlineExistsFilter2 {
571
- /**
572
- * Name of the inline filter
573
- */
574
- name: string;
575
-
576
- /**
577
- * NOT EXISTS subquery condition
578
- */
579
- not_exists: CompilerAPI.SubqueryCondition;
580
-
581
- /**
582
- * Description of the filter
583
- */
584
- description?: string | null;
585
-
586
- /**
587
- * A subquery condition for EXISTS/NOT EXISTS filters
588
- */
589
- exists?: CompilerAPI.SubqueryCondition | null;
590
-
591
- /**
592
- * Human-readable label
593
- */
594
- label?: string | null;
595
- }
596
-
597
- /**
598
- * Sort order specification for query results. Use desc for descending
599
- * (highest/newest first) and asc for ascending (lowest/oldest first).
600
- */
601
- export interface OrderBy {
602
- /**
603
- * Fields to sort in ascending order (lowest/oldest first)
604
- */
605
- asc?: Array<string> | null;
606
-
607
- /**
608
- * Fields to sort in descending order (highest/newest first)
609
- */
610
- desc?: Array<string> | null;
611
- }
612
-
613
- /**
614
- * The matched chart recommendation after evaluating chart hints
615
- */
616
- export interface ResolvedChart {
617
- /**
618
- * Chart configuration
619
- */
620
- config: CompilerAPI.ChartConfig;
621
-
622
- /**
623
- * Recommended chart type
624
- */
625
- recommend:
626
- | 'line'
627
- | 'bar'
628
- | 'stacked_bar'
629
- | 'area'
630
- | 'pie'
631
- | 'donut'
632
- | 'scatter'
633
- | 'table'
634
- | 'heatmap'
635
- | 'single_value';
636
- }
637
-
638
- /**
639
- * A variable definition with its bound value
640
- */
641
- export interface ResolvedVariable {
642
- /**
643
- * The concrete value bound for this resolution
644
- */
645
- bound_value: string | number | boolean;
646
-
647
- /**
648
- * Default value for this variable
649
- */
650
- default: string | number | boolean;
651
-
652
- /**
653
- * Variable name identifier
654
- */
655
- name: string;
656
-
657
- /**
658
- * Data type of the variable
659
- */
660
- type:
661
- | 'STRING'
662
- | 'INT'
663
- | 'FLOAT'
664
- | 'DATE'
665
- | 'TIMESTAMP'
666
- | 'BOOL'
667
- | 'DIMENSION'
668
- | 'MEASURE'
669
- | 'CALCULATION'
670
- | 'FILTER';
671
-
672
- /**
673
- * Allowed values configuration
674
- */
675
- allowed_values?:
676
- | ResolvedVariable.VariableAllowedValues1
677
- | ResolvedVariable.VariableAllowedValues2
678
- | null;
679
-
680
- /**
681
- * Constraints for variable types
682
- */
683
- constraints?: ResolvedVariable.Constraints | null;
684
-
685
- /**
686
- * Description of the variable's purpose
687
- */
688
- description?: string | null;
689
-
690
- /**
691
- * True if bound_value equals the default value
692
- */
693
- is_default?: boolean | null;
694
-
695
- /**
696
- * Human-readable label for the variable
697
- */
698
- label?: string | null;
699
- }
700
-
701
- export namespace ResolvedVariable {
702
- /**
703
- * Allowed values for a variable - either static list or from column
704
- */
705
- export interface VariableAllowedValues1 {
706
- /**
707
- * Static list of allowed values with optional labels
708
- */
709
- static: Array<VariableAllowedValues1.Static>;
710
- }
711
-
712
- export namespace VariableAllowedValues1 {
713
- /**
714
- * A value with optional display label
715
- */
716
- export interface Static {
717
- /**
718
- * The actual value
719
- */
720
- value: string | number | boolean;
721
-
722
- /**
723
- * Human-readable label for the value
724
- */
725
- label?: string | null;
726
- }
727
- }
728
-
729
- /**
730
- * Allowed values for a variable - either static list or from column
731
- */
732
- export interface VariableAllowedValues2 {
733
- /**
734
- * Reference to column for dynamic values
735
- */
736
- from_column: string;
737
-
738
- /**
739
- * Cache time-to-live in seconds
740
- */
741
- cache_ttl?: number;
742
-
743
- /**
744
- * Maximum number of values to retrieve
745
- */
746
- limit?: number;
747
-
748
- /**
749
- * Sort order for values
750
- */
751
- order_by?: 'asc' | 'desc';
752
- }
753
-
754
- /**
755
- * Constraints for variable types
756
- */
757
- export interface Constraints {
758
- /**
759
- * Maximum allowed value
760
- */
761
- max?: number | null;
762
-
763
- /**
764
- * Maximum length for STRING variables
765
- */
766
- max_length?: number | null;
767
-
768
- /**
769
- * Minimum allowed value
770
- */
771
- min?: number | null;
772
-
773
- /**
774
- * Step increment for numeric input
775
- */
776
- step?: number | null;
777
- }
778
- }
779
- }
780
-
781
- /**
782
- * Dependency graph between schema objects.
783
- */
784
- export interface DependencyGraph {
785
- /**
786
- * Edge relationships with UUID string keys
787
- */
788
- edges: { [key: string]: { [key: string]: Array<string> } };
789
-
790
- /**
791
- * UUID string to node mapping
792
- */
793
- nodes: { [key: string]: DependencyGraph.Nodes };
794
- }
795
-
796
- export namespace DependencyGraph {
797
- /**
798
- * A node in the dependency graph.
799
- */
800
- export interface Nodes {
801
- /**
802
- * Source file path
803
- */
804
- file: string;
805
-
806
- /**
807
- * Fully qualified name (e.g. 'dim_customer.region')
808
- */
809
- fqn: string;
810
-
811
- /**
812
- * UUID of the schema object
813
- */
814
- kater_id: string;
815
-
816
- /**
817
- * Line number in source file
818
- */
819
- line: number;
820
-
821
- /**
822
- * Node type: QUERY, VIEW, DIMENSION, MEASURE, FILTER, EXPRESSION
823
- */
824
- node_type: string;
825
- }
826
- }
827
- }
828
-
829
- /**
830
- * Response model for schema validation.
831
- */
832
- export interface CompilerValidateResponse {
833
- /**
834
- * Whether validation passed without errors
835
- */
836
- success: boolean;
837
-
838
- /**
839
- * Per-connection validation results with dependency graphs
840
- */
841
- connection_results?: Array<CompilerValidateResponse.ConnectionResult>;
842
-
843
- /**
844
- * Validation errors
845
- */
846
- errors?: Array<CompilerErrorItem>;
847
-
848
- /**
849
- * Validation warnings
850
- */
851
- warnings?: Array<CompilerErrorItem>;
852
- }
853
-
854
- export namespace CompilerValidateResponse {
855
- /**
856
- * Validation result for a single connection.
857
- */
858
- export interface ConnectionResult {
859
- /**
860
- * Connection UUID
861
- */
862
- connection_id: string;
863
-
864
- /**
865
- * Connection name
866
- */
867
- connection_name: string;
868
-
869
- /**
870
- * Whether this connection validated without errors
871
- */
872
- success: boolean;
873
-
874
- /**
875
- * Dependency graph between schema objects.
876
- */
877
- dependency_graph?: ConnectionResult.DependencyGraph | null;
878
-
879
- /**
880
- * Validation errors for this connection
881
- */
882
- errors?: Array<CompilerAPI.CompilerErrorItem>;
883
-
884
- /**
885
- * Validation warnings for this connection
886
- */
887
- warnings?: Array<CompilerAPI.CompilerErrorItem>;
888
- }
889
-
890
- export namespace ConnectionResult {
891
- /**
892
- * Dependency graph between schema objects.
893
- */
894
- export interface DependencyGraph {
895
- /**
896
- * Edge relationships with UUID string keys
897
- */
898
- edges: { [key: string]: { [key: string]: Array<string> } };
899
-
900
- /**
901
- * UUID string to node mapping
902
- */
903
- nodes: { [key: string]: DependencyGraph.Nodes };
904
- }
905
-
906
- export namespace DependencyGraph {
907
- /**
908
- * A node in the dependency graph.
909
- */
910
- export interface Nodes {
911
- /**
912
- * Source file path
913
- */
914
- file: string;
915
-
916
- /**
917
- * Fully qualified name (e.g. 'dim_customer.region')
918
- */
919
- fqn: string;
920
-
921
- /**
922
- * UUID of the schema object
923
- */
924
- kater_id: string;
925
-
926
- /**
927
- * Line number in source file
928
- */
929
- line: number;
930
-
931
- /**
932
- * Node type: QUERY, VIEW, DIMENSION, MEASURE, FILTER, EXPRESSION
933
- */
934
- node_type: string;
935
- }
936
- }
937
- }
938
- }
939
-
940
- export interface CompilerCompileParams {
941
- /**
942
- * Body param: Connection to compile against
943
- */
944
- connection_id: string;
945
-
946
- /**
947
- * Body param: Previously resolved query object from /resolve
948
- */
949
- resolved_query: CompilerCompileParams.ResolvedQuery;
950
-
951
- /**
952
- * Query param
953
- */
954
- source?: string | null;
955
-
956
- /**
957
- * Body param: Optional tenant database override
958
- */
959
- tenant_database?: string | null;
960
-
961
- /**
962
- * Header param
963
- */
964
- 'X-Kater-CLI-ID'?: string;
965
- }
966
-
967
- export namespace CompilerCompileParams {
968
- /**
969
- * Previously resolved query object from /resolve
970
- */
971
- export interface ResolvedQuery {
972
- /**
973
- * Unique identifier for this resolved query instance
974
- */
975
- kater_id: string;
976
-
977
- /**
978
- * Name from the leaf query in the inheritance chain
979
- */
980
- name: string;
981
-
982
- /**
983
- * Reference to the original query template this was resolved from
984
- */
985
- source_query: string;
986
-
987
- /**
988
- * Reference to the topic this query uses (always known after inheritance
989
- * resolution)
990
- */
991
- topic: string;
992
-
993
- /**
994
- * Usage guidance for AI processing
995
- */
996
- ai_context?: string | null;
997
-
998
- /**
999
- * Merged required + selected optional calculations
1000
- */
1001
- calculations?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1002
-
1003
- /**
1004
- * Chart recommendations preserved for evaluation
1005
- */
1006
- chart_hints?: Array<ResolvedQuery.ChartHint1 | ResolvedQuery.ChartHint2Input> | null;
1007
-
1008
- /**
1009
- * Custom properties
1010
- */
1011
- custom_properties?: { [key: string]: unknown } | null;
1012
-
1013
- /**
1014
- * Description of the query
1015
- */
1016
- description?: string | null;
1017
-
1018
- /**
1019
- * Merged required + selected optional dimensions
1020
- */
1021
- dimensions?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1022
-
1023
- /**
1024
- * Merged required + selected optional filters
1025
- */
1026
- filters?: Array<
1027
- | ResolvedQuery.InlineFieldFilter
1028
- | string
1029
- | ResolvedQuery.InlineExistsFilter1
1030
- | ResolvedQuery.InlineExistsFilter2
1031
- > | null;
1032
-
1033
- /**
1034
- * Ordered list of query refs that were merged during inheritance resolution
1035
- */
1036
- inheritance_chain?: Array<string> | null;
1037
-
1038
- /**
1039
- * Human-readable label with var() values substituted
1040
- */
1041
- label?: string | null;
1042
-
1043
- /**
1044
- * Maximum number of rows to return
1045
- */
1046
- limit?: number | null;
1047
-
1048
- /**
1049
- * Merged required + selected optional measures
1050
- */
1051
- measures?: Array<CompilerAPI.RefWithLabel | CompilerAPI.InlineField | string> | null;
1052
-
1053
- /**
1054
- * Sort order specification for query results. Use desc for descending
1055
- * (highest/newest first) and asc for ascending (lowest/oldest first).
1056
- */
1057
- order_by?: ResolvedQuery.OrderBy | null;
1058
-
1059
- /**
1060
- * Access grants required to use this query
1061
- */
1062
- required_access_grants?: Array<string> | null;
1063
-
1064
- /**
1065
- * The matched chart recommendation after evaluating chart hints
1066
- */
1067
- resolved_chart?: ResolvedQuery.ResolvedChart | null;
1068
-
1069
- /**
1070
- * Full variable definitions with bound values
1071
- */
1072
- resolved_variables?: Array<ResolvedQuery.ResolvedVariable> | null;
1073
-
1074
- /**
1075
- * Category of widget that determines data shape constraints for queries
1076
- */
1077
- widget_category?: 'axis' | 'pie' | 'single_value' | 'heatmap' | 'table' | 'static' | null;
1078
- }
1079
-
1080
- export namespace ResolvedQuery {
1081
- /**
1082
- * A chart recommendation rule
1083
- */
1084
- export interface ChartHint1 {
1085
- /**
1086
- * Chart configuration with variable references
1087
- */
1088
- config: CompilerAPI.ChartConfig;
1089
-
1090
- /**
1091
- * Type of chart visualization
1092
- */
1093
- recommend:
1094
- | 'line'
1095
- | 'bar'
1096
- | 'stacked_bar'
1097
- | 'area'
1098
- | 'pie'
1099
- | 'donut'
1100
- | 'scatter'
1101
- | 'table'
1102
- | 'heatmap'
1103
- | 'single_value';
1104
-
1105
- /**
1106
- * Conditions based on variable values - can be single value (string) or multiple
1107
- * values (array)
1108
- */
1109
- when: { [key: string]: string | Array<string> };
1110
- }
1111
-
1112
- /**
1113
- * A chart recommendation rule
1114
- */
1115
- export interface ChartHint2Input {
1116
- default: ChartHint2Input.Default;
1117
- }
1118
-
1119
- export namespace ChartHint2Input {
1120
- export interface Default {
1121
- /**
1122
- * Chart configuration with variable references
1123
- */
1124
- config: CompilerAPI.ChartConfig;
1125
-
1126
- /**
1127
- * Type of chart visualization
1128
- */
1129
- recommend:
1130
- | 'line'
1131
- | 'bar'
1132
- | 'stacked_bar'
1133
- | 'area'
1134
- | 'pie'
1135
- | 'donut'
1136
- | 'scatter'
1137
- | 'table'
1138
- | 'heatmap'
1139
- | 'single_value';
1140
- }
1141
- }
1142
-
1143
- /**
1144
- * An inline filter using field + operator + values
1145
- */
1146
- export interface InlineFieldFilter {
1147
- /**
1148
- * Reference to the field to filter on
1149
- */
1150
- field: string;
1151
-
1152
- /**
1153
- * Name of the inline filter
1154
- */
1155
- name: string;
1156
-
1157
- /**
1158
- * Filter operator to apply
1159
- */
1160
- operator:
1161
- | 'equals'
1162
- | 'not_equals'
1163
- | 'in'
1164
- | 'not_in'
1165
- | 'greater_than'
1166
- | 'less_than'
1167
- | 'greater_than_or_equals'
1168
- | 'less_than_or_equals'
1169
- | 'between'
1170
- | 'in_the_last'
1171
- | 'in_the_next'
1172
- | 'contains'
1173
- | 'not_contains'
1174
- | 'starts_with'
1175
- | 'ends_with'
1176
- | 'is_null'
1177
- | 'is_not_null';
1178
-
1179
- /**
1180
- * SQL expression for the filter value
1181
- */
1182
- sql_value?: string | null;
1183
-
1184
- /**
1185
- * Fixed values for the filter
1186
- */
1187
- static_values?: Array<string | number | boolean> | null;
1188
- }
1189
-
1190
- /**
1191
- * An inline filter using EXISTS or NOT EXISTS with a subquery
1192
- */
1193
- export interface InlineExistsFilter1 {
1194
- /**
1195
- * EXISTS subquery condition
1196
- */
1197
- exists: CompilerAPI.SubqueryCondition;
1198
-
1199
- /**
1200
- * Name of the inline filter
1201
- */
1202
- name: string;
1203
-
1204
- /**
1205
- * Description of the filter
1206
- */
1207
- description?: string | null;
1208
-
1209
- /**
1210
- * Human-readable label
1211
- */
1212
- label?: string | null;
1213
-
1214
- /**
1215
- * A subquery condition for EXISTS/NOT EXISTS filters
1216
- */
1217
- not_exists?: CompilerAPI.SubqueryCondition | null;
1218
- }
1219
-
1220
- /**
1221
- * An inline filter using EXISTS or NOT EXISTS with a subquery
1222
- */
1223
- export interface InlineExistsFilter2 {
1224
- /**
1225
- * Name of the inline filter
1226
- */
1227
- name: string;
1228
-
1229
- /**
1230
- * NOT EXISTS subquery condition
1231
- */
1232
- not_exists: CompilerAPI.SubqueryCondition;
1233
-
1234
- /**
1235
- * Description of the filter
1236
- */
1237
- description?: string | null;
1238
-
1239
- /**
1240
- * A subquery condition for EXISTS/NOT EXISTS filters
1241
- */
1242
- exists?: CompilerAPI.SubqueryCondition | null;
1243
-
1244
- /**
1245
- * Human-readable label
1246
- */
1247
- label?: string | null;
1248
- }
1249
-
1250
- /**
1251
- * Sort order specification for query results. Use desc for descending
1252
- * (highest/newest first) and asc for ascending (lowest/oldest first).
1253
- */
1254
- export interface OrderBy {
1255
- /**
1256
- * Fields to sort in ascending order (lowest/oldest first)
1257
- */
1258
- asc?: Array<string> | null;
1259
-
1260
- /**
1261
- * Fields to sort in descending order (highest/newest first)
1262
- */
1263
- desc?: Array<string> | null;
1264
- }
1265
-
1266
- /**
1267
- * The matched chart recommendation after evaluating chart hints
1268
- */
1269
- export interface ResolvedChart {
1270
- /**
1271
- * Chart configuration
1272
- */
1273
- config: CompilerAPI.ChartConfig;
1274
-
1275
- /**
1276
- * Recommended chart type
1277
- */
1278
- recommend:
1279
- | 'line'
1280
- | 'bar'
1281
- | 'stacked_bar'
1282
- | 'area'
1283
- | 'pie'
1284
- | 'donut'
1285
- | 'scatter'
1286
- | 'table'
1287
- | 'heatmap'
1288
- | 'single_value';
1289
- }
1290
-
1291
- /**
1292
- * A variable definition with its bound value
1293
- */
1294
- export interface ResolvedVariable {
1295
- /**
1296
- * The concrete value bound for this resolution
1297
- */
1298
- bound_value: string | number | boolean;
1299
-
1300
- /**
1301
- * Default value for this variable
1302
- */
1303
- default: string | number | boolean;
1304
-
1305
- /**
1306
- * Variable name identifier
1307
- */
1308
- name: string;
1309
-
1310
- /**
1311
- * Data type of the variable
1312
- */
1313
- type:
1314
- | 'STRING'
1315
- | 'INT'
1316
- | 'FLOAT'
1317
- | 'DATE'
1318
- | 'TIMESTAMP'
1319
- | 'BOOL'
1320
- | 'DIMENSION'
1321
- | 'MEASURE'
1322
- | 'CALCULATION'
1323
- | 'FILTER';
1324
-
1325
- /**
1326
- * Allowed values configuration
1327
- */
1328
- allowed_values?:
1329
- | ResolvedVariable.VariableAllowedValues1
1330
- | ResolvedVariable.VariableAllowedValues2
1331
- | null;
1332
-
1333
- /**
1334
- * Constraints for variable types
1335
- */
1336
- constraints?: ResolvedVariable.Constraints | null;
1337
-
1338
- /**
1339
- * Description of the variable's purpose
1340
- */
1341
- description?: string | null;
1342
-
1343
- /**
1344
- * True if bound_value equals the default value
1345
- */
1346
- is_default?: boolean | null;
1347
-
1348
- /**
1349
- * Human-readable label for the variable
1350
- */
1351
- label?: string | null;
1352
- }
1353
-
1354
- export namespace ResolvedVariable {
1355
- /**
1356
- * Allowed values for a variable - either static list or from column
1357
- */
1358
- export interface VariableAllowedValues1 {
1359
- /**
1360
- * Static list of allowed values with optional labels
1361
- */
1362
- static: Array<VariableAllowedValues1.Static>;
1363
- }
1364
-
1365
- export namespace VariableAllowedValues1 {
1366
- /**
1367
- * A value with optional display label
1368
- */
1369
- export interface Static {
1370
- /**
1371
- * The actual value
1372
- */
1373
- value: string | number | boolean;
1374
-
1375
- /**
1376
- * Human-readable label for the value
1377
- */
1378
- label?: string | null;
1379
- }
1380
- }
1381
-
1382
- /**
1383
- * Allowed values for a variable - either static list or from column
1384
- */
1385
- export interface VariableAllowedValues2 {
1386
- /**
1387
- * Reference to column for dynamic values
1388
- */
1389
- from_column: string;
1390
-
1391
- /**
1392
- * Cache time-to-live in seconds
1393
- */
1394
- cache_ttl?: number;
1395
-
1396
- /**
1397
- * Maximum number of values to retrieve
1398
- */
1399
- limit?: number;
1400
-
1401
- /**
1402
- * Sort order for values
1403
- */
1404
- order_by?: 'asc' | 'desc';
1405
- }
1406
-
1407
- /**
1408
- * Constraints for variable types
1409
- */
1410
- export interface Constraints {
1411
- /**
1412
- * Maximum allowed value
1413
- */
1414
- max?: number | null;
1415
-
1416
- /**
1417
- * Maximum length for STRING variables
1418
- */
1419
- max_length?: number | null;
1420
-
1421
- /**
1422
- * Minimum allowed value
1423
- */
1424
- min?: number | null;
1425
-
1426
- /**
1427
- * Step increment for numeric input
1428
- */
1429
- step?: number | null;
1430
- }
1431
- }
1432
- }
1433
- }
1434
-
1435
- export interface CompilerResolveParams {
1436
- /**
1437
- * Body param: Connection to resolve against
1438
- */
1439
- connection_id: string;
1440
-
1441
- /**
1442
- * Body param: Reference to the query template (e.g. 'ref(MY_QUERY)')
1443
- */
1444
- query_ref: string;
1445
-
1446
- /**
1447
- * Query param
1448
- */
1449
- source?: string | null;
1450
-
1451
- /**
1452
- * Body param: Calculation names to include
1453
- */
1454
- include_calculations?: Array<string>;
1455
-
1456
- /**
1457
- * Body param: Dimension names to include
1458
- */
1459
- include_dimensions?: Array<string>;
1460
-
1461
- /**
1462
- * Body param: Filter names to include
1463
- */
1464
- include_filters?: Array<string>;
1465
-
1466
- /**
1467
- * Body param: Measure names to include
1468
- */
1469
- include_measures?: Array<string>;
1470
-
1471
- /**
1472
- * Body param: User-selected variable values
1473
- */
1474
- variables?: { [key: string]: unknown };
1475
-
1476
- /**
1477
- * Header param
1478
- */
1479
- 'X-Kater-CLI-ID'?: string;
1480
- }
1481
-
1482
- export interface CompilerValidateParams {
1483
- /**
1484
- * Query param
1485
- */
1486
- source?: string | null;
1487
-
1488
- /**
1489
- * Body param: Optional connection IDs to validate. If omitted, validates all
1490
- * connections.
1491
- */
1492
- connection_ids?: Array<string> | null;
1493
-
1494
- /**
1495
- * Header param
1496
- */
1497
- 'X-Kater-CLI-ID'?: string;
1498
- }
1499
-
1500
- export declare namespace Compiler {
1501
- export {
1502
- type ChartConfig as ChartConfig,
1503
- type CompilerErrorItem as CompilerErrorItem,
1504
- type InlineField as InlineField,
1505
- type Manifest as Manifest,
1506
- type ManifestEntry as ManifestEntry,
1507
- type RefWithLabel as RefWithLabel,
1508
- type SubqueryCondition as SubqueryCondition,
1509
- type CompilerCompileResponse as CompilerCompileResponse,
1510
- type CompilerResolveResponse as CompilerResolveResponse,
1511
- type CompilerValidateResponse as CompilerValidateResponse,
1512
- type CompilerCompileParams as CompilerCompileParams,
1513
- type CompilerResolveParams as CompilerResolveParams,
1514
- type CompilerValidateParams as CompilerValidateParams,
1515
- };
1516
- }
3
+ export * from './compiler/index';