@remnawave/backend-contract 0.4.4 → 0.5.0

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.
Files changed (121) hide show
  1. package/build/backend/api/controllers/users.d.ts +19 -14
  2. package/build/backend/api/controllers/users.d.ts.map +1 -1
  3. package/build/backend/api/controllers/users.js +20 -15
  4. package/build/backend/api/routes.d.ts +17 -13
  5. package/build/backend/api/routes.d.ts.map +1 -1
  6. package/build/backend/api/routes.js +17 -13
  7. package/build/backend/commands/api-tokens/create.command.d.ts +4 -4
  8. package/build/backend/commands/api-tokens/find.command.d.ts +6 -6
  9. package/build/backend/commands/hosts/bulk/delete-many-hosts.command.d.ts +4 -4
  10. package/build/backend/commands/hosts/bulk/disable-many-hosts.command.d.ts +4 -4
  11. package/build/backend/commands/hosts/bulk/enable-many-hosts.command.d.ts +4 -4
  12. package/build/backend/commands/hosts/bulk/set-inbound-to-many-hosts.command.d.ts +4 -4
  13. package/build/backend/commands/hosts/bulk/set-port-to-many-hosts.command.d.ts +4 -4
  14. package/build/backend/commands/hosts/create.command.d.ts +4 -4
  15. package/build/backend/commands/hosts/get-all.command.d.ts +4 -4
  16. package/build/backend/commands/hosts/get-one.command.d.ts +4 -4
  17. package/build/backend/commands/hosts/update.command.d.ts +7 -7
  18. package/build/backend/commands/inbounds/get-full-inbounds.command.d.ts +4 -4
  19. package/build/backend/commands/inbounds/get-inbounds.command.d.ts +4 -4
  20. package/build/backend/commands/nodes/create.command.d.ts +6 -6
  21. package/build/backend/commands/nodes/disable.command.d.ts +6 -6
  22. package/build/backend/commands/nodes/enable.command.d.ts +6 -6
  23. package/build/backend/commands/nodes/get-all.command.d.ts +6 -6
  24. package/build/backend/commands/nodes/get-node-user-usage-by-range.command.d.ts +4 -4
  25. package/build/backend/commands/nodes/get-one.command.d.ts +6 -6
  26. package/build/backend/commands/nodes/reorder.command.d.ts +8 -8
  27. package/build/backend/commands/nodes/update.command.d.ts +11 -11
  28. package/build/backend/commands/users/activate-all-inbounds.command.d.ts +18 -17
  29. package/build/backend/commands/users/activate-all-inbounds.command.d.ts.map +1 -1
  30. package/build/backend/commands/users/activate-all-inbounds.command.js +3 -1
  31. package/build/backend/commands/users/bulk/bulk-update-users.command.d.ts +4 -4
  32. package/build/backend/commands/users/bulk-all/bulk-all-update-users.command.d.ts +2 -2
  33. package/build/backend/commands/users/create-user.command.d.ts +20 -19
  34. package/build/backend/commands/users/create-user.command.d.ts.map +1 -1
  35. package/build/backend/commands/users/create-user.command.js +7 -2
  36. package/build/backend/commands/users/delete-user.command.d.ts +1 -0
  37. package/build/backend/commands/users/delete-user.command.d.ts.map +1 -1
  38. package/build/backend/commands/users/delete-user.command.js +3 -1
  39. package/build/backend/commands/users/disable-user.command.d.ts +18 -17
  40. package/build/backend/commands/users/disable-user.command.d.ts.map +1 -1
  41. package/build/backend/commands/users/disable-user.command.js +3 -1
  42. package/build/backend/commands/users/enable-user.command.d.ts +18 -17
  43. package/build/backend/commands/users/enable-user.command.d.ts.map +1 -1
  44. package/build/backend/commands/users/enable-user.command.js +3 -1
  45. package/build/backend/commands/users/{get-all-users-v2.command.d.ts → get-all-users.command.d.ts} +28 -27
  46. package/build/backend/commands/users/get-all-users.command.d.ts.map +1 -0
  47. package/build/backend/commands/users/{get-all-users-v2.command.js → get-all-users.command.js} +10 -8
  48. package/build/backend/commands/users/get-user-by-email.command.d.ts +18 -17
  49. package/build/backend/commands/users/get-user-by-email.command.d.ts.map +1 -1
  50. package/build/backend/commands/users/get-user-by-email.command.js +3 -1
  51. package/build/backend/commands/users/get-user-by-short-uuid.command.d.ts +18 -17
  52. package/build/backend/commands/users/get-user-by-short-uuid.command.d.ts.map +1 -1
  53. package/build/backend/commands/users/get-user-by-short-uuid.command.js +3 -1
  54. package/build/backend/commands/users/get-user-by-subscription-uuid.command.d.ts +18 -17
  55. package/build/backend/commands/users/get-user-by-subscription-uuid.command.d.ts.map +1 -1
  56. package/build/backend/commands/users/get-user-by-subscription-uuid.command.js +3 -1
  57. package/build/backend/commands/users/get-user-by-telegram-id.command.d.ts +18 -17
  58. package/build/backend/commands/users/get-user-by-telegram-id.command.d.ts.map +1 -1
  59. package/build/backend/commands/users/get-user-by-telegram-id.command.js +3 -1
  60. package/build/backend/commands/users/get-user-by-username.command.d.ts +18 -17
  61. package/build/backend/commands/users/get-user-by-username.command.d.ts.map +1 -1
  62. package/build/backend/commands/users/get-user-by-username.command.js +3 -1
  63. package/build/backend/commands/users/get-user-by-uuid.command.d.ts +18 -17
  64. package/build/backend/commands/users/get-user-by-uuid.command.d.ts.map +1 -1
  65. package/build/backend/commands/users/get-user-by-uuid.command.js +2 -0
  66. package/build/backend/commands/users/index.d.ts +1 -1
  67. package/build/backend/commands/users/index.d.ts.map +1 -1
  68. package/build/backend/commands/users/index.js +1 -1
  69. package/build/backend/commands/users/reset-user-traffic.command.d.ts +18 -17
  70. package/build/backend/commands/users/reset-user-traffic.command.d.ts.map +1 -1
  71. package/build/backend/commands/users/reset-user-traffic.command.js +3 -1
  72. package/build/backend/commands/users/revoke-user-subscription.command.d.ts +18 -17
  73. package/build/backend/commands/users/revoke-user-subscription.command.d.ts.map +1 -1
  74. package/build/backend/commands/users/revoke-user-subscription.command.js +3 -1
  75. package/build/backend/commands/users/update-user.command.d.ts +27 -26
  76. package/build/backend/commands/users/update-user.command.d.ts.map +1 -1
  77. package/build/backend/commands/users/update-user.command.js +3 -2
  78. package/build/backend/constants/base-api/base-api-endpoint.d.ts +7 -0
  79. package/build/backend/constants/base-api/base-api-endpoint.d.ts.map +1 -0
  80. package/build/backend/constants/base-api/base-api-endpoint.js +10 -0
  81. package/build/backend/constants/base-api/index.d.ts +2 -0
  82. package/build/backend/constants/base-api/index.d.ts.map +1 -0
  83. package/build/backend/constants/base-api/index.js +17 -0
  84. package/build/backend/constants/index.d.ts +1 -0
  85. package/build/backend/constants/index.d.ts.map +1 -1
  86. package/build/backend/constants/index.js +1 -0
  87. package/build/backend/models/api-tokens.schema.d.ts +2 -2
  88. package/build/backend/models/extented-users.schema.d.ts +11 -11
  89. package/build/backend/models/full-inbounds.schema.d.ts +2 -2
  90. package/build/backend/models/hosts.schema.d.ts +2 -2
  91. package/build/backend/models/hwid-user-device.schema.js +1 -1
  92. package/build/backend/models/inbounds.schema.d.ts +2 -2
  93. package/build/backend/models/nodes.schema.d.ts +4 -4
  94. package/build/backend/models/subscription-settings.schema.d.ts.map +1 -1
  95. package/build/backend/models/subscription-settings.schema.js +1 -1
  96. package/build/backend/models/users.schema.d.ts +8 -8
  97. package/build/frontend/api/controllers/users.js +20 -15
  98. package/build/frontend/api/routes.js +17 -13
  99. package/build/frontend/commands/users/activate-all-inbounds.command.js +3 -1
  100. package/build/frontend/commands/users/create-user.command.js +7 -2
  101. package/build/frontend/commands/users/delete-user.command.js +3 -1
  102. package/build/frontend/commands/users/disable-user.command.js +3 -1
  103. package/build/frontend/commands/users/enable-user.command.js +3 -1
  104. package/build/frontend/commands/users/{get-all-users-v2.command.js → get-all-users.command.js} +10 -8
  105. package/build/frontend/commands/users/get-user-by-email.command.js +3 -1
  106. package/build/frontend/commands/users/get-user-by-short-uuid.command.js +3 -1
  107. package/build/frontend/commands/users/get-user-by-subscription-uuid.command.js +3 -1
  108. package/build/frontend/commands/users/get-user-by-telegram-id.command.js +3 -1
  109. package/build/frontend/commands/users/get-user-by-username.command.js +3 -1
  110. package/build/frontend/commands/users/get-user-by-uuid.command.js +2 -0
  111. package/build/frontend/commands/users/index.js +1 -1
  112. package/build/frontend/commands/users/reset-user-traffic.command.js +3 -1
  113. package/build/frontend/commands/users/revoke-user-subscription.command.js +3 -1
  114. package/build/frontend/commands/users/update-user.command.js +3 -2
  115. package/build/frontend/constants/base-api/base-api-endpoint.js +10 -0
  116. package/build/frontend/constants/base-api/index.js +17 -0
  117. package/build/frontend/constants/index.js +1 -0
  118. package/build/frontend/models/hwid-user-device.schema.js +1 -1
  119. package/build/frontend/models/subscription-settings.schema.js +1 -1
  120. package/package.json +1 -1
  121. package/build/backend/commands/users/get-all-users-v2.command.d.ts.map +0 -1
