@txo/service-graphql-react 2.3.13 → 2.3.14
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/CHANGELOG.md +7 -0
- package/lib/Api/ErrorMapHelper.js +5 -5
- package/lib/Api/ErrorMapHelper.js.map +1 -1
- package/lib/Api/PromiseHelper.js +1 -39
- package/lib/Api/PromiseHelper.js.map +1 -1
- package/lib/Hooks/UseServiceMutation.js +33 -26
- package/lib/Hooks/UseServiceMutation.js.map +1 -1
- package/lib/Hooks/UseServiceQuery.js +3 -3
- package/lib/Hooks/UseServiceQuery.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/package.json +7 -7
- package/src/Api/ErrorMapHelper.ts +6 -6
- package/src/Api/PromiseHelper.ts +1 -1
- package/src/Hooks/UseServiceMutation.ts +4 -4
- package/src/Hooks/UseServiceQuery.ts +4 -4
- package/src/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [2.3.14](https://github.com/technology-studio/service-graphql-react/compare/v2.3.13...v2.3.14) (2023-02-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency type-fest to ^3.6.1 ([425f92a](https://github.com/technology-studio/service-graphql-react/commit/425f92a06746a560d123bd715702776241c1bcb2))
|
|
7
|
+
|
|
1
8
|
## [2.3.13](https://github.com/technology-studio/service-graphql-react/compare/v2.3.12...v2.3.13) (2023-02-17)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -53,12 +53,12 @@ var getWithWildcardFallback = function (errorMap, path) {
|
|
|
53
53
|
if (errorMap === undefined) {
|
|
54
54
|
return undefined;
|
|
55
55
|
}
|
|
56
|
-
if (path) {
|
|
56
|
+
if (path !== '') {
|
|
57
57
|
if ((0, functional_1.isObject)(errorMap)) {
|
|
58
58
|
var pathList = path.split('.');
|
|
59
59
|
var currentPath = pathList.shift();
|
|
60
60
|
var keyList = Object.keys(errorMap);
|
|
61
|
-
var currentKey = currentPath && keyList.includes(currentPath) ? currentPath : '*';
|
|
61
|
+
var currentKey = currentPath != null && currentPath !== '' && keyList.includes(currentPath) ? currentPath : '*';
|
|
62
62
|
return getWithWildcardFallback(errorMap[currentKey], pathList.join('.'));
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
@@ -78,7 +78,7 @@ var applyErrorMap = function (serviceErrorList, errorMap, onFieldErrors) {
|
|
|
78
78
|
var graphQlError = serviceError.data;
|
|
79
79
|
var path = __spreadArray(__spreadArray([], ((_a = graphQlError === null || graphQlError === void 0 ? void 0 : graphQlError.path) !== null && _a !== void 0 ? _a : []), true), [serviceError.key], false).join('.');
|
|
80
80
|
var errorMapper = getWithWildcardFallback(normalisedErrorMap, path);
|
|
81
|
-
if (errorMapper) {
|
|
81
|
+
if (errorMapper != null) {
|
|
82
82
|
var nextServiceError = errorMapper({
|
|
83
83
|
error: serviceError,
|
|
84
84
|
fieldErrors: fieldErrors,
|
|
@@ -87,14 +87,14 @@ var applyErrorMap = function (serviceErrorList, errorMap, onFieldErrors) {
|
|
|
87
87
|
if (nextServiceError !== serviceError) {
|
|
88
88
|
modified = true;
|
|
89
89
|
}
|
|
90
|
-
nextServiceError && nextServiceErrorList.push(nextServiceError);
|
|
90
|
+
(nextServiceError != null) && nextServiceErrorList.push(nextServiceError);
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
nextServiceErrorList.push(serviceError);
|
|
94
94
|
}
|
|
95
95
|
return nextServiceErrorList;
|
|
96
96
|
}, []);
|
|
97
|
-
if (onFieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
97
|
+
if ((onFieldErrors != null) && Object.keys(fieldErrors).length > 0) {
|
|
98
98
|
onFieldErrors(fieldErrors);
|
|
99
99
|
}
|
|
100
100
|
return modified ? nextServiceErrorList : serviceErrorList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorMapHelper.js","sourceRo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8D;QAC9D,IAAM,YAAY,GAAQ,YAAY,CAAC,IAAI,CAAA;QAC3C,IAAM,IAAI,GAAG,gCAAI,CAAC,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,mCAAI,EAAE,CAAC,UAAE,YAAY,CAAC,GAAG,UAAE,IAAI,CAAC,GAAG,CAAC,CAAA;QACxE,IAAM,WAAW,GAAG,uBAAuB,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAA;QAErE,IAAI,WAAW,IAAI,IAAI,EAAE;YACvB,IAAM,gBAAgB,GAAG,WAAW,CAAC;gBACnC,KAAK,EAAE,YAAY;gBACnB,WAAW,aAAA;gBACX,IAAI,MAAA;aACL,CAAC,CAAA;YACF,IAAI,gBAAgB,KAAK,YAAY,EAAE;gBACrC,QAAQ,GAAG,IAAI,CAAA;aAChB;YACD,CAAC,gBAAgB,IAAI,IAAI,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;SAC1E;aAAM;YACL,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;SACxC;QAED,OAAO,oBAAoB,CAAA;IAC7B,CAAC,EAAE,EAAE,CAAC,CAAA;IAER,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QAClE,aAAa,CAAC,WAAW,CAAC,CAAA;KAC3B;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,gBAAgB,CAAA;AAC3D,CAAC,CAAA;AAtCY,QAAA,aAAa,iBAsCzB"}
|
package/lib/Api/PromiseHelper.js
CHANGED
|
@@ -4,48 +4,10 @@
|
|
|
4
4
|
* @Date: 2022-06-08T09:06:94+02:00
|
|
5
5
|
* @Copyright: Technology Studio
|
|
6
6
|
**/
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
17
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
18
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
19
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
20
|
-
function step(op) {
|
|
21
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
22
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
23
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
24
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
25
|
-
switch (op[0]) {
|
|
26
|
-
case 0: case 1: t = op; break;
|
|
27
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
28
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
29
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
30
|
-
default:
|
|
31
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
32
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
33
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
34
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
35
|
-
if (t[2]) _.ops.pop();
|
|
36
|
-
_.trys.pop(); continue;
|
|
37
|
-
}
|
|
38
|
-
op = body.call(thisArg, _);
|
|
39
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
40
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
7
|
exports.__esModule = true;
|
|
44
8
|
exports.asyncToCallback = exports.suppressErrors = exports.suppressResults = void 0;
|
|
45
9
|
var suppressResults = function (promise) { return promise
|
|
46
|
-
.then(
|
|
47
|
-
return [2 /*return*/, Promise.resolve()];
|
|
48
|
-
}); }); })["catch"](function () { return undefined; }); };
|
|
10
|
+
.then(Promise.resolve)["catch"](function () { return undefined; }); };
|
|
49
11
|
exports.suppressResults = suppressResults;
|
|
50
12
|
var suppressErrors = function (promise, thenCallback) {
|
|
51
13
|
void promise
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromiseHelper.js","sourceRoot":"","sources":["../../src/Api/PromiseHelper.ts"],"names":[],"mappings":";AAAA;;;;GAIG
|
|
1
|
+
{"version":3,"file":"PromiseHelper.js","sourceRoot":"","sources":["../../src/Api/PromiseHelper.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAMI,IAAM,eAAe,GAAG,UAAC,OAAyB,IAAwB,OAC9E,OAAO;KACL,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CACrB,OAAK,CAAA,CAAC,cAAM,OAAA,SAAS,EAAT,CAAS,CACzB,EAJgF,CAIhF,CAAA;AAJY,QAAA,eAAe,mBAI3B;AAEM,IAAM,cAAc,GAAG,UAC5B,OAAsB,EACtB,YAAkC;IAElC,KAAK,OAAO;SACT,IAAI,CAAC,YAAY,CAAC,CAClB,OAAK,CAAA,CAAC,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC,CAAA;AAC3B,CAAC,CAAA;AAPY,QAAA,cAAc,kBAO1B;AAEM,IAAM,eAAe,GAAG,UAC7B,OAAyB;IAEzB,IAAA,uBAAe,EAAC,OAAO,CAAC,CAAA;AAC1B,CAAC,CAAA;AAJY,QAAA,eAAe,mBAI3B"}
|
|
@@ -78,34 +78,41 @@ var useServiceMutation = function (mutationDocument, options) {
|
|
|
78
78
|
var attributes, onFieldErrors, context, operationName, mutateWithErrorProcessor, nextMutate;
|
|
79
79
|
var _a, _b;
|
|
80
80
|
return __generator(this, function (_c) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
81
|
+
switch (_c.label) {
|
|
82
|
+
case 0:
|
|
83
|
+
attributes = __assign({ variables: variables, mutation: mutationDocument }, memoizedOptions);
|
|
84
|
+
onFieldErrors = (_a = callAttributes === null || callAttributes === void 0 ? void 0 : callAttributes.onFieldErrors) !== null && _a !== void 0 ? _a : memoizedDefaultOnFieldErrors;
|
|
85
|
+
context = calculateContext(mutationDocument, variables);
|
|
86
|
+
(exceptionRef.current != null) && removeServiceErrorException(context);
|
|
87
|
+
exceptionRef.current = null;
|
|
88
|
+
operationName = (0, OperationHelper_1.getName)(mutationDocument);
|
|
89
|
+
mutateWithErrorProcessor = function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, (0, service_graphql_1.operationPromiseProcessor)(mutate(options), {
|
|
93
|
+
operationName: operationName,
|
|
94
|
+
context: context
|
|
95
|
+
})];
|
|
96
|
+
case 1: return [2 /*return*/, (_a.sent())];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}); };
|
|
100
|
+
nextMutate = (_b = mutateFactory === null || mutateFactory === void 0 ? void 0 : mutateFactory(mutateWithErrorProcessor)) !== null && _b !== void 0 ? _b : mutateWithErrorProcessor;
|
|
101
|
+
return [4 /*yield*/, (0, service_graphql_1.operationPromiseProcessor)(nextMutate(attributes), {
|
|
90
102
|
operationName: operationName,
|
|
91
103
|
context: context
|
|
92
|
-
}))
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
addServiceErrorException(serviceErrorException);
|
|
105
|
-
exceptionRef.current = serviceErrorException;
|
|
106
|
-
throw serviceErrorException;
|
|
107
|
-
});
|
|
108
|
-
}); })];
|
|
104
|
+
})["catch"](function (serviceErrorException) { return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
+
return __generator(this, function (_a) {
|
|
106
|
+
if (memoizedErrorMap != null) {
|
|
107
|
+
serviceErrorException.serviceErrorList = (0, ErrorMapHelper_1.applyErrorMap)(serviceErrorException.serviceErrorList, memoizedErrorMap, onFieldErrors);
|
|
108
|
+
}
|
|
109
|
+
addServiceErrorException(serviceErrorException);
|
|
110
|
+
exceptionRef.current = serviceErrorException;
|
|
111
|
+
throw serviceErrorException;
|
|
112
|
+
});
|
|
113
|
+
}); })];
|
|
114
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
115
|
+
}
|
|
109
116
|
});
|
|
110
117
|
}); }, [mutationDocument, memoizedOptions, memoizedDefaultOnFieldErrors, removeServiceErrorException, mutateFactory, mutate, memoizedErrorMap, addServiceErrorException]);
|
|
111
118
|
var memoizedMutation = (0, hooks_react_1.useMemoObject)(mutation);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseServiceMutation.js","sourceRoot":"","sources":["../../src/Hooks/UseServiceMutation.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B,IAAI,IAAI,EAAE;oCAC5B,qBAAqB,CAAC,gBAAgB,GAAG,IAAA,8BAAa,EACpD,qBAAqB,CAAC,gBAAgB,EACtC,gBAAgB,EAChB,aAAa,CACd,CAAA;iCACF;gCACD,wBAAwB,CAAC,qBAAqB,CAAC,CAAA;gCAC/C,YAAY,CAAC,OAAO,GAAG,qBAAqB,CAAA;gCAC5C,MAAM,qBAAqB,CAAA;;6BAC5B,CAAC,EAAA;wBAfJ,sBAAO,SAeH,EAAA;;;SACL,EAAE,CAAC,gBAAgB,EAAE,eAAe,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CAAC,CAAA;IAErK,IAAM,gBAAgB,GAAG,IAAA,2BAAa,EAA+B,QAAQ,CAAC,CAAA;IAE9E,OAAO,IAAA,eAAO,EAAC;;QAAM,OAAA,CAAC;YACpB,QAAQ,EAAE,gBAAgB;YAC1B,IAAI,EAAE,MAAA,gBAAgB,CAAC,IAAI,mCAAI,IAAI;YACnC,QAAQ,EAAE,gBAAgB,CAAC,OAAO;YAClC,IAAI,EAAE,WAAW;SAClB,CAAC,CAAA;KAAA,EAAE,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAA;AACtC,CAAC,CAAA;AA/EY,QAAA,kBAAkB,sBA+E9B"}
|
|
@@ -40,7 +40,7 @@ var useServiceQuery = function (queryDocument, options) {
|
|
|
40
40
|
var context = (0, react_1.useMemo)(function () { return (calculateContext(queryDocument, memoizedVariables)); }, [queryDocument, memoizedVariables]);
|
|
41
41
|
var exception = (0, react_1.useMemo)(function () {
|
|
42
42
|
var operationName = (0, OperationHelper_1.getName)(queryDocument);
|
|
43
|
-
if (memoizedQuery.error) {
|
|
43
|
+
if (memoizedQuery.error != null) {
|
|
44
44
|
var errorList = service_graphql_1.configManager.config.errorResponseTranslator(memoizedQuery.error, {
|
|
45
45
|
context: context,
|
|
46
46
|
operationName: operationName
|
|
@@ -55,12 +55,12 @@ var useServiceQuery = function (queryDocument, options) {
|
|
|
55
55
|
return null;
|
|
56
56
|
}, [context, memoizedQuery, queryDocument]);
|
|
57
57
|
(0, react_1.useLayoutEffect)(function () {
|
|
58
|
-
if (exception &&
|
|
58
|
+
if ((exception != null) && (shownExceptionListRef.current.find(function (shownException) { return (isServiceErrorListEqual(shownException.serviceErrorList, exception.serviceErrorList)); }) == null)) {
|
|
59
59
|
addServiceErrorException(exception);
|
|
60
60
|
shownExceptionListRef.current.push(exception);
|
|
61
61
|
}
|
|
62
62
|
return function () {
|
|
63
|
-
exception && removeServiceErrorException(context);
|
|
63
|
+
(exception != null) && removeServiceErrorException(context);
|
|
64
64
|
};
|
|
65
65
|
}, [addServiceErrorException, context, exception, memoizedVariables, queryDocument, removeServiceErrorException]);
|
|
66
66
|
var promiselessRefetch = (0, react_1.useCallback)(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseServiceQuery.js","sourceRoot":"","sources":["../../src/Hooks/UseServiceQuery.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,+BAMc;AAOd,yCAEuB;AACvB,0DAA4B;AAO5B,kDAE0B;AAC1B,iEAA6D;AAC7D,gDAEyB;AACzB,yFAA+E;AAG/E,sDAAqD;AACrD,0DAAgD;AAChD,sDAAsD;AAEtD,IAAM,gBAAgB,GAAG,UAAC,KAAmB,EAAE,SAA8C,IAAa,OAAA,CACxG,IAAA,8BAAc,EAAC,IAAA,yBAAO,EAAC,KAAK,CAAC,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,CAChD,EAFyG,CAEzG,CAAA;AAcD,IAAM,uBAAuB,GAAG,UAAC,CAAiB,EAAE,CAAiB;IACnE,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE;QACzB,OAAO,KAAK,CAAA;KACb;IACD,IAAI,CAAC,CAAC,KAAK,CAAC,UAAC,KAAK,EAAE,KAAK,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OAAO;YACL,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,2BAA2B,CAAC,OAAO,CAAC,CAAA;QAC7D,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,wBAAwB,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,2BAA2B,CAAC,CAAC,CAAA;IAEjH,IAAM,kBAAkB,GAAG,IAAA,mBAAW,EAAC;QAAC,cAAiD;aAAjD,UAAiD,EAAjD,qBAAiD,EAAjD,IAAiD;YAAjD,yBAAiD;;QACvF,IAAA,+BAAe,EAAC,aAAa,CAAC,OAAO,OAArB,aAAa,EAAY,IAAI,EAAE,CAAA;IACjD,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAA;IAEnB,OAAO,IAAA,eAAO,EAAC,cAAM,OAAA,CAAC;QACpB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,IAAA,uBAAG,EAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC;QACvC,QAAQ,EAAE,aAAa,CAAC,OAAO;QAC/B,kBAAkB,oBAAA;QAClB,SAAS,WAAA;KACV,CAAC,EANmB,CAMnB,EAAE,CAAC,aAAa,EAAE,QAAQ,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAC,CAAA;AAC/D,CAAC,CAAA;AA/DY,QAAA,eAAe,mBA+D3B"}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export { getName } from './Api/OperationHelper';
|
|
|
7
7
|
export * from './Api/ErrorMapHelper';
|
|
8
8
|
export * from './Api/PromiseHelper';
|
|
9
9
|
export * from './Hooks/UseServiceMutation';
|
|
10
|
-
export { useServiceQuery, QueryServiceProp, } from './Hooks/UseServiceQuery';
|
|
10
|
+
export { useServiceQuery, type QueryServiceProp, } from './Hooks/UseServiceQuery';
|
|
11
11
|
export * from './Model/Types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@txo/service-graphql-react",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.14",
|
|
4
4
|
"description": "Technology Studio - Service graphql react",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@txo/types": "^1.3.0",
|
|
41
41
|
"lodash.get": "^4.4.2",
|
|
42
42
|
"lodash.set": "^4.3.2",
|
|
43
|
-
"type-fest": "^3.6.
|
|
43
|
+
"type-fest": "^3.6.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@apollo/client": "^3.7.5",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@apollo/client": "^3.7.5",
|
|
53
|
-
"@commitlint/cli": "^17.4.
|
|
54
|
-
"@commitlint/config-conventional": "^17.4.
|
|
53
|
+
"@commitlint/cli": "^17.4.4",
|
|
54
|
+
"@commitlint/config-conventional": "^17.4.4",
|
|
55
55
|
"@semantic-release/changelog": "^6.0.2",
|
|
56
56
|
"@semantic-release/git": "^10.0.1",
|
|
57
57
|
"@txo-peer-dep/log": "^4.0.0",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"@types/lodash.get": "^4.4.7",
|
|
63
63
|
"@types/lodash.set": "^4.3.7",
|
|
64
64
|
"@types/react": "^18.0.28",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
66
|
-
"@typescript-eslint/parser": "^5.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
66
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
67
67
|
"commitizen": "^4.3.0",
|
|
68
68
|
"concurrently": "^7.6.0",
|
|
69
69
|
"eslint": "^8.34.0",
|
|
70
|
-
"eslint-config-txo-typescript-react": "^1.0.
|
|
70
|
+
"eslint-config-txo-typescript-react": "^1.0.59",
|
|
71
71
|
"eslint-formatter-pretty": "^4.1.0",
|
|
72
72
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
73
73
|
"eslint-plugin-import": "^2.27.5",
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
const normaliseErrorMap = (errorMap: ErrorMap): ErrorMap => {
|
|
22
22
|
if (isObject(errorMap)) {
|
|
23
|
-
return Object.keys(errorMap).reduce((normalisedErrorMap:
|
|
23
|
+
return Object.keys(errorMap).reduce((normalisedErrorMap: Record<string, ErrorMap>, key) => {
|
|
24
24
|
set(normalisedErrorMap, key, normaliseErrorMap(errorMap[key]))
|
|
25
25
|
return normalisedErrorMap
|
|
26
26
|
}, {})
|
|
@@ -48,12 +48,12 @@ const getWithWildcardFallback = (errorMap: ErrorMap, path: string): ErrorMapper
|
|
|
48
48
|
if (errorMap === undefined) {
|
|
49
49
|
return undefined
|
|
50
50
|
}
|
|
51
|
-
if (path) {
|
|
51
|
+
if (path !== '') {
|
|
52
52
|
if (isObject(errorMap)) {
|
|
53
53
|
const pathList = path.split('.')
|
|
54
54
|
const currentPath = pathList.shift()
|
|
55
55
|
const keyList = Object.keys(errorMap)
|
|
56
|
-
const currentKey = currentPath && keyList.includes(currentPath) ? currentPath : '*'
|
|
56
|
+
const currentKey = currentPath != null && currentPath !== '' && keyList.includes(currentPath) ? currentPath : '*'
|
|
57
57
|
return getWithWildcardFallback(errorMap[currentKey], pathList.join('.'))
|
|
58
58
|
} else {
|
|
59
59
|
return undefined
|
|
@@ -78,7 +78,7 @@ export const applyErrorMap = (
|
|
|
78
78
|
const path = [...(graphQlError?.path ?? []), serviceError.key].join('.')
|
|
79
79
|
const errorMapper = getWithWildcardFallback(normalisedErrorMap, path)
|
|
80
80
|
|
|
81
|
-
if (errorMapper) {
|
|
81
|
+
if (errorMapper != null) {
|
|
82
82
|
const nextServiceError = errorMapper({
|
|
83
83
|
error: serviceError,
|
|
84
84
|
fieldErrors,
|
|
@@ -87,7 +87,7 @@ export const applyErrorMap = (
|
|
|
87
87
|
if (nextServiceError !== serviceError) {
|
|
88
88
|
modified = true
|
|
89
89
|
}
|
|
90
|
-
nextServiceError && nextServiceErrorList.push(nextServiceError)
|
|
90
|
+
(nextServiceError != null) && nextServiceErrorList.push(nextServiceError)
|
|
91
91
|
} else {
|
|
92
92
|
nextServiceErrorList.push(serviceError)
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ export const applyErrorMap = (
|
|
|
95
95
|
return nextServiceErrorList
|
|
96
96
|
}, [])
|
|
97
97
|
|
|
98
|
-
if (onFieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
98
|
+
if ((onFieldErrors != null) && Object.keys(fieldErrors).length > 0) {
|
|
99
99
|
onFieldErrors(fieldErrors)
|
|
100
100
|
}
|
|
101
101
|
|
package/src/Api/PromiseHelper.ts
CHANGED
|
@@ -101,22 +101,22 @@ export const useServiceMutation = <
|
|
|
101
101
|
const attributes = { variables, mutation: mutationDocument, ...memoizedOptions }
|
|
102
102
|
const onFieldErrors = callAttributes?.onFieldErrors ?? memoizedDefaultOnFieldErrors
|
|
103
103
|
const context = calculateContext(mutationDocument, variables)
|
|
104
|
-
exceptionRef.current && removeServiceErrorException(context)
|
|
104
|
+
;(exceptionRef.current != null) && removeServiceErrorException(context)
|
|
105
105
|
exceptionRef.current = null
|
|
106
106
|
const operationName = getName(mutationDocument)
|
|
107
107
|
const mutateWithErrorProcessor: typeof mutate = async (options) => (
|
|
108
|
-
operationPromiseProcessor(mutate(options), {
|
|
108
|
+
await operationPromiseProcessor(mutate(options), {
|
|
109
109
|
operationName,
|
|
110
110
|
context,
|
|
111
111
|
})
|
|
112
112
|
)
|
|
113
113
|
const nextMutate = mutateFactory?.(mutateWithErrorProcessor) ?? mutateWithErrorProcessor
|
|
114
|
-
return operationPromiseProcessor(nextMutate(attributes), {
|
|
114
|
+
return await operationPromiseProcessor(nextMutate(attributes), {
|
|
115
115
|
operationName,
|
|
116
116
|
context,
|
|
117
117
|
})
|
|
118
118
|
.catch(async (serviceErrorException: ServiceErrorException) => {
|
|
119
|
-
if (memoizedErrorMap) {
|
|
119
|
+
if (memoizedErrorMap != null) {
|
|
120
120
|
serviceErrorException.serviceErrorList = applyErrorMap(
|
|
121
121
|
serviceErrorException.serviceErrorList,
|
|
122
122
|
memoizedErrorMap,
|
|
@@ -94,7 +94,7 @@ DATA_PATH extends string
|
|
|
94
94
|
), [queryDocument, memoizedVariables])
|
|
95
95
|
const exception = useMemo(() => {
|
|
96
96
|
const operationName = getName(queryDocument)
|
|
97
|
-
if (memoizedQuery.error) {
|
|
97
|
+
if (memoizedQuery.error != null) {
|
|
98
98
|
const errorList = configManager.config.errorResponseTranslator(memoizedQuery.error, {
|
|
99
99
|
context,
|
|
100
100
|
operationName,
|
|
@@ -109,14 +109,14 @@ DATA_PATH extends string
|
|
|
109
109
|
return null
|
|
110
110
|
}, [context, memoizedQuery, queryDocument])
|
|
111
111
|
useLayoutEffect(() => {
|
|
112
|
-
if (exception &&
|
|
112
|
+
if ((exception != null) && (shownExceptionListRef.current.find(shownException => (
|
|
113
113
|
isServiceErrorListEqual(shownException.serviceErrorList, exception.serviceErrorList)
|
|
114
|
-
))) {
|
|
114
|
+
)) == null)) {
|
|
115
115
|
addServiceErrorException(exception)
|
|
116
116
|
shownExceptionListRef.current.push(exception)
|
|
117
117
|
}
|
|
118
118
|
return () => {
|
|
119
|
-
exception && removeServiceErrorException(context)
|
|
119
|
+
(exception != null) && removeServiceErrorException(context)
|
|
120
120
|
}
|
|
121
121
|
}, [addServiceErrorException, context, exception, memoizedVariables, queryDocument, removeServiceErrorException])
|
|
122
122
|
|