@ddd-ts-kit/eslint-plugin 0.15.0 → 0.16.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.
Files changed (209) hide show
  1. package/README.fr.md +464 -0
  2. package/README.md +149 -9
  3. package/dist/project/config.d.ts +2 -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 +2 -0
  7. package/dist/project/parse-config.js.map +1 -1
  8. package/dist/rules/domain-value-object-class.d.ts +4 -0
  9. package/dist/rules/domain-value-object-class.d.ts.map +1 -0
  10. package/dist/rules/domain-value-object-class.js +85 -0
  11. package/dist/rules/domain-value-object-class.js.map +1 -0
  12. package/dist/rules/rules.d.ts.map +1 -1
  13. package/dist/rules/rules.js +2 -0
  14. package/dist/rules/rules.js.map +1 -1
  15. package/dist/support/values/answered-objects.d.ts +8 -0
  16. package/dist/support/values/answered-objects.d.ts.map +1 -0
  17. package/dist/support/values/answered-objects.js +34 -0
  18. package/dist/support/values/answered-objects.js.map +1 -0
  19. package/dist/support/values/entry-role.d.ts +11 -0
  20. package/dist/support/values/entry-role.d.ts.map +1 -0
  21. package/dist/support/values/entry-role.js +45 -0
  22. package/dist/support/values/entry-role.js.map +1 -0
  23. package/dist/support/values/exported-bindings.d.ts +21 -0
  24. package/dist/support/values/exported-bindings.d.ts.map +1 -0
  25. package/dist/support/values/exported-bindings.js +76 -0
  26. package/dist/support/values/exported-bindings.js.map +1 -0
  27. package/dist/support/values/extends-value-object.d.ts +10 -0
  28. package/dist/support/values/extends-value-object.d.ts.map +1 -0
  29. package/dist/support/values/extends-value-object.js +36 -0
  30. package/dist/support/values/extends-value-object.js.map +1 -0
  31. package/dist/support/values/is-model-path.d.ts +8 -0
  32. package/dist/support/values/is-model-path.d.ts.map +1 -0
  33. package/dist/support/values/is-model-path.js +16 -0
  34. package/dist/support/values/is-model-path.js.map +1 -0
  35. package/dist/support/values/is-value-object-path.d.ts +7 -0
  36. package/dist/support/values/is-value-object-path.d.ts.map +1 -0
  37. package/dist/support/values/is-value-object-path.js +15 -0
  38. package/dist/support/values/is-value-object-path.js.map +1 -0
  39. package/dist/support/values/javascript-globals.d.ts +3 -0
  40. package/dist/support/values/javascript-globals.d.ts.map +1 -0
  41. package/dist/support/values/javascript-globals.js +22 -0
  42. package/dist/support/values/javascript-globals.js.map +1 -0
  43. package/dist/support/values/local-binding.d.ts +5 -0
  44. package/dist/support/values/local-binding.d.ts.map +1 -0
  45. package/dist/support/values/local-binding.js +23 -0
  46. package/dist/support/values/local-binding.js.map +1 -0
  47. package/dist/support/values/returns-package-type.d.ts +9 -0
  48. package/dist/support/values/returns-package-type.d.ts.map +1 -0
  49. package/dist/support/values/returns-package-type.js +28 -0
  50. package/dist/support/values/returns-package-type.js.map +1 -0
  51. package/dist/support/values/root-name.d.ts +4 -0
  52. package/dist/support/values/root-name.d.ts.map +1 -0
  53. package/dist/support/values/root-name.js +23 -0
  54. package/dist/support/values/root-name.js.map +1 -0
  55. package/dist/support/values/stands-for-a-value.d.ts +10 -0
  56. package/dist/support/values/stands-for-a-value.d.ts.map +1 -0
  57. package/dist/support/values/stands-for-a-value.js +31 -0
  58. package/dist/support/values/stands-for-a-value.js.map +1 -0
  59. package/dist/support/values/unwrapped.d.ts +4 -0
  60. package/dist/support/values/unwrapped.d.ts.map +1 -0
  61. package/dist/support/values/unwrapped.js +11 -0
  62. package/dist/support/values/unwrapped.js.map +1 -0
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/docs/rules/application-command-query-separation.fr.md +57 -0
  66. package/docs/rules/application-command-query-separation.md +2 -0
  67. package/docs/rules/application-handler-shape.fr.md +55 -0
  68. package/docs/rules/application-handler-shape.md +2 -0
  69. package/docs/rules/aspects-outside-in.fr.md +57 -0
  70. package/docs/rules/aspects-outside-in.md +2 -0
  71. package/docs/rules/authz-actor-explicit.fr.md +73 -0
  72. package/docs/rules/authz-actor-explicit.md +2 -0
  73. package/docs/rules/authz-declared.fr.md +90 -0
  74. package/docs/rules/authz-declared.md +2 -0
  75. package/docs/rules/authz-fields-by-schema.fr.md +54 -0
  76. package/docs/rules/authz-fields-by-schema.md +2 -0
  77. package/docs/rules/authz-in-application.fr.md +91 -0
  78. package/docs/rules/authz-in-application.md +2 -0
  79. package/docs/rules/clean-blank-lines.fr.md +90 -0
  80. package/docs/rules/clean-blank-lines.md +2 -0
  81. package/docs/rules/clean-braces.fr.md +64 -0
  82. package/docs/rules/clean-braces.md +2 -0
  83. package/docs/rules/clean-file-size.fr.md +46 -0
  84. package/docs/rules/clean-file-size.md +2 -0
  85. package/docs/rules/clean-formatted.fr.md +35 -0
  86. package/docs/rules/clean-formatted.md +2 -0
  87. package/docs/rules/clean-function-ceiling.fr.md +56 -0
  88. package/docs/rules/clean-function-ceiling.md +2 -0
  89. package/docs/rules/clean-function-size.fr.md +48 -0
  90. package/docs/rules/clean-function-size.md +2 -0
  91. package/docs/rules/clean-no-commented-out-code.fr.md +51 -0
  92. package/docs/rules/clean-no-commented-out-code.md +2 -0
  93. package/docs/rules/clean-no-escape-hatch.fr.md +83 -0
  94. package/docs/rules/clean-no-escape-hatch.md +2 -0
  95. package/docs/rules/clean-no-flag-argument.fr.md +53 -0
  96. package/docs/rules/clean-no-flag-argument.md +2 -0
  97. package/docs/rules/clean-no-hash-private.fr.md +66 -0
  98. package/docs/rules/clean-no-hash-private.md +2 -0
  99. package/docs/rules/clean-no-magic-number.fr.md +62 -0
  100. package/docs/rules/clean-no-magic-number.md +2 -0
  101. package/docs/rules/clean-no-noise-comment.fr.md +58 -0
  102. package/docs/rules/clean-no-noise-comment.md +2 -0
  103. package/docs/rules/clean-one-export-per-file.fr.md +91 -0
  104. package/docs/rules/clean-one-export-per-file.md +2 -0
  105. package/docs/rules/clean-stepdown.fr.md +63 -0
  106. package/docs/rules/clean-stepdown.md +2 -0
  107. package/docs/rules/context-declared-relationship.fr.md +52 -0
  108. package/docs/rules/context-declared-relationship.md +2 -0
  109. package/docs/rules/context-extractable.fr.md +112 -0
  110. package/docs/rules/context-extractable.md +2 -0
  111. package/docs/rules/context-published-language-is-a-contract.fr.md +50 -0
  112. package/docs/rules/context-published-language-is-a-contract.md +2 -0
  113. package/docs/rules/context-published-language-only.fr.md +50 -0
  114. package/docs/rules/context-published-language-only.md +2 -0
  115. package/docs/rules/declarations-constructor-injection.fr.md +92 -0
  116. package/docs/rules/declarations-constructor-injection.md +2 -0
  117. package/docs/rules/declarations-role-declared.fr.md +118 -0
  118. package/docs/rules/declarations-role-declared.md +2 -0
  119. package/docs/rules/domain-aggregate-encapsulation.fr.md +66 -0
  120. package/docs/rules/domain-aggregate-encapsulation.md +2 -0
  121. package/docs/rules/domain-events-dispatched-on-save.fr.md +86 -0
  122. package/docs/rules/domain-events-dispatched-on-save.md +2 -0
  123. package/docs/rules/domain-events-transactional-before-commit.fr.md +95 -0
  124. package/docs/rules/domain-events-transactional-before-commit.md +2 -0
  125. package/docs/rules/domain-no-generic-error.fr.md +43 -0
  126. package/docs/rules/domain-no-generic-error.md +2 -0
  127. package/docs/rules/domain-value-object-class.fr.md +177 -0
  128. package/docs/rules/domain-value-object-class.md +167 -0
  129. package/docs/rules/domain-value-object-immutability.fr.md +55 -0
  130. package/docs/rules/domain-value-object-immutability.md +2 -0
  131. package/docs/rules/errors-constructor-not-public.fr.md +56 -0
  132. package/docs/rules/errors-constructor-not-public.md +2 -0
  133. package/docs/rules/errors-factory-name.fr.md +53 -0
  134. package/docs/rules/errors-factory-name.md +2 -0
  135. package/docs/rules/errors-through-factory.fr.md +48 -0
  136. package/docs/rules/errors-through-factory.md +2 -0
  137. package/docs/rules/event-sourcing-past-tense.fr.md +43 -0
  138. package/docs/rules/event-sourcing-past-tense.md +2 -0
  139. package/docs/rules/event-sourcing-projection-never-appends.fr.md +52 -0
  140. package/docs/rules/event-sourcing-projection-never-appends.md +2 -0
  141. package/docs/rules/event-sourcing-state-in-apply.fr.md +54 -0
  142. package/docs/rules/event-sourcing-state-in-apply.md +2 -0
  143. package/docs/rules/event-sourcing-store-behind-repository.fr.md +42 -0
  144. package/docs/rules/event-sourcing-store-behind-repository.md +2 -0
  145. package/docs/rules/event-sourcing-upcaster-required.fr.md +58 -0
  146. package/docs/rules/event-sourcing-upcaster-required.md +2 -0
  147. package/docs/rules/events-consumer-idempotent.fr.md +71 -0
  148. package/docs/rules/events-consumer-idempotent.md +2 -0
  149. package/docs/rules/events-name-format.fr.md +57 -0
  150. package/docs/rules/events-name-format.md +2 -0
  151. package/docs/rules/events-outbox-required.fr.md +60 -0
  152. package/docs/rules/events-outbox-required.md +2 -0
  153. package/docs/rules/governance-recorded-deviation.fr.md +58 -0
  154. package/docs/rules/governance-recorded-deviation.md +2 -0
  155. package/docs/rules/imports-alias-only.fr.md +77 -0
  156. package/docs/rules/imports-alias-only.md +2 -0
  157. package/docs/rules/imports-extension.fr.md +86 -0
  158. package/docs/rules/imports-extension.md +2 -0
  159. package/docs/rules/language-declared-vocabulary.fr.md +67 -0
  160. package/docs/rules/language-declared-vocabulary.md +2 -0
  161. package/docs/rules/layer-application-inward.fr.md +65 -0
  162. package/docs/rules/layer-application-inward.md +4 -2
  163. package/docs/rules/layer-domain-purity.fr.md +63 -0
  164. package/docs/rules/layer-domain-purity.md +4 -2
  165. package/docs/rules/layer-infrastructure-no-presentation.fr.md +49 -0
  166. package/docs/rules/layer-infrastructure-no-presentation.md +2 -0
  167. package/docs/rules/layer-presentation-no-infrastructure.fr.md +49 -0
  168. package/docs/rules/layer-presentation-no-infrastructure.md +2 -0
  169. package/docs/rules/lifecycle-status-through-machine.fr.md +72 -0
  170. package/docs/rules/lifecycle-status-through-machine.md +2 -0
  171. package/docs/rules/ports-abstract-class.fr.md +73 -0
  172. package/docs/rules/ports-abstract-class.md +2 -0
  173. package/docs/rules/ports-implements-never-extends.fr.md +56 -0
  174. package/docs/rules/ports-implements-never-extends.md +2 -0
  175. package/docs/rules/ports-no-concrete-dependency.fr.md +56 -0
  176. package/docs/rules/ports-no-concrete-dependency.md +2 -0
  177. package/docs/rules/ports-no-token-constant.fr.md +60 -0
  178. package/docs/rules/ports-no-token-constant.md +2 -0
  179. package/docs/rules/ports-value-import.fr.md +58 -0
  180. package/docs/rules/ports-value-import.md +2 -0
  181. package/docs/rules/presentation-controller-delegates.fr.md +60 -0
  182. package/docs/rules/presentation-controller-delegates.md +2 -0
  183. package/docs/rules/presentation-controller-shape.fr.md +53 -0
  184. package/docs/rules/presentation-controller-shape.md +2 -0
  185. package/docs/rules/presentation-guard-at-the-edge.fr.md +58 -0
  186. package/docs/rules/presentation-guard-at-the-edge.md +2 -0
  187. package/docs/rules/presentation-shared-cache-varies.fr.md +57 -0
  188. package/docs/rules/presentation-shared-cache-varies.md +2 -0
  189. package/docs/rules/process-sends-commands-only.fr.md +67 -0
  190. package/docs/rules/process-sends-commands-only.md +2 -0
  191. package/docs/rules/purity-no-ambient-randomness.fr.md +46 -0
  192. package/docs/rules/purity-no-ambient-randomness.md +2 -0
  193. package/docs/rules/purity-no-environment.fr.md +48 -0
  194. package/docs/rules/purity-no-environment.md +2 -0
  195. package/docs/rules/purity-no-system-clock.fr.md +52 -0
  196. package/docs/rules/purity-no-system-clock.md +2 -0
  197. package/docs/rules/scheduling-job-name.fr.md +60 -0
  198. package/docs/rules/scheduling-job-name.md +2 -0
  199. package/docs/rules/scheduling-job-triggers-use-case.fr.md +74 -0
  200. package/docs/rules/scheduling-job-triggers-use-case.md +2 -0
  201. package/docs/rules/schema-presentation-only.fr.md +48 -0
  202. package/docs/rules/schema-presentation-only.md +2 -0
  203. package/docs/rules/standard-no-parallel-interface.fr.md +100 -0
  204. package/docs/rules/standard-no-parallel-interface.md +2 -0
  205. package/docs/rules/test-no-mocks.fr.md +50 -0
  206. package/docs/rules/test-no-mocks.md +2 -0
  207. package/docs/rules/tracing-platform-only.fr.md +68 -0
  208. package/docs/rules/tracing-platform-only.md +2 -0
  209. package/package.json +1 -1
