@senhainfo/shared-utils 1.0.10 → 1.0.12

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.
Files changed (45) hide show
  1. package/lib/exceptions/bad-request-exception.d.ts +5 -0
  2. package/lib/exceptions/bad-request-exception.d.ts.map +1 -0
  3. package/lib/exceptions/bad-request-exception.js +12 -0
  4. package/lib/exceptions/bad-request-exception.js.map +1 -0
  5. package/lib/exceptions/bad-request.d.ts +5 -0
  6. package/lib/exceptions/bad-request.d.ts.map +1 -0
  7. package/lib/exceptions/bad-request.js +12 -0
  8. package/lib/exceptions/bad-request.js.map +1 -0
  9. package/lib/exceptions/forbidden-exception.d.ts +5 -0
  10. package/lib/exceptions/forbidden-exception.d.ts.map +1 -0
  11. package/lib/exceptions/forbidden-exception.js +12 -0
  12. package/lib/exceptions/forbidden-exception.js.map +1 -0
  13. package/lib/exceptions/inactive-exception.d.ts +5 -0
  14. package/lib/exceptions/inactive-exception.d.ts.map +1 -0
  15. package/lib/exceptions/inactive-exception.js +12 -0
  16. package/lib/exceptions/inactive-exception.js.map +1 -0
  17. package/lib/exceptions/index.d.ts +8 -6
  18. package/lib/exceptions/index.d.ts.map +1 -1
  19. package/lib/exceptions/index.js +8 -6
  20. package/lib/exceptions/index.js.map +1 -1
  21. package/lib/exceptions/invalid-credentials-exception.d.ts +5 -0
  22. package/lib/exceptions/invalid-credentials-exception.d.ts.map +1 -0
  23. package/lib/exceptions/invalid-credentials-exception.js +11 -0
  24. package/lib/exceptions/invalid-credentials-exception.js.map +1 -0
  25. package/lib/exceptions/invalid-token-exception.d.ts +5 -0
  26. package/lib/exceptions/invalid-token-exception.d.ts.map +1 -0
  27. package/lib/exceptions/invalid-token-exception.js +12 -0
  28. package/lib/exceptions/invalid-token-exception.js.map +1 -0
  29. package/lib/exceptions/missing-token-exception.d.ts +5 -0
  30. package/lib/exceptions/missing-token-exception.d.ts.map +1 -0
  31. package/lib/exceptions/missing-token-exception.js +12 -0
  32. package/lib/exceptions/missing-token-exception.js.map +1 -0
  33. package/lib/exceptions/not-found-exception.d.ts +5 -0
  34. package/lib/exceptions/not-found-exception.d.ts.map +1 -0
  35. package/lib/exceptions/not-found-exception.js +12 -0
  36. package/lib/exceptions/not-found-exception.js.map +1 -0
  37. package/lib/exceptions/unavailable-stock-exception.d.ts +5 -0
  38. package/lib/exceptions/unavailable-stock-exception.d.ts.map +1 -0
  39. package/lib/exceptions/unavailable-stock-exception.js +11 -0
  40. package/lib/exceptions/unavailable-stock-exception.js.map +1 -0
  41. package/lib/handle-jwt-token.d.ts +22 -0
  42. package/lib/handle-jwt-token.d.ts.map +1 -0
  43. package/lib/handle-jwt-token.js +30 -0
  44. package/lib/handle-jwt-token.js.map +1 -0
  45. package/package.json +2 -1
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class BadRequestException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=bad-request-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bad-request-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/bad-request-exception.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,OAAO,SAAiC,EAAE,OAAO,CAAC,EAAE,MAAM;CAGvE"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class BadRequestException extends app_exception_1.AppException {
7
+ constructor(message = "Erro ao processar requisição", details) {
8
+ super(app_exception_1.AppExceptionEnum.BAD_REQUEST, message, http_status_enum_1.HttpStatusCodes.BAD_REQUEST, details);
9
+ }
10
+ }
11
+ exports.BadRequestException = BadRequestException;
12
+ //# sourceMappingURL=bad-request-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bad-request-exception.js","sourceRoot":"","sources":["../../src/exceptions/bad-request-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,mBAAoB,SAAQ,4BAAY;IACnD,YAAY,OAAO,GAAG,8BAA8B,EAAE,OAAgB;QACpE,KAAK,CAAC,gCAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,kCAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;CACF;AAJD,kDAIC"}
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class BadRequestException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=bad-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bad-request.d.ts","sourceRoot":"","sources":["../../src/exceptions/bad-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,OAAO,SAAiC,EAAE,OAAO,CAAC,EAAE,MAAM;CAGvE"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class BadRequestException extends app_exception_1.AppException {
7
+ constructor(message = "Erro ao processar requisição", details) {
8
+ super(app_exception_1.AppExceptionEnum.BAD_REQUEST, message, http_status_enum_1.HttpStatusCodes.BAD_REQUEST, details);
9
+ }
10
+ }
11
+ exports.BadRequestException = BadRequestException;
12
+ //# sourceMappingURL=bad-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bad-request.js","sourceRoot":"","sources":["../../src/exceptions/bad-request.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,mBAAoB,SAAQ,4BAAY;IACnD,YAAY,OAAO,GAAG,8BAA8B,EAAE,OAAgB;QACpE,KAAK,CAAC,gCAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,kCAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;CACF;AAJD,kDAIC"}
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class ForbiddenException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=forbidden-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidden-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/forbidden-exception.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,kBAAmB,SAAQ,YAAY;gBACtC,OAAO,SAA4C,EAAE,OAAO,CAAC,EAAE,MAAM;CAGlF"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class ForbiddenException extends app_exception_1.AppException {
7
+ constructor(message = "Sem permissão para acessar este recurso", details) {
8
+ super(app_exception_1.AppExceptionEnum.FORBIDDEN, message, http_status_enum_1.HttpStatusCodes.FORBIDDEN, details);
9
+ }
10
+ }
11
+ exports.ForbiddenException = ForbiddenException;
12
+ //# sourceMappingURL=forbidden-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidden-exception.js","sourceRoot":"","sources":["../../src/exceptions/forbidden-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD,mDAAiE;AAEjE,MAAa,kBAAmB,SAAQ,4BAAY;IAClD,YAAY,OAAO,GAAG,yCAAyC,EAAE,OAAgB;QAC/E,KAAK,CAAC,gCAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,kCAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;CACF;AAJD,gDAIC"}
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class InactiveException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=inactive-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inactive-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/inactive-exception.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,SAAY,EAAE,OAAO,CAAC,EAAE,MAAM;CAGlD"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InactiveException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class InactiveException extends app_exception_1.AppException {
7
+ constructor(message = "Inativo", details) {
8
+ super(app_exception_1.AppExceptionEnum.INACTIVE, message, http_status_enum_1.HttpStatusCodes.FORBIDDEN, details);
9
+ }
10
+ }
11
+ exports.InactiveException = InactiveException;
12
+ //# sourceMappingURL=inactive-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inactive-exception.js","sourceRoot":"","sources":["../../src/exceptions/inactive-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AAEtD,mDAAiE;AAEjE,MAAa,iBAAkB,SAAQ,4BAAY;IACjD,YAAY,OAAO,GAAG,SAAS,EAAE,OAAgB;QAC/C,KAAK,CAAC,gCAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,kCAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChF,CAAC;CACF;AAJD,8CAIC"}
@@ -1,9 +1,11 @@
1
1
  export * from "./app-exception";
