@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,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ConstantParameter = void 0;
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const has_parameter_1 = require("./has-parameter");
|
|
28
|
+
class ConstantParameter extends has_parameter_1.HasParameter {
|
|
29
|
+
constructor(name, value) {
|
|
30
|
+
super({ name, isCondition: false });
|
|
31
|
+
this.value = value;
|
|
32
|
+
this.has({ value });
|
|
33
|
+
}
|
|
34
|
+
parameter() {
|
|
35
|
+
const cVal = this.value.constantValue();
|
|
36
|
+
if (!(0, malloy_types_1.isAtomicFieldType)(cVal.dataType)) {
|
|
37
|
+
this.log(`Unexpected expression type '${cVal.dataType}'`);
|
|
38
|
+
return {
|
|
39
|
+
value: ["XXX-type-mismatch-error-XXX"],
|
|
40
|
+
type: "string",
|
|
41
|
+
name: this.name,
|
|
42
|
+
constant: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
value: cVal.value,
|
|
47
|
+
type: cVal.dataType,
|
|
48
|
+
name: this.name,
|
|
49
|
+
constant: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ConstantParameter = ConstantParameter;
|
|
54
|
+
//# sourceMappingURL=constant-parameter.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AtomicFieldType, Parameter } from "../../../model/malloy_types";
|
|
2
|
+
import { ConstantSubExpression } from "../expressions/constant-sub-expression";
|
|
3
|
+
import { MalloyElement } from "../types/malloy-element";
|
|
4
|
+
interface HasInit {
|
|
5
|
+
name: string;
|
|
6
|
+
isCondition: boolean;
|
|
7
|
+
type?: string;
|
|
8
|
+
default?: ConstantSubExpression;
|
|
9
|
+
}
|
|
10
|
+
export declare class HasParameter extends MalloyElement {
|
|
11
|
+
elementType: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly isCondition: boolean;
|
|
14
|
+
readonly type?: AtomicFieldType;
|
|
15
|
+
readonly default?: ConstantSubExpression;
|
|
16
|
+
constructor(init: HasInit);
|
|
17
|
+
parameter(): Parameter;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
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.HasParameter = void 0;
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
28
|
+
class HasParameter extends malloy_element_1.MalloyElement {
|
|
29
|
+
constructor(init) {
|
|
30
|
+
super();
|
|
31
|
+
this.elementType = "hasParameter";
|
|
32
|
+
this.name = init.name;
|
|
33
|
+
this.isCondition = init.isCondition;
|
|
34
|
+
if (init.type && (0, malloy_types_1.isAtomicFieldType)(init.type)) {
|
|
35
|
+
this.type = init.type;
|
|
36
|
+
}
|
|
37
|
+
if (init.default) {
|
|
38
|
+
this.default = init.default;
|
|
39
|
+
this.has({ default: this.default });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
parameter() {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const name = this.name;
|
|
45
|
+
const type = this.type || "string";
|
|
46
|
+
if (this.isCondition) {
|
|
47
|
+
const cCond = ((_a = this.default) === null || _a === void 0 ? void 0 : _a.constantCondition(type).value) || null;
|
|
48
|
+
return {
|
|
49
|
+
type,
|
|
50
|
+
name,
|
|
51
|
+
condition: cCond,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const cVal = ((_b = this.default) === null || _b === void 0 ? void 0 : _b.constantValue().value) || null;
|
|
55
|
+
return {
|
|
56
|
+
value: cVal,
|
|
57
|
+
type,
|
|
58
|
+
name: this.name,
|
|
59
|
+
constant: false,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.HasParameter = HasParameter;
|
|
64
|
+
//# sourceMappingURL=has-parameter.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModelDataRequest } from "../../translate-response";
|
|
2
|
+
import { DocStatement, Document, MalloyElement } from "../types/malloy-element";
|
|
3
|
+
import { QueryElement } from "../types/query-element";
|
|
4
|
+
export declare class AnonymousQuery extends MalloyElement implements DocStatement {
|
|
5
|
+
readonly theQuery: QueryElement;
|
|
6
|
+
elementType: string;
|
|
7
|
+
constructor(theQuery: QueryElement);
|
|
8
|
+
execute(doc: Document): ModelDataRequest;
|
|
9
|
+
}
|
|
@@ -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.AnonymousQuery = void 0;
|
|
26
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
27
|
+
class AnonymousQuery extends malloy_element_1.MalloyElement {
|
|
28
|
+
constructor(theQuery) {
|
|
29
|
+
super();
|
|
30
|
+
this.theQuery = theQuery;
|
|
31
|
+
this.elementType = "anonymousQuery";
|
|
32
|
+
this.has({ query: theQuery });
|
|
33
|
+
}
|
|
34
|
+
execute(doc) {
|
|
35
|
+
const modelQuery = this.theQuery.query();
|
|
36
|
+
doc.queryList.push(modelQuery);
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.AnonymousQuery = AnonymousQuery;
|
|
41
|
+
//# sourceMappingURL=anonymous-query.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Query } from "../../../model/malloy_types";
|
|
2
|
+
import { ModelEntryReference } from "../types/malloy-element";
|
|
3
|
+
import { PipelineDesc } from "../elements/pipeline-desc";
|
|
4
|
+
import { QueryComp } from "../types/query-comp";
|
|
5
|
+
export declare class ExistingQuery extends PipelineDesc {
|
|
6
|
+
_head?: ModelEntryReference;
|
|
7
|
+
set head(head: ModelEntryReference | undefined);
|
|
8
|
+
get head(): ModelEntryReference | undefined;
|
|
9
|
+
queryComp(): QueryComp;
|
|
10
|
+
query(): Query;
|
|
11
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.ExistingQuery = void 0;
|
|
26
|
+
const error_factory_1 = require("../error-factory");
|
|
27
|
+
const pipeline_desc_1 = require("../elements/pipeline-desc");
|
|
28
|
+
const query_head_struct_1 = require("./query-head-struct");
|
|
29
|
+
const static_space_1 = require("../field-space/static-space");
|
|
30
|
+
class ExistingQuery extends pipeline_desc_1.PipelineDesc {
|
|
31
|
+
set head(head) {
|
|
32
|
+
this._head = head;
|
|
33
|
+
this.has({ head });
|
|
34
|
+
}
|
|
35
|
+
get head() {
|
|
36
|
+
return this._head;
|
|
37
|
+
}
|
|
38
|
+
queryComp() {
|
|
39
|
+
if (!this.head) {
|
|
40
|
+
throw this.internalError("can't make query from nameless query");
|
|
41
|
+
}
|
|
42
|
+
const queryEntry = this.modelEntry(this.head);
|
|
43
|
+
const seedQuery = queryEntry === null || queryEntry === void 0 ? void 0 : queryEntry.entry;
|
|
44
|
+
const oops = function () {
|
|
45
|
+
return {
|
|
46
|
+
outputStruct: error_factory_1.ErrorFactory.structDef,
|
|
47
|
+
query: error_factory_1.ErrorFactory.query,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
if (!seedQuery) {
|
|
51
|
+
this.log(`Reference to undefined query '${this.head}'`);
|
|
52
|
+
return oops();
|
|
53
|
+
}
|
|
54
|
+
if (seedQuery.type !== "query") {
|
|
55
|
+
this.log(`Illegal reference to '${this.head}', query expected`);
|
|
56
|
+
return oops();
|
|
57
|
+
}
|
|
58
|
+
const queryHead = new query_head_struct_1.QueryHeadStruct(seedQuery.structRef);
|
|
59
|
+
this.has({ queryHead });
|
|
60
|
+
const exploreStruct = queryHead.structDef();
|
|
61
|
+
const exploreFS = new static_space_1.StaticSpace(exploreStruct);
|
|
62
|
+
const sourcePipe = this.refinePipeline(exploreFS, seedQuery);
|
|
63
|
+
const walkStruct = this.getOutputStruct(exploreStruct, sourcePipe.pipeline);
|
|
64
|
+
const appended = this.appendOps(sourcePipe.pipeline, new static_space_1.StaticSpace(walkStruct));
|
|
65
|
+
const destPipe = { ...sourcePipe, pipeline: appended.opList };
|
|
66
|
+
const query = {
|
|
67
|
+
type: "query",
|
|
68
|
+
...destPipe,
|
|
69
|
+
structRef: queryHead.structRef(),
|
|
70
|
+
location: this.location,
|
|
71
|
+
};
|
|
72
|
+
return { outputStruct: appended.structDef, query };
|
|
73
|
+
}
|
|
74
|
+
query() {
|
|
75
|
+
return this.queryComp().query;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ExistingQuery = ExistingQuery;
|
|
79
|
+
//# sourceMappingURL=existing-query.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Query } from "../../../model/malloy_types";
|
|
2
|
+
import { Source } from "../elements/source";
|
|
3
|
+
import { QueryComp } from "../types/query-comp";
|
|
4
|
+
import { TurtleHeadedPipe } from "../types/turtle-headed-pipe";
|
|
5
|
+
export declare class FullQuery extends TurtleHeadedPipe {
|
|
6
|
+
readonly explore: Source;
|
|
7
|
+
constructor(explore: Source);
|
|
8
|
+
queryComp(): QueryComp;
|
|
9
|
+
query(): Query;
|
|
10
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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.FullQuery = void 0;
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const error_factory_1 = require("../error-factory");
|
|
28
|
+
const turtle_headed_pipe_1 = require("../types/turtle-headed-pipe");
|
|
29
|
+
const static_space_1 = require("../field-space/static-space");
|
|
30
|
+
class FullQuery extends turtle_headed_pipe_1.TurtleHeadedPipe {
|
|
31
|
+
constructor(explore) {
|
|
32
|
+
super({ explore });
|
|
33
|
+
this.explore = explore;
|
|
34
|
+
}
|
|
35
|
+
queryComp() {
|
|
36
|
+
const structRef = this.explore.structRef();
|
|
37
|
+
const destQuery = {
|
|
38
|
+
type: "query",
|
|
39
|
+
structRef,
|
|
40
|
+
pipeline: [],
|
|
41
|
+
location: this.location,
|
|
42
|
+
};
|
|
43
|
+
const structDef = (0, malloy_types_1.refIsStructDef)(structRef)
|
|
44
|
+
? structRef
|
|
45
|
+
: this.explore.structDef();
|
|
46
|
+
let pipeFs = new static_space_1.StaticSpace(structDef);
|
|
47
|
+
if (error_factory_1.ErrorFactory.isErrorStructDef(structDef)) {
|
|
48
|
+
return {
|
|
49
|
+
outputStruct: structDef,
|
|
50
|
+
query: {
|
|
51
|
+
structRef: structRef,
|
|
52
|
+
pipeline: [],
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (this.turtleName) {
|
|
57
|
+
const { error } = this.turtleName.getField(pipeFs);
|
|
58
|
+
if (error)
|
|
59
|
+
this.log(error);
|
|
60
|
+
const name = this.turtleName.refString;
|
|
61
|
+
const { pipeline, location } = this.expandTurtle(name, structDef);
|
|
62
|
+
destQuery.location = location;
|
|
63
|
+
const refined = this.refinePipeline(pipeFs, { pipeline }).pipeline;
|
|
64
|
+
if (this.headRefinement) {
|
|
65
|
+
// TODO there is an issue with losing the name of the turtle
|
|
66
|
+
// which we need to fix, possibly adding a "name:" field to a segment
|
|
67
|
+
// TODO there was mention of promoting filters to the query
|
|
68
|
+
destQuery.pipeline = refined;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
destQuery.pipeHead = { name };
|
|
72
|
+
}
|
|
73
|
+
const pipeStruct = this.getOutputStruct(structDef, refined);
|
|
74
|
+
pipeFs = new static_space_1.StaticSpace(pipeStruct);
|
|
75
|
+
}
|
|
76
|
+
const appended = this.appendOps(destQuery.pipeline, pipeFs);
|
|
77
|
+
destQuery.pipeline = appended.opList;
|
|
78
|
+
return { outputStruct: appended.structDef, query: destQuery };
|
|
79
|
+
}
|
|
80
|
+
query() {
|
|
81
|
+
return this.queryComp().query;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.FullQuery = FullQuery;
|
|
85
|
+
//# sourceMappingURL=full-query.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StructDef, StructRef } from "../../../model/malloy_types";
|
|
2
|
+
import { Source } from "../elements/source";
|
|
3
|
+
export declare class QueryHeadStruct extends Source {
|
|
4
|
+
readonly fromRef: StructRef;
|
|
5
|
+
elementType: string;
|
|
6
|
+
constructor(fromRef: StructRef);
|
|
7
|
+
structRef(): StructRef;
|
|
8
|
+
structDef(): StructDef;
|
|
9
|
+
}
|
|
@@ -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.QueryHeadStruct = void 0;
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const source_1 = require("../elements/source");
|
|
28
|
+
const named_source_1 = require("../sources/named-source");
|
|
29
|
+
class QueryHeadStruct extends source_1.Source {
|
|
30
|
+
constructor(fromRef) {
|
|
31
|
+
super();
|
|
32
|
+
this.fromRef = fromRef;
|
|
33
|
+
this.elementType = "internalOnlyQueryHead";
|
|
34
|
+
}
|
|
35
|
+
structRef() {
|
|
36
|
+
return this.fromRef;
|
|
37
|
+
}
|
|
38
|
+
structDef() {
|
|
39
|
+
if ((0, malloy_types_1.refIsStructDef)(this.fromRef)) {
|
|
40
|
+
return this.fromRef;
|
|
41
|
+
}
|
|
42
|
+
const ns = new named_source_1.NamedSource(this.fromRef);
|
|
43
|
+
this.has({ exploreReference: ns });
|
|
44
|
+
return ns.structDef();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.QueryHeadStruct = QueryHeadStruct;
|
|
48
|
+
//# sourceMappingURL=query-head-struct.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Dialect } from "../../../dialect/dialect";
|
|
2
|
+
import { FieldTypeDef, StructDef } from "../../../model/malloy_types";
|
|
3
|
+
import { LookupResult } from "../types/lookup-result";
|
|
4
|
+
import { ExpressionDef } from "../types/expression-def";
|
|
5
|
+
import { FieldName, FieldSpace } from "../types/field-space";
|
|
6
|
+
import { MalloyElement } from "../types/malloy-element";
|
|
7
|
+
export declare class FieldDeclaration extends MalloyElement {
|
|
8
|
+
readonly expr: ExpressionDef;
|
|
9
|
+
readonly defineName: string;
|
|
10
|
+
readonly exprSrc?: string | undefined;
|
|
11
|
+
elementType: string;
|
|
12
|
+
isMeasure?: boolean;
|
|
13
|
+
constructor(expr: ExpressionDef, defineName: string, exprSrc?: string | undefined);
|
|
14
|
+
fieldDef(fs: FieldSpace, exprName: string): FieldTypeDef;
|
|
15
|
+
queryFieldDef(exprFS: FieldSpace, exprName: string): FieldTypeDef;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Used to detect references to fields in the statement which defines them
|
|
19
|
+
*/
|
|
20
|
+
export declare class DefSpace implements FieldSpace {
|
|
21
|
+
readonly realFS: FieldSpace;
|
|
22
|
+
readonly circular: FieldDeclaration;
|
|
23
|
+
readonly type = "fieldSpace";
|
|
24
|
+
foundCircle: boolean;
|
|
25
|
+
constructor(realFS: FieldSpace, circular: FieldDeclaration);
|
|
26
|
+
structDef(): StructDef;
|
|
27
|
+
emptyStructDef(): StructDef;
|
|
28
|
+
lookup(symbol: FieldName[]): LookupResult;
|
|
29
|
+
dialectObj(): Dialect | undefined;
|
|
30
|
+
whenComplete(step: () => void): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
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.DefSpace = exports.FieldDeclaration = void 0;
|
|
26
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
27
|
+
const utils_1 = require("../expressions/utils");
|
|
28
|
+
const fragtype_utils_1 = require("../fragtype-utils");
|
|
29
|
+
const malloy_element_1 = require("../types/malloy-element");
|
|
30
|
+
const granular_result_1 = require("../types/granular-result");
|
|
31
|
+
class FieldDeclaration extends malloy_element_1.MalloyElement {
|
|
32
|
+
constructor(expr, defineName, exprSrc) {
|
|
33
|
+
super({ expr });
|
|
34
|
+
this.expr = expr;
|
|
35
|
+
this.defineName = defineName;
|
|
36
|
+
this.exprSrc = exprSrc;
|
|
37
|
+
this.elementType = "fieldDeclaration";
|
|
38
|
+
}
|
|
39
|
+
fieldDef(fs, exprName) {
|
|
40
|
+
/*
|
|
41
|
+
* In an explore we cannot reference the thing we are defining, you need
|
|
42
|
+
* to use rename. In a query, the output space is a new thing, and expressions
|
|
43
|
+
* can reference the outer value in order to make a value with the new name,
|
|
44
|
+
* and it feels wrong that this is HERE and not somehow in the QueryOperation.
|
|
45
|
+
* For now, this stops the stack overflow, and passes all tests, but I think
|
|
46
|
+
* a refactor of QueryFieldSpace might someday be the place where this should
|
|
47
|
+
* happen.
|
|
48
|
+
*/
|
|
49
|
+
return this.queryFieldDef(new DefSpace(fs, this), exprName);
|
|
50
|
+
}
|
|
51
|
+
queryFieldDef(exprFS, exprName) {
|
|
52
|
+
let exprValue;
|
|
53
|
+
try {
|
|
54
|
+
exprValue = this.expr.getExpression(exprFS);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
this.log(`Cannot define '${exprName}', ${error.message}`);
|
|
58
|
+
return {
|
|
59
|
+
name: `error_defining_${exprName}`,
|
|
60
|
+
type: "string",
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const compressValue = (0, utils_1.compressExpr)(exprValue.value);
|
|
64
|
+
const retType = exprValue.dataType;
|
|
65
|
+
if ((0, malloy_types_1.isAtomicFieldType)(retType)) {
|
|
66
|
+
const template = {
|
|
67
|
+
name: exprName,
|
|
68
|
+
type: retType,
|
|
69
|
+
location: this.location,
|
|
70
|
+
};
|
|
71
|
+
if (compressValue.length > 0) {
|
|
72
|
+
template.e = compressValue;
|
|
73
|
+
}
|
|
74
|
+
if (exprValue.expressionType) {
|
|
75
|
+
template.expressionType = exprValue.expressionType;
|
|
76
|
+
}
|
|
77
|
+
if (this.exprSrc) {
|
|
78
|
+
template.code = this.exprSrc;
|
|
79
|
+
}
|
|
80
|
+
// TODO this should work for dates too
|
|
81
|
+
if ((0, granular_result_1.isGranularResult)(exprValue) && template.type === "timestamp") {
|
|
82
|
+
template.timeframe = exprValue.timeframe;
|
|
83
|
+
}
|
|
84
|
+
return template;
|
|
85
|
+
}
|
|
86
|
+
const circularDef = exprFS instanceof DefSpace && exprFS.foundCircle;
|
|
87
|
+
if (!circularDef) {
|
|
88
|
+
if (exprValue.dataType == "unknown") {
|
|
89
|
+
this.log(`Cannot define '${exprName}', value has unknown type`);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const badType = fragtype_utils_1.FT.inspect(exprValue);
|
|
93
|
+
this.log(`Cannot define '${exprName}', unexpected type: ${badType}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
name: `error_defining_${exprName}`,
|
|
98
|
+
type: "string",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.FieldDeclaration = FieldDeclaration;
|
|
103
|
+
/**
|
|
104
|
+
* Used to detect references to fields in the statement which defines them
|
|
105
|
+
*/
|
|
106
|
+
class DefSpace {
|
|
107
|
+
constructor(realFS, circular) {
|
|
108
|
+
this.realFS = realFS;
|
|
109
|
+
this.circular = circular;
|
|
110
|
+
this.type = "fieldSpace";
|
|
111
|
+
this.foundCircle = false;
|
|
112
|
+
}
|
|
113
|
+
structDef() {
|
|
114
|
+
return this.realFS.structDef();
|
|
115
|
+
}
|
|
116
|
+
emptyStructDef() {
|
|
117
|
+
return this.realFS.emptyStructDef();
|
|
118
|
+
}
|
|
119
|
+
lookup(symbol) {
|
|
120
|
+
if (symbol[0] && symbol[0].refString === this.circular.defineName) {
|
|
121
|
+
this.foundCircle = true;
|
|
122
|
+
return {
|
|
123
|
+
error: `Circular reference to '${this.circular.defineName}' in definition`,
|
|
124
|
+
found: undefined,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return this.realFS.lookup(symbol);
|
|
128
|
+
}
|
|
129
|
+
dialectObj() {
|
|
130
|
+
return this.realFS.dialectObj();
|
|
131
|
+
}
|
|
132
|
+
whenComplete(step) {
|
|
133
|
+
this.realFS.whenComplete(step);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
exports.DefSpace = DefSpace;
|
|
137
|
+
//# sourceMappingURL=field-declaration.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FieldDef } from "../../../model/malloy_types";
|
|
2
|
+
import { FieldName, FieldSpace } from "../types/field-space";
|
|
3
|
+
import { ListOf, MalloyElement } from "../types/malloy-element";
|
|
4
|
+
import { LookupResult } from "../types/lookup-result";
|
|
5
|
+
export declare class FieldReference extends ListOf<FieldName> {
|
|
6
|
+
elementType: string;
|
|
7
|
+
constructor(names: FieldName[]);
|
|
8
|
+
get refString(): string;
|
|
9
|
+
get outputName(): string;
|
|
10
|
+
get sourceString(): string | undefined;
|
|
11
|
+
get nameString(): string;
|
|
12
|
+
getField(fs: FieldSpace): LookupResult;
|
|
13
|
+
}
|
|
14
|
+
export declare class WildcardFieldReference extends MalloyElement {
|
|
15
|
+
readonly joinPath: FieldReference | undefined;
|
|
16
|
+
readonly star: "*" | "**";
|
|
17
|
+
elementType: string;
|
|
18
|
+
constructor(joinPath: FieldReference | undefined, star: "*" | "**");
|
|
19
|
+
getFieldDef(): FieldDef;
|
|
20
|
+
get refString(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare type FieldReferenceElement = FieldReference | WildcardFieldReference;
|
|
23
|
+
export declare class FieldReferences extends ListOf<FieldReferenceElement> {
|
|
24
|
+
constructor(members: FieldReferenceElement[]);
|
|
25
|
+
}
|