import { SupportedLanguages } from '../../../config/supported-languages.js'; import type { ConstructorBinding } from '../type-env.js'; interface ParsedNode { id: string; label: string; properties: { name: string; filePath: string; startLine: number; endLine: number; language: SupportedLanguages; isExported: boolean; astFrameworkMultiplier?: number; astFrameworkReason?: string; description?: string; parameterCount?: number; returnType?: string; rootType?: string; nodePath?: string; nodeType?: string; uniqueNameInOwner?: boolean; resourceType?: string; resourceId?: string; scene_tree?: string; }; } interface ParsedRelationship { id: string; sourceId: string; targetId: string; type: 'DEFINES' | 'HAS_METHOD' | 'HAS_NODE' | 'HAS_RESOURCE' | 'USES_RESOURCE' | 'ATTACHED_SCRIPT' | 'NODE_SCRIPT' | 'INSTANTIATES'; confidence: number; reason: string; } interface ParsedSymbol { filePath: string; name: string; nodeId: string; type: string; parameterCount?: number; returnType?: string; ownerId?: string; } export interface ExtractedImport { filePath: string; rawImportPath: string; language: SupportedLanguages; /** Named bindings from the import (e.g., import {User as U} → [{local:'U', exported:'User'}]) */ namedBindings?: { local: string; exported: string; }[]; } export interface ExtractedCall { filePath: string; calledName: string; /** generateId of enclosing function, or generateId('File', filePath) for top-level */ sourceId: string; argCount?: number; /** Discriminates free function calls from member/constructor calls */ callForm?: 'free' | 'member' | 'constructor'; /** Simple identifier of the receiver for member calls (e.g., 'user' in user.save()) */ receiverName?: string; /** Resolved type name of the receiver (e.g., 'User' for user.save() when user: User) */ receiverTypeName?: string; /** * Chained call names when the receiver is itself a call expression. * For `svc.getUser().save()`, the `save` ExtractedCall gets receiverCallChain = ['getUser'] * with receiverName = 'svc'. The chain is ordered outermost-last, e.g.: * `a.b().c().d()` → calledName='d', receiverCallChain=['b','c'], receiverName='a' * Length is capped at MAX_CHAIN_DEPTH (3). */ receiverCallChain?: string[]; } export interface ExtractedHeritage { filePath: string; className: string; parentName: string; /** 'extends' | 'implements' | 'trait-impl' | 'include' | 'extend' | 'prepend' */ kind: string; } export interface ExtractedRoute { filePath: string; httpMethod: string; routePath: string | null; controllerName: string | null; methodName: string | null; middleware: string[]; prefix: string | null; lineNumber: number; } /** Constructor bindings keyed by filePath for cross-file type resolution */ export interface FileConstructorBindings { filePath: string; bindings: ConstructorBinding[]; } export interface ParseWorkerResult { nodes: ParsedNode[]; relationships: ParsedRelationship[]; symbols: ParsedSymbol[]; imports: ExtractedImport[]; calls: ExtractedCall[]; heritage: ExtractedHeritage[]; routes: ExtractedRoute[]; constructorBindings: FileConstructorBindings[]; skippedLanguages: Record; fileCount: number; } export interface ParseWorkerInput { path: string; content: string; } export {};