@grafema/core 0.2.4-beta → 0.2.5-beta
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/dist/Orchestrator.d.ts +37 -0
- package/dist/Orchestrator.d.ts.map +1 -1
- package/dist/Orchestrator.js +322 -35
- package/dist/Orchestrator.js.map +1 -0
- package/dist/api/GraphAPI.d.ts +1 -1
- package/dist/api/GraphAPI.d.ts.map +1 -1
- package/dist/api/GraphAPI.js +3 -1
- package/dist/api/GraphAPI.js.map +1 -0
- package/dist/api/GuaranteeAPI.d.ts.map +1 -1
- package/dist/api/GuaranteeAPI.js +4 -2
- package/dist/api/GuaranteeAPI.js.map +1 -0
- package/dist/config/ConfigLoader.d.ts +66 -0
- package/dist/config/ConfigLoader.d.ts.map +1 -1
- package/dist/config/ConfigLoader.js +77 -3
- package/dist/config/ConfigLoader.js.map +1 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -1
- package/dist/config/index.js.map +1 -0
- package/dist/core/ASTWorker.d.ts.map +1 -1
- package/dist/core/ASTWorker.js +6 -4
- package/dist/core/ASTWorker.js.map +1 -0
- package/dist/core/ASTWorkerPool.js +2 -1
- package/dist/core/ASTWorkerPool.js.map +1 -0
- package/dist/core/AnalysisQueue.js +1 -0
- package/dist/core/AnalysisQueue.js.map +1 -0
- package/dist/core/CoverageAnalyzer.d.ts.map +1 -1
- package/dist/core/CoverageAnalyzer.js +1 -0
- package/dist/core/CoverageAnalyzer.js.map +1 -0
- package/dist/core/FileExplainer.js +1 -0
- package/dist/core/FileExplainer.js.map +1 -0
- package/dist/core/FileNodeManager.d.ts.map +1 -1
- package/dist/core/FileNodeManager.js +4 -2
- package/dist/core/FileNodeManager.js.map +1 -0
- package/dist/core/GraphBackend.js +1 -0
- package/dist/core/GraphBackend.js.map +1 -0
- package/dist/core/GraphFreshnessChecker.js +1 -0
- package/dist/core/GraphFreshnessChecker.js.map +1 -0
- package/dist/core/GuaranteeManager.js +2 -1
- package/dist/core/GuaranteeManager.js.map +1 -0
- package/dist/core/HashUtils.js +1 -0
- package/dist/core/HashUtils.js.map +1 -0
- package/dist/core/IncrementalReanalyzer.d.ts.map +1 -1
- package/dist/core/IncrementalReanalyzer.js +7 -3
- package/dist/core/IncrementalReanalyzer.js.map +1 -0
- package/dist/core/ManifestStore.js +1 -0
- package/dist/core/ManifestStore.js.map +1 -0
- package/dist/core/NodeFactory.d.ts +54 -34
- package/dist/core/NodeFactory.d.ts.map +1 -1
- package/dist/core/NodeFactory.js +20 -1
- package/dist/core/NodeFactory.js.map +1 -0
- package/dist/core/NodeId.js +1 -0
- package/dist/core/NodeId.js.map +1 -0
- package/dist/core/PriorityQueue.js +1 -0
- package/dist/core/PriorityQueue.js.map +1 -0
- package/dist/core/Profiler.js +1 -0
- package/dist/core/Profiler.js.map +1 -0
- package/dist/core/ScopeTracker.js +1 -0
- package/dist/core/ScopeTracker.js.map +1 -0
- package/dist/core/SemanticId.js +1 -0
- package/dist/core/SemanticId.js.map +1 -0
- package/dist/core/Task.js +1 -0
- package/dist/core/Task.js.map +1 -0
- package/dist/core/TaskTypes.js +1 -0
- package/dist/core/TaskTypes.js.map +1 -0
- package/dist/core/VersionManager.js +1 -0
- package/dist/core/VersionManager.js.map +1 -0
- package/dist/core/WorkerPool.d.ts.map +1 -1
- package/dist/core/WorkerPool.js +3 -1
- package/dist/core/WorkerPool.js.map +1 -0
- package/dist/core/nodes/ArgumentExpressionNode.js +1 -0
- package/dist/core/nodes/ArgumentExpressionNode.js.map +1 -0
- package/dist/core/nodes/ArrayLiteralNode.js +1 -0
- package/dist/core/nodes/ArrayLiteralNode.js.map +1 -0
- package/dist/core/nodes/BranchNode.js +1 -0
- package/dist/core/nodes/BranchNode.js.map +1 -0
- package/dist/core/nodes/CallSiteNode.js +1 -0
- package/dist/core/nodes/CallSiteNode.js.map +1 -0
- package/dist/core/nodes/CaseNode.js +1 -0
- package/dist/core/nodes/CaseNode.js.map +1 -0
- package/dist/core/nodes/ClassNode.js +1 -0
- package/dist/core/nodes/ClassNode.js.map +1 -0
- package/dist/core/nodes/ConstantNode.js +1 -0
- package/dist/core/nodes/ConstantNode.js.map +1 -0
- package/dist/core/nodes/ConstructorCallNode.js +1 -0
- package/dist/core/nodes/ConstructorCallNode.js.map +1 -0
- package/dist/core/nodes/DatabaseQueryNode.js +1 -0
- package/dist/core/nodes/DatabaseQueryNode.js.map +1 -0
- package/dist/core/nodes/DecoratorNode.js +1 -0
- package/dist/core/nodes/DecoratorNode.js.map +1 -0
- package/dist/core/nodes/EntrypointNode.js +1 -0
- package/dist/core/nodes/EntrypointNode.js.map +1 -0
- package/dist/core/nodes/EnumNode.js +1 -0
- package/dist/core/nodes/EnumNode.js.map +1 -0
- package/dist/core/nodes/EventListenerNode.js +1 -0
- package/dist/core/nodes/EventListenerNode.js.map +1 -0
- package/dist/core/nodes/ExportNode.js +1 -0
- package/dist/core/nodes/ExportNode.js.map +1 -0
- package/dist/core/nodes/ExpressionNode.js +1 -0
- package/dist/core/nodes/ExpressionNode.js.map +1 -0
- package/dist/core/nodes/ExternalModuleNode.js +1 -0
- package/dist/core/nodes/ExternalModuleNode.js.map +1 -0
- package/dist/core/nodes/ExternalStdioNode.js +1 -0
- package/dist/core/nodes/ExternalStdioNode.js.map +1 -0
- package/dist/core/nodes/FunctionNode.js +1 -0
- package/dist/core/nodes/FunctionNode.js.map +1 -0
- package/dist/core/nodes/GuaranteeNode.js +1 -0
- package/dist/core/nodes/GuaranteeNode.js.map +1 -0
- package/dist/core/nodes/HttpRequestNode.js +1 -0
- package/dist/core/nodes/HttpRequestNode.js.map +1 -0
- package/dist/core/nodes/ImportNode.js +1 -0
- package/dist/core/nodes/ImportNode.js.map +1 -0
- package/dist/core/nodes/InterfaceNode.js +1 -0
- package/dist/core/nodes/InterfaceNode.js.map +1 -0
- package/dist/core/nodes/IssueNode.js +1 -0
- package/dist/core/nodes/IssueNode.js.map +1 -0
- package/dist/core/nodes/LiteralNode.js +1 -0
- package/dist/core/nodes/LiteralNode.js.map +1 -0
- package/dist/core/nodes/MethodCallNode.js +1 -0
- package/dist/core/nodes/MethodCallNode.js.map +1 -0
- package/dist/core/nodes/MethodNode.js +1 -0
- package/dist/core/nodes/MethodNode.js.map +1 -0
- package/dist/core/nodes/ModuleNode.js +1 -0
- package/dist/core/nodes/ModuleNode.js.map +1 -0
- package/dist/core/nodes/NetworkRequestNode.js +1 -0
- package/dist/core/nodes/NetworkRequestNode.js.map +1 -0
- package/dist/core/nodes/NodeKind.d.ts +5 -0
- package/dist/core/nodes/NodeKind.d.ts.map +1 -1
- package/dist/core/nodes/NodeKind.js +11 -0
- package/dist/core/nodes/NodeKind.js.map +1 -0
- package/dist/core/nodes/ObjectLiteralNode.js +1 -0
- package/dist/core/nodes/ObjectLiteralNode.js.map +1 -0
- package/dist/core/nodes/ParameterNode.js +1 -0
- package/dist/core/nodes/ParameterNode.js.map +1 -0
- package/dist/core/nodes/PluginNode.d.ts +69 -0
- package/dist/core/nodes/PluginNode.d.ts.map +1 -0
- package/dist/core/nodes/PluginNode.js +106 -0
- package/dist/core/nodes/PluginNode.js.map +1 -0
- package/dist/core/nodes/ScopeNode.js +1 -0
- package/dist/core/nodes/ScopeNode.js.map +1 -0
- package/dist/core/nodes/ServiceNode.js +1 -0
- package/dist/core/nodes/ServiceNode.js.map +1 -0
- package/dist/core/nodes/TypeNode.js +2 -1
- package/dist/core/nodes/TypeNode.js.map +1 -0
- package/dist/core/nodes/VariableDeclarationNode.js +1 -0
- package/dist/core/nodes/VariableDeclarationNode.js.map +1 -0
- package/dist/core/nodes/index.d.ts +2 -1
- package/dist/core/nodes/index.d.ts.map +1 -1
- package/dist/core/nodes/index.js +4 -1
- package/dist/core/nodes/index.js.map +1 -0
- package/dist/core/toposort.d.ts +38 -0
- package/dist/core/toposort.d.ts.map +1 -0
- package/dist/core/toposort.js +129 -0
- package/dist/core/toposort.js.map +1 -0
- package/dist/data/builtins/BuiltinRegistry.js +1 -0
- package/dist/data/builtins/BuiltinRegistry.js.map +1 -0
- package/dist/data/builtins/definitions.js +1 -0
- package/dist/data/builtins/definitions.js.map +1 -0
- package/dist/data/builtins/index.js +1 -0
- package/dist/data/builtins/index.js.map +1 -0
- package/dist/data/builtins/jsGlobals.js +1 -0
- package/dist/data/builtins/jsGlobals.js.map +1 -0
- package/dist/data/builtins/types.js +1 -0
- package/dist/data/builtins/types.js.map +1 -0
- package/dist/data/globals/definitions.js +1 -0
- package/dist/data/globals/definitions.js.map +1 -0
- package/dist/data/globals/index.js +1 -0
- package/dist/data/globals/index.js.map +1 -0
- package/dist/diagnostics/DiagnosticCollector.d.ts +5 -0
- package/dist/diagnostics/DiagnosticCollector.d.ts.map +1 -1
- package/dist/diagnostics/DiagnosticCollector.js +4 -0
- package/dist/diagnostics/DiagnosticCollector.js.map +1 -0
- package/dist/diagnostics/DiagnosticReporter.d.ts +23 -1
- package/dist/diagnostics/DiagnosticReporter.d.ts.map +1 -1
- package/dist/diagnostics/DiagnosticReporter.js +68 -15
- package/dist/diagnostics/DiagnosticReporter.js.map +1 -0
- package/dist/diagnostics/DiagnosticWriter.js +1 -0
- package/dist/diagnostics/DiagnosticWriter.js.map +1 -0
- package/dist/diagnostics/categories.d.ts +57 -0
- package/dist/diagnostics/categories.d.ts.map +1 -0
- package/dist/diagnostics/categories.js +71 -0
- package/dist/diagnostics/categories.js.map +1 -0
- package/dist/diagnostics/index.d.ts +3 -0
- package/dist/diagnostics/index.d.ts.map +1 -1
- package/dist/diagnostics/index.js +4 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/errors/GrafemaError.d.ts +39 -0
- package/dist/errors/GrafemaError.d.ts.map +1 -1
- package/dist/errors/GrafemaError.js +28 -0
- package/dist/errors/GrafemaError.js.map +1 -0
- package/dist/index.d.ts +21 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -0
- package/dist/instructions/index.d.ts +8 -0
- package/dist/instructions/index.d.ts.map +1 -0
- package/dist/instructions/index.js +20 -0
- package/dist/instructions/index.js.map +1 -0
- package/dist/instructions/onboarding.md +121 -0
- package/dist/logging/Logger.d.ts +53 -3
- package/dist/logging/Logger.d.ts.map +1 -1
- package/dist/logging/Logger.js +144 -4
- package/dist/logging/Logger.js.map +1 -0
- package/dist/plugins/Plugin.js +1 -0
- package/dist/plugins/Plugin.js.map +1 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/DatabaseAnalyzer.js +20 -14
- package/dist/plugins/analysis/DatabaseAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressAnalyzer.js +23 -16
- package/dist/plugins/analysis/ExpressAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ExpressResponseAnalyzer.d.ts +2 -1
- package/dist/plugins/analysis/ExpressResponseAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressResponseAnalyzer.js +53 -76
- package/dist/plugins/analysis/ExpressResponseAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +47 -37
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts +8 -14
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/FetchAnalyzer.js +144 -97
- package/dist/plugins/analysis/FetchAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -1
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +3 -5
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js.map +1 -0
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +59 -2
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/JSASTAnalyzer.js +926 -422
- package/dist/plugins/analysis/JSASTAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ReactAnalyzer.js +24 -19
- package/dist/plugins/analysis/ReactAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/RustAnalyzer.js +39 -26
- package/dist/plugins/analysis/RustAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SQLiteAnalyzer.js +14 -7
- package/dist/plugins/analysis/SQLiteAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js +33 -28
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SocketIOAnalyzer.js +24 -14
- package/dist/plugins/analysis/SocketIOAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -1
- package/dist/plugins/analysis/SystemDbAnalyzer.js +19 -11
- package/dist/plugins/analysis/SystemDbAnalyzer.js.map +1 -0
- package/dist/plugins/analysis/ast/ConditionParser.js +1 -0
- package/dist/plugins/analysis/ast/ConditionParser.js.map +1 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/ExpressionEvaluator.js +1 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.js.map +1 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +58 -6
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/GraphBuilder.js +440 -56
- package/dist/plugins/analysis/ast/GraphBuilder.js.map +1 -0
- package/dist/plugins/analysis/ast/IdGenerator.js +1 -0
- package/dist/plugins/analysis/ast/IdGenerator.js.map +1 -0
- package/dist/plugins/analysis/ast/OxcAdapter.js +1 -0
- package/dist/plugins/analysis/ast/OxcAdapter.js.map +1 -0
- package/dist/plugins/analysis/ast/types.d.ts +152 -1
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/types.js +1 -0
- package/dist/plugins/analysis/ast/types.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/babelTraverse.d.ts +27 -0
- package/dist/plugins/analysis/ast/utils/babelTraverse.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/utils/babelTraverse.js +45 -0
- package/dist/plugins/analysis/ast/utils/babelTraverse.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts +1 -1
- package/dist/plugins/analysis/ast/utils/createParameterNodes.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/utils/createParameterNodes.js +1 -0
- package/dist/plugins/analysis/ast/utils/createParameterNodes.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/index.js +1 -0
- package/dist/plugins/analysis/ast/utils/index.js.map +1 -0
- package/dist/plugins/analysis/ast/utils/location.js +1 -0
- package/dist/plugins/analysis/ast/utils/location.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +3 -1
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +1 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +9 -2
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +145 -14
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +1 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +198 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +4 -3
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +5 -2
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +1 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.d.ts +83 -0
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.js +258 -0
- package/dist/plugins/analysis/ast/visitors/PropertyAccessVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +1 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +1 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +1 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js.map +1 -0
- package/dist/plugins/analysis/ast/visitors/index.d.ts +1 -0
- package/dist/plugins/analysis/ast/visitors/index.d.ts.map +1 -1
- package/dist/plugins/analysis/ast/visitors/index.js +2 -0
- package/dist/plugins/analysis/ast/visitors/index.js.map +1 -0
- package/dist/plugins/discovery/DiscoveryPlugin.d.ts +42 -10
- package/dist/plugins/discovery/DiscoveryPlugin.d.ts.map +1 -1
- package/dist/plugins/discovery/DiscoveryPlugin.js +17 -1
- package/dist/plugins/discovery/DiscoveryPlugin.js.map +1 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js +3 -2
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js.map +1 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/SimpleProjectDiscovery.js +3 -2
- package/dist/plugins/discovery/SimpleProjectDiscovery.js.map +1 -0
- package/dist/plugins/discovery/WorkspaceDiscovery.d.ts.map +1 -1
- package/dist/plugins/discovery/WorkspaceDiscovery.js +3 -2
- package/dist/plugins/discovery/WorkspaceDiscovery.js.map +1 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.js +1 -0
- package/dist/plugins/discovery/resolveSourceEntrypoint.js.map +1 -0
- package/dist/plugins/discovery/workspaces/detector.js +1 -0
- package/dist/plugins/discovery/workspaces/detector.js.map +1 -0
- package/dist/plugins/discovery/workspaces/globResolver.js +1 -0
- package/dist/plugins/discovery/workspaces/globResolver.js.map +1 -0
- package/dist/plugins/discovery/workspaces/index.js +1 -0
- package/dist/plugins/discovery/workspaces/index.js.map +1 -0
- package/dist/plugins/discovery/workspaces/parsers.js +1 -0
- package/dist/plugins/discovery/workspaces/parsers.js.map +1 -0
- package/dist/plugins/enrichment/AliasTracker.js +3 -2
- package/dist/plugins/enrichment/AliasTracker.js.map +1 -0
- package/dist/plugins/enrichment/ArgumentParameterLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ArgumentParameterLinker.js +1 -1
- package/dist/plugins/enrichment/ArgumentParameterLinker.js.map +1 -0
- package/dist/plugins/enrichment/ClosureCaptureEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/ClosureCaptureEnricher.js +1 -1
- package/dist/plugins/enrichment/ClosureCaptureEnricher.js.map +1 -0
- package/dist/plugins/enrichment/ExpressHandlerLinker.d.ts +21 -0
- package/dist/plugins/enrichment/ExpressHandlerLinker.d.ts.map +1 -0
- package/dist/plugins/enrichment/ExpressHandlerLinker.js +137 -0
- package/dist/plugins/enrichment/ExpressHandlerLinker.js.map +1 -0
- package/dist/plugins/enrichment/ExternalCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/ExternalCallResolver.js +1 -1
- package/dist/plugins/enrichment/ExternalCallResolver.js.map +1 -0
- package/dist/plugins/enrichment/FunctionCallResolver.d.ts +5 -0
- package/dist/plugins/enrichment/FunctionCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/FunctionCallResolver.js +11 -9
- package/dist/plugins/enrichment/FunctionCallResolver.js.map +1 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts +2 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +51 -13
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js.map +1 -0
- package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -1
- package/dist/plugins/enrichment/ImportExportLinker.js +1 -1
- package/dist/plugins/enrichment/ImportExportLinker.js.map +1 -0
- package/dist/plugins/enrichment/InstanceOfResolver.js +3 -2
- package/dist/plugins/enrichment/InstanceOfResolver.js.map +1 -0
- package/dist/plugins/enrichment/MethodCallResolver.d.ts +39 -1
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MethodCallResolver.js +422 -11
- package/dist/plugins/enrichment/MethodCallResolver.js.map +1 -0
- package/dist/plugins/enrichment/MountPointResolver.d.ts +1 -1
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/MountPointResolver.js +7 -23
- package/dist/plugins/enrichment/MountPointResolver.js.map +1 -0
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.d.ts.map +1 -1
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.js +2 -2
- package/dist/plugins/enrichment/NodejsBuiltinsResolver.js.map +1 -0
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -1
- package/dist/plugins/enrichment/PrefixEvaluator.js +5 -4
- package/dist/plugins/enrichment/PrefixEvaluator.js.map +1 -0
- package/dist/plugins/enrichment/RejectionPropagationEnricher.d.ts +30 -0
- package/dist/plugins/enrichment/RejectionPropagationEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/RejectionPropagationEnricher.js +190 -0
- package/dist/plugins/enrichment/RejectionPropagationEnricher.js.map +1 -0
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -1
- package/dist/plugins/enrichment/RustFFIEnricher.js +1 -1
- package/dist/plugins/enrichment/RustFFIEnricher.js.map +1 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +1 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -1
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +4 -3
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js.map +1 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts +3 -1
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/IncrementalModuleIndexer.js +22 -29
- package/dist/plugins/indexing/IncrementalModuleIndexer.js.map +1 -0
- package/dist/plugins/indexing/JSModuleIndexer.d.ts +3 -1
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/JSModuleIndexer.js +22 -31
- package/dist/plugins/indexing/JSModuleIndexer.js.map +1 -0
- package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -1
- package/dist/plugins/indexing/RustModuleIndexer.js +11 -5
- package/dist/plugins/indexing/RustModuleIndexer.js.map +1 -0
- package/dist/plugins/validation/BrokenImportValidator.d.ts.map +1 -1
- package/dist/plugins/validation/BrokenImportValidator.js +3 -3
- package/dist/plugins/validation/BrokenImportValidator.js.map +1 -0
- package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -1
- package/dist/plugins/validation/CallResolverValidator.js +3 -3
- package/dist/plugins/validation/CallResolverValidator.js.map +1 -0
- package/dist/plugins/validation/DataFlowValidator.js +2 -1
- package/dist/plugins/validation/DataFlowValidator.js.map +1 -0
- package/dist/plugins/validation/EvalBanValidator.js +2 -1
- package/dist/plugins/validation/EvalBanValidator.js.map +1 -0
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -1
- package/dist/plugins/validation/GraphConnectivityValidator.js +2 -1
- package/dist/plugins/validation/GraphConnectivityValidator.js.map +1 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -1
- package/dist/plugins/validation/SQLInjectionValidator.js +4 -2
- package/dist/plugins/validation/SQLInjectionValidator.js.map +1 -0
- package/dist/plugins/validation/ShadowingDetector.js +2 -1
- package/dist/plugins/validation/ShadowingDetector.js.map +1 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -1
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +3 -3
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.js.map +1 -0
- package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -1
- package/dist/plugins/vcs/GitPlugin.js +13 -6
- package/dist/plugins/vcs/GitPlugin.js.map +1 -0
- package/dist/plugins/vcs/VCSPlugin.js +1 -0
- package/dist/plugins/vcs/VCSPlugin.js.map +1 -0
- package/dist/plugins/vcs/index.js +1 -0
- package/dist/plugins/vcs/index.js.map +1 -0
- package/dist/queries/findCallsInFunction.d.ts +1 -1
- package/dist/queries/findCallsInFunction.d.ts.map +1 -1
- package/dist/queries/findCallsInFunction.js +3 -2
- package/dist/queries/findCallsInFunction.js.map +1 -0
- package/dist/queries/findContainingFunction.d.ts +1 -1
- package/dist/queries/findContainingFunction.d.ts.map +1 -1
- package/dist/queries/findContainingFunction.js +1 -0
- package/dist/queries/findContainingFunction.js.map +1 -0
- package/dist/queries/index.js +1 -0
- package/dist/queries/index.js.map +1 -0
- package/dist/queries/traceValues.d.ts.map +1 -1
- package/dist/queries/traceValues.js +1 -0
- package/dist/queries/traceValues.js.map +1 -0
- package/dist/queries/types.js +1 -0
- package/dist/queries/types.js.map +1 -0
- package/dist/schema/GraphSchemaExtractor.js +1 -0
- package/dist/schema/GraphSchemaExtractor.js.map +1 -0
- package/dist/schema/InterfaceSchemaExtractor.js +1 -0
- package/dist/schema/InterfaceSchemaExtractor.js.map +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts +25 -1
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
- package/dist/storage/backends/RFDBServerBackend.js +100 -22
- package/dist/storage/backends/RFDBServerBackend.js.map +1 -0
- package/dist/storage/backends/typeValidation.d.ts.map +1 -1
- package/dist/storage/backends/typeValidation.js +3 -0
- package/dist/storage/backends/typeValidation.js.map +1 -0
- package/dist/utils/findRfdbBinary.js +1 -0
- package/dist/utils/findRfdbBinary.js.map +1 -0
- package/dist/utils/moduleResolution.d.ts +134 -0
- package/dist/utils/moduleResolution.d.ts.map +1 -0
- package/dist/utils/moduleResolution.js +164 -0
- package/dist/utils/moduleResolution.js.map +1 -0
- package/dist/validation/PathValidator.d.ts.map +1 -1
- package/dist/validation/PathValidator.js +1 -0
- package/dist/validation/PathValidator.js.map +1 -0
- package/package.json +4 -3
- package/src/Orchestrator.ts +371 -41
- package/src/api/GraphAPI.ts +4 -2
- package/src/api/GuaranteeAPI.ts +3 -2
- package/src/config/ConfigLoader.ts +121 -3
- package/src/config/index.ts +7 -1
- package/src/core/ASTWorker.ts +8 -20
- package/src/core/ASTWorkerPool.ts +1 -1
- package/src/core/CoverageAnalyzer.ts +2 -2
- package/src/core/FileNodeManager.ts +3 -2
- package/src/core/GuaranteeManager.ts +1 -1
- package/src/core/IncrementalReanalyzer.ts +6 -3
- package/src/core/NodeFactory.ts +34 -1
- package/src/core/WorkerPool.ts +2 -1
- package/src/core/nodes/NodeKind.ts +11 -0
- package/src/core/nodes/PluginNode.ts +144 -0
- package/src/core/nodes/TypeNode.ts +1 -1
- package/src/core/nodes/index.ts +4 -0
- package/src/core/toposort.ts +160 -0
- package/src/diagnostics/DiagnosticCollector.ts +8 -1
- package/src/diagnostics/DiagnosticReporter.ts +87 -16
- package/src/diagnostics/categories.ts +104 -0
- package/src/diagnostics/index.ts +14 -0
- package/src/errors/GrafemaError.ts +58 -0
- package/src/index.ts +53 -9
- package/src/instructions/index.ts +21 -0
- package/src/instructions/onboarding.md +121 -0
- package/src/logging/Logger.ts +155 -4
- package/src/plugins/analysis/DatabaseAnalyzer.ts +22 -15
- package/src/plugins/analysis/ExpressAnalyzer.ts +30 -18
- package/src/plugins/analysis/ExpressResponseAnalyzer.ts +72 -88
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +54 -39
- package/src/plugins/analysis/FetchAnalyzer.ts +165 -113
- package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +6 -7
- package/src/plugins/analysis/JSASTAnalyzer.ts +1122 -487
- package/src/plugins/analysis/ReactAnalyzer.ts +27 -20
- package/src/plugins/analysis/RustAnalyzer.ts +41 -27
- package/src/plugins/analysis/SQLiteAnalyzer.ts +18 -8
- package/src/plugins/analysis/ServiceLayerAnalyzer.ts +38 -34
- package/src/plugins/analysis/SocketIOAnalyzer.ts +30 -15
- package/src/plugins/analysis/SystemDbAnalyzer.ts +24 -13
- package/src/plugins/analysis/ast/ExpressionEvaluator.ts +1 -3
- package/src/plugins/analysis/ast/GraphBuilder.ts +532 -66
- package/src/plugins/analysis/ast/types.ts +200 -2
- package/src/plugins/analysis/ast/utils/babelTraverse.ts +74 -0
- package/src/plugins/analysis/ast/utils/createParameterNodes.ts +1 -1
- package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +7 -2
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +163 -15
- package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +249 -3
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +9 -4
- package/src/plugins/analysis/ast/visitors/PropertyAccessVisitor.ts +342 -0
- package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +2 -3
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +1 -27
- package/src/plugins/analysis/ast/visitors/index.ts +2 -0
- package/src/plugins/discovery/DiscoveryPlugin.ts +42 -11
- package/src/plugins/discovery/MonorepoServiceDiscovery.ts +2 -2
- package/src/plugins/discovery/SimpleProjectDiscovery.ts +2 -2
- package/src/plugins/discovery/WorkspaceDiscovery.ts +2 -2
- package/src/plugins/discovery/workspaces/globResolver.ts +1 -1
- package/src/plugins/enrichment/AliasTracker.ts +2 -2
- package/src/plugins/enrichment/ArgumentParameterLinker.ts +0 -1
- package/src/plugins/enrichment/ClosureCaptureEnricher.ts +0 -1
- package/src/plugins/enrichment/ExpressHandlerLinker.ts +178 -0
- package/src/plugins/enrichment/ExternalCallResolver.ts +0 -1
- package/src/plugins/enrichment/FunctionCallResolver.ts +10 -15
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +65 -14
- package/src/plugins/enrichment/ImportExportLinker.ts +0 -1
- package/src/plugins/enrichment/InstanceOfResolver.ts +2 -2
- package/src/plugins/enrichment/MethodCallResolver.ts +526 -12
- package/src/plugins/enrichment/MountPointResolver.ts +6 -24
- package/src/plugins/enrichment/NodejsBuiltinsResolver.ts +1 -2
- package/src/plugins/enrichment/PrefixEvaluator.ts +4 -4
- package/src/plugins/enrichment/RejectionPropagationEnricher.ts +253 -0
- package/src/plugins/enrichment/RustFFIEnricher.ts +0 -1
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +3 -3
- package/src/plugins/indexing/IncrementalModuleIndexer.ts +24 -30
- package/src/plugins/indexing/JSModuleIndexer.ts +21 -22
- package/src/plugins/indexing/RustModuleIndexer.ts +10 -5
- package/src/plugins/validation/BrokenImportValidator.ts +2 -3
- package/src/plugins/validation/CallResolverValidator.ts +2 -3
- package/src/plugins/validation/DataFlowValidator.ts +1 -1
- package/src/plugins/validation/EvalBanValidator.ts +1 -1
- package/src/plugins/validation/GraphConnectivityValidator.ts +1 -9
- package/src/plugins/validation/SQLInjectionValidator.ts +3 -2
- package/src/plugins/validation/ShadowingDetector.ts +1 -1
- package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +2 -3
- package/src/plugins/vcs/GitPlugin.ts +12 -6
- package/src/queries/findCallsInFunction.ts +4 -4
- package/src/queries/findContainingFunction.ts +1 -1
- package/src/queries/traceValues.ts +0 -1
- package/src/storage/backends/RFDBServerBackend.ts +115 -25
- package/src/storage/backends/typeValidation.ts +2 -0
- package/src/utils/moduleResolution.ts +244 -0
- package/src/validation/PathValidator.ts +0 -8
- package/src/plugins/validation/NodeCreationValidator.ts +0 -554
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* OPTIMIZED: Uses batched writes to reduce FFI overhead
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import type { GraphBackend } from '@grafema/types';
|
|
6
|
+
import { basename } from 'path';
|
|
7
|
+
import type { GraphBackend, NodeRecord } from '@grafema/types';
|
|
8
8
|
import { ImportNode } from '../../../core/nodes/ImportNode.js';
|
|
9
9
|
import { InterfaceNode, type InterfaceNodeRecord } from '../../../core/nodes/InterfaceNode.js';
|
|
10
|
-
import { EnumNode
|
|
10
|
+
import { EnumNode } from '../../../core/nodes/EnumNode.js';
|
|
11
11
|
import { DecoratorNode } from '../../../core/nodes/DecoratorNode.js';
|
|
12
12
|
import { NetworkRequestNode } from '../../../core/nodes/NetworkRequestNode.js';
|
|
13
13
|
import { NodeFactory } from '../../../core/NodeFactory.js';
|
|
@@ -23,11 +23,10 @@ import type {
|
|
|
23
23
|
VariableDeclarationInfo,
|
|
24
24
|
CallSiteInfo,
|
|
25
25
|
MethodCallInfo,
|
|
26
|
+
MethodCallbackInfo,
|
|
26
27
|
EventListenerInfo,
|
|
27
28
|
ClassInstantiationInfo,
|
|
28
|
-
ConstructorCallInfo,
|
|
29
29
|
ClassDeclarationInfo,
|
|
30
|
-
MethodCallbackInfo,
|
|
31
30
|
CallArgumentInfo,
|
|
32
31
|
ImportInfo,
|
|
33
32
|
ExportInfo,
|
|
@@ -41,15 +40,19 @@ import type {
|
|
|
41
40
|
ArrayMutationInfo,
|
|
42
41
|
ObjectMutationInfo,
|
|
43
42
|
VariableReassignmentInfo,
|
|
43
|
+
UpdateExpressionInfo,
|
|
44
44
|
ReturnStatementInfo,
|
|
45
|
+
YieldExpressionInfo,
|
|
45
46
|
ObjectLiteralInfo,
|
|
46
47
|
ObjectPropertyInfo,
|
|
47
48
|
ArrayLiteralInfo,
|
|
48
49
|
TryBlockInfo,
|
|
49
50
|
CatchBlockInfo,
|
|
50
51
|
FinallyBlockInfo,
|
|
51
|
-
UpdateExpressionInfo,
|
|
52
52
|
PromiseResolutionInfo,
|
|
53
|
+
RejectionPatternInfo,
|
|
54
|
+
CatchesFromInfo,
|
|
55
|
+
PropertyAccessInfo,
|
|
53
56
|
ASTCollections,
|
|
54
57
|
GraphNode,
|
|
55
58
|
GraphEdge,
|
|
@@ -84,7 +87,7 @@ export class GraphBuilder {
|
|
|
84
87
|
private async _flushNodes(graph: GraphBackend): Promise<number> {
|
|
85
88
|
if (this._nodeBuffer.length > 0) {
|
|
86
89
|
// Cast to unknown first since GraphNode is more permissive than NodeRecord
|
|
87
|
-
await graph.addNodes(this._nodeBuffer as unknown as
|
|
90
|
+
await graph.addNodes(this._nodeBuffer as unknown as NodeRecord[]);
|
|
88
91
|
const count = this._nodeBuffer.length;
|
|
89
92
|
this._nodeBuffer = [];
|
|
90
93
|
return count;
|
|
@@ -148,16 +151,24 @@ export class GraphBuilder {
|
|
|
148
151
|
objectMutations = [],
|
|
149
152
|
// Variable reassignment tracking for FLOWS_INTO edges (REG-290)
|
|
150
153
|
variableReassignments = [],
|
|
154
|
+
// Update expression tracking for UPDATE_EXPRESSION nodes and MODIFIES edges (REG-288, REG-312)
|
|
155
|
+
updateExpressions = [],
|
|
151
156
|
// Return statement tracking for RETURNS edges
|
|
152
157
|
returnStatements = [],
|
|
153
|
-
//
|
|
154
|
-
|
|
158
|
+
// Yield expression tracking for YIELDS/DELEGATES_TO edges (REG-270)
|
|
159
|
+
yieldExpressions = [],
|
|
155
160
|
// Promise resolution tracking for RESOLVES_TO edges (REG-334)
|
|
156
161
|
promiseResolutions = [],
|
|
157
162
|
// Object/Array literal tracking
|
|
158
163
|
objectLiterals = [],
|
|
159
164
|
objectProperties = [],
|
|
160
|
-
arrayLiterals = []
|
|
165
|
+
arrayLiterals = [],
|
|
166
|
+
// REG-311: Rejection pattern tracking for async error analysis
|
|
167
|
+
rejectionPatterns = [],
|
|
168
|
+
// REG-311: CATCHES_FROM tracking for catch parameter error sources
|
|
169
|
+
catchesFromInfos = [],
|
|
170
|
+
// Property access tracking for PROPERTY_ACCESS nodes (REG-395)
|
|
171
|
+
propertyAccesses = []
|
|
161
172
|
} = data;
|
|
162
173
|
|
|
163
174
|
// Reset buffers for this build
|
|
@@ -166,26 +177,26 @@ export class GraphBuilder {
|
|
|
166
177
|
|
|
167
178
|
// 1. Buffer all functions (without edges)
|
|
168
179
|
for (const func of functions) {
|
|
169
|
-
const { parentScopeId, ...funcData } = func;
|
|
180
|
+
const { parentScopeId: _parentScopeId, ...funcData } = func;
|
|
170
181
|
this._bufferNode(funcData as GraphNode);
|
|
171
182
|
}
|
|
172
183
|
|
|
173
184
|
// 2. Buffer all SCOPE (without edges)
|
|
174
185
|
for (const scope of scopes) {
|
|
175
|
-
const { parentFunctionId, parentScopeId, capturesFrom
|
|
186
|
+
const { parentFunctionId: _parentFunctionId, parentScopeId: _parentScopeId, capturesFrom: _capturesFrom, ...scopeData } = scope;
|
|
176
187
|
this._bufferNode(scopeData as GraphNode);
|
|
177
188
|
}
|
|
178
189
|
|
|
179
190
|
// 2.5. Buffer BRANCH nodes
|
|
180
191
|
// Note: parentScopeId is kept on node for query support (REG-275 test requirement)
|
|
181
192
|
for (const branch of branches) {
|
|
182
|
-
const { discriminantExpressionId, discriminantExpressionType, discriminantLine, discriminantColumn, ...branchData } = branch;
|
|
193
|
+
const { discriminantExpressionId: _discriminantExpressionId, discriminantExpressionType: _discriminantExpressionType, discriminantLine: _discriminantLine, discriminantColumn: _discriminantColumn, ...branchData } = branch;
|
|
183
194
|
this._bufferNode(branchData as GraphNode);
|
|
184
195
|
}
|
|
185
196
|
|
|
186
197
|
// 2.6. Buffer CASE nodes
|
|
187
198
|
for (const caseInfo of cases) {
|
|
188
|
-
const { parentBranchId, ...caseData } = caseInfo;
|
|
199
|
+
const { parentBranchId: _parentBranchId, ...caseData } = caseInfo;
|
|
189
200
|
this._bufferNode(caseData as GraphNode);
|
|
190
201
|
}
|
|
191
202
|
|
|
@@ -193,8 +204,8 @@ export class GraphBuilder {
|
|
|
193
204
|
for (const loop of loops) {
|
|
194
205
|
// Exclude metadata used for edge creation (not stored on node)
|
|
195
206
|
const {
|
|
196
|
-
iteratesOverName, iteratesOverLine, iteratesOverColumn,
|
|
197
|
-
conditionExpressionId, conditionExpressionType, conditionLine, conditionColumn,
|
|
207
|
+
iteratesOverName: _iteratesOverName, iteratesOverLine: _iteratesOverLine, iteratesOverColumn: _iteratesOverColumn,
|
|
208
|
+
conditionExpressionId: _conditionExpressionId, conditionExpressionType: _conditionExpressionType, conditionLine: _conditionLine, conditionColumn: _conditionColumn,
|
|
198
209
|
...loopData
|
|
199
210
|
} = loop;
|
|
200
211
|
this._bufferNode(loopData as GraphNode);
|
|
@@ -207,13 +218,13 @@ export class GraphBuilder {
|
|
|
207
218
|
|
|
208
219
|
// 2.9. Buffer CATCH_BLOCK nodes (Phase 4)
|
|
209
220
|
for (const catchBlock of catchBlocks) {
|
|
210
|
-
const { parentTryBlockId, ...catchData } = catchBlock;
|
|
221
|
+
const { parentTryBlockId: _parentTryBlockId, ...catchData } = catchBlock;
|
|
211
222
|
this._bufferNode(catchData as GraphNode);
|
|
212
223
|
}
|
|
213
224
|
|
|
214
225
|
// 2.10. Buffer FINALLY_BLOCK nodes (Phase 4)
|
|
215
226
|
for (const finallyBlock of finallyBlocks) {
|
|
216
|
-
const { parentTryBlockId, ...finallyData } = finallyBlock;
|
|
227
|
+
const { parentTryBlockId: _parentTryBlockId2, ...finallyData } = finallyBlock;
|
|
217
228
|
this._bufferNode(finallyData as GraphNode);
|
|
218
229
|
}
|
|
219
230
|
|
|
@@ -224,7 +235,7 @@ export class GraphBuilder {
|
|
|
224
235
|
|
|
225
236
|
// 3.5. Buffer PARAMETER nodes and HAS_PARAMETER edges
|
|
226
237
|
for (const param of parameters) {
|
|
227
|
-
const { functionId, ...paramData } = param;
|
|
238
|
+
const { functionId: _functionId, ...paramData } = param;
|
|
228
239
|
// Keep parentFunctionId on the node for queries
|
|
229
240
|
this._bufferNode(paramData as GraphNode);
|
|
230
241
|
|
|
@@ -240,7 +251,7 @@ export class GraphBuilder {
|
|
|
240
251
|
|
|
241
252
|
// 4. Buffer CALL_SITE (keep parentScopeId on node for queries)
|
|
242
253
|
for (const callSite of callSites) {
|
|
243
|
-
const { targetFunctionName, ...callData } = callSite;
|
|
254
|
+
const { targetFunctionName: _targetFunctionName, ...callData } = callSite;
|
|
244
255
|
this._bufferNode(callData as GraphNode);
|
|
245
256
|
}
|
|
246
257
|
|
|
@@ -295,6 +306,9 @@ export class GraphBuilder {
|
|
|
295
306
|
// 9. Buffer METHOD_CALL nodes, CONTAINS edges, and USES edges (REG-262)
|
|
296
307
|
this.bufferMethodCalls(methodCalls, variableDeclarations, parameters);
|
|
297
308
|
|
|
309
|
+
// 9.5. Buffer PROPERTY_ACCESS nodes and CONTAINS edges (REG-395)
|
|
310
|
+
this.bufferPropertyAccessNodes(module, propertyAccesses);
|
|
311
|
+
|
|
298
312
|
// 10. Buffer net:stdio and WRITES_TO edges for console.log/error
|
|
299
313
|
this.bufferStdioNodes(methodCalls);
|
|
300
314
|
|
|
@@ -354,7 +368,8 @@ export class GraphBuilder {
|
|
|
354
368
|
this.bufferImplementsEdges(classDeclarations, interfaces);
|
|
355
369
|
|
|
356
370
|
// 26. Buffer FLOWS_INTO edges for array mutations (push, unshift, splice, indexed assignment)
|
|
357
|
-
|
|
371
|
+
// REG-392: Pass literals, objectLiterals, arrayLiterals, callSites for non-variable value lookups
|
|
372
|
+
this.bufferArrayMutationEdges(arrayMutations, variableDeclarations, parameters, literals, objectLiterals, arrayLiterals, callSites);
|
|
358
373
|
|
|
359
374
|
// 27. Buffer FLOWS_INTO edges for object mutations (property assignment, Object.assign)
|
|
360
375
|
// REG-152: Now includes classDeclarations for this.prop = value patterns
|
|
@@ -372,6 +387,15 @@ export class GraphBuilder {
|
|
|
372
387
|
// 31. Buffer RESOLVES_TO edges for Promise data flow (REG-334)
|
|
373
388
|
this.bufferPromiseResolutionEdges(promiseResolutions);
|
|
374
389
|
|
|
390
|
+
// 32. Buffer YIELDS/DELEGATES_TO edges for generator yields (REG-270)
|
|
391
|
+
this.bufferYieldEdges(yieldExpressions, callSites, methodCalls, variableDeclarations, parameters);
|
|
392
|
+
|
|
393
|
+
// 33. Buffer REJECTS edges for async error tracking (REG-311)
|
|
394
|
+
this.bufferRejectionEdges(functions, rejectionPatterns);
|
|
395
|
+
|
|
396
|
+
// 34. Buffer CATCHES_FROM edges linking catch blocks to error sources (REG-311)
|
|
397
|
+
this.bufferCatchesFromEdges(catchesFromInfos);
|
|
398
|
+
|
|
375
399
|
// FLUSH: Write all nodes first, then edges in single batch calls
|
|
376
400
|
const nodesCreated = await this._flushNodes(graph);
|
|
377
401
|
const edgesCreated = await this._flushEdges(graph);
|
|
@@ -408,7 +432,7 @@ export class GraphBuilder {
|
|
|
408
432
|
|
|
409
433
|
private bufferScopeEdges(scopes: ScopeInfo[], variableDeclarations: VariableDeclarationInfo[]): void {
|
|
410
434
|
for (const scope of scopes) {
|
|
411
|
-
const { parentFunctionId, parentScopeId, capturesFrom,
|
|
435
|
+
const { parentFunctionId, parentScopeId, capturesFrom, ...scopeData } = scope;
|
|
412
436
|
|
|
413
437
|
// FUNCTION -> HAS_SCOPE -> SCOPE (для function_body)
|
|
414
438
|
if (parentFunctionId) {
|
|
@@ -440,16 +464,7 @@ export class GraphBuilder {
|
|
|
440
464
|
}
|
|
441
465
|
}
|
|
442
466
|
|
|
443
|
-
// MODIFIES -
|
|
444
|
-
if (modifies && modifies.length > 0) {
|
|
445
|
-
for (const mod of modifies) {
|
|
446
|
-
this._bufferEdge({
|
|
447
|
-
type: 'MODIFIES',
|
|
448
|
-
src: scopeData.id,
|
|
449
|
-
dst: mod.variableId
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
}
|
|
467
|
+
// REG-288: MODIFIES edges removed - now come from UPDATE_EXPRESSION nodes
|
|
453
468
|
}
|
|
454
469
|
}
|
|
455
470
|
|
|
@@ -851,7 +866,7 @@ export class GraphBuilder {
|
|
|
851
866
|
* REG-275: For CallExpression discriminants, we don't create nodes here since
|
|
852
867
|
* bufferBranchEdges links to the existing CALL_SITE node by coordinates.
|
|
853
868
|
*/
|
|
854
|
-
private bufferDiscriminantExpressions(branches: BranchInfo[],
|
|
869
|
+
private bufferDiscriminantExpressions(branches: BranchInfo[], _callSites: CallSiteInfo[]): void {
|
|
855
870
|
for (const branch of branches) {
|
|
856
871
|
if (branch.discriminantExpressionId && branch.discriminantExpressionType) {
|
|
857
872
|
// Skip CallExpression - we link to existing CALL_SITE in bufferBranchEdges
|
|
@@ -877,7 +892,12 @@ export class GraphBuilder {
|
|
|
877
892
|
|
|
878
893
|
private bufferVariableEdges(variableDeclarations: VariableDeclarationInfo[]): void {
|
|
879
894
|
for (const varDecl of variableDeclarations) {
|
|
880
|
-
const { parentScopeId, ...varData } = varDecl;
|
|
895
|
+
const { parentScopeId, isClassProperty, ...varData } = varDecl;
|
|
896
|
+
|
|
897
|
+
// REG-271: Skip class properties - they get HAS_PROPERTY edges from CLASS, not DECLARES from SCOPE
|
|
898
|
+
if (isClassProperty) {
|
|
899
|
+
continue;
|
|
900
|
+
}
|
|
881
901
|
|
|
882
902
|
// SCOPE -> DECLARES -> VARIABLE
|
|
883
903
|
this._bufferEdge({
|
|
@@ -964,6 +984,38 @@ export class GraphBuilder {
|
|
|
964
984
|
}
|
|
965
985
|
}
|
|
966
986
|
|
|
987
|
+
/**
|
|
988
|
+
* Buffer PROPERTY_ACCESS nodes and CONTAINS edges (REG-395).
|
|
989
|
+
*
|
|
990
|
+
* Creates nodes for property reads (obj.prop, a.b.c) and
|
|
991
|
+
* CONTAINS edges from the enclosing scope (function or module).
|
|
992
|
+
*/
|
|
993
|
+
private bufferPropertyAccessNodes(module: ModuleNode, propertyAccesses: PropertyAccessInfo[]): void {
|
|
994
|
+
for (const propAccess of propertyAccesses) {
|
|
995
|
+
// Buffer node with all relevant fields
|
|
996
|
+
this._bufferNode({
|
|
997
|
+
id: propAccess.id,
|
|
998
|
+
type: 'PROPERTY_ACCESS',
|
|
999
|
+
name: propAccess.propertyName,
|
|
1000
|
+
objectName: propAccess.objectName,
|
|
1001
|
+
file: propAccess.file,
|
|
1002
|
+
line: propAccess.line,
|
|
1003
|
+
column: propAccess.column,
|
|
1004
|
+
semanticId: propAccess.semanticId,
|
|
1005
|
+
optional: propAccess.optional,
|
|
1006
|
+
computed: propAccess.computed
|
|
1007
|
+
} as GraphNode);
|
|
1008
|
+
|
|
1009
|
+
// SCOPE/FUNCTION/MODULE -> CONTAINS -> PROPERTY_ACCESS
|
|
1010
|
+
const containsSrc = propAccess.parentScopeId ?? module.id;
|
|
1011
|
+
this._bufferEdge({
|
|
1012
|
+
type: 'CONTAINS',
|
|
1013
|
+
src: containsSrc,
|
|
1014
|
+
dst: propAccess.id
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
967
1019
|
private bufferStdioNodes(methodCalls: MethodCallInfo[]): void {
|
|
968
1020
|
const consoleIOMethods = methodCalls.filter(mc =>
|
|
969
1021
|
(mc.object === 'console' && (mc.method === 'log' || mc.method === 'error'))
|
|
@@ -991,7 +1043,7 @@ export class GraphBuilder {
|
|
|
991
1043
|
|
|
992
1044
|
private bufferClassDeclarationNodes(classDeclarations: ClassDeclarationInfo[]): void {
|
|
993
1045
|
for (const classDecl of classDeclarations) {
|
|
994
|
-
const { id, type, name, file, line, column, superClass, methods } = classDecl;
|
|
1046
|
+
const { id, type, name, file, line, column, superClass, methods, properties, staticBlocks } = classDecl;
|
|
995
1047
|
|
|
996
1048
|
// Buffer CLASS node
|
|
997
1049
|
this._bufferNode({
|
|
@@ -1013,6 +1065,28 @@ export class GraphBuilder {
|
|
|
1013
1065
|
});
|
|
1014
1066
|
}
|
|
1015
1067
|
|
|
1068
|
+
// REG-271: Buffer HAS_PROPERTY edges: CLASS -> VARIABLE (private fields)
|
|
1069
|
+
if (properties) {
|
|
1070
|
+
for (const propertyId of properties) {
|
|
1071
|
+
this._bufferEdge({
|
|
1072
|
+
type: 'HAS_PROPERTY',
|
|
1073
|
+
src: id,
|
|
1074
|
+
dst: propertyId
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// REG-271: Buffer CONTAINS edges: CLASS -> SCOPE (static blocks)
|
|
1080
|
+
if (staticBlocks) {
|
|
1081
|
+
for (const staticBlockId of staticBlocks) {
|
|
1082
|
+
this._bufferEdge({
|
|
1083
|
+
type: 'CONTAINS',
|
|
1084
|
+
src: id,
|
|
1085
|
+
dst: staticBlockId
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1016
1090
|
// If superClass, buffer DERIVES_FROM edge with computed ID
|
|
1017
1091
|
if (superClass) {
|
|
1018
1092
|
// Compute superclass ID using semantic ID format
|
|
@@ -1042,7 +1116,7 @@ export class GraphBuilder {
|
|
|
1042
1116
|
}
|
|
1043
1117
|
|
|
1044
1118
|
for (const instantiation of classInstantiations) {
|
|
1045
|
-
const { variableId, className, line } = instantiation;
|
|
1119
|
+
const { variableId, className, line: _line } = instantiation;
|
|
1046
1120
|
|
|
1047
1121
|
let classId = declarationMap.get(className);
|
|
1048
1122
|
|
|
@@ -1340,7 +1414,7 @@ export class GraphBuilder {
|
|
|
1340
1414
|
|
|
1341
1415
|
private bufferLiterals(literals: LiteralInfo[]): void {
|
|
1342
1416
|
for (const literal of literals) {
|
|
1343
|
-
const { parentCallId, argIndex, ...literalData } = literal;
|
|
1417
|
+
const { parentCallId: _parentCallId, argIndex: _argIndex, ...literalData } = literal;
|
|
1344
1418
|
this._bufferNode(literalData as GraphNode);
|
|
1345
1419
|
}
|
|
1346
1420
|
}
|
|
@@ -1973,21 +2047,20 @@ export class GraphBuilder {
|
|
|
1973
2047
|
|
|
1974
2048
|
/**
|
|
1975
2049
|
* Buffer FLOWS_INTO edges for array mutations (push, unshift, splice, indexed assignment)
|
|
1976
|
-
* Creates edges from inserted values to the array variable
|
|
1977
|
-
*
|
|
1978
|
-
* REG-117: Now handles nested mutations like obj.arr.push(item):
|
|
1979
|
-
* - For nested mutations, falls back to base object if array property not found
|
|
1980
|
-
* - Adds nestedProperty metadata for tracking
|
|
2050
|
+
* Creates edges from inserted values to the array variable.
|
|
1981
2051
|
*
|
|
1982
|
-
*
|
|
2052
|
+
* REG-117: Handles nested mutations like obj.arr.push(item)
|
|
2053
|
+
* REG-392: Handles non-variable values (LITERAL, OBJECT_LITERAL, ARRAY_LITERAL, CALL)
|
|
1983
2054
|
*/
|
|
1984
2055
|
private bufferArrayMutationEdges(
|
|
1985
2056
|
arrayMutations: ArrayMutationInfo[],
|
|
1986
2057
|
variableDeclarations: VariableDeclarationInfo[],
|
|
1987
|
-
parameters: ParameterInfo[]
|
|
2058
|
+
parameters: ParameterInfo[],
|
|
2059
|
+
literals: LiteralInfo[],
|
|
2060
|
+
objectLiterals: ObjectLiteralInfo[],
|
|
2061
|
+
arrayLiterals: ArrayLiteralInfo[],
|
|
2062
|
+
callSites: CallSiteInfo[]
|
|
1988
2063
|
): void {
|
|
1989
|
-
// Note: No longer using Map-based cache - scope-aware lookup requires scope chain walk
|
|
1990
|
-
|
|
1991
2064
|
for (const mutation of arrayMutations) {
|
|
1992
2065
|
const { arrayName, mutationScopePath, mutationMethod, insertedValues, file, isNested, baseObjectName, propertyName } = mutation;
|
|
1993
2066
|
|
|
@@ -2017,32 +2090,58 @@ export class GraphBuilder {
|
|
|
2017
2090
|
|
|
2018
2091
|
// Create FLOWS_INTO edges for each inserted value
|
|
2019
2092
|
for (const arg of insertedValues) {
|
|
2093
|
+
let sourceNodeId: string | undefined;
|
|
2094
|
+
|
|
2020
2095
|
if (arg.valueType === 'VARIABLE' && arg.valueName) {
|
|
2021
2096
|
// Scope-aware lookup for source variable (REG-309)
|
|
2022
2097
|
const sourceVar = this.resolveVariableInScope(arg.valueName, scopePath, file, variableDeclarations);
|
|
2023
2098
|
const sourceParam = !sourceVar ? this.resolveParameterInScope(arg.valueName, scopePath, file, parameters) : null;
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2099
|
+
sourceNodeId = sourceVar?.id ?? sourceParam?.id;
|
|
2100
|
+
} else if (arg.valueNodeId) {
|
|
2101
|
+
// REG-392: Direct node ID for indexed assignments (LITERAL, OBJECT_LITERAL, ARRAY_LITERAL)
|
|
2102
|
+
sourceNodeId = arg.valueNodeId;
|
|
2103
|
+
} else if (arg.valueType === 'LITERAL' && arg.valueLine !== undefined && arg.valueColumn !== undefined) {
|
|
2104
|
+
// REG-392: Find LITERAL node by coordinates (push/unshift — nodes created by extractArguments)
|
|
2105
|
+
const literalNode = literals.find(l =>
|
|
2106
|
+
l.line === arg.valueLine && l.column === arg.valueColumn && l.file === file
|
|
2107
|
+
);
|
|
2108
|
+
sourceNodeId = literalNode?.id;
|
|
2109
|
+
} else if (arg.valueType === 'OBJECT_LITERAL' && arg.valueLine !== undefined && arg.valueColumn !== undefined) {
|
|
2110
|
+
// REG-392: Find OBJECT_LITERAL node by coordinates
|
|
2111
|
+
const objNode = objectLiterals.find(o =>
|
|
2112
|
+
o.line === arg.valueLine && o.column === arg.valueColumn && o.file === file
|
|
2113
|
+
);
|
|
2114
|
+
sourceNodeId = objNode?.id;
|
|
2115
|
+
} else if (arg.valueType === 'ARRAY_LITERAL' && arg.valueLine !== undefined && arg.valueColumn !== undefined) {
|
|
2116
|
+
// REG-392: Find ARRAY_LITERAL node by coordinates
|
|
2117
|
+
const arrNode = arrayLiterals.find(a =>
|
|
2118
|
+
a.line === arg.valueLine && a.column === arg.valueColumn && a.file === file
|
|
2119
|
+
);
|
|
2120
|
+
sourceNodeId = arrNode?.id;
|
|
2121
|
+
} else if (arg.valueType === 'CALL' && arg.callLine !== undefined && arg.callColumn !== undefined) {
|
|
2122
|
+
// REG-392: Find CALL_SITE node by coordinates
|
|
2123
|
+
const callSite = callSites.find(cs =>
|
|
2124
|
+
cs.line === arg.callLine && cs.column === arg.callColumn && cs.file === file
|
|
2125
|
+
);
|
|
2126
|
+
sourceNodeId = callSite?.id;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
if (sourceNodeId) {
|
|
2130
|
+
const edgeData: GraphEdge = {
|
|
2131
|
+
type: 'FLOWS_INTO',
|
|
2132
|
+
src: sourceNodeId,
|
|
2133
|
+
dst: targetNodeId,
|
|
2134
|
+
mutationMethod,
|
|
2135
|
+
argIndex: arg.argIndex
|
|
2136
|
+
};
|
|
2137
|
+
if (arg.isSpread) {
|
|
2138
|
+
edgeData.isSpread = true;
|
|
2139
|
+
}
|
|
2140
|
+
if (nestedProperty) {
|
|
2141
|
+
edgeData.nestedProperty = nestedProperty;
|
|
2042
2142
|
}
|
|
2143
|
+
this._bufferEdge(edgeData);
|
|
2043
2144
|
}
|
|
2044
|
-
// For literals, object literals, etc. - we could create edges from LITERAL nodes
|
|
2045
|
-
// but for now we just track variable -> array flows
|
|
2046
2145
|
}
|
|
2047
2146
|
}
|
|
2048
2147
|
}
|
|
@@ -2606,6 +2705,260 @@ export class GraphBuilder {
|
|
|
2606
2705
|
}
|
|
2607
2706
|
}
|
|
2608
2707
|
|
|
2708
|
+
/**
|
|
2709
|
+
* Buffer YIELDS and DELEGATES_TO edges connecting yield expressions to their generator functions.
|
|
2710
|
+
*
|
|
2711
|
+
* Edge direction:
|
|
2712
|
+
* - For yield: yieldedExpression --YIELDS--> generatorFunction
|
|
2713
|
+
* - For yield*: delegatedCall --DELEGATES_TO--> generatorFunction
|
|
2714
|
+
*
|
|
2715
|
+
* This enables tracing data flow through generator functions:
|
|
2716
|
+
* - Query: "What does this generator yield?"
|
|
2717
|
+
* - Answer: Follow YIELDS edges from function to see all possible yielded values
|
|
2718
|
+
* - Query: "What generators does this delegate to?"
|
|
2719
|
+
* - Answer: Follow DELEGATES_TO edges from function
|
|
2720
|
+
*
|
|
2721
|
+
* REG-270: Generator yield tracking
|
|
2722
|
+
*/
|
|
2723
|
+
private bufferYieldEdges(
|
|
2724
|
+
yieldExpressions: YieldExpressionInfo[],
|
|
2725
|
+
callSites: CallSiteInfo[],
|
|
2726
|
+
methodCalls: MethodCallInfo[],
|
|
2727
|
+
variableDeclarations: VariableDeclarationInfo[],
|
|
2728
|
+
parameters: ParameterInfo[]
|
|
2729
|
+
): void {
|
|
2730
|
+
for (const yld of yieldExpressions) {
|
|
2731
|
+
const { parentFunctionId, yieldValueType, file, isDelegate } = yld;
|
|
2732
|
+
|
|
2733
|
+
// Skip if no value yielded (bare yield;)
|
|
2734
|
+
if (yieldValueType === 'NONE') {
|
|
2735
|
+
continue;
|
|
2736
|
+
}
|
|
2737
|
+
|
|
2738
|
+
let sourceNodeId: string | null = null;
|
|
2739
|
+
|
|
2740
|
+
switch (yieldValueType) {
|
|
2741
|
+
case 'LITERAL':
|
|
2742
|
+
// Direct reference to literal node
|
|
2743
|
+
sourceNodeId = yld.yieldValueId ?? null;
|
|
2744
|
+
break;
|
|
2745
|
+
|
|
2746
|
+
case 'VARIABLE': {
|
|
2747
|
+
// Find variable declaration by name in same file
|
|
2748
|
+
const varName = yld.yieldValueName;
|
|
2749
|
+
if (varName) {
|
|
2750
|
+
const sourceVar = variableDeclarations.find(v =>
|
|
2751
|
+
v.name === varName && v.file === file
|
|
2752
|
+
);
|
|
2753
|
+
if (sourceVar) {
|
|
2754
|
+
sourceNodeId = sourceVar.id;
|
|
2755
|
+
} else {
|
|
2756
|
+
// Check parameters
|
|
2757
|
+
const sourceParam = parameters.find(p =>
|
|
2758
|
+
p.name === varName && p.file === file
|
|
2759
|
+
);
|
|
2760
|
+
if (sourceParam) {
|
|
2761
|
+
sourceNodeId = sourceParam.id;
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
break;
|
|
2766
|
+
}
|
|
2767
|
+
|
|
2768
|
+
case 'CALL_SITE': {
|
|
2769
|
+
// Find call site by coordinates
|
|
2770
|
+
const { yieldValueLine, yieldValueColumn, yieldValueCallName } = yld;
|
|
2771
|
+
if (yieldValueLine && yieldValueColumn) {
|
|
2772
|
+
const callSite = callSites.find(cs =>
|
|
2773
|
+
cs.line === yieldValueLine &&
|
|
2774
|
+
cs.column === yieldValueColumn &&
|
|
2775
|
+
(yieldValueCallName ? cs.name === yieldValueCallName : true)
|
|
2776
|
+
);
|
|
2777
|
+
if (callSite) {
|
|
2778
|
+
sourceNodeId = callSite.id;
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
break;
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
case 'METHOD_CALL': {
|
|
2785
|
+
// Find method call by coordinates and method name
|
|
2786
|
+
const { yieldValueLine, yieldValueColumn, yieldValueCallName } = yld;
|
|
2787
|
+
if (yieldValueLine && yieldValueColumn) {
|
|
2788
|
+
const methodCall = methodCalls.find(mc =>
|
|
2789
|
+
mc.line === yieldValueLine &&
|
|
2790
|
+
mc.column === yieldValueColumn &&
|
|
2791
|
+
mc.file === file &&
|
|
2792
|
+
(yieldValueCallName ? mc.method === yieldValueCallName : true)
|
|
2793
|
+
);
|
|
2794
|
+
if (methodCall) {
|
|
2795
|
+
sourceNodeId = methodCall.id;
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
break;
|
|
2799
|
+
}
|
|
2800
|
+
|
|
2801
|
+
case 'EXPRESSION': {
|
|
2802
|
+
// Create EXPRESSION node and DERIVES_FROM edges for yield expressions
|
|
2803
|
+
const {
|
|
2804
|
+
expressionType,
|
|
2805
|
+
yieldValueId,
|
|
2806
|
+
yieldValueLine,
|
|
2807
|
+
yieldValueColumn,
|
|
2808
|
+
operator,
|
|
2809
|
+
object,
|
|
2810
|
+
property,
|
|
2811
|
+
computed,
|
|
2812
|
+
objectSourceName,
|
|
2813
|
+
leftSourceName,
|
|
2814
|
+
rightSourceName,
|
|
2815
|
+
consequentSourceName,
|
|
2816
|
+
alternateSourceName,
|
|
2817
|
+
expressionSourceNames,
|
|
2818
|
+
unaryArgSourceName
|
|
2819
|
+
} = yld;
|
|
2820
|
+
|
|
2821
|
+
// Skip if no expression ID was generated
|
|
2822
|
+
if (!yieldValueId) {
|
|
2823
|
+
break;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
// Create EXPRESSION node using NodeFactory
|
|
2827
|
+
const expressionNode = NodeFactory.createExpressionFromMetadata(
|
|
2828
|
+
expressionType || 'Unknown',
|
|
2829
|
+
file,
|
|
2830
|
+
yieldValueLine || yld.line,
|
|
2831
|
+
yieldValueColumn || yld.column,
|
|
2832
|
+
{
|
|
2833
|
+
id: yieldValueId,
|
|
2834
|
+
object,
|
|
2835
|
+
property,
|
|
2836
|
+
computed,
|
|
2837
|
+
operator
|
|
2838
|
+
}
|
|
2839
|
+
);
|
|
2840
|
+
|
|
2841
|
+
this._bufferNode(expressionNode);
|
|
2842
|
+
sourceNodeId = yieldValueId;
|
|
2843
|
+
|
|
2844
|
+
// Buffer DERIVES_FROM edges based on expression type
|
|
2845
|
+
// Helper function to find source variable or parameter
|
|
2846
|
+
const findSource = (name: string): string | null => {
|
|
2847
|
+
const variable = variableDeclarations.find(v =>
|
|
2848
|
+
v.name === name && v.file === file
|
|
2849
|
+
);
|
|
2850
|
+
if (variable) return variable.id;
|
|
2851
|
+
|
|
2852
|
+
const param = parameters.find(p =>
|
|
2853
|
+
p.name === name && p.file === file
|
|
2854
|
+
);
|
|
2855
|
+
if (param) return param.id;
|
|
2856
|
+
|
|
2857
|
+
return null;
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
// MemberExpression: derives from the object
|
|
2861
|
+
if (expressionType === 'MemberExpression' && objectSourceName) {
|
|
2862
|
+
const srcId = findSource(objectSourceName);
|
|
2863
|
+
if (srcId) {
|
|
2864
|
+
this._bufferEdge({
|
|
2865
|
+
type: 'DERIVES_FROM',
|
|
2866
|
+
src: yieldValueId,
|
|
2867
|
+
dst: srcId
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
// BinaryExpression / LogicalExpression: derives from left and right operands
|
|
2873
|
+
if (expressionType === 'BinaryExpression' || expressionType === 'LogicalExpression') {
|
|
2874
|
+
if (leftSourceName) {
|
|
2875
|
+
const srcId = findSource(leftSourceName);
|
|
2876
|
+
if (srcId) {
|
|
2877
|
+
this._bufferEdge({
|
|
2878
|
+
type: 'DERIVES_FROM',
|
|
2879
|
+
src: yieldValueId,
|
|
2880
|
+
dst: srcId
|
|
2881
|
+
});
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
if (rightSourceName) {
|
|
2885
|
+
const srcId = findSource(rightSourceName);
|
|
2886
|
+
if (srcId) {
|
|
2887
|
+
this._bufferEdge({
|
|
2888
|
+
type: 'DERIVES_FROM',
|
|
2889
|
+
src: yieldValueId,
|
|
2890
|
+
dst: srcId
|
|
2891
|
+
});
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
// ConditionalExpression: derives from consequent and alternate
|
|
2897
|
+
if (expressionType === 'ConditionalExpression') {
|
|
2898
|
+
if (consequentSourceName) {
|
|
2899
|
+
const srcId = findSource(consequentSourceName);
|
|
2900
|
+
if (srcId) {
|
|
2901
|
+
this._bufferEdge({
|
|
2902
|
+
type: 'DERIVES_FROM',
|
|
2903
|
+
src: yieldValueId,
|
|
2904
|
+
dst: srcId
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
if (alternateSourceName) {
|
|
2909
|
+
const srcId = findSource(alternateSourceName);
|
|
2910
|
+
if (srcId) {
|
|
2911
|
+
this._bufferEdge({
|
|
2912
|
+
type: 'DERIVES_FROM',
|
|
2913
|
+
src: yieldValueId,
|
|
2914
|
+
dst: srcId
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
// UnaryExpression: derives from the argument
|
|
2921
|
+
if (expressionType === 'UnaryExpression' && unaryArgSourceName) {
|
|
2922
|
+
const srcId = findSource(unaryArgSourceName);
|
|
2923
|
+
if (srcId) {
|
|
2924
|
+
this._bufferEdge({
|
|
2925
|
+
type: 'DERIVES_FROM',
|
|
2926
|
+
src: yieldValueId,
|
|
2927
|
+
dst: srcId
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
// TemplateLiteral: derives from all embedded expressions
|
|
2933
|
+
if (expressionType === 'TemplateLiteral' && expressionSourceNames && expressionSourceNames.length > 0) {
|
|
2934
|
+
for (const sourceName of expressionSourceNames) {
|
|
2935
|
+
const srcId = findSource(sourceName);
|
|
2936
|
+
if (srcId) {
|
|
2937
|
+
this._bufferEdge({
|
|
2938
|
+
type: 'DERIVES_FROM',
|
|
2939
|
+
src: yieldValueId,
|
|
2940
|
+
dst: srcId
|
|
2941
|
+
});
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
break;
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
// Create YIELDS or DELEGATES_TO edge if we found a source node
|
|
2951
|
+
if (sourceNodeId && parentFunctionId) {
|
|
2952
|
+
const edgeType = isDelegate ? 'DELEGATES_TO' : 'YIELDS';
|
|
2953
|
+
this._bufferEdge({
|
|
2954
|
+
type: edgeType,
|
|
2955
|
+
src: sourceNodeId,
|
|
2956
|
+
dst: parentFunctionId
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2609
2962
|
/**
|
|
2610
2963
|
* Buffer UPDATE_EXPRESSION nodes and edges for increment/decrement operations.
|
|
2611
2964
|
*
|
|
@@ -2988,4 +3341,117 @@ export class GraphBuilder {
|
|
|
2988
3341
|
|
|
2989
3342
|
return edgesCreated;
|
|
2990
3343
|
}
|
|
3344
|
+
|
|
3345
|
+
/**
|
|
3346
|
+
* Buffer REJECTS edges for async error tracking (REG-311).
|
|
3347
|
+
*
|
|
3348
|
+
* Creates edges from FUNCTION nodes to error CLASS nodes they can reject.
|
|
3349
|
+
* This enables tracking which async functions can throw which error types:
|
|
3350
|
+
*
|
|
3351
|
+
* - Promise.reject(new Error()) -> FUNCTION --REJECTS--> CLASS[Error]
|
|
3352
|
+
* - reject(new ValidationError()) in executor -> FUNCTION --REJECTS--> CLASS[ValidationError]
|
|
3353
|
+
* - throw new AuthError() in async function -> FUNCTION --REJECTS--> CLASS[AuthError]
|
|
3354
|
+
*
|
|
3355
|
+
* Also stores rejectionPatterns in function metadata for downstream enrichers.
|
|
3356
|
+
*
|
|
3357
|
+
* @param functions - All function infos from analysis
|
|
3358
|
+
* @param rejectionPatterns - Collected rejection patterns from analysis
|
|
3359
|
+
*/
|
|
3360
|
+
private bufferRejectionEdges(functions: FunctionInfo[], rejectionPatterns: RejectionPatternInfo[]): void {
|
|
3361
|
+
// Group rejection patterns by functionId for efficient lookup
|
|
3362
|
+
const patternsByFunction = new Map<string, RejectionPatternInfo[]>();
|
|
3363
|
+
for (const pattern of rejectionPatterns) {
|
|
3364
|
+
const existing = patternsByFunction.get(pattern.functionId);
|
|
3365
|
+
if (existing) {
|
|
3366
|
+
existing.push(pattern);
|
|
3367
|
+
} else {
|
|
3368
|
+
patternsByFunction.set(pattern.functionId, [pattern]);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
// Process each function that has rejection patterns
|
|
3373
|
+
for (const [functionId, patterns] of patternsByFunction) {
|
|
3374
|
+
// Collect unique error class names from this function's rejection patterns
|
|
3375
|
+
const errorClassNames = new Set<string>();
|
|
3376
|
+
for (const pattern of patterns) {
|
|
3377
|
+
if (pattern.errorClassName) {
|
|
3378
|
+
errorClassNames.add(pattern.errorClassName);
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
|
|
3382
|
+
// Create REJECTS edges to error class nodes
|
|
3383
|
+
// Note: These edges target computed CLASS IDs - they will be dangling
|
|
3384
|
+
// if the class isn't declared, but that's expected behavior for
|
|
3385
|
+
// built-in classes like Error, TypeError, etc.
|
|
3386
|
+
for (const errorClassName of errorClassNames) {
|
|
3387
|
+
// Find the function's file to compute the class ID
|
|
3388
|
+
const func = functions.find(f => f.id === functionId);
|
|
3389
|
+
const file = func?.file ?? '';
|
|
3390
|
+
|
|
3391
|
+
// Compute potential class ID at global scope
|
|
3392
|
+
// For built-in errors, this will be a dangling reference (expected)
|
|
3393
|
+
const globalContext = { file, scopePath: [] as string[] };
|
|
3394
|
+
const classId = computeSemanticId('CLASS', errorClassName, globalContext);
|
|
3395
|
+
|
|
3396
|
+
this._bufferEdge({
|
|
3397
|
+
type: 'REJECTS',
|
|
3398
|
+
src: functionId,
|
|
3399
|
+
dst: classId,
|
|
3400
|
+
metadata: {
|
|
3401
|
+
errorClassName
|
|
3402
|
+
}
|
|
3403
|
+
});
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
// Store rejection patterns in function metadata for downstream enrichers
|
|
3407
|
+
// Find and update the function node in the buffer
|
|
3408
|
+
for (const node of this._nodeBuffer) {
|
|
3409
|
+
if (node.id === functionId) {
|
|
3410
|
+
// Store in metadata field for proper persistence and test compatibility
|
|
3411
|
+
if (!node.metadata) {
|
|
3412
|
+
node.metadata = {};
|
|
3413
|
+
}
|
|
3414
|
+
(node.metadata as Record<string, unknown>).rejectionPatterns = patterns.map(p => ({
|
|
3415
|
+
rejectionType: p.rejectionType,
|
|
3416
|
+
errorClassName: p.errorClassName,
|
|
3417
|
+
line: p.line,
|
|
3418
|
+
column: p.column,
|
|
3419
|
+
sourceVariableName: p.sourceVariableName,
|
|
3420
|
+
tracePath: p.tracePath
|
|
3421
|
+
}));
|
|
3422
|
+
break;
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
/**
|
|
3429
|
+
* Buffer CATCHES_FROM edges linking catch blocks to error sources (REG-311).
|
|
3430
|
+
*
|
|
3431
|
+
* Creates edges from CATCH_BLOCK nodes to potential error sources within
|
|
3432
|
+
* their corresponding try blocks. This enables tracking which catch blocks
|
|
3433
|
+
* can handle which exceptions:
|
|
3434
|
+
*
|
|
3435
|
+
* - try { await fetch() } catch(e) -> CATCH_BLOCK --CATCHES_FROM--> CALL[fetch]
|
|
3436
|
+
* - try { throw new Error() } catch(e) -> CATCH_BLOCK --CATCHES_FROM--> THROW_STATEMENT
|
|
3437
|
+
*
|
|
3438
|
+
* The sourceType metadata helps distinguish different error source kinds
|
|
3439
|
+
* for more precise error flow analysis.
|
|
3440
|
+
*
|
|
3441
|
+
* @param catchesFromInfos - Collected CATCHES_FROM info from analysis
|
|
3442
|
+
*/
|
|
3443
|
+
private bufferCatchesFromEdges(catchesFromInfos: CatchesFromInfo[]): void {
|
|
3444
|
+
for (const info of catchesFromInfos) {
|
|
3445
|
+
this._bufferEdge({
|
|
3446
|
+
type: 'CATCHES_FROM',
|
|
3447
|
+
src: info.catchBlockId,
|
|
3448
|
+
dst: info.sourceId,
|
|
3449
|
+
metadata: {
|
|
3450
|
+
parameterName: info.parameterName,
|
|
3451
|
+
sourceType: info.sourceType,
|
|
3452
|
+
sourceLine: info.sourceLine
|
|
3453
|
+
}
|
|
3454
|
+
});
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
2991
3457
|
}
|