react-redux-cache 0.22.1 → 0.22.2
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/README.md +2 -2
- package/dist/cjs/createActions.js +63 -63
- package/dist/cjs/createCache.js +216 -131
- package/dist/cjs/createReducer.js +355 -290
- package/dist/cjs/createSelectors.js +66 -58
- package/dist/cjs/index.js +87 -26
- package/dist/cjs/mutate.js +153 -70
- package/dist/cjs/query.js +161 -70
- package/dist/cjs/types.js +2 -2
- package/dist/cjs/useMutation.js +81 -42
- package/dist/cjs/useQuery.js +127 -56
- package/dist/cjs/utilsAndConstants.js +204 -151
- package/dist/esm/createActions.js +60 -59
- package/dist/esm/createCache.js +218 -127
- package/dist/esm/createReducer.js +349 -286
- package/dist/esm/createSelectors.js +63 -54
- package/dist/esm/index.js +3 -3
- package/dist/esm/mutate.js +143 -66
- package/dist/esm/query.js +149 -66
- package/dist/esm/types.js +1 -1
- package/dist/esm/useMutation.js +77 -38
- package/dist/esm/useQuery.js +119 -52
- package/dist/esm/utilsAndConstants.js +190 -140
- package/dist/types/createActions.d.ts +109 -83
- package/dist/types/createCache.d.ts +734 -409
- package/dist/types/createReducer.d.ts +11 -3
- package/dist/types/createSelectors.d.ts +80 -18
- package/dist/types/index.d.ts +3 -3
- package/dist/types/mutate.d.ts +94 -4
- package/dist/types/query.d.ts +123 -4
- package/dist/types/types.d.ts +360 -184
- package/dist/types/useMutation.d.ts +39 -4
- package/dist/types/useQuery.d.ts +40 -4
- package/dist/types/utilsAndConstants.d.ts +56 -23
- package/package.json +4 -5
|
@@ -1,83 +1,109 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
1
|
+
import type {EntityChanges, Key, MutationState, QueryState, Typenames} from './types'
|
|
2
|
+
import {CacheState} from './types'
|
|
3
|
+
|
|
4
|
+
export type Actions<
|
|
5
|
+
N extends string = string,
|
|
6
|
+
T extends Typenames = Typenames,
|
|
7
|
+
QP = unknown,
|
|
8
|
+
QR = unknown,
|
|
9
|
+
MP = unknown,
|
|
10
|
+
MR = unknown,
|
|
11
|
+
> = ReturnType<typeof createActions<N, T, QP, QR, MP, MR>>
|
|
12
|
+
|
|
13
|
+
export declare const createActions: <N extends string, T extends Typenames, QP, QR, MP, MR>(
|
|
14
|
+
name: N,
|
|
15
|
+
) => {
|
|
16
|
+
updateQueryStateAndEntities: {
|
|
17
|
+
<K extends keyof (QP | QR)>(
|
|
18
|
+
queryKey: K,
|
|
19
|
+
queryCacheKey: Key,
|
|
20
|
+
state?: Partial<QueryState<T, QP[K], QR[K]>>,
|
|
21
|
+
entityChanges?: EntityChanges<T>,
|
|
22
|
+
): {
|
|
23
|
+
type: `@rrc/${N}/updateQueryStateAndEntities`
|
|
24
|
+
queryKey: K
|
|
25
|
+
queryCacheKey: Key
|
|
26
|
+
state: Partial<QueryState<T, QP[K], QR[K]>> | undefined
|
|
27
|
+
entityChanges: EntityChanges<T> | undefined
|
|
28
|
+
}
|
|
29
|
+
type: `@rrc/${N}/updateQueryStateAndEntities`
|
|
30
|
+
}
|
|
31
|
+
updateMutationStateAndEntities: {
|
|
32
|
+
<K extends keyof (MP | MR)>(
|
|
33
|
+
mutationKey: K,
|
|
34
|
+
state?: Partial<MutationState<T, MP[K], MR[K]>>,
|
|
35
|
+
entityChanges?: EntityChanges<T>,
|
|
36
|
+
): {
|
|
37
|
+
type: `@rrc/${N}/updateMutationStateAndEntities`
|
|
38
|
+
mutationKey: K
|
|
39
|
+
state: Partial<MutationState<T, MP[K], MR[K]>> | undefined
|
|
40
|
+
entityChanges: EntityChanges<T> | undefined
|
|
41
|
+
}
|
|
42
|
+
type: `@rrc/${N}/updateMutationStateAndEntities`
|
|
43
|
+
}
|
|
44
|
+
mergeEntityChanges: {
|
|
45
|
+
(changes: EntityChanges<T>): {
|
|
46
|
+
type: `@rrc/${N}/mergeEntityChanges`
|
|
47
|
+
changes: EntityChanges<T>
|
|
48
|
+
}
|
|
49
|
+
type: `@rrc/${N}/mergeEntityChanges`
|
|
50
|
+
}
|
|
51
|
+
invalidateQuery: {
|
|
52
|
+
<K extends keyof (QP | QR)>(
|
|
53
|
+
queries: {
|
|
54
|
+
/** Query key */
|
|
55
|
+
query: K
|
|
56
|
+
/** Query cache key */
|
|
57
|
+
cacheKey?: Key
|
|
58
|
+
/** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
|
|
59
|
+
expiresAt?: number
|
|
60
|
+
}[],
|
|
61
|
+
): {
|
|
62
|
+
type: `@rrc/${N}/invalidateQuery`
|
|
63
|
+
queries: {
|
|
64
|
+
/** Query key */
|
|
65
|
+
query: K
|
|
66
|
+
/** Query cache key */
|
|
67
|
+
cacheKey?: Key
|
|
68
|
+
/** Unix timestamp at which query expires. Is set to the query state. @Default Date.now() */
|
|
69
|
+
expiresAt?: number
|
|
70
|
+
}[]
|
|
71
|
+
}
|
|
72
|
+
type: `@rrc/${N}/invalidateQuery`
|
|
73
|
+
}
|
|
74
|
+
clearQueryState: {
|
|
75
|
+
<K extends keyof (QP | QR)>(
|
|
76
|
+
queries: {
|
|
77
|
+
/** Query key */
|
|
78
|
+
query: K
|
|
79
|
+
/** Query cache key */
|
|
80
|
+
cacheKey?: Key
|
|
81
|
+
}[],
|
|
82
|
+
): {
|
|
83
|
+
type: `@rrc/${N}/clearQueryState`
|
|
84
|
+
queries: {
|
|
85
|
+
/** Query key */
|
|
86
|
+
query: K
|
|
87
|
+
/** Query cache key */
|
|
88
|
+
cacheKey?: Key
|
|
89
|
+
}[]
|
|
90
|
+
}
|
|
91
|
+
type: `@rrc/${N}/clearQueryState`
|
|
92
|
+
}
|
|
93
|
+
clearMutationState: {
|
|
94
|
+
<K extends keyof (MP | MR)>(
|
|
95
|
+
mutationKeys: K[],
|
|
96
|
+
): {
|
|
97
|
+
type: `@rrc/${N}/clearMutationState`
|
|
98
|
+
mutationKeys: K[]
|
|
99
|
+
}
|
|
100
|
+
type: `@rrc/${N}/clearMutationState`
|
|
101
|
+
}
|
|
102
|
+
clearCache: {
|
|
103
|
+
(stateToKeep?: Partial<CacheState<T, QP, QR, MP, MR>>): {
|
|
104
|
+
type: `@rrc/${N}/clearCache`
|
|
105
|
+
stateToKeep: Partial<CacheState<T, QP, QR, MP, MR>> | undefined
|
|
106
|
+
}
|
|
107
|
+
type: `@rrc/${N}/clearCache`
|
|
108
|
+
}
|
|
109
|
+
}
|