/** * Abort requests by pattern * * @param pattern - URL pattern to match * @param reason - Optional abort reason * * @example * ```typescript * // Abort all search requests * abortByPattern('/api/search/*', 'New search started'); * ``` */ export declare function abortByPattern(pattern: string, reason?: string): void; /** * Abort all search requests * * @param reason - Optional abort reason */ export declare function abortSearchRequests(reason?: string): void; /** * Abort all upload requests * * @param reason - Optional abort reason */ export declare function abortUploadRequests(reason?: string): void; /** * Abort all pending API requests * * @param reason - Optional abort reason */ export declare function abortAllRequests(reason?: string): void; /** * Create scoped abort function for a specific API namespace * * @param scope - Scope prefix for requests * @returns Scoped abort function * * @example * ```typescript * const abortUserRequests = createScopedAbort('/api/users'); * * // Later: abort all user requests * abortUserRequests('profile', 'User logged out'); * // This aborts: /api/users/profile * ``` */ export declare function createScopedAbort(scope: string): (key: string, reason?: string) => void; /** * Debounced abort - useful for search-as-you-type * * @param delay - Delay in milliseconds * @returns Debounced abort function * * @example * ```typescript * const debouncedAbort = createDebouncedAbort(300); * * // On each keystroke * debouncedAbort('/api/search', 'New search query'); * // Only aborts after 300ms of no calls * ``` */ export declare function createDebouncedAbort(delay?: number): { (key: string, reason?: string): void; cancel: () => void; }; /** * Throttled abort - limits abort frequency * * @param limit - Minimum time between aborts (ms) * @returns Throttled abort function */ export declare function createThrottledAbort(limit?: number): (key: string, reason?: string) => void; /** * Request with timeout - automatically aborts after timeout * * @param key - Request identifier * @param fetcher - Function that performs the request * @param timeoutMs - Timeout in milliseconds * @returns Promise with request result * * @example * ```typescript * const data = await requestWithTimeout( * '/api/slow-endpoint', * () => fetch('/api/slow-endpoint').then(r => r.json()), * 5000 // 5 second timeout * ); * ``` */ export declare function requestWithTimeout(key: string, fetcher: () => Promise, timeoutMs: number): Promise; /** * Race multiple requests and abort losers * * @param requests - Array of request configurations * @returns Promise with winner's result * * @example * ```typescript * const fastest = await raceRequests([ * { key: 'primary', fetcher: () => fetchPrimary() }, * { key: 'backup', fetcher: () => fetchBackup() } * ]); * ``` */ export declare function raceRequests(requests: Array<{ key: string; fetcher: () => Promise; }>): Promise; /** * Sequential request chain with abort on failure * * @param requests - Array of request configurations * @returns Array of results * * @example * ```typescript * const results = await sequentialRequests([ * { key: 'step1', fetcher: () => doStep1() }, * { key: 'step2', fetcher: () => doStep2() }, * { key: 'step3', fetcher: () => doStep3() } * ]); * ``` */ export declare function sequentialRequests(requests: Array<{ key: string; fetcher: () => Promise; }>): Promise; //# sourceMappingURL=utils.d.ts.map