@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
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
'use strict';/**
|
|
2
|
-
* Light-weight async event emitter used to power model lifecycle hooks.
|
|
3
|
-
*
|
|
4
|
-
* The implementation intentionally avoids any external dependency so we can
|
|
5
|
-
* re-use it in drivers, writers, and other core services without pulling in
|
|
6
|
-
* heavier event libraries.
|
|
7
|
-
*/
|
|
8
|
-
class ModelEvents {
|
|
9
|
-
listeners = new Map();
|
|
10
|
-
/**
|
|
11
|
-
* Register a listener for the given event.
|
|
12
|
-
* Returns an unsubscribe function for convenience.
|
|
13
|
-
*/
|
|
14
|
-
on(event, listener) {
|
|
15
|
-
const listeners = this.ensureListenerSet(event);
|
|
16
|
-
listeners.add(listener);
|
|
17
|
-
return () => this.off(event, listener);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Register a listener that automatically unsubscribes after the first call.
|
|
21
|
-
*/
|
|
22
|
-
once(event, listener) {
|
|
23
|
-
const wrapper = async (model, context) => {
|
|
24
|
-
try {
|
|
25
|
-
await listener(model, context);
|
|
26
|
-
}
|
|
27
|
-
finally {
|
|
28
|
-
this.off(event, wrapper);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
return this.on(event, wrapper);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Deregister a listener for the given event.
|
|
35
|
-
*/
|
|
36
|
-
off(event, listener) {
|
|
37
|
-
const listeners = this.listeners.get(event);
|
|
38
|
-
if (!listeners) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
listeners.delete(listener);
|
|
42
|
-
if (listeners.size === 0) {
|
|
43
|
-
this.listeners.delete(event);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Emit an event to all registered listeners.
|
|
48
|
-
*/
|
|
49
|
-
async emit(event, model, context) {
|
|
50
|
-
const listeners = this.listeners.get(event);
|
|
51
|
-
if (!listeners || listeners.size === 0) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
for (const listener of Array.from(listeners)) {
|
|
55
|
-
await listener(model, context);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Emit events for fetching
|
|
60
|
-
*/
|
|
61
|
-
async emitFetching(query, context) {
|
|
62
|
-
await this.emit("fetching", query, context);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Remove all registered listeners.
|
|
66
|
-
*/
|
|
67
|
-
clear() {
|
|
68
|
-
this.listeners.clear();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Registers a listener for the "saving" event.
|
|
72
|
-
*
|
|
73
|
-
* Fired before a model is persisted (both insert and update), and before validation.
|
|
74
|
-
* Use this hook for data enrichment and preparation (e.g., setting createdBy, updatedBy).
|
|
75
|
-
*
|
|
76
|
-
* @param listener - The callback to invoke
|
|
77
|
-
* @returns An unsubscribe function
|
|
78
|
-
*/
|
|
79
|
-
onSaving(listener) {
|
|
80
|
-
return this.on("saving", listener);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Registers a listener for the "saved" event.
|
|
84
|
-
*
|
|
85
|
-
* Fired after a model has been successfully persisted.
|
|
86
|
-
*
|
|
87
|
-
* @param listener - The callback to invoke
|
|
88
|
-
* @returns An unsubscribe function
|
|
89
|
-
*/
|
|
90
|
-
onSaved(listener) {
|
|
91
|
-
return this.on("saved", listener);
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Registers a listener for the "creating" event.
|
|
95
|
-
*
|
|
96
|
-
* Fired before a new model is inserted into the database.
|
|
97
|
-
*
|
|
98
|
-
* @param listener - The callback to invoke
|
|
99
|
-
* @returns An unsubscribe function
|
|
100
|
-
*/
|
|
101
|
-
onCreating(listener) {
|
|
102
|
-
return this.on("creating", listener);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Registers a listener for the "created" event.
|
|
106
|
-
*
|
|
107
|
-
* Fired after a new model has been successfully inserted.
|
|
108
|
-
*
|
|
109
|
-
* @param listener - The callback to invoke
|
|
110
|
-
* @returns An unsubscribe function
|
|
111
|
-
*/
|
|
112
|
-
onCreated(listener) {
|
|
113
|
-
return this.on("created", listener);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Registers a listener for the "updating" event.
|
|
117
|
-
*
|
|
118
|
-
* Fired before an existing model is updated in the database.
|
|
119
|
-
*
|
|
120
|
-
* @param listener - The callback to invoke
|
|
121
|
-
* @returns An unsubscribe function
|
|
122
|
-
*/
|
|
123
|
-
onUpdating(listener) {
|
|
124
|
-
return this.on("updating", listener);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Registers a listener for the "updated" event.
|
|
128
|
-
*
|
|
129
|
-
* Fired after an existing model has been successfully updated.
|
|
130
|
-
*
|
|
131
|
-
* @param listener - The callback to invoke
|
|
132
|
-
* @returns An unsubscribe function
|
|
133
|
-
*/
|
|
134
|
-
onUpdated(listener) {
|
|
135
|
-
return this.on("updated", listener);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Registers a listener for the "deleting" event.
|
|
139
|
-
*
|
|
140
|
-
* Fired before a model is deleted from the database.
|
|
141
|
-
*
|
|
142
|
-
* @param listener - The callback to invoke
|
|
143
|
-
* @returns An unsubscribe function
|
|
144
|
-
*/
|
|
145
|
-
onDeleting(listener) {
|
|
146
|
-
return this.on("deleting", listener);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Registers a listener for the "deleted" event.
|
|
150
|
-
*
|
|
151
|
-
* Fired after a model has been successfully deleted.
|
|
152
|
-
*
|
|
153
|
-
* @param listener - The callback to invoke
|
|
154
|
-
* @returns An unsubscribe function
|
|
155
|
-
*/
|
|
156
|
-
onDeleted(listener) {
|
|
157
|
-
return this.on("deleted", listener);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Registers a listener for the "validating" event.
|
|
161
|
-
*
|
|
162
|
-
* Fired before model validation is performed.
|
|
163
|
-
*
|
|
164
|
-
* @param listener - The callback to invoke
|
|
165
|
-
* @returns An unsubscribe function
|
|
166
|
-
*/
|
|
167
|
-
onValidating(listener) {
|
|
168
|
-
return this.on("validating", listener);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Registers a listener for the "validated" event.
|
|
172
|
-
*
|
|
173
|
-
* Fired after model validation has completed.
|
|
174
|
-
*
|
|
175
|
-
* @param listener - The callback to invoke
|
|
176
|
-
* @returns An unsubscribe function
|
|
177
|
-
*/
|
|
178
|
-
onValidated(listener) {
|
|
179
|
-
return this.on("validated", listener);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Registers a listener for the "fetching" event.
|
|
183
|
-
*
|
|
184
|
-
* Fired before a query is executed to fetch models.
|
|
185
|
-
* Receives the query builder instance, allowing modification before execution.
|
|
186
|
-
*
|
|
187
|
-
* @param listener - The callback to invoke
|
|
188
|
-
* @returns An unsubscribe function
|
|
189
|
-
*/
|
|
190
|
-
onFetching(listener) {
|
|
191
|
-
return this.on("fetching", listener);
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Registers a listener for the "hydrating" event.
|
|
195
|
-
*
|
|
196
|
-
* Fired after raw records are fetched but before they are hydrated into model instances.
|
|
197
|
-
* Allows modification of raw data before hydration.
|
|
198
|
-
*
|
|
199
|
-
* @param listener - The callback to invoke
|
|
200
|
-
* @returns An unsubscribe function
|
|
201
|
-
*/
|
|
202
|
-
onHydrating(listener) {
|
|
203
|
-
return this.on("hydrating", listener);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Registers a listener for the "fetched" event.
|
|
207
|
-
*
|
|
208
|
-
* Fired after models have been fetched and hydrated.
|
|
209
|
-
* Receives hydrated model instances and query context.
|
|
210
|
-
*
|
|
211
|
-
* @param listener - The callback to invoke
|
|
212
|
-
* @returns An unsubscribe function
|
|
213
|
-
*/
|
|
214
|
-
onFetched(listener) {
|
|
215
|
-
return this.on("fetched", listener);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Registers a listener for the "restoring" event.
|
|
219
|
-
*
|
|
220
|
-
* Fired before a soft-deleted model is restored.
|
|
221
|
-
*
|
|
222
|
-
* @param listener - The callback to invoke
|
|
223
|
-
* @returns An unsubscribe function
|
|
224
|
-
*/
|
|
225
|
-
onRestoring(listener) {
|
|
226
|
-
return this.on("restoring", listener);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Registers a listener for the "restored" event.
|
|
230
|
-
*
|
|
231
|
-
* Fired after a soft-deleted model has been successfully restored.
|
|
232
|
-
*
|
|
233
|
-
* @param listener - The callback to invoke
|
|
234
|
-
* @returns An unsubscribe function
|
|
235
|
-
*/
|
|
236
|
-
onRestored(listener) {
|
|
237
|
-
return this.on("restored", listener);
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Ensures a listener set exists for the given event.
|
|
241
|
-
*
|
|
242
|
-
* @param event - The event name
|
|
243
|
-
* @returns The listener set for the event
|
|
244
|
-
* @private
|
|
245
|
-
*/
|
|
246
|
-
ensureListenerSet(event) {
|
|
247
|
-
let listeners = this.listeners.get(event);
|
|
248
|
-
if (!listeners) {
|
|
249
|
-
listeners = new Set();
|
|
250
|
-
this.listeners.set(event, listeners);
|
|
251
|
-
}
|
|
252
|
-
return listeners;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Global event emitter invoked for every model instance, regardless of type.
|
|
257
|
-
* Useful for cross-cutting concerns like auditing or request-scoped enrichment.
|
|
258
|
-
*/
|
|
259
|
-
const globalModelEvents = new ModelEvents();exports.ModelEvents=ModelEvents;exports.globalModelEvents=globalModelEvents;//# sourceMappingURL=model-events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-events.js","sources":["../../src/events/model-events.ts"],"sourcesContent":[null],"names":[],"mappings":"aAuEA;;;;;;AAMG;MACU,WAAW,CAAA;AACN,IAAA,SAAS,GAAG,IAAI,GAAG,EAAmD,CAAC;AAEvF;;;AAGG;IACI,EAAE,CACP,KAAqB,EACrB,QAA8C,EAAA;QAE9C,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAChD,QAAA,SAAS,CAAC,GAAG,CAAC,QAAsC,CAAC,CAAC;QACtD,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACxC;AAED;;AAEG;IACI,IAAI,CACT,KAAqB,EACrB,QAA8C,EAAA;QAE9C,MAAM,OAAO,GAAyC,OAAO,KAAK,EAAE,OAAO,KAAI;YAC7E,IAAI;AACF,gBAAA,MAAM,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChC,aAAA;AAAS,oBAAA;AACR,gBAAA,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAC1B,aAAA;AACH,SAAC,CAAC;QACF,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAChC;AAED;;AAEG;IACI,GAAG,CACR,KAAqB,EACrB,QAA8C,EAAA;QAE9C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,EAAE;YACd,OAAO;AACR,SAAA;AACD,QAAA,SAAS,CAAC,MAAM,CAAC,QAAsC,CAAC,CAAC;AACzD,QAAA,IAAI,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE;AACxB,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,SAAA;KACF;AAED;;AAEG;AACI,IAAA,MAAM,IAAI,CACf,KAAqB,EACrB,KAAa,EACb,OAAiB,EAAA;QAEjB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,KAAK,CAAC,EAAE;YACtC,OAAO;AACR,SAAA;QACD,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;AAC5C,YAAA,MAAM,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAChC,SAAA;KACF;AAED;;AAEG;AACI,IAAA,MAAM,YAAY,CACvB,KAA2B,EAC3B,OAAkB,EAAA;QAElB,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAY,EAAE,OAAO,CAAC,CAAC;KACpD;AAED;;AAEG;IACI,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;KACxB;AAED;;;;;;;;AAQG;AACI,IAAA,QAAQ,CACb,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;KACpC;AAED;;;;;;;AAOG;AACI,IAAA,OAAO,CAAqB,QAA8C,EAAA;QAC/E,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;KACnC;AAED;;;;;;;AAOG;AACI,IAAA,UAAU,CACf,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACtC;AAED;;;;;;;AAOG;AACI,IAAA,SAAS,CAAqB,QAA8C,EAAA;QACjF,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;KACrC;AAED;;;;;;;AAOG;AACI,IAAA,UAAU,CACf,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACtC;AAED;;;;;;;AAOG;AACI,IAAA,SAAS,CAAqB,QAA8C,EAAA;QACjF,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;KACrC;AAED;;;;;;;AAOG;AACI,IAAA,UAAU,CACf,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACtC;AAED;;;;;;;AAOG;AACI,IAAA,SAAS,CACd,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;KACrC;AAED;;;;;;;AAOG;AACI,IAAA,YAAY,CACjB,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;KACxC;AAED;;;;;;;AAOG;AACI,IAAA,WAAW,CAChB,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;KACvC;AAED;;;;;;;;AAQG;AACI,IAAA,UAAU,CACf,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACtC;AAED;;;;;;;;AAQG;AACI,IAAA,WAAW,CAChB,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;KACvC;AAED;;;;;;;;AAQG;AACI,IAAA,SAAS,CACd,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;KACrC;AAED;;;;;;;AAOG;AACI,IAAA,WAAW,CAChB,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;KACvC;AAED;;;;;;;AAOG;AACI,IAAA,UAAU,CACf,QAA8C,EAAA;QAE9C,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KACtC;AAED;;;;;;AAMG;AACK,IAAA,iBAAiB,CAAC,KAAqB,EAAA;QAC7C,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;YACtB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACtC,SAAA;AACD,QAAA,OAAO,SAAS,CAAC;KAClB;AACF,CAAA;AAED;;;AAGG;AACU,MAAA,iBAAiB,GAAG,IAAI,WAAW"}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database-agnostic aggregation expressions.
|
|
3
|
-
*
|
|
4
|
-
* These helpers provide a unified API for building aggregate queries that work
|
|
5
|
-
* across different database types (MongoDB, PostgreSQL, MySQL, etc.).
|
|
6
|
-
*
|
|
7
|
-
* Each driver implementation translates these abstract expressions to their
|
|
8
|
-
* native format:
|
|
9
|
-
* - MongoDB: { $sum: 1 }, { $sum: "$field" }, etc.
|
|
10
|
-
* - SQL: COUNT(*), SUM(field), etc.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { $agg } from '@warlock.js/cascade';
|
|
15
|
-
*
|
|
16
|
-
* // Works for both MongoDB and SQL
|
|
17
|
-
* Lesson.query()
|
|
18
|
-
* .groupBy("type", {
|
|
19
|
-
* count: $agg.count(),
|
|
20
|
-
* total: $agg.sum("duration"),
|
|
21
|
-
* avg: $agg.avg("rating")
|
|
22
|
-
* })
|
|
23
|
-
* .get();
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Abstract aggregate expression format.
|
|
28
|
-
*
|
|
29
|
-
* This format is database-agnostic and will be translated by each driver
|
|
30
|
-
* to their native syntax.
|
|
31
|
-
*/
|
|
32
|
-
export type AggregateExpression = {
|
|
33
|
-
/** The aggregate function type */
|
|
34
|
-
__agg: AggregateFunction;
|
|
35
|
-
/** The field to aggregate (null for count) */
|
|
36
|
-
__field: string | null;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Supported aggregate functions.
|
|
40
|
-
*/
|
|
41
|
-
export type AggregateFunction = "count" | "sum" | "avg" | "min" | "max" | "first" | "last" | "distinct" | "floor";
|
|
42
|
-
/**
|
|
43
|
-
* Checks if a value is an abstract aggregate expression.
|
|
44
|
-
*/
|
|
45
|
-
export declare function isAggregateExpression(value: unknown): value is AggregateExpression;
|
|
46
|
-
/**
|
|
47
|
-
* Database-agnostic aggregation expression helpers.
|
|
48
|
-
*
|
|
49
|
-
* These helpers create abstract expressions that each driver translates
|
|
50
|
-
* to their native format.
|
|
51
|
-
*/
|
|
52
|
-
export declare const $agg: {
|
|
53
|
-
/**
|
|
54
|
-
* Count documents in each group.
|
|
55
|
-
*
|
|
56
|
-
* @returns Abstract count expression
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```typescript
|
|
60
|
-
* query.groupBy("type", {
|
|
61
|
-
* count: $agg.count()
|
|
62
|
-
* });
|
|
63
|
-
* ```
|
|
64
|
-
*
|
|
65
|
-
* Translates to:
|
|
66
|
-
* - MongoDB: `{ $sum: 1 }`
|
|
67
|
-
* - SQL: `COUNT(*)`
|
|
68
|
-
*/
|
|
69
|
-
count(): AggregateExpression;
|
|
70
|
-
/**
|
|
71
|
-
* Sum a numeric field across documents in each group.
|
|
72
|
-
*
|
|
73
|
-
* @param field - The field name to sum
|
|
74
|
-
* @returns Abstract sum expression
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* query.groupBy("type", {
|
|
79
|
-
* totalDuration: $agg.sum("duration")
|
|
80
|
-
* });
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* Translates to:
|
|
84
|
-
* - MongoDB: `{ $sum: "$duration" }`
|
|
85
|
-
* - SQL: `SUM(duration)`
|
|
86
|
-
*/
|
|
87
|
-
sum(field: string): AggregateExpression;
|
|
88
|
-
/**
|
|
89
|
-
* Calculate the average value of a field across documents in each group.
|
|
90
|
-
*
|
|
91
|
-
* @param field - The field name to average
|
|
92
|
-
* @returns Abstract average expression
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* ```typescript
|
|
96
|
-
* query.groupBy("type", {
|
|
97
|
-
* avgRating: $agg.avg("rating")
|
|
98
|
-
* });
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* Translates to:
|
|
102
|
-
* - MongoDB: `{ $avg: "$rating" }`
|
|
103
|
-
* - SQL: `AVG(rating)`
|
|
104
|
-
*/
|
|
105
|
-
avg(field: string): AggregateExpression;
|
|
106
|
-
/**
|
|
107
|
-
* Get the minimum value of a field across documents in each group.
|
|
108
|
-
*
|
|
109
|
-
* @param field - The field name
|
|
110
|
-
* @returns Abstract min expression
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* query.groupBy("type", {
|
|
115
|
-
* minPrice: $agg.min("price")
|
|
116
|
-
* });
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* Translates to:
|
|
120
|
-
* - MongoDB: `{ $min: "$price" }`
|
|
121
|
-
* - SQL: `MIN(price)`
|
|
122
|
-
*/
|
|
123
|
-
min(field: string): AggregateExpression;
|
|
124
|
-
/**
|
|
125
|
-
* Get the maximum value of a field across documents in each group.
|
|
126
|
-
*
|
|
127
|
-
* @param field - The field name
|
|
128
|
-
* @returns Abstract max expression
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```typescript
|
|
132
|
-
* query.groupBy("type", {
|
|
133
|
-
* maxPrice: $agg.max("price")
|
|
134
|
-
* });
|
|
135
|
-
* ```
|
|
136
|
-
*
|
|
137
|
-
* Translates to:
|
|
138
|
-
* - MongoDB: `{ $max: "$price" }`
|
|
139
|
-
* - SQL: `MAX(price)`
|
|
140
|
-
*/
|
|
141
|
-
max(field: string): AggregateExpression;
|
|
142
|
-
/**
|
|
143
|
-
* Get the distinct values of a field across documents in each group.
|
|
144
|
-
*
|
|
145
|
-
* @param field - The field name
|
|
146
|
-
* @returns Abstract distinct expression
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```typescript
|
|
150
|
-
* query.groupBy("type", {
|
|
151
|
-
* distinctColors: $agg.distinct("color")
|
|
152
|
-
* });
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* Translates to:
|
|
156
|
-
* - MongoDB: `{ $distinct: "$color" }`
|
|
157
|
-
* - SQL: `DISTINCT(color)`
|
|
158
|
-
*/
|
|
159
|
-
distinct(field: string): AggregateExpression;
|
|
160
|
-
/**
|
|
161
|
-
* Get the floor value of a field across documents in each group.
|
|
162
|
-
*
|
|
163
|
-
* @param field - The field name
|
|
164
|
-
* @returns Abstract floor expression
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* ```typescript
|
|
168
|
-
* query.groupBy("type", {
|
|
169
|
-
* floorPrice: $agg.floor("price")
|
|
170
|
-
* });
|
|
171
|
-
* ```
|
|
172
|
-
*
|
|
173
|
-
* Translates to:
|
|
174
|
-
* - MongoDB: `{ $floor: "$price" }`
|
|
175
|
-
* - SQL: `FLOOR(price)`
|
|
176
|
-
*/
|
|
177
|
-
floor(field: string): AggregateExpression;
|
|
178
|
-
/**
|
|
179
|
-
* Get the first value of a field in each group (order-dependent).
|
|
180
|
-
*
|
|
181
|
-
* @param field - The field name
|
|
182
|
-
* @returns Abstract first expression
|
|
183
|
-
*
|
|
184
|
-
* @example
|
|
185
|
-
* ```typescript
|
|
186
|
-
* query.groupBy("type", {
|
|
187
|
-
* firstName: $agg.first("name")
|
|
188
|
-
* });
|
|
189
|
-
* ```
|
|
190
|
-
*
|
|
191
|
-
* Translates to:
|
|
192
|
-
* - MongoDB: `{ $first: "$name" }`
|
|
193
|
-
* - SQL: `FIRST_VALUE(name) OVER (...)`
|
|
194
|
-
*/
|
|
195
|
-
first(field: string): AggregateExpression;
|
|
196
|
-
/**
|
|
197
|
-
* Get the last value of a field in each group (order-dependent).
|
|
198
|
-
*
|
|
199
|
-
* @param field - The field name
|
|
200
|
-
* @returns Abstract last expression
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* ```typescript
|
|
204
|
-
* query.groupBy("type", {
|
|
205
|
-
* lastName: $agg.last("name")
|
|
206
|
-
* });
|
|
207
|
-
* ```
|
|
208
|
-
*
|
|
209
|
-
* Translates to:
|
|
210
|
-
* - MongoDB: `{ $last: "$name" }`
|
|
211
|
-
* - SQL: `LAST_VALUE(name) OVER (...)`
|
|
212
|
-
*/
|
|
213
|
-
last(field: string): AggregateExpression;
|
|
214
|
-
};
|
|
215
|
-
//# sourceMappingURL=aggregate-expressions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-expressions.d.ts","sourceRoot":"","sources":["../../src/expressions/aggregate-expressions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,kCAAkC;IAClC,KAAK,EAAE,iBAAiB,CAAC;IACzB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,OAAO,GACP,MAAM,GACN,UAAU,GACV,OAAO,CAAC;AAEZ;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAOlF;AAED;;;;;GAKG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;;;;OAeG;aACM,mBAAmB;IAI5B;;;;;;;;;;;;;;;;OAgBG;eACQ,MAAM,GAAG,mBAAmB;IAIvC;;;;;;;;;;;;;;;;OAgBG;eACQ,MAAM,GAAG,mBAAmB;IAIvC;;;;;;;;;;;;;;;;OAgBG;eACQ,MAAM,GAAG,mBAAmB;IAIvC;;;;;;;;;;;;;;;;OAgBG;eACQ,MAAM,GAAG,mBAAmB;IAIvC;;;;;;;;;;;;;;;;OAgBG;oBACa,MAAM,GAAG,mBAAmB;IAI5C;;;;;;;;;;;;;;;;OAgBG;iBACU,MAAM,GAAG,mBAAmB;IAIzC;;;;;;;;;;;;;;;;OAgBG;iBACU,MAAM,GAAG,mBAAmB;IAIzC;;;;;;;;;;;;;;;;OAgBG;gBACS,MAAM,GAAG,mBAAmB;CAGzC,CAAC"}
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
'use strict';/**
|
|
2
|
-
* Database-agnostic aggregation expressions.
|
|
3
|
-
*
|
|
4
|
-
* These helpers provide a unified API for building aggregate queries that work
|
|
5
|
-
* across different database types (MongoDB, PostgreSQL, MySQL, etc.).
|
|
6
|
-
*
|
|
7
|
-
* Each driver implementation translates these abstract expressions to their
|
|
8
|
-
* native format:
|
|
9
|
-
* - MongoDB: { $sum: 1 }, { $sum: "$field" }, etc.
|
|
10
|
-
* - SQL: COUNT(*), SUM(field), etc.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { $agg } from '@warlock.js/cascade';
|
|
15
|
-
*
|
|
16
|
-
* // Works for both MongoDB and SQL
|
|
17
|
-
* Lesson.query()
|
|
18
|
-
* .groupBy("type", {
|
|
19
|
-
* count: $agg.count(),
|
|
20
|
-
* total: $agg.sum("duration"),
|
|
21
|
-
* avg: $agg.avg("rating")
|
|
22
|
-
* })
|
|
23
|
-
* .get();
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Checks if a value is an abstract aggregate expression.
|
|
28
|
-
*/
|
|
29
|
-
function isAggregateExpression(value) {
|
|
30
|
-
return (typeof value === "object" &&
|
|
31
|
-
value !== null &&
|
|
32
|
-
"__field" in value &&
|
|
33
|
-
typeof value.__agg === "string");
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Database-agnostic aggregation expression helpers.
|
|
37
|
-
*
|
|
38
|
-
* These helpers create abstract expressions that each driver translates
|
|
39
|
-
* to their native format.
|
|
40
|
-
*/
|
|
41
|
-
const $agg = {
|
|
42
|
-
/**
|
|
43
|
-
* Count documents in each group.
|
|
44
|
-
*
|
|
45
|
-
* @returns Abstract count expression
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* query.groupBy("type", {
|
|
50
|
-
* count: $agg.count()
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* Translates to:
|
|
55
|
-
* - MongoDB: `{ $sum: 1 }`
|
|
56
|
-
* - SQL: `COUNT(*)`
|
|
57
|
-
*/
|
|
58
|
-
count() {
|
|
59
|
-
return { __agg: "count", __field: null };
|
|
60
|
-
},
|
|
61
|
-
/**
|
|
62
|
-
* Sum a numeric field across documents in each group.
|
|
63
|
-
*
|
|
64
|
-
* @param field - The field name to sum
|
|
65
|
-
* @returns Abstract sum expression
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* query.groupBy("type", {
|
|
70
|
-
* totalDuration: $agg.sum("duration")
|
|
71
|
-
* });
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* Translates to:
|
|
75
|
-
* - MongoDB: `{ $sum: "$duration" }`
|
|
76
|
-
* - SQL: `SUM(duration)`
|
|
77
|
-
*/
|
|
78
|
-
sum(field) {
|
|
79
|
-
return { __agg: "sum", __field: field };
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Calculate the average value of a field across documents in each group.
|
|
83
|
-
*
|
|
84
|
-
* @param field - The field name to average
|
|
85
|
-
* @returns Abstract average expression
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* query.groupBy("type", {
|
|
90
|
-
* avgRating: $agg.avg("rating")
|
|
91
|
-
* });
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* Translates to:
|
|
95
|
-
* - MongoDB: `{ $avg: "$rating" }`
|
|
96
|
-
* - SQL: `AVG(rating)`
|
|
97
|
-
*/
|
|
98
|
-
avg(field) {
|
|
99
|
-
return { __agg: "avg", __field: field };
|
|
100
|
-
},
|
|
101
|
-
/**
|
|
102
|
-
* Get the minimum value of a field across documents in each group.
|
|
103
|
-
*
|
|
104
|
-
* @param field - The field name
|
|
105
|
-
* @returns Abstract min expression
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```typescript
|
|
109
|
-
* query.groupBy("type", {
|
|
110
|
-
* minPrice: $agg.min("price")
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* Translates to:
|
|
115
|
-
* - MongoDB: `{ $min: "$price" }`
|
|
116
|
-
* - SQL: `MIN(price)`
|
|
117
|
-
*/
|
|
118
|
-
min(field) {
|
|
119
|
-
return { __agg: "min", __field: field };
|
|
120
|
-
},
|
|
121
|
-
/**
|
|
122
|
-
* Get the maximum value of a field across documents in each group.
|
|
123
|
-
*
|
|
124
|
-
* @param field - The field name
|
|
125
|
-
* @returns Abstract max expression
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* query.groupBy("type", {
|
|
130
|
-
* maxPrice: $agg.max("price")
|
|
131
|
-
* });
|
|
132
|
-
* ```
|
|
133
|
-
*
|
|
134
|
-
* Translates to:
|
|
135
|
-
* - MongoDB: `{ $max: "$price" }`
|
|
136
|
-
* - SQL: `MAX(price)`
|
|
137
|
-
*/
|
|
138
|
-
max(field) {
|
|
139
|
-
return { __agg: "max", __field: field };
|
|
140
|
-
},
|
|
141
|
-
/**
|
|
142
|
-
* Get the distinct values of a field across documents in each group.
|
|
143
|
-
*
|
|
144
|
-
* @param field - The field name
|
|
145
|
-
* @returns Abstract distinct expression
|
|
146
|
-
*
|
|
147
|
-
* @example
|
|
148
|
-
* ```typescript
|
|
149
|
-
* query.groupBy("type", {
|
|
150
|
-
* distinctColors: $agg.distinct("color")
|
|
151
|
-
* });
|
|
152
|
-
* ```
|
|
153
|
-
*
|
|
154
|
-
* Translates to:
|
|
155
|
-
* - MongoDB: `{ $distinct: "$color" }`
|
|
156
|
-
* - SQL: `DISTINCT(color)`
|
|
157
|
-
*/
|
|
158
|
-
distinct(field) {
|
|
159
|
-
return { __agg: "distinct", __field: field };
|
|
160
|
-
},
|
|
161
|
-
/**
|
|
162
|
-
* Get the floor value of a field across documents in each group.
|
|
163
|
-
*
|
|
164
|
-
* @param field - The field name
|
|
165
|
-
* @returns Abstract floor expression
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```typescript
|
|
169
|
-
* query.groupBy("type", {
|
|
170
|
-
* floorPrice: $agg.floor("price")
|
|
171
|
-
* });
|
|
172
|
-
* ```
|
|
173
|
-
*
|
|
174
|
-
* Translates to:
|
|
175
|
-
* - MongoDB: `{ $floor: "$price" }`
|
|
176
|
-
* - SQL: `FLOOR(price)`
|
|
177
|
-
*/
|
|
178
|
-
floor(field) {
|
|
179
|
-
return { __agg: "floor", __field: field };
|
|
180
|
-
},
|
|
181
|
-
/**
|
|
182
|
-
* Get the first value of a field in each group (order-dependent).
|
|
183
|
-
*
|
|
184
|
-
* @param field - The field name
|
|
185
|
-
* @returns Abstract first expression
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
* ```typescript
|
|
189
|
-
* query.groupBy("type", {
|
|
190
|
-
* firstName: $agg.first("name")
|
|
191
|
-
* });
|
|
192
|
-
* ```
|
|
193
|
-
*
|
|
194
|
-
* Translates to:
|
|
195
|
-
* - MongoDB: `{ $first: "$name" }`
|
|
196
|
-
* - SQL: `FIRST_VALUE(name) OVER (...)`
|
|
197
|
-
*/
|
|
198
|
-
first(field) {
|
|
199
|
-
return { __agg: "first", __field: field };
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* Get the last value of a field in each group (order-dependent).
|
|
203
|
-
*
|
|
204
|
-
* @param field - The field name
|
|
205
|
-
* @returns Abstract last expression
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* ```typescript
|
|
209
|
-
* query.groupBy("type", {
|
|
210
|
-
* lastName: $agg.last("name")
|
|
211
|
-
* });
|
|
212
|
-
* ```
|
|
213
|
-
*
|
|
214
|
-
* Translates to:
|
|
215
|
-
* - MongoDB: `{ $last: "$name" }`
|
|
216
|
-
* - SQL: `LAST_VALUE(name) OVER (...)`
|
|
217
|
-
*/
|
|
218
|
-
last(field) {
|
|
219
|
-
return { __agg: "last", __field: field };
|
|
220
|
-
},
|
|
221
|
-
};exports.$agg=$agg;exports.isAggregateExpression=isAggregateExpression;//# sourceMappingURL=aggregate-expressions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-expressions.js","sources":["../../src/expressions/aggregate-expressions.ts"],"sourcesContent":[null],"names":[],"mappings":"aAAA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AA6BH;;AAEG;AACG,SAAU,qBAAqB,CAAC,KAAc,EAAA;AAClD,IAAA,QACE,OAAO,KAAK,KAAK,QAAQ;AACzB,QAAA,KAAK,KAAK,IAAI;AACd,QAAA,SAAS,IAAI,KAAK;AAClB,QAAA,OAAQ,KAA6B,CAAC,KAAK,KAAK,QAAQ,EACxD;AACJ,CAAC;AAED;;;;;AAKG;AACU,MAAA,IAAI,GAAG;AAClB;;;;;;;;;;;;;;;AAeG;IACH,KAAK,GAAA;QACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;KAC1C;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,GAAG,CAAC,KAAa,EAAA;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KACzC;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,GAAG,CAAC,KAAa,EAAA;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KACzC;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,GAAG,CAAC,KAAa,EAAA;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KACzC;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,GAAG,CAAC,KAAa,EAAA;QACf,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KACzC;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,QAAQ,CAAC,KAAa,EAAA;QACpB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC9C;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,KAAK,CAAC,KAAa,EAAA;QACjB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC3C;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,KAAK,CAAC,KAAa,EAAA;QACjB,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC3C;AAED;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,IAAI,CAAC,KAAa,EAAA;QAChB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;KAC1C;"}
|