@oxog/requestkit 1.0.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,263 +1,5 @@
1
- type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
2
- type ResponseType = 'json' | 'text' | 'blob' | 'arrayBuffer' | 'stream' | 'raw';
3
- type ErrorCode = 'ERR_NETWORK' | 'ERR_TIMEOUT' | 'ERR_CANCELED' | 'ERR_BAD_REQUEST' | 'ERR_BAD_RESPONSE';
4
- interface Progress {
5
- loaded: number;
6
- total: number;
7
- percent: number;
8
- }
9
- type ProgressCallback = (progress: Progress) => void;
10
- interface ParamsSerializer {
11
- encode?: (params: Record<string, unknown>) => string;
12
- arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
13
- }
14
- type TransformFn = (data: unknown, headers?: Headers) => unknown;
15
- type RequestHook = (config: InternalRequestConfig) => InternalRequestConfig | Promise<InternalRequestConfig>;
16
- type ResponseHook = (response: Response) => Response | Promise<Response>;
17
- type ErrorHook = (error: RequestError) => unknown;
18
- interface RetryConfig {
19
- /** Max retry attempts */
20
- limit: number;
21
- /** Methods to retry (default: GET, HEAD, OPTIONS, PUT, DELETE) */
22
- methods?: HttpMethod[];
23
- /** Status codes to retry (default: 408, 429, 500, 502, 503, 504) */
24
- statusCodes?: number[];
25
- /** Initial delay in ms (default: 1000) */
26
- delay?: number;
27
- /** Backoff strategy (default: exponential) */
28
- backoff?: 'linear' | 'exponential';
29
- /** Max delay in ms (default: 30000) */
30
- maxDelay?: number;
31
- /** Custom retry condition */
32
- retryCondition?: (error: RequestError) => boolean;
33
- /** Retry callback */
34
- onRetry?: (attempt: number, error: RequestError, config: InternalRequestConfig) => void;
35
- }
36
- interface ClientConfig {
37
- /** Base URL for all requests */
38
- baseURL?: string;
39
- /** Default headers */
40
- headers?: HeadersInit | Record<string, string>;
41
- /** Timeout in ms (0 = no timeout) */
42
- timeout?: number;
43
- /** Retry config or number of retries */
44
- retry?: number | RetryConfig;
45
- /** Response type (default: json) */
46
- responseType?: ResponseType;
47
- /** Credentials mode */
48
- credentials?: RequestCredentials;
49
- /** Cache mode */
50
- cache?: RequestCache;
51
- /** Request mode */
52
- mode?: RequestMode;
53
- /** Query params serialization */
54
- paramsSerializer?: ParamsSerializer;
55
- /** Status validation (default: 200-299) */
56
- validateStatus?: (status: number) => boolean;
57
- /** Transform request data */
58
- transformRequest?: TransformFn | TransformFn[];
59
- /** Transform response data */
60
- transformResponse?: TransformFn | TransformFn[];
61
- /** Request hook */
62
- onRequest?: RequestHook;
63
- /** Response hook */
64
- onResponse?: ResponseHook;
65
- /** Error hook */
66
- onError?: ErrorHook;
67
- }
68
- interface RequestOptions extends Omit<ClientConfig, 'baseURL'> {
69
- /** HTTP method */
70
- method?: HttpMethod;
71
- /** URL params (query string) */
72
- params?: Record<string, unknown> | URLSearchParams;
73
- /** Request body */
74
- body?: BodyInit | Record<string, unknown>;
75
- /** JSON body (auto-serialized) */
76
- json?: Record<string, unknown>;
77
- /** Form body (FormData or URLSearchParams) */
78
- form?: Record<string, unknown> | FormData;
79
- /** Abort signal */
80
- signal?: AbortSignal;
81
- /** Upload progress callback */
82
- onUploadProgress?: ProgressCallback;
83
- /** Download progress callback */
84
- onDownloadProgress?: ProgressCallback;
85
- /** Return cancelable request */
86
- cancelable?: boolean;
87
- /** Return raw response with metadata */
88
- raw?: boolean;
89
- }
90
- interface InternalRequestConfig extends RequestOptions {
91
- url: string;
92
- method: HttpMethod;
93
- headers: Headers;
94
- baseURL?: string;
95
- /** Internal: retry attempt tracking */
96
- _retry?: boolean;
97
- /** Internal: current retry count */
98
- _retryCount?: number;
99
- }
100
- interface RequestResponse<T = unknown> {
101
- data: T;
102
- status: number;
103
- statusText: string;
104
- headers: Headers;
105
- config: InternalRequestConfig;
106
- request?: Request;
107
- ok: boolean;
108
- }
109
- interface RequestError extends Error {
110
- name: 'RequestError';
111
- message: string;
112
- status?: number;
113
- statusText?: string;
114
- data?: unknown;
115
- config: InternalRequestConfig;
116
- request?: Request;
117
- response?: Response;
118
- code?: ErrorCode;
119
- }
120
- interface InterceptorHandler<T> {
121
- fulfilled?: (value: T) => T | Promise<T>;
122
- rejected?: (error: RequestError) => unknown;
123
- }
124
- interface InterceptorManager<T> {
125
- /**
126
- * Add an interceptor
127
- * @returns Interceptor ID for removal
128
- */
129
- use(onFulfilled?: (value: T) => T | Promise<T>, onRejected?: (error: RequestError) => unknown): number;
130
- /**
131
- * Remove an interceptor by ID
132
- */
133
- eject(id: number): void;
134
- /**
135
- * Clear all interceptors
136
- */
137
- clear(): void;
138
- }
139
- interface Interceptors {
140
- request: InterceptorManager<InternalRequestConfig>;
141
- response: InterceptorManager<Response>;
142
- }
143
- interface CancelableRequest<T> {
144
- data: Promise<T>;
145
- cancel: () => void;
146
- }
147
- interface CancelToken$1 {
148
- promise: Promise<Cancel>;
149
- reason?: Cancel;
150
- throwIfRequested(): void;
151
- }
152
- interface CancelTokenSource {
153
- token: CancelToken$1;
154
- cancel: (message?: string) => void;
155
- }
156
- interface Cancel {
157
- message?: string;
158
- }
159
- interface RequestClient {
160
- get<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
161
- post<T = unknown>(url: string, body?: unknown, options?: RequestOptions): Promise<T>;
162
- put<T = unknown>(url: string, body?: unknown, options?: RequestOptions): Promise<T>;
163
- patch<T = unknown>(url: string, body?: unknown, options?: RequestOptions): Promise<T>;
164
- delete<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
165
- head(url: string, options?: RequestOptions): Promise<void>;
166
- options(url: string, options?: RequestOptions): Promise<void>;
167
- request<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
168
- request<T = unknown>(options: RequestOptions & {
169
- url: string;
170
- }): Promise<T>;
171
- interceptors: Interceptors;
172
- defaults: ClientConfig;
173
- extend(config: ClientConfig): RequestClient;
174
- clone(): RequestClient;
175
- }
176
- interface UseRequestOptions<T> {
177
- /** Don't fetch on mount */
178
- manual?: boolean;
179
- /** Success callback */
180
- onSuccess?: (data: T) => void;
181
- /** Error callback */
182
- onError?: (error: RequestError) => void;
183
- }
184
- interface UseRequestResult<T> {
185
- data: T | undefined;
186
- loading: boolean;
187
- error: RequestError | null;
188
- execute: (options?: RequestOptions) => Promise<T>;
189
- reset: () => void;
190
- }
191
- interface UseQueryOptions<T> {
192
- /** Enable/disable query */
193
- enabled?: boolean;
194
- /** Time until data is stale (ms) */
195
- staleTime?: number;
196
- /** Time to keep in cache (ms) */
197
- cacheTime?: number;
198
- /** Refetch on window focus */
199
- refetchOnWindowFocus?: boolean;
200
- /** Refetch on reconnect */
201
- refetchOnReconnect?: boolean;
202
- /** Polling interval (ms) */
203
- refetchInterval?: number;
204
- /** Retry failed requests */
205
- retry?: number | boolean;
206
- /** Success callback */
207
- onSuccess?: (data: T) => void;
208
- /** Error callback */
209
- onError?: (error: RequestError) => void;
210
- }
211
- interface UseQueryResult<T> {
212
- data: T | undefined;
213
- loading: boolean;
214
- error: RequestError | null;
215
- isStale: boolean;
216
- isFetching: boolean;
217
- refetch: () => Promise<void>;
218
- }
219
- interface UseMutationOptions<T, V> {
220
- /** Success callback */
221
- onSuccess?: (data: T, variables: V) => void;
222
- /** Error callback */
223
- onError?: (error: RequestError, variables: V) => void;
224
- /** Settled callback (always called) */
225
- onSettled?: (data: T | undefined, error: RequestError | null, variables: V) => void;
226
- }
227
- interface UseMutationResult<T, V> {
228
- data: T | undefined;
229
- loading: boolean;
230
- error: RequestError | null;
231
- mutate: (variables: V) => void;
232
- mutateAsync: (variables: V) => Promise<T>;
233
- reset: () => void;
234
- }
235
- interface UseInfiniteQueryOptions<T> {
236
- /** Get next page param from last page */
237
- getNextPageParam: (lastPage: T, pages: T[]) => unknown | undefined;
238
- /** Get previous page param from first page */
239
- getPreviousPageParam?: (firstPage: T, pages: T[]) => unknown | undefined;
240
- /** Enable/disable query */
241
- enabled?: boolean;
242
- /** Time until data is stale (ms) */
243
- staleTime?: number;
244
- /** Success callback */
245
- onSuccess?: (data: T[]) => void;
246
- /** Error callback */
247
- onError?: (error: RequestError) => void;
248
- }
249
- interface UseInfiniteQueryResult<T> {
250
- data: T[] | undefined;
251
- loading: boolean;
252
- error: RequestError | null;
253
- isFetchingNextPage: boolean;
254
- isFetchingPreviousPage: boolean;
255
- hasNextPage: boolean;
256
- hasPreviousPage: boolean;
257
- fetchNextPage: () => Promise<void>;
258
- fetchPreviousPage: () => Promise<void>;
259
- refetch: () => Promise<void>;
260
- }
1
+ import { C as ClientConfig, R as RequestClient, a as RequestError, I as InternalRequestConfig, E as ErrorCode, P as ParamsSerializer, b as CancelTokenSource, c as Cancel } from './types-CBczL9cS.cjs';
2
+ export { r as CancelTokenInterface, q as CancelableRequest, l as ErrorHook, H as HttpMethod, o as InterceptorHandler, n as InterceptorManager, p as Interceptors, h as Progress, i as ProgressCallback, j as RequestHook, e as RequestOptions, m as RequestResponse, f as RequestTransport, k as ResponseHook, d as ResponseType, g as RetryConfig, T as TransformFn, x as UseInfiniteQueryOptions, y as UseInfiniteQueryResult, v as UseMutationOptions, w as UseMutationResult, t as UseQueryOptions, u as UseQueryResult, U as UseRequestOptions, s as UseRequestResult } from './types-CBczL9cS.cjs';
261
3
 
