@malloydata/malloy 0.0.279 → 0.0.281
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/annotation.js +3 -4
- package/dist/api/asynchronous.js +21 -12
- package/dist/api/core.js +29 -20
- package/dist/api/index.js +17 -7
- package/dist/api/sessioned.js +20 -11
- package/dist/api/stateless.js +20 -11
- package/dist/api/util.js +6 -6
- package/dist/connection_utils.js +1 -2
- package/dist/dialect/dialect.js +3 -3
- package/dist/dialect/dialect_map.js +3 -4
- package/dist/dialect/functions/malloy_standard_functions.d.ts +1 -0
- package/dist/dialect/functions/malloy_standard_functions.js +9 -3
- package/dist/dialect/functions/util.d.ts +1 -1
- package/dist/dialect/functions/util.js +21 -22
- package/dist/dialect/trino/dialect_functions.js +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -8
- package/dist/lang/ast/ast-utils.js +1 -2
- package/dist/lang/ast/expressions/binary-boolean.js +17 -7
- package/dist/lang/ast/expressions/binary-numeric.js +17 -7
- package/dist/lang/ast/expressions/boolean.js +17 -7
- package/dist/lang/ast/expressions/case.js +17 -7
- package/dist/lang/ast/expressions/expr-aggregate-function.js +17 -7
- package/dist/lang/ast/expressions/expr-array-literal.js +17 -7
- package/dist/lang/ast/expressions/expr-coalesce.js +17 -7
- package/dist/lang/ast/expressions/expr-compare.js +17 -7
- package/dist/lang/ast/expressions/expr-count-distinct.js +17 -7
- package/dist/lang/ast/expressions/expr-func.js +27 -25
- package/dist/lang/ast/expressions/expr-granular-time.js +17 -7
- package/dist/lang/ast/expressions/expr-logical-op.js +17 -7
- package/dist/lang/ast/expressions/expr-max.js +17 -7
- package/dist/lang/ast/expressions/expr-min.js +17 -7
- package/dist/lang/ast/expressions/expr-minus.js +17 -7
- package/dist/lang/ast/expressions/expr-not.js +17 -7
- package/dist/lang/ast/expressions/expr-props.d.ts +36 -36
- package/dist/lang/ast/expressions/expr-props.js +17 -7
- package/dist/lang/ast/expressions/expr-record-literal.js +17 -7
- package/dist/lang/ast/expressions/expr-ungroup.js +17 -7
- package/dist/lang/ast/expressions/for-range.js +17 -7
- package/dist/lang/ast/expressions/pick-when.js +17 -7
- package/dist/lang/ast/field-space/dynamic-space.js +17 -7
- package/dist/lang/ast/field-space/include-utils.js +2 -3
- package/dist/lang/ast/field-space/query-spaces.js +17 -7
- package/dist/lang/ast/field-space/reference-field.js +17 -7
- package/dist/lang/ast/field-space/struct-space-field-base.js +17 -7
- package/dist/lang/ast/field-space/view-field.d.ts +31 -31
- package/dist/lang/ast/field-space/view-field.js +17 -7
- package/dist/lang/ast/query-items/field-declaration.js +17 -7
- package/dist/lang/ast/query-items/typecheck_utils.js +8 -9
- package/dist/lang/ast/query-properties/nest.js +17 -7
- package/dist/lang/ast/query-utils.js +3 -4
- package/dist/lang/ast/struct-utils.js +3 -4
- package/dist/lang/ast/time-utils.js +4 -5
- package/dist/lang/ast/typedesc-utils.js +7 -7
- package/dist/lang/ast/types/binary_operators.js +3 -4
- package/dist/lang/ast/types/expr-value.js +7 -8
- package/dist/lang/ast/types/expression-def.js +21 -11
- package/dist/lang/ast/types/field-collection-member.js +1 -2
- package/dist/lang/ast/types/field-prop-statement.js +1 -2
- package/dist/lang/ast/types/global-name-space.js +2 -2
- package/dist/lang/ast/types/granular-result.js +1 -2
- package/dist/lang/ast/types/malloy-element.js +3 -3
- package/dist/lang/ast/types/noteable.js +3 -4
- package/dist/lang/ast/types/query-element.js +1 -2
- package/dist/lang/ast/types/query-extend-property.js +1 -2
- package/dist/lang/ast/types/query-property.js +1 -2
- package/dist/lang/ast/types/source-property.js +1 -2
- package/dist/lang/ast/types/space-entry.js +2 -2
- package/dist/lang/ast/types/space-param.js +17 -7
- package/dist/lang/ast/view-elements/refine-utils.js +1 -2
- package/dist/lang/field-utils.js +2 -3
- package/dist/lang/lib/Malloy/MalloyLexer.js +17 -7
- package/dist/lang/lib/Malloy/MalloyParser.js +17 -7
- package/dist/lang/malloy-to-ast.js +17 -7
- package/dist/lang/malloy-to-stable-query.js +19 -9
- package/dist/lang/parse-log.js +2 -2
- package/dist/lang/parse-malloy.js +17 -7
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +2 -2
- package/dist/lang/parse-tree-walkers/find-external-references.js +3 -4
- package/dist/lang/parse-tree-walkers/find-table-path-walker.js +1 -2
- package/dist/lang/parse-tree-walkers/model-annotation-walker.js +1 -2
- package/dist/lang/parse-utils.js +8 -9
- package/dist/lang/run-malloy-parser.js +1 -2
- package/dist/lang/test/expr-to-str.js +1 -2
- package/dist/lang/test/test-translator.js +18 -18
- package/dist/lang/translate-response.js +1 -2
- package/dist/lang/utils.js +6 -7
- package/dist/malloy.d.ts +0 -2
- package/dist/model/composite_source_utils.js +17 -18
- package/dist/model/filter_compilers.d.ts +1 -1
- package/dist/model/malloy_query.js +3 -3
- package/dist/model/malloy_types.d.ts +1 -3
- package/dist/model/malloy_types.js +64 -65
- package/dist/model/materialization/utils.js +2 -3
- package/dist/model/sql_block.js +2 -3
- package/dist/model/utils.js +10 -10
- package/dist/test/index.d.ts +0 -1
- package/dist/test/index.js +3 -4
- package/dist/to_stable.d.ts +1 -0
- package/dist/to_stable.js +41 -34
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.constructTableKey = constructTableKey;
|
|
26
|
+
exports.deprecatedParseTableURI = deprecatedParseTableURI;
|
|
27
|
+
exports.findReferences = findReferences;
|
|
26
28
|
const ParseTreeWalker_1 = require("antlr4ts/tree/ParseTreeWalker");
|
|
27
29
|
const parse_utils_1 = require("../parse-utils");
|
|
28
30
|
// Copy of the version in the parser which also errors on each non-string in a
|
|
@@ -80,7 +82,6 @@ function constructTableKey(connectionName, tablePath) {
|
|
|
80
82
|
? tablePath
|
|
81
83
|
: `${connectionName}:${tablePath}`;
|
|
82
84
|
}
|
|
83
|
-
exports.constructTableKey = constructTableKey;
|
|
84
85
|
/**
|
|
85
86
|
* This function parses an old-style `tableURI` into a connection name and
|
|
86
87
|
* table path. The name includes `deprecated` because it should only be used
|
|
@@ -100,7 +101,6 @@ function deprecatedParseTableURI(tableURI) {
|
|
|
100
101
|
return { tablePath: tableURI };
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
exports.deprecatedParseTableURI = deprecatedParseTableURI;
|
|
104
104
|
function findReferences(trans, tokens, parseTree) {
|
|
105
105
|
const finder = new FindExternalReferences(trans, tokens);
|
|
106
106
|
const listener = finder;
|
|
@@ -110,5 +110,4 @@ function findReferences(trans, tokens, parseTree) {
|
|
|
110
110
|
urls: finder.needImports,
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
exports.findReferences = findReferences;
|
|
114
113
|
//# sourceMappingURL=find-external-references.js.map
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.walkForTablePath =
|
|
25
|
+
exports.walkForTablePath = walkForTablePath;
|
|
26
26
|
const parse_utils_1 = require("../parse-utils");
|
|
27
27
|
const ParseTreeWalker_1 = require("antlr4ts/tree/ParseTreeWalker");
|
|
28
28
|
class FindTablePathWalker {
|
|
@@ -49,5 +49,4 @@ function walkForTablePath(forParse, tokens, parseInfo) {
|
|
|
49
49
|
ParseTreeWalker_1.ParseTreeWalker.DEFAULT.walk(listener, parseInfo.root);
|
|
50
50
|
return finder.pathInfos;
|
|
51
51
|
}
|
|
52
|
-
exports.walkForTablePath = walkForTablePath;
|
|
53
52
|
//# sourceMappingURL=find-table-path-walker.js.map
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.walkForModelAnnotation =
|
|
25
|
+
exports.walkForModelAnnotation = walkForModelAnnotation;
|
|
26
26
|
const ParseTreeWalker_1 = require("antlr4ts/tree/ParseTreeWalker");
|
|
27
27
|
class ModelAnnotationWalker {
|
|
28
28
|
constructor(translator, tokens, parseInfo) {
|
|
@@ -56,5 +56,4 @@ function walkForModelAnnotation(forParse, tokens, parseInfo) {
|
|
|
56
56
|
ParseTreeWalker_1.ParseTreeWalker.DEFAULT.walk(listener, parseInfo.root);
|
|
57
57
|
return finder.annotation;
|
|
58
58
|
}
|
|
59
|
-
exports.walkForModelAnnotation = walkForModelAnnotation;
|
|
60
59
|
//# sourceMappingURL=model-annotation-walker.js.map
|
package/dist/lang/parse-utils.js
CHANGED
|
@@ -22,7 +22,14 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.getShortString = getShortString;
|
|
26
|
+
exports.getStringIfShort = getStringIfShort;
|
|
27
|
+
exports.getStringParts = getStringParts;
|
|
28
|
+
exports.getId = getId;
|
|
29
|
+
exports.idToStr = idToStr;
|
|
30
|
+
exports.getOptionalId = getOptionalId;
|
|
31
|
+
exports.unIndent = unIndent;
|
|
32
|
+
exports.getPlainString = getPlainString;
|
|
26
33
|
const malloy_tag_1 = require("@malloydata/malloy-tag");
|
|
27
34
|
/**
|
|
28
35
|
* Take the text of a matched string, including the matching quote
|
|
@@ -40,14 +47,12 @@ function getShortString(scx) {
|
|
|
40
47
|
// shortString: DQ_STRING | SQ_STRING; So this will never happen
|
|
41
48
|
return '';
|
|
42
49
|
}
|
|
43
|
-
exports.getShortString = getShortString;
|
|
44
50
|
function getStringIfShort(cx) {
|
|
45
51
|
const scx = cx.string().shortString();
|
|
46
52
|
if (scx) {
|
|
47
53
|
return getShortString(scx);
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
|
-
exports.getStringIfShort = getStringIfShort;
|
|
51
56
|
function* getStringParts(cx) {
|
|
52
57
|
var _a;
|
|
53
58
|
if (cx) {
|
|
@@ -66,7 +71,6 @@ function* getStringParts(cx) {
|
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
}
|
|
69
|
-
exports.getStringParts = getStringParts;
|
|
70
74
|
/**
|
|
71
75
|
* An identifier is either a sequence of id characters or a `quoted`
|
|
72
76
|
* This parses either to simply the resulting text.
|
|
@@ -76,7 +80,6 @@ exports.getStringParts = getStringParts;
|
|
|
76
80
|
function getId(cx) {
|
|
77
81
|
return idToStr(cx.id());
|
|
78
82
|
}
|
|
79
|
-
exports.getId = getId;
|
|
80
83
|
function idToStr(cx) {
|
|
81
84
|
const quoted = cx.BQ_STRING();
|
|
82
85
|
if (quoted) {
|
|
@@ -84,7 +87,6 @@ function idToStr(cx) {
|
|
|
84
87
|
}
|
|
85
88
|
return cx.text;
|
|
86
89
|
}
|
|
87
|
-
exports.idToStr = idToStr;
|
|
88
90
|
function getOptionalId(cx) {
|
|
89
91
|
function containsID(cx) {
|
|
90
92
|
return 'id' in cx;
|
|
@@ -93,7 +95,6 @@ function getOptionalId(cx) {
|
|
|
93
95
|
return getId(cx);
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
|
-
exports.getOptionalId = getOptionalId;
|
|
97
98
|
function* linesOf(allText) {
|
|
98
99
|
while (allText.length > 0) {
|
|
99
100
|
const lineMatch = allText.match(/^.*?\r?\n/);
|
|
@@ -146,7 +147,6 @@ function unIndent(parts) {
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
}
|
|
149
|
-
exports.unIndent = unIndent;
|
|
150
150
|
/**
|
|
151
151
|
* Returns plain string from string context.
|
|
152
152
|
* @param cx string context
|
|
@@ -180,5 +180,4 @@ function getPlainString(cx, strictCheck = false) {
|
|
|
180
180
|
// string: shortString | sqlString; So this will never happen
|
|
181
181
|
return ['', errorList];
|
|
182
182
|
}
|
|
183
|
-
exports.getPlainString = getPlainString;
|
|
184
183
|
//# sourceMappingURL=parse-utils.js.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.runMalloyParser =
|
|
9
|
+
exports.runMalloyParser = runMalloyParser;
|
|
10
10
|
const antlr4ts_1 = require("antlr4ts");
|
|
11
11
|
const MalloyLexer_1 = require("./lib/Malloy/MalloyLexer");
|
|
12
12
|
const MalloyParser_1 = require("./lib/Malloy/MalloyParser");
|
|
@@ -49,5 +49,4 @@ function runMalloyParser(code, sourceURL, sourceInfo, logger, grammarRule = 'mal
|
|
|
49
49
|
malloyVersion: '4.0.0',
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
exports.runMalloyParser = runMalloyParser;
|
|
53
52
|
//# sourceMappingURL=run-malloy-parser.js.map
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.exprToStr =
|
|
9
|
+
exports.exprToStr = exprToStr;
|
|
10
10
|
const malloy_types_1 = require("../../model/malloy_types");
|
|
11
11
|
function exprToStr(e, symbols) {
|
|
12
12
|
function subExpr(e) {
|
|
@@ -103,5 +103,4 @@ function exprToStr(e, symbols) {
|
|
|
103
103
|
}
|
|
104
104
|
return `{?${e.node}}`;
|
|
105
105
|
}
|
|
106
|
-
exports.exprToStr = exprToStr;
|
|
107
106
|
//# sourceMappingURL=expr-to-str.js.map
|
|
@@ -23,7 +23,24 @@
|
|
|
23
23
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.BetaExpression = exports.TestTranslator = exports.TestChildTranslator = exports.aTableDef = void 0;
|
|
27
|
+
exports.pretty = pretty;
|
|
28
|
+
exports.getExplore = getExplore;
|
|
29
|
+
exports.getModelQuery = getModelQuery;
|
|
30
|
+
exports.getFieldDef = getFieldDef;
|
|
31
|
+
exports.getQueryFieldDef = getQueryFieldDef;
|
|
32
|
+
exports.getQueryField = getQueryField;
|
|
33
|
+
exports.getJoinField = getJoinField;
|
|
34
|
+
exports.expr = expr;
|
|
35
|
+
exports.model = model;
|
|
36
|
+
exports.makeModelFunc = makeModelFunc;
|
|
37
|
+
exports.makeExprFunc = makeExprFunc;
|
|
38
|
+
exports.markSource = markSource;
|
|
39
|
+
exports.getSelectOneStruct = getSelectOneStruct;
|
|
40
|
+
exports.error = error;
|
|
41
|
+
exports.warning = warning;
|
|
42
|
+
exports.errorMessage = errorMessage;
|
|
43
|
+
exports.warningMessage = warningMessage;
|
|
27
44
|
const util_1 = require("util");
|
|
28
45
|
const malloy_types_1 = require("../../model/malloy_types");
|
|
29
46
|
const ast_1 = require("../ast");
|
|
@@ -35,7 +52,6 @@ const sql_block_1 = require("../../model/sql_block");
|
|
|
35
52
|
function pretty(thing) {
|
|
36
53
|
return (0, util_1.inspect)(thing, { breakLength: 72, depth: Infinity });
|
|
37
54
|
}
|
|
38
|
-
exports.pretty = pretty;
|
|
39
55
|
const intType = { type: 'number', numberType: 'integer' };
|
|
40
56
|
const mockSchema = {
|
|
41
57
|
'aTable': {
|
|
@@ -430,11 +446,9 @@ exports.BetaExpression = BetaExpression;
|
|
|
430
446
|
function getExplore(modelDef, name) {
|
|
431
447
|
return modelDef.contents[name];
|
|
432
448
|
}
|
|
433
|
-
exports.getExplore = getExplore;
|
|
434
449
|
function getModelQuery(modelDef, name) {
|
|
435
450
|
return modelDef.contents[name];
|
|
436
451
|
}
|
|
437
|
-
exports.getModelQuery = getModelQuery;
|
|
438
452
|
function getFieldDef(source, name) {
|
|
439
453
|
var _a;
|
|
440
454
|
for (const f of source.fields) {
|
|
@@ -444,7 +458,6 @@ function getFieldDef(source, name) {
|
|
|
444
458
|
}
|
|
445
459
|
throw new Error(`Compiled source did not contain expected field '${name}'`);
|
|
446
460
|
}
|
|
447
|
-
exports.getFieldDef = getFieldDef;
|
|
448
461
|
function getQueryFieldDef(query, name) {
|
|
449
462
|
var _a;
|
|
450
463
|
if ((0, malloy_types_1.isQuerySegment)(query)) {
|
|
@@ -461,17 +474,14 @@ function getQueryFieldDef(query, name) {
|
|
|
461
474
|
}
|
|
462
475
|
throw new Error(`Compiled query did not contain expected field '${name}'`);
|
|
463
476
|
}
|
|
464
|
-
exports.getQueryFieldDef = getQueryFieldDef;
|
|
465
477
|
// TODO "as" is almost always a code smell ...
|
|
466
478
|
function getQueryField(structDef, name) {
|
|
467
479
|
return getFieldDef(structDef, name);
|
|
468
480
|
}
|
|
469
|
-
exports.getQueryField = getQueryField;
|
|
470
481
|
// TODO "as" is almost always a code smell ...
|
|
471
482
|
function getJoinField(structDef, name) {
|
|
472
483
|
return getFieldDef(structDef, name);
|
|
473
484
|
}
|
|
474
|
-
exports.getJoinField = getJoinField;
|
|
475
485
|
function expr(unmarked, ...marked) {
|
|
476
486
|
const ms = markSource(unmarked, ...marked);
|
|
477
487
|
return {
|
|
@@ -479,7 +489,6 @@ function expr(unmarked, ...marked) {
|
|
|
479
489
|
translator: new BetaExpression(ms.code),
|
|
480
490
|
};
|
|
481
491
|
}
|
|
482
|
-
exports.expr = expr;
|
|
483
492
|
function model(unmarked, ...marked) {
|
|
484
493
|
const ms = markSource(unmarked, ...marked);
|
|
485
494
|
return {
|
|
@@ -487,7 +496,6 @@ function model(unmarked, ...marked) {
|
|
|
487
496
|
translator: new TestTranslator(ms.code),
|
|
488
497
|
};
|
|
489
498
|
}
|
|
490
|
-
exports.model = model;
|
|
491
499
|
function makeModelFunc(options) {
|
|
492
500
|
return function model(unmarked, ...marked) {
|
|
493
501
|
var _a;
|
|
@@ -499,7 +507,6 @@ function makeModelFunc(options) {
|
|
|
499
507
|
};
|
|
500
508
|
};
|
|
501
509
|
}
|
|
502
|
-
exports.makeModelFunc = makeModelFunc;
|
|
503
510
|
function makeExprFunc(model, sourceName) {
|
|
504
511
|
return function expr(unmarked, ...marked) {
|
|
505
512
|
const ms = markSource(unmarked, ...marked);
|
|
@@ -509,7 +516,6 @@ function makeExprFunc(model, sourceName) {
|
|
|
509
516
|
};
|
|
510
517
|
};
|
|
511
518
|
}
|
|
512
|
-
exports.makeExprFunc = makeExprFunc;
|
|
513
519
|
function markSource(unmarked, ...marked) {
|
|
514
520
|
let code = '';
|
|
515
521
|
const locations = [];
|
|
@@ -540,7 +546,6 @@ function markSource(unmarked, ...marked) {
|
|
|
540
546
|
code += unmarked[marked.length];
|
|
541
547
|
return { code, locations };
|
|
542
548
|
}
|
|
543
|
-
exports.markSource = markSource;
|
|
544
549
|
function getSelectOneStruct(sqlBlock) {
|
|
545
550
|
const key = (0, sql_block_1.sqlKey)(sqlBlock.connection, sqlBlock.selectStr);
|
|
546
551
|
return {
|
|
@@ -554,21 +559,16 @@ function getSelectOneStruct(sqlBlock) {
|
|
|
554
559
|
},
|
|
555
560
|
};
|
|
556
561
|
}
|
|
557
|
-
exports.getSelectOneStruct = getSelectOneStruct;
|
|
558
562
|
function error(code, data) {
|
|
559
563
|
return { code, data, severity: 'error' };
|
|
560
564
|
}
|
|
561
|
-
exports.error = error;
|
|
562
565
|
function warning(code, data) {
|
|
563
566
|
return { code, data, severity: 'warn' };
|
|
564
567
|
}
|
|
565
|
-
exports.warning = warning;
|
|
566
568
|
function errorMessage(message) {
|
|
567
569
|
return { message, severity: 'error' };
|
|
568
570
|
}
|
|
569
|
-
exports.errorMessage = errorMessage;
|
|
570
571
|
function warningMessage(message) {
|
|
571
572
|
return { message, severity: 'warn' };
|
|
572
573
|
}
|
|
573
|
-
exports.warningMessage = warningMessage;
|
|
574
574
|
//# sourceMappingURL=test-translator.js.map
|
|
@@ -22,9 +22,8 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.isNeedResponse =
|
|
25
|
+
exports.isNeedResponse = isNeedResponse;
|
|
26
26
|
function isNeedResponse(dr) {
|
|
27
27
|
return !!dr && (dr.tables || dr.urls || dr.compileSQL) !== undefined;
|
|
28
28
|
}
|
|
29
|
-
exports.isNeedResponse = isNeedResponse;
|
|
30
29
|
//# sourceMappingURL=translate-response.js.map
|
package/dist/lang/utils.js
CHANGED
|
@@ -22,7 +22,12 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.locationContainsPosition = locationContainsPosition;
|
|
26
|
+
exports.isNotUndefined = isNotUndefined;
|
|
27
|
+
exports.rangeFromTokens = rangeFromTokens;
|
|
28
|
+
exports.rangeFromToken = rangeFromToken;
|
|
29
|
+
exports.rangeFromContext = rangeFromContext;
|
|
30
|
+
exports.getSourceInfo = getSourceInfo;
|
|
26
31
|
function locationContainsPosition(location, position) {
|
|
27
32
|
return (location.range.start.line <= position.line &&
|
|
28
33
|
location.range.end.line >= position.line &&
|
|
@@ -31,11 +36,9 @@ function locationContainsPosition(location, position) {
|
|
|
31
36
|
(position.line !== location.range.end.line ||
|
|
32
37
|
position.character <= location.range.end.character));
|
|
33
38
|
}
|
|
34
|
-
exports.locationContainsPosition = locationContainsPosition;
|
|
35
39
|
function isNotUndefined(value) {
|
|
36
40
|
return value !== undefined;
|
|
37
41
|
}
|
|
38
|
-
exports.isNotUndefined = isNotUndefined;
|
|
39
42
|
function rangeFromTokens(sourceInfo, startToken, stopToken) {
|
|
40
43
|
const start = {
|
|
41
44
|
line: startToken.line - 1,
|
|
@@ -68,15 +71,12 @@ function rangeFromTokens(sourceInfo, startToken, stopToken) {
|
|
|
68
71
|
}
|
|
69
72
|
return { start, end: start };
|
|
70
73
|
}
|
|
71
|
-
exports.rangeFromTokens = rangeFromTokens;
|
|
72
74
|
function rangeFromToken(sourceInfo, token) {
|
|
73
75
|
return rangeFromTokens(sourceInfo, token, token);
|
|
74
76
|
}
|
|
75
|
-
exports.rangeFromToken = rangeFromToken;
|
|
76
77
|
function rangeFromContext(sourceInfo, pcx) {
|
|
77
78
|
return rangeFromTokens(sourceInfo, pcx.start, pcx.stop || pcx.start);
|
|
78
79
|
}
|
|
79
|
-
exports.rangeFromContext = rangeFromContext;
|
|
80
80
|
/**
|
|
81
81
|
* Split the source up into lines so we can correctly compute offset
|
|
82
82
|
* to the line/char positions favored by LSP and VSCode.
|
|
@@ -112,5 +112,4 @@ function getSourceInfo(code) {
|
|
|
112
112
|
}
|
|
113
113
|
return info;
|
|
114
114
|
}
|
|
115
|
-
exports.getSourceInfo = getSourceInfo;
|
|
116
115
|
//# sourceMappingURL=utils.js.map
|
package/dist/malloy.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import type { RunSQLOptions } from './run_sql_options';
|
|
4
2
|
import type { DocumentCompletion as DocumentCompletionDefinition, DocumentSymbol as DocumentSymbolDefinition, LogMessage } from './lang';
|
|
5
3
|
import { MalloyTranslator } from './lang';
|
|
@@ -6,7 +6,23 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.resolveCompositeSources = resolveCompositeSources;
|
|
10
|
+
exports.fieldUsagePaths = fieldUsagePaths;
|
|
11
|
+
exports.formatFieldUsages = formatFieldUsages;
|
|
12
|
+
exports.isEmptyFieldUsage = isEmptyFieldUsage;
|
|
13
|
+
exports.fieldUsageIsPlural = fieldUsageIsPlural;
|
|
14
|
+
exports.formatFieldUsage = formatFieldUsage;
|
|
15
|
+
exports.unique = unique;
|
|
16
|
+
exports.mergeFieldUsage = mergeFieldUsage;
|
|
17
|
+
exports.fieldUsageDifference = fieldUsageDifference;
|
|
18
|
+
exports.emptyFieldUsage = emptyFieldUsage;
|
|
19
|
+
exports.joinedFieldUsage = joinedFieldUsage;
|
|
20
|
+
exports.fieldUsageJoinPaths = fieldUsageJoinPaths;
|
|
21
|
+
exports.checkRequiredGroupBys = checkRequiredGroupBys;
|
|
22
|
+
exports.pathEq = pathEq;
|
|
23
|
+
exports.sortFieldUsageByReferenceLocation = sortFieldUsageByReferenceLocation;
|
|
24
|
+
exports.hasCompositesAnywhere = hasCompositesAnywhere;
|
|
25
|
+
exports.logCompositeError = logCompositeError;
|
|
10
26
|
const malloy_types_1 = require("./malloy_types");
|
|
11
27
|
const utils_1 = require("./utils");
|
|
12
28
|
function _resolveCompositeSources(path, source, rootFields, nests, fieldUsage,
|
|
@@ -381,11 +397,9 @@ function resolveCompositeSources(source, segment, fieldUsage) {
|
|
|
381
397
|
}
|
|
382
398
|
return { sourceDef: undefined, error: result.error };
|
|
383
399
|
}
|
|
384
|
-
exports.resolveCompositeSources = resolveCompositeSources;
|
|
385
400
|
function fieldUsagePaths(fieldUsage) {
|
|
386
401
|
return fieldUsage.map(u => u.path);
|
|
387
402
|
}
|
|
388
|
-
exports.fieldUsagePaths = fieldUsagePaths;
|
|
389
403
|
function formatFieldUsages(fieldUsage) {
|
|
390
404
|
const deduped = [];
|
|
391
405
|
for (const usage of fieldUsage) {
|
|
@@ -407,7 +421,6 @@ function formatFieldUsages(fieldUsage) {
|
|
|
407
421
|
return `${formattedUsages.slice(0, -1).join(', ')}, and ${formattedUsages[formattedUsages.length - 1]}`;
|
|
408
422
|
}
|
|
409
423
|
}
|
|
410
|
-
exports.formatFieldUsages = formatFieldUsages;
|
|
411
424
|
function countFieldUsage(fieldUsage) {
|
|
412
425
|
const paths = [];
|
|
413
426
|
for (const usage of fieldUsage) {
|
|
@@ -420,19 +433,15 @@ function countFieldUsage(fieldUsage) {
|
|
|
420
433
|
function isEmptyFieldUsage(fieldUsage) {
|
|
421
434
|
return countFieldUsage(fieldUsage) === 0;
|
|
422
435
|
}
|
|
423
|
-
exports.isEmptyFieldUsage = isEmptyFieldUsage;
|
|
424
436
|
function fieldUsageIsPlural(fieldUsage) {
|
|
425
437
|
return countFieldUsage(fieldUsage) > 1;
|
|
426
438
|
}
|
|
427
|
-
exports.fieldUsageIsPlural = fieldUsageIsPlural;
|
|
428
439
|
function formatFieldUsage(fieldUsage) {
|
|
429
440
|
return `\`${fieldUsage.join('.')}\``;
|
|
430
441
|
}
|
|
431
|
-
exports.formatFieldUsage = formatFieldUsage;
|
|
432
442
|
function unique(values) {
|
|
433
443
|
return Array.from(new Set(values));
|
|
434
444
|
}
|
|
435
|
-
exports.unique = unique;
|
|
436
445
|
function mergeFieldUsage(...usages) {
|
|
437
446
|
const usage = [];
|
|
438
447
|
for (const oneUsage of usages) {
|
|
@@ -444,19 +453,15 @@ function mergeFieldUsage(...usages) {
|
|
|
444
453
|
return undefined;
|
|
445
454
|
return usage;
|
|
446
455
|
}
|
|
447
|
-
exports.mergeFieldUsage = mergeFieldUsage;
|
|
448
456
|
function fieldUsageDifference(a, b) {
|
|
449
457
|
return a.filter(u1 => !b.some(u2 => pathEq(u1.path, u2.path)));
|
|
450
458
|
}
|
|
451
|
-
exports.fieldUsageDifference = fieldUsageDifference;
|
|
452
459
|
function emptyFieldUsage() {
|
|
453
460
|
return [];
|
|
454
461
|
}
|
|
455
|
-
exports.emptyFieldUsage = emptyFieldUsage;
|
|
456
462
|
function joinedFieldUsage(joinPath, fieldUsage) {
|
|
457
463
|
return fieldUsage.map(u => ({ ...u, path: [...joinPath, ...u.path] }));
|
|
458
464
|
}
|
|
459
|
-
exports.joinedFieldUsage = joinedFieldUsage;
|
|
460
465
|
function fieldUsageJoinPaths(fieldUsage) {
|
|
461
466
|
const joinPaths = [];
|
|
462
467
|
for (const usage of fieldUsage) {
|
|
@@ -469,7 +474,6 @@ function fieldUsageJoinPaths(fieldUsage) {
|
|
|
469
474
|
}
|
|
470
475
|
return joinPaths;
|
|
471
476
|
}
|
|
472
|
-
exports.fieldUsageJoinPaths = fieldUsageJoinPaths;
|
|
473
477
|
function isCompositeField(fieldDef) {
|
|
474
478
|
var _a;
|
|
475
479
|
return (('e' in fieldDef && ((_a = fieldDef.e) === null || _a === void 0 ? void 0 : _a.node) === 'compositeField') ||
|
|
@@ -694,7 +698,6 @@ function checkRequiredGroupBys(compositeResolvedSourceDef, segment) {
|
|
|
694
698
|
const unsatisfied = _checkRequiredGroupBys(nests, mergeFields(compositeResolvedSourceDef.fields, sourceExtensions));
|
|
695
699
|
return unsatisfied;
|
|
696
700
|
}
|
|
697
|
-
exports.checkRequiredGroupBys = checkRequiredGroupBys;
|
|
698
701
|
function getUnsatisfiedRequiredGroupBys(level) {
|
|
699
702
|
const fields = level.fieldsReferencedDirectly;
|
|
700
703
|
const requiredGroupBys = [...level.requiredGroupBys];
|
|
@@ -709,7 +712,6 @@ function getUnsatisfiedRequiredGroupBys(level) {
|
|
|
709
712
|
function pathEq(a, b) {
|
|
710
713
|
return a.length === b.length && a.every((s, i) => b[i] === s);
|
|
711
714
|
}
|
|
712
|
-
exports.pathEq = pathEq;
|
|
713
715
|
function lookup(field, fields) {
|
|
714
716
|
const [head, ...rest] = field;
|
|
715
717
|
const def = fields.find(f => { var _a; return ((_a = f.as) !== null && _a !== void 0 ? _a : f.name) === head; });
|
|
@@ -747,7 +749,6 @@ function compareLocations(a, b) {
|
|
|
747
749
|
function sortFieldUsageByReferenceLocation(usage) {
|
|
748
750
|
return usage.sort((a, b) => compareLocations(a.at, b.at));
|
|
749
751
|
}
|
|
750
|
-
exports.sortFieldUsageByReferenceLocation = sortFieldUsageByReferenceLocation;
|
|
751
752
|
function hasCompositesAnywhere(source) {
|
|
752
753
|
if (source.type === 'composite')
|
|
753
754
|
return true;
|
|
@@ -758,7 +759,6 @@ function hasCompositesAnywhere(source) {
|
|
|
758
759
|
}
|
|
759
760
|
return false;
|
|
760
761
|
}
|
|
761
|
-
exports.hasCompositesAnywhere = hasCompositesAnywhere;
|
|
762
762
|
function logCompositeError(error, logTo) {
|
|
763
763
|
if (error.code === 'no_suitable_composite_source_input') {
|
|
764
764
|
if (error.data.failures.length > 0 &&
|
|
@@ -813,5 +813,4 @@ function logCompositeError(error, logTo) {
|
|
|
813
813
|
logTo.logError('could-not-resolve-composite-source', 'Could not resolve composite source');
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
|
-
exports.logCompositeError = logCompositeError;
|
|
817
816
|
//# sourceMappingURL=composite_source_utils.js.map
|
|
@@ -5,7 +5,7 @@ export declare const FilterCompilers: {
|
|
|
5
5
|
numberCompile(nc: NumberFilter, x: string, d: Dialect): string;
|
|
6
6
|
booleanCompile(bc: BooleanFilter, x: string, _d: Dialect): string;
|
|
7
7
|
stringCompile(sc: StringFilter, x: string, d: Dialect): string;
|
|
8
|
-
temporalCompile(tc: TemporalFilter, x: string, d: Dialect, t:
|
|
8
|
+
temporalCompile(tc: TemporalFilter, x: string, d: Dialect, t: "date" | "timestamp"): string;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* I felt like there was enough "helpful functions needed to make everything
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueryModel = exports.
|
|
3
|
+
exports.QueryModel = exports.Segment = void 0;
|
|
4
|
+
exports.getResultStructDefForView = getResultStructDefForView;
|
|
5
|
+
exports.getResultStructDefForQuery = getResultStructDefForQuery;
|
|
4
6
|
/*
|
|
5
7
|
* Copyright 2023 Google LLC
|
|
6
8
|
*
|
|
@@ -1643,13 +1645,11 @@ function getResultStructDefForView(source, view) {
|
|
|
1643
1645
|
false);
|
|
1644
1646
|
return queryQueryQuery.getResultStructDef();
|
|
1645
1647
|
}
|
|
1646
|
-
exports.getResultStructDefForView = getResultStructDefForView;
|
|
1647
1648
|
function getResultStructDefForQuery(model, query) {
|
|
1648
1649
|
const queryModel = new QueryModel(model);
|
|
1649
1650
|
const compiled = queryModel.compileQuery(query);
|
|
1650
1651
|
return compiled.structs[compiled.structs.length - 1];
|
|
1651
1652
|
}
|
|
1652
|
-
exports.getResultStructDefForQuery = getResultStructDefForQuery;
|
|
1653
1653
|
/** Query builder object. */
|
|
1654
1654
|
class QueryQuery extends QueryField {
|
|
1655
1655
|
constructor(fieldDef, parent, stageWriter, isJoinedSubquery) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
/**
|
|
4
2
|
* Field computations are compiled into an expression tree of "Expr"
|
|
5
3
|
* type nodes. Each node is one of these three interfaces. The
|
|
@@ -733,7 +731,7 @@ export type TypeDescExtensions = {
|
|
|
733
731
|
export type FunctionReturnTypeDef = ExpressionValueExtTypeDef<FunctionReturnTypeExtensions>;
|
|
734
732
|
export type FunctionReturnTypeDesc = FunctionReturnTypeDef & TypeDescExtensions;
|
|
735
733
|
export type EvalSpace = 'constant' | 'input' | 'output' | 'literal';
|
|
736
|
-
export declare function isLiteral(evalSpace: EvalSpace):
|
|
734
|
+
export declare function isLiteral(evalSpace: EvalSpace): evalSpace is "literal";
|
|
737
735
|
export declare function mergeEvalSpaces(...evalSpaces: EvalSpace[]): EvalSpace;
|
|
738
736
|
export interface FunctionParameterDef {
|
|
739
737
|
name: string;
|