UNPKG

@dbs-portal/core-api

Version:

HTTP client and API utilities for DBS Portal

63 lines 2 kB
/** * MSW simulation utilities for delays, errors, and network conditions */ import type { MockRequest, ErrorSimulationConfig } from '../types'; /** * Simulate network delay */ export declare function simulateDelay(delay: number | [number, number]): Promise<void>; /** * Simulate network error based on configuration */ export declare function simulateError(request: MockRequest, config?: ErrorSimulationConfig): Promise<Response | null>; /** * Simulate loading states with progressive responses */ export declare function simulateProgressiveLoading<T>(data: T, options?: { steps?: number; stepDelay?: number; onProgress?: (progress: number) => void; }): Promise<T>; /** * Simulate file upload with progress */ export declare function simulateFileUpload(file: { name: string; size: number; type: string; }, options?: { chunkSize?: number; chunkDelay?: number; onProgress?: (progress: number) => void; failureRate?: number; }): Promise<{ id: string; url: string; metadata: any; }>; /** * Simulate real-time data updates */ export declare function simulateRealTimeUpdates<T>(initialData: T, updateFn: (data: T) => T, options?: { interval?: number; maxUpdates?: number; onUpdate?: (data: T) => void; }): () => void; /** * Simulate batch processing */ export declare function simulateBatchProcessing<T, R>(items: T[], processor: (item: T) => Promise<R> | R, options?: { batchSize?: number; batchDelay?: number; onBatchComplete?: (results: R[], batchIndex: number) => void; onProgress?: (completed: number, total: number) => void; }): Promise<R[]>; /** * Simulate network conditions (slow 3G, fast 3G, etc.) */ export declare function getNetworkConditionDelay(condition: 'slow-3g' | 'fast-3g' | '4g' | 'wifi'): [number, number]; /** * Simulate intermittent connectivity */ export declare function simulateIntermittentConnectivity(successRate?: number): boolean; //# sourceMappingURL=simulation.d.ts.map