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,168 +1,221 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.incrementChangeKey =
|
|
4
|
-
exports.
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {value: true})
|
|
3
|
+
exports.incrementChangeKey =
|
|
4
|
+
exports.FetchPolicy =
|
|
5
|
+
exports.createStateComparer =
|
|
6
|
+
exports.isEmptyObject =
|
|
7
|
+
exports.applyEntityChanges =
|
|
8
|
+
exports.defaultGetCacheKey =
|
|
9
|
+
exports.noop =
|
|
10
|
+
exports.EMPTY_ARRAY =
|
|
11
|
+
exports.EMPTY_OBJECT =
|
|
12
|
+
exports.IS_DEV =
|
|
13
|
+
exports.logWarn =
|
|
14
|
+
exports.logDebug =
|
|
15
|
+
exports.optionalUtils =
|
|
16
|
+
exports.PACKAGE_SHORT_NAME =
|
|
17
|
+
void 0
|
|
18
|
+
exports.PACKAGE_SHORT_NAME = 'rrc'
|
|
5
19
|
exports.optionalUtils = {
|
|
6
|
-
|
|
7
|
-
}
|
|
20
|
+
deepEqual: undefined,
|
|
21
|
+
}
|
|
8
22
|
const logDebug = (tag, data) => {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
exports.logDebug = logDebug
|
|
23
|
+
console.debug(`@${exports.PACKAGE_SHORT_NAME} [${tag}]`, data)
|
|
24
|
+
}
|
|
25
|
+
exports.logDebug = logDebug
|
|
12
26
|
const logWarn = (tag, data) => {
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
exports.logWarn = logWarn;
|
|
16
|
-
try {
|
|
17
|
-
exports.optionalUtils.deepEqual = require('fast-deep-equal/es6');
|
|
27
|
+
console.warn(`@${exports.PACKAGE_SHORT_NAME} [${tag}]`, data)
|
|
18
28
|
}
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
exports.logWarn = logWarn
|
|
30
|
+
try {
|
|
31
|
+
exports.optionalUtils.deepEqual = require('fast-deep-equal/es6')
|
|
32
|
+
} catch (_a) {
|
|
33
|
+
;(0, exports.logDebug)('deepEqual', 'fast-deep-equal optional dependency was not installed')
|
|
21
34
|
}
|
|
22
35
|
exports.IS_DEV = (() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
30
|
-
exports.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
exports.noop = noop;
|
|
36
|
+
try {
|
|
37
|
+
return __DEV__
|
|
38
|
+
} catch (_a) {
|
|
39
|
+
return process.env.NODE_ENV === 'development'
|
|
40
|
+
}
|
|
41
|
+
})()
|
|
42
|
+
exports.EMPTY_OBJECT = Object.freeze({})
|
|
43
|
+
exports.EMPTY_ARRAY = Object.freeze([])
|
|
44
|
+
const noop = () => {}
|
|
45
|
+
exports.noop = noop
|
|
34
46
|
const defaultGetCacheKey = (params) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
exports.defaultGetCacheKey = defaultGetCacheKey
|
|
47
|
+
switch (typeof params) {
|
|
48
|
+
case 'string':
|
|
49
|
+
case 'symbol':
|
|
50
|
+
return params
|
|
51
|
+
case 'object':
|
|
52
|
+
return JSON.stringify(params)
|
|
53
|
+
default:
|
|
54
|
+
return String(params)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.defaultGetCacheKey = defaultGetCacheKey
|
|
46
58
|
const applyEntityChanges = (entities, changes, options) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
var _a, _b, _c
|
|
60
|
+
if (changes.merge && changes.entities) {
|
|
61
|
+
;(0, exports.logWarn)('applyEntityChanges', 'merge and entities should not be both set')
|
|
62
|
+
}
|
|
63
|
+
const {merge = changes.entities, replace, remove} = changes
|
|
64
|
+
if (!merge && !replace && !remove) {
|
|
65
|
+
return undefined
|
|
66
|
+
}
|
|
67
|
+
const mutable = options.mutableCollections
|
|
68
|
+
const deepEqual = options.deepComparisonEnabled ? exports.optionalUtils.deepEqual : undefined
|
|
69
|
+
let result
|
|
70
|
+
const objectWithAllTypenames = Object.assign(
|
|
71
|
+
Object.assign(Object.assign({}, changes.merge), changes.remove),
|
|
72
|
+
changes.replace,
|
|
73
|
+
)
|
|
74
|
+
for (const typename in objectWithAllTypenames) {
|
|
75
|
+
const entitiesToMerge = merge === null || merge === void 0 ? void 0 : merge[typename]
|
|
76
|
+
const entitiesToReplace = replace === null || replace === void 0 ? void 0 : replace[typename]
|
|
77
|
+
const entitiesToRemove = remove === null || remove === void 0 ? void 0 : remove[typename]
|
|
78
|
+
if (
|
|
79
|
+
!entitiesToMerge &&
|
|
80
|
+
!entitiesToReplace &&
|
|
81
|
+
!(entitiesToRemove === null || entitiesToRemove === void 0 ? void 0 : entitiesToRemove.length)
|
|
82
|
+
) {
|
|
83
|
+
continue
|
|
50
84
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
85
|
+
if (options.additionalValidation) {
|
|
86
|
+
const mergeIds = entitiesToMerge && Object.keys(entitiesToMerge)
|
|
87
|
+
const replaceIds = entitiesToReplace && Object.keys(entitiesToReplace)
|
|
88
|
+
const idsSet = new Set(mergeIds)
|
|
89
|
+
replaceIds === null || replaceIds === void 0 ? void 0 : replaceIds.forEach((id) => idsSet.add(id))
|
|
90
|
+
entitiesToRemove === null || entitiesToRemove === void 0
|
|
91
|
+
? void 0
|
|
92
|
+
: entitiesToRemove.forEach((id) => idsSet.add(String(id)))
|
|
93
|
+
const totalKeysInResponse =
|
|
94
|
+
((_a = mergeIds === null || mergeIds === void 0 ? void 0 : mergeIds.length) !== null && _a !== void 0
|
|
95
|
+
? _a
|
|
96
|
+
: 0) +
|
|
97
|
+
((_b = replaceIds === null || replaceIds === void 0 ? void 0 : replaceIds.length) !== null &&
|
|
98
|
+
_b !== void 0
|
|
99
|
+
? _b
|
|
100
|
+
: 0) +
|
|
101
|
+
((_c =
|
|
102
|
+
entitiesToRemove === null || entitiesToRemove === void 0 ? void 0 : entitiesToRemove.length) !==
|
|
103
|
+
null && _c !== void 0
|
|
104
|
+
? _c
|
|
105
|
+
: 0)
|
|
106
|
+
if (totalKeysInResponse !== 0 && idsSet.size !== totalKeysInResponse) {
|
|
107
|
+
;(0, exports.logWarn)(
|
|
108
|
+
'applyEntityChanges',
|
|
109
|
+
'merge, replace and remove changes have intersections for: ' + typename,
|
|
110
|
+
)
|
|
111
|
+
}
|
|
54
112
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
113
|
+
const oldEntities = entities[typename]
|
|
114
|
+
let newEntities
|
|
115
|
+
entitiesToRemove === null || entitiesToRemove === void 0
|
|
116
|
+
? void 0
|
|
117
|
+
: entitiesToRemove.forEach((id) => {
|
|
118
|
+
if (oldEntities === null || oldEntities === void 0 ? void 0 : oldEntities[id]) {
|
|
119
|
+
newEntities !== null && newEntities !== void 0
|
|
120
|
+
? newEntities
|
|
121
|
+
: (newEntities = mutable ? oldEntities : Object.assign({}, oldEntities))
|
|
122
|
+
delete newEntities[id]
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
if (entitiesToReplace) {
|
|
126
|
+
for (const id in entitiesToReplace) {
|
|
127
|
+
const newEntity = entitiesToReplace[id]
|
|
128
|
+
if (
|
|
129
|
+
oldEntities === undefined ||
|
|
130
|
+
!(deepEqual === null || deepEqual === void 0 ? void 0 : deepEqual(oldEntities[id], newEntity))
|
|
131
|
+
) {
|
|
132
|
+
newEntities !== null && newEntities !== void 0
|
|
133
|
+
? newEntities
|
|
134
|
+
: (newEntities = mutable
|
|
135
|
+
? oldEntities !== null && oldEntities !== void 0
|
|
136
|
+
? oldEntities
|
|
137
|
+
: {}
|
|
138
|
+
: Object.assign({}, oldEntities))
|
|
139
|
+
newEntities[id] = newEntity
|
|
65
140
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
newEntities !== null && newEntities !== void 0 ? newEntities : (newEntities = mutable ? oldEntities : Object.assign({}, oldEntities));
|
|
82
|
-
delete newEntities[id];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
if (entitiesToReplace) {
|
|
86
|
-
for (const id in entitiesToReplace) {
|
|
87
|
-
const newEntity = entitiesToReplace[id];
|
|
88
|
-
if (oldEntities === undefined || !(deepEqual === null || deepEqual === void 0 ? void 0 : deepEqual(oldEntities[id], newEntity))) {
|
|
89
|
-
newEntities !== null && newEntities !== void 0 ? newEntities : (newEntities = mutable ? (oldEntities !== null && oldEntities !== void 0 ? oldEntities : {}) : Object.assign({}, oldEntities));
|
|
90
|
-
newEntities[id] = newEntity;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (entitiesToMerge) {
|
|
95
|
-
for (const id in entitiesToMerge) {
|
|
96
|
-
const oldEntity = oldEntities === null || oldEntities === void 0 ? void 0 : oldEntities[id];
|
|
97
|
-
const newEntity = Object.assign(Object.assign({}, oldEntity), entitiesToMerge[id]);
|
|
98
|
-
if (!(deepEqual === null || deepEqual === void 0 ? void 0 : deepEqual(oldEntity, newEntity))) {
|
|
99
|
-
newEntities !== null && newEntities !== void 0 ? newEntities : (newEntities = mutable ? (oldEntities !== null && oldEntities !== void 0 ? oldEntities : {}) : Object.assign({}, oldEntities));
|
|
100
|
-
newEntities[id] = newEntity;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (!newEntities) {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (mutable) {
|
|
108
|
-
(0, exports.incrementChangeKey)(newEntities);
|
|
109
|
-
if (result === undefined) {
|
|
110
|
-
(0, exports.incrementChangeKey)(entities);
|
|
111
|
-
result = entities;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
result !== null && result !== void 0 ? result : (result = Object.assign({}, entities));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (entitiesToMerge) {
|
|
144
|
+
for (const id in entitiesToMerge) {
|
|
145
|
+
const oldEntity = oldEntities === null || oldEntities === void 0 ? void 0 : oldEntities[id]
|
|
146
|
+
const newEntity = Object.assign(Object.assign({}, oldEntity), entitiesToMerge[id])
|
|
147
|
+
if (!(deepEqual === null || deepEqual === void 0 ? void 0 : deepEqual(oldEntity, newEntity))) {
|
|
148
|
+
newEntities !== null && newEntities !== void 0
|
|
149
|
+
? newEntities
|
|
150
|
+
: (newEntities = mutable
|
|
151
|
+
? oldEntities !== null && oldEntities !== void 0
|
|
152
|
+
? oldEntities
|
|
153
|
+
: {}
|
|
154
|
+
: Object.assign({}, oldEntities))
|
|
155
|
+
newEntities[id] = newEntity
|
|
116
156
|
}
|
|
117
|
-
|
|
157
|
+
}
|
|
118
158
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
entities,
|
|
122
|
-
changes,
|
|
123
|
-
options,
|
|
124
|
-
result,
|
|
125
|
-
});
|
|
126
|
-
return result;
|
|
127
|
-
};
|
|
128
|
-
exports.applyEntityChanges = applyEntityChanges;
|
|
129
|
-
const isEmptyObject = (obj) => {
|
|
130
|
-
for (const _ in obj) {
|
|
131
|
-
return false;
|
|
159
|
+
if (!newEntities) {
|
|
160
|
+
continue
|
|
132
161
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
162
|
+
if (mutable) {
|
|
163
|
+
;(0, exports.incrementChangeKey)(newEntities)
|
|
164
|
+
if (result === undefined) {
|
|
165
|
+
;(0, exports.incrementChangeKey)(entities)
|
|
166
|
+
result = entities
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
result !== null && result !== void 0 ? result : (result = Object.assign({}, entities))
|
|
170
|
+
}
|
|
171
|
+
result[typename] = newEntities
|
|
172
|
+
}
|
|
173
|
+
options.logsEnabled &&
|
|
174
|
+
(0, exports.logDebug)('applyEntityChanges', {
|
|
175
|
+
entities,
|
|
176
|
+
changes,
|
|
177
|
+
options,
|
|
178
|
+
result,
|
|
179
|
+
})
|
|
180
|
+
return result
|
|
181
|
+
}
|
|
182
|
+
exports.applyEntityChanges = applyEntityChanges
|
|
183
|
+
const isEmptyObject = (obj) => {
|
|
184
|
+
for (const _ in obj) {
|
|
185
|
+
return false
|
|
186
|
+
}
|
|
187
|
+
return true
|
|
188
|
+
}
|
|
189
|
+
exports.isEmptyObject = isEmptyObject
|
|
136
190
|
const createStateComparer = (fields) => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
for (let i = 0; i < fields.length; i += 1) {
|
|
145
|
-
const key = fields[i];
|
|
146
|
-
if (x[key] !== y[key]) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return true;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
exports.createStateComparer = createStateComparer;
|
|
154
|
-
exports.FetchPolicy = {
|
|
155
|
-
NoCacheOrExpired: (expired, _params, state) => {
|
|
156
|
-
return expired || state.result === undefined;
|
|
157
|
-
},
|
|
158
|
-
Always: () => true,
|
|
159
|
-
};
|
|
160
|
-
const incrementChangeKey = (mutable) => {
|
|
161
|
-
if (mutable._changeKey === undefined) {
|
|
162
|
-
mutable._changeKey = 0;
|
|
191
|
+
return (x, y) => {
|
|
192
|
+
if (x === y) {
|
|
193
|
+
return true
|
|
194
|
+
}
|
|
195
|
+
if (x === undefined || y === undefined) {
|
|
196
|
+
return false
|
|
163
197
|
}
|
|
164
|
-
|
|
165
|
-
|
|
198
|
+
for (let i = 0; i < fields.length; i += 1) {
|
|
199
|
+
const key = fields[i]
|
|
200
|
+
if (x[key] !== y[key]) {
|
|
201
|
+
return false
|
|
202
|
+
}
|
|
166
203
|
}
|
|
167
|
-
|
|
168
|
-
|
|
204
|
+
return true
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.createStateComparer = createStateComparer
|
|
208
|
+
exports.FetchPolicy = {
|
|
209
|
+
NoCacheOrExpired: (expired, _params, state) => {
|
|
210
|
+
return expired || state.result === undefined
|
|
211
|
+
},
|
|
212
|
+
Always: () => true,
|
|
213
|
+
}
|
|
214
|
+
const incrementChangeKey = (mutable) => {
|
|
215
|
+
if (mutable._changeKey === undefined) {
|
|
216
|
+
mutable._changeKey = 0
|
|
217
|
+
} else {
|
|
218
|
+
mutable._changeKey += 1
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
exports.incrementChangeKey = incrementChangeKey
|
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {PACKAGE_SHORT_NAME} from './utilsAndConstants'
|
|
2
|
+
|
|
2
3
|
export const createActions = (name) => {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
}
|
|
4
|
+
const actionPrefix = `@${PACKAGE_SHORT_NAME}/${name}/`
|
|
5
|
+
const updateQueryStateAndEntitiesType = `${actionPrefix}updateQueryStateAndEntities`
|
|
6
|
+
const updateQueryStateAndEntities = (queryKey, queryCacheKey, state, entityChanges) => ({
|
|
7
|
+
type: updateQueryStateAndEntitiesType,
|
|
8
|
+
queryKey,
|
|
9
|
+
queryCacheKey,
|
|
10
|
+
state,
|
|
11
|
+
entityChanges,
|
|
12
|
+
})
|
|
13
|
+
updateQueryStateAndEntities.type = updateQueryStateAndEntitiesType
|
|
14
|
+
const updateMutationStateAndEntitiesType = `${actionPrefix}updateMutationStateAndEntities`
|
|
15
|
+
const updateMutationStateAndEntities = (mutationKey, state, entityChanges) => ({
|
|
16
|
+
type: updateMutationStateAndEntitiesType,
|
|
17
|
+
mutationKey,
|
|
18
|
+
state,
|
|
19
|
+
entityChanges,
|
|
20
|
+
})
|
|
21
|
+
updateMutationStateAndEntities.type = updateMutationStateAndEntitiesType
|
|
22
|
+
const mergeEntityChangesType = `${actionPrefix}mergeEntityChanges`
|
|
23
|
+
const mergeEntityChanges = (changes) => ({
|
|
24
|
+
type: mergeEntityChangesType,
|
|
25
|
+
changes,
|
|
26
|
+
})
|
|
27
|
+
mergeEntityChanges.type = mergeEntityChangesType
|
|
28
|
+
const invalidateQueryType = `${actionPrefix}invalidateQuery`
|
|
29
|
+
const invalidateQuery = (queries) => ({
|
|
30
|
+
type: invalidateQueryType,
|
|
31
|
+
queries,
|
|
32
|
+
})
|
|
33
|
+
invalidateQuery.type = invalidateQueryType
|
|
34
|
+
const clearQueryStateType = `${actionPrefix}clearQueryState`
|
|
35
|
+
const clearQueryState = (queries) => ({
|
|
36
|
+
type: clearQueryStateType,
|
|
37
|
+
queries,
|
|
38
|
+
})
|
|
39
|
+
clearQueryState.type = clearQueryStateType
|
|
40
|
+
const clearMutationStateType = `${actionPrefix}clearMutationState`
|
|
41
|
+
const clearMutationState = (mutationKeys) => ({
|
|
42
|
+
type: clearMutationStateType,
|
|
43
|
+
mutationKeys,
|
|
44
|
+
})
|
|
45
|
+
clearMutationState.type = clearMutationStateType
|
|
46
|
+
const clearCacheType = `${actionPrefix}clearCache`
|
|
47
|
+
const clearCache = (stateToKeep) => ({
|
|
48
|
+
type: clearCacheType,
|
|
49
|
+
stateToKeep,
|
|
50
|
+
})
|
|
51
|
+
clearCache.type = clearCacheType
|
|
52
|
+
return {
|
|
53
|
+
updateQueryStateAndEntities,
|
|
54
|
+
updateMutationStateAndEntities,
|
|
55
|
+
mergeEntityChanges,
|
|
56
|
+
invalidateQuery,
|
|
57
|
+
clearQueryState,
|
|
58
|
+
clearMutationState,
|
|
59
|
+
clearCache,
|
|
60
|
+
}
|
|
61
|
+
}
|