@pristine-ts/validation 2.0.3 → 2.0.4
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 +8 -9
- package/dist/lib/cjs/interceptors/body-validation.request-interceptor.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/esm/interceptors/body-validation.request-interceptor.js +10 -11
- package/dist/lib/esm/interceptors/body-validation.request-interceptor.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/interceptors/body-validation.request-interceptor.d.ts +2 -4
- package/package.json +6 -6
|
@@ -19,9 +19,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
19
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
import { BadRequestHttpError, RequestInterceptorPriorityEnum } from "@pristine-ts/networking";
|
|
22
|
+
import { BadRequestHttpError, MethodRouterNode, RequestInterceptorPriorityEnum } from "@pristine-ts/networking";
|
|
23
23
|
import { Validator } from "@pristine-ts/class-validator";
|
|
24
|
-
import { moduleScoped, ServiceDefinitionTagEnum, tag } from "@pristine-ts/common";
|
|
24
|
+
import { moduleScoped, Request, ServiceDefinitionTagEnum, tag, traced } from "@pristine-ts/common";
|
|
25
25
|
import { ValidationModuleKeyname } from "../validation.module.keyname";
|
|
26
26
|
import { inject, injectable } from "tsyringe";
|
|
27
27
|
import { bodyValidationMetadataKeyname } from "../decorators/body-validation.decorator";
|
|
@@ -39,13 +39,11 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
39
39
|
* @param loghandler The log handler to output logs.
|
|
40
40
|
* @param validator The validator that validates objects.
|
|
41
41
|
* @param dataMapper
|
|
42
|
-
* @param breadcrumbHandler
|
|
43
42
|
*/
|
|
44
|
-
constructor(loghandler, validator, dataMapper
|
|
43
|
+
constructor(loghandler, validator, dataMapper) {
|
|
45
44
|
this.loghandler = loghandler;
|
|
46
45
|
this.validator = validator;
|
|
47
46
|
this.dataMapper = dataMapper;
|
|
48
|
-
this.breadcrumbHandler = breadcrumbHandler;
|
|
49
47
|
this.priority = RequestInterceptorPriorityEnum.BodyMapping - 100;
|
|
50
48
|
}
|
|
51
49
|
/**
|
|
@@ -56,10 +54,6 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
56
54
|
*/
|
|
57
55
|
interceptRequest(request, methodNode) {
|
|
58
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
this.breadcrumbHandler.add(request.id, `${ValidationModuleKeyname}:body-validation.request-interceptor:enter`, {
|
|
60
|
-
request,
|
|
61
|
-
methodNode
|
|
62
|
-
});
|
|
63
57
|
const bodyValidator = methodNode.route.context[bodyValidationMetadataKeyname];
|
|
64
58
|
if (bodyValidator === undefined || bodyValidator.classType === undefined) {
|
|
65
59
|
return request;
|
|
@@ -93,14 +87,19 @@ let BodyValidationRequestInterceptor = class BodyValidationRequestInterceptor {
|
|
|
93
87
|
});
|
|
94
88
|
}
|
|
95
89
|
};
|
|
90
|
+
__decorate([
|
|
91
|
+
traced(),
|
|
92
|
+
__metadata("design:type", Function),
|
|
93
|
+
__metadata("design:paramtypes", [Request, MethodRouterNode]),
|
|
94
|
+
__metadata("design:returntype", Promise)
|
|
95
|
+
], BodyValidationRequestInterceptor.prototype, "interceptRequest", null);
|
|
96
96
|
BodyValidationRequestInterceptor = __decorate([
|
|
97
97
|
moduleScoped(ValidationModuleKeyname),
|
|
98
98
|
tag(ServiceDefinitionTagEnum.RequestInterceptor),
|
|
99
99
|
injectable(),
|
|
100
100
|
__param(0, inject("LogHandlerInterface")),
|
|
101
|
-
__param(3, inject("BreadcrumbHandlerInterface")),
|
|
102
101
|
__metadata("design:paramtypes", [Object, Validator,
|
|
103
|
-
DataMapper
|
|
102
|
+
DataMapper])
|
|
104
103
|
], BodyValidationRequestInterceptor);
|
|
105
104
|
export { BodyValidationRequestInterceptor };
|
|
106
105
|
//# 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":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"body-validation.request-interceptor.js","sourceRoot":"","sources":["../../../../src/interceptors/body-validation.request-interceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAEhB,8BAA8B,EAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAC,YAAY,EAAE,OAAO,EAAE,wBAAwB,EAAE,GAAG,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAC,6BAA6B,EAAC,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAC,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAE5D;;;;GAIG;AAII,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAI3C;;;;;;;OAOG;IACH,YAA2C,UAAgD,EAC9D,SAAoB,EACpB,UAAsB;QAFS,eAAU,GAAV,UAAU,CAAqB;QAC9D,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;QAZnD,aAAQ,GAAG,8BAA8B,CAAC,WAAW,GAAG,GAAG,CAAC;IAc5D,CAAC;IAED;;;;;OAKG;IAEG,gBAAgB,CAAC,OAAgB,EAAE,UAA4B;;YACnE,MAAM,aAAa,GAAG,UAA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