@remnawave/backend-contract 0.0.33 → 0.0.35
Sign up to get free protection for your applications and to get access to all the features.
- package/api/controllers/system.ts +3 -0
- package/api/routes.ts +1 -0
- package/build/api/controllers/system.js +3 -0
- package/build/api/routes.js +1 -0
- package/build/commands/system/get-bandwidth-stats.command.js +6 -10
- package/build/commands/system/get-nodes-statistics.js +21 -0
- package/build/commands/system/index.js +1 -0
- package/build/models/base-stat.schema.js +9 -0
- package/build/models/index.js +1 -0
- package/commands/system/get-bandwidth-stats.command.ts +6 -10
- package/commands/system/get-nodes-statistics.ts +26 -0
- package/commands/system/index.ts +1 -0
- package/models/base-stat.schema.ts +7 -0
- package/models/index.ts +1 -0
- package/package.json +1 -1
package/api/routes.ts
CHANGED
@@ -75,5 +75,6 @@ export const REST_API = {
|
|
75
75
|
SYSTEM: {
|
76
76
|
STATS: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATS}`,
|
77
77
|
BANDWIDTH: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.BANDWIDTH}`,
|
78
|
+
NODES_STATISTIC: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATISTIC.NODES}`,
|
78
79
|
},
|
79
80
|
} as const;
|
package/build/api/routes.js
CHANGED
@@ -93,5 +93,6 @@ exports.REST_API = {
|
|
93
93
|
SYSTEM: {
|
94
94
|
STATS: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATS}`,
|
95
95
|
BANDWIDTH: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.BANDWIDTH}`,
|
96
|
+
NODES_STATISTIC: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATISTIC.NODES}`,
|
96
97
|
},
|
97
98
|
};
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetBandwidthStatsCommand = void 0;
|
4
4
|
const zod_1 = require("zod");
|
5
5
|
const api_1 = require("../../api");
|
6
|
+
const base_stat_schema_1 = require("../../models/base-stat.schema");
|
6
7
|
var GetBandwidthStatsCommand;
|
7
8
|
(function (GetBandwidthStatsCommand) {
|
8
9
|
GetBandwidthStatsCommand.url = api_1.REST_API.SYSTEM.BANDWIDTH;
|
@@ -11,16 +12,11 @@ var GetBandwidthStatsCommand;
|
|
11
12
|
});
|
12
13
|
GetBandwidthStatsCommand.ResponseSchema = zod_1.z.object({
|
13
14
|
response: zod_1.z.object({
|
14
|
-
bandwidthLastTwoDays:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
bandwidthLastSevenDays: zod_1.z.object({
|
20
|
-
current: zod_1.z.string(),
|
21
|
-
previous: zod_1.z.string(),
|
22
|
-
difference: zod_1.z.string(),
|
23
|
-
}),
|
15
|
+
bandwidthLastTwoDays: base_stat_schema_1.BaseStatSchema,
|
16
|
+
bandwidthLastSevenDays: base_stat_schema_1.BaseStatSchema,
|
17
|
+
bandwidthLast30Days: base_stat_schema_1.BaseStatSchema,
|
18
|
+
bandwidthCalendarMonth: base_stat_schema_1.BaseStatSchema,
|
19
|
+
bandwidthCurrentYear: base_stat_schema_1.BaseStatSchema,
|
24
20
|
}),
|
25
21
|
});
|
26
22
|
})(GetBandwidthStatsCommand || (exports.GetBandwidthStatsCommand = GetBandwidthStatsCommand = {}));
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.GetNodesStatisticsCommand = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const api_1 = require("../../api");
|
6
|
+
var GetNodesStatisticsCommand;
|
7
|
+
(function (GetNodesStatisticsCommand) {
|
8
|
+
GetNodesStatisticsCommand.url = api_1.REST_API.SYSTEM.NODES_STATISTIC;
|
9
|
+
GetNodesStatisticsCommand.RequestQuerySchema = zod_1.z.object({
|
10
|
+
tz: zod_1.z.string().optional(),
|
11
|
+
});
|
12
|
+
GetNodesStatisticsCommand.ResponseSchema = zod_1.z.object({
|
13
|
+
response: zod_1.z.object({
|
14
|
+
lastSevenDays: zod_1.z.array(zod_1.z.object({
|
15
|
+
nodeName: zod_1.z.string(),
|
16
|
+
date: zod_1.z.string(),
|
17
|
+
totalBytes: zod_1.z.string(),
|
18
|
+
})),
|
19
|
+
}),
|
20
|
+
});
|
21
|
+
})(GetNodesStatisticsCommand || (exports.GetNodesStatisticsCommand = GetNodesStatisticsCommand = {}));
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./get-bandwidth-stats.command"), exports);
|
18
|
+
__exportStar(require("./get-nodes-statistics"), exports);
|
18
19
|
__exportStar(require("./get-stats.command"), exports);
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.BaseStatSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
exports.BaseStatSchema = zod_1.z.object({
|
6
|
+
current: zod_1.z.string(),
|
7
|
+
previous: zod_1.z.string(),
|
8
|
+
difference: zod_1.z.string(),
|
9
|
+
});
|
package/build/models/index.js
CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./api-tokens.schema"), exports);
|
18
18
|
__exportStar(require("./auth.schema"), exports);
|
19
|
+
__exportStar(require("./base-stat.schema"), exports);
|
19
20
|
__exportStar(require("./hosts.schema"), exports);
|
20
21
|
__exportStar(require("./inbounds.schema"), exports);
|
21
22
|
__exportStar(require("./nodes.schema"), exports);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { z } from 'zod';
|
2
2
|
import { REST_API } from '../../api';
|
3
|
+
import { BaseStatSchema } from '../../models/base-stat.schema';
|
3
4
|
|
4
5
|
export namespace GetBandwidthStatsCommand {
|
5
6
|
export const url = REST_API.SYSTEM.BANDWIDTH;
|
@@ -12,16 +13,11 @@ export namespace GetBandwidthStatsCommand {
|
|
12
13
|
|
13
14
|
export const ResponseSchema = z.object({
|
14
15
|
response: z.object({
|
15
|
-
bandwidthLastTwoDays:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
bandwidthLastSevenDays: z.object({
|
21
|
-
current: z.string(),
|
22
|
-
previous: z.string(),
|
23
|
-
difference: z.string(),
|
24
|
-
}),
|
16
|
+
bandwidthLastTwoDays: BaseStatSchema,
|
17
|
+
bandwidthLastSevenDays: BaseStatSchema,
|
18
|
+
bandwidthLast30Days: BaseStatSchema,
|
19
|
+
bandwidthCalendarMonth: BaseStatSchema,
|
20
|
+
bandwidthCurrentYear: BaseStatSchema,
|
25
21
|
}),
|
26
22
|
});
|
27
23
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { REST_API } from '../../api';
|
3
|
+
|
4
|
+
export namespace GetNodesStatisticsCommand {
|
5
|
+
export const url = REST_API.SYSTEM.NODES_STATISTIC;
|
6
|
+
|
7
|
+
export const RequestQuerySchema = z.object({
|
8
|
+
tz: z.string().optional(),
|
9
|
+
});
|
10
|
+
|
11
|
+
export type Request = z.infer<typeof RequestQuerySchema>;
|
12
|
+
|
13
|
+
export const ResponseSchema = z.object({
|
14
|
+
response: z.object({
|
15
|
+
lastSevenDays: z.array(
|
16
|
+
z.object({
|
17
|
+
nodeName: z.string(),
|
18
|
+
date: z.string(),
|
19
|
+
totalBytes: z.string(),
|
20
|
+
}),
|
21
|
+
),
|
22
|
+
}),
|
23
|
+
});
|
24
|
+
|
25
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
26
|
+
}
|
package/commands/system/index.ts
CHANGED
package/models/index.ts
CHANGED