@memberjunction/react-linter 0.0.1 → 5.38.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 (330) hide show
  1. package/dist/component-linter.d.ts +77 -0
  2. package/dist/component-linter.d.ts.map +1 -0
  3. package/dist/component-linter.js +1206 -0
  4. package/dist/component-linter.js.map +1 -0
  5. package/dist/control-flow-analyzer.d.ts +184 -0
  6. package/dist/control-flow-analyzer.d.ts.map +1 -0
  7. package/dist/control-flow-analyzer.js +798 -0
  8. package/dist/control-flow-analyzer.js.map +1 -0
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +8 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/library-lint-cache.d.ts +50 -0
  14. package/dist/library-lint-cache.d.ts.map +1 -0
  15. package/dist/library-lint-cache.js +173 -0
  16. package/dist/library-lint-cache.js.map +1 -0
  17. package/dist/lint-rule.d.ts +70 -0
  18. package/dist/lint-rule.d.ts.map +1 -0
  19. package/dist/lint-rule.js +30 -0
  20. package/dist/lint-rule.js.map +1 -0
  21. package/dist/lint-utils.d.ts +131 -0
  22. package/dist/lint-utils.d.ts.map +1 -0
  23. package/dist/lint-utils.js +358 -0
  24. package/dist/lint-utils.js.map +1 -0
  25. package/dist/linter-options.d.ts +51 -0
  26. package/dist/linter-options.d.ts.map +1 -0
  27. package/dist/linter-options.js +2 -0
  28. package/dist/linter-options.js.map +1 -0
  29. package/dist/prop-value-extractor.d.ts +147 -0
  30. package/dist/prop-value-extractor.d.ts.map +1 -0
  31. package/dist/prop-value-extractor.js +472 -0
  32. package/dist/prop-value-extractor.js.map +1 -0
  33. package/dist/runtime-rules/ai-tools-availability-check.d.ts +9 -0
  34. package/dist/runtime-rules/ai-tools-availability-check.d.ts.map +1 -0
  35. package/dist/runtime-rules/ai-tools-availability-check.js +223 -0
  36. package/dist/runtime-rules/ai-tools-availability-check.js.map +1 -0
  37. package/dist/runtime-rules/callback-event-validation.d.ts +22 -0
  38. package/dist/runtime-rules/callback-event-validation.d.ts.map +1 -0
  39. package/dist/runtime-rules/callback-event-validation.js +561 -0
  40. package/dist/runtime-rules/callback-event-validation.js.map +1 -0
  41. package/dist/runtime-rules/chart-field-validation.d.ts +10 -0
  42. package/dist/runtime-rules/chart-field-validation.d.ts.map +1 -0
  43. package/dist/runtime-rules/chart-field-validation.js +270 -0
  44. package/dist/runtime-rules/chart-field-validation.js.map +1 -0
  45. package/dist/runtime-rules/child-component-prop-validation.d.ts +11 -0
  46. package/dist/runtime-rules/child-component-prop-validation.d.ts.map +1 -0
  47. package/dist/runtime-rules/child-component-prop-validation.js +443 -0
  48. package/dist/runtime-rules/child-component-prop-validation.js.map +1 -0
  49. package/dist/runtime-rules/component-name-mismatch.d.ts +19 -0
  50. package/dist/runtime-rules/component-name-mismatch.d.ts.map +1 -0
  51. package/dist/runtime-rules/component-name-mismatch.js +82 -0
  52. package/dist/runtime-rules/component-name-mismatch.js.map +1 -0
  53. package/dist/runtime-rules/component-not-in-dependencies.d.ts +20 -0
  54. package/dist/runtime-rules/component-not-in-dependencies.d.ts.map +1 -0
  55. package/dist/runtime-rules/component-not-in-dependencies.js +92 -0
  56. package/dist/runtime-rules/component-not-in-dependencies.js.map +1 -0
  57. package/dist/runtime-rules/component-props-validation.d.ts +25 -0
  58. package/dist/runtime-rules/component-props-validation.d.ts.map +1 -0
  59. package/dist/runtime-rules/component-props-validation.js +228 -0
  60. package/dist/runtime-rules/component-props-validation.js.map +1 -0
  61. package/dist/runtime-rules/component-usage-without-destructuring.d.ts +20 -0
  62. package/dist/runtime-rules/component-usage-without-destructuring.d.ts.map +1 -0
  63. package/dist/runtime-rules/component-usage-without-destructuring.js +124 -0
  64. package/dist/runtime-rules/component-usage-without-destructuring.js.map +1 -0
  65. package/dist/runtime-rules/data-result-validation.d.ts +9 -0
  66. package/dist/runtime-rules/data-result-validation.d.ts.map +1 -0
  67. package/dist/runtime-rules/data-result-validation.js +763 -0
  68. package/dist/runtime-rules/data-result-validation.js.map +1 -0
  69. package/dist/runtime-rules/datagrid-field-validation.d.ts +10 -0
  70. package/dist/runtime-rules/datagrid-field-validation.d.ts.map +1 -0
  71. package/dist/runtime-rules/datagrid-field-validation.js +249 -0
  72. package/dist/runtime-rules/datagrid-field-validation.js.map +1 -0
  73. package/dist/runtime-rules/dependency-shadowing.d.ts +20 -0
  74. package/dist/runtime-rules/dependency-shadowing.d.ts.map +1 -0
  75. package/dist/runtime-rules/dependency-shadowing.js +147 -0
  76. package/dist/runtime-rules/dependency-shadowing.js.map +1 -0
  77. package/dist/runtime-rules/entity-field-access-validation.d.ts +12 -0
  78. package/dist/runtime-rules/entity-field-access-validation.d.ts.map +1 -0
  79. package/dist/runtime-rules/entity-field-access-validation.js +304 -0
  80. package/dist/runtime-rules/entity-field-access-validation.js.map +1 -0
  81. package/dist/runtime-rules/event-parameter-validation.d.ts +22 -0
  82. package/dist/runtime-rules/event-parameter-validation.d.ts.map +1 -0
  83. package/dist/runtime-rules/event-parameter-validation.js +406 -0
  84. package/dist/runtime-rules/event-parameter-validation.js.map +1 -0
  85. package/dist/runtime-rules/index.d.ts +61 -0
  86. package/dist/runtime-rules/index.d.ts.map +1 -0
  87. package/dist/runtime-rules/index.js +62 -0
  88. package/dist/runtime-rules/index.js.map +1 -0
  89. package/dist/runtime-rules/library-variable-names.d.ts +24 -0
  90. package/dist/runtime-rules/library-variable-names.d.ts.map +1 -0
  91. package/dist/runtime-rules/library-variable-names.js +88 -0
  92. package/dist/runtime-rules/library-variable-names.js.map +1 -0
  93. package/dist/runtime-rules/no-child-implementation.d.ts +18 -0
  94. package/dist/runtime-rules/no-child-implementation.d.ts.map +1 -0
  95. package/dist/runtime-rules/no-child-implementation.js +57 -0
  96. package/dist/runtime-rules/no-child-implementation.js.map +1 -0
  97. package/dist/runtime-rules/no-data-prop.d.ts +22 -0
  98. package/dist/runtime-rules/no-data-prop.d.ts.map +1 -0
  99. package/dist/runtime-rules/no-data-prop.js +111 -0
  100. package/dist/runtime-rules/no-data-prop.js.map +1 -0
  101. package/dist/runtime-rules/no-export-statements.d.ts +18 -0
  102. package/dist/runtime-rules/no-export-statements.d.ts.map +1 -0
  103. package/dist/runtime-rules/no-export-statements.js +143 -0
  104. package/dist/runtime-rules/no-export-statements.js.map +1 -0
  105. package/dist/runtime-rules/no-iife-wrapper.d.ts +18 -0
  106. package/dist/runtime-rules/no-iife-wrapper.d.ts.map +1 -0
  107. package/dist/runtime-rules/no-iife-wrapper.js +217 -0
  108. package/dist/runtime-rules/no-iife-wrapper.js.map +1 -0
  109. package/dist/runtime-rules/no-import-statements.d.ts +18 -0
  110. package/dist/runtime-rules/no-import-statements.d.ts.map +1 -0
  111. package/dist/runtime-rules/no-import-statements.js +65 -0
  112. package/dist/runtime-rules/no-import-statements.js.map +1 -0
  113. package/dist/runtime-rules/no-react-destructuring.d.ts +18 -0
  114. package/dist/runtime-rules/no-react-destructuring.d.ts.map +1 -0
  115. package/dist/runtime-rules/no-react-destructuring.js +60 -0
  116. package/dist/runtime-rules/no-react-destructuring.js.map +1 -0
  117. package/dist/runtime-rules/no-require-statements.d.ts +18 -0
  118. package/dist/runtime-rules/no-require-statements.d.ts.map +1 -0
  119. package/dist/runtime-rules/no-require-statements.js +109 -0
  120. package/dist/runtime-rules/no-require-statements.js.map +1 -0
  121. package/dist/runtime-rules/no-return-component.d.ts +18 -0
  122. package/dist/runtime-rules/no-return-component.d.ts.map +1 -0
  123. package/dist/runtime-rules/no-return-component.js +106 -0
  124. package/dist/runtime-rules/no-return-component.js.map +1 -0
  125. package/dist/runtime-rules/no-unwrap-utility-libs.d.ts +20 -0
  126. package/dist/runtime-rules/no-unwrap-utility-libs.d.ts.map +1 -0
  127. package/dist/runtime-rules/no-unwrap-utility-libs.js +75 -0
  128. package/dist/runtime-rules/no-unwrap-utility-libs.js.map +1 -0
  129. package/dist/runtime-rules/no-use-reducer.d.ts +19 -0
  130. package/dist/runtime-rules/no-use-reducer.d.ts.map +1 -0
  131. package/dist/runtime-rules/no-use-reducer.js +78 -0
  132. package/dist/runtime-rules/no-use-reducer.js.map +1 -0
  133. package/dist/runtime-rules/no-window-access.d.ts +23 -0
  134. package/dist/runtime-rules/no-window-access.d.ts.map +1 -0
  135. package/dist/runtime-rules/no-window-access.js +136 -0
  136. package/dist/runtime-rules/no-window-access.js.map +1 -0
  137. package/dist/runtime-rules/noisy-settings-updates.d.ts +18 -0
  138. package/dist/runtime-rules/noisy-settings-updates.d.ts.map +1 -0
  139. package/dist/runtime-rules/noisy-settings-updates.js +110 -0
  140. package/dist/runtime-rules/noisy-settings-updates.js.map +1 -0
  141. package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts +30 -0
  142. package/dist/runtime-rules/overflow-hidden-on-layout-container.d.ts.map +1 -0
  143. package/dist/runtime-rules/overflow-hidden-on-layout-container.js +220 -0
  144. package/dist/runtime-rules/overflow-hidden-on-layout-container.js.map +1 -0
  145. package/dist/runtime-rules/pass-standard-props.d.ts +19 -0
  146. package/dist/runtime-rules/pass-standard-props.d.ts.map +1 -0
  147. package/dist/runtime-rules/pass-standard-props.js +82 -0
  148. package/dist/runtime-rules/pass-standard-props.js.map +1 -0
  149. package/dist/runtime-rules/prefer-async-await.d.ts +17 -0
  150. package/dist/runtime-rules/prefer-async-await.d.ts.map +1 -0
  151. package/dist/runtime-rules/prefer-async-await.js +52 -0
  152. package/dist/runtime-rules/prefer-async-await.js.map +1 -0
  153. package/dist/runtime-rules/prefer-jsx-syntax.d.ts +17 -0
  154. package/dist/runtime-rules/prefer-jsx-syntax.d.ts.map +1 -0
  155. package/dist/runtime-rules/prefer-jsx-syntax.js +51 -0
  156. package/dist/runtime-rules/prefer-jsx-syntax.js.map +1 -0
  157. package/dist/runtime-rules/prop-state-sync.d.ts +19 -0
  158. package/dist/runtime-rules/prop-state-sync.d.ts.map +1 -0
  159. package/dist/runtime-rules/prop-state-sync.js +76 -0
  160. package/dist/runtime-rules/prop-state-sync.js.map +1 -0
  161. package/dist/runtime-rules/property-name-consistency.d.ts +20 -0
  162. package/dist/runtime-rules/property-name-consistency.d.ts.map +1 -0
  163. package/dist/runtime-rules/property-name-consistency.js +172 -0
  164. package/dist/runtime-rules/property-name-consistency.js.map +1 -0
  165. package/dist/runtime-rules/query-result-field-access-validation.d.ts +10 -0
  166. package/dist/runtime-rules/query-result-field-access-validation.d.ts.map +1 -0
  167. package/dist/runtime-rules/query-result-field-access-validation.js +304 -0
  168. package/dist/runtime-rules/query-result-field-access-validation.js.map +1 -0
  169. package/dist/runtime-rules/react-component-naming.d.ts +19 -0
  170. package/dist/runtime-rules/react-component-naming.d.ts.map +1 -0
  171. package/dist/runtime-rules/react-component-naming.js +72 -0
  172. package/dist/runtime-rules/react-component-naming.js.map +1 -0
  173. package/dist/runtime-rules/react-hooks-rules.d.ts +27 -0
  174. package/dist/runtime-rules/react-hooks-rules.d.ts.map +1 -0
  175. package/dist/runtime-rules/react-hooks-rules.js +223 -0
  176. package/dist/runtime-rules/react-hooks-rules.js.map +1 -0
  177. package/dist/runtime-rules/required-queries-not-called.d.ts +19 -0
  178. package/dist/runtime-rules/required-queries-not-called.d.ts.map +1 -0
  179. package/dist/runtime-rules/required-queries-not-called.js +146 -0
  180. package/dist/runtime-rules/required-queries-not-called.js.map +1 -0
  181. package/dist/runtime-rules/runquery-call-validation.d.ts +11 -0
  182. package/dist/runtime-rules/runquery-call-validation.d.ts.map +1 -0
  183. package/dist/runtime-rules/runquery-call-validation.js +886 -0
  184. package/dist/runtime-rules/runquery-call-validation.js.map +1 -0
  185. package/dist/runtime-rules/runview-call-validation.d.ts +10 -0
  186. package/dist/runtime-rules/runview-call-validation.d.ts.map +1 -0
  187. package/dist/runtime-rules/runview-call-validation.js +336 -0
  188. package/dist/runtime-rules/runview-call-validation.js.map +1 -0
  189. package/dist/runtime-rules/saved-user-settings-pattern.d.ts +19 -0
  190. package/dist/runtime-rules/saved-user-settings-pattern.d.ts.map +1 -0
  191. package/dist/runtime-rules/saved-user-settings-pattern.js +90 -0
  192. package/dist/runtime-rules/saved-user-settings-pattern.js.map +1 -0
  193. package/dist/runtime-rules/search-availability-check.d.ts +9 -0
  194. package/dist/runtime-rules/search-availability-check.d.ts.map +1 -0
  195. package/dist/runtime-rules/search-availability-check.js +220 -0
  196. package/dist/runtime-rules/search-availability-check.js.map +1 -0
  197. package/dist/runtime-rules/search-call-validation.d.ts +9 -0
  198. package/dist/runtime-rules/search-call-validation.d.ts.map +1 -0
  199. package/dist/runtime-rules/search-call-validation.js +336 -0
  200. package/dist/runtime-rules/search-call-validation.js.map +1 -0
  201. package/dist/runtime-rules/server-reload-on-client-operation.d.ts +18 -0
  202. package/dist/runtime-rules/server-reload-on-client-operation.d.ts.map +1 -0
  203. package/dist/runtime-rules/server-reload-on-client-operation.js +107 -0
  204. package/dist/runtime-rules/server-reload-on-client-operation.js.map +1 -0
  205. package/dist/runtime-rules/single-function-only.d.ts +18 -0
  206. package/dist/runtime-rules/single-function-only.d.ts.map +1 -0
  207. package/dist/runtime-rules/single-function-only.js +103 -0
  208. package/dist/runtime-rules/single-function-only.js.map +1 -0
  209. package/dist/runtime-rules/string-replace-all-occurrences.d.ts +19 -0
  210. package/dist/runtime-rules/string-replace-all-occurrences.d.ts.map +1 -0
  211. package/dist/runtime-rules/string-replace-all-occurrences.js +109 -0
  212. package/dist/runtime-rules/string-replace-all-occurrences.js.map +1 -0
  213. package/dist/runtime-rules/string-template-validation.d.ts +22 -0
  214. package/dist/runtime-rules/string-template-validation.d.ts.map +1 -0
  215. package/dist/runtime-rules/string-template-validation.js +163 -0
  216. package/dist/runtime-rules/string-template-validation.js.map +1 -0
  217. package/dist/runtime-rules/styles-validation.d.ts +10 -0
  218. package/dist/runtime-rules/styles-validation.d.ts.map +1 -0
  219. package/dist/runtime-rules/styles-validation.js +153 -0
  220. package/dist/runtime-rules/styles-validation.js.map +1 -0
  221. package/dist/runtime-rules/type-inference-errors.d.ts +23 -0
  222. package/dist/runtime-rules/type-inference-errors.d.ts.map +1 -0
  223. package/dist/runtime-rules/type-inference-errors.js +53 -0
  224. package/dist/runtime-rules/type-inference-errors.js.map +1 -0
  225. package/dist/runtime-rules/type-mismatch-operation.d.ts +23 -0
  226. package/dist/runtime-rules/type-mismatch-operation.d.ts.map +1 -0
  227. package/dist/runtime-rules/type-mismatch-operation.js +145 -0
  228. package/dist/runtime-rules/type-mismatch-operation.js.map +1 -0
  229. package/dist/runtime-rules/undefined-component-usage.d.ts +20 -0
  230. package/dist/runtime-rules/undefined-component-usage.d.ts.map +1 -0
  231. package/dist/runtime-rules/undefined-component-usage.js +138 -0
  232. package/dist/runtime-rules/undefined-component-usage.js.map +1 -0
  233. package/dist/runtime-rules/undefined-jsx-component.d.ts +25 -0
  234. package/dist/runtime-rules/undefined-jsx-component.d.ts.map +1 -0
  235. package/dist/runtime-rules/undefined-jsx-component.js +269 -0
  236. package/dist/runtime-rules/undefined-jsx-component.js.map +1 -0
  237. package/dist/runtime-rules/unsafe-array-operations.d.ts +25 -0
  238. package/dist/runtime-rules/unsafe-array-operations.d.ts.map +1 -0
  239. package/dist/runtime-rules/unsafe-array-operations.js +347 -0
  240. package/dist/runtime-rules/unsafe-array-operations.js.map +1 -0
  241. package/dist/runtime-rules/unsafe-formatting-methods.d.ts +24 -0
  242. package/dist/runtime-rules/unsafe-formatting-methods.d.ts.map +1 -0
  243. package/dist/runtime-rules/unsafe-formatting-methods.js +277 -0
  244. package/dist/runtime-rules/unsafe-formatting-methods.js.map +1 -0
  245. package/dist/runtime-rules/unused-component-dependencies.d.ts +19 -0
  246. package/dist/runtime-rules/unused-component-dependencies.d.ts.map +1 -0
  247. package/dist/runtime-rules/unused-component-dependencies.js +90 -0
  248. package/dist/runtime-rules/unused-component-dependencies.js.map +1 -0
  249. package/dist/runtime-rules/unused-libraries.d.ts +19 -0
  250. package/dist/runtime-rules/unused-libraries.d.ts.map +1 -0
  251. package/dist/runtime-rules/unused-libraries.js +127 -0
  252. package/dist/runtime-rules/unused-libraries.js.map +1 -0
  253. package/dist/runtime-rules/use-function-declaration.d.ts +18 -0
  254. package/dist/runtime-rules/use-function-declaration.d.ts.map +1 -0
  255. package/dist/runtime-rules/use-function-declaration.js +127 -0
  256. package/dist/runtime-rules/use-function-declaration.js.map +1 -0
  257. package/dist/runtime-rules/use-unwrap-components.d.ts +19 -0
  258. package/dist/runtime-rules/use-unwrap-components.d.ts.map +1 -0
  259. package/dist/runtime-rules/use-unwrap-components.js +84 -0
  260. package/dist/runtime-rules/use-unwrap-components.js.map +1 -0
  261. package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts +23 -0
  262. package/dist/runtime-rules/useeffect-unstable-dependencies.d.ts.map +1 -0
  263. package/dist/runtime-rules/useeffect-unstable-dependencies.js +215 -0
  264. package/dist/runtime-rules/useeffect-unstable-dependencies.js.map +1 -0
  265. package/dist/runtime-rules/utilities-api-validation.d.ts +24 -0
  266. package/dist/runtime-rules/utilities-api-validation.d.ts.map +1 -0
  267. package/dist/runtime-rules/utilities-api-validation.js +121 -0
  268. package/dist/runtime-rules/utilities-api-validation.js.map +1 -0
  269. package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts +20 -0
  270. package/dist/runtime-rules/utilities-no-direct-instantiation.d.ts.map +1 -0
  271. package/dist/runtime-rules/utilities-no-direct-instantiation.js +58 -0
  272. package/dist/runtime-rules/utilities-no-direct-instantiation.js.map +1 -0
  273. package/dist/runtime-rules/validate-component-references.d.ts +19 -0
  274. package/dist/runtime-rules/validate-component-references.d.ts.map +1 -0
  275. package/dist/runtime-rules/validate-component-references.js +255 -0
  276. package/dist/runtime-rules/validate-component-references.js.map +1 -0
  277. package/dist/schema-validation/component-prop-rule.d.ts +131 -0
  278. package/dist/schema-validation/component-prop-rule.d.ts.map +1 -0
  279. package/dist/schema-validation/component-prop-rule.js +625 -0
  280. package/dist/schema-validation/component-prop-rule.js.map +1 -0
  281. package/dist/schema-validation/index.d.ts +26 -0
  282. package/dist/schema-validation/index.d.ts.map +1 -0
  283. package/dist/schema-validation/index.js +26 -0
  284. package/dist/schema-validation/index.js.map +1 -0
  285. package/dist/schema-validation/semantic-validators/index.d.ts +23 -0
  286. package/dist/schema-validation/semantic-validators/index.d.ts.map +1 -0
  287. package/dist/schema-validation/semantic-validators/index.js +23 -0
  288. package/dist/schema-validation/semantic-validators/index.js.map +1 -0
  289. package/dist/schema-validation/semantic-validators/required-when-validator.d.ts +43 -0
  290. package/dist/schema-validation/semantic-validators/required-when-validator.d.ts.map +1 -0
  291. package/dist/schema-validation/semantic-validators/required-when-validator.js +94 -0
  292. package/dist/schema-validation/semantic-validators/required-when-validator.js.map +1 -0
  293. package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts +122 -0
  294. package/dist/schema-validation/semantic-validators/semantic-validator-registry.d.ts.map +1 -0
  295. package/dist/schema-validation/semantic-validators/semantic-validator-registry.js +166 -0
  296. package/dist/schema-validation/semantic-validators/semantic-validator-registry.js.map +1 -0
  297. package/dist/schema-validation/semantic-validators/semantic-validator.d.ts +260 -0
  298. package/dist/schema-validation/semantic-validators/semantic-validator.d.ts.map +1 -0
  299. package/dist/schema-validation/semantic-validators/semantic-validator.js +301 -0
  300. package/dist/schema-validation/semantic-validators/semantic-validator.js.map +1 -0
  301. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts +115 -0
  302. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.d.ts.map +1 -0
  303. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js +381 -0
  304. package/dist/schema-validation/semantic-validators/sql-where-clause-validator.js.map +1 -0
  305. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts +60 -0
  306. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.d.ts.map +1 -0
  307. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js +195 -0
  308. package/dist/schema-validation/semantic-validators/subset-of-entity-fields-validator.js.map +1 -0
  309. package/dist/schema-validation/semantic-validators/validation-context.d.ts +335 -0
  310. package/dist/schema-validation/semantic-validators/validation-context.d.ts.map +1 -0
  311. package/dist/schema-validation/semantic-validators/validation-context.js +13 -0
  312. package/dist/schema-validation/semantic-validators/validation-context.js.map +1 -0
  313. package/dist/styles-type-analyzer.d.ts +64 -0
  314. package/dist/styles-type-analyzer.d.ts.map +1 -0
  315. package/dist/styles-type-analyzer.js +242 -0
  316. package/dist/styles-type-analyzer.js.map +1 -0
  317. package/dist/type-context.d.ts +184 -0
  318. package/dist/type-context.d.ts.map +1 -0
  319. package/dist/type-context.js +415 -0
  320. package/dist/type-context.js.map +1 -0
  321. package/dist/type-inference-engine.d.ts +181 -0
  322. package/dist/type-inference-engine.d.ts.map +1 -0
  323. package/dist/type-inference-engine.js +1151 -0
  324. package/dist/type-inference-engine.js.map +1 -0
  325. package/dist/type-rules/type-compatibility-rule.d.ts +85 -0
  326. package/dist/type-rules/type-compatibility-rule.d.ts.map +1 -0
  327. package/dist/type-rules/type-compatibility-rule.js +211 -0
  328. package/dist/type-rules/type-compatibility-rule.js.map +1 -0
  329. package/package.json +35 -7
  330. package/README.md +0 -45
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Schema Validation Module
3
+ *
4
+ * This module provides comprehensive schema validation for interactive components,
5
+ * including semantic validation of prop values against business rules and constraints.
6
+ *
7
+ * Key Components:
8
+ * - **Semantic Validators**: Check business rules beyond type safety
9
+ * (e.g., field names exist on entities, SQL clauses are valid)
10
+ * - **Validation Context**: Provides access to component spec, entities, queries
11
+ * - **Validator Registry**: Plugin system for registering custom validators
12
+ *
13
+ * Usage:
14
+ * ```typescript
15
+ * import { SemanticValidator, ValidationContext } from './schema-validation';
16
+ *
17
+ * // Get a validator from the registry
18
+ * const registry = SemanticValidatorRegistry.getInstance();
19
+ * const validator = registry.get('subset-of-entity-fields');
20
+ *
21
+ * // Run validation
22
+ * const violations = validator.validate(context, constraint);
23
+ * ```
24
+ */
25
+ export * from './semantic-validators/index.js';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema-validation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Schema Validation Module
3
+ *
4
+ * This module provides comprehensive schema validation for interactive components,
5
+ * including semantic validation of prop values against business rules and constraints.
6
+ *
7
+ * Key Components:
8
+ * - **Semantic Validators**: Check business rules beyond type safety
9
+ * (e.g., field names exist on entities, SQL clauses are valid)
10
+ * - **Validation Context**: Provides access to component spec, entities, queries
11
+ * - **Validator Registry**: Plugin system for registering custom validators
12
+ *
13
+ * Usage:
14
+ * ```typescript
15
+ * import { SemanticValidator, ValidationContext } from './schema-validation';
16
+ *
17
+ * // Get a validator from the registry
18
+ * const registry = SemanticValidatorRegistry.getInstance();
19
+ * const validator = registry.get('subset-of-entity-fields');
20
+ *
21
+ * // Run validation
22
+ * const violations = validator.validate(context, constraint);
23
+ * ```
24
+ */
25
+ export * from './semantic-validators/index.js';
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema-validation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Semantic Validators Module
3
+ *
4
+ * This module provides the infrastructure for semantic validation of component props.
5
+ * Semantic validators check business rules and constraints beyond basic type checking,
6
+ * such as verifying field names exist on entities or SQL clauses reference valid columns.
7
+ *
8
+ * Validators use MemberJunction's @RegisterClass decorator for automatic discovery.
9
+ * Each validator is registered with SemanticValidator and its constraint type as the key.
10
+ *
11
+ * Key exports:
12
+ * - SemanticValidator: Abstract base class for all semantic validators
13
+ * - ValidationContext: Context passed to validators
14
+ * - Entity/Query metadata types
15
+ * - Concrete validator implementations (auto-registered via @RegisterClass)
16
+ */
17
+ export * from './semantic-validator.js';
18
+ export * from './semantic-validator-registry.js';
19
+ export * from './validation-context.js';
20
+ export * from './subset-of-entity-fields-validator.js';
21
+ export * from './sql-where-clause-validator.js';
22
+ export * from './required-when-validator.js';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Semantic Validators Module
3
+ *
4
+ * This module provides the infrastructure for semantic validation of component props.
5
+ * Semantic validators check business rules and constraints beyond basic type checking,
6
+ * such as verifying field names exist on entities or SQL clauses reference valid columns.
7
+ *
8
+ * Validators use MemberJunction's @RegisterClass decorator for automatic discovery.
9
+ * Each validator is registered with SemanticValidator and its constraint type as the key.
10
+ *
11
+ * Key exports:
12
+ * - SemanticValidator: Abstract base class for all semantic validators
13
+ * - ValidationContext: Context passed to validators
14
+ * - Entity/Query metadata types
15
+ * - Concrete validator implementations (auto-registered via @RegisterClass)
16
+ */
17
+ export * from './semantic-validator.js';
18
+ export * from './semantic-validator-registry.js';
19
+ export * from './validation-context.js';
20
+ export * from './subset-of-entity-fields-validator.js';
21
+ export * from './sql-where-clause-validator.js';
22
+ export * from './required-when-validator.js';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Required-When Constraint Validator
3
+ *
4
+ * Validates that a property is present when a specified condition is met.
5
+ * Used for conditional requirements like "valueField is required when aggregateMethod is 'sum'".
6
+ *
7
+ * Config:
8
+ * - condition: JavaScript expression evaluated with siblingProp as the dependent property value
9
+ * Example: "siblingProp === 'sum' || siblingProp === 'average'"
10
+ *
11
+ * Example usage in spec JSON:
12
+ * ```json
13
+ * {
14
+ * "type": "required-when",
15
+ * "dependsOn": "aggregateMethod",
16
+ * "config": {
17
+ * "condition": "siblingProp === 'sum' || siblingProp === 'average' || siblingProp === 'min' || siblingProp === 'max'"
18
+ * },
19
+ * "errorTemplate": "valueField is required when aggregateMethod is '{aggregateMethod}'"
20
+ * }
21
+ * ```
22
+ */
23
+ import { PropertyConstraint, ConstraintViolation } from '@memberjunction/interactive-component-types';
24
+ import { SemanticValidator } from './semantic-validator.js';
25
+ import { ValidationContext } from './validation-context.js';
26
+ export declare class RequiredWhenValidator extends SemanticValidator {
27
+ /**
28
+ * Get description of this validator
29
+ */
30
+ getDescription(): string;
31
+ /**
32
+ * Validate that a property is present when a condition is met
33
+ *
34
+ * Evaluates a JavaScript condition expression with the dependent property value,
35
+ * and checks if the current property has a value when the condition is true.
36
+ *
37
+ * @param context - Validation context containing property info and sibling props
38
+ * @param constraint - The constraint definition from the spec
39
+ * @returns Array of violations (empty if valid)
40
+ */
41
+ validate(context: ValidationContext, constraint: PropertyConstraint): ConstraintViolation[];
42
+ }
43
+ //# sourceMappingURL=required-when-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-when-validator.d.ts","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/required-when-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEtG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,qBACa,qBAAsB,SAAQ,iBAAiB;IAC1D;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,kBAAkB,GAAG,mBAAmB,EAAE;CAmD5F"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Required-When Constraint Validator
3
+ *
4
+ * Validates that a property is present when a specified condition is met.
5
+ * Used for conditional requirements like "valueField is required when aggregateMethod is 'sum'".
6
+ *
7
+ * Config:
8
+ * - condition: JavaScript expression evaluated with siblingProp as the dependent property value
9
+ * Example: "siblingProp === 'sum' || siblingProp === 'average'"
10
+ *
11
+ * Example usage in spec JSON:
12
+ * ```json
13
+ * {
14
+ * "type": "required-when",
15
+ * "dependsOn": "aggregateMethod",
16
+ * "config": {
17
+ * "condition": "siblingProp === 'sum' || siblingProp === 'average' || siblingProp === 'min' || siblingProp === 'max'"
18
+ * },
19
+ * "errorTemplate": "valueField is required when aggregateMethod is '{aggregateMethod}'"
20
+ * }
21
+ * ```
22
+ */
23
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
24
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
27
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
28
+ };
29
+ import { RegisterClass } from '@memberjunction/global';
30
+ import { SemanticValidator } from './semantic-validator.js';
31
+ let RequiredWhenValidator = class RequiredWhenValidator extends SemanticValidator {
32
+ /**
33
+ * Get description of this validator
34
+ */
35
+ getDescription() {
36
+ return 'Validates that a property is present when a specified condition is met based on another property value';
37
+ }
38
+ /**
39
+ * Validate that a property is present when a condition is met
40
+ *
41
+ * Evaluates a JavaScript condition expression with the dependent property value,
42
+ * and checks if the current property has a value when the condition is true.
43
+ *
44
+ * @param context - Validation context containing property info and sibling props
45
+ * @param constraint - The constraint definition from the spec
46
+ * @returns Array of violations (empty if valid)
47
+ */
48
+ validate(context, constraint) {
49
+ const violations = [];
50
+ if (!constraint.dependsOn) {
51
+ return violations; // Can't validate without a dependency
52
+ }
53
+ const dependentPropValue = context.siblingProps.get(constraint.dependsOn);
54
+ // If dependent prop doesn't exist, condition doesn't apply
55
+ if (dependentPropValue === undefined || dependentPropValue === null) {
56
+ return violations;
57
+ }
58
+ const condition = constraint.config?.condition;
59
+ if (!condition || typeof condition !== 'string') {
60
+ console.warn(`required-when validator missing condition config for ${context.propertyName}`);
61
+ return violations;
62
+ }
63
+ // Evaluate the condition
64
+ let conditionMet = false;
65
+ try {
66
+ // Create a safe evaluation context
67
+ const siblingProp = dependentPropValue;
68
+ // eslint-disable-next-line no-eval
69
+ conditionMet = eval(condition);
70
+ }
71
+ catch (error) {
72
+ console.error(`Error evaluating required-when condition "${condition}":`, error);
73
+ return violations;
74
+ }
75
+ // If condition is met, check if the property has a value
76
+ if (conditionMet) {
77
+ const hasValue = context.propertyValue !== undefined &&
78
+ context.propertyValue !== null &&
79
+ context.propertyValue !== '';
80
+ if (!hasValue) {
81
+ const message = constraint.errorTemplate
82
+ ? constraint.errorTemplate.replace(`{${constraint.dependsOn}}`, String(dependentPropValue))
83
+ : `${context.propertyName} is required when ${constraint.dependsOn} is ${dependentPropValue}`;
84
+ violations.push(this.createViolation('missing-required-prop', message, 'high'));
85
+ }
86
+ }
87
+ return violations;
88
+ }
89
+ };
90
+ RequiredWhenValidator = __decorate([
91
+ RegisterClass(SemanticValidator, 'required-when')
92
+ ], RequiredWhenValidator);
93
+ export { RequiredWhenValidator };
94
+ //# sourceMappingURL=required-when-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"required-when-validator.js","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/required-when-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIlD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,iBAAiB;IAC1D;;OAEG;IACH,cAAc;QACZ,OAAO,wGAAwG,CAAC;IAClH,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAA0B,EAAE,UAA8B;QACjE,MAAM,UAAU,GAA0B,EAAE,CAAC;QAE7C,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YAC1B,OAAO,UAAU,CAAC,CAAC,sCAAsC;QAC3D,CAAC;QAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE1E,2DAA2D;QAC3D,IAAI,kBAAkB,KAAK,SAAS,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;YACpE,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC;QAC/C,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,wDAAwD,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;YAC7F,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,yBAAyB;QACzB,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC;YACH,mCAAmC;YACnC,MAAM,WAAW,GAAG,kBAAkB,CAAC;YACvC,mCAAmC;YACnC,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,6CAA6C,SAAS,IAAI,EAAE,KAAK,CAAC,CAAC;YACjF,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,yDAAyD;QACzD,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,KAAK,SAAS;gBACpC,OAAO,CAAC,aAAa,KAAK,IAAI;gBAC9B,OAAO,CAAC,aAAa,KAAK,EAAE,CAAC;YAE7C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa;oBACtC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,SAAS,GAAG,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;oBAC3F,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,qBAAqB,UAAU,CAAC,SAAS,OAAO,kBAAkB,EAAE,CAAC;gBAEhG,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,eAAe,CAAC,uBAAuB,EAAE,OAAO,EAAE,MAAM,CAAC,CAC/D,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AArEY,qBAAqB;IADjC,aAAa,CAAC,iBAAiB,EAAE,eAAe,CAAC;GACrC,qBAAqB,CAqEjC"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Semantic Validator Registry
3
+ *
4
+ * Centralized registry for semantic validators that provides a plugin system
5
+ * for registering and retrieving validators by their constraint type.
6
+ *
7
+ * This registry uses the singleton pattern to ensure validators are only
8
+ * registered once across the application.
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * // Get the singleton instance
13
+ * const registry = SemanticValidatorRegistry.getInstance();
14
+ *
15
+ * // Register a custom validator
16
+ * registry.register(new MyCustomValidator());
17
+ *
18
+ * // Retrieve a validator by type
19
+ * const validator = registry.get('subset-of-entity-fields');
20
+ * ```
21
+ *
22
+ * Built-in validators are automatically registered on first access:
23
+ * - subset-of-entity-fields
24
+ * - sql-where-clause
25
+ * - required-when
26
+ */
27
+ import { SemanticValidator } from './semantic-validator.js';
28
+ /**
29
+ * Registry for semantic validators
30
+ *
31
+ * Provides plugin system for validation constraints with singleton pattern
32
+ * to ensure validators are only instantiated once.
33
+ */
34
+ export declare class SemanticValidatorRegistry {
35
+ private static instance;
36
+ private validators;
37
+ /**
38
+ * Private constructor to enforce singleton pattern
39
+ */
40
+ private constructor();
41
+ /**
42
+ * Get the singleton instance of the registry
43
+ *
44
+ * @returns The singleton registry instance
45
+ */
46
+ static getInstance(): SemanticValidatorRegistry;
47
+ /**
48
+ * Register built-in semantic validators
49
+ *
50
+ * Called automatically during construction.
51
+ * Registers the core validators that ship with the linter.
52
+ */
53
+ private registerBuiltInValidators;
54
+ /**
55
+ * Register a semantic validator
56
+ *
57
+ * Validators are keyed by the constraint type they handle.
58
+ * If a validator for the same type already exists, it will be overridden.
59
+ *
60
+ * @param validator - Validator instance to register
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const registry = SemanticValidatorRegistry.getInstance();
65
+ * registry.register(new MyCustomValidator());
66
+ * ```
67
+ */
68
+ register(validator: SemanticValidator): void;
69
+ /**
70
+ * Get validator type from validator instance
71
+ *
72
+ * Extracts the constraint type by checking the @RegisterClass metadata.
73
+ * Falls back to deriving from class name if metadata is not available.
74
+ *
75
+ * @param validator - Validator instance
76
+ * @returns Constraint type string
77
+ */
78
+ private getValidatorType;
79
+ /**
80
+ * Get a validator by constraint type
81
+ *
82
+ * @param type - Constraint type (e.g., 'subset-of-entity-fields')
83
+ * @returns Validator instance, or undefined if not registered
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const validator = registry.get('subset-of-entity-fields');
88
+ * if (validator) {
89
+ * const violations = validator.validate(context, constraint);
90
+ * }
91
+ * ```
92
+ */
93
+ get(type: string): SemanticValidator | undefined;
94
+ /**
95
+ * Get all registered validators
96
+ *
97
+ * @returns Map of constraint type to validator instance
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * const allValidators = registry.getAll();
102
+ * for (const [type, validator] of allValidators) {
103
+ * console.log(`${type}: ${validator.getDescription()}`);
104
+ * }
105
+ * ```
106
+ */
107
+ getAll(): Map<string, SemanticValidator>;
108
+ /**
109
+ * Check if a validator is registered for a constraint type
110
+ *
111
+ * @param type - Constraint type to check
112
+ * @returns True if a validator is registered
113
+ */
114
+ has(type: string): boolean;
115
+ /**
116
+ * Get list of all registered constraint types
117
+ *
118
+ * @returns Array of constraint type strings
119
+ */
120
+ getTypes(): string[];
121
+ }
122
+ //# sourceMappingURL=semantic-validator-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-validator-registry.d.ts","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/semantic-validator-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAKzD;;;;;GAKG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IACnD,OAAO,CAAC,UAAU,CAAiC;IAEnD;;OAEG;IACH,OAAO;IAKP;;;;OAIG;IACH,MAAM,CAAC,WAAW,IAAI,yBAAyB;IAO/C;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAMjC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAQ5C;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIhD;;;;;;;;;;;;OAYG;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAIxC;;;;;OAKG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;;;OAIG;IACH,QAAQ,IAAI,MAAM,EAAE;CAGrB"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Semantic Validator Registry
3
+ *
4
+ * Centralized registry for semantic validators that provides a plugin system
5
+ * for registering and retrieving validators by their constraint type.
6
+ *
7
+ * This registry uses the singleton pattern to ensure validators are only
8
+ * registered once across the application.
9
+ *
10
+ * Usage:
11
+ * ```typescript
12
+ * // Get the singleton instance
13
+ * const registry = SemanticValidatorRegistry.getInstance();
14
+ *
15
+ * // Register a custom validator
16
+ * registry.register(new MyCustomValidator());
17
+ *
18
+ * // Retrieve a validator by type
19
+ * const validator = registry.get('subset-of-entity-fields');
20
+ * ```
21
+ *
22
+ * Built-in validators are automatically registered on first access:
23
+ * - subset-of-entity-fields
24
+ * - sql-where-clause
25
+ * - required-when
26
+ */
27
+ import { SubsetOfEntityFieldsValidator } from './subset-of-entity-fields-validator.js';
28
+ import { SqlWhereClauseValidator } from './sql-where-clause-validator.js';
29
+ import { RequiredWhenValidator } from './required-when-validator.js';
30
+ /**
31
+ * Registry for semantic validators
32
+ *
33
+ * Provides plugin system for validation constraints with singleton pattern
34
+ * to ensure validators are only instantiated once.
35
+ */
36
+ export class SemanticValidatorRegistry {
37
+ /**
38
+ * Private constructor to enforce singleton pattern
39
+ */
40
+ constructor() {
41
+ this.validators = new Map();
42
+ this.registerBuiltInValidators();
43
+ }
44
+ /**
45
+ * Get the singleton instance of the registry
46
+ *
47
+ * @returns The singleton registry instance
48
+ */
49
+ static getInstance() {
50
+ if (!SemanticValidatorRegistry.instance) {
51
+ SemanticValidatorRegistry.instance = new SemanticValidatorRegistry();
52
+ }
53
+ return SemanticValidatorRegistry.instance;
54
+ }
55
+ /**
56
+ * Register built-in semantic validators
57
+ *
58
+ * Called automatically during construction.
59
+ * Registers the core validators that ship with the linter.
60
+ */
61
+ registerBuiltInValidators() {
62
+ this.register(new SubsetOfEntityFieldsValidator());
63
+ this.register(new SqlWhereClauseValidator());
64
+ this.register(new RequiredWhenValidator());
65
+ }
66
+ /**
67
+ * Register a semantic validator
68
+ *
69
+ * Validators are keyed by the constraint type they handle.
70
+ * If a validator for the same type already exists, it will be overridden.
71
+ *
72
+ * @param validator - Validator instance to register
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const registry = SemanticValidatorRegistry.getInstance();
77
+ * registry.register(new MyCustomValidator());
78
+ * ```
79
+ */
80
+ register(validator) {
81
+ // Get the constraint type from the validator's @RegisterClass decorator
82
+ // For now, we extract it from the class name by convention
83
+ // In the future, this could be read from metadata
84
+ const type = this.getValidatorType(validator);
85
+ this.validators.set(type, validator);
86
+ }
87
+ /**
88
+ * Get validator type from validator instance
89
+ *
90
+ * Extracts the constraint type by checking the @RegisterClass metadata.
91
+ * Falls back to deriving from class name if metadata is not available.
92
+ *
93
+ * @param validator - Validator instance
94
+ * @returns Constraint type string
95
+ */
96
+ getValidatorType(validator) {
97
+ // Type is stored in MJGlobal.Instance.ClassFactory during @RegisterClass
98
+ // For built-in validators, we know the types:
99
+ if (validator instanceof SubsetOfEntityFieldsValidator) {
100
+ return 'subset-of-entity-fields';
101
+ }
102
+ if (validator instanceof SqlWhereClauseValidator) {
103
+ return 'sql-where-clause';
104
+ }
105
+ if (validator instanceof RequiredWhenValidator) {
106
+ return 'required-when';
107
+ }
108
+ // Fallback: derive from class name (e.g., SubsetOfEntityFieldsValidator -> subset-of-entity-fields)
109
+ const className = validator.constructor.name;
110
+ return className
111
+ .replace(/Validator$/, '') // Remove "Validator" suffix
112
+ .replace(/([A-Z])/g, (match, p1, offset) => (offset > 0 ? '-' : '') + p1.toLowerCase())
113
+ .replace(/^-/, ''); // Remove leading dash if present
114
+ }
115
+ /**
116
+ * Get a validator by constraint type
117
+ *
118
+ * @param type - Constraint type (e.g., 'subset-of-entity-fields')
119
+ * @returns Validator instance, or undefined if not registered
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const validator = registry.get('subset-of-entity-fields');
124
+ * if (validator) {
125
+ * const violations = validator.validate(context, constraint);
126
+ * }
127
+ * ```
128
+ */
129
+ get(type) {
130
+ return this.validators.get(type);
131
+ }
132
+ /**
133
+ * Get all registered validators
134
+ *
135
+ * @returns Map of constraint type to validator instance
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const allValidators = registry.getAll();
140
+ * for (const [type, validator] of allValidators) {
141
+ * console.log(`${type}: ${validator.getDescription()}`);
142
+ * }
143
+ * ```
144
+ */
145
+ getAll() {
146
+ return new Map(this.validators);
147
+ }
148
+ /**
149
+ * Check if a validator is registered for a constraint type
150
+ *
151
+ * @param type - Constraint type to check
152
+ * @returns True if a validator is registered
153
+ */
154
+ has(type) {
155
+ return this.validators.has(type);
156
+ }
157
+ /**
158
+ * Get list of all registered constraint types
159
+ *
160
+ * @returns Array of constraint type strings
161
+ */
162
+ getTypes() {
163
+ return Array.from(this.validators.keys());
164
+ }
165
+ }
166
+ //# sourceMappingURL=semantic-validator-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-validator-registry.js","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/semantic-validator-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IAIpC;;OAEG;IACH;QACE,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,CAAC;YACxC,yBAAyB,CAAC,QAAQ,GAAG,IAAI,yBAAyB,EAAE,CAAC;QACvE,CAAC;QACD,OAAO,yBAAyB,CAAC,QAAQ,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACK,yBAAyB;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,6BAA6B,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,SAA4B;QACnC,wEAAwE;QACxE,2DAA2D;QAC3D,kDAAkD;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACK,gBAAgB,CAAC,SAA4B;QACnD,yEAAyE;QACzE,8CAA8C;QAC9C,IAAI,SAAS,YAAY,6BAA6B,EAAE,CAAC;YACvD,OAAO,yBAAyB,CAAC;QACnC,CAAC;QACD,IAAI,SAAS,YAAY,uBAAuB,EAAE,CAAC;YACjD,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QACD,IAAI,SAAS,YAAY,qBAAqB,EAAE,CAAC;YAC/C,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,oGAAoG;QACpG,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;QAC7C,OAAO,SAAS;aACb,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,4BAA4B;aACtD,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;aACtF,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,iCAAiC;IACzD,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM;QACJ,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF"}