@grafema/core 0.1.0-alpha.1

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 (402) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +76 -0
  3. package/dist/Orchestrator.d.ts +142 -0
  4. package/dist/Orchestrator.d.ts.map +1 -0
  5. package/dist/Orchestrator.js +481 -0
  6. package/dist/api/GraphAPI.d.ts +87 -0
  7. package/dist/api/GraphAPI.d.ts.map +1 -0
  8. package/dist/api/GraphAPI.js +210 -0
  9. package/dist/api/GuaranteeAPI.d.ts +147 -0
  10. package/dist/api/GuaranteeAPI.d.ts.map +1 -0
  11. package/dist/api/GuaranteeAPI.js +288 -0
  12. package/dist/core/ASTWorker.d.ts +133 -0
  13. package/dist/core/ASTWorker.d.ts.map +1 -0
  14. package/dist/core/ASTWorker.js +352 -0
  15. package/dist/core/ASTWorkerPool.d.ts +85 -0
  16. package/dist/core/ASTWorkerPool.d.ts.map +1 -0
  17. package/dist/core/ASTWorkerPool.js +207 -0
  18. package/dist/core/AnalysisQueue.d.ts +104 -0
  19. package/dist/core/AnalysisQueue.d.ts.map +1 -0
  20. package/dist/core/AnalysisQueue.js +299 -0
  21. package/dist/core/AnalysisWorker.d.ts +14 -0
  22. package/dist/core/AnalysisWorker.d.ts.map +1 -0
  23. package/dist/core/AnalysisWorker.js +307 -0
  24. package/dist/core/GraphBackend.d.ts +156 -0
  25. package/dist/core/GraphBackend.d.ts.map +1 -0
  26. package/dist/core/GraphBackend.js +85 -0
  27. package/dist/core/GuaranteeManager.d.ts +230 -0
  28. package/dist/core/GuaranteeManager.d.ts.map +1 -0
  29. package/dist/core/GuaranteeManager.js +352 -0
  30. package/dist/core/ManifestStore.d.ts +71 -0
  31. package/dist/core/ManifestStore.d.ts.map +1 -0
  32. package/dist/core/ManifestStore.js +146 -0
  33. package/dist/core/NodeFactory.d.ts +160 -0
  34. package/dist/core/NodeFactory.d.ts.map +1 -0
  35. package/dist/core/NodeFactory.js +137 -0
  36. package/dist/core/NodeId.d.ts +88 -0
  37. package/dist/core/NodeId.d.ts.map +1 -0
  38. package/dist/core/NodeId.js +170 -0
  39. package/dist/core/ParallelAnalyzer.d.ts +120 -0
  40. package/dist/core/ParallelAnalyzer.d.ts.map +1 -0
  41. package/dist/core/ParallelAnalyzer.js +331 -0
  42. package/dist/core/PriorityQueue.d.ts +106 -0
  43. package/dist/core/PriorityQueue.d.ts.map +1 -0
  44. package/dist/core/PriorityQueue.js +168 -0
  45. package/dist/core/Profiler.d.ts +75 -0
  46. package/dist/core/Profiler.d.ts.map +1 -0
  47. package/dist/core/Profiler.js +149 -0
  48. package/dist/core/QueueWorker.d.ts +12 -0
  49. package/dist/core/QueueWorker.d.ts.map +1 -0
  50. package/dist/core/QueueWorker.js +567 -0
  51. package/dist/core/RFDBClient.d.ts +179 -0
  52. package/dist/core/RFDBClient.d.ts.map +1 -0
  53. package/dist/core/RFDBClient.js +429 -0
  54. package/dist/core/Task.d.ts +56 -0
  55. package/dist/core/Task.d.ts.map +1 -0
  56. package/dist/core/Task.js +85 -0
  57. package/dist/core/TaskTypes.d.ts +20 -0
  58. package/dist/core/TaskTypes.d.ts.map +1 -0
  59. package/dist/core/TaskTypes.js +10 -0
  60. package/dist/core/VersionManager.d.ts +166 -0
  61. package/dist/core/VersionManager.d.ts.map +1 -0
  62. package/dist/core/VersionManager.js +237 -0
  63. package/dist/core/WorkerPool.d.ts +82 -0
  64. package/dist/core/WorkerPool.d.ts.map +1 -0
  65. package/dist/core/WorkerPool.js +109 -0
  66. package/dist/core/nodes/CallSiteNode.d.ts +26 -0
  67. package/dist/core/nodes/CallSiteNode.d.ts.map +1 -0
  68. package/dist/core/nodes/CallSiteNode.js +44 -0
  69. package/dist/core/nodes/ClassNode.d.ts +25 -0
  70. package/dist/core/nodes/ClassNode.d.ts.map +1 -0
  71. package/dist/core/nodes/ClassNode.js +40 -0
  72. package/dist/core/nodes/ConstantNode.d.ts +24 -0
  73. package/dist/core/nodes/ConstantNode.d.ts.map +1 -0
  74. package/dist/core/nodes/ConstantNode.js +39 -0
  75. package/dist/core/nodes/DatabaseQueryNode.d.ts +22 -0
  76. package/dist/core/nodes/DatabaseQueryNode.d.ts.map +1 -0
  77. package/dist/core/nodes/DatabaseQueryNode.js +37 -0
  78. package/dist/core/nodes/EntrypointNode.d.ts +102 -0
  79. package/dist/core/nodes/EntrypointNode.d.ts.map +1 -0
  80. package/dist/core/nodes/EntrypointNode.js +119 -0
  81. package/dist/core/nodes/EventListenerNode.d.ts +25 -0
  82. package/dist/core/nodes/EventListenerNode.d.ts.map +1 -0
  83. package/dist/core/nodes/EventListenerNode.js +39 -0
  84. package/dist/core/nodes/ExportNode.d.ts +26 -0
  85. package/dist/core/nodes/ExportNode.d.ts.map +1 -0
  86. package/dist/core/nodes/ExportNode.js +40 -0
  87. package/dist/core/nodes/ExternalStdioNode.d.ts +17 -0
  88. package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -0
  89. package/dist/core/nodes/ExternalStdioNode.js +26 -0
  90. package/dist/core/nodes/FunctionNode.d.ts +27 -0
  91. package/dist/core/nodes/FunctionNode.d.ts.map +1 -0
  92. package/dist/core/nodes/FunctionNode.js +53 -0
  93. package/dist/core/nodes/GuaranteeNode.d.ts +76 -0
  94. package/dist/core/nodes/GuaranteeNode.d.ts.map +1 -0
  95. package/dist/core/nodes/GuaranteeNode.js +117 -0
  96. package/dist/core/nodes/HttpRequestNode.d.ts +24 -0
  97. package/dist/core/nodes/HttpRequestNode.d.ts.map +1 -0
  98. package/dist/core/nodes/HttpRequestNode.js +38 -0
  99. package/dist/core/nodes/ImportNode.d.ts +27 -0
  100. package/dist/core/nodes/ImportNode.d.ts.map +1 -0
  101. package/dist/core/nodes/ImportNode.js +43 -0
  102. package/dist/core/nodes/LiteralNode.d.ts +26 -0
  103. package/dist/core/nodes/LiteralNode.d.ts.map +1 -0
  104. package/dist/core/nodes/LiteralNode.js +40 -0
  105. package/dist/core/nodes/MethodCallNode.d.ts +29 -0
  106. package/dist/core/nodes/MethodCallNode.d.ts.map +1 -0
  107. package/dist/core/nodes/MethodCallNode.js +47 -0
  108. package/dist/core/nodes/MethodNode.d.ts +29 -0
  109. package/dist/core/nodes/MethodNode.d.ts.map +1 -0
  110. package/dist/core/nodes/MethodNode.js +44 -0
  111. package/dist/core/nodes/ModuleNode.d.ts +29 -0
  112. package/dist/core/nodes/ModuleNode.d.ts.map +1 -0
  113. package/dist/core/nodes/ModuleNode.js +49 -0
  114. package/dist/core/nodes/NodeKind.d.ts +91 -0
  115. package/dist/core/nodes/NodeKind.d.ts.map +1 -0
  116. package/dist/core/nodes/NodeKind.js +146 -0
  117. package/dist/core/nodes/ParameterNode.d.ts +26 -0
  118. package/dist/core/nodes/ParameterNode.d.ts.map +1 -0
  119. package/dist/core/nodes/ParameterNode.js +43 -0
  120. package/dist/core/nodes/ScopeNode.d.ts +32 -0
  121. package/dist/core/nodes/ScopeNode.d.ts.map +1 -0
  122. package/dist/core/nodes/ScopeNode.js +47 -0
  123. package/dist/core/nodes/ServiceNode.d.ts +44 -0
  124. package/dist/core/nodes/ServiceNode.d.ts.map +1 -0
  125. package/dist/core/nodes/ServiceNode.js +49 -0
  126. package/dist/core/nodes/VariableDeclarationNode.d.ts +22 -0
  127. package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -0
  128. package/dist/core/nodes/VariableDeclarationNode.js +38 -0
  129. package/dist/core/nodes/index.d.ts +25 -0
  130. package/dist/core/nodes/index.d.ts.map +1 -0
  131. package/dist/core/nodes/index.js +30 -0
  132. package/dist/index.d.ts +57 -0
  133. package/dist/index.d.ts.map +1 -0
  134. package/dist/index.js +63 -0
  135. package/dist/plugins/Plugin.d.ts +44 -0
  136. package/dist/plugins/Plugin.d.ts.map +1 -0
  137. package/dist/plugins/Plugin.js +46 -0
  138. package/dist/plugins/analysis/DatabaseAnalyzer.d.ts +23 -0
  139. package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -0
  140. package/dist/plugins/analysis/DatabaseAnalyzer.js +260 -0
  141. package/dist/plugins/analysis/ExpressAnalyzer.d.ts +19 -0
  142. package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -0
  143. package/dist/plugins/analysis/ExpressAnalyzer.js +306 -0
  144. package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts +17 -0
  145. package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -0
  146. package/dist/plugins/analysis/ExpressRouteAnalyzer.js +308 -0
  147. package/dist/plugins/analysis/FetchAnalyzer.d.ts +38 -0
  148. package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -0
  149. package/dist/plugins/analysis/FetchAnalyzer.js +344 -0
  150. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +65 -0
  151. package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -0
  152. package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +472 -0
  153. package/dist/plugins/analysis/JSASTAnalyzer.d.ts +84 -0
  154. package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -0
  155. package/dist/plugins/analysis/JSASTAnalyzer.js +1378 -0
  156. package/dist/plugins/analysis/ReactAnalyzer.d.ts +90 -0
  157. package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -0
  158. package/dist/plugins/analysis/ReactAnalyzer.js +1153 -0
  159. package/dist/plugins/analysis/RustAnalyzer.d.ts +13 -0
  160. package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -0
  161. package/dist/plugins/analysis/RustAnalyzer.js +259 -0
  162. package/dist/plugins/analysis/SQLiteAnalyzer.d.ts +21 -0
  163. package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -0
  164. package/dist/plugins/analysis/SQLiteAnalyzer.js +317 -0
  165. package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts +35 -0
  166. package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -0
  167. package/dist/plugins/analysis/ServiceLayerAnalyzer.js +303 -0
  168. package/dist/plugins/analysis/SocketIOAnalyzer.d.ts +33 -0
  169. package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -0
  170. package/dist/plugins/analysis/SocketIOAnalyzer.js +283 -0
  171. package/dist/plugins/analysis/SystemDbAnalyzer.d.ts +27 -0
  172. package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -0
  173. package/dist/plugins/analysis/SystemDbAnalyzer.js +211 -0
  174. package/dist/plugins/analysis/ast/ConditionParser.d.ts +85 -0
  175. package/dist/plugins/analysis/ast/ConditionParser.d.ts.map +1 -0
  176. package/dist/plugins/analysis/ast/ConditionParser.js +277 -0
  177. package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts +15 -0
  178. package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts.map +1 -0
  179. package/dist/plugins/analysis/ast/ExpressionEvaluator.js +91 -0
  180. package/dist/plugins/analysis/ast/GraphBuilder.d.ts +77 -0
  181. package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -0
  182. package/dist/plugins/analysis/ast/GraphBuilder.js +1077 -0
  183. package/dist/plugins/analysis/ast/OxcAdapter.d.ts +41 -0
  184. package/dist/plugins/analysis/ast/OxcAdapter.d.ts.map +1 -0
  185. package/dist/plugins/analysis/ast/OxcAdapter.js +40 -0
  186. package/dist/plugins/analysis/ast/types.d.ts +346 -0
  187. package/dist/plugins/analysis/ast/types.d.ts.map +1 -0
  188. package/dist/plugins/analysis/ast/types.js +4 -0
  189. package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +93 -0
  190. package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -0
  191. package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +24 -0
  192. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +77 -0
  193. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -0
  194. package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +377 -0
  195. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +27 -0
  196. package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -0
  197. package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +232 -0
  198. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +25 -0
  199. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -0
  200. package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +172 -0
  201. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts +29 -0
  202. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -0
  203. package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +180 -0
  204. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +14 -0
  205. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -0
  206. package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +200 -0
  207. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +45 -0
  208. package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -0
  209. package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +150 -0
  210. package/dist/plugins/analysis/ast/visitors/index.d.ts +17 -0
  211. package/dist/plugins/analysis/ast/visitors/index.d.ts.map +1 -0
  212. package/dist/plugins/analysis/ast/visitors/index.js +13 -0
  213. package/dist/plugins/discovery/DiscoveryPlugin.d.ts +34 -0
  214. package/dist/plugins/discovery/DiscoveryPlugin.d.ts.map +1 -0
  215. package/dist/plugins/discovery/DiscoveryPlugin.js +26 -0
  216. package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts +26 -0
  217. package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -0
  218. package/dist/plugins/discovery/MonorepoServiceDiscovery.js +79 -0
  219. package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts +14 -0
  220. package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -0
  221. package/dist/plugins/discovery/SimpleProjectDiscovery.js +65 -0
  222. package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +19 -0
  223. package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +1 -0
  224. package/dist/plugins/discovery/ZonServiceDiscovery.js +204 -0
  225. package/dist/plugins/enrichment/AliasTracker.d.ts +40 -0
  226. package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -0
  227. package/dist/plugins/enrichment/AliasTracker.js +290 -0
  228. package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts +30 -0
  229. package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -0
  230. package/dist/plugins/enrichment/HTTPConnectionEnricher.js +135 -0
  231. package/dist/plugins/enrichment/ImportExportLinker.d.ts +30 -0
  232. package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -0
  233. package/dist/plugins/enrichment/ImportExportLinker.js +176 -0
  234. package/dist/plugins/enrichment/InstanceOfResolver.d.ts +21 -0
  235. package/dist/plugins/enrichment/InstanceOfResolver.d.ts.map +1 -0
  236. package/dist/plugins/enrichment/InstanceOfResolver.js +117 -0
  237. package/dist/plugins/enrichment/MethodCallResolver.d.ts +41 -0
  238. package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -0
  239. package/dist/plugins/enrichment/MethodCallResolver.js +252 -0
  240. package/dist/plugins/enrichment/MountPointResolver.d.ts +26 -0
  241. package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -0
  242. package/dist/plugins/enrichment/MountPointResolver.js +189 -0
  243. package/dist/plugins/enrichment/PrefixEvaluator.d.ts +89 -0
  244. package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -0
  245. package/dist/plugins/enrichment/PrefixEvaluator.js +415 -0
  246. package/dist/plugins/enrichment/RustFFIEnricher.d.ts +25 -0
  247. package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -0
  248. package/dist/plugins/enrichment/RustFFIEnricher.js +170 -0
  249. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +114 -0
  250. package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -0
  251. package/dist/plugins/enrichment/ValueDomainAnalyzer.js +464 -0
  252. package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts +27 -0
  253. package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -0
  254. package/dist/plugins/indexing/IncrementalModuleIndexer.js +238 -0
  255. package/dist/plugins/indexing/JSModuleIndexer.d.ts +33 -0
  256. package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -0
  257. package/dist/plugins/indexing/JSModuleIndexer.js +299 -0
  258. package/dist/plugins/indexing/RustModuleIndexer.d.ts +28 -0
  259. package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -0
  260. package/dist/plugins/indexing/RustModuleIndexer.js +140 -0
  261. package/dist/plugins/indexing/ServiceDetector.d.ts +46 -0
  262. package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -0
  263. package/dist/plugins/indexing/ServiceDetector.js +164 -0
  264. package/dist/plugins/validation/CallResolverValidator.d.ts +23 -0
  265. package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -0
  266. package/dist/plugins/validation/CallResolverValidator.js +108 -0
  267. package/dist/plugins/validation/DataFlowValidator.d.ts +24 -0
  268. package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -0
  269. package/dist/plugins/validation/DataFlowValidator.js +148 -0
  270. package/dist/plugins/validation/EvalBanValidator.d.ts +25 -0
  271. package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -0
  272. package/dist/plugins/validation/EvalBanValidator.js +123 -0
  273. package/dist/plugins/validation/GraphConnectivityValidator.d.ts +11 -0
  274. package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -0
  275. package/dist/plugins/validation/GraphConnectivityValidator.js +135 -0
  276. package/dist/plugins/validation/SQLInjectionValidator.d.ts +43 -0
  277. package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -0
  278. package/dist/plugins/validation/SQLInjectionValidator.js +251 -0
  279. package/dist/plugins/validation/ShadowingDetector.d.ts +26 -0
  280. package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -0
  281. package/dist/plugins/validation/ShadowingDetector.js +119 -0
  282. package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts +21 -0
  283. package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -0
  284. package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +151 -0
  285. package/dist/plugins/vcs/GitPlugin.d.ts +84 -0
  286. package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -0
  287. package/dist/plugins/vcs/GitPlugin.js +295 -0
  288. package/dist/plugins/vcs/VCSPlugin.d.ts +133 -0
  289. package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -0
  290. package/dist/plugins/vcs/VCSPlugin.js +82 -0
  291. package/dist/plugins/vcs/index.d.ts +10 -0
  292. package/dist/plugins/vcs/index.d.ts.map +1 -0
  293. package/dist/plugins/vcs/index.js +18 -0
  294. package/dist/storage/backends/RFDBServerBackend.d.ts +258 -0
  295. package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -0
  296. package/dist/storage/backends/RFDBServerBackend.js +565 -0
  297. package/dist/storage/backends/typeValidation.d.ts +47 -0
  298. package/dist/storage/backends/typeValidation.d.ts.map +1 -0
  299. package/dist/storage/backends/typeValidation.js +137 -0
  300. package/dist/validation/PathValidator.d.ts +81 -0
  301. package/dist/validation/PathValidator.d.ts.map +1 -0
  302. package/dist/validation/PathValidator.js +251 -0
  303. package/package.json +57 -0
  304. package/src/.rfguard/current-session.txt +1 -0
  305. package/src/Orchestrator.ts +673 -0
  306. package/src/api/GraphAPI.ts +305 -0
  307. package/src/api/GuaranteeAPI.ts +401 -0
  308. package/src/core/ASTWorker.ts +567 -0
  309. package/src/core/ASTWorkerPool.ts +299 -0
  310. package/src/core/AnalysisQueue.ts +447 -0
  311. package/src/core/AnalysisWorker.ts +410 -0
  312. package/src/core/GraphBackend.ts +265 -0
  313. package/src/core/GuaranteeManager.ts +581 -0
  314. package/src/core/ManifestStore.ts +196 -0
  315. package/src/core/NodeFactory.ts +274 -0
  316. package/src/core/NodeId.ts +257 -0
  317. package/src/core/ParallelAnalyzer.ts +476 -0
  318. package/src/core/PriorityQueue.ts +227 -0
  319. package/src/core/Profiler.ts +188 -0
  320. package/src/core/QueueWorker.ts +780 -0
  321. package/src/core/Task.ts +107 -0
  322. package/src/core/TaskTypes.ts +40 -0
  323. package/src/core/VersionManager.ts +404 -0
  324. package/src/core/WorkerPool.ts +180 -0
  325. package/src/core/nodes/CallSiteNode.ts +72 -0
  326. package/src/core/nodes/ClassNode.ts +69 -0
  327. package/src/core/nodes/ConstantNode.ts +63 -0
  328. package/src/core/nodes/DatabaseQueryNode.ts +60 -0
  329. package/src/core/nodes/EntrypointNode.ts +164 -0
  330. package/src/core/nodes/EventListenerNode.ts +64 -0
  331. package/src/core/nodes/ExportNode.ts +71 -0
  332. package/src/core/nodes/ExternalStdioNode.ts +36 -0
  333. package/src/core/nodes/FunctionNode.ts +78 -0
  334. package/src/core/nodes/GuaranteeNode.ts +162 -0
  335. package/src/core/nodes/HttpRequestNode.ts +63 -0
  336. package/src/core/nodes/ImportNode.ts +75 -0
  337. package/src/core/nodes/LiteralNode.ts +67 -0
  338. package/src/core/nodes/MethodCallNode.ts +79 -0
  339. package/src/core/nodes/MethodNode.ts +78 -0
  340. package/src/core/nodes/ModuleNode.ts +74 -0
  341. package/src/core/nodes/NodeKind.ts +171 -0
  342. package/src/core/nodes/ParameterNode.ts +73 -0
  343. package/src/core/nodes/ScopeNode.ts +80 -0
  344. package/src/core/nodes/ServiceNode.ts +86 -0
  345. package/src/core/nodes/VariableDeclarationNode.ts +60 -0
  346. package/src/core/nodes/index.ts +49 -0
  347. package/src/index.ts +93 -0
  348. package/src/plugins/Plugin.ts +74 -0
  349. package/src/plugins/analysis/DatabaseAnalyzer.ts +322 -0
  350. package/src/plugins/analysis/ExpressAnalyzer.ts +401 -0
  351. package/src/plugins/analysis/ExpressRouteAnalyzer.ts +414 -0
  352. package/src/plugins/analysis/FetchAnalyzer.ts +441 -0
  353. package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +686 -0
  354. package/src/plugins/analysis/JSASTAnalyzer.ts +1680 -0
  355. package/src/plugins/analysis/ReactAnalyzer.ts +1368 -0
  356. package/src/plugins/analysis/RustAnalyzer.ts +438 -0
  357. package/src/plugins/analysis/SQLiteAnalyzer.ts +388 -0
  358. package/src/plugins/analysis/ServiceLayerAnalyzer.ts +429 -0
  359. package/src/plugins/analysis/SocketIOAnalyzer.ts +395 -0
  360. package/src/plugins/analysis/SystemDbAnalyzer.ts +284 -0
  361. package/src/plugins/analysis/ast/ConditionParser.ts +333 -0
  362. package/src/plugins/analysis/ast/ExpressionEvaluator.ts +117 -0
  363. package/src/plugins/analysis/ast/GraphBuilder.ts +1371 -0
  364. package/src/plugins/analysis/ast/OxcAdapter.ts +63 -0
  365. package/src/plugins/analysis/ast/types.ts +400 -0
  366. package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +137 -0
  367. package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +528 -0
  368. package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +339 -0
  369. package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +273 -0
  370. package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +259 -0
  371. package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +235 -0
  372. package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +268 -0
  373. package/src/plugins/analysis/ast/visitors/index.ts +36 -0
  374. package/src/plugins/discovery/DiscoveryPlugin.ts +50 -0
  375. package/src/plugins/discovery/MonorepoServiceDiscovery.ts +117 -0
  376. package/src/plugins/discovery/SimpleProjectDiscovery.ts +102 -0
  377. package/src/plugins/enrichment/AliasTracker.ts +399 -0
  378. package/src/plugins/enrichment/HTTPConnectionEnricher.ts +192 -0
  379. package/src/plugins/enrichment/ImportExportLinker.ts +221 -0
  380. package/src/plugins/enrichment/InstanceOfResolver.ts +165 -0
  381. package/src/plugins/enrichment/MethodCallResolver.ts +333 -0
  382. package/src/plugins/enrichment/MountPointResolver.ts +264 -0
  383. package/src/plugins/enrichment/PrefixEvaluator.ts +527 -0
  384. package/src/plugins/enrichment/RustFFIEnricher.ts +218 -0
  385. package/src/plugins/enrichment/ValueDomainAnalyzer.ts +682 -0
  386. package/src/plugins/indexing/IncrementalModuleIndexer.ts +287 -0
  387. package/src/plugins/indexing/JSModuleIndexer.ts +374 -0
  388. package/src/plugins/indexing/RustModuleIndexer.ts +160 -0
  389. package/src/plugins/indexing/ServiceDetector.ts +230 -0
  390. package/src/plugins/validation/CallResolverValidator.ts +170 -0
  391. package/src/plugins/validation/DataFlowValidator.ts +233 -0
  392. package/src/plugins/validation/EvalBanValidator.ts +175 -0
  393. package/src/plugins/validation/GraphConnectivityValidator.ts +201 -0
  394. package/src/plugins/validation/SQLInjectionValidator.ts +363 -0
  395. package/src/plugins/validation/ShadowingDetector.ts +173 -0
  396. package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +203 -0
  397. package/src/plugins/vcs/GitPlugin.ts +344 -0
  398. package/src/plugins/vcs/VCSPlugin.ts +190 -0
  399. package/src/plugins/vcs/index.ts +32 -0
  400. package/src/storage/backends/RFDBServerBackend.ts +687 -0
  401. package/src/storage/backends/typeValidation.ts +151 -0
  402. package/src/validation/PathValidator.ts +342 -0
