@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,260 @@
1
+ /**
2
+ * Semantic Validator
3
+ *
4
+ * Abstract base class for all semantic validators.
5
+ * Semantic validators implement business logic for validating prop values at lint-time.
6
+ * They check semantic correctness beyond type checking (e.g., field names exist on entities).
7
+ *
8
+ * Key Concepts:
9
+ * - **Validators = Code**: Implemented as TypeScript classes
10
+ * - **Constraints = Metadata**: Declared in component spec JSON
11
+ * - **Separation**: Validator logic is separate from constraint definitions
12
+ *
13
+ * Example:
14
+ * ```typescript
15
+ * // Validator implementation (code)
16
+ * class SubsetOfEntityFieldsValidator extends SemanticValidator {
17
+ * validate(context, constraint) {
18
+ * // Implementation...
19
+ * }
20
+ * }
21
+ *
22
+ * // Constraint definition (metadata in spec JSON)
23
+ * {
24
+ * "type": "subset-of-entity-fields",
25
+ * "dependsOn": "entityName"
26
+ * }
27
+ * ```
28
+ */
29
+ import { PropertyConstraint, ConstraintViolation } from '@memberjunction/interactive-component-types';
30
+ import { ValidationContext } from './validation-context.js';
31
+ import { DynamicValue } from '../../prop-value-extractor.js';
32
+ /**
33
+ * Abstract base class for semantic validators
34
+ *
35
+ * All semantic validators must extend this class and implement the validate() method.
36
+ */
37
+ export declare abstract class SemanticValidator {
38
+ /**
39
+ * Validate a prop value against a constraint
40
+ *
41
+ * This is the main method that subclasses must implement.
42
+ * It receives the validation context and constraint definition,
43
+ * and returns an array of violations (empty if valid).
44
+ *
45
+ * Note: Changed from async to sync since validators perform no actual I/O.
46
+ * This allows seamless integration with the synchronous linter architecture.
47
+ *
48
+ * @param context - Validation context with prop value, component spec, entities, etc.
49
+ * @param constraint - The constraint definition from the component spec
50
+ * @returns Array of violations (empty if valid)
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * class MyValidator extends SemanticValidator {
55
+ * validate(context: ValidationContext, constraint: PropertyConstraint): ConstraintViolation[] {
56
+ * const violations: ConstraintViolation[] = [];
57
+ *
58
+ * // Check if value can be validated statically
59
+ * if (PropValueExtractor.isDynamicValue(context.propertyValue)) {
60
+ * return violations; // Skip - can't validate dynamic values
61
+ * }
62
+ *
63
+ * // Perform validation logic
64
+ * // ...
65
+ *
66
+ * return violations;
67
+ * }
68
+ * }
69
+ * ```
70
+ */
71
+ abstract validate(context: ValidationContext, constraint: PropertyConstraint): ConstraintViolation[];
72
+ /**
73
+ * Get the name of this validator
74
+ *
75
+ * Used for debugging and error messages.
76
+ * Defaults to the class name, but can be overridden.
77
+ *
78
+ * @returns Validator name
79
+ */
80
+ getName(): string;
81
+ /**
82
+ * Get a description of what this validator checks
83
+ *
84
+ * Used for documentation and error messages.
85
+ * Should be a brief, user-friendly description.
86
+ *
87
+ * @returns Validator description
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * getDescription() {
92
+ * return "Validates that array elements are valid field names for the specified entity";
93
+ * }
94
+ * ```
95
+ */
96
+ abstract getDescription(): string;
97
+ /**
98
+ * Check if a value is dynamic (can't be validated statically)
99
+ *
100
+ * Dynamic values include identifiers (variables) and expressions (function calls, etc.)
101
+ * that can't be resolved at lint-time.
102
+ *
103
+ * @param value - The extracted value to check
104
+ * @returns True if the value is dynamic
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * if (this.isDynamicValue(context.propertyValue)) {
109
+ * return []; // Skip validation
110
+ * }
111
+ * ```
112
+ */
113
+ protected isDynamicValue(value: any): value is DynamicValue;
114
+ /**
115
+ * Create a violation with consistent formatting
116
+ *
117
+ * Helper method to create ConstraintViolation objects with common fields populated.
118
+ *
119
+ * @param type - Violation type (e.g., 'invalid-field', 'type-mismatch')
120
+ * @param message - Error message
121
+ * @param severity - Severity level (default: 'high')
122
+ * @param suggestion - Optional fix suggestion
123
+ * @param metadata - Optional additional metadata
124
+ * @returns ConstraintViolation object
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * return [
129
+ * this.createViolation(
130
+ * 'invalid-field',
131
+ * `Field '${field}' does not exist on entity '${entityName}'`,
132
+ * 'critical',
133
+ * `Use one of: ${validFields.join(', ')}`,
134
+ * { field, entityName, validFields }
135
+ * )
136
+ * ];
137
+ * ```
138
+ */
139
+ protected createViolation(type: string, message: string, severity?: 'critical' | 'high' | 'medium' | 'low', suggestion?: string, metadata?: Record<string, any>): ConstraintViolation;
140
+ /**
141
+ * Get the dependent prop value
142
+ *
143
+ * If the constraint has a `dependsOn` field, this method retrieves
144
+ * the value of that dependent prop from sibling props.
145
+ *
146
+ * Returns null if:
147
+ * - No dependency is specified
148
+ * - The dependent prop is not found
149
+ * - The dependent prop has a dynamic value
150
+ *
151
+ * @param context - Validation context
152
+ * @param constraint - Constraint definition
153
+ * @returns The dependent prop value, or null if not available
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * // Constraint: { type: 'subset-of-entity-fields', dependsOn: 'entityName' }
158
+ * const entityName = this.getDependentPropValue(context, constraint);
159
+ * if (!entityName) {
160
+ * // Can't validate - entityName not provided or is dynamic
161
+ * return [];
162
+ * }
163
+ * ```
164
+ */
165
+ protected getDependentPropValue(context: ValidationContext, constraint: PropertyConstraint): any;
166
+ /**
167
+ * Format a list of values for error messages
168
+ *
169
+ * Truncates long lists with "..." and formats values nicely.
170
+ *
171
+ * @param values - Array of values
172
+ * @param maxItems - Maximum items to show (default: 10)
173
+ * @returns Formatted string
174
+ *
175
+ * @example
176
+ * ```typescript
177
+ * const fields = ['FirstName', 'LastName', 'Email', ...]; // 50 fields
178
+ * const formatted = this.formatValueList(fields, 5);
179
+ * // => "FirstName, LastName, Email, Status, JoinDate... (45 more)"
180
+ * ```
181
+ */
182
+ protected formatValueList(values: any[], maxItems?: number): string;
183
+ /**
184
+ * Apply custom error template
185
+ *
186
+ * If the constraint has an `errorTemplate`, applies it by replacing
187
+ * template variables with actual values.
188
+ *
189
+ * Template variables:
190
+ * - {property} - Property name from context
191
+ * - {value} - Property value from context
192
+ * - {constraint} - Constraint type
193
+ * - Custom variables from templateVars parameter
194
+ *
195
+ * @param constraint - Constraint definition
196
+ * @param context - Validation context
197
+ * @param defaultMessage - Default message to use if no template
198
+ * @param templateVars - Additional template variables
199
+ * @returns Formatted message
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * // Constraint: { errorTemplate: "Field '{field}' not found on {entityName}" }
204
+ * const message = this.applyErrorTemplate(
205
+ * constraint,
206
+ * context,
207
+ * `Field '${field}' does not exist`,
208
+ * { field: 'FullName', entityName: 'Members' }
209
+ * );
210
+ * // => "Field 'FullName' not found on Members"
211
+ * ```
212
+ */
213
+ protected applyErrorTemplate(constraint: PropertyConstraint, context: ValidationContext, defaultMessage: string, templateVars?: Record<string, any>): string;
214
+ /**
215
+ * Calculate Levenshtein distance between two strings
216
+ *
217
+ * Used for finding similar field names for "Did you mean?" suggestions.
218
+ *
219
+ * @param a - First string
220
+ * @param b - Second string
221
+ * @returns Edit distance
222
+ */
223
+ protected levenshteinDistance(a: string, b: string): number;
224
+ /**
225
+ * Find similar strings using Levenshtein distance
226
+ *
227
+ * Returns strings sorted by similarity (most similar first).
228
+ *
229
+ * @param target - The target string to find matches for
230
+ * @param candidates - Array of candidate strings
231
+ * @param maxResults - Maximum number of results (default: 3)
232
+ * @param maxDistance - Maximum edit distance to consider (default: 3)
233
+ * @returns Array of similar strings, sorted by distance
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * const fields = ['FirstName', 'LastName', 'Email', 'Status'];
238
+ * const similar = this.findSimilar('FristName', fields, 2);
239
+ * // => ['FirstName'] (edit distance 1)
240
+ * ```
241
+ */
242
+ protected findSimilar(target: string, candidates: string[], maxResults?: number, maxDistance?: number): string[];
243
+ /**
244
+ * Case-insensitive string comparison
245
+ *
246
+ * @param a - First string
247
+ * @param b - Second string
248
+ * @returns True if strings are equal (case-insensitive)
249
+ */
250
+ protected equalsCaseInsensitive(a: string, b: string): boolean;
251
+ /**
252
+ * Check if array contains value (case-insensitive for strings)
253
+ *
254
+ * @param arr - Array to search
255
+ * @param value - Value to find
256
+ * @returns True if array contains the value
257
+ */
258
+ protected includesCaseInsensitive(arr: string[], value: string): boolean;
259
+ }
260
+ //# sourceMappingURL=semantic-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-validator.d.ts","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/semantic-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAsB,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE9E;;;;GAIG;AACH,8BAAsB,iBAAiB;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,QAAQ,CAAC,QAAQ,CACf,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,kBAAkB,GAC7B,mBAAmB,EAAE;IAExB;;;;;;;OAOG;IACH,OAAO,IAA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G;IACH,SAAS,CAAC,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO;IAI9D;;;;;;OAMG;IACH,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;CAGzE"}
@@ -0,0 +1,301 @@
1
+ /**
2
+ * Semantic Validator
3
+ *
4
+ * Abstract base class for all semantic validators.
5
+ * Semantic validators implement business logic for validating prop values at lint-time.
6
+ * They check semantic correctness beyond type checking (e.g., field names exist on entities).
7
+ *
8
+ * Key Concepts:
9
+ * - **Validators = Code**: Implemented as TypeScript classes
10
+ * - **Constraints = Metadata**: Declared in component spec JSON
11
+ * - **Separation**: Validator logic is separate from constraint definitions
12
+ *
13
+ * Example:
14
+ * ```typescript
15
+ * // Validator implementation (code)
16
+ * class SubsetOfEntityFieldsValidator extends SemanticValidator {
17
+ * validate(context, constraint) {
18
+ * // Implementation...
19
+ * }
20
+ * }
21
+ *
22
+ * // Constraint definition (metadata in spec JSON)
23
+ * {
24
+ * "type": "subset-of-entity-fields",
25
+ * "dependsOn": "entityName"
26
+ * }
27
+ * ```
28
+ */
29
+ import { PropValueExtractor } from '../../prop-value-extractor.js';
30
+ /**
31
+ * Abstract base class for semantic validators
32
+ *
33
+ * All semantic validators must extend this class and implement the validate() method.
34
+ */
35
+ export class SemanticValidator {
36
+ /**
37
+ * Get the name of this validator
38
+ *
39
+ * Used for debugging and error messages.
40
+ * Defaults to the class name, but can be overridden.
41
+ *
42
+ * @returns Validator name
43
+ */
44
+ getName() {
45
+ return this.constructor.name;
46
+ }
47
+ // ============================================================================
48
+ // Protected Helper Methods
49
+ // ============================================================================
50
+ /**
51
+ * Check if a value is dynamic (can't be validated statically)
52
+ *
53
+ * Dynamic values include identifiers (variables) and expressions (function calls, etc.)
54
+ * that can't be resolved at lint-time.
55
+ *
56
+ * @param value - The extracted value to check
57
+ * @returns True if the value is dynamic
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * if (this.isDynamicValue(context.propertyValue)) {
62
+ * return []; // Skip validation
63
+ * }
64
+ * ```
65
+ */
66
+ isDynamicValue(value) {
67
+ return PropValueExtractor.isDynamicValue(value);
68
+ }
69
+ /**
70
+ * Create a violation with consistent formatting
71
+ *
72
+ * Helper method to create ConstraintViolation objects with common fields populated.
73
+ *
74
+ * @param type - Violation type (e.g., 'invalid-field', 'type-mismatch')
75
+ * @param message - Error message
76
+ * @param severity - Severity level (default: 'high')
77
+ * @param suggestion - Optional fix suggestion
78
+ * @param metadata - Optional additional metadata
79
+ * @returns ConstraintViolation object
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * return [
84
+ * this.createViolation(
85
+ * 'invalid-field',
86
+ * `Field '${field}' does not exist on entity '${entityName}'`,
87
+ * 'critical',
88
+ * `Use one of: ${validFields.join(', ')}`,
89
+ * { field, entityName, validFields }
90
+ * )
91
+ * ];
92
+ * ```
93
+ */
94
+ createViolation(type, message, severity = 'high', suggestion, metadata) {
95
+ return {
96
+ type,
97
+ message,
98
+ severity,
99
+ suggestion,
100
+ metadata,
101
+ };
102
+ }
103
+ /**
104
+ * Get the dependent prop value
105
+ *
106
+ * If the constraint has a `dependsOn` field, this method retrieves
107
+ * the value of that dependent prop from sibling props.
108
+ *
109
+ * Returns null if:
110
+ * - No dependency is specified
111
+ * - The dependent prop is not found
112
+ * - The dependent prop has a dynamic value
113
+ *
114
+ * @param context - Validation context
115
+ * @param constraint - Constraint definition
116
+ * @returns The dependent prop value, or null if not available
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * // Constraint: { type: 'subset-of-entity-fields', dependsOn: 'entityName' }
121
+ * const entityName = this.getDependentPropValue(context, constraint);
122
+ * if (!entityName) {
123
+ * // Can't validate - entityName not provided or is dynamic
124
+ * return [];
125
+ * }
126
+ * ```
127
+ */
128
+ getDependentPropValue(context, constraint) {
129
+ if (!constraint.dependsOn) {
130
+ return null;
131
+ }
132
+ const dependentValue = context.siblingProps.get(constraint.dependsOn);
133
+ if (!dependentValue) {
134
+ return null;
135
+ }
136
+ if (this.isDynamicValue(dependentValue)) {
137
+ return null;
138
+ }
139
+ return dependentValue;
140
+ }
141
+ /**
142
+ * Format a list of values for error messages
143
+ *
144
+ * Truncates long lists with "..." and formats values nicely.
145
+ *
146
+ * @param values - Array of values
147
+ * @param maxItems - Maximum items to show (default: 10)
148
+ * @returns Formatted string
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * const fields = ['FirstName', 'LastName', 'Email', ...]; // 50 fields
153
+ * const formatted = this.formatValueList(fields, 5);
154
+ * // => "FirstName, LastName, Email, Status, JoinDate... (45 more)"
155
+ * ```
156
+ */
157
+ formatValueList(values, maxItems = 10) {
158
+ if (values.length === 0) {
159
+ return '(none)';
160
+ }
161
+ if (values.length <= maxItems) {
162
+ return values.map((v) => `'${v}'`).join(', ');
163
+ }
164
+ const shown = values.slice(0, maxItems).map((v) => `'${v}'`);
165
+ const remaining = values.length - maxItems;
166
+ return `${shown.join(', ')}... (${remaining} more)`;
167
+ }
168
+ /**
169
+ * Apply custom error template
170
+ *
171
+ * If the constraint has an `errorTemplate`, applies it by replacing
172
+ * template variables with actual values.
173
+ *
174
+ * Template variables:
175
+ * - {property} - Property name from context
176
+ * - {value} - Property value from context
177
+ * - {constraint} - Constraint type
178
+ * - Custom variables from templateVars parameter
179
+ *
180
+ * @param constraint - Constraint definition
181
+ * @param context - Validation context
182
+ * @param defaultMessage - Default message to use if no template
183
+ * @param templateVars - Additional template variables
184
+ * @returns Formatted message
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * // Constraint: { errorTemplate: "Field '{field}' not found on {entityName}" }
189
+ * const message = this.applyErrorTemplate(
190
+ * constraint,
191
+ * context,
192
+ * `Field '${field}' does not exist`,
193
+ * { field: 'FullName', entityName: 'Members' }
194
+ * );
195
+ * // => "Field 'FullName' not found on Members"
196
+ * ```
197
+ */
198
+ applyErrorTemplate(constraint, context, defaultMessage, templateVars = {}) {
199
+ if (!constraint.errorTemplate) {
200
+ return defaultMessage;
201
+ }
202
+ let message = constraint.errorTemplate;
203
+ // Standard variables
204
+ const vars = {
205
+ property: context.propertyName,
206
+ value: PropValueExtractor.describe(context.propertyValue),
207
+ constraint: constraint.type,
208
+ ...templateVars,
209
+ };
210
+ // Replace template variables
211
+ for (const [key, value] of Object.entries(vars)) {
212
+ const regex = new RegExp(`\\{${key}\\}`, 'g');
213
+ message = message.replace(regex, String(value));
214
+ }
215
+ return message;
216
+ }
217
+ /**
218
+ * Calculate Levenshtein distance between two strings
219
+ *
220
+ * Used for finding similar field names for "Did you mean?" suggestions.
221
+ *
222
+ * @param a - First string
223
+ * @param b - Second string
224
+ * @returns Edit distance
225
+ */
226
+ levenshteinDistance(a, b) {
227
+ const matrix = [];
228
+ // Initialize first column
229
+ for (let i = 0; i <= b.length; i++) {
230
+ matrix[i] = [i];
231
+ }
232
+ // Initialize first row
233
+ for (let j = 0; j <= a.length; j++) {
234
+ matrix[0][j] = j;
235
+ }
236
+ // Fill matrix
237
+ for (let i = 1; i <= b.length; i++) {
238
+ for (let j = 1; j <= a.length; j++) {
239
+ if (b.charAt(i - 1) === a.charAt(j - 1)) {
240
+ matrix[i][j] = matrix[i - 1][j - 1];
241
+ }
242
+ else {
243
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
244
+ matrix[i][j - 1] + 1, // insertion
245
+ matrix[i - 1][j] + 1 // deletion
246
+ );
247
+ }
248
+ }
249
+ }
250
+ return matrix[b.length][a.length];
251
+ }
252
+ /**
253
+ * Find similar strings using Levenshtein distance
254
+ *
255
+ * Returns strings sorted by similarity (most similar first).
256
+ *
257
+ * @param target - The target string to find matches for
258
+ * @param candidates - Array of candidate strings
259
+ * @param maxResults - Maximum number of results (default: 3)
260
+ * @param maxDistance - Maximum edit distance to consider (default: 3)
261
+ * @returns Array of similar strings, sorted by distance
262
+ *
263
+ * @example
264
+ * ```typescript
265
+ * const fields = ['FirstName', 'LastName', 'Email', 'Status'];
266
+ * const similar = this.findSimilar('FristName', fields, 2);
267
+ * // => ['FirstName'] (edit distance 1)
268
+ * ```
269
+ */
270
+ findSimilar(target, candidates, maxResults = 3, maxDistance = 3) {
271
+ const withDistances = candidates
272
+ .map((candidate) => ({
273
+ value: candidate,
274
+ distance: this.levenshteinDistance(target.toLowerCase(), candidate.toLowerCase()),
275
+ }))
276
+ .filter((item) => item.distance <= maxDistance)
277
+ .sort((a, b) => a.distance - b.distance);
278
+ return withDistances.slice(0, maxResults).map((item) => item.value);
279
+ }
280
+ /**
281
+ * Case-insensitive string comparison
282
+ *
283
+ * @param a - First string
284
+ * @param b - Second string
285
+ * @returns True if strings are equal (case-insensitive)
286
+ */
287
+ equalsCaseInsensitive(a, b) {
288
+ return a.toLowerCase() === b.toLowerCase();
289
+ }
290
+ /**
291
+ * Check if array contains value (case-insensitive for strings)
292
+ *
293
+ * @param arr - Array to search
294
+ * @param value - Value to find
295
+ * @returns True if array contains the value
296
+ */
297
+ includesCaseInsensitive(arr, value) {
298
+ return arr.some((item) => this.equalsCaseInsensitive(item, value));
299
+ }
300
+ }
301
+ //# sourceMappingURL=semantic-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-validator.js","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/semantic-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,OAAO,EAAE,kBAAkB,EAAgB,MAAM,4BAA4B,CAAC;AAE9E;;;;GAIG;AACH,MAAM,OAAgB,iBAAiB;IAuCrC;;;;;;;OAOG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAmBD,+EAA+E;IAC/E,2BAA2B;IAC3B,+EAA+E;IAE/E;;;;;;;;;;;;;;;OAeG;IACO,cAAc,CAAC,KAAU;QACjC,OAAO,kBAAkB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC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AsB,CAAC;QAEvB,MAAM,aAAa,GAAG,UAAU;aAC7B,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YACnB,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC;SAClF,CAAC,CAAC;aACF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC;aAC9C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QAE3C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACO,qBAAqB,CAAC,CAAS,EAAE,CAAS;QAClD,OAAO,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACO,uBAAuB,CAAC,GAAa,EAAE,KAAa;QAC5D,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * SQL WHERE Clause Validator
3
+ *
4
+ * Validates SQL WHERE clauses for syntax and field references.
5
+ * Uses SQLParser for accurate AST-based validation with regex fallback.
6
+ *
7
+ * This validator is essential for catching errors like:
8
+ * ```jsx
9
+ * // ❌ BROKEN - LastModified doesn't exist on Products
10
+ * <EntityDataGrid
11
+ * entityName="Products"
12
+ * extraFilter="Status='Active' AND LastModified > '2024-01-01'"
13
+ * />
14
+ *
15
+ * // ✅ FIXED - CreatedAt exists on Products
16
+ * <EntityDataGrid
17
+ * entityName="Products"
18
+ * extraFilter="Status='Active' AND CreatedAt > '2024-01-01'"
19
+ * />
20
+ * ```
21
+ *
22
+ * Validation Levels:
23
+ * - **Level 1**: Field existence (IMPLEMENTED)
24
+ * - **Level 2**: Type compatibility (FUTURE)
25
+ * - **Level 3**: SQL function validation (FUTURE)
26
+ *
27
+ * Constraint Definition:
28
+ * ```json
29
+ * {
30
+ * "type": "sql-where-clause",
31
+ * "dependsOn": "entityName",
32
+ * "config": {
33
+ * "caseSensitive": false
34
+ * }
35
+ * }
36
+ * ```
37
+ */
38
+ import { PropertyConstraint, ConstraintViolation } from '@memberjunction/interactive-component-types';
39
+ import { SemanticValidator } from './semantic-validator.js';
40
+ import { ValidationContext } from './validation-context.js';
41
+ /**
42
+ * Validates SQL WHERE clauses for syntax and field references
43
+ *
44
+ * **Depends On**: Entity name (from entityName prop)
45
+ * **Validates**: SQL WHERE clause string
46
+ * **Common Use Cases**:
47
+ * - EntityDataGrid extraFilter prop
48
+ * - RunView ExtraFilter parameter
49
+ * - Custom components with SQL filtering
50
+ *
51
+ * **Implementation**: Uses SQLParser for accurate AST-based validation
52
+ * with regex fallback for edge cases.
53
+ */
54
+ export declare class SqlWhereClauseValidator extends SemanticValidator {
55
+ /**
56
+ * SQL keywords that are not field references
57
+ * Used in regex fallback when AST parsing fails
58
+ */
59
+ private static readonly SQL_KEYWORDS;
60
+ /**
61
+ * Validate SQL WHERE clause
62
+ *
63
+ * @param context - Validation context
64
+ * @param constraint - Constraint definition
65
+ * @returns Array of violations (empty if valid)
66
+ */
67
+ validate(context: ValidationContext, constraint: PropertyConstraint): ConstraintViolation[];
68
+ /**
69
+ * Validate WHERE clause using AST parsing (Level 1: Field existence)
70
+ *
71
+ * Uses SQLParser to accurately extract column references.
72
+ *
73
+ * @param whereClause - SQL WHERE clause
74
+ * @param entityName - Entity name for context
75
+ * @param fieldNames - Valid field names
76
+ * @param fieldNamesLower - Lowercase field names for case-insensitive matching
77
+ * @param caseSensitive - Whether to check case sensitivity
78
+ * @param context - Validation context
79
+ * @param constraint - Constraint definition
80
+ * @returns Array of violations
81
+ */
82
+ private validateWithAST;
83
+ /**
84
+ * Extract column references from SQL AST
85
+ *
86
+ * Pattern based on MJQueryEntity.extractColumnReferences (lines 563-590)
87
+ * Recursively traverses the AST to find all column_ref nodes.
88
+ *
89
+ * @param expr - Expression node from AST
90
+ * @param referencedColumns - Set to collect column names
91
+ */
92
+ private extractColumnReferences;
93
+ /**
94
+ * Fallback regex-based validation for when SQL parsing fails
95
+ *
96
+ * Less accurate than AST parsing but handles edge cases.
97
+ * Violations from regex fallback have 'high' severity instead of 'critical'
98
+ * to indicate less certainty.
99
+ *
100
+ * @param whereClause - SQL WHERE clause
101
+ * @param entityName - Entity name for context
102
+ * @param fieldNames - Valid field names
103
+ * @param fieldNamesLower - Lowercase field names
104
+ * @param caseSensitive - Whether to check case sensitivity
105
+ * @param context - Validation context
106
+ * @param constraint - Constraint definition
107
+ * @returns Array of violations
108
+ */
109
+ private validateWithRegex;
110
+ /**
111
+ * Get validator description
112
+ */
113
+ getDescription(): string;
114
+ }
115
+ //# sourceMappingURL=sql-where-clause-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-where-clause-validator.d.ts","sourceRoot":"","sources":["../../../src/schema-validation/semantic-validators/sql-where-clause-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD;;;;;;;;;;;;GAYG;AACH,qBACa,uBAAwB,SAAQ,iBAAiB;IAC5D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAajC;IAEH;;;;;;OAMG;IACH,QAAQ,CACN,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,kBAAkB,GAC7B,mBAAmB,EAAE;IA0ExB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,eAAe;IAiHvB;;;;;;;;OAQG;IACH,OAAO,CAAC,uBAAuB;IAwD/B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;IA6GzB;;OAEG;IACH,cAAc,IAAI,MAAM;CAGzB"}