@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
package/src/functions/numeric.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { FunctionNode } from '../ast/function.js'
|
|
3
|
-
* @import { ExprValue } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { fn } from '../util/function.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Return true if the floating point value is not a number, false otherwise.
|
|
9
|
-
* @param {ExprValue} expr The input number.
|
|
10
|
-
* @returns {FunctionNode}
|
|
11
|
-
*/
|
|
12
|
-
export function isNaN(expr) {
|
|
13
|
-
return fn('isnan', expr);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Return true if the floating point value is finite, false otherwise.
|
|
18
|
-
* @param {ExprValue} expr The input number.
|
|
19
|
-
* @returns {FunctionNode}
|
|
20
|
-
*/
|
|
21
|
-
export function isFinite(expr) {
|
|
22
|
-
return fn('isfinite', expr);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Return true if the floating point value is infinite, false otherwise.
|
|
27
|
-
* @param {ExprValue} expr The input number.
|
|
28
|
-
* @returns {FunctionNode}
|
|
29
|
-
*/
|
|
30
|
-
export function isInfinite(expr) {
|
|
31
|
-
return fn('isinf', expr);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Selects the largest value.
|
|
36
|
-
* @param {...ExprValue} expr The input expressions.
|
|
37
|
-
* @returns {FunctionNode}
|
|
38
|
-
*/
|
|
39
|
-
export function greatest(...expr) {
|
|
40
|
-
return fn('greatest', ...expr);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Selects the smallest value.
|
|
45
|
-
* @param {...ExprValue} expr The input expressions.
|
|
46
|
-
* @returns {FunctionNode}
|
|
47
|
-
*/
|
|
48
|
-
export function least(...expr) {
|
|
49
|
-
return fn('least', ...expr);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Compute the exponentional function `e ** expr`.
|
|
54
|
-
* @param {ExprValue} expr The input number.
|
|
55
|
-
* @returns {FunctionNode}
|
|
56
|
-
*/
|
|
57
|
-
export function exp(expr) {
|
|
58
|
-
return fn('exp', expr);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Compute a base 10 logarithm.
|
|
63
|
-
* @param {ExprValue} expr The input number.
|
|
64
|
-
* @returns {FunctionNode}
|
|
65
|
-
*/
|
|
66
|
-
export function log(expr) {
|
|
67
|
-
return fn('log', expr);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Compute a natural logarithm.
|
|
72
|
-
* @param {ExprValue} expr The input number.
|
|
73
|
-
* @returns {FunctionNode}
|
|
74
|
-
*/
|
|
75
|
-
export function ln(expr) {
|
|
76
|
-
return fn('ln', expr);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Compute the sign of a number.
|
|
81
|
-
* @param {ExprValue} expr The input number.
|
|
82
|
-
* @returns {FunctionNode}
|
|
83
|
-
*/
|
|
84
|
-
export function sign(expr) {
|
|
85
|
-
return fn('sign', expr);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Compute the absolute value of a number.
|
|
90
|
-
* @param {ExprValue} expr The input number.
|
|
91
|
-
* @returns {FunctionNode}
|
|
92
|
-
*/
|
|
93
|
-
export function abs(expr) {
|
|
94
|
-
return fn('abs', expr);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Compute the square root of a number.
|
|
99
|
-
* @param {ExprValue} expr The input number.
|
|
100
|
-
* @returns {FunctionNode}
|
|
101
|
-
*/
|
|
102
|
-
export function sqrt(expr) {
|
|
103
|
-
return fn('sqrt', expr);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Rounds the number up.
|
|
108
|
-
* @param {ExprValue} expr The input number.
|
|
109
|
-
* @returns {FunctionNode}
|
|
110
|
-
*/
|
|
111
|
-
export function ceil(expr) {
|
|
112
|
-
return fn('ceil', expr);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Rounds the number down.
|
|
117
|
-
* @param {ExprValue} expr The input number.
|
|
118
|
-
* @returns {FunctionNode}
|
|
119
|
-
*/
|
|
120
|
-
export function floor(expr) {
|
|
121
|
-
return fn('floor', expr);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Round to the given decimal places.
|
|
126
|
-
* @param {ExprValue} expr The input number.
|
|
127
|
-
* @param {ExprValue} [places] The decimal places.
|
|
128
|
-
* Negative values are allowed, to round to tens, hundreds, etc.
|
|
129
|
-
* If unspecified, defaults to zero.
|
|
130
|
-
* @returns {FunctionNode}
|
|
131
|
-
*/
|
|
132
|
-
export function round(expr, places) {
|
|
133
|
-
return fn('round', expr, places);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Truncates the number.
|
|
138
|
-
* @param {ExprValue} expr The input number.
|
|
139
|
-
* @returns {FunctionNode}
|
|
140
|
-
*/
|
|
141
|
-
export function trunc(expr) {
|
|
142
|
-
return fn('trunc', expr);
|
|
143
|
-
}
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ExprValue, ExprVarArgs } from '../types.js'
|
|
3
|
-
*/
|
|
4
|
-
import { BetweenOpNode, NotBetweenOpNode } from '../ast/between-op.js';
|
|
5
|
-
import { BinaryOpNode } from '../ast/binary-op.js';
|
|
6
|
-
import { InOpNode } from '../ast/in-op.js';
|
|
7
|
-
import { AndNode, OrNode } from '../ast/logical-op.js';
|
|
8
|
-
import { UnaryOpNode, UnaryPosftixOpNode } from '../ast/unary-op.js';
|
|
9
|
-
import { asNode } from '../util/ast.js';
|
|
10
|
-
import { exprList } from '../util/function.js';
|
|
11
|
-
|
|
12
|
-
function unaryOp(op, expr) {
|
|
13
|
-
return new UnaryOpNode(op, asNode(expr));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function unaryPostfixOp(op, expr) {
|
|
17
|
-
return new UnaryPosftixOpNode(op, asNode(expr));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function binaryOp(op, left, right) {
|
|
21
|
-
return new BinaryOpNode(op, asNode(left), asNode(right));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function betweenOp(expr, extent, negate = false) {
|
|
25
|
-
const Op = negate ? NotBetweenOpNode : BetweenOpNode;
|
|
26
|
-
return new Op(asNode(expr), extent?.map(asNode));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Logical and (AND) operator.
|
|
31
|
-
* @param {...ExprVarArgs} clauses The input expressions.
|
|
32
|
-
* @returns {AndNode}
|
|
33
|
-
*/
|
|
34
|
-
export function and(...clauses) {
|
|
35
|
-
return new AndNode(exprList(clauses));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Logical or (OR) operator.
|
|
40
|
-
* @param {...ExprVarArgs} clauses The input expressions.
|
|
41
|
-
* @returns {OrNode}
|
|
42
|
-
*/
|
|
43
|
-
export function or(...clauses) {
|
|
44
|
-
return new OrNode(exprList(clauses));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Logical not (NOT) operator.
|
|
49
|
-
* @param {ExprValue} expr The expression to negate.
|
|
50
|
-
* @returns {UnaryOpNode}
|
|
51
|
-
*/
|
|
52
|
-
export function not(expr) {
|
|
53
|
-
return unaryOp('NOT', expr);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Null check (IS NULL) operator.
|
|
58
|
-
* @param {ExprValue} expr The expression to test.
|
|
59
|
-
* @returns {UnaryPosftixOpNode}
|
|
60
|
-
*/
|
|
61
|
-
export function isNull(expr) {
|
|
62
|
-
return unaryPostfixOp('IS NULL', expr);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Non-null check (IS NOT NULL) operator.
|
|
67
|
-
* @param {ExprValue} expr The expression to test.
|
|
68
|
-
* @returns {UnaryPosftixOpNode}
|
|
69
|
-
*/
|
|
70
|
-
export function isNotNull(expr) {
|
|
71
|
-
return unaryPostfixOp('IS NOT NULL', expr);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Bitwise not (~) operator.
|
|
76
|
-
* @param {ExprValue} expr The input expression.
|
|
77
|
-
* @returns {UnaryOpNode}
|
|
78
|
-
*/
|
|
79
|
-
export function bitNot(expr) {
|
|
80
|
-
return unaryOp('~', expr);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Bitwise and (&) operator.
|
|
85
|
-
* @param {ExprValue} left The left argument.
|
|
86
|
-
* @param {ExprValue} right The right argument.
|
|
87
|
-
* @returns {BinaryOpNode}
|
|
88
|
-
*/
|
|
89
|
-
export function bitAnd(left, right) {
|
|
90
|
-
return binaryOp('&', left, right);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Bitwise or (|) operator.
|
|
95
|
-
* @param {ExprValue} left The left argument.
|
|
96
|
-
* @param {ExprValue} right The right argument.
|
|
97
|
-
* @returns {BinaryOpNode}
|
|
98
|
-
*/
|
|
99
|
-
export function bitOr(left, right) {
|
|
100
|
-
return binaryOp('|', left, right);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Bit shift left (<<) operator.
|
|
105
|
-
* @param {ExprValue} left The left argument.
|
|
106
|
-
* @param {ExprValue} right The right argument.
|
|
107
|
-
* @returns {BinaryOpNode}
|
|
108
|
-
*/
|
|
109
|
-
export function bitLeft(left, right) {
|
|
110
|
-
return binaryOp('<<', left, right);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Bit shift right (>>) operator.
|
|
115
|
-
* @param {ExprValue} left The left argument.
|
|
116
|
-
* @param {ExprValue} right The right argument.
|
|
117
|
-
* @returns {BinaryOpNode}
|
|
118
|
-
*/
|
|
119
|
-
export function bitRight(left, right) {
|
|
120
|
-
return binaryOp('>>', left, right);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Addition (+) operator.
|
|
125
|
-
* @param {ExprValue} left The left argument.
|
|
126
|
-
* @param {ExprValue} right The right argument.
|
|
127
|
-
* @returns {BinaryOpNode}
|
|
128
|
-
*/
|
|
129
|
-
export function add(left, right) {
|
|
130
|
-
return binaryOp('+', left, right);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Subtraction (-) operator.
|
|
135
|
-
* @param {ExprValue} left The left argument.
|
|
136
|
-
* @param {ExprValue} right The right argument.
|
|
137
|
-
* @returns {BinaryOpNode}
|
|
138
|
-
*/
|
|
139
|
-
export function sub(left, right) {
|
|
140
|
-
return binaryOp('-', left, right);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Multiplication (*) operator.
|
|
145
|
-
* @param {ExprValue} left The left argument.
|
|
146
|
-
* @param {ExprValue} right The right argument.
|
|
147
|
-
* @returns {BinaryOpNode}
|
|
148
|
-
*/
|
|
149
|
-
export function mul(left, right) {
|
|
150
|
-
return binaryOp('*', left, right);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Division (/) operator.
|
|
155
|
-
* @param {ExprValue} left The left argument.
|
|
156
|
-
* @param {ExprValue} right The right argument.
|
|
157
|
-
* @returns {BinaryOpNode}
|
|
158
|
-
*/
|
|
159
|
-
export function div(left, right) {
|
|
160
|
-
return binaryOp('/', left, right);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Integer division (//) operator.
|
|
165
|
-
* @param {ExprValue} left The left argument.
|
|
166
|
-
* @param {ExprValue} right The right argument.
|
|
167
|
-
* @returns {BinaryOpNode}
|
|
168
|
-
*/
|
|
169
|
-
export function idiv(left, right) {
|
|
170
|
-
return binaryOp('//', left, right);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Modulo (%) operator.
|
|
175
|
-
* @param {ExprValue} left The left argument.
|
|
176
|
-
* @param {ExprValue} right The right argument.
|
|
177
|
-
* @returns {BinaryOpNode}
|
|
178
|
-
*/
|
|
179
|
-
export function mod(left, right) {
|
|
180
|
-
return binaryOp('%', left, right);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Exponentiation (**) operator.
|
|
185
|
-
* @param {ExprValue} left The left argument.
|
|
186
|
-
* @param {ExprValue} right The right argument.
|
|
187
|
-
* @returns {BinaryOpNode}
|
|
188
|
-
*/
|
|
189
|
-
export function pow(left, right) {
|
|
190
|
-
return binaryOp('**', left, right);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Equality comparision (=) operator.
|
|
195
|
-
* @param {ExprValue} left The left argument.
|
|
196
|
-
* @param {ExprValue} right The right argument.
|
|
197
|
-
* @returns {BinaryOpNode}
|
|
198
|
-
*/
|
|
199
|
-
export function eq(left, right) {
|
|
200
|
-
return binaryOp('=', left, right);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Non-equality comparision (<>) operator.
|
|
205
|
-
* @param {ExprValue} left The left argument.
|
|
206
|
-
* @param {ExprValue} right The right argument.
|
|
207
|
-
* @returns {BinaryOpNode}
|
|
208
|
-
*/
|
|
209
|
-
export function neq(left, right) {
|
|
210
|
-
return binaryOp('<>', left, right);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Less-than comparision (<) operator.
|
|
215
|
-
* @param {ExprValue} left The left argument.
|
|
216
|
-
* @param {ExprValue} right The right argument.
|
|
217
|
-
* @returns {BinaryOpNode}
|
|
218
|
-
*/
|
|
219
|
-
export function lt(left, right) {
|
|
220
|
-
return binaryOp('<', left, right);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* Greater-than comparision (>) operator.
|
|
225
|
-
* @param {ExprValue} left The left argument.
|
|
226
|
-
* @param {ExprValue} right The right argument.
|
|
227
|
-
* @returns {BinaryOpNode}
|
|
228
|
-
*/
|
|
229
|
-
export function gt(left, right) {
|
|
230
|
-
return binaryOp('>', left, right);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Less-than or equal comparision (<=) operator.
|
|
235
|
-
* @param {ExprValue} left The left argument.
|
|
236
|
-
* @param {ExprValue} right The right argument.
|
|
237
|
-
* @returns {BinaryOpNode}
|
|
238
|
-
*/
|
|
239
|
-
export function lte(left, right) {
|
|
240
|
-
return binaryOp('<=', left, right);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Greater-than or equal comparision (>=) operator.
|
|
245
|
-
* @param {ExprValue} left The left argument.
|
|
246
|
-
* @param {ExprValue} right The right argument.
|
|
247
|
-
* @returns {BinaryOpNode}
|
|
248
|
-
*/
|
|
249
|
-
export function gte(left, right) {
|
|
250
|
-
return binaryOp('>=', left, right);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Null-inclusive non-equality (IS DISTINCT FROM) operator.
|
|
255
|
-
* @param {ExprValue} left The left argument.
|
|
256
|
-
* @param {ExprValue} right The right argument.
|
|
257
|
-
* @returns {BinaryOpNode}
|
|
258
|
-
*/
|
|
259
|
-
export function isDistinct(left, right) {
|
|
260
|
-
return binaryOp('IS DISTINCT FROM', left, right);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Null-inclusive equality (IS NOT DISTINCT FROM) operator.
|
|
265
|
-
* @param {ExprValue} left The left argument.
|
|
266
|
-
* @param {ExprValue} right The right argument.
|
|
267
|
-
* @returns {BinaryOpNode}
|
|
268
|
-
*/
|
|
269
|
-
export function isNotDistinct(left, right) {
|
|
270
|
-
return binaryOp('IS NOT DISTINCT FROM', left, right);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Range inclusion (BETWEEN) operator.
|
|
275
|
-
* @param {ExprValue} expr The expression to test.
|
|
276
|
-
* @param {ExprValue[]} extent The range extent.
|
|
277
|
-
* @returns {BetweenOpNode}
|
|
278
|
-
*/
|
|
279
|
-
export function isBetween(expr, extent) {
|
|
280
|
-
return betweenOp(expr, extent, false);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Range exclusion (NOT BETWEEN) operator.
|
|
285
|
-
* @param {ExprValue} expr The expression to test.
|
|
286
|
-
* @param {ExprValue[]} extent The range extent.
|
|
287
|
-
* @returns {NotBetweenOpNode}
|
|
288
|
-
*/
|
|
289
|
-
export function isNotBetween(expr, extent) {
|
|
290
|
-
return betweenOp(expr, extent, true);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Set inclusion (IN) operator.
|
|
295
|
-
* @param {ExprValue} expr The expression to test.
|
|
296
|
-
* @param {ExprValue[]} values The included values.
|
|
297
|
-
* @returns {InOpNode}
|
|
298
|
-
*/
|
|
299
|
-
export function isIn(expr, values) {
|
|
300
|
-
return new InOpNode(asNode(expr), values.map(asNode));
|
|
301
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ExprValue } from '../types.js'
|
|
3
|
-
*/
|
|
4
|
-
import { OrderByNode } from '../ast/order-by.js';
|
|
5
|
-
import { asNode } from '../util/ast.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Indicate ascending sort order for an expression.
|
|
9
|
-
* @param {ExprValue} expr An expression to order by.
|
|
10
|
-
* @param {boolean | undefined} [nullsFirst] Flag indicating if null values
|
|
11
|
-
* should be sorted first.
|
|
12
|
-
* @returns {OrderByNode}
|
|
13
|
-
*/
|
|
14
|
-
export function asc(expr, nullsFirst) {
|
|
15
|
-
return new OrderByNode(asNode(expr), false, nullsFirst);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Indicate descending sort order for an expression.
|
|
20
|
-
* @param {ExprValue} expr An expression to order by.
|
|
21
|
-
* @param {boolean | undefined} [nullsFirst] Flag indicating if null values
|
|
22
|
-
* should be sorted first.
|
|
23
|
-
* @returns {OrderByNode}
|
|
24
|
-
*/
|
|
25
|
-
export function desc(expr, nullsFirst) {
|
|
26
|
-
return new OrderByNode(asNode(expr), true, nullsFirst);
|
|
27
|
-
}
|
package/src/functions/spatial.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { FunctionNode } from '../ast/function.js'
|
|
3
|
-
* @import { ExprValue } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { fn } from '../util/function.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Function that converts geometry data to GeoJSON format.
|
|
9
|
-
* @param {ExprValue} expr The input expression.
|
|
10
|
-
* @returns {FunctionNode}
|
|
11
|
-
*/
|
|
12
|
-
export function geojson(expr) {
|
|
13
|
-
return fn('st_asgeojson', expr);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Function that returns a spatial x position (using ST_X).
|
|
18
|
-
* @param {ExprValue} expr The input expression.
|
|
19
|
-
* @returns {FunctionNode}
|
|
20
|
-
*/
|
|
21
|
-
export function x(expr) {
|
|
22
|
-
return fn('st_x', expr);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Function that returns a spatial y position (using ST_Y).
|
|
27
|
-
* @param {ExprValue} expr The input expression.
|
|
28
|
-
* @returns {FunctionNode}
|
|
29
|
-
*/
|
|
30
|
-
export function y(expr) {
|
|
31
|
-
return fn('st_y', expr);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Function that returns the centroid point for geometry data.
|
|
36
|
-
* @param {ExprValue} expr The input expression.
|
|
37
|
-
* @returns {FunctionNode}
|
|
38
|
-
*/
|
|
39
|
-
export function centroid(expr) {
|
|
40
|
-
return fn('st_centroid', expr);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Function that returns the centroid x-coordinate for geometry data.
|
|
45
|
-
* @param {ExprValue} expr The input expression.
|
|
46
|
-
* @returns {FunctionNode}
|
|
47
|
-
*/
|
|
48
|
-
export function centroidX(expr) {
|
|
49
|
-
return x(centroid(expr));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Function that returns yhe centroid y-coordinate for geometry data.
|
|
54
|
-
* @param {ExprValue} expr The input expression.
|
|
55
|
-
* @returns {FunctionNode}
|
|
56
|
-
*/
|
|
57
|
-
export function centroidY(expr) {
|
|
58
|
-
return y(centroid(expr));
|
|
59
|
-
}
|
package/src/functions/string.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { FunctionNode } from '../ast/function.js'
|
|
3
|
-
* @import { ExprValue, StringValue } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { asLiteral } from '../util/ast.js';
|
|
6
|
-
import { argsList, fn } from '../util/function.js';
|
|
7
|
-
|
|
8
|
-
function strFn(name, expr, ...args) {
|
|
9
|
-
return fn(name, expr, ...(argsList(args).map(asLiteral)));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Function that returns true if a string contains a regexp pattern,
|
|
14
|
-
* false otherwise.
|
|
15
|
-
* @param {ExprValue} string The string match against.
|
|
16
|
-
* @param {StringValue} pattern The regular expression pattern to match.
|
|
17
|
-
* @param {StringValue} [options] Regular expression options:
|
|
18
|
-
* 'c': case-sensitive matching
|
|
19
|
-
* 'i': case-insensitive matching
|
|
20
|
-
* 'l': match literals instead of regular expression tokens
|
|
21
|
-
* 'm', 'n', 'p': newline sensitive matching
|
|
22
|
-
* 'g': global replace, only available for regexp_replace
|
|
23
|
-
* 's': non-newline sensitive matching
|
|
24
|
-
* @returns {FunctionNode}
|
|
25
|
-
*/
|
|
26
|
-
export function regexp_matches(string, pattern, options) {
|
|
27
|
-
return strFn('regexp_matches', string, pattern, options);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Function that returns true if search_string is found within string.
|
|
32
|
-
* @param {ExprValue} string The string to match against.
|
|
33
|
-
* @param {StringValue} search_string The substring to search for.
|
|
34
|
-
* @returns {FunctionNode}
|
|
35
|
-
*/
|
|
36
|
-
export function contains(string, search_string) {
|
|
37
|
-
return strFn('contains', string, search_string);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Function that returns true if string begins with search_string.
|
|
42
|
-
* @param {ExprValue} string The string to match against.
|
|
43
|
-
* @param {StringValue} search_string The substring to search for.
|
|
44
|
-
* @returns {FunctionNode}
|
|
45
|
-
*/
|
|
46
|
-
export function prefix(string, search_string) {
|
|
47
|
-
return strFn('starts_with', string, search_string);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Function that returns true if string ends with search_string.
|
|
52
|
-
* @param {ExprValue} string The string to match against.
|
|
53
|
-
* @param {StringValue} search_string The substring to search for.
|
|
54
|
-
* @returns {FunctionNode}
|
|
55
|
-
*/
|
|
56
|
-
export function suffix(string, search_string) {
|
|
57
|
-
return strFn('ends_with', string, search_string);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Function that converts string to lower case.
|
|
62
|
-
* @param {ExprValue} string The string to convert.
|
|
63
|
-
* @returns {FunctionNode}
|
|
64
|
-
*/
|
|
65
|
-
export function lower(string) {
|
|
66
|
-
return strFn('lower', string);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Function that converts string to upper case.
|
|
71
|
-
* @param {ExprValue} string The string to convert.
|
|
72
|
-
* @returns {FunctionNode}
|
|
73
|
-
*/
|
|
74
|
-
export function upper(string) {
|
|
75
|
-
return strFn('upper', string);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Function that returns the number of characters in string.
|
|
80
|
-
* @param {ExprValue} value The string to measure.
|
|
81
|
-
* @returns {FunctionNode}
|
|
82
|
-
*/
|
|
83
|
-
export function length(value) {
|
|
84
|
-
return strFn('length', value);
|
|
85
|
-
}
|
package/src/functions/util.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { FunctionNode } from '../ast/function.js'
|
|
3
|
-
* @import { ExprValue } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { fn } from '../util/function.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Returns the first non-null argument.
|
|
9
|
-
* @param {...ExprValue} expr The input expressions.
|
|
10
|
-
* @returns {FunctionNode}
|
|
11
|
-
*/
|
|
12
|
-
export function coalesce(...expr) {
|
|
13
|
-
return fn('coalesce', ...expr);
|
|
14
|
-
}
|
package/src/index-types.ts
DELETED
package/src/load/extension.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ExprNode } from '../ast/node.js'
|
|
3
|
-
* @import { ExprValue, TimeUnit } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { dateBin, interval } from '../functions/datetime.js';
|
|
6
|
-
import { add } from '../functions/operators.js';
|
|
7
|
-
import { timeInterval } from './util/time-interval.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {object} BinDateOptions
|
|
11
|
-
* @property {TimeUnit} [interval] A string indicating a time interval
|
|
12
|
-
* unit, such as 'year', 'day', or 'hour'.
|
|
13
|
-
* @property {number} [step] The number of time interval steps to
|
|
14
|
-
* take, such as 2 years or 3 months.
|
|
15
|
-
* @property {number} [offset] The number of bin steps (default 0) by
|
|
16
|
-
* which to offset the result.
|
|
17
|
-
* @property {number} [steps] The desired number of binning steps.
|
|
18
|
-
* This value is a hint, it does not guarantee an exact number of steps.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Return a SQL expression for date/time bins.
|
|
23
|
-
* @param {ExprValue} field The column or expression to bin.
|
|
24
|
-
* @param {[Date|number, Date|number]} extent The min/max extent over which to bin.
|
|
25
|
-
* @param {BinDateOptions} [options] Datetime binning options.
|
|
26
|
-
* @returns {ExprNode}
|
|
27
|
-
*/
|
|
28
|
-
export function binDate(field, extent, options = {}) {
|
|
29
|
-
const { offset = 0 } = options;
|
|
30
|
-
|
|
31
|
-
// use interval if provided, otherwise determine from extent
|
|
32
|
-
const { unit, step = 1 } = options.interval
|
|
33
|
-
? { unit: options.interval, step: options.step }
|
|
34
|
-
: timeInterval(extent[0], extent[1], options.steps || 40);
|
|
35
|
-
const bin = dateBin(field, unit, step);
|
|
36
|
-
return offset ? add(bin, interval(unit, offset * step)) : bin;
|
|
37
|
-
}
|