@malloydata/malloy 0.0.190 → 0.0.191-dev240925232958
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/dist/lang/ast/expressions/constant-expression.js +4 -1
- package/dist/lang/ast/expressions/expr-aggregate-function.js +25 -14
- package/dist/lang/ast/expressions/expr-alternation-tree.js +1 -3
- package/dist/lang/ast/expressions/expr-cast.js +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.js +1 -1
- package/dist/lang/ast/expressions/expr-func.js +20 -31
- package/dist/lang/ast/expressions/expr-granular-time.js +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.js +1 -3
- package/dist/lang/ast/expressions/expr-props.js +8 -8
- package/dist/lang/ast/expressions/expr-time-extract.js +7 -13
- package/dist/lang/ast/expressions/expr-ungroup.js +4 -8
- package/dist/lang/ast/expressions/for-range.js +2 -3
- package/dist/lang/ast/expressions/function-ordering.js +6 -6
- package/dist/lang/ast/expressions/partial-compare.js +1 -3
- package/dist/lang/ast/expressions/pick-when.js +30 -20
- package/dist/lang/ast/expressions/range.js +1 -1
- package/dist/lang/ast/expressions/top-by.js +1 -1
- package/dist/lang/ast/field-space/dynamic-space.js +1 -1
- package/dist/lang/ast/field-space/index-field-space.js +6 -6
- package/dist/lang/ast/field-space/parameter-space.js +14 -3
- package/dist/lang/ast/field-space/project-field-space.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.d.ts +2 -1
- package/dist/lang/ast/field-space/query-spaces.js +7 -6
- package/dist/lang/ast/field-space/reference-field.js +1 -1
- package/dist/lang/ast/field-space/refined-space.js +3 -3
- package/dist/lang/ast/field-space/static-space.js +11 -2
- package/dist/lang/ast/parameters/has-parameter.js +4 -4
- package/dist/lang/ast/query-builders/index-builder.js +4 -4
- package/dist/lang/ast/query-builders/project-builder.js +2 -2
- package/dist/lang/ast/query-builders/reduce-builder.js +5 -5
- package/dist/lang/ast/query-elements/anonymous-query.js +1 -1
- package/dist/lang/ast/query-elements/query-reference.js +2 -2
- package/dist/lang/ast/query-items/field-declaration.js +7 -4
- package/dist/lang/ast/query-items/field-references.js +1 -1
- package/dist/lang/ast/query-items/typecheck_utils.js +31 -11
- package/dist/lang/ast/query-properties/filters.js +4 -4
- package/dist/lang/ast/query-properties/ordering.js +3 -3
- package/dist/lang/ast/query-properties/qop-desc.js +2 -2
- package/dist/lang/ast/query-properties/top.js +5 -5
- package/dist/lang/ast/query-utils.js +1 -1
- package/dist/lang/ast/source-elements/named-source.d.ts +2 -2
- package/dist/lang/ast/source-elements/named-source.js +12 -13
- package/dist/lang/ast/source-elements/refined-source.js +9 -7
- package/dist/lang/ast/source-elements/sql-source.js +5 -5
- package/dist/lang/ast/source-elements/table-source.js +2 -2
- package/dist/lang/ast/source-properties/joins.js +6 -6
- package/dist/lang/ast/source-properties/renames.js +3 -3
- package/dist/lang/ast/source-query-elements/source-query-element.d.ts +2 -1
- package/dist/lang/ast/source-query-elements/source-query-element.js +3 -2
- package/dist/lang/ast/source-query-elements/sq-arrow.js +2 -2
- package/dist/lang/ast/source-query-elements/sq-extend.js +1 -1
- package/dist/lang/ast/source-query-elements/sq-reference.js +5 -5
- package/dist/lang/ast/source-query-elements/sq-refine.js +2 -2
- package/dist/lang/ast/source-query-elements/sq-source.js +1 -1
- package/dist/lang/ast/sql-elements/sql-string.js +2 -2
- package/dist/lang/ast/statements/define-query.js +2 -2
- package/dist/lang/ast/statements/define-source.js +3 -3
- package/dist/lang/ast/statements/import-statement.js +7 -7
- package/dist/lang/ast/struct-utils.js +1 -1
- package/dist/lang/ast/types/expression-def.js +21 -22
- package/dist/lang/ast/types/lookup-result.d.ts +5 -1
- package/dist/lang/ast/types/malloy-element.d.ts +8 -5
- package/dist/lang/ast/types/malloy-element.js +33 -27
- package/dist/lang/ast/view-elements/qop-desc-view.js +3 -3
- package/dist/lang/ast/view-elements/reference-view.js +6 -6
- package/dist/lang/ast/view-elements/refine-utils.js +6 -6
- package/dist/lang/ast/view-elements/view-arrow.js +1 -1
- package/dist/lang/ast/view-elements/view-refine.js +1 -1
- package/dist/lang/malloy-to-ast.d.ts +7 -7
- package/dist/lang/malloy-to-ast.js +56 -55
- package/dist/lang/parse-log.d.ts +323 -6
- package/dist/lang/parse-log.js +62 -16
- package/dist/lang/parse-malloy.d.ts +5 -3
- package/dist/lang/parse-malloy.js +22 -31
- package/dist/lang/test/annotation.spec.js +4 -4
- package/dist/lang/test/expressions.spec.js +93 -74
- package/dist/lang/test/imports.spec.js +5 -5
- package/dist/lang/test/lenses.spec.js +18 -18
- package/dist/lang/test/literals.spec.js +1 -1
- package/dist/lang/test/locations.spec.js +5 -5
- package/dist/lang/test/parameters.spec.js +34 -34
- package/dist/lang/test/parse-expects.d.ts +10 -28
- package/dist/lang/test/parse-expects.js +38 -33
- package/dist/lang/test/parse.spec.js +49 -49
- package/dist/lang/test/query.spec.js +82 -82
- package/dist/lang/test/source.spec.js +6 -6
- package/dist/lang/test/test-translator.d.ts +19 -0
- package/dist/lang/test/test-translator.js +20 -1
- package/dist/tags.js +4 -2
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ describe('query:', () => {
|
|
|
47
47
|
test('run:anonymous query', () => expect('run: a -> { group_by: astr }').toTranslate());
|
|
48
48
|
test('query:anonymous query m4 warning', () => {
|
|
49
49
|
expect((0, test_translator_1.markSource) `##! m4warnings=warn
|
|
50
|
-
query: ${'a -> { group_by: astr }'}`).
|
|
50
|
+
query: ${'a -> { group_by: astr }'}`).toLog((0, test_translator_1.warningMessage)('Anonymous `query:` statements are deprecated, use `run:` instead'));
|
|
51
51
|
});
|
|
52
52
|
test('named query:', () => expect('query: aq is a -> { group_by: astr }').toTranslate());
|
|
53
53
|
test('run query ref', () => expect(`
|
|
@@ -147,7 +147,7 @@ describe('query:', () => {
|
|
|
147
147
|
group_by: ai
|
|
148
148
|
aggregate: bi_count is all(count(), afloat)
|
|
149
149
|
}
|
|
150
|
-
}`).
|
|
150
|
+
}`).toLog((0, test_translator_1.errorMessage)("all() 'afloat' is missing from query output"));
|
|
151
151
|
});
|
|
152
152
|
test('exclude ungroup with args', () => {
|
|
153
153
|
expect(`
|
|
@@ -175,7 +175,7 @@ describe('query:', () => {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
`).
|
|
178
|
+
`).toLog((0, test_translator_1.errorMessage)("exclude() 'aaa' is missing from query output"));
|
|
179
179
|
});
|
|
180
180
|
test('exclude problem revealed by production models', () => {
|
|
181
181
|
expect(`
|
|
@@ -221,53 +221,53 @@ describe('query:', () => {
|
|
|
221
221
|
describe('query operation typechecking', () => {
|
|
222
222
|
describe('field declarations', () => {
|
|
223
223
|
test('cannot use aggregate in group_by', () => {
|
|
224
|
-
expect('run: a -> { group_by: s is count()}').
|
|
224
|
+
expect('run: a -> { group_by: s is count()}').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a group_by operation, did you mean to use an aggregate operation instead?'));
|
|
225
225
|
});
|
|
226
226
|
test('cannot use ungrouped_aggregate in group_by', () => {
|
|
227
|
-
expect('run: a -> { group_by: s is all(count())}').
|
|
227
|
+
expect('run: a -> { group_by: s is all(count())}').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a group_by operation, did you mean to use an aggregate operation instead?'));
|
|
228
228
|
});
|
|
229
229
|
test('cannot use analytic in group_by', () => {
|
|
230
|
-
expect('run: a -> { group_by: s is row_number()}').
|
|
230
|
+
expect('run: a -> { group_by: s is row_number()}').toLog((0, test_translator_1.errorMessage)('Cannot use an analytic field in a group_by operation, did you mean to use a calculate operation instead?'));
|
|
231
231
|
});
|
|
232
232
|
test('cannot use aggregate in dimension', () => {
|
|
233
|
-
expect('source: a1 is a extend { dimension: s is count()}').
|
|
233
|
+
expect('source: a1 is a extend { dimension: s is count()}').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a dimension declaration, did you mean to use a measure declaration instead?'));
|
|
234
234
|
});
|
|
235
235
|
test('cannot use ungrouped_aggregate in dimension', () => {
|
|
236
|
-
expect('source: a1 is a extend { dimension: s is all(count())}').
|
|
236
|
+
expect('source: a1 is a extend { dimension: s is all(count())}').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a dimension declaration, did you mean to use a measure declaration instead?'));
|
|
237
237
|
});
|
|
238
238
|
test('cannot use analytic in dimension', () => {
|
|
239
|
-
expect('source: a1 is a extend { dimension: s is row_number()}').
|
|
239
|
+
expect('source: a1 is a extend { dimension: s is row_number()}').toLog((0, test_translator_1.errorMessage)('Cannot use an analytic field in a dimension declaration'));
|
|
240
240
|
});
|
|
241
241
|
test('cannot use scalar in measure', () => {
|
|
242
|
-
expect('source: a1 is a extend { measure: s is 1}').
|
|
242
|
+
expect('source: a1 is a extend { measure: s is 1}').toLog((0, test_translator_1.errorMessage)('Cannot use a scalar field in a measure declaration, did you mean to use a dimension declaration instead?'));
|
|
243
243
|
});
|
|
244
244
|
test('cannot use analytic in measure', () => {
|
|
245
|
-
expect('source: a1 is a extend { measure: s is lag(count())}').
|
|
245
|
+
expect('source: a1 is a extend { measure: s is lag(count())}').toLog((0, test_translator_1.errorMessage)('Cannot use an analytic field in a measure declaration'));
|
|
246
246
|
});
|
|
247
247
|
test('cannot use scalar in aggregate', () => {
|
|
248
|
-
expect('run: a -> { aggregate: s is 1}').
|
|
248
|
+
expect('run: a -> { aggregate: s is 1}').toLog((0, test_translator_1.errorMessage)('Cannot use a scalar field in an aggregate operation, did you mean to use a group_by or select operation instead?'));
|
|
249
249
|
});
|
|
250
250
|
test('cannot use analytic in aggregate', () => {
|
|
251
|
-
expect('run: a -> { aggregate: s is lag(count())}').
|
|
251
|
+
expect('run: a -> { aggregate: s is lag(count())}').toLog((0, test_translator_1.errorMessage)('Cannot use an analytic field in an aggregate operation, did you mean to use a calculate operation instead?'));
|
|
252
252
|
});
|
|
253
253
|
test('cannot use scalar in calculate', () => {
|
|
254
|
-
expect('run: a -> { group_by: a is 1; calculate: s is 1 }').
|
|
254
|
+
expect('run: a -> { group_by: a is 1; calculate: s is 1 }').toLog((0, test_translator_1.errorMessage)('Cannot use a scalar field in a calculate operation, did you mean to use a group_by or select operation instead?'));
|
|
255
255
|
});
|
|
256
256
|
test('cannot use aggregate in calculate', () => {
|
|
257
|
-
expect('run: a -> { group_by: a is 1; calculate: s is count() }').
|
|
257
|
+
expect('run: a -> { group_by: a is 1; calculate: s is count() }').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a calculate operation, did you mean to use an aggregate operation instead?'));
|
|
258
258
|
});
|
|
259
259
|
test('cannot use aggregate in project', () => {
|
|
260
|
-
expect('run: a -> { select: s is count() }').
|
|
260
|
+
expect('run: a -> { select: s is count() }').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a select operation, did you mean to use an aggregate operation instead?'));
|
|
261
261
|
});
|
|
262
262
|
test('cannot use analytic in project', () => {
|
|
263
|
-
expect('run: a -> { select: s is row_number() }').
|
|
263
|
+
expect('run: a -> { select: s is row_number() }').toLog((0, test_translator_1.errorMessage)('Cannot use an analytic field in a select operation, did you mean to use a calculate operation instead?'));
|
|
264
264
|
});
|
|
265
265
|
test('cannot use analytic in extended source', () => {
|
|
266
266
|
expect(`##! -m4warnings
|
|
267
|
-
run: a -> { group_by: a is 1; declare: s is row_number() }`).
|
|
267
|
+
run: a -> { group_by: a is 1; declare: s is row_number() }`).toLog((0, test_translator_1.errorMessage)('Analytic expressions can not be used in a declare block'));
|
|
268
268
|
});
|
|
269
269
|
test('cannot use aggregate in index', () => {
|
|
270
|
-
expect('run: a extend { measure: acount is count() } -> { index: acount }').
|
|
270
|
+
expect('run: a extend { measure: acount is count() } -> { index: acount }').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in an index operation'));
|
|
271
271
|
});
|
|
272
272
|
test('can use aggregate in except', () => {
|
|
273
273
|
expect(`
|
|
@@ -278,31 +278,31 @@ describe('query:', () => {
|
|
|
278
278
|
});
|
|
279
279
|
describe('field references', () => {
|
|
280
280
|
test('cannot use aggregate in group_by', () => {
|
|
281
|
-
expect('run: a -> { extend: {measure: acount is count()} group_by: acount }').
|
|
281
|
+
expect('run: a -> { extend: {measure: acount is count()} group_by: acount }').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a group_by operation, did you mean to use an aggregate operation instead?'));
|
|
282
282
|
});
|
|
283
283
|
test('cannot use query in group_by', () => {
|
|
284
|
-
expect('run: a extend { view: q is { group_by: x is 1 } } -> { group_by: q }').
|
|
284
|
+
expect('run: a extend { view: q is { group_by: x is 1 } } -> { group_by: q }').toLog((0, test_translator_1.errorMessage)('Cannot use a view field in a group_by operation, did you mean to use a nest operation instead?'));
|
|
285
285
|
});
|
|
286
286
|
test('cannot use scalar in aggregate', () => {
|
|
287
|
-
expect('run: a -> { extend: {dimension: aconst is 1} aggregate: aconst }').
|
|
287
|
+
expect('run: a -> { extend: {dimension: aconst is 1} aggregate: aconst }').toLog((0, test_translator_1.errorMessage)('Cannot use a scalar field in an aggregate operation, did you mean to use a group_by or select operation instead?'));
|
|
288
288
|
});
|
|
289
289
|
test('cannot use scalar in calculate', () => {
|
|
290
|
-
expect('run: a -> { extend: {dimension: aconst is 1} group_by: x is 1; calculate: aconst }').
|
|
290
|
+
expect('run: a -> { extend: {dimension: aconst is 1} group_by: x is 1; calculate: aconst }').toLog((0, test_translator_1.errorMessage)('Cannot use a scalar field in a calculate operation, did you mean to use a group_by or select operation instead?'));
|
|
291
291
|
});
|
|
292
292
|
test('cannot use aggregate in calculate', () => {
|
|
293
|
-
expect('run: a -> { extend: {measure: acount is count()} group_by: x is 1; calculate: acount }').
|
|
293
|
+
expect('run: a -> { extend: {measure: acount is count()} group_by: x is 1; calculate: acount }').toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a calculate operation, did you mean to use an aggregate operation instead?'));
|
|
294
294
|
});
|
|
295
295
|
test('cannot use query in project', () => {
|
|
296
|
-
expect('run: a extend { view: q is { group_by: x is 1 } } -> { select: q }').
|
|
296
|
+
expect('run: a extend { view: q is { group_by: x is 1 } } -> { select: q }').toLog((0, test_translator_1.errorMessage)('Cannot use a view field in a select operation, did you mean to use a nest operation instead?'));
|
|
297
297
|
});
|
|
298
298
|
test('cannot use query in index', () => {
|
|
299
|
-
expect('run: a extend { view: q is { group_by: x is 1 } } -> { index: q }').
|
|
299
|
+
expect('run: a extend { view: q is { group_by: x is 1 } } -> { index: q }').toLog((0, test_translator_1.errorMessage)('Cannot use a view field in an index operation'));
|
|
300
300
|
});
|
|
301
301
|
test('cannot use query in calculate', () => {
|
|
302
|
-
expect('run: a extend { view: q is { group_by: x is 1 } } -> { group_by: x is 1; calculate: q }').
|
|
302
|
+
expect('run: a extend { view: q is { group_by: x is 1 } } -> { group_by: x is 1; calculate: q }').toLog((0, test_translator_1.errorMessage)('Cannot use a view field in a calculate operation, did you mean to use a nest operation instead?'));
|
|
303
303
|
});
|
|
304
304
|
test('cannot use query in aggregate', () => {
|
|
305
|
-
expect('run: a extend { view: q is { group_by: x is 1 } } -> { aggregate: q }').
|
|
305
|
+
expect('run: a extend { view: q is { group_by: x is 1 } } -> { aggregate: q }').toLog((0, test_translator_1.errorMessage)('Cannot use a view field in an aggregate operation, did you mean to use a nest operation instead?'));
|
|
306
306
|
});
|
|
307
307
|
test('cannot use aggregate in calculate, preserved over refinement', () => {
|
|
308
308
|
expect(`query: a1 is a -> {
|
|
@@ -310,7 +310,7 @@ describe('query:', () => {
|
|
|
310
310
|
}
|
|
311
311
|
run: a1 + {
|
|
312
312
|
calculate: b is c
|
|
313
|
-
}`).
|
|
313
|
+
}`).toLog((0, test_translator_1.errorMessage)('Cannot use an aggregate field in a calculate operation, did you mean to use an aggregate operation instead?'));
|
|
314
314
|
});
|
|
315
315
|
test('cannot use scalar in calculate, preserved over refinement', () => {
|
|
316
316
|
expect(`query: a1 is a -> {
|
|
@@ -318,7 +318,7 @@ describe('query:', () => {
|
|
|
318
318
|
}
|
|
319
319
|
run: a1 + {
|
|
320
320
|
calculate: b is c
|
|
321
|
-
}`).
|
|
321
|
+
}`).toLog((0, test_translator_1.errorMessage)('Cannot use a scalar field in a calculate operation, did you mean to use a group_by or select operation instead?'));
|
|
322
322
|
});
|
|
323
323
|
test('cannot use analytic in group_by, preserved over refinement', () => {
|
|
324
324
|
expect(`query: a1 is a -> {
|
|
@@ -327,9 +327,9 @@ describe('query:', () => {
|
|
|
327
327
|
}
|
|
328
328
|
run: a1 + {
|
|
329
329
|
group_by: b is c2
|
|
330
|
-
}`).
|
|
330
|
+
}`).toLog(
|
|
331
331
|
// c2 is not defined because group_by doesn't know to look in the output space
|
|
332
|
-
"'c2' is not defined");
|
|
332
|
+
(0, test_translator_1.errorMessage)("'c2' is not defined"));
|
|
333
333
|
});
|
|
334
334
|
test('cannot use analytic in order_by, preserved over refinement', () => {
|
|
335
335
|
expect(`query: a1 is a -> {
|
|
@@ -338,25 +338,25 @@ describe('query:', () => {
|
|
|
338
338
|
}
|
|
339
339
|
run: a1 + {
|
|
340
340
|
order_by: c2
|
|
341
|
-
}`).
|
|
341
|
+
}`).toLog((0, test_translator_1.errorMessage)('Illegal order by of analytic field c2'));
|
|
342
342
|
});
|
|
343
343
|
test('cannot ungroup an ungrouped', () => {
|
|
344
344
|
expect(`query: a1 is a -> {
|
|
345
345
|
group_by: c is 1
|
|
346
346
|
aggregate: c2 is all(all(sum(ai)))
|
|
347
|
-
}`).
|
|
347
|
+
}`).toLog((0, test_translator_1.errorMessage)('all() expression must not already be ungrouped'));
|
|
348
348
|
});
|
|
349
349
|
test('cannot aggregate an ungrouped', () => {
|
|
350
350
|
expect(`query: a1 is a -> {
|
|
351
351
|
group_by: c is 1
|
|
352
352
|
aggregate: c2 is sum(all(sum(ai)))
|
|
353
|
-
}`).
|
|
353
|
+
}`).toLog((0, test_translator_1.errorMessage)('Aggregate expression cannot be aggregate'));
|
|
354
354
|
});
|
|
355
355
|
test('cannot aggregate an aggregate', () => {
|
|
356
356
|
expect(`query: a1 is a -> {
|
|
357
357
|
group_by: c is 1
|
|
358
358
|
aggregate: c2 is sum(sum(ai))
|
|
359
|
-
}`).
|
|
359
|
+
}`).toLog((0, test_translator_1.errorMessage)('Aggregate expression cannot be aggregate'));
|
|
360
360
|
});
|
|
361
361
|
test('can use field def in group_by, preserved over refinement', () => {
|
|
362
362
|
expect(`query: a1 is a -> {
|
|
@@ -385,17 +385,17 @@ describe('query:', () => {
|
|
|
385
385
|
test('function incorrect case', () => {
|
|
386
386
|
expect(`run: a -> {
|
|
387
387
|
group_by: s is CONCAT('a', 'b')
|
|
388
|
-
}`).
|
|
388
|
+
}`).toLog((0, test_translator_1.warningMessage)("Case insensitivity for function names is deprecated, use 'concat' instead"));
|
|
389
389
|
});
|
|
390
390
|
test('function no matching overload', () => {
|
|
391
391
|
expect(`run: a -> {
|
|
392
392
|
group_by: s is floor('a', 'b')
|
|
393
|
-
}`).
|
|
393
|
+
}`).toLog((0, test_translator_1.errorMessage)('No matching overload for function floor(string, string)'));
|
|
394
394
|
});
|
|
395
395
|
test('unknown function', () => {
|
|
396
396
|
expect(`run: a -> {
|
|
397
397
|
group_by: s is asdfasdf()
|
|
398
|
-
}`).
|
|
398
|
+
}`).toLog((0, test_translator_1.errorMessage)("Unknown function 'asdfasdf'. Use 'asdfasdf!(...)' to call a SQL function directly."));
|
|
399
399
|
});
|
|
400
400
|
test('can select different overload', () => {
|
|
401
401
|
expect('run: a -> { group_by: s is concat() }').toTranslate();
|
|
@@ -417,7 +417,7 @@ describe('query:', () => {
|
|
|
417
417
|
test('function return type incorrect', () => {
|
|
418
418
|
expect(`run: a -> {
|
|
419
419
|
group_by: s is floor(1.2) + 'a'
|
|
420
|
-
}`).
|
|
420
|
+
}`).toLog((0, test_translator_1.errorMessage)("The '+' operator requires a number, not a 'string'"));
|
|
421
421
|
});
|
|
422
422
|
test('can use output value in calculate', () => {
|
|
423
423
|
expect(`run: a -> {
|
|
@@ -429,29 +429,29 @@ describe('query:', () => {
|
|
|
429
429
|
expect(`run: a -> {
|
|
430
430
|
group_by: x is 1
|
|
431
431
|
group_by: y is x
|
|
432
|
-
}`).
|
|
432
|
+
}`).toLog((0, test_translator_1.errorMessage)("'x' is not defined"));
|
|
433
433
|
});
|
|
434
434
|
test('lag can check that other args are constant', () => {
|
|
435
435
|
expect(`run: a -> {
|
|
436
436
|
group_by: x is 1
|
|
437
437
|
calculate: s is lag(x, 1, x)
|
|
438
|
-
}`).
|
|
438
|
+
}`).toLog(
|
|
439
439
|
// TODO improve this error message
|
|
440
|
-
"Parameter 3 ('default') of lag must be literal or constant, but received output");
|
|
440
|
+
(0, test_translator_1.errorMessage)("Parameter 3 ('default') of lag must be literal or constant, but received output"));
|
|
441
441
|
});
|
|
442
442
|
test('lag can check that other args are literal', () => {
|
|
443
443
|
expect(`run: a -> {
|
|
444
444
|
group_by: x is 1
|
|
445
445
|
calculate: s is lag(x, 1 + 1)
|
|
446
|
-
}`).
|
|
446
|
+
}`).toLog(
|
|
447
447
|
// TODO improve this error message
|
|
448
|
-
"Parameter 2 ('offset') of lag must be literal, but received constant");
|
|
448
|
+
(0, test_translator_1.errorMessage)("Parameter 2 ('offset') of lag must be literal, but received constant"));
|
|
449
449
|
});
|
|
450
450
|
test('lag can check that other args are nonnull', () => {
|
|
451
451
|
expect(`run: a -> {
|
|
452
452
|
group_by: x is 1
|
|
453
453
|
calculate: s is lag(x, null)
|
|
454
|
-
}`).
|
|
454
|
+
}`).toLog((0, test_translator_1.errorMessage)("Parameter 2 ('offset') of lag must not be a literal null"));
|
|
455
455
|
});
|
|
456
456
|
test('lag can use constant values for other args', () => {
|
|
457
457
|
expect(`run: a -> {
|
|
@@ -460,9 +460,9 @@ describe('query:', () => {
|
|
|
460
460
|
}`).toTranslate();
|
|
461
461
|
});
|
|
462
462
|
test('cannot name top level objects same as functions', () => {
|
|
463
|
-
expect((0, test_translator_1.markSource) `query: ${'concat is a -> { group_by: x is 1 }'}`).
|
|
463
|
+
expect((0, test_translator_1.markSource) `query: ${'concat is a -> { group_by: x is 1 }'}`).toLog(
|
|
464
464
|
// TODO improve this error message
|
|
465
|
-
"'concat' is already defined, cannot redefine");
|
|
465
|
+
(0, test_translator_1.errorMessage)("'concat' is already defined, cannot redefine"));
|
|
466
466
|
});
|
|
467
467
|
test('`now` is considered constant`', () => {
|
|
468
468
|
expect(`run: a -> {
|
|
@@ -476,27 +476,27 @@ describe('query:', () => {
|
|
|
476
476
|
expect(`run: a -> {
|
|
477
477
|
group_by: ai, pi is pi()
|
|
478
478
|
calculate: l is lag(ai, 1, pi)
|
|
479
|
-
}`).
|
|
479
|
+
}`).toLog((0, test_translator_1.errorMessage)("Parameter 3 ('default') of lag must be literal or constant, but received output"));
|
|
480
480
|
});
|
|
481
481
|
test('cannot use struct in function arg', () => {
|
|
482
482
|
expect(`run: ab -> {
|
|
483
483
|
group_by: b.astr
|
|
484
484
|
calculate: foo is lag(b)
|
|
485
|
-
}`).
|
|
485
|
+
}`).toLog((0, test_translator_1.errorMessage)('No matching overload for function lag(struct)'));
|
|
486
486
|
});
|
|
487
487
|
// TODO this doesn't work today, we're not rigorous enough with integer
|
|
488
488
|
// subtypes. But we should probably make this typecheck properly.
|
|
489
489
|
test.skip('cannot use float in round precision', () => {
|
|
490
490
|
expect(`run: a -> {
|
|
491
491
|
group_by: x is round(1.5, 1.6)
|
|
492
|
-
}`).
|
|
492
|
+
}`).toLog(
|
|
493
493
|
// TODO improve this error message
|
|
494
|
-
"Parameter 2 ('precision') for round must be integer, received float");
|
|
494
|
+
(0, test_translator_1.errorMessage)("Parameter 2 ('precision') for round must be integer, received float"));
|
|
495
495
|
});
|
|
496
496
|
test('cannot use stddev with no arguments', () => {
|
|
497
497
|
expect(`run: a -> {
|
|
498
498
|
aggregate: x is stddev()
|
|
499
|
-
}`).
|
|
499
|
+
}`).toLog((0, test_translator_1.errorMessage)('No matching overload for function stddev()'));
|
|
500
500
|
});
|
|
501
501
|
test('can use stddev with postfix syntax', () => {
|
|
502
502
|
expect(`run: a -> {
|
|
@@ -520,12 +520,12 @@ describe('query:', () => {
|
|
|
520
520
|
expect(`run: a -> {
|
|
521
521
|
group_by: y is 1
|
|
522
522
|
calculate: x is lag(ai)
|
|
523
|
-
}`).
|
|
523
|
+
}`).toLog(
|
|
524
524
|
// TODO improve this error message:
|
|
525
525
|
// Parameter 1 ('value') of 'lag' must be a constant, an aggregate, or an expression using
|
|
526
526
|
// only fields that appear in the query output. Received an expression which uses a field
|
|
527
527
|
// that is not in the query output.
|
|
528
|
-
"Parameter 1 ('value') of lag must be literal, constant or output, but received input");
|
|
528
|
+
(0, test_translator_1.errorMessage)("Parameter 1 ('value') of lag must be literal, constant or output, but received input"));
|
|
529
529
|
});
|
|
530
530
|
test('can use calculate with aggregate field which is not in query', () => {
|
|
531
531
|
expect(`run: a extend { measure: acount is count() } -> {
|
|
@@ -536,12 +536,12 @@ describe('query:', () => {
|
|
|
536
536
|
test('cannot use agregate as argument to agg function', () => {
|
|
537
537
|
expect(`run: a -> {
|
|
538
538
|
aggregate: x is stddev(count())
|
|
539
|
-
}`).
|
|
539
|
+
}`).toLog((0, test_translator_1.errorMessage)("Parameter 1 ('value') of stddev must be scalar, but received aggregate"));
|
|
540
540
|
});
|
|
541
541
|
test('cannot use calculate with no other fields', () => {
|
|
542
542
|
expect(`run: a -> {
|
|
543
543
|
calculate: x is row_number()
|
|
544
|
-
}`).
|
|
544
|
+
}`).toLog((0, test_translator_1.error)('ambiguous-view-type', {}));
|
|
545
545
|
});
|
|
546
546
|
// TODO someday make it so we can order by an analytic function
|
|
547
547
|
test('today: cannot order by analytic function', () => {
|
|
@@ -549,7 +549,7 @@ describe('query:', () => {
|
|
|
549
549
|
group_by: astr
|
|
550
550
|
calculate: row_num is row_number()
|
|
551
551
|
order_by: row_num desc
|
|
552
|
-
}`).
|
|
552
|
+
}`).toLog((0, test_translator_1.errorMessage)('Illegal order by of analytic field row_num'));
|
|
553
553
|
});
|
|
554
554
|
test('cannot use analytic in calculate -- and preserved over refinement', () => {
|
|
555
555
|
expect(`query: a1 is a -> {
|
|
@@ -558,13 +558,13 @@ describe('query:', () => {
|
|
|
558
558
|
}
|
|
559
559
|
run: a1 + {
|
|
560
560
|
calculate: p1 is lag(p)
|
|
561
|
-
}`).
|
|
561
|
+
}`).toLog((0, test_translator_1.errorMessage)("Parameter 1 ('value') of lag must be scalar or aggregate, but received scalar_analytic"));
|
|
562
562
|
});
|
|
563
563
|
test('cannot use aggregate analytic in project', () => {
|
|
564
564
|
expect(`run: a -> {
|
|
565
565
|
select: astr
|
|
566
566
|
calculate: p is lag(count())
|
|
567
|
-
}`).
|
|
567
|
+
}`).toLog((0, test_translator_1.errorMessage)('Cannot add aggregate analyics to select'));
|
|
568
568
|
});
|
|
569
569
|
test('reference field in join', () => {
|
|
570
570
|
expect(`run: a -> {
|
|
@@ -576,7 +576,7 @@ describe('query:', () => {
|
|
|
576
576
|
expect(`run: a -> {
|
|
577
577
|
extend: { join_one: b with astr }
|
|
578
578
|
group_by: b
|
|
579
|
-
}`).
|
|
579
|
+
}`).toLog((0, test_translator_1.errorMessage)('foo'));
|
|
580
580
|
});
|
|
581
581
|
test('can reference select: inline join.* field in calculate', () => {
|
|
582
582
|
expect(`run: a -> {
|
|
@@ -608,7 +608,7 @@ describe('query:', () => {
|
|
|
608
608
|
test('cannot use function enabled in a different dialect (duckdb)', () => {
|
|
609
609
|
expect(`run: a -> {
|
|
610
610
|
group_by: ts is to_timestamp(1000)
|
|
611
|
-
}`).
|
|
611
|
+
}`).toLog((0, test_translator_1.errorMessage)(/Unknown function/));
|
|
612
612
|
});
|
|
613
613
|
});
|
|
614
614
|
});
|
|
@@ -685,11 +685,11 @@ describe('query:', () => {
|
|
|
685
685
|
expect(fields).toEqual(filterdFields);
|
|
686
686
|
});
|
|
687
687
|
test('star error checking', () => {
|
|
688
|
-
expect((0, test_translator_1.markSource) `run: a->{select: ${'zzz'}.*}`).
|
|
689
|
-
expect((0, test_translator_1.markSource) `run: ab->{select: b.${'zzz'}.*}`).
|
|
690
|
-
expect((0, test_translator_1.markSource) `run: a->{select: ${'ai'}.*}`).
|
|
691
|
-
expect((0, test_translator_1.markSource) `run: a->{select:ai,${'*'}}`).
|
|
692
|
-
expect((0, test_translator_1.markSource) `run: ab->{select:ai,${'b.*'}}`).
|
|
688
|
+
expect((0, test_translator_1.markSource) `run: a->{select: ${'zzz'}.*}`).toLog((0, test_translator_1.errorMessage)("No such field as 'zzz'"));
|
|
689
|
+
expect((0, test_translator_1.markSource) `run: ab->{select: b.${'zzz'}.*}`).toLog((0, test_translator_1.errorMessage)("No such field as 'zzz'"));
|
|
690
|
+
expect((0, test_translator_1.markSource) `run: a->{select: ${'ai'}.*}`).toLog((0, test_translator_1.errorMessage)("Field 'ai' does not contain rows and cannot be expanded with '*'"));
|
|
691
|
+
expect((0, test_translator_1.markSource) `run: a->{select:ai,${'*'}}`).toLog((0, test_translator_1.errorMessage)("Cannot expand 'ai' in '*' because a field with that name already exists"));
|
|
692
|
+
expect((0, test_translator_1.markSource) `run: ab->{select:ai,${'b.*'}}`).toLog((0, test_translator_1.errorMessage)("Cannot expand 'ai' in 'b.*' because a field with that name already exists"));
|
|
693
693
|
const m = `
|
|
694
694
|
source: nab is a extend {
|
|
695
695
|
accept: ai
|
|
@@ -697,7 +697,7 @@ describe('query:', () => {
|
|
|
697
697
|
}
|
|
698
698
|
run: nab->{select: b.*,*}
|
|
699
699
|
`;
|
|
700
|
-
expect(m).
|
|
700
|
+
expect(m).toLog((0, test_translator_1.errorMessage)("Cannot expand 'ai' in '*' because a field with that name already exists (conflicts with b.ai)"));
|
|
701
701
|
});
|
|
702
702
|
test('regress check extend: and star', () => {
|
|
703
703
|
const m = (0, test_translator_1.model) `run: ab->{ extend: {dimension: x is 1} select: * }`;
|
|
@@ -786,11 +786,11 @@ describe('query:', () => {
|
|
|
786
786
|
});
|
|
787
787
|
test('top N by field', () => {
|
|
788
788
|
expect(`##! m4warnings=warn
|
|
789
|
-
run: a->{top: 5 ${'by astr'}; group_by: astr}`).
|
|
789
|
+
run: a->{top: 5 ${'by astr'}; group_by: astr}`).toLog((0, test_translator_1.warningMessage)('by clause of top statement unupported. Use order_by instead'));
|
|
790
790
|
});
|
|
791
791
|
test('top N by expression', () => {
|
|
792
792
|
expect(`##! m4warnings=warn
|
|
793
|
-
run: ab->{top: 5 by ai + 1; group_by: ai}`).
|
|
793
|
+
run: ab->{top: 5 by ai + 1; group_by: ai}`).toLog((0, test_translator_1.warningMessage)('by clause of top statement unupported. Use order_by instead'));
|
|
794
794
|
});
|
|
795
795
|
test('limit N', () => {
|
|
796
796
|
expect('run: a->{ limit: 5; group_by: astr }').toTranslate();
|
|
@@ -804,7 +804,7 @@ describe('query:', () => {
|
|
|
804
804
|
run: a1 + { order_by: astr }
|
|
805
805
|
`).toTranslate();
|
|
806
806
|
});
|
|
807
|
-
test('order by must be in the output space', () => expect('run: a -> { order_by: af; group_by: astr }').
|
|
807
|
+
test('order by must be in the output space', () => expect('run: a -> { order_by: af; group_by: astr }').toLog((0, test_translator_1.errorMessage)('Unknown field af in output space')));
|
|
808
808
|
test('order by asc', () => {
|
|
809
809
|
expect('run: a->{ order_by: astr asc; group_by: astr }').toTranslate();
|
|
810
810
|
});
|
|
@@ -823,13 +823,13 @@ describe('query:', () => {
|
|
|
823
823
|
`).toTranslate();
|
|
824
824
|
});
|
|
825
825
|
test('agg cannot be used in where', () => {
|
|
826
|
-
expect('run:ab->{ aggregate: acount; group_by: astr; where: acount > 10 }').
|
|
826
|
+
expect('run:ab->{ aggregate: acount; group_by: astr; where: acount > 10 }').toLog((0, test_translator_1.errorMessage)('Aggregate expressions are not allowed in `where:`; use `having:`'));
|
|
827
827
|
});
|
|
828
828
|
test('analytic cannot be used in where', () => {
|
|
829
|
-
expect('run:ab->{ calculate: prevc is lag(count()); group_by: astr; where: prevc > 10 }').
|
|
829
|
+
expect('run:ab->{ calculate: prevc is lag(count()); group_by: astr; where: prevc > 10 }').toLog((0, test_translator_1.errorMessage)("'prevc' is not defined"));
|
|
830
830
|
});
|
|
831
831
|
test('analytic cannot be used in having', () => {
|
|
832
|
-
expect('run:ab->{ calculate: prevc is lag(count()); group_by: astr; having: prevc > 10 }').
|
|
832
|
+
expect('run:ab->{ calculate: prevc is lag(count()); group_by: astr; having: prevc > 10 }').toLog((0, test_translator_1.errorMessage)('Analytic expressions are not allowed in `having:`'));
|
|
833
833
|
});
|
|
834
834
|
test('where single', () => {
|
|
835
835
|
expect('run:a->{ group_by: astr; where: af > 10 }').toTranslate();
|
|
@@ -916,15 +916,15 @@ describe('query:', () => {
|
|
|
916
916
|
describe('declare/query join warnings', () => {
|
|
917
917
|
test('declare warning in query', () => {
|
|
918
918
|
expect((0, test_translator_1.markSource) `##! m4warnings=warn
|
|
919
|
-
run: a -> { ${'declare: x is 1'}; group_by: x }`).
|
|
919
|
+
run: a -> { ${'declare: x is 1'}; group_by: x }`).toLog((0, test_translator_1.warningMessage)('`declare:` is deprecated; use `dimension:` or `measure:` inside a source or `extend:` block'));
|
|
920
920
|
});
|
|
921
921
|
test('declare warning in source', () => {
|
|
922
922
|
expect((0, test_translator_1.markSource) `##! m4warnings=warn
|
|
923
|
-
source: a2 is a extend { ${'declare: x is 1'} }`).
|
|
923
|
+
source: a2 is a extend { ${'declare: x is 1'} }`).toLog((0, test_translator_1.warningMessage)('`declare:` is deprecated; use `dimension:` or `measure:` inside a source or `extend:` block'));
|
|
924
924
|
});
|
|
925
925
|
test('joins in query', () => {
|
|
926
926
|
expect((0, test_translator_1.markSource) `##! m4warnings=warn
|
|
927
|
-
run: a -> { ${'join_one: b on true'}; ${'join_many: c is b on true'}; ${'join_cross: d is b on true'}; group_by: b.astr }`).
|
|
927
|
+
run: a -> { ${'join_one: b on true'}; ${'join_many: c is b on true'}; ${'join_cross: d is b on true'}; group_by: b.astr }`).toLog((0, test_translator_1.warningMessage)('Joins in queries are deprecated, move into an `extend:` block.'), (0, test_translator_1.warningMessage)('Joins in queries are deprecated, move into an `extend:` block.'), (0, test_translator_1.warningMessage)('Joins in queries are deprecated, move into an `extend:` block.'));
|
|
928
928
|
});
|
|
929
929
|
});
|
|
930
930
|
test('refine query with extended source', () => {
|
|
@@ -1054,23 +1054,23 @@ describe('query:', () => {
|
|
|
1054
1054
|
const stageErr = 'Illegal in refinement of a query with more than one stage';
|
|
1055
1055
|
test('group_by illegal in long pipes', () => {
|
|
1056
1056
|
expect((0, test_translator_1.markSource) `query: refineme is a -> { select: stage is "stage1" } -> { select: stage is "stage2" }
|
|
1057
|
-
query: checkme is refineme + { ${'group_by: stage'} }`).
|
|
1057
|
+
query: checkme is refineme + { ${'group_by: stage'} }`).toLog((0, test_translator_1.errorMessage)(stageErr));
|
|
1058
1058
|
});
|
|
1059
1059
|
test('aggregate illegal in long pipes', () => {
|
|
1060
1060
|
expect((0, test_translator_1.markSource) `query: refineme is a -> { select: stage is "stage1" } -> { select: stage is "stage2" }
|
|
1061
|
-
query: checkme is refineme + { ${'aggregate: c is count()'} }`).
|
|
1061
|
+
query: checkme is refineme + { ${'aggregate: c is count()'} }`).toLog((0, test_translator_1.errorMessage)(stageErr));
|
|
1062
1062
|
});
|
|
1063
1063
|
test('calcluate illegal in long pipes', () => {
|
|
1064
1064
|
expect((0, test_translator_1.markSource) `query: refineme is a -> { select: stage is "stage1" } -> { select: stage is "stage2" }
|
|
1065
|
-
query: checkme is refineme + { ${'calculate: c is count()'} }`).
|
|
1065
|
+
query: checkme is refineme + { ${'calculate: c is count()'} }`).toLog((0, test_translator_1.errorMessage)(stageErr));
|
|
1066
1066
|
});
|
|
1067
1067
|
test('extend illegal in long pipes', () => {
|
|
1068
1068
|
expect((0, test_translator_1.markSource) `query: refineme is a -> { select: stage is "stage1" } -> { select: stage is "stage2" }
|
|
1069
|
-
query: checkme is refineme + { ${'extend: {measure: c is count()}'} }`).
|
|
1069
|
+
query: checkme is refineme + { ${'extend: {measure: c is count()}'} }`).toLog((0, test_translator_1.errorMessage)(stageErr));
|
|
1070
1070
|
});
|
|
1071
1071
|
test('nest illegal in long pipes', () => {
|
|
1072
1072
|
expect((0, test_translator_1.markSource) `query: refineme is a -> { select: stage is "stage1" } -> { select: stage is "stage2" }
|
|
1073
|
-
query: checkme is refineme + { ${'nest: b is {group_by: stage}'} }`).
|
|
1073
|
+
query: checkme is refineme + { ${'nest: b is {group_by: stage}'} }`).toLog((0, test_translator_1.errorMessage)(stageErr));
|
|
1074
1074
|
});
|
|
1075
1075
|
test('all single stage refinements are accepted', () => {
|
|
1076
1076
|
expect((0, test_translator_1.markSource) `query: refineme is a -> { group_by: stage is "stage1" }
|
|
@@ -36,7 +36,7 @@ describe('source:', () => {
|
|
|
36
36
|
expect(`
|
|
37
37
|
##! m4warnings=warn
|
|
38
38
|
source: xA is _db_.table('aTable') extend {? astr ~ 'a%' }
|
|
39
|
-
`).
|
|
39
|
+
`).toLog((0, test_translator_1.warningMessage)('Filter shortcut `{? condition }` is deprecated; use `{ where: condition } instead'));
|
|
40
40
|
});
|
|
41
41
|
test('fitlered table', () => {
|
|
42
42
|
expect("source: testA is _db_.table('aTable') extend { where: astr ~ 'a%' }").toTranslate();
|
|
@@ -65,7 +65,7 @@ describe('source:', () => {
|
|
|
65
65
|
expect('source: aa is a extend { dimension: x is 1 }').toTranslate();
|
|
66
66
|
});
|
|
67
67
|
test('field def with null value', () => {
|
|
68
|
-
expect((0, test_translator_1.markSource) `source: aa is a extend { dimension: x is ${'null'} }`).
|
|
68
|
+
expect((0, test_translator_1.markSource) `source: aa is a extend { dimension: x is ${'null'} }`).toLog((0, test_translator_1.warningMessage)('null value defaults to type number, use "null::TYPE" to specify correct type'));
|
|
69
69
|
});
|
|
70
70
|
test('multiple dimensions', () => {
|
|
71
71
|
expect(`
|
|
@@ -144,7 +144,7 @@ describe('source:', () => {
|
|
|
144
144
|
expect('source: nab is a extend { join_many: b on astr = b.astr }').toTranslate();
|
|
145
145
|
});
|
|
146
146
|
test('many with', () => {
|
|
147
|
-
expect((0, test_translator_1.model) `source: nab is a extend { ${'join_many: b with astr'} }`).
|
|
147
|
+
expect((0, test_translator_1.model) `source: nab is a extend { ${'join_many: b with astr'} }`).toLog((0, test_translator_1.errorMessage)('Foreign key join not legal in join_many:'));
|
|
148
148
|
});
|
|
149
149
|
test('many is on', () => {
|
|
150
150
|
expect('source: y is a extend { join_many: x is b on astr = x.astr }').toTranslate();
|
|
@@ -172,7 +172,7 @@ describe('source:', () => {
|
|
|
172
172
|
source: nb is b extend {
|
|
173
173
|
join_one: ${'bb is _db_.table("aTable") with astr'}
|
|
174
174
|
}
|
|
175
|
-
`).
|
|
175
|
+
`).toLog((0, test_translator_1.errorMessage)('join_one: Cannot use with unless source has a primary key'));
|
|
176
176
|
});
|
|
177
177
|
test('can join a query without a rename', () => {
|
|
178
178
|
expect(`
|
|
@@ -218,7 +218,7 @@ describe('source:', () => {
|
|
|
218
218
|
test('turtle in source can be called query with m4 warning', () => {
|
|
219
219
|
expect(`##! m4warnings=warn
|
|
220
220
|
source: c is a extend {query: q is { group_by: astr } }
|
|
221
|
-
`).
|
|
221
|
+
`).toLog((0, test_translator_1.warningMessage)('Use view: inside of a source instead of query:'));
|
|
222
222
|
});
|
|
223
223
|
test('refined explore-query', () => {
|
|
224
224
|
expect(`
|
|
@@ -233,7 +233,7 @@ describe('source:', () => {
|
|
|
233
233
|
source: abNew is ab extend {
|
|
234
234
|
view: for1 is aturtle + {? ai = 1 }
|
|
235
235
|
}
|
|
236
|
-
`).
|
|
236
|
+
`).toLog((0, test_translator_1.warningMessage)('Filter shortcut `{? condition }` is deprecated; use `{ where: condition } instead'));
|
|
237
237
|
});
|
|
238
238
|
test('chained explore-query', () => {
|
|
239
239
|
expect(`
|
|
@@ -5,6 +5,7 @@ import { ModelEntry } from '../ast/types/model-entry';
|
|
|
5
5
|
import { MalloyChildTranslator, MalloyTranslator } from '../parse-malloy';
|
|
6
6
|
import { DataRequestResponse, TranslateResponse } from '../translate-response';
|
|
7
7
|
import { ExprValue } from '../ast/types/expr-value';
|
|
8
|
+
import { LogSeverity, MessageCode, MessageParameterType } from '../parse-log';
|
|
8
9
|
export declare function pretty(thing: any): string;
|
|
9
10
|
export declare const aTableDef: StructDef;
|
|
10
11
|
/**
|
|
@@ -73,4 +74,22 @@ export declare function makeModelFunc(options: {
|
|
|
73
74
|
export declare function markSource(unmarked: TemplateStringsArray, ...marked: string[]): MarkedSource;
|
|
74
75
|
export declare function getSelectOneStruct(sqlBlock: SQLBlockSource): SQLBlockStructDef;
|
|
75
76
|
export declare function exprToString(e: Expr, symbols?: Record<string, string>): string;
|
|
77
|
+
export declare function error<T extends MessageCode>(code: T, data?: MessageParameterType<T>): {
|
|
78
|
+
code: T;
|
|
79
|
+
data: MessageParameterType<T> | undefined;
|
|
80
|
+
severity: LogSeverity;
|
|
81
|
+
};
|
|
82
|
+
export declare function warning<T extends MessageCode>(code: T, data?: MessageParameterType<T>): {
|
|
83
|
+
code: T;
|
|
84
|
+
data: MessageParameterType<T> | undefined;
|
|
85
|
+
severity: LogSeverity;
|
|
86
|
+
};
|
|
87
|
+
export declare function errorMessage(message: string | RegExp): {
|
|
88
|
+
message: string | RegExp;
|
|
89
|
+
severity: LogSeverity;
|
|
90
|
+
};
|
|
91
|
+
export declare function warningMessage(message: string | RegExp): {
|
|
92
|
+
message: string | RegExp;
|
|
93
|
+
severity: LogSeverity;
|
|
94
|
+
};
|
|
76
95
|
export {};
|