@remnawave/backend-contract 0.0.34 → 0.0.36

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.
@@ -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;
@@ -6,6 +6,7 @@ export const USERS_ROUTES = {
6
6
  GET_BY_SHORT_UUID: 'short-uuid',
7
7
  GET_BY_SUBSCRIPTION_UUID: 'sub-uuid',
8
8
  GET_ALL: '',
9
+ GET_ALL_V2: 'v2',
9
10
  REVOKE_SUBSCRIPTION: 'revoke',
10
11
  DISABLE_USER: 'disable',
11
12
  ENABLE_USER: 'enable',
package/api/routes.ts CHANGED
@@ -56,6 +56,7 @@ export const REST_API = {
56
56
  DELETE_USER: (uuid: string) =>
57
57
  `${ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DELETE_USER}/${uuid}`,
58
58
  UPDATE: `${ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.UPDATE}`,
59
+ GET_ALL_V2: `${ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_ALL_V2}`,
59
60
  },
60
61
  SUBSCRIPTION: {
61
62
  GET: (shortUuid: string) =>
@@ -75,5 +76,6 @@ export const REST_API = {
75
76
  SYSTEM: {
76
77
  STATS: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATS}`,
77
78
  BANDWIDTH: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.BANDWIDTH}`,
79
+ NODES_STATISTIC: `${ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATISTIC.NODES}`,
78
80
  },
79
81
  } 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
  };
@@ -8,6 +8,7 @@ exports.USERS_ROUTES = {
8
8
  GET_BY_SHORT_UUID: 'short-uuid',
9
9
  GET_BY_SUBSCRIPTION_UUID: 'sub-uuid',
10
10
  GET_ALL: '',
11
+ GET_ALL_V2: 'v2',
11
12
  REVOKE_SUBSCRIPTION: 'revoke',
12
13
  DISABLE_USER: 'disable',
13
14
  ENABLE_USER: 'enable',
@@ -77,6 +77,7 @@ exports.REST_API = {
77
77
  ENABLE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ENABLE_USER}/${uuid}`,
78
78
  DELETE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DELETE_USER}/${uuid}`,
79
79
  UPDATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.UPDATE}`,
80
+ GET_ALL_V2: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_ALL_V2}`,
80
81
  },
81
82
  SUBSCRIPTION: {
82
83
  GET: (shortUuid) => `${exports.ROOT}/${CONTROLLERS.SUBSCRIPTION_CONTROLLER}/${CONTROLLERS.SUBSCRIPTION_ROUTES.GET}/${shortUuid}`,
@@ -93,5 +94,6 @@ exports.REST_API = {
93
94
  SYSTEM: {
94
95
  STATS: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATS}`,
95
96
  BANDWIDTH: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.BANDWIDTH}`,
97
+ NODES_STATISTIC: `${exports.ROOT}/${CONTROLLERS.SYSTEM_CONTROLLER}/${CONTROLLERS.SYSTEM_ROUTES.STATISTIC.NODES}`,
96
98
  },
97
99
  };
@@ -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,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetAllUsersV2Command = void 0;
4
+ const zod_1 = require("zod");
5
+ const api_1 = require("../../api");
6
+ const users_schema_1 = require("../../models/users.schema");
7
+ var GetAllUsersV2Command;
8
+ (function (GetAllUsersV2Command) {
9
+ GetAllUsersV2Command.url = api_1.REST_API.USERS.GET_ALL;
10
+ GetAllUsersV2Command.RequestQuerySchema = zod_1.z.object({
11
+ start: zod_1.z.number().optional(),
12
+ size: zod_1.z.number().optional(),
13
+ filters: zod_1.z
14
+ .array(zod_1.z.object({
15
+ id: zod_1.z.string(),
16
+ value: zod_1.z.string(),
17
+ }))
18
+ .optional(),
19
+ filterModes: zod_1.z
20
+ .record(zod_1.z.string(), zod_1.z.enum(['contains', 'startsWith', 'endsWith']))
21
+ .optional(),
22
+ globalFilterMode: zod_1.z.string().optional(),
23
+ sorting: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), desc: zod_1.z.boolean() })).optional(),
24
+ });
25
+ GetAllUsersV2Command.ResponseSchema = zod_1.z.object({
26
+ response: zod_1.z.object({
27
+ users: zod_1.z.array(users_schema_1.UsersSchema.extend({
28
+ totalUsedBytes: zod_1.z.string(),
29
+ })),
30
+ total: zod_1.z.number(),
31
+ }),
32
+ });
33
+ })(GetAllUsersV2Command || (exports.GetAllUsersV2Command = GetAllUsersV2Command = {}));
@@ -18,6 +18,7 @@ __exportStar(require("./create-user.command"), exports);
18
18
  __exportStar(require("./delete-user.command"), exports);
19
19
  __exportStar(require("./disable-user.command.ts"), exports);
20
20
  __exportStar(require("./enable-user.command"), exports);
21
+ __exportStar(require("./get-all-users-v2.command"), exports);
21
22
  __exportStar(require("./get-all-users.command"), exports);
22
23
  __exportStar(require("./get-user-by-short-uuid.command"), exports);
23
24
  __exportStar(require("./get-user-by-subscription-uuid.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';
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { REST_API } from '../../api';
3
+ import { UsersSchema } from '../../models/users.schema';
4
+
5
+ export namespace GetAllUsersV2Command {
6
+ export const url = REST_API.USERS.GET_ALL;
7
+
8
+ export const RequestQuerySchema = z.object({
9
+ start: z.number().optional(),
10
+ size: z.number().optional(),
11
+ filters: z
12
+ .array(
13
+ z.object({
14
+ id: z.string(),
15
+ value: z.string(),
16
+ }),
17
+ )
18
+ .optional(),
19
+ filterModes: z
20
+ .record(z.string(), z.enum(['contains', 'startsWith', 'endsWith']))
21
+ .optional(),
22
+ globalFilterMode: z.string().optional(),
23
+ sorting: z.array(z.object({ id: z.string(), desc: z.boolean() })).optional(),
24
+ });
25
+
26
+ export type RequestQuery = z.infer<typeof RequestQuerySchema>;
27
+
28
+ export const ResponseSchema = z.object({
29
+ response: z.object({
30
+ users: z.array(
31
+ UsersSchema.extend({
32
+ totalUsedBytes: z.string(),
33
+ }),
34
+ ),
35
+
36
+ total: z.number(),
37
+ }),
38
+ });
39
+
40
+ export type Response = z.infer<typeof ResponseSchema>;
41
+ }
@@ -2,6 +2,7 @@ export * from './create-user.command';
2
2
  export * from './delete-user.command';
3
3
  export * from './disable-user.command.ts';
4
4
  export * from './enable-user.command';
5
+ export * from './get-all-users-v2.command';
5
6
  export * from './get-all-users.command';
6
7
  export * from './get-user-by-short-uuid.command';
7
8
  export * from './get-user-by-subscription-uuid.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.36",
4
4
  "description": "A contract library for Remnawave",
5
5
  "main": "index.js",
6
6
  "scripts": {