@malloydata/malloy 0.0.22-dev230207144036 → 0.0.22-dev230207180844
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/connection_utils.d.ts +1 -0
- package/dist/connection_utils.js +66 -0
- package/dist/dialect/dialect.d.ts +66 -0
- package/dist/dialect/dialect.js +85 -0
- package/dist/dialect/dialect_map.d.ts +3 -0
- package/dist/dialect/dialect_map.js +45 -0
- package/dist/dialect/duckdb.d.ts +52 -0
- package/dist/dialect/duckdb.js +364 -0
- package/dist/dialect/index.d.ts +6 -0
- package/dist/dialect/index.js +37 -0
- package/dist/dialect/postgres.d.ts +52 -0
- package/dist/dialect/postgres.js +330 -0
- package/dist/dialect/standardsql.d.ts +49 -0
- package/dist/dialect/standardsql.js +381 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +59 -0
- 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-query.d.ts +14 -0
- package/dist/lang/ast/elements/define-query.js +56 -0
- package/dist/lang/ast/elements/define-source.d.ts +17 -0
- package/dist/lang/ast/elements/define-source.js +79 -0
- package/dist/lang/ast/elements/import-statement.d.ts +9 -0
- package/dist/lang/ast/elements/import-statement.js +78 -0
- package/dist/lang/ast/elements/pipeline-desc.d.ts +30 -0
- package/dist/lang/ast/elements/pipeline-desc.js +102 -0
- package/dist/lang/ast/elements/refined-source.d.ts +15 -0
- package/dist/lang/ast/elements/refined-source.js +121 -0
- package/dist/lang/ast/elements/source.d.ts +12 -0
- package/dist/lang/ast/elements/source.js +53 -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 +21 -0
- package/dist/lang/ast/executors/reduce-executor.js +149 -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-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 +58 -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 +75 -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 +12 -0
- package/dist/lang/ast/expressions/utils.js +87 -0
- package/dist/lang/ast/field-space/column-space-field.d.ts +9 -0
- package/dist/lang/ast/field-space/column-space-field.js +40 -0
- package/dist/lang/ast/field-space/dynamic-space.d.ts +22 -0
- package/dist/lang/ast/field-space/dynamic-space.js +140 -0
- package/dist/lang/ast/field-space/field-definition-value.d.ts +16 -0
- package/dist/lang/ast/field-space/field-definition-value.js +55 -0
- package/dist/lang/ast/field-space/index-field-space.d.ts +10 -0
- package/dist/lang/ast/field-space/index-field-space.js +57 -0
- package/dist/lang/ast/field-space/join-space-field.d.ts +8 -0
- package/dist/lang/ast/field-space/join-space-field.js +35 -0
- package/dist/lang/ast/field-space/project-field-space.d.ts +6 -0
- package/dist/lang/ast/field-space/project-field-space.js +51 -0
- package/dist/lang/ast/field-space/query-field-struct.d.ts +10 -0
- package/dist/lang/ast/field-space/query-field-struct.js +46 -0
- package/dist/lang/ast/field-space/query-space-field.d.ts +11 -0
- package/dist/lang/ast/field-space/query-space-field.js +37 -0
- package/dist/lang/ast/field-space/query-spaces.d.ts +50 -0
- package/dist/lang/ast/field-space/query-spaces.js +233 -0
- package/dist/lang/ast/field-space/reference-field.d.ts +11 -0
- package/dist/lang/ast/field-space/reference-field.js +45 -0
- package/dist/lang/ast/field-space/refined-space.d.ts +13 -0
- package/dist/lang/ast/field-space/refined-space.js +100 -0
- package/dist/lang/ast/field-space/rename-space-field.d.ts +11 -0
- package/dist/lang/ast/field-space/rename-space-field.js +50 -0
- package/dist/lang/ast/field-space/static-space.d.ts +29 -0
- package/dist/lang/ast/field-space/static-space.js +156 -0
- package/dist/lang/ast/field-space/struct-space-field-base.d.ts +11 -0
- package/dist/lang/ast/field-space/struct-space-field-base.js +40 -0
- package/dist/lang/ast/field-space/wild-space-field.d.ts +10 -0
- package/dist/lang/ast/field-space/wild-space-field.js +40 -0
- package/dist/lang/ast/fragtype-utils.d.ts +39 -0
- package/dist/lang/ast/fragtype-utils.js +100 -0
- package/dist/lang/ast/index.d.ts +90 -0
- package/dist/lang/ast/index.js +129 -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/nest-reference.d.ts +7 -0
- package/dist/lang/ast/query-properties/nest-reference.js +35 -0
- package/dist/lang/ast/query-properties/nest.d.ts +31 -0
- package/dist/lang/ast/query-properties/nest.js +133 -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 +124 -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/source-properties/field-list-edit.d.ts +8 -0
- package/dist/lang/ast/source-properties/field-list-edit.js +36 -0
- package/dist/lang/ast/source-properties/primary-key.d.ts +7 -0
- package/dist/lang/ast/source-properties/primary-key.js +35 -0
- package/dist/lang/ast/source-properties/renames.d.ts +11 -0
- package/dist/lang/ast/source-properties/renames.js +43 -0
- package/dist/lang/ast/source-properties/turtles.d.ts +5 -0
- package/dist/lang/ast/source-properties/turtles.js +33 -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-seed.d.ts +16 -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/struct-utils.d.ts +4 -0
- package/dist/lang/ast/struct-utils.js +48 -0
- package/dist/lang/ast/time-utils.d.ts +12 -0
- package/dist/lang/ast/time-utils.js +140 -0
- package/dist/lang/ast/types/comparison.d.ts +11 -0
- package/dist/lang/ast/types/comparison.js +41 -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/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/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-space.d.ts +24 -0
- package/dist/lang/ast/types/field-space.js +44 -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 +106 -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/source-property.d.ts +10 -0
- package/dist/lang/ast/types/source-property.js +43 -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 +20 -0
- package/dist/lang/ast/types/space-param.js +61 -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/ast/types/type-desc.d.ts +7 -0
- package/dist/lang/ast/types/type-desc.js +25 -0
- package/dist/lang/field-utils.d.ts +5 -0
- package/dist/lang/field-utils.js +43 -0
- package/dist/lang/index.d.ts +10 -0
- package/dist/lang/index.js +32 -0
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +165 -0
- package/dist/lang/lib/Malloy/MalloyLexer.js +1232 -0
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +1947 -0
- package/dist/lang/lib/Malloy/MalloyParser.js +11909 -0
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +2022 -0
- package/dist/lang/lib/Malloy/MalloyParserListener.js +4 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +1274 -0
- package/dist/lang/lib/Malloy/MalloyParserVisitor.js +4 -0
- package/dist/lang/malloy-to-ast.d.ts +155 -0
- package/dist/lang/malloy-to-ast.js +990 -0
- package/dist/lang/parse-error-handler.d.ts +9 -0
- package/dist/lang/parse-error-handler.js +44 -0
- package/dist/lang/parse-log.d.ts +27 -0
- package/dist/lang/parse-log.js +51 -0
- package/dist/lang/parse-malloy.d.ts +182 -0
- package/dist/lang/parse-malloy.js +728 -0
- package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +10 -0
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +148 -0
- package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +9 -0
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +107 -0
- package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +83 -0
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +385 -0
- package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +11 -0
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +182 -0
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +34 -0
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +74 -0
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +11 -0
- package/dist/lang/parse-tree-walkers/find-external-references.js +61 -0
- package/dist/lang/reference-list.d.ts +10 -0
- package/dist/lang/reference-list.js +90 -0
- package/dist/lang/test/document-help-context-walker.spec.d.ts +1 -0
- package/dist/lang/test/document-help-context-walker.spec.js +55 -0
- package/dist/lang/test/document-symbol-walker.spec.d.ts +1 -0
- package/dist/lang/test/document-symbol-walker.spec.js +110 -0
- package/dist/lang/test/field-symbols.spec.d.ts +1 -0
- package/dist/lang/test/field-symbols.spec.js +184 -0
- package/dist/lang/test/parse.spec.d.ts +14 -0
- package/dist/lang/test/parse.spec.js +2135 -0
- package/dist/lang/test/test-translator.d.ts +41 -0
- package/dist/lang/test/test-translator.js +344 -0
- package/dist/lang/translate-response.d.ts +59 -0
- package/dist/lang/translate-response.js +30 -0
- package/dist/lang/zone.d.ts +57 -0
- package/dist/lang/zone.js +107 -0
- package/dist/malloy.d.ts +1146 -0
- package/dist/malloy.js +2413 -0
- package/dist/model/index.d.ts +2 -0
- package/dist/model/index.js +45 -0
- package/dist/model/malloy_query.d.ts +351 -0
- package/dist/model/malloy_query.js +3174 -0
- package/dist/model/malloy_types.d.ts +551 -0
- package/dist/model/malloy_types.js +378 -0
- package/dist/model/sql_block.d.ts +7 -0
- package/dist/model/sql_block.js +56 -0
- package/dist/model/utils.d.ts +22 -0
- package/dist/model/utils.js +102 -0
- package/dist/run_sql_options.d.ts +3 -0
- package/dist/run_sql_options.js +25 -0
- package/dist/runtime_types.d.ts +105 -0
- package/dist/runtime_types.js +25 -0
- package/package.json +2 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as model from "../../../model/malloy_types";
|
|
2
|
+
import { FieldDeclaration } from "../query-items/field-declaration";
|
|
3
|
+
import { FieldName, FieldSpace } from "../types/field-space";
|
|
4
|
+
import { MalloyElement } from "../types/malloy-element";
|
|
5
|
+
import { Join } from "../query-properties/joins";
|
|
6
|
+
import { SourceSpec } from "../space-seed";
|
|
7
|
+
import { FieldReference, WildcardFieldReference } from "../query-items/field-references";
|
|
8
|
+
import { FieldCollectionMember } from "../types/field-collection-member";
|
|
9
|
+
import { QueryItem } from "../types/query-item";
|
|
10
|
+
import { RefinedSpace } from "./refined-space";
|
|
11
|
+
/**
|
|
12
|
+
* Unlike a source, which is a refinement of a namespace, a query
|
|
13
|
+
* is creating a new unrelated namespace. The query starts with a
|
|
14
|
+
* source, which it might modify. This set of fields used to resolve
|
|
15
|
+
* expressions in the query is called the "input space". There is a
|
|
16
|
+
* specialized QuerySpace for each type of query operation.
|
|
17
|
+
*/
|
|
18
|
+
export declare class QueryInputSpace extends RefinedSpace {
|
|
19
|
+
readonly result: QuerySpace;
|
|
20
|
+
nestParent?: QueryInputSpace;
|
|
21
|
+
extendList: string[];
|
|
22
|
+
constructor(input: SourceSpec, result: QuerySpace);
|
|
23
|
+
extendSource(extendField: Join | FieldDeclaration): void;
|
|
24
|
+
}
|
|
25
|
+
export declare abstract class QuerySpace extends RefinedSpace {
|
|
26
|
+
readonly queryInputSpace: FieldSpace;
|
|
27
|
+
readonly exprSpace: QueryInputSpace;
|
|
28
|
+
astEl?: MalloyElement | undefined;
|
|
29
|
+
abstract readonly segmentType: "reduce" | "project" | "index";
|
|
30
|
+
constructor(queryInputSpace: FieldSpace);
|
|
31
|
+
log(s: string): void;
|
|
32
|
+
addMembers(members: FieldCollectionMember[]): void;
|
|
33
|
+
addReference(ref: FieldReference): void;
|
|
34
|
+
addWild(wild: WildcardFieldReference): void;
|
|
35
|
+
/**
|
|
36
|
+
* Check for the definition of an ungrouping reference in the result space,
|
|
37
|
+
* or in the case of an exclude reference, if this query is nested
|
|
38
|
+
* in another query, in the result space of a query that this query
|
|
39
|
+
* is nested inside of.
|
|
40
|
+
*/
|
|
41
|
+
checkUngroup(fn: FieldName, isExclude: boolean): void;
|
|
42
|
+
addQueryItems(...qiList: QueryItem[]): void;
|
|
43
|
+
canContain(_qd: model.QueryFieldDef): boolean;
|
|
44
|
+
protected queryFieldDefs(): model.QueryFieldDef[];
|
|
45
|
+
getQuerySegment(rf: model.QuerySegment | undefined): model.QuerySegment;
|
|
46
|
+
getPipeSegment(refineFrom: model.QuerySegment | undefined): model.PipeSegment;
|
|
47
|
+
}
|
|
48
|
+
export declare class ReduceFieldSpace extends QuerySpace {
|
|
49
|
+
readonly segmentType = "reduce";
|
|
50
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
25
|
+
if (k2 === undefined) k2 = k;
|
|
26
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
27
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
28
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
29
|
+
}
|
|
30
|
+
Object.defineProperty(o, k2, desc);
|
|
31
|
+
}) : (function(o, m, k, k2) {
|
|
32
|
+
if (k2 === undefined) k2 = k;
|
|
33
|
+
o[k2] = m[k];
|
|
34
|
+
}));
|
|
35
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
36
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
37
|
+
}) : function(o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.ReduceFieldSpace = exports.QuerySpace = exports.QueryInputSpace = void 0;
|
|
49
|
+
const model = __importStar(require("../../../model/malloy_types"));
|
|
50
|
+
const field_utils_1 = require("../../field-utils");
|
|
51
|
+
const field_declaration_1 = require("../query-items/field-declaration");
|
|
52
|
+
const joins_1 = require("../query-properties/joins");
|
|
53
|
+
const space_field_1 = require("../types/space-field");
|
|
54
|
+
const space_seed_1 = require("../space-seed");
|
|
55
|
+
const nest_1 = require("../query-properties/nest");
|
|
56
|
+
const nest_reference_1 = require("../query-properties/nest-reference");
|
|
57
|
+
const field_references_1 = require("../query-items/field-references");
|
|
58
|
+
const reference_field_1 = require("./reference-field");
|
|
59
|
+
const wild_space_field_1 = require("./wild-space-field");
|
|
60
|
+
const refined_space_1 = require("./refined-space");
|
|
61
|
+
/**
|
|
62
|
+
* Unlike a source, which is a refinement of a namespace, a query
|
|
63
|
+
* is creating a new unrelated namespace. The query starts with a
|
|
64
|
+
* source, which it might modify. This set of fields used to resolve
|
|
65
|
+
* expressions in the query is called the "input space". There is a
|
|
66
|
+
* specialized QuerySpace for each type of query operation.
|
|
67
|
+
*/
|
|
68
|
+
class QueryInputSpace extends refined_space_1.RefinedSpace {
|
|
69
|
+
constructor(input, result) {
|
|
70
|
+
const inputSpace = new space_seed_1.SpaceSeed(input);
|
|
71
|
+
super(inputSpace.structDef);
|
|
72
|
+
this.result = result;
|
|
73
|
+
this.extendList = [];
|
|
74
|
+
}
|
|
75
|
+
extendSource(extendField) {
|
|
76
|
+
this.addField(extendField);
|
|
77
|
+
if (extendField instanceof joins_1.Join) {
|
|
78
|
+
this.extendList.push(extendField.name.refString);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this.extendList.push(extendField.defineName);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.QueryInputSpace = QueryInputSpace;
|
|
86
|
+
class QuerySpace extends refined_space_1.RefinedSpace {
|
|
87
|
+
constructor(queryInputSpace) {
|
|
88
|
+
super(queryInputSpace.emptyStructDef());
|
|
89
|
+
this.queryInputSpace = queryInputSpace;
|
|
90
|
+
this.exprSpace = new QueryInputSpace(queryInputSpace, this);
|
|
91
|
+
}
|
|
92
|
+
log(s) {
|
|
93
|
+
if (this.astEl) {
|
|
94
|
+
this.astEl.log(s);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
addMembers(members) {
|
|
98
|
+
for (const member of members) {
|
|
99
|
+
if (member instanceof field_references_1.FieldReference) {
|
|
100
|
+
this.addReference(member);
|
|
101
|
+
}
|
|
102
|
+
else if (member instanceof field_references_1.WildcardFieldReference) {
|
|
103
|
+
this.addWild(member);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.addField(member);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
addReference(ref) {
|
|
111
|
+
const refName = ref.outputName;
|
|
112
|
+
if (this.entry(refName)) {
|
|
113
|
+
ref.log(`Output already has a field named '${refName}'`);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.setEntry(refName, new reference_field_1.ReferenceField(ref));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
addWild(wild) {
|
|
120
|
+
this.setEntry(wild.refString, new wild_space_field_1.WildSpaceField(wild.refString));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Check for the definition of an ungrouping reference in the result space,
|
|
124
|
+
* or in the case of an exclude reference, if this query is nested
|
|
125
|
+
* in another query, in the result space of a query that this query
|
|
126
|
+
* is nested inside of.
|
|
127
|
+
*/
|
|
128
|
+
checkUngroup(fn, isExclude) {
|
|
129
|
+
if (!this.entry(fn.refString)) {
|
|
130
|
+
if (isExclude && this.exprSpace.nestParent) {
|
|
131
|
+
const parent = this.exprSpace.nestParent;
|
|
132
|
+
parent.whenComplete(() => {
|
|
133
|
+
parent.result.checkUngroup(fn, isExclude);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const uName = isExclude ? "exclude()" : "all()";
|
|
138
|
+
fn.log(`${uName} '${fn.refString}' is missing from query output`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
addQueryItems(...qiList) {
|
|
143
|
+
for (const qi of qiList) {
|
|
144
|
+
if (qi instanceof field_references_1.FieldReference || qi instanceof nest_reference_1.NestReference) {
|
|
145
|
+
this.addReference(qi);
|
|
146
|
+
}
|
|
147
|
+
else if (qi instanceof field_declaration_1.FieldDeclaration) {
|
|
148
|
+
this.addField(qi);
|
|
149
|
+
}
|
|
150
|
+
else if ((0, nest_1.isNestedQuery)(qi)) {
|
|
151
|
+
const qf = new nest_1.QueryFieldAST(this, qi, qi.name);
|
|
152
|
+
qf.nestParent = this.exprSpace;
|
|
153
|
+
this.setEntry(qi.name, qf);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
// Compiler will error if we don't handle all cases
|
|
157
|
+
const _itemNotHandled = qi;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
canContain(_qd) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
queryFieldDefs() {
|
|
165
|
+
const fields = [];
|
|
166
|
+
for (const [name, field] of this.entries()) {
|
|
167
|
+
if (field instanceof space_field_1.SpaceField) {
|
|
168
|
+
const fieldQueryDef = field.getQueryFieldDef(this.exprSpace);
|
|
169
|
+
if (fieldQueryDef) {
|
|
170
|
+
if (this.canContain(fieldQueryDef)) {
|
|
171
|
+
fields.push(fieldQueryDef);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.log(`'${name}' not legal in ${this.segmentType}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
throw new Error(`'${name}' does not have a QueryFieldDef`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
this.isComplete();
|
|
183
|
+
return fields;
|
|
184
|
+
}
|
|
185
|
+
getQuerySegment(rf) {
|
|
186
|
+
const p = this.getPipeSegment(rf);
|
|
187
|
+
if (model.isQuerySegment(p)) {
|
|
188
|
+
return p;
|
|
189
|
+
}
|
|
190
|
+
throw new Error("TODO NOT POSSIBLE");
|
|
191
|
+
}
|
|
192
|
+
getPipeSegment(refineFrom) {
|
|
193
|
+
if (this.segmentType == "index") {
|
|
194
|
+
// TODO ... should make this go away
|
|
195
|
+
throw new Error("INDEX FIELD PIPE SEGMENT MIS HANDLED");
|
|
196
|
+
}
|
|
197
|
+
if (refineFrom === null || refineFrom === void 0 ? void 0 : refineFrom.extendSource) {
|
|
198
|
+
for (const xField of refineFrom.extendSource) {
|
|
199
|
+
this.exprSpace.addFieldDef(xField);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const segment = {
|
|
203
|
+
type: this.segmentType,
|
|
204
|
+
fields: this.queryFieldDefs(),
|
|
205
|
+
};
|
|
206
|
+
segment.fields = (0, field_utils_1.mergeFields)(refineFrom === null || refineFrom === void 0 ? void 0 : refineFrom.fields, segment.fields);
|
|
207
|
+
if (refineFrom === null || refineFrom === void 0 ? void 0 : refineFrom.extendSource) {
|
|
208
|
+
segment.extendSource = refineFrom.extendSource;
|
|
209
|
+
}
|
|
210
|
+
if (this.exprSpace.extendList.length > 0) {
|
|
211
|
+
const newExtends = [];
|
|
212
|
+
const extendedStruct = this.exprSpace.structDef();
|
|
213
|
+
for (const extendName of this.exprSpace.extendList) {
|
|
214
|
+
const extendEnt = extendedStruct.fields.find((f) => (0, field_utils_1.nameOf)(f) == extendName);
|
|
215
|
+
if (extendEnt) {
|
|
216
|
+
newExtends.push(extendEnt);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
segment.extendSource = (0, field_utils_1.mergeFields)(segment.extendSource, newExtends);
|
|
220
|
+
}
|
|
221
|
+
this.isComplete();
|
|
222
|
+
return segment;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.QuerySpace = QuerySpace;
|
|
226
|
+
class ReduceFieldSpace extends QuerySpace {
|
|
227
|
+
constructor() {
|
|
228
|
+
super(...arguments);
|
|
229
|
+
this.segmentType = "reduce";
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.ReduceFieldSpace = ReduceFieldSpace;
|
|
233
|
+
//# sourceMappingURL=query-spaces.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QueryFieldDef } from "../../../model/malloy_types";
|
|
2
|
+
import { FieldReference } from "../query-items/field-references";
|
|
3
|
+
import { FieldSpace } from "../types/field-space";
|
|
4
|
+
import { SpaceField } from "../types/space-field";
|
|
5
|
+
import { TypeDesc } from "../types/type-desc";
|
|
6
|
+
export declare class ReferenceField extends SpaceField {
|
|
7
|
+
readonly fieldRef: FieldReference;
|
|
8
|
+
constructor(fieldRef: FieldReference);
|
|
9
|
+
getQueryFieldDef(fs: FieldSpace): QueryFieldDef | undefined;
|
|
10
|
+
typeDesc(): TypeDesc;
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.ReferenceField = void 0;
|
|
26
|
+
const space_field_1 = require("../types/space-field");
|
|
27
|
+
class ReferenceField extends space_field_1.SpaceField {
|
|
28
|
+
constructor(fieldRef) {
|
|
29
|
+
super();
|
|
30
|
+
this.fieldRef = fieldRef;
|
|
31
|
+
}
|
|
32
|
+
getQueryFieldDef(fs) {
|
|
33
|
+
// Lookup string and generate error if it isn't defined.
|
|
34
|
+
const check = this.fieldRef.getField(fs);
|
|
35
|
+
if (check.error) {
|
|
36
|
+
this.fieldRef.log(check.error);
|
|
37
|
+
}
|
|
38
|
+
return this.fieldRef.refString;
|
|
39
|
+
}
|
|
40
|
+
typeDesc() {
|
|
41
|
+
return { dataType: "unknown", expressionType: "scalar" };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.ReferenceField = ReferenceField;
|
|
45
|
+
//# sourceMappingURL=reference-field.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StructDef } from "../../../model/malloy_types";
|
|
2
|
+
import { FieldListEdit } from "../source-properties/field-list-edit";
|
|
3
|
+
import { DynamicSpace } from "./dynamic-space";
|
|
4
|
+
import { ExploreField } from "../types/explore-field";
|
|
5
|
+
export declare class RefinedSpace extends DynamicSpace {
|
|
6
|
+
/**
|
|
7
|
+
* Factory for FieldSpace when there are accept/except edits
|
|
8
|
+
* @param from A structdef which seeds this space
|
|
9
|
+
* @param choose A accept/except edit of the "from" fields
|
|
10
|
+
*/
|
|
11
|
+
static filteredFrom(from: StructDef, choose?: FieldListEdit): RefinedSpace;
|
|
12
|
+
addField(...defs: ExploreField[]): void;
|
|
13
|
+
}
|
|
@@ -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.RefinedSpace = void 0;
|
|
26
|
+
const renames_1 = require("../source-properties/renames");
|
|
27
|
+
const joins_1 = require("../query-properties/joins");
|
|
28
|
+
const dynamic_space_1 = require("./dynamic-space");
|
|
29
|
+
const nest_1 = require("../query-properties/nest");
|
|
30
|
+
const field_definition_value_1 = require("./field-definition-value");
|
|
31
|
+
const join_space_field_1 = require("./join-space-field");
|
|
32
|
+
const rename_space_field_1 = require("./rename-space-field");
|
|
33
|
+
const field_declaration_1 = require("../query-items/field-declaration");
|
|
34
|
+
const space_field_1 = require("../types/space-field");
|
|
35
|
+
class RefinedSpace extends dynamic_space_1.DynamicSpace {
|
|
36
|
+
/**
|
|
37
|
+
* Factory for FieldSpace when there are accept/except edits
|
|
38
|
+
* @param from A structdef which seeds this space
|
|
39
|
+
* @param choose A accept/except edit of the "from" fields
|
|
40
|
+
*/
|
|
41
|
+
static filteredFrom(from, choose) {
|
|
42
|
+
const edited = new RefinedSpace(from);
|
|
43
|
+
if (choose) {
|
|
44
|
+
const names = choose.refs.list;
|
|
45
|
+
const oldMap = edited.entries();
|
|
46
|
+
edited.dropEntries();
|
|
47
|
+
for (const [symbol, value] of oldMap) {
|
|
48
|
+
const included = !!names.find((f) => f.refString === symbol);
|
|
49
|
+
const accepting = choose.edit === "accept";
|
|
50
|
+
if (included === accepting) {
|
|
51
|
+
edited.setEntry(symbol, value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return edited;
|
|
56
|
+
}
|
|
57
|
+
addField(...defs) {
|
|
58
|
+
for (const def of defs) {
|
|
59
|
+
// TODO express the "three fields kinds" in a typesafe way
|
|
60
|
+
// one of three kinds of fields are legal in an explore: expressions ...
|
|
61
|
+
const elseLog = def.log;
|
|
62
|
+
const elseType = def.elementType;
|
|
63
|
+
if (def instanceof field_declaration_1.FieldDeclaration) {
|
|
64
|
+
const exprField = new field_definition_value_1.FieldDefinitionValue(this, def);
|
|
65
|
+
this.newEntry(exprField.name, def, exprField);
|
|
66
|
+
}
|
|
67
|
+
else if (def instanceof nest_1.TurtleDecl) {
|
|
68
|
+
const name = def.name;
|
|
69
|
+
this.newEntry(name, def, new nest_1.QueryFieldAST(this, def, name));
|
|
70
|
+
}
|
|
71
|
+
else if (def instanceof renames_1.RenameField) {
|
|
72
|
+
if (def.oldName.refString === def.newName) {
|
|
73
|
+
def.log("Can't rename field to itself");
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const oldValue = def.oldName.getField(this);
|
|
77
|
+
if (oldValue.found) {
|
|
78
|
+
if (oldValue.found instanceof space_field_1.SpaceField) {
|
|
79
|
+
this.setEntry(def.newName, new rename_space_field_1.RenameSpaceField(oldValue.found, def.newName, def.location));
|
|
80
|
+
this.dropEntry(def.oldName.refString);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
def.log(`'${def.oldName}' cannot be renamed`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
def.log(`Can't rename '${def.oldName}', no such field`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else if (def instanceof joins_1.Join) {
|
|
91
|
+
this.newEntry(def.name.refString, def, new join_space_field_1.JoinSpaceField(this, def));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
elseLog(`Internal error: Expected expression, query, or rename, got '${elseType}'`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.RefinedSpace = RefinedSpace;
|
|
100
|
+
//# sourceMappingURL=refined-space.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DocumentLocation, FieldDef } from "../../../model/malloy_types";
|
|
2
|
+
import { SpaceField } from "../types/space-field";
|
|
3
|
+
import { TypeDesc } from "../types/type-desc";
|
|
4
|
+
export declare class RenameSpaceField extends SpaceField {
|
|
5
|
+
private readonly otherField;
|
|
6
|
+
private readonly newName;
|
|
7
|
+
private readonly location;
|
|
8
|
+
constructor(otherField: SpaceField, newName: string, location: DocumentLocation);
|
|
9
|
+
fieldDef(): FieldDef | undefined;
|
|
10
|
+
typeDesc(): TypeDesc;
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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.RenameSpaceField = void 0;
|
|
26
|
+
const space_field_1 = require("../types/space-field");
|
|
27
|
+
class RenameSpaceField extends space_field_1.SpaceField {
|
|
28
|
+
constructor(otherField, newName, location) {
|
|
29
|
+
super();
|
|
30
|
+
this.otherField = otherField;
|
|
31
|
+
this.newName = newName;
|
|
32
|
+
this.location = location;
|
|
33
|
+
}
|
|
34
|
+
fieldDef() {
|
|
35
|
+
const renamedFieldRaw = this.otherField.fieldDef();
|
|
36
|
+
if (renamedFieldRaw === undefined) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...renamedFieldRaw,
|
|
41
|
+
as: this.newName,
|
|
42
|
+
location: this.location,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
typeDesc() {
|
|
46
|
+
return this.otherField.typeDesc();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.RenameSpaceField = RenameSpaceField;
|
|
50
|
+
//# sourceMappingURL=rename-space-field.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { SpaceField } from "../types/space-field";
|
|
7
|
+
import { StructSpaceFieldBase } from "./struct-space-field-base";
|
|
8
|
+
export declare class StaticSpace implements FieldSpace {
|
|
9
|
+
readonly type = "fieldSpace";
|
|
10
|
+
private memoMap?;
|
|
11
|
+
protected fromStruct: StructDef;
|
|
12
|
+
constructor(sourceStructDef: StructDef);
|
|
13
|
+
whenComplete(step: () => void): void;
|
|
14
|
+
dialectObj(): Dialect | undefined;
|
|
15
|
+
defToSpaceField(from: FieldDef): SpaceField;
|
|
16
|
+
private get map();
|
|
17
|
+
protected dropEntries(): void;
|
|
18
|
+
protected dropEntry(name: string): void;
|
|
19
|
+
protected entry(name: string): SpaceEntry | undefined;
|
|
20
|
+
protected setEntry(name: string, value: SpaceEntry): void;
|
|
21
|
+
protected entries(): [string, SpaceEntry][];
|
|
22
|
+
structDef(): StructDef;
|
|
23
|
+
emptyStructDef(): StructDef;
|
|
24
|
+
lookup(path: FieldName[]): LookupResult;
|
|
25
|
+
}
|
|
26
|
+
export declare class StructSpaceField extends StructSpaceFieldBase {
|
|
27
|
+
constructor(def: StructDef);
|
|
28
|
+
get fieldSpace(): FieldSpace;
|
|
29
|
+
}
|