/** * Query Preprocessor for Virtual Filesystem * Transforms SQL queries containing mcp:// URIs into executable DuckDB queries */ /** * Represents a URI replacement in a query */ export interface URIReplacement { uri: string; startPos: number; endPos: number; replacement: string; needsResolution: boolean; } /** * Query transformation result */ export interface TransformResult { originalQuery: string; transformedQuery: string; replacements: URIReplacement[]; urisToResolve: string[]; } /** * Preprocesses SQL queries to handle mcp:// URIs */ export declare class QueryPreprocessor { /** * Transform a SQL query by replacing mcp:// URIs * @param sql The original SQL query * @param resolver Function to resolve URIs to local paths * @returns Transformation result */ static transform(sql: string, resolver: (uri: string) => Promise): Promise; /** * Build replacement string for a URI * @param localPath The local file path * @param format The data format * @returns Replacement SQL fragment */ private static buildReplacement; /** * Find all occurrences of a URI in the query * @param sql The SQL query * @param uri The URI to find * @returns Array of positions */ private static findOccurrences; /** * Replace URI in query with replacement * @param query The SQL query * @param uri The URI to replace * @param replacement The replacement string * @returns Modified query */ private static replaceURI; /** * Escape special regex characters */ private static escapeRegex; /** * Apply replacements to a query * @param sql The original SQL query * @param replacements The replacements to apply * @returns Transformed query */ static applyReplacements(sql: string, replacements: URIReplacement[]): string; /** * Validate a transformed query * @param query The transformed query * @returns True if valid, false otherwise */ static validate(query: string): boolean; /** * Expand glob patterns in a query * @param sql The SQL query * @param availableResources List of available resources * @returns Expanded query with all matching resources */ static expandGlobs(sql: string, availableResources: Array<{ server: string; path: string; }>): Promise; /** * Extract table references from a query * @param sql The SQL query * @returns List of table names referenced */ static extractTableReferences(sql: string): string[]; /** * Check if a word is a SQL keyword */ private static isKeyword; } //# sourceMappingURL=QueryPreprocessor.d.ts.map