badmfck-api-server 4.0.97 → 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.
- package/dist/apiServer/APIService.d.ts +5 -2
- package/dist/apiServer/APIService.js +6 -4
- package/dist/apiServer/DBService.d.ts +23 -30
- package/dist/apiServer/DBService.js +59 -90
- package/dist/apiServer/MonitorService.d.ts +11 -0
- package/dist/apiServer/MonitorService.js +56 -4
- package/dist/apiServer/db/IDBAdapter.d.ts +2 -1
- package/dist/apiServer/db/MysqlAdapter.d.ts +7 -1
- package/dist/apiServer/db/MysqlAdapter.js +69 -2
- package/dist/apiServer/db/PostgresAdapter.d.ts +3 -1
- package/dist/apiServer/db/PostgresAdapter.js +4 -0
- package/dist/apiServer/documentation/Documentation.d.ts +1 -1
- package/dist/apiServer/documentation/Documentation.js +22 -3
- package/dist/apiServer/documentation/index.html +224 -161
- package/dist/apiServer/monitor/Monitor.d.ts +2 -0
- package/dist/apiServer/monitor/Monitor.js +14 -0
- package/package.json +2 -2
- package/untitled folder/assets/index-BQHWfl2U.js +0 -40
- package/untitled folder/index.html +0 -12
|
@@ -18,9 +18,13 @@ class PostgresAdapter {
|
|
|
18
18
|
pingInterval = 1000 * 60 * 5;
|
|
19
19
|
poolConnections = 0;
|
|
20
20
|
acquiredPoolConnections = 0;
|
|
21
|
+
statFrames = new Map();
|
|
21
22
|
constructor(options) {
|
|
22
23
|
this.options = options;
|
|
23
24
|
}
|
|
25
|
+
stat() {
|
|
26
|
+
return this.statFrames;
|
|
27
|
+
}
|
|
24
28
|
escape(value) {
|
|
25
29
|
return value;
|
|
26
30
|
}
|
|
@@ -9,5 +9,5 @@ export declare class Documentation extends BaseEndpoint {
|
|
|
9
9
|
data: Record<string, any>[];
|
|
10
10
|
}>;
|
|
11
11
|
html(req: HTTPRequestVO): Promise<TransferPacketVO<any>>;
|
|
12
|
-
checkAuthorization(req: HTTPRequestVO): Promise<
|
|
12
|
+
checkAuthorization(req: HTTPRequestVO): Promise<string[] | undefined>;
|
|
13
13
|
}
|
|
@@ -33,8 +33,27 @@ class Documentation extends BaseEndpoint_1.BaseEndpoint {
|
|
|
33
33
|
}]);
|
|
34
34
|
}
|
|
35
35
|
async json(req) {
|
|
36
|
-
await this.checkAuthorization(req);
|
|
37
|
-
|
|
36
|
+
const endpoints = await this.checkAuthorization(req);
|
|
37
|
+
let doc = JSON.parse(JSON.stringify(await DocumentService_1.REQ_DOC.request()));
|
|
38
|
+
if (endpoints && endpoints.length > 0) {
|
|
39
|
+
doc = doc.filter((group) => {
|
|
40
|
+
if (group.endpoints && Array.isArray(group.endpoints)) {
|
|
41
|
+
group.endpoints = group.endpoints.filter((ep) => {
|
|
42
|
+
const path = ep.name;
|
|
43
|
+
return endpoints.some((pattern) => {
|
|
44
|
+
if (pattern.endsWith('/*')) {
|
|
45
|
+
const base = pattern.slice(0, -2);
|
|
46
|
+
return path === base || path.startsWith(base + '/');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return path === pattern;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return group.endpoints && group.endpoints.length > 0;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
38
57
|
return { data: doc };
|
|
39
58
|
}
|
|
40
59
|
async html(req) {
|
|
@@ -80,7 +99,7 @@ class Documentation extends BaseEndpoint_1.BaseEndpoint {
|
|
|
80
99
|
for (let i of users) {
|
|
81
100
|
const hash = crypto_1.default.createHash("sha256").update(i.login + ":" + i.password).digest("hex");
|
|
82
101
|
if (hash === header) {
|
|
83
|
-
return;
|
|
102
|
+
return i.endpoints;
|
|
84
103
|
}
|
|
85
104
|
}
|
|
86
105
|
throw { ...DefaultErrors_1.default.UNAUTHORIZED, details: "Invalid user" };
|