262
4
  /**
263
5
  * RequestKit Client Factory
@@ -275,7 +17,7 @@ declare function createClient(config?: ClientConfig): RequestClient;
275
17
  /**
276
18
  * Create a RequestError from various inputs
277
19
  */
278
- declare function createError(message: string, config: InternalRequestConfig, code?: ErrorCode, request?: Request, response?: Response, data?: unknown): RequestError;
20
+ declare function createError(message: string, config: InternalRequestConfig, code?: ErrorCode, request?: Request, response?: Response, data?: unknown, cause?: unknown): RequestError;
279
21
  /**
280
22
  * Type guard to check if error is a RequestError
281
23
  */
@@ -567,4 +309,4 @@ declare function delay(ms: number): Promise<void>;
567
309
  */
568
310
  declare function abortableDelay(ms: number, signal?: AbortSignal): Promise<void>;
569
311
 
570
- export { type Cancel, CancelToken, type CancelToken$1 as CancelTokenInterface, type CancelTokenSource, type CancelableRequest, type ClientConfig, ContentTypes, type ErrorCode, type ErrorHook, type HttpMethod, type InterceptorHandler, type InterceptorManager, type Interceptors, type InternalRequestConfig, type ParamsSerializer, type Progress, type ProgressCallback, type RequestClient, type RequestError, type RequestHook, type RequestOptions, type RequestResponse, type ResponseHook, type ResponseType, type RetryConfig, type TransformFn, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseRequestOptions, type UseRequestResult, abortableDelay, buildURL, combineURLs, createClient, createError, createParamsSerializer, deepClone, deepMerge, delay, getContentType, getHeader, getOrigin, hasHeader, isAbortSignal, isAbsoluteURL, isArray, isArrayBuffer, isArrayBufferView, isBlob, isBoolean, isCancel, isCancelError, isClientError, isDate, isFile, isFormData, isFunction, isHeaders, isJSONContentType, isNetworkError, isNullOrUndefined, isNumber, isObject, isPlainObject, isRequest, isRequestError, isResponse, isSameOrigin, isServerError, isStream, isString, isTextContentType, isTimeoutError, isURLSearchParams, isUndefined, mergeHeaders, normalizeHeaders, objectToFormData, objectToURLSearchParams, omit, parseHeaders, parseParams, parseURL, pick, serializeParams, shallowMerge };
312
+ export { Cancel, CancelToken, CancelTokenSource, ClientConfig, ContentTypes, ErrorCode, InternalRequestConfig, ParamsSerializer, RequestClient, RequestError, abortableDelay, buildURL, combineURLs, createClient, createError, createParamsSerializer, deepClone, deepMerge, delay, getContentType, getHeader, getOrigin, hasHeader, isAbortSignal, isAbsoluteURL, isArray, isArrayBuffer, isArrayBufferView, isBlob, isBoolean, isCancel, isCancelError, isClientError, isDate, isFile, isFormData, isFunction, isHeaders, isJSONContentType, isNetworkError, isNullOrUndefined, isNumber, isObject, isPlainObject, isRequest, isRequestError, isResponse, isSameOrigin, isServerError, isStream, isString, isTextContentType, isTimeoutError, isURLSearchParams, isUndefined, mergeHeaders, normalizeHeaders, objectToFormData, objectToURLSearchParams, omit, parseHeaders, parseParams, parseURL, pick, serializeParams, shallowMerge };
package/dist/index.d.ts CHANGED
@@ -1,263 +1,5 @@
1
- type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
2
- type ResponseType = 'json' | 'text' | 'blob' | 'arrayBuffer' | 'stream' | 'raw';
3
- type ErrorCode = 'ERR_NETWORK' | 'ERR_TIMEOUT' | 'ERR_CANCELED' | 'ERR_BAD_REQUEST' | 'ERR_BAD_RESPONSE';
4
- interface Progress {
5
- loaded: number;
6
- total: number;
7
- percent: number;
8
- }
9
- type ProgressCallback = (progress: Progress) => void;
10
- interface ParamsSerializer {
11
- encode?: (params: Record<string, unknown>) => string;
12
- arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
13
- }
14
- type TransformFn = (data: unknown, headers?: Headers) => unknown;
15
- type RequestHook = (config: InternalRequestConfig) => InternalRequestConfig | Promise<InternalRequestConfig>;
16
- type ResponseHook = (response: Response) => Response | Promise<Response>;
17
- type ErrorHook = (error: RequestError) => unknown;
18
- interface RetryConfig {
19
- /** Max retry attempts */
20
- limit: number;
21
- /** Methods to retry (default: GET, HEAD, OPTIONS, PUT, DELETE) */
22
- methods?: HttpMethod[];
23
- /** Status codes to retry (default: 408, 429, 500, 502, 503, 504) */
24
- statusCodes?: number[];
25
- /** Initial delay in ms (default: 1000) */
26
- delay?: number;
27
- /** Backoff strategy (default: exponential) */
28
- backoff?: 'linear' | 'exponential';
29
- /** Max delay in ms (default: 30000) */
30
- maxDelay?: number;
31
- /** Custom retry condition */
32
- retryCondition?: (error: RequestError) => boolean;
33
- /** Retry callback */
34
- onRetry?: (attempt: number, error: RequestError, config: InternalRequestConfig) => void;
35
- }
36
- interface ClientConfig {
37
- /** Base URL for all requests */
38
- baseURL?: string;
39
- /** Default headers */
40
- headers?: HeadersInit | Record<string, string>;
41
- /** Timeout in ms (0 = no timeout) */
42
- timeout?: number;
43
- /** Retry config or number of retries */
44
- retry?: number | RetryConfig;
45
- /** Response type (default: json) */
46
- responseType?: ResponseType;
47
- /** Credentials mode */
48
- credentials?: RequestCredentials;
49
- /** Cache mode */
50
- cache?: RequestCache;
51
- /** Request mode */
52
- mode?: RequestMode;
53
- /** Query params serialization */
54
- paramsSerializer?: ParamsSerializer;
55
- /** Status validation (default: 200-299) */
56
- validateStatus?: (status: number) => boolean;
57
- /** Transform request data */
58
- transformRequest?: TransformFn | TransformFn[];
59
- /** Transform response data */
60
- transformResponse?: TransformFn | TransformFn[];
61
- /** Request hook */
62
- onRequest?: RequestHook;
63
- /** Response hook */
64
- onResponse?: ResponseHook;
65
- /** Error hook */
66
- onError?: ErrorHook;
67
- }
68
- interface RequestOptions extends Omit<ClientConfig, 'baseURL'> {
69
- /** HTTP method */
70
- method?: HttpMethod;
71
- /** URL params (query string) */
72
- params?: Record<string, unknown> | URLSearchParams;
73
- /** Request body */
74
- body?: BodyInit | Record<string, unknown>;
75
- /** JSON body (auto-serialized) */
76
- json?: Record<string, unknown>;
77
- /** Form body (FormData or URLSearchParams) */
78
- form?: Record<string, unknown> | FormData;
79
- /** Abort signal */
80
- signal?: AbortSignal;
81
- /** Upload progress callback */
82
- onUploadProgress?: ProgressCallback;
83
- /** Download progress callback */
84
- onDownloadProgress?: ProgressCallback;
85
- /** Return cancelable request */
86
- cancelable?: boolean;
87
- /** Return raw response with metadata */
88
- raw?: boolean;
89
- }
90
- interface InternalRequestConfig extends RequestOptions {
91
- url: string;
92
- method: HttpMethod;
93
- headers: Headers;
94
- baseURL?: string;
95
- /** Internal: retry attempt tracking */
96
- _retry?: boolean;
97
- /** Internal: current retry count */
98
- _retryCount?: number;
99
- }
100
- interface RequestResponse<T = unknown> {
101
- data: T;
102
- status: number;
103
- statusText: string;
104
- headers: Headers;
105
- config: InternalRequestConfig;
106
- request?: Request;
107
- ok: boolean;
108
- }
109
- interface RequestError extends Error {
110
- name: 'RequestError';
111
- message: string;
112
- status?: number;
113
- statusText?: string;
114
- data?: unknown;
115
- config: InternalRequestConfig;
116
- request?: Request;
117
- response?: Response;
118
- code?: ErrorCode;
119
- }
120
- interface InterceptorHandler<T> {
121
- fulfilled?: (value: T) => T | Promise<T>;
122
- rejected?: (error: RequestError) => unknown;
123
- }
124
- interface InterceptorManager<T> {
125
- /**
126
- * Add an interceptor
127
- * @returns Interceptor ID for removal
128
- */
129
- use(onFulfilled?: (value: T) => T | Promise<T>, onRejected?: (error: RequestError) => unknown): number;
130
- /**
131
- * Remove an interceptor by ID
132
- */
133
- eject(id: number): void;
134
- /**
135
- * Clear all interceptors
136
- */
137
- clear(): void;
138
- }
139
- interface Interceptors {
140
- request: InterceptorManager<InternalRequestConfig>;
141
- response: InterceptorManager<Response>;
142
- }
143
- interface CancelableRequest<T> {
144
- data: Promise<T>;
145
- cancel: () => void;
146
- }
147
- interface CancelToken$1 {
148
- promise: Promise<Cancel>;
149
- reason?: Cancel;
150
- throwIfRequested(): void;
151
- }
152
- interface CancelTokenSource {
153
- token: CancelToken$1;
154
- cancel: (message?: string) => void;
155
- }
156
- interface Cancel {
157
- message?: string;
158
- }
159
- interface RequestClient {
160
- get<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
161
- post<T = unknown>(url: string, body?: unknown, options?: RequestOptions): Promise<T>;
162
- put<T = unknown>(url: string, body?: unknown, options?: RequestOptions): Promise<T>;
163
- patch<T = unknown>(url: string, body?: unknown, options?: RequestOptions): Promise<T>;
164
- delete<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
165
- head(url: string, options?: RequestOptions): Promise<void>;
166
- options(url: string, options?: RequestOptions): Promise<void>;
167
- request<T = unknown>(url: string, options?: RequestOptions): Promise<T>;
168
- request<T = unknown>(options: RequestOptions & {
169
- url: string;
170
- }): Promise<T>;
171
- interceptors: Interceptors;
172
- defaults: ClientConfig;
173
- extend(config: ClientConfig): RequestClient;
174
- clone(): RequestClient;
175
- }
176
- interface UseRequestOptions<T> {
177
- /** Don't fetch on mount */
178
- manual?: boolean;
179
- /** Success callback */
180
- onSuccess?: (data: T) => void;
181
- /** Error callback */
182
- onError?: (error: RequestError) => void;
183
- }
184
- interface UseRequestResult<T> {
185
- data: T | undefined;
186
- loading: boolean;
187
- error: RequestError | null;
188
- execute: (options?: RequestOptions) => Promise<T>;
189
- reset: () => void;
190
- }
191
- interface UseQueryOptions<T> {
192
- /** Enable/disable query */
193
- enabled?: boolean;
194
- /** Time until data is stale (ms) */
195
- staleTime?: number;
196
- /** Time to keep in cache (ms) */
197
- cacheTime?: number;
198
- /** Refetch on window focus */
199
- refetchOnWindowFocus?: boolean;
200
- /** Refetch on reconnect */
201
- refetchOnReconnect?: boolean;
202
- /** Polling interval (ms) */
203
- refetchInterval?: number;
204
- /** Retry failed requests */
205
- retry?: number | boolean;
206
- /** Success callback */
207
- onSuccess?: (data: T) => void;
208
- /** Error callback */
209
- onError?: (error: RequestError) => void;
210
- }
211
- interface UseQueryResult<T> {
212
- data: T | undefined;
213
- loading: boolean;
214
- error: RequestError | null;
215
- isStale: boolean;
216
- isFetching: boolean;
217
- refetch: () => Promise<void>;
218
- }
219
- interface UseMutationOptions<T, V> {
220
- /** Success callback */
221
- onSuccess?: (data: T, variables: V) => void;
222
- /** Error callback */
223
- onError?: (error: RequestError, variables: V) => void;
224
- /** Settled callback (always called) */
225
- onSettled?: (data: T | undefined, error: RequestError | null, variables: V) => void;
226
- }
227
- interface UseMutationResult<T, V> {
228
- data: T | undefined;
229
- loading: boolean;
230
- error: RequestError | null;
231
- mutate: (variables: V) => void;
232
- mutateAsync: (variables: V) => Promise<T>;
233
- reset: () => void;
234
- }
235
- interface UseInfiniteQueryOptions<T> {
236
- /** Get next page param from last page */
237
- getNextPageParam: (lastPage: T, pages: T[]) => unknown | undefined;
238
- /** Get previous page param from first page */
239
- getPreviousPageParam?: (firstPage: T, pages: T[]) => unknown | undefined;
240
- /** Enable/disable query */
241
- enabled?: boolean;
242
- /** Time until data is stale (ms) */
243
- staleTime?: number;
244
- /** Success callback */
245
- onSuccess?: (data: T[]) => void;
246
- /** Error callback */
247
- onError?: (error: RequestError) => void;
248
- }
249
- interface UseInfiniteQueryResult<T> {
250
- data: T[] | undefined;
251
- loading: boolean;
252
- error: RequestError | null;
253
- isFetchingNextPage: boolean;
254
- isFetchingPreviousPage: boolean;
255
- hasNextPage: boolean;
256
- hasPreviousPage: boolean;
257
- fetchNextPage: () => Promise<void>;
258
- fetchPreviousPage: () => Promise<void>;
259
- refetch: () => Promise<void>;
260
- }
1
+ import { C as ClientConfig, R as RequestClient, a as RequestError, I as InternalRequestConfig, E as ErrorCode, P as ParamsSerializer, b as CancelTokenSource, c as Cancel } from './types-CBczL9cS.js';
2
+ export { r as CancelTokenInterface, q as CancelableRequest, l as ErrorHook, H as HttpMethod, o as InterceptorHandler, n as InterceptorManager, p as Interceptors, h as Progress, i as ProgressCallback, j as RequestHook, e as RequestOptions, m as RequestResponse, f as RequestTransport, k as ResponseHook, d as ResponseType, g as RetryConfig, T as TransformFn, x as UseInfiniteQueryOptions, y as UseInfiniteQueryResult, v as UseMutationOptions, w as UseMutationResult, t as UseQueryOptions, u as UseQueryResult, U as UseRequestOptions, s as UseRequestResult } from './types-CBczL9cS.js';
261
3
 
