@tanstack/query-core 5.64.2 → 5.66.0
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/build/legacy/{hydration-DpBMnFDT.d.ts → hydration-De1u5VYH.d.ts} +170 -130
- package/build/legacy/{hydration-BiRZ4dmX.d.cts → hydration-De8Br-lj.d.cts} +170 -130
- package/build/legacy/hydration.d.cts +1 -1
- package/build/legacy/hydration.d.ts +1 -1
- package/build/legacy/index.d.cts +1 -1
- package/build/legacy/index.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.cjs +2 -0
- package/build/legacy/infiniteQueryBehavior.cjs.map +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
- package/build/legacy/infiniteQueryBehavior.js +2 -0
- package/build/legacy/infiniteQueryBehavior.js.map +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +1 -1
- package/build/legacy/infiniteQueryObserver.d.ts +1 -1
- package/build/legacy/mutation.d.cts +1 -1
- package/build/legacy/mutation.d.ts +1 -1
- package/build/legacy/mutationCache.d.cts +1 -1
- package/build/legacy/mutationCache.d.ts +1 -1
- package/build/legacy/mutationObserver.d.cts +1 -1
- package/build/legacy/mutationObserver.d.ts +1 -1
- package/build/legacy/queriesObserver.d.cts +1 -1
- package/build/legacy/queriesObserver.d.ts +1 -1
- package/build/legacy/query.cjs +7 -2
- package/build/legacy/query.cjs.map +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/query.js +7 -2
- package/build/legacy/query.js.map +1 -1
- package/build/legacy/queryCache.cjs +1 -1
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/queryCache.js +1 -1
- package/build/legacy/queryCache.js.map +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryObserver.d.cts +1 -1
- package/build/legacy/queryObserver.d.ts +1 -1
- package/build/legacy/retryer.d.cts +1 -1
- package/build/legacy/retryer.d.ts +1 -1
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +1 -1
- package/build/legacy/types.d.ts +1 -1
- package/build/legacy/types.js.map +1 -1
- package/build/legacy/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- package/build/modern/{hydration-DpBMnFDT.d.ts → hydration-De1u5VYH.d.ts} +170 -130
- package/build/modern/{hydration-BiRZ4dmX.d.cts → hydration-De8Br-lj.d.cts} +170 -130
- package/build/modern/hydration.d.cts +1 -1
- package/build/modern/hydration.d.ts +1 -1
- package/build/modern/index.d.cts +1 -1
- package/build/modern/index.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.cjs +2 -0
- package/build/modern/infiniteQueryBehavior.cjs.map +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +1 -1
- package/build/modern/infiniteQueryBehavior.js +2 -0
- package/build/modern/infiniteQueryBehavior.js.map +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +1 -1
- package/build/modern/infiniteQueryObserver.d.ts +1 -1
- package/build/modern/mutation.d.cts +1 -1
- package/build/modern/mutation.d.ts +1 -1
- package/build/modern/mutationCache.d.cts +1 -1
- package/build/modern/mutationCache.d.ts +1 -1
- package/build/modern/mutationObserver.d.cts +1 -1
- package/build/modern/mutationObserver.d.ts +1 -1
- package/build/modern/queriesObserver.d.cts +1 -1
- package/build/modern/queriesObserver.d.ts +1 -1
- package/build/modern/query.cjs +5 -1
- package/build/modern/query.cjs.map +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/query.js +5 -1
- package/build/modern/query.js.map +1 -1
- package/build/modern/queryCache.cjs +1 -1
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/queryCache.js +1 -1
- package/build/modern/queryCache.js.map +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryObserver.d.cts +1 -1
- package/build/modern/queryObserver.d.ts +1 -1
- package/build/modern/retryer.d.cts +1 -1
- package/build/modern/retryer.d.ts +1 -1
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +1 -1
- package/build/modern/types.d.ts +1 -1
- package/build/modern/types.js.map +1 -1
- package/build/modern/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/package.json +3 -2
- package/src/infiniteQueryBehavior.ts +2 -0
- package/src/query.ts +9 -3
- package/src/queryCache.ts +1 -1
- package/src/types.ts +50 -0
|
@@ -33,7 +33,7 @@ declare class QueryObserver<TQueryFnData = unknown, TError = DefaultError, TData
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
interface QueryConfig<TQueryFnData, TError, TData, TQueryKey extends QueryKey = QueryKey> {
|
|
36
|
-
|
|
36
|
+
client: QueryClient;
|
|
37
37
|
queryKey: TQueryKey;
|
|
38
38
|
queryHash: string;
|
|
39
39
|
options?: QueryOptions<TQueryFnData, TError, TData, TQueryKey>;
|
|
@@ -59,6 +59,7 @@ interface FetchContext<TQueryFnData, TError, TData, TQueryKey extends QueryKey =
|
|
|
59
59
|
fetchOptions?: FetchOptions;
|
|
60
60
|
signal: AbortSignal;
|
|
61
61
|
options: QueryOptions<TQueryFnData, TError, TData, any>;
|
|
62
|
+
client: QueryClient;
|
|
62
63
|
queryKey: TQueryKey;
|
|
63
64
|
state: QueryState<TData, TError>;
|
|
64
65
|
}
|
|
@@ -152,6 +153,132 @@ declare function fetchState<TQueryFnData, TError, TData, TQueryKey extends Query
|
|
|
152
153
|
readonly fetchStatus: "fetching" | "paused";
|
|
153
154
|
};
|
|
154
155
|
|
|
156
|
+
type MutationObserverListener<TData, TError, TVariables, TContext> = (result: MutationObserverResult<TData, TError, TVariables, TContext>) => void;
|
|
157
|
+
declare class MutationObserver<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends Subscribable<MutationObserverListener<TData, TError, TVariables, TContext>> {
|
|
158
|
+
#private;
|
|
159
|
+
options: MutationObserverOptions<TData, TError, TVariables, TContext>;
|
|
160
|
+
constructor(client: QueryClient, options: MutationObserverOptions<TData, TError, TVariables, TContext>);
|
|
161
|
+
protected bindMethods(): void;
|
|
162
|
+
setOptions(options: MutationObserverOptions<TData, TError, TVariables, TContext>): void;
|
|
163
|
+
protected onUnsubscribe(): void;
|
|
164
|
+
onMutationUpdate(action: Action<TData, TError, TVariables, TContext>): void;
|
|
165
|
+
getCurrentResult(): MutationObserverResult<TData, TError, TVariables, TContext>;
|
|
166
|
+
reset(): void;
|
|
167
|
+
mutate(variables: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>): Promise<TData>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface MutationCacheConfig {
|
|
171
|
+
onError?: (error: DefaultError, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
172
|
+
onSuccess?: (data: unknown, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
173
|
+
onMutate?: (variables: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
174
|
+
onSettled?: (data: unknown | undefined, error: DefaultError | null, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
175
|
+
}
|
|
176
|
+
interface NotifyEventMutationAdded extends NotifyEvent {
|
|
177
|
+
type: 'added';
|
|
178
|
+
mutation: Mutation<any, any, any, any>;
|
|
179
|
+
}
|
|
180
|
+
interface NotifyEventMutationRemoved extends NotifyEvent {
|
|
181
|
+
type: 'removed';
|
|
182
|
+
mutation: Mutation<any, any, any, any>;
|
|
183
|
+
}
|
|
184
|
+
interface NotifyEventMutationObserverAdded extends NotifyEvent {
|
|
185
|
+
type: 'observerAdded';
|
|
186
|
+
mutation: Mutation<any, any, any, any>;
|
|
187
|
+
observer: MutationObserver<any, any, any>;
|
|
188
|
+
}
|
|
189
|
+
interface NotifyEventMutationObserverRemoved extends NotifyEvent {
|
|
190
|
+
type: 'observerRemoved';
|
|
191
|
+
mutation: Mutation<any, any, any, any>;
|
|
192
|
+
observer: MutationObserver<any, any, any>;
|
|
193
|
+
}
|
|
194
|
+
interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent {
|
|
195
|
+
type: 'observerOptionsUpdated';
|
|
196
|
+
mutation?: Mutation<any, any, any, any>;
|
|
197
|
+
observer: MutationObserver<any, any, any, any>;
|
|
198
|
+
}
|
|
199
|
+
interface NotifyEventMutationUpdated extends NotifyEvent {
|
|
200
|
+
type: 'updated';
|
|
201
|
+
mutation: Mutation<any, any, any, any>;
|
|
202
|
+
action: Action<any, any, any, any>;
|
|
203
|
+
}
|
|
204
|
+
type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationObserverOptionsUpdated | NotifyEventMutationUpdated;
|
|
205
|
+
type MutationCacheListener = (event: MutationCacheNotifyEvent) => void;
|
|
206
|
+
declare class MutationCache extends Subscribable<MutationCacheListener> {
|
|
207
|
+
#private;
|
|
208
|
+
config: MutationCacheConfig;
|
|
209
|
+
constructor(config?: MutationCacheConfig);
|
|
210
|
+
build<TData, TError, TVariables, TContext>(client: QueryClient, options: MutationOptions<TData, TError, TVariables, TContext>, state?: MutationState<TData, TError, TVariables, TContext>): Mutation<TData, TError, TVariables, TContext>;
|
|
211
|
+
add(mutation: Mutation<any, any, any, any>): void;
|
|
212
|
+
remove(mutation: Mutation<any, any, any, any>): void;
|
|
213
|
+
canRun(mutation: Mutation<any, any, any, any>): boolean;
|
|
214
|
+
runNext(mutation: Mutation<any, any, any, any>): Promise<unknown>;
|
|
215
|
+
clear(): void;
|
|
216
|
+
getAll(): Array<Mutation>;
|
|
217
|
+
find<TData = unknown, TError = DefaultError, TVariables = any, TContext = unknown>(filters: MutationFilters): Mutation<TData, TError, TVariables, TContext> | undefined;
|
|
218
|
+
findAll(filters?: MutationFilters): Array<Mutation>;
|
|
219
|
+
notify(event: MutationCacheNotifyEvent): void;
|
|
220
|
+
resumePausedMutations(): Promise<unknown>;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface MutationConfig<TData, TError, TVariables, TContext> {
|
|
224
|
+
mutationId: number;
|
|
225
|
+
mutationCache: MutationCache;
|
|
226
|
+
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
227
|
+
state?: MutationState<TData, TError, TVariables, TContext>;
|
|
228
|
+
}
|
|
229
|
+
interface MutationState<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> {
|
|
230
|
+
context: TContext | undefined;
|
|
231
|
+
data: TData | undefined;
|
|
232
|
+
error: TError | null;
|
|
233
|
+
failureCount: number;
|
|
234
|
+
failureReason: TError | null;
|
|
235
|
+
isPaused: boolean;
|
|
236
|
+
status: MutationStatus;
|
|
237
|
+
variables: TVariables | undefined;
|
|
238
|
+
submittedAt: number;
|
|
239
|
+
}
|
|
240
|
+
interface FailedAction<TError> {
|
|
241
|
+
type: 'failed';
|
|
242
|
+
failureCount: number;
|
|
243
|
+
error: TError | null;
|
|
244
|
+
}
|
|
245
|
+
interface PendingAction<TVariables, TContext> {
|
|
246
|
+
type: 'pending';
|
|
247
|
+
isPaused: boolean;
|
|
248
|
+
variables?: TVariables;
|
|
249
|
+
context?: TContext;
|
|
250
|
+
}
|
|
251
|
+
interface SuccessAction<TData> {
|
|
252
|
+
type: 'success';
|
|
253
|
+
data: TData;
|
|
254
|
+
}
|
|
255
|
+
interface ErrorAction<TError> {
|
|
256
|
+
type: 'error';
|
|
257
|
+
error: TError;
|
|
258
|
+
}
|
|
259
|
+
interface PauseAction {
|
|
260
|
+
type: 'pause';
|
|
261
|
+
}
|
|
262
|
+
interface ContinueAction {
|
|
263
|
+
type: 'continue';
|
|
264
|
+
}
|
|
265
|
+
type Action<TData, TError, TVariables, TContext> = ContinueAction | ErrorAction<TError> | FailedAction<TError> | PendingAction<TVariables, TContext> | PauseAction | SuccessAction<TData>;
|
|
266
|
+
declare class Mutation<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> extends Removable {
|
|
267
|
+
#private;
|
|
268
|
+
state: MutationState<TData, TError, TVariables, TContext>;
|
|
269
|
+
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
270
|
+
readonly mutationId: number;
|
|
271
|
+
constructor(config: MutationConfig<TData, TError, TVariables, TContext>);
|
|
272
|
+
setOptions(options: MutationOptions<TData, TError, TVariables, TContext>): void;
|
|
273
|
+
get meta(): MutationMeta | undefined;
|
|
274
|
+
addObserver(observer: MutationObserver<any, any, any, any>): void;
|
|
275
|
+
removeObserver(observer: MutationObserver<any, any, any, any>): void;
|
|
276
|
+
protected optionalRemove(): void;
|
|
277
|
+
continue(): Promise<unknown>;
|
|
278
|
+
execute(variables: TVariables): Promise<TData>;
|
|
279
|
+
}
|
|
280
|
+
declare function getDefaultState<TData, TError, TVariables, TContext>(): MutationState<TData, TError, TVariables, TContext>;
|
|
281
|
+
|
|
155
282
|
interface QueryFilters<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> {
|
|
156
283
|
/**
|
|
157
284
|
* Filter to active queries, inactive queries or all queries
|
|
@@ -342,132 +469,6 @@ declare class QueryClient {
|
|
|
342
469
|
clear(): void;
|
|
343
470
|
}
|
|
344
471
|
|
|
345
|
-
type MutationObserverListener<TData, TError, TVariables, TContext> = (result: MutationObserverResult<TData, TError, TVariables, TContext>) => void;
|
|
346
|
-
declare class MutationObserver<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends Subscribable<MutationObserverListener<TData, TError, TVariables, TContext>> {
|
|
347
|
-
#private;
|
|
348
|
-
options: MutationObserverOptions<TData, TError, TVariables, TContext>;
|
|
349
|
-
constructor(client: QueryClient, options: MutationObserverOptions<TData, TError, TVariables, TContext>);
|
|
350
|
-
protected bindMethods(): void;
|
|
351
|
-
setOptions(options: MutationObserverOptions<TData, TError, TVariables, TContext>): void;
|
|
352
|
-
protected onUnsubscribe(): void;
|
|
353
|
-
onMutationUpdate(action: Action<TData, TError, TVariables, TContext>): void;
|
|
354
|
-
getCurrentResult(): MutationObserverResult<TData, TError, TVariables, TContext>;
|
|
355
|
-
reset(): void;
|
|
356
|
-
mutate(variables: TVariables, options?: MutateOptions<TData, TError, TVariables, TContext>): Promise<TData>;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
interface MutationCacheConfig {
|
|
360
|
-
onError?: (error: DefaultError, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
361
|
-
onSuccess?: (data: unknown, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
362
|
-
onMutate?: (variables: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
363
|
-
onSettled?: (data: unknown | undefined, error: DefaultError | null, variables: unknown, context: unknown, mutation: Mutation<unknown, unknown, unknown>) => Promise<unknown> | unknown;
|
|
364
|
-
}
|
|
365
|
-
interface NotifyEventMutationAdded extends NotifyEvent {
|
|
366
|
-
type: 'added';
|
|
367
|
-
mutation: Mutation<any, any, any, any>;
|
|
368
|
-
}
|
|
369
|
-
interface NotifyEventMutationRemoved extends NotifyEvent {
|
|
370
|
-
type: 'removed';
|
|
371
|
-
mutation: Mutation<any, any, any, any>;
|
|
372
|
-
}
|
|
373
|
-
interface NotifyEventMutationObserverAdded extends NotifyEvent {
|
|
374
|
-
type: 'observerAdded';
|
|
375
|
-
mutation: Mutation<any, any, any, any>;
|
|
376
|
-
observer: MutationObserver<any, any, any>;
|
|
377
|
-
}
|
|
378
|
-
interface NotifyEventMutationObserverRemoved extends NotifyEvent {
|
|
379
|
-
type: 'observerRemoved';
|
|
380
|
-
mutation: Mutation<any, any, any, any>;
|
|
381
|
-
observer: MutationObserver<any, any, any>;
|
|
382
|
-
}
|
|
383
|
-
interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent {
|
|
384
|
-
type: 'observerOptionsUpdated';
|
|
385
|
-
mutation?: Mutation<any, any, any, any>;
|
|
386
|
-
observer: MutationObserver<any, any, any, any>;
|
|
387
|
-
}
|
|
388
|
-
interface NotifyEventMutationUpdated extends NotifyEvent {
|
|
389
|
-
type: 'updated';
|
|
390
|
-
mutation: Mutation<any, any, any, any>;
|
|
391
|
-
action: Action<any, any, any, any>;
|
|
392
|
-
}
|
|
393
|
-
type MutationCacheNotifyEvent = NotifyEventMutationAdded | NotifyEventMutationRemoved | NotifyEventMutationObserverAdded | NotifyEventMutationObserverRemoved | NotifyEventMutationObserverOptionsUpdated | NotifyEventMutationUpdated;
|
|
394
|
-
type MutationCacheListener = (event: MutationCacheNotifyEvent) => void;
|
|
395
|
-
declare class MutationCache extends Subscribable<MutationCacheListener> {
|
|
396
|
-
#private;
|
|
397
|
-
config: MutationCacheConfig;
|
|
398
|
-
constructor(config?: MutationCacheConfig);
|
|
399
|
-
build<TData, TError, TVariables, TContext>(client: QueryClient, options: MutationOptions<TData, TError, TVariables, TContext>, state?: MutationState<TData, TError, TVariables, TContext>): Mutation<TData, TError, TVariables, TContext>;
|
|
400
|
-
add(mutation: Mutation<any, any, any, any>): void;
|
|
401
|
-
remove(mutation: Mutation<any, any, any, any>): void;
|
|
402
|
-
canRun(mutation: Mutation<any, any, any, any>): boolean;
|
|
403
|
-
runNext(mutation: Mutation<any, any, any, any>): Promise<unknown>;
|
|
404
|
-
clear(): void;
|
|
405
|
-
getAll(): Array<Mutation>;
|
|
406
|
-
find<TData = unknown, TError = DefaultError, TVariables = any, TContext = unknown>(filters: MutationFilters): Mutation<TData, TError, TVariables, TContext> | undefined;
|
|
407
|
-
findAll(filters?: MutationFilters): Array<Mutation>;
|
|
408
|
-
notify(event: MutationCacheNotifyEvent): void;
|
|
409
|
-
resumePausedMutations(): Promise<unknown>;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
interface MutationConfig<TData, TError, TVariables, TContext> {
|
|
413
|
-
mutationId: number;
|
|
414
|
-
mutationCache: MutationCache;
|
|
415
|
-
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
416
|
-
state?: MutationState<TData, TError, TVariables, TContext>;
|
|
417
|
-
}
|
|
418
|
-
interface MutationState<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> {
|
|
419
|
-
context: TContext | undefined;
|
|
420
|
-
data: TData | undefined;
|
|
421
|
-
error: TError | null;
|
|
422
|
-
failureCount: number;
|
|
423
|
-
failureReason: TError | null;
|
|
424
|
-
isPaused: boolean;
|
|
425
|
-
status: MutationStatus;
|
|
426
|
-
variables: TVariables | undefined;
|
|
427
|
-
submittedAt: number;
|
|
428
|
-
}
|
|
429
|
-
interface FailedAction<TError> {
|
|
430
|
-
type: 'failed';
|
|
431
|
-
failureCount: number;
|
|
432
|
-
error: TError | null;
|
|
433
|
-
}
|
|
434
|
-
interface PendingAction<TVariables, TContext> {
|
|
435
|
-
type: 'pending';
|
|
436
|
-
isPaused: boolean;
|
|
437
|
-
variables?: TVariables;
|
|
438
|
-
context?: TContext;
|
|
439
|
-
}
|
|
440
|
-
interface SuccessAction<TData> {
|
|
441
|
-
type: 'success';
|
|
442
|
-
data: TData;
|
|
443
|
-
}
|
|
444
|
-
interface ErrorAction<TError> {
|
|
445
|
-
type: 'error';
|
|
446
|
-
error: TError;
|
|
447
|
-
}
|
|
448
|
-
interface PauseAction {
|
|
449
|
-
type: 'pause';
|
|
450
|
-
}
|
|
451
|
-
interface ContinueAction {
|
|
452
|
-
type: 'continue';
|
|
453
|
-
}
|
|
454
|
-
type Action<TData, TError, TVariables, TContext> = ContinueAction | ErrorAction<TError> | FailedAction<TError> | PendingAction<TVariables, TContext> | PauseAction | SuccessAction<TData>;
|
|
455
|
-
declare class Mutation<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> extends Removable {
|
|
456
|
-
#private;
|
|
457
|
-
state: MutationState<TData, TError, TVariables, TContext>;
|
|
458
|
-
options: MutationOptions<TData, TError, TVariables, TContext>;
|
|
459
|
-
readonly mutationId: number;
|
|
460
|
-
constructor(config: MutationConfig<TData, TError, TVariables, TContext>);
|
|
461
|
-
setOptions(options: MutationOptions<TData, TError, TVariables, TContext>): void;
|
|
462
|
-
get meta(): MutationMeta | undefined;
|
|
463
|
-
addObserver(observer: MutationObserver<any, any, any, any>): void;
|
|
464
|
-
removeObserver(observer: MutationObserver<any, any, any, any>): void;
|
|
465
|
-
protected optionalRemove(): void;
|
|
466
|
-
continue(): Promise<unknown>;
|
|
467
|
-
execute(variables: TVariables): Promise<TData>;
|
|
468
|
-
}
|
|
469
|
-
declare function getDefaultState<TData, TError, TVariables, TContext>(): MutationState<TData, TError, TVariables, TContext>;
|
|
470
|
-
|
|
471
472
|
interface RetryerConfig<TData = unknown, TError = DefaultError> {
|
|
472
473
|
fn: () => TData | Promise<TData>;
|
|
473
474
|
initialPromise?: Promise<TData>;
|
|
@@ -536,6 +537,7 @@ type StaleTime<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnDa
|
|
|
536
537
|
type Enabled<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = boolean | ((query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean);
|
|
537
538
|
type QueryPersister<T = unknown, TQueryKey extends QueryKey = QueryKey, TPageParam = never> = [TPageParam] extends [never] ? (queryFn: QueryFunction<T, TQueryKey, never>, context: QueryFunctionContext<TQueryKey>, query: Query) => T | Promise<T> : (queryFn: QueryFunction<T, TQueryKey, TPageParam>, context: QueryFunctionContext<TQueryKey>, query: Query) => T | Promise<T>;
|
|
538
539
|
type QueryFunctionContext<TQueryKey extends QueryKey = QueryKey, TPageParam = never> = [TPageParam] extends [never] ? {
|
|
540
|
+
client: QueryClient;
|
|
539
541
|
queryKey: TQueryKey;
|
|
540
542
|
signal: AbortSignal;
|
|
541
543
|
meta: QueryMeta | undefined;
|
|
@@ -546,6 +548,7 @@ type QueryFunctionContext<TQueryKey extends QueryKey = QueryKey, TPageParam = ne
|
|
|
546
548
|
*/
|
|
547
549
|
direction?: unknown;
|
|
548
550
|
} : {
|
|
551
|
+
client: QueryClient;
|
|
549
552
|
queryKey: TQueryKey;
|
|
550
553
|
signal: AbortSignal;
|
|
551
554
|
pageParam: TPageParam;
|
|
@@ -642,6 +645,7 @@ interface QueryObserverOptions<TQueryFnData = unknown, TError = DefaultError, TD
|
|
|
642
645
|
* The time in milliseconds after data is considered stale.
|
|
643
646
|
* If set to `Infinity`, the data will never be considered stale.
|
|
644
647
|
* If set to a function, the function will be executed with the query to compute a `staleTime`.
|
|
648
|
+
* Defaults to `0`.
|
|
645
649
|
*/
|
|
646
650
|
staleTime?: StaleTime<TQueryFnData, TError, TQueryData, TQueryKey>;
|
|
647
651
|
/**
|
|
@@ -970,6 +974,7 @@ interface QueryObserverPendingResult<TData = unknown, TError = DefaultError> ext
|
|
|
970
974
|
isLoadingError: false;
|
|
971
975
|
isRefetchError: false;
|
|
972
976
|
isSuccess: false;
|
|
977
|
+
isPlaceholderData: false;
|
|
973
978
|
status: 'pending';
|
|
974
979
|
}
|
|
975
980
|
interface QueryObserverLoadingResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
|
|
@@ -981,6 +986,7 @@ interface QueryObserverLoadingResult<TData = unknown, TError = DefaultError> ext
|
|
|
981
986
|
isLoadingError: false;
|
|
982
987
|
isRefetchError: false;
|
|
983
988
|
isSuccess: false;
|
|
989
|
+
isPlaceholderData: false;
|
|
984
990
|
status: 'pending';
|
|
985
991
|
}
|
|
986
992
|
interface QueryObserverLoadingErrorResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
|
|
@@ -992,6 +998,7 @@ interface QueryObserverLoadingErrorResult<TData = unknown, TError = DefaultError
|
|
|
992
998
|
isLoadingError: true;
|
|
993
999
|
isRefetchError: false;
|
|
994
1000
|
isSuccess: false;
|
|
1001
|
+
isPlaceholderData: false;
|
|
995
1002
|
status: 'error';
|
|
996
1003
|
}
|
|
997
1004
|
interface QueryObserverRefetchErrorResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
|
|
@@ -1003,6 +1010,7 @@ interface QueryObserverRefetchErrorResult<TData = unknown, TError = DefaultError
|
|
|
1003
1010
|
isLoadingError: false;
|
|
1004
1011
|
isRefetchError: true;
|
|
1005
1012
|
isSuccess: false;
|
|
1013
|
+
isPlaceholderData: false;
|
|
1006
1014
|
status: 'error';
|
|
1007
1015
|
}
|
|
1008
1016
|
interface QueryObserverSuccessResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
|
|
@@ -1014,10 +1022,23 @@ interface QueryObserverSuccessResult<TData = unknown, TError = DefaultError> ext
|
|
|
1014
1022
|
isLoadingError: false;
|
|
1015
1023
|
isRefetchError: false;
|
|
1016
1024
|
isSuccess: true;
|
|
1025
|
+
isPlaceholderData: false;
|
|
1026
|
+
status: 'success';
|
|
1027
|
+
}
|
|
1028
|
+
interface QueryObserverPlaceholderResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
|
|
1029
|
+
data: TData;
|
|
1030
|
+
isError: false;
|
|
1031
|
+
error: null;
|
|
1032
|
+
isPending: false;
|
|
1033
|
+
isLoading: false;
|
|
1034
|
+
isLoadingError: false;
|
|
1035
|
+
isRefetchError: false;
|
|
1036
|
+
isSuccess: true;
|
|
1037
|
+
isPlaceholderData: true;
|
|
1017
1038
|
status: 'success';
|
|
1018
1039
|
}
|
|
1019
1040
|
type DefinedQueryObserverResult<TData = unknown, TError = DefaultError> = QueryObserverRefetchErrorResult<TData, TError> | QueryObserverSuccessResult<TData, TError>;
|
|
1020
|
-
type QueryObserverResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError> | QueryObserverLoadingErrorResult<TData, TError> | QueryObserverLoadingResult<TData, TError> | QueryObserverPendingResult<TData, TError>;
|
|
1041
|
+
type QueryObserverResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError> | QueryObserverLoadingErrorResult<TData, TError> | QueryObserverLoadingResult<TData, TError> | QueryObserverPendingResult<TData, TError> | QueryObserverPlaceholderResult<TData, TError>;
|
|
1021
1042
|
interface InfiniteQueryObserverBaseResult<TData = unknown, TError = DefaultError> extends QueryObserverBaseResult<TData, TError> {
|
|
1022
1043
|
/**
|
|
1023
1044
|
* This function allows you to fetch the next "page" of results.
|
|
@@ -1062,6 +1083,7 @@ interface InfiniteQueryObserverPendingResult<TData = unknown, TError = DefaultEr
|
|
|
1062
1083
|
isFetchNextPageError: false;
|
|
1063
1084
|
isFetchPreviousPageError: false;
|
|
1064
1085
|
isSuccess: false;
|
|
1086
|
+
isPlaceholderData: false;
|
|
1065
1087
|
status: 'pending';
|
|
1066
1088
|
}
|
|
1067
1089
|
interface InfiniteQueryObserverLoadingResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
@@ -1075,6 +1097,7 @@ interface InfiniteQueryObserverLoadingResult<TData = unknown, TError = DefaultEr
|
|
|
1075
1097
|
isFetchNextPageError: false;
|
|
1076
1098
|
isFetchPreviousPageError: false;
|
|
1077
1099
|
isSuccess: false;
|
|
1100
|
+
isPlaceholderData: false;
|
|
1078
1101
|
status: 'pending';
|
|
1079
1102
|
}
|
|
1080
1103
|
interface InfiniteQueryObserverLoadingErrorResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
@@ -1088,6 +1111,7 @@ interface InfiniteQueryObserverLoadingErrorResult<TData = unknown, TError = Defa
|
|
|
1088
1111
|
isFetchNextPageError: false;
|
|
1089
1112
|
isFetchPreviousPageError: false;
|
|
1090
1113
|
isSuccess: false;
|
|
1114
|
+
isPlaceholderData: false;
|
|
1091
1115
|
status: 'error';
|
|
1092
1116
|
}
|
|
1093
1117
|
interface InfiniteQueryObserverRefetchErrorResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
@@ -1099,6 +1123,7 @@ interface InfiniteQueryObserverRefetchErrorResult<TData = unknown, TError = Defa
|
|
|
1099
1123
|
isLoadingError: false;
|
|
1100
1124
|
isRefetchError: true;
|
|
1101
1125
|
isSuccess: false;
|
|
1126
|
+
isPlaceholderData: false;
|
|
1102
1127
|
status: 'error';
|
|
1103
1128
|
}
|
|
1104
1129
|
interface InfiniteQueryObserverSuccessResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
@@ -1112,10 +1137,25 @@ interface InfiniteQueryObserverSuccessResult<TData = unknown, TError = DefaultEr
|
|
|
1112
1137
|
isFetchNextPageError: false;
|
|
1113
1138
|
isFetchPreviousPageError: false;
|
|
1114
1139
|
isSuccess: true;
|
|
1140
|
+
isPlaceholderData: false;
|
|
1141
|
+
status: 'success';
|
|
1142
|
+
}
|
|
1143
|
+
interface InfiniteQueryObserverPlaceholderResult<TData = unknown, TError = DefaultError> extends InfiniteQueryObserverBaseResult<TData, TError> {
|
|
1144
|
+
data: TData;
|
|
1145
|
+
isError: false;
|
|
1146
|
+
error: null;
|
|
1147
|
+
isPending: false;
|
|
1148
|
+
isLoading: false;
|
|
1149
|
+
isLoadingError: false;
|
|
1150
|
+
isRefetchError: false;
|
|
1151
|
+
isSuccess: true;
|
|
1152
|
+
isPlaceholderData: true;
|
|
1153
|
+
isFetchNextPageError: false;
|
|
1154
|
+
isFetchPreviousPageError: false;
|
|
1115
1155
|
status: 'success';
|
|
1116
1156
|
}
|
|
1117
1157
|
type DefinedInfiniteQueryObserverResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverRefetchErrorResult<TData, TError> | InfiniteQueryObserverSuccessResult<TData, TError>;
|
|
1118
|
-
type InfiniteQueryObserverResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError> | InfiniteQueryObserverLoadingErrorResult<TData, TError> | InfiniteQueryObserverLoadingResult<TData, TError> | InfiniteQueryObserverPendingResult<TData, TError>;
|
|
1158
|
+
type InfiniteQueryObserverResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError> | InfiniteQueryObserverLoadingErrorResult<TData, TError> | InfiniteQueryObserverLoadingResult<TData, TError> | InfiniteQueryObserverPendingResult<TData, TError> | InfiniteQueryObserverPlaceholderResult<TData, TError>;
|
|
1119
1159
|
type MutationKey = Register extends {
|
|
1120
1160
|
mutationKey: infer TMutationKey;
|
|
1121
1161
|
} ? TMutationKey extends Array<unknown> ? TMutationKey : TMutationKey extends Array<unknown> ? TMutationKey : ReadonlyArray<unknown> : ReadonlyArray<unknown>;
|
|
@@ -1309,4 +1349,4 @@ declare function defaultShouldDehydrateQuery(query: Query): boolean;
|
|
|
1309
1349
|
declare function dehydrate(client: QueryClient, options?: DehydrateOptions): DehydratedState;
|
|
1310
1350
|
declare function hydrate(client: QueryClient, dehydratedState: unknown, options?: HydrateOptions): void;
|
|
1311
1351
|
|
|
1312
|
-
export { type GetNextPageParamFunction as $, type QueryKey as A, dataTagSymbol as B, CancelledError as C, type DehydrateOptions as D, dataTagErrorSymbol as E, unsetMarker as F, type UnsetMarker as G, type HydrateOptions as H, type AnyDataTag as I, type DataTag as J, type QueryFunction as K, type StaleTime as L, MutationCache as M, type NoInfer as N, type OmitKeyof as O, type Enabled as P, QueryCache as Q, type Register as R, type SkipToken as S, type QueryPersister as T, type Updater as U, type QueryFunctionContext as V, type InitialDataFunction as W, type PlaceholderDataFunction as X, type QueriesPlaceholderDataFunction as Y, type QueryKeyHashFunction as Z, type GetPreviousPageParamFunction as _, type QueryCacheNotifyEvent as a, type
|
|
1352
|
+
export { type GetNextPageParamFunction as $, type QueryKey as A, dataTagSymbol as B, CancelledError as C, type DehydrateOptions as D, dataTagErrorSymbol as E, unsetMarker as F, type UnsetMarker as G, type HydrateOptions as H, type AnyDataTag as I, type DataTag as J, type QueryFunction as K, type StaleTime as L, MutationCache as M, type NoInfer as N, type OmitKeyof as O, type Enabled as P, QueryCache as Q, type Register as R, type SkipToken as S, type QueryPersister as T, type Updater as U, type QueryFunctionContext as V, type InitialDataFunction as W, type PlaceholderDataFunction as X, type QueriesPlaceholderDataFunction as Y, type QueryKeyHashFunction as Z, type GetPreviousPageParamFunction as _, type QueryCacheNotifyEvent as a, type CancelOptions as a$, type InfiniteData as a0, type QueryMeta as a1, type NetworkMode as a2, type NotifyOnChangeProps as a3, type QueryOptions as a4, type InitialPageParam as a5, type InfiniteQueryPageParamsOptions as a6, type ThrowOnError as a7, type QueryObserverOptions as a8, type WithRequired as a9, type QueryObserverResult as aA, type InfiniteQueryObserverBaseResult as aB, type InfiniteQueryObserverPendingResult as aC, type InfiniteQueryObserverLoadingResult as aD, type InfiniteQueryObserverLoadingErrorResult as aE, type InfiniteQueryObserverRefetchErrorResult as aF, type InfiniteQueryObserverSuccessResult as aG, type InfiniteQueryObserverPlaceholderResult as aH, type DefinedInfiniteQueryObserverResult as aI, type InfiniteQueryObserverResult as aJ, type MutationKey as aK, type MutationStatus as aL, type MutationScope as aM, type MutationMeta as aN, type MutationFunction as aO, type MutationOptions as aP, type MutationObserverOptions as aQ, type MutateOptions as aR, type MutateFunction as aS, type MutationObserverBaseResult as aT, type MutationObserverIdleResult as aU, type MutationObserverLoadingResult as aV, type MutationObserverErrorResult as aW, type MutationObserverSuccessResult as aX, type MutationObserverResult as aY, type QueryClientConfig as aZ, type DefaultOptions as a_, type Optional as aa, type DefaultedQueryObserverOptions as ab, type InfiniteQueryObserverOptions as ac, type DefaultedInfiniteQueryObserverOptions as ad, type FetchQueryOptions as ae, type EnsureQueryDataOptions as af, type EnsureInfiniteQueryDataOptions as ag, type FetchInfiniteQueryOptions as ah, type ResultOptions as ai, type RefetchOptions as aj, type InvalidateQueryFilters as ak, type RefetchQueryFilters as al, type InvalidateOptions as am, type ResetOptions as an, type FetchNextPageOptions as ao, type FetchPreviousPageOptions as ap, type QueryStatus as aq, type FetchStatus as ar, type QueryObserverBaseResult as as, type QueryObserverPendingResult as at, type QueryObserverLoadingResult as au, type QueryObserverLoadingErrorResult as av, type QueryObserverRefetchErrorResult as aw, type QueryObserverSuccessResult as ax, type QueryObserverPlaceholderResult as ay, type DefinedQueryObserverResult as az, QueryClient as b, type SetDataOptions as b0, type NotifyEventType as b1, type NotifyEvent as b2, type QueryBehavior as b3, type NotifyOptions as b4, type FetchContext as b5, type FetchDirection as b6, type FetchMeta as b7, type FetchOptions as b8, type Action$1 as b9, createRetryer as bA, type SetStateOptions as ba, fetchState as bb, type Action as bc, getDefaultState as bd, type QueryTypeFilter as be, noop as bf, functionalUpdate as bg, isValidTimeout as bh, timeUntilStale as bi, resolveStaleTime as bj, resolveEnabled as bk, hashQueryKeyByOptions as bl, partialMatchKey as bm, shallowEqualObjects as bn, isPlainArray as bo, isPlainObject as bp, sleep as bq, replaceData as br, addToEnd as bs, addToStart as bt, ensureQueryFn as bu, type QueryStore as bv, type Retryer as bw, type RetryValue as bx, type RetryDelayValue as by, canFetch as bz, QueryObserver as c, type MutationCacheNotifyEvent as d, MutationObserver as e, matchMutation as f, type MutationFilters as g, hashKey as h, isServer as i, type QueryFilters as j, keepPreviousData as k, isCancelledError as l, matchQuery as m, dehydrate as n, hydrate as o, defaultShouldDehydrateQuery as p, defaultShouldDehydrateMutation as q, replaceEqualDeep as r, skipToken as s, type QueryState as t, Query as u, type MutationState as v, Mutation as w, type DehydratedState as x, type Override as y, type DefaultError as z };
|