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