@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230206094309
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/package.json +2 -2
- package/dist/connection_utils.d.ts +0 -1
- package/dist/connection_utils.js +0 -66
- package/dist/dialect/dialect.d.ts +0 -66
- package/dist/dialect/dialect.js +0 -85
- package/dist/dialect/dialect_map.d.ts +0 -3
- package/dist/dialect/dialect_map.js +0 -45
- package/dist/dialect/duckdb.d.ts +0 -52
- package/dist/dialect/duckdb.js +0 -364
- package/dist/dialect/index.d.ts +0 -6
- package/dist/dialect/index.js +0 -37
- package/dist/dialect/postgres.d.ts +0 -52
- package/dist/dialect/postgres.js +0 -330
- package/dist/dialect/standardsql.d.ts +0 -49
- package/dist/dialect/standardsql.js +0 -381
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -59
- package/dist/lang/ast/apply-expr.d.ts +0 -3
- package/dist/lang/ast/apply-expr.js +0 -34
- package/dist/lang/ast/ast-expr.d.ts +0 -206
- package/dist/lang/ast/ast-expr.js +0 -781
- package/dist/lang/ast/ast-main.d.ts +0 -915
- package/dist/lang/ast/ast-main.js +0 -3672
- package/dist/lang/ast/ast-time-expr.d.ts +0 -69
- package/dist/lang/ast/ast-time-expr.js +0 -389
- package/dist/lang/ast/ast-types.d.ts +0 -83
- package/dist/lang/ast/ast-types.js +0 -225
- package/dist/lang/ast/index.d.ts +0 -5
- package/dist/lang/ast/index.js +0 -44
- package/dist/lang/ast/time-utils.d.ts +0 -9
- package/dist/lang/ast/time-utils.js +0 -104
- package/dist/lang/field-utils.d.ts +0 -5
- package/dist/lang/field-utils.js +0 -43
- package/dist/lang/index.d.ts +0 -9
- package/dist/lang/index.js +0 -32
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +0 -165
- package/dist/lang/lib/Malloy/MalloyLexer.js +0 -1232
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +0 -1947
- package/dist/lang/lib/Malloy/MalloyParser.js +0 -11909
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +0 -2022
- package/dist/lang/lib/Malloy/MalloyParserListener.js +0 -4
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +0 -1274
- package/dist/lang/lib/Malloy/MalloyParserVisitor.js +0 -4
- package/dist/lang/parse-log.d.ts +0 -27
- package/dist/lang/parse-log.js +0 -51
- package/dist/lang/parse-malloy.d.ts +0 -236
- package/dist/lang/parse-malloy.js +0 -746
- package/dist/lang/parse-to-ast.d.ts +0 -155
- package/dist/lang/parse-to-ast.js +0 -990
- package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +0 -10
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +0 -148
- package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +0 -9
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +0 -107
- package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +0 -83
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +0 -385
- package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +0 -11
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +0 -182
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +0 -34
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +0 -74
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +0 -11
- package/dist/lang/parse-tree-walkers/find-external-references.js +0 -61
- package/dist/lang/reference-list.d.ts +0 -10
- package/dist/lang/reference-list.js +0 -90
- package/dist/lang/space-field.d.ts +0 -17
- package/dist/lang/space-field.js +0 -127
- package/dist/lang/test/document-help-context-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-help-context-walker.spec.js +0 -55
- package/dist/lang/test/document-symbol-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-symbol-walker.spec.js +0 -110
- package/dist/lang/test/field-symbols.spec.d.ts +0 -1
- package/dist/lang/test/field-symbols.spec.js +0 -180
- package/dist/lang/test/parse.spec.d.ts +0 -14
- package/dist/lang/test/parse.spec.js +0 -2134
- package/dist/lang/test/test-translator.d.ts +0 -38
- package/dist/lang/test/test-translator.js +0 -344
- package/dist/lang/zone.d.ts +0 -57
- package/dist/lang/zone.js +0 -107
- package/dist/malloy.d.ts +0 -1146
- package/dist/malloy.js +0 -2413
- package/dist/model/index.d.ts +0 -2
- package/dist/model/index.js +0 -45
- package/dist/model/malloy_query.d.ts +0 -351
- package/dist/model/malloy_query.js +0 -3174
- package/dist/model/malloy_types.d.ts +0 -551
- package/dist/model/malloy_types.js +0 -378
- package/dist/model/sql_block.d.ts +0 -7
- package/dist/model/sql_block.js +0 -56
- package/dist/model/utils.d.ts +0 -22
- package/dist/model/utils.js +0 -102
- package/dist/run_sql_options.d.ts +0 -3
- package/dist/run_sql_options.js +0 -25
- package/dist/runtime_types.d.ts +0 -105
- package/dist/runtime_types.js +0 -25
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.isEquality = exports.isComparison = exports.timestampOffset = exports.dateOffset = exports.compose = exports.compressExpr = exports.errorFor = exports.isGranularResult = exports.FT = exports.isExpressionValueType = void 0;
|
|
26
|
-
const malloy_types_1 = require("../../model/malloy_types");
|
|
27
|
-
function isExpressionValueType(fv) {
|
|
28
|
-
return ((0, malloy_types_1.isAtomicFieldType)(fv) ||
|
|
29
|
-
["null", "unknown", "duration", "regular expression"].includes(fv));
|
|
30
|
-
}
|
|
31
|
-
exports.isExpressionValueType = isExpressionValueType;
|
|
32
|
-
/**
|
|
33
|
-
* Collects functions which operate on fragtype compatible objects
|
|
34
|
-
*/
|
|
35
|
-
class FT {
|
|
36
|
-
/**
|
|
37
|
-
* Checks if a given type is in a list
|
|
38
|
-
* @param check The type to check (can be undefined)
|
|
39
|
-
* @param from List of types which are OK
|
|
40
|
-
*/
|
|
41
|
-
static in(check, from) {
|
|
42
|
-
if (check) {
|
|
43
|
-
const found = from.find((okType) => FT.eq(okType, check));
|
|
44
|
-
return found !== undefined;
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Checks if a possibly undefined candidate matches a type
|
|
50
|
-
* @param good The real type
|
|
51
|
-
* @param checkThis The possibly undefined candidate
|
|
52
|
-
*/
|
|
53
|
-
static eq(good, checkThis) {
|
|
54
|
-
return (checkThis !== undefined &&
|
|
55
|
-
good.dataType === checkThis.dataType &&
|
|
56
|
-
good.expressionType === checkThis.expressionType);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Checks if the base types, ignoring aggregate, are equal
|
|
60
|
-
* @param left Left type
|
|
61
|
-
* @param right Right type
|
|
62
|
-
* @param nullOk True if a NULL is an acceptable match
|
|
63
|
-
*/
|
|
64
|
-
static typeEq(left, right, nullOk = false) {
|
|
65
|
-
const maybeEq = left.dataType === right.dataType;
|
|
66
|
-
const nullEq = nullOk && (left.dataType === "null" || right.dataType === "null");
|
|
67
|
-
return maybeEq || nullEq;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
* For error messages, returns a comma seperated list of readable names
|
|
72
|
-
* for a list of types.
|
|
73
|
-
* @param types List of type or objects with types
|
|
74
|
-
*/
|
|
75
|
-
static inspect(...types) {
|
|
76
|
-
const strings = types.map((type) => {
|
|
77
|
-
if (type) {
|
|
78
|
-
let inspected = type.dataType;
|
|
79
|
-
if (type.expressionType != "scalar") {
|
|
80
|
-
inspected = `${type.expressionType} ${inspected}`;
|
|
81
|
-
}
|
|
82
|
-
return inspected;
|
|
83
|
-
}
|
|
84
|
-
return "undefined";
|
|
85
|
-
});
|
|
86
|
-
return strings.join(",");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.FT = FT;
|
|
90
|
-
FT.nullT = mkFragType("null");
|
|
91
|
-
FT.numberT = mkFragType("number");
|
|
92
|
-
FT.stringT = mkFragType("string");
|
|
93
|
-
FT.dateT = mkFragType("date");
|
|
94
|
-
FT.timestampT = mkFragType("timestamp");
|
|
95
|
-
FT.boolT = mkFragType("boolean");
|
|
96
|
-
FT.anyAtomicT = [
|
|
97
|
-
FT.numberT,
|
|
98
|
-
FT.stringT,
|
|
99
|
-
FT.dateT,
|
|
100
|
-
FT.timestampT,
|
|
101
|
-
FT.boolT,
|
|
102
|
-
];
|
|
103
|
-
function mkFragType(dType) {
|
|
104
|
-
return { dataType: dType, expressionType: "scalar" };
|
|
105
|
-
}
|
|
106
|
-
function isGranularResult(v) {
|
|
107
|
-
if (v.dataType !== "date" && v.dataType !== "timestamp") {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
return v.timeframe !== undefined;
|
|
111
|
-
}
|
|
112
|
-
exports.isGranularResult = isGranularResult;
|
|
113
|
-
/**
|
|
114
|
-
* When a translation hits an error, log and return one of these as a value.
|
|
115
|
-
* This will allow the rest of the translation walk to complete. The
|
|
116
|
-
* generated SQL will have a reference to an impossible variable name
|
|
117
|
-
* with the reason embedded in it.
|
|
118
|
-
* @param reason very short phrase, only read by implementers
|
|
119
|
-
* @returns Fragment[] which a debugging humnan will regognize
|
|
120
|
-
*/
|
|
121
|
-
function errorFor(reason) {
|
|
122
|
-
return {
|
|
123
|
-
dataType: "unknown",
|
|
124
|
-
expressionType: "scalar",
|
|
125
|
-
value: [`_ERROR_${reason.replace(/ /g, "_")}`],
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
exports.errorFor = errorFor;
|
|
129
|
-
/**
|
|
130
|
-
* If the passed expresion is not a single term, wrap it in parens
|
|
131
|
-
* @param f expression fragment
|
|
132
|
-
*/
|
|
133
|
-
function term(f) {
|
|
134
|
-
if (f.length > 1) {
|
|
135
|
-
return ["(", ...f, ")"];
|
|
136
|
-
}
|
|
137
|
-
if (f.length === 0) {
|
|
138
|
-
// Trying to compose a binary expresion with an entity that has no value
|
|
139
|
-
// this should at least cause the generated SQL to error, but likely
|
|
140
|
-
// there has already been a semantic error reported.
|
|
141
|
-
return ["__MISSING_VALUE__"];
|
|
142
|
-
}
|
|
143
|
-
return f;
|
|
144
|
-
}
|
|
145
|
-
function compressExpr(expr) {
|
|
146
|
-
// compress all adjacent strings
|
|
147
|
-
const compressValue = [];
|
|
148
|
-
let buildString;
|
|
149
|
-
for (const fragment of expr.flat()) {
|
|
150
|
-
if (typeof fragment === "string") {
|
|
151
|
-
buildString = buildString ? buildString + fragment : fragment;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
if (buildString) {
|
|
155
|
-
compressValue.push(buildString);
|
|
156
|
-
buildString = undefined;
|
|
157
|
-
}
|
|
158
|
-
compressValue.push(fragment);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (buildString) {
|
|
162
|
-
compressValue.push(buildString);
|
|
163
|
-
}
|
|
164
|
-
return compressValue;
|
|
165
|
-
}
|
|
166
|
-
exports.compressExpr = compressExpr;
|
|
167
|
-
/**
|
|
168
|
-
* Compose a binary expression. Tries to write them safely and concisely
|
|
169
|
-
* @param left
|
|
170
|
-
* @param op
|
|
171
|
-
* @param right
|
|
172
|
-
* @returns Fragment list of the composed expression
|
|
173
|
-
*/
|
|
174
|
-
function compose(left, op, right) {
|
|
175
|
-
const opAlpha = op.match(/^[A-Za-z]/);
|
|
176
|
-
const leftSpace = left.length === 1 && opAlpha ? " " : "";
|
|
177
|
-
const rightSpace = right.length === 1 && opAlpha ? " " : "";
|
|
178
|
-
const newOp = leftSpace + op + rightSpace;
|
|
179
|
-
return [...term(left), newOp, ...term(right)];
|
|
180
|
-
}
|
|
181
|
-
exports.compose = compose;
|
|
182
|
-
function dateOffset(from, op, n, timeframe) {
|
|
183
|
-
const add = op === "+" ? "_ADD" : "_SUB";
|
|
184
|
-
const units = timeframe.toUpperCase();
|
|
185
|
-
return compressExpr([
|
|
186
|
-
`DATE${add}(`,
|
|
187
|
-
...from,
|
|
188
|
-
`,INTERVAL `,
|
|
189
|
-
...n,
|
|
190
|
-
` ${units})`,
|
|
191
|
-
]);
|
|
192
|
-
}
|
|
193
|
-
exports.dateOffset = dateOffset;
|
|
194
|
-
function timestampOffset(from, op, n, timeframe, fromNotTimestamp = false) {
|
|
195
|
-
const useDatetime = ["week", "month", "quarter", "year"].includes(timeframe);
|
|
196
|
-
const add = op === "+" ? "_ADD" : "_SUB";
|
|
197
|
-
const units = timeframe.toUpperCase();
|
|
198
|
-
if (useDatetime) {
|
|
199
|
-
return [
|
|
200
|
-
`TIMESTAMP(DATETIME${add}(DATETIME(`,
|
|
201
|
-
...from,
|
|
202
|
-
`),INTERVAL `,
|
|
203
|
-
...n,
|
|
204
|
-
` ${units}))`,
|
|
205
|
-
];
|
|
206
|
-
}
|
|
207
|
-
const typeFrom = fromNotTimestamp ? ["TIMESTAMP(", ...from, ")"] : from;
|
|
208
|
-
return compressExpr([
|
|
209
|
-
`TIMESTAMP${add}(`,
|
|
210
|
-
...typeFrom,
|
|
211
|
-
`,INTERVAL `,
|
|
212
|
-
...n,
|
|
213
|
-
` ${units})`,
|
|
214
|
-
]);
|
|
215
|
-
}
|
|
216
|
-
exports.timestampOffset = timestampOffset;
|
|
217
|
-
function isComparison(s) {
|
|
218
|
-
return ["~", "!~", "<", "<=", "=", ">", ">=", "!="].includes(s);
|
|
219
|
-
}
|
|
220
|
-
exports.isComparison = isComparison;
|
|
221
|
-
function isEquality(s) {
|
|
222
|
-
return ["~", "!~", "=", "!="].includes(s);
|
|
223
|
-
}
|
|
224
|
-
exports.isEquality = isEquality;
|
|
225
|
-
//# sourceMappingURL=ast-types.js.map
|
package/dist/lang/ast/index.d.ts
DELETED
package/dist/lang/ast/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
27
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
28
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29
|
-
}
|
|
30
|
-
Object.defineProperty(o, k2, desc);
|
|
31
|
-
}) : (function(o, m, k, k2) {
|
|
32
|
-
if (k2 === undefined) k2 = k;
|
|
33
|
-
o[k2] = m[k];
|
|
34
|
-
}));
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
__exportStar(require("./ast-types"), exports);
|
|
40
|
-
__exportStar(require("./ast-main"), exports);
|
|
41
|
-
__exportStar(require("./ast-expr"), exports);
|
|
42
|
-
__exportStar(require("./ast-time-expr"), exports);
|
|
43
|
-
__exportStar(require("./time-utils"), exports);
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TimestampUnit, Expr, TimeFieldType, AtomicFieldType } from "../../model/malloy_types";
|
|
2
|
-
import { GranularResult, TimeResult } from "./ast-types";
|
|
3
|
-
export declare function timeOffset(timeType: TimeFieldType, from: Expr, op: "+" | "-", n: Expr, timeframe: TimestampUnit): Expr;
|
|
4
|
-
export declare function castTo(castType: AtomicFieldType, from: Expr, safe?: boolean): Expr;
|
|
5
|
-
export declare function castTimestampToDate(from: Expr, safe?: boolean): Expr;
|
|
6
|
-
export declare function castDateToTimestamp(from: Expr, safe?: boolean): Expr;
|
|
7
|
-
export declare function resolution(timeframe: string): TimeFieldType;
|
|
8
|
-
export declare function timeResult(t: TimeResult, tt: TimestampUnit | undefined): TimeResult | GranularResult;
|
|
9
|
-
export declare function timeLiteral(literalStr: string, timeType: TimeFieldType, tz: string): Expr;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.timeLiteral = exports.timeResult = exports.resolution = exports.castDateToTimestamp = exports.castTimestampToDate = exports.castTo = exports.timeOffset = void 0;
|
|
26
|
-
function timeOffset(timeType, from, op, n, timeframe) {
|
|
27
|
-
return [
|
|
28
|
-
{
|
|
29
|
-
type: "dialect",
|
|
30
|
-
function: "delta",
|
|
31
|
-
base: { valueType: timeType, value: from },
|
|
32
|
-
op,
|
|
33
|
-
delta: n,
|
|
34
|
-
units: timeframe,
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
exports.timeOffset = timeOffset;
|
|
39
|
-
function castTo(castType, from, safe = false) {
|
|
40
|
-
const cast = {
|
|
41
|
-
type: "dialect",
|
|
42
|
-
function: "cast",
|
|
43
|
-
dstType: castType,
|
|
44
|
-
expr: from,
|
|
45
|
-
safe,
|
|
46
|
-
};
|
|
47
|
-
return [cast];
|
|
48
|
-
}
|
|
49
|
-
exports.castTo = castTo;
|
|
50
|
-
function castTimestampToDate(from, safe = false) {
|
|
51
|
-
const cast = {
|
|
52
|
-
type: "dialect",
|
|
53
|
-
function: "cast",
|
|
54
|
-
dstType: "date",
|
|
55
|
-
srcType: "timestamp",
|
|
56
|
-
expr: from,
|
|
57
|
-
safe,
|
|
58
|
-
};
|
|
59
|
-
return [cast];
|
|
60
|
-
}
|
|
61
|
-
exports.castTimestampToDate = castTimestampToDate;
|
|
62
|
-
function castDateToTimestamp(from, safe = false) {
|
|
63
|
-
const cast = {
|
|
64
|
-
type: "dialect",
|
|
65
|
-
function: "cast",
|
|
66
|
-
dstType: "timestamp",
|
|
67
|
-
srcType: "date",
|
|
68
|
-
expr: from,
|
|
69
|
-
safe,
|
|
70
|
-
};
|
|
71
|
-
return [cast];
|
|
72
|
-
}
|
|
73
|
-
exports.castDateToTimestamp = castDateToTimestamp;
|
|
74
|
-
function resolution(timeframe) {
|
|
75
|
-
switch (timeframe) {
|
|
76
|
-
case "hour":
|
|
77
|
-
case "minute":
|
|
78
|
-
case "second":
|
|
79
|
-
case "microsecond":
|
|
80
|
-
case "millisecond":
|
|
81
|
-
return "timestamp";
|
|
82
|
-
}
|
|
83
|
-
return "date";
|
|
84
|
-
}
|
|
85
|
-
exports.resolution = resolution;
|
|
86
|
-
function timeResult(t, tt) {
|
|
87
|
-
if (tt) {
|
|
88
|
-
return { ...t, timeframe: tt };
|
|
89
|
-
}
|
|
90
|
-
return t;
|
|
91
|
-
}
|
|
92
|
-
exports.timeResult = timeResult;
|
|
93
|
-
function timeLiteral(literalStr, timeType, tz) {
|
|
94
|
-
const fragment = {
|
|
95
|
-
type: "dialect",
|
|
96
|
-
function: "timeLiteral",
|
|
97
|
-
literal: literalStr,
|
|
98
|
-
literalType: timeType,
|
|
99
|
-
timezone: tz,
|
|
100
|
-
};
|
|
101
|
-
return [fragment];
|
|
102
|
-
}
|
|
103
|
-
exports.timeLiteral = timeLiteral;
|
|
104
|
-
//# sourceMappingURL=time-utils.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { QueryFieldDef, FieldDef } from "../model/malloy_types";
|
|
2
|
-
declare type Field = QueryFieldDef | FieldDef;
|
|
3
|
-
export declare function nameOf(qfd: Field): string;
|
|
4
|
-
export declare function mergeFields<T extends Field>(older: T[] | undefined, newer: T[]): T[];
|
|
5
|
-
export {};
|
package/dist/lang/field-utils.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.mergeFields = exports.nameOf = void 0;
|
|
26
|
-
function nameOf(qfd) {
|
|
27
|
-
if (typeof qfd == "string") {
|
|
28
|
-
return qfd;
|
|
29
|
-
}
|
|
30
|
-
return qfd.as || qfd.name;
|
|
31
|
-
}
|
|
32
|
-
exports.nameOf = nameOf;
|
|
33
|
-
function mergeFields(older, newer) {
|
|
34
|
-
if (older == undefined) {
|
|
35
|
-
return newer;
|
|
36
|
-
}
|
|
37
|
-
const redefined = new Set(newer.map((f) => nameOf(f)));
|
|
38
|
-
const merged = older.filter((f) => !redefined.has(nameOf(f)));
|
|
39
|
-
merged.push(...newer);
|
|
40
|
-
return merged;
|
|
41
|
-
}
|
|
42
|
-
exports.mergeFields = mergeFields;
|
|
43
|
-
//# sourceMappingURL=field-utils.js.map
|
package/dist/lang/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { MalloyTranslator } from "./parse-malloy";
|
|
2
|
-
export type { TranslateResponse, UpdateData, SchemaData, URLData, SQLBlockData, } from "./parse-malloy";
|
|
3
|
-
export { exploreQueryWalkerBuilder } from "./parse-tree-walkers/explore-query-walker";
|
|
4
|
-
export type { ExploreClauseRef } from "./parse-tree-walkers/explore-query-walker";
|
|
5
|
-
export { HighlightType } from "./parse-tree-walkers/document-highlight-walker";
|
|
6
|
-
export type { DocumentHighlight } from "./parse-tree-walkers/document-highlight-walker";
|
|
7
|
-
export type { DocumentSymbol } from "./parse-tree-walkers/document-symbol-walker";
|
|
8
|
-
export type { DocumentCompletion } from "./parse-tree-walkers/document-completion-walker";
|
|
9
|
-
export type { LogMessage } from "./parse-log";
|
package/dist/lang/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright 2023 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
* a copy of this software and associated documentation files
|
|
7
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
-
* subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be
|
|
14
|
-
* included in all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.HighlightType = exports.exploreQueryWalkerBuilder = exports.MalloyTranslator = void 0;
|
|
26
|
-
var parse_malloy_1 = require("./parse-malloy");
|
|
27
|
-
Object.defineProperty(exports, "MalloyTranslator", { enumerable: true, get: function () { return parse_malloy_1.MalloyTranslator; } });
|
|
28
|
-
var explore_query_walker_1 = require("./parse-tree-walkers/explore-query-walker");
|
|
29
|
-
Object.defineProperty(exports, "exploreQueryWalkerBuilder", { enumerable: true, get: function () { return explore_query_walker_1.exploreQueryWalkerBuilder; } });
|
|
30
|
-
var document_highlight_walker_1 = require("./parse-tree-walkers/document-highlight-walker");
|
|
31
|
-
Object.defineProperty(exports, "HighlightType", { enumerable: true, get: function () { return document_highlight_walker_1.HighlightType; } });
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { ATN } from "antlr4ts/atn/ATN";
|
|
2
|
-
import { CharStream } from "antlr4ts/CharStream";
|
|
3
|
-
import { Lexer } from "antlr4ts/Lexer";
|
|
4
|
-
import { Vocabulary } from "antlr4ts/Vocabulary";
|
|
5
|
-
export declare class MalloyLexer extends Lexer {
|
|
6
|
-
static readonly JSON_STRING = 1;
|
|
7
|
-
static readonly ACCEPT = 2;
|
|
8
|
-
static readonly AGGREGATE = 3;
|
|
9
|
-
static readonly CONNECTION = 4;
|
|
10
|
-
static readonly DECLARE = 5;
|
|
11
|
-
static readonly DIMENSION = 6;
|
|
12
|
-
static readonly EXCEPT = 7;
|
|
13
|
-
static readonly EXPLORE = 8;
|
|
14
|
-
static readonly GROUP_BY = 9;
|
|
15
|
-
static readonly HAVING = 10;
|
|
16
|
-
static readonly INDEX = 11;
|
|
17
|
-
static readonly JOIN_CROSS = 12;
|
|
18
|
-
static readonly JOIN_ONE = 13;
|
|
19
|
-
static readonly JOIN_MANY = 14;
|
|
20
|
-
static readonly LIMIT = 15;
|
|
21
|
-
static readonly MEASURE = 16;
|
|
22
|
-
static readonly NEST = 17;
|
|
23
|
-
static readonly ORDER_BY = 18;
|
|
24
|
-
static readonly PRIMARY_KEY = 19;
|
|
25
|
-
static readonly PROJECT = 20;
|
|
26
|
-
static readonly QUERY = 21;
|
|
27
|
-
static readonly RENAME = 22;
|
|
28
|
-
static readonly SAMPLE = 23;
|
|
29
|
-
static readonly SELECT = 24;
|
|
30
|
-
static readonly SOURCE = 25;
|
|
31
|
-
static readonly SQL = 26;
|
|
32
|
-
static readonly FANCYSQL = 27;
|
|
33
|
-
static readonly TOP = 28;
|
|
34
|
-
static readonly WHERE = 29;
|
|
35
|
-
static readonly ALL = 30;
|
|
36
|
-
static readonly AND = 31;
|
|
37
|
-
static readonly AS = 32;
|
|
38
|
-
static readonly ASC = 33;
|
|
39
|
-
static readonly AVG = 34;
|
|
40
|
-
static readonly BOOLEAN = 35;
|
|
41
|
-
static readonly BY = 36;
|
|
42
|
-
static readonly CASE = 37;
|
|
43
|
-
static readonly CAST = 38;
|
|
44
|
-
static readonly CONDITION = 39;
|
|
45
|
-
static readonly COUNT = 40;
|
|
46
|
-
static readonly DATE = 41;
|
|
47
|
-
static readonly DAY = 42;
|
|
48
|
-
static readonly DESC = 43;
|
|
49
|
-
static readonly DISTINCT = 44;
|
|
50
|
-
static readonly ELSE = 45;
|
|
51
|
-
static readonly END = 46;
|
|
52
|
-
static readonly EXCLUDE = 47;
|
|
53
|
-
static readonly FALSE = 48;
|
|
54
|
-
static readonly FOR = 49;
|
|
55
|
-
static readonly FROM = 50;
|
|
56
|
-
static readonly FROM_SQL = 51;
|
|
57
|
-
static readonly HAS = 52;
|
|
58
|
-
static readonly HOUR = 53;
|
|
59
|
-
static readonly IMPORT = 54;
|
|
60
|
-
static readonly IS = 55;
|
|
61
|
-
static readonly JSON = 56;
|
|
62
|
-
static readonly LAST = 57;
|
|
63
|
-
static readonly MAX = 58;
|
|
64
|
-
static readonly MIN = 59;
|
|
65
|
-
static readonly MINUTE = 60;
|
|
66
|
-
static readonly MONTH = 61;
|
|
67
|
-
static readonly NOT = 62;
|
|
68
|
-
static readonly NOW = 63;
|
|
69
|
-
static readonly NULL = 64;
|
|
70
|
-
static readonly NUMBER = 65;
|
|
71
|
-
static readonly ON = 66;
|
|
72
|
-
static readonly OR = 67;
|
|
73
|
-
static readonly PICK = 68;
|
|
74
|
-
static readonly QMARK = 69;
|
|
75
|
-
static readonly QUARTER = 70;
|
|
76
|
-
static readonly SECOND = 71;
|
|
77
|
-
static readonly STRING = 72;
|
|
78
|
-
static readonly SUM = 73;
|
|
79
|
-
static readonly TABLE = 74;
|
|
80
|
-
static readonly THEN = 75;
|
|
81
|
-
static readonly THIS = 76;
|
|
82
|
-
static readonly TIMESTAMP = 77;
|
|
83
|
-
static readonly TO = 78;
|
|
84
|
-
static readonly TRUE = 79;
|
|
85
|
-
static readonly TURTLE = 80;
|
|
86
|
-
static readonly WEEK = 81;
|
|
87
|
-
static readonly WHEN = 82;
|
|
88
|
-
static readonly WITH = 83;
|
|
89
|
-
static readonly YEAR = 84;
|
|
90
|
-
static readonly UNGROUPED = 85;
|
|
91
|
-
static readonly STRING_ESCAPE = 86;
|
|
92
|
-
static readonly HACKY_REGEX = 87;
|
|
93
|
-
static readonly STRING_LITERAL = 88;
|
|
94
|
-
static readonly AMPER = 89;
|
|
95
|
-
static readonly ARROW = 90;
|
|
96
|
-
static readonly FAT_ARROW = 91;
|
|
97
|
-
static readonly OPAREN = 92;
|
|
98
|
-
static readonly CPAREN = 93;
|
|
99
|
-
static readonly OBRACK = 94;
|
|
100
|
-
static readonly CBRACK = 95;
|
|
101
|
-
static readonly OCURLY = 96;
|
|
102
|
-
static readonly CCURLY = 97;
|
|
103
|
-
static readonly DOUBLECOLON = 98;
|
|
104
|
-
static readonly COLON = 99;
|
|
105
|
-
static readonly COMMA = 100;
|
|
106
|
-
static readonly DOT = 101;
|
|
107
|
-
static readonly LT = 102;
|
|
108
|
-
static readonly GT = 103;
|
|
109
|
-
static readonly EQ = 104;
|
|
110
|
-
static readonly NE = 105;
|
|
111
|
-
static readonly LTE = 106;
|
|
112
|
-
static readonly GTE = 107;
|
|
113
|
-
static readonly PLUS = 108;
|
|
114
|
-
static readonly MINUS = 109;
|
|
115
|
-
static readonly STAR = 110;
|
|
116
|
-
static readonly STARSTAR = 111;
|
|
117
|
-
static readonly SLASH = 112;
|
|
118
|
-
static readonly BAR = 113;
|
|
119
|
-
static readonly SEMI = 114;
|
|
120
|
-
static readonly NOT_MATCH = 115;
|
|
121
|
-
static readonly MATCH = 116;
|
|
122
|
-
static readonly PERCENT = 117;
|
|
123
|
-
static readonly LITERAL_TIMESTAMP = 118;
|
|
124
|
-
static readonly LITERAL_DAY = 119;
|
|
125
|
-
static readonly LITERAL_QUARTER = 120;
|
|
126
|
-
static readonly LITERAL_MONTH = 121;
|
|
127
|
-
static readonly LITERAL_WEEK = 122;
|
|
128
|
-
static readonly LITERAL_YEAR = 123;
|
|
129
|
-
static readonly IDENTIFIER = 124;
|
|
130
|
-
static readonly PERCENT_LITERAL = 125;
|
|
131
|
-
static readonly INTEGER_LITERAL = 126;
|
|
132
|
-
static readonly NUMERIC_LITERAL = 127;
|
|
133
|
-
static readonly OBJECT_NAME_LITERAL = 128;
|
|
134
|
-
static readonly BLOCK_COMMENT = 129;
|
|
135
|
-
static readonly COMMENT_TO_EOL = 130;
|
|
136
|
-
static readonly WHITE_SPACE = 131;
|
|
137
|
-
static readonly SQL_BEGIN = 132;
|
|
138
|
-
static readonly CLOSE_CODE = 133;
|
|
139
|
-
static readonly UNWATED_CHARS_TRAILING_NUMBERS = 134;
|
|
140
|
-
static readonly UNEXPECTED_CHAR = 135;
|
|
141
|
-
static readonly OPEN_CODE = 136;
|
|
142
|
-
static readonly SQL_END = 137;
|
|
143
|
-
static readonly SQL_MODE = 1;
|
|
144
|
-
static readonly channelNames: string[];
|
|
145
|
-
static readonly modeNames: string[];
|
|
146
|
-
static readonly ruleNames: string[];
|
|
147
|
-
private static readonly _LITERAL_NAMES;
|
|
148
|
-
private static readonly _SYMBOLIC_NAMES;
|
|
149
|
-
static readonly VOCABULARY: Vocabulary;
|
|
150
|
-
get vocabulary(): Vocabulary;
|
|
151
|
-
constructor(input: CharStream);
|
|
152
|
-
get grammarFileName(): string;
|
|
153
|
-
get ruleNames(): string[];
|
|
154
|
-
get serializedATN(): string;
|
|
155
|
-
get channelNames(): string[];
|
|
156
|
-
get modeNames(): string[];
|
|
157
|
-
private static readonly _serializedATNSegments;
|
|
158
|
-
private static readonly _serializedATNSegment0;
|
|
159
|
-
private static readonly _serializedATNSegment1;
|
|
160
|
-
private static readonly _serializedATNSegment2;
|
|
161
|
-
private static readonly _serializedATNSegment3;
|
|
162
|
-
static readonly _serializedATN: string;
|
|
163
|
-
static __ATN: ATN;
|
|
164
|
-
static get _ATN(): ATN;
|
|
165
|
-
}
|