2
- export * from "./forbidden";
3
- export * from "./inactive";
4
- export * from "./invalid-credentials";
5
- export * from "./invalid-token";
6
- export * from "./missing-token";
7
- export * from "./not-found";
2
+ export * from "./bad-request-exception";
3
+ export * from "./forbidden-exception";
4
+ export * from "./inactive-exception";
5
+ export * from "./invalid-credentials-exception";
6
+ export * from "./invalid-token-exception";
7
+ export * from "./missing-token-exception";
8
+ export * from "./not-found-exception";
8
9
  export * from "./unauthorized-exception";
10
+ export * from "./unavailable-stock-exception";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC"}
@@ -15,11 +15,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./app-exception"), exports);
18
- __exportStar(require("./forbidden"), exports);
19
- __exportStar(require("./inactive"), exports);
20
- __exportStar(require("./invalid-credentials"), exports);
21
- __exportStar(require("./invalid-token"), exports);
22
- __exportStar(require("./missing-token"), exports);
23
- __exportStar(require("./not-found"), exports);
18
+ __exportStar(require("./bad-request-exception"), exports);
19
+ __exportStar(require("./forbidden-exception"), exports);
20
+ __exportStar(require("./inactive-exception"), exports);
21
+ __exportStar(require("./invalid-credentials-exception"), exports);
22
+ __exportStar(require("./invalid-token-exception"), exports);
23
+ __exportStar(require("./missing-token-exception"), exports);
24
+ __exportStar(require("./not-found-exception"), exports);
24
25
  __exportStar(require("./unauthorized-exception"), exports);
