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