ddd-ts-kit 0.86.0 → 0.88.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 +43 -0
- package/README.fr.md +38 -39
- package/README.md +38 -37
- package/dist/check/canonical/earlier-context-file.d.ts +15 -0
- package/dist/check/canonical/earlier-context-file.d.ts.map +1 -0
- package/dist/check/canonical/earlier-context-file.js +33 -0
- package/dist/check/canonical/earlier-context-file.js.map +1 -0
- package/dist/check/canonical/stray-entry.d.ts.map +1 -1
- package/dist/check/canonical/stray-entry.js +11 -9
- package/dist/check/canonical/stray-entry.js.map +1 -1
- package/dist/check/configuration/module-problems.js +2 -2
- package/dist/check/configuration/module-problems.js.map +1 -1
- package/dist/check/errors/code-list.d.ts +1 -1
- package/dist/check/errors/code-list.d.ts.map +1 -1
- package/dist/check/errors/is-codes-file.d.ts +1 -1
- package/dist/check/errors/is-codes-file.d.ts.map +1 -1
- package/dist/check/errors/is-codes-file.js +1 -1
- package/dist/check/errors/is-codes-file.js.map +1 -1
- package/dist/check/explain/errors-docs.js +5 -5
- package/dist/check/explain/errors-docs.js.map +1 -1
- package/dist/check/explain/language-docs.js +1 -1
- package/dist/check/explain/language-docs.js.map +1 -1
- package/dist/check/explain/layout-docs.js +1 -1
- package/dist/check/explain/layout-docs.js.map +1 -1
- package/dist/check/explain/module-docs.d.ts.map +1 -1
- package/dist/check/explain/module-docs.js +16 -12
- package/dist/check/explain/module-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.d.ts.map +1 -1
- package/dist/check/explain/wiring-docs.js +8 -7
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/authz-granted-fixtures.js +2 -2
- package/dist/check/fixtures/authz-granted-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +3 -3
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js +4 -4
- package/dist/check/fixtures/authz-scope-narrows-fixtures.js.map +1 -1
- package/dist/check/fixtures/constructor-injection-fixtures.js +6 -6
- package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -1
- package/dist/check/fixtures/context-file-fixtures.d.ts +4 -0
- package/dist/check/fixtures/context-file-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/context-file-fixtures.js +36 -0
- package/dist/check/fixtures/context-file-fixtures.js.map +1 -0
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +15 -36
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/declared-declarations.d.ts +4 -2
- package/dist/check/fixtures/declared-declarations.d.ts.map +1 -1
- package/dist/check/fixtures/declared-declarations.js +9 -3
- package/dist/check/fixtures/declared-declarations.js.map +1 -1
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts +4 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.js +48 -0
- package/dist/check/fixtures/earlier-declarations-fixtures.js.map +1 -0
- 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/module-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/module-fixtures.js +50 -17
- package/dist/check/fixtures/module-fixtures.js.map +1 -1
- package/dist/check/fixtures/named-refusal-fixtures.js +5 -5
- package/dist/check/fixtures/named-refusal-fixtures.js.map +1 -1
- package/dist/check/fixtures/paths.d.ts +1 -1
- package/dist/check/fixtures/paths.js +1 -1
- package/dist/check/fixtures/paths.js.map +1 -1
- package/dist/check/fixtures/vocabulary-fixtures.js +2 -2
- package/dist/check/fixtures/vocabulary-fixtures.js.map +1 -1
- package/dist/check/project/locate.d.ts.map +1 -1
- package/dist/check/project/locate.js +18 -9
- package/dist/check/project/locate.js.map +1 -1
- package/dist/check/rules/declarations-barrel-current.js +16 -11
- package/dist/check/rules/declarations-barrel-current.js.map +1 -1
- package/dist/check/rules/errors-code-listed.js +6 -8
- package/dist/check/rules/errors-code-listed.js.map +1 -1
- package/dist/check/rules/errors-code-unique.js +2 -2
- package/dist/check/rules/errors-code-unique.js.map +1 -1
- package/dist/check/rules/errors-known-code.js +2 -2
- package/dist/check/rules/errors-known-code.js.map +1 -1
- package/dist/check/rules/language-glossary-term.js +1 -1
- package/dist/check/rules/language-glossary-term.js.map +1 -1
- package/dist/check/rules/module-complete.d.ts.map +1 -1
- package/dist/check/rules/module-complete.js +67 -13
- package/dist/check/rules/module-complete.js.map +1 -1
- package/dist/check/rules/naming-suffix.d.ts.map +1 -1
- package/dist/check/rules/naming-suffix.js +12 -9
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/check/rules/tree-closed.d.ts.map +1 -1
- package/dist/check/rules/tree-closed.js +8 -1
- package/dist/check/rules/tree-closed.js.map +1 -1
- package/dist/check/support/is-generated-context-file.d.ts +1 -1
- package/dist/check/support/is-generated-context-file.js +1 -1
- package/dist/check/support/path-in-context.d.ts +5 -1
- package/dist/check/support/path-in-context.d.ts.map +1 -1
- package/dist/check/support/path-in-context.js +12 -3
- package/dist/check/support/path-in-context.js.map +1 -1
- package/dist/commands/context-layout.d.ts +4 -0
- package/dist/commands/context-layout.d.ts.map +1 -0
- package/dist/commands/context-layout.js +48 -0
- package/dist/commands/context-layout.js.map +1 -0
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +14 -9
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/generate.js +2 -2
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/move-to-module.d.ts.map +1 -1
- package/dist/commands/move-to-module.js +2 -0
- package/dist/commands/move-to-module.js.map +1 -1
- package/dist/config/stack.d.ts +1 -1
- package/dist/context-files/context-file-at.d.ts +7 -0
- package/dist/context-files/context-file-at.d.ts.map +1 -0
- package/dist/context-files/context-file-at.js +9 -0
- package/dist/context-files/context-file-at.js.map +1 -0
- package/dist/context-files/context-file-placement.d.ts +8 -0
- package/dist/context-files/context-file-placement.d.ts.map +1 -0
- package/dist/context-files/context-file-placement.js +23 -0
- package/dist/context-files/context-file-placement.js.map +1 -0
- package/dist/context-files/context-file.d.ts +16 -0
- package/dist/context-files/context-file.d.ts.map +1 -0
- package/dist/context-files/context-file.js +12 -0
- package/dist/context-files/context-file.js.map +1 -0
- package/dist/context-files/earlier-place-of.d.ts +7 -0
- package/dist/context-files/earlier-place-of.d.ts.map +1 -0
- package/dist/context-files/earlier-place-of.js +10 -0
- package/dist/context-files/earlier-place-of.js.map +1 -0
- package/dist/context-files/index.d.ts +5 -0
- package/dist/context-files/index.d.ts.map +1 -0
- package/dist/context-files/index.js +5 -0
- package/dist/context-files/index.js.map +1 -0
- package/dist/context-layout/context-layout.d.ts +19 -0
- package/dist/context-layout/context-layout.d.ts.map +1 -0
- package/dist/context-layout/context-layout.js +55 -0
- package/dist/context-layout/context-layout.js.map +1 -0
- package/dist/context-layout/index.d.ts +2 -0
- package/dist/context-layout/index.d.ts.map +1 -0
- package/dist/context-layout/index.js +2 -0
- package/dist/context-layout/index.js.map +1 -0
- package/dist/context-layout/module-moves.d.ts +21 -0
- package/dist/context-layout/module-moves.d.ts.map +1 -0
- package/dist/context-layout/module-moves.js +146 -0
- package/dist/context-layout/module-moves.js.map +1 -0
- package/dist/controllers/migrate-context.js +20 -15
- package/dist/controllers/migrate-context.js.map +1 -1
- package/dist/controllers/plan-context.d.ts +5 -1
- package/dist/controllers/plan-context.d.ts.map +1 -1
- package/dist/controllers/plan-context.js +19 -5
- package/dist/controllers/plan-context.js.map +1 -1
- package/dist/declared/barrel-file.d.ts +1 -1
- package/dist/declared/barrel-file.js +1 -1
- package/dist/declared/context-declarations.d.ts +4 -2
- package/dist/declared/context-declarations.d.ts.map +1 -1
- package/dist/declared/context-declarations.js +4 -2
- package/dist/declared/context-declarations.js.map +1 -1
- package/dist/declared/declarations-folder-of.d.ts +12 -7
- package/dist/declared/declarations-folder-of.d.ts.map +1 -1
- package/dist/declared/declarations-folder-of.js +15 -11
- package/dist/declared/declarations-folder-of.js.map +1 -1
- package/dist/declared/earlier-layout-notice.d.ts +10 -0
- package/dist/declared/earlier-layout-notice.d.ts.map +1 -0
- package/dist/declared/earlier-layout-notice.js +12 -0
- package/dist/declared/earlier-layout-notice.js.map +1 -0
- package/dist/declared/earlier-layout-of.d.ts +10 -0
- package/dist/declared/earlier-layout-of.d.ts.map +1 -0
- package/dist/declared/earlier-layout-of.js +16 -0
- package/dist/declared/earlier-layout-of.js.map +1 -0
- package/dist/declared/earlier-shape-of.d.ts +13 -0
- package/dist/declared/earlier-shape-of.d.ts.map +1 -0
- package/dist/declared/earlier-shape-of.js +35 -0
- package/dist/declared/earlier-shape-of.js.map +1 -0
- package/dist/declared/folder-declarations-file.d.ts +6 -4
- package/dist/declared/folder-declarations-file.d.ts.map +1 -1
- package/dist/declared/folder-declarations-file.js +7 -5
- package/dist/declared/folder-declarations-file.js.map +1 -1
- package/dist/declared/index.d.ts +3 -2
- package/dist/declared/index.d.ts.map +1 -1
- package/dist/declared/index.js +3 -2
- package/dist/declared/index.js.map +1 -1
- package/dist/declared/is-declarations-file.d.ts +3 -2
- package/dist/declared/is-declarations-file.d.ts.map +1 -1
- package/dist/declared/is-declarations-file.js +9 -9
- package/dist/declared/is-declarations-file.js.map +1 -1
- package/dist/declared/keeps-role-folder-files.d.ts +12 -0
- package/dist/declared/keeps-role-folder-files.d.ts.map +1 -0
- package/dist/declared/keeps-role-folder-files.js +25 -0
- package/dist/declared/keeps-role-folder-files.js.map +1 -0
- package/dist/declared/keeps-single-file.d.ts +1 -1
- package/dist/declared/keeps-single-file.js +1 -1
- package/dist/declared/render-declarations.d.ts +7 -3
- package/dist/declared/render-declarations.d.ts.map +1 -1
- package/dist/declared/render-declarations.js +5 -3
- package/dist/declared/render-declarations.js.map +1 -1
- package/dist/declared/render-folder-declarations.d.ts +2 -2
- package/dist/declared/same-files.d.ts +3 -0
- package/dist/declared/same-files.d.ts.map +1 -0
- package/dist/declared/same-files.js +5 -0
- package/dist/declared/same-files.js.map +1 -0
- package/dist/depcruise/layer-rules.js +21 -7
- package/dist/depcruise/layer-rules.js.map +1 -1
- package/dist/describe/read-adapters.d.ts.map +1 -1
- package/dist/describe/read-adapters.js +6 -4
- package/dist/describe/read-adapters.js.map +1 -1
- package/dist/describe/read-controllers.d.ts.map +1 -1
- package/dist/describe/read-controllers.js +5 -3
- package/dist/describe/read-controllers.js.map +1 -1
- package/dist/describe/read-errors.d.ts +1 -1
- package/dist/describe/read-errors.d.ts.map +1 -1
- package/dist/describe/read-errors.js +5 -3
- package/dist/describe/read-errors.js.map +1 -1
- package/dist/describe/read-routes.d.ts.map +1 -1
- package/dist/describe/read-routes.js +5 -5
- package/dist/describe/read-routes.js.map +1 -1
- package/dist/dev/refresh-declarations.d.ts.map +1 -1
- package/dist/dev/refresh-declarations.js +1 -1
- package/dist/dev/refresh-declarations.js.map +1 -1
- package/dist/docs/context-facts.d.ts +1 -1
- package/dist/docs/context-facts.d.ts.map +1 -1
- package/dist/docs/read-context.d.ts.map +1 -1
- package/dist/docs/read-context.js +2 -1
- package/dist/docs/read-context.js.map +1 -1
- package/dist/docs/refresh-context-doc.js +1 -1
- package/dist/docs/refresh-context-doc.js.map +1 -1
- package/dist/docs/state-machine-lines.d.ts +1 -1
- package/dist/docs/state-machine-lines.d.ts.map +1 -1
- package/dist/docs/state-machine-lines.js +6 -2
- package/dist/docs/state-machine-lines.js.map +1 -1
- package/dist/docs/write-docs.d.ts +3 -3
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +3 -3
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/file-moves/file-move.d.ts +6 -0
- package/dist/file-moves/file-move.d.ts.map +1 -0
- package/dist/file-moves/file-move.js +2 -0
- package/dist/file-moves/file-move.js.map +1 -0
- package/dist/file-moves/index.d.ts +3 -0
- package/dist/file-moves/index.d.ts.map +1 -0
- package/dist/file-moves/index.js +2 -0
- package/dist/file-moves/index.js.map +1 -0
- package/dist/file-moves/move-files.d.ts +15 -0
- package/dist/file-moves/move-files.d.ts.map +1 -0
- package/dist/file-moves/move-files.js +37 -0
- package/dist/file-moves/move-files.js.map +1 -0
- package/dist/generate/errors/codes-list.d.ts +1 -1
- package/dist/generate/errors/codes-list.d.ts.map +1 -1
- package/dist/generate/errors/write-named-refusal.d.ts +1 -1
- package/dist/generate/errors/write-named-refusal.d.ts.map +1 -1
- package/dist/generate/errors/write-named-refusal.js +3 -2
- package/dist/generate/errors/write-named-refusal.js.map +1 -1
- package/dist/generate/kind.d.ts +1 -1
- 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 +22 -2
- package/dist/generate/kinds/adapter-kind.js.map +1 -1
- package/dist/generate/kinds/error-kind.js +1 -1
- package/dist/generate/kinds/error-kind.js.map +1 -1
- package/dist/generate/kinds/module-kind.js +1 -1
- package/dist/generate/kinds/module-kind.js.map +1 -1
- package/dist/generate/kinds/port-kind.d.ts.map +1 -1
- package/dist/generate/kinds/port-kind.js +3 -1
- package/dist/generate/kinds/port-kind.js.map +1 -1
- package/dist/generate/kinds/presentation/controller-of.d.ts +1 -1
- package/dist/generate/kinds/presentation/controller-of.d.ts.map +1 -1
- package/dist/generate/kinds/presentation/controller-of.js +7 -5
- package/dist/generate/kinds/presentation/controller-of.js.map +1 -1
- package/dist/generate/permissions-file.d.ts +4 -1
- package/dist/generate/permissions-file.d.ts.map +1 -1
- package/dist/generate/permissions-file.js +6 -2
- package/dist/generate/permissions-file.js.map +1 -1
- package/dist/generate/place-context-files.d.ts +9 -0
- package/dist/generate/place-context-files.d.ts.map +1 -0
- package/dist/generate/place-context-files.js +14 -0
- package/dist/generate/place-context-files.js.map +1 -0
- package/dist/generate/place-generated-files.d.ts +18 -0
- package/dist/generate/place-generated-files.d.ts.map +1 -0
- package/dist/generate/{place-in-modules.js → place-generated-files.js} +42 -17
- package/dist/generate/place-generated-files.js.map +1 -0
- package/dist/generate/refresh-barrels.d.ts +17 -11
- package/dist/generate/refresh-barrels.d.ts.map +1 -1
- package/dist/generate/refresh-barrels.js +32 -26
- package/dist/generate/refresh-barrels.js.map +1 -1
- package/dist/generate/refresh-docs.d.ts +2 -2
- package/dist/generate/refresh-docs.d.ts.map +1 -1
- package/dist/generate/refresh-docs.js +6 -3
- package/dist/generate/refresh-docs.js.map +1 -1
- package/dist/generate/refuse-earlier-layout.d.ts +9 -0
- package/dist/generate/refuse-earlier-layout.d.ts.map +1 -0
- package/dist/generate/refuse-earlier-layout.js +15 -0
- package/dist/generate/refuse-earlier-layout.js.map +1 -0
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +24 -9
- package/dist/help/notes.js.map +1 -1
- package/dist/help/usage.d.ts +1 -1
- package/dist/help/usage.d.ts.map +1 -1
- package/dist/help/usage.js +1 -0
- package/dist/help/usage.js.map +1 -1
- 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 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/knip/ignore-code-types-where-they-are.d.ts +11 -0
- package/dist/knip/ignore-code-types-where-they-are.d.ts.map +1 -0
- package/dist/knip/ignore-code-types-where-they-are.js +56 -0
- package/dist/knip/ignore-code-types-where-they-are.js.map +1 -0
- package/dist/knip/index.d.ts +2 -0
- package/dist/knip/index.d.ts.map +1 -0
- package/dist/knip/index.js +2 -0
- package/dist/knip/index.js.map +1 -0
- package/dist/model-modules/index.d.ts +1 -1
- package/dist/model-modules/index.d.ts.map +1 -1
- package/dist/model-modules/index.js +1 -1
- package/dist/model-modules/index.js.map +1 -1
- package/dist/model-modules/into-module.d.ts +5 -1
- package/dist/model-modules/into-module.d.ts.map +1 -1
- package/dist/model-modules/into-module.js +12 -5
- package/dist/model-modules/into-module.js.map +1 -1
- package/dist/model-modules/is-context-level.d.ts +5 -3
- package/dist/model-modules/is-context-level.d.ts.map +1 -1
- package/dist/model-modules/is-context-level.js +17 -4
- package/dist/model-modules/is-context-level.js.map +1 -1
- package/dist/model-modules/module-layers.d.ts +7 -1
- package/dist/model-modules/module-layers.d.ts.map +1 -1
- package/dist/model-modules/module-layers.js +8 -2
- package/dist/model-modules/module-layers.js.map +1 -1
- package/dist/model-modules/module-name-flaw.d.ts +2 -2
- package/dist/model-modules/module-name-flaw.js +4 -4
- package/dist/model-modules/module-name-flaw.js.map +1 -1
- package/dist/model-modules/module-placement.d.ts +5 -1
- package/dist/model-modules/module-placement.d.ts.map +1 -1
- package/dist/model-modules/module-placement.js +47 -18
- package/dist/model-modules/module-placement.js.map +1 -1
- package/dist/model-modules/module-split.d.ts +9 -5
- package/dist/model-modules/module-split.d.ts.map +1 -1
- package/dist/model-modules/module-split.js +30 -13
- package/dist/model-modules/module-split.js.map +1 -1
- package/dist/model-modules/role-directories-of.d.ts.map +1 -1
- package/dist/model-modules/role-directories-of.js +6 -1
- package/dist/model-modules/role-directories-of.js.map +1 -1
- package/dist/model-modules/role-folders-of.d.ts +1 -1
- package/dist/model-modules/role-folders-of.d.ts.map +1 -1
- package/dist/model-modules/role-folders-of.js +15 -5
- package/dist/model-modules/role-folders-of.js.map +1 -1
- package/dist/model-modules/role-folders.d.ts +2 -2
- package/dist/model-modules/role-folders.js +2 -2
- package/dist/move-to-module/module-move.d.ts +2 -4
- package/dist/move-to-module/module-move.d.ts.map +1 -1
- package/dist/move-to-module/move-to-module.d.ts +2 -6
- package/dist/move-to-module/move-to-module.d.ts.map +1 -1
- package/dist/move-to-module/move-to-module.js +2 -31
- package/dist/move-to-module/move-to-module.js.map +1 -1
- package/dist/move-to-module/moves-into-module.d.ts +1 -1
- package/dist/move-to-module/moves-into-module.d.ts.map +1 -1
- package/dist/move-to-module/moves-into-module.js +25 -6
- package/dist/move-to-module/moves-into-module.js.map +1 -1
- package/dist/refusals/code-types-pattern.d.ts +4 -0
- package/dist/refusals/code-types-pattern.d.ts.map +1 -0
- package/dist/refusals/code-types-pattern.js +6 -0
- package/dist/refusals/code-types-pattern.js.map +1 -0
- package/dist/refusals/ignore-code-types.d.ts +1 -1
- package/dist/refusals/ignore-code-types.d.ts.map +1 -1
- package/dist/refusals/ignore-code-types.js +3 -2
- package/dist/refusals/ignore-code-types.js.map +1 -1
- package/dist/refusals/path-from-contexts.d.ts +1 -1
- package/dist/refusals/path-from-contexts.js +2 -2
- package/dist/refusals/path-from-contexts.js.map +1 -1
- package/dist/refusals/with-codes.d.ts +1 -1
- package/dist/refusals/with-codes.d.ts.map +1 -1
- package/dist/refusals/with-codes.js +1 -1
- package/dist/refusals/with-codes.js.map +1 -1
- package/dist/refusals/write-refusal-classes.d.ts.map +1 -1
- package/dist/refusals/write-refusal-classes.js +4 -2
- package/dist/refusals/write-refusal-classes.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/templates/command/handler.spec.buses.ts.tpl +1 -1
- package/templates/command/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/context/permission-set.tpl +1 -1
- package/templates/context/permissions.spec.ts.tpl +1 -1
- package/templates/error/refusal.ts.tpl +1 -1
- package/templates/file-upload/handler.spec.ts.tpl +1 -1
- package/templates/init/AGENTS.md.tpl +1 -1
- package/templates/init/README.md.tpl +2 -2
- package/templates/init/rules/application.md.tpl +3 -2
- package/templates/init/rules/domain.md.tpl +3 -2
- package/templates/init/rules/infrastructure.md.tpl +1 -0
- package/templates/init/rules/presentation.md.tpl +2 -1
- package/templates/pipeline/knip.json.tpl +1 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/policy/policy.declared.ts.tpl +1 -1
- package/templates/policy/policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/change-member-roles.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/grant-delegations.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/invite-members.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/read-members.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/remove-members.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/revoke-delegations.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/authorization/revoke-invitations.policy.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/invite-member/invite-member.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.command.ts.tpl +1 -1
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/queries/search-members/search-members.handler.ts.tpl +1 -1
- package/templates/presets/identity/context/application/queries/search-members/search-members.query.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +1 -1
- package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -1
- package/templates/query/handler.spec.buses.ts.tpl +1 -1
- package/templates/query/handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/query/search.handler.declared.ts.tpl +1 -1
- package/templates/query/search.handler.spec.buses.ts.tpl +1 -1
- package/templates/query/search.handler.spec.tsyringe.ts.tpl +1 -1
- package/templates/query/search.handler.ts.tpl +1 -1
- package/dist/declared/single-file-notice.d.ts +0 -8
- package/dist/declared/single-file-notice.d.ts.map +0 -1
- package/dist/declared/single-file-notice.js +0 -9
- package/dist/declared/single-file-notice.js.map +0 -1
- package/dist/generate/place-in-modules.d.ts +0 -16
- package/dist/generate/place-in-modules.d.ts.map +0 -1
- package/dist/generate/place-in-modules.js.map +0 -1
- /package/templates/presets/identity/context/{domain/errors/codes.named.ts.tpl → __context__.codes.named.ts.tpl} +0 -0
- /package/templates/presets/identity/context/{application/authorization/__context__.permissions.ts.tpl → __context__.permissions.ts.tpl} +0 -0
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ module file of the context: `builder.bind(Port).toClass(Adapter, [Ports])`,
|
|
|
140
140
|
metadata, and only `@ddd-ts-kit/di` (on tsyringe) turns them into bindings.
|
|
141
141
|
`--assembly` says how a declared context reaches the composition root: `barrel` (the default) is
|
|
142
142
|
generated files, `<context>.declarations.ts` at the root of the context re-exporting the
|
|
143
|
-
declarations of each
|
|
143
|
+
declarations of each layer, static, followed by a bundler, by knip and by dependency-cruiser; `discovery` writes `await discoverContext(...)` instead, with the knip entry
|
|
144
144
|
and the dependency-cruiser exception the discovered files need (publishers and jobs included: they
|
|
145
145
|
are discovered like the rest), and inlines `@ddd-ts-kit/di` in the two vitest configs, so that the
|
|
146
146
|
files it imports itself are compiled by the runner. Discovery is accepted behind a broker: a
|
|
@@ -165,7 +165,7 @@ declare class Invoice extends AggregateRoot {
|
|
|
165
165
|
// domain/repositories/invoice.repository.ts
|
|
166
166
|
export abstract class InvoiceRepository extends Repository<Invoice> {}
|
|
167
167
|
|
|
168
|
-
//
|
|
168
|
+
// billing.permissions.ts
|
|
169
169
|
export const billingPermissions = definePermissions('billing', {
|
|
170
170
|
'invoice.issue': { description: 'Issue invoice' },
|
|
171
171
|
});
|
|
@@ -302,8 +302,8 @@ nothing in its decorator (`@CommandHandler(IssueInvoiceCommand)`): each construc
|
|
|
302
302
|
is typed by one class, its token (`declarations/constructor-injection`). `generate`, `docs` and
|
|
303
303
|
the `dev` script read the signatures, with the zero-dependency scanner of the checker and no
|
|
304
304
|
compiler, and write `injected(Class, [Tokens])` statements in the generated files of each
|
|
305
|
-
context: the `<
|
|
306
|
-
which `<context>.declarations.ts` re-exports, or `<context>.dependencies.ts` under discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
|
|
305
|
+
context: the `<layer>.declarations.ts` of each layer, above the role folders whose classes it
|
|
306
|
+
registers, which `<context>.declarations.ts` re-exports, or `<context>.dependencies.ts` under discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
|
|
307
307
|
is absent with standard decorators and under `tsx`. `init` writes
|
|
308
308
|
`"stack.dependencies": "signature"`; a config without the key is `listed`, the 0.1 form
|
|
309
309
|
(`@CommandHandler(M, [Ports])`), which keeps working untouched, and
|
|
@@ -311,14 +311,14 @@ is absent with standard decorators and under `tsx`. `init` writes
|
|
|
311
311
|
what each class is given. Every generated file exports one class, interface or function and is named
|
|
312
312
|
after it.
|
|
313
313
|
|
|
314
|
-

|
|
315
315
|
|
|
316
316
|
An excerpt of the declarations of the `notification` context of the example application, as
|
|
317
|
-
the CLI writes them (never by hand): one file per
|
|
318
|
-
and a summary at the root of the context that only re-exports them.
|
|
317
|
+
the CLI writes them (never by hand): one file per layer, above the role folders whose classes it
|
|
318
|
+
registers, and a summary at the root of the context that only re-exports them.
|
|
319
319
|
|
|
320
320
|
```ts
|
|
321
|
-
// src/contexts/notification/application/
|
|
321
|
+
// src/contexts/notification/application/application.declarations.ts
|
|
322
322
|
import { injected } from '@ddd-ts-kit/kernel/declarations';
|
|
323
323
|
import { WithdrawReminderHandler } from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
|
|
324
324
|
import { ReminderRepository } from '@/contexts/notification/domain/repositories/reminder.repository';
|
|
@@ -328,7 +328,7 @@ export * from '@/contexts/notification/application/commands/withdraw-reminder/wi
|
|
|
328
328
|
|
|
329
329
|
injected(WithdrawReminderHandler, [ReminderRepository]);
|
|
330
330
|
|
|
331
|
-
// src/contexts/notification/infrastructure/
|
|
331
|
+
// src/contexts/notification/infrastructure/infrastructure.declarations.ts
|
|
332
332
|
import { KnexReminderRepository } from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
|
|
333
333
|
import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';
|
|
334
334
|
import { KnexContext } from '@ddd-ts-kit/knex';
|
|
@@ -338,8 +338,9 @@ export * from '@/contexts/notification/infrastructure/persistence/knex-reminder.
|
|
|
338
338
|
injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
|
|
339
339
|
|
|
340
340
|
// src/contexts/notification/notification.declarations.ts
|
|
341
|
-
export * from '@/contexts/notification/application/
|
|
342
|
-
export * from '@/contexts/notification/infrastructure/
|
|
341
|
+
export * from '@/contexts/notification/application/application.declarations';
|
|
342
|
+
export * from '@/contexts/notification/infrastructure/infrastructure.declarations';
|
|
343
|
+
export * from '@/contexts/notification/presentation/presentation.declarations';
|
|
343
344
|
```
|
|
344
345
|
|
|
345
346
|
and the one line of the composition root that adds the whole context:
|
|
@@ -348,7 +349,7 @@ and the one line of the composition root that adds the whole context:
|
|
|
348
349
|
**A refusal is a class of its own.** `init` writes `"stack.refusals": "named"`: each refusal of
|
|
349
350
|
a context is a class named after what is refused, extending `DomainRefusal` of the kernel, built
|
|
350
351
|
by static factories named after what the refusal is about, and its code is read from the closed
|
|
351
|
-
list of the codes of the context,
|
|
352
|
+
list of the codes of the context, `<context>.codes.ts`.
|
|
352
353
|
`generate error <context> <Refusal> <factory>` writes the class, its code and the factory. The
|
|
353
354
|
`errors/*` rules hold that form. Two earlier forms keep working: `--refusals factories`, one error class per concept extending
|
|
354
355
|
`ConceptError`, each refusal a static factory of it, as `init` wrote it before; and
|
|
@@ -361,7 +362,7 @@ The form `init` writes, which `generate error scheduling SlotTaken forCalendar`
|
|
|
361
362
|
```ts
|
|
362
363
|
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
363
364
|
|
|
364
|
-
//
|
|
365
|
+
// scheduling.codes.ts: the closed list of the codes of the context
|
|
365
366
|
export const SchedulingCodes = {
|
|
366
367
|
SlotTaken: 'SLOT_TAKEN',
|
|
367
368
|
} as const;
|
|
@@ -663,8 +664,8 @@ would create src/contexts/notification/application/commands/archive-notification
|
|
|
663
664
|
would create src/contexts/notification/application/commands/archive-notification/archive-notification.handler.ts
|
|
664
665
|
would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
|
|
665
666
|
would update src/contexts/notification/CONTEXT.md
|
|
666
|
-
would update src/contexts/notification/
|
|
667
|
-
would update src/contexts/notification/application/
|
|
667
|
+
would update src/contexts/notification/notification.permissions.ts
|
|
668
|
+
would update src/contexts/notification/application/application.declarations.ts
|
|
668
669
|
|
|
669
670
|
Next, in this order: the language of the context first, then the business decisions only you can make
|
|
670
671
|
src/contexts/notification/application/commands/archive-notification/archive-notification.command.ts:9 declare the input of "archive notification" as a constructor with the actor first, ...
|
|
@@ -674,7 +675,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
674
675
|
|
|
675
676
|
| Kind | Arguments | Writes |
|
|
676
677
|
|---|---|---|
|
|
677
|
-
| `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/composition/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`.
|
|
678
|
+
| `context` | `<name> --classification <c> [--purpose "<two sentences>"] [--term ...]... [--upstream <ctx>[:relationship]]... [--preset identity]` | `CONTEXT.md` with its glossary, `published-language/index.ts`, config entry, registration in `platform/composition/compose-application.ts` and in `test/architecture/extractable.spec.ts`; on tsyringe, with HTTP, `presentation/http/<name>.routes.ts` (a function of the two buses, in both styles); declared: the barrel `<name>.declarations.ts`; explicit and hand wiring: `<name>.module.ts`. `<name>.permissions.ts`, at the root of the context, is born with the first permission, or at once when `platform/auth/authorization/permissions.ts` lists the permission sets (rebac, custom). With `--preset`, the context is then written whole from that preset, its classification and purpose those of the preset unless the flags say otherwise ([Presets](#presets)) |
|
|
678
679
|
| `aggregate` | `<context> <Name> [--event-sourced]` | aggregate, builder, spec in given / when / then; with `--event-sourced`, an aggregate on `EventSourcedAggregate` whose state is the replay of its events, born with its `Created` domain event, the codec of its stored events in `infrastructure/persistence/<name>-events.mapper.ts`, a builder that replays a history and a spec given events, and a note naming the `EventSourcedRepository` its repository adapter delegates to |
|
|
679
680
|
| `builder` | `<context> <Aggregate>` | `test/builders/<name>.builder.ts`, a class extending `Builder` |
|
|
680
681
|
| `test-world` | `<context> [Name]` | `test/worlds/<name>.world.ts` (the name defaults to the context): `a<Name>World({ now, idPrefix, given })`, the arrangement several specs of the context share. It reads the fakes of `test/fakes/` and the port each one implements, builds them, hands them to `given` so that the spec stores what it starts from, then to the test application (with `modules`, the authorization of the spec) or, wired by hand, wraps the repositories of the buses of `createTestBuses` with `dispatching`; it returns every fake under the name of its port. A fake that needs constructor arguments, or, under a container, stands for a port nothing binds or depends on yet, is left out with a note |
|
|
@@ -682,7 +683,7 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
682
683
|
| `value-object` (`vo`) | `<context> <Name>` | value object, spec |
|
|
683
684
|
| `vocabulary` | `<context> <Name> --value <value> [--value <value>]...` | `domain/vocabularies/<name>.vocabulary.ts`: an object `as const` of the values, keyed by each value in PascalCase, and the union type of the same name; run again, adds the values the file does not hold |
|
|
684
685
|
| `domain-event` | `<context> <Aggregate> <Fact>` | event named `<context>.<aggregate>.<fact>`, spec |
|
|
685
|
-
| `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | under `"stack.refusals": "named"`: the class `<Refusal>` in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal` and reading its code from the list, its entry in
|
|
686
|
+
| `error` (`refusal`) | `<context> <Refusal> <factory> [--code CODE] [--term ...]...` | under `"stack.refusals": "named"`: the class `<Refusal>` in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal` and reading its code from the list, its entry in `<context>.codes.ts` (the list `<Context>Codes` and its type `<Context>Code`, created when absent; the entry is added at the end), the static factory `<factory>` and its case in `test/unit/<refusal>.error.spec.ts`. Each is written when absent: run again, the command changes nothing; given another factory, it adds it to the class. `<Refusal>` is in PascalCase (a trailing `Error` is dropped), named with terms of the glossary and the qualifiers of a refusal, `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` (`BookingTooLate`): a word the glossary does not define is refused, with the `--term` that adds it; `<factory>` starts with `for`, `with`, `because`, `on` or `at` (`forAccountId`), else the command refuses and proposes `for<Factory>`. The code is the refusal in constant case (`InsufficientFunds` sets `INSUFFICIENT_FUNDS`), `--code` gives another; refused: a code already set in the context. Under `factories` and `classes`, `<context> <Concept> <refusal>`: a static factory `<refusal>` on `domain/errors/<concept>.error.ts`, the class of the errors of that concept (created when absent, extending `ConceptError`), and its case in `test/unit/<concept>.error.spec.ts`. The factory is added after the last one; run again, the command changes nothing. `<Concept>` is a term of the glossary (`--term` adds it). The code is the name of the refusal in constant case, with the concept before it when the name is one word or a code of the kit (`Appointment notFound` sets `APPOINTMENT_NOT_FOUND`); `--code` takes one of the forms `errors/factory-name` accepts. Refused: a name such as `create` or `error1`, and a code already set in the context |
|
|
686
687
|
| `domain-error` | `<context> <Name> [--code CODE]` | one class per error with a stable code, spec: the form of a project whose config says `"stack.refusals": "classes"` or nothing. Refused under `named` and `factories`, with the `generate error` command to run instead |
|
|
687
688
|
| `domain-service` | `<context> <Name>` | service, spec |
|
|
688
689
|
| `state-machine` | `<context> <Aggregate> [--value <state>]... [--transition "<intention>:<from>[,<from>]...[><to>]"]...` | the vocabulary `<Aggregate>Status` (created from `--value`, two states at least, or given the values it misses), `domain/state-machines/<aggregate>.state-machine.ts` (`<aggregate>Lifecycle`: every value a state, the first one initial, the transitions asked, a `TODO(domain)` for the refusal of the concept error) and `test/unit/<aggregate>.state-machine.spec.ts` (each transition where it leads, a refusal from a state it does not leave); the aggregate is left to use it |
|
|
@@ -764,19 +765,19 @@ Next, in this order: the language of the context first, then the business decisi
|
|
|
764
765
|
`system` subject operate a context. With `--authz custom`, a removed region, a remodelled
|
|
765
766
|
relationship schema or a permission the generator cannot read, nothing is written and the job
|
|
766
767
|
file carries the `TODO(domain)` naming the actor and the permission.
|
|
767
|
-
- **The declarations are derived.** Each
|
|
768
|
-
|
|
769
|
-
`infrastructure/
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
`export *` per role file of the folder, sorted by path, then one `injected(Class, [Tokens])` per
|
|
768
|
+
- **The declarations are derived.** Each layer of a context that holds a declared role file has
|
|
769
|
+
its `<layer>.declarations.ts`, directly in the layer: `application/application.declarations.ts`,
|
|
770
|
+
`infrastructure/infrastructure.declarations.ts`, `presentation/presentation.declarations.ts`,
|
|
771
|
+
and the same in each module of the model. It holds one
|
|
772
|
+
`export *` per role file of the layer, sorted by path, then one `injected(Class, [Tokens])` per
|
|
773
773
|
class whose constructor takes something, read from its signature, with the imports they need.
|
|
774
774
|
`<context>.declarations.ts`, at the root of the context, only re-exports these files, sorted by
|
|
775
|
-
path. Every `generate`, and `docs`, rewrite them and delete the declarations of a
|
|
776
|
-
holds no role file any more
|
|
775
|
+
path. Every `generate`, and `docs`, rewrite them and delete the declarations of a layer that
|
|
776
|
+
holds no role file any more, and the `<folder>.declarations.ts` of each role folder that 0.85 and
|
|
777
|
+
0.86 wrote; `docs --check` and `check` (`declarations/barrel-current`) report
|
|
777
778
|
one that a role file written by hand left behind or whose constructor changed since, naming the
|
|
778
779
|
class
|
|
779
|
-
(`stale src/contexts/billing/application/
|
|
780
|
+
(`stale src/contexts/billing/application/application.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
|
|
780
781
|
The `dev` script loads `ddd-ts-kit/dist/refresh-declarations.js` before the application, on
|
|
781
782
|
every start and reload of `tsx watch`: a port added to a constructor is injected on the
|
|
782
783
|
reload that follows the save. The same module is the binary `ddd-ts-kit-refresh-declarations`.
|
|
@@ -863,9 +864,9 @@ Regenerates what is derived from the config and the code, and nothing else:
|
|
|
863
864
|
kept; on first creation the four written sections are laid out with hints.
|
|
864
865
|
- the generated lists of every `CONTEXT.md` (aggregates, published events, permissions, scheduled
|
|
865
866
|
jobs as a table of name, schedule and command, relationships);
|
|
866
|
-
- the generated declarations of every declared context: the `<
|
|
867
|
-
|
|
868
|
-
`<context>.declarations.ts`, which re-exports them (the declarations of a
|
|
867
|
+
- the generated declarations of every declared context: the `<layer>.declarations.ts` of each
|
|
868
|
+
layer, with what each constructor is injected, read from its signature, and
|
|
869
|
+
`<context>.declarations.ts`, which re-exports them (the declarations of a layer left without a
|
|
869
870
|
role file are deleted), or under discovery `<context>.dependencies.ts`, which holds the lists
|
|
870
871
|
alone;
|
|
871
872
|
- the reference of every `CONTEXT.md`: the facts of `describe`, as tables under `## Reference`,
|
|
@@ -996,7 +997,7 @@ for each class it writes.
|
|
|
996
997
|
a factory that does not start with `for`, `with`, `because`, `on` or `at` then an upper-case
|
|
997
998
|
letter, a class given two codes and a factory planned twice. It:
|
|
998
999
|
|
|
999
|
-
- writes
|
|
1000
|
+
- writes `<context>.codes.ts` in each context, the list `<Context>Codes` with one entry per
|
|
1000
1001
|
class, and one file per refusal class, `domain/errors/<refusal>.error.ts`, extending
|
|
1001
1002
|
`DomainRefusal` and reading its code from the list, with its factories: each keeps the
|
|
1002
1003
|
parameters, the message and the facts it had;
|
|
@@ -1013,7 +1014,7 @@ letter, a class given two codes and a factory planned twice. It:
|
|
|
1013
1014
|
It leaves, and says with its line, what still names a concept class that is gone: a bare
|
|
1014
1015
|
`AppointmentError.is(error)`, which meant every refusal of the concept (write the refusals it
|
|
1015
1016
|
means, `AppointmentEnded.is(error) || ..`), and `CodeOf<typeof AppointmentError>` (write the
|
|
1016
|
-
union of the codes it means, or the code type of
|
|
1017
|
+
union of the codes it means, or the code type of `<context>.codes.ts`). And always: run the formatter and
|
|
1017
1018
|
the checks, decide which facts a client may read where no factory exposes any yet, assert the
|
|
1018
1019
|
facts in the specs, and delete the plan file. Run again, it finds nothing left to move. `--json`
|
|
1019
1020
|
answers `{ dryRun, moved, written, removed, manual }`.
|
|
@@ -1979,7 +1980,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
1979
1980
|
| `context/declared-relationship` | an import of a published language whose context is not a declared upstream |
|
|
1980
1981
|
| `context/published-language-is-a-contract` | `published-language/` importing anything but its allow-list and other published languages |
|
|
1981
1982
|
| `context/no-cycle` | a cycle in the declared upstreams, with its path |
|
|
1982
|
-
| `tree/closed` | a directory outside the canonical tree and `extraDirectories`; a source file outside a role directory; in the declared style `<context>.declarations.ts` is accepted at the root of a context, and the `<
|
|
1983
|
+
| `tree/closed` | a directory outside the canonical tree and `extraDirectories`; a source file outside a role directory; in the declared style `<context>.declarations.ts` is accepted at the root of a context, and the `<layer>.declarations.ts` of a layer in that layer |
|
|
1983
1984
|
| `tree/context-doc` | a missing `CONTEXT.md`, a missing section, a classification that contradicts the config |
|
|
1984
1985
|
| `naming/suffix` | a file without the suffix of its role, or not in kebab-case. `application/scheduling/` holds `*.job.ts`; a use case folder accepts `*.result.ts` next to its message and its handler; `presentation/http/<context>.routes.ts`, named after its context instead of a role, is accepted in both styles |
|
|
1985
1986
|
| `naming/one-concept-per-file` | several exported classes in an aggregate, entity, value object, event, command, query, handler, event handler, integration event handler or job file; in the declared style, several classes carrying a declaration decorator in one role file |
|
|
@@ -1992,7 +1993,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
1992
1993
|
| `events/name-format` | an event name that is not `<context>.<aggregate>.<fact>` in kebab-case with the right context |
|
|
1993
1994
|
| `events/name-declared-once` | a class of `domain/events/` without `static readonly eventName`, or whose `readonly name` writes the name again instead of reading it |
|
|
1994
1995
|
| `events/defined-in-published-language` | `defineIntegrationEvent` outside a published language, without a payload, twice for one version; an event described by hand |
|
|
1995
|
-
| `language/glossary-term` | a class of the model named with a word the glossary of its context does not define; an empty glossary; under `"stack.refusals": "factories"` or `"named"`, a class of `domain/errors/` too, a refusal class of `named` allowed the qualifiers `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` besides (
|
|
1996
|
+
| `language/glossary-term` | a class of the model named with a word the glossary of its context does not define; an empty glossary; under `"stack.refusals": "factories"` or `"named"`, a class of `domain/errors/` too, a refusal class of `named` allowed the qualifiers `invalid`, `unknown`, `already`, `too`, `no`, `missing` and `required` besides (`<context>.codes.ts` is not judged) |
|
|
1996
1997
|
| `language/declared-vocabulary` | a string literal whose value is a value of a closed vocabulary the project declares (an object `as const` exported with the union type of its name, a permission set of `definePermissions`), outside the file that declares it, in the place that speaks its language (its context; the platform and the route groups for the platform; everywhere for a permission id or the shared kernel); tests, published languages and the relationship schema are not judged, nor, outside `domain/`, a word typed by another language (a key of a `Record<T, ..>`, a value of a `Record<.., T>`, `'x' satisfies T`, `T` a type of a published language, of a package or of `infrastructure/anti-corruption/` or `infrastructure/external/`); under `"stack.literals": "named"` |
|
|
1997
1998
|
| `language/no-technical-name` | `Manager`, `Helper`, `Util`, `Utils`, `Data`, `Info`, `Processor`, `Wrapper`, `Impl`, `Base`, `Abstract`, `Dto`, `Entity`, `Model` in a type declared under `domain/` or in a use case folder |
|
|
1998
1999
|
| `purity/no-system-clock` | `new Date()` without argument, `Date.now()`, `performance.now()` in `domain/` or `application/` |
|
|
@@ -2037,7 +2038,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
2037
2038
|
| `context/extractable` | a module file importing another context outside its published language; persistence importing another context's infrastructure or naming its schema; a handler importing another context's repository; `export let` or an exported `new Map`, `Set`, `WeakMap` at module level; `deployable: true` without `apps/<context>/main.ts`; in the declared style, a role file importing anything of a port file of another context |
|
|
2038
2039
|
| `governance/recorded-deviation` | a `ddd-ts-kit-disable` or `eslint-disable` comment whose reason names no `ADR-<number>` with a file `docs/adr/<number>-*.md`; a rule set to `off` (or to `warn` below its default), an extra directory, an extra allowed package, a `guard` other than `enforce` or `stack.events` off the outbox, without a `deviations` entry `{ what, adr, reason }` pointing to an existing record |
|
|
2039
2040
|
| `declarations/role-declared` | declared style only: a role file (other than `*.command.ts` and `*.query.ts`, held by `authz/declared`; `*.job.ts` under `application/scheduling/` with `@Scheduled` and `*.publisher.ts` with `@DomainEventHandler` are roles) exporting no class with the decorator of its suffix and folder, or one carrying another declaration; a declared class in a file that is not a role file; a `consumer` or `name` option that is missing, empty, a variable, a concatenation or a template with a substitution; any declaration decorator on a class under `domain/` |
|
|
2040
|
-
| `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<
|
|
2041
|
+
| `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<layer>.declarations.ts` of a layer or one that differs from one `export *` per role file of the layer sorted by path followed by one `injected(Class, [Tokens])` per class of the layer whose constructor takes something (read from the signatures, with their imports), a `<context>.declarations.ts` that is missing or differs from one `export *` per such file sorted by path, and the declarations of a layer that holds no role file any more; with `discovery`, generated declarations that still exist, and a `<context>.dependencies.ts` that differs from those `injected` statements (absent is accepted while it would hold none). The message names the missing role file or the class whose list is stale. A context still declared as an earlier version wrote it, exactly as that version would write it (the single `<context>.declarations.ts` of 0.84, or one `<folder>.declarations.ts` per role folder as 0.85 and 0.86 wrote them), is a warning in this version (`docs --check` passes and prints it, `docs` moves it) and an error in a later minor version. It needs the tree, so `check-file` does not run it |
|
|
2041
2042
|
| `declarations/constructor-injection` | declared style only, in a role file: on a class whose decorator lists nothing, a constructor parameter that is optional, has a default value, is a rest parameter or is destructured, has no type, or is typed by anything but one class name (type arguments aside): a union, an intersection, an array, a qualified name, a type of the language, an interface, a type alias, an enum or an unexported class of the file or of the file of the project it is imported from; a class that inherits its constructor from a class the project cannot read. Under `stack.dependencies: signature`, a decorator that carries a list although the constructor can be read: one that repeats it, one that differs |
|
|
2042
2043
|
| `declarations/port-adapter-wired` | a class of `infrastructure/` implementing a port that nothing wires: no `@Repository`, `@Gateway` or `@Adapter` in the declared style, and no file of the composition root (`<context>.module.ts`, `main.ts`, `apps/<context>/main.ts`, the platform) importing it, once the file carries no `TODO(domain)` or `TODO(platform)` left; one kept on purpose carries `// ddd-ts-kit-disable-next-line declarations/port-adapter-wired -- ADR-NNNN: <why>` |
|
|
2043
2044
|
| `ports/abstract-class` | in a port file (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`): a class that is not `abstract`; a member that is not an abstract method or property (`static readonly tokenKey = '<text>'` apart): a constructor, a body, an initializer, a `private`, `protected` or `#` member; an exported `interface` (a `type` alias, a data shape, is not reported) |
|
|
@@ -2047,11 +2048,11 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
|
|
|
2047
2048
|
| `ports/value-import` | a class named in a dependency list, or given to `bind` or `rebind`, imported with `import type` or `import { type X }` |
|
|
2048
2049
|
| `scheduling/job-triggers-use-case` | in `application/scheduling/*.job.ts`: an exported class that does not implement `ScheduledJob`; a `run` that sends no command (no `.execute(` call); a repository in the dependency list or the constructor; an import from `domain/aggregates/`, `domain/entities/`, `domain/services/` or `infrastructure/`. A `builder.job(..)` registration of a class that lives elsewhere |
|
|
2049
2050
|
| `scheduling/job-name` | the first argument of `@Scheduled(..)` or `.job(..)` that is not a string literal `<context>.<job-name>` in lower-case kebab-case with the context of its file; a `systemActor(..)` of a job file passing another name; one job name used twice in the project |
|
|
2050
|
-
| `errors/code-unique` | under `"stack.refusals": "named"` or `"factories"`, in the `domain/errors/` of a context: a code set a second time, by a value of
|
|
2051
|
-
| `errors/code-listed` | under `"stack.refusals": "named"`, in the `domain/errors/` of a context: a refusal class (extending `DomainRefusal`) whose code is not `readonly code = <Context>Codes.<Class>` from the
|
|
2051
|
+
| `errors/code-unique` | under `"stack.refusals": "named"` or `"factories"`, in the `domain/errors/` of a context: a code set a second time, by a value of `<context>.codes.ts`, a factory (`refusal('CODE', ..)`) or a class (`readonly code = 'CODE'`), with the file and line of the first. The same code in two contexts is not reported |
|
|
2052
|
+
| `errors/code-listed` | under `"stack.refusals": "named"`, in the `domain/errors/` of a context: a refusal class (extending `DomainRefusal`) whose code is not `readonly code = <Context>Codes.<Class>` from the `<context>.codes.ts` of its context, refusal classes and no `<context>.codes.ts`, a class the list does not hold; in `<context>.codes.ts`, no list `<Context>Codes` or one not declared `as const`, a key that names no refusal class of the context, a value that is not a string literal in constant case |
|
|
2052
2053
|
| `schema/presentation-only` | under `"stack.schemas": "shared"`: in the shared kernel outside `presentation/`, an import of a validation library; in `domain/`, `application/`, `infrastructure/`, `published-language/` and the shared kernel outside `presentation/`, an import of a file of `presentation/` of the shared kernel |
|
|
2053
2054
|
| `schema/no-duplicate-shape` | under `"stack.schemas": "shared"`, in the presentation layer of one context, or in it and `presentation/` of the shared kernel: a DTO class or an object schema (`z.object`, `v.object`, `Type.Object`) declaring the shape of another one, with the place of the original (the shared kernel, then `presentation/http/shared/`); two contexts are not compared, and request parameters and shapes still carrying a `TODO(domain)` of the generator are not judged |
|
|
2054
|
-
| `errors/known-code` | under `"stack.refusals": "named"` or `"factories"`, in a `*.route.ts`: a code of the `errors` list that the
|
|
2055
|
+
| `errors/known-code` | under `"stack.refusals": "named"` or `"factories"`, in a `*.route.ts`: a code of the `errors` list that the `<context>.codes.ts` of the context of the route does not list, that no refusal of that context sets, that no class outside the contexts sets, and that is not a code of the kit |
|
|
2055
2056
|
| `domain/value-object-class` | under `"stack.values": "classes"`: in `domain/value-objects/` of a context or a `*.vo.ts` of the shared kernel outside `presentation/`, no exported class or a second one, a class that extends neither `ValueObject` nor another value object of the project, a public constructor, a concrete class without a static method, an exported function, arrow constant or object literal (inline, listed or by default); in `domain/` and in the shared kernel outside `presentation/`, an exported function that answers a record of data: data entries, no spread, nothing a call of the model built |
|
|
2056
2057
|
|
|
2057
2058
|
More ids belong to `@ddd-ts-kit/eslint-plugin`, which reads the syntax tree where this
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Config } from '../../config/index.js';
|
|
2
|
+
import type { Flaw } from '../model/flaw.js';
|
|
3
|
+
/** A file of a context still where 0.86 and 0.87 wrote it: a warning while it is the only one, an error next to the one at the root. */
|
|
4
|
+
export interface EarlierContextFile {
|
|
5
|
+
readonly flaw: Flaw;
|
|
6
|
+
readonly severity: 'warn' | 'error';
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* What `tree/closed` says of a file of a context that 0.86 and 0.87 wrote in a role folder, the code list
|
|
10
|
+
* (`domain/errors/codes.ts`) or the permission set (`application/authorization/<context>.permissions.ts`),
|
|
11
|
+
* now at the root of the context; undefined for any other entry. `entries` are every entry of the
|
|
12
|
+
* contexts, to tell whether the root holds the file already.
|
|
13
|
+
*/
|
|
14
|
+
export declare function earlierContextFile(entry: string, config: Config, entries: ReadonlySet<string>): EarlierContextFile | undefined;
|
|
15
|
+
//# sourceMappingURL=earlier-context-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-context-file.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/earlier-context-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,wIAAwI;AACxI,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAC3B,kBAAkB,GAAG,SAAS,CA4BhC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CONTEXT_FILES } from '../../context-files/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* What `tree/closed` says of a file of a context that 0.86 and 0.87 wrote in a role folder, the code list
|
|
4
|
+
* (`domain/errors/codes.ts`) or the permission set (`application/authorization/<context>.permissions.ts`),
|
|
5
|
+
* now at the root of the context; undefined for any other entry. `entries` are every entry of the
|
|
6
|
+
* contexts, to tell whether the root holds the file already.
|
|
7
|
+
*/
|
|
8
|
+
export function earlierContextFile(entry, config, entries) {
|
|
9
|
+
const [context = '', ...rest] = entry.slice(config.contextsDir.length + 1).split('/');
|
|
10
|
+
const relative = rest.join('/');
|
|
11
|
+
const file = CONTEXT_FILES.find((candidate) => candidate.earlier(context) === relative);
|
|
12
|
+
if (file === undefined || !entry.startsWith(`${config.contextsDir}/`)) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const root = file.root(context);
|
|
16
|
+
if (entries.has(`${config.contextsDir}/${context}/${root}`)) {
|
|
17
|
+
return {
|
|
18
|
+
severity: 'error',
|
|
19
|
+
flaw: {
|
|
20
|
+
message: `"${context}" holds ${relative} next to ${root}: one context has one of each.`,
|
|
21
|
+
fix: `Keep ${root}, move into it what ${relative} holds that it lacks, and delete ${relative}.`,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
severity: 'warn',
|
|
27
|
+
flaw: {
|
|
28
|
+
message: `${relative} of "${context}" is where 0.86 and 0.87 kept it: it lives at the root of the context now, ${root}. This version reads it where it is, and a later minor version reports it as an error.`,
|
|
29
|
+
fix: 'Run `npx ddd-ts-kit context-layout`, which moves it to the root of its context and rewrites every import of it, then commit the result.',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=earlier-context-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier-context-file.js","sourceRoot":"","sources":["../../../src/check/canonical/earlier-context-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AASpD;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAa,EACb,MAAc,EACd,OAA4B;IAE5B,MAAM,CAAC,OAAO,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;IAExF,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;QAC5D,OAAO;YACL,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI,OAAO,WAAW,QAAQ,YAAY,IAAI,gCAAgC;gBACvF,GAAG,EAAE,QAAQ,IAAI,uBAAuB,QAAQ,oCAAoC,QAAQ,GAAG;aAChG;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE;YACJ,OAAO,EAAE,GAAG,QAAQ,QAAQ,OAAO,8EAA8E,IAAI,wFAAwF;YAC7M,GAAG,EAAE,yIAAyI;SAC/I;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stray-entry.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"stray-entry.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAgB1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAS1E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { CONTEXT_FILES } from '../../context-files/index.js';
|
|
2
3
|
import { barrelFile, dependenciesFile, isDeclarationsFile } from '../../declared/index.js';
|
|
3
|
-
import { declaredModules,
|
|
4
|
+
import { declaredModules, moduleSplit, WITHOUT_MODULE } from '../../model-modules/index.js';
|
|
4
5
|
import { isCanonicalDirectory } from './is-canonical-directory.js';
|
|
5
6
|
import { OPEN_DIRECTORIES } from './open-directories.js';
|
|
6
7
|
import { roleOf } from './role-of.js';
|
|
@@ -10,7 +11,8 @@ import { roleOf } from './role-of.js';
|
|
|
10
11
|
*/
|
|
11
12
|
export function strayEntry(entry, config) {
|
|
12
13
|
const placed = place(entry, config);
|
|
13
|
-
|
|
14
|
+
// The folder of a declared module holds its layers: it is canonical as the context itself is.
|
|
15
|
+
if (placed === undefined || (placed.module !== undefined && placed.inside === '')) {
|
|
14
16
|
return undefined;
|
|
15
17
|
}
|
|
16
18
|
return entry.endsWith('/') ? strayDirectory(placed) : straySource(placed);
|
|
@@ -37,12 +39,11 @@ function strayDirectory({ context, inside, module, extras }) {
|
|
|
37
39
|
if (isCanonicalDirectory(inside) || coveredByExtra(extras, inside)) {
|
|
38
40
|
return undefined;
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (folder !== undefined && below.length === 0 && MODULE_LAYERS.includes(layer) && module === undefined) {
|
|
42
|
+
// A folder at the root of the context may be a module the config does not declare yet; one inside a module is not.
|
|
43
|
+
if (!inside.includes('/') && module === undefined) {
|
|
43
44
|
return {
|
|
44
45
|
message: `"${inside}" is not a directory of the canonical tree.`,
|
|
45
|
-
fix: `If ${
|
|
46
|
+
fix: `If ${inside} is a part of the model of ${context}, declare it as a module with \`ddd-ts-kit generate module ${context} ${inside}\`, which gives it its layers (${inside}/domain/, ${inside}/application/...); otherwise move its files to the canonical directory of their role (see \`ddd-ts-kit explain tree/closed\`).`,
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
return {
|
|
@@ -71,12 +72,13 @@ function straySource(placed) {
|
|
|
71
72
|
}
|
|
72
73
|
function atContextRoot({ context, declared, inside: file }) {
|
|
73
74
|
const generated = [barrelFile(context), dependenciesFile(context)];
|
|
74
|
-
|
|
75
|
+
const ofTheContext = CONTEXT_FILES.map((candidate) => candidate.root(context));
|
|
76
|
+
if (file === `${context}.module.ts` || ofTheContext.includes(file) || (declared && generated.includes(file))) {
|
|
75
77
|
return undefined;
|
|
76
78
|
}
|
|
77
79
|
const allowed = declared
|
|
78
|
-
? `CONTEXT.md, the generated ${generated.join(' or ')} and ${context}.module.ts`
|
|
79
|
-
: `CONTEXT.md and ${context}.module.ts`;
|
|
80
|
+
? `CONTEXT.md, ${ofTheContext.join(', ')}, the generated ${generated.join(' or ')} and ${context}.module.ts`
|
|
81
|
+
: `CONTEXT.md, ${ofTheContext.join(', ')} and ${context}.module.ts`;
|
|
80
82
|
return {
|
|
81
83
|
message: `"${file}" sits at the root of the context.`,
|
|
82
84
|
fix: `Move it into the directory of its role; only ${allowed} live at the root of a context.`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stray-entry.js","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"stray-entry.js","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEnF,OAAO,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AM,CAAC,QAAQ,OAAO,YAAY;QAC5G,CAAC,CAAC,eAAe,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,OAAO,YAAY,CAAC;IAEtE,OAAO;QACL,OAAO,EAAE,IAAI,IAAI,oCAAoC;QACrD,GAAG,EAAE,gDAAgD,OAAO,iCAAiC;KAC9F,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB,EAAE,SAAiB;IAClE,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CACzG,CAAC;AACJ,CAAC"}
|
|
@@ -37,14 +37,14 @@ function namingProblems(context, modules) {
|
|
|
37
37
|
problems.push({
|
|
38
38
|
needle: name,
|
|
39
39
|
message: `The module "${name}" of "${context}" is not written in kebab-case.`,
|
|
40
|
-
fix: `Name it as its folder is named, in kebab-case: domain
|
|
40
|
+
fix: `Name it as its folder is named, in kebab-case: <module>/, holding <module>/domain/, <module>/application/...`,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
else if (reason === 'role-folder') {
|
|
44
44
|
problems.push({
|
|
45
45
|
needle: name,
|
|
46
46
|
message: `The module "${name}" of "${context}" has the name of a role folder.`,
|
|
47
|
-
fix: 'A module is a part of the model, named in its language;
|
|
47
|
+
fix: 'A module is a part of the model, named in its language; its layers keep their role folders under it (<module>/domain/aggregates/).',
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
if (classification !== undefined && !isOneOf(CLASSIFICATIONS, classification)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-problems.js","sourceRoot":"","sources":["../../../src/check/configuration/module-problems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;AA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,CAAC;AAC1D,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,OAAiC;IACxE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE;QAClD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAC5C,MAAM,QAAQ,GAAoB,EAAE,CAAC;QAErC,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YACxB,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,IAAI;gBACZ,OAAO,EAAE,eAAe,IAAI,SAAS,OAAO,iCAAiC;gBAC7E,GAAG,EAAE,8GAA8G;aACpH,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;YACpC,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,IAAI;gBACZ,OAAO,EAAE,eAAe,IAAI,SAAS,OAAO,kCAAkC;gBAC9E,GAAG,EAAE,oIAAoI;aAC1I,CAAC,CAAC;QACL,CAAC;QAED,IAAI,cAAc,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,cAAc,CAAC,EAAE,CAAC;YAC9E,QAAQ,CAAC,IAAI,CAAC;gBACZ,MAAM,EAAE,IAAI;gBACZ,OAAO,EAAE,eAAe,IAAI,SAAS,OAAO,6BAA6B,cAAc,IAAI;gBAC3F,GAAG,EAAE,gBAAgB,OAAO,YAAY,IAAI,8BAA8B,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,iEAAiE;aACtK,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CodeEntry } from './code-entry.js';
|
|
2
|
-
/** The closed list of the codes of a context, `export const <Context>Codes = { .. } as const` in
|
|
2
|
+
/** The closed list of the codes of a context, `export const <Context>Codes = { .. } as const` in `<context>.codes.ts`. */
|
|
3
3
|
export interface CodeList {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly line: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-list.d.ts","sourceRoot":"","sources":["../../../src/check/errors/code-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,
|
|
1
|
+
{"version":3,"file":"code-list.d.ts","sourceRoot":"","sources":["../../../src/check/errors/code-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,0HAA0H;AAC1H,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;CACxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SourceFile } from '../model/source-file.js';
|
|
2
|
-
/** True for the
|
|
2
|
+
/** True for the code list of a context, `<context>.codes.ts` at its root (read as `domain/errors/codes.ts`, where 0.86 and 0.87 kept it). */
|
|
3
3
|
export declare function isCodesFile(file: SourceFile): boolean;
|
|
4
4
|
//# sourceMappingURL=is-codes-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-codes-file.d.ts","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"is-codes-file.d.ts","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,6IAA6I;AAC7I,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAWrD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** True for the
|
|
1
|
+
/** True for the code list of a context, `<context>.codes.ts` at its root (read as `domain/errors/codes.ts`, where 0.86 and 0.87 kept it). */
|
|
2
2
|
export function isCodesFile(file) {
|
|
3
3
|
const { location } = file;
|
|
4
4
|
return (!file.isTest &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-codes-file.js","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"is-codes-file.js","sourceRoot":"","sources":["../../../src/check/errors/is-codes-file.ts"],"names":[],"mappings":"AAEA,6IAA6I;AAC7I,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC1C,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,OAAO,CACL,CAAC,IAAI,CAAC,MAAM;QACZ,QAAQ,CAAC,IAAI,KAAK,SAAS;QAC3B,QAAQ,CAAC,KAAK,KAAK,QAAQ;QAC3B,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ;QAC/B,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAClC,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const ERRORS_DOCS = {
|
|
2
2
|
'errors/code-unique': {
|
|
3
|
-
why: 'The code is the identity of a refusal for everything outside the domain: the HTTP mapper gives it a status, the OpenAPI document lists it, the audit trail and the span record it as the reason, a client branches on it and a test asserts it. Nothing downstream knows the class or the factory. Two refusals of one context under one code are therefore one refusal for every reader, whatever their messages say. The code is checked per context, since each context owns its language: the same code in two contexts is allowed, and the error mapper of the application gives it one status. Every form is read: the first argument of `refusal(..)` in a factory of a concept class, the `readonly code` field of a class per error, and under "stack.refusals": "named" the values of
|
|
3
|
+
why: 'The code is the identity of a refusal for everything outside the domain: the HTTP mapper gives it a status, the OpenAPI document lists it, the audit trail and the span record it as the reason, a client branches on it and a test asserts it. Nothing downstream knows the class or the factory. Two refusals of one context under one code are therefore one refusal for every reader, whatever their messages say. The code is checked per context, since each context owns its language: the same code in two contexts is allowed, and the error mapper of the application gives it one status. Every form is read: the first argument of `refusal(..)` in a factory of a concept class, the `readonly code` field of a class per error, and under "stack.refusals": "named" the values of <context>.codes.ts, the code list of the context, where two keys under one value are reported. Judged under "stack.refusals": "factories" and "named": a project whose config does not say was written when an error was a class, and keeps working untouched.',
|
|
4
4
|
bad: `export class AppointmentError extends ConceptError {
|
|
5
5
|
static slotTaken(calendarId: string) {
|
|
6
6
|
return AppointmentError.refusal('BOOKING_REFUSED', 'The slot is already held.', { calendarId });
|
|
@@ -21,8 +21,8 @@ export const ERRORS_DOCS = {
|
|
|
21
21
|
}`,
|
|
22
22
|
},
|
|
23
23
|
'errors/code-listed': {
|
|
24
|
-
why: 'Under "stack.refusals": "named" a refusal is a class of its own, `SlotTaken`, and its code is what everything outside the domain knows it by: the error mapper gives it a status, the OpenAPI document and the client list it, a test asserts it. The codes of a context are therefore one closed list,
|
|
25
|
-
bad: `//
|
|
24
|
+
why: 'Under "stack.refusals": "named" a refusal is a class of its own, `SlotTaken`, and its code is what everything outside the domain knows it by: the error mapper gives it a status, the OpenAPI document and the client list it, a test asserts it. The codes of a context are therefore one closed list, <context>.codes.ts, `export const SchedulingCodes = { SlotTaken: \'SLOT_TAKEN\' } as const`, and each class reads its code from it under its own name, `readonly code = SchedulingCodes.SlotTaken`: the list is the contract of the context in one file, two refusals cannot drift to one code unseen, and the type of each code stays its own literal. Reported: a refusal class (a class of domain/errors/ that extends DomainRefusal, abstract ones aside) without a code, with a code written another way (a string literal, another entry, the list of another context), a context with refusal classes and no codes.ts, a class whose name the list does not hold; in codes.ts, a list missing or not `as const`, a key that names no refusal class of the context (a code nothing raises), and a value that is not a string literal in constant case. The value is usually the name of the class in constant case, but need not be: a migrated project keeps its codes, since the code is the contract. Judged under "stack.refusals": "named" only.',
|
|
25
|
+
bad: `// scheduling.codes.ts
|
|
26
26
|
export const SchedulingCodes = {
|
|
27
27
|
SlotTaken: 'SLOT_TAKEN',
|
|
28
28
|
SlotHeld: 'SLOT_HELD',
|
|
@@ -32,7 +32,7 @@ export const SchedulingCodes = {
|
|
|
32
32
|
export class SlotTaken extends DomainRefusal {
|
|
33
33
|
readonly code = 'SLOT_TAKEN';
|
|
34
34
|
}`,
|
|
35
|
-
good: `//
|
|
35
|
+
good: `// scheduling.codes.ts
|
|
36
36
|
export const SchedulingCodes = {
|
|
37
37
|
SlotTaken: 'SLOT_TAKEN',
|
|
38
38
|
} as const;
|
|
@@ -49,7 +49,7 @@ export class SlotTaken extends DomainRefusal {
|
|
|
49
49
|
}`,
|
|
50
50
|
},
|
|
51
51
|
'errors/known-code': {
|
|
52
|
-
why: 'The `errors` list of a route is what the OpenAPI document promises: one problem response per status of the codes it names. A code written there that no refusal sets, misspelled or left behind by a renamed factory, is a response the contract documents and the API never gives, while the refusal really raised is missing from it. A code exists when a factory or an error class of the context of the route sets it, when the
|
|
52
|
+
why: 'The `errors` list of a route is what the OpenAPI document promises: one problem response per status of the codes it names. A code written there that no refusal sets, misspelled or left behind by a renamed factory, is a response the contract documents and the API never gives, while the refusal really raised is missing from it. A code exists when a factory or an error class of the context of the route sets it, when the <context>.codes.ts of that context lists it (under "stack.refusals": "named"), when a class outside the contexts (the platform, the shared kernel) does, or when it is a code of the kit: VALIDATION_FAILED, NOT_FOUND, CONFLICT, INVARIANT_VIOLATION, UNAUTHORIZED, FORBIDDEN, NOT_ACCEPTABLE, CONCURRENCY_CONFLICT, INVALID_CRITERIA, INVALID_PAGE_REQUEST, TIMEOUT, CIRCUIT_OPEN, BULKHEAD_FULL, ATTEMPTS_EXHAUSTED, the conditions of a write: PRECONDITION_FAILED, PRECONDITION_REQUIRED, and the refusals of a file: FILE_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE, FILE_NOT_FOUND, FILE_REJECTED, INVALID_FILE_KEY. A code another context sets does not count: a context answers with its own language. Judged under "stack.refusals": "factories" and "named".',
|
|
53
53
|
bad: `// domain/errors/appointment.error.ts sets 'SLOT_TAKEN'
|
|
54
54
|
defineRoute({ method: 'POST', path: '/appointments', errors: ['FORBIDDEN', 'SLOT_ALREADY_TAKEN'], security: ['bearer'] }, book);`,
|
|
55
55
|
good: `defineRoute({ method: 'POST', path: '/appointments', errors: ['FORBIDDEN', 'SLOT_TAKEN'], security: ['bearer'] }, book);`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-docs.js","sourceRoot":"","sources":["../../../src/check/explain/errors-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"errors-docs.js","sourceRoot":"","sources":["../../../src/check/explain/errors-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,oBAAoB,EAAE;QACpB,GAAG,EAAE,ggCAAggC;QACrgC,GAAG,EAAE;;;;;;;;EAQP;QACE,IAAI,EAAE;;;;;;;;EAQR;KACC;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,qyCAAqyC;QAC1yC,GAAG,EAAE;;;;;;;;;EASP;QACE,IAAI,EAAE;;;;;;;;;;;;;;EAcR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,uoCAAuoC;QAC5oC,GAAG,EAAE;iIACwH;QAC7H,IAAI,EAAE,0HAA0H;KACjI;CACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const LANGUAGE_DOCS = {
|
|
2
2
|
'language/glossary-term': {
|
|
3
|
-
why: 'The ubiquitous language is the contract between the domain experts and the code. A class named with a word nobody defined is either a concept the experts do not know, or a synonym that will split the vocabulary in two. Writing the term and its meaning first forces the conversation that the name needs. Under "stack.refusals": "factories" or "named" the classes of domain/errors/ are judged too: `AppointmentError` names `Appointment`, `SlotTaken` names `Slot` and `Take`; a refusal class may also use the qualifiers of a refusal, invalid, unknown, already, too, no, missing and required (`BookingTooLate`, `InvalidAppointment`), and
|
|
3
|
+
why: 'The ubiquitous language is the contract between the domain experts and the code. A class named with a word nobody defined is either a concept the experts do not know, or a synonym that will split the vocabulary in two. Writing the term and its meaning first forces the conversation that the name needs. Under "stack.refusals": "factories" or "named" the classes of domain/errors/ are judged too: `AppointmentError` names `Appointment`, `SlotTaken` names `Slot` and `Take`; a refusal class may also use the qualifiers of a refusal, invalid, unknown, already, too, no, missing and required (`BookingTooLate`, `InvalidAppointment`), and <context>.codes.ts, which holds no class, is not judged.',
|
|
4
4
|
bad: `// CONTEXT.md glossary: Invoice, Issue
|
|
5
5
|
export class BillDispatcher {}`,
|
|
6
6
|
good: `// CONTEXT.md glossary: Invoice, Issue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-docs.js","sourceRoot":"","sources":["../../../src/check/explain/language-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D,wBAAwB,EAAE;QACxB,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"language-docs.js","sourceRoot":"","sources":["../../../src/check/explain/language-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAsC;IAC9D,wBAAwB,EAAE;QACxB,GAAG,EAAE,orBAAorB;QACzrB,GAAG,EAAE;+BACsB;QAC3B,IAAI,EAAE;oCAC0B;KACjC;IACD,4BAA4B,EAAE;QAC5B,GAAG,EAAE,+OAA+O;QACpP,GAAG,EAAE,gCAAgC;QACrC,IAAI,EAAE,kCAAkC;KACzC;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,y0EAAy0E;QAC90E,GAAG,EAAE;;;EAGP;QACE,IAAI,EAAE;;EAER;KACC;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,iQAAiQ;QACtQ,GAAG,EAAE,4DAA4D;QACjE,IAAI,EAAE,8DAA8D;KACrE;IACD,8BAA8B,EAAE;QAC9B,GAAG,EAAE,4QAA4Q;QACjR,GAAG,EAAE,uEAAuE;QAC5E,IAAI,EAAE,gEAAgE;KACvE;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,2QAA2Q;QAChR,GAAG,EAAE,6DAA6D;QAClE,IAAI,EAAE,yDAAyD;KAChE;CACF,CAAC"}
|
|
@@ -63,7 +63,7 @@ export abstract class TaxGateway {}
|
|
|
63
63
|
export interface IssueInvoiceResult { readonly invoiceId: string }`,
|
|
64
64
|
},
|
|
65
65
|
'clean/file-size': {
|
|
66
|
-
why: 'Past a few hundred lines a file holds more than one responsibility: nobody reads it whole, and every change touches something unrelated. The limit is 350 physical lines, for sources and tests alike, and is not configurable. A long test file is split by behaviour, a long source by concept. A long end-to-end spec is split into parts named after it, test/e2e/<use-case>-<behaviour>.e2e.spec.ts beside test/e2e/<use-case>.e2e.spec.ts (the one name of a new end-to-end spec the guard of the plugin lets be written by hand, with test/e2e/journey-<name>.e2e.spec.ts for a journey across use cases), and what its parts share goes to test/e2e/support/<context>/. An aggregate keeps its intention methods and moves a decision out: a domain service that takes the state and returns the new state and its events, which the aggregate applies, or a value object for fields that travel together; never a public method that sets its state from outside. Generated files (a path segment named generated, the <context>.declarations.ts and <context>.dependencies.ts at the root of a context, the <
|
|
66
|
+
why: 'Past a few hundred lines a file holds more than one responsibility: nobody reads it whole, and every change touches something unrelated. The limit is 350 physical lines, for sources and tests alike, and is not configurable. A long test file is split by behaviour, a long source by concept. A long end-to-end spec is split into parts named after it, test/e2e/<use-case>-<behaviour>.e2e.spec.ts beside test/e2e/<use-case>.e2e.spec.ts (the one name of a new end-to-end spec the guard of the plugin lets be written by hand, with test/e2e/journey-<name>.e2e.spec.ts for a journey across use cases), and what its parts share goes to test/e2e/support/<context>/. An aggregate keeps its intention methods and moves a decision out: a domain service that takes the state and returns the new state and its events, which the aggregate applies, or a value object for fields that travel together; never a public method that sets its state from outside. Generated files (a path segment named generated, the <context>.declarations.ts and <context>.dependencies.ts at the root of a context, the <layer>.declarations.ts of its layers) and declaration files are not judged.',
|
|
67
67
|
bad: `// application/commands/issue-invoice/issue-invoice.handler.ts, 600 lines:
|
|
68
68
|
// the handler, its validation, its mapping and three helpers`,
|
|
69
69
|
good: `// issue-invoice.handler.ts orchestrates, in 40 lines;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-docs.js","sourceRoot":"","sources":["../../../src/check/explain/layout-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,uBAAuB,EAAE;QACvB,GAAG,EAAE,qXAAqX;QAC1X,GAAG,EAAE;;;;;;EAMP;QACE,IAAI,EAAE;;;;;;EAMR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qgBAAqgB;QAC1gB,GAAG,EAAE;;;;EAIP;QACE,IAAI,EAAE;;;;EAIR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,ieAAie;QACte,GAAG,EAAE;;;;0CAIiC;QACtC,IAAI,EAAE;;;;;;;;;;EAUR;KACC;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,yrBAAyrB;QAC9rB,GAAG,EAAE;;;;iCAIwB;QAC7B,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"layout-docs.js","sourceRoot":"","sources":["../../../src/check/explain/layout-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,uBAAuB,EAAE;QACvB,GAAG,EAAE,qXAAqX;QAC1X,GAAG,EAAE;;;;;;EAMP;QACE,IAAI,EAAE;;;;;;EAMR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qgBAAqgB;QAC1gB,GAAG,EAAE;;;;EAIP;QACE,IAAI,EAAE;;;;EAIR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,ieAAie;QACte,GAAG,EAAE;;;;0CAIiC;QACtC,IAAI,EAAE;;;;;;;;;;EAUR;KACC;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,yrBAAyrB;QAC9rB,GAAG,EAAE;;;;iCAIwB;QAC7B,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,ooCAAooC;QACzoC,GAAG,EAAE;8DACqD;QAC1D,IAAI,EAAE;wFAC8E;KACrF;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/module-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"module-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/module-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmCzD,CAAC"}
|