@@ -0,0 +1,109 @@
1
+ /**
2
+ * WorkerPool - worker pool for parallel task execution
3
+ *
4
+ * Key property: HORIZONTAL SCALING
5
+ * More workers = faster processing (up to CPU/IO limit)
6
+ */
7
+ import { EventEmitter } from 'events';
8
+ export class WorkerPool extends EventEmitter {
9
+ workerCount;
10
+ handlers;
11
+ activeWorkers;
12
+ running;
13
+ constructor(workerCount = 10, handlers = {}) {
14
+ super();
15
+ this.workerCount = workerCount;
16
+ this.handlers = handlers;
17
+ this.activeWorkers = 0;
18
+ this.running = false;
19
+ }
20
+ /**
21
+ * Register handler for task type
22
+ */
23
+ registerHandler(taskType, handler) {
24
+ this.handlers[taskType] = handler;
25
+ }
26
+ /**
27
+ * Start queue processing
28
+ */
29
+ async processQueue(queue) {
30
+ this.running = true;
31
+ this.emit('pool:started', { workerCount: this.workerCount });
32
+ // Create workers
33
+ const workers = [];
34
+ for (let i = 0; i < this.workerCount; i++) {
35
+ workers.push(this._worker(i, queue));
36
+ }
37
+ // Wait for all workers to complete
38
+ await Promise.all(workers);
39
+ this.running = false;
40
+ this.emit('pool:finished', queue.getStats());
41
+ }
42
+ /**
43
+ * Worker - picks task from queue and executes
44
+ */
45
+ async _worker(workerId, queue) {
46
+ while (true) {
47
+ // If queue is empty AND no active workers - exit
48
+ if (queue.isEmpty && this.activeWorkers === 0) {
49
+ break;
50
+ }
51
+ // Get next task
52
+ const task = queue.next();
53
+ if (!task) {
54
+ // No ready tasks, wait a bit
55
+ await this._sleep(10);
56
+ continue;
57
+ }
58
+ this.activeWorkers++;
59
+ this.emit('worker:task:start', { workerId, task });
60
+ this.emit('worker:task:started', task); // For progress tracking
61
+ try {
62
+ // Execute task
63
+ const handler = task.type ? this.handlers[task.type] : undefined;
64
+ if (!handler) {
65
+ throw new Error(`No handler for task type: ${task.type}`);
66
+ }
67
+ task.start();
68
+ const result = await handler(task);
69
+ queue.complete(task.id, result);
70
+ this.emit('worker:task:completed', { workerId, task, result });
71
+ }
72
+ catch (error) {
73
+ queue.fail(task.id, error);
74
+ this.emit('worker:task:failed', { workerId, task, error });
75
+ }
76
+ finally {
77
+ this.activeWorkers--;
78
+ }
79
+ }
80
+ this.emit('worker:stopped', { workerId });
81
+ }
82
+ /**
83
+ * Sleep helper
84
+ */
85
+ _sleep(ms) {
86
+ return new Promise(resolve => setTimeout(resolve, ms));
87
+ }
88
+ /**
89
+ * Stop pool (graceful shutdown)
90
+ */
91
+ async stop() {
92
+ this.running = false;
93
+ // Wait for all active workers to complete current tasks
94
+ while (this.activeWorkers > 0) {
95
+ await this._sleep(100);
96
+ }
97
+ this.emit('pool:stopped');
98
+ }
99
+ /**
100
+ * Statistics
101
+ */
102
+ getStats() {
103
+ return {
104
+ workerCount: this.workerCount,
105
+ activeWorkers: this.activeWorkers,
106
+ running: this.running
107
+ };
108
+ }
109
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * CallSiteNode - contract for CALL_SITE node
3
+ */
4
+ import type { BaseNodeRecord } from '@grafema/types';
5
+ interface CallSiteNodeRecord extends BaseNodeRecord {
6
+ type: 'CALL_SITE';
7
+ column: number;
8
+ parentScopeId?: string;
9
+ targetFunctionName: string;
10
+ }
11
+ interface CallSiteNodeOptions {
12
+ parentScopeId?: string;
13
+ counter?: number;
14
+ }
15
+ export declare class CallSiteNode {
16
+ static readonly TYPE: "CALL_SITE";
17
+ static readonly REQUIRED: readonly ["name", "file", "line"];
18
+ static readonly OPTIONAL: readonly ["column", "parentScopeId", "targetFunctionName"];
19
+ /**
20
+ * Create CALL_SITE node
21
+ */
22
+ static create(targetName: string, file: string, line: number, column: number, options?: CallSiteNodeOptions): CallSiteNodeRecord;
23
+ static validate(node: CallSiteNodeRecord): string[];
24
+ }
25
+ export type { CallSiteNodeRecord };
26
+ //# sourceMappingURL=CallSiteNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallSiteNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/CallSiteNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,kBAAmB,SAAQ,cAAc;IACjD,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,UAAU,mBAAmB;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,WAAW,CAAU;IAE5C,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,6DAA8D;IAEtF;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,kBAAkB;IAoBrB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,EAAE;CAgBpD;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * CallSiteNode - contract for CALL_SITE node
3
+ */
4
+ export class CallSiteNode {
5
+ static TYPE = 'CALL_SITE';
6
+ static REQUIRED = ['name', 'file', 'line'];
7
+ static OPTIONAL = ['column', 'parentScopeId', 'targetFunctionName'];
8
+ /**
9
+ * Create CALL_SITE node
10
+ */
11
+ static create(targetName, file, line, column, options = {}) {
12
+ if (!targetName)
13
+ throw new Error('CallSiteNode.create: targetName is required');
14
+ if (!file)
15
+ throw new Error('CallSiteNode.create: file is required');
16
+ if (line === undefined)
17
+ throw new Error('CallSiteNode.create: line is required');
18
+ const counter = options.counter !== undefined ? `:${options.counter}` : '';
19
+ const id = `${file}:CALL_SITE:${targetName}:${line}:${column || 0}${counter}`;
20
+ return {
21
+ id,
22
+ type: this.TYPE,
23
+ name: targetName,
24
+ file,
25
+ line,
26
+ column: column || 0,
27
+ parentScopeId: options.parentScopeId,
28
+ targetFunctionName: targetName
29
+ };
30
+ }
31
+ static validate(node) {
32
+ const errors = [];
33
+ if (node.type !== this.TYPE) {
34
+ errors.push(`Expected type ${this.TYPE}, got ${node.type}`);
35
+ }
36
+ const nodeRecord = node;
37
+ for (const field of this.REQUIRED) {
38
+ if (nodeRecord[field] === undefined || nodeRecord[field] === null) {
39
+ errors.push(`Missing required field: ${field}`);
40
+ }
41
+ }
42
+ return errors;
43
+ }
44
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * ClassNode - contract for CLASS node
3
+ */
4
+ import type { BaseNodeRecord } from '@grafema/types';
5
+ interface ClassNodeRecord extends BaseNodeRecord {
6
+ type: 'CLASS';
7
+ column: number;
8
+ exported: boolean;
9
+ superClass?: string;
10
+ methods: string[];
11
+ }
12
+ interface ClassNodeOptions {
13
+ exported?: boolean;
14
+ superClass?: string;
15
+ methods?: string[];
16
+ }
17
+ export declare class ClassNode {
18
+ static readonly TYPE: "CLASS";
19
+ static readonly REQUIRED: readonly ["name", "file", "line"];
20
+ static readonly OPTIONAL: readonly ["column", "exported", "superClass", "methods"];
21
+ static create(name: string, file: string, line: number, column: number, options?: ClassNodeOptions): ClassNodeRecord;
22
+ static validate(node: ClassNodeRecord): string[];
23
+ }
24
+ export type { ClassNodeRecord };
25
+ //# sourceMappingURL=ClassNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/ClassNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,eAAgB,SAAQ,cAAc;IAC9C,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,UAAU,gBAAgB;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,qBAAa,SAAS;IACpB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,OAAO,CAAU;IAExC,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,2DAA4D;IAEpF,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,gBAAqB,GAC7B,eAAe;IAkBlB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,EAAE;CAgBjD;AAED,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * ClassNode - contract for CLASS node
3
+ */
4
+ export class ClassNode {
5
+ static TYPE = 'CLASS';
6
+ static REQUIRED = ['name', 'file', 'line'];
7
+ static OPTIONAL = ['column', 'exported', 'superClass', 'methods'];
8
+ static create(name, file, line, column, options = {}) {
9
+ if (!name)
10
+ throw new Error('ClassNode.create: name is required');
11
+ if (!file)
12
+ throw new Error('ClassNode.create: file is required');
13
+ if (!line)
14
+ throw new Error('ClassNode.create: line is required');
15
+ return {
16
+ id: `${file}:CLASS:${name}:${line}`,
17
+ type: this.TYPE,
18
+ name,
19
+ file,
20
+ line,
21
+ column: column || 0,
22
+ exported: options.exported || false,
23
+ superClass: options.superClass,
24
+ methods: options.methods || []
25
+ };
26
+ }
27
+ static validate(node) {
28
+ const errors = [];
29
+ if (node.type !== this.TYPE) {
30
+ errors.push(`Expected type ${this.TYPE}, got ${node.type}`);
31
+ }
32
+ const nodeRecord = node;
33
+ for (const field of this.REQUIRED) {
34
+ if (!nodeRecord[field]) {
35
+ errors.push(`Missing required field: ${field}`);
36
+ }
37
+ }
38
+ return errors;
39
+ }
40
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * ConstantNode - contract for CONSTANT node
3
+ */
4
+ import type { BaseNodeRecord } from '@grafema/types';
5
+ interface ConstantNodeRecord extends BaseNodeRecord {
6
+ type: 'CONSTANT';
7
+ column: number;
8
+ value?: unknown;
9
+ parentScopeId?: string;
10
+ }
11
+ interface ConstantNodeOptions {
12
+ value?: unknown;
13
+ parentScopeId?: string;
14
+ counter?: number;
15
+ }
16
+ export declare class ConstantNode {
17
+ static readonly TYPE: "CONSTANT";
18
+ static readonly REQUIRED: readonly ["name", "file", "line"];
19
+ static readonly OPTIONAL: readonly ["column", "value", "parentScopeId"];
20
+ static create(name: string, file: string, line: number, column: number, options?: ConstantNodeOptions): ConstantNodeRecord;
21
+ static validate(node: ConstantNodeRecord): string[];
22
+ }
23
+ export type { ConstantNodeRecord };
24
+ //# sourceMappingURL=ConstantNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConstantNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/ConstantNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,kBAAmB,SAAQ,cAAc;IACjD,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IAE3C,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,gDAAiD;IAEzE,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,kBAAkB;IAoBrB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,EAAE;CASpD;AAED,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * ConstantNode - contract for CONSTANT node
3
+ */
4
+ export class ConstantNode {
5
+ static TYPE = 'CONSTANT';
6
+ static REQUIRED = ['name', 'file', 'line'];
7
+ static OPTIONAL = ['column', 'value', 'parentScopeId'];
8
+ static create(name, file, line, column, options = {}) {
9
+ if (!name)
10
+ throw new Error('ConstantNode.create: name is required');
11
+ if (!file)
12
+ throw new Error('ConstantNode.create: file is required');
13
+ if (line === undefined)
14
+ throw new Error('ConstantNode.create: line is required');
15
+ const counter = options.counter !== undefined ? `:${options.counter}` : '';
16
+ const id = `${file}:CONSTANT:${name}:${line}:${column || 0}${counter}`;
17
+ return {
18
+ id,
19
+ type: this.TYPE,
20
+ name,
21
+ file,
22
+ line,
23
+ column: column || 0,
24
+ value: options.value,
25
+ parentScopeId: options.parentScopeId
26
+ };
27
+ }
28
+ static validate(node) {
29
+ const errors = [];
30
+ if (node.type !== this.TYPE)
31
+ errors.push(`Expected type ${this.TYPE}`);
32
+ const nodeRecord = node;
33
+ for (const field of this.REQUIRED) {
34
+ if (nodeRecord[field] === undefined)
35
+ errors.push(`Missing: ${field}`);
36
+ }
37
+ return errors;
38
+ }
39
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * DatabaseQueryNode - contract for DATABASE_QUERY node
3
+ */
4
+ import type { BaseNodeRecord } from '@grafema/types';
5
+ interface DatabaseQueryNodeRecord extends BaseNodeRecord {
6
+ type: 'DATABASE_QUERY';
7
+ query?: string;
8
+ operation: string;
9
+ parentScopeId?: string;
10
+ }
11
+ interface DatabaseQueryNodeOptions {
12
+ parentScopeId?: string;
13
+ }
14
+ export declare class DatabaseQueryNode {
15
+ static readonly TYPE: "DATABASE_QUERY";
16
+ static readonly REQUIRED: readonly ["name", "file", "line"];
17
+ static readonly OPTIONAL: readonly ["query", "operation", "parentScopeId"];
18
+ static create(query: string | undefined, operation: string | undefined, file: string, line: number, options?: DatabaseQueryNodeOptions): DatabaseQueryNodeRecord;
19
+ static validate(node: DatabaseQueryNodeRecord): string[];
20
+ }
21
+ export type { DatabaseQueryNodeRecord };
22
+ //# sourceMappingURL=DatabaseQueryNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DatabaseQueryNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/DatabaseQueryNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,uBAAwB,SAAQ,cAAc;IACtD,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,wBAAwB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,gBAAgB,CAAU;IAEjD,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,mDAAoD;IAE5E,MAAM,CAAC,MAAM,CACX,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,wBAA6B,GACrC,uBAAuB;IAmB1B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,uBAAuB,GAAG,MAAM,EAAE;CASzD;AAED,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * DatabaseQueryNode - contract for DATABASE_QUERY node
3
+ */
4
+ export class DatabaseQueryNode {
5
+ static TYPE = 'DATABASE_QUERY';
6
+ static REQUIRED = ['name', 'file', 'line'];
7
+ static OPTIONAL = ['query', 'operation', 'parentScopeId'];
8
+ static create(query, operation, file, line, options = {}) {
9
+ if (!file)
10
+ throw new Error('DatabaseQueryNode.create: file is required');
11
+ if (line === undefined)
12
+ throw new Error('DatabaseQueryNode.create: line is required');
13
+ const name = query || `${operation || 'QUERY'}`;
14
+ const id = `${file}:DATABASE_QUERY:${name}:${line}`;
15
+ return {
16
+ id,
17
+ type: this.TYPE,
18
+ name,
19
+ query,
20
+ operation: operation || 'UNKNOWN',
21
+ file,
22
+ line,
23
+ parentScopeId: options.parentScopeId
24
+ };
25
+ }
26
+ static validate(node) {
27
+ const errors = [];
28
+ if (node.type !== this.TYPE)
29
+ errors.push(`Expected type ${this.TYPE}`);
30
+ const nodeRecord = node;
31
+ for (const field of this.REQUIRED) {
32
+ if (nodeRecord[field] === undefined)
33
+ errors.push(`Missing: ${field}`);
34
+ }
35
+ return errors;
36
+ }
37
+ }
@@ -0,0 +1,102 @@
1
+ /**
2
+ * EntrypointNode - represents an executable entry point
3
+ *
4
+ * An ENTRYPOINT is any file that can be executed directly:
5
+ * - service: main app entrypoint (package.json main/bin)
6
+ * - cli: command-line tool
7
+ * - test: test file
8
+ * - script: dev/build script (package.json scripts)
9
+ * - hook: git/tool hook (.husky/*, hooks/*.mjs)
10
+ * - config: build config (*.config.js)
11
+ */
12
+ import type { BaseNodeRecord } from '@grafema/types';
13
+ export declare const ENTRYPOINT_TYPES: {
14
+ readonly SERVICE: "service";
15
+ readonly CLI: "cli";
16
+ readonly TEST: "test";
17
+ readonly SCRIPT: "script";
18
+ readonly HOOK: "hook";
19
+ readonly CONFIG: "config";
20
+ };
21
+ export type EntrypointType = typeof ENTRYPOINT_TYPES[keyof typeof ENTRYPOINT_TYPES];
22
+ export declare const ENTRYPOINT_TRIGGERS: {
23
+ readonly RUNTIME: "runtime";
24
+ readonly BUILD: "build";
25
+ readonly DEV: "dev";
26
+ readonly CI: "ci";
27
+ readonly MANUAL: "manual";
28
+ };
29
+ export type EntrypointTrigger = typeof ENTRYPOINT_TRIGGERS[keyof typeof ENTRYPOINT_TRIGGERS];
30
+ export declare const ENTRYPOINT_SOURCES: {
31
+ readonly PACKAGE_MAIN: "package.json:main";
32
+ readonly PACKAGE_BIN: "package.json:bin";
33
+ readonly PACKAGE_SCRIPT: "package.json:scripts";
34
+ readonly CONVENTION: "convention";
35
+ readonly CONFIG: "config";
36
+ readonly MANUAL: "manual";
37
+ };
38
+ export type EntrypointSource = typeof ENTRYPOINT_SOURCES[keyof typeof ENTRYPOINT_SOURCES];
39
+ interface EntrypointNodeRecord extends BaseNodeRecord {
40
+ type: 'ENTRYPOINT';
41
+ entrypointType: EntrypointType;
42
+ trigger: EntrypointTrigger;
43
+ source: string;
44
+ serviceId: string | null;
45
+ }
46
+ interface EntrypointNodeOptions {
47
+ id?: string;
48
+ name?: string;
49
+ trigger?: EntrypointTrigger;
50
+ source?: string;
51
+ serviceId?: string;
52
+ }
53
+ export declare class EntrypointNode {
54
+ static readonly TYPE: "ENTRYPOINT";
55
+ static readonly REQUIRED: readonly ["file", "entrypointType"];
56
+ static readonly OPTIONAL: readonly ["trigger", "source", "serviceId", "name"];
57
+ static readonly TYPES: {
58
+ readonly SERVICE: "service";
59
+ readonly CLI: "cli";
60
+ readonly TEST: "test";
61
+ readonly SCRIPT: "script";
62
+ readonly HOOK: "hook";
63
+ readonly CONFIG: "config";
64
+ };
65
+ static readonly TRIGGERS: {
66
+ readonly RUNTIME: "runtime";
67
+ readonly BUILD: "build";
68
+ readonly DEV: "dev";
69
+ readonly CI: "ci";
70
+ readonly MANUAL: "manual";
71
+ };
72
+ static readonly SOURCES: {
73
+ readonly PACKAGE_MAIN: "package.json:main";
74
+ readonly PACKAGE_BIN: "package.json:bin";
75
+ readonly PACKAGE_SCRIPT: "package.json:scripts";
76
+ readonly CONVENTION: "convention";
77
+ readonly CONFIG: "config";
78
+ readonly MANUAL: "manual";
79
+ };
80
+ /**
81
+ * Create ENTRYPOINT node
82
+ */
83
+ static create(file: string, entrypointType: EntrypointType, options?: EntrypointNodeOptions): EntrypointNodeRecord;
84
+ /**
85
+ * Generate stable ID for entrypoint
86
+ */
87
+ static generateId(file: string, type: string): string;
88
+ /**
89
+ * Extract name from file path
90
+ */
91
+ static extractName(file: string): string;
92
+ /**
93
+ * Infer trigger from entrypoint type
94
+ */
95
+ static inferTrigger(entrypointType: EntrypointType): EntrypointTrigger;
96
+ /**
97
+ * Validate ENTRYPOINT node
98
+ */
99
+ static validate(node: EntrypointNodeRecord): string[];
100
+ }
101
+ export type { EntrypointNodeRecord };
102
+ //# sourceMappingURL=EntrypointNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntrypointNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/EntrypointNode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,eAAO,MAAM,gBAAgB;;;;;;;CAOnB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,gBAAgB,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAGpF,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,OAAO,mBAAmB,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAG7F,eAAO,MAAM,kBAAkB;;;;;;;CAOrB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,kBAAkB,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE1F,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,qBAAqB;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,YAAY,CAAU;IAE7C,MAAM,CAAC,QAAQ,CAAC,QAAQ,sCAAuC;IAC/D,MAAM,CAAC,QAAQ,CAAC,QAAQ,sDAAuD;IAE/E,MAAM,CAAC,QAAQ,CAAC,KAAK;;;;;;;MAAoB;IACzC,MAAM,CAAC,QAAQ,CAAC,QAAQ;;;;;;MAAuB;IAC/C,MAAM,CAAC,QAAQ,CAAC,OAAO;;;;;;;MAAsB;IAE7C;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc,EAC9B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB;IAmBvB;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAKrD;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAKxC;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,iBAAiB;IAiBtE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,EAAE;CAoBtD;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * EntrypointNode - represents an executable entry point
3
+ *
4
+ * An ENTRYPOINT is any file that can be executed directly:
5
+ * - service: main app entrypoint (package.json main/bin)
6
+ * - cli: command-line tool
7
+ * - test: test file
8
+ * - script: dev/build script (package.json scripts)
9
+ * - hook: git/tool hook (.husky/*, hooks/*.mjs)
10
+ * - config: build config (*.config.js)
11
+ */
12
+ import { createHash } from 'crypto';
13
+ // Entrypoint types
14
+ export const ENTRYPOINT_TYPES = {
15
+ SERVICE: 'service', // Main app entrypoint
16
+ CLI: 'cli', // Command-line tool
17
+ TEST: 'test', // Test file
18
+ SCRIPT: 'script', // Dev/build script
19
+ HOOK: 'hook', // Git/tool hook
20
+ CONFIG: 'config' // Build config file
21
+ };
22
+ // What triggers execution
23
+ export const ENTRYPOINT_TRIGGERS = {
24
+ RUNTIME: 'runtime', // Production runtime
25
+ BUILD: 'build', // Build process
26
+ DEV: 'dev', // Development
27
+ CI: 'ci', // CI/CD pipeline
28
+ MANUAL: 'manual' // Manual execution
29
+ };
30
+ // How entrypoint was discovered
31
+ export const ENTRYPOINT_SOURCES = {
32
+ PACKAGE_MAIN: 'package.json:main',
33
+ PACKAGE_BIN: 'package.json:bin',
34
+ PACKAGE_SCRIPT: 'package.json:scripts',
35
+ CONVENTION: 'convention',
36
+ CONFIG: 'config',
37
+ MANUAL: 'manual'
38
+ };
39
+ export class EntrypointNode {
40
+ static TYPE = 'ENTRYPOINT';
41
+ static REQUIRED = ['file', 'entrypointType'];
42
+ static OPTIONAL = ['trigger', 'source', 'serviceId', 'name'];
43
+ static TYPES = ENTRYPOINT_TYPES;
44
+ static TRIGGERS = ENTRYPOINT_TRIGGERS;
45
+ static SOURCES = ENTRYPOINT_SOURCES;
46
+ /**
47
+ * Create ENTRYPOINT node
48
+ */
49
+ static create(file, entrypointType, options = {}) {
50
+ if (!file)
51
+ throw new Error('EntrypointNode.create: file is required');
52
+ if (!entrypointType)
53
+ throw new Error('EntrypointNode.create: entrypointType is required');
54
+ const id = options.id || this.generateId(file, entrypointType);
55
+ return {
56
+ id,
57
+ type: this.TYPE,
58
+ file,
59
+ line: 0,
60
+ name: options.name || this.extractName(file),
61
+ entrypointType,
62
+ trigger: options.trigger || this.inferTrigger(entrypointType),
63
+ source: options.source || 'unknown',
64
+ serviceId: options.serviceId || null
65
+ };
66
+ }
67
+ /**
68
+ * Generate stable ID for entrypoint
69
+ */
70
+ static generateId(file, type) {
71
+ const hash = createHash('md5').update(file).digest('hex').substring(0, 8);
72
+ return `ENTRYPOINT:${type}:${hash}`;
73
+ }
74
+ /**
75
+ * Extract name from file path
76
+ */
77
+ static extractName(file) {
78
+ const parts = file.split('/');
79
+ return parts[parts.length - 1];
80
+ }
81
+ /**
82
+ * Infer trigger from entrypoint type
83
+ */
84
+ static inferTrigger(entrypointType) {
85
+ switch (entrypointType) {
86
+ case this.TYPES.SERVICE:
87
+ case this.TYPES.CLI:
88
+ return this.TRIGGERS.RUNTIME;
89
+ case this.TYPES.TEST:
90
+ return this.TRIGGERS.CI;
91
+ case this.TYPES.CONFIG:
92
+ return this.TRIGGERS.BUILD;
93
+ case this.TYPES.SCRIPT:
94
+ case this.TYPES.HOOK:
95
+ return this.TRIGGERS.DEV;
96
+ default:
97
+ return this.TRIGGERS.MANUAL;
98
+ }
99
+ }
100
+ /**
101
+ * Validate ENTRYPOINT node
102
+ */
103
+ static validate(node) {
104
+ const errors = [];
105
+ if (node.type !== this.TYPE) {
106
+ errors.push(`Expected type ${this.TYPE}, got ${node.type}`);
107
+ }
108
+ const nodeRecord = node;
109
+ for (const field of this.REQUIRED) {
110
+ if (!nodeRecord[field]) {
111
+ errors.push(`Missing required field: ${field}`);
112
+ }
113
+ }
114
+ if (node.entrypointType && !Object.values(this.TYPES).includes(node.entrypointType)) {
115
+ errors.push(`Invalid entrypointType: ${node.entrypointType}`);
116
+ }
117
+ return errors;
118
+ }
119
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * EventListenerNode - contract for EVENT_LISTENER node
3
+ */
4
+ import type { BaseNodeRecord } from '@grafema/types';
5
+ interface EventListenerNodeRecord extends BaseNodeRecord {
6
+ type: 'EVENT_LISTENER';
7
+ object?: string;
8
+ parentScopeId?: string;
9
+ callbackArg?: string;
10
+ }
11
+ interface EventListenerNodeOptions {
12
+ column?: number;
13
+ parentScopeId?: string;
14
+ callbackArg?: string;
15
+ counter?: number;
16
+ }
17
+ export declare class EventListenerNode {
18
+ static readonly TYPE: "EVENT_LISTENER";
19
+ static readonly REQUIRED: readonly ["name", "file", "line"];
20
+ static readonly OPTIONAL: readonly ["object", "column", "parentScopeId", "callbackArg"];
21
+ static create(eventName: string, objectName: string | undefined, file: string, line: number, options?: EventListenerNodeOptions): EventListenerNodeRecord;
22
+ static validate(node: EventListenerNodeRecord): string[];
23
+ }
24
+ export type { EventListenerNodeRecord };
25
+ //# sourceMappingURL=EventListenerNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventListenerNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/EventListenerNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,uBAAwB,SAAQ,cAAc;IACtD,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,wBAAwB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,gBAAgB,CAAU;IAEjD,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,gEAAiE;IAEzF,MAAM,CAAC,MAAM,CACX,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,wBAA6B,GACrC,uBAAuB;IAoB1B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,uBAAuB,GAAG,MAAM,EAAE;CASzD;AAED,YAAY,EAAE,uBAAuB,EAAE,CAAC"}