integreat 0.8.0-alpha.94 → 0.8.0-alpha.95
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/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "transformers", { enumerable: true, get: function
|
|
|
15
15
|
var middleware_1 = require("./middleware");
|
|
16
16
|
Object.defineProperty(exports, "middleware", { enumerable: true, get: function () { return middleware_1.default; } });
|
|
17
17
|
exports.default = {
|
|
18
|
-
version: '0.8.0-alpha.
|
|
18
|
+
version: '0.8.0-alpha.95',
|
|
19
19
|
create: create_1.default,
|
|
20
20
|
mergeDefinitions: mergeDefinitions_1.default,
|
|
21
21
|
mergeResources: mergeResources_1.default,
|
|
@@ -7,13 +7,22 @@ function prepareActionForMapping(action, _isRequest = false) {
|
|
|
7
7
|
}
|
|
8
8
|
exports.prepareActionForMapping = prepareActionForMapping;
|
|
9
9
|
const isResponseObject = (response) => (0, is_1.isObject)(response) && Object.keys(response).length > 0;
|
|
10
|
-
const
|
|
10
|
+
const setStatusAndError = (response, originalStatus = null) => ({
|
|
11
11
|
...response,
|
|
12
|
-
status: response.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
: response.status
|
|
12
|
+
status: response.error &&
|
|
13
|
+
['ok', null, undefined].includes(response.status) &&
|
|
14
|
+
(!originalStatus || originalStatus === 'ok')
|
|
15
|
+
? 'error'
|
|
16
|
+
: response.status === null
|
|
17
|
+
? null
|
|
18
|
+
: response.status || originalStatus,
|
|
19
|
+
...(response.error
|
|
20
|
+
? {
|
|
21
|
+
error: Array.isArray(response.error)
|
|
22
|
+
? response.error.join(' | ')
|
|
23
|
+
: response.error,
|
|
24
|
+
}
|
|
25
|
+
: {}),
|
|
17
26
|
});
|
|
18
27
|
function populateActionAfterMapping(action, mappedAction) {
|
|
19
28
|
if (!mappedAction) {
|
|
@@ -25,7 +34,7 @@ function populateActionAfterMapping(action, mappedAction) {
|
|
|
25
34
|
type: type || action.type,
|
|
26
35
|
payload: payload || action.payload,
|
|
27
36
|
...(isResponseObject(response) && {
|
|
28
|
-
response:
|
|
37
|
+
response: setStatusAndError(response, action.response?.status),
|
|
29
38
|
}),
|
|
30
39
|
meta: meta || action.meta,
|
|
31
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mappingHelpers.js","sourceRoot":"","sources":["../../src/utils/mappingHelpers.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAG/B,SAAgB,uBAAuB,CACrC,MAAc,EACd,UAAU,GAAG,KAAK;IAElB,OAAO,MAAM,CAAA;AACf,CAAC;AALD,0DAKC;AAED,MAAM,gBAAgB,GAAG,CAAC,QAAiB,EAAwB,EAAE,CACnE,IAAA,aAAQ,EAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AAExD,MAAM,
|
|
1
|
+
{"version":3,"file":"mappingHelpers.js","sourceRoot":"","sources":["../../src/utils/mappingHelpers.ts"],"names":[],"mappings":";;;AAAA,6BAA+B;AAG/B,SAAgB,uBAAuB,CACrC,MAAc,EACd,UAAU,GAAG,KAAK;IAElB,OAAO,MAAM,CAAA;AACf,CAAC;AALD,0DAKC;AAED,MAAM,gBAAgB,GAAG,CAAC,QAAiB,EAAwB,EAAE,CACnE,IAAA,aAAQ,EAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AAExD,MAAM,iBAAiB,GAAG,CACxB,QAA2B,EAC3B,iBAAgC,IAAI,EAC1B,EAAE,CAAC,CAAC;IACd,GAAG,QAAQ;IACX,MAAM,EACJ,QAAQ,CAAC,KAAK;QACd,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;QACjD,CAAC,CAAC,cAAc,IAAI,cAAc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