import { SupportedLanguages } from '../../../_shared/index.js'; import { type MixedChainStep } from '../utils/call-analysis.js'; import type { ConstructorBinding } from '../type-env.js'; import type { NamedBinding } from '../named-bindings/types.js'; import type { NodeLabel } from '../../../_shared/index.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; requiredParameterCount?: number; returnType?: string; declaredType?: string; visibility?: string; isStatic?: boolean; isReadonly?: boolean; }; } interface ParsedRelationship { id: string; sourceId: string; targetId: string; type: 'DEFINES' | 'HAS_METHOD' | 'HAS_PROPERTY'; confidence: number; reason: string; } interface ParsedSymbol { filePath: string; name: string; nodeId: string; type: NodeLabel; parameterCount?: number; requiredParameterCount?: number; parameterTypes?: string[]; returnType?: string; declaredType?: string; ownerId?: string; visibility?: string; isStatic?: boolean; isReadonly?: boolean; isAbstract?: boolean; isFinal?: boolean; annotations?: 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?: NamedBinding[]; } export interface ExtractedCall { filePath: string; calledName: string; /** generateId of enclosing function, or generateId('File', filePath) for top-level */ sourceId: string; /** From call AST; omitted for some seeds (e.g. Java `::`) so arity filter is skipped */ 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; /** * Unified mixed chain when the receiver is a chain of field accesses and/or method calls. * Steps are ordered base-first (innermost to outermost). Examples: * `svc.getUser().save()` → chain=[{kind:'call',name:'getUser'}], receiverName='svc' * `user.address.save()` → chain=[{kind:'field',name:'address'}], receiverName='user' * `svc.getUser().address.save()` → chain=[{kind:'call',name:'getUser'},{kind:'field',name:'address'}] * Length is capped at MAX_CHAIN_DEPTH (3). */ receiverMixedChain?: MixedChainStep[]; argTypes?: (string | undefined)[]; } export interface ExtractedAssignment { filePath: string; /** generateId of enclosing function, or generateId('File', filePath) for top-level */ sourceId: string; /** Receiver text (e.g., 'user' from user.address = value) */ receiverText: string; /** Property name being written (e.g., 'address') */ propertyName: string; /** Resolved type name of the receiver if available from TypeEnv */ receiverTypeName?: 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; } export interface ExtractedFetchCall { filePath: string; fetchURL: string; lineNumber: number; } export interface ExtractedDecoratorRoute { filePath: string; routePath: string; httpMethod: string; decoratorName: string; lineNumber: number; } export interface ExtractedToolDef { filePath: string; toolName: string; description: string; lineNumber: number; } export interface ExtractedORMQuery { filePath: string; orm: 'prisma' | 'supabase'; model: string; method: string; lineNumber: number; } /** Constructor bindings keyed by filePath for cross-file type resolution */ export interface FileConstructorBindings { filePath: string; bindings: ConstructorBinding[]; } /** File-scope type bindings from TypeEnv fixpoint — used for cross-file ExportedTypeMap. */ export interface FileTypeEnvBindings { filePath: string; /** [varName, typeName] pairs from file scope (scope = '') */ bindings: [string, string][]; } export interface ParseWorkerResult { nodes: ParsedNode[]; relationships: ParsedRelationship[]; symbols: ParsedSymbol[]; imports: ExtractedImport[]; calls: ExtractedCall[]; assignments: ExtractedAssignment[]; heritage: ExtractedHeritage[]; routes: ExtractedRoute[]; fetchCalls: ExtractedFetchCall[]; decoratorRoutes: ExtractedDecoratorRoute[]; toolDefs: ExtractedToolDef[]; ormQueries: ExtractedORMQuery[]; constructorBindings: FileConstructorBindings[]; /** File-scope type bindings from TypeEnv fixpoint for exported symbol collection. */ typeEnvBindings: FileTypeEnvBindings[]; skippedLanguages: Record; fileCount: number; } export interface ParseWorkerInput { path: string; content: string; } /** * Extract ORM query calls from file content via regex. * Appends results to the provided array (avoids allocation when no matches). */ export declare function extractORMQueries(filePath: string, content: string, out: ExtractedORMQuery[]): void; export {};