@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
|
@@ -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
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { FrameExclude } from '../ast/window-frame.js'
|
|
3
|
-
* @import { FrameExtent, FrameValue } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { CURRENT_ROW, FOLLOWING, GROUPS, PRECEDING, RANGE, ROWS, WindowFrameExprNode, WindowFrameNode } from '../ast/window-frame.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Return an updated window definition with the given rows frame.
|
|
9
|
-
* @param {FrameExtent} extent The row-based window frame extent.
|
|
10
|
-
* @param {FrameExclude} [exclude] The window frame exclusion criteria.
|
|
11
|
-
* @returns {WindowFrameNode} A window frame node.
|
|
12
|
-
*/
|
|
13
|
-
export function frameRows(extent, exclude) {
|
|
14
|
-
return new WindowFrameNode(ROWS, extent, exclude);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Return an updated window definition with the given range frame.
|
|
19
|
-
* @param {FrameExtent} extent The range-based window frame extent.
|
|
20
|
-
* @param {FrameExclude} [exclude] The window frame exclusion criteria.
|
|
21
|
-
* @returns {WindowFrameNode} A window frame node.
|
|
22
|
-
*/
|
|
23
|
-
export function frameRange(extent, exclude) {
|
|
24
|
-
return new WindowFrameNode(RANGE, extent, exclude);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Return an updated window definition with the given groups frame.
|
|
29
|
-
* @param {FrameExtent} extent The group-based window frame extent.
|
|
30
|
-
* @param {FrameExclude} [exclude] The window frame exclusion criteria.
|
|
31
|
-
* @returns {WindowFrameNode} A window frame node.
|
|
32
|
-
*/
|
|
33
|
-
export function frameGroups(extent, exclude) {
|
|
34
|
-
return new WindowFrameNode(GROUPS, extent, exclude);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* A `PRECEDING` frame value expression.
|
|
39
|
-
* @param {FrameValue} value The frame value.
|
|
40
|
-
* @returns {WindowFrameExprNode} A preceding value.
|
|
41
|
-
*/
|
|
42
|
-
export function preceding(value) {
|
|
43
|
-
return new WindowFrameExprNode(PRECEDING, value);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* A `FOLLOWING` frame value expression.
|
|
48
|
-
* @param {FrameValue} value The frame value.
|
|
49
|
-
* @returns {WindowFrameExprNode} A following value.
|
|
50
|
-
*/
|
|
51
|
-
export function following(value) {
|
|
52
|
-
return new WindowFrameExprNode(FOLLOWING, value);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A `CURRENT ROW` frame value expression.
|
|
57
|
-
* @returns {WindowFrameExprNode} A current row value.
|
|
58
|
-
*/
|
|
59
|
-
export function currentRow() {
|
|
60
|
-
return new WindowFrameExprNode(CURRENT_ROW);
|
|
61
|
-
}
|
package/src/index-types.ts
DELETED
package/src/load/extension.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ExprNode } from '../ast/node.js'
|
|
3
|
-
* @import { ExprValue, TimeUnit } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { dateBin } from '../functions/datetime.js';
|
|
6
|
-
import { interval } from '../functions/interval.js';
|
|
7
|
-
import { add } from '../functions/operators.js';
|
|
8
|
-
import { timeInterval } from './util/time-interval.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {object} BinDateOptions
|
|
12
|
-
* @property {TimeUnit} [interval] A string indicating a time interval
|
|
13
|
-
* unit, such as 'year', 'day', or 'hour'.
|
|
14
|
-
* @property {number} [step] The number of time interval steps to
|
|
15
|
-
* take, such as 2 years or 3 months.
|
|
16
|
-
* @property {number} [offset] The number of bin steps (default 0) by
|
|
17
|
-
* which to offset the result.
|
|
18
|
-
* @property {number} [steps] The desired number of binning steps.
|
|
19
|
-
* This value is a hint, it does not guarantee an exact number of steps.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Return a SQL expression for date/time bins.
|
|
24
|
-
* @param {ExprValue} field The column or expression to bin.
|
|
25
|
-
* @param {[Date|number, Date|number]} extent The min/max extent over which to bin.
|
|
26
|
-
* @param {BinDateOptions} [options] Datetime binning options.
|
|
27
|
-
* @returns {ExprNode}
|
|
28
|
-
*/
|
|
29
|
-
export function binDate(field, extent, options = {}) {
|
|
30
|
-
const { offset = 0 } = options;
|
|
31
|
-
|
|
32
|
-
// use interval if provided, otherwise determine from extent
|
|
33
|
-
const { unit, step = 1 } = options.interval
|
|
34
|
-
? { unit: options.interval, step: options.step }
|
|
35
|
-
: timeInterval(extent[0], extent[1], options.steps || 40);
|
|
36
|
-
const bin = dateBin(field, unit, step);
|
|
37
|
-
return offset ? add(bin, interval(unit, offset * step)) : bin;
|
|
38
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @import { ExprNode } from '../ast/node.js'
|
|
3
|
-
* @import { ExprValue } from '../types.js'
|
|
4
|
-
*/
|
|
5
|
-
import { float64 } from '../functions/cast.js';
|
|
6
|
-
import { floor } from '../functions/numeric.js';
|
|
7
|
-
import { add, div, mul, sub } from '../functions/operators.js';
|
|
8
|
-
import { binSpec } from './util/bin-step.js';
|
|
9
|
-
import { scaleTransform } from './scales.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {object} BinHistogramOptions
|
|
13
|
-
* @property {number} [step] An exact binning step to use.
|
|
14
|
-
* @property {number} [steps] The desired number of binning steps.
|
|
15
|
-
* This value is a hint, it does not guarantee an exact number of steps.
|
|
16
|
-
* @property {number} [minstep] A minimum binning step value. No generated
|
|
17
|
-
* step can be less than this value.
|
|
18
|
-
* @property {boolean} [nice] A boolean flag (default true) indicating if bin
|
|
19
|
-
* extents should be snapped to "nice" numbers such as multiples of 5 or 10.
|
|
20
|
-
* @property {number} [offset] The number of bin steps (default 0) by
|
|
21
|
-
* which to offset the result.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Return a SQL expression for histogram bins.
|
|
26
|
-
* @param {ExprValue} field The column or expression to bin.
|
|
27
|
-
* @param {[number, number]} extent The min/max extent over which to bin.
|
|
28
|
-
* @param {BinHistogramOptions} [options] Binning options.
|
|
29
|
-
* @param {ReturnType<typeof scaleTransform>} [transform] Scale transforms to
|
|
30
|
-
* apply to create (potentially non-linear) binning intervals.
|
|
31
|
-
* @returns {ExprNode} The resulting SQL expression
|
|
32
|
-
*/
|
|
33
|
-
export function binHistogram(
|
|
34
|
-
field,
|
|
35
|
-
extent,
|
|
36
|
-
options = {},
|
|
37
|
-
transform = scaleTransform({ type: 'linear' })
|
|
38
|
-
) {
|
|
39
|
-
const [min, max] = extent;
|
|
40
|
-
const { offset = 0 } = options;
|
|
41
|
-
const { apply, sqlApply, sqlInvert } = transform;
|
|
42
|
-
const b = binSpec(apply(min), apply(max), options);
|
|
43
|
-
const col = sqlApply(field);
|
|
44
|
-
const alpha = (b.max - b.min) / b.steps;
|
|
45
|
-
|
|
46
|
-
let expr = b.min === 0 ? col : sub(col, b.min);
|
|
47
|
-
if (alpha !== 1) expr = div(expr, float64(alpha));
|
|
48
|
-
expr = floor(offset ? add(offset, expr) : expr);
|
|
49
|
-
if (alpha !== 1) expr = mul(alpha, expr);
|
|
50
|
-
if (b.min !== 0) expr = add(b.min, expr);
|
|
51
|
-
return sqlInvert(expr);
|
|
52
|
-
}
|