@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
|
@@ -8,14 +8,6 @@ import type { PluginContext, PluginMetadata, PluginResult } from '../Plugin.js';
|
|
|
8
8
|
import type { NodeRecord } from '@grafema/types';
|
|
9
9
|
import { ValidationError } from '../../errors/GrafemaError.js';
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* Edge structure
|
|
13
|
-
*/
|
|
14
|
-
interface EdgeRecord {
|
|
15
|
-
src: string;
|
|
16
|
-
dst: string;
|
|
17
|
-
[key: string]: unknown;
|
|
18
|
-
}
|
|
19
11
|
|
|
20
12
|
/**
|
|
21
13
|
* Unreachable node info for manifest
|
|
@@ -51,7 +43,7 @@ export class GraphConnectivityValidator extends Plugin {
|
|
|
51
43
|
return {
|
|
52
44
|
name: 'GraphConnectivityValidator',
|
|
53
45
|
phase: 'VALIDATION',
|
|
54
|
-
|
|
46
|
+
dependencies: [],
|
|
55
47
|
creates: {
|
|
56
48
|
nodes: [],
|
|
57
49
|
edges: []
|
|
@@ -102,7 +102,7 @@ export class SQLInjectionValidator extends Plugin {
|
|
|
102
102
|
return {
|
|
103
103
|
name: 'SQLInjectionValidator',
|
|
104
104
|
phase: 'VALIDATION',
|
|
105
|
-
|
|
105
|
+
dependencies: ['ValueDomainAnalyzer'],
|
|
106
106
|
creates: {
|
|
107
107
|
nodes: ['issue:security'],
|
|
108
108
|
edges: ['AFFECTS']
|
|
@@ -396,7 +396,8 @@ export class SQLInjectionValidator extends Plugin {
|
|
|
396
396
|
}
|
|
397
397
|
} catch (err) {
|
|
398
398
|
// Datalog query might fail if backend doesn't support it
|
|
399
|
-
|
|
399
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
400
|
+
logger.debug('Datalog check skipped', { error: message });
|
|
400
401
|
}
|
|
401
402
|
|
|
402
403
|
return issues;
|
|
@@ -47,12 +47,11 @@ export class TypeScriptDeadCodeValidator extends Plugin {
|
|
|
47
47
|
return {
|
|
48
48
|
name: 'TypeScriptDeadCodeValidator',
|
|
49
49
|
phase: 'VALIDATION',
|
|
50
|
-
|
|
50
|
+
dependencies: ['JSASTAnalyzer'],
|
|
51
51
|
creates: {
|
|
52
52
|
nodes: [],
|
|
53
53
|
edges: []
|
|
54
|
-
}
|
|
55
|
-
dependencies: ['JSASTAnalyzer'] // Requires TypeScript nodes to be created
|
|
54
|
+
}
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -114,8 +114,9 @@ export class GitPlugin extends VCSPlugin {
|
|
|
114
114
|
|
|
115
115
|
return files;
|
|
116
116
|
} catch (error) {
|
|
117
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
117
118
|
throw new FileAccessError(
|
|
118
|
-
`Failed to get changed files: ${
|
|
119
|
+
`Failed to get changed files: ${message}`,
|
|
119
120
|
'ERR_GIT_ACCESS_DENIED',
|
|
120
121
|
{ plugin: 'GitPlugin' },
|
|
121
122
|
'Check that git is installed and this is a valid git repository'
|
|
@@ -157,8 +158,9 @@ export class GitPlugin extends VCSPlugin {
|
|
|
157
158
|
// Парсим unified diff
|
|
158
159
|
return this._parseUnifiedDiff(filePath, stdout);
|
|
159
160
|
} catch (error) {
|
|
161
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
160
162
|
throw new FileAccessError(
|
|
161
|
-
`Failed to get diff for ${filePath}: ${
|
|
163
|
+
`Failed to get diff for ${filePath}: ${message}`,
|
|
162
164
|
'ERR_GIT_ACCESS_DENIED',
|
|
163
165
|
{ plugin: 'GitPlugin', filePath },
|
|
164
166
|
'Ensure the file is tracked by git and the working directory is accessible'
|
|
@@ -174,8 +176,9 @@ export class GitPlugin extends VCSPlugin {
|
|
|
174
176
|
const { stdout } = await this._exec('git rev-parse --abbrev-ref HEAD');
|
|
175
177
|
return stdout.trim();
|
|
176
178
|
} catch (error) {
|
|
179
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
177
180
|
throw new FileAccessError(
|
|
178
|
-
`Failed to get current branch: ${
|
|
181
|
+
`Failed to get current branch: ${message}`,
|
|
179
182
|
'ERR_GIT_ACCESS_DENIED',
|
|
180
183
|
{ plugin: 'GitPlugin' },
|
|
181
184
|
'Ensure this is a valid git repository with at least one commit'
|
|
@@ -191,8 +194,9 @@ export class GitPlugin extends VCSPlugin {
|
|
|
191
194
|
const { stdout } = await this._exec('git rev-parse HEAD');
|
|
192
195
|
return stdout.trim();
|
|
193
196
|
} catch (error) {
|
|
197
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
194
198
|
throw new FileAccessError(
|
|
195
|
-
`Failed to get last commit hash: ${
|
|
199
|
+
`Failed to get last commit hash: ${message}`,
|
|
196
200
|
'ERR_GIT_NOT_FOUND',
|
|
197
201
|
{ plugin: 'GitPlugin' },
|
|
198
202
|
'Ensure this is a valid git repository with at least one commit'
|
|
@@ -328,8 +332,9 @@ export class GitPlugin extends VCSPlugin {
|
|
|
328
332
|
const { stdout } = await this._exec('git ls-files');
|
|
329
333
|
return stdout.trim().split('\n').filter(line => line.length > 0);
|
|
330
334
|
} catch (error) {
|
|
335
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
331
336
|
throw new FileAccessError(
|
|
332
|
-
`Failed to get tracked files: ${
|
|
337
|
+
`Failed to get tracked files: ${message}`,
|
|
333
338
|
'ERR_GIT_ACCESS_DENIED',
|
|
334
339
|
{ plugin: 'GitPlugin' },
|
|
335
340
|
'Check that git is installed and this is a valid git repository'
|
|
@@ -353,8 +358,9 @@ export class GitPlugin extends VCSPlugin {
|
|
|
353
358
|
message: lines[4]
|
|
354
359
|
};
|
|
355
360
|
} catch (error) {
|
|
361
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
356
362
|
throw new FileAccessError(
|
|
357
|
-
`Failed to get last commit info: ${
|
|
363
|
+
`Failed to get last commit info: ${message}`,
|
|
358
364
|
'ERR_GIT_NOT_FOUND',
|
|
359
365
|
{ plugin: 'GitPlugin' },
|
|
360
366
|
'Ensure this is a valid git repository with at least one commit'
|
|
@@ -30,7 +30,7 @@ interface GraphBackend {
|
|
|
30
30
|
getNode(id: string): Promise<{
|
|
31
31
|
id: string;
|
|
32
32
|
type: string;
|
|
33
|
-
name
|
|
33
|
+
name?: string;
|
|
34
34
|
file?: string;
|
|
35
35
|
line?: number;
|
|
36
36
|
object?: string;
|
|
@@ -126,7 +126,7 @@ export async function findCallsInFunction(
|
|
|
126
126
|
*/
|
|
127
127
|
async function buildCallInfo(
|
|
128
128
|
backend: GraphBackend,
|
|
129
|
-
callNode: { id: string; type: string; name
|
|
129
|
+
callNode: { id: string; type: string; name?: string; file?: string; line?: number; object?: string },
|
|
130
130
|
depth: number
|
|
131
131
|
): Promise<CallInfo> {
|
|
132
132
|
// Check for CALLS edge (resolved target)
|
|
@@ -139,7 +139,7 @@ async function buildCallInfo(
|
|
|
139
139
|
if (targetNode) {
|
|
140
140
|
target = {
|
|
141
141
|
id: targetNode.id,
|
|
142
|
-
name: targetNode.name,
|
|
142
|
+
name: targetNode.name ?? '<anonymous>',
|
|
143
143
|
file: targetNode.file,
|
|
144
144
|
line: targetNode.line,
|
|
145
145
|
};
|
|
@@ -148,7 +148,7 @@ async function buildCallInfo(
|
|
|
148
148
|
|
|
149
149
|
return {
|
|
150
150
|
id: callNode.id,
|
|
151
|
-
name: callNode.name,
|
|
151
|
+
name: callNode.name ?? '<unknown>',
|
|
152
152
|
type: callNode.type as 'CALL' | 'METHOD_CALL',
|
|
153
153
|
object: callNode.object,
|
|
154
154
|
resolved: isResolved,
|
|
@@ -22,13 +22,17 @@ import { RFDBClient } from '@grafema/rfdb-client';
|
|
|
22
22
|
import { existsSync, unlinkSync } from 'fs';
|
|
23
23
|
import { spawn, type ChildProcess } from 'child_process';
|
|
24
24
|
import { join, dirname } from 'path';
|
|
25
|
+
import { fileURLToPath } from 'url';
|
|
26
|
+
import { createRequire } from 'module';
|
|
25
27
|
import { setTimeout as sleep } from 'timers/promises';
|
|
26
28
|
|
|
27
|
-
import type { WireNode, WireEdge } from '@grafema/types';
|
|
29
|
+
import type { WireNode, WireEdge, FieldDeclaration, AttrQuery as RFDBAttrQuery } from '@grafema/types';
|
|
28
30
|
import type { NodeType, EdgeType } from '@grafema/types';
|
|
29
31
|
import type { BaseNodeRecord, EdgeRecord } from '@grafema/types';
|
|
30
32
|
import type { AttrQuery, GraphStats, GraphExport } from '../../core/GraphBackend.js';
|
|
31
|
-
|
|
33
|
+
|
|
34
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
35
|
+
const __dirname = dirname(__filename);
|
|
32
36
|
|
|
33
37
|
/**
|
|
34
38
|
* Options for RFDBServerBackend
|
|
@@ -42,6 +46,11 @@ export interface RFDBServerBackendOptions {
|
|
|
42
46
|
* Default: true (for backwards compatibility)
|
|
43
47
|
*/
|
|
44
48
|
autoStart?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* If true, suppress all console output (for clean CLI progress).
|
|
51
|
+
* Default: false
|
|
52
|
+
*/
|
|
53
|
+
silent?: boolean;
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
/**
|
|
@@ -92,6 +101,7 @@ export class RFDBServerBackend {
|
|
|
92
101
|
readonly socketPath: string;
|
|
93
102
|
readonly dbPath: string | undefined;
|
|
94
103
|
private readonly autoStart: boolean;
|
|
104
|
+
private readonly silent: boolean;
|
|
95
105
|
private client: RFDBClient | null;
|
|
96
106
|
private serverProcess: ChildProcess | null;
|
|
97
107
|
connected: boolean; // Public for compatibility
|
|
@@ -102,6 +112,7 @@ export class RFDBServerBackend {
|
|
|
102
112
|
constructor(options: RFDBServerBackendOptions = {}) {
|
|
103
113
|
this.dbPath = options.dbPath;
|
|
104
114
|
this.autoStart = options.autoStart ?? true; // Default true for backwards compat
|
|
115
|
+
this.silent = options.silent ?? false;
|
|
105
116
|
// Default socket path: next to the database in .grafema folder
|
|
106
117
|
// This ensures each project has its own socket, avoiding conflicts
|
|
107
118
|
if (options.socketPath) {
|
|
@@ -117,6 +128,22 @@ export class RFDBServerBackend {
|
|
|
117
128
|
this.edgeTypes = new Set();
|
|
118
129
|
}
|
|
119
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Log message if not in silent mode.
|
|
133
|
+
*/
|
|
134
|
+
private log(message: string): void {
|
|
135
|
+
if (!this.silent) {
|
|
136
|
+
console.log(message);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Log error (always shown, even in silent mode).
|
|
142
|
+
*/
|
|
143
|
+
private logError(message: string, error?: unknown): void {
|
|
144
|
+
console.error(message, error ?? '');
|
|
145
|
+
}
|
|
146
|
+
|
|
120
147
|
/**
|
|
121
148
|
* Connect to RFDB server.
|
|
122
149
|
* If autoStart is true (default), starts the server if not running.
|
|
@@ -128,33 +155,42 @@ export class RFDBServerBackend {
|
|
|
128
155
|
// Try to connect first
|
|
129
156
|
this.client = new RFDBClient(this.socketPath);
|
|
130
157
|
|
|
158
|
+
// Attach error handler to prevent unhandled 'error' events
|
|
159
|
+
// This is important for stale sockets (socket file exists but server is dead)
|
|
160
|
+
this.client.on('error', (err: Error) => {
|
|
161
|
+
this.logError('[RFDBServerBackend] Client error:', err.message);
|
|
162
|
+
});
|
|
163
|
+
|
|
131
164
|
try {
|
|
132
165
|
await this.client.connect();
|
|
133
166
|
// Verify server is responsive
|
|
134
167
|
await this.client.ping();
|
|
135
168
|
this.connected = true;
|
|
136
|
-
|
|
169
|
+
this.log(`[RFDBServerBackend] Connected to RFDB server at ${this.socketPath}`);
|
|
137
170
|
return;
|
|
138
171
|
} catch {
|
|
139
|
-
// Server not running
|
|
172
|
+
// Server not running or stale socket
|
|
140
173
|
if (!this.autoStart) {
|
|
141
174
|
throw new Error(
|
|
142
175
|
`RFDB server not running at ${this.socketPath}\n` +
|
|
143
176
|
`Start the server first: grafema server start`
|
|
144
177
|
);
|
|
145
178
|
}
|
|
146
|
-
|
|
179
|
+
this.log(`[RFDBServerBackend] RFDB server not running, starting...`);
|
|
147
180
|
}
|
|
148
181
|
|
|
149
182
|
// Start the server (only if autoStart is true)
|
|
150
183
|
await this._startServer();
|
|
151
184
|
|
|
152
|
-
// Connect again
|
|
185
|
+
// Connect again with fresh client
|
|
153
186
|
this.client = new RFDBClient(this.socketPath);
|
|
187
|
+
this.client.on('error', (err: Error) => {
|
|
188
|
+
this.logError('[RFDBServerBackend] Client error:', err.message);
|
|
189
|
+
});
|
|
154
190
|
await this.client.connect();
|
|
155
191
|
await this.client.ping();
|
|
156
192
|
this.connected = true;
|
|
157
|
-
|
|
193
|
+
this.log(`[RFDBServerBackend] Connected to RFDB server at ${this.socketPath}`);
|
|
158
194
|
}
|
|
159
195
|
|
|
160
196
|
/**
|
|
@@ -165,14 +201,62 @@ export class RFDBServerBackend {
|
|
|
165
201
|
}
|
|
166
202
|
|
|
167
203
|
/**
|
|
168
|
-
* Find RFDB server binary
|
|
204
|
+
* Find RFDB server binary in order of preference:
|
|
205
|
+
* 1. packages/rfdb-server/target/release (monorepo development - prioritized for dev)
|
|
206
|
+
* 2. packages/rfdb-server/target/debug
|
|
207
|
+
* 3. @grafema/rfdb npm package
|
|
208
|
+
* 4. ~/.local/bin/rfdb-server (user-installed binary)
|
|
169
209
|
*/
|
|
170
210
|
private _findServerBinary(): string | null {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
211
|
+
// 1. Check packages/rfdb-server in monorepo (prioritized for development)
|
|
212
|
+
const projectRoot = join(__dirname, '../../../../..');
|
|
213
|
+
const releaseBinary = join(projectRoot, 'packages/rfdb-server/target/release/rfdb-server');
|
|
214
|
+
if (existsSync(releaseBinary)) {
|
|
215
|
+
this.log(`[RFDBServerBackend] Found release binary: ${releaseBinary}`);
|
|
216
|
+
return releaseBinary;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// 2. Check debug build
|
|
220
|
+
const debugBinary = join(projectRoot, 'packages/rfdb-server/target/debug/rfdb-server');
|
|
221
|
+
if (existsSync(debugBinary)) {
|
|
222
|
+
this.log(`[RFDBServerBackend] Found debug binary: ${debugBinary}`);
|
|
223
|
+
return debugBinary;
|
|
174
224
|
}
|
|
175
|
-
|
|
225
|
+
|
|
226
|
+
// 3. Check @grafema/rfdb npm package
|
|
227
|
+
try {
|
|
228
|
+
const require = createRequire(import.meta.url);
|
|
229
|
+
const rfdbPkg = require.resolve('@grafema/rfdb');
|
|
230
|
+
const rfdbDir = dirname(rfdbPkg);
|
|
231
|
+
const platform = process.platform;
|
|
232
|
+
const arch = process.arch;
|
|
233
|
+
|
|
234
|
+
let platformDir: string;
|
|
235
|
+
if (platform === 'darwin') {
|
|
236
|
+
platformDir = arch === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
|
|
237
|
+
} else if (platform === 'linux') {
|
|
238
|
+
platformDir = arch === 'arm64' ? 'linux-arm64' : 'linux-x64';
|
|
239
|
+
} else {
|
|
240
|
+
platformDir = `${platform}-${arch}`;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const npmBinary = join(rfdbDir, 'prebuilt', platformDir, 'rfdb-server');
|
|
244
|
+
if (existsSync(npmBinary)) {
|
|
245
|
+
this.log(`[RFDBServerBackend] Found binary in @grafema/rfdb: ${npmBinary}`);
|
|
246
|
+
return npmBinary;
|
|
247
|
+
}
|
|
248
|
+
} catch {
|
|
249
|
+
// @grafema/rfdb not installed
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// 4. Check ~/.local/bin (user-installed binary for unsupported platforms)
|
|
253
|
+
const homeBinary = join(process.env.HOME || '', '.local', 'bin', 'rfdb-server');
|
|
254
|
+
if (existsSync(homeBinary)) {
|
|
255
|
+
this.log(`[RFDBServerBackend] Found user binary: ${homeBinary}`);
|
|
256
|
+
return homeBinary;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return null;
|
|
176
260
|
}
|
|
177
261
|
|
|
178
262
|
/**
|
|
@@ -186,7 +270,11 @@ export class RFDBServerBackend {
|
|
|
186
270
|
// Find server binary - check multiple locations
|
|
187
271
|
const binaryPath = this._findServerBinary();
|
|
188
272
|
if (!binaryPath) {
|
|
189
|
-
throw new Error(
|
|
273
|
+
throw new Error(
|
|
274
|
+
'RFDB server binary not found.\n' +
|
|
275
|
+
'Install @grafema/rfdb: npm install @grafema/rfdb\n' +
|
|
276
|
+
'Or build from source: cargo build --release --bin rfdb-server'
|
|
277
|
+
);
|
|
190
278
|
}
|
|
191
279
|
|
|
192
280
|
// Remove stale socket
|
|
@@ -194,25 +282,18 @@ export class RFDBServerBackend {
|
|
|
194
282
|
unlinkSync(this.socketPath);
|
|
195
283
|
}
|
|
196
284
|
|
|
197
|
-
|
|
285
|
+
this.log(`[RFDBServerBackend] Starting: ${binaryPath} ${this.dbPath} --socket ${this.socketPath}`);
|
|
198
286
|
|
|
199
287
|
this.serverProcess = spawn(binaryPath, [this.dbPath, '--socket', this.socketPath], {
|
|
200
|
-
stdio: ['ignore', '
|
|
288
|
+
stdio: ['ignore', 'ignore', 'inherit'], // stdin/stdout ignored, stderr inherited
|
|
201
289
|
detached: true, // Allow server to outlive this process
|
|
202
290
|
});
|
|
203
291
|
|
|
204
292
|
// Don't let server process prevent parent from exiting
|
|
205
293
|
this.serverProcess.unref();
|
|
206
294
|
|
|
207
|
-
this.serverProcess.stderr?.on('data', (data: Buffer) => {
|
|
208
|
-
const msg = data.toString().trim();
|
|
209
|
-
if (!msg.includes('FLUSH') && !msg.includes('WRITER')) {
|
|
210
|
-
console.log(`[rfdb-server] ${msg}`);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
|
|
214
295
|
this.serverProcess.on('error', (err: Error) => {
|
|
215
|
-
|
|
296
|
+
this.logError(`[RFDBServerBackend] Server process error:`, err);
|
|
216
297
|
});
|
|
217
298
|
|
|
218
299
|
// Wait for socket to appear
|
|
@@ -226,7 +307,7 @@ export class RFDBServerBackend {
|
|
|
226
307
|
throw new Error(`RFDB server failed to start (socket not created after ${attempts * 100}ms)`);
|
|
227
308
|
}
|
|
228
309
|
|
|
229
|
-
|
|
310
|
+
this.log(`[RFDBServerBackend] Server started on ${this.socketPath}`);
|
|
230
311
|
}
|
|
231
312
|
|
|
232
313
|
/**
|
|
@@ -268,6 +349,15 @@ export class RFDBServerBackend {
|
|
|
268
349
|
await this.client.flush();
|
|
269
350
|
}
|
|
270
351
|
|
|
352
|
+
/**
|
|
353
|
+
* Declare metadata fields for server-side indexing.
|
|
354
|
+
* Persisted in metadata.json — survives database reopen.
|
|
355
|
+
*/
|
|
356
|
+
async declareFields(fields: FieldDeclaration[]): Promise<number> {
|
|
357
|
+
if (!this.client) throw new Error('Not connected');
|
|
358
|
+
return this.client.declareFields(fields);
|
|
359
|
+
}
|
|
360
|
+
|
|
271
361
|
// ===========================================================================
|
|
272
362
|
// Node Operations
|
|
273
363
|
// ===========================================================================
|
|
@@ -462,7 +552,7 @@ export class RFDBServerBackend {
|
|
|
462
552
|
}
|
|
463
553
|
|
|
464
554
|
// Otherwise use client's queryNodes
|
|
465
|
-
for await (const wireNode of this.client.queryNodes(serverQuery)) {
|
|
555
|
+
for await (const wireNode of this.client.queryNodes(serverQuery as unknown as RFDBAttrQuery)) {
|
|
466
556
|
yield this._parseNode(wireNode);
|
|
467
557
|
}
|
|
468
558
|
}
|
|
@@ -46,6 +46,8 @@ const KNOWN_EDGE_TYPES = new Set<string>([
|
|
|
46
46
|
'RETURNS', 'RECEIVES_ARGUMENT', 'READS_FROM', 'THROWS', 'REGISTERS_VIEW',
|
|
47
47
|
'GOVERNS', 'VIOLATES', 'HAS_PARAMETER', 'DERIVES_FROM',
|
|
48
48
|
'RESOLVES_TO', // Promise resolve() data flow
|
|
49
|
+
'YIELDS', // Generator yield data flow (REG-270)
|
|
50
|
+
'DELEGATES_TO', // Generator yield* delegation (REG-270)
|
|
49
51
|
]);
|
|
50
52
|
|
|
51
53
|
// Store initial edge types for reset
|