ddd-ts-kit 0.105.0 → 0.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.fr.md +22 -13
  3. package/README.md +20 -12
  4. package/dist/check/baseline/renamed-files.d.ts.map +1 -1
  5. package/dist/check/baseline/renamed-files.js +2 -1
  6. package/dist/check/baseline/renamed-files.js.map +1 -1
  7. package/dist/check/commands/changed-files.d.ts.map +1 -1
  8. package/dist/check/commands/changed-files.js +2 -1
  9. package/dist/check/commands/changed-files.js.map +1 -1
  10. package/dist/check/project/git-ignored.d.ts.map +1 -1
  11. package/dist/check/project/git-ignored.js +2 -1
  12. package/dist/check/project/git-ignored.js.map +1 -1
  13. package/dist/check/rules/authz-declared.d.ts.map +1 -1
  14. package/dist/check/rules/authz-declared.js +2 -1
  15. package/dist/check/rules/authz-declared.js.map +1 -1
  16. package/dist/commit/git-arguments.d.ts +9 -0
  17. package/dist/commit/git-arguments.d.ts.map +1 -0
  18. package/dist/commit/git-arguments.js +46 -0
  19. package/dist/commit/git-arguments.js.map +1 -0
  20. package/dist/commit/run-git.d.ts.map +1 -1
  21. package/dist/commit/run-git.js +2 -1
  22. package/dist/commit/run-git.js.map +1 -1
  23. package/dist/config/index.d.ts +1 -0
  24. package/dist/config/index.d.ts.map +1 -1
  25. package/dist/config/index.js +1 -0
  26. package/dist/config/index.js.map +1 -1
  27. package/dist/config/kit-container.d.ts +6 -0
  28. package/dist/config/kit-container.d.ts.map +1 -0
  29. package/dist/config/kit-container.js +10 -0
  30. package/dist/config/kit-container.js.map +1 -0
  31. package/dist/config/stack.d.ts +1 -1
  32. package/dist/config/stack.d.ts.map +1 -1
  33. package/dist/config/stack.js +1 -1
  34. package/dist/config/stack.js.map +1 -1
  35. package/dist/doctor/format-diagnosis.js +3 -0
  36. package/dist/doctor/format-diagnosis.js.map +1 -1
  37. package/dist/doctor/hook-findings.d.ts +2 -1
  38. package/dist/doctor/hook-findings.d.ts.map +1 -1
  39. package/dist/doctor/hook-findings.js +10 -2
  40. package/dist/doctor/hook-findings.js.map +1 -1
  41. package/dist/doctor/permission-findings.js +1 -0
  42. package/dist/doctor/permission-findings.js.map +1 -1
  43. package/dist/generate/di-entry.d.ts +4 -0
  44. package/dist/generate/di-entry.d.ts.map +1 -0
  45. package/dist/generate/di-entry.js +5 -0
  46. package/dist/generate/di-entry.js.map +1 -0
  47. package/dist/generate/di-imports.d.ts +4 -0
  48. package/dist/generate/di-imports.d.ts.map +1 -0
  49. package/dist/generate/di-imports.js +12 -0
  50. package/dist/generate/di-imports.js.map +1 -0
  51. package/dist/generate/kinds/adapter-kind.d.ts.map +1 -1
  52. package/dist/generate/kinds/adapter-kind.js +3 -2
  53. package/dist/generate/kinds/adapter-kind.js.map +1 -1
  54. package/dist/generate/kinds/background/spec-family.d.ts +1 -1
  55. package/dist/generate/kinds/background/spec-family.d.ts.map +1 -1
  56. package/dist/generate/kinds/background/spec-family.js +2 -1
  57. package/dist/generate/kinds/background/spec-family.js.map +1 -1
  58. package/dist/generate/kinds/command-outputs.d.ts.map +1 -1
  59. package/dist/generate/kinds/command-outputs.js +2 -1
  60. package/dist/generate/kinds/command-outputs.js.map +1 -1
  61. package/dist/generate/kinds/extraction/service-selection.d.ts.map +1 -1
  62. package/dist/generate/kinds/extraction/service-selection.js +2 -1
  63. package/dist/generate/kinds/extraction/service-selection.js.map +1 -1
  64. package/dist/generate/kinds/gateway-kind.js +1 -1
  65. package/dist/generate/kinds/gateway-kind.js.map +1 -1
  66. package/dist/generate/kinds/import-assembler.d.ts.map +1 -1
  67. package/dist/generate/kinds/import-assembler.js +11 -2
  68. package/dist/generate/kinds/import-assembler.js.map +1 -1
  69. package/dist/generate/kinds/job/grant-system-actor.d.ts.map +1 -1
  70. package/dist/generate/kinds/job/grant-system-actor.js +8 -4
  71. package/dist/generate/kinds/job/grant-system-actor.js.map +1 -1
  72. package/dist/generate/kinds/job-kind.d.ts.map +1 -1
  73. package/dist/generate/kinds/job-kind.js +2 -1
  74. package/dist/generate/kinds/job-kind.js.map +1 -1
  75. package/dist/generate/kinds/personal-data/declare-personal-data.js +1 -1
  76. package/dist/generate/kinds/personal-data/declare-personal-data.js.map +1 -1
  77. package/dist/generate/kinds/query-outputs.d.ts.map +1 -1
  78. package/dist/generate/kinds/query-outputs.js +2 -1
  79. package/dist/generate/kinds/query-outputs.js.map +1 -1
  80. package/dist/generate/kinds/test-world-kind.d.ts.map +1 -1
  81. package/dist/generate/kinds/test-world-kind.js +3 -2
  82. package/dist/generate/kinds/test-world-kind.js.map +1 -1
  83. package/dist/generate/kinds/world/context-fakes.d.ts.map +1 -1
  84. package/dist/generate/kinds/world/context-fakes.js +2 -1
  85. package/dist/generate/kinds/world/context-fakes.js.map +1 -1
  86. package/dist/generate/kinds/world/world-arrangement.d.ts.map +1 -1
  87. package/dist/generate/kinds/world/world-arrangement.js +2 -1
  88. package/dist/generate/kinds/world/world-arrangement.js.map +1 -1
  89. package/dist/generate/kinds/world/world-vars.d.ts.map +1 -1
  90. package/dist/generate/kinds/world/world-vars.js +2 -1
  91. package/dist/generate/kinds/world/world-vars.js.map +1 -1
  92. package/dist/generate/spec-vars.d.ts.map +1 -1
  93. package/dist/generate/spec-vars.js +2 -1
  94. package/dist/generate/spec-vars.js.map +1 -1
  95. package/dist/generate/wiring-family.d.ts +1 -1
  96. package/dist/generate/wiring-family.d.ts.map +1 -1
  97. package/dist/generate/wiring-family.js +2 -1
  98. package/dist/generate/wiring-family.js.map +1 -1
  99. package/dist/generate/wirings.js +2 -2
  100. package/dist/generate/wirings.js.map +1 -1
  101. package/dist/help/usage.js +1 -1
  102. package/dist/init/add-presets.d.ts +8 -0
  103. package/dist/init/add-presets.d.ts.map +1 -0
  104. package/dist/init/add-presets.js +17 -0
  105. package/dist/init/add-presets.js.map +1 -0
  106. package/dist/init/agent-permissions.js +2 -0
  107. package/dist/init/agent-permissions.js.map +1 -1
  108. package/dist/init/files/audit-files.js +1 -1
  109. package/dist/init/files/audit-files.js.map +1 -1
  110. package/dist/init/files/auth-files.js +2 -2
  111. package/dist/init/files/auth-files.js.map +1 -1
  112. package/dist/init/files/event-sourcing-files.js +1 -1
  113. package/dist/init/files/event-sourcing-files.js.map +1 -1
  114. package/dist/init/files/family-of.d.ts +1 -1
  115. package/dist/init/files/family-of.d.ts.map +1 -1
  116. package/dist/init/files/family-of.js +2 -1
  117. package/dist/init/files/family-of.js.map +1 -1
  118. package/dist/init/files/persistence-files.d.ts.map +1 -1
  119. package/dist/init/files/persistence-files.js +2 -1
  120. package/dist/init/files/persistence-files.js.map +1 -1
  121. package/dist/init/files/platform-files.js +2 -2
  122. package/dist/init/files/platform-files.js.map +1 -1
  123. package/dist/init/files/privacy-files.js +1 -1
  124. package/dist/init/files/privacy-files.js.map +1 -1
  125. package/dist/init/manifest/dependencies-against-stack.d.ts.map +1 -1
  126. package/dist/init/manifest/dependencies-against-stack.js +5 -1
  127. package/dist/init/manifest/dependencies-against-stack.js.map +1 -1
  128. package/dist/init/manifest/dependencies-for.d.ts.map +1 -1
  129. package/dist/init/manifest/dependencies-for.js +4 -0
  130. package/dist/init/manifest/dependencies-for.js.map +1 -1
  131. package/dist/init/manifest/versions.d.ts.map +1 -1
  132. package/dist/init/manifest/versions.js +28 -24
  133. package/dist/init/manifest/versions.js.map +1 -1
  134. package/dist/init/manifest/write-manifest.js +1 -1
  135. package/dist/init/manifest/write-manifest.js.map +1 -1
  136. package/dist/init/regulated-sandbox.d.ts +5 -3
  137. package/dist/init/regulated-sandbox.d.ts.map +1 -1
  138. package/dist/init/regulated-sandbox.js +6 -3
  139. package/dist/init/regulated-sandbox.js.map +1 -1
  140. package/dist/init/rewire-personal-data.js +1 -1
  141. package/dist/init/rewire-personal-data.js.map +1 -1
  142. package/dist/init/rewire-preset.d.ts +1 -1
  143. package/dist/init/rewire-preset.d.ts.map +1 -1
  144. package/dist/init/rewire-preset.js +5 -2
  145. package/dist/init/rewire-preset.js.map +1 -1
  146. package/dist/init/run-init.js +1 -5
  147. package/dist/init/run-init.js.map +1 -1
  148. package/dist/init/stack/resolve-stack.js +1 -1
  149. package/dist/init/stack/resolve-stack.js.map +1 -1
  150. package/dist/init/stack/resolve-style.d.ts +1 -1
  151. package/dist/init/stack/resolve-style.js +4 -4
  152. package/dist/init/stack/resolve-style.js.map +1 -1
  153. package/dist/init/validation-dependencies.d.ts.map +1 -1
  154. package/dist/init/validation-dependencies.js +3 -1
  155. package/dist/init/validation-dependencies.js.map +1 -1
  156. package/dist/layout/fit-statement.js +16 -2
  157. package/dist/layout/fit-statement.js.map +1 -1
  158. package/dist/merge/git-process.d.ts.map +1 -1
  159. package/dist/merge/git-process.js +2 -1
  160. package/dist/merge/git-process.js.map +1 -1
  161. package/dist/merge/lost/revision-files.d.ts.map +1 -1
  162. package/dist/merge/lost/revision-files.js +6 -1
  163. package/dist/merge/lost/revision-files.js.map +1 -1
  164. package/dist/merge/lost/side-hunks.d.ts.map +1 -1
  165. package/dist/merge/lost/side-hunks.js +2 -1
  166. package/dist/merge/lost/side-hunks.js.map +1 -1
  167. package/dist/merge/object-bytes.d.ts.map +1 -1
  168. package/dist/merge/object-bytes.js +2 -1
  169. package/dist/merge/object-bytes.js.map +1 -1
  170. package/dist/package-manager/package-manager-vars.d.ts +1 -1
  171. package/dist/package-manager/package-manager-vars.js +2 -2
  172. package/dist/package-manager/package-manager-vars.js.map +1 -1
  173. package/dist/package-manager/pinned-package-managers.d.ts +2 -2
  174. package/dist/package-manager/pinned-package-managers.js +2 -2
  175. package/dist/plan/copy-of-project.d.ts.map +1 -1
  176. package/dist/plan/copy-of-project.js +2 -1
  177. package/dist/plan/copy-of-project.js.map +1 -1
  178. package/dist/presets/apply-preset.d.ts.map +1 -1
  179. package/dist/presets/apply-preset.js +2 -0
  180. package/dist/presets/apply-preset.js.map +1 -1
  181. package/dist/presets/identity-refusal.d.ts.map +1 -1
  182. package/dist/presets/identity-refusal.js +4 -3
  183. package/dist/presets/identity-refusal.js.map +1 -1
  184. package/dist/presets/organisations-as-audit-chains.d.ts +10 -0
  185. package/dist/presets/organisations-as-audit-chains.d.ts.map +1 -0
  186. package/dist/presets/organisations-as-audit-chains.js +30 -0
  187. package/dist/presets/organisations-as-audit-chains.js.map +1 -0
  188. package/dist/stack/stack-vars.d.ts.map +1 -1
  189. package/dist/stack/stack-vars.js +7 -2
  190. package/dist/stack/stack-vars.js.map +1 -1
  191. package/dist/version.d.ts +1 -1
  192. package/dist/version.js +1 -1
  193. package/package.json +8 -5
  194. package/templates/architecture/{extractable.tsyringe.spec.ts.tpl → extractable.container.spec.ts.tpl} +2 -1
  195. package/templates/architecture/extractable.declared.spec.ts.tpl +2 -1
  196. package/templates/controller/guard.spec.ts.tpl +20 -15
  197. package/templates/controller/guard.ts.tpl +3 -5
  198. package/templates/init/README.md.tpl +8 -6
  199. package/templates/init/docker/Dockerfile.tpl +7 -7
  200. package/templates/init/docker/env.example.tpl +2 -0
  201. package/templates/init/e2e/start-application.database.ts.tpl +5 -5
  202. package/templates/init/e2e/start-application.memory.ts.tpl +5 -5
  203. package/templates/init/main.ts.tpl +1 -0
  204. package/templates/init/platform/composition/{compose-application.tsyringe.ts.tpl → compose-application.container.ts.tpl} +4 -7
  205. package/templates/init/platform/composition/compose-application.manual.ts.tpl +2 -0
  206. package/templates/init/platform/events/start-outbox-relay.ts.tpl +5 -1
  207. package/templates/init/platform/observability/create-logger.stdout.ts.tpl +2 -2
  208. package/templates/init/platform/observability/create-metrics.ts.tpl +6 -3
  209. package/templates/init/platform/resilience/adapters-with-own-policy.ts.tpl +1 -1
  210. package/templates/init/platform/resilience/default-policy.ts.tpl +1 -1
  211. package/templates/init/rules/platform.md.tpl +3 -3
  212. package/templates/init/rules/tests.md.tpl +2 -2
  213. package/templates/pipeline/biome.json.tpl +1 -1
  214. package/templates/pipeline/github/actions/setup/action.yml.tpl +3 -2
  215. package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +2 -2
  216. package/templates/pipeline/package-scripts.json +2 -2
  217. package/templates/presets/identity/context/application/commands/deactivate-account/deactivate-account.handler.ts.tpl +6 -4
  218. package/templates/presets/identity/context/test/integration/organisation-tenant-directory.spec.ts.tpl +7 -6
  219. package/templates/presets/identity/context/test/worlds/__context__.world.declared.ts.tpl +2 -1
  220. package/templates/presets/identity/design.md.tpl +4 -2
  221. package/templates/presets/identity/e2e/support.wiring.tpl +4 -4
  222. package/templates/presets/identity/platform/organisation-of-command.ts.tpl +36 -0
  223. package/templates/repository/knex/mapper.ts.tpl +1 -1
  224. package/templates/service/main.ts.tpl +1 -0
  225. /package/templates/adapter/{simulated.wiring.tsyringe.tpl → simulated.wiring.container.tpl} +0 -0
  226. /package/templates/adapter/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  227. /package/templates/architecture/{hosting.tsyringe.spec.ts.tpl → hosting.container.spec.ts.tpl} +0 -0
  228. /package/templates/architecture/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  229. /package/templates/background-job/{background-job.spec.tsyringe.ts.tpl → background-job.spec.container.ts.tpl} +0 -0
  230. /package/templates/background-job/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  231. /package/templates/command/{handler.spec.tsyringe.ts.tpl → handler.spec.container.ts.tpl} +0 -0
  232. /package/templates/command/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  233. /package/templates/context/{module.tsyringe.ts.tpl → module.container.ts.tpl} +0 -0
  234. /package/templates/context/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  235. /package/templates/controller/{routes.tsyringe.tpl → routes.container.tpl} +0 -0
  236. /package/templates/erasure-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  237. /package/templates/event-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  238. /package/templates/file-upload/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  239. /package/templates/gateway/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  240. /package/templates/init/platform/audit/{audit.module.tsyringe.ts.tpl → audit.module.container.ts.tpl} +0 -0
  241. /package/templates/init/platform/auth/authorization/{authorization.tsyringe.ts.tpl → authorization.container.ts.tpl} +0 -0
  242. /package/templates/init/platform/buses/{create-command-bus.tsyringe.ts.tpl → create-command-bus.container.ts.tpl} +0 -0
  243. /package/templates/init/platform/buses/{create-query-bus.tsyringe.ts.tpl → create-query-bus.container.ts.tpl} +0 -0
  244. /package/templates/init/platform/composition/{context-selection.tsyringe.ts.tpl → context-selection.container.ts.tpl} +0 -0
  245. /package/templates/init/platform/composition/{lay-foundations.tsyringe.ts.tpl → lay-foundations.container.ts.tpl} +0 -0
  246. /package/templates/init/platform/composition/{platform-test.module.tsyringe.ts.tpl → platform-test.module.container.ts.tpl} +0 -0
  247. /package/templates/init/platform/composition/{platform.module.tsyringe.ts.tpl → platform.module.container.ts.tpl} +0 -0
  248. /package/templates/init/platform/composition/{routes-of.tsyringe.ts.tpl → routes-of.container.ts.tpl} +0 -0
  249. /package/templates/init/platform/files/{bind-files.tsyringe.ts.tpl → bind-files.container.ts.tpl} +0 -0
  250. /package/templates/init/platform/files/{files.module.tsyringe.ts.tpl → files.module.container.ts.tpl} +0 -0
  251. /package/templates/init/platform/files/{staging-uploads.tsyringe.ts.tpl → staging-uploads.container.ts.tpl} +0 -0
  252. /package/templates/init/platform/jobs/{housekeeping.module.tsyringe.ts.tpl → housekeeping.module.container.ts.tpl} +0 -0
  253. /package/templates/init/platform/privacy/{data-subject-copies.tsyringe.ts.tpl → data-subject-copies.container.ts.tpl} +0 -0
  254. /package/templates/init/platform/privacy/{data-subject-exports.tsyringe.ts.tpl → data-subject-exports.container.ts.tpl} +0 -0
  255. /package/templates/init/platform/privacy/{privacy.module.tsyringe.ts.tpl → privacy.module.container.ts.tpl} +0 -0
  256. /package/templates/init/platform/privacy/{run-erasure.tsyringe.ts.tpl → run-erasure.container.ts.tpl} +0 -0
  257. /package/templates/init/platform/privacy/{run-export.tsyringe.ts.tpl → run-export.container.ts.tpl} +0 -0
  258. /package/templates/init/platform/privacy/{run-purge.tsyringe.ts.tpl → run-purge.container.ts.tpl} +0 -0
  259. /package/templates/init/scripts/{privacy-erase.tsyringe.ts.tpl → privacy-erase.container.ts.tpl} +0 -0
  260. /package/templates/init/scripts/{privacy-export.tsyringe.ts.tpl → privacy-export.container.ts.tpl} +0 -0
  261. /package/templates/init/scripts/{privacy-purge.tsyringe.ts.tpl → privacy-purge.container.ts.tpl} +0 -0
  262. /package/templates/integration-event/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  263. /package/templates/integration-handler/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  264. /package/templates/job/{job.spec.tsyringe.ts.tpl → job.spec.container.ts.tpl} +0 -0
  265. /package/templates/job/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  266. /package/templates/module/{module-file.tsyringe.ts.tpl → module-file.container.ts.tpl} +0 -0
  267. /package/templates/module/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  268. /package/templates/personal-data/{copies.tsyringe.tpl → copies.container.tpl} +0 -0
  269. /package/templates/personal-data/{exports.tsyringe.tpl → exports.container.tpl} +0 -0
  270. /package/templates/personal-data/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  271. /package/templates/process/{timeout-job.spec.tsyringe.ts.tpl → timeout-job.spec.container.ts.tpl} +0 -0
  272. /package/templates/process/{timeout-job.wiring.tsyringe.tpl → timeout-job.wiring.container.tpl} +0 -0
  273. /package/templates/projection/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  274. /package/templates/query/{handler.spec.tsyringe.ts.tpl → handler.spec.container.ts.tpl} +0 -0
  275. /package/templates/query/{search.handler.spec.tsyringe.ts.tpl → search.handler.spec.container.ts.tpl} +0 -0
  276. /package/templates/query/{search.wiring.tsyringe.tpl → search.wiring.container.tpl} +0 -0
  277. /package/templates/query/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  278. /package/templates/repository/{event-sourced.wiring.tsyringe.tpl → event-sourced.wiring.container.tpl} +0 -0
  279. /package/templates/repository/{wiring.tsyringe.tpl → wiring.container.tpl} +0 -0
  280. /package/templates/route/{routes.on-tsyringe.tpl → routes.on-container.tpl} +0 -0
  281. /package/templates/service/{extracted.tsyringe.tpl → extracted.container.tpl} +0 -0
  282. /package/templates/test-world/{world.tsyringe.ts.tpl → world.container.ts.tpl} +0 -0
