import { Readable } from 'stream'; import { ProxyData } from '../core/types/index.js'; export interface ProxyResponse { data: Buffer | string; contentType: string; statusCode: number; headers?: Record; } export interface StreamingProxyResponse { stream: Readable; contentType: string; statusCode: number; headers: Record; } export type ProxyResult = ProxyResponse | StreamingProxyResponse; export declare function isStreamingResponse(response: ProxyResult): response is StreamingProxyResponse; export declare class ProxyService { private isProd; private streamPatterns; constructor(streamPatterns?: RegExp[]); /** * Proxy a request to an upstream provider * Returns either buffered response or streaming response based on file type */ proxyRequest(encodedData: string): Promise; /** * Determine if a URL should be streamed based on file type */ private shouldStream; /** * Fetch helper with timeout */ private fetchWithTimeout; /** * Handle streaming request for large files */ private handleStreamingRequest; /** * Handle buffered request for small files */ private handleBufferedRequest; /** * Determine MIME type from URL or content */ private getMimeType; /** * Decode proxy data parameter */ static decodeProxyData(encodedData: string): ProxyData; /** * Check if the response is a manifest file that needs rewriting. * Makes sure that it is text based, but NOT a subtitle file. */ private isManifestFile; /** * Rewrite manifest file URLs to go through proxy */ private rewriteManifest; private hasUriAttribute; private rewriteTagAttributes; private isUrlLine; private resolveUrl; /** * Create a proxy URL for a given upstream URL * ALWAYS includes headers from the original request */ createProxyUrl(url: string, headers?: Record): string; } //# sourceMappingURL=proxy.service.d.ts.map