@uwdata/mosaic-sql 0.16.2 → 0.18.0
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/LICENSE +1 -1
- package/README.md +0 -2
- package/dist/src/ast/aggregate.d.ts +82 -0
- package/dist/src/ast/aggregate.d.ts.map +1 -0
- package/dist/src/ast/aggregate.js +180 -0
- package/dist/src/ast/aggregate.js.map +1 -0
- package/dist/src/ast/between-op.d.ts +46 -0
- package/dist/src/ast/between-op.d.ts.map +1 -0
- package/dist/src/ast/between-op.js +60 -0
- package/dist/src/ast/between-op.js.map +1 -0
- package/dist/src/ast/binary-op.d.ts +21 -0
- package/dist/src/ast/binary-op.d.ts.map +1 -0
- package/dist/src/ast/binary-op.js +29 -0
- package/dist/src/ast/binary-op.js.map +1 -0
- package/dist/src/ast/case.d.ts +53 -0
- package/dist/src/ast/case.d.ts.map +1 -0
- package/dist/src/ast/case.js +75 -0
- package/dist/src/ast/case.js.map +1 -0
- package/dist/src/ast/cast.d.ts +18 -0
- package/dist/src/ast/cast.d.ts.map +1 -0
- package/dist/src/ast/cast.js +26 -0
- package/dist/src/ast/cast.js.map +1 -0
- package/dist/src/ast/collate.d.ts +18 -0
- package/dist/src/ast/collate.d.ts.map +1 -0
- package/dist/src/ast/collate.js +25 -0
- package/dist/src/ast/collate.js.map +1 -0
- package/dist/src/ast/column-param.d.ts +23 -0
- package/dist/src/ast/column-param.d.ts.map +1 -0
- package/dist/src/ast/column-param.js +29 -0
- package/dist/src/ast/column-param.js.map +1 -0
- package/dist/src/ast/column-ref.d.ts +40 -0
- package/dist/src/ast/column-ref.d.ts.map +1 -0
- package/dist/src/ast/column-ref.js +58 -0
- package/dist/src/ast/column-ref.js.map +1 -0
- package/dist/src/ast/fragment.d.ts +20 -0
- package/dist/src/ast/fragment.d.ts.map +1 -0
- package/dist/src/ast/fragment.js +26 -0
- package/dist/src/ast/fragment.js.map +1 -0
- package/dist/src/ast/from.d.ts +22 -0
- package/dist/src/ast/from.d.ts.map +1 -0
- package/dist/src/ast/from.js +37 -0
- package/dist/src/ast/from.js.map +1 -0
- package/dist/src/ast/function.d.ts +18 -0
- package/dist/src/ast/function.d.ts.map +1 -0
- package/dist/src/ast/function.js +26 -0
- package/dist/src/ast/function.js.map +1 -0
- package/dist/src/ast/in-op.d.ts +18 -0
- package/dist/src/ast/in-op.d.ts.map +1 -0
- package/dist/src/ast/in-op.js +25 -0
- package/dist/src/ast/in-op.js.map +1 -0
- package/dist/src/ast/interval.d.ts +18 -0
- package/dist/src/ast/interval.d.ts.map +1 -0
- package/dist/src/ast/interval.js +25 -0
- package/dist/src/ast/interval.js.map +1 -0
- package/dist/src/ast/literal.d.ts +16 -0
- package/dist/src/ast/literal.d.ts.map +1 -0
- package/dist/src/ast/literal.js +53 -0
- package/dist/src/ast/literal.js.map +1 -0
- package/dist/src/ast/logical-op.d.ts +32 -0
- package/dist/src/ast/logical-op.d.ts.map +1 -0
- package/dist/src/ast/logical-op.js +46 -0
- package/dist/src/ast/logical-op.js.map +1 -0
- package/dist/src/ast/node.d.ts +25 -0
- package/dist/src/ast/node.d.ts.map +1 -0
- package/dist/src/ast/node.js +36 -0
- package/dist/src/ast/node.js.map +1 -0
- package/dist/src/ast/order-by.d.ts +21 -0
- package/dist/src/ast/order-by.d.ts.map +1 -0
- package/dist/src/ast/order-by.js +36 -0
- package/dist/src/ast/order-by.js.map +1 -0
- package/dist/{types → src}/ast/param.d.ts +11 -11
- package/dist/src/ast/param.d.ts.map +1 -0
- package/dist/src/ast/param.js +28 -0
- package/dist/src/ast/param.js.map +1 -0
- package/dist/src/ast/query.d.ts +294 -0
- package/dist/src/ast/query.d.ts.map +1 -0
- package/dist/src/ast/query.js +584 -0
- package/dist/src/ast/query.js.map +1 -0
- package/dist/src/ast/sample.d.ts +27 -0
- package/dist/src/ast/sample.d.ts.map +1 -0
- package/dist/src/ast/sample.js +38 -0
- package/dist/src/ast/sample.js.map +1 -0
- package/dist/src/ast/select.d.ts +19 -0
- package/dist/src/ast/select.d.ts.map +1 -0
- package/dist/src/ast/select.js +35 -0
- package/dist/src/ast/select.js.map +1 -0
- package/dist/src/ast/subquery.d.ts +16 -0
- package/dist/src/ast/subquery.d.ts.map +1 -0
- package/dist/src/ast/subquery.js +21 -0
- package/dist/src/ast/subquery.js.map +1 -0
- package/dist/src/ast/table-ref.d.ts +24 -0
- package/dist/src/ast/table-ref.d.ts.map +1 -0
- package/dist/src/ast/table-ref.js +35 -0
- package/dist/src/ast/table-ref.js.map +1 -0
- package/dist/src/ast/unary-op.d.ts +40 -0
- package/dist/src/ast/unary-op.d.ts.map +1 -0
- package/dist/src/ast/unary-op.js +52 -0
- package/dist/src/ast/unary-op.js.map +1 -0
- package/dist/src/ast/verbatim.d.ts +18 -0
- package/dist/src/ast/verbatim.d.ts.map +1 -0
- package/dist/src/ast/verbatim.js +25 -0
- package/dist/src/ast/verbatim.js.map +1 -0
- package/dist/src/ast/window-frame.d.ts +54 -0
- package/dist/src/ast/window-frame.d.ts.map +1 -0
- package/dist/src/ast/window-frame.js +79 -0
- package/dist/src/ast/window-frame.js.map +1 -0
- package/dist/src/ast/window.d.ts +128 -0
- package/dist/src/ast/window.d.ts.map +1 -0
- package/dist/src/ast/window.js +194 -0
- package/dist/src/ast/window.js.map +1 -0
- package/dist/{types → src}/ast/with.d.ts +15 -22
- package/dist/src/ast/with.d.ts.map +1 -0
- package/dist/src/ast/with.js +36 -0
- package/dist/src/ast/with.js.map +1 -0
- package/dist/src/constants.d.ts +38 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +38 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/functions/aggregate.d.ts +236 -0
- package/dist/src/functions/aggregate.d.ts.map +1 -0
- package/dist/src/functions/aggregate.js +308 -0
- package/dist/src/functions/aggregate.js.map +1 -0
- package/dist/{types → src}/functions/case.d.ts +7 -7
- package/dist/src/functions/case.d.ts.map +1 -0
- package/dist/src/functions/case.js +17 -0
- package/dist/src/functions/case.js.map +1 -0
- package/dist/src/functions/cast.d.ts +23 -0
- package/dist/src/functions/cast.d.ts.map +1 -0
- package/dist/src/functions/cast.js +32 -0
- package/dist/src/functions/cast.js.map +1 -0
- package/dist/src/functions/collate.d.ts +10 -0
- package/dist/src/functions/collate.d.ts.map +1 -0
- package/dist/src/functions/collate.js +12 -0
- package/dist/src/functions/collate.js.map +1 -0
- package/dist/src/functions/column.d.ts +10 -0
- package/dist/src/functions/column.d.ts.map +1 -0
- package/dist/src/functions/column.js +17 -0
- package/dist/src/functions/column.js.map +1 -0
- package/dist/{types → src}/functions/cte.d.ts +7 -7
- package/dist/src/functions/cte.d.ts.map +1 -0
- package/dist/src/functions/cte.js +14 -0
- package/dist/src/functions/cte.js.map +1 -0
- package/dist/src/functions/datetime.d.ts +32 -0
- package/dist/src/functions/datetime.d.ts.map +1 -0
- package/dist/src/functions/datetime.js +45 -0
- package/dist/src/functions/datetime.js.map +1 -0
- package/dist/src/functions/interval.d.ts +48 -0
- package/dist/src/functions/interval.d.ts.map +1 -0
- package/dist/src/functions/interval.js +66 -0
- package/dist/src/functions/interval.js.map +1 -0
- package/dist/{types → src}/functions/literal.d.ts +8 -8
- package/dist/src/functions/literal.d.ts.map +1 -0
- package/dist/src/functions/literal.js +20 -0
- package/dist/src/functions/literal.js.map +1 -0
- package/dist/src/functions/numeric.d.ts +80 -0
- package/dist/src/functions/numeric.d.ts.map +1 -0
- package/dist/src/functions/numeric.js +110 -0
- package/dist/src/functions/numeric.js.map +1 -0
- package/dist/src/functions/operators.d.ts +169 -0
- package/dist/src/functions/operators.d.ts.map +1 -0
- package/dist/src/functions/operators.js +235 -0
- package/dist/src/functions/operators.js.map +1 -0
- package/dist/src/functions/order-by.d.ts +15 -0
- package/dist/src/functions/order-by.d.ts.map +1 -0
- package/dist/src/functions/order-by.js +19 -0
- package/dist/src/functions/order-by.js.map +1 -0
- package/dist/src/functions/spatial.d.ts +32 -0
- package/dist/src/functions/spatial.d.ts.map +1 -0
- package/dist/src/functions/spatial.js +44 -0
- package/dist/src/functions/spatial.js.map +1 -0
- package/dist/{types → src}/functions/sql-template-tag.d.ts +8 -10
- package/dist/src/functions/sql-template-tag.d.ts.map +1 -0
- package/dist/src/functions/sql-template-tag.js +44 -0
- package/dist/src/functions/sql-template-tag.js.map +1 -0
- package/dist/src/functions/string.d.ts +49 -0
- package/dist/src/functions/string.d.ts.map +1 -0
- package/dist/src/functions/string.js +67 -0
- package/dist/src/functions/string.js.map +1 -0
- package/dist/src/functions/table-ref.d.ts +10 -0
- package/dist/src/functions/table-ref.d.ts.map +1 -0
- package/dist/src/functions/table-ref.js +13 -0
- package/dist/src/functions/table-ref.js.map +1 -0
- package/dist/src/functions/util.d.ts +7 -0
- package/dist/src/functions/util.d.ts.map +1 -0
- package/dist/src/functions/util.js +9 -0
- package/dist/src/functions/util.js.map +1 -0
- package/dist/src/functions/window-frame.d.ts +41 -0
- package/dist/src/functions/window-frame.d.ts.map +1 -0
- package/dist/src/functions/window-frame.js +52 -0
- package/dist/src/functions/window-frame.js.map +1 -0
- package/dist/{types → src}/functions/window.d.ts +24 -39
- package/dist/src/functions/window.d.ts.map +1 -0
- package/dist/src/functions/window.js +96 -0
- package/dist/src/functions/window.js.map +1 -0
- package/dist/src/index.d.ts +69 -0
- package/dist/src/index.d.ts.map +1 -0
- package/{src → dist/src}/index.js +16 -12
- package/dist/src/index.js.map +1 -0
- package/dist/src/load/create.d.ts +10 -0
- package/dist/src/load/create.d.ts.map +1 -0
- package/dist/src/load/create.js +14 -0
- package/dist/src/load/create.js.map +1 -0
- package/dist/src/load/extension.d.ts +2 -0
- package/dist/src/load/extension.d.ts.map +1 -0
- package/dist/src/load/extension.js +4 -0
- package/dist/src/load/extension.js.map +1 -0
- package/dist/src/load/load.d.ts +18 -0
- package/dist/src/load/load.d.ts.map +1 -0
- package/dist/src/load/load.js +80 -0
- package/dist/src/load/load.js.map +1 -0
- package/dist/src/load/sql-from.d.ts +14 -0
- package/dist/src/load/sql-from.d.ts.map +1 -0
- package/dist/src/load/sql-from.js +29 -0
- package/dist/src/load/sql-from.js.map +1 -0
- package/dist/src/transforms/bin-1d.d.ts +16 -0
- package/dist/src/transforms/bin-1d.d.ts.map +1 -0
- package/dist/src/transforms/bin-1d.js +21 -0
- package/dist/src/transforms/bin-1d.js.map +1 -0
- package/dist/src/transforms/bin-2d.d.ts +19 -0
- package/dist/src/transforms/bin-2d.d.ts.map +1 -0
- package/dist/src/transforms/bin-2d.js +27 -0
- package/dist/src/transforms/bin-2d.js.map +1 -0
- package/dist/src/transforms/bin-date.d.ts +31 -0
- package/dist/src/transforms/bin-date.d.ts.map +1 -0
- package/dist/src/transforms/bin-date.js +20 -0
- package/dist/src/transforms/bin-date.js.map +1 -0
- package/dist/src/transforms/bin-histogram.d.ts +37 -0
- package/dist/src/transforms/bin-histogram.d.ts.map +1 -0
- package/dist/src/transforms/bin-histogram.js +32 -0
- package/dist/src/transforms/bin-histogram.js.map +1 -0
- package/dist/src/transforms/bin-linear-1d.d.ts +11 -0
- package/dist/src/transforms/bin-linear-1d.d.ts.map +1 -0
- package/dist/src/transforms/bin-linear-1d.js +25 -0
- package/dist/src/transforms/bin-linear-1d.js.map +1 -0
- package/dist/src/transforms/bin-linear-2d.d.ts +20 -0
- package/dist/src/transforms/bin-linear-2d.d.ts.map +1 -0
- package/dist/src/transforms/bin-linear-2d.js +49 -0
- package/dist/src/transforms/bin-linear-2d.js.map +1 -0
- package/dist/src/transforms/filter-query.d.ts +12 -0
- package/dist/src/transforms/filter-query.d.ts.map +1 -0
- package/dist/src/transforms/filter-query.js +39 -0
- package/dist/src/transforms/filter-query.js.map +1 -0
- package/dist/src/transforms/line-density.d.ts +24 -0
- package/dist/src/transforms/line-density.d.ts.map +1 -0
- package/dist/src/transforms/line-density.js +98 -0
- package/dist/src/transforms/line-density.js.map +1 -0
- package/dist/src/transforms/m4.d.ts +19 -0
- package/dist/src/transforms/m4.d.ts.map +1 -0
- package/dist/src/transforms/m4.js +38 -0
- package/dist/src/transforms/m4.js.map +1 -0
- package/dist/src/transforms/scales.d.ts +30 -0
- package/dist/src/transforms/scales.d.ts.map +1 -0
- package/dist/src/transforms/scales.js +103 -0
- package/dist/src/transforms/scales.js.map +1 -0
- package/dist/src/transforms/util/bin-step.d.ts +50 -0
- package/dist/src/transforms/util/bin-step.d.ts.map +1 -0
- package/dist/src/transforms/util/bin-step.js +53 -0
- package/dist/src/transforms/util/bin-step.js.map +1 -0
- package/dist/src/transforms/util/time-interval.d.ts +14 -0
- package/dist/src/transforms/util/time-interval.d.ts.map +1 -0
- package/dist/src/transforms/util/time-interval.js +88 -0
- package/dist/src/transforms/util/time-interval.js.map +1 -0
- package/dist/{types → src}/types.d.ts +6 -19
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/{types → src}/util/ast.d.ts +26 -25
- package/dist/src/util/ast.d.ts.map +1 -0
- package/{src → dist/src}/util/ast.js +36 -41
- package/dist/src/util/ast.js.map +1 -0
- package/dist/src/util/function.d.ts +56 -0
- package/dist/src/util/function.d.ts.map +1 -0
- package/dist/src/util/function.js +73 -0
- package/dist/src/util/function.js.map +1 -0
- package/dist/src/util/identity.d.ts +6 -0
- package/dist/src/util/identity.d.ts.map +1 -0
- package/dist/src/util/identity.js +8 -0
- package/dist/src/util/identity.js.map +1 -0
- package/dist/src/util/string.d.ts +4 -0
- package/dist/src/util/string.d.ts.map +1 -0
- package/dist/src/util/string.js +14 -0
- package/dist/src/util/string.js.map +1 -0
- package/dist/src/util/type-check.d.ts +17 -0
- package/dist/src/util/type-check.d.ts.map +1 -0
- package/dist/src/util/type-check.js +28 -0
- package/dist/src/util/type-check.js.map +1 -0
- package/dist/src/visit/clone.d.ts +7 -0
- package/dist/src/visit/clone.d.ts.map +1 -0
- package/dist/src/visit/clone.js +52 -0
- package/dist/src/visit/clone.js.map +1 -0
- package/dist/src/visit/recurse.d.ts +2 -0
- package/dist/src/visit/recurse.d.ts.map +1 -0
- package/dist/src/visit/recurse.js +36 -0
- package/dist/src/visit/recurse.js.map +1 -0
- package/dist/src/visit/rewrite.d.ts +9 -0
- package/dist/src/visit/rewrite.d.ts.map +1 -0
- package/dist/src/visit/rewrite.js +39 -0
- package/dist/src/visit/rewrite.js.map +1 -0
- package/dist/{types → src}/visit/visitors.d.ts +14 -16
- package/dist/src/visit/visitors.d.ts.map +1 -0
- package/dist/src/visit/visitors.js +95 -0
- package/dist/src/visit/visitors.js.map +1 -0
- package/dist/src/visit/walk.d.ts +21 -0
- package/dist/src/visit/walk.d.ts.map +1 -0
- package/dist/src/visit/walk.js +32 -0
- package/dist/src/visit/walk.js.map +1 -0
- package/package.json +12 -10
- package/src/ast/aggregate.ts +198 -0
- package/src/ast/{between-op.js → between-op.ts} +19 -26
- package/src/ast/binary-op.ts +31 -0
- package/src/ast/{case.js → case.ts} +29 -44
- package/src/ast/{cast.js → cast.ts} +8 -14
- package/src/ast/collate.ts +27 -0
- package/src/ast/column-param.ts +34 -0
- package/src/ast/{column-ref.js → column-ref.ts} +16 -25
- package/src/ast/fragment.ts +28 -0
- package/src/ast/from.ts +40 -0
- package/src/ast/{function.js → function.ts} +8 -14
- package/src/ast/{in-op.js → in-op.ts} +8 -14
- package/src/ast/{interval.js → interval.ts} +8 -14
- package/src/ast/{literal.js → literal.ts} +6 -9
- package/src/ast/logical-op.ts +50 -0
- package/src/ast/node.ts +39 -0
- package/src/ast/order-by.ts +38 -0
- package/src/ast/{param.js → param.ts} +6 -12
- package/src/ast/{query.js → query.ts} +193 -205
- package/src/ast/sample.ts +47 -0
- package/src/ast/{select.js → select.ts} +10 -16
- package/src/ast/subquery.ts +24 -0
- package/src/ast/{table-ref.js → table-ref.ts} +7 -12
- package/src/ast/{unary-op.js → unary-op.ts} +16 -23
- package/src/ast/{verbatim.js → verbatim.ts} +9 -8
- package/src/ast/window-frame.ts +97 -0
- package/src/ast/window.ts +246 -0
- package/src/ast/{with.js → with.ts} +19 -20
- package/src/{constants.js → constants.ts} +5 -6
- package/src/functions/aggregate.ts +344 -0
- package/src/functions/{case.js → case.ts} +5 -8
- package/src/functions/{cast.js → cast.ts} +9 -13
- package/src/functions/collate.ts +13 -0
- package/src/functions/{column.js → column.ts} +9 -10
- package/src/functions/{cte.js → cte.ts} +9 -6
- package/src/functions/datetime.ts +50 -0
- package/src/functions/interval.ts +74 -0
- package/src/functions/{literal.js → literal.ts} +6 -7
- package/src/functions/numeric.ts +125 -0
- package/src/functions/operators.ts +272 -0
- package/src/functions/order-by.ts +21 -0
- package/src/functions/spatial.ts +50 -0
- package/src/functions/{sql-template-tag.js → sql-template-tag.ts} +16 -13
- package/src/functions/string.ts +79 -0
- package/src/functions/{table-ref.js → table-ref.ts} +4 -4
- package/src/functions/util.ts +10 -0
- package/src/functions/window-frame.ts +58 -0
- package/src/functions/{window.js → window.ts} +18 -35
- package/src/index.ts +75 -0
- package/src/load/{create.js → create.ts} +9 -3
- package/src/load/extension.ts +3 -0
- package/src/load/{load.js → load.ts} +26 -11
- package/src/load/{sql-from.js → sql-from.ts} +14 -7
- package/src/transforms/{bin-1d.js → bin-1d.ts} +13 -9
- package/src/transforms/{bin-2d.js → bin-2d.ts} +17 -13
- package/src/transforms/bin-date.ts +48 -0
- package/src/transforms/bin-histogram.ts +61 -0
- package/src/transforms/{bin-linear-1d.js → bin-linear-1d.ts} +16 -11
- package/src/transforms/{bin-linear-2d.js → bin-linear-2d.ts} +23 -35
- package/src/transforms/filter-query.ts +40 -0
- package/src/transforms/{line-density.js → line-density.ts} +19 -17
- package/src/transforms/{m4.js → m4.ts} +17 -14
- package/src/transforms/{scales.js → scales.ts} +57 -14
- package/src/transforms/util/bin-step.ts +100 -0
- package/src/transforms/util/{time-interval.js → time-interval.ts} +32 -21
- package/src/types.ts +5 -30
- package/src/util/ast.ts +104 -0
- package/src/util/{function.js → function.ts} +40 -31
- package/src/util/identity.ts +7 -0
- package/src/util/{string.js → string.ts} +4 -4
- package/src/util/type-check.ts +31 -0
- package/src/visit/clone.ts +53 -0
- package/src/visit/{recurse.js → recurse.ts} +18 -6
- package/src/visit/{rewrite.js → rewrite.ts} +10 -18
- package/src/visit/{visitors.js → visitors.ts} +22 -30
- package/src/visit/walk.ts +46 -0
- package/dist/types/ast/aggregate.d.ts +0 -71
- package/dist/types/ast/between-op.d.ts +0 -46
- package/dist/types/ast/binary-op.d.ts +0 -28
- package/dist/types/ast/case.d.ts +0 -67
- package/dist/types/ast/cast.d.ts +0 -21
- package/dist/types/ast/column-param.d.ts +0 -23
- package/dist/types/ast/column-ref.d.ts +0 -40
- package/dist/types/ast/fragment.d.ts +0 -14
- package/dist/types/ast/from.d.ts +0 -21
- package/dist/types/ast/function.d.ts +0 -21
- package/dist/types/ast/in-op.d.ts +0 -21
- package/dist/types/ast/interval.d.ts +0 -21
- package/dist/types/ast/literal.d.ts +0 -15
- package/dist/types/ast/logical-op.d.ts +0 -46
- package/dist/types/ast/node.d.ts +0 -24
- package/dist/types/ast/order-by.d.ts +0 -29
- package/dist/types/ast/query.d.ts +0 -320
- package/dist/types/ast/sample.d.ts +0 -42
- package/dist/types/ast/select.d.ts +0 -22
- package/dist/types/ast/table-ref.d.ts +0 -25
- package/dist/types/ast/unary-op.d.ts +0 -39
- package/dist/types/ast/verbatim.d.ts +0 -9
- package/dist/types/ast/window.d.ts +0 -180
- package/dist/types/constants.d.ts +0 -38
- package/dist/types/functions/aggregate.d.ts +0 -236
- package/dist/types/functions/cast.d.ts +0 -26
- package/dist/types/functions/column.d.ts +0 -11
- package/dist/types/functions/datetime.d.ts +0 -45
- package/dist/types/functions/numeric.d.ts +0 -95
- package/dist/types/functions/operators.d.ts +0 -200
- package/dist/types/functions/order-by.d.ts +0 -18
- package/dist/types/functions/spatial.d.ts +0 -38
- package/dist/types/functions/string.d.ts +0 -57
- package/dist/types/functions/table-ref.d.ts +0 -9
- package/dist/types/functions/util.d.ts +0 -8
- package/dist/types/index-types.d.ts +0 -2
- package/dist/types/index.d.ts +0 -59
- package/dist/types/load/create.d.ts +0 -8
- package/dist/types/load/extension.d.ts +0 -1
- package/dist/types/load/load.d.ts +0 -12
- package/dist/types/load/sql-from.d.ts +0 -11
- package/dist/types/transforms/bin-1d.d.ts +0 -15
- package/dist/types/transforms/bin-2d.d.ts +0 -19
- package/dist/types/transforms/bin-date.d.ts +0 -44
- package/dist/types/transforms/bin-histogram.d.ts +0 -51
- package/dist/types/transforms/bin-linear-1d.d.ts +0 -12
- package/dist/types/transforms/bin-linear-2d.d.ts +0 -19
- package/dist/types/transforms/line-density.d.ts +0 -24
- package/dist/types/transforms/m4.d.ts +0 -21
- package/dist/types/transforms/scales.d.ts +0 -1
- package/dist/types/transforms/util/bin-step.d.ts +0 -61
- package/dist/types/transforms/util/time-interval.d.ts +0 -13
- package/dist/types/util/function.d.ts +0 -56
- package/dist/types/util/string.d.ts +0 -3
- package/dist/types/util/type-check.d.ts +0 -22
- package/dist/types/visit/recurse.d.ts +0 -28
- package/dist/types/visit/rewrite.d.ts +0 -10
- package/dist/types/visit/walk.d.ts +0 -10
- package/jsconfig.json +0 -11
- package/src/ast/aggregate.js +0 -167
- package/src/ast/binary-op.js +0 -40
- package/src/ast/column-param.js +0 -40
- package/src/ast/fragment.js +0 -26
- package/src/ast/from.js +0 -40
- package/src/ast/logical-op.js +0 -67
- package/src/ast/node.js +0 -29
- package/src/ast/order-by.js +0 -48
- package/src/ast/sample.js +0 -53
- package/src/ast/window.js +0 -294
- package/src/functions/aggregate.js +0 -347
- package/src/functions/datetime.js +0 -68
- package/src/functions/numeric.js +0 -143
- package/src/functions/operators.js +0 -301
- package/src/functions/order-by.js +0 -27
- package/src/functions/spatial.js +0 -59
- package/src/functions/string.js +0 -85
- package/src/functions/util.js +0 -14
- package/src/index-types.ts +0 -2
- package/src/load/extension.js +0 -3
- package/src/transforms/bin-date.js +0 -37
- package/src/transforms/bin-histogram.js +0 -52
- package/src/transforms/util/bin-step.js +0 -79
- package/src/util/type-check.js +0 -33
- package/src/visit/walk.js +0 -35
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -3
|
@@ -1,61 +1,62 @@
|
|
|
1
|
+
import type { ColumnRefNode } from '../ast/column-ref.js';
|
|
2
|
+
import type { TableRefNode } from '../ast/table-ref.js';
|
|
3
|
+
import { ExprNode, type SQLNode } from '../ast/node.js';
|
|
4
|
+
import { WindowDefNode } from '../ast/window.js';
|
|
1
5
|
/**
|
|
2
6
|
* Interpret a value as a SQL AST node. String values are assumed to be
|
|
3
7
|
* column references. All other primitive values are interpreted as
|
|
4
8
|
* SQL literals. Dynamic parameters are interpreted as param AST nodes,
|
|
5
9
|
* while existing AST nodes are left as-is.
|
|
6
|
-
* @param
|
|
7
|
-
* @returns {ExprNode}
|
|
10
|
+
* @param value The value to interpret as a SQL AST node.
|
|
8
11
|
*/
|
|
9
|
-
export function asNode(value:
|
|
12
|
+
export declare function asNode(value: unknown): ExprNode;
|
|
10
13
|
/**
|
|
11
14
|
* Interpret a value as a verbatim SQL AST node. String values will be
|
|
12
15
|
* passed through to queries as verbatim text. All other primitive values
|
|
13
16
|
* are interpreted as SQL literals. Dynamic parameters are interpreted
|
|
14
17
|
* as param AST nodes, while existing AST nodes are left as-is.
|
|
15
|
-
* @param
|
|
16
|
-
* @returns {ExprNode}
|
|
18
|
+
* @param value The value to interpret as a verbatim AST node.
|
|
17
19
|
*/
|
|
18
|
-
export function asVerbatim(value:
|
|
20
|
+
export declare function asVerbatim(value: unknown): ExprNode;
|
|
19
21
|
/**
|
|
20
22
|
* Interpret a value as a literal AST node. All other primitive values
|
|
21
23
|
* are interpreted as SQL literals. Dynamic parameters are interpreted
|
|
22
24
|
* as param AST nodes, while existing AST nodes are left as-is.
|
|
23
|
-
* @param
|
|
24
|
-
* @returns {ExprNode}
|
|
25
|
+
* @param value The value to interpret as a literal AST node.
|
|
25
26
|
*/
|
|
26
|
-
export function asLiteral(value:
|
|
27
|
+
export declare function asLiteral(value: unknown): ExprNode;
|
|
27
28
|
/**
|
|
28
29
|
* Interpret a value as a table reference AST node. String values are parsed
|
|
29
30
|
* assuming dot ('.') delimiters (as in `schema.table`). Array values are
|
|
30
31
|
* interpreted as pre-parsed name paths (as in `['schema', 'table']`). Any
|
|
31
32
|
* other values are left as-is.
|
|
32
|
-
* @param
|
|
33
|
-
* table reference AST node.
|
|
34
|
-
* @returns {TableRefNode}
|
|
33
|
+
* @param value The value to interpret as a table reference AST node.
|
|
35
34
|
*/
|
|
36
|
-
export function asTableRef(value
|
|
35
|
+
export declare function asTableRef(value?: string | string[] | TableRefNode): TableRefNode | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Try to interpret a value as a table reference AST node. String values are
|
|
38
|
+
* parsed assuming dot ('.') delimiters (as in `schema.table`). Array values
|
|
39
|
+
* are interpreted as pre-parsed name paths (as in `['schema', 'table']`). Any
|
|
40
|
+
* other values are left as-is.
|
|
41
|
+
* @param value The value to interpret as a table reference.
|
|
42
|
+
*/
|
|
43
|
+
export declare function maybeTableRef(value: string | string[] | SQLNode): SQLNode;
|
|
37
44
|
/**
|
|
38
45
|
* Parse a string as a column reference, potentially with
|
|
39
46
|
* dot ('.') delimited table, schema, and database references.
|
|
40
|
-
* @param
|
|
41
|
-
* @returns {ColumnRefNode}
|
|
47
|
+
* @param ref The column reference string.
|
|
42
48
|
*/
|
|
43
|
-
export function parseColumnRef(ref: string): ColumnRefNode;
|
|
49
|
+
export declare function parseColumnRef(ref: string): ColumnRefNode;
|
|
44
50
|
/**
|
|
45
51
|
* Parse a string as a table reference, potentially with
|
|
46
52
|
* dot ('.') delimited schema and database references.
|
|
47
|
-
* @param
|
|
48
|
-
* @returns {TableRefNode}
|
|
53
|
+
* @param ref The table reference string.
|
|
49
54
|
*/
|
|
50
|
-
export function parseTableRef(ref: string): TableRefNode;
|
|
55
|
+
export declare function parseTableRef(ref: string): TableRefNode;
|
|
51
56
|
/**
|
|
52
57
|
* Create a new window definition node. The return value is an empty
|
|
53
58
|
* window definition. Use chained calls such as `partitionby` and `orderby`
|
|
54
59
|
* to specify the window settings.
|
|
55
|
-
* @returns {WindowDefNode}
|
|
56
60
|
*/
|
|
57
|
-
export function over(): WindowDefNode;
|
|
58
|
-
|
|
59
|
-
import type { TableRefNode } from '../ast/table-ref.js';
|
|
60
|
-
import type { ColumnRefNode } from '../ast/column-ref.js';
|
|
61
|
-
import { WindowDefNode } from '../ast/window.js';
|
|
61
|
+
export declare function over(): WindowDefNode;
|
|
62
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../../src/util/ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAI/C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAInD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAIlD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAE7F;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,OAAO,CAEzE;AAQD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,kBAEnB"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ColumnRefNode } from '../ast/column-ref.js'
|
|
3
|
-
* @import { TableRefNode } from '../ast/table-ref.js'
|
|
4
|
-
*/
|
|
5
1
|
import { ExprNode } from '../ast/node.js';
|
|
6
2
|
import { ParamNode } from '../ast/param.js';
|
|
7
3
|
import { WindowDefNode } from '../ast/window.js';
|
|
@@ -10,90 +6,89 @@ import { literal, verbatim } from '../functions/literal.js';
|
|
|
10
6
|
import { tableRef } from '../functions/table-ref.js';
|
|
11
7
|
import { parseIdentifier } from './string.js';
|
|
12
8
|
import { isArray, isParamLike, isString } from './type-check.js';
|
|
13
|
-
|
|
14
9
|
/**
|
|
15
10
|
* Interpret a value as a SQL AST node. String values are assumed to be
|
|
16
11
|
* column references. All other primitive values are interpreted as
|
|
17
12
|
* SQL literals. Dynamic parameters are interpreted as param AST nodes,
|
|
18
13
|
* while existing AST nodes are left as-is.
|
|
19
|
-
* @param
|
|
20
|
-
* @returns {ExprNode}
|
|
14
|
+
* @param value The value to interpret as a SQL AST node.
|
|
21
15
|
*/
|
|
22
16
|
export function asNode(value) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
return isString(value)
|
|
18
|
+
? parseColumnRef(value)
|
|
19
|
+
: asLiteral(value);
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
/**
|
|
29
22
|
* Interpret a value as a verbatim SQL AST node. String values will be
|
|
30
23
|
* passed through to queries as verbatim text. All other primitive values
|
|
31
24
|
* are interpreted as SQL literals. Dynamic parameters are interpreted
|
|
32
25
|
* as param AST nodes, while existing AST nodes are left as-is.
|
|
33
|
-
* @param
|
|
34
|
-
* @returns {ExprNode}
|
|
26
|
+
* @param value The value to interpret as a verbatim AST node.
|
|
35
27
|
*/
|
|
36
28
|
export function asVerbatim(value) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
return isString(value)
|
|
30
|
+
? verbatim(value)
|
|
31
|
+
: asLiteral(value);
|
|
40
32
|
}
|
|
41
|
-
|
|
42
33
|
/**
|
|
43
34
|
* Interpret a value as a literal AST node. All other primitive values
|
|
44
35
|
* are interpreted as SQL literals. Dynamic parameters are interpreted
|
|
45
36
|
* as param AST nodes, while existing AST nodes are left as-is.
|
|
46
|
-
* @param
|
|
47
|
-
* @returns {ExprNode}
|
|
37
|
+
* @param value The value to interpret as a literal AST node.
|
|
48
38
|
*/
|
|
49
39
|
export function asLiteral(value) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
return value instanceof ExprNode ? value
|
|
41
|
+
: isParamLike(value) ? new ParamNode(value)
|
|
42
|
+
: literal(value);
|
|
53
43
|
}
|
|
54
|
-
|
|
55
44
|
/**
|
|
56
45
|
* Interpret a value as a table reference AST node. String values are parsed
|
|
57
46
|
* assuming dot ('.') delimiters (as in `schema.table`). Array values are
|
|
58
47
|
* interpreted as pre-parsed name paths (as in `['schema', 'table']`). Any
|
|
59
48
|
* other values are left as-is.
|
|
60
|
-
* @param
|
|
61
|
-
* table reference AST node.
|
|
62
|
-
* @returns {TableRefNode}
|
|
49
|
+
* @param value The value to interpret as a table reference AST node.
|
|
63
50
|
*/
|
|
64
51
|
export function asTableRef(value) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
return getTableRef(value);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Try to interpret a value as a table reference AST node. String values are
|
|
56
|
+
* parsed assuming dot ('.') delimiters (as in `schema.table`). Array values
|
|
57
|
+
* are interpreted as pre-parsed name paths (as in `['schema', 'table']`). Any
|
|
58
|
+
* other values are left as-is.
|
|
59
|
+
* @param value The value to interpret as a table reference.
|
|
60
|
+
*/
|
|
61
|
+
export function maybeTableRef(value) {
|
|
62
|
+
return getTableRef(value);
|
|
63
|
+
}
|
|
64
|
+
function getTableRef(value) {
|
|
65
|
+
return isString(value) ? parseTableRef(value)
|
|
66
|
+
: isArray(value) ? tableRef(value)
|
|
67
|
+
: value;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
69
|
/**
|
|
71
70
|
* Parse a string as a column reference, potentially with
|
|
72
71
|
* dot ('.') delimited table, schema, and database references.
|
|
73
|
-
* @param
|
|
74
|
-
* @returns {ColumnRefNode}
|
|
72
|
+
* @param ref The column reference string.
|
|
75
73
|
*/
|
|
76
74
|
export function parseColumnRef(ref) {
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const ids = parseIdentifier(ref);
|
|
76
|
+
return column(ids.pop(), tableRef(ids));
|
|
79
77
|
}
|
|
80
|
-
|
|
81
78
|
/**
|
|
82
79
|
* Parse a string as a table reference, potentially with
|
|
83
80
|
* dot ('.') delimited schema and database references.
|
|
84
|
-
* @param
|
|
85
|
-
* @returns {TableRefNode}
|
|
81
|
+
* @param ref The table reference string.
|
|
86
82
|
*/
|
|
87
83
|
export function parseTableRef(ref) {
|
|
88
|
-
|
|
84
|
+
return tableRef(parseIdentifier(ref));
|
|
89
85
|
}
|
|
90
|
-
|
|
91
86
|
/**
|
|
92
87
|
* Create a new window definition node. The return value is an empty
|
|
93
88
|
* window definition. Use chained calls such as `partitionby` and `orderby`
|
|
94
89
|
* to specify the window settings.
|
|
95
|
-
* @returns {WindowDefNode}
|
|
96
90
|
*/
|
|
97
91
|
export function over() {
|
|
98
|
-
|
|
92
|
+
return new WindowDefNode();
|
|
99
93
|
}
|
|
94
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../../src/util/ast.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,QAAQ,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC;QACvB,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,QAAQ,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjB,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,YAAY,QAAQ,CAAC,CAAC,CAAC,KAAK;QACtC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC;YAC3C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAwC;IACjE,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAkC;IAC9D,OAAO,WAAW,CAAC,KAAK,CAAE,CAAC;AAC7B,CAAC;AAED,SAAS,WAAW,CAAI,KAA6B;IACnD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC;QAC3C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAE;YACnC,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,GAAG,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,EAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,CAAE,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI;IAClB,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ExprNode, SQLNode } from '../ast/node.js';
|
|
2
|
+
import type { WindowFunctionName } from '../types.js';
|
|
3
|
+
import { AggregateNode } from '../ast/aggregate.js';
|
|
4
|
+
import { FunctionNode } from '../ast/function.js';
|
|
5
|
+
import { WindowNode } from '../ast/window.js';
|
|
6
|
+
/**
|
|
7
|
+
* Test if an AST node is a specific function call.
|
|
8
|
+
* @param node The SQL AST node to test.
|
|
9
|
+
* @param name The function name.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isFunctionCall(node: SQLNode, name: string): node is FunctionNode;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new function call AST node.
|
|
14
|
+
* @param name The function name.
|
|
15
|
+
* @param args The function arguments.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fn(name: string, ...args: unknown[]): FunctionNode;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new aggregate function AST node.
|
|
20
|
+
* @param name The function name.
|
|
21
|
+
* @param args The function arguments.
|
|
22
|
+
*/
|
|
23
|
+
export declare function aggFn(name: string, ...args: unknown[]): AggregateNode;
|
|
24
|
+
/**
|
|
25
|
+
* Create a new window AST node. The output node has an empty window
|
|
26
|
+
* definition. Use chained calls such as `partitionby` and `orderby`
|
|
27
|
+
* to specify the window settings.
|
|
28
|
+
* @param name The function name.
|
|
29
|
+
* @param args The function arguments.
|
|
30
|
+
*/
|
|
31
|
+
export declare function winFn(name: WindowFunctionName, ...args: unknown[]): WindowNode;
|
|
32
|
+
/**
|
|
33
|
+
* Process a list of expression inputs. Nested arrays are flattened,
|
|
34
|
+
* null results are removed, and each input is cast to a SQL AST node.
|
|
35
|
+
* @param list The list of expression inputs.
|
|
36
|
+
* @param cast A function that casts an input value
|
|
37
|
+
* to a desired type. By default, `asNode` is used to coerce
|
|
38
|
+
* inputs to AST nodes as needed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function exprList<T>(list: unknown[], cast: ((x: unknown) => T)): T[];
|
|
41
|
+
/**
|
|
42
|
+
* Process a list of expression inputs. Nested arrays are flattened,
|
|
43
|
+
* null results are removed, and each input is cast (as needed) to
|
|
44
|
+
* be a proper SQL AST node. By default, strings are assumed to be
|
|
45
|
+
* column names, while other primitive values map to SQL literals.
|
|
46
|
+
* Use an alternative *cast* function to change this behavior.
|
|
47
|
+
* @param list The list of expression inputs.
|
|
48
|
+
*/
|
|
49
|
+
export declare function nodeList(list: unknown[]): ExprNode[];
|
|
50
|
+
/**
|
|
51
|
+
* Process a list of function arguments, stripping any undefined
|
|
52
|
+
* values from the end of the list.
|
|
53
|
+
* @param list The input function arguments.
|
|
54
|
+
*/
|
|
55
|
+
export declare function argsList<T>(list: T[]): T[];
|
|
56
|
+
//# sourceMappingURL=function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../../src/util/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAsB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGlE;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,MAAM,GACX,IAAI,IAAI,YAAY,CAEtB;AAED;;;;GAIG;AACH,wBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,YAAY,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,CAErE;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,kBAAkB,EACxB,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,UAAU,CAIZ;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,IAAI,EAAE,OAAO,EAAE,EACf,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,GACxB,CAAC,EAAE,CAEL;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAK1C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AggregateNode } from '../ast/aggregate.js';
|
|
2
|
+
import { FunctionNode } from '../ast/function.js';
|
|
3
|
+
import { WindowFunctionNode, WindowNode } from '../ast/window.js';
|
|
4
|
+
import { asNode } from './ast.js';
|
|
5
|
+
/**
|
|
6
|
+
* Test if an AST node is a specific function call.
|
|
7
|
+
* @param node The SQL AST node to test.
|
|
8
|
+
* @param name The function name.
|
|
9
|
+
*/
|
|
10
|
+
export function isFunctionCall(node, name) {
|
|
11
|
+
return node instanceof FunctionNode && node.name === name;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a new function call AST node.
|
|
15
|
+
* @param name The function name.
|
|
16
|
+
* @param args The function arguments.
|
|
17
|
+
*/
|
|
18
|
+
export function fn(name, ...args) {
|
|
19
|
+
return new FunctionNode(name, argsList(args).map(asNode));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a new aggregate function AST node.
|
|
23
|
+
* @param name The function name.
|
|
24
|
+
* @param args The function arguments.
|
|
25
|
+
*/
|
|
26
|
+
export function aggFn(name, ...args) {
|
|
27
|
+
return new AggregateNode(name, argsList(args).map(asNode));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a new window AST node. The output node has an empty window
|
|
31
|
+
* definition. Use chained calls such as `partitionby` and `orderby`
|
|
32
|
+
* to specify the window settings.
|
|
33
|
+
* @param name The function name.
|
|
34
|
+
* @param args The function arguments.
|
|
35
|
+
*/
|
|
36
|
+
export function winFn(name, ...args) {
|
|
37
|
+
return new WindowNode(new WindowFunctionNode(name, argsList(args).map(asNode)));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Process a list of expression inputs. Nested arrays are flattened,
|
|
41
|
+
* null results are removed, and each input is cast to a SQL AST node.
|
|
42
|
+
* @param list The list of expression inputs.
|
|
43
|
+
* @param cast A function that casts an input value
|
|
44
|
+
* to a desired type. By default, `asNode` is used to coerce
|
|
45
|
+
* inputs to AST nodes as needed.
|
|
46
|
+
*/
|
|
47
|
+
export function exprList(list, cast) {
|
|
48
|
+
return list.flat().filter(x => x != null).map(x => cast(x));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Process a list of expression inputs. Nested arrays are flattened,
|
|
52
|
+
* null results are removed, and each input is cast (as needed) to
|
|
53
|
+
* be a proper SQL AST node. By default, strings are assumed to be
|
|
54
|
+
* column names, while other primitive values map to SQL literals.
|
|
55
|
+
* Use an alternative *cast* function to change this behavior.
|
|
56
|
+
* @param list The list of expression inputs.
|
|
57
|
+
*/
|
|
58
|
+
export function nodeList(list) {
|
|
59
|
+
return exprList(list, asNode);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Process a list of function arguments, stripping any undefined
|
|
63
|
+
* values from the end of the list.
|
|
64
|
+
* @param list The input function arguments.
|
|
65
|
+
*/
|
|
66
|
+
export function argsList(list) {
|
|
67
|
+
const n = list.length;
|
|
68
|
+
let i = n;
|
|
69
|
+
for (; i > 0 && list[i - 1] === undefined; --i)
|
|
70
|
+
;
|
|
71
|
+
return i < n ? list.slice(0, i) : list;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../src/util/function.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAa,EACb,IAAY;IAEZ,OAAO,IAAI,YAAY,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,EAAE,CAAC,IAAY,EAAE,GAAG,IAAe;IACjD,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,GAAG,IAAe;IACpD,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CACnB,IAAwB,EACxB,GAAG,IAAe;IAElB,OAAO,IAAI,UAAU,CACnB,IAAI,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CACzD,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,IAAe,EACf,IAAyB;IAEzB,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAe;IACtC,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAI,IAAS;IACnC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;IACtB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,SAAS,EAAE,EAAE,CAAC;QAAC,CAAC;IAChD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/util/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAE/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/util/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAI,CAAI;IAC9B,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/util/string.ts"],"names":[],"mappings":"AACA,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,YAEzC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,UAE7C;AAED,wBAAgB,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,sBAEjC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// TODO: handle case where identifiers are already quoted?
|
|
2
|
+
export function parseIdentifier(id) {
|
|
3
|
+
return id.split('.');
|
|
4
|
+
}
|
|
5
|
+
export function quoteIdentifier(value) {
|
|
6
|
+
return `"${value}"`;
|
|
7
|
+
}
|
|
8
|
+
export function unquote(s) {
|
|
9
|
+
return s && isDoubleQuoted(s) ? s.slice(1, -1) : s;
|
|
10
|
+
}
|
|
11
|
+
function isDoubleQuoted(s) {
|
|
12
|
+
return s[0] === '"' && s[s.length - 1] === '"';
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/util/string.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,UAAU,eAAe,CAAC,EAAU;IACxC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,IAAI,KAAK,GAAG,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,CAAU;IAChC,OAAO,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ParamLike } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check if a value is a string.
|
|
4
|
+
* @param value The value to check.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isString(value: unknown): value is string;
|
|
7
|
+
/**
|
|
8
|
+
* Check if a value is an array.
|
|
9
|
+
* @param value The value to check.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isArray(value: unknown): value is Array<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Check if a value is a dynamic parameter.
|
|
14
|
+
* @param value The value to check.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isParamLike(value: unknown): value is ParamLike;
|
|
17
|
+
//# sourceMappingURL=type-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-check.d.ts","sourceRoot":"","sources":["../../../src/util/type-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAE/D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAQ9D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a value is a string.
|
|
3
|
+
* @param value The value to check.
|
|
4
|
+
*/
|
|
5
|
+
export function isString(value) {
|
|
6
|
+
return typeof value === 'string';
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Check if a value is an array.
|
|
10
|
+
* @param value The value to check.
|
|
11
|
+
*/
|
|
12
|
+
export function isArray(value) {
|
|
13
|
+
return Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if a value is a dynamic parameter.
|
|
17
|
+
* @param value The value to check.
|
|
18
|
+
*/
|
|
19
|
+
export function isParamLike(value) {
|
|
20
|
+
if (value) {
|
|
21
|
+
const v = value;
|
|
22
|
+
return typeof v?.addEventListener === 'function'
|
|
23
|
+
&& v.dynamic !== false
|
|
24
|
+
&& 'value' in v;
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=type-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-check.js","sourceRoot":"","sources":["../../../src/util/type-check.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,CAAC,GAAG,KAA+B,CAAC;QAC1C,OAAO,OAAO,CAAC,EAAE,gBAAgB,KAAK,UAAU;eAC3C,CAAC,CAAC,OAAO,KAAK,KAAK;eACnB,OAAO,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../../src/visit/clone.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAkBvC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isNode } from '../ast/node.js';
|
|
2
|
+
import { recurse } from './recurse.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a deep clone of the given SQL AST node and all children nodes.
|
|
5
|
+
* @param node The node to deeply clone.
|
|
6
|
+
* @returns The cloned node.
|
|
7
|
+
*/
|
|
8
|
+
export function deepClone(node) {
|
|
9
|
+
const clone = shallowClone(node);
|
|
10
|
+
if (isNode(node)) {
|
|
11
|
+
const props = recurse[node.type];
|
|
12
|
+
const n = props?.length ?? 0;
|
|
13
|
+
for (let i = 0; i < n; ++i) {
|
|
14
|
+
const key = props[i];
|
|
15
|
+
// @ts-expect-error allow assignment
|
|
16
|
+
const value = node[key];
|
|
17
|
+
// @ts-expect-error allow assignment
|
|
18
|
+
clone[key] = Array.isArray(value)
|
|
19
|
+
? value.map(v => deepClone(v))
|
|
20
|
+
: deepClone(value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return clone;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a shallow clone of the given SQL AST node.
|
|
27
|
+
* @param node The node to clone.
|
|
28
|
+
* @returns The cloned node.
|
|
29
|
+
*/
|
|
30
|
+
function shallowClone(node) {
|
|
31
|
+
/** @type {T} */
|
|
32
|
+
let clone;
|
|
33
|
+
if (!node || typeof node !== 'object') {
|
|
34
|
+
return node;
|
|
35
|
+
}
|
|
36
|
+
else if (isNode(node)) {
|
|
37
|
+
clone = node.clone();
|
|
38
|
+
}
|
|
39
|
+
else if (node instanceof Date) {
|
|
40
|
+
// @ts-expect-error node is known to be Date
|
|
41
|
+
return new Date(+node);
|
|
42
|
+
}
|
|
43
|
+
else if (Array.isArray(node)) {
|
|
44
|
+
// @ts-expect-error allow slice
|
|
45
|
+
return node.slice();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
return { ...node };
|
|
49
|
+
}
|
|
50
|
+
return clone;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=clone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.js","sourceRoot":"","sources":["../../../src/visit/clone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAI,IAAO;IAClC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACrB,oCAAoC;YACpC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YACxB,oCAAoC;YACpC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC/B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9B,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAI,IAAO;IAC9B,gBAAgB;IAChB,IAAI,KAAK,CAAC;IAEV,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,IAAI,YAAY,IAAI,EAAE,CAAC;QAChC,4CAA4C;QAC5C,OAAO,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,+BAA+B;QAC/B,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recurse.d.ts","sourceRoot":"","sources":["../../../src/visit/recurse.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAiC5C,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AGGREGATE, BETWEEN_OPERATOR, BINARY_OPERATOR, CASE, CAST, COLLATE, COLUMN_PARAM, COLUMN_REF, DESCRIBE_QUERY, EXPRESSION, FRAGMENT, FROM_CLAUSE, FUNCTION, IN_OPERATOR, LOGICAL_OPERATOR, NOT_BETWEEN_OPERATOR, ORDER_BY, PARAM, SCALAR_SUBQUERY, SELECT_CLAUSE, SELECT_QUERY, SET_OPERATION, UNARY_OPERATOR, UNARY_POSTFIX_OPERATOR, WHEN, WINDOW, WINDOW_CLAUSE, WINDOW_DEF, WINDOW_EXTENT_EXPR, WINDOW_FRAME, WINDOW_FUNCTION, WITH_CLAUSE } from '../constants.js';
|
|
2
|
+
export const recurse = {
|
|
3
|
+
[AGGREGATE]: ['args', 'order', 'filter'],
|
|
4
|
+
[BETWEEN_OPERATOR]: ['expr', 'extent'],
|
|
5
|
+
[BINARY_OPERATOR]: ['left', 'right'],
|
|
6
|
+
[CASE]: ['expr', '_when', '_else'],
|
|
7
|
+
[CAST]: ['expr'],
|
|
8
|
+
[COLLATE]: ['expr'],
|
|
9
|
+
[COLUMN_PARAM]: ['param', 'table'],
|
|
10
|
+
[COLUMN_REF]: ['table'],
|
|
11
|
+
[DESCRIBE_QUERY]: ['query'],
|
|
12
|
+
[EXPRESSION]: ['node'],
|
|
13
|
+
[FRAGMENT]: ['spans'],
|
|
14
|
+
[FROM_CLAUSE]: ['expr'],
|
|
15
|
+
[FUNCTION]: ['args'],
|
|
16
|
+
[IN_OPERATOR]: ['expr', 'values'],
|
|
17
|
+
[LOGICAL_OPERATOR]: ['clauses'],
|
|
18
|
+
[NOT_BETWEEN_OPERATOR]: ['expr', 'extent'],
|
|
19
|
+
[ORDER_BY]: ['expr'],
|
|
20
|
+
[PARAM]: ['value'],
|
|
21
|
+
[SCALAR_SUBQUERY]: ['subquery'],
|
|
22
|
+
[SELECT_CLAUSE]: ['expr'],
|
|
23
|
+
[SELECT_QUERY]: ['_with', '_select', '_from', '_where', '_sample', '_groupby', '_having', '_window', '_qualify', '_orderby'],
|
|
24
|
+
[SET_OPERATION]: ['queries', '_orderby'],
|
|
25
|
+
[UNARY_OPERATOR]: ['expr'],
|
|
26
|
+
[UNARY_POSTFIX_OPERATOR]: ['expr'],
|
|
27
|
+
[WHEN]: ['when', 'then'],
|
|
28
|
+
[WINDOW]: ['func', 'def'],
|
|
29
|
+
[WINDOW_CLAUSE]: ['def'],
|
|
30
|
+
[WINDOW_DEF]: ['partition', 'order', 'framedef'],
|
|
31
|
+
[WINDOW_EXTENT_EXPR]: ['expr'],
|
|
32
|
+
[WINDOW_FRAME]: ['extent'],
|
|
33
|
+
[WINDOW_FUNCTION]: ['args'],
|
|
34
|
+
[WITH_CLAUSE]: ['query']
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=recurse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recurse.js","sourceRoot":"","sources":["../../../src/visit/recurse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,UAAU,EACV,cAAc,EACd,UAAU,EACV,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,QAAQ,EACR,KAAK,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,IAAI,EACJ,MAAM,EACN,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,OAAO,GAA6B;IAC/C,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;IACxC,CAAC,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IACtC,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;IAClC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;IAChB,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC;IACnB,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;IAClC,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC;IACvB,CAAC,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC;IAC3B,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC;IACtB,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC;IACrB,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC;IACvB,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC;IACpB,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IACjC,CAAC,gBAAgB,CAAC,EAAE,CAAC,SAAS,CAAC;IAC/B,CAAC,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1C,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC;IACpB,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC;IAClB,CAAC,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC;IAC/B,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC;IACzB,CAAC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC;IAC5H,CAAC,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IACxC,CAAC,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC;IAC1B,CAAC,sBAAsB,CAAC,EAAE,CAAC,MAAM,CAAC;IAClC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;IACzB,CAAC,aAAa,CAAC,EAAE,CAAC,KAAK,CAAC;IACxB,CAAC,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC;IAChD,CAAC,kBAAkB,CAAC,EAAE,CAAC,MAAM,CAAC;IAC9B,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC;IAC1B,CAAC,eAAe,CAAC,EAAE,CAAC,MAAM,CAAC;IAC3B,CAAC,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ExprNode } from '../ast/node.js';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrite a SQL expression, based on a map of nodes to replace.
|
|
4
|
+
* This method copies nodes as needed; it does not modify the input node.
|
|
5
|
+
* @param node The root AST node of the expression.
|
|
6
|
+
* @param map The rewrite map. When encountered, key nodes are replaced by value nodes.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rewrite(node: ExprNode, map: Map<ExprNode, ExprNode>): ExprNode | undefined;
|
|
9
|
+
//# sourceMappingURL=rewrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../../src/visit/rewrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAU,MAAM,gBAAgB,CAAC;AAGvD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,wBA2BnE"}
|