@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
package/dist/annotation.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addModelScope = addModelScope;
|
|
4
|
+
exports.annotationToTaglines = annotationToTaglines;
|
|
5
|
+
exports.annotationToTag = annotationToTag;
|
|
4
6
|
const malloy_tag_1 = require("@malloydata/malloy-tag");
|
|
5
7
|
function addModelScope(spec, modelScope) {
|
|
6
8
|
const useSpec = spec ? { ...spec } : {};
|
|
@@ -12,7 +14,6 @@ function addModelScope(spec, modelScope) {
|
|
|
12
14
|
}
|
|
13
15
|
return useSpec;
|
|
14
16
|
}
|
|
15
|
-
exports.addModelScope = addModelScope;
|
|
16
17
|
function annotationToTaglines(annote, prefix) {
|
|
17
18
|
annote || (annote = {});
|
|
18
19
|
const tagLines = annote.inherits
|
|
@@ -29,7 +30,6 @@ function annotationToTaglines(annote, prefix) {
|
|
|
29
30
|
}
|
|
30
31
|
return tagLines.concat(prefixed(annote.blockNotes), prefixed(annote.notes));
|
|
31
32
|
}
|
|
32
|
-
exports.annotationToTaglines = annotationToTaglines;
|
|
33
33
|
function annotationToTag(annote, spec = {}) {
|
|
34
34
|
var _a;
|
|
35
35
|
let extending = spec.extending || new malloy_tag_1.Tag();
|
|
@@ -64,7 +64,6 @@ function annotationToTag(annote, spec = {}) {
|
|
|
64
64
|
}
|
|
65
65
|
return { tag: extending, log: allErrs };
|
|
66
66
|
}
|
|
67
|
-
exports.annotationToTag = annotationToTag;
|
|
68
67
|
function mapMalloyError(e, note) {
|
|
69
68
|
const loc = {
|
|
70
69
|
line: note.at.range.start.line,
|
package/dist/api/asynchronous.js
CHANGED
|
@@ -21,15 +21,28 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
21
21
|
}) : function(o, v) {
|
|
22
22
|
o["default"] = v;
|
|
23
23
|
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.
|
|
42
|
+
exports.compileModel = compileModel;
|
|
43
|
+
exports.compileSource = compileSource;
|
|
44
|
+
exports.compileQuery = compileQuery;
|
|
45
|
+
exports.runQuery = runQuery;
|
|
33
46
|
const Core = __importStar(require("./core"));
|
|
34
47
|
const util_1 = require("./util");
|
|
35
48
|
async function fetchNeeds(needs, fetchers) {
|
|
@@ -129,7 +142,6 @@ async function compileModel(request, fetchers) {
|
|
|
129
142
|
Core.updateCompileModelState(state, needs);
|
|
130
143
|
}
|
|
131
144
|
}
|
|
132
|
-
exports.compileModel = compileModel;
|
|
133
145
|
async function compileSource(request, fetchers) {
|
|
134
146
|
const state = Core.newCompileSourceState(request);
|
|
135
147
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -142,7 +154,6 @@ async function compileSource(request, fetchers) {
|
|
|
142
154
|
Core.updateCompileModelState(state, needs);
|
|
143
155
|
}
|
|
144
156
|
}
|
|
145
|
-
exports.compileSource = compileSource;
|
|
146
157
|
async function compileQuery(request, fetchers) {
|
|
147
158
|
const state = Core.newCompileQueryState(request);
|
|
148
159
|
// eslint-disable-next-line no-constant-condition
|
|
@@ -155,7 +166,6 @@ async function compileQuery(request, fetchers) {
|
|
|
155
166
|
Core.updateCompileModelState(state, needs);
|
|
156
167
|
}
|
|
157
168
|
}
|
|
158
|
-
exports.compileQuery = compileQuery;
|
|
159
169
|
async function runQuery(request, fetchers) {
|
|
160
170
|
var _a, _b;
|
|
161
171
|
const compiled = await compileQuery(request, fetchers);
|
|
@@ -202,5 +212,4 @@ async function runQuery(request, fetchers) {
|
|
|
202
212
|
};
|
|
203
213
|
}
|
|
204
214
|
}
|
|
205
|
-
exports.runQuery = runQuery;
|
|
206
215
|
//# sourceMappingURL=asynchronous.js.map
|
package/dist/api/core.js
CHANGED
|
@@ -21,15 +21,36 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
21
21
|
}) : function(o, v) {
|
|
22
22
|
o["default"] = v;
|
|
23
23
|
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.
|
|
42
|
+
exports.compileQuery = compileQuery;
|
|
43
|
+
exports.updateCompileModelState = updateCompileModelState;
|
|
44
|
+
exports.newCompileModelState = newCompileModelState;
|
|
45
|
+
exports.newCompileSourceState = newCompileSourceState;
|
|
46
|
+
exports.statedCompileModel = statedCompileModel;
|
|
47
|
+
exports.statedCompileSource = statedCompileSource;
|
|
48
|
+
exports._statedCompileModel = _statedCompileModel;
|
|
49
|
+
exports.compileModel = compileModel;
|
|
50
|
+
exports.compileSource = compileSource;
|
|
51
|
+
exports.hasErrors = hasErrors;
|
|
52
|
+
exports.newCompileQueryState = newCompileQueryState;
|
|
53
|
+
exports.statedCompileQuery = statedCompileQuery;
|
|
33
54
|
const Malloy = __importStar(require("@malloydata/malloy-interfaces"));
|
|
34
55
|
const lang_1 = require("../lang");
|
|
35
56
|
const model_1 = require("../model");
|
|
@@ -220,7 +241,6 @@ function compileQuery(request, state) {
|
|
|
220
241
|
state !== null && state !== void 0 ? state : (state = newCompileQueryState(request));
|
|
221
242
|
return statedCompileQuery(state);
|
|
222
243
|
}
|
|
223
|
-
exports.compileQuery = compileQuery;
|
|
224
244
|
function updateCompileModelState(state, needs) {
|
|
225
245
|
function performUpdate(state, update) {
|
|
226
246
|
var _a, _b, _c, _d;
|
|
@@ -237,7 +257,6 @@ function updateCompileModelState(state, needs) {
|
|
|
237
257
|
const update = compilerNeedsToUpdate(needs);
|
|
238
258
|
performUpdate(state, update);
|
|
239
259
|
}
|
|
240
|
-
exports.updateCompileModelState = updateCompileModelState;
|
|
241
260
|
function _newCompileModelState(modelURL, compilerNeeds, extendURL) {
|
|
242
261
|
var _a, _b, _c, _d;
|
|
243
262
|
const translator = new lang_1.MalloyTranslator(modelURL, null, compilerNeedsToUpdate(compilerNeeds));
|
|
@@ -262,11 +281,9 @@ function _newCompileModelState(modelURL, compilerNeeds, extendURL) {
|
|
|
262
281
|
function newCompileModelState(request) {
|
|
263
282
|
return _newCompileModelState(request.model_url, request.compiler_needs, request.extend_model_url);
|
|
264
283
|
}
|
|
265
|
-
exports.newCompileModelState = newCompileModelState;
|
|
266
284
|
function newCompileSourceState(request) {
|
|
267
285
|
return _newCompileModelState(request.model_url, request.compiler_needs, request.extend_model_url);
|
|
268
286
|
}
|
|
269
|
-
exports.newCompileSourceState = newCompileSourceState;
|
|
270
287
|
// function hasNeeds(needs: Malloy.CompilerNeeds | undefined): boolean {
|
|
271
288
|
// if (needs === undefined) return false;
|
|
272
289
|
// if (needs.files && needs.files.length > 0) return true;
|
|
@@ -278,11 +295,9 @@ exports.newCompileSourceState = newCompileSourceState;
|
|
|
278
295
|
function statedCompileModel(state) {
|
|
279
296
|
return wrapResponse(_statedCompileModel(state), state.translator.sourceURL);
|
|
280
297
|
}
|
|
281
|
-
exports.statedCompileModel = statedCompileModel;
|
|
282
298
|
function statedCompileSource(state, name) {
|
|
283
299
|
return extractSource(_statedCompileModel(state), name, state.translator.sourceURL);
|
|
284
300
|
}
|
|
285
|
-
exports.statedCompileSource = statedCompileSource;
|
|
286
301
|
function _statedCompileModel(state) {
|
|
287
302
|
let extendingModel = undefined;
|
|
288
303
|
if (state.extending) {
|
|
@@ -322,7 +337,6 @@ function _statedCompileModel(state) {
|
|
|
322
337
|
return { compilerNeeds, logs: result.problems };
|
|
323
338
|
}
|
|
324
339
|
}
|
|
325
|
-
exports._statedCompileModel = _statedCompileModel;
|
|
326
340
|
function wrapResponse(response, defaultURL) {
|
|
327
341
|
const logs = response.logs ? (0, util_1.mapLogs)(response.logs, defaultURL) : undefined;
|
|
328
342
|
if (response.compilerNeeds) {
|
|
@@ -349,12 +363,10 @@ function compileModel(request, state) {
|
|
|
349
363
|
state !== null && state !== void 0 ? state : (state = newCompileModelState(request));
|
|
350
364
|
return statedCompileModel(state);
|
|
351
365
|
}
|
|
352
|
-
exports.compileModel = compileModel;
|
|
353
366
|
function compileSource(request) {
|
|
354
367
|
const state = newCompileSourceState(request);
|
|
355
368
|
return statedCompileSource(state, request.name);
|
|
356
369
|
}
|
|
357
|
-
exports.compileSource = compileSource;
|
|
358
370
|
// Given the URL to a model and a name of a queryable thing, get a StableSourceDef
|
|
359
371
|
function extractSource(result, name, defaultURL) {
|
|
360
372
|
const logs = result.logs ? (0, util_1.mapLogs)(result.logs, defaultURL) : undefined;
|
|
@@ -383,7 +395,6 @@ function hasErrors(log) {
|
|
|
383
395
|
var _a;
|
|
384
396
|
return (_a = log === null || log === void 0 ? void 0 : log.some(m => m.severity === 'error')) !== null && _a !== void 0 ? _a : false;
|
|
385
397
|
}
|
|
386
|
-
exports.hasErrors = hasErrors;
|
|
387
398
|
function newCompileQueryState(request) {
|
|
388
399
|
var _a, _b;
|
|
389
400
|
const queryMalloy = Malloy.queryToMalloy(request.query);
|
|
@@ -403,7 +414,6 @@ function newCompileQueryState(request) {
|
|
|
403
414
|
defaultRowLimit: request.default_row_limit,
|
|
404
415
|
};
|
|
405
416
|
}
|
|
406
|
-
exports.newCompileQueryState = newCompileQueryState;
|
|
407
417
|
function statedCompileQuery(state) {
|
|
408
418
|
var _a;
|
|
409
419
|
const result = _statedCompileModel(state);
|
|
@@ -495,7 +505,6 @@ function statedCompileQuery(state) {
|
|
|
495
505
|
return { compiler_needs: result.compilerNeeds, logs };
|
|
496
506
|
}
|
|
497
507
|
}
|
|
498
|
-
exports.statedCompileQuery = statedCompileQuery;
|
|
499
508
|
function annotationsOrUndefined(annotations) {
|
|
500
509
|
return annotations.length > 0 ? annotations : undefined;
|
|
501
510
|
}
|
package/dist/api/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
package/dist/api/sessioned.js
CHANGED
|
@@ -21,15 +21,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
21
21
|
}) : function(o, v) {
|
|
22
22
|
o["default"] = v;
|
|
23
23
|
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.
|
|
42
|
+
exports.compileModel = compileModel;
|
|
43
|
+
exports.compileSource = compileSource;
|
|
44
|
+
exports.compileQuery = compileQuery;
|
|
33
45
|
const Malloy = __importStar(require("@malloydata/malloy-interfaces"));
|
|
34
46
|
const Core = __importStar(require("./core"));
|
|
35
47
|
const uuid_1 = require("uuid");
|
|
@@ -228,13 +240,10 @@ const SESSION_MANAGER = new SessionManager();
|
|
|
228
240
|
function compileModel(request, options) {
|
|
229
241
|
return SESSION_MANAGER.compileModel(request, options);
|
|
230
242
|
}
|
|
231
|
-
exports.compileModel = compileModel;
|
|
232
243
|
function compileSource(request, options) {
|
|
233
244
|
return SESSION_MANAGER.compileSource(request, options);
|
|
234
245
|
}
|
|
235
|
-
exports.compileSource = compileSource;
|
|
236
246
|
function compileQuery(request, options) {
|
|
237
247
|
return SESSION_MANAGER.compileQuery(request, options);
|
|
238
248
|
}
|
|
239
|
-
exports.compileQuery = compileQuery;
|
|
240
249
|
//# sourceMappingURL=sessioned.js.map
|
package/dist/api/stateless.js
CHANGED
|
@@ -21,26 +21,35 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
21
21
|
}) : function(o, v) {
|
|
22
22
|
o["default"] = v;
|
|
23
23
|
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
31
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.
|
|
42
|
+
exports.compileModel = compileModel;
|
|
43
|
+
exports.compileSource = compileSource;
|
|
44
|
+
exports.compileQuery = compileQuery;
|
|
33
45
|
const Core = __importStar(require("./core"));
|
|
34
46
|
function compileModel(request) {
|
|
35
47
|
return Core.compileModel(request);
|
|
36
48
|
}
|
|
37
|
-
exports.compileModel = compileModel;
|
|
38
49
|
function compileSource(request) {
|
|
39
50
|
return Core.compileSource(request);
|
|
40
51
|
}
|
|
41
|
-
exports.compileSource = compileSource;
|
|
42
52
|
function compileQuery(request) {
|
|
43
53
|
return Core.compileQuery(request);
|
|
44
54
|
}
|
|
45
|
-
exports.compileQuery = compileQuery;
|
|
46
55
|
//# sourceMappingURL=stateless.js.map
|
package/dist/api/util.js
CHANGED
|
@@ -6,7 +6,12 @@
|
|
|
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.DEFAULT_LOG_RANGE = void 0;
|
|
10
|
+
exports.wrapLegacyInfoConnection = wrapLegacyInfoConnection;
|
|
11
|
+
exports.wrapLegacyConnection = wrapLegacyConnection;
|
|
12
|
+
exports.mapData = mapData;
|
|
13
|
+
exports.wrapResult = wrapResult;
|
|
14
|
+
exports.mapLogs = mapLogs;
|
|
10
15
|
const malloy_tag_1 = require("@malloydata/malloy-tag");
|
|
11
16
|
const annotation_1 = require("../annotation");
|
|
12
17
|
const to_stable_1 = require("../to_stable");
|
|
@@ -39,7 +44,6 @@ function wrapLegacyInfoConnection(connection) {
|
|
|
39
44
|
},
|
|
40
45
|
};
|
|
41
46
|
}
|
|
42
|
-
exports.wrapLegacyInfoConnection = wrapLegacyInfoConnection;
|
|
43
47
|
function wrapLegacyConnection(connection) {
|
|
44
48
|
return {
|
|
45
49
|
...wrapLegacyInfoConnection(connection),
|
|
@@ -49,7 +53,6 @@ function wrapLegacyConnection(connection) {
|
|
|
49
53
|
},
|
|
50
54
|
};
|
|
51
55
|
}
|
|
52
|
-
exports.wrapLegacyConnection = wrapLegacyConnection;
|
|
53
56
|
function valueToDate(value) {
|
|
54
57
|
// TODO properly map the data from BQ/Postgres types
|
|
55
58
|
if (value instanceof Date) {
|
|
@@ -176,7 +179,6 @@ function mapData(data, schema) {
|
|
|
176
179
|
array_value: data.map(row => mapRow(row, rootField)),
|
|
177
180
|
};
|
|
178
181
|
}
|
|
179
|
-
exports.mapData = mapData;
|
|
180
182
|
function wrapResult(result) {
|
|
181
183
|
const structs = result._queryResult.structs;
|
|
182
184
|
const struct = structs[structs.length - 1];
|
|
@@ -212,7 +214,6 @@ function wrapResult(result) {
|
|
|
212
214
|
sql: result.sql,
|
|
213
215
|
};
|
|
214
216
|
}
|
|
215
|
-
exports.wrapResult = wrapResult;
|
|
216
217
|
exports.DEFAULT_LOG_RANGE = {
|
|
217
218
|
start: {
|
|
218
219
|
line: 0,
|
|
@@ -234,5 +235,4 @@ function mapLogs(logs, defaultURL) {
|
|
|
234
235
|
});
|
|
235
236
|
});
|
|
236
237
|
}
|
|
237
|
-
exports.mapLogs = mapLogs;
|
|
238
238
|
//# sourceMappingURL=util.js.map
|
package/dist/connection_utils.js
CHANGED
|
@@ -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.toAsyncGenerator =
|
|
25
|
+
exports.toAsyncGenerator = toAsyncGenerator;
|
|
26
26
|
async function* toAsyncGenerator(startStreaming) {
|
|
27
27
|
let done = false;
|
|
28
28
|
function getResults(startStreaming) {
|
|
@@ -62,5 +62,4 @@ async function* toAsyncGenerator(startStreaming) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
exports.toAsyncGenerator = toAsyncGenerator;
|
|
66
65
|
//# sourceMappingURL=connection_utils.js.map
|
package/dist/dialect/dialect.js
CHANGED
|
@@ -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.Dialect = exports.
|
|
25
|
+
exports.Dialect = exports.dayIndex = void 0;
|
|
26
|
+
exports.inDays = inDays;
|
|
27
|
+
exports.qtz = qtz;
|
|
26
28
|
const malloy_types_1 = require("../model/malloy_types");
|
|
27
29
|
const allUnits = [
|
|
28
30
|
'microsecond',
|
|
@@ -40,7 +42,6 @@ exports.dayIndex = allUnits.indexOf('day');
|
|
|
40
42
|
function inDays(units) {
|
|
41
43
|
return allUnits.indexOf(units) >= exports.dayIndex;
|
|
42
44
|
}
|
|
43
|
-
exports.inDays = inDays;
|
|
44
45
|
// Return the active query timezone, if it different than the
|
|
45
46
|
// "native" timezone for timestamps.
|
|
46
47
|
function qtz(qi) {
|
|
@@ -50,7 +51,6 @@ function qtz(qi) {
|
|
|
50
51
|
}
|
|
51
52
|
return tz;
|
|
52
53
|
}
|
|
53
|
-
exports.qtz = qtz;
|
|
54
54
|
class Dialect {
|
|
55
55
|
constructor() {
|
|
56
56
|
// -- we should add flags with default values from now on so as to not break
|
|
@@ -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.getDialect = getDialect;
|
|
26
|
+
exports.registerDialect = registerDialect;
|
|
27
|
+
exports.getDialects = getDialects;
|
|
26
28
|
const duckdb_1 = require("./duckdb");
|
|
27
29
|
const postgres_1 = require("./postgres");
|
|
28
30
|
const snowflake_1 = require("./snowflake");
|
|
@@ -37,15 +39,12 @@ function getDialect(name) {
|
|
|
37
39
|
}
|
|
38
40
|
return d;
|
|
39
41
|
}
|
|
40
|
-
exports.getDialect = getDialect;
|
|
41
42
|
function registerDialect(d) {
|
|
42
43
|
dialectMap.set(d.name, d);
|
|
43
44
|
}
|
|
44
|
-
exports.registerDialect = registerDialect;
|
|
45
45
|
function getDialects() {
|
|
46
46
|
return [...dialectMap.values()];
|
|
47
47
|
}
|
|
48
|
-
exports.getDialects = getDialects;
|
|
49
48
|
registerDialect(new postgres_1.PostgresDialect());
|
|
50
49
|
registerDialect(new standardsql_1.StandardSQLDialect());
|
|
51
50
|
registerDialect(new duckdb_1.DuckDBDialect());
|
|
@@ -6,7 +6,9 @@
|
|
|
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.MALLOY_STANDARD_FUNCTIONS = void 0;
|
|
10
|
+
exports.getMalloyStandardFunctions = getMalloyStandardFunctions;
|
|
11
|
+
exports.expandOverrideMap = expandOverrideMap;
|
|
10
12
|
const util_1 = require("./util");
|
|
11
13
|
const abs = {
|
|
12
14
|
takes: { 'value': 'number' },
|
|
@@ -450,6 +452,11 @@ const rank = {
|
|
|
450
452
|
returns: { calculation: 'number' },
|
|
451
453
|
impl: { function: 'RANK', needsWindowOrderBy: true },
|
|
452
454
|
};
|
|
455
|
+
const dense_rank = {
|
|
456
|
+
takes: {},
|
|
457
|
+
returns: { calculation: 'number' },
|
|
458
|
+
impl: { function: 'DENSE_RANK', needsWindowOrderBy: true },
|
|
459
|
+
};
|
|
453
460
|
const row_number = {
|
|
454
461
|
takes: {},
|
|
455
462
|
returns: { calculation: 'number' },
|
|
@@ -575,6 +582,7 @@ exports.MALLOY_STANDARD_FUNCTIONS = {
|
|
|
575
582
|
// string_agg_distinct,
|
|
576
583
|
// Analytic functions
|
|
577
584
|
avg_moving,
|
|
585
|
+
dense_rank,
|
|
578
586
|
first_value,
|
|
579
587
|
lag,
|
|
580
588
|
last_value,
|
|
@@ -598,9 +606,7 @@ exports.MALLOY_STANDARD_FUNCTIONS = {
|
|
|
598
606
|
function getMalloyStandardFunctions() {
|
|
599
607
|
return (0, util_1.expandBlueprintMap)(exports.MALLOY_STANDARD_FUNCTIONS);
|
|
600
608
|
}
|
|
601
|
-
exports.getMalloyStandardFunctions = getMalloyStandardFunctions;
|
|
602
609
|
function expandOverrideMap(overrides) {
|
|
603
610
|
return (0, util_1.expandOverrideMapFromBase)(exports.MALLOY_STANDARD_FUNCTIONS, overrides);
|
|
604
611
|
}
|
|
605
|
-
exports.expandOverrideMap = expandOverrideMap;
|
|
606
612
|
//# sourceMappingURL=malloy_standard_functions.js.map
|
|
@@ -163,6 +163,6 @@ export declare function expandOverrideMapFromBase(base: DefinitionBlueprintMap,
|
|
|
163
163
|
* @returns dot dot dot able blueprint definition
|
|
164
164
|
*/
|
|
165
165
|
export declare function def(name: string, takes: Record<string, TypeDescBlueprint>, returns: TypeDescBlueprint, options?: Partial<Omit<DefinitionBlueprint, 'takes' | 'returns'>>): {
|
|
166
|
-
[
|
|
166
|
+
[name]: DefinitionBlueprint;
|
|
167
167
|
};
|
|
168
168
|
export {};
|