@adtrackify/at-service-common 2.0.25 → 2.0.26
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/cjs/helpers/input-validation-helper.d.ts +1 -0
- package/dist/cjs/helpers/input-validation-helper.js +4 -3
- package/dist/cjs/helpers/input-validation-helper.js.map +1 -1
- package/dist/esm/helpers/input-validation-helper.d.ts +1 -0
- package/dist/esm/helpers/input-validation-helper.js +3 -2
- package/dist/esm/helpers/input-validation-helper.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateInput = void 0;
|
|
3
|
+
exports.validateAndTransformInput = exports.validateInput = void 0;
|
|
4
4
|
const logging_helper_js_1 = require("./logging-helper.js");
|
|
5
5
|
const http_error_js_1 = require("../libs/http-error.js");
|
|
6
6
|
const validateInput = (schema, input) => {
|
|
@@ -8,11 +8,11 @@ const validateInput = (schema, input) => {
|
|
|
8
8
|
if (error) {
|
|
9
9
|
logging_helper_js_1.Logger.info('', { error });
|
|
10
10
|
const httperr = http_error_js_1.HttpError.badRequest('Bad Request', {
|
|
11
|
-
errors: error.details.map(detail => ({
|
|
11
|
+
errors: error.details.map((detail) => ({
|
|
12
12
|
message: detail?.message,
|
|
13
13
|
key: detail?.context?.key,
|
|
14
14
|
path: detail?.path,
|
|
15
|
-
}))
|
|
15
|
+
})),
|
|
16
16
|
});
|
|
17
17
|
logging_helper_js_1.Logger.error('validation failure', { httperr });
|
|
18
18
|
throw httperr;
|
|
@@ -20,4 +20,5 @@ const validateInput = (schema, input) => {
|
|
|
20
20
|
return value;
|
|
21
21
|
};
|
|
22
22
|
exports.validateInput = validateInput;
|
|
23
|
+
exports.validateAndTransformInput = exports.validateInput;
|
|
23
24
|
//# sourceMappingURL=input-validation-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-validation-helper.js","sourceRoot":"","sources":["../../../src/helpers/input-validation-helper.ts"],"names":[],"mappings":";;;AACA,2DAA6C;AAC7C,yDAAkD;AAE3C,MAAM,aAAa,GAAG,CAAC,MAA6B,EAAE,KAAU,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,KAAK,EAAE;QACT,0BAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAE3B,MAAM,OAAO,GAAG,yBAAS,CAAC,UAAU,CAAC,aAAa,EAAE;YAClD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"input-validation-helper.js","sourceRoot":"","sources":["../../../src/helpers/input-validation-helper.ts"],"names":[],"mappings":";;;AACA,2DAA6C;AAC7C,yDAAkD;AAE3C,MAAM,aAAa,GAAG,CAAC,MAA6B,EAAE,KAAU,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,KAAK,EAAE;QACT,0BAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAE3B,MAAM,OAAO,GAAG,yBAAS,CAAC,UAAU,CAAC,aAAa,EAAE;YAClD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACrC,OAAO,EAAE,MAAM,EAAE,OAAO;gBACxB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;gBACzB,IAAI,EAAE,MAAM,EAAE,IAAI;aACnB,CAAC,CAAC;SACJ,CAAC,CAAC;QAEH,0BAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAjBW,QAAA,aAAa,iBAiBxB;AAEW,QAAA,yBAAyB,GAAG,qBAAa,CAAC"}
|
|
@@ -5,15 +5,16 @@ export const validateInput = (schema, input) => {
|
|
|
5
5
|
if (error) {
|
|
6
6
|
Logger.info('', { error });
|
|
7
7
|
const httperr = HttpError.badRequest('Bad Request', {
|
|
8
|
-
errors: error.details.map(detail => ({
|
|
8
|
+
errors: error.details.map((detail) => ({
|
|
9
9
|
message: detail?.message,
|
|
10
10
|
key: detail?.context?.key,
|
|
11
11
|
path: detail?.path,
|
|
12
|
-
}))
|
|
12
|
+
})),
|
|
13
13
|
});
|
|
14
14
|
Logger.error('validation failure', { httperr });
|
|
15
15
|
throw httperr;
|
|
16
16
|
}
|
|
17
17
|
return value;
|
|
18
18
|
};
|
|
19
|
+
export const validateAndTransformInput = validateInput;
|
|
19
20
|
//# sourceMappingURL=input-validation-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-validation-helper.js","sourceRoot":"","sources":["../../../src/helpers/input-validation-helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAA6B,EAAE,KAAU,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,KAAK,EAAE;QACT,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAE3B,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,aAAa,EAAE;YAClD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"input-validation-helper.js","sourceRoot":"","sources":["../../../src/helpers/input-validation-helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAA6B,EAAE,KAAU,EAAE,EAAE;IACzE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,KAAK,EAAE;QACT,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAE3B,MAAM,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,aAAa,EAAE;YAClD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACrC,OAAO,EAAE,MAAM,EAAE,OAAO;gBACxB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;gBACzB,IAAI,EAAE,MAAM,EAAE,IAAI;aACnB,CAAC,CAAC;SACJ,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,MAAM,OAAO,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adtrackify/at-service-common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.26",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*"
|
|
@@ -105,4 +105,4 @@
|
|
|
105
105
|
"author": "",
|
|
106
106
|
"license": "ISC",
|
|
107
107
|
"homepage": "https://bitbucket.org/eacap/at-service-common#readme"
|
|
108
|
-
}
|
|
108
|
+
}
|