26
+ __exportStar(require("./unavailable-stock-exception"), exports);
25
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,8CAA4B;AAC5B,6CAA2B;AAC3B,wDAAsC;AACtC,kDAAgC;AAChC,kDAAgC;AAChC,8CAA4B;AAC5B,2DAAyC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,uDAAqC;AACrC,kEAAgD;AAChD,4DAA0C;AAC1C,4DAA0C;AAC1C,wDAAsC;AACtC,2DAAyC;AACzC,gEAA8C"}
@@ -0,0 +1,5 @@
1
+ import { UnauthorizedException } from "./unauthorized-exception";
2
+ export declare class InvalidCredentialsException extends UnauthorizedException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=invalid-credentials-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-credentials-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/invalid-credentials-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,qBAAa,2BAA4B,SAAQ,qBAAqB;gBACxD,OAAO,SAAgC,EAAE,OAAO,CAAC,EAAE,MAAM;CAGtE"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidCredentialsException = void 0;
4
+ const unauthorized_exception_1 = require("./unauthorized-exception");
5
+ class InvalidCredentialsException extends unauthorized_exception_1.UnauthorizedException {
6
+ constructor(message = "Usuário ou senha incorretos", details) {
7
+ super(message, details);
8
+ }
9
+ }
10
+ exports.InvalidCredentialsException = InvalidCredentialsException;
11
+ //# sourceMappingURL=invalid-credentials-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-credentials-exception.js","sourceRoot":"","sources":["../../src/exceptions/invalid-credentials-exception.ts"],"names":[],"mappings":";;;AAAA,qEAAiE;AAEjE,MAAa,2BAA4B,SAAQ,8CAAqB;IACpE,YAAY,OAAO,GAAG,6BAA6B,EAAE,OAAgB;QACnE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF;AAJD,kEAIC"}
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class InvalidTokenException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=invalid-token-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-token-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/invalid-token-exception.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,OAAO,SAA+C,EAAE,OAAO,CAAC,EAAE,MAAM;CAGrF"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidTokenException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class InvalidTokenException extends app_exception_1.AppException {
7
+ constructor(message = "Token de acesso inválido, tente novamente!", details) {
8
+ super(app_exception_1.AppExceptionEnum.INVALID_TOKEN, message, http_status_enum_1.HttpStatusCodes.UNAUTHORIZED, details);
9
+ }
10
+ }
11
+ exports.InvalidTokenException = InvalidTokenException;
12
+ //# sourceMappingURL=invalid-token-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-token-exception.js","sourceRoot":"","sources":["../../src/exceptions/invalid-token-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,OAAO,GAAG,4CAA4C,EAAE,OAAgB;QAClF,KAAK,CAAC,gCAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,kCAAe,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;CACF;AAJD,sDAIC"}
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class MissingTokenException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=missing-token-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missing-token-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/missing-token-exception.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,qBAAsB,SAAQ,YAAY;gBACzC,OAAO,SAAkC,EAAE,OAAO,CAAC,EAAE,MAAM;CAGxE"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MissingTokenException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class MissingTokenException extends app_exception_1.AppException {
7
+ constructor(message = "Token de acesso não informado", details) {
8
+ super(app_exception_1.AppExceptionEnum.MISSING_TOKEN, message, http_status_enum_1.HttpStatusCodes.UNAUTHORIZED, details);
9
+ }
10
+ }
11
+ exports.MissingTokenException = MissingTokenException;
12
+ //# sourceMappingURL=missing-token-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"missing-token-exception.js","sourceRoot":"","sources":["../../src/exceptions/missing-token-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,qBAAsB,SAAQ,4BAAY;IACrD,YAAY,OAAO,GAAG,+BAA+B,EAAE,OAAgB;QACrE,KAAK,CAAC,gCAAgB,CAAC,aAAa,EAAE,OAAO,EAAE,kCAAe,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;CACF;AAJD,sDAIC"}
@@ -0,0 +1,5 @@
1
+ import { AppException } from "./app-exception";
2
+ export declare class NotFoundException extends AppException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=not-found-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/not-found-exception.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC;AAEjE,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,SAAmB,EAAE,OAAO,CAAC,EAAE,MAAM;CAGzD"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotFoundException = void 0;
4
+ const http_status_enum_1 = require("../http-status-enum");
5
+ const app_exception_1 = require("./app-exception");
6
+ class NotFoundException extends app_exception_1.AppException {
7
+ constructor(message = "Não encontrado", details) {
8
+ super(app_exception_1.AppExceptionEnum.NOT_FOUND, message, http_status_enum_1.HttpStatusCodes.NOT_FOUND, details);
9
+ }
10
+ }
11
+ exports.NotFoundException = NotFoundException;
12
+ //# sourceMappingURL=not-found-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found-exception.js","sourceRoot":"","sources":["../../src/exceptions/not-found-exception.ts"],"names":[],"mappings":";;;AAAA,0DAAsD;AACtD,mDAAiE;AAEjE,MAAa,iBAAkB,SAAQ,4BAAY;IACjD,YAAY,OAAO,GAAG,gBAAgB,EAAE,OAAgB;QACtD,KAAK,CAAC,gCAAgB,CAAC,SAAS,EAAE,OAAO,EAAE,kCAAe,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;CACF;AAJD,8CAIC"}
@@ -0,0 +1,5 @@
1
+ import { BadRequestException } from "./bad-request-exception";
2
+ export declare class UnavailableStockException extends BadRequestException {
3
+ constructor(message?: string, details?: object);
4
+ }
5
+ //# sourceMappingURL=unavailable-stock-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unavailable-stock-exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/unavailable-stock-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,qBAAa,yBAA0B,SAAQ,mBAAmB;gBACpD,OAAO,SAAyB,EAAE,OAAO,CAAC,EAAE,MAAM;CAG/D"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnavailableStockException = void 0;
4
+ const bad_request_exception_1 = require("./bad-request-exception");
5
+ class UnavailableStockException extends bad_request_exception_1.BadRequestException {
6
+ constructor(message = "Estoque indisponível", details) {
7
+ super(message, details);
8
+ }
9
+ }
10
+ exports.UnavailableStockException = UnavailableStockException;
11
+ //# sourceMappingURL=unavailable-stock-exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unavailable-stock-exception.js","sourceRoot":"","sources":["../../src/exceptions/unavailable-stock-exception.ts"],"names":[],"mappings":";;;AAAA,mEAA8D;AAE9D,MAAa,yBAA0B,SAAQ,2CAAmB;IAChE,YAAY,OAAO,GAAG,sBAAsB,EAAE,OAAgB;QAC5D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC;CACF;AAJD,8DAIC"}
@@ -0,0 +1,22 @@
1
+ import jwt, { JwtPayload, SignOptions } from "jsonwebtoken";
2
+ interface TokenData {
3
+ userId: number;
4
+ }
5
+ type TokenType = "access" | "refresh";
6
+ interface GenerateTokenProps {
7
+ payload: JwtPayload;
8
+ options?: SignOptions & {
9
+ type?: TokenType;
10
+ };
11
+ }
12
+ export declare class HandleJwtToken {
13
+ private jwtSecretKey;
14
+ private jwtRefreshSecretKey;
15
+ constructor(jwtSecretKey: string, jwtRefreshSecretKey: string);
16
+ private getSecret;
17
+ generate({ payload, options }: GenerateTokenProps): string;
18
+ verify(token: string, type?: TokenType): JwtPayload & TokenData;
19
+ decode(token: string): string | jwt.JwtPayload | null;
20
+ }
21
+ export {};
22
+ //# sourceMappingURL=handle-jwt-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-jwt-token.d.ts","sourceRoot":"","sources":["../src/handle-jwt-token.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE5D,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,GAAG;QACtB,IAAI,CAAC,EAAE,SAAS,CAAC;KAClB,CAAC;CACH;AAED,qBAAa,cAAc;IACb,OAAO,CAAC,YAAY;IAAU,OAAO,CAAC,mBAAmB;gBAAjD,YAAY,EAAE,MAAM,EAAU,mBAAmB,EAAE,MAAM;IAE7E,OAAO,CAAC,SAAS;IAIjB,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB;IAMjD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,SAAoB,GAAG,UAAU,GAAG,SAAS;IAKzE,MAAM,CAAC,KAAK,EAAE,MAAM;CAGrB"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HandleJwtToken = void 0;
7
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
+ class HandleJwtToken {
9
+ constructor(jwtSecretKey, jwtRefreshSecretKey) {
10
+ this.jwtSecretKey = jwtSecretKey;
11
+ this.jwtRefreshSecretKey = jwtRefreshSecretKey;
12
+ }
13
+ getSecret(type = "access") {
14
+ return type === "access" ? this.jwtSecretKey : this.jwtRefreshSecretKey;
15
+ }
16
+ generate({ payload, options }) {
17
+ const SECRET = this.getSecret(options === null || options === void 0 ? void 0 : options.type);
18
+ options === null || options === void 0 ? true : delete options.type;
19
+ return jsonwebtoken_1.default.sign(payload, SECRET, options);
20
+ }
21
+ verify(token, type = "access") {
22
+ const SECRET = this.getSecret(type);
23
+ return jsonwebtoken_1.default.verify(token, SECRET);
24
+ }
25
+ decode(token) {
26
+ return jsonwebtoken_1.default.decode(token);
27
+ }
28
+ }
29
+ exports.HandleJwtToken = HandleJwtToken;
30
+ //# sourceMappingURL=handle-jwt-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-jwt-token.js","sourceRoot":"","sources":["../src/handle-jwt-token.ts"],"names":[],"mappings":";;;;;;AAAA,gEAA4D;AAe5D,MAAa,cAAc;IACzB,YAAoB,YAAoB,EAAU,mBAA2B;QAAzD,iBAAY,GAAZ,YAAY,CAAQ;QAAU,wBAAmB,GAAnB,mBAAmB,CAAQ;IAAG,CAAC;IAEzE,SAAS,CAAC,OAAkB,QAAQ;QAC1C,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;IAC1E,CAAC;IAED,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAsB;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CAAC;QACtC,OAAO,aAAP,OAAO,4BAAP,OAAO,CAAE,IAAI,CAAC;QACrB,OAAO,sBAAG,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,OAAkB,QAAQ;QAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,sBAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAA2B,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,sBAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;CACF;AArBD,wCAqBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senhainfo/shared-utils",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "repository": "https://github.com/senha-info/senha-shared-utils.git",
5
5
  "author": "Bruno Gaspar <bruninhoogaspar@gmail.com>",
6
6
  "license": "MIT",
@@ -10,6 +10,7 @@
10
10
  "lib"
11
11
  ],
12
12
  "scripts": {
13
+ "types:check": "tsc --noEmit",
13
14
  "build": "tsc",
14
15
  "prepare": "npm run build"
15
16
  },