@pristine-ts/validation 0.0.374 → 0.0.376
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/lib/cjs/interceptors/body-validation.request-interceptor.js +7 -2
- package/dist/lib/cjs/interceptors/body-validation.request-interceptor.js.map +1 -1
- package/dist/lib/esm/interceptors/body-validation.request-interceptor.js +7 -2
- package/dist/lib/esm/interceptors/body-validation.request-interceptor.js.map +1 -1
- package/dist/types/interceptors/body-validation.request-interceptor.d.ts +5 -2
- package/package.json +6 -6
|
@@ -41,11 +41,14 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
41
41
|
* It is module scoped to the Validation module so that it is only registered if the validation module is imported.
|
|
42
42
|
* @param loghandler The log handler to output logs.
|
|
43
43
|
* @param validator The validator that validates objects.
|
|
44
|
+
* @param dataMapper
|
|
45
|
+
* @param breadcrumbHandler
|
|
44
46
|
*/
|
|
45
|
-
constructor(loghandler, validator, dataMapper) {
|
|
47
|
+
constructor(loghandler, validator, dataMapper, breadcrumbHandler) {
|
|
46
48
|
this.loghandler = loghandler;
|
|
47
49
|
this.validator = validator;
|
|
48
50
|
this.dataMapper = dataMapper;
|
|
51
|
+
this.breadcrumbHandler = breadcrumbHandler;
|
|
49
52
|
this.priority = networking_1.RequestInterceptorPriorityEnum.BodyMapping - 100;
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
@@ -56,6 +59,7 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
56
59
|
*/
|
|
57
60
|
interceptRequest(request, methodNode) {
|
|
58
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
this.breadcrumbHandler.add(`${validation_module_keyname_1.ValidationModuleKeyname}:body-validation.request-interceptor:enter`, { request, methodNode });
|
|
59
63
|
const bodyValidator = methodNode.route.context[body_validation_decorator_1.bodyValidationMetadataKeyname];
|
|
60
64
|
if (bodyValidator === undefined || bodyValidator.classType === undefined) {
|
|
61
65
|
return request;
|
|
@@ -90,7 +94,8 @@ exports.BodyValidationRequestInterceptor = BodyValidationRequestInterceptor = __
|
|
|
90
94
|
(0, common_1.tag)(common_1.ServiceDefinitionTagEnum.RequestInterceptor),
|
|
91
95
|
(0, tsyringe_1.injectable)(),
|
|
92
96
|
__param(0, (0, tsyringe_1.inject)("LogHandlerInterface")),
|
|
97
|
+
__param(3, (0, tsyringe_1.inject)("BreadcrumbHandlerInterface")),
|
|
93
98
|
__metadata("design:paramtypes", [Object, class_validator_1.Validator,
|
|
94
|
-
data_mapping_common_1.DataMapper])
|
|
99
|
+
data_mapping_common_1.DataMapper, Object])
|
|
95
100
|
], BodyValidationRequestInterceptor);
|
|
96
101
|
//# sourceMappingURL=body-validation.request-interceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-validation.request-interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/body-validation.request-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,kEAAuD;AACvD,wDAA4F;AAC5F,gDAAyF;AACzF,4EAAqE;AACrE,uCAA4C;AAG5C,uFAAsF;AACtF,0EAA4D;AAE5D;;;;GAIG;AAII,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAEzC
|
|
1
|
+
{"version":3,"file":"body-validation.request-interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/body-validation.request-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,kEAAuD;AACvD,wDAA4F;AAC5F,gDAAyF;AACzF,4EAAqE;AACrE,uCAA4C;AAG5C,uFAAsF;AACtF,0EAA4D;AAE5D;;;;GAIG;AAII,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAEzC;;;;;;;;OAQG;IACH,YAA2C,UAAgD,EAC9D,SAAoB,EACpB,UAAsB,EACD,iBAA8D;QAHpD,eAAU,GAAV,UAAU,CAAqB;QAC9D,cAAS,GAAT,SAAS,C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mB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC9D,CAAC;KAAA;CACJ,CAAA;AA7DY,4EAAgC;2CAAhC,gCAAgC;IAH5C,IAAA,qBAAY,EAAC,mDAAuB,CAAC;IACrC,IAAA,YAAG,EAAC,iCAAwB,CAAC,kBAAkB,CAAC;IAChD,IAAA,qBAAU,GAAE;IAYI,WAAA,IAAA,iBAAM,EAAC,qBAAqB,CAAC,CAAA;IAG7B,WAAA,IAAA,iBAAM,EAAC,4BAA4B,CAAC,CAAA;6CAFT,2BAAS;QACR,gCAAU;GAb1C,gCAAgC,CA6D5C"}
|
|
@@ -38,11 +38,14 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
38
38
|
* It is module scoped to the Validation module so that it is only registered if the validation module is imported.
|
|
39
39
|
* @param loghandler The log handler to output logs.
|
|
40
40
|
* @param validator The validator that validates objects.
|
|
41
|
+
* @param dataMapper
|
|
42
|
+
* @param breadcrumbHandler
|
|
41
43
|
*/
|
|
42
|
-
constructor(loghandler, validator, dataMapper) {
|
|
44
|
+
constructor(loghandler, validator, dataMapper, breadcrumbHandler) {
|
|
43
45
|
this.loghandler = loghandler;
|
|
44
46
|
this.validator = validator;
|
|
45
47
|
this.dataMapper = dataMapper;
|
|
48
|
+
this.breadcrumbHandler = breadcrumbHandler;
|
|
46
49
|
this.priority = RequestInterceptorPriorityEnum.BodyMapping - 100;
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
@@ -53,6 +56,7 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
53
56
|
*/
|
|
54
57
|
interceptRequest(request, methodNode) {
|
|
55
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
this.breadcrumbHandler.add(`${ValidationModuleKeyname}:body-validation.request-interceptor:enter`, { request, methodNode });
|
|
56
60
|
const bodyValidator = methodNode.route.context[bodyValidationMetadataKeyname];
|
|
57
61
|
if (bodyValidator === undefined || bodyValidator.classType === undefined) {
|
|
58
62
|
return request;
|
|
@@ -86,8 +90,9 @@ BodyValidationRequestInterceptor = __decorate([
|
|
|
86
90
|
tag(ServiceDefinitionTagEnum.RequestInterceptor),
|
|
87
91
|
injectable(),
|
|
88
92
|
__param(0, inject("LogHandlerInterface")),
|
|
93
|
+
__param(3, inject("BreadcrumbHandlerInterface")),
|
|
89
94
|
__metadata("design:paramtypes", [Object, Validator,
|
|
90
|
-
DataMapper])
|
|
95
|
+
DataMapper, Object])
|
|
91
96
|
], BodyValidationRequestInterceptor);
|
|
92
97
|
export { BodyValidationRequestInterceptor };
|
|
93
98
|
//# sourceMappingURL=body-validation.request-interceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-validation.request-interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/body-validation.request-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAC,mBAAmB,EAAE,8BAA8B,EAAC,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAC,YAAY,EAAE,wBAAwB,EAAE,GAAG,EAAU,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAG5C,OAAO,EAAC,6BAA6B,EAAC,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAE5D;;;;GAIG;AAII,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAEzC
|
|
1
|
+
{"version":3,"file":"body-validation.request-interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/body-validation.request-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAC,m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D;YAC7D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;YAExF,sEAAsE;YACtE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAEzD,IAAG,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;gBACpB,OAAO,OAAO,CAAC;YACnB,CAAC;YAED,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,yDAAyD,EAAE;gBAC7E,OAAO;gBACP,UAAU;gBACV,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC,OAAO;gBACtC,MAAM;gBACN,UAAU;aACb,EAAE,uBAAuB,CAAC,CAAA;YAE3B,6EAA6E;YAC7E,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QAC9D,CAAC;KAAA;CACJ,CAAA;AA7DY,gCAAgC;IAH5C,YAAY,CAAC,uBAAuB,CAAC;IACrC,GAAG,CAAC,wBAAwB,CAAC,kBAAkB,CAAC;IAChD,UAAU,EAAE;IAYI,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAG7B,WAAA,MAAM,CAAC,4BAA4B,CAAC,CAAA;6CAFT,SAAS;QACR,UAAU;GAb1C,gCAAgC,CA6D5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RequestInterceptorInterface, MethodRouterNode } from "@pristine-ts/networking";
|
|
2
2
|
import { Validator } from "@pristine-ts/class-validator";
|
|
3
3
|
import { Request } from "@pristine-ts/common";
|
|
4
|
-
import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
4
|
+
import { BreadcrumbHandlerInterface, LogHandlerInterface } from "@pristine-ts/logging";
|
|
5
5
|
import { DataMapper } from "@pristine-ts/data-mapping-common";
|
|
6
6
|
/**
|
|
7
7
|
* This class is an interceptor to validate the body of an incoming request.
|
|
@@ -12,14 +12,17 @@ export declare class BodyValidationRequestInterceptor implements RequestIntercep
|
|
|
12
12
|
private readonly loghandler;
|
|
13
13
|
private readonly validator;
|
|
14
14
|
private readonly dataMapper;
|
|
15
|
+
private readonly breadcrumbHandler;
|
|
15
16
|
/**
|
|
16
17
|
* This class is an interceptor to validate the body of an incoming request.
|
|
17
18
|
* It is tagged as an RequestInterceptor so it can be automatically injected with the all the other RequestInterceptors.
|
|
18
19
|
* It is module scoped to the Validation module so that it is only registered if the validation module is imported.
|
|
19
20
|
* @param loghandler The log handler to output logs.
|
|
20
21
|
* @param validator The validator that validates objects.
|
|
22
|
+
* @param dataMapper
|
|
23
|
+
* @param breadcrumbHandler
|
|
21
24
|
*/
|
|
22
|
-
constructor(loghandler: LogHandlerInterface, validator: Validator, dataMapper: DataMapper);
|
|
25
|
+
constructor(loghandler: LogHandlerInterface, validator: Validator, dataMapper: DataMapper, breadcrumbHandler: BreadcrumbHandlerInterface);
|
|
23
26
|
priority: number;
|
|
24
27
|
/**
|
|
25
28
|
* Intercepts the request and validates that the body of the request matches the expected class.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pristine-ts/validation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.376",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "dist/lib/esm/validation.module.js",
|
|
6
6
|
"main": "dist/lib/cjs/validation.module.js",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@pristine-ts/class-validator": "^2.0.4",
|
|
16
|
-
"@pristine-ts/common": "^0.0.
|
|
17
|
-
"@pristine-ts/core": "^0.0.
|
|
18
|
-
"@pristine-ts/data-mapping": "^0.0.
|
|
19
|
-
"@pristine-ts/networking": "^0.0.
|
|
16
|
+
"@pristine-ts/common": "^0.0.376",
|
|
17
|
+
"@pristine-ts/core": "^0.0.376",
|
|
18
|
+
"@pristine-ts/data-mapping": "^0.0.376",
|
|
19
|
+
"@pristine-ts/networking": "^0.0.376"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"src/*.{js,ts}"
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "9eb00a46f1ceb476e0006db830a40f8631ff1ddf"
|
|
64
64
|
}
|