ddd-ts-kit 0.103.0 → 0.105.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 +110 -6
- package/README.fr.md +29 -18
- package/README.md +28 -16
- package/dist/check/canonical/earlier-context-file.d.ts +1 -6
- package/dist/check/canonical/earlier-context-file.d.ts.map +1 -1
- package/dist/check/canonical/earlier-context-file.js +4 -10
- package/dist/check/canonical/earlier-context-file.js.map +1 -1
- package/dist/check/canonical/stray-entry.d.ts.map +1 -1
- package/dist/check/canonical/stray-entry.js +14 -1
- package/dist/check/canonical/stray-entry.js.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.d.ts.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +1 -1
- package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
- package/dist/check/commands/check-command.d.ts.map +1 -1
- package/dist/check/commands/check-command.js +24 -1
- package/dist/check/commands/check-command.js.map +1 -1
- package/dist/check/commands/check-file-command.d.ts.map +1 -1
- package/dist/check/commands/check-file-command.js +3 -0
- package/dist/check/commands/check-file-command.js.map +1 -1
- package/dist/check/commands/explain-command.d.ts.map +1 -1
- package/dist/check/commands/explain-command.js +8 -21
- package/dist/check/commands/explain-command.js.map +1 -1
- package/dist/check/events/domain-event-names.d.ts +1 -1
- package/dist/check/events/domain-event-names.js +1 -1
- package/dist/check/explain/delegated-doc.d.ts +4 -0
- package/dist/check/explain/delegated-doc.d.ts.map +1 -0
- package/dist/check/explain/delegated-doc.js +11 -0
- package/dist/check/explain/delegated-doc.js.map +1 -0
- package/dist/check/explain/delegated-docs.d.ts +8 -0
- package/dist/check/explain/delegated-docs.d.ts.map +1 -0
- package/dist/check/explain/delegated-docs.js +292 -0
- package/dist/check/explain/delegated-docs.js.map +1 -0
- package/dist/check/explain/errors-docs.d.ts.map +1 -1
- package/dist/check/explain/errors-docs.js +10 -18
- package/dist/check/explain/errors-docs.js.map +1 -1
- package/dist/check/explain/layer-docs.d.ts.map +1 -1
- package/dist/check/explain/layer-docs.js +6 -4
- package/dist/check/explain/layer-docs.js.map +1 -1
- package/dist/check/explain/module-docs.js +1 -1
- package/dist/check/explain/module-docs.js.map +1 -1
- package/dist/check/explain/ports-docs.js +1 -1
- package/dist/check/explain/ports-docs.js.map +1 -1
- package/dist/check/explain/standard-docs.js +2 -2
- package/dist/check/explain/standard-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.js +2 -2
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.js +1 -1
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/context-file-fixtures.d.ts +1 -1
- package/dist/check/fixtures/context-file-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/context-file-fixtures.js +4 -6
- package/dist/check/fixtures/context-file-fixtures.js.map +1 -1
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/earlier-declarations-fixtures.js +2 -4
- package/dist/check/fixtures/earlier-declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +4 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/layer-entry-fixtures.d.ts +4 -0
- package/dist/check/fixtures/layer-entry-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/layer-entry-fixtures.js +35 -0
- package/dist/check/fixtures/layer-entry-fixtures.js.map +1 -0
- package/dist/check/fixtures/layer-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/layer-fixtures.js.map +1 -1
- package/dist/check/fixtures/module-fixtures.js +2 -2
- package/dist/check/fixtures/module-fixtures.js.map +1 -1
- package/dist/check/fixtures/other-language-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/other-language-fixtures.js +1 -1
- package/dist/check/fixtures/other-language-fixtures.js.map +1 -1
- package/dist/check/fixtures/ports-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/ports-fixtures.js +1 -0
- package/dist/check/fixtures/ports-fixtures.js.map +1 -1
- package/dist/check/fixtures/purity-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/purity-fixtures.js +18 -0
- package/dist/check/fixtures/purity-fixtures.js.map +1 -1
- package/dist/check/fixtures/role-folder-fixtures.d.ts +4 -0
- package/dist/check/fixtures/role-folder-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/role-folder-fixtures.js +31 -0
- package/dist/check/fixtures/role-folder-fixtures.js.map +1 -0
- package/dist/check/fixtures/test-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/test-fixtures.js +9 -0
- package/dist/check/fixtures/test-fixtures.js.map +1 -1
- package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/tree-fixtures.js +0 -1
- package/dist/check/fixtures/tree-fixtures.js.map +1 -1
- package/dist/check/layers/outer-entry.d.ts +13 -0
- package/dist/check/layers/outer-entry.d.ts.map +1 -0
- package/dist/check/layers/outer-entry.js +29 -0
- package/dist/check/layers/outer-entry.js.map +1 -0
- package/dist/check/rules/clean-braces.js +1 -1
- package/dist/check/rules/clean-braces.js.map +1 -1
- package/dist/check/rules/declarations-barrel-current.d.ts.map +1 -1
- package/dist/check/rules/declarations-barrel-current.js +3 -12
- package/dist/check/rules/declarations-barrel-current.js.map +1 -1
- package/dist/check/rules/layer-application-inward.d.ts.map +1 -1
- package/dist/check/rules/layer-application-inward.js +3 -1
- package/dist/check/rules/layer-application-inward.js.map +1 -1
- package/dist/check/rules/layer-domain-purity.d.ts.map +1 -1
- package/dist/check/rules/layer-domain-purity.js +3 -1
- package/dist/check/rules/layer-domain-purity.js.map +1 -1
- package/dist/check/rules/module-complete.d.ts.map +1 -1
- package/dist/check/rules/module-complete.js +6 -2
- package/dist/check/rules/module-complete.js.map +1 -1
- package/dist/check/rules/naming-suffix.js +7 -1
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/check/rules/ports-abstract-class.d.ts.map +1 -1
- package/dist/check/rules/ports-abstract-class.js +16 -2
- package/dist/check/rules/ports-abstract-class.js.map +1 -1
- package/dist/check/rules/purity-no-ambient-randomness.d.ts.map +1 -1
- package/dist/check/rules/purity-no-ambient-randomness.js +4 -0
- package/dist/check/rules/purity-no-ambient-randomness.js.map +1 -1
- package/dist/check/rules/purity-no-environment.d.ts.map +1 -1
- package/dist/check/rules/purity-no-environment.js +5 -0
- package/dist/check/rules/purity-no-environment.js.map +1 -1
- package/dist/check/rules/purity-no-system-clock.d.ts.map +1 -1
- package/dist/check/rules/purity-no-system-clock.js +4 -0
- package/dist/check/rules/purity-no-system-clock.js.map +1 -1
- package/dist/check/rules/test-no-mocks.d.ts.map +1 -1
- package/dist/check/rules/test-no-mocks.js +16 -6
- package/dist/check/rules/test-no-mocks.js.map +1 -1
- package/dist/check/rules/tree-closed.d.ts.map +1 -1
- package/dist/check/rules/tree-closed.js +1 -2
- package/dist/check/rules/tree-closed.js.map +1 -1
- package/dist/commands/affected.d.ts.map +1 -1
- package/dist/commands/affected.js +5 -4
- package/dist/commands/affected.js.map +1 -1
- package/dist/commands/cited.d.ts.map +1 -1
- package/dist/commands/cited.js +2 -1
- package/dist/commands/cited.js.map +1 -1
- package/dist/commands/depcruise-config.d.ts.map +1 -1
- package/dist/commands/depcruise-config.js +10 -7
- package/dist/commands/depcruise-config.js.map +1 -1
- package/dist/commands/digest.d.ts.map +1 -1
- package/dist/commands/digest.js +2 -1
- package/dist/commands/digest.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +9 -16
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +6 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/drizzle-generate.d.ts.map +1 -1
- package/dist/commands/drizzle-generate.js +9 -2
- package/dist/commands/drizzle-generate.js.map +1 -1
- package/dist/commands/json-report.d.ts +8 -0
- package/dist/commands/json-report.d.ts.map +1 -0
- package/dist/commands/json-report.js +42 -0
- package/dist/commands/json-report.js.map +1 -0
- package/dist/commands/knex-generate.d.ts.map +1 -1
- package/dist/commands/knex-generate.js +8 -2
- package/dist/commands/knex-generate.js.map +1 -1
- package/dist/commands/lint.d.ts +2 -2
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +26 -5
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/mutation.d.ts.map +1 -1
- package/dist/commands/mutation.js +3 -2
- package/dist/commands/mutation.js.map +1 -1
- package/dist/commands/plan-waves.d.ts +2 -1
- package/dist/commands/plan-waves.d.ts.map +1 -1
- package/dist/commands/plan-waves.js +8 -4
- package/dist/commands/plan-waves.js.map +1 -1
- package/dist/commands/print-report.d.ts.map +1 -1
- package/dist/commands/print-report.js +2 -1
- package/dist/commands/print-report.js.map +1 -1
- package/dist/commands/prisma-generate.d.ts.map +1 -1
- package/dist/commands/prisma-generate.js +5 -4
- package/dist/commands/prisma-generate.js.map +1 -1
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +16 -3
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/typeorm-generate.d.ts.map +1 -1
- package/dist/commands/typeorm-generate.js +19 -16
- package/dist/commands/typeorm-generate.js.map +1 -1
- package/dist/commands/verify-slice.d.ts.map +1 -1
- package/dist/commands/verify-slice.js +3 -2
- package/dist/commands/verify-slice.js.map +1 -1
- package/dist/commit/resolved-trunk.d.ts +3 -0
- package/dist/commit/resolved-trunk.d.ts.map +1 -0
- package/dist/commit/resolved-trunk.js +7 -0
- package/dist/commit/resolved-trunk.js.map +1 -0
- package/dist/commit/trunk-example.d.ts +3 -0
- package/dist/commit/trunk-example.d.ts.map +1 -0
- package/dist/commit/trunk-example.js +6 -0
- package/dist/commit/trunk-example.js.map +1 -0
- package/dist/context-files/context-file.d.ts +1 -1
- package/dist/declared/earlier-layout-notice.d.ts +1 -1
- package/dist/declared/earlier-layout-notice.js +1 -1
- package/dist/declared/earlier-layout-notice.js.map +1 -1
- package/dist/declared/keeps-role-folder-files.d.ts +1 -2
- package/dist/declared/keeps-role-folder-files.d.ts.map +1 -1
- package/dist/declared/keeps-role-folder-files.js +1 -2
- package/dist/declared/keeps-role-folder-files.js.map +1 -1
- package/dist/declared/keeps-single-file.d.ts +2 -3
- package/dist/declared/keeps-single-file.d.ts.map +1 -1
- package/dist/declared/keeps-single-file.js +2 -3
- package/dist/declared/keeps-single-file.js.map +1 -1
- package/dist/describe/context-description.d.ts +2 -0
- package/dist/describe/context-description.d.ts.map +1 -1
- package/dist/describe/describe-context.d.ts.map +1 -1
- package/dist/describe/describe-context.js +6 -0
- package/dist/describe/describe-context.js.map +1 -1
- package/dist/describe/format-description.js +1 -1
- package/dist/describe/format-description.js.map +1 -1
- package/dist/digest/branch-points.d.ts.map +1 -1
- package/dist/digest/branch-points.js +3 -2
- package/dist/digest/branch-points.js.map +1 -1
- package/dist/docs/spec-heading.d.ts +5 -1
- package/dist/docs/spec-heading.d.ts.map +1 -1
- package/dist/docs/spec-heading.js +8 -2
- package/dist/docs/spec-heading.js.map +1 -1
- package/dist/generate/errors/refuse-taken-class-name.d.ts +9 -0
- package/dist/generate/errors/refuse-taken-class-name.d.ts.map +1 -0
- package/dist/generate/errors/refuse-taken-class-name.js +22 -0
- package/dist/generate/errors/refuse-taken-class-name.js.map +1 -0
- package/dist/generate/errors/write-named-refusal.d.ts.map +1 -1
- package/dist/generate/errors/write-named-refusal.js +2 -0
- package/dist/generate/errors/write-named-refusal.js.map +1 -1
- package/dist/generate/kinds/background-job-kind.d.ts.map +1 -1
- package/dist/generate/kinds/background-job-kind.js +8 -1
- package/dist/generate/kinds/background-job-kind.js.map +1 -1
- package/dist/generate/kinds/generate-context.js +1 -0
- package/dist/generate/kinds/generate-context.js.map +1 -1
- package/dist/generate/kinds/process-kind.d.ts.map +1 -1
- package/dist/generate/kinds/process-kind.js +8 -1
- package/dist/generate/kinds/process-kind.js.map +1 -1
- package/dist/help/flag-notes.d.ts.map +1 -1
- package/dist/help/flag-notes.js +8 -0
- package/dist/help/flag-notes.js.map +1 -1
- package/dist/help/reading-notes.d.ts.map +1 -1
- package/dist/help/reading-notes.js +4 -2
- package/dist/help/reading-notes.js.map +1 -1
- package/dist/help/tool-notes.d.ts.map +1 -1
- package/dist/help/tool-notes.js +1 -2
- package/dist/help/tool-notes.js.map +1 -1
- package/dist/help/usage.js +3 -3
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +6 -2
- package/dist/init/run-init.js.map +1 -1
- package/dist/lint/eslint-in-project.d.ts +1 -1
- package/dist/lint/eslint-in-project.d.ts.map +1 -1
- package/dist/lint/eslint-in-project.js +1 -6
- package/dist/lint/eslint-in-project.js.map +1 -1
- package/dist/lint/format-verdict.d.ts +2 -2
- package/dist/lint/format-verdict.d.ts.map +1 -1
- package/dist/lint/format-verdict.js +3 -4
- package/dist/lint/format-verdict.js.map +1 -1
- package/dist/lint/lint-verdict.d.ts +2 -13
- package/dist/lint/lint-verdict.d.ts.map +1 -1
- package/dist/lint/lint-verdict.js +4 -22
- package/dist/lint/lint-verdict.js.map +1 -1
- package/dist/lint/parse-lint-answer.d.ts +1 -3
- package/dist/lint/parse-lint-answer.d.ts.map +1 -1
- package/dist/lint/parse-lint-answer.js +0 -2
- package/dist/lint/parse-lint-answer.js.map +1 -1
- package/dist/measures/format-measures.js +1 -1
- package/dist/measures/format-measures.js.map +1 -1
- package/dist/measures/measures-view.d.ts +1 -1
- package/dist/measures/measures-view.d.ts.map +1 -1
- package/dist/merge/merge-in-progress.d.ts +7 -0
- package/dist/merge/merge-in-progress.d.ts.map +1 -0
- package/dist/merge/merge-in-progress.js +22 -0
- package/dist/merge/merge-in-progress.js.map +1 -0
- package/dist/migration/answered-as-json.d.ts +13 -0
- package/dist/migration/answered-as-json.d.ts.map +1 -0
- package/dist/migration/answered-as-json.js +38 -0
- package/dist/migration/answered-as-json.js.map +1 -0
- package/dist/migration/audit-guard/run-orm-tool.d.ts.map +1 -1
- package/dist/migration/audit-guard/run-orm-tool.js +2 -1
- package/dist/migration/audit-guard/run-orm-tool.js.map +1 -1
- 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/knex-schema-difference.d.ts.map +1 -1
- package/dist/migration/knex-schema-difference.js +2 -1
- package/dist/migration/knex-schema-difference.js.map +1 -1
- package/dist/migration/run-on-in-process-database.d.ts.map +1 -1
- package/dist/migration/run-on-in-process-database.js +2 -1
- package/dist/migration/run-on-in-process-database.js.map +1 -1
- package/dist/migration/tool-stdio.d.ts +6 -0
- package/dist/migration/tool-stdio.d.ts.map +1 -0
- package/dist/migration/tool-stdio.js +17 -0
- package/dist/migration/tool-stdio.js.map +1 -0
- package/dist/model-modules/module-layers.d.ts +1 -1
- package/dist/model-modules/module-layers.d.ts.map +1 -1
- package/dist/model-modules/module-layers.js +1 -1
- package/dist/model-modules/module-layers.js.map +1 -1
- package/dist/model-modules/role-folders-of.js +1 -1
- package/dist/model-modules/role-folders-of.js.map +1 -1
- package/dist/plan/batched-waves.d.ts +2 -0
- package/dist/plan/batched-waves.d.ts.map +1 -1
- package/dist/plan/batched-waves.js +6 -4
- package/dist/plan/batched-waves.js.map +1 -1
- package/dist/plan/format-plan.d.ts.map +1 -1
- package/dist/plan/format-plan.js +12 -2
- package/dist/plan/format-plan.js.map +1 -1
- package/dist/plan/plan-problems.d.ts +5 -0
- package/dist/plan/plan-problems.d.ts.map +1 -1
- package/dist/plan/plan-problems.js +6 -1
- package/dist/plan/plan-problems.js.map +1 -1
- package/dist/plan/plan-waves.d.ts +2 -0
- package/dist/plan/plan-waves.d.ts.map +1 -1
- package/dist/plan/plan-waves.js +1 -1
- package/dist/plan/plan-waves.js.map +1 -1
- package/dist/plan/ready-now.d.ts +8 -0
- package/dist/plan/ready-now.d.ts.map +1 -0
- package/dist/plan/ready-now.js +25 -0
- package/dist/plan/ready-now.js.map +1 -0
- package/dist/plan/wave-plan.d.ts +8 -0
- package/dist/plan/wave-plan.d.ts.map +1 -1
- package/dist/progress/format-progress.js +10 -1
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/progress/progress.d.ts +2 -0
- package/dist/progress/progress.d.ts.map +1 -1
- package/dist/progress/ready-rows.d.ts +7 -0
- package/dist/progress/ready-rows.d.ts.map +1 -0
- package/dist/progress/ready-rows.js +14 -0
- package/dist/progress/ready-rows.js.map +1 -0
- package/dist/run.d.ts +2 -0
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/stories/open-story-scope.d.ts.map +1 -1
- package/dist/stories/open-story-scope.js +2 -1
- package/dist/stories/open-story-scope.js.map +1 -1
- package/dist/stories/origin-of.d.ts.map +1 -1
- package/dist/stories/origin-of.js +14 -2
- package/dist/stories/origin-of.js.map +1 -1
- package/dist/stories/origin-phase.js +4 -4
- package/dist/stories/origin-phase.js.map +1 -1
- package/dist/stories/read-story-phases.js +8 -4
- package/dist/stories/read-story-phases.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/base-of.d.ts.map +1 -1
- package/dist/worker/base-of.js +2 -2
- package/dist/worker/base-of.js.map +1 -1
- package/dist/worker/briefing-of.js +2 -2
- package/dist/worker/briefing-of.js.map +1 -1
- package/dist/worker/open-worker-scope.js +1 -1
- package/dist/worker/open-worker-scope.js.map +1 -1
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/dist/workspace/workspace.js +2 -1
- package/dist/workspace/workspace.js.map +1 -1
- package/package.json +5 -5
- package/templates/acl/translator.spec.ts.tpl +3 -3
- package/templates/adapter/adapter.spec.ts.tpl +2 -7
- package/templates/adapter/simulated.spec.ts.tpl +1 -1
- package/templates/aggregate/aggregate.spec.ts.tpl +1 -9
- package/templates/background-job/background-job.spec.buses.ts.tpl +19 -3
- package/templates/background-job/background-job.spec.tsyringe.ts.tpl +42 -12
- package/templates/controller/guard.spec.ts.tpl +4 -4
- package/templates/domain-service/domain-service.spec.ts.tpl +2 -2
- package/templates/init/rules/application.md.tpl +2 -0
- package/templates/init/rules/domain.md.tpl +2 -0
- package/templates/init/rules/infrastructure.md.tpl +2 -0
- package/templates/pipeline/lefthook.yml +4 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/pipeline/vitest.config.ts.tpl +2 -0
- package/templates/process/timeout-job.spec.buses.ts.tpl +15 -2
- package/templates/process/timeout-job.spec.tsyringe.ts.tpl +21 -2
- package/templates/query/search.reader.spec.ts.tpl +1 -1
- package/templates/repository/knex/mapper.ts.tpl +1 -1
- package/templates/value-object/value-object.spec.ts.tpl +1 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.105.0",
|
|
4
4
|
"description": "Bootstrap, scaffold and verify Domain-Driven Design (DDD), Clean Architecture and hexagonal TypeScript backends on Node.js: project and code generators, architecture checks, OpenAPI and AsyncAPI documents, for developers and AI coding agents (Claude Code, Codex, GitHub Copilot).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ddd",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../s3/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@ddd-ts-kit/audit": "^0.
|
|
56
|
-
"@ddd-ts-kit/auth": "^0.
|
|
57
|
-
"@ddd-ts-kit/events": "^0.
|
|
58
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
55
|
+
"@ddd-ts-kit/audit": "^0.105.0",
|
|
56
|
+
"@ddd-ts-kit/auth": "^0.105.0",
|
|
57
|
+
"@ddd-ts-kit/events": "^0.105.0",
|
|
58
|
+
"@ddd-ts-kit/kernel": "^0.105.0",
|
|
59
59
|
"@types/pg": "^8.23.1",
|
|
60
60
|
"pg": "^8.23.1"
|
|
61
61
|
}
|
|
@@ -2,11 +2,11 @@ import { describe, expect, it } from '{{tests.module}}';
|
|
|
2
2
|
import { {{name.pascal}}Translator } from '{{alias.context}}/infrastructure/anti-corruption/{{name.kebab}}.translator{{alias.ext}}';
|
|
3
3
|
|
|
4
4
|
describe('Translating the model of {{name.title}}', () => {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
// TODO(domain): replace this test by the entries below once the fields of {{name.title}} are declared, each a test with a real sample received from {{name.title}}.
|
|
6
|
+
it('answers an empty record of {{context.kebab}} as long as its mapping is not written', () => {
|
|
7
|
+
expect(new {{name.pascal}}Translator().translate({})).toEqual({});
|
|
7
8
|
});
|
|
8
9
|
|
|
9
|
-
// TODO(domain): replace each entry below by a test with a real sample received from {{name.title}}.
|
|
10
10
|
it.todo('maps every field to the vocabulary of {{context.kebab}}');
|
|
11
11
|
it.todo('refuses a record the model of {{context.kebab}} cannot express');
|
|
12
12
|
});
|
|
@@ -26,7 +26,7 @@ class Unwired{{name.pascal}} extends Remote{{name.pascal}} {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
describe('
|
|
29
|
+
describe('The remote {{name.words}}', () => {
|
|
30
30
|
{{#if adapter.decorated}}
|
|
31
31
|
it('sends again a call the outside system failed, and answers once it succeeds', async () => {
|
|
32
32
|
const fakes = createAspectFakes();
|
|
@@ -39,13 +39,8 @@ describe('Remote{{name.pascal}}', () => {
|
|
|
39
39
|
expect(await pending).toBe('answered');
|
|
40
40
|
expect(adapter.calls).toBe(2);
|
|
41
41
|
});
|
|
42
|
-
{{/if}}
|
|
43
|
-
{{#unless adapter.decorated}}
|
|
44
|
-
it('is an adapter of the port, built without argument until its transport is written', () => {
|
|
45
|
-
expect(new Remote{{name.pascal}}()).toBeInstanceOf(Remote{{name.pascal}});
|
|
46
|
-
});
|
|
47
|
-
{{/unless}}
|
|
48
42
|
|
|
43
|
+
{{/if}}
|
|
49
44
|
it('refuses to send a call as long as its transport is not written, and names the operation', async () => {
|
|
50
45
|
const adapter = new Unwired{{name.pascal}}();
|
|
51
46
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { Simulated{{name.pascal}} } from '{{alias.context}}/infrastructure/external/simulated-{{name.kebab}}.adapter{{alias.ext}}';
|
|
3
3
|
|
|
4
|
-
describe('
|
|
4
|
+
describe('The simulated {{name.words}}', () => {
|
|
5
5
|
it('is built with nothing from the environment: it reaches nothing outside the process', () => {
|
|
6
6
|
expect(() => new Simulated{{name.pascal}}()).not.toThrow();
|
|
7
7
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
-
import { given } from '@ddd-ts-kit/testing';
|
|
3
2
|
import { {{name.pascal}} } from '{{alias.context}}/domain/aggregates/{{name.kebab}}.aggregate{{alias.ext}}';
|
|
4
3
|
{{#if birth.named}}
|
|
5
4
|
import { {{birth.pascal}} } from '{{alias.context}}/domain/events/{{birth.kebab}}.event{{alias.ext}}';
|
|
@@ -32,14 +31,7 @@ describe('{{name.title}}', () => {
|
|
|
32
31
|
expect(loaded.pullEvents()).toEqual([]);
|
|
33
32
|
});
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
// TODO(domain): replace `toState` by a business method of {{name.pascal}} and `[]` by the facts it records, for example `[{ name: '{{context.kebab}}.{{name.kebab}}.issued' }]`.
|
|
37
|
-
given({{name.article}}{{name.pascal}}())
|
|
38
|
-
.when((subject) => subject.toState())
|
|
39
|
-
.thenEvents([]);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// TODO(domain): replace each entry below by a given / when / then test named after the business rule it proves: a built state, one intention, then the recorded facts (`thenEvents`) or the raised error (`thenError`).
|
|
34
|
+
// TODO(domain): replace each entry below by a given / when / then test (`given` of `@ddd-ts-kit/testing`) named after the business rule it proves: a built state, one intention, then the recorded facts (`thenEvents`) or the raised error (`thenError`).
|
|
43
35
|
{{#unless birth.named}}
|
|
44
36
|
it.todo('records the fact of its birth');
|
|
45
37
|
{{/unless}}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import type { BackgroundJob, Message } from '@ddd-ts-kit/kernel';
|
|
3
3
|
import { InMemoryJobStore, QueueWorker, StoredJobQueue } from '@ddd-ts-kit/scheduling';
|
|
4
|
+
{{#if world.through}}
|
|
5
|
+
import { earlierVersionOf } from '@ddd-ts-kit/testing';
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#unless world.through}}
|
|
4
8
|
import { createTestBuses, earlierVersionOf } from '@ddd-ts-kit/testing';
|
|
9
|
+
{{/unless}}
|
|
5
10
|
import { {{job.command}}Command } from '{{alias.context}}/application/commands/{{job.commandKebab}}/{{job.commandKebab}}.command{{alias.ext}}';
|
|
6
11
|
{{job.specImport}}
|
|
12
|
+
{{#if world.through}}
|
|
13
|
+
{{world.import}}
|
|
14
|
+
{{/if}}
|
|
7
15
|
|
|
8
16
|
describe('{{name.title}}, once enqueued', () => {
|
|
9
17
|
it('sends {{job.commandWords}}{{job.asActor}}', async () => {
|
|
10
|
-
const { jobQueue, worker, sent } = arrange();
|
|
18
|
+
const { jobQueue, worker, sent } = {{world.await}}arrange();
|
|
11
19
|
|
|
12
20
|
{{#if job.hasPayload}}
|
|
13
21
|
const payload: {{name.pascal}}Payload = {
|
|
@@ -30,7 +38,7 @@ describe('{{name.title}}, once enqueued', () => {
|
|
|
30
38
|
});
|
|
31
39
|
|
|
32
40
|
it('never runs a payload enqueued in an earlier shape: the job is dead with INVALID_JOB_PAYLOAD', async () => {
|
|
33
|
-
const { jobQueue, worker, sent } = arrange();
|
|
41
|
+
const { jobQueue, worker, sent } = {{world.await}}arrange();
|
|
34
42
|
const earlierVersion = earlierVersionOf({{name.pascal}}BackgroundJob);
|
|
35
43
|
|
|
36
44
|
await jobQueue.enqueue(earlierVersion, {{job.misfit}});
|
|
@@ -45,9 +53,17 @@ describe('{{name.title}}, once enqueued', () => {
|
|
|
45
53
|
it.todo('resumes from its checkpoint after an interrupted attempt');
|
|
46
54
|
});
|
|
47
55
|
|
|
56
|
+
{{#unless world.through}}
|
|
57
|
+
{{world.comment}}
|
|
58
|
+
{{/unless}}
|
|
48
59
|
/** The queue and its worker in memory, on the clock and the execution scope of the test buses: the job is enqueued as `test-user`. */
|
|
49
|
-
function arrange() {
|
|
60
|
+
{{world.async}}function arrange() {
|
|
61
|
+
{{#if world.through}}
|
|
62
|
+
const { commandBus, clock, ids, executionScope } = await {{world.builder}}();
|
|
63
|
+
{{/if}}
|
|
64
|
+
{{#unless world.through}}
|
|
50
65
|
const { commandBus, clock, ids, executionScope } = createTestBuses();
|
|
66
|
+
{{/unless}}
|
|
51
67
|
const store = new InMemoryJobStore();
|
|
52
68
|
const jobQueue = new StoredJobQueue({ store, clock, ids, scope: executionScope });
|
|
53
69
|
const worker = new QueueWorker({ store, clock, scope: executionScope });
|
|
@@ -1,34 +1,56 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
+
{{#unless job.protected}}
|
|
3
|
+
{{#unless world.through}}
|
|
2
4
|
import { RoleBasedAuthorizer } from '@ddd-ts-kit/auth';
|
|
3
5
|
import { authorizationModule } from '@ddd-ts-kit/auth/di';
|
|
6
|
+
{{/unless}}
|
|
7
|
+
import { anActor } from '@ddd-ts-kit/auth/testing';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
{{#if job.protected}}
|
|
10
|
+
import { authorizationModule } from '@ddd-ts-kit/auth/di';
|
|
11
|
+
import { holdersOf } from '@ddd-ts-kit/auth/testing';
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#unless world.through}}
|
|
4
14
|
{{spec.diPlain}}
|
|
5
15
|
{{spec.contextImports}}
|
|
6
|
-
|
|
16
|
+
{{/unless}}
|
|
17
|
+
import type { Message } from '@ddd-ts-kit/kernel';
|
|
7
18
|
import { earlierVersionOf } from '@ddd-ts-kit/testing';
|
|
19
|
+
{{#unless world.through}}
|
|
8
20
|
import { platformTestModule } from '{{alias.platform}}/composition/platform-test.module{{alias.ext}}';
|
|
21
|
+
{{/unless}}
|
|
9
22
|
{{job.permissionsImport}}
|
|
10
23
|
import { {{job.command}}Command } from '{{alias.context}}/application/commands/{{job.commandKebab}}/{{job.commandKebab}}.command{{alias.ext}}';
|
|
11
24
|
{{job.specImport}}
|
|
25
|
+
{{#if world.through}}
|
|
26
|
+
{{world.import}}
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#if job.protected}}
|
|
12
29
|
|
|
13
|
-
const
|
|
30
|
+
const { holder: enqueuer, authorizer } = holdersOf({{job.granted}});
|
|
31
|
+
const authorization = authorizationModule({ authorizer });
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#unless job.protected}}
|
|
14
34
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
});
|
|
35
|
+
const enqueuer = anActor().build();
|
|
36
|
+
{{#unless world.through}}
|
|
37
|
+
const authorization = authorizationModule({ authorizer: new RoleBasedAuthorizer({ roles: {} }) });
|
|
38
|
+
{{/unless}}
|
|
39
|
+
{{/unless}}
|
|
18
40
|
|
|
19
41
|
describe('{{name.title}}, once enqueued', () => {
|
|
20
42
|
it('sends {{job.commandWords}}{{job.asActor}}', async () => {
|
|
21
|
-
const { application, sent } = {{
|
|
43
|
+
const { application, sent } = {{world.await}}arrange();
|
|
22
44
|
|
|
23
45
|
{{#if job.hasPayload}}
|
|
24
46
|
const payload: {{name.pascal}}Payload = {
|
|
25
47
|
{{job.payloadSample}}
|
|
26
48
|
};
|
|
27
49
|
|
|
28
|
-
await application.as(
|
|
50
|
+
await application.as(enqueuer, () => application.jobQueue.enqueue({{name.pascal}}BackgroundJob, payload));
|
|
29
51
|
{{/if}}
|
|
30
52
|
{{#unless job.hasPayload}}
|
|
31
|
-
await application.as(
|
|
53
|
+
await application.as(enqueuer, () => application.jobQueue.enqueue({{name.pascal}}BackgroundJob, {}));
|
|
32
54
|
{{/unless}}
|
|
33
55
|
|
|
34
56
|
expect(await application.backgroundJobs.runDue()).toMatchObject([{ job: '{{job.name}}', outcome: 'succeeded' }]);
|
|
@@ -36,15 +58,15 @@ describe('{{name.title}}, once enqueued', () => {
|
|
|
36
58
|
expect(sent).toHaveLength(1);
|
|
37
59
|
expect(sent[0]).toBeInstanceOf({{job.command}}Command);
|
|
38
60
|
{{#if job.protected}}
|
|
39
|
-
expect(sent[0]).toMatchObject({ actor: { id:
|
|
61
|
+
expect(sent[0]).toMatchObject({ actor: { id: enqueuer.id } });
|
|
40
62
|
{{/if}}
|
|
41
63
|
});
|
|
42
64
|
|
|
43
65
|
it('never runs a payload enqueued in an earlier shape: the job is dead with INVALID_JOB_PAYLOAD', async () => {
|
|
44
|
-
const { application, sent } = {{
|
|
66
|
+
const { application, sent } = {{world.await}}arrange();
|
|
45
67
|
const earlierVersion = earlierVersionOf({{name.pascal}}BackgroundJob);
|
|
46
68
|
|
|
47
|
-
await application.as(
|
|
69
|
+
await application.as(enqueuer, () => application.jobQueue.enqueue(earlierVersion, {{job.misfit}}));
|
|
48
70
|
|
|
49
71
|
await expect(application.backgroundJobs.runDue()).rejects.toMatchObject({
|
|
50
72
|
code: 'INVALID_JOB_PAYLOAD',
|
|
@@ -60,7 +82,14 @@ describe('{{name.title}}, once enqueued', () => {
|
|
|
60
82
|
it.todo('resumes from its checkpoint after an interrupted attempt');
|
|
61
83
|
});
|
|
62
84
|
|
|
63
|
-
{{
|
|
85
|
+
{{#unless world.through}}
|
|
86
|
+
{{world.comment}}
|
|
87
|
+
{{/unless}}
|
|
88
|
+
{{world.async}}function arrange() {
|
|
89
|
+
{{#if world.through}}
|
|
90
|
+
const { application } = await {{world.builder}}({{world.options}});
|
|
91
|
+
{{/if}}
|
|
92
|
+
{{#unless world.through}}
|
|
64
93
|
{{#if spec.assembles}}
|
|
65
94
|
const context = {{spec.context}};
|
|
66
95
|
|
|
@@ -68,6 +97,7 @@ describe('{{name.title}}, once enqueued', () => {
|
|
|
68
97
|
const application = createTestApplication({
|
|
69
98
|
modules: [{{spec.modules}}],
|
|
70
99
|
});
|
|
100
|
+
{{/unless}}
|
|
71
101
|
|
|
72
102
|
const sent: Message[] = [];
|
|
73
103
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
+
import { anActor } from '@ddd-ts-kit/auth/testing';
|
|
2
3
|
import type { GuardRequest } from '@ddd-ts-kit/http';
|
|
3
|
-
import {
|
|
4
|
+
import { executionContext } from '@ddd-ts-kit/kernel';
|
|
4
5
|
import { {{name.pascal}}Guard } from '{{alias.context}}/presentation/http/guards/{{name.kebab}}.guard{{alias.ext}}';
|
|
5
6
|
|
|
6
|
-
const actor =
|
|
7
|
+
const actor = anActor().build();
|
|
7
8
|
const execution = executionContext({ correlationId: 'correlation-1', actor, origin: 'http' });
|
|
8
9
|
|
|
9
10
|
const request: GuardRequest = {
|
|
@@ -16,10 +17,9 @@ const request: GuardRequest = {
|
|
|
16
17
|
context: { requestId: 'request-1', execution, raw: undefined },
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
describe('{{name.
|
|
20
|
+
describe('Who may pass the {{name.words}} guard', () => {
|
|
20
21
|
it('refuses a caller with 403', () => {
|
|
21
22
|
expect(() => new {{name.pascal}}Guard().check(request)).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }));
|
|
22
|
-
expect(anonymousActor().type).toBe('anonymous');
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// TODO(domain): replace the test above by one per decision of the guard.
|
|
@@ -2,8 +2,8 @@ import { describe, expect, it } from '{{tests.module}}';
|
|
|
2
2
|
import { {{name.pascal}}Service } from '{{alias.context}}/domain/services/{{name.kebab}}.service{{alias.ext}}';
|
|
3
3
|
|
|
4
4
|
describe('{{name.title}}', () => {
|
|
5
|
-
it('is built
|
|
6
|
-
expect(
|
|
5
|
+
it('takes nothing when it is built: it decides from what it is given, with no port and no store', () => {
|
|
6
|
+
expect({{name.pascal}}Service).toHaveLength(0);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// TODO(domain): replace each entry below by a test named after the business decision {{name.pascal}}Service makes, given aggregates built with the builders of test/builders.
|
|
@@ -9,7 +9,9 @@ paths:
|
|
|
9
9
|
- Imports `domain/`, `application/`, published languages, `@ddd-ts-kit/kernel` and `@ddd-ts-kit/auth` only (`layer/application-inward`): never `infrastructure/`, `presentation/`, a framework or a driver. A background job, and no other file here, also imports `@ddd-ts-kit/validation` and the validation library of the stack, for the schema of its payload.
|
|
10
10
|
- One use case per folder, `commands/<use-case>/` or `queries/<use-case>/`: the message, its handler, a `*.result.ts` when the answer has a shape of its own. The handler has one public method, `execute` (`application/handler-shape`): it loads or builds, calls ONE intention method, `await repository.save(aggregate)`, and returns at most an identifier. Each binding is named after the concept it holds, `const invoice = await this.invoiceRepository.findById(command.invoiceId)`, `for (const reminder of dueReminders)`, never `target`, `data` or `item` (`naming/business-name`).
|
|
11
11
|
- Events leave with the save: never `pullEvents()`, never a `DomainEventDispatcher` here (`domain-events/dispatched-on-save`). A reaction is a class of `event-handlers/` or a publisher of `integration/publishers/`. It runs at the end of the unit of work, before the commit, and depends only on what the transaction covers (`domain-events/transactional-before-commit`): repositories, the integration event publisher, the command bus. An effect outside the database is a handler of the `after-commit` phase (`generate event-handler ... --phase after-commit`: at most once, never saves, sends a command) or, when it must not be lost, the handler of an integration event.
|
|
12
|
+
{{#if eventSourcing.on}}
|
|
12
13
|
- Nothing here reads the event store: an event-sourced aggregate is loaded and saved through its repository port like any other (`event-sourcing/store-behind-repository`). A projection writes its read model and never a stream (`event-sourcing/projection-never-appends`); one fed by the store is declared `@Projection(name, { feed: 'event-store' })`.
|
|
14
|
+
{{/if}}
|
|
13
15
|
{{#if style.declared}}
|
|
14
16
|
- Every command and query carries `@Requires(permission)` or `@Public()` (`authz/declared`), and the actor is in the message (`authz/actor-explicit`). Permissions live in `<context>.permissions.ts` at the root of the context, rules that need loaded state in `application/authorization/*.policy.ts`.{{#if authz.rbac}} A role holds each permission by name in the roles of the platform (`--grant <role>` when generating it): the super-admin `*` alone refuses everybody else (`authz/granted`).{{/if}}
|
|
15
17
|
- The decorator is the registration (`declarations/role-declared`): `@CommandHandler(Message)`, `@QueryHandler(Message)`, `@DomainEventHandler(Event)` (the name is the static `eventName` of the event class), `@IntegrationEventHandler(definition, { consumer })`, `@Scheduled('<context>.<job>', schedule)`, `@Background(options)` (the name is the static `jobName`), `@Projection('<context>.<name>')`, `@Policy(permission, { name })`. Names are string literals.
|
|
@@ -34,7 +34,9 @@ paths:
|
|
|
34
34
|
- A value object returns its refusals in the `Result` of `create`{{#if refusals.named}}: `err(InvalidEmail.forAddress(raw))`{{/if}}{{#if refusals.factories}}: `err(PersonError.invalidEmail(raw))`{{/if}}; the caller unwraps it with `unwrap(..)` of the kernel. `npx ddd-ts-kit value-objects` moves the project to factories that throw.
|
|
35
35
|
{{/if}}
|
|
36
36
|
- Domain events are named in the past tense, `<context>.<aggregate>.<fact>` (`events/name-format`), declared once on the class, `static readonly eventName`, which `readonly name` reads (`events/name-declared-once`), and recorded by the aggregate (`this.record(...)`). They leave with the save: nothing here dispatches them.
|
|
37
|
+
{{#if eventSourcing.on}}
|
|
37
38
|
- An aggregate whose history is the business can be event-sourced, chosen per aggregate (`generate aggregate <context> <Name> --event-sourced`): it extends `EventSourcedAggregate`, a command checks the invariants then `this.record(...)`, and only its `apply<Fact>` methods (and `restore`, for a snapshot) change the state (`event-sourcing/state-in-apply`). Its events are named in the past tense (`event-sourcing/past-tense`). The other aggregates keep their state in tables.
|
|
39
|
+
{{/if}}
|
|
38
40
|
- A repository here is a port: an abstract class extending the kernel `Repository<Aggregate>`, abstract members only (`ports/abstract-class`). A domain service is stateless.
|
|
39
41
|
- Time and identifiers come in as parameters (`purity/*`); nothing here knows the acting user or its rights (`authz/in-application`).
|
|
40
42
|
- One concept per file, with the suffix of its role: `.aggregate.ts`, `.entity.ts`, `.vo.ts`, `.vocabulary.ts`, `.event.ts`, `.error.ts`, `.repository.ts`, `.service.ts` (`naming/suffix`, `naming/one-concept-per-file`).
|
|
@@ -31,7 +31,9 @@ paths:
|
|
|
31
31
|
- Retry, timeout and cache go on the binding (`ownPolicy(retry(...), timeout(...))`) or, when the policy is part of what the adapter is, as decorators of `@ddd-ts-kit/aspects/decorators` (`aspects/outside-in`). Kinds `external` and `gateway` get the default policy of the platform otherwise. `ownPolicy` is the helper of `{{alias.platform}}/resilience/own-policy{{alias.ext}}`, which `generate adapter` writes when the platform does not have it yet.
|
|
32
32
|
{{/if}}
|
|
33
33
|
- A repository only persists: no `pullEvents()`, no dispatcher (`domain-events/dispatched-on-save`). A removal that announces an event takes the aggregate, not its id.
|
|
34
|
+
{{#if eventSourcing.on}}
|
|
34
35
|
- The repository adapter of an event-sourced aggregate delegates to `EventSourcedRepository` of the kernel. Its stored events are declared in `persistence/<aggregate>-events.mapper.ts` with `defineStoredEvent` and a named type of their data; a change of that type is a new version with its upcaster, never an edit (`event-sourcing/upcaster-required`, against `stored-events.lock.json`, which `ddd-ts-kit docs --stored-events` writes once the shape of a version is final; `docs --check` fails while a version is unrecorded). Every named type the data reaches is declared in the codec file too.
|
|
36
|
+
{{/if}}
|
|
35
37
|
- Infrastructure faults are plain errors (a 5xx, reported from outside); business refusals are `DomainError`s raised by the domain.
|
|
36
38
|
- Every adapter passes the contract suite of the fake of its port (`test/integration/*.contract.spec.ts`).
|
|
37
39
|
- Method: `/ddd-ts-kit:persistence`. Create with `npx ddd-ts-kit generate repository|adapter|gateway|acl ... --json`.
|
|
@@ -3,6 +3,10 @@ min_version: 2.0.0
|
|
|
3
3
|
# without its dependencies fails the commit instead of skipping the checks.
|
|
4
4
|
lefthook: node_modules/.bin/lefthook
|
|
5
5
|
|
|
6
|
+
# A hook that passes says nothing: a job prints its output only when it fails.
|
|
7
|
+
output:
|
|
8
|
+
- failure
|
|
9
|
+
|
|
6
10
|
pre-commit:
|
|
7
11
|
parallel: true
|
|
8
12
|
jobs:
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.6.2",
|
|
24
24
|
"@commitlint/cli": "^21.2.3",
|
|
25
25
|
"@commitlint/config-conventional": "^21.2.3",
|
|
26
|
-
"@ddd-ts-kit/eslint-plugin": "^0.
|
|
26
|
+
"@ddd-ts-kit/eslint-plugin": "^0.105.0",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "^5.0.3",
|
|
@@ -20,6 +20,8 @@ const UNIT_PROJECT: TestProjectInlineConfiguration = {
|
|
|
20
20
|
name: 'unit',
|
|
21
21
|
include: ['{{config.sourceRoot}}/**/*.spec.ts', 'test/architecture/**/*.spec.ts'],
|
|
22
22
|
exclude: [INTEGRATION_SPECS, ...NOT_AFFECTED],
|
|
23
|
+
// The unit specs share no state: each worker runs them in one module graph, the declarations of a context evaluated once rather than once per spec file. `isolate: true` gives each file its own graph again.
|
|
24
|
+
isolate: false,
|
|
23
25
|
},
|
|
24
26
|
};
|
|
25
27
|
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
2
|
import { InMemoryProcessStore, type BackgroundJob } from '@ddd-ts-kit/kernel';
|
|
3
3
|
import { InMemoryJobStore, QueueWorker, StoredJobQueue, StoredProcessRunner } from '@ddd-ts-kit/scheduling';
|
|
4
|
+
{{#unless world.through}}
|
|
4
5
|
import { createTestBuses } from '@ddd-ts-kit/testing';
|
|
6
|
+
{{/unless}}
|
|
5
7
|
import { {{name.pascal}}TimeoutBackgroundJob } from '{{alias.context}}/application/background/{{name.kebab}}-timeout.background-job{{alias.ext}}';
|
|
6
8
|
import { {{name.pascal}}Process } from '{{alias.context}}/application/processes/{{name.kebab}}.process{{alias.ext}}';
|
|
9
|
+
{{#if world.through}}
|
|
10
|
+
{{world.import}}
|
|
11
|
+
{{/if}}
|
|
7
12
|
|
|
8
13
|
const HOUR = 3_600_000;
|
|
9
14
|
|
|
10
15
|
describe('The timeout of {{name.words}}, when its job runs', () => {
|
|
11
16
|
it('runs the step of the deadline once it is due, and not before', async () => {
|
|
12
|
-
const { clock, processes, runner, worker } = arrange();
|
|
17
|
+
const { clock, processes, runner, worker } = {{world.await}}arrange();
|
|
13
18
|
const deadline = new Date(clock.now().getTime() + HOUR);
|
|
14
19
|
const process = new {{name.pascal}}Process();
|
|
15
20
|
const id = '{{name.kebab}}-1';
|
|
@@ -26,9 +31,17 @@ describe('The timeout of {{name.words}}, when its job runs', () => {
|
|
|
26
31
|
});
|
|
27
32
|
});
|
|
28
33
|
|
|
34
|
+
{{#unless world.through}}
|
|
35
|
+
{{world.comment}}
|
|
36
|
+
{{/unless}}
|
|
29
37
|
/** The runner, the queue of its timeouts and the worker in memory, on the clock, the buses and the unit of work of the test buses. */
|
|
30
|
-
function arrange() {
|
|
38
|
+
{{world.async}}function arrange() {
|
|
39
|
+
{{#if world.through}}
|
|
40
|
+
const { commandBus, clock, ids, executionScope, unitOfWork } = await {{world.builder}}();
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#unless world.through}}
|
|
31
43
|
const { commandBus, clock, ids, executionScope, unitOfWork } = createTestBuses();
|
|
44
|
+
{{/unless}}
|
|
32
45
|
const store = new InMemoryJobStore();
|
|
33
46
|
const processes = new InMemoryProcessStore();
|
|
34
47
|
const jobQueue = new StoredJobQueue({ store, clock, ids, scope: executionScope });
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
+
{{#unless world.through}}
|
|
2
3
|
import { RoleBasedAuthorizer } from '@ddd-ts-kit/auth';
|
|
3
4
|
import { authorizationModule } from '@ddd-ts-kit/auth/di';
|
|
4
5
|
{{spec.diPlain}}
|
|
5
6
|
{{spec.contextImports}}
|
|
7
|
+
{{/unless}}
|
|
6
8
|
import { ProcessRunner } from '@ddd-ts-kit/kernel';
|
|
9
|
+
{{#unless world.through}}
|
|
7
10
|
import { platformTestModule } from '{{alias.platform}}/composition/platform-test.module{{alias.ext}}';
|
|
11
|
+
{{/unless}}
|
|
8
12
|
import { {{name.pascal}}Process } from '{{alias.context}}/application/processes/{{name.kebab}}.process{{alias.ext}}';
|
|
13
|
+
{{#if world.through}}
|
|
14
|
+
{{world.import}}
|
|
15
|
+
{{/if}}
|
|
9
16
|
|
|
10
17
|
const HOUR = 3_600_000;
|
|
18
|
+
{{#unless world.through}}
|
|
11
19
|
|
|
12
20
|
const authorization = authorizationModule({ authorizer: new RoleBasedAuthorizer({ roles: {} }) });
|
|
21
|
+
{{/unless}}
|
|
13
22
|
|
|
14
23
|
describe('The timeout of {{name.words}}, when its job runs', () => {
|
|
15
24
|
it('runs the step of the deadline once it is due, and not before', async () => {
|
|
16
|
-
const application = {{
|
|
25
|
+
const application = {{world.await}}arrange();
|
|
17
26
|
const deadline = new Date(application.clock.now().getTime() + HOUR);
|
|
18
27
|
const process = new {{name.pascal}}Process();
|
|
19
28
|
const id = '{{name.kebab}}-1';
|
|
@@ -32,7 +41,16 @@ describe('The timeout of {{name.words}}, when its job runs', () => {
|
|
|
32
41
|
});
|
|
33
42
|
});
|
|
34
43
|
|
|
35
|
-
{{
|
|
44
|
+
{{#unless world.through}}
|
|
45
|
+
{{world.comment}}
|
|
46
|
+
{{/unless}}
|
|
47
|
+
{{world.async}}function arrange() {
|
|
48
|
+
{{#if world.through}}
|
|
49
|
+
const { application } = await {{world.builder}}();
|
|
50
|
+
|
|
51
|
+
return application;
|
|
52
|
+
{{/if}}
|
|
53
|
+
{{#unless world.through}}
|
|
36
54
|
{{#if spec.assembles}}
|
|
37
55
|
const context = {{spec.context}};
|
|
38
56
|
|
|
@@ -40,4 +58,5 @@ describe('The timeout of {{name.words}}, when its job runs', () => {
|
|
|
40
58
|
return createTestApplication({
|
|
41
59
|
modules: [{{spec.modules}}],
|
|
42
60
|
});
|
|
61
|
+
{{/unless}}
|
|
43
62
|
}
|
|
@@ -6,7 +6,7 @@ import { Fake{{name.pascal}}Reader } from '{{alias.context}}/test/fakes/{{name.k
|
|
|
6
6
|
const LINES = [{ id: '{{name.kebab}}-1' }, { id: '{{name.kebab}}-2' }, { id: '{{name.kebab}}-3' }];
|
|
7
7
|
const [first, second, third] = LINES;
|
|
8
8
|
|
|
9
|
-
describe('
|
|
9
|
+
describe('The reader of {{name.words}}', () => {
|
|
10
10
|
it('shows only what the access scope covers: everything, nothing, some identifiers, a filter', async () => {
|
|
11
11
|
const reader = new Fake{{name.pascal}}Reader(LINES);
|
|
12
12
|
const some = await reader.search({ kind: 'ids', ids: ['{{name.kebab}}-2'] }, offsetPage());
|
|
@@ -12,7 +12,7 @@ export const {{aggregate.pascal}}Mapper = {
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
toRow(saved: {{aggregate.pascal}}): {{aggregate.pascal}}Columns {
|
|
15
|
-
// TODO(domain): flatten each value object of {{aggregate.pascal}}State into its columns; nothing of the row type leaves this file.
|
|
15
|
+
// TODO(domain): flatten each value object of {{aggregate.pascal}}State into its columns; nothing of the row type leaves this file. A `jsonb` column holding an array or a string takes `JSON.stringify(value)` on Knex, where the other ORM serialize it.
|
|
16
16
|
{{#if personal.any}}
|
|
17
17
|
return {
|
|
18
18
|
id: saved.id,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
-
{{#if valueObjects.throwing}}
|
|
3
2
|
import { expectRefusal } from '@ddd-ts-kit/testing';
|
|
4
|
-
{{/if}}
|
|
5
3
|
{{#if valueObjects.result}}
|
|
6
4
|
import { unwrap } from '@ddd-ts-kit/kernel';
|
|
7
5
|
{{/if}}
|
|
@@ -27,9 +25,7 @@ describe('{{name.title}}', () => {
|
|
|
27
25
|
expectRefusal(() => {{name.pascal}}.create(' '), 'INVARIANT_VIOLATION');
|
|
28
26
|
{{/if}}
|
|
29
27
|
{{#if valueObjects.result}}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
expect(result.ok).toBe(false);
|
|
28
|
+
expectRefusal({{name.pascal}}.create(' '), 'INVARIANT_VIOLATION');
|
|
33
29
|
{{/if}}
|
|
34
30
|
});
|
|
35
31
|
|