drapcode-utility 1.8.5 → 1.8.6
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.
|
@@ -54,6 +54,7 @@ var voca_1 = __importDefault(require("voca"));
|
|
|
54
54
|
var checkForError = function (result, errors, mapping, status) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
55
|
var finalErrors, errorMsgPath, errorValue, fError, finalFinalStatus_1, finalMessage, finalMessages_1;
|
|
56
56
|
return __generator(this, function (_a) {
|
|
57
|
+
console.log("\n ==result", result);
|
|
57
58
|
finalErrors = [];
|
|
58
59
|
console.log("errors", errors);
|
|
59
60
|
if (errors && errors.length > 0) {
|
|
@@ -79,10 +80,7 @@ var checkForError = function (result, errors, mapping, status) { return __awaite
|
|
|
79
80
|
}
|
|
80
81
|
console.log("finalErrors", finalErrors);
|
|
81
82
|
if (finalErrors.length > 0) {
|
|
82
|
-
finalErrors =
|
|
83
|
-
"".concat(Number(err.status), "|").concat(err.message),
|
|
84
|
-
{ status: Number(err.status), message: err.message },
|
|
85
|
-
]; })).values());
|
|
83
|
+
finalErrors = removeDuplicateError(finalErrors);
|
|
86
84
|
finalFinalStatus_1 = 400;
|
|
87
85
|
finalMessage = "";
|
|
88
86
|
console.log("finalMessage", finalMessage);
|
|
@@ -111,6 +109,11 @@ var checkForError = function (result, errors, mapping, status) { return __awaite
|
|
|
111
109
|
});
|
|
112
110
|
}); };
|
|
113
111
|
exports.checkForError = checkForError;
|
|
112
|
+
var removeDuplicateError = function (finalErrors) {
|
|
113
|
+
// Remove duplicates based only on the message
|
|
114
|
+
var uniqueErrors = Array.from(new Map(finalErrors.map(function (err) { return [err.message.trim(), err]; })).values());
|
|
115
|
+
return uniqueErrors;
|
|
116
|
+
};
|
|
114
117
|
var handleMultErrorConfig = function (error, result, status) {
|
|
115
118
|
if (!error || Object.keys(error).length === 0) {
|
|
116
119
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drapcode-utility",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"@types/voca": "^1.4.2",
|
|
38
38
|
"axios": "^1.1.2",
|
|
39
39
|
"dompurify": "^3.1.7",
|
|
40
|
-
"drapcode-constant": "^1.6.
|
|
41
|
-
"drapcode-logger": "^1.3.
|
|
42
|
-
"drapcode-redis": "^1.
|
|
40
|
+
"drapcode-constant": "^1.6.5",
|
|
41
|
+
"drapcode-logger": "^1.3.1",
|
|
42
|
+
"drapcode-redis": "^1.2.0",
|
|
43
43
|
"exiftool-vendored": "^28.2.1",
|
|
44
44
|
"express": "^4.17.1",
|
|
45
45
|
"gm": "^1.25.0",
|