@ddd-ts-kit/eslint-plugin 0.16.1 → 0.18.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 (125) hide show
  1. package/README.fr.md +7 -6
  2. package/README.md +5 -4
  3. package/dist/project/config.d.ts +8 -0
  4. package/dist/project/config.d.ts.map +1 -1
  5. package/dist/project/parse-config.d.ts.map +1 -1
  6. package/dist/project/parse-config.js +13 -0
  7. package/dist/project/parse-config.js.map +1 -1
  8. package/dist/rules/declarations-role-declared.d.ts +2 -2
  9. package/dist/rules/declarations-role-declared.d.ts.map +1 -1
  10. package/dist/rules/declarations-role-declared.js +4 -68
  11. package/dist/rules/declarations-role-declared.js.map +1 -1
  12. package/dist/rules/naming-business-name.d.ts +6 -0
  13. package/dist/rules/naming-business-name.d.ts.map +1 -0
  14. package/dist/rules/naming-business-name.js +175 -0
  15. package/dist/rules/naming-business-name.js.map +1 -0
  16. package/dist/rules/rules.d.ts.map +1 -1
  17. package/dist/rules/rules.js +2 -0
  18. package/dist/rules/rules.js.map +1 -1
  19. package/dist/support/business-names/binding-advice.d.ts +4 -0
  20. package/dist/support/business-names/binding-advice.d.ts.map +1 -0
  21. package/dist/support/business-names/binding-advice.js +12 -0
  22. package/dist/support/business-names/binding-advice.js.map +1 -0
  23. package/dist/support/business-names/binding-kind.d.ts +3 -0
  24. package/dist/support/business-names/binding-kind.d.ts.map +1 -0
  25. package/dist/support/business-names/binding-kind.js +2 -0
  26. package/dist/support/business-names/binding-kind.js.map +1 -0
  27. package/dist/support/business-names/built-class.d.ts +9 -0
  28. package/dist/support/business-names/built-class.d.ts.map +1 -0
  29. package/dist/support/business-names/built-class.js +37 -0
  30. package/dist/support/business-names/built-class.js.map +1 -0
  31. package/dist/support/business-names/called-member.d.ts +8 -0
  32. package/dist/support/business-names/called-member.d.ts.map +1 -0
  33. package/dist/support/business-names/called-member.js +10 -0
  34. package/dist/support/business-names/called-member.js.map +1 -0
  35. package/dist/support/business-names/camel.d.ts +3 -0
  36. package/dist/support/business-names/camel.d.ts.map +1 -0
  37. package/dist/support/business-names/camel.js +5 -0
  38. package/dist/support/business-names/camel.js.map +1 -0
  39. package/dist/support/business-names/collection-element.d.ts +4 -0
  40. package/dist/support/business-names/collection-element.d.ts.map +1 -0
  41. package/dist/support/business-names/collection-element.js +12 -0
  42. package/dist/support/business-names/collection-element.js.map +1 -0
  43. package/dist/support/business-names/conventional-model-name.d.ts +9 -0
  44. package/dist/support/business-names/conventional-model-name.d.ts.map +1 -0
  45. package/dist/support/business-names/conventional-model-name.js +22 -0
  46. package/dist/support/business-names/conventional-model-name.js.map +1 -0
  47. package/dist/support/business-names/generic-words.d.ts +6 -0
  48. package/dist/support/business-names/generic-words.d.ts.map +1 -0
  49. package/dist/support/business-names/generic-words.js +25 -0
  50. package/dist/support/business-names/generic-words.js.map +1 -0
  51. package/dist/support/business-names/is-name-free.d.ts +10 -0
  52. package/dist/support/business-names/is-name-free.d.ts.map +1 -0
  53. package/dist/support/business-names/is-name-free.js +26 -0
  54. package/dist/support/business-names/is-name-free.js.map +1 -0
  55. package/dist/support/business-names/judges-names.d.ts +7 -0
  56. package/dist/support/business-names/judges-names.d.ts.map +1 -0
  57. package/dist/support/business-names/judges-names.js +14 -0
  58. package/dist/support/business-names/judges-names.js.map +1 -0
  59. package/dist/support/business-names/pattern-identifiers.d.ts +4 -0
  60. package/dist/support/business-names/pattern-identifiers.d.ts.map +1 -0
  61. package/dist/support/business-names/pattern-identifiers.js +21 -0
  62. package/dist/support/business-names/pattern-identifiers.js.map +1 -0
  63. package/dist/support/business-names/plural.d.ts +3 -0
  64. package/dist/support/business-names/plural.d.ts.map +1 -0
  65. package/dist/support/business-names/plural.js +8 -0
  66. package/dist/support/business-names/plural.js.map +1 -0
  67. package/dist/support/business-names/proposed-name.d.ts +6 -0
  68. package/dist/support/business-names/proposed-name.d.ts.map +1 -0
  69. package/dist/support/business-names/proposed-name.js +2 -0
  70. package/dist/support/business-names/proposed-name.js.map +1 -0
  71. package/dist/support/business-names/rename-fix.d.ts +8 -0
  72. package/dist/support/business-names/rename-fix.d.ts.map +1 -0
  73. package/dist/support/business-names/rename-fix.js +26 -0
  74. package/dist/support/business-names/rename-fix.js.map +1 -0
  75. package/dist/support/business-names/repository-concept.d.ts +4 -0
  76. package/dist/support/business-names/repository-concept.d.ts.map +1 -0
  77. package/dist/support/business-names/repository-concept.js +10 -0
  78. package/dist/support/business-names/repository-concept.js.map +1 -0
  79. package/dist/support/business-names/singular.d.ts +3 -0
  80. package/dist/support/business-names/singular.d.ts.map +1 -0
  81. package/dist/support/business-names/singular.js +11 -0
  82. package/dist/support/business-names/singular.js.map +1 -0
  83. package/dist/support/business-names/typed-names.d.ts +13 -0
  84. package/dist/support/business-names/typed-names.d.ts.map +1 -0
  85. package/dist/support/business-names/typed-names.js +53 -0
  86. package/dist/support/business-names/typed-names.js.map +1 -0
  87. package/dist/support/business-names/words-of.d.ts +9 -0
  88. package/dist/support/business-names/words-of.d.ts.map +1 -0
  89. package/dist/support/business-names/words-of.js +8 -0
  90. package/dist/support/business-names/words-of.js.map +1 -0
  91. package/dist/support/declarations/written-names.d.ts +1 -1
  92. package/dist/support/declarations/written-names.d.ts.map +1 -1
  93. package/dist/support/declarations/written-names.js +1 -2
  94. package/dist/support/declarations/written-names.js.map +1 -1
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/docs/rules/authz-declared.fr.md +2 -2
  98. package/docs/rules/authz-declared.md +1 -1
  99. package/docs/rules/context-extractable.fr.md +9 -5
  100. package/docs/rules/context-extractable.md +8 -4
  101. package/docs/rules/declarations-role-declared.fr.md +3 -11
  102. package/docs/rules/declarations-role-declared.md +2 -10
  103. package/docs/rules/domain-events-dispatched-on-save.fr.md +3 -3
  104. package/docs/rules/domain-events-dispatched-on-save.md +2 -2
  105. package/docs/rules/domain-events-transactional-before-commit.fr.md +24 -10
  106. package/docs/rules/domain-events-transactional-before-commit.md +23 -9
  107. package/docs/rules/events-consumer-idempotent.fr.md +9 -5
  108. package/docs/rules/events-consumer-idempotent.md +8 -4
  109. package/docs/rules/events-name-format.fr.md +2 -2
  110. package/docs/rules/events-name-format.md +1 -1
  111. package/docs/rules/layer-application-inward.fr.md +9 -3
  112. package/docs/rules/layer-application-inward.md +8 -2
  113. package/docs/rules/naming-business-name.fr.md +82 -0
  114. package/docs/rules/naming-business-name.md +81 -0
  115. package/docs/rules/ports-implements-never-extends.fr.md +9 -5
  116. package/docs/rules/ports-implements-never-extends.md +8 -4
  117. package/docs/rules/ports-no-concrete-dependency.fr.md +15 -5
  118. package/docs/rules/ports-no-concrete-dependency.md +14 -4
  119. package/docs/rules/ports-value-import.fr.md +5 -5
  120. package/docs/rules/ports-value-import.md +4 -4
  121. package/docs/rules/scheduling-job-name.fr.md +7 -3
  122. package/docs/rules/scheduling-job-name.md +6 -2
  123. package/docs/rules/scheduling-job-triggers-use-case.fr.md +8 -3
  124. package/docs/rules/scheduling-job-triggers-use-case.md +7 -2
  125. package/package.json +13 -9
