@ddd-ts-kit/eslint-plugin 0.16.0 → 0.17.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 (235) hide show
  1. package/README.fr.md +465 -0
  2. package/README.md +149 -9
  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/naming-business-name.d.ts +6 -0
  9. package/dist/rules/naming-business-name.d.ts.map +1 -0
  10. package/dist/rules/naming-business-name.js +175 -0
  11. package/dist/rules/naming-business-name.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/business-names/binding-advice.d.ts +4 -0
  16. package/dist/support/business-names/binding-advice.d.ts.map +1 -0
  17. package/dist/support/business-names/binding-advice.js +12 -0
  18. package/dist/support/business-names/binding-advice.js.map +1 -0
  19. package/dist/support/business-names/binding-kind.d.ts +3 -0
  20. package/dist/support/business-names/binding-kind.d.ts.map +1 -0
  21. package/dist/support/business-names/binding-kind.js +2 -0
  22. package/dist/support/business-names/binding-kind.js.map +1 -0
  23. package/dist/support/business-names/built-class.d.ts +9 -0
  24. package/dist/support/business-names/built-class.d.ts.map +1 -0
  25. package/dist/support/business-names/built-class.js +37 -0
  26. package/dist/support/business-names/built-class.js.map +1 -0
  27. package/dist/support/business-names/called-member.d.ts +8 -0
  28. package/dist/support/business-names/called-member.d.ts.map +1 -0
  29. package/dist/support/business-names/called-member.js +10 -0
  30. package/dist/support/business-names/called-member.js.map +1 -0
  31. package/dist/support/business-names/camel.d.ts +3 -0
  32. package/dist/support/business-names/camel.d.ts.map +1 -0
  33. package/dist/support/business-names/camel.js +5 -0
  34. package/dist/support/business-names/camel.js.map +1 -0
  35. package/dist/support/business-names/collection-element.d.ts +4 -0
  36. package/dist/support/business-names/collection-element.d.ts.map +1 -0
  37. package/dist/support/business-names/collection-element.js +12 -0
  38. package/dist/support/business-names/collection-element.js.map +1 -0
  39. package/dist/support/business-names/conventional-model-name.d.ts +9 -0
  40. package/dist/support/business-names/conventional-model-name.d.ts.map +1 -0
  41. package/dist/support/business-names/conventional-model-name.js +22 -0
  42. package/dist/support/business-names/conventional-model-name.js.map +1 -0
  43. package/dist/support/business-names/generic-words.d.ts +6 -0
  44. package/dist/support/business-names/generic-words.d.ts.map +1 -0
  45. package/dist/support/business-names/generic-words.js +25 -0
  46. package/dist/support/business-names/generic-words.js.map +1 -0
  47. package/dist/support/business-names/is-name-free.d.ts +10 -0
  48. package/dist/support/business-names/is-name-free.d.ts.map +1 -0
  49. package/dist/support/business-names/is-name-free.js +26 -0
  50. package/dist/support/business-names/is-name-free.js.map +1 -0
  51. package/dist/support/business-names/judges-names.d.ts +7 -0
  52. package/dist/support/business-names/judges-names.d.ts.map +1 -0
  53. package/dist/support/business-names/judges-names.js +14 -0
  54. package/dist/support/business-names/judges-names.js.map +1 -0
  55. package/dist/support/business-names/pattern-identifiers.d.ts +4 -0
  56. package/dist/support/business-names/pattern-identifiers.d.ts.map +1 -0
  57. package/dist/support/business-names/pattern-identifiers.js +21 -0
  58. package/dist/support/business-names/pattern-identifiers.js.map +1 -0
  59. package/dist/support/business-names/plural.d.ts +3 -0
  60. package/dist/support/business-names/plural.d.ts.map +1 -0
  61. package/dist/support/business-names/plural.js +8 -0
  62. package/dist/support/business-names/plural.js.map +1 -0
  63. package/dist/support/business-names/proposed-name.d.ts +6 -0
  64. package/dist/support/business-names/proposed-name.d.ts.map +1 -0
  65. package/dist/support/business-names/proposed-name.js +2 -0
  66. package/dist/support/business-names/proposed-name.js.map +1 -0
  67. package/dist/support/business-names/rename-fix.d.ts +8 -0
  68. package/dist/support/business-names/rename-fix.d.ts.map +1 -0
  69. package/dist/support/business-names/rename-fix.js +26 -0
  70. package/dist/support/business-names/rename-fix.js.map +1 -0
  71. package/dist/support/business-names/repository-concept.d.ts +4 -0
  72. package/dist/support/business-names/repository-concept.d.ts.map +1 -0
  73. package/dist/support/business-names/repository-concept.js +10 -0
  74. package/dist/support/business-names/repository-concept.js.map +1 -0
  75. package/dist/support/business-names/singular.d.ts +3 -0
  76. package/dist/support/business-names/singular.d.ts.map +1 -0
  77. package/dist/support/business-names/singular.js +11 -0
  78. package/dist/support/business-names/singular.js.map +1 -0
  79. package/dist/support/business-names/typed-names.d.ts +13 -0
  80. package/dist/support/business-names/typed-names.d.ts.map +1 -0
  81. package/dist/support/business-names/typed-names.js +53 -0
  82. package/dist/support/business-names/typed-names.js.map +1 -0
  83. package/dist/support/business-names/words-of.d.ts +9 -0
  84. package/dist/support/business-names/words-of.d.ts.map +1 -0
  85. package/dist/support/business-names/words-of.js +8 -0
  86. package/dist/support/business-names/words-of.js.map +1 -0
  87. package/dist/version.d.ts +1 -1
  88. package/dist/version.js +1 -1
  89. package/docs/rules/application-command-query-separation.fr.md +57 -0
  90. package/docs/rules/application-command-query-separation.md +2 -0
  91. package/docs/rules/application-handler-shape.fr.md +55 -0
  92. package/docs/rules/application-handler-shape.md +2 -0
  93. package/docs/rules/aspects-outside-in.fr.md +57 -0
  94. package/docs/rules/aspects-outside-in.md +2 -0
  95. package/docs/rules/authz-actor-explicit.fr.md +73 -0
  96. package/docs/rules/authz-actor-explicit.md +2 -0
  97. package/docs/rules/authz-declared.fr.md +90 -0
  98. package/docs/rules/authz-declared.md +3 -1
  99. package/docs/rules/authz-fields-by-schema.fr.md +54 -0
  100. package/docs/rules/authz-fields-by-schema.md +2 -0
  101. package/docs/rules/authz-in-application.fr.md +91 -0
  102. package/docs/rules/authz-in-application.md +2 -0
  103. package/docs/rules/clean-blank-lines.fr.md +90 -0
  104. package/docs/rules/clean-blank-lines.md +2 -0
  105. package/docs/rules/clean-braces.fr.md +64 -0
  106. package/docs/rules/clean-braces.md +2 -0
  107. package/docs/rules/clean-file-size.fr.md +46 -0
  108. package/docs/rules/clean-file-size.md +2 -0
  109. package/docs/rules/clean-formatted.fr.md +35 -0
  110. package/docs/rules/clean-formatted.md +2 -0
  111. package/docs/rules/clean-function-ceiling.fr.md +56 -0
  112. package/docs/rules/clean-function-ceiling.md +2 -0
  113. package/docs/rules/clean-function-size.fr.md +48 -0
  114. package/docs/rules/clean-function-size.md +2 -0
  115. package/docs/rules/clean-no-commented-out-code.fr.md +51 -0
  116. package/docs/rules/clean-no-commented-out-code.md +2 -0
  117. package/docs/rules/clean-no-escape-hatch.fr.md +83 -0
  118. package/docs/rules/clean-no-escape-hatch.md +2 -0
  119. package/docs/rules/clean-no-flag-argument.fr.md +53 -0
  120. package/docs/rules/clean-no-flag-argument.md +2 -0
  121. package/docs/rules/clean-no-hash-private.fr.md +66 -0
  122. package/docs/rules/clean-no-hash-private.md +2 -0
  123. package/docs/rules/clean-no-magic-number.fr.md +62 -0
  124. package/docs/rules/clean-no-magic-number.md +2 -0
  125. package/docs/rules/clean-no-noise-comment.fr.md +58 -0
  126. package/docs/rules/clean-no-noise-comment.md +2 -0
  127. package/docs/rules/clean-one-export-per-file.fr.md +91 -0
  128. package/docs/rules/clean-one-export-per-file.md +2 -0
  129. package/docs/rules/clean-stepdown.fr.md +63 -0
  130. package/docs/rules/clean-stepdown.md +2 -0
  131. package/docs/rules/context-declared-relationship.fr.md +52 -0
  132. package/docs/rules/context-declared-relationship.md +2 -0
  133. package/docs/rules/context-extractable.fr.md +112 -0
  134. package/docs/rules/context-extractable.md +2 -0
  135. package/docs/rules/context-published-language-is-a-contract.fr.md +50 -0
  136. package/docs/rules/context-published-language-is-a-contract.md +2 -0
  137. package/docs/rules/context-published-language-only.fr.md +50 -0
  138. package/docs/rules/context-published-language-only.md +2 -0
  139. package/docs/rules/declarations-constructor-injection.fr.md +92 -0
  140. package/docs/rules/declarations-constructor-injection.md +2 -0
  141. package/docs/rules/declarations-role-declared.fr.md +118 -0
  142. package/docs/rules/declarations-role-declared.md +2 -0
  143. package/docs/rules/domain-aggregate-encapsulation.fr.md +66 -0
  144. package/docs/rules/domain-aggregate-encapsulation.md +2 -0
  145. package/docs/rules/domain-events-dispatched-on-save.fr.md +86 -0
  146. package/docs/rules/domain-events-dispatched-on-save.md +2 -0
  147. package/docs/rules/domain-events-transactional-before-commit.fr.md +95 -0
  148. package/docs/rules/domain-events-transactional-before-commit.md +2 -0
  149. package/docs/rules/domain-no-generic-error.fr.md +43 -0
  150. package/docs/rules/domain-no-generic-error.md +2 -0
  151. package/docs/rules/domain-value-object-class.fr.md +177 -0
  152. package/docs/rules/domain-value-object-class.md +2 -0
  153. package/docs/rules/domain-value-object-immutability.fr.md +55 -0
  154. package/docs/rules/domain-value-object-immutability.md +2 -0
  155. package/docs/rules/errors-constructor-not-public.fr.md +56 -0
  156. package/docs/rules/errors-constructor-not-public.md +2 -0
  157. package/docs/rules/errors-factory-name.fr.md +53 -0
  158. package/docs/rules/errors-factory-name.md +2 -0
  159. package/docs/rules/errors-through-factory.fr.md +48 -0
  160. package/docs/rules/errors-through-factory.md +2 -0
  161. package/docs/rules/event-sourcing-past-tense.fr.md +43 -0
  162. package/docs/rules/event-sourcing-past-tense.md +2 -0
  163. package/docs/rules/event-sourcing-projection-never-appends.fr.md +52 -0
  164. package/docs/rules/event-sourcing-projection-never-appends.md +2 -0
  165. package/docs/rules/event-sourcing-state-in-apply.fr.md +54 -0
  166. package/docs/rules/event-sourcing-state-in-apply.md +2 -0
  167. package/docs/rules/event-sourcing-store-behind-repository.fr.md +42 -0
  168. package/docs/rules/event-sourcing-store-behind-repository.md +2 -0
  169. package/docs/rules/event-sourcing-upcaster-required.fr.md +58 -0
  170. package/docs/rules/event-sourcing-upcaster-required.md +2 -0
  171. package/docs/rules/events-consumer-idempotent.fr.md +71 -0
  172. package/docs/rules/events-consumer-idempotent.md +2 -0
  173. package/docs/rules/events-name-format.fr.md +57 -0
  174. package/docs/rules/events-name-format.md +2 -0
  175. package/docs/rules/events-outbox-required.fr.md +60 -0
  176. package/docs/rules/events-outbox-required.md +2 -0
  177. package/docs/rules/governance-recorded-deviation.fr.md +58 -0
  178. package/docs/rules/governance-recorded-deviation.md +2 -0
  179. package/docs/rules/imports-alias-only.fr.md +77 -0
  180. package/docs/rules/imports-alias-only.md +2 -0
  181. package/docs/rules/imports-extension.fr.md +86 -0
  182. package/docs/rules/imports-extension.md +2 -0
  183. package/docs/rules/language-declared-vocabulary.fr.md +67 -0
  184. package/docs/rules/language-declared-vocabulary.md +2 -0
  185. package/docs/rules/layer-application-inward.fr.md +65 -0
  186. package/docs/rules/layer-application-inward.md +4 -2
  187. package/docs/rules/layer-domain-purity.fr.md +63 -0
  188. package/docs/rules/layer-domain-purity.md +4 -2
  189. package/docs/rules/layer-infrastructure-no-presentation.fr.md +49 -0
  190. package/docs/rules/layer-infrastructure-no-presentation.md +2 -0
  191. package/docs/rules/layer-presentation-no-infrastructure.fr.md +49 -0
  192. package/docs/rules/layer-presentation-no-infrastructure.md +2 -0
  193. package/docs/rules/lifecycle-status-through-machine.fr.md +72 -0
  194. package/docs/rules/lifecycle-status-through-machine.md +2 -0
  195. package/docs/rules/naming-business-name.fr.md +82 -0
  196. package/docs/rules/naming-business-name.md +81 -0
  197. package/docs/rules/ports-abstract-class.fr.md +73 -0
  198. package/docs/rules/ports-abstract-class.md +2 -0
  199. package/docs/rules/ports-implements-never-extends.fr.md +56 -0
  200. package/docs/rules/ports-implements-never-extends.md +2 -0
  201. package/docs/rules/ports-no-concrete-dependency.fr.md +56 -0
  202. package/docs/rules/ports-no-concrete-dependency.md +2 -0
  203. package/docs/rules/ports-no-token-constant.fr.md +60 -0
  204. package/docs/rules/ports-no-token-constant.md +2 -0
  205. package/docs/rules/ports-value-import.fr.md +58 -0
  206. package/docs/rules/ports-value-import.md +2 -0
  207. package/docs/rules/presentation-controller-delegates.fr.md +60 -0
  208. package/docs/rules/presentation-controller-delegates.md +2 -0
  209. package/docs/rules/presentation-controller-shape.fr.md +53 -0
  210. package/docs/rules/presentation-controller-shape.md +2 -0
  211. package/docs/rules/presentation-guard-at-the-edge.fr.md +58 -0
  212. package/docs/rules/presentation-guard-at-the-edge.md +2 -0
  213. package/docs/rules/presentation-shared-cache-varies.fr.md +57 -0
  214. package/docs/rules/presentation-shared-cache-varies.md +2 -0
  215. package/docs/rules/process-sends-commands-only.fr.md +67 -0
  216. package/docs/rules/process-sends-commands-only.md +2 -0
  217. package/docs/rules/purity-no-ambient-randomness.fr.md +46 -0
  218. package/docs/rules/purity-no-ambient-randomness.md +2 -0
  219. package/docs/rules/purity-no-environment.fr.md +48 -0
  220. package/docs/rules/purity-no-environment.md +2 -0
  221. package/docs/rules/purity-no-system-clock.fr.md +52 -0
  222. package/docs/rules/purity-no-system-clock.md +2 -0
  223. package/docs/rules/scheduling-job-name.fr.md +60 -0
  224. package/docs/rules/scheduling-job-name.md +2 -0
  225. package/docs/rules/scheduling-job-triggers-use-case.fr.md +74 -0
  226. package/docs/rules/scheduling-job-triggers-use-case.md +2 -0
  227. package/docs/rules/schema-presentation-only.fr.md +48 -0
  228. package/docs/rules/schema-presentation-only.md +2 -0
  229. package/docs/rules/standard-no-parallel-interface.fr.md +100 -0
  230. package/docs/rules/standard-no-parallel-interface.md +2 -0
  231. package/docs/rules/test-no-mocks.fr.md +50 -0
  232. package/docs/rules/test-no-mocks.md +2 -0
  233. package/docs/rules/tracing-platform-only.fr.md +68 -0
  234. package/docs/rules/tracing-platform-only.md +2 -0
  235. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ import { TSESLint, type TSESTree } from '@typescript-eslint/utils';
