driftdetect-core 0.5.0 → 0.6.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 (350) hide show
  1. package/dist/boundaries/types.d.ts +1 -1
  2. package/dist/boundaries/types.d.ts.map +1 -1
  3. package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -1
  4. package/dist/call-graph/analysis/graph-builder.js +1 -0
  5. package/dist/call-graph/analysis/graph-builder.js.map +1 -1
  6. package/dist/call-graph/extractors/go-data-access-extractor.d.ts +80 -0
  7. package/dist/call-graph/extractors/go-data-access-extractor.d.ts.map +1 -0
  8. package/dist/call-graph/extractors/go-data-access-extractor.js +457 -0
  9. package/dist/call-graph/extractors/go-data-access-extractor.js.map +1 -0
  10. package/dist/call-graph/extractors/go-extractor.d.ts +103 -0
  11. package/dist/call-graph/extractors/go-extractor.d.ts.map +1 -0
  12. package/dist/call-graph/extractors/go-extractor.js +509 -0
  13. package/dist/call-graph/extractors/go-extractor.js.map +1 -0
  14. package/dist/call-graph/extractors/go-hybrid-extractor.d.ts +97 -0
  15. package/dist/call-graph/extractors/go-hybrid-extractor.d.ts.map +1 -0
  16. package/dist/call-graph/extractors/go-hybrid-extractor.js +496 -0
  17. package/dist/call-graph/extractors/go-hybrid-extractor.js.map +1 -0
  18. package/dist/call-graph/extractors/regex/go-regex.d.ts +51 -0
  19. package/dist/call-graph/extractors/regex/go-regex.d.ts.map +1 -0
  20. package/dist/call-graph/extractors/regex/go-regex.js +435 -0
  21. package/dist/call-graph/extractors/regex/go-regex.js.map +1 -0
  22. package/dist/call-graph/extractors/regex/index.d.ts +1 -0
  23. package/dist/call-graph/extractors/regex/index.d.ts.map +1 -1
  24. package/dist/call-graph/extractors/regex/index.js +8 -0
  25. package/dist/call-graph/extractors/regex/index.js.map +1 -1
  26. package/dist/call-graph/index.d.ts +3 -0
  27. package/dist/call-graph/index.d.ts.map +1 -1
  28. package/dist/call-graph/index.js +5 -0
  29. package/dist/call-graph/index.js.map +1 -1
  30. package/dist/call-graph/types.d.ts +1 -1
  31. package/dist/call-graph/types.d.ts.map +1 -1
  32. package/dist/constraints/extraction/constraint-synthesizer.d.ts +72 -0
  33. package/dist/constraints/extraction/constraint-synthesizer.d.ts.map +1 -0
  34. package/dist/constraints/extraction/constraint-synthesizer.js +336 -0
  35. package/dist/constraints/extraction/constraint-synthesizer.js.map +1 -0
  36. package/dist/constraints/extraction/index.d.ts +10 -0
  37. package/dist/constraints/extraction/index.d.ts.map +1 -0
  38. package/dist/constraints/extraction/index.js +10 -0
  39. package/dist/constraints/extraction/index.js.map +1 -0
  40. package/dist/constraints/extraction/invariant-detector.d.ts +109 -0
  41. package/dist/constraints/extraction/invariant-detector.d.ts.map +1 -0
  42. package/dist/constraints/extraction/invariant-detector.js +979 -0
  43. package/dist/constraints/extraction/invariant-detector.js.map +1 -0
  44. package/dist/constraints/index.d.ts +15 -0
  45. package/dist/constraints/index.d.ts.map +1 -0
  46. package/dist/constraints/index.js +16 -0
  47. package/dist/constraints/index.js.map +1 -0
  48. package/dist/constraints/store/constraint-store.d.ts +110 -0
  49. package/dist/constraints/store/constraint-store.d.ts.map +1 -0
  50. package/dist/constraints/store/constraint-store.js +584 -0
  51. package/dist/constraints/store/constraint-store.js.map +1 -0
  52. package/dist/constraints/types.d.ts +605 -0
  53. package/dist/constraints/types.d.ts.map +1 -0
  54. package/dist/constraints/types.js +57 -0
  55. package/dist/constraints/types.js.map +1 -0
  56. package/dist/constraints/verification/constraint-verifier.d.ts +100 -0
  57. package/dist/constraints/verification/constraint-verifier.d.ts.map +1 -0
  58. package/dist/constraints/verification/constraint-verifier.js +638 -0
  59. package/dist/constraints/verification/constraint-verifier.js.map +1 -0
  60. package/dist/constraints/verification/index.d.ts +8 -0
  61. package/dist/constraints/verification/index.d.ts.map +1 -0
  62. package/dist/constraints/verification/index.js +8 -0
  63. package/dist/constraints/verification/index.js.map +1 -0
  64. package/dist/decisions/analyzer/decision-mining-analyzer.d.ts +121 -0
  65. package/dist/decisions/analyzer/decision-mining-analyzer.d.ts.map +1 -0
  66. package/dist/decisions/analyzer/decision-mining-analyzer.js +904 -0
  67. package/dist/decisions/analyzer/decision-mining-analyzer.js.map +1 -0
  68. package/dist/decisions/analyzer/index.d.ts +5 -0
  69. package/dist/decisions/analyzer/index.d.ts.map +1 -0
  70. package/dist/decisions/analyzer/index.js +5 -0
  71. package/dist/decisions/analyzer/index.js.map +1 -0
  72. package/dist/decisions/extractors/base-commit-extractor.d.ts +104 -0
  73. package/dist/decisions/extractors/base-commit-extractor.d.ts.map +1 -0
  74. package/dist/decisions/extractors/base-commit-extractor.js +305 -0
  75. package/dist/decisions/extractors/base-commit-extractor.js.map +1 -0
  76. package/dist/decisions/extractors/csharp-commit-extractor.d.ts +18 -0
  77. package/dist/decisions/extractors/csharp-commit-extractor.d.ts.map +1 -0
  78. package/dist/decisions/extractors/csharp-commit-extractor.js +281 -0
  79. package/dist/decisions/extractors/csharp-commit-extractor.js.map +1 -0
  80. package/dist/decisions/extractors/index.d.ts +31 -0
  81. package/dist/decisions/extractors/index.d.ts.map +1 -0
  82. package/dist/decisions/extractors/index.js +63 -0
  83. package/dist/decisions/extractors/index.js.map +1 -0
  84. package/dist/decisions/extractors/java-commit-extractor.d.ts +18 -0
  85. package/dist/decisions/extractors/java-commit-extractor.d.ts.map +1 -0
  86. package/dist/decisions/extractors/java-commit-extractor.js +248 -0
  87. package/dist/decisions/extractors/java-commit-extractor.js.map +1 -0
  88. package/dist/decisions/extractors/php-commit-extractor.d.ts +18 -0
  89. package/dist/decisions/extractors/php-commit-extractor.d.ts.map +1 -0
  90. package/dist/decisions/extractors/php-commit-extractor.js +280 -0
  91. package/dist/decisions/extractors/php-commit-extractor.js.map +1 -0
  92. package/dist/decisions/extractors/python-commit-extractor.d.ts +18 -0
  93. package/dist/decisions/extractors/python-commit-extractor.d.ts.map +1 -0
  94. package/dist/decisions/extractors/python-commit-extractor.js +248 -0
  95. package/dist/decisions/extractors/python-commit-extractor.js.map +1 -0
  96. package/dist/decisions/extractors/typescript-commit-extractor.d.ts +37 -0
  97. package/dist/decisions/extractors/typescript-commit-extractor.d.ts.map +1 -0
  98. package/dist/decisions/extractors/typescript-commit-extractor.js +229 -0
  99. package/dist/decisions/extractors/typescript-commit-extractor.js.map +1 -0
  100. package/dist/decisions/git/commit-parser.d.ts +58 -0
  101. package/dist/decisions/git/commit-parser.d.ts.map +1 -0
  102. package/dist/decisions/git/commit-parser.js +344 -0
  103. package/dist/decisions/git/commit-parser.js.map +1 -0
  104. package/dist/decisions/git/diff-analyzer.d.ts +30 -0
  105. package/dist/decisions/git/diff-analyzer.d.ts.map +1 -0
  106. package/dist/decisions/git/diff-analyzer.js +492 -0
  107. package/dist/decisions/git/diff-analyzer.js.map +1 -0
  108. package/dist/decisions/git/git-walker.d.ts +64 -0
  109. package/dist/decisions/git/git-walker.d.ts.map +1 -0
  110. package/dist/decisions/git/git-walker.js +441 -0
  111. package/dist/decisions/git/git-walker.js.map +1 -0
  112. package/dist/decisions/git/index.d.ts +11 -0
  113. package/dist/decisions/git/index.d.ts.map +1 -0
  114. package/dist/decisions/git/index.js +13 -0
  115. package/dist/decisions/git/index.js.map +1 -0
  116. package/dist/decisions/git/types.d.ts +223 -0
  117. package/dist/decisions/git/types.d.ts.map +1 -0
  118. package/dist/decisions/git/types.js +7 -0
  119. package/dist/decisions/git/types.js.map +1 -0
  120. package/dist/decisions/index.d.ts +27 -0
  121. package/dist/decisions/index.d.ts.map +1 -0
  122. package/dist/decisions/index.js +45 -0
  123. package/dist/decisions/index.js.map +1 -0
  124. package/dist/decisions/types.d.ts +530 -0
  125. package/dist/decisions/types.d.ts.map +1 -0
  126. package/dist/decisions/types.js +8 -0
  127. package/dist/decisions/types.js.map +1 -0
  128. package/dist/go/go-analyzer.d.ts +203 -0
  129. package/dist/go/go-analyzer.d.ts.map +1 -0
  130. package/dist/go/go-analyzer.js +509 -0
  131. package/dist/go/go-analyzer.js.map +1 -0
  132. package/dist/go/index.d.ts +7 -0
  133. package/dist/go/index.d.ts.map +1 -0
  134. package/dist/go/index.js +8 -0
  135. package/dist/go/index.js.map +1 -0
  136. package/dist/index.d.ts +11 -0
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +56 -0
  139. package/dist/index.js.map +1 -1
  140. package/dist/parsers/tree-sitter/go-loader.d.ts +50 -0
  141. package/dist/parsers/tree-sitter/go-loader.d.ts.map +1 -0
  142. package/dist/parsers/tree-sitter/go-loader.js +161 -0
  143. package/dist/parsers/tree-sitter/go-loader.js.map +1 -0
  144. package/dist/parsers/tree-sitter/tree-sitter-go-parser.d.ts +250 -0
  145. package/dist/parsers/tree-sitter/tree-sitter-go-parser.d.ts.map +1 -0
  146. package/dist/parsers/tree-sitter/tree-sitter-go-parser.js +707 -0
  147. package/dist/parsers/tree-sitter/tree-sitter-go-parser.js.map +1 -0
  148. package/dist/parsers/types.d.ts +1 -1
  149. package/dist/parsers/types.d.ts.map +1 -1
  150. package/dist/simulation/approach-generator.d.ts +73 -0
  151. package/dist/simulation/approach-generator.d.ts.map +1 -0
  152. package/dist/simulation/approach-generator.js +371 -0
  153. package/dist/simulation/approach-generator.js.map +1 -0
  154. package/dist/simulation/index.d.ts +14 -0
  155. package/dist/simulation/index.d.ts.map +1 -0
  156. package/dist/simulation/index.js +19 -0
  157. package/dist/simulation/index.js.map +1 -0
  158. package/dist/simulation/language-strategies/csharp-strategies.d.ts +17 -0
  159. package/dist/simulation/language-strategies/csharp-strategies.d.ts.map +1 -0
  160. package/dist/simulation/language-strategies/csharp-strategies.js +118 -0
  161. package/dist/simulation/language-strategies/csharp-strategies.js.map +1 -0
  162. package/dist/simulation/language-strategies/index.d.ts +41 -0
  163. package/dist/simulation/language-strategies/index.d.ts.map +1 -0
  164. package/dist/simulation/language-strategies/index.js +92 -0
  165. package/dist/simulation/language-strategies/index.js.map +1 -0
  166. package/dist/simulation/language-strategies/java-strategies.d.ts +17 -0
  167. package/dist/simulation/language-strategies/java-strategies.d.ts.map +1 -0
  168. package/dist/simulation/language-strategies/java-strategies.js +119 -0
  169. package/dist/simulation/language-strategies/java-strategies.js.map +1 -0
  170. package/dist/simulation/language-strategies/php-strategies.d.ts +17 -0
  171. package/dist/simulation/language-strategies/php-strategies.d.ts.map +1 -0
  172. package/dist/simulation/language-strategies/php-strategies.js +129 -0
  173. package/dist/simulation/language-strategies/php-strategies.js.map +1 -0
  174. package/dist/simulation/language-strategies/python-strategies.d.ts +17 -0
  175. package/dist/simulation/language-strategies/python-strategies.d.ts.map +1 -0
  176. package/dist/simulation/language-strategies/python-strategies.js +208 -0
  177. package/dist/simulation/language-strategies/python-strategies.js.map +1 -0
  178. package/dist/simulation/language-strategies/types.d.ts +67 -0
  179. package/dist/simulation/language-strategies/types.d.ts.map +1 -0
  180. package/dist/simulation/language-strategies/types.js +23 -0
  181. package/dist/simulation/language-strategies/types.js.map +1 -0
  182. package/dist/simulation/language-strategies/typescript-strategies.d.ts +17 -0
  183. package/dist/simulation/language-strategies/typescript-strategies.d.ts.map +1 -0
  184. package/dist/simulation/language-strategies/typescript-strategies.js +251 -0
  185. package/dist/simulation/language-strategies/typescript-strategies.js.map +1 -0
  186. package/dist/simulation/scorers/friction-scorer.d.ts +45 -0
  187. package/dist/simulation/scorers/friction-scorer.d.ts.map +1 -0
  188. package/dist/simulation/scorers/friction-scorer.js +336 -0
  189. package/dist/simulation/scorers/friction-scorer.js.map +1 -0
  190. package/dist/simulation/scorers/impact-scorer.d.ts +56 -0
  191. package/dist/simulation/scorers/impact-scorer.d.ts.map +1 -0
  192. package/dist/simulation/scorers/impact-scorer.js +273 -0
  193. package/dist/simulation/scorers/impact-scorer.js.map +1 -0
  194. package/dist/simulation/scorers/index.d.ts +12 -0
  195. package/dist/simulation/scorers/index.d.ts.map +1 -0
  196. package/dist/simulation/scorers/index.js +12 -0
  197. package/dist/simulation/scorers/index.js.map +1 -0
  198. package/dist/simulation/scorers/pattern-alignment-scorer.d.ts +83 -0
  199. package/dist/simulation/scorers/pattern-alignment-scorer.d.ts.map +1 -0
  200. package/dist/simulation/scorers/pattern-alignment-scorer.js +367 -0
  201. package/dist/simulation/scorers/pattern-alignment-scorer.js.map +1 -0
  202. package/dist/simulation/scorers/security-scorer.d.ts +63 -0
  203. package/dist/simulation/scorers/security-scorer.d.ts.map +1 -0
  204. package/dist/simulation/scorers/security-scorer.js +346 -0
  205. package/dist/simulation/scorers/security-scorer.js.map +1 -0
  206. package/dist/simulation/simulation-engine.d.ts +89 -0
  207. package/dist/simulation/simulation-engine.d.ts.map +1 -0
  208. package/dist/simulation/simulation-engine.js +480 -0
  209. package/dist/simulation/simulation-engine.js.map +1 -0
  210. package/dist/simulation/types.d.ts +200 -0
  211. package/dist/simulation/types.d.ts.map +1 -0
  212. package/dist/simulation/types.js +23 -0
  213. package/dist/simulation/types.js.map +1 -0
  214. package/dist/speculative/approach-generator.d.ts +2 -0
  215. package/dist/speculative/approach-generator.d.ts.map +1 -0
  216. package/dist/speculative/approach-generator.js +2 -0
  217. package/dist/speculative/approach-generator.js.map +1 -0
  218. package/dist/speculative/templates/types.d.ts +133 -0
  219. package/dist/speculative/templates/types.d.ts.map +1 -0
  220. package/dist/speculative/templates/types.js +208 -0
  221. package/dist/speculative/templates/types.js.map +1 -0
  222. package/dist/speculative/types.d.ts +523 -0
  223. package/dist/speculative/types.d.ts.map +1 -0
  224. package/dist/speculative/types.js +71 -0
  225. package/dist/speculative/types.js.map +1 -0
  226. package/dist/test-topology/extractors/base-test-extractor.d.ts +1 -1
  227. package/dist/test-topology/extractors/base-test-extractor.d.ts.map +1 -1
  228. package/dist/test-topology/extractors/base-test-extractor.js.map +1 -1
  229. package/dist/test-topology/extractors/go-test-extractor.d.ts +33 -0
  230. package/dist/test-topology/extractors/go-test-extractor.d.ts.map +1 -0
  231. package/dist/test-topology/extractors/go-test-extractor.js +436 -0
  232. package/dist/test-topology/extractors/go-test-extractor.js.map +1 -0
  233. package/dist/test-topology/extractors/index.d.ts +1 -0
  234. package/dist/test-topology/extractors/index.d.ts.map +1 -1
  235. package/dist/test-topology/extractors/index.js +1 -0
  236. package/dist/test-topology/extractors/index.js.map +1 -1
  237. package/dist/test-topology/extractors/regex/go-test-regex.d.ts +62 -0
  238. package/dist/test-topology/extractors/regex/go-test-regex.d.ts.map +1 -0
  239. package/dist/test-topology/extractors/regex/go-test-regex.js +528 -0
  240. package/dist/test-topology/extractors/regex/go-test-regex.js.map +1 -0
  241. package/dist/test-topology/extractors/regex/index.d.ts +1 -0
  242. package/dist/test-topology/extractors/regex/index.d.ts.map +1 -1
  243. package/dist/test-topology/extractors/regex/index.js +4 -0
  244. package/dist/test-topology/extractors/regex/index.js.map +1 -1
  245. package/dist/test-topology/hybrid-test-topology-analyzer.d.ts.map +1 -1
  246. package/dist/test-topology/hybrid-test-topology-analyzer.js +1 -0
  247. package/dist/test-topology/hybrid-test-topology-analyzer.js.map +1 -1
  248. package/dist/test-topology/test-topology-analyzer.d.ts.map +1 -1
  249. package/dist/test-topology/test-topology-analyzer.js +1 -0
  250. package/dist/test-topology/test-topology-analyzer.js.map +1 -1
  251. package/dist/test-topology/types.d.ts +2 -2
  252. package/dist/test-topology/types.d.ts.map +1 -1
  253. package/dist/unified-provider/matching/database-sql-matcher.d.ts +42 -0
  254. package/dist/unified-provider/matching/database-sql-matcher.d.ts.map +1 -0
  255. package/dist/unified-provider/matching/database-sql-matcher.js +282 -0
  256. package/dist/unified-provider/matching/database-sql-matcher.js.map +1 -0
  257. package/dist/unified-provider/matching/gorm-matcher.d.ts +41 -0
  258. package/dist/unified-provider/matching/gorm-matcher.d.ts.map +1 -0
  259. package/dist/unified-provider/matching/gorm-matcher.js +222 -0
  260. package/dist/unified-provider/matching/gorm-matcher.js.map +1 -0
  261. package/dist/unified-provider/matching/index.d.ts +3 -0
  262. package/dist/unified-provider/matching/index.d.ts.map +1 -1
  263. package/dist/unified-provider/matching/index.js +4 -0
  264. package/dist/unified-provider/matching/index.js.map +1 -1
  265. package/dist/unified-provider/matching/matcher-registry.d.ts.map +1 -1
  266. package/dist/unified-provider/matching/matcher-registry.js +7 -0
  267. package/dist/unified-provider/matching/matcher-registry.js.map +1 -1
  268. package/dist/unified-provider/matching/sqlx-matcher.d.ts +40 -0
  269. package/dist/unified-provider/matching/sqlx-matcher.d.ts.map +1 -0
  270. package/dist/unified-provider/matching/sqlx-matcher.js +214 -0
  271. package/dist/unified-provider/matching/sqlx-matcher.js.map +1 -0
  272. package/dist/unified-provider/normalization/go-normalizer.d.ts +62 -0
  273. package/dist/unified-provider/normalization/go-normalizer.d.ts.map +1 -0
  274. package/dist/unified-provider/normalization/go-normalizer.js +608 -0
  275. package/dist/unified-provider/normalization/go-normalizer.js.map +1 -0
  276. package/dist/unified-provider/normalization/index.d.ts +1 -0
  277. package/dist/unified-provider/normalization/index.d.ts.map +1 -1
  278. package/dist/unified-provider/normalization/index.js +6 -1
  279. package/dist/unified-provider/normalization/index.js.map +1 -1
  280. package/dist/unified-provider/types.d.ts +1 -1
  281. package/dist/unified-provider/types.d.ts.map +1 -1
  282. package/dist/wpf/extractors/binding-error-detector.d.ts +75 -0
  283. package/dist/wpf/extractors/binding-error-detector.d.ts.map +1 -0
  284. package/dist/wpf/extractors/binding-error-detector.js +290 -0
  285. package/dist/wpf/extractors/binding-error-detector.js.map +1 -0
  286. package/dist/wpf/extractors/code-behind-linker.d.ts +70 -0
  287. package/dist/wpf/extractors/code-behind-linker.d.ts.map +1 -0
  288. package/dist/wpf/extractors/code-behind-linker.js +172 -0
  289. package/dist/wpf/extractors/code-behind-linker.js.map +1 -0
  290. package/dist/wpf/extractors/dependency-property-extractor.d.ts +61 -0
  291. package/dist/wpf/extractors/dependency-property-extractor.d.ts.map +1 -0
  292. package/dist/wpf/extractors/dependency-property-extractor.js +201 -0
  293. package/dist/wpf/extractors/dependency-property-extractor.js.map +1 -0
  294. package/dist/wpf/extractors/regex/viewmodel-regex.d.ts +82 -0
  295. package/dist/wpf/extractors/regex/viewmodel-regex.d.ts.map +1 -0
  296. package/dist/wpf/extractors/regex/viewmodel-regex.js +412 -0
  297. package/dist/wpf/extractors/regex/viewmodel-regex.js.map +1 -0
  298. package/dist/wpf/extractors/regex/xaml-regex.d.ts +77 -0
  299. package/dist/wpf/extractors/regex/xaml-regex.d.ts.map +1 -0
  300. package/dist/wpf/extractors/regex/xaml-regex.js +353 -0
  301. package/dist/wpf/extractors/regex/xaml-regex.js.map +1 -0
  302. package/dist/wpf/extractors/resource-dictionary-parser.d.ts +103 -0
  303. package/dist/wpf/extractors/resource-dictionary-parser.d.ts.map +1 -0
  304. package/dist/wpf/extractors/resource-dictionary-parser.js +296 -0
  305. package/dist/wpf/extractors/resource-dictionary-parser.js.map +1 -0
  306. package/dist/wpf/extractors/value-converter-extractor.d.ts +128 -0
  307. package/dist/wpf/extractors/value-converter-extractor.d.ts.map +1 -0
  308. package/dist/wpf/extractors/value-converter-extractor.js +312 -0
  309. package/dist/wpf/extractors/value-converter-extractor.js.map +1 -0
  310. package/dist/wpf/extractors/viewmodel-hybrid-extractor.d.ts +104 -0
  311. package/dist/wpf/extractors/viewmodel-hybrid-extractor.d.ts.map +1 -0
  312. package/dist/wpf/extractors/viewmodel-hybrid-extractor.js +513 -0
  313. package/dist/wpf/extractors/viewmodel-hybrid-extractor.js.map +1 -0
  314. package/dist/wpf/extractors/xaml-hybrid-extractor.d.ts +98 -0
  315. package/dist/wpf/extractors/xaml-hybrid-extractor.d.ts.map +1 -0
  316. package/dist/wpf/extractors/xaml-hybrid-extractor.js +444 -0
  317. package/dist/wpf/extractors/xaml-hybrid-extractor.js.map +1 -0
  318. package/dist/wpf/index.d.ts +25 -0
  319. package/dist/wpf/index.d.ts.map +1 -0
  320. package/dist/wpf/index.js +31 -0
  321. package/dist/wpf/index.js.map +1 -0
  322. package/dist/wpf/integration/wpf-callgraph-adapter.d.ts +82 -0
  323. package/dist/wpf/integration/wpf-callgraph-adapter.d.ts.map +1 -0
  324. package/dist/wpf/integration/wpf-callgraph-adapter.js +311 -0
  325. package/dist/wpf/integration/wpf-callgraph-adapter.js.map +1 -0
  326. package/dist/wpf/integration/wpf-data-flow-tracer.d.ts +129 -0
  327. package/dist/wpf/integration/wpf-data-flow-tracer.d.ts.map +1 -0
  328. package/dist/wpf/integration/wpf-data-flow-tracer.js +367 -0
  329. package/dist/wpf/integration/wpf-data-flow-tracer.js.map +1 -0
  330. package/dist/wpf/linkers/datacontext-resolver.d.ts +66 -0
  331. package/dist/wpf/linkers/datacontext-resolver.d.ts.map +1 -0
  332. package/dist/wpf/linkers/datacontext-resolver.js +240 -0
  333. package/dist/wpf/linkers/datacontext-resolver.js.map +1 -0
  334. package/dist/wpf/linkers/viewmodel-linker.d.ts +71 -0
  335. package/dist/wpf/linkers/viewmodel-linker.d.ts.map +1 -0
  336. package/dist/wpf/linkers/viewmodel-linker.js +268 -0
  337. package/dist/wpf/linkers/viewmodel-linker.js.map +1 -0
  338. package/dist/wpf/types.d.ts +451 -0
  339. package/dist/wpf/types.d.ts.map +1 -0
  340. package/dist/wpf/types.js +8 -0
  341. package/dist/wpf/types.js.map +1 -0
  342. package/dist/wpf/wpf-analyzer.d.ts +114 -0
  343. package/dist/wpf/wpf-analyzer.d.ts.map +1 -0
  344. package/dist/wpf/wpf-analyzer.js +332 -0
  345. package/dist/wpf/wpf-analyzer.js.map +1 -0
  346. package/dist/wrappers/integration/adapter.d.ts.map +1 -1
  347. package/dist/wrappers/integration/adapter.js +1 -0
  348. package/dist/wrappers/integration/adapter.js.map +1 -1
  349. package/package.json +29 -18
  350. package/LICENSE +0 -21
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Python Language Strategies
3
+ *
4
+ * Strategies for FastAPI, Django, and Flask frameworks.
5
+ *
6
+ * @module simulation/language-strategies/python-strategies
7
+ */
8
+ // ============================================================================
9
+ // FastAPI Strategies
10
+ // ============================================================================
11
+ const FASTAPI_STRATEGIES = [
12
+ {
13
+ strategy: 'dependency',
14
+ name: 'FastAPI Dependency',
15
+ description: 'Implement as a FastAPI dependency injection',
16
+ applicableCategories: ['authentication', 'authorization', 'rate-limiting', 'validation', 'data-access'],
17
+ filePatterns: ['dependencies', 'deps', 'auth'],
18
+ pros: ['Built-in pattern', 'Type-safe', 'Reusable', 'Testable'],
19
+ cons: ['FastAPI-specific'],
20
+ estimatedLines: 25,
21
+ template: `async def {{name}}_dependency(request: Request):\n # Implementation\n return result`,
22
+ },
23
+ {
24
+ strategy: 'middleware',
25
+ name: 'Starlette Middleware',
26
+ description: 'Implement as ASGI middleware',
27
+ applicableCategories: ['logging', 'rate-limiting', 'authentication', 'error-handling'],
28
+ filePatterns: ['middleware', 'middlewares'],
29
+ pros: ['Intercepts all requests', 'ASGI standard', 'Access to raw request/response'],
30
+ cons: ['Lower level than dependencies', 'More complex'],
31
+ estimatedLines: 45,
32
+ template: `class {{Name}}Middleware(BaseHTTPMiddleware):\n async def dispatch(self, request, call_next):\n response = await call_next(request)\n return response`,
33
+ },
34
+ {
35
+ strategy: 'decorator',
36
+ name: 'Python Decorator',
37
+ description: 'Create a decorator for route handlers',
38
+ applicableCategories: ['caching', 'logging', 'rate-limiting', 'authorization'],
39
+ filePatterns: ['decorators', 'utils'],
40
+ pros: ['Pythonic', 'Explicit', 'Composable'],
41
+ cons: ['Manual application required'],
42
+ estimatedLines: 20,
43
+ template: `def {{name}}(func):\n @wraps(func)\n async def wrapper(*args, **kwargs):\n return await func(*args, **kwargs)\n return wrapper`,
44
+ },
45
+ {
46
+ strategy: 'centralized',
47
+ name: 'Service Class',
48
+ description: 'Create a dedicated service class',
49
+ applicableCategories: ['authentication', 'data-access', 'caching'],
50
+ filePatterns: ['services', 'core'],
51
+ pros: ['Clean architecture', 'Testable', 'Reusable'],
52
+ cons: ['More boilerplate'],
53
+ estimatedLines: 60,
54
+ },
55
+ ];
56
+ const FASTAPI_FRAMEWORK = {
57
+ name: 'fastapi',
58
+ language: 'python',
59
+ detectPatterns: ['FastAPI()', '@app.get', '@app.post', 'Depends(', 'APIRouter'],
60
+ importPatterns: ['from fastapi', 'import fastapi'],
61
+ strategies: FASTAPI_STRATEGIES,
62
+ };
63
+ // ============================================================================
64
+ // Django Strategies
65
+ // ============================================================================
66
+ const DJANGO_STRATEGIES = [
67
+ {
68
+ strategy: 'middleware',
69
+ name: 'Django Middleware',
70
+ description: 'Implement as Django middleware class',
71
+ applicableCategories: ['authentication', 'logging', 'rate-limiting', 'error-handling'],
72
+ filePatterns: ['middleware', 'middlewares'],
73
+ pros: ['Django standard', 'Intercepts all requests', 'Well-documented'],
74
+ cons: ['Synchronous by default', 'Order matters'],
75
+ estimatedLines: 40,
76
+ template: `class {{Name}}Middleware:\n def __init__(self, get_response):\n self.get_response = get_response\n def __call__(self, request):\n response = self.get_response(request)\n return response`,
77
+ },
78
+ {
79
+ strategy: 'decorator',
80
+ name: 'View Decorator',
81
+ description: 'Create a decorator for view functions',
82
+ applicableCategories: ['authentication', 'authorization', 'caching', 'rate-limiting'],
83
+ filePatterns: ['decorators', 'utils'],
84
+ pros: ['Django pattern', 'Explicit', 'Composable with @login_required etc.'],
85
+ cons: ['Manual application'],
86
+ estimatedLines: 25,
87
+ template: `def {{name}}_required(view_func):\n @wraps(view_func)\n def wrapper(request, *args, **kwargs):\n return view_func(request, *args, **kwargs)\n return wrapper`,
88
+ },
89
+ {
90
+ strategy: 'mixin',
91
+ name: 'View Mixin',
92
+ description: 'Create a mixin class for class-based views',
93
+ applicableCategories: ['authentication', 'authorization', 'logging'],
94
+ filePatterns: ['mixins', 'views'],
95
+ pros: ['Reusable with CBVs', 'Django pattern', 'Composable'],
96
+ cons: ['Only for class-based views'],
97
+ estimatedLines: 30,
98
+ template: `class {{Name}}Mixin:\n def dispatch(self, request, *args, **kwargs):\n return super().dispatch(request, *args, **kwargs)`,
99
+ },
100
+ {
101
+ strategy: 'centralized',
102
+ name: 'Django Service',
103
+ description: 'Create a service module',
104
+ applicableCategories: ['data-access', 'authentication', 'caching'],
105
+ filePatterns: ['services', 'utils'],
106
+ pros: ['Clean separation', 'Testable'],
107
+ cons: ['Not a Django convention'],
108
+ estimatedLines: 50,
109
+ },
110
+ ];
111
+ const DJANGO_FRAMEWORK = {
112
+ name: 'django',
113
+ language: 'python',
114
+ detectPatterns: ['from django', 'Django', 'HttpResponse', 'render(', 'models.Model'],
115
+ importPatterns: ['from django', 'import django'],
116
+ strategies: DJANGO_STRATEGIES,
117
+ };
118
+ // ============================================================================
119
+ // Flask Strategies
120
+ // ============================================================================
121
+ const FLASK_STRATEGIES = [
122
+ {
123
+ strategy: 'decorator',
124
+ name: 'Flask Decorator',
125
+ description: 'Create a decorator for route handlers',
126
+ applicableCategories: ['authentication', 'authorization', 'rate-limiting', 'logging', 'caching'],
127
+ filePatterns: ['decorators', 'utils', 'auth'],
128
+ pros: ['Flask pattern', 'Explicit', 'Composable'],
129
+ cons: ['Manual application'],
130
+ estimatedLines: 20,
131
+ template: `def {{name}}_required(f):\n @wraps(f)\n def decorated(*args, **kwargs):\n return f(*args, **kwargs)\n return decorated`,
132
+ },
133
+ {
134
+ strategy: 'middleware',
135
+ name: 'Flask Before/After Request',
136
+ description: 'Use before_request/after_request hooks',
137
+ applicableCategories: ['logging', 'authentication', 'rate-limiting'],
138
+ filePatterns: ['app', 'hooks'],
139
+ pros: ['Simple', 'Global effect'],
140
+ cons: ['Less granular control'],
141
+ estimatedLines: 15,
142
+ template: `@app.before_request\ndef {{name}}_before():\n pass`,
143
+ },
144
+ {
145
+ strategy: 'centralized',
146
+ name: 'Flask Extension',
147
+ description: 'Create or use a Flask extension',
148
+ applicableCategories: ['authentication', 'caching', 'data-access'],
149
+ filePatterns: ['extensions', 'ext'],
150
+ pros: ['Reusable', 'Flask ecosystem'],
151
+ cons: ['More complex setup'],
152
+ estimatedLines: 70,
153
+ },
154
+ {
155
+ strategy: 'wrapper',
156
+ name: 'Context Manager',
157
+ description: 'Use Python context managers for resource management',
158
+ applicableCategories: ['data-access', 'error-handling', 'logging'],
159
+ filePatterns: ['utils', 'context'],
160
+ pros: ['Pythonic', 'Clean resource handling'],
161
+ cons: ['Limited to specific use cases'],
162
+ estimatedLines: 25,
163
+ },
164
+ ];
165
+ const FLASK_FRAMEWORK = {
166
+ name: 'flask',
167
+ language: 'python',
168
+ detectPatterns: ['Flask(__name__)', '@app.route', 'flask.', 'Blueprint('],
169
+ importPatterns: ['from flask', 'import flask'],
170
+ strategies: FLASK_STRATEGIES,
171
+ };
172
+ // ============================================================================
173
+ // Python Strategy Provider
174
+ // ============================================================================
175
+ export class PythonStrategyProvider {
176
+ language = 'python';
177
+ frameworks = [
178
+ FASTAPI_FRAMEWORK,
179
+ DJANGO_FRAMEWORK,
180
+ FLASK_FRAMEWORK,
181
+ ];
182
+ getStrategies(category, framework) {
183
+ const fw = framework
184
+ ? this.frameworks.find(f => f.name === framework)
185
+ : this.frameworks[0];
186
+ if (!fw)
187
+ return [];
188
+ return fw.strategies.filter(s => s.applicableCategories.includes(category) ||
189
+ s.applicableCategories.includes('generic'));
190
+ }
191
+ detectFramework(content, _filePath) {
192
+ for (const fw of this.frameworks) {
193
+ for (const pattern of fw.importPatterns) {
194
+ if (content.includes(pattern)) {
195
+ return fw.name;
196
+ }
197
+ }
198
+ for (const pattern of fw.detectPatterns) {
199
+ if (content.includes(pattern)) {
200
+ return fw.name;
201
+ }
202
+ }
203
+ }
204
+ return null;
205
+ }
206
+ }
207
+ export const pythonStrategyProvider = new PythonStrategyProvider();
208
+ //# sourceMappingURL=python-strategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-strategies.js","sourceRoot":"","sources":["../../../src/simulation/language-strategies/python-strategies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,MAAM,kBAAkB,GAAuB;IAC7C;QACE,QAAQ,EAAE,YAAY;QACtB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,6CAA6C;QAC1D,oBAAoB,EAAE,CAAC,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAA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CAAC,IAAI,CAAC;gBACjB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Language Strategy Types
3
+ *
4
+ * Defines the structure for language-specific implementation strategies.
5
+ *
6
+ * @module simulation/language-strategies/types
7
+ */
8
+ import type { TaskCategory, ApproachStrategy } from '../types.js';
9
+ import type { CallGraphLanguage } from '../../call-graph/types.js';
10
+ /** Strategy template for a specific language/framework */
11
+ export interface StrategyTemplate {
12
+ /** Strategy identifier */
13
+ strategy: ApproachStrategy;
14
+ /** Human-readable name */
15
+ name: string;
16
+ /** Description of the approach */
17
+ description: string;
18
+ /** Task categories this strategy applies to */
19
+ applicableCategories: TaskCategory[];
20
+ /** File patterns to look for (e.g., 'middleware', 'controller') */
21
+ filePatterns: string[];
22
+ /** Pros of this approach */
23
+ pros: string[];
24
+ /** Cons of this approach */
25
+ cons: string[];
26
+ /** Estimated base lines of code */
27
+ estimatedLines: number;
28
+ /** Framework-specific notes */
29
+ frameworkNotes?: string;
30
+ /** Example code template */
31
+ template?: string;
32
+ /** New files that would be created */
33
+ newFiles?: string[];
34
+ }
35
+ /** Framework definition */
36
+ export interface FrameworkDefinition {
37
+ /** Framework name */
38
+ name: string;
39
+ /** Language this framework is for */
40
+ language: CallGraphLanguage;
41
+ /** File patterns that indicate this framework */
42
+ detectPatterns: string[];
43
+ /** Import patterns that indicate this framework */
44
+ importPatterns: string[];
45
+ /** Available strategies for this framework */
46
+ strategies: StrategyTemplate[];
47
+ }
48
+ /** Language strategy provider */
49
+ export interface LanguageStrategyProvider {
50
+ /** Language this provider handles */
51
+ language: CallGraphLanguage;
52
+ /** Supported frameworks */
53
+ frameworks: FrameworkDefinition[];
54
+ /** Get strategies for a task category */
55
+ getStrategies(category: TaskCategory, framework?: string): StrategyTemplate[];
56
+ /** Detect framework from file content */
57
+ detectFramework(content: string, filePath: string): string | null;
58
+ }
59
+ /** Category keywords for auto-detection */
60
+ export interface CategoryKeywords {
61
+ category: TaskCategory;
62
+ keywords: string[];
63
+ weight: number;
64
+ }
65
+ /** All category keywords for task detection */
66
+ export declare const CATEGORY_KEYWORDS: CategoryKeywords[];
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/simulation/language-strategies/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,oBAAoB,EAAE,YAAY,EAAE,CAAC;IACrC,mEAAmE;IACnE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,4BAA4B;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,2BAA2B;AAC3B,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,iDAAiD;IACjD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,mDAAmD;IACnD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,8CAA8C;IAC9C,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,iCAAiC;AACjC,MAAM,WAAW,wBAAwB;IACvC,qCAAqC;IACrC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,2BAA2B;IAC3B,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,yCAAyC;IACzC,aAAa,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAC9E,yCAAyC;IACzC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACnE;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,YAAY,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+CAA+C;AAC/C,eAAO,MAAM,iBAAiB,EAAE,gBAAgB,EAa/C,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Language Strategy Types
3
+ *
4
+ * Defines the structure for language-specific implementation strategies.
5
+ *
6
+ * @module simulation/language-strategies/types
7
+ */
8
+ /** All category keywords for task detection */
9
+ export const CATEGORY_KEYWORDS = [
10
+ { category: 'rate-limiting', keywords: ['rate limit', 'throttle', 'throttling', 'requests per', 'api limit', 'quota'], weight: 1.0 },
11
+ { category: 'authentication', keywords: ['auth', 'login', 'logout', 'session', 'jwt', 'token', 'oauth', 'sso', 'sign in', 'sign up', 'password'], weight: 1.0 },
12
+ { category: 'authorization', keywords: ['permission', 'role', 'access control', 'rbac', 'acl', 'authorize', 'can access', 'allowed', 'forbidden'], weight: 1.0 },
13
+ { category: 'api-endpoint', keywords: ['endpoint', 'route', 'api', 'rest', 'graphql', 'controller', 'handler'], weight: 0.8 },
14
+ { category: 'data-access', keywords: ['database', 'query', 'repository', 'dao', 'orm', 'sql', 'crud', 'fetch', 'save', 'delete', 'model'], weight: 0.9 },
15
+ { category: 'error-handling', keywords: ['error', 'exception', 'catch', 'try', 'throw', 'handle', 'fallback', 'retry', 'recover'], weight: 0.9 },
16
+ { category: 'caching', keywords: ['cache', 'redis', 'memcache', 'memoize', 'invalidate', 'ttl', 'expire', 'store'], weight: 1.0 },
17
+ { category: 'logging', keywords: ['log', 'logging', 'trace', 'debug', 'audit', 'monitor', 'observability', 'telemetry'], weight: 0.8 },
18
+ { category: 'testing', keywords: ['test', 'spec', 'mock', 'stub', 'fixture', 'assert', 'expect', 'coverage', 'unit test'], weight: 0.9 },
19
+ { category: 'validation', keywords: ['validate', 'validation', 'schema', 'sanitize', 'input', 'form', 'constraint', 'dto'], weight: 0.9 },
20
+ { category: 'middleware', keywords: ['middleware', 'interceptor', 'filter', 'pipe', 'guard', 'before', 'after', 'hook'], weight: 0.9 },
21
+ { category: 'refactoring', keywords: ['refactor', 'restructure', 'reorganize', 'clean up', 'simplify', 'extract', 'inline', 'rename'], weight: 0.7 },
22
+ ];
23
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/simulation/language-strategies/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,iBAAiB,GAAuB;IACnD,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;IACpI,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,S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AAE,SAAS,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;IACxI,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;IACzI,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;IACtI,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE;CACrJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * TypeScript Language Strategies
3
+ *
4
+ * Strategies for Express, NestJS, Next.js, and Fastify frameworks.
5
+ *
6
+ * @module simulation/language-strategies/typescript-strategies
7
+ */
8
+ import type { TaskCategory } from '../types.js';
9
+ import type { FrameworkDefinition, LanguageStrategyProvider, StrategyTemplate } from './types.js';
10
+ export declare class TypeScriptStrategyProvider implements LanguageStrategyProvider {
11
+ readonly language: "typescript";
12
+ readonly frameworks: FrameworkDefinition[];
13
+ getStrategies(category: TaskCategory, framework?: string): StrategyTemplate[];
14
+ detectFramework(content: string, _filePath: string): string | null;
15
+ }
16
+ export declare const typescriptStrategyProvider: TypeScriptStrategyProvider;
17
+ //# sourceMappingURL=typescript-strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-strategies.d.ts","sourceRoot":"","sources":["../../../src/simulation/language-strategies/typescript-strategies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgOlG,qBAAa,0BAA2B,YAAW,wBAAwB;IACzE,QAAQ,CAAC,QAAQ,EAAG,YAAY,CAAU;IAC1C,QAAQ,CAAC,UAAU,EAAE,mBAAmB,EAAE,CAKxC;IAEF,aAAa,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAa7E,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAiBnE;AAED,eAAO,MAAM,0BAA0B,4BAAmC,CAAC"}
@@ -0,0 +1,251 @@
1
+ /**
2
+ * TypeScript Language Strategies
3
+ *
4
+ * Strategies for Express, NestJS, Next.js, and Fastify frameworks.
5
+ *
6
+ * @module simulation/language-strategies/typescript-strategies
7
+ */
8
+ // ============================================================================
9
+ // Express Strategies
10
+ // ============================================================================
11
+ const EXPRESS_STRATEGIES = [
12
+ {
13
+ strategy: 'middleware',
14
+ name: 'Express Middleware',
15
+ description: 'Implement as Express middleware that intercepts requests',
16
+ applicableCategories: ['rate-limiting', 'authentication', 'authorization', 'logging', 'validation', 'error-handling'],
17
+ filePatterns: ['middleware', 'middlewares'],
18
+ pros: ['Centralized logic', 'Easy to enable/disable', 'Reusable across routes', 'Standard Express pattern'],
19
+ cons: ['Applies to all matched routes', 'Order-dependent', 'Can add latency'],
20
+ estimatedLines: 40,
21
+ template: `export const {{name}}Middleware = (req, res, next) => {\n // Implementation\n next();\n};`,
22
+ },
23
+ {
24
+ strategy: 'wrapper',
25
+ name: 'Route Handler Wrapper',
26
+ description: 'Create a wrapper function that adds behavior around route handlers',
27
+ applicableCategories: ['error-handling', 'logging', 'caching', 'rate-limiting'],
28
+ filePatterns: ['utils', 'helpers', 'wrappers'],
29
+ pros: ['Explicit and traceable', 'Works with any handler', 'Easy to test'],
30
+ cons: ['Requires manual wrapping', 'Can lead to deep nesting'],
31
+ estimatedLines: 30,
32
+ },
33
+ {
34
+ strategy: 'per-route',
35
+ name: 'Per-Route Implementation',
36
+ description: 'Implement directly in each route handler',
37
+ applicableCategories: ['api-endpoint', 'validation', 'data-access'],
38
+ filePatterns: ['routes', 'controllers', 'handlers'],
39
+ pros: ['Maximum flexibility', 'No abstraction overhead', 'Easy to understand'],
40
+ cons: ['Code duplication', 'Inconsistent implementations'],
41
+ estimatedLines: 20,
42
+ },
43
+ {
44
+ strategy: 'centralized',
45
+ name: 'Centralized Service',
46
+ description: 'Create a dedicated service module',
47
+ applicableCategories: ['authentication', 'authorization', 'caching', 'data-access', 'logging'],
48
+ filePatterns: ['services', 'providers'],
49
+ pros: ['Single source of truth', 'Easy to modify globally', 'Clear ownership'],
50
+ cons: ['Can become a bottleneck', 'Tight coupling risk'],
51
+ estimatedLines: 80,
52
+ },
53
+ ];
54
+ const EXPRESS_FRAMEWORK = {
55
+ name: 'express',
56
+ language: 'typescript',
57
+ detectPatterns: ['app.use', 'app.get', 'app.post', 'express.Router', 'req, res, next'],
58
+ importPatterns: ['express', 'from \'express\'', 'from "express"'],
59
+ strategies: EXPRESS_STRATEGIES,
60
+ };
61
+ // ============================================================================
62
+ // NestJS Strategies
63
+ // ============================================================================
64
+ const NESTJS_STRATEGIES = [
65
+ {
66
+ strategy: 'guard',
67
+ name: 'NestJS Guard',
68
+ description: 'Implement as a NestJS Guard for route protection',
69
+ applicableCategories: ['authentication', 'authorization', 'rate-limiting'],
70
+ filePatterns: ['guards', 'guard'],
71
+ pros: ['Built-in NestJS pattern', 'Declarative with decorators', 'Reusable'],
72
+ cons: ['NestJS-specific', 'Learning curve'],
73
+ estimatedLines: 35,
74
+ template: `@Injectable()\nexport class {{Name}}Guard implements CanActivate {\n canActivate(context: ExecutionContext): boolean {\n return true;\n }\n}`,
75
+ },
76
+ {
77
+ strategy: 'interceptor',
78
+ name: 'NestJS Interceptor',
79
+ description: 'Implement as a NestJS Interceptor for request/response transformation',
80
+ applicableCategories: ['logging', 'caching', 'error-handling'],
81
+ filePatterns: ['interceptors', 'interceptor'],
82
+ pros: ['Access to both request and response', 'Can transform data', 'Composable'],
83
+ cons: ['More complex than middleware', 'NestJS-specific'],
84
+ estimatedLines: 45,
85
+ },
86
+ {
87
+ strategy: 'decorator',
88
+ name: 'Custom Decorator',
89
+ description: 'Create a custom decorator for declarative behavior',
90
+ applicableCategories: ['rate-limiting', 'caching', 'logging', 'authorization', 'validation'],
91
+ filePatterns: ['decorators', 'decorator'],
92
+ pros: ['Clean syntax', 'Self-documenting', 'Reusable'],
93
+ cons: ['Requires decorator support', 'Can be magical'],
94
+ estimatedLines: 25,
95
+ template: `export const {{Name}} = () => SetMetadata('{{name}}', true);`,
96
+ },
97
+ {
98
+ strategy: 'filter',
99
+ name: 'NestJS Exception Filter',
100
+ description: 'Implement as an exception filter for error handling',
101
+ applicableCategories: ['error-handling'],
102
+ filePatterns: ['filters', 'filter', 'exceptions'],
103
+ pros: ['Centralized error handling', 'Type-safe', 'Customizable responses'],
104
+ cons: ['Only for errors', 'NestJS-specific'],
105
+ estimatedLines: 40,
106
+ },
107
+ {
108
+ strategy: 'middleware',
109
+ name: 'NestJS Middleware',
110
+ description: 'Implement as NestJS middleware',
111
+ applicableCategories: ['logging', 'authentication', 'rate-limiting'],
112
+ filePatterns: ['middleware', 'middlewares'],
113
+ pros: ['Similar to Express', 'Early in request lifecycle'],
114
+ cons: ['Less powerful than guards/interceptors'],
115
+ estimatedLines: 35,
116
+ },
117
+ ];
118
+ const NESTJS_FRAMEWORK = {
119
+ name: 'nestjs',
120
+ language: 'typescript',
121
+ detectPatterns: ['@Controller', '@Injectable', '@Module', '@Get', '@Post', 'NestFactory'],
122
+ importPatterns: ['@nestjs/common', '@nestjs/core'],
123
+ strategies: NESTJS_STRATEGIES,
124
+ };
125
+ // ============================================================================
126
+ // Next.js Strategies
127
+ // ============================================================================
128
+ const NEXTJS_STRATEGIES = [
129
+ {
130
+ strategy: 'middleware',
131
+ name: 'Next.js Middleware',
132
+ description: 'Implement as Next.js edge middleware',
133
+ applicableCategories: ['authentication', 'authorization', 'rate-limiting', 'logging'],
134
+ filePatterns: ['middleware'],
135
+ pros: ['Runs at edge', 'Intercepts all routes', 'Built-in pattern'],
136
+ cons: ['Limited runtime', 'Edge constraints'],
137
+ estimatedLines: 30,
138
+ frameworkNotes: 'Runs in Edge Runtime with limited Node.js APIs',
139
+ },
140
+ {
141
+ strategy: 'wrapper',
142
+ name: 'API Route Wrapper (HOF)',
143
+ description: 'Create a higher-order function to wrap API routes',
144
+ applicableCategories: ['authentication', 'error-handling', 'logging', 'rate-limiting'],
145
+ filePatterns: ['lib', 'utils', 'api'],
146
+ pros: ['Full Node.js runtime', 'Composable', 'Type-safe'],
147
+ cons: ['Manual wrapping required'],
148
+ estimatedLines: 35,
149
+ template: `export const with{{Name}} = (handler) => async (req, res) => {\n // Pre-processing\n return handler(req, res);\n};`,
150
+ },
151
+ {
152
+ strategy: 'per-route',
153
+ name: 'Per-Route Implementation',
154
+ description: 'Implement directly in API route handlers',
155
+ applicableCategories: ['api-endpoint', 'data-access', 'validation'],
156
+ filePatterns: ['api', 'pages/api', 'app/api'],
157
+ pros: ['Simple', 'No abstraction'],
158
+ cons: ['Duplication across routes'],
159
+ estimatedLines: 20,
160
+ },
161
+ ];
162
+ const NEXTJS_FRAMEWORK = {
163
+ name: 'nextjs',
164
+ language: 'typescript',
165
+ detectPatterns: ['NextRequest', 'NextResponse', 'getServerSideProps', 'getStaticProps', 'NextApiRequest'],
166
+ importPatterns: ['next', 'next/server', 'from \'next\''],
167
+ strategies: NEXTJS_STRATEGIES,
168
+ };
169
+ // ============================================================================
170
+ // Fastify Strategies
171
+ // ============================================================================
172
+ const FASTIFY_STRATEGIES = [
173
+ {
174
+ strategy: 'decorator',
175
+ name: 'Fastify Decorator',
176
+ description: 'Extend Fastify instance with custom functionality',
177
+ applicableCategories: ['authentication', 'caching', 'data-access'],
178
+ filePatterns: ['plugins', 'decorators'],
179
+ pros: ['Fastify-native', 'Available on all requests', 'Type-safe'],
180
+ cons: ['Fastify-specific pattern'],
181
+ estimatedLines: 30,
182
+ },
183
+ {
184
+ strategy: 'middleware',
185
+ name: 'Fastify Hook',
186
+ description: 'Use Fastify lifecycle hooks (onRequest, preHandler, etc.)',
187
+ applicableCategories: ['authentication', 'authorization', 'logging', 'rate-limiting', 'validation'],
188
+ filePatterns: ['hooks', 'plugins'],
189
+ pros: ['Fine-grained control', 'Multiple hook points', 'Async-friendly'],
190
+ cons: ['Different from Express middleware'],
191
+ estimatedLines: 35,
192
+ template: `fastify.addHook('preHandler', async (request, reply) => {\n // Implementation\n});`,
193
+ },
194
+ {
195
+ strategy: 'centralized',
196
+ name: 'Fastify Plugin',
197
+ description: 'Create a Fastify plugin for encapsulated functionality',
198
+ applicableCategories: ['authentication', 'caching', 'logging', 'data-access'],
199
+ filePatterns: ['plugins'],
200
+ pros: ['Encapsulated', 'Reusable', 'Scoped'],
201
+ cons: ['Plugin architecture learning curve'],
202
+ estimatedLines: 50,
203
+ },
204
+ ];
205
+ const FASTIFY_FRAMEWORK = {
206
+ name: 'fastify',
207
+ language: 'typescript',
208
+ detectPatterns: ['fastify.', 'FastifyInstance', 'FastifyRequest', 'FastifyReply', 'addHook'],
209
+ importPatterns: ['fastify', 'from \'fastify\''],
210
+ strategies: FASTIFY_STRATEGIES,
211
+ };
212
+ // ============================================================================
213
+ // TypeScript Strategy Provider
214
+ // ============================================================================
215
+ export class TypeScriptStrategyProvider {
216
+ language = 'typescript';
217
+ frameworks = [
218
+ NESTJS_FRAMEWORK, // Check NestJS first (more specific)
219
+ NEXTJS_FRAMEWORK,
220
+ FASTIFY_FRAMEWORK,
221
+ EXPRESS_FRAMEWORK, // Express last (most generic)
222
+ ];
223
+ getStrategies(category, framework) {
224
+ const fw = framework
225
+ ? this.frameworks.find(f => f.name === framework)
226
+ : this.frameworks[0]; // Default to first (NestJS)
227
+ if (!fw)
228
+ return [];
229
+ return fw.strategies.filter(s => s.applicableCategories.includes(category) ||
230
+ s.applicableCategories.includes('generic'));
231
+ }
232
+ detectFramework(content, _filePath) {
233
+ for (const fw of this.frameworks) {
234
+ // Check import patterns first (more reliable)
235
+ for (const pattern of fw.importPatterns) {
236
+ if (content.includes(pattern)) {
237
+ return fw.name;
238
+ }
239
+ }
240
+ // Then check code patterns
241
+ for (const pattern of fw.detectPatterns) {
242
+ if (content.includes(pattern)) {
243
+ return fw.name;
244
+ }
245
+ }
246
+ }
247
+ return null;
248
+ }
249
+ }
250
+ export const typescriptStrategyProvider = new TypeScriptStrategyProvider();
251
+ //# sourceMappingURL=typescript-strategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-strategies.js","sourceRoot":"","sources":["../../../src/simulation/language-strategies/typescript-strategies.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,MAAM,kBAAkB,GAAuB;IAC7C;QACE,QAAQ,EAAE,YAAY;QACtB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EAAE,0DAA0D;QACvE,oBAAoB,EAAE,CAAC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,gBAAgB,CAAC;QACrH,YAAY,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;QAC3C,IAAI,EAAE,CAAC,mBAAmB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,0BAA0B,CAAC;QAC3G,IAAI,EAAE,CAAC,+BAA+B,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;QAC7E,cAAc,EAAE,EAAE;QAClB,QAAQ,EAAE,6FAA6F;KAC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