@malloydata/malloy 0.0.22-dev230202171033 → 0.0.22-dev230206104726
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/package.json +2 -2
- package/dist/connection_utils.d.ts +0 -1
- package/dist/connection_utils.js +0 -66
- package/dist/dialect/dialect.d.ts +0 -66
- package/dist/dialect/dialect.js +0 -85
- package/dist/dialect/dialect_map.d.ts +0 -3
- package/dist/dialect/dialect_map.js +0 -45
- package/dist/dialect/duckdb.d.ts +0 -52
- package/dist/dialect/duckdb.js +0 -364
- package/dist/dialect/index.d.ts +0 -6
- package/dist/dialect/index.js +0 -37
- package/dist/dialect/postgres.d.ts +0 -52
- package/dist/dialect/postgres.js +0 -330
- package/dist/dialect/standardsql.d.ts +0 -49
- package/dist/dialect/standardsql.js +0 -381
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -59
- package/dist/lang/ast/ast-main.d.ts +0 -118
- package/dist/lang/ast/ast-main.js +0 -537
- package/dist/lang/ast/ast-utils.d.ts +0 -10
- package/dist/lang/ast/ast-utils.js +0 -42
- package/dist/lang/ast/elements/define-explore.d.ts +0 -17
- package/dist/lang/ast/elements/define-explore.js +0 -79
- package/dist/lang/ast/elements/define-query.d.ts +0 -14
- package/dist/lang/ast/elements/define-query.js +0 -56
- package/dist/lang/ast/elements/mallobj.d.ts +0 -12
- package/dist/lang/ast/elements/mallobj.js +0 -53
- package/dist/lang/ast/elements/pipeline-desc.d.ts +0 -28
- package/dist/lang/ast/elements/pipeline-desc.js +0 -102
- package/dist/lang/ast/elements/refined-explore.d.ts +0 -15
- package/dist/lang/ast/elements/refined-explore.js +0 -121
- package/dist/lang/ast/error-factory.d.ts +0 -9
- package/dist/lang/ast/error-factory.js +0 -61
- package/dist/lang/ast/executors/index-executor.d.ts +0 -18
- package/dist/lang/ast/executors/index-executor.js +0 -96
- package/dist/lang/ast/executors/project-executor.d.ts +0 -10
- package/dist/lang/ast/executors/project-executor.js +0 -68
- package/dist/lang/ast/executors/reduce-executor.d.ts +0 -20
- package/dist/lang/ast/executors/reduce-executor.js +0 -149
- package/dist/lang/ast/explore-properties/field-list-edit.d.ts +0 -8
- package/dist/lang/ast/explore-properties/field-list-edit.js +0 -36
- package/dist/lang/ast/explore-properties/primary-key.d.ts +0 -7
- package/dist/lang/ast/explore-properties/primary-key.js +0 -35
- package/dist/lang/ast/explore-properties/renames.d.ts +0 -11
- package/dist/lang/ast/explore-properties/renames.js +0 -43
- package/dist/lang/ast/explore-properties/turtles.d.ts +0 -5
- package/dist/lang/ast/explore-properties/turtles.js +0 -33
- package/dist/lang/ast/expressions/apply.d.ts +0 -8
- package/dist/lang/ast/expressions/apply.js +0 -37
- package/dist/lang/ast/expressions/binary-boolean.d.ts +0 -12
- package/dist/lang/ast/expressions/binary-boolean.js +0 -54
- package/dist/lang/ast/expressions/binary-numeric.d.ts +0 -11
- package/dist/lang/ast/expressions/binary-numeric.js +0 -42
- package/dist/lang/ast/expressions/boolean.d.ts +0 -8
- package/dist/lang/ast/expressions/boolean.js +0 -39
- package/dist/lang/ast/expressions/constant-sub-expression.d.ts +0 -16
- package/dist/lang/ast/expressions/constant-sub-expression.js +0 -98
- package/dist/lang/ast/expressions/expr-add-sub.d.ts +0 -4
- package/dist/lang/ast/expressions/expr-add-sub.js +0 -34
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +0 -15
- package/dist/lang/ast/expressions/expr-aggregate-function.js +0 -99
- package/dist/lang/ast/expressions/expr-alternation-tree.d.ts +0 -11
- package/dist/lang/ast/expressions/expr-alternation-tree.js +0 -54
- package/dist/lang/ast/expressions/expr-asymmetric.d.ts +0 -10
- package/dist/lang/ast/expressions/expr-asymmetric.js +0 -27
- package/dist/lang/ast/expressions/expr-avg.d.ts +0 -6
- package/dist/lang/ast/expressions/expr-avg.js +0 -34
- package/dist/lang/ast/expressions/expr-case.d.ts +0 -11
- package/dist/lang/ast/expressions/expr-case.js +0 -84
- package/dist/lang/ast/expressions/expr-cast.d.ts +0 -13
- package/dist/lang/ast/expressions/expr-cast.js +0 -29
- package/dist/lang/ast/expressions/expr-compare.d.ts +0 -10
- package/dist/lang/ast/expressions/expr-compare.js +0 -48
- package/dist/lang/ast/expressions/expr-count-distinct.d.ts +0 -6
- package/dist/lang/ast/expressions/expr-count-distinct.js +0 -35
- package/dist/lang/ast/expressions/expr-count.d.ts +0 -11
- package/dist/lang/ast/expressions/expr-count.js +0 -57
- package/dist/lang/ast/expressions/expr-filter.d.ts +0 -12
- package/dist/lang/ast/expressions/expr-filter.js +0 -69
- package/dist/lang/ast/expressions/expr-func.d.ts +0 -10
- package/dist/lang/ast/expressions/expr-func.js +0 -63
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +0 -24
- package/dist/lang/ast/expressions/expr-granular-time.js +0 -117
- package/dist/lang/ast/expressions/expr-id-reference.d.ts +0 -12
- package/dist/lang/ast/expressions/expr-id-reference.js +0 -76
- package/dist/lang/ast/expressions/expr-logical-op.d.ts +0 -9
- package/dist/lang/ast/expressions/expr-logical-op.js +0 -36
- package/dist/lang/ast/expressions/expr-max.d.ts +0 -9
- package/dist/lang/ast/expressions/expr-max.js +0 -16
- package/dist/lang/ast/expressions/expr-min.d.ts +0 -9
- package/dist/lang/ast/expressions/expr-min.js +0 -16
- package/dist/lang/ast/expressions/expr-minus.d.ts +0 -9
- package/dist/lang/ast/expressions/expr-minus.js +0 -48
- package/dist/lang/ast/expressions/expr-mul-div.d.ts +0 -4
- package/dist/lang/ast/expressions/expr-mul-div.js +0 -34
- package/dist/lang/ast/expressions/expr-not.d.ts +0 -10
- package/dist/lang/ast/expressions/expr-not.js +0 -49
- package/dist/lang/ast/expressions/expr-now.d.ts +0 -7
- package/dist/lang/ast/expressions/expr-now.js +0 -46
- package/dist/lang/ast/expressions/expr-null.d.ts +0 -6
- package/dist/lang/ast/expressions/expr-null.js +0 -41
- package/dist/lang/ast/expressions/expr-number.d.ts +0 -10
- package/dist/lang/ast/expressions/expr-number.js +0 -42
- package/dist/lang/ast/expressions/expr-parens.d.ts +0 -10
- package/dist/lang/ast/expressions/expr-parens.js +0 -42
- package/dist/lang/ast/expressions/expr-regex.d.ts +0 -8
- package/dist/lang/ast/expressions/expr-regex.js +0 -42
- package/dist/lang/ast/expressions/expr-string.d.ts +0 -9
- package/dist/lang/ast/expressions/expr-string.js +0 -50
- package/dist/lang/ast/expressions/expr-sum.d.ts +0 -6
- package/dist/lang/ast/expressions/expr-sum.js +0 -12
- package/dist/lang/ast/expressions/expr-time-extract.d.ts +0 -13
- package/dist/lang/ast/expressions/expr-time-extract.js +0 -117
- package/dist/lang/ast/expressions/expr-time.d.ts +0 -11
- package/dist/lang/ast/expressions/expr-time.js +0 -62
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +0 -14
- package/dist/lang/ast/expressions/expr-ungroup.js +0 -83
- package/dist/lang/ast/expressions/for-range.d.ts +0 -19
- package/dist/lang/ast/expressions/for-range.js +0 -101
- package/dist/lang/ast/expressions/granular-literal.d.ts +0 -20
- package/dist/lang/ast/expressions/granular-literal.js +0 -148
- package/dist/lang/ast/expressions/partial-compare.d.ts +0 -14
- package/dist/lang/ast/expressions/partial-compare.js +0 -50
- package/dist/lang/ast/expressions/pick-when.d.ts +0 -19
- package/dist/lang/ast/expressions/pick-when.js +0 -156
- package/dist/lang/ast/expressions/range.d.ts +0 -12
- package/dist/lang/ast/expressions/range.js +0 -80
- package/dist/lang/ast/expressions/time-frame.d.ts +0 -7
- package/dist/lang/ast/expressions/time-frame.js +0 -40
- package/dist/lang/ast/expressions/top-by.d.ts +0 -10
- package/dist/lang/ast/expressions/top-by.js +0 -51
- package/dist/lang/ast/expressions/unary.d.ts +0 -5
- package/dist/lang/ast/expressions/unary.js +0 -34
- package/dist/lang/ast/expressions/utils.d.ts +0 -15
- package/dist/lang/ast/expressions/utils.js +0 -106
- package/dist/lang/ast/expressions/when-clause.d.ts +0 -10
- package/dist/lang/ast/expressions/when-clause.js +0 -17
- package/dist/lang/ast/fragtype-utils.d.ts +0 -39
- package/dist/lang/ast/fragtype-utils.js +0 -100
- package/dist/lang/ast/import-elements/import-statement.d.ts +0 -9
- package/dist/lang/ast/import-elements/import-statement.js +0 -78
- package/dist/lang/ast/index.d.ts +0 -96
- package/dist/lang/ast/index.js +0 -135
- package/dist/lang/ast/json-elements/json-element.d.ts +0 -6
- package/dist/lang/ast/json-elements/json-element.js +0 -41
- package/dist/lang/ast/json-elements/json-struct-def.d.ts +0 -10
- package/dist/lang/ast/json-elements/json-struct-def.js +0 -48
- package/dist/lang/ast/nesting/nest-reference.d.ts +0 -7
- package/dist/lang/ast/nesting/nest-reference.js +0 -35
- package/dist/lang/ast/parameters/constant-parameter.d.ts +0 -8
- package/dist/lang/ast/parameters/constant-parameter.js +0 -54
- package/dist/lang/ast/parameters/has-parameter.d.ts +0 -19
- package/dist/lang/ast/parameters/has-parameter.js +0 -64
- package/dist/lang/ast/query-elements/anonymous-query.d.ts +0 -9
- package/dist/lang/ast/query-elements/anonymous-query.js +0 -41
- package/dist/lang/ast/query-elements/existing-query.d.ts +0 -11
- package/dist/lang/ast/query-elements/existing-query.js +0 -79
- package/dist/lang/ast/query-elements/full-query.d.ts +0 -10
- package/dist/lang/ast/query-elements/full-query.js +0 -85
- package/dist/lang/ast/query-elements/query-head-struct.d.ts +0 -9
- package/dist/lang/ast/query-elements/query-head-struct.js +0 -48
- package/dist/lang/ast/query-items/field-declaration.d.ts +0 -31
- package/dist/lang/ast/query-items/field-declaration.js +0 -137
- package/dist/lang/ast/query-items/field-references.d.ts +0 -25
- package/dist/lang/ast/query-items/field-references.js +0 -80
- package/dist/lang/ast/query-properties/aggregate.d.ts +0 -5
- package/dist/lang/ast/query-properties/aggregate.js +0 -39
- package/dist/lang/ast/query-properties/declare-fields.d.ts +0 -5
- package/dist/lang/ast/query-properties/declare-fields.js +0 -33
- package/dist/lang/ast/query-properties/dimmensions.d.ts +0 -5
- package/dist/lang/ast/query-properties/dimmensions.js +0 -36
- package/dist/lang/ast/query-properties/filters.d.ts +0 -18
- package/dist/lang/ast/query-properties/filters.js +0 -89
- package/dist/lang/ast/query-properties/group-by.d.ts +0 -5
- package/dist/lang/ast/query-properties/group-by.js +0 -39
- package/dist/lang/ast/query-properties/indexing.d.ts +0 -10
- package/dist/lang/ast/query-properties/indexing.js +0 -39
- package/dist/lang/ast/query-properties/joins.d.ts +0 -36
- package/dist/lang/ast/query-properties/joins.js +0 -143
- package/dist/lang/ast/query-properties/limit.d.ts +0 -6
- package/dist/lang/ast/query-properties/limit.js +0 -35
- package/dist/lang/ast/query-properties/measures.d.ts +0 -5
- package/dist/lang/ast/query-properties/measures.js +0 -36
- package/dist/lang/ast/query-properties/nests.d.ts +0 -5
- package/dist/lang/ast/query-properties/nests.js +0 -33
- package/dist/lang/ast/query-properties/ordering.d.ts +0 -15
- package/dist/lang/ast/query-properties/ordering.js +0 -66
- package/dist/lang/ast/query-properties/project-statement.d.ts +0 -5
- package/dist/lang/ast/query-properties/project-statement.js +0 -33
- package/dist/lang/ast/query-properties/qop-desc.d.ts +0 -17
- package/dist/lang/ast/query-properties/qop-desc.js +0 -123
- package/dist/lang/ast/query-properties/sampling.d.ts +0 -8
- package/dist/lang/ast/query-properties/sampling.js +0 -38
- package/dist/lang/ast/query-properties/top.d.ts +0 -13
- package/dist/lang/ast/query-properties/top.js +0 -60
- package/dist/lang/ast/result-spaces/index-field-space.d.ts +0 -10
- package/dist/lang/ast/result-spaces/index-field-space.js +0 -57
- package/dist/lang/ast/result-spaces/project-field-space.d.ts +0 -6
- package/dist/lang/ast/result-spaces/project-field-space.js +0 -51
- package/dist/lang/ast/result-spaces/reduce-field-space.d.ts +0 -7
- package/dist/lang/ast/result-spaces/reduce-field-space.js +0 -37
- package/dist/lang/ast/sources/named-source.d.ts +0 -19
- package/dist/lang/ast/sources/named-source.js +0 -147
- package/dist/lang/ast/sources/query-source.d.ts +0 -9
- package/dist/lang/ast/sources/query-source.js +0 -41
- package/dist/lang/ast/sources/sql-source.d.ts +0 -7
- package/dist/lang/ast/sources/sql-source.js +0 -54
- package/dist/lang/ast/sources/table-source.d.ts +0 -8
- package/dist/lang/ast/sources/table-source.js +0 -60
- package/dist/lang/ast/space-fields/column-space-field.d.ts +0 -9
- package/dist/lang/ast/space-fields/column-space-field.js +0 -40
- package/dist/lang/ast/space-fields/join-space-field.d.ts +0 -8
- package/dist/lang/ast/space-fields/join-space-field.js +0 -35
- package/dist/lang/ast/space-fields/query-field-struct.d.ts +0 -10
- package/dist/lang/ast/space-fields/query-field-struct.js +0 -46
- package/dist/lang/ast/space-fields/query-space-field.d.ts +0 -11
- package/dist/lang/ast/space-fields/query-space-field.js +0 -37
- package/dist/lang/ast/space-fields/reference-field.d.ts +0 -11
- package/dist/lang/ast/space-fields/reference-field.js +0 -45
- package/dist/lang/ast/space-fields/rename-space-field.d.ts +0 -11
- package/dist/lang/ast/space-fields/rename-space-field.js +0 -50
- package/dist/lang/ast/space-fields/wild-space-field.d.ts +0 -10
- package/dist/lang/ast/space-fields/wild-space-field.js +0 -40
- package/dist/lang/ast/space-parameters/abstract-parameter.d.ts +0 -10
- package/dist/lang/ast/space-parameters/abstract-parameter.js +0 -41
- package/dist/lang/ast/space-parameters/defined-parameter.d.ts +0 -9
- package/dist/lang/ast/space-parameters/defined-parameter.js +0 -40
- package/dist/lang/ast/space-seed.d.ts +0 -17
- package/dist/lang/ast/space-seed.js +0 -59
- package/dist/lang/ast/sql-elements/sql-statement.d.ts +0 -19
- package/dist/lang/ast/sql-elements/sql-statement.js +0 -80
- package/dist/lang/ast/sql-elements/sql-string.d.ts +0 -12
- package/dist/lang/ast/sql-elements/sql-string.js +0 -60
- package/dist/lang/ast/static-space.d.ts +0 -33
- package/dist/lang/ast/static-space.js +0 -167
- package/dist/lang/ast/struct-utils.d.ts +0 -4
- package/dist/lang/ast/struct-utils.js +0 -48
- package/dist/lang/ast/time-utils.d.ts +0 -12
- package/dist/lang/ast/time-utils.js +0 -140
- package/dist/lang/ast/types/comparison.d.ts +0 -11
- package/dist/lang/ast/types/comparison.js +0 -41
- package/dist/lang/ast/types/compart-types.d.ts +0 -10
- package/dist/lang/ast/types/compart-types.js +0 -37
- package/dist/lang/ast/types/document-compile-result.d.ts +0 -8
- package/dist/lang/ast/types/document-compile-result.js +0 -25
- package/dist/lang/ast/types/equality.d.ts +0 -7
- package/dist/lang/ast/types/equality.js +0 -37
- package/dist/lang/ast/types/executor.d.ts +0 -9
- package/dist/lang/ast/types/executor.js +0 -25
- package/dist/lang/ast/types/explore-desc.d.ts +0 -5
- package/dist/lang/ast/types/explore-desc.js +0 -33
- package/dist/lang/ast/types/explore-field.d.ts +0 -5
- package/dist/lang/ast/types/explore-field.js +0 -32
- package/dist/lang/ast/types/explore-property.d.ts +0 -10
- package/dist/lang/ast/types/explore-property.js +0 -43
- package/dist/lang/ast/types/expr-result.d.ts +0 -5
- package/dist/lang/ast/types/expr-result.js +0 -25
- package/dist/lang/ast/types/expr-value.d.ts +0 -3
- package/dist/lang/ast/types/expr-value.js +0 -25
- package/dist/lang/ast/types/expression-def.d.ts +0 -69
- package/dist/lang/ast/types/expression-def.js +0 -346
- package/dist/lang/ast/types/expression-value-type.d.ts +0 -2
- package/dist/lang/ast/types/expression-value-type.js +0 -25
- package/dist/lang/ast/types/field-collection-member.d.ts +0 -5
- package/dist/lang/ast/types/field-collection-member.js +0 -34
- package/dist/lang/ast/types/field-decl.d.ts +0 -7
- package/dist/lang/ast/types/field-decl.js +0 -37
- package/dist/lang/ast/types/field-map.d.ts +0 -2
- package/dist/lang/ast/types/field-map.js +0 -25
- package/dist/lang/ast/types/field-space.d.ts +0 -26
- package/dist/lang/ast/types/field-space.js +0 -48
- package/dist/lang/ast/types/field-type.d.ts +0 -6
- package/dist/lang/ast/types/field-type.js +0 -25
- package/dist/lang/ast/types/field-value-type.d.ts +0 -3
- package/dist/lang/ast/types/field-value-type.js +0 -25
- package/dist/lang/ast/types/frag-type.d.ts +0 -6
- package/dist/lang/ast/types/frag-type.js +0 -25
- package/dist/lang/ast/types/granular-result.d.ts +0 -7
- package/dist/lang/ast/types/granular-result.js +0 -11
- package/dist/lang/ast/types/lookup-result.d.ts +0 -10
- package/dist/lang/ast/types/lookup-result.js +0 -25
- package/dist/lang/ast/types/malloy-element.d.ts +0 -105
- package/dist/lang/ast/types/malloy-element.js +0 -398
- package/dist/lang/ast/types/model-entry.d.ts +0 -6
- package/dist/lang/ast/types/model-entry.js +0 -25
- package/dist/lang/ast/types/name-space.d.ts +0 -5
- package/dist/lang/ast/types/name-space.js +0 -25
- package/dist/lang/ast/types/nested-query.d.ts +0 -3
- package/dist/lang/ast/types/nested-query.js +0 -25
- package/dist/lang/ast/types/op-desc.d.ts +0 -6
- package/dist/lang/ast/types/op-desc.js +0 -25
- package/dist/lang/ast/types/query-comp.d.ts +0 -5
- package/dist/lang/ast/types/query-comp.js +0 -25
- package/dist/lang/ast/types/query-element.d.ts +0 -5
- package/dist/lang/ast/types/query-element.js +0 -32
- package/dist/lang/ast/types/query-item.d.ts +0 -5
- package/dist/lang/ast/types/query-item.js +0 -25
- package/dist/lang/ast/types/query-property.d.ts +0 -17
- package/dist/lang/ast/types/query-property.js +0 -55
- package/dist/lang/ast/types/space-entry.d.ts +0 -5
- package/dist/lang/ast/types/space-entry.js +0 -29
- package/dist/lang/ast/types/space-field.d.ts +0 -10
- package/dist/lang/ast/types/space-field.js +0 -48
- package/dist/lang/ast/types/space-param.d.ts +0 -6
- package/dist/lang/ast/types/space-param.js +0 -34
- package/dist/lang/ast/types/stage-field-type.d.ts +0 -1
- package/dist/lang/ast/types/stage-field-type.js +0 -25
- package/dist/lang/ast/types/time-result.d.ts +0 -6
- package/dist/lang/ast/types/time-result.js +0 -25
- package/dist/lang/ast/types/turtle-headed-pipe.d.ts +0 -7
- package/dist/lang/ast/types/turtle-headed-pipe.js +0 -37
- package/dist/lang/field-utils.d.ts +0 -5
- package/dist/lang/field-utils.js +0 -43
- package/dist/lang/index.d.ts +0 -9
- package/dist/lang/index.js +0 -32
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +0 -165
- package/dist/lang/lib/Malloy/MalloyLexer.js +0 -1232
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +0 -1947
- package/dist/lang/lib/Malloy/MalloyParser.js +0 -11909
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +0 -2022
- package/dist/lang/lib/Malloy/MalloyParserListener.js +0 -4
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +0 -1274
- package/dist/lang/lib/Malloy/MalloyParserVisitor.js +0 -4
- package/dist/lang/parse-log.d.ts +0 -27
- package/dist/lang/parse-log.js +0 -51
- package/dist/lang/parse-malloy.d.ts +0 -236
- package/dist/lang/parse-malloy.js +0 -746
- package/dist/lang/parse-to-ast.d.ts +0 -155
- package/dist/lang/parse-to-ast.js +0 -990
- package/dist/lang/parse-tree-walkers/document-completion-walker.d.ts +0 -10
- package/dist/lang/parse-tree-walkers/document-completion-walker.js +0 -148
- package/dist/lang/parse-tree-walkers/document-help-context-walker.d.ts +0 -9
- package/dist/lang/parse-tree-walkers/document-help-context-walker.js +0 -107
- package/dist/lang/parse-tree-walkers/document-highlight-walker.d.ts +0 -83
- package/dist/lang/parse-tree-walkers/document-highlight-walker.js +0 -385
- package/dist/lang/parse-tree-walkers/document-symbol-walker.d.ts +0 -11
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +0 -182
- package/dist/lang/parse-tree-walkers/explore-query-walker.d.ts +0 -34
- package/dist/lang/parse-tree-walkers/explore-query-walker.js +0 -74
- package/dist/lang/parse-tree-walkers/find-external-references.d.ts +0 -11
- package/dist/lang/parse-tree-walkers/find-external-references.js +0 -61
- package/dist/lang/reference-list.d.ts +0 -10
- package/dist/lang/reference-list.js +0 -90
- package/dist/lang/space-field.d.ts +0 -20
- package/dist/lang/space-field.js +0 -128
- package/dist/lang/test/document-help-context-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-help-context-walker.spec.js +0 -55
- package/dist/lang/test/document-symbol-walker.spec.d.ts +0 -1
- package/dist/lang/test/document-symbol-walker.spec.js +0 -110
- package/dist/lang/test/field-symbols.spec.d.ts +0 -1
- package/dist/lang/test/field-symbols.spec.js +0 -184
- package/dist/lang/test/parse.spec.d.ts +0 -14
- package/dist/lang/test/parse.spec.js +0 -2135
- package/dist/lang/test/test-translator.d.ts +0 -40
- package/dist/lang/test/test-translator.js +0 -344
- package/dist/lang/zone.d.ts +0 -57
- package/dist/lang/zone.js +0 -107
- package/dist/malloy.d.ts +0 -1146
- package/dist/malloy.js +0 -2413
- package/dist/model/index.d.ts +0 -2
- package/dist/model/index.js +0 -45
- package/dist/model/malloy_query.d.ts +0 -351
- package/dist/model/malloy_query.js +0 -3174
- package/dist/model/malloy_types.d.ts +0 -551
- package/dist/model/malloy_types.js +0 -378
- package/dist/model/sql_block.d.ts +0 -7
- package/dist/model/sql_block.js +0 -56
- package/dist/model/utils.d.ts +0 -22
- package/dist/model/utils.js +0 -102
- package/dist/run_sql_options.d.ts +0 -3
- package/dist/run_sql_options.js +0 -25
- package/dist/runtime_types.d.ts +0 -105
- package/dist/runtime_types.js +0 -25
|
@@ -1,537 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.QuerySpace = exports.QueryFieldAST = exports.ExpressionFieldFromAst = exports.ResultSpace = exports.DynamicSpace = exports.isNestedQuery = exports.NestDefinition = exports.NestRefinement = exports.TurtleDecl = void 0;
|
|
27
|
-
/*
|
|
28
|
-
* Copyright 2023 Google LLC
|
|
29
|
-
*
|
|
30
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
31
|
-
* a copy of this software and associated documentation files
|
|
32
|
-
* (the "Software"), to deal in the Software without restriction,
|
|
33
|
-
* including without limitation the rights to use, copy, modify, merge,
|
|
34
|
-
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
35
|
-
* and to permit persons to whom the Software is furnished to do so,
|
|
36
|
-
* subject to the following conditions:
|
|
37
|
-
*
|
|
38
|
-
* The above copyright notice and this permission notice shall be
|
|
39
|
-
* included in all copies or substantial portions of the Software.
|
|
40
|
-
*
|
|
41
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
42
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
43
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
44
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
45
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
46
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
47
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
48
|
-
*/
|
|
49
|
-
const lodash_1 = require("lodash");
|
|
50
|
-
const model = __importStar(require("../../model/malloy_types"));
|
|
51
|
-
const field_utils_1 = require("../field-utils");
|
|
52
|
-
const error_factory_1 = require("./error-factory");
|
|
53
|
-
const renames_1 = require("./explore-properties/renames");
|
|
54
|
-
const field_declaration_1 = require("./query-items/field-declaration");
|
|
55
|
-
const field_references_1 = require("./query-items/field-references");
|
|
56
|
-
const nest_reference_1 = require("./nesting/nest-reference");
|
|
57
|
-
const joins_1 = require("./query-properties/joins");
|
|
58
|
-
const space_field_1 = require("./types/space-field");
|
|
59
|
-
const join_space_field_1 = require("./space-fields/join-space-field");
|
|
60
|
-
const query_space_field_1 = require("./space-fields/query-space-field");
|
|
61
|
-
const reference_field_1 = require("./space-fields/reference-field");
|
|
62
|
-
const rename_space_field_1 = require("./space-fields/rename-space-field");
|
|
63
|
-
const wild_space_field_1 = require("./space-fields/wild-space-field");
|
|
64
|
-
const space_param_1 = require("./types/space-param");
|
|
65
|
-
const abstract_parameter_1 = require("./space-parameters/abstract-parameter");
|
|
66
|
-
const space_seed_1 = require("./space-seed");
|
|
67
|
-
const static_space_1 = require("./static-space");
|
|
68
|
-
const struct_utils_1 = require("./struct-utils");
|
|
69
|
-
const turtle_headed_pipe_1 = require("./types/turtle-headed-pipe");
|
|
70
|
-
function isTurtle(fd) {
|
|
71
|
-
const ret = fd && typeof fd !== "string" && fd.type === "turtle";
|
|
72
|
-
return !!ret;
|
|
73
|
-
}
|
|
74
|
-
class TurtleDecl extends turtle_headed_pipe_1.TurtleHeadedPipe {
|
|
75
|
-
constructor(name) {
|
|
76
|
-
super();
|
|
77
|
-
this.name = name;
|
|
78
|
-
}
|
|
79
|
-
getPipeline(fs) {
|
|
80
|
-
const modelPipe = { pipeline: [] };
|
|
81
|
-
if (this.turtleName) {
|
|
82
|
-
const headEnt = this.turtleName.getField(fs);
|
|
83
|
-
let reportWrongType = true;
|
|
84
|
-
if (headEnt.error) {
|
|
85
|
-
this.log(headEnt.error);
|
|
86
|
-
reportWrongType = false;
|
|
87
|
-
}
|
|
88
|
-
else if (headEnt.found instanceof query_space_field_1.QueryField) {
|
|
89
|
-
const headDef = headEnt.found.getQueryFieldDef(fs);
|
|
90
|
-
if (isTurtle(headDef)) {
|
|
91
|
-
const newPipe = this.refinePipeline(fs, headDef);
|
|
92
|
-
modelPipe.pipeline = [...newPipe.pipeline];
|
|
93
|
-
reportWrongType = false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (reportWrongType) {
|
|
97
|
-
this.log(`Expected '${this.turtleName}' to be a query`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else if (this.headRefinement) {
|
|
101
|
-
throw this.internalError("Can't refine the head of a turtle in its definition");
|
|
102
|
-
}
|
|
103
|
-
let appendInput = fs;
|
|
104
|
-
if (modelPipe.pipeline.length > 0) {
|
|
105
|
-
let endStruct = appendInput.structDef();
|
|
106
|
-
for (const existingSeg of modelPipe.pipeline) {
|
|
107
|
-
endStruct = (0, struct_utils_1.opOutputStruct)(this, endStruct, existingSeg);
|
|
108
|
-
}
|
|
109
|
-
appendInput = new DynamicSpace(endStruct);
|
|
110
|
-
}
|
|
111
|
-
const appended = this.appendOps(modelPipe.pipeline, appendInput);
|
|
112
|
-
modelPipe.pipeline = appended.opList;
|
|
113
|
-
return modelPipe;
|
|
114
|
-
}
|
|
115
|
-
getFieldDef(fs, nestParent) {
|
|
116
|
-
if (nestParent) {
|
|
117
|
-
this.nestedInQuerySpace = nestParent;
|
|
118
|
-
}
|
|
119
|
-
const pipe = this.getPipeline(fs);
|
|
120
|
-
return {
|
|
121
|
-
type: "turtle",
|
|
122
|
-
name: this.name,
|
|
123
|
-
...pipe,
|
|
124
|
-
location: this.location,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.TurtleDecl = TurtleDecl;
|
|
129
|
-
class NestRefinement extends TurtleDecl {
|
|
130
|
-
constructor(turtleName) {
|
|
131
|
-
super(turtleName.refString);
|
|
132
|
-
this.elementType = "nestRefinement";
|
|
133
|
-
this.turtleName = turtleName;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
exports.NestRefinement = NestRefinement;
|
|
137
|
-
class NestDefinition extends TurtleDecl {
|
|
138
|
-
constructor(name) {
|
|
139
|
-
super(name);
|
|
140
|
-
this.elementType = "nestDefinition";
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
exports.NestDefinition = NestDefinition;
|
|
144
|
-
function isNestedQuery(me) {
|
|
145
|
-
return (me instanceof NestRefinement ||
|
|
146
|
-
me instanceof nest_reference_1.NestReference ||
|
|
147
|
-
me instanceof NestDefinition);
|
|
148
|
-
}
|
|
149
|
-
exports.isNestedQuery = isNestedQuery;
|
|
150
|
-
/**
|
|
151
|
-
* A FieldSpace which may undergo modification
|
|
152
|
-
*/
|
|
153
|
-
class DynamicSpace extends static_space_1.StaticSpace {
|
|
154
|
-
constructor(extending) {
|
|
155
|
-
const source = new space_seed_1.SpaceSeed(extending);
|
|
156
|
-
super((0, lodash_1.cloneDeep)(source.structDef));
|
|
157
|
-
this.completions = [];
|
|
158
|
-
this.complete = false;
|
|
159
|
-
this.final = undefined;
|
|
160
|
-
this.source = source;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Factory for DynamicSpace when there are accept/except edits
|
|
164
|
-
* @param from A structdef which seeds this space
|
|
165
|
-
* @param choose A accept/except edit of the "from" fields
|
|
166
|
-
*/
|
|
167
|
-
static filteredFrom(from, choose) {
|
|
168
|
-
const edited = new DynamicSpace(from);
|
|
169
|
-
if (choose) {
|
|
170
|
-
const names = choose.refs.list;
|
|
171
|
-
const oldMap = edited.entries();
|
|
172
|
-
edited.dropEntries();
|
|
173
|
-
for (const [symbol, value] of oldMap) {
|
|
174
|
-
const included = !!names.find((f) => f.refString === symbol);
|
|
175
|
-
const accepting = choose.edit === "accept";
|
|
176
|
-
if (included === accepting) {
|
|
177
|
-
edited.setEntry(symbol, value);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return edited;
|
|
182
|
-
}
|
|
183
|
-
whenComplete(finalizeStep) {
|
|
184
|
-
if (this.complete) {
|
|
185
|
-
finalizeStep();
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
this.completions.push(finalizeStep);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
isComplete() {
|
|
192
|
-
this.complete = true;
|
|
193
|
-
for (const step of this.completions) {
|
|
194
|
-
step();
|
|
195
|
-
}
|
|
196
|
-
this.completions = [];
|
|
197
|
-
}
|
|
198
|
-
setEntry(name, value) {
|
|
199
|
-
if (this.final) {
|
|
200
|
-
throw new Error("Space already final");
|
|
201
|
-
}
|
|
202
|
-
super.setEntry(name, value);
|
|
203
|
-
}
|
|
204
|
-
addParameters(params) {
|
|
205
|
-
for (const oneP of params) {
|
|
206
|
-
this.setEntry(oneP.name, new abstract_parameter_1.AbstractParameter(oneP));
|
|
207
|
-
}
|
|
208
|
-
return this;
|
|
209
|
-
}
|
|
210
|
-
newEntry(name, astEl, entry) {
|
|
211
|
-
if (this.entry(name)) {
|
|
212
|
-
astEl.log(`Cannot redefine '${name}'`);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
this.setEntry(name, entry);
|
|
216
|
-
}
|
|
217
|
-
addField(...defs) {
|
|
218
|
-
for (const def of defs) {
|
|
219
|
-
// TODO express the "three fields kinds" in a typesafe way
|
|
220
|
-
// one of three kinds of fields are legal in an explore: expressions ...
|
|
221
|
-
const elseLog = def.log;
|
|
222
|
-
const elseType = def.elementType;
|
|
223
|
-
if (def instanceof field_declaration_1.FieldDeclaration) {
|
|
224
|
-
const exprField = new ExpressionFieldFromAst(this, def);
|
|
225
|
-
this.newEntry(exprField.name, def, exprField);
|
|
226
|
-
// querry (turtle) fields
|
|
227
|
-
}
|
|
228
|
-
else if (def instanceof TurtleDecl) {
|
|
229
|
-
const name = def.name;
|
|
230
|
-
this.newEntry(name, def, new QueryFieldAST(this, def, name));
|
|
231
|
-
}
|
|
232
|
-
else if (def instanceof renames_1.RenameField) {
|
|
233
|
-
if (def.oldName.refString === def.newName) {
|
|
234
|
-
def.log("Can't rename field to itself");
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
const oldValue = def.oldName.getField(this);
|
|
238
|
-
if (oldValue.found) {
|
|
239
|
-
if (oldValue.found instanceof space_field_1.SpaceField) {
|
|
240
|
-
this.setEntry(def.newName, new rename_space_field_1.RenameSpaceField(oldValue.found, def.newName, def.location));
|
|
241
|
-
this.dropEntry(def.oldName.refString);
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
def.log(`'${def.oldName}' cannot be renamed`);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
def.log(`Can't rename '${def.oldName}', no such field`);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
else if (def instanceof joins_1.Join) {
|
|
252
|
-
this.newEntry(def.name.refString, def, new join_space_field_1.JoinSpaceField(this, def));
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
elseLog(`Internal error: Expected expression, query, or rename, got '${elseType}'`);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
addFieldDef(fd) {
|
|
260
|
-
this.setEntry((0, field_utils_1.nameOf)(fd), this.fromFieldDef(fd));
|
|
261
|
-
}
|
|
262
|
-
structDef() {
|
|
263
|
-
const parameters = this.fromStruct.parameters || {};
|
|
264
|
-
if (this.final === undefined) {
|
|
265
|
-
this.final = {
|
|
266
|
-
...this.fromStruct,
|
|
267
|
-
fields: [],
|
|
268
|
-
};
|
|
269
|
-
// Need to process the entities in specific order
|
|
270
|
-
const fields = [];
|
|
271
|
-
const joins = [];
|
|
272
|
-
const turtles = [];
|
|
273
|
-
const fixupJoins = [];
|
|
274
|
-
for (const [name, spaceEntry] of this.entries()) {
|
|
275
|
-
if (spaceEntry instanceof static_space_1.StructSpaceField) {
|
|
276
|
-
joins.push([name, spaceEntry]);
|
|
277
|
-
}
|
|
278
|
-
else if (spaceEntry instanceof query_space_field_1.QueryField) {
|
|
279
|
-
turtles.push([name, spaceEntry]);
|
|
280
|
-
}
|
|
281
|
-
else if (spaceEntry instanceof space_field_1.SpaceField) {
|
|
282
|
-
fields.push([name, spaceEntry]);
|
|
283
|
-
}
|
|
284
|
-
else if (spaceEntry instanceof space_param_1.SpaceParam) {
|
|
285
|
-
parameters[name] = spaceEntry.parameter();
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
const reorderFields = [...fields, ...joins, ...turtles];
|
|
289
|
-
for (const [fieldName, field] of reorderFields) {
|
|
290
|
-
if (field instanceof join_space_field_1.JoinSpaceField) {
|
|
291
|
-
const joinStruct = field.join.structDef();
|
|
292
|
-
if (!error_factory_1.ErrorFactory.isErrorStructDef(joinStruct)) {
|
|
293
|
-
this.final.fields.push(joinStruct);
|
|
294
|
-
fixupJoins.push([field.join, joinStruct]);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
else {
|
|
298
|
-
const fieldDef = field.fieldDef();
|
|
299
|
-
if (fieldDef) {
|
|
300
|
-
this.final.fields.push(fieldDef);
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
throw new Error(`'${fieldName}' doesn't have a FieldDef`);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
if (Object.entries(parameters).length > 0) {
|
|
308
|
-
this.final.parameters = parameters;
|
|
309
|
-
}
|
|
310
|
-
// If we have join expressions, we need to now go back and fill them in
|
|
311
|
-
for (const [join, missingOn] of fixupJoins) {
|
|
312
|
-
join.fixupJoinOn(this, missingOn);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
this.isComplete();
|
|
316
|
-
return this.final;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
exports.DynamicSpace = DynamicSpace;
|
|
320
|
-
class ResultSpace extends DynamicSpace {
|
|
321
|
-
constructor(queryInputSpace) {
|
|
322
|
-
super(queryInputSpace.emptyStructDef());
|
|
323
|
-
this.queryInputSpace = queryInputSpace;
|
|
324
|
-
this.exprSpace = new QuerySpace(queryInputSpace, this);
|
|
325
|
-
}
|
|
326
|
-
log(s) {
|
|
327
|
-
if (this.astEl) {
|
|
328
|
-
this.astEl.log(s);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
addMembers(members) {
|
|
332
|
-
for (const member of members) {
|
|
333
|
-
if (member instanceof field_references_1.FieldReference) {
|
|
334
|
-
this.addReference(member);
|
|
335
|
-
}
|
|
336
|
-
else if (member instanceof field_references_1.WildcardFieldReference) {
|
|
337
|
-
this.addWild(member);
|
|
338
|
-
}
|
|
339
|
-
else {
|
|
340
|
-
this.addField(member);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
addReference(ref) {
|
|
345
|
-
const refName = ref.outputName;
|
|
346
|
-
if (this.entry(refName)) {
|
|
347
|
-
ref.log(`Output already has a field named '${refName}'`);
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
this.setEntry(refName, new reference_field_1.ReferenceField(ref));
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
addWild(wild) {
|
|
354
|
-
this.setEntry(wild.refString, new wild_space_field_1.WildSpaceField(wild.refString));
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Check for the definition of an ungrouping reference in the result space,
|
|
358
|
-
* or in the case of an exclude reference, if this query is nested
|
|
359
|
-
* in another query, in the result space of a query that this query
|
|
360
|
-
* is nested inside of.
|
|
361
|
-
*/
|
|
362
|
-
checkUngroup(fn, isExclude) {
|
|
363
|
-
if (!this.entry(fn.refString)) {
|
|
364
|
-
if (isExclude && this.exprSpace.nestParent) {
|
|
365
|
-
const parent = this.exprSpace.nestParent;
|
|
366
|
-
parent.whenComplete(() => {
|
|
367
|
-
parent.result.checkUngroup(fn, isExclude);
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
const uName = isExclude ? "exclude()" : "all()";
|
|
372
|
-
fn.log(`${uName} '${fn.refString}' is missing from query output`);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
addQueryItems(...qiList) {
|
|
377
|
-
for (const qi of qiList) {
|
|
378
|
-
if (qi instanceof field_references_1.FieldReference || qi instanceof nest_reference_1.NestReference) {
|
|
379
|
-
this.addReference(qi);
|
|
380
|
-
}
|
|
381
|
-
else if (qi instanceof field_declaration_1.FieldDeclaration) {
|
|
382
|
-
this.addField(qi);
|
|
383
|
-
}
|
|
384
|
-
else if (isNestedQuery(qi)) {
|
|
385
|
-
const qf = new QueryFieldAST(this, qi, qi.name);
|
|
386
|
-
qf.nestParent = this.exprSpace;
|
|
387
|
-
this.setEntry(qi.name, qf);
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
// Compiler will error if we don't handle all cases
|
|
391
|
-
const _itemNotHandled = qi;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
canContain(_qd) {
|
|
396
|
-
return true;
|
|
397
|
-
}
|
|
398
|
-
queryFieldDefs() {
|
|
399
|
-
const fields = [];
|
|
400
|
-
for (const [name, field] of this.entries()) {
|
|
401
|
-
if (field instanceof space_field_1.SpaceField) {
|
|
402
|
-
const fieldQueryDef = field.getQueryFieldDef(this.exprSpace);
|
|
403
|
-
if (fieldQueryDef) {
|
|
404
|
-
if (this.canContain(fieldQueryDef)) {
|
|
405
|
-
fields.push(fieldQueryDef);
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
this.log(`'${name}' not legal in ${this.segmentType}`);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
else {
|
|
412
|
-
throw new Error(`'${name}' does not have a QueryFieldDef`);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
this.isComplete();
|
|
417
|
-
return fields;
|
|
418
|
-
}
|
|
419
|
-
getQuerySegment(rf) {
|
|
420
|
-
const p = this.getPipeSegment(rf);
|
|
421
|
-
if (model.isQuerySegment(p)) {
|
|
422
|
-
return p;
|
|
423
|
-
}
|
|
424
|
-
throw new Error("TODO NOT POSSIBLE");
|
|
425
|
-
}
|
|
426
|
-
getPipeSegment(refineFrom) {
|
|
427
|
-
if (this.segmentType == "index") {
|
|
428
|
-
// TODO ... should make this go away
|
|
429
|
-
throw new Error("INDEX FIELD PIPE SEGMENT MIS HANDLED");
|
|
430
|
-
}
|
|
431
|
-
if (refineFrom === null || refineFrom === void 0 ? void 0 : refineFrom.extendSource) {
|
|
432
|
-
for (const xField of refineFrom.extendSource) {
|
|
433
|
-
this.exprSpace.addFieldDef(xField);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
const segment = {
|
|
437
|
-
type: this.segmentType,
|
|
438
|
-
fields: this.queryFieldDefs(),
|
|
439
|
-
};
|
|
440
|
-
segment.fields = (0, field_utils_1.mergeFields)(refineFrom === null || refineFrom === void 0 ? void 0 : refineFrom.fields, segment.fields);
|
|
441
|
-
if (refineFrom === null || refineFrom === void 0 ? void 0 : refineFrom.extendSource) {
|
|
442
|
-
segment.extendSource = refineFrom.extendSource;
|
|
443
|
-
}
|
|
444
|
-
if (this.exprSpace.extendList.length > 0) {
|
|
445
|
-
const newExtends = [];
|
|
446
|
-
const extendedStruct = this.exprSpace.structDef();
|
|
447
|
-
for (const extendName of this.exprSpace.extendList) {
|
|
448
|
-
const extendEnt = extendedStruct.fields.find((f) => (0, field_utils_1.nameOf)(f) == extendName);
|
|
449
|
-
if (extendEnt) {
|
|
450
|
-
newExtends.push(extendEnt);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
segment.extendSource = (0, field_utils_1.mergeFields)(segment.extendSource, newExtends);
|
|
454
|
-
}
|
|
455
|
-
this.isComplete();
|
|
456
|
-
return segment;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
exports.ResultSpace = ResultSpace;
|
|
460
|
-
class ExpressionFieldFromAst extends space_field_1.SpaceField {
|
|
461
|
-
constructor(space, exprDef) {
|
|
462
|
-
super();
|
|
463
|
-
this.space = space;
|
|
464
|
-
this.exprDef = exprDef;
|
|
465
|
-
this.fieldName = exprDef.defineName;
|
|
466
|
-
}
|
|
467
|
-
get name() {
|
|
468
|
-
return this.fieldName;
|
|
469
|
-
}
|
|
470
|
-
fieldDef() {
|
|
471
|
-
const def = this.exprDef.fieldDef(this.space, this.name);
|
|
472
|
-
this.defType = this.fieldTypeFromFieldDef(def);
|
|
473
|
-
return def;
|
|
474
|
-
}
|
|
475
|
-
getQueryFieldDef(fs) {
|
|
476
|
-
const def = this.exprDef.queryFieldDef(fs, this.name);
|
|
477
|
-
this.defType = this.fieldTypeFromFieldDef(def);
|
|
478
|
-
return def;
|
|
479
|
-
}
|
|
480
|
-
type() {
|
|
481
|
-
if (this.defType) {
|
|
482
|
-
return this.defType;
|
|
483
|
-
}
|
|
484
|
-
return this.fieldTypeFromFieldDef(this.fieldDef());
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
exports.ExpressionFieldFromAst = ExpressionFieldFromAst;
|
|
488
|
-
class QueryFieldAST extends query_space_field_1.QueryField {
|
|
489
|
-
constructor(fs, turtle, name) {
|
|
490
|
-
super(fs);
|
|
491
|
-
this.turtle = turtle;
|
|
492
|
-
this.name = name;
|
|
493
|
-
}
|
|
494
|
-
getQueryFieldDef(fs) {
|
|
495
|
-
const def = this.turtle.getFieldDef(fs, this.nestParent);
|
|
496
|
-
if (this.renameAs) {
|
|
497
|
-
def.as = this.renameAs;
|
|
498
|
-
}
|
|
499
|
-
return def;
|
|
500
|
-
}
|
|
501
|
-
fieldDef() {
|
|
502
|
-
const def = this.turtle.getFieldDef(this.inSpace, this.nestParent);
|
|
503
|
-
if (this.renameAs) {
|
|
504
|
-
def.as = this.renameAs;
|
|
505
|
-
}
|
|
506
|
-
return def;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
exports.QueryFieldAST = QueryFieldAST;
|
|
510
|
-
/**
|
|
511
|
-
* Unlike a source, which is a refinement of a namespace, a query
|
|
512
|
-
* is creating a new unrelated namespace. The query starts with a
|
|
513
|
-
* source, which it might modify. This set of fields used to resolve
|
|
514
|
-
* expressions in the query is called the "input space". There is a
|
|
515
|
-
* specialized QuerySpace for each type of query operation.
|
|
516
|
-
*
|
|
517
|
-
* The query output is managed by an instance of ResultSpace.
|
|
518
|
-
*/
|
|
519
|
-
class QuerySpace extends DynamicSpace {
|
|
520
|
-
constructor(input, result) {
|
|
521
|
-
const inputSpace = new space_seed_1.SpaceSeed(input);
|
|
522
|
-
super(inputSpace.structDef);
|
|
523
|
-
this.result = result;
|
|
524
|
-
this.extendList = [];
|
|
525
|
-
}
|
|
526
|
-
extendSource(extendField) {
|
|
527
|
-
this.addField(extendField);
|
|
528
|
-
if (extendField instanceof joins_1.Join) {
|
|
529
|
-
this.extendList.push(extendField.name.refString);
|
|
530
|
-
}
|
|
531
|
-
else {
|
|
532
|
-
this.extendList.push(extendField.defineName);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
exports.QuerySpace = QuerySpace;
|
|
537
|
-
//# sourceMappingURL=ast-main.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ExprValue } from "./types/expr-value";
|
|
2
|
-
/**
|
|
3
|
-
* When a translation hits an error, log and return one of these as a value.
|
|
4
|
-
* This will allow the rest of the translation walk to complete. The
|
|
5
|
-
* generated SQL will have a reference to an impossible variable name
|
|
6
|
-
* with the reason embedded in it.
|
|
7
|
-
* @param reason very short phrase, only read by implementers
|
|
8
|
-
* @returns Fragment[] which a debugging humnan will regognize
|
|
9
|
-
*/
|
|
10
|
-
export declare function errorFor(reason: string): ExprValue;
|
|
@@ -1,42 +0,0 @@
|
|
|
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.errorFor = void 0;
|
|
26
|
-
/**
|
|
27
|
-
* When a translation hits an error, log and return one of these as a value.
|
|
28
|
-
* This will allow the rest of the translation walk to complete. The
|
|
29
|
-
* generated SQL will have a reference to an impossible variable name
|
|
30
|
-
* with the reason embedded in it.
|
|
31
|
-
* @param reason very short phrase, only read by implementers
|
|
32
|
-
* @returns Fragment[] which a debugging humnan will regognize
|
|
33
|
-
*/
|
|
34
|
-
function errorFor(reason) {
|
|
35
|
-
return {
|
|
36
|
-
dataType: "unknown",
|
|
37
|
-
expressionType: "scalar",
|
|
38
|
-
value: [`_ERROR_${reason.replace(/ /g, "_")}`],
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
exports.errorFor = errorFor;
|
|
42
|
-
//# sourceMappingURL=ast-utils.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ModelDataRequest } from "../../parse-malloy";
|
|
2
|
-
import { DocStatement, Document, MalloyElement, RunList } from "../types/malloy-element";
|
|
3
|
-
import { HasParameter } from "../parameters/has-parameter";
|
|
4
|
-
import { Mallobj } from "./mallobj";
|
|
5
|
-
export declare class DefineExplore extends MalloyElement implements DocStatement {
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly mallobj: Mallobj;
|
|
8
|
-
readonly exported: boolean;
|
|
9
|
-
elementType: string;
|
|
10
|
-
readonly parameters?: HasParameter[];
|
|
11
|
-
constructor(name: string, mallobj: Mallobj, exported: boolean, params?: MalloyElement[]);
|
|
12
|
-
execute(doc: Document): ModelDataRequest;
|
|
13
|
-
}
|
|
14
|
-
export declare class DefineSourceList extends RunList implements DocStatement {
|
|
15
|
-
constructor(sourceList: DefineExplore[]);
|
|
16
|
-
execute(doc: Document): ModelDataRequest;
|
|
17
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
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.DefineSourceList = exports.DefineExplore = void 0;
|
|
26
|
-
const malloy_element_1 = require("../types/malloy-element");
|
|
27
|
-
const has_parameter_1 = require("../parameters/has-parameter");
|
|
28
|
-
const error_factory_1 = require("../error-factory");
|
|
29
|
-
class DefineExplore extends malloy_element_1.MalloyElement {
|
|
30
|
-
constructor(name, mallobj, exported, params) {
|
|
31
|
-
super({ explore: mallobj });
|
|
32
|
-
this.name = name;
|
|
33
|
-
this.mallobj = mallobj;
|
|
34
|
-
this.exported = exported;
|
|
35
|
-
this.elementType = "defineExplore";
|
|
36
|
-
if (params) {
|
|
37
|
-
this.parameters = [];
|
|
38
|
-
for (const el of params) {
|
|
39
|
-
if (el instanceof has_parameter_1.HasParameter) {
|
|
40
|
-
this.parameters.push(el);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
this.log(`Unexpected element type in define statement: ${el.elementType}`);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
this.has({ parameters: this.parameters });
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
execute(doc) {
|
|
50
|
-
if (doc.modelEntry(this.name)) {
|
|
51
|
-
this.log(`Cannot redefine '${this.name}'`);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
const structDef = this.mallobj.withParameters(this.parameters);
|
|
55
|
-
if (error_factory_1.ErrorFactory.isErrorStructDef(structDef)) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
doc.setEntry(this.name, {
|
|
59
|
-
entry: {
|
|
60
|
-
...structDef,
|
|
61
|
-
as: this.name,
|
|
62
|
-
location: this.location,
|
|
63
|
-
},
|
|
64
|
-
exported: this.exported,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.DefineExplore = DefineExplore;
|
|
70
|
-
class DefineSourceList extends malloy_element_1.RunList {
|
|
71
|
-
constructor(sourceList) {
|
|
72
|
-
super("defineSources", sourceList);
|
|
73
|
-
}
|
|
74
|
-
execute(doc) {
|
|
75
|
-
return this.executeList(doc);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.DefineSourceList = DefineSourceList;
|
|
79
|
-
//# sourceMappingURL=define-explore.js.map
|