2
+ import type { LintedFile } from '../../project/linted-file.js';
3
+ /**
4
+ * The class of the project an initializer builds, `X.create(..)` or `new X(..)`: a class of the
5
+ * file, or one imported from the project. A class of a package or of the language (`new Map()`)
6
+ * says nothing of the business.
7
+ */
8
+ export declare function builtClass(sourceCode: Readonly<TSESLint.SourceCode>, file: LintedFile, init: TSESTree.Expression): string | undefined;
9
+ //# sourceMappingURL=built-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"built-class.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/built-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,QAAQ,CAAC,UAAU,GACxB,MAAM,GAAG,SAAS,CAmBpB"}
@@ -0,0 +1,37 @@
1
+ import { ASTUtils, AST_NODE_TYPES, TSESLint } from '@typescript-eslint/utils';
2
+ const PASCAL = /^[A-Z][A-Za-z\d]*$/;
3
+ /**
4
+ * The class of the project an initializer builds, `X.create(..)` or `new X(..)`: a class of the
5
+ * file, or one imported from the project. A class of a package or of the language (`new Map()`)
6
+ * says nothing of the business.
7
+ */
8
+ export function builtClass(sourceCode, file, init) {
9
+ const callee = builtCallee(init);
10
+ if (callee === undefined || !PASCAL.test(callee.name)) {
11
+ return undefined;
12
+ }
13
+ const definition = ASTUtils.findVariable(sourceCode.getScope(callee), callee.name)?.defs[0];
14
+ if (definition?.type === TSESLint.Scope.DefinitionType.ClassName) {
15
+ return callee.name;
16
+ }
17
+ const imported = definition?.type === TSESLint.Scope.DefinitionType.ImportBinding &&
18
+ definition.parent.type === AST_NODE_TYPES.ImportDeclaration &&
19
+ isProjectSpecifier(file, definition.parent.source.value);
20
+ return imported ? callee.name : undefined;
21
+ }
22
+ function builtCallee(init) {
23
+ const value = init.type === AST_NODE_TYPES.AwaitExpression ? init.argument : init;
24
+ if (value.type === AST_NODE_TYPES.NewExpression) {
25
+ return value.callee.type === AST_NODE_TYPES.Identifier ? value.callee : undefined;
26
+ }
27
+ if (value.type !== AST_NODE_TYPES.CallExpression || value.callee.type !== AST_NODE_TYPES.MemberExpression) {
28
+ return undefined;
29
+ }
30
+ const { object, property } = value.callee;
31
+ const creates = !value.callee.computed && property.type === AST_NODE_TYPES.Identifier && property.name === 'create';
32
+ return creates && object.type === AST_NODE_TYPES.Identifier ? object : undefined;
33
+ }
34
+ function isProjectSpecifier(file, specifier) {
35
+ return specifier.startsWith('.') || specifier.startsWith(file.config.importAlias);
36
+ }
37
+ //# sourceMappingURL=built-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"built-class.js","sourceRoot":"","sources":["../../../src/support/business-names/built-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAG7F,MAAM,MAAM,GAAG,oBAAoB,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,UAAyC,EACzC,IAAgB,EAChB,IAAyB;IAEzB,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAE5F,IAAI,UAAU,EAAE,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;QACjE,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,MAAM,QAAQ,GACZ,UAAU,EAAE,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa;QAChE,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB;QAC3D,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE3D,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5C,CAAC;AAED,SAAS,WAAW,CAAC,IAAyB;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAElF,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,aAAa,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QAC1G,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAE1C,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC;IAEpH,OAAO,OAAO,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACnF,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAgB,EAAE,SAAiB;IAC7D,OAAO,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /** The object and the method of `object.method(..)`, awaited or not. */
3
+ export interface CalledMember {
4
+ readonly object: TSESTree.Expression;
5
+ readonly method: string;
6
+ }
7
+ export declare function calledMember(init: TSESTree.Expression): CalledMember | undefined;
8
+ //# sourceMappingURL=called-member.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"called-member.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/called-member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzE,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,YAAY,GAAG,SAAS,CAUhF"}
@@ -0,0 +1,10 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ export function calledMember(init) {
3
+ const value = init.type === AST_NODE_TYPES.AwaitExpression ? init.argument : init;
4
+ if (value.type !== AST_NODE_TYPES.CallExpression || value.callee.type !== AST_NODE_TYPES.MemberExpression) {
5
+ return undefined;
6
+ }
7
+ const { object, property, computed } = value.callee;
8
+ return computed || property.type !== AST_NODE_TYPES.Identifier ? undefined : { object, method: property.name };
9
+ }
10
+ //# sourceMappingURL=called-member.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"called-member.js","sourceRoot":"","sources":["../../../src/support/business-names/called-member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAQzE,MAAM,UAAU,YAAY,CAAC,IAAyB;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;IAElF,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;QAC1G,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;IAEpD,OAAO,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjH,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** `practiceMember` for `PracticeMember`: the name of a binding that holds one of them. */
2
+ export declare function camel(pascal: string): string;
3
+ //# sourceMappingURL=camel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camel.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/camel.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5C"}
@@ -0,0 +1,5 @@
1
+ /** `practiceMember` for `PracticeMember`: the name of a binding that holds one of them. */
2
+ export function camel(pascal) {
3
+ return pascal.charAt(0).toLowerCase() + pascal.slice(1);
4
+ }
5
+ //# sourceMappingURL=camel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camel.js","sourceRoot":"","sources":["../../../src/support/business-names/camel.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,UAAU,KAAK,CAAC,MAAc;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /** The singular of the last word of a collection named after a concept: `reminder` for `dueReminders` or `this.reminders`. */
3
+ export declare function collectionElement(collection: TSESTree.Expression): string | undefined;
4
+ //# sourceMappingURL=collection-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-element.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/collection-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzE,8HAA8H;AAC9H,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAQrF"}
@@ -0,0 +1,12 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ import { splitWords } from '../words/split-words.js';
3
+ import { singular } from './singular.js';
4
+ /** The singular of the last word of a collection named after a concept: `reminder` for `dueReminders` or `this.reminders`. */
5
+ export function collectionElement(collection) {
6
+ const named = collection.type === AST_NODE_TYPES.MemberExpression ? collection.property : collection;
7
+ if (named.type !== AST_NODE_TYPES.Identifier) {
8
+ return undefined;
9
+ }
10
+ return singular(splitWords(named.name).at(-1) ?? '');
11
+ }
12
+ //# sourceMappingURL=collection-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection-element.js","sourceRoot":"","sources":["../../../src/support/business-names/collection-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,8HAA8H;AAC9H,MAAM,UAAU,iBAAiB,CAAC,UAA+B;IAC/D,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC;IAErG,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAC7C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { CalledMember } from './called-member.js';
2
+ import type { ProposedName } from './proposed-name.js';
3
+ /**
4
+ * Without type information, what a call on a repository answers by the convention of its names:
5
+ * the concept of `appointmentRepository`, one of it for a read of one element, several for a
6
+ * read that names what it selects. Undefined when the names say neither.
7
+ */
8
+ export declare function conventionalModelName(call: CalledMember, several: boolean): ProposedName | undefined;
9
+ //# sourceMappingURL=conventional-model-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conventional-model-name.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/conventional-model-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASvD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAYpG"}
@@ -0,0 +1,22 @@
1
+ import { repositoryConcept } from './repository-concept.js';
2
+ /** A read of one element: `findById`, `get`, `load`, `findOne`, `requireById`. */
3
+ const ONE = /^(?:find|get|load|require)(?:One)?(?:ById)?$/;
4
+ /** A read of several elements by the name of its method: `findDue`, `findAll`, `getByPractice`. */
5
+ const MANY = /^(?:find|get|load)[A-Z]/;
6
+ const OF_ONE = /(?:ById|One)$/;
7
+ /**
8
+ * Without type information, what a call on a repository answers by the convention of its names:
9
+ * the concept of `appointmentRepository`, one of it for a read of one element, several for a
10
+ * read that names what it selects. Undefined when the names say neither.
11
+ */
12
+ export function conventionalModelName(call, several) {
13
+ const concept = repositoryConcept(call.object);
14
+ if (concept === undefined) {
15
+ return undefined;
16
+ }
17
+ if (!several) {
18
+ return ONE.test(call.method) ? { element: concept, many: false } : undefined;
19
+ }
20
+ return MANY.test(call.method) && !OF_ONE.test(call.method) ? { element: concept, many: true } : undefined;
21
+ }
22
+ //# sourceMappingURL=conventional-model-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conventional-model-name.js","sourceRoot":"","sources":["../../../src/support/business-names/conventional-model-name.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,kFAAkF;AAClF,MAAM,GAAG,GAAG,8CAA8C,CAAC;AAC3D,mGAAmG;AACnG,MAAM,IAAI,GAAG,yBAAyB,CAAC;AACvC,MAAM,MAAM,GAAG,eAAe,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAkB,EAAE,OAAgB;IACxE,MAAM,OAAO,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE/C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5G,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Words that say a value is there without saying which concept it is. `naming/business-name`
3
+ * reports a binding named by one of them where the model speaks; the same list as the checker.
4
+ */
5
+ export declare const GENERIC_WORDS: readonly string[];
6
+ //# sourceMappingURL=generic-words.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-words.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/generic-words.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAmB1C,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Words that say a value is there without saying which concept it is. `naming/business-name`
3
+ * reports a binding named by one of them where the model speaks; the same list as the checker.
4
+ */
5
+ export const GENERIC_WORDS = [
6
+ 'target',
7
+ 'targets',
8
+ 'data',
9
+ 'item',
10
+ 'items',
11
+ 'obj',
12
+ 'object',
13
+ 'thing',
14
+ 'things',
15
+ 'stuff',
16
+ 'info',
17
+ 'element',
18
+ 'el',
19
+ 'tmp',
20
+ 'temp',
21
+ 'foo',
22
+ 'bar',
23
+ 'baz',
24
+ ];
25
+ //# sourceMappingURL=generic-words.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic-words.js","sourceRoot":"","sources":["../../../src/support/business-names/generic-words.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB;IAC9C,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { TSESLint } from '@typescript-eslint/utils';
2
+ type Variable = TSESLint.Scope.Variable;
3
+ /**
4
+ * Whether `variable` can be renamed `name` without changing what any name of the code means:
5
+ * no other variable of that name in its scope, none between a use and its declaration, and no
6
+ * use of that name inside its scope that reaches another variable or a global.
7
+ */
8
+ export declare function isNameFree(variable: Variable, name: string): boolean;
9
+ export {};
10
+ //# sourceMappingURL=is-name-free.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-name-free.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/is-name-free.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD,KAAK,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAUpE"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Whether `variable` can be renamed `name` without changing what any name of the code means:
3
+ * no other variable of that name in its scope, none between a use and its declaration, and no
4
+ * use of that name inside its scope that reaches another variable or a global.
5
+ */
6
+ export function isNameFree(variable, name) {
7
+ const { scope } = variable;
8
+ if (scope.set.has(name)) {
9
+ return false;
10
+ }
11
+ const shadowed = variable.references.some((reference) => declaresBetween(reference.from, scope, name));
12
+ return !shadowed && !usedInside(scope, name);
13
+ }
14
+ function declaresBetween(from, declaring, name) {
15
+ for (let current = from; current !== null && current !== declaring; current = current.upper) {
16
+ if (current.set.has(name)) {
17
+ return true;
18
+ }
19
+ }
20
+ return false;
21
+ }
22
+ function usedInside(scope, name) {
23
+ return (scope.references.some((reference) => reference.identifier.name === name) ||
24
+ scope.childScopes.some((child) => usedInside(child, name)));
25
+ }
26
+ //# sourceMappingURL=is-name-free.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-name-free.js","sourceRoot":"","sources":["../../../src/support/business-names/is-name-free.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,QAAkB,EAAE,IAAY;IACzD,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,CAAC;IAE3B,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAEvG,OAAO,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,eAAe,CAAC,IAAW,EAAE,SAAgB,EAAE,IAAY;IAClE,KAAK,IAAI,OAAO,GAAiB,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1G,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,KAAY,EAAE,IAAY;IAC5C,OAAO,CACL,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,KAAK,IAAI,CAAC;QACxE,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAC3D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { LintedFile } from '../../project/linted-file.js';
2
+ /**
3
+ * Where the language of the model lives: `domain/` and `application/` of a context, and the
4
+ * shared kernel outside its `presentation/`. Specs are not judged. Same table as the checker.
5
+ */
6
+ export declare function judgesNames(file: LintedFile): boolean;
7
+ //# sourceMappingURL=judges-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judges-names.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/judges-names.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAYrD"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Where the language of the model lives: `domain/` and `application/` of a context, and the
3
+ * shared kernel outside its `presentation/`. Specs are not judged. Same table as the checker.
4
+ */
5
+ export function judgesNames(file) {
6
+ if (file.isTest) {
7
+ return false;
8
+ }
9
+ if (file.location.area === 'context') {
10
+ return file.location.layer === 'domain' || file.location.layer === 'application';
11
+ }
12
+ return (file.location.area === 'shared-kernel' && !file.path.startsWith(`${file.config.sharedKernelDir}/presentation/`));
13
+ }
14
+ //# sourceMappingURL=judges-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"judges-names.js","sourceRoot":"","sources":["../../../src/support/business-names/judges-names.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAgB;IAC1C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,aAAa,CAAC;IACnF,CAAC;IAED,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,eAAe,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,gBAAgB,CAAC,CAChH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /** The names a binding target declares: itself, or every name of a destructuring at any depth, defaults and rests included. */
3
+ export declare function patternIdentifiers(target: TSESTree.Node): TSESTree.Identifier[];
4
+ //# sourceMappingURL=pattern-identifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern-identifiers.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/pattern-identifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzE,+HAA+H;AAC/H,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,UAAU,EAAE,CAmB/E"}
@@ -0,0 +1,21 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ /** The names a binding target declares: itself, or every name of a destructuring at any depth, defaults and rests included. */
3
+ export function patternIdentifiers(target) {
4
+ switch (target.type) {
5
+ case AST_NODE_TYPES.Identifier:
6
+ return [target];
7
+ case AST_NODE_TYPES.AssignmentPattern:
8
+ return patternIdentifiers(target.left);
9
+ case AST_NODE_TYPES.RestElement:
10
+ return patternIdentifiers(target.argument);
11
+ case AST_NODE_TYPES.ArrayPattern:
12
+ return target.elements.flatMap((element) => (element === null ? [] : patternIdentifiers(element)));
13
+ case AST_NODE_TYPES.ObjectPattern:
14
+ return target.properties.flatMap((property) => patternIdentifiers(property.type === AST_NODE_TYPES.Property ? property.value : property));
15
+ case AST_NODE_TYPES.TSParameterProperty:
16
+ return patternIdentifiers(target.parameter);
17
+ default:
18
+ return [];
19
+ }
20
+ }
21
+ //# sourceMappingURL=pattern-identifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern-identifiers.js","sourceRoot":"","sources":["../../../src/support/business-names/pattern-identifiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,+HAA+H;AAC/H,MAAM,UAAU,kBAAkB,CAAC,MAAqB;IACtD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,cAAc,CAAC,UAAU;YAC5B,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,KAAK,cAAc,CAAC,iBAAiB;YACnC,OAAO,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACzC,KAAK,cAAc,CAAC,WAAW;YAC7B,OAAO,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7C,KAAK,cAAc,CAAC,YAAY;YAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACrG,KAAK,cAAc,CAAC,aAAa;YAC/B,OAAO,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAC5C,kBAAkB,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAC1F,CAAC;QACJ,KAAK,cAAc,CAAC,mBAAmB;YACrC,OAAO,kBAAkB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9C;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The plural of an English word, as the generator writes it. */
2
+ export declare function plural(word: string): string;
3
+ //# sourceMappingURL=plural.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/plural.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3C"}
@@ -0,0 +1,8 @@
1
+ /** The plural of an English word, as the generator writes it. */
2
+ export function plural(word) {
3
+ if (/[^aeiou]y$/.test(word)) {
4
+ return `${word.slice(0, -1)}ies`;
5
+ }
6
+ return /(?:s|x|z|ch|sh)$/.test(word) ? `${word}es` : `${word}s`;
7
+ }
8
+ //# sourceMappingURL=plural.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural.js","sourceRoot":"","sources":["../../../src/support/business-names/plural.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC;IAED,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;AAClE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** The business concept a binding holds, by the camel name of one element, and whether it holds several of them. */
2
+ export interface ProposedName {
3
+ readonly element: string;
4
+ readonly many: boolean;
5
+ }
6
+ //# sourceMappingURL=proposed-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposed-name.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/proposed-name.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=proposed-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proposed-name.js","sourceRoot":"","sources":["../../../src/support/business-names/proposed-name.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { type TSESLint } from '@typescript-eslint/utils';
2
+ /**
3
+ * Renames a variable where it is declared and wherever it is used, its type annotation kept. A
4
+ * shorthand property keeps its key (`{ target }` becomes `{ target: appointment }`). Undefined
5
+ * for an exported variable, whose name other files read.
6
+ */
7
+ export declare function renameFix(variable: TSESLint.Scope.Variable, name: string): TSESLint.ReportFixFunction | undefined;
8
+ //# sourceMappingURL=rename-fix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-fix.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/rename-fix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAiB,MAAM,0BAA0B,CAAC;AAExF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,iBAAiB,GAAG,SAAS,CAYjH"}
@@ -0,0 +1,26 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ /**
3
+ * Renames a variable where it is declared and wherever it is used, its type annotation kept. A
4
+ * shorthand property keeps its key (`{ target }` becomes `{ target: appointment }`). Undefined
5
+ * for an exported variable, whose name other files read.
6
+ */
7
+ export function renameFix(variable, name) {
8
+ const uses = variable.references.map((reference) => reference.identifier);
9
+ if (uses.some((identifier) => identifier.parent.type === AST_NODE_TYPES.ExportSpecifier) || isExported(variable)) {
10
+ return undefined;
11
+ }
12
+ const identifiers = [...variable.identifiers, ...uses].filter((identifier, index, all) => all.findIndex((other) => other.range[0] === identifier.range[0]) === index);
13
+ return (fixer) => identifiers.map((identifier) => renamed(fixer, identifier, name));
14
+ }
15
+ function renamed(fixer, identifier, name) {
16
+ const { parent } = identifier;
17
+ const own = identifier.name;
18
+ if (parent.type === AST_NODE_TYPES.Property && parent.shorthand && parent.value === identifier) {
19
+ return fixer.replaceText(parent, `${own}: ${name}`);
20
+ }
21
+ return fixer.replaceTextRange([identifier.range[0], identifier.range[0] + own.length], name);
22
+ }
23
+ function isExported(variable) {
24
+ return variable.defs.some((definition) => definition.parent?.parent.type === AST_NODE_TYPES.ExportNamedDeclaration);
25
+ }
26
+ //# sourceMappingURL=rename-fix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename-fix.js","sourceRoot":"","sources":["../../../src/support/business-names/rename-fix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgC,MAAM,0BAA0B,CAAC;AAExF;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,QAAiC,EAAE,IAAY;IACvE,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAE1E,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACjH,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,CAAC,GAAG,QAAQ,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,CAC3D,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CACvG,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,SAAS,OAAO,CACd,KAAyB,EACzB,UAAwD,EACxD,IAAY;IAEZ,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9B,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC;IAE5B,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QAC/F,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,KAAK,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,UAAU,CAAC,QAAiC;IACnD,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,sBAAsB,CAAC,CAAC;AACtH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type TSESTree } from '@typescript-eslint/utils';
2
+ /** `appointment` for `this.appointmentRepository` or `appointmentRepository`: a repository named by the convention of the kit. */
3
+ export declare function repositoryConcept(object: TSESTree.Expression): string | undefined;
4
+ //# sourceMappingURL=repository-concept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-concept.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/repository-concept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAIzE,kIAAkI;AAClI,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,GAAG,SAAS,CAOjF"}
@@ -0,0 +1,10 @@
1
+ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
2
+ const REPOSITORY = /^([a-z][\w$]*)Repository$/;
3
+ /** `appointment` for `this.appointmentRepository` or `appointmentRepository`: a repository named by the convention of the kit. */
4
+ export function repositoryConcept(object) {
5
+ const holder = object.type === AST_NODE_TYPES.MemberExpression && object.object.type === AST_NODE_TYPES.ThisExpression
6
+ ? object.property
7
+ : object;
8
+ return holder.type === AST_NODE_TYPES.Identifier ? REPOSITORY.exec(holder.name)?.[1] : undefined;
9
+ }
10
+ //# sourceMappingURL=repository-concept.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository-concept.js","sourceRoot":"","sources":["../../../src/support/business-names/repository-concept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AAEzE,MAAM,UAAU,GAAG,2BAA2B,CAAC;AAE/C,kIAAkI;AAClI,MAAM,UAAU,iBAAiB,CAAC,MAA2B;IAC3D,MAAM,MAAM,GACV,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,gBAAgB,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,cAAc;QACrG,CAAC,CAAC,MAAM,CAAC,QAAQ;QACjB,CAAC,CAAC,MAAM,CAAC;IAEb,OAAO,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnG,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The singular of a plural English word (`reminders`, `deliveries`, `boxes`), or undefined when it does not read as one. */
2
+ export declare function singular(word: string): string | undefined;
3
+ //# sourceMappingURL=singular.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singular.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/singular.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUzD"}
@@ -0,0 +1,11 @@
1
+ /** The singular of a plural English word (`reminders`, `deliveries`, `boxes`), or undefined when it does not read as one. */
2
+ export function singular(word) {
3
+ if (/[^aeiou]ies$/.test(word)) {
4
+ return `${word.slice(0, -3)}y`;
5
+ }
6
+ if (/(?:ss|x|z|ch|sh)es$/.test(word)) {
7
+ return word.slice(0, -2);
8
+ }
9
+ return /[^su]s$/.test(word) ? word.slice(0, -1) : undefined;
10
+ }
11
+ //# sourceMappingURL=singular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singular.js","sourceRoot":"","sources":["../../../src/support/business-names/singular.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACjC,CAAC;IAED,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type TSESLint, type TSESTree } from '@typescript-eslint/utils';
2
+ import type { LintedFile } from '../../project/linted-file.js';
3
+ import type { ProposedName } from './proposed-name.js';
4
+ /** What the type checker tells of the project: which concept of the model an expression holds, and whether it is a repository. */
5
+ export interface TypedNames {
6
+ /** An aggregate, an entity or a value object of the project, or a list of them, once awaited and without `undefined`. */
7
+ modelOf(node: TSESTree.Node): ProposedName | undefined;
8
+ /** An instance of a repository port of `domain/repositories/`. */
9
+ isRepository(node: TSESTree.Node): boolean;
10
+ }
11
+ /** Undefined when the parser was given no program: the rule then reads the names of the code. */
12
+ export declare function typedNames(context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>, file: LintedFile): TypedNames | undefined;
13
+ //# sourceMappingURL=typed-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-names.d.ts","sourceRoot":"","sources":["../../../src/support/business-names/typed-names.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,kIAAkI;AAClI,MAAM,WAAW,UAAU;IACzB,yHAAyH;IACzH,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,YAAY,GAAG,SAAS,CAAC;IACvD,kEAAkE;IAClE,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC;CAC5C;AAUD,iGAAiG;AACjG,wBAAgB,UAAU,CACxB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,CAAC,EACnE,IAAI,EAAE,UAAU,GACf,UAAU,GAAG,SAAS,CAsCxB"}
@@ -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"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.16.0";
1
+ export declare const VERSION = "0.17.0";
2
2
  //# sourceMappingURL=version.d.ts.map