@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.
- package/LICENSE +190 -0
- package/README.md +76 -0
- package/dist/Orchestrator.d.ts +142 -0
- package/dist/Orchestrator.d.ts.map +1 -0
- package/dist/Orchestrator.js +481 -0
- package/dist/api/GraphAPI.d.ts +87 -0
- package/dist/api/GraphAPI.d.ts.map +1 -0
- package/dist/api/GraphAPI.js +210 -0
- package/dist/api/GuaranteeAPI.d.ts +147 -0
- package/dist/api/GuaranteeAPI.d.ts.map +1 -0
- package/dist/api/GuaranteeAPI.js +288 -0
- package/dist/core/ASTWorker.d.ts +133 -0
- package/dist/core/ASTWorker.d.ts.map +1 -0
- package/dist/core/ASTWorker.js +352 -0
- package/dist/core/ASTWorkerPool.d.ts +85 -0
- package/dist/core/ASTWorkerPool.d.ts.map +1 -0
- package/dist/core/ASTWorkerPool.js +207 -0
- package/dist/core/AnalysisQueue.d.ts +104 -0
- package/dist/core/AnalysisQueue.d.ts.map +1 -0
- package/dist/core/AnalysisQueue.js +299 -0
- package/dist/core/AnalysisWorker.d.ts +14 -0
- package/dist/core/AnalysisWorker.d.ts.map +1 -0
- package/dist/core/AnalysisWorker.js +307 -0
- package/dist/core/GraphBackend.d.ts +156 -0
- package/dist/core/GraphBackend.d.ts.map +1 -0
- package/dist/core/GraphBackend.js +85 -0
- package/dist/core/GuaranteeManager.d.ts +230 -0
- package/dist/core/GuaranteeManager.d.ts.map +1 -0
- package/dist/core/GuaranteeManager.js +352 -0
- package/dist/core/ManifestStore.d.ts +71 -0
- package/dist/core/ManifestStore.d.ts.map +1 -0
- package/dist/core/ManifestStore.js +146 -0
- package/dist/core/NodeFactory.d.ts +160 -0
- package/dist/core/NodeFactory.d.ts.map +1 -0
- package/dist/core/NodeFactory.js +137 -0
- package/dist/core/NodeId.d.ts +88 -0
- package/dist/core/NodeId.d.ts.map +1 -0
- package/dist/core/NodeId.js +170 -0
- package/dist/core/ParallelAnalyzer.d.ts +120 -0
- package/dist/core/ParallelAnalyzer.d.ts.map +1 -0
- package/dist/core/ParallelAnalyzer.js +331 -0
- package/dist/core/PriorityQueue.d.ts +106 -0
- package/dist/core/PriorityQueue.d.ts.map +1 -0
- package/dist/core/PriorityQueue.js +168 -0
- package/dist/core/Profiler.d.ts +75 -0
- package/dist/core/Profiler.d.ts.map +1 -0
- package/dist/core/Profiler.js +149 -0
- package/dist/core/QueueWorker.d.ts +12 -0
- package/dist/core/QueueWorker.d.ts.map +1 -0
- package/dist/core/QueueWorker.js +567 -0
- package/dist/core/RFDBClient.d.ts +179 -0
- package/dist/core/RFDBClient.d.ts.map +1 -0
- package/dist/core/RFDBClient.js +429 -0
- package/dist/core/Task.d.ts +56 -0
- package/dist/core/Task.d.ts.map +1 -0
- package/dist/core/Task.js +85 -0
- package/dist/core/TaskTypes.d.ts +20 -0
- package/dist/core/TaskTypes.d.ts.map +1 -0
- package/dist/core/TaskTypes.js +10 -0
- package/dist/core/VersionManager.d.ts +166 -0
- package/dist/core/VersionManager.d.ts.map +1 -0
- package/dist/core/VersionManager.js +237 -0
- package/dist/core/WorkerPool.d.ts +82 -0
- package/dist/core/WorkerPool.d.ts.map +1 -0
- package/dist/core/WorkerPool.js +109 -0
- package/dist/core/nodes/CallSiteNode.d.ts +26 -0
- package/dist/core/nodes/CallSiteNode.d.ts.map +1 -0
- package/dist/core/nodes/CallSiteNode.js +44 -0
- package/dist/core/nodes/ClassNode.d.ts +25 -0
- package/dist/core/nodes/ClassNode.d.ts.map +1 -0
- package/dist/core/nodes/ClassNode.js +40 -0
- package/dist/core/nodes/ConstantNode.d.ts +24 -0
- package/dist/core/nodes/ConstantNode.d.ts.map +1 -0
- package/dist/core/nodes/ConstantNode.js +39 -0
- package/dist/core/nodes/DatabaseQueryNode.d.ts +22 -0
- package/dist/core/nodes/DatabaseQueryNode.d.ts.map +1 -0
- package/dist/core/nodes/DatabaseQueryNode.js +37 -0
- package/dist/core/nodes/EntrypointNode.d.ts +102 -0
- package/dist/core/nodes/EntrypointNode.d.ts.map +1 -0
- package/dist/core/nodes/EntrypointNode.js +119 -0
- package/dist/core/nodes/EventListenerNode.d.ts +25 -0
- package/dist/core/nodes/EventListenerNode.d.ts.map +1 -0
- package/dist/core/nodes/EventListenerNode.js +39 -0
- package/dist/core/nodes/ExportNode.d.ts +26 -0
- package/dist/core/nodes/ExportNode.d.ts.map +1 -0
- package/dist/core/nodes/ExportNode.js +40 -0
- package/dist/core/nodes/ExternalStdioNode.d.ts +17 -0
- package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -0
- package/dist/core/nodes/ExternalStdioNode.js +26 -0
- package/dist/core/nodes/FunctionNode.d.ts +27 -0
- package/dist/core/nodes/FunctionNode.d.ts.map +1 -0
- package/dist/core/nodes/FunctionNode.js +53 -0
- package/dist/core/nodes/GuaranteeNode.d.ts +76 -0
- package/dist/core/nodes/GuaranteeNode.d.ts.map +1 -0
- package/dist/core/nodes/GuaranteeNode.js +117 -0
- package/dist/core/nodes/HttpRequestNode.d.ts +24 -0
- package/dist/core/nodes/HttpRequestNode.d.ts.map +1 -0
- package/dist/core/nodes/HttpRequestNode.js +38 -0
- package/dist/core/nodes/ImportNode.d.ts +27 -0
- package/dist/core/nodes/ImportNode.d.ts.map +1 -0
- package/dist/core/nodes/ImportNode.js +43 -0
- package/dist/core/nodes/LiteralNode.d.ts +26 -0
- package/dist/core/nodes/LiteralNode.d.ts.map +1 -0
- package/dist/core/nodes/LiteralNode.js +40 -0
- package/dist/core/nodes/MethodCallNode.d.ts +29 -0
- package/dist/core/nodes/MethodCallNode.d.ts.map +1 -0
- package/dist/core/nodes/MethodCallNode.js +47 -0
- package/dist/core/nodes/MethodNode.d.ts +29 -0
- package/dist/core/nodes/MethodNode.d.ts.map +1 -0
- package/dist/core/nodes/MethodNode.js +44 -0
- package/dist/core/nodes/ModuleNode.d.ts +29 -0
- package/dist/core/nodes/ModuleNode.d.ts.map +1 -0
- package/dist/core/nodes/ModuleNode.js +49 -0
- package/dist/core/nodes/NodeKind.d.ts +91 -0
- package/dist/core/nodes/NodeKind.d.ts.map +1 -0
- package/dist/core/nodes/NodeKind.js +146 -0
- package/dist/core/nodes/ParameterNode.d.ts +26 -0
- package/dist/core/nodes/ParameterNode.d.ts.map +1 -0
- package/dist/core/nodes/ParameterNode.js +43 -0
- package/dist/core/nodes/ScopeNode.d.ts +32 -0
- package/dist/core/nodes/ScopeNode.d.ts.map +1 -0
- package/dist/core/nodes/ScopeNode.js +47 -0
- package/dist/core/nodes/ServiceNode.d.ts +44 -0
- package/dist/core/nodes/ServiceNode.d.ts.map +1 -0
- package/dist/core/nodes/ServiceNode.js +49 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts +22 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -0
- package/dist/core/nodes/VariableDeclarationNode.js +38 -0
- package/dist/core/nodes/index.d.ts +25 -0
- package/dist/core/nodes/index.d.ts.map +1 -0
- package/dist/core/nodes/index.js +30 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/plugins/Plugin.d.ts +44 -0
- package/dist/plugins/Plugin.d.ts.map +1 -0
- package/dist/plugins/Plugin.js +46 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts +23 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.js +260 -0
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts +19 -0
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ExpressAnalyzer.js +306 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts +17 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +308 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts +38 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/FetchAnalyzer.js +344 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +65 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +472 -0
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +84 -0
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/JSASTAnalyzer.js +1378 -0
- package/dist/plugins/analysis/ReactAnalyzer.d.ts +90 -0
- package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ReactAnalyzer.js +1153 -0
- package/dist/plugins/analysis/RustAnalyzer.d.ts +13 -0
- package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/RustAnalyzer.js +259 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts +21 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.js +317 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts +35 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js +303 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts +33 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.js +283 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts +27 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.js +211 -0
- package/dist/plugins/analysis/ast/ConditionParser.d.ts +85 -0
- package/dist/plugins/analysis/ast/ConditionParser.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/ConditionParser.js +277 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts +15 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.js +91 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +77 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/GraphBuilder.js +1077 -0
- package/dist/plugins/analysis/ast/OxcAdapter.d.ts +41 -0
- package/dist/plugins/analysis/ast/OxcAdapter.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/OxcAdapter.js +40 -0
- package/dist/plugins/analysis/ast/types.d.ts +346 -0
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/types.js +4 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +93 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +24 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +77 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +377 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +27 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +232 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +25 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +172 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts +29 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +180 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +14 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +200 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +45 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +150 -0
- package/dist/plugins/analysis/ast/visitors/index.d.ts +17 -0
- package/dist/plugins/analysis/ast/visitors/index.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/index.js +13 -0
- package/dist/plugins/discovery/DiscoveryPlugin.d.ts +34 -0
- package/dist/plugins/discovery/DiscoveryPlugin.d.ts.map +1 -0
- package/dist/plugins/discovery/DiscoveryPlugin.js +26 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts +26 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js +79 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts +14 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.js +65 -0
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +19 -0
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/ZonServiceDiscovery.js +204 -0
- package/dist/plugins/enrichment/AliasTracker.d.ts +40 -0
- package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -0
- package/dist/plugins/enrichment/AliasTracker.js +290 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts +30 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +135 -0
- package/dist/plugins/enrichment/ImportExportLinker.d.ts +30 -0
- package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -0
- package/dist/plugins/enrichment/ImportExportLinker.js +176 -0
- package/dist/plugins/enrichment/InstanceOfResolver.d.ts +21 -0
- package/dist/plugins/enrichment/InstanceOfResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/InstanceOfResolver.js +117 -0
- package/dist/plugins/enrichment/MethodCallResolver.d.ts +41 -0
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/MethodCallResolver.js +252 -0
- package/dist/plugins/enrichment/MountPointResolver.d.ts +26 -0
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/MountPointResolver.js +189 -0
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts +89 -0
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -0
- package/dist/plugins/enrichment/PrefixEvaluator.js +415 -0
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts +25 -0
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/RustFFIEnricher.js +170 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +114 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +464 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts +27 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.js +238 -0
- package/dist/plugins/indexing/JSModuleIndexer.d.ts +33 -0
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -0
- package/dist/plugins/indexing/JSModuleIndexer.js +299 -0
- package/dist/plugins/indexing/RustModuleIndexer.d.ts +28 -0
- package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -0
- package/dist/plugins/indexing/RustModuleIndexer.js +140 -0
- package/dist/plugins/indexing/ServiceDetector.d.ts +46 -0
- package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -0
- package/dist/plugins/indexing/ServiceDetector.js +164 -0
- package/dist/plugins/validation/CallResolverValidator.d.ts +23 -0
- package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -0
- package/dist/plugins/validation/CallResolverValidator.js +108 -0
- package/dist/plugins/validation/DataFlowValidator.d.ts +24 -0
- package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -0
- package/dist/plugins/validation/DataFlowValidator.js +148 -0
- package/dist/plugins/validation/EvalBanValidator.d.ts +25 -0
- package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -0
- package/dist/plugins/validation/EvalBanValidator.js +123 -0
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts +11 -0
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -0
- package/dist/plugins/validation/GraphConnectivityValidator.js +135 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts +43 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -0
- package/dist/plugins/validation/SQLInjectionValidator.js +251 -0
- package/dist/plugins/validation/ShadowingDetector.d.ts +26 -0
- package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -0
- package/dist/plugins/validation/ShadowingDetector.js +119 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts +21 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +151 -0
- package/dist/plugins/vcs/GitPlugin.d.ts +84 -0
- package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -0
- package/dist/plugins/vcs/GitPlugin.js +295 -0
- package/dist/plugins/vcs/VCSPlugin.d.ts +133 -0
- package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -0
- package/dist/plugins/vcs/VCSPlugin.js +82 -0
- package/dist/plugins/vcs/index.d.ts +10 -0
- package/dist/plugins/vcs/index.d.ts.map +1 -0
- package/dist/plugins/vcs/index.js +18 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts +258 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -0
- package/dist/storage/backends/RFDBServerBackend.js +565 -0
- package/dist/storage/backends/typeValidation.d.ts +47 -0
- package/dist/storage/backends/typeValidation.d.ts.map +1 -0
- package/dist/storage/backends/typeValidation.js +137 -0
- package/dist/validation/PathValidator.d.ts +81 -0
- package/dist/validation/PathValidator.d.ts.map +1 -0
- package/dist/validation/PathValidator.js +251 -0
- package/package.json +57 -0
- package/src/.rfguard/current-session.txt +1 -0
- package/src/Orchestrator.ts +673 -0
- package/src/api/GraphAPI.ts +305 -0
- package/src/api/GuaranteeAPI.ts +401 -0
- package/src/core/ASTWorker.ts +567 -0
- package/src/core/ASTWorkerPool.ts +299 -0
- package/src/core/AnalysisQueue.ts +447 -0
- package/src/core/AnalysisWorker.ts +410 -0
- package/src/core/GraphBackend.ts +265 -0
- package/src/core/GuaranteeManager.ts +581 -0
- package/src/core/ManifestStore.ts +196 -0
- package/src/core/NodeFactory.ts +274 -0
- package/src/core/NodeId.ts +257 -0
- package/src/core/ParallelAnalyzer.ts +476 -0
- package/src/core/PriorityQueue.ts +227 -0
- package/src/core/Profiler.ts +188 -0
- package/src/core/QueueWorker.ts +780 -0
- package/src/core/Task.ts +107 -0
- package/src/core/TaskTypes.ts +40 -0
- package/src/core/VersionManager.ts +404 -0
- package/src/core/WorkerPool.ts +180 -0
- package/src/core/nodes/CallSiteNode.ts +72 -0
- package/src/core/nodes/ClassNode.ts +69 -0
- package/src/core/nodes/ConstantNode.ts +63 -0
- package/src/core/nodes/DatabaseQueryNode.ts +60 -0
- package/src/core/nodes/EntrypointNode.ts +164 -0
- package/src/core/nodes/EventListenerNode.ts +64 -0
- package/src/core/nodes/ExportNode.ts +71 -0
- package/src/core/nodes/ExternalStdioNode.ts +36 -0
- package/src/core/nodes/FunctionNode.ts +78 -0
- package/src/core/nodes/GuaranteeNode.ts +162 -0
- package/src/core/nodes/HttpRequestNode.ts +63 -0
- package/src/core/nodes/ImportNode.ts +75 -0
- package/src/core/nodes/LiteralNode.ts +67 -0
- package/src/core/nodes/MethodCallNode.ts +79 -0
- package/src/core/nodes/MethodNode.ts +78 -0
- package/src/core/nodes/ModuleNode.ts +74 -0
- package/src/core/nodes/NodeKind.ts +171 -0
- package/src/core/nodes/ParameterNode.ts +73 -0
- package/src/core/nodes/ScopeNode.ts +80 -0
- package/src/core/nodes/ServiceNode.ts +86 -0
- package/src/core/nodes/VariableDeclarationNode.ts +60 -0
- package/src/core/nodes/index.ts +49 -0
- package/src/index.ts +93 -0
- package/src/plugins/Plugin.ts +74 -0
- package/src/plugins/analysis/DatabaseAnalyzer.ts +322 -0
- package/src/plugins/analysis/ExpressAnalyzer.ts +401 -0
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +414 -0
- package/src/plugins/analysis/FetchAnalyzer.ts +441 -0
- package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +686 -0
- package/src/plugins/analysis/JSASTAnalyzer.ts +1680 -0
- package/src/plugins/analysis/ReactAnalyzer.ts +1368 -0
- package/src/plugins/analysis/RustAnalyzer.ts +438 -0
- package/src/plugins/analysis/SQLiteAnalyzer.ts +388 -0
- package/src/plugins/analysis/ServiceLayerAnalyzer.ts +429 -0
- package/src/plugins/analysis/SocketIOAnalyzer.ts +395 -0
- package/src/plugins/analysis/SystemDbAnalyzer.ts +284 -0
- package/src/plugins/analysis/ast/ConditionParser.ts +333 -0
- package/src/plugins/analysis/ast/ExpressionEvaluator.ts +117 -0
- package/src/plugins/analysis/ast/GraphBuilder.ts +1371 -0
- package/src/plugins/analysis/ast/OxcAdapter.ts +63 -0
- package/src/plugins/analysis/ast/types.ts +400 -0
- package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +137 -0
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +528 -0
- package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +339 -0
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +273 -0
- package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +259 -0
- package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +235 -0
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +268 -0
- package/src/plugins/analysis/ast/visitors/index.ts +36 -0
- package/src/plugins/discovery/DiscoveryPlugin.ts +50 -0
- package/src/plugins/discovery/MonorepoServiceDiscovery.ts +117 -0
- package/src/plugins/discovery/SimpleProjectDiscovery.ts +102 -0
- package/src/plugins/enrichment/AliasTracker.ts +399 -0
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +192 -0
- package/src/plugins/enrichment/ImportExportLinker.ts +221 -0
- package/src/plugins/enrichment/InstanceOfResolver.ts +165 -0
- package/src/plugins/enrichment/MethodCallResolver.ts +333 -0
- package/src/plugins/enrichment/MountPointResolver.ts +264 -0
- package/src/plugins/enrichment/PrefixEvaluator.ts +527 -0
- package/src/plugins/enrichment/RustFFIEnricher.ts +218 -0
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +682 -0
- package/src/plugins/indexing/IncrementalModuleIndexer.ts +287 -0
- package/src/plugins/indexing/JSModuleIndexer.ts +374 -0
- package/src/plugins/indexing/RustModuleIndexer.ts +160 -0
- package/src/plugins/indexing/ServiceDetector.ts +230 -0
- package/src/plugins/validation/CallResolverValidator.ts +170 -0
- package/src/plugins/validation/DataFlowValidator.ts +233 -0
- package/src/plugins/validation/EvalBanValidator.ts +175 -0
- package/src/plugins/validation/GraphConnectivityValidator.ts +201 -0
- package/src/plugins/validation/SQLInjectionValidator.ts +363 -0
- package/src/plugins/validation/ShadowingDetector.ts +173 -0
- package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +203 -0
- package/src/plugins/vcs/GitPlugin.ts +344 -0
- package/src/plugins/vcs/VCSPlugin.ts +190 -0
- package/src/plugins/vcs/index.ts +32 -0
- package/src/storage/backends/RFDBServerBackend.ts +687 -0
- package/src/storage/backends/typeValidation.ts +151 -0
- package/src/validation/PathValidator.ts +342 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ManifestStore - simple persistent processing state storage
|
|
3
|
+
*
|
|
4
|
+
* Format: StableID|Phase|Status|Timestamp
|
|
5
|
+
* Operations: grep for search, sed for update
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, appendFileSync } from 'fs';
|
|
8
|
+
import { execSync } from 'child_process';
|
|
9
|
+
export class ManifestStore {
|
|
10
|
+
filePath;
|
|
11
|
+
constructor(filePath) {
|
|
12
|
+
this.filePath = filePath;
|
|
13
|
+
// Create file if doesn't exist
|
|
14
|
+
if (!existsSync(filePath)) {
|
|
15
|
+
writeFileSync(filePath, '# StableID|Phase|Status|Timestamp\n', 'utf-8');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if file is processed in phase
|
|
20
|
+
* @param key - Full key like "PHASE|Plugin|Hash" or stableId
|
|
21
|
+
* @param phase - For backward compat, ignored if key contains |
|
|
22
|
+
*/
|
|
23
|
+
isDone(key, phase) {
|
|
24
|
+
try {
|
|
25
|
+
// If key already contains pipe, use as-is, else build pattern
|
|
26
|
+
const searchKey = key.includes('|') ? key : `${key}|${phase}`;
|
|
27
|
+
const pattern = `^${searchKey}\\|done`;
|
|
28
|
+
execSync(`grep -q "${pattern}" "${this.filePath}"`, { encoding: 'utf-8' });
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Mark file as processed in phase
|
|
37
|
+
* @param key - Full key like "PHASE|Plugin|Hash" or stableId
|
|
38
|
+
* @param phase - For backward compat, ignored if key contains |
|
|
39
|
+
*/
|
|
40
|
+
markDone(key, phase) {
|
|
41
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
42
|
+
const fullKey = key.includes('|') ? key : `${key}|${phase}`;
|
|
43
|
+
const line = `${fullKey}|done|${timestamp}\n`;
|
|
44
|
+
// Atomic append
|
|
45
|
+
appendFileSync(this.filePath, line, 'utf-8');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Mark file as in progress
|
|
49
|
+
* @param key - Full key like "PHASE|Plugin|Hash" or stableId
|
|
50
|
+
* @param phase - For backward compat, ignored if key contains |
|
|
51
|
+
*/
|
|
52
|
+
markInProgress(key, phase) {
|
|
53
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
54
|
+
const fullKey = key.includes('|') ? key : `${key}|${phase}`;
|
|
55
|
+
const line = `${fullKey}|in_progress|${timestamp}\n`;
|
|
56
|
+
appendFileSync(this.filePath, line, 'utf-8');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get status of file in phase
|
|
60
|
+
* @param key - Full key like "PHASE|Plugin|Hash" or stableId
|
|
61
|
+
* @param phase - For backward compat, ignored if key contains |
|
|
62
|
+
*/
|
|
63
|
+
getStatus(key, phase) {
|
|
64
|
+
try {
|
|
65
|
+
const searchKey = key.includes('|') ? key : `${key}|${phase}`;
|
|
66
|
+
const pattern = `^${searchKey}\\|`;
|
|
67
|
+
const result = execSync(`grep "${pattern}" "${this.filePath}" | tail -1`, { encoding: 'utf-8' }).trim();
|
|
68
|
+
if (!result)
|
|
69
|
+
return 'pending';
|
|
70
|
+
const parts = result.split('|');
|
|
71
|
+
// Status is after the key parts
|
|
72
|
+
const statusIndex = key.includes('|') ? key.split('|').length : 2;
|
|
73
|
+
return parts[statusIndex];
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return 'pending';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get all files for phase with specific status
|
|
81
|
+
*/
|
|
82
|
+
getByStatus(phase, status) {
|
|
83
|
+
try {
|
|
84
|
+
const pattern = `\\|${phase}\\|${status}\\|`;
|
|
85
|
+
const result = execSync(`grep "${pattern}" "${this.filePath}" | cut -d'|' -f1`, { encoding: 'utf-8' }).trim();
|
|
86
|
+
return result ? result.split('\n') : [];
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get statistics by phases
|
|
94
|
+
*/
|
|
95
|
+
getStats() {
|
|
96
|
+
const content = readFileSync(this.filePath, 'utf-8');
|
|
97
|
+
const lines = content.split('\n').filter(l => l && !l.startsWith('#'));
|
|
98
|
+
const stats = {};
|
|
99
|
+
for (const line of lines) {
|
|
100
|
+
const parts = line.split('|');
|
|
101
|
+
const phase = parts[1];
|
|
102
|
+
const status = parts[2];
|
|
103
|
+
if (!phase || !status)
|
|
104
|
+
continue;
|
|
105
|
+
if (!stats[phase]) {
|
|
106
|
+
stats[phase] = { done: 0, in_progress: 0, pending: 0 };
|
|
107
|
+
}
|
|
108
|
+
if (status in stats[phase]) {
|
|
109
|
+
stats[phase][status]++;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return stats;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Clean up stale in_progress (crashed processes)
|
|
116
|
+
* @param olderThanSeconds - older than N seconds considered dead
|
|
117
|
+
*/
|
|
118
|
+
cleanupStaleProgress(olderThanSeconds = 300) {
|
|
119
|
+
const now = Math.floor(Date.now() / 1000);
|
|
120
|
+
const content = readFileSync(this.filePath, 'utf-8');
|
|
121
|
+
const lines = content.split('\n');
|
|
122
|
+
const cleaned = lines.map(line => {
|
|
123
|
+
if (!line || line.startsWith('#'))
|
|
124
|
+
return line;
|
|
125
|
+
const parts = line.split('|');
|
|
126
|
+
const status = parts[2];
|
|
127
|
+
const timestamp = parts[3];
|
|
128
|
+
if (status === 'in_progress' && timestamp) {
|
|
129
|
+
const age = now - parseInt(timestamp);
|
|
130
|
+
if (age > olderThanSeconds) {
|
|
131
|
+
// Mark as crashed (process died)
|
|
132
|
+
parts[2] = 'crashed';
|
|
133
|
+
return parts.join('|');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return line;
|
|
137
|
+
});
|
|
138
|
+
writeFileSync(this.filePath, cleaned.join('\n'), 'utf-8');
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Clear entire manifest (for testing)
|
|
142
|
+
*/
|
|
143
|
+
clear() {
|
|
144
|
+
writeFileSync(this.filePath, '# StableID|Phase|Status|Timestamp\n', 'utf-8');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeFactory - centralized graph node creation
|
|
3
|
+
*
|
|
4
|
+
* Single point for creating all node types with:
|
|
5
|
+
* - Required field validation
|
|
6
|
+
* - Standard field set for each type
|
|
7
|
+
* - Automatic ID generation
|
|
8
|
+
*
|
|
9
|
+
* Delegates creation to node contracts from ./nodes/
|
|
10
|
+
*/
|
|
11
|
+
import { type EntrypointType, type EntrypointTrigger } from './nodes/index.js';
|
|
12
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
13
|
+
interface ServiceOptions {
|
|
14
|
+
version?: string;
|
|
15
|
+
entrypoint?: string;
|
|
16
|
+
discoveryMethod?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
dependencies?: string[];
|
|
19
|
+
serviceType?: string;
|
|
20
|
+
testFiles?: string[];
|
|
21
|
+
metadata?: {
|
|
22
|
+
type?: string;
|
|
23
|
+
testFiles?: string[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface EntrypointOptions {
|
|
27
|
+
id?: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
trigger?: EntrypointTrigger;
|
|
30
|
+
source?: string;
|
|
31
|
+
serviceId?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ModuleOptions {
|
|
34
|
+
contentHash?: string;
|
|
35
|
+
isTest?: boolean;
|
|
36
|
+
}
|
|
37
|
+
interface FunctionOptions {
|
|
38
|
+
async?: boolean;
|
|
39
|
+
generator?: boolean;
|
|
40
|
+
exported?: boolean;
|
|
41
|
+
arrowFunction?: boolean;
|
|
42
|
+
parentScopeId?: string;
|
|
43
|
+
isClassMethod?: boolean;
|
|
44
|
+
className?: string;
|
|
45
|
+
params?: string[];
|
|
46
|
+
counter?: number;
|
|
47
|
+
}
|
|
48
|
+
interface ScopeOptions {
|
|
49
|
+
name?: string;
|
|
50
|
+
conditional?: boolean;
|
|
51
|
+
parentScopeId?: string;
|
|
52
|
+
parentFunctionId?: string;
|
|
53
|
+
capturesFrom?: string[];
|
|
54
|
+
counter?: number;
|
|
55
|
+
}
|
|
56
|
+
interface CallSiteOptions {
|
|
57
|
+
parentScopeId?: string;
|
|
58
|
+
counter?: number;
|
|
59
|
+
}
|
|
60
|
+
interface MethodCallOptions {
|
|
61
|
+
parentScopeId?: string;
|
|
62
|
+
args?: unknown[];
|
|
63
|
+
counter?: number;
|
|
64
|
+
}
|
|
65
|
+
interface VariableOptions {
|
|
66
|
+
parentScopeId?: string;
|
|
67
|
+
counter?: number;
|
|
68
|
+
}
|
|
69
|
+
interface ConstantOptions {
|
|
70
|
+
value?: unknown;
|
|
71
|
+
parentScopeId?: string;
|
|
72
|
+
counter?: number;
|
|
73
|
+
}
|
|
74
|
+
interface LiteralOptions {
|
|
75
|
+
parentCallId?: string;
|
|
76
|
+
argIndex?: number;
|
|
77
|
+
counter?: number;
|
|
78
|
+
}
|
|
79
|
+
interface EventListenerOptions {
|
|
80
|
+
column?: number;
|
|
81
|
+
parentScopeId?: string;
|
|
82
|
+
callbackArg?: string;
|
|
83
|
+
counter?: number;
|
|
84
|
+
}
|
|
85
|
+
interface HttpRequestOptions {
|
|
86
|
+
column?: number;
|
|
87
|
+
parentScopeId?: string;
|
|
88
|
+
counter?: number;
|
|
89
|
+
}
|
|
90
|
+
interface DatabaseQueryOptions {
|
|
91
|
+
parentScopeId?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare class NodeFactory {
|
|
94
|
+
/**
|
|
95
|
+
* Create SERVICE node
|
|
96
|
+
*/
|
|
97
|
+
static createService(name: string, projectPath: string, options?: ServiceOptions): import("./nodes/ServiceNode.js").ServiceNodeRecord;
|
|
98
|
+
/**
|
|
99
|
+
* Create ENTRYPOINT node
|
|
100
|
+
*/
|
|
101
|
+
static createEntrypoint(file: string, entrypointType: EntrypointType, options?: EntrypointOptions): import("./nodes/EntrypointNode.js").EntrypointNodeRecord;
|
|
102
|
+
/**
|
|
103
|
+
* Create MODULE node
|
|
104
|
+
*/
|
|
105
|
+
static createModule(filePath: string, projectPath: string, options?: ModuleOptions): import("./nodes/ModuleNode.js").ModuleNodeRecord;
|
|
106
|
+
/**
|
|
107
|
+
* Create FUNCTION node
|
|
108
|
+
*/
|
|
109
|
+
static createFunction(name: string, file: string, line: number, column: number, options?: FunctionOptions): import("@grafema/types").FunctionNodeRecord;
|
|
110
|
+
/**
|
|
111
|
+
* Create SCOPE node
|
|
112
|
+
*/
|
|
113
|
+
static createScope(scopeType: string, file: string, line: number, options?: ScopeOptions): import("./nodes/ScopeNode.js").ScopeNodeRecord;
|
|
114
|
+
/**
|
|
115
|
+
* Create CALL_SITE node
|
|
116
|
+
*/
|
|
117
|
+
static createCallSite(targetName: string, file: string, line: number, column: number, options?: CallSiteOptions): import("./nodes/CallSiteNode.js").CallSiteNodeRecord;
|
|
118
|
+
/**
|
|
119
|
+
* Create METHOD_CALL node
|
|
120
|
+
*/
|
|
121
|
+
static createMethodCall(objectName: string | undefined, methodName: string, file: string, line: number, column: number, options?: MethodCallOptions): import("./nodes/MethodCallNode.js").MethodCallNodeRecord;
|
|
122
|
+
/**
|
|
123
|
+
* Create VARIABLE_DECLARATION node
|
|
124
|
+
*/
|
|
125
|
+
static createVariableDeclaration(name: string, file: string, line: number, column: number, options?: VariableOptions): import("./nodes/VariableDeclarationNode.js").VariableDeclarationNodeRecord;
|
|
126
|
+
/**
|
|
127
|
+
* Create CONSTANT node
|
|
128
|
+
*/
|
|
129
|
+
static createConstant(name: string, file: string, line: number, column: number, options?: ConstantOptions): import("./nodes/ConstantNode.js").ConstantNodeRecord;
|
|
130
|
+
/**
|
|
131
|
+
* Create LITERAL node
|
|
132
|
+
*/
|
|
133
|
+
static createLiteral(value: unknown, file: string, line: number, column: number, options?: LiteralOptions): import("./nodes/LiteralNode.js").LiteralNodeRecord;
|
|
134
|
+
/**
|
|
135
|
+
* Create EXTERNAL_STDIO node (singleton)
|
|
136
|
+
*/
|
|
137
|
+
static createExternalStdio(): import("./nodes/ExternalStdioNode.js").ExternalStdioNodeRecord;
|
|
138
|
+
/**
|
|
139
|
+
* Create EVENT_LISTENER node
|
|
140
|
+
*/
|
|
141
|
+
static createEventListener(eventName: string, objectName: string | undefined, file: string, line: number, options?: EventListenerOptions): import("./nodes/EventListenerNode.js").EventListenerNodeRecord;
|
|
142
|
+
/**
|
|
143
|
+
* Create HTTP_REQUEST node
|
|
144
|
+
*/
|
|
145
|
+
static createHttpRequest(url: string | undefined, method: string | undefined, file: string, line: number, options?: HttpRequestOptions): import("./nodes/HttpRequestNode.js").HttpRequestNodeRecord;
|
|
146
|
+
/**
|
|
147
|
+
* Create DATABASE_QUERY node
|
|
148
|
+
*/
|
|
149
|
+
static createDatabaseQuery(query: string | undefined, operation: string | undefined, file: string, line: number, options?: DatabaseQueryOptions): import("./nodes/DatabaseQueryNode.js").DatabaseQueryNodeRecord;
|
|
150
|
+
/**
|
|
151
|
+
* Validate node by its type
|
|
152
|
+
*/
|
|
153
|
+
static validate(node: BaseNodeRecord): string[];
|
|
154
|
+
/**
|
|
155
|
+
* Helper: hash file path for stable ID
|
|
156
|
+
*/
|
|
157
|
+
static _hashFile(filePath: string): string;
|
|
158
|
+
}
|
|
159
|
+
export {};
|
|
160
|
+
//# sourceMappingURL=NodeFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeFactory.d.ts","sourceRoot":"","sources":["../../src/core/NodeFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAeL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAC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AAM,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB;IAI7G;;OAEG;IACH,MAAM,CAAC,mBAAmB;IAI1B;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;IAI5I;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB;IAI1I;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB;IAInJ;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,EAAE;IA0B/C;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAG3C"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeFactory - centralized graph node creation
|
|
3
|
+
*
|
|
4
|
+
* Single point for creating all node types with:
|
|
5
|
+
* - Required field validation
|
|
6
|
+
* - Standard field set for each type
|
|
7
|
+
* - Automatic ID generation
|
|
8
|
+
*
|
|
9
|
+
* Delegates creation to node contracts from ./nodes/
|
|
10
|
+
*/
|
|
11
|
+
import { createHash } from 'crypto';
|
|
12
|
+
import { basename, relative } from 'path';
|
|
13
|
+
import { ServiceNode, EntrypointNode, ModuleNode, FunctionNode, ScopeNode, CallSiteNode, MethodCallNode, VariableDeclarationNode, ConstantNode, LiteralNode, ExternalStdioNode, EventListenerNode, HttpRequestNode, DatabaseQueryNode, } from './nodes/index.js';
|
|
14
|
+
export class NodeFactory {
|
|
15
|
+
/**
|
|
16
|
+
* Create SERVICE node
|
|
17
|
+
*/
|
|
18
|
+
static createService(name, projectPath, options = {}) {
|
|
19
|
+
return ServiceNode.create(name, projectPath, options);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create ENTRYPOINT node
|
|
23
|
+
*/
|
|
24
|
+
static createEntrypoint(file, entrypointType, options = {}) {
|
|
25
|
+
return EntrypointNode.create(file, entrypointType, options);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Create MODULE node
|
|
29
|
+
*/
|
|
30
|
+
static createModule(filePath, projectPath, options = {}) {
|
|
31
|
+
if (!filePath)
|
|
32
|
+
throw new Error('NodeFactory.createModule: filePath is required');
|
|
33
|
+
if (!projectPath)
|
|
34
|
+
throw new Error('NodeFactory.createModule: projectPath is required');
|
|
35
|
+
const contentHash = options.contentHash || this._hashFile(filePath);
|
|
36
|
+
const relativePath = relative(projectPath, filePath) || basename(filePath);
|
|
37
|
+
return ModuleNode.create(filePath, relativePath, contentHash, options);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Create FUNCTION node
|
|
41
|
+
*/
|
|
42
|
+
static createFunction(name, file, line, column, options = {}) {
|
|
43
|
+
return FunctionNode.create(name, file, line, column, options);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create SCOPE node
|
|
47
|
+
*/
|
|
48
|
+
static createScope(scopeType, file, line, options = {}) {
|
|
49
|
+
return ScopeNode.create(scopeType, file, line, options);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create CALL_SITE node
|
|
53
|
+
*/
|
|
54
|
+
static createCallSite(targetName, file, line, column, options = {}) {
|
|
55
|
+
return CallSiteNode.create(targetName, file, line, column, options);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create METHOD_CALL node
|
|
59
|
+
*/
|
|
60
|
+
static createMethodCall(objectName, methodName, file, line, column, options = {}) {
|
|
61
|
+
return MethodCallNode.create(objectName, methodName, file, line, column, options);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create VARIABLE_DECLARATION node
|
|
65
|
+
*/
|
|
66
|
+
static createVariableDeclaration(name, file, line, column, options = {}) {
|
|
67
|
+
return VariableDeclarationNode.create(name, file, line, column, options);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create CONSTANT node
|
|
71
|
+
*/
|
|
72
|
+
static createConstant(name, file, line, column, options = {}) {
|
|
73
|
+
return ConstantNode.create(name, file, line, column, options);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create LITERAL node
|
|
77
|
+
*/
|
|
78
|
+
static createLiteral(value, file, line, column, options = {}) {
|
|
79
|
+
return LiteralNode.create(value, file, line, column, options);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create EXTERNAL_STDIO node (singleton)
|
|
83
|
+
*/
|
|
84
|
+
static createExternalStdio() {
|
|
85
|
+
return ExternalStdioNode.create();
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Create EVENT_LISTENER node
|
|
89
|
+
*/
|
|
90
|
+
static createEventListener(eventName, objectName, file, line, options = {}) {
|
|
91
|
+
return EventListenerNode.create(eventName, objectName, file, line, options);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create HTTP_REQUEST node
|
|
95
|
+
*/
|
|
96
|
+
static createHttpRequest(url, method, file, line, options = {}) {
|
|
97
|
+
return HttpRequestNode.create(url, method, file, line, options);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create DATABASE_QUERY node
|
|
101
|
+
*/
|
|
102
|
+
static createDatabaseQuery(query, operation, file, line, options = {}) {
|
|
103
|
+
return DatabaseQueryNode.create(query, operation, file, line, options);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Validate node by its type
|
|
107
|
+
*/
|
|
108
|
+
static validate(node) {
|
|
109
|
+
const validators = {
|
|
110
|
+
'SERVICE': ServiceNode,
|
|
111
|
+
'ENTRYPOINT': EntrypointNode,
|
|
112
|
+
'MODULE': ModuleNode,
|
|
113
|
+
'FUNCTION': FunctionNode,
|
|
114
|
+
'SCOPE': ScopeNode,
|
|
115
|
+
'CALL_SITE': CallSiteNode,
|
|
116
|
+
'METHOD_CALL': MethodCallNode,
|
|
117
|
+
'VARIABLE_DECLARATION': VariableDeclarationNode,
|
|
118
|
+
'CONSTANT': ConstantNode,
|
|
119
|
+
'LITERAL': LiteralNode,
|
|
120
|
+
'EXTERNAL_STDIO': ExternalStdioNode,
|
|
121
|
+
'EVENT_LISTENER': EventListenerNode,
|
|
122
|
+
'HTTP_REQUEST': HttpRequestNode,
|
|
123
|
+
'DATABASE_QUERY': DatabaseQueryNode
|
|
124
|
+
};
|
|
125
|
+
const validator = validators[node.type];
|
|
126
|
+
if (!validator) {
|
|
127
|
+
return [`Unknown node type: ${node.type}`];
|
|
128
|
+
}
|
|
129
|
+
return validator.validate(node);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Helper: hash file path for stable ID
|
|
133
|
+
*/
|
|
134
|
+
static _hashFile(filePath) {
|
|
135
|
+
return createHash('md5').update(filePath).digest('hex').substring(0, 12);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic Node ID generation scheme for the graph
|
|
3
|
+
*
|
|
4
|
+
* Format: TYPE|SCOPE|FILE|IDENTIFIER|LINE:COL
|
|
5
|
+
*
|
|
6
|
+
* Components:
|
|
7
|
+
* - TYPE: node type (MODULE, FUNCTION, CLASS, METHOD, VARIABLE, etc.)
|
|
8
|
+
* - SCOPE: context/scope (path to parent or project)
|
|
9
|
+
* - FILE: relative file path from project root
|
|
10
|
+
* - IDENTIFIER: entity name (for MODULE can be empty)
|
|
11
|
+
* - LINE:COL: position in file (for uniqueness of anonymous functions)
|
|
12
|
+
*
|
|
13
|
+
* Examples:
|
|
14
|
+
* MODULE|/project|src/index.js||0:0
|
|
15
|
+
* FUNCTION|/project|src/index.js|handleRequest|42:5
|
|
16
|
+
* CLASS|/project|src/User.js|User|10:0
|
|
17
|
+
* METHOD|User|src/User.js|login|25:2
|
|
18
|
+
* VARIABLE|handleRequest|src/index.js|userId|45:10
|
|
19
|
+
* EXTERNAL_MODULE|/project||express|0:0
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Parameters for computing Node ID
|
|
23
|
+
*/
|
|
24
|
+
export interface NodeIdParams {
|
|
25
|
+
type: string;
|
|
26
|
+
scope?: string;
|
|
27
|
+
file?: string;
|
|
28
|
+
identifier?: string;
|
|
29
|
+
line?: number;
|
|
30
|
+
column?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Parsed Node ID components
|
|
34
|
+
*/
|
|
35
|
+
export interface ParsedNodeId {
|
|
36
|
+
type: string;
|
|
37
|
+
scope: string;
|
|
38
|
+
file: string;
|
|
39
|
+
identifier: string;
|
|
40
|
+
line: number;
|
|
41
|
+
column: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Compute deterministic Node ID
|
|
45
|
+
*/
|
|
46
|
+
export declare function computeNodeId({ type, scope, file, identifier, line, column }: NodeIdParams): string;
|
|
47
|
+
/**
|
|
48
|
+
* Compute u128 numeric ID from string (for Rust backend)
|
|
49
|
+
* Uses SHA-256 hash and takes first 16 bytes
|
|
50
|
+
*/
|
|
51
|
+
export declare function computeNumericId(stringId: string): bigint;
|
|
52
|
+
/**
|
|
53
|
+
* Parse Node ID back into components
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseNodeId(nodeId: string): ParsedNodeId;
|
|
56
|
+
/**
|
|
57
|
+
* Helper for creating MODULE ID
|
|
58
|
+
*/
|
|
59
|
+
export declare function createModuleId(filePath: string, projectPath?: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Helper for creating FUNCTION ID
|
|
62
|
+
*/
|
|
63
|
+
export declare function createFunctionId(filePath: string, functionName: string, line: number, column: number, scope?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Helper for creating CLASS ID
|
|
66
|
+
*/
|
|
67
|
+
export declare function createClassId(filePath: string, className: string, line: number, column: number, scope?: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Helper for creating METHOD ID
|
|
70
|
+
*/
|
|
71
|
+
export declare function createMethodId(filePath: string, className: string, methodName: string, line: number, column: number): string;
|
|
72
|
+
/**
|
|
73
|
+
* Helper for creating VARIABLE ID
|
|
74
|
+
*/
|
|
75
|
+
export declare function createVariableId(filePath: string, varName: string, line: number, column: number, scope: string): string;
|
|
76
|
+
/**
|
|
77
|
+
* Helper for creating EXTERNAL_MODULE ID
|
|
78
|
+
*/
|
|
79
|
+
export declare function createExternalModuleId(moduleName: string, projectPath?: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Helper for creating IMPORT ID
|
|
82
|
+
*/
|
|
83
|
+
export declare function createImportId(filePath: string, source: string, localName: string, line: number, scope?: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Helper for creating EXPORT ID
|
|
86
|
+
*/
|
|
87
|
+
export declare function createExportId(filePath: string, exportName: string, line: number, scope?: string): string;
|
|
88
|
+
//# sourceMappingURL=NodeId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeId.d.ts","sourceRoot":"","sources":["../../src/core/NodeId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,E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