@warlock.js/cascade 4.8.2 → 4.9.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/CHANGELOG.md +13 -0
- package/cjs/index.cjs +172 -127
- package/cjs/index.cjs.map +1 -1
- package/esm/context/database-data-source-context.d.mts +1 -1
- package/esm/context/database-data-source-context.d.mts.map +1 -1
- package/esm/context/database-data-source-context.mjs +1 -1
- package/esm/context/database-data-source-context.mjs.map +1 -1
- package/esm/context/database-transaction-context.d.mts +1 -1
- package/esm/context/database-transaction-context.d.mts.map +1 -1
- package/esm/context/database-transaction-context.mjs +1 -1
- package/esm/context/database-transaction-context.mjs.map +1 -1
- package/esm/contracts/database-driver.contract.d.mts +1 -1
- package/esm/contracts/database-driver.contract.d.mts.map +1 -1
- package/esm/contracts/database-id-generator.contract.d.mts +1 -1
- package/esm/contracts/database-id-generator.contract.d.mts.map +1 -1
- package/esm/contracts/database-remover.contract.d.mts +1 -1
- package/esm/contracts/database-remover.contract.d.mts.map +1 -1
- package/esm/contracts/database-restorer.contract.d.mts +1 -1
- package/esm/contracts/database-restorer.contract.d.mts.map +1 -1
- package/esm/contracts/database-writer.contract.d.mts +1 -1
- package/esm/contracts/database-writer.contract.d.mts.map +1 -1
- package/esm/contracts/driver-blueprint.contract.d.mts +1 -1
- package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -1
- package/esm/contracts/migration-driver.contract.d.mts +1 -1
- package/esm/contracts/migration-driver.contract.d.mts.map +1 -1
- package/esm/contracts/query-builder.contract.d.mts +1 -1
- package/esm/contracts/query-builder.contract.d.mts.map +1 -1
- package/esm/contracts/sync-adapter.contract.d.mts +1 -1
- package/esm/contracts/sync-adapter.contract.d.mts.map +1 -1
- package/esm/data-source/data-source-registry.d.mts +1 -1
- package/esm/data-source/data-source-registry.d.mts.map +1 -1
- package/esm/data-source/data-source-registry.mjs +1 -1
- package/esm/data-source/data-source-registry.mjs.map +1 -1
- package/esm/data-source/data-source.d.mts +1 -1
- package/esm/data-source/data-source.d.mts.map +1 -1
- package/esm/data-source/data-source.mjs +1 -1
- package/esm/data-source/data-source.mjs.map +1 -1
- package/esm/database-dirty-tracker.d.mts +12 -3
- package/esm/database-dirty-tracker.d.mts.map +1 -1
- package/esm/database-dirty-tracker.mjs +13 -4
- package/esm/database-dirty-tracker.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-blueprint.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-blueprint.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-driver.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-driver.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-id-generator.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-builder.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-operations.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-query-parser.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +1 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs +1 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs.map +1 -1
- package/esm/drivers/mongodb/types.d.mts +1 -1
- package/esm/drivers/mongodb/types.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-blueprint.d.mts +1 -1
- package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-blueprint.mjs +1 -1
- package/esm/drivers/postgres/postgres-blueprint.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-dialect.d.mts +1 -1
- package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-dialect.mjs +1 -1
- package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-driver.d.mts +1 -1
- package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-driver.mjs +1 -1
- package/esm/drivers/postgres/postgres-driver.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.mts +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.mjs +1 -1
- package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-query-builder.d.mts +1 -1
- package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-query-builder.mjs +1 -1
- package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-query-parser.d.mts +1 -1
- package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-query-parser.mjs +1 -1
- package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-sql-serializer.mjs +1 -1
- package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -1
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts +1 -1
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts.map +1 -1
- package/esm/drivers/postgres/postgres-sync-adapter.mjs +1 -1
- package/esm/drivers/postgres/postgres-sync-adapter.mjs.map +1 -1
- package/esm/drivers/postgres/types.d.mts +1 -1
- package/esm/drivers/postgres/types.d.mts.map +1 -1
- package/esm/drivers/sql/sql-dialect.contract.d.mts +1 -1
- package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -1
- package/esm/drivers/sql/sql-types.d.mts +1 -1
- package/esm/drivers/sql/sql-types.d.mts.map +1 -1
- package/esm/errors/missing-data-source.error.d.mts +1 -1
- package/esm/errors/missing-data-source.error.d.mts.map +1 -1
- package/esm/errors/missing-data-source.error.mjs +1 -1
- package/esm/errors/missing-data-source.error.mjs.map +1 -1
- package/esm/errors/transaction-rollback.error.d.mts +1 -1
- package/esm/errors/transaction-rollback.error.d.mts.map +1 -1
- package/esm/errors/transaction-rollback.error.mjs +1 -1
- package/esm/errors/transaction-rollback.error.mjs.map +1 -1
- package/esm/events/model-events.d.mts +1 -1
- package/esm/events/model-events.d.mts.map +1 -1
- package/esm/events/model-events.mjs +1 -1
- package/esm/events/model-events.mjs.map +1 -1
- package/esm/expressions/aggregate-expressions.d.mts +1 -1
- package/esm/expressions/aggregate-expressions.d.mts.map +1 -1
- package/esm/expressions/aggregate-expressions.mjs +1 -1
- package/esm/expressions/aggregate-expressions.mjs.map +1 -1
- package/esm/expressions/column-expressions.d.mts +1 -1
- package/esm/expressions/column-expressions.d.mts.map +1 -1
- package/esm/expressions/column-expressions.mjs +1 -1
- package/esm/expressions/column-expressions.mjs.map +1 -1
- package/esm/migration/column-builder.d.mts +1 -1
- package/esm/migration/column-builder.d.mts.map +1 -1
- package/esm/migration/column-builder.mjs +1 -1
- package/esm/migration/column-builder.mjs.map +1 -1
- package/esm/migration/column-helpers.d.mts +1 -1
- package/esm/migration/column-helpers.d.mts.map +1 -1
- package/esm/migration/column-helpers.mjs +1 -1
- package/esm/migration/column-helpers.mjs.map +1 -1
- package/esm/migration/foreign-key-builder.d.mts +1 -1
- package/esm/migration/foreign-key-builder.d.mts.map +1 -1
- package/esm/migration/foreign-key-builder.mjs +1 -1
- package/esm/migration/foreign-key-builder.mjs.map +1 -1
- package/esm/migration/migration-runner.d.mts +1 -1
- package/esm/migration/migration-runner.d.mts.map +1 -1
- package/esm/migration/migration-runner.mjs +4 -40
- package/esm/migration/migration-runner.mjs.map +1 -1
- package/esm/migration/migration.d.mts +1 -1
- package/esm/migration/migration.d.mts.map +1 -1
- package/esm/migration/migration.mjs +1 -1
- package/esm/migration/migration.mjs.map +1 -1
- package/esm/migration/parse-created-at.mjs +67 -0
- package/esm/migration/parse-created-at.mjs.map +1 -0
- package/esm/migration/sql-grammar.mjs +16 -6
- package/esm/migration/sql-grammar.mjs.map +1 -1
- package/esm/migration/sql-serializer.d.mts +1 -1
- package/esm/migration/sql-serializer.d.mts.map +1 -1
- package/esm/migration/sql-serializer.mjs +1 -1
- package/esm/migration/sql-serializer.mjs.map +1 -1
- package/esm/migration/types.d.mts +1 -1
- package/esm/migration/types.d.mts.map +1 -1
- package/esm/model/methods/accessor-methods.mjs +1 -1
- package/esm/model/methods/accessor-methods.mjs.map +1 -1
- package/esm/model/methods/delete-methods.mjs +1 -1
- package/esm/model/methods/delete-methods.mjs.map +1 -1
- package/esm/model/methods/dirty-methods.mjs +1 -1
- package/esm/model/methods/dirty-methods.mjs.map +1 -1
- package/esm/model/methods/hydration-methods.mjs +1 -1
- package/esm/model/methods/hydration-methods.mjs.map +1 -1
- package/esm/model/methods/instance-event-methods.mjs +1 -1
- package/esm/model/methods/instance-event-methods.mjs.map +1 -1
- package/esm/model/methods/meta-methods.mjs +1 -1
- package/esm/model/methods/meta-methods.mjs.map +1 -1
- package/esm/model/methods/pivot-methods.mjs +1 -1
- package/esm/model/methods/pivot-methods.mjs.map +1 -1
- package/esm/model/methods/query-methods.mjs +1 -1
- package/esm/model/methods/query-methods.mjs.map +1 -1
- package/esm/model/methods/restore-methods.mjs +1 -1
- package/esm/model/methods/restore-methods.mjs.map +1 -1
- package/esm/model/methods/scope-methods.mjs +1 -1
- package/esm/model/methods/scope-methods.mjs.map +1 -1
- package/esm/model/methods/serialization-methods.mjs +1 -1
- package/esm/model/methods/serialization-methods.mjs.map +1 -1
- package/esm/model/methods/static-event-methods.mjs +1 -1
- package/esm/model/methods/static-event-methods.mjs.map +1 -1
- package/esm/model/methods/write-methods.d.mts +1 -1
- package/esm/model/methods/write-methods.d.mts.map +1 -1
- package/esm/model/methods/write-methods.mjs +1 -1
- package/esm/model/methods/write-methods.mjs.map +1 -1
- package/esm/model/model.d.mts +1 -1
- package/esm/model/model.d.mts.map +1 -1
- package/esm/model/model.mjs +1 -1
- package/esm/model/model.mjs.map +1 -1
- package/esm/model/model.types.d.mts +1 -1
- package/esm/model/model.types.d.mts.map +1 -1
- package/esm/model/register-model.d.mts +1 -1
- package/esm/model/register-model.d.mts.map +1 -1
- package/esm/model/register-model.mjs +1 -1
- package/esm/model/register-model.mjs.map +1 -1
- package/esm/model/relation-decorators.d.mts +1 -1
- package/esm/model/relation-decorators.d.mts.map +1 -1
- package/esm/model/relation-decorators.mjs +1 -1
- package/esm/model/relation-decorators.mjs.map +1 -1
- package/esm/operations/database.d.mts +1 -1
- package/esm/operations/database.d.mts.map +1 -1
- package/esm/operations/database.mjs +1 -1
- package/esm/operations/database.mjs.map +1 -1
- package/esm/operations/migrations.d.mts +1 -1
- package/esm/operations/migrations.d.mts.map +1 -1
- package/esm/operations/migrations.mjs +1 -1
- package/esm/operations/migrations.mjs.map +1 -1
- package/esm/query-builder/query-builder.d.mts +1 -1
- package/esm/query-builder/query-builder.d.mts.map +1 -1
- package/esm/query-builder/query-builder.mjs +1 -1
- package/esm/query-builder/query-builder.mjs.map +1 -1
- package/esm/relations/key-conventions.mjs +1 -1
- package/esm/relations/key-conventions.mjs.map +1 -1
- package/esm/relations/pivot-operations.d.mts +1 -1
- package/esm/relations/pivot-operations.d.mts.map +1 -1
- package/esm/relations/pivot-operations.mjs +1 -1
- package/esm/relations/pivot-operations.mjs.map +1 -1
- package/esm/relations/relation-hydrator.d.mts +1 -1
- package/esm/relations/relation-hydrator.d.mts.map +1 -1
- package/esm/relations/relation-hydrator.mjs +1 -1
- package/esm/relations/relation-hydrator.mjs.map +1 -1
- package/esm/relations/relation-loader.d.mts +1 -1
- package/esm/relations/relation-loader.d.mts.map +1 -1
- package/esm/relations/relation-loader.mjs +1 -1
- package/esm/relations/relation-loader.mjs.map +1 -1
- package/esm/relations/types.d.mts +1 -1
- package/esm/relations/types.d.mts.map +1 -1
- package/esm/remover/database-remover.d.mts +1 -1
- package/esm/remover/database-remover.d.mts.map +1 -1
- package/esm/remover/database-remover.mjs +1 -1
- package/esm/remover/database-remover.mjs.map +1 -1
- package/esm/restorer/database-restorer.d.mts +1 -1
- package/esm/restorer/database-restorer.d.mts.map +1 -1
- package/esm/restorer/database-restorer.mjs +1 -1
- package/esm/restorer/database-restorer.mjs.map +1 -1
- package/esm/sql-database-dirty-tracker.d.mts +1 -1
- package/esm/sql-database-dirty-tracker.d.mts.map +1 -1
- package/esm/sql-database-dirty-tracker.mjs +1 -1
- package/esm/sql-database-dirty-tracker.mjs.map +1 -1
- package/esm/sync/model-events.mjs +1 -1
- package/esm/sync/model-events.mjs.map +1 -1
- package/esm/sync/model-sync-operation.d.mts +1 -1
- package/esm/sync/model-sync-operation.d.mts.map +1 -1
- package/esm/sync/model-sync-operation.mjs +1 -1
- package/esm/sync/model-sync-operation.mjs.map +1 -1
- package/esm/sync/model-sync.d.mts +1 -1
- package/esm/sync/model-sync.d.mts.map +1 -1
- package/esm/sync/model-sync.mjs +1 -1
- package/esm/sync/model-sync.mjs.map +1 -1
- package/esm/sync/sync-context.d.mts +1 -1
- package/esm/sync/sync-context.d.mts.map +1 -1
- package/esm/sync/sync-context.mjs +1 -1
- package/esm/sync/sync-context.mjs.map +1 -1
- package/esm/sync/sync-manager.d.mts +1 -1
- package/esm/sync/sync-manager.d.mts.map +1 -1
- package/esm/sync/sync-manager.mjs +1 -1
- package/esm/sync/sync-manager.mjs.map +1 -1
- package/esm/sync/types.d.mts +1 -1
- package/esm/sync/types.d.mts.map +1 -1
- package/esm/types.d.mts +1 -1
- package/esm/types.d.mts.map +1 -1
- package/esm/utils/connect-to-database.d.mts +1 -1
- package/esm/utils/connect-to-database.d.mts.map +1 -1
- package/esm/utils/connect-to-database.mjs +1 -1
- package/esm/utils/connect-to-database.mjs.map +1 -1
- package/esm/utils/database-writer.utils.d.mts +1 -1
- package/esm/utils/database-writer.utils.d.mts.map +1 -1
- package/esm/utils/database-writer.utils.mjs +1 -1
- package/esm/utils/database-writer.utils.mjs.map +1 -1
- package/esm/utils/define-model.d.mts +1 -1
- package/esm/utils/define-model.d.mts.map +1 -1
- package/esm/utils/define-model.mjs +1 -1
- package/esm/utils/define-model.mjs.map +1 -1
- package/esm/utils/is-valid-date-value.mjs +1 -1
- package/esm/utils/is-valid-date-value.mjs.map +1 -1
- package/esm/utils/once-connected.d.mts +1 -1
- package/esm/utils/once-connected.d.mts.map +1 -1
- package/esm/utils/once-connected.mjs +1 -1
- package/esm/utils/once-connected.mjs.map +1 -1
- package/esm/validation/database-seal-plugins.mjs +1 -1
- package/esm/validation/database-seal-plugins.mjs.map +1 -1
- package/esm/validation/database-writer-validation-error.d.mts +1 -1
- package/esm/validation/database-writer-validation-error.d.mts.map +1 -1
- package/esm/validation/database-writer-validation-error.mjs +1 -1
- package/esm/validation/database-writer-validation-error.mjs.map +1 -1
- package/esm/validation/mutators/embed-mutator.mjs +1 -1
- package/esm/validation/mutators/embed-mutator.mjs.map +1 -1
- package/esm/validation/plugins/database-rules-plugin.d.mts +1 -1
- package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -1
- package/esm/validation/plugins/database-rules-plugin.mjs +1 -1
- package/esm/validation/plugins/database-rules-plugin.mjs.map +1 -1
- package/esm/validation/plugins/embed-validator-plugin.d.mts +1 -1
- package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -1
- package/esm/validation/plugins/embed-validator-plugin.mjs +1 -1
- package/esm/validation/plugins/embed-validator-plugin.mjs.map +1 -1
- package/esm/validation/rules/database-model-rule.mjs +1 -1
- package/esm/validation/rules/database-model-rule.mjs.map +1 -1
- package/esm/validation/rules/exists-rule.mjs +1 -1
- package/esm/validation/rules/exists-rule.mjs.map +1 -1
- package/esm/validation/rules/unique-rule.mjs +1 -1
- package/esm/validation/rules/unique-rule.mjs.map +1 -1
- package/esm/validation/transformers/embed-model-transformer.mjs +1 -1
- package/esm/validation/transformers/embed-model-transformer.mjs.map +1 -1
- package/esm/validation/types.d.mts +1 -1
- package/esm/validation/types.d.mts.map +1 -1
- package/esm/validation/validators/embed-validator.d.mts +1 -1
- package/esm/validation/validators/embed-validator.d.mts.map +1 -1
- package/esm/validation/validators/embed-validator.mjs +1 -1
- package/esm/validation/validators/embed-validator.mjs.map +1 -1
- package/esm/writer/database-writer.d.mts +1 -1
- package/esm/writer/database-writer.d.mts.map +1 -1
- package/esm/writer/database-writer.mjs +1 -1
- package/esm/writer/database-writer.mjs.map +1 -1
- package/llms-full.txt +32 -0
- package/package.json +4 -4
- package/skills/track-changes/SKILL.md +18 -0
- package/skills/write-migration/SKILL.md +14 -0
package/cjs/index.cjs
CHANGED
|
@@ -40,7 +40,7 @@ fs = __toESM(fs, 1);
|
|
|
40
40
|
let path = require("path");
|
|
41
41
|
path = __toESM(path, 1);
|
|
42
42
|
|
|
43
|
-
//#region
|
|
43
|
+
//#region ../cascade/src/context/database-data-source-context.ts
|
|
44
44
|
/**
|
|
45
45
|
* Database DataSource Context
|
|
46
46
|
*
|
|
@@ -71,7 +71,7 @@ const databaseDataSourceContext = new DatabaseDataSourceContext();
|
|
|
71
71
|
_warlock_js_context.contextManager.register("db.datasource", databaseDataSourceContext);
|
|
72
72
|
|
|
73
73
|
//#endregion
|
|
74
|
-
//#region
|
|
74
|
+
//#region ../cascade/src/context/database-transaction-context.ts
|
|
75
75
|
/**
|
|
76
76
|
* Database Transaction Context
|
|
77
77
|
*
|
|
@@ -114,7 +114,7 @@ const databaseTransactionContext = new DatabaseTransactionContext();
|
|
|
114
114
|
_warlock_js_context.contextManager.register("db.transaction", databaseTransactionContext);
|
|
115
115
|
|
|
116
116
|
//#endregion
|
|
117
|
-
//#region
|
|
117
|
+
//#region ../cascade/src/data-source/data-source.ts
|
|
118
118
|
/**
|
|
119
119
|
* Wrapper that couples a driver with its metadata.
|
|
120
120
|
*
|
|
@@ -221,7 +221,7 @@ var DataSource = class {
|
|
|
221
221
|
};
|
|
222
222
|
|
|
223
223
|
//#endregion
|
|
224
|
-
//#region
|
|
224
|
+
//#region ../cascade/src/errors/missing-data-source.error.ts
|
|
225
225
|
/**
|
|
226
226
|
* Error thrown when a requested data source is not found in the registry.
|
|
227
227
|
*
|
|
@@ -250,7 +250,7 @@ var MissingDataSourceError = class MissingDataSourceError extends Error {
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
//#endregion
|
|
253
|
-
//#region
|
|
253
|
+
//#region ../cascade/src/data-source/data-source-registry.ts
|
|
254
254
|
/** Maintains registry of named data sources. */
|
|
255
255
|
var DataSourceRegistry = class {
|
|
256
256
|
sources = /* @__PURE__ */ new Map();
|
|
@@ -385,7 +385,7 @@ var DataSourceRegistry = class {
|
|
|
385
385
|
const dataSourceRegistry = new DataSourceRegistry();
|
|
386
386
|
|
|
387
387
|
//#endregion
|
|
388
|
-
//#region
|
|
388
|
+
//#region ../cascade/src/errors/transaction-rollback.error.ts
|
|
389
389
|
/**
|
|
390
390
|
* Error thrown when a transaction is explicitly rolled back via ctx.rollback().
|
|
391
391
|
*
|
|
@@ -412,7 +412,7 @@ var TransactionRollbackError = class TransactionRollbackError extends Error {
|
|
|
412
412
|
};
|
|
413
413
|
|
|
414
414
|
//#endregion
|
|
415
|
-
//#region
|
|
415
|
+
//#region ../cascade/src/database-dirty-tracker.ts
|
|
416
416
|
function canBeFlatten(object) {
|
|
417
417
|
return (0, _mongez_supportive_is.isPlainObject)(object);
|
|
418
418
|
}
|
|
@@ -691,8 +691,17 @@ var DatabaseDirtyTracker = class {
|
|
|
691
691
|
/**
|
|
692
692
|
* Recursively merges source object into target object, performing a deep merge.
|
|
693
693
|
*
|
|
694
|
-
*
|
|
695
|
-
*
|
|
694
|
+
* Only **plain** objects are merged recursively. Everything else — arrays,
|
|
695
|
+
* primitives, and class instances such as `Date` / `Map` / `Set` / `RegExp` —
|
|
696
|
+
* replaces the target value. All values are cloned to prevent reference sharing.
|
|
697
|
+
*
|
|
698
|
+
* The plain-object guard is load-bearing, not tidiness. A bare
|
|
699
|
+
* `typeof value === "object"` also matches a `Date`, and `Object.entries(date)`
|
|
700
|
+
* is `[]` — so merging a `Date` over a column that already held a `Date`
|
|
701
|
+
* recursed into it, copied nothing, and left the old value in the snapshot.
|
|
702
|
+
* The column then never went dirty and `save()` returned
|
|
703
|
+
* `{ success: true, modifiedCount: 0 }` without issuing an `UPDATE`. This is
|
|
704
|
+
* the same lesson `canBeFlatten` above already encodes.
|
|
696
705
|
*
|
|
697
706
|
* @param target - The object to merge into
|
|
698
707
|
* @param source - The object to merge from
|
|
@@ -700,7 +709,7 @@ var DatabaseDirtyTracker = class {
|
|
|
700
709
|
*/
|
|
701
710
|
mergeIntoRaw(target, source) {
|
|
702
711
|
for (const [key, value] of Object.entries(source)) {
|
|
703
|
-
if (
|
|
712
|
+
if ((0, _mongez_supportive_is.isPlainObject)(value) && (0, _mongez_supportive_is.isPlainObject)(target[key])) {
|
|
704
713
|
this.mergeIntoRaw(target[key], value);
|
|
705
714
|
continue;
|
|
706
715
|
}
|
|
@@ -763,7 +772,7 @@ var DatabaseDirtyTracker = class {
|
|
|
763
772
|
};
|
|
764
773
|
|
|
765
774
|
//#endregion
|
|
766
|
-
//#region
|
|
775
|
+
//#region ../cascade/src/events/model-events.ts
|
|
767
776
|
/**
|
|
768
777
|
* Light-weight async event emitter used to power model lifecycle hooks.
|
|
769
778
|
*
|
|
@@ -1015,7 +1024,7 @@ var ModelEvents = class {
|
|
|
1015
1024
|
const globalModelEvents = new ModelEvents();
|
|
1016
1025
|
|
|
1017
1026
|
//#endregion
|
|
1018
|
-
//#region
|
|
1027
|
+
//#region ../cascade/src/model/relation-decorators.ts
|
|
1019
1028
|
/**
|
|
1020
1029
|
* @fileoverview TC39 Stage 3 class field decorators for declaring model
|
|
1021
1030
|
* relations directly on the field.
|
|
@@ -1202,7 +1211,7 @@ const HasMany = makeRelationDecorator("hasMany");
|
|
|
1202
1211
|
const BelongsToMany = makeRelationDecorator("belongsToMany");
|
|
1203
1212
|
|
|
1204
1213
|
//#endregion
|
|
1205
|
-
//#region
|
|
1214
|
+
//#region ../cascade/src/model/register-model.ts
|
|
1206
1215
|
/**
|
|
1207
1216
|
* Global model registry that maps model class names to their constructors.
|
|
1208
1217
|
* This allows for string-based model references to avoid circular dependencies.
|
|
@@ -1372,7 +1381,7 @@ function verifyRegisteredRelations() {
|
|
|
1372
1381
|
}
|
|
1373
1382
|
|
|
1374
1383
|
//#endregion
|
|
1375
|
-
//#region
|
|
1384
|
+
//#region ../cascade/src/relations/key-conventions.ts
|
|
1376
1385
|
/**
|
|
1377
1386
|
* @fileoverview Foreign-key naming conventions for relation defaults.
|
|
1378
1387
|
*
|
|
@@ -1487,7 +1496,7 @@ function inferPivotTable(selfModelName, relatedModelName, options) {
|
|
|
1487
1496
|
}
|
|
1488
1497
|
|
|
1489
1498
|
//#endregion
|
|
1490
|
-
//#region
|
|
1499
|
+
//#region ../cascade/src/relations/relation-loader.ts
|
|
1491
1500
|
/**
|
|
1492
1501
|
* @fileoverview Core relation loading logic for the Cascade ORM.
|
|
1493
1502
|
*
|
|
@@ -1897,7 +1906,7 @@ var RelationLoader = class RelationLoader {
|
|
|
1897
1906
|
};
|
|
1898
1907
|
|
|
1899
1908
|
//#endregion
|
|
1900
|
-
//#region
|
|
1909
|
+
//#region ../cascade/src/sync/model-events.ts
|
|
1901
1910
|
/**
|
|
1902
1911
|
* Event name prefix for all model sync events.
|
|
1903
1912
|
*/
|
|
@@ -1941,7 +1950,7 @@ function getModelDeletedEvent(modelClass) {
|
|
|
1941
1950
|
}
|
|
1942
1951
|
|
|
1943
1952
|
//#endregion
|
|
1944
|
-
//#region
|
|
1953
|
+
//#region ../cascade/src/sync/sync-context.ts
|
|
1945
1954
|
/**
|
|
1946
1955
|
* Default maximum sync depth.
|
|
1947
1956
|
* Prevents infinite sync chains.
|
|
@@ -2034,7 +2043,7 @@ var SyncContextManager = class {
|
|
|
2034
2043
|
};
|
|
2035
2044
|
|
|
2036
2045
|
//#endregion
|
|
2037
|
-
//#region
|
|
2046
|
+
//#region ../cascade/src/sync/sync-manager.ts
|
|
2038
2047
|
/**
|
|
2039
2048
|
* Manages sync operations across models with multi-level support.
|
|
2040
2049
|
*/
|
|
@@ -2626,7 +2635,7 @@ var SyncManager = class {
|
|
|
2626
2635
|
};
|
|
2627
2636
|
|
|
2628
2637
|
//#endregion
|
|
2629
|
-
//#region
|
|
2638
|
+
//#region ../cascade/src/sync/model-sync-operation.ts
|
|
2630
2639
|
/**
|
|
2631
2640
|
* Model sync operation class.
|
|
2632
2641
|
*
|
|
@@ -2876,7 +2885,7 @@ var ModelSyncOperation = class {
|
|
|
2876
2885
|
};
|
|
2877
2886
|
|
|
2878
2887
|
//#endregion
|
|
2879
|
-
//#region
|
|
2888
|
+
//#region ../cascade/src/sync/model-sync.ts
|
|
2880
2889
|
/**
|
|
2881
2890
|
* ModelSync facade implementation.
|
|
2882
2891
|
*
|
|
@@ -3029,7 +3038,7 @@ var ModelSyncFacade = class {
|
|
|
3029
3038
|
const modelSync = new ModelSyncFacade();
|
|
3030
3039
|
|
|
3031
3040
|
//#endregion
|
|
3032
|
-
//#region
|
|
3041
|
+
//#region ../cascade/src/model/methods/accessor-methods.ts
|
|
3033
3042
|
/**
|
|
3034
3043
|
* Sentinel symbol to distinguish a genuinely missing field from a field
|
|
3035
3044
|
* whose value is `undefined`. Encapsulated here — callers use `hasField()`.
|
|
@@ -3079,7 +3088,7 @@ function getBooleanField(model, key, defaultValue) {
|
|
|
3079
3088
|
}
|
|
3080
3089
|
|
|
3081
3090
|
//#endregion
|
|
3082
|
-
//#region
|
|
3091
|
+
//#region ../cascade/src/remover/database-remover.ts
|
|
3083
3092
|
/**
|
|
3084
3093
|
* Database remover service that orchestrates model deletion.
|
|
3085
3094
|
*
|
|
@@ -3250,7 +3259,7 @@ var DatabaseRemover = class {
|
|
|
3250
3259
|
};
|
|
3251
3260
|
|
|
3252
3261
|
//#endregion
|
|
3253
|
-
//#region
|
|
3262
|
+
//#region ../cascade/src/model/methods/delete-methods.ts
|
|
3254
3263
|
async function destroyModel(model, options) {
|
|
3255
3264
|
return new DatabaseRemover(model).destroy(options);
|
|
3256
3265
|
}
|
|
@@ -3262,7 +3271,7 @@ async function deleteOneRecord(ModelClass, filter) {
|
|
|
3262
3271
|
}
|
|
3263
3272
|
|
|
3264
3273
|
//#endregion
|
|
3265
|
-
//#region
|
|
3274
|
+
//#region ../cascade/src/model/methods/dirty-methods.ts
|
|
3266
3275
|
function checkHasChanges(model) {
|
|
3267
3276
|
return model.dirtyTracker.hasChanges();
|
|
3268
3277
|
}
|
|
@@ -3280,7 +3289,7 @@ function getDirtyColumns(model) {
|
|
|
3280
3289
|
}
|
|
3281
3290
|
|
|
3282
3291
|
//#endregion
|
|
3283
|
-
//#region
|
|
3292
|
+
//#region ../cascade/src/relations/relation-hydrator.ts
|
|
3284
3293
|
/**
|
|
3285
3294
|
* Restores eager-loaded relations from a plain snapshot onto a model instance.
|
|
3286
3295
|
*
|
|
@@ -3328,7 +3337,7 @@ var RelationHydrator = class {
|
|
|
3328
3337
|
};
|
|
3329
3338
|
|
|
3330
3339
|
//#endregion
|
|
3331
|
-
//#region
|
|
3340
|
+
//#region ../cascade/src/model/methods/hydration-methods.ts
|
|
3332
3341
|
function hydrateModel(ModelClass, data) {
|
|
3333
3342
|
const model = new ModelClass(ModelClass.getDriver().deserialize(data));
|
|
3334
3343
|
model.isNew = false;
|
|
@@ -3375,7 +3384,7 @@ function replaceModelData(model, data) {
|
|
|
3375
3384
|
}
|
|
3376
3385
|
|
|
3377
3386
|
//#endregion
|
|
3378
|
-
//#region
|
|
3387
|
+
//#region ../cascade/src/model/methods/instance-event-methods.ts
|
|
3379
3388
|
async function emitModelEvent(model, event, context) {
|
|
3380
3389
|
const ctor = model.constructor;
|
|
3381
3390
|
await model.events.emit(event, model, context);
|
|
@@ -3393,7 +3402,7 @@ function offModelEvent(model, event, listener) {
|
|
|
3393
3402
|
}
|
|
3394
3403
|
|
|
3395
3404
|
//#endregion
|
|
3396
|
-
//#region
|
|
3405
|
+
//#region ../cascade/src/validation/database-writer-validation-error.ts
|
|
3397
3406
|
/**
|
|
3398
3407
|
* Error thrown when model validation fails during database write operations.
|
|
3399
3408
|
*
|
|
@@ -3542,7 +3551,7 @@ var DatabaseWriterValidationError = class DatabaseWriterValidationError extends
|
|
|
3542
3551
|
};
|
|
3543
3552
|
|
|
3544
3553
|
//#endregion
|
|
3545
|
-
//#region
|
|
3554
|
+
//#region ../cascade/src/validation/rules/exists-rule.ts
|
|
3546
3555
|
/**
|
|
3547
3556
|
* Validates that a record exists in the database for the given column/value.
|
|
3548
3557
|
*
|
|
@@ -3566,7 +3575,7 @@ const existsRule = {
|
|
|
3566
3575
|
};
|
|
3567
3576
|
|
|
3568
3577
|
//#endregion
|
|
3569
|
-
//#region
|
|
3578
|
+
//#region ../cascade/src/validation/rules/unique-rule.ts
|
|
3570
3579
|
/**
|
|
3571
3580
|
* Validates that a value is unique against a database column.
|
|
3572
3581
|
*
|
|
@@ -3603,7 +3612,7 @@ const uniqueRule = {
|
|
|
3603
3612
|
};
|
|
3604
3613
|
|
|
3605
3614
|
//#endregion
|
|
3606
|
-
//#region
|
|
3615
|
+
//#region ../cascade/src/validation/plugins/database-rules-plugin.ts
|
|
3607
3616
|
/**
|
|
3608
3617
|
* Cascade's database-rules plugin for Seal.
|
|
3609
3618
|
*/
|
|
@@ -3640,7 +3649,7 @@ const databaseRulesPlugin = {
|
|
|
3640
3649
|
};
|
|
3641
3650
|
|
|
3642
3651
|
//#endregion
|
|
3643
|
-
//#region
|
|
3652
|
+
//#region ../cascade/src/validation/mutators/embed-mutator.ts
|
|
3644
3653
|
const databaseModelMutator = async (value, context) => {
|
|
3645
3654
|
let { model: ModelClass } = context?.options || {};
|
|
3646
3655
|
if (typeof ModelClass === "string") ModelClass = getModelFromRegistry(ModelClass);
|
|
@@ -3661,7 +3670,7 @@ const databaseModelsMutator = async (value, context) => {
|
|
|
3661
3670
|
};
|
|
3662
3671
|
|
|
3663
3672
|
//#endregion
|
|
3664
|
-
//#region
|
|
3673
|
+
//#region ../cascade/src/validation/rules/database-model-rule.ts
|
|
3665
3674
|
const databaseModelRule = {
|
|
3666
3675
|
name: "databaseModel",
|
|
3667
3676
|
defaultErrorMessage: "The :input must be a valid :model model",
|
|
@@ -3687,7 +3696,7 @@ const databaseModelsRule = {
|
|
|
3687
3696
|
};
|
|
3688
3697
|
|
|
3689
3698
|
//#endregion
|
|
3690
|
-
//#region
|
|
3699
|
+
//#region ../cascade/src/validation/transformers/embed-model-transformer.ts
|
|
3691
3700
|
const databaseModelTransformer = (value, context) => {
|
|
3692
3701
|
const embed = context.options.embed ?? "embedData";
|
|
3693
3702
|
if (value instanceof Model === false && !Array.isArray(value)) return value;
|
|
@@ -3700,7 +3709,7 @@ const databaseModelTransformer = (value, context) => {
|
|
|
3700
3709
|
};
|
|
3701
3710
|
|
|
3702
3711
|
//#endregion
|
|
3703
|
-
//#region
|
|
3712
|
+
//#region ../cascade/src/validation/validators/embed-validator.ts
|
|
3704
3713
|
var EmbedModelValidator = class extends _warlock_js_seal.BaseValidator {
|
|
3705
3714
|
/**
|
|
3706
3715
|
* Check if value is a string type
|
|
@@ -3734,7 +3743,7 @@ var EmbedModelValidator = class extends _warlock_js_seal.BaseValidator {
|
|
|
3734
3743
|
};
|
|
3735
3744
|
|
|
3736
3745
|
//#endregion
|
|
3737
|
-
//#region
|
|
3746
|
+
//#region ../cascade/src/validation/plugins/embed-validator-plugin.ts
|
|
3738
3747
|
/**
|
|
3739
3748
|
* File validation plugin for Seal
|
|
3740
3749
|
*/
|
|
@@ -3749,12 +3758,12 @@ const embedValidator = {
|
|
|
3749
3758
|
};
|
|
3750
3759
|
|
|
3751
3760
|
//#endregion
|
|
3752
|
-
//#region
|
|
3761
|
+
//#region ../cascade/src/validation/database-seal-plugins.ts
|
|
3753
3762
|
(0, _warlock_js_seal.registerPlugin)(embedValidator);
|
|
3754
3763
|
(0, _warlock_js_seal.registerPlugin)(databaseRulesPlugin);
|
|
3755
3764
|
|
|
3756
3765
|
//#endregion
|
|
3757
|
-
//#region
|
|
3766
|
+
//#region ../cascade/src/writer/database-writer.ts
|
|
3758
3767
|
/**
|
|
3759
3768
|
* Database writer service that orchestrates model persistence.
|
|
3760
3769
|
*
|
|
@@ -4065,7 +4074,7 @@ var DatabaseWriter = class {
|
|
|
4065
4074
|
};
|
|
4066
4075
|
|
|
4067
4076
|
//#endregion
|
|
4068
|
-
//#region
|
|
4077
|
+
//#region ../cascade/src/model/methods/meta-methods.ts
|
|
4069
4078
|
function applyDefaultsToModel(ModelClass, defaults) {
|
|
4070
4079
|
if (defaults.autoGenerateId !== void 0 && ModelClass.autoGenerateId === void 0) ModelClass.autoGenerateId = defaults.autoGenerateId;
|
|
4071
4080
|
if (defaults.initialId !== void 0 && ModelClass.initialId === void 0) ModelClass.initialId = defaults.initialId;
|
|
@@ -4097,7 +4106,7 @@ async function performAtomicDecrement(model, field, amount = 1) {
|
|
|
4097
4106
|
}
|
|
4098
4107
|
|
|
4099
4108
|
//#endregion
|
|
4100
|
-
//#region
|
|
4109
|
+
//#region ../cascade/src/relations/pivot-operations.ts
|
|
4101
4110
|
/**
|
|
4102
4111
|
* Manages pivot table operations for many-to-many relationships.
|
|
4103
4112
|
*
|
|
@@ -4324,7 +4333,7 @@ function createPivotOperations(model, relationName) {
|
|
|
4324
4333
|
}
|
|
4325
4334
|
|
|
4326
4335
|
//#endregion
|
|
4327
|
-
//#region
|
|
4336
|
+
//#region ../cascade/src/model/methods/pivot-methods.ts
|
|
4328
4337
|
/**
|
|
4329
4338
|
* Get the pivot-operations handle for a `belongsToMany` relation.
|
|
4330
4339
|
*
|
|
@@ -4368,7 +4377,7 @@ async function detachPivotRelation(model, relation, ids) {
|
|
|
4368
4377
|
}
|
|
4369
4378
|
|
|
4370
4379
|
//#endregion
|
|
4371
|
-
//#region
|
|
4380
|
+
//#region ../cascade/src/model/methods/query-methods.ts
|
|
4372
4381
|
function buildQuery(ModelClass, BaseModel) {
|
|
4373
4382
|
const queryBuilder = ModelClass.newQueryBuilder();
|
|
4374
4383
|
queryBuilder.pendingGlobalScopes = new Map([...BaseModel.globalScopes, ...ModelClass.globalScopes]);
|
|
@@ -4485,7 +4494,7 @@ function resolveDataSource(ModelClass) {
|
|
|
4485
4494
|
}
|
|
4486
4495
|
|
|
4487
4496
|
//#endregion
|
|
4488
|
-
//#region
|
|
4497
|
+
//#region ../cascade/src/restorer/database-restorer.ts
|
|
4489
4498
|
/**
|
|
4490
4499
|
* Database restorer service that orchestrates model restoration.
|
|
4491
4500
|
*
|
|
@@ -4799,7 +4808,7 @@ var DatabaseRestorer = class {
|
|
|
4799
4808
|
};
|
|
4800
4809
|
|
|
4801
4810
|
//#endregion
|
|
4802
|
-
//#region
|
|
4811
|
+
//#region ../cascade/src/model/methods/restore-methods.ts
|
|
4803
4812
|
async function restoreRecord(ModelClass, id, options) {
|
|
4804
4813
|
const result = await new DatabaseRestorer(ModelClass).restore(id, options);
|
|
4805
4814
|
if (!result.restoredRecord) throw new Error(`Failed to restore ${ModelClass.name} with ${ModelClass.primaryKey} ${id}: no record returned.`);
|
|
@@ -4811,7 +4820,7 @@ async function restoreAllRecords(ModelClass, options) {
|
|
|
4811
4820
|
}
|
|
4812
4821
|
|
|
4813
4822
|
//#endregion
|
|
4814
|
-
//#region
|
|
4823
|
+
//#region ../cascade/src/model/methods/scope-methods.ts
|
|
4815
4824
|
/**
|
|
4816
4825
|
* Give the model class its OWN scope map before mutating.
|
|
4817
4826
|
*
|
|
@@ -4843,7 +4852,7 @@ function removeLocalModelScope(ModelClass, name) {
|
|
|
4843
4852
|
}
|
|
4844
4853
|
|
|
4845
4854
|
//#endregion
|
|
4846
|
-
//#region
|
|
4855
|
+
//#region ../cascade/src/model/methods/serialization-methods.ts
|
|
4847
4856
|
function modelToJSON(model) {
|
|
4848
4857
|
const ModelClass = model.self();
|
|
4849
4858
|
const resource = ModelClass.resource;
|
|
@@ -4861,7 +4870,7 @@ function modelToJSON(model) {
|
|
|
4861
4870
|
}
|
|
4862
4871
|
|
|
4863
4872
|
//#endregion
|
|
4864
|
-
//#region
|
|
4873
|
+
//#region ../cascade/src/model/methods/static-event-methods.ts
|
|
4865
4874
|
/**
|
|
4866
4875
|
* Isolated event emitter registry — one ModelEvents instance per model constructor.
|
|
4867
4876
|
* Encapsulated here so no other module needs to know it exists.
|
|
@@ -4893,7 +4902,7 @@ function getGlobalEvents() {
|
|
|
4893
4902
|
}
|
|
4894
4903
|
|
|
4895
4904
|
//#endregion
|
|
4896
|
-
//#region
|
|
4905
|
+
//#region ../cascade/src/model/methods/write-methods.ts
|
|
4897
4906
|
/**
|
|
4898
4907
|
* Default number of rows processed per chunk by {@link createManyRecords}.
|
|
4899
4908
|
*
|
|
@@ -5119,7 +5128,7 @@ async function upsertRecord(ModelClass, filter, data, options) {
|
|
|
5119
5128
|
}
|
|
5120
5129
|
|
|
5121
5130
|
//#endregion
|
|
5122
|
-
//#region
|
|
5131
|
+
//#region ../cascade/src/model/model.ts
|
|
5123
5132
|
/**
|
|
5124
5133
|
* Base class that powers all Cascade models.
|
|
5125
5134
|
*
|
|
@@ -6929,7 +6938,7 @@ var Model = class Model {
|
|
|
6929
6938
|
};
|
|
6930
6939
|
|
|
6931
6940
|
//#endregion
|
|
6932
|
-
//#region
|
|
6941
|
+
//#region ../cascade/src/expressions/aggregate-expressions.ts
|
|
6933
6942
|
/**
|
|
6934
6943
|
* Checks if a value is an abstract aggregate expression.
|
|
6935
6944
|
*/
|
|
@@ -7232,7 +7241,7 @@ const $agg = {
|
|
|
7232
7241
|
};
|
|
7233
7242
|
|
|
7234
7243
|
//#endregion
|
|
7235
|
-
//#region
|
|
7244
|
+
//#region ../cascade/src/expressions/column-expressions.ts
|
|
7236
7245
|
/**
|
|
7237
7246
|
* Type guard: is `value` one of the typed column-expression nodes?
|
|
7238
7247
|
*
|
|
@@ -7382,7 +7391,7 @@ const $expr = {
|
|
|
7382
7391
|
};
|
|
7383
7392
|
|
|
7384
7393
|
//#endregion
|
|
7385
|
-
//#region
|
|
7394
|
+
//#region ../cascade/src/utils/is-valid-date-value.ts
|
|
7386
7395
|
const isoRegex = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d{3})?Z?)?$/;
|
|
7387
7396
|
/**
|
|
7388
7397
|
* Check if the given value is a valid date value
|
|
@@ -7402,7 +7411,7 @@ function isValidDateValue(value) {
|
|
|
7402
7411
|
}
|
|
7403
7412
|
|
|
7404
7413
|
//#endregion
|
|
7405
|
-
//#region
|
|
7414
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-blueprint.ts
|
|
7406
7415
|
var MongoDBBlueprint = class {
|
|
7407
7416
|
database;
|
|
7408
7417
|
/**
|
|
@@ -7452,7 +7461,7 @@ var MongoDBBlueprint = class {
|
|
|
7452
7461
|
};
|
|
7453
7462
|
|
|
7454
7463
|
//#endregion
|
|
7455
|
-
//#region
|
|
7464
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-id-generator.ts
|
|
7456
7465
|
/** Number of times a reservation retries after a duplicate-key (E11000) error. */
|
|
7457
7466
|
const MAX_RESERVE_ATTEMPTS = 3;
|
|
7458
7467
|
/** MongoDB duplicate-key error code. */
|
|
@@ -7685,7 +7694,7 @@ var MongoIdGenerator = class {
|
|
|
7685
7694
|
};
|
|
7686
7695
|
|
|
7687
7696
|
//#endregion
|
|
7688
|
-
//#region
|
|
7697
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-migration-driver.ts
|
|
7689
7698
|
/**
|
|
7690
7699
|
* MongoDB-specific migration driver implementation.
|
|
7691
7700
|
*
|
|
@@ -8215,7 +8224,7 @@ var MongoMigrationDriver = class {
|
|
|
8215
8224
|
};
|
|
8216
8225
|
|
|
8217
8226
|
//#endregion
|
|
8218
|
-
//#region
|
|
8227
|
+
//#region ../cascade/src/query-builder/query-builder.ts
|
|
8219
8228
|
/**
|
|
8220
8229
|
* Pure, driver-agnostic query builder.
|
|
8221
8230
|
*
|
|
@@ -9329,7 +9338,7 @@ var QueryBuilder = class QueryBuilder {
|
|
|
9329
9338
|
};
|
|
9330
9339
|
|
|
9331
9340
|
//#endregion
|
|
9332
|
-
//#region
|
|
9341
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-query-operations.ts
|
|
9333
9342
|
/**
|
|
9334
9343
|
* Helper class for constructing MongoDB aggregation pipeline operations.
|
|
9335
9344
|
*
|
|
@@ -9602,7 +9611,7 @@ var MongoQueryOperations = class {
|
|
|
9602
9611
|
};
|
|
9603
9612
|
|
|
9604
9613
|
//#endregion
|
|
9605
|
-
//#region
|
|
9614
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-query-parser.ts
|
|
9606
9615
|
/**
|
|
9607
9616
|
* Parses query builder operations into MongoDB aggregation pipeline.
|
|
9608
9617
|
*
|
|
@@ -10673,7 +10682,7 @@ var MongoQueryParser = class {
|
|
|
10673
10682
|
};
|
|
10674
10683
|
|
|
10675
10684
|
//#endregion
|
|
10676
|
-
//#region
|
|
10685
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-query-builder.ts
|
|
10677
10686
|
/**
|
|
10678
10687
|
* MongoDB-specific query builder implementation using aggregation pipeline.
|
|
10679
10688
|
*/
|
|
@@ -12547,7 +12556,7 @@ var MongoQueryBuilder = class MongoQueryBuilder extends QueryBuilder {
|
|
|
12547
12556
|
};
|
|
12548
12557
|
|
|
12549
12558
|
//#endregion
|
|
12550
|
-
//#region
|
|
12559
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-sync-adapter.ts
|
|
12551
12560
|
/**
|
|
12552
12561
|
* MongoDB implementation of the sync adapter.
|
|
12553
12562
|
* Handles array updates using positional operators and arrayFilters.
|
|
@@ -12663,7 +12672,7 @@ var MongoSyncAdapter = class {
|
|
|
12663
12672
|
};
|
|
12664
12673
|
|
|
12665
12674
|
//#endregion
|
|
12666
|
-
//#region
|
|
12675
|
+
//#region ../cascade/src/drivers/mongodb/mongodb-driver.ts
|
|
12667
12676
|
const DEFAULT_TRANSACTION_OPTIONS = {
|
|
12668
12677
|
readPreference: "primary",
|
|
12669
12678
|
readConcern: { level: "local" },
|
|
@@ -13369,7 +13378,7 @@ var MongoDbDriver = class {
|
|
|
13369
13378
|
};
|
|
13370
13379
|
|
|
13371
13380
|
//#endregion
|
|
13372
|
-
//#region
|
|
13381
|
+
//#region ../cascade/src/drivers/postgres/postgres-blueprint.ts
|
|
13373
13382
|
/**
|
|
13374
13383
|
* PostgreSQL Blueprint.
|
|
13375
13384
|
*
|
|
@@ -13472,7 +13481,7 @@ var PostgresBlueprint = class {
|
|
|
13472
13481
|
};
|
|
13473
13482
|
|
|
13474
13483
|
//#endregion
|
|
13475
|
-
//#region
|
|
13484
|
+
//#region ../cascade/src/drivers/postgres/postgres-dialect.ts
|
|
13476
13485
|
/**
|
|
13477
13486
|
* PostgreSQL-specific SQL dialect implementation.
|
|
13478
13487
|
*
|
|
@@ -13750,7 +13759,7 @@ var PostgresDialect = class {
|
|
|
13750
13759
|
};
|
|
13751
13760
|
|
|
13752
13761
|
//#endregion
|
|
13753
|
-
//#region
|
|
13762
|
+
//#region ../cascade/src/sql-database-dirty-tracker.ts
|
|
13754
13763
|
/**
|
|
13755
13764
|
* A dirty tracker designed for SQL databases where nested objects shouldn't be flattened.
|
|
13756
13765
|
* Since SQL drivers (like Postgres) replace the entire JSON column when updated,
|
|
@@ -13766,7 +13775,7 @@ var SqlDatabaseDirtyTracker = class extends DatabaseDirtyTracker {
|
|
|
13766
13775
|
};
|
|
13767
13776
|
|
|
13768
13777
|
//#endregion
|
|
13769
|
-
//#region
|
|
13778
|
+
//#region ../cascade/src/drivers/postgres/postgres-migration-driver.ts
|
|
13770
13779
|
/**
|
|
13771
13780
|
* PostgreSQL Migration Driver
|
|
13772
13781
|
*
|
|
@@ -14522,7 +14531,7 @@ var PostgresMigrationDriver = class {
|
|
|
14522
14531
|
};
|
|
14523
14532
|
|
|
14524
14533
|
//#endregion
|
|
14525
|
-
//#region
|
|
14534
|
+
//#region ../cascade/src/drivers/postgres/postgres-query-parser.ts
|
|
14526
14535
|
/**
|
|
14527
14536
|
* PostgreSQL Query Parser.
|
|
14528
14537
|
*
|
|
@@ -15344,7 +15353,7 @@ var PostgresQueryParser = class PostgresQueryParser {
|
|
|
15344
15353
|
};
|
|
15345
15354
|
|
|
15346
15355
|
//#endregion
|
|
15347
|
-
//#region
|
|
15356
|
+
//#region ../cascade/src/drivers/postgres/postgres-query-builder.ts
|
|
15348
15357
|
/**
|
|
15349
15358
|
* Cast an Op[] to PostgresParserOperation[] — the shapes are compatible since
|
|
15350
15359
|
* both have `type: string` and `data: Record<string, unknown>`.
|
|
@@ -16523,7 +16532,7 @@ var PostgresQueryBuilder = class PostgresQueryBuilder extends QueryBuilder {
|
|
|
16523
16532
|
};
|
|
16524
16533
|
|
|
16525
16534
|
//#endregion
|
|
16526
|
-
//#region
|
|
16535
|
+
//#region ../cascade/src/migration/sql-serializer.ts
|
|
16527
16536
|
/**
|
|
16528
16537
|
* Converts PendingOperation objects to SQL strings for a specific dialect.
|
|
16529
16538
|
*/
|
|
@@ -16547,7 +16556,7 @@ var SQLSerializer = class {
|
|
|
16547
16556
|
};
|
|
16548
16557
|
|
|
16549
16558
|
//#endregion
|
|
16550
|
-
//#region
|
|
16559
|
+
//#region ../cascade/src/drivers/postgres/postgres-sql-serializer.ts
|
|
16551
16560
|
/**
|
|
16552
16561
|
* PostgreSQL-specific SQL serializer.
|
|
16553
16562
|
*
|
|
@@ -16814,7 +16823,7 @@ var PostgresSQLSerializer = class extends SQLSerializer {
|
|
|
16814
16823
|
};
|
|
16815
16824
|
|
|
16816
16825
|
//#endregion
|
|
16817
|
-
//#region
|
|
16826
|
+
//#region ../cascade/src/drivers/postgres/postgres-sync-adapter.ts
|
|
16818
16827
|
/**
|
|
16819
16828
|
* PostgreSQL Sync Adapter.
|
|
16820
16829
|
*
|
|
@@ -16974,7 +16983,7 @@ var PostgresSyncAdapter = class {
|
|
|
16974
16983
|
};
|
|
16975
16984
|
|
|
16976
16985
|
//#endregion
|
|
16977
|
-
//#region
|
|
16986
|
+
//#region ../cascade/src/drivers/postgres/postgres-driver.ts
|
|
16978
16987
|
/**
|
|
16979
16988
|
* PostgreSQL Driver
|
|
16980
16989
|
*
|
|
@@ -17981,7 +17990,7 @@ var PostgresDriver = class {
|
|
|
17981
17990
|
};
|
|
17982
17991
|
|
|
17983
17992
|
//#endregion
|
|
17984
|
-
//#region
|
|
17993
|
+
//#region ../cascade/src/utils/connect-to-database.ts
|
|
17985
17994
|
/**
|
|
17986
17995
|
* Connect to a database and register the data source.
|
|
17987
17996
|
*
|
|
@@ -18103,7 +18112,7 @@ async function transaction(fn, options) {
|
|
|
18103
18112
|
}
|
|
18104
18113
|
|
|
18105
18114
|
//#endregion
|
|
18106
|
-
//#region
|
|
18115
|
+
//#region ../cascade/src/utils/database-writer.utils.ts
|
|
18107
18116
|
/**
|
|
18108
18117
|
* Transfer value before saving it into the database
|
|
18109
18118
|
*/
|
|
@@ -18126,7 +18135,7 @@ function useModelTransformer(callback) {
|
|
|
18126
18135
|
}
|
|
18127
18136
|
|
|
18128
18137
|
//#endregion
|
|
18129
|
-
//#region
|
|
18138
|
+
//#region ../cascade/src/utils/define-model.ts
|
|
18130
18139
|
/**
|
|
18131
18140
|
* Define a model with a clean, concise API.
|
|
18132
18141
|
*
|
|
@@ -18226,7 +18235,7 @@ function defineModel(options) {
|
|
|
18226
18235
|
}
|
|
18227
18236
|
|
|
18228
18237
|
//#endregion
|
|
18229
|
-
//#region
|
|
18238
|
+
//#region ../cascade/src/utils/once-connected.ts
|
|
18230
18239
|
/**
|
|
18231
18240
|
* Execute a callback once the driver is connected.
|
|
18232
18241
|
*
|
|
@@ -18425,7 +18434,7 @@ function onceDisconnected(dataSourceOrNameOrCallback, callback) {
|
|
|
18425
18434
|
}
|
|
18426
18435
|
|
|
18427
18436
|
//#endregion
|
|
18428
|
-
//#region
|
|
18437
|
+
//#region ../cascade/src/migration/column-builder.ts
|
|
18429
18438
|
/**
|
|
18430
18439
|
* Fluent builder for defining column properties.
|
|
18431
18440
|
*
|
|
@@ -18955,7 +18964,7 @@ var ColumnBuilder = class {
|
|
|
18955
18964
|
};
|
|
18956
18965
|
|
|
18957
18966
|
//#endregion
|
|
18958
|
-
//#region
|
|
18967
|
+
//#region ../cascade/src/migration/foreign-key-builder.ts
|
|
18959
18968
|
/**
|
|
18960
18969
|
* Fluent builder for foreign key constraints.
|
|
18961
18970
|
*
|
|
@@ -19079,7 +19088,7 @@ var ForeignKeyBuilder = class {
|
|
|
19079
19088
|
};
|
|
19080
19089
|
|
|
19081
19090
|
//#endregion
|
|
19082
|
-
//#region
|
|
19091
|
+
//#region ../cascade/src/migration/column-helpers.ts
|
|
19083
19092
|
/**
|
|
19084
19093
|
* A no-op migration sink used by standalone column helpers.
|
|
19085
19094
|
*
|
|
@@ -19451,7 +19460,7 @@ function arrayJson() {
|
|
|
19451
19460
|
}
|
|
19452
19461
|
|
|
19453
19462
|
//#endregion
|
|
19454
|
-
//#region
|
|
19463
|
+
//#region ../cascade/src/migration/migration.ts
|
|
19455
19464
|
/**
|
|
19456
19465
|
* Base class for all database migrations.
|
|
19457
19466
|
*
|
|
@@ -21566,7 +21575,72 @@ Migration.alter = function alterMigration(model, schema, options = {}) {
|
|
|
21566
21575
|
Migration.__declarativeFactoriesAttached = true;
|
|
21567
21576
|
|
|
21568
21577
|
//#endregion
|
|
21569
|
-
//#region
|
|
21578
|
+
//#region ../cascade/src/migration/parse-created-at.ts
|
|
21579
|
+
/**
|
|
21580
|
+
* Parse a migration's `createdAt` stamp into a `Date`.
|
|
21581
|
+
*
|
|
21582
|
+
* Migration filenames generated by the framework carry a
|
|
21583
|
+
* `MM-DD-YYYY_HH-MM-SS` prefix, which **`new Date()` cannot parse** — it
|
|
21584
|
+
* returns `Invalid Date`. Anything ordering migrations by timestamp must come
|
|
21585
|
+
* through here; using the native constructor silently yields `NaN` and
|
|
21586
|
+
* degrades the sort into whatever its tiebreaker is.
|
|
21587
|
+
*
|
|
21588
|
+
* Supports `MM-DD-YYYY_HH-MM-SS` and `DD-MM-YYYY_HH-MM-SS`, telling them apart
|
|
21589
|
+
* by whether the first field exceeds 12 (a month cannot), and falls back to
|
|
21590
|
+
* native parsing for ISO strings.
|
|
21591
|
+
*
|
|
21592
|
+
* @returns the parsed date, or `undefined` when the stamp is unusable.
|
|
21593
|
+
*/
|
|
21594
|
+
function parseCreatedAt(createdAt) {
|
|
21595
|
+
const match = createdAt.match(/^(\d{2})-(\d{2})-(\d{4})_(\d{2})-(\d{2})-(\d{2})$/);
|
|
21596
|
+
if (match) {
|
|
21597
|
+
const [, first, second, year, hour, minute, second_time] = match;
|
|
21598
|
+
const firstNum = parseInt(first);
|
|
21599
|
+
const secondNum = parseInt(second);
|
|
21600
|
+
let month, day;
|
|
21601
|
+
if (firstNum > 12) {
|
|
21602
|
+
day = firstNum;
|
|
21603
|
+
month = secondNum;
|
|
21604
|
+
} else if (secondNum > 12) {
|
|
21605
|
+
month = firstNum;
|
|
21606
|
+
day = secondNum;
|
|
21607
|
+
} else {
|
|
21608
|
+
month = firstNum;
|
|
21609
|
+
day = secondNum;
|
|
21610
|
+
}
|
|
21611
|
+
const date = new Date(parseInt(year), month - 1, day, parseInt(hour), parseInt(minute), parseInt(second_time));
|
|
21612
|
+
if (isNaN(date.getTime())) return;
|
|
21613
|
+
return date;
|
|
21614
|
+
}
|
|
21615
|
+
try {
|
|
21616
|
+
const date = new Date(createdAt);
|
|
21617
|
+
return isNaN(date.getTime()) ? void 0 : date;
|
|
21618
|
+
} catch {
|
|
21619
|
+
return;
|
|
21620
|
+
}
|
|
21621
|
+
}
|
|
21622
|
+
/**
|
|
21623
|
+
* Compare two migration timestamps for ordering.
|
|
21624
|
+
*
|
|
21625
|
+
* Shared by every migration comparator so they cannot drift apart: a stamp
|
|
21626
|
+
* that parses always sorts before one that doesn't, and two unparseable
|
|
21627
|
+
* stamps are equal (leaving the caller's own tiebreaker to decide).
|
|
21628
|
+
*
|
|
21629
|
+
* Returns `undefined` when the timestamps do not settle the comparison.
|
|
21630
|
+
*/
|
|
21631
|
+
function compareCreatedAt(a, b) {
|
|
21632
|
+
const dateA = a ? parseCreatedAt(a) : void 0;
|
|
21633
|
+
const dateB = b ? parseCreatedAt(b) : void 0;
|
|
21634
|
+
if (dateA && dateB) {
|
|
21635
|
+
const difference = dateA.getTime() - dateB.getTime();
|
|
21636
|
+
return difference === 0 ? void 0 : difference;
|
|
21637
|
+
}
|
|
21638
|
+
if (dateA) return -1;
|
|
21639
|
+
if (dateB) return 1;
|
|
21640
|
+
}
|
|
21641
|
+
|
|
21642
|
+
//#endregion
|
|
21643
|
+
//#region ../cascade/src/migration/sql-grammar.ts
|
|
21570
21644
|
/**
|
|
21571
21645
|
* Parses and sorts SQL statements globally based on their execution phase,
|
|
21572
21646
|
* and classifies statements by their semantic type.
|
|
@@ -21662,15 +21736,23 @@ var SQLGrammar = class {
|
|
|
21662
21736
|
}
|
|
21663
21737
|
/**
|
|
21664
21738
|
* Sort an array of tagged SQL statements by phase, then creation date, then migration name.
|
|
21739
|
+
*
|
|
21740
|
+
* This is the sort that decides **execution order** — it runs across every
|
|
21741
|
+
* pending migration's statements at once, after the migration list itself
|
|
21742
|
+
* has been ordered, so whatever it decides is final.
|
|
21743
|
+
*
|
|
21744
|
+
* The creation date must go through {@link compareCreatedAt}. Parsing these
|
|
21745
|
+
* stamps with `new Date()` returns `Invalid Date` for the framework's own
|
|
21746
|
+
* `MM-DD-YYYY_HH-MM-SS` filename format, which collapsed every timestamp to
|
|
21747
|
+
* the same value and quietly handed the whole ordering to the alphabetical
|
|
21748
|
+
* tiebreaker below — running, for example, a January 2026 migration before a
|
|
21749
|
+
* December 2025 one.
|
|
21665
21750
|
*/
|
|
21666
21751
|
static sort(statements) {
|
|
21667
21752
|
return statements.slice().sort((a, b) => {
|
|
21668
21753
|
if (a.phase !== b.phase) return a.phase - b.phase;
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
if (isNaN(dateA)) dateA = 0;
|
|
21672
|
-
if (isNaN(dateB)) dateB = 0;
|
|
21673
|
-
if (dateA !== dateB) return dateA - dateB;
|
|
21754
|
+
const byCreatedAt = compareCreatedAt(a.createdAt, b.createdAt);
|
|
21755
|
+
if (byCreatedAt !== void 0) return byCreatedAt;
|
|
21674
21756
|
const nameA = a.migrationName || "";
|
|
21675
21757
|
const nameB = b.migrationName || "";
|
|
21676
21758
|
return nameA.localeCompare(nameB);
|
|
@@ -21679,41 +21761,7 @@ var SQLGrammar = class {
|
|
|
21679
21761
|
};
|
|
21680
21762
|
|
|
21681
21763
|
//#endregion
|
|
21682
|
-
//#region
|
|
21683
|
-
/**
|
|
21684
|
-
* Parse createdAt timestamp from custom format to Date.
|
|
21685
|
-
* Supports both: MM-DD-YYYY_HH-MM-SS and DD-MM-YYYY_HH-MM-SS
|
|
21686
|
-
* Intelligently detects format by checking if first value > 12 (must be day)
|
|
21687
|
-
* Falls back to standard Date parsing for ISO strings.
|
|
21688
|
-
*/
|
|
21689
|
-
function parseCreatedAt(createdAt) {
|
|
21690
|
-
const match = createdAt.match(/^(\d{2})-(\d{2})-(\d{4})_(\d{2})-(\d{2})-(\d{2})$/);
|
|
21691
|
-
if (match) {
|
|
21692
|
-
const [, first, second, year, hour, minute, second_time] = match;
|
|
21693
|
-
const firstNum = parseInt(first);
|
|
21694
|
-
const secondNum = parseInt(second);
|
|
21695
|
-
let month, day;
|
|
21696
|
-
if (firstNum > 12) {
|
|
21697
|
-
day = firstNum;
|
|
21698
|
-
month = secondNum;
|
|
21699
|
-
} else if (secondNum > 12) {
|
|
21700
|
-
month = firstNum;
|
|
21701
|
-
day = secondNum;
|
|
21702
|
-
} else {
|
|
21703
|
-
month = firstNum;
|
|
21704
|
-
day = secondNum;
|
|
21705
|
-
}
|
|
21706
|
-
const date = new Date(parseInt(year), month - 1, day, parseInt(hour), parseInt(minute), parseInt(second_time));
|
|
21707
|
-
if (isNaN(date.getTime())) return;
|
|
21708
|
-
return date;
|
|
21709
|
-
}
|
|
21710
|
-
try {
|
|
21711
|
-
const date = new Date(createdAt);
|
|
21712
|
-
return isNaN(date.getTime()) ? void 0 : date;
|
|
21713
|
-
} catch {
|
|
21714
|
-
return;
|
|
21715
|
-
}
|
|
21716
|
-
}
|
|
21764
|
+
//#region ../cascade/src/migration/migration-runner.ts
|
|
21717
21765
|
/**
|
|
21718
21766
|
* Comparator for sorting migration classes.
|
|
21719
21767
|
*
|
|
@@ -21722,11 +21770,8 @@ function parseCreatedAt(createdAt) {
|
|
|
21722
21770
|
* 2. Alphabetical by migration name (last resort)
|
|
21723
21771
|
*/
|
|
21724
21772
|
function sortMigrations(a, b) {
|
|
21725
|
-
const
|
|
21726
|
-
|
|
21727
|
-
if (aDate && bDate) return aDate.getTime() - bDate.getTime();
|
|
21728
|
-
if (aDate) return -1;
|
|
21729
|
-
if (bDate) return 1;
|
|
21773
|
+
const byCreatedAt = compareCreatedAt(a.createdAt, b.createdAt);
|
|
21774
|
+
if (byCreatedAt !== void 0) return byCreatedAt;
|
|
21730
21775
|
return a.migrationName.localeCompare(b.migrationName);
|
|
21731
21776
|
}
|
|
21732
21777
|
/**
|
|
@@ -22354,7 +22399,7 @@ var MigrationRunner = class {
|
|
|
22354
22399
|
const migrationRunner = new MigrationRunner();
|
|
22355
22400
|
|
|
22356
22401
|
//#endregion
|
|
22357
|
-
//#region
|
|
22402
|
+
//#region ../cascade/src/operations/database.ts
|
|
22358
22403
|
/**
|
|
22359
22404
|
* Create a database on the configured data source. Returns `created: false`
|
|
22360
22405
|
* when the database already exists — drivers are responsible for the
|
|
@@ -22390,7 +22435,7 @@ async function dropAllTables(options = {}) {
|
|
|
22390
22435
|
}
|
|
22391
22436
|
|
|
22392
22437
|
//#endregion
|
|
22393
|
-
//#region
|
|
22438
|
+
//#region ../cascade/src/operations/migrations.ts
|
|
22394
22439
|
/**
|
|
22395
22440
|
* Run every pending migration registered on the migration runner.
|
|
22396
22441
|
*
|