@hyper-fetch/core
Version:
Cache, Queue and Persist your requests no matter if you are online or offline!
25 lines • 1.92 kB
TypeScript
import { AdapterInstance, ProgressType, RequestResponseType, ResponseType } from '../adapter';
import { Dispatcher } from '../dispatcher';
import { ExtractAdapterType } from '../types';
import { ProgressEventType, RequestInstance, RequestJSON, RequestSendOptionsType } from './request.types';
export declare const scopeKey: (key: string, scope: string | null) => string;
export declare const stringifyKey: (value: unknown) => string;
export declare const getProgressValue: ({ loaded, total }: ProgressEventType) => number;
export declare const getRequestEta: (startDate: Date, progressDate: Date, { total, loaded }: ProgressEventType) => {
sizeLeft: number;
timeLeft: number | null;
};
export declare const getProgressData: (requestStartTime: Date, progressDate: Date, progressEvent: ProgressEventType) => ProgressType;
export declare const getSimpleKey: (request: RequestInstance | RequestJSON<RequestInstance>) => string;
/**
* Cache instance for individual request that collects individual requests responses from
* the same endpoint (they may differ base on the custom key, endpoint params etc)
* @param request
* @param useInitialValues
* @returns
*/
export declare const getRequestKey: (request: RequestInstance | RequestJSON<RequestInstance>, useInitialValues?: boolean) => string;
export declare const getRequestDispatcher: <Request extends RequestInstance>(request: Request, dispatcherType?: "auto" | "fetch" | "submit") => [Dispatcher<ExtractAdapterType<Request>>, isFetchDispatcher: boolean];
export declare const mapResponseForSend: <Request extends RequestInstance>(request: Request, response: ResponseType<any, any, AdapterInstance>) => Promise<RequestResponseType<Request>>;
export declare const sendRequest: <Request extends RequestInstance>(request: Request, options?: RequestSendOptionsType<Request>) => Promise<RequestResponseType<Request>>;
//# sourceMappingURL=request.utils.d.ts.map