import { Result } from './result';
/**
 * Options for retry functionality.
 */
export interface RetryOptions {
    maxAttempts?: number;
    delay?: number;
    backoff?: 'linear' | 'exponential';
    backoffFactor?: number;
    onRetry?: (attempt: number, error: any) => void;
}
/**
 * Executes functions in parallel and collects all results.
 * @template T - Array type of all function return values.
 * @template E - The type of the error.
 * @param {...Array<() => Promise<Result<any, E>>>} fns - Functions to execute in parallel.
 * @returns {Promise<Result<T, E[]>>} - Result containing array of values or array of errors.
 */
export declare const parallel: <T extends readonly any[], E>(...fns: { [K in keyof T]: () => Promise<Result<T[K], E>>; }) => Promise<Result<T, E[]>>;
/**
 * Executes functions in parallel and returns the first successful result.
 * @template T - The type of the value.
 * @template E - The type of the error.
 * @param {...Array<() => Promise<Result<T, E>>>} fns - Functions to execute.
 * @returns {Promise<Result<T, E[]>>} - First successful result or all errors.
 */
export declare const race: <T, E>(...fns: Array<() => Promise<Result<T, E>>>) => Promise<Result<T, E[]>>;
/**
 * Executes functions sequentially, stopping on first failure.
 * @template T - Array type of all function return values.
 * @template E - The type of the error.
 * @param {...Array<() => Promise<Result<any, E>>>} fns - Functions to execute sequentially.
 * @returns {Promise<Result<T, E>>} - Result containing array of values or first error.
 */
export declare const sequential: <T extends readonly any[], E>(...fns: { [K in keyof T]: () => Promise<Result<T[K], E>>; }) => Promise<Result<T, E>>;
/**
 * Retries a function with configurable options.
 * @template T - The type of the value.
 * @template E - The type of the error.
 * @param {() => Promise<Result<T, E>>} fn - Function to retry.
 * @param {RetryOptions} options - Retry configuration.
 * @returns {Promise<Result<T, E>>} - Result after retries.
 */
export declare const retry: <T, E>(fn: () => Promise<Result<T, E>>, options?: RetryOptions) => Promise<Result<T, E>>;
/**
 * Applies a timeout to an async operation.
 * @template T - The type of the value.
 * @template E - The type of the error.
 * @param {() => Promise<Result<T, E>>} fn - Function to execute with timeout.
 * @param {number} ms - Timeout in milliseconds.
 * @param {E} timeoutError - Error to return on timeout.
 * @returns {Promise<Result<T, E>>} - Result or timeout error.
 */
export declare const withTimeout: <T, E>(fn: () => Promise<Result<T, E>>, ms: number, timeoutError: E) => Promise<Result<T, E>>;
/**
 * Batches multiple operations and executes them with concurrency control.
 * @template T - The type of the value.
 * @template E - The type of the error.
 * @param {Array<() => Promise<Result<T, E>>>} fns - Functions to execute.
 * @param {number} concurrency - Maximum concurrent executions.
 * @returns {Promise<Result<T[], E[]>>} - Results of all operations.
 */
export declare const batch: <T, E>(fns: Array<() => Promise<Result<T, E>>>, concurrency: number) => Promise<Result<T[], E[]>>;
/**
 * Debounces an async function.
 * @template T - The type of the value.
 * @template E - The type of the error.
 * @param {(...args: any[]) => Promise<Result<T, E>>} fn - Function to debounce.
 * @param {number} ms - Debounce delay in milliseconds.
 * @returns {(...args: any[]) => Promise<Result<T, E>>} - Debounced function.
 */
export declare const debounce: <T, E>(fn: (...args: any[]) => Promise<Result<T, E>>, ms: number) => ((...args: any[]) => Promise<Result<T, E>>);
//# sourceMappingURL=async.d.ts.map