@apipass/common 0.0.20-alpha.0 → 0.0.22-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 APIPASSValidationPipe extends ValidationPipe {
3
+ constructor();
4
+ }
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClassValidatorPipe = void 0;
3
+ exports.APIPASSValidationPipe = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const _ = require("lodash");
6
- class ClassValidatorPipe {
7
- static getValidationPipe() {
8
- return new common_1.ValidationPipe({ transform: true, exceptionFactory: (errors) => {
6
+ class APIPASSValidationPipe extends common_1.ValidationPipe {
7
+ constructor() {
8
+ super({
9
+ transform: true,
10
+ exceptionFactory: (errors) => {
9
11
  const exceptions = [];
10
12
  errors.forEach(error => {
11
13
  for (const key of Object.keys(error.constraints)) {
@@ -16,8 +18,9 @@ class ClassValidatorPipe {
16
18
  }
17
19
  });
18
20
  return new common_1.BadRequestException(exceptions);
19
- } });
21
+ }
22
+ });
20
23
  }
21
24
  }
22
- exports.ClassValidatorPipe = ClassValidatorPipe;
23
- //# sourceMappingURL=class-validator.pipe.js.map
25
+ exports.APIPASSValidationPipe = APIPASSValidationPipe;
26
+ //# sourceMappingURL=apipass-validation-pipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apipass-validation-pipe.js","sourceRoot":"","sources":["../../src/class-validator/apipass-validation-pipe.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AACrE,4BAA2B;AAE3B,MAAa,qBAAsB,SAAQ,uBAAc;IACvD;QACE,KAAK,CAAC;YACJ,SAAS,EAAE,IAAI;YACf,gBAAgB,EAAE,CAAC,MAAa,EAAE,EAAE;gBAClC,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;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAlBD,sDAkBC"}
@@ -1,11 +1,11 @@
1
- type Either<S, F> = Success<S, F> | Failure<S, F>;
1
+ export 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);
5
5
  isSuccess(): this is Success<S, F>;
6
6
  isFailure(): this is Failure<S, F>;
7
7
  }
8
- declare class Failure<S, F> {
8
+ export declare class Failure<S, F> {
9
9
  readonly value: F;
10
10
  constructor(value: F);
11
11
  isSuccess(): this is Success<S, F>;
@@ -13,4 +13,3 @@ declare class Failure<S, F> {
13
13
  }
14
14
  export declare const success: <S, F>(l: S) => Either<S, F>;
15
15
  export declare const failure: <S, F>(a: F) => Either<S, F>;
16
- export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.failure = exports.success = exports.Success = void 0;
3
+ exports.failure = exports.success = exports.Failure = exports.Success = void 0;
4
4
  class Success {
5
5
  constructor(value) {
6
6
  this.value = value;
@@ -24,6 +24,7 @@ class Failure {
24
24
  return true;
25
25
  }
26
26
  }
27
+ exports.Failure = Failure;
27
28
  const success = (l) => {
28
29
  return new Success(l);
29
30
  };
@@ -1 +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"}
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,MAAa,OAAO;IAGlB,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;AAdD,0BAcC;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,3 +1,3 @@
1
1
  export * from './environment/environment';
2
2
  export * from './either/either';
3
- export * from './class-validator/class-validator.pipe';
3
+ export * from './class-validator/apipass-validation-pipe';
package/lib/index.js CHANGED
@@ -16,5 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./environment/environment"), exports);
18
18
  __exportStar(require("./either/either"), exports);
19
- __exportStar(require("./class-validator/class-validator.pipe"), exports);
19
+ __exportStar(require("./class-validator/apipass-validation-pipe"), exports);
20
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,kDAAgC;AAChC,yEAAuD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,kDAAgC;AAChC,4EAA0D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/common",
3
- "version": "0.0.20-alpha.0",
3
+ "version": "0.0.22-alpha.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Nathan Lemos <nathan@apipass.com.br>",
6
6
  "license": "ISC",
@@ -19,7 +19,7 @@
19
19
  "tsc": "tsc"
20
20
  },
21
21
  "dependencies": {
22
- "@nestjs/class-validator": "0.13.1",
22
+ "@nestjs/class-validator": "0.13.4",
23
23
  "@nestjs/common": "9.2.1",
24
24
  "lodash": "^4.17.21"
25
25
  },
@@ -27,5 +27,5 @@
27
27
  "@types/lodash": "^4.14.191",
28
28
  "tunnel-ssh": "4.1.6"
29
29
  },
30
- "gitHead": "c4c075c8fdd09dbac48fcc55c2b787f9a0db2445"
30
+ "gitHead": "c31761d00db27aa4d3e28a6d82e6c7cce321708e"
31
31
  }
@@ -1,4 +0,0 @@
1
- import { ValidationPipe } from '@nestjs/common';
2
- export declare class ClassValidatorPipe {
3
- static getValidationPipe(): ValidationPipe;
4
- }
@@ -1 +0,0 @@
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"}