/** * Client fetch function factory. * * This module provides a factory function that creates a customized fetch function * by composing multiple fetch wrappers based on configuration: * - Timeout wrapper (if timeoutMs is specified) * - Header stripping wrapper (for browser compatibility) * - Progress tracking wrapper (if progress features are enabled) * * @module */ import type { Logger } from '../../logger/index.js'; import type { FetchProgressEvent } from '../types/progress-event.types.js'; /** * Parameters for creating a customized fetch function. */ export type CreateClientFetchParams = { readonly logger: Logger; readonly enableProgressLog: boolean; readonly progressCallback: ((event: FetchProgressEvent) => void) | undefined; readonly timeoutMs: number | undefined; readonly providedFetch: typeof fetch | undefined; readonly stripHeaders?: string[] | undefined; }; /** * Create a customized fetch function with optional features. * * This function composes multiple fetch wrappers in the following order: * 1. Timeout wrapper (if timeoutMs is specified) * 2. Header stripping wrapper (if stripHeaders is specified) * 3. Progress tracking wrapper (if enableProgressLog or progressCallback is specified) * * @param params - Configuration parameters for fetch customization * @returns Customized fetch function, or undefined to use default fetch * * @example Basic usage with timeout * ```typescript * const customFetch = createClientFetch({ * logger: myLogger, * enableProgressLog: false, * progressCallback: undefined, * timeoutMs: 30000, * providedFetch: undefined, * }); * ``` * * @example With progress tracking * ```typescript * const customFetch = createClientFetch({ * logger: myLogger, * enableProgressLog: true, * progressCallback: (event) => { * if (event.type === 'download-progress') { * console.log(`Progress: ${event.percentage}%`); * } * }, * timeoutMs: undefined, * providedFetch: undefined, * }); * ``` */ export declare function createClientFetch(params: CreateClientFetchParams): typeof fetch | undefined; //# sourceMappingURL=create-client-fetch.d.ts.map