@@ -0,0 +1,53 @@
1
+ import path from 'node:path';
2
+ import { ESLintUtils } from '@typescript-eslint/utils';
3
+ import { locate } from '../../project/locate.js';
4
+ import { toPosix } from '../../project/to-posix.js';
5
+ import { camel } from './camel.js';
6
+ const MODEL_DIRECTORIES = ['aggregates', 'entities', 'value-objects'];
7
+ /** Undefined when the parser was given no program: the rule then reads the names of the code. */
8
+ export function typedNames(context, file) {
9
+ const services = ESLintUtils.getParserServices(context, true);
10
+ if (services.program === null) {
11
+ return undefined;
12
+ }
13
+ const checker = services.program.getTypeChecker();
14
+ /** The file that declares the type of `node`, the element type for a list, and the name of that type. */
15
+ const declared = (node) => {
16
+ const found = services.getTypeAtLocation(node);
17
+ const type = (checker.getAwaitedType(found) ?? found).getNonNullableType();
18
+ const many = checker.isArrayType(type);
19
+ const symbol = symbolOf(many ? type.getNumberIndexType() : type);
20
+ const source = symbol?.declarations?.[0]?.getSourceFile().fileName;
21
+ return symbol === undefined || source === undefined ? undefined : { file: source, name: symbol.getName(), many };
22
+ };
23
+ return {
24
+ modelOf(node) {
25
+ const type = declared(node);
26
+ const place = type === undefined ? undefined : placeOf(file, type.file);
27
+ if (type === undefined || place === undefined || !isModelPlace(place)) {
28
+ return undefined;
29
+ }
30
+ return { element: camel(type.name), many: type.many };
31
+ },
32
+ isRepository(node) {
33
+ const type = declared(node);
34
+ const place = type === undefined ? undefined : placeOf(file, type.file);
35
+ return place?.area === 'context' && place.layer === 'domain' && place.inside[0] === 'repositories';
36
+ },
37
+ };
38
+ }
39
+ function placeOf(file, absolute) {
40
+ const relative = toPosix(path.relative(file.root, absolute));
41
+ return relative.startsWith('../') || relative.includes('node_modules/') ? undefined : locate(file.config, relative);
42
+ }
43
+ function isModelPlace(place) {
44
+ if (place.area === 'shared-kernel') {
45
+ return true;
46
+ }
47
+ return place.area === 'context' && place.layer === 'domain' && MODEL_DIRECTORIES.includes(place.inside[0] ?? '');
48
+ }
49
+ /** The symbol a type is declared by: its class or interface, or the alias it was written with. */
50
+ function symbolOf(type) {
51
+ return type?.getSymbol() ?? type?.aliasSymbol;
52
+ }
53
+ //# sourceMappingURL=typed-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-names.js","sourceRoot":"","sources":["../../../src/support/business-names/typed-names.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ import type { Config } from '../../project/config.js';
2
+ /** The `words` and `allow` options of the rule, which come over `businessNames` of the config. */
3
+ export interface BusinessNameOptions {
4
+ readonly words?: readonly string[];
5
+ readonly allow?: readonly string[];
6
+ }
7
+ /** The words the rule reports: the list of the options, else of the config, else the defaults; less what either allows. */
8
+ export declare function wordsOf(config: Config, options: BusinessNameOptions): ReadonlySet<string>;
9
+ //# sourceMappingURL=words-of.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words-of.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/words-of.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,kGAAkG;AAClG,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,2HAA2H;AAC3H,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAAC,MAAM,CAAC,CAKzF"}
@@ -0,0 +1,8 @@
1
+ import { GENERIC_WORDS } from './generic-words.js';
2
+ /** The words the rule reports: the list of the options, else of the config, else the defaults; less what either allows. */
3
+ export function wordsOf(config, options) {
4
+ const listed = options.words ?? config.businessNames.words ?? GENERIC_WORDS;
5
+ const allowed = [...config.businessNames.allow, ...(options.allow ?? [])];
6
+ return new Set(listed.filter((word) => !allowed.includes(word)));
7
+ }
8
+ //# sourceMappingURL=words-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"words-of.js","sourceRoot":"","sources":["../../../src/support/business-names/words-of.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQnD,2HAA2H;AAC3H,MAAM,UAAU,OAAO,CAAC,MAAc,EAAE,OAA4B;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,IAAI,aAAa,CAAC;IAC5E,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;IAE1E,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC"}
@@ -1,3 +1,3 @@
1
- /** The options keys that hold a name written once and never derived: the idempotency scope, the policy name, the event name. */
1
+ /** The options keys that hold a name written once and never derived: the idempotency scope, the policy name. */
2
2
  export declare const WRITTEN_NAMES: Readonly<Record<string, string>>;
