ddd-ts-kit 0.27.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 +232 -0
- package/README.fr.md +186 -72
- package/README.md +177 -71
- 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 +6 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/catalogue/default-severities.d.ts.map +1 -1
- package/dist/check/catalogue/default-severities.js +2 -0
- package/dist/check/catalogue/default-severities.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/commands/check-command.d.ts.map +1 -1
- package/dist/check/commands/check-command.js +4 -1
- package/dist/check/commands/check-command.js.map +1 -1
- package/dist/check/commands/explain-command.d.ts.map +1 -1
- package/dist/check/commands/explain-command.js +2 -9
- package/dist/check/commands/explain-command.js.map +1 -1
- package/dist/check/engine/format-check.d.ts +6 -1
- package/dist/check/engine/format-check.d.ts.map +1 -1
- package/dist/check/engine/format-check.js +33 -11
- package/dist/check/engine/format-check.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/documented-rule.d.ts +8 -0
- package/dist/check/explain/documented-rule.d.ts.map +1 -0
- package/dist/check/explain/documented-rule.js +14 -0
- package/dist/check/explain/documented-rule.js.map +1 -0
- 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/explanations-of.d.ts +5 -0
- package/dist/check/explain/explanations-of.d.ts.map +1 -0
- package/dist/check/explain/explanations-of.js +16 -0
- package/dist/check/explain/explanations-of.js.map +1 -0
- package/dist/check/explain/language-docs.js +1 -1
- package/dist/check/explain/language-docs.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts.map +1 -1
- package/dist/check/explain/persistence-docs.js +7 -0
- package/dist/check/explain/persistence-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.d.ts.map +1 -1
- package/dist/check/explain/wiring-docs.js +13 -0
- package/dist/check/explain/wiring-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/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +78 -1
- package/dist/check/fixtures/declarations-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/fixtures/persistence-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/persistence-fixtures.js +25 -0
- package/dist/check/fixtures/persistence-fixtures.js.map +1 -1
- 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/model/rule-explanation.d.ts +10 -0
- package/dist/check/model/rule-explanation.d.ts.map +1 -0
- package/dist/check/model/rule-explanation.js +2 -0
- package/dist/check/model/rule-explanation.js.map +1 -0
- 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/declarations-port-adapter-wired.d.ts +3 -0
- package/dist/check/rules/declarations-port-adapter-wired.d.ts.map +1 -0
- package/dist/check/rules/declarations-port-adapter-wired.js +104 -0
- package/dist/check/rules/declarations-port-adapter-wired.js.map +1 -0
- 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/check/rules/persistence-primary-key-order.d.ts +3 -0
- package/dist/check/rules/persistence-primary-key-order.d.ts.map +1 -0
- package/dist/check/rules/persistence-primary-key-order.js +31 -0
- package/dist/check/rules/persistence-primary-key-order.js.map +1 -0
- 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/doctor.d.ts +4 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +20 -4
- package/dist/commands/doctor.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/commands/lint.d.ts +7 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +55 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.d.ts.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/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +2 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/restack-config-text.d.ts +3 -2
- package/dist/config/restack-config-text.d.ts.map +1 -1
- package/dist/config/restack-config-text.js +5 -3
- package/dist/config/restack-config-text.js.map +1 -1
- package/dist/config/serialize-config.d.ts.map +1 -1
- package/dist/config/serialize-config.js +2 -1
- package/dist/config/serialize-config.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/doctor/diagnose.d.ts +2 -0
- package/dist/doctor/diagnose.d.ts.map +1 -1
- package/dist/doctor/diagnose.js +22 -3
- package/dist/doctor/diagnose.js.map +1 -1
- package/dist/doctor/doctor-finding.d.ts +13 -5
- package/dist/doctor/doctor-finding.d.ts.map +1 -1
- package/dist/doctor/format-diagnosis.d.ts +4 -1
- package/dist/doctor/format-diagnosis.d.ts.map +1 -1
- package/dist/doctor/format-diagnosis.js +49 -3
- package/dist/doctor/format-diagnosis.js.map +1 -1
- package/dist/doctor/in-range.d.ts +7 -0
- package/dist/doctor/in-range.d.ts.map +1 -0
- package/dist/doctor/in-range.js +90 -0
- package/dist/doctor/in-range.js.map +1 -0
- package/dist/doctor/install-findings.d.ts +11 -0
- package/dist/doctor/install-findings.d.ts.map +1 -0
- package/dist/doctor/install-findings.js +119 -0
- package/dist/doctor/install-findings.js.map +1 -0
- package/dist/doctor/node-findings.d.ts +7 -0
- package/dist/doctor/node-findings.d.ts.map +1 -0
- package/dist/doctor/node-findings.js +19 -0
- package/dist/doctor/node-findings.js.map +1 -0
- package/dist/doctor/package-findings.d.ts +2 -0
- package/dist/doctor/package-findings.d.ts.map +1 -1
- package/dist/doctor/package-findings.js +1 -1
- package/dist/doctor/package-findings.js.map +1 -1
- package/dist/doctor/submodule-findings.d.ts +7 -0
- package/dist/doctor/submodule-findings.d.ts.map +1 -0
- package/dist/doctor/submodule-findings.js +22 -0
- package/dist/doctor/submodule-findings.js.map +1 -0
- 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/schedule/cron-problem.d.ts.map +1 -1
- package/dist/generate/schedule/cron-problem.js +16 -1
- package/dist/generate/schedule/cron-problem.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 +32 -13
- 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 +4 -3
- package/dist/help/usage.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +4 -2
- 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/lint/eslint-in-project.d.ts +8 -0
- package/dist/lint/eslint-in-project.d.ts.map +1 -0
- package/dist/lint/eslint-in-project.js +33 -0
- package/dist/lint/eslint-in-project.js.map +1 -0
- package/dist/lint/format-verdict.d.ts +4 -0
- package/dist/lint/format-verdict.d.ts.map +1 -0
- package/dist/lint/format-verdict.js +11 -0
- package/dist/lint/format-verdict.js.map +1 -0
- package/dist/lint/lint-run.d.ts +8 -0
- package/dist/lint/lint-run.d.ts.map +1 -0
- package/dist/lint/lint-run.js +2 -0
- package/dist/lint/lint-run.js.map +1 -0
- package/dist/lint/lint-verdict.d.ts +19 -0
- package/dist/lint/lint-verdict.d.ts.map +1 -0
- package/dist/lint/lint-verdict.js +25 -0
- package/dist/lint/lint-verdict.js.map +1 -0
- package/dist/lint/parse-lint-answer.d.ts +13 -0
- package/dist/lint/parse-lint-answer.d.ts.map +1 -0
- package/dist/lint/parse-lint-answer.js +18 -0
- package/dist/lint/parse-lint-answer.js.map +1 -0
- package/dist/migration/plan-replay.d.ts +4 -3
- package/dist/migration/plan-replay.d.ts.map +1 -1
- package/dist/migration/plan-replay.js +21 -6
- package/dist/migration/plan-replay.js.map +1 -1
- package/dist/migration/rename-branch-migrations.d.ts +13 -0
- package/dist/migration/rename-branch-migrations.d.ts.map +1 -0
- package/dist/migration/rename-branch-migrations.js +25 -0
- package/dist/migration/rename-branch-migrations.js.map +1 -0
- package/dist/migration/replay-drizzle-migrations.d.ts +6 -3
- package/dist/migration/replay-drizzle-migrations.d.ts.map +1 -1
- package/dist/migration/replay-drizzle-migrations.js +48 -4
- package/dist/migration/replay-drizzle-migrations.js.map +1 -1
- package/dist/migration/replay-plan.d.ts +8 -0
- package/dist/migration/replay-plan.d.ts.map +1 -1
- package/dist/migration/restore-migration-folder.d.ts +4 -0
- package/dist/migration/restore-migration-folder.d.ts.map +1 -0
- package/dist/migration/restore-migration-folder.js +15 -0
- package/dist/migration/restore-migration-folder.js.map +1 -0
- package/dist/package-manager/lockfiles.d.ts +2 -0
- package/dist/package-manager/lockfiles.d.ts.map +1 -1
- package/dist/package-manager/lockfiles.js +5 -0
- package/dist/package-manager/lockfiles.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/run.d.ts.map +1 -1
- package/dist/run.js +2 -0
- package/dist/run.js.map +1 -1
- 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 +3 -3
- 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
|
@@ -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();
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Clock } from '@ddd-ts-kit/kernel';
|
|
2
2
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
3
3
|
import { Account } from '{{alias.context}}/domain/aggregates/account.aggregate{{alias.ext}}';
|
|
4
|
+
{{#unless refusals.named}}
|
|
4
5
|
import { AccountError } from '{{alias.context}}/domain/errors/account.error{{alias.ext}}';
|
|
6
|
+
{{/unless}}
|
|
7
|
+
{{#if refusals.named}}
|
|
8
|
+
import { EmailNotVerified } from '{{alias.context}}/domain/errors/email-not-verified.error{{alias.ext}}';
|
|
9
|
+
{{/if}}
|
|
5
10
|
import type { AccountRepository } from '{{alias.context}}/domain/repositories/account.repository{{alias.ext}}';
|
|
6
11
|
import { DisplayName } from '{{alias.context}}/domain/value-objects/display-name.vo{{alias.ext}}';
|
|
7
12
|
import { EmailAddress } from '{{alias.context}}/domain/value-objects/email-address.vo{{alias.ext}}';
|
|
@@ -21,7 +26,12 @@ export class ProvisionAccountHandler implements CommandHandler<ProvisionAccountC
|
|
|
21
26
|
*/
|
|
22
27
|
async execute({ actor, profile }: ProvisionAccountCommand): Promise<string> {
|
|
23
28
|
if (!profile.emailVerified) {
|
|
29
|
+
{{#if refusals.named}}
|
|
30
|
+
throw EmailNotVerified.forAccount(actor.id);
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{#unless refusals.named}}
|
|
24
33
|
throw AccountError.emailNotVerified(actor.id);
|
|
34
|
+
{{/unless}}
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
const current = { email: EmailAddress.create(profile.email), displayName: DisplayName.create(profile.displayName) };
|
|
@@ -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}}';
|
|
@@ -60,11 +66,21 @@ export class RemoveMemberHandler implements CommandHandler<RemoveMemberCommand>
|
|
|
60
66
|
const member = await this.memberRepository.findOf(organisationId, accountId);
|
|
61
67
|
|
|
62
68
|
if (organisation === undefined) {
|
|
69
|
+
{{#if refusals.named}}
|
|
70
|
+
throw UnknownOrganisation.forOrganisation(organisationId);
|
|
71
|
+
{{/if}}
|
|
72
|
+
{{#unless refusals.named}}
|
|
63
73
|
throw OrganisationError.notFound(organisationId);
|
|
74
|
+
{{/unless}}
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
if (member === undefined) {
|
|
78
|
+
{{#if refusals.named}}
|
|
79
|
+
throw UnknownMember.forMembership(organisationId, accountId);
|
|
80
|
+
{{/if}}
|
|
81
|
+
{{#unless refusals.named}}
|
|
67
82
|
throw MemberError.notFound(organisationId, accountId);
|
|
83
|
+
{{/unless}}
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
return { organisation, member };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Access } from '@ddd-ts-kit/auth';
|
|
2
2
|
import type { Clock } from '@ddd-ts-kit/kernel';
|
|
3
3
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{#unless refusals.named}}
|
|
4
5
|
import { DelegationError } from '{{alias.context}}/domain/errors/delegation.error{{alias.ext}}';
|
|
6
|
+
{{/unless}}
|
|
7
|
+
{{#if refusals.named}}
|
|
8
|
+
import { UnknownDelegation } from '{{alias.context}}/domain/errors/unknown-delegation.error{{alias.ext}}';
|
|
9
|
+
{{/if}}
|
|
5
10
|
import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
|
|
6
11
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
7
12
|
import { RoleRightsService } from '{{alias.context}}/domain/services/role-rights.service{{alias.ext}}';
|
|
@@ -28,7 +33,12 @@ export class RevokeDelegationHandler implements CommandHandler<RevokeDelegationC
|
|
|
28
33
|
const delegation = await this.delegationRepository.findById(delegationId);
|
|
29
34
|
|
|
30
35
|
if (delegation?.organisationId !== organisationId) {
|
|
36
|
+
{{#if refusals.named}}
|
|
37
|
+
throw UnknownDelegation.forDelegation(delegationId);
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#unless refusals.named}}
|
|
31
40
|
throw DelegationError.notFound(delegationId);
|
|
41
|
+
{{/unless}}
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
delegation.revoke(now);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { Access } from '@ddd-ts-kit/auth';
|
|
2
2
|
import type { Clock } from '@ddd-ts-kit/kernel';
|
|
3
3
|
import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
|
|
4
|
+
{{#unless refusals.named}}
|
|
4
5
|
import { InvitationError } from '{{alias.context}}/domain/errors/invitation.error{{alias.ext}}';
|
|
6
|
+
{{/unless}}
|
|
7
|
+
{{#if refusals.named}}
|
|
8
|
+
import { UnknownInvitation } from '{{alias.context}}/domain/errors/unknown-invitation.error{{alias.ext}}';
|
|
9
|
+
{{/if}}
|
|
5
10
|
import type { DelegationRepository } from '{{alias.context}}/domain/repositories/delegation.repository{{alias.ext}}';
|
|
6
11
|
import type { InvitationRepository } from '{{alias.context}}/domain/repositories/invitation.repository{{alias.ext}}';
|
|
7
12
|
import type { MemberRepository } from '{{alias.context}}/domain/repositories/member.repository{{alias.ext}}';
|
|
@@ -31,7 +36,12 @@ export class RevokeInvitationHandler implements CommandHandler<RevokeInvitationC
|
|
|
31
36
|
const invitation = await this.invitationRepository.findById(invitationId);
|
|
32
37
|
|
|
33
38
|
if (invitation?.organisationId !== organisationId) {
|
|
39
|
+
{{#if refusals.named}}
|
|
40
|
+
throw UnknownInvitation.forReference();
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#unless refusals.named}}
|
|
34
43
|
throw InvitationError.notFound();
|
|
44
|
+
{{/unless}}
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
invitation.revoke(now);
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { AggregateRoot } 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 { AccountAlreadyDeactivated } from '{{alias.context}}/domain/errors/account-already-deactivated.error{{alias.ext}}';
|
|
7
|
+
import { DeactivatedAccount } from '{{alias.context}}/domain/errors/deactivated-account.error{{alias.ext}}';
|
|
8
|
+
{{/if}}
|
|
3
9
|
import { AccountDeactivated } from '{{alias.context}}/domain/events/account-deactivated.event{{alias.ext}}';
|
|
4
10
|
import { AccountProvisioned } from '{{alias.context}}/domain/events/account-provisioned.event{{alias.ext}}';
|
|
5
11
|
import type { DisplayName } from '{{alias.context}}/domain/value-objects/display-name.vo{{alias.ext}}';
|
|
@@ -56,7 +62,12 @@ export class Account extends AggregateRoot<string> {
|
|
|
56
62
|
/** The person signs in no more; their memberships and their history stay. */
|
|
57
63
|
deactivate(now: Date): void {
|
|
58
64
|
if (!this.isActive) {
|
|
65
|
+
{{#if refusals.named}}
|
|
66
|
+
throw AccountAlreadyDeactivated.forAccount(this.id);
|
|
67
|
+
{{/if}}
|
|
68
|
+
{{#unless refusals.named}}
|
|
59
69
|
throw AccountError.alreadyDeactivated(this.id);
|
|
70
|
+
{{/unless}}
|
|
60
71
|
}
|
|
61
72
|
|
|
62
73
|
this.state = { ...this.state, status: AccountStatus.Deactivated, deactivatedAt: now };
|
|
@@ -66,7 +77,12 @@ export class Account extends AggregateRoot<string> {
|
|
|
66
77
|
/** Refuses every intention of a deactivated account. */
|
|
67
78
|
assertActive(): void {
|
|
68
79
|
if (!this.isActive) {
|
|
80
|
+
{{#if refusals.named}}
|
|
81
|
+
throw DeactivatedAccount.forAccount(this.id);
|
|
82
|
+
{{/if}}
|
|
83
|
+
{{#unless refusals.named}}
|
|
69
84
|
throw AccountError.deactivated(this.id);
|
|
85
|
+
{{/unless}}
|
|
70
86
|
}
|
|
71
87
|
}
|
|
72
88
|
|
|
@@ -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
|
+
}
|