@tanstack/query-core 4.0.8 → 4.0.11-beta.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/build/{types/packages/query-core/src → lib}/focusManager.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/hydration.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/index.d.ts +2 -2
- package/build/lib/index.js +3115 -0
- package/build/lib/index.js.map +1 -0
- package/build/{esm/index.js → lib/index.mjs} +22 -7
- package/build/lib/index.mjs.map +1 -0
- package/build/{types/packages/query-core/src → lib}/infiniteQueryBehavior.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/infiniteQueryObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/logger.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/logger.native.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/mutation.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/mutationCache.d.ts +6 -1
- package/build/{types/packages/query-core/src → lib}/mutationObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/notifyManager.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/onlineManager.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queriesObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/query.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queryCache.d.ts +6 -1
- package/build/{types/packages/query-core/src → lib}/queryClient.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/queryObserver.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/removable.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/retryer.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/subscribable.d.ts +0 -0
- package/build/{types/packages/query-core/src → lib}/types.d.ts +10 -8
- package/build/{types/packages/query-core/src → lib}/utils.d.ts +0 -0
- package/build/umd/index.development.js +21 -6
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +16 -7
- package/src/index.ts +2 -2
- package/src/mutationCache.ts +7 -0
- package/src/mutationObserver.ts +9 -0
- package/src/queryCache.ts +7 -0
- package/src/queryClient.ts +10 -14
- package/src/queryObserver.ts +8 -0
- package/src/tests/queryClient.test.tsx +33 -0
- package/src/tests/queryObserver.test.tsx +19 -0
- package/src/types.ts +15 -9
- package/src/utils.ts +2 -0
- package/build/cjs/focusManager.js +0 -101
- package/build/cjs/focusManager.js.map +0 -1
- package/build/cjs/hydration.js +0 -112
- package/build/cjs/hydration.js.map +0 -1
- package/build/cjs/index.js +0 -51
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/infiniteQueryBehavior.js +0 -160
- package/build/cjs/infiniteQueryBehavior.js.map +0 -1
- package/build/cjs/infiniteQueryObserver.js +0 -92
- package/build/cjs/infiniteQueryObserver.js.map +0 -1
- package/build/cjs/logger.js +0 -18
- package/build/cjs/logger.js.map +0 -1
- package/build/cjs/mutation.js +0 -258
- package/build/cjs/mutation.js.map +0 -1
- package/build/cjs/mutationCache.js +0 -99
- package/build/cjs/mutationCache.js.map +0 -1
- package/build/cjs/mutationObserver.js +0 -130
- package/build/cjs/mutationObserver.js.map +0 -1
- package/build/cjs/notifyManager.js +0 -114
- package/build/cjs/notifyManager.js.map +0 -1
- package/build/cjs/onlineManager.js +0 -100
- package/build/cjs/onlineManager.js.map +0 -1
- package/build/cjs/queriesObserver.js +0 -170
- package/build/cjs/queriesObserver.js.map +0 -1
- package/build/cjs/query.js +0 -474
- package/build/cjs/query.js.map +0 -1
- package/build/cjs/queryCache.js +0 -140
- package/build/cjs/queryCache.js.map +0 -1
- package/build/cjs/queryClient.js +0 -357
- package/build/cjs/queryClient.js.map +0 -1
- package/build/cjs/queryObserver.js +0 -521
- package/build/cjs/queryObserver.js.map +0 -1
- package/build/cjs/removable.js +0 -47
- package/build/cjs/removable.js.map +0 -1
- package/build/cjs/retryer.js +0 -177
- package/build/cjs/retryer.js.map +0 -1
- package/build/cjs/subscribable.js +0 -43
- package/build/cjs/subscribable.js.map +0 -1
- package/build/cjs/utils.js +0 -356
- package/build/cjs/utils.js.map +0 -1
- package/build/esm/index.js.map +0 -1
- package/build/stats-html.html +0 -2689
- package/build/stats.json +0 -805
- package/build/types/packages/query-core/src/tests/focusManager.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/hydration.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/infiniteQueryBehavior.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/infiniteQueryObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/mutationCache.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/mutationObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/mutations.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/notifyManager.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/onlineManager.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queriesObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/query.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queryCache.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queryClient.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/queryObserver.test.d.ts +0 -1
- package/build/types/packages/query-core/src/tests/utils.test.d.ts +0 -1
- package/build/types/tests/utils.d.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/query-core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.11-beta.1",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,16 +10,25 @@
|
|
|
10
10
|
"type": "github",
|
|
11
11
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
12
12
|
},
|
|
13
|
-
"module": "build/
|
|
14
|
-
"main": "build/
|
|
13
|
+
"module": "build/lib/index.mjs",
|
|
14
|
+
"main": "build/lib/index.js",
|
|
15
15
|
"browser": "build/umd/index.production.js",
|
|
16
|
-
"types": "build/
|
|
16
|
+
"types": "build/lib/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./build/lib/index.d.ts",
|
|
20
|
+
"import": "./build/lib/index.mjs",
|
|
21
|
+
"default": "./build/lib/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
17
25
|
"files": [
|
|
18
|
-
"build/*",
|
|
26
|
+
"build/lib/*",
|
|
27
|
+
"build/umd/*",
|
|
19
28
|
"src"
|
|
20
29
|
],
|
|
21
30
|
"scripts": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
31
|
+
"clean": "rm -rf ./build",
|
|
32
|
+
"test:eslint": "../../node_modules/.bin/eslint --ext .ts,.tsx ./src"
|
|
24
33
|
}
|
|
25
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -17,13 +17,13 @@ export {
|
|
|
17
17
|
parseMutationFilterArgs,
|
|
18
18
|
parseMutationArgs,
|
|
19
19
|
} from './utils'
|
|
20
|
-
export type { MutationFilters, QueryFilters } from './utils'
|
|
20
|
+
export type { MutationFilters, QueryFilters, Updater } from './utils'
|
|
21
21
|
export { isCancelledError } from './retryer'
|
|
22
22
|
export { dehydrate, hydrate } from './hydration'
|
|
23
23
|
|
|
24
24
|
// Types
|
|
25
25
|
export * from './types'
|
|
26
|
-
export type { Query } from './query'
|
|
26
|
+
export type { Query, QueryState } from './query'
|
|
27
27
|
export type { Mutation } from './mutation'
|
|
28
28
|
export type { Logger } from './logger'
|
|
29
29
|
export type {
|
package/src/mutationCache.ts
CHANGED
|
@@ -48,6 +48,12 @@ interface NotifyEventMutationObserverRemoved {
|
|
|
48
48
|
observer: MutationObserver<any, any, any>
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
interface NotifyEventMutationObserverOptionsUpdated {
|
|
52
|
+
type: 'observerOptionsUpdated'
|
|
53
|
+
mutation?: Mutation<any, any, any, any>
|
|
54
|
+
observer: MutationObserver<any, any, any, any>
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
interface NotifyEventMutationUpdated {
|
|
52
58
|
type: 'updated'
|
|
53
59
|
mutation: Mutation<any, any, any, any>
|
|
@@ -59,6 +65,7 @@ type MutationCacheNotifyEvent =
|
|
|
59
65
|
| NotifyEventMutationRemoved
|
|
60
66
|
| NotifyEventMutationObserverAdded
|
|
61
67
|
| NotifyEventMutationObserverRemoved
|
|
68
|
+
| NotifyEventMutationObserverOptionsUpdated
|
|
62
69
|
| NotifyEventMutationUpdated
|
|
63
70
|
|
|
64
71
|
type MutationCacheListener = (event: MutationCacheNotifyEvent) => void
|
package/src/mutationObserver.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
MutationObserverResult,
|
|
9
9
|
MutationObserverOptions,
|
|
10
10
|
} from './types'
|
|
11
|
+
import { shallowEqualObjects } from './utils'
|
|
11
12
|
|
|
12
13
|
// TYPES
|
|
13
14
|
|
|
@@ -63,7 +64,15 @@ export class MutationObserver<
|
|
|
63
64
|
setOptions(
|
|
64
65
|
options?: MutationObserverOptions<TData, TError, TVariables, TContext>,
|
|
65
66
|
) {
|
|
67
|
+
const prevOptions = this.options
|
|
66
68
|
this.options = this.client.defaultMutationOptions(options)
|
|
69
|
+
if (!shallowEqualObjects(prevOptions, this.options)) {
|
|
70
|
+
this.client.getMutationCache().notify({
|
|
71
|
+
type: 'observerOptionsUpdated',
|
|
72
|
+
mutation: this.currentMutation,
|
|
73
|
+
observer: this,
|
|
74
|
+
})
|
|
75
|
+
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
protected onUnsubscribe(): void {
|
package/src/queryCache.ts
CHANGED
|
@@ -55,6 +55,12 @@ interface NotifyEventQueryObserverResultsUpdated {
|
|
|
55
55
|
query: Query<any, any, any, any>
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
interface NotifyEventQueryObserverOptionsUpdated {
|
|
59
|
+
type: 'observerOptionsUpdated'
|
|
60
|
+
query: Query<any, any, any, any>
|
|
61
|
+
observer: QueryObserver<any, any, any, any, any>
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
type QueryCacheNotifyEvent =
|
|
59
65
|
| NotifyEventQueryAdded
|
|
60
66
|
| NotifyEventQueryRemoved
|
|
@@ -62,6 +68,7 @@ type QueryCacheNotifyEvent =
|
|
|
62
68
|
| NotifyEventQueryObserverAdded
|
|
63
69
|
| NotifyEventQueryObserverRemoved
|
|
64
70
|
| NotifyEventQueryObserverResultsUpdated
|
|
71
|
+
| NotifyEventQueryObserverOptionsUpdated
|
|
65
72
|
|
|
66
73
|
type QueryCacheListener = (event: QueryCacheNotifyEvent) => void
|
|
67
74
|
|
package/src/queryClient.ts
CHANGED
|
@@ -570,13 +570,11 @@ export class QueryClient {
|
|
|
570
570
|
)
|
|
571
571
|
// It is ok not having defaults, but it is error prone to have more than 1 default for a given key
|
|
572
572
|
if (matchingDefaults.length > 1) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
)
|
|
579
|
-
}
|
|
573
|
+
this.logger.error(
|
|
574
|
+
`[QueryClient] Several query defaults match with key '${JSON.stringify(
|
|
575
|
+
queryKey,
|
|
576
|
+
)}'. The first matching query defaults are used. Please check how query defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetquerydefaults.`,
|
|
577
|
+
)
|
|
580
578
|
}
|
|
581
579
|
}
|
|
582
580
|
|
|
@@ -617,13 +615,11 @@ export class QueryClient {
|
|
|
617
615
|
)
|
|
618
616
|
// It is ok not having defaults, but it is error prone to have more than 1 default for a given key
|
|
619
617
|
if (matchingDefaults.length > 1) {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
)
|
|
626
|
-
}
|
|
618
|
+
this.logger.error(
|
|
619
|
+
`[QueryClient] Several mutation defaults match with key '${JSON.stringify(
|
|
620
|
+
mutationKey,
|
|
621
|
+
)}'. The first matching mutation defaults are used. Please check how mutation defaults are registered. Order does matter here. cf. https://react-query.tanstack.com/reference/QueryClient#queryclientsetmutationdefaults.`,
|
|
622
|
+
)
|
|
627
623
|
}
|
|
628
624
|
}
|
|
629
625
|
|
package/src/queryObserver.ts
CHANGED
|
@@ -155,6 +155,14 @@ export class QueryObserver<
|
|
|
155
155
|
|
|
156
156
|
this.options = this.client.defaultQueryOptions(options)
|
|
157
157
|
|
|
158
|
+
if (!shallowEqualObjects(prevOptions, this.options)) {
|
|
159
|
+
this.client.getQueryCache().notify({
|
|
160
|
+
type: 'observerOptionsUpdated',
|
|
161
|
+
query: this.currentQuery,
|
|
162
|
+
observer: this,
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
158
166
|
if (
|
|
159
167
|
typeof this.options.enabled !== 'undefined' &&
|
|
160
168
|
typeof this.options.enabled !== 'boolean'
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
QueryClient,
|
|
14
14
|
QueryFunction,
|
|
15
15
|
QueryObserver,
|
|
16
|
+
QueryObserverOptions,
|
|
16
17
|
} from '..'
|
|
17
18
|
import { focusManager, onlineManager } from '..'
|
|
18
19
|
|
|
@@ -357,6 +358,38 @@ describe('queryClient', () => {
|
|
|
357
358
|
expect(queryCache.find(key)!.state.data).toBe(newData)
|
|
358
359
|
})
|
|
359
360
|
|
|
361
|
+
test('should apply a custom structuralSharing function when provided', () => {
|
|
362
|
+
const key = queryKey()
|
|
363
|
+
|
|
364
|
+
const queryObserverOptions = {
|
|
365
|
+
structuralSharing: (
|
|
366
|
+
prevData: { value: Date } | undefined,
|
|
367
|
+
newData: { value: Date },
|
|
368
|
+
) => {
|
|
369
|
+
if (!prevData) {
|
|
370
|
+
return newData
|
|
371
|
+
}
|
|
372
|
+
return newData.value.getTime() === prevData.value.getTime()
|
|
373
|
+
? prevData
|
|
374
|
+
: newData
|
|
375
|
+
},
|
|
376
|
+
} as QueryObserverOptions
|
|
377
|
+
|
|
378
|
+
queryClient.setDefaultOptions({ queries: queryObserverOptions })
|
|
379
|
+
|
|
380
|
+
const oldData = { value: new Date(2022, 6, 19) }
|
|
381
|
+
const newData = { value: new Date(2022, 6, 19) }
|
|
382
|
+
queryClient.setQueryData(key, oldData)
|
|
383
|
+
queryClient.setQueryData(key, newData)
|
|
384
|
+
|
|
385
|
+
expect(queryCache.find(key)!.state.data).toBe(oldData)
|
|
386
|
+
|
|
387
|
+
const distinctData = { value: new Date(2021, 11, 25) }
|
|
388
|
+
queryClient.setQueryData(key, distinctData)
|
|
389
|
+
|
|
390
|
+
expect(queryCache.find(key)!.state.data).toBe(distinctData)
|
|
391
|
+
})
|
|
392
|
+
|
|
360
393
|
test('should not set isFetching to false', async () => {
|
|
361
394
|
const key = queryKey()
|
|
362
395
|
queryClient.prefetchQuery(key, async () => {
|
|
@@ -799,4 +799,23 @@ describe('queryObserver', () => {
|
|
|
799
799
|
|
|
800
800
|
unsubscribe()
|
|
801
801
|
})
|
|
802
|
+
|
|
803
|
+
test('setOptions should notify cache listeners', async () => {
|
|
804
|
+
const key = queryKey()
|
|
805
|
+
|
|
806
|
+
const observer = new QueryObserver(queryClient, {
|
|
807
|
+
queryKey: key,
|
|
808
|
+
})
|
|
809
|
+
|
|
810
|
+
const spy = jest.fn()
|
|
811
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(spy)
|
|
812
|
+
observer.setOptions({ enabled: false })
|
|
813
|
+
|
|
814
|
+
expect(spy).toHaveBeenCalledTimes(1)
|
|
815
|
+
expect(spy).toHaveBeenCalledWith(
|
|
816
|
+
expect.objectContaining({ type: 'observerOptionsUpdated' }),
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
unsubscribe()
|
|
820
|
+
})
|
|
802
821
|
})
|
package/src/types.ts
CHANGED
|
@@ -76,9 +76,12 @@ export interface QueryOptions<
|
|
|
76
76
|
behavior?: QueryBehavior<TQueryFnData, TError, TData>
|
|
77
77
|
/**
|
|
78
78
|
* Set this to `false` to disable structural sharing between query results.
|
|
79
|
+
* Set this to a function which accepts the old and new data and returns resolved data of the same type to implement custom structural sharing logic.
|
|
79
80
|
* Defaults to `true`.
|
|
80
81
|
*/
|
|
81
|
-
structuralSharing?:
|
|
82
|
+
structuralSharing?:
|
|
83
|
+
| boolean
|
|
84
|
+
| ((oldData: TData | undefined, newData: TData) => TData)
|
|
82
85
|
/**
|
|
83
86
|
* This function can be set to automatically get the previous cursor for infinite queries.
|
|
84
87
|
* The result will also be used to determine the value of `hasPreviousPage`.
|
|
@@ -425,11 +428,14 @@ export interface QueryObserverSuccessResult<TData = unknown, TError = unknown>
|
|
|
425
428
|
status: 'success'
|
|
426
429
|
}
|
|
427
430
|
|
|
431
|
+
export type DefinedQueryObserverResult<TData = unknown, TError = unknown> =
|
|
432
|
+
| QueryObserverRefetchErrorResult<TData, TError>
|
|
433
|
+
| QueryObserverSuccessResult<TData, TError>
|
|
434
|
+
|
|
428
435
|
export type QueryObserverResult<TData = unknown, TError = unknown> =
|
|
436
|
+
| DefinedQueryObserverResult<TData, TError>
|
|
429
437
|
| QueryObserverLoadingErrorResult<TData, TError>
|
|
430
438
|
| QueryObserverLoadingResult<TData, TError>
|
|
431
|
-
| QueryObserverRefetchErrorResult<TData, TError>
|
|
432
|
-
| QueryObserverSuccessResult<TData, TError>
|
|
433
439
|
|
|
434
440
|
export interface InfiniteQueryObserverBaseResult<
|
|
435
441
|
TData = unknown,
|
|
@@ -535,18 +541,18 @@ export interface MutationOptions<
|
|
|
535
541
|
data: TData,
|
|
536
542
|
variables: TVariables,
|
|
537
543
|
context: TContext | undefined,
|
|
538
|
-
) => Promise<unknown> |
|
|
544
|
+
) => Promise<unknown> | unknown
|
|
539
545
|
onError?: (
|
|
540
546
|
error: TError,
|
|
541
547
|
variables: TVariables,
|
|
542
548
|
context: TContext | undefined,
|
|
543
|
-
) => Promise<unknown> |
|
|
549
|
+
) => Promise<unknown> | unknown
|
|
544
550
|
onSettled?: (
|
|
545
551
|
data: TData | undefined,
|
|
546
552
|
error: TError | null,
|
|
547
553
|
variables: TVariables,
|
|
548
554
|
context: TContext | undefined,
|
|
549
|
-
) => Promise<unknown> |
|
|
555
|
+
) => Promise<unknown> | unknown
|
|
550
556
|
retry?: RetryValue<TError>
|
|
551
557
|
retryDelay?: RetryDelayValue<TError>
|
|
552
558
|
networkMode?: NetworkMode
|
|
@@ -574,18 +580,18 @@ export interface MutateOptions<
|
|
|
574
580
|
data: TData,
|
|
575
581
|
variables: TVariables,
|
|
576
582
|
context: TContext,
|
|
577
|
-
) => Promise<unknown> |
|
|
583
|
+
) => Promise<unknown> | unknown
|
|
578
584
|
onError?: (
|
|
579
585
|
error: TError,
|
|
580
586
|
variables: TVariables,
|
|
581
587
|
context: TContext | undefined,
|
|
582
|
-
) => Promise<unknown> |
|
|
588
|
+
) => Promise<unknown> | unknown
|
|
583
589
|
onSettled?: (
|
|
584
590
|
data: TData | undefined,
|
|
585
591
|
error: TError | null,
|
|
586
592
|
variables: TVariables,
|
|
587
593
|
context: TContext | undefined,
|
|
588
|
-
) => Promise<unknown> |
|
|
594
|
+
) => Promise<unknown> | unknown
|
|
589
595
|
}
|
|
590
596
|
|
|
591
597
|
export type MutateFunction<
|
package/src/utils.ts
CHANGED
|
@@ -427,6 +427,8 @@ export function replaceData<
|
|
|
427
427
|
// Use prev data if an isDataEqual function is defined and returns `true`
|
|
428
428
|
if (options.isDataEqual?.(prevData, data)) {
|
|
429
429
|
return prevData as TData
|
|
430
|
+
} else if (typeof options.structuralSharing === 'function') {
|
|
431
|
+
return options.structuralSharing(prevData, data)
|
|
430
432
|
} else if (options.structuralSharing !== false) {
|
|
431
433
|
// Structurally share data between prev and new data if needed
|
|
432
434
|
return replaceEqualDeep(prevData, data)
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* query-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var subscribable = require('./subscribable.js');
|
|
16
|
-
var utils = require('./utils.js');
|
|
17
|
-
|
|
18
|
-
class FocusManager extends subscribable.Subscribable {
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
|
|
22
|
-
this.setup = onFocus => {
|
|
23
|
-
// addEventListener does not exist in React Native, but window does
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
25
|
-
if (!utils.isServer && window.addEventListener) {
|
|
26
|
-
const listener = () => onFocus(); // Listen to visibillitychange and focus
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
window.addEventListener('visibilitychange', listener, false);
|
|
30
|
-
window.addEventListener('focus', listener, false);
|
|
31
|
-
return () => {
|
|
32
|
-
// Be sure to unsubscribe if a new handler is set
|
|
33
|
-
window.removeEventListener('visibilitychange', listener);
|
|
34
|
-
window.removeEventListener('focus', listener);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onSubscribe() {
|
|
41
|
-
if (!this.cleanup) {
|
|
42
|
-
this.setEventListener(this.setup);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
onUnsubscribe() {
|
|
47
|
-
if (!this.hasListeners()) {
|
|
48
|
-
var _this$cleanup;
|
|
49
|
-
|
|
50
|
-
(_this$cleanup = this.cleanup) == null ? void 0 : _this$cleanup.call(this);
|
|
51
|
-
this.cleanup = undefined;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
setEventListener(setup) {
|
|
56
|
-
var _this$cleanup2;
|
|
57
|
-
|
|
58
|
-
this.setup = setup;
|
|
59
|
-
(_this$cleanup2 = this.cleanup) == null ? void 0 : _this$cleanup2.call(this);
|
|
60
|
-
this.cleanup = setup(focused => {
|
|
61
|
-
if (typeof focused === 'boolean') {
|
|
62
|
-
this.setFocused(focused);
|
|
63
|
-
} else {
|
|
64
|
-
this.onFocus();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
setFocused(focused) {
|
|
70
|
-
this.focused = focused;
|
|
71
|
-
|
|
72
|
-
if (focused) {
|
|
73
|
-
this.onFocus();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
onFocus() {
|
|
78
|
-
this.listeners.forEach(listener => {
|
|
79
|
-
listener();
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
isFocused() {
|
|
84
|
-
if (typeof this.focused === 'boolean') {
|
|
85
|
-
return this.focused;
|
|
86
|
-
} // document global can be unavailable in react native
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (typeof document === 'undefined') {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return [undefined, 'visible', 'prerender'].includes(document.visibilityState);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
const focusManager = new FocusManager();
|
|
98
|
-
|
|
99
|
-
exports.FocusManager = FocusManager;
|
|
100
|
-
exports.focusManager = focusManager;
|
|
101
|
-
//# sourceMappingURL=focusManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"focusManager.js","sources":["../../src/focusManager.ts"],"sourcesContent":["import { Subscribable } from './subscribable'\nimport { isServer } from './utils'\n\ntype SetupFn = (\n setFocused: (focused?: boolean) => void,\n) => (() => void) | undefined\n\nexport class FocusManager extends Subscribable {\n private focused?: boolean\n private cleanup?: () => void\n\n private setup: SetupFn\n\n constructor() {\n super()\n this.setup = (onFocus) => {\n // addEventListener does not exist in React Native, but window does\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus()\n // Listen to visibillitychange and focus\n window.addEventListener('visibilitychange', listener, false)\n window.addEventListener('focus', listener, false)\n\n return () => {\n // Be sure to unsubscribe if a new handler is set\n window.removeEventListener('visibilitychange', listener)\n window.removeEventListener('focus', listener)\n }\n }\n }\n }\n\n protected onSubscribe(): void {\n if (!this.cleanup) {\n this.setEventListener(this.setup)\n }\n }\n\n protected onUnsubscribe() {\n if (!this.hasListeners()) {\n this.cleanup?.()\n this.cleanup = undefined\n }\n }\n\n setEventListener(setup: SetupFn): void {\n this.setup = setup\n this.cleanup?.()\n this.cleanup = setup((focused) => {\n if (typeof focused === 'boolean') {\n this.setFocused(focused)\n } else {\n this.onFocus()\n }\n })\n }\n\n setFocused(focused?: boolean): void {\n this.focused = focused\n\n if (focused) {\n this.onFocus()\n }\n }\n\n onFocus(): void {\n this.listeners.forEach((listener) => {\n listener()\n })\n }\n\n isFocused(): boolean {\n if (typeof this.focused === 'boolean') {\n return this.focused\n }\n\n // document global can be unavailable in react native\n if (typeof document === 'undefined') {\n return true\n }\n\n return [undefined, 'visible', 'prerender'].includes(\n document.visibilityState,\n )\n }\n}\n\nexport const focusManager = new FocusManager()\n"],"names":["FocusManager","Subscribable","constructor","setup","onFocus","isServer","window","addEventListener","listener","removeEventListener","onSubscribe","cleanup","setEventListener","onUnsubscribe","hasListeners","undefined","focused","setFocused","listeners","forEach","isFocused","document","includes","visibilityState","focusManager"],"mappings":";;;;;;;;;;;;;;;;;AAOO,MAAMA,YAAN,SAA2BC,yBAA3B,CAAwC;AAM7CC,EAAAA,WAAW,GAAG;AACZ,IAAA,KAAA,EAAA,CAAA;;IACA,IAAKC,CAAAA,KAAL,GAAcC,OAAD,IAAa;AACxB;AACA;AACA,MAAA,IAAI,CAACC,c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,IAAA,CAAKA,OAAL,GAAeR,KAAK,CAAEa,OAAD,IAAa;AAChC,MAAA,IAAI,OAAOA,OAAP,KAAmB,SAAvB,EAAkC;QAChC,IAAKC,CAAAA,UAAL,CAAgBD,OAAhB,CAAA,CAAA;AACD,OAFD,MAEO;AACL,QAAA,IAAA,CAAKZ,OAAL,EAAA,CAAA;AACD,OAAA;AACF,KANmB,CAApB,CAAA;AAOD,GAAA;;EAEDa,UAAU,CAACD,OAAD,EAA0B;IAClC,IAAKA,CAAAA,OAAL,GAAeA,OAAf,CAAA;;AAEA,IAAA,IAAIA,OAAJ,EAAa;AACX,MAAA,IAAA,CAAKZ,OAAL,EAAA,CAAA;AACD,KAAA;AACF,GAAA;;AAEDA,EAAAA,OAAO,GAAS;AACd,IAAA,IAAA,CAAKc,SAAL,CAAeC,OAAf,CAAwBX,QAAD,IAAc;MACnCA,QAAQ,EAAA,CAAA;KADV,CAAA,CAAA;AAGD,GAAA;;AAEDY,EAAAA,SAAS,GAAY;AACnB,IAAA,IAAI,OAAO,IAAA,CAAKJ,OAAZ,KAAwB,SAA5B,EAAuC;AACrC,MAAA,OAAO,KAAKA,OAAZ,CAAA;AACD,KAHkB;;;AAMnB,IAAA,IAAI,OAAOK,QAAP,KAAoB,WAAxB,EAAqC;AACnC,MAAA,OAAO,IAAP,CAAA;AACD,KAAA;;AAED,IAAA,OAAO,CAACN,SAAD,EAAY,SAAZ,EAAuB,WAAvB,CAAoCO,CAAAA,QAApC,CACLD,QAAQ,CAACE,eADJ,CAAP,CAAA;AAGD,GAAA;;AA9E4C,CAAA;AAiFlCC,MAAAA,YAAY,GAAG,IAAIxB,YAAJ;;;;;"}
|
package/build/cjs/hydration.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* query-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
// TYPES
|
|
16
|
-
// FUNCTIONS
|
|
17
|
-
function dehydrateMutation(mutation) {
|
|
18
|
-
return {
|
|
19
|
-
mutationKey: mutation.options.mutationKey,
|
|
20
|
-
state: mutation.state
|
|
21
|
-
};
|
|
22
|
-
} // Most config is not dehydrated but instead meant to configure again when
|
|
23
|
-
// consuming the de/rehydrated data, typically with useQuery on the client.
|
|
24
|
-
// Sometimes it might make sense to prefetch data on the server and include
|
|
25
|
-
// in the html-payload, but not consume it on the initial render.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function dehydrateQuery(query) {
|
|
29
|
-
return {
|
|
30
|
-
state: query.state,
|
|
31
|
-
queryKey: query.queryKey,
|
|
32
|
-
queryHash: query.queryHash
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function defaultShouldDehydrateMutation(mutation) {
|
|
37
|
-
return mutation.state.isPaused;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function defaultShouldDehydrateQuery(query) {
|
|
41
|
-
return query.state.status === 'success';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function dehydrate(client, options = {}) {
|
|
45
|
-
const mutations = [];
|
|
46
|
-
const queries = [];
|
|
47
|
-
|
|
48
|
-
if (options.dehydrateMutations !== false) {
|
|
49
|
-
const shouldDehydrateMutation = options.shouldDehydrateMutation || defaultShouldDehydrateMutation;
|
|
50
|
-
client.getMutationCache().getAll().forEach(mutation => {
|
|
51
|
-
if (shouldDehydrateMutation(mutation)) {
|
|
52
|
-
mutations.push(dehydrateMutation(mutation));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (options.dehydrateQueries !== false) {
|
|
58
|
-
const shouldDehydrateQuery = options.shouldDehydrateQuery || defaultShouldDehydrateQuery;
|
|
59
|
-
client.getQueryCache().getAll().forEach(query => {
|
|
60
|
-
if (shouldDehydrateQuery(query)) {
|
|
61
|
-
queries.push(dehydrateQuery(query));
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
mutations,
|
|
68
|
-
queries
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function hydrate(client, dehydratedState, options) {
|
|
72
|
-
if (typeof dehydratedState !== 'object' || dehydratedState === null) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const mutationCache = client.getMutationCache();
|
|
77
|
-
const queryCache = client.getQueryCache(); // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
78
|
-
|
|
79
|
-
const mutations = dehydratedState.mutations || []; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
80
|
-
|
|
81
|
-
const queries = dehydratedState.queries || [];
|
|
82
|
-
mutations.forEach(dehydratedMutation => {
|
|
83
|
-
var _options$defaultOptio;
|
|
84
|
-
|
|
85
|
-
mutationCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio = options.defaultOptions) == null ? void 0 : _options$defaultOptio.mutations),
|
|
86
|
-
mutationKey: dehydratedMutation.mutationKey
|
|
87
|
-
}, dehydratedMutation.state);
|
|
88
|
-
});
|
|
89
|
-
queries.forEach(dehydratedQuery => {
|
|
90
|
-
var _options$defaultOptio2;
|
|
91
|
-
|
|
92
|
-
const query = queryCache.get(dehydratedQuery.queryHash); // Do not hydrate if an existing query exists with newer data
|
|
93
|
-
|
|
94
|
-
if (query) {
|
|
95
|
-
if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {
|
|
96
|
-
query.setState(dehydratedQuery.state);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return;
|
|
100
|
-
} // Restore query
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
queryCache.build(client, { ...(options == null ? void 0 : (_options$defaultOptio2 = options.defaultOptions) == null ? void 0 : _options$defaultOptio2.queries),
|
|
104
|
-
queryKey: dehydratedQuery.queryKey,
|
|
105
|
-
queryHash: dehydratedQuery.queryHash
|
|
106
|
-
}, dehydratedQuery.state);
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
exports.dehydrate = dehydrate;
|
|
111
|
-
exports.hydrate = hydrate;
|
|
112
|
-
//# sourceMappingURL=hydration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hydration.js","sources":["../../src/hydration.ts"],"sourcesContent":["import type { QueryClient } from './queryClient'\nimport type { Query, QueryState } from './query'\nimport type {\n MutationKey,\n MutationOptions,\n QueryKey,\n QueryOptions,\n} from './types'\nimport type { Mutation, MutationState } from './mutation'\n\n// TYPES\n\nexport interface DehydrateOptions {\n dehydrateMutations?: boolean\n dehydrateQueries?: boolean\n shouldDehydrateMutation?: ShouldDehydrateMutationFunction\n shouldDehydrateQuery?: ShouldDehydrateQueryFunction\n}\n\nexport interface HydrateOptions {\n defaultOptions?: {\n queries?: QueryOptions\n mutations?: MutationOptions\n }\n}\n\ninterface DehydratedMutation {\n mutationKey?: MutationKey\n state: MutationState\n}\n\ninterface DehydratedQuery {\n queryHash: string\n queryKey: QueryKey\n state: QueryState\n}\n\nexport interface DehydratedState {\n mutations: DehydratedMutation[]\n queries: DehydratedQuery[]\n}\n\nexport type ShouldDehydrateQueryFunction = (query: Query) => boolean\n\nexport type ShouldDehydrateMutationFunction = (mutation: Mutation) => boolean\n\n// FUNCTIONS\n\nfunction dehydrateMutation(mutation: Mutation): DehydratedMutation {\n return {\n mutationKey: mutation.options.mutationKey,\n state: mutation.state,\n }\n}\n\n// Most config is not dehydrated but instead meant to configure again when\n// consuming the de/rehydrated data, typically with useQuery on the client.\n// Sometimes it might make sense to prefetch data on the server and include\n// in the html-payload, but not consume it on the initial render.\nfunction dehydrateQuery(query: Query): DehydratedQuery {\n return {\n state: query.state,\n queryKey: query.queryKey,\n queryHash: query.queryHash,\n }\n}\n\nfunction defaultShouldDehydrateMutation(mutation: Mutation) {\n return mutation.state.isPaused\n}\n\nfunction defaultShouldDehydrateQuery(query: Query) {\n return query.state.status === 'success'\n}\n\nexport function dehydrate(\n client: QueryClient,\n options: DehydrateOptions = {},\n): DehydratedState {\n const mutations: DehydratedMutation[] = []\n const queries: DehydratedQuery[] = []\n\n if (options.dehydrateMutations !== false) {\n const shouldDehydrateMutation =\n options.shouldDehydrateMutation || defaultShouldDehydrateMutation\n\n client\n .getMutationCache()\n .getAll()\n .forEach((mutation) => {\n if (shouldDehydrateMutation(mutation)) {\n mutations.push(dehydrateMutation(mutation))\n }\n })\n }\n\n if (options.dehydrateQueries !== false) {\n const shouldDehydrateQuery =\n options.shouldDehydrateQuery || defaultShouldDehydrateQuery\n\n client\n .getQueryCache()\n .getAll()\n .forEach((query) => {\n if (shouldDehydrateQuery(query)) {\n queries.push(dehydrateQuery(query))\n }\n })\n }\n\n return { mutations, queries }\n}\n\nexport function hydrate(\n client: QueryClient,\n dehydratedState: unknown,\n options?: HydrateOptions,\n): void {\n if (typeof dehydratedState !== 'object' || dehydratedState === null) {\n return\n }\n\n const mutationCache = client.getMutationCache()\n const queryCache = client.getQueryCache()\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const mutations = (dehydratedState as DehydratedState).mutations || []\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = (dehydratedState as DehydratedState).queries || []\n\n mutations.forEach((dehydratedMutation) => {\n mutationCache.build(\n client,\n {\n ...options?.defaultOptions?.mutations,\n mutationKey: dehydratedMutation.mutationKey,\n },\n dehydratedMutation.state,\n )\n })\n\n queries.forEach((dehydratedQuery) => {\n const query = queryCache.get(dehydratedQuery.queryHash)\n\n // Do not hydrate if an existing query exists with newer data\n if (query) {\n if (query.state.dataUpdatedAt < dehydratedQuery.state.dataUpdatedAt) {\n query.setState(dehydratedQuery.state)\n }\n return\n }\n\n // Restore query\n queryCache.build(\n client,\n {\n ...options?.defaultOptions?.queries,\n queryKey: dehydratedQuery.queryKey,\n queryHash: dehydratedQuery.queryHash,\n },\n dehydratedQuery.state,\n )\n })\n}\n"],"names":["dehydrateMutation","mutation","mutationKey","options","state","dehydrateQuery","query","queryKey","queryHash","defaultShouldDehydrateMutation","isPaused","defaultShouldDehydrateQuery","status","dehydrate","client","mutations","queries","dehydrateMutations","shouldDehydrateMutation","getMutationCache","getAll","forEach","push","dehydrateQueries","shouldDehydrateQuery","getQueryCache","hydrate","dehydratedState","mutationCache","queryCache","dehydratedMutation","build","defaultOptions","dehydratedQuery","get","dataUpdatedAt","setState"],"mappings":";;;;;;;;;;;;;;AAUA;AAoCA;AAEA,SAASA,iBAAT,CAA2BC,QAA3B,EAAmE;EACjE,OAAO;AACLC,IAAAA,WAAW,EAAED,QAAQ,CAACE,OAAT,CAAiBD,WADzB;IAELE,KAAK,EAAEH,QAAQ,CAACG,KAAAA;GAFlB,CAAA;AAID;AAGD;AACA;AACA;;;AACA,SAASC,cAAT,CAAwBC,KAAxB,EAAuD;EACrD,OAAO;IACLF,KAAK,EAAEE,KAAK,CAACF,KADR;IAELG,QAAQ,EAAED,KAAK,CAACC,QAFX;IAGLC,SAAS,EAAEF,KAAK,CAACE,SAAAA;GAHnB,CAAA;AAKD,CAAA;;AAED,SAASC,8BAAT,CAAwCR,QAAxC,EAA4D;AAC1D,EAAA,OAAOA,QAAQ,CAACG,KAAT,CAAeM,QAAtB,CAAA;AACD,CAAA;;AAED,SAASC,2BAAT,CAAqCL,KAArC,EAAmD;AACjD,EAAA,OAAOA,KAAK,CAACF,KAAN,CAAYQ,MAAZ,KAAuB,SAA9B,CAAA;AACD,CAAA;;AAEM,SAASC,SAAT,CACLC,MADK,EAELX,OAAyB,GAAG,EAFvB,EAGY;EACjB,MAAMY,SAA+B,GAAG,EAAxC,CAAA;EACA,MAAMC,OAA0B,GAAG,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7B,KAPlB,CAAA,CAAA;GAZF,CAAA,CAAA;AAsBD;;;;;"}
|
package/build/cjs/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* query-core
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) TanStack
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14
|
-
|
|
15
|
-
var retryer = require('./retryer.js');
|
|
16
|
-
var queryCache = require('./queryCache.js');
|
|
17
|
-
var queryClient = require('./queryClient.js');
|
|
18
|
-
var queryObserver = require('./queryObserver.js');
|
|
19
|
-
var queriesObserver = require('./queriesObserver.js');
|
|
20
|
-
var infiniteQueryObserver = require('./infiniteQueryObserver.js');
|
|
21
|
-
var mutationCache = require('./mutationCache.js');
|
|
22
|
-
var mutationObserver = require('./mutationObserver.js');
|
|
23
|
-
var notifyManager = require('./notifyManager.js');
|
|
24
|
-
var focusManager = require('./focusManager.js');
|
|
25
|
-
var onlineManager = require('./onlineManager.js');
|
|
26
|
-
var utils = require('./utils.js');
|
|
27
|
-
var hydration = require('./hydration.js');
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
exports.CancelledError = retryer.CancelledError;
|
|
32
|
-
exports.isCancelledError = retryer.isCancelledError;
|
|
33
|
-
exports.QueryCache = queryCache.QueryCache;
|
|
34
|
-
exports.QueryClient = queryClient.QueryClient;
|
|
35
|
-
exports.QueryObserver = queryObserver.QueryObserver;
|
|
36
|
-
exports.QueriesObserver = queriesObserver.QueriesObserver;
|
|
37
|
-
exports.InfiniteQueryObserver = infiniteQueryObserver.InfiniteQueryObserver;
|
|
38
|
-
exports.MutationCache = mutationCache.MutationCache;
|
|
39
|
-
exports.MutationObserver = mutationObserver.MutationObserver;
|
|
40
|
-
exports.notifyManager = notifyManager.notifyManager;
|
|
41
|
-
exports.focusManager = focusManager.focusManager;
|
|
42
|
-
exports.onlineManager = onlineManager.onlineManager;
|
|
43
|
-
exports.hashQueryKey = utils.hashQueryKey;
|
|
44
|
-
exports.isError = utils.isError;
|
|
45
|
-
exports.parseFilterArgs = utils.parseFilterArgs;
|
|
46
|
-
exports.parseMutationArgs = utils.parseMutationArgs;
|
|
47
|
-
exports.parseMutationFilterArgs = utils.parseMutationFilterArgs;
|
|
48
|
-
exports.parseQueryArgs = utils.parseQueryArgs;
|
|
49
|
-
exports.dehydrate = hydration.dehydrate;
|
|
50
|
-
exports.hydrate = hydration.hydrate;
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|