import type { ReasonCode, ValueIr } from "../../../../core/domain/facts/value-ir.js"; import type { DeclaredRouter, ServeRoot } from "../../../../core/ports/config.port.js"; import type { ParsedFile } from "../../../../core/ports/parser.port.js"; import { type SyntaxNode } from "../../../../infrastructure/parser/ts-utils.js"; import { type GoImportIndex } from "../../index/go/imports.js"; import type { GoPackageIndex } from "../../index/go/packages.js"; /** A router value whose lineage was lost carries why it was lost. */ export type Identity = { readonly kind: "proven"; readonly key: string; } | { readonly kind: "lost"; readonly reason: ReasonCode; }; export type RouterValue = { readonly router: DeclaredRouter; readonly identity: Identity; }; export type Registration = { readonly value: RouterValue; readonly path: ValueIr; readonly method: ValueIr; readonly call: SyntaxNode; readonly relPath: string; /** Interprocedural distance the claiming walk reached this site at. */ readonly distance: number; }; export type MountRecord = { readonly prefix: ValueIr; readonly parent: string | null; }; /** A member call on a proven router value that no registration form claims. */ export type UnclassifiedRegistration = { readonly router: DeclaredRouter; readonly member: string; readonly arity: number; readonly call: SyntaxNode; readonly relPath: string; }; export type ScopeResult = { readonly registrations: readonly Registration[]; readonly mounts: ReadonlyMap; readonly unclassified: readonly UnclassifiedRegistration[]; readonly lostMounts: readonly UnclassifiedRegistration[]; /** Identity key of an anchored router to the mount it is exposed under. */ readonly anchors: ReadonlyMap; /** Declared symbols the unit could not resolve to one anchored router. */ readonly serveRootFailures: readonly string[]; }; export type GoRouterFile = { readonly file: ParsedFile; readonly imports: GoImportIndex; }; /** * Binds every router value the unit constructs and attributes each registration * to the value its receiver resolves to. A body taking a router, directly or in * a record, is entered through the call edge that seeds it; a body reached by no * edge is walked once with that parameter's identity lost. */ export declare function analyzeGoRouterValues(files: readonly GoRouterFile[], routers: readonly DeclaredRouter[], packages: GoPackageIndex, serveRoots?: readonly ServeRoot[]): ScopeResult; export type Member = { readonly name: string; readonly receiver: SyntaxNode; readonly args: readonly SyntaxNode[]; };