import EventEmitter$1 from 'events'; type Prettify = { [K in keyof T]: T[K]; } & {}; type EmptyTypes = null | undefined; type NullableType = T | EmptyTypes; type NullableKeys = { [P in keyof T]-?: NullableType; }; type NonNullableKeys = { [P in keyof T]-?: NonNullable; }; type RequiredKeys = { [P in keyof T]-?: Exclude; }; type TypeWithDefaults, Key extends keyof Types, Value, ExcludedTypes = void | never> = Key extends keyof Types ? Exclude extends never ? Value : Exclude : Value; type SyncOrAsync = T | Promise; type HttpMethodsType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; type HttpStatusType = number; type ExtractAdapterOptionsType = T extends Adapter ? O : never; type ExtractAdapterMethodType = T extends Adapter ? M : never; type ExtractAdapterStatusType = T extends Adapter ? S : never; type ExtractAdapterExtraType = T extends Adapter ? A : never; type ExtractAdapterQueryParamsType = T extends Adapter ? Q : never; type ExtractAdapterDefaultQueryParamsType = T extends Adapter ? Q : never; type ExtractAdapterEndpointType = T extends Adapter ? E : never; type ExtractAdapterEndpointMapperType = T extends Adapter ? EM : never; type ExtractAdapterQueryParamsMapperType = T extends Adapter ? QPM : never; type ExtractAdapterHeaderMapperType = T extends Adapter ? HM : never; type ExtractAdapterPayloadMapperType = T extends Adapter ? PM : never; type ExtractUnionAdapter = Extract> extends AdapterInstance ? Extract> : never; type ExtractClientGlobalError = T extends Client$1 ? P : never; type ExtractClientAdapterType = T extends Client$1 ? P : never; type ExtractAdapterResolvedType = ResponseType, ExtractErrorType, ExtractAdapterType>; type ExtractResponseType = T extends Request ? D : never; type ExtractPayloadType = T extends Request ? D : never; type ExtractQueryParamsType = T extends Request ? Q : never; type ExtractErrorType = T extends Request ? G | ExtractClientGlobalError : never; type ExtractGlobalErrorType = T extends Request ? ExtractClientGlobalError : never; type ExtractLocalErrorType = T extends Request ? E : never; type ExtractParamsType = T extends Request ? E extends string ? ExtractUrlParams : never : never; type ExtractEndpointType = T extends Request ? E : never; type ExtractClientType = T extends Request ? C : never; type ExtractAdapterType = T extends Request ? ExtractClientAdapterType : never; type ExtractHasPayloadType = T extends Request ? D : never; type ExtractHasParamsType = T extends Request ? P : never; type ExtractHasQueryParamsType = T extends Request ? Q : never; type ExtendRequest>; client?: Client$1; hasData?: true | false; hasParams?: true | false; hasQuery?: true | false; }> = Request>, TypeWithDefaults>, TypeWithDefaults>, TypeWithDefaults>, Properties["endpoint"] extends string ? Properties["endpoint"] : ExtractEndpointType, Properties["client"] extends ClientInstance ? Properties["client"] : ExtractClientType, Properties["hasData"] extends true ? true : ExtractHasPayloadType, Properties["hasParams"] extends true ? true : ExtractHasParamsType, Properties["hasQuery"] extends true ? true : ExtractHasQueryParamsType>; /** * Cache class handles the data exchange with the dispatchers. * * @note * Keys used to save the values are created dynamically on the Request class * */ declare class Cache { options?: CacheOptionsType | undefined; emitter: EventEmitter; events: ReturnType; storage: CacheStorageType; lazyStorage?: CacheAsyncStorageType; version: string; garbageCollectors: Map; private logger; private client; constructor(options?: CacheOptionsType | undefined); initialize: (client: ClientInstance<{ adapter: Adapter; }>) => this; /** * Set the cache data to the storage * @param request * @param response * @returns */ set: >(request: Request, response: CacheSetState, ExtractErrorType, ExtractAdapterType> & ResponseDetailsType> & { hydrated?: boolean; }) => void; /** * Update the cache data with partial response data * @param request * @param partialResponse * @param isTriggeredExtrenally - informs whether an update was triggered due to internal logic or externally, e.g. * via plugin. * @returns */ update: >(request: Request, partialResponse: CacheSetState, ExtractErrorType, ExtractAdapterType> & ResponseDetailsType>>) => void; /** * Get particular record from storage by cacheKey. It will trigger lazyStorage to emit lazy load event for reading it's data. * @param cacheKey * @returns */ get: (cacheKey: string) => CacheValueType | undefined; /** * Get sync storage keys, lazyStorage keys will not be included * @returns */ keys: () => string[]; /** * Delete record from storages and trigger invalidation event * @param cacheKey */ delete: (cacheKey: string) => void; /** * Invalidate cache by cacheKey or partial matching with RegExp * It emits invalidation event for each matching cacheKey and sets staleTime to 0 to indicate out of time cache * @param key - cacheKey or Request instance or RegExp for partial matching */ invalidate: (cacheKeys: string | RegExp | RequestInstance | Array) => void; /** * Used to receive data from lazy storage * @param cacheKey */ getLazyResource: (cacheKey: string) => Promise | undefined>; /** * Used to receive keys from sync storage and lazy storage * @param cacheKey */ getLazyKeys: () => Promise; /** * Used to receive keys from sync storage and lazy storage * @param cacheKey */ getAllKeys: () => Promise; /** * Schedule garbage collection for given key * @param cacheKey * @returns */ scheduleGarbageCollector: (cacheKey: string) => void; /** * Clear cache storages */ clear: () => Promise; } type CacheOptionsType = { /** * Assign your custom sync storage */ storage?: CacheStorageType; /** * Lazy loading from remote resources - possibly persistent */ lazyStorage?: CacheAsyncStorageType; /** * Key to clear lazy storage data, often used for versioning * If the new key is different from the old one, the cache will be cleared */ version?: string; }; type CacheValueType = ResponseType & ResponseDetailsType & { cacheKey: string; staleTime: number; version: string; cacheTime: number; cached: boolean; hydrated?: boolean; }; type CacheAsyncStorageType = { set: (key: string, data: CacheValueType) => Promise; get: (key: string) => Promise | undefined>; keys: () => Promise | string[]>; delete: (key: string) => Promise; }; type CacheStorageType = { set: (key: string, data: CacheValueType) => void; get: (key: string) => CacheValueType | undefined; keys: () => string[] | IterableIterator | string[]; delete: (key: string) => void; clear: () => void; }; type CacheInitialData = Record; type CacheSetState = CacheData | ((previousData: CacheData | null) => CacheData); type RequestCacheType = Pick; declare const getCacheData: (previousResponse: ExtractAdapterResolvedType | undefined, response: ExtractAdapterResolvedType & ResponseDetailsType) => ExtractAdapterResolvedType & ResponseDetailsType; declare const getInvalidateKey: () => string; declare const getInvalidateByKey: (key: string) => string; declare const getDeleteKey: () => string; declare const getDeleteByKey: (key: string) => string; declare const getCacheByKey: (key: string) => string; declare const getCacheKey: () => string; declare const getCacheEvents: (emitter: EventEmitter$1) => { /** * Set cache data * @param data */ emitCacheData: (data: CacheValueType & { cached: boolean; }, isTriggeredExternally?: boolean) => void; /** * Invalidate cache values event */ emitInvalidation: (cacheKey: string, isTriggeredExternally?: boolean) => void; /** * Delete of cache values */ emitDelete: (cacheKey: string, isTriggeredExternally?: boolean) => void; /** * Cache data listener * @param callback * @returns */ onData: (callback: (data: CacheValueType & { cached: boolean; }) => void) => VoidFunction; /** * Cache data listener * @param cacheKey * @param callback * @returns */ onDataByKey: (cacheKey: string, callback: (data: CacheValueType) => void) => VoidFunction; /** * Cache invalidation listener * @param callback * @returns */ onInvalidate: (callback: (cacheKey: string) => void) => VoidFunction; /** * Cache invalidation listener * @param cacheKey * @param callback * @returns */ onInvalidateByKey: (cacheKey: string, callback: () => void) => VoidFunction; onDelete: (callback: (cacheKey: string) => void) => VoidFunction; onDeleteByKey: (cacheKey: string, callback: () => void) => VoidFunction; }; type HydrationOptions = RequestCacheType & { override: boolean; }; type HydrateDataType = HydrationOptions & { /** Hydration timestamp */ timestamp: number; /** Hydrated response */ response: ResponseType; /** Hydrated flag */ hydrated: true; }; declare const getAdapterBindings: ({ request: baseRequest, requestId, resolve, onStartTime, internalErrorMapping, }: { request: RequestInstance; requestId: string; resolve: (value: ResponseSuccessType | ResponseErrorType) => void; onStartTime: (timestamp: number) => void; internalErrorMapping: (error: ReturnType) => any; }) => Promise<{ request: RequestInstance; requestId: string; url: string; endpoint: any; queryParams: any; payload: any; headers: any; adapter: AdapterInstance; adapterOptions: ExtractAdapterOptionsType | undefined; getAbortController: () => AbortController | undefined; getRequestStartTimestamp: () => number | null; getResponseStartTimestamp: () => number | null; createAbortListener: ({ status, extra, onAbort, }: { status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; onAbort?: () => void; }) => () => void; onBeforeRequest: () => void; onRequestStart: (progress?: ProgressDataType) => number; onRequestProgress: (progress: ProgressDataType) => number; onRequestEnd: () => number; onResponseStart: (progress?: ProgressDataType) => number; onResponseProgress: (progress: ProgressDataType) => number; onResponseEnd: () => number; onSuccess: ({ data, error, status, extra, }: { data: any; status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; error?: ExtractErrorType; }) => Promise, T>>; onAbortError: ({ status, extra, }: { status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; }) => Promise>; onTimeoutError: ({ status, extra, }: { status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; }) => Promise>; onUnexpectedError: ({ status, extra, }: { status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; }) => Promise>; onError: ({ error, status, extra, }: { error: any; status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; }) => Promise>; }>; declare function getAdapterOnError({ request, requestId, startTime, resolve, logger, }: { request: RequestInstance; requestId: string; startTime: number; logger: LoggerMethods; resolve: (value: ResponseSuccessType | ResponseErrorType) => void; }): ({ error, status, extra, }: { error: any; status: ExtractAdapterStatusType; extra: ExtractAdapterExtraType; }) => Promise>; /** * Base Adapter */ type AdapterInstance = Adapter; type AdapterGenericType, QueryParams = QueryParamsType | string | EmptyTypes, DefaultQueryParams = undefined, EndpointType = string, EndpointMapperType extends EndpointMapper | DefaultMapperType = DefaultMapperType, QueryParamsMapperType extends QueryParamsMapper | DefaultMapperType = DefaultMapperType, HeaderMapperType extends HeaderMappingType | DefaultMapperType = DefaultMapperType, PayloadMapperType extends AdapterPayloadMappingType | DefaultMapperType = DefaultMapperType> = { adapterOptions: AdapterOptions; methodType: MethodType; statusType: StatusType; extra: Extra; queryParams?: QueryParams; defaultQueryParams?: DefaultQueryParams; endpointType: EndpointType; endpointMapperType?: EndpointMapperType; queryParamsMapperType?: QueryParamsMapperType; headerMapperType?: HeaderMapperType; payloadMapperType?: PayloadMapperType; }; type DeclareAdapterType> = Adapter, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, NonNullable>>; type AdapterFetcherType = (options: Omit>>, "payload"> & { url: string; endpoint: ReturnType>; queryParams: ReturnType>; headers: ReturnType>; payload: ReturnType>; requestId: string; request: RequestInstance; }) => void; type HeaderMappingType = (request: RequestInstance, config?: Config) => HeadersInit; type EndpointMapper = (endpoint: EndpointType, config?: Config) => string; type QueryParamsMapper = (queryParams: QueryParams | EmptyTypes, config?: Config) => any; type AdapterPayloadMappingType = (options: { request: RequestInstance; payload: unknown; }, config?: Config) => any; type DefaultEndpointMapper = (endpoint: string) => string; type DefaultQueryParamsMapper = (queryParams: QueryParamsType | string | EmptyTypes) => QueryParamsType | string | EmptyTypes; type DefaultHeaderMapper = (request: RequestInstance) => HeadersInit; type DefaultPayloadMapper = (options: { request: RequestInstance; payload: unknown; }) => string; type QueryParamValuesType = number | string | boolean | null | undefined | Record; type QueryParamType = QueryParamValuesType | Array | Record; type QueryParamsType = Record; type RequestResponseType = { data: ExtractResponseType | null; error: ExtractErrorType | null; status: ExtractAdapterStatusType> | null; success: true | false; extra: ExtractAdapterExtraType> | null; responseTimestamp: number; requestTimestamp: number; }; type ResponseType = { data: GenericDataType | null; error: GenericErrorType | null; status: ExtractAdapterStatusType | null; success: true | false; extra: ExtractAdapterExtraType | null; responseTimestamp: number; requestTimestamp: number; }; type ResponseSuccessType = { data: GenericDataType; error: null; status: ExtractAdapterStatusType | null; success: true; extra: ExtractAdapterExtraType | null; responseTimestamp: number; requestTimestamp: number; }; type ResponseErrorType = { data: null; error: GenericErrorType; status: ExtractAdapterStatusType | null; success: false; extra: ExtractAdapterExtraType | null; responseTimestamp: number; requestTimestamp: number; }; type ProgressDataType = { /** Total size in bytes */ total?: number; /** Loaded size in bytes */ loaded?: number; }; type ProgressType = { /** Progress in percentage (0-100) */ progress: number; /** Time left in seconds (null if not available) */ timeLeft: number | null; /** Size left in bytes */ sizeLeft: number; /** Total size in bytes */ total: number; /** Loaded size in bytes */ loaded: number; /** Start timestamp in milliseconds */ startTimestamp: number; }; declare class TimeoutError extends Error { constructor(); } declare class AbortError extends Error { constructor(); } declare class DeletedError extends Error { constructor(); } declare class RequestProcessingError extends Error { description?: string; constructor(description?: string); } declare class UnexpectedError extends Error { description?: string; constructor(description?: string); } declare const getErrorMessage: (errorCase?: "timeout" | "abort" | "deleted" | "processing" | "unexpected") => TimeoutError | AbortError | DeletedError | RequestProcessingError | UnexpectedError; declare const stringifyValue: (response: string | unknown) => string; declare const getAdapterHeaders: (request: RequestInstance) => HeadersInit; declare const getAdapterPayload: (data: unknown) => string | FormData; type DefaultMapperType = (value: V, config: C) => V; declare const defaultMapper: DefaultMapperType; declare class Adapter, QueryParams = QueryParamsType | string | EmptyTypes, DefaultQueryParams = undefined, EndpointType = string, EndpointMapperType extends EndpointMapper | DefaultMapperType = DefaultMapperType, QueryParamsMapperType extends QueryParamsMapper | DefaultMapperType = DefaultMapperType, HeaderMapperType extends HeaderMappingType | DefaultMapperType = DefaultMapperType, PayloadMapperType extends AdapterPayloadMappingType | DefaultMapperType = DefaultMapperType> { options: { name: string; defaultMethod: MethodType; defaultExtra: Extra; systemErrorStatus: StatusType; systemErrorExtra: Extra; defaultRequestOptions?: RequestOptionsType; }; /** Fetching function */ unstable_fetcher: AdapterFetcherType>; /** * ******************** * Defaults * ******************** */ name: string; defaultMethod: MethodType; defaultExtra: Extra; systemErrorStatus: StatusType; systemErrorExtra: Extra; defaultRequestOptions?: RequestOptionsType; logger: LoggerMethods; initialized: boolean; client: ClientInstance; unstable_onInitializeCallback?: (options: { client: ClientInstance; }) => void; unstable_queryParamsMapperConfig: Parameters[1]; unstable_headerMapperConfig: Parameters[1]; unstable_payloadMapperConfig: Parameters[1]; unstable_endpointMapperConfig: Parameters[1]; constructor(options: { name: string; defaultMethod: MethodType; defaultExtra: Extra; systemErrorStatus: StatusType; systemErrorExtra: Extra; defaultRequestOptions?: RequestOptionsType; }); initialize: (client: ClientInstance) => this; onInitialize: (callback: (options: { client: ClientInstance; }) => void) => this; /** * ******************** * Options Setters * ******************** */ unstable_internalErrorMapping: (error: ReturnType) => any; /** Method to get default headers and to map them based on the data format exchange, by default it handles FormData / JSON formats. */ unstable_headerMapper: HeaderMapperType; /** Method to get request data and transform them to the required format. It handles FormData and JSON by default. */ unstable_payloadMapper: PayloadMapperType; /** Method to get the endpoint for the adapter request. */ unstable_endpointMapper: EndpointMapperType; /** Method to get request data and transform them to the required format. */ unstable_queryParamsMapper: QueryParamsMapperType; /** Get default adapter options for the request. */ unstable_getAdapterDefaults?: (request: ExtendRequest>; }>) => AdapterOptions; /** Get default request options for the request. */ unstable_getRequestDefaults?: (options: RequestOptionsType) => Partial>; /** * Get formatted endpoint name of the request. * Helpful in displaying long endpoints like in case of graphql schemas etc. */ unstable_devtoolsEndpointGetter: (endpoint: string) => string; /** * ******************** * Methods * ******************** */ setDefaultMethod: (method: MethodType) => this; setDefaultExtra: (extra: Extra) => this; setDevtoolsEndpointGetter: (callback: (endpoint: string) => string) => this; /** * This method allows to configure global defaults for the request configuration like method, auth, deduplication etc. */ setRequestDefaults: (callback: typeof this.unstable_getRequestDefaults) => this; /** * Set the adapter default options added to every sent request */ setAdapterDefaults: (callback: (request: ExtendRequest>; }>) => AdapterOptions) => this; setInternalErrorMapping: (callback: (error: ReturnType) => any) => this; /** * Set the custom header mapping function */ setHeaderMapper: (headerMapper: NewMapper) => Adapter; /** * Set the request payload mapping function which gets triggered before request is send */ setPayloadMapper: (payloadMapper: NewMapper) => Adapter; /** * Set the request payload mapping function which get triggered before request get sent */ setEndpointMapper: >(endpointMapper: NewEndpointMapper) => Adapter; /** * Set the query params mapping function which get triggered before request get sent */ setQueryParamsMapper: >(queryParamsMapper: NewQueryParamsMapper) => Adapter; setQueryParamsMapperConfig: [1]>(config: NewQueryParamsMapperConfig) => this; setHeaderMapperConfig: [1]>(config: NewHeaderMapperConfig) => this; setEndpointMapperConfig: [1]>(config: NewEndpointMapperConfig) => this; setPayloadMapperConfig: [1]>(config: NewPayloadMapperConfig) => this; /** * ******************** * Fetching * ******************** */ setFetcher(fetcher: AdapterFetcherType>): this; fetch(request: ExtendRequest>; }>, requestId: string): Promise>; } declare const mocker: ({ request, requestId, onError, onResponseEnd, onTimeoutError, onRequestEnd, createAbortListener, onResponseProgress, onRequestProgress, onResponseStart, onBeforeRequest, onRequestStart, onSuccess, onAbortError, adapter, }: Awaited>>) => Promise; type PartialBy = Omit & Partial>; type MockerConfigType = { /** Informs how long the request should take before returning a timeout error (in milliseconds) */ timeout?: number; /** Simulates how long the request to the server should take (in milliseconds) */ requestTime?: number; /** Indicates how long the response from the server should take (in milliseconds). * If their combined total takes longer than provided timeout, each value will be automatically * adjusted to last half of the timeout time */ responseTime?: number; /** total number of 'bytes' to be uploaded. */ totalUploaded?: number; /** total number of 'bytes' to be downloaded. */ totalDownloaded?: number; }; type MockResponseType = PartialBy, "data" | "error" | "responseTimestamp" | "requestTimestamp">, "extra" | "success"> & ({ data: Response; error?: Error; } | { data?: Response; error: Error; }); /** * Request is a class that represents a request sent to the server. It contains all the necessary information to make a request, like endpoint, method, headers, data, and much more. * It is executed at any time via methods like `send` or `exec`. * * We can set it up with options like endpoint, method, headers and more. * We can choose some of advanced settings like cache, invalidation patterns, concurrency, retries and much, much more. * * @info We should not use this class directly in the standard development flow. * We can initialize it using the `createRequest` method on the **Client** class. * * @attention The most important thing about the request is that it keeps data in the format that can be dumped. * This is necessary for the persistence and different dispatcher storage types. * This class doesn't have any callback methods by design and communicate with dispatcher and cache by events. * * It should be serializable to JSON and deserializable back to the class. * Serialization should not affect the result of the request, so it's methods and functional part should be only syntax sugar for given runtime. */ declare class Request { readonly client: Client; readonly requestOptions: RequestOptionsType>, ExtractAdapterMethodType>>; readonly initialRequestConfiguration?: RequestConfigurationType : never, QueryParams, Endpoint, ExtractAdapterOptionsType>, ExtractAdapterMethodType>> | undefined; endpoint: Endpoint; headers?: HeadersInit; auth: boolean; method: ExtractAdapterMethodType>; params: ExtractUrlParams | EmptyTypes; payload: PayloadType; queryParams: QueryParams | EmptyTypes; options?: ExtractAdapterOptionsType> | undefined; cancelable: boolean; retry: number; retryTime: number; cacheTime: number; cache: boolean; staleTime: number; queued: boolean; offline: boolean; abortKey: string; cacheKey: string; queryKey: string; used: boolean; deduplicate: boolean; deduplicateTime: number | null; isMockerEnabled: boolean; unstable_mock?: { fn: (options: { request: RequestInstance; requestId: string; }) => MockResponseType, ExtractClientAdapterType>; config: MockerConfigType; }; /** @internal */ unstable_payloadMapper?: PayloadMapperType; /** @internal */ unstable_requestMapper?: RequestMapper; /** @internal */ unstable_responseMapper?: ResponseMapper | ResponseErrorType>; unstable_hasParams: HasParams; unstable_hasPayload: HasPayload; unstable_hasQuery: HasQuery; private updatedAbortKey; private updatedCacheKey; private updatedQueryKey; constructor(client: Client, requestOptions: RequestOptionsType>, ExtractAdapterMethodType>>, initialRequestConfiguration?: RequestConfigurationType : never, QueryParams, Endpoint, ExtractAdapterOptionsType>, ExtractAdapterMethodType>> | undefined); setHeaders: (headers: HeadersInit) => Request; setAuth: (auth: boolean) => Request; setParams:

>(params: P) => Request; setPayload:

(payload: P) => Request; setQueryParams: (queryParams: QueryParams) => Request; setOptions: (options: ExtractAdapterOptionsType>) => Request; setCancelable: (cancelable: boolean) => Request; setRetry: (retry: RequestOptionsType>, ExtractAdapterMethodType>>["retry"]) => Request; setRetryTime: (retryTime: RequestOptionsType>, ExtractAdapterMethodType>>["retryTime"]) => Request; setCacheTime: (cacheTime: RequestOptionsType>, ExtractAdapterMethodType>>["cacheTime"]) => Request; setCache: (cache: RequestOptionsType>, ExtractAdapterMethodType>>["cache"]) => Request; setStaleTime: (staleTime: RequestOptionsType>, ExtractAdapterMethodType>>["staleTime"]) => Request; setQueued: (queued: boolean) => Request; setAbortKey: (abortKey: string) => Request; setCacheKey: (cacheKey: string) => Request; setQueryKey: (queryKey: string) => Request; setDeduplicate: (deduplicate: boolean) => Request; setDeduplicateTime: (deduplicateTime: number) => Request; setUsed: (used: boolean) => Request; setOffline: (offline: boolean) => Request; setMock: (fn: (options: { request: Request; requestId: string; }) => SyncOrAsync, ExtractClientAdapterType>>, config?: MockerConfigType) => this; clearMock: () => this; setMockingEnabled: (isMockerEnabled: boolean) => this; /** * Map data before it gets send to the server * @param payloadMapper * @returns */ setPayloadMapper: >(payloadMapper: (data: Payload) => MappedPayload) => Request; /** * Map request before it gets send to the server * @param requestMapper mapper of the request * @returns new request */ setRequestMapper: (requestMapper: RequestMapper) => Request; /** * Map the response to the new interface * @param responseMapper our mapping callback * @returns new response */ setResponseMapper: | ResponseErrorType>(responseMapper?: ResponseMapper) => Request ? R : Response, Payload, QueryParams, MappedResponse extends ResponseType ? E : LocalError, Endpoint, Client, HasPayload, HasParams, HasQuery>; private paramsMapper; toJSON(): RequestJSON; clone(configuration?: RequestConfigurationType>, ExtractAdapterMethodType>>): Request; abort: () => Request; dehydrate: (config?: { /** in case of using adapter without cache we can provide response to dehydrate */ response?: ResponseType, ExtractClientAdapterType>; /** override cache data */ override?: boolean; }) => HydrateDataType, ExtractClientAdapterType> | undefined; /** * Read the response from cache data * * If it returns error and data at the same time, it means that latest request was failed * and we show previous data from cache together with error received from actual request */ read(): ResponseType, ExtractClientAdapterType> | undefined; /** * Method to use the request WITHOUT adding it to cache and queues. This mean it will make simple request without queue side effects. * @param options * @disableReturns * @returns * ```tsx * Promise<[Data | null, Error | null, HttpStatus]> * ``` */ exec: RequestSendType; /** * Method used to perform requests with usage of cache and queues * @param options * @param requestCallback * @disableReturns * @returns * ```tsx * Promise<[Data | null, Error | null, HttpStatus]> * ``` */ send: RequestSendType; static fromJSON: (client: NewClient, json: RequestJSON>) => Request; } type RequestInstanceProperties = { response?: any; payload?: any; error?: any; client?: ClientInstance; queryParams?: any; endpoint?: string; hasParams?: boolean; hasQueryParams?: boolean; hasPayload?: boolean; }; type RequestInstance = Request, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults, TypeWithDefaults>; type ProgressEventType = { total: number; loaded: number; }; /** * Dump of the request used to later recreate it */ type RequestJSON = { requestOptions: RequestOptionsType, ExtractAdapterOptionsType>, ExtractAdapterMethodType>>; endpoint: ExtractEndpointType; method: ExtractAdapterMethodType>; headers?: HeadersInit; auth: boolean; cancelable: boolean; retry: number; retryTime: number; cacheTime: number; cache: boolean; staleTime: number; queued: boolean; offline: boolean; disableResponseInterceptors: boolean | undefined; disableRequestInterceptors: boolean | undefined; options?: ExtractAdapterOptionsType>; payload: PayloadType>; params: ExtractParamsType | EmptyTypes; queryParams: ExtractQueryParamsType | EmptyTypes; abortKey: string; cacheKey: string; queryKey: string; used: boolean; updatedAbortKey: boolean; updatedCacheKey: boolean; updatedQueryKey: boolean; deduplicate: boolean; deduplicateTime: number | null; isMockerEnabled: boolean; hasMock: boolean; }; /** * Configuration options for request creation */ type RequestOptionsType = { /** * Determine the endpoint for request request */ endpoint: GenericEndpoint; /** * Custom headers for request */ headers?: HeadersInit; /** * Should the onAuth method get called on this request */ auth?: boolean; /** * Request method picked from method names handled by adapter * With default adapter it is GET | POST | PATCH | PUT | DELETE */ method?: RequestMethods; /** * Should enable cancelable mode in the Dispatcher */ cancelable?: boolean; /** * Retry count when request is failed */ retry?: number; /** * Retry time delay between retries */ retryTime?: number; /** * Should we trigger garbage collection or leave data in memory */ cacheTime?: number; /** * Should we save the response to cache */ cache?: boolean; /** * Time for which the cache is considered up-to-date */ staleTime?: number; /** * Should the requests from this request be send one-by-one */ queued?: boolean; /** * Do we want to store request made in offline mode for latter use when we go back online */ offline?: boolean; /** * Disable post-request interceptors */ disableResponseInterceptors?: boolean; /** * Disable pre-request interceptors */ disableRequestInterceptors?: boolean; /** * Additional options for your adapter, by default XHR options */ options?: AdapterOptions; /** * Key which will be used to cancel requests. Autogenerated by default. */ abortKey?: string; /** * Key which will be used to cache requests. Autogenerated by default. */ cacheKey?: string; /** * Key which will be used to queue requests. Autogenerated by default. */ queryKey?: string; /** * Should we deduplicate two requests made at the same time into one */ deduplicate?: boolean; /** * Time of pooling for the deduplication to be active (default 10ms) */ deduplicateTime?: number; }; type PayloadMapperType = (payload: Payload) => NewDataType; type PayloadType = Payload | EmptyTypes; type RequestConfigurationType = { used?: boolean; params?: Params | EmptyTypes; queryParams?: QueryParams | EmptyTypes; payload?: PayloadType; headers?: HeadersInit; updatedAbortKey?: boolean; updatedCacheKey?: boolean; updatedQueryKey?: boolean; updatedEffectKey?: boolean; } & Partial>>; type ParamType = string | number; type ParamsType = Record; type ExtractUrlParams = string extends T ? EmptyTypes : T extends `${string}:${infer Param}/${infer Rest}` ? { [k in Param | keyof ExtractUrlParams]: ParamType; } : T extends `${string}:${infer Param}` ? { [k in Param]: ParamType; } : EmptyTypes; /** * If the request endpoint parameters are not filled it will throw an error */ type FetchParamsType = Params extends EmptyTypes | void | never ? { params?: EmptyTypes; } : HasParams extends true ? { params?: EmptyTypes; } : { params: Params; }; /** * If the request data is not filled it will throw an error */ type FetchPayloadType = Payload extends EmptyTypes | void | never ? { payload?: EmptyTypes; } : HasPayload extends true ? { payload?: EmptyTypes; } : { payload: Payload; }; /** * It will check if the query params are already set */ type FetchQueryParamsType = HasQuery extends true ? { queryParams?: EmptyTypes | undefined; } : HasQuery extends true ? { queryParams?: EmptyTypes; } : QueryParams extends EmptyTypes | void | never ? { queryParams?: QueryParams; } : { queryParams: QueryParams; }; type RequestDynamicSendOptionsType = Omit>>>, "params" | "data" | "endpoint" | "method"> & { dispatcherType?: "auto" | "fetch" | "submit"; }; type RequestSendOptionsType = FetchQueryParamsType, ExtractHasQueryParamsType> & FetchParamsType, ExtractHasParamsType> & FetchPayloadType, ExtractHasPayloadType> & FetchQueryParamsType, ExtractHasQueryParamsType> & RequestSendActionsType & RequestDynamicSendOptionsType; type RequestSendActionsType = { onBeforeSent?: (eventData: RequestEventType) => void; onRequestStart?: (eventData: RequestEventType) => void; onResponseStart?: (eventData: RequestEventType) => void; onUploadProgress?: (eventData: RequestProgressEventType) => void; onDownloadProgress?: (eventData: RequestProgressEventType) => void; onResponse?: (eventData: RequestResponseEventType) => void; onRemove?: (eventData: RequestEventType) => void; }; type IsNegativeType = void extends T ? EmptyTypes : undefined extends T ? EmptyTypes : null extends T ? EmptyTypes : T; type RequestSendType = IsNegativeType["payload"]> extends EmptyTypes | void | never ? IsNegativeType["params"]> extends EmptyTypes | void | never ? IsNegativeType["queryParams"]> extends EmptyTypes | void | never ? (options?: RequestSendOptionsType) => Promise> : (options: RequestSendOptionsType) => Promise> : (options: RequestSendOptionsType) => Promise> : (options: RequestSendOptionsType) => Promise>; type RequestMapper = (request: Request, requestId: string) => NewRequest | Promise; type ResponseMapper | ResponseErrorType> = (response: ResponseSuccessType, ExtractAdapterType> | ResponseErrorType, ExtractAdapterType>) => MappedResponse | Promise; declare enum DispatcherMode { ONE_BY_ONE = "one-by-one", ALL_AT_ONCE = "all-at-once", PREVIOUS_CANCELED = "previous-canceled", DEDUPLICATED = "deduplicated" } declare const getDispatcherEvents: (emitter: EventEmitter$1) => { emitDrained: (values: QueueDataType, isTriggeredExternally?: boolean) => void; emitQueueStatusChanged: (values: QueueDataType, isTriggeredExternally?: boolean) => void; emitQueueChanged: (values: QueueDataType, isTriggeredExternally?: boolean) => void; /** * When queue becomes empty * @param callback * @returns */ onDrained: (callback: (values: QueueDataType) => void) => VoidFunction; /** * When queue becomes empty * @param queryKey * @param callback * @returns */ onDrainedByKey: (queryKey: string, callback: (values: QueueDataType) => void) => VoidFunction; /** * When queue status change from enabled to paused or vice versa * @param callback * @returns */ onQueueStatusChange: (callback: (values: QueueDataType) => void) => VoidFunction; /** * When queue status change from enabled to paused or vice versa * @param queryKey * @param callback * @returns */ onQueueStatusChangeByKey: (queryKey: string, callback: (values: QueueDataType) => void) => VoidFunction; /** * When new elements are added or removed from the queue * @param queryKey * @param callback * @returns */ onQueueChange: (callback: (values: QueueDataType) => void) => VoidFunction; /** * When new elements are added or removed from the queue * @param queryKey * @param callback * @returns */ onQueueChangeByKey: (queryKey: string, callback: (values: QueueDataType) => void) => VoidFunction; }; /** * Dispatcher controls and manages the requests that are going to be executed with adapter. It manages them based on the options provided with request. * This class can also run them with different modes like deduplication, cancelation, queueing or run-all-at-once mode. With it's help we can pause, * stop, start and cancel requests. */ declare class Dispatcher { options?: DispatcherOptionsType | undefined; emitter: EventEmitter; events: { emitDrained: (values: QueueDataType, isTriggeredExternally?: boolean) => void; emitQueueStatusChanged: (values: QueueDataType, isTriggeredExternally?: boolean) => void; emitQueueChanged: (values: QueueDataType, isTriggeredExternally?: boolean) => void; onDrained: (callback: (values: QueueDataType) => void) => VoidFunction; onDrainedByKey: (queryKey: string, callback: (values: QueueDataType) => void) => VoidFunction; onQueueStatusChange: (callback: (values: QueueDataType) => void) => VoidFunction; onQueueStatusChangeByKey: (queryKey: string, callback: (values: QueueDataType) => void) => VoidFunction; onQueueChange: (callback: (values: QueueDataType) => void) => VoidFunction; onQueueChangeByKey: (queryKey: string, callback: (values: QueueDataType) => void) => VoidFunction; }; storage: DispatcherStorageType; private requestCount; private runningRequests; private logger; private client; constructor(options?: DispatcherOptionsType | undefined); initialize: (client: ClientInstance<{ adapter: Adapter; }>) => this; /** * Start request handling by queryKey */ start: (queryKey: string) => void; /** * Pause request queue, but do not cancel already started requests */ pause: (queryKey: string) => void; /** * Stop request queue and cancel all started requests - those will be treated like not started */ stop: (queryKey: string) => void; /** * Return all */ getQueuesKeys: () => string[]; /** * Return queue state object */ getQueue: (queryKey: string) => QueueDataType; /** * Return request from queue state */ getRequest: (queryKey: string, requestId: string) => QueueItemType | undefined; /** * Get value of the active queue status based on the stopped status */ getIsActiveQueue: (queryKey: string) => boolean; /** * Add new element to storage */ addQueueItem: (queryKey: string, element: QueueItemType) => void; /** * Set new queue storage value */ setQueue: (queryKey: string, queue: QueueDataType) => QueueDataType; /** * Clear requests from queue cache */ clearQueue: (queryKey: string) => { queryKey: string; requests: never[]; stopped: boolean; }; /** * Method used to flush the queue requests */ flushQueue: (queryKey: string) => Promise; /** * Flush all available requests from all queues */ flush: () => Promise; /** * Clear all running requests and storage */ clear: () => void; /** * Start particular request */ startRequest: (queryKey: string, requestId: string) => void; /** * Stop particular request */ stopRequest: (queryKey: string, requestId: string) => void; /** * Get currently running requests from all queryKeys */ getAllRunningRequests: () => RunningRequestValueType[]; /** * Get currently running requests */ getRunningRequests: (queryKey: string) => RunningRequestValueType[]; /** * Get running request by id */ getRunningRequest: (queryKey: string, requestId: string) => RunningRequestValueType | undefined; /** * Add request to the running requests list */ addRunningRequest: (queryKey: string, requestId: string, request: RequestInstance) => RunningRequestValueType; /** * Get the value based on the currently running requests */ hasRunningRequests: (queryKey: string) => boolean; /** * Check if request is currently processing */ hasRunningRequest: (queryKey: string, requestId: string) => boolean; /** * Cancel all started requests, but do NOT remove it from main storage */ cancelRunningRequests: (queryKey: string) => void; /** * Cancel started request, but do NOT remove it from main storage */ cancelRunningRequest: (queryKey: string, requestId: string) => void; /** * Delete all started requests, but do NOT clear it from queue and do NOT cancel them */ deleteRunningRequests: (queryKey: string) => void; /** * Delete request by id, but do NOT clear it from queue and do NOT cancel them */ deleteRunningRequest: (queryKey: string, requestId: string) => void; /** * Get count of requests from the same queryKey */ getQueueRequestCount: (queryKey: string) => number; /** * Add request count to the queryKey */ incrementQueueRequestCount: (queryKey: string) => void; /** * Create storage element from request */ createStorageItem: (request: Request) => QueueItemType; /** * Add request to the dispatcher handler */ add: (request: RequestInstance) => string; /** * Delete from the storage and cancel request */ delete: (queryKey: string, requestId: string, abortKey: string) => QueueDataType | undefined; /** * Request can run for some time, once it's done, we have to check if it's successful or if it was aborted * It can be different once the previous call was set as cancelled and removed from queue before this request got resolved */ performRequest: (storageItem: QueueItemType) => Promise>; } type DispatcherOptionsType = { storage?: DispatcherStorageType; }; type QueueItemType = { requestId: string; request: Request; retries: number; timestamp: number; stopped: boolean; /** Resolved when we receive response */ resolved: boolean; }; type QueueDataType = { queryKey: string; requests: QueueItemType[]; stopped: boolean; }; type DispatcherStorageType = { set: (key: string, data: QueueDataType) => void; get: (key: string) => QueueDataType | undefined; keys: () => string[] | IterableIterator; entries: () => [string, QueueDataType] | IterableIterator<[string, QueueDataType]>; delete: (key: string) => void; clear: () => void; }; type RunningRequestValueType = { requestId: string; request: RequestInstance; timestamp: number; }; declare const getDispatcherDrainedKey: () => string; declare const getDispatcherDrainedByKey: (key: string) => string; declare const getDispatcherStatusKey: () => string; declare const getDispatcherStatusByKey: (key: string) => string; declare const getDispatcherChangeKey: () => string; declare const getDispatcherChangeByKey: (key: string) => string; declare const getIsEqualTimestamp: (currentTimestamp: number, threshold: number, queueTimestamp?: number) => boolean; declare const canRetryRequest: (currentRetries: number, retry: number | undefined) => boolean; declare const getRequestType: (request: RequestInstance, latestRequest: QueueItemType | undefined) => DispatcherMode; declare const stringifyKey: (value: unknown) => string; declare const getProgressValue: ({ loaded, total }: ProgressEventType) => number; declare const getRequestEta: (startDate: Date, progressDate: Date, { total, loaded }: ProgressEventType) => { sizeLeft: number; timeLeft: number | null; }; declare const getProgressData: (requestStartTime: Date, progressDate: Date, progressEvent: ProgressEventType) => ProgressType; declare const getSimpleKey: (request: RequestInstance | RequestJSON) => 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 */ declare const getRequestKey: (request: RequestInstance | RequestJSON, useInitialValues?: boolean) => string; declare const getRequestDispatcher: (request: Request, dispatcherType?: "auto" | "fetch" | "submit") => [Dispatcher>, isFetchDispatcher: boolean]; declare const sendRequest: (request: Request, options?: RequestSendOptionsType) => Promise>; declare const getUniqueRequestId: (request: Pick) => string; declare class EventEmitter extends EventEmitter$1 { emitCallbacks: Array<(event: string, data: any, isTriggeredExternally?: true) => void>; constructor(options?: ConstructorParameters[0]); emit(type: string, data: any, isTriggeredExternally: boolean): boolean; onEmit: (callback: (event: string, data: any, isTriggeredExternally?: true) => void) => () => void; onListener: (event: string, listener: (count: number) => void) => () => void; on: (event: string | symbol, listener: (...args: any[]) => void) => this; off: (event: string | symbol, listener: (...args: any[]) => void) => this; addListener: (event: string | symbol, listener: (...args: any[]) => void) => this; removeListener: (event: string | symbol, listener: (...args: any[]) => void) => this; } /** * App manager handles main application states - focus and online. Those two values can answer questions: * - Is the tab or current view instance focused and visible for user? * - Is our application online or offline? * With the app manager it is not a problem to get the valid answer for this question. * * @caution * Make sure to apply valid focus/online handlers for different environments like for example for native mobile applications. */ declare class AppManager { options?: AppManagerOptionsType | undefined; emitter: EventEmitter; events: { emitFocus: () => void; emitBlur: () => void; emitOnline: () => void; emitOffline: () => void; onFocus: (callback: () => void) => VoidFunction; onBlur: (callback: () => void) => VoidFunction; onOnline: (callback: () => void) => VoidFunction; onOffline: (callback: () => void) => VoidFunction; }; isBrowser: boolean; isOnline: boolean; isFocused: boolean; constructor(options?: AppManagerOptionsType | undefined); initialize: () => void; private setInitialFocus; private setInitialOnline; setFocused: (isFocused: boolean) => void; setOnline: (isOnline: boolean) => void; } type AppManagerOptionsType = { initiallyFocused?: boolean | (() => boolean | Promise); initiallyOnline?: boolean | (() => boolean | Promise); focusEvent?: (setFocused: (isFocused: boolean) => void) => void; onlineEvent?: (setOnline: (isOnline: boolean) => void) => void; }; declare const hasWindow: () => boolean; declare const hasDocument: () => boolean; declare const onWindowEvent: (key: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined) => VoidFunction; declare const onDocumentEvent: (key: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined) => VoidFunction; declare const getAppManagerEvents: (emitter: EventEmitter$1) => { emitFocus: () => void; emitBlur: () => void; emitOnline: () => void; emitOffline: () => void; onFocus: (callback: () => void) => VoidFunction; onBlur: (callback: () => void) => VoidFunction; onOnline: (callback: () => void) => VoidFunction; onOffline: (callback: () => void) => VoidFunction; }; declare enum AppEvents { FOCUS = "focus", BLUR = "blur", ONLINE = "online", OFFLINE = "offline" } declare const appManagerInitialOptions: RequiredKeys; /** * **Request Manager** is used to emit `request lifecycle events` like - request start, request end, upload and download progress. * It is also the place of `request aborting` system, here we store all the keys and controllers that are isolated for each client instance. */ declare class RequestManager { emitter: EventEmitter; events: { emitDeduplicated: (data: RequestDeduplicatedEventType, isTriggeredExternally?: boolean) => void; emitLoading: (data: RequestLoadingEventType, isTriggeredExternally?: boolean) => void; emitRequestStart: (data: RequestEventType, isTriggeredExternally?: boolean) => void; emitResponseStart: (data: RequestEventType, isTriggeredExternally?: boolean) => void; emitUploadProgress: (data: RequestProgressEventType, isTriggeredExternally?: boolean) => void; emitDownloadProgress: (data: RequestProgressEventType, isTriggeredExternally?: boolean) => void; emitResponse: (data: RequestResponseEventType; }>>, isTriggeredExternally?: boolean) => void; emitAbort: (data: RequestEventType, isTriggeredExternally?: boolean) => void; emitRemove: (data: RequestRemovedEventType, isTriggeredExternally?: boolean) => void; onDeduplicated: (callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onDeduplicatedByQueue: (queryKey: string, callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onDeduplicatedByCache: (cacheKey: string, callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onDeduplicatedById: (requestId: string, callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onLoading: (callback: (data: RequestLoadingEventType) => void) => VoidFunction; onLoadingByQueue: (queryKey: string, callback: (data: RequestLoadingEventType) => void) => VoidFunction; onLoadingByCache: (cacheKey: string, callback: (data: RequestLoadingEventType) => void) => VoidFunction; onLoadingById: (requestId: string, callback: (data: RequestLoadingEventType) => void) => VoidFunction; onRequestStart: (callback: (details: RequestEventType) => void) => VoidFunction; onRequestStartByQueue: (queryKey: string, callback: (details: RequestEventType) => void) => VoidFunction; onRequestStartById: (requestId: string, callback: (details: RequestEventType) => void) => VoidFunction; onResponseStart: (callback: (details: RequestEventType) => void) => VoidFunction; onResponseStartByQueue: (queryKey: string, callback: (details: RequestEventType) => void) => VoidFunction; onResponseStartById: (requestId: string, callback: (details: RequestEventType) => void) => VoidFunction; onUploadProgress: (callback: (data: RequestProgressEventType) => void) => VoidFunction; onUploadProgressByQueue: (queryKey: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onUploadProgressById: (requestId: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onDownloadProgress: (callback: (data: RequestProgressEventType) => void) => VoidFunction; onDownloadProgressByQueue: (queryKey: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onDownloadProgressById: (requestId: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onResponse: (callback: (data: RequestResponseEventType) => void) => VoidFunction; onResponseByCache: (cacheKey: string, callback: (data: RequestResponseEventType) => void) => VoidFunction; onResponseById: (requestId: string, callback: (data: RequestResponseEventType) => void) => VoidFunction; onAbort: (callback: (request: RequestEventType) => void) => VoidFunction; onAbortByKey: (abortKey: string, callback: (request: RequestEventType) => void) => VoidFunction; onAbortById: (requestId: string, callback: (data: RequestEventType) => void) => VoidFunction; onRemove: (callback: (data: RequestRemovedEventType) => void) => VoidFunction; onRemoveByQueue: (queryKey: string, callback: (data: RequestRemovedEventType) => void) => VoidFunction; onRemoveById: (requestId: string, callback: (data: RequestRemovedEventType) => void) => VoidFunction; }; constructor(); abortControllers: Map>; addAbortController: (abortKey: string, requestId: string) => void; getAbortController: (abortKey: string, requestId: string) => AbortController | undefined; removeAbortController: (abortKey: string, requestId: string) => void; useAbortController: (abortKey: string, requestId: string) => void; abortByKey: (abortKey: string) => void; abortByRequestId: (abortKey: string, requestId: string) => void; abortAll: () => void; } declare const getLoadingKey: () => string; declare const getLoadingByQueryKey: (queryKey: string) => string; declare const getLoadingByCacheKey: (cacheKey: string) => string; declare const getLoadingByIdKey: (id: string) => string; declare const getRemoveKey: () => string; declare const getRemoveByQueryKey: (queryKey: string) => string; declare const getRemoveByIdKey: (id: string) => string; declare const getAbortKey: () => string; declare const getAbortByAbortKey: (abortKey: string) => string; declare const getAbortByIdKey: (id: string) => string; declare const getResponseKey: () => string; declare const getResponseByCacheKey: (cacheKey: string) => string; declare const getResponseByIdKey: (id: string) => string; declare const getRequestStartKey: () => string; declare const getRequestStarByQueryKey: (queryKey: string) => string; declare const getRequestStartByIdKey: (id: string) => string; declare const getResponseStartKey: () => string; declare const getResponseStartByQueryKey: (queryKey: string) => string; declare const getResponseStartByIdKey: (id: string) => string; declare const getUploadProgressKey: () => string; declare const getUploadProgressByQueryKey: (queryKey: string) => string; declare const getUploadProgressByIdKey: (id: string) => string; declare const getDownloadProgressKey: () => string; declare const getDownloadProgressByQueryKey: (queryKey: string) => string; declare const getDownloadProgressByIdKey: (id: string) => string; declare const getRequestDeduplicatedKey: () => string; declare const getRequestDeduplicatedByQueryKey: (queryKey: string) => string; declare const getRequestDeduplicatedByCacheKey: (cacheKey: string) => string; declare const getRequestDeduplicatedByIdKey: (id: string) => string; declare const getRequestManagerEvents: (emitter: EventEmitter$1) => { /** * Emiter */ emitDeduplicated: (data: RequestDeduplicatedEventType, isTriggeredExternally?: boolean) => void; emitLoading: (data: RequestLoadingEventType, isTriggeredExternally?: boolean) => void; emitRequestStart: (data: RequestEventType, isTriggeredExternally?: boolean) => void; emitResponseStart: (data: RequestEventType, isTriggeredExternally?: boolean) => void; emitUploadProgress: (data: RequestProgressEventType, isTriggeredExternally?: boolean) => void; emitDownloadProgress: (data: RequestProgressEventType, isTriggeredExternally?: boolean) => void; emitResponse: (data: RequestResponseEventType; }>>, isTriggeredExternally?: boolean) => void; emitAbort: (data: RequestEventType, isTriggeredExternally?: boolean) => void; emitRemove: (data: RequestRemovedEventType, isTriggeredExternally?: boolean) => void; /** * Listeners */ onDeduplicated: (callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onDeduplicatedByQueue: (queryKey: string, callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onDeduplicatedByCache: (cacheKey: string, callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onDeduplicatedById: (requestId: string, callback: (data: RequestDeduplicatedEventType) => void) => VoidFunction; onLoading: (callback: (data: RequestLoadingEventType) => void) => VoidFunction; onLoadingByQueue: (queryKey: string, callback: (data: RequestLoadingEventType) => void) => VoidFunction; onLoadingByCache: (cacheKey: string, callback: (data: RequestLoadingEventType) => void) => VoidFunction; onLoadingById: (requestId: string, callback: (data: RequestLoadingEventType) => void) => VoidFunction; onRequestStart: (callback: (details: RequestEventType) => void) => VoidFunction; onRequestStartByQueue: (queryKey: string, callback: (details: RequestEventType) => void) => VoidFunction; onRequestStartById: (requestId: string, callback: (details: RequestEventType) => void) => VoidFunction; onResponseStart: (callback: (details: RequestEventType) => void) => VoidFunction; onResponseStartByQueue: (queryKey: string, callback: (details: RequestEventType) => void) => VoidFunction; onResponseStartById: (requestId: string, callback: (details: RequestEventType) => void) => VoidFunction; onUploadProgress: (callback: (data: RequestProgressEventType) => void) => VoidFunction; onUploadProgressByQueue: (queryKey: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onUploadProgressById: (requestId: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onDownloadProgress: (callback: (data: RequestProgressEventType) => void) => VoidFunction; onDownloadProgressByQueue: (queryKey: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onDownloadProgressById: (requestId: string, callback: (data: RequestProgressEventType) => void) => VoidFunction; onResponse: (callback: (data: RequestResponseEventType) => void) => VoidFunction; onResponseByCache: (cacheKey: string, callback: (data: RequestResponseEventType) => void) => VoidFunction; onResponseById: (requestId: string, callback: (data: RequestResponseEventType) => void) => VoidFunction; onAbort: (callback: (request: RequestEventType) => void) => VoidFunction; onAbortByKey: (abortKey: string, callback: (request: RequestEventType) => void) => VoidFunction; onAbortById: (requestId: string, callback: (data: RequestEventType) => void) => VoidFunction; onRemove: (callback: (data: RequestRemovedEventType) => void) => VoidFunction; onRemoveByQueue: (queryKey: string, callback: (data: RequestRemovedEventType) => void) => VoidFunction; onRemoveById: (requestId: string, callback: (data: RequestRemovedEventType) => void) => VoidFunction; }; type RequestLoadingEventType = { loading: boolean; isRetry: boolean; isOffline: boolean; } & RequestEventType; type RequestProgressEventType = ProgressType & RequestEventType; type RequestEventType = { request: T; requestId: string; }; type RequestRemovedEventType = { request: T; requestId: string; /** @true when we receive any response, @false if removed before response is received */ resolved: boolean; }; type RequestResponseEventType = { request: T; requestId: string; response: ResponseType, ExtractErrorType, ExtractAdapterType>; details: ResponseDetailsType; }; type RequestDeduplicatedEventType = RequestEventType & { deduplicatedRequest: T; }; type ResponseDetailsType = { /** If it's retry request we can see which attempt is it */ retries: number; /** If request was canceled */ isCanceled: boolean; /** If error from offline status */ isOffline: boolean; /** When added to dispatcher's queue (pre-middleware which could take time) */ addedTimestamp: number; /** When request is picked from queue and started to be sent */ triggerTimestamp: number; /** When adapter triggers request (after all middlewares) */ requestTimestamp: number; /** When we receive response */ responseTimestamp: number; }; /** * This class is used across the Hyper Fetch library to provide unified logging system with necessary setup per each client. * We can set up the logging level based on available values. This manager enable to initialize the logging instance per individual module * like Client, Request etc. Which can give you better feedback on the logging itself. */ declare class LoggerManager { private options?; logger: LoggerType; level: LogLevel; modules: string[] | undefined; emitter: EventEmitter$1; private client; constructor(options?: LoggerOptionsType | undefined); setSeverity: (level: LogLevel) => void; setModules: (modules: string[] | undefined) => void; initialize: (client: Pick, module: string) => LoggerMethods; private log; } declare const getTime: () => string; declare const logger: LoggerType; type LogLevel = "debug" | "info" | "warning" | "error"; type LoggerOptionsType = { logger?: LoggerType; level?: LogLevel; modules?: string[]; }; type LogData> = { /** Some Message / https://google.com */ title: string; /** Some contextual data */ extra: Data; }; type LoggerArgs = LogDataTypes & { /** "debug" | "info" | "warning" | "error" */ level: LogLevel; /** Client / Request / Cache / Dispatcher / useFetch etc. */ module: string; }; type LoggerType = (data: LoggerArgs) => void; type LoggerMethods = Record void>; type LogRequestEventType = LogData<{ request: RequestInstance; [key: string]: unknown; }>; type LogResponseEventType = LogData<{ request: RequestInstance; response: ResponseType; requestId: string; [key: string]: unknown; }>; type LogSystemEventType = LogData<{ [key: string]: unknown; }>; type LogDataTypes = ({ type: "request"; } & LogRequestEventType) | ({ type: "response"; } & LogResponseEventType) | ({ type: "system"; } & LogSystemEventType); declare const logLevelOrder: LogLevel[]; declare const loggerStyles: Record; declare const loggerColors: Record; declare const getResponseHeaders: (headersString: string) => Record; declare const parseResponse: (response: string | unknown) => any; declare const handleResponse: (responseChunks: any[], responseType: HttpAdapterRequest["responseType"], responseEncoding: BufferEncoding) => any; declare const parseErrorResponse: (response: unknown) => ExtractErrorType; declare const stringifyQueryParams: (queryParams: QueryParamsType | string | EmptyTypes, options?: QueryStringifyOptionsType) => string; /** * Base Adapter */ type HttpAdapterType = DeclareAdapterType<{ adapterOptions: HttpAdapterOptionsType; methodType: HttpMethodsType; statusType: HttpStatusType; extra: HttpAdapterExtraType; queryParams: QueryParamsType | string | null; endpointType: string; queryParamsMapperType: typeof stringifyQueryParams; }>; /** * Options */ interface HttpAdapterRequest extends Omit { responseType: XMLHttpRequestResponseType | "stream"; } type HttpAdapterOptionsType = Partial; type HttpAdapterExtraType = { headers: Record; }; type HttpAdapterHeadersProps = { isFormData: boolean; headers: HeadersInit | undefined; }; type QueryStringifyOptionsType = { /** * Strict URI encoding */ strict?: boolean; /** * Encode keys and values */ encode?: boolean; /** * Array encoding type */ arrayFormat?: "bracket" | "index" | "comma" | "separator" | "bracket-separator" | "none"; /** * Array format separator */ arraySeparator?: string; /** * Skip keys with null values */ skipNull?: boolean; /** * Skip keys with empty string */ skipEmptyString?: boolean; /** * Parsing function for date type query param */ dateParser?: (value: QueryParamType) => string; /** * Parsing function for object type query param */ objectParser?: (value: QueryParamType) => string; }; type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"; declare const HttpAdapter: () => HttpAdapterType; declare const defaultTimeout: number; declare const xhrExtra: HttpAdapterExtraType; /** * **Client** is a class that allows you to configure the connection with the server and then use it to create * requests. It allows you to set global defaults for the requests configuration, query params configuration. * It is also orchestrator for all of the HyperFetch modules like Cache, Dispatcher, AppManager, LoggerManager, * RequestManager and more. */ declare class Client$1 { options: ClientOptionsType>; readonly url: string; debug: boolean; unstable_onErrorCallbacks: ResponseInterceptorType[]; unstable_onSuccessCallbacks: ResponseInterceptorType[]; unstable_onResponseCallbacks: ResponseInterceptorType[]; unstable_onAuthCallbacks: RequestInterceptorType[]; unstable_onRequestCallbacks: RequestInterceptorType[]; loggerManager: LoggerManager; requestManager: RequestManager; appManager: AppManager; adapter: Adapter; cache: Cache; fetchDispatcher: Dispatcher; submitDispatcher: Dispatcher; isMockerEnabled: boolean; plugins: PluginInstance[]; /** @internal */ unstable_abortKeyMapper: (request: RequestInstance) => string; /** @internal */ unstable_cacheKeyMapper: (request: RequestInstance) => string; /** @internal */ unstable_queryKeyMapper: (request: RequestInstance) => string; /** @internal */ unstable_requestIdMapper: (request: RequestInstance) => string; logger: LoggerMethods; constructor(options: ClientOptionsType>); /** * This method enables the logger usage and display the logs in console */ setDebug: (enabled: boolean) => Client$1; /** * Set the logger severity of the messages displayed to the console */ setLogLevel: (severity: LogLevel) => Client$1; /** * Set the new logger instance to the Client */ setLogger: (callback: (Client: ClientInstance) => LoggerManager) => Client$1; /** * Set globally if mocking should be enabled or disabled for all client requests. * @param isMockerEnabled */ setEnableGlobalMocking: (isMockerEnabled: boolean) => this; /** * Set custom http adapter to handle graphql, rest, firebase or others */ setAdapter: (adapter: NewAdapter) => Client$1; /** * Method of manipulating requests before sending the request. We can for example add custom header with token to the request which request had the auth set to true. */ onAuth: (callback: RequestInterceptorType) => Client$1; /** * Method for removing listeners on auth. * */ removeOnAuthInterceptors: (callbacks: RequestInterceptorType[]) => Client$1; /** * Method for intercepting error responses. It can be used for example to refresh tokens. */ onError: (callback: ResponseInterceptorType) => Client$1; /** * Method for removing listeners on error. * */ removeOnErrorInterceptors: (callbacks: ResponseInterceptorType[]) => Client$1; /** * Method for intercepting success responses. */ onSuccess: (callback: ResponseInterceptorType) => Client$1; /** * Method for removing listeners on success. * */ removeOnSuccessInterceptors: (callbacks: ResponseInterceptorType[]) => Client$1; /** * Method of manipulating requests before sending the request. */ onRequest: (callback: RequestInterceptorType) => Client$1; /** * Method for removing listeners on request. * */ removeOnRequestInterceptors: (callbacks: RequestInterceptorType[]) => Client$1; /** * Method for intercepting any responses. */ onResponse: (callback: ResponseInterceptorType) => Client$1; /** * Method for removing listeners on request. * */ removeOnResponseInterceptors: (callbacks: ResponseInterceptorType[]) => Client$1; /** * Add persistent plugins which trigger on the request lifecycle */ addPlugin: (plugin: PluginInstance) => this; /** * Remove plugins from Client */ removePlugin: (plugin: PluginInstance) => this; triggerPlugins: >(key: Key, data: PluginMethodParameters) => this; /** * Key setters */ setAbortKeyMapper: (callback: (request: RequestInstance) => string) => this; setCacheKeyMapper: (callback: (request: RequestInstance) => string) => this; setQueryKeyMapper: (callback: (request: RequestInstance) => string) => this; setRequestIdMapper: (callback: (request: RequestInstance) => string) => this; /** * Helper used by http adapter to apply the modifications on response error * @private */ unstable_modifyAuth: (request: RequestInstance) => Promise; /** * Private helper to run async pre-request processing * @private */ unstable_modifyRequest: (request: RequestInstance) => Promise; /** * Private helper to run async on-error response processing * @private */ unstable_modifyErrorResponse: (response: ResponseType, request: RequestInstance) => Promise>; /** * Private helper to run async on-success response processing * @private */ unstable_modifySuccessResponse: (response: ResponseType, request: RequestInstance) => Promise>; /** * Private helper to run async response processing * @private */ unstable_modifyResponse: (response: ResponseType, request: RequestInstance) => Promise>; /** * Clears the Client instance and remove all listeners on it's dependencies */ clear: () => void; /** * Hydrate your SSR cache data * @param hydrationData * @param options */ hydrate: (hydrationData: (HydrateDataType | EmptyTypes)[], options?: Partial | ((item: HydrateDataType) => Partial)) => void; /** * Create requests based on the Client setup * * @template Response Your response */ createRequest: > = {}>( /** * `createRequest` must be initialized twice(currying). * * ✅ Good: * ```ts * const request = createRequest()(params) * ``` * ⛔ Bad: * ```ts * const request = createRequest(params) * ``` * * We are using currying to achieve auto generated types for the endpoint string. * * This solution will be removed once https://github.com/microsoft/TypeScript/issues/10571 get resolved. */ _USE_DOUBLE_INITIALIZATION?: never) => , AdapterOptions extends ExtractAdapterOptionsType, MethodType extends ExtractAdapterMethodType>(params: RequestOptionsType) => Request, TypeWithDefaults, TypeWithDefaults, never>, TypeWithDefaults, TypeWithDefaults extends string ? TypeWithDefaults : any, Client$1, never>; }> extends EmptyTypes ? Adapter : ExtractUnionAdapter, never>; }>>, false, false, false>; } type ClientErrorType = Record | string; type ClientInstanceProperties = { error?: any; adapter?: AdapterInstance; }; type ClientInstance = Client$1, TypeWithDefaults>; type RequestGenericType = { response?: any; payload?: any; error?: any; queryParams?: QueryParams; endpoint?: string; params?: Record; }; /** * Configuration setup for the client */ type ClientOptionsType = { /** * Url to your server */ url: string; /** * Custom cache initialization prop */ cache?: () => C["cache"]; /** * Custom app manager initialization prop */ appManager?: () => C["appManager"]; /** * Custom fetch dispatcher initialization prop */ fetchDispatcher?: () => C["submitDispatcher"]; /** * Custom submit dispatcher initialization prop */ submitDispatcher?: () => C["fetchDispatcher"]; }; type RequestInterceptorType = (request: RequestInstance) => Promise | RequestInstance; type ResponseInterceptorType = (response: ResponseType>, request: ExtendRequest) => Promise>> | ResponseType>; type ModifyQueryParamsCallbackType = (queryParams: QueryParams) => ModifiedQueryParams; declare const interceptRequest: (interceptors: RequestInterceptorType[], request: RequestInstance) => Promise; declare const interceptResponse: (interceptors: ResponseInterceptorType[], response: ResponseType>, request: ExtendRequest) => Promise>>; declare const stringifyDefaultOptions: { readonly strict: true; readonly encode: true; readonly arrayFormat: "bracket"; readonly arraySeparator: "bracket"; readonly sort: false; readonly skipNull: true; readonly skipEmptyString: true; }; type ClientGenericType = { error?: ClientErrorType; }; declare function createClient(options: ClientOptionsType>>>): Client$1>, HttpAdapterType>; declare class Plugin { config: PluginOptionsType; name: string; data: PluginData; client: Client | undefined; private pluginMethods; constructor(config: PluginOptionsType); initialize: (client: Client) => this; trigger: >(method: Key, data: PluginMethodParameters) => void; /** * Callback that will be executed when plugin is mounted */ onMount: (callback: PluginMethods["onMount"]) => this; /** * Callback that will be executed when plugin is unmounted */ onUnmount: (callback: PluginMethods["onUnmount"]) => this; /** * Callback that will be executed when request is created */ onRequestCreate: (callback: PluginMethods["onRequestCreate"]) => this; /** * Callback that will be executed when request gets triggered */ onRequestTrigger: (callback: PluginMethods["onRequestTrigger"]) => this; /** * Callback that will be executed when request starts */ onRequestStart: (callback: PluginMethods["onRequestStart"]) => this; /** * Callback that will be executed when response is successful */ onRequestSuccess: (callback: PluginMethods["onRequestSuccess"]) => this; /** * Callback that will be executed when response is failed */ onRequestError: (callback: PluginMethods["onRequestError"]) => this; /** * Callback that will be executed when response is finished */ onRequestFinished: (callback: PluginMethods["onRequestFinished"]) => this; onDispatcherCleared: (callback: PluginMethods["onDispatcherCleared"]) => this; onDispatcherQueueDrained: (callback: PluginMethods["onDispatcherQueueDrained"]) => this; onDispatcherQueueRunning: (callback: PluginMethods["onDispatcherQueueRunning"]) => this; onDispatcherItemAdded: (callback: PluginMethods["onDispatcherItemAdded"]) => this; onDispatcherItemDeleted: (callback: PluginMethods["onDispatcherItemDeleted"]) => this; onDispatcherQueueCreated: (callback: PluginMethods["onDispatcherQueueCreated"]) => this; onDispatcherQueueCleared: (callback: PluginMethods["onDispatcherQueueCleared"]) => this; onCacheItemChange: (callback: PluginMethods["onCacheItemChange"]) => this; onCacheItemDelete: (callback: PluginMethods["onCacheItemDelete"]) => this; onAdapterFetch: (callback: PluginMethods["onAdapterFetch"]) => this; } type PluginLifecycle = "trigger" | "start" | "success" | "error" | "finished"; type PluginInstance = Plugin; type PluginRequest = ExtendRequest; type PluginOptionsType = { /** * Name of the plugin */ name: string; /** * Data stored in a plugin */ data?: PluginData; }; type PluginMethods = { onMount?: (data: { client: Client; }) => void; onUnmount?: (data: { client: Client; }) => void; onRequestCreate?: (data: { request: PluginRequest; }) => void; onRequestTrigger?: (data: { request: PluginRequest; }) => void; onRequestStart?: (data: { request: PluginRequest; }) => void; onRequestSuccess?: (data: { response: ResponseSuccessType>, ExtractAdapterType>>; request: PluginRequest; }) => void; onRequestError?: (data: { response: ResponseErrorType>, ExtractAdapterType>>; request: PluginRequest; }) => void; onRequestFinished?: (data: { response: ResponseType>, ExtractErrorType>, ExtractAdapterType>>; request: PluginRequest; }) => void; onCacheItemChange?: (data: { cache: Cache>; cacheKey: Requests["cacheKey"]; prevData: CacheValueType> | null; newData: CacheValueType>; }) => void; onCacheItemDelete?: (data: { cacheKey: string; cache: Cache>; }) => void; onCacheItemInvalidate?: (data: { cacheKey: string; cache: Cache>; }) => void; onDispatcherCleared?: (data: { dispatcher: Dispatcher>; }) => void; onDispatcherQueueDrained?: (data: { dispatcher: Dispatcher>; queue: QueueDataType>; }) => void; onDispatcherItemAdded?: (data: { dispatcher: Dispatcher>; queue: QueueDataType>; queueItem: QueueItemType>; }) => void; onDispatcherItemDeleted?: (data: { dispatcher: Dispatcher>; queue: QueueDataType>; queueItem: QueueItemType>; }) => void; onDispatcherQueueRunning?: (data: { dispatcher: Dispatcher>; queue: QueueDataType>; status: "paused" | "stopped" | "running"; }) => void; onDispatcherQueueCreated?: (data: { dispatcher: Dispatcher>; queue: QueueDataType>; }) => void; onDispatcherQueueCleared?: (data: { dispatcher: Dispatcher>; queue: QueueDataType>; }) => void; onAdapterFetch?: (data: { request: RequestInstance; requestId: string; adapter: AdapterInstance; }) => void; }; type PluginMethodParameters, Client extends ClientInstance> = Parameters[Key]>>[0]; type RecursiveSchemaType = Record; type CreateSdkOptions = { /** @default true */ camelCaseToKebabCase?: boolean; /** @default (method) => method.toUpperCase() */ methodTransform?: (method: string) => string; }; declare const createSdk: (client: Client, options?: CreateSdkOptions) => RecursiveSchema; declare enum Time { SEC = 1000, MIN = 60000, HOUR = 3600000, DAY = 86400000, WEEK = 604800000, MONTH_30 = 2592000000, MONTH_31 = 2678400000, YEAR = 31536000000, YEAR_LEAP = 31622400000 } declare enum HttpMethods { GET = "GET", POST = "POST", PUT = "PUT", PATCH = "PATCH", DELETE = "DELETE" } export { AbortError, Adapter, type AdapterFetcherType, type AdapterGenericType, type AdapterInstance, type AdapterPayloadMappingType, AppEvents, AppManager, type AppManagerOptionsType, type BufferEncoding, Cache, type CacheAsyncStorageType, type CacheInitialData, type CacheOptionsType, type CacheSetState, type CacheStorageType, type CacheValueType, Client$1 as Client, type ClientErrorType, type ClientGenericType, type ClientInstance, type ClientInstanceProperties, type ClientOptionsType, type CreateSdkOptions, type DeclareAdapterType, type DefaultEndpointMapper, type DefaultHeaderMapper, type DefaultMapperType, type DefaultPayloadMapper, type DefaultQueryParamsMapper, DeletedError, Dispatcher, DispatcherMode, type DispatcherOptionsType, type DispatcherStorageType, type EmptyTypes, type EndpointMapper, EventEmitter, type ExtendRequest, type ExtractAdapterDefaultQueryParamsType, type ExtractAdapterEndpointMapperType, type ExtractAdapterEndpointType, type ExtractAdapterExtraType, type ExtractAdapterHeaderMapperType, type ExtractAdapterMethodType, type ExtractAdapterOptionsType, type ExtractAdapterPayloadMapperType, type ExtractAdapterQueryParamsMapperType, type ExtractAdapterQueryParamsType, type ExtractAdapterResolvedType, type ExtractAdapterStatusType, type ExtractAdapterType, type ExtractClientAdapterType, type ExtractClientGlobalError, type ExtractClientType, type ExtractEndpointType, type ExtractErrorType, type ExtractGlobalErrorType, type ExtractHasParamsType, type ExtractHasPayloadType, type ExtractHasQueryParamsType, type ExtractLocalErrorType, type ExtractParamsType, type ExtractPayloadType, type ExtractQueryParamsType, type ExtractResponseType, type ExtractUnionAdapter, type ExtractUrlParams, type FetchParamsType, type FetchPayloadType, type FetchQueryParamsType, type HeaderMappingType, HttpAdapter, type HttpAdapterExtraType, type HttpAdapterHeadersProps, type HttpAdapterOptionsType, type HttpAdapterRequest, type HttpAdapterType, HttpMethods, type HttpMethodsType, type HttpStatusType, type HydrateDataType, type HydrationOptions, type LogData, type LogDataTypes, type LogLevel, type LogRequestEventType, type LogResponseEventType, type LogSystemEventType, type LoggerArgs, LoggerManager, type LoggerMethods, type LoggerOptionsType, type LoggerType, type MockResponseType, type MockerConfigType, type ModifyQueryParamsCallbackType, type NonNullableKeys, type NullableKeys, type NullableType, type ParamType, type ParamsType, type PayloadMapperType, type PayloadType, Plugin, type PluginInstance, type PluginLifecycle, type PluginMethodParameters, type PluginMethods, type PluginOptionsType, type PluginRequest, type Prettify, type ProgressDataType, type ProgressEventType, type ProgressType, type QueryParamType, type QueryParamValuesType, type QueryParamsMapper, type QueryParamsType, type QueryStringifyOptionsType, type QueueDataType, type QueueItemType, type RecursiveSchemaType, Request, type RequestCacheType, type RequestConfigurationType, type RequestDeduplicatedEventType, type RequestDynamicSendOptionsType, type RequestEventType, type RequestGenericType, type RequestInstance, type RequestInstanceProperties, type RequestInterceptorType, type RequestJSON, type RequestLoadingEventType, RequestManager, type RequestMapper, type RequestOptionsType, RequestProcessingError, type RequestProgressEventType, type RequestRemovedEventType, type RequestResponseEventType, type RequestResponseType, type RequestSendActionsType, type RequestSendOptionsType, type RequestSendType, type RequiredKeys, type ResponseDetailsType, type ResponseErrorType, type ResponseInterceptorType, type ResponseMapper, type ResponseSuccessType, type ResponseType, type RunningRequestValueType, type SyncOrAsync, Time, TimeoutError, type TypeWithDefaults, UnexpectedError, appManagerInitialOptions, canRetryRequest, createClient, createSdk, defaultMapper, defaultTimeout, getAbortByAbortKey, getAbortByIdKey, getAbortKey, getAdapterBindings, getAdapterHeaders, getAdapterOnError, getAdapterPayload, getAppManagerEvents, getCacheByKey, getCacheData, getCacheEvents, getCacheKey, getDeleteByKey, getDeleteKey, getDispatcherChangeByKey, getDispatcherChangeKey, getDispatcherDrainedByKey, getDispatcherDrainedKey, getDispatcherEvents, getDispatcherStatusByKey, getDispatcherStatusKey, getDownloadProgressByIdKey, getDownloadProgressByQueryKey, getDownloadProgressKey, getErrorMessage, getInvalidateByKey, getInvalidateKey, getIsEqualTimestamp, getLoadingByCacheKey, getLoadingByIdKey, getLoadingByQueryKey, getLoadingKey, getProgressData, getProgressValue, getRemoveByIdKey, getRemoveByQueryKey, getRemoveKey, getRequestDeduplicatedByCacheKey, getRequestDeduplicatedByIdKey, getRequestDeduplicatedByQueryKey, getRequestDeduplicatedKey, getRequestDispatcher, getRequestEta, getRequestKey, getRequestManagerEvents, getRequestStarByQueryKey, getRequestStartByIdKey, getRequestStartKey, getRequestType, getResponseByCacheKey, getResponseByIdKey, getResponseHeaders, getResponseKey, getResponseStartByIdKey, getResponseStartByQueryKey, getResponseStartKey, getSimpleKey, getTime, getUniqueRequestId, getUploadProgressByIdKey, getUploadProgressByQueryKey, getUploadProgressKey, handleResponse, hasDocument, hasWindow, interceptRequest, interceptResponse, logLevelOrder, logger, loggerColors, loggerStyles, mocker, onDocumentEvent, onWindowEvent, parseErrorResponse, parseResponse, sendRequest, stringifyDefaultOptions, stringifyKey, stringifyQueryParams, stringifyValue, xhrExtra };