@quereus/quereus 4.4.1 → 4.6.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/README.md +5 -4
- package/dist/src/core/database-events.d.ts +99 -1
- package/dist/src/core/database-events.d.ts.map +1 -1
- package/dist/src/core/database-events.js +219 -3
- package/dist/src/core/database-events.js.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-analysis.js +1 -0
- package/dist/src/core/database-materialized-views-analysis.js.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.d.ts.map +1 -1
- package/dist/src/core/database-materialized-views-plan-builders.js +29 -2
- package/dist/src/core/database-materialized-views-plan-builders.js.map +1 -1
- package/dist/src/core/database-transaction.d.ts +9 -0
- package/dist/src/core/database-transaction.d.ts.map +1 -1
- package/dist/src/core/database-transaction.js +9 -0
- package/dist/src/core/database-transaction.js.map +1 -1
- package/dist/src/core/database.d.ts +7 -1
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +20 -5
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/func/builtins/aggregate.js +11 -11
- package/dist/src/func/builtins/aggregate.js.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.d.ts.map +1 -1
- package/dist/src/func/builtins/builtin-window-functions.js +15 -85
- package/dist/src/func/builtins/builtin-window-functions.js.map +1 -1
- package/dist/src/func/builtins/conversion.d.ts.map +1 -1
- package/dist/src/func/builtins/conversion.js +10 -9
- package/dist/src/func/builtins/conversion.js.map +1 -1
- package/dist/src/func/builtins/datetime.d.ts.map +1 -1
- package/dist/src/func/builtins/datetime.js +28 -10
- package/dist/src/func/builtins/datetime.js.map +1 -1
- package/dist/src/func/builtins/json.d.ts.map +1 -1
- package/dist/src/func/builtins/json.js +23 -17
- package/dist/src/func/builtins/json.js.map +1 -1
- package/dist/src/func/builtins/mutation.js +2 -2
- package/dist/src/func/builtins/mutation.js.map +1 -1
- package/dist/src/func/builtins/return-types.d.ts +327 -0
- package/dist/src/func/builtins/return-types.d.ts.map +1 -0
- package/dist/src/func/builtins/return-types.js +43 -0
- package/dist/src/func/builtins/return-types.js.map +1 -0
- package/dist/src/func/builtins/scalar.d.ts.map +1 -1
- package/dist/src/func/builtins/scalar.js +193 -37
- package/dist/src/func/builtins/scalar.js.map +1 -1
- package/dist/src/func/builtins/schema.d.ts.map +1 -1
- package/dist/src/func/builtins/schema.js +11 -3
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/func/builtins/string.d.ts.map +1 -1
- package/dist/src/func/builtins/string.js +4 -2
- package/dist/src/func/builtins/string.js.map +1 -1
- package/dist/src/func/builtins/timespan.d.ts +3 -0
- package/dist/src/func/builtins/timespan.d.ts.map +1 -1
- package/dist/src/func/builtins/timespan.js +15 -11
- package/dist/src/func/builtins/timespan.js.map +1 -1
- package/dist/src/func/registration.d.ts +39 -1
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +236 -41
- package/dist/src/func/registration.js.map +1 -1
- package/dist/src/index.d.ts +14 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/parser.d.ts +46 -0
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +160 -44
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -1
- package/dist/src/planner/analysis/check-extraction.js +37 -4
- package/dist/src/planner/analysis/check-extraction.js.map +1 -1
- package/dist/src/planner/analysis/coarsened-key.d.ts +4 -3
- package/dist/src/planner/analysis/coarsened-key.d.ts.map +1 -1
- package/dist/src/planner/analysis/coarsened-key.js +37 -3
- package/dist/src/planner/analysis/coarsened-key.js.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.d.ts +41 -13
- package/dist/src/planner/analysis/comparison-collation.d.ts.map +1 -1
- package/dist/src/planner/analysis/comparison-collation.js +51 -14
- package/dist/src/planner/analysis/comparison-collation.js.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.d.ts +0 -7
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +59 -59
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.d.ts +13 -2
- package/dist/src/planner/analysis/coverage-prover.d.ts.map +1 -1
- package/dist/src/planner/analysis/coverage-prover.js +10 -14
- package/dist/src/planner/analysis/coverage-prover.js.map +1 -1
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts +10 -4
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -1
- package/dist/src/planner/analysis/predicate-conjuncts.js +28 -7
- package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.d.ts.map +1 -1
- package/dist/src/planner/analysis/query-rewrite-matcher.js +8 -27
- package/dist/src/planner/analysis/query-rewrite-matcher.js.map +1 -1
- package/dist/src/planner/analysis/scalar-subqueries.d.ts +22 -3
- package/dist/src/planner/analysis/scalar-subqueries.d.ts.map +1 -1
- package/dist/src/planner/analysis/scalar-subqueries.js +32 -3
- package/dist/src/planner/analysis/scalar-subqueries.js.map +1 -1
- package/dist/src/planner/analysis/set-op-type-merge.d.ts +64 -0
- package/dist/src/planner/analysis/set-op-type-merge.d.ts.map +1 -0
- package/dist/src/planner/analysis/set-op-type-merge.js +97 -0
- package/dist/src/planner/analysis/set-op-type-merge.js.map +1 -0
- package/dist/src/planner/building/alter-table.d.ts.map +1 -1
- package/dist/src/planner/building/alter-table.js +65 -27
- package/dist/src/planner/building/alter-table.js.map +1 -1
- package/dist/src/planner/building/coercion.d.ts +54 -0
- package/dist/src/planner/building/coercion.d.ts.map +1 -0
- package/dist/src/planner/building/coercion.js +88 -0
- package/dist/src/planner/building/coercion.js.map +1 -0
- package/dist/src/planner/building/constraint-builder.d.ts.map +1 -1
- package/dist/src/planner/building/constraint-builder.js +5 -18
- package/dist/src/planner/building/constraint-builder.js.map +1 -1
- package/dist/src/planner/building/expression.d.ts +17 -0
- package/dist/src/planner/building/expression.d.ts.map +1 -1
- package/dist/src/planner/building/expression.js +23 -115
- package/dist/src/planner/building/expression.js.map +1 -1
- package/dist/src/planner/building/function-call.d.ts.map +1 -1
- package/dist/src/planner/building/function-call.js +13 -0
- package/dist/src/planner/building/function-call.js.map +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts +1 -1
- package/dist/src/planner/building/select-aggregates.d.ts.map +1 -1
- package/dist/src/planner/building/select-aggregates.js +53 -2
- package/dist/src/planner/building/select-aggregates.js.map +1 -1
- package/dist/src/planner/building/select-compound.d.ts.map +1 -1
- package/dist/src/planner/building/select-compound.js +10 -6
- package/dist/src/planner/building/select-compound.js.map +1 -1
- package/dist/src/planner/building/select-context.d.ts +7 -0
- package/dist/src/planner/building/select-context.d.ts.map +1 -1
- package/dist/src/planner/building/select-context.js +10 -40
- package/dist/src/planner/building/select-context.js.map +1 -1
- package/dist/src/planner/building/select.d.ts +37 -1
- package/dist/src/planner/building/select.d.ts.map +1 -1
- package/dist/src/planner/building/select.js +112 -51
- package/dist/src/planner/building/select.js.map +1 -1
- package/dist/src/planner/cost/conjunct-cost.d.ts +82 -0
- package/dist/src/planner/cost/conjunct-cost.d.ts.map +1 -0
- package/dist/src/planner/cost/conjunct-cost.js +107 -0
- package/dist/src/planner/cost/conjunct-cost.js.map +1 -0
- package/dist/src/planner/cost/index.d.ts +10 -0
- package/dist/src/planner/cost/index.d.ts.map +1 -1
- package/dist/src/planner/cost/index.js +15 -0
- package/dist/src/planner/cost/index.js.map +1 -1
- package/dist/src/planner/mutation/propagate.d.ts.map +1 -1
- package/dist/src/planner/mutation/propagate.js +1 -0
- package/dist/src/planner/mutation/propagate.js.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.d.ts +6 -0
- package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.js +10 -2
- package/dist/src/planner/nodes/aggregate-node.js.map +1 -1
- package/dist/src/planner/nodes/alias-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alias-node.js +2 -1
- package/dist/src/planner/nodes/alias-node.js.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.d.ts +24 -8
- package/dist/src/planner/nodes/alter-table-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/alter-table-node.js.map +1 -1
- package/dist/src/planner/nodes/asof-scan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/asof-scan-node.js +4 -1
- package/dist/src/planner/nodes/asof-scan-node.js.map +1 -1
- package/dist/src/planner/nodes/asserted-keys-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/asserted-keys-node.js +2 -1
- package/dist/src/planner/nodes/asserted-keys-node.js.map +1 -1
- package/dist/src/planner/nodes/async-gather-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/async-gather-node.js +19 -8
- package/dist/src/planner/nodes/async-gather-node.js.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.d.ts +2 -0
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +17 -7
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/cache-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/cache-node.js +2 -1
- package/dist/src/planner/nodes/cache-node.js.map +1 -1
- package/dist/src/planner/nodes/distinct-node.d.ts +6 -0
- package/dist/src/planner/nodes/distinct-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/distinct-node.js +10 -2
- package/dist/src/planner/nodes/distinct-node.js.map +1 -1
- package/dist/src/planner/nodes/eager-prefetch-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/eager-prefetch-node.js +2 -1
- package/dist/src/planner/nodes/eager-prefetch-node.js.map +1 -1
- package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts +5 -0
- package/dist/src/planner/nodes/fanout-lookup-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/fanout-lookup-join-node.js +13 -6
- package/dist/src/planner/nodes/fanout-lookup-join-node.js.map +1 -1
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +12 -5
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts +6 -0
- package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +10 -2
- package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts +25 -1
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +38 -10
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +78 -0
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +73 -0
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts +87 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.js +141 -0
- package/dist/src/planner/nodes/key-set-semi-join-node.js.map +1 -0
- package/dist/src/planner/nodes/lens-auxiliary-access-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js +2 -1
- package/dist/src/planner/nodes/lens-auxiliary-access-node.js.map +1 -1
- package/dist/src/planner/nodes/limit-offset.d.ts +6 -0
- package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
- package/dist/src/planner/nodes/limit-offset.js +10 -2
- package/dist/src/planner/nodes/limit-offset.js.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.d.ts +2 -0
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +21 -8
- package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts +5 -0
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.js +9 -2
- package/dist/src/planner/nodes/ordinal-slice-node.js.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.d.ts +1 -0
- package/dist/src/planner/nodes/plan-node-type.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node-type.js +1 -0
- package/dist/src/planner/nodes/plan-node-type.js.map +1 -1
- package/dist/src/planner/nodes/plan-node.d.ts +24 -0
- package/dist/src/planner/nodes/plan-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/plan-node.js.map +1 -1
- package/dist/src/planner/nodes/project-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/project-node.js +2 -1
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +3 -2
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +2 -1
- package/dist/src/planner/nodes/retrieve-node.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +5 -18
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.d.ts +68 -16
- package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.js +147 -26
- package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
- package/dist/src/planner/nodes/sort.d.ts.map +1 -1
- package/dist/src/planner/nodes/sort.js +3 -1
- package/dist/src/planner/nodes/sort.js.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts +6 -0
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +10 -2
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +19 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +18 -2
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/nodes/window-function.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-function.js +8 -0
- package/dist/src/planner/nodes/window-function.js.map +1 -1
- package/dist/src/planner/nodes/window-node.d.ts +1 -1
- package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-node.js +3 -1
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts +9 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +126 -6
- package/dist/src/planner/optimizer.js.map +1 -1
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts +68 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.d.ts.map +1 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.js +343 -0
- package/dist/src/planner/rules/access/rule-key-set-seek.js.map +1 -0
- package/dist/src/planner/rules/access/rule-monotonic-range-access.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js +2 -2
- package/dist/src/planner/rules/access/rule-monotonic-range-access.js.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts +46 -0
- package/dist/src/planner/rules/access/rule-select-access-path.d.ts.map +1 -1
- package/dist/src/planner/rules/access/rule-select-access-path.js +54 -13
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.js +9 -0
- package/dist/src/planner/rules/cache/rule-cte-optimization.js.map +1 -1
- package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.d.ts.map +1 -1
- package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js +6 -4
- package/dist/src/planner/rules/cache/rule-nested-loop-right-cache.js.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts +49 -49
- package/dist/src/planner/rules/join/equi-pair-extractor.d.ts.map +1 -1
- package/dist/src/planner/rules/join/equi-pair-extractor.js +54 -58
- package/dist/src/planner/rules/join/equi-pair-extractor.js.map +1 -1
- package/dist/src/planner/rules/join/index-nested-loop.d.ts +49 -0
- package/dist/src/planner/rules/join/index-nested-loop.d.ts.map +1 -0
- package/dist/src/planner/rules/join/index-nested-loop.js +285 -0
- package/dist/src/planner/rules/join/index-nested-loop.js.map +1 -0
- package/dist/src/planner/rules/join/rule-fanout-batched-outer.js +8 -8
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts +10 -4
- package/dist/src/planner/rules/join/rule-join-physical-selection.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-physical-selection.js +97 -29
- package/dist/src/planner/rules/join/rule-join-physical-selection.js.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js +15 -5
- package/dist/src/planner/rules/join/rule-monotonic-merge-join.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +1 -1
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts +43 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js +119 -0
- package/dist/src/planner/rules/predicate/rule-filter-conjunct-ordering.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts +44 -3
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js +142 -18
- package/dist/src/planner/rules/predicate/rule-filter-selectivity.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts +73 -0
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js +205 -0
- package/dist/src/planner/rules/predicate/rule-join-predicate-pushdown.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts +14 -11
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +21 -85
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts +10 -2
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.d.ts.map +1 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js +20 -2
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.d.ts.map +1 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js +18 -3
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +1 -1
- package/dist/src/planner/rules/shared/access-leaf.d.ts +39 -0
- package/dist/src/planner/rules/shared/access-leaf.d.ts.map +1 -0
- package/dist/src/planner/rules/shared/access-leaf.js +79 -0
- package/dist/src/planner/rules/shared/access-leaf.js.map +1 -0
- package/dist/src/planner/rules/shared/index-style-context.d.ts +17 -0
- package/dist/src/planner/rules/shared/index-style-context.d.ts.map +1 -1
- package/dist/src/planner/rules/shared/index-style-context.js +7 -0
- package/dist/src/planner/rules/shared/index-style-context.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +18 -8
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts +3 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +27 -10
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts +24 -6
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +243 -70
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts +17 -7
- package/dist/src/planner/rules/window/rule-monotonic-window.d.ts.map +1 -1
- package/dist/src/planner/rules/window/rule-monotonic-window.js +124 -87
- package/dist/src/planner/rules/window/rule-monotonic-window.js.map +1 -1
- package/dist/src/planner/scopes/aliased.d.ts.map +1 -1
- package/dist/src/planner/scopes/aliased.js +6 -0
- package/dist/src/planner/scopes/aliased.js.map +1 -1
- package/dist/src/planner/stats/catalog-stats.d.ts +87 -4
- package/dist/src/planner/stats/catalog-stats.d.ts.map +1 -1
- package/dist/src/planner/stats/catalog-stats.js +250 -28
- package/dist/src/planner/stats/catalog-stats.js.map +1 -1
- package/dist/src/planner/stats/conjunct-selectivity.d.ts +48 -0
- package/dist/src/planner/stats/conjunct-selectivity.d.ts.map +1 -0
- package/dist/src/planner/stats/conjunct-selectivity.js +168 -0
- package/dist/src/planner/stats/conjunct-selectivity.js.map +1 -0
- package/dist/src/planner/stats/index.d.ts +36 -2
- package/dist/src/planner/stats/index.d.ts.map +1 -1
- package/dist/src/planner/stats/index.js.map +1 -1
- package/dist/src/planner/stats/selectivity-combine.d.ts +53 -0
- package/dist/src/planner/stats/selectivity-combine.d.ts.map +1 -0
- package/dist/src/planner/stats/selectivity-combine.js +75 -0
- package/dist/src/planner/stats/selectivity-combine.js.map +1 -0
- package/dist/src/planner/stats/table-cardinality.d.ts +28 -0
- package/dist/src/planner/stats/table-cardinality.d.ts.map +1 -0
- package/dist/src/planner/stats/table-cardinality.js +29 -0
- package/dist/src/planner/stats/table-cardinality.js.map +1 -0
- package/dist/src/planner/util/column-origins.d.ts +79 -0
- package/dist/src/planner/util/column-origins.d.ts.map +1 -0
- package/dist/src/planner/util/column-origins.js +150 -0
- package/dist/src/planner/util/column-origins.js.map +1 -0
- package/dist/src/planner/util/fd-utils.d.ts +32 -8
- package/dist/src/planner/util/fd-utils.d.ts.map +1 -1
- package/dist/src/planner/util/fd-utils.js +46 -9
- package/dist/src/planner/util/fd-utils.js.map +1 -1
- package/dist/src/planner/util/ind-utils.d.ts +56 -17
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -1
- package/dist/src/planner/util/ind-utils.js +82 -21
- package/dist/src/planner/util/ind-utils.js.map +1 -1
- package/dist/src/planner/util/key-utils.d.ts +20 -2
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +37 -3
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/planner/util/row-estimates.d.ts +28 -0
- package/dist/src/planner/util/row-estimates.d.ts.map +1 -0
- package/dist/src/planner/util/row-estimates.js +40 -0
- package/dist/src/planner/util/row-estimates.js.map +1 -0
- package/dist/src/planner/util/row-population.d.ts +42 -0
- package/dist/src/planner/util/row-population.d.ts.map +1 -0
- package/dist/src/planner/util/row-population.js +71 -0
- package/dist/src/planner/util/row-population.js.map +1 -0
- package/dist/src/runtime/deferred-constraint-queue.d.ts +40 -0
- package/dist/src/runtime/deferred-constraint-queue.d.ts.map +1 -1
- package/dist/src/runtime/deferred-constraint-queue.js +90 -9
- package/dist/src/runtime/deferred-constraint-queue.js.map +1 -1
- package/dist/src/runtime/emit/add-constraint.d.ts.map +1 -1
- package/dist/src/runtime/emit/add-constraint.js +39 -1
- package/dist/src/runtime/emit/add-constraint.js.map +1 -1
- package/dist/src/runtime/emit/aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/aggregate.js +4 -4
- package/dist/src/runtime/emit/aggregate.js.map +1 -1
- package/dist/src/runtime/emit/alter-schema-event.d.ts +42 -0
- package/dist/src/runtime/emit/alter-schema-event.d.ts.map +1 -0
- package/dist/src/runtime/emit/alter-schema-event.js +28 -0
- package/dist/src/runtime/emit/alter-schema-event.js.map +1 -0
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +386 -154
- package/dist/src/runtime/emit/alter-table.js.map +1 -1
- package/dist/src/runtime/emit/analyze.d.ts.map +1 -1
- package/dist/src/runtime/emit/analyze.js +35 -3
- package/dist/src/runtime/emit/analyze.js.map +1 -1
- package/dist/src/runtime/emit/asof-scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/asof-scan.js +8 -3
- package/dist/src/runtime/emit/asof-scan.js.map +1 -1
- package/dist/src/runtime/emit/between.d.ts.map +1 -1
- package/dist/src/runtime/emit/between.js +4 -38
- package/dist/src/runtime/emit/between.js.map +1 -1
- package/dist/src/runtime/emit/binary.d.ts.map +1 -1
- package/dist/src/runtime/emit/binary.js +2 -23
- package/dist/src/runtime/emit/binary.js.map +1 -1
- package/dist/src/runtime/emit/bloom-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/bloom-join.js +6 -35
- package/dist/src/runtime/emit/bloom-join.js.map +1 -1
- package/dist/src/runtime/emit/case.d.ts.map +1 -1
- package/dist/src/runtime/emit/case.js +40 -6
- package/dist/src/runtime/emit/case.js.map +1 -1
- package/dist/src/runtime/emit/cast.d.ts.map +1 -1
- package/dist/src/runtime/emit/cast.js +4 -19
- package/dist/src/runtime/emit/cast.js.map +1 -1
- package/dist/src/runtime/emit/constraint-check.d.ts.map +1 -1
- package/dist/src/runtime/emit/constraint-check.js +32 -8
- package/dist/src/runtime/emit/constraint-check.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +90 -50
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-index.d.ts.map +1 -1
- package/dist/src/runtime/emit/drop-index.js +4 -3
- package/dist/src/runtime/emit/drop-index.js.map +1 -1
- package/dist/src/runtime/emit/filter.d.ts +18 -0
- package/dist/src/runtime/emit/filter.d.ts.map +1 -1
- package/dist/src/runtime/emit/filter.js +52 -10
- package/dist/src/runtime/emit/filter.js.map +1 -1
- package/dist/src/runtime/emit/hash-aggregate.d.ts.map +1 -1
- package/dist/src/runtime/emit/hash-aggregate.js +2 -2
- package/dist/src/runtime/emit/hash-aggregate.js.map +1 -1
- package/dist/src/runtime/emit/join-key-extractor.d.ts +46 -0
- package/dist/src/runtime/emit/join-key-extractor.d.ts.map +1 -0
- package/dist/src/runtime/emit/join-key-extractor.js +60 -0
- package/dist/src/runtime/emit/join-key-extractor.js.map +1 -0
- package/dist/src/runtime/emit/join.d.ts.map +1 -1
- package/dist/src/runtime/emit/join.js +8 -46
- package/dist/src/runtime/emit/join.js.map +1 -1
- package/dist/src/runtime/emit/key-set-semi-join.d.ts +29 -0
- package/dist/src/runtime/emit/key-set-semi-join.d.ts.map +1 -0
- package/dist/src/runtime/emit/key-set-semi-join.js +149 -0
- package/dist/src/runtime/emit/key-set-semi-join.js.map +1 -0
- package/dist/src/runtime/emit/merge-join.d.ts.map +1 -1
- package/dist/src/runtime/emit/merge-join.js +15 -8
- package/dist/src/runtime/emit/merge-join.js.map +1 -1
- package/dist/src/runtime/emit/operand-comparator.d.ts +70 -0
- package/dist/src/runtime/emit/operand-comparator.d.ts.map +1 -0
- package/dist/src/runtime/emit/operand-comparator.js +93 -0
- package/dist/src/runtime/emit/operand-comparator.js.map +1 -0
- package/dist/src/runtime/emit/scan.d.ts.map +1 -1
- package/dist/src/runtime/emit/scan.js +11 -2
- package/dist/src/runtime/emit/scan.js.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.d.ts.map +1 -1
- package/dist/src/runtime/emit/schema-declarative.js +30 -0
- package/dist/src/runtime/emit/schema-declarative.js.map +1 -1
- package/dist/src/runtime/emit/subquery.d.ts.map +1 -1
- package/dist/src/runtime/emit/subquery.js +153 -52
- package/dist/src/runtime/emit/subquery.js.map +1 -1
- package/dist/src/runtime/emit/window.js +36 -23
- package/dist/src/runtime/emit/window.js.map +1 -1
- package/dist/src/runtime/parallel-driver.d.ts +5 -2
- package/dist/src/runtime/parallel-driver.d.ts.map +1 -1
- package/dist/src/runtime/parallel-driver.js +6 -2
- package/dist/src/runtime/parallel-driver.js.map +1 -1
- package/dist/src/runtime/register.d.ts.map +1 -1
- package/dist/src/runtime/register.js +2 -0
- package/dist/src/runtime/register.js.map +1 -1
- package/dist/src/runtime/types.d.ts +7 -0
- package/dist/src/runtime/types.d.ts.map +1 -1
- package/dist/src/runtime/types.js.map +1 -1
- package/dist/src/schema/catalog-persistability.d.ts +19 -16
- package/dist/src/schema/catalog-persistability.d.ts.map +1 -1
- package/dist/src/schema/catalog-persistability.js +76 -20
- package/dist/src/schema/catalog-persistability.js.map +1 -1
- package/dist/src/schema/catalog.d.ts +67 -2
- package/dist/src/schema/catalog.d.ts.map +1 -1
- package/dist/src/schema/catalog.js +194 -3
- package/dist/src/schema/catalog.js.map +1 -1
- package/dist/src/schema/column.d.ts +26 -3
- package/dist/src/schema/column.d.ts.map +1 -1
- package/dist/src/schema/column.js.map +1 -1
- package/dist/src/schema/ddl-generator.d.ts.map +1 -1
- package/dist/src/schema/ddl-generator.js +19 -6
- package/dist/src/schema/ddl-generator.js.map +1 -1
- package/dist/src/schema/function.d.ts +40 -0
- package/dist/src/schema/function.d.ts.map +1 -1
- package/dist/src/schema/function.js +10 -2
- package/dist/src/schema/function.js.map +1 -1
- package/dist/src/schema/manager.d.ts +84 -7
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +153 -53
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/schema-differ.d.ts.map +1 -1
- package/dist/src/schema/schema-differ.js +104 -28
- package/dist/src/schema/schema-differ.js.map +1 -1
- package/dist/src/schema/table.d.ts +149 -1
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +248 -1
- package/dist/src/schema/table.js.map +1 -1
- package/dist/src/schema/unique-enforcement.d.ts +5 -3
- package/dist/src/schema/unique-enforcement.d.ts.map +1 -1
- package/dist/src/schema/unique-enforcement.js +5 -3
- package/dist/src/schema/unique-enforcement.js.map +1 -1
- package/dist/src/types/builtin-types.d.ts +16 -0
- package/dist/src/types/builtin-types.d.ts.map +1 -1
- package/dist/src/types/builtin-types.js +76 -12
- package/dist/src/types/builtin-types.js.map +1 -1
- package/dist/src/types/cast-semantics.d.ts +42 -0
- package/dist/src/types/cast-semantics.d.ts.map +1 -1
- package/dist/src/types/cast-semantics.js +64 -0
- package/dist/src/types/cast-semantics.js.map +1 -1
- package/dist/src/types/comparison-coercion.d.ts +101 -0
- package/dist/src/types/comparison-coercion.d.ts.map +1 -0
- package/dist/src/types/comparison-coercion.js +162 -0
- package/dist/src/types/comparison-coercion.js.map +1 -0
- package/dist/src/types/index.d.ts +2 -2
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +2 -2
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/logical-type.d.ts +7 -0
- package/dist/src/types/logical-type.d.ts.map +1 -1
- package/dist/src/types/logical-type.js.map +1 -1
- package/dist/src/types/validation.d.ts +56 -0
- package/dist/src/types/validation.d.ts.map +1 -1
- package/dist/src/types/validation.js +68 -0
- package/dist/src/types/validation.js.map +1 -1
- package/dist/src/util/coercion.d.ts +8 -0
- package/dist/src/util/coercion.d.ts.map +1 -1
- package/dist/src/util/coercion.js +8 -0
- package/dist/src/util/coercion.js.map +1 -1
- package/dist/src/util/comparison.d.ts +41 -3
- package/dist/src/util/comparison.d.ts.map +1 -1
- package/dist/src/util/comparison.js +52 -5
- package/dist/src/util/comparison.js.map +1 -1
- package/dist/src/util/key-serializer.d.ts +46 -0
- package/dist/src/util/key-serializer.d.ts.map +1 -1
- package/dist/src/util/key-serializer.js +47 -0
- package/dist/src/util/key-serializer.js.map +1 -1
- package/dist/src/util/value-set.d.ts +21 -0
- package/dist/src/util/value-set.d.ts.map +1 -0
- package/dist/src/util/value-set.js +22 -0
- package/dist/src/util/value-set.js.map +1 -0
- package/dist/src/vtab/best-access-plan.d.ts +87 -0
- package/dist/src/vtab/best-access-plan.d.ts.map +1 -1
- package/dist/src/vtab/best-access-plan.js +87 -0
- package/dist/src/vtab/best-access-plan.js.map +1 -1
- package/dist/src/vtab/capabilities.d.ts +1 -1
- package/dist/src/vtab/events.d.ts +5 -1
- package/dist/src/vtab/events.d.ts.map +1 -1
- package/dist/src/vtab/events.js.map +1 -1
- package/dist/src/vtab/memory/layer/alter-column.d.ts +147 -0
- package/dist/src/vtab/memory/layer/alter-column.d.ts.map +1 -0
- package/dist/src/vtab/memory/layer/alter-column.js +214 -0
- package/dist/src/vtab/memory/layer/alter-column.js.map +1 -0
- package/dist/src/vtab/memory/layer/base.d.ts +6 -4
- package/dist/src/vtab/memory/layer/base.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/base.js +10 -7
- package/dist/src/vtab/memory/layer/base.js.map +1 -1
- package/dist/src/vtab/memory/layer/interface.d.ts +2 -2
- package/dist/src/vtab/memory/layer/interface.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts +232 -39
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +657 -519
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/scan-layer.js +32 -5
- package/dist/src/vtab/memory/layer/scan-layer.js.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.d.ts +111 -16
- package/dist/src/vtab/memory/layer/transaction.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/transaction.js +154 -51
- package/dist/src/vtab/memory/layer/transaction.js.map +1 -1
- package/dist/src/vtab/memory/module.d.ts +14 -2
- package/dist/src/vtab/memory/module.d.ts.map +1 -1
- package/dist/src/vtab/memory/module.js +53 -40
- package/dist/src/vtab/memory/module.js.map +1 -1
- package/dist/src/vtab/memory/table.d.ts +1 -1
- package/dist/src/vtab/memory/table.d.ts.map +1 -1
- package/dist/src/vtab/memory/table.js +15 -3
- package/dist/src/vtab/memory/table.js.map +1 -1
- package/dist/src/vtab/module.d.ts +51 -21
- package/dist/src/vtab/module.d.ts.map +1 -1
- package/dist/src/vtab/table.d.ts +10 -2
- package/dist/src/vtab/table.d.ts.map +1 -1
- package/dist/src/vtab/table.js +1 -1
- package/dist/src/vtab/table.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FunctionFlags } from '../common/constants.js';
|
|
2
|
-
import {
|
|
2
|
+
import { MisuseError } from '../common/errors.js';
|
|
3
|
+
import { ANY_RETURN } from './builtins/return-types.js';
|
|
3
4
|
/** Clone an aggregate initial value so each group gets an independent accumulator. */
|
|
4
5
|
export function cloneInitialValue(initialValue) {
|
|
5
6
|
if (typeof initialValue === 'function') {
|
|
@@ -15,6 +16,221 @@ export function cloneInitialValue(initialValue) {
|
|
|
15
16
|
return initialValue;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The return type a function that declares none is taken to have.
|
|
21
|
+
*
|
|
22
|
+
* An undeclared return type is genuinely unknown, so it defaults to ANY rather
|
|
23
|
+
* than guessing. A concrete guess is worse than no answer: while this defaulted to
|
|
24
|
+
* REAL, the planner believed every undeclared function returned a number and
|
|
25
|
+
* `insertCrossTypeCoercion` cast the *other* side of a comparison to REAL —
|
|
26
|
+
* `my_text_udf(x) = 'abc'` silently became `… = 0`. ANY sets neither isNumeric nor
|
|
27
|
+
* isTextual, so coercion leaves both operands alone and the generic runtime
|
|
28
|
+
* comparison decides. Declare `returnType` when you know it: ANY is safe but
|
|
29
|
+
* forfeits plan-time typing and comparison specialization.
|
|
30
|
+
*
|
|
31
|
+
* Same declaration a built-in spells `ANY_RETURN` — named separately here because
|
|
32
|
+
* this one is the default nobody asked for, not a deliberate "unknown on purpose".
|
|
33
|
+
*/
|
|
34
|
+
const UNKNOWN_SCALAR_RETURN = ANY_RETURN;
|
|
35
|
+
/**
|
|
36
|
+
* The relation a table-valued function that declares no columns gets. Its empty
|
|
37
|
+
* `columns` is load-bearing: it is how such a function opts out of row-width
|
|
38
|
+
* normalization (see {@link createTableValuedFunction}).
|
|
39
|
+
*
|
|
40
|
+
* NOTE: as with the shared constants in `func/builtins/return-types.ts`, one
|
|
41
|
+
* object is shared by every function that defaults to it, so a `returnType` is
|
|
42
|
+
* only ever read, never mutated.
|
|
43
|
+
*/
|
|
44
|
+
const UNDECLARED_RELATION_RETURN = {
|
|
45
|
+
typeClass: 'relation',
|
|
46
|
+
isReadOnly: true,
|
|
47
|
+
isSet: false, // Table functions can return duplicates by default
|
|
48
|
+
columns: [],
|
|
49
|
+
keys: [],
|
|
50
|
+
rowConstraints: []
|
|
51
|
+
};
|
|
52
|
+
/** Structural test for a logical type object — every one carries these two fields. */
|
|
53
|
+
function isLogicalTypeObject(value) {
|
|
54
|
+
if (typeof value !== 'object' || value === null)
|
|
55
|
+
return false;
|
|
56
|
+
const candidate = value;
|
|
57
|
+
return typeof candidate.name === 'string' && typeof candidate.physicalType === 'number';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check a scalar type object (`{ typeClass: 'scalar', logicalType, … }`) and fill
|
|
61
|
+
* in its one omittable field. `nullable` is required by {@link ScalarType} but is
|
|
62
|
+
* easy to leave off a hand-built declaration, and it has one safe answer —
|
|
63
|
+
* nullable — so an absent one is filled rather than rejected. Everything that
|
|
64
|
+
* reads it today treats `undefined` as nullable already; filling it keeps the
|
|
65
|
+
* stored type honest to its own declared shape.
|
|
66
|
+
*
|
|
67
|
+
* Returns the input unchanged when nothing needed filling, or `null` when the
|
|
68
|
+
* value is not a scalar type object at all.
|
|
69
|
+
*/
|
|
70
|
+
function normalizeScalarType(value) {
|
|
71
|
+
if (typeof value !== 'object' || value === null)
|
|
72
|
+
return null;
|
|
73
|
+
const candidate = value;
|
|
74
|
+
if (candidate.typeClass !== 'scalar' || !isLogicalTypeObject(candidate.logicalType))
|
|
75
|
+
return null;
|
|
76
|
+
if (typeof candidate.nullable === 'boolean')
|
|
77
|
+
return candidate;
|
|
78
|
+
return { ...candidate, nullable: true };
|
|
79
|
+
}
|
|
80
|
+
function malformedReturnType(schema, problem) {
|
|
81
|
+
throw new MisuseError(`Function '${schema.name}/${schema.numArgs}': ${problem}`);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Check a relation's declared columns and fill in each one's omittable fields.
|
|
85
|
+
* Returns the input array unchanged when nothing needed filling.
|
|
86
|
+
*/
|
|
87
|
+
function normalizeRelationColumns(schema, columns) {
|
|
88
|
+
if (!Array.isArray(columns)) {
|
|
89
|
+
malformedReturnType(schema, 'returnType.columns must be an array of column definitions');
|
|
90
|
+
}
|
|
91
|
+
let changed = false;
|
|
92
|
+
const normalized = columns.map((column, index) => {
|
|
93
|
+
if (typeof column?.name !== 'string' || column.name === '') {
|
|
94
|
+
malformedReturnType(schema, `returnType.columns[${index}].name must be a non-empty string`);
|
|
95
|
+
}
|
|
96
|
+
const type = normalizeScalarType(column.type);
|
|
97
|
+
if (!type) {
|
|
98
|
+
malformedReturnType(schema, `returnType.columns[${index}] ('${column.name}') must carry a scalar type object such as `
|
|
99
|
+
+ `{ typeClass: 'scalar', logicalType: INTEGER_TYPE, nullable: true }, not a type-name string`);
|
|
100
|
+
}
|
|
101
|
+
if (type === column.type)
|
|
102
|
+
return column;
|
|
103
|
+
changed = true;
|
|
104
|
+
return { ...column, type };
|
|
105
|
+
});
|
|
106
|
+
return changed ? normalized : columns;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check a relation's declared unique keys. Each key is an array of `{ index }`
|
|
110
|
+
* references into the declared columns — `[]` is the empty key (the relation has
|
|
111
|
+
* at most one row), and `keys: []` declares no key at all.
|
|
112
|
+
*
|
|
113
|
+
* The indices are checked because a bad one is not inert: `keysOf`
|
|
114
|
+
* (`planner/util/fd-utils.ts`) reads `ref.index` straight through into the plan's
|
|
115
|
+
* key set, so `keys: [['v']]` — column names where references belong — mints a key
|
|
116
|
+
* over column `undefined`, and an out-of-range index mints one over a column that
|
|
117
|
+
* does not exist. Both survive registration and then drive DISTINCT elimination
|
|
118
|
+
* and join-cardinality reasoning off a key nothing enforces.
|
|
119
|
+
*
|
|
120
|
+
* NOTE: `TVFAdvertisement.keys` (`relationalAdvertisement`, see
|
|
121
|
+
* docs/optimizer-retrieve.md) is the same shape feeding the same consumer, and is
|
|
122
|
+
* still unchecked. Nothing in-tree declares a bad one; if a plugin's advertisement
|
|
123
|
+
* ever produces a phantom key, validate it the same way here.
|
|
124
|
+
*/
|
|
125
|
+
function validateRelationKeys(schema, keys, columnCount) {
|
|
126
|
+
if (!Array.isArray(keys)) {
|
|
127
|
+
malformedReturnType(schema, 'returnType.keys must be an array of key column references');
|
|
128
|
+
}
|
|
129
|
+
keys.forEach((key, keyIndex) => {
|
|
130
|
+
if (!Array.isArray(key)) {
|
|
131
|
+
malformedReturnType(schema, `returnType.keys[${keyIndex}] must be an array of { index } column references `
|
|
132
|
+
+ '(an empty array declares the empty key)');
|
|
133
|
+
}
|
|
134
|
+
key.forEach((ref, refIndex) => {
|
|
135
|
+
const index = ref?.index;
|
|
136
|
+
if (typeof index !== 'number' || !Number.isInteger(index) || index < 0 || index >= columnCount) {
|
|
137
|
+
malformedReturnType(schema, `returnType.keys[${keyIndex}][${refIndex}].index must be an integer index into the `
|
|
138
|
+
+ `${columnCount} declared column(s), as { index: 0 }`);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Check a relation return type and fill in its omittable fields.
|
|
145
|
+
*
|
|
146
|
+
* `columns` is the field that carries meaning, so it is validated: a non-array,
|
|
147
|
+
* an unnamed column, or a column typed with anything but a scalar type object is
|
|
148
|
+
* rejected. `isReadOnly` / `isSet` / `keys` / `rowConstraints` all have one
|
|
149
|
+
* obvious answer for a function that says nothing about them, so an absent one
|
|
150
|
+
* is filled with the same value `createTableValuedFunction` uses rather than
|
|
151
|
+
* being demanded of the author — an absent `keys` otherwise registers fine and
|
|
152
|
+
* then fails at planning with `type.keys is not iterable`. Present-but-malformed
|
|
153
|
+
* is still a typo, and is rejected (see {@link validateRelationKeys}).
|
|
154
|
+
*
|
|
155
|
+
* Returns the input unchanged when nothing needed filling.
|
|
156
|
+
*/
|
|
157
|
+
function normalizeRelationReturnType(schema, returnType) {
|
|
158
|
+
const columns = normalizeRelationColumns(schema, returnType.columns);
|
|
159
|
+
const keys = returnType.keys;
|
|
160
|
+
if (keys !== undefined)
|
|
161
|
+
validateRelationKeys(schema, keys, columns.length);
|
|
162
|
+
const rowConstraints = returnType.rowConstraints;
|
|
163
|
+
if (rowConstraints !== undefined && !Array.isArray(rowConstraints)) {
|
|
164
|
+
malformedReturnType(schema, 'returnType.rowConstraints must be an array');
|
|
165
|
+
}
|
|
166
|
+
const needsDefaults = columns !== returnType.columns
|
|
167
|
+
|| returnType.isReadOnly === undefined || returnType.isSet === undefined
|
|
168
|
+
|| keys === undefined || rowConstraints === undefined;
|
|
169
|
+
if (!needsDefaults)
|
|
170
|
+
return returnType;
|
|
171
|
+
return {
|
|
172
|
+
...returnType,
|
|
173
|
+
columns,
|
|
174
|
+
isReadOnly: returnType.isReadOnly ?? UNDECLARED_RELATION_RETURN.isReadOnly,
|
|
175
|
+
isSet: returnType.isSet ?? UNDECLARED_RELATION_RETURN.isSet,
|
|
176
|
+
keys: keys ?? UNDECLARED_RELATION_RETURN.keys,
|
|
177
|
+
rowConstraints: rowConstraints ?? UNDECLARED_RELATION_RETURN.rowConstraints,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The one stated contract for a registered function's `returnType`.
|
|
182
|
+
*
|
|
183
|
+
* - **Absent** means "unknown" and normalizes to a nullable scalar of ANY. A
|
|
184
|
+
* schema carrying an implementation and no declared return type is therefore
|
|
185
|
+
* taken to be SCALAR — nothing else distinguishes it from a table-valued
|
|
186
|
+
* function, and a TVF with no declared columns is useless anyway. TVF authors
|
|
187
|
+
* declare `returnType` or use {@link createTableValuedFunction}.
|
|
188
|
+
* - **Present but malformed** throws {@link MisuseError} naming the function and
|
|
189
|
+
* the offending field. A typo is never silently downgraded to "unknown": that
|
|
190
|
+
* is how the long-documented `{ typeClass: 'scalar', sqlType: 'TEXT' }` shape
|
|
191
|
+
* half-worked for so long — it registered and evaluated, then failed with an
|
|
192
|
+
* internal `undefined` read the first time anything compared against its type.
|
|
193
|
+
* - **Present and well-formed but incomplete** is filled in, for the fields that
|
|
194
|
+
* have one obvious answer: a scalar's `nullable` (see {@link normalizeScalarType})
|
|
195
|
+
* and a relation's `isReadOnly` / `isSet` / `keys` / `rowConstraints` (see
|
|
196
|
+
* {@link normalizeRelationReturnType}).
|
|
197
|
+
*
|
|
198
|
+
* Both registration paths route through here: `Database.registerFunction` for a
|
|
199
|
+
* hand-built schema (the path every plugin takes via `registerPlugin`) and the
|
|
200
|
+
* `create*` helpers below.
|
|
201
|
+
*
|
|
202
|
+
* NOTE: `Schema.addFunction` (schema/schema.ts) is where all roads actually meet,
|
|
203
|
+
* including the built-ins registered at startup, but it is a plain map insert and
|
|
204
|
+
* deliberately stays one — gating there would revalidate every builtin on every
|
|
205
|
+
* database open for the same benefit. Anything that inserts into a Schema directly
|
|
206
|
+
* therefore bypasses this contract; the type guards in schema/function.ts are the
|
|
207
|
+
* backstop for that case.
|
|
208
|
+
*/
|
|
209
|
+
export function normalizeFunctionSchema(schema) {
|
|
210
|
+
const returnType = schema.returnType;
|
|
211
|
+
if (returnType === undefined || returnType === null) {
|
|
212
|
+
return { ...schema, returnType: UNKNOWN_SCALAR_RETURN };
|
|
213
|
+
}
|
|
214
|
+
if (typeof returnType !== 'object') {
|
|
215
|
+
malformedReturnType(schema, 'returnType must be an object');
|
|
216
|
+
}
|
|
217
|
+
switch (returnType.typeClass) {
|
|
218
|
+
case 'scalar': {
|
|
219
|
+
const scalar = normalizeScalarType(returnType);
|
|
220
|
+
if (!scalar) {
|
|
221
|
+
malformedReturnType(schema, 'returnType.logicalType must be a type object such as TEXT_TYPE — '
|
|
222
|
+
+ 'build the declaration with scalarReturn(TEXT_TYPE) or use the TEXT_RETURN / INTEGER_RETURN / … constants');
|
|
223
|
+
}
|
|
224
|
+
return scalar === returnType ? schema : { ...schema, returnType: scalar };
|
|
225
|
+
}
|
|
226
|
+
case 'relation': {
|
|
227
|
+
const relation = normalizeRelationReturnType(schema, returnType);
|
|
228
|
+
return relation === returnType ? schema : { ...schema, returnType: relation };
|
|
229
|
+
}
|
|
230
|
+
default:
|
|
231
|
+
malformedReturnType(schema, `returnType.typeClass must be 'scalar' or 'relation' (got ${String(returnType.typeClass)})`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
18
234
|
/**
|
|
19
235
|
* Creates a function schema for a scalar SQL function.
|
|
20
236
|
* This is the primary way to register scalar functions in Quereus.
|
|
@@ -24,17 +240,13 @@ export function cloneInitialValue(initialValue) {
|
|
|
24
240
|
* @returns A FunctionSchema ready for registration
|
|
25
241
|
*/
|
|
26
242
|
export function createScalarFunction(options, jsFunc) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
nullable: true,
|
|
31
|
-
isReadOnly: true
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
243
|
+
// Defaulting and validation both live in normalizeFunctionSchema — see the
|
|
244
|
+
// contract there for what an absent return type means.
|
|
245
|
+
return normalizeFunctionSchema({
|
|
34
246
|
name: options.name,
|
|
35
247
|
numArgs: options.numArgs,
|
|
36
248
|
flags: options.flags ?? (FunctionFlags.UTF8 | (options.deterministic !== false ? FunctionFlags.DETERMINISTIC : 0)),
|
|
37
|
-
returnType,
|
|
249
|
+
returnType: options.returnType ?? UNKNOWN_SCALAR_RETURN,
|
|
38
250
|
implementation: jsFunc,
|
|
39
251
|
replicable: options.replicable,
|
|
40
252
|
inferReturnType: options.inferReturnType,
|
|
@@ -43,7 +255,9 @@ export function createScalarFunction(options, jsFunc) {
|
|
|
43
255
|
monotoneOnArgs: options.monotoneOnArgs,
|
|
44
256
|
rangeRewriteOnArg: options.rangeRewriteOnArg,
|
|
45
257
|
hidden: options.hidden,
|
|
46
|
-
|
|
258
|
+
comparesArgs: options.comparesArgs,
|
|
259
|
+
returnsArg: options.returnsArg,
|
|
260
|
+
});
|
|
47
261
|
}
|
|
48
262
|
/**
|
|
49
263
|
* Creates a function schema for a table-valued function.
|
|
@@ -61,23 +275,15 @@ export function createScalarFunction(options, jsFunc) {
|
|
|
61
275
|
* @returns A FunctionSchema ready for registration
|
|
62
276
|
*/
|
|
63
277
|
export function createTableValuedFunction(options, jsFunc) {
|
|
64
|
-
|
|
65
|
-
typeClass: 'relation',
|
|
66
|
-
isReadOnly: true,
|
|
67
|
-
isSet: false, // Table functions can return duplicates by default
|
|
68
|
-
columns: [],
|
|
69
|
-
keys: [],
|
|
70
|
-
rowConstraints: []
|
|
71
|
-
};
|
|
72
|
-
return {
|
|
278
|
+
return normalizeFunctionSchema({
|
|
73
279
|
name: options.name,
|
|
74
280
|
numArgs: options.numArgs,
|
|
75
281
|
flags: options.flags ?? (FunctionFlags.UTF8 | (options.deterministic !== false ? FunctionFlags.DETERMINISTIC : 0)),
|
|
76
|
-
returnType,
|
|
282
|
+
returnType: options.returnType ?? UNDECLARED_RELATION_RETURN,
|
|
77
283
|
implementation: jsFunc,
|
|
78
284
|
replicable: options.replicable,
|
|
79
285
|
relationalAdvertisement: options.relationalAdvertisement
|
|
80
|
-
};
|
|
286
|
+
});
|
|
81
287
|
}
|
|
82
288
|
/**
|
|
83
289
|
* Creates a function schema for an integrated table-valued function.
|
|
@@ -88,24 +294,16 @@ export function createTableValuedFunction(options, jsFunc) {
|
|
|
88
294
|
* @returns A FunctionSchema ready for registration
|
|
89
295
|
*/
|
|
90
296
|
export function createIntegratedTableValuedFunction(options, jsFunc) {
|
|
91
|
-
|
|
92
|
-
typeClass: 'relation',
|
|
93
|
-
isReadOnly: true,
|
|
94
|
-
isSet: false, // Table functions can return duplicates by default
|
|
95
|
-
columns: [],
|
|
96
|
-
keys: [],
|
|
97
|
-
rowConstraints: []
|
|
98
|
-
};
|
|
99
|
-
return {
|
|
297
|
+
return normalizeFunctionSchema({
|
|
100
298
|
name: options.name,
|
|
101
299
|
numArgs: options.numArgs,
|
|
102
300
|
flags: options.flags ?? (FunctionFlags.UTF8 | (options.deterministic !== false ? FunctionFlags.DETERMINISTIC : 0)),
|
|
103
|
-
returnType,
|
|
301
|
+
returnType: options.returnType ?? UNDECLARED_RELATION_RETURN,
|
|
104
302
|
implementation: jsFunc,
|
|
105
303
|
replicable: options.replicable,
|
|
106
304
|
isIntegrated: true,
|
|
107
305
|
relationalAdvertisement: options.relationalAdvertisement
|
|
108
|
-
};
|
|
306
|
+
});
|
|
109
307
|
}
|
|
110
308
|
/**
|
|
111
309
|
* Creates a function schema for an aggregate function.
|
|
@@ -117,17 +315,14 @@ export function createIntegratedTableValuedFunction(options, jsFunc) {
|
|
|
117
315
|
* @returns A FunctionSchema ready for registration
|
|
118
316
|
*/
|
|
119
317
|
export function createAggregateFunction(options, stepFunc, finalizeFunc) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
isReadOnly: true
|
|
125
|
-
};
|
|
126
|
-
return {
|
|
318
|
+
// Unknown rather than guessed — see UNKNOWN_SCALAR_RETURN. No built-in aggregate
|
|
319
|
+
// rides this default (every one declares a type or supplies inferReturnType); it
|
|
320
|
+
// guards user-defined aggregates registered through Database.createAggregateFunction.
|
|
321
|
+
return normalizeFunctionSchema({
|
|
127
322
|
name: options.name,
|
|
128
323
|
numArgs: options.numArgs,
|
|
129
324
|
flags: options.flags ?? (FunctionFlags.UTF8 | (options.deterministic !== false ? FunctionFlags.DETERMINISTIC : 0)),
|
|
130
|
-
returnType,
|
|
325
|
+
returnType: options.returnType ?? UNKNOWN_SCALAR_RETURN,
|
|
131
326
|
stepFunction: stepFunc,
|
|
132
327
|
finalizeFunction: finalizeFunc,
|
|
133
328
|
initialValue: options.initialValue,
|
|
@@ -136,7 +331,7 @@ export function createAggregateFunction(options, stepFunc, finalizeFunc) {
|
|
|
136
331
|
replicable: options.replicable,
|
|
137
332
|
inferReturnType: options.inferReturnType,
|
|
138
333
|
validateArgTypes: options.validateArgTypes
|
|
139
|
-
};
|
|
334
|
+
});
|
|
140
335
|
}
|
|
141
336
|
/**
|
|
142
337
|
* Specialize an aggregate schema to one call site's argument comparison context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/func/registration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/func/registration.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAgFxD,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAAC,YAAqB;IACtD,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE,CAAC;QACxC,OAAO,YAAY,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,YAAY,CAAa,CAAC;IACtC,CAAC;SAAM,IAAI,YAAY,IAAI,OAAO,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC7D,OAAO,EAAE,GAAG,YAAY,EAAc,CAAC;IACxC,CAAC;SA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C9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClH,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,qBAAqB;QACvD,YAAY,EAAE,QAAQ;QACtB,gBAAgB,EAAE,YAAY;QAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;KAC1C,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA+B,EAC/B,IAAoC;IAEpC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK;QAAE,OAAO,MAAM,CAAC;IAC1B,gFAAgF;IAChF,0EAA0E;IAC1E,gFAAgF;IAChF,0EAA0E;IAC1E,OAAO;QACN,GAAG,MAAM;QACT,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY;QACvD,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,IAAI,MAAM,CAAC,gBAAgB;QACnE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO;KACxC,CAAC;AACH,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { BackingRowChange, MaintenanceOp, BackingHost, BackingScanRequest }
|
|
|
12
12
|
export { Statement } from './core/statement.js';
|
|
13
13
|
export { Table } from './core/table-handle.js';
|
|
14
14
|
export { StatusCode, SqlDataType } from './common/types.js';
|
|
15
|
-
export type { SqlValue, JsonSqlValue, SqlParameters, StatementOptions, Row, MaybePromise, RowOp, ConstraintType, UpdateResult } from './common/types.js';
|
|
15
|
+
export type { SqlValue, JsonSqlValue, SqlParameters, StatementOptions, Row, MaybePromise, RowOp, ConstraintType, UpdateResult, CompareFn } from './common/types.js';
|
|
16
16
|
export { isUpdateOk, isConstraintViolation, isSqlValue } from './common/types.js';
|
|
17
17
|
export { ConflictResolution, IndexConstraintOp, VTabConfig, FunctionFlags } from './common/constants.js';
|
|
18
18
|
export { QuereusError, MisuseError, ConstraintError, AbortError, throwIfAborted, isAbortError, unwrapError, formatErrorChain, getPrimaryError } from './common/errors.js';
|
|
@@ -35,8 +35,8 @@ export type { VTableDataChangeEvent, VTableDataChangeListener, VTableSchemaChang
|
|
|
35
35
|
export { DefaultVTableEventEmitter } from './vtab/events.js';
|
|
36
36
|
export type { DatabaseDataChangeEvent, DatabaseSchemaChangeEvent, MaintenanceCollisionEvent, TransactionCommitBatch, TransactionCommitListener, DataChangeSubscriptionOptions, SchemaChangeSubscriptionOptions, } from './core/database-events.js';
|
|
37
37
|
export { DatabaseEventEmitter } from './core/database-events.js';
|
|
38
|
-
export type { BestAccessPlanRequest, BestAccessPlanResult, ConstraintOp, ColumnMeta, PredicateConstraint, OrderingSpec } from './vtab/best-access-plan.js';
|
|
39
|
-
export { AccessPlanBuilder, validateAccessPlan } from './vtab/best-access-plan.js';
|
|
38
|
+
export type { BestAccessPlanRequest, BestAccessPlanResult, ConstraintOp, ColumnMeta, PredicateConstraint, RuntimeSetSpec, OrderingSpec } from './vtab/best-access-plan.js';
|
|
39
|
+
export { AccessPlanBuilder, validateAccessPlan, validateAccessPlanRequest, equalitySeekKeyCount, isMultiValueEquality, } from './vtab/best-access-plan.js';
|
|
40
40
|
export type { CollationFunction } from './util/comparison.js';
|
|
41
41
|
export { BINARY_COLLATION, NOCASE_COLLATION, RTRIM_COLLATION, compareCodePoints, builtinCollationResolver, normalizeCollationName, resolveCollationFunctions, compareSqlValues, compareSqlValuesFast, rowsValueIdentical, sqlValueIdentical, compareRows, compareTypedValues, createTypedComparator, createTypedRowComparator, createCollationRowComparator, createSemanticRowComparator, hasSemanticOrdering, semanticKeyTransform, comparisonSemanticsDiffer, compareWithOrderByFast, createOrderByComparatorFast, createTypedOrderByComparator, SortDirection, NullsOrdering, isTruthy, getSqlDataTypeName } from './util/comparison.js';
|
|
42
42
|
export type { LogicalType, CollationResolver, KeyNormalizer, KeyNormalizerResolver, CollationFunction as TypeCollationFunction } from './types/logical-type.js';
|
|
@@ -45,7 +45,8 @@ export { NULL_TYPE, INTEGER_TYPE, REAL_TYPE, TEXT_TYPE, BLOB_TYPE, BOOLEAN_TYPE,
|
|
|
45
45
|
export { DATE_TYPE, TIME_TYPE, DATETIME_TYPE, TIMESPAN_TYPE } from './types/temporal-types.js';
|
|
46
46
|
export { JSON_TYPE } from './types/json-type.js';
|
|
47
47
|
export { typeRegistry, registerType, getType, getTypeOrDefault, inferType } from './types/registry.js';
|
|
48
|
-
export { validateValue, parseValue, validateAndParse, coerceRowToSchema, isValidForType, tryParse } from './types/validation.js';
|
|
48
|
+
export { validateValue, parseValue, validateAndParse, coerceRowToSchema, foldDefaultToType, planRetypeConversion, isValidForType, tryParse } from './types/validation.js';
|
|
49
|
+
export type { RetypeConversion } from './types/validation.js';
|
|
49
50
|
export { Parser } from './parser/parser.js';
|
|
50
51
|
export { Lexer, TokenType, KEYWORDS } from './parser/lexer.js';
|
|
51
52
|
export { ParseError } from './parser/parser.js';
|
|
@@ -53,9 +54,10 @@ export { tryFoldLiteral } from './parser/utils.js';
|
|
|
53
54
|
export { quoteIdentifier } from './emit/ast-stringify.js';
|
|
54
55
|
export { SchemaManager } from './schema/manager.js';
|
|
55
56
|
export type { ImportCatalogOptions } from './schema/manager.js';
|
|
57
|
+
export type { IndexLookupScope, IndexOwnerMatch } from './schema/manager.js';
|
|
56
58
|
export type { SchemaChangeEvent, SchemaChangeListener, TableModifiedEvent, ViewAddedEvent, ViewRemovedEvent } from './schema/change-events.js';
|
|
57
|
-
export { buildColumnIndexMap, columnDefToSchema, resolveNamedConstraintClass, validateCollationForType, resolveDefaultCollation, appendIndexToTableSchema } from './schema/table.js';
|
|
58
|
-
export { buildUniqueConstraintSchema, buildForeignKeyConstraintSchema, buildCheckConstraintSchema, validateForeignKeyOverExistingRows, validateForeignKeyCollations, maintainedTableUniqueViolationError } from './schema/constraint-builder.js';
|
|
59
|
+
export { buildColumnIndexMap, columnDefToSchema, resolveNamedConstraintClass, validateCollationForType, resolveDefaultCollation, appendIndexToTableSchema, shiftSchemaIndicesForDrop, rekeySchemaPrimaryKey } from './schema/table.js';
|
|
60
|
+
export { buildUniqueConstraintSchema, buildForeignKeyConstraintSchema, buildCheckConstraintSchema, validateForeignKeyOverExistingRows, validateForeignKeyCollations, maintainedTableUniqueViolationError, formatKeyValue } from './schema/constraint-builder.js';
|
|
59
61
|
export type { TableSchema, IndexSchema as TableIndexSchema, UniqueConstraintSchema, ForeignKeyConstraintSchema, NamedConstraintClass } from './schema/table.js';
|
|
60
62
|
export { uniqueEnforcementCollations, resolveUniqueEnforcementCollations, uniqueEnforcementComparators } from './schema/unique-enforcement.js';
|
|
61
63
|
export type { ColumnSchema } from './schema/column.js';
|
|
@@ -73,16 +75,21 @@ export type { CompiledPredicate } from './vtab/memory/utils/predicate.js';
|
|
|
73
75
|
export { isAsyncIterable, getAsyncIterator, asyncIterableToArray } from './runtime/utils.js';
|
|
74
76
|
export { CollectingInstructionTracer } from './runtime/types.js';
|
|
75
77
|
export type { InstructionTracer, InstructionTraceEvent } from './runtime/types.js';
|
|
76
|
-
export { createScalarFunction, createTableValuedFunction, createAggregateFunction } from './func/registration.js';
|
|
78
|
+
export { createScalarFunction, createTableValuedFunction, createAggregateFunction, normalizeFunctionSchema } from './func/registration.js';
|
|
79
|
+
export { scalarReturn, TEXT_RETURN, TEXT_RETURN_NOT_NULL, INTEGER_RETURN, INTEGER_RETURN_NOT_NULL, REAL_RETURN, REAL_RETURN_NOT_NULL, BOOLEAN_RETURN, BOOLEAN_RETURN_NOT_NULL, BLOB_RETURN, JSON_RETURN, ANY_RETURN } from './func/builtins/return-types.js';
|
|
80
|
+
export type { ScalarType, RelationType, ColumnDef, ColRef } from './common/datatype.js';
|
|
77
81
|
export type { ScalarFunc, TableValuedFunc, AggregateReducer, AggregateFinalizer, FunctionSchema } from './schema/function.js';
|
|
78
82
|
export { tryCoerceToNumber, coerceToNumberForArithmetic, coerceForComparison, coerceForAggregate, isNumericValue } from './util/coercion.js';
|
|
79
83
|
export { Latches } from './util/latches.js';
|
|
80
84
|
export { BUILTIN_NORMALIZERS, serializeKey, serializeRowKey, serializeKeyNullGrouping } from './util/key-serializer.js';
|
|
85
|
+
export { makePkIdentitySerializer, resolvePkIdentityKeying } from './util/key-serializer.js';
|
|
86
|
+
export type { PkIdentityColumn, PkIdentityTable, PkIdentityKeying } from './util/key-serializer.js';
|
|
81
87
|
export { logicalTypeCanHoldText, pkKeyCollationName } from './planner/analysis/comparison-collation.js';
|
|
82
88
|
export { canonicalJsonString } from './util/json-canonical.js';
|
|
83
89
|
export { registerPlugin } from './util/plugin-helper.js';
|
|
84
90
|
export type { PluginFunction } from './util/plugin-helper.js';
|
|
85
91
|
import './runtime/register.js';
|
|
92
|
+
export type { TableStatistics, ColumnStatistics, EquiHeightHistogram, HistogramBucket } from './planner/stats/catalog-stats.js';
|
|
86
93
|
export type { VirtualTableModule } from './vtab/module.js';
|
|
87
94
|
export type { ModuleCapabilities, IsolationCapableTable } from './vtab/capabilities.js';
|
|
88
95
|
export type { Schema } from './schema/schema.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,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mB,EACnB,cAAc,EACd,mBAAmB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,cAAc,EACd,OAAO,EACP,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,GACtB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AACxH,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -23,7 +23,7 @@ export { encodeIdxStr, decodeIdxStr, idxStrSentinel, retargetIdxStr, makeIdxStrS
|
|
|
23
23
|
export { getModuleConcurrencyMode, acquireConnectionLock } from './vtab/concurrency.js';
|
|
24
24
|
export { DefaultVTableEventEmitter } from './vtab/events.js';
|
|
25
25
|
export { DatabaseEventEmitter } from './core/database-events.js';
|
|
26
|
-
export { AccessPlanBuilder, validateAccessPlan } from './vtab/best-access-plan.js';
|
|
26
|
+
export { AccessPlanBuilder, validateAccessPlan, validateAccessPlanRequest, equalitySeekKeyCount, isMultiValueEquality, } from './vtab/best-access-plan.js';
|
|
27
27
|
export {
|
|
28
28
|
// Built-in collation functions. Custom collations are registered per-database
|
|
29
29
|
// with `db.registerCollation(...)` and resolved via `db.getCollationResolver()`.
|
|
@@ -45,7 +45,7 @@ export { NULL_TYPE, INTEGER_TYPE, REAL_TYPE, TEXT_TYPE, BLOB_TYPE, BOOLEAN_TYPE,
|
|
|
45
45
|
export { DATE_TYPE, TIME_TYPE, DATETIME_TYPE, TIMESPAN_TYPE } from './types/temporal-types.js';
|
|
46
46
|
export { JSON_TYPE } from './types/json-type.js';
|
|
47
47
|
export { typeRegistry, registerType, getType, getTypeOrDefault, inferType } from './types/registry.js';
|
|
48
|
-
export { validateValue, parseValue, validateAndParse, coerceRowToSchema, isValidForType, tryParse } from './types/validation.js';
|
|
48
|
+
export { validateValue, parseValue, validateAndParse, coerceRowToSchema, foldDefaultToType, planRetypeConversion, isValidForType, tryParse } from './types/validation.js';
|
|
49
49
|
// SQL Parser and Compiler
|
|
50
50
|
export { Parser } from './parser/parser.js';
|
|
51
51
|
export { Lexer, TokenType, KEYWORDS } from './parser/lexer.js';
|
|
@@ -54,8 +54,8 @@ export { tryFoldLiteral } from './parser/utils.js';
|
|
|
54
54
|
export { quoteIdentifier } from './emit/ast-stringify.js';
|
|
55
55
|
// Schema management
|
|
56
56
|
export { SchemaManager } from './schema/manager.js';
|
|
57
|
-
export { buildColumnIndexMap, columnDefToSchema, resolveNamedConstraintClass, validateCollationForType, resolveDefaultCollation, appendIndexToTableSchema } from './schema/table.js';
|
|
58
|
-
export { buildUniqueConstraintSchema, buildForeignKeyConstraintSchema, buildCheckConstraintSchema, validateForeignKeyOverExistingRows, validateForeignKeyCollations, maintainedTableUniqueViolationError } from './schema/constraint-builder.js';
|
|
57
|
+
export { buildColumnIndexMap, columnDefToSchema, resolveNamedConstraintClass, validateCollationForType, resolveDefaultCollation, appendIndexToTableSchema, shiftSchemaIndicesForDrop, rekeySchemaPrimaryKey } from './schema/table.js';
|
|
58
|
+
export { buildUniqueConstraintSchema, buildForeignKeyConstraintSchema, buildCheckConstraintSchema, validateForeignKeyOverExistingRows, validateForeignKeyCollations, maintainedTableUniqueViolationError, formatKeyValue } from './schema/constraint-builder.js';
|
|
59
59
|
// Per-column UNIQUE-enforcement collation resolver, plus the per-column comparators
|
|
60
60
|
// built from it — the single source of truth shared by store/isolation re-validators
|
|
61
61
|
// (memory's `checkUniqueViaIndex` is conformance-locked against the collation resolver
|
|
@@ -83,7 +83,11 @@ export { compilePredicate } from './vtab/memory/utils/predicate.js';
|
|
|
83
83
|
export { isAsyncIterable, getAsyncIterator, asyncIterableToArray } from './runtime/utils.js';
|
|
84
84
|
export { CollectingInstructionTracer } from './runtime/types.js';
|
|
85
85
|
// Function registration utilities
|
|
86
|
-
export { createScalarFunction, createTableValuedFunction, createAggregateFunction } from './func/registration.js';
|
|
86
|
+
export { createScalarFunction, createTableValuedFunction, createAggregateFunction, normalizeFunctionSchema } from './func/registration.js';
|
|
87
|
+
// Return-type declarations for registered functions. `scalarReturn(TEXT_TYPE)` and
|
|
88
|
+
// the `*_RETURN` constants make declaring a function's return type a one-token edit
|
|
89
|
+
// instead of a repeated four-field object literal.
|
|
90
|
+
export { scalarReturn, TEXT_RETURN, TEXT_RETURN_NOT_NULL, INTEGER_RETURN, INTEGER_RETURN_NOT_NULL, REAL_RETURN, REAL_RETURN_NOT_NULL, BOOLEAN_RETURN, BOOLEAN_RETURN_NOT_NULL, BLOB_RETURN, JSON_RETURN, ANY_RETURN } from './func/builtins/return-types.js';
|
|
87
91
|
// Coercion utilities (for module implementations)
|
|
88
92
|
export { tryCoerceToNumber, coerceToNumberForArithmetic, coerceForComparison, coerceForAggregate, isNumericValue } from './util/coercion.js';
|
|
89
93
|
// Utility functions
|
|
@@ -93,6 +97,11 @@ export { Latches } from './util/latches.js';
|
|
|
93
97
|
// backs a store's default key-normalizer resolver for callers that hold no Database;
|
|
94
98
|
// any caller that DOES hold one must resolve through `db.getKeyNormalizerResolver()`.
|
|
95
99
|
export { BUILTIN_NORMALIZERS, serializeKey, serializeRowKey, serializeKeyNullGrouping } from './util/key-serializer.js';
|
|
100
|
+
// The ONE pk row-identity recipe ("are these two primary keys the same row?"): per pk
|
|
101
|
+
// column, its semantic key transform then its key-collation normalizer, serialized via
|
|
102
|
+
// `serializeKeyNullGrouping`. Shared by `@quereus/isolation`'s overlay row-alignment key and
|
|
103
|
+
// `@quereus/sync`'s per-row CRDT metadata key, so the two layers can never disagree.
|
|
104
|
+
export { makePkIdentitySerializer, resolvePkIdentityKeying } from './util/key-serializer.js';
|
|
96
105
|
// Whether a column's declared type can ever hold text, and therefore whether a key
|
|
97
106
|
// built over it needs a key normalizer at all. Out-of-package hash-key sites (the
|
|
98
107
|
// isolation overlay's modified-PK set) must gate on this exactly as the engine's own
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8BAA8B;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK9C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C,kCAAkC;AAClC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1K,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,GACvB,MAAM,uBAAu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AAoC,CAAC;AAE5C,kCAAkC;AAClC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAGxH,uFAAuF;AACvF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -17,6 +17,15 @@ export declare class Parser {
|
|
|
17
17
|
private current;
|
|
18
18
|
private parameterPosition;
|
|
19
19
|
private parenStack;
|
|
20
|
+
/**
|
|
21
|
+
* Bare (no-`as`) alias barrier. While a declaration-block item body is being
|
|
22
|
+
* parsed, the leading keywords of a *sibling* item must not be absorbed as an
|
|
23
|
+
* implicit alias — block items carry no required separator, so the alias slot
|
|
24
|
+
* and the next item's first token compete for the same position. Scoped by a
|
|
25
|
+
* stack so it never leaks into ordinary statements, and by the paren depth the
|
|
26
|
+
* item started at, since a sibling item cannot begin inside an open `(`.
|
|
27
|
+
*/
|
|
28
|
+
private aliasBarriers;
|
|
20
29
|
/**
|
|
21
30
|
* Initialize the parser with tokens from a SQL string
|
|
22
31
|
* @param sql SQL string to parse
|
|
@@ -329,6 +338,18 @@ export declare class Parser {
|
|
|
329
338
|
* it only ends the source list item (`from t a, u b`).
|
|
330
339
|
*/
|
|
331
340
|
private matchBareSourceAlias;
|
|
341
|
+
/**
|
|
342
|
+
* Runs `parse` with `words` (uppercase lexemes) barred from the bare-alias slot.
|
|
343
|
+
* See {@link aliasBarriers}; nesting is supported and the barrier always pops.
|
|
344
|
+
*/
|
|
345
|
+
private withAliasBarrier;
|
|
346
|
+
/**
|
|
347
|
+
* True when the cursor sits on a bare identifier an active barrier reserves.
|
|
348
|
+
* Only fires at the paren depth the barrier was pushed at: an alias inside an
|
|
349
|
+
* open `(` — a subquery source, a scalar subquery — cannot be confused with the
|
|
350
|
+
* start of a sibling item, so `from t2 materialized` keeps working there.
|
|
351
|
+
*/
|
|
352
|
+
private atAliasBarrier;
|
|
332
353
|
/**
|
|
333
354
|
* True when the current token starts a `QueryExpr` (SELECT, VALUES, WITH,
|
|
334
355
|
* INSERT, UPDATE, DELETE). Used by callers that have already consumed an
|
|
@@ -529,6 +550,31 @@ export declare class Parser {
|
|
|
529
550
|
*/
|
|
530
551
|
private analyzeStatement;
|
|
531
552
|
private declareSchemaStatement;
|
|
553
|
+
/** Parses one item of a `declare schema { … }` block, dispatched on its leading keyword. */
|
|
554
|
+
private declareBlockItem;
|
|
555
|
+
/**
|
|
556
|
+
* Fallback for an item kind the parser doesn't model yet (domain, collation, import):
|
|
557
|
+
* skip its tokens and keep a placeholder so the surrounding block still parses.
|
|
558
|
+
*
|
|
559
|
+
* NOTE: an unrecognized item is retained only as opaque text — a typo'd item keyword
|
|
560
|
+
* is therefore accepted and silently ignored rather than diagnosed. Diagnosing it
|
|
561
|
+
* needs a real grammar for these kinds, not a tighter skip.
|
|
562
|
+
*/
|
|
563
|
+
private declareIgnoredItem;
|
|
564
|
+
/**
|
|
565
|
+
* Advances past the current declaration-block item, stopping at nesting depth 0 on
|
|
566
|
+
* a `;`, the block's closing `}`, or the leading keyword of the next item. Brace and
|
|
567
|
+
* paren depth is tracked so a braced column list or a parenthesized payload inside
|
|
568
|
+
* the item doesn't end the scan early.
|
|
569
|
+
*
|
|
570
|
+
* NOTE: stopping on an item keyword is a heuristic — these kinds have no grammar
|
|
571
|
+
* here, so the word `table` inside an unmodeled item would cut the skip short.
|
|
572
|
+
* Separating the items with `;` is exact; if domain/collation/import ever gain real
|
|
573
|
+
* bodies, give them a grammar rather than widening this scan.
|
|
574
|
+
*/
|
|
575
|
+
private skipToDeclareItemBoundary;
|
|
576
|
+
/** True when the cursor sits on a keyword that can begin a declaration-block item. */
|
|
577
|
+
private atDeclareItemStart;
|
|
532
578
|
/**
|
|
533
579
|
* Parses `declare lens for <X> over <Y> { ( view <T> as <select> ;? )* }`.
|
|
534
580
|
* The DECLARE token is already consumed by {@link statement}. `lens` and `for`
|