/** * Route / fetch edge emission + exported-type-map helpers. * * The legacy call-resolution DAG that previously lived here (per-file type * inference → receiver inference → dispatch selection → MRO walk over the * legacy heritage map) was deleted in RING4-1 (#942): all languages now resolve * calls through the scope-resolution registry pipeline. What remains are the * language-agnostic edge emitters that are NOT part of call resolution: * * - `processRoutesFromExtracted` — CALLS edges from framework routes * (e.g. Laravel) to their controller methods. * - `processNextjsFetchRoutes` / `extractConsumerAccessedKeys` — FETCHES edges * from `fetch()` calls to Next.js Route nodes. * - `buildExportedTypeMapFromGraph` — exported symbol → return/declared type * map, consumed by the cross-file enrichment pass. */ import { KnowledgeGraph } from '../graph/types.js'; import type { SemanticModel, SymbolTableReader } from './model/index.js'; import type { ExtractedRoute, ExtractedFetchCall } from './workers/parse-worker.js'; /** Per-file resolved type bindings for exported symbols. * Consumed by the cross-file re-resolution / enrichment pass. */ export type ExportedTypeMap = Map>; /** Record one exported graph node into the incremental ExportedTypeMap. */ export declare const accumulateExportedTypesFromParsedNode: (result: ExportedTypeMap, node: { id: string; properties?: Record; }, symbolTable: SymbolTableReader) => void; /** Build ExportedTypeMap from graph nodes — used for the worker path where the * sequential TypeEnv is not available in the main thread. Collects * returnType/declaredType from exported symbols with known types. */ export declare function buildExportedTypeMapFromGraph(graph: KnowledgeGraph, symbolTable: SymbolTableReader): ExportedTypeMap; /** * Create CALLS edges from extracted framework routes (e.g. Laravel) to their * controller methods. Runs for all languages — independent of call resolution. * * Resolution is registry-based (RING4-2 #943 retired the tiered resolver): * - Controller: **qualified-first** (see {@link resolveControllerByQualifiedName}). * When the routes file disambiguated the controller, the Laravel extractor * threads `route.controllerQualifiedName` (a `use` import — incl. aliased * `use … as X;` — or an inline qualified `::class`, normalized to the dot- * joined key shape). The emitter resolves it by direct qualified lookup, or * by PSR-4 file-path disambiguation when PHP's statement-form namespace left * the registry keyed only by the short name — either way picking the * specific class even when the short name is globally duplicated (the common * admin/public `OrderController` split) or aliased. It falls back to the * global short-name lookup (`lookupClassByName`), which still skips on * ambiguity (`length !== 1`) — so a bare, genuinely ambiguous short name * with no `use`/FQN correctly produces no (wrong) edge. * - Method: resolved within the controller's own file via the symbol table * (the legacy emitter only accepted same-file method resolutions). * * Edge confidence is a flat {@link ROUTE_EDGE_CONFIDENCE}. Route CALLS edges * are gated downstream by the process-trace (`MIN_TRACE_CONFIDENCE`) and * large-graph community (`MIN_CONFIDENCE_LARGE`) thresholds (both 0.5); a * resolved edge lands at exactly 0.5 and passes (`>= 0.5`). The guessed-method * fallback edge (`× 0.8` = 0.4) sits below the gate and is excluded from those * passes — acceptable for an edge whose target method could not be resolved. */ export declare const processRoutesFromExtracted: (graph: KnowledgeGraph, extractedRoutes: ExtractedRoute[], model: SemanticModel, onProgress?: (current: number, total: number) => void) => Promise; /** * Extract property access keys from a consumer file's source code near fetch calls. * * Looks for destructuring (`const { data } = await res.json()`), property access * (`response.data`), and optional chaining (`data?.key`). Returns deduplicated * top-level property names accessed on the response. Scans the whole file, so * all accessed keys are attributed to each fetch — acceptable for regex-based * extraction. */ export declare const extractConsumerAccessedKeys: (content: string) => string[]; /** * Create FETCHES edges from extracted fetch() calls to matching Route nodes. * When consumerContents is provided, extracts property access patterns from * consumer files and encodes them in the edge reason field. */ export declare const processNextjsFetchRoutes: (graph: KnowledgeGraph, fetchCalls: ExtractedFetchCall[], routeRegistry: Map, // routeURL → handlerFilePath consumerContents?: Map) => void;