@quereus/quereus 0.7.2 → 0.7.4
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/package.json +3 -3
- package/dist/src/common/constants.js.map +0 -1
- package/dist/src/common/datatype.js.map +0 -1
- package/dist/src/common/errors.js.map +0 -1
- package/dist/src/common/json-types.js.map +0 -1
- package/dist/src/common/logger.js.map +0 -1
- package/dist/src/common/type-inference.js.map +0 -1
- package/dist/src/common/types.js.map +0 -1
- package/dist/src/core/database-options.js.map +0 -1
- package/dist/src/core/database.js.map +0 -1
- package/dist/src/core/param.js.map +0 -1
- package/dist/src/core/statement.js.map +0 -1
- package/dist/src/func/builtins/aggregate.js.map +0 -1
- package/dist/src/func/builtins/builtin-window-functions.js.map +0 -1
- package/dist/src/func/builtins/conversion.js.map +0 -1
- package/dist/src/func/builtins/datetime.js.map +0 -1
- package/dist/src/func/builtins/explain.js.map +0 -1
- package/dist/src/func/builtins/generation.js.map +0 -1
- package/dist/src/func/builtins/index.js.map +0 -1
- package/dist/src/func/builtins/json-helpers.js.map +0 -1
- package/dist/src/func/builtins/json-tvf.js.map +0 -1
- package/dist/src/func/builtins/json.js.map +0 -1
- package/dist/src/func/builtins/scalar.js.map +0 -1
- package/dist/src/func/builtins/schema.js.map +0 -1
- package/dist/src/func/builtins/string.js.map +0 -1
- package/dist/src/func/builtins/timespan.js.map +0 -1
- package/dist/src/func/context.js.map +0 -1
- package/dist/src/func/registration.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/parser/ast.js.map +0 -1
- package/dist/src/parser/index.js.map +0 -1
- package/dist/src/parser/lexer.js.map +0 -1
- package/dist/src/parser/parser.js.map +0 -1
- package/dist/src/parser/utils.js.map +0 -1
- package/dist/src/parser/visitor.js.map +0 -1
- package/dist/src/planner/analysis/binding-collector.js.map +0 -1
- package/dist/src/planner/analysis/const-evaluator.js.map +0 -1
- package/dist/src/planner/analysis/const-pass.js.map +0 -1
- package/dist/src/planner/analysis/constraint-extractor.js.map +0 -1
- package/dist/src/planner/analysis/predicate-normalizer.js.map +0 -1
- package/dist/src/planner/building/alter-table.js.map +0 -1
- package/dist/src/planner/building/block.js.map +0 -1
- package/dist/src/planner/building/constraint-builder.js.map +0 -1
- package/dist/src/planner/building/create-assertion.js.map +0 -1
- package/dist/src/planner/building/create-view.js.map +0 -1
- package/dist/src/planner/building/ddl.js.map +0 -1
- package/dist/src/planner/building/declare-schema.js.map +0 -1
- package/dist/src/planner/building/delete.js.map +0 -1
- package/dist/src/planner/building/drop-assertion.js.map +0 -1
- package/dist/src/planner/building/drop-table.js.map +0 -1
- package/dist/src/planner/building/drop-view.js.map +0 -1
- package/dist/src/planner/building/expression.js.map +0 -1
- package/dist/src/planner/building/function-call.js.map +0 -1
- package/dist/src/planner/building/insert.js.map +0 -1
- package/dist/src/planner/building/pragma.js.map +0 -1
- package/dist/src/planner/building/schema-resolution.js.map +0 -1
- package/dist/src/planner/building/select-aggregates.js.map +0 -1
- package/dist/src/planner/building/select-compound.js.map +0 -1
- package/dist/src/planner/building/select-context.js.map +0 -1
- package/dist/src/planner/building/select-modifiers.js.map +0 -1
- package/dist/src/planner/building/select-projections.js.map +0 -1
- package/dist/src/planner/building/select-window.js.map +0 -1
- package/dist/src/planner/building/select.js.map +0 -1
- package/dist/src/planner/building/table-function.js.map +0 -1
- package/dist/src/planner/building/table.js.map +0 -1
- package/dist/src/planner/building/transaction.js.map +0 -1
- package/dist/src/planner/building/update.js.map +0 -1
- package/dist/src/planner/building/with.js.map +0 -1
- package/dist/src/planner/cache/correlation-detector.js.map +0 -1
- package/dist/src/planner/cache/materialization-advisory.js.map +0 -1
- package/dist/src/planner/cache/reference-graph.js.map +0 -1
- package/dist/src/planner/cost/index.js.map +0 -1
- package/dist/src/planner/debug/logger-utils.js.map +0 -1
- package/dist/src/planner/debug.js.map +0 -1
- package/dist/src/planner/framework/characteristics.js.map +0 -1
- package/dist/src/planner/framework/context.js.map +0 -1
- package/dist/src/planner/framework/pass.js.map +0 -1
- package/dist/src/planner/framework/physical-utils.js.map +0 -1
- package/dist/src/planner/framework/registry.js.map +0 -1
- package/dist/src/planner/framework/trace.js.map +0 -1
- package/dist/src/planner/nodes/add-constraint-node.js.map +0 -1
- package/dist/src/planner/nodes/aggregate-function.js.map +0 -1
- package/dist/src/planner/nodes/aggregate-node.js.map +0 -1
- package/dist/src/planner/nodes/array-index-node.js.map +0 -1
- package/dist/src/planner/nodes/block.js.map +0 -1
- package/dist/src/planner/nodes/cache-node.js.map +0 -1
- package/dist/src/planner/nodes/constraint-check-node.js.map +0 -1
- package/dist/src/planner/nodes/create-assertion-node.js.map +0 -1
- package/dist/src/planner/nodes/create-index-node.js.map +0 -1
- package/dist/src/planner/nodes/create-table-node.js.map +0 -1
- package/dist/src/planner/nodes/create-view-node.js.map +0 -1
- package/dist/src/planner/nodes/cte-node.js.map +0 -1
- package/dist/src/planner/nodes/cte-reference-node.js.map +0 -1
- package/dist/src/planner/nodes/declarative-schema.js.map +0 -1
- package/dist/src/planner/nodes/delete-node.js.map +0 -1
- package/dist/src/planner/nodes/distinct-node.js.map +0 -1
- package/dist/src/planner/nodes/dml-executor-node.js.map +0 -1
- package/dist/src/planner/nodes/drop-assertion-node.js.map +0 -1
- package/dist/src/planner/nodes/drop-table-node.js.map +0 -1
- package/dist/src/planner/nodes/drop-view-node.js.map +0 -1
- package/dist/src/planner/nodes/filter.js.map +0 -1
- package/dist/src/planner/nodes/function.js.map +0 -1
- package/dist/src/planner/nodes/insert-node.js.map +0 -1
- package/dist/src/planner/nodes/internal-recursive-cte-ref-node.js.map +0 -1
- package/dist/src/planner/nodes/join-node.js.map +0 -1
- package/dist/src/planner/nodes/limit-offset.js.map +0 -1
- package/dist/src/planner/nodes/plan-node-type.js.map +0 -1
- package/dist/src/planner/nodes/plan-node.js.map +0 -1
- package/dist/src/planner/nodes/pragma.js.map +0 -1
- package/dist/src/planner/nodes/project-node.js.map +0 -1
- package/dist/src/planner/nodes/recursive-cte-node.js.map +0 -1
- package/dist/src/planner/nodes/reference.js.map +0 -1
- package/dist/src/planner/nodes/remote-query-node.js.map +0 -1
- package/dist/src/planner/nodes/retrieve-node.js.map +0 -1
- package/dist/src/planner/nodes/returning-node.js.map +0 -1
- package/dist/src/planner/nodes/scalar.js.map +0 -1
- package/dist/src/planner/nodes/sequencing-node.js.map +0 -1
- package/dist/src/planner/nodes/set-operation-node.js.map +0 -1
- package/dist/src/planner/nodes/single-row.js.map +0 -1
- package/dist/src/planner/nodes/sink-node.js.map +0 -1
- package/dist/src/planner/nodes/sort.js.map +0 -1
- package/dist/src/planner/nodes/stream-aggregate.js.map +0 -1
- package/dist/src/planner/nodes/subquery.js.map +0 -1
- package/dist/src/planner/nodes/table-access-nodes.js.map +0 -1
- package/dist/src/planner/nodes/table-function-call.js.map +0 -1
- package/dist/src/planner/nodes/transaction-node.js.map +0 -1
- package/dist/src/planner/nodes/update-node.js.map +0 -1
- package/dist/src/planner/nodes/values-node.js.map +0 -1
- package/dist/src/planner/nodes/view-reference-node.js.map +0 -1
- package/dist/src/planner/nodes/window-function.js.map +0 -1
- package/dist/src/planner/nodes/window-node.js.map +0 -1
- package/dist/src/planner/optimizer-tuning.js.map +0 -1
- package/dist/src/planner/optimizer.js.map +0 -1
- package/dist/src/planner/planning-context.js.map +0 -1
- package/dist/src/planner/resolve.js.map +0 -1
- package/dist/src/planner/rules/access/rule-select-access-path.js.map +0 -1
- package/dist/src/planner/rules/aggregate/rule-aggregate-streaming.js.map +0 -1
- package/dist/src/planner/rules/cache/rule-cte-optimization.js.map +0 -1
- package/dist/src/planner/rules/cache/rule-materialization-advisory.js.map +0 -1
- package/dist/src/planner/rules/cache/rule-mutating-subquery-cache.js.map +0 -1
- package/dist/src/planner/rules/join/rule-join-greedy-commute.js.map +0 -1
- package/dist/src/planner/rules/join/rule-join-key-inference.js.map +0 -1
- package/dist/src/planner/rules/join/rule-quickpick-enumeration.js.map +0 -1
- package/dist/src/planner/rules/predicate/rule-predicate-pushdown.js.map +0 -1
- package/dist/src/planner/rules/retrieve/rule-grow-retrieve.js.map +0 -1
- package/dist/src/planner/scopes/aliased.js.map +0 -1
- package/dist/src/planner/scopes/base.js.map +0 -1
- package/dist/src/planner/scopes/empty.js.map +0 -1
- package/dist/src/planner/scopes/global.js.map +0 -1
- package/dist/src/planner/scopes/multi.js.map +0 -1
- package/dist/src/planner/scopes/param.js.map +0 -1
- package/dist/src/planner/scopes/registered.js.map +0 -1
- package/dist/src/planner/scopes/scope.js.map +0 -1
- package/dist/src/planner/stats/basic-estimates.js.map +0 -1
- package/dist/src/planner/stats/index.js.map +0 -1
- package/dist/src/planner/type-utils.js.map +0 -1
- package/dist/src/planner/util/key-utils.js.map +0 -1
- package/dist/src/planner/validation/determinism-validator.js.map +0 -1
- package/dist/src/planner/validation/plan-validator.js.map +0 -1
- package/dist/src/runtime/async-util.js.map +0 -1
- package/dist/src/runtime/cache/shared-cache.js.map +0 -1
- package/dist/src/runtime/context-helpers.js.map +0 -1
- package/dist/src/runtime/deferred-constraint-queue.js.map +0 -1
- package/dist/src/runtime/emission-context.js.map +0 -1
- package/dist/src/runtime/emit/add-constraint.js.map +0 -1
- package/dist/src/runtime/emit/aggregate.js.map +0 -1
- package/dist/src/runtime/emit/array-index.js.map +0 -1
- package/dist/src/runtime/emit/between.js.map +0 -1
- package/dist/src/runtime/emit/binary.js.map +0 -1
- package/dist/src/runtime/emit/block.js.map +0 -1
- package/dist/src/runtime/emit/cache.js.map +0 -1
- package/dist/src/runtime/emit/case.js.map +0 -1
- package/dist/src/runtime/emit/cast.js.map +0 -1
- package/dist/src/runtime/emit/collate.js.map +0 -1
- package/dist/src/runtime/emit/column-reference.js.map +0 -1
- package/dist/src/runtime/emit/constraint-check.js.map +0 -1
- package/dist/src/runtime/emit/create-assertion.js.map +0 -1
- package/dist/src/runtime/emit/create-index.js.map +0 -1
- package/dist/src/runtime/emit/create-table.js.map +0 -1
- package/dist/src/runtime/emit/create-view.js.map +0 -1
- package/dist/src/runtime/emit/cte-reference.js.map +0 -1
- package/dist/src/runtime/emit/cte.js.map +0 -1
- package/dist/src/runtime/emit/delete.js.map +0 -1
- package/dist/src/runtime/emit/distinct.js.map +0 -1
- package/dist/src/runtime/emit/dml-executor.js.map +0 -1
- package/dist/src/runtime/emit/drop-assertion.js.map +0 -1
- package/dist/src/runtime/emit/drop-table.js.map +0 -1
- package/dist/src/runtime/emit/drop-view.js.map +0 -1
- package/dist/src/runtime/emit/filter.js.map +0 -1
- package/dist/src/runtime/emit/insert.js.map +0 -1
- package/dist/src/runtime/emit/internal-recursive-cte-ref.js.map +0 -1
- package/dist/src/runtime/emit/join.js.map +0 -1
- package/dist/src/runtime/emit/limit-offset.js.map +0 -1
- package/dist/src/runtime/emit/literal.js.map +0 -1
- package/dist/src/runtime/emit/parameter.js.map +0 -1
- package/dist/src/runtime/emit/pragma.js.map +0 -1
- package/dist/src/runtime/emit/project.js.map +0 -1
- package/dist/src/runtime/emit/recursive-cte.js.map +0 -1
- package/dist/src/runtime/emit/remote-query.js.map +0 -1
- package/dist/src/runtime/emit/retrieve.js.map +0 -1
- package/dist/src/runtime/emit/returning.js.map +0 -1
- package/dist/src/runtime/emit/scalar-function.js.map +0 -1
- package/dist/src/runtime/emit/scan.js.map +0 -1
- package/dist/src/runtime/emit/schema-declarative.js.map +0 -1
- package/dist/src/runtime/emit/sequencing.js.map +0 -1
- package/dist/src/runtime/emit/set-operation.js.map +0 -1
- package/dist/src/runtime/emit/sink.js.map +0 -1
- package/dist/src/runtime/emit/sort.js.map +0 -1
- package/dist/src/runtime/emit/subquery.js.map +0 -1
- package/dist/src/runtime/emit/table-valued-function.js.map +0 -1
- package/dist/src/runtime/emit/temporal-arithmetic.js.map +0 -1
- package/dist/src/runtime/emit/transaction.js.map +0 -1
- package/dist/src/runtime/emit/unary.js.map +0 -1
- package/dist/src/runtime/emit/update.js.map +0 -1
- package/dist/src/runtime/emit/values.js.map +0 -1
- package/dist/src/runtime/emit/window-function.js.map +0 -1
- package/dist/src/runtime/emit/window.js.map +0 -1
- package/dist/src/runtime/emitters.js.map +0 -1
- package/dist/src/runtime/register.js.map +0 -1
- package/dist/src/runtime/scheduler.js.map +0 -1
- package/dist/src/runtime/types.js.map +0 -1
- package/dist/src/runtime/utils.js.map +0 -1
- package/dist/src/schema/assertion.js.map +0 -1
- package/dist/src/schema/catalog.js.map +0 -1
- package/dist/src/schema/change-events.js.map +0 -1
- package/dist/src/schema/column.js.map +0 -1
- package/dist/src/schema/declared-schema-manager.js.map +0 -1
- package/dist/src/schema/function.js.map +0 -1
- package/dist/src/schema/manager.js.map +0 -1
- package/dist/src/schema/schema-differ.js.map +0 -1
- package/dist/src/schema/schema-hasher.js.map +0 -1
- package/dist/src/schema/schema.js.map +0 -1
- package/dist/src/schema/table.js.map +0 -1
- package/dist/src/schema/view.js.map +0 -1
- package/dist/src/schema/window-function.js.map +0 -1
- package/dist/src/types/builtin-types.js.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/types/json-type.js.map +0 -1
- package/dist/src/types/logical-type.js.map +0 -1
- package/dist/src/types/plugin-interface.js.map +0 -1
- package/dist/src/types/registry.js.map +0 -1
- package/dist/src/types/temporal-types.js.map +0 -1
- package/dist/src/types/validation.js.map +0 -1
- package/dist/src/util/affinity.js.map +0 -1
- package/dist/src/util/ast-stringify.js.map +0 -1
- package/dist/src/util/cached.js.map +0 -1
- package/dist/src/util/coercion.js.map +0 -1
- package/dist/src/util/comparison.js.map +0 -1
- package/dist/src/util/environment.js.map +0 -1
- package/dist/src/util/hash.js.map +0 -1
- package/dist/src/util/latches.js.map +0 -1
- package/dist/src/util/mutation-statement.js.map +0 -1
- package/dist/src/util/patterns.js.map +0 -1
- package/dist/src/util/plan-formatter.js.map +0 -1
- package/dist/src/util/plugin-helper.js.map +0 -1
- package/dist/src/util/row-descriptor.js.map +0 -1
- package/dist/src/util/serialization.js.map +0 -1
- package/dist/src/util/sql-literal.js.map +0 -1
- package/dist/src/util/working-table-iterable.js.map +0 -1
- package/dist/src/vtab/best-access-plan.js.map +0 -1
- package/dist/src/vtab/connection.js.map +0 -1
- package/dist/src/vtab/filter-info.js.map +0 -1
- package/dist/src/vtab/index-info.js.map +0 -1
- package/dist/src/vtab/manifest.js.map +0 -1
- package/dist/src/vtab/memory/connection.js.map +0 -1
- package/dist/src/vtab/memory/index.js.map +0 -1
- package/dist/src/vtab/memory/layer/base-cursor.js.map +0 -1
- package/dist/src/vtab/memory/layer/base.js.map +0 -1
- package/dist/src/vtab/memory/layer/connection.js.map +0 -1
- package/dist/src/vtab/memory/layer/interface.js.map +0 -1
- package/dist/src/vtab/memory/layer/manager.js.map +0 -1
- package/dist/src/vtab/memory/layer/safe-iterate.js.map +0 -1
- package/dist/src/vtab/memory/layer/scan-plan.js.map +0 -1
- package/dist/src/vtab/memory/layer/transaction-cursor.js.map +0 -1
- package/dist/src/vtab/memory/layer/transaction.js.map +0 -1
- package/dist/src/vtab/memory/module.js.map +0 -1
- package/dist/src/vtab/memory/table.js.map +0 -1
- package/dist/src/vtab/memory/types.js.map +0 -1
- package/dist/src/vtab/memory/utils/logging.js.map +0 -1
- package/dist/src/vtab/memory/utils/primary-key.js.map +0 -1
- package/dist/src/vtab/module.js.map +0 -1
- package/dist/src/vtab/table.js.map +0 -1
- package/src/common/constants.ts +0 -60
- package/src/common/datatype.ts +0 -85
- package/src/common/errors.ts +0 -189
- package/src/common/json-types.ts +0 -16
- package/src/common/logger.ts +0 -97
- package/src/common/type-inference.ts +0 -39
- package/src/common/types.ts +0 -151
- package/src/core/database-options.ts +0 -258
- package/src/core/database.ts +0 -1461
- package/src/core/param.ts +0 -56
- package/src/core/statement.ts +0 -528
- package/src/func/builtins/aggregate.ts +0 -269
- package/src/func/builtins/builtin-window-functions.ts +0 -166
- package/src/func/builtins/conversion.ts +0 -226
- package/src/func/builtins/datetime.ts +0 -500
- package/src/func/builtins/explain.ts +0 -779
- package/src/func/builtins/generation.ts +0 -43
- package/src/func/builtins/index.ts +0 -167
- package/src/func/builtins/json-helpers.ts +0 -237
- package/src/func/builtins/json-tvf.ts +0 -224
- package/src/func/builtins/json.ts +0 -588
- package/src/func/builtins/scalar.ts +0 -423
- package/src/func/builtins/schema.ts +0 -213
- package/src/func/builtins/string.ts +0 -306
- package/src/func/builtins/timespan.ts +0 -179
- package/src/func/context.ts +0 -258
- package/src/func/registration.ts +0 -201
- package/src/index.ts +0 -172
- package/src/parser/ast.ts +0 -581
- package/src/parser/index.ts +0 -65
- package/src/parser/lexer.ts +0 -806
- package/src/parser/parser.ts +0 -3352
- package/src/parser/utils.ts +0 -10
- package/src/parser/visitor.ts +0 -188
- package/src/planner/analysis/README.md +0 -93
- package/src/planner/analysis/binding-collector.ts +0 -83
- package/src/planner/analysis/const-evaluator.ts +0 -63
- package/src/planner/analysis/const-pass.ts +0 -282
- package/src/planner/analysis/constraint-extractor.ts +0 -764
- package/src/planner/analysis/predicate-normalizer.ts +0 -237
- package/src/planner/building/alter-table.ts +0 -49
- package/src/planner/building/block.ts +0 -93
- package/src/planner/building/constraint-builder.ts +0 -178
- package/src/planner/building/create-assertion.ts +0 -7
- package/src/planner/building/create-view.ts +0 -29
- package/src/planner/building/ddl.ts +0 -24
- package/src/planner/building/declare-schema.ts +0 -22
- package/src/planner/building/delete.ts +0 -218
- package/src/planner/building/drop-assertion.ts +0 -11
- package/src/planner/building/drop-table.ts +0 -13
- package/src/planner/building/drop-view.ts +0 -19
- package/src/planner/building/expression.ts +0 -205
- package/src/planner/building/function-call.ts +0 -129
- package/src/planner/building/insert.ts +0 -435
- package/src/planner/building/pragma.ts +0 -34
- package/src/planner/building/schema-resolution.ts +0 -176
- package/src/planner/building/select-aggregates.ts +0 -318
- package/src/planner/building/select-compound.ts +0 -119
- package/src/planner/building/select-context.ts +0 -85
- package/src/planner/building/select-modifiers.ts +0 -236
- package/src/planner/building/select-projections.ts +0 -177
- package/src/planner/building/select-window.ts +0 -259
- package/src/planner/building/select.ts +0 -567
- package/src/planner/building/table-function.ts +0 -49
- package/src/planner/building/table.ts +0 -40
- package/src/planner/building/transaction.ts +0 -23
- package/src/planner/building/update.ts +0 -331
- package/src/planner/building/with.ts +0 -180
- package/src/planner/cache/correlation-detector.ts +0 -83
- package/src/planner/cache/materialization-advisory.ts +0 -265
- package/src/planner/cache/reference-graph.ts +0 -196
- package/src/planner/cost/index.ts +0 -169
- package/src/planner/debug/logger-utils.ts +0 -68
- package/src/planner/debug.ts +0 -480
- package/src/planner/framework/README.md +0 -132
- package/src/planner/framework/characteristics.ts +0 -503
- package/src/planner/framework/context.ts +0 -239
- package/src/planner/framework/pass.ts +0 -354
- package/src/planner/framework/physical-utils.ts +0 -210
- package/src/planner/framework/registry.ts +0 -261
- package/src/planner/framework/trace.ts +0 -259
- package/src/planner/nodes/add-constraint-node.ts +0 -62
- package/src/planner/nodes/aggregate-function.ts +0 -155
- package/src/planner/nodes/aggregate-node.ts +0 -267
- package/src/planner/nodes/array-index-node.ts +0 -50
- package/src/planner/nodes/block.ts +0 -80
- package/src/planner/nodes/cache-node.ts +0 -103
- package/src/planner/nodes/constraint-check-node.ts +0 -138
- package/src/planner/nodes/create-assertion-node.ts +0 -51
- package/src/planner/nodes/create-index-node.ts +0 -41
- package/src/planner/nodes/create-table-node.ts +0 -35
- package/src/planner/nodes/create-view-node.ts +0 -44
- package/src/planner/nodes/cte-node.ts +0 -168
- package/src/planner/nodes/cte-reference-node.ts +0 -125
- package/src/planner/nodes/declarative-schema.ts +0 -221
- package/src/planner/nodes/delete-node.ts +0 -102
- package/src/planner/nodes/distinct-node.ts +0 -107
- package/src/planner/nodes/dml-executor-node.ts +0 -104
- package/src/planner/nodes/drop-assertion-node.ts +0 -50
- package/src/planner/nodes/drop-table-node.ts +0 -36
- package/src/planner/nodes/drop-view-node.ts +0 -37
- package/src/planner/nodes/filter.ts +0 -144
- package/src/planner/nodes/function.ts +0 -98
- package/src/planner/nodes/insert-node.ts +0 -126
- package/src/planner/nodes/internal-recursive-cte-ref-node.ts +0 -61
- package/src/planner/nodes/join-node.ts +0 -336
- package/src/planner/nodes/limit-offset.ts +0 -144
- package/src/planner/nodes/plan-node-type.ts +0 -95
- package/src/planner/nodes/plan-node.ts +0 -503
- package/src/planner/nodes/pragma.ts +0 -98
- package/src/planner/nodes/project-node.ts +0 -337
- package/src/planner/nodes/recursive-cte-node.ts +0 -158
- package/src/planner/nodes/reference.ts +0 -334
- package/src/planner/nodes/remote-query-node.ts +0 -73
- package/src/planner/nodes/retrieve-node.ts +0 -86
- package/src/planner/nodes/returning-node.ts +0 -269
- package/src/planner/nodes/scalar.ts +0 -772
- package/src/planner/nodes/sequencing-node.ts +0 -113
- package/src/planner/nodes/set-operation-node.ts +0 -87
- package/src/planner/nodes/single-row.ts +0 -85
- package/src/planner/nodes/sink-node.ts +0 -61
- package/src/planner/nodes/sort.ts +0 -166
- package/src/planner/nodes/stream-aggregate.ts +0 -293
- package/src/planner/nodes/subquery.ts +0 -268
- package/src/planner/nodes/table-access-nodes.ts +0 -323
- package/src/planner/nodes/table-function-call.ts +0 -134
- package/src/planner/nodes/transaction-node.ts +0 -55
- package/src/planner/nodes/update-node.ts +0 -138
- package/src/planner/nodes/values-node.ts +0 -244
- package/src/planner/nodes/view-reference-node.ts +0 -97
- package/src/planner/nodes/window-function.ts +0 -73
- package/src/planner/nodes/window-node.ts +0 -199
- package/src/planner/optimizer-tuning.ts +0 -105
- package/src/planner/optimizer.ts +0 -332
- package/src/planner/planning-context.ts +0 -190
- package/src/planner/resolve.ts +0 -101
- package/src/planner/rules/README.md +0 -96
- package/src/planner/rules/access/rule-select-access-path.ts +0 -399
- package/src/planner/rules/aggregate/rule-aggregate-streaming.ts +0 -162
- package/src/planner/rules/cache/rule-cte-optimization.ts +0 -79
- package/src/planner/rules/cache/rule-materialization-advisory.ts +0 -77
- package/src/planner/rules/cache/rule-mutating-subquery-cache.ts +0 -104
- package/src/planner/rules/join/rule-join-greedy-commute.ts +0 -48
- package/src/planner/rules/join/rule-join-key-inference.ts +0 -35
- package/src/planner/rules/join/rule-quickpick-enumeration.ts +0 -267
- package/src/planner/rules/predicate/rule-predicate-pushdown.ts +0 -144
- package/src/planner/rules/retrieve/rule-grow-retrieve.ts +0 -337
- package/src/planner/scopes/aliased.ts +0 -50
- package/src/planner/scopes/base.ts +0 -10
- package/src/planner/scopes/empty.ts +0 -12
- package/src/planner/scopes/global.ts +0 -73
- package/src/planner/scopes/multi.ts +0 -40
- package/src/planner/scopes/param.ts +0 -95
- package/src/planner/scopes/registered.ts +0 -67
- package/src/planner/scopes/scope.ts +0 -16
- package/src/planner/stats/basic-estimates.ts +0 -107
- package/src/planner/stats/index.ts +0 -158
- package/src/planner/type-utils.ts +0 -87
- package/src/planner/util/key-utils.ts +0 -46
- package/src/planner/validation/determinism-validator.ts +0 -104
- package/src/planner/validation/plan-validator.ts +0 -335
- package/src/runtime/async-util.ts +0 -283
- package/src/runtime/cache/shared-cache.ts +0 -169
- package/src/runtime/context-helpers.ts +0 -191
- package/src/runtime/deferred-constraint-queue.ts +0 -196
- package/src/runtime/emission-context.ts +0 -319
- package/src/runtime/emit/add-constraint.ts +0 -78
- package/src/runtime/emit/aggregate.ts +0 -581
- package/src/runtime/emit/array-index.ts +0 -25
- package/src/runtime/emit/between.ts +0 -51
- package/src/runtime/emit/binary.ts +0 -357
- package/src/runtime/emit/block.ts +0 -23
- package/src/runtime/emit/cache.ts +0 -64
- package/src/runtime/emit/case.ts +0 -87
- package/src/runtime/emit/cast.ts +0 -151
- package/src/runtime/emit/collate.ts +0 -9
- package/src/runtime/emit/column-reference.ts +0 -17
- package/src/runtime/emit/constraint-check.ts +0 -290
- package/src/runtime/emit/create-assertion.ts +0 -82
- package/src/runtime/emit/create-index.ts +0 -15
- package/src/runtime/emit/create-table.ts +0 -15
- package/src/runtime/emit/create-view.ts +0 -52
- package/src/runtime/emit/cte-reference.ts +0 -38
- package/src/runtime/emit/cte.ts +0 -39
- package/src/runtime/emit/delete.ts +0 -24
- package/src/runtime/emit/distinct.ts +0 -40
- package/src/runtime/emit/dml-executor.ts +0 -198
- package/src/runtime/emit/drop-assertion.ts +0 -45
- package/src/runtime/emit/drop-table.ts +0 -27
- package/src/runtime/emit/drop-view.ts +0 -49
- package/src/runtime/emit/filter.ts +0 -30
- package/src/runtime/emit/insert.ts +0 -42
- package/src/runtime/emit/internal-recursive-cte-ref.ts +0 -37
- package/src/runtime/emit/join.ts +0 -148
- package/src/runtime/emit/limit-offset.ts +0 -73
- package/src/runtime/emit/literal.ts +0 -17
- package/src/runtime/emit/parameter.ts +0 -59
- package/src/runtime/emit/pragma.ts +0 -56
- package/src/runtime/emit/project.ts +0 -46
- package/src/runtime/emit/recursive-cte.ts +0 -111
- package/src/runtime/emit/remote-query.ts +0 -47
- package/src/runtime/emit/retrieve.ts +0 -15
- package/src/runtime/emit/returning.ts +0 -41
- package/src/runtime/emit/scalar-function.ts +0 -69
- package/src/runtime/emit/scan.ts +0 -106
- package/src/runtime/emit/schema-declarative.ts +0 -215
- package/src/runtime/emit/sequencing.ts +0 -24
- package/src/runtime/emit/set-operation.ts +0 -141
- package/src/runtime/emit/sink.ts +0 -27
- package/src/runtime/emit/sort.ts +0 -75
- package/src/runtime/emit/subquery.ts +0 -203
- package/src/runtime/emit/table-valued-function.ts +0 -106
- package/src/runtime/emit/temporal-arithmetic.ts +0 -302
- package/src/runtime/emit/transaction.ts +0 -205
- package/src/runtime/emit/unary.ts +0 -101
- package/src/runtime/emit/update.ts +0 -66
- package/src/runtime/emit/values.ts +0 -66
- package/src/runtime/emit/window-function.ts +0 -42
- package/src/runtime/emit/window.ts +0 -458
- package/src/runtime/emitters.ts +0 -183
- package/src/runtime/register.ts +0 -150
- package/src/runtime/scheduler.ts +0 -488
- package/src/runtime/types.ts +0 -242
- package/src/runtime/utils.ts +0 -177
- package/src/schema/assertion.ts +0 -21
- package/src/schema/catalog.ts +0 -269
- package/src/schema/change-events.ts +0 -80
- package/src/schema/column.ts +0 -51
- package/src/schema/declared-schema-manager.ts +0 -82
- package/src/schema/function.ts +0 -188
- package/src/schema/manager.ts +0 -1034
- package/src/schema/schema-differ.ts +0 -214
- package/src/schema/schema-hasher.ts +0 -26
- package/src/schema/schema.ts +0 -222
- package/src/schema/table.ts +0 -409
- package/src/schema/view.ts +0 -19
- package/src/schema/window-function.ts +0 -56
- package/src/types/builtin-types.ts +0 -350
- package/src/types/index.ts +0 -17
- package/src/types/json-type.ts +0 -152
- package/src/types/logical-type.ts +0 -91
- package/src/types/plugin-interface.ts +0 -10
- package/src/types/registry.ts +0 -204
- package/src/types/temporal-types.ts +0 -290
- package/src/types/validation.ts +0 -120
- package/src/util/affinity.ts +0 -151
- package/src/util/ast-stringify.ts +0 -887
- package/src/util/cached.ts +0 -25
- package/src/util/coercion.ts +0 -113
- package/src/util/comparison.ts +0 -510
- package/src/util/environment.ts +0 -52
- package/src/util/hash.ts +0 -90
- package/src/util/latches.ts +0 -47
- package/src/util/mutation-statement.ts +0 -135
- package/src/util/patterns.ts +0 -56
- package/src/util/plan-formatter.ts +0 -48
- package/src/util/plugin-helper.ts +0 -110
- package/src/util/row-descriptor.ts +0 -105
- package/src/util/serialization.ts +0 -47
- package/src/util/sql-literal.ts +0 -22
- package/src/util/working-table-iterable.ts +0 -38
- package/src/vtab/best-access-plan.ts +0 -244
- package/src/vtab/connection.ts +0 -36
- package/src/vtab/filter-info.ts +0 -23
- package/src/vtab/index-info.ts +0 -84
- package/src/vtab/manifest.ts +0 -86
- package/src/vtab/memory/connection.ts +0 -73
- package/src/vtab/memory/index.ts +0 -191
- package/src/vtab/memory/layer/base-cursor.ts +0 -124
- package/src/vtab/memory/layer/base.ts +0 -275
- package/src/vtab/memory/layer/connection.ts +0 -203
- package/src/vtab/memory/layer/interface.ts +0 -47
- package/src/vtab/memory/layer/manager.ts +0 -909
- package/src/vtab/memory/layer/safe-iterate.ts +0 -49
- package/src/vtab/memory/layer/scan-plan.ts +0 -84
- package/src/vtab/memory/layer/transaction-cursor.ts +0 -162
- package/src/vtab/memory/layer/transaction.ts +0 -229
- package/src/vtab/memory/module.ts +0 -667
- package/src/vtab/memory/table.ts +0 -251
- package/src/vtab/memory/types.ts +0 -23
- package/src/vtab/memory/utils/logging.ts +0 -36
- package/src/vtab/memory/utils/primary-key.ts +0 -163
- package/src/vtab/module.ts +0 -162
- package/src/vtab/table.ts +0 -177
package/src/common/datatype.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { Expression } from "../parser/ast.js";
|
|
2
|
-
import type { DeepReadonly } from "./types.js";
|
|
3
|
-
import type { LogicalType } from "../types/logical-type.js";
|
|
4
|
-
|
|
5
|
-
export type TypeClass = 'scalar' | 'relation' | 'list' | 'void';
|
|
6
|
-
|
|
7
|
-
export type BaseType = DeepReadonly<{
|
|
8
|
-
typeClass: TypeClass;
|
|
9
|
-
}>
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Type information for scalar values.
|
|
13
|
-
* This is used to determine the type of a scalar value, e.g., for a column reference or a literal.
|
|
14
|
-
*/
|
|
15
|
-
export type ScalarType = DeepReadonly<BaseType & {
|
|
16
|
-
typeClass: 'scalar';
|
|
17
|
-
/** The logical type defining semantics and behavior */
|
|
18
|
-
logicalType: LogicalType;
|
|
19
|
-
/** The optional collation name of the scalar value. */
|
|
20
|
-
collationName?: string;
|
|
21
|
-
/** If nullable, null values are allowed and may be encountered in inference contexts too. */
|
|
22
|
-
nullable: boolean;
|
|
23
|
-
/** Indicates that it is inferred const, computed, or otherwise immutable. Missing assumes false. */
|
|
24
|
-
isReadOnly?: boolean;
|
|
25
|
-
/** TODO: Based on integrity constraints, in some cases we can know of further restrictions on the set of values, which may enabled certain optimizations. */
|
|
26
|
-
//constraints?: ReadonlyArray<ColumnConstraint>;
|
|
27
|
-
}>
|
|
28
|
-
|
|
29
|
-
export type ColumnDef = {
|
|
30
|
-
name: string;
|
|
31
|
-
type: ScalarType;
|
|
32
|
-
/** The optional default value for the column. */
|
|
33
|
-
default?: Expression;
|
|
34
|
-
/** If true, the column is generated, not stored. Absent = false. */
|
|
35
|
-
generated?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type ColRef = {
|
|
39
|
-
index: number;
|
|
40
|
-
/** If true, the column is sorted in descending order. Absent = false. */
|
|
41
|
-
desc?: boolean;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Type information for relations.
|
|
45
|
-
* This is used to determine the type of a relation, e.g., for a table or a subquery.
|
|
46
|
-
* Foreign keys and externally referencing constraints are not part of the relation type as they are essentially database level.
|
|
47
|
-
*/
|
|
48
|
-
export type RelationType = DeepReadonly<BaseType & {
|
|
49
|
-
typeClass: 'relation';
|
|
50
|
-
isReadOnly: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* If true, this relation is guaranteed to be a set (no duplicate rows).
|
|
53
|
-
* If false, this relation could be a bag (duplicate rows possible).
|
|
54
|
-
* This affects how certain operations (like sorting) handle the data.
|
|
55
|
-
*/
|
|
56
|
-
isSet: boolean;
|
|
57
|
-
columns: ColumnDef[];
|
|
58
|
-
/** The unique keys of the relation (the primary key is arbitrarily the first one).
|
|
59
|
-
* Note that these may or may not be supported by indexes (normally they are), but by definition are unique.
|
|
60
|
-
* An empty key means the relation can have exactly 0 or 1 rows (TableDum and TableDee respectively).
|
|
61
|
-
*/
|
|
62
|
-
keys: ColRef[][];
|
|
63
|
-
/** The row constraints of the relation - limited to the relation itself. */
|
|
64
|
-
rowConstraints: { name?: string, expr: Expression }[];
|
|
65
|
-
}>
|
|
66
|
-
|
|
67
|
-
export type ListType = DeepReadonly<BaseType & {
|
|
68
|
-
typeClass: 'list';
|
|
69
|
-
}>
|
|
70
|
-
|
|
71
|
-
export type VoidType = DeepReadonly<BaseType & {
|
|
72
|
-
typeClass: 'void';
|
|
73
|
-
}>
|
|
74
|
-
|
|
75
|
-
export function isRelationType(type: BaseType): type is RelationType {
|
|
76
|
-
return type.typeClass === 'relation';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function isScalarType(type: BaseType): type is ScalarType {
|
|
80
|
-
return type.typeClass === 'scalar';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function isListType(type: BaseType): type is ListType {
|
|
84
|
-
return type.typeClass === 'list';
|
|
85
|
-
}
|
package/src/common/errors.ts
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import { StatusCode } from './types.js';
|
|
2
|
-
import type { Token } from '../parser/lexer.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Base class for Quereus specific errors
|
|
6
|
-
* Provides location information and status code support
|
|
7
|
-
*/
|
|
8
|
-
export class QuereusError extends Error {
|
|
9
|
-
public code: number;
|
|
10
|
-
public cause?: Error;
|
|
11
|
-
public line?: number;
|
|
12
|
-
public column?: number;
|
|
13
|
-
|
|
14
|
-
constructor(message: string, code: number = StatusCode.ERROR, cause?: Error, line?: number, column?: number) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.code = code;
|
|
17
|
-
this.name = 'QuereusError';
|
|
18
|
-
this.cause = cause;
|
|
19
|
-
this.line = line;
|
|
20
|
-
this.column = column;
|
|
21
|
-
|
|
22
|
-
// Enhance message with location if available
|
|
23
|
-
if (line !== undefined && column !== undefined) {
|
|
24
|
-
this.message = `${message} (at line ${line}, column ${column})`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Maintain stack trace in V8
|
|
28
|
-
if (Error.captureStackTrace) {
|
|
29
|
-
Error.captureStackTrace(this, QuereusError);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Parser-specific error that includes token information
|
|
36
|
-
* Used during SQL parsing to provide precise error locations
|
|
37
|
-
*/
|
|
38
|
-
export class ParseError extends QuereusError {
|
|
39
|
-
public token: Token;
|
|
40
|
-
|
|
41
|
-
constructor(message: string, token: Token) {
|
|
42
|
-
super(message, StatusCode.ERROR, undefined, token.startLine, token.startColumn);
|
|
43
|
-
this.token = token;
|
|
44
|
-
this.name = 'ParseError';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Error thrown when a database constraint is violated
|
|
50
|
-
*/
|
|
51
|
-
export class ConstraintError extends QuereusError {
|
|
52
|
-
constructor(message: string, code: number = StatusCode.CONSTRAINT) {
|
|
53
|
-
super(message, code);
|
|
54
|
-
this.name = 'ConstraintError';
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Error thrown for SQL syntax issues
|
|
60
|
-
*/
|
|
61
|
-
export class SyntaxError extends QuereusError {
|
|
62
|
-
constructor(message: string = "SQL syntax error") {
|
|
63
|
-
super(message, StatusCode.ERROR);
|
|
64
|
-
this.name = 'SyntaxError';
|
|
65
|
-
Object.setPrototypeOf(this, SyntaxError.prototype);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Error thrown when the API is used incorrectly
|
|
71
|
-
*/
|
|
72
|
-
export class MisuseError extends QuereusError {
|
|
73
|
-
constructor(message: string = "API misuse") {
|
|
74
|
-
super(message, StatusCode.MISUSE);
|
|
75
|
-
this.name = 'MisuseError';
|
|
76
|
-
Object.setPrototypeOf(this, MisuseError.prototype);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Helper function to throw a QuereusError with optional location information from AST nodes
|
|
82
|
-
* @param message Error message
|
|
83
|
-
* @param code Status code (defaults to ERROR)
|
|
84
|
-
* @param cause Optional underlying error
|
|
85
|
-
* @param astNode Optional AST node or object with location information
|
|
86
|
-
* @returns Never (always throws)
|
|
87
|
-
*/
|
|
88
|
-
export function quereusError(
|
|
89
|
-
message: string,
|
|
90
|
-
code: StatusCode = StatusCode.ERROR,
|
|
91
|
-
cause?: Error,
|
|
92
|
-
astNode?: { loc?: { start: { line: number; column: number }, end?: { line: number; column: number } } }
|
|
93
|
-
): never {
|
|
94
|
-
throw new QuereusError(
|
|
95
|
-
message,
|
|
96
|
-
code,
|
|
97
|
-
cause,
|
|
98
|
-
astNode?.loc?.start.line,
|
|
99
|
-
astNode?.loc?.start.column
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Information about an error in the error chain
|
|
105
|
-
*/
|
|
106
|
-
export interface ErrorInfo {
|
|
107
|
-
message: string;
|
|
108
|
-
code?: number;
|
|
109
|
-
line?: number;
|
|
110
|
-
column?: number;
|
|
111
|
-
name: string;
|
|
112
|
-
stack?: string;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Recursively unwraps a QuereusError (or any Error) and its causes
|
|
117
|
-
* @param error The error to unwrap
|
|
118
|
-
* @returns Array of ErrorInfo objects, with the root error first
|
|
119
|
-
*/
|
|
120
|
-
export function unwrapError(error: Error): ErrorInfo[] {
|
|
121
|
-
const errorChain: ErrorInfo[] = [];
|
|
122
|
-
let currentError: Error | undefined = error;
|
|
123
|
-
|
|
124
|
-
while (currentError) {
|
|
125
|
-
const errorInfo: ErrorInfo = {
|
|
126
|
-
message: currentError.message,
|
|
127
|
-
name: currentError.name,
|
|
128
|
-
stack: currentError.stack,
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// Add QuereusError-specific fields if available
|
|
132
|
-
if (currentError instanceof QuereusError) {
|
|
133
|
-
errorInfo.code = currentError.code;
|
|
134
|
-
errorInfo.line = currentError.line;
|
|
135
|
-
errorInfo.column = currentError.column;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
errorChain.push(errorInfo);
|
|
139
|
-
|
|
140
|
-
// Move to the next error in the chain
|
|
141
|
-
currentError = (currentError as Error & { cause?: Error }).cause;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return errorChain;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Formats an error chain for display
|
|
149
|
-
* @param errorChain Array of ErrorInfo objects
|
|
150
|
-
* @param includeStack Whether to include stack traces
|
|
151
|
-
* @returns Formatted error message
|
|
152
|
-
*/
|
|
153
|
-
export function formatErrorChain(errorChain: ErrorInfo[], includeStack: boolean = false): string {
|
|
154
|
-
if (errorChain.length === 0) {
|
|
155
|
-
return 'Unknown error';
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const lines: string[] = [];
|
|
159
|
-
|
|
160
|
-
errorChain.forEach((errorInfo, index) => {
|
|
161
|
-
const prefix = index === 0 ? 'Error' : `Caused by`;
|
|
162
|
-
let line = `${prefix}: ${errorInfo.message}`;
|
|
163
|
-
|
|
164
|
-
if (errorInfo.line !== undefined && errorInfo.column !== undefined) {
|
|
165
|
-
line += ` (at line ${errorInfo.line}, column ${errorInfo.column})`;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
lines.push(line);
|
|
169
|
-
|
|
170
|
-
if (includeStack && errorInfo.stack) {
|
|
171
|
-
lines.push(errorInfo.stack);
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
return lines.join('\n');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Gets the primary error info (the first error in the chain)
|
|
180
|
-
* @param error The error to analyze
|
|
181
|
-
* @returns ErrorInfo for the primary error
|
|
182
|
-
*/
|
|
183
|
-
export function getPrimaryError(error: Error): ErrorInfo {
|
|
184
|
-
const chain = unwrapError(error);
|
|
185
|
-
return chain[0] || {
|
|
186
|
-
message: 'Unknown error',
|
|
187
|
-
name: 'Error',
|
|
188
|
-
};
|
|
189
|
-
}
|
package/src/common/json-types.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/**
|
|
3
|
-
* Represents a JSON-compatible value structure
|
|
4
|
-
*
|
|
5
|
-
* This type represents the valid JSON value space that can result from
|
|
6
|
-
* JSON.parse() or be passed to JSON.stringify(). It excludes JavaScript
|
|
7
|
-
* values that cannot be represented in JSON (undefined, functions, symbols, etc.)
|
|
8
|
-
*/
|
|
9
|
-
export type JSONValue =
|
|
10
|
-
| string
|
|
11
|
-
| number
|
|
12
|
-
| boolean
|
|
13
|
-
| null
|
|
14
|
-
| JSONValue[]
|
|
15
|
-
| { [key: string]: JSONValue };
|
|
16
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
package/src/common/logger.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import debug from 'debug';
|
|
2
|
-
|
|
3
|
-
// Base namespace for the project
|
|
4
|
-
const BASE_NAMESPACE = 'quereus';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Creates a namespaced debug logger instance.
|
|
8
|
-
*
|
|
9
|
-
* Example: createLogger('compiler') -> returns a debugger for 'quereus:compiler'
|
|
10
|
-
* Example: createLogger('vtab:memory') -> returns a debugger for 'quereus:vtab:memory'
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* const log = createLogger('compiler');
|
|
14
|
-
* log('Compiling statement: %s', sql);
|
|
15
|
-
* const errorLog = log.extend('error'); // Creates 'quereus:compiler:error'
|
|
16
|
-
* errorLog('Compilation failed: %O', error);
|
|
17
|
-
*
|
|
18
|
-
* @param subNamespace The specific subsystem namespace (e.g., 'parser', 'vdbe:runtime', 'vtab:memory')
|
|
19
|
-
* @returns A debug instance.
|
|
20
|
-
*/
|
|
21
|
-
export function createLogger(subNamespace: string): debug.Debugger {
|
|
22
|
-
return debug(`${BASE_NAMESPACE}:${subNamespace}`);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Enable Quereus debug logging programmatically.
|
|
27
|
-
*
|
|
28
|
-
* This is particularly useful in environments like React Native where
|
|
29
|
-
* environment variables are not available at runtime.
|
|
30
|
-
*
|
|
31
|
-
* @param pattern - Debug pattern to enable (default: 'quereus:*')
|
|
32
|
-
* Examples:
|
|
33
|
-
* - 'quereus:*' - all Quereus logs
|
|
34
|
-
* - 'quereus:vtab:*' - virtual table operations
|
|
35
|
-
* - 'quereus:vtab:memory' - memory table operations only
|
|
36
|
-
* - 'quereus:planner' - query planner logs
|
|
37
|
-
* - 'quereus:runtime' - VDBE execution (very verbose)
|
|
38
|
-
* - 'quereus:*,-quereus:runtime' - all except verbose runtime
|
|
39
|
-
* @param logFn - Optional custom log function. Defaults to console.log.
|
|
40
|
-
* Useful in environments where console.debug may be filtered.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* import { enableLogging } from '@quereus/quereus';
|
|
45
|
-
*
|
|
46
|
-
* // Enable all Quereus logs
|
|
47
|
-
* enableLogging();
|
|
48
|
-
*
|
|
49
|
-
* // Enable only memory table logs
|
|
50
|
-
* enableLogging('quereus:vtab:memory');
|
|
51
|
-
*
|
|
52
|
-
* // Enable all logs with custom output (e.g., React Native)
|
|
53
|
-
* enableLogging('quereus:*', console.log.bind(console));
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export function enableLogging(
|
|
57
|
-
pattern: string = `${BASE_NAMESPACE}:*`,
|
|
58
|
-
logFn?: (...args: unknown[]) => void
|
|
59
|
-
): void {
|
|
60
|
-
if (logFn) {
|
|
61
|
-
debug.log = logFn;
|
|
62
|
-
}
|
|
63
|
-
debug.enable(pattern);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Disable all Quereus debug logging.
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* import { disableLogging } from '@quereus/quereus';
|
|
72
|
-
*
|
|
73
|
-
* disableLogging();
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
export function disableLogging(): void {
|
|
77
|
-
debug.disable();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Check if logging is enabled for a specific namespace.
|
|
82
|
-
*
|
|
83
|
-
* @param namespace - The namespace to check (without 'quereus:' prefix)
|
|
84
|
-
* @returns true if logging is enabled for this namespace
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* import { isLoggingEnabled } from '@quereus/quereus';
|
|
89
|
-
*
|
|
90
|
-
* if (isLoggingEnabled('vtab:memory')) {
|
|
91
|
-
* // Perform expensive debug operations
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
export function isLoggingEnabled(namespace: string): boolean {
|
|
96
|
-
return debug.enabled(`${BASE_NAMESPACE}:${namespace}`);
|
|
97
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { SqlDataType, type SqlValue } from "./types.js";
|
|
2
|
-
import type { LogicalType } from "../types/logical-type.js";
|
|
3
|
-
import { NULL_TYPE, INTEGER_TYPE, REAL_TYPE, TEXT_TYPE, BLOB_TYPE, BOOLEAN_TYPE } from "../types/builtin-types.js";
|
|
4
|
-
|
|
5
|
-
export function getLiteralSqlType(v: SqlValue): SqlDataType {
|
|
6
|
-
if (v === null) return SqlDataType.NULL;
|
|
7
|
-
if (typeof v === 'number') {
|
|
8
|
-
if (Number.isInteger(v)) return SqlDataType.INTEGER;
|
|
9
|
-
return SqlDataType.REAL;
|
|
10
|
-
}
|
|
11
|
-
if (typeof v === 'bigint') return SqlDataType.INTEGER;
|
|
12
|
-
if (typeof v === 'string') return SqlDataType.TEXT;
|
|
13
|
-
if (v instanceof Uint8Array) return SqlDataType.BLOB;
|
|
14
|
-
return SqlDataType.BLOB;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Infer LogicalType from a SqlValue for parameters.
|
|
19
|
-
* Uses JavaScript type to determine the logical type:
|
|
20
|
-
* - null → NULL
|
|
21
|
-
* - number (integer) → INTEGER
|
|
22
|
-
* - number (float) → REAL
|
|
23
|
-
* - bigint → INTEGER
|
|
24
|
-
* - boolean → BOOLEAN
|
|
25
|
-
* - string → TEXT
|
|
26
|
-
* - Uint8Array → BLOB
|
|
27
|
-
*/
|
|
28
|
-
export function inferLogicalTypeFromValue(v: SqlValue): LogicalType {
|
|
29
|
-
if (v === null) return NULL_TYPE;
|
|
30
|
-
if (typeof v === 'number') {
|
|
31
|
-
// Distinguish INTEGER from REAL based on Number.isInteger()
|
|
32
|
-
return Number.isInteger(v) ? INTEGER_TYPE : REAL_TYPE;
|
|
33
|
-
}
|
|
34
|
-
if (typeof v === 'bigint') return INTEGER_TYPE;
|
|
35
|
-
if (typeof v === 'boolean') return BOOLEAN_TYPE;
|
|
36
|
-
if (typeof v === 'string') return TEXT_TYPE;
|
|
37
|
-
if (v instanceof Uint8Array) return BLOB_TYPE;
|
|
38
|
-
return BLOB_TYPE;
|
|
39
|
-
}
|
package/src/common/types.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type { RuntimeContext } from '../runtime/types.js';
|
|
2
|
-
|
|
3
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
4
|
-
|
|
5
|
-
export type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> };
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Represents the primitive scalar types Quereus can handle internally in this implementation.
|
|
9
|
-
* These are the values that can be stored in Quereus columns and passed as parameters.
|
|
10
|
-
*/
|
|
11
|
-
export type SqlValue = string | number | bigint | boolean | Uint8Array | null;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Represents a row of data, which is an array of SqlValue.
|
|
15
|
-
*/
|
|
16
|
-
export type Row = SqlValue[];
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Represents a value that can be expected as an input in the runtime environment.
|
|
20
|
-
* This type can be a scalar value, or an async iterable of rows (cursor).
|
|
21
|
-
*/
|
|
22
|
-
export type RuntimeValue = SqlValue | Row | AsyncIterable<Row> | ((ctx: RuntimeContext) => OutputValue)
|
|
23
|
-
|
|
24
|
-
/** Represents a value that can be output from an instruction or program. */
|
|
25
|
-
export type OutputValue = MaybePromise<RuntimeValue>;
|
|
26
|
-
|
|
27
|
-
export type SqlParameters = Record<string, SqlValue> | SqlValue[];
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Standard status/error codes that significantly match SQLite.
|
|
31
|
-
* Used for error handling and determining operation results.
|
|
32
|
-
*/
|
|
33
|
-
export enum StatusCode {
|
|
34
|
-
OK = 0,
|
|
35
|
-
ERROR = 1,
|
|
36
|
-
INTERNAL = 2,
|
|
37
|
-
PERM = 3,
|
|
38
|
-
ABORT = 4,
|
|
39
|
-
BUSY = 5,
|
|
40
|
-
LOCKED = 6,
|
|
41
|
-
NOMEM = 7,
|
|
42
|
-
READONLY = 8,
|
|
43
|
-
INTERRUPT = 9,
|
|
44
|
-
IOERR = 10,
|
|
45
|
-
CORRUPT = 11,
|
|
46
|
-
NOTFOUND = 12,
|
|
47
|
-
FULL = 13,
|
|
48
|
-
CANTOPEN = 14,
|
|
49
|
-
PROTOCOL = 15,
|
|
50
|
-
EMPTY = 16,
|
|
51
|
-
SCHEMA = 17,
|
|
52
|
-
TOOBIG = 18,
|
|
53
|
-
CONSTRAINT = 19,
|
|
54
|
-
MISMATCH = 20,
|
|
55
|
-
MISUSE = 21,
|
|
56
|
-
NOLFS = 22,
|
|
57
|
-
AUTH = 23,
|
|
58
|
-
FORMAT = 24,
|
|
59
|
-
RANGE = 25,
|
|
60
|
-
NOTADB = 26,
|
|
61
|
-
NOTICE = 27,
|
|
62
|
-
WARNING = 28,
|
|
63
|
-
SYNTAX = 29,
|
|
64
|
-
UNSUPPORTED = 30,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Fundamental SQLite compatible datatypes/affinity types.
|
|
69
|
-
* These determine how values are stored and compared within the database.
|
|
70
|
-
*/
|
|
71
|
-
export enum SqlDataType {
|
|
72
|
-
NULL = 0,
|
|
73
|
-
INTEGER = 1,
|
|
74
|
-
REAL = 2,
|
|
75
|
-
TEXT = 3,
|
|
76
|
-
BLOB = 4,
|
|
77
|
-
NUMERIC = 6, // For DECIMAL, NUMERIC with precision/scale
|
|
78
|
-
BOOLEAN = 7, // For explicit BOOLEAN columns (future, not standard SQLite)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export type CompareFn = (a: SqlValue, b: SqlValue) => number;
|
|
82
|
-
|
|
83
|
-
export interface DatabaseInfo {
|
|
84
|
-
path: string | ':memory:';
|
|
85
|
-
isOpen: boolean;
|
|
86
|
-
isReadonly: boolean;
|
|
87
|
-
inTransaction: boolean;
|
|
88
|
-
name: string;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Shared configuration object that can be used by multiple databases
|
|
93
|
-
*/
|
|
94
|
-
export interface DatabaseConfig {
|
|
95
|
-
/**
|
|
96
|
-
* Open the database in read-only mode
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
readonly?: boolean;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Register default functions
|
|
103
|
-
* @default true
|
|
104
|
-
*/
|
|
105
|
-
registerDefaultFunctions?: boolean;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Maximum number of retries when opening the database
|
|
109
|
-
* @default 3
|
|
110
|
-
*/
|
|
111
|
-
maxRetries?: number;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Enable WAL mode (Write-Ahead Logging)
|
|
115
|
-
* @default true for file databases, false for in-memory
|
|
116
|
-
*/
|
|
117
|
-
enableWAL?: boolean;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Synchronous setting ('OFF' | 'NORMAL' | 'FULL' | 'EXTRA')
|
|
121
|
-
* @default 'NORMAL' with WAL, 'FULL' without WAL
|
|
122
|
-
*/
|
|
123
|
-
synchronous?: 'OFF' | 'NORMAL' | 'FULL' | 'EXTRA';
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Journal mode ('DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY' | 'WAL' | 'OFF')
|
|
127
|
-
* @default 'WAL' if enableWAL is true, 'DELETE' otherwise
|
|
128
|
-
*/
|
|
129
|
-
journalMode?: 'DELETE' | 'TRUNCATE' | 'PERSIST' | 'MEMORY' | 'WAL' | 'OFF';
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Cache size in pages (negative value = KB)
|
|
133
|
-
* @default -2048 (2MB)
|
|
134
|
-
*/
|
|
135
|
-
cacheSize?: number;
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Page size in bytes (must be power of 2, 512-65536)
|
|
139
|
-
* @default 4096
|
|
140
|
-
*/
|
|
141
|
-
pageSize?: number;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Foreign key constraint enforcement
|
|
145
|
-
* @default true
|
|
146
|
-
*/
|
|
147
|
-
foreignKeys?: boolean;
|
|
148
|
-
}
|
|
149
|
-
export type RowOp = 'insert' | 'update' | 'delete';
|
|
150
|
-
|
|
151
|
-
export type { JSONValue } from './json-types.js';
|