@@ -0,0 +1,76 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { localBinding } from './local-binding.js';
3
+ /**
4
+ * The functions (declared, or arrows and function expressions bound to a constant) and object
5
+ * literals a module exports: inline, by `export { name }` and by `export default`, a name
6
+ * exported after its declaration being read from that declaration.
7
+ */
8
+ export function exportedBindings(program) {
9
+ return program.body.flatMap((statement) => {
10
+ if (statement.type === AST_NODE_TYPES.ExportDefaultDeclaration) {
11
+ return defaultExport(program, statement.declaration);
12
+ }
13
+ return statement.type === AST_NODE_TYPES.ExportNamedDeclaration && statement.exportKind !== 'type'
14
+ ? namedExport(program, statement)
15
+ : [];
16
+ });
17
+ }
18
+ /** `export function ..`, `export const ..`, and the names of `export { .. }` without a source. */
19
+ function namedExport(program, statement) {
20
+ const { declaration } = statement;
21
+ if (declaration === null) {
22
+ return statement.source === null ? statement.specifiers.flatMap((specifier) => listed(program, specifier)) : [];
23
+ }
24
+ if (declaration.type === AST_NODE_TYPES.FunctionDeclaration) {
25
+ return bound(declaration, declaration.id?.name ?? 'default', declaration.id ?? declaration);
26
+ }
27
+ return declaration.type === AST_NODE_TYPES.VariableDeclaration ? declaration.declarations.flatMap(boundTo) : [];
28
+ }
29
+ /** `export { money }`, `export { money as of }`: what the local declaration binds, reported on the export. */
30
+ function listed(program, specifier) {
31
+ const { local, exported } = specifier;
32
+ if (specifier.exportKind === 'type' || local.type !== AST_NODE_TYPES.Identifier) {
33
+ return [];
34
+ }
35
+ const name = exported.type === AST_NODE_TYPES.Identifier ? exported.name : exported.value;
36
+ return bound(localBinding(program, local.name), name, specifier);
37
+ }
38
+ /** `export default (..) => ..`, `export default function (..) {}`, `export default { .. }`, `export default money`. */
39
+ function defaultExport(program, declaration) {
40
+ if (declaration.type === AST_NODE_TYPES.FunctionDeclaration) {
41
+ return [{ kind: 'function', name: 'default', at: declaration.id ?? declaration, node: declaration }];
42
+ }
43
+ return declaration.type === AST_NODE_TYPES.Identifier
44
+ ? bound(localBinding(program, declaration.name), 'default', declaration)
45
+ : bound(declaration, 'default', declaration);
46
+ }
47
+ function boundTo(declarator) {
48
+ const name = declarator.id.type === AST_NODE_TYPES.Identifier ? declarator.id.name : 'a binding';
49
+ return bound(declarator.init ?? undefined, name, declarator.id);
50
+ }
51
+ /** What a binding holds when it is a function or an object literal; nothing else is judged. */
52
+ function bound(value, name, at) {
53
+ const inner = value === undefined ? undefined : peeled(value);
54
+ switch (inner?.type) {
55
+ case AST_NODE_TYPES.FunctionDeclaration:
56
+ case AST_NODE_TYPES.ArrowFunctionExpression:
57
+ case AST_NODE_TYPES.FunctionExpression: {
58
+ return [{ kind: 'function', name, at, node: inner }];
59
+ }
60
+ case AST_NODE_TYPES.ObjectExpression: {
61
+ return [{ kind: 'object', name, at, node: inner }];
62
+ }
63
+ default: {
64
+ return [];
65
+ }
66
+ }
67
+ }
68
+ /** The node under `as ..`, `satisfies ..` and `!`. */
69
+ function peeled(node) {
70
+ return node.type === AST_NODE_TYPES.TSAsExpression ||
71
+ node.type === AST_NODE_TYPES.TSSatisfiesExpression ||
72
+ node.type === AST_NODE_TYPES.TSNonNullExpression
73
+ ? peeled(node.expression)
74
+ : node;
75
+ }
76
+ //# sourceMappingURL=exported-bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exported-bindings.js","sourceRoot":"","sources":["../../../src/support/values/exported-bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAYlD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACxD,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,EAAqB,EAAE;QAC3D,IAAI,SAAS,CAAC,IAAI,KAAK,cAAc,CAAC,wBAAwB,EAAE,CAAC;YAC/D,OAAO,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;QACvD,CAAC;QAED,OA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AAM,CAAC,KAAK,CAAC,CAAC;IAE9D,QAAQ,KAAK,EAAE,IAAI,EAAE,CAAC;QACpB,KAAK,cAAc,CAAC,mBAAmB,CAAC;QACxC,KAAK,cAAc,CAAC,uBAAuB,CAAC;QAC5C,KAAK,cAAc,CAAC,kBAAkB,EAAE,CAAC;YACvC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;YACrC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,SAAS,CAAC;YACR,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;AACH,CAAC;AAED,sDAAsD;AACtD,SAAS,MAAM,CAAC,IAAmB;IACjC,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc;QAChD,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,qBAAqB;QAClD,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,mBAAmB;QAChD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ import type { LintedFile } from '../../project/linted-file.js';
3
+ import type { ClassNode } from '../classes/class-name.js';
4
+ /**
5
+ * Whether a class is a value object: it extends `ValueObject` of the kernel, a class of its own
6
+ * module that does, or a class imported from a value object file of the project, whose own file
7
+ * is judged on its own.
8
+ */
9
+ export declare function extendsValueObject(file: LintedFile, program: TSESTree.Program, node: ClassNode): boolean;
10
+ //# sourceMappingURL=extends-value-object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends-value-object.d.ts","sourceRoot":"","sources":["../../../src/support/values/extends-value-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAK1D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAsBxG"}
@@ -0,0 +1,36 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { topLevelClasses } from '../classes/top-level-classes.js';
3
+ import { importedBindings } from '../ports/imported-bindings.js';
4
+ import { isValueObjectPath } from './is-value-object-path.js';
5
+ /**
6
+ * Whether a class is a value object: it extends `ValueObject` of the kernel, a class of its own
7
+ * module that does, or a class imported from a value object file of the project, whose own file
8
+ * is judged on its own.
9
+ */
10
+ export function extendsValueObject(file, program, node) {
11
+ const imported = importedBindings(file, program);
12
+ const seen = new Set();
13
+ let current = node;
14
+ while (current !== undefined && !seen.has(current)) {
15
+ const parent = parentName(current.superClass);
16
+ const target = parent === undefined ? undefined : imported.get(parent)?.target;
17
+ if (parent === 'ValueObject') {
18
+ return true;
19
+ }
20
+ if (target?.kind === 'file') {
21
+ return isValueObjectPath(target.path, target.location, file.config.sharedKernelDir);
22
+ }
23
+ seen.add(current);
24
+ current = topLevelClasses(program).find((candidate) => parent !== undefined && candidate.id?.name === parent);
25
+ }
26
+ return false;
27
+ }
28
+ function parentName(superClass) {
29
+ if (superClass?.type === AST_NODE_TYPES.Identifier) {
30
+ return superClass.name;
31
+ }
32
+ return superClass?.type === AST_NODE_TYPES.MemberExpression && superClass.property.type === AST_NODE_TYPES.Identifier
33
+ ? superClass.property.name
34
+ : undefined;
35
+ }
36
+ //# sourceMappingURL=extends-value-object.js.map
@@ -0,0 +1 @@
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KAAK,SAAS,IAAI,SAAS,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC;IAChH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,UAAkD;IACpE,IAAI,UAAU,EAAE,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QACnD,OAAO,UAAU,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,OAAO,UAAU,EAAE,IAAI,KAAK,cAAc,CAAC,gBAAgB,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU;QACnH,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI;QAC1B,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Location } from '../../project/location.js';
2
+ /**
3
+ * Where a value of the model may be written as a function and is looked for: `domain/` of a
4
+ * context, and the shared kernel outside its `presentation/`. Specs are never judged. Same table
5
+ * as the checker of the CLI.
6
+ */
7
+ export declare function isModelPath(file: string, location: Location, sharedKernelDir: string): boolean;
8
+ //# sourceMappingURL=is-model-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-model-path.d.ts","sourceRoot":"","sources":["../../../src/support/values/is-model-path.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAU9F"}
@@ -0,0 +1,16 @@
1
+ import { isTestFile } from '../../project/is-test-file.js';
2
+ /**
3
+ * Where a value of the model may be written as a function and is looked for: `domain/` of a
4
+ * context, and the shared kernel outside its `presentation/`. Specs are never judged. Same table
5
+ * as the checker of the CLI.
6
+ */
7
+ export function isModelPath(file, location, sharedKernelDir) {
8
+ if (isTestFile(file, location)) {
9
+ return false;
10
+ }
11
+ if (location.area === 'context') {
12
+ return location.layer === 'domain';
13
+ }
14
+ return location.area === 'shared-kernel' && !file.startsWith(`${sharedKernelDir}/presentation/`);
15
+ }
16
+ //# sourceMappingURL=is-model-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-model-path.js","sourceRoot":"","sources":["../../../src/support/values/is-model-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,QAAkB,EAAE,eAAuB;IACnF,IAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC;IACrC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,KAAK,eAAe,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,eAAe,gBAAgB,CAAC,CAAC;AACnG,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Location } from '../../project/location.js';
2
+ /**
3
+ * Where a value object is declared: `domain/value-objects/` of a context, or a `*.vo.ts` of the
4
+ * shared kernel outside its `presentation/`. Same table as the checker of the CLI.
5
+ */
6
+ export declare function isValueObjectPath(file: string, location: Location, sharedKernelDir: string): boolean;
7
+ //# sourceMappingURL=is-value-object-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-value-object-path.d.ts","sourceRoot":"","sources":["../../../src/support/values/is-value-object-path.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAYpG"}
@@ -0,0 +1,15 @@
1
+ import { isTestFile } from '../../project/is-test-file.js';
2
+ /**
3
+ * Where a value object is declared: `domain/value-objects/` of a context, or a `*.vo.ts` of the
4
+ * shared kernel outside its `presentation/`. Same table as the checker of the CLI.
5
+ */
6
+ export function isValueObjectPath(file, location, sharedKernelDir) {
7
+ if (isTestFile(file, location)) {
8
+ return false;
9
+ }
10
+ if (location.area === 'context') {
11
+ return location.layer === 'domain' && location.inside[0] === 'value-objects';
12
+ }
13
+ return (location.area === 'shared-kernel' && file.endsWith('.vo.ts') && !file.startsWith(`${sharedKernelDir}/presentation/`));
14
+ }
15
+ //# sourceMappingURL=is-value-object-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-value-object-path.js","sourceRoot":"","sources":["../../../src/support/values/is-value-object-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,QAAkB,EAAE,eAAuB;IACzF,IAAI,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,eAAe,CAAC;IAC/E,CAAC;IAED,OAAO,CACL,QAAQ,CAAC,IAAI,KAAK,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,eAAe,gBAAgB,CAAC,CACrH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** What a call of the language itself builds: a number, a string, a date, never a value of the model. Same list as the checker of the CLI. */
2
+ export declare const JAVASCRIPT_GLOBALS: ReadonlySet<string>;
3
+ //# sourceMappingURL=javascript-globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript-globals.d.ts","sourceRoot":"","sources":["../../../src/support/values/javascript-globals.ts"],"names":[],"mappings":"AAAA,8IAA8I;AAC9I,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAmBjD,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** What a call of the language itself builds: a number, a string, a date, never a value of the model. Same list as the checker of the CLI. */
2
+ export const JAVASCRIPT_GLOBALS = new Set([
3
+ 'Array',
4
+ 'BigInt',
5
+ 'Boolean',
6
+ 'Date',
7
+ 'Intl',
8
+ 'JSON',
9
+ 'Map',
10
+ 'Math',
11
+ 'Number',
12
+ 'Object',
13
+ 'RegExp',
14
+ 'Set',
15
+ 'String',
16
+ 'Symbol',
17
+ 'URL',
18
+ 'parseFloat',
19
+ 'parseInt',
20
+ 'structuredClone',
21
+ ]);
22
+ //# sourceMappingURL=javascript-globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"javascript-globals.js","sourceRoot":"","sources":["../../../src/support/values/javascript-globals.ts"],"names":[],"mappings":"AAAA,8IAA8I;AAC9I,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,OAAO;IACP,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,UAAU;IACV,iBAAiB;CAClB,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ import type { FunctionNode } from '../functions/function-node.js';
3
+ /** What a name declared at the top of a module binds: its function, or the value of its constant. */
4
+ export declare function localBinding(program: TSESTree.Program, name: string): FunctionNode | TSESTree.Expression | undefined;
5
+ //# sourceMappingURL=local-binding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-binding.d.ts","sourceRoot":"","sources":["../../../src/support/values/local-binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,QAAQ,CAAC,UAAU,GAAG,SAAS,CAWpH"}
@@ -0,0 +1,23 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ /** What a name declared at the top of a module binds: its function, or the value of its constant. */
3
+ export function localBinding(program, name) {
4
+ for (const statement of program.body) {
5
+ const declaration = statement.type === AST_NODE_TYPES.ExportNamedDeclaration ? statement.declaration : statement;
6
+ const binding = declaration === null ? undefined : bindingOf(declaration, name);
7
+ if (binding !== undefined) {
8
+ return binding;
9
+ }
10
+ }
11
+ return undefined;
12
+ }
13
+ function bindingOf(declaration, name) {
14
+ if (declaration.type === AST_NODE_TYPES.FunctionDeclaration) {
15
+ return declaration.id?.name === name ? declaration : undefined;
16
+ }
17
+ if (declaration.type !== AST_NODE_TYPES.VariableDeclaration) {
18
+ return undefined;
19
+ }
20
+ const declarator = declaration.declarations.find(({ id }) => id.type === AST_NODE_TYPES.Identifier && id.name === name);
21
+ return declarator?.init ?? undefined;
22
+ }
23
+ //# sourceMappingURL=local-binding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-binding.js","sourceRoot":"","sources":["../../../src/support/values/local-binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAGzE,qGAAqG;AACrG,MAAM,UAAU,YAAY,CAAC,OAAyB,EAAE,IAAY;IAClE,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,KAAK,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QACjH,MAAM,OAAO,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAEhF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,SAAS,CAAC,WAA0B,EAAE,IAAY;IACzD,IAAI,WAAW,CAAC,IAAI,KAAK,cAAc,CAAC,mBAAmB,EAAE,CAAC;QAC5D,OAAO,WAAW,CAAC,EAAE,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC;IAED,IAAI,WAAW,CAAC,IAAI,KAAK,cAAc,CAAC,mBAAmB,EAAE,CAAC;QAC5D,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,YAAY,CAAC,IAAI,CAC9C,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,CACtE,CAAC;IAEF,OAAO,UAAU,EAAE,IAAI,IAAI,SAAS,CAAC;AACvC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ import type { LintedFile } from '../../project/linted-file.js';
3
+ import type { FunctionNode } from '../functions/function-node.js';
4
+ /**
5
+ * Whether a function declares that it returns a type of a package (`): EventStamp` of the kernel):
6
+ * the shape is the one of the library, which the project cannot make a class of its own.
7
+ */
8
+ export declare function returnsPackageType(file: LintedFile, program: TSESTree.Program, node: FunctionNode): boolean;
9
+ //# sourceMappingURL=returns-package-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returns-package-type.d.ts","sourceRoot":"","sources":["../../../src/support/values/returns-package-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAU3G"}
@@ -0,0 +1,28 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { importedBindings } from '../ports/imported-bindings.js';
3
+ /**
4
+ * Whether a function declares that it returns a type of a package (`): EventStamp` of the kernel):
5
+ * the shape is the one of the library, which the project cannot make a class of its own.
6
+ */
7
+ export function returnsPackageType(file, program, node) {
8
+ const annotation = node.returnType?.typeAnnotation;
9
+ if (annotation?.type !== AST_NODE_TYPES.TSTypeReference) {
10
+ return false;
11
+ }
12
+ const name = leftmost(annotation.typeName);
13
+ return importedBindings(file, program).get(name)?.target.kind === 'package';
14
+ }
15
+ function leftmost(name) {
16
+ switch (name.type) {
17
+ case AST_NODE_TYPES.Identifier: {
18
+ return name.name;
19
+ }
20
+ case AST_NODE_TYPES.TSQualifiedName: {
21
+ return leftmost(name.left);
22
+ }
23
+ default: {
24
+ return '';
25
+ }
26
+ }
27
+ }
28
+ //# sourceMappingURL=returns-package-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"returns-package-type.js","sourceRoot":"","sources":["../../../src/support/values/returns-package-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAgB,EAAE,OAAyB,EAAE,IAAkB;IAChG,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC;IAEnD,IAAI,UAAU,EAAE,IAAI,KAAK,cAAc,CAAC,eAAe,EAAE,CAAC;QACxD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE3C,OAAO,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,IAAyB;IACzC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QACD,KAAK,cAAc,CAAC,eAAe,EAAE,CAAC;YACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;QACD,SAAS,CAAC;YACR,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /** The name a chain of calls and members starts from: `Money` in `Money.of(1).add(tax)`; undefined when it starts from `this` or an expression. */
3
+ export declare function rootName(node: TSESTree.Node): string | undefined;
4
+ //# sourceMappingURL=root-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-name.d.ts","sourceRoot":"","sources":["../../../src/support/values/root-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzE,mJAAmJ;AACnJ,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,MAAM,GAAG,SAAS,CAmBhE"}
@@ -0,0 +1,23 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ /** The name a chain of calls and members starts from: `Money` in `Money.of(1).add(tax)`; undefined when it starts from `this` or an expression. */
3
+ export function rootName(node) {
4
+ switch (node.type) {
5
+ case AST_NODE_TYPES.Identifier: {
6
+ return node.name;
7
+ }
8
+ case AST_NODE_TYPES.MemberExpression: {
9
+ return rootName(node.object);
10
+ }
11
+ case AST_NODE_TYPES.CallExpression:
12
+ case AST_NODE_TYPES.NewExpression: {
13
+ return rootName(node.callee);
14
+ }
15
+ case AST_NODE_TYPES.ChainExpression: {
16
+ return rootName(node.expression);
17
+ }
18
+ default: {
19
+ return undefined;
20
+ }
21
+ }
22
+ }
23
+ //# sourceMappingURL=root-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-name.js","sourceRoot":"","sources":["../../../src/support/values/root-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,mJAAmJ;AACnJ,MAAM,UAAU,QAAQ,CAAC,IAAmB;IAC1C,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QACD,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;YACrC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;QACD,KAAK,cAAc,CAAC,cAAc,CAAC;QACnC,KAAK,cAAc,CAAC,aAAa,EAAE,CAAC;YAClC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;QACD,KAAK,cAAc,CAAC,eAAe,EAAE,CAAC;YACpC,OAAO,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,CAAC;QACD,SAAS,CAAC;YACR,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /**
3
+ * Whether an object literal answered by a function is a value of the model written as a record:
4
+ * it holds data (an entry that is not a function), nothing a call or `new` of the model built,
5
+ * and no spread. A record of value objects the function builds (`{ first: Money.of(1), rest }`)
6
+ * is an operation of the model; a spread (`{ ...state, status }`) derives a record that exists;
7
+ * an object of functions only is behaviour, a specification or a strategy.
8
+ */
9
+ export declare function standsForAValue(object: TSESTree.ObjectExpression, program: TSESTree.Program): boolean;
10
+ //# sourceMappingURL=stands-for-a-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stands-for-a-value.d.ts","sourceRoot":"","sources":["../../../src/support/values/stands-for-a-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAWzE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,GAAG,OAAO,CAUrG"}
@@ -0,0 +1,31 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { expressionRole } from './entry-role.js';
3
+ /**
4
+ * Whether an object literal answered by a function is a value of the model written as a record:
5
+ * it holds data (an entry that is not a function), nothing a call or `new` of the model built,
6
+ * and no spread. A record of value objects the function builds (`{ first: Money.of(1), rest }`)
7
+ * is an operation of the model; a spread (`{ ...state, status }`) derives a record that exists;
8
+ * an object of functions only is behaviour, a specification or a strategy.
9
+ */
10
+ export function standsForAValue(object, program) {
11
+ const roles = object.properties.map((property) => {
12
+ if (property.type === AST_NODE_TYPES.SpreadElement) {
13
+ return 'spread';
14
+ }
15
+ return property.method || property.kind !== 'init' ? 'behaviour' : valueRole(property.value, program);
16
+ });
17
+ return roles.includes('data') && !roles.includes('built') && !roles.includes('spread');
18
+ }
19
+ function valueRole(value, program) {
20
+ if (isNotAnExpression(value)) {
21
+ return value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression ? 'behaviour' : 'data';
22
+ }
23
+ return expressionRole(value, program);
24
+ }
25
+ function isNotAnExpression(value) {
26
+ return (value.type === AST_NODE_TYPES.AssignmentPattern ||
27
+ value.type === AST_NODE_TYPES.ArrayPattern ||
28
+ value.type === AST_NODE_TYPES.ObjectPattern ||
29
+ value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression);
30
+ }
31
+ //# sourceMappingURL=stands-for-a-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stands-for-a-value.js","sourceRoot":"","sources":["../../../src/support/values/stands-for-a-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAUjD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiC,EAAE,OAAyB;IAC1F,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAC/C,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,aAAa,EAAE,CAAC;YACnD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,OAAO,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,SAAS,CAAC,KAAoB,EAAE,OAAyB;IAChE,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,6BAA6B,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5F,CAAC;IAED,OAAO,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAoB;IAC7C,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB;QAC/C,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,YAAY;QAC1C,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,aAAa;QAC3C,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,6BAA6B,CAC5D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /** The expression under `as ..`, `satisfies ..` and `!`, which change its type and not what it is. */
3
+ export declare function unwrapped(expression: TSESTree.Expression): TSESTree.Expression;
4
+ //# sourceMappingURL=unwrapped.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrapped.d.ts","sourceRoot":"","sources":["../../../src/support/values/unwrapped.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzE,sGAAsG;AACtG,wBAAgB,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAU9E"}
@@ -0,0 +1,11 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ /** The expression under `as ..`, `satisfies ..` and `!`, which change its type and not what it is. */
3
+ export function unwrapped(expression) {
4
+ if (expression.type === AST_NODE_TYPES.TSAsExpression ||
5
+ expression.type === AST_NODE_TYPES.TSSatisfiesExpression ||
6
+ expression.type === AST_NODE_TYPES.TSNonNullExpression) {
7
+ return unwrapped(expression.expression);
8
+ }
9
+ return expression;
10
+ }
11
+ //# sourceMappingURL=unwrapped.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrapped.js","sourceRoot":"","sources":["../../../src/support/values/unwrapped.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,sGAAsG;AACtG,MAAM,UAAU,SAAS,CAAC,UAA+B;IACvD,IACE,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc;QACjD,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,qBAAqB;QACxD,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,mBAAmB,EACtD,CAAC;QACD,OAAO,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.15.0";
1
+ export declare const VERSION = "0.16.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.15.0';
1
+ export const VERSION = '0.16.1';
2
2
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,57 @@
1
+ [English](application-command-query-separation.md) · **Français**
2
+ <!-- translation-of: application-command-query-separation.md sha256:71759990f27562b5 -->
3
+
4
+ # ddd-ts-kit/application-command-query-separation
5
+
6
+ Identifiant d'architecture : `application/command-query-separation` (ajouté par ce *plugin*). Sévérité par défaut : `warn` dans `recommended`, `error` dans `strict`.
7
+
8
+ S'applique à : les fichiers sous `application/queries/` d'un contexte, tests exclus.
9
+
10
+ ## Pourquoi
11
+
12
+ Une requête répond et ne change jamais l'état : on peut alors la relancer, la mettre en cache et l'exécuter sur une réplique. Une requête qui enregistre est une commande avec une valeur de retour.
13
+
14
+ ## Signalé
15
+
16
+ - un appel de `save`, `delete` ou `publish` sur quelque chose que tient le gestionnaire (`this.invoices.save(...)`, `this.#bus.publish(...)`)
17
+
18
+ Incorrect :
19
+
20
+ ```ts
21
+ export class SearchInvoicesHandler {
22
+ async execute(query: SearchInvoicesQuery): Promise<SearchInvoicesResult> {
23
+ await this.audit.save(query);
24
+ return this.reader.read(query);
25
+ }
26
+ }
27
+ ```
28
+
29
+ Correct :
30
+
31
+ ```ts
32
+ export class SearchInvoicesHandler {
33
+ async execute(query: SearchInvoicesQuery): Promise<SearchInvoicesResult> {
34
+ return this.reader.read(query);
35
+ }
36
+ }
37
+ ```
38
+
39
+ ## Détails
40
+
41
+ Pragmatique par conception : la règle reconnaît des noms de méthodes sur les dépendances atteintes par `this`. Un `Set` local dont on appelle `delete` n'est pas signalé.
42
+
43
+ ## Options
44
+
45
+ `[{ "mutators": ["save", "delete", "publish"] }]` remplace la liste des noms de méthodes.
46
+
47
+ `rules."application/command-query-separation"` à `off` dans `ddd-ts-kit.config.json` désactive la règle, et `// ddd-ts-kit-disable-next-line application/command-query-separation -- <reason>` désactive une ligne, exactement comme pour `ddd-ts-kit check`.
48
+
49
+ ## Limites
50
+
51
+ - Une modification derrière un autre nom (`upsert`, `record`) demande l'option `mutators`.
52
+ - Une dépendance passée en argument plutôt qu'injectée n'est pas suivie.
53
+ - L'autre moitié du principe, une commande qui renvoie plus qu'un identifiant, est laissée à la revue.
54
+
55
+ ## Avec le checker de la CLI
56
+
57
+ Nouveau avec ce *plugin* : le *checker* de la CLI n'a pas d'équivalent, car la forme d'une classe demande un arbre syntaxique.
@@ -1,3 +1,5 @@
1
+ **English** · [Français](application-command-query-separation.fr.md)
2
+
1
3
  # ddd-ts-kit/application-command-query-separation
