@quereus/quereus 2.9.0 → 3.0.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 +224 -222
- package/dist/src/core/database-assertions.d.ts +36 -16
- package/dist/src/core/database-assertions.d.ts.map +1 -1
- package/dist/src/core/database-assertions.js +222 -118
- package/dist/src/core/database-assertions.js.map +1 -1
- package/dist/src/core/database-transaction.d.ts +96 -13
- package/dist/src/core/database-transaction.d.ts.map +1 -1
- package/dist/src/core/database-transaction.js +294 -35
- package/dist/src/core/database-transaction.js.map +1 -1
- package/dist/src/core/database-watchers.d.ts +58 -0
- package/dist/src/core/database-watchers.d.ts.map +1 -0
- package/dist/src/core/database-watchers.js +206 -0
- package/dist/src/core/database-watchers.js.map +1 -0
- package/dist/src/core/database.d.ts +78 -5
- package/dist/src/core/database.d.ts.map +1 -1
- package/dist/src/core/database.js +120 -20
- package/dist/src/core/database.js.map +1 -1
- package/dist/src/core/statement.d.ts +9 -0
- package/dist/src/core/statement.d.ts.map +1 -1
- package/dist/src/core/statement.js +29 -0
- package/dist/src/core/statement.js.map +1 -1
- package/dist/src/core/table-handle.d.ts +45 -0
- package/dist/src/core/table-handle.d.ts.map +1 -0
- package/dist/src/core/table-handle.js +54 -0
- package/dist/src/core/table-handle.js.map +1 -0
- package/dist/src/func/builtins/conversion.d.ts.map +1 -1
- package/dist/src/func/builtins/conversion.js +12 -1
- package/dist/src/func/builtins/conversion.js.map +1 -1
- package/dist/src/func/builtins/explain.d.ts.map +1 -1
- package/dist/src/func/builtins/explain.js +22 -8
- package/dist/src/func/builtins/explain.js.map +1 -1
- package/dist/src/func/builtins/generation.d.ts.map +1 -1
- package/dist/src/func/builtins/generation.js +26 -1
- package/dist/src/func/builtins/generation.js.map +1 -1
- package/dist/src/func/builtins/index.d.ts.map +1 -1
- package/dist/src/func/builtins/index.js +5 -1
- package/dist/src/func/builtins/index.js.map +1 -1
- package/dist/src/func/builtins/json-tvf.d.ts.map +1 -1
- package/dist/src/func/builtins/json-tvf.js +16 -2
- package/dist/src/func/builtins/json-tvf.js.map +1 -1
- package/dist/src/func/builtins/schema.d.ts +4 -0
- package/dist/src/func/builtins/schema.d.ts.map +1 -1
- package/dist/src/func/builtins/schema.js +270 -11
- package/dist/src/func/builtins/schema.js.map +1 -1
- package/dist/src/func/registration.d.ts +19 -1
- package/dist/src/func/registration.d.ts.map +1 -1
- package/dist/src/func/registration.js +8 -3
- package/dist/src/func/registration.js.map +1 -1
- package/dist/src/index.d.ts +7 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/parser/parser.d.ts.map +1 -1
- package/dist/src/parser/parser.js +12 -4
- package/dist/src/parser/parser.js.map +1 -1
- package/dist/src/planner/analysis/assertion-classifier.d.ts +71 -0
- package/dist/src/planner/analysis/assertion-classifier.d.ts.map +1 -0
- package/dist/src/planner/analysis/assertion-classifier.js +286 -0
- package/dist/src/planner/analysis/assertion-classifier.js.map +1 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts +34 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.d.ts.map +1 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.js +119 -0
- package/dist/src/planner/analysis/assertion-hoist-cache.js.map +1 -0
- package/dist/src/planner/analysis/binding-extractor.d.ts +58 -0
- package/dist/src/planner/analysis/binding-extractor.d.ts.map +1 -0
- package/dist/src/planner/analysis/binding-extractor.js +110 -0
- package/dist/src/planner/analysis/binding-extractor.js.map +1 -0
- package/dist/src/planner/analysis/change-scope.d.ts +184 -0
- package/dist/src/planner/analysis/change-scope.d.ts.map +1 -0
- package/dist/src/planner/analysis/change-scope.js +825 -0
- package/dist/src/planner/analysis/change-scope.js.map +1 -0
- package/dist/src/planner/analysis/check-extraction.d.ts +29 -0
- package/dist/src/planner/analysis/check-extraction.d.ts.map +1 -0
- package/dist/src/planner/analysis/check-extraction.js +420 -0
- package/dist/src/planner/analysis/check-extraction.js.map +1 -0
- package/dist/src/planner/analysis/constraint-extractor.d.ts +47 -7
- package/dist/src/planner/analysis/constraint-extractor.d.ts.map +1 -1
- package/dist/src/planner/analysis/constraint-extractor.js +169 -92
- package/dist/src/planner/analysis/constraint-extractor.js.map +1 -1
- package/dist/src/planner/analysis/partial-unique-extraction.d.ts +68 -0
- package/dist/src/planner/analysis/partial-unique-extraction.d.ts.map +1 -0
- package/dist/src/planner/analysis/partial-unique-extraction.js +347 -0
- package/dist/src/planner/analysis/partial-unique-extraction.js.map +1 -0
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts +14 -0
- package/dist/src/planner/analysis/predicate-conjuncts.d.ts.map +1 -0
- package/dist/src/planner/analysis/predicate-conjuncts.js +31 -0
- package/dist/src/planner/analysis/predicate-conjuncts.js.map +1 -0
- package/dist/src/planner/analysis/predicate-shape.d.ts +52 -0
- package/dist/src/planner/analysis/predicate-shape.d.ts.map +1 -0
- package/dist/src/planner/analysis/predicate-shape.js +119 -0
- package/dist/src/planner/analysis/predicate-shape.js.map +1 -0
- package/dist/src/planner/analysis/sat-checker.d.ts +43 -0
- package/dist/src/planner/analysis/sat-checker.d.ts.map +1 -0
- package/dist/src/planner/analysis/sat-checker.js +393 -0
- package/dist/src/planner/analysis/sat-checker.js.map +1 -0
- package/dist/src/planner/building/table.d.ts.map +1 -1
- package/dist/src/planner/building/table.js +1 -1
- package/dist/src/planner/building/table.js.map +1 -1
- package/dist/src/planner/framework/characteristics.d.ts +10 -1
- package/dist/src/planner/framework/characteristics.d.ts.map +1 -1
- package/dist/src/planner/framework/characteristics.js +24 -5
- package/dist/src/planner/framework/characteristics.js.map +1 -1
- package/dist/src/planner/framework/pass.d.ts.map +1 -1
- package/dist/src/planner/framework/pass.js +46 -16
- package/dist/src/planner/framework/pass.js.map +1 -1
- package/dist/src/planner/framework/physical-utils.d.ts +0 -9
- package/dist/src/planner/framework/physical-utils.d.ts.map +1 -1
- package/dist/src/planner/framework/physical-utils.js +0 -31
- package/dist/src/planner/framework/physical-utils.js.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.d.ts +25 -0
- package/dist/src/planner/nodes/aggregate-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/aggregate-node.js +75 -8
- 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 +6 -1
- package/dist/src/planner/nodes/alias-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 +17 -3
- package/dist/src/planner/nodes/asof-scan-node.js.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/bloom-join-node.js +19 -9
- package/dist/src/planner/nodes/bloom-join-node.js.map +1 -1
- package/dist/src/planner/nodes/distinct-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/distinct-node.js +10 -6
- package/dist/src/planner/nodes/distinct-node.js.map +1 -1
- package/dist/src/planner/nodes/empty-relation-node.d.ts +27 -0
- package/dist/src/planner/nodes/empty-relation-node.d.ts.map +1 -0
- package/dist/src/planner/nodes/empty-relation-node.js +61 -0
- package/dist/src/planner/nodes/empty-relation-node.js.map +1 -0
- package/dist/src/planner/nodes/filter.d.ts.map +1 -1
- package/dist/src/planner/nodes/filter.js +65 -5
- package/dist/src/planner/nodes/filter.js.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts +1 -1
- package/dist/src/planner/nodes/hash-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/hash-aggregate.js +8 -6
- package/dist/src/planner/nodes/hash-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-node.js +12 -9
- package/dist/src/planner/nodes/join-node.js.map +1 -1
- package/dist/src/planner/nodes/join-utils.d.ts +24 -1
- package/dist/src/planner/nodes/join-utils.d.ts.map +1 -1
- package/dist/src/planner/nodes/join-utils.js +86 -0
- package/dist/src/planner/nodes/join-utils.js.map +1 -1
- package/dist/src/planner/nodes/limit-offset.d.ts.map +1 -1
- package/dist/src/planner/nodes/limit-offset.js +6 -1
- package/dist/src/planner/nodes/limit-offset.js.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/merge-join-node.js +19 -9
- package/dist/src/planner/nodes/merge-join-node.js.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/ordinal-slice-node.js +5 -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 +186 -4
- 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 +75 -30
- package/dist/src/planner/nodes/project-node.js.map +1 -1
- package/dist/src/planner/nodes/reference.d.ts +24 -2
- package/dist/src/planner/nodes/reference.d.ts.map +1 -1
- package/dist/src/planner/nodes/reference.js +101 -1
- package/dist/src/planner/nodes/reference.js.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts +9 -1
- package/dist/src/planner/nodes/retrieve-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/retrieve-node.js +21 -0
- package/dist/src/planner/nodes/retrieve-node.js.map +1 -1
- package/dist/src/planner/nodes/returning-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/returning-node.js +64 -28
- package/dist/src/planner/nodes/returning-node.js.map +1 -1
- package/dist/src/planner/nodes/scalar.d.ts +1 -0
- package/dist/src/planner/nodes/scalar.d.ts.map +1 -1
- package/dist/src/planner/nodes/scalar.js +12 -0
- package/dist/src/planner/nodes/scalar.js.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/set-operation-node.js +15 -0
- package/dist/src/planner/nodes/set-operation-node.js.map +1 -1
- package/dist/src/planner/nodes/single-row.d.ts.map +1 -1
- package/dist/src/planner/nodes/single-row.js +3 -1
- package/dist/src/planner/nodes/single-row.js.map +1 -1
- package/dist/src/planner/nodes/sort.d.ts.map +1 -1
- package/dist/src/planner/nodes/sort.js +10 -3
- package/dist/src/planner/nodes/sort.js.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts +1 -1
- package/dist/src/planner/nodes/stream-aggregate.d.ts.map +1 -1
- package/dist/src/planner/nodes/stream-aggregate.js +8 -8
- package/dist/src/planner/nodes/stream-aggregate.js.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.d.ts +3 -3
- package/dist/src/planner/nodes/table-access-nodes.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-access-nodes.js +26 -8
- package/dist/src/planner/nodes/table-access-nodes.js.map +1 -1
- package/dist/src/planner/nodes/table-function-call.d.ts +4 -1
- package/dist/src/planner/nodes/table-function-call.d.ts.map +1 -1
- package/dist/src/planner/nodes/table-function-call.js +224 -14
- package/dist/src/planner/nodes/table-function-call.js.map +1 -1
- package/dist/src/planner/nodes/window-node.d.ts.map +1 -1
- package/dist/src/planner/nodes/window-node.js +9 -2
- package/dist/src/planner/nodes/window-node.js.map +1 -1
- package/dist/src/planner/optimizer-tuning.d.ts +29 -1
- package/dist/src/planner/optimizer-tuning.d.ts.map +1 -1
- package/dist/src/planner/optimizer-tuning.js +3 -0
- package/dist/src/planner/optimizer-tuning.js.map +1 -1
- package/dist/src/planner/optimizer.d.ts.map +1 -1
- package/dist/src/planner/optimizer.js +187 -0
- package/dist/src/planner/optimizer.js.map +1 -1
- 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 +22 -7
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +1 -1
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts +30 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.d.ts.map +1 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js +116 -0
- package/dist/src/planner/rules/aggregate/rule-groupby-fd-simplification.js.map +1 -0
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.d.ts +7 -7
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.d.ts.map +1 -1
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.js +18 -16
- package/dist/src/planner/rules/distinct/rule-distinct-elimination.js.map +1 -1
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts +56 -0
- package/dist/src/planner/rules/join/rule-join-elimination.d.ts.map +1 -0
- package/dist/src/planner/rules/join/rule-join-elimination.js +326 -0
- package/dist/src/planner/rules/join/rule-join-elimination.js.map +1 -0
- package/dist/src/planner/rules/join/rule-join-greedy-commute.d.ts.map +1 -1
- package/dist/src/planner/rules/join/rule-join-greedy-commute.js +10 -2
- package/dist/src/planner/rules/join/rule-join-greedy-commute.js.map +1 -1
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts +20 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js +181 -0
- package/dist/src/planner/rules/predicate/rule-aggregate-predicate-pushdown.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts +46 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js +156 -0
- package/dist/src/planner/rules/predicate/rule-empty-relation-folding.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.d.ts +30 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.js +60 -0
- package/dist/src/planner/rules/predicate/rule-filter-contradiction.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts +45 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js +210 -0
- package/dist/src/planner/rules/predicate/rule-predicate-inference-equivalence.js.map +1 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.d.ts +29 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.d.ts.map +1 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.js +161 -0
- package/dist/src/planner/rules/predicate/rule-sargable-range-rewrite.js.map +1 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.d.ts +39 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.d.ts.map +1 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.js +91 -0
- package/dist/src/planner/rules/sort/rule-orderby-fd-pruning.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts +35 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.d.ts.map +1 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js +74 -0
- package/dist/src/planner/rules/subquery/rule-anti-join-fk-empty.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts +27 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.d.ts.map +1 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js +103 -0
- package/dist/src/planner/rules/subquery/rule-semi-join-fk-trivial.js.map +1 -0
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.d.ts.map +1 -1
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js +1 -25
- package/dist/src/planner/rules/subquery/rule-subquery-decorrelation.js.map +1 -1
- package/dist/src/planner/scopes/global.js +2 -2
- package/dist/src/planner/scopes/global.js.map +1 -1
- package/dist/src/planner/type-utils.d.ts.map +1 -1
- package/dist/src/planner/type-utils.js +11 -0
- package/dist/src/planner/type-utils.js.map +1 -1
- package/dist/src/planner/util/fd-utils.d.ts +245 -0
- package/dist/src/planner/util/fd-utils.d.ts.map +1 -0
- package/dist/src/planner/util/fd-utils.js +1416 -0
- package/dist/src/planner/util/fd-utils.js.map +1 -0
- package/dist/src/planner/util/ind-utils.d.ts +79 -0
- package/dist/src/planner/util/ind-utils.d.ts.map +1 -0
- package/dist/src/planner/util/ind-utils.js +146 -0
- package/dist/src/planner/util/ind-utils.js.map +1 -0
- package/dist/src/planner/util/key-utils.d.ts +75 -14
- package/dist/src/planner/util/key-utils.d.ts.map +1 -1
- package/dist/src/planner/util/key-utils.js +234 -57
- package/dist/src/planner/util/key-utils.js.map +1 -1
- package/dist/src/runtime/delta-executor.d.ts +134 -0
- package/dist/src/runtime/delta-executor.d.ts.map +1 -0
- package/dist/src/runtime/delta-executor.js +382 -0
- package/dist/src/runtime/delta-executor.js.map +1 -0
- package/dist/src/runtime/emit/alter-table.d.ts.map +1 -1
- package/dist/src/runtime/emit/alter-table.js +52 -16
- package/dist/src/runtime/emit/alter-table.js.map +1 -1
- package/dist/src/runtime/emit/create-assertion.d.ts.map +1 -1
- package/dist/src/runtime/emit/create-assertion.js +3 -2
- package/dist/src/runtime/emit/create-assertion.js.map +1 -1
- package/dist/src/runtime/emit/dml-executor.d.ts.map +1 -1
- package/dist/src/runtime/emit/dml-executor.js +40 -13
- package/dist/src/runtime/emit/dml-executor.js.map +1 -1
- package/dist/src/runtime/emit/drop-assertion.js +1 -1
- package/dist/src/runtime/emit/drop-assertion.js.map +1 -1
- package/dist/src/runtime/emit/empty-relation.d.ts +5 -0
- package/dist/src/runtime/emit/empty-relation.d.ts.map +1 -0
- package/dist/src/runtime/emit/empty-relation.js +11 -0
- package/dist/src/runtime/emit/empty-relation.js.map +1 -0
- package/dist/src/runtime/foreign-key-actions.d.ts +16 -0
- package/dist/src/runtime/foreign-key-actions.d.ts.map +1 -1
- package/dist/src/runtime/foreign-key-actions.js +81 -1
- package/dist/src/runtime/foreign-key-actions.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/schema/assertion.d.ts +8 -0
- package/dist/src/schema/assertion.d.ts.map +1 -1
- package/dist/src/schema/change-events.d.ts +5 -1
- package/dist/src/schema/change-events.d.ts.map +1 -1
- package/dist/src/schema/change-events.js.map +1 -1
- package/dist/src/schema/function.d.ts +65 -1
- package/dist/src/schema/function.d.ts.map +1 -1
- package/dist/src/schema/function.js +31 -0
- package/dist/src/schema/function.js.map +1 -1
- package/dist/src/schema/manager.d.ts +33 -0
- package/dist/src/schema/manager.d.ts.map +1 -1
- package/dist/src/schema/manager.js +95 -4
- package/dist/src/schema/manager.js.map +1 -1
- package/dist/src/schema/rename-rewriter.d.ts.map +1 -1
- package/dist/src/schema/rename-rewriter.js +303 -102
- package/dist/src/schema/rename-rewriter.js.map +1 -1
- package/dist/src/schema/table.d.ts +21 -2
- package/dist/src/schema/table.d.ts.map +1 -1
- package/dist/src/schema/table.js +17 -8
- package/dist/src/schema/table.js.map +1 -1
- package/dist/src/types/temporal-types.d.ts.map +1 -1
- package/dist/src/types/temporal-types.js +32 -0
- package/dist/src/types/temporal-types.js.map +1 -1
- package/dist/src/vtab/events.d.ts +9 -0
- package/dist/src/vtab/events.d.ts.map +1 -1
- package/dist/src/vtab/events.js +19 -0
- package/dist/src/vtab/events.js.map +1 -1
- package/dist/src/vtab/memory/layer/manager.d.ts.map +1 -1
- package/dist/src/vtab/memory/layer/manager.js +24 -5
- package/dist/src/vtab/memory/layer/manager.js.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.d.ts +2 -1
- package/dist/src/vtab/memory/utils/predicate.d.ts.map +1 -1
- package/dist/src/vtab/memory/utils/predicate.js +32 -1
- package/dist/src/vtab/memory/utils/predicate.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,222 +1,224 @@
|
|
|
1
|
-
# Quereus - A TypeScript SQL Query Processor
|
|
2
|
-
|
|
3
|
-
<img src="../../docs/images/Quereus_colored_wide.svg" alt="Quereus Logo" height="150">
|
|
4
|
-
|
|
5
|
-
Quereus is a feature-complete SQL query processor specifically designed for efficient in-memory data processing with a strong emphasis on the **virtual table** interface. It provides rich SQL query and constraint capabilities (joins, aggregates, subqueries, CTEs, window functions, constraints) over data sources exposed via the virtual table mechanism. Quereus features a modern type system with temporal types, JSON support, and plugin-extensible custom types. It has no persistent file storage, though one could be built as a virtual table module.
|
|
6
|
-
|
|
7
|
-
## Project Goals
|
|
8
|
-
|
|
9
|
-
* **Virtual Table Centric** — provide a robust and flexible virtual table API as the primary means of interacting with data sources. All tables are virtual tables.
|
|
10
|
-
* **In-Memory Default** — includes a comprehensive in-memory virtual table implementation (`MemoryTable`) with support for transactions and savepoints.
|
|
11
|
-
* **Modern Type System** — extensible logical/physical type separation with built-in temporal types (DATE, TIME, DATETIME), native JSON type with deep equality comparison, and plugin support for custom types. See [Type System Documentation](../../docs/types.md).
|
|
12
|
-
* **TypeScript & Modern JS** — leverage TypeScript's type system and modern JavaScript features and idioms.
|
|
13
|
-
* **Async VTab Operations** — virtual table data operations (reads/writes) are asynchronous. Cursors are implemented as async iterables.
|
|
14
|
-
* **Cross-Platform** — target diverse Javascript runtime environments, including Node.js, browser, and React Native. Plugin loading (via `@quereus/plugin-loader`) uses dynamic `import()` and is not compatible with React Native; use static imports for RN.
|
|
15
|
-
* **Minimal Dependencies** — avoid heavy external dependencies where possible.
|
|
16
|
-
* **SQL Compatibility** — comprehensive support for modern SQL features including joins, window functions, subqueries, CTEs, constraints, views, and advanced DML/DDL operations.
|
|
17
|
-
* **Key-Based Addressing** — all tables are addressed by their defined Primary Key. The concept of a separate, implicit `rowid` for addressing rows is not used.
|
|
18
|
-
* **Third Manifesto Friendly** — embraces some of the principles of the [Third Manifesto](https://www.dcs.warwick.ac.uk/~hugh/TTM/DTATRM.pdf), such as allowing for empty keys. Utilizes algebraic planning.
|
|
19
|
-
|
|
20
|
-
## Quick Start
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import { Database } from '@quereus/quereus';
|
|
24
|
-
|
|
25
|
-
const db = new Database();
|
|
26
|
-
|
|
27
|
-
// Create a table and insert data
|
|
28
|
-
await db.exec("create table users (id integer primary key, name text, email text)");
|
|
29
|
-
await db.exec("insert into users values (1, 'Alice', 'alice@example.com')");
|
|
30
|
-
|
|
31
|
-
// Query returns objects: { id: 1, name: 'Alice', email: 'alice@example.com' }
|
|
32
|
-
const user = await db.get("select * from users where id = ?", [1]);
|
|
33
|
-
console.log(user.name); // "Alice"
|
|
34
|
-
|
|
35
|
-
// Iterate over multiple rows
|
|
36
|
-
for await (const row of db.eval("select * from users")) {
|
|
37
|
-
console.log(row.name);
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Reactive Patterns with Event Hooks
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
import { Database } from '@quereus/quereus';
|
|
45
|
-
|
|
46
|
-
const db = new Database();
|
|
47
|
-
|
|
48
|
-
// Subscribe to data changes at the database level
|
|
49
|
-
db.onDataChange((event) => {
|
|
50
|
-
console.log(`${event.type} on ${event.tableName} (module: ${event.moduleName})`);
|
|
51
|
-
if (event.remote) {
|
|
52
|
-
console.log('Change came from remote sync');
|
|
53
|
-
}
|
|
54
|
-
if (event.type === 'update') {
|
|
55
|
-
console.log('Changed columns:', event.changedColumns);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// Subscribe to schema changes
|
|
60
|
-
db.onSchemaChange((event) => {
|
|
61
|
-
console.log(`${event.type} ${event.objectType}: ${event.objectName}`);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// Events fire after commit
|
|
65
|
-
await db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
|
|
66
|
-
// Output: create table: users
|
|
67
|
-
|
|
68
|
-
await db.exec("INSERT INTO users VALUES (1, 'Alice')");
|
|
69
|
-
// Output: insert on users (module: memory)
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The database-level event system aggregates events from all modules automatically. Events are batched within transactions and delivered only after successful commit.
|
|
73
|
-
|
|
74
|
-
SQL values use native JavaScript types (`string`, `number`, `bigint`, `Uint8Array`, `null`). Temporal types are ISO 8601 strings. Results stream as async iterators.
|
|
75
|
-
|
|
76
|
-
See the [Usage Guide](../../docs/usage.md) for complete API reference and [Module Authoring Guide](../../docs/module-authoring.md) for event system details.
|
|
77
|
-
|
|
78
|
-
## Platform Support & Storage
|
|
79
|
-
|
|
80
|
-
Quereus runs on any JavaScript runtime. For persistent storage, platform-specific plugins provide the `store` virtual table module:
|
|
81
|
-
|
|
82
|
-
### Node.js
|
|
83
|
-
|
|
84
|
-
Use [`@quereus/plugin-leveldb`](../quereus-plugin-leveldb/) for LevelDB-based persistent storage with full transaction isolation. Each table becomes a subdirectory under `basePath`:
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
import { Database, registerPlugin } from '@quereus/quereus';
|
|
88
|
-
import leveldbPlugin from '@quereus/plugin-leveldb/plugin';
|
|
89
|
-
|
|
90
|
-
const db = new Database();
|
|
91
|
-
await registerPlugin(db, leveldbPlugin, { basePath: './data' }); // ./data/users/, ./data/orders/, etc.
|
|
92
|
-
|
|
93
|
-
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
94
|
-
|
|
95
|
-
// Full transaction isolation enabled by default
|
|
96
|
-
await db.exec('BEGIN');
|
|
97
|
-
await db.exec(`INSERT INTO users VALUES (1, 'Alice')`);
|
|
98
|
-
const user = await db.get('SELECT * FROM users WHERE id = 1'); // Sees uncommitted insert
|
|
99
|
-
await db.exec('COMMIT');
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Browser
|
|
103
|
-
|
|
104
|
-
Use [`@quereus/plugin-indexeddb`](../quereus-plugin-indexeddb/) for IndexedDB-based persistent storage with cross-tab sync and full transaction isolation. All tables share one IndexedDB database:
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
import { Database, registerPlugin } from '@quereus/quereus';
|
|
108
|
-
import indexeddbPlugin from '@quereus/plugin-indexeddb/plugin';
|
|
109
|
-
|
|
110
|
-
const db = new Database();
|
|
111
|
-
await registerPlugin(db, indexeddbPlugin, { databaseName: 'myapp' }); // IndexedDB database name
|
|
112
|
-
|
|
113
|
-
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### React Native
|
|
117
|
-
|
|
118
|
-
Use [`@quereus/plugin-react-native-leveldb`](../quereus-plugin-react-native-leveldb/) for fast LevelDB storage with full transaction isolation. Each table becomes a separate LevelDB database with a name prefix:
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
import { LevelDB, LevelDBWriteBatch } from 'react-native-leveldb';
|
|
122
|
-
import { Database, registerPlugin } from '@quereus/quereus';
|
|
123
|
-
import leveldbPlugin from '@quereus/plugin-react-native-leveldb/plugin';
|
|
124
|
-
|
|
125
|
-
const db = new Database();
|
|
126
|
-
await registerPlugin(db, leveldbPlugin, {
|
|
127
|
-
openFn: LevelDB.open,
|
|
128
|
-
WriteBatch: LevelDBWriteBatch,
|
|
129
|
-
databaseName: 'myapp' // creates myapp_users, myapp_orders, etc.
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**Note:** React Native requires runtime polyfills and static plugin loading. See the [plugin README](../quereus-plugin-react-native-leveldb/) for setup details.
|
|
136
|
-
|
|
137
|
-
**Required polyfills:**
|
|
138
|
-
- `structuredClone` (Quereus uses it internally)
|
|
139
|
-
- `TextEncoder` / `TextDecoder` (used by store plugins)
|
|
140
|
-
- `Symbol.asyncIterator` (required for async-iterable support; Quereus has a Hermes workaround for AsyncGenerator iterables, but the symbol must exist)
|
|
141
|
-
|
|
142
|
-
### NativeScript
|
|
143
|
-
|
|
144
|
-
Use [`@quereus/plugin-nativescript-sqlite`](../quereus-plugin-nativescript-sqlite/) for SQLite-based storage with full transaction isolation. All tables share one SQLite database file:
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
import { openOrCreate } from '@nativescript-community/sqlite';
|
|
148
|
-
import { Database, registerPlugin } from '@quereus/quereus';
|
|
149
|
-
import sqlitePlugin from '@quereus/plugin-nativescript-sqlite/plugin';
|
|
150
|
-
|
|
151
|
-
const sqliteDb = openOrCreate('myapp.db'); // SQLite database file
|
|
152
|
-
const db = new Database();
|
|
153
|
-
await registerPlugin(db, sqlitePlugin, { db: sqliteDb });
|
|
154
|
-
|
|
155
|
-
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
See [Store Documentation](../../docs/store.md) for the storage architecture and custom backend implementation.
|
|
159
|
-
|
|
160
|
-
## Documentation
|
|
161
|
-
|
|
162
|
-
**Architecture deep dive:** [Architecture](../../docs/architecture.md) — the pipeline (parser → planner → runtime), source layout, extension patterns, design decisions, constraints model, and testing strategy. Start here if you're working on the engine itself.
|
|
163
|
-
|
|
164
|
-
**User & operator docs:**
|
|
165
|
-
* [Usage Guide](../../docs/usage.md) — complete API reference (type mappings, parameter binding, logging, tracing, transactions)
|
|
166
|
-
* [SQL Reference Guide](../../docs/sql.md) — SQL syntax (includes Declarative Schema)
|
|
167
|
-
* [Schema Management](../../docs/schema.md) — SchemaManager API, change events, key types, DDL generation
|
|
168
|
-
* [Type System](../../docs/types.md) — logical/physical types, temporal types, JSON, custom types
|
|
169
|
-
* [Functions](../../docs/functions.md) — built-in scalar, aggregate, window, and JSON functions
|
|
170
|
-
* [Memory Tables](../../docs/memory-table.md) — built-in MemoryTable module
|
|
171
|
-
* [Module Authoring](../../docs/module-authoring.md) — virtual table module development and event system
|
|
172
|
-
* [Date/Time Handling](../../docs/datetime.md) — temporal parsing, functions, and ISO 8601 formats
|
|
173
|
-
* [Runtime](../../docs/runtime.md) — instruction-based execution and opcodes
|
|
174
|
-
* [Error Handling](../../docs/errors.md) — error types and status codes
|
|
175
|
-
* [Plugin System](../../docs/plugins.md) — virtual tables, functions, and collations
|
|
176
|
-
* [Optimizer](../../docs/optimizer.md) / [Optimizer Conventions](../../docs/optimizer-conventions.md)
|
|
177
|
-
* [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
* **
|
|
185
|
-
* **
|
|
186
|
-
* **
|
|
187
|
-
* **
|
|
188
|
-
* **
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
* **
|
|
199
|
-
* **
|
|
200
|
-
* **
|
|
201
|
-
* **
|
|
202
|
-
* **
|
|
203
|
-
* **
|
|
204
|
-
* **
|
|
205
|
-
* **
|
|
206
|
-
* **
|
|
207
|
-
* **
|
|
208
|
-
|
|
209
|
-
[
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
* **
|
|
216
|
-
* **
|
|
217
|
-
* **
|
|
218
|
-
* **
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
1
|
+
# Quereus - A TypeScript SQL Query Processor
|
|
2
|
+
|
|
3
|
+
<img src="../../docs/images/Quereus_colored_wide.svg" alt="Quereus Logo" height="150">
|
|
4
|
+
|
|
5
|
+
Quereus is a feature-complete SQL query processor specifically designed for efficient in-memory data processing with a strong emphasis on the **virtual table** interface. It provides rich SQL query and constraint capabilities (joins, aggregates, subqueries, CTEs, window functions, constraints) over data sources exposed via the virtual table mechanism. Quereus features a modern type system with temporal types, JSON support, and plugin-extensible custom types. It has no persistent file storage, though one could be built as a virtual table module.
|
|
6
|
+
|
|
7
|
+
## Project Goals
|
|
8
|
+
|
|
9
|
+
* **Virtual Table Centric** — provide a robust and flexible virtual table API as the primary means of interacting with data sources. All tables are virtual tables.
|
|
10
|
+
* **In-Memory Default** — includes a comprehensive in-memory virtual table implementation (`MemoryTable`) with support for transactions and savepoints.
|
|
11
|
+
* **Modern Type System** — extensible logical/physical type separation with built-in temporal types (DATE, TIME, DATETIME), native JSON type with deep equality comparison, and plugin support for custom types. See [Type System Documentation](../../docs/types.md).
|
|
12
|
+
* **TypeScript & Modern JS** — leverage TypeScript's type system and modern JavaScript features and idioms.
|
|
13
|
+
* **Async VTab Operations** — virtual table data operations (reads/writes) are asynchronous. Cursors are implemented as async iterables.
|
|
14
|
+
* **Cross-Platform** — target diverse Javascript runtime environments, including Node.js, browser, and React Native. Plugin loading (via `@quereus/plugin-loader`) uses dynamic `import()` and is not compatible with React Native; use static imports for RN.
|
|
15
|
+
* **Minimal Dependencies** — avoid heavy external dependencies where possible.
|
|
16
|
+
* **SQL Compatibility** — comprehensive support for modern SQL features including joins, window functions, subqueries, CTEs, constraints, views, and advanced DML/DDL operations.
|
|
17
|
+
* **Key-Based Addressing** — all tables are addressed by their defined Primary Key. The concept of a separate, implicit `rowid` for addressing rows is not used.
|
|
18
|
+
* **Third Manifesto Friendly** — embraces some of the principles of the [Third Manifesto](https://www.dcs.warwick.ac.uk/~hugh/TTM/DTATRM.pdf), such as allowing for empty keys. Utilizes algebraic planning.
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { Database } from '@quereus/quereus';
|
|
24
|
+
|
|
25
|
+
const db = new Database();
|
|
26
|
+
|
|
27
|
+
// Create a table and insert data
|
|
28
|
+
await db.exec("create table users (id integer primary key, name text, email text)");
|
|
29
|
+
await db.exec("insert into users values (1, 'Alice', 'alice@example.com')");
|
|
30
|
+
|
|
31
|
+
// Query returns objects: { id: 1, name: 'Alice', email: 'alice@example.com' }
|
|
32
|
+
const user = await db.get("select * from users where id = ?", [1]);
|
|
33
|
+
console.log(user.name); // "Alice"
|
|
34
|
+
|
|
35
|
+
// Iterate over multiple rows
|
|
36
|
+
for await (const row of db.eval("select * from users")) {
|
|
37
|
+
console.log(row.name);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Reactive Patterns with Event Hooks
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { Database } from '@quereus/quereus';
|
|
45
|
+
|
|
46
|
+
const db = new Database();
|
|
47
|
+
|
|
48
|
+
// Subscribe to data changes at the database level
|
|
49
|
+
db.onDataChange((event) => {
|
|
50
|
+
console.log(`${event.type} on ${event.tableName} (module: ${event.moduleName})`);
|
|
51
|
+
if (event.remote) {
|
|
52
|
+
console.log('Change came from remote sync');
|
|
53
|
+
}
|
|
54
|
+
if (event.type === 'update') {
|
|
55
|
+
console.log('Changed columns:', event.changedColumns);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Subscribe to schema changes
|
|
60
|
+
db.onSchemaChange((event) => {
|
|
61
|
+
console.log(`${event.type} ${event.objectType}: ${event.objectName}`);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Events fire after commit
|
|
65
|
+
await db.exec("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)");
|
|
66
|
+
// Output: create table: users
|
|
67
|
+
|
|
68
|
+
await db.exec("INSERT INTO users VALUES (1, 'Alice')");
|
|
69
|
+
// Output: insert on users (module: memory)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The database-level event system aggregates events from all modules automatically. Events are batched within transactions and delivered only after successful commit.
|
|
73
|
+
|
|
74
|
+
SQL values use native JavaScript types (`string`, `number`, `bigint`, `Uint8Array`, `null`). Temporal types are ISO 8601 strings. Results stream as async iterators.
|
|
75
|
+
|
|
76
|
+
See the [Usage Guide](../../docs/usage.md) for complete API reference and [Module Authoring Guide](../../docs/module-authoring.md) for event system details.
|
|
77
|
+
|
|
78
|
+
## Platform Support & Storage
|
|
79
|
+
|
|
80
|
+
Quereus runs on any JavaScript runtime. For persistent storage, platform-specific plugins provide the `store` virtual table module:
|
|
81
|
+
|
|
82
|
+
### Node.js
|
|
83
|
+
|
|
84
|
+
Use [`@quereus/plugin-leveldb`](../quereus-plugin-leveldb/) for LevelDB-based persistent storage with full transaction isolation. Each table becomes a subdirectory under `basePath`:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { Database, registerPlugin } from '@quereus/quereus';
|
|
88
|
+
import leveldbPlugin from '@quereus/plugin-leveldb/plugin';
|
|
89
|
+
|
|
90
|
+
const db = new Database();
|
|
91
|
+
await registerPlugin(db, leveldbPlugin, { basePath: './data' }); // ./data/users/, ./data/orders/, etc.
|
|
92
|
+
|
|
93
|
+
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
94
|
+
|
|
95
|
+
// Full transaction isolation enabled by default
|
|
96
|
+
await db.exec('BEGIN');
|
|
97
|
+
await db.exec(`INSERT INTO users VALUES (1, 'Alice')`);
|
|
98
|
+
const user = await db.get('SELECT * FROM users WHERE id = 1'); // Sees uncommitted insert
|
|
99
|
+
await db.exec('COMMIT');
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Browser
|
|
103
|
+
|
|
104
|
+
Use [`@quereus/plugin-indexeddb`](../quereus-plugin-indexeddb/) for IndexedDB-based persistent storage with cross-tab sync and full transaction isolation. All tables share one IndexedDB database:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { Database, registerPlugin } from '@quereus/quereus';
|
|
108
|
+
import indexeddbPlugin from '@quereus/plugin-indexeddb/plugin';
|
|
109
|
+
|
|
110
|
+
const db = new Database();
|
|
111
|
+
await registerPlugin(db, indexeddbPlugin, { databaseName: 'myapp' }); // IndexedDB database name
|
|
112
|
+
|
|
113
|
+
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### React Native
|
|
117
|
+
|
|
118
|
+
Use [`@quereus/plugin-react-native-leveldb`](../quereus-plugin-react-native-leveldb/) for fast LevelDB storage with full transaction isolation. Each table becomes a separate LevelDB database with a name prefix:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { LevelDB, LevelDBWriteBatch } from 'react-native-leveldb';
|
|
122
|
+
import { Database, registerPlugin } from '@quereus/quereus';
|
|
123
|
+
import leveldbPlugin from '@quereus/plugin-react-native-leveldb/plugin';
|
|
124
|
+
|
|
125
|
+
const db = new Database();
|
|
126
|
+
await registerPlugin(db, leveldbPlugin, {
|
|
127
|
+
openFn: LevelDB.open,
|
|
128
|
+
WriteBatch: LevelDBWriteBatch,
|
|
129
|
+
databaseName: 'myapp' // creates myapp_users, myapp_orders, etc.
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Note:** React Native requires runtime polyfills and static plugin loading. See the [plugin README](../quereus-plugin-react-native-leveldb/) for setup details.
|
|
136
|
+
|
|
137
|
+
**Required polyfills:**
|
|
138
|
+
- `structuredClone` (Quereus uses it internally)
|
|
139
|
+
- `TextEncoder` / `TextDecoder` (used by store plugins)
|
|
140
|
+
- `Symbol.asyncIterator` (required for async-iterable support; Quereus has a Hermes workaround for AsyncGenerator iterables, but the symbol must exist)
|
|
141
|
+
|
|
142
|
+
### NativeScript
|
|
143
|
+
|
|
144
|
+
Use [`@quereus/plugin-nativescript-sqlite`](../quereus-plugin-nativescript-sqlite/) for SQLite-based storage with full transaction isolation. All tables share one SQLite database file:
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { openOrCreate } from '@nativescript-community/sqlite';
|
|
148
|
+
import { Database, registerPlugin } from '@quereus/quereus';
|
|
149
|
+
import sqlitePlugin from '@quereus/plugin-nativescript-sqlite/plugin';
|
|
150
|
+
|
|
151
|
+
const sqliteDb = openOrCreate('myapp.db'); // SQLite database file
|
|
152
|
+
const db = new Database();
|
|
153
|
+
await registerPlugin(db, sqlitePlugin, { db: sqliteDb });
|
|
154
|
+
|
|
155
|
+
await db.exec(`create table users (id integer primary key, name text) using store`);
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
See [Store Documentation](../../docs/store.md) for the storage architecture and custom backend implementation.
|
|
159
|
+
|
|
160
|
+
## Documentation
|
|
161
|
+
|
|
162
|
+
**Architecture deep dive:** [Architecture](../../docs/architecture.md) — the pipeline (parser → planner → runtime), source layout, extension patterns, design decisions, constraints model, and testing strategy. Start here if you're working on the engine itself.
|
|
163
|
+
|
|
164
|
+
**User & operator docs:**
|
|
165
|
+
* [Usage Guide](../../docs/usage.md) — complete API reference (type mappings, parameter binding, logging, tracing, transactions)
|
|
166
|
+
* [SQL Reference Guide](../../docs/sql.md) — SQL syntax (includes Declarative Schema)
|
|
167
|
+
* [Schema Management](../../docs/schema.md) — SchemaManager API, change events, key types, DDL generation
|
|
168
|
+
* [Type System](../../docs/types.md) — logical/physical types, temporal types, JSON, custom types
|
|
169
|
+
* [Functions](../../docs/functions.md) — built-in scalar, aggregate, window, and JSON functions
|
|
170
|
+
* [Memory Tables](../../docs/memory-table.md) — built-in MemoryTable module
|
|
171
|
+
* [Module Authoring](../../docs/module-authoring.md) — virtual table module development and event system
|
|
172
|
+
* [Date/Time Handling](../../docs/datetime.md) — temporal parsing, functions, and ISO 8601 formats
|
|
173
|
+
* [Runtime](../../docs/runtime.md) — instruction-based execution and opcodes
|
|
174
|
+
* [Error Handling](../../docs/errors.md) — error types and status codes
|
|
175
|
+
* [Plugin System](../../docs/plugins.md) — virtual tables, functions, and collations
|
|
176
|
+
* [Optimizer](../../docs/optimizer.md) / [Optimizer Conventions](../../docs/optimizer-conventions.md)
|
|
177
|
+
* [Change-scope Introspection](../../docs/change-scope.md) — what a prepared statement reads from
|
|
178
|
+
* [TODO List](../../docs/todo.md) — planned features
|
|
179
|
+
|
|
180
|
+
### Plugin Development
|
|
181
|
+
|
|
182
|
+
Quereus exports all critical utilities needed for plugin and module development:
|
|
183
|
+
|
|
184
|
+
* **Comparison Functions** — `compareSqlValues`, `compareRows`, `compareTypedValues`, `createTypedComparator` — match Quereus SQL semantics in custom implementations
|
|
185
|
+
* **Coercion Utilities** — `tryCoerceToNumber`, `coerceForAggregate` — handle type coercion for aggregates and arithmetic
|
|
186
|
+
* **Collation Support** — `registerCollation`, `getCollation`, built-in collations (`BINARY_COLLATION`, `NOCASE_COLLATION`, `RTRIM_COLLATION`)
|
|
187
|
+
* **Type System** — full access to logical types, validation, and parsing utilities
|
|
188
|
+
* **Event Hooks** — `VTableEventEmitter` interface for mutation and schema change events; enable reactive patterns, caching, and replication
|
|
189
|
+
* **DDL Generation** — `generateTableDDL(tableSchema, db?)`, `generateIndexDDL(indexSchema, tableSchema, db?)` — canonical `CREATE TABLE` / `CREATE INDEX` output from runtime schema objects. With a `Database`, matches session defaults (schema qualification, `default_column_nullability`, `default_vtab_module`/`default_vtab_args`) for readable output; without one, emits fully-qualified, explicitly-annotated DDL safe for cross-session persistence. See [Schema Management — DDL Generation](../../docs/schema.md#ddl-generation).
|
|
190
|
+
|
|
191
|
+
See the [Plugin System documentation](../../docs/plugins.md#comparison-and-coercion-utilities) for complete API reference and examples.
|
|
192
|
+
|
|
193
|
+
## Current Status
|
|
194
|
+
|
|
195
|
+
Quereus is a feature-complete SQL query processor with a modern planner and instruction-based runtime architecture. The engine successfully handles complex SQL workloads including joins, window functions, subqueries, CTEs, constraints, and comprehensive DML/DDL operations.
|
|
196
|
+
|
|
197
|
+
**Current capabilities include:**
|
|
198
|
+
* **Modern Type System** — temporal types (DATE, TIME, DATETIME), JSON with deep equality, plugin-extensible custom types
|
|
199
|
+
* **Complete JOIN support** — INNER, LEFT, RIGHT, CROSS, SEMI, and ANTI joins with proper NULL padding
|
|
200
|
+
* **Advanced window functions** — ranking, aggregates, and frame specifications
|
|
201
|
+
* **Full constraint system** — NOT NULL, CHECK, FOREIGN KEY, and CREATE ASSERTION. Row-level constraints that reference other tables are automatically deferred to COMMIT. The `committed.tablename` pseudo-schema provides read-only access to pre-transaction state for transition constraints (e.g., "balance may not decrease"). See [Architecture — Constraints](../../docs/architecture.md#constraints).
|
|
202
|
+
* **Comprehensive subqueries** — scalar, correlated, EXISTS, and IN subqueries
|
|
203
|
+
* **Relational orthogonality** — INSERT/UPDATE/DELETE with RETURNING can be used as table sources
|
|
204
|
+
* **Complete set operations** — UNION, INTERSECT, EXCEPT with proper deduplication
|
|
205
|
+
* **DIFF (symmetric difference)** — `A diff B` equals `(A except B) union (B except A)`, handy for table equality checks via `not exists(A diff B)`
|
|
206
|
+
* **Robust transaction support** — multi-level savepoints and rollback. See [Usage Guide](../../docs/usage.md#transactions) for details
|
|
207
|
+
* **Rich built-in function library** — scalar, aggregate, window, JSON, and date/time functions
|
|
208
|
+
* **Rule-based optimizer** — constant folding, caching, streaming aggregation, bloom-join selection, and correlated subquery decorrelation. See [Architecture — Optimizer](../../docs/architecture.md#optimizer).
|
|
209
|
+
* **Change-scope introspection and reactive subscriptions** — `Statement.getChangeScope()` returns a JSON-serializable description of what base-table state and external inputs a prepared statement reads from. The companion `Database.watch(scope, handler)` consumes any `ChangeScope` value (analyzed, deserialized, or hand-built) and fires a post-commit callback whenever matching rows, groups, or tables change. See [Change-scope Documentation](../../docs/change-scope.md).
|
|
210
|
+
|
|
211
|
+
[TODO List](../../docs/todo.md) has remaining priorities.
|
|
212
|
+
|
|
213
|
+
## Supported Built-in Functions
|
|
214
|
+
|
|
215
|
+
* **Scalar** — `lower`, `upper`, `length`, `substr`/`substring`, `abs`, `round`, `coalesce`, `nullif`, `like`, `glob`, `typeof`
|
|
216
|
+
* **Aggregate** — `count`, `sum`, `avg`, `min`, `max`, `group_concat`, `json_group_array`, `json_group_object`
|
|
217
|
+
* **Window Functions** — complete implementation with `row_number`, `rank`, `dense_rank`, `ntile` (ranking); `count`, `sum`, `avg`, `min`, `max` with OVER clause (aggregates); full frame specification support (`ROWS BETWEEN`, `UNBOUNDED PRECEDING/FOLLOWING`); `NULLS FIRST/LAST` ordering
|
|
218
|
+
* **Date/Time** — `date`, `time`, `datetime`, `julianday`, `strftime` (supports common formats and modifiers), `epoch_s`, `epoch_ms`, `epoch_s_frac` (Unix epoch conversions with strict parsing)
|
|
219
|
+
* **JSON** — `json_valid`, `json_schema`, `json_type`, `json_extract`, `json_quote`, `json_array`, `json_object`, `json_insert`, `json_replace`, `json_set`, `json_remove`, `json_array_length`, `json_patch`
|
|
220
|
+
* **Query Analysis** — `query_plan`, `scheduler_program`, `execution_trace` (debugging and performance analysis)
|
|
221
|
+
|
|
222
|
+
## Testing
|
|
223
|
+
|
|
224
|
+
Tests live in `test/*.spec.ts`, driven by Mocha with ts-node/esm. Run with `yarn test`. Quereus uses SQL logic tests (primary), property-based tests, performance sentinels, unit tests, and a benchmark suite — see [Architecture — Testing Strategy](../../docs/architecture.md#testing-strategy) for details.
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Global assertion evaluation for deferred constraint checking.
|
|
3
3
|
*
|
|
4
|
-
* This module handles the evaluation of CREATE ASSERTION constraints at
|
|
5
|
-
* commit time. It optimizes assertion checking by:
|
|
4
|
+
* This module handles the evaluation of CREATE ASSERTION constraints at
|
|
5
|
+
* transaction commit time. It optimizes assertion checking by:
|
|
6
6
|
* - Only evaluating assertions impacted by changed tables
|
|
7
|
-
* - Caching compiled plans and
|
|
7
|
+
* - Caching compiled plans, classifications, and residual variants across commits
|
|
8
8
|
* - Invalidating cached plans on schema changes
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
9
|
+
* - Driving per-binding execution through the reusable `DeltaExecutor` kernel
|
|
10
|
+
*
|
|
11
|
+
* Assertions are the first consumer of `DeltaExecutor`. Materialized views,
|
|
12
|
+
* reactive signals, and triggers will plug in by registering their own
|
|
13
|
+
* `DeltaSubscription`s.
|
|
11
14
|
*/
|
|
12
15
|
import { type SqlValue } from '../common/types.js';
|
|
13
16
|
import * as AST from '../parser/ast.js';
|
|
@@ -28,16 +31,22 @@ export interface AssertionEvaluatorContext {
|
|
|
28
31
|
getChangedBaseTables(): Set<string>;
|
|
29
32
|
/** Get changed PK tuples for a specific base table */
|
|
30
33
|
getChangedKeyTuples(base: string): SqlValue[][];
|
|
34
|
+
/** Get changed projected tuples for a specific base table */
|
|
35
|
+
getChangedTuples(base: string, columnIndices: readonly number[], pkIndices: readonly number[]): SqlValue[][];
|
|
36
|
+
/** Register a column-projection capture spec for a base table */
|
|
37
|
+
registerCaptureSpec(baseTable: string, spec: {
|
|
38
|
+
extraColumns: ReadonlySet<number>;
|
|
39
|
+
}): () => void;
|
|
31
40
|
}
|
|
32
41
|
/**
|
|
33
42
|
* Evaluates global assertions (CREATE ASSERTION) at transaction commit time.
|
|
34
43
|
*
|
|
35
44
|
* Assertions are evaluated only when the tables they reference have been modified.
|
|
36
|
-
* The evaluator uses
|
|
37
|
-
* checked per-row
|
|
45
|
+
* The evaluator uses binding analysis to determine whether assertions can be
|
|
46
|
+
* checked per-row, per-group, or require a full violation query.
|
|
38
47
|
*
|
|
39
|
-
* Compiled plans are cached and invalidated on schema
|
|
40
|
-
* re-parsing/re-planning on every commit.
|
|
48
|
+
* Compiled plans and residual variants are cached and invalidated on schema
|
|
49
|
+
* changes to avoid re-parsing/re-planning on every commit.
|
|
41
50
|
*/
|
|
42
51
|
export declare class AssertionEvaluator {
|
|
43
52
|
private readonly ctx;
|
|
@@ -47,25 +56,36 @@ export declare class AssertionEvaluator {
|
|
|
47
56
|
private schemaGeneration;
|
|
48
57
|
/** Unsubscribe function for schema change listener */
|
|
49
58
|
private unsubscribeSchemaChanges;
|
|
59
|
+
/** The shared delta dispatcher */
|
|
60
|
+
private readonly executor;
|
|
50
61
|
constructor(ctx: AssertionEvaluatorContext);
|
|
51
62
|
private subscribeToSchemaChanges;
|
|
52
63
|
/** Remove an assertion from the plan cache (called on DROP ASSERTION) */
|
|
53
64
|
invalidateAssertion(name: string): void;
|
|
54
65
|
/** Unsubscribe from schema changes and clear cached plans */
|
|
55
66
|
dispose(): void;
|
|
67
|
+
private releaseCached;
|
|
56
68
|
/**
|
|
57
|
-
* Run all global assertions
|
|
58
|
-
*
|
|
69
|
+
* Run all global assertions impacted by changes in the current transaction.
|
|
70
|
+
* The DeltaExecutor walks all live subscriptions; assertion subscriptions
|
|
71
|
+
* dispatch their own residual scheduler per binding tuple.
|
|
72
|
+
*
|
|
73
|
+
* @throws QuereusError with CONSTRAINT status if any assertion is violated.
|
|
59
74
|
*/
|
|
60
75
|
runGlobalAssertions(): Promise<void>;
|
|
61
76
|
private getOrCompilePlan;
|
|
62
|
-
private
|
|
77
|
+
private compileUnderSuppression;
|
|
78
|
+
private buildSubscription;
|
|
63
79
|
private executeViolationOnce;
|
|
64
|
-
private
|
|
80
|
+
private executeResidualPerTuple;
|
|
65
81
|
private buildViolationError;
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Inject a key-equality filter onto the `TableReferenceNode` matching
|
|
84
|
+
* `targetRelationKey`. Used for both `'row'` (with PK columns + 'pk' prefix)
|
|
85
|
+
* and `'group'` (with group-key columns + 'gk' prefix).
|
|
86
|
+
*/
|
|
87
|
+
private injectKeyFilter;
|
|
88
|
+
private rewriteForKeyFilter;
|
|
68
89
|
private tryWrapTableReference;
|
|
69
|
-
private collectTables;
|
|
70
90
|
}
|
|
71
91
|
//# sourceMappingURL=database-assertions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-assertions.d.ts","sourceRoot":"","sources":["../../../src/core/database-assertions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"database-assertions.d.ts","sourceRoot":"","sources":["../../../src/core/database-assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI/D,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AAcxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQ9C;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,eAAe,CAAC,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEtC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,OAAO,eAAe,EAAE,eAAe,CAAC;IACjF,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACtD,oBAAoB,IAAI,UAAU,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAErE,qEAAqE;IACrE,oBAAoB,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,sDAAsD;IACtD,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,EAAE,CAAC;IAChD,6DAA6D;IAC7D,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,QAAQ,EAAE,EAAE,CAAC;IAC7G,iEAAiE;IACjE,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;KAAE,GAAG,MAAM,IAAI,CAAC;CAChG;AAwCD;;;;;;;;;GASG;AACH,qBAAa,kBAAkB;IAUlB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAThC,gEAAgE;IAChE,OAAO,CAAC,KAAK,CAA0C;IACvD,6FAA6F;IAC7F,OAAO,CAAC,gBAAgB,CAAK;IAC7B,sDAAsD;IACtD,OAAO,CAAC,wBAAwB,CAA6B;IAC7D,kCAAkC;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;gBAEZ,GAAG,EAAE,yBAAyB;IAe3D,OAAO,CAAC,wBAAwB;IAUhC,yEAAyE;IACzE,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IASvC,6DAA6D;IAC7D,OAAO,IAAI,IAAI;IAYf,OAAO,CAAC,aAAa;IAMrB;;;;;;OAMG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B1C,OAAO,CAAC,gBAAgB;IAiCxB,OAAO,CAAC,uBAAuB;IA+F/B,OAAO,CAAC,iBAAiB;YAwCX,oBAAoB;YAsBpB,uBAAuB;IAkCrC,OAAO,CAAC,mBAAmB;IAS3B;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,qBAAqB;CA2E7B"}
|