@malloydata/malloy 0.0.22-dev230207144036 → 0.0.22-dev230207171614
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,7 @@
|
|
|
1
|
+
import { TimestampUnit } from "../../../model/malloy_types";
|
|
2
|
+
import { ExprValue } from "./expr-value";
|
|
3
|
+
import { TimeResult } from "./time-result";
|
|
4
|
+
export interface GranularResult extends TimeResult {
|
|
5
|
+
timeframe: TimestampUnit;
|
|
6
|
+
}
|
|
7
|
+
export declare function isGranularResult(v: ExprValue): v is GranularResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isGranularResult = void 0;
|
|
4
|
+
function isGranularResult(v) {
|
|
5
|
+
if (v.dataType !== "date" && v.dataType !== "timestamp") {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return v.timeframe !== undefined;
|
|
9
|
+
}
|
|
10
|
+
exports.isGranularResult = isGranularResult;
|
|
11
|
+
//# sourceMappingURL=granular-result.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
//# sourceMappingURL=lookup-result.js.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { MalloyTranslation } from "../../parse-malloy";
|
|
2
|
+
import { ModelDataRequest } from "../../translate-response";
|
|
3
|
+
import { DocumentCompileResult } from "./document-compile-result";
|
|
4
|
+
import { NameSpace } from "./name-space";
|
|
5
|
+
import { ModelEntry } from "./model-entry";
|
|
6
|
+
import { DocumentLocation, DocumentReference, ModelDef, Query, SQLBlockStructDef } from "../../../model/malloy_types";
|
|
7
|
+
export declare abstract class MalloyElement {
|
|
8
|
+
abstract elementType: string;
|
|
9
|
+
codeLocation?: DocumentLocation;
|
|
10
|
+
children: ElementChildren;
|
|
11
|
+
parent: MalloyElement | null;
|
|
12
|
+
private logger?;
|
|
13
|
+
/**
|
|
14
|
+
* @param kids All children passed to the constructor are not optional
|
|
15
|
+
*/
|
|
16
|
+
constructor(kids?: ElementChildren);
|
|
17
|
+
/**
|
|
18
|
+
* Record all elements as children of this element, and mark this
|
|
19
|
+
* element as their parent.
|
|
20
|
+
* @param kids Some of these might be undefined, in which case they are ignored
|
|
21
|
+
*/
|
|
22
|
+
has(kids: Record<string, ChildBody | undefined>): void;
|
|
23
|
+
get location(): DocumentLocation;
|
|
24
|
+
set location(loc: DocumentLocation | undefined);
|
|
25
|
+
protected namespace(): NameSpace | undefined;
|
|
26
|
+
modelEntry(reference: string | ModelEntryReference): ModelEntry | undefined;
|
|
27
|
+
private xlate?;
|
|
28
|
+
translator(): MalloyTranslation | undefined;
|
|
29
|
+
setTranslator(x: MalloyTranslation): void;
|
|
30
|
+
addReference(reference: DocumentReference): void;
|
|
31
|
+
private get sourceURL();
|
|
32
|
+
errorsExist(): boolean;
|
|
33
|
+
private logged;
|
|
34
|
+
log(message: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Mostly for debugging / testing. A string-y version of this object which
|
|
37
|
+
* is used to ask "are these two AST segments equal". Formatted so that
|
|
38
|
+
* errors would be human readable.
|
|
39
|
+
* @param indent only used for recursion
|
|
40
|
+
*/
|
|
41
|
+
toString(): string;
|
|
42
|
+
private stringify;
|
|
43
|
+
walk(callBack: (node: MalloyElement) => void): void;
|
|
44
|
+
private varInfo;
|
|
45
|
+
protected internalError(msg: string): Error;
|
|
46
|
+
}
|
|
47
|
+
export declare class Unimplemented extends MalloyElement {
|
|
48
|
+
elementType: string;
|
|
49
|
+
reported: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare type ChildBody = MalloyElement | MalloyElement[];
|
|
52
|
+
declare type ElementChildren = Record<string, ChildBody>;
|
|
53
|
+
export declare class ModelEntryReference extends MalloyElement {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
elementType: string;
|
|
56
|
+
constructor(name: string);
|
|
57
|
+
get refString(): string;
|
|
58
|
+
toString(): string;
|
|
59
|
+
}
|
|
60
|
+
export interface DocStatement extends MalloyElement {
|
|
61
|
+
execute(doc: Document): ModelDataRequest;
|
|
62
|
+
}
|
|
63
|
+
export declare function isDocStatement(e: MalloyElement): e is DocStatement;
|
|
64
|
+
export declare class ListOf<ET extends MalloyElement> extends MalloyElement {
|
|
65
|
+
elementType: string;
|
|
66
|
+
protected elements: ET[];
|
|
67
|
+
constructor(listDesc: string, elements: ET[]);
|
|
68
|
+
private newContents;
|
|
69
|
+
get list(): ET[];
|
|
70
|
+
empty(): boolean;
|
|
71
|
+
notEmpty(): boolean;
|
|
72
|
+
push(...el: ET[]): ET[];
|
|
73
|
+
}
|
|
74
|
+
export declare class RunList extends ListOf<DocStatement> {
|
|
75
|
+
execCursor: number;
|
|
76
|
+
executeList(doc: Document): ModelDataRequest;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The Document class is a little weird because we might need to bounce back
|
|
80
|
+
* to the requestor, which might be on the other side of a wire, to get
|
|
81
|
+
* back some schema information. The intended translation of a Document
|
|
82
|
+
* is to call initModelDef(), and then to call modelDataRequest() until it
|
|
83
|
+
* returns undefined. At any time you can call modelDef to get the model
|
|
84
|
+
* as it exists so far, but the translation is not complete until
|
|
85
|
+
* modelDataRequest() returns undefined;
|
|
86
|
+
*
|
|
87
|
+
* TODO probably modelRequest should be the method and you call it
|
|
88
|
+
* until it returns a model with no additional data needed ...
|
|
89
|
+
* that can be tomorrow
|
|
90
|
+
*/
|
|
91
|
+
export declare class Document extends MalloyElement implements NameSpace {
|
|
92
|
+
elementType: string;
|
|
93
|
+
documentModel: Record<string, ModelEntry>;
|
|
94
|
+
queryList: Query[];
|
|
95
|
+
sqlBlocks: SQLBlockStructDef[];
|
|
96
|
+
statements: RunList;
|
|
97
|
+
didInitModel: boolean;
|
|
98
|
+
constructor(statements: DocStatement[]);
|
|
99
|
+
initModelDef(extendingModelDef: ModelDef | undefined): void;
|
|
100
|
+
compile(): DocumentCompileResult;
|
|
101
|
+
modelDef(): ModelDef;
|
|
102
|
+
defineSQL(sql: SQLBlockStructDef, name?: string): boolean;
|
|
103
|
+
getEntry(str: string): ModelEntry;
|
|
104
|
+
setEntry(str: string, ent: ModelEntry): void;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Document = exports.RunList = exports.ListOf = exports.isDocStatement = exports.ModelEntryReference = exports.Unimplemented = exports.MalloyElement = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright 2023 Google LLC
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
* a copy of this software and associated documentation files
|
|
9
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
10
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
11
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
12
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
13
|
+
* subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be
|
|
16
|
+
* included in all copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
21
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
23
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
24
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
const lodash_1 = require("lodash");
|
|
27
|
+
const malloy_types_1 = require("../../../model/malloy_types");
|
|
28
|
+
class MalloyElement {
|
|
29
|
+
/**
|
|
30
|
+
* @param kids All children passed to the constructor are not optional
|
|
31
|
+
*/
|
|
32
|
+
constructor(kids) {
|
|
33
|
+
this.children = {};
|
|
34
|
+
this.parent = null;
|
|
35
|
+
this.logged = new Set();
|
|
36
|
+
if (kids) {
|
|
37
|
+
this.has(kids);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Record all elements as children of this element, and mark this
|
|
42
|
+
* element as their parent.
|
|
43
|
+
* @param kids Some of these might be undefined, in which case they are ignored
|
|
44
|
+
*/
|
|
45
|
+
has(kids) {
|
|
46
|
+
for (const kidName in kids) {
|
|
47
|
+
const kidValue = kids[kidName];
|
|
48
|
+
if (kidValue !== undefined) {
|
|
49
|
+
this.children[kidName] = kidValue;
|
|
50
|
+
if (kidValue instanceof MalloyElement) {
|
|
51
|
+
kidValue.parent = this;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
for (const oneKid of kidValue) {
|
|
55
|
+
oneKid.parent = this;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
get location() {
|
|
62
|
+
if (this.codeLocation) {
|
|
63
|
+
return this.codeLocation;
|
|
64
|
+
}
|
|
65
|
+
if (this.parent) {
|
|
66
|
+
return this.parent.location;
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
url: this.sourceURL,
|
|
70
|
+
range: {
|
|
71
|
+
start: { line: 0, character: 0 },
|
|
72
|
+
end: { line: 0, character: 0 },
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
set location(loc) {
|
|
77
|
+
this.codeLocation = loc;
|
|
78
|
+
}
|
|
79
|
+
namespace() {
|
|
80
|
+
if (this instanceof Document) {
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
else if (this.parent) {
|
|
84
|
+
return this.parent.namespace();
|
|
85
|
+
}
|
|
86
|
+
throw new Error("INTERNAL ERROR: Translation without document scope");
|
|
87
|
+
}
|
|
88
|
+
modelEntry(reference) {
|
|
89
|
+
var _a;
|
|
90
|
+
const key = reference instanceof ModelEntryReference ? reference.name : reference;
|
|
91
|
+
const result = (_a = this.namespace()) === null || _a === void 0 ? void 0 : _a.getEntry(key);
|
|
92
|
+
if (reference instanceof ModelEntryReference) {
|
|
93
|
+
if ((result === null || result === void 0 ? void 0 : result.entry.type) === "query") {
|
|
94
|
+
this.addReference({
|
|
95
|
+
type: "queryReference",
|
|
96
|
+
text: key,
|
|
97
|
+
definition: result.entry,
|
|
98
|
+
location: reference.location,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else if ((result === null || result === void 0 ? void 0 : result.entry.type) === "struct") {
|
|
102
|
+
if ((0, malloy_types_1.isSQLBlock)(result.entry)) {
|
|
103
|
+
this.addReference({
|
|
104
|
+
type: "sqlBlockReference",
|
|
105
|
+
text: key,
|
|
106
|
+
definition: result.entry,
|
|
107
|
+
location: reference.location,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
this.addReference({
|
|
112
|
+
type: "exploreReference",
|
|
113
|
+
text: key,
|
|
114
|
+
definition: result.entry,
|
|
115
|
+
location: reference.location,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
translator() {
|
|
123
|
+
if (this.xlate) {
|
|
124
|
+
return this.xlate;
|
|
125
|
+
}
|
|
126
|
+
if (this.parent) {
|
|
127
|
+
return this.parent.translator();
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
setTranslator(x) {
|
|
132
|
+
this.xlate = x;
|
|
133
|
+
}
|
|
134
|
+
addReference(reference) {
|
|
135
|
+
var _a;
|
|
136
|
+
(_a = this.translator()) === null || _a === void 0 ? void 0 : _a.addReference(reference);
|
|
137
|
+
}
|
|
138
|
+
get sourceURL() {
|
|
139
|
+
const trans = this.translator();
|
|
140
|
+
return (trans === null || trans === void 0 ? void 0 : trans.sourceURL) || "(missing)";
|
|
141
|
+
}
|
|
142
|
+
errorsExist() {
|
|
143
|
+
var _a;
|
|
144
|
+
const logger = (_a = this.translator()) === null || _a === void 0 ? void 0 : _a.root.logger;
|
|
145
|
+
if (logger) {
|
|
146
|
+
return logger.hasErrors();
|
|
147
|
+
}
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
log(message) {
|
|
151
|
+
if (this.codeLocation) {
|
|
152
|
+
/*
|
|
153
|
+
* If this element has a location, then don't report the same
|
|
154
|
+
* error message at the same location more than once
|
|
155
|
+
*/
|
|
156
|
+
if (this.logged.has(message)) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
this.logged.add(message);
|
|
160
|
+
}
|
|
161
|
+
const trans = this.translator();
|
|
162
|
+
const msg = { at: this.location, message };
|
|
163
|
+
const logTo = trans === null || trans === void 0 ? void 0 : trans.root.logger;
|
|
164
|
+
if (logTo) {
|
|
165
|
+
logTo.log(msg);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
throw new Error(`Translation error (without error reporter):\n${JSON.stringify(msg, null, 2)}`);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Mostly for debugging / testing. A string-y version of this object which
|
|
172
|
+
* is used to ask "are these two AST segments equal". Formatted so that
|
|
173
|
+
* errors would be human readable.
|
|
174
|
+
* @param indent only used for recursion
|
|
175
|
+
*/
|
|
176
|
+
toString() {
|
|
177
|
+
return this.stringify("", 0);
|
|
178
|
+
}
|
|
179
|
+
stringify(prefix, indent) {
|
|
180
|
+
const left = " ".repeat(indent);
|
|
181
|
+
let asString = `${left}${prefix}<${this.elementType}>${this.varInfo()}`;
|
|
182
|
+
for (const kidLabel of Object.keys(this.children)) {
|
|
183
|
+
const kiddle = this.children[kidLabel];
|
|
184
|
+
if (kiddle instanceof MalloyElement) {
|
|
185
|
+
asString += "\n" + kiddle.stringify(`${kidLabel}: `, indent + 2);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
asString += `\n${left} ${kidLabel}: [`;
|
|
189
|
+
if (kiddle.length > 0) {
|
|
190
|
+
asString +=
|
|
191
|
+
"\n" +
|
|
192
|
+
kiddle.map((k) => k.stringify("", indent + 4)).join("\n") +
|
|
193
|
+
`\n${left} `;
|
|
194
|
+
}
|
|
195
|
+
asString += "]";
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return asString;
|
|
199
|
+
}
|
|
200
|
+
walk(callBack) {
|
|
201
|
+
callBack(this);
|
|
202
|
+
for (const kidLabel of Object.keys(this.children)) {
|
|
203
|
+
const kiddle = this.children[kidLabel];
|
|
204
|
+
if (kiddle instanceof MalloyElement) {
|
|
205
|
+
kiddle.walk(callBack);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
for (const k of kiddle) {
|
|
209
|
+
k.walk(callBack);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
varInfo() {
|
|
215
|
+
let extra = "";
|
|
216
|
+
for (const [key, value] of Object.entries(this)) {
|
|
217
|
+
if (key !== "elementType") {
|
|
218
|
+
if (typeof value == "boolean") {
|
|
219
|
+
extra += value ? ` ${key}` : ` !${key}`;
|
|
220
|
+
}
|
|
221
|
+
else if (typeof value === "string" || typeof value === "number") {
|
|
222
|
+
extra += ` ${key}=${value}`;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return extra;
|
|
227
|
+
}
|
|
228
|
+
internalError(msg) {
|
|
229
|
+
this.log(`INTERNAL ERROR IN TRANSLATION: ${msg}`);
|
|
230
|
+
return new Error(msg);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
exports.MalloyElement = MalloyElement;
|
|
234
|
+
class Unimplemented extends MalloyElement {
|
|
235
|
+
constructor() {
|
|
236
|
+
super(...arguments);
|
|
237
|
+
this.elementType = "unimplemented";
|
|
238
|
+
this.reported = false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
exports.Unimplemented = Unimplemented;
|
|
242
|
+
class ModelEntryReference extends MalloyElement {
|
|
243
|
+
constructor(name) {
|
|
244
|
+
super();
|
|
245
|
+
this.name = name;
|
|
246
|
+
this.elementType = "modelEntryReference";
|
|
247
|
+
}
|
|
248
|
+
get refString() {
|
|
249
|
+
return this.name;
|
|
250
|
+
}
|
|
251
|
+
toString() {
|
|
252
|
+
return this.refString;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
exports.ModelEntryReference = ModelEntryReference;
|
|
256
|
+
function isDocStatement(e) {
|
|
257
|
+
return e.execute !== undefined;
|
|
258
|
+
}
|
|
259
|
+
exports.isDocStatement = isDocStatement;
|
|
260
|
+
class ListOf extends MalloyElement {
|
|
261
|
+
constructor(listDesc, elements) {
|
|
262
|
+
super();
|
|
263
|
+
this.elementType = "genericElementList";
|
|
264
|
+
this.elements = elements;
|
|
265
|
+
if (this.elementType === "genericElementList") {
|
|
266
|
+
this.elementType = listDesc;
|
|
267
|
+
}
|
|
268
|
+
this.newContents();
|
|
269
|
+
}
|
|
270
|
+
newContents() {
|
|
271
|
+
this.has({ [this.elementType]: this.elements });
|
|
272
|
+
}
|
|
273
|
+
get list() {
|
|
274
|
+
return this.elements;
|
|
275
|
+
}
|
|
276
|
+
empty() {
|
|
277
|
+
return this.elements.length === 0;
|
|
278
|
+
}
|
|
279
|
+
notEmpty() {
|
|
280
|
+
return this.elements.length > 0;
|
|
281
|
+
}
|
|
282
|
+
push(...el) {
|
|
283
|
+
this.elements.push(...el);
|
|
284
|
+
this.newContents();
|
|
285
|
+
return this.elements;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
exports.ListOf = ListOf;
|
|
289
|
+
class RunList extends ListOf {
|
|
290
|
+
constructor() {
|
|
291
|
+
super(...arguments);
|
|
292
|
+
this.execCursor = 0;
|
|
293
|
+
}
|
|
294
|
+
executeList(doc) {
|
|
295
|
+
while (this.execCursor < this.elements.length) {
|
|
296
|
+
if (doc.errorsExist()) {
|
|
297
|
+
// This stops cascading errors
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const el = this.elements[this.execCursor];
|
|
301
|
+
if (isDocStatement(el)) {
|
|
302
|
+
const resp = el.execute(doc);
|
|
303
|
+
if (resp) {
|
|
304
|
+
return resp;
|
|
305
|
+
}
|
|
306
|
+
this.execCursor += 1;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return undefined;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
exports.RunList = RunList;
|
|
313
|
+
/**
|
|
314
|
+
* The Document class is a little weird because we might need to bounce back
|
|
315
|
+
* to the requestor, which might be on the other side of a wire, to get
|
|
316
|
+
* back some schema information. The intended translation of a Document
|
|
317
|
+
* is to call initModelDef(), and then to call modelDataRequest() until it
|
|
318
|
+
* returns undefined. At any time you can call modelDef to get the model
|
|
319
|
+
* as it exists so far, but the translation is not complete until
|
|
320
|
+
* modelDataRequest() returns undefined;
|
|
321
|
+
*
|
|
322
|
+
* TODO probably modelRequest should be the method and you call it
|
|
323
|
+
* until it returns a model with no additional data needed ...
|
|
324
|
+
* that can be tomorrow
|
|
325
|
+
*/
|
|
326
|
+
class Document extends MalloyElement {
|
|
327
|
+
constructor(statements) {
|
|
328
|
+
super();
|
|
329
|
+
this.elementType = "document";
|
|
330
|
+
this.documentModel = {};
|
|
331
|
+
this.queryList = [];
|
|
332
|
+
this.sqlBlocks = [];
|
|
333
|
+
this.didInitModel = false;
|
|
334
|
+
this.statements = new RunList("topLevelStatements", statements);
|
|
335
|
+
this.has({ statements });
|
|
336
|
+
}
|
|
337
|
+
initModelDef(extendingModelDef) {
|
|
338
|
+
if (this.didInitModel) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
this.documentModel = {};
|
|
342
|
+
this.queryList = [];
|
|
343
|
+
this.sqlBlocks = [];
|
|
344
|
+
if (extendingModelDef) {
|
|
345
|
+
for (const inName in extendingModelDef.contents) {
|
|
346
|
+
const struct = extendingModelDef.contents[inName];
|
|
347
|
+
if (struct.type == "struct") {
|
|
348
|
+
const exported = extendingModelDef.exports.includes(inName);
|
|
349
|
+
this.setEntry(inName, { entry: struct, exported });
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
this.didInitModel = true;
|
|
354
|
+
}
|
|
355
|
+
compile() {
|
|
356
|
+
const needs = this.statements.executeList(this);
|
|
357
|
+
const ret = {
|
|
358
|
+
modelDef: this.modelDef(),
|
|
359
|
+
queryList: this.queryList,
|
|
360
|
+
sqlBlocks: this.sqlBlocks,
|
|
361
|
+
needs,
|
|
362
|
+
};
|
|
363
|
+
return ret;
|
|
364
|
+
}
|
|
365
|
+
modelDef() {
|
|
366
|
+
const def = { name: "", exports: [], contents: {} };
|
|
367
|
+
for (const entry in this.documentModel) {
|
|
368
|
+
const entryDef = this.documentModel[entry].entry;
|
|
369
|
+
if (entryDef.type === "struct" || entryDef.type === "query") {
|
|
370
|
+
if (this.documentModel[entry].exported) {
|
|
371
|
+
def.exports.push(entry);
|
|
372
|
+
}
|
|
373
|
+
def.contents[entry] = (0, lodash_1.cloneDeep)(entryDef);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return def;
|
|
377
|
+
}
|
|
378
|
+
defineSQL(sql, name) {
|
|
379
|
+
const ret = { ...sql, as: `$${this.sqlBlocks.length}` };
|
|
380
|
+
if (name) {
|
|
381
|
+
if (this.getEntry(name)) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
ret.as = name;
|
|
385
|
+
this.setEntry(name, { entry: ret, sqlType: true });
|
|
386
|
+
}
|
|
387
|
+
this.sqlBlocks.push(ret);
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
getEntry(str) {
|
|
391
|
+
return this.documentModel[str];
|
|
392
|
+
}
|
|
393
|
+
setEntry(str, ent) {
|
|
394
|
+
this.documentModel[str] = ent;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
exports.Document = Document;
|
|
398
|
+
//# sourceMappingURL=malloy-element.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
//# sourceMappingURL=model-entry.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
//# sourceMappingURL=name-space.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
//# sourceMappingURL=nested-query.js.map
|