@grafema/core 0.2.3-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 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -6
- 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 +20 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -1
- package/dist/storage/backends/RFDBServerBackend.js +47 -19
- 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.d.ts +39 -0
- package/dist/utils/findRfdbBinary.d.ts.map +1 -0
- package/dist/utils/findRfdbBinary.js +141 -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 -7
- 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 +56 -22
- package/src/storage/backends/typeValidation.ts +2 -0
- package/src/utils/findRfdbBinary.ts +160 -0
- package/src/utils/moduleResolution.ts +244 -0
- package/src/validation/PathValidator.ts +0 -8
- package/src/plugins/validation/NodeCreationValidator.ts +0 -554
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { readFileSync } from 'fs';
|
|
13
|
-
import {
|
|
13
|
+
import type { ParserPlugin } from '@babel/parser';
|
|
14
|
+
import { parse } from '@babel/parser';
|
|
14
15
|
import traverseModule from '@babel/traverse';
|
|
15
16
|
import type { CallExpression, Identifier, MemberExpression, ObjectExpression, Node } from '@babel/types';
|
|
16
17
|
import type { NodePath } from '@babel/traverse';
|
|
@@ -20,7 +21,6 @@ import type { NodeRecord } from '@grafema/types';
|
|
|
20
21
|
import { NetworkRequestNode } from '../../core/nodes/NetworkRequestNode.js';
|
|
21
22
|
import { getLine, getColumn } from './ast/utils/location.js';
|
|
22
23
|
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
24
|
const traverse = (traverseModule as any).default || traverseModule;
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -31,6 +31,7 @@ interface HttpRequestNode {
|
|
|
31
31
|
type: 'http:request';
|
|
32
32
|
name: string; // Human-readable name like "GET /api/users"
|
|
33
33
|
method: string;
|
|
34
|
+
methodSource: MethodSource;
|
|
34
35
|
url: string;
|
|
35
36
|
library: string;
|
|
36
37
|
file: string;
|
|
@@ -53,6 +54,8 @@ interface FetchCallInfo {
|
|
|
53
54
|
responseVarName: string | null;
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
type MethodSource = 'explicit' | 'default' | 'unknown';
|
|
58
|
+
|
|
56
59
|
/**
|
|
57
60
|
* Analysis result
|
|
58
61
|
*/
|
|
@@ -69,7 +72,6 @@ export class FetchAnalyzer extends Plugin {
|
|
|
69
72
|
return {
|
|
70
73
|
name: 'FetchAnalyzer',
|
|
71
74
|
phase: 'ANALYSIS',
|
|
72
|
-
priority: 75, // После JSASTAnalyzer (80)
|
|
73
75
|
creates: {
|
|
74
76
|
nodes: ['http:request', 'EXTERNAL'],
|
|
75
77
|
edges: ['CONTAINS', 'MAKES_REQUEST', 'CALLS_API']
|
|
@@ -84,7 +86,11 @@ export class FetchAnalyzer extends Plugin {
|
|
|
84
86
|
try {
|
|
85
87
|
const { graph } = context;
|
|
86
88
|
|
|
87
|
-
// net:request singleton
|
|
89
|
+
// Create net:request singleton once before processing modules
|
|
90
|
+
const networkNode = NetworkRequestNode.create();
|
|
91
|
+
await graph.addNode(networkNode);
|
|
92
|
+
this.networkNodeCreated = true;
|
|
93
|
+
this.networkNodeId = networkNode.id;
|
|
88
94
|
|
|
89
95
|
// Получаем все модули
|
|
90
96
|
const modules = await this.getModules(graph);
|
|
@@ -128,28 +134,20 @@ export class FetchAnalyzer extends Plugin {
|
|
|
128
134
|
);
|
|
129
135
|
} catch (error) {
|
|
130
136
|
logger.error('Analysis failed', { error });
|
|
131
|
-
|
|
137
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
138
|
+
return createErrorResult(err);
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
141
|
|
|
135
|
-
/**
|
|
136
|
-
* Ensures net:request singleton exists, creating it if necessary.
|
|
137
|
-
* Called lazily when first HTTP request is detected.
|
|
138
|
-
*/
|
|
139
|
-
private async ensureNetworkNode(graph: PluginContext['graph']): Promise<string> {
|
|
140
|
-
if (!this.networkNodeId) {
|
|
141
|
-
const networkNode = NetworkRequestNode.create();
|
|
142
|
-
await graph.addNode(networkNode);
|
|
143
|
-
this.networkNodeCreated = true;
|
|
144
|
-
this.networkNodeId = networkNode.id;
|
|
145
|
-
}
|
|
146
|
-
return this.networkNodeId;
|
|
147
|
-
}
|
|
148
142
|
|
|
149
143
|
private async analyzeModule(
|
|
150
144
|
module: NodeRecord,
|
|
151
145
|
graph: PluginContext['graph']
|
|
152
146
|
): Promise<AnalysisResult> {
|
|
147
|
+
// Batch arrays for nodes and edges
|
|
148
|
+
const nodes: NodeRecord[] = [];
|
|
149
|
+
const edges: Array<{ type: string; src: string; dst: string }> = [];
|
|
150
|
+
|
|
153
151
|
try {
|
|
154
152
|
const code = readFileSync(module.file!, 'utf-8');
|
|
155
153
|
|
|
@@ -167,6 +165,26 @@ export class FetchAnalyzer extends Plugin {
|
|
|
167
165
|
] as ParserPlugin[]
|
|
168
166
|
});
|
|
169
167
|
|
|
168
|
+
const constStrings = new Map<string, string>();
|
|
169
|
+
const constObjects = new Map<string, ObjectExpression>();
|
|
170
|
+
|
|
171
|
+
// Collect simple const assignments for method resolution
|
|
172
|
+
traverse(ast, {
|
|
173
|
+
VariableDeclarator: (path: NodePath) => {
|
|
174
|
+
const node = path.node as { id: Node; init?: Node | null };
|
|
175
|
+
const parent = path.parentPath?.node as { type?: string; kind?: string } | undefined;
|
|
176
|
+
if (!parent || parent.type !== 'VariableDeclaration' || parent.kind !== 'const') return;
|
|
177
|
+
if (!node.init || node.id.type !== 'Identifier') return;
|
|
178
|
+
|
|
179
|
+
const name = (node.id as Identifier).name;
|
|
180
|
+
if (node.init.type === 'StringLiteral') {
|
|
181
|
+
constStrings.set(name, (node.init as { value: string }).value);
|
|
182
|
+
} else if (node.init.type === 'ObjectExpression') {
|
|
183
|
+
constObjects.set(name, node.init as ObjectExpression);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
170
188
|
const fetchCalls: FetchCallInfo[] = [];
|
|
171
189
|
const externalAPIs = new Set<string>();
|
|
172
190
|
|
|
@@ -180,7 +198,8 @@ export class FetchAnalyzer extends Plugin {
|
|
|
180
198
|
if (callee.type === 'Identifier' && (callee as Identifier).name === 'fetch') {
|
|
181
199
|
const urlArg = node.arguments[0];
|
|
182
200
|
const url = this.extractURL(urlArg);
|
|
183
|
-
const
|
|
201
|
+
const methodInfo = this.extractMethodInfo(node.arguments[1], constStrings, constObjects);
|
|
202
|
+
const method = methodInfo.method;
|
|
184
203
|
const line = getLine(node);
|
|
185
204
|
|
|
186
205
|
const request: HttpRequestNode = {
|
|
@@ -188,6 +207,7 @@ export class FetchAnalyzer extends Plugin {
|
|
|
188
207
|
type: 'http:request',
|
|
189
208
|
name: `${method} ${url}`,
|
|
190
209
|
method: method,
|
|
210
|
+
methodSource: methodInfo.source,
|
|
191
211
|
url: url,
|
|
192
212
|
library: 'fetch',
|
|
193
213
|
file: module.file!,
|
|
@@ -223,6 +243,7 @@ export class FetchAnalyzer extends Plugin {
|
|
|
223
243
|
type: 'http:request',
|
|
224
244
|
name: `${method} ${url}`,
|
|
225
245
|
method: method,
|
|
246
|
+
methodSource: 'explicit',
|
|
226
247
|
url: url,
|
|
227
248
|
library: 'axios',
|
|
228
249
|
file: module.file!,
|
|
@@ -250,19 +271,12 @@ export class FetchAnalyzer extends Plugin {
|
|
|
250
271
|
(p.key as Identifier).type === 'Identifier' &&
|
|
251
272
|
(p.key as Identifier).name === 'url'
|
|
252
273
|
);
|
|
253
|
-
const methodProp = objExpr.properties.find(
|
|
254
|
-
p =>
|
|
255
|
-
p.type === 'ObjectProperty' &&
|
|
256
|
-
(p.key as Identifier).type === 'Identifier' &&
|
|
257
|
-
(p.key as Identifier).name === 'method'
|
|
258
|
-
);
|
|
259
274
|
|
|
260
275
|
const url = urlProp
|
|
261
276
|
? this.extractURL((urlProp as { value: Node }).value)
|
|
262
277
|
: 'unknown';
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
: 'GET';
|
|
278
|
+
const methodInfo = this.extractMethodInfo(config, constStrings, constObjects);
|
|
279
|
+
const method = methodInfo.method;
|
|
266
280
|
const line = getLine(node);
|
|
267
281
|
|
|
268
282
|
const request: HttpRequestNode = {
|
|
@@ -270,6 +284,7 @@ export class FetchAnalyzer extends Plugin {
|
|
|
270
284
|
type: 'http:request',
|
|
271
285
|
name: `${method.toUpperCase()} ${url}`,
|
|
272
286
|
method: method.toUpperCase(),
|
|
287
|
+
methodSource: methodInfo.source,
|
|
273
288
|
url: url,
|
|
274
289
|
library: 'axios',
|
|
275
290
|
file: module.file!,
|
|
@@ -297,7 +312,8 @@ export class FetchAnalyzer extends Plugin {
|
|
|
297
312
|
) {
|
|
298
313
|
const urlArg = node.arguments[0];
|
|
299
314
|
const url = this.extractURL(urlArg);
|
|
300
|
-
const
|
|
315
|
+
const methodInfo = this.extractMethodInfo(node.arguments[1], constStrings, constObjects);
|
|
316
|
+
const method = methodInfo.method;
|
|
301
317
|
const line = getLine(node);
|
|
302
318
|
|
|
303
319
|
const request: HttpRequestNode = {
|
|
@@ -305,6 +321,7 @@ export class FetchAnalyzer extends Plugin {
|
|
|
305
321
|
type: 'http:request',
|
|
306
322
|
name: `${method} ${url}`,
|
|
307
323
|
method: method,
|
|
324
|
+
methodSource: methodInfo.source,
|
|
308
325
|
url: url,
|
|
309
326
|
library: calleeName,
|
|
310
327
|
file: module.file!,
|
|
@@ -328,15 +345,24 @@ export class FetchAnalyzer extends Plugin {
|
|
|
328
345
|
// Extract httpRequests for external API handling
|
|
329
346
|
const httpRequests = fetchCalls.map(fc => fc.request);
|
|
330
347
|
|
|
348
|
+
// Pre-fetch FUNCTION and CALL nodes for this file once (avoid N+1 IPC queries)
|
|
349
|
+
const fileFunctions: NodeRecord[] = [];
|
|
350
|
+
for await (const fn of graph.queryNodes({ type: 'FUNCTION', file: module.file! })) {
|
|
351
|
+
fileFunctions.push(fn);
|
|
352
|
+
}
|
|
353
|
+
const fileCalls: NodeRecord[] = [];
|
|
354
|
+
for await (const cn of graph.queryNodes({ type: 'CALL', file: module.file! })) {
|
|
355
|
+
fileCalls.push(cn);
|
|
356
|
+
}
|
|
357
|
+
|
|
331
358
|
// Создаём HTTP_REQUEST ноды
|
|
332
359
|
for (const fetchCall of fetchCalls) {
|
|
333
360
|
const request = fetchCall.request;
|
|
334
361
|
|
|
335
362
|
// Find responseDataNode if we have a response variable name
|
|
336
363
|
if (fetchCall.responseVarName) {
|
|
337
|
-
const responseDataNodeId =
|
|
338
|
-
|
|
339
|
-
request.file,
|
|
364
|
+
const responseDataNodeId = this.findResponseJsonCallInMemory(
|
|
365
|
+
fileCalls,
|
|
340
366
|
fetchCall.responseVarName,
|
|
341
367
|
request.line
|
|
342
368
|
);
|
|
@@ -345,67 +371,58 @@ export class FetchAnalyzer extends Plugin {
|
|
|
345
371
|
}
|
|
346
372
|
}
|
|
347
373
|
|
|
348
|
-
|
|
374
|
+
nodes.push(request as unknown as NodeRecord);
|
|
349
375
|
|
|
350
376
|
// Создаём ребро от модуля к request
|
|
351
|
-
|
|
377
|
+
edges.push({
|
|
352
378
|
type: 'CONTAINS',
|
|
353
379
|
src: module.id,
|
|
354
380
|
dst: request.id
|
|
355
381
|
});
|
|
356
382
|
|
|
357
|
-
// http:request --CALLS--> net:request singleton
|
|
358
|
-
|
|
359
|
-
await graph.addEdge({
|
|
383
|
+
// http:request --CALLS--> net:request singleton
|
|
384
|
+
edges.push({
|
|
360
385
|
type: 'CALLS',
|
|
361
386
|
src: request.id,
|
|
362
|
-
dst:
|
|
387
|
+
dst: this.networkNodeId!
|
|
363
388
|
});
|
|
364
389
|
|
|
365
|
-
// Ищем FUNCTION node которая делает запрос
|
|
366
|
-
const functions
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
(fn.line ?? 0) + 50 >= request.line
|
|
372
|
-
) {
|
|
373
|
-
functions.push(fn);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
390
|
+
// Ищем FUNCTION node которая делает запрос (in-memory filter)
|
|
391
|
+
const functions = fileFunctions.filter(fn =>
|
|
392
|
+
fn.line != null &&
|
|
393
|
+
fn.line <= request.line &&
|
|
394
|
+
fn.line + 50 >= request.line
|
|
395
|
+
);
|
|
376
396
|
|
|
377
397
|
if (functions.length > 0) {
|
|
378
398
|
// Берём ближайшую функцию
|
|
379
399
|
const closestFunction = functions.reduce((closest, func) => {
|
|
380
|
-
const currentDistance = Math.abs(
|
|
381
|
-
const closestDistance = Math.abs(
|
|
400
|
+
const currentDistance = Math.abs(func.line! - request.line);
|
|
401
|
+
const closestDistance = Math.abs(closest.line! - request.line);
|
|
382
402
|
return currentDistance < closestDistance ? func : closest;
|
|
383
403
|
});
|
|
384
404
|
|
|
385
|
-
|
|
405
|
+
edges.push({
|
|
386
406
|
type: 'MAKES_REQUEST',
|
|
387
407
|
src: closestFunction.id,
|
|
388
408
|
dst: request.id
|
|
389
409
|
});
|
|
390
410
|
}
|
|
391
411
|
|
|
392
|
-
// Find CALL node that makes this request (same file, same line)
|
|
393
|
-
// Determine expected call name based on library
|
|
412
|
+
// Find CALL node that makes this request (same file, same line, in-memory)
|
|
394
413
|
const expectedCallNames = this.getExpectedCallNames(request.library, request.method);
|
|
395
414
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
break; // Only link to first matching CALL node
|
|
408
|
-
}
|
|
415
|
+
const matchingCall = fileCalls.find(callNode =>
|
|
416
|
+
callNode.line === request.line &&
|
|
417
|
+
expectedCallNames.includes(callNode.name as string)
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
if (matchingCall) {
|
|
421
|
+
edges.push({
|
|
422
|
+
type: 'MAKES_REQUEST',
|
|
423
|
+
src: matchingCall.id,
|
|
424
|
+
dst: request.id
|
|
425
|
+
});
|
|
409
426
|
}
|
|
410
427
|
}
|
|
411
428
|
|
|
@@ -416,7 +433,7 @@ export class FetchAnalyzer extends Plugin {
|
|
|
416
433
|
// Проверяем что нода ещё не создана
|
|
417
434
|
const existingApi = await graph.getNode(apiId);
|
|
418
435
|
if (!existingApi) {
|
|
419
|
-
|
|
436
|
+
nodes.push({
|
|
420
437
|
id: apiId,
|
|
421
438
|
type: 'EXTERNAL',
|
|
422
439
|
domain: apiDomain,
|
|
@@ -428,7 +445,7 @@ export class FetchAnalyzer extends Plugin {
|
|
|
428
445
|
const apiRequests = httpRequests.filter(r => r.url.includes(apiDomain));
|
|
429
446
|
|
|
430
447
|
for (const request of apiRequests) {
|
|
431
|
-
|
|
448
|
+
edges.push({
|
|
432
449
|
type: 'CALLS_API',
|
|
433
450
|
src: request.id,
|
|
434
451
|
dst: apiId
|
|
@@ -436,11 +453,19 @@ export class FetchAnalyzer extends Plugin {
|
|
|
436
453
|
}
|
|
437
454
|
}
|
|
438
455
|
|
|
456
|
+
// Flush batched operations
|
|
457
|
+
if (nodes.length > 0) {
|
|
458
|
+
await graph.addNodes(nodes);
|
|
459
|
+
}
|
|
460
|
+
if (edges.length > 0) {
|
|
461
|
+
await graph.addEdges(edges);
|
|
462
|
+
}
|
|
463
|
+
|
|
439
464
|
return {
|
|
440
465
|
requests: fetchCalls.length,
|
|
441
466
|
apis: externalAPIs.size
|
|
442
467
|
};
|
|
443
|
-
} catch
|
|
468
|
+
} catch {
|
|
444
469
|
// Silent - per-module errors shouldn't spam logs
|
|
445
470
|
return { requests: 0, apis: 0 };
|
|
446
471
|
}
|
|
@@ -480,38 +505,77 @@ export class FetchAnalyzer extends Plugin {
|
|
|
480
505
|
}
|
|
481
506
|
|
|
482
507
|
/**
|
|
483
|
-
* Извлекает HTTP method из options объекта
|
|
508
|
+
* Извлекает HTTP method из options объекта и источник значения
|
|
484
509
|
*/
|
|
485
|
-
private
|
|
486
|
-
|
|
487
|
-
|
|
510
|
+
private extractMethodInfo(
|
|
511
|
+
optionsArg: Node | undefined,
|
|
512
|
+
constStrings: Map<string, string>,
|
|
513
|
+
constObjects: Map<string, ObjectExpression>
|
|
514
|
+
): { method: string; source: MethodSource } {
|
|
515
|
+
if (!optionsArg) {
|
|
516
|
+
return { method: 'GET', source: 'default' };
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
let optionsNode: Node = optionsArg;
|
|
520
|
+
if (optionsNode.type === 'Identifier') {
|
|
521
|
+
const resolvedObject = constObjects.get((optionsNode as Identifier).name);
|
|
522
|
+
if (resolvedObject) {
|
|
523
|
+
optionsNode = resolvedObject;
|
|
524
|
+
} else {
|
|
525
|
+
return { method: 'UNKNOWN', source: 'unknown' };
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (optionsNode.type !== 'ObjectExpression') {
|
|
530
|
+
return { method: 'UNKNOWN', source: 'unknown' };
|
|
488
531
|
}
|
|
489
532
|
|
|
490
|
-
const objExpr =
|
|
491
|
-
const methodProp = objExpr.properties.find(
|
|
492
|
-
p
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
533
|
+
const objExpr = optionsNode as ObjectExpression;
|
|
534
|
+
const methodProp = objExpr.properties.find(p => {
|
|
535
|
+
if (p.type !== 'ObjectProperty') return false;
|
|
536
|
+
const key = p.key;
|
|
537
|
+
if (key.type === 'Identifier') return key.name === 'method';
|
|
538
|
+
if (key.type === 'StringLiteral') return key.value === 'method';
|
|
539
|
+
return false;
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
if (!methodProp || !(methodProp as { value?: Node }).value) {
|
|
543
|
+
return { method: 'GET', source: 'default' };
|
|
544
|
+
}
|
|
497
545
|
|
|
498
|
-
|
|
499
|
-
|
|
546
|
+
const methodValue = (methodProp as { value: Node }).value;
|
|
547
|
+
const methodString = this.extractStaticString(methodValue, constStrings);
|
|
548
|
+
if (!methodString) {
|
|
549
|
+
return { method: 'UNKNOWN', source: 'unknown' };
|
|
500
550
|
}
|
|
501
551
|
|
|
502
|
-
return
|
|
552
|
+
return { method: methodString.toUpperCase(), source: 'explicit' };
|
|
503
553
|
}
|
|
504
554
|
|
|
505
555
|
/**
|
|
506
|
-
* Извлекает строковое значение
|
|
556
|
+
* Извлекает статическое строковое значение (StringLiteral, простая TemplateLiteral, или const Identifier)
|
|
507
557
|
*/
|
|
508
|
-
private
|
|
558
|
+
private extractStaticString(
|
|
559
|
+
node: Node | undefined,
|
|
560
|
+
constStrings: Map<string, string>
|
|
561
|
+
): string | null {
|
|
509
562
|
if (!node) return null;
|
|
510
563
|
|
|
511
564
|
if (node.type === 'StringLiteral') {
|
|
512
565
|
return (node as { value: string }).value;
|
|
513
566
|
}
|
|
514
567
|
|
|
568
|
+
if (node.type === 'TemplateLiteral') {
|
|
569
|
+
const tl = node as { quasis: Array<{ value: { raw: string } }>; expressions: unknown[] };
|
|
570
|
+
if (tl.expressions.length === 0) {
|
|
571
|
+
return tl.quasis.map(q => q.value.raw).join('');
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (node.type === 'Identifier') {
|
|
576
|
+
return constStrings.get((node as Identifier).name) || null;
|
|
577
|
+
}
|
|
578
|
+
|
|
515
579
|
return null;
|
|
516
580
|
}
|
|
517
581
|
|
|
@@ -605,48 +669,36 @@ export class FetchAnalyzer extends Plugin {
|
|
|
605
669
|
|
|
606
670
|
/**
|
|
607
671
|
* Finds the response consumption CALL node (response.json(), response.text(), etc.)
|
|
608
|
-
*
|
|
672
|
+
* from pre-fetched CALL nodes for the current file.
|
|
609
673
|
*
|
|
610
|
-
*
|
|
674
|
+
* Filters to find the response.json() call AFTER the fetch line and
|
|
611
675
|
* closest to it, ensuring we match the correct call in the same function scope.
|
|
612
676
|
*
|
|
613
|
-
* @param
|
|
614
|
-
* @param file - File path where fetch call is located
|
|
677
|
+
* @param fileCalls - Pre-fetched CALL nodes for this file
|
|
615
678
|
* @param responseVarName - Variable name holding the response
|
|
616
679
|
* @param fetchLine - Line number of the fetch call (response.json must be after this)
|
|
617
680
|
* @returns CALL node ID or null if not found
|
|
618
681
|
*/
|
|
619
|
-
private
|
|
620
|
-
|
|
621
|
-
file: string,
|
|
682
|
+
private findResponseJsonCallInMemory(
|
|
683
|
+
fileCalls: NodeRecord[],
|
|
622
684
|
responseVarName: string,
|
|
623
685
|
fetchLine: number
|
|
624
|
-
):
|
|
625
|
-
|
|
626
|
-
|
|
686
|
+
): string | null {
|
|
687
|
+
let bestId: string | null = null;
|
|
688
|
+
let bestLine = Infinity;
|
|
627
689
|
|
|
628
|
-
for
|
|
629
|
-
// Check if it's in the same file
|
|
630
|
-
if (node.file !== file) continue;
|
|
631
|
-
|
|
632
|
-
// Check if object matches response variable name
|
|
690
|
+
for (const node of fileCalls) {
|
|
633
691
|
const callNode = node as unknown as { object?: string; method?: string };
|
|
634
692
|
if (callNode.object !== responseVarName) continue;
|
|
693
|
+
if (!callNode.method || !RESPONSE_CONSUMPTION_METHODS.includes(callNode.method)) continue;
|
|
635
694
|
|
|
636
|
-
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
if (nodeLine > fetchLine) {
|
|
641
|
-
candidates.push({ id: node.id, line: nodeLine });
|
|
642
|
-
}
|
|
695
|
+
if (node.line == null) continue;
|
|
696
|
+
if (node.line > fetchLine && node.line < bestLine) {
|
|
697
|
+
bestId = node.id;
|
|
698
|
+
bestLine = node.line;
|
|
643
699
|
}
|
|
644
700
|
}
|
|
645
701
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
// Return the closest match (smallest line number after fetch)
|
|
649
|
-
candidates.sort((a, b) => a.line - b.line);
|
|
650
|
-
return candidates[0].id;
|
|
702
|
+
return bestId;
|
|
651
703
|
}
|
|
652
704
|
}
|
|
@@ -23,15 +23,16 @@ import { Plugin, createSuccessResult, createErrorResult } from '../Plugin.js';
|
|
|
23
23
|
import type { PluginContext, PluginResult, PluginMetadata } from '../Plugin.js';
|
|
24
24
|
import type { GraphBackend } from '@grafema/types';
|
|
25
25
|
import type { NodeRecord } from '@grafema/types';
|
|
26
|
-
import {
|
|
26
|
+
import type { VersionedNode } from '../../core/VersionManager.js';
|
|
27
|
+
import { versionManager } from '../../core/VersionManager.js';
|
|
27
28
|
import { VCSPluginFactory } from '../vcs/index.js';
|
|
28
29
|
import type { VCSPlugin } from '../vcs/VCSPlugin.js';
|
|
29
|
-
import {
|
|
30
|
+
import type { ParserPlugin } from '@babel/parser';
|
|
31
|
+
import { parse } from '@babel/parser';
|
|
30
32
|
import traverseModule from '@babel/traverse';
|
|
31
33
|
import type { NodePath } from '@babel/traverse';
|
|
32
34
|
import { readFile } from 'fs/promises';
|
|
33
35
|
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
36
|
const traverse = (traverseModule as any).default || traverseModule;
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -77,7 +78,6 @@ export class IncrementalAnalysisPlugin extends Plugin {
|
|
|
77
78
|
return {
|
|
78
79
|
name: 'IncrementalAnalysisPlugin',
|
|
79
80
|
phase: 'ANALYSIS',
|
|
80
|
-
priority: 85, // Запускается после JSModuleIndexer (90) но перед JSASTAnalyzer (80)
|
|
81
81
|
creates: {
|
|
82
82
|
nodes: ['FUNCTION', 'CLASS', 'VARIABLE_DECLARATION'], // Создаёт __local версии
|
|
83
83
|
edges: ['REPLACES', 'CALLS', 'USES']
|
|
@@ -184,7 +184,8 @@ export class IncrementalAnalysisPlugin extends Plugin {
|
|
|
184
184
|
);
|
|
185
185
|
} catch (error) {
|
|
186
186
|
logger.error('Incremental analysis failed', { error: error instanceof Error ? error.message : String(error) });
|
|
187
|
-
|
|
187
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
188
|
+
return createErrorResult(err);
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|
|
@@ -642,7 +643,6 @@ export class IncrementalAnalysisPlugin extends Plugin {
|
|
|
642
643
|
* This method was disabled as part of stableId removal (REG-140).
|
|
643
644
|
* The getNodesByStableId method never existed on GraphBackend.
|
|
644
645
|
*/
|
|
645
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
646
646
|
private async findCalleeAndCreateEdge(
|
|
647
647
|
_callerId: string,
|
|
648
648
|
_calleeStableId: string,
|
|
@@ -656,7 +656,6 @@ export class IncrementalAnalysisPlugin extends Plugin {
|
|
|
656
656
|
/**
|
|
657
657
|
* Анализировать методы класса
|
|
658
658
|
*/
|
|
659
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
660
659
|
private async analyzeClassMethods(
|
|
661
660
|
_classNode: VersionedNode,
|
|
662
661
|
_ast: unknown,
|