noormme 1.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/LICENSE +21 -0
- package/README.md +727 -0
- package/dist/cjs/cache/cache-manager.d.ts +76 -0
- package/dist/cjs/cache/cache-manager.js +169 -0
- package/dist/cjs/cli/commands/analyze.d.ts +7 -0
- package/dist/cjs/cli/commands/analyze.js +132 -0
- package/dist/cjs/cli/commands/generate.d.ts +7 -0
- package/dist/cjs/cli/commands/generate.js +514 -0
- package/dist/cjs/cli/commands/init.d.ts +7 -0
- package/dist/cjs/cli/commands/init.js +470 -0
- package/dist/cjs/cli/commands/inspect.d.ts +7 -0
- package/dist/cjs/cli/commands/inspect.js +365 -0
- package/dist/cjs/cli/commands/migrate.d.ts +8 -0
- package/dist/cjs/cli/commands/migrate.js +218 -0
- package/dist/cjs/cli/commands/optimize.d.ts +8 -0
- package/dist/cjs/cli/commands/optimize.js +156 -0
- package/dist/cjs/cli/commands/status.d.ts +6 -0
- package/dist/cjs/cli/commands/status.js +267 -0
- package/dist/cjs/cli/commands/watch.d.ts +7 -0
- package/dist/cjs/cli/commands/watch.js +216 -0
- package/dist/cjs/cli/index.d.ts +2 -0
- package/dist/cjs/cli/index.js +157 -0
- package/dist/cjs/dialect/database-introspector.d.ts +61 -0
- package/dist/cjs/dialect/database-introspector.js +85 -0
- package/dist/cjs/dialect/dialect-adapter-base.d.ts +94 -0
- package/dist/cjs/dialect/dialect-adapter-base.js +24 -0
- package/dist/cjs/dialect/dialect-adapter.d.ts +115 -0
- package/dist/cjs/dialect/dialect-adapter.js +2 -0
- package/dist/cjs/dialect/dialect.d.ts +34 -0
- package/dist/cjs/dialect/dialect.js +2 -0
- package/dist/cjs/dialect/sqlite/sqlite-adapter.d.ts +80 -0
- package/dist/cjs/dialect/sqlite/sqlite-adapter.js +23 -0
- package/dist/cjs/dialect/sqlite/sqlite-auto-indexer.d.ts +181 -0
- package/dist/cjs/dialect/sqlite/sqlite-auto-indexer.js +541 -0
- package/dist/cjs/dialect/sqlite/sqlite-auto-optimizer.d.ts +102 -0
- package/dist/cjs/dialect/sqlite/sqlite-auto-optimizer.js +373 -0
- package/dist/cjs/dialect/sqlite/sqlite-dialect-config.d.ts +41 -0
- package/dist/cjs/dialect/sqlite/sqlite-dialect-config.js +2 -0
- package/dist/cjs/dialect/sqlite/sqlite-dialect.d.ts +55 -0
- package/dist/cjs/dialect/sqlite/sqlite-dialect.js +51 -0
- package/dist/cjs/dialect/sqlite/sqlite-driver.d.ts +42 -0
- package/dist/cjs/dialect/sqlite/sqlite-driver.js +152 -0
- package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +36 -0
- package/dist/cjs/dialect/sqlite/sqlite-introspector.js +236 -0
- package/dist/cjs/dialect/sqlite/sqlite-query-compiler.d.ts +16 -0
- package/dist/cjs/dialect/sqlite/sqlite-query-compiler.js +43 -0
- package/dist/cjs/driver/connection-provider.d.ts +8 -0
- package/dist/cjs/driver/connection-provider.js +2 -0
- package/dist/cjs/driver/database-connection.d.ts +35 -0
- package/dist/cjs/driver/database-connection.js +2 -0
- package/dist/cjs/driver/default-connection-provider.d.ts +12 -0
- package/dist/cjs/driver/default-connection-provider.js +19 -0
- package/dist/cjs/driver/driver.d.ts +61 -0
- package/dist/cjs/driver/driver.js +22 -0
- package/dist/cjs/driver/dummy-driver.d.ts +75 -0
- package/dist/cjs/driver/dummy-driver.js +83 -0
- package/dist/cjs/driver/runtime-driver.d.ts +47 -0
- package/dist/cjs/driver/runtime-driver.js +165 -0
- package/dist/cjs/driver/single-connection-provider.d.ts +11 -0
- package/dist/cjs/driver/single-connection-provider.js +29 -0
- package/dist/cjs/dynamic/dynamic-reference-builder.d.ts +18 -0
- package/dist/cjs/dynamic/dynamic-reference-builder.js +36 -0
- package/dist/cjs/dynamic/dynamic-table-builder.d.ts +16 -0
- package/dist/cjs/dynamic/dynamic-table-builder.js +46 -0
- package/dist/cjs/dynamic/dynamic.d.ts +124 -0
- package/dist/cjs/dynamic/dynamic.js +132 -0
- package/dist/cjs/errors/NoormError.d.ts +56 -0
- package/dist/cjs/errors/NoormError.js +158 -0
- package/dist/cjs/expression/expression-builder.d.ts +920 -0
- package/dist/cjs/expression/expression-builder.js +128 -0
- package/dist/cjs/expression/expression-wrapper.d.ts +631 -0
- package/dist/cjs/expression/expression-wrapper.js +134 -0
- package/dist/cjs/expression/expression.d.ts +198 -0
- package/dist/cjs/expression/expression.js +15 -0
- package/dist/cjs/helpers/sqlite.d.ts +189 -0
- package/dist/cjs/helpers/sqlite.js +204 -0
- package/dist/cjs/index.d.ts +211 -0
- package/dist/cjs/index.js +223 -0
- package/dist/cjs/kysely.d.ts +848 -0
- package/dist/cjs/kysely.js +924 -0
- package/dist/cjs/logging/logger.d.ts +96 -0
- package/dist/cjs/logging/logger.js +179 -0
- package/dist/cjs/noormme.d.ts +137 -0
- package/dist/cjs/noormme.js +521 -0
- package/dist/cjs/operation-node/add-column-node.d.ts +13 -0
- package/dist/cjs/operation-node/add-column-node.js +18 -0
- package/dist/cjs/operation-node/add-constraint-node.d.ts +13 -0
- package/dist/cjs/operation-node/add-constraint-node.js +18 -0
- package/dist/cjs/operation-node/add-index-node.d.ts +21 -0
- package/dist/cjs/operation-node/add-index-node.js +31 -0
- package/dist/cjs/operation-node/aggregate-function-node.d.ts +27 -0
- package/dist/cjs/operation-node/aggregate-function-node.js +58 -0
- package/dist/cjs/operation-node/alias-node.d.ts +13 -0
- package/dist/cjs/operation-node/alias-node.js +19 -0
- package/dist/cjs/operation-node/alter-column-node.d.ts +21 -0
- package/dist/cjs/operation-node/alter-column-node.js +20 -0
- package/dist/cjs/operation-node/alter-table-node.d.ts +36 -0
- package/dist/cjs/operation-node/alter-table-node.js +32 -0
- package/dist/cjs/operation-node/and-node.d.ts +13 -0
- package/dist/cjs/operation-node/and-node.js +19 -0
- package/dist/cjs/operation-node/binary-operation-node.d.ts +14 -0
- package/dist/cjs/operation-node/binary-operation-node.js +20 -0
- package/dist/cjs/operation-node/case-node.d.ts +19 -0
- package/dist/cjs/operation-node/case-node.js +42 -0
- package/dist/cjs/operation-node/cast-node.d.ts +13 -0
- package/dist/cjs/operation-node/cast-node.js +19 -0
- package/dist/cjs/operation-node/check-constraint-node.d.ts +14 -0
- package/dist/cjs/operation-node/check-constraint-node.js +20 -0
- package/dist/cjs/operation-node/collate-node.d.ts +13 -0
- package/dist/cjs/operation-node/collate-node.js +19 -0
- package/dist/cjs/operation-node/column-definition-node.d.ts +36 -0
- package/dist/cjs/operation-node/column-definition-node.js +42 -0
- package/dist/cjs/operation-node/column-node.d.ts +13 -0
- package/dist/cjs/operation-node/column-node.js +19 -0
- package/dist/cjs/operation-node/column-update-node.d.ts +13 -0
- package/dist/cjs/operation-node/column-update-node.js +19 -0
- package/dist/cjs/operation-node/common-table-expression-name-node.d.ts +15 -0
- package/dist/cjs/operation-node/common-table-expression-name-node.js +23 -0
- package/dist/cjs/operation-node/common-table-expression-node.d.ts +18 -0
- package/dist/cjs/operation-node/common-table-expression-node.js +25 -0
- package/dist/cjs/operation-node/constraint-node.d.ts +5 -0
- package/dist/cjs/operation-node/constraint-node.js +2 -0
- package/dist/cjs/operation-node/create-index-node.d.ts +27 -0
- package/dist/cjs/operation-node/create-index-node.js +31 -0
- package/dist/cjs/operation-node/create-schema-node.d.ts +16 -0
- package/dist/cjs/operation-node/create-schema-node.js +26 -0
- package/dist/cjs/operation-node/create-table-node.d.ts +32 -0
- package/dist/cjs/operation-node/create-table-node.js +56 -0
- package/dist/cjs/operation-node/create-type-node.d.ts +17 -0
- package/dist/cjs/operation-node/create-type-node.js +26 -0
- package/dist/cjs/operation-node/create-view-node.d.ts +24 -0
- package/dist/cjs/operation-node/create-view-node.js +25 -0
- package/dist/cjs/operation-node/data-type-node.d.ts +18 -0
- package/dist/cjs/operation-node/data-type-node.js +86 -0
- package/dist/cjs/operation-node/default-insert-value-node.d.ts +11 -0
- package/dist/cjs/operation-node/default-insert-value-node.js +17 -0
- package/dist/cjs/operation-node/default-value-node.d.ts +12 -0
- package/dist/cjs/operation-node/default-value-node.js +18 -0
- package/dist/cjs/operation-node/delete-query-node.d.ts +46 -0
- package/dist/cjs/operation-node/delete-query-node.js +52 -0
- package/dist/cjs/operation-node/drop-column-node.d.ts +13 -0
- package/dist/cjs/operation-node/drop-column-node.js +19 -0
- package/dist/cjs/operation-node/drop-constraint-node.d.ts +17 -0
- package/dist/cjs/operation-node/drop-constraint-node.js +25 -0
- package/dist/cjs/operation-node/drop-index-node.d.ts +19 -0
- package/dist/cjs/operation-node/drop-index-node.js +26 -0
- package/dist/cjs/operation-node/drop-schema-node.d.ts +17 -0
- package/dist/cjs/operation-node/drop-schema-node.js +26 -0
- package/dist/cjs/operation-node/drop-table-node.d.ts +17 -0
- package/dist/cjs/operation-node/drop-table-node.js +25 -0
- package/dist/cjs/operation-node/drop-type-node.d.ts +16 -0
- package/dist/cjs/operation-node/drop-type-node.js +24 -0
- package/dist/cjs/operation-node/drop-view-node.d.ts +18 -0
- package/dist/cjs/operation-node/drop-view-node.js +25 -0
- package/dist/cjs/operation-node/explain-node.d.ts +14 -0
- package/dist/cjs/operation-node/explain-node.js +19 -0
- package/dist/cjs/operation-node/fetch-node.d.ts +15 -0
- package/dist/cjs/operation-node/fetch-node.js +19 -0
- package/dist/cjs/operation-node/foreign-key-constraint-node.d.ts +33 -0
- package/dist/cjs/operation-node/foreign-key-constraint-node.js +28 -0
- package/dist/cjs/operation-node/from-node.d.ts +13 -0
- package/dist/cjs/operation-node/from-node.js +24 -0
- package/dist/cjs/operation-node/function-node.d.ts +13 -0
- package/dist/cjs/operation-node/function-node.js +19 -0
- package/dist/cjs/operation-node/generated-node.d.ts +19 -0
- package/dist/cjs/operation-node/generated-node.js +31 -0
- package/dist/cjs/operation-node/group-by-item-node.d.ts +12 -0
- package/dist/cjs/operation-node/group-by-item-node.js +18 -0
- package/dist/cjs/operation-node/group-by-node.d.ts +14 -0
- package/dist/cjs/operation-node/group-by-node.js +24 -0
- package/dist/cjs/operation-node/having-node.d.ts +13 -0
- package/dist/cjs/operation-node/having-node.js +28 -0
- package/dist/cjs/operation-node/identifier-node.d.ts +12 -0
- package/dist/cjs/operation-node/identifier-node.js +18 -0
- package/dist/cjs/operation-node/insert-query-node.d.ts +40 -0
- package/dist/cjs/operation-node/insert-query-node.js +31 -0
- package/dist/cjs/operation-node/join-node.d.ts +18 -0
- package/dist/cjs/operation-node/join-node.js +37 -0
- package/dist/cjs/operation-node/json-operator-chain-node.d.ts +16 -0
- package/dist/cjs/operation-node/json-operator-chain-node.js +25 -0
- package/dist/cjs/operation-node/json-path-leg-node.d.ts +14 -0
- package/dist/cjs/operation-node/json-path-leg-node.js +19 -0
- package/dist/cjs/operation-node/json-path-node.d.ts +16 -0
- package/dist/cjs/operation-node/json-path-node.js +25 -0
- package/dist/cjs/operation-node/json-reference-node.d.ts +17 -0
- package/dist/cjs/operation-node/json-reference-node.js +25 -0
- package/dist/cjs/operation-node/limit-node.d.ts +12 -0
- package/dist/cjs/operation-node/limit-node.js +18 -0
- package/dist/cjs/operation-node/list-node.d.ts +12 -0
- package/dist/cjs/operation-node/list-node.js +18 -0
- package/dist/cjs/operation-node/matched-node.d.ts +13 -0
- package/dist/cjs/operation-node/matched-node.js +19 -0
- package/dist/cjs/operation-node/merge-query-node.d.ts +30 -0
- package/dist/cjs/operation-node/merge-query-node.js +45 -0
- package/dist/cjs/operation-node/modify-column-node.d.ts +13 -0
- package/dist/cjs/operation-node/modify-column-node.js +18 -0
- package/dist/cjs/operation-node/offset-node.d.ts +12 -0
- package/dist/cjs/operation-node/offset-node.js +18 -0
- package/dist/cjs/operation-node/on-conflict-node.d.ts +30 -0
- package/dist/cjs/operation-node/on-conflict-node.js +68 -0
- package/dist/cjs/operation-node/on-duplicate-key-node.d.ts +14 -0
- package/dist/cjs/operation-node/on-duplicate-key-node.js +18 -0
- package/dist/cjs/operation-node/on-node.d.ts +13 -0
- package/dist/cjs/operation-node/on-node.js +28 -0
- package/dist/cjs/operation-node/operation-node-source.d.ts +5 -0
- package/dist/cjs/operation-node/operation-node-source.js +7 -0
- package/dist/cjs/operation-node/operation-node-transformer.d.ts +238 -0
- package/dist/cjs/operation-node/operation-node-transformer.js +929 -0
- package/dist/cjs/operation-node/operation-node-visitor.d.ts +201 -0
- package/dist/cjs/operation-node/operation-node-visitor.js +115 -0
- package/dist/cjs/operation-node/operation-node.d.ts +4 -0
- package/dist/cjs/operation-node/operation-node.js +2 -0
- package/dist/cjs/operation-node/operator-node.d.ts +32 -0
- package/dist/cjs/operation-node/operator-node.js +107 -0
- package/dist/cjs/operation-node/or-action-node.d.ts +12 -0
- package/dist/cjs/operation-node/or-action-node.js +18 -0
- package/dist/cjs/operation-node/or-node.d.ts +13 -0
- package/dist/cjs/operation-node/or-node.js +19 -0
- package/dist/cjs/operation-node/order-by-item-node.d.ts +18 -0
- package/dist/cjs/operation-node/order-by-item-node.js +25 -0
- package/dist/cjs/operation-node/order-by-node.d.ts +14 -0
- package/dist/cjs/operation-node/order-by-node.js +24 -0
- package/dist/cjs/operation-node/output-node.d.ts +13 -0
- package/dist/cjs/operation-node/output-node.js +26 -0
- package/dist/cjs/operation-node/over-node.d.ts +19 -0
- package/dist/cjs/operation-node/over-node.js +35 -0
- package/dist/cjs/operation-node/parens-node.d.ts +12 -0
- package/dist/cjs/operation-node/parens-node.js +18 -0
- package/dist/cjs/operation-node/partition-by-item-node.d.ts +13 -0
- package/dist/cjs/operation-node/partition-by-item-node.js +18 -0
- package/dist/cjs/operation-node/partition-by-node.d.ts +14 -0
- package/dist/cjs/operation-node/partition-by-node.js +24 -0
- package/dist/cjs/operation-node/primary-key-constraint-node.d.ts +29 -0
- package/dist/cjs/operation-node/primary-key-constraint-node.js +30 -0
- package/dist/cjs/operation-node/primitive-value-list-node.d.ts +17 -0
- package/dist/cjs/operation-node/primitive-value-list-node.js +18 -0
- package/dist/cjs/operation-node/query-node.d.ts +60 -0
- package/dist/cjs/operation-node/query-node.js +102 -0
- package/dist/cjs/operation-node/raw-node.d.ts +16 -0
- package/dist/cjs/operation-node/raw-node.js +28 -0
- package/dist/cjs/operation-node/reference-node.d.ts +17 -0
- package/dist/cjs/operation-node/reference-node.js +27 -0
- package/dist/cjs/operation-node/references-node.d.ts +22 -0
- package/dist/cjs/operation-node/references-node.js +38 -0
- package/dist/cjs/operation-node/refresh-materialized-view-node.d.ts +17 -0
- package/dist/cjs/operation-node/refresh-materialized-view-node.js +25 -0
- package/dist/cjs/operation-node/rename-column-node.d.ts +14 -0
- package/dist/cjs/operation-node/rename-column-node.js +20 -0
- package/dist/cjs/operation-node/rename-constraint-node.d.ts +14 -0
- package/dist/cjs/operation-node/rename-constraint-node.js +20 -0
- package/dist/cjs/operation-node/returning-node.d.ts +14 -0
- package/dist/cjs/operation-node/returning-node.js +26 -0
- package/dist/cjs/operation-node/schemable-identifier-node.d.ts +15 -0
- package/dist/cjs/operation-node/schemable-identifier-node.js +26 -0
- package/dist/cjs/operation-node/select-all-node.d.ts +11 -0
- package/dist/cjs/operation-node/select-all-node.js +17 -0
- package/dist/cjs/operation-node/select-modifier-node.d.ts +16 -0
- package/dist/cjs/operation-node/select-modifier-node.js +25 -0
- package/dist/cjs/operation-node/select-query-node.d.ts +67 -0
- package/dist/cjs/operation-node/select-query-node.js +129 -0
- package/dist/cjs/operation-node/selection-node.d.ts +20 -0
- package/dist/cjs/operation-node/selection-node.js +32 -0
- package/dist/cjs/operation-node/set-operation-node.d.ts +15 -0
- package/dist/cjs/operation-node/set-operation-node.js +20 -0
- package/dist/cjs/operation-node/simple-reference-expression-node.d.ts +3 -0
- package/dist/cjs/operation-node/simple-reference-expression-node.js +2 -0
- package/dist/cjs/operation-node/table-node.d.ts +14 -0
- package/dist/cjs/operation-node/table-node.js +25 -0
- package/dist/cjs/operation-node/top-node.d.ts +14 -0
- package/dist/cjs/operation-node/top-node.js +19 -0
- package/dist/cjs/operation-node/tuple-node.d.ts +12 -0
- package/dist/cjs/operation-node/tuple-node.js +18 -0
- package/dist/cjs/operation-node/unary-operation-node.d.ts +13 -0
- package/dist/cjs/operation-node/unary-operation-node.js +19 -0
- package/dist/cjs/operation-node/unique-constraint-node.d.ts +20 -0
- package/dist/cjs/operation-node/unique-constraint-node.js +28 -0
- package/dist/cjs/operation-node/update-query-node.d.ts +39 -0
- package/dist/cjs/operation-node/update-query-node.js +50 -0
- package/dist/cjs/operation-node/using-node.d.ts +13 -0
- package/dist/cjs/operation-node/using-node.js +24 -0
- package/dist/cjs/operation-node/value-list-node.d.ts +12 -0
- package/dist/cjs/operation-node/value-list-node.js +18 -0
- package/dist/cjs/operation-node/value-node.d.ts +14 -0
- package/dist/cjs/operation-node/value-node.js +25 -0
- package/dist/cjs/operation-node/values-node.d.ts +15 -0
- package/dist/cjs/operation-node/values-node.js +18 -0
- package/dist/cjs/operation-node/when-node.d.ts +14 -0
- package/dist/cjs/operation-node/when-node.js +24 -0
- package/dist/cjs/operation-node/where-node.d.ts +13 -0
- package/dist/cjs/operation-node/where-node.js +28 -0
- package/dist/cjs/operation-node/with-node.d.ts +16 -0
- package/dist/cjs/operation-node/with-node.js +25 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/parser/binary-operation-parser.d.ts +21 -0
- package/dist/cjs/parser/binary-operation-parser.js +74 -0
- package/dist/cjs/parser/coalesce-parser.d.ts +12 -0
- package/dist/cjs/parser/coalesce-parser.js +2 -0
- package/dist/cjs/parser/collate-parser.d.ts +1 -0
- package/dist/cjs/parser/collate-parser.js +2 -0
- package/dist/cjs/parser/data-type-parser.d.ts +5 -0
- package/dist/cjs/parser/data-type-parser.js +14 -0
- package/dist/cjs/parser/default-value-parser.d.ts +4 -0
- package/dist/cjs/parser/default-value-parser.js +10 -0
- package/dist/cjs/parser/delete-from-parser.d.ts +9 -0
- package/dist/cjs/parser/delete-from-parser.js +2 -0
- package/dist/cjs/parser/expression-parser.d.ts +20 -0
- package/dist/cjs/parser/expression-parser.js +30 -0
- package/dist/cjs/parser/fetch-parser.d.ts +2 -0
- package/dist/cjs/parser/fetch-parser.js +17 -0
- package/dist/cjs/parser/group-by-parser.d.ts +6 -0
- package/dist/cjs/parser/group-by-parser.js +11 -0
- package/dist/cjs/parser/identifier-parser.d.ts +2 -0
- package/dist/cjs/parser/identifier-parser.js +22 -0
- package/dist/cjs/parser/insert-values-parser.d.ts +14 -0
- package/dist/cjs/parser/insert-values-parser.js +64 -0
- package/dist/cjs/parser/join-parser.d.ts +10 -0
- package/dist/cjs/parser/join-parser.js +30 -0
- package/dist/cjs/parser/merge-into-parser.d.ts +7 -0
- package/dist/cjs/parser/merge-into-parser.js +2 -0
- package/dist/cjs/parser/merge-parser.d.ts +9 -0
- package/dist/cjs/parser/merge-parser.js +31 -0
- package/dist/cjs/parser/on-commit-action-parse.d.ts +2 -0
- package/dist/cjs/parser/on-commit-action-parse.js +10 -0
- package/dist/cjs/parser/on-modify-action-parser.d.ts +2 -0
- package/dist/cjs/parser/on-modify-action-parser.js +10 -0
- package/dist/cjs/parser/order-by-parser.d.ts +25 -0
- package/dist/cjs/parser/order-by-parser.js +71 -0
- package/dist/cjs/parser/parse-utils.d.ts +10 -0
- package/dist/cjs/parser/parse-utils.js +38 -0
- package/dist/cjs/parser/partition-by-parser.d.ts +6 -0
- package/dist/cjs/parser/partition-by-parser.js +8 -0
- package/dist/cjs/parser/reference-parser.d.ts +31 -0
- package/dist/cjs/parser/reference-parser.js +104 -0
- package/dist/cjs/parser/returning-parser.d.ts +8 -0
- package/dist/cjs/parser/returning-parser.js +2 -0
- package/dist/cjs/parser/savepoint-parser.d.ts +4 -0
- package/dist/cjs/parser/savepoint-parser.js +11 -0
- package/dist/cjs/parser/select-from-parser.d.ts +6 -0
- package/dist/cjs/parser/select-from-parser.js +2 -0
- package/dist/cjs/parser/select-parser.d.ts +36 -0
- package/dist/cjs/parser/select-parser.js +50 -0
- package/dist/cjs/parser/set-operation-parser.d.ts +5 -0
- package/dist/cjs/parser/set-operation-parser.js +16 -0
- package/dist/cjs/parser/table-parser.d.ts +24 -0
- package/dist/cjs/parser/table-parser.js +54 -0
- package/dist/cjs/parser/top-parser.d.ts +2 -0
- package/dist/cjs/parser/top-parser.js +19 -0
- package/dist/cjs/parser/tuple-parser.d.ts +47 -0
- package/dist/cjs/parser/tuple-parser.js +2 -0
- package/dist/cjs/parser/unary-operation-parser.d.ts +8 -0
- package/dist/cjs/parser/unary-operation-parser.js +17 -0
- package/dist/cjs/parser/update-parser.d.ts +9 -0
- package/dist/cjs/parser/update-parser.js +2 -0
- package/dist/cjs/parser/update-set-parser.d.ts +16 -0
- package/dist/cjs/parser/update-set-parser.js +26 -0
- package/dist/cjs/parser/value-parser.d.ts +13 -0
- package/dist/cjs/parser/value-parser.js +38 -0
- package/dist/cjs/parser/with-parser.d.ts +45 -0
- package/dist/cjs/parser/with-parser.js +33 -0
- package/dist/cjs/performance/query-analyzer.d.ts +89 -0
- package/dist/cjs/performance/query-analyzer.js +263 -0
- package/dist/cjs/plugin/camel-case/camel-case-plugin.d.ts +170 -0
- package/dist/cjs/plugin/camel-case/camel-case-plugin.js +122 -0
- package/dist/cjs/plugin/camel-case/camel-case-transformer.d.ts +9 -0
- package/dist/cjs/plugin/camel-case/camel-case-transformer.js +19 -0
- package/dist/cjs/plugin/camel-case/camel-case.d.ts +15 -0
- package/dist/cjs/plugin/camel-case/camel-case.js +111 -0
- package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-plugin.d.ts +70 -0
- package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-plugin.js +19 -0
- package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-transformer.d.ts +11 -0
- package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-transformer.js +42 -0
- package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.d.ts +211 -0
- package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.js +162 -0
- package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.d.ts +8 -0
- package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.js +29 -0
- package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists.d.ts +44 -0
- package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists.js +66 -0
- package/dist/cjs/plugin/immediate-value/immediate-value-plugin.d.ts +73 -0
- package/dist/cjs/plugin/immediate-value/immediate-value-plugin.js +22 -0
- package/dist/cjs/plugin/immediate-value/immediate-value-transformer.d.ts +15 -0
- package/dist/cjs/plugin/immediate-value/immediate-value-transformer.js +23 -0
- package/dist/cjs/plugin/kysely-plugin.d.ts +72 -0
- package/dist/cjs/plugin/kysely-plugin.js +2 -0
- package/dist/cjs/plugin/noop-plugin.d.ts +64 -0
- package/dist/cjs/plugin/noop-plugin.js +12 -0
- package/dist/cjs/plugin/parse-json-results/parse-json-results-plugin.d.ts +126 -0
- package/dist/cjs/plugin/parse-json-results/parse-json-results-plugin.js +107 -0
- package/dist/cjs/plugin/with-schema/with-schema-plugin.d.ts +66 -0
- package/dist/cjs/plugin/with-schema/with-schema-plugin.js +17 -0
- package/dist/cjs/plugin/with-schema/with-schema-transformer.d.ts +16 -0
- package/dist/cjs/plugin/with-schema/with-schema-transformer.js +181 -0
- package/dist/cjs/query-builder/aggregate-function-builder.d.ts +379 -0
- package/dist/cjs/query-builder/aggregate-function-builder.js +242 -0
- package/dist/cjs/query-builder/case-builder.d.ts +112 -0
- package/dist/cjs/query-builder/case-builder.js +79 -0
- package/dist/cjs/query-builder/cte-builder.d.ts +20 -0
- package/dist/cjs/query-builder/cte-builder.js +37 -0
- package/dist/cjs/query-builder/delete-query-builder.d.ts +1348 -0
- package/dist/cjs/query-builder/delete-query-builder.js +504 -0
- package/dist/cjs/query-builder/delete-result.d.ts +4 -0
- package/dist/cjs/query-builder/delete-result.js +10 -0
- package/dist/cjs/query-builder/function-module.d.ts +592 -0
- package/dist/cjs/query-builder/function-module.js +62 -0
- package/dist/cjs/query-builder/having-interface.d.ts +15 -0
- package/dist/cjs/query-builder/having-interface.js +2 -0
- package/dist/cjs/query-builder/insert-query-builder.d.ts +1235 -0
- package/dist/cjs/query-builder/insert-query-builder.js +1160 -0
- package/dist/cjs/query-builder/insert-result.d.ts +46 -0
- package/dist/cjs/query-builder/insert-result.js +53 -0
- package/dist/cjs/query-builder/join-builder.d.ts +38 -0
- package/dist/cjs/query-builder/join-builder.js +51 -0
- package/dist/cjs/query-builder/json-path-builder.d.ts +294 -0
- package/dist/cjs/query-builder/json-path-builder.js +200 -0
- package/dist/cjs/query-builder/merge-query-builder.d.ts +1001 -0
- package/dist/cjs/query-builder/merge-query-builder.js +630 -0
- package/dist/cjs/query-builder/merge-result.d.ts +4 -0
- package/dist/cjs/query-builder/merge-result.js +10 -0
- package/dist/cjs/query-builder/no-result-error.d.ts +10 -0
- package/dist/cjs/query-builder/no-result-error.js +18 -0
- package/dist/cjs/query-builder/on-conflict-builder.d.ts +872 -0
- package/dist/cjs/query-builder/on-conflict-builder.js +259 -0
- package/dist/cjs/query-builder/order-by-interface.d.ts +158 -0
- package/dist/cjs/query-builder/order-by-interface.js +2 -0
- package/dist/cjs/query-builder/order-by-item-builder.d.ts +43 -0
- package/dist/cjs/query-builder/order-by-item-builder.js +75 -0
- package/dist/cjs/query-builder/output-interface.d.ts +138 -0
- package/dist/cjs/query-builder/output-interface.js +2 -0
- package/dist/cjs/query-builder/over-builder.d.ts +101 -0
- package/dist/cjs/query-builder/over-builder.js +40 -0
- package/dist/cjs/query-builder/returning-interface.d.ts +91 -0
- package/dist/cjs/query-builder/returning-interface.js +2 -0
- package/dist/cjs/query-builder/select-query-builder-expression.d.ts +28 -0
- package/dist/cjs/query-builder/select-query-builder-expression.js +2 -0
- package/dist/cjs/query-builder/select-query-builder.d.ts +2391 -0
- package/dist/cjs/query-builder/select-query-builder.js +376 -0
- package/dist/cjs/query-builder/update-query-builder.d.ts +1392 -0
- package/dist/cjs/query-builder/update-query-builder.js +513 -0
- package/dist/cjs/query-builder/update-result.d.ts +14 -0
- package/dist/cjs/query-builder/update-result.js +21 -0
- package/dist/cjs/query-builder/where-interface.d.ts +382 -0
- package/dist/cjs/query-builder/where-interface.js +2 -0
- package/dist/cjs/query-compiler/compiled-query.d.ts +11 -0
- package/dist/cjs/query-compiler/compiled-query.js +16 -0
- package/dist/cjs/query-compiler/default-query-compiler.d.ts +235 -0
- package/dist/cjs/query-compiler/default-query-compiler.js +1390 -0
- package/dist/cjs/query-compiler/query-compiler.d.ts +24 -0
- package/dist/cjs/query-compiler/query-compiler.js +2 -0
- package/dist/cjs/query-creator.d.ts +592 -0
- package/dist/cjs/query-creator.js +622 -0
- package/dist/cjs/query-executor/default-query-executor.d.ts +50 -0
- package/dist/cjs/query-executor/default-query-executor.js +40 -0
- package/dist/cjs/query-executor/noop-query-executor.d.ts +50 -0
- package/dist/cjs/query-executor/noop-query-executor.js +37 -0
- package/dist/cjs/query-executor/query-executor-base.d.ts +68 -0
- package/dist/cjs/query-executor/query-executor-base.js +62 -0
- package/dist/cjs/query-executor/query-executor-provider.d.ts +8 -0
- package/dist/cjs/query-executor/query-executor-provider.js +2 -0
- package/dist/cjs/query-executor/query-executor.d.ts +74 -0
- package/dist/cjs/query-executor/query-executor.js +2 -0
- package/dist/cjs/raw-builder/raw-builder.d.ts +218 -0
- package/dist/cjs/raw-builder/raw-builder.js +86 -0
- package/dist/cjs/raw-builder/sql.d.ts +366 -0
- package/dist/cjs/raw-builder/sql.js +84 -0
- package/dist/cjs/relationships/relationship-engine.d.ts +59 -0
- package/dist/cjs/relationships/relationship-engine.js +206 -0
- package/dist/cjs/repository/repository-factory.d.ts +54 -0
- package/dist/cjs/repository/repository-factory.js +449 -0
- package/dist/cjs/schema/builders/alter-column-builder.d.ts +53 -0
- package/dist/cjs/schema/builders/alter-column-builder.js +74 -0
- package/dist/cjs/schema/builders/alter-table-add-foreign-key-constraint-builder.d.ts +32 -0
- package/dist/cjs/schema/builders/alter-table-add-foreign-key-constraint-builder.js +67 -0
- package/dist/cjs/schema/builders/alter-table-add-index-builder.d.ts +138 -0
- package/dist/cjs/schema/builders/alter-table-add-index-builder.js +165 -0
- package/dist/cjs/schema/builders/alter-table-builder.d.ts +148 -0
- package/dist/cjs/schema/builders/alter-table-builder.js +267 -0
- package/dist/cjs/schema/builders/alter-table-drop-constraint-builder.d.ts +26 -0
- package/dist/cjs/schema/builders/alter-table-drop-constraint-builder.js +59 -0
- package/dist/cjs/schema/builders/alter-table-executor.d.ts +18 -0
- package/dist/cjs/schema/builders/alter-table-executor.js +20 -0
- package/dist/cjs/schema/builders/check-constraint-builder.d.ts +13 -0
- package/dist/cjs/schema/builders/check-constraint-builder.js +20 -0
- package/dist/cjs/schema/builders/column-definition-builder.d.ts +514 -0
- package/dist/cjs/schema/builders/column-definition-builder.js +600 -0
- package/dist/cjs/schema/builders/create-index-builder.d.ts +173 -0
- package/dist/cjs/schema/builders/create-index-builder.js +202 -0
- package/dist/cjs/schema/builders/create-schema-builder.d.ts +24 -0
- package/dist/cjs/schema/builders/create-schema-builder.js +34 -0
- package/dist/cjs/schema/builders/create-table-builder.d.ts +331 -0
- package/dist/cjs/schema/builders/create-table-builder.js +411 -0
- package/dist/cjs/schema/builders/create-type-builder.d.ts +33 -0
- package/dist/cjs/schema/builders/create-type-builder.js +43 -0
- package/dist/cjs/schema/builders/create-view-builder.d.ts +48 -0
- package/dist/cjs/schema/builders/create-view-builder.js +98 -0
- package/dist/cjs/schema/builders/drop-index-builder.d.ts +30 -0
- package/dist/cjs/schema/builders/drop-index-builder.js +57 -0
- package/dist/cjs/schema/builders/drop-schema-builder.d.ts +25 -0
- package/dist/cjs/schema/builders/drop-schema-builder.js +44 -0
- package/dist/cjs/schema/builders/drop-table-builder.d.ts +25 -0
- package/dist/cjs/schema/builders/drop-table-builder.js +44 -0
- package/dist/cjs/schema/builders/drop-type-builder.d.ts +24 -0
- package/dist/cjs/schema/builders/drop-type-builder.js +36 -0
- package/dist/cjs/schema/builders/drop-view-builder.d.ts +26 -0
- package/dist/cjs/schema/builders/drop-view-builder.js +52 -0
- package/dist/cjs/schema/builders/foreign-key-constraint-builder.d.ts +28 -0
- package/dist/cjs/schema/builders/foreign-key-constraint-builder.js +48 -0
- package/dist/cjs/schema/builders/index.d.ts +22 -0
- package/dist/cjs/schema/builders/index.js +39 -0
- package/dist/cjs/schema/builders/primary-key-constraint-builder.d.ts +17 -0
- package/dist/cjs/schema/builders/primary-key-constraint-builder.js +37 -0
- package/dist/cjs/schema/builders/refresh-materialized-view-builder.d.ts +47 -0
- package/dist/cjs/schema/builders/refresh-materialized-view-builder.js +75 -0
- package/dist/cjs/schema/builders/unique-constraint-builder.d.ts +23 -0
- package/dist/cjs/schema/builders/unique-constraint-builder.js +45 -0
- package/dist/cjs/schema/core/coordinators/schema-discovery.coordinator.d.ts +35 -0
- package/dist/cjs/schema/core/coordinators/schema-discovery.coordinator.js +63 -0
- package/dist/cjs/schema/core/discovery/relationship-discovery.d.ts +36 -0
- package/dist/cjs/schema/core/discovery/relationship-discovery.js +162 -0
- package/dist/cjs/schema/core/discovery/table-metadata-discovery.d.ts +29 -0
- package/dist/cjs/schema/core/discovery/table-metadata-discovery.js +126 -0
- package/dist/cjs/schema/core/discovery/view-discovery.d.ts +36 -0
- package/dist/cjs/schema/core/discovery/view-discovery.js +137 -0
- package/dist/cjs/schema/core/factories/discovery-factory.d.ts +66 -0
- package/dist/cjs/schema/core/factories/discovery-factory.js +122 -0
- package/dist/cjs/schema/core/types/schema-discovery-types.d.ts +43 -0
- package/dist/cjs/schema/core/types/schema-discovery-types.js +3 -0
- package/dist/cjs/schema/core/utils/name-generator.d.ts +21 -0
- package/dist/cjs/schema/core/utils/name-generator.js +55 -0
- package/dist/cjs/schema/core/utils/type-mapper.d.ts +25 -0
- package/dist/cjs/schema/core/utils/type-mapper.js +61 -0
- package/dist/cjs/schema/dialects/sqlite/discovery/sqlite-constraint-discovery.d.ts +97 -0
- package/dist/cjs/schema/dialects/sqlite/discovery/sqlite-constraint-discovery.js +533 -0
- package/dist/cjs/schema/dialects/sqlite/discovery/sqlite-index-discovery.d.ts +32 -0
- package/dist/cjs/schema/dialects/sqlite/discovery/sqlite-index-discovery.js +133 -0
- package/dist/cjs/schema/dialects/sqlite/introspection/sqlite-schema-introspector.d.ts +31 -0
- package/dist/cjs/schema/dialects/sqlite/introspection/sqlite-schema-introspector.js +192 -0
- package/dist/cjs/schema/dialects/sqlite/sqlite-discovery.coordinator.d.ts +51 -0
- package/dist/cjs/schema/dialects/sqlite/sqlite-discovery.coordinator.js +180 -0
- package/dist/cjs/schema/index.d.ts +14 -0
- package/dist/cjs/schema/index.js +49 -0
- package/dist/cjs/schema/schema-discovery.d.ts +23 -0
- package/dist/cjs/schema/schema-discovery.js +33 -0
- package/dist/cjs/schema/schema.d.ts +230 -0
- package/dist/cjs/schema/schema.js +328 -0
- package/dist/cjs/schema/test/basic-schema-test.d.ts +8 -0
- package/dist/cjs/schema/test/basic-schema-test.js +184 -0
- package/dist/cjs/schema/test/dialect-capabilities.test.d.ts +1 -0
- package/dist/cjs/schema/test/dialect-capabilities.test.js +153 -0
- package/dist/cjs/schema/test/discovery-factory.test.d.ts +1 -0
- package/dist/cjs/schema/test/discovery-factory.test.js +151 -0
- package/dist/cjs/schema/test/error-handling.test.d.ts +1 -0
- package/dist/cjs/schema/test/error-handling.test.js +149 -0
- package/dist/cjs/schema/test/integration.test.d.ts +1 -0
- package/dist/cjs/schema/test/integration.test.js +135 -0
- package/dist/cjs/schema/test/schema-discovery-coordinator.test.d.ts +1 -0
- package/dist/cjs/schema/test/schema-discovery-coordinator.test.js +139 -0
- package/dist/cjs/schema/test/simple-schema-test.d.ts +5 -0
- package/dist/cjs/schema/test/simple-schema-test.js +77 -0
- package/dist/cjs/schema/test/sqlite-discovery-coordinator.test.d.ts +1 -0
- package/dist/cjs/schema/test/sqlite-discovery-coordinator.test.js +377 -0
- package/dist/cjs/schema/test/test-runner.d.ts +66 -0
- package/dist/cjs/schema/test/test-runner.js +90 -0
- package/dist/cjs/sqlite-migration/index.d.ts +6 -0
- package/dist/cjs/sqlite-migration/index.js +20 -0
- package/dist/cjs/sqlite-migration/sqlite-migration-manager.d.ts +104 -0
- package/dist/cjs/sqlite-migration/sqlite-migration-manager.js +335 -0
- package/dist/cjs/sqlite-migration/sqlite-migration-provider.d.ts +77 -0
- package/dist/cjs/sqlite-migration/sqlite-migration-provider.js +342 -0
- package/dist/cjs/testing/test-utils.d.ts +110 -0
- package/dist/cjs/testing/test-utils.js +328 -0
- package/dist/cjs/types/index.d.ts +155 -0
- package/dist/cjs/types/index.js +5 -0
- package/dist/cjs/types/type-generator.d.ts +52 -0
- package/dist/cjs/types/type-generator.js +261 -0
- package/dist/cjs/util/assert.d.ts +2 -0
- package/dist/cjs/util/assert.js +14 -0
- package/dist/cjs/util/column-type.d.ts +175 -0
- package/dist/cjs/util/column-type.js +2 -0
- package/dist/cjs/util/compilable.d.ts +5 -0
- package/dist/cjs/util/compilable.js +7 -0
- package/dist/cjs/util/deferred.d.ts +7 -0
- package/dist/cjs/util/deferred.js +28 -0
- package/dist/cjs/util/explainable.d.ts +40 -0
- package/dist/cjs/util/explainable.js +2 -0
- package/dist/cjs/util/infer-result.d.ts +48 -0
- package/dist/cjs/util/infer-result.js +2 -0
- package/dist/cjs/util/json-object-args.d.ts +3 -0
- package/dist/cjs/util/json-object-args.js +34 -0
- package/dist/cjs/util/log-once.d.ts +5 -0
- package/dist/cjs/util/log-once.js +15 -0
- package/dist/cjs/util/log.d.ts +26 -0
- package/dist/cjs/util/log.js +58 -0
- package/dist/cjs/util/object-utils.d.ts +23 -0
- package/dist/cjs/util/object-utils.js +162 -0
- package/dist/cjs/util/performance-now.d.ts +1 -0
- package/dist/cjs/util/performance-now.js +12 -0
- package/dist/cjs/util/provide-controlled-connection.d.ts +7 -0
- package/dist/cjs/util/provide-controlled-connection.js +24 -0
- package/dist/cjs/util/query-id.d.ts +4 -0
- package/dist/cjs/util/query-id.js +16 -0
- package/dist/cjs/util/random-string.d.ts +1 -0
- package/dist/cjs/util/random-string.js +77 -0
- package/dist/cjs/util/require-all-props.d.ts +45 -0
- package/dist/cjs/util/require-all-props.js +41 -0
- package/dist/cjs/util/stack-trace-utils.d.ts +1 -0
- package/dist/cjs/util/stack-trace-utils.js +16 -0
- package/dist/cjs/util/streamable.d.ts +29 -0
- package/dist/cjs/util/streamable.js +2 -0
- package/dist/cjs/util/type-error.d.ts +3 -0
- package/dist/cjs/util/type-error.js +2 -0
- package/dist/cjs/util/type-utils.d.ts +189 -0
- package/dist/cjs/util/type-utils.js +2 -0
- package/dist/cjs/utils/errorHelpers.d.ts +26 -0
- package/dist/cjs/utils/errorHelpers.js +186 -0
- package/dist/cjs/watch/schema-watcher.d.ts +68 -0
- package/dist/cjs/watch/schema-watcher.js +186 -0
- package/dist/esm/cache/cache-manager.d.ts +76 -0
- package/dist/esm/cache/cache-manager.js +166 -0
- package/dist/esm/cli/commands/analyze.d.ts +7 -0
- package/dist/esm/cli/commands/analyze.js +130 -0
- package/dist/esm/cli/commands/generate.d.ts +7 -0
- package/dist/esm/cli/commands/generate.js +512 -0
- package/dist/esm/cli/commands/init.d.ts +7 -0
- package/dist/esm/cli/commands/init.js +468 -0
- package/dist/esm/cli/commands/inspect.d.ts +7 -0
- package/dist/esm/cli/commands/inspect.js +363 -0
- package/dist/esm/cli/commands/migrate.d.ts +8 -0
- package/dist/esm/cli/commands/migrate.js +216 -0
- package/dist/esm/cli/commands/optimize.d.ts +8 -0
- package/dist/esm/cli/commands/optimize.js +154 -0
- package/dist/esm/cli/commands/status.d.ts +6 -0
- package/dist/esm/cli/commands/status.js +265 -0
- package/dist/esm/cli/commands/watch.d.ts +7 -0
- package/dist/esm/cli/commands/watch.js +214 -0
- package/dist/esm/cli/index.d.ts +2 -0
- package/dist/esm/cli/index.js +156 -0
- package/dist/esm/dialect/database-introspector.d.ts +61 -0
- package/dist/esm/dialect/database-introspector.js +82 -0
- package/dist/esm/dialect/dialect-adapter-base.d.ts +94 -0
- package/dist/esm/dialect/dialect-adapter-base.js +21 -0
- package/dist/esm/dialect/dialect-adapter.d.ts +115 -0
- package/dist/esm/dialect/dialect-adapter.js +2 -0
- package/dist/esm/dialect/dialect.d.ts +34 -0
- package/dist/esm/dialect/dialect.js +2 -0
- package/dist/esm/dialect/sqlite/sqlite-adapter.d.ts +80 -0
- package/dist/esm/dialect/sqlite/sqlite-adapter.js +20 -0
- package/dist/esm/dialect/sqlite/sqlite-auto-indexer.d.ts +181 -0
- package/dist/esm/dialect/sqlite/sqlite-auto-indexer.js +538 -0
- package/dist/esm/dialect/sqlite/sqlite-auto-optimizer.d.ts +102 -0
- package/dist/esm/dialect/sqlite/sqlite-auto-optimizer.js +370 -0
- package/dist/esm/dialect/sqlite/sqlite-dialect-config.d.ts +41 -0
- package/dist/esm/dialect/sqlite/sqlite-dialect-config.js +2 -0
- package/dist/esm/dialect/sqlite/sqlite-dialect.d.ts +55 -0
- package/dist/esm/dialect/sqlite/sqlite-dialect.js +48 -0
- package/dist/esm/dialect/sqlite/sqlite-driver.d.ts +42 -0
- package/dist/esm/dialect/sqlite/sqlite-driver.js +149 -0
- package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +36 -0
- package/dist/esm/dialect/sqlite/sqlite-introspector.js +233 -0
- package/dist/esm/dialect/sqlite/sqlite-query-compiler.d.ts +16 -0
- package/dist/esm/dialect/sqlite/sqlite-query-compiler.js +40 -0
- package/dist/esm/driver/connection-provider.d.ts +8 -0
- package/dist/esm/driver/connection-provider.js +2 -0
- package/dist/esm/driver/database-connection.d.ts +35 -0
- package/dist/esm/driver/database-connection.js +2 -0
- package/dist/esm/driver/default-connection-provider.d.ts +12 -0
- package/dist/esm/driver/default-connection-provider.js +16 -0
- package/dist/esm/driver/driver.d.ts +61 -0
- package/dist/esm/driver/driver.js +19 -0
- package/dist/esm/driver/dummy-driver.d.ts +75 -0
- package/dist/esm/driver/dummy-driver.js +80 -0
- package/dist/esm/driver/runtime-driver.d.ts +47 -0
- package/dist/esm/driver/runtime-driver.js +162 -0
- package/dist/esm/driver/single-connection-provider.d.ts +11 -0
- package/dist/esm/driver/single-connection-provider.js +26 -0
- package/dist/esm/dynamic/dynamic-reference-builder.d.ts +18 -0
- package/dist/esm/dynamic/dynamic-reference-builder.js +32 -0
- package/dist/esm/dynamic/dynamic-table-builder.d.ts +16 -0
- package/dist/esm/dynamic/dynamic-table-builder.js +41 -0
- package/dist/esm/dynamic/dynamic.d.ts +124 -0
- package/dist/esm/dynamic/dynamic.js +129 -0
- package/dist/esm/errors/NoormError.d.ts +56 -0
- package/dist/esm/errors/NoormError.js +150 -0
- package/dist/esm/expression/expression-builder.d.ts +920 -0
- package/dist/esm/expression/expression-builder.js +125 -0
- package/dist/esm/expression/expression-wrapper.d.ts +631 -0
- package/dist/esm/expression/expression-wrapper.js +128 -0
- package/dist/esm/expression/expression.d.ts +198 -0
- package/dist/esm/expression/expression.js +12 -0
- package/dist/esm/helpers/sqlite.d.ts +189 -0
- package/dist/esm/helpers/sqlite.js +200 -0
- package/dist/esm/index.d.ts +211 -0
- package/dist/esm/index.js +203 -0
- package/dist/esm/kysely.d.ts +848 -0
- package/dist/esm/kysely.js +914 -0
- package/dist/esm/logging/logger.d.ts +96 -0
- package/dist/esm/logging/logger.js +176 -0
- package/dist/esm/noormme.d.ts +137 -0
- package/dist/esm/noormme.js +518 -0
- package/dist/esm/operation-node/add-column-node.d.ts +13 -0
- package/dist/esm/operation-node/add-column-node.js +16 -0
- package/dist/esm/operation-node/add-constraint-node.d.ts +13 -0
- package/dist/esm/operation-node/add-constraint-node.js +16 -0
- package/dist/esm/operation-node/add-index-node.d.ts +21 -0
- package/dist/esm/operation-node/add-index-node.js +29 -0
- package/dist/esm/operation-node/aggregate-function-node.d.ts +27 -0
- package/dist/esm/operation-node/aggregate-function-node.js +56 -0
- package/dist/esm/operation-node/alias-node.d.ts +13 -0
- package/dist/esm/operation-node/alias-node.js +17 -0
- package/dist/esm/operation-node/alter-column-node.d.ts +21 -0
- package/dist/esm/operation-node/alter-column-node.js +18 -0
- package/dist/esm/operation-node/alter-table-node.d.ts +36 -0
- package/dist/esm/operation-node/alter-table-node.js +30 -0
- package/dist/esm/operation-node/and-node.d.ts +13 -0
- package/dist/esm/operation-node/and-node.js +17 -0
- package/dist/esm/operation-node/binary-operation-node.d.ts +14 -0
- package/dist/esm/operation-node/binary-operation-node.js +18 -0
- package/dist/esm/operation-node/case-node.d.ts +19 -0
- package/dist/esm/operation-node/case-node.js +40 -0
- package/dist/esm/operation-node/cast-node.d.ts +13 -0
- package/dist/esm/operation-node/cast-node.js +17 -0
- package/dist/esm/operation-node/check-constraint-node.d.ts +14 -0
- package/dist/esm/operation-node/check-constraint-node.js +18 -0
- package/dist/esm/operation-node/collate-node.d.ts +13 -0
- package/dist/esm/operation-node/collate-node.js +17 -0
- package/dist/esm/operation-node/column-definition-node.d.ts +36 -0
- package/dist/esm/operation-node/column-definition-node.js +40 -0
- package/dist/esm/operation-node/column-node.d.ts +13 -0
- package/dist/esm/operation-node/column-node.js +17 -0
- package/dist/esm/operation-node/column-update-node.d.ts +13 -0
- package/dist/esm/operation-node/column-update-node.js +17 -0
- package/dist/esm/operation-node/common-table-expression-name-node.d.ts +15 -0
- package/dist/esm/operation-node/common-table-expression-name-node.js +21 -0
- package/dist/esm/operation-node/common-table-expression-node.d.ts +18 -0
- package/dist/esm/operation-node/common-table-expression-node.js +23 -0
- package/dist/esm/operation-node/constraint-node.d.ts +5 -0
- package/dist/esm/operation-node/constraint-node.js +2 -0
- package/dist/esm/operation-node/create-index-node.d.ts +27 -0
- package/dist/esm/operation-node/create-index-node.js +29 -0
- package/dist/esm/operation-node/create-schema-node.d.ts +16 -0
- package/dist/esm/operation-node/create-schema-node.js +24 -0
- package/dist/esm/operation-node/create-table-node.d.ts +32 -0
- package/dist/esm/operation-node/create-table-node.js +54 -0
- package/dist/esm/operation-node/create-type-node.d.ts +17 -0
- package/dist/esm/operation-node/create-type-node.js +24 -0
- package/dist/esm/operation-node/create-view-node.d.ts +24 -0
- package/dist/esm/operation-node/create-view-node.js +23 -0
- package/dist/esm/operation-node/data-type-node.d.ts +18 -0
- package/dist/esm/operation-node/data-type-node.js +83 -0
- package/dist/esm/operation-node/default-insert-value-node.d.ts +11 -0
- package/dist/esm/operation-node/default-insert-value-node.js +15 -0
- package/dist/esm/operation-node/default-value-node.d.ts +12 -0
- package/dist/esm/operation-node/default-value-node.js +16 -0
- package/dist/esm/operation-node/delete-query-node.d.ts +46 -0
- package/dist/esm/operation-node/delete-query-node.js +50 -0
- package/dist/esm/operation-node/drop-column-node.d.ts +13 -0
- package/dist/esm/operation-node/drop-column-node.js +17 -0
- package/dist/esm/operation-node/drop-constraint-node.d.ts +17 -0
- package/dist/esm/operation-node/drop-constraint-node.js +23 -0
- package/dist/esm/operation-node/drop-index-node.d.ts +19 -0
- package/dist/esm/operation-node/drop-index-node.js +24 -0
- package/dist/esm/operation-node/drop-schema-node.d.ts +17 -0
- package/dist/esm/operation-node/drop-schema-node.js +24 -0
- package/dist/esm/operation-node/drop-table-node.d.ts +17 -0
- package/dist/esm/operation-node/drop-table-node.js +23 -0
- package/dist/esm/operation-node/drop-type-node.d.ts +16 -0
- package/dist/esm/operation-node/drop-type-node.js +22 -0
- package/dist/esm/operation-node/drop-view-node.d.ts +18 -0
- package/dist/esm/operation-node/drop-view-node.js +23 -0
- package/dist/esm/operation-node/explain-node.d.ts +14 -0
- package/dist/esm/operation-node/explain-node.js +17 -0
- package/dist/esm/operation-node/fetch-node.d.ts +15 -0
- package/dist/esm/operation-node/fetch-node.js +17 -0
- package/dist/esm/operation-node/foreign-key-constraint-node.d.ts +33 -0
- package/dist/esm/operation-node/foreign-key-constraint-node.js +26 -0
- package/dist/esm/operation-node/from-node.d.ts +13 -0
- package/dist/esm/operation-node/from-node.js +22 -0
- package/dist/esm/operation-node/function-node.d.ts +13 -0
- package/dist/esm/operation-node/function-node.js +17 -0
- package/dist/esm/operation-node/generated-node.d.ts +19 -0
- package/dist/esm/operation-node/generated-node.js +29 -0
- package/dist/esm/operation-node/group-by-item-node.d.ts +12 -0
- package/dist/esm/operation-node/group-by-item-node.js +16 -0
- package/dist/esm/operation-node/group-by-node.d.ts +14 -0
- package/dist/esm/operation-node/group-by-node.js +22 -0
- package/dist/esm/operation-node/having-node.d.ts +13 -0
- package/dist/esm/operation-node/having-node.js +26 -0
- package/dist/esm/operation-node/identifier-node.d.ts +12 -0
- package/dist/esm/operation-node/identifier-node.js +16 -0
- package/dist/esm/operation-node/insert-query-node.d.ts +40 -0
- package/dist/esm/operation-node/insert-query-node.js +29 -0
- package/dist/esm/operation-node/join-node.d.ts +18 -0
- package/dist/esm/operation-node/join-node.js +35 -0
- package/dist/esm/operation-node/json-operator-chain-node.d.ts +16 -0
- package/dist/esm/operation-node/json-operator-chain-node.js +23 -0
- package/dist/esm/operation-node/json-path-leg-node.d.ts +14 -0
- package/dist/esm/operation-node/json-path-leg-node.js +17 -0
- package/dist/esm/operation-node/json-path-node.d.ts +16 -0
- package/dist/esm/operation-node/json-path-node.js +23 -0
- package/dist/esm/operation-node/json-reference-node.d.ts +17 -0
- package/dist/esm/operation-node/json-reference-node.js +23 -0
- package/dist/esm/operation-node/limit-node.d.ts +12 -0
- package/dist/esm/operation-node/limit-node.js +16 -0
- package/dist/esm/operation-node/list-node.d.ts +12 -0
- package/dist/esm/operation-node/list-node.js +16 -0
- package/dist/esm/operation-node/matched-node.d.ts +13 -0
- package/dist/esm/operation-node/matched-node.js +17 -0
- package/dist/esm/operation-node/merge-query-node.d.ts +30 -0
- package/dist/esm/operation-node/merge-query-node.js +43 -0
- package/dist/esm/operation-node/modify-column-node.d.ts +13 -0
- package/dist/esm/operation-node/modify-column-node.js +16 -0
- package/dist/esm/operation-node/offset-node.d.ts +12 -0
- package/dist/esm/operation-node/offset-node.js +16 -0
- package/dist/esm/operation-node/on-conflict-node.d.ts +30 -0
- package/dist/esm/operation-node/on-conflict-node.js +66 -0
- package/dist/esm/operation-node/on-duplicate-key-node.d.ts +14 -0
- package/dist/esm/operation-node/on-duplicate-key-node.js +16 -0
- package/dist/esm/operation-node/on-node.d.ts +13 -0
- package/dist/esm/operation-node/on-node.js +26 -0
- package/dist/esm/operation-node/operation-node-source.d.ts +5 -0
- package/dist/esm/operation-node/operation-node-source.js +5 -0
- package/dist/esm/operation-node/operation-node-transformer.d.ts +238 -0
- package/dist/esm/operation-node/operation-node-transformer.js +926 -0
- package/dist/esm/operation-node/operation-node-visitor.d.ts +201 -0
- package/dist/esm/operation-node/operation-node-visitor.js +112 -0
- package/dist/esm/operation-node/operation-node.d.ts +4 -0
- package/dist/esm/operation-node/operation-node.js +2 -0
- package/dist/esm/operation-node/operator-node.d.ts +32 -0
- package/dist/esm/operation-node/operator-node.js +100 -0
- package/dist/esm/operation-node/or-action-node.d.ts +12 -0
- package/dist/esm/operation-node/or-action-node.js +16 -0
- package/dist/esm/operation-node/or-node.d.ts +13 -0
- package/dist/esm/operation-node/or-node.js +17 -0
- package/dist/esm/operation-node/order-by-item-node.d.ts +18 -0
- package/dist/esm/operation-node/order-by-item-node.js +23 -0
- package/dist/esm/operation-node/order-by-node.d.ts +14 -0
- package/dist/esm/operation-node/order-by-node.js +22 -0
- package/dist/esm/operation-node/output-node.d.ts +13 -0
- package/dist/esm/operation-node/output-node.js +24 -0
- package/dist/esm/operation-node/over-node.d.ts +19 -0
- package/dist/esm/operation-node/over-node.js +33 -0
- package/dist/esm/operation-node/parens-node.d.ts +12 -0
- package/dist/esm/operation-node/parens-node.js +16 -0
- package/dist/esm/operation-node/partition-by-item-node.d.ts +13 -0
- package/dist/esm/operation-node/partition-by-item-node.js +16 -0
- package/dist/esm/operation-node/partition-by-node.d.ts +14 -0
- package/dist/esm/operation-node/partition-by-node.js +22 -0
- package/dist/esm/operation-node/primary-key-constraint-node.d.ts +29 -0
- package/dist/esm/operation-node/primary-key-constraint-node.js +28 -0
- package/dist/esm/operation-node/primitive-value-list-node.d.ts +17 -0
- package/dist/esm/operation-node/primitive-value-list-node.js +16 -0
- package/dist/esm/operation-node/query-node.d.ts +60 -0
- package/dist/esm/operation-node/query-node.js +100 -0
- package/dist/esm/operation-node/raw-node.d.ts +16 -0
- package/dist/esm/operation-node/raw-node.js +26 -0
- package/dist/esm/operation-node/reference-node.d.ts +17 -0
- package/dist/esm/operation-node/reference-node.js +25 -0
- package/dist/esm/operation-node/references-node.d.ts +22 -0
- package/dist/esm/operation-node/references-node.js +36 -0
- package/dist/esm/operation-node/refresh-materialized-view-node.d.ts +17 -0
- package/dist/esm/operation-node/refresh-materialized-view-node.js +23 -0
- package/dist/esm/operation-node/rename-column-node.d.ts +14 -0
- package/dist/esm/operation-node/rename-column-node.js +18 -0
- package/dist/esm/operation-node/rename-constraint-node.d.ts +14 -0
- package/dist/esm/operation-node/rename-constraint-node.js +18 -0
- package/dist/esm/operation-node/returning-node.d.ts +14 -0
- package/dist/esm/operation-node/returning-node.js +24 -0
- package/dist/esm/operation-node/schemable-identifier-node.d.ts +15 -0
- package/dist/esm/operation-node/schemable-identifier-node.js +24 -0
- package/dist/esm/operation-node/select-all-node.d.ts +11 -0
- package/dist/esm/operation-node/select-all-node.js +15 -0
- package/dist/esm/operation-node/select-modifier-node.d.ts +16 -0
- package/dist/esm/operation-node/select-modifier-node.js +23 -0
- package/dist/esm/operation-node/select-query-node.d.ts +67 -0
- package/dist/esm/operation-node/select-query-node.js +127 -0
- package/dist/esm/operation-node/selection-node.d.ts +20 -0
- package/dist/esm/operation-node/selection-node.js +30 -0
- package/dist/esm/operation-node/set-operation-node.d.ts +15 -0
- package/dist/esm/operation-node/set-operation-node.js +18 -0
- package/dist/esm/operation-node/simple-reference-expression-node.d.ts +3 -0
- package/dist/esm/operation-node/simple-reference-expression-node.js +2 -0
- package/dist/esm/operation-node/table-node.d.ts +14 -0
- package/dist/esm/operation-node/table-node.js +23 -0
- package/dist/esm/operation-node/top-node.d.ts +14 -0
- package/dist/esm/operation-node/top-node.js +17 -0
- package/dist/esm/operation-node/tuple-node.d.ts +12 -0
- package/dist/esm/operation-node/tuple-node.js +16 -0
- package/dist/esm/operation-node/unary-operation-node.d.ts +13 -0
- package/dist/esm/operation-node/unary-operation-node.js +17 -0
- package/dist/esm/operation-node/unique-constraint-node.d.ts +20 -0
- package/dist/esm/operation-node/unique-constraint-node.js +26 -0
- package/dist/esm/operation-node/update-query-node.d.ts +39 -0
- package/dist/esm/operation-node/update-query-node.js +48 -0
- package/dist/esm/operation-node/using-node.d.ts +13 -0
- package/dist/esm/operation-node/using-node.js +22 -0
- package/dist/esm/operation-node/value-list-node.d.ts +12 -0
- package/dist/esm/operation-node/value-list-node.js +16 -0
- package/dist/esm/operation-node/value-node.d.ts +14 -0
- package/dist/esm/operation-node/value-node.js +23 -0
- package/dist/esm/operation-node/values-node.d.ts +15 -0
- package/dist/esm/operation-node/values-node.js +16 -0
- package/dist/esm/operation-node/when-node.d.ts +14 -0
- package/dist/esm/operation-node/when-node.js +22 -0
- package/dist/esm/operation-node/where-node.d.ts +13 -0
- package/dist/esm/operation-node/where-node.js +26 -0
- package/dist/esm/operation-node/with-node.d.ts +16 -0
- package/dist/esm/operation-node/with-node.js +23 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/parser/binary-operation-parser.d.ts +21 -0
- package/dist/esm/parser/binary-operation-parser.js +68 -0
- package/dist/esm/parser/coalesce-parser.d.ts +12 -0
- package/dist/esm/parser/coalesce-parser.js +2 -0
- package/dist/esm/parser/collate-parser.d.ts +1 -0
- package/dist/esm/parser/collate-parser.js +2 -0
- package/dist/esm/parser/data-type-parser.d.ts +5 -0
- package/dist/esm/parser/data-type-parser.js +12 -0
- package/dist/esm/parser/default-value-parser.d.ts +4 -0
- package/dist/esm/parser/default-value-parser.js +8 -0
- package/dist/esm/parser/delete-from-parser.d.ts +9 -0
- package/dist/esm/parser/delete-from-parser.js +2 -0
- package/dist/esm/parser/expression-parser.d.ts +20 -0
- package/dist/esm/parser/expression-parser.js +26 -0
- package/dist/esm/parser/fetch-parser.d.ts +2 -0
- package/dist/esm/parser/fetch-parser.js +15 -0
- package/dist/esm/parser/group-by-parser.d.ts +6 -0
- package/dist/esm/parser/group-by-parser.js +9 -0
- package/dist/esm/parser/identifier-parser.d.ts +2 -0
- package/dist/esm/parser/identifier-parser.js +20 -0
- package/dist/esm/parser/insert-values-parser.d.ts +14 -0
- package/dist/esm/parser/insert-values-parser.js +62 -0
- package/dist/esm/parser/join-parser.d.ts +10 -0
- package/dist/esm/parser/join-parser.js +28 -0
- package/dist/esm/parser/merge-into-parser.d.ts +7 -0
- package/dist/esm/parser/merge-into-parser.js +2 -0
- package/dist/esm/parser/merge-parser.d.ts +9 -0
- package/dist/esm/parser/merge-parser.js +28 -0
- package/dist/esm/parser/on-commit-action-parse.d.ts +2 -0
- package/dist/esm/parser/on-commit-action-parse.js +8 -0
- package/dist/esm/parser/on-modify-action-parser.d.ts +2 -0
- package/dist/esm/parser/on-modify-action-parser.js +8 -0
- package/dist/esm/parser/order-by-parser.d.ts +25 -0
- package/dist/esm/parser/order-by-parser.js +67 -0
- package/dist/esm/parser/parse-utils.d.ts +10 -0
- package/dist/esm/parser/parse-utils.js +33 -0
- package/dist/esm/parser/partition-by-parser.d.ts +6 -0
- package/dist/esm/parser/partition-by-parser.js +6 -0
- package/dist/esm/parser/reference-parser.d.ts +31 -0
- package/dist/esm/parser/reference-parser.js +95 -0
- package/dist/esm/parser/returning-parser.d.ts +8 -0
- package/dist/esm/parser/returning-parser.js +2 -0
- package/dist/esm/parser/savepoint-parser.d.ts +4 -0
- package/dist/esm/parser/savepoint-parser.js +9 -0
- package/dist/esm/parser/select-from-parser.d.ts +6 -0
- package/dist/esm/parser/select-from-parser.js +2 -0
- package/dist/esm/parser/select-parser.d.ts +36 -0
- package/dist/esm/parser/select-parser.js +47 -0
- package/dist/esm/parser/set-operation-parser.d.ts +5 -0
- package/dist/esm/parser/set-operation-parser.js +14 -0
- package/dist/esm/parser/table-parser.d.ts +24 -0
- package/dist/esm/parser/table-parser.js +49 -0
- package/dist/esm/parser/top-parser.d.ts +2 -0
- package/dist/esm/parser/top-parser.js +17 -0
- package/dist/esm/parser/tuple-parser.d.ts +47 -0
- package/dist/esm/parser/tuple-parser.js +2 -0
- package/dist/esm/parser/unary-operation-parser.d.ts +8 -0
- package/dist/esm/parser/unary-operation-parser.js +13 -0
- package/dist/esm/parser/update-parser.d.ts +9 -0
- package/dist/esm/parser/update-parser.js +2 -0
- package/dist/esm/parser/update-set-parser.d.ts +16 -0
- package/dist/esm/parser/update-set-parser.js +23 -0
- package/dist/esm/parser/value-parser.d.ts +13 -0
- package/dist/esm/parser/value-parser.js +33 -0
- package/dist/esm/parser/with-parser.d.ts +45 -0
- package/dist/esm/parser/with-parser.js +31 -0
- package/dist/esm/performance/query-analyzer.d.ts +89 -0
- package/dist/esm/performance/query-analyzer.js +260 -0
- package/dist/esm/plugin/camel-case/camel-case-plugin.d.ts +170 -0
- package/dist/esm/plugin/camel-case/camel-case-plugin.js +119 -0
- package/dist/esm/plugin/camel-case/camel-case-transformer.d.ts +9 -0
- package/dist/esm/plugin/camel-case/camel-case-transformer.js +16 -0
- package/dist/esm/plugin/camel-case/camel-case.d.ts +15 -0
- package/dist/esm/plugin/camel-case/camel-case.js +108 -0
- package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-plugin.d.ts +70 -0
- package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-plugin.js +16 -0
- package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-transformer.d.ts +11 -0
- package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-transformer.js +39 -0
- package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.d.ts +211 -0
- package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.js +159 -0
- package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.d.ts +8 -0
- package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.js +26 -0
- package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists.d.ts +44 -0
- package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists.js +63 -0
- package/dist/esm/plugin/immediate-value/immediate-value-plugin.d.ts +73 -0
- package/dist/esm/plugin/immediate-value/immediate-value-plugin.js +19 -0
- package/dist/esm/plugin/immediate-value/immediate-value-transformer.d.ts +15 -0
- package/dist/esm/plugin/immediate-value/immediate-value-transformer.js +20 -0
- package/dist/esm/plugin/kysely-plugin.d.ts +72 -0
- package/dist/esm/plugin/kysely-plugin.js +2 -0
- package/dist/esm/plugin/noop-plugin.d.ts +64 -0
- package/dist/esm/plugin/noop-plugin.js +9 -0
- package/dist/esm/plugin/parse-json-results/parse-json-results-plugin.d.ts +126 -0
- package/dist/esm/plugin/parse-json-results/parse-json-results-plugin.js +104 -0
- package/dist/esm/plugin/with-schema/with-schema-plugin.d.ts +66 -0
- package/dist/esm/plugin/with-schema/with-schema-plugin.js +14 -0
- package/dist/esm/plugin/with-schema/with-schema-transformer.d.ts +16 -0
- package/dist/esm/plugin/with-schema/with-schema-transformer.js +178 -0
- package/dist/esm/query-builder/aggregate-function-builder.d.ts +379 -0
- package/dist/esm/query-builder/aggregate-function-builder.js +238 -0
- package/dist/esm/query-builder/case-builder.d.ts +112 -0
- package/dist/esm/query-builder/case-builder.js +73 -0
- package/dist/esm/query-builder/cte-builder.d.ts +20 -0
- package/dist/esm/query-builder/cte-builder.js +34 -0
- package/dist/esm/query-builder/delete-query-builder.d.ts +1348 -0
- package/dist/esm/query-builder/delete-query-builder.js +501 -0
- package/dist/esm/query-builder/delete-result.d.ts +4 -0
- package/dist/esm/query-builder/delete-result.js +7 -0
- package/dist/esm/query-builder/function-module.d.ts +592 -0
- package/dist/esm/query-builder/function-module.js +60 -0
- package/dist/esm/query-builder/having-interface.d.ts +15 -0
- package/dist/esm/query-builder/having-interface.js +2 -0
- package/dist/esm/query-builder/insert-query-builder.d.ts +1235 -0
- package/dist/esm/query-builder/insert-query-builder.js +1157 -0
- package/dist/esm/query-builder/insert-result.d.ts +46 -0
- package/dist/esm/query-builder/insert-result.js +50 -0
- package/dist/esm/query-builder/join-builder.d.ts +38 -0
- package/dist/esm/query-builder/join-builder.js +48 -0
- package/dist/esm/query-builder/json-path-builder.d.ts +294 -0
- package/dist/esm/query-builder/json-path-builder.js +195 -0
- package/dist/esm/query-builder/merge-query-builder.d.ts +1001 -0
- package/dist/esm/query-builder/merge-query-builder.js +624 -0
- package/dist/esm/query-builder/merge-result.d.ts +4 -0
- package/dist/esm/query-builder/merge-result.js +7 -0
- package/dist/esm/query-builder/no-result-error.d.ts +10 -0
- package/dist/esm/query-builder/no-result-error.js +14 -0
- package/dist/esm/query-builder/on-conflict-builder.d.ts +872 -0
- package/dist/esm/query-builder/on-conflict-builder.js +254 -0
- package/dist/esm/query-builder/order-by-interface.d.ts +158 -0
- package/dist/esm/query-builder/order-by-interface.js +2 -0
- package/dist/esm/query-builder/order-by-item-builder.d.ts +43 -0
- package/dist/esm/query-builder/order-by-item-builder.js +72 -0
- package/dist/esm/query-builder/output-interface.d.ts +138 -0
- package/dist/esm/query-builder/output-interface.js +2 -0
- package/dist/esm/query-builder/over-builder.d.ts +101 -0
- package/dist/esm/query-builder/over-builder.js +37 -0
- package/dist/esm/query-builder/returning-interface.d.ts +91 -0
- package/dist/esm/query-builder/returning-interface.js +2 -0
- package/dist/esm/query-builder/select-query-builder-expression.d.ts +28 -0
- package/dist/esm/query-builder/select-query-builder-expression.js +2 -0
- package/dist/esm/query-builder/select-query-builder.d.ts +2391 -0
- package/dist/esm/query-builder/select-query-builder.js +374 -0
- package/dist/esm/query-builder/update-query-builder.d.ts +1392 -0
- package/dist/esm/query-builder/update-query-builder.js +510 -0
- package/dist/esm/query-builder/update-result.d.ts +14 -0
- package/dist/esm/query-builder/update-result.js +18 -0
- package/dist/esm/query-builder/where-interface.d.ts +382 -0
- package/dist/esm/query-builder/where-interface.js +2 -0
- package/dist/esm/query-compiler/compiled-query.d.ts +11 -0
- package/dist/esm/query-compiler/compiled-query.js +14 -0
- package/dist/esm/query-compiler/default-query-compiler.d.ts +235 -0
- package/dist/esm/query-compiler/default-query-compiler.js +1387 -0
- package/dist/esm/query-compiler/query-compiler.d.ts +24 -0
- package/dist/esm/query-compiler/query-compiler.js +2 -0
- package/dist/esm/query-creator.d.ts +592 -0
- package/dist/esm/query-creator.js +619 -0
- package/dist/esm/query-executor/default-query-executor.d.ts +50 -0
- package/dist/esm/query-executor/default-query-executor.js +37 -0
- package/dist/esm/query-executor/noop-query-executor.d.ts +50 -0
- package/dist/esm/query-executor/noop-query-executor.js +34 -0
- package/dist/esm/query-executor/query-executor-base.d.ts +68 -0
- package/dist/esm/query-executor/query-executor-base.js +59 -0
- package/dist/esm/query-executor/query-executor-provider.d.ts +8 -0
- package/dist/esm/query-executor/query-executor-provider.js +2 -0
- package/dist/esm/query-executor/query-executor.d.ts +74 -0
- package/dist/esm/query-executor/query-executor.js +2 -0
- package/dist/esm/raw-builder/raw-builder.d.ts +218 -0
- package/dist/esm/raw-builder/raw-builder.js +84 -0
- package/dist/esm/raw-builder/sql.d.ts +366 -0
- package/dist/esm/raw-builder/sql.js +82 -0
- package/dist/esm/relationships/relationship-engine.d.ts +59 -0
- package/dist/esm/relationships/relationship-engine.js +203 -0
- package/dist/esm/repository/repository-factory.d.ts +54 -0
- package/dist/esm/repository/repository-factory.js +446 -0
- package/dist/esm/schema/builders/alter-column-builder.d.ts +53 -0
- package/dist/esm/schema/builders/alter-column-builder.js +70 -0
- package/dist/esm/schema/builders/alter-table-add-foreign-key-constraint-builder.d.ts +32 -0
- package/dist/esm/schema/builders/alter-table-add-foreign-key-constraint-builder.js +64 -0
- package/dist/esm/schema/builders/alter-table-add-index-builder.d.ts +138 -0
- package/dist/esm/schema/builders/alter-table-add-index-builder.js +162 -0
- package/dist/esm/schema/builders/alter-table-builder.d.ts +148 -0
- package/dist/esm/schema/builders/alter-table-builder.js +263 -0
- package/dist/esm/schema/builders/alter-table-drop-constraint-builder.d.ts +26 -0
- package/dist/esm/schema/builders/alter-table-drop-constraint-builder.js +56 -0
- package/dist/esm/schema/builders/alter-table-executor.d.ts +18 -0
- package/dist/esm/schema/builders/alter-table-executor.js +17 -0
- package/dist/esm/schema/builders/check-constraint-builder.d.ts +13 -0
- package/dist/esm/schema/builders/check-constraint-builder.js +17 -0
- package/dist/esm/schema/builders/column-definition-builder.d.ts +514 -0
- package/dist/esm/schema/builders/column-definition-builder.js +597 -0
- package/dist/esm/schema/builders/create-index-builder.d.ts +173 -0
- package/dist/esm/schema/builders/create-index-builder.js +199 -0
- package/dist/esm/schema/builders/create-schema-builder.d.ts +24 -0
- package/dist/esm/schema/builders/create-schema-builder.js +31 -0
- package/dist/esm/schema/builders/create-table-builder.d.ts +331 -0
- package/dist/esm/schema/builders/create-table-builder.js +408 -0
- package/dist/esm/schema/builders/create-type-builder.d.ts +33 -0
- package/dist/esm/schema/builders/create-type-builder.js +40 -0
- package/dist/esm/schema/builders/create-view-builder.d.ts +48 -0
- package/dist/esm/schema/builders/create-view-builder.js +95 -0
- package/dist/esm/schema/builders/drop-index-builder.d.ts +30 -0
- package/dist/esm/schema/builders/drop-index-builder.js +54 -0
- package/dist/esm/schema/builders/drop-schema-builder.d.ts +25 -0
- package/dist/esm/schema/builders/drop-schema-builder.js +41 -0
- package/dist/esm/schema/builders/drop-table-builder.d.ts +25 -0
- package/dist/esm/schema/builders/drop-table-builder.js +41 -0
- package/dist/esm/schema/builders/drop-type-builder.d.ts +24 -0
- package/dist/esm/schema/builders/drop-type-builder.js +33 -0
- package/dist/esm/schema/builders/drop-view-builder.d.ts +26 -0
- package/dist/esm/schema/builders/drop-view-builder.js +49 -0
- package/dist/esm/schema/builders/foreign-key-constraint-builder.d.ts +28 -0
- package/dist/esm/schema/builders/foreign-key-constraint-builder.js +45 -0
- package/dist/esm/schema/builders/index.d.ts +22 -0
- package/dist/esm/schema/builders/index.js +24 -0
- package/dist/esm/schema/builders/primary-key-constraint-builder.d.ts +17 -0
- package/dist/esm/schema/builders/primary-key-constraint-builder.js +34 -0
- package/dist/esm/schema/builders/refresh-materialized-view-builder.d.ts +47 -0
- package/dist/esm/schema/builders/refresh-materialized-view-builder.js +72 -0
- package/dist/esm/schema/builders/unique-constraint-builder.d.ts +23 -0
- package/dist/esm/schema/builders/unique-constraint-builder.js +42 -0
- package/dist/esm/schema/core/coordinators/schema-discovery.coordinator.d.ts +35 -0
- package/dist/esm/schema/core/coordinators/schema-discovery.coordinator.js +60 -0
- package/dist/esm/schema/core/discovery/relationship-discovery.d.ts +36 -0
- package/dist/esm/schema/core/discovery/relationship-discovery.js +159 -0
- package/dist/esm/schema/core/discovery/table-metadata-discovery.d.ts +29 -0
- package/dist/esm/schema/core/discovery/table-metadata-discovery.js +123 -0
- package/dist/esm/schema/core/discovery/view-discovery.d.ts +36 -0
- package/dist/esm/schema/core/discovery/view-discovery.js +134 -0
- package/dist/esm/schema/core/factories/discovery-factory.d.ts +66 -0
- package/dist/esm/schema/core/factories/discovery-factory.js +119 -0
- package/dist/esm/schema/core/types/schema-discovery-types.d.ts +43 -0
- package/dist/esm/schema/core/types/schema-discovery-types.js +3 -0
- package/dist/esm/schema/core/utils/name-generator.d.ts +21 -0
- package/dist/esm/schema/core/utils/name-generator.js +52 -0
- package/dist/esm/schema/core/utils/type-mapper.d.ts +25 -0
- package/dist/esm/schema/core/utils/type-mapper.js +58 -0
- package/dist/esm/schema/dialects/sqlite/discovery/sqlite-constraint-discovery.d.ts +97 -0
- package/dist/esm/schema/dialects/sqlite/discovery/sqlite-constraint-discovery.js +530 -0
- package/dist/esm/schema/dialects/sqlite/discovery/sqlite-index-discovery.d.ts +32 -0
- package/dist/esm/schema/dialects/sqlite/discovery/sqlite-index-discovery.js +130 -0
- package/dist/esm/schema/dialects/sqlite/introspection/sqlite-schema-introspector.d.ts +31 -0
- package/dist/esm/schema/dialects/sqlite/introspection/sqlite-schema-introspector.js +189 -0
- package/dist/esm/schema/dialects/sqlite/sqlite-discovery.coordinator.d.ts +51 -0
- package/dist/esm/schema/dialects/sqlite/sqlite-discovery.coordinator.js +177 -0
- package/dist/esm/schema/index.d.ts +14 -0
- package/dist/esm/schema/index.js +21 -0
- package/dist/esm/schema/schema-discovery.d.ts +23 -0
- package/dist/esm/schema/schema-discovery.js +30 -0
- package/dist/esm/schema/schema.d.ts +230 -0
- package/dist/esm/schema/schema.js +325 -0
- package/dist/esm/schema/test/basic-schema-test.d.ts +8 -0
- package/dist/esm/schema/test/basic-schema-test.js +183 -0
- package/dist/esm/schema/test/dialect-capabilities.test.d.ts +1 -0
- package/dist/esm/schema/test/dialect-capabilities.test.js +152 -0
- package/dist/esm/schema/test/discovery-factory.test.d.ts +1 -0
- package/dist/esm/schema/test/discovery-factory.test.js +150 -0
- package/dist/esm/schema/test/error-handling.test.d.ts +1 -0
- package/dist/esm/schema/test/error-handling.test.js +148 -0
- package/dist/esm/schema/test/integration.test.d.ts +1 -0
- package/dist/esm/schema/test/integration.test.js +134 -0
- package/dist/esm/schema/test/schema-discovery-coordinator.test.d.ts +1 -0
- package/dist/esm/schema/test/schema-discovery-coordinator.test.js +138 -0
- package/dist/esm/schema/test/simple-schema-test.d.ts +5 -0
- package/dist/esm/schema/test/simple-schema-test.js +78 -0
- package/dist/esm/schema/test/sqlite-discovery-coordinator.test.d.ts +1 -0
- package/dist/esm/schema/test/sqlite-discovery-coordinator.test.js +376 -0
- package/dist/esm/schema/test/test-runner.d.ts +66 -0
- package/dist/esm/schema/test/test-runner.js +89 -0
- package/dist/esm/sqlite-migration/index.d.ts +6 -0
- package/dist/esm/sqlite-migration/index.js +14 -0
- package/dist/esm/sqlite-migration/sqlite-migration-manager.d.ts +104 -0
- package/dist/esm/sqlite-migration/sqlite-migration-manager.js +332 -0
- package/dist/esm/sqlite-migration/sqlite-migration-provider.d.ts +77 -0
- package/dist/esm/sqlite-migration/sqlite-migration-provider.js +339 -0
- package/dist/esm/testing/test-utils.d.ts +110 -0
- package/dist/esm/testing/test-utils.js +320 -0
- package/dist/esm/types/index.d.ts +155 -0
- package/dist/esm/types/index.js +5 -0
- package/dist/esm/types/type-generator.d.ts +52 -0
- package/dist/esm/types/type-generator.js +258 -0
- package/dist/esm/util/assert.d.ts +2 -0
- package/dist/esm/util/assert.js +11 -0
- package/dist/esm/util/column-type.d.ts +175 -0
- package/dist/esm/util/column-type.js +2 -0
- package/dist/esm/util/compilable.d.ts +5 -0
- package/dist/esm/util/compilable.js +5 -0
- package/dist/esm/util/deferred.d.ts +7 -0
- package/dist/esm/util/deferred.js +25 -0
- package/dist/esm/util/explainable.d.ts +40 -0
- package/dist/esm/util/explainable.js +2 -0
- package/dist/esm/util/infer-result.d.ts +48 -0
- package/dist/esm/util/infer-result.js +2 -0
- package/dist/esm/util/json-object-args.d.ts +3 -0
- package/dist/esm/util/json-object-args.js +32 -0
- package/dist/esm/util/log-once.d.ts +5 -0
- package/dist/esm/util/log-once.js +13 -0
- package/dist/esm/util/log.d.ts +26 -0
- package/dist/esm/util/log.js +55 -0
- package/dist/esm/util/object-utils.d.ts +23 -0
- package/dist/esm/util/object-utils.js +141 -0
- package/dist/esm/util/performance-now.d.ts +1 -0
- package/dist/esm/util/performance-now.js +10 -0
- package/dist/esm/util/provide-controlled-connection.d.ts +7 -0
- package/dist/esm/util/provide-controlled-connection.js +22 -0
- package/dist/esm/util/query-id.d.ts +4 -0
- package/dist/esm/util/query-id.js +14 -0
- package/dist/esm/util/random-string.d.ts +1 -0
- package/dist/esm/util/random-string.js +75 -0
- package/dist/esm/util/require-all-props.d.ts +45 -0
- package/dist/esm/util/require-all-props.js +39 -0
- package/dist/esm/util/stack-trace-utils.d.ts +1 -0
- package/dist/esm/util/stack-trace-utils.js +14 -0
- package/dist/esm/util/streamable.d.ts +29 -0
- package/dist/esm/util/streamable.js +2 -0
- package/dist/esm/util/type-error.d.ts +3 -0
- package/dist/esm/util/type-error.js +2 -0
- package/dist/esm/util/type-utils.d.ts +189 -0
- package/dist/esm/util/type-utils.js +2 -0
- package/dist/esm/utils/errorHelpers.d.ts +26 -0
- package/dist/esm/utils/errorHelpers.js +180 -0
- package/dist/esm/watch/schema-watcher.d.ts +68 -0
- package/dist/esm/watch/schema-watcher.js +183 -0
- package/outdated-typescript.d.ts +5 -0
- package/package.json +152 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
/// <reference types="./sqlite-constraint-discovery.d.ts" />
|
|
2
|
+
import { sql } from '../../../../raw-builder/sql.js';
|
|
3
|
+
/**
|
|
4
|
+
* SQLite-specific constraint discovery
|
|
5
|
+
*/
|
|
6
|
+
export class SQLiteConstraintDiscovery {
|
|
7
|
+
static instance;
|
|
8
|
+
static getInstance() {
|
|
9
|
+
if (!SQLiteConstraintDiscovery.instance) {
|
|
10
|
+
SQLiteConstraintDiscovery.instance = new SQLiteConstraintDiscovery();
|
|
11
|
+
}
|
|
12
|
+
return SQLiteConstraintDiscovery.instance;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Discover constraints from SQLite table definition
|
|
16
|
+
*/
|
|
17
|
+
async discoverTableConstraints(db, tableName) {
|
|
18
|
+
try {
|
|
19
|
+
// Get table definition from sqlite_master
|
|
20
|
+
const tableDef = await db
|
|
21
|
+
.selectFrom('sqlite_master')
|
|
22
|
+
.select('sql')
|
|
23
|
+
.where('type', '=', 'table')
|
|
24
|
+
.where('name', '=', tableName)
|
|
25
|
+
.executeTakeFirst();
|
|
26
|
+
if (!tableDef?.sql) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
return this.parseConstraintsFromSQL(tableDef.sql, tableName);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.warn(`Failed to discover constraints for SQLite table ${tableName}:`, error);
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parse constraints from SQLite CREATE TABLE statement
|
|
38
|
+
*/
|
|
39
|
+
parseConstraintsFromSQL(sql, tableName) {
|
|
40
|
+
const constraints = [];
|
|
41
|
+
// Extract column definitions and table constraints
|
|
42
|
+
const columnMatches = sql.match(/CREATE TABLE[^(]*\(([^)]+)\)/i);
|
|
43
|
+
if (!columnMatches)
|
|
44
|
+
return constraints;
|
|
45
|
+
const definitions = columnMatches[1].split(',').map(def => def.trim());
|
|
46
|
+
for (const definition of definitions) {
|
|
47
|
+
// Primary key constraints
|
|
48
|
+
if (definition.toUpperCase().includes('PRIMARY KEY')) {
|
|
49
|
+
const pkMatch = definition.match(/(\w+)\s+PRIMARY KEY/i);
|
|
50
|
+
if (pkMatch) {
|
|
51
|
+
constraints.push({
|
|
52
|
+
name: `${tableName}_pk`,
|
|
53
|
+
type: 'p',
|
|
54
|
+
columns: [pkMatch[1]],
|
|
55
|
+
definition: definition
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Foreign key constraints
|
|
60
|
+
if (definition.toUpperCase().includes('FOREIGN KEY')) {
|
|
61
|
+
const fkMatch = definition.match(/FOREIGN KEY\s*\((\w+)\)\s*REFERENCES\s+(\w+)\s*\((\w+)\)/i);
|
|
62
|
+
if (fkMatch) {
|
|
63
|
+
constraints.push({
|
|
64
|
+
name: `${tableName}_fk_${fkMatch[1]}`,
|
|
65
|
+
type: 'f',
|
|
66
|
+
column: fkMatch[1],
|
|
67
|
+
referencedTable: fkMatch[2],
|
|
68
|
+
referencedColumn: fkMatch[3],
|
|
69
|
+
definition: definition
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Check constraints
|
|
74
|
+
if (definition.toUpperCase().includes('CHECK')) {
|
|
75
|
+
const checkMatch = definition.match(/CHECK\s*\(([^)]+)\)/i);
|
|
76
|
+
if (checkMatch) {
|
|
77
|
+
constraints.push({
|
|
78
|
+
name: `${tableName}_check_${constraints.length + 1}`,
|
|
79
|
+
type: 'c',
|
|
80
|
+
definition: checkMatch[1],
|
|
81
|
+
fullDefinition: definition
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Unique constraints
|
|
86
|
+
if (definition.toUpperCase().includes('UNIQUE')) {
|
|
87
|
+
const uniqueMatch = definition.match(/UNIQUE\s*\(([^)]+)\)/i);
|
|
88
|
+
if (uniqueMatch) {
|
|
89
|
+
constraints.push({
|
|
90
|
+
name: `${tableName}_unique_${constraints.length + 1}`,
|
|
91
|
+
type: 'u',
|
|
92
|
+
columns: uniqueMatch[1].split(',').map(col => col.trim()),
|
|
93
|
+
definition: definition
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// Not null constraints
|
|
98
|
+
if (definition.toUpperCase().includes('NOT NULL')) {
|
|
99
|
+
const notNullMatch = definition.match(/(\w+)\s+[^,]+\s+NOT NULL/i);
|
|
100
|
+
if (notNullMatch) {
|
|
101
|
+
constraints.push({
|
|
102
|
+
name: `${tableName}_nn_${notNullMatch[1]}`,
|
|
103
|
+
type: 'n',
|
|
104
|
+
column: notNullMatch[1],
|
|
105
|
+
definition: definition
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return constraints;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get foreign key information using PRAGMA
|
|
114
|
+
*/
|
|
115
|
+
async getForeignKeyInfo(db, tableName) {
|
|
116
|
+
try {
|
|
117
|
+
const result = await sql `PRAGMA foreign_key_list(${sql.lit(tableName)})`.execute(db);
|
|
118
|
+
return (result.rows || []).map((row) => ({
|
|
119
|
+
name: `${tableName}_fk_${row.column}`,
|
|
120
|
+
type: 'f',
|
|
121
|
+
column: row.column,
|
|
122
|
+
referencedTable: row.table,
|
|
123
|
+
referencedColumn: row.to,
|
|
124
|
+
onDelete: row.on_delete || 'NO ACTION',
|
|
125
|
+
onUpdate: row.on_update || 'NO ACTION'
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
console.warn(`Failed to get foreign key info for SQLite table ${tableName}:`, error);
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if foreign keys are enabled
|
|
135
|
+
*/
|
|
136
|
+
async isForeignKeySupportEnabled(db) {
|
|
137
|
+
try {
|
|
138
|
+
const result = await sql `PRAGMA foreign_keys`.execute(db);
|
|
139
|
+
return result.rows?.[0]?.foreign_keys === 1;
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
console.warn('Failed to check foreign key support:', error);
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Validate SQLite constraints
|
|
148
|
+
*/
|
|
149
|
+
validateConstraints(constraints) {
|
|
150
|
+
const issues = [];
|
|
151
|
+
for (const constraint of constraints) {
|
|
152
|
+
if (!constraint.name) {
|
|
153
|
+
issues.push('Constraint name is required');
|
|
154
|
+
}
|
|
155
|
+
if (!constraint.type) {
|
|
156
|
+
issues.push(`Constraint type is required for ${constraint.name}`);
|
|
157
|
+
}
|
|
158
|
+
// Validate foreign key constraints
|
|
159
|
+
if (constraint.type === 'f') {
|
|
160
|
+
if (!constraint.column) {
|
|
161
|
+
issues.push(`Foreign key constraint ${constraint.name} missing column`);
|
|
162
|
+
}
|
|
163
|
+
if (!constraint.referencedTable) {
|
|
164
|
+
issues.push(`Foreign key constraint ${constraint.name} missing referenced table`);
|
|
165
|
+
}
|
|
166
|
+
if (!constraint.referencedColumn) {
|
|
167
|
+
issues.push(`Foreign key constraint ${constraint.name} missing referenced column`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Validate check constraints
|
|
171
|
+
if (constraint.type === 'c' && !constraint.definition) {
|
|
172
|
+
issues.push(`Check constraint ${constraint.name} missing definition`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
isValid: issues.length === 0,
|
|
177
|
+
issues
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Analyze constraint compatibility
|
|
182
|
+
*/
|
|
183
|
+
analyzeConstraintCompatibility(constraints) {
|
|
184
|
+
const recommendations = [];
|
|
185
|
+
const compatibilityIssues = [];
|
|
186
|
+
// Check for complex constraints that might not be portable
|
|
187
|
+
for (const constraint of constraints) {
|
|
188
|
+
if (constraint.type === 'c' && constraint.definition) {
|
|
189
|
+
const definition = constraint.definition.toLowerCase();
|
|
190
|
+
// Check for SQLite-specific functions
|
|
191
|
+
if (definition.includes('datetime(') || definition.includes('date(')) {
|
|
192
|
+
compatibilityIssues.push(`Check constraint ${constraint.name} uses SQLite-specific date functions`);
|
|
193
|
+
}
|
|
194
|
+
if (definition.includes('substr(') || definition.includes('length(')) {
|
|
195
|
+
compatibilityIssues.push(`Check constraint ${constraint.name} uses SQLite-specific string functions`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Recommendations for better portability
|
|
200
|
+
if (compatibilityIssues.length > 0) {
|
|
201
|
+
recommendations.push('Consider using standard SQL functions for better database portability');
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
recommendations,
|
|
205
|
+
compatibilityIssues
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Validate foreign key constraints and provide recommendations
|
|
210
|
+
*/
|
|
211
|
+
async validateForeignKeyConstraints(db) {
|
|
212
|
+
const issues = [];
|
|
213
|
+
const recommendations = [];
|
|
214
|
+
const orphanedRecords = [];
|
|
215
|
+
try {
|
|
216
|
+
// Check if foreign keys are enabled
|
|
217
|
+
const fkEnabled = await this.isForeignKeySupportEnabled(db);
|
|
218
|
+
if (!fkEnabled) {
|
|
219
|
+
issues.push('Foreign key constraints are disabled');
|
|
220
|
+
recommendations.push('Enable foreign key constraints with PRAGMA foreign_keys = ON');
|
|
221
|
+
}
|
|
222
|
+
// Get all tables with foreign keys
|
|
223
|
+
const tables = await this.getTablesWithForeignKeys(db);
|
|
224
|
+
for (const table of tables) {
|
|
225
|
+
const foreignKeys = await this.getForeignKeyInfo(db, table);
|
|
226
|
+
for (const fk of foreignKeys) {
|
|
227
|
+
// Check for orphaned records
|
|
228
|
+
const orphanedCount = await this.checkOrphanedRecords(db, table, fk);
|
|
229
|
+
if (orphanedCount > 0) {
|
|
230
|
+
orphanedRecords.push({ table, count: orphanedCount });
|
|
231
|
+
issues.push(`Table ${table} has ${orphanedCount} orphaned records for foreign key ${fk.column}`);
|
|
232
|
+
recommendations.push(`Clean up orphaned records in ${table}.${fk.column} or add proper foreign key constraints`);
|
|
233
|
+
}
|
|
234
|
+
// Check for missing indexes on foreign key columns
|
|
235
|
+
const hasIndex = await this.checkForeignKeyIndex(db, table, fk.column);
|
|
236
|
+
if (!hasIndex) {
|
|
237
|
+
recommendations.push(`Add index on ${table}.${fk.column} for better join performance`);
|
|
238
|
+
}
|
|
239
|
+
// Validate referenced table exists
|
|
240
|
+
const referencedTableExists = await this.checkTableExists(db, fk.referencedTable);
|
|
241
|
+
if (!referencedTableExists) {
|
|
242
|
+
issues.push(`Foreign key ${fk.column} references non-existent table ${fk.referencedTable}`);
|
|
243
|
+
recommendations.push(`Create table ${fk.referencedTable} or remove invalid foreign key`);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// Validate referenced column exists
|
|
247
|
+
const referencedColumnExists = await this.checkColumnExists(db, fk.referencedTable, fk.referencedColumn);
|
|
248
|
+
if (!referencedColumnExists) {
|
|
249
|
+
issues.push(`Foreign key ${fk.column} references non-existent column ${fk.referencedTable}.${fk.referencedColumn}`);
|
|
250
|
+
recommendations.push(`Add column ${fk.referencedColumn} to table ${fk.referencedTable} or fix foreign key reference`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Performance impact assessment
|
|
256
|
+
const performanceImpact = this.assessPerformanceImpact(issues, orphanedRecords);
|
|
257
|
+
return {
|
|
258
|
+
isValid: issues.length === 0,
|
|
259
|
+
issues,
|
|
260
|
+
recommendations,
|
|
261
|
+
orphanedRecords,
|
|
262
|
+
performanceImpact
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
issues.push(`Foreign key validation failed: ${error}`);
|
|
267
|
+
return {
|
|
268
|
+
isValid: false,
|
|
269
|
+
issues,
|
|
270
|
+
recommendations: ['Check database connection and permissions'],
|
|
271
|
+
orphanedRecords: [],
|
|
272
|
+
performanceImpact: 'high'
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get tables that have foreign key constraints
|
|
278
|
+
*/
|
|
279
|
+
async getTablesWithForeignKeys(db) {
|
|
280
|
+
try {
|
|
281
|
+
const result = await db
|
|
282
|
+
.selectFrom('sqlite_master')
|
|
283
|
+
.select('name')
|
|
284
|
+
.where('type', '=', 'table')
|
|
285
|
+
.where('name', 'not like', 'sqlite_%')
|
|
286
|
+
.execute();
|
|
287
|
+
const tablesWithFks = [];
|
|
288
|
+
for (const row of result) {
|
|
289
|
+
const fks = await this.getForeignKeyInfo(db, row.name);
|
|
290
|
+
if (fks.length > 0) {
|
|
291
|
+
tablesWithFks.push(row.name);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return tablesWithFks;
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Check for orphaned records in foreign key relationships
|
|
302
|
+
*/
|
|
303
|
+
async checkOrphanedRecords(db, table, foreignKey) {
|
|
304
|
+
try {
|
|
305
|
+
// Use a simpler approach to avoid type issues
|
|
306
|
+
const result = await sql `
|
|
307
|
+
SELECT COUNT(*) as count
|
|
308
|
+
FROM ${sql.id(table)} t
|
|
309
|
+
LEFT JOIN ${sql.id(foreignKey.referencedTable)} r
|
|
310
|
+
ON t.${sql.id(foreignKey.column)} = r.${sql.id(foreignKey.referencedColumn)}
|
|
311
|
+
WHERE r.${sql.id(foreignKey.referencedColumn)} IS NULL
|
|
312
|
+
`.execute(db);
|
|
313
|
+
return Number(result.rows[0]?.count || 0);
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
return 0;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Check if foreign key column has an index
|
|
321
|
+
*/
|
|
322
|
+
async checkForeignKeyIndex(db, table, column) {
|
|
323
|
+
try {
|
|
324
|
+
const result = await db
|
|
325
|
+
.selectFrom('sqlite_master')
|
|
326
|
+
.select('sql')
|
|
327
|
+
.where('type', '=', 'index')
|
|
328
|
+
.where('tbl_name', '=', table)
|
|
329
|
+
.execute();
|
|
330
|
+
for (const row of result) {
|
|
331
|
+
if (row.sql && row.sql.includes(column)) {
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Check if table exists
|
|
343
|
+
*/
|
|
344
|
+
async checkTableExists(db, tableName) {
|
|
345
|
+
try {
|
|
346
|
+
const result = await db
|
|
347
|
+
.selectFrom('sqlite_master')
|
|
348
|
+
.select('name')
|
|
349
|
+
.where('type', '=', 'table')
|
|
350
|
+
.where('name', '=', tableName)
|
|
351
|
+
.executeTakeFirst();
|
|
352
|
+
return !!result;
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Check if column exists in table
|
|
360
|
+
*/
|
|
361
|
+
async checkColumnExists(db, tableName, columnName) {
|
|
362
|
+
try {
|
|
363
|
+
const result = await db
|
|
364
|
+
.selectFrom('sqlite_master')
|
|
365
|
+
.select('sql')
|
|
366
|
+
.where('type', '=', 'table')
|
|
367
|
+
.where('name', '=', tableName)
|
|
368
|
+
.executeTakeFirst();
|
|
369
|
+
if (!result?.sql)
|
|
370
|
+
return false;
|
|
371
|
+
// Parse column names from CREATE TABLE statement
|
|
372
|
+
const columnMatch = result.sql.match(/CREATE TABLE[^(]*\(([^)]+)\)/i);
|
|
373
|
+
if (!columnMatch)
|
|
374
|
+
return false;
|
|
375
|
+
const columns = columnMatch[1]
|
|
376
|
+
.split(',')
|
|
377
|
+
.map((col) => col.trim())
|
|
378
|
+
.map((col) => col.split(/\s+/)[0].replace(/["`]/g, ''));
|
|
379
|
+
return columns.includes(columnName);
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Assess performance impact of foreign key issues
|
|
387
|
+
*/
|
|
388
|
+
assessPerformanceImpact(issues, orphanedRecords) {
|
|
389
|
+
const totalOrphaned = orphanedRecords.reduce((sum, record) => sum + record.count, 0);
|
|
390
|
+
if (issues.length > 5 || totalOrphaned > 1000)
|
|
391
|
+
return 'high';
|
|
392
|
+
if (issues.length > 2 || totalOrphaned > 100)
|
|
393
|
+
return 'medium';
|
|
394
|
+
return 'low';
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Generate foreign key optimization recommendations
|
|
398
|
+
*/
|
|
399
|
+
async generateForeignKeyOptimizations(db) {
|
|
400
|
+
const indexRecommendations = [];
|
|
401
|
+
const constraintRecommendations = [];
|
|
402
|
+
const cleanupRecommendations = [];
|
|
403
|
+
const performanceRecommendations = [];
|
|
404
|
+
try {
|
|
405
|
+
// Check foreign key support
|
|
406
|
+
const fkEnabled = await this.isForeignKeySupportEnabled(db);
|
|
407
|
+
if (!fkEnabled) {
|
|
408
|
+
constraintRecommendations.push('PRAGMA foreign_keys = ON');
|
|
409
|
+
}
|
|
410
|
+
// Get all foreign key relationships
|
|
411
|
+
const tables = await this.getTablesWithForeignKeys(db);
|
|
412
|
+
for (const table of tables) {
|
|
413
|
+
const foreignKeys = await this.getForeignKeyInfo(db, table);
|
|
414
|
+
for (const fk of foreignKeys) {
|
|
415
|
+
// Index recommendations
|
|
416
|
+
const hasIndex = await this.checkForeignKeyIndex(db, table, fk.column);
|
|
417
|
+
if (!hasIndex) {
|
|
418
|
+
indexRecommendations.push(`CREATE INDEX idx_${table}_${fk.column} ON ${table} (${fk.column})`);
|
|
419
|
+
}
|
|
420
|
+
// Check for orphaned records
|
|
421
|
+
const orphanedCount = await this.checkOrphanedRecords(db, table, fk);
|
|
422
|
+
if (orphanedCount > 0) {
|
|
423
|
+
cleanupRecommendations.push(`DELETE FROM ${table} WHERE ${fk.column} NOT IN (SELECT ${fk.referencedColumn} FROM ${fk.referencedTable})`);
|
|
424
|
+
}
|
|
425
|
+
// Performance recommendations
|
|
426
|
+
if (orphanedCount > 100) {
|
|
427
|
+
performanceRecommendations.push(`Consider adding CASCADE DELETE to foreign key ${fk.column} for automatic cleanup`);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
// General performance recommendations
|
|
432
|
+
if (tables.length > 10) {
|
|
433
|
+
performanceRecommendations.push('Consider using deferred foreign key constraints for bulk operations');
|
|
434
|
+
}
|
|
435
|
+
return {
|
|
436
|
+
indexRecommendations,
|
|
437
|
+
constraintRecommendations,
|
|
438
|
+
cleanupRecommendations,
|
|
439
|
+
performanceRecommendations
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
return {
|
|
444
|
+
indexRecommendations: [],
|
|
445
|
+
constraintRecommendations: [],
|
|
446
|
+
cleanupRecommendations: [],
|
|
447
|
+
performanceRecommendations: [`Error generating recommendations: ${error}`]
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Auto-fix common foreign key issues
|
|
453
|
+
*/
|
|
454
|
+
async autoFixForeignKeyIssues(db, options = {}) {
|
|
455
|
+
const { createMissingIndexes = true, enableForeignKeys = true, cleanupOrphanedRecords = false, dryRun = true } = options;
|
|
456
|
+
const applied = [];
|
|
457
|
+
const failed = [];
|
|
458
|
+
const skipped = [];
|
|
459
|
+
try {
|
|
460
|
+
// Enable foreign keys
|
|
461
|
+
if (enableForeignKeys) {
|
|
462
|
+
const fkEnabled = await this.isForeignKeySupportEnabled(db);
|
|
463
|
+
if (!fkEnabled) {
|
|
464
|
+
if (!dryRun) {
|
|
465
|
+
await sql `PRAGMA foreign_keys = ON`.execute(db);
|
|
466
|
+
}
|
|
467
|
+
applied.push('Enabled foreign key constraints');
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
skipped.push('Foreign key constraints already enabled');
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// Create missing indexes
|
|
474
|
+
if (createMissingIndexes) {
|
|
475
|
+
const tables = await this.getTablesWithForeignKeys(db);
|
|
476
|
+
for (const table of tables) {
|
|
477
|
+
const foreignKeys = await this.getForeignKeyInfo(db, table);
|
|
478
|
+
for (const fk of foreignKeys) {
|
|
479
|
+
const hasIndex = await this.checkForeignKeyIndex(db, table, fk.column);
|
|
480
|
+
if (!hasIndex) {
|
|
481
|
+
const indexSQL = `CREATE INDEX idx_${table}_${fk.column} ON ${table} (${fk.column})`;
|
|
482
|
+
if (!dryRun) {
|
|
483
|
+
try {
|
|
484
|
+
await sql.raw(indexSQL).execute(db);
|
|
485
|
+
applied.push(`Created index on ${table}.${fk.column}`);
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
failed.push(`Failed to create index on ${table}.${fk.column}: ${error}`);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
applied.push(`Would create index on ${table}.${fk.column}`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
// Cleanup orphaned records
|
|
499
|
+
if (cleanupOrphanedRecords) {
|
|
500
|
+
const tables = await this.getTablesWithForeignKeys(db);
|
|
501
|
+
for (const table of tables) {
|
|
502
|
+
const foreignKeys = await this.getForeignKeyInfo(db, table);
|
|
503
|
+
for (const fk of foreignKeys) {
|
|
504
|
+
const orphanedCount = await this.checkOrphanedRecords(db, table, fk);
|
|
505
|
+
if (orphanedCount > 0) {
|
|
506
|
+
const cleanupSQL = `DELETE FROM ${table} WHERE ${fk.column} NOT IN (SELECT ${fk.referencedColumn} FROM ${fk.referencedTable})`;
|
|
507
|
+
if (!dryRun) {
|
|
508
|
+
try {
|
|
509
|
+
await sql.raw(cleanupSQL).execute(db);
|
|
510
|
+
applied.push(`Cleaned up ${orphanedCount} orphaned records in ${table}.${fk.column}`);
|
|
511
|
+
}
|
|
512
|
+
catch (error) {
|
|
513
|
+
failed.push(`Failed to cleanup orphaned records in ${table}.${fk.column}: ${error}`);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
applied.push(`Would cleanup ${orphanedCount} orphaned records in ${table}.${fk.column}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return { applied, failed, skipped };
|
|
524
|
+
}
|
|
525
|
+
catch (error) {
|
|
526
|
+
failed.push(`Auto-fix failed: ${error}`);
|
|
527
|
+
return { applied, failed, skipped };
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Kysely } from '../../../../kysely.js';
|
|
2
|
+
/**
|
|
3
|
+
* SQLite-specific index discovery
|
|
4
|
+
*/
|
|
5
|
+
export declare class SQLiteIndexDiscovery {
|
|
6
|
+
private static instance;
|
|
7
|
+
static getInstance(): SQLiteIndexDiscovery;
|
|
8
|
+
/**
|
|
9
|
+
* Discover indexes for a specific table in SQLite
|
|
10
|
+
*/
|
|
11
|
+
discoverTableIndexes(db: Kysely<any>, tableName: string): Promise<any[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Extract column names from SQLite index definition
|
|
14
|
+
*/
|
|
15
|
+
private extractColumnsFromSQL;
|
|
16
|
+
/**
|
|
17
|
+
* Get index information from pragma
|
|
18
|
+
*/
|
|
19
|
+
getIndexInfo(db: Kysely<any>, tableName: string): Promise<any[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Analyze SQLite index efficiency
|
|
22
|
+
*/
|
|
23
|
+
analyzeIndexEfficiency(indexes: any[]): {
|
|
24
|
+
recommendations: string[];
|
|
25
|
+
missingIndexes: string[];
|
|
26
|
+
redundantIndexes: string[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Get table size information for SQLite
|
|
30
|
+
*/
|
|
31
|
+
getTableSize(db: Kysely<any>, tableName: string): Promise<any>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/// <reference types="./sqlite-index-discovery.d.ts" />
|
|
2
|
+
import { sql } from '../../../../raw-builder/sql.js';
|
|
3
|
+
/**
|
|
4
|
+
* SQLite-specific index discovery
|
|
5
|
+
*/
|
|
6
|
+
export class SQLiteIndexDiscovery {
|
|
7
|
+
static instance;
|
|
8
|
+
static getInstance() {
|
|
9
|
+
if (!SQLiteIndexDiscovery.instance) {
|
|
10
|
+
SQLiteIndexDiscovery.instance = new SQLiteIndexDiscovery();
|
|
11
|
+
}
|
|
12
|
+
return SQLiteIndexDiscovery.instance;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Discover indexes for a specific table in SQLite
|
|
16
|
+
*/
|
|
17
|
+
async discoverTableIndexes(db, tableName) {
|
|
18
|
+
try {
|
|
19
|
+
const indexes = await db
|
|
20
|
+
.selectFrom('sqlite_master')
|
|
21
|
+
.select([
|
|
22
|
+
'name',
|
|
23
|
+
'sql as definition',
|
|
24
|
+
sql `type = 'index'`.as('isIndex'),
|
|
25
|
+
sql `sql LIKE '%UNIQUE%'`.as('unique')
|
|
26
|
+
])
|
|
27
|
+
.where('type', '=', 'index')
|
|
28
|
+
.where('tbl_name', '=', tableName)
|
|
29
|
+
.execute();
|
|
30
|
+
// Parse column information from SQL definition
|
|
31
|
+
const processedIndexes = indexes.map((index) => ({
|
|
32
|
+
...index,
|
|
33
|
+
columns: this.extractColumnsFromSQL(index.definition),
|
|
34
|
+
isPrimary: index.name.includes('sqlite_autoindex'),
|
|
35
|
+
comment: null // SQLite doesn't support index comments
|
|
36
|
+
}));
|
|
37
|
+
return processedIndexes;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.warn(`Failed to discover indexes for SQLite table ${tableName}:`, error);
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Extract column names from SQLite index definition
|
|
46
|
+
*/
|
|
47
|
+
extractColumnsFromSQL(sql) {
|
|
48
|
+
if (!sql)
|
|
49
|
+
return [];
|
|
50
|
+
// Parse columns from CREATE INDEX statement
|
|
51
|
+
// Example: CREATE INDEX idx_name ON table (col1, col2)
|
|
52
|
+
const match = sql.match(/\(([^)]+)\)/);
|
|
53
|
+
if (match) {
|
|
54
|
+
return match[1]
|
|
55
|
+
.split(',')
|
|
56
|
+
.map(col => col.trim().replace(/^\s*["']?|["']?\s*$/g, ''))
|
|
57
|
+
.filter(col => col.length > 0);
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get index information from pragma
|
|
63
|
+
*/
|
|
64
|
+
async getIndexInfo(db, tableName) {
|
|
65
|
+
try {
|
|
66
|
+
// SQLite pragma index_info
|
|
67
|
+
const result = await sql `PRAGMA index_list(${sql.lit(tableName)})`.execute(db);
|
|
68
|
+
return result.rows || [];
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.warn(`Failed to get index info for SQLite table ${tableName}:`, error);
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Analyze SQLite index efficiency
|
|
77
|
+
*/
|
|
78
|
+
analyzeIndexEfficiency(indexes) {
|
|
79
|
+
const recommendations = [];
|
|
80
|
+
const missingIndexes = [];
|
|
81
|
+
const redundantIndexes = [];
|
|
82
|
+
// Check for auto-generated indexes that might be redundant
|
|
83
|
+
const autoIndexes = indexes.filter(idx => idx.isPrimary);
|
|
84
|
+
if (autoIndexes.length > 1) {
|
|
85
|
+
recommendations.push('Multiple auto-generated indexes found - review table structure');
|
|
86
|
+
}
|
|
87
|
+
// Check for indexes with no columns (invalid)
|
|
88
|
+
const invalidIndexes = indexes.filter(idx => !idx.columns || idx.columns.length === 0);
|
|
89
|
+
for (const idx of invalidIndexes) {
|
|
90
|
+
recommendations.push(`Invalid index found: ${idx.name} (no columns)`);
|
|
91
|
+
}
|
|
92
|
+
// Check for duplicate column combinations
|
|
93
|
+
const columnGroups = new Map();
|
|
94
|
+
for (const index of indexes) {
|
|
95
|
+
const key = index.columns.sort().join(',');
|
|
96
|
+
if (!columnGroups.has(key)) {
|
|
97
|
+
columnGroups.set(key, []);
|
|
98
|
+
}
|
|
99
|
+
columnGroups.get(key).push(index.name);
|
|
100
|
+
}
|
|
101
|
+
for (const [columns, names] of columnGroups) {
|
|
102
|
+
if (names.length > 1) {
|
|
103
|
+
redundantIndexes.push(...names);
|
|
104
|
+
recommendations.push(`Redundant indexes on columns (${columns}): ${names.join(', ')}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
recommendations,
|
|
109
|
+
missingIndexes,
|
|
110
|
+
redundantIndexes
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get table size information for SQLite
|
|
115
|
+
*/
|
|
116
|
+
async getTableSize(db, tableName) {
|
|
117
|
+
try {
|
|
118
|
+
const result = await sql `SELECT COUNT(*) as rowCount FROM ${sql.id(tableName)}`.execute(db);
|
|
119
|
+
return {
|
|
120
|
+
rowCount: result.rows?.[0]?.rowCount || 0,
|
|
121
|
+
size: 0, // SQLite doesn't provide direct size info
|
|
122
|
+
lastModified: new Date()
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.warn(`Failed to get table size for SQLite table ${tableName}:`, error);
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|