driftdetect-detectors 0.1.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 (509) hide show
  1. package/dist/accessibility/alt-text.d.ts +63 -0
  2. package/dist/accessibility/alt-text.d.ts.map +1 -0
  3. package/dist/accessibility/alt-text.js +100 -0
  4. package/dist/accessibility/alt-text.js.map +1 -0
  5. package/dist/accessibility/aria-roles.d.ts +65 -0
  6. package/dist/accessibility/aria-roles.d.ts.map +1 -0
  7. package/dist/accessibility/aria-roles.js +87 -0
  8. package/dist/accessibility/aria-roles.js.map +1 -0
  9. package/dist/accessibility/focus-management.d.ts +62 -0
  10. package/dist/accessibility/focus-management.d.ts.map +1 -0
  11. package/dist/accessibility/focus-management.js +88 -0
  12. package/dist/accessibility/focus-management.js.map +1 -0
  13. package/dist/accessibility/heading-hierarchy.d.ts +66 -0
  14. package/dist/accessibility/heading-hierarchy.d.ts.map +1 -0
  15. package/dist/accessibility/heading-hierarchy.js +94 -0
  16. package/dist/accessibility/heading-hierarchy.js.map +1 -0
  17. package/dist/accessibility/index.d.ts +25 -0
  18. package/dist/accessibility/index.d.ts.map +1 -0
  19. package/dist/accessibility/index.js +21 -0
  20. package/dist/accessibility/index.js.map +1 -0
  21. package/dist/accessibility/keyboard-nav.d.ts +63 -0
  22. package/dist/accessibility/keyboard-nav.d.ts.map +1 -0
  23. package/dist/accessibility/keyboard-nav.js +86 -0
  24. package/dist/accessibility/keyboard-nav.js.map +1 -0
  25. package/dist/accessibility/semantic-html.d.ts +76 -0
  26. package/dist/accessibility/semantic-html.d.ts.map +1 -0
  27. package/dist/accessibility/semantic-html.js +204 -0
  28. package/dist/accessibility/semantic-html.js.map +1 -0
  29. package/dist/api/client-patterns.d.ts +121 -0
  30. package/dist/api/client-patterns.d.ts.map +1 -0
  31. package/dist/api/client-patterns.js +478 -0
  32. package/dist/api/client-patterns.js.map +1 -0
  33. package/dist/api/error-format.d.ts +140 -0
  34. package/dist/api/error-format.d.ts.map +1 -0
  35. package/dist/api/error-format.js +614 -0
  36. package/dist/api/error-format.js.map +1 -0
  37. package/dist/api/http-methods.d.ts +255 -0
  38. package/dist/api/http-methods.d.ts.map +1 -0
  39. package/dist/api/http-methods.js +890 -0
  40. package/dist/api/http-methods.js.map +1 -0
  41. package/dist/api/index.d.ts +16 -0
  42. package/dist/api/index.d.ts.map +1 -0
  43. package/dist/api/index.js +37 -0
  44. package/dist/api/index.js.map +1 -0
  45. package/dist/api/pagination.d.ts +133 -0
  46. package/dist/api/pagination.d.ts.map +1 -0
  47. package/dist/api/pagination.js +521 -0
  48. package/dist/api/pagination.js.map +1 -0
  49. package/dist/api/response-envelope.d.ts +261 -0
  50. package/dist/api/response-envelope.d.ts.map +1 -0
  51. package/dist/api/response-envelope.js +1050 -0
  52. package/dist/api/response-envelope.js.map +1 -0
  53. package/dist/api/retry-patterns.d.ts +117 -0
  54. package/dist/api/retry-patterns.d.ts.map +1 -0
  55. package/dist/api/retry-patterns.js +480 -0
  56. package/dist/api/retry-patterns.js.map +1 -0
  57. package/dist/api/route-structure.d.ts +128 -0
  58. package/dist/api/route-structure.d.ts.map +1 -0
  59. package/dist/api/route-structure.js +738 -0
  60. package/dist/api/route-structure.js.map +1 -0
  61. package/dist/auth/audit-logging.d.ts +80 -0
  62. package/dist/auth/audit-logging.d.ts.map +1 -0
  63. package/dist/auth/audit-logging.js +370 -0
  64. package/dist/auth/audit-logging.js.map +1 -0
  65. package/dist/auth/index.d.ts +33 -0
  66. package/dist/auth/index.d.ts.map +1 -0
  67. package/dist/auth/index.js +49 -0
  68. package/dist/auth/index.js.map +1 -0
  69. package/dist/auth/middleware-usage.d.ts +65 -0
  70. package/dist/auth/middleware-usage.d.ts.map +1 -0
  71. package/dist/auth/middleware-usage.js +192 -0
  72. package/dist/auth/middleware-usage.js.map +1 -0
  73. package/dist/auth/permission-checks.d.ts +60 -0
  74. package/dist/auth/permission-checks.d.ts.map +1 -0
  75. package/dist/auth/permission-checks.js +159 -0
  76. package/dist/auth/permission-checks.js.map +1 -0
  77. package/dist/auth/rbac-patterns.d.ts +68 -0
  78. package/dist/auth/rbac-patterns.d.ts.map +1 -0
  79. package/dist/auth/rbac-patterns.js +143 -0
  80. package/dist/auth/rbac-patterns.js.map +1 -0
  81. package/dist/auth/resource-ownership.d.ts +77 -0
  82. package/dist/auth/resource-ownership.d.ts.map +1 -0
  83. package/dist/auth/resource-ownership.js +324 -0
  84. package/dist/auth/resource-ownership.js.map +1 -0
  85. package/dist/auth/token-handling.d.ts +64 -0
  86. package/dist/auth/token-handling.d.ts.map +1 -0
  87. package/dist/auth/token-handling.js +151 -0
  88. package/dist/auth/token-handling.js.map +1 -0
  89. package/dist/base/ast-detector.d.ts +421 -0
  90. package/dist/base/ast-detector.d.ts.map +1 -0
  91. package/dist/base/ast-detector.js +699 -0
  92. package/dist/base/ast-detector.js.map +1 -0
  93. package/dist/base/base-detector.d.ts +366 -0
  94. package/dist/base/base-detector.d.ts.map +1 -0
  95. package/dist/base/base-detector.js +170 -0
  96. package/dist/base/base-detector.js.map +1 -0
  97. package/dist/base/index.d.ts +12 -0
  98. package/dist/base/index.d.ts.map +1 -0
  99. package/dist/base/index.js +17 -0
  100. package/dist/base/index.js.map +1 -0
  101. package/dist/base/regex-detector.d.ts +421 -0
  102. package/dist/base/regex-detector.d.ts.map +1 -0
  103. package/dist/base/regex-detector.js +537 -0
  104. package/dist/base/regex-detector.js.map +1 -0
  105. package/dist/base/structural-detector.d.ts +424 -0
  106. package/dist/base/structural-detector.d.ts.map +1 -0
  107. package/dist/base/structural-detector.js +731 -0
  108. package/dist/base/structural-detector.js.map +1 -0
  109. package/dist/base/types.d.ts +53 -0
  110. package/dist/base/types.d.ts.map +1 -0
  111. package/dist/base/types.js +5 -0
  112. package/dist/base/types.js.map +1 -0
  113. package/dist/components/component-structure.d.ts +163 -0
  114. package/dist/components/component-structure.d.ts.map +1 -0
  115. package/dist/components/component-structure.js +500 -0
  116. package/dist/components/component-structure.js.map +1 -0
  117. package/dist/components/composition.d.ts +287 -0
  118. package/dist/components/composition.d.ts.map +1 -0
  119. package/dist/components/composition.js +1123 -0
  120. package/dist/components/composition.js.map +1 -0
  121. package/dist/components/duplicate-detection.d.ts +251 -0
  122. package/dist/components/duplicate-detection.d.ts.map +1 -0
  123. package/dist/components/duplicate-detection.js +804 -0
  124. package/dist/components/duplicate-detection.js.map +1 -0
  125. package/dist/components/index.d.ts +16 -0
  126. package/dist/components/index.d.ts.map +1 -0
  127. package/dist/components/index.js +51 -0
  128. package/dist/components/index.js.map +1 -0
  129. package/dist/components/near-duplicate.d.ts +402 -0
  130. package/dist/components/near-duplicate.d.ts.map +1 -0
  131. package/dist/components/near-duplicate.js +1090 -0
  132. package/dist/components/near-duplicate.js.map +1 -0
  133. package/dist/components/props-patterns.d.ts +194 -0
  134. package/dist/components/props-patterns.d.ts.map +1 -0
  135. package/dist/components/props-patterns.js +795 -0
  136. package/dist/components/props-patterns.js.map +1 -0
  137. package/dist/components/ref-forwarding.d.ts +250 -0
  138. package/dist/components/ref-forwarding.d.ts.map +1 -0
  139. package/dist/components/ref-forwarding.js +832 -0
  140. package/dist/components/ref-forwarding.js.map +1 -0
  141. package/dist/components/state-patterns.d.ts +291 -0
  142. package/dist/components/state-patterns.d.ts.map +1 -0
  143. package/dist/components/state-patterns.js +970 -0
  144. package/dist/components/state-patterns.js.map +1 -0
  145. package/dist/config/config-validation.d.ts +74 -0
  146. package/dist/config/config-validation.d.ts.map +1 -0
  147. package/dist/config/config-validation.js +446 -0
  148. package/dist/config/config-validation.js.map +1 -0
  149. package/dist/config/default-values.d.ts +72 -0
  150. package/dist/config/default-values.d.ts.map +1 -0
  151. package/dist/config/default-values.js +386 -0
  152. package/dist/config/default-values.js.map +1 -0
  153. package/dist/config/env-naming.d.ts +73 -0
  154. package/dist/config/env-naming.d.ts.map +1 -0
  155. package/dist/config/env-naming.js +429 -0
  156. package/dist/config/env-naming.js.map +1 -0
  157. package/dist/config/environment-detection.d.ts +72 -0
  158. package/dist/config/environment-detection.d.ts.map +1 -0
  159. package/dist/config/environment-detection.js +400 -0
  160. package/dist/config/environment-detection.js.map +1 -0
  161. package/dist/config/feature-flags.d.ts +72 -0
  162. package/dist/config/feature-flags.d.ts.map +1 -0
  163. package/dist/config/feature-flags.js +384 -0
  164. package/dist/config/feature-flags.js.map +1 -0
  165. package/dist/config/index.d.ts +27 -0
  166. package/dist/config/index.d.ts.map +1 -0
  167. package/dist/config/index.js +43 -0
  168. package/dist/config/index.js.map +1 -0
  169. package/dist/config/required-optional.d.ts +71 -0
  170. package/dist/config/required-optional.d.ts.map +1 -0
  171. package/dist/config/required-optional.js +344 -0
  172. package/dist/config/required-optional.js.map +1 -0
  173. package/dist/data-access/connection-pooling.d.ts +63 -0
  174. package/dist/data-access/connection-pooling.d.ts.map +1 -0
  175. package/dist/data-access/connection-pooling.js +297 -0
  176. package/dist/data-access/connection-pooling.js.map +1 -0
  177. package/dist/data-access/dto-patterns.d.ts +64 -0
  178. package/dist/data-access/dto-patterns.d.ts.map +1 -0
  179. package/dist/data-access/dto-patterns.js +291 -0
  180. package/dist/data-access/dto-patterns.js.map +1 -0
  181. package/dist/data-access/index.d.ts +31 -0
  182. package/dist/data-access/index.d.ts.map +1 -0
  183. package/dist/data-access/index.js +49 -0
  184. package/dist/data-access/index.js.map +1 -0
  185. package/dist/data-access/n-plus-one.d.ts +60 -0
  186. package/dist/data-access/n-plus-one.d.ts.map +1 -0
  187. package/dist/data-access/n-plus-one.js +264 -0
  188. package/dist/data-access/n-plus-one.js.map +1 -0
  189. package/dist/data-access/query-patterns.d.ts +64 -0
  190. package/dist/data-access/query-patterns.d.ts.map +1 -0
  191. package/dist/data-access/query-patterns.js +314 -0
  192. package/dist/data-access/query-patterns.js.map +1 -0
  193. package/dist/data-access/repository-pattern.d.ts +62 -0
  194. package/dist/data-access/repository-pattern.d.ts.map +1 -0
  195. package/dist/data-access/repository-pattern.js +257 -0
  196. package/dist/data-access/repository-pattern.js.map +1 -0
  197. package/dist/data-access/transaction-patterns.d.ts +61 -0
  198. package/dist/data-access/transaction-patterns.d.ts.map +1 -0
  199. package/dist/data-access/transaction-patterns.js +277 -0
  200. package/dist/data-access/transaction-patterns.js.map +1 -0
  201. package/dist/data-access/validation-patterns.d.ts +62 -0
  202. package/dist/data-access/validation-patterns.d.ts.map +1 -0
  203. package/dist/data-access/validation-patterns.js +301 -0
  204. package/dist/data-access/validation-patterns.js.map +1 -0
  205. package/dist/documentation/deprecation.d.ts +62 -0
  206. package/dist/documentation/deprecation.d.ts.map +1 -0
  207. package/dist/documentation/deprecation.js +83 -0
  208. package/dist/documentation/deprecation.js.map +1 -0
  209. package/dist/documentation/example-code.d.ts +64 -0
  210. package/dist/documentation/example-code.d.ts.map +1 -0
  211. package/dist/documentation/example-code.js +79 -0
  212. package/dist/documentation/example-code.js.map +1 -0
  213. package/dist/documentation/index.d.ts +22 -0
  214. package/dist/documentation/index.d.ts.map +1 -0
  215. package/dist/documentation/index.js +19 -0
  216. package/dist/documentation/index.js.map +1 -0
  217. package/dist/documentation/jsdoc-patterns.d.ts +72 -0
  218. package/dist/documentation/jsdoc-patterns.d.ts.map +1 -0
  219. package/dist/documentation/jsdoc-patterns.js +92 -0
  220. package/dist/documentation/jsdoc-patterns.js.map +1 -0
  221. package/dist/documentation/readme-structure.d.ts +67 -0
  222. package/dist/documentation/readme-structure.d.ts.map +1 -0
  223. package/dist/documentation/readme-structure.js +76 -0
  224. package/dist/documentation/readme-structure.js.map +1 -0
  225. package/dist/documentation/todo-patterns.d.ts +67 -0
  226. package/dist/documentation/todo-patterns.d.ts.map +1 -0
  227. package/dist/documentation/todo-patterns.js +73 -0
  228. package/dist/documentation/todo-patterns.js.map +1 -0
  229. package/dist/errors/async-errors.d.ts +72 -0
  230. package/dist/errors/async-errors.d.ts.map +1 -0
  231. package/dist/errors/async-errors.js +214 -0
  232. package/dist/errors/async-errors.js.map +1 -0
  233. package/dist/errors/circuit-breaker.d.ts +53 -0
  234. package/dist/errors/circuit-breaker.d.ts.map +1 -0
  235. package/dist/errors/circuit-breaker.js +241 -0
  236. package/dist/errors/circuit-breaker.js.map +1 -0
  237. package/dist/errors/error-codes.d.ts +73 -0
  238. package/dist/errors/error-codes.d.ts.map +1 -0
  239. package/dist/errors/error-codes.js +211 -0
  240. package/dist/errors/error-codes.js.map +1 -0
  241. package/dist/errors/error-logging.d.ts +73 -0
  242. package/dist/errors/error-logging.d.ts.map +1 -0
  243. package/dist/errors/error-logging.js +256 -0
  244. package/dist/errors/error-logging.js.map +1 -0
  245. package/dist/errors/error-propagation.d.ts +73 -0
  246. package/dist/errors/error-propagation.d.ts.map +1 -0
  247. package/dist/errors/error-propagation.js +244 -0
  248. package/dist/errors/error-propagation.js.map +1 -0
  249. package/dist/errors/exception-hierarchy.d.ts +75 -0
  250. package/dist/errors/exception-hierarchy.d.ts.map +1 -0
  251. package/dist/errors/exception-hierarchy.js +259 -0
  252. package/dist/errors/exception-hierarchy.js.map +1 -0
  253. package/dist/errors/index.d.ts +31 -0
  254. package/dist/errors/index.d.ts.map +1 -0
  255. package/dist/errors/index.js +49 -0
  256. package/dist/errors/index.js.map +1 -0
  257. package/dist/errors/try-catch-placement.d.ts +73 -0
  258. package/dist/errors/try-catch-placement.d.ts.map +1 -0
  259. package/dist/errors/try-catch-placement.js +214 -0
  260. package/dist/errors/try-catch-placement.js.map +1 -0
  261. package/dist/index.d.ts +221 -0
  262. package/dist/index.d.ts.map +1 -0
  263. package/dist/index.js +245 -0
  264. package/dist/index.js.map +1 -0
  265. package/dist/logging/context-fields.d.ts +48 -0
  266. package/dist/logging/context-fields.d.ts.map +1 -0
  267. package/dist/logging/context-fields.js +160 -0
  268. package/dist/logging/context-fields.js.map +1 -0
  269. package/dist/logging/correlation-ids.d.ts +44 -0
  270. package/dist/logging/correlation-ids.d.ts.map +1 -0
  271. package/dist/logging/correlation-ids.js +144 -0
  272. package/dist/logging/correlation-ids.js.map +1 -0
  273. package/dist/logging/health-checks.d.ts +45 -0
  274. package/dist/logging/health-checks.d.ts.map +1 -0
  275. package/dist/logging/health-checks.js +165 -0
  276. package/dist/logging/health-checks.js.map +1 -0
  277. package/dist/logging/index.d.ts +31 -0
  278. package/dist/logging/index.d.ts.map +1 -0
  279. package/dist/logging/index.js +49 -0
  280. package/dist/logging/index.js.map +1 -0
  281. package/dist/logging/log-levels.d.ts +46 -0
  282. package/dist/logging/log-levels.d.ts.map +1 -0
  283. package/dist/logging/log-levels.js +178 -0
  284. package/dist/logging/log-levels.js.map +1 -0
  285. package/dist/logging/metric-naming.d.ts +46 -0
  286. package/dist/logging/metric-naming.d.ts.map +1 -0
  287. package/dist/logging/metric-naming.js +157 -0
  288. package/dist/logging/metric-naming.js.map +1 -0
  289. package/dist/logging/pii-redaction.d.ts +44 -0
  290. package/dist/logging/pii-redaction.d.ts.map +1 -0
  291. package/dist/logging/pii-redaction.js +166 -0
  292. package/dist/logging/pii-redaction.js.map +1 -0
  293. package/dist/logging/structured-format.d.ts +53 -0
  294. package/dist/logging/structured-format.d.ts.map +1 -0
  295. package/dist/logging/structured-format.js +235 -0
  296. package/dist/logging/structured-format.js.map +1 -0
  297. package/dist/performance/bundle-size.d.ts +79 -0
  298. package/dist/performance/bundle-size.d.ts.map +1 -0
  299. package/dist/performance/bundle-size.js +276 -0
  300. package/dist/performance/bundle-size.js.map +1 -0
  301. package/dist/performance/caching-patterns.d.ts +78 -0
  302. package/dist/performance/caching-patterns.d.ts.map +1 -0
  303. package/dist/performance/caching-patterns.js +257 -0
  304. package/dist/performance/caching-patterns.js.map +1 -0
  305. package/dist/performance/code-splitting.d.ts +86 -0
  306. package/dist/performance/code-splitting.d.ts.map +1 -0
  307. package/dist/performance/code-splitting.js +447 -0
  308. package/dist/performance/code-splitting.js.map +1 -0
  309. package/dist/performance/debounce-throttle.d.ts +75 -0
  310. package/dist/performance/debounce-throttle.d.ts.map +1 -0
  311. package/dist/performance/debounce-throttle.js +232 -0
  312. package/dist/performance/debounce-throttle.js.map +1 -0
  313. package/dist/performance/index.d.ts +28 -0
  314. package/dist/performance/index.d.ts.map +1 -0
  315. package/dist/performance/index.js +39 -0
  316. package/dist/performance/index.js.map +1 -0
  317. package/dist/performance/lazy-loading.d.ts +75 -0
  318. package/dist/performance/lazy-loading.d.ts.map +1 -0
  319. package/dist/performance/lazy-loading.js +233 -0
  320. package/dist/performance/lazy-loading.js.map +1 -0
  321. package/dist/performance/memoization.d.ts +75 -0
  322. package/dist/performance/memoization.d.ts.map +1 -0
  323. package/dist/performance/memoization.js +251 -0
  324. package/dist/performance/memoization.js.map +1 -0
  325. package/dist/registry/detector-registry.d.ts +266 -0
  326. package/dist/registry/detector-registry.d.ts.map +1 -0
  327. package/dist/registry/detector-registry.js +526 -0
  328. package/dist/registry/detector-registry.js.map +1 -0
  329. package/dist/registry/index.d.ts +10 -0
  330. package/dist/registry/index.d.ts.map +1 -0
  331. package/dist/registry/index.js +10 -0
  332. package/dist/registry/index.js.map +1 -0
  333. package/dist/registry/loader.d.ts +232 -0
  334. package/dist/registry/loader.d.ts.map +1 -0
  335. package/dist/registry/loader.js +419 -0
  336. package/dist/registry/loader.js.map +1 -0
  337. package/dist/registry/types.d.ts +111 -0
  338. package/dist/registry/types.d.ts.map +1 -0
  339. package/dist/registry/types.js +19 -0
  340. package/dist/registry/types.js.map +1 -0
  341. package/dist/security/csp-headers.d.ts +78 -0
  342. package/dist/security/csp-headers.d.ts.map +1 -0
  343. package/dist/security/csp-headers.js +401 -0
  344. package/dist/security/csp-headers.js.map +1 -0
  345. package/dist/security/csrf-protection.d.ts +72 -0
  346. package/dist/security/csrf-protection.d.ts.map +1 -0
  347. package/dist/security/csrf-protection.js +344 -0
  348. package/dist/security/csrf-protection.js.map +1 -0
  349. package/dist/security/index.d.ts +30 -0
  350. package/dist/security/index.d.ts.map +1 -0
  351. package/dist/security/index.js +48 -0
  352. package/dist/security/index.js.map +1 -0
  353. package/dist/security/input-sanitization.d.ts +74 -0
  354. package/dist/security/input-sanitization.d.ts.map +1 -0
  355. package/dist/security/input-sanitization.js +373 -0
  356. package/dist/security/input-sanitization.js.map +1 -0
  357. package/dist/security/rate-limiting.d.ts +81 -0
  358. package/dist/security/rate-limiting.d.ts.map +1 -0
  359. package/dist/security/rate-limiting.js +535 -0
  360. package/dist/security/rate-limiting.js.map +1 -0
  361. package/dist/security/secret-management.d.ts +83 -0
  362. package/dist/security/secret-management.d.ts.map +1 -0
  363. package/dist/security/secret-management.js +547 -0
  364. package/dist/security/secret-management.js.map +1 -0
  365. package/dist/security/sql-injection.d.ts +76 -0
  366. package/dist/security/sql-injection.d.ts.map +1 -0
  367. package/dist/security/sql-injection.js +383 -0
  368. package/dist/security/sql-injection.js.map +1 -0
  369. package/dist/security/xss-prevention.d.ts +80 -0
  370. package/dist/security/xss-prevention.d.ts.map +1 -0
  371. package/dist/security/xss-prevention.js +416 -0
  372. package/dist/security/xss-prevention.js.map +1 -0
  373. package/dist/structural/barrel-exports.d.ts +178 -0
  374. package/dist/structural/barrel-exports.d.ts.map +1 -0
  375. package/dist/structural/barrel-exports.js +553 -0
  376. package/dist/structural/barrel-exports.js.map +1 -0
  377. package/dist/structural/circular-deps.d.ts +140 -0
  378. package/dist/structural/circular-deps.d.ts.map +1 -0
  379. package/dist/structural/circular-deps.js +422 -0
  380. package/dist/structural/circular-deps.js.map +1 -0
  381. package/dist/structural/co-location.d.ts +202 -0
  382. package/dist/structural/co-location.d.ts.map +1 -0
  383. package/dist/structural/co-location.js +640 -0
  384. package/dist/structural/co-location.js.map +1 -0
  385. package/dist/structural/directory-structure.d.ts +151 -0
  386. package/dist/structural/directory-structure.d.ts.map +1 -0
  387. package/dist/structural/directory-structure.js +457 -0
  388. package/dist/structural/directory-structure.js.map +1 -0
  389. package/dist/structural/file-naming.d.ts +61 -0
  390. package/dist/structural/file-naming.d.ts.map +1 -0
  391. package/dist/structural/file-naming.js +231 -0
  392. package/dist/structural/file-naming.js.map +1 -0
  393. package/dist/structural/import-ordering.d.ts +212 -0
  394. package/dist/structural/import-ordering.d.ts.map +1 -0
  395. package/dist/structural/import-ordering.js +821 -0
  396. package/dist/structural/import-ordering.js.map +1 -0
  397. package/dist/structural/index.d.ts +23 -0
  398. package/dist/structural/index.d.ts.map +1 -0
  399. package/dist/structural/index.js +26 -0
  400. package/dist/structural/index.js.map +1 -0
  401. package/dist/structural/module-boundaries.d.ts +164 -0
  402. package/dist/structural/module-boundaries.d.ts.map +1 -0
  403. package/dist/structural/module-boundaries.js +616 -0
  404. package/dist/structural/module-boundaries.js.map +1 -0
  405. package/dist/structural/package-boundaries.d.ts +182 -0
  406. package/dist/structural/package-boundaries.d.ts.map +1 -0
  407. package/dist/structural/package-boundaries.js +602 -0
  408. package/dist/structural/package-boundaries.js.map +1 -0
  409. package/dist/styling/class-naming.d.ts +263 -0
  410. package/dist/styling/class-naming.d.ts.map +1 -0
  411. package/dist/styling/class-naming.js +892 -0
  412. package/dist/styling/class-naming.js.map +1 -0
  413. package/dist/styling/color-usage.d.ts +213 -0
  414. package/dist/styling/color-usage.d.ts.map +1 -0
  415. package/dist/styling/color-usage.js +732 -0
  416. package/dist/styling/color-usage.js.map +1 -0
  417. package/dist/styling/design-tokens.d.ts +212 -0
  418. package/dist/styling/design-tokens.d.ts.map +1 -0
  419. package/dist/styling/design-tokens.js +748 -0
  420. package/dist/styling/design-tokens.js.map +1 -0
  421. package/dist/styling/index.d.ts +16 -0
  422. package/dist/styling/index.d.ts.map +1 -0
  423. package/dist/styling/index.js +56 -0
  424. package/dist/styling/index.js.map +1 -0
  425. package/dist/styling/responsive.d.ts +304 -0
  426. package/dist/styling/responsive.d.ts.map +1 -0
  427. package/dist/styling/responsive.js +888 -0
  428. package/dist/styling/responsive.js.map +1 -0
  429. package/dist/styling/spacing-scale.d.ts +248 -0
  430. package/dist/styling/spacing-scale.d.ts.map +1 -0
  431. package/dist/styling/spacing-scale.js +865 -0
  432. package/dist/styling/spacing-scale.js.map +1 -0
  433. package/dist/styling/tailwind-patterns.d.ts +305 -0
  434. package/dist/styling/tailwind-patterns.d.ts.map +1 -0
  435. package/dist/styling/tailwind-patterns.js +1181 -0
  436. package/dist/styling/tailwind-patterns.js.map +1 -0
  437. package/dist/styling/typography.d.ts +281 -0
  438. package/dist/styling/typography.d.ts.map +1 -0
  439. package/dist/styling/typography.js +1004 -0
  440. package/dist/styling/typography.js.map +1 -0
  441. package/dist/styling/z-index-scale.d.ts +270 -0
  442. package/dist/styling/z-index-scale.d.ts.map +1 -0
  443. package/dist/styling/z-index-scale.js +714 -0
  444. package/dist/styling/z-index-scale.js.map +1 -0
  445. package/dist/testing/co-location.d.ts +42 -0
  446. package/dist/testing/co-location.d.ts.map +1 -0
  447. package/dist/testing/co-location.js +134 -0
  448. package/dist/testing/co-location.js.map +1 -0
  449. package/dist/testing/describe-naming.d.ts +47 -0
  450. package/dist/testing/describe-naming.d.ts.map +1 -0
  451. package/dist/testing/describe-naming.js +150 -0
  452. package/dist/testing/describe-naming.js.map +1 -0
  453. package/dist/testing/file-naming.d.ts +44 -0
  454. package/dist/testing/file-naming.d.ts.map +1 -0
  455. package/dist/testing/file-naming.js +131 -0
  456. package/dist/testing/file-naming.js.map +1 -0
  457. package/dist/testing/fixture-patterns.d.ts +52 -0
  458. package/dist/testing/fixture-patterns.d.ts.map +1 -0
  459. package/dist/testing/fixture-patterns.js +228 -0
  460. package/dist/testing/fixture-patterns.js.map +1 -0
  461. package/dist/testing/index.d.ts +31 -0
  462. package/dist/testing/index.d.ts.map +1 -0
  463. package/dist/testing/index.js +49 -0
  464. package/dist/testing/index.js.map +1 -0
  465. package/dist/testing/mock-patterns.d.ts +53 -0
  466. package/dist/testing/mock-patterns.d.ts.map +1 -0
  467. package/dist/testing/mock-patterns.js +264 -0
  468. package/dist/testing/mock-patterns.js.map +1 -0
  469. package/dist/testing/setup-teardown.d.ts +55 -0
  470. package/dist/testing/setup-teardown.d.ts.map +1 -0
  471. package/dist/testing/setup-teardown.js +262 -0
  472. package/dist/testing/setup-teardown.js.map +1 -0
  473. package/dist/testing/test-structure.d.ts +51 -0
  474. package/dist/testing/test-structure.d.ts.map +1 -0
  475. package/dist/testing/test-structure.js +225 -0
  476. package/dist/testing/test-structure.js.map +1 -0
  477. package/dist/types/any-usage.d.ts +99 -0
  478. package/dist/types/any-usage.d.ts.map +1 -0
  479. package/dist/types/any-usage.js +641 -0
  480. package/dist/types/any-usage.js.map +1 -0
  481. package/dist/types/file-location.d.ts +76 -0
  482. package/dist/types/file-location.d.ts.map +1 -0
  483. package/dist/types/file-location.js +395 -0
  484. package/dist/types/file-location.js.map +1 -0
  485. package/dist/types/generic-patterns.d.ts +97 -0
  486. package/dist/types/generic-patterns.d.ts.map +1 -0
  487. package/dist/types/generic-patterns.js +615 -0
  488. package/dist/types/generic-patterns.js.map +1 -0
  489. package/dist/types/index.d.ts +31 -0
  490. package/dist/types/index.d.ts.map +1 -0
  491. package/dist/types/index.js +43 -0
  492. package/dist/types/index.js.map +1 -0
  493. package/dist/types/interface-vs-type.d.ts +81 -0
  494. package/dist/types/interface-vs-type.d.ts.map +1 -0
  495. package/dist/types/interface-vs-type.js +440 -0
  496. package/dist/types/interface-vs-type.js.map +1 -0
  497. package/dist/types/naming-conventions.d.ts +84 -0
  498. package/dist/types/naming-conventions.d.ts.map +1 -0
  499. package/dist/types/naming-conventions.js +455 -0
  500. package/dist/types/naming-conventions.js.map +1 -0
  501. package/dist/types/type-assertions.d.ts +98 -0
  502. package/dist/types/type-assertions.d.ts.map +1 -0
  503. package/dist/types/type-assertions.js +639 -0
  504. package/dist/types/type-assertions.js.map +1 -0
  505. package/dist/types/utility-types.d.ts +110 -0
  506. package/dist/types/utility-types.d.ts.map +1 -0
  507. package/dist/types/utility-types.js +547 -0
  508. package/dist/types/utility-types.js.map +1 -0
  509. package/package.json +44 -0