@@ -86,18 +86,24 @@ exports.REST_API = {
86
86
  },
87
87
  USERS: {
88
88
  CREATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.CREATE}`,
89
- GET_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_UUID}/${uuid}`,
90
- GET_BY_SHORT_UUID: (shortUuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_SHORT_UUID}/${shortUuid}`,
91
- GET_BY_USERNAME: (username) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_USERNAME}/${username}`,
92
- GET_BY_SUBSCRIPTION_UUID: (subscriptionUuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_SUBSCRIPTION_UUID}/${subscriptionUuid}`,
93
- REVOKE_SUBSCRIPTION: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.REVOKE_SUBSCRIPTION}/${uuid}`,
94
- DISABLE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DISABLE_USER}/${uuid}`,
95
- ENABLE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ENABLE_USER}/${uuid}`,
96
- DELETE_USER: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DELETE_USER}/${uuid}`,
97
89
  UPDATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.UPDATE}`,
98
- ACTIVATE_ALL_INBOUNDS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ACTIVATE_ALL_INBOUNDS}/${uuid}`,
99
- GET_ALL_V2: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_ALL_V2}`,
100
- RESET_USER_TRAFFIC: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.RESET_USER_TRAFFIC}/${uuid}`,
90
+ GET: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET}`,
91
+ DELETE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.DELETE(uuid)}`,
92
+ GET_BY_UUID: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_UUID(uuid)}`,
93
+ ACTIONS: {
94
+ DISABLE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ACTIONS.DISABLE(uuid)}`,
95
+ ENABLE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ACTIONS.ENABLE(uuid)}`,
96
+ RESET_TRAFFIC: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ACTIONS.RESET_TRAFFIC(uuid)}`,
97
+ ACTIVATE_ALL_INBOUNDS: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ACTIONS.ACTIVATE_ALL_INBOUNDS(uuid)}`,
98
+ REVOKE_SUBSCRIPTION: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.ACTIONS.REVOKE_SUBSCRIPTION(uuid)}`,
99
+ },
100
+ GET_BY: {
101
+ SHORT_UUID: (shortUuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY.SHORT_UUID(shortUuid)}`,
102
+ USERNAME: (username) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY.USERNAME(username)}`,
103
+ SUBSCRIPTION_UUID: (subscriptionUuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY.SUBSCRIPTION_UUID(subscriptionUuid)}`,
104
+ TELEGRAM_ID: (telegramId) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY.TELEGRAM_ID(telegramId)}`,
105
+ EMAIL: (email) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY.EMAIL(email)}`,
106
+ },
101
107
  BULK: {
102
108
  DELETE_BY_STATUS: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.DELETE_BY_STATUS}`,
103
109
  UPDATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.UPDATE}`,
