@malloydata/malloy 0.0.22-dev230126015148 → 0.0.22-dev230202171033
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lang/ast/ast-main.d.ts +18 -815
- package/dist/lang/ast/ast-main.js +106 -3241
- package/dist/lang/ast/ast-utils.d.ts +10 -0
- package/dist/lang/ast/ast-utils.js +42 -0
- package/dist/lang/ast/elements/define-explore.d.ts +17 -0
- package/dist/lang/ast/elements/define-explore.js +79 -0
- package/dist/lang/ast/elements/define-query.d.ts +14 -0
- package/dist/lang/ast/elements/define-query.js +56 -0
- package/dist/lang/ast/elements/mallobj.d.ts +12 -0
- package/dist/lang/ast/elements/mallobj.js +53 -0
- package/dist/lang/ast/elements/pipeline-desc.d.ts +28 -0
- package/dist/lang/ast/elements/pipeline-desc.js +102 -0
- package/dist/lang/ast/elements/refined-explore.d.ts +15 -0
- package/dist/lang/ast/elements/refined-explore.js +121 -0
- package/dist/lang/ast/error-factory.d.ts +9 -0
- package/dist/lang/ast/error-factory.js +61 -0
- package/dist/lang/ast/executors/index-executor.d.ts +18 -0
- package/dist/lang/ast/executors/index-executor.js +96 -0
- package/dist/lang/ast/executors/project-executor.d.ts +10 -0
- package/dist/lang/ast/executors/project-executor.js +68 -0
- package/dist/lang/ast/executors/reduce-executor.d.ts +20 -0
- package/dist/lang/ast/executors/reduce-executor.js +149 -0
- package/dist/lang/ast/explore-properties/field-list-edit.d.ts +8 -0
- package/dist/lang/ast/explore-properties/field-list-edit.js +36 -0
- package/dist/lang/ast/explore-properties/primary-key.d.ts +7 -0
- package/dist/lang/ast/{apply-expr.js → explore-properties/primary-key.js} +9 -8
- package/dist/lang/ast/explore-properties/renames.d.ts +11 -0
- package/dist/lang/ast/explore-properties/renames.js +43 -0
- package/dist/lang/ast/explore-properties/turtles.d.ts +5 -0
- package/dist/lang/ast/explore-properties/turtles.js +33 -0
- package/dist/lang/ast/expressions/apply.d.ts +8 -0
- package/dist/lang/ast/expressions/apply.js +37 -0
- package/dist/lang/ast/expressions/binary-boolean.d.ts +12 -0
- package/dist/lang/ast/expressions/binary-boolean.js +54 -0
- package/dist/lang/ast/expressions/binary-numeric.d.ts +11 -0
- package/dist/lang/ast/expressions/binary-numeric.js +42 -0
- package/dist/lang/ast/expressions/boolean.d.ts +8 -0
- package/dist/lang/ast/expressions/boolean.js +39 -0
- package/dist/lang/ast/expressions/constant-sub-expression.d.ts +16 -0
- package/dist/lang/ast/expressions/constant-sub-expression.js +98 -0
- package/dist/lang/ast/expressions/expr-add-sub.d.ts +4 -0
- package/dist/lang/ast/expressions/expr-add-sub.js +34 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +15 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.js +99 -0
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-alternation-tree.js +54 -0
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-asymmetric.js +27 -0
- package/dist/lang/ast/expressions/expr-avg.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-avg.js +34 -0
- package/dist/lang/ast/expressions/expr-case.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-case.js +84 -0
- package/dist/lang/ast/expressions/expr-cast.d.ts +13 -0
- package/dist/lang/ast/expressions/expr-cast.js +29 -0
- package/dist/lang/ast/expressions/expr-compare.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-compare.js +48 -0
- package/dist/lang/ast/expressions/expr-count-distinct.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-count-distinct.js +35 -0
- package/dist/lang/ast/expressions/expr-count.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-count.js +57 -0
- package/dist/lang/ast/expressions/expr-filter.d.ts +12 -0
- package/dist/lang/ast/expressions/expr-filter.js +69 -0
- package/dist/lang/ast/expressions/expr-func.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-func.js +63 -0
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +24 -0
- package/dist/lang/ast/expressions/expr-granular-time.js +117 -0
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +12 -0
- package/dist/lang/ast/expressions/expr-id-reference.js +76 -0
- package/dist/lang/ast/expressions/expr-logical-op.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-logical-op.js +36 -0
- package/dist/lang/ast/expressions/expr-max.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-max.js +16 -0
- package/dist/lang/ast/expressions/expr-min.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-min.js +16 -0
- package/dist/lang/ast/expressions/expr-minus.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-minus.js +48 -0
- package/dist/lang/ast/expressions/expr-mul-div.d.ts +4 -0
- package/dist/lang/ast/expressions/expr-mul-div.js +34 -0
- package/dist/lang/ast/expressions/expr-not.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-not.js +49 -0
- package/dist/lang/ast/expressions/expr-now.d.ts +7 -0
- package/dist/lang/ast/expressions/expr-now.js +46 -0
- package/dist/lang/ast/expressions/expr-null.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-null.js +41 -0
- package/dist/lang/ast/expressions/expr-number.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-number.js +42 -0
- package/dist/lang/ast/expressions/expr-parens.d.ts +10 -0
- package/dist/lang/ast/expressions/expr-parens.js +42 -0
- package/dist/lang/ast/expressions/expr-regex.d.ts +8 -0
- package/dist/lang/ast/expressions/expr-regex.js +42 -0
- package/dist/lang/ast/expressions/expr-string.d.ts +9 -0
- package/dist/lang/ast/expressions/expr-string.js +50 -0
- package/dist/lang/ast/expressions/expr-sum.d.ts +6 -0
- package/dist/lang/ast/expressions/expr-sum.js +12 -0
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +13 -0
- package/dist/lang/ast/expressions/expr-time-extract.js +117 -0
- package/dist/lang/ast/expressions/expr-time.d.ts +11 -0
- package/dist/lang/ast/expressions/expr-time.js +62 -0
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +14 -0
- package/dist/lang/ast/expressions/expr-ungroup.js +83 -0
- package/dist/lang/ast/expressions/for-range.d.ts +19 -0
- package/dist/lang/ast/expressions/for-range.js +101 -0
- package/dist/lang/ast/expressions/granular-literal.d.ts +20 -0
- package/dist/lang/ast/expressions/granular-literal.js +148 -0
- package/dist/lang/ast/expressions/partial-compare.d.ts +14 -0
- package/dist/lang/ast/expressions/partial-compare.js +50 -0
- package/dist/lang/ast/expressions/pick-when.d.ts +19 -0
- package/dist/lang/ast/expressions/pick-when.js +156 -0
- package/dist/lang/ast/expressions/range.d.ts +12 -0
- package/dist/lang/ast/expressions/range.js +80 -0
- package/dist/lang/ast/expressions/time-frame.d.ts +7 -0
- package/dist/lang/ast/expressions/time-frame.js +40 -0
- package/dist/lang/ast/expressions/top-by.d.ts +10 -0
- package/dist/lang/ast/expressions/top-by.js +51 -0
- package/dist/lang/ast/expressions/unary.d.ts +5 -0
- package/dist/lang/ast/expressions/unary.js +34 -0
- package/dist/lang/ast/expressions/utils.d.ts +15 -0
- package/dist/lang/ast/expressions/utils.js +106 -0
- package/dist/lang/ast/expressions/when-clause.d.ts +10 -0
- package/dist/lang/ast/expressions/when-clause.js +17 -0
- package/dist/lang/ast/fragtype-utils.d.ts +39 -0
- package/dist/lang/ast/fragtype-utils.js +100 -0
- package/dist/lang/ast/import-elements/import-statement.d.ts +9 -0
- package/dist/lang/ast/import-elements/import-statement.js +78 -0
- package/dist/lang/ast/index.d.ts +94 -3
- package/dist/lang/ast/index.js +94 -3
- package/dist/lang/ast/json-elements/json-element.d.ts +6 -0
- package/dist/lang/ast/json-elements/json-element.js +41 -0
- package/dist/lang/ast/json-elements/json-struct-def.d.ts +10 -0
- package/dist/lang/ast/json-elements/json-struct-def.js +48 -0
- package/dist/lang/ast/nesting/nest-reference.d.ts +7 -0
- package/dist/lang/ast/nesting/nest-reference.js +35 -0
- package/dist/lang/ast/parameters/constant-parameter.d.ts +8 -0
- package/dist/lang/ast/parameters/constant-parameter.js +54 -0
- package/dist/lang/ast/parameters/has-parameter.d.ts +19 -0
- package/dist/lang/ast/parameters/has-parameter.js +64 -0
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +9 -0
- package/dist/lang/ast/query-elements/anonymous-query.js +41 -0
- package/dist/lang/ast/query-elements/existing-query.d.ts +11 -0
- package/dist/lang/ast/query-elements/existing-query.js +79 -0
- package/dist/lang/ast/query-elements/full-query.d.ts +10 -0
- package/dist/lang/ast/query-elements/full-query.js +85 -0
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +9 -0
- package/dist/lang/ast/query-elements/query-head-struct.js +48 -0
- package/dist/lang/ast/query-items/field-declaration.d.ts +31 -0
- package/dist/lang/ast/query-items/field-declaration.js +137 -0
- package/dist/lang/ast/query-items/field-references.d.ts +25 -0
- package/dist/lang/ast/query-items/field-references.js +80 -0
- package/dist/lang/ast/query-properties/aggregate.d.ts +5 -0
- package/dist/lang/ast/query-properties/aggregate.js +39 -0
- package/dist/lang/ast/query-properties/declare-fields.d.ts +5 -0
- package/dist/lang/ast/query-properties/declare-fields.js +33 -0
- package/dist/lang/ast/query-properties/dimmensions.d.ts +5 -0
- package/dist/lang/ast/query-properties/dimmensions.js +36 -0
- package/dist/lang/ast/query-properties/filters.d.ts +18 -0
- package/dist/lang/ast/query-properties/filters.js +89 -0
- package/dist/lang/ast/query-properties/group-by.d.ts +5 -0
- package/dist/lang/ast/query-properties/group-by.js +39 -0
- package/dist/lang/ast/query-properties/indexing.d.ts +10 -0
- package/dist/lang/ast/query-properties/indexing.js +39 -0
- package/dist/lang/ast/query-properties/joins.d.ts +36 -0
- package/dist/lang/ast/query-properties/joins.js +143 -0
- package/dist/lang/ast/query-properties/limit.d.ts +6 -0
- package/dist/lang/ast/query-properties/limit.js +35 -0
- package/dist/lang/ast/query-properties/measures.d.ts +5 -0
- package/dist/lang/ast/query-properties/measures.js +36 -0
- package/dist/lang/ast/query-properties/nests.d.ts +5 -0
- package/dist/lang/ast/query-properties/nests.js +33 -0
- package/dist/lang/ast/query-properties/ordering.d.ts +15 -0
- package/dist/lang/ast/query-properties/ordering.js +66 -0
- package/dist/lang/ast/query-properties/project-statement.d.ts +5 -0
- package/dist/lang/ast/query-properties/project-statement.js +33 -0
- package/dist/lang/ast/query-properties/qop-desc.d.ts +17 -0
- package/dist/lang/ast/query-properties/qop-desc.js +123 -0
- package/dist/lang/ast/query-properties/sampling.d.ts +8 -0
- package/dist/lang/ast/query-properties/sampling.js +38 -0
- package/dist/lang/ast/query-properties/top.d.ts +13 -0
- package/dist/lang/ast/query-properties/top.js +60 -0
- package/dist/lang/ast/result-spaces/index-field-space.d.ts +10 -0
- package/dist/lang/ast/result-spaces/index-field-space.js +57 -0
- package/dist/lang/ast/result-spaces/project-field-space.d.ts +6 -0
- package/dist/lang/ast/result-spaces/project-field-space.js +51 -0
- package/dist/lang/ast/result-spaces/reduce-field-space.d.ts +7 -0
- package/dist/lang/ast/result-spaces/reduce-field-space.js +37 -0
- package/dist/lang/ast/sources/named-source.d.ts +19 -0
- package/dist/lang/ast/sources/named-source.js +147 -0
- package/dist/lang/ast/sources/query-source.d.ts +9 -0
- package/dist/lang/ast/sources/query-source.js +41 -0
- package/dist/lang/ast/sources/sql-source.d.ts +7 -0
- package/dist/lang/ast/sources/sql-source.js +54 -0
- package/dist/lang/ast/sources/table-source.d.ts +8 -0
- package/dist/lang/ast/sources/table-source.js +60 -0
- package/dist/lang/ast/space-fields/column-space-field.d.ts +9 -0
- package/dist/lang/ast/space-fields/column-space-field.js +40 -0
- package/dist/lang/ast/space-fields/join-space-field.d.ts +8 -0
- package/dist/lang/ast/space-fields/join-space-field.js +35 -0
- package/dist/lang/ast/space-fields/query-field-struct.d.ts +10 -0
- package/dist/lang/ast/space-fields/query-field-struct.js +46 -0
- package/dist/lang/ast/space-fields/query-space-field.d.ts +11 -0
- package/dist/lang/ast/space-fields/query-space-field.js +37 -0
- package/dist/lang/ast/space-fields/reference-field.d.ts +11 -0
- package/dist/lang/ast/space-fields/reference-field.js +45 -0
- package/dist/lang/ast/space-fields/rename-space-field.d.ts +11 -0
- package/dist/lang/ast/space-fields/rename-space-field.js +50 -0
- package/dist/lang/ast/space-fields/wild-space-field.d.ts +10 -0
- package/dist/lang/ast/space-fields/wild-space-field.js +40 -0
- package/dist/lang/ast/space-parameters/abstract-parameter.d.ts +10 -0
- package/dist/lang/ast/space-parameters/abstract-parameter.js +41 -0
- package/dist/lang/ast/space-parameters/defined-parameter.d.ts +9 -0
- package/dist/lang/ast/space-parameters/defined-parameter.js +40 -0
- package/dist/lang/ast/space-seed.d.ts +17 -0
- package/dist/lang/ast/space-seed.js +59 -0
- package/dist/lang/ast/sql-elements/sql-statement.d.ts +19 -0
- package/dist/lang/ast/sql-elements/sql-statement.js +80 -0
- package/dist/lang/ast/sql-elements/sql-string.d.ts +12 -0
- package/dist/lang/ast/sql-elements/sql-string.js +60 -0
- package/dist/lang/ast/static-space.d.ts +33 -0
- package/dist/lang/ast/static-space.js +167 -0
- package/dist/lang/ast/struct-utils.d.ts +4 -0
- package/dist/lang/ast/struct-utils.js +48 -0
- package/dist/lang/ast/time-utils.d.ts +5 -2
- package/dist/lang/ast/time-utils.js +37 -1
- package/dist/lang/ast/types/comparison.d.ts +11 -0
- package/dist/lang/ast/types/comparison.js +41 -0
- package/dist/lang/ast/types/compart-types.d.ts +10 -0
- package/dist/lang/ast/types/compart-types.js +37 -0
- package/dist/lang/ast/types/document-compile-result.d.ts +8 -0
- package/dist/lang/ast/types/document-compile-result.js +25 -0
- package/dist/lang/ast/types/equality.d.ts +7 -0
- package/dist/lang/ast/types/equality.js +37 -0
- package/dist/lang/ast/types/executor.d.ts +9 -0
- package/dist/lang/ast/types/executor.js +25 -0
- package/dist/lang/ast/types/explore-desc.d.ts +5 -0
- package/dist/lang/ast/types/explore-desc.js +33 -0
- package/dist/lang/ast/types/explore-field.d.ts +5 -0
- package/dist/lang/ast/types/explore-field.js +32 -0
- package/dist/lang/ast/types/explore-property.d.ts +10 -0
- package/dist/lang/ast/types/explore-property.js +43 -0
- package/dist/lang/ast/types/expr-result.d.ts +5 -0
- package/dist/lang/ast/types/expr-result.js +25 -0
- package/dist/lang/ast/types/expr-value.d.ts +3 -0
- package/dist/lang/ast/types/expr-value.js +25 -0
- package/dist/lang/ast/types/expression-def.d.ts +69 -0
- package/dist/lang/ast/types/expression-def.js +346 -0
- package/dist/lang/ast/types/expression-value-type.d.ts +2 -0
- package/dist/lang/ast/types/expression-value-type.js +25 -0
- package/dist/lang/ast/types/field-collection-member.d.ts +5 -0
- package/dist/lang/ast/types/field-collection-member.js +34 -0
- package/dist/lang/ast/types/field-decl.d.ts +7 -0
- package/dist/lang/ast/types/field-decl.js +37 -0
- package/dist/lang/ast/types/field-map.d.ts +2 -0
- package/dist/lang/ast/types/field-map.js +25 -0
- package/dist/lang/ast/types/field-space.d.ts +26 -0
- package/dist/lang/ast/types/field-space.js +48 -0
- package/dist/lang/ast/types/field-type.d.ts +6 -0
- package/dist/lang/ast/types/field-type.js +25 -0
- package/dist/lang/ast/types/field-value-type.d.ts +3 -0
- package/dist/lang/ast/types/field-value-type.js +25 -0
- package/dist/lang/ast/types/frag-type.d.ts +6 -0
- package/dist/lang/ast/types/frag-type.js +25 -0
- package/dist/lang/ast/types/granular-result.d.ts +7 -0
- package/dist/lang/ast/types/granular-result.js +11 -0
- package/dist/lang/ast/types/lookup-result.d.ts +10 -0
- package/dist/lang/ast/types/lookup-result.js +25 -0
- package/dist/lang/ast/types/malloy-element.d.ts +105 -0
- package/dist/lang/ast/types/malloy-element.js +398 -0
- package/dist/lang/ast/types/model-entry.d.ts +6 -0
- package/dist/lang/ast/types/model-entry.js +25 -0
- package/dist/lang/ast/types/name-space.d.ts +5 -0
- package/dist/lang/ast/types/name-space.js +25 -0
- package/dist/lang/ast/types/nested-query.d.ts +3 -0
- package/dist/lang/ast/types/nested-query.js +25 -0
- package/dist/lang/ast/types/op-desc.d.ts +6 -0
- package/dist/lang/ast/types/op-desc.js +25 -0
- package/dist/lang/ast/types/query-comp.d.ts +5 -0
- package/dist/lang/ast/types/query-comp.js +25 -0
- package/dist/lang/ast/types/query-element.d.ts +5 -0
- package/dist/lang/ast/types/query-element.js +32 -0
- package/dist/lang/ast/types/query-item.d.ts +5 -0
- package/dist/lang/ast/types/query-item.js +25 -0
- package/dist/lang/ast/types/query-property.d.ts +17 -0
- package/dist/lang/ast/types/query-property.js +55 -0
- package/dist/lang/ast/types/space-entry.d.ts +5 -0
- package/dist/lang/ast/types/space-entry.js +29 -0
- package/dist/lang/ast/types/space-field.d.ts +10 -0
- package/dist/lang/ast/types/space-field.js +48 -0
- package/dist/lang/ast/types/space-param.d.ts +6 -0
- package/dist/lang/ast/types/space-param.js +34 -0
- package/dist/lang/ast/types/stage-field-type.d.ts +1 -0
- package/dist/lang/ast/types/stage-field-type.js +25 -0
- package/dist/lang/ast/types/time-result.d.ts +6 -0
- package/dist/lang/ast/types/time-result.js +25 -0
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +7 -0
- package/dist/lang/ast/types/turtle-headed-pipe.js +37 -0
- package/dist/lang/space-field.d.ts +4 -1
- package/dist/lang/space-field.js +4 -3
- package/dist/lang/test/field-symbols.spec.js +25 -21
- package/dist/lang/test/parse.spec.js +4 -3
- package/dist/lang/test/test-translator.d.ts +3 -1
- package/package.json +1 -1
- package/dist/lang/ast/apply-expr.d.ts +0 -3
- package/dist/lang/ast/ast-expr.d.ts +0 -206
- package/dist/lang/ast/ast-expr.js +0 -781
- 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
|
@@ -0,0 +1,100 @@
|
|
|
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.FT = void 0;
|
|
26
|
+
function mkFragType(dType) {
|
|
27
|
+
return { dataType: dType, expressionType: "scalar" };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Collects functions which operate on fragtype compatible objects
|
|
31
|
+
*/
|
|
32
|
+
class FT {
|
|
33
|
+
/**
|
|
34
|
+
* Checks if a given type is in a list
|
|
35
|
+
* @param check The type to check (can be undefined)
|
|
36
|
+
* @param from List of types which are OK
|
|
37
|
+
*/
|
|
38
|
+
static in(check, from) {
|
|
39
|
+
if (check) {
|
|
40
|
+
const found = from.find((okType) => FT.eq(okType, check));
|
|
41
|
+
return found !== undefined;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Checks if a possibly undefined candidate matches a type
|
|
47
|
+
* @param good The real type
|
|
48
|
+
* @param checkThis The possibly undefined candidate
|
|
49
|
+
*/
|
|
50
|
+
static eq(good, checkThis) {
|
|
51
|
+
return (checkThis !== undefined &&
|
|
52
|
+
good.dataType === checkThis.dataType &&
|
|
53
|
+
good.expressionType === checkThis.expressionType);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the base types, ignoring aggregate, are equal
|
|
57
|
+
* @param left Left type
|
|
58
|
+
* @param right Right type
|
|
59
|
+
* @param nullOk True if a NULL is an acceptable match
|
|
60
|
+
*/
|
|
61
|
+
static typeEq(left, right, nullOk = false) {
|
|
62
|
+
const maybeEq = left.dataType === right.dataType;
|
|
63
|
+
const nullEq = nullOk && (left.dataType === "null" || right.dataType === "null");
|
|
64
|
+
return maybeEq || nullEq;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* For error messages, returns a comma seperated list of readable names
|
|
69
|
+
* for a list of types.
|
|
70
|
+
* @param types List of type or objects with types
|
|
71
|
+
*/
|
|
72
|
+
static inspect(...types) {
|
|
73
|
+
const strings = types.map((type) => {
|
|
74
|
+
if (type) {
|
|
75
|
+
let inspected = type.dataType;
|
|
76
|
+
if (type.expressionType != "scalar") {
|
|
77
|
+
inspected = `${type.expressionType} ${inspected}`;
|
|
78
|
+
}
|
|
79
|
+
return inspected;
|
|
80
|
+
}
|
|
81
|
+
return "undefined";
|
|
82
|
+
});
|
|
83
|
+
return strings.join(",");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.FT = FT;
|
|
87
|
+
FT.nullT = mkFragType("null");
|
|
88
|
+
FT.numberT = mkFragType("number");
|
|
89
|
+
FT.stringT = mkFragType("string");
|
|
90
|
+
FT.dateT = mkFragType("date");
|
|
91
|
+
FT.timestampT = mkFragType("timestamp");
|
|
92
|
+
FT.boolT = mkFragType("boolean");
|
|
93
|
+
FT.anyAtomicT = [
|
|
94
|
+
FT.numberT,
|
|
95
|
+
FT.stringT,
|
|
96
|
+
FT.dateT,
|
|
97
|
+
FT.timestampT,
|
|
98
|
+
FT.boolT,
|
|
99
|
+
];
|
|
100
|
+
//# sourceMappingURL=fragtype-utils.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModelDataRequest } from "../../parse-malloy";
|
|
2
|
+
import { DocStatement, Document, MalloyElement } from "../types/malloy-element";
|
|
3
|
+
export declare class ImportStatement extends MalloyElement implements DocStatement {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
elementType: string;
|
|
6
|
+
fullURL?: string;
|
|
7
|
+
constructor(url: string, baseURL: string);
|
|
8
|
+
execute(doc: Document): ModelDataRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
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.ImportStatement = void 0;
|
|
26
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
27
|
+
class ImportStatement extends malloy_element_1.MalloyElement {
|
|
28
|
+
/*
|
|
29
|
+
* At the time of writng this comment, it is guaranteed that if an AST
|
|
30
|
+
* node for an import statement is created, the translator has already
|
|
31
|
+
* succesfully fetched the URL referred to in the statement.
|
|
32
|
+
*
|
|
33
|
+
* Error checking code in here is future proofing against a day when
|
|
34
|
+
* there are other ways to contruct an AST.
|
|
35
|
+
*/
|
|
36
|
+
constructor(url, baseURL) {
|
|
37
|
+
super();
|
|
38
|
+
this.url = url;
|
|
39
|
+
this.elementType = "import statement";
|
|
40
|
+
try {
|
|
41
|
+
this.fullURL = decodeURI(new URL(url, baseURL).toString());
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
this.log("Invalid URI in import statement");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
execute(doc) {
|
|
48
|
+
const trans = this.translator();
|
|
49
|
+
if (!trans) {
|
|
50
|
+
this.log("Cannot import without translation context");
|
|
51
|
+
}
|
|
52
|
+
else if (this.fullURL) {
|
|
53
|
+
const src = trans.root.importZone.getEntry(this.fullURL);
|
|
54
|
+
if (src.status === "present") {
|
|
55
|
+
const childNeeds = trans.childRequest(this.fullURL);
|
|
56
|
+
if (childNeeds) {
|
|
57
|
+
return childNeeds;
|
|
58
|
+
}
|
|
59
|
+
const importStructs = trans.getChildExports(this.fullURL);
|
|
60
|
+
for (const importing in importStructs) {
|
|
61
|
+
doc.setEntry(importing, {
|
|
62
|
+
entry: importStructs[importing],
|
|
63
|
+
exported: false,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else if (src.status === "error") {
|
|
68
|
+
this.log(`import failed: '${src.message}'`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.log(`import failed with status: '${src.status}'`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ImportStatement = ImportStatement;
|
|
78
|
+
//# sourceMappingURL=import-statement.js.map
|
package/dist/lang/ast/index.d.ts
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
|
-
export * from "./ast-types";
|
|
2
1
|
export * from "./ast-main";
|
|
3
|
-
export * from "./ast-
|
|
4
|
-
export * from "./
|
|
2
|
+
export * from "./ast-utils";
|
|
3
|
+
export * from "./elements/define-explore";
|
|
4
|
+
export * from "./elements/define-query";
|
|
5
|
+
export * from "./elements/mallobj";
|
|
6
|
+
export * from "./elements/refined-explore";
|
|
7
|
+
export * from "./explore-properties/field-list-edit";
|
|
8
|
+
export * from "./explore-properties/primary-key";
|
|
9
|
+
export * from "./explore-properties/renames";
|
|
10
|
+
export * from "./explore-properties/turtles";
|
|
11
|
+
export * from "./expressions/apply";
|
|
12
|
+
export * from "./expressions/binary-numeric";
|
|
13
|
+
export * from "./expressions/boolean";
|
|
14
|
+
export * from "./expressions/expr-add-sub";
|
|
15
|
+
export * from "./expressions/expr-aggregate-function";
|
|
16
|
+
export * from "./expressions/expr-alternation-tree";
|
|
17
|
+
export * from "./expressions/expr-asymmetric";
|
|
18
|
+
export * from "./expressions/expr-avg";
|
|
19
|
+
export * from "./expressions/expr-case";
|
|
20
|
+
export * from "./expressions/expr-cast";
|
|
21
|
+
export * from "./expressions/expr-compare";
|
|
22
|
+
export * from "./expressions/expr-count";
|
|
23
|
+
export * from "./expressions/expr-count-distinct";
|
|
24
|
+
export * from "./expressions/expr-filter";
|
|
25
|
+
export * from "./expressions/expr-func";
|
|
26
|
+
export * from "./expressions/expr-granular-time";
|
|
27
|
+
export * from "./expressions/expr-id-reference";
|
|
28
|
+
export * from "./expressions/expr-logical-op";
|
|
29
|
+
export * from "./expressions/expr-max";
|
|
30
|
+
export * from "./expressions/expr-min";
|
|
31
|
+
export * from "./expressions/expr-minus";
|
|
32
|
+
export * from "./expressions/expr-mul-div";
|
|
33
|
+
export * from "./expressions/expr-not";
|
|
34
|
+
export * from "./expressions/expr-now";
|
|
35
|
+
export * from "./expressions/expr-null";
|
|
36
|
+
export * from "./expressions/expr-number";
|
|
37
|
+
export * from "./expressions/expr-parens";
|
|
38
|
+
export * from "./expressions/expr-regex";
|
|
39
|
+
export * from "./expressions/expr-string";
|
|
40
|
+
export * from "./expressions/expr-sum";
|
|
41
|
+
export * from "./expressions/expr-time-extract";
|
|
42
|
+
export * from "./expressions/expr-ungroup";
|
|
43
|
+
export * from "./expressions/for-range";
|
|
44
|
+
export * from "./expressions/granular-literal";
|
|
45
|
+
export * from "./expressions/partial-compare";
|
|
46
|
+
export * from "./expressions/pick-when";
|
|
47
|
+
export * from "./expressions/range";
|
|
48
|
+
export * from "./expressions/time-frame";
|
|
49
|
+
export * from "./expressions/top-by";
|
|
50
|
+
export * from "./expressions/unary";
|
|
51
|
+
export * from "./expressions/utils";
|
|
52
|
+
export * from "./expressions/when-clause";
|
|
53
|
+
export * from "./import-elements/import-statement";
|
|
54
|
+
export * from "./nesting/nest-reference";
|
|
55
|
+
export * from "./parameters/has-parameter";
|
|
56
|
+
export * from "./query-elements/anonymous-query";
|
|
57
|
+
export * from "./query-elements/existing-query";
|
|
58
|
+
export * from "./query-elements/full-query";
|
|
59
|
+
export * from "./query-items/field-declaration";
|
|
60
|
+
export * from "./query-items/field-references";
|
|
61
|
+
export * from "./query-properties/aggregate";
|
|
62
|
+
export * from "./query-properties/declare-fields";
|
|
63
|
+
export * from "./query-properties/dimmensions";
|
|
64
|
+
export * from "./query-properties/filters";
|
|
65
|
+
export * from "./query-properties/group-by";
|
|
66
|
+
export * from "./query-properties/indexing";
|
|
67
|
+
export * from "./query-properties/joins";
|
|
68
|
+
export * from "./query-properties/limit";
|
|
69
|
+
export * from "./query-properties/measures";
|
|
70
|
+
export * from "./query-properties/nests";
|
|
71
|
+
export * from "./query-properties/ordering";
|
|
72
|
+
export * from "./query-properties/project-statement";
|
|
73
|
+
export * from "./query-properties/qop-desc";
|
|
74
|
+
export * from "./query-properties/sampling";
|
|
75
|
+
export * from "./query-properties/top";
|
|
76
|
+
export * from "./sources/named-source";
|
|
77
|
+
export * from "./sources/query-source";
|
|
78
|
+
export * from "./sources/sql-source";
|
|
79
|
+
export * from "./sources/table-source";
|
|
80
|
+
export * from "./sql-elements/sql-statement";
|
|
81
|
+
export * from "./sql-elements/sql-string";
|
|
5
82
|
export * from "./time-utils";
|
|
83
|
+
export * from "./types/comparison";
|
|
84
|
+
export * from "./types/compart-types";
|
|
85
|
+
export * from "./types/explore-desc";
|
|
86
|
+
export * from "./types/explore-property";
|
|
87
|
+
export * from "./types/expression-def";
|
|
88
|
+
export * from "./types/field-collection-member";
|
|
89
|
+
export * from "./types/field-space";
|
|
90
|
+
export * from "./types/malloy-element";
|
|
91
|
+
export * from "./types/nested-query";
|
|
92
|
+
export * from "./types/query-element";
|
|
93
|
+
export * from "./types/query-item";
|
|
94
|
+
export * from "./types/query-property";
|
|
95
|
+
export * from "./types/stage-field-type";
|
|
96
|
+
export * from "./types/turtle-headed-pipe";
|
package/dist/lang/ast/index.js
CHANGED
|
@@ -36,9 +36,100 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
__exportStar(require("./ast-types"), exports);
|
|
40
39
|
__exportStar(require("./ast-main"), exports);
|
|
41
|
-
__exportStar(require("./ast-
|
|
42
|
-
__exportStar(require("./
|
|
40
|
+
__exportStar(require("./ast-utils"), exports);
|
|
41
|
+
__exportStar(require("./elements/define-explore"), exports);
|
|
42
|
+
__exportStar(require("./elements/define-query"), exports);
|
|
43
|
+
__exportStar(require("./elements/mallobj"), exports);
|
|
44
|
+
__exportStar(require("./elements/refined-explore"), exports);
|
|
45
|
+
__exportStar(require("./explore-properties/field-list-edit"), exports);
|
|
46
|
+
__exportStar(require("./explore-properties/primary-key"), exports);
|
|
47
|
+
__exportStar(require("./explore-properties/renames"), exports);
|
|
48
|
+
__exportStar(require("./explore-properties/turtles"), exports);
|
|
49
|
+
__exportStar(require("./expressions/apply"), exports);
|
|
50
|
+
__exportStar(require("./expressions/binary-numeric"), exports);
|
|
51
|
+
__exportStar(require("./expressions/boolean"), exports);
|
|
52
|
+
__exportStar(require("./expressions/expr-add-sub"), exports);
|
|
53
|
+
__exportStar(require("./expressions/expr-aggregate-function"), exports);
|
|
54
|
+
__exportStar(require("./expressions/expr-alternation-tree"), exports);
|
|
55
|
+
__exportStar(require("./expressions/expr-asymmetric"), exports);
|
|
56
|
+
__exportStar(require("./expressions/expr-avg"), exports);
|
|
57
|
+
__exportStar(require("./expressions/expr-case"), exports);
|
|
58
|
+
__exportStar(require("./expressions/expr-cast"), exports);
|
|
59
|
+
__exportStar(require("./expressions/expr-compare"), exports);
|
|
60
|
+
__exportStar(require("./expressions/expr-count"), exports);
|
|
61
|
+
__exportStar(require("./expressions/expr-count-distinct"), exports);
|
|
62
|
+
__exportStar(require("./expressions/expr-filter"), exports);
|
|
63
|
+
__exportStar(require("./expressions/expr-func"), exports);
|
|
64
|
+
__exportStar(require("./expressions/expr-granular-time"), exports);
|
|
65
|
+
__exportStar(require("./expressions/expr-id-reference"), exports);
|
|
66
|
+
__exportStar(require("./expressions/expr-logical-op"), exports);
|
|
67
|
+
__exportStar(require("./expressions/expr-max"), exports);
|
|
68
|
+
__exportStar(require("./expressions/expr-min"), exports);
|
|
69
|
+
__exportStar(require("./expressions/expr-minus"), exports);
|
|
70
|
+
__exportStar(require("./expressions/expr-mul-div"), exports);
|
|
71
|
+
__exportStar(require("./expressions/expr-not"), exports);
|
|
72
|
+
__exportStar(require("./expressions/expr-now"), exports);
|
|
73
|
+
__exportStar(require("./expressions/expr-null"), exports);
|
|
74
|
+
__exportStar(require("./expressions/expr-number"), exports);
|
|
75
|
+
__exportStar(require("./expressions/expr-parens"), exports);
|
|
76
|
+
__exportStar(require("./expressions/expr-regex"), exports);
|
|
77
|
+
__exportStar(require("./expressions/expr-string"), exports);
|
|
78
|
+
__exportStar(require("./expressions/expr-sum"), exports);
|
|
79
|
+
__exportStar(require("./expressions/expr-time-extract"), exports);
|
|
80
|
+
__exportStar(require("./expressions/expr-ungroup"), exports);
|
|
81
|
+
__exportStar(require("./expressions/for-range"), exports);
|
|
82
|
+
__exportStar(require("./expressions/granular-literal"), exports);
|
|
83
|
+
__exportStar(require("./expressions/partial-compare"), exports);
|
|
84
|
+
__exportStar(require("./expressions/pick-when"), exports);
|
|
85
|
+
__exportStar(require("./expressions/range"), exports);
|
|
86
|
+
__exportStar(require("./expressions/time-frame"), exports);
|
|
87
|
+
__exportStar(require("./expressions/top-by"), exports);
|
|
88
|
+
__exportStar(require("./expressions/unary"), exports);
|
|
89
|
+
__exportStar(require("./expressions/utils"), exports);
|
|
90
|
+
__exportStar(require("./expressions/when-clause"), exports);
|
|
91
|
+
__exportStar(require("./import-elements/import-statement"), exports);
|
|
92
|
+
__exportStar(require("./nesting/nest-reference"), exports);
|
|
93
|
+
__exportStar(require("./parameters/has-parameter"), exports);
|
|
94
|
+
__exportStar(require("./query-elements/anonymous-query"), exports);
|
|
95
|
+
__exportStar(require("./query-elements/existing-query"), exports);
|
|
96
|
+
__exportStar(require("./query-elements/full-query"), exports);
|
|
97
|
+
__exportStar(require("./query-items/field-declaration"), exports);
|
|
98
|
+
__exportStar(require("./query-items/field-references"), exports);
|
|
99
|
+
__exportStar(require("./query-properties/aggregate"), exports);
|
|
100
|
+
__exportStar(require("./query-properties/declare-fields"), exports);
|
|
101
|
+
__exportStar(require("./query-properties/dimmensions"), exports);
|
|
102
|
+
__exportStar(require("./query-properties/filters"), exports);
|
|
103
|
+
__exportStar(require("./query-properties/group-by"), exports);
|
|
104
|
+
__exportStar(require("./query-properties/indexing"), exports);
|
|
105
|
+
__exportStar(require("./query-properties/joins"), exports);
|
|
106
|
+
__exportStar(require("./query-properties/limit"), exports);
|
|
107
|
+
__exportStar(require("./query-properties/measures"), exports);
|
|
108
|
+
__exportStar(require("./query-properties/nests"), exports);
|
|
109
|
+
__exportStar(require("./query-properties/ordering"), exports);
|
|
110
|
+
__exportStar(require("./query-properties/project-statement"), exports);
|
|
111
|
+
__exportStar(require("./query-properties/qop-desc"), exports);
|
|
112
|
+
__exportStar(require("./query-properties/sampling"), exports);
|
|
113
|
+
__exportStar(require("./query-properties/top"), exports);
|
|
114
|
+
__exportStar(require("./sources/named-source"), exports);
|
|
115
|
+
__exportStar(require("./sources/query-source"), exports);
|
|
116
|
+
__exportStar(require("./sources/sql-source"), exports);
|
|
117
|
+
__exportStar(require("./sources/table-source"), exports);
|
|
118
|
+
__exportStar(require("./sql-elements/sql-statement"), exports);
|
|
119
|
+
__exportStar(require("./sql-elements/sql-string"), exports);
|
|
43
120
|
__exportStar(require("./time-utils"), exports);
|
|
121
|
+
__exportStar(require("./types/comparison"), exports);
|
|
122
|
+
__exportStar(require("./types/compart-types"), exports);
|
|
123
|
+
__exportStar(require("./types/explore-desc"), exports);
|
|
124
|
+
__exportStar(require("./types/explore-property"), exports);
|
|
125
|
+
__exportStar(require("./types/expression-def"), exports);
|
|
126
|
+
__exportStar(require("./types/field-collection-member"), exports);
|
|
127
|
+
__exportStar(require("./types/field-space"), exports);
|
|
128
|
+
__exportStar(require("./types/malloy-element"), exports);
|
|
129
|
+
__exportStar(require("./types/nested-query"), exports);
|
|
130
|
+
__exportStar(require("./types/query-element"), exports);
|
|
131
|
+
__exportStar(require("./types/query-item"), exports);
|
|
132
|
+
__exportStar(require("./types/query-property"), exports);
|
|
133
|
+
__exportStar(require("./types/stage-field-type"), exports);
|
|
134
|
+
__exportStar(require("./types/turtle-headed-pipe"), exports);
|
|
44
135
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
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.JSONElement = void 0;
|
|
26
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
27
|
+
class JSONElement extends malloy_element_1.MalloyElement {
|
|
28
|
+
constructor(jsonSrc) {
|
|
29
|
+
super();
|
|
30
|
+
this.elementType = "jsonElement";
|
|
31
|
+
try {
|
|
32
|
+
this.value = JSON.parse(jsonSrc);
|
|
33
|
+
}
|
|
34
|
+
catch (SyntaxError) {
|
|
35
|
+
this.log("JSON syntax error");
|
|
36
|
+
this.value = undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.JSONElement = JSONElement;
|
|
41
|
+
//# sourceMappingURL=json-element.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StructDef } from "../../../model/malloy_types";
|
|
2
|
+
import { Mallobj } from "../elements/mallobj";
|
|
3
|
+
import { JSONElement } from "./json-element";
|
|
4
|
+
export declare class JSONStructDef extends Mallobj {
|
|
5
|
+
readonly struct: StructDef;
|
|
6
|
+
elementType: string;
|
|
7
|
+
constructor(struct: StructDef);
|
|
8
|
+
static fromJSON(jsonObj: JSONElement): JSONStructDef | undefined;
|
|
9
|
+
structDef(): StructDef;
|
|
10
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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.JSONStructDef = void 0;
|
|
26
|
+
const mallobj_1 = require("../elements/mallobj");
|
|
27
|
+
class JSONStructDef extends mallobj_1.Mallobj {
|
|
28
|
+
constructor(struct) {
|
|
29
|
+
super();
|
|
30
|
+
this.struct = struct;
|
|
31
|
+
this.elementType = "jsonStructDef";
|
|
32
|
+
}
|
|
33
|
+
static fromJSON(jsonObj) {
|
|
34
|
+
const obj = jsonObj.value;
|
|
35
|
+
if (obj &&
|
|
36
|
+
obj.type === "struct" &&
|
|
37
|
+
obj.structRelationship &&
|
|
38
|
+
obj.structSource) {
|
|
39
|
+
return new JSONStructDef(obj);
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
structDef() {
|
|
44
|
+
return this.struct;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.JSONStructDef = JSONStructDef;
|
|
48
|
+
//# sourceMappingURL=json-struct-def.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
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.NestReference = void 0;
|
|
26
|
+
const field_references_1 = require("../query-items/field-references");
|
|
27
|
+
class NestReference extends field_references_1.FieldReference {
|
|
28
|
+
constructor(name) {
|
|
29
|
+
super([name]);
|
|
30
|
+
this.name = name;
|
|
31
|
+
this.elementType = "nestReference";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.NestReference = NestReference;
|
|
35
|
+
//# sourceMappingURL=nest-reference.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Parameter } from "../../../model/malloy_types";
|
|
2
|
+
import { ConstantSubExpression } from "../expressions/constant-sub-expression";
|
|
3
|
+
import { HasParameter } from "./has-parameter";
|
|
4
|
+
export declare class ConstantParameter extends HasParameter {
|
|
5
|
+
readonly value: ConstantSubExpression;
|
|
6
|
+
constructor(name: string, value: ConstantSubExpression);
|
|
7
|
+
parameter(): Parameter;
|
|
8
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.ConstantParameter = void 0;
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const has_parameter_1 = require("./has-parameter");
|
|
28
|
+
class ConstantParameter extends has_parameter_1.HasParameter {
|
|
29
|
+
constructor(name, value) {
|
|
30
|
+
super({ name, isCondition: false });
|
|
31
|
+
this.value = value;
|
|
32
|
+
this.has({ value });
|
|
33
|
+
}
|
|
34
|
+
parameter() {
|
|
35
|
+
const cVal = this.value.constantValue();
|
|
36
|
+
if (!(0, malloy_types_1.isAtomicFieldType)(cVal.dataType)) {
|
|
37
|
+
this.log(`Unexpected expression type '${cVal.dataType}'`);
|
|
38
|
+
return {
|
|
39
|
+
value: ["XXX-type-mismatch-error-XXX"],
|
|
40
|
+
type: "string",
|
|
41
|
+
name: this.name,
|
|
42
|
+
constant: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
value: cVal.value,
|
|
47
|
+
type: cVal.dataType,
|
|
48
|
+
name: this.name,
|
|
49
|
+
constant: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ConstantParameter = ConstantParameter;
|
|
54
|
+
//# sourceMappingURL=constant-parameter.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AtomicFieldType, Parameter } from "../../../model/malloy_types";
|
|
2
|
+
import { ConstantSubExpression } from "../expressions/constant-sub-expression";
|
|
3
|
+
import { MalloyElement } from "../types/malloy-element";
|
|
4
|
+
interface HasInit {
|
|
5
|
+
name: string;
|
|
6
|
+
isCondition: boolean;
|
|
7
|
+
type?: string;
|
|
8
|
+
default?: ConstantSubExpression;
|
|
9
|
+
}
|
|
10
|
+
export declare class HasParameter extends MalloyElement {
|
|
11
|
+
elementType: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly isCondition: boolean;
|
|
14
|
+
readonly type?: AtomicFieldType;
|
|
15
|
+
readonly default?: ConstantSubExpression;
|
|
16
|
+
constructor(init: HasInit);
|
|
17
|
+
parameter(): Parameter;
|
|
18
|
+
}
|
|
19
|
+
export {};
|