c2-http 1.0.141 → 1.0.143

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.
@@ -3,31 +3,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const c2_util_1 = require("c2-util");
7
6
  const cors_1 = __importDefault(require("cors"));
8
7
  class MiddlewareCors {
9
8
  config(expressApplication) {
10
- expressApplication.use(() => {
11
- (0, c2_util_1.log)("LOG_CORS", "CORS middleware enabled");
12
- return (0, cors_1.default)({
13
- origin: (origin, callback) => {
14
- // Permitir solicitações sem uma origem
15
- if (!origin)
16
- return callback(null, true);
17
- if (!process.env.ORIGIN_ENABLES) {
18
- return callback(null, true);
19
- }
20
- if (process.env.ORIGIN_ENABLES.split(",").indexOf(origin) === -1) {
21
- const msg = "Acesso não permitido para esta origem";
22
- return callback(new Error(msg), false);
23
- }
9
+ expressApplication.use((0, cors_1.default)({
10
+ origin: (origin, callback) => {
11
+ // Permitir solicitações sem uma origem
12
+ if (!origin)
24
13
  return callback(null, true);
25
- },
26
- methods: "GET,OPTIONS,PUT,POST,PATCH,DELETE",
27
- allowedHeaders: "Content-Type,Authorization,Origin,Accept",
28
- credentials: true
29
- });
30
- });
14
+ if (!process.env.ORIGIN_ENABLES) {
15
+ return callback(null, true);
16
+ }
17
+ if (process.env.ORIGIN_ENABLES.split(",").indexOf(origin) === -1) {
18
+ const msg = "Acesso não permitido para esta origem";
19
+ return callback(new Error(msg), false);
20
+ }
21
+ return callback(null, true);
22
+ },
23
+ methods: "GET,OPTIONS,PUT,POST,PATCH,DELETE",
24
+ allowedHeaders: "Content-Type,Authorization,Origin,Accept",
25
+ credentials: true
26
+ }));
31
27
  }
32
28
  }
33
29
  exports.default = new MiddlewareCors;
@@ -9,7 +9,6 @@ const express_1 = __importDefault(require("express"));
9
9
  const express_prom_bundle_1 = __importDefault(require("express-prom-bundle"));
10
10
  const i18n_1 = require("../i18n");
11
11
  const MiddlewareGlobals_1 = __importDefault(require("../middleware/global-middleware/MiddlewareGlobals"));
12
- const MiddlewareJwt_1 = __importDefault(require("../middleware/jwt-middlware/MiddlewareJwt"));
13
12
  class Server {
14
13
  app;
15
14
  config;
@@ -40,7 +39,7 @@ class Server {
40
39
  // this.app.use("/docs", swaggerUI.serve, swaggerUI.setup((global as any).OPEN_API_DOC))
41
40
  (0, c2_util_1.log)("LOG", "Rotas abertas OK");
42
41
  //middlewares de checagem de token obrigatorio
43
- this.app.use(MiddlewareJwt_1.default.config);
42
+ // this.app.use(MiddlewareJwt.config)
44
43
  //middlewares de checagem de token opcional
45
44
  // this.config.middlewaresCloseControllers?.forEach((middl: RequestHandler) => {
46
45
  // this.app.use(middl)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-http",
3
- "version": "1.0.141",
3
+ "version": "1.0.143",
4
4
  "description": "Biblioteca Typescript para API NodeJS",
5
5
  "repository": "https://cabralsilva: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@github.com/cabralsilva/c2-http.git",
6
6
  "author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",