@remnawave/backend-contract 0.0.34 → 0.0.35

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,4 +3,7 @@ export const SYSTEM_CONTROLLER = 'system' as const;
3
3
  export const SYSTEM_ROUTES = {
4
4
  STATS: 'stats',
5
5
  BANDWIDTH: 'bandwidth',
6
+ STATISTIC: {
7
+ NODES: 'statistics/nodes',
8
+ },
6
9
  } as const;
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;
@@ -5,4 +5,7 @@ exports.SYSTEM_CONTROLLER = 'system';
5
5
  exports.SYSTEM_ROUTES = {
6
6
  STATS: 'stats',
7
7
  BANDWIDTH: 'bandwidth',
8
+ STATISTIC: {
9
+ NODES: 'statistics/nodes',
10
+ },
8
11
  };
@@ -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
  };
@@ -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,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
+ }
@@ -1,2 +1,3 @@
1
1
  export * from './get-bandwidth-stats.command';
2
+ export * from './get-nodes-statistics';
2
3
  export * from './get-stats.command';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "A contract library for Remnawave",
5
5
  "main": "index.js",
6
6
  "scripts": {