@remnawave/backend-contract 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/api/controllers/index.ts +1 -0
- package/api/controllers/system.ts +5 -0
- package/api/routes.ts +3 -0
- package/build/api/controllers/index.js +1 -0
- package/build/api/controllers/system.js +7 -0
- package/build/api/routes.js +3 -0
- package/build/commands/index.js +1 -0
- package/build/commands/system/get-stats.command.js +33 -0
- package/build/commands/system/index.js +17 -0
- package/build/constants/errors/errors.js +5 -0
- package/commands/index.ts +1 -0
- package/commands/system/get-stats.command.ts +36 -0
- package/commands/system/index.ts +1 -0
- package/constants/errors/errors.ts +5 -0
- package/package.json +1 -1
package/api/controllers/index.ts
CHANGED
package/api/routes.ts
CHANGED
@@ -70,4 +70,7 @@ export const REST_API = {
|
|
70
70
|
DELETE: (uuid: string) =>
|
71
71
|
`${ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.DELETE}/${uuid}`,
|
72
72
|
},
|
73
|
+
SYSTEM: {
|
74
|
+
STATS: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATS}`,
|
75
|
+
},
|
73
76
|
} as const;
|
@@ -21,5 +21,6 @@ __exportStar(require("./inbounds"), exports);
|
|
21
21
|
__exportStar(require("./keygen"), exports);
|
22
22
|
__exportStar(require("./nodes"), exports);
|
23
23
|
__exportStar(require("./subscription"), exports);
|
24
|
+
__exportStar(require("./system"), exports);
|
24
25
|
__exportStar(require("./users"), exports);
|
25
26
|
__exportStar(require("./xray"), exports);
|
package/build/api/routes.js
CHANGED
@@ -78,4 +78,7 @@ exports.REST_API = {
|
|
78
78
|
UPDATE_MANY: `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.UPDATE_MANY}`,
|
79
79
|
DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.HOSTS_CONTROLLER}/${CONTROLLERS.HOSTS_ROUTES.DELETE}/${uuid}`,
|
80
80
|
},
|
81
|
+
SYSTEM: {
|
82
|
+
STATS: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATS}`,
|
83
|
+
},
|
81
84
|
};
|
package/build/commands/index.js
CHANGED
@@ -21,5 +21,6 @@ __exportStar(require("./inbounds"), exports);
|
|
21
21
|
__exportStar(require("./keygen"), exports);
|
22
22
|
__exportStar(require("./nodes"), exports);
|
23
23
|
__exportStar(require("./subscription"), exports);
|
24
|
+
__exportStar(require("./system"), exports);
|
24
25
|
__exportStar(require("./users"), exports);
|
25
26
|
__exportStar(require("./xray"), exports);
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GetStatsCommand = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const api_1 = require("../../api");
|
6
|
+
const constants_1 = require("../../constants");
|
7
|
+
var GetStatsCommand;
|
8
|
+
(function (GetStatsCommand) {
|
9
|
+
GetStatsCommand.url = api_1.REST_API.SYSTEM.STATS;
|
10
|
+
GetStatsCommand.ResponseSchema = zod_1.z.object({
|
11
|
+
response: zod_1.z.object({
|
12
|
+
cpu: zod_1.z.object({
|
13
|
+
cores: zod_1.z.number(),
|
14
|
+
physicalCores: zod_1.z.number(),
|
15
|
+
}),
|
16
|
+
memory: zod_1.z.object({
|
17
|
+
total: zod_1.z.number(),
|
18
|
+
free: zod_1.z.number(),
|
19
|
+
used: zod_1.z.number(),
|
20
|
+
active: zod_1.z.number(),
|
21
|
+
available: zod_1.z.number(),
|
22
|
+
}),
|
23
|
+
uptime: zod_1.z.number(),
|
24
|
+
timestamp: zod_1.z.number(),
|
25
|
+
users: zod_1.z.object({
|
26
|
+
onlineLastMinute: zod_1.z.number(),
|
27
|
+
statusCounts: zod_1.z.record(zod_1.z.enum(Object.values(constants_1.USERS_STATUS)), zod_1.z.number()),
|
28
|
+
totalUsers: zod_1.z.number(),
|
29
|
+
totalTrafficBytes: zod_1.z.string(),
|
30
|
+
}),
|
31
|
+
}),
|
32
|
+
});
|
33
|
+
})(GetStatsCommand || (exports.GetStatsCommand = GetStatsCommand = {}));
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./get-stats.command"), exports);
|
package/commands/index.ts
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { REST_API } from '../../api';
|
3
|
+
import { USERS_STATUS } from '../../constants';
|
4
|
+
|
5
|
+
export namespace GetStatsCommand {
|
6
|
+
export const url = REST_API.SYSTEM.STATS;
|
7
|
+
|
8
|
+
export const ResponseSchema = z.object({
|
9
|
+
response: z.object({
|
10
|
+
cpu: z.object({
|
11
|
+
cores: z.number(),
|
12
|
+
physicalCores: z.number(),
|
13
|
+
}),
|
14
|
+
memory: z.object({
|
15
|
+
total: z.number(),
|
16
|
+
free: z.number(),
|
17
|
+
used: z.number(),
|
18
|
+
active: z.number(),
|
19
|
+
available: z.number(),
|
20
|
+
}),
|
21
|
+
uptime: z.number(),
|
22
|
+
timestamp: z.number(),
|
23
|
+
users: z.object({
|
24
|
+
onlineLastMinute: z.number(),
|
25
|
+
statusCounts: z.record(
|
26
|
+
z.enum(Object.values(USERS_STATUS) as [string, ...string[]]),
|
27
|
+
z.number(),
|
28
|
+
),
|
29
|
+
totalUsers: z.number(),
|
30
|
+
totalTrafficBytes: z.string(),
|
31
|
+
}),
|
32
|
+
}),
|
33
|
+
});
|
34
|
+
|
35
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
36
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './get-stats.command';
|