ddd-ts-kit 0.82.0 → 0.83.1
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 +103 -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/stack/resolve-stack.js +2 -2
- package/dist/init/stack/resolve-stack.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/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/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
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { AggregateRoot } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#unless refusals.named}}
|
|
2
3
|
import { DelegationError } from '{{alias.context}}/domain/errors/delegation.error{{alias.ext}}';
|
|
4
|
+
{{/unless}}
|
|
5
|
+
{{#if refusals.named}}
|
|
6
|
+
import { DelegationNotActive } from '{{alias.context}}/domain/errors/delegation-not-active.error{{alias.ext}}';
|
|
7
|
+
import { DelegationToOneself } from '{{alias.context}}/domain/errors/delegation-to-oneself.error{{alias.ext}}';
|
|
8
|
+
import { DelegationWithNoRight } from '{{alias.context}}/domain/errors/delegation-with-no-right.error{{alias.ext}}';
|
|
9
|
+
import { RightNotInRole } from '{{alias.context}}/domain/errors/right-not-in-role.error{{alias.ext}}';
|
|
10
|
+
{{/if}}
|
|
3
11
|
import { DelegationGranted } from '{{alias.context}}/domain/events/delegation-granted.event{{alias.ext}}';
|
|
4
12
|
import { DelegationRevoked } from '{{alias.context}}/domain/events/delegation-revoked.event{{alias.ext}}';
|
|
5
13
|
import type { DelegationPeriod } from '{{alias.context}}/domain/value-objects/delegation-period.vo{{alias.ext}}';
|
|
@@ -53,7 +61,12 @@ export class Delegation extends AggregateRoot<string> {
|
|
|
53
61
|
/** Withdrawn by hand while it holds or before it starts: an ended delegation cannot be. */
|
|
54
62
|
revoke(now: Date): void {
|
|
55
63
|
if (this.state.endedAt !== undefined || now.getTime() >= this.state.period.endsAt.getTime()) {
|
|
64
|
+
{{#if refusals.named}}
|
|
65
|
+
throw DelegationNotActive.forDelegation(this.id);
|
|
66
|
+
{{/if}}
|
|
67
|
+
{{#unless refusals.named}}
|
|
56
68
|
throw DelegationError.notActive(this.id);
|
|
69
|
+
{{/unless}}
|
|
57
70
|
}
|
|
58
71
|
|
|
59
72
|
this.end(now);
|
|
@@ -102,16 +115,31 @@ export class Delegation extends AggregateRoot<string> {
|
|
|
102
115
|
|
|
103
116
|
function assertLendable(terms: Omit<DelegationState, 'endedAt'>, held: OrganisationRights): void {
|
|
104
117
|
if (terms.delegateId === terms.delegatorId) {
|
|
118
|
+
{{#if refusals.named}}
|
|
119
|
+
throw DelegationToOneself.forAccount(terms.delegatorId);
|
|
120
|
+
{{/if}}
|
|
121
|
+
{{#unless refusals.named}}
|
|
105
122
|
throw DelegationError.toOneself(terms.delegatorId);
|
|
123
|
+
{{/unless}}
|
|
106
124
|
}
|
|
107
125
|
|
|
108
126
|
if (terms.rights.length === 0) {
|
|
127
|
+
{{#if refusals.named}}
|
|
128
|
+
throw DelegationWithNoRight.withNoRight();
|
|
129
|
+
{{/if}}
|
|
130
|
+
{{#unless refusals.named}}
|
|
109
131
|
throw DelegationError.withoutRights();
|
|
132
|
+
{{/unless}}
|
|
110
133
|
}
|
|
111
134
|
|
|
112
135
|
const beyond = terms.rights.find((right) => !held.includes(right));
|
|
113
136
|
|
|
114
137
|
if (beyond !== undefined) {
|
|
138
|
+
{{#if refusals.named}}
|
|
139
|
+
throw RightNotInRole.forRight(beyond);
|
|
140
|
+
{{/if}}
|
|
141
|
+
{{#unless refusals.named}}
|
|
115
142
|
throw DelegationError.beyondRights(beyond);
|
|
143
|
+
{{/unless}}
|
|
116
144
|
}
|
|
117
145
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { AggregateRoot } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#unless refusals.named}}
|
|
2
3
|
import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
|
|
4
|
+
{{/unless}}
|
|
5
|
+
{{#if refusals.named}}
|
|
6
|
+
import { InvitationExpired } from '{{alias.context}}/domain/errors/invitation-expired.error{{alias.ext}}';
|
|
7
|
+
import { InvitationNotAddressedToAccount } from '{{alias.context}}/domain/errors/invitation-not-addressed-to-account.error{{alias.ext}}';
|
|
8
|
+
import { InvitationNotPending } from '{{alias.context}}/domain/errors/invitation-not-pending.error{{alias.ext}}';
|
|
9
|
+
{{/if}}
|
|
3
10
|
import { InvitationAccepted } from '{{alias.context}}/domain/events/invitation-accepted.event{{alias.ext}}';
|
|
4
11
|
import { InvitationDeclined } from '{{alias.context}}/domain/events/invitation-declined.event{{alias.ext}}';
|
|
5
12
|
import { InvitationIssued } from '{{alias.context}}/domain/events/invitation-issued.event{{alias.ext}}';
|
|
@@ -77,7 +84,12 @@ export class Invitation extends AggregateRoot<string> {
|
|
|
77
84
|
/** Taken back by the organisation while it waits for an answer, expired or not. */
|
|
78
85
|
revoke(now: Date): void {
|
|
79
86
|
if (this.state.status !== InvitationStatus.Pending) {
|
|
87
|
+
{{#if refusals.named}}
|
|
88
|
+
throw InvitationNotPending.forInvitation(this.id, this.state.status);
|
|
89
|
+
{{/if}}
|
|
90
|
+
{{#unless refusals.named}}
|
|
80
91
|
throw InvitationError.notPending(this.id, this.state.status);
|
|
92
|
+
{{/unless}}
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
this.answer(InvitationStatus.Revoked, now);
|
|
@@ -110,15 +122,30 @@ export class Invitation extends AggregateRoot<string> {
|
|
|
110
122
|
|
|
111
123
|
private assertAnswerableBy(invitee: Invitee, now: Date): void {
|
|
112
124
|
if (this.state.status !== InvitationStatus.Pending) {
|
|
125
|
+
{{#if refusals.named}}
|
|
126
|
+
throw InvitationNotPending.forInvitation(this.id, this.state.status);
|
|
127
|
+
{{/if}}
|
|
128
|
+
{{#unless refusals.named}}
|
|
113
129
|
throw InvitationError.notPending(this.id, this.state.status);
|
|
130
|
+
{{/unless}}
|
|
114
131
|
}
|
|
115
132
|
|
|
116
133
|
if (now.getTime() >= this.state.expiresAt.getTime()) {
|
|
134
|
+
{{#if refusals.named}}
|
|
135
|
+
throw InvitationExpired.forInvitation(this.id, this.state.expiresAt);
|
|
136
|
+
{{/if}}
|
|
137
|
+
{{#unless refusals.named}}
|
|
117
138
|
throw InvitationError.expired(this.id, this.state.expiresAt);
|
|
139
|
+
{{/unless}}
|
|
118
140
|
}
|
|
119
141
|
|
|
120
142
|
if (!invitee.email.equals(this.state.email)) {
|
|
143
|
+
{{#if refusals.named}}
|
|
144
|
+
throw InvitationNotAddressedToAccount.forInvitation(this.id);
|
|
145
|
+
{{/if}}
|
|
146
|
+
{{#unless refusals.named}}
|
|
121
147
|
throw InvitationError.addressedToAnother(this.id);
|
|
148
|
+
{{/unless}}
|
|
122
149
|
}
|
|
123
150
|
}
|
|
124
151
|
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { AggregateRoot } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#unless refusals.named}}
|
|
2
3
|
import { MemberError } from '{{alias.context}}/domain/errors/member.error{{alias.ext}}';
|
|
4
|
+
{{/unless}}
|
|
5
|
+
{{#if refusals.named}}
|
|
6
|
+
import { AboveOwnRole } from '{{alias.context}}/domain/errors/above-own-role.error{{alias.ext}}';
|
|
7
|
+
import { LastOwner } from '{{alias.context}}/domain/errors/last-owner.error{{alias.ext}}';
|
|
8
|
+
import { NotAnOwner } from '{{alias.context}}/domain/errors/not-an-owner.error{{alias.ext}}';
|
|
9
|
+
import { OwnRole } from '{{alias.context}}/domain/errors/own-role.error{{alias.ext}}';
|
|
10
|
+
import { UnknownMember } from '{{alias.context}}/domain/errors/unknown-member.error{{alias.ext}}';
|
|
11
|
+
{{/if}}
|
|
3
12
|
import { MemberJoined } from '{{alias.context}}/domain/events/member-joined.event{{alias.ext}}';
|
|
4
13
|
import { MemberRemoved } from '{{alias.context}}/domain/events/member-removed.event{{alias.ext}}';
|
|
5
14
|
import { MemberRoleChanged } from '{{alias.context}}/domain/events/member-role-changed.event{{alias.ext}}';
|
|
@@ -55,7 +64,14 @@ export class Member extends AggregateRoot<string> {
|
|
|
55
64
|
return;
|
|
56
65
|
}
|
|
57
66
|
|
|
67
|
+
{{#if refusals.named}}
|
|
68
|
+
throw role === MemberRole.Owner
|
|
69
|
+
? NotAnOwner.forOrganisation(organisationId)
|
|
70
|
+
: AboveOwnRole.forOrganisation(organisationId);
|
|
71
|
+
{{/if}}
|
|
72
|
+
{{#unless refusals.named}}
|
|
58
73
|
throw role === MemberRole.Owner ? MemberError.ownersOnly(organisationId) : MemberError.aboveOwnRole(organisationId);
|
|
74
|
+
{{/unless}}
|
|
59
75
|
}
|
|
60
76
|
|
|
61
77
|
/** Never one's own role, never above one's own role, and the last owner stays one. */
|
|
@@ -63,7 +79,12 @@ export class Member extends AggregateRoot<string> {
|
|
|
63
79
|
this.assertActive();
|
|
64
80
|
|
|
65
81
|
if (change.byAccount === this.state.accountId) {
|
|
82
|
+
{{#if refusals.named}}
|
|
83
|
+
throw OwnRole.forOrganisation(this.state.organisationId);
|
|
84
|
+
{{/if}}
|
|
85
|
+
{{#unless refusals.named}}
|
|
66
86
|
throw MemberError.ownRole(this.state.organisationId);
|
|
87
|
+
{{/unless}}
|
|
67
88
|
}
|
|
68
89
|
|
|
69
90
|
if (role === this.state.role) {
|
|
@@ -121,7 +142,12 @@ export class Member extends AggregateRoot<string> {
|
|
|
121
142
|
|
|
122
143
|
private assertActive(): void {
|
|
123
144
|
if (!this.isActive) {
|
|
145
|
+
{{#if refusals.named}}
|
|
146
|
+
throw UnknownMember.forMembership(this.state.organisationId, this.state.accountId);
|
|
147
|
+
{{/if}}
|
|
148
|
+
{{#unless refusals.named}}
|
|
124
149
|
throw MemberError.notFound(this.state.organisationId, this.state.accountId);
|
|
150
|
+
{{/unless}}
|
|
125
151
|
}
|
|
126
152
|
}
|
|
127
153
|
|
|
@@ -134,7 +160,12 @@ export class Member extends AggregateRoot<string> {
|
|
|
134
160
|
/** `next` is the role after the change, none for a removal. */
|
|
135
161
|
private assertOwnersKept(change: MembershipChange, next: MemberRole | undefined): void {
|
|
136
162
|
if (this.state.role === MemberRole.Owner && next !== MemberRole.Owner && change.owners <= 1) {
|
|
163
|
+
{{#if refusals.named}}
|
|
164
|
+
throw LastOwner.forOrganisation(this.state.organisationId);
|
|
165
|
+
{{/if}}
|
|
166
|
+
{{#unless refusals.named}}
|
|
137
167
|
throw MemberError.lastOwner(this.state.organisationId);
|
|
168
|
+
{{/unless}}
|
|
138
169
|
}
|
|
139
170
|
}
|
|
140
171
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class AboveOwnRole extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.AboveOwnRole;
|
|
6
|
+
|
|
7
|
+
static forOrganisation(organisationId: string) {
|
|
8
|
+
return AboveOwnRole.refusal(
|
|
9
|
+
`A member of ${organisationId} appoints, changes or removes no one above their own role.`,
|
|
10
|
+
{ organisationId },
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class AccountAlreadyDeactivated extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.AccountAlreadyDeactivated;
|
|
6
|
+
|
|
7
|
+
static forAccount(accountId: string) {
|
|
8
|
+
return AccountAlreadyDeactivated.refusal(`The account ${accountId} is already deactivated.`, { accountId });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class AlreadyMember extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.AlreadyMember;
|
|
6
|
+
|
|
7
|
+
static forMembership(organisationId: string, accountId: string) {
|
|
8
|
+
return AlreadyMember.refusal(`The account ${accountId} is already a member of ${organisationId}.`, {
|
|
9
|
+
organisationId,
|
|
10
|
+
accountId,
|
|
11
|
+
}).exposing('organisationId', 'accountId');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The codes of the refusals of {{context.words}}: one per refusal class of `domain/errors/`, named after it. The code is the contract a client reads. */
|
|
2
|
+
export const {{context.pascal}}Codes = {
|
|
3
|
+
UnknownAccount: 'ACCOUNT_NOT_FOUND',
|
|
4
|
+
DeactivatedAccount: 'ACCOUNT_DEACTIVATED',
|
|
5
|
+
AccountAlreadyDeactivated: 'ACCOUNT_ALREADY_DEACTIVATED',
|
|
6
|
+
EmailNotVerified: 'EMAIL_NOT_VERIFIED',
|
|
7
|
+
InvalidEmailAddress: 'INVALID_EMAIL_ADDRESS',
|
|
8
|
+
InvalidDisplayName: 'INVALID_DISPLAY_NAME',
|
|
9
|
+
UnknownOrganisation: 'ORGANISATION_NOT_FOUND',
|
|
10
|
+
OrganisationSlugTaken: 'ORGANISATION_SLUG_TAKEN',
|
|
11
|
+
InvalidOrganisationName: 'INVALID_ORGANISATION_NAME',
|
|
12
|
+
InvalidOrganisationSlug: 'INVALID_ORGANISATION_SLUG',
|
|
13
|
+
UnknownMember: 'MEMBER_NOT_FOUND',
|
|
14
|
+
AlreadyMember: 'ALREADY_MEMBER',
|
|
15
|
+
LastOwner: 'LAST_OWNER',
|
|
16
|
+
NotAnOwner: 'OWNERS_ONLY',
|
|
17
|
+
OwnRole: 'OWN_ROLE',
|
|
18
|
+
AboveOwnRole: 'ABOVE_OWN_ROLE',
|
|
19
|
+
UnknownInvitation: 'INVITATION_NOT_FOUND',
|
|
20
|
+
InvitationExpired: 'INVITATION_EXPIRED',
|
|
21
|
+
InvitationNotPending: 'INVITATION_NOT_PENDING',
|
|
22
|
+
InvitationNotAddressedToAccount: 'INVITATION_ADDRESSED_TO_ANOTHER',
|
|
23
|
+
UnknownDelegation: 'DELEGATION_NOT_FOUND',
|
|
24
|
+
DelegationNotActive: 'DELEGATION_NOT_ACTIVE',
|
|
25
|
+
DelegationToOneself: 'DELEGATION_TO_ONESELF',
|
|
26
|
+
DelegationWithNoRight: 'DELEGATION_WITHOUT_RIGHTS',
|
|
27
|
+
RightNotInRole: 'DELEGATION_BEYOND_RIGHTS',
|
|
28
|
+
DelegationPeriodInverted: 'DELEGATION_PERIOD_INVERTED',
|
|
29
|
+
DelegationTooLong: 'DELEGATION_TOO_LONG',
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
/** One code of a refusal of {{context.words}}, for a signature that takes any of them. */
|
|
33
|
+
export type {{context.pascal}}Code = (typeof {{context.pascal}}Codes)[keyof typeof {{context.pascal}}Codes];
|
package/templates/presets/identity/context/domain/errors/deactivated-account.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class DeactivatedAccount extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.DeactivatedAccount;
|
|
6
|
+
|
|
7
|
+
static forAccount(accountId: string) {
|
|
8
|
+
return DeactivatedAccount.refusal(`The account ${accountId} is deactivated.`, { accountId });
|
|
9
|
+
}
|
|
10
|
+
}
|
package/templates/presets/identity/context/domain/errors/delegation-not-active.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class DelegationNotActive extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.DelegationNotActive;
|
|
6
|
+
|
|
7
|
+
static forDelegation(delegationId: string) {
|
|
8
|
+
return DelegationNotActive.refusal(`The delegation ${delegationId} already ended.`, { delegationId });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class DelegationPeriodInverted extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.DelegationPeriodInverted;
|
|
6
|
+
|
|
7
|
+
static forPeriod(startsAt: Date, endsAt: Date) {
|
|
8
|
+
return DelegationPeriodInverted.refusal('A delegation ends after it starts.', {
|
|
9
|
+
startsAt,
|
|
10
|
+
endsAt,
|
|
11
|
+
}).exposing('startsAt', 'endsAt');
|
|
12
|
+
}
|
|
13
|
+
}
|
package/templates/presets/identity/context/domain/errors/delegation-to-oneself.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class DelegationToOneself extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.DelegationToOneself;
|
|
6
|
+
|
|
7
|
+
static forAccount(accountId: string) {
|
|
8
|
+
return DelegationToOneself.refusal('A member delegates to another member.', { accountId });
|
|
9
|
+
}
|
|
10
|
+
}
|
package/templates/presets/identity/context/domain/errors/delegation-too-long.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class DelegationTooLong extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.DelegationTooLong;
|
|
6
|
+
|
|
7
|
+
static withLongestDays(longestDays: number) {
|
|
8
|
+
return DelegationTooLong.refusal(`A delegation lasts ${longestDays} days at most: a longer one is a role.`, {
|
|
9
|
+
longestDays,
|
|
10
|
+
}).exposing('longestDays');
|
|
11
|
+
}
|
|
12
|
+
}
|
package/templates/presets/identity/context/domain/errors/delegation-with-no-right.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class DelegationWithNoRight extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.DelegationWithNoRight;
|
|
6
|
+
|
|
7
|
+
static withNoRight() {
|
|
8
|
+
return DelegationWithNoRight.refusal('A delegation lends at least one right.');
|
|
9
|
+
}
|
|
10
|
+
}
|
package/templates/presets/identity/context/domain/errors/email-not-verified.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class EmailNotVerified extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.EmailNotVerified;
|
|
6
|
+
|
|
7
|
+
static forAccount(accountId: string) {
|
|
8
|
+
return EmailNotVerified.refusal(
|
|
9
|
+
'The identity provider has not verified the email address of this person: they verify it, then sign in again.',
|
|
10
|
+
{ accountId },
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/templates/presets/identity/context/domain/errors/invalid-display-name.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvalidDisplayName extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvalidDisplayName;
|
|
6
|
+
|
|
7
|
+
static forValue(raw: string) {
|
|
8
|
+
return InvalidDisplayName.refusal('A display name holds between 1 and 100 characters.', { raw });
|
|
9
|
+
}
|
|
10
|
+
}
|
package/templates/presets/identity/context/domain/errors/invalid-email-address.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvalidEmailAddress extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvalidEmailAddress;
|
|
6
|
+
|
|
7
|
+
static forValue(raw: string) {
|
|
8
|
+
return InvalidEmailAddress.refusal('An email address is a local part, an @ and a domain.', { raw });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvalidOrganisationName extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvalidOrganisationName;
|
|
6
|
+
|
|
7
|
+
static forValue(raw: string) {
|
|
8
|
+
return InvalidOrganisationName.refusal('The name of an organisation holds between 1 and 100 characters.', { raw });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvalidOrganisationSlug extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvalidOrganisationSlug;
|
|
6
|
+
|
|
7
|
+
static forValue(raw: string) {
|
|
8
|
+
return InvalidOrganisationSlug.refusal(
|
|
9
|
+
'A slug is 2 to 63 lower-case letters, digits and hyphens, starting with a letter or a digit.',
|
|
10
|
+
{ raw },
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/templates/presets/identity/context/domain/errors/invitation-expired.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvitationExpired extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvitationExpired;
|
|
6
|
+
|
|
7
|
+
static forInvitation(invitationId: string, expiresAt: Date) {
|
|
8
|
+
return InvitationExpired.refusal(`The invitation ${invitationId} expired.`, {
|
|
9
|
+
invitationId,
|
|
10
|
+
expiresAt,
|
|
11
|
+
}).exposing('expiresAt');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvitationNotAddressedToAccount extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvitationNotAddressedToAccount;
|
|
6
|
+
|
|
7
|
+
static forInvitation(invitationId: string) {
|
|
8
|
+
return InvitationNotAddressedToAccount.refusal(
|
|
9
|
+
`The invitation ${invitationId} is addressed to another email address than the account's.`,
|
|
10
|
+
{ invitationId },
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/templates/presets/identity/context/domain/errors/invitation-not-pending.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class InvitationNotPending extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.InvitationNotPending;
|
|
6
|
+
|
|
7
|
+
static forInvitation(invitationId: string, status: string) {
|
|
8
|
+
return InvitationNotPending.refusal(`The invitation ${invitationId} is already ${status}.`, {
|
|
9
|
+
invitationId,
|
|
10
|
+
status,
|
|
11
|
+
}).exposing('status');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class LastOwner extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.LastOwner;
|
|
6
|
+
|
|
7
|
+
static forOrganisation(organisationId: string) {
|
|
8
|
+
return LastOwner.refusal(`${organisationId} keeps at least one owner.`, {
|
|
9
|
+
organisationId,
|
|
10
|
+
}).exposing('organisationId');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class NotAnOwner extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.NotAnOwner;
|
|
6
|
+
|
|
7
|
+
static forOrganisation(organisationId: string) {
|
|
8
|
+
return NotAnOwner.refusal(`Only an owner of ${organisationId} appoints or changes an owner.`, { organisationId });
|
|
9
|
+
}
|
|
10
|
+
}
|
package/templates/presets/identity/context/domain/errors/organisation-slug-taken.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class OrganisationSlugTaken extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.OrganisationSlugTaken;
|
|
6
|
+
|
|
7
|
+
static forSlug(slug: string) {
|
|
8
|
+
return OrganisationSlugTaken.refusal(`An organisation is already named ${slug}.`, { slug }).exposing('slug');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class OwnRole extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.OwnRole;
|
|
6
|
+
|
|
7
|
+
static forOrganisation(organisationId: string) {
|
|
8
|
+
return OwnRole.refusal(`A member of ${organisationId} does not change their own role: another member does.`, {
|
|
9
|
+
organisationId,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class RightNotInRole extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.RightNotInRole;
|
|
6
|
+
|
|
7
|
+
static forRight(right: string) {
|
|
8
|
+
return RightNotInRole.refusal(`A member lends only the rights they hold: ${right}.`, {
|
|
9
|
+
right,
|
|
10
|
+
}).exposing('right');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class UnknownAccount extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.UnknownAccount;
|
|
6
|
+
|
|
7
|
+
static forAccount(accountId: string) {
|
|
8
|
+
return UnknownAccount.refusal(`No account ${accountId}: the person signs in once before acting.`, {
|
|
9
|
+
accountId,
|
|
10
|
+
}).exposing('accountId');
|
|
11
|
+
}
|
|
12
|
+
}
|
package/templates/presets/identity/context/domain/errors/unknown-delegation.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class UnknownDelegation extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.UnknownDelegation;
|
|
6
|
+
|
|
7
|
+
static forDelegation(delegationId: string) {
|
|
8
|
+
return UnknownDelegation.refusal(`No delegation ${delegationId}.`, { delegationId }).exposing('delegationId');
|
|
9
|
+
}
|
|
10
|
+
}
|
package/templates/presets/identity/context/domain/errors/unknown-invitation.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
/** No invitation answers the token or the identifier given. The token of an invitation is never a fact of a refusal. */
|
|
5
|
+
export class UnknownInvitation extends DomainRefusal {
|
|
6
|
+
readonly code = {{context.pascal}}Codes.UnknownInvitation;
|
|
7
|
+
|
|
8
|
+
static forReference() {
|
|
9
|
+
return UnknownInvitation.refusal('No invitation answers this token or this identifier.');
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class UnknownMember extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.UnknownMember;
|
|
6
|
+
|
|
7
|
+
static forMembership(organisationId: string, accountId: string) {
|
|
8
|
+
return UnknownMember.refusal(`The account ${accountId} is not a member of ${organisationId}.`, {
|
|
9
|
+
organisationId,
|
|
10
|
+
accountId,
|
|
11
|
+
}).exposing('organisationId', 'accountId');
|
|
12
|
+
}
|
|
13
|
+
}
|
package/templates/presets/identity/context/domain/errors/unknown-organisation.error.named.ts.tpl
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DomainRefusal } from '@ddd-ts-kit/kernel';
|
|
2
|
+
import { {{context.pascal}}Codes } from '{{alias.context}}/domain/errors/codes{{alias.ext}}';
|
|
3
|
+
|
|
4
|
+
export class UnknownOrganisation extends DomainRefusal {
|
|
5
|
+
readonly code = {{context.pascal}}Codes.UnknownOrganisation;
|
|
6
|
+
|
|
7
|
+
static forOrganisation(organisationId: string) {
|
|
8
|
+
return UnknownOrganisation.refusal(`No organisation ${organisationId}.`, {
|
|
9
|
+
organisationId,
|
|
10
|
+
}).exposing('organisationId');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ValueObject } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#unless refusals.named}}
|
|
2
3
|
import { DelegationError } from '{{alias.context}}/domain/errors/delegation.error{{alias.ext}}';
|
|
4
|
+
{{/unless}}
|
|
5
|
+
{{#if refusals.named}}
|
|
6
|
+
import { DelegationPeriodInverted } from '{{alias.context}}/domain/errors/delegation-period-inverted.error{{alias.ext}}';
|
|
7
|
+
import { DelegationTooLong } from '{{alias.context}}/domain/errors/delegation-too-long.error{{alias.ext}}';
|
|
8
|
+
{{/if}}
|
|
3
9
|
|
|
4
10
|
/** A delegation is a stand-in for an absence: past this, the right belongs in a role. */
|
|
5
11
|
const LONGEST_DAYS = 90;
|
|
@@ -18,11 +24,21 @@ export class DelegationPeriod extends ValueObject<DelegationPeriodProps> {
|
|
|
18
24
|
|
|
19
25
|
static create(startsAt: Date, endsAt: Date): DelegationPeriod {
|
|
20
26
|
if (endsAt.getTime() <= startsAt.getTime()) {
|
|
27
|
+
{{#if refusals.named}}
|
|
28
|
+
throw DelegationPeriodInverted.forPeriod(startsAt, endsAt);
|
|
29
|
+
{{/if}}
|
|
30
|
+
{{#unless refusals.named}}
|
|
21
31
|
throw DelegationError.periodInverted(startsAt, endsAt);
|
|
32
|
+
{{/unless}}
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
if (endsAt.getTime() - startsAt.getTime() > LONGEST_DAYS * DAY_MS) {
|
|
36
|
+
{{#if refusals.named}}
|
|
37
|
+
throw DelegationTooLong.withLongestDays(LONGEST_DAYS);
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#unless refusals.named}}
|
|
25
40
|
throw DelegationError.tooLong(LONGEST_DAYS);
|
|
41
|
+
{{/unless}}
|
|
26
42
|
}
|
|
27
43
|
|
|
28
44
|
return new DelegationPeriod({ startsAt, endsAt });
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ValueObject } from '@ddd-ts-kit/kernel';
|
|
2
|
+
{{#unless refusals.named}}
|
|
2
3
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
4
|
+
{{/unless}}
|
|
5
|
+
{{#if refusals.named}}
|
|
6
|
+
import { InvalidDisplayName } from '{{alias.context}}/domain/errors/invalid-display-name.error{{alias.ext}}';
|
|
7
|
+
{{/if}}
|
|
3
8
|
|
|
4
9
|
const LONGEST = 100;
|
|
5
10
|
|
|
@@ -17,7 +22,12 @@ export class DisplayName extends ValueObject<DisplayNameProps> {
|
|
|
17
22
|
const value = raw.trim();
|
|
18
23
|
|
|
19
24
|
if (value.length === 0 || value.length > LONGEST) {
|
|
25
|
+
{{#if refusals.named}}
|
|
26
|
+
throw InvalidDisplayName.forValue(raw);
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#unless refusals.named}}
|
|
20
29
|
throw AccountError.invalidDisplayName(raw);
|
|
30
|
+
{{/unless}}
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
return new DisplayName({ value });
|