@@ -20,10 +20,10 @@
20
20
  "ci:build": "npm run build"
21
21
  },
22
22
  "devDependencies": {
23
- "@biomejs/biome": "2.6.2",
23
+ "@biomejs/biome": "2.6.3",
24
24
  "@commitlint/cli": "^21.2.3",
25
25
  "@commitlint/config-conventional": "^21.2.3",
26
- "@ddd-ts-kit/eslint-plugin": "^0.105.0",
26
+ "@ddd-ts-kit/eslint-plugin": "^0.106.0",
27
27
  "@eslint/js": "^10.0.1",
28
28
  "@typescript/native": "npm:typescript@~7.0.2",
29
29
  "@vitest/coverage-v8": "^5.0.3",
@@ -39,10 +39,12 @@ export class DeactivateAccountHandler implements CommandHandler<DeactivateAccoun
39
39
 
40
40
  /**
41
41
  * A person deactivates their own account, which leaves every organisation it belongs to and ends
42
- * every delegation it gave or received there, in the same unit of work: a deactivated account
43
- * holds no right anywhere, whatever its token says until it expires. The last owner of an
44
- * organisation is refused: they appoint another owner first. The provider is asked to disable
45
- * the person once it is committed (`application/integration/handlers/`).
42
+ * every delegation it gave or received there, in the same unit of work. This context refuses the
43
+ * account at once; the other contexts read the token, so they refuse it at its next token: a
44
+ * token already issued lives until it expires (300 s in the realm of the kit). A project that
45
+ * wants no window checks the account at the edge. The last owner of an organisation is refused:
46
+ * they appoint another owner first. The provider is asked to disable the person once it is
47
+ * committed (`application/integration/handlers/`).
46
48
  */
47
49
  async execute({ actor }: DeactivateAccountCommand): Promise<string> {
48
50
  const account = await this.accountRepository.findById(actor.id);
@@ -1,8 +1,9 @@
1
1
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from '{{tests.module}}';
2
- {{#if di.tsyringe}}
3
- import { contextModule, createApplication, kernelModule } from '@ddd-ts-kit/di';
2
+ {{#if di.container}}
3
+ import { contextModule, kernelModule } from '@ddd-ts-kit/di';
4
+ import { createApplication } from '{{di.entry}}';
4
5
  {{/if}}
5
- {{#if di.tsyringe}}
6
+ {{#if di.container}}
6
7
  import {
7
8
  FixedClock,
8
9
  FixedExecutionScope,
@@ -13,10 +14,10 @@ import {
13
14
  type ScheduledJob,
14
15
  } from '@ddd-ts-kit/kernel';
15
16
  {{/if}}
16
- {{#unless di.tsyringe}}
17
+ {{#unless di.container}}
17
18
  import { FixedClock, FixedExecutionScope, executionContext, type Actor } from '@ddd-ts-kit/kernel';
18
19
  {{/unless}}
19
- {{#if di.tsyringe}}
20
+ {{#if di.container}}
20
21
  import { Scheduled } from '@ddd-ts-kit/kernel/declarations';
21
22
  {{/if}}
22
23
  import { {{preset.adapter.pascal}}OrganisationRepository } from '{{alias.context}}/infrastructure/persistence/{{preset.adapter.kebab}}-organisation.repository{{alias.ext}}';
@@ -67,7 +68,7 @@ describe('{{preset.adapter.pascal}}OrganisationTenantDirectory', () => {
67
68
  await organisations.save(anOrganisation().identifiedBy('globex').build());
68
69
  expect(await directory.tenants()).toEqual(['acme', 'globex']);
69
70
  });
70
- {{#if di.tsyringe}}
71
+ {{#if di.container}}
71
72
 
72
73
  it('gives an organisation opened after the boot its run of a per-tenant job', async () => {
73
74
  const { organisations, directory } = arrange();
@@ -1,7 +1,8 @@
1
1
  import { RoleBasedAuthorizer } from '@ddd-ts-kit/auth';
2
2
  import { authorizationModule } from '@ddd-ts-kit/auth/di';
3
3
  import { anActor } from '@ddd-ts-kit/auth/testing';
4
- import { contextModule, createTestApplication, fake } from '@ddd-ts-kit/di';
4
+ import { contextModule, fake } from '@ddd-ts-kit/di';
5
+ import { createTestApplication } from '{{di.entry}}';
5
6
  import type { Actor } from '@ddd-ts-kit/kernel';
6
7
  import * as {{context.camel}}Declarations from '{{alias.context}}/{{context.kebab}}.declarations{{alias.ext}}';
7
8
  import { platformTestModule } from '{{alias.platform}}/composition/platform-test.module{{alias.ext}}';
@@ -9,8 +9,10 @@ what their token says (`PUT /accounts/me`) and refreshed at each later one. No p
9
9
  of the provider is stored here. The email address of an account is always the one of the token,
10
10
  never one a client sends, and one the provider verified (`email_verified`): an invitation is
11
11
  matched on it. A deactivated account leaves every organisation and ends every delegation in the
12
- same unit of work, so that it holds no right anywhere while its last token lives; the last owner
13
- of an organisation appoints another owner before deactivating.
12
+ same unit of work; the last owner of an organisation appoints another owner before deactivating.
13
+ This context refuses the account at once, the other contexts at its next token: they read the
14
+ token, and a token already issued lives until it expires (300 s in the realm of the kit). A
15
+ project that wants no window checks the account at the edge.
14
16
 
15
17
  **Organisations, members and roles.** An organisation is opened under its slug, which is its
16
18
  identity for good, and its opener is its first owner. A member holds one role, `owner`, `admin`
@@ -1,16 +1,16 @@
1
1
  @@imports
2
- {{#if di.tsyringe}}
2
+ {{#if di.container}}
3
3
  import { IdentityProviderAdmin } from '{{alias.context}}/application/ports/identity-provider-admin.port{{alias.ext}}';
4
4
  {{/if}}
5
- {{#unless di.tsyringe}}
5
+ {{#unless di.container}}
6
6
  import { {{context.camel}}Module } from '{{alias.context}}/{{context.kebab}}.module{{alias.ext}}';
7
7
  {{/unless}}
8
8
  import { FakeIdentityProviderAdmin } from '{{alias.context}}/test/fakes/identity-provider-admin.fake{{alias.ext}}';
9
9
  @@e2e-fakes
10
- {{#if di.tsyringe}}
10
+ {{#if di.container}}
11
11
  builder.rebind(IdentityProviderAdmin).toValue(new FakeIdentityProviderAdmin());
12
12
  {{/if}}
13
- {{#unless di.tsyringe}}
13
+ {{#unless di.container}}
14
14
  if (module === {{context.camel}}Module) {
15
15
  return (platform) => {{context.camel}}Module(platform, { identityProvider: new FakeIdentityProviderAdmin() });
16
16
  }
@@ -0,0 +1,36 @@
1
+ import type { Message } from '@ddd-ts-kit/kernel';
2
+ import { ChangeMemberRoleCommand } from '{{alias.context}}/application/commands/change-member-role/change-member-role.command{{alias.ext}}';
3
+ import { GrantDelegationCommand } from '{{alias.context}}/application/commands/grant-delegation/grant-delegation.command{{alias.ext}}';
4
+ import { InviteMemberCommand } from '{{alias.context}}/application/commands/invite-member/invite-member.command{{alias.ext}}';
5
+ import { OpenOrganisationCommand } from '{{alias.context}}/application/commands/open-organisation/open-organisation.command{{alias.ext}}';
6
+ import { RemoveMemberCommand } from '{{alias.context}}/application/commands/remove-member/remove-member.command{{alias.ext}}';
7
+ import { RevokeDelegationCommand } from '{{alias.context}}/application/commands/revoke-delegation/revoke-delegation.command{{alias.ext}}';
8
+ import { RevokeInvitationCommand } from '{{alias.context}}/application/commands/revoke-invitation/revoke-invitation.command{{alias.ext}}';
9
+ import { OrganisationSlug } from '{{alias.context}}/domain/value-objects/organisation-slug.vo{{alias.ext}}';
10
+
11
+ /**
12
+ * The organisation a command of the {{context.kebab}} context acts on, whose audit chain receives its
13
+ * entry once it succeeded, whatever organisation the token of its sender names: the owner of an
14
+ * organisation reads there who opened it, invited, removed, changed a role or lent a right in it.
15
+ * The entry of a failure, and the decision of the authorization, stay in the tenant of the token,
16
+ * since they record what the sender asked. Accepting or declining an invitation names its token
17
+ * only: the organisation it joins reads `{{context.kebab}}.member.joined` in its own chain.
18
+ */
19
+ export function organisationOfCommand(message: Message): string | undefined {
20
+ if (message instanceof OpenOrganisationCommand) {
21
+ return OrganisationSlug.create(message.organisation.slug).value;
22
+ }
23
+
24
+ if (
25
+ message instanceof ChangeMemberRoleCommand ||
26
+ message instanceof GrantDelegationCommand ||
27
+ message instanceof InviteMemberCommand ||
28
+ message instanceof RemoveMemberCommand ||
29
+ message instanceof RevokeDelegationCommand ||
30
+ message instanceof RevokeInvitationCommand
31
+ ) {
32
+ return message.organisationId;
33
+ }
34
+
35
+ return undefined;
36
+ }
@@ -12,7 +12,7 @@ export const {{aggregate.pascal}}Mapper = {
12
12
  },
13
13
 
14
14
  toRow(saved: {{aggregate.pascal}}): {{aggregate.pascal}}Columns {
15
- // TODO(domain): flatten each value object of {{aggregate.pascal}}State into its columns; nothing of the row type leaves this file. A `jsonb` column holding an array or a string takes `JSON.stringify(value)` on Knex, where the other ORM serialize it.
15
+ // TODO(domain): flatten each value object of {{aggregate.pascal}}State into its columns; nothing of the row type leaves this file. A `jsonb` column holding an array or a string takes `jsonColumn(value)` of `@ddd-ts-kit/knex` on Knex, where the other ORM serialize it.
16
16
  {{#if personal.any}}
17
17
  return {
18
18
  id: saved.id,
@@ -87,6 +87,7 @@ const relay = startOutboxRelay({
87
87
  {{/unless}}
88
88
  intervalMs: config.outboxRelayIntervalMs,
89
89
  logger: application.logger,
90
+ metrics: application.metrics,
90
91
  {{#if errors.sentry}}
91
92
  errors,
92
93
  {{/if}}