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,68 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.createSelectors = void 0
|
|
4
|
-
const utilsAndConstants_1 = require(
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSelectors = void 0;
|
|
4
|
+
const utilsAndConstants_1 = require("./utilsAndConstants");
|
|
6
5
|
const createSelectors = (cache) => {
|
|
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
|
-
return cache.cacheStateSelector(state).entities
|
|
62
|
-
},
|
|
63
|
-
selectEntitiesByTypename: (state, typename) => {
|
|
64
|
-
return cache.cacheStateSelector(state).entities[typename]
|
|
65
|
-
},
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.createSelectors = createSelectors
|
|
6
|
+
const selectEntityById = (state, id, typename) => {
|
|
7
|
+
var _a;
|
|
8
|
+
return id == null ? undefined : (_a = cache.cacheStateSelector(state).entities[typename]) === null || _a === void 0 ? void 0 : _a[id];
|
|
9
|
+
};
|
|
10
|
+
const selectQueryState = (state, query, cacheKey) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return (_a = cache.cacheStateSelector(state).queries[query][cacheKey]) !== null && _a !== void 0 ? _a : utilsAndConstants_1.EMPTY_OBJECT;
|
|
13
|
+
};
|
|
14
|
+
const selectMutationState = (state, mutation) => {
|
|
15
|
+
var _a;
|
|
16
|
+
return (_a = cache.cacheStateSelector(state).mutations[mutation]) !== null && _a !== void 0 ? _a : utilsAndConstants_1.EMPTY_OBJECT;
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
selectEntityById,
|
|
20
|
+
selectQueryState,
|
|
21
|
+
selectQueryResult: (state, query, cacheKey) => {
|
|
22
|
+
return selectQueryState(state, query, cacheKey).result;
|
|
23
|
+
},
|
|
24
|
+
selectQueryLoading: (state, query, cacheKey) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return (_a = selectQueryState(state, query, cacheKey).loading) !== null && _a !== void 0 ? _a : false;
|
|
27
|
+
},
|
|
28
|
+
selectQueryError: (state, query, cacheKey) => {
|
|
29
|
+
return selectQueryState(state, query, cacheKey).error;
|
|
30
|
+
},
|
|
31
|
+
selectQueryParams: (state, query, cacheKey) => {
|
|
32
|
+
return selectQueryState(state, query, cacheKey).params;
|
|
33
|
+
},
|
|
34
|
+
selectQueryExpiresAt: (state, query, cacheKey) => {
|
|
35
|
+
return selectQueryState(state, query, cacheKey).expiresAt;
|
|
36
|
+
},
|
|
37
|
+
selectMutationState,
|
|
38
|
+
selectMutationResult: (state, mutation) => {
|
|
39
|
+
return selectMutationState(state, mutation).result;
|
|
40
|
+
},
|
|
41
|
+
selectMutationLoading: (state, mutation) => {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = selectMutationState(state, mutation).loading) !== null && _a !== void 0 ? _a : false;
|
|
44
|
+
},
|
|
45
|
+
selectMutationError: (state, mutation) => {
|
|
46
|
+
return selectMutationState(state, mutation).error;
|
|
47
|
+
},
|
|
48
|
+
selectMutationParams: (state, mutation) => {
|
|
49
|
+
return selectMutationState(state, mutation).params;
|
|
50
|
+
},
|
|
51
|
+
selectEntities: (state) => {
|
|
52
|
+
return cache.cacheStateSelector(state).entities;
|
|
53
|
+
},
|
|
54
|
+
selectEntitiesByTypename: (state, typename) => {
|
|
55
|
+
return cache.cacheStateSelector(state).entities[typename];
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.createSelectors = createSelectors;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,90 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
k2 = k
|
|
8
|
-
}
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k)
|
|
10
|
-
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get() {
|
|
14
|
-
return m[k]
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(o, k2, desc)
|
|
19
|
-
}
|
|
20
|
-
: function (o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) {
|
|
22
|
-
k2 = k
|
|
23
|
-
}
|
|
24
|
-
o[k2] = m[k]
|
|
25
|
-
})
|
|
26
|
-
var __exportStar =
|
|
27
|
-
(this && this.__exportStar) ||
|
|
28
|
-
function (m, exports) {
|
|
29
|
-
for (var p in m) {
|
|
30
|
-
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) {
|
|
31
|
-
__createBinding(exports, m, p)
|
|
32
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
7
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var createCache_1 = require(
|
|
45
|
-
|
|
46
|
-
Object.defineProperty(exports,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
})
|
|
52
|
-
Object.defineProperty(exports,
|
|
53
|
-
|
|
54
|
-
get() {
|
|
55
|
-
return createCache_1.withTypenames
|
|
56
|
-
},
|
|
57
|
-
})
|
|
58
|
-
__exportStar(require('./types'), exports)
|
|
59
|
-
var utilsAndConstants_1 = require('./utilsAndConstants')
|
|
60
|
-
|
|
61
|
-
Object.defineProperty(exports, 'createStateComparer', {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get() {
|
|
64
|
-
return utilsAndConstants_1.createStateComparer
|
|
65
|
-
},
|
|
66
|
-
})
|
|
67
|
-
Object.defineProperty(exports, 'defaultGetCacheKey', {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get() {
|
|
70
|
-
return utilsAndConstants_1.defaultGetCacheKey
|
|
71
|
-
},
|
|
72
|
-
})
|
|
73
|
-
Object.defineProperty(exports, 'FetchPolicy', {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
get() {
|
|
76
|
-
return utilsAndConstants_1.FetchPolicy
|
|
77
|
-
},
|
|
78
|
-
})
|
|
79
|
-
Object.defineProperty(exports, 'isEmptyObject', {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get() {
|
|
82
|
-
return utilsAndConstants_1.isEmptyObject
|
|
83
|
-
},
|
|
84
|
-
})
|
|
85
|
-
Object.defineProperty(exports, 'noop', {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get() {
|
|
88
|
-
return utilsAndConstants_1.noop
|
|
89
|
-
},
|
|
90
|
-
})
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.noop = exports.isEmptyObject = exports.FetchPolicy = exports.defaultGetCacheKey = exports.createStateComparer = exports.withTypenames = exports.createCache = void 0;
|
|
18
|
+
var createCache_1 = require("./createCache");
|
|
19
|
+
Object.defineProperty(exports, "createCache", { enumerable: true, get: function () { return createCache_1.createCache; } });
|
|
20
|
+
Object.defineProperty(exports, "withTypenames", { enumerable: true, get: function () { return createCache_1.withTypenames; } });
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
var utilsAndConstants_1 = require("./utilsAndConstants");
|
|
23
|
+
Object.defineProperty(exports, "createStateComparer", { enumerable: true, get: function () { return utilsAndConstants_1.createStateComparer; } });
|
|
24
|
+
Object.defineProperty(exports, "defaultGetCacheKey", { enumerable: true, get: function () { return utilsAndConstants_1.defaultGetCacheKey; } });
|
|
25
|
+
Object.defineProperty(exports, "FetchPolicy", { enumerable: true, get: function () { return utilsAndConstants_1.FetchPolicy; } });
|
|
26
|
+
Object.defineProperty(exports, "isEmptyObject", { enumerable: true, get: function () { return utilsAndConstants_1.isEmptyObject; } });
|
|
27
|
+
Object.defineProperty(exports, "noop", { enumerable: true, get: function () { return utilsAndConstants_1.noop; } });
|
package/dist/cjs/mutate.js
CHANGED
|
@@ -1,161 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter =
|
|
3
|
-
|
|
4
|
-
function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) {
|
|
6
|
-
return value instanceof P
|
|
7
|
-
? value
|
|
8
|
-
: new P(function (resolve) {
|
|
9
|
-
resolve(value)
|
|
10
|
-
})
|
|
11
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
Object.defineProperty(exports, '__esModule', {value: true})
|
|
34
|
-
exports.mutate = void 0
|
|
35
|
-
const utilsAndConstants_1 = require('./utilsAndConstants')
|
|
36
|
-
|
|
37
|
-
const mutate = (
|
|
38
|
-
logTag_1,
|
|
39
|
-
store_1,
|
|
40
|
-
cache_1,
|
|
41
|
-
actions_1,
|
|
42
|
-
selectors_1,
|
|
43
|
-
mutationKey_1,
|
|
44
|
-
params_1,
|
|
45
|
-
abortControllers_1,
|
|
46
|
-
...args_1
|
|
47
|
-
) =>
|
|
48
|
-
__awaiter(
|
|
49
|
-
void 0,
|
|
50
|
-
[
|
|
51
|
-
logTag_1,
|
|
52
|
-
store_1,
|
|
53
|
-
cache_1,
|
|
54
|
-
actions_1,
|
|
55
|
-
selectors_1,
|
|
56
|
-
mutationKey_1,
|
|
57
|
-
params_1,
|
|
58
|
-
abortControllers_1,
|
|
59
|
-
...args_1,
|
|
60
|
-
],
|
|
61
|
-
void 0,
|
|
62
|
-
function* (
|
|
63
|
-
logTag,
|
|
64
|
-
store,
|
|
65
|
-
cache,
|
|
66
|
-
actions,
|
|
67
|
-
selectors,
|
|
68
|
-
mutationKey,
|
|
69
|
-
params,
|
|
70
|
-
abortControllers,
|
|
71
|
-
onCompleted = cache.mutations[mutationKey].onCompleted,
|
|
72
|
-
onSuccess = cache.mutations[mutationKey].onSuccess,
|
|
73
|
-
onError = cache.mutations[mutationKey].onError
|
|
74
|
-
) {
|
|
75
|
-
var _a, _b
|
|
76
|
-
const {updateMutationStateAndEntities} = actions
|
|
77
|
-
let abortControllersOfStore = abortControllers.get(store)
|
|
78
|
-
if (abortControllersOfStore === undefined) {
|
|
79
|
-
abortControllersOfStore = {}
|
|
80
|
-
abortControllers.set(store, abortControllersOfStore)
|
|
81
|
-
}
|
|
82
|
-
{
|
|
83
|
-
const abortController = abortControllersOfStore[mutationKey]
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.mutate = void 0;
|
|
13
|
+
const utilsAndConstants_1 = require("./utilsAndConstants");
|
|
14
|
+
const mutate = (logTag_1, store_1, cache_1, actions_1, selectors_1, mutationKey_1, params_1, abortControllers_1, ...args_1) => __awaiter(void 0, [logTag_1, store_1, cache_1, actions_1, selectors_1, mutationKey_1, params_1, abortControllers_1, ...args_1], void 0, function* (logTag, store, cache, actions, selectors, mutationKey, params, abortControllers, onCompleted = cache.mutations[mutationKey].onCompleted, onSuccess = cache.mutations[mutationKey].onSuccess, onError = cache.mutations[mutationKey].onError) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const { updateMutationStateAndEntities } = actions;
|
|
17
|
+
let abortControllersOfStore = abortControllers.get(store);
|
|
18
|
+
if (abortControllersOfStore === undefined) {
|
|
19
|
+
abortControllersOfStore = {};
|
|
20
|
+
abortControllers.set(store, abortControllersOfStore);
|
|
21
|
+
}
|
|
22
|
+
{
|
|
23
|
+
const abortController = abortControllersOfStore[mutationKey];
|
|
84
24
|
cache.options.logsEnabled &&
|
|
85
|
-
|
|
86
|
-
mutationKey,
|
|
87
|
-
params,
|
|
88
|
-
previousAborted: abortController !== undefined,
|
|
89
|
-
})
|
|
25
|
+
(0, utilsAndConstants_1.logDebug)(logTag, { mutationKey, params, previousAborted: abortController !== undefined });
|
|
90
26
|
if (abortController !== undefined) {
|
|
91
|
-
|
|
27
|
+
abortController.abort();
|
|
92
28
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
delete abortControllersOfStore[mutationKey]
|
|
121
|
-
if (error) {
|
|
122
|
-
store.dispatch(
|
|
123
|
-
updateMutationStateAndEntities(mutationKey, {
|
|
124
|
-
error,
|
|
29
|
+
}
|
|
30
|
+
const abortController = new AbortController();
|
|
31
|
+
abortControllersOfStore[mutationKey] = abortController;
|
|
32
|
+
const mutatePromise = cache.mutations[mutationKey].mutation(params, store, abortController.signal);
|
|
33
|
+
store.dispatch(updateMutationStateAndEntities(mutationKey, {
|
|
34
|
+
loading: mutatePromise,
|
|
35
|
+
params,
|
|
36
|
+
result: undefined,
|
|
37
|
+
}));
|
|
38
|
+
let response;
|
|
39
|
+
let error;
|
|
40
|
+
try {
|
|
41
|
+
response = yield mutatePromise;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
error = e;
|
|
45
|
+
}
|
|
46
|
+
cache.options.logsEnabled &&
|
|
47
|
+
(0, utilsAndConstants_1.logDebug)(`${logTag} finished`, { response, error, aborted: abortController.signal.aborted });
|
|
48
|
+
if (abortController.signal.aborted) {
|
|
49
|
+
return ABORTED_RESULT;
|
|
50
|
+
}
|
|
51
|
+
delete abortControllersOfStore[mutationKey];
|
|
52
|
+
if (error) {
|
|
53
|
+
store.dispatch(updateMutationStateAndEntities(mutationKey, {
|
|
54
|
+
error: error,
|
|
125
55
|
loading: undefined,
|
|
126
|
-
|
|
127
|
-
)
|
|
128
|
-
|
|
129
|
-
!(onError === null || onError === void 0
|
|
130
|
-
? void 0
|
|
131
|
-
: onError(error, params, store, actions, selectors))
|
|
132
|
-
) {
|
|
133
|
-
;(_b = (_a = cache.globals).onError) === null || _b === void 0
|
|
134
|
-
? void 0
|
|
135
|
-
: _b.call(_a, error, mutationKey, params, store, actions, selectors)
|
|
56
|
+
}));
|
|
57
|
+
if (!(onError === null || onError === void 0 ? void 0 : onError(error, params, store, actions, selectors))) {
|
|
58
|
+
(_b = (_a = cache.globals).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error, mutationKey, params, store, actions, selectors);
|
|
136
59
|
}
|
|
137
|
-
onCompleted === null || onCompleted === void 0
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
if (response) {
|
|
60
|
+
onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response, error, params, store, actions, selectors);
|
|
61
|
+
return { error };
|
|
62
|
+
}
|
|
63
|
+
if (response) {
|
|
143
64
|
const newState = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
store.dispatch(updateMutationStateAndEntities(mutationKey, newState, response))
|
|
149
|
-
onSuccess === null || onSuccess === void 0
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
onCompleted === null || onCompleted === void 0
|
|
153
|
-
? void 0
|
|
154
|
-
: onCompleted(response, error, params, store, actions, selectors)
|
|
155
|
-
return {result: response.result}
|
|
156
|
-
}
|
|
157
|
-
throw new Error(`${logTag}: both error and response are not defined`)
|
|
65
|
+
error: undefined,
|
|
66
|
+
loading: undefined,
|
|
67
|
+
result: response.result,
|
|
68
|
+
};
|
|
69
|
+
store.dispatch(updateMutationStateAndEntities(mutationKey, newState, response));
|
|
70
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response, params, store, actions, selectors);
|
|
71
|
+
onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response, error, params, store, actions, selectors);
|
|
72
|
+
return { result: response.result };
|
|
158
73
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
74
|
+
throw new Error(`${logTag}: both error and response are not defined`);
|
|
75
|
+
});
|
|
76
|
+
exports.mutate = mutate;
|
|
77
|
+
const ABORTED_RESULT = Object.freeze({ aborted: true });
|