@tanstack/query-core 4.24.6 → 4.24.9
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/lib/mutationCache.d.ts +7 -7
- package/build/lib/mutationCache.esm.js.map +1 -1
- package/build/lib/mutationCache.js.map +1 -1
- package/build/lib/mutationCache.mjs.map +1 -1
- package/build/lib/queryCache.d.ts +8 -8
- package/build/lib/queryCache.esm.js.map +1 -1
- package/build/lib/queryCache.js.map +1 -1
- package/build/lib/queryCache.mjs.map +1 -1
- package/build/lib/types.d.ts +4 -0
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/mutationCache.ts +7 -7
- package/src/queryCache.ts +8 -8
- package/src/types.ts +13 -0
package/package.json
CHANGED
package/src/mutationCache.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MutationObserver } from './mutationObserver'
|
|
2
|
-
import type { MutationOptions } from './types'
|
|
2
|
+
import type { MutationOptions, NotifyEvent } from './types'
|
|
3
3
|
import type { QueryClient } from './queryClient'
|
|
4
4
|
import { notifyManager } from './notifyManager'
|
|
5
5
|
import type { Action, MutationState } from './mutation'
|
|
@@ -29,34 +29,34 @@ interface MutationCacheConfig {
|
|
|
29
29
|
) => Promise<unknown> | unknown
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
interface NotifyEventMutationAdded {
|
|
32
|
+
interface NotifyEventMutationAdded extends NotifyEvent {
|
|
33
33
|
type: 'added'
|
|
34
34
|
mutation: Mutation<any, any, any, any>
|
|
35
35
|
}
|
|
36
|
-
interface NotifyEventMutationRemoved {
|
|
36
|
+
interface NotifyEventMutationRemoved extends NotifyEvent {
|
|
37
37
|
type: 'removed'
|
|
38
38
|
mutation: Mutation<any, any, any, any>
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
interface NotifyEventMutationObserverAdded {
|
|
41
|
+
interface NotifyEventMutationObserverAdded extends NotifyEvent {
|
|
42
42
|
type: 'observerAdded'
|
|
43
43
|
mutation: Mutation<any, any, any, any>
|
|
44
44
|
observer: MutationObserver<any, any, any>
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
interface NotifyEventMutationObserverRemoved {
|
|
47
|
+
interface NotifyEventMutationObserverRemoved extends NotifyEvent {
|
|
48
48
|
type: 'observerRemoved'
|
|
49
49
|
mutation: Mutation<any, any, any, any>
|
|
50
50
|
observer: MutationObserver<any, any, any>
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
interface NotifyEventMutationObserverOptionsUpdated {
|
|
53
|
+
interface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent {
|
|
54
54
|
type: 'observerOptionsUpdated'
|
|
55
55
|
mutation?: Mutation<any, any, any, any>
|
|
56
56
|
observer: MutationObserver<any, any, any, any>
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
interface NotifyEventMutationUpdated {
|
|
59
|
+
interface NotifyEventMutationUpdated extends NotifyEvent {
|
|
60
60
|
type: 'updated'
|
|
61
61
|
mutation: Mutation<any, any, any, any>
|
|
62
62
|
action: Action<any, any, any, any>
|
package/src/queryCache.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { QueryFilters } from './utils'
|
|
|
2
2
|
import { hashQueryKeyByOptions, matchQuery, parseFilterArgs } from './utils'
|
|
3
3
|
import type { Action, QueryState } from './query'
|
|
4
4
|
import { Query } from './query'
|
|
5
|
-
import type { QueryKey, QueryOptions } from './types'
|
|
5
|
+
import type { NotifyEvent, QueryKey, QueryOptions } from './types'
|
|
6
6
|
import { notifyManager } from './notifyManager'
|
|
7
7
|
import type { QueryClient } from './queryClient'
|
|
8
8
|
import { Subscribable } from './subscribable'
|
|
@@ -19,40 +19,40 @@ interface QueryHashMap {
|
|
|
19
19
|
[hash: string]: Query<any, any, any, any>
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
interface NotifyEventQueryAdded {
|
|
22
|
+
interface NotifyEventQueryAdded extends NotifyEvent {
|
|
23
23
|
type: 'added'
|
|
24
24
|
query: Query<any, any, any, any>
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
interface NotifyEventQueryRemoved {
|
|
27
|
+
interface NotifyEventQueryRemoved extends NotifyEvent {
|
|
28
28
|
type: 'removed'
|
|
29
29
|
query: Query<any, any, any, any>
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
interface NotifyEventQueryUpdated {
|
|
32
|
+
interface NotifyEventQueryUpdated extends NotifyEvent {
|
|
33
33
|
type: 'updated'
|
|
34
34
|
query: Query<any, any, any, any>
|
|
35
35
|
action: Action<any, any>
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
interface NotifyEventQueryObserverAdded {
|
|
38
|
+
interface NotifyEventQueryObserverAdded extends NotifyEvent {
|
|
39
39
|
type: 'observerAdded'
|
|
40
40
|
query: Query<any, any, any, any>
|
|
41
41
|
observer: QueryObserver<any, any, any, any, any>
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
interface NotifyEventQueryObserverRemoved {
|
|
44
|
+
interface NotifyEventQueryObserverRemoved extends NotifyEvent {
|
|
45
45
|
type: 'observerRemoved'
|
|
46
46
|
query: Query<any, any, any, any>
|
|
47
47
|
observer: QueryObserver<any, any, any, any, any>
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
interface NotifyEventQueryObserverResultsUpdated {
|
|
50
|
+
interface NotifyEventQueryObserverResultsUpdated extends NotifyEvent {
|
|
51
51
|
type: 'observerResultsUpdated'
|
|
52
52
|
query: Query<any, any, any, any>
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
interface NotifyEventQueryObserverOptionsUpdated {
|
|
55
|
+
interface NotifyEventQueryObserverOptionsUpdated extends NotifyEvent {
|
|
56
56
|
type: 'observerOptionsUpdated'
|
|
57
57
|
query: Query<any, any, any, any>
|
|
58
58
|
observer: QueryObserver<any, any, any, any, any>
|
package/src/types.ts
CHANGED
|
@@ -726,3 +726,16 @@ export interface CancelOptions {
|
|
|
726
726
|
export interface SetDataOptions {
|
|
727
727
|
updatedAt?: number
|
|
728
728
|
}
|
|
729
|
+
|
|
730
|
+
export type NotifyEventType =
|
|
731
|
+
| 'added'
|
|
732
|
+
| 'removed'
|
|
733
|
+
| 'updated'
|
|
734
|
+
| 'observerAdded'
|
|
735
|
+
| 'observerRemoved'
|
|
736
|
+
| 'observerResultsUpdated'
|
|
737
|
+
| 'observerOptionsUpdated'
|
|
738
|
+
|
|
739
|
+
export interface NotifyEvent {
|
|
740
|
+
type: NotifyEventType
|
|
741
|
+
}
|