@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,10 @@
|
|
|
1
|
+
import { QueryFieldDef } from "../../../model/malloy_types";
|
|
2
|
+
import { FieldType } from "../types/field-type";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
|
+
import { SpaceField } from "../types/space-field";
|
|
5
|
+
export declare class WildSpaceField extends SpaceField {
|
|
6
|
+
readonly wildText: string;
|
|
7
|
+
constructor(wildText: string);
|
|
8
|
+
type(): FieldType;
|
|
9
|
+
getQueryFieldDef(_fs: FieldSpace): QueryFieldDef;
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.WildSpaceField = void 0;
|
|
26
|
+
const space_field_1 = require("../types/space-field");
|
|
27
|
+
class WildSpaceField extends space_field_1.SpaceField {
|
|
28
|
+
constructor(wildText) {
|
|
29
|
+
super();
|
|
30
|
+
this.wildText = wildText;
|
|
31
|
+
}
|
|
32
|
+
type() {
|
|
33
|
+
throw new Error("should never ask a wild field for its type");
|
|
34
|
+
}
|
|
35
|
+
getQueryFieldDef(_fs) {
|
|
36
|
+
return this.wildText;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.WildSpaceField = WildSpaceField;
|
|
40
|
+
//# sourceMappingURL=wild-space-field.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Parameter } from "../../../model/malloy_types";
|
|
2
|
+
import { FieldType } from "../types/field-type";
|
|
3
|
+
import { HasParameter } from "../parameters/has-parameter";
|
|
4
|
+
import { SpaceParam } from "../types/space-param";
|
|
5
|
+
export declare class AbstractParameter extends SpaceParam {
|
|
6
|
+
readonly astParam: HasParameter;
|
|
7
|
+
constructor(astParam: HasParameter);
|
|
8
|
+
parameter(): Parameter;
|
|
9
|
+
type(): FieldType;
|
|
10
|
+
}
|
|
@@ -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.AbstractParameter = void 0;
|
|
26
|
+
const space_param_1 = require("../types/space-param");
|
|
27
|
+
class AbstractParameter extends space_param_1.SpaceParam {
|
|
28
|
+
constructor(astParam) {
|
|
29
|
+
super();
|
|
30
|
+
this.astParam = astParam;
|
|
31
|
+
}
|
|
32
|
+
parameter() {
|
|
33
|
+
return this.astParam.parameter();
|
|
34
|
+
}
|
|
35
|
+
type() {
|
|
36
|
+
const type = this.astParam.type || "unknown";
|
|
37
|
+
return { type };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.AbstractParameter = AbstractParameter;
|
|
41
|
+
//# sourceMappingURL=abstract-parameter.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Parameter } from "../../../model/malloy_types";
|
|
2
|
+
import { FieldType } from "../types/field-type";
|
|
3
|
+
import { SpaceParam } from "../types/space-param";
|
|
4
|
+
export declare class DefinedParameter extends SpaceParam {
|
|
5
|
+
readonly paramDef: Parameter;
|
|
6
|
+
constructor(paramDef: Parameter);
|
|
7
|
+
parameter(): Parameter;
|
|
8
|
+
type(): FieldType;
|
|
9
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.DefinedParameter = void 0;
|
|
26
|
+
const space_param_1 = require("../types/space-param");
|
|
27
|
+
class DefinedParameter extends space_param_1.SpaceParam {
|
|
28
|
+
constructor(paramDef) {
|
|
29
|
+
super();
|
|
30
|
+
this.paramDef = paramDef;
|
|
31
|
+
}
|
|
32
|
+
parameter() {
|
|
33
|
+
return this.paramDef;
|
|
34
|
+
}
|
|
35
|
+
type() {
|
|
36
|
+
return { type: this.paramDef.type };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.DefinedParameter = DefinedParameter;
|
|
40
|
+
//# sourceMappingURL=defined-parameter.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StructDef } from "../../model/malloy_types";
|
|
2
|
+
import { FieldSpace, SourceSpec } from "./types/field-space";
|
|
3
|
+
/**
|
|
4
|
+
* Based on how things are constructed, the starting field space
|
|
5
|
+
* can either be another field space or an existing structdef.
|
|
6
|
+
* Using a SpaceSeed allows a class to accept either one
|
|
7
|
+
* and use either version at some future time.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SpaceSeed {
|
|
10
|
+
readonly sourceSpec: SourceSpec;
|
|
11
|
+
private spaceSpec;
|
|
12
|
+
private asFS?;
|
|
13
|
+
private asStruct?;
|
|
14
|
+
constructor(sourceSpec: SourceSpec);
|
|
15
|
+
get structDef(): StructDef;
|
|
16
|
+
get fieldSpace(): FieldSpace;
|
|
17
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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.SpaceSeed = void 0;
|
|
26
|
+
const field_space_1 = require("./types/field-space");
|
|
27
|
+
const static_space_1 = require("./static-space");
|
|
28
|
+
/**
|
|
29
|
+
* Based on how things are constructed, the starting field space
|
|
30
|
+
* can either be another field space or an existing structdef.
|
|
31
|
+
* Using a SpaceSeed allows a class to accept either one
|
|
32
|
+
* and use either version at some future time.
|
|
33
|
+
*/
|
|
34
|
+
class SpaceSeed {
|
|
35
|
+
constructor(sourceSpec) {
|
|
36
|
+
this.sourceSpec = sourceSpec;
|
|
37
|
+
this.spaceSpec = sourceSpec;
|
|
38
|
+
}
|
|
39
|
+
get structDef() {
|
|
40
|
+
if ((0, field_space_1.isFieldSpace)(this.spaceSpec)) {
|
|
41
|
+
if (!this.asStruct) {
|
|
42
|
+
this.asStruct = this.spaceSpec.structDef();
|
|
43
|
+
}
|
|
44
|
+
return this.asStruct;
|
|
45
|
+
}
|
|
46
|
+
return this.spaceSpec;
|
|
47
|
+
}
|
|
48
|
+
get fieldSpace() {
|
|
49
|
+
if ((0, field_space_1.isFieldSpace)(this.spaceSpec)) {
|
|
50
|
+
return this.spaceSpec;
|
|
51
|
+
}
|
|
52
|
+
if (!this.asFS) {
|
|
53
|
+
this.asFS = new static_space_1.StaticSpace(this.spaceSpec);
|
|
54
|
+
}
|
|
55
|
+
return this.asFS;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.SpaceSeed = SpaceSeed;
|
|
59
|
+
//# sourceMappingURL=space-seed.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SQLBlockSource } from "../../../model/malloy_types";
|
|
2
|
+
import { ModelDataRequest } from "../../parse-malloy";
|
|
3
|
+
import { DocStatement, Document, MalloyElement } from "../types/malloy-element";
|
|
4
|
+
import { SQLString } from "./sql-string";
|
|
5
|
+
export declare class SQLStatement extends MalloyElement implements DocStatement {
|
|
6
|
+
readonly select: SQLString;
|
|
7
|
+
elementType: string;
|
|
8
|
+
is?: string;
|
|
9
|
+
connection?: string;
|
|
10
|
+
requestBlock?: SQLBlockSource;
|
|
11
|
+
constructor(select: SQLString);
|
|
12
|
+
sqlBlock(): SQLBlockSource;
|
|
13
|
+
/**
|
|
14
|
+
* This is the one statement which pauses execution. First time through
|
|
15
|
+
* it will generate a schema request, next time through it will either
|
|
16
|
+
* record the error or record the schema.
|
|
17
|
+
*/
|
|
18
|
+
execute(doc: Document): ModelDataRequest;
|
|
19
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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.SQLStatement = void 0;
|
|
26
|
+
const sql_block_1 = require("../../../model/sql_block");
|
|
27
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
28
|
+
class SQLStatement extends malloy_element_1.MalloyElement {
|
|
29
|
+
constructor(select) {
|
|
30
|
+
super();
|
|
31
|
+
this.select = select;
|
|
32
|
+
this.elementType = "sqlStatement";
|
|
33
|
+
this.has({ select });
|
|
34
|
+
}
|
|
35
|
+
sqlBlock() {
|
|
36
|
+
if (!this.requestBlock) {
|
|
37
|
+
this.requestBlock = (0, sql_block_1.makeSQLBlock)(this.select.sqlPhrases(), this.connection);
|
|
38
|
+
}
|
|
39
|
+
return this.requestBlock;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This is the one statement which pauses execution. First time through
|
|
43
|
+
* it will generate a schema request, next time through it will either
|
|
44
|
+
* record the error or record the schema.
|
|
45
|
+
*/
|
|
46
|
+
execute(doc) {
|
|
47
|
+
var _a;
|
|
48
|
+
const sqlDefEntry = (_a = this.translator()) === null || _a === void 0 ? void 0 : _a.root.sqlQueryZone;
|
|
49
|
+
if (!sqlDefEntry) {
|
|
50
|
+
this.log("Cant't look up schema for sql block");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const sql = this.sqlBlock();
|
|
54
|
+
sqlDefEntry.reference(sql.name, this.location);
|
|
55
|
+
const lookup = sqlDefEntry.getEntry(sql.name);
|
|
56
|
+
if (lookup.status == "error") {
|
|
57
|
+
const msgLines = lookup.message.split(/\r?\n/);
|
|
58
|
+
this.select.log("Invalid SQL, " + msgLines.join("\n "));
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
if (lookup.status == "present") {
|
|
62
|
+
const location = this.select.location;
|
|
63
|
+
const locStruct = {
|
|
64
|
+
...lookup.value,
|
|
65
|
+
fields: lookup.value.fields.map((f) => ({ ...f, location })),
|
|
66
|
+
location: this.location,
|
|
67
|
+
};
|
|
68
|
+
if (this.is && !doc.defineSQL(locStruct, this.is)) {
|
|
69
|
+
this.log(`'${this.is}' already defined`);
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
compileSQL: sql,
|
|
75
|
+
partialModel: this.select.containsQueries ? doc.modelDef() : undefined,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.SQLStatement = SQLStatement;
|
|
80
|
+
//# sourceMappingURL=sql-statement.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SQLPhrase } from "../../../model/malloy_types";
|
|
2
|
+
import { QueryElement } from "../types/query-element";
|
|
3
|
+
import { MalloyElement } from "../types/malloy-element";
|
|
4
|
+
declare type SQLStringSegment = string | QueryElement;
|
|
5
|
+
export declare class SQLString extends MalloyElement {
|
|
6
|
+
elementType: string;
|
|
7
|
+
elements: SQLStringSegment[];
|
|
8
|
+
containsQueries: boolean;
|
|
9
|
+
push(el: string | MalloyElement): void;
|
|
10
|
+
sqlPhrases(): SQLPhrase[];
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
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.SQLString = void 0;
|
|
26
|
+
const query_element_1 = require("../types/query-element");
|
|
27
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
28
|
+
class SQLString extends malloy_element_1.MalloyElement {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.elementType = "sqlString";
|
|
32
|
+
this.elements = [];
|
|
33
|
+
this.containsQueries = false;
|
|
34
|
+
}
|
|
35
|
+
push(el) {
|
|
36
|
+
if (typeof el == "string") {
|
|
37
|
+
if (el.length > 0) {
|
|
38
|
+
this.elements.push(el);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if ((0, query_element_1.isQueryElement)(el)) {
|
|
42
|
+
this.elements.push(el);
|
|
43
|
+
this.containsQueries = true;
|
|
44
|
+
el.parent = this;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
el.log("This element is not legal inside an SQL string");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
sqlPhrases() {
|
|
51
|
+
return this.elements.map((el) => {
|
|
52
|
+
if (typeof el == "string") {
|
|
53
|
+
return { sql: el };
|
|
54
|
+
}
|
|
55
|
+
return el.query();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.SQLString = SQLString;
|
|
60
|
+
//# sourceMappingURL=sql-string.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Dialect } from "../../dialect/dialect";
|
|
2
|
+
import { FieldDef, StructDef } from "../../model/malloy_types";
|
|
3
|
+
import { SpaceEntry } from "./types/space-entry";
|
|
4
|
+
import { LookupResult } from "./types/lookup-result";
|
|
5
|
+
import { FieldName, FieldSpace } from "./types/field-space";
|
|
6
|
+
import { FieldType } from "./types/field-type";
|
|
7
|
+
import { SpaceField } from "./types/space-field";
|
|
8
|
+
export declare class StructSpaceField extends SpaceField {
|
|
9
|
+
protected sourceDef: StructDef;
|
|
10
|
+
protected space?: FieldSpace;
|
|
11
|
+
constructor(sourceDef: StructDef);
|
|
12
|
+
get fieldSpace(): FieldSpace;
|
|
13
|
+
fieldDef(): FieldDef;
|
|
14
|
+
type(): FieldType;
|
|
15
|
+
}
|
|
16
|
+
export declare class StaticSpace implements FieldSpace {
|
|
17
|
+
readonly type = "fieldSpace";
|
|
18
|
+
private memoMap?;
|
|
19
|
+
protected fromStruct: StructDef;
|
|
20
|
+
constructor(sourceStructDef: StructDef);
|
|
21
|
+
whenComplete(step: () => void): void;
|
|
22
|
+
dialectObj(): Dialect | undefined;
|
|
23
|
+
fromFieldDef(from: FieldDef): SpaceField;
|
|
24
|
+
private get map();
|
|
25
|
+
protected dropEntries(): void;
|
|
26
|
+
protected dropEntry(name: string): void;
|
|
27
|
+
protected entry(name: string): SpaceEntry | undefined;
|
|
28
|
+
protected setEntry(name: string, value: SpaceEntry): void;
|
|
29
|
+
protected entries(): [string, SpaceEntry][];
|
|
30
|
+
structDef(): StructDef;
|
|
31
|
+
emptyStructDef(): StructDef;
|
|
32
|
+
lookup(path: FieldName[]): LookupResult;
|
|
33
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
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.StaticSpace = exports.StructSpaceField = void 0;
|
|
26
|
+
const dialect_map_1 = require("../../dialect/dialect_map");
|
|
27
|
+
const malloy_types_1 = require("../../model/malloy_types");
|
|
28
|
+
const column_space_field_1 = require("./space-fields/column-space-field");
|
|
29
|
+
const query_field_struct_1 = require("./space-fields/query-field-struct");
|
|
30
|
+
const defined_parameter_1 = require("./space-parameters/defined-parameter");
|
|
31
|
+
const space_field_1 = require("./types/space-field");
|
|
32
|
+
// TODO(maden): These two classes are intertwined, we may want to look into decoupling them.
|
|
33
|
+
class StructSpaceField extends space_field_1.SpaceField {
|
|
34
|
+
constructor(sourceDef) {
|
|
35
|
+
super();
|
|
36
|
+
this.sourceDef = sourceDef;
|
|
37
|
+
}
|
|
38
|
+
get fieldSpace() {
|
|
39
|
+
if (!this.space) {
|
|
40
|
+
this.space = new StaticSpace(this.sourceDef);
|
|
41
|
+
}
|
|
42
|
+
return this.space;
|
|
43
|
+
}
|
|
44
|
+
fieldDef() {
|
|
45
|
+
return this.sourceDef;
|
|
46
|
+
}
|
|
47
|
+
type() {
|
|
48
|
+
return { type: "struct" };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.StructSpaceField = StructSpaceField;
|
|
52
|
+
class StaticSpace {
|
|
53
|
+
constructor(sourceStructDef) {
|
|
54
|
+
this.type = "fieldSpace";
|
|
55
|
+
this.fromStruct = sourceStructDef;
|
|
56
|
+
}
|
|
57
|
+
whenComplete(step) {
|
|
58
|
+
step();
|
|
59
|
+
}
|
|
60
|
+
dialectObj() {
|
|
61
|
+
try {
|
|
62
|
+
return (0, dialect_map_1.getDialect)(this.fromStruct.dialect);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
fromFieldDef(from) {
|
|
69
|
+
if (from.type === "struct") {
|
|
70
|
+
return new StructSpaceField(from);
|
|
71
|
+
}
|
|
72
|
+
else if ((0, malloy_types_1.isTurtleDef)(from)) {
|
|
73
|
+
return new query_field_struct_1.QueryFieldStruct(this, from);
|
|
74
|
+
}
|
|
75
|
+
// TODO field has a filter and needs to be a filteredalias
|
|
76
|
+
return new column_space_field_1.ColumnSpaceField(from);
|
|
77
|
+
}
|
|
78
|
+
get map() {
|
|
79
|
+
if (this.memoMap === undefined) {
|
|
80
|
+
this.memoMap = {};
|
|
81
|
+
for (const f of this.fromStruct.fields) {
|
|
82
|
+
const name = f.as || f.name;
|
|
83
|
+
this.memoMap[name] = this.fromFieldDef(f);
|
|
84
|
+
}
|
|
85
|
+
if (this.fromStruct.parameters) {
|
|
86
|
+
for (const [paramName, paramDef] of Object.entries(this.fromStruct.parameters)) {
|
|
87
|
+
if (this.memoMap[paramName]) {
|
|
88
|
+
throw new Error(`In struct '${this.fromStruct.as || this.fromStruct.name}': ` +
|
|
89
|
+
` : Field and parameter name conflict '${paramName}`);
|
|
90
|
+
}
|
|
91
|
+
this.memoMap[paramName] = new defined_parameter_1.DefinedParameter(paramDef);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return this.memoMap;
|
|
96
|
+
}
|
|
97
|
+
dropEntries() {
|
|
98
|
+
this.memoMap = {};
|
|
99
|
+
}
|
|
100
|
+
dropEntry(name) {
|
|
101
|
+
delete this.map[name];
|
|
102
|
+
}
|
|
103
|
+
entry(name) {
|
|
104
|
+
return this.map[name];
|
|
105
|
+
}
|
|
106
|
+
setEntry(name, value) {
|
|
107
|
+
this.map[name] = value;
|
|
108
|
+
}
|
|
109
|
+
entries() {
|
|
110
|
+
return Object.entries(this.map);
|
|
111
|
+
}
|
|
112
|
+
structDef() {
|
|
113
|
+
return this.fromStruct;
|
|
114
|
+
}
|
|
115
|
+
emptyStructDef() {
|
|
116
|
+
return { ...this.fromStruct, fields: [] };
|
|
117
|
+
}
|
|
118
|
+
lookup(path) {
|
|
119
|
+
const head = path[0];
|
|
120
|
+
const rest = path.slice(1);
|
|
121
|
+
const found = this.entry(head.refString);
|
|
122
|
+
if (!found) {
|
|
123
|
+
return { error: `'${head}' is not defined`, found };
|
|
124
|
+
}
|
|
125
|
+
if (found instanceof space_field_1.SpaceField) {
|
|
126
|
+
/*
|
|
127
|
+
* TODO cache defs, post the addReference call to whenComplete
|
|
128
|
+
*
|
|
129
|
+
* In the cleanup phase of query space construction, it may check
|
|
130
|
+
* the output space for ungrouping variables. However if an
|
|
131
|
+
* ungrouping variable is a measure, the field expression value
|
|
132
|
+
* needed to get the definition needs to be computed in the
|
|
133
|
+
* input space of the query. There is a test which failed which
|
|
134
|
+
* caused this code to be here, but this is really a bandaid.
|
|
135
|
+
*
|
|
136
|
+
* Some re-work of how to get the definition of a SpaceField
|
|
137
|
+
* no matter what it is contained in needs to be thought out.
|
|
138
|
+
*
|
|
139
|
+
* ... or this check would look at the finalized output of
|
|
140
|
+
* the namespace and not re-compile ...
|
|
141
|
+
*/
|
|
142
|
+
const definition = found.fieldDef();
|
|
143
|
+
if (definition) {
|
|
144
|
+
head.addReference({
|
|
145
|
+
type: found instanceof StructSpaceField
|
|
146
|
+
? "joinReference"
|
|
147
|
+
: "fieldReference",
|
|
148
|
+
definition,
|
|
149
|
+
location: head.location,
|
|
150
|
+
text: head.refString,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (rest.length) {
|
|
155
|
+
if (found instanceof StructSpaceField) {
|
|
156
|
+
return found.fieldSpace.lookup(rest);
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
error: `'${head}' cannot contain a '${rest[0]}'`,
|
|
160
|
+
found: undefined,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
return { found, error: undefined };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.StaticSpace = StaticSpace;
|
|
167
|
+
//# sourceMappingURL=static-space.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FieldDef, PipeSegment, StructDef } from "../../model/malloy_types";
|
|
2
|
+
import { MalloyElement } from "./types/malloy-element";
|
|
3
|
+
export declare function opOutputStruct(logTo: MalloyElement, inputStruct: StructDef, opDesc: PipeSegment): StructDef;
|
|
4
|
+
export declare function getStructFieldDef(s: StructDef, fn: string): FieldDef | undefined;
|
|
@@ -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.getStructFieldDef = exports.opOutputStruct = void 0;
|
|
26
|
+
const util_1 = require("util");
|
|
27
|
+
const malloy_query_1 = require("../../model/malloy_query");
|
|
28
|
+
const error_factory_1 = require("./error-factory");
|
|
29
|
+
function opOutputStruct(logTo, inputStruct, opDesc) {
|
|
30
|
+
const badModel = error_factory_1.ErrorFactory.isErrorStructDef(inputStruct);
|
|
31
|
+
// Don't call into the model code with a broken model
|
|
32
|
+
if (!badModel) {
|
|
33
|
+
try {
|
|
34
|
+
return malloy_query_1.Segment.nextStructDef(inputStruct, opDesc);
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
logTo.log(`INTERNAL ERROR model/Segment.nextStructDef: ${e.message}\n` +
|
|
38
|
+
`QUERY: ${(0, util_1.inspect)(opDesc, { breakLength: 72, depth: Infinity })}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { ...error_factory_1.ErrorFactory.structDef, dialect: inputStruct.dialect };
|
|
42
|
+
}
|
|
43
|
+
exports.opOutputStruct = opOutputStruct;
|
|
44
|
+
function getStructFieldDef(s, fn) {
|
|
45
|
+
return s.fields.find((fld) => (fld.as || fld.name) === fn);
|
|
46
|
+
}
|
|
47
|
+
exports.getStructFieldDef = getStructFieldDef;
|
|
48
|
+
//# sourceMappingURL=struct-utils.js.map
|