@remnawave/backend-contract 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. package/api/controllers/api-tokens.ts +7 -0
  2. package/api/controllers/auth.ts +5 -0
  3. package/api/controllers/hosts.ts +9 -0
  4. package/api/controllers/inbounds.ts +5 -0
  5. package/api/controllers/index.ts +9 -0
  6. package/api/controllers/keygen.ts +5 -0
  7. package/api/controllers/nodes.ts +14 -0
  8. package/api/controllers/subscription.ts +6 -0
  9. package/api/controllers/users.ts +13 -0
  10. package/api/controllers/xray.ts +6 -0
  11. package/api/index.ts +2 -0
  12. package/api/routes.ts +73 -0
  13. package/build/api/controllers/api-tokens.js +9 -0
  14. package/build/api/controllers/auth.js +7 -0
  15. package/build/api/controllers/hosts.js +11 -0
  16. package/build/api/controllers/inbounds.js +7 -0
  17. package/build/api/controllers/index.js +25 -0
  18. package/build/api/controllers/keygen.js +7 -0
  19. package/build/api/controllers/nodes.js +15 -0
  20. package/build/api/controllers/subscription.js +8 -0
  21. package/build/api/controllers/users.js +15 -0
  22. package/build/api/controllers/xray.js +8 -0
  23. package/build/api/index.js +18 -0
  24. package/build/api/routes.js +81 -0
  25. package/build/commands/api-tokens/create.command.js +19 -0
  26. package/build/commands/api-tokens/delete.command.js +15 -0
  27. package/build/commands/api-tokens/find.command.js +13 -0
  28. package/build/commands/api-tokens/index.js +19 -0
  29. package/build/commands/auth/index.js +17 -0
  30. package/build/commands/auth/login.command.js +18 -0
  31. package/build/commands/hosts/create.command.js +50 -0
  32. package/build/commands/hosts/delete.command.js +17 -0
  33. package/build/commands/hosts/index.js +18 -0
  34. package/build/commands/inbounds/get-inbounds.command.js +13 -0
  35. package/build/commands/inbounds/index.js +17 -0
  36. package/build/commands/index.js +25 -0
  37. package/build/commands/keygen/get-pubkey.command.js +14 -0
  38. package/build/commands/keygen/index.js +17 -0
  39. package/build/commands/nodes/create.command.js +36 -0
  40. package/build/commands/nodes/delete.command.js +17 -0
  41. package/build/commands/nodes/disable.command.js +16 -0
  42. package/build/commands/nodes/enable.command.js +16 -0
  43. package/build/commands/nodes/get-all.command.js +13 -0
  44. package/build/commands/nodes/get-one.command.js +16 -0
  45. package/build/commands/nodes/index.js +25 -0
  46. package/build/commands/nodes/restart-all.command.js +14 -0
  47. package/build/commands/nodes/restart.command.js +17 -0
  48. package/build/commands/nodes/update.command.js +38 -0
  49. package/build/commands/subscription/get-subscription-by-short-uuid.command.js +12 -0
  50. package/build/commands/subscription/get-subscription-info-by-short-uuid.command.js +28 -0
  51. package/build/commands/subscription/index.js +18 -0
  52. package/build/commands/users/create-user.command.js +94 -0
  53. package/build/commands/users/delete-user.command.js +17 -0
  54. package/build/commands/users/disable-user.command.ts.js +16 -0
  55. package/build/commands/users/enable-user.command.js +16 -0
  56. package/build/commands/users/get-all-users.command.js +23 -0
  57. package/build/commands/users/get-user-by-short-uuid.command.js +16 -0
  58. package/build/commands/users/get-user-by-subscription-uuid.command.js +16 -0
  59. package/build/commands/users/get-user-by-uuid.command.js +16 -0
  60. package/build/commands/users/index.js +25 -0
  61. package/build/commands/users/revoke-user-subscription.command.js +16 -0
  62. package/build/commands/xray/get-config.command.js +14 -0
  63. package/build/commands/xray/index.js +17 -0
  64. package/build/constants/errors/errors.js +236 -0
  65. package/build/constants/errors/index.js +17 -0
  66. package/build/constants/hosts/alpn.js +9 -0
  67. package/build/constants/hosts/fingerprints.js +15 -0
  68. package/build/constants/hosts/index.js +18 -0
  69. package/build/constants/index.js +22 -0
  70. package/build/constants/nodes/cycle/cycle.js +8 -0
  71. package/build/constants/nodes/cycle/index.js +17 -0
  72. package/build/constants/nodes/index.js +18 -0
  73. package/build/constants/nodes/status/index.js +17 -0
  74. package/build/constants/nodes/status/status.constant.js +9 -0
  75. package/build/constants/roles/index.js +17 -0
  76. package/build/constants/roles/role.js +7 -0
  77. package/build/constants/templates/index.js +18 -0
  78. package/build/constants/templates/template-keys.js +4 -0
  79. package/build/constants/templates/user-statuses.js +9 -0
  80. package/build/constants/users/index.js +18 -0
  81. package/build/constants/users/reset-periods/index.js +17 -0
  82. package/build/constants/users/reset-periods/reset-periods.constant.js +11 -0
  83. package/build/constants/users/status/index.js +17 -0
  84. package/build/constants/users/status/status.constant.js +10 -0
  85. package/build/index.js +20 -0
  86. package/build/models/api-tokens.schema.js +12 -0
  87. package/build/models/auth.schema.js +7 -0
  88. package/build/models/hosts.schema.js +19 -0
  89. package/build/models/inbounds.schema.js +9 -0
  90. package/build/models/index.js +22 -0
  91. package/build/models/nodes.schema.js +28 -0
  92. package/build/models/users.schema.js +34 -0
  93. package/commands/api-tokens/create.command.ts +22 -0
  94. package/commands/api-tokens/delete.command.ts +18 -0
  95. package/commands/api-tokens/find.command.ts +13 -0
  96. package/commands/api-tokens/index.ts +3 -0
  97. package/commands/auth/index.ts +1 -0
  98. package/commands/auth/login.command.ts +20 -0
  99. package/commands/hosts/create.command.ts +52 -0
  100. package/commands/hosts/delete.command.ts +20 -0
  101. package/commands/hosts/index.ts +2 -0
  102. package/commands/inbounds/get-inbounds.command.ts +13 -0
  103. package/commands/inbounds/index.ts +1 -0
  104. package/commands/index.ts +9 -0
  105. package/commands/keygen/get-pubkey.command.ts +14 -0
  106. package/commands/keygen/index.ts +1 -0
  107. package/commands/nodes/create.command.ts +39 -0
  108. package/commands/nodes/delete.command.ts +20 -0
  109. package/commands/nodes/disable.command.ts +19 -0
  110. package/commands/nodes/enable.command.ts +19 -0
  111. package/commands/nodes/get-all.command.ts +13 -0
  112. package/commands/nodes/get-one.command.ts +19 -0
  113. package/commands/nodes/index.ts +9 -0
  114. package/commands/nodes/restart-all.command.ts +13 -0
  115. package/commands/nodes/restart.command.ts +20 -0
  116. package/commands/nodes/update.command.ts +41 -0
  117. package/commands/subscription/get-subscription-by-short-uuid.command.ts +12 -0
  118. package/commands/subscription/get-subscription-info-by-short-uuid.command.ts +31 -0
  119. package/commands/subscription/index.ts +2 -0
  120. package/commands/users/create-user.command.ts +103 -0
  121. package/commands/users/delete-user.command.ts +19 -0
  122. package/commands/users/disable-user.command.ts.ts +18 -0
  123. package/commands/users/enable-user.command.ts +19 -0
  124. package/commands/users/get-all-users.command.ts +26 -0
  125. package/commands/users/get-user-by-short-uuid.command.ts +19 -0
  126. package/commands/users/get-user-by-subscription-uuid.command.ts +19 -0
  127. package/commands/users/get-user-by-uuid.command.ts +19 -0
  128. package/commands/users/index.ts +9 -0
  129. package/commands/users/revoke-user-subscription.command.ts +19 -0
  130. package/commands/xray/get-config.command.ts +12 -0
  131. package/commands/xray/index.ts +1 -0
  132. package/constants/errors/errors.ts +233 -0
  133. package/constants/errors/index.ts +1 -0
  134. package/constants/hosts/alpn.ts +8 -0
  135. package/constants/hosts/fingerprints.ts +14 -0
  136. package/constants/hosts/index.ts +2 -0
  137. package/constants/index.ts +6 -0
  138. package/constants/nodes/cycle/cycle.ts +7 -0
  139. package/constants/nodes/cycle/index.ts +1 -0
  140. package/constants/nodes/index.ts +2 -0
  141. package/constants/nodes/status/index.ts +1 -0
  142. package/constants/nodes/status/status.constant.ts +8 -0
  143. package/constants/roles/index.ts +1 -0
  144. package/constants/roles/role.ts +7 -0
  145. package/constants/templates/index.ts +2 -0
  146. package/constants/templates/template-keys.ts +2 -0
  147. package/constants/templates/user-statuses.ts +6 -0
  148. package/constants/users/index.ts +2 -0
  149. package/constants/users/reset-periods/index.ts +1 -0
  150. package/constants/users/reset-periods/reset-periods.constant.ts +10 -0
  151. package/constants/users/status/index.ts +1 -0
  152. package/constants/users/status/status.constant.ts +9 -0
  153. package/index.ts +4 -0
  154. package/models/api-tokens.schema.ts +11 -0
  155. package/models/auth.schema.ts +5 -0
  156. package/models/hosts.schema.ts +17 -0
  157. package/models/inbounds.schema.ts +7 -0
  158. package/models/index.ts +6 -0
  159. package/models/nodes.schema.ts +28 -0
  160. package/models/users.schema.ts +38 -0
  161. package/package.json +16 -0
  162. package/tsconfig.json +103 -0
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERRORS = void 0;
4
+ exports.ERRORS = {
5
+ INTERNAL_SERVER_ERROR: { code: 'A001', message: 'Server error', httpCode: 500 },
6
+ LOGIN_ERROR: { code: 'A002', message: 'Login error', httpCode: 500 },
7
+ UNAUTHORIZED: { code: 'A003', message: 'Unauthorized', httpCode: 401 },
8
+ FORBIDDEN_ROLE_ERROR: { code: 'A004', message: 'Forbidden role error', httpCode: 403 },
9
+ CREATE_API_TOKEN_ERROR: { code: 'A005', message: 'Create API token error', httpCode: 500 },
10
+ DELETE_API_TOKEN_ERROR: { code: 'A006', message: 'Delete API token error', httpCode: 500 },
11
+ REQUESTED_TOKEN_NOT_FOUND: {
12
+ code: 'A007',
13
+ message: 'Requested token not found',
14
+ httpCode: 404,
15
+ },
16
+ FIND_ALL_API_TOKENS_ERROR: {
17
+ code: 'A008',
18
+ message: 'Find all API tokens error',
19
+ httpCode: 500,
20
+ },
21
+ GET_PUBLIC_KEY_ERROR: {
22
+ code: 'A009',
23
+ message: 'Get public key error',
24
+ httpCode: 500,
25
+ },
26
+ ENABLE_NODE_ERROR: {
27
+ code: 'A010',
28
+ message: 'Enable node error',
29
+ httpCode: 500,
30
+ },
31
+ NODE_NOT_FOUND: {
32
+ code: 'A011',
33
+ message: 'Node not found',
34
+ httpCode: 404,
35
+ },
36
+ CONFIG_NOT_FOUND: {
37
+ code: 'A012',
38
+ message: 'Configuration not found',
39
+ httpCode: 404,
40
+ },
41
+ UPDATE_CONFIG_ERROR: {
42
+ code: 'A013',
43
+ message: 'Error updating configuration',
44
+ httpCode: 500,
45
+ },
46
+ GET_CONFIG_ERROR: {
47
+ code: 'A014',
48
+ message: 'Error retrieving configuration',
49
+ httpCode: 500,
50
+ },
51
+ DELETE_MANY_INBOUNDS_ERROR: {
52
+ code: 'A015',
53
+ message: 'Delete many inbounds error',
54
+ httpCode: 500,
55
+ },
56
+ CREATE_MANY_INBOUNDS_ERROR: {
57
+ code: 'A016',
58
+ message: 'Create many inbounds error',
59
+ httpCode: 500,
60
+ },
61
+ FIND_ALL_INBOUNDS_ERROR: {
62
+ code: 'A017',
63
+ message: 'Find all inbounds error',
64
+ httpCode: 500,
65
+ },
66
+ CREATE_USER_ERROR: {
67
+ code: 'A018',
68
+ message: 'Failed to create user',
69
+ httpCode: 500,
70
+ },
71
+ USER_USERNAME_ALREADY_EXISTS: {
72
+ code: 'A019',
73
+ message: 'User username already exists',
74
+ httpCode: 400,
75
+ },
76
+ USER_SHORT_UUID_ALREADY_EXISTS: {
77
+ code: 'A020',
78
+ message: 'User short UUID already exists',
79
+ httpCode: 400,
80
+ },
81
+ USER_SUBSCRIPTION_UUID_ALREADY_EXISTS: {
82
+ code: 'A021',
83
+ message: 'User subscription UUID already exists',
84
+ httpCode: 400,
85
+ },
86
+ CREATE_USER_WITH_INBOUNDS_ERROR: {
87
+ code: 'A022',
88
+ message: 'User creation successful, but inbound creation failed. User not created.',
89
+ httpCode: 500,
90
+ },
91
+ CANT_GET_CREATED_USER_WITH_INBOUNDS: {
92
+ code: 'A023',
93
+ message: 'User creation successful, but failed to get created user with inbounds.',
94
+ httpCode: 500,
95
+ },
96
+ GET_ALL_USERS_ERROR: {
97
+ code: 'A024',
98
+ message: 'Get all users error',
99
+ httpCode: 500,
100
+ },
101
+ USER_NOT_FOUND: {
102
+ code: 'A025',
103
+ message: 'User not found',
104
+ httpCode: 404,
105
+ },
106
+ GET_USER_BY_ERROR: {
107
+ code: 'A026',
108
+ message: 'Get user by error',
109
+ httpCode: 500,
110
+ },
111
+ REVOKE_USER_SUBSCRIPTION_ERROR: {
112
+ code: 'A027',
113
+ message: 'Revoke user subscription error',
114
+ httpCode: 500,
115
+ },
116
+ DISABLE_USER_ERROR: {
117
+ code: 'A028',
118
+ message: 'Disable user error',
119
+ httpCode: 500,
120
+ },
121
+ USER_ALREADY_DISABLED: {
122
+ code: 'A029',
123
+ message: 'User already disabled',
124
+ httpCode: 400,
125
+ },
126
+ USER_ALREADY_ENABLED: {
127
+ code: 'A030',
128
+ message: 'User already enabled',
129
+ httpCode: 400,
130
+ },
131
+ ENABLE_USER_ERROR: {
132
+ code: 'A031',
133
+ message: 'Enable user error',
134
+ httpCode: 500,
135
+ },
136
+ CREATE_NODE_ERROR: {
137
+ code: 'A032',
138
+ message: 'Create node error',
139
+ httpCode: 500,
140
+ },
141
+ NODE_NAME_ALREADY_EXISTS: {
142
+ code: 'A033',
143
+ message: 'Node name already exists',
144
+ httpCode: 400,
145
+ },
146
+ NODE_ADDRESS_ALREADY_EXISTS: {
147
+ code: 'A034',
148
+ message: 'Node address already exists',
149
+ httpCode: 400,
150
+ },
151
+ NODE_ERROR_WITH_MSG: {
152
+ code: 'N001',
153
+ message: '',
154
+ httpCode: 500,
155
+ withMessage: (message) => ({
156
+ code: 'N001',
157
+ message,
158
+ httpCode: 500,
159
+ }),
160
+ },
161
+ NODE_ERROR_500_WITH_MSG: {
162
+ code: 'N002',
163
+ message: '',
164
+ httpCode: 500,
165
+ withMessage: (message) => ({
166
+ code: 'N002',
167
+ message,
168
+ httpCode: 500,
169
+ }),
170
+ },
171
+ RESTART_NODE_ERROR: {
172
+ code: 'A035',
173
+ message: 'Restart node error',
174
+ httpCode: 500,
175
+ },
176
+ GET_CONFIG_WITH_USERS_ERROR: {
177
+ code: 'A036',
178
+ message: 'Get config with users error',
179
+ httpCode: 500,
180
+ },
181
+ DELETE_USER_ERROR: {
182
+ code: 'A037',
183
+ message: 'Delete user error',
184
+ httpCode: 500,
185
+ },
186
+ UPDATE_NODE_ERROR: {
187
+ code: 'A038',
188
+ message: 'Update node error',
189
+ httpCode: 500,
190
+ },
191
+ UPDATE_USER_ERROR: {
192
+ code: 'A039',
193
+ message: 'Update user error',
194
+ httpCode: 500,
195
+ },
196
+ INCREMENT_USED_TRAFFIC_ERROR: {
197
+ code: 'A040',
198
+ message: 'Increment used traffic error',
199
+ httpCode: 500,
200
+ },
201
+ GET_ALL_NODES_ERROR: {
202
+ code: 'A041',
203
+ message: 'Get all nodes error',
204
+ httpCode: 500,
205
+ },
206
+ GET_ONE_NODE_ERROR: {
207
+ code: 'A042',
208
+ message: 'Get one node error',
209
+ httpCode: 500,
210
+ },
211
+ DELETE_NODE_ERROR: {
212
+ code: 'A043',
213
+ message: 'Delete node error',
214
+ httpCode: 500,
215
+ },
216
+ CREATE_HOST_ERROR: {
217
+ code: 'A044',
218
+ message: 'Create host error',
219
+ httpCode: 500,
220
+ },
221
+ HOST_REMARK_ALREADY_EXISTS: {
222
+ code: 'A045',
223
+ message: 'Host remark already exists',
224
+ httpCode: 400,
225
+ },
226
+ HOST_NOT_FOUND: {
227
+ code: 'A046',
228
+ message: 'Host not found',
229
+ httpCode: 404,
230
+ },
231
+ DELETE_HOST_ERROR: {
232
+ code: 'A047',
233
+ message: 'Delete host error',
234
+ httpCode: 500,
235
+ },
236
+ };
@@ -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("./errors"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ALPN_VALUES = exports.ALPN = void 0;
4
+ exports.ALPN = {
5
+ HTTP_1_1: 'http/1.1',
6
+ H2: 'h2',
7
+ H_COMBINED: 'h2,http/1.1',
8
+ };
9
+ exports.ALPN_VALUES = Object.values(exports.ALPN);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FINGERPRINTS_VALUES = exports.FINGERPRINTS = void 0;
4
+ exports.FINGERPRINTS = {
5
+ CHROME: 'chrome',
6
+ FIREFOX: 'firefox',
7
+ SAFARI: 'safari',
8
+ IOS: 'ios',
9
+ ANDROID: 'android',
10
+ EDGE: 'edge',
11
+ QQ: 'qq',
12
+ RANDOM: 'random',
13
+ RANDOMIZED: 'randomized',
14
+ };
15
+ exports.FINGERPRINTS_VALUES = Object.values(exports.FINGERPRINTS);
@@ -0,0 +1,18 @@
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("./alpn"), exports);
18
+ __exportStar(require("./fingerprints"), exports);
@@ -0,0 +1,22 @@
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("./errors"), exports);
18
+ __exportStar(require("./hosts"), exports);
19
+ __exportStar(require("./nodes"), exports);
20
+ __exportStar(require("./roles"), exports);
21
+ __exportStar(require("./templates"), exports);
22
+ __exportStar(require("./users"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NODES_CYCLE_VALUES = exports.NODES_CYCLE = void 0;
4
+ exports.NODES_CYCLE = {
5
+ MONTH: 'MONTH',
6
+ YEAR: 'YEAR',
7
+ };
8
+ exports.NODES_CYCLE_VALUES = Object.values(exports.NODES_CYCLE);
@@ -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("./cycle"), exports);
@@ -0,0 +1,18 @@
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("./status"), exports);
18
+ __exportStar(require("./cycle"), exports);
@@ -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("./status.constant"), exports);
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NODES_STATUS_VALUES = exports.NODES_STATUS = void 0;
4
+ exports.NODES_STATUS = {
5
+ CONNECTED: 'CONNECTED',
6
+ DISCONNECTED: 'DISCONNECTED',
7
+ DISABLED: 'DISABLED',
8
+ };
9
+ exports.NODES_STATUS_VALUES = Object.values(exports.NODES_STATUS);
@@ -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("./role"), exports);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ROLE = void 0;
4
+ exports.ROLE = {
5
+ ADMIN: 'ADMIN',
6
+ API: 'API',
7
+ };
@@ -0,0 +1,18 @@
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("./template-keys"), exports);
18
+ __exportStar(require("./user-statuses"), exports);
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEMPLATE_KEYS = void 0;
4
+ exports.TEMPLATE_KEYS = ['DAYS_LEFT', 'TRAFFIC_USED', 'TRAFFIC_LEFT', 'STATUS'];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_STATUSES_TEMPLATE = void 0;
4
+ exports.USER_STATUSES_TEMPLATE = {
5
+ ACTIVE: ' ✅ Active',
6
+ EXPIRED: ' ⚠️ Expired',
7
+ DISABLED: '❌ Disabled',
8
+ LIMITED: '🔴 Limited',
9
+ };
@@ -0,0 +1,18 @@
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("./reset-periods"), exports);
18
+ __exportStar(require("./status"), exports);
@@ -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("./reset-periods.constant"), exports);
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESET_PERIODS_VALUES = exports.RESET_PERIODS = void 0;
4
+ exports.RESET_PERIODS = {
5
+ NO_RESET: 'NO_RESET',
6
+ DAY: 'DAY',
7
+ WEEK: 'WEEK',
8
+ MONTH: 'MONTH',
9
+ YEAR: 'YEAR',
10
+ };
11
+ exports.RESET_PERIODS_VALUES = Object.values(exports.RESET_PERIODS);
@@ -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("./status.constant"), exports);
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USERS_STATUS_VALUES = exports.USERS_STATUS = void 0;
4
+ exports.USERS_STATUS = {
5
+ ACTIVE: 'ACTIVE',
6
+ DISABLED: 'DISABLED',
7
+ LIMITED: 'LIMITED',
8
+ EXPIRED: 'EXPIRED',
9
+ };
10
+ exports.USERS_STATUS_VALUES = Object.values(exports.USERS_STATUS);
package/build/index.js ADDED
@@ -0,0 +1,20 @@
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("./api"), exports);
18
+ __exportStar(require("./commands"), exports);
19
+ __exportStar(require("./constants"), exports);
20
+ __exportStar(require("./models"), exports);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiTokensSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ApiTokensSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ token: zod_1.z.string(),
8
+ tokenName: zod_1.z.string(),
9
+ tokenDescription: zod_1.z.nullable(zod_1.z.string()),
10
+ createdAt: zod_1.z.date(),
11
+ updatedAt: zod_1.z.date(),
12
+ });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.AuthSchema = zod_1.z.object({
6
+ hash: zod_1.z.string(),
7
+ });
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HostsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.HostsSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ inboundUuid: zod_1.z.string().uuid(),
8
+ viewPosition: zod_1.z.number().int(),
9
+ remark: zod_1.z.string(),
10
+ address: zod_1.z.string(),
11
+ port: zod_1.z.number().int(),
12
+ path: zod_1.z.string().nullable(),
13
+ sni: zod_1.z.string().nullable(),
14
+ host: zod_1.z.string().nullable(),
15
+ alpn: zod_1.z.string().nullable(),
16
+ fingerprint: zod_1.z.string().nullable(),
17
+ allowInsecure: zod_1.z.boolean().default(false),
18
+ isDisabled: zod_1.z.boolean().default(false),
19
+ });
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InboundsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.InboundsSchema = zod_1.z.object({
6
+ uuid: zod_1.z.string().uuid(),
7
+ tag: zod_1.z.string(),
8
+ type: zod_1.z.string(),
9
+ });
@@ -0,0 +1,22 @@
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("./api-tokens.schema"), exports);
18
+ __exportStar(require("./auth.schema"), exports);
19
+ __exportStar(require("./hosts.schema"), exports);
20
+ __exportStar(require("./inbounds.schema"), exports);
21
+ __exportStar(require("./nodes.schema"), exports);
22
+ __exportStar(require("./users.schema"), exports);