2
4
 
3
5
  Architecture id: `application/command-query-separation` (added by this plugin). Default severity: `warn` in `recommended`, `error` in `strict`.
@@ -0,0 +1,55 @@
1
+ [English](application-handler-shape.md) · **Français**
2
+ <!-- translation-of: application-handler-shape.md sha256:39389c2ddda30de3 -->
3
+
4
+ # ddd-ts-kit/application-handler-shape
5
+
6
+ Identifiant d'architecture : `application/handler-shape` (ajouté par ce *plugin*). Sévérité par défaut : `error` dans `recommended`, `error` dans `strict`.
7
+
8
+ S'applique à : les fichiers `*.handler.ts` sous `application/` d'un contexte.
9
+
10
+ ## Pourquoi
11
+
12
+ Un gestionnaire (handler) est un cas d'usage : une classe, appelée par le bus par `execute`. Une seconde méthode publique est un second cas d'usage caché dans le premier, ou une décision métier qui revient au domaine.
13
+
14
+ ## Signalé
15
+
16
+ - un fichier de gestionnaire qui n'exporte aucune classe
17
+ - une seconde classe exportée
18
+ - une classe de gestionnaire sans `execute` public
19
+ - toute autre méthode publique ou propriété de type fonction, statiques comprises
20
+
21
+ Incorrect :
22
+
23
+ ```ts
24
+ export class IssueInvoiceHandler {
25
+ async handle(command: IssueInvoiceCommand): Promise<string> {}
26
+ computeTotal(): number {}
27
+ }
28
+ ```
29
+
30
+ Correct :
31
+
32
+ ```ts
33
+ export class IssueInvoiceHandler implements CommandHandler<IssueInvoiceCommand> {
34
+ async execute(command: IssueInvoiceCommand): Promise<string> {}
35
+ private total(): number {}
36
+ }
37
+ ```
38
+
39
+ ## Détails
40
+
41
+ Les types, interfaces et constantes exportés à côté de la classe sont permis. Les fichiers `*.event-handler.ts` ne sont pas des gestionnaires du bus et ne sont pas jugés.
42
+
43
+ ## Options
44
+
45
+ Aucune.
46
+
47
+ `rules."application/handler-shape"` à `off` dans `ddd-ts-kit.config.json` désactive la règle, et `// ddd-ts-kit-disable-next-line application/handler-shape -- <reason>` désactive une ligne, exactement comme pour `ddd-ts-kit check`.
48
+
49
+ ## Limites
50
+
51
+ - La signature de `execute` n'est pas vérifiée par rapport au type de la commande ou de la requête : le compilateur le fait par `CommandHandler<T>` et `QueryHandler<T>`.
52
+
53
+ ## Avec le checker de la CLI
54
+
55
+ Nouveau avec ce *plugin* : le *checker* de la CLI n'a pas d'équivalent, car la forme d'une classe demande un arbre syntaxique.
@@ -1,3 +1,5 @@
1
+ **English** · [Français](application-handler-shape.fr.md)
2
+
1
3
  # ddd-ts-kit/application-handler-shape
2
4
 
3
5
  Architecture id: `application/handler-shape` (added by this plugin). Default severity: `error` in `recommended`, `error` in `strict`.