@uwdata/mosaic-sql 0.17.0 → 0.19.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 +47 -0
- 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/list.d.ts +15 -0
- package/dist/src/ast/list.d.ts.map +1 -0
- package/dist/src/ast/list.js +21 -0
- package/dist/src/ast/list.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/src/ast/param.d.ts +20 -0
- 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 +334 -0
- package/dist/src/ast/query.d.ts.map +1 -0
- package/dist/src/ast/query.js +640 -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/unnest.d.ts +19 -0
- package/dist/src/ast/unnest.d.ts.map +1 -0
- package/dist/src/ast/unnest.js +29 -0
- package/dist/src/ast/unnest.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/src/ast/with.d.ts +25 -0
- 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 +40 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +40 -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/src/functions/case.d.ts +13 -0
- 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/src/functions/cte.d.ts +13 -0
- 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/src/functions/list.d.ts +31 -0
- package/dist/src/functions/list.d.ts.map +1 -0
- package/dist/src/functions/list.js +49 -0
- package/dist/src/functions/list.js.map +1 -0
- package/dist/src/functions/literal.d.ts +16 -0
- 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/src/functions/sql-template-tag.d.ts +13 -0
- 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/unnest.d.ts +10 -0
- package/dist/src/functions/unnest.d.ts.map +1 -0
- package/dist/src/functions/unnest.js +12 -0
- package/dist/src/functions/unnest.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/src/functions/window.d.ts +74 -0
- 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 +73 -0
- package/dist/src/index.d.ts.map +1 -0
- package/{src → dist/src}/index.js +8 -8
- 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/src/types.d.ts +49 -0
- 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/src/util/ast.d.ts +62 -0
- 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 +37 -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/src/visit/visitors.d.ts +32 -0
- 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 +13 -7
- package/src/ast/{aggregate.js → aggregate.ts} +49 -60
- 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.js → collate.ts} +8 -14
- 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.js → from.ts} +12 -21
- 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/list.ts +23 -0
- package/src/ast/{literal.js → literal.ts} +6 -9
- package/src/ast/logical-op.ts +50 -0
- package/src/ast/{node.js → node.ts} +10 -13
- package/src/ast/order-by.ts +38 -0
- package/src/ast/{param.js → param.ts} +6 -12
- package/src/ast/{query.js → query.ts} +224 -204
- package/src/ast/sample.ts +47 -0
- package/src/ast/{select.js → select.ts} +10 -16
- package/src/ast/{subquery.js → subquery.ts} +9 -8
- 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/unnest.ts +31 -0
- package/src/ast/verbatim.ts +27 -0
- package/src/ast/{window-frame.js → window-frame.ts} +37 -47
- package/src/ast/window.ts +246 -0
- package/src/ast/{with.js → with.ts} +19 -20
- package/src/{constants.js → constants.ts} +2 -0
- 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.js → collate.ts} +4 -7
- package/src/functions/{column.js → column.ts} +9 -10
- package/src/functions/{cte.js → cte.ts} +9 -6
- package/src/functions/{datetime.js → datetime.ts} +12 -20
- package/src/functions/interval.ts +74 -0
- package/src/functions/list.ts +63 -0
- package/src/functions/{literal.js → literal.ts} +5 -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/unnest.ts +13 -0
- 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 +79 -0
- package/src/load/{create.js → create.ts} +9 -3
- package/src/load/extension.ts +3 -0
- package/src/load/{load.js → load.ts} +25 -10
- 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.js → filter-query.ts} +10 -14
- 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 -39
- 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.js → clone.ts} +10 -10
- package/src/visit/{recurse.js → recurse.ts} +3 -1
- package/src/visit/{rewrite.js → rewrite.ts} +7 -7
- package/src/visit/{visitors.js → visitors.ts} +22 -30
- package/src/visit/walk.ts +46 -0
- 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/logical-op.js +0 -67
- package/src/ast/order-by.js +0 -48
- package/src/ast/sample.js +0 -53
- package/src/ast/verbatim.js +0 -33
- package/src/ast/window.js +0 -260
- package/src/functions/aggregate.js +0 -347
- package/src/functions/interval.js +0 -83
- 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/functions/window-frame.js +0 -61
- package/src/index-types.ts +0 -2
- package/src/load/extension.js +0 -3
- package/src/transforms/bin-date.js +0 -38
- 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 -34
- package/tsconfig.json +0 -8
- package/vitest.config.ts +0 -3
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { ExprValue, ExprVarArgs } from '../types.js';
|
|
2
|
+
import { BetweenOpNode, NotBetweenOpNode } from '../ast/between-op.js';
|
|
3
|
+
import { BinaryOpNode } from '../ast/binary-op.js';
|
|
4
|
+
import { InOpNode } from '../ast/in-op.js';
|
|
5
|
+
import { AndNode, OrNode } from '../ast/logical-op.js';
|
|
6
|
+
import { UnaryOpNode, UnaryPostfixOpNode } from '../ast/unary-op.js';
|
|
7
|
+
/**
|
|
8
|
+
* Logical and (AND) operator.
|
|
9
|
+
* @param clauses The input expressions.
|
|
10
|
+
*/
|
|
11
|
+
export declare function and(...clauses: ExprVarArgs[]): AndNode<import("../index.js").ExprNode>;
|
|
12
|
+
/**
|
|
13
|
+
* Logical or (OR) operator.
|
|
14
|
+
* @param clauses The input expressions.
|
|
15
|
+
*/
|
|
16
|
+
export declare function or(...clauses: ExprVarArgs[]): OrNode<import("../index.js").ExprNode>;
|
|
17
|
+
/**
|
|
18
|
+
* Logical not (NOT) operator.
|
|
19
|
+
* @param expr The expression to negate.
|
|
20
|
+
*/
|
|
21
|
+
export declare function not(expr: ExprValue): UnaryOpNode;
|
|
22
|
+
/**
|
|
23
|
+
* Null check (IS NULL) operator.
|
|
24
|
+
* @param expr The expression to test.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isNull(expr: ExprValue): UnaryPostfixOpNode;
|
|
27
|
+
/**
|
|
28
|
+
* Non-null check (IS NOT NULL) operator.
|
|
29
|
+
* @param expr The expression to test.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isNotNull(expr: ExprValue): UnaryPostfixOpNode;
|
|
32
|
+
/**
|
|
33
|
+
* Bitwise not (~) operator.
|
|
34
|
+
* @param expr The input expression.
|
|
35
|
+
*/
|
|
36
|
+
export declare function bitNot(expr: ExprValue): UnaryOpNode;
|
|
37
|
+
/**
|
|
38
|
+
* Bitwise and (&) operator.
|
|
39
|
+
* @param left The left argument.
|
|
40
|
+
* @param right The right argument.
|
|
41
|
+
*/
|
|
42
|
+
export declare function bitAnd(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
43
|
+
/**
|
|
44
|
+
* Bitwise or (|) operator.
|
|
45
|
+
* @param left The left argument.
|
|
46
|
+
* @param right The right argument.
|
|
47
|
+
*/
|
|
48
|
+
export declare function bitOr(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
49
|
+
/**
|
|
50
|
+
* Bit shift left (<<) operator.
|
|
51
|
+
* @param left The left argument.
|
|
52
|
+
* @param right The right argument.
|
|
53
|
+
*/
|
|
54
|
+
export declare function bitLeft(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
55
|
+
/**
|
|
56
|
+
* Bit shift right (>>) operator.
|
|
57
|
+
* @param left The left argument.
|
|
58
|
+
* @param right The right argument.
|
|
59
|
+
*/
|
|
60
|
+
export declare function bitRight(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
61
|
+
/**
|
|
62
|
+
* Addition (+) operator.
|
|
63
|
+
* @param left The left argument.
|
|
64
|
+
* @param right The right argument.
|
|
65
|
+
*/
|
|
66
|
+
export declare function add(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
67
|
+
/**
|
|
68
|
+
* Subtraction (-) operator.
|
|
69
|
+
* @param left The left argument.
|
|
70
|
+
* @param right The right argument.
|
|
71
|
+
*/
|
|
72
|
+
export declare function sub(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
73
|
+
/**
|
|
74
|
+
* Multiplication (*) operator.
|
|
75
|
+
* @param left The left argument.
|
|
76
|
+
* @param right The right argument.
|
|
77
|
+
*/
|
|
78
|
+
export declare function mul(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
79
|
+
/**
|
|
80
|
+
* Division (/) operator.
|
|
81
|
+
* @param left The left argument.
|
|
82
|
+
* @param right The right argument.
|
|
83
|
+
*/
|
|
84
|
+
export declare function div(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
85
|
+
/**
|
|
86
|
+
* Integer division (//) operator.
|
|
87
|
+
* @param left The left argument.
|
|
88
|
+
* @param right The right argument.
|
|
89
|
+
*/
|
|
90
|
+
export declare function idiv(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
91
|
+
/**
|
|
92
|
+
* Modulo (%) operator.
|
|
93
|
+
* @param left The left argument.
|
|
94
|
+
* @param right The right argument.
|
|
95
|
+
*/
|
|
96
|
+
export declare function mod(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
97
|
+
/**
|
|
98
|
+
* Exponentiation (**) operator.
|
|
99
|
+
* @param left The left argument.
|
|
100
|
+
* @param right The right argument.
|
|
101
|
+
*/
|
|
102
|
+
export declare function pow(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
103
|
+
/**
|
|
104
|
+
* Equality comparision (=) operator.
|
|
105
|
+
* @param left The left argument.
|
|
106
|
+
* @param right The right argument.
|
|
107
|
+
*/
|
|
108
|
+
export declare function eq(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
109
|
+
/**
|
|
110
|
+
* Non-equality comparision (<>) operator.
|
|
111
|
+
* @param left The left argument.
|
|
112
|
+
* @param right The right argument.
|
|
113
|
+
*/
|
|
114
|
+
export declare function neq(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
115
|
+
/**
|
|
116
|
+
* Less-than comparision (<) operator.
|
|
117
|
+
* @param left The left argument.
|
|
118
|
+
* @param right The right argument.
|
|
119
|
+
*/
|
|
120
|
+
export declare function lt(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
121
|
+
/**
|
|
122
|
+
* Greater-than comparision (>) operator.
|
|
123
|
+
* @param left The left argument.
|
|
124
|
+
* @param right The right argument.
|
|
125
|
+
*/
|
|
126
|
+
export declare function gt(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
127
|
+
/**
|
|
128
|
+
* Less-than or equal comparision (<=) operator.
|
|
129
|
+
* @param left The left argument.
|
|
130
|
+
* @param right The right argument.
|
|
131
|
+
*/
|
|
132
|
+
export declare function lte(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
133
|
+
/**
|
|
134
|
+
* Greater-than or equal comparision (>=) operator.
|
|
135
|
+
* @param left The left argument.
|
|
136
|
+
* @param right The right argument.
|
|
137
|
+
*/
|
|
138
|
+
export declare function gte(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
139
|
+
/**
|
|
140
|
+
* Null-inclusive non-equality (IS DISTINCT FROM) operator.
|
|
141
|
+
* @param left The left argument.
|
|
142
|
+
* @param right The right argument.
|
|
143
|
+
*/
|
|
144
|
+
export declare function isDistinct(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
145
|
+
/**
|
|
146
|
+
* Null-inclusive equality (IS NOT DISTINCT FROM) operator.
|
|
147
|
+
* @param left The left argument.
|
|
148
|
+
* @param right The right argument.
|
|
149
|
+
*/
|
|
150
|
+
export declare function isNotDistinct(left: ExprValue, right: ExprValue): BinaryOpNode;
|
|
151
|
+
/**
|
|
152
|
+
* Range inclusion (BETWEEN) operator.
|
|
153
|
+
* @param expr The expression to test.
|
|
154
|
+
* @param extent The range extent.
|
|
155
|
+
*/
|
|
156
|
+
export declare function isBetween(expr: ExprValue, extent?: ExprValue[] | null): BetweenOpNode;
|
|
157
|
+
/**
|
|
158
|
+
* Range exclusion (NOT BETWEEN) operator.
|
|
159
|
+
* @param expr The expression to test.
|
|
160
|
+
* @param extent The range extent.
|
|
161
|
+
*/
|
|
162
|
+
export declare function isNotBetween(expr: ExprValue, extent?: ExprValue[] | null): NotBetweenOpNode;
|
|
163
|
+
/**
|
|
164
|
+
* Set inclusion (IN) operator.
|
|
165
|
+
* @param expr The expression to test.
|
|
166
|
+
* @param values The included values.
|
|
167
|
+
*/
|
|
168
|
+
export declare function isIn(expr: ExprValue, values: ExprValue[]): InOpNode;
|
|
169
|
+
//# sourceMappingURL=operators.d.ts.map
|
|
@@ -0,0 +1 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EAAE,SAAS,gBAE3D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,gBAE9D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,iBAKrE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,oBAKxE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAExD"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { BetweenOpNode, NotBetweenOpNode } from '../ast/between-op.js';
|
|
2
|
+
import { BinaryOpNode } from '../ast/binary-op.js';
|
|
3
|
+
import { InOpNode } from '../ast/in-op.js';
|
|
4
|
+
import { AndNode, OrNode } from '../ast/logical-op.js';
|
|
5
|
+
import { UnaryOpNode, UnaryPostfixOpNode } from '../ast/unary-op.js';
|
|
6
|
+
import { asNode } from '../util/ast.js';
|
|
7
|
+
import { nodeList } from '../util/function.js';
|
|
8
|
+
function unaryOp(op, expr) {
|
|
9
|
+
return new UnaryOpNode(op, asNode(expr));
|
|
10
|
+
}
|
|
11
|
+
function unaryPostfixOp(op, expr) {
|
|
12
|
+
return new UnaryPostfixOpNode(op, asNode(expr));
|
|
13
|
+
}
|
|
14
|
+
function binaryOp(op, left, right) {
|
|
15
|
+
return new BinaryOpNode(op, asNode(left), asNode(right));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Logical and (AND) operator.
|
|
19
|
+
* @param clauses The input expressions.
|
|
20
|
+
*/
|
|
21
|
+
export function and(...clauses) {
|
|
22
|
+
return new AndNode(nodeList(clauses));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Logical or (OR) operator.
|
|
26
|
+
* @param clauses The input expressions.
|
|
27
|
+
*/
|
|
28
|
+
export function or(...clauses) {
|
|
29
|
+
return new OrNode(nodeList(clauses));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Logical not (NOT) operator.
|
|
33
|
+
* @param expr The expression to negate.
|
|
34
|
+
*/
|
|
35
|
+
export function not(expr) {
|
|
36
|
+
return unaryOp('NOT', expr);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Null check (IS NULL) operator.
|
|
40
|
+
* @param expr The expression to test.
|
|
41
|
+
*/
|
|
42
|
+
export function isNull(expr) {
|
|
43
|
+
return unaryPostfixOp('IS NULL', expr);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Non-null check (IS NOT NULL) operator.
|
|
47
|
+
* @param expr The expression to test.
|
|
48
|
+
*/
|
|
49
|
+
export function isNotNull(expr) {
|
|
50
|
+
return unaryPostfixOp('IS NOT NULL', expr);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Bitwise not (~) operator.
|
|
54
|
+
* @param expr The input expression.
|
|
55
|
+
*/
|
|
56
|
+
export function bitNot(expr) {
|
|
57
|
+
return unaryOp('~', expr);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Bitwise and (&) operator.
|
|
61
|
+
* @param left The left argument.
|
|
62
|
+
* @param right The right argument.
|
|
63
|
+
*/
|
|
64
|
+
export function bitAnd(left, right) {
|
|
65
|
+
return binaryOp('&', left, right);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Bitwise or (|) operator.
|
|
69
|
+
* @param left The left argument.
|
|
70
|
+
* @param right The right argument.
|
|
71
|
+
*/
|
|
72
|
+
export function bitOr(left, right) {
|
|
73
|
+
return binaryOp('|', left, right);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Bit shift left (<<) operator.
|
|
77
|
+
* @param left The left argument.
|
|
78
|
+
* @param right The right argument.
|
|
79
|
+
*/
|
|
80
|
+
export function bitLeft(left, right) {
|
|
81
|
+
return binaryOp('<<', left, right);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Bit shift right (>>) operator.
|
|
85
|
+
* @param left The left argument.
|
|
86
|
+
* @param right The right argument.
|
|
87
|
+
*/
|
|
88
|
+
export function bitRight(left, right) {
|
|
89
|
+
return binaryOp('>>', left, right);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Addition (+) operator.
|
|
93
|
+
* @param left The left argument.
|
|
94
|
+
* @param right The right argument.
|
|
95
|
+
*/
|
|
96
|
+
export function add(left, right) {
|
|
97
|
+
return binaryOp('+', left, right);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Subtraction (-) operator.
|
|
101
|
+
* @param left The left argument.
|
|
102
|
+
* @param right The right argument.
|
|
103
|
+
*/
|
|
104
|
+
export function sub(left, right) {
|
|
105
|
+
return binaryOp('-', left, right);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Multiplication (*) operator.
|
|
109
|
+
* @param left The left argument.
|
|
110
|
+
* @param right The right argument.
|
|
111
|
+
*/
|
|
112
|
+
export function mul(left, right) {
|
|
113
|
+
return binaryOp('*', left, right);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Division (/) operator.
|
|
117
|
+
* @param left The left argument.
|
|
118
|
+
* @param right The right argument.
|
|
119
|
+
*/
|
|
120
|
+
export function div(left, right) {
|
|
121
|
+
return binaryOp('/', left, right);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Integer division (//) operator.
|
|
125
|
+
* @param left The left argument.
|
|
126
|
+
* @param right The right argument.
|
|
127
|
+
*/
|
|
128
|
+
export function idiv(left, right) {
|
|
129
|
+
return binaryOp('//', left, right);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Modulo (%) operator.
|
|
133
|
+
* @param left The left argument.
|
|
134
|
+
* @param right The right argument.
|
|
135
|
+
*/
|
|
136
|
+
export function mod(left, right) {
|
|
137
|
+
return binaryOp('%', left, right);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Exponentiation (**) operator.
|
|
141
|
+
* @param left The left argument.
|
|
142
|
+
* @param right The right argument.
|
|
143
|
+
*/
|
|
144
|
+
export function pow(left, right) {
|
|
145
|
+
return binaryOp('**', left, right);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Equality comparision (=) operator.
|
|
149
|
+
* @param left The left argument.
|
|
150
|
+
* @param right The right argument.
|
|
151
|
+
*/
|
|
152
|
+
export function eq(left, right) {
|
|
153
|
+
return binaryOp('=', left, right);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Non-equality comparision (<>) operator.
|
|
157
|
+
* @param left The left argument.
|
|
158
|
+
* @param right The right argument.
|
|
159
|
+
*/
|
|
160
|
+
export function neq(left, right) {
|
|
161
|
+
return binaryOp('<>', left, right);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Less-than comparision (<) operator.
|
|
165
|
+
* @param left The left argument.
|
|
166
|
+
* @param right The right argument.
|
|
167
|
+
*/
|
|
168
|
+
export function lt(left, right) {
|
|
169
|
+
return binaryOp('<', left, right);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Greater-than comparision (>) operator.
|
|
173
|
+
* @param left The left argument.
|
|
174
|
+
* @param right The right argument.
|
|
175
|
+
*/
|
|
176
|
+
export function gt(left, right) {
|
|
177
|
+
return binaryOp('>', left, right);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Less-than or equal comparision (<=) operator.
|
|
181
|
+
* @param left The left argument.
|
|
182
|
+
* @param right The right argument.
|
|
183
|
+
*/
|
|
184
|
+
export function lte(left, right) {
|
|
185
|
+
return binaryOp('<=', left, right);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Greater-than or equal comparision (>=) operator.
|
|
189
|
+
* @param left The left argument.
|
|
190
|
+
* @param right The right argument.
|
|
191
|
+
*/
|
|
192
|
+
export function gte(left, right) {
|
|
193
|
+
return binaryOp('>=', left, right);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Null-inclusive non-equality (IS DISTINCT FROM) operator.
|
|
197
|
+
* @param left The left argument.
|
|
198
|
+
* @param right The right argument.
|
|
199
|
+
*/
|
|
200
|
+
export function isDistinct(left, right) {
|
|
201
|
+
return binaryOp('IS DISTINCT FROM', left, right);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Null-inclusive equality (IS NOT DISTINCT FROM) operator.
|
|
205
|
+
* @param left The left argument.
|
|
206
|
+
* @param right The right argument.
|
|
207
|
+
*/
|
|
208
|
+
export function isNotDistinct(left, right) {
|
|
209
|
+
return binaryOp('IS NOT DISTINCT FROM', left, right);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Range inclusion (BETWEEN) operator.
|
|
213
|
+
* @param expr The expression to test.
|
|
214
|
+
* @param extent The range extent.
|
|
215
|
+
*/
|
|
216
|
+
export function isBetween(expr, extent) {
|
|
217
|
+
return new BetweenOpNode(asNode(expr), extent?.map(asNode));
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Range exclusion (NOT BETWEEN) operator.
|
|
221
|
+
* @param expr The expression to test.
|
|
222
|
+
* @param extent The range extent.
|
|
223
|
+
*/
|
|
224
|
+
export function isNotBetween(expr, extent) {
|
|
225
|
+
return new NotBetweenOpNode(asNode(expr), extent?.map(asNode));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Set inclusion (IN) operator.
|
|
229
|
+
* @param expr The expression to test.
|
|
230
|
+
* @param values The included values.
|
|
231
|
+
*/
|
|
232
|
+
export function isIn(expr, values) {
|
|
233
|
+
return new InOpNode(asNode(expr), values.map(asNode));
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=operators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators.js","source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Value } from '../types.js';
|
|
2
|
+
import { OrderByNode } from '../ast/order-by.js';
|
|
3
|
+
/**
|
|
4
|
+
* Indicate ascending sort order for an expression.
|
|
5
|
+
* @param expr An expression to order by.
|
|
6
|
+
* @param nullsFirst Flag indicating if null values should be sorted first.
|
|
7
|
+
*/
|
|
8
|
+
export declare function asc(expr: ExprValue, nullsFirst?: boolean): OrderByNode;
|
|
9
|
+
/**
|
|
10
|
+
* Indicate descending sort order for an expression.
|
|
11
|
+
* @param expr An expression to order by.
|
|
12
|
+
* @param nullsFirst Flag indicating if null values should be sorted first.
|
|
13
|
+
*/
|
|
14
|
+
export declare function desc(expr: ExprValue, nullsFirst?: boolean): OrderByNode;
|
|
15
|
+
//# sourceMappingURL=order-by.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-by.d.ts","sourceRoot":"","sources":["../../../src/functions/order-by.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,eAExD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,eAEzD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OrderByNode } from '../ast/order-by.js';
|
|
2
|
+
import { asNode } from '../util/ast.js';
|
|
3
|
+
/**
|
|
4
|
+
* Indicate ascending sort order for an expression.
|
|
5
|
+
* @param expr An expression to order by.
|
|
6
|
+
* @param nullsFirst Flag indicating if null values should be sorted first.
|
|
7
|
+
*/
|
|
8
|
+
export function asc(expr, nullsFirst) {
|
|
9
|
+
return new OrderByNode(asNode(expr), false, nullsFirst);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Indicate descending sort order for an expression.
|
|
13
|
+
* @param expr An expression to order by.
|
|
14
|
+
* @param nullsFirst Flag indicating if null values should be sorted first.
|
|
15
|
+
*/
|
|
16
|
+
export function desc(expr, nullsFirst) {
|
|
17
|
+
return new OrderByNode(asNode(expr), true, nullsFirst);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=order-by.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-by.js","sourceRoot":"","sources":["../../../src/functions/order-by.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,IAAe,EAAE,UAAoB;IACvD,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,IAAe,EAAE,UAAoB;IACxD,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ExprValue } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Function that converts geometry data to GeoJSON format.
|
|
4
|
+
* @param expr The input expression.
|
|
5
|
+
*/
|
|
6
|
+
export declare function geojson(expr: ExprValue): import("../index.js").FunctionNode;
|
|
7
|
+
/**
|
|
8
|
+
* Function that returns a spatial x position (using ST_X).
|
|
9
|
+
* @param expr The input expression.
|
|
10
|
+
*/
|
|
11
|
+
export declare function x(expr: ExprValue): import("../index.js").FunctionNode;
|
|
12
|
+
/**
|
|
13
|
+
* Function that returns a spatial y position (using ST_Y).
|
|
14
|
+
* @param expr The input expression.
|
|
15
|
+
*/
|
|
16
|
+
export declare function y(expr: ExprValue): import("../index.js").FunctionNode;
|
|
17
|
+
/**
|
|
18
|
+
* Function that returns the centroid point for geometry data.
|
|
19
|
+
* @param expr The input expression.
|
|
20
|
+
*/
|
|
21
|
+
export declare function centroid(expr: ExprValue): import("../index.js").FunctionNode;
|
|
22
|
+
/**
|
|
23
|
+
* Function that returns the centroid x-coordinate for geometry data.
|
|
24
|
+
* @param expr The input expression.
|
|
25
|
+
*/
|
|
26
|
+
export declare function centroidX(expr: ExprValue): import("../index.js").FunctionNode;
|
|
27
|
+
/**
|
|
28
|
+
* Function that returns yhe centroid y-coordinate for geometry data.
|
|
29
|
+
* @param expr The input expression.
|
|
30
|
+
*/
|
|
31
|
+
export declare function centroidY(expr: ExprValue): import("../index.js").FunctionNode;
|
|
32
|
+
//# sourceMappingURL=spatial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial.d.ts","sourceRoot":"","sources":["../../../src/functions/spatial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,sCAEtC;AAED;;;GAGG;AACH,wBAAgB,CAAC,CAAC,IAAI,EAAE,SAAS,sCAEhC;AAED;;;GAGG;AACH,wBAAgB,CAAC,CAAC,IAAI,EAAE,SAAS,sCAEhC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,SAAS,sCAEvC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,sCAExC;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,sCAExC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { fn } from '../util/function.js';
|
|
2
|
+
/**
|
|
3
|
+
* Function that converts geometry data to GeoJSON format.
|
|
4
|
+
* @param expr The input expression.
|
|
5
|
+
*/
|
|
6
|
+
export function geojson(expr) {
|
|
7
|
+
return fn('st_asgeojson', expr);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Function that returns a spatial x position (using ST_X).
|
|
11
|
+
* @param expr The input expression.
|
|
12
|
+
*/
|
|
13
|
+
export function x(expr) {
|
|
14
|
+
return fn('st_x', expr);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Function that returns a spatial y position (using ST_Y).
|
|
18
|
+
* @param expr The input expression.
|
|
19
|
+
*/
|
|
20
|
+
export function y(expr) {
|
|
21
|
+
return fn('st_y', expr);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Function that returns the centroid point for geometry data.
|
|
25
|
+
* @param expr The input expression.
|
|
26
|
+
*/
|
|
27
|
+
export function centroid(expr) {
|
|
28
|
+
return fn('st_centroid', expr);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Function that returns the centroid x-coordinate for geometry data.
|
|
32
|
+
* @param expr The input expression.
|
|
33
|
+
*/
|
|
34
|
+
export function centroidX(expr) {
|
|
35
|
+
return x(centroid(expr));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Function that returns yhe centroid y-coordinate for geometry data.
|
|
39
|
+
* @param expr The input expression.
|
|
40
|
+
*/
|
|
41
|
+
export function centroidY(expr) {
|
|
42
|
+
return y(centroid(expr));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=spatial.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial.js","sourceRoot":"","sources":["../../../src/functions/spatial.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAEzC;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,IAAe;IACrC,OAAO,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,CAAC,CAAC,IAAe;IAC/B,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,CAAC,CAAC,IAAe;IAC/B,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAe;IACtC,OAAO,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExprNode } from '../ast/node.js';
|
|
2
|
+
import type { ParamLike } from '../types.js';
|
|
3
|
+
import { FragmentNode } from '../ast/fragment.js';
|
|
4
|
+
export type TemplateValue = ExprNode | ParamLike | string | number | boolean | Date;
|
|
5
|
+
/**
|
|
6
|
+
* Template tag function for SQL fragments. Interpolated values
|
|
7
|
+
* may be strings, other SQL expression objects (such as column
|
|
8
|
+
* references), primitive values, or dynamic parameters.
|
|
9
|
+
* @param strings Template string constants.
|
|
10
|
+
* @param exprs Template expression values.
|
|
11
|
+
*/
|
|
12
|
+
export declare function sql(strings: TemplateStringsArray, ...exprs: TemplateValue[]): FragmentNode;
|
|
13
|
+
//# sourceMappingURL=sql-template-tag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-template-tag.d.ts","sourceRoot":"","sources":["../../../src/functions/sql-template-tag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,CACL;AAEH;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,gBAE3E"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FragmentNode } from '../ast/fragment.js';
|
|
2
|
+
import { isNode } from '../ast/node.js';
|
|
3
|
+
import { ParamNode } from '../ast/param.js';
|
|
4
|
+
import { VerbatimNode } from '../ast/verbatim.js';
|
|
5
|
+
import { isParamLike, isString } from '../util/type-check.js';
|
|
6
|
+
import { literal } from './literal.js';
|
|
7
|
+
/**
|
|
8
|
+
* Template tag function for SQL fragments. Interpolated values
|
|
9
|
+
* may be strings, other SQL expression objects (such as column
|
|
10
|
+
* references), primitive values, or dynamic parameters.
|
|
11
|
+
* @param strings Template string constants.
|
|
12
|
+
* @param exprs Template expression values.
|
|
13
|
+
*/
|
|
14
|
+
export function sql(strings, ...exprs) {
|
|
15
|
+
return new FragmentNode(parseSQL(strings, exprs));
|
|
16
|
+
}
|
|
17
|
+
function parseSQL(strings, exprs) {
|
|
18
|
+
const spans = [strings[0]];
|
|
19
|
+
const n = exprs.length;
|
|
20
|
+
for (let i = 0, k = 0; i < n;) {
|
|
21
|
+
const e = exprs[i];
|
|
22
|
+
if (isNode(e)) {
|
|
23
|
+
spans[++k] = e;
|
|
24
|
+
}
|
|
25
|
+
else if (isParamLike(e)) {
|
|
26
|
+
spans[++k] = new ParamNode(e);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
spans[k] += isString(e) ? e : `${literal(e)}`;
|
|
30
|
+
}
|
|
31
|
+
const s = strings[++i];
|
|
32
|
+
if (isNode(spans[k])) {
|
|
33
|
+
spans[++k] = s;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
spans[k] += s;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// remove empty strings and preserve verbatim content
|
|
40
|
+
return spans
|
|
41
|
+
.filter(s => s)
|
|
42
|
+
.map(s => isString(s) ? new VerbatimNode(s) : s);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=sql-template-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-template-tag.js","sourceRoot":"","sources":["../../../src/functions/sql-template-tag.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAWvC;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CAAC,OAA6B,EAAE,GAAG,KAAsB;IAC1E,OAAO,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,QAAQ,CAAC,OAA6B,EAAE,KAAsB;IACrE,MAAM,KAAK,GAA0B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC;QAC9B,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACd,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;aAAM,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1B,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,CAAC;QACD,MAAM,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACvB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrB,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAEA,qDAAqD;IACtD,OAAO,KAAK;SACT,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACd,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ExprValue, StringValue } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Function that returns true if a string contains a regexp pattern,
|
|
4
|
+
* false otherwise.
|
|
5
|
+
* @param string The string match against.
|
|
6
|
+
* @param pattern The regular expression pattern to match.
|
|
7
|
+
* @param options Regular expression options:
|
|
8
|
+
* 'c': case-sensitive matching
|
|
9
|
+
* 'i': case-insensitive matching
|
|
10
|
+
* 'l': match literals instead of regular expression tokens
|
|
11
|
+
* 'm', 'n', 'p': newline sensitive matching
|
|
12
|
+
* 'g': global replace, only available for regexp_replace
|
|
13
|
+
* 's': non-newline sensitive matching
|
|
14
|
+
*/
|
|
15
|
+
export declare function regexp_matches(string: ExprValue, pattern: StringValue, options?: StringValue): import("../index.js").FunctionNode;
|
|
16
|
+
/**
|
|
17
|
+
* Function that returns true if search_string is found within string.
|
|
18
|
+
* @param string The string to match against.
|
|
19
|
+
* @param search_string The substring to search for.
|
|
20
|
+
*/
|
|
21
|
+
export declare function contains(string: ExprValue, search_string: StringValue): import("../index.js").FunctionNode;
|
|
22
|
+
/**
|
|
23
|
+
* Function that returns true if string begins with search_string.
|
|
24
|
+
* @param string The string to match against.
|
|
25
|
+
* @param search_string The substring to search for.
|
|
26
|
+
*/
|
|
27
|
+
export declare function prefix(string: ExprValue, search_string: StringValue): import("../index.js").FunctionNode;
|
|
28
|
+
/**
|
|
29
|
+
* Function that returns true if string ends with search_string.
|
|
30
|
+
* @param string The string to match against.
|
|
31
|
+
* @param search_string The substring to search for.
|
|
32
|
+
*/
|
|
33
|
+
export declare function suffix(string: ExprValue, search_string: StringValue): import("../index.js").FunctionNode;
|
|
34
|
+
/**
|
|
35
|
+
* Function that converts string to lower case.
|
|
36
|
+
* @param string The string to convert.
|
|
37
|
+
*/
|
|
38
|
+
export declare function lower(string: ExprValue): import("../index.js").FunctionNode;
|
|
39
|
+
/**
|
|
40
|
+
* Function that converts string to upper case.
|
|
41
|
+
* @param string The string to convert.
|
|
42
|
+
*/
|
|
43
|
+
export declare function upper(string: ExprValue): import("../index.js").FunctionNode;
|
|
44
|
+
/**
|
|
45
|
+
* Function that returns the number of characters in string.
|
|
46
|
+
* @param value The string to measure.
|
|
47
|
+
*/
|
|
48
|
+
export declare function length(value: ExprValue): import("../index.js").FunctionNode;
|
|
49
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../src/functions/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ1D;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,WAAW,sCAGtB;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,sCAErE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,sCAEnE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,sCAEnE;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,sCAEtC;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,sCAEtC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,sCAEtC"}
|