@tanstack/query-core 5.28.4 → 5.28.8
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.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.map +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +1 -1
- package/build/legacy/infiniteQueryBehavior.d.ts +1 -1
- 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.map +1 -1
- package/build/legacy/query.d.cts +1 -1
- package/build/legacy/query.d.ts +1 -1
- package/build/legacy/query.js.map +1 -1
- package/build/legacy/queryCache.d.cts +1 -1
- package/build/legacy/queryCache.d.ts +1 -1
- package/build/legacy/{queryClient-6vLRMq5C.d.ts → queryClient-Iu1tSaKE.d.ts} +7 -6
- package/build/legacy/{queryClient-C_S9rQE6.d.cts → queryClient-nKFaeeO2.d.cts} +7 -6
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +1 -1
- package/build/legacy/queryClient.d.ts +1 -1
- package/build/legacy/queryClient.js.map +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/utils.d.cts +1 -1
- package/build/legacy/utils.d.ts +1 -1
- 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.map +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +1 -1
- package/build/modern/infiniteQueryBehavior.d.ts +1 -1
- 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.map +1 -1
- package/build/modern/query.d.cts +1 -1
- package/build/modern/query.d.ts +1 -1
- package/build/modern/query.js.map +1 -1
- package/build/modern/queryCache.d.cts +1 -1
- package/build/modern/queryCache.d.ts +1 -1
- package/build/modern/{queryClient-6vLRMq5C.d.ts → queryClient-Iu1tSaKE.d.ts} +7 -6
- package/build/modern/{queryClient-C_S9rQE6.d.cts → queryClient-nKFaeeO2.d.cts} +7 -6
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +1 -1
- package/build/modern/queryClient.d.ts +1 -1
- package/build/modern/queryClient.js.map +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/utils.d.cts +1 -1
- package/build/modern/utils.d.ts +1 -1
- package/package.json +2 -1
- package/src/__tests__/OmitKeyof.test-d.ts +59 -0
- package/src/infiniteQueryBehavior.ts +2 -1
- package/src/query.ts +6 -2
- package/src/queryClient.ts +9 -6
- package/src/types.ts +13 -2
- /package/src/{tests → __tests__}/focusManager.test.tsx +0 -0
- /package/src/{tests → __tests__}/hydration.test.tsx +0 -0
- /package/src/{tests → __tests__}/infiniteQueryBehavior.test.tsx +0 -0
- /package/src/{tests → __tests__}/infiniteQueryObserver.test-d.tsx +0 -0
- /package/src/{tests → __tests__}/infiniteQueryObserver.test.tsx +0 -0
- /package/src/{tests → __tests__}/mutationCache.test.tsx +0 -0
- /package/src/{tests → __tests__}/mutationObserver.test.tsx +0 -0
- /package/src/{tests → __tests__}/mutations.test.tsx +0 -0
- /package/src/{tests → __tests__}/notifyManager.test.tsx +0 -0
- /package/src/{tests → __tests__}/onlineManager.test.tsx +0 -0
- /package/src/{tests → __tests__}/queriesObserver.test.tsx +0 -0
- /package/src/{tests → __tests__}/query.test.tsx +0 -0
- /package/src/{tests → __tests__}/queryCache.test.tsx +0 -0
- /package/src/{tests → __tests__}/queryClient.test-d.tsx +0 -0
- /package/src/{tests → __tests__}/queryClient.test.tsx +0 -0
- /package/src/{tests → __tests__}/queryObserver.test-d.tsx +0 -0
- /package/src/{tests → __tests__}/queryObserver.test.tsx +0 -0
- /package/src/{tests → __tests__}/utils.test.tsx +0 -0
- /package/src/{tests → __tests__}/utils.ts +0 -0
|
@@ -3,6 +3,7 @@ import type { QueryBehavior } from './query'
|
|
|
3
3
|
import type {
|
|
4
4
|
InfiniteData,
|
|
5
5
|
InfiniteQueryPageParamsOptions,
|
|
6
|
+
OmitKeyof,
|
|
6
7
|
QueryFunctionContext,
|
|
7
8
|
QueryKey,
|
|
8
9
|
} from './types'
|
|
@@ -67,7 +68,7 @@ export function infiniteQueryBehavior<TQueryFnData, TError, TData, TPageParam>(
|
|
|
67
68
|
return Promise.resolve(data)
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
const queryFnContext:
|
|
71
|
+
const queryFnContext: OmitKeyof<
|
|
71
72
|
QueryFunctionContext<QueryKey, unknown>,
|
|
72
73
|
'signal'
|
|
73
74
|
> = {
|
package/src/query.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
DefaultError,
|
|
8
8
|
FetchStatus,
|
|
9
9
|
InitialDataFunction,
|
|
10
|
+
OmitKeyof,
|
|
10
11
|
QueryFunctionContext,
|
|
11
12
|
QueryKey,
|
|
12
13
|
QueryMeta,
|
|
@@ -370,7 +371,10 @@ export class Query<
|
|
|
370
371
|
const abortController = new AbortController()
|
|
371
372
|
|
|
372
373
|
// Create query function context
|
|
373
|
-
const queryFnContext:
|
|
374
|
+
const queryFnContext: OmitKeyof<
|
|
375
|
+
QueryFunctionContext<TQueryKey>,
|
|
376
|
+
'signal'
|
|
377
|
+
> = {
|
|
374
378
|
queryKey: this.queryKey,
|
|
375
379
|
meta: this.meta,
|
|
376
380
|
}
|
|
@@ -421,7 +425,7 @@ export class Query<
|
|
|
421
425
|
}
|
|
422
426
|
|
|
423
427
|
// Trigger behavior hook
|
|
424
|
-
const context:
|
|
428
|
+
const context: OmitKeyof<
|
|
425
429
|
FetchContext<TQueryFnData, TError, TData, TQueryKey>,
|
|
426
430
|
'signal'
|
|
427
431
|
> = {
|
package/src/queryClient.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { focusManager } from './focusManager'
|
|
|
12
12
|
import { onlineManager } from './onlineManager'
|
|
13
13
|
import { notifyManager } from './notifyManager'
|
|
14
14
|
import { infiniteQueryBehavior } from './infiniteQueryBehavior'
|
|
15
|
-
import type { DataTag, NoInfer } from './types'
|
|
15
|
+
import type { DataTag, NoInfer, OmitKeyof } from './types'
|
|
16
16
|
import type { QueryState } from './query'
|
|
17
17
|
import type {
|
|
18
18
|
CancelOptions,
|
|
@@ -43,7 +43,7 @@ import type { MutationFilters, QueryFilters, Updater } from './utils'
|
|
|
43
43
|
|
|
44
44
|
interface QueryDefaults {
|
|
45
45
|
queryKey: QueryKey
|
|
46
|
-
defaultOptions:
|
|
46
|
+
defaultOptions: OmitKeyof<QueryOptions<any, any, any>, 'queryKey'>
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
interface MutationDefaults {
|
|
@@ -429,7 +429,7 @@ export class QueryClient {
|
|
|
429
429
|
setQueryDefaults(
|
|
430
430
|
queryKey: QueryKey,
|
|
431
431
|
options: Partial<
|
|
432
|
-
|
|
432
|
+
OmitKeyof<QueryObserverOptions<unknown, any, any, any>, 'queryKey'>
|
|
433
433
|
>,
|
|
434
434
|
): void {
|
|
435
435
|
this.#queryDefaults.set(hashKey(queryKey), {
|
|
@@ -440,10 +440,10 @@ export class QueryClient {
|
|
|
440
440
|
|
|
441
441
|
getQueryDefaults(
|
|
442
442
|
queryKey: QueryKey,
|
|
443
|
-
):
|
|
443
|
+
): OmitKeyof<QueryObserverOptions<any, any, any, any, any>, 'queryKey'> {
|
|
444
444
|
const defaults = [...this.#queryDefaults.values()]
|
|
445
445
|
|
|
446
|
-
let result:
|
|
446
|
+
let result: OmitKeyof<
|
|
447
447
|
QueryObserverOptions<any, any, any, any, any>,
|
|
448
448
|
'queryKey'
|
|
449
449
|
> = {}
|
|
@@ -458,7 +458,10 @@ export class QueryClient {
|
|
|
458
458
|
|
|
459
459
|
setMutationDefaults(
|
|
460
460
|
mutationKey: MutationKey,
|
|
461
|
-
options:
|
|
461
|
+
options: OmitKeyof<
|
|
462
|
+
MutationObserverOptions<any, any, any, any>,
|
|
463
|
+
'mutationKey'
|
|
464
|
+
>,
|
|
462
465
|
): void {
|
|
463
466
|
this.#mutationDefaults.set(hashKey(mutationKey), {
|
|
464
467
|
mutationKey,
|
package/src/types.ts
CHANGED
|
@@ -7,6 +7,14 @@ import type { QueryFilters, QueryTypeFilter, SkipToken } from './utils'
|
|
|
7
7
|
import type { QueryCache } from './queryCache'
|
|
8
8
|
import type { MutationCache } from './mutationCache'
|
|
9
9
|
|
|
10
|
+
export type OmitKeyof<
|
|
11
|
+
TObject,
|
|
12
|
+
TKey extends TStrictly extends 'safely'
|
|
13
|
+
? keyof TObject | (string & Record<never, never>)
|
|
14
|
+
: keyof TObject,
|
|
15
|
+
TStrictly extends 'strictly' | 'safely' = 'strictly',
|
|
16
|
+
> = Omit<TObject, TKey>
|
|
17
|
+
|
|
10
18
|
export type NoInfer<T> = [T][T extends any ? 0 : never]
|
|
11
19
|
|
|
12
20
|
export interface Register {
|
|
@@ -341,7 +349,7 @@ export type Optional<TTarget, TKey extends keyof TTarget> = Pick<
|
|
|
341
349
|
Partial<TTarget>,
|
|
342
350
|
TKey
|
|
343
351
|
> &
|
|
344
|
-
|
|
352
|
+
OmitKeyof<TTarget, TKey>
|
|
345
353
|
|
|
346
354
|
export type DefaultedQueryObserverOptions<
|
|
347
355
|
TQueryFnData = unknown,
|
|
@@ -889,7 +897,10 @@ export interface QueryClientConfig {
|
|
|
889
897
|
}
|
|
890
898
|
|
|
891
899
|
export interface DefaultOptions<TError = DefaultError> {
|
|
892
|
-
queries?:
|
|
900
|
+
queries?: OmitKeyof<
|
|
901
|
+
QueryObserverOptions<unknown, TError>,
|
|
902
|
+
'suspense' | 'queryKey'
|
|
903
|
+
>
|
|
893
904
|
mutations?: MutationObserverOptions<unknown, TError, unknown, unknown>
|
|
894
905
|
}
|
|
895
906
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|