@push.rocks/webrequest
Version:
Modern, fetch-compatible web request library with intelligent HTTP caching, retry strategies, and fault tolerance.
31 lines (30 loc) • 746 B
TypeScript
/**
* Request deduplication system
* Prevents multiple simultaneous identical requests
*/
export declare class RequestDeduplicator {
private inFlightRequests;
/**
* Generate a deduplication key from a request
*/
generateKey(request: Request): string;
/**
* Execute a request with deduplication
*/
execute(key: string, executeFn: () => Promise<Response>): Promise<{
response: Response;
wasDeduplicated: boolean;
}>;
/**
* Check if a request is currently in flight
*/
isInFlight(key: string): boolean;
/**
* Get the number of in-flight requests
*/
getInFlightCount(): number;
/**
* Clear all in-flight requests
*/
clear(): void;
}