@warlock.js/cascade 4.0.156 → 4.0.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- 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 -324
- package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.js +0 -799
- 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 -965
- 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 -864
- 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 -197
- package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/cjs/drivers/postgres/types.d.ts +0 -142
- 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 -1992
- 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 -161
- 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 -1650
- 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 -201
- 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 -300
- package/cjs/utils/connect-to-database.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.js +0 -128
- 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 -181
- package/cjs/writer/database-writer.d.ts.map +0 -1
- package/cjs/writer/database-writer.js +0 -407
- 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 -324
- package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.js +0 -799
- 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 -965
- 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 -864
- 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 -197
- package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/esm/drivers/postgres/types.d.ts +0 -142
- 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 -1992
- 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 -161
- 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 -1650
- 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 -201
- 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 -300
- package/esm/utils/connect-to-database.d.ts.map +0 -1
- package/esm/utils/connect-to-database.js +0 -128
- 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 -181
- package/esm/writer/database-writer.d.ts.map +0 -1
- package/esm/writer/database-writer.js +0 -407
- package/esm/writer/database-writer.js.map +0 -1
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import {DataSource}from'../data-source/data-source.js';import {dataSourceRegistry}from'../data-source/data-source-registry.js';import {MongoDbDriver}from'../drivers/mongodb/mongodb-driver.js';import {PostgresDriver}from'../drivers/postgres/postgres-driver.js';import'../context/database-transaction-context.js';/**
|
|
2
|
-
* Connect to a database and register the data source.
|
|
3
|
-
*
|
|
4
|
-
* This is a high-level utility function that simplifies database connection
|
|
5
|
-
* for small to medium projects. It handles driver instantiation, connection,
|
|
6
|
-
* data source creation, and automatic registration.
|
|
7
|
-
*
|
|
8
|
-
* **Supported Drivers:**
|
|
9
|
-
* - `mongodb` (default) - MongoDB driver with optional auto ID generation
|
|
10
|
-
* - `postgres` - PostgreSQL driver (not yet implemented)
|
|
11
|
-
* - `mysql` - MySQL driver (not yet implemented)
|
|
12
|
-
*
|
|
13
|
-
* **Features:**
|
|
14
|
-
* - Automatic driver instantiation based on driver name
|
|
15
|
-
* - Connection establishment and error handling
|
|
16
|
-
* - DataSource creation and registration
|
|
17
|
-
* - Support for MongoDB-specific features (ID generation, transactions)
|
|
18
|
-
*
|
|
19
|
-
* @param options - Connection configuration options
|
|
20
|
-
* @returns A connected and registered DataSource instance
|
|
21
|
-
* @throws {Error} If connection fails or driver is not implemented
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* // MongoDB with new structure
|
|
26
|
-
* const dataSource = await connectToDatabase({
|
|
27
|
-
* driver: "mongodb",
|
|
28
|
-
* database: "myapp",
|
|
29
|
-
* host: "localhost",
|
|
30
|
-
* port: 27017,
|
|
31
|
-
* driverOptions: {
|
|
32
|
-
* autoGenerateId: true,
|
|
33
|
-
* },
|
|
34
|
-
* clientOptions: {
|
|
35
|
-
* minPoolSize: 5,
|
|
36
|
-
* maxPoolSize: 10,
|
|
37
|
-
* },
|
|
38
|
-
* modelOptions: {
|
|
39
|
-
* randomIncrement: true,
|
|
40
|
-
* initialId: 1000,
|
|
41
|
-
* },
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
async function connectToDatabase(options) {
|
|
46
|
-
// Default values
|
|
47
|
-
const driverType = options.driver ?? "mongodb";
|
|
48
|
-
const dataSourceName = options.name ?? "default";
|
|
49
|
-
const isDefault = options.isDefault ?? true;
|
|
50
|
-
// Create driver based on type
|
|
51
|
-
let driver;
|
|
52
|
-
switch (driverType) {
|
|
53
|
-
case "mongodb": {
|
|
54
|
-
driver = new MongoDbDriver({
|
|
55
|
-
database: options.database,
|
|
56
|
-
uri: options.uri,
|
|
57
|
-
host: options.host,
|
|
58
|
-
port: options.port,
|
|
59
|
-
username: options.username,
|
|
60
|
-
password: options.password,
|
|
61
|
-
authSource: options.authSource,
|
|
62
|
-
clientOptions: options.clientOptions,
|
|
63
|
-
}, options.driverOptions);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
case "postgres": {
|
|
67
|
-
driver = new PostgresDriver({
|
|
68
|
-
database: options.database,
|
|
69
|
-
connectionString: options.uri,
|
|
70
|
-
host: options.host,
|
|
71
|
-
port: options.port ?? 5432,
|
|
72
|
-
user: options.username,
|
|
73
|
-
password: options.password,
|
|
74
|
-
// Spread any additional client options (pool settings, SSL, etc.)
|
|
75
|
-
...options.clientOptions,
|
|
76
|
-
});
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
case "mysql":
|
|
80
|
-
throw new Error("MySQL driver is not yet implemented. Coming soon!");
|
|
81
|
-
default:
|
|
82
|
-
throw new Error(`Unknown driver: "${driverType}". Supported drivers: mongodb, postgres, mysql`);
|
|
83
|
-
}
|
|
84
|
-
// Create data source
|
|
85
|
-
const dataSource = new DataSource({
|
|
86
|
-
name: dataSourceName,
|
|
87
|
-
driver,
|
|
88
|
-
isDefault,
|
|
89
|
-
defaultDeleteStrategy: options.defaultDeleteStrategy,
|
|
90
|
-
defaultTrashTable: options.defaultTrashTable,
|
|
91
|
-
modelDefaults: options.modelOptions,
|
|
92
|
-
migrationDefaults: options.migrationOptions,
|
|
93
|
-
migrations: options.migrations,
|
|
94
|
-
});
|
|
95
|
-
// Register data source
|
|
96
|
-
dataSourceRegistry.register(dataSource);
|
|
97
|
-
// Connect to the database
|
|
98
|
-
try {
|
|
99
|
-
await driver.connect();
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
console.log(error);
|
|
103
|
-
throw new Error(`Failed to connect to ${driverType} database: ${error instanceof Error ? error.message : String(error)}`);
|
|
104
|
-
}
|
|
105
|
-
return dataSource;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Get current driver instance.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```typescript
|
|
112
|
-
* const driver = getDatabaseDriver();
|
|
113
|
-
*
|
|
114
|
-
* // Pass type to return Postgres driver type
|
|
115
|
-
* const pgDriver = getDatabaseDriver<PostgresDriver>();
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
function getDatabaseDriver() {
|
|
119
|
-
const driver = dataSourceRegistry.get().driver;
|
|
120
|
-
return driver;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Perform database transaction(s)
|
|
124
|
-
* Shorthand to `dataSourceRegister.get().driver.transaction
|
|
125
|
-
*/
|
|
126
|
-
async function transaction(fn, options) {
|
|
127
|
-
return getDatabaseDriver().transaction(fn, options);
|
|
128
|
-
}export{connectToDatabase,getDatabaseDriver,transaction};//# sourceMappingURL=connect-to-database.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect-to-database.js","sources":["../../src/utils/connect-to-database.ts"],"sourcesContent":[null],"names":[],"mappings":"uTAiSA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CG;AACI,eAAe,iBAAiB,CACrC,OAA0D,EAAA;;AAG1D,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,SAAS,CAAC;AAC/C,IAAA,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC;AACjD,IAAA,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;;AAG5C,IAAA,IAAI,MAAsB,CAAC;AAE3B,IAAA,QAAQ,UAAU;QAChB,KAAK,SAAS,EAAE;YACd,MAAM,GAAG,IAAI,aAAa,CACxB;gBACE,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,aAAa,EAAE,OAAO,CAAC,aAAoB;AAC5C,aAAA,EACD,OAAO,CAAC,aAAoB,CAC7B,CAAC;YACF,MAAM;AACP,SAAA;QAED,KAAK,UAAU,EAAE;YACf,MAAM,GAAG,IAAI,cAAc,CAAC;gBAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,gBAAgB,EAAE,OAAO,CAAC,GAAG;gBAC7B,IAAI,EAAE,OAAO,CAAC,IAAI;AAClB,gBAAA,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;gBAC1B,IAAI,EAAE,OAAO,CAAC,QAAQ;gBACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;;gBAE1B,GAAI,OAAO,CAAC,aAAwB;AACrC,aAAA,CAAC,CAAC;YACH,MAAM;AACP,SAAA;AAED,QAAA,KAAK,OAAO;AACV,YAAA,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AAEvE,QAAA;AACE,YAAA,MAAM,IAAI,KAAK,CACb,oBAAoB,UAAU,CAAA,8CAAA,CAAgD,CAC/E,CAAC;AACL,KAAA;;AAGD,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC;AAChC,QAAA,IAAI,EAAE,cAAc;QACpB,MAAM;QACN,SAAS;QACT,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;QACpD,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,aAAa,EAAE,OAAO,CAAC,YAAY;QACnC,iBAAiB,EAAE,OAAO,CAAC,gBAAgB;QAC3C,UAAU,EAAE,OAAO,CAAC,UAAU;AAC/B,KAAA,CAAC,CAAC;;AAGH,IAAA,kBAAkB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;;IAGxC,IAAI;AACF,QAAA,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;AACxB,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,MAAM,IAAI,KAAK,CACb,CAAwB,qBAAA,EAAA,UAAU,cAAc,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAE,CAAA,CACzG,CAAC;AACH,KAAA;AAED,IAAA,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;;;;AAUG;SACa,iBAAiB,GAAA;IAC/B,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;AAE/C,IAAA,OAAO,MAAsB,CAAC;AAChC,CAAC;AAED;;;AAGG;AACI,eAAe,WAAW,CAC/B,EAA2C,EAC3C,OAAiC,EAAA;IAEjC,OAAO,iBAAiB,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AACtD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type Model } from "../model/model";
|
|
2
|
-
type transformCallbackOptions = {
|
|
3
|
-
model: Model;
|
|
4
|
-
column: string;
|
|
5
|
-
value: any;
|
|
6
|
-
isChanged: boolean;
|
|
7
|
-
isNew: boolean;
|
|
8
|
-
};
|
|
9
|
-
export type ModelTransformCallback = (options: transformCallbackOptions) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Transfer value before saving it into the database
|
|
12
|
-
*/
|
|
13
|
-
export declare function useModelTransformer(callback: ModelTransformCallback): TransformerCallback;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=database-writer.utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database-writer.utils.d.ts","sourceRoot":"","sources":["../../src/utils/database-writer.utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,wBAAwB,KAAK,MAAM,CAAC;AAEnF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,sBAAsB,uBAWnE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transfer value before saving it into the database
|
|
3
|
-
*/
|
|
4
|
-
function useModelTransformer(callback) {
|
|
5
|
-
const transformCallback = (data, { context }) => {
|
|
6
|
-
const model = context.rootContext?.model;
|
|
7
|
-
const column = context.key;
|
|
8
|
-
const value = data;
|
|
9
|
-
const isChanged = model.isDirty(column);
|
|
10
|
-
const isNew = model.isNew;
|
|
11
|
-
return callback({ model, column, value, isChanged, isNew });
|
|
12
|
-
};
|
|
13
|
-
return transformCallback;
|
|
14
|
-
}export{useModelTransformer};//# sourceMappingURL=database-writer.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database-writer.utils.js","sources":["../../src/utils/database-writer.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAaA;;AAEG;AACG,SAAU,mBAAmB,CAAC,QAAgC,EAAA;IAClE,MAAM,iBAAiB,GAAwB,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAI;AACnE,QAAA,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,KAAc,CAAC;AAClD,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC;QACnB,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACxC,QAAA,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;AAC1B,QAAA,OAAO,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9D,KAAC,CAAC;AAEF,IAAA,OAAO,iBAAiB,CAAC;AAC3B"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {Model}from'../model/model.js';import {registerModelInRegistry}from'../model/register-model.js';/**
|
|
2
|
-
* Define a model with a clean, concise API.
|
|
3
|
-
*
|
|
4
|
-
* This utility function creates a Model class with the specified configuration,
|
|
5
|
-
* reducing boilerplate and providing a more declarative way to define models.
|
|
6
|
-
*
|
|
7
|
-
* @param options - Model configuration options
|
|
8
|
-
* @returns A Model class with the specified configuration
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import { defineModel } from "@warlock.js/cascade";
|
|
13
|
-
* import { v } from "@warlock.js/seal";
|
|
14
|
-
*
|
|
15
|
-
* export const User = defineModel({
|
|
16
|
-
* table: "users",
|
|
17
|
-
* schema: v.object({
|
|
18
|
-
* name: v.string().required().trim(),
|
|
19
|
-
* email: v.string().email().required().lowercase(),
|
|
20
|
-
* password: v.string().required().min(6),
|
|
21
|
-
* role: v.string().default("user"),
|
|
22
|
-
* }),
|
|
23
|
-
* deleteStrategy: "soft",
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* // Usage
|
|
27
|
-
* const user = await User.create({
|
|
28
|
-
* name: "John Doe",
|
|
29
|
-
* email: "john@example.com",
|
|
30
|
-
* password: "secret123",
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* // With type inference
|
|
37
|
-
* export const Post = defineModel({
|
|
38
|
-
* table: "posts",
|
|
39
|
-
* schema: v.object({
|
|
40
|
-
* title: v.string().required(),
|
|
41
|
-
* content: v.string().required(),
|
|
42
|
-
* authorId: v.number().required(),
|
|
43
|
-
* published: v.boolean().default(false),
|
|
44
|
-
* }),
|
|
45
|
-
* });
|
|
46
|
-
*
|
|
47
|
-
* // TypeScript knows the exact type!
|
|
48
|
-
* const post = await Post.create({
|
|
49
|
-
* title: "Hello World",
|
|
50
|
-
* content: "My first post",
|
|
51
|
-
* authorId: 1,
|
|
52
|
-
* });
|
|
53
|
-
*
|
|
54
|
-
* console.log(post.title); // ✅ Type-safe!
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
function defineModel(options) {
|
|
58
|
-
class DefinedModel extends Model {
|
|
59
|
-
/**
|
|
60
|
-
* Table/collection name
|
|
61
|
-
*/
|
|
62
|
-
static table = options.table;
|
|
63
|
-
/**
|
|
64
|
-
* Validation schema
|
|
65
|
-
*/
|
|
66
|
-
static schema = options.schema;
|
|
67
|
-
/**
|
|
68
|
-
* Delete strategy
|
|
69
|
-
*/
|
|
70
|
-
static deleteStrategy = options.deleteStrategy || "trash";
|
|
71
|
-
/**
|
|
72
|
-
* Strict mode
|
|
73
|
-
*/
|
|
74
|
-
static strictMode = options.strictMode || "strip";
|
|
75
|
-
/**
|
|
76
|
-
* Auto-generate ID
|
|
77
|
-
*/
|
|
78
|
-
static autoGenerateId = options.autoGenerateId || false;
|
|
79
|
-
/**
|
|
80
|
-
* Random increment
|
|
81
|
-
*/
|
|
82
|
-
static randomIncrement = options.randomIncrement || false;
|
|
83
|
-
/**
|
|
84
|
-
* Initial ID
|
|
85
|
-
*/
|
|
86
|
-
static initialId = options.initialId || 1;
|
|
87
|
-
}
|
|
88
|
-
// Apply custom instance properties (getters/setters/methods)
|
|
89
|
-
if (options.properties) {
|
|
90
|
-
Object.defineProperties(DefinedModel.prototype, Object.getOwnPropertyDescriptors(options.properties));
|
|
91
|
-
}
|
|
92
|
-
if (options.name) {
|
|
93
|
-
registerModelInRegistry(options.name, DefinedModel);
|
|
94
|
-
}
|
|
95
|
-
// Apply custom static methods
|
|
96
|
-
if (options.statics) {
|
|
97
|
-
Object.defineProperties(DefinedModel, Object.getOwnPropertyDescriptors(options.statics));
|
|
98
|
-
}
|
|
99
|
-
return DefinedModel;
|
|
100
|
-
}export{defineModel};//# sourceMappingURL=define-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-model.js","sources":["../../src/utils/define-model.ts"],"sourcesContent":[null],"names":[],"mappings":"uGAuGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDG;AACG,SAAU,WAAW,CAMzB,OAIC,EAAA;IAID,MAAM,YAAa,SAAQ,KAAqB,CAAA;AAC9C;;AAEG;AACI,QAAA,OAAO,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;AAEpC;;AAEG;AACI,QAAA,OAAO,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;AAEtC;;AAEG;QACI,OAAO,cAAc,GAAmB,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC;AAEjF;;AAEG;QACI,OAAO,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC;AAEzD;;AAEG;QACI,OAAO,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,KAAK,CAAC;AAE/D;;AAEG;QACI,OAAO,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,KAAK,CAAC;AAEjE;;AAEG;QACI,OAAO,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC;;;IAInD,IAAI,OAAO,CAAC,UAAU,EAAE;AACtB,QAAA,MAAM,CAAC,gBAAgB,CACrB,YAAY,CAAC,SAAS,EACtB,MAAM,CAAC,yBAAyB,CAAC,OAAO,CAAC,UAAU,CAAC,CACrD,CAAC;AACH,KAAA;IAED,IAAI,OAAO,CAAC,IAAI,EAAE;AAChB,QAAA,uBAAuB,CAAC,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACrD,KAAA;;IAGD,IAAI,OAAO,CAAC,OAAO,EAAE;AACnB,QAAA,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC,yBAAyB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1F,KAAA;AAQD,IAAA,OAAO,YAAqC,CAAC;AAC/C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-valid-date-value.d.ts","sourceRoot":"","sources":["../../src/utils/is-valid-date-value.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAsBxD"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const isoRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/;
|
|
2
|
-
/**
|
|
3
|
-
* Check if the given value is a valid date value
|
|
4
|
-
*/
|
|
5
|
-
function isValidDateValue(value) {
|
|
6
|
-
// ✅ Handle timestamps
|
|
7
|
-
if (typeof value === "number") {
|
|
8
|
-
if (!Number.isFinite(value))
|
|
9
|
-
return false;
|
|
10
|
-
const date = new Date(value);
|
|
11
|
-
return !Number.isNaN(date.getTime());
|
|
12
|
-
}
|
|
13
|
-
// ❌ Only allow strict ISO strings
|
|
14
|
-
if (typeof value !== "string")
|
|
15
|
-
return false;
|
|
16
|
-
if (!isoRegex.test(value))
|
|
17
|
-
return false;
|
|
18
|
-
const date = new Date(value);
|
|
19
|
-
if (Number.isNaN(date.getTime()))
|
|
20
|
-
return false;
|
|
21
|
-
// 🔥 Critical step: prevent JS auto-correction
|
|
22
|
-
// Example: "2023-02-31" → March 3 (WRONG but "valid")
|
|
23
|
-
const [y, m, d] = value.split("T")[0].split("-").map(Number);
|
|
24
|
-
return date.getUTCFullYear() === y && date.getUTCMonth() + 1 === m && date.getUTCDate() === d;
|
|
25
|
-
}export{isValidDateValue};//# sourceMappingURL=is-valid-date-value.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-valid-date-value.js","sources":["../../src/utils/is-valid-date-value.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,sDAAsD,CAAC;AAExE;;AAEG;AACG,SAAU,gBAAgB,CAAC,KAAc,EAAA;;AAE7C,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,YAAA,OAAO,KAAK,CAAC;AAE1C,QAAA,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AACtC,KAAA;;IAGD,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK,CAAC;AAE5C,IAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC;AAExC,IAAA,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC;;;IAI/C,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE7D,OAAO,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAChG"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { DataSource } from "../data-source/data-source";
|
|
2
|
-
/**
|
|
3
|
-
* Execute a callback once the driver is connected.
|
|
4
|
-
*
|
|
5
|
-
* If the driver is already connected, the callback is executed immediately.
|
|
6
|
-
* Otherwise, it waits for the "connected" event.
|
|
7
|
-
*
|
|
8
|
-
* **Use Case:**
|
|
9
|
-
* Useful for ensuring database-dependent operations only run after connection
|
|
10
|
-
* is established, especially in small to medium projects with a single data source.
|
|
11
|
-
*
|
|
12
|
-
* @param dataSourceOrNameOrCallback - Data source instance, name, or callback function
|
|
13
|
-
* @param callback - Function to execute once connected (optional if first param is callback)
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* // With default data source (just callback)
|
|
18
|
-
* await connectToDatabase({ database: "myapp" });
|
|
19
|
-
*
|
|
20
|
-
* onceConnected((ds) => {
|
|
21
|
-
* console.log("Database is ready!");
|
|
22
|
-
* console.log("Connected to:", ds.name);
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* // With data source name
|
|
29
|
-
* onceConnected("primary", (ds) => {
|
|
30
|
-
* console.log("Primary database is ready!");
|
|
31
|
-
* });
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* // With data source instance
|
|
37
|
-
* const dataSource = await connectToDatabase({ database: "myapp" });
|
|
38
|
-
*
|
|
39
|
-
* onceConnected(dataSource, (ds) => {
|
|
40
|
-
* console.log("Database is ready!");
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* // With driver instance
|
|
47
|
-
* const driver = new MongoDbDriver(config);
|
|
48
|
-
* const dataSource = new DataSource({ name: "primary", driver });
|
|
49
|
-
*
|
|
50
|
-
* onceConnected(dataSource, () => {
|
|
51
|
-
* // Start application server
|
|
52
|
-
* app.listen(3000);
|
|
53
|
-
* });
|
|
54
|
-
*
|
|
55
|
-
* // Connect after setting up the callback
|
|
56
|
-
* await driver.connect();
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* // Chaining operations
|
|
62
|
-
* onceConnected(async (ds) => {
|
|
63
|
-
* // Seed database
|
|
64
|
-
* await seedDatabase();
|
|
65
|
-
*
|
|
66
|
-
* // Run migrations
|
|
67
|
-
* await runMigrations();
|
|
68
|
-
*
|
|
69
|
-
* console.log("Database ready!");
|
|
70
|
-
* });
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare function onceConnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
74
|
-
/**
|
|
75
|
-
* Execute a callback once the driver is disconnected.
|
|
76
|
-
*
|
|
77
|
-
* If the driver is already disconnected, the callback is executed immediately.
|
|
78
|
-
* Otherwise, it waits for the "disconnected" event.
|
|
79
|
-
*
|
|
80
|
-
* **Use Case:**
|
|
81
|
-
* Useful for cleanup operations, graceful shutdown, or reconnection logic.
|
|
82
|
-
*
|
|
83
|
-
* @param dataSourceOrNameOrCallback - Data source instance, name, or callback function
|
|
84
|
-
* @param callback - Function to execute once disconnected (optional if first param is callback)
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* // With default data source (just callback)
|
|
89
|
-
* await connectToDatabase({ database: "myapp" });
|
|
90
|
-
*
|
|
91
|
-
* onceDisconnected((ds) => {
|
|
92
|
-
* console.log("Database disconnected!");
|
|
93
|
-
* console.log("Attempting reconnection...");
|
|
94
|
-
* });
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* // With data source name
|
|
100
|
-
* onceDisconnected("primary", (ds) => {
|
|
101
|
-
* console.log("Primary database disconnected!");
|
|
102
|
-
* });
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```typescript
|
|
107
|
-
* // With data source instance
|
|
108
|
-
* const dataSource = await connectToDatabase({ database: "myapp" });
|
|
109
|
-
*
|
|
110
|
-
* onceDisconnected(dataSource, (ds) => {
|
|
111
|
-
* console.log("Database disconnected!");
|
|
112
|
-
* });
|
|
113
|
-
* ```
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* // Graceful shutdown with default data source
|
|
118
|
-
* process.on("SIGTERM", async () => {
|
|
119
|
-
* console.log("Shutting down...");
|
|
120
|
-
*
|
|
121
|
-
* onceDisconnected(() => {
|
|
122
|
-
* console.log("Database closed, exiting process");
|
|
123
|
-
* process.exit(0);
|
|
124
|
-
* });
|
|
125
|
-
*
|
|
126
|
-
* const dataSource = DataSourceRegistry.getDefault();
|
|
127
|
-
* await dataSource?.driver.disconnect();
|
|
128
|
-
* });
|
|
129
|
-
* ```
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* // Cleanup resources on disconnect
|
|
134
|
-
* onceDisconnected(async (ds) => {
|
|
135
|
-
* // Close file handles
|
|
136
|
-
* await closeFileHandles();
|
|
137
|
-
*
|
|
138
|
-
* // Clear caches
|
|
139
|
-
* clearCaches();
|
|
140
|
-
*
|
|
141
|
-
* console.log("Cleanup complete");
|
|
142
|
-
* });
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
export declare function onceDisconnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
146
|
-
//# sourceMappingURL=once-connected.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"once-connected.d.ts","sourceRoot":"","sources":["../../src/utils/once-connected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,wBAAgB,aAAa,CAC3B,0BAA0B,EAAE,UAAU,GAAG,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC,EACpF,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAC1C,IAAI,CAyDN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,wBAAgB,gBAAgB,CAC9B,0BAA0B,EAAE,UAAU,GAAG,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC,EACpF,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAC1C,IAAI,CAyDN"}
|