@warlock.js/cascade 4.0.174 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/bin/cascadejs +3 -0
- package/esm/cli/commands/migrate-export-sql.mjs +48 -0
- package/esm/cli/commands/migrate-export-sql.mjs.map +1 -0
- package/esm/cli/commands/migrate-list.mjs +26 -0
- package/esm/cli/commands/migrate-list.mjs.map +1 -0
- package/esm/cli/commands/migrate-rollback.mjs +50 -0
- package/esm/cli/commands/migrate-rollback.mjs.map +1 -0
- package/esm/cli/commands/migrate.mjs +65 -0
- package/esm/cli/commands/migrate.mjs.map +1 -0
- package/esm/cli/connection-from-env.mjs +181 -0
- package/esm/cli/connection-from-env.mjs.map +1 -0
- package/esm/cli/index.mjs +31 -0
- package/esm/cli/index.mjs.map +1 -0
- package/esm/cli/load-migrations.mjs +78 -0
- package/esm/cli/load-migrations.mjs.map +1 -0
- package/esm/cli/printers.mjs +57 -0
- package/esm/cli/printers.mjs.map +1 -0
- package/esm/cli/setup-logger.mjs +30 -0
- package/esm/cli/setup-logger.mjs.map +1 -0
- package/esm/cli/with-cli-connection.mjs +39 -0
- package/esm/cli/with-cli-connection.mjs.map +1 -0
- package/esm/cli.d.mts +1 -0
- package/esm/cli.mjs +26 -0
- package/esm/cli.mjs.map +1 -0
- package/esm/context/database-data-source-context.d.mts +32 -0
- package/esm/context/database-data-source-context.d.mts.map +1 -0
- package/esm/context/database-data-source-context.mjs +35 -0
- package/esm/context/database-data-source-context.mjs.map +1 -0
- package/esm/context/database-transaction-context.d.mts +38 -0
- package/esm/context/database-transaction-context.d.mts.map +1 -0
- package/esm/context/database-transaction-context.mjs +47 -0
- package/esm/context/database-transaction-context.mjs.map +1 -0
- package/esm/contracts/database-driver.contract.d.mts +443 -0
- package/esm/contracts/database-driver.contract.d.mts.map +1 -0
- package/esm/contracts/database-id-generator.contract.d.mts +109 -0
- package/esm/contracts/database-id-generator.contract.d.mts.map +1 -0
- package/esm/contracts/database-remover.contract.d.mts +108 -0
- package/esm/contracts/database-remover.contract.d.mts.map +1 -0
- package/esm/contracts/database-restorer.contract.d.mts +145 -0
- package/esm/contracts/database-restorer.contract.d.mts.map +1 -0
- package/esm/contracts/database-writer.contract.d.mts +123 -0
- package/esm/contracts/database-writer.contract.d.mts.map +1 -0
- package/esm/contracts/driver-blueprint.contract.d.mts +52 -0
- package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -0
- package/esm/contracts/index.d.mts +9 -0
- package/esm/contracts/migration-driver.contract.d.mts +476 -0
- package/esm/contracts/migration-driver.contract.d.mts.map +1 -0
- package/esm/contracts/query-builder.contract.d.mts +1663 -0
- package/esm/contracts/query-builder.contract.d.mts.map +1 -0
- package/esm/contracts/sync-adapter.contract.d.mts +49 -0
- package/esm/contracts/sync-adapter.contract.d.mts.map +1 -0
- package/esm/data-source/data-source-registry.d.mts +111 -0
- package/esm/data-source/data-source-registry.d.mts.map +1 -0
- package/esm/data-source/data-source-registry.mjs +142 -0
- package/esm/data-source/data-source-registry.mjs.map +1 -0
- package/esm/data-source/data-source.d.mts +160 -0
- package/esm/data-source/data-source.d.mts.map +1 -0
- package/esm/data-source/data-source.mjs +87 -0
- package/esm/data-source/data-source.mjs.map +1 -0
- package/esm/database-dirty-tracker.d.mts +254 -0
- package/esm/database-dirty-tracker.d.mts.map +1 -0
- package/esm/database-dirty-tracker.mjs +356 -0
- package/esm/database-dirty-tracker.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-blueprint.mjs +54 -0
- package/esm/drivers/mongodb/mongodb-blueprint.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-driver.d.mts +334 -0
- package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-driver.mjs +716 -0
- package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts +120 -0
- package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-id-generator.mjs +141 -0
- package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +322 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs +531 -0
- package/esm/drivers/mongodb/mongodb-migration-driver.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts +1117 -0
- package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-builder.mjs +1828 -0
- package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts +230 -0
- package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-operations.mjs +275 -0
- package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts +263 -0
- package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-query-parser.mjs +965 -0
- package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +78 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs +118 -0
- package/esm/drivers/mongodb/mongodb-sync-adapter.mjs.map +1 -0
- package/esm/drivers/mongodb/types.d.mts +43 -0
- package/esm/drivers/mongodb/types.d.mts.map +1 -0
- package/esm/drivers/postgres/index.d.mts +8 -0
- package/esm/drivers/postgres/index.mjs +9 -0
- package/esm/drivers/postgres/postgres-blueprint.d.mts +60 -0
- package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-blueprint.mjs +105 -0
- package/esm/drivers/postgres/postgres-blueprint.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-dialect.d.mts +144 -0
- package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-dialect.mjs +227 -0
- package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-driver.d.mts +424 -0
- package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-driver.mjs +845 -0
- package/esm/drivers/postgres/postgres-driver.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-migration-driver.d.mts +393 -0
- package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-migration-driver.mjs +760 -0
- package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-query-builder.d.mts +399 -0
- package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-query-builder.mjs +1105 -0
- package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-query-parser.d.mts +351 -0
- package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-query-parser.mjs +796 -0
- package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-sql-serializer.mjs +260 -0
- package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -0
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts +79 -0
- package/esm/drivers/postgres/postgres-sync-adapter.d.mts.map +1 -0
- package/esm/drivers/postgres/postgres-sync-adapter.mjs +162 -0
- package/esm/drivers/postgres/postgres-sync-adapter.mjs.map +1 -0
- package/esm/drivers/postgres/types.d.mts +105 -0
- package/esm/drivers/postgres/types.d.mts.map +1 -0
- package/esm/drivers/sql/sql-dialect.contract.d.mts +221 -0
- package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -0
- package/esm/drivers/sql/sql-types.d.mts +150 -0
- package/esm/drivers/sql/sql-types.d.mts.map +1 -0
- package/esm/errors/missing-data-source.error.d.mts +25 -0
- package/esm/errors/missing-data-source.error.d.mts.map +1 -0
- package/esm/errors/missing-data-source.error.mjs +31 -0
- package/esm/errors/missing-data-source.error.mjs.map +1 -0
- package/esm/errors/transaction-rollback.error.d.mts +23 -0
- package/esm/errors/transaction-rollback.error.d.mts.map +1 -0
- package/esm/errors/transaction-rollback.error.mjs +29 -0
- package/esm/errors/transaction-rollback.error.mjs.map +1 -0
- package/esm/events/model-events.d.mts +234 -0
- package/esm/events/model-events.d.mts.map +1 -0
- package/esm/events/model-events.mjs +254 -0
- package/esm/events/model-events.mjs.map +1 -0
- package/esm/expressions/aggregate-expressions.d.mts +224 -0
- package/esm/expressions/aggregate-expressions.d.mts.map +1 -0
- package/esm/expressions/aggregate-expressions.mjs +232 -0
- package/esm/expressions/aggregate-expressions.mjs.map +1 -0
- package/esm/index.d.mts +67 -0
- package/esm/index.mjs +53 -0
- package/esm/migration/column-builder.d.mts +420 -0
- package/esm/migration/column-builder.d.mts.map +1 -0
- package/esm/migration/column-builder.mjs +532 -0
- package/esm/migration/column-builder.mjs.map +1 -0
- package/esm/migration/column-helpers.d.mts +280 -0
- package/esm/migration/column-helpers.d.mts.map +1 -0
- package/esm/migration/column-helpers.mjs +376 -0
- package/esm/migration/column-helpers.mjs.map +1 -0
- package/esm/migration/foreign-key-builder.d.mts +106 -0
- package/esm/migration/foreign-key-builder.d.mts.map +1 -0
- package/esm/migration/foreign-key-builder.mjs +126 -0
- package/esm/migration/foreign-key-builder.mjs.map +1 -0
- package/esm/migration/index.d.mts +6 -0
- package/esm/migration/index.mjs +7 -0
- package/esm/migration/migration-runner.d.mts +279 -0
- package/esm/migration/migration-runner.d.mts.map +1 -0
- package/esm/migration/migration-runner.mjs +662 -0
- package/esm/migration/migration-runner.mjs.map +1 -0
- package/esm/migration/migration.d.mts +2035 -0
- package/esm/migration/migration.d.mts.map +1 -0
- package/esm/migration/migration.mjs +2083 -0
- package/esm/migration/migration.mjs.map +1 -0
- package/esm/migration/sql-grammar.mjs +115 -0
- package/esm/migration/sql-grammar.mjs.map +1 -0
- package/esm/migration/sql-serializer.d.mts +26 -0
- package/esm/migration/sql-serializer.d.mts.map +1 -0
- package/esm/migration/sql-serializer.mjs +26 -0
- package/esm/migration/sql-serializer.mjs.map +1 -0
- package/esm/migration/types.d.mts +136 -0
- package/esm/migration/types.d.mts.map +1 -0
- package/esm/model/methods/accessor-methods.mjs +54 -0
- package/esm/model/methods/accessor-methods.mjs.map +1 -0
- package/esm/model/methods/delete-methods.mjs +16 -0
- package/esm/model/methods/delete-methods.mjs.map +1 -0
- package/esm/model/methods/dirty-methods.mjs +20 -0
- package/esm/model/methods/dirty-methods.mjs.map +1 -0
- package/esm/model/methods/hydration-methods.mjs +51 -0
- package/esm/model/methods/hydration-methods.mjs.map +1 -0
- package/esm/model/methods/instance-event-methods.mjs +22 -0
- package/esm/model/methods/instance-event-methods.mjs.map +1 -0
- package/esm/model/methods/meta-methods.mjs +36 -0
- package/esm/model/methods/meta-methods.mjs.map +1 -0
- package/esm/model/methods/pivot-methods.mjs +48 -0
- package/esm/model/methods/pivot-methods.mjs.map +1 -0
- package/esm/model/methods/query-methods.mjs +121 -0
- package/esm/model/methods/query-methods.mjs.map +1 -0
- package/esm/model/methods/restore-methods.mjs +16 -0
- package/esm/model/methods/restore-methods.mjs.map +1 -0
- package/esm/model/methods/scope-methods.mjs +20 -0
- package/esm/model/methods/scope-methods.mjs.map +1 -0
- package/esm/model/methods/serialization-methods.mjs +20 -0
- package/esm/model/methods/serialization-methods.mjs.map +1 -0
- package/esm/model/methods/static-event-methods.mjs +37 -0
- package/esm/model/methods/static-event-methods.mjs.map +1 -0
- package/esm/model/methods/write-methods.mjs +69 -0
- package/esm/model/methods/write-methods.mjs.map +1 -0
- package/esm/model/model.d.mts +1778 -0
- package/esm/model/model.d.mts.map +1 -0
- package/esm/model/model.mjs +1762 -0
- package/esm/model/model.mjs.map +1 -0
- package/esm/model/model.types.d.mts +47 -0
- package/esm/model/model.types.d.mts.map +1 -0
- package/esm/model/register-model.d.mts +140 -0
- package/esm/model/register-model.d.mts.map +1 -0
- package/esm/model/register-model.mjs +175 -0
- package/esm/model/register-model.mjs.map +1 -0
- package/esm/model/relation-decorators.d.mts +88 -0
- package/esm/model/relation-decorators.d.mts.map +1 -0
- package/esm/model/relation-decorators.mjs +191 -0
- package/esm/model/relation-decorators.mjs.map +1 -0
- package/esm/operations/database.d.mts +46 -0
- package/esm/operations/database.d.mts.map +1 -0
- package/esm/operations/database.mjs +40 -0
- package/esm/operations/database.mjs.map +1 -0
- package/esm/operations/index.d.mts +2 -0
- package/esm/operations/index.mjs +4 -0
- package/esm/operations/migrations.d.mts +71 -0
- package/esm/operations/migrations.d.mts.map +1 -0
- package/esm/operations/migrations.mjs +70 -0
- package/esm/operations/migrations.mjs.map +1 -0
- package/esm/query-builder/query-builder.d.mts +564 -0
- package/esm/query-builder/query-builder.d.mts.map +1 -0
- package/esm/query-builder/query-builder.mjs +1097 -0
- package/esm/query-builder/query-builder.mjs.map +1 -0
- package/esm/relations/index.d.mts +4 -0
- package/esm/relations/index.mjs +5 -0
- package/esm/relations/key-conventions.mjs +119 -0
- package/esm/relations/key-conventions.mjs.map +1 -0
- package/esm/relations/pivot-operations.d.mts +155 -0
- package/esm/relations/pivot-operations.d.mts.map +1 -0
- package/esm/relations/pivot-operations.mjs +232 -0
- package/esm/relations/pivot-operations.mjs.map +1 -0
- package/esm/relations/relation-hydrator.d.mts +55 -0
- package/esm/relations/relation-hydrator.d.mts.map +1 -0
- package/esm/relations/relation-hydrator.mjs +52 -0
- package/esm/relations/relation-hydrator.mjs.map +1 -0
- package/esm/relations/relation-loader.d.mts +190 -0
- package/esm/relations/relation-loader.d.mts.map +1 -0
- package/esm/relations/relation-loader.mjs +416 -0
- package/esm/relations/relation-loader.mjs.map +1 -0
- package/esm/relations/types.d.mts +317 -0
- package/esm/relations/types.d.mts.map +1 -0
- package/esm/remover/database-remover.d.mts +104 -0
- package/esm/remover/database-remover.d.mts.map +1 -0
- package/esm/remover/database-remover.mjs +174 -0
- package/esm/remover/database-remover.mjs.map +1 -0
- package/esm/restorer/database-restorer.d.mts +135 -0
- package/esm/restorer/database-restorer.d.mts.map +1 -0
- package/esm/restorer/database-restorer.mjs +316 -0
- package/esm/restorer/database-restorer.mjs.map +1 -0
- package/esm/sql-database-dirty-tracker.d.mts +17 -0
- package/esm/sql-database-dirty-tracker.d.mts.map +1 -0
- package/esm/sql-database-dirty-tracker.mjs +20 -0
- package/esm/sql-database-dirty-tracker.mjs.map +1 -0
- package/esm/sync/model-events.mjs +46 -0
- package/esm/sync/model-events.mjs.map +1 -0
- package/esm/sync/model-sync-operation.d.mts +159 -0
- package/esm/sync/model-sync-operation.d.mts.map +1 -0
- package/esm/sync/model-sync-operation.mjs +257 -0
- package/esm/sync/model-sync-operation.mjs.map +1 -0
- package/esm/sync/model-sync.d.mts +126 -0
- package/esm/sync/model-sync.d.mts.map +1 -0
- package/esm/sync/model-sync.mjs +157 -0
- package/esm/sync/model-sync.mjs.map +1 -0
- package/esm/sync/sync-context.d.mts +69 -0
- package/esm/sync/sync-context.d.mts.map +1 -0
- package/esm/sync/sync-context.mjs +95 -0
- package/esm/sync/sync-context.mjs.map +1 -0
- package/esm/sync/sync-manager.d.mts +213 -0
- package/esm/sync/sync-manager.d.mts.map +1 -0
- package/esm/sync/sync-manager.mjs +597 -0
- package/esm/sync/sync-manager.mjs.map +1 -0
- package/esm/sync/types.d.mts +215 -0
- package/esm/sync/types.d.mts.map +1 -0
- package/esm/types.d.mts +423 -0
- package/esm/types.d.mts.map +1 -0
- package/esm/utils/connect-to-database.d.mts +328 -0
- package/esm/utils/connect-to-database.d.mts.map +1 -0
- package/esm/utils/connect-to-database.mjs +130 -0
- package/esm/utils/connect-to-database.mjs.map +1 -0
- package/esm/utils/database-writer.utils.d.mts +18 -0
- package/esm/utils/database-writer.utils.d.mts.map +1 -0
- package/esm/utils/database-writer.utils.mjs +25 -0
- package/esm/utils/database-writer.utils.mjs.map +1 -0
- package/esm/utils/define-model.d.mts +185 -0
- package/esm/utils/define-model.d.mts.map +1 -0
- package/esm/utils/define-model.mjs +105 -0
- package/esm/utils/define-model.mjs.map +1 -0
- package/esm/utils/is-valid-date-value.mjs +22 -0
- package/esm/utils/is-valid-date-value.mjs.map +1 -0
- package/esm/utils/once-connected.d.mts +150 -0
- package/esm/utils/once-connected.d.mts.map +1 -0
- package/esm/utils/once-connected.mjs +203 -0
- package/esm/utils/once-connected.mjs.map +1 -0
- package/esm/validation/database-seal-plugins.d.mts +1 -0
- package/esm/validation/database-seal-plugins.mjs +11 -0
- package/esm/validation/database-seal-plugins.mjs.map +1 -0
- package/esm/validation/database-writer-validation-error.d.mts +101 -0
- package/esm/validation/database-writer-validation-error.d.mts.map +1 -0
- package/esm/validation/database-writer-validation-error.mjs +153 -0
- package/esm/validation/database-writer-validation-error.mjs.map +1 -0
- package/esm/validation/index.d.mts +2 -0
- package/esm/validation/index.mjs +4 -0
- package/esm/validation/mutators/embed-mutator.mjs +26 -0
- package/esm/validation/mutators/embed-mutator.mjs.map +1 -0
- package/esm/validation/plugins/database-rules-plugin.d.mts +28 -0
- package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -0
- package/esm/validation/plugins/database-rules-plugin.mjs +43 -0
- package/esm/validation/plugins/database-rules-plugin.mjs.map +1 -0
- package/esm/validation/plugins/embed-validator-plugin.d.mts +17 -0
- package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -0
- package/esm/validation/plugins/embed-validator-plugin.mjs +20 -0
- package/esm/validation/plugins/embed-validator-plugin.mjs.map +1 -0
- package/esm/validation/rules/database-model-rule.mjs +32 -0
- package/esm/validation/rules/database-model-rule.mjs.map +1 -0
- package/esm/validation/rules/exists-rule.mjs +29 -0
- package/esm/validation/rules/exists-rule.mjs.map +1 -0
- package/esm/validation/rules/unique-rule.mjs +43 -0
- package/esm/validation/rules/unique-rule.mjs.map +1 -0
- package/esm/validation/transformers/embed-model-transformer.mjs +17 -0
- package/esm/validation/transformers/embed-model-transformer.mjs.map +1 -0
- package/esm/validation/types.d.mts +43 -0
- package/esm/validation/types.d.mts.map +1 -0
- package/esm/validation/validators/embed-validator.d.mts +25 -0
- package/esm/validation/validators/embed-validator.d.mts.map +1 -0
- package/esm/validation/validators/embed-validator.mjs +42 -0
- package/esm/validation/validators/embed-validator.mjs.map +1 -0
- package/esm/writer/database-writer.d.mts +178 -0
- package/esm/writer/database-writer.d.mts.map +1 -0
- package/esm/writer/database-writer.mjs +317 -0
- package/esm/writer/database-writer.mjs.map +1 -0
- package/llms-full.txt +2027 -0
- package/llms.txt +23 -0
- package/package.json +60 -51
- package/skills/README.md +65 -0
- package/skills/aggregate-data/SKILL.md +102 -0
- package/skills/cascade-basics/SKILL.md +93 -0
- package/skills/configure-delete-strategy/SKILL.md +126 -0
- package/skills/define-model/SKILL.md +170 -0
- package/skills/define-relations/SKILL.md +171 -0
- package/skills/manage-data-sources/SKILL.md +140 -0
- package/skills/manage-transactions/SKILL.md +118 -0
- package/skills/paginate-results/SKILL.md +122 -0
- package/skills/perform-atomic-ops/SKILL.md +98 -0
- package/skills/query-data/SKILL.md +168 -0
- package/skills/run-cascade-cli/SKILL.md +125 -0
- package/skills/search-by-vector/SKILL.md +127 -0
- package/skills/subscribe-to-model-events/SKILL.md +148 -0
- package/skills/track-changes/SKILL.md +109 -0
- package/skills/write-migration/SKILL.md +144 -0
- package/cjs/context/database-data-source-context.d.ts +0 -29
- package/cjs/context/database-data-source-context.d.ts.map +0 -1
- package/cjs/context/database-data-source-context.js +0 -28
- package/cjs/context/database-data-source-context.js.map +0 -1
- package/cjs/context/database-transaction-context.d.ts +0 -35
- package/cjs/context/database-transaction-context.d.ts.map +0 -1
- package/cjs/context/database-transaction-context.js +0 -40
- package/cjs/context/database-transaction-context.js.map +0 -1
- package/cjs/contracts/database-driver.contract.d.ts +0 -450
- package/cjs/contracts/database-driver.contract.d.ts.map +0 -1
- package/cjs/contracts/database-id-generator.contract.d.ts +0 -109
- package/cjs/contracts/database-id-generator.contract.d.ts.map +0 -1
- package/cjs/contracts/database-remover.contract.d.ts +0 -104
- package/cjs/contracts/database-remover.contract.d.ts.map +0 -1
- package/cjs/contracts/database-restorer.contract.d.ts +0 -143
- package/cjs/contracts/database-restorer.contract.d.ts.map +0 -1
- package/cjs/contracts/database-writer.contract.d.ts +0 -119
- package/cjs/contracts/database-writer.contract.d.ts.map +0 -1
- package/cjs/contracts/driver-blueprint.contract.d.ts +0 -49
- package/cjs/contracts/driver-blueprint.contract.d.ts.map +0 -1
- package/cjs/contracts/index.d.ts +0 -10
- package/cjs/contracts/index.d.ts.map +0 -1
- package/cjs/contracts/migration-driver.contract.d.ts +0 -522
- package/cjs/contracts/migration-driver.contract.d.ts.map +0 -1
- package/cjs/contracts/query-builder.contract.d.ts +0 -1609
- package/cjs/contracts/query-builder.contract.d.ts.map +0 -1
- package/cjs/contracts/sync-adapter.contract.d.ts +0 -58
- package/cjs/contracts/sync-adapter.contract.d.ts.map +0 -1
- package/cjs/data-source/data-source-registry.d.ts +0 -108
- package/cjs/data-source/data-source-registry.d.ts.map +0 -1
- package/cjs/data-source/data-source-registry.js +0 -145
- package/cjs/data-source/data-source-registry.js.map +0 -1
- package/cjs/data-source/data-source.d.ts +0 -147
- package/cjs/data-source/data-source.d.ts.map +0 -1
- package/cjs/data-source/data-source.js +0 -83
- package/cjs/data-source/data-source.js.map +0 -1
- package/cjs/database-dirty-tracker.d.ts +0 -252
- package/cjs/database-dirty-tracker.d.ts.map +0 -1
- package/cjs/database-dirty-tracker.js +0 -386
- package/cjs/database-dirty-tracker.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
- package/cjs/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-blueprint.js +0 -51
- package/cjs/drivers/mongodb/mongodb-blueprint.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.d.ts +0 -325
- package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-driver.js +0 -845
- package/cjs/drivers/mongodb/mongodb-driver.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
- package/cjs/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-id-generator.js +0 -149
- package/cjs/drivers/mongodb/mongodb-id-generator.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
- package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-migration-driver.js +0 -666
- package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
- package/cjs/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-builder.js +0 -1988
- package/cjs/drivers/mongodb/mongodb-query-builder.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
- package/cjs/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-operations.js +0 -270
- package/cjs/drivers/mongodb/mongodb-query-operations.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
- package/cjs/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-query-parser.js +0 -1351
- package/cjs/drivers/mongodb/mongodb-query-parser.js.map +0 -1
- package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
- package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
- package/cjs/drivers/mongodb/mongodb-sync-adapter.js +0 -146
- package/cjs/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
- package/cjs/drivers/mongodb/types.d.ts +0 -43
- package/cjs/drivers/mongodb/types.d.ts.map +0 -1
- package/cjs/drivers/postgres/index.d.ts +0 -16
- package/cjs/drivers/postgres/index.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-blueprint.d.ts +0 -64
- package/cjs/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-blueprint.js +0 -121
- package/cjs/drivers/postgres/postgres-blueprint.js.map +0 -1
- package/cjs/drivers/postgres/postgres-dialect.d.ts +0 -136
- package/cjs/drivers/postgres/postgres-dialect.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-dialect.js +0 -268
- package/cjs/drivers/postgres/postgres-dialect.js.map +0 -1
- package/cjs/drivers/postgres/postgres-driver.d.ts +0 -432
- package/cjs/drivers/postgres/postgres-driver.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-driver.js +0 -1008
- package/cjs/drivers/postgres/postgres-driver.js.map +0 -1
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts +0 -397
- package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-migration-driver.js +0 -900
- package/cjs/drivers/postgres/postgres-migration-driver.js.map +0 -1
- package/cjs/drivers/postgres/postgres-query-builder.d.ts +0 -254
- package/cjs/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-query-builder.js +0 -933
- package/cjs/drivers/postgres/postgres-query-builder.js.map +0 -1
- package/cjs/drivers/postgres/postgres-query-parser.d.ts +0 -328
- package/cjs/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-query-parser.js +0 -868
- package/cjs/drivers/postgres/postgres-query-parser.js.map +0 -1
- package/cjs/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
- package/cjs/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-sql-serializer.js +0 -400
- package/cjs/drivers/postgres/postgres-sql-serializer.js.map +0 -1
- package/cjs/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
- package/cjs/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
- package/cjs/drivers/postgres/postgres-sync-adapter.js +0 -204
- package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/cjs/drivers/postgres/types.d.ts +0 -144
- package/cjs/drivers/postgres/types.d.ts.map +0 -1
- package/cjs/drivers/sql/index.d.ts +0 -10
- package/cjs/drivers/sql/index.d.ts.map +0 -1
- package/cjs/drivers/sql/sql-dialect.contract.d.ts +0 -204
- package/cjs/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
- package/cjs/drivers/sql/sql-types.d.ts +0 -202
- package/cjs/drivers/sql/sql-types.d.ts.map +0 -1
- package/cjs/errors/missing-data-source.error.d.ts +0 -22
- package/cjs/errors/missing-data-source.error.d.ts.map +0 -1
- package/cjs/errors/missing-data-source.error.js +0 -29
- package/cjs/errors/missing-data-source.error.js.map +0 -1
- package/cjs/errors/transaction-rollback.error.d.ts +0 -20
- package/cjs/errors/transaction-rollback.error.d.ts.map +0 -1
- package/cjs/errors/transaction-rollback.error.js +0 -27
- package/cjs/errors/transaction-rollback.error.js.map +0 -1
- package/cjs/events/model-events.d.ts +0 -231
- package/cjs/events/model-events.d.ts.map +0 -1
- package/cjs/events/model-events.js +0 -259
- package/cjs/events/model-events.js.map +0 -1
- package/cjs/expressions/aggregate-expressions.d.ts +0 -215
- package/cjs/expressions/aggregate-expressions.d.ts.map +0 -1
- package/cjs/expressions/aggregate-expressions.js +0 -221
- package/cjs/expressions/aggregate-expressions.js.map +0 -1
- package/cjs/expressions/index.d.ts +0 -2
- package/cjs/expressions/index.d.ts.map +0 -1
- package/cjs/index.d.ts +0 -45
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/migration/column-builder.d.ts +0 -417
- package/cjs/migration/column-builder.d.ts.map +0 -1
- package/cjs/migration/column-builder.js +0 -586
- package/cjs/migration/column-builder.js.map +0 -1
- package/cjs/migration/column-helpers.d.ts +0 -275
- package/cjs/migration/column-helpers.d.ts.map +0 -1
- package/cjs/migration/column-helpers.js +0 -389
- package/cjs/migration/column-helpers.js.map +0 -1
- package/cjs/migration/foreign-key-builder.d.ts +0 -103
- package/cjs/migration/foreign-key-builder.d.ts.map +0 -1
- package/cjs/migration/foreign-key-builder.js +0 -121
- package/cjs/migration/foreign-key-builder.js.map +0 -1
- package/cjs/migration/index.d.ts +0 -7
- package/cjs/migration/index.d.ts.map +0 -1
- package/cjs/migration/migration-runner.d.ts +0 -278
- package/cjs/migration/migration-runner.d.ts.map +0 -1
- package/cjs/migration/migration-runner.js +0 -815
- package/cjs/migration/migration-runner.js.map +0 -1
- package/cjs/migration/migration.d.ts +0 -1988
- package/cjs/migration/migration.d.ts.map +0 -1
- package/cjs/migration/migration.js +0 -2162
- package/cjs/migration/migration.js.map +0 -1
- package/cjs/migration/sql-grammar.d.ts +0 -61
- package/cjs/migration/sql-grammar.d.ts.map +0 -1
- package/cjs/migration/sql-grammar.js +0 -164
- package/cjs/migration/sql-grammar.js.map +0 -1
- package/cjs/migration/sql-serializer.d.ts +0 -22
- package/cjs/migration/sql-serializer.d.ts.map +0 -1
- package/cjs/migration/sql-serializer.js +0 -26
- package/cjs/migration/sql-serializer.js.map +0 -1
- package/cjs/migration/types.d.ts +0 -155
- package/cjs/migration/types.d.ts.map +0 -1
- package/cjs/model/methods/accessor-methods.d.ts +0 -13
- package/cjs/model/methods/accessor-methods.d.ts.map +0 -1
- package/cjs/model/methods/accessor-methods.js +0 -51
- package/cjs/model/methods/accessor-methods.js.map +0 -1
- package/cjs/model/methods/delete-methods.d.ts +0 -10
- package/cjs/model/methods/delete-methods.d.ts.map +0 -1
- package/cjs/model/methods/delete-methods.js +0 -10
- package/cjs/model/methods/delete-methods.js.map +0 -1
- package/cjs/model/methods/dirty-methods.d.ts +0 -10
- package/cjs/model/methods/dirty-methods.d.ts.map +0 -1
- package/cjs/model/methods/dirty-methods.js +0 -15
- package/cjs/model/methods/dirty-methods.js.map +0 -1
- package/cjs/model/methods/hydration-methods.d.ts +0 -10
- package/cjs/model/methods/hydration-methods.d.ts.map +0 -1
- package/cjs/model/methods/hydration-methods.js +0 -57
- package/cjs/model/methods/hydration-methods.js.map +0 -1
- package/cjs/model/methods/instance-event-methods.d.ts +0 -7
- package/cjs/model/methods/instance-event-methods.d.ts.map +0 -1
- package/cjs/model/methods/instance-event-methods.js +0 -15
- package/cjs/model/methods/instance-event-methods.js.map +0 -1
- package/cjs/model/methods/meta-methods.d.ts +0 -7
- package/cjs/model/methods/meta-methods.d.ts.map +0 -1
- package/cjs/model/methods/meta-methods.js +0 -78
- package/cjs/model/methods/meta-methods.js.map +0 -1
- package/cjs/model/methods/query-methods.d.ts +0 -24
- package/cjs/model/methods/query-methods.d.ts.map +0 -1
- package/cjs/model/methods/query-methods.js +0 -164
- package/cjs/model/methods/query-methods.js.map +0 -1
- package/cjs/model/methods/restore-methods.d.ts +0 -10
- package/cjs/model/methods/restore-methods.d.ts.map +0 -1
- package/cjs/model/methods/restore-methods.js +0 -13
- package/cjs/model/methods/restore-methods.js.map +0 -1
- package/cjs/model/methods/scope-methods.d.ts +0 -7
- package/cjs/model/methods/scope-methods.d.ts.map +0 -1
- package/cjs/model/methods/scope-methods.js +0 -15
- package/cjs/model/methods/scope-methods.js.map +0 -1
- package/cjs/model/methods/serialization-methods.d.ts +0 -3
- package/cjs/model/methods/serialization-methods.d.ts.map +0 -1
- package/cjs/model/methods/serialization-methods.js +0 -27
- package/cjs/model/methods/serialization-methods.js.map +0 -1
- package/cjs/model/methods/static-event-methods.d.ts +0 -9
- package/cjs/model/methods/static-event-methods.d.ts.map +0 -1
- package/cjs/model/methods/static-event-methods.js +0 -29
- package/cjs/model/methods/static-event-methods.js.map +0 -1
- package/cjs/model/methods/write-methods.d.ts +0 -10
- package/cjs/model/methods/write-methods.d.ts.map +0 -1
- package/cjs/model/methods/write-methods.js +0 -52
- package/cjs/model/methods/write-methods.js.map +0 -1
- package/cjs/model/model.d.ts +0 -1647
- package/cjs/model/model.d.ts.map +0 -1
- package/cjs/model/model.js +0 -1657
- package/cjs/model/model.js.map +0 -1
- package/cjs/model/model.types.d.ts +0 -44
- package/cjs/model/model.types.d.ts.map +0 -1
- package/cjs/model/register-model.d.ts +0 -81
- package/cjs/model/register-model.d.ts.map +0 -1
- package/cjs/model/register-model.js +0 -94
- package/cjs/model/register-model.js.map +0 -1
- package/cjs/query-builder/query-builder.d.ts +0 -556
- package/cjs/query-builder/query-builder.d.ts.map +0 -1
- package/cjs/query-builder/query-builder.js +0 -1070
- package/cjs/query-builder/query-builder.js.map +0 -1
- package/cjs/relations/helpers.d.ts +0 -156
- package/cjs/relations/helpers.d.ts.map +0 -1
- package/cjs/relations/helpers.js +0 -202
- package/cjs/relations/helpers.js.map +0 -1
- package/cjs/relations/index.d.ts +0 -35
- package/cjs/relations/index.d.ts.map +0 -1
- package/cjs/relations/pivot-operations.d.ts +0 -160
- package/cjs/relations/pivot-operations.d.ts.map +0 -1
- package/cjs/relations/pivot-operations.js +0 -293
- package/cjs/relations/pivot-operations.js.map +0 -1
- package/cjs/relations/relation-hydrator.d.ts +0 -68
- package/cjs/relations/relation-hydrator.d.ts.map +0 -1
- package/cjs/relations/relation-hydrator.js +0 -81
- package/cjs/relations/relation-hydrator.js.map +0 -1
- package/cjs/relations/relation-loader.d.ts +0 -194
- package/cjs/relations/relation-loader.d.ts.map +0 -1
- package/cjs/relations/relation-loader.js +0 -466
- package/cjs/relations/relation-loader.js.map +0 -1
- package/cjs/relations/types.d.ts +0 -306
- package/cjs/relations/types.d.ts.map +0 -1
- package/cjs/remover/database-remover.d.ts +0 -100
- package/cjs/remover/database-remover.d.ts.map +0 -1
- package/cjs/remover/database-remover.js +0 -214
- package/cjs/remover/database-remover.js.map +0 -1
- package/cjs/restorer/database-restorer.d.ts +0 -131
- package/cjs/restorer/database-restorer.d.ts.map +0 -1
- package/cjs/restorer/database-restorer.js +0 -434
- package/cjs/restorer/database-restorer.js.map +0 -1
- package/cjs/sql-database-dirty-tracker.d.ts +0 -13
- package/cjs/sql-database-dirty-tracker.d.ts.map +0 -1
- package/cjs/sql-database-dirty-tracker.js +0 -14
- package/cjs/sql-database-dirty-tracker.js.map +0 -1
- package/cjs/sync/index.d.ts +0 -12
- package/cjs/sync/index.d.ts.map +0 -1
- package/cjs/sync/model-events.d.ts +0 -62
- package/cjs/sync/model-events.d.ts.map +0 -1
- package/cjs/sync/model-events.js +0 -49
- package/cjs/sync/model-events.js.map +0 -1
- package/cjs/sync/model-sync-operation.d.ts +0 -163
- package/cjs/sync/model-sync-operation.d.ts.map +0 -1
- package/cjs/sync/model-sync-operation.js +0 -292
- package/cjs/sync/model-sync-operation.js.map +0 -1
- package/cjs/sync/model-sync.d.ts +0 -130
- package/cjs/sync/model-sync.d.ts.map +0 -1
- package/cjs/sync/model-sync.js +0 -178
- package/cjs/sync/model-sync.js.map +0 -1
- package/cjs/sync/sync-context.d.ts +0 -70
- package/cjs/sync/sync-context.d.ts.map +0 -1
- package/cjs/sync/sync-context.js +0 -101
- package/cjs/sync/sync-context.js.map +0 -1
- package/cjs/sync/sync-manager.d.ts +0 -213
- package/cjs/sync/sync-manager.d.ts.map +0 -1
- package/cjs/sync/sync-manager.js +0 -689
- package/cjs/sync/sync-manager.js.map +0 -1
- package/cjs/sync/types.d.ts +0 -289
- package/cjs/sync/types.d.ts.map +0 -1
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts +0 -15
- package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
- package/cjs/types.d.ts +0 -371
- package/cjs/types.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.d.ts +0 -307
- package/cjs/utils/connect-to-database.d.ts.map +0 -1
- package/cjs/utils/connect-to-database.js +0 -130
- package/cjs/utils/connect-to-database.js.map +0 -1
- package/cjs/utils/database-writer.utils.d.ts +0 -15
- package/cjs/utils/database-writer.utils.d.ts.map +0 -1
- package/cjs/utils/database-writer.utils.js +0 -14
- package/cjs/utils/database-writer.utils.js.map +0 -1
- package/cjs/utils/define-model.js +0 -100
- package/cjs/utils/define-model.js.map +0 -1
- package/cjs/utils/is-valid-date-value.d.ts +0 -5
- package/cjs/utils/is-valid-date-value.d.ts.map +0 -1
- package/cjs/utils/is-valid-date-value.js +0 -25
- package/cjs/utils/is-valid-date-value.js.map +0 -1
- package/cjs/utils/once-connected.d.ts +0 -146
- package/cjs/utils/once-connected.d.ts.map +0 -1
- package/cjs/utils/once-connected.js +0 -251
- package/cjs/utils/once-connected.js.map +0 -1
- package/cjs/validation/database-seal-plugins.d.ts +0 -12
- package/cjs/validation/database-seal-plugins.d.ts.map +0 -1
- package/cjs/validation/database-seal-plugins.js +0 -1
- package/cjs/validation/database-seal-plugins.js.map +0 -1
- package/cjs/validation/database-writer-validation-error.d.ts +0 -97
- package/cjs/validation/database-writer-validation-error.d.ts.map +0 -1
- package/cjs/validation/database-writer-validation-error.js +0 -160
- package/cjs/validation/database-writer-validation-error.js.map +0 -1
- package/cjs/validation/index.d.ts +0 -3
- package/cjs/validation/index.d.ts.map +0 -1
- package/cjs/validation/mutators/embed-mutator.d.ts +0 -9
- package/cjs/validation/mutators/embed-mutator.d.ts.map +0 -1
- package/cjs/validation/mutators/embed-mutator.js +0 -33
- package/cjs/validation/mutators/embed-mutator.js.map +0 -1
- package/cjs/validation/plugins/embed-validator-plugin.d.ts +0 -24
- package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
- package/cjs/validation/plugins/embed-validator-plugin.js +0 -18
- package/cjs/validation/plugins/embed-validator-plugin.js.map +0 -1
- package/cjs/validation/rules/database-model-rule.d.ts +0 -7
- package/cjs/validation/rules/database-model-rule.d.ts.map +0 -1
- package/cjs/validation/rules/database-model-rule.js +0 -27
- package/cjs/validation/rules/database-model-rule.js.map +0 -1
- package/cjs/validation/transformers/embed-model-transformer.d.ts +0 -3
- package/cjs/validation/transformers/embed-model-transformer.d.ts.map +0 -1
- package/cjs/validation/transformers/embed-model-transformer.js +0 -18
- package/cjs/validation/transformers/embed-model-transformer.js.map +0 -1
- package/cjs/validation/validators/embed-validator.d.ts +0 -21
- package/cjs/validation/validators/embed-validator.d.ts.map +0 -1
- package/cjs/validation/validators/embed-validator.js +0 -43
- package/cjs/validation/validators/embed-validator.js.map +0 -1
- package/cjs/writer/database-writer.d.ts +0 -174
- package/cjs/writer/database-writer.d.ts.map +0 -1
- package/cjs/writer/database-writer.js +0 -400
- package/cjs/writer/database-writer.js.map +0 -1
- package/esm/context/database-data-source-context.d.ts +0 -29
- package/esm/context/database-data-source-context.d.ts.map +0 -1
- package/esm/context/database-data-source-context.js +0 -28
- package/esm/context/database-data-source-context.js.map +0 -1
- package/esm/context/database-transaction-context.d.ts +0 -35
- package/esm/context/database-transaction-context.d.ts.map +0 -1
- package/esm/context/database-transaction-context.js +0 -40
- package/esm/context/database-transaction-context.js.map +0 -1
- package/esm/contracts/database-driver.contract.d.ts +0 -450
- package/esm/contracts/database-driver.contract.d.ts.map +0 -1
- package/esm/contracts/database-id-generator.contract.d.ts +0 -109
- package/esm/contracts/database-id-generator.contract.d.ts.map +0 -1
- package/esm/contracts/database-remover.contract.d.ts +0 -104
- package/esm/contracts/database-remover.contract.d.ts.map +0 -1
- package/esm/contracts/database-restorer.contract.d.ts +0 -143
- package/esm/contracts/database-restorer.contract.d.ts.map +0 -1
- package/esm/contracts/database-writer.contract.d.ts +0 -119
- package/esm/contracts/database-writer.contract.d.ts.map +0 -1
- package/esm/contracts/driver-blueprint.contract.d.ts +0 -49
- package/esm/contracts/driver-blueprint.contract.d.ts.map +0 -1
- package/esm/contracts/index.d.ts +0 -10
- package/esm/contracts/index.d.ts.map +0 -1
- package/esm/contracts/migration-driver.contract.d.ts +0 -522
- package/esm/contracts/migration-driver.contract.d.ts.map +0 -1
- package/esm/contracts/query-builder.contract.d.ts +0 -1609
- package/esm/contracts/query-builder.contract.d.ts.map +0 -1
- package/esm/contracts/sync-adapter.contract.d.ts +0 -58
- package/esm/contracts/sync-adapter.contract.d.ts.map +0 -1
- package/esm/data-source/data-source-registry.d.ts +0 -108
- package/esm/data-source/data-source-registry.d.ts.map +0 -1
- package/esm/data-source/data-source-registry.js +0 -145
- package/esm/data-source/data-source-registry.js.map +0 -1
- package/esm/data-source/data-source.d.ts +0 -147
- package/esm/data-source/data-source.d.ts.map +0 -1
- package/esm/data-source/data-source.js +0 -83
- package/esm/data-source/data-source.js.map +0 -1
- package/esm/database-dirty-tracker.d.ts +0 -252
- package/esm/database-dirty-tracker.d.ts.map +0 -1
- package/esm/database-dirty-tracker.js +0 -386
- package/esm/database-dirty-tracker.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
- package/esm/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-blueprint.js +0 -51
- package/esm/drivers/mongodb/mongodb-blueprint.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.d.ts +0 -325
- package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-driver.js +0 -845
- package/esm/drivers/mongodb/mongodb-driver.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
- package/esm/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-id-generator.js +0 -149
- package/esm/drivers/mongodb/mongodb-id-generator.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
- package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-migration-driver.js +0 -666
- package/esm/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
- package/esm/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-builder.js +0 -1988
- package/esm/drivers/mongodb/mongodb-query-builder.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
- package/esm/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-operations.js +0 -270
- package/esm/drivers/mongodb/mongodb-query-operations.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
- package/esm/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-query-parser.js +0 -1351
- package/esm/drivers/mongodb/mongodb-query-parser.js.map +0 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
- package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
- package/esm/drivers/mongodb/mongodb-sync-adapter.js +0 -146
- package/esm/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
- package/esm/drivers/mongodb/types.d.ts +0 -43
- package/esm/drivers/mongodb/types.d.ts.map +0 -1
- package/esm/drivers/postgres/index.d.ts +0 -16
- package/esm/drivers/postgres/index.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-blueprint.d.ts +0 -64
- package/esm/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-blueprint.js +0 -121
- package/esm/drivers/postgres/postgres-blueprint.js.map +0 -1
- package/esm/drivers/postgres/postgres-dialect.d.ts +0 -136
- package/esm/drivers/postgres/postgres-dialect.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-dialect.js +0 -268
- package/esm/drivers/postgres/postgres-dialect.js.map +0 -1
- package/esm/drivers/postgres/postgres-driver.d.ts +0 -432
- package/esm/drivers/postgres/postgres-driver.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-driver.js +0 -1008
- package/esm/drivers/postgres/postgres-driver.js.map +0 -1
- package/esm/drivers/postgres/postgres-migration-driver.d.ts +0 -397
- package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-migration-driver.js +0 -900
- package/esm/drivers/postgres/postgres-migration-driver.js.map +0 -1
- package/esm/drivers/postgres/postgres-query-builder.d.ts +0 -254
- package/esm/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-query-builder.js +0 -933
- package/esm/drivers/postgres/postgres-query-builder.js.map +0 -1
- package/esm/drivers/postgres/postgres-query-parser.d.ts +0 -328
- package/esm/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-query-parser.js +0 -868
- package/esm/drivers/postgres/postgres-query-parser.js.map +0 -1
- package/esm/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
- package/esm/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-sql-serializer.js +0 -400
- package/esm/drivers/postgres/postgres-sql-serializer.js.map +0 -1
- package/esm/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
- package/esm/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
- package/esm/drivers/postgres/postgres-sync-adapter.js +0 -204
- package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
- package/esm/drivers/postgres/types.d.ts +0 -144
- package/esm/drivers/postgres/types.d.ts.map +0 -1
- package/esm/drivers/sql/index.d.ts +0 -10
- package/esm/drivers/sql/index.d.ts.map +0 -1
- package/esm/drivers/sql/sql-dialect.contract.d.ts +0 -204
- package/esm/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
- package/esm/drivers/sql/sql-types.d.ts +0 -202
- package/esm/drivers/sql/sql-types.d.ts.map +0 -1
- package/esm/errors/missing-data-source.error.d.ts +0 -22
- package/esm/errors/missing-data-source.error.d.ts.map +0 -1
- package/esm/errors/missing-data-source.error.js +0 -29
- package/esm/errors/missing-data-source.error.js.map +0 -1
- package/esm/errors/transaction-rollback.error.d.ts +0 -20
- package/esm/errors/transaction-rollback.error.d.ts.map +0 -1
- package/esm/errors/transaction-rollback.error.js +0 -27
- package/esm/errors/transaction-rollback.error.js.map +0 -1
- package/esm/events/model-events.d.ts +0 -231
- package/esm/events/model-events.d.ts.map +0 -1
- package/esm/events/model-events.js +0 -259
- package/esm/events/model-events.js.map +0 -1
- package/esm/expressions/aggregate-expressions.d.ts +0 -215
- package/esm/expressions/aggregate-expressions.d.ts.map +0 -1
- package/esm/expressions/aggregate-expressions.js +0 -221
- package/esm/expressions/aggregate-expressions.js.map +0 -1
- package/esm/expressions/index.d.ts +0 -2
- package/esm/expressions/index.d.ts.map +0 -1
- package/esm/index.d.ts +0 -45
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +0 -1
- package/esm/migration/column-builder.d.ts +0 -417
- package/esm/migration/column-builder.d.ts.map +0 -1
- package/esm/migration/column-builder.js +0 -586
- package/esm/migration/column-builder.js.map +0 -1
- package/esm/migration/column-helpers.d.ts +0 -275
- package/esm/migration/column-helpers.d.ts.map +0 -1
- package/esm/migration/column-helpers.js +0 -389
- package/esm/migration/column-helpers.js.map +0 -1
- package/esm/migration/foreign-key-builder.d.ts +0 -103
- package/esm/migration/foreign-key-builder.d.ts.map +0 -1
- package/esm/migration/foreign-key-builder.js +0 -121
- package/esm/migration/foreign-key-builder.js.map +0 -1
- package/esm/migration/index.d.ts +0 -7
- package/esm/migration/index.d.ts.map +0 -1
- package/esm/migration/migration-runner.d.ts +0 -278
- package/esm/migration/migration-runner.d.ts.map +0 -1
- package/esm/migration/migration-runner.js +0 -815
- package/esm/migration/migration-runner.js.map +0 -1
- package/esm/migration/migration.d.ts +0 -1988
- package/esm/migration/migration.d.ts.map +0 -1
- package/esm/migration/migration.js +0 -2162
- package/esm/migration/migration.js.map +0 -1
- package/esm/migration/sql-grammar.d.ts +0 -61
- package/esm/migration/sql-grammar.d.ts.map +0 -1
- package/esm/migration/sql-grammar.js +0 -164
- package/esm/migration/sql-grammar.js.map +0 -1
- package/esm/migration/sql-serializer.d.ts +0 -22
- package/esm/migration/sql-serializer.d.ts.map +0 -1
- package/esm/migration/sql-serializer.js +0 -26
- package/esm/migration/sql-serializer.js.map +0 -1
- package/esm/migration/types.d.ts +0 -155
- package/esm/migration/types.d.ts.map +0 -1
- package/esm/model/methods/accessor-methods.d.ts +0 -13
- package/esm/model/methods/accessor-methods.d.ts.map +0 -1
- package/esm/model/methods/accessor-methods.js +0 -51
- package/esm/model/methods/accessor-methods.js.map +0 -1
- package/esm/model/methods/delete-methods.d.ts +0 -10
- package/esm/model/methods/delete-methods.d.ts.map +0 -1
- package/esm/model/methods/delete-methods.js +0 -10
- package/esm/model/methods/delete-methods.js.map +0 -1
- package/esm/model/methods/dirty-methods.d.ts +0 -10
- package/esm/model/methods/dirty-methods.d.ts.map +0 -1
- package/esm/model/methods/dirty-methods.js +0 -15
- package/esm/model/methods/dirty-methods.js.map +0 -1
- package/esm/model/methods/hydration-methods.d.ts +0 -10
- package/esm/model/methods/hydration-methods.d.ts.map +0 -1
- package/esm/model/methods/hydration-methods.js +0 -57
- package/esm/model/methods/hydration-methods.js.map +0 -1
- package/esm/model/methods/instance-event-methods.d.ts +0 -7
- package/esm/model/methods/instance-event-methods.d.ts.map +0 -1
- package/esm/model/methods/instance-event-methods.js +0 -15
- package/esm/model/methods/instance-event-methods.js.map +0 -1
- package/esm/model/methods/meta-methods.d.ts +0 -7
- package/esm/model/methods/meta-methods.d.ts.map +0 -1
- package/esm/model/methods/meta-methods.js +0 -78
- package/esm/model/methods/meta-methods.js.map +0 -1
- package/esm/model/methods/query-methods.d.ts +0 -24
- package/esm/model/methods/query-methods.d.ts.map +0 -1
- package/esm/model/methods/query-methods.js +0 -164
- package/esm/model/methods/query-methods.js.map +0 -1
- package/esm/model/methods/restore-methods.d.ts +0 -10
- package/esm/model/methods/restore-methods.d.ts.map +0 -1
- package/esm/model/methods/restore-methods.js +0 -13
- package/esm/model/methods/restore-methods.js.map +0 -1
- package/esm/model/methods/scope-methods.d.ts +0 -7
- package/esm/model/methods/scope-methods.d.ts.map +0 -1
- package/esm/model/methods/scope-methods.js +0 -15
- package/esm/model/methods/scope-methods.js.map +0 -1
- package/esm/model/methods/serialization-methods.d.ts +0 -3
- package/esm/model/methods/serialization-methods.d.ts.map +0 -1
- package/esm/model/methods/serialization-methods.js +0 -27
- package/esm/model/methods/serialization-methods.js.map +0 -1
- package/esm/model/methods/static-event-methods.d.ts +0 -9
- package/esm/model/methods/static-event-methods.d.ts.map +0 -1
- package/esm/model/methods/static-event-methods.js +0 -29
- package/esm/model/methods/static-event-methods.js.map +0 -1
- package/esm/model/methods/write-methods.d.ts +0 -10
- package/esm/model/methods/write-methods.d.ts.map +0 -1
- package/esm/model/methods/write-methods.js +0 -52
- package/esm/model/methods/write-methods.js.map +0 -1
- package/esm/model/model.d.ts +0 -1647
- package/esm/model/model.d.ts.map +0 -1
- package/esm/model/model.js +0 -1657
- package/esm/model/model.js.map +0 -1
- package/esm/model/model.types.d.ts +0 -44
- package/esm/model/model.types.d.ts.map +0 -1
- package/esm/model/register-model.d.ts +0 -81
- package/esm/model/register-model.d.ts.map +0 -1
- package/esm/model/register-model.js +0 -94
- package/esm/model/register-model.js.map +0 -1
- package/esm/query-builder/query-builder.d.ts +0 -556
- package/esm/query-builder/query-builder.d.ts.map +0 -1
- package/esm/query-builder/query-builder.js +0 -1070
- package/esm/query-builder/query-builder.js.map +0 -1
- package/esm/relations/helpers.d.ts +0 -156
- package/esm/relations/helpers.d.ts.map +0 -1
- package/esm/relations/helpers.js +0 -202
- package/esm/relations/helpers.js.map +0 -1
- package/esm/relations/index.d.ts +0 -35
- package/esm/relations/index.d.ts.map +0 -1
- package/esm/relations/pivot-operations.d.ts +0 -160
- package/esm/relations/pivot-operations.d.ts.map +0 -1
- package/esm/relations/pivot-operations.js +0 -293
- package/esm/relations/pivot-operations.js.map +0 -1
- package/esm/relations/relation-hydrator.d.ts +0 -68
- package/esm/relations/relation-hydrator.d.ts.map +0 -1
- package/esm/relations/relation-hydrator.js +0 -81
- package/esm/relations/relation-hydrator.js.map +0 -1
- package/esm/relations/relation-loader.d.ts +0 -194
- package/esm/relations/relation-loader.d.ts.map +0 -1
- package/esm/relations/relation-loader.js +0 -466
- package/esm/relations/relation-loader.js.map +0 -1
- package/esm/relations/types.d.ts +0 -306
- package/esm/relations/types.d.ts.map +0 -1
- package/esm/remover/database-remover.d.ts +0 -100
- package/esm/remover/database-remover.d.ts.map +0 -1
- package/esm/remover/database-remover.js +0 -214
- package/esm/remover/database-remover.js.map +0 -1
- package/esm/restorer/database-restorer.d.ts +0 -131
- package/esm/restorer/database-restorer.d.ts.map +0 -1
- package/esm/restorer/database-restorer.js +0 -434
- package/esm/restorer/database-restorer.js.map +0 -1
- package/esm/sql-database-dirty-tracker.d.ts +0 -13
- package/esm/sql-database-dirty-tracker.d.ts.map +0 -1
- package/esm/sql-database-dirty-tracker.js +0 -14
- package/esm/sql-database-dirty-tracker.js.map +0 -1
- package/esm/sync/index.d.ts +0 -12
- package/esm/sync/index.d.ts.map +0 -1
- package/esm/sync/model-events.d.ts +0 -62
- package/esm/sync/model-events.d.ts.map +0 -1
- package/esm/sync/model-events.js +0 -49
- package/esm/sync/model-events.js.map +0 -1
- package/esm/sync/model-sync-operation.d.ts +0 -163
- package/esm/sync/model-sync-operation.d.ts.map +0 -1
- package/esm/sync/model-sync-operation.js +0 -292
- package/esm/sync/model-sync-operation.js.map +0 -1
- package/esm/sync/model-sync.d.ts +0 -130
- package/esm/sync/model-sync.d.ts.map +0 -1
- package/esm/sync/model-sync.js +0 -178
- package/esm/sync/model-sync.js.map +0 -1
- package/esm/sync/sync-context.d.ts +0 -70
- package/esm/sync/sync-context.d.ts.map +0 -1
- package/esm/sync/sync-context.js +0 -101
- package/esm/sync/sync-context.js.map +0 -1
- package/esm/sync/sync-manager.d.ts +0 -213
- package/esm/sync/sync-manager.d.ts.map +0 -1
- package/esm/sync/sync-manager.js +0 -689
- package/esm/sync/sync-manager.js.map +0 -1
- package/esm/sync/types.d.ts +0 -289
- package/esm/sync/types.d.ts.map +0 -1
- package/esm/test-migrations/test-enhanced-features.migration.d.ts +0 -15
- package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
- package/esm/types.d.ts +0 -371
- package/esm/types.d.ts.map +0 -1
- package/esm/utils/connect-to-database.d.ts +0 -307
- package/esm/utils/connect-to-database.d.ts.map +0 -1
- package/esm/utils/connect-to-database.js +0 -130
- package/esm/utils/connect-to-database.js.map +0 -1
- package/esm/utils/database-writer.utils.d.ts +0 -15
- package/esm/utils/database-writer.utils.d.ts.map +0 -1
- package/esm/utils/database-writer.utils.js +0 -14
- package/esm/utils/database-writer.utils.js.map +0 -1
- package/esm/utils/define-model.js +0 -100
- package/esm/utils/define-model.js.map +0 -1
- package/esm/utils/is-valid-date-value.d.ts +0 -5
- package/esm/utils/is-valid-date-value.d.ts.map +0 -1
- package/esm/utils/is-valid-date-value.js +0 -25
- package/esm/utils/is-valid-date-value.js.map +0 -1
- package/esm/utils/once-connected.d.ts +0 -146
- package/esm/utils/once-connected.d.ts.map +0 -1
- package/esm/utils/once-connected.js +0 -251
- package/esm/utils/once-connected.js.map +0 -1
- package/esm/validation/database-seal-plugins.d.ts +0 -12
- package/esm/validation/database-seal-plugins.d.ts.map +0 -1
- package/esm/validation/database-seal-plugins.js +0 -1
- package/esm/validation/database-seal-plugins.js.map +0 -1
- package/esm/validation/database-writer-validation-error.d.ts +0 -97
- package/esm/validation/database-writer-validation-error.d.ts.map +0 -1
- package/esm/validation/database-writer-validation-error.js +0 -160
- package/esm/validation/database-writer-validation-error.js.map +0 -1
- package/esm/validation/index.d.ts +0 -3
- package/esm/validation/index.d.ts.map +0 -1
- package/esm/validation/mutators/embed-mutator.d.ts +0 -9
- package/esm/validation/mutators/embed-mutator.d.ts.map +0 -1
- package/esm/validation/mutators/embed-mutator.js +0 -33
- package/esm/validation/mutators/embed-mutator.js.map +0 -1
- package/esm/validation/plugins/embed-validator-plugin.d.ts +0 -24
- package/esm/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
- package/esm/validation/plugins/embed-validator-plugin.js +0 -18
- package/esm/validation/plugins/embed-validator-plugin.js.map +0 -1
- package/esm/validation/rules/database-model-rule.d.ts +0 -7
- package/esm/validation/rules/database-model-rule.d.ts.map +0 -1
- package/esm/validation/rules/database-model-rule.js +0 -27
- package/esm/validation/rules/database-model-rule.js.map +0 -1
- package/esm/validation/transformers/embed-model-transformer.d.ts +0 -3
- package/esm/validation/transformers/embed-model-transformer.d.ts.map +0 -1
- package/esm/validation/transformers/embed-model-transformer.js +0 -18
- package/esm/validation/transformers/embed-model-transformer.js.map +0 -1
- package/esm/validation/validators/embed-validator.d.ts +0 -21
- package/esm/validation/validators/embed-validator.d.ts.map +0 -1
- package/esm/validation/validators/embed-validator.js +0 -43
- package/esm/validation/validators/embed-validator.js.map +0 -1
- package/esm/writer/database-writer.d.ts +0 -174
- package/esm/writer/database-writer.d.ts.map +0 -1
- package/esm/writer/database-writer.js +0 -400
- package/esm/writer/database-writer.js.map +0 -1
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
//#region ../../@warlock.js/cascade/src/drivers/mongodb/mongodb-query-operations.ts
|
|
2
|
+
/**
|
|
3
|
+
* Helper class for constructing MongoDB aggregation pipeline operations.
|
|
4
|
+
*
|
|
5
|
+
* This class encapsulates the logic for creating operation objects that will be
|
|
6
|
+
* converted to MongoDB aggregation stages by the query parser. It provides a
|
|
7
|
+
* clean abstraction over the low-level operation structure, making the query
|
|
8
|
+
* builder code more maintainable and testable.
|
|
9
|
+
*
|
|
10
|
+
* Each operation consists of:
|
|
11
|
+
* - **stage**: The MongoDB aggregation stage name (e.g., "$match", "$project")
|
|
12
|
+
* - **type**: An internal identifier for the operation type
|
|
13
|
+
* - **data**: The data associated with the operation
|
|
14
|
+
* - **mergeable**: Whether this operation can be merged with adjacent similar operations
|
|
15
|
+
*
|
|
16
|
+
* @internal This class is for internal use within the MongoDB driver
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const operations: Operation[] = [];
|
|
21
|
+
* const helper = new MongoQueryOperations(operations);
|
|
22
|
+
*
|
|
23
|
+
* // Add a match operation
|
|
24
|
+
* helper.addMatchOperation("whereIn", { field: "status", values: ["active", "pending"] });
|
|
25
|
+
*
|
|
26
|
+
* // Add a project operation
|
|
27
|
+
* helper.addProjectOperation("select", { fields: ["name", "email"] });
|
|
28
|
+
*
|
|
29
|
+
* // Operations array is now populated
|
|
30
|
+
* console.log(operations);
|
|
31
|
+
* // [
|
|
32
|
+
* // { stage: "$match", mergeable: true, type: "whereIn", data: {...} },
|
|
33
|
+
* // { stage: "$project", mergeable: true, type: "select", data: {...} }
|
|
34
|
+
* // ]
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
var MongoQueryOperations = class {
|
|
38
|
+
operations;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new operations helper.
|
|
41
|
+
*
|
|
42
|
+
* The helper maintains a reference to the operations array and populates it
|
|
43
|
+
* as methods are called. This allows the query builder to maintain a single
|
|
44
|
+
* ordered list of operations that will be converted to a MongoDB aggregation
|
|
45
|
+
* pipeline.
|
|
46
|
+
*
|
|
47
|
+
* @param operations - Reference to the operations array to populate
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const operations: Operation[] = [];
|
|
52
|
+
* const helper = new MongoQueryOperations(operations);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
constructor(operations) {
|
|
56
|
+
this.operations = operations;
|
|
57
|
+
}
|
|
58
|
+
setOperations(operations) {
|
|
59
|
+
this.operations = operations;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Adds a $match stage operation to the pipeline.
|
|
63
|
+
*
|
|
64
|
+
* Match operations filter documents in the aggregation pipeline, similar to
|
|
65
|
+
* the WHERE clause in SQL. Multiple match operations can be merged together
|
|
66
|
+
* by the parser for optimization.
|
|
67
|
+
*
|
|
68
|
+
* @param type - The operation type identifier (e.g., "where", "whereIn", "whereLike")
|
|
69
|
+
* @param data - The operation data data containing filter criteria
|
|
70
|
+
* @param mergeable - Whether this operation can be merged with adjacent match operations (default: true)
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Simple where operation
|
|
75
|
+
* helper.addMatchOperation("where", { field: "age", operator: ">", value: 18 });
|
|
76
|
+
*
|
|
77
|
+
* // WhereIn operation
|
|
78
|
+
* helper.addMatchOperation("whereIn", { field: "status", values: ["active", "pending"] });
|
|
79
|
+
*
|
|
80
|
+
* // Non-mergeable match (e.g., after a group stage)
|
|
81
|
+
* helper.addMatchOperation("having", { field: "count", operator: ">", value: 5 }, false);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
addMatchOperation(type, data, mergeable = true) {
|
|
85
|
+
this.operations.push({
|
|
86
|
+
stage: "$match",
|
|
87
|
+
mergeable,
|
|
88
|
+
type,
|
|
89
|
+
data
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Adds a $project stage operation to the pipeline.
|
|
94
|
+
*
|
|
95
|
+
* Project operations control which fields are included or excluded in the
|
|
96
|
+
* output documents, similar to the SELECT clause in SQL. They can also be
|
|
97
|
+
* used to compute new fields or reshape documents.
|
|
98
|
+
*
|
|
99
|
+
* @param type - The operation type identifier (e.g., "select", "deselect", "selectRaw")
|
|
100
|
+
* @param data - The operation data data containing projection specifications
|
|
101
|
+
* @param mergeable - Whether this operation can be merged with adjacent project operations (default: true)
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Select specific fields
|
|
106
|
+
* helper.addProjectOperation("select", { fields: ["name", "email", "age"] });
|
|
107
|
+
*
|
|
108
|
+
* // Deselect fields
|
|
109
|
+
* helper.addProjectOperation("deselect", { fields: ["password", "secret"] });
|
|
110
|
+
*
|
|
111
|
+
* // Computed field
|
|
112
|
+
* helper.addProjectOperation("selectRaw", {
|
|
113
|
+
* expression: { fullName: { $concat: ["$firstName", " ", "$lastName"] } }
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
addProjectOperation(type, data, mergeable = true) {
|
|
118
|
+
this.operations.push({
|
|
119
|
+
stage: "$project",
|
|
120
|
+
mergeable,
|
|
121
|
+
type,
|
|
122
|
+
data
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Adds a $sort stage operation to the pipeline.
|
|
127
|
+
*
|
|
128
|
+
* Sort operations order the documents in the pipeline, similar to the ORDER BY
|
|
129
|
+
* clause in SQL. Multiple sort operations can be merged to create compound
|
|
130
|
+
* sorting.
|
|
131
|
+
*
|
|
132
|
+
* @param type - The operation type identifier (e.g., "orderBy", "orderByRandom")
|
|
133
|
+
* @param data - The operation data data containing sort specifications
|
|
134
|
+
* @param mergeable - Whether this operation can be merged with adjacent sort operations (default: true)
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* // Order by a single field
|
|
139
|
+
* helper.addSortOperation("orderBy", { field: "createdAt", direction: "desc" });
|
|
140
|
+
*
|
|
141
|
+
* // Random ordering (not mergeable)
|
|
142
|
+
* helper.addSortOperation("orderByRandom", {limit: 1000}, false);
|
|
143
|
+
*
|
|
144
|
+
* // Order by raw expression
|
|
145
|
+
* helper.addSortOperation("orderByRaw", {
|
|
146
|
+
* expression: { score: -1, name: 1 }
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
addSortOperation(type, data, mergeable = true) {
|
|
151
|
+
this.operations.push({
|
|
152
|
+
stage: "$sort",
|
|
153
|
+
mergeable,
|
|
154
|
+
type,
|
|
155
|
+
data
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Adds a $group stage operation to the pipeline.
|
|
160
|
+
*
|
|
161
|
+
* Group operations aggregate documents by specified fields and compute
|
|
162
|
+
* aggregate values, similar to the GROUP BY clause in SQL. Group operations
|
|
163
|
+
* are typically not mergeable as they represent distinct aggregation boundaries.
|
|
164
|
+
*
|
|
165
|
+
* @param type - The operation type identifier (e.g., "groupBy", "distinct")
|
|
166
|
+
* @param data - The operation data data containing grouping specifications
|
|
167
|
+
* @param mergeable - Whether this operation can be merged with adjacent group operations (default: false)
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* // Group by a single field
|
|
172
|
+
* helper.addGroupOperation("groupBy", { fields: "category" });
|
|
173
|
+
*
|
|
174
|
+
* // Group by multiple fields
|
|
175
|
+
* helper.addGroupOperation("groupBy", {
|
|
176
|
+
* fields: { category: "$category", status: "$status" }
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* // Distinct operation (special case of grouping)
|
|
180
|
+
* helper.addGroupOperation("distinct", { fields: ["email"] });
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
addGroupOperation(type, data, mergeable = false) {
|
|
184
|
+
this.operations.push({
|
|
185
|
+
stage: "$group",
|
|
186
|
+
mergeable,
|
|
187
|
+
type,
|
|
188
|
+
data
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Adds a $lookup stage operation to the pipeline.
|
|
193
|
+
*
|
|
194
|
+
* Lookup operations perform left outer joins with other collections, similar
|
|
195
|
+
* to JOIN in SQL. Lookup operations are never mergeable as each represents a
|
|
196
|
+
* distinct join operation.
|
|
197
|
+
*
|
|
198
|
+
* @param type - The operation type identifier (typically "join")
|
|
199
|
+
* @param data - The operation data data containing join specifications
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* // Simple lookup
|
|
204
|
+
* helper.addLookupOperation("join", {
|
|
205
|
+
* table: "orders",
|
|
206
|
+
* localField: "id",
|
|
207
|
+
* foreignField: "userId",
|
|
208
|
+
* alias: "userOrders"
|
|
209
|
+
* });
|
|
210
|
+
*
|
|
211
|
+
* // Lookup with pipeline
|
|
212
|
+
* helper.addLookupOperation("join", {
|
|
213
|
+
* table: "products",
|
|
214
|
+
* pipeline: [
|
|
215
|
+
* { $match: { inStock: true } },
|
|
216
|
+
* { $sort: { price: 1 } }
|
|
217
|
+
* ],
|
|
218
|
+
* alias: "availableProducts"
|
|
219
|
+
* });
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
addLookupOperation(type, data) {
|
|
223
|
+
this.operations.push({
|
|
224
|
+
stage: "$lookup",
|
|
225
|
+
mergeable: false,
|
|
226
|
+
type,
|
|
227
|
+
data
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Adds a generic stage operation to the pipeline.
|
|
232
|
+
*
|
|
233
|
+
* This method provides flexibility to add any MongoDB aggregation stage,
|
|
234
|
+
* including less common stages like $facet, $bucket, $setWindowFields, etc.
|
|
235
|
+
* Use this for operations that don't fit into the standard categories.
|
|
236
|
+
*
|
|
237
|
+
* @param stage - The MongoDB aggregation stage name (e.g., "$limit", "$skip", "$unwind")
|
|
238
|
+
* @param type - The operation type identifier
|
|
239
|
+
* @param data - The operation data data
|
|
240
|
+
* @param mergeable - Whether this operation can be merged with adjacent operations (default: false)
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* // Add a limit operation
|
|
245
|
+
* helper.addOperation("$limit", "limit", { value: 10 });
|
|
246
|
+
*
|
|
247
|
+
* // Add a skip operation
|
|
248
|
+
* helper.addOperation("$skip", "skip", { value: 20 });
|
|
249
|
+
*
|
|
250
|
+
* // Add an unwind operation
|
|
251
|
+
* helper.addOperation("$unwind", "unwind", { path: "$tags" });
|
|
252
|
+
*
|
|
253
|
+
* // Add a window function
|
|
254
|
+
* helper.addOperation("$setWindowFields", "selectWindow", {
|
|
255
|
+
* spec: {
|
|
256
|
+
* partitionBy: "$category",
|
|
257
|
+
* sortBy: { price: 1 },
|
|
258
|
+
* output: { rank: { $rank: {} } }
|
|
259
|
+
* }
|
|
260
|
+
* });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
addOperation(stage, type, data, mergeable = false) {
|
|
264
|
+
this.operations.push({
|
|
265
|
+
stage,
|
|
266
|
+
mergeable,
|
|
267
|
+
type,
|
|
268
|
+
data
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
//#endregion
|
|
274
|
+
export { MongoQueryOperations };
|
|
275
|
+
//# sourceMappingURL=mongodb-query-operations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb-query-operations.mjs","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/drivers/mongodb/mongodb-query-operations.ts"],"sourcesContent":["import type { Operation, PipelineStage } from \"./types\";\n\n/**\n * Helper class for constructing MongoDB aggregation pipeline operations.\n *\n * This class encapsulates the logic for creating operation objects that will be\n * converted to MongoDB aggregation stages by the query parser. It provides a\n * clean abstraction over the low-level operation structure, making the query\n * builder code more maintainable and testable.\n *\n * Each operation consists of:\n * - **stage**: The MongoDB aggregation stage name (e.g., \"$match\", \"$project\")\n * - **type**: An internal identifier for the operation type\n * - **data**: The data associated with the operation\n * - **mergeable**: Whether this operation can be merged with adjacent similar operations\n *\n * @internal This class is for internal use within the MongoDB driver\n *\n * @example\n * ```typescript\n * const operations: Operation[] = [];\n * const helper = new MongoQueryOperations(operations);\n *\n * // Add a match operation\n * helper.addMatchOperation(\"whereIn\", { field: \"status\", values: [\"active\", \"pending\"] });\n *\n * // Add a project operation\n * helper.addProjectOperation(\"select\", { fields: [\"name\", \"email\"] });\n *\n * // Operations array is now populated\n * console.log(operations);\n * // [\n * // { stage: \"$match\", mergeable: true, type: \"whereIn\", data: {...} },\n * // { stage: \"$project\", mergeable: true, type: \"select\", data: {...} }\n * // ]\n * ```\n */\nexport class MongoQueryOperations {\n /**\n * Creates a new operations helper.\n *\n * The helper maintains a reference to the operations array and populates it\n * as methods are called. This allows the query builder to maintain a single\n * ordered list of operations that will be converted to a MongoDB aggregation\n * pipeline.\n *\n * @param operations - Reference to the operations array to populate\n *\n * @example\n * ```typescript\n * const operations: Operation[] = [];\n * const helper = new MongoQueryOperations(operations);\n * ```\n */\n public constructor(private operations: Operation[]) {}\n\n public setOperations(operations: Operation[]): void {\n this.operations = operations;\n }\n\n /**\n * Adds a $match stage operation to the pipeline.\n *\n * Match operations filter documents in the aggregation pipeline, similar to\n * the WHERE clause in SQL. Multiple match operations can be merged together\n * by the parser for optimization.\n *\n * @param type - The operation type identifier (e.g., \"where\", \"whereIn\", \"whereLike\")\n * @param data - The operation data data containing filter criteria\n * @param mergeable - Whether this operation can be merged with adjacent match operations (default: true)\n *\n * @example\n * ```typescript\n * // Simple where operation\n * helper.addMatchOperation(\"where\", { field: \"age\", operator: \">\", value: 18 });\n *\n * // WhereIn operation\n * helper.addMatchOperation(\"whereIn\", { field: \"status\", values: [\"active\", \"pending\"] });\n *\n * // Non-mergeable match (e.g., after a group stage)\n * helper.addMatchOperation(\"having\", { field: \"count\", operator: \">\", value: 5 }, false);\n * ```\n */\n public addMatchOperation(type: string, data: Record<string, unknown>, mergeable = true): void {\n this.operations.push({\n stage: \"$match\",\n mergeable,\n type,\n data,\n });\n }\n\n /**\n * Adds a $project stage operation to the pipeline.\n *\n * Project operations control which fields are included or excluded in the\n * output documents, similar to the SELECT clause in SQL. They can also be\n * used to compute new fields or reshape documents.\n *\n * @param type - The operation type identifier (e.g., \"select\", \"deselect\", \"selectRaw\")\n * @param data - The operation data data containing projection specifications\n * @param mergeable - Whether this operation can be merged with adjacent project operations (default: true)\n *\n * @example\n * ```typescript\n * // Select specific fields\n * helper.addProjectOperation(\"select\", { fields: [\"name\", \"email\", \"age\"] });\n *\n * // Deselect fields\n * helper.addProjectOperation(\"deselect\", { fields: [\"password\", \"secret\"] });\n *\n * // Computed field\n * helper.addProjectOperation(\"selectRaw\", {\n * expression: { fullName: { $concat: [\"$firstName\", \" \", \"$lastName\"] } }\n * });\n * ```\n */\n public addProjectOperation(\n type: string,\n data: Record<string, unknown>,\n mergeable = true,\n ): void {\n this.operations.push({\n stage: \"$project\",\n mergeable,\n type,\n data,\n });\n }\n\n /**\n * Adds a $sort stage operation to the pipeline.\n *\n * Sort operations order the documents in the pipeline, similar to the ORDER BY\n * clause in SQL. Multiple sort operations can be merged to create compound\n * sorting.\n *\n * @param type - The operation type identifier (e.g., \"orderBy\", \"orderByRandom\")\n * @param data - The operation data data containing sort specifications\n * @param mergeable - Whether this operation can be merged with adjacent sort operations (default: true)\n *\n * @example\n * ```typescript\n * // Order by a single field\n * helper.addSortOperation(\"orderBy\", { field: \"createdAt\", direction: \"desc\" });\n *\n * // Random ordering (not mergeable)\n * helper.addSortOperation(\"orderByRandom\", {limit: 1000}, false);\n *\n * // Order by raw expression\n * helper.addSortOperation(\"orderByRaw\", {\n * expression: { score: -1, name: 1 }\n * });\n * ```\n */\n public addSortOperation(type: string, data: Record<string, unknown>, mergeable = true): void {\n this.operations.push({\n stage: \"$sort\",\n mergeable,\n type,\n data,\n });\n }\n\n /**\n * Adds a $group stage operation to the pipeline.\n *\n * Group operations aggregate documents by specified fields and compute\n * aggregate values, similar to the GROUP BY clause in SQL. Group operations\n * are typically not mergeable as they represent distinct aggregation boundaries.\n *\n * @param type - The operation type identifier (e.g., \"groupBy\", \"distinct\")\n * @param data - The operation data data containing grouping specifications\n * @param mergeable - Whether this operation can be merged with adjacent group operations (default: false)\n *\n * @example\n * ```typescript\n * // Group by a single field\n * helper.addGroupOperation(\"groupBy\", { fields: \"category\" });\n *\n * // Group by multiple fields\n * helper.addGroupOperation(\"groupBy\", {\n * fields: { category: \"$category\", status: \"$status\" }\n * });\n *\n * // Distinct operation (special case of grouping)\n * helper.addGroupOperation(\"distinct\", { fields: [\"email\"] });\n * ```\n */\n public addGroupOperation(\n type: string,\n data: Record<string, unknown>,\n mergeable = false,\n ): void {\n this.operations.push({\n stage: \"$group\",\n mergeable,\n type,\n data,\n });\n }\n\n /**\n * Adds a $lookup stage operation to the pipeline.\n *\n * Lookup operations perform left outer joins with other collections, similar\n * to JOIN in SQL. Lookup operations are never mergeable as each represents a\n * distinct join operation.\n *\n * @param type - The operation type identifier (typically \"join\")\n * @param data - The operation data data containing join specifications\n *\n * @example\n * ```typescript\n * // Simple lookup\n * helper.addLookupOperation(\"join\", {\n * table: \"orders\",\n * localField: \"id\",\n * foreignField: \"userId\",\n * alias: \"userOrders\"\n * });\n *\n * // Lookup with pipeline\n * helper.addLookupOperation(\"join\", {\n * table: \"products\",\n * pipeline: [\n * { $match: { inStock: true } },\n * { $sort: { price: 1 } }\n * ],\n * alias: \"availableProducts\"\n * });\n * ```\n */\n public addLookupOperation(type: string, data: Record<string, unknown>): void {\n this.operations.push({\n stage: \"$lookup\",\n mergeable: false,\n type,\n data,\n });\n }\n\n /**\n * Adds a generic stage operation to the pipeline.\n *\n * This method provides flexibility to add any MongoDB aggregation stage,\n * including less common stages like $facet, $bucket, $setWindowFields, etc.\n * Use this for operations that don't fit into the standard categories.\n *\n * @param stage - The MongoDB aggregation stage name (e.g., \"$limit\", \"$skip\", \"$unwind\")\n * @param type - The operation type identifier\n * @param data - The operation data data\n * @param mergeable - Whether this operation can be merged with adjacent operations (default: false)\n *\n * @example\n * ```typescript\n * // Add a limit operation\n * helper.addOperation(\"$limit\", \"limit\", { value: 10 });\n *\n * // Add a skip operation\n * helper.addOperation(\"$skip\", \"skip\", { value: 20 });\n *\n * // Add an unwind operation\n * helper.addOperation(\"$unwind\", \"unwind\", { path: \"$tags\" });\n *\n * // Add a window function\n * helper.addOperation(\"$setWindowFields\", \"selectWindow\", {\n * spec: {\n * partitionBy: \"$category\",\n * sortBy: { price: 1 },\n * output: { rank: { $rank: {} } }\n * }\n * });\n * ```\n */\n public addOperation(\n stage: PipelineStage,\n type: string,\n data: Record<string, unknown>,\n mergeable = false,\n ): void {\n this.operations.push({\n stage,\n mergeable,\n type,\n data,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,uBAAb,MAAkC;CAiBL;;;;;;;;;;;;;;;;;CAA3B,AAAO,YAAY,AAAQ,YAAyB;EAAzB;CAA0B;CAErD,AAAO,cAAc,YAA+B;EAClD,KAAK,aAAa;CACpB;;;;;;;;;;;;;;;;;;;;;;;;CAyBA,AAAO,kBAAkB,MAAc,MAA+B,YAAY,MAAY;EAC5F,KAAK,WAAW,KAAK;GACnB,OAAO;GACP;GACA;GACA;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,AAAO,oBACL,MACA,MACA,YAAY,MACN;EACN,KAAK,WAAW,KAAK;GACnB,OAAO;GACP;GACA;GACA;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,AAAO,iBAAiB,MAAc,MAA+B,YAAY,MAAY;EAC3F,KAAK,WAAW,KAAK;GACnB,OAAO;GACP;GACA;GACA;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BA,AAAO,kBACL,MACA,MACA,YAAY,OACN;EACN,KAAK,WAAW,KAAK;GACnB,OAAO;GACP;GACA;GACA;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCA,AAAO,mBAAmB,MAAc,MAAqC;EAC3E,KAAK,WAAW,KAAK;GACnB,OAAO;GACP,WAAW;GACX;GACA;EACF,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCA,AAAO,aACL,OACA,MACA,MACA,YAAY,OACN;EACN,KAAK,WAAW,KAAK;GACnB;GACA;GACA;GACA;EACF,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { Operation } from "./types.mjs";
|
|
2
|
+
import { MongoQueryBuilder } from "./mongodb-query-builder.mjs";
|
|
3
|
+
import { Collection } from "mongodb";
|
|
4
|
+
|
|
5
|
+
//#region ../../@warlock.js/cascade/src/drivers/mongodb/mongodb-query-parser.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Options for configuring the MongoDB query parser.
|
|
8
|
+
*/
|
|
9
|
+
type MongoQueryParserOptions = {
|
|
10
|
+
/** The MongoDB collection being queried */collection: Collection; /** The ordered list of operations to parse */
|
|
11
|
+
operations: Operation[]; /** Factory method for creating sub-builders (used for callbacks) */
|
|
12
|
+
createSubBuilder: () => MongoQueryBuilder;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Parses query builder operations into MongoDB aggregation pipeline.
|
|
16
|
+
*
|
|
17
|
+
* This parser is responsible for converting the abstract operations collected
|
|
18
|
+
* by the query builder into a concrete MongoDB aggregation pipeline. It handles
|
|
19
|
+
* intelligent grouping of mergeable operations (like multiple where clauses)
|
|
20
|
+
* into single pipeline stages for optimal performance.
|
|
21
|
+
*/
|
|
22
|
+
declare class MongoQueryParser {
|
|
23
|
+
/**
|
|
24
|
+
* The MongoDB collection being queried.
|
|
25
|
+
*/
|
|
26
|
+
private readonly collection;
|
|
27
|
+
/**
|
|
28
|
+
* The ordered list of operations to parse.
|
|
29
|
+
*/
|
|
30
|
+
private readonly operations;
|
|
31
|
+
/**
|
|
32
|
+
* Factory for creating sub-builders (used when resolving callbacks).
|
|
33
|
+
*/
|
|
34
|
+
private readonly createSubBuilder;
|
|
35
|
+
/**
|
|
36
|
+
* Track group field names for automatic _id renaming.
|
|
37
|
+
* Maps pipeline index to field names.
|
|
38
|
+
*/
|
|
39
|
+
private readonly groupFieldNames;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new MongoDB query parser.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Configuration options for the parser
|
|
44
|
+
*/
|
|
45
|
+
constructor(options: MongoQueryParserOptions);
|
|
46
|
+
/**
|
|
47
|
+
* Parse the operations into a MongoDB aggregation pipeline.
|
|
48
|
+
*
|
|
49
|
+
* This method intelligently groups mergeable operations (e.g., multiple where
|
|
50
|
+
* clauses) into single pipeline stages while maintaining the correct execution
|
|
51
|
+
* order for non-mergeable operations.
|
|
52
|
+
*
|
|
53
|
+
* @returns The MongoDB aggregation pipeline
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const parser = new MongoQueryParser({ collection, operations });
|
|
58
|
+
* const pipeline = parser.parse();
|
|
59
|
+
* // [
|
|
60
|
+
* // { $match: { status: 'active', age: { $gt: 18 } } },
|
|
61
|
+
* // { $sort: { createdAt: -1 } },
|
|
62
|
+
* // { $limit: 10 }
|
|
63
|
+
* // ]
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
parse(): any[];
|
|
67
|
+
/**
|
|
68
|
+
* Track field names for group stages that need _id renaming.
|
|
69
|
+
*/
|
|
70
|
+
private trackGroupFieldNames;
|
|
71
|
+
/**
|
|
72
|
+
* Post-process pipeline to rename _id fields after $group stages.
|
|
73
|
+
*
|
|
74
|
+
* This automatically renames MongoDB's `_id` field to the actual field name(s)
|
|
75
|
+
* used for grouping, making the results more intuitive.
|
|
76
|
+
*
|
|
77
|
+
* @param pipeline - The aggregation pipeline
|
|
78
|
+
* @returns The processed pipeline
|
|
79
|
+
*/
|
|
80
|
+
private postProcessGroupStages;
|
|
81
|
+
/**
|
|
82
|
+
* Convert the parsed pipeline to a pretty-printed string for debugging.
|
|
83
|
+
*
|
|
84
|
+
* This method formats the MongoDB aggregation pipeline in a human-readable
|
|
85
|
+
* way, making it easier to understand and debug complex queries.
|
|
86
|
+
*
|
|
87
|
+
* @returns A formatted string representation of the pipeline
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const parser = new MongoQueryParser({ collection, operations });
|
|
92
|
+
* console.log(parser.toPrettyString());
|
|
93
|
+
* // Output:
|
|
94
|
+
* // MongoDB Aggregation Pipeline:
|
|
95
|
+
* // ════════════════════════════
|
|
96
|
+
* // Stage 1: $match
|
|
97
|
+
* // status: "active"
|
|
98
|
+
* // age: { $gt: 18 }
|
|
99
|
+
* //
|
|
100
|
+
* // Stage 2: $sort
|
|
101
|
+
* // createdAt: -1
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
toPrettyString(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Format stage data with proper indentation.
|
|
107
|
+
*
|
|
108
|
+
* @param data - The stage data to format
|
|
109
|
+
* @param indent - The indentation level
|
|
110
|
+
* @returns Formatted string
|
|
111
|
+
*/
|
|
112
|
+
private formatStageData;
|
|
113
|
+
/**
|
|
114
|
+
* Build a single pipeline stage from a group of operations.
|
|
115
|
+
*
|
|
116
|
+
* @param stage - The pipeline stage type
|
|
117
|
+
* @param operations - The operations to build the stage from
|
|
118
|
+
* @returns The built pipeline stage or null if no stage should be added
|
|
119
|
+
*/
|
|
120
|
+
private buildStage;
|
|
121
|
+
/**
|
|
122
|
+
* Build a $match stage from where operations.
|
|
123
|
+
*
|
|
124
|
+
* Query building strategy:
|
|
125
|
+
* - Top-level where() + orWhere() = Pure OR
|
|
126
|
+
* - Use callbacks for AND + OR grouping
|
|
127
|
+
*
|
|
128
|
+
* @param operations - The where operations
|
|
129
|
+
* @returns The $match stage or null
|
|
130
|
+
*/
|
|
131
|
+
private buildMatchStage;
|
|
132
|
+
private isPureOrCondition;
|
|
133
|
+
/**
|
|
134
|
+
* Build a condition from a callback-based where clause.
|
|
135
|
+
* Creates a sub-builder, executes the callback, and extracts the conditions.
|
|
136
|
+
* If callback has orWhere, all conditions become OR.
|
|
137
|
+
*
|
|
138
|
+
* @param callback - The callback function
|
|
139
|
+
* @returns The built condition or null
|
|
140
|
+
*/
|
|
141
|
+
private buildCallbackCondition;
|
|
142
|
+
/**
|
|
143
|
+
* Build a MongoDB filter condition from a where operation.
|
|
144
|
+
*
|
|
145
|
+
* @param op - The operation to build
|
|
146
|
+
* @returns The MongoDB filter condition
|
|
147
|
+
*/
|
|
148
|
+
private buildWhereCondition;
|
|
149
|
+
/**
|
|
150
|
+
* Build a condition based on the operator.
|
|
151
|
+
*
|
|
152
|
+
* @param field - The field name
|
|
153
|
+
* @param operator - The comparison operator
|
|
154
|
+
* @param value - The value to compare
|
|
155
|
+
* @returns The MongoDB filter condition
|
|
156
|
+
*/
|
|
157
|
+
private buildOperatorCondition;
|
|
158
|
+
/**
|
|
159
|
+
* Get MongoDB operator from comparison operator.
|
|
160
|
+
*
|
|
161
|
+
* @param operator - The comparison operator
|
|
162
|
+
* @returns The MongoDB operator
|
|
163
|
+
*/
|
|
164
|
+
private getMongoOperator;
|
|
165
|
+
private resolveRawExpression;
|
|
166
|
+
private bindRawString;
|
|
167
|
+
private buildColumnComparison;
|
|
168
|
+
private buildBetweenColumnsCondition;
|
|
169
|
+
private wrapColumn;
|
|
170
|
+
private buildDateEqualityCondition;
|
|
171
|
+
private buildDateBeforeCondition;
|
|
172
|
+
private buildDateAfterCondition;
|
|
173
|
+
private buildTimeCondition;
|
|
174
|
+
private buildDatePartCondition;
|
|
175
|
+
private buildJsonContainsCondition;
|
|
176
|
+
private buildJsonDoesntContainCondition;
|
|
177
|
+
private buildJsonContainsKeyCondition;
|
|
178
|
+
private buildJsonLengthCondition;
|
|
179
|
+
private buildJsonTypeCondition;
|
|
180
|
+
private buildArrayLengthCondition;
|
|
181
|
+
private normalizeDateInput;
|
|
182
|
+
private startOfDay;
|
|
183
|
+
private endOfDay;
|
|
184
|
+
private normalizePath;
|
|
185
|
+
private applyProjectionFields;
|
|
186
|
+
/**
|
|
187
|
+
* Apply projection object with aliases and inclusion/exclusion.
|
|
188
|
+
* @param projection - The projection object to modify
|
|
189
|
+
* @param projectionObj - The projection specification
|
|
190
|
+
*/
|
|
191
|
+
private applyProjectionObject;
|
|
192
|
+
private applyRawProjection;
|
|
193
|
+
private resolveProjectionExpression;
|
|
194
|
+
private normalizeFieldReference;
|
|
195
|
+
private buildAggregateProjection;
|
|
196
|
+
private buildExistsProjection;
|
|
197
|
+
private buildArraySizeExpression;
|
|
198
|
+
private buildCaseExpression;
|
|
199
|
+
private buildCondExpression;
|
|
200
|
+
/**
|
|
201
|
+
* Resolve a value as a literal (if it's a plain string) or as an expression.
|
|
202
|
+
* Used for `then`/`default` values in CASE/WHEN expressions.
|
|
203
|
+
*/
|
|
204
|
+
private resolveLiteralOrExpression;
|
|
205
|
+
private inferJsonAlias;
|
|
206
|
+
private buildConcatExpression;
|
|
207
|
+
private buildCoalesceExpression;
|
|
208
|
+
/**
|
|
209
|
+
* Build a $project stage from select operations.
|
|
210
|
+
*
|
|
211
|
+
* @param operations - The select operations
|
|
212
|
+
* @returns The $project stage or null
|
|
213
|
+
*/
|
|
214
|
+
private buildProjectStage;
|
|
215
|
+
/**
|
|
216
|
+
* Build a $sort stage from order operations.
|
|
217
|
+
*
|
|
218
|
+
* @param operations - The order operations
|
|
219
|
+
* @returns The $sort stage or null
|
|
220
|
+
*/
|
|
221
|
+
private buildSortStage;
|
|
222
|
+
/**
|
|
223
|
+
* Build a $group stage from group operations.
|
|
224
|
+
*
|
|
225
|
+
* @param operations - The group operations
|
|
226
|
+
* @returns The $group stage or null
|
|
227
|
+
*/
|
|
228
|
+
private buildGroupStage;
|
|
229
|
+
private buildGroupByStage;
|
|
230
|
+
/**
|
|
231
|
+
* Build a $group stage with aggregates from group operations.
|
|
232
|
+
*
|
|
233
|
+
* @param fields - Fields to group by
|
|
234
|
+
* @param aggregates - Aggregate operations (abstract or raw)
|
|
235
|
+
* @returns The $group stage or null
|
|
236
|
+
*/
|
|
237
|
+
private buildGroupByWithAggregatesStage;
|
|
238
|
+
/**
|
|
239
|
+
* Extract field names from GroupByInput for renaming _id.
|
|
240
|
+
*
|
|
241
|
+
* @param fields - The grouping fields
|
|
242
|
+
* @returns Field name(s) to use for renaming _id
|
|
243
|
+
*/
|
|
244
|
+
private extractGroupFieldNames;
|
|
245
|
+
/**
|
|
246
|
+
* Translate an abstract aggregate expression to MongoDB format.
|
|
247
|
+
*
|
|
248
|
+
* @param expr - Abstract aggregate expression
|
|
249
|
+
* @returns MongoDB aggregation expression
|
|
250
|
+
*/
|
|
251
|
+
private translateAggregateExpression;
|
|
252
|
+
private buildGroupId;
|
|
253
|
+
/**
|
|
254
|
+
* Build a $lookup stage from join operations.
|
|
255
|
+
*
|
|
256
|
+
* @param operations - The join operations
|
|
257
|
+
* @returns The $lookup stage or null
|
|
258
|
+
*/
|
|
259
|
+
private buildLookupStage;
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { MongoQueryParser };
|
|
263
|
+
//# sourceMappingURL=mongodb-query-parser.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb-query-parser.d.mts","names":[],"sources":["../../../../../../../@warlock.js/cascade/src/drivers/mongodb/mongodb-query-parser.ts"],"mappings":";;;;;;;AAaA;KAAY,uBAAA;6CAEV,UAAA,EAAY,UAAA,EAEA;EAAZ,UAAA,EAAY,SAAA,IAE6B;EAAzC,gBAAA,QAAwB,iBAAA;AAAA;;;;;;;AAAiB;AAW3C;cAAa,gBAAA;;;;mBAIM,UAAA;EAUA;;;EAAA,iBALA,UAAA;EAkBE;;;EAAA,iBAbF,gBAAA;EA+LV;;;;EAAA,iBAzLU,eAAA;EAgfT;;;;;cAzeW,OAAA,EAAS,uBAAuB;EAs0B3C;;;;;;;;;;;;;;;;;;;;EA5yBD,KAAA,CAAA;EAggCC;;;EAAA,QAt8BA,oBAAA;EAkhCA;;;;;;;;;EAAA,QAz/BA,sBAAA;EA8wCA;;;;;;;AAwLgB;;;;;;;;;;;;;;;;EAj4CjB,cAAA,CAAA;;;;;;;;UAgCC,eAAA;;;;;;;;UAoDA,UAAA;;;;;;;;;;;UAmCA,eAAA;EAAA,QA8KA,iBAAA;;;;;;;;;UAkBA,sBAAA;;;;;;;UA8EA,mBAAA;;;;;;;;;UAiNA,sBAAA;;;;;;;UAyBA,gBAAA;EAAA,QAYA,oBAAA;EAAA,QAaA,aAAA;EAAA,QAYA,qBAAA;EAAA,QASA,4BAAA;EAAA,QAWA,UAAA;EAAA,QAIA,0BAAA;EAAA,QAOA,wBAAA;EAAA,QAKA,uBAAA;EAAA,QAKA,kBAAA;EAAA,QAgBA,sBAAA;EAAA,QAiBA,0BAAA;EAAA,QAQA,+BAAA;EAAA,QAMA,6BAAA;EAAA,QAMA,wBAAA;EAAA,QASA,sBAAA;EAAA,QAQA,yBAAA;EAAA,QASA,kBAAA;EAAA,QAWA,UAAA;EAAA,QAMA,QAAA;EAAA,QAMA,aAAA;EAAA,QAIA,qBAAA;;;;;;UAeA,qBAAA;EAAA,QAmCA,kBAAA;EAAA,QAeA,2BAAA;EAAA,QA0BA,uBAAA;EAAA,QAoBA,wBAAA;EAAA,QAwBA,qBAAA;EAAA,QAMA,wBAAA;EAAA,QAMA,mBAAA;EAAA,QAeA,mBAAA;;;;;UAkBA,0BAAA;EAAA,QAaA,cAAA;EAAA,QAMA,qBAAA;EAAA,QAMA,uBAAA;;;;;;;UAsBA,iBAAA;;;;;;;UAqHA,cAAA;;;;;;;UA2BA,eAAA;EAAA,QA+CA,iBAAA;;;;;;;;UAgBA,+BAAA;;;;;;;UAiCA,sBAAA;;;;;;;UA4BA,4BAAA;EAAA,QA2DA,YAAA;;;;;;;UAgDA,gBAAA;AAAA"}
|