3
3
  //# sourceMappingURL=written-names.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"written-names.d.ts","sourceRoot":"","sources":["../../../src/support/declarations/written-names.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAChI,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAI1D,CAAC"}
1
+ {"version":3,"file":"written-names.d.ts","sourceRoot":"","sources":["../../../src/support/declarations/written-names.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG1D,CAAC"}
@@ -1,7 +1,6 @@
1
- /** The options keys that hold a name written once and never derived: the idempotency scope, the policy name, the event name. */
1
+ /** The options keys that hold a name written once and never derived: the idempotency scope, the policy name. */
2
2
  export const WRITTEN_NAMES = {
3
3
  IntegrationEventHandler: 'consumer',
4
- DomainEventHandler: 'name',
5
4
  Policy: 'name',
6
5
  };
7
6
  //# sourceMappingURL=written-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"written-names.js","sourceRoot":"","sources":["../../../src/support/declarations/written-names.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAChI,MAAM,CAAC,MAAM,aAAa,GAAqC;IAC7D,uBAAuB,EAAE,UAAU;IACnC,kBAAkB,EAAE,MAAM;IAC1B,MAAM,EAAE,MAAM;CACf,CAAC"}
1
+ {"version":3,"file":"written-names.js","sourceRoot":"","sources":["../../../src/support/declarations/written-names.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,MAAM,CAAC,MAAM,aAAa,GAAqC;IAC7D,uBAAuB,EAAE,UAAU;IACnC,MAAM,EAAE,MAAM;CACf,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.16.1";
1
+ export declare const VERSION = "0.18.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.16.1';
1
+ export const VERSION = '0.18.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1,5 +1,5 @@
1
1
  [English](authz-declared.md) · **Français**
2
- <!-- translation-of: authz-declared.md sha256:45bde1afe67f1b4c -->
2
+ <!-- translation-of: authz-declared.md sha256:38d77053454decf3 -->
3
3
 
4
4
  # ddd-ts-kit/authz-declared
5
5
 
@@ -79,7 +79,7 @@ Aucune.
79
79
  - Un message enregistré atteint par un *barrel*, un export qui renomme, un import par défaut ou un espace de noms n'est pas suivi jusqu'à sa classe : son décorateur n'est pas vu et l'enregistrement est signalé.
80
80
  - Dans un projet de style déclaré qui garde un `<context>.module.ts`, un message qui y est enregistré avec `.requires(...)` et écrit sans décorateur est quand même signalé dans son propre fichier : mettez le décorateur sur la classe.
81
81
  - Un fichier `*.command.ts` ou `*.query.ts` qui n'exporte aucune classe n'est pas signalé ici.
82
- - Un enregistrement réparti sur plusieurs instructions (`const target = builder.command(X); target.handledBy(H);`) n'est pas suivi.
82
+ - Un enregistrement réparti sur plusieurs instructions (`const registration = builder.command(X); registration.handledBy(H);`) n'est pas suivi.
83
83
  - Un câblage écrit à la main avec `AuthorizationMap.of(requires(...), publicUseCase(...))` n'est pas lu : `authorizationMiddleware` refuse un cas d'usage non déclaré à l'exécution, et `createApplication({ authorization: 'required' })` au démarrage.
84
84
  - Un message qui étend simplement `Command` ou `Query` alors que son enregistrement appelle `.requires(...)` s'étend sur deux fichiers et n'est pas vu ici ; le compilateur le refuse, puisque `requires` n'existe que pour un message qui porte un acteur.
85
85
  - Une spécification de route qui n'est pas un littéral d'objet, ou qui étale un autre objet, n'est pas jugée.
@@ -78,7 +78,7 @@ None.
78
78
  - A registered message reached through a barrel, a renaming export, a default import or a namespace is not followed to its class: its decorator is not seen and the registration is reported.
79
79
  - In a declared-style project that keeps a `<context>.module.ts`, a message registered there with `.requires(...)` and written without a decorator is still reported in its own file: put the decorator on the class.
80
80
  - A `*.command.ts` or `*.query.ts` file that exports no class is not reported here.
81
- - A registration split over statements (`const target = builder.command(X); target.handledBy(H);`) is not followed.
81
+ - A registration split over statements (`const registration = builder.command(X); registration.handledBy(H);`) is not followed.
82
82
  - A wiring written by hand with `AuthorizationMap.of(requires(...), publicUseCase(...))` is not read: `authorizationMiddleware` refuses an undeclared use case at run time, and `createApplication({ authorization: 'required' })` at start.
83
83
  - A message extending plain `Command` or `Query` while its registration calls `.requires(...)` spans two files and is not seen here; the compiler refuses it, since `requires` only exists for a message that carries an actor.
84
84
  - A route spec that is not an object literal, or that spreads another object, is not judged.
@@ -1,5 +1,5 @@
1
1
  [English](context-extractable.md) · **Français**
2
- <!-- translation-of: context-extractable.md sha256:1fef5c4577e579cd -->
2
+ <!-- translation-of: context-extractable.md sha256:9c8ef03d79be6af4 -->
3
3
 
4
4
  # ddd-ts-kit/context-extractable
5
5
 
@@ -50,8 +50,10 @@ builder.query(GetPrice).public().handledBy(GetPriceHandler, [ProductReader]);
50
50
  // style déclaré : billing/application/queries/get-price/get-price.handler.ts
51
51
  import { ProductReader } from '@/contexts/catalog/application/ports/product-reader.port';
52
52
 
53
- @QueryHandler(GetPriceQuery, [ProductReader])
54
- export class GetPriceHandler {}
53
+ @QueryHandler(GetPriceQuery)
54
+ export class GetPriceHandler {
55
+ constructor(private readonly productReader: ProductReader) {}
56
+ }
55
57
  ```
56
58
 
57
59
  Correct :
@@ -67,8 +69,10 @@ builder.query(GetPrice).public().handledBy(GetPriceHandler, [PriceSource]);
67
69
  // style déclaré : le port appartient à billing, sa gateway appelle catalog
68
70
  import { PriceCatalog } from '@/contexts/billing/application/ports/price-catalog.port';
69
71
 
70
- @QueryHandler(GetPriceQuery, [PriceCatalog])
71
- export class GetPriceHandler {}
72
+ @QueryHandler(GetPriceQuery)
73
+ export class GetPriceHandler {
74
+ constructor(private readonly priceCatalog: PriceCatalog) {}
75
+ }
72
76
  ```
73
77
 
74
78
  ## Détails
@@ -49,8 +49,10 @@ builder.query(GetPrice).public().handledBy(GetPriceHandler, [ProductReader]);
49
49
  // declared style: billing/application/queries/get-price/get-price.handler.ts
50
50
  import { ProductReader } from '@/contexts/catalog/application/ports/product-reader.port';
51
51
 
52
- @QueryHandler(GetPriceQuery, [ProductReader])
53
- export class GetPriceHandler {}
52
+ @QueryHandler(GetPriceQuery)
53
+ export class GetPriceHandler {
54
+ constructor(private readonly productReader: ProductReader) {}
55
+ }
54
56
  ```
55
57
 
56
58
  Correct:
@@ -66,8 +68,10 @@ builder.query(GetPrice).public().handledBy(GetPriceHandler, [PriceSource]);
66
68
  // declared style: the port is one of billing, its gateway calls catalog
67
69
  import { PriceCatalog } from '@/contexts/billing/application/ports/price-catalog.port';
68
70
 
69
- @QueryHandler(GetPriceQuery, [PriceCatalog])
70
- export class GetPriceHandler {}
71
+ @QueryHandler(GetPriceQuery)
72
+ export class GetPriceHandler {
73
+ constructor(private readonly priceCatalog: PriceCatalog) {}
74
+ }
71
75
  ```
72
76
 
73
77
  ## Details
@@ -1,5 +1,5 @@
1
1
  [English](declarations-role-declared.md) · **Français**
2
- <!-- translation-of: declarations-role-declared.md sha256:d6c86f0b480155cb -->
2
+ <!-- translation-of: declarations-role-declared.md sha256:a325a3f29d8ff0b1 -->
3
3
 
4
4
  # ddd-ts-kit/declarations-role-declared
5
5
 
@@ -20,8 +20,7 @@ Dans un fichier de rôle (le tableau ci-dessous), hors `*.command.ts` et `*.quer
20
20
 
21
21
  Sur toute classe de `application/`, `infrastructure/`, `presentation/` ou de la racine du contexte :
22
22
 
23
- - `@IntegrationEventHandler(definition, { consumer })`, `@Policy(permission, { name })` ou `@DomainEventHandler(Event, { name })` dont le nom n'est pas un littéral de chaîne non vide : absent, vide, une variable, un gabarit avec une substitution, des options contenues dans une variable ou seulement étalées. Un gestionnaire d'événement du domaine peut à la place lire le nom que déclare sa classe d'événement, `@DomainEventHandler(InvoiceIssued, { name: InvoiceIssued.eventName })`, la classe étant celle qu'il reçoit
24
- - `@DomainEventHandler(Event, { name })` dont le `name`, écrit en toutes lettres, diffère du nom que déclare la classe d'événement, quand cette classe est en vue
23
+ - `@IntegrationEventHandler(definition, { consumer })` ou `@Policy(permission, { name })` dont le nom n'est pas un littéral de chaîne non vide : absent, vide, une variable, un gabarit avec une substitution, des options contenues dans une variable ou seulement étalées. `@DomainEventHandler(Event)` n'écrit aucun nom : il est rattaché à celui que sa classe d'événement déclare une fois, `static readonly eventName`, que le compilateur exige
25
24
 
26
25
  Sous `domain/` :
27
26
 
@@ -55,10 +54,6 @@ export class SearchInvoicesHandler {}
55
54
  @Policy(billingPermissions['invoice.void'], { name: policyName })
56
55
  export class OnlyIssuerVoidsPolicy {}
57
56
 
58
- // application/event-handlers/invoice-issued.event-handler.ts, où InvoiceIssued s'appelle 'billing.invoice.issued'
59
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.sent' })
60
- export class InvoiceIssuedEventHandler {}
61
-
62
57
  // domain/aggregates/invoice.aggregate.ts
63
58
  @Repository(InvoiceRepository)
64
59
  export class Invoice {}
@@ -85,7 +80,7 @@ export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand>
85
80
  export class OnlyIssuerVoidsPolicy {}
86
81
 
87
82
  // application/event-handlers/invoice-issued.event-handler.ts
88
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' })
83
+ @DomainEventHandler(InvoiceIssued)
89
84
  export class InvoiceIssuedEventHandler {}
90
85
  ```
91
86
 
@@ -95,8 +90,6 @@ Un décorateur compte quand son nom est l'un des douze décorateurs de déclarat
95
90
 
96
91
  Le rôle d'un fichier se lit à son suffixe et à son dossier, tels que le générateur les écrit. Une classe est exportée en ligne, par `export { A }` ou par `export default A`. Quand une classe porte un autre décorateur de déclaration, seul celui-ci est signalé : le corriger répond aussi au décorateur manquant.
97
92
 
98
- La classe d'événement de `@DomainEventHandler` est en vue quand elle est déclarée dans le même fichier, ou importée par son nom depuis une source du projet qui existe sur le disque ; ce fichier est alors analysé, syntaxe seulement, et son `static readonly eventName = '...'` (ou, comme l'écrivait la 0.5, son `readonly name = '...'`) est lu (`as const` et `satisfies` sont traversés). Quand la classe est introuvable, ou que son nom n'est pas un littéral, rien n'est comparé.
99
-
100
93
  ## Options
101
94
 
102
95
  Aucune.
@@ -105,7 +98,6 @@ Aucune.
105
98
 
106
99
  ## Limites
107
100
 
108
- - Une classe d'événement atteinte par un *barrel* (`@/contexts/billing/domain/events/index`), un export qui renomme, un import par défaut ou un espace de noms n'est pas suivie : son nom n'est pas comparé. `ddd-ts-kit check` résout le même import dans le projet.
109
101
  - Un décorateur appliqué par une variable (`const declare = Repository(InvoiceRepository); @declare class ...`) n'est pas reconnu.
110
102
  - Ce qu'une classe reçoit relève de `declarations/constructor-injection` ; qu'une liste corresponde au constructeur et qu'un gestionnaire traite son message est vérifié par le compilateur, pas ici ; qu'un adaptateur implémente son port relève de `ports/implements-never-extends`, et l'endroit où vit un *job* et son nom relèvent de `scheduling/job-triggers-use-case` et de `scheduling/job-name`.
111
103
  - Que chaque fichier de rôle contienne une seule classe déclarée relève de `naming/one-concept-per-file` de `ddd-ts-kit check`.
@@ -19,8 +19,7 @@ In a role file (the table below), other than `*.command.ts` and `*.query.ts`, wh
19
19
 
20
20
  On any class of `application/`, `infrastructure/`, `presentation/` or the context root:
21
21
 
22
- - `@IntegrationEventHandler(definition, { consumer })`, `@Policy(permission, { name })` or `@DomainEventHandler(Event, { name })` whose name is not a non-empty string literal: missing, empty, a variable, a template with a substitution, options held in a variable or only spread. A domain event handler may instead read the name its event class declares, `@DomainEventHandler(InvoiceIssued, { name: InvoiceIssued.eventName })`, the class being the one it is given
23
- - `@DomainEventHandler(Event, { name })` whose `name`, written out, differs from the name the event class declares, when that class is in view
22
+ - `@IntegrationEventHandler(definition, { consumer })` or `@Policy(permission, { name })` whose name is not a non-empty string literal: missing, empty, a variable, a template with a substitution, options held in a variable or only spread. `@DomainEventHandler(Event)` writes no name: it is attached under the one its event class declares once, `static readonly eventName`, which the compiler requires
24
23
 
25
24
  Under `domain/`:
26
25
 
@@ -54,10 +53,6 @@ export class SearchInvoicesHandler {}
54
53
  @Policy(billingPermissions['invoice.void'], { name: policyName })
55
54
  export class OnlyIssuerVoidsPolicy {}
56
55
 
57
- // application/event-handlers/invoice-issued.event-handler.ts, where InvoiceIssued is named 'billing.invoice.issued'
58
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.sent' })
59
- export class InvoiceIssuedEventHandler {}
60
-
61
56
  // domain/aggregates/invoice.aggregate.ts
62
57
  @Repository(InvoiceRepository)
63
58
  export class Invoice {}
@@ -84,7 +79,7 @@ export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand>
84
79
  export class OnlyIssuerVoidsPolicy {}
85
80
 
86
81
  // application/event-handlers/invoice-issued.event-handler.ts
87
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' })
82
+ @DomainEventHandler(InvoiceIssued)
88
83
  export class InvoiceIssuedEventHandler {}
89
84
  ```
90
85
 
@@ -94,8 +89,6 @@ A decorator counts when its name is one of the twelve declaration decorators and
94
89
 
95
90
  The role of a file is read from its suffix and its folder, as the generator writes them. A class is exported inline, by `export { A }` or by `export default A`. When a class carries another declaration decorator, only that is reported: fixing it also answers the missing one.
96
91
 
97
- The event class of `@DomainEventHandler` is in view when it is declared in the same file, or imported by name from a source of the project that exists on disk; that file is then parsed, syntax only, and its `static readonly eventName = '...'` (or, as 0.5 wrote it, its `readonly name = '...'`) is read (`as const` and `satisfies` are looked through). When the class cannot be found, or its name is not a literal, nothing is compared.
98
-
99
92
  ## Options
100
93
 
101
94
  None.
@@ -104,7 +97,6 @@ None.
104
97
 
105
98
  ## Limits
106
99
 
107
- - An event class reached through a barrel (`@/contexts/billing/domain/events/index`), a renaming export, a default import or a namespace is not followed: its name is not compared. `ddd-ts-kit check` resolves the same import in the project.
108
100
  - A decorator applied through a variable (`const declare = Repository(InvoiceRepository); @declare class ...`) is not recognised.
109
101
  - What a class is given is `declarations/constructor-injection`; that a list matches the constructor and that a handler handles its message is checked by the compiler, not here; that an adapter implements its port is `ports/implements-never-extends`, and where a job lives and what it is named are `scheduling/job-triggers-use-case` and `scheduling/job-name`.
110
102
  - That each role file holds a single declared class is `naming/one-concept-per-file` of `ddd-ts-kit check`.
@@ -1,5 +1,5 @@
1
1
  [English](domain-events-dispatched-on-save.md) · **Français**
2
- <!-- translation-of: domain-events-dispatched-on-save.md sha256:d2a6b9135e82644d -->
2
+ <!-- translation-of: domain-events-dispatched-on-save.md sha256:815a6be7014d66ca -->
3
3
 
4
4
  # ddd-ts-kit/domain-events-dispatched-on-save
5
5
 
@@ -22,7 +22,7 @@ Incorrect :
22
22
  // src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
23
23
  import { Clock, DomainEventDispatcher } from '@ddd-ts-kit/kernel';
24
24
 
25
- @CommandHandler(IssueInvoice, [InvoiceRepository, Clock, DomainEventDispatcher])
25
+ @CommandHandler(IssueInvoice)
26
26
  export class IssueInvoiceHandler {
27
27
  constructor(
28
28
  private readonly invoices: InvoiceRepository,
@@ -47,7 +47,7 @@ Correct :
47
47
  // src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
48
48
  import { Clock } from '@ddd-ts-kit/kernel';
49
49
 
50
- @CommandHandler(IssueInvoice, [InvoiceRepository, Clock])
50
+ @CommandHandler(IssueInvoice)
51
51
  export class IssueInvoiceHandler {
52
52
  constructor(
53
53
  private readonly invoices: InvoiceRepository,
@@ -21,7 +21,7 @@ Incorrect:
21
21
  // src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
22
22
  import { Clock, DomainEventDispatcher } from '@ddd-ts-kit/kernel';
23
23
 
24
- @CommandHandler(IssueInvoice, [InvoiceRepository, Clock, DomainEventDispatcher])
24
+ @CommandHandler(IssueInvoice)
25
25
  export class IssueInvoiceHandler {
26
26
  constructor(
27
27
  private readonly invoices: InvoiceRepository,
@@ -46,7 +46,7 @@ Correct:
46
46
  // src/contexts/billing/application/commands/issue-invoice/issue-invoice.handler.ts
47
47
  import { Clock } from '@ddd-ts-kit/kernel';
48
48
 
49
- @CommandHandler(IssueInvoice, [InvoiceRepository, Clock])
49
+ @CommandHandler(IssueInvoice)
50
50
  export class IssueInvoiceHandler {
51
51
  constructor(
52
52
  private readonly invoices: InvoiceRepository,
@@ -1,5 +1,5 @@
1
1
  [English](domain-events-transactional-before-commit.md) · **Français**
2
- <!-- translation-of: domain-events-transactional-before-commit.md sha256:4d31ba97cc3e8f7c -->
2
+ <!-- translation-of: domain-events-transactional-before-commit.md sha256:9a978f4c0a72e179 -->
3
3
 
4
4
  # ddd-ts-kit/domain-events-transactional-before-commit
5
5
 
@@ -35,7 +35,7 @@ import { Cache } from '@ddd-ts-kit/kernel';
35
35
  import { DomainEventHandler } from '@ddd-ts-kit/kernel/declarations';
36
36
  import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
37
37
 
38
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [InvoiceRepository, Cache])
38
+ @DomainEventHandler(InvoiceIssued)
39
39
  export class InvoiceIssuedEventHandler {
40
40
  constructor(
41
41
  private readonly invoices: InvoiceRepository,
@@ -45,28 +45,42 @@ export class InvoiceIssuedEventHandler {
45
45
  ```
46
46
 
47
47
  ```ts
48
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued', phase: 'after-commit' }, [IntegrationEventPublisher])
49
- export class InvoiceIssuedEventHandler {}
48
+ @DomainEventHandler(InvoiceIssued, { phase: 'after-commit' })
49
+ export class InvoiceIssuedEventHandler {
50
+ constructor(private readonly integrationEventPublisher: IntegrationEventPublisher) {}
51
+ }
50
52
  ```
51
53
 
52
54
  Correct :
53
55
 
54
56
  ```ts
55
57
  // l'état que change le gestionnaire est validé ou annulé avec la commande
56
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [InvoiceRepository, CommandBus])
57
- export class InvoiceIssuedEventHandler {}
58
+ @DomainEventHandler(InvoiceIssued)
59
+ export class InvoiceIssuedEventHandler {
60
+ constructor(
61
+ private readonly invoiceRepository: InvoiceRepository,
62
+ private readonly commandBus: CommandBus,
63
+ ) {}
64
+ }
58
65
  ```
59
66
 
60
67
  ```ts
61
68
  // un effet qu'aucune transaction ne couvre s'exécute une fois la transaction validée, au plus une fois
62
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued', phase: 'after-commit' }, [Cache])
63
- export class InvoiceIssuedEventHandler {}
69
+ @DomainEventHandler(InvoiceIssued, { phase: 'after-commit' })
70
+ export class InvoiceIssuedEventHandler {
71
+ constructor(private readonly cache: Cache) {}
72
+ }
64
73
  ```
65
74
 
66
75
  ```ts
67
76
  // un effet qui ne doit pas être perdu passe par l'outbox : le gestionnaire de l'événement d'intégration fait le travail
68
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [IntegrationEventPublisher, IdGenerator])
69
- export class InvoiceIssuedPublisher {}
77
+ @DomainEventHandler(InvoiceIssued)
78
+ export class InvoiceIssuedPublisher {
79
+ constructor(
80
+ private readonly integrationEventPublisher: IntegrationEventPublisher,
81
+ private readonly idGenerator: IdGenerator,
82
+ ) {}
83
+ }
70
84
  ```
71
85
 
72
86
  ## Détails
@@ -34,7 +34,7 @@ import { Cache } from '@ddd-ts-kit/kernel';
34
34
  import { DomainEventHandler } from '@ddd-ts-kit/kernel/declarations';
35
35
  import { InvoiceRepository } from '@/contexts/billing/domain/repositories/invoice.repository';
36
36
 
37
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [InvoiceRepository, Cache])
37
+ @DomainEventHandler(InvoiceIssued)
38
38
  export class InvoiceIssuedEventHandler {
39
39
  constructor(
40
40
  private readonly invoices: InvoiceRepository,
@@ -44,28 +44,42 @@ export class InvoiceIssuedEventHandler {
44
44
  ```
45
45
 
46
46
  ```ts
47
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued', phase: 'after-commit' }, [IntegrationEventPublisher])
48
- export class InvoiceIssuedEventHandler {}
47
+ @DomainEventHandler(InvoiceIssued, { phase: 'after-commit' })
48
+ export class InvoiceIssuedEventHandler {
49
+ constructor(private readonly integrationEventPublisher: IntegrationEventPublisher) {}
50
+ }
49
51
  ```
50
52
 
51
53
  Correct:
52
54
 
53
55
  ```ts
54
56
  // the state the handler changes commits or rolls back with the command
55
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [InvoiceRepository, CommandBus])
56
- export class InvoiceIssuedEventHandler {}
57
+ @DomainEventHandler(InvoiceIssued)
58
+ export class InvoiceIssuedEventHandler {
59
+ constructor(
60
+ private readonly invoiceRepository: InvoiceRepository,
61
+ private readonly commandBus: CommandBus,
62
+ ) {}
63
+ }
57
64
  ```
58
65
 
59
66
  ```ts
60
67
  // an effect no transaction covers runs once the transaction has committed, at most once
61
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued', phase: 'after-commit' }, [Cache])
62
- export class InvoiceIssuedEventHandler {}
68
+ @DomainEventHandler(InvoiceIssued, { phase: 'after-commit' })
69
+ export class InvoiceIssuedEventHandler {
70
+ constructor(private readonly cache: Cache) {}
71
+ }
63
72
  ```
64
73
 
65
74
  ```ts
66
75
  // an effect that must not be lost goes through the outbox: the handler of the integration event does the work
67
- @DomainEventHandler(InvoiceIssued, { name: 'billing.invoice.issued' }, [IntegrationEventPublisher, IdGenerator])
68
- export class InvoiceIssuedPublisher {}
76
+ @DomainEventHandler(InvoiceIssued)
77
+ export class InvoiceIssuedPublisher {
78
+ constructor(
79
+ private readonly integrationEventPublisher: IntegrationEventPublisher,
80
+ private readonly idGenerator: IdGenerator,
81
+ ) {}
82
+ }
69
83
  ```
70
84
 
71
85
  ## Details
@@ -1,5 +1,5 @@
1
1
  [English](events-consumer-idempotent.md) · **Français**
2
- <!-- translation-of: events-consumer-idempotent.md sha256:1b3f1042f11ef75d -->
2
+ <!-- translation-of: events-consumer-idempotent.md sha256:03b7477d9bda7e88 -->
3
3
 
4
4
  # ddd-ts-kit/events-consumer-idempotent
5
5
 
@@ -28,8 +28,10 @@ subscribeAll(platform.subscriber, [on(productListedV1, (event) => consumer.handl
28
28
  resolve(IntegrationEventSubscriber).subscribe('catalog.product.listed', (event) => consumer.handle(event));
29
29
 
30
30
  // style déclaré
31
- @IntegrationEventHandler(productListedV1, { consumer: consumerName }, [CommandBus])
32
- export class CatalogProductListedHandler {}
31
+ @IntegrationEventHandler(productListedV1, { consumer: consumerName })
32
+ export class CatalogProductListedHandler {
33
+ constructor(private readonly commandBus: CommandBus) {}
34
+ }
33
35
  ```
34
36
 
35
37
  Correct :
@@ -42,8 +44,10 @@ subscribeAll(platform.subscriber, [
42
44
  ]);
43
45
 
44
46
  // style déclaré
45
- @IntegrationEventHandler(productListedV1, { consumer: 'billing.catalog-product-listed' }, [CommandBus])
46
- export class CatalogProductListedHandler {}
47
+ @IntegrationEventHandler(productListedV1, { consumer: 'billing.catalog-product-listed' })
48
+ export class CatalogProductListedHandler {
49
+ constructor(private readonly commandBus: CommandBus) {}
50
+ }
47
51
  ```
48
52
 
49
53
  ## Détails
@@ -27,8 +27,10 @@ subscribeAll(platform.subscriber, [on(productListedV1, (event) => consumer.handl
27
27
  resolve(IntegrationEventSubscriber).subscribe('catalog.product.listed', (event) => consumer.handle(event));
28
28
 
29
29
  // declared style
30
- @IntegrationEventHandler(productListedV1, { consumer: consumerName }, [CommandBus])
31
- export class CatalogProductListedHandler {}
30
+ @IntegrationEventHandler(productListedV1, { consumer: consumerName })
31
+ export class CatalogProductListedHandler {
32
+ constructor(private readonly commandBus: CommandBus) {}
33
+ }
32
34
  ```
33
35
 
34
36
  Correct:
@@ -41,8 +43,10 @@ subscribeAll(platform.subscriber, [
41
43
  ]);
42
44
 
43
45
  // declared style
44
- @IntegrationEventHandler(productListedV1, { consumer: 'billing.catalog-product-listed' }, [CommandBus])
45
- export class CatalogProductListedHandler {}
46
+ @IntegrationEventHandler(productListedV1, { consumer: 'billing.catalog-product-listed' })
47
+ export class CatalogProductListedHandler {
48
+ constructor(private readonly commandBus: CommandBus) {}
49
+ }
46
50
  ```
47
51
 
48
52
  ## Details
@@ -1,5 +1,5 @@
1
1
  [English](events-name-format.md) · **Français**
2
- <!-- translation-of: events-name-format.md sha256:3696b2ab4eae3dd8 -->
2
+ <!-- translation-of: events-name-format.md sha256:282199502c3aaecf -->
3
3
 
4
4
  # ddd-ts-kit/events-name-format
5
5
 
@@ -38,7 +38,7 @@ export class InvoiceIssued implements DomainEvent {
38
38
 
39
39
  ## Détails
40
40
 
41
- Les littéraux de gabarit (template literals) sans interpolation sont lus comme des chaînes. Le nom est déclaré une fois, dans `eventName`, que l'événement porte dans `name` et que ses réactions lisent (`{ name: InvoiceIssued.eventName }`) ; un `readonly name = '..'` écrit en toutes lettres, comme avant la 0.6, est jugé de la même façon.
41
+ Les littéraux de gabarit (template literals) sans interpolation sont lus comme des chaînes. Le nom est déclaré une fois, dans `eventName`, que l'événement porte dans `name` et que ses réactions lisent (`@DomainEventHandler(InvoiceIssued)`) ; un `readonly name = '..'` écrit en toutes lettres, comme avant la 0.6, est jugé de la même façon.
42
42
 
43
43
  ## Options
44
44
 
@@ -37,7 +37,7 @@ export class InvoiceIssued implements DomainEvent {
37
37
 
38
38
  ## Details
39
39
 
40
- Template literals without interpolation are read like strings. The name is declared once, in `eventName`, which the event carries in `name` and its reactions read (`{ name: InvoiceIssued.eventName }`); a `readonly name = '..'` written out, as before 0.6, is judged the same way.
40
+ Template literals without interpolation are read like strings. The name is declared once, in `eventName`, which the event carries in `name` and its reactions read (`@DomainEventHandler(InvoiceIssued)`); a `readonly name = '..'` written out, as before 0.6, is judged the same way.
41
41
 
42
42
  ## Options
43
43
 
@@ -1,5 +1,5 @@
1
1
  [English](layer-application-inward.md) · **Français**
2
- <!-- translation-of: layer-application-inward.md sha256:03b6d93f13ce9469 -->
2
+ <!-- translation-of: layer-application-inward.md sha256:6e16bc8f73e2aef0 -->
3
3
 
4
4
  # ddd-ts-kit/layer-application-inward
5
5
 
@@ -40,8 +40,14 @@ import { PaymentGateway } from '@/contexts/billing/application/ports/payment-gat
40
40
  // style déclaré
41
41
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
42
42
 
43
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, PaymentGateway, Clock])
44
- export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand> {}
43
+ @CommandHandler(IssueInvoiceCommand)
44
+ export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand> {
45
+ constructor(
46
+ private readonly invoiceRepository: InvoiceRepository,
47
+ private readonly paymentGateway: PaymentGateway,
48
+ private readonly clock: Clock,
49
+ ) {}
50
+ }
45
51
  ```
46
52
 
47
53
  ## Détails
@@ -39,8 +39,14 @@ import { PaymentGateway } from '@/contexts/billing/application/ports/payment-gat
39
39
  // declared style
40
40
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
41
41
 
42
- @CommandHandler(IssueInvoiceCommand, [InvoiceRepository, PaymentGateway, Clock])
43
- export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand> {}
42
+ @CommandHandler(IssueInvoiceCommand)
43
+ export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand> {
44
+ constructor(
45
+ private readonly invoiceRepository: InvoiceRepository,
46
+ private readonly paymentGateway: PaymentGateway,
47
+ private readonly clock: Clock,
48
+ ) {}
49
+ }
44
50
  ```
45
51
 
46
52
  ## Details