badmfck-api-server 4.0.98 → 4.0.99

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.
@@ -21,5 +21,7 @@ export declare class Monitor extends BaseEndpoint {
21
21
  logs(req: HTTPRequestVO): Promise<TransferPacketVO>;
22
22
  netlog(req: HTTPRequestVO): Promise<TransferPacketVO>;
23
23
  metrics(req: HTTPRequestVO): Promise<TransferPacketVO>;
24
+ connections(req: HTTPRequestVO): Promise<TransferPacketVO>;
25
+ db(req: HTTPRequestVO): Promise<TransferPacketVO>;
24
26
  checkAuthentication(req: HTTPRequestVO): Promise<void>;
25
27
  }
@@ -14,6 +14,7 @@ const fs_1 = __importDefault(require("fs"));
14
14
  const path_1 = __importDefault(require("path"));
15
15
  const Http_1 = require("../http/Http");
16
16
  const MonitorService_1 = require("../MonitorService");
17
+ const DBService_1 = require("../DBService");
17
18
  exports.S_MONITOR_REGISTRATE_ACTION = new badmfck_signal_1.Signal();
18
19
  const logMap = {
19
20
  ALL: 10,
@@ -42,6 +43,11 @@ class Monitor extends BaseEndpoint_1.BaseEndpoint {
42
43
  range: "",
43
44
  $__range_values: ["week", "day", "hour"]
44
45
  } },
46
+ { ignoreInterceptor: true, endpoint: "connections", handler: this.connections },
47
+ { ignoreInterceptor: true, endpoint: "db", handler: this.db, validationModel: {
48
+ range: "",
49
+ $__range_values: ["week", "day", "hour"]
50
+ } },
45
51
  { ignoreInterceptor: true, endpoint: "controllers", handler: this.controllers },
46
52
  { ignoreInterceptor: true, endpoint: "changeLogLevel", handler: this.changeLogLevel, validationModel: {
47
53
  level: Object.keys(logMap).join(",")
@@ -129,6 +135,14 @@ class Monitor extends BaseEndpoint_1.BaseEndpoint {
129
135
  const result = await MonitorService_1.REQ_STAT.request(req.data);
130
136
  return { data: result };
131
137
  }
138
+ async connections(req) {
139
+ await this.checkAuthentication(req);
140
+ return { data: Http_1.Http.getActiveConnectionsSnapshot() };
141
+ }
142
+ async db(req) {
143
+ await this.checkAuthentication(req);
144
+ return { data: DBService_1.DBService.healthcheck(req.data.range) };
145
+ }
132
146
  async checkAuthentication(req) {
133
147
  const users = await APIService_1.REQ_MONITOR_USERS.request();
134
148
  if (!users || users.length == 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "4.0.98",
3
+ "version": "4.0.99",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",