ddd-ts-kit 0.110.1 → 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 +164 -0
- package/README.fr.md +39 -8
- package/README.md +36 -7
- 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/explain/tenancy-docs.d.ts.map +1 -1
- package/dist/check/explain/tenancy-docs.js +3 -1
- package/dist/check/explain/tenancy-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/tenancy-advisory-lock-fixtures.d.ts +9 -0
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.js +45 -0
- package/dist/check/fixtures/tenancy-advisory-lock-fixtures.js.map +1 -0
- package/dist/check/fixtures/tenancy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tenancy-fixtures.js +2 -0
- package/dist/check/fixtures/tenancy-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/check/rules/privacy-declared-field.js +1 -1
- package/dist/check/rules/privacy-declared-field.js.map +1 -1
- package/dist/check/rules/tenancy-scoped-statement.d.ts.map +1 -1
- package/dist/check/rules/tenancy-scoped-statement.js +11 -3
- package/dist/check/rules/tenancy-scoped-statement.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 +3 -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/context-layout/context-layout.d.ts.map +1 -1
- package/dist/context-layout/context-layout.js +6 -0
- package/dist/context-layout/context-layout.js.map +1 -1
- package/dist/context-layout/module-moves.d.ts +8 -0
- package/dist/context-layout/module-moves.d.ts.map +1 -1
- package/dist/context-layout/module-moves.js +14 -3
- package/dist/context-layout/module-moves.js.map +1 -1
- package/dist/context-layout/runner-configs-by-hand.d.ts.map +1 -1
- package/dist/context-layout/runner-configs-by-hand.js +12 -0
- package/dist/context-layout/runner-configs-by-hand.js.map +1 -1
- package/dist/context-layout/settle.d.ts +9 -0
- package/dist/context-layout/settle.d.ts.map +1 -1
- package/dist/context-layout/settle.js +25 -3
- package/dist/context-layout/settle.js.map +1 -1
- package/dist/describe/read-adapters.d.ts.map +1 -1
- package/dist/describe/read-adapters.js +5 -1
- package/dist/describe/read-adapters.js.map +1 -1
- package/dist/describe/read-ports.js +8 -1
- package/dist/describe/read-ports.js.map +1 -1
- package/dist/generate/generate-options.d.ts +10 -0
- package/dist/generate/generate-options.d.ts.map +1 -1
- package/dist/generate/generate-options.js +3 -0
- package/dist/generate/generate-options.js.map +1 -1
- package/dist/generate/kind.d.ts +6 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/adapter-kind.d.ts.map +1 -1
- package/dist/generate/kinds/adapter-kind.js +12 -0
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/declare-storage.d.ts.map +1 -1
- package/dist/generate/kinds/declare-storage.js +3 -57
- package/dist/generate/kinds/declare-storage.js.map +1 -1
- package/dist/generate/kinds/declare-table.d.ts +14 -0
- package/dist/generate/kinds/declare-table.d.ts.map +1 -0
- package/dist/generate/kinds/declare-table.js +72 -0
- package/dist/generate/kinds/declare-table.js.map +1 -0
- package/dist/generate/kinds/e2e/job-slug.d.ts +3 -0
- package/dist/generate/kinds/e2e/job-slug.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/job-slug.js +8 -0
- package/dist/generate/kinds/e2e/job-slug.js.map +1 -0
- package/dist/generate/kinds/e2e/job-spec.d.ts +16 -0
- package/dist/generate/kinds/e2e/job-spec.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/job-spec.js +54 -0
- package/dist/generate/kinds/e2e/job-spec.js.map +1 -0
- package/dist/generate/kinds/e2e/jobs-sending.d.ts +17 -5
- package/dist/generate/kinds/e2e/jobs-sending.d.ts.map +1 -1
- package/dist/generate/kinds/e2e/jobs-sending.js +15 -6
- package/dist/generate/kinds/e2e/jobs-sending.js.map +1 -1
- package/dist/generate/kinds/e2e/reaction-of.d.ts +5 -5
- package/dist/generate/kinds/e2e/reaction-of.d.ts.map +1 -1
- package/dist/generate/kinds/e2e/reaction-of.js +15 -8
- package/dist/generate/kinds/e2e/reaction-of.js.map +1 -1
- package/dist/generate/kinds/e2e/starting-jobs.d.ts +10 -0
- package/dist/generate/kinds/e2e/starting-jobs.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/starting-jobs.js +33 -0
- package/dist/generate/kinds/e2e/starting-jobs.js.map +1 -0
- package/dist/generate/kinds/e2e-kind.d.ts.map +1 -1
- package/dist/generate/kinds/e2e-kind.js +47 -35
- package/dist/generate/kinds/e2e-kind.js.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/generate-repository.d.ts +8 -0
- package/dist/generate/kinds/generate-repository.d.ts.map +1 -1
- package/dist/generate/kinds/generate-repository.js +2 -13
- package/dist/generate/kinds/generate-repository.js.map +1 -1
- package/dist/generate/kinds/note-the-migration.d.ts +4 -0
- package/dist/generate/kinds/note-the-migration.d.ts.map +1 -0
- package/dist/generate/kinds/note-the-migration.js +13 -0
- package/dist/generate/kinds/note-the-migration.js.map +1 -0
- package/dist/generate/kinds/personal-data/columns-of-table.d.ts +18 -0
- package/dist/generate/kinds/personal-data/columns-of-table.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/columns-of-table.js +31 -0
- package/dist/generate/kinds/personal-data/columns-of-table.js.map +1 -0
- package/dist/generate/kinds/personal-data/declare-personal-data.d.ts.map +1 -1
- package/dist/generate/kinds/personal-data/declare-personal-data.js +7 -52
- package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -1
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.d.ts +11 -0
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.js +71 -0
- package/dist/generate/kinds/personal-data/declare-table-personal-fields.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.d.ts +11 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.js +20 -0
- package/dist/generate/kinds/personal-data/personal-request-of-table.js.map +1 -0
- package/dist/generate/kinds/personal-data/personal-vars.d.ts +7 -0
- package/dist/generate/kinds/personal-data/personal-vars.d.ts.map +1 -1
- package/dist/generate/kinds/personal-data/personal-vars.js +14 -11
- package/dist/generate/kinds/personal-data/personal-vars.js.map +1 -1
- package/dist/generate/kinds/personal-data/schema-table.d.ts +13 -0
- package/dist/generate/kinds/personal-data/schema-table.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/schema-table.js +2 -0
- package/dist/generate/kinds/personal-data/schema-table.js.map +1 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.d.ts +9 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.js +78 -0
- package/dist/generate/kinds/personal-data/schema-tables-of.js.map +1 -0
- package/dist/generate/kinds/personal-data/table-of-schema.d.ts +15 -0
- package/dist/generate/kinds/personal-data/table-of-schema.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/table-of-schema.js +39 -0
- package/dist/generate/kinds/personal-data/table-of-schema.js.map +1 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.d.ts +20 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.d.ts.map +1 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.js +63 -0
- package/dist/generate/kinds/personal-data/write-personal-declaration.js.map +1 -0
- package/dist/generate/kinds/personal-fields-kind.d.ts +3 -0
- package/dist/generate/kinds/personal-fields-kind.d.ts.map +1 -0
- package/dist/generate/kinds/personal-fields-kind.js +15 -0
- package/dist/generate/kinds/personal-fields-kind.js.map +1 -0
- package/dist/generate/kinds/projection-kind.d.ts.map +1 -1
- package/dist/generate/kinds/projection-kind.js +2 -1
- package/dist/generate/kinds/projection-kind.js.map +1 -1
- package/dist/generate/kinds/read-model/field-lines.d.ts +11 -0
- package/dist/generate/kinds/read-model/field-lines.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/field-lines.js +85 -0
- package/dist/generate/kinds/read-model/field-lines.js.map +1 -0
- 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/live-rows-check.d.ts +22 -0
- package/dist/generate/kinds/read-model/live-rows-check.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/live-rows-check.js +47 -0
- package/dist/generate/kinds/read-model/live-rows-check.js.map +1 -0
- package/dist/generate/kinds/read-model/read-model-fields.d.ts +19 -0
- package/dist/generate/kinds/read-model/read-model-fields.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/read-model-fields.js +31 -0
- package/dist/generate/kinds/read-model/read-model-fields.js.map +1 -0
- package/dist/generate/kinds/read-model/read-model-store.d.ts +24 -0
- package/dist/generate/kinds/read-model/read-model-store.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/read-model-store.js +39 -0
- package/dist/generate/kinds/read-model/read-model-store.js.map +1 -0
- package/dist/generate/kinds/read-model/read-model-table.d.ts +11 -0
- package/dist/generate/kinds/read-model/read-model-table.d.ts.map +1 -0
- package/dist/generate/kinds/read-model/read-model-table.js +2 -0
- package/dist/generate/kinds/read-model/read-model-table.js.map +1 -0
- package/dist/generate/kinds/read-model-kind.d.ts +3 -0
- package/dist/generate/kinds/read-model-kind.d.ts.map +1 -0
- package/dist/generate/kinds/read-model-kind.js +103 -0
- package/dist/generate/kinds/read-model-kind.js.map +1 -0
- 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/kinds.d.ts.map +1 -1
- package/dist/generate/kinds.js +4 -0
- package/dist/generate/kinds.js.map +1 -1
- package/dist/generate/shared-writes.d.ts.map +1 -1
- package/dist/generate/shared-writes.js +9 -0
- 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 +7 -2
- 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 -0
- 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/dependencies-for.d.ts.map +1 -1
- package/dist/init/manifest/dependencies-for.js +10 -7
- package/dist/init/manifest/dependencies-for.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/layout/fit-block.js +4 -0
- package/dist/layout/fit-block.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/presets/no-flags.d.ts.map +1 -1
- package/dist/presets/no-flags.js +1 -0
- package/dist/presets/no-flags.js.map +1 -1
- 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/stack/end-to-end-vars.d.ts +9 -0
- package/dist/stack/end-to-end-vars.d.ts.map +1 -0
- package/dist/stack/end-to-end-vars.js +32 -0
- package/dist/stack/end-to-end-vars.js.map +1 -0
- package/dist/stack/stack-vars.d.ts.map +1 -1
- package/dist/stack/stack-vars.js +2 -0
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/briefing-of.js +2 -2
- package/dist/worker/briefing-of.js.map +1 -1
- package/package.json +6 -6
- package/templates/e2e/e2e-background-job-case.ts.tpl +12 -0
- package/templates/e2e/e2e-job.spec.ts.tpl +3 -3
- 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 +29 -5
- package/templates/init/e2e/start-application.database.ts.tpl +40 -2
- package/templates/init/e2e/start-application.memory.ts.tpl +36 -0
- package/templates/init/e2e/test-database-setup.ts.tpl +120 -0
- package/templates/init/e2e/vitest.e2e.config.ts.tpl +14 -4
- 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 +27 -4
- package/templates/init/platform/database/open-test-database.knex.ts.tpl +26 -3
- package/templates/init/platform/database/open-test-database.prisma.ts.tpl +27 -3
- package/templates/init/platform/database/open-test-database.typeorm.ts.tpl +27 -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 +75 -0
- 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/jobs/background-jobs.ts.tpl +4 -0
- package/templates/init/platform/jobs/create-background-work.ts.tpl +1 -0
- package/templates/init/platform/resilience/default-policy.ts.tpl +8 -1
- package/templates/init/rules/infrastructure.md.tpl +3 -3
- 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/personal-data/declaration.drizzle.ts.tpl +6 -1
- package/templates/personal-data/declaration.knex.ts.tpl +14 -1
- package/templates/personal-data/declaration.prisma.ts.tpl +6 -1
- package/templates/personal-data/declaration.typeorm.ts.tpl +21 -1
- package/templates/personal-data/spec.table.ts.tpl +39 -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/projection/projection.manual.ts.tpl +2 -2
- package/templates/projection/projection.ts.tpl +2 -2
- package/templates/read-model/contract.spec.ts.tpl +95 -0
- package/templates/read-model/drizzle/schema.ts.tpl +8 -0
- package/templates/read-model/drizzle/store.ts.tpl +41 -0
- package/templates/read-model/drizzle/table.tpl +38 -0
- package/templates/read-model/fake.ts.tpl +8 -0
- package/templates/read-model/knex/store.ts.tpl +41 -0
- package/templates/read-model/knex/table.tpl +26 -0
- package/templates/read-model/none/store.ts.tpl +17 -0
- package/templates/read-model/port.ts.tpl +24 -0
- package/templates/read-model/prisma/model.tpl +25 -0
- package/templates/read-model/prisma/store.ts.tpl +43 -0
- package/templates/read-model/typeorm/schema-export.tpl +4 -0
- package/templates/read-model/typeorm/schema.ts.tpl +9 -0
- package/templates/read-model/typeorm/store.ts.tpl +30 -0
- package/templates/read-model/typeorm/table.tpl +54 -0
- package/templates/read-model/wiring.container.tpl +21 -0
- package/templates/repository/drizzle/repository.ts.tpl +6 -9
- package/templates/repository/drizzle/table.tpl +1 -0
- package/templates/repository/typeorm/table.tpl +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,170 @@ What each version changes for someone who uses the kit. The packages of `package
|
|
|
4
4
|
together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
|
|
5
5
|
list the pull requests behind it.
|
|
6
6
|
|
|
7
|
+
## 0.112.0
|
|
8
|
+
|
|
9
|
+
**`ddd-ts-kit generate file-upload --text <utf-8|single-byte>` writes the upload of a text file, with a spec that sends one that is not UTF-8.** Without the flag the generated controller still declares a document (PDF, PNG, JPEG). With it, the upload is a CSV under the names browsers give one (`text/csv`, `application/csv`, and `application/vnd.ms-excel` stated as `text` in `contentRules`), held to the text rule asked: `single-byte` when the file may be in Windows-1252 or ISO-8859-1 as well as UTF-8, `utf-8` when it must be UTF-8. The spec of the controller, a controller of the kit or a Nest controller, then sends a multipart form through `multipartUploads()` of `@ddd-ts-kit/http/uploads`: under `single-byte` a Windows-1252 file reaches the command byte for byte, under `utf-8` it is answered 415, and under both a workbook under the name of a CSV is answered 415. The spec of the handler stages a CSV. Another value of `--text` is refused with the two it takes. See `docs/concepts/file-storage.md`.
|
|
10
|
+
|
|
11
|
+
**Breaking: an upload says the text it takes and the content rule of each media type, and a declaration that could receive no file is refused.** Two defects of the content check of `@ddd-ts-kit/kernel` and `@ddd-ts-kit/http`. A text upload passed only as valid UTF-8, so a CSV exported in Windows-1252 or ISO-8859-1 (a bank statement, a spreadsheet) was answered 415: `UploadSpec` and `ContentExpectation` take `text: 'single-byte'`, under which UTF-8 and every single-byte encoding that extends ASCII pass, while a binary file under the name of a CSV is still refused (a signature, a NUL, a control character other than tab, line feed, form feed and carriage return) and so are UTF-16 and UTF-32. The default stays `utf-8`: the bytes cannot say their encoding, and a route that reads UTF-8 must not receive, without a refusal, a file it decodes wrong. The kit never decodes: the handler and the storage get the bytes as sent, and the new `isUtf8(bytes)` of the kernel tells a reader which decoder to take. And `mediaTypes` accepted types the content check then always refused (`application/vnd.ms-excel`, which a browser on Windows sends for a CSV, `application/csv`, `application/octet-stream`): every accepted type now has a content rule, the one of the kit (`contentRuleOf`: a signature for `SIGNED_MEDIA_TYPES`, text for `TEXT_MEDIA_TYPES`, which gain `application/csv` and `text/tab-separated-values`) or the one the upload states in `contentRules`, `text` (text under another name) or `unchecked` (the bytes are taken as they are). A rule stated for a family (`{ 'image/*': 'unchecked' }`) never reaches a type a browser runs when it opens it (`NAMED_ONLY_MEDIA_TYPES`: `image/svg+xml`, `text/html`, `application/xhtml+xml`, `text/javascript`, `application/javascript`): an upload takes one only by naming it. A type with no rule, a family none of whose types has one (`video/*`), an entry that is no media type (`*/*`) and a stated rule that does nothing are refused when the route is declared, by `@Controller`, `defineRoute` and the routes of a Nest controller, with the type and the rules it may state; `FileStaging.uploadUrl` takes `text` and `contentRules`, keeps them in the `PendingUpload` that `confirm` applies, and throws on the same defects (`contentRuleDefects`). The new rule `files/upload-content-rule` of `ddd-ts-kit check` reports them on the line of the type, in a `*.route.ts` or a `*.controller.ts` whose `mediaTypes` and `contentRules` are written as literals. The OpenAPI document says both (`x-text`, `x-content-rules`, and the description of the file). See `docs/concepts/file-storage.md`, "What a route accepts: a content rule for each media type".
|
|
12
|
+
|
|
13
|
+
To move: run `ddd-ts-kit check --rule files/upload-content-rule` to list the uploads that accept a media type with no content rule; they never received a file of it, and now refuse to start. For each, state the rule: `contentRules: { 'application/vnd.ms-excel': 'text' }` for the CSV of a browser on Windows, `{ 'application/octet-stream': 'unchecked' }` for bytes the route takes as they are, or remove the type. A list built in a constant is not read by the rule: the application says it at start. Add `text: 'single-byte'` to an upload that receives text files which are not UTF-8, and decode them where they are read (`new TextDecoder(isUtf8(bytes) ? 'utf-8' : 'windows-1252')`). A part declared `application/csv` or `text/tab-separated-values` on a route that accepts it, or `text/*`, is now held to the text rule and passes, where it was refused.
|
|
14
|
+
|
|
15
|
+
**Breaking: `ddd-ts-kit check` reports an adapter the default policy cuts before the slower adapter it calls, rule `aspects/timeout-covers-delegate`.** A new rule, an error at once. It reports one case, the one nobody chose: an `external` or `gateway` adapter left to the default policy of the platform (no `ownPolicy(...)`, no `timeout(...)` of its own; an `@Adapter` that names no kind is `external`) that is given a port, a constructor parameter typed by it, whose adapter states a longer `timeout(<ms>)` around all its methods. Every call the inner adapter would still answer then fails in the outer one first, at the default limit, as a timeout of the outer one. The default limit is the fallback of `OUTBOUND_TIMEOUT_MS` in the configuration of the platform, else `timeoutMs` of `resilience/default-resilience-settings.ts`. The rule reads `@Adapter`, `@Gateway` and the bindings of the container of the kit (`bind(Port).toClass(Adapter).as(kind).with(...)`). An adapter that states its own limit, even a shorter one, chose it and is never reported. The fix is `ownPolicy(timeout(<ms>))` on the outer adapter, or `ownPolicy()` alone when it only hands the call over. Not judged, because the text does not show it: a platform wired by hand (`platform.adapter(...)`); a duration or a kind that is not a literal; an aspect that is a variable, a spread, a call of another name or under `when(...)`; a `timeout(` nested in the options of another aspect; a `@Timeout` on a method; a port or an adapter bound more than once, bound again by `rebind(`, or bound under a condition; a parameter typed by a name the adapter does not import from a file of the project (a type of a package, a declaration of its own file); two ports of one name unless each file imports its own from the file that declares it; an adapter reached through a middle adapter; a default limit that is not one number, or an environment that sets `OUTBOUND_TIMEOUT_MS`; the retries. See "A delegating adapter" of `docs/concepts/resilience.md`.
|
|
16
|
+
|
|
17
|
+
To move: `npx ddd-ts-kit check --rule aspects/timeout-covers-delegate` lists the adapters to take up; each gets the policy the fix names.
|
|
18
|
+
|
|
19
|
+
**Breaking: `verify-merge` fails on a migration of a branch that sorts before the last migration of the trunk, on the four ORM, and `merge-trunk --to-land` reorders it on a branch that already holds the trunk.** A push that passed the pre-push hook now stops on such a migration. A branch that lives more than a day holds a migration generated before the last one the trunk gained meanwhile. The migrator of Drizzle then skips it without a word on a database that already applied the later one, and a merge that keeps the journal of the trunk loses its entry; knex, Prisma and TypeORM run it late, so a database that follows the trunk and a new one run one history in two orders. Without a `<commit>`, `ddd-ts-kit verify-merge` now reads the migrations of the working tree against the trunk (the base of the worker, else `origin/HEAD`, else `origin/main`) and exits 1, naming the migration, the last one of the trunk and the command that brings the order right: under drizzle-kit an entry of the journal generated before the last entry of the trunk, or a `.sql` file the journal does not list and the trunk does not hold (`ddd-ts-kit merge-trunk`, or the `meta/` of the trunk then `ddd-ts-kit drizzle-generate --replay` once the trunk is merged otherwise); under knex, Prisma and TypeORM a name that sorts before the trunk's last (`ddd-ts-kit merge-trunk --to-land`). `--warn`, which the pre-push hook of a generated project passes, still softens what a merge lost and never this: the push stops. A working migration (`working-<what-it-does>`) is left out, its place being decided when the branch lands, and what is ordered is what the tool itself takes for a migration, by what it orders it by: every script of the folder of knex and the folders of Prisma that hold a `migration.sql`, by their name, and the classes of TypeORM whose name ends with 13 digits, by that number. `merge-trunk --to-land` on a branch that already holds the trunk used to answer that there was nothing to merge: it now lands the migrations all the same and leaves them to commit. Under drizzle-kit they are replayed; elsewhere those that do not follow the trunk's already are renamed after its last, in their order, the others keeping their name, and a TypeORM class and its `name` follow. It stops, the folder left as it was found so that the same command runs again, when the replay fails or when a later migration of the trunk changes the same table (the stop then says to delete the migration and to generate it again), or when the last file of the trunk carries no number a migration can follow. A rename never takes a number a file of the folder carries already. `--dry-run` says which migrations would move. A database of development, of a preview or shared that already applied a migration under its old name no longer matches (knex refuses every migrate, the migrator of Drizzle and TypeORM run the migration again): the command and the fix of `verify-merge` say to reset it or what to correct, for each tool. `verify-slice` says such a migration apart from what a merge lost: the slice does not fail on it, the push is refused on it. `npm run db:generate <name>` refuses a name a migration of the folder already carries on knex, Prisma and TypeORM too, as it did on Drizzle. The JSON of `verify-merge` gains `migrations`, counted in `errorCount`. The order is read from the files and from git, not measured against a database: see "Migrations: names, merges and order" of `docs/tools/persistence.md`.
|
|
20
|
+
|
|
21
|
+
To move: run `git fetch`, then `npx ddd-ts-kit verify-merge` on each open branch; a branch it reports follows the command it names before its next push (`npx ddd-ts-kit merge-trunk` under Drizzle, `npx ddd-ts-kit merge-trunk --to-land` under knex, Prisma and TypeORM, then commit the renamed migrations when the branch already held the trunk). A script that reads the exit code of `verify-merge --warn` as always 0 now gets 1 on such a migration. A migration to generate under a name already taken gets a name of its own.
|
|
22
|
+
|
|
23
|
+
**A call cut by the default time limit of the platform says so: `timeout(ms, { statedBy })`.** The platform of a generated project puts a default policy around every `external` or `gateway` adapter that states none: 2 seconds per attempt. An adapter that only hands its call to another adapter, slow by nature and bound with a longer limit of its own (a remote reader with 120 seconds), failed every call at 2 seconds, and the error named the outer adapter and nothing else. `timeout(ms, { statedBy })` of `@ddd-ts-kit/aspects`, and `@Timeout(ms, { statedBy })` of its decorators, now take who states the limit: the `TimeoutError` keeps it in `statedBy` and ends its message with it, its code `TIMEOUT` and its `timeoutMs` unchanged, and a `timeout` without `statedBy` writes the message it always wrote. The `default-policy.ts` that `init` writes names itself there, so the message reads `RemoteQuoteReader.read did not answer within 2000 ms (the default policy of the external and gateway adapters, OUTBOUND_TIMEOUT_MS: ownPolicy(timeout(<ms>)) on the declaration or the binding of this adapter states another, at least as long as the adapter it calls)`. See "A delegating adapter" of `docs/concepts/resilience.md`.
|
|
24
|
+
|
|
25
|
+
To move: a project generated earlier takes the message by adding `{ statedBy: '<who states it>' }` to the `timeout(settings.timeoutMs)` of its `src/platform/resilience/default-policy.ts`, as the template of this version does; nothing else changes, and a test that compares the whole message of a `TimeoutError` of the default policy reads the new ending.
|
|
26
|
+
|
|
27
|
+
**`ddd-ts-kit move-to-module` writes nothing when the move would close a cycle between modules, and says which.** The command moved the files and rewrote their imports, and `module/no-cycle` reported the cycle afterwards. It now reads the imports between the modules of the context as the rule does, before the move and with the move planned, and refuses a move that makes a module import another that imports it back, directly or through a third: the refusal names the cycle, each step of it with its imports (file and line, the steps the move adds told apart from the ones there now), and the file at the other end of the imports the move adds, to move along in the same command. `--dry-run` refuses with the same words. The new `--allow-cycle` moves all the same and says the cycle with the move, in the text and under `cycles` of `--json`. A cycle that is there before the move is not counted, and the command judges what the rule will: a project that turns `module/no-cycle` off is not judged, nor a cycle whose every import is in a file the config turns the rule off for, and only the files `ddd-ts-kit check` reads are read. Under `--json`, the refusal carries `cycles` and `along` (the files or folders to move along) in its `error`. `context-layout` is unchanged: it already leaves where it is a file that would make a module depend on another.
|
|
28
|
+
|
|
29
|
+
To move: a script that runs `ddd-ts-kit move-to-module` and must keep moving a cluster one file at a time passes `--allow-cycle`; otherwise name in one command the files the refusal lists.
|
|
30
|
+
|
|
31
|
+
**Breaking: on a PostgreSQL server (`DATABASE_URL`), an end-to-end run of a generated project copies the migrated database once, in a global setup, and each spec file copies the tables of that copy, emptied but for those the project lists.** Each spec file used to copy the migrated database itself, in the hook that starts the application. Three things followed on a migrated database that holds rows (measured at 474 MB on PostgreSQL 18): a copy takes 6 seconds alone and 46 to 56 seconds when four files copy at once, more than the 30 seconds of a hook; nothing held the pools of the applications under the connections of the server, so workers times 10 connections ended in `too many clients`; and the copies of a run that was killed, or of a file that failed while it started, stayed on the server for an hour, or for good. Now `test/support/test-database-setup.ts`, a global setup of the end-to-end run, opens the run once, where no timeout of a hook applies (`test/support/test-database-run.ts` and the files it is made of, `test-database-session.ts`, `-leftovers.ts`, `-budget.ts`, `-copy.ts`, `-emptying.ts`, `-server.ts`): it copies the migrated database, one run at a time on the server, and empties the copy. `cloneDatabase(url)` of `test/support/test-database-clone.ts` copies that template for its file, one copy at a time in a run, in a fraction of a second whatever the migrated database holds. **What a file finds.** The run empties every table of its copy but those `KEPT_TABLES` lists in `test/support/test-database-kept.ts`, a file of the project: as generated, what the migration tool writes and, with an audit trail, the `audit` schema, which is left as the migrated database holds it. A name is `<schema>.<table>`, or `<schema>.*`, written as the server stores it and without quotes, so in lower case unless the table was created between quotes (`"Countries"` is listed as `public.Countries`); `<schema>.*` keeps every table of the schema whatever its name holds, and a table whose name holds a dot or a quote is kept through it only; any other shape (`*`, `public`, a quoted name, `public.plans.v2`) refuses the run with the shapes a name takes, and a name that is no table of the database (a misspelling, another case, a view) is said in one line, except the names the generated list holds for a table its tool has not created yet. The tables are emptied in one `truncate` without `cascade`, each one alone (`only`): a kept table that references an emptied one refuses the run with both names, a kept table that inherits from an emptied one keeps its rows, and a kept partition of an emptied table, or a kept table that references such a partition, refuses the run with both names. A table another role owns, or one in a schema the role of the run may not use, is left with its rows and named, a table of an extension is left, the materialized views are refreshed, a sequence no column owns keeps its value. The run names on its error output the tables it emptied that held rows, up to 20 of them, and above 64 MB what the copy took; a run with nothing to say writes nothing. **The connections.** The global setup counts the files that run at once, the workers of the run and no more than the files of this run: under Vitest the list of the runner once the filters of the command line are applied, and the share of a shard; under Jest, which hands no list to a global setup, the spec files under `test/` that the patterns of the command line match as Jest matches them, less those `testPathIgnorePatterns` ignores, and the share of a shard. Where the count cannot be made or finds nothing (a run that watches, an empty list, under Jest no spec file under `test/` among those of the run, a pattern that is no expression, no `test/` directory) the workers alone count, so a run is never given more files than it counted. The setup reads what the server has left (`max_connections`, less what it reserves and what is open, and no more than the connection limit of the role), and gives each application under test a pool of its share less one connection to spare, 10 at most (`DatabaseClone.poolSize`, handed to the connection of the four ORM; `connectToDatabase` of a project on Drizzle takes a `poolSize` like the three others). A run that does not fit is refused before any file starts, with its numbers, the number of files at once that fits and what raises the bound that holds it, for one `8 spec files at once need 24 connections (2 for each application at least and 1 to spare), and the role app has 12 left (connection limit 13, 1 open): run at most 4 at once (npm run test:e2e -- --maxWorkers=4), or raise the limit of the role (alter role app connection limit <more>).` `TEST_DATABASE_CONNECTIONS` states fewer connections than the server leaves; a value that is not a whole number, or above what the server leaves, is refused. **What a killed run leaves.** A database of a run is named `<database>_test_<run>_template` or `<database>_test_<run>_<random>`. The run holds an advisory lock keyed by its name, on a session to the `postgres` database of the server, and writes every 15 seconds the time of the server in the comment of its template; its teardown never throws. The global setup of a run drops a database named after a run only when the lock of that run is free, it has not written for a minute and nobody is connected to the database: a run that lives, in another checkout or on another machine, keeps its databases, and a database with any other name is never dropped. **When the server ends a session.** The run takes another session and its lock again at once, and says so when it could not. With its lock again it looks for its template: when that one is gone (the run had no session for more than a minute and another run dropped what it held dead, or an administrator did), it says that it lost its databases, and each file that then cannot copy the template fails with that sentence instead of the `template database ... does not exist` of the server. The copy of the migrated database has a session of its own: when the server ends it, what is left of the copy is dropped and the copy made once more, and a second end is said as such. A statement of the run that somebody cancels (`pg_cancel_backend`) is no ended session: the run says that its copy was cancelled and does not take it again. **The timeouts of the role.** The sessions of the run itself, the one of its lock and those that copy, empty and drop its databases, set `statement_timeout`, `lock_timeout` and, from PostgreSQL 17, `transaction_timeout` to 0 for themselves: a role is given such a timeout (`alter role <role> set statement_timeout = '30s'`) for the requests of an application, and what the run does lasts as long as the database is large. The pool of the application under test keeps the timeouts of its role. The address is the server itself, not a pooler in transaction mode, and `DATABASE_URL` cannot name the `postgres` database: the run says so. **Outside an end-to-end run** (`openTestDatabase(url)` in a spec of the unit run, a project without an HTTP stack), the call opens a run of its own, which copies and empties the migrated database itself. Nothing counts the files that do so at the same time: each opens a small pool, 4 connections at most, and is refused when the server has no room for it at that moment. **Any way of starting the runner.** The files directly under `test/support/` import one another by a relative path (`./test-database-run`), since a runner loads its global setup before any alias exists: the setup loads however the runner is started, and the scripts are the ones a project on Jest had. The spec files of a project on Jest are ES modules, as before: a bare `npx jest -c jest.e2e.config.js` fails with `Must use import to load ES Module`, and `NODE_OPTIONS=--experimental-vm-modules npx jest -c jest.e2e.config.js`, or the runner of an editor given that variable, starts the run as the scripts do. Under `"importExtension": "js"` that path ends with the `.ts` of the source, which the transform of the runner finds, and `init` writes `"allowImportingTsExtensions": true` and `"noEmit": true` in `tsconfig.json`, which let the type check read it, and both as `false` in `tsconfig.build.json`: the build emits what it emitted before. See [the testing strategy](docs/concepts/testing-strategy.md).
|
|
32
|
+
|
|
33
|
+
To move: these files are written once by `init`, so a project already generated keeps what it has until it takes them. Commit everything first, then run `npx ddd-ts-kit init --force` and read `git diff` before you commit again: it rewrites from the templates of this version every file `init` owns, not the test support alone, and an edit made by hand in one of them is lost. That is all of `src/platform/**`, `test/e2e/support/*`, `test/support/*`, `scripts/*`, the configurations of the runner, of Stryker, of ESLint, of the ORM and of lefthook, `tsconfig.json`, `.github/actions/setup`, the Dependabot configuration, `test/architecture/extractable.spec.ts`, the declarations file of each context, `docs/behaviour/*.md`, and the scripts of `package.json` that `init` generates, whose names are written again: a script you changed under one of those names is replaced, one you added under another name stays. It keeps the workflows, `README.md`, `AGENTS.md`, `CLAUDE.md`, `src/main.ts`, the migrations, the spec files, the API documents, the published language, and a `test/support/test-database-kept.ts` that exists: once written, that file is the project's ([Migrate after a kit upgrade](docs/guides/commands.md)). To take the files one by one instead, generate a project with the same flags in a temporary directory and copy `test/support/test-database-*.ts`, the function `openServer` of `src/platform/database/open-test-database.ts`, `src/platform/database/connect-to-database.ts` on Drizzle, the `globalSetup` line of `vitest.e2e.config.ts` or of `jest.e2e.config.js`, and under `"importExtension": "js"` the `allowImportingTsExtensions` and `noEmit` lines of `tsconfig.json` and of `tsconfig.build.json`; the rule `imports/alias-only` of this version lets those files import one another by a relative path. Then read `test/support/test-database-kept.ts`: add each table whose rows a migration inserts and the application reads at boot or in a request (a spec that read such a row found it until now); write the table of the migration tool under its name when the project gives it one (`tableName`, `migrationsTableName`, `migrations.table`); on Drizzle and TypeORM, a table the ORM does not declare was never emptied by `reset()` and is emptied now, unless listed. The audit trail is not emptied: a migrated database that holds audit rows hands them to every file, as before. Point `DATABASE_URL` at the server itself and at a database other than `postgres`. The copies an earlier version left carry another name (`<database>_test_<ten digits>_<random>`) and are no longer dropped: list them once with `select datname from pg_database where datname ~ '_test_[0-9]{10}_[0-9a-f]{8}$'` and drop each (`drop database "<name>" with (force)`).
|
|
34
|
+
|
|
35
|
+
**`imports/alias-only` lets a file directly under `test/support/` import its neighbour by `./<name>`.** A test runner loads its global setup, and every file that one imports, before any alias of the project exists: Jest applies no `moduleNameMapper` there. A global setup made of several files could therefore import them by alias only when the runner was started under a loader that resolves aliases, and failed with `Cannot find module '$test/support/...'` from `NODE_OPTIONS=--experimental-vm-modules npx jest` or from the runner of an editor. The rule, in `ddd-ts-kit check` and in `@ddd-ts-kit/eslint-plugin`, now leaves that one relative path alone: from a file directly under `test/support/`, a specifier `./<name>` that names a neighbour file. Nothing else changes: from `test/support/`, `../e2e/support/start-application`, `./parts/part`, `./.`, `./..` and a `./parts` that is a directory are reported as before, and a file of any other directory still imports its neighbour by alias. The rule judges the name of that neighbour against the files on disk, and `eslint --fix` rewrites it: a `.ts` source without its extension under `"importExtension": "none"`, the name of the source under `"js"` (`./test-database-run.ts` for `./test-database-run.js`, `./esm.mts` for `./esm.mjs`), since the runner loads the sources and a `./test-database-run.js` there passes the type check, then stops the run on `Cannot find module`. A file that exists as it is named (a JSON file, a JavaScript file) is left alone, and a directory named as a neighbour is fixed to the alias of its index file. `init` writes what lets the type check of such a project read that ending, and `imports/alias-declared` holds it. See [Import aliases](docs/tools/import-aliases.md).
|
|
36
|
+
|
|
37
|
+
**Events of one key applied at once to a read model are no longer refused for another unique value of its table.** A read model table that holds a second value unique (a unique index on a slug, a number) could refuse one of two writes of the same row made at once, on PostgreSQL, with the unique violation of that other index: the insert named the key alone as its conflict target, and two inserts that cross meet on the other index first. No write was lost, since the handler of the event failed and the event is delivered again, but the error named a value no other row held. The stores of `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/knex` and `@ddd-ts-kit/typeorm`, and on `@ddd-ts-kit/prisma` the copy of a rebuild (its model already skipped on any unique value), now insert with a statement that skips on any unique value, and only when it wrote nothing with a second one that names the key: a key that is held is compared with the event and written if the event is newer, and a value another row holds is still refused by the database. `readModelStoreContract` and `readModelRowsContract` of `@ddd-ts-kit/testing` gain the cases, for a storage that says `uniqueTitle`: writers that insert one row at once, in the table and in the copy of a rebuild, and several rows that take one unique value at once, of which one holds it and the others are refused. See [CQRS](docs/concepts/cqrs.md).
|
|
38
|
+
|
|
39
|
+
To move: nothing for a table of the four ORM. A `ReadModelTable` of your own that runs the contract with `uniqueTitle` and holds the value in memory takes it before its write, as an index does, and gives it back when nothing was written: checked after the write, two rows inserted at once both pass.
|
|
40
|
+
|
|
41
|
+
**Two first saves of one aggregate made at once are a lost update on a table with a unique column too, never a unique violation for the value they both write.** On PostgreSQL, the first save of an aggregate inserted with the key alone as its conflict target (`ON CONFLICT (id) DO NOTHING`). Two inserts of the same id made at once (a request delivered twice, a command run again while its first run commits) both pass the check of the key, then meet on the other unique index of the table (an email, a number), and the one that lost was answered `UniqueViolationError` (code `CONFLICT`, 409) for a value no other row held, where `optimisticUpdate` promises `ConcurrencyError` (code `CONCURRENCY_CONFLICT`). `insertIgnoringConflict` of `@ddd-ts-kit/knex` and of `@ddd-ts-kit/typeorm` now inserts with a statement that skips on any unique value, and only when it wrote nothing with a second one that names the key: a key that is held writes no row, and a value another row holds is still refused by the database, with the error of the driver as the cause of the `UniqueViolationError`. `@ddd-ts-kit/drizzle` gains the same helper, `insertIgnoringConflict(() => executor.insert(table).values(row), table)`, which says whether it inserted, and `generate repository` and the identity preset write it on Drizzle in place of `onConflictDoNothing({ target: primaryKeyOf(table) })`. A repository on `@ddd-ts-kit/prisma` was not concerned: `skipDuplicates` names no target and `rowsCreated` tells a taken id from a taken value. `repositoryContract` of `@ddd-ts-kit/testing` gains the case, with the new option `createAggregateAgain`: the same new aggregate saved several times at once, one save that writes it and the others refused with `CONCURRENCY_CONFLICT`. The stores of the kit were not concerned: their tables hold no second unique value two writers of one key could both write. See [Persistence](docs/tools/persistence.md).
|
|
42
|
+
|
|
43
|
+
To move: nothing on Knex and TypeORM, whose repositories call the helper. On Drizzle, `grep -rn "primaryKeyOf(" src` lists the first saves to take up: `insertion.onConflictDoNothing({ target: primaryKeyOf(table) }).returning(...)` becomes `insertIgnoringConflict(() => this.database.executor().insert(table).values(row), table)`, which answers a boolean where the statement answered its rows (`? 1 : 0` under `optimisticUpdate`). Give `createAggregateAgain` to the `repositoryContract` of a repository over a table with a unique column, and run it on a real PostgreSQL: one connection, as PGlite has, never crosses two inserts.
|
|
44
|
+
|
|
45
|
+
**Breaking: under `"importExtension": "js"`, `imports/alias-declared` reports a `tsconfig.json` that does not let the type check read the `.ts` by which a file of `test/support/` names its neighbour; it reports a build configuration that would write nothing, and `ddd-ts-kit build-aliases` refuses one.** The files a test runner loads as its global setup import one another by `./<name>.ts` in such a project. The compiler refuses that ending (`TS5097`) unless `tsconfig.json` sets `"allowImportingTsExtensions": true`, which it accepts only in a configuration that emits nothing (`"noEmit": true`), and a `tsconfig.build.json` that extends it without setting both back to `false` compiles without an error and writes no file: `build-aliases` then finds no output, or rewrites an earlier one. `init --import-extension js` writes those four lines, and `ddd-ts-kit check` now holds them: it reports `tsconfig.json` when a file directly under `test/support/` names a neighbour by its `.ts` and neither `allowImportingTsExtensions` nor `rewriteRelativeImportExtensions` is set there, and, whatever `importExtension` is, `tsconfig.build.json` and each tsconfig a script of `package.json` compiles what ships with (`tsc -p tsconfig.prod.json`, `tsc` alone for `tsconfig.json`) when it resolves `noEmit` as `true`, or `allowImportingTsExtensions` as `true` without `rewriteRelativeImportExtensions` or `emitDeclarationOnly`. Each finding names the lines to write. An `extends` is followed as the compiler follows it: a relative path with or without its `.json`, and a package installed in the `node_modules` of the project root; a package found through its `exports`, or in a `node_modules` above the root, is not. `ddd-ts-kit build-aliases` refuses, exit 2, a tsconfig that resolves `noEmit` as `true`: the compiler wrote nothing with it, and the command used to answer `rewritten 0 alias specifier(s)` over an earlier output, which then shipped. The compiled output is what it was: no option rewrites an import of the sources, so no helper is added to it. A project that writes its imports without an extension (`"importExtension": "none"`, the default) is given none of these options by `init`, and is reported only for a `noEmit` it wrote itself in a configuration its build inherits. See [Import aliases](docs/tools/import-aliases.md).
|
|
46
|
+
|
|
47
|
+
To move: `npx ddd-ts-kit check --rule imports/alias-declared` lists the two files when they are concerned. Write `"allowImportingTsExtensions": true` and `"noEmit": true` under `compilerOptions` in `tsconfig.json`, and `"compilerOptions": { "allowImportingTsExtensions": false, "noEmit": false }` in `tsconfig.build.json`, or let `npx ddd-ts-kit init --force` write both files after a commit. A script of your own that emits with `tsc -p tsconfig.json` now writes nothing: point it at `tsconfig.build.json`.
|
|
48
|
+
|
|
49
|
+
**Breaking: `ReadModelTableNotReadyError` says what is missing and writes the migration in two steps, for the columns its store maps and no other, and is built from a `ReadModelTableState`.** Its message named the table and the columns that refuse NULL, then gave the statement to write with a `<column>` to fill in. It now names the table, each thing that keeps it from holding a trace, and the whole migration as PostgreSQL statements, in its `steps` field (`definition`, then `validation`) and, both in order, in `statements`. The state it reports is the reading of the store (`PostgresTraceColumns` of `@ddd-ts-kit/kernel`, behind the tables of `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/prisma` and `@ddd-ts-kit/typeorm`), which looks at the columns the store maps as fields of its row and at nothing else: the key, the tenant column whatever its name, the stamp and a column the store does not map are never read, never altered and never emptied. Among the mapped columns it tells those that refuse NULL (`refusing`) from those no migration opens (`unfit`: a part of the primary key, an identity column, a generated column, a column of a domain that refuses NULL, a column that is not there), and says when the table itself is not in the database; a store whose mapped column is unfit refuses, with no statement for that column, where it failed later on the database. The stamp columns carry the names the definition of the store gives them, so a renamed `deleted` column is the one the migration names; on TypeORM, the names the naming strategy of the data source gives the table and its columns.
|
|
50
|
+
|
|
51
|
+
The first step is the change of definition, one statement: NOT NULL dropped on each refusing column and, in the same `alter table`, the constraint `<table>_live_rows_whole` written again, `not valid`. Nothing commits between the two, on any migration tool. Before it changes anything, the statement reads the constraint the database holds under that name and fails on one that is not written as the kit writes it, naming the constraint and its table: a constraint of the project that happens to carry the name is never dropped, on the database that was read or on another. The second step validates the constraint and empties the rows deleted before, with an update that touches only the rows still holding a value. Every identifier is quoted, the dollar quote of the first step is one no name of the statement holds, the statements hold no backslash and no question mark (a string of JavaScript and `knex.raw` carry them as they are; a column whose own name holds a question mark is said under the statements, to write `\?` in `knex.raw`), and the migration can be run twice. The name of the constraint is cut at 63 bytes, as PostgreSQL cuts it, not at 63 characters.
|
|
52
|
+
|
|
53
|
+
The first step takes the lock that stops the readers and the writers of the table, and holds it to the end of its transaction. On a small table both steps go in one migration. On a large one the second step goes in a migration that runs outside the transaction of the first, where the validation and the update stop neither readers nor writers, and each tool needs something for that: knex runs every pending migration in one transaction unless the second ends with `export const config = { transaction: false };`; TypeORM does unless the data source says `migrationsTransactionMode: 'each'`; Drizzle always does, so the second migration is added and applied after the first; Prisma commits each statement of a file except a file with a `do` block, which the first step is, so two migrations. `docs/tools/persistence.md`, "A large read model table: the second step apart", gives each case as it was run, with the locks read in `pg_locks`.
|
|
54
|
+
|
|
55
|
+
The constraint is read exactly: only the form the kit writes, as PostgreSQL prints it back, counts as holding columns; `(deleted or title is not null) and ..` or `deleted or not (..)` under that name is another check. A constraint that is not validated, another check under that name, and any other check constraint that names a column of the row, unless it is written for the live rows only (`deleted or ..`), are read and reported as warnings by `ReadModelTables`, not as refusals: nothing in the columns refuses a trace, and the kit does not decide what an arbitrary check does. A refusal read from a definition alone (Drizzle, TypeORM, a column declared not null there) carries no statement and says to declare the column nullable.
|
|
56
|
+
|
|
57
|
+
To move: code that builds the error itself (a `ReadModelRows` of your own) passes a state, `new ReadModelTableNotReadyError({ table, exists: true, refusing, unfit: [], row, deleted: 'deleted' })` (`schema` and `constraint` when known), where it passed `(table, columns)`; a test that compared the whole message compares `table`, `columns`, `steps` or `statements`. A read model whose store maps a part of its primary key, an identity column, a generated column or a column of a domain that refuses NULL as a field of its row is now refused before its first trace: take that column out of the fields the store maps, or make it an ordinary nullable column. A TypeORM entity without `tableName` is named in a refusal by the table the naming strategy gives it (`strict_row`), not by its entity name.
|
|
58
|
+
|
|
59
|
+
**The read model tables an application lists are checked when it starts and, from the command line, before a deployment, each by its own store and each root for the contexts it hosts.** A table that cannot hold the trace of a deleted row was refused when its store was built (Drizzle, TypeORM) or before its first trace (the four ORM). In an application whose container builds a store at its first use, both came with the first request or the first event that reached the read model, in production, one table at a time, and nothing listed the tables an upgrade left to migrate. A `TableReadModelStore` of `@ddd-ts-kit/kernel` now answers `tableState()`, the reading its table makes before its first trace (`tableState()` of the `ReadModelTable` port, implemented by the table of `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/prisma` and `@ddd-ts-kit/typeorm`), as a `ReadModelTableState`. `ReadModelTables` of the kernel takes a list of entries, each a name and what builds a store, and asks it of each: `states()`, `notReady()`, `require()` (which refuses with `ReadModelTablesNotReadyError`, one error that names every table with its migration), `atStart(logger, 'required' | 'reported')` for a start and `report()` for a command. The verdict is the one of the store by construction: the same table, schema, columns and stamp names, read by the same code, and a table nobody lists is never read, whatever else the database holds. Every entry is tried: one whose store cannot be built, or whose table the database refuses to read (a role without the right to use the schema), is told under its name with its cause, in `unread` of the same error, the others are still read, and `'reported'` logs it and lets the start go on. The cause is said in a few words, the message of the driver and never the statement an ORM wraps it in. A database that cannot be reached at all (a refused connection, a host that is not found, a timeout, read through the wrapping of each ORM) is not a refusal: the start goes on, `'required'` or `'reported'`, with one warning that gives the short cause, since an application never depended on its database being up to start, and `db:read-models` exits 3. What the check cannot decide is a warning at the start and a line of the command: a check constraint that is not validated or is not written as the kit writes it, another check constraint that names a column of the row, a view, a store the application names as not listed. A store without a table (memory, OpenSearch) has nothing to say. `readModelTablesContract` of `@ddd-ts-kit/testing` holds the four ORM to it on PostgreSQL.
|
|
60
|
+
|
|
61
|
+
A project generated by `ddd-ts-kit init` on one of the four ORM has the list in `src/platform/database/read-model-tables.ts`, between markers: an entry is the context of a read model and the class of its store, `['billing', KnexInvoiceSummaries]`, and the context is one of those the file holds in `Contexts`, which `generate context` fills, so an entry under a misspelt name does not compile. `ddd-ts-kit generate read-model` adds the store it writes, under an alias that carries its context when another context holds a store of that class name. `init`, with or without `--force`, adds the read model stores the tree holds and the list does not, so a project generated before the list existed gets it filled; it reads every class of the persistence of each context, several in one file and a store over a base class of the project included; a store it cannot list with certainty (its own constructor is not `(database)` nor `(database, scope)`, or is inherited; a generic class) is named in a note and in `NOT_LISTED` of the file, and the check says at each start that nothing checks its table. A store left out on purpose is a comment of the list that holds `<context>: <Store>` and the reason: `init` leaves it out and nothing warns of it, where an entry merely deleted comes back at the next `init --force`. An application checks, when it starts and before a consumer is subscribed or a request served, the entries of the contexts it hosts: the whole application and the worker every context but those run as services, a service (`generate service`) its context alone, so each root starts on a database that holds its own tables. A listed table that is not ready stops the start, which in a rolling deployment keeps the old instances serving until the migration ran; a pipeline that starts the application before its migrations passes `readModelTables: 'reported'` to `composeApplication`, and the same message is logged as one error. `npm run db:read-models` (`scripts/read-model-tables.ts`) runs the same check on the database `DATABASE_URL` names, for every context or for those `-- --context <name>` names, and needs no other variable of the application: it prints the database it reads (name and host, never credentials, since a `.env` file may give the address), how many tables it read and their names, then each one that is not ready with its migration, and exits 0 when all are ready, 1 when one is not, 2 when `DATABASE_URL` names no database, 3 when no table could be read, 4 when `--context` names a context no listed read model belongs to, with the contexts the list holds. Since the list is a file every context shares, `generate read-model` on an ORM is a step of the conductor under `--local-only` (`docs/guides/parallel-work.md`). The persistence skill of the plugin says when to run the command and how to write the migration of its refusal, and the parallel-work skill names the new conductor step. On TypeORM, the table and the columns of a refusal, the mark of a deleted row included, are named as the database holds them under the naming strategy of the data source. See `docs/concepts/cqrs.md`, "Every table checked at the start, and before a deployment", which also says what the check does not read (a trigger, a rule, a check of a domain, the table under a view).
|
|
62
|
+
|
|
63
|
+
To move: commit, then `ddd-ts-kit init --force`. It writes `src/platform/database/read-model-tables.ts` with the read model stores of the tree listed under their contexts (and keeps the list of a file that has the markers), `scripts/read-model-tables.ts`, the call of the start and the `db:read-models` script of `package.json`; read its notes for a store it could not list. By hand instead:
|
|
64
|
+
|
|
65
|
+
1. `src/platform/database/read-model-tables.ts`:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import {
|
|
69
|
+
AsyncLocalStorageExecutionScope,
|
|
70
|
+
ReadModelTables,
|
|
71
|
+
type ExecutionScope,
|
|
72
|
+
type ReadModelInATable,
|
|
73
|
+
} from '@ddd-ts-kit/kernel';
|
|
74
|
+
import type { Persistence } from '@/platform/database/persistence';
|
|
75
|
+
// ddd-ts-kit:imports
|
|
76
|
+
import { KnexAgenda } from '@/contexts/scheduling/infrastructure/persistence/knex-agenda.repository';
|
|
77
|
+
// /ddd-ts-kit:imports
|
|
78
|
+
|
|
79
|
+
type Store = new (database: Persistence['database'], scope: ExecutionScope) => ReadModelInATable;
|
|
80
|
+
|
|
81
|
+
type Contexts = [
|
|
82
|
+
// ddd-ts-kit:contexts
|
|
83
|
+
'scheduling',
|
|
84
|
+
// /ddd-ts-kit:contexts
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const LISTED: readonly (readonly [context: Contexts[number], store: Store])[] = [
|
|
88
|
+
// ddd-ts-kit:read-model-tables
|
|
89
|
+
['scheduling', KnexAgenda],
|
|
90
|
+
// /ddd-ts-kit:read-model-tables
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
const NOT_LISTED: readonly string[] = [
|
|
94
|
+
// ddd-ts-kit:read-models-not-listed
|
|
95
|
+
// /ddd-ts-kit:read-models-not-listed
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
export function readModelTables(persistence: Persistence, contexts?: readonly string[]): ReadModelTables {
|
|
99
|
+
const scope = new AsyncLocalStorageExecutionScope();
|
|
100
|
+
|
|
101
|
+
const listed = LISTED.map(([context, Store]) => ({
|
|
102
|
+
context,
|
|
103
|
+
name: Store.name,
|
|
104
|
+
build: () => new Store(persistence.database, scope),
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
return new ReadModelTables(listed, NOT_LISTED).hosting(contexts);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
One line per read model kept in a table: the name of its context, as `ddd-ts-kit.config.json` declares it, and the class of its store. The scope is given to a store of tenant data and never read by the check.
|
|
112
|
+
|
|
113
|
+
2. The start. On a container, `platformModule` takes the hosted contexts as a third parameter, `hosted?: readonly ContextModule[]`, reads their names (`const contexts = hosted?.map(({ name }) => name);`), its module holds `onStart: ({ resolve }) => readModelTables(persistence, contexts).atStart(resolve(Logger), options.readModelTables),`, and `compose-application.ts` calls `platformModule(persistence, options, contexts.modules)`. On a platform wired by hand, `readModelTables(contexts: readonly string[]): ReadModelTables;` in the `Platform` interface, `readModelTables: (contexts) => readModelTables(persistence, contexts),` where the platform is created, `start: () => start(platform, options, contexts),` in `composeApplication`, a third parameter `hosted: readonly ContextWiring[]` of `start`, and `await platform.readModelTables(hosted.map(({ name }) => name)).atStart(platform.logger, options.readModelTables);` there, before `options.events.start()`. In both, `readonly readModelTables?: ReadModelTablesAtStart;` in `PlatformOptions`.
|
|
114
|
+
|
|
115
|
+
3. In `package.json`, `"db:read-models": "tsx --env-file-if-exists=.env scripts/read-model-tables.ts"`, and `scripts/read-model-tables.ts`, which opens the persistence on `process.env['DATABASE_URL']` alone (`openPersistence({ databaseUrl })`), refuses with exit code 4 a `--context` that is not among `readModelTables(persistence).contexts`, prints `(await readModelTables(persistence).hosting(contexts).report()).text`, sets `process.exitCode` from `outcome` (`ready` 0, `not-ready` 1, `unread` 3), and closes the persistence.
|
|
116
|
+
|
|
117
|
+
Before the next deployment, `DATABASE_URL=<its database> npm run db:read-models` lists what is left of the 0.111.0 migration.
|
|
118
|
+
|
|
119
|
+
## 0.111.0
|
|
120
|
+
|
|
121
|
+
**The briefing of a worker says upfront that a branch keeps one working migration.** A worker whose second slice changed the schema generated a second working migration, and learned only from the refusal of `drizzle-generate --replay` at the merge that a branch keeps one and generates it again. `worker-scope` and the context builder agent now say it before the first slice.
|
|
122
|
+
|
|
123
|
+
**`ddd-ts-kit context-layout` no longer puts a file kept at the level of a context in the module it imports when the code of another module imports it.** The command told the module of such a file by its imports alone: a reader that imports one module and is used by another went into the first, and the second then depended on it, which `module/no-cycle` reported when the first already depended on the second. The file now stays where it is and the command lists it with both modules, as it does a file whose imports name two modules: `move-to-module` takes it to the one it belongs to. The specs, fakes and builders are told as before.
|
|
124
|
+
|
|
125
|
+
The command also names the rules of the tests `init` wrote for the coding agents (`.claude/rules/tests.md`, `.github/instructions/tests.instructions.md`) when they still name the test folder of each context alone, once a spec moved into a module: add `<contexts>/*/*/test/**` beside it, as it already says of a config of a test runner.
|
|
126
|
+
|
|
127
|
+
**On a PostgreSQL server (`DATABASE_URL`), each end-to-end spec file of a generated project runs on a database of its own, copied from the migrated one, so the files run at the same time and two runs at once no longer block each other.** Until now every file shared the database the URL names and emptied its tables in `reset()`: the files had to run one after the other (`fileParallelism` off under Vitest, one worker under Jest), two runs started together could end in a deadlock on `truncate` (40P01), and the audit trail, which nothing empties, carried the rows of the other files. `openTestDatabase(url)` of the four ORM now creates a database from the migrated one (`create database ... template`), connects the persistence to it and drops it at `close()` (`drop database ... with (force)`); the new `test/support/test-database-clone.ts` does it for all four. The copy gives its address (`TestDatabase.url`), which `startApplication` hands to the configuration of the application as `DATABASE_URL`: an adapter that opens a connection of its own from `config.databaseUrl` reaches the copy too. `reset()` still empties the tables of the copy between two tests, the audit trail starts empty in each file, and the migrated database is never written by a test. `vitest.e2e.config.ts` and `jest.e2e.config.js` no longer read `DATABASE_URL`: they keep the files one after the other only where a server is still one for every file, a broker (`AMQP_URL`, `KAFKA_BROKERS`, `NATS_URL`) or a Redis protocol server (`REDIS_URL`). A server that was never migrated is refused with `npm run db:migrate` in the message instead of `relation does not exist`, and so are a role that may not copy the database and a migrated database somebody else is connected to. A copy is named `<database>_test_<seconds of its date>_<random>`; the ones a killed run left are dropped by the next file that starts, an hour later, and no database with another name ever is. See [the testing strategy](docs/concepts/testing-strategy.md).
|
|
128
|
+
|
|
129
|
+
What changes on the server: the role of `DATABASE_URL` needs `CREATEDB` and owns the migrated database, or is a superuser (the role of the generated `docker-compose.yml` and of the generated pipelines is one), the server is PostgreSQL 13 or later, and nobody else may be connected to the migrated database while a file starts (an application left running on it, a console): PostgreSQL copies a database only then.
|
|
130
|
+
|
|
131
|
+
To move: these files are written once by `init`, so a project already generated takes them by hand. Generate a project with the same flags in a temporary directory (`npx ddd-ts-kit init` with the `stack` of your `ddd-ts-kit.config.json`) and copy from it: `test/support/test-database-clone.ts` (new); in `src/platform/database/open-test-database.ts`, the import of `cloneDatabase` and the function `openServer`, which connects to `clone.url`, returns `url: clone.url` and ends its `close` with `await clone.drop()`, and the `url` member of `TestDatabase`; in `test/e2e/support/start-application.ts`, `DATABASE_URL: database.url ?? 'postgres://in-process/tests'` in the call of `loadConfig`; in `vitest.e2e.config.ts`, the `fileParallelism` line, removed, or kept on the broker and Redis variables alone; in `jest.e2e.config.js`, `sharedServer` and `maxWorkers`, the same way. Then, where the role is not a superuser, let it create databases and own the migrated one (`alter role <role> createdb`, `alter database <database> owner to <role>`). A spec of your own that connects to `DATABASE_URL` itself now holds a session on the migrated database and makes the other files fail: connect it to the `postgres` database, or read through the application.
|
|
132
|
+
|
|
133
|
+
**`ddd-ts-kit generate personal-fields <context> <table> --personal <column>,... --subject <column>` declares the personal data of a table no aggregate owns.** A read model, a table of received messages or a table written by hand in the schema of a context had no generator: `generate repository --personal` asks for an aggregate, so their `*.personal-fields.ts` and their lines in the erasure and the export adapters were written by hand. The new generator takes the SQL name of a table the schema file of the context declares (Drizzle, Knex, Prisma, TypeORM), writes `infrastructure/persistence/<table>.personal-fields.ts` spelled as the erasure of the ORM reads it, and joins it to the erasure and the export of the context, or writes them when the table is the first (ports, adapters, fakes, binding, the copies and the exports of the platform, and a spec that proves the fakes and names each case to prove on the test database as `it.todo`, no repository nor builder writing the rows of such a table). `--subject` is required there: the row is rarely the person, and a default of `id` would have `privacy:erase` miss it. The table is never changed: a table the schema does not declare, a table that has a declaration, a column the table does not hold and, where the erasure is confined to a tenant, a table without `tenant_id` are refused; a column that could not be read (the definition spreads shared columns) is said in the output. `--erasure`, `--retention`, `--tenant-scoped` and `--module` as on a repository. The refusal of `generate repository <context> <Aggregate> --personal ...` on a table that exists now names this command, and so does the fix of `privacy/declared-field`. See docs/concepts/personal-data.md.
|
|
134
|
+
|
|
135
|
+
**`ddd-ts-kit describe` and the "Ports" section of `CONTEXT.md` show as bound a port whose adapter extends a parent with several type arguments.** An adapter declared `class DrizzleAppointmentList extends DrizzleReadModelStore<AppointmentRow, PgQueryResultHKT> implements AppointmentList`, as a Drizzle or a Prisma read model store is, was not read as an adapter, so its port was listed `not bound` while the application ran with it. The parent is now whatever stands before `implements`, on one line or on the lines the formatter gives a long heritage. A port file that declares an interface before its abstract class is named after the abstract class, which is the injection token.
|
|
136
|
+
|
|
137
|
+
To move: run `ddd-ts-kit docs` once, so that the reference of each `CONTEXT.md` lists the adapters it missed.
|
|
138
|
+
|
|
139
|
+
**`ddd-ts-kit generate read-model <context> <Name>` writes the read model a projection keeps.** `generate projection` wrote the projector alone, and the port of its read model, its table, its store adapter and its fake were written by hand from the declarations of the packages. The new kind writes them: the port in `application/ports/<name>.port.ts` (the type `<Name>Row`, the criteria `<name>Criteria` and the abstract class `<Name>` over `ReadModelStore<<Name>Row>`), the table in the schema of the context, the store adapter `infrastructure/persistence/<orm>-<name>.repository.ts` over the read model store of the ORM package (Drizzle, Knex, Prisma, TypeORM; `InMemoryReadModelStore` in a project without an ORM), declared with `@Repository(<Name>)` or bound in the module file in the explicit style, the fake, and `test/integration/<name>.contract.spec.ts`, which runs `readModelContract` on the fake and on the adapter. `--field <name>:<string|number|boolean|instant|decimal>[:nullable]` adds a field to the row, to the criteria, to the table and to the columns of the adapter at once; `--tenant-scoped`, or a multi-tenant project, gives the table its tenant column and the store the scope of the work. The column of a field accepts null whatever the row requires, a removed row being a trace that keeps its key and its stamp alone, and a check constraint `<table>_live_rows_whole` keeps every other row whole: `check(...)` on Drizzle, `table.check(...)` on Knex, `checks` of the entity schema on TypeORM; the schema language of Prisma has none, so its model carries a `TODO(domain)` line with the `ALTER TABLE` to add to the migration. `generate projection` names the command in its file and in a note, `generate adapter` refuses the port of a read model with it, and the `persistence`, `scaffold` and `wiring` skills of the plugin say it. A repository generated after a read model in the same context finds the imports of its own table (`integer`, `auditColumns`), and a table may bear the name of a column of another.
|
|
140
|
+
|
|
141
|
+
**`readModelContract` of `@ddd-ts-kit/testing/contracts` holds the read model port of a context, on rows of its own.** `readModelStoreContract` runs on the fixed row of the kit and holds the table of an ORM package; nothing held the port a context declares over it, so its fake and its adapter were compared by hand. `readModelContract<Row>(runner, { name, createStore, createRow, change })` runs the same cases on any `ReadModelStore<Row>`: a row read back as written, nothing for an unknown key or for a change that answers nothing, an event delivered twice or older than the row ignored, a deletion an older event does not undo, a search that lists the rows held and none removed, and with `change` the current row handed to a later event (pending without it). `ddd-ts-kit generate read-model` writes the spec that runs it on the fake and on the adapter.
|
|
142
|
+
|
|
143
|
+
**A read model on `@ddd-ts-kit/typeorm` leaves a column declared `select: false` out of the rows it answers.** The rows held every column of the entity but the stamps, so a read model of tenant data answered `tenantId` even when the row of its port did not carry it, where the stores of the three other ORM answer the mapped fields only. Declare the tenant column `tenantId: { ...tenantColumn().tenantId, select: false }` in an entity typed `Row & TenantScoped & ReadModelStamps`: the store still writes it and confines every statement to it. An entity that declares the column without `select: false` answers it as before.
|
|
144
|
+
|
|
145
|
+
**Breaking: a deletion in a read model leaves its trace under a key the table does not hold, and a deleted row keeps no data.** `ReadModelStore.delete(key, stamp)` of `@ddd-ts-kit/kernel` on a key the read model did not hold wrote nothing and answered `ignored`, so a deletion delivered before the older creation it follows let that creation make a row that should not exist, and a rebuild lost a deletion made while it exported a row it had not copied yet. It now inserts the trace (the key, the stamp, `deleted`, the tenant of a read model of tenant data) and answers `traced`, a fourth value of `ReadModelWrite`: a deletion that removed no row and recorded its trace, under a key not held or over the trace of an earlier deletion (which answered `applied`). `applied` keeps one meaning, a row written or a held row removed; the older creation delivered after the trace is `stale`, and `projection_events_total` counts the result `traced`. `ignored` is left to an `upsertIfNewer` whose `next` answers `undefined`. On `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/prisma` and `@ddd-ts-kit/typeorm`, a deleted row now holds NULL in every column of the row, as it already kept nothing in memory and on `@ddd-ts-kit/opensearch`: its personal data is gone and a unique value it held is free again. So every column of the row is nullable, and a table that is not ready is refused by name, `ReadModelTableNotReadyError`, which lists the columns and gives the check constraint: when the store is built on Drizzle and TypeORM, from the definition, and on the four before the first trace is written, from one read of the columns the database holds, never by a statement that would abort the transaction of the event. On TypeORM and Prisma, an insert that takes a unique value another row holds is no longer skipped in silence: only a conflict on the key is, and the other is refused, by the database on TypeORM, with `UniqueViolationError` on Prisma. `readModelStoreContract` and `readModelRowsContract` of `@ddd-ts-kit/testing` hold it, with two capabilities to give them: `stored(key)`, which reads the table beside the store, and `uniqueTitle`. A read model of tenant data keeps its keys unique across tenants: under a key another tenant holds, a deletion stays `ignored`, and an upsert is now refused at once with `ReadModelKeyHeldElsewhereError`, a `ConcurrencyError` that says the key should carry the tenant, where it spent five attempts first. See `docs/concepts/cqrs.md`, "The table of a read model, and what a deleted row leaves".
|
|
146
|
+
|
|
147
|
+
To move: for each read model table, write a migration that drops NOT NULL on every column of the row (not on the key, the tenant column, `last_event_id`, `last_event_at`, `deleted`) and keeps the live rows whole: `alter table <table> alter column <column> drop not null` for each, then `alter table <table> add constraint <table>_live_rows_whole check (deleted or (<column> is not null and ...))` over the columns that were NOT NULL; `update <table> set <column> = null, ... where deleted` empties the rows deleted before. Declare the same in the definition the store reads: no `.notNull()` on Drizzle, `nullable: true` on TypeORM, optional fields (`String?`) on Prisma. A unique index `WHERE NOT deleted` may become a plain one. A statement of your own on the table keeps filtering `deleted = false`. A `switch` over `ReadModelWrite` gains the case `traced`; code that counts the rows a deletion removed keeps counting `applied` alone, and a dashboard that sums the results of `projection_events_total` meets the new one. A `ReadModelRows` of your own now inserts an entry without a `row` (the trace) where it answered `false`, and writes no data on a replace without one. Run `readModelStoreContract` again on your stores: the table of its dataset needs the same migration.
|
|
148
|
+
|
|
149
|
+
**`ddd-ts-kit generate e2e` writes the end-to-end spec of a use case a background job starts, and the end-to-end support runs what is due on the queues.** `generate e2e <context> <UseCase>` found a route, then an integration event handler, then a scheduled job, and refused a use case only a background job sends the command of. It now finds the background jobs of the context too (`application/background/*.background-job.ts`) and writes a spec in three steps: the request whose use case enqueues the job, to send through the API (a `TODO(domain)`), `const ran = await application.runDueJobs()`, then `application.settled()` and what a client observes. The spec asserts that the job is among `ran`, so it fails until the request that enqueues is written. A use case a scheduled job and a background job both send gets one test per job. `--job <JobName>` names one job, scheduled or background, by its class (`VoidInvoice`, `VoidInvoiceBackgroundJob`) or by the name it runs under (`billing.void-invoice`), also for a use case a route reaches: that spec is written in `test/e2e/<use-case>-<job>.e2e.spec.ts`, beside the one of the route; `--event` and `--job` together are refused.
|
|
150
|
+
|
|
151
|
+
`runDueJobs()` is new in `test/e2e/support/start-application.ts`, next to `runJob(name)`, which runs a scheduled job at once: it stops the worker of the process (a queue kept in memory starts one, and a job it claimed would end behind the spec), runs every job due until none is left on the worker of the application, answers the name of each job run, and rejects when a run did not succeed, naming the job, its outcome and the code of its error, never the message. On a container it resolves the `QueueWorker` of the kernel module; where the platform is wired by hand, or under Nest, it calls `platform.backgroundJobs`, which gains `runDue()` (`src/platform/jobs/background-jobs.ts`, `create-background-work.ts`). It is the same on the three queue stores (`memory`, `database`, `redis`). A project on a container lists `@ddd-ts-kit/scheduling` in its development dependencies when its queue does not already list it at run time: the support imports the token of the worker from it. The `testing`, `scaffold` and `integration-event` skills of the plugin say it, with the pages [testing strategy](docs/concepts/testing-strategy.md) and [background jobs](docs/concepts/background-jobs.md).
|
|
152
|
+
|
|
153
|
+
To move: nothing has to change. `init` keeps the support of an existing project as it is, and `generate e2e` notes what it lacks when a spec needs it. To add `runDueJobs` by hand: declare `runDueJobs(): Promise<string[]>;` on `RunningApplication`, and implement it on the worker, `application.container.resolve(QueueWorker)` on a container (`QueueWorker` of `@ddd-ts-kit/scheduling`, to add to the development dependencies if the project does not list it), or `application.platform.backgroundJobs` by hand once `runDue: () => worker.runDue()` is among what `backgroundJobsOn` of `src/platform/jobs/create-background-work.ts` answers and `runDue(): Promise<BackgroundJobRun[]>;` is on the `BackgroundJobs` interface: `await worker.stop()`, then `const runs = await worker.runDue()`, throw when the `outcome` of a run is not `succeeded`, and answer `runs.map((run) => run.job)`.
|
|
154
|
+
|
|
155
|
+
**`advisoryLock` and `tryAdvisoryLock` serialise the units of work that decide on the same business key, on the four ORM.** A decision taken on rows that do not exist yet (count then insert, the next number of a sequence per tenant) has no version for optimistic concurrency to compare, and took a raw `pg_advisory_xact_lock` that `tenancy/scoped-statement` refuses. `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/prisma` and `@ddd-ts-kit/typeorm` now export the same two functions: `advisoryLock(context, key, { tenant: scope })` waits until no other transaction holds the lock on `key` and holds it until the unit of work commits or rolls back, and `tryAdvisoryLock` answers `false` instead of waiting. The key is a text that PostgreSQL hashes into 64 bits (`hashtextextended(text, 0)`); with `tenant` it is `tenant:<id>:<key>` (`tenantKey`), so two tenants never wait for each other and work that names no tenant is refused; two keys of the same hash wait for each other, and nothing else happens. Outside a unit of work the lock would be released at once: `AdvisoryLockOutsideUnitOfWorkError` of `@ddd-ts-kit/kernel`. `tenancy/scoped-statement` accepts the helper, which is given the context and never the executor, and a raw advisory lock is still reported, with a message that now names the helper. `advisoryLockContract` of `@ddd-ts-kit/testing` holds the four packages to the same behaviour; the wait of a second unit of work runs on a real PostgreSQL (`concurrent: true`), PGlite being one session. PostgreSQL only. The page is "A decision no version protects" in `docs/tools/persistence.md`.
|
|
156
|
+
|
|
157
|
+
To move: nothing has to. A raw `pg_advisory_xact_lock` kept under a `ddd-ts-kit-disable-next-line tenancy/scoped-statement` becomes `await advisoryLock(context, key, { tenant: scope })`, and its suppression goes: `ddd-ts-kit check --rule tenancy/scoped-statement` lists what is left. The number locked on changes with the helper (the hash of the text, with the tenant in it): deploy the change to every instance at once, or two versions of the application would not wait for each other.
|
|
158
|
+
|
|
159
|
+
**A criteria searches a text whatever its case: `containsIgnoringCase` and `startsWithIgnoringCase`, on every store.** A field of type `string` declares them beside `contains` and `startsWith` (`filter: ['containsIgnoringCase']`), and `where('name', 'containsIgnoringCase', 'dupont')` then finds `Dupont` and `DUPONT`. The text is taken as literally as `contains` takes it (`%`, `_` and `\` are characters, an empty text is refused), each letter of both sides is put in lower case and nothing else is folded: an accent is kept, so `e` does not find `é`. In memory it is `foldCase` of `@ddd-ts-kit/kernel` (`toLowerCase` of JavaScript); `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle` and `@ddd-ts-kit/typeorm` write an `ILIKE`, `@ddd-ts-kit/prisma` the `insensitive` mode, `@ddd-ts-kit/opensearch` a `regexp` query that names both forms of each letter. `criteriaContract` of `@ddd-ts-kit/testing` holds them to the same rows for the ASCII letters and for a letter with one upper-case and one lower-case form (`É` and `é`); outside them (the two `I` of Turkish, `ß`, the final sigma) each store follows its own table, and a PostgreSQL database created with the `C` locale folds the ASCII letters alone. A route that reads its criteria with `criteriaQuerySchema` of `@ddd-ts-kit/http` takes `filter[name]=containsIgnoringCase:dupont` once the definition declares the operator. No b-tree index serves an `ILIKE`: on PostgreSQL a GIN index of `pg_trgm` on the column does, in a migration of the project. The rule and its limits are in "What a criteria means" of `packages/kernel/README.md`.
|
|
160
|
+
|
|
161
|
+
To move: nothing for a project that does not declare the operators. An adapter of a read port written by hand over `Predicate` (a `switch` on `operator`) now meets two more operators, on the fields that declare them only.
|
|
162
|
+
|
|
163
|
+
**The conditional replace of a read model row compares the whole stamp on the four ORM, and Knex and TypeORM read the instant of a stamp back to the millisecond.** A write of a read model replaces the row only if it still holds the stamp that was read. The in-memory table and `@ddd-ts-kit/opensearch` compared the event id, the instant and the version; `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/prisma` and `@ddd-ts-kit/typeorm` left the version out, so a row whose version alone had moved (two domain events of one name and one aggregate in the same millisecond share the two others) was replaced by a write computed from the row before it. The four now compare the version too, NULL matching NULL, and `sameStamp(left, right)` of `@ddd-ts-kit/kernel` is exported for a `ReadModelRows` of your own. On `@ddd-ts-kit/knex` and `@ddd-ts-kit/typeorm`, the instant of a stamp was read back through the text of the `Date` the driver gave, which has no milliseconds: the stamp read never matched the row, and the second event of a key ended in `ConcurrencyError` whenever the first carried milliseconds. It is read as the date it is. The order of stamps is unchanged, and now said where it is read (`isNewer`, `docs/concepts/cqrs.md`, "Which write for which event"): total among stamps that all carry a version and among stamps that carry none, decided by the instants between one of each, which is not an order, so a key should see one kind, the one mix that is meant being a deletion made outside the history of the key, such as an erasure. `readModelStoreContract` and `readModelRowsContract` of `@ddd-ts-kit/testing` hold the replace on the whole stamp, the stamp at the millisecond, the same row whatever the order of three deliveries of one kind, and such a deletion.
|
|
164
|
+
|
|
165
|
+
To move: a `ReadModelRows` of your own compares the version in `replace`, with `sameStamp`, and gives back the instant it was given, to the millisecond; run `readModelStoreContract` again on your stores. A workaround that rounded the instant of a stamp to the second for Knex or TypeORM can go.
|
|
166
|
+
|
|
167
|
+
**Breaking: `ReadModelStore.updateIfNewer` writes the change of a row another event created, and answers `missing` when that row is not there.** A projection wrote such an event (an appointment moved, a payment captured) as an `upsertIfNewer` whose `next` answered `undefined` when the key held no row, which read as `ignored`: nothing told a change that found no row from an event the read model filters. `updateIfNewer(key, stamp, change)` of `@ddd-ts-kit/kernel`, where `change` takes the row and answers the row, is the write of a partial change: `applied` on a row the key holds, `stale` when the row, or the trace of its deletion, holds this event or a later one, and `missing`, a fifth value of `ReadModelWrite`, when the key holds no row, the trace of a deletion older than the event, or a row of another tenant. Nothing is written then and the store never throws for it: the projection decides what a missing row means. It is not a cure for disorder: the store refuses to go back in time and cannot put back a change that arrived before its creation, or the older of two changes delivered out of order, which is `stale`. A partial change is right only on a feed that keeps the order of a key; an event that carries the whole row is right in any order. `docs/concepts/cqrs.md`, "Which write for which event", says which feeds keep that order (the save, a catch-up subscription, the in-process bus, the relay per key, Kafka per partition) and what to do with `missing` on each. `projection_events_total` of `@ddd-ts-kit/di` counts the result `missing`. `TableReadModelStore`, so the stores of `@ddd-ts-kit/knex`, `@ddd-ts-kit/drizzle`, `@ddd-ts-kit/prisma`, `@ddd-ts-kit/typeorm` and `@ddd-ts-kit/opensearch` and `InMemoryReadModelStore`, and `ShadowReadModelStore` have it; `readModelStoreContract`, `readModelRowsContract` and `readModelContract` of `@ddd-ts-kit/testing` hold the cases; `generate projection` of `ddd-ts-kit` names the two writes in the method it leaves to fill. `upsertIfNewer` keeps its meaning.
|
|
168
|
+
|
|
169
|
+
To move: a class of your own that extends `ReadModelStore` without extending `TableReadModelStore` implements `updateIfNewer`. A `switch` over `ReadModelWrite` gains the case `missing`, and a dashboard that sums the results of `projection_events_total` meets it. In a projection, `upsertIfNewer(key, stamp, (row) => (row === undefined ? undefined : { ...row, ... }))` may become `updateIfNewer(key, stamp, (row) => ({ ...row, ... }))`: its answer is then `missing` where it was `ignored`. Never throw on `missing` in a projection fed by the domain events of its context or by the event store; prefer events that carry the whole row where the transport keeps no order.
|
|
170
|
+
|
|
7
171
|
## 0.110.1
|
|
8
172
|
|
|
9
173
|
**The guard lets a worker take a lock with `flock` under `$XDG_RUNTIME_DIR`.** Since 0.110.0 the guard reads the lock file of `flock` as a file the command writes, and refused `flock "$XDG_RUNTIME_DIR/heavy.lock" npm run verify` to a context worker: a variable it did not read, in a directory outside the worktree. A worker then ran its heavy command without the lock the checkouts of the machine share. The guard now reads `$XDG_RUNTIME_DIR` by its value when the session started, and a lock of `flock` there is free, as output to the system temp directory is: `flock` creates the file when it is missing and writes nothing in it. Everything else a worker writes there is still refused (a redirection, the report of `time -o`), so is a lock that is a link into a project, and a worker that sets `XDG_RUNTIME_DIR` itself is refused as one that sets `TMPDIR`.
|
package/README.fr.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[English](README.md) · **Français**
|
|
2
|
-
<!-- translation-of: README.md sha256:
|
|
2
|
+
<!-- translation-of: README.md sha256:e7884377cb3ae2cc -->
|
|
3
3
|
|
|
4
4
|
# ddd-ts-kit
|
|
5
5
|
|
|
@@ -646,12 +646,12 @@ choix sont enregistrés sous `stack` dans la configuration, `docsUi`, `ci` et `l
|
|
|
646
646
|
| `--storage local\|s3` | enregistré comme `stack.storage` : où vit le contenu des fichiers, jamais dans la base de données. `src/platform/config/read-files.ts` et `src/platform/files/open-files.ts`, un par choix : `local`, un répertoire en développement (`FILES_DIRECTORY`, `.data/files`) et les liens signés servis par l'application sous `/files` (`FILES_PUBLIC_URL` et `FILES_SIGNING_SECRET` requises en production) ; `s3`, un bucket de n'importe quel fournisseur du protocole S3 au moyen de `@ddd-ts-kit/s3` (les variables `S3_*`, MinIO dans la stack compose) ; la mémoire du processus dans les tests et les outils, dans les deux cas. Avec `--di tsyringe` : `files/bind-files.ts`, `files/files.module.ts` et `files/staging-uploads.ts` ; en câblage manuel, `files/create-files.ts` ; avec une *stack* HTTP, `files/file-routes.ts`. Ils lient `FileStorage`, `FileKeys`, `FileScanner` et `FileStaging`, enregistrent la purge horaire des fichiers en attente et mettent en attente le fichier que porte une commande avant sa transaction ; `generate file-upload` en a besoin. `--storage none` n'écrit rien de tout cela ([Stockage de fichiers](../../docs/concepts/file-storage.fr.md)) |
|
|
647
647
|
| `--search opensearch\|none` | enregistré comme `stack.search`, `none` par défaut : où vivent les modèles de lecture qu'un contexte tient pour la recherche. `opensearch` : `@ddd-ts-kit/opensearch`, `src/platform/search/search-indexes.ts` (`SearchIndexes`, la classe abstraite que reçoit l'adaptateur d'un port de modèle de lecture : `super(search.options('billing_invoices', criteria))`) et `search/open-search.ts` (`fetchTransport` sur `OPENSEARCH_URL`, l'utilisateur d'`OPENSEARCH_USERNAME` et `OPENSEARCH_PASSWORD` les deux ou aucune, la stratégie `attribute` sous `--tenancy shared-table`, `none` sinon), lié par `search/search.module.ts` sur un conteneur du kit, `platform.search` câblé à la main et sous Nest ; l'index de chaque store construit à partir de lui provisionné avant une requête, sous tables partagées pour le locataire du travail une fois que l'annuaire des locataires de la plateforme le liste (un locataire non listé ne crée aucun index), au mieux au démarrage, qui n'échoue jamais sur la recherche, rien d'appelé sans store ; les scripts de confidentialité reçoivent le nœud ; un service compose `opensearch` (un nœud, extension de sécurité coupée). Aucun générateur n'écrit de store, et le pipeline ne démarre aucun nœud ; un contexte construit ses stores depuis `SearchIndexes` seulement (`search/store-from-platform`). [Modèles de lecture de recherche](../../docs/tools/search-read-models.fr.md) |
|
|
648
648
|
| `src/platform/events/` | `event-provider.ts` (`bus`, `forConsumer(name)`, `start()`, `close()`), `in-process-events.ts`, et pour `--broker` `create-event-provider.ts` : `RabbitMqEventBus` (`AMQP_URL`), `KafkaEventBus` (`KAFKA_BROKERS`, avec `aggregate-key-of.ts` pour l'ordre par agrégat), `NatsEventBus` (`NATS_URL`) ou `RedisStreamsEventBus` de `@ddd-ts-kit/redis/event-bus` (`REDIS_URL` : Redis, Dragonfly ou Valkey), chacun avec un abonné par contexte consommateur (`forConsumer`), `assertTopology` au démarrage, son adresse validée et un service compose avec un contrôle de santé ; ou `custom-event-bus.ts` avec sa *spec* `eventBusContract`. `start-outbox-relay.ts` avec l'outbox. `--broker redis` avec `--cache redis` fait un seul serveur et un seul service compose, `cache` ; seul, le service s'appelle `streams` |
|
|
649
|
-
| `src/platform/database/` | `persistence.ts` (`interface Persistence` : unité de travail, magasins de l'outbox et des événements traités du *package* de l'ORM, la poignée de stockage), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, la connexion (`connect-to-database.ts`, `create-client.ts` ou `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, le schéma de ce que le kit stocke pour l'application), `open-test-database.ts` (PostgreSQL dans le processus, ou le serveur nommé par une URL ; avec Vitest chaque *spec* ouvre une copie du cluster que `test/support/test-database-template.ts`, la mise en place globale de l'exécution, initialise une fois, et y crée ses tables ; avec drizzle depuis `table-statements.ts`, le SQL des tables de `schema.ts`, puisque drizzle-kit écrit des migrations, pas des tables, ses index uniques compris), `persistence.contract.spec.ts` (les stores de l'outbox, des événements traités, des *jobs* et des processus tels que la plateforme les branche, tenus aux contrats de `@ddd-ts-kit/testing` avec ce que la pile active : le *tenant* sous `--tenancy`, l'unité de travail). La classe de stockage qu'un adaptateur de *repository* nomme dans sa liste de dépendances : `database.ts` avec drizzle et prisma (`abstract class Database extends` le type de contexte du *package* de l'ORM), `KnexContext` de `@ddd-ts-kit/knex`, `TypeOrmContext` de `@ddd-ts-kit/typeorm` |
|
|
649
|
+
| `src/platform/database/` | `persistence.ts` (`interface Persistence` : unité de travail, magasins de l'outbox et des événements traités du *package* de l'ORM, la poignée de stockage), `open-persistence.ts`, `persistence-over.ts`, `inert-persistence.ts`, la connexion (`connect-to-database.ts`, `create-client.ts` ou `create-data-source.ts`), `schema.ts` (`MESSAGING_SCHEMA`, le schéma de ce que le kit stocke pour l'application), `open-test-database.ts` (PostgreSQL dans le processus, ou le serveur nommé par une URL, chaque appel alors sur une copie de la base migrée, créée et supprimée par `test/support/test-database-clone.ts` ; avec Vitest chaque *spec* ouvre une copie du cluster que `test/support/test-database-template.ts`, la mise en place globale de l'exécution, initialise une fois, et y crée ses tables ; avec drizzle depuis `table-statements.ts`, le SQL des tables de `schema.ts`, puisque drizzle-kit écrit des migrations, pas des tables, ses index uniques compris), `persistence.contract.spec.ts` (les stores de l'outbox, des événements traités, des *jobs* et des processus tels que la plateforme les branche, tenus aux contrats de `@ddd-ts-kit/testing` avec ce que la pile active : le *tenant* sous `--tenancy`, l'unité de travail), `read-model-tables.ts` (la liste des modèles de lecture gardés dans une table, entre des marqueurs que `generate read-model` remplit, qu'`init` remplit d'après les stores de l'arbre et que `init --force` garde, chaque entrée étant le contexte d'un modèle de lecture et la classe de son store ; `readModelTables(persistence, contexts)` fait lire chaque table de ces contextes par son propre store, donc avec le verdict de ce store ; une application l'appelle à son démarrage, pour les contextes qu'elle héberge (un contexte exécuté en service vérifie ses propres tables, sur sa base), et refuse de démarrer sur une table listée qui ne peut pas contenir la trace d'une ligne supprimée, nommée avec sa migration, ou qu'elle n'a pas pu lire, sauf si `composeApplication` reçoit `readModelTables: 'reported'` ; `scripts/read-model-tables.ts`, `npm run db:read-models`, la demande à la base que nomme `DATABASE_URL` avant un déploiement, pour tous les contextes ou pour ceux que nomme `-- --context <nom>`, sans autre variable, affiche la base qu'il a lue, et sort avec le code 1 quand une table n'est pas prête, 2 sans base à lire, 3 quand aucune table n'a pu être lue, 4 quand `--context` nomme un contexte auquel aucun modèle de lecture listé n'appartient ; une entrée nomme un contexte de `Contexts`, que `generate context` remplit, ou ne compile pas, et un store laissé de côté exprès est un commentaire de la liste qui porte `<contexte>: <Store>`). La classe de stockage qu'un adaptateur de *repository* nomme dans sa liste de dépendances : `database.ts` avec drizzle et prisma (`abstract class Database extends` le type de contexte du *package* de l'ORM), `KnexContext` de `@ddd-ts-kit/knex`, `TypeOrmContext` de `@ddd-ts-kit/typeorm` |
|
|
650
650
|
| outillage des migrations | `drizzle.config.ts`, `knexfile.js` et le dossier `migrations/`, `prisma/schema/schema.prisma` (le client, la datasource et les tables de la plateforme ; `generate repository` ajoute le fichier de chaque contexte, `prisma/schema/<context>.prisma`) et `prisma.config.ts`, ou `data-source.ts`. Un projet qui garde le seul `prisma/schema.prisma` des versions antérieures à 0.95 le garde avec son `prisma.config.ts` et son `db:client`, même sous `--force` : `init` n'écrit rien sous `prisma/schema/`, ses notes donnent les étapes du déplacement en nommant les contextes du projet, et `generate repository` refuse jusqu'au déplacement |
|
|
651
651
|
| `scripts/openapi.ts`, `scripts/events.ts` | écrivent `openapi/openapi.yaml` (un fichier par document de `openapi.documents`), `docs/integration/asyncapi.yaml` et `docs/integration/event-catalog.md`, en JSON sous `openapi.format: json` ; `--check` échoue sur une différence |
|
|
652
652
|
| `scripts/privacy-erase.ts`, `scripts/privacy-export.ts` | avec `--privacy on`, les deux demandes d'une personne concernée, traitées en ligne de commande sur les sources avec les variables de `.env` (`npm run privacy:erase -- <subject-id> [--operator <qui-demande>] [--rerun]`, `npm run privacy:export -- <subject-id> > export.json`) : l'effacement détruit d'abord la clé de la personne quand le projet a un event store (`--event-sourcing on` : ses événements stockés se lisent effacés ; audité avec `--audit on`), puis efface chaque copie listée dans `src/platform/privacy/data-subject-copies.ts`, chacune laissant son entrée avec `--audit on`, et ce que l'outbox et le stockage des *jobs* gardent de la personne ; un id qui n'a rien atteint est refusé, code de sortie 1, et annoncé à personne, sauf si `--rerun` dit que cette personne a déjà été effacée ; `privacy:purge` lance à la main ce que le *job* `privacy.purge-expired` lance chaque nuit à 03:00 UTC, la purge de ce qui a dépassé sa durée de conservation (`JOB_PRIVACY_PURGE_EXPIRED_ENABLED=false` coupe le *job*) ; l'export rassemble chaque enregistrement listé dans `data-subject-exports.ts` en un document JSON daté (`format`, `subject`, `exportedAt`, `records`), l'export de chaque contexte audité avec `--audit on`, jamais les valeurs (chaque exécution laisse son entrée, un essai compris : essayez-le sur une personne de test). Avec `--tenancy shared-table`, `TENANTS` nomme les tenants, séparés par des virgules : une écriture de données de tenant n'est jamais élargie. Ni l'un ni l'autre n'atteint les sauvegardes, les journaux, une copie qu'aucun contexte n'a déclarée, un message déjà livré ou un *job* qui ne nomme aucun `subject` |
|
|
653
653
|
| `docker-compose.yml`, `.env.example`, `Dockerfile`, `.dockerignore` | la base de données avec un contrôle de santé et un volume nommé, `jaegertracing/jaeger:2.22.0` derrière le profil `observability`, chaque port publié sur 127.0.0.1 seulement (une adresse plus large s'écrit dans l'entrée à dessein, le README du projet dit comment), les ports depuis `.env` ; une image multi-étapes, sans root, avec les seules dépendances de production |
|
|
654
|
-
| `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (l'application entière sur un port libre, sur une base de données dans le processus sauf si `DATABASE_URL` est définie, aucun *job* lancé par le temps ; `settled()` se résout quand l'outbox a relayé ce que les requêtes HTTP ont enregistré ; `publish(events)` remet des événements d'intégration de l'amont à ses gestionnaires, comme le ferait le relais de cet amont), `create-credentials.ts` (au nom de qui un test appelle, `application.as({ id, roles })` ; en RBAC et en ABAC les rôles sont ceux de `Role` dans `src/platform/auth/authorization/role.ts`, si bien que `roles: [Role.Admin]` est complété par l'éditeur et qu'un rôle mal orthographié ne compile pas), `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)` : une trace sans les appels qu'un adaptateur fait sur lui-même, la forme que vérifie `expectSpanTree`) |
|
|
654
|
+
| `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (l'application entière sur un port libre, sur une base de données dans le processus sauf si `DATABASE_URL` est définie, alors sur une base par fichier de *spec*, les tables de cette base migrée, vidées sauf celles que liste `test/support/test-database-kept.ts`, si bien que les fichiers s'exécutent en même temps sur un serveur aussi ; `test/support/test-database-setup.ts`, une mise en place globale de l'exécution, copie et vide la base migrée une fois, partage entre les fichiers qui s'exécutent en même temps les connexions qu'il reste au serveur et supprime ce qu'une exécution tuée a laissé (`test/support/test-database-*.ts`) ; aucun *job* lancé par le temps ; `settled()` se résout quand l'outbox a relayé ce que les requêtes HTTP ont enregistré ; `publish(events)` remet des événements d'intégration de l'amont à ses gestionnaires, comme le ferait le relais de cet amont), `create-credentials.ts` (au nom de qui un test appelle, `application.as({ id, roles })` ; en RBAC et en ABAC les rôles sont ceux de `Role` dans `src/platform/auth/authorization/role.ts`, si bien que `roles: [Role.Admin]` est complété par l'éditeur et qu'un rôle mal orthographié ne compile pas), `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)` : une trace sans les appels qu'un adaptateur fait sur lui-même, la forme que vérifie `expectSpanTree`) |
|
|
655
655
|
| `docs/context-map.md`, `docs/integration/README.md` | voir `docs` |
|
|
656
656
|
| `test/architecture/extractable.spec.ts` | écrit avec le premier contexte : démarre chaque contexte seul sur le kernel et la plateforme, ses *jobs* compris |
|
|
657
657
|
| `eslint.config.mjs` | le preset `dddTsKit` de `@ddd-ts-kit/eslint-plugin`, lint typé sur le tsconfig du projet |
|
|
@@ -841,7 +841,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
841
841
|
| `port` | `<context> <Name> [--module <module>]` | `application/ports/<name>.port.ts`, une classe abstraite, et son *fake* |
|
|
842
842
|
| `route` | `<context> <UseCaseName> --method <GET\|POST\|PUT\|PATCH\|DELETE> --path <p> [--command\|--query] [--group <Name>] [--mapper] [--serializer] [--cache public\|private\|no-store] [--module <module>]` | sous `"stack.routes": "controllers"` : une classe contrôleur dans `presentation/http/<resource>/<use-case>/` (la ressource est le premier segment du chemin), qui dépend de `CommandBus` ou de `QueryBus`, derrière le groupe de routes de sa ressource, écrit avec elle quand il est nouveau (`<resource>.routes.ts` : préfixe, étiquette, `Authenticated`) ; un cas d'usage public ne se tient dans aucun groupe et dit `guards: [Public]` ; avec class-validator, une classe par fichier (`<use-case>.params.ts`, `.body.ts`, `.answer.ts`, `.accepted.ts`, `.line.ts`) ; `--mapper` et `--serializer` ajoutent un *mapper* de requête HTTP et un sérialiseur que reçoit le contrôleur ; une *spec* ; aucun enregistrement dans un projet déclaré, un contrôleur construit à la main dans `<context>.routes.ts` (le fichier de module en câblage manuel) dans un projet explicite. Sous `"functions"` : une fonction `defineRoute`, sa *spec*, son enregistrement dans `<context>.routes.ts`, et des classes `<use-case>-<role>.dto.ts` |
|
|
843
843
|
| `controller` | les mêmes arguments que `route` | la classe contrôleur, quoi que dise `stack.routes` : pour un projet de routes en fonctions qui écrit sa prochaine route comme une classe. `--cache` écrit sa politique de cache : `private` (un `GET` d'un appelant, `max-age=0`, `must-revalidate`, `ETag` fort), `public` (un `GET` d'un cas d'usage public, `max-age` 1m, `s-maxage` 5m, étiqueté avec les ressources de son chemin), `no-store` ; refusé sur une écriture, et `public` derrière un groupe de routes |
|
|
844
|
-
| `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>] [--module <module>]` | un téléversement : un contrôleur qui déclare le fichier qu'il reçoit (sa taille et ses types de média dans le contrat, vérifiés au fil du flux), la commande qui le porte comme un `FileUpload`, mis en attente par le bus de commandes avant la transaction, le gestionnaire qui l'enregistre et le promeut avec la validation (commit), et leurs *specs*. Refusé sans `stack.storage` ou sans *stack* HTTP, avec le `init --force --storage local` à lancer |
|
|
844
|
+
| `file-upload` | `<context> <UseCaseName> --path <p> (--permission <aggregate>.<action> [--grant <role>] \| --public) [--method POST\|PUT] [--group <Name>] [--text utf-8\|single-byte] [--module <module>]` | un téléversement : un contrôleur qui déclare le fichier qu'il reçoit (sa taille et ses types de média dans le contrat, vérifiés au fil du flux ; avec `--text`, un fichier texte tel qu'un CSV sous les noms que les navigateurs lui donnent, `single-byte` quand il peut être en Windows-1252 aussi bien qu'en UTF-8, et une *spec* qui en envoie un à travers le lecteur multipart), la commande qui le porte comme un `FileUpload`, mis en attente par le bus de commandes avant la transaction, le gestionnaire qui l'enregistre et le promeut avec la validation (commit), et leurs *specs*. Refusé sans `stack.storage` ou sans *stack* HTTP, avec le `init --force --storage local` à lancer |
|
|
845
845
|
| `route-group` (`group`) | `<context> <Name> [--prefix <path>] [--group <ParentName>] [--public \| --role <role>]` | `presentation/http/<name>.routes.ts` : une classe vide qui porte `@RouteGroup`, derrière `Authenticated` sauf si `--public` ou `--role` dit autre chose (`HasRole(Role.Admin)`, le rôle lu dans le vocabulaire de la plateforme, `<platformDir>/auth/authorization/role.ts`, qui le reçoit s'il ne le contient pas) ; avec `--group`, il affine ce groupe et en hérite |
|
|
846
846
|
| `guard` | `<context> <Name>` | `presentation/http/guards/<name>.guard.ts` : une classe de garde déclarée à remplir, et sa *spec* |
|
|
847
847
|
| `representation` | `<context> <UseCase> <xml\|csv\|media/type>[,...] [--module <module>]` | après `generate route` du cas d'usage (un contrôleur sous `"stack.routes": "controllers"` ou `"nest"`) ou `generate controller` : ajoute `produces` au `@Controller` du cas d'usage, et `consumes: ['application/xml']` à celui qui reçoit un corps quand XML est demandé ; dit quand CSV a besoin d'une page ou d'une liste en flux, et quand `stack.representations` n'est pas `negotiated` |
|
|
@@ -849,14 +849,16 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
849
849
|
| `schema` | `<context\|shared-kernel> <Name>` | `presentation/http/shared/<name>.schema.ts` du contexte, ou `presentation/<name>.schema.ts` du noyau partagé : une forme du contrat déclarée une fois (un schéma zod avec `.meta({ id })`, une classe class-validator, ou un schéma enveloppé par `sharedSchema`), à remplir ; les routes l'utilisent en entier, imbriquée ou en partie |
|
|
850
850
|
| `integration-event` | `<context> <Aggregate> <Fact> [--version n] [--module <module>]` | la déclaration `defineIntegrationEvent` dans le langage publié (sa charge utile dans `<event>.v<n>.payload.ts` avec class-validator ou un schéma à vous), l'export de l'index, le *publisher* `application/integration/publishers/<event>.publisher.ts`, une *spec*, l'enregistrement, une ligne de `platform/audit/audited-events.ts` |
|
|
851
851
|
| `integration-handler` (`consumer`) | `<context> <upstreamContext> <eventType>[@v<n>] [--version <n>] [--name <Name>] [--module <module>]` | `application/integration/handlers/<name>.integration-handler.ts`, une classe `<Name>IntegrationHandler` qui dépend de `CommandBus`, sa *spec*, son abonnement idempotent sous le nom de consommateur `<context>.<name>` ; le type est pris comme `list` l'affiche, avec ou sans `@v<n>` (la version la plus récente sans, `--version <n>` disant la même chose que le suffixe) ; refusé sauf si l'amont est déclaré et publie cette version (une version introuvable est refusée, jamais remplacée par une autre) |
|
|
852
|
+
| `personal-fields` | `<context> <table> --personal <colonne>,... --subject <colonne> [--erasure pseudonymise\|row] [--retention <colonne>:<n><d\|m\|y>] [--tenant-scoped] [--module <module>]` | la déclaration des colonnes personnelles d'une table qu'aucun agrégat ne possède (un modèle de lecture, une table de messages reçus, une table écrite à la main), donnée par son nom SQL : `infrastructure/persistence/<table>.personal-fields.ts`, épelée comme l'effacement de l'ORM la lit (avec Drizzle et TypeORM par les propriétés que le fichier de schéma donne aux colonnes), jointe à l'effacement et à l'export du contexte, ou écrite avec eux comme `repository --personal` les écrit pour une première table, sauf la *spec* : `test/integration/<context>-personal-data.spec.ts` prouve les *fakes* et nomme en `it.todo` chaque cas à prouver sur la base de test, aucun *repository* ni *builder* n'écrivant les lignes d'une telle table. `--subject` est obligatoire : la ligne d'une telle table est rarement la personne. La table est lue dans le fichier de schéma du contexte et jamais modifiée. Refusés : une table que ce fichier ne déclare pas, une table qui a une déclaration, une colonne que la définition de la table ne tient pas (dite dans la sortie quand la définition prend des colonnes d'une décomposition ou d'une fonction), une table sans `tenant_id` là où l'effacement est confiné à un *tenant*, et ce que `--personal` d'un *repository* refuse |
|
|
852
853
|
| `erasure-handler` | `<context> [--module <module>]` | `application/integration/handlers/data-subject-erased.integration-handler.ts`, une classe `DataSubjectErasedIntegrationHandler` qui efface ce que le contexte garde d'une personne par son `<Context>PersonalDataErasure` quand la plateforme annonce `privacy.data-subject.erased` (`dataSubjectErasedV1` du kernel), sa *spec* sur le *fake*, son abonnement idempotent sous le nom de consommateur `<context>.data-subject-erased` (dans une transaction derrière un *broker*) ; pour un contexte qui tourne comme un service à part ou copie des données personnelles depuis des événements. Refusé tant que le contexte n'a pas son effacement (`generate repository --personal`), et refusé sur un contexte en *event sourcing*, dont les valeurs personnelles s'effacent en détruisant la clé du sujet (`eraseDataSubject`) |
|
|
853
854
|
| `event-handler` | `<context> <Aggregate> <Fact> [--phase before-commit\|after-commit] [--name <Name>] [--module <module>]` | réaction à un événement du domaine du contexte, *spec*, abonnement ; avant la validation (commit) de l'unité de travail par défaut, après elle avec `--phase after-commit` (un effet qu'aucune transaction ne couvre, au plus une fois), et la *spec* exécute la réaction dans cette phase |
|
|
854
|
-
| `projection` (`projector`) | `<context> <Name> <event-type>[@v<n>] [--module <module>]` | un projecteur dans `application/projections/<name>.projection.ts`, déclaré avec `@Projection('<context>.<name>')` et une méthode `@On(definition)` pour l'événement d'intégration, que publie le contexte lui-même ou un amont déclaré, et sa *spec* ; le type est pris comme `list` l'affiche, `@v<n>` fixant la version (la plus récente sans). Dans le style explicite sur tsyringe, le fichier de module du contexte l'inclut par `builder.include(<Name>Projection)` ; sur une plateforme câblée à la main, la classe est simple et le module la souscrit sous son nom de consommateur. Il tient un seul modèle de lecture : son port est reçu par le constructeur |
|
|
855
|
+
| `projection` (`projector`) | `<context> <Name> <event-type>[@v<n>] [--module <module>]` | un projecteur dans `application/projections/<name>.projection.ts`, déclaré avec `@Projection('<context>.<name>')` et une méthode `@On(definition)` pour l'événement d'intégration, que publie le contexte lui-même ou un amont déclaré, et sa *spec* ; le type est pris comme `list` l'affiche, `@v<n>` fixant la version (la plus récente sans). Dans le style explicite sur tsyringe, le fichier de module du contexte l'inclut par `builder.include(<Name>Projection)` ; sur une plateforme câblée à la main, la classe est simple et le module la souscrit sous son nom de consommateur. Il tient un seul modèle de lecture, qu'écrit `generate read-model` : son port est reçu par le constructeur |
|
|
856
|
+
| `read-model` | `<context> <Name> [--field <name>:<type>[:nullable]]... [--tenant-scoped] [--module <module>]` | le modèle de lecture que tient une projection. Le port dans `application/ports/<name>.port.ts` : le type `<Name>Row` (la clé `id`, puis un champ par `--field`, de type `string`, `number`, `boolean`, `instant` ou `decimal`, `:nullable` pour celui qui peut valoir null), les critères `<name>Criteria` que ses lecteurs peuvent demander, et la classe abstraite `<Name>` au-dessus de `ReadModelStore<<Name>Row>`. Sa table, nommée d'après lui en snake_case, dans le schéma du contexte, avec la colonne de chaque champ et les colonnes du registre (`readModelColumns()` ; le modèle Prisma les porte comme champs). La colonne d'un champ accepte null quoi qu'exige la ligne, une ligne supprimée étant une trace qui ne garde que sa clé et son tampon, et une contrainte de vérification `<table>_live_rows_whole` garde entière toute autre ligne, `deleted or (<column> is not null and ...)` sur les champs que la ligne exige : `check(...)` sur Drizzle, `table.check(...)` sur Knex, `checks` du schéma d'entité sur TypeORM, et sur Prisma, dont le langage de schéma n'en a pas, une ligne `TODO(domain)` du modèle qui porte l'`ALTER TABLE` à ajouter à la migration. La colonne du *tenant* et son index avec `--tenant-scoped` ou dans un projet multi-*tenant*. L'adaptateur `infrastructure/persistence/<orm>-<name>.repository.ts`, une classe `<Orm><Name>` au-dessus du registre de modèle de lecture du paquet de l'ORM (`DrizzleReadModelStore`, `KnexReadModelStore`, `PrismaReadModelStore`, `TypeOrmReadModelStore` ; `InMemoryReadModelStore` du noyau dans un projet sans ORM), déclarée avec `@Repository(<Name>)`, ou liée dans le fichier de module dans le style explicite (une note dit où la construire sur une plateforme câblée à la main). Le *fake* `test/fakes/<name>.fake.ts` et `test/integration/<name>.contract.spec.ts`, qui lance `readModelContract` sur le *fake* et sur l'adaptateur et, avec un *tenant*, prouve qu'un *tenant* ne lit pas les lignes d'un autre. Un port de ce nom qui n'est pas un modèle de lecture est refusé |
|
|
855
857
|
| `job` | `<context> <Name> (--every <duration> \| --cron "<expression>" [--time-zone <zone>]) --command <UseCaseName> [--global] [--module <module>]` | `application/scheduling/<name>.job.ts`, une classe `<Name>Job implements ScheduledJob` qui envoie la commande, en tant que `systemActor('<context>.<name>')` quand elle est protégée, avec `execution.scheduledAt` quand la commande le prend ; `test/unit/<name>.job.spec.ts`, qui exécute le *job* (par son nom sur tsyringe, `application.jobs.runNow` ; `job.run(occurrence)` en câblage manuel) et vérifie la commande qu'il a envoyée ; son enregistrement ; son interrupteur dans `platform/jobs/job-settings.ts` ; l'autorisation de son acteur système (ci-dessous) |
|
|
856
858
|
| `background-job` | `<context> <Name> --command <UseCaseName> [--module <module>]` | `application/background/<name>.background-job.ts`, une classe `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` nommée par son `jobName` statique `<context>.<name>`, qui envoie la commande en tant que `execution.actor` quand elle est protégée, suivi d'un champ de `<Name>Payload` par autre paramètre du constructeur de la commande (chaînes, nombres, booléens, littéraux et listes de ceux-ci tels qu'écrits, une `Date` sous forme de son texte ISO ; tout le reste est refusé), et son `payload` statique, le schéma de cette charge utile dans la bibliothèque de validation de la pile (un `z.object` sous zod, une classe de champs décorés sans valeur initiale sous class-validator, un `Type.Object` sous TypeBox, un refus par champ écrit à la main sous Standard Schema et, avec `--validation none`, dans le `BackgroundJobPayloadSchema` du noyau ; un type qu'il ne sait pas vérifier est typé `unknown` avec un `TODO(domain)`), avec lequel le *worker* lit la charge utile stockée avant chaque exécution ; `test/unit/<name>.background-job.spec.ts`, qui le met en file avec une charge utile de chaque champ en tant qu'utilisateur et exécute ce qui est dû, puis le met en file tel qu'une version antérieure le déclarait (`earlierVersionOf` de `@ddd-ts-kit/testing`) et montre le *job* mort avec `INVALID_JOB_PAYLOAD` (à travers l'application de test sur tsyringe, à travers une file et un *worker* en mémoire sur les bus de test sinon) ; son enregistrement (`@Background()`, `builder.backgroundJob(..)` dans le fichier de module sur tsyringe, `platform.backgroundJobs.register(..)` dans le fichier de module d'une plateforme câblée à la main) |
|
|
857
859
|
| `process` (`process-manager`) | `<context> <Name> [--module <module>]` | `application/processes/<name>.process.ts` (son état, `processName`, `timeoutJob`, `isState`, une première étape qui arme une échéance, une étape qui y met fin à temps, l'étape de l'échéance), `application/background/<name>-timeout.background-job.ts`, qui livre ses expirations au moyen de `ProcessRunner`, et les *specs* des deux (`givenProcess`, la file de l'application de test sur tsyringe, une file et un *runner* en mémoire sur les bus de test sinon) |
|
|
858
860
|
| `acl` | `<context> <upstreamOrSystemName> [--module <module>]` | traducteur dans `infrastructure/anti-corruption/`, *spec* |
|
|
859
|
-
| `e2e` | `<context> <UseCaseName> [--event <eventType>]` | `test/e2e/<use-case>.e2e.spec.ts` qui pilote la route du cas d'usage : 401 sans identifiant de connexion, 403 sans la permission, le statut documenté avec elle ; pour une commande, un test de plus vérifie la trace de la requête HTTP, exacte sur les noms et la structure, avec `installTestTracing()` et `expectSpanTree(storyOf(trace), [...])` de `@ddd-ts-kit/tracing/testing` (`POST /invoices`, puis `command IssueInvoiceCommand`, puis `repository InvoiceRepository.save`, et après lui, pour une commande qui donne naissance à un agrégat né avec `--birth`, `unit-of-work before-commit` et `domain-event <name>` de son événement de naissance, une note nommant ce qui y réagit déjà). Un cas d'usage qu'aucune route n'atteint, lancé par un gestionnaire d'événement d'intégration du contexte, reçoit une spec qui publie l'événement de l'amont, construit depuis sa déclaration, avec `application.publish([event])`, attend `application.settled()` et laisse des `it.todo` pour ce qu'un client observe (les routes `GET` du contexte, ou les événements qu'il publie, avec `collectEvents`) ; le gestionnaire qui envoie `<UseCase>Command` est cherché dans `application/integration/handlers/`, et `--event billing.invoice.issued` nomme l'événement quand des gestionnaires de plusieurs l'envoient, ou quand le gestionnaire ne l'envoie pas encore. Demande la route,
|
|
861
|
+
| `e2e` | `<context> <UseCaseName> [--event <eventType> \| --job <JobName>]` | `test/e2e/<use-case>.e2e.spec.ts` qui pilote la route du cas d'usage : 401 sans identifiant de connexion, 403 sans la permission, le statut documenté avec elle ; pour une commande, un test de plus vérifie la trace de la requête HTTP, exacte sur les noms et la structure, avec `installTestTracing()` et `expectSpanTree(storyOf(trace), [...])` de `@ddd-ts-kit/tracing/testing` (`POST /invoices`, puis `command IssueInvoiceCommand`, puis `repository InvoiceRepository.save`, et après lui, pour une commande qui donne naissance à un agrégat né avec `--birth`, `unit-of-work before-commit` et `domain-event <name>` de son événement de naissance, une note nommant ce qui y réagit déjà). Un cas d'usage qu'aucune route n'atteint, lancé par un gestionnaire d'événement d'intégration du contexte, reçoit une spec qui publie l'événement de l'amont, construit depuis sa déclaration, avec `application.publish([event])`, attend `application.settled()` et laisse des `it.todo` pour ce qu'un client observe (les routes `GET` du contexte, ou les événements qu'il publie, avec `collectEvents`) ; le gestionnaire qui envoie `<UseCase>Command` est cherché dans `application/integration/handlers/`, et `--event billing.invoice.issued` nomme l'événement quand des gestionnaires de plusieurs l'envoient, ou quand le gestionnaire ne l'envoie pas encore. Un cas d'usage dont seul un *job* envoie la commande reçoit un test par *job* : `await application.runJob('<context>.<job>')` pour un *job* planifié (`application/scheduling/`), et, pour un *job* en arrière-plan (`application/background/`), la requête qui le met en file laissée à écrire, `const ran = await application.runDueJobs()`, qui exécute ce qui est échu dans les files comme le ferait le *worker*, et la vérification que le *job* est parmi `ran` ; chacun attend ensuite `application.settled()`. `--job VoidInvoice` nomme un seul *job*, par sa classe ou par le nom sous lequel il s'exécute (`billing.void-invoice`), y compris pour un cas d'usage qu'une route atteint, et écrit `test/e2e/<use-case>-<job>.e2e.spec.ts`. Demande la route, ce gestionnaire, ou un *job* qui envoie la commande |
|
|
860
862
|
| `acceptance` | `<story> ["<title>"]` | `test/acceptance/<story>.acceptance.spec.ts`, écrit avant le code : un `it.todo` par critère d'acceptation de `docs/architecture/stories/<story>.md`, ou par ligne de tranche de l'histoire dans `docs/architecture/slices.md` quand elle n'en énonce aucun |
|
|
861
863
|
| `policy` | `<context> <Name> --permission <aggregate>.<action> [--module <module>]` | `application/authorization/<name>.policy.ts`, *spec* ; déclaré : la classe porte `@Policy(permission, { name })` et rien d'autre n'est écrit ; explicite : l'enregistrement dans `platform/auth/authorization/access-policies.ts` |
|
|
862
864
|
| `gateway` | `<context> <upstreamContext> <Name> [--module <module>]` | le contrat de lecture dans le langage publié de l'amont (`<name>.contract.ts`, une classe abstraite et le jeton de la valeur de l'amont), le port `application/ports/<name>-gateway.port.ts`, un adaptateur dans le processus dans `infrastructure/external/` lié `.as('gateway')`, un *fake*, une suite de contrat ; refusé sauf si l'amont est déclaré |
|
|
@@ -2164,6 +2166,22 @@ une ligne de ponctuation perdue, ni un changement de sens, et un clone superfici
|
|
|
2164
2166
|
*commits* qu'elle lit : en CI il lui faut `fetch-depth: 0`, c'est pourquoi les *pipelines*
|
|
2165
2167
|
d'`init` ne la lancent pas.
|
|
2166
2168
|
|
|
2169
|
+
**Les migrations de la branche face au tronc.** Sans `<commit>`, elle lit ensuite les migrations
|
|
2170
|
+
de l'arbre de travail face au même tronc, avec les quatre ORM : une migration que la branche
|
|
2171
|
+
ajoute et dont le nom se trie avant la dernière migration du tronc (knex, Prisma, TypeORM), une
|
|
2172
|
+
entrée que la branche ajoute au journal de drizzle-kit et dont le `when` n'est pas après la
|
|
2173
|
+
dernière entrée de celui du tronc, et un fichier `.sql` que ce journal ne liste pas et que le
|
|
2174
|
+
tronc ne contient pas. Ce qui est ordonné est ce que l'outil prend pour une migration, selon ce
|
|
2175
|
+
par quoi il l'ordonne : chaque script du dossier de knex et les dossiers de Prisma qui
|
|
2176
|
+
contiennent un `migration.sql`, par leur nom ; les classes de TypeORM dont le nom se termine par
|
|
2177
|
+
13 chiffres, par ce nombre. Chacune est
|
|
2178
|
+
une erreur qui nomme la migration, la dernière du tronc et la commande qui remet l'ordre
|
|
2179
|
+
(`merge-trunk` sous drizzle-kit, ou le `meta/` du tronc puis `drizzle-generate --replay` une fois
|
|
2180
|
+
le tronc fusionné ; `merge-trunk --to-land` ailleurs), et `--warn` ne l'adoucit pas : code de
|
|
2181
|
+
sortie 1. Une migration de travail (`working-<what-it-does>`) est laissée de côté. Dans
|
|
2182
|
+
`--json` : `migrations`, chacune `{ kind, migration, file, trunkLast, text, fix }` avec `kind`
|
|
2183
|
+
`before-trunk` ou `not-in-journal`, comptées dans `errorCount`.
|
|
2184
|
+
|
|
2167
2185
|
|
|
2168
2186
|
## merge-trunk
|
|
2169
2187
|
|
|
@@ -2259,6 +2277,18 @@ nécessaire pour une base que git ne calculerait pas ; un git plus ancien fusion
|
|
|
2259
2277
|
`git merge` lui-même depuis `git merge-base` (`--since <merge base>`), et refuse `--dry-run`.
|
|
2260
2278
|
Sortie 0 une fois commité, à jour ou en aperçu, 1 sur un arrêt, 2 quand il ne peut pas démarrer.
|
|
2261
2279
|
|
|
2280
|
+
Sur une branche qui contient déjà le tronc, il n'y a rien à fusionner. `--to-land` fait quand
|
|
2281
|
+
même atterrir ses migrations quand l'une est une migration de travail, se trie avant la dernière
|
|
2282
|
+
du tronc ou manque au journal de drizzle-kit : rejouées sous drizzle-kit, renommées après la
|
|
2283
|
+
dernière du tronc sous knex, Prisma et TypeORM, seulement celles qui ne suivent pas déjà celles du
|
|
2284
|
+
tronc et dans leur ordre (un arrêt, code de sortie 1, quand l'une d'elles et une migration plus
|
|
2285
|
+
récente du tronc nomment la même table : l'arrêt dit de la supprimer, puis de la générer de
|
|
2286
|
+
nouveau). Elles sont laissées à committer : aucun commit de fusion ne les porte. Un arrêt laisse
|
|
2287
|
+
le dossier des migrations comme il a été trouvé, donc la même commande se relance, et `--dry-run`
|
|
2288
|
+
dit quelles migrations bougeraient. Chaque renommage ou rejeu se termine par ce qu'il faut faire
|
|
2289
|
+
d'une base qui a déjà appliqué l'ancien nom : la réinitialiser, ou corriger sa table des
|
|
2290
|
+
migrations (la table de chaque outil est dans `docs/tools/persistence.fr.md`).
|
|
2291
|
+
|
|
2262
2292
|
```text
|
|
2263
2293
|
merge-trunk build/billing-2 <- origin/main (d8d281b)
|
|
2264
2294
|
base 6d8be4b: build/billing-1 landed as d8d281b "feat(billing): issue and cancel (#1)"
|
|
@@ -2514,9 +2544,9 @@ règle.
|
|
|
2514
2544
|
| `clean/one-export-per-file` | sous la racine des sources, tests à part : plus d'une classe, interface ou fonction exportée que les tolérances n'expliquent pas (les types de la signature de l'export principal, un type et une valeur qui partagent un nom, un type avec ses constructeurs, les accesseurs d'un même état privé, `onePerFile.allow`) ; un fichier qui ne porte pas le nom de son export principal en kebab-case (`invoice.aggregate.ts` pour `Invoice`) ; un `index.ts` ou un `<context>.declarations.ts` qui contient autre chose que des réexports |
|
|
2515
2545
|
| `clean/file-size` | un fichier de plus de 350 lignes, sources et tests ; un chemin avec un segment `generated` et les fichiers de déclaration sont exemptés |
|
|
2516
2546
|
| `composition/only-in-module` | `new X`, ou `bind(..).toClass(X, ..)` et `rebind(..).toClass(X, ..)`, d'une classe importée de `infrastructure/`, hors du fichier de module, de `main.ts`, de la plateforme et des tests ; dans un fichier qui importe `@ddd-ts-kit/di`, un appel de `contextModule`, `discoverContext` ou `.include(` hors de ces endroits et de `apps/<context>/main.ts` |
|
|
2517
|
-
| `imports/alias-only` | sous la racine des sources, `test/` et `scripts/` : un `import`, `export ... from` ou `import()` avec un spécificateur relatif, même répertoire compris (la correction nomme l'alias à écrire ; `eslint --fix` l'écrit) ; un spécificateur d'alias avec un segment `.` ou `..` |
|
|
2547
|
+
| `imports/alias-only` | sous la racine des sources, `test/` et `scripts/` : un `import`, `export ... from` ou `import()` avec un spécificateur relatif, même répertoire compris (la correction nomme l'alias à écrire ; `eslint --fix` l'écrit), sauf `./<nom>` entre deux fichiers placés directement sous `test/support/`, qu'un lanceur de tests charge avant qu'aucun alias n'existe ; ce `./<nom>` quand la source présente sur le disque porte un autre nom (une source `.ts` nommée avec une extension sous `none` ; sous `js`, `./x` ou `./x.js` pour `x.ts`, `./x.mjs` pour `x.mts`, `./x.cjs` pour `x.cts`), nomme `.` ou `..`, ou nomme un répertoire ; un spécificateur d'alias avec un segment `.` ou `..` |
|
|
2518
2548
|
| `imports/extension` | sous la racine des sources, `test/` et `scripts/` : avec `importExtension` `none`, un spécificateur d'alias qui se termine par `.js`, `.mjs`, `.cjs`, `.ts`, `.mts` ou `.cts` ; avec `js` (ou sans clé), un spécificateur d'alias qui ne se termine pas par `.js` (la correction nomme le spécificateur à écrire ; `eslint --fix` l'écrit). Un sous-chemin de *package* n'est jamais jugé |
|
|
2519
|
-
| `imports/alias-declared` | un `importAlias` qui n'est pas `@/` ou `$<name>/`, ou qui est `$test/`, `$scripts/`, `$generated/` ; une entrée `paths` de `tsconfig.json` manquante ou différente de ce que donne `importAlias` (la correction donne l'entrée) ; une autre entrée `paths` sous un alias ; un `baseUrl` ; un `tsconfig.build.json` dont les `paths` diffèrent ; des `paths` de `knip.json` qui associent un alias ; un script qui compile (`tsc` sans `--noEmit`) et ne lance pas `ddd-ts-kit build-aliases` ensuite ; un script qui lance `tsx --tsconfig` sur un autre fichier ; une configuration `vitest` à la racine sans `tsconfigPaths: true`, une configuration `jest` sans les entrées `moduleNameMapper` dérivées, ou `.dependency-cruiser.cjs` sans `tsConfig` ; un `module` et un `moduleResolution` de `tsconfig.json` (ou d'un `tsconfig.build.json` qui pose les siens) qui ne sont pas ce que donne `importExtension` : `ESNext`, `Bundler` et `customConditions` contenant `node` sous `none`, et sous `js` une valeur écrite qui n'est pas une résolution Node ; une association jest dont le motif ne se termine pas comme les imports. Un projet sans `package.json` n'est pas jugé |
|
|
2549
|
+
| `imports/alias-declared` | un `importAlias` qui n'est pas `@/` ou `$<name>/`, ou qui est `$test/`, `$scripts/`, `$generated/` ; une entrée `paths` de `tsconfig.json` manquante ou différente de ce que donne `importAlias` (la correction donne l'entrée) ; une autre entrée `paths` sous un alias ; un `baseUrl` ; un `tsconfig.build.json` dont les `paths` diffèrent ; des `paths` de `knip.json` qui associent un alias ; un script qui compile (`tsc` sans `--noEmit`) et ne lance pas `ddd-ts-kit build-aliases` ensuite ; un script qui lance `tsx --tsconfig` sur un autre fichier ; une configuration `vitest` à la racine sans `tsconfigPaths: true`, une configuration `jest` sans les entrées `moduleNameMapper` dérivées, ou `.dependency-cruiser.cjs` sans `tsConfig` ; un `module` et un `moduleResolution` de `tsconfig.json` (ou d'un `tsconfig.build.json` qui pose les siens) qui ne sont pas ce que donne `importExtension` : `ESNext`, `Bundler` et `customConditions` contenant `node` sous `none`, et sous `js` une valeur écrite qui n'est pas une résolution Node ; une association jest dont le motif ne se termine pas comme les imports ; sous `js`, un fichier placé directement sous `test/support/` qui importe un voisin par son `.ts` alors que `tsconfig.json` ne fixe ni `allowImportingTsExtensions` ni `rewriteRelativeImportExtensions` ; quelle que soit la terminaison, un `tsconfig.build.json`, ou un tsconfig qu'un script compile pour ce qui est livré, qui résout `noEmit` à `true`, ou `allowImportingTsExtensions` à `true` sans `rewriteRelativeImportExtensions` ni `emitDeclarationOnly`. Un projet sans `package.json` n'est pas jugé |
|
|
2520
2550
|
| `config/valid` | un amont, une classification, une relation, un identifiant de règle, un mode de `guard` ou un `importExtension` inconnu ; un répertoire de la configuration qui sort du projet ; un contexte absent du disque ou de la configuration ; une limite de `commit` qui n'est pas un entier positif |
|
|
2521
2551
|
| `config/suppression-needs-reason` | une désactivation sans identifiant de règle ou sans raison (gardée comme alias à côté de `governance/recorded-deviation`, qui juge la raison) |
|
|
2522
2552
|
| `authz/declared` | dans un fichier de module, `builder.command(X)` ou `builder.query(X)` sans `.requires(` ni `.public(` dans sa chaîne, sauf si la classe du message porte `@Requires` ou `@Public` de `@ddd-ts-kit/kernel/declarations` ; en câblage manuel ou nest, une classe de commande ou de requête absente de tous les `requires(X, ...)` et `publicUseCase(X)` du fichier de module et de `application/authorization/` ; un `defineRoute` sans `security` (le type de la route le refuse déjà, et une liste vide aussi : c'est le filet au niveau du texte pour une définition construite de façon lâche) ; dans le style déclaré, la classe exportée d'un fichier `*.command.ts` ou `*.query.ts` qui ne porte ni `@Requires` ni `@Public` |
|
|
@@ -2533,6 +2563,7 @@ règle.
|
|
|
2533
2563
|
| `authz/actor-explicit` | dans `domain/` et `application/` : `ActorContext`, `ExecutionScope` (comme type ou comme valeur : la classe est le jeton d'une liste de dépendances), `AsyncLocalStorageExecutionScope`, `ScopedActorContext`, `AsyncLocalStorage` ; `.current()` ou `.require()` sur un contexte d'acteur ou sur quelque chose nommé `scope`, `scopes` ou `...executionScope` ; un import de `stampCreation`, `stampUpdate` ou `tenantScopeOf` |
|
|
2534
2564
|
| `authz/fields-by-schema` | sous `application/queries/` : `roles.includes(`, `.some(`, `.every(`, `.find(`, `.indexOf(`, une comparaison avec un `role`, `isAdmin` |
|
|
2535
2565
|
| `aspects/outside-in` | un import de `@ddd-ts-kit/aspects/decorators` hors de `infrastructure/` d'un contexte et du répertoire de la plateforme : `presentation/`, le fichier de module, `published-language/`, le noyau partagé, `main.ts`, toute autre source (`domain/` et `application/` sont signalés par les deux règles `layer/*` à la place) |
|
|
2566
|
+
| `aspects/timeout-covers-delegate` | un adaptateur déclaré avec `@Adapter` ou `@Gateway`, ou lié par `bind(Port).toClass(Adapter)` dans un fichier qui importe `@ddd-ts-kit/di`, qui s'exécute sous la seule politique par défaut et dont le constructeur a un paramètre typé par un port dont l'adaptateur déclare un délai plus long. Sous la seule politique par défaut : le genre `external` ou `gateway` (le littéral de `kind:` ou de `.as(` ; `external` pour un `@Adapter` sans `kind`, aucun pour une liaison sans `.as(`), aucun `ownPolicy(...)` et aucun `timeout(...)` parmi les éléments de `aspects: [...]` ou les arguments de `.with(...)`. Le délai par défaut : le `fallback: <nombre>` écrit après la chaîne `'OUTBOUND_TIMEOUT_MS'`, premier argument d'un appel, dans un seul fichier du répertoire de la plateforme, sinon le `timeoutMs: <nombre>` de `<platform>/resilience/default-resilience-settings.ts`. Le délai derrière le port : le plus petit `timeout(<nombre>)` qui est un élément de ses aspects ou un argument de son `ownPolicy(...)`, quand il a un `ownPolicy(...)` ou un genre que la politique par défaut laisse de côté. La classe d'une liaison est celle que le fichier de la liaison déclare ou importe sous ce nom, sinon la seule classe de ce nom. Muette sur : une plateforme câblée à la main (`platform.adapter(...)`) ; une durée ou un genre qui n'est pas un littéral ; un aspect qui est une variable, une décomposition, un appel d'un autre nom ou sous `when(...)` ; un `timeout(` imbriqué dans les options d'un autre aspect ; un `@Timeout` sur une méthode ; un port ou un adaptateur lié plus d'une fois, lié de nouveau par `rebind(`, ou lié sous une condition ; un paramètre typé par un nom que l'adaptateur n'importe pas d'un fichier du projet (un type d'un paquet, une déclaration de son propre fichier) ; deux ports du même nom, sauf si chaque fichier importe le sien depuis le fichier qui le déclare ; un adaptateur atteint à travers un adaptateur intermédiaire ; un délai par défaut qui n'est pas un seul nombre, ou un environnement qui fixe `OUTBOUND_TIMEOUT_MS` ; les nouvelles tentatives |
|
|
2536
2567
|
| `tracing/platform-only` | un import de `@ddd-ts-kit/tracing` ou d'un *package* `@opentelemetry/*` hors du répertoire de la plateforme, de `main.ts` et de `apps/`, tests compris |
|
|
2537
2568
|
| `nest/no-parallel-pipeline` | dans `presentation/`, `infrastructure/` ou le fichier de module d'un contexte, tests à part : un import d'un contrôleur que Nest sert (ses décorateurs de route et de paramètres, sauf si le fichier importe `KitRoute` ou `KitRoutes` de `@ddd-ts-kit/http/nest`), de la requête ou de la réponse brutes, d'un *guard*, d'un *pipe*, d'un filtre d'exceptions ou d'une `HttpException`, d'un intercepteur ou du `Logger` de `@nestjs/common`, un import sans nom de celui-ci, ou un import d'un *package* de Nest dont le kit fait le travail (`@nestjs/core`, `@nestjs/swagger`, `@nestjs/cqrs`, `@nestjs/passport`, `@nestjs/config`, `@nestjs/schedule` et les autres de la section 3 d'ARCHITECTURE.md) ; le message dit ce que le kit fait à sa place ; sous la racine des sources hors des contextes, tests à part : un fichier qui importe `Controller` de `@nestjs/common`, ni `KitRoute` ni `KitRoutes`, et nomme `CommandBus` ou `QueryBus` ou importe un fichier d'un contexte |
|
|
2538
2569
|
| `nest/controllers-current` | avec `"stack.routes": "nest"` : un `<context>.controllers.ts` qui diffère de ce que donnent les contrôleurs Nest du contexte et les signatures de leurs méthodes, ou absent ; une partie de la requête prise entière par aucune classe DTO et que `request` de `@KitRoute` ne donne pas ; une méthode de route qui ne répond ni une classe DTO, ni `Accepted`, ni `void`, et ne déclare pas de `response` dans `@KitRoute` |
|