262
4
  /**
263
5
  * RequestKit Client Factory
@@ -275,7 +17,7 @@ declare function createClient(config?: ClientConfig): RequestClient;
275
17
  /**
276
18
  * Create a RequestError from various inputs
277
19
  */
278
- declare function createError(message: string, config: InternalRequestConfig, code?: ErrorCode, request?: Request, response?: Response, data?: unknown): RequestError;
20
+ declare function createError(message: string, config: InternalRequestConfig, code?: ErrorCode, request?: Request, response?: Response, data?: unknown, cause?: unknown): RequestError;
279
21
  /**
280
22
  * Type guard to check if error is a RequestError
281
23
  */
@@ -567,4 +309,4 @@ declare function delay(ms: number): Promise<void>;
567
309
  */
568
310
  declare function abortableDelay(ms: number, signal?: AbortSignal): Promise<void>;
569
311
 
570
- export { type Cancel, CancelToken, type CancelToken$1 as CancelTokenInterface, type CancelTokenSource, type CancelableRequest, type ClientConfig, ContentTypes, type ErrorCode, type ErrorHook, type HttpMethod, type InterceptorHandler, type InterceptorManager, type Interceptors, type InternalRequestConfig, type ParamsSerializer, type Progress, type ProgressCallback, type RequestClient, type RequestError, type RequestHook, type RequestOptions, type RequestResponse, type ResponseHook, type ResponseType, type RetryConfig, type TransformFn, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseRequestOptions, type UseRequestResult, abortableDelay, buildURL, combineURLs, createClient, createError, createParamsSerializer, deepClone, deepMerge, delay, getContentType, getHeader, getOrigin, hasHeader, isAbortSignal, isAbsoluteURL, isArray, isArrayBuffer, isArrayBufferView, isBlob, isBoolean, isCancel, isCancelError, isClientError, isDate, isFile, isFormData, isFunction, isHeaders, isJSONContentType, isNetworkError, isNullOrUndefined, isNumber, isObject, isPlainObject, isRequest, isRequestError, isResponse, isSameOrigin, isServerError, isStream, isString, isTextContentType, isTimeoutError, isURLSearchParams, isUndefined, mergeHeaders, normalizeHeaders, objectToFormData, objectToURLSearchParams, omit, parseHeaders, parseParams, parseURL, pick, serializeParams, shallowMerge };
312
+ export { Cancel, CancelToken, CancelTokenSource, ClientConfig, ContentTypes, ErrorCode, InternalRequestConfig, ParamsSerializer, RequestClient, RequestError, abortableDelay, buildURL, combineURLs, createClient, createError, createParamsSerializer, deepClone, deepMerge, delay, getContentType, getHeader, getOrigin, hasHeader, isAbortSignal, isAbsoluteURL, isArray, isArrayBuffer, isArrayBufferView, isBlob, isBoolean, isCancel, isCancelError, isClientError, isDate, isFile, isFormData, isFunction, isHeaders, isJSONContentType, isNetworkError, isNullOrUndefined, isNumber, isObject, isPlainObject, isRequest, isRequestError, isResponse, isSameOrigin, isServerError, isStream, isString, isTextContentType, isTimeoutError, isURLSearchParams, isUndefined, mergeHeaders, normalizeHeaders, objectToFormData, objectToURLSearchParams, omit, parseHeaders, parseParams, parseURL, pick, serializeParams, shallowMerge };