ddd-ts-kit 0.111.0 → 0.112.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/README.fr.md +35 -6
- package/README.md +32 -5
- package/dist/alias/index.d.ts +2 -0
- package/dist/alias/index.d.ts.map +1 -1
- package/dist/alias/index.js +2 -0
- package/dist/alias/index.js.map +1 -1
- package/dist/alias/neighbour-sources.d.ts +17 -0
- package/dist/alias/neighbour-sources.d.ts.map +1 -0
- package/dist/alias/neighbour-sources.js +11 -0
- package/dist/alias/neighbour-sources.js.map +1 -0
- package/dist/alias/neighbour-suffix.d.ts +8 -0
- package/dist/alias/neighbour-suffix.d.ts.map +1 -0
- package/dist/alias/neighbour-suffix.js +10 -0
- package/dist/alias/neighbour-suffix.js.map +1 -0
- package/dist/build/rewrite-aliases.d.ts.map +1 -1
- package/dist/build/rewrite-aliases.js +11 -0
- package/dist/build/rewrite-aliases.js.map +1 -1
- package/dist/check/alias/build-scripts.d.ts.map +1 -1
- package/dist/check/alias/build-scripts.js +4 -8
- package/dist/check/alias/build-scripts.js.map +1 -1
- package/dist/check/alias/compiler-options-of.d.ts +3 -3
- package/dist/check/alias/compiler-options-of.js +17 -6
- package/dist/check/alias/compiler-options-of.js.map +1 -1
- package/dist/check/alias/neighbour-sources.d.ts +12 -0
- package/dist/check/alias/neighbour-sources.d.ts.map +1 -0
- package/dist/check/alias/neighbour-sources.js +80 -0
- package/dist/check/alias/neighbour-sources.js.map +1 -0
- package/dist/check/alias/script-steps.d.ts +11 -0
- package/dist/check/alias/script-steps.d.ts.map +1 -0
- package/dist/check/alias/script-steps.js +22 -0
- package/dist/check/alias/script-steps.js.map +1 -0
- package/dist/check/aspects/adapter-policies.d.ts +10 -0
- package/dist/check/aspects/adapter-policies.d.ts.map +1 -0
- package/dist/check/aspects/adapter-policies.js +104 -0
- package/dist/check/aspects/adapter-policies.js.map +1 -0
- package/dist/check/aspects/adapter-policy.d.ts +18 -0
- package/dist/check/aspects/adapter-policy.d.ts.map +1 -0
- package/dist/check/aspects/adapter-policy.js +2 -0
- package/dist/check/aspects/adapter-policy.js.map +1 -0
- package/dist/check/aspects/is-under-condition.d.ts +7 -0
- package/dist/check/aspects/is-under-condition.d.ts.map +1 -0
- package/dist/check/aspects/is-under-condition.js +50 -0
- package/dist/check/aspects/is-under-condition.js.map +1 -0
- package/dist/check/aspects/stated-policy.d.ts +18 -0
- package/dist/check/aspects/stated-policy.d.ts.map +1 -0
- package/dist/check/aspects/stated-policy.js +39 -0
- package/dist/check/aspects/stated-policy.js.map +1 -0
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +4 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/explain/imports-docs.d.ts.map +1 -1
- package/dist/check/explain/imports-docs.js +5 -3
- package/dist/check/explain/imports-docs.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts.map +1 -1
- package/dist/check/explain/persistence-docs.js +21 -0
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/standard-docs.d.ts.map +1 -1
- package/dist/check/explain/standard-docs.js +16 -0
- package/dist/check/explain/standard-docs.js.map +1 -1
- package/dist/check/files/kit-content-types.d.ts +12 -0
- package/dist/check/files/kit-content-types.d.ts.map +1 -0
- package/dist/check/files/kit-content-types.js +38 -0
- package/dist/check/files/kit-content-types.js.map +1 -0
- package/dist/check/files/upload-content-defect.d.ts +7 -0
- package/dist/check/files/upload-content-defect.d.ts.map +1 -0
- package/dist/check/files/upload-content-defect.js +2 -0
- package/dist/check/files/upload-content-defect.js.map +1 -0
- package/dist/check/files/upload-content-defects.d.ts +9 -0
- package/dist/check/files/upload-content-defects.d.ts.map +1 -0
- package/dist/check/files/upload-content-defects.js +54 -0
- package/dist/check/files/upload-content-defects.js.map +1 -0
- package/dist/check/files/upload-declaration.d.ts +7 -0
- package/dist/check/files/upload-declaration.d.ts.map +1 -0
- package/dist/check/files/upload-declaration.js +2 -0
- package/dist/check/files/upload-declaration.js.map +1 -0
- package/dist/check/files/upload-declarations.d.ts +9 -0
- package/dist/check/files/upload-declarations.d.ts.map +1 -0
- package/dist/check/files/upload-declarations.js +41 -0
- package/dist/check/files/upload-declarations.js.map +1 -0
- package/dist/check/fixtures/alias-declared-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/alias-declared-fixtures.js +95 -1
- package/dist/check/fixtures/alias-declared-fixtures.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/imports-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/imports-fixtures.js +97 -0
- package/dist/check/fixtures/imports-fixtures.js.map +1 -1
- package/dist/check/fixtures/standard-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/standard-fixtures.js +42 -0
- package/dist/check/fixtures/standard-fixtures.js.map +1 -1
- package/dist/check/fixtures/upload-fixtures.d.ts +3 -0
- package/dist/check/fixtures/upload-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/upload-fixtures.js +94 -0
- package/dist/check/fixtures/upload-fixtures.js.map +1 -0
- package/dist/check/migrations/is-working-migration.d.ts +6 -0
- package/dist/check/migrations/is-working-migration.d.ts.map +1 -0
- package/dist/check/migrations/is-working-migration.js +8 -0
- package/dist/check/migrations/is-working-migration.js.map +1 -0
- package/dist/check/migrations/journal-entries.d.ts +4 -0
- package/dist/check/migrations/journal-entries.d.ts.map +1 -0
- package/dist/check/migrations/journal-entries.js +21 -0
- package/dist/check/migrations/journal-entries.js.map +1 -0
- package/dist/check/migrations/read-drizzle-migrations.d.ts.map +1 -1
- package/dist/check/migrations/read-drizzle-migrations.js +4 -9
- package/dist/check/migrations/read-drizzle-migrations.js.map +1 -1
- package/dist/check/modules/imported-modules.d.ts +4 -0
- package/dist/check/modules/imported-modules.d.ts.map +1 -0
- package/dist/check/modules/imported-modules.js +5 -0
- package/dist/check/modules/imported-modules.js.map +1 -0
- package/dist/check/modules/module-imports.d.ts +17 -0
- package/dist/check/modules/module-imports.d.ts.map +1 -0
- package/dist/check/modules/module-imports.js +23 -0
- package/dist/check/modules/module-imports.js.map +1 -0
- package/dist/check/project/assemble-project.d.ts.map +1 -1
- package/dist/check/project/assemble-project.js +1 -8
- package/dist/check/project/assemble-project.js.map +1 -1
- package/dist/check/project/file-severity.d.ts +4 -0
- package/dist/check/project/file-severity.d.ts.map +1 -0
- package/dist/check/project/file-severity.js +11 -0
- package/dist/check/project/file-severity.js.map +1 -0
- package/dist/check/project/load-project.js +1 -10
- package/dist/check/project/load-project.js.map +1 -1
- package/dist/check/project/not-in-the-tree.d.ts +10 -0
- package/dist/check/project/not-in-the-tree.d.ts.map +1 -0
- package/dist/check/project/not-in-the-tree.js +17 -0
- package/dist/check/project/not-in-the-tree.js.map +1 -0
- package/dist/check/project/skipped-directories.d.ts +3 -0
- package/dist/check/project/skipped-directories.d.ts.map +1 -0
- package/dist/check/project/skipped-directories.js +3 -0
- package/dist/check/project/skipped-directories.js.map +1 -0
- package/dist/check/project/walk-directory.d.ts.map +1 -1
- package/dist/check/project/walk-directory.js +1 -1
- package/dist/check/project/walk-directory.js.map +1 -1
- package/dist/check/rules/aspects-timeout-covers-delegate.d.ts +3 -0
- package/dist/check/rules/aspects-timeout-covers-delegate.d.ts.map +1 -0
- package/dist/check/rules/aspects-timeout-covers-delegate.js +179 -0
- package/dist/check/rules/aspects-timeout-covers-delegate.js.map +1 -0
- package/dist/check/rules/files-upload-content-rule.d.ts +3 -0
- package/dist/check/rules/files-upload-content-rule.d.ts.map +1 -0
- package/dist/check/rules/files-upload-content-rule.js +25 -0
- package/dist/check/rules/files-upload-content-rule.js.map +1 -0
- package/dist/check/rules/imports-alias-declared.d.ts.map +1 -1
- package/dist/check/rules/imports-alias-declared.js +3 -1
- package/dist/check/rules/imports-alias-declared.js.map +1 -1
- package/dist/check/rules/imports-alias-only.d.ts.map +1 -1
- package/dist/check/rules/imports-alias-only.js +86 -7
- package/dist/check/rules/imports-alias-only.js.map +1 -1
- package/dist/check/rules/module-no-cycle.d.ts.map +1 -1
- package/dist/check/rules/module-no-cycle.js +12 -34
- package/dist/check/rules/module-no-cycle.js.map +1 -1
- package/dist/cli-error.d.ts +7 -2
- package/dist/cli-error.d.ts.map +1 -1
- package/dist/cli-error.js +8 -2
- package/dist/cli-error.js.map +1 -1
- package/dist/commands/generate.js +1 -0
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/knex-generate.d.ts.map +1 -1
- package/dist/commands/knex-generate.js +2 -1
- package/dist/commands/knex-generate.js.map +1 -1
- package/dist/commands/move-to-module.d.ts +6 -1
- package/dist/commands/move-to-module.d.ts.map +1 -1
- package/dist/commands/move-to-module.js +28 -3
- package/dist/commands/move-to-module.js.map +1 -1
- package/dist/commands/prisma-generate.d.ts.map +1 -1
- package/dist/commands/prisma-generate.js +2 -1
- package/dist/commands/prisma-generate.js.map +1 -1
- package/dist/commands/typeorm-generate.d.ts.map +1 -1
- package/dist/commands/typeorm-generate.js +2 -1
- package/dist/commands/typeorm-generate.js.map +1 -1
- package/dist/commands/verify-merge.d.ts +4 -2
- package/dist/commands/verify-merge.d.ts.map +1 -1
- package/dist/commands/verify-merge.js +8 -5
- package/dist/commands/verify-merge.js.map +1 -1
- package/dist/generate/generate-options.d.ts +3 -0
- package/dist/generate/generate-options.d.ts.map +1 -1
- package/dist/generate/generate-options.js +1 -0
- package/dist/generate/generate-options.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload/upload-file-vars.d.ts +9 -0
- package/dist/generate/kinds/file-upload/upload-file-vars.d.ts.map +1 -0
- package/dist/generate/kinds/file-upload/upload-file-vars.js +39 -0
- package/dist/generate/kinds/file-upload/upload-file-vars.js.map +1 -0
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js +2 -1
- package/dist/generate/kinds/file-upload/write-nest-upload-controller.js.map +1 -1
- package/dist/generate/kinds/file-upload/write-upload-controller.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload/write-upload-controller.js +2 -1
- package/dist/generate/kinds/file-upload/write-upload-controller.js.map +1 -1
- package/dist/generate/kinds/file-upload-kind.d.ts.map +1 -1
- package/dist/generate/kinds/file-upload-kind.js +5 -3
- package/dist/generate/kinds/file-upload-kind.js.map +1 -1
- package/dist/generate/kinds/read-model/list-read-model.d.ts +17 -0
- package/dist/generate/kinds/read-model/list-read-model.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/list-read-model.js +22 -0
- package/dist/generate/kinds/read-model/list-read-model.js.map +1 -0
- package/dist/generate/kinds/read-model-kind.d.ts.map +1 -1
- package/dist/generate/kinds/read-model-kind.js +19 -0
- package/dist/generate/kinds/read-model-kind.js.map +1 -1
- package/dist/generate/kinds/service-kind.d.ts.map +1 -1
- package/dist/generate/kinds/service-kind.js +8 -0
- package/dist/generate/kinds/service-kind.js.map +1 -1
- package/dist/generate/kinds/wire-context.d.ts.map +1 -1
- package/dist/generate/kinds/wire-context.js +4 -0
- package/dist/generate/kinds/wire-context.js.map +1 -1
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +3 -2
- package/dist/generate/shared-writes.js.map +1 -1
- package/dist/help/tool-notes.d.ts.map +1 -1
- package/dist/help/tool-notes.js +5 -1
- package/dist/help/tool-notes.js.map +1 -1
- package/dist/help/usage.js +1 -1
- package/dist/help/work-notes.d.ts.map +1 -1
- package/dist/help/work-notes.js +9 -2
- package/dist/help/work-notes.js.map +1 -1
- package/dist/init/files/end-to-end-files.d.ts.map +1 -1
- package/dist/init/files/end-to-end-files.js +3 -0
- package/dist/init/files/end-to-end-files.js.map +1 -1
- package/dist/init/files/persistence-files.d.ts.map +1 -1
- package/dist/init/files/persistence-files.js +8 -2
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/files/script-files.d.ts +2 -1
- package/dist/init/files/script-files.d.ts.map +1 -1
- package/dist/init/files/script-files.js +6 -1
- package/dist/init/files/script-files.js.map +1 -1
- package/dist/init/is-team-file.d.ts +2 -2
- package/dist/init/is-team-file.d.ts.map +1 -1
- package/dist/init/is-team-file.js +5 -4
- package/dist/init/is-team-file.js.map +1 -1
- package/dist/init/list-read-models.d.ts +17 -0
- package/dist/init/list-read-models.d.ts.map +1 -0
- package/dist/init/list-read-models.js +74 -0
- package/dist/init/list-read-models.js.map +1 -0
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +8 -0
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/versions.js +25 -25
- package/dist/init/rewire-contexts.d.ts +4 -2
- package/dist/init/rewire-contexts.d.ts.map +1 -1
- package/dist/init/rewire-contexts.js +10 -2
- package/dist/init/rewire-contexts.js.map +1 -1
- package/dist/init/run-init.js +1 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/wiring-notes.js +1 -1
- package/dist/init/wiring-notes.js.map +1 -1
- package/dist/init/write-type-script-configs.d.ts +3 -1
- package/dist/init/write-type-script-configs.d.ts.map +1 -1
- package/dist/init/write-type-script-configs.js +14 -2
- package/dist/init/write-type-script-configs.js.map +1 -1
- package/dist/merge/format-merge-report.js +5 -2
- package/dist/merge/format-merge-report.js.map +1 -1
- package/dist/merge/land-drizzle.d.ts +4 -0
- package/dist/merge/land-drizzle.d.ts.map +1 -1
- package/dist/merge/land-drizzle.js +6 -1
- package/dist/merge/land-drizzle.js.map +1 -1
- package/dist/merge/land-up-to-date.d.ts +15 -0
- package/dist/merge/land-up-to-date.d.ts.map +1 -0
- package/dist/merge/land-up-to-date.js +76 -0
- package/dist/merge/land-up-to-date.js.map +1 -0
- package/dist/merge/lost/format-merge-verification.d.ts +2 -1
- package/dist/merge/lost/format-merge-verification.d.ts.map +1 -1
- package/dist/merge/lost/format-merge-verification.js +13 -2
- package/dist/merge/lost/format-merge-verification.js.map +1 -1
- package/dist/merge/lost/merge-verification.d.ts +4 -0
- package/dist/merge/lost/merge-verification.d.ts.map +1 -1
- package/dist/merge/lost/verify-merges.d.ts +2 -1
- package/dist/merge/lost/verify-merges.d.ts.map +1 -1
- package/dist/merge/lost/verify-merges.js +10 -4
- package/dist/merge/lost/verify-merges.js.map +1 -1
- package/dist/merge/merge-trunk.d.ts +2 -1
- package/dist/merge/merge-trunk.d.ts.map +1 -1
- package/dist/merge/merge-trunk.js +5 -2
- package/dist/merge/merge-trunk.js.map +1 -1
- package/dist/merge/next-steps.d.ts +3 -0
- package/dist/merge/next-steps.d.ts.map +1 -1
- package/dist/merge/next-steps.js +3 -0
- package/dist/merge/next-steps.js.map +1 -1
- package/dist/merge/order/applied-under-old-name.d.ts +13 -0
- package/dist/merge/order/applied-under-old-name.d.ts.map +1 -0
- package/dist/merge/order/applied-under-old-name.js +14 -0
- package/dist/merge/order/applied-under-old-name.js.map +1 -0
- package/dist/merge/order/comes-after.d.ts +8 -0
- package/dist/merge/order/comes-after.d.ts.map +1 -0
- package/dist/merge/order/comes-after.js +9 -0
- package/dist/merge/order/comes-after.js.map +1 -0
- package/dist/merge/order/drizzle-order.d.ts +11 -0
- package/dist/merge/order/drizzle-order.d.ts.map +1 -0
- package/dist/merge/order/drizzle-order.js +64 -0
- package/dist/merge/order/drizzle-order.js.map +1 -0
- package/dist/merge/order/in-order.d.ts +4 -0
- package/dist/merge/order/in-order.d.ts.map +1 -0
- package/dist/merge/order/in-order.js +6 -0
- package/dist/merge/order/in-order.js.map +1 -0
- package/dist/merge/order/migration-order-finding.d.ts +18 -0
- package/dist/merge/order/migration-order-finding.d.ts.map +1 -0
- package/dist/merge/order/migration-order-finding.js +2 -0
- package/dist/merge/order/migration-order-finding.js.map +1 -0
- package/dist/merge/order/migration-order.d.ts +12 -0
- package/dist/merge/order/migration-order.d.ts.map +1 -0
- package/dist/merge/order/migration-order.js +21 -0
- package/dist/merge/order/migration-order.js.map +1 -0
- package/dist/merge/order/migrations-of-commit.d.ts +7 -0
- package/dist/merge/order/migrations-of-commit.d.ts.map +1 -0
- package/dist/merge/order/migrations-of-commit.js +43 -0
- package/dist/merge/order/migrations-of-commit.js.map +1 -0
- package/dist/merge/order/migrations-of-tree.d.ts +9 -0
- package/dist/merge/order/migrations-of-tree.d.ts.map +1 -0
- package/dist/merge/order/migrations-of-tree.js +25 -0
- package/dist/merge/order/migrations-of-tree.js.map +1 -0
- package/dist/merge/order/named-order.d.ts +11 -0
- package/dist/merge/order/named-order.d.ts.map +1 -0
- package/dist/merge/order/named-order.js +36 -0
- package/dist/merge/order/named-order.js.map +1 -0
- package/dist/merge/order/ordered-migration.d.ts +12 -0
- package/dist/merge/order/ordered-migration.d.ts.map +1 -0
- package/dist/merge/order/ordered-migration.js +2 -0
- package/dist/merge/order/ordered-migration.js.map +1 -0
- package/dist/merge/order/trunk-to-follow.d.ts +9 -0
- package/dist/merge/order/trunk-to-follow.d.ts.map +1 -0
- package/dist/merge/order/trunk-to-follow.js +2 -0
- package/dist/merge/order/trunk-to-follow.js.map +1 -0
- package/dist/merge/renumber-migrations.d.ts +14 -5
- package/dist/merge/renumber-migrations.d.ts.map +1 -1
- package/dist/merge/renumber-migrations.js +141 -60
- package/dist/merge/renumber-migrations.js.map +1 -1
- package/dist/merge/restamp-class.d.ts +9 -0
- package/dist/merge/restamp-class.d.ts.map +1 -0
- package/dist/merge/restamp-class.js +30 -0
- package/dist/merge/restamp-class.js.map +1 -0
- package/dist/migration/index.d.ts +1 -0
- package/dist/migration/index.d.ts.map +1 -1
- package/dist/migration/index.js +1 -0
- package/dist/migration/index.js.map +1 -1
- package/dist/migration/plan-replay.d.ts.map +1 -1
- package/dist/migration/plan-replay.js +2 -1
- package/dist/migration/plan-replay.js.map +1 -1
- package/dist/migration/refuse-taken-migration-name.d.ts +8 -0
- package/dist/migration/refuse-taken-migration-name.d.ts.map +1 -0
- package/dist/migration/refuse-taken-migration-name.js +22 -0
- package/dist/migration/refuse-taken-migration-name.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +5 -0
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -1
- package/dist/migration/replay-drizzle-migrations.js +10 -2
- package/dist/migration/replay-drizzle-migrations.js.map +1 -1
- package/dist/migration/replay-plan.d.ts +2 -2
- package/dist/migration/replay-plan.d.ts.map +1 -1
- package/dist/migration/restore-migration-folder.d.ts +6 -2
- package/dist/migration/restore-migration-folder.d.ts.map +1 -1
- package/dist/migration/restore-migration-folder.js +14 -7
- package/dist/migration/restore-migration-folder.js.map +1 -1
- package/dist/migration/snapshot-migration-folder.d.ts +7 -0
- package/dist/migration/snapshot-migration-folder.d.ts.map +1 -0
- package/dist/migration/snapshot-migration-folder.js +12 -0
- package/dist/migration/snapshot-migration-folder.js.map +1 -0
- package/dist/move-to-module/before-the-move.d.ts +5 -0
- package/dist/move-to-module/before-the-move.d.ts.map +1 -0
- package/dist/move-to-module/before-the-move.js +13 -0
- package/dist/move-to-module/before-the-move.js.map +1 -0
- package/dist/move-to-module/closed-cycles.d.ts +21 -0
- package/dist/move-to-module/closed-cycles.d.ts.map +1 -0
- package/dist/move-to-module/closed-cycles.js +66 -0
- package/dist/move-to-module/closed-cycles.js.map +1 -0
- package/dist/move-to-module/cycle-lines.d.ts +7 -0
- package/dist/move-to-module/cycle-lines.d.ts.map +1 -0
- package/dist/move-to-module/cycle-lines.js +22 -0
- package/dist/move-to-module/cycle-lines.js.map +1 -0
- package/dist/move-to-module/cycle-refusal.d.ts +17 -0
- package/dist/move-to-module/cycle-refusal.d.ts.map +1 -0
- package/dist/move-to-module/cycle-refusal.js +25 -0
- package/dist/move-to-module/cycle-refusal.js.map +1 -0
- package/dist/move-to-module/index.d.ts +5 -0
- package/dist/move-to-module/index.d.ts.map +1 -1
- package/dist/move-to-module/index.js +4 -0
- package/dist/move-to-module/index.js.map +1 -1
- package/dist/move-to-module/module-imports-in.d.ts +11 -0
- package/dist/move-to-module/module-imports-in.d.ts.map +1 -0
- package/dist/move-to-module/module-imports-in.js +32 -0
- package/dist/move-to-module/module-imports-in.js.map +1 -0
- package/dist/move-to-module/moves-into-module.d.ts.map +1 -1
- package/dist/move-to-module/moves-into-module.js +6 -18
- package/dist/move-to-module/moves-into-module.js.map +1 -1
- package/dist/move-to-module/place-in-module.d.ts +13 -0
- package/dist/move-to-module/place-in-module.d.ts.map +1 -0
- package/dist/move-to-module/place-in-module.js +24 -0
- package/dist/move-to-module/place-in-module.js.map +1 -0
- package/dist/move-to-module/watch-cycles.d.ts +19 -0
- package/dist/move-to-module/watch-cycles.d.ts.map +1 -0
- package/dist/move-to-module/watch-cycles.js +51 -0
- package/dist/move-to-module/watch-cycles.js.map +1 -0
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/slice/format-slice-verification.d.ts.map +1 -1
- package/dist/slice/format-slice-verification.js +11 -5
- package/dist/slice/format-slice-verification.js.map +1 -1
- package/dist/stack/alias-vars.d.ts +3 -1
- package/dist/stack/alias-vars.d.ts.map +1 -1
- package/dist/stack/alias-vars.js +5 -2
- package/dist/stack/alias-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/templates/file-upload/controller.spec.ts.tpl +66 -2
- package/templates/file-upload/controller.ts.tpl +12 -0
- package/templates/file-upload/handler.spec.ts.tpl +3 -3
- package/templates/init/README.md.tpl +20 -1
- package/templates/init/e2e/jest.e2e.config.js.tpl +5 -0
- package/templates/init/e2e/test-database-setup.ts.tpl +120 -0
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +2 -1
- package/templates/init/platform/composition/compose-application.container.ts.tpl +5 -0
- package/templates/init/platform/composition/compose-application.manual.ts.tpl +20 -3
- package/templates/init/platform/composition/create-platform.manual.ts.tpl +6 -0
- package/templates/init/platform/composition/platform-options.manual.ts.tpl +11 -0
- package/templates/init/platform/composition/platform.manual.ts.tpl +7 -0
- package/templates/init/platform/composition/platform.module.container.ts.tpl +34 -0
- package/templates/init/platform/database/connect-to-database.drizzle.ts.tpl +7 -2
- package/templates/init/platform/database/open-test-database.drizzle.ts.tpl +8 -3
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +8 -3
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +8 -3
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +8 -3
- package/templates/init/platform/database/read-model-tables.ts.tpl +67 -0
- package/templates/init/platform/database/test-database-budget.ts.tpl +108 -0
- package/templates/init/platform/database/test-database-clone.ts.tpl +52 -161
- package/templates/init/platform/database/test-database-copy.ts.tpl +76 -0
- package/templates/init/platform/database/test-database-emptying.ts.tpl +209 -0
- package/templates/init/platform/database/test-database-kept.ts.tpl +32 -0
- package/templates/init/platform/database/test-database-leftovers.ts.tpl +52 -0
- package/templates/init/platform/database/test-database-run.ts.tpl +99 -0
- package/templates/init/platform/database/test-database-server.ts.tpl +140 -0
- package/templates/init/platform/database/test-database-session.ts.tpl +141 -0
- package/templates/init/platform/database/test-database-teardown.ts.tpl +11 -1
- package/templates/init/platform/resilience/default-policy.ts.tpl +8 -1
- package/templates/init/rules/infrastructure.md.tpl +2 -2
- package/templates/init/scripts/read-model-tables.ts.tpl +83 -0
- package/templates/nest-controller/upload.spec.ts.tpl +67 -2
- package/templates/nest-controller/upload.ts.tpl +12 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-account.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-delegation.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-invitation.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-member.repository.drizzle.ts.tpl +5 -9
- package/templates/presets/identity/context/infrastructure/persistence/drizzle-organisation.repository.drizzle.ts.tpl +5 -9
- package/templates/repository/drizzle/repository.ts.tpl +6 -9
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const REMEDIES: {
|
|
2
|
+
readonly drizzle: 'would run it again under the new one: reset it, or add to `drizzle.__drizzle_migrations` a row whose `created_at` is the `when` of its new entry in the journal, with any `hash` (required, never compared)';
|
|
3
|
+
readonly knex: 'then refuses every migration (`The migration directory is corrupt, the following files are missing`): reset it, or set `name` of its row in `knex_migrations` to the new file name, extension included';
|
|
4
|
+
readonly prisma: 'still knows it by the old one: reset it, or record the new name as applied with `npx prisma migrate resolve --applied <new name>`';
|
|
5
|
+
readonly typeorm: 'would run it again under the new one: reset it, or correct its row in `migrations` (`timestamp`, and `name`, the class)';
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* What to do with a database that already ran a migration the landing renames or generates
|
|
9
|
+
* again: its tool knows the migration by the old name.
|
|
10
|
+
*/
|
|
11
|
+
export declare function appliedUnderOldName(orm: keyof typeof REMEDIES): string;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=applied-under-old-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applied-under-old-name.d.ts","sourceRoot":"","sources":["../../../src/merge/order/applied-under-old-name.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,QAAQ;aACZ,OAAO,EACL,6MAA6M;aAC/M,IAAI,EAAE,wMAAwM;aAC9M,MAAM,EACJ,mIAAmI;aACrI,OAAO,EACL,yHAAyH;CACnH,CAAC;AAEX;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,OAAO,QAAQ,GAAG,MAAM,CAEtE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const REMEDIES = {
|
|
2
|
+
drizzle: 'would run it again under the new one: reset it, or add to `drizzle.__drizzle_migrations` a row whose `created_at` is the `when` of its new entry in the journal, with any `hash` (required, never compared)',
|
|
3
|
+
knex: 'then refuses every migration (`The migration directory is corrupt, the following files are missing`): reset it, or set `name` of its row in `knex_migrations` to the new file name, extension included',
|
|
4
|
+
prisma: 'still knows it by the old one: reset it, or record the new name as applied with `npx prisma migrate resolve --applied <new name>`',
|
|
5
|
+
typeorm: 'would run it again under the new one: reset it, or correct its row in `migrations` (`timestamp`, and `name`, the class)',
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* What to do with a database that already ran a migration the landing renames or generates
|
|
9
|
+
* again: its tool knows the migration by the old name.
|
|
10
|
+
*/
|
|
11
|
+
export function appliedUnderOldName(orm) {
|
|
12
|
+
return `A database that already applied a migration under its old name (development, preview, shared) ${REMEDIES[orm]}.`;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=applied-under-old-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applied-under-old-name.js","sourceRoot":"","sources":["../../../src/merge/order/applied-under-old-name.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;IACf,OAAO,EACL,6MAA6M;IAC/M,IAAI,EAAE,wMAAwM;IAC9M,MAAM,EACJ,mIAAmI;IACrI,OAAO,EACL,yHAAyH;CACnH,CAAC;AAEX;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAA0B;IAC5D,OAAO,iGAAiG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;AAC3H,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NamedOrm } from './ordered-migration.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the tool runs a migration after another, by their keys: the order of the strings for
|
|
4
|
+
* knex and Prisma, which sort names, the number for TypeORM, which sorts the stamps of the
|
|
5
|
+
* classes. `verify-merge` and the landing both ask it here, so that they never disagree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function comesAfter(orm: NamedOrm, key: string, previous: string): boolean;
|
|
8
|
+
//# sourceMappingURL=comes-after.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comes-after.d.ts","sourceRoot":"","sources":["../../../src/merge/order/comes-after.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEhF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the tool runs a migration after another, by their keys: the order of the strings for
|
|
3
|
+
* knex and Prisma, which sort names, the number for TypeORM, which sorts the stamps of the
|
|
4
|
+
* classes. `verify-merge` and the landing both ask it here, so that they never disagree.
|
|
5
|
+
*/
|
|
6
|
+
export function comesAfter(orm, key, previous) {
|
|
7
|
+
return orm === 'typeorm' ? Number(key) > Number(previous) : key > previous;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=comes-after.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comes-after.js","sourceRoot":"","sources":["../../../src/merge/order/comes-after.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,GAAa,EAAE,GAAW,EAAE,QAAgB;IACrE,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,QAAQ,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MigrationOrderFinding } from './migration-order-finding.js';
|
|
2
|
+
import type { TrunkToFollow } from './trunk-to-follow.js';
|
|
3
|
+
/**
|
|
4
|
+
* Under drizzle-kit the order is the journal's: the migrator applies the entries generated after
|
|
5
|
+
* the last one a database applied, by their `when`, and nothing else. An entry of the branch
|
|
6
|
+
* generated before the last entry of the trunk is skipped there without a word, and a file the
|
|
7
|
+
* journal does not list (a merge kept the journal of one side) is never applied anywhere; one the
|
|
8
|
+
* trunk holds as well is not the branch's to list.
|
|
9
|
+
*/
|
|
10
|
+
export declare function drizzleOrder(root: string, trunk: TrunkToFollow): MigrationOrderFinding[];
|
|
11
|
+
//# sourceMappingURL=drizzle-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle-order.d.ts","sourceRoot":"","sources":["../../../src/merge/order/drizzle-order.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,qBAAqB,EAAE,CAgBxF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isWorkingMigration } from '../../check/migrations/is-working-migration.js';
|
|
2
|
+
import { journalEntries } from '../../check/migrations/journal-entries.js';
|
|
3
|
+
import { readDrizzleMigrations } from '../../check/migrations/read-drizzle-migrations.js';
|
|
4
|
+
import { runGit } from '../../commit/run-git.js';
|
|
5
|
+
import { migrationsAt } from '../migrations-at.js';
|
|
6
|
+
import { appliedUnderOldName } from './applied-under-old-name.js';
|
|
7
|
+
/**
|
|
8
|
+
* Under drizzle-kit the order is the journal's: the migrator applies the entries generated after
|
|
9
|
+
* the last one a database applied, by their `when`, and nothing else. An entry of the branch
|
|
10
|
+
* generated before the last entry of the trunk is skipped there without a word, and a file the
|
|
11
|
+
* journal does not list (a merge kept the journal of one side) is never applied anywhere; one the
|
|
12
|
+
* trunk holds as well is not the branch's to list.
|
|
13
|
+
*/
|
|
14
|
+
export function drizzleOrder(root, trunk) {
|
|
15
|
+
const here = readDrizzleMigrations(root);
|
|
16
|
+
if (here === undefined) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const journal = `./${here.folder}/meta/_journal.json`;
|
|
20
|
+
const theirs = journalEntries(runGit(root, ['show', `${trunk.commit}:${journal}`]) ?? '') ?? [];
|
|
21
|
+
const fix = fixOf(here.folder, trunk);
|
|
22
|
+
const held = new Set(migrationsAt(root, trunk.commit, { folder: here.folder, directories: false }).map(({ name }) => name));
|
|
23
|
+
return [...generatedBefore(here, theirs, trunk), ...unlisted(here, held)].map((finding) => ({ ...finding, fix }));
|
|
24
|
+
}
|
|
25
|
+
function generatedBefore({ entries, folder }, theirs, trunk) {
|
|
26
|
+
const last = theirs.at(-1);
|
|
27
|
+
const landed = new Set(theirs.map((entry) => entry.tag));
|
|
28
|
+
if (last === undefined) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return entries
|
|
32
|
+
.filter(({ tag, when }) => !landed.has(tag) && !isWorkingMigration(tag) && when <= last.when)
|
|
33
|
+
.map(({ tag }) => ({
|
|
34
|
+
kind: 'before-trunk',
|
|
35
|
+
migration: tag,
|
|
36
|
+
file: `${folder}/${tag}.sql`,
|
|
37
|
+
trunkLast: last.tag,
|
|
38
|
+
text: `the migration "${tag}" of this branch was generated before "${last.tag}", the last migration of ${trunk.name}: the migrator of drizzle skips it without a word on a database that already applied "${last.tag}"`,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A file the trunk holds too is the trunk's to list: every branch would report it, and none could
|
|
43
|
+
* fix it. A working migration is left out here as everywhere: its place is decided when it lands.
|
|
44
|
+
*/
|
|
45
|
+
function unlisted({ entries, files, folder }, held) {
|
|
46
|
+
const listed = new Set(entries.map((entry) => entry.tag));
|
|
47
|
+
return files
|
|
48
|
+
.filter((tag) => !listed.has(tag) && !held.has(tag) && !isWorkingMigration(tag))
|
|
49
|
+
.map((tag) => ({
|
|
50
|
+
kind: 'not-in-journal',
|
|
51
|
+
migration: tag,
|
|
52
|
+
file: `${folder}/${tag}.sql`,
|
|
53
|
+
text: `the migration "${tag}" is not in ${folder}/meta/_journal.json: drizzle-kit migrate never applies it (a merge that keeps the journal of one side loses the entries of the other)`,
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
/** The merge that replays when the trunk is to bring in; the replay alone, on the journal of the trunk, once it is in. */
|
|
57
|
+
function fixOf(folder, trunk) {
|
|
58
|
+
const limit = 'A branch with more than one migration that changes the schema is refused, with the steps to generate them again one at a time.';
|
|
59
|
+
if (!trunk.merged) {
|
|
60
|
+
return `Run \`npx ddd-ts-kit merge-trunk\`: it brings ${trunk.name} in, takes its journal and its snapshots, and generates the migrations of the branch again after them, under their names. ${limit} ${appliedUnderOldName('drizzle')}`;
|
|
61
|
+
}
|
|
62
|
+
return `Take the journal and the snapshots of the trunk, \`git checkout ${trunk.name} -- ${folder}/meta\`, then run \`npx ddd-ts-kit drizzle-generate --replay --base ${trunk.name}\`: it finds the migrations of the branch by their files and generates them again after the trunk's, under their names. ${limit} ${appliedUnderOldName('drizzle')}`;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=drizzle-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle-order.js","sourceRoot":"","sources":["../../../src/merge/order/drizzle-order.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAI/D;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,KAAoB;IAC7D,MAAM,IAAI,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAEzC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,EAAE,CAAC;IACZ,CAAC;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jD,MAAM,KAAK,GACT,gIAAgI,CAAC;IAEnI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,iDAAiD,KAAK,CAAC,IAAI,6HAA6H,KAAK,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC;IAC3O,CAAC;IAED,OAAO,mEAAmE,KAAK,CAAC,IAAI,OAAO,MAAM,uEAAuE,KAAK,CAAC,IAAI,2HAA2H,KAAK,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE,CAAC;AACzV,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NamedOrm, OrderedMigration } from './ordered-migration.js';
|
|
2
|
+
/** The migrations as their tool runs them. */
|
|
3
|
+
export declare function inOrder(orm: NamedOrm, migrations: readonly OrderedMigration[]): OrderedMigration[];
|
|
4
|
+
//# sourceMappingURL=in-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-order.d.ts","sourceRoot":"","sources":["../../../src/merge/order/in-order.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,8CAA8C;AAC9C,wBAAgB,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAIlG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { comesAfter } from './comes-after.js';
|
|
2
|
+
/** The migrations as their tool runs them. */
|
|
3
|
+
export function inOrder(orm, migrations) {
|
|
4
|
+
return [...migrations].sort((left, right) => left.key === right.key ? 0 : comesAfter(orm, left.key, right.key) ? 1 : -1);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=in-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-order.js","sourceRoot":"","sources":["../../../src/merge/order/in-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,8CAA8C;AAC9C,MAAM,UAAU,OAAO,CAAC,GAAa,EAAE,UAAuC;IAC5E,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAC1C,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One migration of a branch that the trunk's history would run in another order, or never:
|
|
3
|
+
*
|
|
4
|
+
* - `before-trunk`: the branch adds it and it sorts before the last migration of the trunk;
|
|
5
|
+
* - `not-in-journal`: its file is in the folder of drizzle-kit and no entry of the journal names it.
|
|
6
|
+
*/
|
|
7
|
+
export interface MigrationOrderFinding {
|
|
8
|
+
readonly kind: 'before-trunk' | 'not-in-journal';
|
|
9
|
+
/** The name of the migration, without extension. */
|
|
10
|
+
readonly migration: string;
|
|
11
|
+
/** From the project root, POSIX separators. */
|
|
12
|
+
readonly file: string;
|
|
13
|
+
/** The last migration of the trunk, which this one sorts before; absent for a file out of the journal. */
|
|
14
|
+
readonly trunkLast?: string;
|
|
15
|
+
readonly text: string;
|
|
16
|
+
readonly fix: string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=migration-order-finding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-order-finding.d.ts","sourceRoot":"","sources":["../../../src/merge/order/migration-order-finding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACjD,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-order-finding.js","sourceRoot":"","sources":["../../../src/merge/order/migration-order-finding.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MigrationOrderFinding } from './migration-order-finding.js';
|
|
2
|
+
/**
|
|
3
|
+
* The migrations of the working tree that do not follow the trunk's: one the branch adds that
|
|
4
|
+
* sorts before the last migration of the trunk, on the four ORM, and under drizzle-kit a file
|
|
5
|
+
* the journal does not list. A working migration (`working-<what-it-does>`) is left out: its
|
|
6
|
+
* place is decided when the branch lands. Nothing without the config of the kit or an ORM.
|
|
7
|
+
*/
|
|
8
|
+
export declare function migrationOrder(root: string, trunk: {
|
|
9
|
+
name: string;
|
|
10
|
+
commit: string;
|
|
11
|
+
}): MigrationOrderFinding[];
|
|
12
|
+
//# sourceMappingURL=migration-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-order.d.ts","sourceRoot":"","sources":["../../../src/merge/order/migration-order.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGvE;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,EAAE,CAS7G"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { runGit } from '../../commit/run-git.js';
|
|
4
|
+
import { CONFIG_FILE, readConfig } from '../../config/index.js';
|
|
5
|
+
import { drizzleOrder } from './drizzle-order.js';
|
|
6
|
+
import { namedOrder } from './named-order.js';
|
|
7
|
+
/**
|
|
8
|
+
* The migrations of the working tree that do not follow the trunk's: one the branch adds that
|
|
9
|
+
* sorts before the last migration of the trunk, on the four ORM, and under drizzle-kit a file
|
|
10
|
+
* the journal does not list. A working migration (`working-<what-it-does>`) is left out: its
|
|
11
|
+
* place is decided when the branch lands. Nothing without the config of the kit or an ORM.
|
|
12
|
+
*/
|
|
13
|
+
export function migrationOrder(root, trunk) {
|
|
14
|
+
const orm = fs.existsSync(path.join(root, CONFIG_FILE)) ? readConfig(root).config.stack.orm : undefined;
|
|
15
|
+
const merged = runGit(root, ['merge-base', '--is-ancestor', trunk.commit, 'HEAD']) !== undefined;
|
|
16
|
+
if (orm === 'drizzle') {
|
|
17
|
+
return drizzleOrder(root, { ...trunk, merged });
|
|
18
|
+
}
|
|
19
|
+
return orm === 'knex' || orm === 'prisma' || orm === 'typeorm' ? namedOrder(root, orm, { ...trunk, merged }) : [];
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=migration-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-order.js","sourceRoot":"","sources":["../../../src/merge/order/migration-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAuC;IAClF,MAAM,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;IACxG,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAAK,SAAS,CAAC;IAEjG,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACpH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NamedOrm, OrderedMigration } from './ordered-migration.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the tool of an ORM takes for a migration in a commit, read from git, in the order it runs
|
|
4
|
+
* them: the trunk a branch has to follow. The same shapes as `migrationsOfTree`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function migrationsOfCommit(root: string, orm: NamedOrm, commit: string): OrderedMigration[];
|
|
7
|
+
//# sourceMappingURL=migrations-of-commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations-of-commit.d.ts","sourceRoot":"","sources":["../../../src/merge/order/migrations-of-commit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQtE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAelG"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { runGit } from '../../commit/run-git.js';
|
|
3
|
+
import { inOrder } from './in-order.js';
|
|
4
|
+
const FOLDERS = { knex: 'migrations', prisma: 'prisma/migrations', typeorm: 'migrations' };
|
|
5
|
+
/** What knex and TypeORM load from the folder; a declaration file is not one. */
|
|
6
|
+
const SCRIPT = /(?<!\.d)\.(?:js|ts|mjs|cjs)$/;
|
|
7
|
+
/** A class whose name ends with 13 digits, for `git grep -E`, which reads a commit without a checkout. */
|
|
8
|
+
const STAMPED_CLASS = 'class[[:space:]]+[A-Za-z_$][A-Za-z0-9_$]*[0-9]{13}';
|
|
9
|
+
/**
|
|
10
|
+
* What the tool of an ORM takes for a migration in a commit, read from git, in the order it runs
|
|
11
|
+
* them: the trunk a branch has to follow. The same shapes as `migrationsOfTree`.
|
|
12
|
+
*/
|
|
13
|
+
export function migrationsOfCommit(root, orm, commit) {
|
|
14
|
+
const folder = FOLDERS[orm];
|
|
15
|
+
if (orm === 'typeorm') {
|
|
16
|
+
return inOrder(orm, stampedIn(runGit(root, ['grep', '-I', '-o', '-E', STAMPED_CLASS, commit, '--', folder])));
|
|
17
|
+
}
|
|
18
|
+
const files = (runGit(root, ['ls-tree', '-r', '--name-only', commit, '--', `${folder}/`]) ?? '')
|
|
19
|
+
.split('\n')
|
|
20
|
+
.filter((file) => file !== '');
|
|
21
|
+
return inOrder(orm, files.flatMap((file) => (orm === 'prisma' ? folderOf(file, folder) : scriptOf(file, folder))));
|
|
22
|
+
}
|
|
23
|
+
/** `<commit>:<file>:class <Name><stamp>` on each line of `git grep`; the first class of a file names it. */
|
|
24
|
+
function stampedIn(matches) {
|
|
25
|
+
const byFile = new Map();
|
|
26
|
+
for (const line of (matches ?? '').split('\n')) {
|
|
27
|
+
const [, file, stamp] = /^[^:]+:(.+):class\s+\S*?(\d{13})$/.exec(line) ?? [];
|
|
28
|
+
if (file !== undefined && stamp !== undefined && SCRIPT.test(file) && !byFile.has(file)) {
|
|
29
|
+
byFile.set(file, { name: path.posix.basename(file).replace(SCRIPT, ''), file, key: stamp });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return [...byFile.values()];
|
|
33
|
+
}
|
|
34
|
+
function folderOf(file, folder) {
|
|
35
|
+
const [name = '', held, ...deeper] = file.slice(folder.length + 1).split('/');
|
|
36
|
+
return held === 'migration.sql' && deeper.length === 0 ? [{ name, file, key: name }] : [];
|
|
37
|
+
}
|
|
38
|
+
function scriptOf(file, folder) {
|
|
39
|
+
const entry = file.slice(folder.length + 1);
|
|
40
|
+
const name = entry.replace(SCRIPT, '');
|
|
41
|
+
return entry.includes('/') || name === entry ? [] : [{ name, file, key: name }];
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=migrations-of-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations-of-commit.js","sourceRoot":"","sources":["../../../src/merge/order/migrations-of-commit.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,YAAY,EAAW,CAAC;AACpG,iFAAiF;AACjF,MAAM,MAAM,GAAG,8BAA8B,CAAC;AAC9C,0GAA0G;AAC1G,MAAM,aAAa,GAAG,oDAAoD,CAAC;AAE3E;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,GAAa,EAAE,MAAc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+1,9 @@
|
|
|
1
|
+
import type { NamedOrm, OrderedMigration } from './ordered-migration.js';
|
|
2
|
+
/**
|
|
3
|
+
* What the tool of an ORM takes for a migration in the working tree, in the order it runs them.
|
|
4
|
+
* knex loads every script of the folder, whatever its name. Prisma reads the folders that hold a
|
|
5
|
+
* `migration.sql`. TypeORM takes the classes whose name ends with 13 digits, however the file
|
|
6
|
+
* is named.
|
|
7
|
+
*/
|
|
8
|
+
export declare function migrationsOfTree(root: string, orm: NamedOrm): OrderedMigration[];
|
|
9
|
+
//# sourceMappingURL=migrations-of-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations-of-tree.d.ts","sourceRoot":"","sources":["../../../src/merge/order/migrations-of-tree.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAItE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAgBhF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readMigrationFolder } from '../../check/migrations/read-migration-folder.js';
|
|
4
|
+
import { scan } from '../../check/scan/scan.js';
|
|
5
|
+
import { inOrder } from './in-order.js';
|
|
6
|
+
const STAMPED_CLASS = /(?<![\w$.])class\s+[A-Za-z_$][\w$]*?(\d{13})(?![\w$])/;
|
|
7
|
+
/**
|
|
8
|
+
* What the tool of an ORM takes for a migration in the working tree, in the order it runs them.
|
|
9
|
+
* knex loads every script of the folder, whatever its name. Prisma reads the folders that hold a
|
|
10
|
+
* `migration.sql`. TypeORM takes the classes whose name ends with 13 digits, however the file
|
|
11
|
+
* is named.
|
|
12
|
+
*/
|
|
13
|
+
export function migrationsOfTree(root, orm) {
|
|
14
|
+
const found = readMigrationFolder(root, orm)?.migrations ?? [];
|
|
15
|
+
if (orm === 'typeorm') {
|
|
16
|
+
return inOrder(orm, found.flatMap((migration) => stamped(migration, fs.readFileSync(path.join(root, migration.file), 'utf8'))));
|
|
17
|
+
}
|
|
18
|
+
const held = orm === 'prisma' ? found.filter(({ file }) => fs.existsSync(path.join(root, file))) : found;
|
|
19
|
+
return inOrder(orm, held.map((migration) => ({ ...migration, key: migration.name })));
|
|
20
|
+
}
|
|
21
|
+
function stamped(migration, text) {
|
|
22
|
+
const stamp = STAMPED_CLASS.exec(scan(text).code)?.[1];
|
|
23
|
+
return stamp === undefined ? [] : [{ ...migration, key: stamp }];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=migrations-of-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations-of-tree.js","sourceRoot":"","sources":["../../../src/merge/order/migrations-of-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,MAAM,aAAa,GAAG,uDAAuD,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,GAAa;IAC1D,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,UAAU,IAAI,EAAE,CAAC;IAE/D,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,OAAO,CACZ,GAAG,EACH,KAAK,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAC3G,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEzG,OAAO,OAAO,CACZ,GAAG,EACH,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CACjE,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,SAAoB,EAAE,IAAY;IACjD,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEvD,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { MigrationOrderFinding } from './migration-order-finding.js';
|
|
2
|
+
import type { NamedOrm } from './ordered-migration.js';
|
|
3
|
+
import type { TrunkToFollow } from './trunk-to-follow.js';
|
|
4
|
+
/**
|
|
5
|
+
* Under knex, Prisma and TypeORM a migration is a file (a folder under Prisma) the tool orders
|
|
6
|
+
* itself, and each of the three runs whatever the database has not run yet: one that comes
|
|
7
|
+
* before the last of the trunk runs after it where the trunk's is applied, and before it on a new
|
|
8
|
+
* database. What a migration is and what orders it are the tool's: see `migrationsOfTree`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function namedOrder(root: string, orm: NamedOrm, trunk: TrunkToFollow): MigrationOrderFinding[];
|
|
11
|
+
//# sourceMappingURL=named-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-order.d.ts","sourceRoot":"","sources":["../../../src/merge/order/named-order.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,GAAG,qBAAqB,EAAE,CAarG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isWorkingMigration } from '../../check/migrations/is-working-migration.js';
|
|
2
|
+
import { appliedUnderOldName } from './applied-under-old-name.js';
|
|
3
|
+
import { comesAfter } from './comes-after.js';
|
|
4
|
+
import { migrationsOfCommit } from './migrations-of-commit.js';
|
|
5
|
+
import { migrationsOfTree } from './migrations-of-tree.js';
|
|
6
|
+
const TOOLS = { knex: 'knex', prisma: 'Prisma', typeorm: 'TypeORM' };
|
|
7
|
+
/**
|
|
8
|
+
* Under knex, Prisma and TypeORM a migration is a file (a folder under Prisma) the tool orders
|
|
9
|
+
* itself, and each of the three runs whatever the database has not run yet: one that comes
|
|
10
|
+
* before the last of the trunk runs after it where the trunk's is applied, and before it on a new
|
|
11
|
+
* database. What a migration is and what orders it are the tool's: see `migrationsOfTree`.
|
|
12
|
+
*/
|
|
13
|
+
export function namedOrder(root, orm, trunk) {
|
|
14
|
+
const onTrunk = migrationsOfCommit(root, orm, trunk.commit);
|
|
15
|
+
const last = onTrunk.at(-1);
|
|
16
|
+
if (last === undefined) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
const landed = new Set(onTrunk.map((migration) => migration.file));
|
|
20
|
+
return migrationsOfTree(root, orm)
|
|
21
|
+
.filter(({ file, name, key }) => !landed.has(file) && !isWorkingMigration(name) && !comesAfter(orm, key, last.key))
|
|
22
|
+
.map((migration) => beforeTrunk(migration, { orm, last, trunk }));
|
|
23
|
+
}
|
|
24
|
+
function beforeTrunk({ name, file }, { orm, last, trunk }) {
|
|
25
|
+
const tool = TOOLS[orm];
|
|
26
|
+
const brought = trunk.merged ? `${trunk.name} being merged already, it` : `it brings ${trunk.name} in and`;
|
|
27
|
+
return {
|
|
28
|
+
kind: 'before-trunk',
|
|
29
|
+
migration: name,
|
|
30
|
+
file,
|
|
31
|
+
trunkLast: last.name,
|
|
32
|
+
text: `the migration "${name}" of this branch sorts before "${last.name}", the last migration of ${trunk.name}: ${tool} runs it after "${last.name}" on a database that already applied that one, and before it on a new database, so one history runs in two orders`,
|
|
33
|
+
fix: `Run \`npx ddd-ts-kit merge-trunk --to-land\` before the landing: ${brought} renames the migration with a number after "${last.name}", its content kept. When it changes a table a later migration of ${trunk.name} changes too, or when "${last.name}" carries no number a migration can follow, the command stops and says what to do. ${appliedUnderOldName(orm)}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=named-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-order.js","sourceRoot":"","sources":["../../../src/merge/order/named-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGxD,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAA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,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,IAAI;QACf,IAAI;QACJ,SAAS,EAAE,IAAI,CAAC,IAAI;QACpB,IAAI,EAAE,kBAAkB,IAAI,kCAAkC,IAAI,CAAC,IAAI,4BAA4B,KAAK,CAAC,IAAI,KAAK,IAAI,mBAAmB,IAAI,CAAC,IAAI,mHAAmH;QACrQ,GAAG,EAAE,oEAAoE,OAAO,+CAA+C,IAAI,CAAC,IAAI,qEAAqE,KAAK,CAAC,IAAI,0BAA0B,IAAI,CAAC,IAAI,sFAAsF,mBAAmB,CAAC,GAAG,CAAC,EAAE;KAC3W,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Migration } from '../../check/migrations/migration-folder.js';
|
|
2
|
+
/** The ORM whose migrations are files or folders the tool orders itself. */
|
|
3
|
+
export type NamedOrm = 'knex' | 'prisma' | 'typeorm';
|
|
4
|
+
/** A migration with what its tool orders it by. */
|
|
5
|
+
export interface OrderedMigration extends Migration {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the file without its extension (knex), the name of the folder (Prisma), or the
|
|
8
|
+
* 13 digits that end the name of the class (TypeORM, which never reads the name of the file).
|
|
9
|
+
*/
|
|
10
|
+
readonly key: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ordered-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordered-migration.d.ts","sourceRoot":"","sources":["../../../src/merge/order/ordered-migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAErD,mDAAmD;AACnD,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ordered-migration.js","sourceRoot":"","sources":["../../../src/merge/order/ordered-migration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The trunk the migrations of a branch are ordered against. */
|
|
2
|
+
export interface TrunkToFollow {
|
|
3
|
+
/** The ref, as the report and the commands of a fix name it. */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly commit: string;
|
|
6
|
+
/** Whether the branch already holds that commit: what brings the order right differs. */
|
|
7
|
+
readonly merged: boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=trunk-to-follow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trunk-to-follow.d.ts","sourceRoot":"","sources":["../../../src/merge/order/trunk-to-follow.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trunk-to-follow.js","sourceRoot":"","sources":["../../../src/merge/order/trunk-to-follow.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import type { NamedOrm } from './order/ordered-migration.js';
|
|
1
2
|
/** The migrations of a knex, Prisma or TypeORM project to land on the trunk. */
|
|
2
3
|
export interface Renumbering {
|
|
3
4
|
readonly root: string;
|
|
4
|
-
readonly orm:
|
|
5
|
-
/**
|
|
5
|
+
readonly orm: NamedOrm;
|
|
6
|
+
/**
|
|
7
|
+
* The base of the merge and the commit of the trunk. With the trunk as the base (a branch that
|
|
8
|
+
* already holds it), what the trunk gained is what comes after the first migration to land, and
|
|
9
|
+
* only the migrations that do not follow the trunk's already are renamed.
|
|
10
|
+
*/
|
|
6
11
|
readonly base: string;
|
|
7
12
|
readonly trunk: string;
|
|
8
13
|
readonly now: Date;
|
|
14
|
+
/** Says what would be renamed, and renames nothing. */
|
|
15
|
+
readonly dryRun?: boolean;
|
|
9
16
|
}
|
|
10
17
|
/** What renaming did, or why it stopped. */
|
|
11
18
|
export interface MigrationsLanded {
|
|
@@ -15,9 +22,11 @@ export interface MigrationsLanded {
|
|
|
15
22
|
/**
|
|
16
23
|
* Lands the migrations of the branch the trunk does not have: each gets a number after the last
|
|
17
24
|
* of the trunk and loses its `working-` prefix, its content kept (TypeORM: the class and its
|
|
18
|
-
* `name` follow).
|
|
19
|
-
*
|
|
20
|
-
*
|
|
25
|
+
* `name` follow). On a branch that already holds the trunk, a migration that follows the last of
|
|
26
|
+
* the trunk already keeps its name, and the others keep their order around it. A number is never
|
|
27
|
+
* one a file of the folder carries already. When a migration the trunk gained since the base
|
|
28
|
+
* changes a table one of the renamed changes too, their order is a decision: the landing stops,
|
|
29
|
+
* the migration is to generate again on the trunk.
|
|
21
30
|
*/
|
|
22
31
|
export declare function renumberMigrations(renumbering: Renumbering): MigrationsLanded;
|
|
23
32
|
//# sourceMappingURL=renumber-migrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renumber-migrations.d.ts","sourceRoot":"","sources":["../../src/merge/renumber-migrations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renumber-migrations.d.ts","sourceRoot":"","sources":["../../src/merge/renumber-migrations.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAoB,MAAM,2BAA2B,CAAC;AAK5E,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,uDAAuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,4CAA4C;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAyBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,gBAAgB,CAqB7E"}
|