@warlock.js/cascade 4.0.174 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/bin/cascadejs +3 -0
- package/esm/cli/commands/migrate-export-sql.mjs +48 -0
- package/esm/cli/commands/migrate-export-sql.mjs.map +1 -0
- package/esm/cli/commands/migrate-list.mjs +26 -0
- package/esm/cli/commands/migrate-list.mjs.map +1 -0
- package/esm/cli/commands/migrate-rollback.mjs +50 -0
- package/esm/cli/commands/migrate-rollback.mjs.map +1 -0
- package/esm/cli/commands/migrate.mjs +65 -0
- package/esm/cli/commands/migrate.mjs.map +1 -0
- package/esm/cli/connection-from-env.mjs +181 -0
- package/esm/cli/connection-from-env.mjs.map +1 -0
- package/esm/cli/index.mjs +31 -0
- package/esm/cli/index.mjs.map +1 -0
- package/esm/cli/load-migrations.mjs +78 -0
- package/esm/cli/load-migrations.mjs.map +1 -0
- package/esm/cli/printers.mjs +57 -0
- package/esm/cli/printers.mjs.map +1 -0
- package/esm/cli/setup-logger.mjs +30 -0
- package/esm/cli/setup-logger.mjs.map +1 -0
- package/esm/cli/with-cli-connection.mjs +39 -0
- package/esm/cli/with-cli-connection.mjs.map +1 -0
- package/esm/cli.d.mts +1 -0
- package/esm/cli.mjs +26 -0
- package/esm/cli.mjs.map +1 -0
- package/esm/context/database-data-source-context.d.mts +32 -0
- package/esm/context/database-data-source-context.d.mts.map +1 -0
- package/esm/context/database-data-source-context.mjs +35 -0
- package/esm/context/database-data-source-context.mjs.map +1 -0
- package/esm/context/database-transaction-context.d.mts +38 -0
- package/esm/context/database-transaction-context.d.mts.map +1 -0
- package/esm/context/database-transaction-context.mjs +47 -0
- package/esm/context/database-transaction-context.mjs.map +1 -0
- package/esm/contracts/database-driver.contract.d.mts +443 -0
- package/esm/contracts/database-driver.contract.d.mts.map +1 -0
- package/esm/contracts/database-id-generator.contract.d.mts +109 -0
- package/esm/contracts/database-id-generator.contract.d.mts.map +1 -0
- package/esm/contracts/database-remover.contract.d.mts +108 -0
- package/esm/contracts/database-remover.contract.d.mts.map +1 -0
- package/esm/contracts/database-restorer.contract.d.mts +145 -0
- package/esm/contracts/database-restorer.contract.d.mts.map +1 -0
- package/esm/contracts/database-writer.contract.d.mts +123 -0
- package/esm/contracts/database-writer.contract.d.mts.map +1 -0
- package/esm/contracts/driver-blueprint.contract.d.mts +52 -0
- package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -0
- package/esm/contracts/index.d.mts +9 -0
- package/esm/contracts/migration-driver.contract.d.mts +476 -0
- package/esm/contracts/migration-driver.contract.d.mts.map +1 -0
- package/esm/contracts/query-builder.contract.d.mts +1663 -0
- package/esm/contracts/query-builder.contract.d.mts.map +1 -0
- package/esm/contracts/sync-adapter.contract.d.mts +49 -0
- package/esm/contracts/sync-adapter.contract.d.mts.map +1 -0
- package/esm/data-source/data-source-registry.d.mts +111 -0
- package/esm/data-source/data-source-registry.d.mts.map +1 -0
- package/esm/data-source/data-source-registry.mjs +142 -0
- package/esm/data-source/data-source-registry.mjs.map +1 -0
- package/esm/data-source/data-source.d.mts +160 -0
- package/esm/data-source/data-source.d.mts.map +1 -0
- package/esm/data-source/data-source.mjs +87 -0
- package/esm/data-source/data-source.mjs.map +1 -0
- package/esm/database-dirty-tracker.d.mts +254 -0
- package/esm/database-dirty-tracker.d.mts.map +1 -0
- package/esm/database-dirty-tracker.mjs +356 -0
- package/esm/database-dirty-tracker.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-blueprint.mjs +54 -0
- package/esm/drivers/mongodb/mongodb-blueprint.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-driver.d.mts +334 -0
- package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-driver.mjs +716 -0
- package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts +120 -0
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-id-generator.mjs +141 -0
- package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +322 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs +531 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts +1117 -0
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-builder.mjs +1828 -0
- package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts +230 -0
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-operations.mjs +275 -0
- package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts +263 -0
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-parser.mjs +965 -0
- package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +78 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs +118 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs.map +1 -0
- package/esm/drivers/mongodb/types.d.mts +43 -0
- package/esm/drivers/mongodb/types.d.mts.map +1 -0
- package/esm/drivers/postgres/index.d.mts +8 -0
- package/esm/drivers/postgres/index.mjs +9 -0
- package/esm/drivers/postgres/postgres-blueprint.d.mts +60 -0
- package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-blueprint.mjs +105 -0
- package/esm/drivers/postgres/postgres-blueprint.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-dialect.d.mts +144 -0
- package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-dialect.mjs +227 -0
- package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-driver.d.mts +424 -0
- package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-driver.mjs +845 -0
- package/esm/drivers/postgres/postgres-driver.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-migration-driver.d.mts +393 -0
- package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-migration-driver.mjs +760 -0
- package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-query-builder.d.mts +399 -0
- package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-query-builder.mjs +1105 -0
- package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-query-parser.d.mts +351 -0
- package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-query-parser.mjs +796 -0
- package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-sql-serializer.mjs +260 -0
- package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts +79 -0
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-sync-adapter.mjs +162 -0
- package/esm/drivers/postgres/postgres-sync-adapter.mjs.map +1 -0
- package/esm/drivers/postgres/types.d.mts +105 -0
- package/esm/drivers/postgres/types.d.mts.map +1 -0
- package/esm/drivers/sql/sql-dialect.contract.d.mts +221 -0
- package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -0
- package/esm/drivers/sql/sql-types.d.mts +150 -0
- package/esm/drivers/sql/sql-types.d.mts.map +1 -0
- package/esm/errors/missing-data-source.error.d.mts +25 -0
- package/esm/errors/missing-data-source.error.d.mts.map +1 -0
- package/esm/errors/missing-data-source.error.mjs +31 -0
- package/esm/errors/missing-data-source.error.mjs.map +1 -0
- package/esm/errors/transaction-rollback.error.d.mts +23 -0
- package/esm/errors/transaction-rollback.error.d.mts.map +1 -0
- package/esm/errors/transaction-rollback.error.mjs +29 -0
- package/esm/errors/transaction-rollback.error.mjs.map +1 -0
- package/esm/events/model-events.d.mts +234 -0
- package/esm/events/model-events.d.mts.map +1 -0
- package/esm/events/model-events.mjs +254 -0
- package/esm/events/model-events.mjs.map +1 -0
- package/esm/expressions/aggregate-expressions.d.mts +224 -0
- package/esm/expressions/aggregate-expressions.d.mts.map +1 -0
- package/esm/expressions/aggregate-expressions.mjs +232 -0
- package/esm/expressions/aggregate-expressions.mjs.map +1 -0
- package/esm/index.d.mts +67 -0
- package/esm/index.mjs +53 -0
- package/esm/migration/column-builder.d.mts +420 -0
- package/esm/migration/column-builder.d.mts.map +1 -0
- package/esm/migration/column-builder.mjs +532 -0
- package/esm/migration/column-builder.mjs.map +1 -0
- package/esm/migration/column-helpers.d.mts +280 -0
- package/esm/migration/column-helpers.d.mts.map +1 -0
- package/esm/migration/column-helpers.mjs +376 -0
- package/esm/migration/column-helpers.mjs.map +1 -0
- package/esm/migration/foreign-key-builder.d.mts +106 -0
- package/esm/migration/foreign-key-builder.d.mts.map +1 -0
- package/esm/migration/foreign-key-builder.mjs +126 -0
- package/esm/migration/foreign-key-builder.mjs.map +1 -0
- package/esm/migration/index.d.mts +6 -0
- package/esm/migration/index.mjs +7 -0
- package/esm/migration/migration-runner.d.mts +279 -0
- package/esm/migration/migration-runner.d.mts.map +1 -0
- package/esm/migration/migration-runner.mjs +662 -0
- package/esm/migration/migration-runner.mjs.map +1 -0
- package/esm/migration/migration.d.mts +2035 -0
- package/esm/migration/migration.d.mts.map +1 -0
- package/esm/migration/migration.mjs +2083 -0
- package/esm/migration/migration.mjs.map +1 -0
- package/esm/migration/sql-grammar.mjs +115 -0
- package/esm/migration/sql-grammar.mjs.map +1 -0
- package/esm/migration/sql-serializer.d.mts +26 -0
- package/esm/migration/sql-serializer.d.mts.map +1 -0
- package/esm/migration/sql-serializer.mjs +26 -0
- package/esm/migration/sql-serializer.mjs.map +1 -0
- package/esm/migration/types.d.mts +136 -0
- package/esm/migration/types.d.mts.map +1 -0
- package/esm/model/methods/accessor-methods.mjs +54 -0
- package/esm/model/methods/accessor-methods.mjs.map +1 -0
- package/esm/model/methods/delete-methods.mjs +16 -0
- package/esm/model/methods/delete-methods.mjs.map +1 -0
- package/esm/model/methods/dirty-methods.mjs +20 -0
- package/esm/model/methods/dirty-methods.mjs.map +1 -0
- package/esm/model/methods/hydration-methods.mjs +51 -0
- package/esm/model/methods/hydration-methods.mjs.map +1 -0
- package/esm/model/methods/instance-event-methods.mjs +22 -0
- package/esm/model/methods/instance-event-methods.mjs.map +1 -0
- package/esm/model/methods/meta-methods.mjs +36 -0
- package/esm/model/methods/meta-methods.mjs.map +1 -0
- package/esm/model/methods/pivot-methods.mjs +48 -0
- package/esm/model/methods/pivot-methods.mjs.map +1 -0
- package/esm/model/methods/query-methods.mjs +121 -0
- package/esm/model/methods/query-methods.mjs.map +1 -0
- package/esm/model/methods/restore-methods.mjs +16 -0
- package/esm/model/methods/restore-methods.mjs.map +1 -0
- package/esm/model/methods/scope-methods.mjs +20 -0
- package/esm/model/methods/scope-methods.mjs.map +1 -0
- package/esm/model/methods/serialization-methods.mjs +20 -0
- package/esm/model/methods/serialization-methods.mjs.map +1 -0
- package/esm/model/methods/static-event-methods.mjs +37 -0
- package/esm/model/methods/static-event-methods.mjs.map +1 -0
- package/esm/model/methods/write-methods.mjs +69 -0
- package/esm/model/methods/write-methods.mjs.map +1 -0
- package/esm/model/model.d.mts +1778 -0
- package/esm/model/model.d.mts.map +1 -0
- package/esm/model/model.mjs +1762 -0
- package/esm/model/model.mjs.map +1 -0
- package/esm/model/model.types.d.mts +47 -0
- package/esm/model/model.types.d.mts.map +1 -0
- package/esm/model/register-model.d.mts +140 -0
- package/esm/model/register-model.d.mts.map +1 -0
- package/esm/model/register-model.mjs +175 -0
- package/esm/model/register-model.mjs.map +1 -0
- package/esm/model/relation-decorators.d.mts +88 -0
- package/esm/model/relation-decorators.d.mts.map +1 -0
- package/esm/model/relation-decorators.mjs +191 -0
- package/esm/model/relation-decorators.mjs.map +1 -0
- package/esm/operations/database.d.mts +46 -0
- package/esm/operations/database.d.mts.map +1 -0
- package/esm/operations/database.mjs +40 -0
- package/esm/operations/database.mjs.map +1 -0
- package/esm/operations/index.d.mts +2 -0
- package/esm/operations/index.mjs +4 -0
- package/esm/operations/migrations.d.mts +71 -0
- package/esm/operations/migrations.d.mts.map +1 -0
- package/esm/operations/migrations.mjs +70 -0
- package/esm/operations/migrations.mjs.map +1 -0
- package/esm/query-builder/query-builder.d.mts +564 -0
- package/esm/query-builder/query-builder.d.mts.map +1 -0
- package/esm/query-builder/query-builder.mjs +1097 -0
- package/esm/query-builder/query-builder.mjs.map +1 -0
- package/esm/relations/index.d.mts +4 -0
- package/esm/relations/index.mjs +5 -0
- package/esm/relations/key-conventions.mjs +119 -0
- package/esm/relations/key-conventions.mjs.map +1 -0
- package/esm/relations/pivot-operations.d.mts +155 -0
- package/esm/relations/pivot-operations.d.mts.map +1 -0
- package/esm/relations/pivot-operations.mjs +232 -0
- package/esm/relations/pivot-operations.mjs.map +1 -0
- package/esm/relations/relation-hydrator.d.mts +55 -0
- package/esm/relations/relation-hydrator.d.mts.map +1 -0
- package/esm/relations/relation-hydrator.mjs +52 -0
- package/esm/relations/relation-hydrator.mjs.map +1 -0
- package/esm/relations/relation-loader.d.mts +190 -0
- package/esm/relations/relation-loader.d.mts.map +1 -0
- package/esm/relations/relation-loader.mjs +416 -0
- package/esm/relations/relation-loader.mjs.map +1 -0
- package/esm/relations/types.d.mts +317 -0
- package/esm/relations/types.d.mts.map +1 -0
- package/esm/remover/database-remover.d.mts +104 -0
- package/esm/remover/database-remover.d.mts.map +1 -0
- package/esm/remover/database-remover.mjs +174 -0
- package/esm/remover/database-remover.mjs.map +1 -0
- package/esm/restorer/database-restorer.d.mts +135 -0
- package/esm/restorer/database-restorer.d.mts.map +1 -0
- package/esm/restorer/database-restorer.mjs +316 -0
- package/esm/restorer/database-restorer.mjs.map +1 -0
- package/esm/sql-database-dirty-tracker.d.mts +17 -0
- package/esm/sql-database-dirty-tracker.d.mts.map +1 -0
- package/esm/sql-database-dirty-tracker.mjs +20 -0
- package/esm/sql-database-dirty-tracker.mjs.map +1 -0
- package/esm/sync/model-events.mjs +46 -0
- package/esm/sync/model-events.mjs.map +1 -0
- package/esm/sync/model-sync-operation.d.mts +159 -0
- package/esm/sync/model-sync-operation.d.mts.map +1 -0
- package/esm/sync/model-sync-operation.mjs +257 -0
- package/esm/sync/model-sync-operation.mjs.map +1 -0
- package/esm/sync/model-sync.d.mts +126 -0
- package/esm/sync/model-sync.d.mts.map +1 -0
- package/esm/sync/model-sync.mjs +157 -0
- package/esm/sync/model-sync.mjs.map +1 -0
- package/esm/sync/sync-context.d.mts +69 -0
- package/esm/sync/sync-context.d.mts.map +1 -0
- package/esm/sync/sync-context.mjs +95 -0
- package/esm/sync/sync-context.mjs.map +1 -0
- package/esm/sync/sync-manager.d.mts +213 -0
- package/esm/sync/sync-manager.d.mts.map +1 -0
- package/esm/sync/sync-manager.mjs +597 -0
- package/esm/sync/sync-manager.mjs.map +1 -0
- package/esm/sync/types.d.mts +215 -0
- package/esm/sync/types.d.mts.map +1 -0
- package/esm/types.d.mts +423 -0
- package/esm/types.d.mts.map +1 -0
- package/esm/utils/connect-to-database.d.mts +328 -0
- package/esm/utils/connect-to-database.d.mts.map +1 -0
- package/esm/utils/connect-to-database.mjs +130 -0
- package/esm/utils/connect-to-database.mjs.map +1 -0
- package/esm/utils/database-writer.utils.d.mts +18 -0
- package/esm/utils/database-writer.utils.d.mts.map +1 -0
- package/esm/utils/database-writer.utils.mjs +25 -0
- package/esm/utils/database-writer.utils.mjs.map +1 -0
- package/esm/utils/define-model.d.mts +185 -0
- package/esm/utils/define-model.d.mts.map +1 -0
- package/esm/utils/define-model.mjs +105 -0
- package/esm/utils/define-model.mjs.map +1 -0
- package/esm/utils/is-valid-date-value.mjs +22 -0
- package/esm/utils/is-valid-date-value.mjs.map +1 -0
- package/esm/utils/once-connected.d.mts +150 -0
- package/esm/utils/once-connected.d.mts.map +1 -0
- package/esm/utils/once-connected.mjs +203 -0
- package/esm/utils/once-connected.mjs.map +1 -0
- package/esm/validation/database-seal-plugins.d.mts +1 -0
- package/esm/validation/database-seal-plugins.mjs +11 -0
- package/esm/validation/database-seal-plugins.mjs.map +1 -0
- package/esm/validation/database-writer-validation-error.d.mts +101 -0
- package/esm/validation/database-writer-validation-error.d.mts.map +1 -0
- package/esm/validation/database-writer-validation-error.mjs +153 -0
- package/esm/validation/database-writer-validation-error.mjs.map +1 -0
- package/esm/validation/index.d.mts +2 -0
- package/esm/validation/index.mjs +4 -0
- package/esm/validation/mutators/embed-mutator.mjs +26 -0
- package/esm/validation/mutators/embed-mutator.mjs.map +1 -0
- package/esm/validation/plugins/database-rules-plugin.d.mts +28 -0
- package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -0
- package/esm/validation/plugins/database-rules-plugin.mjs +43 -0
- package/esm/validation/plugins/database-rules-plugin.mjs.map +1 -0
- package/esm/validation/plugins/embed-validator-plugin.d.mts +17 -0
- package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -0
- package/esm/validation/plugins/embed-validator-plugin.mjs +20 -0
- package/esm/validation/plugins/embed-validator-plugin.mjs.map +1 -0
- package/esm/validation/rules/database-model-rule.mjs +32 -0
- package/esm/validation/rules/database-model-rule.mjs.map +1 -0
- package/esm/validation/rules/exists-rule.mjs +29 -0
- package/esm/validation/rules/exists-rule.mjs.map +1 -0
- package/esm/validation/rules/unique-rule.mjs +43 -0
- package/esm/validation/rules/unique-rule.mjs.map +1 -0
- package/esm/validation/transformers/embed-model-transformer.mjs +17 -0
- package/esm/validation/transformers/embed-model-transformer.mjs.map +1 -0
- package/esm/validation/types.d.mts +43 -0
- package/esm/validation/types.d.mts.map +1 -0
- package/esm/validation/validators/embed-validator.d.mts +25 -0
- package/esm/validation/validators/embed-validator.d.mts.map +1 -0
- package/esm/validation/validators/embed-validator.mjs +42 -0
- package/esm/validation/validators/embed-validator.mjs.map +1 -0
- package/esm/writer/database-writer.d.mts +178 -0
- package/esm/writer/database-writer.d.mts.map +1 -0
- package/esm/writer/database-writer.mjs +317 -0
- package/esm/writer/database-writer.mjs.map +1 -0
- package/llms-full.txt +2027 -0
- package/llms.txt +23 -0
- package/package.json +60 -51
- package/skills/README.md +65 -0
- package/skills/aggregate-data/SKILL.md +102 -0
- package/skills/cascade-basics/SKILL.md +93 -0
- package/skills/configure-delete-strategy/SKILL.md +126 -0
- package/skills/define-model/SKILL.md +170 -0
- package/skills/define-relations/SKILL.md +171 -0
- package/skills/manage-data-sources/SKILL.md +140 -0
- package/skills/manage-transactions/SKILL.md +118 -0
- package/skills/paginate-results/SKILL.md +122 -0
- package/skills/perform-atomic-ops/SKILL.md +98 -0
- package/skills/query-data/SKILL.md +168 -0
- package/skills/run-cascade-cli/SKILL.md +125 -0
- package/skills/search-by-vector/SKILL.md +127 -0
- package/skills/subscribe-to-model-events/SKILL.md +148 -0
- package/skills/track-changes/SKILL.md +109 -0
- package/skills/write-migration/SKILL.md +144 -0
- package/cjs/context/database-data-source-context.d.ts +0 -29
- package/cjs/context/database-data-source-context.d.ts.map +0 -1
- package/cjs/context/database-data-source-context.js +0 -28
- package/cjs/context/database-data-source-context.js.map +0 -1
- package/cjs/context/database-transaction-context.d.ts +0 -35
- package/cjs/context/database-transaction-context.d.ts.map +0 -1
- package/cjs/context/database-transaction-context.js +0 -40
- package/cjs/context/database-transaction-context.js.map +0 -1
- package/cjs/contracts/database-driver.contract.d.ts +0 -450
- package/cjs/contracts/database-driver.contract.d.ts.map +0 -1
- package/cjs/contracts/database-id-generator.contract.d.ts +0 -109
- package/cjs/contracts/database-id-generator.contract.d.ts.map +0 -1
- package/cjs/contracts/database-remover.contract.d.ts +0 -104
- package/cjs/contracts/database-remover.contract.d.ts.map +0 -1
- package/cjs/contracts/database-restorer.contract.d.ts +0 -143
- package/cjs/contracts/database-restorer.contract.d.ts.map +0 -1
- package/cjs/contracts/database-writer.contract.d.ts +0 -119
- package/cjs/contracts/database-writer.contract.d.ts.map +0 -1
- package/cjs/contracts/driver-blueprint.contract.d.ts +0 -49
- package/cjs/contracts/driver-blueprint.contract.d.ts.map +0 -1
- package/cjs/contracts/index.d.ts +0 -10
- package/cjs/contracts/index.d.ts.map +0 -1
- package/cjs/contracts/migration-driver.contract.d.ts +0 -522
- package/cjs/contracts/migration-driver.contract.d.ts.map +0 -1
- package/cjs/contracts/query-builder.contract.d.ts +0 -1609
- package/cjs/contracts/query-builder.contract.d.ts.map +0 -1
- package/cjs/contracts/sync-adapter.contract.d.ts +0 -58
- package/cjs/contracts/sync-adapter.contract.d.ts.map +0 -1
- package/cjs/data-source/data-source-registry.d.ts +0 -108
- package/cjs/data-source/data-source-registry.d.ts.map +0 -1
- package/cjs/data-source/data-source-registry.js +0 -145
- package/cjs/data-source/data-source-registry.js.map +0 -1
- package/cjs/data-source/data-source.d.ts +0 -147
- package/cjs/data-source/data-source.d.ts.map +0 -1
- package/cjs/data-source/data-source.js +0 -83
- package/cjs/data-source/data-source.js.map +0 -1
- package/cjs/database-dirty-tracker.d.ts +0 -252
- package/cjs/database-dirty-tracker.d.ts.map +0 -1
- package/cjs/database-dirty-tracker.js +0 -386
- package/cjs/database-dirty-tracker.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
- package/cjs/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-blueprint.js +0 -51
- package/cjs/drivers/mongodb/mongodb-blueprint.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.d.ts +0 -325
- package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.js +0 -845
- package/cjs/drivers/mongodb/mongodb-driver.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
- package/cjs/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-id-generator.js +0 -149
- package/cjs/drivers/mongodb/mongodb-id-generator.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.js +0 -666
- package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
- package/cjs/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-builder.js +0 -1988
- package/cjs/drivers/mongodb/mongodb-query-builder.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
- package/cjs/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-operations.js +0 -270
- package/cjs/drivers/mongodb/mongodb-query-operations.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
- package/cjs/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-parser.js +0 -1351
- package/cjs/drivers/mongodb/mongodb-query-parser.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
- package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-sync-adapter.js +0 -146
- package/cjs/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
- package/cjs/drivers/mongodb/types.d.ts +0 -43
- package/cjs/drivers/mongodb/types.d.ts.map +0 -1
- package/cjs/drivers/postgres/index.d.ts +0 -16
- package/cjs/drivers/postgres/index.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-blueprint.d.ts +0 -64
- package/cjs/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-blueprint.js +0 -121
- package/cjs/drivers/postgres/postgres-blueprint.js.map +0 -1
- package/cjs/drivers/postgres/postgres-dialect.d.ts +0 -136
- package/cjs/drivers/postgres/postgres-dialect.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-dialect.js +0 -268
- package/cjs/drivers/postgres/postgres-dialect.js.map +0 -1
- package/cjs/drivers/postgres/postgres-driver.d.ts +0 -432
- package/cjs/drivers/postgres/postgres-driver.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-driver.js +0 -1008
- package/cjs/drivers/postgres/postgres-driver.js.map +0 -1
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts +0 -397
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-migration-driver.js +0 -900
- package/cjs/drivers/postgres/postgres-migration-driver.js.map +0 -1
- package/cjs/drivers/postgres/postgres-query-builder.d.ts +0 -254
- package/cjs/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-query-builder.js +0 -933
- package/cjs/drivers/postgres/postgres-query-builder.js.map +0 -1
- package/cjs/drivers/postgres/postgres-query-parser.d.ts +0 -328
- package/cjs/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-query-parser.js +0 -868
- package/cjs/drivers/postgres/postgres-query-parser.js.map +0 -1
- package/cjs/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
- package/cjs/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-sql-serializer.js +0 -400
- package/cjs/drivers/postgres/postgres-sql-serializer.js.map +0 -1
- package/cjs/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
- package/cjs/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-sync-adapter.js +0 -204
- package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/cjs/drivers/postgres/types.d.ts +0 -144
- package/cjs/drivers/postgres/types.d.ts.map +0 -1
- package/cjs/drivers/sql/index.d.ts +0 -10
- package/cjs/drivers/sql/index.d.ts.map +0 -1
- package/cjs/drivers/sql/sql-dialect.contract.d.ts +0 -204
- package/cjs/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
- package/cjs/drivers/sql/sql-types.d.ts +0 -202
- package/cjs/drivers/sql/sql-types.d.ts.map +0 -1
- package/cjs/errors/missing-data-source.error.d.ts +0 -22
- package/cjs/errors/missing-data-source.error.d.ts.map +0 -1
- package/cjs/errors/missing-data-source.error.js +0 -29
- package/cjs/errors/missing-data-source.error.js.map +0 -1
- package/cjs/errors/transaction-rollback.error.d.ts +0 -20
- package/cjs/errors/transaction-rollback.error.d.ts.map +0 -1
- package/cjs/errors/transaction-rollback.error.js +0 -27
- package/cjs/errors/transaction-rollback.error.js.map +0 -1
- package/cjs/events/model-events.d.ts +0 -231
- package/cjs/events/model-events.d.ts.map +0 -1
- package/cjs/events/model-events.js +0 -259
- package/cjs/events/model-events.js.map +0 -1
- package/cjs/expressions/aggregate-expressions.d.ts +0 -215
- package/cjs/expressions/aggregate-expressions.d.ts.map +0 -1
- package/cjs/expressions/aggregate-expressions.js +0 -221
- package/cjs/expressions/aggregate-expressions.js.map +0 -1
- package/cjs/expressions/index.d.ts +0 -2
- package/cjs/expressions/index.d.ts.map +0 -1
- package/cjs/index.d.ts +0 -45
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/migration/column-builder.d.ts +0 -417
- package/cjs/migration/column-builder.d.ts.map +0 -1
- package/cjs/migration/column-builder.js +0 -586
- package/cjs/migration/column-builder.js.map +0 -1
- package/cjs/migration/column-helpers.d.ts +0 -275
- package/cjs/migration/column-helpers.d.ts.map +0 -1
- package/cjs/migration/column-helpers.js +0 -389
- package/cjs/migration/column-helpers.js.map +0 -1
- package/cjs/migration/foreign-key-builder.d.ts +0 -103
- package/cjs/migration/foreign-key-builder.d.ts.map +0 -1
- package/cjs/migration/foreign-key-builder.js +0 -121
- package/cjs/migration/foreign-key-builder.js.map +0 -1
- package/cjs/migration/index.d.ts +0 -7
- package/cjs/migration/index.d.ts.map +0 -1
- package/cjs/migration/migration-runner.d.ts +0 -278
- package/cjs/migration/migration-runner.d.ts.map +0 -1
- package/cjs/migration/migration-runner.js +0 -815
- package/cjs/migration/migration-runner.js.map +0 -1
- package/cjs/migration/migration.d.ts +0 -1988
- package/cjs/migration/migration.d.ts.map +0 -1
- package/cjs/migration/migration.js +0 -2162
- package/cjs/migration/migration.js.map +0 -1
- package/cjs/migration/sql-grammar.d.ts +0 -61
- package/cjs/migration/sql-grammar.d.ts.map +0 -1
- package/cjs/migration/sql-grammar.js +0 -164
- package/cjs/migration/sql-grammar.js.map +0 -1
- package/cjs/migration/sql-serializer.d.ts +0 -22
- package/cjs/migration/sql-serializer.d.ts.map +0 -1
- package/cjs/migration/sql-serializer.js +0 -26
- package/cjs/migration/sql-serializer.js.map +0 -1
- package/cjs/migration/types.d.ts +0 -155
- package/cjs/migration/types.d.ts.map +0 -1
- package/cjs/model/methods/accessor-methods.d.ts +0 -13
- package/cjs/model/methods/accessor-methods.d.ts.map +0 -1
- package/cjs/model/methods/accessor-methods.js +0 -51
- package/cjs/model/methods/accessor-methods.js.map +0 -1
- package/cjs/model/methods/delete-methods.d.ts +0 -10
- package/cjs/model/methods/delete-methods.d.ts.map +0 -1
- package/cjs/model/methods/delete-methods.js +0 -10
- package/cjs/model/methods/delete-methods.js.map +0 -1
- package/cjs/model/methods/dirty-methods.d.ts +0 -10
- package/cjs/model/methods/dirty-methods.d.ts.map +0 -1
- package/cjs/model/methods/dirty-methods.js +0 -15
- package/cjs/model/methods/dirty-methods.js.map +0 -1
- package/cjs/model/methods/hydration-methods.d.ts +0 -10
- package/cjs/model/methods/hydration-methods.d.ts.map +0 -1
- package/cjs/model/methods/hydration-methods.js +0 -57
- package/cjs/model/methods/hydration-methods.js.map +0 -1
- package/cjs/model/methods/instance-event-methods.d.ts +0 -7
- package/cjs/model/methods/instance-event-methods.d.ts.map +0 -1
- package/cjs/model/methods/instance-event-methods.js +0 -15
- package/cjs/model/methods/instance-event-methods.js.map +0 -1
- package/cjs/model/methods/meta-methods.d.ts +0 -7
- package/cjs/model/methods/meta-methods.d.ts.map +0 -1
- package/cjs/model/methods/meta-methods.js +0 -78
- package/cjs/model/methods/meta-methods.js.map +0 -1
- package/cjs/model/methods/query-methods.d.ts +0 -24
- package/cjs/model/methods/query-methods.d.ts.map +0 -1
- package/cjs/model/methods/query-methods.js +0 -164
- package/cjs/model/methods/query-methods.js.map +0 -1
- package/cjs/model/methods/restore-methods.d.ts +0 -10
- package/cjs/model/methods/restore-methods.d.ts.map +0 -1
- package/cjs/model/methods/restore-methods.js +0 -13
- package/cjs/model/methods/restore-methods.js.map +0 -1
- package/cjs/model/methods/scope-methods.d.ts +0 -7
- package/cjs/model/methods/scope-methods.d.ts.map +0 -1
- package/cjs/model/methods/scope-methods.js +0 -15
- package/cjs/model/methods/scope-methods.js.map +0 -1
- package/cjs/model/methods/serialization-methods.d.ts +0 -3
- package/cjs/model/methods/serialization-methods.d.ts.map +0 -1
- package/cjs/model/methods/serialization-methods.js +0 -27
- package/cjs/model/methods/serialization-methods.js.map +0 -1
- package/cjs/model/methods/static-event-methods.d.ts +0 -9
- package/cjs/model/methods/static-event-methods.d.ts.map +0 -1
- package/cjs/model/methods/static-event-methods.js +0 -29
- package/cjs/model/methods/static-event-methods.js.map +0 -1
- package/cjs/model/methods/write-methods.d.ts +0 -10
- package/cjs/model/methods/write-methods.d.ts.map +0 -1
- package/cjs/model/methods/write-methods.js +0 -52
- package/cjs/model/methods/write-methods.js.map +0 -1
- package/cjs/model/model.d.ts +0 -1647
- package/cjs/model/model.d.ts.map +0 -1
- package/cjs/model/model.js +0 -1657
- package/cjs/model/model.js.map +0 -1
- package/cjs/model/model.types.d.ts +0 -44
- package/cjs/model/model.types.d.ts.map +0 -1
- package/cjs/model/register-model.d.ts +0 -81
- package/cjs/model/register-model.d.ts.map +0 -1
- package/cjs/model/register-model.js +0 -94
- package/cjs/model/register-model.js.map +0 -1
- package/cjs/query-builder/query-builder.d.ts +0 -556
- package/cjs/query-builder/query-builder.d.ts.map +0 -1
- package/cjs/query-builder/query-builder.js +0 -1070
- package/cjs/query-builder/query-builder.js.map +0 -1
- package/cjs/relations/helpers.d.ts +0 -156
- package/cjs/relations/helpers.d.ts.map +0 -1
- package/cjs/relations/helpers.js +0 -202
- package/cjs/relations/helpers.js.map +0 -1
- package/cjs/relations/index.d.ts +0 -35
- package/cjs/relations/index.d.ts.map +0 -1
- package/cjs/relations/pivot-operations.d.ts +0 -160
- package/cjs/relations/pivot-operations.d.ts.map +0 -1
- package/cjs/relations/pivot-operations.js +0 -293
- package/cjs/relations/pivot-operations.js.map +0 -1
- package/cjs/relations/relation-hydrator.d.ts +0 -68
- package/cjs/relations/relation-hydrator.d.ts.map +0 -1
- package/cjs/relations/relation-hydrator.js +0 -81
- package/cjs/relations/relation-hydrator.js.map +0 -1
- package/cjs/relations/relation-loader.d.ts +0 -194
- package/cjs/relations/relation-loader.d.ts.map +0 -1
- package/cjs/relations/relation-loader.js +0 -466
- package/cjs/relations/relation-loader.js.map +0 -1
- package/cjs/relations/types.d.ts +0 -306
- package/cjs/relations/types.d.ts.map +0 -1
- package/cjs/remover/database-remover.d.ts +0 -100
- package/cjs/remover/database-remover.d.ts.map +0 -1
- package/cjs/remover/database-remover.js +0 -214
- package/cjs/remover/database-remover.js.map +0 -1
- package/cjs/restorer/database-restorer.d.ts +0 -131
- package/cjs/restorer/database-restorer.d.ts.map +0 -1
- package/cjs/restorer/database-restorer.js +0 -434
- package/cjs/restorer/database-restorer.js.map +0 -1
- package/cjs/sql-database-dirty-tracker.d.ts +0 -13
- package/cjs/sql-database-dirty-tracker.d.ts.map +0 -1
- package/cjs/sql-database-dirty-tracker.js +0 -14
- package/cjs/sql-database-dirty-tracker.js.map +0 -1
- package/cjs/sync/index.d.ts +0 -12
- package/cjs/sync/index.d.ts.map +0 -1
- package/cjs/sync/model-events.d.ts +0 -62
- package/cjs/sync/model-events.d.ts.map +0 -1
- package/cjs/sync/model-events.js +0 -49
- package/cjs/sync/model-events.js.map +0 -1
- package/cjs/sync/model-sync-operation.d.ts +0 -163
- package/cjs/sync/model-sync-operation.d.ts.map +0 -1
- package/cjs/sync/model-sync-operation.js +0 -292
- package/cjs/sync/model-sync-operation.js.map +0 -1
- package/cjs/sync/model-sync.d.ts +0 -130
- package/cjs/sync/model-sync.d.ts.map +0 -1
- package/cjs/sync/model-sync.js +0 -178
- package/cjs/sync/model-sync.js.map +0 -1
- package/cjs/sync/sync-context.d.ts +0 -70
- package/cjs/sync/sync-context.d.ts.map +0 -1
- package/cjs/sync/sync-context.js +0 -101
- package/cjs/sync/sync-context.js.map +0 -1
- package/cjs/sync/sync-manager.d.ts +0 -213
- package/cjs/sync/sync-manager.d.ts.map +0 -1
- package/cjs/sync/sync-manager.js +0 -689
- package/cjs/sync/sync-manager.js.map +0 -1
- package/cjs/sync/types.d.ts +0 -289
- package/cjs/sync/types.d.ts.map +0 -1
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts +0 -15
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
- package/cjs/types.d.ts +0 -371
- package/cjs/types.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.d.ts +0 -307
- package/cjs/utils/connect-to-database.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.js +0 -130
- package/cjs/utils/connect-to-database.js.map +0 -1
- package/cjs/utils/database-writer.utils.d.ts +0 -15
- package/cjs/utils/database-writer.utils.d.ts.map +0 -1
- package/cjs/utils/database-writer.utils.js +0 -14
- package/cjs/utils/database-writer.utils.js.map +0 -1
- package/cjs/utils/define-model.js +0 -100
- package/cjs/utils/define-model.js.map +0 -1
- package/cjs/utils/is-valid-date-value.d.ts +0 -5
- package/cjs/utils/is-valid-date-value.d.ts.map +0 -1
- package/cjs/utils/is-valid-date-value.js +0 -25
- package/cjs/utils/is-valid-date-value.js.map +0 -1
- package/cjs/utils/once-connected.d.ts +0 -146
- package/cjs/utils/once-connected.d.ts.map +0 -1
- package/cjs/utils/once-connected.js +0 -251
- package/cjs/utils/once-connected.js.map +0 -1
- package/cjs/validation/database-seal-plugins.d.ts +0 -12
- package/cjs/validation/database-seal-plugins.d.ts.map +0 -1
- package/cjs/validation/database-seal-plugins.js +0 -1
- package/cjs/validation/database-seal-plugins.js.map +0 -1
- package/cjs/validation/database-writer-validation-error.d.ts +0 -97
- package/cjs/validation/database-writer-validation-error.d.ts.map +0 -1
- package/cjs/validation/database-writer-validation-error.js +0 -160
- package/cjs/validation/database-writer-validation-error.js.map +0 -1
- package/cjs/validation/index.d.ts +0 -3
- package/cjs/validation/index.d.ts.map +0 -1
- package/cjs/validation/mutators/embed-mutator.d.ts +0 -9
- package/cjs/validation/mutators/embed-mutator.d.ts.map +0 -1
- package/cjs/validation/mutators/embed-mutator.js +0 -33
- package/cjs/validation/mutators/embed-mutator.js.map +0 -1
- package/cjs/validation/plugins/embed-validator-plugin.d.ts +0 -24
- package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
- package/cjs/validation/plugins/embed-validator-plugin.js +0 -18
- package/cjs/validation/plugins/embed-validator-plugin.js.map +0 -1
- package/cjs/validation/rules/database-model-rule.d.ts +0 -7
- package/cjs/validation/rules/database-model-rule.d.ts.map +0 -1
- package/cjs/validation/rules/database-model-rule.js +0 -27
- package/cjs/validation/rules/database-model-rule.js.map +0 -1
- package/cjs/validation/transformers/embed-model-transformer.d.ts +0 -3
- package/cjs/validation/transformers/embed-model-transformer.d.ts.map +0 -1
- package/cjs/validation/transformers/embed-model-transformer.js +0 -18
- package/cjs/validation/transformers/embed-model-transformer.js.map +0 -1
- package/cjs/validation/validators/embed-validator.d.ts +0 -21
- package/cjs/validation/validators/embed-validator.d.ts.map +0 -1
- package/cjs/validation/validators/embed-validator.js +0 -43
- package/cjs/validation/validators/embed-validator.js.map +0 -1
- package/cjs/writer/database-writer.d.ts +0 -174
- package/cjs/writer/database-writer.d.ts.map +0 -1
- package/cjs/writer/database-writer.js +0 -400
- package/cjs/writer/database-writer.js.map +0 -1
- package/esm/context/database-data-source-context.d.ts +0 -29
- package/esm/context/database-data-source-context.d.ts.map +0 -1
- package/esm/context/database-data-source-context.js +0 -28
- package/esm/context/database-data-source-context.js.map +0 -1
- package/esm/context/database-transaction-context.d.ts +0 -35
- package/esm/context/database-transaction-context.d.ts.map +0 -1
- package/esm/context/database-transaction-context.js +0 -40
- package/esm/context/database-transaction-context.js.map +0 -1
- package/esm/contracts/database-driver.contract.d.ts +0 -450
- package/esm/contracts/database-driver.contract.d.ts.map +0 -1
- package/esm/contracts/database-id-generator.contract.d.ts +0 -109
- package/esm/contracts/database-id-generator.contract.d.ts.map +0 -1
- package/esm/contracts/database-remover.contract.d.ts +0 -104
- package/esm/contracts/database-remover.contract.d.ts.map +0 -1
- package/esm/contracts/database-restorer.contract.d.ts +0 -143
- package/esm/contracts/database-restorer.contract.d.ts.map +0 -1
- package/esm/contracts/database-writer.contract.d.ts +0 -119
- package/esm/contracts/database-writer.contract.d.ts.map +0 -1
- package/esm/contracts/driver-blueprint.contract.d.ts +0 -49
- package/esm/contracts/driver-blueprint.contract.d.ts.map +0 -1
- package/esm/contracts/index.d.ts +0 -10
- package/esm/contracts/index.d.ts.map +0 -1
- package/esm/contracts/migration-driver.contract.d.ts +0 -522
- package/esm/contracts/migration-driver.contract.d.ts.map +0 -1
- package/esm/contracts/query-builder.contract.d.ts +0 -1609
- package/esm/contracts/query-builder.contract.d.ts.map +0 -1
- package/esm/contracts/sync-adapter.contract.d.ts +0 -58
- package/esm/contracts/sync-adapter.contract.d.ts.map +0 -1
- package/esm/data-source/data-source-registry.d.ts +0 -108
- package/esm/data-source/data-source-registry.d.ts.map +0 -1
- package/esm/data-source/data-source-registry.js +0 -145
- package/esm/data-source/data-source-registry.js.map +0 -1
- package/esm/data-source/data-source.d.ts +0 -147
- package/esm/data-source/data-source.d.ts.map +0 -1
- package/esm/data-source/data-source.js +0 -83
- package/esm/data-source/data-source.js.map +0 -1
- package/esm/database-dirty-tracker.d.ts +0 -252
- package/esm/database-dirty-tracker.d.ts.map +0 -1
- package/esm/database-dirty-tracker.js +0 -386
- package/esm/database-dirty-tracker.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
- package/esm/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-blueprint.js +0 -51
- package/esm/drivers/mongodb/mongodb-blueprint.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.d.ts +0 -325
- package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.js +0 -845
- package/esm/drivers/mongodb/mongodb-driver.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
- package/esm/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-id-generator.js +0 -149
- package/esm/drivers/mongodb/mongodb-id-generator.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.js +0 -666
- package/esm/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
- package/esm/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-builder.js +0 -1988
- package/esm/drivers/mongodb/mongodb-query-builder.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
- package/esm/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-operations.js +0 -270
- package/esm/drivers/mongodb/mongodb-query-operations.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
- package/esm/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-parser.js +0 -1351
- package/esm/drivers/mongodb/mongodb-query-parser.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.js +0 -146
- package/esm/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
- package/esm/drivers/mongodb/types.d.ts +0 -43
- package/esm/drivers/mongodb/types.d.ts.map +0 -1
- package/esm/drivers/postgres/index.d.ts +0 -16
- package/esm/drivers/postgres/index.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-blueprint.d.ts +0 -64
- package/esm/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-blueprint.js +0 -121
- package/esm/drivers/postgres/postgres-blueprint.js.map +0 -1
- package/esm/drivers/postgres/postgres-dialect.d.ts +0 -136
- package/esm/drivers/postgres/postgres-dialect.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-dialect.js +0 -268
- package/esm/drivers/postgres/postgres-dialect.js.map +0 -1
- package/esm/drivers/postgres/postgres-driver.d.ts +0 -432
- package/esm/drivers/postgres/postgres-driver.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-driver.js +0 -1008
- package/esm/drivers/postgres/postgres-driver.js.map +0 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.ts +0 -397
- package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-migration-driver.js +0 -900
- package/esm/drivers/postgres/postgres-migration-driver.js.map +0 -1
- package/esm/drivers/postgres/postgres-query-builder.d.ts +0 -254
- package/esm/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-query-builder.js +0 -933
- package/esm/drivers/postgres/postgres-query-builder.js.map +0 -1
- package/esm/drivers/postgres/postgres-query-parser.d.ts +0 -328
- package/esm/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-query-parser.js +0 -868
- package/esm/drivers/postgres/postgres-query-parser.js.map +0 -1
- package/esm/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
- package/esm/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-sql-serializer.js +0 -400
- package/esm/drivers/postgres/postgres-sql-serializer.js.map +0 -1
- package/esm/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
- package/esm/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-sync-adapter.js +0 -204
- package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/esm/drivers/postgres/types.d.ts +0 -144
- package/esm/drivers/postgres/types.d.ts.map +0 -1
- package/esm/drivers/sql/index.d.ts +0 -10
- package/esm/drivers/sql/index.d.ts.map +0 -1
- package/esm/drivers/sql/sql-dialect.contract.d.ts +0 -204
- package/esm/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
- package/esm/drivers/sql/sql-types.d.ts +0 -202
- package/esm/drivers/sql/sql-types.d.ts.map +0 -1
- package/esm/errors/missing-data-source.error.d.ts +0 -22
- package/esm/errors/missing-data-source.error.d.ts.map +0 -1
- package/esm/errors/missing-data-source.error.js +0 -29
- package/esm/errors/missing-data-source.error.js.map +0 -1
- package/esm/errors/transaction-rollback.error.d.ts +0 -20
- package/esm/errors/transaction-rollback.error.d.ts.map +0 -1
- package/esm/errors/transaction-rollback.error.js +0 -27
- package/esm/errors/transaction-rollback.error.js.map +0 -1
- package/esm/events/model-events.d.ts +0 -231
- package/esm/events/model-events.d.ts.map +0 -1
- package/esm/events/model-events.js +0 -259
- package/esm/events/model-events.js.map +0 -1
- package/esm/expressions/aggregate-expressions.d.ts +0 -215
- package/esm/expressions/aggregate-expressions.d.ts.map +0 -1
- package/esm/expressions/aggregate-expressions.js +0 -221
- package/esm/expressions/aggregate-expressions.js.map +0 -1
- package/esm/expressions/index.d.ts +0 -2
- package/esm/expressions/index.d.ts.map +0 -1
- package/esm/index.d.ts +0 -45
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +0 -1
- package/esm/migration/column-builder.d.ts +0 -417
- package/esm/migration/column-builder.d.ts.map +0 -1
- package/esm/migration/column-builder.js +0 -586
- package/esm/migration/column-builder.js.map +0 -1
- package/esm/migration/column-helpers.d.ts +0 -275
- package/esm/migration/column-helpers.d.ts.map +0 -1
- package/esm/migration/column-helpers.js +0 -389
- package/esm/migration/column-helpers.js.map +0 -1
- package/esm/migration/foreign-key-builder.d.ts +0 -103
- package/esm/migration/foreign-key-builder.d.ts.map +0 -1
- package/esm/migration/foreign-key-builder.js +0 -121
- package/esm/migration/foreign-key-builder.js.map +0 -1
- package/esm/migration/index.d.ts +0 -7
- package/esm/migration/index.d.ts.map +0 -1
- package/esm/migration/migration-runner.d.ts +0 -278
- package/esm/migration/migration-runner.d.ts.map +0 -1
- package/esm/migration/migration-runner.js +0 -815
- package/esm/migration/migration-runner.js.map +0 -1
- package/esm/migration/migration.d.ts +0 -1988
- package/esm/migration/migration.d.ts.map +0 -1
- package/esm/migration/migration.js +0 -2162
- package/esm/migration/migration.js.map +0 -1
- package/esm/migration/sql-grammar.d.ts +0 -61
- package/esm/migration/sql-grammar.d.ts.map +0 -1
- package/esm/migration/sql-grammar.js +0 -164
- package/esm/migration/sql-grammar.js.map +0 -1
- package/esm/migration/sql-serializer.d.ts +0 -22
- package/esm/migration/sql-serializer.d.ts.map +0 -1
- package/esm/migration/sql-serializer.js +0 -26
- package/esm/migration/sql-serializer.js.map +0 -1
- package/esm/migration/types.d.ts +0 -155
- package/esm/migration/types.d.ts.map +0 -1
- package/esm/model/methods/accessor-methods.d.ts +0 -13
- package/esm/model/methods/accessor-methods.d.ts.map +0 -1
- package/esm/model/methods/accessor-methods.js +0 -51
- package/esm/model/methods/accessor-methods.js.map +0 -1
- package/esm/model/methods/delete-methods.d.ts +0 -10
- package/esm/model/methods/delete-methods.d.ts.map +0 -1
- package/esm/model/methods/delete-methods.js +0 -10
- package/esm/model/methods/delete-methods.js.map +0 -1
- package/esm/model/methods/dirty-methods.d.ts +0 -10
- package/esm/model/methods/dirty-methods.d.ts.map +0 -1
- package/esm/model/methods/dirty-methods.js +0 -15
- package/esm/model/methods/dirty-methods.js.map +0 -1
- package/esm/model/methods/hydration-methods.d.ts +0 -10
- package/esm/model/methods/hydration-methods.d.ts.map +0 -1
- package/esm/model/methods/hydration-methods.js +0 -57
- package/esm/model/methods/hydration-methods.js.map +0 -1
- package/esm/model/methods/instance-event-methods.d.ts +0 -7
- package/esm/model/methods/instance-event-methods.d.ts.map +0 -1
- package/esm/model/methods/instance-event-methods.js +0 -15
- package/esm/model/methods/instance-event-methods.js.map +0 -1
- package/esm/model/methods/meta-methods.d.ts +0 -7
- package/esm/model/methods/meta-methods.d.ts.map +0 -1
- package/esm/model/methods/meta-methods.js +0 -78
- package/esm/model/methods/meta-methods.js.map +0 -1
- package/esm/model/methods/query-methods.d.ts +0 -24
- package/esm/model/methods/query-methods.d.ts.map +0 -1
- package/esm/model/methods/query-methods.js +0 -164
- package/esm/model/methods/query-methods.js.map +0 -1
- package/esm/model/methods/restore-methods.d.ts +0 -10
- package/esm/model/methods/restore-methods.d.ts.map +0 -1
- package/esm/model/methods/restore-methods.js +0 -13
- package/esm/model/methods/restore-methods.js.map +0 -1
- package/esm/model/methods/scope-methods.d.ts +0 -7
- package/esm/model/methods/scope-methods.d.ts.map +0 -1
- package/esm/model/methods/scope-methods.js +0 -15
- package/esm/model/methods/scope-methods.js.map +0 -1
- package/esm/model/methods/serialization-methods.d.ts +0 -3
- package/esm/model/methods/serialization-methods.d.ts.map +0 -1
- package/esm/model/methods/serialization-methods.js +0 -27
- package/esm/model/methods/serialization-methods.js.map +0 -1
- package/esm/model/methods/static-event-methods.d.ts +0 -9
- package/esm/model/methods/static-event-methods.d.ts.map +0 -1
- package/esm/model/methods/static-event-methods.js +0 -29
- package/esm/model/methods/static-event-methods.js.map +0 -1
- package/esm/model/methods/write-methods.d.ts +0 -10
- package/esm/model/methods/write-methods.d.ts.map +0 -1
- package/esm/model/methods/write-methods.js +0 -52
- package/esm/model/methods/write-methods.js.map +0 -1
- package/esm/model/model.d.ts +0 -1647
- package/esm/model/model.d.ts.map +0 -1
- package/esm/model/model.js +0 -1657
- package/esm/model/model.js.map +0 -1
- package/esm/model/model.types.d.ts +0 -44
- package/esm/model/model.types.d.ts.map +0 -1
- package/esm/model/register-model.d.ts +0 -81
- package/esm/model/register-model.d.ts.map +0 -1
- package/esm/model/register-model.js +0 -94
- package/esm/model/register-model.js.map +0 -1
- package/esm/query-builder/query-builder.d.ts +0 -556
- package/esm/query-builder/query-builder.d.ts.map +0 -1
- package/esm/query-builder/query-builder.js +0 -1070
- package/esm/query-builder/query-builder.js.map +0 -1
- package/esm/relations/helpers.d.ts +0 -156
- package/esm/relations/helpers.d.ts.map +0 -1
- package/esm/relations/helpers.js +0 -202
- package/esm/relations/helpers.js.map +0 -1
- package/esm/relations/index.d.ts +0 -35
- package/esm/relations/index.d.ts.map +0 -1
- package/esm/relations/pivot-operations.d.ts +0 -160
- package/esm/relations/pivot-operations.d.ts.map +0 -1
- package/esm/relations/pivot-operations.js +0 -293
- package/esm/relations/pivot-operations.js.map +0 -1
- package/esm/relations/relation-hydrator.d.ts +0 -68
- package/esm/relations/relation-hydrator.d.ts.map +0 -1
- package/esm/relations/relation-hydrator.js +0 -81
- package/esm/relations/relation-hydrator.js.map +0 -1
- package/esm/relations/relation-loader.d.ts +0 -194
- package/esm/relations/relation-loader.d.ts.map +0 -1
- package/esm/relations/relation-loader.js +0 -466
- package/esm/relations/relation-loader.js.map +0 -1
- package/esm/relations/types.d.ts +0 -306
- package/esm/relations/types.d.ts.map +0 -1
- package/esm/remover/database-remover.d.ts +0 -100
- package/esm/remover/database-remover.d.ts.map +0 -1
- package/esm/remover/database-remover.js +0 -214
- package/esm/remover/database-remover.js.map +0 -1
- package/esm/restorer/database-restorer.d.ts +0 -131
- package/esm/restorer/database-restorer.d.ts.map +0 -1
- package/esm/restorer/database-restorer.js +0 -434
- package/esm/restorer/database-restorer.js.map +0 -1
- package/esm/sql-database-dirty-tracker.d.ts +0 -13
- package/esm/sql-database-dirty-tracker.d.ts.map +0 -1
- package/esm/sql-database-dirty-tracker.js +0 -14
- package/esm/sql-database-dirty-tracker.js.map +0 -1
- package/esm/sync/index.d.ts +0 -12
- package/esm/sync/index.d.ts.map +0 -1
- package/esm/sync/model-events.d.ts +0 -62
- package/esm/sync/model-events.d.ts.map +0 -1
- package/esm/sync/model-events.js +0 -49
- package/esm/sync/model-events.js.map +0 -1
- package/esm/sync/model-sync-operation.d.ts +0 -163
- package/esm/sync/model-sync-operation.d.ts.map +0 -1
- package/esm/sync/model-sync-operation.js +0 -292
- package/esm/sync/model-sync-operation.js.map +0 -1
- package/esm/sync/model-sync.d.ts +0 -130
- package/esm/sync/model-sync.d.ts.map +0 -1
- package/esm/sync/model-sync.js +0 -178
- package/esm/sync/model-sync.js.map +0 -1
- package/esm/sync/sync-context.d.ts +0 -70
- package/esm/sync/sync-context.d.ts.map +0 -1
- package/esm/sync/sync-context.js +0 -101
- package/esm/sync/sync-context.js.map +0 -1
- package/esm/sync/sync-manager.d.ts +0 -213
- package/esm/sync/sync-manager.d.ts.map +0 -1
- package/esm/sync/sync-manager.js +0 -689
- package/esm/sync/sync-manager.js.map +0 -1
- package/esm/sync/types.d.ts +0 -289
- package/esm/sync/types.d.ts.map +0 -1
- package/esm/test-migrations/test-enhanced-features.migration.d.ts +0 -15
- package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
- package/esm/types.d.ts +0 -371
- package/esm/types.d.ts.map +0 -1
- package/esm/utils/connect-to-database.d.ts +0 -307
- package/esm/utils/connect-to-database.d.ts.map +0 -1
- package/esm/utils/connect-to-database.js +0 -130
- package/esm/utils/connect-to-database.js.map +0 -1
- package/esm/utils/database-writer.utils.d.ts +0 -15
- package/esm/utils/database-writer.utils.d.ts.map +0 -1
- package/esm/utils/database-writer.utils.js +0 -14
- package/esm/utils/database-writer.utils.js.map +0 -1
- package/esm/utils/define-model.js +0 -100
- package/esm/utils/define-model.js.map +0 -1
- package/esm/utils/is-valid-date-value.d.ts +0 -5
- package/esm/utils/is-valid-date-value.d.ts.map +0 -1
- package/esm/utils/is-valid-date-value.js +0 -25
- package/esm/utils/is-valid-date-value.js.map +0 -1
- package/esm/utils/once-connected.d.ts +0 -146
- package/esm/utils/once-connected.d.ts.map +0 -1
- package/esm/utils/once-connected.js +0 -251
- package/esm/utils/once-connected.js.map +0 -1
- package/esm/validation/database-seal-plugins.d.ts +0 -12
- package/esm/validation/database-seal-plugins.d.ts.map +0 -1
- package/esm/validation/database-seal-plugins.js +0 -1
- package/esm/validation/database-seal-plugins.js.map +0 -1
- package/esm/validation/database-writer-validation-error.d.ts +0 -97
- package/esm/validation/database-writer-validation-error.d.ts.map +0 -1
- package/esm/validation/database-writer-validation-error.js +0 -160
- package/esm/validation/database-writer-validation-error.js.map +0 -1
- package/esm/validation/index.d.ts +0 -3
- package/esm/validation/index.d.ts.map +0 -1
- package/esm/validation/mutators/embed-mutator.d.ts +0 -9
- package/esm/validation/mutators/embed-mutator.d.ts.map +0 -1
- package/esm/validation/mutators/embed-mutator.js +0 -33
- package/esm/validation/mutators/embed-mutator.js.map +0 -1
- package/esm/validation/plugins/embed-validator-plugin.d.ts +0 -24
- package/esm/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
- package/esm/validation/plugins/embed-validator-plugin.js +0 -18
- package/esm/validation/plugins/embed-validator-plugin.js.map +0 -1
- package/esm/validation/rules/database-model-rule.d.ts +0 -7
- package/esm/validation/rules/database-model-rule.d.ts.map +0 -1
- package/esm/validation/rules/database-model-rule.js +0 -27
- package/esm/validation/rules/database-model-rule.js.map +0 -1
- package/esm/validation/transformers/embed-model-transformer.d.ts +0 -3
- package/esm/validation/transformers/embed-model-transformer.d.ts.map +0 -1
- package/esm/validation/transformers/embed-model-transformer.js +0 -18
- package/esm/validation/transformers/embed-model-transformer.js.map +0 -1
- package/esm/validation/validators/embed-validator.d.ts +0 -21
- package/esm/validation/validators/embed-validator.d.ts.map +0 -1
- package/esm/validation/validators/embed-validator.js +0 -43
- package/esm/validation/validators/embed-validator.js.map +0 -1
- package/esm/writer/database-writer.d.ts +0 -174
- package/esm/writer/database-writer.d.ts.map +0 -1
- package/esm/writer/database-writer.js +0 -400
- package/esm/writer/database-writer.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChildModel } from "../../model/model.types.mjs";
|
|
2
|
+
import { EmbedModelValidator } from "../validators/embed-validator.mjs";
|
|
3
|
+
//#region ../../@warlock.js/cascade/src/validation/plugins/embed-validator-plugin.d.ts
|
|
4
|
+
type EmbedOptions = {
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
embed?: string | string[];
|
|
7
|
+
};
|
|
8
|
+
declare module "@warlock.js/seal" {
|
|
9
|
+
interface ValidatorV {
|
|
10
|
+
embed(model: ChildModel<any> | string, options?: EmbedOptions): EmbedModelValidator;
|
|
11
|
+
embedMany(model: ChildModel<any> | string, options?: EmbedOptions): EmbedModelValidator;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* File validation plugin for Seal
|
|
16
|
+
*/
|
|
17
|
+
//# sourceMappingURL=embed-validator-plugin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-validator-plugin.d.mts","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/plugins/embed-validator-plugin.ts"],"mappings":";;;KAWK,YAAA;EACH,YAAA;EACA,KAAK;AAAA;AAAA;EAAA,UAIK,UAAA;IACR,KAAA,CAAM,KAAA,EAAO,UAAA,gBAA0B,OAAA,GAAU,YAAA,GAAe,mBAAA;IAChE,SAAA,CAAU,KAAA,EAAO,UAAA,gBAA0B,OAAA,GAAU,YAAA,GAAe,mBAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EmbedModelValidator } from "../validators/embed-validator.mjs";
|
|
2
|
+
import { v } from "@warlock.js/seal";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/cascade/src/validation/plugins/embed-validator-plugin.ts
|
|
5
|
+
/**
|
|
6
|
+
* File validation plugin for Seal
|
|
7
|
+
*/
|
|
8
|
+
const embedValidator = {
|
|
9
|
+
name: "embed",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
description: "Adds embed validation (v.embed())",
|
|
12
|
+
install() {
|
|
13
|
+
v.embed = (model, options) => new EmbedModelValidator().model(model).embed(options?.embed);
|
|
14
|
+
v.embedMany = (model, options) => new EmbedModelValidator().models(model).embed(options?.embed);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { embedValidator };
|
|
20
|
+
//# sourceMappingURL=embed-validator-plugin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-validator-plugin.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/plugins/embed-validator-plugin.ts"],"sourcesContent":["/**\n * Embed Validator Plugin\n *\n * Adds embed validation to Seal v factory\n */\n\nimport type { SealPlugin } from \"@warlock.js/seal\";\nimport { v } from \"@warlock.js/seal\";\nimport type { ChildModel } from \"../../model/model\";\nimport { EmbedModelValidator } from \"../validators/embed-validator\";\n\ntype EmbedOptions = {\n errorMessage?: string;\n embed?: string | string[];\n};\n\ndeclare module \"@warlock.js/seal\" {\n interface ValidatorV {\n embed(model: ChildModel<any> | string, options?: EmbedOptions): EmbedModelValidator;\n embedMany(model: ChildModel<any> | string, options?: EmbedOptions): EmbedModelValidator;\n }\n}\n\n/**\n * File validation plugin for Seal\n */\nexport const embedValidator: SealPlugin = {\n name: \"embed\",\n version: \"1.0.0\",\n description: \"Adds embed validation (v.embed())\",\n\n install() {\n // Inject embed() method into v factory\n v.embed = (model: ChildModel<any> | string, options?: EmbedOptions) =>\n new EmbedModelValidator().model(model).embed(options?.embed);\n v.embedMany = (model: ChildModel<any> | string, options?: EmbedOptions) =>\n new EmbedModelValidator().models(model).embed(options?.embed);\n },\n};\n"],"mappings":";;;;;;;AA0BA,MAAa,iBAA6B;CACxC,MAAM;CACN,SAAS;CACT,aAAa;CAEb,UAAU;EAER,EAAE,SAAS,OAAiC,YAC1C,IAAI,oBAAoB,EAAE,MAAM,KAAK,EAAE,MAAM,SAAS,KAAK;EAC7D,EAAE,aAAa,OAAiC,YAC9C,IAAI,oBAAoB,EAAE,OAAO,KAAK,EAAE,MAAM,SAAS,KAAK;CAChE;AACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getModelFromRegistry } from "../../model/register-model.mjs";
|
|
2
|
+
import { Model } from "../../model/model.mjs";
|
|
3
|
+
import { VALID_RULE, invalidRule } from "@warlock.js/seal";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/cascade/src/validation/rules/database-model-rule.ts
|
|
6
|
+
const databaseModelRule = {
|
|
7
|
+
name: "databaseModel",
|
|
8
|
+
defaultErrorMessage: "The :input must be a valid :model model",
|
|
9
|
+
async validate(value, context) {
|
|
10
|
+
if (value instanceof Model === false) {
|
|
11
|
+
this.context.attributesList.model = this.context.options.model?.name;
|
|
12
|
+
return invalidRule(this, context);
|
|
13
|
+
}
|
|
14
|
+
return VALID_RULE;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const databaseModelsRule = {
|
|
18
|
+
name: "databaseModels",
|
|
19
|
+
defaultErrorMessage: "The :input must be a list of valid :model",
|
|
20
|
+
async validate(value, context) {
|
|
21
|
+
let { model } = this.context.options;
|
|
22
|
+
if (typeof model === "string") model = getModelFromRegistry(model);
|
|
23
|
+
this.context.attributesList.model = model.name;
|
|
24
|
+
if (!Array.isArray(value)) return invalidRule(this, context);
|
|
25
|
+
if (value.every((item) => item instanceof Model)) return VALID_RULE;
|
|
26
|
+
return invalidRule(this, context);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { databaseModelRule, databaseModelsRule };
|
|
32
|
+
//# sourceMappingURL=database-model-rule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-model-rule.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/rules/database-model-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE, type SchemaRule } from \"@warlock.js/seal\";\r\nimport { ChildModel, Model } from \"./../../model/model\";\r\nimport { getModelFromRegistry } from \"./../../model/register-model\";\r\n\r\nexport const databaseModelRule: SchemaRule = {\r\n name: \"databaseModel\",\r\n defaultErrorMessage: \"The :input must be a valid :model model\",\r\n async validate(value, context) {\r\n if (value instanceof Model === false) {\r\n this.context.attributesList.model = this.context.options.model?.name;\r\n return invalidRule(this, context);\r\n }\r\n\r\n return VALID_RULE;\r\n },\r\n};\r\n\r\nexport const databaseModelsRule: SchemaRule<{ model: ChildModel<any> | string }> = {\r\n name: \"databaseModels\",\r\n defaultErrorMessage: \"The :input must be a list of valid :model\",\r\n async validate(value, context) {\r\n let { model } = this.context.options;\r\n if (typeof model === \"string\") {\r\n model = getModelFromRegistry(model)!;\r\n }\r\n\r\n this.context.attributesList.model = model.name;\r\n\r\n if (!Array.isArray(value)) return invalidRule(this, context);\r\n\r\n if (value.every((item) => item instanceof Model)) return VALID_RULE;\r\n\r\n return invalidRule(this, context);\r\n },\r\n};\r\n"],"mappings":";;;;;AAIA,MAAa,oBAAgC;CAC3C,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAO,SAAS;EAC7B,IAAI,iBAAiB,UAAU,OAAO;GACpC,KAAK,QAAQ,eAAe,QAAQ,KAAK,QAAQ,QAAQ,OAAO;GAChE,OAAO,YAAY,MAAM,OAAO;EAClC;EAEA,OAAO;CACT;AACF;AAEA,MAAa,qBAAsE;CACjF,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAO,SAAS;EAC7B,IAAI,EAAE,UAAU,KAAK,QAAQ;EAC7B,IAAI,OAAO,UAAU,UACnB,QAAQ,qBAAqB,KAAK;EAGpC,KAAK,QAAQ,eAAe,QAAQ,MAAM;EAE1C,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG,OAAO,YAAY,MAAM,OAAO;EAE3D,IAAI,MAAM,OAAO,SAAS,gBAAgB,KAAK,GAAG,OAAO;EAEzD,OAAO,YAAY,MAAM,OAAO;CAClC;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { resolveModelClass } from "../../model/register-model.mjs";
|
|
2
|
+
import { VALID_RULE, invalidRule } from "@warlock.js/seal";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/cascade/src/validation/rules/exists-rule.ts
|
|
5
|
+
/**
|
|
6
|
+
* Validates that a record exists in the database for the given column/value.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* v.string().exists(Organization, { column: "id" });
|
|
10
|
+
*/
|
|
11
|
+
const existsRule = {
|
|
12
|
+
name: "exists",
|
|
13
|
+
defaultErrorMessage: "The :input must exist",
|
|
14
|
+
async validate(value, context) {
|
|
15
|
+
const { Model, query, column = context.key } = this.context.options;
|
|
16
|
+
const dbQuery = resolveModelClass(Model).query();
|
|
17
|
+
dbQuery.where(column, value);
|
|
18
|
+
if (query) await query({
|
|
19
|
+
query: dbQuery,
|
|
20
|
+
value,
|
|
21
|
+
allValues: context.allValues
|
|
22
|
+
});
|
|
23
|
+
return await dbQuery.first() ? VALID_RULE : invalidRule(this, context);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { existsRule };
|
|
29
|
+
//# sourceMappingURL=exists-rule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exists-rule.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/rules/exists-rule.ts"],"sourcesContent":["import { invalidRule, VALID_RULE, type SchemaRule } from \"@warlock.js/seal\";\nimport { resolveModelClass } from \"../../model/register-model\";\nimport type { ExistsRuleOptions } from \"../types\";\n\n/**\n * Validates that a record exists in the database for the given column/value.\n *\n * @example\n * v.string().exists(Organization, { column: \"id\" });\n */\nexport const existsRule: SchemaRule<ExistsRuleOptions> = {\n name: \"exists\",\n defaultErrorMessage: \"The :input must exist\",\n async validate(value: any, context) {\n const { Model, query, column = context.key } = this.context.options;\n\n const ResolvedModelClass = resolveModelClass(Model);\n\n const dbQuery = ResolvedModelClass.query();\n\n dbQuery.where(column, value);\n\n if (query) {\n await query({\n query: dbQuery,\n value,\n allValues: context.allValues,\n });\n }\n\n const document = await dbQuery.first();\n\n return document ? VALID_RULE : invalidRule(this, context);\n },\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,aAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EAAE,OAAO,OAAO,SAAS,QAAQ,QAAQ,KAAK,QAAQ;EAI5D,MAAM,UAFqB,kBAAkB,KAEZ,EAAE,MAAM;EAEzC,QAAQ,MAAM,QAAQ,KAAK;EAE3B,IAAI,OACF,MAAM,MAAM;GACV,OAAO;GACP;GACA,WAAW,QAAQ;EACrB,CAAC;EAKH,OAAO,MAFgB,QAAQ,MAAM,IAEnB,aAAa,YAAY,MAAM,OAAO;CAC1D;AACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { resolveModelClass } from "../../model/register-model.mjs";
|
|
2
|
+
import { get } from "@mongez/reinforcements";
|
|
3
|
+
import { VALID_RULE, invalidRule } from "@warlock.js/seal";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/cascade/src/validation/rules/unique-rule.ts
|
|
6
|
+
/**
|
|
7
|
+
* Validates that a value is unique against a database column.
|
|
8
|
+
*
|
|
9
|
+
* Supports three exclusion modes:
|
|
10
|
+
* - `except`: read a sibling input's value and exclude rows where that
|
|
11
|
+
* column equals the sibling's value
|
|
12
|
+
* - `exceptColumnName` + `exceptValue`: exclude rows where the named
|
|
13
|
+
* column equals the supplied value (used by request-aware wrappers)
|
|
14
|
+
* - Custom `query` callback for anything more involved
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* v.email().unique("User");
|
|
18
|
+
* v.string().unique("User", { except: "id" });
|
|
19
|
+
*/
|
|
20
|
+
const uniqueRule = {
|
|
21
|
+
name: "unique",
|
|
22
|
+
defaultErrorMessage: "The :input must be unique",
|
|
23
|
+
async validate(value, context) {
|
|
24
|
+
const { Model, except, column = context.key, exceptColumnName, exceptValue, query } = this.context.options;
|
|
25
|
+
const dbQuery = resolveModelClass(Model).query();
|
|
26
|
+
dbQuery.where(column, value);
|
|
27
|
+
if (except) {
|
|
28
|
+
const exceptVal = get(context.allValues, except);
|
|
29
|
+
if (exceptVal !== void 0) dbQuery.where(except, "!=", exceptVal);
|
|
30
|
+
}
|
|
31
|
+
if (exceptColumnName !== void 0) dbQuery.where(exceptColumnName, "!=", exceptValue);
|
|
32
|
+
if (query) await query({
|
|
33
|
+
query: dbQuery,
|
|
34
|
+
value,
|
|
35
|
+
allValues: context.allValues
|
|
36
|
+
});
|
|
37
|
+
return await dbQuery.first() ? invalidRule(this, context) : VALID_RULE;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { uniqueRule };
|
|
43
|
+
//# sourceMappingURL=unique-rule.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unique-rule.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/rules/unique-rule.ts"],"sourcesContent":["import { get } from \"@mongez/reinforcements\";\nimport { invalidRule, VALID_RULE, type SchemaRule } from \"@warlock.js/seal\";\nimport { resolveModelClass } from \"../../model/register-model\";\nimport type { UniqueRuleOptions } from \"../types\";\n\n/**\n * Validates that a value is unique against a database column.\n *\n * Supports three exclusion modes:\n * - `except`: read a sibling input's value and exclude rows where that\n * column equals the sibling's value\n * - `exceptColumnName` + `exceptValue`: exclude rows where the named\n * column equals the supplied value (used by request-aware wrappers)\n * - Custom `query` callback for anything more involved\n *\n * @example\n * v.email().unique(\"User\");\n * v.string().unique(\"User\", { except: \"id\" });\n */\nexport const uniqueRule: SchemaRule<UniqueRuleOptions> = {\n name: \"unique\",\n defaultErrorMessage: \"The :input must be unique\",\n async validate(value: any, context) {\n const {\n Model,\n except,\n column = context.key,\n exceptColumnName,\n exceptValue,\n query,\n } = this.context.options;\n\n const ResolvedModelClass = resolveModelClass(Model);\n\n const dbQuery = ResolvedModelClass.query();\n\n dbQuery.where(column, value);\n\n if (except) {\n const exceptVal = get(context.allValues, except);\n\n if (exceptVal !== undefined) {\n dbQuery.where(except, \"!=\", exceptVal);\n }\n }\n\n if (exceptColumnName !== undefined) {\n dbQuery.where(exceptColumnName, \"!=\", exceptValue);\n }\n\n if (query) {\n await query({\n query: dbQuery,\n value,\n allValues: context.allValues,\n });\n }\n\n const document = await dbQuery.first();\n\n return document ? invalidRule(this, context) : VALID_RULE;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,aAA4C;CACvD,MAAM;CACN,qBAAqB;CACrB,MAAM,SAAS,OAAY,SAAS;EAClC,MAAM,EACJ,OACA,QACA,SAAS,QAAQ,KACjB,kBACA,aACA,UACE,KAAK,QAAQ;EAIjB,MAAM,UAFqB,kBAAkB,KAEZ,EAAE,MAAM;EAEzC,QAAQ,MAAM,QAAQ,KAAK;EAE3B,IAAI,QAAQ;GACV,MAAM,YAAY,IAAI,QAAQ,WAAW,MAAM;GAE/C,IAAI,cAAc,QAChB,QAAQ,MAAM,QAAQ,MAAM,SAAS;EAEzC;EAEA,IAAI,qBAAqB,QACvB,QAAQ,MAAM,kBAAkB,MAAM,WAAW;EAGnD,IAAI,OACF,MAAM,MAAM;GACV,OAAO;GACP;GACA,WAAW,QAAQ;EACrB,CAAC;EAKH,OAAO,MAFgB,QAAQ,MAAM,IAEnB,YAAY,MAAM,OAAO,IAAI;CACjD;AACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Model } from "../../model/model.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../@warlock.js/cascade/src/validation/transformers/embed-model-transformer.ts
|
|
4
|
+
const databaseModelTransformer = (value, context) => {
|
|
5
|
+
const embed = context.options.embed ?? "embedData";
|
|
6
|
+
if (value instanceof Model === false && !Array.isArray(value)) return value;
|
|
7
|
+
if (Array.isArray(value)) return value.map((item) => {
|
|
8
|
+
if (typeof embed === "string") return item[embed];
|
|
9
|
+
return item.only(embed);
|
|
10
|
+
});
|
|
11
|
+
if (typeof embed === "string") return value[embed];
|
|
12
|
+
return value.only(embed);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { databaseModelTransformer };
|
|
17
|
+
//# sourceMappingURL=embed-model-transformer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-model-transformer.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/transformers/embed-model-transformer.ts"],"sourcesContent":["import { type TransformerCallback } from \"@warlock.js/seal\";\nimport { Model } from \"../../model/model\";\n\nexport const databaseModelTransformer: TransformerCallback = (value, context) => {\n const embed = context.options.embed ?? \"embedData\";\n\n if (value instanceof Model === false && !Array.isArray(value)) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => {\n if (typeof embed === \"string\") {\n return item[embed];\n }\n\n return item.only(embed);\n });\n }\n\n if (typeof embed === \"string\") {\n return (value as any)[embed];\n }\n\n return value.only(embed);\n};\n"],"mappings":";;;AAGA,MAAa,4BAAiD,OAAO,YAAY;CAC/E,MAAM,QAAQ,QAAQ,QAAQ,SAAS;CAEvC,IAAI,iBAAiB,UAAU,SAAS,CAAC,MAAM,QAAQ,KAAK,GAC1D,OAAO;CAGT,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,KAAK,SAAS;EACzB,IAAI,OAAO,UAAU,UACnB,OAAO,KAAK;EAGd,OAAO,KAAK,KAAK,KAAK;CACxB,CAAC;CAGH,IAAI,OAAO,UAAU,UACnB,OAAQ,MAAc;CAGxB,OAAO,MAAM,KAAK,KAAK;AACzB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ChildModel } from "../model/model.types.mjs";
|
|
2
|
+
import { Model } from "../model/model.mjs";
|
|
3
|
+
import { QueryBuilderContract } from "../contracts/query-builder.contract.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/cascade/src/validation/types.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Base options shared by all database-backed validation rules.
|
|
8
|
+
*
|
|
9
|
+
* Identifies the model to query, the column to filter on, and an optional
|
|
10
|
+
* hook to customise the query before the existence/uniqueness check runs.
|
|
11
|
+
*/
|
|
12
|
+
type BaseQueryRuleOptions = {
|
|
13
|
+
/** The Model to query against */Model: ChildModel<Model> | string; /** Callback to customise the query before it executes */
|
|
14
|
+
query?: (options: {
|
|
15
|
+
query: QueryBuilderContract;
|
|
16
|
+
value: any;
|
|
17
|
+
allValues: any;
|
|
18
|
+
}) => void | Promise<void>; /** The column to filter by (defaults to the validated key) */
|
|
19
|
+
column?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Base options for uniqueness validation rules.
|
|
23
|
+
*/
|
|
24
|
+
type BaseUniqueRuleOptions = BaseQueryRuleOptions;
|
|
25
|
+
/**
|
|
26
|
+
* Options for the `unique` validation rule.
|
|
27
|
+
*
|
|
28
|
+
* Accepts an optional `except` sibling-key for "unique except this other
|
|
29
|
+
* input's value", or an explicit `exceptColumnName` / `exceptValue` pair
|
|
30
|
+
* used by request-aware wrappers (e.g. core's `uniqueExceptCurrentUser`).
|
|
31
|
+
*/
|
|
32
|
+
type UniqueRuleOptions = BaseUniqueRuleOptions & {
|
|
33
|
+
/** Sibling input key to exclude from the uniqueness check */except?: string; /** Column name to exclude (paired with `exceptValue`) */
|
|
34
|
+
exceptColumnName?: string; /** Value to exclude under `exceptColumnName` */
|
|
35
|
+
exceptValue?: any;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Options for the `exists` validation rule.
|
|
39
|
+
*/
|
|
40
|
+
type ExistsRuleOptions = BaseQueryRuleOptions;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { BaseQueryRuleOptions, BaseUniqueRuleOptions, ExistsRuleOptions, UniqueRuleOptions };
|
|
43
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../../@warlock.js/cascade/src/validation/types.ts"],"mappings":";;;;;;;;AASA;;;KAAY,oBAAA;EAEH,iCAAP,KAAA,EAAO,UAAA,CAAW,KAAA,YAML;EAJb,KAAA,IAAS,OAAA;IACP,KAAA,EAAO,oBAAA;IACP,KAAA;IACA,SAAA;EAAA,aACW,OAAA,QAJb;EAMA,MAAA;AAAA;;;;KAMU,qBAAA,GAAwB,oBAAoB;;;AANhD;AAMR;;;;KASY,iBAAA,GAAoB,qBAAqB;EAAzC,6DAEV,MAAA;EAEA,gBAAA,WAJ8B;EAM9B,WAAA;AAAA;;;AAAW;KAMD,iBAAA,GAAoB,oBAAoB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChildModel } from "../../model/model.types.mjs";
|
|
2
|
+
import { BaseValidator } from "@warlock.js/seal";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/cascade/src/validation/validators/embed-validator.d.ts
|
|
5
|
+
declare class EmbedModelValidator extends BaseValidator {
|
|
6
|
+
/**
|
|
7
|
+
* Check if value is a string type
|
|
8
|
+
*/
|
|
9
|
+
matchesType(value: any): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Mutate the value to be a model, also fail if the mutated value is not a valid model
|
|
12
|
+
*/
|
|
13
|
+
model(model: ChildModel<any> | string, errorMessage?: string): EmbedModelValidator;
|
|
14
|
+
/**
|
|
15
|
+
* Validate the value is a list of models
|
|
16
|
+
*/
|
|
17
|
+
models(model: ChildModel<any> | string, errorMessage?: string): EmbedModelValidator;
|
|
18
|
+
/**
|
|
19
|
+
* Determine how the data will be stored as an embedded document
|
|
20
|
+
*/
|
|
21
|
+
embed(embed?: string | string[]): EmbedModelValidator;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { EmbedModelValidator };
|
|
25
|
+
//# sourceMappingURL=embed-validator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-validator.d.mts","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/validators/embed-validator.ts"],"mappings":";;;;cAMa,mBAAA,SAA4B,aAAA;;;AAAzC;EAIS,WAAA,CAAY,KAAA;;;;EAWZ,KAAA,CAAM,KAAA,EAAO,UAAA,gBAA0B,YAAA,YAAwB,mBAAA;EAaC;;;EAAhE,MAAA,CAAO,KAAA,EAAO,UAAA,gBAA0B,YAAA,YAAwB,mBAAA;EA5BnB;;;EA6C7C,KAAA,CAAM,KAAA,uBAA4B,mBAAA;AAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { databaseModelMutator, databaseModelsMutator } from "../mutators/embed-mutator.mjs";
|
|
2
|
+
import { databaseModelRule, databaseModelsRule } from "../rules/database-model-rule.mjs";
|
|
3
|
+
import { databaseModelTransformer } from "../transformers/embed-model-transformer.mjs";
|
|
4
|
+
import { Model } from "../../model/model.mjs";
|
|
5
|
+
import { BaseValidator, arrayRule } from "@warlock.js/seal";
|
|
6
|
+
|
|
7
|
+
//#region ../../@warlock.js/cascade/src/validation/validators/embed-validator.ts
|
|
8
|
+
var EmbedModelValidator = class extends BaseValidator {
|
|
9
|
+
/**
|
|
10
|
+
* Check if value is a string type
|
|
11
|
+
*/
|
|
12
|
+
matchesType(value) {
|
|
13
|
+
return value instanceof Model || typeof value === "number" || Array.isArray(value) && value.every((item) => item instanceof Model);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Mutate the value to be a model, also fail if the mutated value is not a valid model
|
|
17
|
+
*/
|
|
18
|
+
model(model, errorMessage) {
|
|
19
|
+
this.addMutator(databaseModelMutator, { model });
|
|
20
|
+
return this.addRule(databaseModelRule, errorMessage, { model });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Validate the value is a list of models
|
|
24
|
+
*/
|
|
25
|
+
models(model, errorMessage) {
|
|
26
|
+
const instance = this.instance;
|
|
27
|
+
instance.addMutator(databaseModelsMutator, { model });
|
|
28
|
+
instance.addMutableRule(arrayRule);
|
|
29
|
+
instance.addMutableRule(databaseModelsRule, errorMessage, { model });
|
|
30
|
+
return instance;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Determine how the data will be stored as an embedded document
|
|
34
|
+
*/
|
|
35
|
+
embed(embed) {
|
|
36
|
+
return this.addTransformer(databaseModelTransformer, { embed });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { EmbedModelValidator };
|
|
42
|
+
//# sourceMappingURL=embed-validator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-validator.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/validation/validators/embed-validator.ts"],"sourcesContent":["import { arrayRule, BaseValidator } from \"@warlock.js/seal\";\nimport { Model, type ChildModel } from \"../../model/model\";\nimport { databaseModelMutator, databaseModelsMutator } from \"../mutators/embed-mutator\";\nimport { databaseModelRule, databaseModelsRule } from \"../rules/database-model-rule\";\nimport { databaseModelTransformer } from \"../transformers/embed-model-transformer\";\n\nexport class EmbedModelValidator extends BaseValidator {\n /**\n * Check if value is a string type\n */\n public matchesType(value: any): boolean {\n return (\n value instanceof Model ||\n typeof value === \"number\" ||\n (Array.isArray(value) && value.every((item) => item instanceof Model))\n );\n }\n\n /**\n * Mutate the value to be a model, also fail if the mutated value is not a valid model\n */\n public model(model: ChildModel<any> | string, errorMessage?: string): EmbedModelValidator {\n this.addMutator(databaseModelMutator, {\n model,\n });\n\n return this.addRule(databaseModelRule, errorMessage, {\n model,\n });\n }\n\n /**\n * Validate the value is a list of models\n */\n public models(model: ChildModel<any> | string, errorMessage?: string): EmbedModelValidator {\n const instance = this.instance;\n instance.addMutator(databaseModelsMutator, {\n model,\n });\n\n instance.addMutableRule(arrayRule);\n instance.addMutableRule(databaseModelsRule, errorMessage, {\n model,\n });\n\n return instance;\n }\n\n /**\n * Determine how the data will be stored as an embedded document\n */\n public embed(embed?: string | string[]): EmbedModelValidator {\n return this.addTransformer(databaseModelTransformer, {\n embed,\n });\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,sBAAb,cAAyC,cAAc;;;;CAIrD,AAAO,YAAY,OAAqB;EACtC,OACE,iBAAiB,SACjB,OAAO,UAAU,YAChB,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAO,SAAS,gBAAgB,KAAK;CAExE;;;;CAKA,AAAO,MAAM,OAAiC,cAA4C;EACxF,KAAK,WAAW,sBAAsB,EACpC,MACF,CAAC;EAED,OAAO,KAAK,QAAQ,mBAAmB,cAAc,EACnD,MACF,CAAC;CACH;;;;CAKA,AAAO,OAAO,OAAiC,cAA4C;EACzF,MAAM,WAAW,KAAK;EACtB,SAAS,WAAW,uBAAuB,EACzC,MACF,CAAC;EAED,SAAS,eAAe,SAAS;EACjC,SAAS,eAAe,oBAAoB,cAAc,EACxD,MACF,CAAC;EAED,OAAO;CACT;;;;CAKA,AAAO,MAAM,OAAgD;EAC3D,OAAO,KAAK,eAAe,0BAA0B,EACnD,MACF,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { Model } from "../model/model.mjs";
|
|
2
|
+
import { WriterContract, WriterOptions, WriterResult } from "../contracts/database-writer.contract.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../@warlock.js/cascade/src/writer/database-writer.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Database writer service that orchestrates model persistence.
|
|
7
|
+
*
|
|
8
|
+
* Handles the complete save pipeline:
|
|
9
|
+
* 1. Check for changes (skip if no changes and not new)
|
|
10
|
+
* 2. Emit `saving` event (for data enrichment)
|
|
11
|
+
* 3. Emit `validating` event
|
|
12
|
+
* 4. Validate and cast data via @warlock.js/seal schema
|
|
13
|
+
* 5. Emit `validated` event
|
|
14
|
+
* 6. Generate ID (for new NoSQL records)
|
|
15
|
+
* 7. Emit `creating`/`updating` events
|
|
16
|
+
* 8. Execute insert or update via driver
|
|
17
|
+
* 9. Merge returned data into model
|
|
18
|
+
* 10. Reset dirty tracker and update `isNew` flag
|
|
19
|
+
* 11. Emit `saved` and `created`/`updated` events
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const user = new User({ name: "Alice", email: "alice@example.com" });
|
|
24
|
+
* const writer = new DatabaseWriter(user);
|
|
25
|
+
* await writer.save();
|
|
26
|
+
*
|
|
27
|
+
* console.log(user.get("id")); // 1 (auto-generated)
|
|
28
|
+
* console.log(user.get("_id")); // ObjectId("...")
|
|
29
|
+
*
|
|
30
|
+
* // Update existing record
|
|
31
|
+
* user.set("name", "Alice Smith");
|
|
32
|
+
* await writer.save();
|
|
33
|
+
* // Only updates the "name" field (partial update)
|
|
34
|
+
*
|
|
35
|
+
* // Silent save (no events)
|
|
36
|
+
* await writer.save({ skipEvents: true });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare class DatabaseWriter implements WriterContract {
|
|
40
|
+
/** The model instance being persisted */
|
|
41
|
+
private readonly model;
|
|
42
|
+
/** Model constructor reference */
|
|
43
|
+
private readonly ctor;
|
|
44
|
+
/** Data source containing driver and ID generator */
|
|
45
|
+
private readonly dataSource;
|
|
46
|
+
/** Database driver for executing queries */
|
|
47
|
+
private readonly driver;
|
|
48
|
+
/** Table/collection name */
|
|
49
|
+
private readonly table;
|
|
50
|
+
/** Primary key field name */
|
|
51
|
+
private readonly primaryKey;
|
|
52
|
+
/** Validation schema (if defined) */
|
|
53
|
+
private readonly schema?;
|
|
54
|
+
/** Strict mode configuration */
|
|
55
|
+
private readonly strictMode;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new writer instance for a model.
|
|
58
|
+
*
|
|
59
|
+
* @param model - The model instance to persist
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const user = new User({ name: "Alice" });
|
|
64
|
+
* const writer = new DatabaseWriter(user);
|
|
65
|
+
* await writer.save();
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
constructor(model: Model);
|
|
69
|
+
/**
|
|
70
|
+
* Save the model instance to the database.
|
|
71
|
+
*
|
|
72
|
+
* @param options - Save options
|
|
73
|
+
* @returns Result with success status, document, and metadata
|
|
74
|
+
* @throws {ValidationError} If validation fails
|
|
75
|
+
*/
|
|
76
|
+
save(options?: WriterOptions): Promise<WriterResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Validate and cast model data using the schema.
|
|
79
|
+
*
|
|
80
|
+
* Updates the model's data in-place with validated/casted values.
|
|
81
|
+
*
|
|
82
|
+
* @param isInsert - Whether this is an insert operation
|
|
83
|
+
* @param options - Save options
|
|
84
|
+
* @throws {ValidationError} If validation fails
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private validateAndCast;
|
|
88
|
+
/**
|
|
89
|
+
* Perform an insert operation.
|
|
90
|
+
*
|
|
91
|
+
* @param options - Save options
|
|
92
|
+
* @returns Insert result
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
private performInsert;
|
|
96
|
+
/**
|
|
97
|
+
* Perform an update operation.
|
|
98
|
+
*
|
|
99
|
+
* @param options - Save options
|
|
100
|
+
* @returns Update result
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
private performUpdate;
|
|
104
|
+
/**
|
|
105
|
+
* Generate ID for the model if auto-generation is enabled.
|
|
106
|
+
*
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
generateNextId(): Promise<void>;
|
|
110
|
+
/**
|
|
111
|
+
* Build update operations from the model's dirty tracker.
|
|
112
|
+
*
|
|
113
|
+
* Handles both modified fields ($set) and removed fields ($unset).
|
|
114
|
+
*
|
|
115
|
+
* @returns Update operations for the driver
|
|
116
|
+
* @private
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // Model with changes
|
|
121
|
+
* user.set("name", "Alice");
|
|
122
|
+
* user.unset("tempField");
|
|
123
|
+
*
|
|
124
|
+
* const operations = this.buildUpdateOperations();
|
|
125
|
+
* // {
|
|
126
|
+
* // $set: { name: "Alice" },
|
|
127
|
+
* // $unset: { tempField: 1 }
|
|
128
|
+
* // }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
private buildUpdateOperations;
|
|
132
|
+
/**
|
|
133
|
+
* Resolve the initial ID from model configuration.
|
|
134
|
+
*
|
|
135
|
+
* Priority:
|
|
136
|
+
* 1. Model.initialId (explicit value)
|
|
137
|
+
* 2. Model.randomInitialId (random or function)
|
|
138
|
+
* 3. Default: 1
|
|
139
|
+
*
|
|
140
|
+
* @returns The initial ID value
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
private resolveInitialId;
|
|
144
|
+
/**
|
|
145
|
+
* Resolve the increment value from model configuration.
|
|
146
|
+
*
|
|
147
|
+
* Priority:
|
|
148
|
+
* 1. Model.incrementIdBy (explicit value)
|
|
149
|
+
* 2. Model.randomIncrement (random or function)
|
|
150
|
+
* 3. Default: 1
|
|
151
|
+
*
|
|
152
|
+
* @returns The increment value
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
private resolveIncrementBy;
|
|
156
|
+
/**
|
|
157
|
+
* Generate a random integer between min and max (inclusive).
|
|
158
|
+
*
|
|
159
|
+
* @param min - Minimum value
|
|
160
|
+
* @param max - Maximum value
|
|
161
|
+
* @returns Random integer
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
private randomInt;
|
|
165
|
+
/**
|
|
166
|
+
* Trigger sync operations after successful save.
|
|
167
|
+
*
|
|
168
|
+
* Emits a model.updated event that ModelSyncOperation listens to.
|
|
169
|
+
* The sync is handled by registered sync operations, not directly here.
|
|
170
|
+
*
|
|
171
|
+
* @param changedFields - Fields that were changed (for filtering)
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
private triggerSync;
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
export { DatabaseWriter };
|
|
178
|
+
//# sourceMappingURL=database-writer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database-writer.d.mts","names":[],"sources":["../../../../../../@warlock.js/cascade/src/writer/database-writer.ts"],"mappings":";;;;;;AAqDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa,cAAA,YAA0B,cAAA;EA0U7B;EAAA,iBAxUS,KAAA;EAwYT;EAAA,iBArYS,IAAA;EAwaH;EAAA,iBAraG,UAAA;EAqaQ;EAAA,iBAlaR,MAAA;;mBAGA,KAAA;;mBAGA,UAAA;;mBAGA,MAAA;;mBAGA,UAAA;;;;;;;;;;;;;cAcE,KAAA,EAAO,KAAA;;;;;;;;EAkBb,IAAA,CAAK,OAAA,GAAS,aAAA,GAAqB,OAAA,CAAQ,YAAA;;;;;;;;;;;UAoE1C,eAAA;;;;;;;;UAuEA,aAAA;;;;;;;;UAgDA,aAAA;;;;;;EA2CD,cAAA,CAAA,GAAkB,OAAA;;;;;;;;;;;;;;;;;;;;;;UA6CvB,qBAAA;;;;;;;;;;;;UAuCA,gBAAA;;;;;;;;;;;;UAyBA,kBAAA;;;;;;;;;UAsBA,SAAA;;;;;;;;;;UAaM,WAAA;AAAA"}
|