@@ -110,8 +116,6 @@ exports.REST_API = {
110
116
  RESET_TRAFFIC: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.ALL.RESET_TRAFFIC}`,
111
117
  },
112
118
  },
113
- GET_BY_TELEGRAM_ID: (telegramId) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_TELEGRAM_ID}/${telegramId}`,
114
- GET_BY_EMAIL: (email) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_EMAIL}/${email}`,
115
119
  STATS: {
116
120
  GET_USAGE_BY_RANGE: (uuid) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.STATS.GET_USAGE_BY_RANGE}/${uuid}`,
117
121
  },
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActivateAllInboundsCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var ActivateAllInboundsCommand;
8
9
  (function (ActivateAllInboundsCommand) {
9
- ActivateAllInboundsCommand.url = api_1.REST_API.USERS.ACTIVATE_ALL_INBOUNDS;
10
+ ActivateAllInboundsCommand.url = api_1.REST_API.USERS.ACTIONS.ACTIVATE_ALL_INBOUNDS;
10
11
  ActivateAllInboundsCommand.TSQ_url = ActivateAllInboundsCommand.url(':uuid');
12
+ ActivateAllInboundsCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.ACTIONS.ACTIVATE_ALL_INBOUNDS(':uuid'), 'post', 'Activate all inbounds');
11
13
  ActivateAllInboundsCommand.RequestSchema = zod_1.z.object({
12
14
  uuid: zod_1.z.string().uuid(),
13
15
  });
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CreateUserCommand = void 0;
4
4
  const zod_1 = require("zod");
5
- const models_1 = require("../../models");
6
5
  const constants_1 = require("../../constants");
6
+ const models_1 = require("../../models");
7
7
  const api_1 = require("../../api");
8
8
  var CreateUserCommand;
9
9
  (function (CreateUserCommand) {
10
10
  CreateUserCommand.url = api_1.REST_API.USERS.CREATE;
11
11
  CreateUserCommand.TSQ_url = CreateUserCommand.url;
12
+ CreateUserCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.CREATE, 'post', 'Create a new user');
12
13
  CreateUserCommand.RequestSchema = zod_1.z.object({
13
14
  username: zod_1.z
14
15
  .string({
@@ -105,7 +106,11 @@ var CreateUserCommand;
105
106
  description: zod_1.z.string().optional(),
106
107
  telegramId: zod_1.z.optional(zod_1.z.number().int()),
107
108
  email: zod_1.z.string().email('Invalid email format').optional(),
108
- hwidDeviceLimit: zod_1.z.optional(zod_1.z.number().int()),
109
+ hwidDeviceLimit: zod_1.z.optional(zod_1.z
110
+ .number({ invalid_type_error: 'Device limit must be a number' })
111
+ .int('Device limit must be an integer')
112
+ .min(0, 'Device limit must be greater than 0')
113
+ .describe('Device limit')),
109
114
  activateAllInbounds: zod_1.z.boolean().optional(),
110
115
  });
111
116
  CreateUserCommand.ResponseSchema = zod_1.z.object({
@@ -2,11 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeleteUserCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const api_1 = require("../../api");
6
7
  var DeleteUserCommand;
7
8
  (function (DeleteUserCommand) {
8
- DeleteUserCommand.url = api_1.REST_API.USERS.DELETE_USER;
9
+ DeleteUserCommand.url = api_1.REST_API.USERS.DELETE;
9
10
  DeleteUserCommand.TSQ_url = DeleteUserCommand.url(':uuid');
11
+ DeleteUserCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.DELETE(':uuid'), 'delete', 'Delete user');
10
12
  DeleteUserCommand.RequestSchema = zod_1.z.object({
11
13
  uuid: zod_1.z.string().uuid(),
12
14
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DisableUserCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var DisableUserCommand;
8
9
  (function (DisableUserCommand) {
9
- DisableUserCommand.url = api_1.REST_API.USERS.DISABLE_USER;
10
+ DisableUserCommand.url = api_1.REST_API.USERS.ACTIONS.DISABLE;
10
11
  DisableUserCommand.TSQ_url = DisableUserCommand.url(':uuid');
12
+ DisableUserCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.ACTIONS.DISABLE(':uuid'), 'post', 'Disable user');
11
13
  DisableUserCommand.RequestSchema = zod_1.z.object({
12
14
  uuid: zod_1.z.string().uuid(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EnableUserCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var EnableUserCommand;
8
9
  (function (EnableUserCommand) {
9
- EnableUserCommand.url = api_1.REST_API.USERS.ENABLE_USER;
10
+ EnableUserCommand.url = api_1.REST_API.USERS.ACTIONS.ENABLE;
10
11
  EnableUserCommand.TSQ_url = EnableUserCommand.url(':uuid');
12
+ EnableUserCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.ACTIONS.ENABLE(':uuid'), 'post', 'Enable user');
11
13
  EnableUserCommand.RequestSchema = zod_1.z.object({
12
14
  uuid: zod_1.z.string().uuid(),
13
15
  });
@@ -1,13 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetAllUsersV2Command = void 0;
3
+ exports.GetAllUsersCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
- var GetAllUsersV2Command;
8
- (function (GetAllUsersV2Command) {
9
- GetAllUsersV2Command.url = api_1.REST_API.USERS.GET_ALL_V2;
10
- GetAllUsersV2Command.TSQ_url = GetAllUsersV2Command.url;
8
+ var GetAllUsersCommand;
9
+ (function (GetAllUsersCommand) {
10
+ GetAllUsersCommand.url = api_1.REST_API.USERS.GET;
11
+ GetAllUsersCommand.TSQ_url = GetAllUsersCommand.url;
12
+ GetAllUsersCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET, 'get', 'Get all users');
11
13
  const FilterSchema = zod_1.z.object({
12
14
  id: zod_1.z.string(),
13
15
  value: zod_1.z.unknown(),
@@ -16,7 +18,7 @@ var GetAllUsersV2Command;
16
18
  id: zod_1.z.string(),
17
19
  desc: zod_1.z.boolean(),
18
20
  });
19
- GetAllUsersV2Command.RequestQuerySchema = zod_1.z.object({
21
+ GetAllUsersCommand.RequestQuerySchema = zod_1.z.object({
20
22
  start: zod_1.z.coerce
21
23
  .number()
22
24
  .default(0)
@@ -38,10 +40,10 @@ var GetAllUsersV2Command;
38
40
  .preprocess((str) => (typeof str === 'string' ? JSON.parse(str) : str), zod_1.z.array(SortingSchema))
39
41
  .optional(),
40
42
  });
41
- GetAllUsersV2Command.ResponseSchema = zod_1.z.object({
43
+ GetAllUsersCommand.ResponseSchema = zod_1.z.object({
42
44
  response: zod_1.z.object({
43
45
  users: zod_1.z.array(models_1.ExtendedUsersSchema),
44
46
  total: zod_1.z.number(),
45
47
  }),
46
48
  });
47
- })(GetAllUsersV2Command || (exports.GetAllUsersV2Command = GetAllUsersV2Command = {}));
49
+ })(GetAllUsersCommand || (exports.GetAllUsersCommand = GetAllUsersCommand = {}));
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetUserByEmailCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var GetUserByEmailCommand;
8
9
  (function (GetUserByEmailCommand) {
9
- GetUserByEmailCommand.url = api_1.REST_API.USERS.GET_BY_EMAIL;
10
+ GetUserByEmailCommand.url = api_1.REST_API.USERS.GET_BY.EMAIL;
10
11
  GetUserByEmailCommand.TSQ_url = GetUserByEmailCommand.url(':email');
12
+ GetUserByEmailCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET_BY.EMAIL(':email'), 'get', 'Get users by email');
11
13
  GetUserByEmailCommand.RequestSchema = zod_1.z.object({
12
14
  email: zod_1.z.string().email(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetUserByShortUuidCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var GetUserByShortUuidCommand;
8
9
  (function (GetUserByShortUuidCommand) {
9
- GetUserByShortUuidCommand.url = api_1.REST_API.USERS.GET_BY_SHORT_UUID;
10
+ GetUserByShortUuidCommand.url = api_1.REST_API.USERS.GET_BY.SHORT_UUID;
10
11
  GetUserByShortUuidCommand.TSQ_url = GetUserByShortUuidCommand.url(':shortUuid');
12
+ GetUserByShortUuidCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET_BY.SHORT_UUID(':shortUuid'), 'get', 'Get user by Short UUID');
11
13
  GetUserByShortUuidCommand.RequestSchema = zod_1.z.object({
12
14
  shortUuid: zod_1.z.string(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetUserBySubscriptionUuidCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var GetUserBySubscriptionUuidCommand;
8
9
  (function (GetUserBySubscriptionUuidCommand) {
9
- GetUserBySubscriptionUuidCommand.url = api_1.REST_API.USERS.GET_BY_SUBSCRIPTION_UUID;
10
+ GetUserBySubscriptionUuidCommand.url = api_1.REST_API.USERS.GET_BY.SUBSCRIPTION_UUID;
10
11
  GetUserBySubscriptionUuidCommand.TSQ_url = GetUserBySubscriptionUuidCommand.url(':subscriptionUuid');
12
+ GetUserBySubscriptionUuidCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET_BY.SUBSCRIPTION_UUID(':subscriptionUuid'), 'get', 'Get user by subscription UUID');
11
13
  GetUserBySubscriptionUuidCommand.RequestSchema = zod_1.z.object({
12
14
  subscriptionUuid: zod_1.z.string(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetUserByTelegramIdCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var GetUserByTelegramIdCommand;
8
9
  (function (GetUserByTelegramIdCommand) {
9
- GetUserByTelegramIdCommand.url = api_1.REST_API.USERS.GET_BY_TELEGRAM_ID;
10
+ GetUserByTelegramIdCommand.url = api_1.REST_API.USERS.GET_BY.TELEGRAM_ID;
10
11
  GetUserByTelegramIdCommand.TSQ_url = GetUserByTelegramIdCommand.url(':telegramId');
12
+ GetUserByTelegramIdCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET_BY.TELEGRAM_ID(':telegramId'), 'get', 'Get users by telegram ID');
11
13
  GetUserByTelegramIdCommand.RequestSchema = zod_1.z.object({
12
14
  telegramId: zod_1.z.string(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetUserByUsernameCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var GetUserByUsernameCommand;
8
9
  (function (GetUserByUsernameCommand) {
9
- GetUserByUsernameCommand.url = api_1.REST_API.USERS.GET_BY_USERNAME;
10
+ GetUserByUsernameCommand.url = api_1.REST_API.USERS.GET_BY.USERNAME;
10
11
  GetUserByUsernameCommand.TSQ_url = GetUserByUsernameCommand.url(':username');
12
+ GetUserByUsernameCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET_BY.USERNAME(':username'), 'get', 'Get user by username');
11
13
  GetUserByUsernameCommand.RequestSchema = zod_1.z.object({
12
14
  username: zod_1.z.string(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetUserByUuidCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var GetUserByUuidCommand;
8
9
  (function (GetUserByUuidCommand) {
9
10
  GetUserByUuidCommand.url = api_1.REST_API.USERS.GET_BY_UUID;
10
11
  GetUserByUuidCommand.TSQ_url = GetUserByUuidCommand.url(':uuid');
12
+ GetUserByUuidCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.GET_BY_UUID(':uuid'), 'get', 'Get user by UUID');
11
13
  GetUserByUuidCommand.RequestSchema = zod_1.z.object({
12
14
  uuid: zod_1.z.string().uuid(),
13
15
  });
@@ -21,7 +21,7 @@ __exportStar(require("./create-user.command"), exports);
21
21
  __exportStar(require("./delete-user.command"), exports);
22
22
  __exportStar(require("./disable-user.command"), exports);
23
23
  __exportStar(require("./enable-user.command"), exports);
24
- __exportStar(require("./get-all-users-v2.command"), exports);
24
+ __exportStar(require("./get-all-users.command"), exports);
25
25
  __exportStar(require("./get-user-by-email.command"), exports);
26
26
  __exportStar(require("./get-user-by-short-uuid.command"), exports);
27
27
  __exportStar(require("./get-user-by-subscription-uuid.command"), exports);
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResetUserTrafficCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var ResetUserTrafficCommand;
8
9
  (function (ResetUserTrafficCommand) {
9
- ResetUserTrafficCommand.url = api_1.REST_API.USERS.RESET_USER_TRAFFIC;
10
+ ResetUserTrafficCommand.url = api_1.REST_API.USERS.ACTIONS.RESET_TRAFFIC;
10
11
  ResetUserTrafficCommand.TSQ_url = ResetUserTrafficCommand.url(':uuid');
12
+ ResetUserTrafficCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.ACTIONS.RESET_TRAFFIC(':uuid'), 'post', 'Reset user traffic');
11
13
  ResetUserTrafficCommand.RequestSchema = zod_1.z.object({
12
14
  uuid: zod_1.z.string().uuid(),
13
15
  });
@@ -2,12 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RevokeUserSubscriptionCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
5
6
  const models_1 = require("../../models");
6
7
  const api_1 = require("../../api");
7
8
  var RevokeUserSubscriptionCommand;
8
9
  (function (RevokeUserSubscriptionCommand) {
9
- RevokeUserSubscriptionCommand.url = api_1.REST_API.USERS.REVOKE_SUBSCRIPTION;
10
+ RevokeUserSubscriptionCommand.url = api_1.REST_API.USERS.ACTIONS.REVOKE_SUBSCRIPTION;
10
11
  RevokeUserSubscriptionCommand.TSQ_url = RevokeUserSubscriptionCommand.url(':uuid');
12
+ RevokeUserSubscriptionCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.ACTIONS.REVOKE_SUBSCRIPTION(':uuid'), 'post', 'Revoke user subscription');
11
13
  RevokeUserSubscriptionCommand.RequestSchema = zod_1.z.object({
12
14
  uuid: zod_1.z.string().uuid(),
13
15
  });
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UpdateUserCommand = void 0;
4
4
  const zod_1 = require("zod");
5
- const models_1 = require("../../models");
6
5
  const constants_1 = require("../../constants");
6
+ const models_1 = require("../../models");
7
7
  const api_1 = require("../../api");
8
8
  var UpdateUserCommand;
9
9
  (function (UpdateUserCommand) {
10
10
  UpdateUserCommand.url = api_1.REST_API.USERS.UPDATE;
11
11
  UpdateUserCommand.TSQ_url = UpdateUserCommand.url;
12
+ UpdateUserCommand.baseApiEndpoint = (0, constants_1.getBaseApiEndpoint)(api_1.USERS_ROUTES.UPDATE, 'patch', 'Update a user');
12
13
  UpdateUserCommand.RequestSchema = models_1.UsersSchema.pick({
13
14
  uuid: true,
14
15
  }).extend({
@@ -52,7 +53,7 @@ var UpdateUserCommand;
52
53
  description: zod_1.z.optional(zod_1.z.string().nullable()),
53
54
  telegramId: zod_1.z.optional(zod_1.z.number().int().nullable()),
54
55
  email: zod_1.z.optional(zod_1.z.string().email('Invalid email format').nullable()),
55
- hwidDeviceLimit: zod_1.z.optional(zod_1.z.number().int().nullable()),
56
+ hwidDeviceLimit: zod_1.z.optional(zod_1.z.number().int().min(0, 'Device limit must be non-negative').nullable()),
56
57
  });
57
58
  UpdateUserCommand.ResponseSchema = zod_1.z.object({
58
59
  response: models_1.ExtendedUsersSchema,
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBaseApiEndpoint = getBaseApiEndpoint;
4
+ function getBaseApiEndpoint(controllerUrl, requestMethod, methodDescription) {
5
+ return {
6
+ CONTROLLER_URL: controllerUrl,
7
+ REQUEST_METHOD: requestMethod,
8
+ METHOD_DESCRIPTION: methodDescription,
9
+ };
10
+ }
@@ -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("./base-api-endpoint"), exports);
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./base-api"), exports);
17
18
  __exportStar(require("./errors"), exports);
18
19
  __exportStar(require("./events"), exports);
19
20
  __exportStar(require("./hosts"), exports);
@@ -4,7 +4,7 @@ exports.HwidUserDeviceSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.HwidUserDeviceSchema = zod_1.z.object({
6
6
  hwid: zod_1.z.string(),
7
- userUuid: zod_1.z.string(),
7
+ userUuid: zod_1.z.string().uuid(),
8
8
  platform: zod_1.z.nullable(zod_1.z.string()),
9
9
  osVersion: zod_1.z.nullable(zod_1.z.string()),
10
10
  deviceModel: zod_1.z.nullable(zod_1.z.string()),
@@ -19,7 +19,7 @@ exports.SubscriptionSettingsSchema = zod_1.z.object({
19
19
  expiredUsersRemarks: zod_1.z.array(zod_1.z.string()),
20
20
  limitedUsersRemarks: zod_1.z.array(zod_1.z.string()),
21
21
  disabledUsersRemarks: zod_1.z.array(zod_1.z.string()),
22
- customResponseHeaders: zod_1.z.nullable(zod_1.z.record(zod_1.z.string(), zod_1.z.string())),
22
+ customResponseHeaders: zod_1.z.nullable(zod_1.z.record(zod_1.z.string().regex(/^[!#$%&'*+-.^_`|~0-9a-zA-Z]+$/, 'Invalid header name'), zod_1.z.string())),
23
23
  createdAt: zod_1.z
24
24
  .string()
25
25
  .datetime()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "0.4.4",
3
+ "version": "0.5.0",
4
4
  "public": true,
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "A contract library for Remnawave Backend. It can be used in backend and frontend.",
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-all-users-v2.command.d.ts","sourceRoot":"","sources":["../../../../commands/users/get-all-users-v2.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,yBAAiB,oBAAoB,CAAC;IAC3B,MAAM,GAAG,iBAA4B,CAAC;IACtC,MAAM,OAAO,iBAAM,CAAC;IAYpB,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiC7B,CAAC;IAEH,KAAY,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAEvD,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAKzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}