@apipass/common 0.0.18-alpha.0 → 0.0.20-alpha.0

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.
@@ -0,0 +1,4 @@
1
+ import { ValidationPipe } from '@nestjs/common';
2
+ export declare class ClassValidatorPipe {
3
+ static getValidationPipe(): ValidationPipe;
4
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClassValidatorPipe = void 0;
4
+ const common_1 = require("@nestjs/common");
5
+ const _ = require("lodash");
6
+ class ClassValidatorPipe {
7
+ static getValidationPipe() {
8
+ return new common_1.ValidationPipe({ transform: true, exceptionFactory: (errors) => {
9
+ const exceptions = [];
10
+ errors.forEach(error => {
11
+ for (const key of Object.keys(error.constraints)) {
12
+ exceptions.push({
13
+ code: _.snakeCase(key).toUpperCase(),
14
+ message: error.constraints[key],
15
+ });
16
+ }
17
+ });
18
+ return new common_1.BadRequestException(exceptions);
19
+ } });
20
+ }
21
+ }
22
+ exports.ClassValidatorPipe = ClassValidatorPipe;
23
+ //# sourceMappingURL=class-validator.pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-validator.pipe.js","sourceRoot":"","sources":["../../src/class-validator/class-validator.pipe.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AACrE,4BAA2B;AAE3B,MAAa,kBAAkB;IAEpB,MAAM,CAAC,iBAAiB;QAC3B,OAAO,IAAI,uBAAc,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,MAAa,EAAE,EAAE;gBAC7E,MAAM,UAAU,GAAQ,EAAE,CAAC;gBAC3B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;wBAChD,UAAU,CAAC,IAAI,CAAC;4BACd,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;4BACpC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;yBAChC,CAAC,CAAA;qBACH;gBACH,CAAC,CAAC,CAAC;gBACH,OAAO,IAAI,4BAAmB,CAAC,UAAU,CAAC,CAAC;YAC7C,CAAC,EAAC,CACH,CAAA;IACL,CAAC;CAEJ;AAlBD,gDAkBC"}
@@ -1,4 +1,4 @@
1
- declare type Either<S, F> = Success<S, F> | Failure<S, F>;
1
+ type Either<S, F> = Success<S, F> | Failure<S, F>;
2
2
  export declare class Success<S, F> {
3
3
  readonly value: S;
4
4
  constructor(value: S);
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"either.js","sourceRoot":"","sources":["../../src/either/either.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAGlB,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAdD,0BAcC;AAED,MAAM,OAAO;IAGX,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAEM,MAAM,OAAO,GAAG,CAAO,CAAI,EAAgB,EAAE;IAClD,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEK,MAAM,OAAO,GAAG,CAAO,CAAI,EAAgB,EAAE;IAClD,OAAO,IAAI,OAAO,CAAO,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB"}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './environment/environment';
2
- export * from './environment/either';
2
+ export * from './either/either';
3
+ export * from './class-validator/class-validator.pipe';
package/lib/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./environment/environment"), exports);
18
- __exportStar(require("./environment/either"), exports);
18
+ __exportStar(require("./either/either"), exports);
19
+ __exportStar(require("./class-validator/class-validator.pipe"), exports);
19
20
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,kDAAgC;AAChC,yEAAuD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/common",
3
- "version": "0.0.18-alpha.0",
3
+ "version": "0.0.20-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Nathan Lemos <nathan@apipass.com.br>",
6
6
  "license": "ISC",
@@ -9,9 +9,6 @@
9
9
  "directories": {
10
10
  "lib": "lib"
11
11
  },
12
- "devDependencies": {
13
- "tunnel-ssh": "4.1.6"
14
- },
15
12
  "files": [
16
13
  "lib"
17
14
  ],
@@ -21,5 +18,14 @@
21
18
  "scripts": {
22
19
  "tsc": "tsc"
23
20
  },
24
- "gitHead": "a851238bd4d94c177138606b644a303dcccf9966"
21
+ "dependencies": {
22
+ "@nestjs/class-validator": "0.13.1",
23
+ "@nestjs/common": "9.2.1",
24
+ "lodash": "^4.17.21"
25
+ },
26
+ "devDependencies": {
27
+ "@types/lodash": "^4.14.191",
28
+ "tunnel-ssh": "4.1.6"
29
+ },
30
+ "gitHead": "c4c075c8fdd09dbac48fcc55c2b787f9a0db2445"
25
31
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"either.js","sourceRoot":"","sources":["../../src/environment/either.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IAGlB,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAdD,0BAcC;AAED,MAAM,OAAO;IAGX,YAAY,KAAQ;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAEM,MAAM,OAAO,GAAG,CAAO,CAAI,EAAgB,EAAE;IAClD,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB;AAEK,MAAM,OAAO,GAAG,CAAO,CAAI,EAAgB,EAAE;IAClD,OAAO,IAAI,OAAO,CAAO,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC;AAFW,QAAA,OAAO,WAElB"}