@@ -0,0 +1,301 @@
1
+ /**
2
+ * Validation Patterns Detector - Input validation pattern detection
3
+ *
4
+ * Detects validation patterns including:
5
+ * - Schema validation (Zod, Yup, Joi)
6
+ * - Class validator decorators
7
+ * - Manual validation patterns
8
+ * - Validation middleware
9
+ *
10
+ * @requirements 13.4 - Validation pattern detection
11
+ */
12
+ import { RegexDetector } from '../base/regex-detector.js';
13
+ // ============================================================================
14
+ // Patterns
15
+ // ============================================================================
16
+ export const ZOD_PATTERNS = [
17
+ /z\.object\s*\(\s*\{/gi,
18
+ /z\.string\s*\(\s*\)/gi,
19
+ /z\.number\s*\(\s*\)/gi,
20
+ /z\.array\s*\(/gi,
21
+ /z\.enum\s*\(/gi,
22
+ /\.parse\s*\(/gi,
23
+ /\.safeParse\s*\(/gi,
24
+ ];
25
+ export const YUP_PATTERNS = [
26
+ /yup\.object\s*\(\s*\{/gi,
27
+ /yup\.string\s*\(\s*\)/gi,
28
+ /yup\.number\s*\(\s*\)/gi,
29
+ /\.validate\s*\(/gi,
30
+ /\.validateSync\s*\(/gi,
31
+ ];
32
+ export const JOI_PATTERNS = [
33
+ /Joi\.object\s*\(\s*\{/gi,
34
+ /Joi\.string\s*\(\s*\)/gi,
35
+ /Joi\.number\s*\(\s*\)/gi,
36
+ /\.validate\s*\(/gi,
37
+ ];
38
+ export const CLASS_VALIDATOR_PATTERNS = [
39
+ // JavaScript/TypeScript
40
+ /@IsString\s*\(/gi,
41
+ /@IsNumber\s*\(/gi,
42
+ /@IsEmail\s*\(/gi,
43
+ /@IsNotEmpty\s*\(/gi,
44
+ /@ValidateNested\s*\(/gi,
45
+ /@IsOptional\s*\(/gi,
46
+ /@Min\s*\(/gi,
47
+ /@Max\s*\(/gi,
48
+ // Python Pydantic
49
+ /Field\s*\(/gi,
50
+ /validator\s*\(/gi,
51
+ /@validator\s*\(/gi,
52
+ /@field_validator\s*\(/gi,
53
+ /constr\s*\(/gi,
54
+ /conint\s*\(/gi,
55
+ /confloat\s*\(/gi,
56
+ /EmailStr/gi,
57
+ /HttpUrl/gi,
58
+ ];
59
+ export const MANUAL_VALIDATION_PATTERNS = [
60
+ // JavaScript/TypeScript
61
+ /if\s*\(\s*!?\w+\s*(?:===?|!==?)\s*(?:undefined|null|''|"")\s*\)/gi,
62
+ /typeof\s+\w+\s*(?:===?|!==?)\s*['"`](?:string|number|boolean)['"`]/gi,
63
+ /Array\.isArray\s*\(/gi,
64
+ /Number\.isNaN\s*\(/gi,
65
+ /Number\.isFinite\s*\(/gi,
66
+ // Python
67
+ /isinstance\s*\(\s*\w+\s*,\s*(?:str|int|float|bool|list|dict)/gi,
68
+ /if\s+\w+\s+is\s+(?:None|not\s+None)/gi,
69
+ /if\s+not\s+\w+\s*:/gi,
70
+ /type\s*\(\s*\w+\s*\)\s*(?:==|is)/gi,
71
+ ];
72
+ export const VALIDATION_MIDDLEWARE_PATTERNS = [
73
+ /validateRequest\s*\(/gi,
74
+ /validateBody\s*\(/gi,
75
+ /validateQuery\s*\(/gi,
76
+ /validateParams\s*\(/gi,
77
+ /express-validator/gi,
78
+ ];
79
+ // ============================================================================
80
+ // Analysis Functions
81
+ // ============================================================================
82
+ export function shouldExcludeFile(filePath) {
83
+ const excludePatterns = [
84
+ /\.test\.[jt]sx?$/,
85
+ /\.spec\.[jt]sx?$/,
86
+ /__tests__\//,
87
+ /\.d\.ts$/,
88
+ /node_modules\//,
89
+ ];
90
+ return excludePatterns.some((p) => p.test(filePath));
91
+ }
92
+ export function detectZodSchemas(content) {
93
+ const results = [];
94
+ const lines = content.split('\n');
95
+ for (let i = 0; i < lines.length; i++) {
96
+ const line = lines[i];
97
+ for (const pattern of ZOD_PATTERNS) {
98
+ const regex = new RegExp(pattern.source, pattern.flags);
99
+ let match;
100
+ while ((match = regex.exec(line)) !== null) {
101
+ results.push({
102
+ type: 'zod-schema',
103
+ line: i + 1,
104
+ column: match.index + 1,
105
+ match: match[0],
106
+ library: 'zod',
107
+ });
108
+ }
109
+ }
110
+ }
111
+ return results;
112
+ }
113
+ export function detectYupSchemas(content) {
114
+ const results = [];
115
+ const lines = content.split('\n');
116
+ for (let i = 0; i < lines.length; i++) {
117
+ const line = lines[i];
118
+ for (const pattern of YUP_PATTERNS) {
119
+ const regex = new RegExp(pattern.source, pattern.flags);
120
+ let match;
121
+ while ((match = regex.exec(line)) !== null) {
122
+ results.push({
123
+ type: 'yup-schema',
124
+ line: i + 1,
125
+ column: match.index + 1,
126
+ match: match[0],
127
+ library: 'yup',
128
+ });
129
+ }
130
+ }
131
+ }
132
+ return results;
133
+ }
134
+ export function detectJoiSchemas(content) {
135
+ const results = [];
136
+ const lines = content.split('\n');
137
+ for (let i = 0; i < lines.length; i++) {
138
+ const line = lines[i];
139
+ for (const pattern of JOI_PATTERNS) {
140
+ const regex = new RegExp(pattern.source, pattern.flags);
141
+ let match;
142
+ while ((match = regex.exec(line)) !== null) {
143
+ results.push({
144
+ type: 'joi-schema',
145
+ line: i + 1,
146
+ column: match.index + 1,
147
+ match: match[0],
148
+ library: 'joi',
149
+ });
150
+ }
151
+ }
152
+ }
153
+ return results;
154
+ }
155
+ export function detectClassValidators(content) {
156
+ const results = [];
157
+ const lines = content.split('\n');
158
+ for (let i = 0; i < lines.length; i++) {
159
+ const line = lines[i];
160
+ for (const pattern of CLASS_VALIDATOR_PATTERNS) {
161
+ const regex = new RegExp(pattern.source, pattern.flags);
162
+ let match;
163
+ while ((match = regex.exec(line)) !== null) {
164
+ results.push({
165
+ type: 'class-validator',
166
+ line: i + 1,
167
+ column: match.index + 1,
168
+ match: match[0],
169
+ library: 'class-validator',
170
+ });
171
+ }
172
+ }
173
+ }
174
+ return results;
175
+ }
176
+ export function detectManualValidation(content) {
177
+ const results = [];
178
+ const lines = content.split('\n');
179
+ for (let i = 0; i < lines.length; i++) {
180
+ const line = lines[i];
181
+ for (const pattern of MANUAL_VALIDATION_PATTERNS) {
182
+ const regex = new RegExp(pattern.source, pattern.flags);
183
+ let match;
184
+ while ((match = regex.exec(line)) !== null) {
185
+ results.push({
186
+ type: 'manual-validation',
187
+ line: i + 1,
188
+ column: match.index + 1,
189
+ match: match[0],
190
+ });
191
+ }
192
+ }
193
+ }
194
+ return results;
195
+ }
196
+ export function detectValidationMiddleware(content) {
197
+ const results = [];
198
+ const lines = content.split('\n');
199
+ for (let i = 0; i < lines.length; i++) {
200
+ const line = lines[i];
201
+ for (const pattern of VALIDATION_MIDDLEWARE_PATTERNS) {
202
+ const regex = new RegExp(pattern.source, pattern.flags);
203
+ let match;
204
+ while ((match = regex.exec(line)) !== null) {
205
+ results.push({
206
+ type: 'validation-middleware',
207
+ line: i + 1,
208
+ column: match.index + 1,
209
+ match: match[0],
210
+ });
211
+ }
212
+ }
213
+ }
214
+ return results;
215
+ }
216
+ export function analyzeValidationPatterns(content, filePath) {
217
+ if (shouldExcludeFile(filePath)) {
218
+ return {
219
+ patterns: [],
220
+ violations: [],
221
+ dominantLibrary: null,
222
+ hasValidation: false,
223
+ };
224
+ }
225
+ const patterns = [
226
+ ...detectZodSchemas(content),
227
+ ...detectYupSchemas(content),
228
+ ...detectJoiSchemas(content),
229
+ ...detectClassValidators(content),
230
+ ...detectManualValidation(content),
231
+ ...detectValidationMiddleware(content),
232
+ ];
233
+ const violations = [];
234
+ // Determine dominant library
235
+ const libraryCounts = new Map();
236
+ for (const pattern of patterns) {
237
+ if (pattern.library) {
238
+ libraryCounts.set(pattern.library, (libraryCounts.get(pattern.library) || 0) + 1);
239
+ }
240
+ }
241
+ let dominantLibrary = null;
242
+ let maxCount = 0;
243
+ for (const [lib, count] of libraryCounts) {
244
+ if (count > maxCount) {
245
+ maxCount = count;
246
+ dominantLibrary = lib;
247
+ }
248
+ }
249
+ // Check for inconsistent validation libraries
250
+ if (libraryCounts.size > 1) {
251
+ violations.push({
252
+ type: 'inconsistent-validation',
253
+ line: 1,
254
+ column: 1,
255
+ match: '',
256
+ message: `Multiple validation libraries detected: ${[...libraryCounts.keys()].join(', ')}`,
257
+ });
258
+ }
259
+ return {
260
+ patterns,
261
+ violations,
262
+ dominantLibrary,
263
+ hasValidation: patterns.length > 0,
264
+ };
265
+ }
266
+ // ============================================================================
267
+ // Detector Class
268
+ // ============================================================================
269
+ export class ValidationPatternsDetector extends RegexDetector {
270
+ id = 'data-access/validation-patterns';
271
+ name = 'Validation Patterns Detector';
272
+ description = 'Detects input validation patterns and identifies inconsistencies';
273
+ category = 'data-access';
274
+ subcategory = 'validation-patterns';
275
+ supportedLanguages = ['typescript', 'javascript', 'python'];
276
+ async detect(context) {
277
+ if (!this.supportsLanguage(context.language)) {
278
+ return this.createEmptyResult();
279
+ }
280
+ const analysis = analyzeValidationPatterns(context.content, context.file);
281
+ if (analysis.patterns.length === 0 && analysis.violations.length === 0) {
282
+ return this.createEmptyResult();
283
+ }
284
+ const confidence = analysis.hasValidation ? 0.9 : 0.7;
285
+ return this.createResult([], [], confidence, {
286
+ custom: {
287
+ patterns: analysis.patterns,
288
+ violations: analysis.violations,
289
+ dominantLibrary: analysis.dominantLibrary,
290
+ hasValidation: analysis.hasValidation,
291
+ },
292
+ });
293
+ }
294
+ generateQuickFix(_violation) {
295
+ return null;
296
+ }
297
+ }
298
+ export function createValidationPatternsDetector() {
299
+ return new ValidationPatternsDetector();
300
+ }
301
+ //# sourceMappingURL=validation-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-patterns.js","sourceRoot":"","sources":["../../src/data-access/validation-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA2C1D,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,uBAAuB;IACvB,uBAAuB;IACvB,uBAAuB;IACvB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,oBAAoB;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,mBAAmB;IACnB,uBAAuB;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;IACzB,m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EAAE;gBACN,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,eAAe,EAAE,QAAQ,CAAC,eAAe;gBACzC,aAAa,EAAE,QAAQ,CAAC,aAAa;aACtC;SACF,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB,CAAC,UAAqB;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,gCAAgC;IAC9C,OAAO,IAAI,0BAA0B,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Deprecation Detector - Deprecation pattern detection
3
+ * @requirements 21.4 - Deprecation patterns
4
+ */
5
+ import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
6
+ import { RegexDetector } from '../base/regex-detector.js';
7
+ import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
8
+ export type DeprecationPatternType = 'jsdoc-deprecated' | 'decorator-deprecated' | 'console-warn' | 'deprecation-notice' | 'legacy-marker';
9
+ export type DeprecationViolationType = 'missing-alternative' | 'missing-removal-date';
10
+ export interface DeprecationPatternInfo {
11
+ type: DeprecationPatternType;
12
+ file: string;
13
+ line: number;
14
+ column: number;
15
+ matchedText: string;
16
+ alternative?: string | undefined;
17
+ context?: string | undefined;
18
+ }
19
+ export interface DeprecationViolationInfo {
20
+ type: DeprecationViolationType;
21
+ file: string;
22
+ line: number;
23
+ column: number;
24
+ matchedText: string;
25
+ issue: string;
26
+ suggestedFix?: string | undefined;
27
+ severity: 'high' | 'medium' | 'low';
28
+ }
29
+ export interface DeprecationAnalysis {
30
+ patterns: DeprecationPatternInfo[];
31
+ violations: DeprecationViolationInfo[];
32
+ deprecatedCount: number;
33
+ hasAlternatives: boolean;
34
+ confidence: number;
35
+ }
36
+ export declare const JSDOC_DEPRECATED_PATTERNS: readonly [RegExp, RegExp];
37
+ export declare const DECORATOR_DEPRECATED_PATTERNS: readonly [RegExp, RegExp];
38
+ export declare const CONSOLE_WARN_PATTERNS: readonly [RegExp, RegExp];
39
+ export declare const DEPRECATION_NOTICE_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
40
+ export declare const LEGACY_MARKER_PATTERNS: readonly [RegExp, RegExp, RegExp];
41
+ export declare const PYTHON_DEPRECATED_DECORATOR_PATTERNS: readonly [RegExp, RegExp, RegExp];
42
+ export declare const PYTHON_WARNINGS_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
43
+ export declare const PYTHON_DOCSTRING_DEPRECATED_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
44
+ export declare function shouldExcludeFile(filePath: string): boolean;
45
+ export declare function detectJsdocDeprecated(content: string, filePath: string): DeprecationPatternInfo[];
46
+ export declare function detectDecoratorDeprecated(content: string, filePath: string): DeprecationPatternInfo[];
47
+ export declare function detectConsoleWarn(content: string, filePath: string): DeprecationPatternInfo[];
48
+ export declare function detectDeprecationNotice(content: string, filePath: string): DeprecationPatternInfo[];
49
+ export declare function detectLegacyMarker(content: string, filePath: string): DeprecationPatternInfo[];
50
+ export declare function analyzeDeprecation(content: string, filePath: string): DeprecationAnalysis;
51
+ export declare class DeprecationDetector extends RegexDetector {
52
+ readonly id = "documentation/deprecation";
53
+ readonly name = "Deprecation Detector";
54
+ readonly description = "Detects deprecation patterns and notices";
55
+ readonly category: PatternCategory;
56
+ readonly subcategory = "deprecation";
57
+ readonly supportedLanguages: Language[];
58
+ detect(context: DetectionContext): Promise<DetectionResult>;
59
+ generateQuickFix(_violation: Violation): QuickFix | null;
60
+ }
61
+ export declare function createDeprecationDetector(): DeprecationDetector;
62
+ //# sourceMappingURL=deprecation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../src/documentation/deprecation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,C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E,SAAS,GAAG,QAAQ,GAAG,IAAI;CACzD;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAAsC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Deprecation Detector - Deprecation pattern detection
3
+ * @requirements 21.4 - Deprecation patterns
4
+ */
5
+ import { RegexDetector } from '../base/regex-detector.js';
6
+ // JavaScript/TypeScript deprecation patterns
7
+ export const JSDOC_DEPRECATED_PATTERNS = [/@deprecated/gi, /\*\s*@deprecated\s+(.+)/g];
8
+ export const DECORATOR_DEPRECATED_PATTERNS = [/@Deprecated\s*\(/g, /@deprecated\s*\(/g];
9
+ export const CONSOLE_WARN_PATTERNS = [/console\.warn\s*\([^)]*deprecat/gi, /console\.warn\s*\([^)]*will be removed/gi];
10
+ export const DEPRECATION_NOTICE_PATTERNS = [/DEPRECATED/g, /deprecated/g, /will be removed/gi, /no longer supported/gi];
11
+ export const LEGACY_MARKER_PATTERNS = [/legacy/gi, /old\s+api/gi, /v1\s+api/gi];
12
+ // Python deprecation patterns
13
+ export const PYTHON_DEPRECATED_DECORATOR_PATTERNS = [/@deprecated/g, /@deprecation\.deprecated/g, /@typing\.deprecated/g];
14
+ export const PYTHON_WARNINGS_PATTERNS = [/warnings\.warn\s*\([^)]*deprecat/gi, /warnings\.warn\s*\([^)]*will be removed/gi, /DeprecationWarning/g, /PendingDeprecationWarning/g];
15
+ export const PYTHON_DOCSTRING_DEPRECATED_PATTERNS = [/"""[^"]*deprecated[^"]*"""/gi, /'''[^']*deprecated[^']*'''/gi, /:deprecated:/gi, /\.\.\s*deprecated::/gi];
16
+ export function shouldExcludeFile(filePath) {
17
+ return [/\.test\.[jt]sx?$/, /\.spec\.[jt]sx?$/, /__tests__\//, /node_modules\//, /\.min\.[jt]s$/, /test_.*\.py$/, /_test\.py$/, /__pycache__\//, /\.pyc$/].some((p) => p.test(filePath));
18
+ }
19
+ function detectPythonDeprecatedDecorator(content, filePath) {
20
+ return detectPatterns(content, filePath, PYTHON_DEPRECATED_DECORATOR_PATTERNS, 'decorator-deprecated');
21
+ }
22
+ function detectPythonWarnings(content, filePath) {
23
+ return detectPatterns(content, filePath, PYTHON_WARNINGS_PATTERNS, 'console-warn');
24
+ }
25
+ function detectPythonDocstringDeprecated(content, filePath) {
26
+ return detectPatterns(content, filePath, PYTHON_DOCSTRING_DEPRECATED_PATTERNS, 'jsdoc-deprecated');
27
+ }
28
+ function detectPatterns(content, filePath, patterns, type) {
29
+ const results = [];
30
+ const lines = content.split('\n');
31
+ for (let i = 0; i < lines.length; i++) {
32
+ const line = lines[i];
33
+ for (const pattern of patterns) {
34
+ const regex = new RegExp(pattern.source, pattern.flags);
35
+ let match;
36
+ while ((match = regex.exec(line)) !== null) {
37
+ const altMatch = line.match(/use\s+(\w+)\s+instead/i) || line.match(/replaced\s+by\s+(\w+)/i);
38
+ results.push({ type, file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], alternative: altMatch ? altMatch[1] : undefined, context: line.trim() });
39
+ }
40
+ }
41
+ }
42
+ return results;
43
+ }
44
+ export function detectJsdocDeprecated(content, filePath) { return detectPatterns(content, filePath, JSDOC_DEPRECATED_PATTERNS, 'jsdoc-deprecated'); }
45
+ export function detectDecoratorDeprecated(content, filePath) { return detectPatterns(content, filePath, DECORATOR_DEPRECATED_PATTERNS, 'decorator-deprecated'); }
46
+ export function detectConsoleWarn(content, filePath) { return detectPatterns(content, filePath, CONSOLE_WARN_PATTERNS, 'console-warn'); }
47
+ export function detectDeprecationNotice(content, filePath) { return detectPatterns(content, filePath, DEPRECATION_NOTICE_PATTERNS, 'deprecation-notice'); }
48
+ export function detectLegacyMarker(content, filePath) { return detectPatterns(content, filePath, LEGACY_MARKER_PATTERNS, 'legacy-marker'); }
49
+ export function analyzeDeprecation(content, filePath) {
50
+ if (shouldExcludeFile(filePath))
51
+ return { patterns: [], violations: [], deprecatedCount: 0, hasAlternatives: false, confidence: 1.0 };
52
+ const isPython = filePath.endsWith('.py');
53
+ const patterns = isPython
54
+ ? [...detectPythonDeprecatedDecorator(content, filePath), ...detectPythonWarnings(content, filePath), ...detectPythonDocstringDeprecated(content, filePath), ...detectDeprecationNotice(content, filePath), ...detectLegacyMarker(content, filePath)]
55
+ : [...detectJsdocDeprecated(content, filePath), ...detectDecoratorDeprecated(content, filePath), ...detectConsoleWarn(content, filePath), ...detectDeprecationNotice(content, filePath), ...detectLegacyMarker(content, filePath)];
56
+ const violations = [];
57
+ const deprecatedCount = patterns.length;
58
+ const hasAlternatives = patterns.some((p) => p.alternative);
59
+ let confidence = 0.7;
60
+ if (patterns.length > 0)
61
+ confidence += 0.2;
62
+ confidence = Math.min(confidence, 0.95);
63
+ return { patterns, violations, deprecatedCount, hasAlternatives, confidence };
64
+ }
65
+ export class DeprecationDetector extends RegexDetector {
66
+ id = 'documentation/deprecation';
67
+ name = 'Deprecation Detector';
68
+ description = 'Detects deprecation patterns and notices';
69
+ category = 'documentation';
70
+ subcategory = 'deprecation';
71
+ supportedLanguages = ['typescript', 'javascript', 'python'];
72
+ async detect(context) {
73
+ if (!this.supportsLanguage(context.language))
74
+ return this.createEmptyResult();
75
+ const analysis = analyzeDeprecation(context.content, context.file);
76
+ if (analysis.patterns.length === 0 && analysis.violations.length === 0)
77
+ return this.createEmptyResult();
78
+ return this.createResult([], [], analysis.confidence, { custom: { patterns: analysis.patterns, violations: analysis.violations, deprecatedCount: analysis.deprecatedCount, hasAlternatives: analysis.hasAlternatives } });
79
+ }
80
+ generateQuickFix(_violation) { return null; }
81
+ }
82
+ export function createDeprecationDetector() { return new DeprecationDetector(); }
83
+ //# sourceMappingURL=deprecation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecation.js","sourceRoot":"","sources":["../../src/documentation/deprecation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D,6CAA6C;AAC7C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,eAAe,EAAE,0BAA0B,CAA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;IAEjF,KAAK,CAAC,MAAM,CAAC,OAAyB;QACpC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9E,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACnE,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxG,OAAO,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC5N,CAAC;IAED,gBAAgB,CAAC,UAAqB,IAAqB,OAAO,IAAI,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,UAAU,yBAAyB,KAA0B,OAAO,IAAI,mBAAmB,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Example Code Detector - Example code pattern detection
3
+ * @requirements 21.5 - Example code patterns
4
+ */
5
+ import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
6
+ import { RegexDetector } from '../base/regex-detector.js';
7
+ import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
8
+ export type ExampleCodePatternType = 'code-block' | 'inline-code' | 'example-tag' | 'usage-example' | 'snippet' | 'demo-code';
9
+ export type ExampleCodeViolationType = 'missing-example' | 'outdated-example';
10
+ export interface ExampleCodePatternInfo {
11
+ type: ExampleCodePatternType;
12
+ file: string;
13
+ line: number;
14
+ column: number;
15
+ matchedText: string;
16
+ language?: string | undefined;
17
+ context?: string | undefined;
18
+ }
19
+ export interface ExampleCodeViolationInfo {
20
+ type: ExampleCodeViolationType;
21
+ file: string;
22
+ line: number;
23
+ column: number;
24
+ matchedText: string;
25
+ issue: string;
26
+ suggestedFix?: string | undefined;
27
+ severity: 'high' | 'medium' | 'low';
28
+ }
29
+ export interface ExampleCodeAnalysis {
30
+ patterns: ExampleCodePatternInfo[];
31
+ violations: ExampleCodeViolationInfo[];
32
+ codeBlockCount: number;
33
+ hasExamples: boolean;
34
+ confidence: number;
35
+ }
36
+ export declare const CODE_BLOCK_PATTERNS: readonly [RegExp, RegExp];
37
+ export declare const INLINE_CODE_PATTERNS: readonly [RegExp];
38
+ export declare const EXAMPLE_TAG_PATTERNS: readonly [RegExp, RegExp];
39
+ export declare const USAGE_EXAMPLE_PATTERNS: readonly [RegExp, RegExp, RegExp];
40
+ export declare const SNIPPET_PATTERNS: readonly [RegExp, RegExp];
41
+ export declare const DEMO_CODE_PATTERNS: readonly [RegExp, RegExp];
42
+ export declare const PYTHON_DOCTEST_PATTERNS: readonly [RegExp];
43
+ export declare const PYTHON_EXAMPLE_SECTION_PATTERNS: readonly [RegExp, RegExp];
44
+ export declare const PYTHON_USAGE_COMMENT_PATTERNS: readonly [RegExp, RegExp];
45
+ export declare function shouldExcludeFile(filePath: string): boolean;
46
+ export declare function detectCodeBlock(content: string, filePath: string): ExampleCodePatternInfo[];
47
+ export declare function detectInlineCode(content: string, filePath: string): ExampleCodePatternInfo[];
48
+ export declare function detectExampleTag(content: string, filePath: string): ExampleCodePatternInfo[];
49
+ export declare function detectUsageExample(content: string, filePath: string): ExampleCodePatternInfo[];
50
+ export declare function detectSnippet(content: string, filePath: string): ExampleCodePatternInfo[];
51
+ export declare function detectDemoCode(content: string, filePath: string): ExampleCodePatternInfo[];
52
+ export declare function analyzeExampleCode(content: string, filePath: string): ExampleCodeAnalysis;
53
+ export declare class ExampleCodeDetector extends RegexDetector {
54
+ readonly id = "documentation/example-code";
55
+ readonly name = "Example Code Detector";
56
+ readonly description = "Detects example code patterns in documentation";
57
+ readonly category: PatternCategory;
58
+ readonly subcategory = "example-code";
59
+ readonly supportedLanguages: Language[];
60
+ detect(context: DetectionContext): Promise<DetectionResult>;
61
+ generateQuickFix(_violation: Violation): QuickFix | null;
62
+ }
63
+ export declare function createExampleCodeDetector(): ExampleCodeDetector;
64
+ //# sourceMappingURL=example-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-code.d.ts","sourceRoot":"","sources":["../../src/documentation/example-code.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,aAAa,GAAG,aAAa,GAAG,eAAe,GAAG,SAAS,GAAG,WAAW,CAAC;AAC9H,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAE9E,MAAM,WAAW,sBAAsB;IAAG,IAAI,EAAE,sBAAsB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAAE;AACvM,MAAM,WAAW,wBAAwB;IAAG,IAAI,EAAE,wBAAwB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,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AAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAA2E;AACrK,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAA+E;AAE1K,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAWzF;AAED,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,QAAQ,CAAC,EAAE,gCAAgC;IAC3C,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,WAAW,oDAAoD;IACxE,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAmB;IACrD,QAAQ,CAAC,WAAW,kBAAkB;IACtC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAsD;IAEvF,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAOjE,gBAAgB,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI;CACzD;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAAsC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Example Code Detector - Example code pattern detection
3
+ * @requirements 21.5 - Example code patterns
4
+ */
5
+ import { RegexDetector } from '../base/regex-detector.js';
6
+ // JavaScript/TypeScript example patterns
7
+ export const CODE_BLOCK_PATTERNS = [/```(\w+)?[\s\S]*?```/g, /~~~(\w+)?[\s\S]*?~~~/g];
8
+ export const INLINE_CODE_PATTERNS = [/`[^`]+`/g];
9
+ export const EXAMPLE_TAG_PATTERNS = [/@example/g, /\*\s*@example/g];
10
+ export const USAGE_EXAMPLE_PATTERNS = [/\/\/\s*Example:/gi, /\/\/\s*Usage:/gi, /\/\*\s*Example:/gi];
11
+ export const SNIPPET_PATTERNS = [/snippet/gi, /sample/gi];
12
+ export const DEMO_CODE_PATTERNS = [/demo/gi, /playground/gi];
13
+ // Python example patterns
14
+ export const PYTHON_DOCTEST_PATTERNS = [/>>>\s+.+/g];
15
+ export const PYTHON_EXAMPLE_SECTION_PATTERNS = [/Examples?:\s*\n/g, /Example usage:/gi];
16
+ export const PYTHON_USAGE_COMMENT_PATTERNS = [/#\s*Example:/gi, /#\s*Usage:/gi];
17
+ export function shouldExcludeFile(filePath) {
18
+ return [/node_modules\//, /\.min\.[jt]s$/, /__pycache__\//, /\.pyc$/].some((p) => p.test(filePath));
19
+ }
20
+ // Python example detection functions
21
+ function detectPythonDoctest(content, filePath) { return detectPatterns(content, filePath, PYTHON_DOCTEST_PATTERNS, 'usage-example'); }
22
+ function detectPythonExampleSection(content, filePath) { return detectPatterns(content, filePath, PYTHON_EXAMPLE_SECTION_PATTERNS, 'example-tag'); }
23
+ function detectPythonUsageComment(content, filePath) { return detectPatterns(content, filePath, PYTHON_USAGE_COMMENT_PATTERNS, 'usage-example'); }
24
+ function detectPatterns(content, filePath, patterns, type) {
25
+ const results = [];
26
+ const lines = content.split('\n');
27
+ for (let i = 0; i < lines.length; i++) {
28
+ const line = lines[i];
29
+ for (const pattern of patterns) {
30
+ const regex = new RegExp(pattern.source, pattern.flags);
31
+ let match;
32
+ while ((match = regex.exec(line)) !== null) {
33
+ results.push({ type, file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0].slice(0, 50), language: match[1], context: line.trim() });
34
+ }
35
+ }
36
+ }
37
+ return results;
38
+ }
39
+ export function detectCodeBlock(content, filePath) { return detectPatterns(content, filePath, CODE_BLOCK_PATTERNS, 'code-block'); }
40
+ export function detectInlineCode(content, filePath) { return detectPatterns(content, filePath, INLINE_CODE_PATTERNS, 'inline-code'); }
41
+ export function detectExampleTag(content, filePath) { return detectPatterns(content, filePath, EXAMPLE_TAG_PATTERNS, 'example-tag'); }
42
+ export function detectUsageExample(content, filePath) { return detectPatterns(content, filePath, USAGE_EXAMPLE_PATTERNS, 'usage-example'); }
43
+ export function detectSnippet(content, filePath) { return detectPatterns(content, filePath, SNIPPET_PATTERNS, 'snippet'); }
44
+ export function detectDemoCode(content, filePath) { return detectPatterns(content, filePath, DEMO_CODE_PATTERNS, 'demo-code'); }
45
+ export function analyzeExampleCode(content, filePath) {
46
+ if (shouldExcludeFile(filePath))
47
+ return { patterns: [], violations: [], codeBlockCount: 0, hasExamples: false, confidence: 1.0 };
48
+ const isPython = filePath.endsWith('.py');
49
+ const patterns = isPython
50
+ ? [...detectCodeBlock(content, filePath), ...detectInlineCode(content, filePath), ...detectPythonDoctest(content, filePath), ...detectPythonExampleSection(content, filePath), ...detectPythonUsageComment(content, filePath), ...detectSnippet(content, filePath), ...detectDemoCode(content, filePath)]
51
+ : [...detectCodeBlock(content, filePath), ...detectInlineCode(content, filePath), ...detectExampleTag(content, filePath), ...detectUsageExample(content, filePath), ...detectSnippet(content, filePath), ...detectDemoCode(content, filePath)];
52
+ const violations = [];
53
+ const codeBlockCount = patterns.filter((p) => p.type === 'code-block').length;
54
+ const hasExamples = patterns.some((p) => p.type === 'example-tag' || p.type === 'usage-example');
55
+ let confidence = 0.7;
56
+ if (patterns.length > 0)
57
+ confidence += 0.2;
58
+ confidence = Math.min(confidence, 0.95);
59
+ return { patterns, violations, codeBlockCount, hasExamples, confidence };
60
+ }
61
+ export class ExampleCodeDetector extends RegexDetector {
62
+ id = 'documentation/example-code';
63
+ name = 'Example Code Detector';
64
+ description = 'Detects example code patterns in documentation';
65
+ category = 'documentation';
66
+ subcategory = 'example-code';
67
+ supportedLanguages = ['typescript', 'javascript', 'markdown', 'python'];
68
+ async detect(context) {
69
+ if (!this.supportsLanguage(context.language))
70
+ return this.createEmptyResult();
71
+ const analysis = analyzeExampleCode(context.content, context.file);
72
+ if (analysis.patterns.length === 0 && analysis.violations.length === 0)
73
+ return this.createEmptyResult();
74
+ return this.createResult([], [], analysis.confidence, { custom: { patterns: analysis.patterns, violations: analysis.violations, codeBlockCount: analysis.codeBlockCount, hasExamples: analysis.hasExamples } });
75
+ }
76
+ generateQuickFix(_violation) { return null; }
77
+ }
78
+ export function createExampleCodeDetector() { return new ExampleCodeDetector(); }
79
+ //# sourceMappingURL=example-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-code.js","sourceRoot":"","sources":["../../src/documentation/example-code.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D,yCAAyC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,uBAAuB,EAAE,uBAAuB,CAAU,CAAC;AAC/F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAU,CAAU,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAAW,EAAE,gBAAgB,CAAU,CAAC;AAC7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,mBAAmB,CAAU,CAAC;AAC7G,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,UAAU,CAAU,CAAC;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAU,CAAC;AAEtE,0BAA0B;AAC1B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,WAAW,CAAU,CAAC;AAC9D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,CAAU,CAAC;AACjG,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAU,CAAC;AAEzF,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,CAAC,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtG,CAAC;AAED,qCAAqC;AACrC,SAAS,mBAAmB,CAAC,OAAe,EAAE,QAAgB,IAA8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