c2-http 1.0.40 → 1.0.42
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.
- package/dist/index.js +51 -0
- package/dist/model/Controller.d.ts +0 -1
- package/dist/model/Controller.js +4 -55
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,6 +22,57 @@ Object.defineProperty(exports, "CrudController", { enumerable: true, get: functi
|
|
|
22
22
|
const HttpError_1 = require("./model/HttpError");
|
|
23
23
|
const Server_1 = require("./model/Server");
|
|
24
24
|
Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return Server_1.Server; } });
|
|
25
|
+
global.OPEN_API_DOC = {
|
|
26
|
+
"openapi": "3.1.0",
|
|
27
|
+
"info": {
|
|
28
|
+
"version": "1.0.0",
|
|
29
|
+
"title": "REST API",
|
|
30
|
+
"description": ""
|
|
31
|
+
},
|
|
32
|
+
"servers": [
|
|
33
|
+
{
|
|
34
|
+
"url": "http://localhost:3000/"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"components": {
|
|
38
|
+
"schemas": {
|
|
39
|
+
"info": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"title": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"example": "Sua API"
|
|
45
|
+
},
|
|
46
|
+
"version": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"example": "1.0.0"
|
|
49
|
+
},
|
|
50
|
+
"description": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"example": "Descrição da sua API"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"servers": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"items": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"url": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"example": "http://localhost:3000"
|
|
64
|
+
},
|
|
65
|
+
"description": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"example": "Servidor local"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
paths: {}
|
|
75
|
+
};
|
|
25
76
|
const convertErrorToHttpError = (error) => {
|
|
26
77
|
if (error instanceof mongodb_1.MongoServerError) {
|
|
27
78
|
if (error.code === 11000) {
|
|
@@ -4,7 +4,6 @@ export declare abstract class Controller {
|
|
|
4
4
|
routers: Router;
|
|
5
5
|
documentation: any;
|
|
6
6
|
protected options: IControllerOptions;
|
|
7
|
-
static openApi: any;
|
|
8
7
|
constructor(_options: Partial<IControllerOptions>);
|
|
9
8
|
}
|
|
10
9
|
export declare function HttpDispatchHandling(target: any, methodName: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
package/dist/model/Controller.js
CHANGED
|
@@ -10,7 +10,7 @@ class Controller {
|
|
|
10
10
|
documentation;
|
|
11
11
|
options;
|
|
12
12
|
// Propriedade estática compartilhada por todas as instâncias
|
|
13
|
-
static openApi = {};
|
|
13
|
+
// static openApi: any = {};
|
|
14
14
|
constructor(_options) {
|
|
15
15
|
this.options = _options;
|
|
16
16
|
if (!this?.options?.relativePath?.startsWith("/")) {
|
|
@@ -30,57 +30,6 @@ class Controller {
|
|
|
30
30
|
this.options.prefixRole = defaultPrefixRole.replaceAll("/", "-");
|
|
31
31
|
}
|
|
32
32
|
this.options.uri = `${this.options.basePath}${this.options.relativePath}`;
|
|
33
|
-
Controller.openApi = {
|
|
34
|
-
"openapi": "3.1.0",
|
|
35
|
-
"info": {
|
|
36
|
-
"version": "1.0.0",
|
|
37
|
-
"title": "REST API",
|
|
38
|
-
"description": ""
|
|
39
|
-
},
|
|
40
|
-
"servers": [
|
|
41
|
-
{
|
|
42
|
-
"url": "http://localhost:3000/"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"components": {
|
|
46
|
-
"schemas": {
|
|
47
|
-
"info": {
|
|
48
|
-
"type": "object",
|
|
49
|
-
"properties": {
|
|
50
|
-
"title": {
|
|
51
|
-
"type": "string",
|
|
52
|
-
"example": "Sua API"
|
|
53
|
-
},
|
|
54
|
-
"version": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
"example": "1.0.0"
|
|
57
|
-
},
|
|
58
|
-
"description": {
|
|
59
|
-
"type": "string",
|
|
60
|
-
"example": "Descrição da sua API"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"servers": {
|
|
65
|
-
"type": "array",
|
|
66
|
-
"items": {
|
|
67
|
-
"type": "object",
|
|
68
|
-
"properties": {
|
|
69
|
-
"url": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"example": "http://localhost:3000"
|
|
72
|
-
},
|
|
73
|
-
"description": {
|
|
74
|
-
"type": "string",
|
|
75
|
-
"example": "Servidor local"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
paths: {}
|
|
83
|
-
};
|
|
84
33
|
}
|
|
85
34
|
}
|
|
86
35
|
exports.Controller = Controller;
|
|
@@ -144,10 +93,10 @@ function OpenApi(target) {
|
|
|
144
93
|
};
|
|
145
94
|
}
|
|
146
95
|
});
|
|
147
|
-
|
|
148
|
-
...
|
|
96
|
+
global.OPEN_API_DOC = {
|
|
97
|
+
...global.OPEN_API_DOC,
|
|
149
98
|
paths: {
|
|
150
|
-
...
|
|
99
|
+
...global.OPEN_API_DOC.paths,
|
|
151
100
|
...paths
|
|
152
101
|
}
|
|
153
102
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42",
|
|
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>",
|