c2-http 1.0.121 → 1.0.123
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.
|
@@ -4,8 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const body_parser_1 = __importDefault(require("body-parser"));
|
|
7
|
-
// import moment from "moment";
|
|
8
|
-
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
7
|
class MiddlewareBody {
|
|
10
8
|
config(expressApplication) {
|
|
11
9
|
expressApplication.use(body_parser_1.default.json({ limit: "5mb" }));
|
|
@@ -33,26 +31,25 @@ class MiddlewareBody {
|
|
|
33
31
|
// }
|
|
34
32
|
// }
|
|
35
33
|
convertDates(obj, headers) {
|
|
36
|
-
if (Array.isArray(obj)) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
else if (typeof obj === "object" && obj !== null) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
34
|
+
// if (Array.isArray(obj)) {
|
|
35
|
+
// // percorre arrays também
|
|
36
|
+
// for (let i = 0; i < obj.length; i++) {
|
|
37
|
+
// this.convertDates(obj[i], headers);
|
|
38
|
+
// }
|
|
39
|
+
// }
|
|
40
|
+
// else if (typeof obj === "object" && obj !== null) {
|
|
41
|
+
// for (const key in obj) {
|
|
42
|
+
// if (!obj.hasOwnProperty(key)) continue;
|
|
43
|
+
// const value = obj[key];
|
|
44
|
+
// if (key.endsWith("Date") || key.endsWith("DateTime")) {
|
|
45
|
+
// const tz = headers["timezone"] || "America/Sao_Paulo"; // fallback padrão
|
|
46
|
+
// obj[key] = moment.tz(value, "YYYY-MM-DD", tz).utc();
|
|
47
|
+
// }
|
|
48
|
+
// else {
|
|
49
|
+
// this.convertDates(value, headers); // recursivo
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
exports.default = new MiddlewareBody;
|
package/dist/model/Controller.js
CHANGED
|
@@ -23,7 +23,6 @@ class Controller {
|
|
|
23
23
|
this.normalizedPaths = [];
|
|
24
24
|
this.router = (0, express_1.Router)();
|
|
25
25
|
this.basePath = `${process.env.BASE_PATH_API ? process.env.BASE_PATH_API : ""}${options.basePath ?? ""}`;
|
|
26
|
-
console.log(this.basePath);
|
|
27
26
|
this.relativePath = options.relativePath;
|
|
28
27
|
if (!this.relativePath?.startsWith("/")) {
|
|
29
28
|
throw new Error("the 'relativePatch' must start with a slash '/'");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.123",
|
|
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>",
|