@duckcodeailabs/dql-core 0.1.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/LICENSE +123 -0
- package/dist/ast/index.d.ts +4 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +4 -0
- package/dist/ast/index.js.map +1 -0
- package/dist/ast/nodes.d.ts +205 -0
- package/dist/ast/nodes.d.ts.map +1 -0
- package/dist/ast/nodes.js +33 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/ast/printer.d.ts +3 -0
- package/dist/ast/printer.d.ts.map +1 -0
- package/dist/ast/printer.js +157 -0
- package/dist/ast/printer.js.map +1 -0
- package/dist/ast/visitor.d.ts +45 -0
- package/dist/ast/visitor.d.ts.map +1 -0
- package/dist/ast/visitor.js +155 -0
- package/dist/ast/visitor.js.map +1 -0
- package/dist/errors/diagnostic.d.ts +23 -0
- package/dist/errors/diagnostic.d.ts.map +1 -0
- package/dist/errors/diagnostic.js +13 -0
- package/dist/errors/diagnostic.js.map +1 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +3 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/reporter.d.ts +22 -0
- package/dist/errors/reporter.d.ts.map +1 -0
- package/dist/errors/reporter.js +64 -0
- package/dist/errors/reporter.js.map +1 -0
- package/dist/formatter/formatter.d.ts +8 -0
- package/dist/formatter/formatter.d.ts.map +1 -0
- package/dist/formatter/formatter.js +243 -0
- package/dist/formatter/formatter.js.map +1 -0
- package/dist/formatter/index.d.ts +2 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +2 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/lexer/index.d.ts +3 -0
- package/dist/lexer/index.d.ts.map +1 -0
- package/dist/lexer/index.js +3 -0
- package/dist/lexer/index.js.map +1 -0
- package/dist/lexer/lexer.d.ts +43 -0
- package/dist/lexer/lexer.d.ts.map +1 -0
- package/dist/lexer/lexer.js +346 -0
- package/dist/lexer/lexer.js.map +1 -0
- package/dist/lexer/token.d.ts +72 -0
- package/dist/lexer/token.d.ts.map +1 -0
- package/dist/lexer/token.js +170 -0
- package/dist/lexer/token.js.map +1 -0
- package/dist/parser/index.d.ts +2 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +2 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/parser.d.ts +50 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +1024 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/semantic/analyzer.d.ts +27 -0
- package/dist/semantic/analyzer.d.ts.map +1 -0
- package/dist/semantic/analyzer.js +580 -0
- package/dist/semantic/analyzer.js.map +1 -0
- package/dist/semantic/index.d.ts +4 -0
- package/dist/semantic/index.d.ts.map +1 -0
- package/dist/semantic/index.js +3 -0
- package/dist/semantic/index.js.map +1 -0
- package/dist/semantic/semantic-layer.d.ts +118 -0
- package/dist/semantic/semantic-layer.d.ts.map +1 -0
- package/dist/semantic/semantic-layer.js +264 -0
- package/dist/semantic/semantic-layer.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
import { DiagnosticReporter, DQLSemanticError } from '../errors/reporter.js';
|
|
2
|
+
import { NodeKind, } from '../ast/nodes.js';
|
|
3
|
+
const COMMON_OPTIONAL = {
|
|
4
|
+
title: 'string',
|
|
5
|
+
title_font_size: 'number',
|
|
6
|
+
theme: 'string',
|
|
7
|
+
color: 'string',
|
|
8
|
+
show_grid: 'boolean',
|
|
9
|
+
show_legend: 'boolean',
|
|
10
|
+
width: 'number',
|
|
11
|
+
height: 'number',
|
|
12
|
+
// Interactive features
|
|
13
|
+
on_click: 'string',
|
|
14
|
+
drill_down: 'string',
|
|
15
|
+
link_to: 'string',
|
|
16
|
+
filter_by: 'any',
|
|
17
|
+
drill_hierarchy: 'string',
|
|
18
|
+
drill_path: 'string',
|
|
19
|
+
drill_mode: 'string',
|
|
20
|
+
// Chart enhancements
|
|
21
|
+
y2: 'identifier',
|
|
22
|
+
tooltip: 'any',
|
|
23
|
+
format_x: 'string',
|
|
24
|
+
format_y: 'string',
|
|
25
|
+
color_rule: 'string',
|
|
26
|
+
connection: 'string',
|
|
27
|
+
// Table enhancements
|
|
28
|
+
pin_columns: 'string[]',
|
|
29
|
+
row_color: 'string',
|
|
30
|
+
};
|
|
31
|
+
const CHART_ARG_SCHEMAS = {
|
|
32
|
+
line: {
|
|
33
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
34
|
+
optional: {
|
|
35
|
+
...COMMON_OPTIONAL,
|
|
36
|
+
line_width: 'number',
|
|
37
|
+
fill_opacity: 'number',
|
|
38
|
+
x_axis_label: 'string',
|
|
39
|
+
y_axis_label: 'string',
|
|
40
|
+
stroke_dash: 'string',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
bar: {
|
|
44
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
45
|
+
optional: {
|
|
46
|
+
...COMMON_OPTIONAL,
|
|
47
|
+
orientation: 'string',
|
|
48
|
+
bar_width: 'number',
|
|
49
|
+
x_axis_label: 'string',
|
|
50
|
+
y_axis_label: 'string',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
scatter: {
|
|
54
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
55
|
+
optional: {
|
|
56
|
+
...COMMON_OPTIONAL,
|
|
57
|
+
size: 'identifier',
|
|
58
|
+
x_axis_label: 'string',
|
|
59
|
+
y_axis_label: 'string',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
area: {
|
|
63
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
64
|
+
optional: {
|
|
65
|
+
...COMMON_OPTIONAL,
|
|
66
|
+
fill_opacity: 'number',
|
|
67
|
+
x_axis_label: 'string',
|
|
68
|
+
y_axis_label: 'string',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
pie: {
|
|
72
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
73
|
+
optional: {
|
|
74
|
+
...COMMON_OPTIONAL,
|
|
75
|
+
inner_radius: 'number',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
heatmap: {
|
|
79
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
80
|
+
optional: {
|
|
81
|
+
...COMMON_OPTIONAL,
|
|
82
|
+
color_field: 'identifier',
|
|
83
|
+
x_axis_label: 'string',
|
|
84
|
+
y_axis_label: 'string',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
kpi: {
|
|
88
|
+
required: {},
|
|
89
|
+
optional: {
|
|
90
|
+
...COMMON_OPTIONAL,
|
|
91
|
+
metrics: 'string[]',
|
|
92
|
+
compare_to_previous: 'boolean',
|
|
93
|
+
formatting: 'string',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
table: {
|
|
97
|
+
required: {},
|
|
98
|
+
optional: {
|
|
99
|
+
...COMMON_OPTIONAL,
|
|
100
|
+
columns: 'string[]',
|
|
101
|
+
sortable: 'boolean',
|
|
102
|
+
page_size: 'number',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
metric: {
|
|
106
|
+
required: {},
|
|
107
|
+
optional: {
|
|
108
|
+
...COMMON_OPTIONAL,
|
|
109
|
+
format: 'string',
|
|
110
|
+
compare_to_previous: 'boolean',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
stacked_bar: {
|
|
114
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
115
|
+
optional: {
|
|
116
|
+
...COMMON_OPTIONAL,
|
|
117
|
+
orientation: 'string',
|
|
118
|
+
x_axis_label: 'string',
|
|
119
|
+
y_axis_label: 'string',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
grouped_bar: {
|
|
123
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
124
|
+
optional: {
|
|
125
|
+
...COMMON_OPTIONAL,
|
|
126
|
+
orientation: 'string',
|
|
127
|
+
x_axis_label: 'string',
|
|
128
|
+
y_axis_label: 'string',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
combo: {
|
|
132
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
133
|
+
optional: {
|
|
134
|
+
...COMMON_OPTIONAL,
|
|
135
|
+
color_field: 'identifier',
|
|
136
|
+
line_width: 'number',
|
|
137
|
+
x_axis_label: 'string',
|
|
138
|
+
y_axis_label: 'string',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
histogram: {
|
|
142
|
+
required: { x: 'identifier' },
|
|
143
|
+
optional: {
|
|
144
|
+
...COMMON_OPTIONAL,
|
|
145
|
+
y: 'identifier',
|
|
146
|
+
x_axis_label: 'string',
|
|
147
|
+
y_axis_label: 'string',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
funnel: {
|
|
151
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
152
|
+
optional: {
|
|
153
|
+
...COMMON_OPTIONAL,
|
|
154
|
+
x_axis_label: 'string',
|
|
155
|
+
y_axis_label: 'string',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
treemap: {
|
|
159
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
160
|
+
optional: {
|
|
161
|
+
...COMMON_OPTIONAL,
|
|
162
|
+
color_field: 'identifier',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
sankey: {
|
|
166
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
167
|
+
optional: {
|
|
168
|
+
...COMMON_OPTIONAL,
|
|
169
|
+
color_field: 'identifier',
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
sparkline: {
|
|
173
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
174
|
+
optional: {
|
|
175
|
+
...COMMON_OPTIONAL,
|
|
176
|
+
line_width: 'number',
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
small_multiples: {
|
|
180
|
+
required: { x: 'identifier', y: 'identifier', facet: 'identifier' },
|
|
181
|
+
optional: {
|
|
182
|
+
...COMMON_OPTIONAL,
|
|
183
|
+
color_field: 'identifier',
|
|
184
|
+
line_width: 'number',
|
|
185
|
+
x_axis_label: 'string',
|
|
186
|
+
y_axis_label: 'string',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
gauge: {
|
|
190
|
+
required: { y: 'identifier' },
|
|
191
|
+
optional: {
|
|
192
|
+
...COMMON_OPTIONAL,
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
waterfall: {
|
|
196
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
197
|
+
optional: {
|
|
198
|
+
...COMMON_OPTIONAL,
|
|
199
|
+
x_axis_label: 'string',
|
|
200
|
+
y_axis_label: 'string',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
boxplot: {
|
|
204
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
205
|
+
optional: {
|
|
206
|
+
...COMMON_OPTIONAL,
|
|
207
|
+
x_axis_label: 'string',
|
|
208
|
+
y_axis_label: 'string',
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
geo: {
|
|
212
|
+
required: { x: 'identifier', y: 'identifier' },
|
|
213
|
+
optional: {
|
|
214
|
+
...COMMON_OPTIONAL,
|
|
215
|
+
color_field: 'identifier',
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
// ---- Filter Argument Schemas ----
|
|
220
|
+
const FILTER_ARG_SCHEMAS = {
|
|
221
|
+
dropdown: {
|
|
222
|
+
required: { label: 'string', param: 'string' },
|
|
223
|
+
optional: { default_value: 'string', placeholder: 'string', width: 'number' },
|
|
224
|
+
},
|
|
225
|
+
date_range: {
|
|
226
|
+
required: { label: 'string', param: 'string' },
|
|
227
|
+
optional: { default_value: 'string', format: 'string', width: 'number' },
|
|
228
|
+
},
|
|
229
|
+
text: {
|
|
230
|
+
required: { label: 'string', param: 'string' },
|
|
231
|
+
optional: { placeholder: 'string', debounce: 'number', width: 'number' },
|
|
232
|
+
},
|
|
233
|
+
multi_select: {
|
|
234
|
+
required: { label: 'string', param: 'string' },
|
|
235
|
+
optional: { default_value: 'string[]', placeholder: 'string', width: 'number' },
|
|
236
|
+
},
|
|
237
|
+
range: {
|
|
238
|
+
required: { label: 'string', param: 'string' },
|
|
239
|
+
optional: { min: 'number', max: 'number', step: 'number', width: 'number' },
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
const SAFE_RLS_COLUMN = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/;
|
|
243
|
+
const RLS_TEMPLATE_VARIABLE = /^\{[A-Za-z_][A-Za-z0-9_.]*\}$/;
|
|
244
|
+
// ---- Analyzer ----
|
|
245
|
+
export class SemanticAnalyzer {
|
|
246
|
+
reporter;
|
|
247
|
+
scopes = [];
|
|
248
|
+
constructor() {
|
|
249
|
+
this.reporter = new DiagnosticReporter();
|
|
250
|
+
}
|
|
251
|
+
analyze(program) {
|
|
252
|
+
this.reporter.clear();
|
|
253
|
+
this.scopes = [];
|
|
254
|
+
for (const stmt of program.statements) {
|
|
255
|
+
switch (stmt.kind) {
|
|
256
|
+
case NodeKind.Dashboard:
|
|
257
|
+
this.analyzeDashboard(stmt);
|
|
258
|
+
break;
|
|
259
|
+
case NodeKind.ChartCall:
|
|
260
|
+
this.analyzeChartCall(stmt);
|
|
261
|
+
break;
|
|
262
|
+
case NodeKind.Workbook:
|
|
263
|
+
this.analyzeWorkbook(stmt);
|
|
264
|
+
break;
|
|
265
|
+
case NodeKind.ImportDecl:
|
|
266
|
+
// Import validation is handled at compile time
|
|
267
|
+
break;
|
|
268
|
+
case NodeKind.BlockDecl:
|
|
269
|
+
this.analyzeBlockDecl(stmt);
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return this.reporter.getAll();
|
|
274
|
+
}
|
|
275
|
+
validate(program) {
|
|
276
|
+
const diagnostics = this.analyze(program);
|
|
277
|
+
const errors = diagnostics.filter((d) => d.severity === 'error');
|
|
278
|
+
if (errors.length > 0) {
|
|
279
|
+
throw new DQLSemanticError(`Semantic errors found: ${errors.map((e) => e.message).join('; ')}`, errors);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
analyzeWorkbook(node) {
|
|
283
|
+
this.validateDecorators(node.decorators, 'dashboard');
|
|
284
|
+
if (node.pages.length === 0) {
|
|
285
|
+
this.reporter.warning('Workbook has no pages.', node.span);
|
|
286
|
+
}
|
|
287
|
+
for (const page of node.pages) {
|
|
288
|
+
this.analyzePage(page);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
analyzePage(node) {
|
|
292
|
+
this.pushScope();
|
|
293
|
+
this.analyzeBodyItems(node.body, node.span);
|
|
294
|
+
this.popScope();
|
|
295
|
+
}
|
|
296
|
+
analyzeBlockDecl(node) {
|
|
297
|
+
this.validateDecorators(node.decorators, 'dashboard');
|
|
298
|
+
if (!node.name || node.name.trim().length === 0) {
|
|
299
|
+
this.reporter.error('Block must have a non-empty name.', node.span);
|
|
300
|
+
}
|
|
301
|
+
if (!node.domain) {
|
|
302
|
+
this.reporter.warning('Block is missing a domain declaration.', node.span);
|
|
303
|
+
}
|
|
304
|
+
if (node.blockType === 'semantic') {
|
|
305
|
+
// Semantic blocks carry provenance (metricRef) and optionally pre-compiled SQL
|
|
306
|
+
// produced by an import adapter (dbt YAML, schema introspection, MetricFlow).
|
|
307
|
+
// Having both metricRef and query is the canonical imported-block shape.
|
|
308
|
+
if (!node.metricRef) {
|
|
309
|
+
this.reporter.warning('A semantic block should declare the dbt metric it references via metric = "metric_name".', node.span);
|
|
310
|
+
}
|
|
311
|
+
if (node.query && !node.metricRef) {
|
|
312
|
+
this.reporter.error('A semantic block must not contain a query field. Semantic blocks route to the MetricFlow API at query time; only custom blocks execute raw SQL. Declare this block as type = "custom" or remove the query field and add metric = "metric_name".', node.span);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else if (node.blockType === 'custom') {
|
|
316
|
+
// Custom blocks route to the SQL runtime — they must contain a query.
|
|
317
|
+
if (!node.query) {
|
|
318
|
+
this.reporter.error('A custom block must have a query field containing the certified SQL. Add a query = """SELECT ...""" block.', node.span);
|
|
319
|
+
}
|
|
320
|
+
if (node.metricRef) {
|
|
321
|
+
this.reporter.warning('A custom block should not declare a metric reference. The metric field is only meaningful on semantic blocks.', node.span);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// Validate SQL interpolations in block query
|
|
325
|
+
if (node.query) {
|
|
326
|
+
// Register block params as variables so SQL interpolations resolve
|
|
327
|
+
this.pushScope();
|
|
328
|
+
if (node.params) {
|
|
329
|
+
for (const p of node.params.params) {
|
|
330
|
+
this.currentScope().variables.set(p.name, {
|
|
331
|
+
kind: NodeKind.VariableDecl,
|
|
332
|
+
name: p.name,
|
|
333
|
+
initializer: p.initializer,
|
|
334
|
+
span: p.span,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
this.validateSQLInterpolations(node.query);
|
|
339
|
+
this.popScope();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
analyzeDashboard(node) {
|
|
343
|
+
this.validateDecorators(node.decorators, 'dashboard');
|
|
344
|
+
this.pushScope();
|
|
345
|
+
this.analyzeBodyItems(node.body, node.span);
|
|
346
|
+
this.popScope();
|
|
347
|
+
}
|
|
348
|
+
analyzeBodyItems(body, parentSpan) {
|
|
349
|
+
if (body.length === 0) {
|
|
350
|
+
this.reporter.warning('Dashboard/page has no charts.', parentSpan);
|
|
351
|
+
}
|
|
352
|
+
for (const item of body) {
|
|
353
|
+
switch (item.kind) {
|
|
354
|
+
case NodeKind.VariableDecl:
|
|
355
|
+
this.analyzeVariableDecl(item);
|
|
356
|
+
break;
|
|
357
|
+
case NodeKind.ParamDecl:
|
|
358
|
+
this.analyzeParamDecl(item);
|
|
359
|
+
break;
|
|
360
|
+
case NodeKind.ChartCall:
|
|
361
|
+
this.analyzeChartCall(item);
|
|
362
|
+
break;
|
|
363
|
+
case NodeKind.FilterCall:
|
|
364
|
+
this.analyzeFilterCall(item);
|
|
365
|
+
break;
|
|
366
|
+
case NodeKind.UseDecl:
|
|
367
|
+
// Use declarations are resolved at compile time
|
|
368
|
+
break;
|
|
369
|
+
case NodeKind.LayoutBlock:
|
|
370
|
+
for (const row of item.rows) {
|
|
371
|
+
for (const rowItem of row.items) {
|
|
372
|
+
if (rowItem.node.kind === NodeKind.ChartCall) {
|
|
373
|
+
this.analyzeChartCall(rowItem.node);
|
|
374
|
+
}
|
|
375
|
+
else if (rowItem.node.kind === NodeKind.FilterCall) {
|
|
376
|
+
this.analyzeFilterCall(rowItem.node);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
analyzeParamDecl(node) {
|
|
385
|
+
const scope = this.currentScope();
|
|
386
|
+
if (scope.variables.has(node.name)) {
|
|
387
|
+
this.reporter.error(`Parameter '${node.name}' conflicts with an existing variable in this scope.`, node.span);
|
|
388
|
+
}
|
|
389
|
+
// Register param as a variable so SQL interpolations can reference it
|
|
390
|
+
scope.variables.set(node.name, {
|
|
391
|
+
kind: NodeKind.VariableDecl,
|
|
392
|
+
name: node.name,
|
|
393
|
+
initializer: node.defaultValue ?? { kind: NodeKind.StringLiteral, value: '', span: node.span },
|
|
394
|
+
span: node.span,
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
analyzeChartCall(node) {
|
|
398
|
+
this.validateDecorators(node.decorators, 'chart');
|
|
399
|
+
this.validateChartArgs(node);
|
|
400
|
+
this.validateSQLInterpolations(node.query);
|
|
401
|
+
}
|
|
402
|
+
analyzeFilterCall(node) {
|
|
403
|
+
const schema = FILTER_ARG_SCHEMAS[node.filterType];
|
|
404
|
+
if (!schema)
|
|
405
|
+
return;
|
|
406
|
+
const provided = new Set(node.args.map((a) => a.name));
|
|
407
|
+
// Check required args
|
|
408
|
+
for (const [name] of Object.entries(schema.required)) {
|
|
409
|
+
if (!provided.has(name)) {
|
|
410
|
+
this.reporter.error(`filter.${node.filterType} requires argument '${name}'.`, node.span, `Add ${name} = "..." to the filter call.`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
// Check for unknown args
|
|
414
|
+
for (const arg of node.args) {
|
|
415
|
+
if (!(arg.name in schema.required) && !(arg.name in schema.optional)) {
|
|
416
|
+
this.reporter.warning(`Unknown argument '${arg.name}' for filter.${node.filterType}.`, arg.span, `Valid arguments: ${[...Object.keys(schema.required), ...Object.keys(schema.optional)].join(', ')}`);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
// Validate SQL interpolations in filter query if present
|
|
420
|
+
if (node.query) {
|
|
421
|
+
this.validateSQLInterpolations(node.query);
|
|
422
|
+
}
|
|
423
|
+
// Register filter param as an implicitly-defined variable so dashboards can
|
|
424
|
+
// reference it in SQL templates via {param_name} without a separate `param` declaration.
|
|
425
|
+
const paramArg = node.args.find((a) => a.name === 'param');
|
|
426
|
+
if (paramArg && paramArg.value.kind === NodeKind.StringLiteral) {
|
|
427
|
+
const scope = this.currentScope();
|
|
428
|
+
const paramName = paramArg.value.value;
|
|
429
|
+
if (!scope.variables.has(paramName)) {
|
|
430
|
+
const defaultArg = node.args.find((a) => a.name === 'default_value');
|
|
431
|
+
const initializer = defaultArg?.value ?? { kind: NodeKind.StringLiteral, value: '', span: node.span };
|
|
432
|
+
scope.variables.set(paramName, {
|
|
433
|
+
kind: NodeKind.VariableDecl,
|
|
434
|
+
name: paramName,
|
|
435
|
+
initializer,
|
|
436
|
+
span: node.span,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
analyzeVariableDecl(node) {
|
|
442
|
+
const scope = this.currentScope();
|
|
443
|
+
if (scope.variables.has(node.name)) {
|
|
444
|
+
this.reporter.error(`Variable '${node.name}' is already declared in this scope.`, node.span);
|
|
445
|
+
}
|
|
446
|
+
scope.variables.set(node.name, node);
|
|
447
|
+
}
|
|
448
|
+
validateChartArgs(node) {
|
|
449
|
+
const schema = CHART_ARG_SCHEMAS[node.chartType];
|
|
450
|
+
if (!schema)
|
|
451
|
+
return;
|
|
452
|
+
const provided = new Set(node.args.map((a) => a.name));
|
|
453
|
+
// Check required args
|
|
454
|
+
for (const [name] of Object.entries(schema.required)) {
|
|
455
|
+
if (!provided.has(name)) {
|
|
456
|
+
this.reporter.error(`chart.${node.chartType} requires argument '${name}'.`, node.span, `Add ${name} = <column_name> to the chart call.`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
// Check for unknown args
|
|
460
|
+
for (const arg of node.args) {
|
|
461
|
+
if (!(arg.name in schema.required) && !(arg.name in schema.optional)) {
|
|
462
|
+
this.reporter.warning(`Unknown argument '${arg.name}' for chart.${node.chartType}.`, arg.span, `Valid arguments: ${[...Object.keys(schema.required), ...Object.keys(schema.optional)].join(', ')}`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const drillHierarchyArg = node.args.find((a) => a.name === 'drill_hierarchy');
|
|
466
|
+
const drillPathArg = node.args.find((a) => a.name === 'drill_path');
|
|
467
|
+
const drillModeArg = node.args.find((a) => a.name === 'drill_mode');
|
|
468
|
+
if ((drillPathArg || drillModeArg) && !drillHierarchyArg) {
|
|
469
|
+
this.reporter.warning('drill_path/drill_mode provided without drill_hierarchy. Hierarchy-driven drill may not activate.', (drillPathArg ?? drillModeArg ?? node).span);
|
|
470
|
+
}
|
|
471
|
+
if (drillModeArg && drillModeArg.value.kind === NodeKind.StringLiteral) {
|
|
472
|
+
const drillMode = drillModeArg.value.value;
|
|
473
|
+
const allowedModes = new Set(['modal', 'replace', 'expand']);
|
|
474
|
+
if (!allowedModes.has(drillMode)) {
|
|
475
|
+
this.reporter.error(`Invalid drill_mode '${drillMode}'. Allowed values: modal, replace, expand.`, drillModeArg.span);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
validateSQLInterpolations(node) {
|
|
480
|
+
for (const interp of node.interpolations) {
|
|
481
|
+
if (!this.resolveVariable(interp.variableName)) {
|
|
482
|
+
this.reporter.error(`Undefined variable '${interp.variableName}' in SQL template.`, interp.span, `Declare it with: let ${interp.variableName} = ...`);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
validateDecorators(decorators, context) {
|
|
487
|
+
for (const dec of decorators) {
|
|
488
|
+
switch (dec.name) {
|
|
489
|
+
case 'schedule':
|
|
490
|
+
if (dec.arguments.length === 0) {
|
|
491
|
+
this.reporter.error('@schedule requires at least one argument (e.g., daily, "9:00 AM").', dec.span);
|
|
492
|
+
}
|
|
493
|
+
break;
|
|
494
|
+
case 'email_to':
|
|
495
|
+
if (dec.arguments.length === 0) {
|
|
496
|
+
this.reporter.error('@email_to requires at least one email address.', dec.span);
|
|
497
|
+
}
|
|
498
|
+
break;
|
|
499
|
+
case 'cache':
|
|
500
|
+
case 'slack_channel':
|
|
501
|
+
case 'refresh':
|
|
502
|
+
// Valid decorators with future implementation
|
|
503
|
+
break;
|
|
504
|
+
case 'if':
|
|
505
|
+
if (context !== 'chart') {
|
|
506
|
+
this.reporter.error('@if can only be applied to chart declarations.', dec.span);
|
|
507
|
+
}
|
|
508
|
+
if (dec.arguments.length === 0) {
|
|
509
|
+
this.reporter.error('@if requires a parameter name as argument (e.g., @if(show_details)).', dec.span);
|
|
510
|
+
}
|
|
511
|
+
break;
|
|
512
|
+
case 'rls':
|
|
513
|
+
if (context !== 'chart') {
|
|
514
|
+
this.reporter.error('@rls can only be applied to chart declarations.', dec.span);
|
|
515
|
+
}
|
|
516
|
+
if (dec.arguments.length < 2) {
|
|
517
|
+
this.reporter.error('@rls requires two arguments: column name and value (e.g., @rls("org_id", "{user.org}")).', dec.span);
|
|
518
|
+
}
|
|
519
|
+
if (dec.arguments.length >= 1) {
|
|
520
|
+
const columnArg = dec.arguments[0];
|
|
521
|
+
const columnName = columnArg.kind === NodeKind.StringLiteral
|
|
522
|
+
? columnArg.value
|
|
523
|
+
: (columnArg.kind === NodeKind.Identifier ? columnArg.name : '');
|
|
524
|
+
if (!columnName || !SAFE_RLS_COLUMN.test(columnName.trim())) {
|
|
525
|
+
this.reporter.error('@rls first argument must be a safe SQL column identifier (letters/numbers/underscores, optional dot paths).', dec.span);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (dec.arguments.length >= 2 && dec.arguments[1].kind === NodeKind.StringLiteral) {
|
|
529
|
+
const raw = dec.arguments[1].value.trim();
|
|
530
|
+
if (raw.startsWith('{') && raw.endsWith('}') && !RLS_TEMPLATE_VARIABLE.test(raw)) {
|
|
531
|
+
this.reporter.error('@rls template values must use {variable_name} or {scope.name} format.', dec.span);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
break;
|
|
535
|
+
case 'annotate':
|
|
536
|
+
if (context !== 'chart') {
|
|
537
|
+
this.reporter.error('@annotate can only be applied to chart declarations.', dec.span);
|
|
538
|
+
}
|
|
539
|
+
if (dec.arguments.length < 2) {
|
|
540
|
+
this.reporter.error('@annotate requires at least 2 arguments: x value and label (e.g., @annotate("2024-06-01", "Launch")).', dec.span);
|
|
541
|
+
}
|
|
542
|
+
break;
|
|
543
|
+
case 'materialize':
|
|
544
|
+
if (context !== 'chart') {
|
|
545
|
+
this.reporter.error('@materialize can only be applied to chart declarations.', dec.span);
|
|
546
|
+
}
|
|
547
|
+
break;
|
|
548
|
+
case 'alert':
|
|
549
|
+
break;
|
|
550
|
+
default:
|
|
551
|
+
this.reporter.warning(`Unknown decorator '@${dec.name}'.`, dec.span, `Valid decorators: @schedule, @email_to, @cache, @slack_channel, @refresh, @if, @rls, @annotate, @materialize, @alert`);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
resolveVariable(name) {
|
|
556
|
+
for (let i = this.scopes.length - 1; i >= 0; i--) {
|
|
557
|
+
const found = this.scopes[i].variables.get(name);
|
|
558
|
+
if (found)
|
|
559
|
+
return found;
|
|
560
|
+
}
|
|
561
|
+
return undefined;
|
|
562
|
+
}
|
|
563
|
+
pushScope() {
|
|
564
|
+
this.scopes.push({ variables: new Map() });
|
|
565
|
+
}
|
|
566
|
+
popScope() {
|
|
567
|
+
this.scopes.pop();
|
|
568
|
+
}
|
|
569
|
+
currentScope() {
|
|
570
|
+
if (this.scopes.length === 0) {
|
|
571
|
+
this.pushScope();
|
|
572
|
+
}
|
|
573
|
+
return this.scopes[this.scopes.length - 1];
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
export function analyze(program) {
|
|
577
|
+
const analyzer = new SemanticAnalyzer();
|
|
578
|
+
return analyzer.analyze(program);
|
|
579
|
+
}
|
|
580
|
+
//# sourceMappingURL=analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzer.js","sourceRoot":"","sources":["../../src/semantic/analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE7E,OAAO,EACL,QAAQ,GAeT,MAAM,iBAAiB,CAAC;AAWzB,MAAM,eAAe,GAA4B;IAC/C,KAAK,EAAE,QAAQ;IACf,eAAe,EAAE,QAAQ;IACzB,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,uBAAuB;IACvB,QAAQ,EAAE,QAAQ;IAClB,UAAU,EAAE,QAAQ;IACpB,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,KAAK;IAChB,eAAe,EAAE,QAAQ;IACzB,UAAU,EAAE,QAA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;QACd,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAEO,YAAY;QAClB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,UAAU,OAAO,CAAC,OAAoB;IAC1C,MAAM,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACxC,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SemanticAnalyzer, analyze } from './analyzer.js';
|
|
2
|
+
export { SemanticLayer, parseMetricDefinition, parseDimensionDefinition, parseHierarchyDefinition, parseBlockCompanionDefinition, } from './semantic-layer.js';
|
|
3
|
+
export type { MetricDefinition, DimensionDefinition, HierarchyDefinition, BlockCompanionDefinition, HierarchyLevelDefinition, HierarchyDrillPathDefinition, HierarchyRollupType, SemanticLayerConfig, } from './semantic-layer.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/semantic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/semantic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC"}
|