@warlock.js/cascade 4.0.171 → 4.1.1
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,185 @@
|
|
|
1
|
+
import { DeleteStrategy, StrictMode } from "../types.mjs";
|
|
2
|
+
import { ModelSchema } from "../model/model.types.mjs";
|
|
3
|
+
import { Model } from "../model/model.mjs";
|
|
4
|
+
import { Infer, ObjectValidator } from "@warlock.js/seal";
|
|
5
|
+
|
|
6
|
+
//#region ../../@warlock.js/cascade/src/utils/define-model.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for defining a model.
|
|
9
|
+
*/
|
|
10
|
+
type DefineModelOptions<TSchema extends ModelSchema> = {
|
|
11
|
+
/**
|
|
12
|
+
* The database table/collection name.
|
|
13
|
+
*/
|
|
14
|
+
table: string;
|
|
15
|
+
/**
|
|
16
|
+
* Model name
|
|
17
|
+
* If provided, it will be registered in the models registery
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The validation schema for the model.
|
|
22
|
+
* Use `v.object()` from @warlock.js/seal to define the schema.
|
|
23
|
+
*/
|
|
24
|
+
schema: ObjectValidator;
|
|
25
|
+
/**
|
|
26
|
+
* Delete strategy for this model. Controls how `destroy()` handles records.
|
|
27
|
+
*
|
|
28
|
+
* - `"trash"` — Moves the record to a trash table/collection, then deletes from the source.
|
|
29
|
+
* - `"permanent"` — Hard delete. The record is removed from the database.
|
|
30
|
+
* - `"soft"` — Sets a `deletedAt` timestamp; the row stays in place.
|
|
31
|
+
*
|
|
32
|
+
* When omitted, the runtime resolves the strategy in this priority order:
|
|
33
|
+
* `destroy()` call options → this model's static → data source `defaultDeleteStrategy` → `"permanent"`.
|
|
34
|
+
*/
|
|
35
|
+
deleteStrategy?: DeleteStrategy;
|
|
36
|
+
/**
|
|
37
|
+
* Behavior when the model is asked to write a field that is not declared in `schema`.
|
|
38
|
+
*
|
|
39
|
+
* - `"strip"` — Drop unknown fields silently (default).
|
|
40
|
+
* - `"fail"` — Throw a validation error on unknown fields.
|
|
41
|
+
* - `"allow"` — Pass unknown fields through to the database as-is.
|
|
42
|
+
*/
|
|
43
|
+
strictMode?: StrictMode;
|
|
44
|
+
/**
|
|
45
|
+
* Auto-generate a sequential `id` field on insert (NoSQL only).
|
|
46
|
+
*
|
|
47
|
+
* SQL drivers use native AUTO_INCREMENT and ignore this. When omitted, the
|
|
48
|
+
* MongoDB driver defaults to `true`; the PostgreSQL driver defaults to `false`.
|
|
49
|
+
*/
|
|
50
|
+
autoGenerateId?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Use a random increment (1–10) instead of a fixed step when auto-generating IDs.
|
|
53
|
+
*
|
|
54
|
+
* When omitted, falls through to the driver/data-source default.
|
|
55
|
+
*/
|
|
56
|
+
randomIncrement?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Initial ID value for the first record when auto-generating IDs.
|
|
59
|
+
*
|
|
60
|
+
* When omitted, falls through to the driver/data-source default (typically `1`).
|
|
61
|
+
*/
|
|
62
|
+
initialId?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Optional: Custom instance properties (getters/setters/methods).
|
|
65
|
+
* Define computed properties, custom getters, or instance methods.
|
|
66
|
+
*
|
|
67
|
+
* The `this` context will be the Model instance, giving you access to
|
|
68
|
+
* all Model methods like `get()`, `set()`, `save()`, etc.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* properties: {
|
|
73
|
+
* get fullName(this: Model<UserSchema>) {
|
|
74
|
+
* return `${this.get("firstName")} ${this.get("lastName")}`;
|
|
75
|
+
* },
|
|
76
|
+
* get isActive(this: Model<UserSchema>) {
|
|
77
|
+
* return this.get("status") === "active";
|
|
78
|
+
* },
|
|
79
|
+
* async sendEmail(this: Model<UserSchema>, subject: string) {
|
|
80
|
+
* // this.get(), this.save(), etc. all work!
|
|
81
|
+
* },
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
properties?: ThisType<Model<TSchema>> & Record<string, any>;
|
|
86
|
+
/**
|
|
87
|
+
* Optional: Custom static methods.
|
|
88
|
+
* Define class-level methods like custom finders or utilities.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* statics: {
|
|
93
|
+
* async findByEmail(email: string) {
|
|
94
|
+
* return this.first({ email });
|
|
95
|
+
* },
|
|
96
|
+
* async findActive() {
|
|
97
|
+
* return this.query().where("status", "active").get();
|
|
98
|
+
* },
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
statics?: Record<string, any>;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Define a model with a clean, concise API.
|
|
106
|
+
*
|
|
107
|
+
* This utility function creates a Model class with the specified configuration,
|
|
108
|
+
* reducing boilerplate and providing a more declarative way to define models.
|
|
109
|
+
*
|
|
110
|
+
* @param options - Model configuration options
|
|
111
|
+
* @returns A Model class with the specified configuration
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```typescript
|
|
115
|
+
* import { defineModel } from "@warlock.js/cascade";
|
|
116
|
+
* import { v } from "@warlock.js/seal";
|
|
117
|
+
*
|
|
118
|
+
* export const User = defineModel({
|
|
119
|
+
* table: "users",
|
|
120
|
+
* schema: v.object({
|
|
121
|
+
* name: v.string().required().trim(),
|
|
122
|
+
* email: v.string().email().required().lowercase(),
|
|
123
|
+
* password: v.string().required().min(6),
|
|
124
|
+
* role: v.string().default("user"),
|
|
125
|
+
* }),
|
|
126
|
+
* deleteStrategy: "soft",
|
|
127
|
+
* });
|
|
128
|
+
*
|
|
129
|
+
* // Usage
|
|
130
|
+
* const user = await User.create({
|
|
131
|
+
* name: "John Doe",
|
|
132
|
+
* email: "john@example.com",
|
|
133
|
+
* password: "secret123",
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* // With type inference
|
|
140
|
+
* export const Post = defineModel({
|
|
141
|
+
* table: "posts",
|
|
142
|
+
* schema: v.object({
|
|
143
|
+
* title: v.string().required(),
|
|
144
|
+
* content: v.string().required(),
|
|
145
|
+
* authorId: v.number().required(),
|
|
146
|
+
* published: v.boolean().default(false),
|
|
147
|
+
* }),
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* // TypeScript knows the exact type!
|
|
151
|
+
* const post = await Post.create({
|
|
152
|
+
* title: "Hello World",
|
|
153
|
+
* content: "My first post",
|
|
154
|
+
* authorId: 1,
|
|
155
|
+
* });
|
|
156
|
+
*
|
|
157
|
+
* console.log(post.title); // ✅ Type-safe!
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
declare function defineModel<TSchema extends ModelSchema, TSchemaValidator extends ObjectValidator = ObjectValidator, TProperties extends Record<string, any> = {}, TStatics extends Record<string, any> = {}>(options: DefineModelOptions<TSchema> & {
|
|
161
|
+
schema: TSchemaValidator;
|
|
162
|
+
properties?: ThisType<Model<Infer.Output<TSchemaValidator>>> & TProperties;
|
|
163
|
+
statics?: ThisType<typeof Model<Infer.Output<TSchemaValidator>>> & TStatics;
|
|
164
|
+
}): (new (initialData?: Partial<Infer.Output<TSchemaValidator>>) => Model<Infer.Output<TSchemaValidator>> & TProperties) & Omit<typeof Model, "new"> & TStatics;
|
|
165
|
+
/**
|
|
166
|
+
* Type helper to infer the schema type from a defined model.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* const User = defineModel({
|
|
171
|
+
* table: "users",
|
|
172
|
+
* schema: v.object({
|
|
173
|
+
* name: v.string(),
|
|
174
|
+
* email: v.string(),
|
|
175
|
+
* }),
|
|
176
|
+
* });
|
|
177
|
+
*
|
|
178
|
+
* type UserType = ModelType<typeof User>;
|
|
179
|
+
* // { name: string; email: string; }
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
type ModelType<T extends ReturnType<typeof defineModel>> = T extends (new (...args: any[]) => infer R) ? R extends Model<infer S> ? S : never : never;
|
|
183
|
+
//#endregion
|
|
184
|
+
export { DefineModelOptions, ModelType, defineModel };
|
|
185
|
+
//# sourceMappingURL=define-model.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-model.d.mts","names":[],"sources":["../../../../../../@warlock.js/cascade/src/utils/define-model.ts"],"mappings":";;;;;;;;AASA;KAAY,kBAAA,iBAAmC,WAAA;EAAjB;;;EAI5B,KAAA;EAiCa;;;;EA3Bb,IAAA;EA2FU;;;;EArFV,MAAA,EAAQ,eAAA;EAZR;;;;;;;;;;EAwBA,cAAA,GAAiB,cAAA;EAuDjB;;;;;;;EA9CA,UAAA,GAAa,UAAA;EAgEG;AA2DlB;;;;;EAnHE,cAAA;EAsHoB;;;;;EA/GpB,eAAA;EAoH8B;;;;;EA7G9B,SAAA;EA8G4B;;;;;;;;;;;;;;;;;;;;;;EAtF5B,UAAA,GAAa,QAAA,CAAS,KAAA,CAAM,OAAA,KAAY,MAAA;EAiFvB;;;;;;;;;;;;;;;;EA/DjB,OAAA,GAAU,MAAA;AAAA;;;;;;;;;;;;;;;;;AAgJwE;AAwBpF;;;;;;;;;;;;;;;;;;;;AAIO;;;;;;;;;;;;;;;;;;;iBAjHS,WAAA,iBACE,WAAA,2BACS,eAAA,GAAkB,eAAA,sBACvB,MAAA,qCACH,MAAA,mBAAA,CAEjB,OAAA,EAAS,kBAAA,CAAmB,OAAA;EAC1B,MAAA,EAAQ,gBAAA;EACR,UAAA,GAAa,QAAA,CAAS,KAAA,CAAM,KAAA,CAAM,MAAA,CAAO,gBAAA,MAAsB,WAAA;EAC/D,OAAA,GAAU,QAAA,QAAgB,KAAA,CAAM,KAAA,CAAM,MAAA,CAAO,gBAAA,MAAsB,QAAA;AAAA,UACpE,WAAA,GA2EoB,OAAA,CAAO,KAAA,CAAA,MAAA,CAAA,gBAAA,OAAmB,KAAA,CAAK,KAAA,CAAA,MAAA,CAAA,gBAAA,KAAmB,WAAA,IAAW,IAAA,QAAA,KAAA,WAAA,QAAA;;;;;;;;;;;;;;;;;;KAwBxE,SAAA,WAAoB,UAAA,QAAkB,WAAA,KAAgB,CAAA,kBAC7D,IAAA,uBAED,CAAA,SAAU,KAAA,YACR,CAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { registerModelInRegistry } from "../model/register-model.mjs";
|
|
2
|
+
import { Model } from "../model/model.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/cascade/src/utils/define-model.ts
|
|
5
|
+
/**
|
|
6
|
+
* Define a model with a clean, concise API.
|
|
7
|
+
*
|
|
8
|
+
* This utility function creates a Model class with the specified configuration,
|
|
9
|
+
* reducing boilerplate and providing a more declarative way to define models.
|
|
10
|
+
*
|
|
11
|
+
* @param options - Model configuration options
|
|
12
|
+
* @returns A Model class with the specified configuration
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { defineModel } from "@warlock.js/cascade";
|
|
17
|
+
* import { v } from "@warlock.js/seal";
|
|
18
|
+
*
|
|
19
|
+
* export const User = defineModel({
|
|
20
|
+
* table: "users",
|
|
21
|
+
* schema: v.object({
|
|
22
|
+
* name: v.string().required().trim(),
|
|
23
|
+
* email: v.string().email().required().lowercase(),
|
|
24
|
+
* password: v.string().required().min(6),
|
|
25
|
+
* role: v.string().default("user"),
|
|
26
|
+
* }),
|
|
27
|
+
* deleteStrategy: "soft",
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Usage
|
|
31
|
+
* const user = await User.create({
|
|
32
|
+
* name: "John Doe",
|
|
33
|
+
* email: "john@example.com",
|
|
34
|
+
* password: "secret123",
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // With type inference
|
|
41
|
+
* export const Post = defineModel({
|
|
42
|
+
* table: "posts",
|
|
43
|
+
* schema: v.object({
|
|
44
|
+
* title: v.string().required(),
|
|
45
|
+
* content: v.string().required(),
|
|
46
|
+
* authorId: v.number().required(),
|
|
47
|
+
* published: v.boolean().default(false),
|
|
48
|
+
* }),
|
|
49
|
+
* });
|
|
50
|
+
*
|
|
51
|
+
* // TypeScript knows the exact type!
|
|
52
|
+
* const post = await Post.create({
|
|
53
|
+
* title: "Hello World",
|
|
54
|
+
* content: "My first post",
|
|
55
|
+
* authorId: 1,
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* console.log(post.title); // ✅ Type-safe!
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
function defineModel(options) {
|
|
62
|
+
class DefinedModel extends Model {
|
|
63
|
+
/**
|
|
64
|
+
* Table/collection name
|
|
65
|
+
*/
|
|
66
|
+
static table = options.table;
|
|
67
|
+
/**
|
|
68
|
+
* Validation schema
|
|
69
|
+
*/
|
|
70
|
+
static schema = options.schema;
|
|
71
|
+
/**
|
|
72
|
+
* Delete strategy. When undefined, the runtime resolves via call options →
|
|
73
|
+
* data source `defaultDeleteStrategy` → `"permanent"`.
|
|
74
|
+
*/
|
|
75
|
+
static deleteStrategy = options.deleteStrategy;
|
|
76
|
+
/**
|
|
77
|
+
* Strict mode for unknown fields. Defaults to `"strip"` to match the base
|
|
78
|
+
* `Model` static default.
|
|
79
|
+
*/
|
|
80
|
+
static strictMode = options.strictMode || "strip";
|
|
81
|
+
/**
|
|
82
|
+
* Auto-generate sequential IDs (NoSQL only). Defaults to `true` to match
|
|
83
|
+
* the base `Model` static default.
|
|
84
|
+
*/
|
|
85
|
+
static autoGenerateId = options.autoGenerateId ?? true;
|
|
86
|
+
/**
|
|
87
|
+
* Random increment for auto-generated IDs. When undefined, falls through
|
|
88
|
+
* to the data-source default.
|
|
89
|
+
*/
|
|
90
|
+
static randomIncrement = options.randomIncrement;
|
|
91
|
+
/**
|
|
92
|
+
* Initial ID value for the first record when auto-generating IDs. When
|
|
93
|
+
* undefined, falls through to the data-source default.
|
|
94
|
+
*/
|
|
95
|
+
static initialId = options.initialId;
|
|
96
|
+
}
|
|
97
|
+
if (options.properties) Object.defineProperties(DefinedModel.prototype, Object.getOwnPropertyDescriptors(options.properties));
|
|
98
|
+
if (options.name) registerModelInRegistry(options.name, DefinedModel);
|
|
99
|
+
if (options.statics) Object.defineProperties(DefinedModel, Object.getOwnPropertyDescriptors(options.statics));
|
|
100
|
+
return DefinedModel;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//#endregion
|
|
104
|
+
export { defineModel };
|
|
105
|
+
//# sourceMappingURL=define-model.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-model.mjs","names":[],"sources":["../../../../../../@warlock.js/cascade/src/utils/define-model.ts"],"sourcesContent":["import type { Infer, ObjectValidator } from \"@warlock.js/seal\";\nimport type { ModelSchema } from \"../model/model\";\nimport { Model } from \"../model/model\";\nimport { registerModelInRegistry } from \"../model/register-model\";\nimport type { DeleteStrategy, StrictMode } from \"../types\";\n\n/**\n * Configuration options for defining a model.\n */\nexport type DefineModelOptions<TSchema extends ModelSchema> = {\n /**\n * The database table/collection name.\n */\n table: string;\n\n /**\n * Model name\n * If provided, it will be registered in the models registery\n */\n name?: string;\n\n /**\n * The validation schema for the model.\n * Use `v.object()` from @warlock.js/seal to define the schema.\n */\n schema: ObjectValidator;\n\n /**\n * Delete strategy for this model. Controls how `destroy()` handles records.\n *\n * - `\"trash\"` — Moves the record to a trash table/collection, then deletes from the source.\n * - `\"permanent\"` — Hard delete. The record is removed from the database.\n * - `\"soft\"` — Sets a `deletedAt` timestamp; the row stays in place.\n *\n * When omitted, the runtime resolves the strategy in this priority order:\n * `destroy()` call options → this model's static → data source `defaultDeleteStrategy` → `\"permanent\"`.\n */\n deleteStrategy?: DeleteStrategy;\n\n /**\n * Behavior when the model is asked to write a field that is not declared in `schema`.\n *\n * - `\"strip\"` — Drop unknown fields silently (default).\n * - `\"fail\"` — Throw a validation error on unknown fields.\n * - `\"allow\"` — Pass unknown fields through to the database as-is.\n */\n strictMode?: StrictMode;\n\n /**\n * Auto-generate a sequential `id` field on insert (NoSQL only).\n *\n * SQL drivers use native AUTO_INCREMENT and ignore this. When omitted, the\n * MongoDB driver defaults to `true`; the PostgreSQL driver defaults to `false`.\n */\n autoGenerateId?: boolean;\n\n /**\n * Use a random increment (1–10) instead of a fixed step when auto-generating IDs.\n *\n * When omitted, falls through to the driver/data-source default.\n */\n randomIncrement?: boolean;\n\n /**\n * Initial ID value for the first record when auto-generating IDs.\n *\n * When omitted, falls through to the driver/data-source default (typically `1`).\n */\n initialId?: number;\n\n /**\n * Optional: Custom instance properties (getters/setters/methods).\n * Define computed properties, custom getters, or instance methods.\n *\n * The `this` context will be the Model instance, giving you access to\n * all Model methods like `get()`, `set()`, `save()`, etc.\n *\n * @example\n * ```typescript\n * properties: {\n * get fullName(this: Model<UserSchema>) {\n * return `${this.get(\"firstName\")} ${this.get(\"lastName\")}`;\n * },\n * get isActive(this: Model<UserSchema>) {\n * return this.get(\"status\") === \"active\";\n * },\n * async sendEmail(this: Model<UserSchema>, subject: string) {\n * // this.get(), this.save(), etc. all work!\n * },\n * }\n * ```\n */\n properties?: ThisType<Model<TSchema>> & Record<string, any>;\n\n /**\n * Optional: Custom static methods.\n * Define class-level methods like custom finders or utilities.\n *\n * @example\n * ```typescript\n * statics: {\n * async findByEmail(email: string) {\n * return this.first({ email });\n * },\n * async findActive() {\n * return this.query().where(\"status\", \"active\").get();\n * },\n * }\n * ```\n */\n statics?: Record<string, any>;\n};\n\n/**\n * Define a model with a clean, concise API.\n *\n * This utility function creates a Model class with the specified configuration,\n * reducing boilerplate and providing a more declarative way to define models.\n *\n * @param options - Model configuration options\n * @returns A Model class with the specified configuration\n *\n * @example\n * ```typescript\n * import { defineModel } from \"@warlock.js/cascade\";\n * import { v } from \"@warlock.js/seal\";\n *\n * export const User = defineModel({\n * table: \"users\",\n * schema: v.object({\n * name: v.string().required().trim(),\n * email: v.string().email().required().lowercase(),\n * password: v.string().required().min(6),\n * role: v.string().default(\"user\"),\n * }),\n * deleteStrategy: \"soft\",\n * });\n *\n * // Usage\n * const user = await User.create({\n * name: \"John Doe\",\n * email: \"john@example.com\",\n * password: \"secret123\",\n * });\n * ```\n *\n * @example\n * ```typescript\n * // With type inference\n * export const Post = defineModel({\n * table: \"posts\",\n * schema: v.object({\n * title: v.string().required(),\n * content: v.string().required(),\n * authorId: v.number().required(),\n * published: v.boolean().default(false),\n * }),\n * });\n *\n * // TypeScript knows the exact type!\n * const post = await Post.create({\n * title: \"Hello World\",\n * content: \"My first post\",\n * authorId: 1,\n * });\n *\n * console.log(post.title); // ✅ Type-safe!\n * ```\n */\nexport function defineModel<\n TSchema extends ModelSchema,\n TSchemaValidator extends ObjectValidator = ObjectValidator,\n TProperties extends Record<string, any> = {},\n TStatics extends Record<string, any> = {},\n>(\n options: DefineModelOptions<TSchema> & {\n schema: TSchemaValidator;\n properties?: ThisType<Model<Infer.Output<TSchemaValidator>>> & TProperties;\n statics?: ThisType<typeof Model<Infer.Output<TSchemaValidator>>> & TStatics;\n },\n) {\n type InferredSchema = Infer.Output<TSchemaValidator>;\n\n class DefinedModel extends Model<InferredSchema> {\n /**\n * Table/collection name\n */\n public static table = options.table;\n\n /**\n * Validation schema\n */\n public static schema = options.schema;\n\n /**\n * Delete strategy. When undefined, the runtime resolves via call options →\n * data source `defaultDeleteStrategy` → `\"permanent\"`.\n */\n public static deleteStrategy: DeleteStrategy | undefined = options.deleteStrategy;\n\n /**\n * Strict mode for unknown fields. Defaults to `\"strip\"` to match the base\n * `Model` static default.\n */\n public static strictMode: StrictMode = options.strictMode || \"strip\";\n\n /**\n * Auto-generate sequential IDs (NoSQL only). Defaults to `true` to match\n * the base `Model` static default.\n */\n public static autoGenerateId: boolean = options.autoGenerateId ?? true;\n\n /**\n * Random increment for auto-generated IDs. When undefined, falls through\n * to the data-source default.\n */\n public static randomIncrement: boolean | undefined = options.randomIncrement;\n\n /**\n * Initial ID value for the first record when auto-generating IDs. When\n * undefined, falls through to the data-source default.\n */\n public static initialId: number | undefined = options.initialId;\n }\n\n // Apply custom instance properties (getters/setters/methods)\n if (options.properties) {\n Object.defineProperties(\n DefinedModel.prototype,\n Object.getOwnPropertyDescriptors(options.properties),\n );\n }\n\n if (options.name) {\n registerModelInRegistry(options.name, DefinedModel);\n }\n\n // Apply custom static methods\n if (options.statics) {\n Object.defineProperties(DefinedModel, Object.getOwnPropertyDescriptors(options.statics));\n }\n\n // Return with proper type inference.\n //\n // The constructed type references the EXPORTED `Model` (instance + statics)\n // rather than the local `DefinedModel` class. `DefinedModel` is declared\n // inside this function, so emitting it into the public `.d.ts` would force the\n // declaration emitter to inline it as an anonymous class type — which fails\n // with TS4094 (\"anonymous class type may not be private or protected\", from\n // Model's `protected isActiveColumn`) and crashes the dts bundler on Model's\n // getters. `DefinedModel` adds no instance members over `Model<InferredSchema>`\n // and no statics beyond those already declared on `Model`, so this is a\n // faithful, emittable equivalent of the previously-inferred return type.\n type DefinedModelClass = {\n new (initialData?: Partial<InferredSchema>): Model<InferredSchema> & TProperties;\n } & Omit<typeof Model, \"new\"> &\n TStatics;\n\n return DefinedModel as unknown as DefinedModelClass;\n}\n\n/**\n * Type helper to infer the schema type from a defined model.\n *\n * @example\n * ```typescript\n * const User = defineModel({\n * table: \"users\",\n * schema: v.object({\n * name: v.string(),\n * email: v.string(),\n * }),\n * });\n *\n * type UserType = ModelType<typeof User>;\n * // { name: string; email: string; }\n * ```\n */\nexport type ModelType<T extends ReturnType<typeof defineModel>> = T extends new (\n ...args: any[]\n) => infer R\n ? R extends Model<infer S>\n ? S\n : never\n : never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyKA,SAAgB,YAMd,SAKA;CAGA,MAAM,qBAAqB,MAAsB;;;;EAI/C,OAAc,QAAQ,QAAQ;;;;EAK9B,OAAc,SAAS,QAAQ;;;;;EAM/B,OAAc,iBAA6C,QAAQ;;;;;EAMnE,OAAc,aAAyB,QAAQ,cAAc;;;;;EAM7D,OAAc,iBAA0B,QAAQ,kBAAkB;;;;;EAMlE,OAAc,kBAAuC,QAAQ;;;;;EAM7D,OAAc,YAAgC,QAAQ;CACxD;CAGA,IAAI,QAAQ,YACV,OAAO,iBACL,aAAa,WACb,OAAO,0BAA0B,QAAQ,UAAU,CACrD;CAGF,IAAI,QAAQ,MACV,wBAAwB,QAAQ,MAAM,YAAY;CAIpD,IAAI,QAAQ,SACV,OAAO,iBAAiB,cAAc,OAAO,0BAA0B,QAAQ,OAAO,CAAC;CAmBzF,OAAO;AACT"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region ../../@warlock.js/cascade/src/utils/is-valid-date-value.ts
|
|
2
|
+
const isoRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/;
|
|
3
|
+
/**
|
|
4
|
+
* Check if the given value is a valid date value
|
|
5
|
+
*/
|
|
6
|
+
function isValidDateValue(value) {
|
|
7
|
+
if (typeof value === "number") {
|
|
8
|
+
if (!Number.isFinite(value)) return false;
|
|
9
|
+
const date = new Date(value);
|
|
10
|
+
return !Number.isNaN(date.getTime());
|
|
11
|
+
}
|
|
12
|
+
if (typeof value !== "string") return false;
|
|
13
|
+
if (!isoRegex.test(value)) return false;
|
|
14
|
+
const date = new Date(value);
|
|
15
|
+
if (Number.isNaN(date.getTime())) return false;
|
|
16
|
+
const [y, m, d] = value.split("T")[0].split("-").map(Number);
|
|
17
|
+
return date.getUTCFullYear() === y && date.getUTCMonth() + 1 === m && date.getUTCDate() === d;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export { isValidDateValue };
|
|
22
|
+
//# sourceMappingURL=is-valid-date-value.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-valid-date-value.mjs","names":[],"sources":["../../../../../../@warlock.js/cascade/src/utils/is-valid-date-value.ts"],"sourcesContent":["const isoRegex = /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z?)?$/;\n\n/**\n * Check if the given value is a valid date value\n */\nexport function isValidDateValue(value: unknown): boolean {\n // ✅ Handle timestamps\n if (typeof value === \"number\") {\n if (!Number.isFinite(value)) return false;\n\n const date = new Date(value);\n return !Number.isNaN(date.getTime());\n }\n\n // ❌ Only allow strict ISO strings\n if (typeof value !== \"string\") return false;\n\n if (!isoRegex.test(value)) return false;\n\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) return false;\n\n // 🔥 Critical step: prevent JS auto-correction\n // Example: \"2023-02-31\" → March 3 (WRONG but \"valid\")\n const [y, m, d] = value.split(\"T\")[0].split(\"-\").map(Number);\n\n return date.getUTCFullYear() === y && date.getUTCMonth() + 1 === m && date.getUTCDate() === d;\n}\n"],"mappings":";AAAA,MAAM,WAAW;;;;AAKjB,SAAgB,iBAAiB,OAAyB;CAExD,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,CAAC,OAAO,SAAS,KAAK,GAAG,OAAO;EAEpC,MAAM,OAAO,IAAI,KAAK,KAAK;EAC3B,OAAO,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC;CACrC;CAGA,IAAI,OAAO,UAAU,UAAU,OAAO;CAEtC,IAAI,CAAC,SAAS,KAAK,KAAK,GAAG,OAAO;CAElC,MAAM,OAAO,IAAI,KAAK,KAAK;CAC3B,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,GAAG,OAAO;CAIzC,MAAM,CAAC,GAAG,GAAG,KAAK,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,GAAG,EAAE,IAAI,MAAM;CAE3D,OAAO,KAAK,eAAe,MAAM,KAAK,KAAK,YAAY,IAAI,MAAM,KAAK,KAAK,WAAW,MAAM;AAC9F"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { DataSource } from "../data-source/data-source.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/cascade/src/utils/once-connected.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Execute a callback once the driver is connected.
|
|
6
|
+
*
|
|
7
|
+
* If the driver is already connected, the callback is executed immediately.
|
|
8
|
+
* Otherwise, it waits for the "connected" event.
|
|
9
|
+
*
|
|
10
|
+
* **Use Case:**
|
|
11
|
+
* Useful for ensuring database-dependent operations only run after connection
|
|
12
|
+
* is established, especially in small to medium projects with a single data source.
|
|
13
|
+
*
|
|
14
|
+
* @param dataSourceOrNameOrCallback - Data source instance, name, or callback function
|
|
15
|
+
* @param callback - Function to execute once connected (optional if first param is callback)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // With default data source (just callback)
|
|
20
|
+
* await connectToDatabase({ database: "myapp" });
|
|
21
|
+
*
|
|
22
|
+
* onceConnected((ds) => {
|
|
23
|
+
* console.log("Database is ready!");
|
|
24
|
+
* console.log("Connected to:", ds.name);
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // With data source name
|
|
31
|
+
* onceConnected("primary", (ds) => {
|
|
32
|
+
* console.log("Primary database is ready!");
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // With data source instance
|
|
39
|
+
* const dataSource = await connectToDatabase({ database: "myapp" });
|
|
40
|
+
*
|
|
41
|
+
* onceConnected(dataSource, (ds) => {
|
|
42
|
+
* console.log("Database is ready!");
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // With driver instance
|
|
49
|
+
* const driver = new MongoDbDriver(config);
|
|
50
|
+
* const dataSource = new DataSource({ name: "primary", driver });
|
|
51
|
+
*
|
|
52
|
+
* onceConnected(dataSource, () => {
|
|
53
|
+
* // Start application server
|
|
54
|
+
* app.listen(3000);
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* // Connect after setting up the callback
|
|
58
|
+
* await driver.connect();
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Chaining operations
|
|
64
|
+
* onceConnected(async (ds) => {
|
|
65
|
+
* // Seed database
|
|
66
|
+
* await seedDatabase();
|
|
67
|
+
*
|
|
68
|
+
* // Run migrations
|
|
69
|
+
* await runMigrations();
|
|
70
|
+
*
|
|
71
|
+
* console.log("Database ready!");
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare function onceConnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
76
|
+
/**
|
|
77
|
+
* Execute a callback once the driver is disconnected.
|
|
78
|
+
*
|
|
79
|
+
* If the driver is already disconnected, the callback is executed immediately.
|
|
80
|
+
* Otherwise, it waits for the "disconnected" event.
|
|
81
|
+
*
|
|
82
|
+
* **Use Case:**
|
|
83
|
+
* Useful for cleanup operations, graceful shutdown, or reconnection logic.
|
|
84
|
+
*
|
|
85
|
+
* @param dataSourceOrNameOrCallback - Data source instance, name, or callback function
|
|
86
|
+
* @param callback - Function to execute once disconnected (optional if first param is callback)
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* // With default data source (just callback)
|
|
91
|
+
* await connectToDatabase({ database: "myapp" });
|
|
92
|
+
*
|
|
93
|
+
* onceDisconnected((ds) => {
|
|
94
|
+
* console.log("Database disconnected!");
|
|
95
|
+
* console.log("Attempting reconnection...");
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* // With data source name
|
|
102
|
+
* onceDisconnected("primary", (ds) => {
|
|
103
|
+
* console.log("Primary database disconnected!");
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* // With data source instance
|
|
110
|
+
* const dataSource = await connectToDatabase({ database: "myapp" });
|
|
111
|
+
*
|
|
112
|
+
* onceDisconnected(dataSource, (ds) => {
|
|
113
|
+
* console.log("Database disconnected!");
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* // Graceful shutdown with default data source
|
|
120
|
+
* process.on("SIGTERM", async () => {
|
|
121
|
+
* console.log("Shutting down...");
|
|
122
|
+
*
|
|
123
|
+
* onceDisconnected(() => {
|
|
124
|
+
* console.log("Database closed, exiting process");
|
|
125
|
+
* process.exit(0);
|
|
126
|
+
* });
|
|
127
|
+
*
|
|
128
|
+
* const dataSource = DataSourceRegistry.getDefault();
|
|
129
|
+
* await dataSource?.driver.disconnect();
|
|
130
|
+
* });
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* // Cleanup resources on disconnect
|
|
136
|
+
* onceDisconnected(async (ds) => {
|
|
137
|
+
* // Close file handles
|
|
138
|
+
* await closeFileHandles();
|
|
139
|
+
*
|
|
140
|
+
* // Clear caches
|
|
141
|
+
* clearCaches();
|
|
142
|
+
*
|
|
143
|
+
* console.log("Cleanup complete");
|
|
144
|
+
* });
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
declare function onceDisconnected(dataSourceOrNameOrCallback: DataSource | string | ((dataSource: DataSource) => void), callback?: (dataSource: DataSource) => void): void;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { onceConnected, onceDisconnected };
|
|
150
|
+
//# sourceMappingURL=once-connected.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"once-connected.d.mts","names":[],"sources":["../../../../../../@warlock.js/cascade/src/utils/once-connected.ts"],"mappings":";;;;;AA0EA;;;;;;;;;;;;;;;;AAE6C;AAmI7C;;;;;;;;;;;;;;;;AAE6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAvI7B,aAAA,CACd,0BAAA,EAA4B,UAAA,cAAwB,UAAA,EAAY,UAAA,YAChE,QAAA,IAAY,UAAA,EAAY,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmIV,gBAAA,CACd,0BAAA,EAA4B,UAAA,cAAwB,UAAA,EAAY,UAAA,YAChE,QAAA,IAAY,UAAA,EAAY,UAAA"}
|