@grafema/core 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +76 -0
- package/dist/Orchestrator.d.ts +142 -0
- package/dist/Orchestrator.d.ts.map +1 -0
- package/dist/Orchestrator.js +481 -0
- package/dist/api/GraphAPI.d.ts +87 -0
- package/dist/api/GraphAPI.d.ts.map +1 -0
- package/dist/api/GraphAPI.js +210 -0
- package/dist/api/GuaranteeAPI.d.ts +147 -0
- package/dist/api/GuaranteeAPI.d.ts.map +1 -0
- package/dist/api/GuaranteeAPI.js +288 -0
- package/dist/core/ASTWorker.d.ts +133 -0
- package/dist/core/ASTWorker.d.ts.map +1 -0
- package/dist/core/ASTWorker.js +352 -0
- package/dist/core/ASTWorkerPool.d.ts +85 -0
- package/dist/core/ASTWorkerPool.d.ts.map +1 -0
- package/dist/core/ASTWorkerPool.js +207 -0
- package/dist/core/AnalysisQueue.d.ts +104 -0
- package/dist/core/AnalysisQueue.d.ts.map +1 -0
- package/dist/core/AnalysisQueue.js +299 -0
- package/dist/core/AnalysisWorker.d.ts +14 -0
- package/dist/core/AnalysisWorker.d.ts.map +1 -0
- package/dist/core/AnalysisWorker.js +307 -0
- package/dist/core/GraphBackend.d.ts +156 -0
- package/dist/core/GraphBackend.d.ts.map +1 -0
- package/dist/core/GraphBackend.js +85 -0
- package/dist/core/GuaranteeManager.d.ts +230 -0
- package/dist/core/GuaranteeManager.d.ts.map +1 -0
- package/dist/core/GuaranteeManager.js +352 -0
- package/dist/core/ManifestStore.d.ts +71 -0
- package/dist/core/ManifestStore.d.ts.map +1 -0
- package/dist/core/ManifestStore.js +146 -0
- package/dist/core/NodeFactory.d.ts +160 -0
- package/dist/core/NodeFactory.d.ts.map +1 -0
- package/dist/core/NodeFactory.js +137 -0
- package/dist/core/NodeId.d.ts +88 -0
- package/dist/core/NodeId.d.ts.map +1 -0
- package/dist/core/NodeId.js +170 -0
- package/dist/core/ParallelAnalyzer.d.ts +120 -0
- package/dist/core/ParallelAnalyzer.d.ts.map +1 -0
- package/dist/core/ParallelAnalyzer.js +331 -0
- package/dist/core/PriorityQueue.d.ts +106 -0
- package/dist/core/PriorityQueue.d.ts.map +1 -0
- package/dist/core/PriorityQueue.js +168 -0
- package/dist/core/Profiler.d.ts +75 -0
- package/dist/core/Profiler.d.ts.map +1 -0
- package/dist/core/Profiler.js +149 -0
- package/dist/core/QueueWorker.d.ts +12 -0
- package/dist/core/QueueWorker.d.ts.map +1 -0
- package/dist/core/QueueWorker.js +567 -0
- package/dist/core/RFDBClient.d.ts +179 -0
- package/dist/core/RFDBClient.d.ts.map +1 -0
- package/dist/core/RFDBClient.js +429 -0
- package/dist/core/Task.d.ts +56 -0
- package/dist/core/Task.d.ts.map +1 -0
- package/dist/core/Task.js +85 -0
- package/dist/core/TaskTypes.d.ts +20 -0
- package/dist/core/TaskTypes.d.ts.map +1 -0
- package/dist/core/TaskTypes.js +10 -0
- package/dist/core/VersionManager.d.ts +166 -0
- package/dist/core/VersionManager.d.ts.map +1 -0
- package/dist/core/VersionManager.js +237 -0
- package/dist/core/WorkerPool.d.ts +82 -0
- package/dist/core/WorkerPool.d.ts.map +1 -0
- package/dist/core/WorkerPool.js +109 -0
- package/dist/core/nodes/CallSiteNode.d.ts +26 -0
- package/dist/core/nodes/CallSiteNode.d.ts.map +1 -0
- package/dist/core/nodes/CallSiteNode.js +44 -0
- package/dist/core/nodes/ClassNode.d.ts +25 -0
- package/dist/core/nodes/ClassNode.d.ts.map +1 -0
- package/dist/core/nodes/ClassNode.js +40 -0
- package/dist/core/nodes/ConstantNode.d.ts +24 -0
- package/dist/core/nodes/ConstantNode.d.ts.map +1 -0
- package/dist/core/nodes/ConstantNode.js +39 -0
- package/dist/core/nodes/DatabaseQueryNode.d.ts +22 -0
- package/dist/core/nodes/DatabaseQueryNode.d.ts.map +1 -0
- package/dist/core/nodes/DatabaseQueryNode.js +37 -0
- package/dist/core/nodes/EntrypointNode.d.ts +102 -0
- package/dist/core/nodes/EntrypointNode.d.ts.map +1 -0
- package/dist/core/nodes/EntrypointNode.js +119 -0
- package/dist/core/nodes/EventListenerNode.d.ts +25 -0
- package/dist/core/nodes/EventListenerNode.d.ts.map +1 -0
- package/dist/core/nodes/EventListenerNode.js +39 -0
- package/dist/core/nodes/ExportNode.d.ts +26 -0
- package/dist/core/nodes/ExportNode.d.ts.map +1 -0
- package/dist/core/nodes/ExportNode.js +40 -0
- package/dist/core/nodes/ExternalStdioNode.d.ts +17 -0
- package/dist/core/nodes/ExternalStdioNode.d.ts.map +1 -0
- package/dist/core/nodes/ExternalStdioNode.js +26 -0
- package/dist/core/nodes/FunctionNode.d.ts +27 -0
- package/dist/core/nodes/FunctionNode.d.ts.map +1 -0
- package/dist/core/nodes/FunctionNode.js +53 -0
- package/dist/core/nodes/GuaranteeNode.d.ts +76 -0
- package/dist/core/nodes/GuaranteeNode.d.ts.map +1 -0
- package/dist/core/nodes/GuaranteeNode.js +117 -0
- package/dist/core/nodes/HttpRequestNode.d.ts +24 -0
- package/dist/core/nodes/HttpRequestNode.d.ts.map +1 -0
- package/dist/core/nodes/HttpRequestNode.js +38 -0
- package/dist/core/nodes/ImportNode.d.ts +27 -0
- package/dist/core/nodes/ImportNode.d.ts.map +1 -0
- package/dist/core/nodes/ImportNode.js +43 -0
- package/dist/core/nodes/LiteralNode.d.ts +26 -0
- package/dist/core/nodes/LiteralNode.d.ts.map +1 -0
- package/dist/core/nodes/LiteralNode.js +40 -0
- package/dist/core/nodes/MethodCallNode.d.ts +29 -0
- package/dist/core/nodes/MethodCallNode.d.ts.map +1 -0
- package/dist/core/nodes/MethodCallNode.js +47 -0
- package/dist/core/nodes/MethodNode.d.ts +29 -0
- package/dist/core/nodes/MethodNode.d.ts.map +1 -0
- package/dist/core/nodes/MethodNode.js +44 -0
- package/dist/core/nodes/ModuleNode.d.ts +29 -0
- package/dist/core/nodes/ModuleNode.d.ts.map +1 -0
- package/dist/core/nodes/ModuleNode.js +49 -0
- package/dist/core/nodes/NodeKind.d.ts +91 -0
- package/dist/core/nodes/NodeKind.d.ts.map +1 -0
- package/dist/core/nodes/NodeKind.js +146 -0
- package/dist/core/nodes/ParameterNode.d.ts +26 -0
- package/dist/core/nodes/ParameterNode.d.ts.map +1 -0
- package/dist/core/nodes/ParameterNode.js +43 -0
- package/dist/core/nodes/ScopeNode.d.ts +32 -0
- package/dist/core/nodes/ScopeNode.d.ts.map +1 -0
- package/dist/core/nodes/ScopeNode.js +47 -0
- package/dist/core/nodes/ServiceNode.d.ts +44 -0
- package/dist/core/nodes/ServiceNode.d.ts.map +1 -0
- package/dist/core/nodes/ServiceNode.js +49 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts +22 -0
- package/dist/core/nodes/VariableDeclarationNode.d.ts.map +1 -0
- package/dist/core/nodes/VariableDeclarationNode.js +38 -0
- package/dist/core/nodes/index.d.ts +25 -0
- package/dist/core/nodes/index.d.ts.map +1 -0
- package/dist/core/nodes/index.js +30 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +63 -0
- package/dist/plugins/Plugin.d.ts +44 -0
- package/dist/plugins/Plugin.d.ts.map +1 -0
- package/dist/plugins/Plugin.js +46 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts +23 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/DatabaseAnalyzer.js +260 -0
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts +19 -0
- package/dist/plugins/analysis/ExpressAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ExpressAnalyzer.js +306 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts +17 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ExpressRouteAnalyzer.js +308 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts +38 -0
- package/dist/plugins/analysis/FetchAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/FetchAnalyzer.js +344 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts +65 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.d.ts.map +1 -0
- package/dist/plugins/analysis/IncrementalAnalysisPlugin.js +472 -0
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts +84 -0
- package/dist/plugins/analysis/JSASTAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/JSASTAnalyzer.js +1378 -0
- package/dist/plugins/analysis/ReactAnalyzer.d.ts +90 -0
- package/dist/plugins/analysis/ReactAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ReactAnalyzer.js +1153 -0
- package/dist/plugins/analysis/RustAnalyzer.d.ts +13 -0
- package/dist/plugins/analysis/RustAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/RustAnalyzer.js +259 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts +21 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SQLiteAnalyzer.js +317 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts +35 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/ServiceLayerAnalyzer.js +303 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts +33 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SocketIOAnalyzer.js +283 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts +27 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.d.ts.map +1 -0
- package/dist/plugins/analysis/SystemDbAnalyzer.js +211 -0
- package/dist/plugins/analysis/ast/ConditionParser.d.ts +85 -0
- package/dist/plugins/analysis/ast/ConditionParser.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/ConditionParser.js +277 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts +15 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/ExpressionEvaluator.js +91 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts +77 -0
- package/dist/plugins/analysis/ast/GraphBuilder.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/GraphBuilder.js +1077 -0
- package/dist/plugins/analysis/ast/OxcAdapter.d.ts +41 -0
- package/dist/plugins/analysis/ast/OxcAdapter.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/OxcAdapter.js +40 -0
- package/dist/plugins/analysis/ast/types.d.ts +346 -0
- package/dist/plugins/analysis/ast/types.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/types.js +4 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts +93 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ASTVisitor.js +24 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts +77 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/CallExpressionVisitor.js +377 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts +27 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ClassVisitor.js +232 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts +25 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/FunctionVisitor.js +172 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts +29 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/ImportExportVisitor.js +180 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts +14 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/TypeScriptVisitor.js +200 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts +45 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/VariableVisitor.js +150 -0
- package/dist/plugins/analysis/ast/visitors/index.d.ts +17 -0
- package/dist/plugins/analysis/ast/visitors/index.d.ts.map +1 -0
- package/dist/plugins/analysis/ast/visitors/index.js +13 -0
- package/dist/plugins/discovery/DiscoveryPlugin.d.ts +34 -0
- package/dist/plugins/discovery/DiscoveryPlugin.d.ts.map +1 -0
- package/dist/plugins/discovery/DiscoveryPlugin.js +26 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts +26 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/MonorepoServiceDiscovery.js +79 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts +14 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/SimpleProjectDiscovery.js +65 -0
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts +19 -0
- package/dist/plugins/discovery/ZonServiceDiscovery.d.ts.map +1 -0
- package/dist/plugins/discovery/ZonServiceDiscovery.js +204 -0
- package/dist/plugins/enrichment/AliasTracker.d.ts +40 -0
- package/dist/plugins/enrichment/AliasTracker.d.ts.map +1 -0
- package/dist/plugins/enrichment/AliasTracker.js +290 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts +30 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/HTTPConnectionEnricher.js +135 -0
- package/dist/plugins/enrichment/ImportExportLinker.d.ts +30 -0
- package/dist/plugins/enrichment/ImportExportLinker.d.ts.map +1 -0
- package/dist/plugins/enrichment/ImportExportLinker.js +176 -0
- package/dist/plugins/enrichment/InstanceOfResolver.d.ts +21 -0
- package/dist/plugins/enrichment/InstanceOfResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/InstanceOfResolver.js +117 -0
- package/dist/plugins/enrichment/MethodCallResolver.d.ts +41 -0
- package/dist/plugins/enrichment/MethodCallResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/MethodCallResolver.js +252 -0
- package/dist/plugins/enrichment/MountPointResolver.d.ts +26 -0
- package/dist/plugins/enrichment/MountPointResolver.d.ts.map +1 -0
- package/dist/plugins/enrichment/MountPointResolver.js +189 -0
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts +89 -0
- package/dist/plugins/enrichment/PrefixEvaluator.d.ts.map +1 -0
- package/dist/plugins/enrichment/PrefixEvaluator.js +415 -0
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts +25 -0
- package/dist/plugins/enrichment/RustFFIEnricher.d.ts.map +1 -0
- package/dist/plugins/enrichment/RustFFIEnricher.js +170 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts +114 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.d.ts.map +1 -0
- package/dist/plugins/enrichment/ValueDomainAnalyzer.js +464 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts +27 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.d.ts.map +1 -0
- package/dist/plugins/indexing/IncrementalModuleIndexer.js +238 -0
- package/dist/plugins/indexing/JSModuleIndexer.d.ts +33 -0
- package/dist/plugins/indexing/JSModuleIndexer.d.ts.map +1 -0
- package/dist/plugins/indexing/JSModuleIndexer.js +299 -0
- package/dist/plugins/indexing/RustModuleIndexer.d.ts +28 -0
- package/dist/plugins/indexing/RustModuleIndexer.d.ts.map +1 -0
- package/dist/plugins/indexing/RustModuleIndexer.js +140 -0
- package/dist/plugins/indexing/ServiceDetector.d.ts +46 -0
- package/dist/plugins/indexing/ServiceDetector.d.ts.map +1 -0
- package/dist/plugins/indexing/ServiceDetector.js +164 -0
- package/dist/plugins/validation/CallResolverValidator.d.ts +23 -0
- package/dist/plugins/validation/CallResolverValidator.d.ts.map +1 -0
- package/dist/plugins/validation/CallResolverValidator.js +108 -0
- package/dist/plugins/validation/DataFlowValidator.d.ts +24 -0
- package/dist/plugins/validation/DataFlowValidator.d.ts.map +1 -0
- package/dist/plugins/validation/DataFlowValidator.js +148 -0
- package/dist/plugins/validation/EvalBanValidator.d.ts +25 -0
- package/dist/plugins/validation/EvalBanValidator.d.ts.map +1 -0
- package/dist/plugins/validation/EvalBanValidator.js +123 -0
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts +11 -0
- package/dist/plugins/validation/GraphConnectivityValidator.d.ts.map +1 -0
- package/dist/plugins/validation/GraphConnectivityValidator.js +135 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts +43 -0
- package/dist/plugins/validation/SQLInjectionValidator.d.ts.map +1 -0
- package/dist/plugins/validation/SQLInjectionValidator.js +251 -0
- package/dist/plugins/validation/ShadowingDetector.d.ts +26 -0
- package/dist/plugins/validation/ShadowingDetector.d.ts.map +1 -0
- package/dist/plugins/validation/ShadowingDetector.js +119 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts +21 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.d.ts.map +1 -0
- package/dist/plugins/validation/TypeScriptDeadCodeValidator.js +151 -0
- package/dist/plugins/vcs/GitPlugin.d.ts +84 -0
- package/dist/plugins/vcs/GitPlugin.d.ts.map +1 -0
- package/dist/plugins/vcs/GitPlugin.js +295 -0
- package/dist/plugins/vcs/VCSPlugin.d.ts +133 -0
- package/dist/plugins/vcs/VCSPlugin.d.ts.map +1 -0
- package/dist/plugins/vcs/VCSPlugin.js +82 -0
- package/dist/plugins/vcs/index.d.ts +10 -0
- package/dist/plugins/vcs/index.d.ts.map +1 -0
- package/dist/plugins/vcs/index.js +18 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts +258 -0
- package/dist/storage/backends/RFDBServerBackend.d.ts.map +1 -0
- package/dist/storage/backends/RFDBServerBackend.js +565 -0
- package/dist/storage/backends/typeValidation.d.ts +47 -0
- package/dist/storage/backends/typeValidation.d.ts.map +1 -0
- package/dist/storage/backends/typeValidation.js +137 -0
- package/dist/validation/PathValidator.d.ts +81 -0
- package/dist/validation/PathValidator.d.ts.map +1 -0
- package/dist/validation/PathValidator.js +251 -0
- package/package.json +57 -0
- package/src/.rfguard/current-session.txt +1 -0
- package/src/Orchestrator.ts +673 -0
- package/src/api/GraphAPI.ts +305 -0
- package/src/api/GuaranteeAPI.ts +401 -0
- package/src/core/ASTWorker.ts +567 -0
- package/src/core/ASTWorkerPool.ts +299 -0
- package/src/core/AnalysisQueue.ts +447 -0
- package/src/core/AnalysisWorker.ts +410 -0
- package/src/core/GraphBackend.ts +265 -0
- package/src/core/GuaranteeManager.ts +581 -0
- package/src/core/ManifestStore.ts +196 -0
- package/src/core/NodeFactory.ts +274 -0
- package/src/core/NodeId.ts +257 -0
- package/src/core/ParallelAnalyzer.ts +476 -0
- package/src/core/PriorityQueue.ts +227 -0
- package/src/core/Profiler.ts +188 -0
- package/src/core/QueueWorker.ts +780 -0
- package/src/core/Task.ts +107 -0
- package/src/core/TaskTypes.ts +40 -0
- package/src/core/VersionManager.ts +404 -0
- package/src/core/WorkerPool.ts +180 -0
- package/src/core/nodes/CallSiteNode.ts +72 -0
- package/src/core/nodes/ClassNode.ts +69 -0
- package/src/core/nodes/ConstantNode.ts +63 -0
- package/src/core/nodes/DatabaseQueryNode.ts +60 -0
- package/src/core/nodes/EntrypointNode.ts +164 -0
- package/src/core/nodes/EventListenerNode.ts +64 -0
- package/src/core/nodes/ExportNode.ts +71 -0
- package/src/core/nodes/ExternalStdioNode.ts +36 -0
- package/src/core/nodes/FunctionNode.ts +78 -0
- package/src/core/nodes/GuaranteeNode.ts +162 -0
- package/src/core/nodes/HttpRequestNode.ts +63 -0
- package/src/core/nodes/ImportNode.ts +75 -0
- package/src/core/nodes/LiteralNode.ts +67 -0
- package/src/core/nodes/MethodCallNode.ts +79 -0
- package/src/core/nodes/MethodNode.ts +78 -0
- package/src/core/nodes/ModuleNode.ts +74 -0
- package/src/core/nodes/NodeKind.ts +171 -0
- package/src/core/nodes/ParameterNode.ts +73 -0
- package/src/core/nodes/ScopeNode.ts +80 -0
- package/src/core/nodes/ServiceNode.ts +86 -0
- package/src/core/nodes/VariableDeclarationNode.ts +60 -0
- package/src/core/nodes/index.ts +49 -0
- package/src/index.ts +93 -0
- package/src/plugins/Plugin.ts +74 -0
- package/src/plugins/analysis/DatabaseAnalyzer.ts +322 -0
- package/src/plugins/analysis/ExpressAnalyzer.ts +401 -0
- package/src/plugins/analysis/ExpressRouteAnalyzer.ts +414 -0
- package/src/plugins/analysis/FetchAnalyzer.ts +441 -0
- package/src/plugins/analysis/IncrementalAnalysisPlugin.ts +686 -0
- package/src/plugins/analysis/JSASTAnalyzer.ts +1680 -0
- package/src/plugins/analysis/ReactAnalyzer.ts +1368 -0
- package/src/plugins/analysis/RustAnalyzer.ts +438 -0
- package/src/plugins/analysis/SQLiteAnalyzer.ts +388 -0
- package/src/plugins/analysis/ServiceLayerAnalyzer.ts +429 -0
- package/src/plugins/analysis/SocketIOAnalyzer.ts +395 -0
- package/src/plugins/analysis/SystemDbAnalyzer.ts +284 -0
- package/src/plugins/analysis/ast/ConditionParser.ts +333 -0
- package/src/plugins/analysis/ast/ExpressionEvaluator.ts +117 -0
- package/src/plugins/analysis/ast/GraphBuilder.ts +1371 -0
- package/src/plugins/analysis/ast/OxcAdapter.ts +63 -0
- package/src/plugins/analysis/ast/types.ts +400 -0
- package/src/plugins/analysis/ast/visitors/ASTVisitor.ts +137 -0
- package/src/plugins/analysis/ast/visitors/CallExpressionVisitor.ts +528 -0
- package/src/plugins/analysis/ast/visitors/ClassVisitor.ts +339 -0
- package/src/plugins/analysis/ast/visitors/FunctionVisitor.ts +273 -0
- package/src/plugins/analysis/ast/visitors/ImportExportVisitor.ts +259 -0
- package/src/plugins/analysis/ast/visitors/TypeScriptVisitor.ts +235 -0
- package/src/plugins/analysis/ast/visitors/VariableVisitor.ts +268 -0
- package/src/plugins/analysis/ast/visitors/index.ts +36 -0
- package/src/plugins/discovery/DiscoveryPlugin.ts +50 -0
- package/src/plugins/discovery/MonorepoServiceDiscovery.ts +117 -0
- package/src/plugins/discovery/SimpleProjectDiscovery.ts +102 -0
- package/src/plugins/enrichment/AliasTracker.ts +399 -0
- package/src/plugins/enrichment/HTTPConnectionEnricher.ts +192 -0
- package/src/plugins/enrichment/ImportExportLinker.ts +221 -0
- package/src/plugins/enrichment/InstanceOfResolver.ts +165 -0
- package/src/plugins/enrichment/MethodCallResolver.ts +333 -0
- package/src/plugins/enrichment/MountPointResolver.ts +264 -0
- package/src/plugins/enrichment/PrefixEvaluator.ts +527 -0
- package/src/plugins/enrichment/RustFFIEnricher.ts +218 -0
- package/src/plugins/enrichment/ValueDomainAnalyzer.ts +682 -0
- package/src/plugins/indexing/IncrementalModuleIndexer.ts +287 -0
- package/src/plugins/indexing/JSModuleIndexer.ts +374 -0
- package/src/plugins/indexing/RustModuleIndexer.ts +160 -0
- package/src/plugins/indexing/ServiceDetector.ts +230 -0
- package/src/plugins/validation/CallResolverValidator.ts +170 -0
- package/src/plugins/validation/DataFlowValidator.ts +233 -0
- package/src/plugins/validation/EvalBanValidator.ts +175 -0
- package/src/plugins/validation/GraphConnectivityValidator.ts +201 -0
- package/src/plugins/validation/SQLInjectionValidator.ts +363 -0
- package/src/plugins/validation/ShadowingDetector.ts +173 -0
- package/src/plugins/validation/TypeScriptDeadCodeValidator.ts +203 -0
- package/src/plugins/vcs/GitPlugin.ts +344 -0
- package/src/plugins/vcs/VCSPlugin.ts +190 -0
- package/src/plugins/vcs/index.ts +32 -0
- package/src/storage/backends/RFDBServerBackend.ts +687 -0
- package/src/storage/backends/typeValidation.ts +151 -0
- package/src/validation/PathValidator.ts +342 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EventListenerNode - contract for EVENT_LISTENER node
|
|
3
|
+
*/
|
|
4
|
+
export class EventListenerNode {
|
|
5
|
+
static TYPE = 'EVENT_LISTENER';
|
|
6
|
+
static REQUIRED = ['name', 'file', 'line'];
|
|
7
|
+
static OPTIONAL = ['object', 'column', 'parentScopeId', 'callbackArg'];
|
|
8
|
+
static create(eventName, objectName, file, line, options = {}) {
|
|
9
|
+
if (!eventName)
|
|
10
|
+
throw new Error('EventListenerNode.create: eventName is required');
|
|
11
|
+
if (!file)
|
|
12
|
+
throw new Error('EventListenerNode.create: file is required');
|
|
13
|
+
if (line === undefined)
|
|
14
|
+
throw new Error('EventListenerNode.create: line is required');
|
|
15
|
+
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
16
|
+
const id = `${file}:EVENT_LISTENER:${eventName}:${line}:${options.column || 0}${counter}`;
|
|
17
|
+
return {
|
|
18
|
+
id,
|
|
19
|
+
type: this.TYPE,
|
|
20
|
+
name: eventName,
|
|
21
|
+
object: objectName,
|
|
22
|
+
file,
|
|
23
|
+
line,
|
|
24
|
+
parentScopeId: options.parentScopeId,
|
|
25
|
+
callbackArg: options.callbackArg
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static validate(node) {
|
|
29
|
+
const errors = [];
|
|
30
|
+
if (node.type !== this.TYPE)
|
|
31
|
+
errors.push(`Expected type ${this.TYPE}`);
|
|
32
|
+
const nodeRecord = node;
|
|
33
|
+
for (const field of this.REQUIRED) {
|
|
34
|
+
if (nodeRecord[field] === undefined)
|
|
35
|
+
errors.push(`Missing: ${field}`);
|
|
36
|
+
}
|
|
37
|
+
return errors;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExportNode - contract for EXPORT node
|
|
3
|
+
*/
|
|
4
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
5
|
+
type ExportKind = 'value' | 'type';
|
|
6
|
+
interface ExportNodeRecord extends BaseNodeRecord {
|
|
7
|
+
type: 'EXPORT';
|
|
8
|
+
column: number;
|
|
9
|
+
exportKind: ExportKind;
|
|
10
|
+
local: string;
|
|
11
|
+
default: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface ExportNodeOptions {
|
|
14
|
+
exportKind?: ExportKind;
|
|
15
|
+
local?: string;
|
|
16
|
+
default?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare class ExportNode {
|
|
19
|
+
static readonly TYPE: "EXPORT";
|
|
20
|
+
static readonly REQUIRED: readonly ["name", "file", "line"];
|
|
21
|
+
static readonly OPTIONAL: readonly ["column", "exportKind", "local", "default"];
|
|
22
|
+
static create(name: string, file: string, line: number, column: number, options?: ExportNodeOptions): ExportNodeRecord;
|
|
23
|
+
static validate(node: ExportNodeRecord): string[];
|
|
24
|
+
}
|
|
25
|
+
export type { ExportNodeRecord, ExportKind };
|
|
26
|
+
//# sourceMappingURL=ExportNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/ExportNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,KAAK,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnC,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,iBAAiB;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAEzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,wDAAyD;IAEjF,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB;IAkBnB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,EAAE;CAgBlD;AAED,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExportNode - contract for EXPORT node
|
|
3
|
+
*/
|
|
4
|
+
export class ExportNode {
|
|
5
|
+
static TYPE = 'EXPORT';
|
|
6
|
+
static REQUIRED = ['name', 'file', 'line'];
|
|
7
|
+
static OPTIONAL = ['column', 'exportKind', 'local', 'default'];
|
|
8
|
+
static create(name, file, line, column, options = {}) {
|
|
9
|
+
if (!name)
|
|
10
|
+
throw new Error('ExportNode.create: name is required');
|
|
11
|
+
if (!file)
|
|
12
|
+
throw new Error('ExportNode.create: file is required');
|
|
13
|
+
if (!line)
|
|
14
|
+
throw new Error('ExportNode.create: line is required');
|
|
15
|
+
return {
|
|
16
|
+
id: `${file}:EXPORT:${name}:${line}`,
|
|
17
|
+
type: this.TYPE,
|
|
18
|
+
name,
|
|
19
|
+
file,
|
|
20
|
+
line,
|
|
21
|
+
column: column || 0,
|
|
22
|
+
exportKind: options.exportKind || 'value',
|
|
23
|
+
local: options.local || name,
|
|
24
|
+
default: options.default || false
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static validate(node) {
|
|
28
|
+
const errors = [];
|
|
29
|
+
if (node.type !== this.TYPE) {
|
|
30
|
+
errors.push(`Expected type ${this.TYPE}, got ${node.type}`);
|
|
31
|
+
}
|
|
32
|
+
const nodeRecord = node;
|
|
33
|
+
for (const field of this.REQUIRED) {
|
|
34
|
+
if (!nodeRecord[field]) {
|
|
35
|
+
errors.push(`Missing required field: ${field}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return errors;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExternalStdioNode - contract for EXTERNAL_STDIO node (singleton)
|
|
3
|
+
*/
|
|
4
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
5
|
+
interface ExternalStdioNodeRecord extends BaseNodeRecord {
|
|
6
|
+
type: 'EXTERNAL_STDIO';
|
|
7
|
+
}
|
|
8
|
+
export declare class ExternalStdioNode {
|
|
9
|
+
static readonly TYPE: "EXTERNAL_STDIO";
|
|
10
|
+
static readonly SINGLETON_ID = "EXTERNAL_STDIO:__stdio__";
|
|
11
|
+
static readonly REQUIRED: readonly ["name", "file"];
|
|
12
|
+
static readonly OPTIONAL: readonly [];
|
|
13
|
+
static create(): ExternalStdioNodeRecord;
|
|
14
|
+
static validate(node: ExternalStdioNodeRecord): string[];
|
|
15
|
+
}
|
|
16
|
+
export type { ExternalStdioNodeRecord };
|
|
17
|
+
//# sourceMappingURL=ExternalStdioNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExternalStdioNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/ExternalStdioNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,uBAAwB,SAAQ,cAAc;IACtD,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,gBAAgB,CAAU;IACjD,MAAM,CAAC,QAAQ,CAAC,YAAY,8BAA8B;IAE1D,MAAM,CAAC,QAAQ,CAAC,QAAQ,4BAA6B;IACrD,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAe;IAEvC,MAAM,CAAC,MAAM,IAAI,uBAAuB;IAUxC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,uBAAuB,GAAG,MAAM,EAAE;CAMzD;AAED,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExternalStdioNode - contract for EXTERNAL_STDIO node (singleton)
|
|
3
|
+
*/
|
|
4
|
+
export class ExternalStdioNode {
|
|
5
|
+
static TYPE = 'EXTERNAL_STDIO';
|
|
6
|
+
static SINGLETON_ID = 'EXTERNAL_STDIO:__stdio__';
|
|
7
|
+
static REQUIRED = ['name', 'file'];
|
|
8
|
+
static OPTIONAL = [];
|
|
9
|
+
static create() {
|
|
10
|
+
return {
|
|
11
|
+
id: this.SINGLETON_ID,
|
|
12
|
+
type: this.TYPE,
|
|
13
|
+
name: '__stdio__',
|
|
14
|
+
file: '__builtin__',
|
|
15
|
+
line: 0
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
static validate(node) {
|
|
19
|
+
const errors = [];
|
|
20
|
+
if (node.type !== this.TYPE)
|
|
21
|
+
errors.push(`Expected type ${this.TYPE}`);
|
|
22
|
+
if (node.id !== this.SINGLETON_ID)
|
|
23
|
+
errors.push(`Invalid singleton ID`);
|
|
24
|
+
return errors;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FunctionNode - contract for FUNCTION node
|
|
3
|
+
*/
|
|
4
|
+
import type { FunctionNodeRecord } from '@grafema/types';
|
|
5
|
+
interface FunctionNodeOptions {
|
|
6
|
+
async?: boolean;
|
|
7
|
+
generator?: boolean;
|
|
8
|
+
exported?: boolean;
|
|
9
|
+
arrowFunction?: boolean;
|
|
10
|
+
parentScopeId?: string;
|
|
11
|
+
isClassMethod?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
params?: string[];
|
|
14
|
+
counter?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class FunctionNode {
|
|
17
|
+
static readonly TYPE: "FUNCTION";
|
|
18
|
+
static readonly REQUIRED: readonly ["name", "file", "line", "column"];
|
|
19
|
+
static readonly OPTIONAL: readonly ["async", "generator", "exported", "arrowFunction", "parentScopeId", "isClassMethod", "className", "params"];
|
|
20
|
+
/**
|
|
21
|
+
* Create FUNCTION node
|
|
22
|
+
*/
|
|
23
|
+
static create(name: string, file: string, line: number, column: number, options?: FunctionNodeOptions): FunctionNodeRecord;
|
|
24
|
+
static validate(node: FunctionNodeRecord): string[];
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=FunctionNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FunctionNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/FunctionNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IAE3C,MAAM,CAAC,QAAQ,CAAC,QAAQ,8CAA+C;IACvE,MAAM,CAAC,QAAQ,CAAC,QAAQ,wHAAyH;IAEjJ;;OAEG;IACH,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,kBAAkB;IA4BrB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,EAAE;CAgBpD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FunctionNode - contract for FUNCTION node
|
|
3
|
+
*/
|
|
4
|
+
export class FunctionNode {
|
|
5
|
+
static TYPE = 'FUNCTION';
|
|
6
|
+
static REQUIRED = ['name', 'file', 'line', 'column'];
|
|
7
|
+
static OPTIONAL = ['async', 'generator', 'exported', 'arrowFunction', 'parentScopeId', 'isClassMethod', 'className', 'params'];
|
|
8
|
+
/**
|
|
9
|
+
* Create FUNCTION node
|
|
10
|
+
*/
|
|
11
|
+
static create(name, file, line, column, options = {}) {
|
|
12
|
+
if (!name)
|
|
13
|
+
throw new Error('FunctionNode.create: name is required');
|
|
14
|
+
if (!file)
|
|
15
|
+
throw new Error('FunctionNode.create: file is required');
|
|
16
|
+
if (line === undefined)
|
|
17
|
+
throw new Error('FunctionNode.create: line is required');
|
|
18
|
+
if (column === undefined)
|
|
19
|
+
throw new Error('FunctionNode.create: column is required');
|
|
20
|
+
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
21
|
+
const id = `${file}:FUNCTION:${name}:${line}:${column}${counter}`;
|
|
22
|
+
return {
|
|
23
|
+
id,
|
|
24
|
+
stableId: id,
|
|
25
|
+
type: this.TYPE,
|
|
26
|
+
name,
|
|
27
|
+
file,
|
|
28
|
+
line,
|
|
29
|
+
column,
|
|
30
|
+
async: options.async || false,
|
|
31
|
+
generator: options.generator || false,
|
|
32
|
+
exported: options.exported || false,
|
|
33
|
+
arrowFunction: options.arrowFunction || false,
|
|
34
|
+
parentScopeId: options.parentScopeId,
|
|
35
|
+
isClassMethod: options.isClassMethod || false,
|
|
36
|
+
className: options.className,
|
|
37
|
+
params: options.params || []
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
static validate(node) {
|
|
41
|
+
const errors = [];
|
|
42
|
+
if (node.type !== this.TYPE) {
|
|
43
|
+
errors.push(`Expected type ${this.TYPE}, got ${node.type}`);
|
|
44
|
+
}
|
|
45
|
+
const nodeRecord = node;
|
|
46
|
+
for (const field of this.REQUIRED) {
|
|
47
|
+
if (nodeRecord[field] === undefined || nodeRecord[field] === null) {
|
|
48
|
+
errors.push(`Missing required field: ${field}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return errors;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GuaranteeNode - contract for contract-based guarantee nodes
|
|
3
|
+
*
|
|
4
|
+
* Types: guarantee:queue, guarantee:api, guarantee:permission
|
|
5
|
+
* ID format: guarantee:queue#orders, guarantee:api#rate-limit
|
|
6
|
+
*
|
|
7
|
+
* Unlike Datalog-based GUARANTEE nodes (handled by GuaranteeManager),
|
|
8
|
+
* these nodes use JSON schema validation for contract verification.
|
|
9
|
+
*/
|
|
10
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
11
|
+
export type GuaranteePriority = 'critical' | 'important' | 'observed' | 'tracked';
|
|
12
|
+
export type GuaranteeStatus = 'discovered' | 'reviewed' | 'active' | 'changing' | 'deprecated';
|
|
13
|
+
export type GuaranteeType = 'guarantee:queue' | 'guarantee:api' | 'guarantee:permission';
|
|
14
|
+
export interface GuaranteeNodeRecord extends BaseNodeRecord {
|
|
15
|
+
type: GuaranteeType;
|
|
16
|
+
priority: GuaranteePriority;
|
|
17
|
+
status: GuaranteeStatus;
|
|
18
|
+
owner?: string;
|
|
19
|
+
schema?: Record<string, unknown>;
|
|
20
|
+
condition?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
createdAt?: number;
|
|
23
|
+
updatedAt?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GuaranteeNodeOptions {
|
|
26
|
+
priority?: GuaranteePriority;
|
|
27
|
+
status?: GuaranteeStatus;
|
|
28
|
+
owner?: string;
|
|
29
|
+
schema?: Record<string, unknown>;
|
|
30
|
+
condition?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const GUARANTEE_NAMESPACES: readonly ["queue", "api", "permission"];
|
|
34
|
+
type GuaranteeNamespace = typeof GUARANTEE_NAMESPACES[number];
|
|
35
|
+
export declare class GuaranteeNode {
|
|
36
|
+
static readonly TYPE_QUEUE: "guarantee:queue";
|
|
37
|
+
static readonly TYPE_API: "guarantee:api";
|
|
38
|
+
static readonly TYPE_PERMISSION: "guarantee:permission";
|
|
39
|
+
static readonly REQUIRED: readonly ["name", "file", "priority", "status"];
|
|
40
|
+
static readonly OPTIONAL: readonly ["owner", "schema", "condition", "description", "createdAt", "updatedAt"];
|
|
41
|
+
/**
|
|
42
|
+
* Create guarantee node
|
|
43
|
+
* @param namespace - guarantee namespace (queue, api, permission)
|
|
44
|
+
* @param name - guarantee name (e.g., 'orders', 'rate-limit')
|
|
45
|
+
* @param options - optional fields
|
|
46
|
+
*/
|
|
47
|
+
static create(namespace: GuaranteeNamespace, name: string, options?: GuaranteeNodeOptions): GuaranteeNodeRecord;
|
|
48
|
+
/**
|
|
49
|
+
* Validate guarantee node
|
|
50
|
+
* @returns array of error messages, empty if valid
|
|
51
|
+
*/
|
|
52
|
+
static validate(node: GuaranteeNodeRecord): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Parse guarantee ID into components
|
|
55
|
+
* @param id - full ID (e.g., 'guarantee:queue#orders')
|
|
56
|
+
* @returns { namespace, name } or null if invalid
|
|
57
|
+
*/
|
|
58
|
+
static parseId(id: string): {
|
|
59
|
+
namespace: GuaranteeNamespace;
|
|
60
|
+
name: string;
|
|
61
|
+
} | null;
|
|
62
|
+
/**
|
|
63
|
+
* Build ID from components
|
|
64
|
+
*/
|
|
65
|
+
static buildId(namespace: GuaranteeNamespace, name: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Check if node type is a guarantee type
|
|
68
|
+
*/
|
|
69
|
+
static isGuaranteeType(type: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Get all valid guarantee types
|
|
72
|
+
*/
|
|
73
|
+
static getTypes(): GuaranteeType[];
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=GuaranteeNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuaranteeNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/GuaranteeNode.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIrD,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;AAC/F,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,eAAe,GAAG,sBAAsB,CAAC;AAEzF,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,QAAA,MAAM,oBAAoB,yCAA0C,CAAC;AACrE,KAAK,kBAAkB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAE9D,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,UAAU,oBAAmC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,kBAAiC;IACzD,MAAM,CAAC,QAAQ,CAAC,eAAe,yBAAwC;IAEvE,MAAM,CAAC,QAAQ,CAAC,QAAQ,kDAAmD;IAC3E,MAAM,CAAC,QAAQ,CAAC,QAAQ,qFAAsF;IAE9G;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CACX,SAAS,EAAE,kBAAkB,EAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,oBAAyB,GACjC,mBAAmB;IA4BtB;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,EAAE;IA0BpD;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,kBAAkB,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAalF;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAInE;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI7C;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,aAAa,EAAE;CAOnC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GuaranteeNode - contract for contract-based guarantee nodes
|
|
3
|
+
*
|
|
4
|
+
* Types: guarantee:queue, guarantee:api, guarantee:permission
|
|
5
|
+
* ID format: guarantee:queue#orders, guarantee:api#rate-limit
|
|
6
|
+
*
|
|
7
|
+
* Unlike Datalog-based GUARANTEE nodes (handled by GuaranteeManager),
|
|
8
|
+
* these nodes use JSON schema validation for contract verification.
|
|
9
|
+
*/
|
|
10
|
+
import { NAMESPACED_TYPE, isGuaranteeType } from './NodeKind.js';
|
|
11
|
+
// Valid guarantee namespaces
|
|
12
|
+
const GUARANTEE_NAMESPACES = ['queue', 'api', 'permission'];
|
|
13
|
+
export class GuaranteeNode {
|
|
14
|
+
static TYPE_QUEUE = NAMESPACED_TYPE.GUARANTEE_QUEUE;
|
|
15
|
+
static TYPE_API = NAMESPACED_TYPE.GUARANTEE_API;
|
|
16
|
+
static TYPE_PERMISSION = NAMESPACED_TYPE.GUARANTEE_PERMISSION;
|
|
17
|
+
static REQUIRED = ['name', 'file', 'priority', 'status'];
|
|
18
|
+
static OPTIONAL = ['owner', 'schema', 'condition', 'description', 'createdAt', 'updatedAt'];
|
|
19
|
+
/**
|
|
20
|
+
* Create guarantee node
|
|
21
|
+
* @param namespace - guarantee namespace (queue, api, permission)
|
|
22
|
+
* @param name - guarantee name (e.g., 'orders', 'rate-limit')
|
|
23
|
+
* @param options - optional fields
|
|
24
|
+
*/
|
|
25
|
+
static create(namespace, name, options = {}) {
|
|
26
|
+
if (!namespace)
|
|
27
|
+
throw new Error('GuaranteeNode.create: namespace is required');
|
|
28
|
+
if (!name)
|
|
29
|
+
throw new Error('GuaranteeNode.create: name is required');
|
|
30
|
+
if (!GUARANTEE_NAMESPACES.includes(namespace)) {
|
|
31
|
+
throw new Error(`GuaranteeNode.create: invalid namespace "${namespace}". Valid: ${GUARANTEE_NAMESPACES.join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const type = `guarantee:${namespace}`;
|
|
34
|
+
const id = `${type}#${name}`;
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
return {
|
|
37
|
+
id,
|
|
38
|
+
type,
|
|
39
|
+
name,
|
|
40
|
+
file: '', // Guarantees don't have a source file
|
|
41
|
+
line: undefined,
|
|
42
|
+
priority: options.priority || 'observed',
|
|
43
|
+
status: options.status || 'discovered',
|
|
44
|
+
owner: options.owner,
|
|
45
|
+
schema: options.schema,
|
|
46
|
+
condition: options.condition,
|
|
47
|
+
description: options.description,
|
|
48
|
+
createdAt: now,
|
|
49
|
+
updatedAt: now,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validate guarantee node
|
|
54
|
+
* @returns array of error messages, empty if valid
|
|
55
|
+
*/
|
|
56
|
+
static validate(node) {
|
|
57
|
+
const errors = [];
|
|
58
|
+
if (!isGuaranteeType(node.type)) {
|
|
59
|
+
errors.push(`Expected guarantee:* type, got ${node.type}`);
|
|
60
|
+
}
|
|
61
|
+
if (!node.name) {
|
|
62
|
+
errors.push('Missing required field: name');
|
|
63
|
+
}
|
|
64
|
+
if (!node.priority) {
|
|
65
|
+
errors.push('Missing required field: priority');
|
|
66
|
+
}
|
|
67
|
+
else if (!['critical', 'important', 'observed', 'tracked'].includes(node.priority)) {
|
|
68
|
+
errors.push(`Invalid priority: ${node.priority}. Valid: critical, important, observed, tracked`);
|
|
69
|
+
}
|
|
70
|
+
if (!node.status) {
|
|
71
|
+
errors.push('Missing required field: status');
|
|
72
|
+
}
|
|
73
|
+
else if (!['discovered', 'reviewed', 'active', 'changing', 'deprecated'].includes(node.status)) {
|
|
74
|
+
errors.push(`Invalid status: ${node.status}. Valid: discovered, reviewed, active, changing, deprecated`);
|
|
75
|
+
}
|
|
76
|
+
return errors;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Parse guarantee ID into components
|
|
80
|
+
* @param id - full ID (e.g., 'guarantee:queue#orders')
|
|
81
|
+
* @returns { namespace, name } or null if invalid
|
|
82
|
+
*/
|
|
83
|
+
static parseId(id) {
|
|
84
|
+
if (!id)
|
|
85
|
+
return null;
|
|
86
|
+
// Format: guarantee:namespace#name
|
|
87
|
+
const match = id.match(/^guarantee:(queue|api|permission)#(.+)$/);
|
|
88
|
+
if (!match)
|
|
89
|
+
return null;
|
|
90
|
+
return {
|
|
91
|
+
namespace: match[1],
|
|
92
|
+
name: match[2],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Build ID from components
|
|
97
|
+
*/
|
|
98
|
+
static buildId(namespace, name) {
|
|
99
|
+
return `guarantee:${namespace}#${name}`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Check if node type is a guarantee type
|
|
103
|
+
*/
|
|
104
|
+
static isGuaranteeType(type) {
|
|
105
|
+
return isGuaranteeType(type);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get all valid guarantee types
|
|
109
|
+
*/
|
|
110
|
+
static getTypes() {
|
|
111
|
+
return [
|
|
112
|
+
NAMESPACED_TYPE.GUARANTEE_QUEUE,
|
|
113
|
+
NAMESPACED_TYPE.GUARANTEE_API,
|
|
114
|
+
NAMESPACED_TYPE.GUARANTEE_PERMISSION,
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HttpRequestNode - contract for HTTP_REQUEST node
|
|
3
|
+
*/
|
|
4
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
5
|
+
interface HttpRequestNodeRecord extends BaseNodeRecord {
|
|
6
|
+
type: 'HTTP_REQUEST';
|
|
7
|
+
url?: string;
|
|
8
|
+
method: string;
|
|
9
|
+
parentScopeId?: string;
|
|
10
|
+
}
|
|
11
|
+
interface HttpRequestNodeOptions {
|
|
12
|
+
column?: number;
|
|
13
|
+
parentScopeId?: string;
|
|
14
|
+
counter?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class HttpRequestNode {
|
|
17
|
+
static readonly TYPE: "HTTP_REQUEST";
|
|
18
|
+
static readonly REQUIRED: readonly ["name", "file", "line"];
|
|
19
|
+
static readonly OPTIONAL: readonly ["url", "method", "column", "parentScopeId"];
|
|
20
|
+
static create(url: string | undefined, method: string | undefined, file: string, line: number, options?: HttpRequestNodeOptions): HttpRequestNodeRecord;
|
|
21
|
+
static validate(node: HttpRequestNodeRecord): string[];
|
|
22
|
+
}
|
|
23
|
+
export type { HttpRequestNodeRecord };
|
|
24
|
+
//# sourceMappingURL=HttpRequestNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpRequestNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/HttpRequestNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,qBAAsB,SAAQ,cAAc;IACpD,IAAI,EAAE,cAAc,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,sBAAsB;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAU;IAE/C,MAAM,CAAC,QAAQ,CAAC,QAAQ,oCAAqC;IAC7D,MAAM,CAAC,QAAQ,CAAC,QAAQ,wDAAyD;IAEjF,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,sBAA2B,GACnC,qBAAqB;IAoBxB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,GAAG,MAAM,EAAE;CASvD;AAED,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HttpRequestNode - contract for HTTP_REQUEST node
|
|
3
|
+
*/
|
|
4
|
+
export class HttpRequestNode {
|
|
5
|
+
static TYPE = 'HTTP_REQUEST';
|
|
6
|
+
static REQUIRED = ['name', 'file', 'line'];
|
|
7
|
+
static OPTIONAL = ['url', 'method', 'column', 'parentScopeId'];
|
|
8
|
+
static create(url, method, file, line, options = {}) {
|
|
9
|
+
if (!file)
|
|
10
|
+
throw new Error('HttpRequestNode.create: file is required');
|
|
11
|
+
if (line === undefined)
|
|
12
|
+
throw new Error('HttpRequestNode.create: line is required');
|
|
13
|
+
const httpMethod = method || 'GET';
|
|
14
|
+
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
15
|
+
const id = `${file}:HTTP_REQUEST:${httpMethod}:${line}:${options.column || 0}${counter}`;
|
|
16
|
+
return {
|
|
17
|
+
id,
|
|
18
|
+
type: this.TYPE,
|
|
19
|
+
name: `${httpMethod} ${url || 'dynamic'}`,
|
|
20
|
+
url,
|
|
21
|
+
method: httpMethod,
|
|
22
|
+
file,
|
|
23
|
+
line,
|
|
24
|
+
parentScopeId: options.parentScopeId
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static validate(node) {
|
|
28
|
+
const errors = [];
|
|
29
|
+
if (node.type !== this.TYPE)
|
|
30
|
+
errors.push(`Expected type ${this.TYPE}`);
|
|
31
|
+
const nodeRecord = node;
|
|
32
|
+
for (const field of this.REQUIRED) {
|
|
33
|
+
if (nodeRecord[field] === undefined)
|
|
34
|
+
errors.push(`Missing: ${field}`);
|
|
35
|
+
}
|
|
36
|
+
return errors;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ImportNode - contract for IMPORT node
|
|
3
|
+
*/
|
|
4
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
5
|
+
type ImportKind = 'value' | 'type' | 'typeof';
|
|
6
|
+
interface ImportNodeRecord extends BaseNodeRecord {
|
|
7
|
+
type: 'IMPORT';
|
|
8
|
+
column: number;
|
|
9
|
+
source: string;
|
|
10
|
+
importKind: ImportKind;
|
|
11
|
+
imported: string;
|
|
12
|
+
local: string;
|
|
13
|
+
}
|
|
14
|
+
interface ImportNodeOptions {
|
|
15
|
+
importKind?: ImportKind;
|
|
16
|
+
imported?: string;
|
|
17
|
+
local?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class ImportNode {
|
|
20
|
+
static readonly TYPE: "IMPORT";
|
|
21
|
+
static readonly REQUIRED: readonly ["name", "file", "line", "source"];
|
|
22
|
+
static readonly OPTIONAL: readonly ["column", "importKind", "imported", "local"];
|
|
23
|
+
static create(name: string, file: string, line: number, column: number, source: string, options?: ImportNodeOptions): ImportNodeRecord;
|
|
24
|
+
static validate(node: ImportNodeRecord): string[];
|
|
25
|
+
}
|
|
26
|
+
export type { ImportNodeRecord, ImportKind };
|
|
27
|
+
//# sourceMappingURL=ImportNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/ImportNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,KAAK,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9C,UAAU,gBAAiB,SAAQ,cAAc;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;IAEzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,8CAA+C;IACvE,MAAM,CAAC,QAAQ,CAAC,QAAQ,yDAA0D;IAElF,MAAM,CAAC,MAAM,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB;IAoBnB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,EAAE;CAgBlD;AAED,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ImportNode - contract for IMPORT node
|
|
3
|
+
*/
|
|
4
|
+
export class ImportNode {
|
|
5
|
+
static TYPE = 'IMPORT';
|
|
6
|
+
static REQUIRED = ['name', 'file', 'line', 'source'];
|
|
7
|
+
static OPTIONAL = ['column', 'importKind', 'imported', 'local'];
|
|
8
|
+
static create(name, file, line, column, source, options = {}) {
|
|
9
|
+
if (!name)
|
|
10
|
+
throw new Error('ImportNode.create: name is required');
|
|
11
|
+
if (!file)
|
|
12
|
+
throw new Error('ImportNode.create: file is required');
|
|
13
|
+
if (!line)
|
|
14
|
+
throw new Error('ImportNode.create: line is required');
|
|
15
|
+
if (!source)
|
|
16
|
+
throw new Error('ImportNode.create: source is required');
|
|
17
|
+
return {
|
|
18
|
+
id: `${file}:IMPORT:${name}:${line}`,
|
|
19
|
+
type: this.TYPE,
|
|
20
|
+
name,
|
|
21
|
+
file,
|
|
22
|
+
line,
|
|
23
|
+
column: column || 0,
|
|
24
|
+
source,
|
|
25
|
+
importKind: options.importKind || 'value',
|
|
26
|
+
imported: options.imported || name,
|
|
27
|
+
local: options.local || name
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
static validate(node) {
|
|
31
|
+
const errors = [];
|
|
32
|
+
if (node.type !== this.TYPE) {
|
|
33
|
+
errors.push(`Expected type ${this.TYPE}, got ${node.type}`);
|
|
34
|
+
}
|
|
35
|
+
const nodeRecord = node;
|
|
36
|
+
for (const field of this.REQUIRED) {
|
|
37
|
+
if (!nodeRecord[field]) {
|
|
38
|
+
errors.push(`Missing required field: ${field}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return errors;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiteralNode - contract for LITERAL node
|
|
3
|
+
*/
|
|
4
|
+
import type { BaseNodeRecord } from '@grafema/types';
|
|
5
|
+
interface LiteralNodeRecord extends BaseNodeRecord {
|
|
6
|
+
type: 'LITERAL';
|
|
7
|
+
value: unknown;
|
|
8
|
+
valueType: string;
|
|
9
|
+
column: number;
|
|
10
|
+
parentCallId?: string;
|
|
11
|
+
argIndex?: number;
|
|
12
|
+
}
|
|
13
|
+
interface LiteralNodeOptions {
|
|
14
|
+
parentCallId?: string;
|
|
15
|
+
argIndex?: number;
|
|
16
|
+
counter?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class LiteralNode {
|
|
19
|
+
static readonly TYPE: "LITERAL";
|
|
20
|
+
static readonly REQUIRED: readonly ["file", "line"];
|
|
21
|
+
static readonly OPTIONAL: readonly ["value", "valueType", "column", "parentCallId", "argIndex"];
|
|
22
|
+
static create(value: unknown, file: string, line: number, column: number, options?: LiteralNodeOptions): LiteralNodeRecord;
|
|
23
|
+
static validate(node: LiteralNodeRecord): string[];
|
|
24
|
+
}
|
|
25
|
+
export type { LiteralNodeRecord };
|
|
26
|
+
//# sourceMappingURL=LiteralNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiteralNode.d.ts","sourceRoot":"","sources":["../../../src/core/nodes/LiteralNode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,UAAU,iBAAkB,SAAQ,cAAc;IAChD,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,kBAAkB;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,SAAS,CAAU;IAE1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,4BAA6B;IACrD,MAAM,CAAC,QAAQ,CAAC,QAAQ,wEAAyE;IAEjG,MAAM,CAAC,MAAM,CACX,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB;IAsBpB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,EAAE;CASnD;AAED,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiteralNode - contract for LITERAL node
|
|
3
|
+
*/
|
|
4
|
+
export class LiteralNode {
|
|
5
|
+
static TYPE = 'LITERAL';
|
|
6
|
+
static REQUIRED = ['file', 'line'];
|
|
7
|
+
static OPTIONAL = ['value', 'valueType', 'column', 'parentCallId', 'argIndex'];
|
|
8
|
+
static create(value, file, line, column, options = {}) {
|
|
9
|
+
if (!file)
|
|
10
|
+
throw new Error('LiteralNode.create: file is required');
|
|
11
|
+
if (line === undefined)
|
|
12
|
+
throw new Error('LiteralNode.create: line is required');
|
|
13
|
+
const counter = options.counter !== undefined ? `:${options.counter}` : '';
|
|
14
|
+
const argIndex = options.argIndex !== undefined ? `arg${options.argIndex}` : 'value';
|
|
15
|
+
const id = `${file}:LITERAL:${argIndex}:${line}:${column || 0}${counter}`;
|
|
16
|
+
return {
|
|
17
|
+
id,
|
|
18
|
+
type: this.TYPE,
|
|
19
|
+
name: file,
|
|
20
|
+
value,
|
|
21
|
+
valueType: typeof value,
|
|
22
|
+
file,
|
|
23
|
+
line,
|
|
24
|
+
column: column || 0,
|
|
25
|
+
parentCallId: options.parentCallId,
|
|
26
|
+
argIndex: options.argIndex
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static validate(node) {
|
|
30
|
+
const errors = [];
|
|
31
|
+
if (node.type !== this.TYPE)
|
|
32
|
+
errors.push(`Expected type ${this.TYPE}`);
|
|
33
|
+
const nodeRecord = node;
|
|
34
|
+
for (const field of this.REQUIRED) {
|
|
35
|
+
if (nodeRecord[field] === undefined)
|
|
36
|
+
errors.push(`Missing: ${field}`);
|
|
37
|
+
}
|
|
38
|
+
return errors;
|
|
39
|
+
}
|
|
40
|
+
}
|