ddd-ts-kit 0.82.0 → 0.83.2
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 +109 -0
- package/README.fr.md +128 -60
- package/README.md +124 -59
- package/dist/check/canonical/role.d.ts +2 -0
- package/dist/check/canonical/role.d.ts.map +1 -1
- package/dist/check/canonical/roles.js +1 -1
- package/dist/check/canonical/roles.js.map +1 -1
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/eslint-only-rules.js +3 -3
- package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
- package/dist/check/errors/builds-through-factories.d.ts +4 -1
- package/dist/check/errors/builds-through-factories.d.ts.map +1 -1
- package/dist/check/errors/builds-through-factories.js +6 -2
- package/dist/check/errors/builds-through-factories.js.map +1 -1
- package/dist/check/errors/code-entry.d.ts +8 -0
- package/dist/check/errors/code-entry.d.ts.map +1 -0
- package/dist/check/errors/code-entry.js +2 -0
- package/dist/check/errors/code-entry.js.map +1 -0
- package/dist/check/errors/code-list-name.d.ts +3 -0
- package/dist/check/errors/code-list-name.d.ts.map +1 -0
- package/dist/check/errors/code-list-name.js +6 -0
- package/dist/check/errors/code-list-name.js.map +1 -0
- package/dist/check/errors/code-list.d.ts +10 -0
- package/dist/check/errors/code-list.d.ts.map +1 -0
- package/dist/check/errors/code-list.js +2 -0
- package/dist/check/errors/code-list.js.map +1 -0
- package/dist/check/errors/codes-set-in.d.ts +9 -0
- package/dist/check/errors/codes-set-in.d.ts.map +1 -0
- package/dist/check/errors/codes-set-in.js +15 -0
- package/dist/check/errors/codes-set-in.js.map +1 -0
- package/dist/check/errors/error-codes.d.ts +2 -0
- package/dist/check/errors/error-codes.d.ts.map +1 -1
- package/dist/check/errors/error-codes.js +8 -0
- package/dist/check/errors/error-codes.js.map +1 -1
- package/dist/check/errors/is-codes-file.d.ts +4 -0
- package/dist/check/errors/is-codes-file.d.ts.map +1 -0
- package/dist/check/errors/is-codes-file.js +11 -0
- package/dist/check/errors/is-codes-file.js.map +1 -0
- package/dist/check/errors/is-error-file.d.ts +4 -0
- package/dist/check/errors/is-error-file.d.ts.map +1 -0
- package/dist/check/errors/is-error-file.js +6 -0
- package/dist/check/errors/is-error-file.js.map +1 -0
- package/dist/check/errors/listed-codes.d.ts +5 -0
- package/dist/check/errors/listed-codes.d.ts.map +1 -0
- package/dist/check/errors/listed-codes.js +12 -0
- package/dist/check/errors/listed-codes.js.map +1 -0
- package/dist/check/errors/names-refusals.d.ts +4 -0
- package/dist/check/errors/names-refusals.d.ts.map +1 -0
- package/dist/check/errors/names-refusals.js +5 -0
- package/dist/check/errors/names-refusals.js.map +1 -0
- package/dist/check/errors/read-code-list.d.ts +5 -0
- package/dist/check/errors/read-code-list.d.ts.map +1 -0
- package/dist/check/errors/read-code-list.js +32 -0
- package/dist/check/errors/read-code-list.js.map +1 -0
- package/dist/check/errors/refusal-classes.d.ts +8 -0
- package/dist/check/errors/refusal-classes.d.ts.map +1 -0
- package/dist/check/errors/refusal-classes.js +9 -0
- package/dist/check/errors/refusal-classes.js.map +1 -0
- package/dist/check/event-sourcing/declared-shape.d.ts +7 -1
- package/dist/check/event-sourcing/declared-shape.d.ts.map +1 -1
- package/dist/check/event-sourcing/declared-shape.js +12 -4
- package/dist/check/event-sourcing/declared-shape.js.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.d.ts.map +1 -1
- package/dist/check/event-sourcing/read-stored-shape.js +10 -2
- package/dist/check/event-sourcing/read-stored-shape.js.map +1 -1
- package/dist/check/event-sourcing/stored-event-declaration.d.ts +2 -0
- package/dist/check/event-sourcing/stored-event-declaration.d.ts.map +1 -1
- package/dist/check/event-sourcing/stored-event-declarations.js +1 -0
- package/dist/check/event-sourcing/stored-event-declarations.js.map +1 -1
- package/dist/check/event-sourcing/stored-shape.d.ts +2 -0
- package/dist/check/event-sourcing/stored-shape.d.ts.map +1 -1
- package/dist/check/explain/errors-docs.d.ts.map +1 -1
- package/dist/check/explain/errors-docs.js +30 -2
- 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/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +11 -0
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/errors-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/errors-fixtures.js +1 -1
- package/dist/check/fixtures/errors-fixtures.js.map +1 -1
- package/dist/check/fixtures/errors-route.d.ts +3 -0
- package/dist/check/fixtures/errors-route.d.ts.map +1 -0
- package/dist/check/fixtures/errors-route.js +6 -0
- package/dist/check/fixtures/errors-route.js.map +1 -0
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/named-refusal-fixtures.d.ts +4 -0
- package/dist/check/fixtures/named-refusal-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/named-refusal-fixtures.js +210 -0
- package/dist/check/fixtures/named-refusal-fixtures.js.map +1 -0
- package/dist/check/language/refusal-qualifiers.d.ts +8 -0
- package/dist/check/language/refusal-qualifiers.d.ts.map +1 -0
- package/dist/check/language/refusal-qualifiers.js +16 -0
- package/dist/check/language/refusal-qualifiers.js.map +1 -0
- package/dist/check/language/unknown-words.d.ts +2 -2
- package/dist/check/language/unknown-words.d.ts.map +1 -1
- package/dist/check/language/unknown-words.js +3 -2
- package/dist/check/language/unknown-words.js.map +1 -1
- package/dist/check/rules/authz-policy-asked.js +5 -2
- package/dist/check/rules/authz-policy-asked.js.map +1 -1
- package/dist/check/rules/errors-code-listed.d.ts +3 -0
- package/dist/check/rules/errors-code-listed.d.ts.map +1 -0
- package/dist/check/rules/errors-code-listed.js +160 -0
- package/dist/check/rules/errors-code-listed.js.map +1 -0
- package/dist/check/rules/errors-code-unique.d.ts.map +1 -1
- package/dist/check/rules/errors-code-unique.js +13 -8
- package/dist/check/rules/errors-code-unique.js.map +1 -1
- package/dist/check/rules/errors-known-code.d.ts.map +1 -1
- package/dist/check/rules/errors-known-code.js +17 -7
- package/dist/check/rules/errors-known-code.js.map +1 -1
- package/dist/check/rules/event-sourcing-upcaster-required.js +14 -4
- package/dist/check/rules/event-sourcing-upcaster-required.js.map +1 -1
- package/dist/check/rules/language-glossary-term.d.ts.map +1 -1
- package/dist/check/rules/language-glossary-term.js +10 -3
- package/dist/check/rules/language-glossary-term.js.map +1 -1
- package/dist/check/rules/naming-suffix.js +1 -1
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +16 -7
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/error-factories.d.ts +4 -2
- package/dist/commands/error-factories.d.ts.map +1 -1
- package/dist/commands/error-factories.js +74 -17
- package/dist/commands/error-factories.js.map +1 -1
- package/dist/config/open-api-problems.js +7 -6
- package/dist/config/open-api-problems.js.map +1 -1
- package/dist/config/stack.d.ts +9 -6
- package/dist/config/stack.d.ts.map +1 -1
- package/dist/config/stack.js +1 -1
- package/dist/config/stack.js.map +1 -1
- package/dist/describe/context-description.d.ts +7 -2
- package/dist/describe/context-description.d.ts.map +1 -1
- package/dist/describe/exposed-by.d.ts +7 -0
- package/dist/describe/exposed-by.d.ts.map +1 -0
- package/dist/describe/exposed-by.js +11 -0
- package/dist/describe/exposed-by.js.map +1 -0
- package/dist/describe/read-errors.d.ts +3 -1
- package/dist/describe/read-errors.d.ts.map +1 -1
- package/dist/describe/read-errors.js +18 -11
- package/dist/describe/read-errors.js.map +1 -1
- package/dist/describe/read-refusals.d.ts +11 -0
- package/dist/describe/read-refusals.d.ts.map +1 -0
- package/dist/describe/read-refusals.js +41 -0
- package/dist/describe/read-refusals.js.map +1 -0
- package/dist/describe/reference-lines.d.ts.map +1 -1
- package/dist/describe/reference-lines.js +18 -2
- package/dist/describe/reference-lines.js.map +1 -1
- package/dist/docs/formerly-recorded-stored-events.d.ts +9 -0
- package/dist/docs/formerly-recorded-stored-events.d.ts.map +1 -0
- package/dist/docs/formerly-recorded-stored-events.js +17 -0
- package/dist/docs/formerly-recorded-stored-events.js.map +1 -0
- package/dist/docs/write-stored-events-lock.d.ts +3 -2
- package/dist/docs/write-stored-events-lock.d.ts.map +1 -1
- package/dist/docs/write-stored-events-lock.js +10 -4
- package/dist/docs/write-stored-events-lock.js.map +1 -1
- package/dist/generate/concept.d.ts.map +1 -1
- package/dist/generate/concept.js +3 -29
- package/dist/generate/concept.js.map +1 -1
- package/dist/generate/errors/add-code.d.ts +13 -0
- package/dist/generate/errors/add-code.d.ts.map +1 -0
- package/dist/generate/errors/add-code.js +18 -0
- package/dist/generate/errors/add-code.js.map +1 -0
- package/dist/generate/errors/codes-list.d.ts +10 -0
- package/dist/generate/errors/codes-list.d.ts.map +1 -0
- package/dist/generate/errors/codes-list.js +25 -0
- package/dist/generate/errors/codes-list.js.map +1 -0
- package/dist/generate/errors/error-code-pattern.d.ts +3 -0
- package/dist/generate/errors/error-code-pattern.d.ts.map +1 -0
- package/dist/generate/errors/error-code-pattern.js +3 -0
- package/dist/generate/errors/error-code-pattern.js.map +1 -0
- package/dist/generate/errors/factory-prefix.d.ts +3 -0
- package/dist/generate/errors/factory-prefix.d.ts.map +1 -0
- package/dist/generate/errors/factory-prefix.js +3 -0
- package/dist/generate/errors/factory-prefix.js.map +1 -0
- package/dist/generate/errors/named-refusal-code.d.ts +17 -0
- package/dist/generate/errors/named-refusal-code.d.ts.map +1 -0
- package/dist/generate/errors/named-refusal-code.js +42 -0
- package/dist/generate/errors/named-refusal-code.js.map +1 -0
- package/dist/generate/errors/refusal-class-name.d.ts +8 -0
- package/dist/generate/errors/refusal-class-name.d.ts.map +1 -0
- package/dist/generate/errors/refusal-class-name.js +16 -0
- package/dist/generate/errors/refusal-class-name.js.map +1 -0
- package/dist/generate/errors/refusal-factory-name.d.ts +4 -0
- package/dist/generate/errors/refusal-factory-name.d.ts.map +1 -0
- package/dist/generate/errors/refusal-factory-name.js +15 -0
- package/dist/generate/errors/refusal-factory-name.js.map +1 -0
- package/dist/generate/errors/write-named-refusal.d.ts +18 -0
- package/dist/generate/errors/write-named-refusal.d.ts.map +1 -0
- package/dist/generate/errors/write-named-refusal.js +89 -0
- package/dist/generate/errors/write-named-refusal.js.map +1 -0
- package/dist/generate/kinds/domain-error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/domain-error-kind.js +12 -5
- package/dist/generate/kinds/domain-error-kind.js.map +1 -1
- package/dist/generate/kinds/error-kind.d.ts.map +1 -1
- package/dist/generate/kinds/error-kind.js +27 -12
- package/dist/generate/kinds/error-kind.js.map +1 -1
- package/dist/generate/spoken-in-language.d.ts +9 -0
- package/dist/generate/spoken-in-language.d.ts.map +1 -0
- package/dist/generate/spoken-in-language.js +39 -0
- package/dist/generate/spoken-in-language.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 +11 -5
- 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 +2 -2
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.js +1 -1
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-stack.js +2 -2
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/write-contracts.d.ts +9 -2
- package/dist/init/write-contracts.d.ts.map +1 -1
- package/dist/init/write-contracts.js +14 -4
- package/dist/init/write-contracts.js.map +1 -1
- package/dist/presets/identity-refusal.js +1 -1
- package/dist/presets/identity-refusal.js.map +1 -1
- package/dist/presets/identity-terms.d.ts.map +1 -1
- package/dist/presets/identity-terms.js +30 -0
- package/dist/presets/identity-terms.js.map +1 -1
- package/dist/presets/preset-files.d.ts.map +1 -1
- package/dist/presets/preset-files.js +4 -1
- package/dist/presets/preset-files.js.map +1 -1
- package/dist/refusals/aggregates-of.d.ts +10 -0
- package/dist/refusals/aggregates-of.d.ts.map +1 -0
- package/dist/refusals/aggregates-of.js +9 -0
- package/dist/refusals/aggregates-of.js.map +1 -0
- package/dist/refusals/applied-moves.d.ts +7 -0
- package/dist/refusals/applied-moves.d.ts.map +1 -0
- package/dist/refusals/applied-moves.js +2 -0
- package/dist/refusals/applied-moves.js.map +1 -0
- package/dist/refusals/apply-named-plan.d.ts +19 -0
- package/dist/refusals/apply-named-plan.d.ts.map +1 -0
- package/dist/refusals/apply-named-plan.js +46 -0
- package/dist/refusals/apply-named-plan.js.map +1 -0
- package/dist/refusals/apply-plan.d.ts.map +1 -1
- package/dist/refusals/apply-plan.js +21 -25
- package/dist/refusals/apply-plan.js.map +1 -1
- package/dist/refusals/code-without-imports.d.ts +3 -0
- package/dist/refusals/code-without-imports.d.ts.map +1 -0
- package/dist/refusals/code-without-imports.js +9 -0
- package/dist/refusals/code-without-imports.js.map +1 -0
- package/dist/refusals/concept-error-class.d.ts +26 -0
- package/dist/refusals/concept-error-class.d.ts.map +1 -0
- package/dist/refusals/concept-error-class.js +2 -0
- package/dist/refusals/concept-error-class.js.map +1 -0
- package/dist/refusals/concept-errors.d.ts +6 -0
- package/dist/refusals/concept-errors.d.ts.map +1 -0
- package/dist/refusals/concept-errors.js +16 -0
- package/dist/refusals/concept-errors.js.map +1 -0
- package/dist/refusals/concept-imports.d.ts +8 -0
- package/dist/refusals/concept-imports.d.ts.map +1 -0
- package/dist/refusals/concept-imports.js +33 -0
- package/dist/refusals/concept-imports.js.map +1 -0
- package/dist/refusals/concept-leftovers.d.ts +5 -0
- package/dist/refusals/concept-leftovers.d.ts.map +1 -0
- package/dist/refusals/concept-leftovers.js +26 -0
- package/dist/refusals/concept-leftovers.js.map +1 -0
- package/dist/refusals/concept-named.d.ts +3 -0
- package/dist/refusals/concept-named.d.ts.map +1 -0
- package/dist/refusals/concept-named.js +13 -0
- package/dist/refusals/concept-named.js.map +1 -0
- package/dist/refusals/concerns.d.ts +16 -0
- package/dist/refusals/concerns.d.ts.map +1 -0
- package/dist/refusals/concerns.js +9 -0
- package/dist/refusals/concerns.js.map +1 -0
- package/dist/refusals/cut-factories.d.ts +7 -0
- package/dist/refusals/cut-factories.d.ts.map +1 -0
- package/dist/refusals/cut-factories.js +30 -0
- package/dist/refusals/cut-factories.js.map +1 -0
- package/dist/refusals/earlier-guidance.d.ts +8 -0
- package/dist/refusals/earlier-guidance.d.ts.map +1 -0
- package/dist/refusals/earlier-guidance.js +21 -0
- package/dist/refusals/earlier-guidance.js.map +1 -0
- package/dist/refusals/factory-for-parameter.d.ts +7 -0
- package/dist/refusals/factory-for-parameter.d.ts.map +1 -0
- package/dist/refusals/factory-for-parameter.js +17 -0
- package/dist/refusals/factory-for-parameter.js.map +1 -0
- package/dist/refusals/first-parameter.d.ts +6 -0
- package/dist/refusals/first-parameter.d.ts.map +1 -0
- package/dist/refusals/first-parameter.js +12 -0
- package/dist/refusals/first-parameter.js.map +1 -0
- package/dist/refusals/ignore-code-types.d.ts +10 -0
- package/dist/refusals/ignore-code-types.d.ts.map +1 -0
- package/dist/refusals/ignore-code-types.js +53 -0
- package/dist/refusals/ignore-code-types.js.map +1 -0
- package/dist/refusals/imports-used-by.d.ts +6 -0
- package/dist/refusals/imports-used-by.d.ts.map +1 -0
- package/dist/refusals/imports-used-by.js +32 -0
- package/dist/refusals/imports-used-by.js.map +1 -0
- package/dist/refusals/leave-origins.d.ts +10 -0
- package/dist/refusals/leave-origins.d.ts.map +1 -0
- package/dist/refusals/leave-origins.js +35 -0
- package/dist/refusals/leave-origins.js.map +1 -0
- package/dist/refusals/legacy-move.d.ts +5 -0
- package/dist/refusals/legacy-move.d.ts.map +1 -0
- package/dist/refusals/legacy-move.js +14 -0
- package/dist/refusals/legacy-move.js.map +1 -0
- package/dist/refusals/markdown-files.d.ts +4 -0
- package/dist/refusals/markdown-files.d.ts.map +1 -0
- package/dist/refusals/markdown-files.js +13 -0
- package/dist/refusals/markdown-files.js.map +1 -0
- package/dist/refusals/member-start.d.ts +3 -0
- package/dist/refusals/member-start.d.ts.map +1 -0
- package/dist/refusals/member-start.js +14 -0
- package/dist/refusals/member-start.js.map +1 -0
- package/dist/refusals/migration-targets.d.ts +3 -0
- package/dist/refusals/migration-targets.d.ts.map +1 -0
- package/dist/refusals/migration-targets.js +3 -0
- package/dist/refusals/migration-targets.js.map +1 -0
- package/dist/refusals/move-named-specs.d.ts +16 -0
- package/dist/refusals/move-named-specs.d.ts.map +1 -0
- package/dist/refusals/move-named-specs.js +119 -0
- package/dist/refusals/move-named-specs.js.map +1 -0
- package/dist/refusals/move.d.ts +6 -1
- package/dist/refusals/move.d.ts.map +1 -1
- package/dist/refusals/named-move.d.ts +23 -0
- package/dist/refusals/named-move.d.ts.map +1 -0
- package/dist/refusals/named-move.js +2 -0
- package/dist/refusals/named-move.js.map +1 -0
- package/dist/refusals/named-moves.d.ts +10 -0
- package/dist/refusals/named-moves.d.ts.map +1 -0
- package/dist/refusals/named-moves.js +64 -0
- package/dist/refusals/named-moves.js.map +1 -0
- package/dist/refusals/named-plan.d.ts +7 -0
- package/dist/refusals/named-plan.d.ts.map +1 -0
- package/dist/refusals/named-plan.js +2 -0
- package/dist/refusals/named-plan.js.map +1 -0
- package/dist/refusals/own-factory.d.ts +14 -0
- package/dist/refusals/own-factory.d.ts.map +1 -0
- package/dist/refusals/own-factory.js +38 -0
- package/dist/refusals/own-factory.js.map +1 -0
- package/dist/refusals/plan-target.d.ts +7 -0
- package/dist/refusals/plan-target.d.ts.map +1 -0
- package/dist/refusals/plan-target.js +13 -0
- package/dist/refusals/plan-target.js.map +1 -0
- package/dist/refusals/planned-refusal.d.ts +13 -0
- package/dist/refusals/planned-refusal.d.ts.map +1 -0
- package/dist/refusals/planned-refusal.js +2 -0
- package/dist/refusals/planned-refusal.js.map +1 -0
- package/dist/refusals/propose-named-plan.d.ts +25 -0
- package/dist/refusals/propose-named-plan.d.ts.map +1 -0
- package/dist/refusals/propose-named-plan.js +67 -0
- package/dist/refusals/propose-named-plan.js.map +1 -0
- package/dist/refusals/propose-plan.d.ts.map +1 -1
- package/dist/refusals/propose-plan.js +3 -19
- package/dist/refusals/propose-plan.js.map +1 -1
- package/dist/refusals/read-concept-error.d.ts +9 -0
- package/dist/refusals/read-concept-error.d.ts.map +1 -0
- package/dist/refusals/read-concept-error.js +51 -0
- package/dist/refusals/read-concept-error.js.map +1 -0
- package/dist/refusals/read-named-plan.d.ts +4 -0
- package/dist/refusals/read-named-plan.d.ts.map +1 -0
- package/dist/refusals/read-named-plan.js +57 -0
- package/dist/refusals/read-named-plan.js.map +1 -0
- package/dist/refusals/refusal-class-file.d.ts +15 -0
- package/dist/refusals/refusal-class-file.d.ts.map +1 -0
- package/dist/refusals/refusal-class-file.js +38 -0
- package/dist/refusals/refusal-class-file.js.map +1 -0
- package/dist/refusals/rename-concept.d.ts +7 -0
- package/dist/refusals/rename-concept.d.ts.map +1 -0
- package/dist/refusals/rename-concept.js +15 -0
- package/dist/refusals/rename-concept.js.map +1 -0
- package/dist/refusals/render-factory.d.ts +1 -1
- package/dist/refusals/render-factory.d.ts.map +1 -1
- package/dist/refusals/render-factory.js +3 -2
- package/dist/refusals/render-factory.js.map +1 -1
- package/dist/refusals/rewrite-concept-usages.d.ts +11 -0
- package/dist/refusals/rewrite-concept-usages.d.ts.map +1 -0
- package/dist/refusals/rewrite-concept-usages.js +61 -0
- package/dist/refusals/rewrite-concept-usages.js.map +1 -0
- package/dist/refusals/rewrite-named-usages.d.ts +9 -0
- package/dist/refusals/rewrite-named-usages.d.ts.map +1 -0
- package/dist/refusals/rewrite-named-usages.js +14 -0
- package/dist/refusals/rewrite-named-usages.js.map +1 -0
- package/dist/refusals/rewrite-usages.d.ts.map +1 -1
- package/dist/refusals/rewrite-usages.js +10 -6
- package/dist/refusals/rewrite-usages.js.map +1 -1
- package/dist/refusals/say-refusals.d.ts +3 -0
- package/dist/refusals/say-refusals.d.ts.map +1 -0
- package/dist/refusals/say-refusals.js +8 -0
- package/dist/refusals/say-refusals.js.map +1 -0
- package/dist/refusals/split-concept-spec.d.ts +19 -0
- package/dist/refusals/split-concept-spec.d.ts.map +1 -0
- package/dist/refusals/split-concept-spec.js +74 -0
- package/dist/refusals/split-concept-spec.js.map +1 -0
- package/dist/refusals/stale-mentions.d.ts +10 -0
- package/dist/refusals/stale-mentions.d.ts.map +1 -0
- package/dist/refusals/stale-mentions.js +41 -0
- package/dist/refusals/stale-mentions.js.map +1 -0
- package/dist/refusals/undefined-words.d.ts +15 -0
- package/dist/refusals/undefined-words.d.ts.map +1 -0
- package/dist/refusals/undefined-words.js +26 -0
- package/dist/refusals/undefined-words.js.map +1 -0
- package/dist/refusals/with-codes.d.ts +11 -0
- package/dist/refusals/with-codes.d.ts.map +1 -0
- package/dist/refusals/with-codes.js +46 -0
- package/dist/refusals/with-codes.js.map +1 -0
- package/dist/refusals/with-imports.d.ts +3 -0
- package/dist/refusals/with-imports.d.ts.map +1 -0
- package/dist/refusals/with-imports.js +8 -0
- package/dist/refusals/with-imports.js.map +1 -0
- package/dist/refusals/write-refusal-classes.d.ts +9 -0
- package/dist/refusals/write-refusal-classes.d.ts.map +1 -0
- package/dist/refusals/write-refusal-classes.js +23 -0
- package/dist/refusals/write-refusal-classes.js.map +1 -0
- package/dist/stack/stack-vars.js +1 -1
- package/dist/stack/stack-vars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/templates/aggregate/aggregate.ts.tpl +3 -0
- package/templates/aggregate/event-sourced.aggregate.ts.tpl +3 -0
- package/templates/command/handler.declared.ts.tpl +3 -0
- package/templates/command/handler.ts.tpl +3 -0
- package/templates/entity/entity.ts.tpl +3 -0
- package/templates/error/codes.ts.tpl +5 -0
- package/templates/error/refusal-case.spec.ts.tpl +8 -0
- package/templates/error/refusal-factory.ts.tpl +4 -0
- package/templates/error/refusal.spec.ts.tpl +7 -0
- package/templates/error/refusal.ts.tpl +8 -0
- package/templates/init/rules/domain.md.tpl +9 -2
- package/templates/init/rules/presentation.md.tpl +3 -0
- package/templates/init/scripts/events.ts.tpl +19 -1
- package/templates/init/scripts/openapi.ts.tpl +19 -1
- package/templates/pipeline/knip.json.tpl +5 -0
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/application/commands/accept-invitation/accept-invitation.handler.ts.tpl +22 -0
- package/templates/presets/identity/context/application/commands/change-member-role/change-member-role.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/decline-invitation/decline-invitation.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/grant-delegation/grant-delegation.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/open-organisation/open-organisation.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/provision-account/provision-account.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/remove-member/remove-member.handler.ts.tpl +16 -0
- package/templates/presets/identity/context/application/commands/revoke-delegation/revoke-delegation.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/application/commands/revoke-invitation/revoke-invitation.handler.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/aggregates/account.aggregate.ts.tpl +16 -0
- package/templates/presets/identity/context/domain/aggregates/delegation.aggregate.ts.tpl +28 -0
- package/templates/presets/identity/context/domain/aggregates/invitation.aggregate.ts.tpl +27 -0
- package/templates/presets/identity/context/domain/aggregates/member.aggregate.ts.tpl +31 -0
- package/templates/presets/identity/context/domain/errors/above-own-role.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/account-already-deactivated.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/already-member.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/codes.named.ts.tpl +33 -0
- package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/delegation-period-inverted.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/invalid-organisation-name.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/invalid-organisation-slug.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation-not-addressed-to-account.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/last-owner.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/not-an-owner.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/own-role.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/right-not-in-role.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/unknown-account.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl +11 -0
- package/templates/presets/identity/context/domain/errors/unknown-member.error.named.ts.tpl +13 -0
- package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl +12 -0
- package/templates/presets/identity/context/domain/value-objects/delegation-period.vo.ts.tpl +16 -0
- package/templates/presets/identity/context/domain/value-objects/display-name.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/value-objects/email-address.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-name.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/domain/value-objects/organisation-slug.vo.ts.tpl +10 -0
- package/templates/presets/identity/context/test/unit/provision-account.controller.spec.ts.tpl +13 -0
- package/templates/state-machine/state-machine.ts.tpl +5 -0
- package/templates/value-object/value-object.ts.tpl +6 -0
- /package/templates/presets/identity/context/domain/errors/{account.error.ts.tpl → account.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{delegation.error.ts.tpl → delegation.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{invitation.error.ts.tpl → invitation.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{member.error.ts.tpl → member.error.factories.ts.tpl} +0 -0
- /package/templates/presets/identity/context/domain/errors/{organisation.error.ts.tpl → organisation.error.factories.ts.tpl} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-imports.js","sourceRoot":"","sources":["../../src/refusals/with-imports.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,OAA0B;IACpE,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,EAAE,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { MigrationDraft } from './migration-draft.js';
|
|
3
|
+
import type { NamedMove } from './named-move.js';
|
|
4
|
+
/**
|
|
5
|
+
* Writes one file per refusal class, with the factories of its moves, and the list of the codes
|
|
6
|
+
* of each context that names those classes, in the order of the plan.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeRefusalClasses(config: Config, moves: readonly NamedMove[], draft: MigrationDraft): void;
|
|
9
|
+
//# sourceMappingURL=write-refusal-classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-refusal-classes.d.ts","sourceRoot":"","sources":["../../src/refusals/write-refusal-classes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAkB5G"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { specifierOf } from '../alias/index.js';
|
|
2
|
+
import { refusalClassFile } from './refusal-class-file.js';
|
|
3
|
+
import { withCodes } from './with-codes.js';
|
|
4
|
+
/**
|
|
5
|
+
* Writes one file per refusal class, with the factories of its moves, and the list of the codes
|
|
6
|
+
* of each context that names those classes, in the order of the plan.
|
|
7
|
+
*/
|
|
8
|
+
export function writeRefusalClasses(config, moves, draft) {
|
|
9
|
+
for (const context of [...new Set(moves.map((move) => move.context))]) {
|
|
10
|
+
const errors = `${config.contextsDir}/${context}/domain/errors`;
|
|
11
|
+
const codesFile = `${errors}/codes.ts`;
|
|
12
|
+
const own = moves.filter((move) => move.context === context);
|
|
13
|
+
for (const className of [...new Set(own.map((move) => move.className))]) {
|
|
14
|
+
const ofClass = own.filter((move) => move.className === className);
|
|
15
|
+
const file = `${errors}/${ofClass[0]?.classFile ?? ''}.ts`;
|
|
16
|
+
const refusal = { file, className, context, codesSpecifier: specifierOf(config, codesFile), moves: ofClass };
|
|
17
|
+
draft.write(file, refusalClassFile(draft.read(file), refusal));
|
|
18
|
+
}
|
|
19
|
+
const entries = own.map((move) => ({ key: move.className, code: move.code }));
|
|
20
|
+
draft.write(codesFile, withCodes(draft.read(codesFile), context, entries));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=write-refusal-classes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-refusal-classes.js","sourceRoot":"","sources":["../../src/refusals/write-refusal-classes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc,EAAE,KAA2B,EAAE,KAAqB;IACpG,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,MAAM,MAAM,GAAG,GAAG,M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/stack/stack-vars.js
CHANGED
|
@@ -63,7 +63,7 @@ function queueVars(config) {
|
|
|
63
63
|
function modelWritingVars(config) {
|
|
64
64
|
const { refusals, schemas, valueObjects, literals, values } = config.stack;
|
|
65
65
|
return {
|
|
66
|
-
refusals: one(refusals, ['factories', 'classes']),
|
|
66
|
+
refusals: one(refusals, ['named', 'factories', 'classes']),
|
|
67
67
|
schemas: one(schemas, ['shared', 'per-route']),
|
|
68
68
|
valueObjects: one(valueObjects, ['throwing', 'result']),
|
|
69
69
|
literals: one(literals, ['named', 'free']),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-vars.js","sourceRoot":"","sources":["../../src/stack/stack-vars.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,6GAA6G;AAC7G,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,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AC;QAC5D,GAAG,EAAE,IAAI,KAAK,MAAM;QACpB,KAAK,EAAE,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,MAAM;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.83.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.83.2';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.2",
|
|
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,6 +52,6 @@
|
|
|
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/kernel": "^0.
|
|
55
|
+
"@ddd-ts-kit/kernel": "^0.83.2"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -14,6 +14,9 @@ export class {{name.pascal}} extends AggregateRoot<string> {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
static create(id: string, now: Date): {{name.pascal}} {
|
|
17
|
+
{{#if refusals.named}}
|
|
18
|
+
// TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal named after it when one is violated: `throw <Refusal>.for<Fact>(...)`, written with `ddd-ts-kit generate error {{context.kebab}} <Refusal> <factory>`.
|
|
19
|
+
{{/if}}
|
|
17
20
|
{{#if refusals.factories}}
|
|
18
21
|
// TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal of its error class when one is violated: `throw {{name.pascal}}Error.<refusal>(...)`, added with `ddd-ts-kit generate error {{context.kebab}} {{name.pascal}} <refusal>`.
|
|
19
22
|
{{/if}}
|
|
@@ -16,6 +16,9 @@ export class {{name.pascal}} extends EventSourcedAggregate<{{name.pascal}}Event,
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
static create(id: string, now: Date): {{name.pascal}} {
|
|
19
|
+
{{#if refusals.named}}
|
|
20
|
+
// TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal named after it when one is violated: `throw <Refusal>.for<Fact>(...)`, written with `ddd-ts-kit generate error {{context.kebab}} <Refusal> <factory>`.
|
|
21
|
+
{{/if}}
|
|
19
22
|
{{#if refusals.factories}}
|
|
20
23
|
// TODO(domain): take the facts known at birth as parameters, check each birth invariant and throw the refusal of its error class when one is violated: `throw {{name.pascal}}Error.<refusal>(...)`, added with `ddd-ts-kit generate error {{context.kebab}} {{name.pascal}} <refusal>`.
|
|
21
24
|
{{/if}}
|
|
@@ -28,6 +28,9 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
|
|
|
28
28
|
await this.access.authorize(command.actor, {{access.reference}}, command);
|
|
29
29
|
|
|
30
30
|
{{/if}}
|
|
31
|
+
{{#if refusals.named}}
|
|
32
|
+
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its refusal when there is none, `Unknown{{aggregate.pascal}}.for{{aggregate.pascal}}(id)` (`ddd-ts-kit generate error {{context.kebab}} Unknown{{aggregate.pascal}} for{{aggregate.pascal}}`), call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
33
|
+
{{/if}}
|
|
31
34
|
{{#if refusals.factories}}
|
|
32
35
|
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
33
36
|
{{/if}}
|
|
@@ -26,6 +26,9 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
|
|
|
26
26
|
await this.access.authorize(command.actor, {{access.reference}}, command);
|
|
27
27
|
|
|
28
28
|
{{/if}}
|
|
29
|
+
{{#if refusals.named}}
|
|
30
|
+
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its refusal when there is none, `Unknown{{aggregate.pascal}}.for{{aggregate.pascal}}(id)` (`ddd-ts-kit generate error {{context.kebab}} Unknown{{aggregate.pascal}} for{{aggregate.pascal}}`), call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
31
|
+
{{/if}}
|
|
29
32
|
{{#if refusals.factories}}
|
|
30
33
|
// TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
|
|
31
34
|
{{/if}}
|
|
@@ -13,6 +13,9 @@ export class {{name.pascal}} extends Entity<string> {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
static create(id: string, state: {{name.pascal}}State): {{name.pascal}} {
|
|
16
|
+
{{#if refusals.named}}
|
|
17
|
+
// TODO(domain): check the invariants {{name.pascal}} guards on its own and throw the refusal named after one when it is violated (`ddd-ts-kit generate error {{context.kebab}} <Refusal> <factory>`); invariants spanning several entities belong to the aggregate root.
|
|
18
|
+
{{/if}}
|
|
16
19
|
{{#if refusals.factories}}
|
|
17
20
|
// TODO(domain): check the invariants {{name.pascal}} guards on its own and throw a refusal of the error class of its aggregate when one is violated (`ddd-ts-kit generate error {{context.kebab}} <Concept> <refusal>`); invariants spanning several entities belong to the aggregate root.
|
|
18
21
|
{{/if}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
it('refuses {{factory.words}} with the code {{error.code}}', () => {
|
|
2
|
+
const error = {{name.pascal}}.{{factory.camel}}();
|
|
3
|
+
|
|
4
|
+
expect(error).toBeInstanceOf(DomainRefusal);
|
|
5
|
+
expect(error.code).toBe('{{error.code}}');
|
|
6
|
+
expect(error.message).toBe('{{name.title}}.');
|
|
7
|
+
expect(error.facts).toEqual({});
|
|
8
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
static {{factory.camel}}() {
|
|
2
|
+
// TODO(domain): take as parameters what `{{factory.camel}}` names and the facts that explain the refusal (which {{context.words}} rule, which value), give them as the second argument and write a message a domain expert would recognise; a fact reaches the client only when named: `.exposing('<fact>')`. The code is the stable contract.
|
|
3
|
+
return {{name.pascal}}.refusal('{{name.title}}.');
|
|
4
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { describe, expect, it } from '{{tests.module}}';
|
|
2
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
3
|
+
import { {{name.pascal}} } from '{{alias.context}}/domain/errors/{{name.kebab}}.error{{alias.ext}}';
|
|
4
|
+
|
|
5
|
+
describe('{{name.pascal}}', () => {
|
|
6
|
+
{{error.case}}
|
|
7
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{codes.list}} } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class {{name.pascal}} extends DomainRefusal {
|
|
5
|
+
readonly code = {{codes.list}}.{{name.pascal}};
|
|
6
|
+
|
|
7
|
+
{{error.factory}}
|
|
8
|
+
}
|
|
@@ -15,6 +15,10 @@ paths:
|
|
|
15
15
|
- A closed list of values (a status, a kind, a role of the model) is a vocabulary, `npx ddd-ts-kit generate vocabulary <context> <Name> --value <value>...`: code reads `AppointmentStatus.NoShow`, never the string (`language/declared-vocabulary`).
|
|
16
16
|
- No number without a name: 0, 1, -1 and an index only; a duration, a limit or a rate is a constant of the module (`const MINUTES_PER_HOUR = 60;`) or a value object (`clean/no-magic-number`).
|
|
17
17
|
{{/if}}
|
|
18
|
+
{{#if refusals.named}}
|
|
19
|
+
- A violated invariant throws a refusal built by a static factory of the class named after it, never `new` and never a bare `Error`: `throw InvoiceAlreadyIssued.forInvoice(this.id)` (`errors/through-factory`, `domain/no-generic-error`). One class per refusal in `domain/errors/<refusal>.error.ts`, extending `DomainRefusal`, named after what is refused and never `...Error`, no constructor (`errors/constructor-not-public`); a factory is named after what the refusal is about, `for`, `with`, `because`, `on` or `at` then a capital letter, no digit: `forInvoice`, `withNotice`, `becauseOf` (`errors/factory-name`). The class reads its code from the closed list of its context, `domain/errors/codes.ts`, `readonly code = BillingCodes.InvoiceAlreadyIssued;`: one entry per refusal class and no other, in constant case (`errors/code-listed`), one code per refusal (`errors/code-unique`). The code is the contract a client reads: a renamed class keeps it.
|
|
20
|
+
- A factory takes the facts of the refusal as typed parameters and gives them to `refusal(message, facts)`. Facts are private: one reaches a client only when the factory names it, `.exposing('<fact>')`, and never when it identifies a person. A caught refusal is recognised with `InvoiceAlreadyIssued.is(error)`.
|
|
21
|
+
{{/if}}
|
|
18
22
|
{{#if refusals.factories}}
|
|
19
23
|
- A violated invariant throws a refusal built by a static factory of the error class of its concept, never `new` and never a bare `Error`: `throw InvoiceError.alreadyIssued(this.id)` (`errors/through-factory`, `domain/no-generic-error`). One class per concept of the glossary in `domain/errors/`, extending `ConceptError`, no constructor (`errors/constructor-not-public`); a factory is named after the refusal and its code says the same words (`errors/factory-name`), one code per refusal of the context (`errors/code-unique`).
|
|
20
24
|
- A factory takes the facts of the refusal as typed parameters and gives them to `refusal(code, message, facts)`. Facts are private: one reaches a client only when the factory names it, `.exposing('<fact>')`, and never when it identifies a person.
|
|
@@ -23,16 +27,19 @@ paths:
|
|
|
23
27
|
- A violated invariant throws a `DomainError` of `domain/errors/` with a stable `code`, never a bare `Error` (`domain/no-generic-error`).
|
|
24
28
|
{{/if}}
|
|
25
29
|
{{#if valueObjects.throwing}}
|
|
26
|
-
- A value object refuses in `create` as the rest of the domain does: it returns the value object or throws the refusal of the concept it describes{{#if refusals.factories}} (`throw PersonError.invalidEmail(raw)`){{/if}}. The caller takes the value as it is, with no `unwrap`; a spec asserts the refusal with `expectRefusal(() => Email.create(raw), 'INVALID_EMAIL')`.
|
|
30
|
+
- A value object refuses in `create` as the rest of the domain does: it returns the value object or throws the refusal of the concept it describes{{#if refusals.named}} (`throw InvalidEmail.forAddress(raw)`){{/if}}{{#if refusals.factories}} (`throw PersonError.invalidEmail(raw)`){{/if}}. The caller takes the value as it is, with no `unwrap`; a spec asserts the refusal with `expectRefusal(() => Email.create(raw), 'INVALID_EMAIL')`.
|
|
27
31
|
{{/if}}
|
|
28
32
|
{{#if valueObjects.result}}
|
|
29
|
-
- A value object returns its refusals in the `Result` of `create`{{#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.
|
|
33
|
+
- 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.
|
|
30
34
|
{{/if}}
|
|
31
35
|
- 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.
|
|
32
36
|
- 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.
|
|
33
37
|
- 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.
|
|
34
38
|
- Time and identifiers come in as parameters (`purity/*`); nothing here knows the acting user or its rights (`authz/in-application`).
|
|
35
39
|
- 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`).
|
|
40
|
+
{{#if refusals.named}}
|
|
41
|
+
- The language first, with `/ddd-ts-kit:glossary`. Then create with `npx ddd-ts-kit generate aggregate|entity|value-object|vocabulary|domain-event|domain-service|repository ... --json`, a refusal with `npx ddd-ts-kit generate error <context> <Refusal> <factory> --json` (it writes the class and its code in `codes.ts` when absent, adds the factory, and its case to the spec), and fill the `TODO(domain)` places it lists.
|
|
42
|
+
{{/if}}
|
|
36
43
|
{{#if refusals.factories}}
|
|
37
44
|
- The language first, with `/ddd-ts-kit:glossary`. Then create with `npx ddd-ts-kit generate aggregate|entity|value-object|vocabulary|domain-event|domain-service|repository ... --json`, a refusal with `npx ddd-ts-kit generate error <context> <Concept> <refusal> --json` (it adds the factory to the class of the concept, and its case to the spec), and fill the `TODO(domain)` places it lists.
|
|
38
45
|
{{/if}}
|
|
@@ -21,6 +21,9 @@ paths:
|
|
|
21
21
|
{{/if}}
|
|
22
22
|
- Imports `application/` (and domain types for mapping), never `infrastructure/` (`layer/presentation-no-infrastructure`).
|
|
23
23
|
- Input shape is validated here with the schema library of the project, behind the `Schema` port. Business rules are not validated here.
|
|
24
|
+
{{#if refusals.named}}
|
|
25
|
+
- Every route says who may call it (its group or its guards for a controller, `security` for a function) and the codes of the refusals it can answer in `errors`, as the `codes.ts` of its context lists them (`errors/known-code`); the mapping from code to status lives in one place, the error mapper. A client reads the `code`, under `facts` only what a factory exposed, and the message of the refusal as `detail` unless it quotes a fact that is not exposed.
|
|
26
|
+
{{/if}}
|
|
24
27
|
{{#if refusals.factories}}
|
|
25
28
|
- Every route says who may call it (its group or its guards for a controller, `security` for a function) and the codes of the refusals it can answer in `errors`, as their factories set them (`errors/known-code`); the mapping from code to status lives in one place, the error mapper. A client reads the `code`, under `facts` only what a factory exposed, and the message of the refusal as `detail` unless it quotes a fact that is not exposed.
|
|
26
29
|
{{/if}}
|
|
@@ -13,6 +13,10 @@ const catalog = path.resolve('docs/integration');
|
|
|
13
13
|
const format = contractFormat();
|
|
14
14
|
const other = format === 'yaml' ? 'asyncapi.json' : 'asyncapi.yaml';
|
|
15
15
|
|
|
16
|
+
// What init leaves when the events are known only to the running application (a preset): the
|
|
17
|
+
// first check writes both files, to commit; on a pipeline (CI set), it fails until they are.
|
|
18
|
+
const PENDING = 'x-ddd-ts-kit-pending';
|
|
19
|
+
|
|
16
20
|
/** The type of each declaration by the name its published language exports it under, `invoiceIssuedV1`: what a handler reads with `invoiceIssuedV1.type`. */
|
|
17
21
|
const typesByName = new Map<string, string>();
|
|
18
22
|
const registry = createEventRegistry(await declaredEvents());
|
|
@@ -46,7 +50,9 @@ function reportStale(): void {
|
|
|
46
50
|
for (const [file, content] of Object.entries(generated)) {
|
|
47
51
|
const committed = fs.existsSync(path.join(catalog, file)) ? fs.readFileSync(path.join(catalog, file), 'utf8') : '';
|
|
48
52
|
|
|
49
|
-
if (committed.
|
|
53
|
+
if (committed.includes(PENDING)) {
|
|
54
|
+
writeFirst(file, content);
|
|
55
|
+
} else if (committed.replaceAll('\r\n', '\n') !== content) {
|
|
50
56
|
console.error('docs/integration/' + file + ' is out of date: run the script `docs:generate` and commit it.');
|
|
51
57
|
process.exitCode = 1;
|
|
52
58
|
}
|
|
@@ -58,6 +64,18 @@ function reportStale(): void {
|
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
|
67
|
+
function writeFirst(file: string, content: string): void {
|
|
68
|
+
if (process.env['CI'] !== undefined) {
|
|
69
|
+
console.error('docs/integration/' + file + ' was never generated: run the script `docs:generate` and commit it.');
|
|
70
|
+
process.exitCode = 1;
|
|
71
|
+
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
fs.writeFileSync(path.join(catalog, file), content);
|
|
76
|
+
console.error('docs/integration/' + file + ' is written for the first time, from the declarations of the events: commit it.');
|
|
77
|
+
}
|
|
78
|
+
|
|
61
79
|
/** Every declaration exported by a published language. Read from the compiled modules next to this script, so that a new context needs no registration: a path completed at run time cannot be an import alias, which the build rewrites. */
|
|
62
80
|
async function declaredEvents(): Promise<AnyIntegrationEventDefinition[]> {
|
|
63
81
|
const declarations: AnyIntegrationEventDefinition[] = [];
|
|
@@ -19,6 +19,10 @@ import { OPENAPI_DOCUMENTS } from '{{alias.platform}}/http/openapi-documents{{al
|
|
|
19
19
|
{{/if}}
|
|
20
20
|
// with --check, fails when a committed file differs. Build products: never edit them by hand.
|
|
21
21
|
const directory = path.resolve('openapi');
|
|
22
|
+
|
|
23
|
+
// What init leaves when the routes are known only to the running application (a preset): the
|
|
24
|
+
// first check writes the contract, to commit; on a pipeline (CI set), it fails until it is.
|
|
25
|
+
const PENDING = 'x-ddd-ts-kit-pending';
|
|
22
26
|
const format = contractFormat();
|
|
23
27
|
|
|
24
28
|
const application = composeApplication(inertPersistence(), {
|
|
@@ -68,7 +72,9 @@ function reportDrift(): void {
|
|
|
68
72
|
const contract = path.join(directory, file);
|
|
69
73
|
const committed = fs.existsSync(contract) ? fs.readFileSync(contract, 'utf8') : '';
|
|
70
74
|
|
|
71
|
-
if (committed.
|
|
75
|
+
if (committed.includes(PENDING)) {
|
|
76
|
+
writeFirst(file, content);
|
|
77
|
+
} else if (committed.replaceAll('\r\n', '\n') !== content) {
|
|
72
78
|
console.error(`openapi/${file} is out of date: run the script \`docs:generate\` and commit it.`);
|
|
73
79
|
process.exitCode = 1;
|
|
74
80
|
}
|
|
@@ -80,6 +86,18 @@ function reportDrift(): void {
|
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
function writeFirst(file: string, content: string): void {
|
|
90
|
+
if (process.env['CI'] !== undefined) {
|
|
91
|
+
console.error(`openapi/${file} was never generated: run the script \`docs:generate\` and commit it.`);
|
|
92
|
+
process.exitCode = 1;
|
|
93
|
+
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
fs.writeFileSync(path.join(directory, file), content);
|
|
98
|
+
console.error(`openapi/${file} is written for the first time, from the routes of the application: commit it.`);
|
|
99
|
+
}
|
|
100
|
+
|
|
83
101
|
/** The contracts left by another format or by a document that is gone{{#if presentation.forms}}, and the forms of routes that declare none any more{{/if}}: what else the folder holds is left alone. */
|
|
84
102
|
function staleFiles(): string[] {
|
|
85
103
|
{{#if presentation.forms}}
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"ignoreDependencies": {{knip.ignored}},
|
|
16
16
|
{{/if}}
|
|
17
17
|
"ignoreExportsUsedInFile": true,
|
|
18
|
+
{{#if refusals.named}}
|
|
19
|
+
"ignoreIssues": {
|
|
20
|
+
"{{config.contextsDir}}/*/domain/errors/codes.ts": ["types"]
|
|
21
|
+
},
|
|
22
|
+
{{/if}}
|
|
18
23
|
"vitest": {
|
|
19
24
|
"config": ["vitest.config.ts"{{knip.e2eConfig}}],
|
|
20
25
|
"entry": [
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@biomejs/biome": "2.5.15",
|
|
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.83.2",
|
|
27
27
|
"@eslint/js": "^10.0.1",
|
|
28
28
|
"@typescript/native": "npm:typescript@~7.0.2",
|
|
29
29
|
"@vitest/coverage-v8": "5.0.3",
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
3
3
|
import { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
|
|
4
|
+
{{#unless refusals.named}}
|
|
4
5
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
5
6
|
import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
|
|
6
7
|
import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
{{#if refusals.named}}
|
|
10
|
+
import { AlreadyMember } from '{{alias.context}}/domain/errors/already-member.error{{alias.ext}}';
|
|
11
|
+
import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
|
|
12
|
+
import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invitation.error{{alias.ext}}';
|
|
13
|
+
{{/if}}
|
|
7
14
|
import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
|
|
8
15
|
import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
|
|
9
16
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
@@ -27,11 +34,21 @@ export class AcceptInvitationHandler implements CommandHandler<AcceptInvitationC
|
|
|
27
34
|
const account = await this.accountRepository.findById(actor.id);
|
|
28
35
|
|
|
29
36
|
if (invitation === undefined) {
|
|
37
|
+
{{#if refusals.named}}
|
|
38
|
+
throw UnknownInvitation.forReference();
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#unless refusals.named}}
|
|
30
41
|
throw InvitationError.notFound();
|
|
42
|
+
{{/unless}}
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
if (account === undefined) {
|
|
46
|
+
{{#if refusals.named}}
|
|
47
|
+
throw UnknownAccount.forAccount(actor.id);
|
|
48
|
+
{{/if}}
|
|
49
|
+
{{#unless refusals.named}}
|
|
34
50
|
throw AccountError.notFound(actor.id);
|
|
51
|
+
{{/unless}}
|
|
35
52
|
}
|
|
36
53
|
|
|
37
54
|
account.assertActive();
|
|
@@ -42,7 +59,12 @@ export class AcceptInvitationHandler implements CommandHandler<AcceptInvitationC
|
|
|
42
59
|
invitation.accept(account, now);
|
|
43
60
|
|
|
44
61
|
if ((await this.memberRepository.findOf(organisationId, account.id)) !== undefined) {
|
|
62
|
+
{{#if refusals.named}}
|
|
63
|
+
throw AlreadyMember.forMembership(organisationId, account.id);
|
|
64
|
+
{{/if}}
|
|
65
|
+
{{#unless refusals.named}}
|
|
45
66
|
throw MemberError.alreadyMember(organisationId, account.id);
|
|
67
|
+
{{/unless}}
|
|
46
68
|
}
|
|
47
69
|
|
|
48
70
|
await this.invitationRepository.save(invitation);
|
|
@@ -3,8 +3,14 @@ import type { Clock } from '@ddd-ts-kit/kernel';
|
|
|
3
3
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
4
4
|
import type { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
|
|
5
5
|
import type { Organisation } from '{{alias.context}}/domain/aggregates/organisation.aggregate{{alias.ext}}';
|
|
6
|
+
{{#unless refusals.named}}
|
|
6
7
|
import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
|
|
7
8
|
import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
|
|
9
|
+
{{/unless}}
|
|
10
|
+
{{#if refusals.named}}
|
|
11
|
+
import { UnknownMember } from '{{alias.context}}/domain/errors/unknown-member.error{{alias.ext}}';
|
|
12
|
+
import { UnknownOrganisation } from '{{alias.context}}/domain/errors/unknown-organisation.error{{alias.ext}}';
|
|
13
|
+
{{/if}}
|
|
8
14
|
import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
|
|
9
15
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
10
16
|
import type { OrganisationRepository } from '{{alias.context}}/domain/repositories/organisation.repository{{alias.ext}}';
|
|
@@ -61,11 +67,21 @@ export class ChangeMemberRoleHandler implements CommandHandler<ChangeMemberRoleC
|
|
|
61
67
|
const member = await this.memberRepository.findOf(organisationId, accountId);
|
|
62
68
|
|
|
63
69
|
if (organisation === undefined) {
|
|
70
|
+
{{#if refusals.named}}
|
|
71
|
+
throw UnknownOrganisation.forOrganisation(organisationId);
|
|
72
|
+
{{/if}}
|
|
73
|
+
{{#unless refusals.named}}
|
|
64
74
|
throw OrganisationError.notFound(organisationId);
|
|
75
|
+
{{/unless}}
|
|
65
76
|
}
|
|
66
77
|
|
|
67
78
|
if (member === undefined) {
|
|
79
|
+
{{#if refusals.named}}
|
|
80
|
+
throw UnknownMember.forMembership(organisationId, accountId);
|
|
81
|
+
{{/if}}
|
|
82
|
+
{{#unless refusals.named}}
|
|
68
83
|
throw MemberError.notFound(organisationId, accountId);
|
|
84
|
+
{{/unless}}
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
return { organisation, member };
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { Clock } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
3
3
|
import type { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
|
|
4
|
+
{{#unless refusals.named}}
|
|
4
5
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
5
6
|
import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
|
|
7
|
+
{{/unless}}
|
|
8
|
+
{{#if refusals.named}}
|
|
9
|
+
import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
|
|
10
|
+
import { UnknownOrganisation } from '{{alias.context}}/domain/errors/unknown-organisation.error{{alias.ext}}';
|
|
11
|
+
{{/if}}
|
|
6
12
|
import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
|
|
7
13
|
import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
|
|
8
14
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
@@ -30,7 +36,12 @@ export class DeactivateAccountHandler implements CommandHandler<DeactivateAccoun
|
|
|
30
36
|
const account = await this.accountRepository.findById(actor.id);
|
|
31
37
|
|
|
32
38
|
if (account === undefined) {
|
|
39
|
+
{{#if refusals.named}}
|
|
40
|
+
throw UnknownAccount.forAccount(actor.id);
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#unless refusals.named}}
|
|
33
43
|
throw AccountError.notFound(actor.id);
|
|
44
|
+
{{/unless}}
|
|
34
45
|
}
|
|
35
46
|
|
|
36
47
|
const now = this.clock.now();
|
|
@@ -52,7 +63,12 @@ export class DeactivateAccountHandler implements CommandHandler<DeactivateAccoun
|
|
|
52
63
|
const organisation = await this.organisationRepository.findById(organisationId);
|
|
53
64
|
|
|
54
65
|
if (organisation === undefined) {
|
|
66
|
+
{{#if refusals.named}}
|
|
67
|
+
throw UnknownOrganisation.forOrganisation(organisationId);
|
|
68
|
+
{{/if}}
|
|
69
|
+
{{#unless refusals.named}}
|
|
55
70
|
throw OrganisationError.notFound(organisationId);
|
|
71
|
+
{{/unless}}
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
const owners = await this.memberRepository.countOwners(organisationId);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { Clock } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
3
|
+
{{#unless refusals.named}}
|
|
3
4
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
4
5
|
import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
|
|
6
|
+
{{/unless}}
|
|
7
|
+
{{#if refusals.named}}
|
|
8
|
+
import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
|
|
9
|
+
import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invitation.error{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
5
11
|
import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
|
|
6
12
|
import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
|
|
7
13
|
import { DeclineInvitationCommand } from '{{alias.context}}/application/commands/decline-invitation/decline-invitation.command{{alias.ext}}';
|
|
@@ -21,11 +27,21 @@ export class DeclineInvitationHandler implements CommandHandler<DeclineInvitatio
|
|
|
21
27
|
const account = await this.accountRepository.findById(actor.id);
|
|
22
28
|
|
|
23
29
|
if (invitation === undefined) {
|
|
30
|
+
{{#if refusals.named}}
|
|
31
|
+
throw UnknownInvitation.forReference();
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{#unless refusals.named}}
|
|
24
34
|
throw InvitationError.notFound();
|
|
35
|
+
{{/unless}}
|
|
25
36
|
}
|
|
26
37
|
|
|
27
38
|
if (account === undefined) {
|
|
39
|
+
{{#if refusals.named}}
|
|
40
|
+
throw UnknownAccount.forAccount(actor.id);
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#unless refusals.named}}
|
|
28
43
|
throw AccountError.notFound(actor.id);
|
|
44
|
+
{{/unless}}
|
|
29
45
|
}
|
|
30
46
|
|
|
31
47
|
invitation.decline(account, this.clock.now());
|
|
@@ -2,7 +2,12 @@ import type { Access } from '@ddd-ts-kit/auth';
|
|
|
2
2
|
import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
|
|
3
3
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
4
4
|
import { Delegation } from '{{alias.context}}/domain/aggregates/delegation.aggregate{{alias.ext}}';
|
|
5
|
+
{{#unless refusals.named}}
|
|
5
6
|
import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
|
|
7
|
+
{{/unless}}
|
|
8
|
+
{{#if refusals.named}}
|
|
9
|
+
import { UnknownMember } from '{{alias.context}}/domain/errors/unknown-member.error{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
6
11
|
import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
|
|
7
12
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
8
13
|
import { RoleRightsService } from '{{alias.context}}/domain/services/role-rights.service{{alias.ext}}';
|
|
@@ -29,7 +34,12 @@ export class GrantDelegationHandler implements CommandHandler<GrantDelegationCom
|
|
|
29
34
|
await this.access.authorize(actor, {{context.camel}}Permissions['delegation.grant'], held);
|
|
30
35
|
|
|
31
36
|
if ((await this.memberRepository.findOf(organisationId, terms.delegateId)) === undefined) {
|
|
37
|
+
{{#if refusals.named}}
|
|
38
|
+
throw UnknownMember.forMembership(organisationId, terms.delegateId);
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#unless refusals.named}}
|
|
32
41
|
throw MemberError.notFound(organisationId, terms.delegateId);
|
|
42
|
+
{{/unless}}
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
const period = DelegationPeriod.create(terms.startsAt, terms.endsAt);
|
|
@@ -2,8 +2,14 @@ import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
|
|
|
2
2
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
3
3
|
import { Member } from '{{alias.context}}/domain/aggregates/member.aggregate{{alias.ext}}';
|
|
4
4
|
import { Organisation } from '{{alias.context}}/domain/aggregates/organisation.aggregate{{alias.ext}}';
|
|
5
|
+
{{#unless refusals.named}}
|
|
5
6
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
6
7
|
import { OrganisationError } from '{{alias.context}}/domain/errors/organisation.error{{alias.ext}}';
|
|
8
|
+
{{/unless}}
|
|
9
|
+
{{#if refusals.named}}
|
|
10
|
+
import { OrganisationSlugTaken } from '{{alias.context}}/domain/errors/organisation-slug-taken.error{{alias.ext}}';
|
|
11
|
+
import { UnknownAccount } from '{{alias.context}}/domain/errors/unknown-account.error{{alias.ext}}';
|
|
12
|
+
{{/if}}
|
|
7
13
|
import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
|
|
8
14
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
9
15
|
import type { OrganisationRepository } from '{{alias.context}}/domain/repositories/organisation.repository{{alias.ext}}';
|
|
@@ -29,13 +35,23 @@ export class OpenOrganisationHandler implements CommandHandler<OpenOrganisationC
|
|
|
29
35
|
const opener = await this.accountRepository.findById(actor.id);
|
|
30
36
|
|
|
31
37
|
if (opener === undefined) {
|
|
38
|
+
{{#if refusals.named}}
|
|
39
|
+
throw UnknownAccount.forAccount(actor.id);
|
|
40
|
+
{{/if}}
|
|
41
|
+
{{#unless refusals.named}}
|
|
32
42
|
throw AccountError.notFound(actor.id);
|
|
43
|
+
{{/unless}}
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
opener.assertActive();
|
|
36
47
|
|
|
37
48
|
if ((await this.organisationRepository.findById(slug.value)) !== undefined) {
|
|
49
|
+
{{#if refusals.named}}
|
|
50
|
+
throw OrganisationSlugTaken.forSlug(slug.value);
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{#unless refusals.named}}
|
|
38
53
|
throw OrganisationError.slugTaken(slug.value);
|
|
54
|
+
{{/unless}}
|
|
39
55
|
}
|
|
40
56
|
|
|
41
57
|
const now = this.clock.now();
|