@warlock.js/cascade 4.0.174 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/bin/cascadejs +3 -0
- package/esm/cli/commands/migrate-export-sql.mjs +48 -0
- package/esm/cli/commands/migrate-export-sql.mjs.map +1 -0
- package/esm/cli/commands/migrate-list.mjs +26 -0
- package/esm/cli/commands/migrate-list.mjs.map +1 -0
- package/esm/cli/commands/migrate-rollback.mjs +50 -0
- package/esm/cli/commands/migrate-rollback.mjs.map +1 -0
- package/esm/cli/commands/migrate.mjs +65 -0
- package/esm/cli/commands/migrate.mjs.map +1 -0
- package/esm/cli/connection-from-env.mjs +181 -0
- package/esm/cli/connection-from-env.mjs.map +1 -0
- package/esm/cli/index.mjs +31 -0
- package/esm/cli/index.mjs.map +1 -0
- package/esm/cli/load-migrations.mjs +78 -0
- package/esm/cli/load-migrations.mjs.map +1 -0
- package/esm/cli/printers.mjs +57 -0
- package/esm/cli/printers.mjs.map +1 -0
- package/esm/cli/setup-logger.mjs +30 -0
- package/esm/cli/setup-logger.mjs.map +1 -0
- package/esm/cli/with-cli-connection.mjs +39 -0
- package/esm/cli/with-cli-connection.mjs.map +1 -0
- package/esm/cli.d.mts +1 -0
- package/esm/cli.mjs +26 -0
- package/esm/cli.mjs.map +1 -0
- package/esm/context/database-data-source-context.d.mts +32 -0
- package/esm/context/database-data-source-context.d.mts.map +1 -0
- package/esm/context/database-data-source-context.mjs +35 -0
- package/esm/context/database-data-source-context.mjs.map +1 -0
- package/esm/context/database-transaction-context.d.mts +38 -0
- package/esm/context/database-transaction-context.d.mts.map +1 -0
- package/esm/context/database-transaction-context.mjs +47 -0
- package/esm/context/database-transaction-context.mjs.map +1 -0
- package/esm/contracts/database-driver.contract.d.mts +443 -0
- package/esm/contracts/database-driver.contract.d.mts.map +1 -0
- package/esm/contracts/database-id-generator.contract.d.mts +109 -0
- package/esm/contracts/database-id-generator.contract.d.mts.map +1 -0
- package/esm/contracts/database-remover.contract.d.mts +108 -0
- package/esm/contracts/database-remover.contract.d.mts.map +1 -0
- package/esm/contracts/database-restorer.contract.d.mts +145 -0
- package/esm/contracts/database-restorer.contract.d.mts.map +1 -0
- package/esm/contracts/database-writer.contract.d.mts +123 -0
- package/esm/contracts/database-writer.contract.d.mts.map +1 -0
- package/esm/contracts/driver-blueprint.contract.d.mts +52 -0
- package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -0
- package/esm/contracts/index.d.mts +9 -0
- package/esm/contracts/migration-driver.contract.d.mts +476 -0
- package/esm/contracts/migration-driver.contract.d.mts.map +1 -0
- package/esm/contracts/query-builder.contract.d.mts +1663 -0
- package/esm/contracts/query-builder.contract.d.mts.map +1 -0
- package/esm/contracts/sync-adapter.contract.d.mts +49 -0
- package/esm/contracts/sync-adapter.contract.d.mts.map +1 -0
- package/esm/data-source/data-source-registry.d.mts +111 -0
- package/esm/data-source/data-source-registry.d.mts.map +1 -0
- package/esm/data-source/data-source-registry.mjs +142 -0
- package/esm/data-source/data-source-registry.mjs.map +1 -0
- package/esm/data-source/data-source.d.mts +160 -0
- package/esm/data-source/data-source.d.mts.map +1 -0
- package/esm/data-source/data-source.mjs +87 -0
- package/esm/data-source/data-source.mjs.map +1 -0
- package/esm/database-dirty-tracker.d.mts +254 -0
- package/esm/database-dirty-tracker.d.mts.map +1 -0
- package/esm/database-dirty-tracker.mjs +356 -0
- package/esm/database-dirty-tracker.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-blueprint.mjs +54 -0
- package/esm/drivers/mongodb/mongodb-blueprint.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-driver.d.mts +334 -0
- package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-driver.mjs +716 -0
- package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts +120 -0
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-id-generator.mjs +141 -0
- package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +322 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs +531 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts +1117 -0
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-builder.mjs +1828 -0
- package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts +230 -0
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-operations.mjs +275 -0
- package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts +263 -0
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-parser.mjs +965 -0
- package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +78 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs +118 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs.map +1 -0
- package/esm/drivers/mongodb/types.d.mts +43 -0
- package/esm/drivers/mongodb/types.d.mts.map +1 -0
- package/esm/drivers/postgres/index.d.mts +8 -0
- package/esm/drivers/postgres/index.mjs +9 -0
- package/esm/drivers/postgres/postgres-blueprint.d.mts +60 -0
- package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-blueprint.mjs +105 -0
- package/esm/drivers/postgres/postgres-blueprint.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-dialect.d.mts +144 -0
- package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-dialect.mjs +227 -0
- package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-driver.d.mts +424 -0
- package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-driver.mjs +845 -0
- package/esm/drivers/postgres/postgres-driver.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-migration-driver.d.mts +393 -0
- package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-migration-driver.mjs +760 -0
- package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-query-builder.d.mts +399 -0
- package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-query-builder.mjs +1105 -0
- package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-query-parser.d.mts +351 -0
- package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-query-parser.mjs +796 -0
- package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-sql-serializer.mjs +260 -0
- package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts +79 -0
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-sync-adapter.mjs +162 -0
- package/esm/drivers/postgres/postgres-sync-adapter.mjs.map +1 -0
- package/esm/drivers/postgres/types.d.mts +105 -0
- package/esm/drivers/postgres/types.d.mts.map +1 -0
- package/esm/drivers/sql/sql-dialect.contract.d.mts +221 -0
- package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -0
- package/esm/drivers/sql/sql-types.d.mts +150 -0
- package/esm/drivers/sql/sql-types.d.mts.map +1 -0
- package/esm/errors/missing-data-source.error.d.mts +25 -0
- package/esm/errors/missing-data-source.error.d.mts.map +1 -0
- package/esm/errors/missing-data-source.error.mjs +31 -0
- package/esm/errors/missing-data-source.error.mjs.map +1 -0
- package/esm/errors/transaction-rollback.error.d.mts +23 -0
- package/esm/errors/transaction-rollback.error.d.mts.map +1 -0
- package/esm/errors/transaction-rollback.error.mjs +29 -0
- package/esm/errors/transaction-rollback.error.mjs.map +1 -0
- package/esm/events/model-events.d.mts +234 -0
- package/esm/events/model-events.d.mts.map +1 -0
- package/esm/events/model-events.mjs +254 -0
- package/esm/events/model-events.mjs.map +1 -0
- package/esm/expressions/aggregate-expressions.d.mts +224 -0
- package/esm/expressions/aggregate-expressions.d.mts.map +1 -0
- package/esm/expressions/aggregate-expressions.mjs +232 -0
- package/esm/expressions/aggregate-expressions.mjs.map +1 -0
- package/esm/index.d.mts +67 -0
- package/esm/index.mjs +53 -0
- package/esm/migration/column-builder.d.mts +420 -0
- package/esm/migration/column-builder.d.mts.map +1 -0
- package/esm/migration/column-builder.mjs +532 -0
- package/esm/migration/column-builder.mjs.map +1 -0
- package/esm/migration/column-helpers.d.mts +280 -0
- package/esm/migration/column-helpers.d.mts.map +1 -0
- package/esm/migration/column-helpers.mjs +376 -0
- package/esm/migration/column-helpers.mjs.map +1 -0
- package/esm/migration/foreign-key-builder.d.mts +106 -0
- package/esm/migration/foreign-key-builder.d.mts.map +1 -0
- package/esm/migration/foreign-key-builder.mjs +126 -0
- package/esm/migration/foreign-key-builder.mjs.map +1 -0
- package/esm/migration/index.d.mts +6 -0
- package/esm/migration/index.mjs +7 -0
- package/esm/migration/migration-runner.d.mts +279 -0
- package/esm/migration/migration-runner.d.mts.map +1 -0
- package/esm/migration/migration-runner.mjs +662 -0
- package/esm/migration/migration-runner.mjs.map +1 -0
- package/esm/migration/migration.d.mts +2035 -0
- package/esm/migration/migration.d.mts.map +1 -0
- package/esm/migration/migration.mjs +2083 -0
- package/esm/migration/migration.mjs.map +1 -0
- package/esm/migration/sql-grammar.mjs +115 -0
- package/esm/migration/sql-grammar.mjs.map +1 -0
- package/esm/migration/sql-serializer.d.mts +26 -0
- package/esm/migration/sql-serializer.d.mts.map +1 -0
- package/esm/migration/sql-serializer.mjs +26 -0
- package/esm/migration/sql-serializer.mjs.map +1 -0
- package/esm/migration/types.d.mts +136 -0
- package/esm/migration/types.d.mts.map +1 -0
- package/esm/model/methods/accessor-methods.mjs +54 -0
- package/esm/model/methods/accessor-methods.mjs.map +1 -0
- package/esm/model/methods/delete-methods.mjs +16 -0
- package/esm/model/methods/delete-methods.mjs.map +1 -0
- package/esm/model/methods/dirty-methods.mjs +20 -0
- package/esm/model/methods/dirty-methods.mjs.map +1 -0
- package/esm/model/methods/hydration-methods.mjs +51 -0
- package/esm/model/methods/hydration-methods.mjs.map +1 -0
- package/esm/model/methods/instance-event-methods.mjs +22 -0
- package/esm/model/methods/instance-event-methods.mjs.map +1 -0
- package/esm/model/methods/meta-methods.mjs +36 -0
- package/esm/model/methods/meta-methods.mjs.map +1 -0
- package/esm/model/methods/pivot-methods.mjs +48 -0
- package/esm/model/methods/pivot-methods.mjs.map +1 -0
- package/esm/model/methods/query-methods.mjs +121 -0
- package/esm/model/methods/query-methods.mjs.map +1 -0
- package/esm/model/methods/restore-methods.mjs +16 -0
- package/esm/model/methods/restore-methods.mjs.map +1 -0
- package/esm/model/methods/scope-methods.mjs +20 -0
- package/esm/model/methods/scope-methods.mjs.map +1 -0
- package/esm/model/methods/serialization-methods.mjs +20 -0
- package/esm/model/methods/serialization-methods.mjs.map +1 -0
- package/esm/model/methods/static-event-methods.mjs +37 -0
- package/esm/model/methods/static-event-methods.mjs.map +1 -0
- package/esm/model/methods/write-methods.mjs +69 -0
- package/esm/model/methods/write-methods.mjs.map +1 -0
- package/esm/model/model.d.mts +1778 -0
- package/esm/model/model.d.mts.map +1 -0
- package/esm/model/model.mjs +1762 -0
- package/esm/model/model.mjs.map +1 -0
- package/esm/model/model.types.d.mts +47 -0
- package/esm/model/model.types.d.mts.map +1 -0
- package/esm/model/register-model.d.mts +140 -0
- package/esm/model/register-model.d.mts.map +1 -0
- package/esm/model/register-model.mjs +175 -0
- package/esm/model/register-model.mjs.map +1 -0
- package/esm/model/relation-decorators.d.mts +88 -0
- package/esm/model/relation-decorators.d.mts.map +1 -0
- package/esm/model/relation-decorators.mjs +191 -0
- package/esm/model/relation-decorators.mjs.map +1 -0
- package/esm/operations/database.d.mts +46 -0
- package/esm/operations/database.d.mts.map +1 -0
- package/esm/operations/database.mjs +40 -0
- package/esm/operations/database.mjs.map +1 -0
- package/esm/operations/index.d.mts +2 -0
- package/esm/operations/index.mjs +4 -0
- package/esm/operations/migrations.d.mts +71 -0
- package/esm/operations/migrations.d.mts.map +1 -0
- package/esm/operations/migrations.mjs +70 -0
- package/esm/operations/migrations.mjs.map +1 -0
- package/esm/query-builder/query-builder.d.mts +564 -0
- package/esm/query-builder/query-builder.d.mts.map +1 -0
- package/esm/query-builder/query-builder.mjs +1097 -0
- package/esm/query-builder/query-builder.mjs.map +1 -0
- package/esm/relations/index.d.mts +4 -0
- package/esm/relations/index.mjs +5 -0
- package/esm/relations/key-conventions.mjs +119 -0
- package/esm/relations/key-conventions.mjs.map +1 -0
- package/esm/relations/pivot-operations.d.mts +155 -0
- package/esm/relations/pivot-operations.d.mts.map +1 -0
- package/esm/relations/pivot-operations.mjs +232 -0
- package/esm/relations/pivot-operations.mjs.map +1 -0
- package/esm/relations/relation-hydrator.d.mts +55 -0
- package/esm/relations/relation-hydrator.d.mts.map +1 -0
- package/esm/relations/relation-hydrator.mjs +52 -0
- package/esm/relations/relation-hydrator.mjs.map +1 -0
- package/esm/relations/relation-loader.d.mts +190 -0
- package/esm/relations/relation-loader.d.mts.map +1 -0
- package/esm/relations/relation-loader.mjs +416 -0
- package/esm/relations/relation-loader.mjs.map +1 -0
- package/esm/relations/types.d.mts +317 -0
- package/esm/relations/types.d.mts.map +1 -0
- package/esm/remover/database-remover.d.mts +104 -0
- package/esm/remover/database-remover.d.mts.map +1 -0
- package/esm/remover/database-remover.mjs +174 -0
- package/esm/remover/database-remover.mjs.map +1 -0
- package/esm/restorer/database-restorer.d.mts +135 -0
- package/esm/restorer/database-restorer.d.mts.map +1 -0
- package/esm/restorer/database-restorer.mjs +316 -0
- package/esm/restorer/database-restorer.mjs.map +1 -0
- package/esm/sql-database-dirty-tracker.d.mts +17 -0
- package/esm/sql-database-dirty-tracker.d.mts.map +1 -0
- package/esm/sql-database-dirty-tracker.mjs +20 -0
- package/esm/sql-database-dirty-tracker.mjs.map +1 -0
- package/esm/sync/model-events.mjs +46 -0
- package/esm/sync/model-events.mjs.map +1 -0
- package/esm/sync/model-sync-operation.d.mts +159 -0
- package/esm/sync/model-sync-operation.d.mts.map +1 -0
- package/esm/sync/model-sync-operation.mjs +257 -0
- package/esm/sync/model-sync-operation.mjs.map +1 -0
- package/esm/sync/model-sync.d.mts +126 -0
- package/esm/sync/model-sync.d.mts.map +1 -0
- package/esm/sync/model-sync.mjs +157 -0
- package/esm/sync/model-sync.mjs.map +1 -0
- package/esm/sync/sync-context.d.mts +69 -0
- package/esm/sync/sync-context.d.mts.map +1 -0
- package/esm/sync/sync-context.mjs +95 -0
- package/esm/sync/sync-context.mjs.map +1 -0
- package/esm/sync/sync-manager.d.mts +213 -0
- package/esm/sync/sync-manager.d.mts.map +1 -0
- package/esm/sync/sync-manager.mjs +597 -0
- package/esm/sync/sync-manager.mjs.map +1 -0
- package/esm/sync/types.d.mts +215 -0
- package/esm/sync/types.d.mts.map +1 -0
- package/esm/types.d.mts +423 -0
- package/esm/types.d.mts.map +1 -0
- package/esm/utils/connect-to-database.d.mts +328 -0
- package/esm/utils/connect-to-database.d.mts.map +1 -0
- package/esm/utils/connect-to-database.mjs +130 -0
- package/esm/utils/connect-to-database.mjs.map +1 -0
- package/esm/utils/database-writer.utils.d.mts +18 -0
- package/esm/utils/database-writer.utils.d.mts.map +1 -0
- package/esm/utils/database-writer.utils.mjs +25 -0
- package/esm/utils/database-writer.utils.mjs.map +1 -0
- package/esm/utils/define-model.d.mts +185 -0
- package/esm/utils/define-model.d.mts.map +1 -0
- package/esm/utils/define-model.mjs +105 -0
- package/esm/utils/define-model.mjs.map +1 -0
- package/esm/utils/is-valid-date-value.mjs +22 -0
- package/esm/utils/is-valid-date-value.mjs.map +1 -0
- package/esm/utils/once-connected.d.mts +150 -0
- package/esm/utils/once-connected.d.mts.map +1 -0
- package/esm/utils/once-connected.mjs +203 -0
- package/esm/utils/once-connected.mjs.map +1 -0
- package/esm/validation/database-seal-plugins.d.mts +1 -0
- package/esm/validation/database-seal-plugins.mjs +11 -0
- package/esm/validation/database-seal-plugins.mjs.map +1 -0
- package/esm/validation/database-writer-validation-error.d.mts +101 -0
- package/esm/validation/database-writer-validation-error.d.mts.map +1 -0
- package/esm/validation/database-writer-validation-error.mjs +153 -0
- package/esm/validation/database-writer-validation-error.mjs.map +1 -0
- package/esm/validation/index.d.mts +2 -0
- package/esm/validation/index.mjs +4 -0
- package/esm/validation/mutators/embed-mutator.mjs +26 -0
- package/esm/validation/mutators/embed-mutator.mjs.map +1 -0
- package/esm/validation/plugins/database-rules-plugin.d.mts +28 -0
- package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -0
- package/esm/validation/plugins/database-rules-plugin.mjs +43 -0
- package/esm/validation/plugins/database-rules-plugin.mjs.map +1 -0
- package/esm/validation/plugins/embed-validator-plugin.d.mts +17 -0
- package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -0
- package/esm/validation/plugins/embed-validator-plugin.mjs +20 -0
- package/esm/validation/plugins/embed-validator-plugin.mjs.map +1 -0
- package/esm/validation/rules/database-model-rule.mjs +32 -0
- package/esm/validation/rules/database-model-rule.mjs.map +1 -0
- package/esm/validation/rules/exists-rule.mjs +29 -0
- package/esm/validation/rules/exists-rule.mjs.map +1 -0
- package/esm/validation/rules/unique-rule.mjs +43 -0
- package/esm/validation/rules/unique-rule.mjs.map +1 -0
- package/esm/validation/transformers/embed-model-transformer.mjs +17 -0
- package/esm/validation/transformers/embed-model-transformer.mjs.map +1 -0
- package/esm/validation/types.d.mts +43 -0
- package/esm/validation/types.d.mts.map +1 -0
- package/esm/validation/validators/embed-validator.d.mts +25 -0
- package/esm/validation/validators/embed-validator.d.mts.map +1 -0
- package/esm/validation/validators/embed-validator.mjs +42 -0
- package/esm/validation/validators/embed-validator.mjs.map +1 -0
- package/esm/writer/database-writer.d.mts +178 -0
- package/esm/writer/database-writer.d.mts.map +1 -0
- package/esm/writer/database-writer.mjs +317 -0
- package/esm/writer/database-writer.mjs.map +1 -0
- package/llms-full.txt +2027 -0
- package/llms.txt +23 -0
- package/package.json +60 -51
- package/skills/README.md +65 -0
- package/skills/aggregate-data/SKILL.md +102 -0
- package/skills/cascade-basics/SKILL.md +93 -0
- package/skills/configure-delete-strategy/SKILL.md +126 -0
- package/skills/define-model/SKILL.md +170 -0
- package/skills/define-relations/SKILL.md +171 -0
- package/skills/manage-data-sources/SKILL.md +140 -0
- package/skills/manage-transactions/SKILL.md +118 -0
- package/skills/paginate-results/SKILL.md +122 -0
- package/skills/perform-atomic-ops/SKILL.md +98 -0
- package/skills/query-data/SKILL.md +168 -0
- package/skills/run-cascade-cli/SKILL.md +125 -0
- package/skills/search-by-vector/SKILL.md +127 -0
- package/skills/subscribe-to-model-events/SKILL.md +148 -0
- package/skills/track-changes/SKILL.md +109 -0
- package/skills/write-migration/SKILL.md +144 -0
- package/cjs/context/database-data-source-context.d.ts +0 -29
- package/cjs/context/database-data-source-context.d.ts.map +0 -1
- package/cjs/context/database-data-source-context.js +0 -28
- package/cjs/context/database-data-source-context.js.map +0 -1
- package/cjs/context/database-transaction-context.d.ts +0 -35
- package/cjs/context/database-transaction-context.d.ts.map +0 -1
- package/cjs/context/database-transaction-context.js +0 -40
- package/cjs/context/database-transaction-context.js.map +0 -1
- package/cjs/contracts/database-driver.contract.d.ts +0 -450
- package/cjs/contracts/database-driver.contract.d.ts.map +0 -1
- package/cjs/contracts/database-id-generator.contract.d.ts +0 -109
- package/cjs/contracts/database-id-generator.contract.d.ts.map +0 -1
- package/cjs/contracts/database-remover.contract.d.ts +0 -104
- package/cjs/contracts/database-remover.contract.d.ts.map +0 -1
- package/cjs/contracts/database-restorer.contract.d.ts +0 -143
- package/cjs/contracts/database-restorer.contract.d.ts.map +0 -1
- package/cjs/contracts/database-writer.contract.d.ts +0 -119
- package/cjs/contracts/database-writer.contract.d.ts.map +0 -1
- package/cjs/contracts/driver-blueprint.contract.d.ts +0 -49
- package/cjs/contracts/driver-blueprint.contract.d.ts.map +0 -1
- package/cjs/contracts/index.d.ts +0 -10
- package/cjs/contracts/index.d.ts.map +0 -1
- package/cjs/contracts/migration-driver.contract.d.ts +0 -522
- package/cjs/contracts/migration-driver.contract.d.ts.map +0 -1
- package/cjs/contracts/query-builder.contract.d.ts +0 -1609
- package/cjs/contracts/query-builder.contract.d.ts.map +0 -1
- package/cjs/contracts/sync-adapter.contract.d.ts +0 -58
- package/cjs/contracts/sync-adapter.contract.d.ts.map +0 -1
- package/cjs/data-source/data-source-registry.d.ts +0 -108
- package/cjs/data-source/data-source-registry.d.ts.map +0 -1
- package/cjs/data-source/data-source-registry.js +0 -145
- package/cjs/data-source/data-source-registry.js.map +0 -1
- package/cjs/data-source/data-source.d.ts +0 -147
- package/cjs/data-source/data-source.d.ts.map +0 -1
- package/cjs/data-source/data-source.js +0 -83
- package/cjs/data-source/data-source.js.map +0 -1
- package/cjs/database-dirty-tracker.d.ts +0 -252
- package/cjs/database-dirty-tracker.d.ts.map +0 -1
- package/cjs/database-dirty-tracker.js +0 -386
- package/cjs/database-dirty-tracker.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
- package/cjs/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-blueprint.js +0 -51
- package/cjs/drivers/mongodb/mongodb-blueprint.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.d.ts +0 -325
- package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.js +0 -845
- package/cjs/drivers/mongodb/mongodb-driver.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
- package/cjs/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-id-generator.js +0 -149
- package/cjs/drivers/mongodb/mongodb-id-generator.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.js +0 -666
- package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
- package/cjs/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-builder.js +0 -1988
- package/cjs/drivers/mongodb/mongodb-query-builder.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
- package/cjs/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-operations.js +0 -270
- package/cjs/drivers/mongodb/mongodb-query-operations.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
- package/cjs/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-parser.js +0 -1351
- package/cjs/drivers/mongodb/mongodb-query-parser.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
- package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-sync-adapter.js +0 -146
- package/cjs/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
- package/cjs/drivers/mongodb/types.d.ts +0 -43
- package/cjs/drivers/mongodb/types.d.ts.map +0 -1
- package/cjs/drivers/postgres/index.d.ts +0 -16
- package/cjs/drivers/postgres/index.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-blueprint.d.ts +0 -64
- package/cjs/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-blueprint.js +0 -121
- package/cjs/drivers/postgres/postgres-blueprint.js.map +0 -1
- package/cjs/drivers/postgres/postgres-dialect.d.ts +0 -136
- package/cjs/drivers/postgres/postgres-dialect.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-dialect.js +0 -268
- package/cjs/drivers/postgres/postgres-dialect.js.map +0 -1
- package/cjs/drivers/postgres/postgres-driver.d.ts +0 -432
- package/cjs/drivers/postgres/postgres-driver.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-driver.js +0 -1008
- package/cjs/drivers/postgres/postgres-driver.js.map +0 -1
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts +0 -397
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-migration-driver.js +0 -900
- package/cjs/drivers/postgres/postgres-migration-driver.js.map +0 -1
- package/cjs/drivers/postgres/postgres-query-builder.d.ts +0 -254
- package/cjs/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-query-builder.js +0 -933
- package/cjs/drivers/postgres/postgres-query-builder.js.map +0 -1
- package/cjs/drivers/postgres/postgres-query-parser.d.ts +0 -328
- package/cjs/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-query-parser.js +0 -868
- package/cjs/drivers/postgres/postgres-query-parser.js.map +0 -1
- package/cjs/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
- package/cjs/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-sql-serializer.js +0 -400
- package/cjs/drivers/postgres/postgres-sql-serializer.js.map +0 -1
- package/cjs/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
- package/cjs/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-sync-adapter.js +0 -204
- package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/cjs/drivers/postgres/types.d.ts +0 -144
- package/cjs/drivers/postgres/types.d.ts.map +0 -1
- package/cjs/drivers/sql/index.d.ts +0 -10
- package/cjs/drivers/sql/index.d.ts.map +0 -1
- package/cjs/drivers/sql/sql-dialect.contract.d.ts +0 -204
- package/cjs/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
- package/cjs/drivers/sql/sql-types.d.ts +0 -202
- package/cjs/drivers/sql/sql-types.d.ts.map +0 -1
- package/cjs/errors/missing-data-source.error.d.ts +0 -22
- package/cjs/errors/missing-data-source.error.d.ts.map +0 -1
- package/cjs/errors/missing-data-source.error.js +0 -29
- package/cjs/errors/missing-data-source.error.js.map +0 -1
- package/cjs/errors/transaction-rollback.error.d.ts +0 -20
- package/cjs/errors/transaction-rollback.error.d.ts.map +0 -1
- package/cjs/errors/transaction-rollback.error.js +0 -27
- package/cjs/errors/transaction-rollback.error.js.map +0 -1
- package/cjs/events/model-events.d.ts +0 -231
- package/cjs/events/model-events.d.ts.map +0 -1
- package/cjs/events/model-events.js +0 -259
- package/cjs/events/model-events.js.map +0 -1
- package/cjs/expressions/aggregate-expressions.d.ts +0 -215
- package/cjs/expressions/aggregate-expressions.d.ts.map +0 -1
- package/cjs/expressions/aggregate-expressions.js +0 -221
- package/cjs/expressions/aggregate-expressions.js.map +0 -1
- package/cjs/expressions/index.d.ts +0 -2
- package/cjs/expressions/index.d.ts.map +0 -1
- package/cjs/index.d.ts +0 -45
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/migration/column-builder.d.ts +0 -417
- package/cjs/migration/column-builder.d.ts.map +0 -1
- package/cjs/migration/column-builder.js +0 -586
- package/cjs/migration/column-builder.js.map +0 -1
- package/cjs/migration/column-helpers.d.ts +0 -275
- package/cjs/migration/column-helpers.d.ts.map +0 -1
- package/cjs/migration/column-helpers.js +0 -389
- package/cjs/migration/column-helpers.js.map +0 -1
- package/cjs/migration/foreign-key-builder.d.ts +0 -103
- package/cjs/migration/foreign-key-builder.d.ts.map +0 -1
- package/cjs/migration/foreign-key-builder.js +0 -121
- package/cjs/migration/foreign-key-builder.js.map +0 -1
- package/cjs/migration/index.d.ts +0 -7
- package/cjs/migration/index.d.ts.map +0 -1
- package/cjs/migration/migration-runner.d.ts +0 -278
- package/cjs/migration/migration-runner.d.ts.map +0 -1
- package/cjs/migration/migration-runner.js +0 -815
- package/cjs/migration/migration-runner.js.map +0 -1
- package/cjs/migration/migration.d.ts +0 -1988
- package/cjs/migration/migration.d.ts.map +0 -1
- package/cjs/migration/migration.js +0 -2162
- package/cjs/migration/migration.js.map +0 -1
- package/cjs/migration/sql-grammar.d.ts +0 -61
- package/cjs/migration/sql-grammar.d.ts.map +0 -1
- package/cjs/migration/sql-grammar.js +0 -164
- package/cjs/migration/sql-grammar.js.map +0 -1
- package/cjs/migration/sql-serializer.d.ts +0 -22
- package/cjs/migration/sql-serializer.d.ts.map +0 -1
- package/cjs/migration/sql-serializer.js +0 -26
- package/cjs/migration/sql-serializer.js.map +0 -1
- package/cjs/migration/types.d.ts +0 -155
- package/cjs/migration/types.d.ts.map +0 -1
- package/cjs/model/methods/accessor-methods.d.ts +0 -13
- package/cjs/model/methods/accessor-methods.d.ts.map +0 -1
- package/cjs/model/methods/accessor-methods.js +0 -51
- package/cjs/model/methods/accessor-methods.js.map +0 -1
- package/cjs/model/methods/delete-methods.d.ts +0 -10
- package/cjs/model/methods/delete-methods.d.ts.map +0 -1
- package/cjs/model/methods/delete-methods.js +0 -10
- package/cjs/model/methods/delete-methods.js.map +0 -1
- package/cjs/model/methods/dirty-methods.d.ts +0 -10
- package/cjs/model/methods/dirty-methods.d.ts.map +0 -1
- package/cjs/model/methods/dirty-methods.js +0 -15
- package/cjs/model/methods/dirty-methods.js.map +0 -1
- package/cjs/model/methods/hydration-methods.d.ts +0 -10
- package/cjs/model/methods/hydration-methods.d.ts.map +0 -1
- package/cjs/model/methods/hydration-methods.js +0 -57
- package/cjs/model/methods/hydration-methods.js.map +0 -1
- package/cjs/model/methods/instance-event-methods.d.ts +0 -7
- package/cjs/model/methods/instance-event-methods.d.ts.map +0 -1
- package/cjs/model/methods/instance-event-methods.js +0 -15
- package/cjs/model/methods/instance-event-methods.js.map +0 -1
- package/cjs/model/methods/meta-methods.d.ts +0 -7
- package/cjs/model/methods/meta-methods.d.ts.map +0 -1
- package/cjs/model/methods/meta-methods.js +0 -78
- package/cjs/model/methods/meta-methods.js.map +0 -1
- package/cjs/model/methods/query-methods.d.ts +0 -24
- package/cjs/model/methods/query-methods.d.ts.map +0 -1
- package/cjs/model/methods/query-methods.js +0 -164
- package/cjs/model/methods/query-methods.js.map +0 -1
- package/cjs/model/methods/restore-methods.d.ts +0 -10
- package/cjs/model/methods/restore-methods.d.ts.map +0 -1
- package/cjs/model/methods/restore-methods.js +0 -13
- package/cjs/model/methods/restore-methods.js.map +0 -1
- package/cjs/model/methods/scope-methods.d.ts +0 -7
- package/cjs/model/methods/scope-methods.d.ts.map +0 -1
- package/cjs/model/methods/scope-methods.js +0 -15
- package/cjs/model/methods/scope-methods.js.map +0 -1
- package/cjs/model/methods/serialization-methods.d.ts +0 -3
- package/cjs/model/methods/serialization-methods.d.ts.map +0 -1
- package/cjs/model/methods/serialization-methods.js +0 -27
- package/cjs/model/methods/serialization-methods.js.map +0 -1
- package/cjs/model/methods/static-event-methods.d.ts +0 -9
- package/cjs/model/methods/static-event-methods.d.ts.map +0 -1
- package/cjs/model/methods/static-event-methods.js +0 -29
- package/cjs/model/methods/static-event-methods.js.map +0 -1
- package/cjs/model/methods/write-methods.d.ts +0 -10
- package/cjs/model/methods/write-methods.d.ts.map +0 -1
- package/cjs/model/methods/write-methods.js +0 -52
- package/cjs/model/methods/write-methods.js.map +0 -1
- package/cjs/model/model.d.ts +0 -1647
- package/cjs/model/model.d.ts.map +0 -1
- package/cjs/model/model.js +0 -1657
- package/cjs/model/model.js.map +0 -1
- package/cjs/model/model.types.d.ts +0 -44
- package/cjs/model/model.types.d.ts.map +0 -1
- package/cjs/model/register-model.d.ts +0 -81
- package/cjs/model/register-model.d.ts.map +0 -1
- package/cjs/model/register-model.js +0 -94
- package/cjs/model/register-model.js.map +0 -1
- package/cjs/query-builder/query-builder.d.ts +0 -556
- package/cjs/query-builder/query-builder.d.ts.map +0 -1
- package/cjs/query-builder/query-builder.js +0 -1070
- package/cjs/query-builder/query-builder.js.map +0 -1
- package/cjs/relations/helpers.d.ts +0 -156
- package/cjs/relations/helpers.d.ts.map +0 -1
- package/cjs/relations/helpers.js +0 -202
- package/cjs/relations/helpers.js.map +0 -1
- package/cjs/relations/index.d.ts +0 -35
- package/cjs/relations/index.d.ts.map +0 -1
- package/cjs/relations/pivot-operations.d.ts +0 -160
- package/cjs/relations/pivot-operations.d.ts.map +0 -1
- package/cjs/relations/pivot-operations.js +0 -293
- package/cjs/relations/pivot-operations.js.map +0 -1
- package/cjs/relations/relation-hydrator.d.ts +0 -68
- package/cjs/relations/relation-hydrator.d.ts.map +0 -1
- package/cjs/relations/relation-hydrator.js +0 -81
- package/cjs/relations/relation-hydrator.js.map +0 -1
- package/cjs/relations/relation-loader.d.ts +0 -194
- package/cjs/relations/relation-loader.d.ts.map +0 -1
- package/cjs/relations/relation-loader.js +0 -466
- package/cjs/relations/relation-loader.js.map +0 -1
- package/cjs/relations/types.d.ts +0 -306
- package/cjs/relations/types.d.ts.map +0 -1
- package/cjs/remover/database-remover.d.ts +0 -100
- package/cjs/remover/database-remover.d.ts.map +0 -1
- package/cjs/remover/database-remover.js +0 -214
- package/cjs/remover/database-remover.js.map +0 -1
- package/cjs/restorer/database-restorer.d.ts +0 -131
- package/cjs/restorer/database-restorer.d.ts.map +0 -1
- package/cjs/restorer/database-restorer.js +0 -434
- package/cjs/restorer/database-restorer.js.map +0 -1
- package/cjs/sql-database-dirty-tracker.d.ts +0 -13
- package/cjs/sql-database-dirty-tracker.d.ts.map +0 -1
- package/cjs/sql-database-dirty-tracker.js +0 -14
- package/cjs/sql-database-dirty-tracker.js.map +0 -1
- package/cjs/sync/index.d.ts +0 -12
- package/cjs/sync/index.d.ts.map +0 -1
- package/cjs/sync/model-events.d.ts +0 -62
- package/cjs/sync/model-events.d.ts.map +0 -1
- package/cjs/sync/model-events.js +0 -49
- package/cjs/sync/model-events.js.map +0 -1
- package/cjs/sync/model-sync-operation.d.ts +0 -163
- package/cjs/sync/model-sync-operation.d.ts.map +0 -1
- package/cjs/sync/model-sync-operation.js +0 -292
- package/cjs/sync/model-sync-operation.js.map +0 -1
- package/cjs/sync/model-sync.d.ts +0 -130
- package/cjs/sync/model-sync.d.ts.map +0 -1
- package/cjs/sync/model-sync.js +0 -178
- package/cjs/sync/model-sync.js.map +0 -1
- package/cjs/sync/sync-context.d.ts +0 -70
- package/cjs/sync/sync-context.d.ts.map +0 -1
- package/cjs/sync/sync-context.js +0 -101
- package/cjs/sync/sync-context.js.map +0 -1
- package/cjs/sync/sync-manager.d.ts +0 -213
- package/cjs/sync/sync-manager.d.ts.map +0 -1
- package/cjs/sync/sync-manager.js +0 -689
- package/cjs/sync/sync-manager.js.map +0 -1
- package/cjs/sync/types.d.ts +0 -289
- package/cjs/sync/types.d.ts.map +0 -1
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts +0 -15
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
- package/cjs/types.d.ts +0 -371
- package/cjs/types.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.d.ts +0 -307
- package/cjs/utils/connect-to-database.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.js +0 -130
- package/cjs/utils/connect-to-database.js.map +0 -1
- package/cjs/utils/database-writer.utils.d.ts +0 -15
- package/cjs/utils/database-writer.utils.d.ts.map +0 -1
- package/cjs/utils/database-writer.utils.js +0 -14
- package/cjs/utils/database-writer.utils.js.map +0 -1
- package/cjs/utils/define-model.js +0 -100
- package/cjs/utils/define-model.js.map +0 -1
- package/cjs/utils/is-valid-date-value.d.ts +0 -5
- package/cjs/utils/is-valid-date-value.d.ts.map +0 -1
- package/cjs/utils/is-valid-date-value.js +0 -25
- package/cjs/utils/is-valid-date-value.js.map +0 -1
- package/cjs/utils/once-connected.d.ts +0 -146
- package/cjs/utils/once-connected.d.ts.map +0 -1
- package/cjs/utils/once-connected.js +0 -251
- package/cjs/utils/once-connected.js.map +0 -1
- package/cjs/validation/database-seal-plugins.d.ts +0 -12
- package/cjs/validation/database-seal-plugins.d.ts.map +0 -1
- package/cjs/validation/database-seal-plugins.js +0 -1
- package/cjs/validation/database-seal-plugins.js.map +0 -1
- package/cjs/validation/database-writer-validation-error.d.ts +0 -97
- package/cjs/validation/database-writer-validation-error.d.ts.map +0 -1
- package/cjs/validation/database-writer-validation-error.js +0 -160
- package/cjs/validation/database-writer-validation-error.js.map +0 -1
- package/cjs/validation/index.d.ts +0 -3
- package/cjs/validation/index.d.ts.map +0 -1
- package/cjs/validation/mutators/embed-mutator.d.ts +0 -9
- package/cjs/validation/mutators/embed-mutator.d.ts.map +0 -1
- package/cjs/validation/mutators/embed-mutator.js +0 -33
- package/cjs/validation/mutators/embed-mutator.js.map +0 -1
- package/cjs/validation/plugins/embed-validator-plugin.d.ts +0 -24
- package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
- package/cjs/validation/plugins/embed-validator-plugin.js +0 -18
- package/cjs/validation/plugins/embed-validator-plugin.js.map +0 -1
- package/cjs/validation/rules/database-model-rule.d.ts +0 -7
- package/cjs/validation/rules/database-model-rule.d.ts.map +0 -1
- package/cjs/validation/rules/database-model-rule.js +0 -27
- package/cjs/validation/rules/database-model-rule.js.map +0 -1
- package/cjs/validation/transformers/embed-model-transformer.d.ts +0 -3
- package/cjs/validation/transformers/embed-model-transformer.d.ts.map +0 -1
- package/cjs/validation/transformers/embed-model-transformer.js +0 -18
- package/cjs/validation/transformers/embed-model-transformer.js.map +0 -1
- package/cjs/validation/validators/embed-validator.d.ts +0 -21
- package/cjs/validation/validators/embed-validator.d.ts.map +0 -1
- package/cjs/validation/validators/embed-validator.js +0 -43
- package/cjs/validation/validators/embed-validator.js.map +0 -1
- package/cjs/writer/database-writer.d.ts +0 -174
- package/cjs/writer/database-writer.d.ts.map +0 -1
- package/cjs/writer/database-writer.js +0 -400
- package/cjs/writer/database-writer.js.map +0 -1
- package/esm/context/database-data-source-context.d.ts +0 -29
- package/esm/context/database-data-source-context.d.ts.map +0 -1
- package/esm/context/database-data-source-context.js +0 -28
- package/esm/context/database-data-source-context.js.map +0 -1
- package/esm/context/database-transaction-context.d.ts +0 -35
- package/esm/context/database-transaction-context.d.ts.map +0 -1
- package/esm/context/database-transaction-context.js +0 -40
- package/esm/context/database-transaction-context.js.map +0 -1
- package/esm/contracts/database-driver.contract.d.ts +0 -450
- package/esm/contracts/database-driver.contract.d.ts.map +0 -1
- package/esm/contracts/database-id-generator.contract.d.ts +0 -109
- package/esm/contracts/database-id-generator.contract.d.ts.map +0 -1
- package/esm/contracts/database-remover.contract.d.ts +0 -104
- package/esm/contracts/database-remover.contract.d.ts.map +0 -1
- package/esm/contracts/database-restorer.contract.d.ts +0 -143
- package/esm/contracts/database-restorer.contract.d.ts.map +0 -1
- package/esm/contracts/database-writer.contract.d.ts +0 -119
- package/esm/contracts/database-writer.contract.d.ts.map +0 -1
- package/esm/contracts/driver-blueprint.contract.d.ts +0 -49
- package/esm/contracts/driver-blueprint.contract.d.ts.map +0 -1
- package/esm/contracts/index.d.ts +0 -10
- package/esm/contracts/index.d.ts.map +0 -1
- package/esm/contracts/migration-driver.contract.d.ts +0 -522
- package/esm/contracts/migration-driver.contract.d.ts.map +0 -1
- package/esm/contracts/query-builder.contract.d.ts +0 -1609
- package/esm/contracts/query-builder.contract.d.ts.map +0 -1
- package/esm/contracts/sync-adapter.contract.d.ts +0 -58
- package/esm/contracts/sync-adapter.contract.d.ts.map +0 -1
- package/esm/data-source/data-source-registry.d.ts +0 -108
- package/esm/data-source/data-source-registry.d.ts.map +0 -1
- package/esm/data-source/data-source-registry.js +0 -145
- package/esm/data-source/data-source-registry.js.map +0 -1
- package/esm/data-source/data-source.d.ts +0 -147
- package/esm/data-source/data-source.d.ts.map +0 -1
- package/esm/data-source/data-source.js +0 -83
- package/esm/data-source/data-source.js.map +0 -1
- package/esm/database-dirty-tracker.d.ts +0 -252
- package/esm/database-dirty-tracker.d.ts.map +0 -1
- package/esm/database-dirty-tracker.js +0 -386
- package/esm/database-dirty-tracker.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
- package/esm/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-blueprint.js +0 -51
- package/esm/drivers/mongodb/mongodb-blueprint.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.d.ts +0 -325
- package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.js +0 -845
- package/esm/drivers/mongodb/mongodb-driver.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
- package/esm/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-id-generator.js +0 -149
- package/esm/drivers/mongodb/mongodb-id-generator.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.js +0 -666
- package/esm/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
- package/esm/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-builder.js +0 -1988
- package/esm/drivers/mongodb/mongodb-query-builder.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
- package/esm/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-operations.js +0 -270
- package/esm/drivers/mongodb/mongodb-query-operations.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
- package/esm/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-parser.js +0 -1351
- package/esm/drivers/mongodb/mongodb-query-parser.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.js +0 -146
- package/esm/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
- package/esm/drivers/mongodb/types.d.ts +0 -43
- package/esm/drivers/mongodb/types.d.ts.map +0 -1
- package/esm/drivers/postgres/index.d.ts +0 -16
- package/esm/drivers/postgres/index.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-blueprint.d.ts +0 -64
- package/esm/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-blueprint.js +0 -121
- package/esm/drivers/postgres/postgres-blueprint.js.map +0 -1
- package/esm/drivers/postgres/postgres-dialect.d.ts +0 -136
- package/esm/drivers/postgres/postgres-dialect.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-dialect.js +0 -268
- package/esm/drivers/postgres/postgres-dialect.js.map +0 -1
- package/esm/drivers/postgres/postgres-driver.d.ts +0 -432
- package/esm/drivers/postgres/postgres-driver.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-driver.js +0 -1008
- package/esm/drivers/postgres/postgres-driver.js.map +0 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.ts +0 -397
- package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-migration-driver.js +0 -900
- package/esm/drivers/postgres/postgres-migration-driver.js.map +0 -1
- package/esm/drivers/postgres/postgres-query-builder.d.ts +0 -254
- package/esm/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-query-builder.js +0 -933
- package/esm/drivers/postgres/postgres-query-builder.js.map +0 -1
- package/esm/drivers/postgres/postgres-query-parser.d.ts +0 -328
- package/esm/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-query-parser.js +0 -868
- package/esm/drivers/postgres/postgres-query-parser.js.map +0 -1
- package/esm/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
- package/esm/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-sql-serializer.js +0 -400
- package/esm/drivers/postgres/postgres-sql-serializer.js.map +0 -1
- package/esm/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
- package/esm/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-sync-adapter.js +0 -204
- package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/esm/drivers/postgres/types.d.ts +0 -144
- package/esm/drivers/postgres/types.d.ts.map +0 -1
- package/esm/drivers/sql/index.d.ts +0 -10
- package/esm/drivers/sql/index.d.ts.map +0 -1
- package/esm/drivers/sql/sql-dialect.contract.d.ts +0 -204
- package/esm/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
- package/esm/drivers/sql/sql-types.d.ts +0 -202
- package/esm/drivers/sql/sql-types.d.ts.map +0 -1
- package/esm/errors/missing-data-source.error.d.ts +0 -22
- package/esm/errors/missing-data-source.error.d.ts.map +0 -1
- package/esm/errors/missing-data-source.error.js +0 -29
- package/esm/errors/missing-data-source.error.js.map +0 -1
- package/esm/errors/transaction-rollback.error.d.ts +0 -20
- package/esm/errors/transaction-rollback.error.d.ts.map +0 -1
- package/esm/errors/transaction-rollback.error.js +0 -27
- package/esm/errors/transaction-rollback.error.js.map +0 -1
- package/esm/events/model-events.d.ts +0 -231
- package/esm/events/model-events.d.ts.map +0 -1
- package/esm/events/model-events.js +0 -259
- package/esm/events/model-events.js.map +0 -1
- package/esm/expressions/aggregate-expressions.d.ts +0 -215
- package/esm/expressions/aggregate-expressions.d.ts.map +0 -1
- package/esm/expressions/aggregate-expressions.js +0 -221
- package/esm/expressions/aggregate-expressions.js.map +0 -1
- package/esm/expressions/index.d.ts +0 -2
- package/esm/expressions/index.d.ts.map +0 -1
- package/esm/index.d.ts +0 -45
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +0 -1
- package/esm/migration/column-builder.d.ts +0 -417
- package/esm/migration/column-builder.d.ts.map +0 -1
- package/esm/migration/column-builder.js +0 -586
- package/esm/migration/column-builder.js.map +0 -1
- package/esm/migration/column-helpers.d.ts +0 -275
- package/esm/migration/column-helpers.d.ts.map +0 -1
- package/esm/migration/column-helpers.js +0 -389
- package/esm/migration/column-helpers.js.map +0 -1
- package/esm/migration/foreign-key-builder.d.ts +0 -103
- package/esm/migration/foreign-key-builder.d.ts.map +0 -1
- package/esm/migration/foreign-key-builder.js +0 -121
- package/esm/migration/foreign-key-builder.js.map +0 -1
- package/esm/migration/index.d.ts +0 -7
- package/esm/migration/index.d.ts.map +0 -1
- package/esm/migration/migration-runner.d.ts +0 -278
- package/esm/migration/migration-runner.d.ts.map +0 -1
- package/esm/migration/migration-runner.js +0 -815
- package/esm/migration/migration-runner.js.map +0 -1
- package/esm/migration/migration.d.ts +0 -1988
- package/esm/migration/migration.d.ts.map +0 -1
- package/esm/migration/migration.js +0 -2162
- package/esm/migration/migration.js.map +0 -1
- package/esm/migration/sql-grammar.d.ts +0 -61
- package/esm/migration/sql-grammar.d.ts.map +0 -1
- package/esm/migration/sql-grammar.js +0 -164
- package/esm/migration/sql-grammar.js.map +0 -1
- package/esm/migration/sql-serializer.d.ts +0 -22
- package/esm/migration/sql-serializer.d.ts.map +0 -1
- package/esm/migration/sql-serializer.js +0 -26
- package/esm/migration/sql-serializer.js.map +0 -1
- package/esm/migration/types.d.ts +0 -155
- package/esm/migration/types.d.ts.map +0 -1
- package/esm/model/methods/accessor-methods.d.ts +0 -13
- package/esm/model/methods/accessor-methods.d.ts.map +0 -1
- package/esm/model/methods/accessor-methods.js +0 -51
- package/esm/model/methods/accessor-methods.js.map +0 -1
- package/esm/model/methods/delete-methods.d.ts +0 -10
- package/esm/model/methods/delete-methods.d.ts.map +0 -1
- package/esm/model/methods/delete-methods.js +0 -10
- package/esm/model/methods/delete-methods.js.map +0 -1
- package/esm/model/methods/dirty-methods.d.ts +0 -10
- package/esm/model/methods/dirty-methods.d.ts.map +0 -1
- package/esm/model/methods/dirty-methods.js +0 -15
- package/esm/model/methods/dirty-methods.js.map +0 -1
- package/esm/model/methods/hydration-methods.d.ts +0 -10
- package/esm/model/methods/hydration-methods.d.ts.map +0 -1
- package/esm/model/methods/hydration-methods.js +0 -57
- package/esm/model/methods/hydration-methods.js.map +0 -1
- package/esm/model/methods/instance-event-methods.d.ts +0 -7
- package/esm/model/methods/instance-event-methods.d.ts.map +0 -1
- package/esm/model/methods/instance-event-methods.js +0 -15
- package/esm/model/methods/instance-event-methods.js.map +0 -1
- package/esm/model/methods/meta-methods.d.ts +0 -7
- package/esm/model/methods/meta-methods.d.ts.map +0 -1
- package/esm/model/methods/meta-methods.js +0 -78
- package/esm/model/methods/meta-methods.js.map +0 -1
- package/esm/model/methods/query-methods.d.ts +0 -24
- package/esm/model/methods/query-methods.d.ts.map +0 -1
- package/esm/model/methods/query-methods.js +0 -164
- package/esm/model/methods/query-methods.js.map +0 -1
- package/esm/model/methods/restore-methods.d.ts +0 -10
- package/esm/model/methods/restore-methods.d.ts.map +0 -1
- package/esm/model/methods/restore-methods.js +0 -13
- package/esm/model/methods/restore-methods.js.map +0 -1
- package/esm/model/methods/scope-methods.d.ts +0 -7
- package/esm/model/methods/scope-methods.d.ts.map +0 -1
- package/esm/model/methods/scope-methods.js +0 -15
- package/esm/model/methods/scope-methods.js.map +0 -1
- package/esm/model/methods/serialization-methods.d.ts +0 -3
- package/esm/model/methods/serialization-methods.d.ts.map +0 -1
- package/esm/model/methods/serialization-methods.js +0 -27
- package/esm/model/methods/serialization-methods.js.map +0 -1
- package/esm/model/methods/static-event-methods.d.ts +0 -9
- package/esm/model/methods/static-event-methods.d.ts.map +0 -1
- package/esm/model/methods/static-event-methods.js +0 -29
- package/esm/model/methods/static-event-methods.js.map +0 -1
- package/esm/model/methods/write-methods.d.ts +0 -10
- package/esm/model/methods/write-methods.d.ts.map +0 -1
- package/esm/model/methods/write-methods.js +0 -52
- package/esm/model/methods/write-methods.js.map +0 -1
- package/esm/model/model.d.ts +0 -1647
- package/esm/model/model.d.ts.map +0 -1
- package/esm/model/model.js +0 -1657
- package/esm/model/model.js.map +0 -1
- package/esm/model/model.types.d.ts +0 -44
- package/esm/model/model.types.d.ts.map +0 -1
- package/esm/model/register-model.d.ts +0 -81
- package/esm/model/register-model.d.ts.map +0 -1
- package/esm/model/register-model.js +0 -94
- package/esm/model/register-model.js.map +0 -1
- package/esm/query-builder/query-builder.d.ts +0 -556
- package/esm/query-builder/query-builder.d.ts.map +0 -1
- package/esm/query-builder/query-builder.js +0 -1070
- package/esm/query-builder/query-builder.js.map +0 -1
- package/esm/relations/helpers.d.ts +0 -156
- package/esm/relations/helpers.d.ts.map +0 -1
- package/esm/relations/helpers.js +0 -202
- package/esm/relations/helpers.js.map +0 -1
- package/esm/relations/index.d.ts +0 -35
- package/esm/relations/index.d.ts.map +0 -1
- package/esm/relations/pivot-operations.d.ts +0 -160
- package/esm/relations/pivot-operations.d.ts.map +0 -1
- package/esm/relations/pivot-operations.js +0 -293
- package/esm/relations/pivot-operations.js.map +0 -1
- package/esm/relations/relation-hydrator.d.ts +0 -68
- package/esm/relations/relation-hydrator.d.ts.map +0 -1
- package/esm/relations/relation-hydrator.js +0 -81
- package/esm/relations/relation-hydrator.js.map +0 -1
- package/esm/relations/relation-loader.d.ts +0 -194
- package/esm/relations/relation-loader.d.ts.map +0 -1
- package/esm/relations/relation-loader.js +0 -466
- package/esm/relations/relation-loader.js.map +0 -1
- package/esm/relations/types.d.ts +0 -306
- package/esm/relations/types.d.ts.map +0 -1
- package/esm/remover/database-remover.d.ts +0 -100
- package/esm/remover/database-remover.d.ts.map +0 -1
- package/esm/remover/database-remover.js +0 -214
- package/esm/remover/database-remover.js.map +0 -1
- package/esm/restorer/database-restorer.d.ts +0 -131
- package/esm/restorer/database-restorer.d.ts.map +0 -1
- package/esm/restorer/database-restorer.js +0 -434
- package/esm/restorer/database-restorer.js.map +0 -1
- package/esm/sql-database-dirty-tracker.d.ts +0 -13
- package/esm/sql-database-dirty-tracker.d.ts.map +0 -1
- package/esm/sql-database-dirty-tracker.js +0 -14
- package/esm/sql-database-dirty-tracker.js.map +0 -1
- package/esm/sync/index.d.ts +0 -12
- package/esm/sync/index.d.ts.map +0 -1
- package/esm/sync/model-events.d.ts +0 -62
- package/esm/sync/model-events.d.ts.map +0 -1
- package/esm/sync/model-events.js +0 -49
- package/esm/sync/model-events.js.map +0 -1
- package/esm/sync/model-sync-operation.d.ts +0 -163
- package/esm/sync/model-sync-operation.d.ts.map +0 -1
- package/esm/sync/model-sync-operation.js +0 -292
- package/esm/sync/model-sync-operation.js.map +0 -1
- package/esm/sync/model-sync.d.ts +0 -130
- package/esm/sync/model-sync.d.ts.map +0 -1
- package/esm/sync/model-sync.js +0 -178
- package/esm/sync/model-sync.js.map +0 -1
- package/esm/sync/sync-context.d.ts +0 -70
- package/esm/sync/sync-context.d.ts.map +0 -1
- package/esm/sync/sync-context.js +0 -101
- package/esm/sync/sync-context.js.map +0 -1
- package/esm/sync/sync-manager.d.ts +0 -213
- package/esm/sync/sync-manager.d.ts.map +0 -1
- package/esm/sync/sync-manager.js +0 -689
- package/esm/sync/sync-manager.js.map +0 -1
- package/esm/sync/types.d.ts +0 -289
- package/esm/sync/types.d.ts.map +0 -1
- package/esm/test-migrations/test-enhanced-features.migration.d.ts +0 -15
- package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
- package/esm/types.d.ts +0 -371
- package/esm/types.d.ts.map +0 -1
- package/esm/utils/connect-to-database.d.ts +0 -307
- package/esm/utils/connect-to-database.d.ts.map +0 -1
- package/esm/utils/connect-to-database.js +0 -130
- package/esm/utils/connect-to-database.js.map +0 -1
- package/esm/utils/database-writer.utils.d.ts +0 -15
- package/esm/utils/database-writer.utils.d.ts.map +0 -1
- package/esm/utils/database-writer.utils.js +0 -14
- package/esm/utils/database-writer.utils.js.map +0 -1
- package/esm/utils/define-model.js +0 -100
- package/esm/utils/define-model.js.map +0 -1
- package/esm/utils/is-valid-date-value.d.ts +0 -5
- package/esm/utils/is-valid-date-value.d.ts.map +0 -1
- package/esm/utils/is-valid-date-value.js +0 -25
- package/esm/utils/is-valid-date-value.js.map +0 -1
- package/esm/utils/once-connected.d.ts +0 -146
- package/esm/utils/once-connected.d.ts.map +0 -1
- package/esm/utils/once-connected.js +0 -251
- package/esm/utils/once-connected.js.map +0 -1
- package/esm/validation/database-seal-plugins.d.ts +0 -12
- package/esm/validation/database-seal-plugins.d.ts.map +0 -1
- package/esm/validation/database-seal-plugins.js +0 -1
- package/esm/validation/database-seal-plugins.js.map +0 -1
- package/esm/validation/database-writer-validation-error.d.ts +0 -97
- package/esm/validation/database-writer-validation-error.d.ts.map +0 -1
- package/esm/validation/database-writer-validation-error.js +0 -160
- package/esm/validation/database-writer-validation-error.js.map +0 -1
- package/esm/validation/index.d.ts +0 -3
- package/esm/validation/index.d.ts.map +0 -1
- package/esm/validation/mutators/embed-mutator.d.ts +0 -9
- package/esm/validation/mutators/embed-mutator.d.ts.map +0 -1
- package/esm/validation/mutators/embed-mutator.js +0 -33
- package/esm/validation/mutators/embed-mutator.js.map +0 -1
- package/esm/validation/plugins/embed-validator-plugin.d.ts +0 -24
- package/esm/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
- package/esm/validation/plugins/embed-validator-plugin.js +0 -18
- package/esm/validation/plugins/embed-validator-plugin.js.map +0 -1
- package/esm/validation/rules/database-model-rule.d.ts +0 -7
- package/esm/validation/rules/database-model-rule.d.ts.map +0 -1
- package/esm/validation/rules/database-model-rule.js +0 -27
- package/esm/validation/rules/database-model-rule.js.map +0 -1
- package/esm/validation/transformers/embed-model-transformer.d.ts +0 -3
- package/esm/validation/transformers/embed-model-transformer.d.ts.map +0 -1
- package/esm/validation/transformers/embed-model-transformer.js +0 -18
- package/esm/validation/transformers/embed-model-transformer.js.map +0 -1
- package/esm/validation/validators/embed-validator.d.ts +0 -21
- package/esm/validation/validators/embed-validator.d.ts.map +0 -1
- package/esm/validation/validators/embed-validator.js +0 -43
- package/esm/validation/validators/embed-validator.js.map +0 -1
- package/esm/writer/database-writer.d.ts +0 -174
- package/esm/writer/database-writer.d.ts.map +0 -1
- package/esm/writer/database-writer.js +0 -400
- package/esm/writer/database-writer.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-driver.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/drivers/postgres/postgres-driver.ts"],"sourcesContent":["/**\r\n * PostgreSQL Driver\r\n *\r\n * Main driver implementation for PostgreSQL database operations.\r\n * Implements the DriverContract interface to provide a unified API\r\n * for CRUD operations, transactions, and query building.\r\n *\r\n * Uses the `pg` package for database connectivity with connection pooling.\r\n *\r\n * @module cascade/drivers/postgres\r\n */\r\n\r\nimport { colors } from \"@mongez/copper\";\r\nimport { log } from \"@warlock.js/logger\";\r\nimport { databaseTransactionContext } from \"../../context/database-transaction-context\";\r\nimport type {\r\n CreateDatabaseOptions,\r\n DriverContract,\r\n DriverEventListener,\r\n DriverTransactionContract,\r\n DropDatabaseOptions,\r\n InsertResult,\r\n TransactionContext,\r\n UpdateOperations,\r\n UpdateResult,\r\n} from \"../../contracts/database-driver.contract\";\r\nimport type { DriverBlueprintContract } from \"../../contracts/driver-blueprint.contract\";\r\nimport type { MigrationDriverContract } from \"../../contracts/migration-driver.contract\";\r\nimport type { QueryBuilderContract } from \"../../contracts/query-builder.contract\";\r\nimport type { SyncAdapterContract } from \"../../contracts/sync-adapter.contract\";\r\nimport { TransactionRollbackError } from \"../../errors/transaction-rollback.error\";\r\nimport { SQLSerializer } from \"../../migration/sql-serializer\";\r\nimport { SqlDatabaseDirtyTracker } from \"../../sql-database-dirty-tracker\";\r\nimport type { ModelDefaults } from \"../../types\";\r\nimport { DatabaseDriver } from \"../../utils/connect-to-database\";\r\nimport { isValidDateValue } from \"../../utils/is-valid-date-value\";\r\nimport { PostgresBlueprint } from \"./postgres-blueprint\";\r\nimport { PostgresDialect } from \"./postgres-dialect\";\r\nimport { PostgresMigrationDriver } from \"./postgres-migration-driver\";\r\nimport { PostgresQueryBuilder } from \"./postgres-query-builder\";\r\nimport { PostgresSQLSerializer } from \"./postgres-sql-serializer\";\r\nimport { PostgresSyncAdapter } from \"./postgres-sync-adapter\";\r\nimport type { PostgresPoolConfig, PostgresQueryResult, PostgresTransactionOptions } from \"./types\";\r\n\r\n/**\r\n * Lazily loaded pg module types.\r\n */\r\ntype PgPool = import(\"pg\").Pool;\r\ntype PgPoolClient = import(\"pg\").PoolClient;\r\ntype PgPoolConfig = import(\"pg\").PoolConfig;\r\n\r\n/**\r\n * Cached pg module reference.\r\n */\r\nlet pgModule: typeof import(\"pg\") | undefined;\r\n\r\n/**\r\n * Lazily load the pg package.\r\n *\r\n * @returns The pg module\r\n * @throws Error if pg is not installed\r\n */\r\nasync function loadPg(): Promise<typeof import(\"pg\")> {\r\n if (pgModule) {\r\n return pgModule;\r\n }\r\n\r\n try {\r\n pgModule = await import(\"pg\");\r\n return pgModule;\r\n } catch {\r\n throw new Error(\r\n 'The \"pg\" package is required for PostgreSQL support. ' + \"Please install it: npm install pg\",\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * PostgreSQL database driver implementing the Cascade DriverContract.\r\n *\r\n * Provides connection pooling, CRUD operations, transactions, and\r\n * integration with Cascade's query builder and migration systems.\r\n *\r\n * @example\r\n * ```typescript\r\n * const driver = new PostgresDriver({\r\n * host: 'localhost',\r\n * port: 5432,\r\n * database: 'myapp',\r\n * user: 'postgres',\r\n * password: 'secret'\r\n * });\r\n *\r\n * await driver.connect();\r\n *\r\n * // Insert a document\r\n * const result = await driver.insert('users', { name: 'Alice', email: 'alice@example.com' });\r\n *\r\n * // Query using the query builder\r\n * const users = await driver.queryBuilder('users')\r\n * .where('name', 'Alice')\r\n * .get();\r\n *\r\n * await driver.disconnect();\r\n * ```\r\n */\r\nexport class PostgresDriver implements DriverContract {\r\n /**\r\n * Driver name identifier.\r\n */\r\n public readonly name = \"postgres\" as DatabaseDriver;\r\n\r\n /**\r\n * SQL dialect for PostgreSQL-specific syntax.\r\n */\r\n public readonly dialect = new PostgresDialect();\r\n\r\n /**\r\n * PostgreSQL driver model defaults.\r\n *\r\n * PostgreSQL follows SQL conventions:\r\n * - snake_case naming for columns (created_at, updated_at, deleted_at)\r\n * - Native AUTO_INCREMENT for IDs (no manual generation)\r\n * - Timestamps enabled by default\r\n * - Permanent delete strategy (hard deletes)\r\n */\r\n public readonly modelDefaults: Partial<ModelDefaults> = {\r\n namingConvention: \"snake_case\",\r\n createdAtColumn: \"created_at\",\r\n updatedAtColumn: \"updated_at\",\r\n deletedAtColumn: \"deleted_at\",\r\n timestamps: true,\r\n autoGenerateId: false, // PostgreSQL uses SERIAL/BIGSERIAL\r\n strictMode: \"fail\",\r\n deleteStrategy: \"permanent\",\r\n };\r\n\r\n /**\r\n * Connection pool instance.\r\n */\r\n private _pool: PgPool | undefined;\r\n\r\n /**\r\n * Event listeners for driver lifecycle events.\r\n */\r\n private readonly _eventListeners = new Map<string, Set<DriverEventListener>>();\r\n\r\n /**\r\n * Whether the driver is currently connected.\r\n */\r\n private _isConnected = false;\r\n\r\n /**\r\n * Blueprint instance (lazy-loaded).\r\n */\r\n private _blueprint: DriverBlueprintContract | undefined;\r\n\r\n /**\r\n * Migration driver instance (lazy-loaded).\r\n */\r\n private _migrationDriver: MigrationDriverContract | undefined;\r\n\r\n /**\r\n * Sync adapter instance (lazy-loaded).\r\n */\r\n private _syncAdapter: SyncAdapterContract | undefined;\r\n\r\n /**\r\n * Create a new PostgreSQL driver instance.\r\n *\r\n * @param config - PostgreSQL connection configuration\r\n */\r\n public constructor(private readonly config: PostgresPoolConfig) {}\r\n\r\n /**\r\n * Get the connection pool instance.\r\n *\r\n * @throws Error if not connected\r\n */\r\n public get pool(): PgPool {\r\n if (!this._pool) {\r\n throw new Error(\"PostgreSQL driver is not connected. Call connect() first.\");\r\n }\r\n return this._pool;\r\n }\r\n\r\n /**\r\n * Get database native client\r\n */\r\n public getClient<Client = PgPool>(): Client {\r\n return this.pool as Client;\r\n }\r\n\r\n /**\r\n * Check if the driver is currently connected.\r\n */\r\n public get isConnected(): boolean {\r\n return this._isConnected;\r\n }\r\n\r\n /**\r\n * Get the driver blueprint (information schema).\r\n */\r\n public get blueprint(): DriverBlueprintContract {\r\n if (!this._blueprint) {\r\n this._blueprint = new PostgresBlueprint(this);\r\n }\r\n return this._blueprint;\r\n }\r\n\r\n /**\r\n * Establish connection to the PostgreSQL database.\r\n *\r\n * Creates a connection pool with the configured options.\r\n * Emits 'connected' event on successful connection.\r\n */\r\n public async connect(): Promise<void> {\r\n if (this._isConnected) {\r\n return;\r\n }\r\n\r\n const pg = await loadPg();\r\n\r\n try {\r\n const poolConfig: PgPoolConfig = {\r\n host: this.config.host ?? \"localhost\",\r\n port: this.config.port ?? 5432,\r\n database: this.config.database,\r\n user: this.config.user,\r\n password: this.config.password,\r\n connectionString: this.config.connectionString,\r\n max: this.config.max ?? 10,\r\n min: this.config.min ?? 0,\r\n idleTimeoutMillis: this.config.idleTimeoutMillis ?? 30000,\r\n connectionTimeoutMillis: this.config.connectionTimeoutMillis ?? 2000,\r\n application_name: this.config.application_name ?? \"cascade\",\r\n ssl: this.config.ssl,\r\n };\r\n\r\n log.info(\r\n \"database.postgres\",\r\n \"connection\",\r\n `Connecting to database ${colors.bold(colors.yellowBright(this.config.database))}`,\r\n );\r\n\r\n this._pool = new pg.Pool(poolConfig);\r\n\r\n // Test the connection\r\n const client = await this._pool.connect();\r\n client.release();\r\n\r\n log.success(\r\n \"database.postgres\",\r\n \"connection\",\r\n `Connected to database ${colors.bold(colors.yellowBright(this.config.database))}`,\r\n );\r\n\r\n this._isConnected = true;\r\n this.emit(\"connected\");\r\n } catch (error) {\r\n log.error(\"database.postgres\", \"connection\", \"Failed to connect to database\");\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Close the database connection pool.\r\n *\r\n * Waits for all active queries to complete before closing.\r\n * Emits 'disconnected' event on successful disconnection.\r\n */\r\n public async disconnect(): Promise<void> {\r\n if (!this._isConnected || !this._pool) {\r\n return;\r\n }\r\n\r\n await this._pool.end();\r\n this._pool = undefined;\r\n this._isConnected = false;\r\n this.emit(\"disconnected\");\r\n }\r\n\r\n /**\r\n * Register an event listener for driver lifecycle events.\r\n *\r\n * @param event - Event name ('connected', 'disconnected', etc.)\r\n * @param listener - Callback function to invoke\r\n */\r\n public on(event: string, listener: DriverEventListener): void {\r\n if (!this._eventListeners.has(event)) {\r\n this._eventListeners.set(event, new Set());\r\n }\r\n\r\n this._eventListeners.get(event)!.add(listener);\r\n }\r\n\r\n /**\r\n * Serialize data for storage in PostgreSQL.\r\n *\r\n * Handles Date objects, BigInt, and other JavaScript types\r\n * that need special handling for PostgreSQL storage.\r\n *\r\n * @param data - The data object to serialize\r\n * @returns Serialized data ready for PostgreSQL\r\n */\r\n public serialize(data: Record<string, unknown>): Record<string, unknown> {\r\n const serialized: Record<string, unknown> = {};\r\n\r\n for (const [key, value] of Object.entries(data)) {\r\n if (value === undefined) {\r\n continue; // Skip undefined values\r\n }\r\n\r\n if (value instanceof Date) {\r\n serialized[key] = value.toISOString();\r\n } else if (typeof value === \"bigint\") {\r\n serialized[key] = value.toString();\r\n } else if (typeof value === \"object\" && value !== null && !Array.isArray(value)) {\r\n // Nested objects will be stored as JSONB\r\n serialized[key] = value;\r\n } else if (\r\n Array.isArray(value) &&\r\n value.length > 0 &&\r\n value.every((v) => typeof v === \"number\")\r\n ) {\r\n // pgvector columns expect the literal '[n1,n2,...]' format.\r\n // If we pass a raw JS number[] the pg driver serializes it as a\r\n // PostgreSQL array '{n1,n2,...}' which the vector type rejects.\r\n serialized[key] = `[${value.join(\",\")}]`;\r\n } else {\r\n serialized[key] = value;\r\n }\r\n }\r\n\r\n return serialized;\r\n }\r\n\r\n /**\r\n * Get the dirty tracker for this driver.\r\n */\r\n public getDirtyTracker(data: Record<string, unknown>): SqlDatabaseDirtyTracker {\r\n return new SqlDatabaseDirtyTracker(data);\r\n }\r\n\r\n /**\r\n * Deserialize data retrieved from PostgreSQL.\r\n *\r\n * Converts PostgreSQL types back to JavaScript equivalents.\r\n *\r\n * @param data - The data object from PostgreSQL\r\n * @returns Deserialized JavaScript object\r\n */\r\n public deserialize(data: Record<string, unknown>): Record<string, unknown> {\r\n // PostgreSQL pg driver handles most type conversions automatically\r\n // Special handling can be added here if needed\r\n for (const [key, value] of Object.entries(data)) {\r\n // Only re-inflate strings — pg already returns Date objects from DB reads\r\n if (typeof value !== \"string\") continue;\r\n\r\n if (isValidDateValue(value)) {\r\n data[key] = new Date(value);\r\n continue;\r\n }\r\n\r\n // pgvector columns are returned as '[n1,n2,...]' strings.\r\n // charCodeAt is faster than startsWith/endsWith — no string allocation.\r\n // '[' = 91, ']' = 93\r\n if (value.charCodeAt(0) === 91 && value.charCodeAt(value.length - 1) === 93) {\r\n const parts = value.slice(1, -1).split(\",\");\r\n const nums = new Array<number>(parts.length);\r\n let isNumericVector = parts.length > 0;\r\n\r\n for (let i = 0; i < parts.length; i++) {\r\n const n = +parts[i]; // unary + is the fastest string-to-number coercion\r\n if (!Number.isFinite(n)) {\r\n isNumericVector = false;\r\n break; // early-exit — not a numeric vector, leave value untouched\r\n }\r\n nums[i] = n;\r\n }\r\n\r\n if (isNumericVector) {\r\n data[key] = nums;\r\n }\r\n }\r\n }\r\n\r\n return data;\r\n }\r\n\r\n /**\r\n * Insert a single row into a table.\r\n *\r\n * Uses INSERT ... RETURNING to get the inserted row with generated values.\r\n *\r\n * @param table - Target table name\r\n * @param document - Data to insert\r\n * @param options - Optional insertion options\r\n * @returns The inserted document\r\n */\r\n public async insert(\r\n table: string,\r\n document: Record<string, unknown>,\r\n _options?: Record<string, unknown>,\r\n ): Promise<InsertResult> {\r\n const serialized = this.serialize(document);\r\n\r\n // Filter out id if null/undefined to let PostgreSQL SERIAL auto-generate\r\n const filteredData = Object.fromEntries(\r\n Object.entries(serialized).filter(([key, value]) => {\r\n // Exclude id if null/undefined (let SERIAL handle it)\r\n if (key === \"id\" && (value === null || value === undefined)) {\r\n return false;\r\n }\r\n return true;\r\n }),\r\n );\r\n\r\n const columns = Object.keys(filteredData);\r\n const values = Object.values(filteredData);\r\n\r\n if (columns.length === 0) {\r\n throw new Error(\"Cannot insert empty document\");\r\n }\r\n\r\n const quotedColumns = columns.map((c) => this.dialect.quoteIdentifier(c)).join(\", \");\r\n const placeholders = columns.map((_, i) => this.dialect.placeholder(i + 1)).join(\", \");\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n\r\n const sql = `INSERT INTO ${quotedTable} (${quotedColumns}) VALUES (${placeholders}) RETURNING *`;\r\n\r\n const result = await this.query<Record<string, unknown>>(sql, values);\r\n\r\n return {\r\n document: result.rows[0],\r\n };\r\n }\r\n\r\n /**\r\n * Insert multiple rows into a table.\r\n *\r\n * Uses a single INSERT statement with multiple value sets for efficiency.\r\n *\r\n * @param table - Target table name\r\n * @param documents - Array of documents to insert\r\n * @param options - Optional insertion options\r\n * @returns Array of inserted documents\r\n */\r\n public async insertMany(\r\n table: string,\r\n documents: Record<string, unknown>[],\r\n _options?: Record<string, unknown>,\r\n ): Promise<InsertResult[]> {\r\n if (documents.length === 0) {\r\n return [];\r\n }\r\n\r\n // Get all unique columns across all documents\r\n const allColumns = new Set<string>();\r\n for (const doc of documents) {\r\n const serialized = this.serialize(doc);\r\n Object.keys(serialized).forEach((key) => allColumns.add(key));\r\n }\r\n const columns = Array.from(allColumns);\r\n\r\n const quotedColumns = columns.map((c) => this.dialect.quoteIdentifier(c)).join(\", \");\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n\r\n // Build value sets and params\r\n const valueSets: string[] = [];\r\n const params: unknown[] = [];\r\n let paramIndex = 1;\r\n\r\n for (const doc of documents) {\r\n const serialized = this.serialize(doc);\r\n const rowPlaceholders: string[] = [];\r\n\r\n for (const col of columns) {\r\n if (col in serialized) {\r\n rowPlaceholders.push(this.dialect.placeholder(paramIndex++));\r\n params.push(serialized[col]);\r\n } else {\r\n rowPlaceholders.push(\"DEFAULT\");\r\n }\r\n }\r\n\r\n valueSets.push(`(${rowPlaceholders.join(\", \")})`);\r\n }\r\n\r\n const sql = `INSERT INTO ${quotedTable} (${quotedColumns}) VALUES ${valueSets.join(\", \")} RETURNING *`;\r\n\r\n const result = await this.query<Record<string, unknown>>(sql, params);\r\n\r\n return result.rows as unknown as InsertResult[];\r\n }\r\n\r\n /**\r\n * Update a single row matching the filter.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param update - Update operations ($set, $unset, $inc)\r\n * @param options - Optional update options\r\n * @returns Update result with modified count\r\n */\r\n public async update(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n update: UpdateOperations,\r\n _options?: Record<string, unknown>,\r\n ): Promise<UpdateResult> {\r\n const { sql, params } = this.buildUpdateQuery(table, filter, update, 1);\r\n try {\r\n const result = await this.query(sql, params);\r\n\r\n return {\r\n modifiedCount: result.rowCount ?? 0,\r\n };\r\n } catch (error) {\r\n console.log(\"PG Query Error in:\", sql, params);\r\n\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Find one and update a single row matching the filter and return the updated row\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param update - Update operations ($set, $unset, $inc)\r\n * @param options - Optional update options\r\n * @returns The updated row or null\r\n */\r\n public async findOneAndUpdate<T = unknown>(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n update: UpdateOperations,\r\n _options?: Record<string, unknown>,\r\n ): Promise<T | null> {\r\n const { sql, params } = this.buildUpdateQuery(table, filter, update, 1);\r\n // Add RETURNING * to get the updated row back\r\n const sqlWithReturning = `${sql} RETURNING *`;\r\n const result = await this.query<T>(sqlWithReturning, params);\r\n return result.rows[0] ?? null;\r\n }\r\n\r\n /**\r\n * Update multiple rows matching the filter.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param update - Update operations\r\n * @param options - Optional update options\r\n * @returns Update result with modified count\r\n */\r\n public async updateMany(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n update: UpdateOperations,\r\n _options?: Record<string, unknown>,\r\n ): Promise<UpdateResult> {\r\n const { sql, params } = this.buildUpdateQuery(table, filter, update);\r\n\r\n const result = await this.query(sql, params);\r\n\r\n return {\r\n modifiedCount: result.rowCount ?? 0,\r\n };\r\n }\r\n\r\n /**\r\n * Replace a document matching the filter.\r\n *\r\n * Completely replaces the document (not a partial update).\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param document - New document data\r\n * @param options - Optional options\r\n * @returns The replaced document or null\r\n */\r\n public async replace<T = unknown>(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n document: Record<string, unknown>,\r\n _options?: Record<string, unknown>,\r\n ): Promise<T | null> {\r\n const serialized = this.serialize(document);\r\n const columns = Object.keys(serialized);\r\n const values = Object.values(serialized);\r\n\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const setClauses = columns\r\n .map((col, i) => `${this.dialect.quoteIdentifier(col)} = ${this.dialect.placeholder(i + 1)}`)\r\n .join(\", \");\r\n\r\n const { whereClause, whereParams } = this.buildWhereClause(filter, columns.length + 1);\r\n\r\n const sql = `UPDATE ${quotedTable} SET ${setClauses} ${whereClause} RETURNING *`;\r\n const params = [...values, ...whereParams];\r\n\r\n const result = await this.query<T>(sql, params);\r\n\r\n return result.rows[0] ?? null;\r\n }\r\n\r\n /**\r\n * Upsert (insert or update) a single row.\r\n *\r\n * Uses PostgreSQL's INSERT ... ON CONFLICT ... DO UPDATE syntax.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions to find existing row (used for conflict detection)\r\n * @param document - Document data to insert or update\r\n * @param options - Upsert options (conflictColumns for conflict target)\r\n * @returns The upserted row\r\n */\r\n public async upsert<T = unknown>(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n document: Record<string, unknown>,\r\n options?: Record<string, unknown>,\r\n ): Promise<T> {\r\n const serialized = this.serialize(document);\r\n const columns = Object.keys(serialized);\r\n const values = Object.values(serialized);\r\n\r\n if (columns.length === 0) {\r\n throw new Error(\"Cannot upsert empty document\");\r\n }\r\n\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const quotedColumns = columns.map((c) => this.dialect.quoteIdentifier(c)).join(\", \");\r\n const placeholders = columns.map((_, i) => this.dialect.placeholder(i + 1)).join(\", \");\r\n\r\n // Determine conflict columns from options or filter\r\n const conflictColumns = (options?.conflictColumns as string[]) ?? Object.keys(filter);\r\n if (conflictColumns.length === 0) {\r\n throw new Error(\"Upsert requires conflictColumns option or filter with columns\");\r\n }\r\n\r\n const quotedConflictColumns = conflictColumns\r\n .map((c) => this.dialect.quoteIdentifier(c))\r\n .join(\", \");\r\n\r\n // Build UPDATE clause for ON CONFLICT\r\n // Update all columns except the conflict columns (they stay the same)\r\n const updateColumns = columns.filter((col) => !conflictColumns.includes(col));\r\n const setClauses = updateColumns\r\n .map((col, i) => {\r\n const valueIndex = columns.indexOf(col) + 1;\r\n return `${this.dialect.quoteIdentifier(col)} = ${this.dialect.placeholder(valueIndex)}`;\r\n })\r\n .join(\", \");\r\n\r\n // If there are no columns to update (all columns are conflict columns), use EXCLUDED\r\n const updateClause =\r\n setClauses.length > 0\r\n ? setClauses\r\n : columns\r\n .map(\r\n (col) =>\r\n `${this.dialect.quoteIdentifier(col)} = EXCLUDED.${this.dialect.quoteIdentifier(col)}`,\r\n )\r\n .join(\", \");\r\n\r\n const sql = `INSERT INTO ${quotedTable} (${quotedColumns}) VALUES (${placeholders}) ON CONFLICT (${quotedConflictColumns}) DO UPDATE SET ${updateClause} RETURNING *`;\r\n\r\n const result = await this.query<T>(sql, values);\r\n\r\n return result.rows[0]! as T;\r\n }\r\n\r\n /**\r\n * Find one and delete a single row matching the filter and return the deleted row.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param options - Optional delete options\r\n * @returns The deleted row or null\r\n */\r\n public async findOneAndDelete<T = unknown>(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n _options?: Record<string, unknown>,\r\n ): Promise<T | null> {\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const { whereClause, whereParams } = this.buildWhereClause(filter, 1);\r\n\r\n // Use ctid for single row deletion with RETURNING\r\n const sql = `DELETE FROM ${quotedTable} WHERE ctid IN (SELECT ctid FROM ${quotedTable} ${whereClause} LIMIT 1) RETURNING *`;\r\n\r\n const result = await this.query<T>(sql, whereParams);\r\n\r\n return result.rows[0] ? (result.rows[0] as T) : null;\r\n }\r\n\r\n /**\r\n * Delete a single row matching the filter.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param options - Optional options\r\n * @returns Number of deleted rows (0 or 1)\r\n */\r\n public async delete(\r\n table: string,\r\n filter?: Record<string, unknown>,\r\n _options?: Record<string, unknown>,\r\n ): Promise<number> {\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const { whereClause, whereParams } = this.buildWhereClause(filter ?? {}, 1);\r\n\r\n // Use ctid for single row deletion\r\n const sql = `DELETE FROM ${quotedTable} WHERE ctid IN (SELECT ctid FROM ${quotedTable} ${whereClause} LIMIT 1)`;\r\n\r\n const result = await this.query(sql, whereParams);\r\n\r\n return result.rowCount ?? 0;\r\n }\r\n\r\n /**\r\n * Delete multiple rows matching the filter.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param options - Optional options\r\n * @returns Number of deleted rows\r\n */\r\n public async deleteMany(\r\n table: string,\r\n filter?: Record<string, unknown>,\r\n _options?: Record<string, unknown>,\r\n ): Promise<number> {\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const { whereClause, whereParams } = this.buildWhereClause(filter ?? {}, 1);\r\n\r\n const sql = `DELETE FROM ${quotedTable} ${whereClause}`;\r\n\r\n const result = await this.query(sql, whereParams);\r\n\r\n return result.rowCount ?? 0;\r\n }\r\n\r\n /**\r\n * Truncate a table (remove all rows).\r\n *\r\n * Uses TRUNCATE TABLE for fast deletion with RESTART IDENTITY.\r\n *\r\n * @param table - Target table name\r\n * @param options - Optional options\r\n * @param options.cascade - If true, automatically truncate all tables with foreign key references (use with caution)\r\n * @returns Number of deleted rows (always 0 for TRUNCATE)\r\n */\r\n public async truncateTable(table: string, options?: { cascade?: boolean }): Promise<number> {\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const cascadeClause = options?.cascade ? \" CASCADE\" : \"\";\r\n await this.query(`TRUNCATE TABLE ${quotedTable} RESTART IDENTITY${cascadeClause}`);\r\n return 0; // TRUNCATE doesn't return row count\r\n }\r\n\r\n /**\r\n * Get a query builder for the specified table.\r\n *\r\n * @param table - Target table name\r\n * @returns Query builder instance\r\n */\r\n public queryBuilder<T = unknown>(table: string): QueryBuilderContract<T> {\r\n return new PostgresQueryBuilder<T>(table) as unknown as QueryBuilderContract<T>;\r\n }\r\n\r\n /**\r\n * Begin a new database transaction.\r\n *\r\n * Acquires a client from the pool and starts a transaction.\r\n * The client is stored in AsyncLocalStorage for automatic\r\n * participation by subsequent queries.\r\n *\r\n * @param options - Optional transaction options\r\n * @returns Transaction contract with commit/rollback methods\r\n */\r\n public async beginTransaction(\r\n options?: PostgresTransactionOptions,\r\n ): Promise<DriverTransactionContract<PgPoolClient>> {\r\n const client = await this.pool.connect();\r\n\r\n let beginSql = \"BEGIN\";\r\n if (options?.isolationLevel) {\r\n beginSql += ` ISOLATION LEVEL ${options.isolationLevel.toUpperCase()}`;\r\n }\r\n if (options?.readOnly) {\r\n beginSql += \" READ ONLY\";\r\n }\r\n if (options?.deferrable) {\r\n beginSql += \" DEFERRABLE\";\r\n }\r\n\r\n await client.query(beginSql);\r\n\r\n return {\r\n context: client,\r\n commit: async () => {\r\n await client.query(\"COMMIT\");\r\n client.release();\r\n },\r\n rollback: async () => {\r\n await client.query(\"ROLLBACK\");\r\n client.release();\r\n },\r\n };\r\n }\r\n\r\n /**\r\n * Execute a function within a transaction scope (recommended pattern).\r\n *\r\n * Automatically commits on success, rolls back on any error, and guarantees\r\n * resource cleanup. This is the recommended way to use transactions.\r\n *\r\n * @param fn - Async function to execute within transaction\r\n * @param options - Transaction options (isolation level, read-only, etc.)\r\n * @returns The return value of the callback function\r\n * @throws {Error} If transaction fails or is explicitly rolled back\r\n */\r\n public async transaction<T>(\r\n fn: (ctx: TransactionContext) => Promise<T>,\r\n options?: Record<string, unknown>,\r\n ): Promise<T> {\r\n // Prevent nested transaction() calls\r\n if (databaseTransactionContext.hasActiveTransaction()) {\r\n // throw new Error(\r\n // \"Nested transaction() calls are not supported. \" +\r\n // \"Use beginTransaction() with savepoints for advanced transaction patterns.\",\r\n // );\r\n }\r\n\r\n const tx = await this.beginTransaction(options);\r\n\r\n // Set transaction context for queries within callback\r\n databaseTransactionContext.enter({ session: tx.context });\r\n\r\n try {\r\n // Create transaction context with rollback method\r\n const ctx: TransactionContext = {\r\n rollback(reason?: string): never {\r\n throw new TransactionRollbackError(reason);\r\n },\r\n };\r\n\r\n // Execute callback\r\n const result = await fn(ctx);\r\n\r\n // Auto-commit on success\r\n await tx.commit();\r\n\r\n return result;\r\n } catch (error) {\r\n // Auto-rollback on any error (including explicit rollback)\r\n await tx.rollback();\r\n log.error(\r\n `database.postgress`,\r\n \"transaction\",\r\n \"Transaction operation failed, rolled back everything\",\r\n );\r\n throw error;\r\n } finally {\r\n // Guaranteed cleanup\r\n databaseTransactionContext.exit();\r\n }\r\n }\r\n\r\n /**\r\n * Perform an atomic update operation.\r\n *\r\n * Builds and executes an UPDATE query for the given filter and operations.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param operations - Update operations\r\n * @param options - Optional options\r\n * @returns Update result\r\n */\r\n public async atomic(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n operations: UpdateOperations,\r\n _options?: Record<string, unknown>,\r\n ): Promise<UpdateResult> {\r\n const { sql, params } = this.buildUpdateQuery(table, filter, operations, 1);\r\n\r\n const result = await this.query(sql, params);\r\n\r\n return {\r\n modifiedCount: result.rowCount ?? 0,\r\n };\r\n }\r\n\r\n /**\r\n * Get the sync adapter for bulk denormalized updates.\r\n *\r\n * @returns Sync adapter instance\r\n */\r\n public syncAdapter(): SyncAdapterContract {\r\n if (!this._syncAdapter) {\r\n this._syncAdapter = new PostgresSyncAdapter(this);\r\n }\r\n return this._syncAdapter;\r\n }\r\n\r\n /**\r\n * Get the migration driver for schema operations.\r\n *\r\n * @returns Migration driver instance\r\n */\r\n public migrationDriver(): MigrationDriverContract {\r\n if (!this._migrationDriver) {\r\n this._migrationDriver = new PostgresMigrationDriver(this);\r\n }\r\n\r\n return this._migrationDriver;\r\n }\r\n\r\n /**\r\n * Return a SQL serializer for this driver's dialect.\r\n * Used by Migration.toSQL() to convert pending operations to SQL strings.\r\n */\r\n public getSQLSerializer(): SQLSerializer {\r\n return new PostgresSQLSerializer(this.dialect);\r\n }\r\n\r\n /**\r\n * Execute a raw SQL query.\r\n *\r\n * Automatically uses the transaction client if one is active.\r\n *\r\n * @param sql - SQL query string\r\n * @param params - Query parameters\r\n * @returns Query result\r\n */\r\n public async query<T = Record<string, unknown>>(\r\n sql: string,\r\n params: unknown[] = [],\r\n ): Promise<PostgresQueryResult<T>> {\r\n // Check for active transaction client\r\n const txClient = databaseTransactionContext.getSession() as PgPoolClient | undefined;\r\n\r\n const startTime = this.config.logging ? performance.now() : 0;\r\n\r\n let paramsString = \"\";\r\n if (this.config.logging && params.length > 0) {\r\n paramsString = JSON.stringify(params);\r\n if (paramsString.length > 300) {\r\n paramsString = paramsString.substring(0, 300) + \"...\";\r\n }\r\n paramsString = ` | Params: ${paramsString}`;\r\n }\r\n\r\n try {\r\n let result;\r\n if (this.config.logging) {\r\n log.info({\r\n module: \"database.postgres\",\r\n action: \"query.executing\",\r\n message: `${sql}${paramsString}`,\r\n context: { params, sql },\r\n });\r\n }\r\n if (txClient) {\r\n result = await txClient.query(sql, params);\r\n } else {\r\n result = await this.pool.query(sql, params);\r\n }\r\n\r\n if (this.config.logging) {\r\n const duration = (performance.now() - startTime).toFixed(2);\r\n log.success({\r\n module: \"database.postgres\",\r\n action: \"query.executed\",\r\n message: `[${duration}ms] ${sql}${paramsString}`,\r\n context: { params, sql, duration },\r\n });\r\n }\r\n\r\n return result as PostgresQueryResult<T>;\r\n } catch (error) {\r\n if (this.config.logging) {\r\n const duration = (performance.now() - startTime).toFixed(2);\r\n log.error({\r\n module: \"database.postgres\",\r\n action: \"query.error\",\r\n message: `[${duration}ms] ${sql}${paramsString}`,\r\n context: {\r\n sql,\r\n params,\r\n error: error instanceof Error ? error.message : String(error),\r\n },\r\n });\r\n }\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Emit an event to all registered listeners.\r\n *\r\n * @param event - Event name\r\n * @param args - Event arguments\r\n */\r\n private emit(event: string, ...args: unknown[]): void {\r\n const listeners = this._eventListeners.get(event);\r\n if (listeners) {\r\n for (const listener of listeners) {\r\n listener(...args);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Build a simple WHERE clause from a filter object.\r\n *\r\n * @param filter - Filter conditions\r\n * @param startParamIndex - Starting parameter index\r\n * @returns Object with WHERE clause string and parameters\r\n */\r\n private buildWhereClause(\r\n filter: Record<string, unknown>,\r\n startParamIndex: number,\r\n ): { whereClause: string; whereParams: unknown[] } {\r\n const conditions: string[] = [];\r\n const params: unknown[] = [];\r\n let paramIndex = startParamIndex;\r\n\r\n for (const [key, value] of Object.entries(filter)) {\r\n const quotedKey = this.dialect.quoteIdentifier(key);\r\n\r\n if (value === null) {\r\n conditions.push(`${quotedKey} IS NULL`);\r\n } else {\r\n conditions.push(`${quotedKey} = ${this.dialect.placeholder(paramIndex++)}`);\r\n params.push(value);\r\n }\r\n }\r\n\r\n const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(\" AND \")}` : \"\";\r\n\r\n return { whereClause, whereParams: params };\r\n }\r\n\r\n /**\r\n * Build an UPDATE query from update operations.\r\n *\r\n * @param table - Target table name\r\n * @param filter - Filter conditions\r\n * @param update - Update operations\r\n * @param limit - Optional limit (for single row update)\r\n * @returns Object with SQL and parameters\r\n */\r\n private buildUpdateQuery(\r\n table: string,\r\n filter: Record<string, unknown>,\r\n update: UpdateOperations,\r\n limit?: number,\r\n ): { sql: string; params: unknown[] } {\r\n const setClauses: string[] = [];\r\n const params: unknown[] = [];\r\n let paramIndex = 1;\r\n\r\n // Handle $set\r\n if (update.$set) {\r\n for (const [key, value] of Object.entries(update.$set)) {\r\n setClauses.push(\r\n `${this.dialect.quoteIdentifier(key)} = ${this.dialect.placeholder(paramIndex++)}`,\r\n );\r\n params.push(value);\r\n }\r\n }\r\n\r\n // Handle $unset (set to NULL)\r\n if (update.$unset) {\r\n for (const key of Object.keys(update.$unset)) {\r\n setClauses.push(`${this.dialect.quoteIdentifier(key)} = NULL`);\r\n }\r\n }\r\n\r\n // Handle $inc\r\n if (update.$inc) {\r\n for (const [key, amount] of Object.entries(update.$inc)) {\r\n const quotedKey = this.dialect.quoteIdentifier(key);\r\n setClauses.push(\r\n `${quotedKey} = COALESCE(${quotedKey}, 0) + ${this.dialect.placeholder(paramIndex++)}`,\r\n );\r\n params.push(amount);\r\n }\r\n }\r\n\r\n // Handle $dec\r\n if (update.$dec) {\r\n for (const [key, amount] of Object.entries(update.$dec)) {\r\n const quotedKey = this.dialect.quoteIdentifier(key);\r\n setClauses.push(\r\n `${quotedKey} = COALESCE(${quotedKey}, 0) - ${this.dialect.placeholder(paramIndex++)}`,\r\n );\r\n params.push(amount);\r\n }\r\n }\r\n\r\n if (setClauses.length === 0) {\r\n throw new Error(\"No update operations specified\");\r\n }\r\n\r\n const quotedTable = this.dialect.quoteIdentifier(table);\r\n const { whereClause, whereParams } = this.buildWhereClause(filter, paramIndex);\r\n params.push(...whereParams);\r\n\r\n let sql = `UPDATE ${quotedTable} SET ${setClauses.join(\", \")} ${whereClause}`;\r\n\r\n // For single row update, use ctid subquery\r\n if (limit === 1 && whereClause) {\r\n sql = `UPDATE ${quotedTable} SET ${setClauses.join(\", \")} WHERE ctid IN (SELECT ctid FROM ${quotedTable} ${whereClause} LIMIT 1)`;\r\n }\r\n\r\n return { sql, params };\r\n }\r\n\r\n // ============================================================\r\n // Database Lifecycle Operations\r\n // ============================================================\r\n\r\n /**\r\n * Create a new database.\r\n *\r\n * Note: This requires connecting to a system database (like 'postgres')\r\n * since you cannot create a database while connected to it.\r\n *\r\n * @param name - Database name to create\r\n * @param options - Creation options (encoding, template, etc.)\r\n * @returns true if created, false if already exists\r\n */\r\n public async createDatabase(name: string, options?: CreateDatabaseOptions): Promise<boolean> {\r\n // Check if database already exists\r\n if (await this.databaseExists(name)) {\r\n return false;\r\n }\r\n\r\n // Build CREATE DATABASE statement\r\n const quotedName = this.dialect.quoteIdentifier(name);\r\n let sql = `CREATE DATABASE ${quotedName}`;\r\n\r\n const withClauses: string[] = [];\r\n\r\n if (options?.encoding) {\r\n withClauses.push(`ENCODING = '${options.encoding}'`);\r\n }\r\n if (options?.template) {\r\n withClauses.push(`TEMPLATE = ${this.dialect.quoteIdentifier(options.template)}`);\r\n }\r\n if (options?.locale) {\r\n withClauses.push(`LC_COLLATE = '${options.locale}'`);\r\n withClauses.push(`LC_CTYPE = '${options.locale}'`);\r\n }\r\n if (options?.owner) {\r\n withClauses.push(`OWNER = ${this.dialect.quoteIdentifier(options.owner)}`);\r\n }\r\n\r\n if (withClauses.length > 0) {\r\n sql += ` WITH ${withClauses.join(\" \")}`;\r\n }\r\n\r\n try {\r\n await this.query(sql);\r\n log.success(\"database\", \"lifecycle\", `Created database ${name}`);\r\n return true;\r\n } catch (error) {\r\n log.error(\"database\", \"lifecycle\", `Failed to create database ${name}: ${error}`);\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Drop a database.\r\n *\r\n * @param name - Database name to drop\r\n * @param options - Drop options\r\n * @returns true if dropped, false if didn't exist\r\n */\r\n public async dropDatabase(name: string, options?: DropDatabaseOptions): Promise<boolean> {\r\n // Check if database exists first (if ifExists option not set)\r\n if (!options?.ifExists && !(await this.databaseExists(name))) {\r\n return false;\r\n }\r\n\r\n const quotedName = this.dialect.quoteIdentifier(name);\r\n let sql = \"DROP DATABASE\";\r\n\r\n if (options?.ifExists) {\r\n sql += \" IF EXISTS\";\r\n }\r\n\r\n sql += ` ${quotedName}`;\r\n\r\n // PostgreSQL 13+ supports WITH (FORCE) to terminate active connections\r\n if (options?.force) {\r\n sql += \" WITH (FORCE)\";\r\n }\r\n\r\n try {\r\n await this.query(sql);\r\n log.success(\"database\", \"lifecycle\", `Dropped database ${name}`);\r\n return true;\r\n } catch (error) {\r\n log.error(\"database\", \"lifecycle\", `Failed to drop database ${name}: ${error}`);\r\n throw error;\r\n }\r\n }\r\n\r\n /**\r\n * Check if a database exists.\r\n *\r\n * @param name - Database name to check\r\n * @returns true if database exists\r\n */\r\n public async databaseExists(name: string): Promise<boolean> {\r\n const result = await this.query<{ exists: boolean }>(\r\n `SELECT EXISTS(SELECT 1 FROM pg_database WHERE datname = $1) as exists`,\r\n [name],\r\n );\r\n\r\n return result.rows[0]?.exists ?? false;\r\n }\r\n\r\n /**\r\n * List all databases.\r\n *\r\n * @returns Array of database names\r\n */\r\n public async listDatabases(): Promise<string[]> {\r\n const result = await this.query<{ datname: string }>(\r\n `SELECT datname FROM pg_database WHERE datistemplate = false ORDER BY datname`,\r\n );\r\n\r\n return result.rows.map((row) => row.datname);\r\n }\r\n\r\n // ============================================================\r\n // Table Management Operations\r\n // ============================================================\r\n\r\n /**\r\n * Drop a table.\r\n *\r\n * @param name - Table name to drop\r\n * @throws Error if table doesn't exist\r\n */\r\n public async dropTable(name: string): Promise<void> {\r\n const quotedName = this.dialect.quoteIdentifier(name);\r\n await this.query(`DROP TABLE ${quotedName}`);\r\n log.success(\"database\", \"table\", `Dropped table ${name}`);\r\n }\r\n\r\n /**\r\n * Drop a table if it exists.\r\n *\r\n * @param name - Table name to drop\r\n */\r\n public async dropTableIfExists(name: string): Promise<void> {\r\n const quotedName = this.dialect.quoteIdentifier(name);\r\n await this.query(`DROP TABLE IF EXISTS ${quotedName}`);\r\n }\r\n\r\n /**\r\n * Drop all tables in the current database.\r\n *\r\n * Uses CASCADE to handle foreign key dependencies.\r\n * Useful for `migrate:fresh` command.\r\n */\r\n public async dropAllTables(): Promise<void> {\r\n // Get all tables from blueprint\r\n const tables = await this.blueprint.listTables();\r\n\r\n if (tables.length === 0) {\r\n return;\r\n }\r\n\r\n // Drop all tables with CASCADE to handle foreign keys\r\n for (const table of tables) {\r\n const quotedName = this.dialect.quoteIdentifier(table);\r\n await this.query(`DROP TABLE IF EXISTS ${quotedName} CASCADE`);\r\n }\r\n\r\n log.success(\"database\", \"table\", `Dropped ${tables.length} tables`);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,IAAI;;;;;;;AAQJ,eAAe,SAAuC;CACpD,IAAI,UACF,OAAO;CAGT,IAAI;EACF,WAAW,MAAM,OAAO;EACxB,OAAO;CACT,QAAQ;EACN,MAAM,IAAI,MACR,0FACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,iBAAb,MAAsD;CAkEhB;;;;CA9DpC,AAAgB,OAAO;;;;CAKvB,AAAgB,UAAU,IAAI,gBAAgB;;;;;;;;;;CAW9C,AAAgB,gBAAwC;EACtD,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACj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AK,MAAM,wBAAwB,WAAW,SAAS;EAC/D;EAEA,IAAI,QAAQ,YAAY,SAAS,WAAW,OAAO,OAAO,QAAQ;CACpE;AACF"}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import { MigrationDefaults } from "../../types.mjs";
|
|
2
|
+
import { TableIndexInformation } from "../../contracts/driver-blueprint.contract.mjs";
|
|
3
|
+
import { ColumnDefinition, ForeignKeyDefinition, FullTextIndexOptions, GeoIndexOptions, IndexDefinition, MigrationDriverContract, VectorIndexOptions } from "../../contracts/migration-driver.contract.mjs";
|
|
4
|
+
import { PostgresDriver } from "./postgres-driver.mjs";
|
|
5
|
+
|
|
6
|
+
//#region ../../@warlock.js/cascade/src/drivers/postgres/postgres-migration-driver.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* PostgreSQL Migration Driver.
|
|
9
|
+
*
|
|
10
|
+
* Handles database schema operations for PostgreSQL including:
|
|
11
|
+
* - Table creation and deletion
|
|
12
|
+
* - Column management
|
|
13
|
+
* - Index creation (B-tree, GIN, GiST, etc.)
|
|
14
|
+
* - Constraint management (foreign keys, unique, etc.)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const migrationDriver = driver.migrationDriver();
|
|
19
|
+
*
|
|
20
|
+
* // Create a table
|
|
21
|
+
* await migrationDriver.createTable('users');
|
|
22
|
+
*
|
|
23
|
+
* // Add columns
|
|
24
|
+
* await migrationDriver.addColumn('users', {
|
|
25
|
+
* name: 'email',
|
|
26
|
+
* type: 'string',
|
|
27
|
+
* length: 255,
|
|
28
|
+
* nullable: false
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Create unique index
|
|
32
|
+
* await migrationDriver.createUniqueIndex('users', ['email']);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare class PostgresMigrationDriver implements MigrationDriverContract {
|
|
36
|
+
readonly driver: PostgresDriver;
|
|
37
|
+
/**
|
|
38
|
+
* Active transaction client (if any).
|
|
39
|
+
*/
|
|
40
|
+
private get transactionClient();
|
|
41
|
+
/**
|
|
42
|
+
* Create a new migration driver.
|
|
43
|
+
*
|
|
44
|
+
* @param driver - The PostgreSQL driver instance
|
|
45
|
+
*/
|
|
46
|
+
constructor(driver: PostgresDriver);
|
|
47
|
+
/**
|
|
48
|
+
* Create a new table with a default id column.
|
|
49
|
+
*
|
|
50
|
+
* @param table - Table name
|
|
51
|
+
*/
|
|
52
|
+
createTable(table: string): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Create table if it doesn't exist.
|
|
55
|
+
*
|
|
56
|
+
* @param table - Table name
|
|
57
|
+
*/
|
|
58
|
+
createTableIfNotExists(table: string): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Drop an existing table.
|
|
61
|
+
*
|
|
62
|
+
* @param table - Table name
|
|
63
|
+
*/
|
|
64
|
+
dropTable(table: string): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Drop table if it exists.
|
|
67
|
+
*
|
|
68
|
+
* @param table - Table name
|
|
69
|
+
*/
|
|
70
|
+
dropTableIfExists(table: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Rename a table.
|
|
73
|
+
*
|
|
74
|
+
* @param from - Current table name
|
|
75
|
+
* @param to - New table name
|
|
76
|
+
*/
|
|
77
|
+
renameTable(from: string, to: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Truncate a table — remove all rows efficiently.
|
|
80
|
+
*
|
|
81
|
+
* @param table - Table name
|
|
82
|
+
*/
|
|
83
|
+
truncateTable(table: string): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Check if a table exists.
|
|
86
|
+
*
|
|
87
|
+
* @param table - Table name
|
|
88
|
+
* @returns Whether the table exists
|
|
89
|
+
*/
|
|
90
|
+
tableExists(table: string): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* List all columns in a table.
|
|
93
|
+
*
|
|
94
|
+
* @param table - Table name
|
|
95
|
+
* @returns Array of column definitions
|
|
96
|
+
*/
|
|
97
|
+
listColumns(table: string): Promise<ColumnDefinition[]>;
|
|
98
|
+
/**
|
|
99
|
+
* List all tables in the current database.
|
|
100
|
+
*
|
|
101
|
+
* @returns Array of table names
|
|
102
|
+
*/
|
|
103
|
+
listTables(): Promise<string[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Ensure the migrations tracking table exists.
|
|
106
|
+
*
|
|
107
|
+
* Creates the table with proper schema if it doesn't exist.
|
|
108
|
+
*
|
|
109
|
+
* @param tableName - Name of the migrations table
|
|
110
|
+
*/
|
|
111
|
+
ensureMigrationsTable(tableName: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Add a column to an existing table.
|
|
114
|
+
*
|
|
115
|
+
* @param table - Table name
|
|
116
|
+
* @param column - Column definition
|
|
117
|
+
*/
|
|
118
|
+
addColumn(table: string, column: ColumnDefinition): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Drop a column from a table.
|
|
121
|
+
*
|
|
122
|
+
* @param table - Table name
|
|
123
|
+
* @param column - Column name
|
|
124
|
+
*/
|
|
125
|
+
dropColumn(table: string, column: string): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Drop multiple columns from a table.
|
|
128
|
+
*
|
|
129
|
+
* @param table - Table name
|
|
130
|
+
* @param columns - Column names
|
|
131
|
+
*/
|
|
132
|
+
dropColumns(table: string, columns: string[]): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Rename a column.
|
|
135
|
+
*
|
|
136
|
+
* @param table - Table name
|
|
137
|
+
* @param from - Current column name
|
|
138
|
+
* @param to - New column name
|
|
139
|
+
*/
|
|
140
|
+
renameColumn(table: string, from: string, to: string): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Modify an existing column.
|
|
143
|
+
*
|
|
144
|
+
* @param table - Table name
|
|
145
|
+
* @param column - New column definition
|
|
146
|
+
*/
|
|
147
|
+
modifyColumn(table: string, column: ColumnDefinition): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Create standard timestamp columns (created_at, updated_at).
|
|
150
|
+
*
|
|
151
|
+
* PostgreSQL implementation creates TIMESTAMPTZ columns with NOW() defaults.
|
|
152
|
+
*
|
|
153
|
+
* @param table - Table name
|
|
154
|
+
*/
|
|
155
|
+
createTimestampColumns(table: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Create an index on one or more columns.
|
|
158
|
+
*
|
|
159
|
+
* Supports:
|
|
160
|
+
* - Regular column indexes
|
|
161
|
+
* - Expression-based indexes (e.g., `lower(email)`)
|
|
162
|
+
* - Covering indexes (INCLUDE clause)
|
|
163
|
+
* - Concurrent index creation (CONCURRENTLY keyword)
|
|
164
|
+
*
|
|
165
|
+
* @param table - Table name
|
|
166
|
+
* @param index - Index definition
|
|
167
|
+
*/
|
|
168
|
+
createIndex(table: string, index: IndexDefinition): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Drop an index.
|
|
171
|
+
*
|
|
172
|
+
* @param table - Table name
|
|
173
|
+
* @param indexNameOrColumns - Index name or columns
|
|
174
|
+
*/
|
|
175
|
+
dropIndex(table: string, indexNameOrColumns: string | string[]): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Create a unique index.
|
|
178
|
+
*
|
|
179
|
+
* @param table - Table name
|
|
180
|
+
* @param columns - Columns to include
|
|
181
|
+
* @param name - Optional index name
|
|
182
|
+
*/
|
|
183
|
+
createUniqueIndex(table: string, columns: string[], name?: string): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Drop a unique index.
|
|
186
|
+
*
|
|
187
|
+
* @param table - Table name
|
|
188
|
+
* @param columns - Columns in the index
|
|
189
|
+
*/
|
|
190
|
+
dropUniqueIndex(table: string, columns: string[]): Promise<void>;
|
|
191
|
+
/**
|
|
192
|
+
* Create a full-text search index using GIN.
|
|
193
|
+
*
|
|
194
|
+
* @param table - Table name
|
|
195
|
+
* @param columns - Columns to index
|
|
196
|
+
* @param options - Full-text options
|
|
197
|
+
*/
|
|
198
|
+
createFullTextIndex(table: string, columns: string[], options?: FullTextIndexOptions): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Drop a full-text search index.
|
|
201
|
+
*
|
|
202
|
+
* @param table - Table name
|
|
203
|
+
* @param name - Index name
|
|
204
|
+
*/
|
|
205
|
+
dropFullTextIndex(table: string, name: string): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Create a geo-spatial index using GiST.
|
|
208
|
+
*
|
|
209
|
+
* @param table - Table name
|
|
210
|
+
* @param column - Geo column
|
|
211
|
+
* @param options - Geo index options
|
|
212
|
+
*/
|
|
213
|
+
createGeoIndex(table: string, column: string, options?: GeoIndexOptions): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Drop a geo-spatial index.
|
|
216
|
+
*
|
|
217
|
+
* @param table - Table name
|
|
218
|
+
* @param column - Geo column
|
|
219
|
+
*/
|
|
220
|
+
dropGeoIndex(table: string, column: string): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Create a vector search index (requires pgvector extension).
|
|
223
|
+
*
|
|
224
|
+
* @param table - Table name
|
|
225
|
+
* @param column - Vector column
|
|
226
|
+
* @param options - Vector index options
|
|
227
|
+
*/
|
|
228
|
+
createVectorIndex(table: string, column: string, options: VectorIndexOptions): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Drop a vector search index.
|
|
231
|
+
*
|
|
232
|
+
* @param table - Table name
|
|
233
|
+
* @param column - Vector column
|
|
234
|
+
*/
|
|
235
|
+
dropVectorIndex(table: string, column: string): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Create a TTL index (not natively supported in PostgreSQL).
|
|
238
|
+
*
|
|
239
|
+
* Note: PostgreSQL doesn't have native TTL indexes like MongoDB.
|
|
240
|
+
* This creates a partial index and requires a scheduled job for cleanup.
|
|
241
|
+
*
|
|
242
|
+
* @param table - Table name
|
|
243
|
+
* @param column - Date column
|
|
244
|
+
* @param expireAfterSeconds - Expiration time in seconds
|
|
245
|
+
*/
|
|
246
|
+
createTTLIndex(table: string, column: string, expireAfterSeconds: number): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Drop a TTL index.
|
|
249
|
+
*
|
|
250
|
+
* @param table - Table name
|
|
251
|
+
* @param column - Column with TTL index
|
|
252
|
+
*/
|
|
253
|
+
dropTTLIndex(table: string, column: string): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* List all indexes on a table.
|
|
256
|
+
*
|
|
257
|
+
* @param table - Table name
|
|
258
|
+
* @returns Array of index metadata
|
|
259
|
+
*/
|
|
260
|
+
listIndexes(table: string): Promise<TableIndexInformation[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Check if a PostgreSQL extension is available on the database server.
|
|
263
|
+
*
|
|
264
|
+
* @param extension - Extension name (e.g., "vector")
|
|
265
|
+
*/
|
|
266
|
+
isExtensionAvailable(extension: string): Promise<boolean>;
|
|
267
|
+
/**
|
|
268
|
+
* Get the official documentation or installation URL for a PostgreSQL extension.
|
|
269
|
+
*
|
|
270
|
+
* @param extension - Extension name
|
|
271
|
+
*/
|
|
272
|
+
getExtensionDocsUrl(extension: string): string | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Add a foreign key constraint.
|
|
275
|
+
*
|
|
276
|
+
* @param table - Table name
|
|
277
|
+
* @param foreignKey - Foreign key definition
|
|
278
|
+
*/
|
|
279
|
+
addForeignKey(table: string, foreignKey: ForeignKeyDefinition): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* Drop a foreign key constraint.
|
|
282
|
+
*
|
|
283
|
+
* @param table - Table name
|
|
284
|
+
* @param name - Constraint name
|
|
285
|
+
*/
|
|
286
|
+
dropForeignKey(table: string, name: string): Promise<void>;
|
|
287
|
+
/**
|
|
288
|
+
* Add a primary key constraint.
|
|
289
|
+
*
|
|
290
|
+
* @param table - Table name
|
|
291
|
+
* @param columns - Primary key columns
|
|
292
|
+
*/
|
|
293
|
+
addPrimaryKey(table: string, columns: string[]): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Drop the primary key constraint.
|
|
296
|
+
*
|
|
297
|
+
* @param table - Table name
|
|
298
|
+
*/
|
|
299
|
+
dropPrimaryKey(table: string): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Add a CHECK constraint.
|
|
302
|
+
*
|
|
303
|
+
* @param table - Table name
|
|
304
|
+
* @param name - Constraint name
|
|
305
|
+
* @param expression - SQL CHECK expression
|
|
306
|
+
*/
|
|
307
|
+
addCheck(table: string, name: string, expression: string): Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* Drop a CHECK constraint.
|
|
310
|
+
*
|
|
311
|
+
* @param table - Table name
|
|
312
|
+
* @param name - Constraint name
|
|
313
|
+
*/
|
|
314
|
+
dropCheck(table: string, name: string): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Set schema validation (no-op for PostgreSQL).
|
|
317
|
+
*
|
|
318
|
+
* PostgreSQL uses column constraints instead.
|
|
319
|
+
*/
|
|
320
|
+
setSchemaValidation(_table: string, _schema: object): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Remove schema validation (no-op for PostgreSQL).
|
|
323
|
+
*/
|
|
324
|
+
removeSchemaValidation(_table: string): Promise<void>;
|
|
325
|
+
/**
|
|
326
|
+
* Begin a transaction.
|
|
327
|
+
*/
|
|
328
|
+
beginTransaction(): Promise<void>;
|
|
329
|
+
/**
|
|
330
|
+
* Commit the current transaction.
|
|
331
|
+
*/
|
|
332
|
+
commit(): Promise<void>;
|
|
333
|
+
/**
|
|
334
|
+
* Rollback the current transaction.
|
|
335
|
+
*/
|
|
336
|
+
rollback(): Promise<void>;
|
|
337
|
+
/**
|
|
338
|
+
* Whether transactions are supported.
|
|
339
|
+
*/
|
|
340
|
+
supportsTransactions(): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* Get the default transactional behavior for PostgreSQL.
|
|
343
|
+
*
|
|
344
|
+
* PostgreSQL supports transactional DDL operations, so migrations
|
|
345
|
+
* are wrapped in transactions by default for atomicity and safety.
|
|
346
|
+
*
|
|
347
|
+
* @returns true (PostgreSQL DDL is transactional)
|
|
348
|
+
*/
|
|
349
|
+
getDefaultTransactional(): boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Get the default UUID generation expression for PostgreSQL.
|
|
352
|
+
*
|
|
353
|
+
* Resolution order:
|
|
354
|
+
* 1. `migrationDefaults.uuidExpression` → raw expression (escape hatch)
|
|
355
|
+
* 2. `migrationDefaults.uuidStrategy` → mapped to PG function
|
|
356
|
+
* 3. Fallback → `gen_random_uuid()` (v4, PG 13+)
|
|
357
|
+
*
|
|
358
|
+
* @param migrationDefaults - Optional overrides from DataSource config
|
|
359
|
+
* @returns PostgreSQL SQL expression for UUID generation
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* driver.getUuidDefault(); // "gen_random_uuid()"
|
|
364
|
+
* driver.getUuidDefault({ uuidStrategy: "v7" }); // "uuidv7()"
|
|
365
|
+
* driver.getUuidDefault({ uuidExpression: "uuid_generate_v1mc()" }); // "uuid_generate_v1mc()"
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
getUuidDefault(migrationDefaults?: MigrationDefaults): string;
|
|
369
|
+
/**
|
|
370
|
+
* Execute raw operations with direct driver access.
|
|
371
|
+
*
|
|
372
|
+
* @param callback - Callback receiving the driver
|
|
373
|
+
*/
|
|
374
|
+
raw<T>(callback: (connection: unknown) => Promise<T>): Promise<T>;
|
|
375
|
+
/**
|
|
376
|
+
* Execute a SQL statement.
|
|
377
|
+
*
|
|
378
|
+
* @param sql - SQL to execute
|
|
379
|
+
* @param params - Query parameters
|
|
380
|
+
*/
|
|
381
|
+
private execute;
|
|
382
|
+
/**
|
|
383
|
+
* Map foreign key action to PostgreSQL syntax.
|
|
384
|
+
*/
|
|
385
|
+
private mapForeignKeyAction;
|
|
386
|
+
/**
|
|
387
|
+
* Map PostgreSQL data type to ColumnType.
|
|
388
|
+
*/
|
|
389
|
+
private mapPostgresTypeToColumnType;
|
|
390
|
+
}
|
|
391
|
+
//#endregion
|
|
392
|
+
export { PostgresMigrationDriver };
|
|
393
|
+
//# sourceMappingURL=postgres-migration-driver.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-migration-driver.d.mts","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/drivers/postgres/postgres-migration-driver.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqDa,uBAAA,YAAmC,uBAAA;EAAA,SAaX,MAAA,EAAQ,cAAA;EAuiBxC;;;EAAA,YAhjBS,iBAAA,CAAA;EA4nBqC;;;;;cAnnBd,MAAA,EAAQ,cAAA;EA6uBmB;;;;;EAluBjD,WAAA,CAAY,KAAA,WAAgB,OAAA;EAgzBR;;;;;EAryBpB,sBAAA,CAAuB,KAAA,WAAgB,OAAA;EAy3BwB;;;;;EA92B/D,SAAA,CAAU,KAAA,WAAgB,OAAA;EAjCJ;;;;;EA2CtB,iBAAA,CAAkB,KAAA,WAAgB,OAAA;EAhClC;;;;;;EA2CA,WAAA,CAAY,IAAA,UAAc,EAAA,WAAa,OAAA;EArB7B;;;;;EAgCV,aAAA,CAAc,KAAA,WAAgB,OAAA;EAXlB;;;;;;EAsBZ,WAAA,CAAY,KAAA,WAAgB,OAAA;EAAhB;;;;;;EAkBZ,WAAA,CAAY,KAAA,WAAgB,OAAA,CAAQ,gBAAA;EAyCtB;;;;;EAAd,UAAA,CAAA,GAAc,OAAA;EA0CmB;;;;;;;EAxBjC,qBAAA,CAAsB,SAAA,WAAoB,OAAA;EAqH9B;;;;;;EA7FZ,SAAA,CAAU,KAAA,UAAe,MAAA,EAAQ,gBAAA,GAAmB,OAAA;EA0GG;;;;;;EAzBvD,UAAA,CAAW,KAAA,UAAe,MAAA,WAAiB,OAAA;EAsFpB;;;;;;EA1EvB,WAAA,CAAY,KAAA,UAAe,OAAA,aAAoB,OAAA;EAm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