@remnawave/node-contract 0.2.0 → 0.2.2

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 (92) hide show
  1. package/build/api/controllers/handler.d.ts +8 -0
  2. package/build/api/controllers/handler.d.ts.map +1 -0
  3. package/{commands/index.ts → build/api/controllers/index.d.ts} +2 -1
  4. package/build/api/controllers/index.d.ts.map +1 -0
  5. package/build/api/controllers/stats.d.ts +9 -0
  6. package/build/api/controllers/stats.d.ts.map +1 -0
  7. package/build/api/controllers/xray.d.ts +7 -0
  8. package/build/api/controllers/xray.d.ts.map +1 -0
  9. package/{api/index.ts → build/api/index.d.ts} +1 -0
  10. package/build/api/index.d.ts.map +1 -0
  11. package/build/api/routes.d.ts +22 -0
  12. package/build/api/routes.d.ts.map +1 -0
  13. package/build/api/routes.js +6 -0
  14. package/build/commands/handler/add-user.command.d.ts +249 -0
  15. package/build/commands/handler/add-user.command.d.ts.map +1 -0
  16. package/build/commands/handler/get-inbound-users-count.command.d.ts +30 -0
  17. package/build/commands/handler/get-inbound-users-count.command.d.ts.map +1 -0
  18. package/build/commands/handler/get-inbound-users.command.d.ts +58 -0
  19. package/build/commands/handler/get-inbound-users.command.d.ts.map +1 -0
  20. package/{commands/handler/index.ts → build/commands/handler/index.d.ts} +1 -0
  21. package/build/commands/handler/index.d.ts.map +1 -0
  22. package/build/commands/handler/remove-user.command.d.ts +38 -0
  23. package/build/commands/handler/remove-user.command.d.ts.map +1 -0
  24. package/{api/controllers/index.ts → build/commands/index.d.ts} +2 -1
  25. package/build/commands/index.d.ts.map +1 -0
  26. package/build/commands/stats/get-inbound-stats.command.d.ts +43 -0
  27. package/build/commands/stats/get-inbound-stats.command.d.ts.map +1 -0
  28. package/build/commands/stats/get-outbound-stats.command.d.ts +43 -0
  29. package/build/commands/stats/get-outbound-stats.command.d.ts.map +1 -0
  30. package/build/commands/stats/get-system-stats.command.d.ts +67 -0
  31. package/build/commands/stats/get-system-stats.command.d.ts.map +1 -0
  32. package/build/commands/stats/get-user-online-status.command.d.ts +30 -0
  33. package/build/commands/stats/get-user-online-status.command.d.ts.map +1 -0
  34. package/build/commands/stats/get-users-stats.command.d.ts +58 -0
  35. package/build/commands/stats/get-users-stats.command.d.ts.map +1 -0
  36. package/{commands/stats/index.ts → build/commands/stats/index.d.ts} +1 -0
  37. package/build/commands/stats/index.d.ts.map +1 -0
  38. package/build/commands/xray/get-status-and-version.command.d.ts +28 -0
  39. package/build/commands/xray/get-status-and-version.command.d.ts.map +1 -0
  40. package/build/commands/xray/get-status-and-version.command.js +2 -0
  41. package/{commands/xray/index.ts → build/commands/xray/index.d.ts} +1 -0
  42. package/build/commands/xray/index.d.ts.map +1 -0
  43. package/build/commands/xray/start.command.d.ts +34 -0
  44. package/build/commands/xray/start.command.d.ts.map +1 -0
  45. package/build/commands/xray/stop.command.d.ts +22 -0
  46. package/build/commands/xray/stop.command.d.ts.map +1 -0
  47. package/build/constants/errors/errors.d.ts +63 -0
  48. package/build/constants/errors/errors.d.ts.map +1 -0
  49. package/build/constants/errors/index.d.ts +2 -0
  50. package/build/constants/errors/index.d.ts.map +1 -0
  51. package/{constants/index.ts → build/constants/index.d.ts} +1 -0
  52. package/build/constants/index.d.ts.map +1 -0
  53. package/build/constants/roles/index.d.ts +2 -0
  54. package/build/constants/roles/index.d.ts.map +1 -0
  55. package/build/constants/roles/role.d.ts +7 -0
  56. package/build/constants/roles/role.d.ts.map +1 -0
  57. package/build/constants/xray/index.d.ts +2 -0
  58. package/build/constants/xray/index.d.ts.map +1 -0
  59. package/build/constants/xray/stats.d.ts +28 -0
  60. package/build/constants/xray/stats.d.ts.map +1 -0
  61. package/{index.ts → build/index.d.ts} +1 -0
  62. package/build/index.d.ts.map +1 -0
  63. package/build/models/auth.schema.d.ts +9 -0
  64. package/build/models/auth.schema.d.ts.map +1 -0
  65. package/build/models/index.d.ts +2 -0
  66. package/build/models/index.d.ts.map +1 -0
  67. package/package.json +7 -3
  68. package/api/controllers/handler.ts +0 -8
  69. package/api/controllers/stats.ts +0 -10
  70. package/api/controllers/xray.ts +0 -7
  71. package/api/routes.ts +0 -18
  72. package/commands/handler/add-user.command.ts +0 -88
  73. package/commands/handler/get-inbound-users-count.command.ts +0 -17
  74. package/commands/handler/get-inbound-users.command.ts +0 -23
  75. package/commands/handler/remove-user.command.ts +0 -19
  76. package/commands/stats/get-inbound-stats.command.ts +0 -20
  77. package/commands/stats/get-outbound-stats.command.ts +0 -20
  78. package/commands/stats/get-system-stats.command.ts +0 -20
  79. package/commands/stats/get-user-online-status.command.ts +0 -17
  80. package/commands/stats/get-users-stats.command.ts +0 -23
  81. package/commands/xray/get-status-and-version.command.ts +0 -12
  82. package/commands/xray/start.command.ts +0 -17
  83. package/commands/xray/stop.command.ts +0 -11
  84. package/constants/errors/errors.ts +0 -38
  85. package/constants/errors/index.ts +0 -1
  86. package/constants/roles/index.ts +0 -1
  87. package/constants/roles/role.ts +0 -7
  88. package/constants/xray/index.ts +0 -1
  89. package/constants/xray/stats.ts +0 -45
  90. package/models/auth.schema.ts +0 -5
  91. package/models/index.ts +0 -1
  92. package/tsconfig.json +0 -95
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetSystemStatsCommand {
3
+ const ResponseSchema: z.ZodObject<{
4
+ response: z.ZodObject<{
5
+ numGoroutine: z.ZodNumber;
6
+ numGC: z.ZodNumber;
7
+ alloc: z.ZodNumber;
8
+ totalAlloc: z.ZodNumber;
9
+ sys: z.ZodNumber;
10
+ mallocs: z.ZodNumber;
11
+ frees: z.ZodNumber;
12
+ liveObjects: z.ZodNumber;
13
+ pauseTotalNs: z.ZodNumber;
14
+ uptime: z.ZodNumber;
15
+ }, "strip", z.ZodTypeAny, {
16
+ numGoroutine: number;
17
+ numGC: number;
18
+ alloc: number;
19
+ totalAlloc: number;
20
+ sys: number;
21
+ mallocs: number;
22
+ frees: number;
23
+ liveObjects: number;
24
+ pauseTotalNs: number;
25
+ uptime: number;
26
+ }, {
27
+ numGoroutine: number;
28
+ numGC: number;
29
+ alloc: number;
30
+ totalAlloc: number;
31
+ sys: number;
32
+ mallocs: number;
33
+ frees: number;
34
+ liveObjects: number;
35
+ pauseTotalNs: number;
36
+ uptime: number;
37
+ }>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ response: {
40
+ numGoroutine: number;
41
+ numGC: number;
42
+ alloc: number;
43
+ totalAlloc: number;
44
+ sys: number;
45
+ mallocs: number;
46
+ frees: number;
47
+ liveObjects: number;
48
+ pauseTotalNs: number;
49
+ uptime: number;
50
+ };
51
+ }, {
52
+ response: {
53
+ numGoroutine: number;
54
+ numGC: number;
55
+ alloc: number;
56
+ totalAlloc: number;
57
+ sys: number;
58
+ mallocs: number;
59
+ frees: number;
60
+ liveObjects: number;
61
+ pauseTotalNs: number;
62
+ uptime: number;
63
+ };
64
+ }>;
65
+ type Response = z.infer<typeof ResponseSchema>;
66
+ }
67
+ //# sourceMappingURL=get-system-stats.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-system-stats.command.d.ts","sourceRoot":"","sources":["../../../commands/stats/get-system-stats.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,qBAAqB,CAAC;IAC5B,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAazB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetUserOnlineStatusCommand {
3
+ const RequestSchema: z.ZodObject<{
4
+ username: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ username: string;
7
+ }, {
8
+ username: string;
9
+ }>;
10
+ type Request = z.infer<typeof RequestSchema>;
11
+ const ResponseSchema: z.ZodObject<{
12
+ response: z.ZodObject<{
13
+ isOnline: z.ZodBoolean;
14
+ }, "strip", z.ZodTypeAny, {
15
+ isOnline: boolean;
16
+ }, {
17
+ isOnline: boolean;
18
+ }>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ response: {
21
+ isOnline: boolean;
22
+ };
23
+ }, {
24
+ response: {
25
+ isOnline: boolean;
26
+ };
27
+ }>;
28
+ type Response = z.infer<typeof ResponseSchema>;
29
+ }
30
+ //# sourceMappingURL=get-user-online-status.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-user-online-status.command.d.ts","sourceRoot":"","sources":["../../../commands/stats/get-user-online-status.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,0BAA0B,CAAC;IACjC,MAAM,aAAa;;;;;;MAExB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,58 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetUsersStatsCommand {
3
+ const RequestSchema: z.ZodObject<{
4
+ reset: z.ZodBoolean;
5
+ }, "strip", z.ZodTypeAny, {
6
+ reset: boolean;
7
+ }, {
8
+ reset: boolean;
9
+ }>;
10
+ type Request = z.infer<typeof RequestSchema>;
11
+ const ResponseSchema: z.ZodObject<{
12
+ response: z.ZodObject<{
13
+ users: z.ZodArray<z.ZodObject<{
14
+ username: z.ZodString;
15
+ downlink: z.ZodNumber;
16
+ uplink: z.ZodNumber;
17
+ }, "strip", z.ZodTypeAny, {
18
+ username: string;
19
+ downlink: number;
20
+ uplink: number;
21
+ }, {
22
+ username: string;
23
+ downlink: number;
24
+ uplink: number;
25
+ }>, "many">;
26
+ }, "strip", z.ZodTypeAny, {
27
+ users: {
28
+ username: string;
29
+ downlink: number;
30
+ uplink: number;
31
+ }[];
32
+ }, {
33
+ users: {
34
+ username: string;
35
+ downlink: number;
36
+ uplink: number;
37
+ }[];
38
+ }>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ response: {
41
+ users: {
42
+ username: string;
43
+ downlink: number;
44
+ uplink: number;
45
+ }[];
46
+ };
47
+ }, {
48
+ response: {
49
+ users: {
50
+ username: string;
51
+ downlink: number;
52
+ uplink: number;
53
+ }[];
54
+ };
55
+ }>;
56
+ type Response = z.infer<typeof ResponseSchema>;
57
+ }
58
+ //# sourceMappingURL=get-users-stats.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-users-stats.command.d.ts","sourceRoot":"","sources":["../../../commands/stats/get-users-stats.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,oBAAoB,CAAC;IAC3B,MAAM,aAAa;;;;;;MAExB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAUzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -3,3 +3,4 @@ export * from './get-system-stats.command';
3
3
  export * from './get-users-stats.command';
4
4
  export * from './get-inbound-stats.command';
5
5
  export * from './get-outbound-stats.command';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../commands/stats/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ export declare namespace GetStatusAndVersionCommand {
3
+ const ResponseSchema: z.ZodObject<{
4
+ response: z.ZodObject<{
5
+ isRunning: z.ZodBoolean;
6
+ version: z.ZodNullable<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ version: string | null;
9
+ isRunning: boolean;
10
+ }, {
11
+ version: string | null;
12
+ isRunning: boolean;
13
+ }>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ response: {
16
+ version: string | null;
17
+ isRunning: boolean;
18
+ };
19
+ }, {
20
+ response: {
21
+ version: string | null;
22
+ isRunning: boolean;
23
+ };
24
+ }>;
25
+ type Response = z.infer<typeof ResponseSchema>;
26
+ const url: "/api/v1/xray/status";
27
+ }
28
+ //# sourceMappingURL=get-status-and-version.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-status-and-version.command.d.ts","sourceRoot":"","sources":["../../../commands/xray/get-status-and-version.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,0BAA0B,CAAC;IACjC,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;MAKzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;IAE/C,MAAM,GAAG,uBAAuB,CAAC;CAC3C"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetStatusAndVersionCommand = void 0;
4
4
  const zod_1 = require("zod");
5
+ const api_1 = require("../../api");
5
6
  var GetStatusAndVersionCommand;
6
7
  (function (GetStatusAndVersionCommand) {
7
8
  GetStatusAndVersionCommand.ResponseSchema = zod_1.z.object({
@@ -10,4 +11,5 @@ var GetStatusAndVersionCommand;
10
11
  version: zod_1.z.string().nullable(),
11
12
  }),
12
13
  });
14
+ GetStatusAndVersionCommand.url = api_1.REST_API.XRAY.STATUS;
13
15
  })(GetStatusAndVersionCommand || (exports.GetStatusAndVersionCommand = GetStatusAndVersionCommand = {}));
@@ -1,3 +1,4 @@
1
1
  export * from './start.command';
2
2
  export * from './stop.command';
3
3
  export * from './get-status-and-version.command';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../commands/xray/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ export declare namespace StartXrayCommand {
3
+ const RequestSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4
+ type Request = z.infer<typeof RequestSchema>;
5
+ const ResponseSchema: z.ZodObject<{
6
+ response: z.ZodObject<{
7
+ isStarted: z.ZodBoolean;
8
+ version: z.ZodNullable<z.ZodString>;
9
+ error: z.ZodNullable<z.ZodString>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ isStarted: boolean;
12
+ version: string | null;
13
+ error: string | null;
14
+ }, {
15
+ isStarted: boolean;
16
+ version: string | null;
17
+ error: string | null;
18
+ }>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ response: {
21
+ isStarted: boolean;
22
+ version: string | null;
23
+ error: string | null;
24
+ };
25
+ }, {
26
+ response: {
27
+ isStarted: boolean;
28
+ version: string | null;
29
+ error: string | null;
30
+ };
31
+ }>;
32
+ type Response = z.infer<typeof ResponseSchema>;
33
+ }
34
+ //# sourceMappingURL=start.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.command.d.ts","sourceRoot":"","sources":["../../../commands/xray/start.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,gBAAgB,CAAC;IACvB,MAAM,aAAa,wCAAwB,CAAC;IAEnD,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;MAMzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ export declare namespace StopXrayCommand {
3
+ const ResponseSchema: z.ZodObject<{
4
+ response: z.ZodObject<{
5
+ isStopped: z.ZodBoolean;
6
+ }, "strip", z.ZodTypeAny, {
7
+ isStopped: boolean;
8
+ }, {
9
+ isStopped: boolean;
10
+ }>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ response: {
13
+ isStopped: boolean;
14
+ };
15
+ }, {
16
+ response: {
17
+ isStopped: boolean;
18
+ };
19
+ }>;
20
+ type Response = z.infer<typeof ResponseSchema>;
21
+ }
22
+ //# sourceMappingURL=stop.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop.command.d.ts","sourceRoot":"","sources":["../../../commands/xray/stop.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yBAAiB,eAAe,CAAC;IACtB,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,63 @@
1
+ export declare const ERRORS: {
2
+ readonly INTERNAL_SERVER_ERROR: {
3
+ readonly code: "A001";
4
+ readonly message: "Server error";
5
+ readonly httpCode: 500;
6
+ };
7
+ readonly LOGIN_ERROR: {
8
+ readonly code: "A002";
9
+ readonly message: "Login error";
10
+ readonly httpCode: 500;
11
+ };
12
+ readonly UNAUTHORIZED: {
13
+ readonly code: "A003";
14
+ readonly message: "Unauthorized";
15
+ readonly httpCode: 401;
16
+ };
17
+ readonly FORBIDDEN_ROLE_ERROR: {
18
+ readonly code: "A004";
19
+ readonly message: "Forbidden role error";
20
+ readonly httpCode: 403;
21
+ };
22
+ readonly CREATE_API_TOKEN_ERROR: {
23
+ readonly code: "A005";
24
+ readonly message: "Create API token error";
25
+ readonly httpCode: 500;
26
+ };
27
+ readonly DELETE_API_TOKEN_ERROR: {
28
+ readonly code: "A006";
29
+ readonly message: "Delete API token error";
30
+ readonly httpCode: 500;
31
+ };
32
+ readonly GET_XRAY_STATS_ERROR: {
33
+ readonly code: "A009";
34
+ readonly message: "Get Xray stats error";
35
+ readonly httpCode: 500;
36
+ };
37
+ readonly FAILED_TO_GET_SYSTEM_STATS: {
38
+ readonly code: "A010";
39
+ readonly message: "Failed to get system stats";
40
+ readonly httpCode: 500;
41
+ };
42
+ readonly FAILED_TO_GET_USERS_STATS: {
43
+ readonly code: "A011";
44
+ readonly message: "Failed to get users stats";
45
+ readonly httpCode: 500;
46
+ };
47
+ readonly FAILED_TO_GET_INBOUND_STATS: {
48
+ readonly code: "A012";
49
+ readonly message: "Failed to get inbound stats";
50
+ readonly httpCode: 500;
51
+ };
52
+ readonly FAILED_TO_GET_OUTBOUND_STATS: {
53
+ readonly code: "A013";
54
+ readonly message: "Failed to get outbound stats";
55
+ readonly httpCode: 500;
56
+ };
57
+ readonly FAILED_TO_GET_INBOUND_USERS: {
58
+ readonly code: "A014";
59
+ readonly message: "Failed to get inbound users";
60
+ readonly httpCode: 500;
61
+ };
62
+ };
63
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../constants/errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCT,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './errors';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../constants/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './errors';
2
2
  export * from './roles';
3
3
  export * from './xray';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './role';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../constants/roles/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const ROLE: {
2
+ readonly USER: "user";
3
+ readonly ADMIN: "admin";
4
+ };
5
+ export type TRole = typeof ROLE;
6
+ export type TRolesKey = (typeof ROLE)[keyof typeof ROLE];
7
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../constants/roles/role.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;CAGP,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC;AAChC,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,OAAO,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './stats';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../constants/xray/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare const XRAY_DEFAULT_POLICY_MODEL: {
2
+ readonly policy: {
3
+ readonly levels: {
4
+ readonly '0': {
5
+ readonly statsUserUplink: true;
6
+ readonly statsUserDownlink: true;
7
+ readonly statsUserOnline: true;
8
+ };
9
+ };
10
+ readonly system: {
11
+ readonly statsInboundDownlink: true;
12
+ readonly statsInboundUplink: true;
13
+ readonly statsOutboundDownlink: true;
14
+ readonly statsOutboundUplink: true;
15
+ };
16
+ };
17
+ };
18
+ export declare const XRAY_DEFAULT_STATS_MODEL: {
19
+ readonly stats: {};
20
+ };
21
+ export declare const XRAY_DEFAULT_API_MODEL: {
22
+ readonly api: {
23
+ readonly services: readonly ["HandlerService", "StatsService", "LoggerService"];
24
+ readonly listen: "127.0.0.1:61000";
25
+ readonly tag: "API";
26
+ };
27
+ };
28
+ //# sourceMappingURL=stats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../constants/xray/stats.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;CAgB5B,CAAC;AAEX,eAAO,MAAM,wBAAwB;;CAE3B,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;;CAMzB,CAAC"}
@@ -2,3 +2,4 @@ export * from './constants';
2
2
  export * from './commands';
3
3
  export * from './api';
4
4
  export * from './models';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export declare const AuthSchema: z.ZodObject<{
3
+ hash: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ hash: string;
6
+ }, {
7
+ hash: string;
8
+ }>;
9
+ //# sourceMappingURL=auth.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.schema.d.ts","sourceRoot":"","sources":["../../models/auth.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU;;;;;;EAErB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './auth.schema';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@remnawave/node-contract",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A node-contract library for Remnawave Panel",
5
- "main": "index.js",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "files": [
8
+ "build/**/*"
9
+ ],
6
10
  "scripts": {
7
11
  "prepublish": "rm -rf build && tsc",
8
12
  "build": "tsc"
@@ -13,4 +17,4 @@
13
17
  "dependencies": {
14
18
  "zod": "^3.22.4"
15
19
  }
16
- }
20
+ }
@@ -1,8 +0,0 @@
1
- export const HANDLER_CONTROLLER = 'handler' as const;
2
-
3
- export const HANDLER_ROUTES = {
4
- REMOVE_USER: '/remove-user',
5
- ADD_USER: '/add-user',
6
- GET_INBOUND_USERS_COUNT: '/get-inbound-users-count',
7
- GET_INBOUND_USERS: '/get-inbound-users',
8
- } as const;
@@ -1,10 +0,0 @@
1
- export const STATS_CONTROLLER = 'stats' as const;
2
-
3
- export const STATS_ROUTES = {
4
- GET_USER_ONLINE_STATUS: 'get-user-online-status',
5
- GET_USERS_STATS: 'get-users-stats',
6
- GET_SYSTEM_STATS: 'get-system-stats',
7
-
8
- GET_INBOUND_STATS: 'get-inbound-stats',
9
- GET_OUTBOUND_STATS: 'get-outbound-stats',
10
- } as const;
@@ -1,7 +0,0 @@
1
- export const XRAY_CONTROLLER = 'xray' as const;
2
-
3
- export const XRAY_ROUTES = {
4
- START: 'start',
5
- STOP: 'stop',
6
- STATUS: 'status',
7
- } as const;
package/api/routes.ts DELETED
@@ -1,18 +0,0 @@
1
- import * as CONTROLLERS from './controllers';
2
-
3
- export const ROOT = '/api/v1' as const;
4
-
5
- export const REST_API = {
6
- XRAY: {
7
- START: `${ROOT}/${CONTROLLERS.XRAY_CONTROLLER}/${CONTROLLERS.XRAY_ROUTES.START}`,
8
- STOP: `${ROOT}/${CONTROLLERS.XRAY_CONTROLLER}/${CONTROLLERS.XRAY_ROUTES.STOP}`,
9
- STATUS: `${ROOT}/${CONTROLLERS.XRAY_CONTROLLER}/${CONTROLLERS.XRAY_ROUTES.STATUS}`,
10
- },
11
- STATS: {
12
- GET_USER_ONLINE_STATUS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_USER_ONLINE_STATUS}`,
13
- GET_USERS_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_USERS_STATS}`,
14
- GET_SYSTEM_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_SYSTEM_STATS}`,
15
- GET_INBOUND_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_INBOUND_STATS}`,
16
- GET_OUTBOUND_STATS: `${ROOT}/${CONTROLLERS.STATS_CONTROLLER}/${CONTROLLERS.STATS_ROUTES.GET_OUTBOUND_STATS}`,
17
- },
18
- } as const;
@@ -1,88 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export enum CipherType {
4
- UNKNOWN = 0,
5
- AES_128_GCM = 5,
6
- AES_256_GCM = 6,
7
- CHACHA20_POLY1305 = 7,
8
- XCHACHA20_POLY1305 = 8,
9
- NONE = 9,
10
- UNRECOGNIZED = -1,
11
- }
12
-
13
- export namespace AddUserCommand {
14
- const BaseTrojanUser = z.object({
15
- type: z.literal('trojan'),
16
- tag: z.string(),
17
- username: z.string(),
18
- password: z.string(),
19
- level: z.number().default(0),
20
- });
21
-
22
- const BaseVlessUser = z.object({
23
- type: z.literal('vless'),
24
- tag: z.string(),
25
- username: z.string(),
26
- uuid: z.string(),
27
- flow: z.enum(['xtls-rprx-vision', '']),
28
- level: z.number().default(0),
29
- });
30
-
31
- const BaseShadowsocksUser = z.object({
32
- type: z.literal('shadowsocks'),
33
- tag: z.string(),
34
- username: z.string(),
35
- password: z.string(),
36
- cipherType: z.nativeEnum(CipherType),
37
- ivCheck: z.boolean(),
38
- level: z.number().default(0),
39
- });
40
-
41
- const BaseShadowsocks2022User = z.object({
42
- type: z.literal('shadowsocks2022'),
43
- tag: z.string(),
44
- username: z.string(),
45
- key: z.string(),
46
- level: z.number().default(0),
47
- });
48
-
49
- const BaseSocksUser = z.object({
50
- type: z.literal('socks'),
51
- tag: z.string(),
52
- username: z.string(),
53
- socks_username: z.string(),
54
- socks_password: z.string(),
55
- level: z.number().default(0),
56
- });
57
-
58
- const BaseHttpUser = z.object({
59
- type: z.literal('http'),
60
- tag: z.string(),
61
- username: z.string(),
62
- http_username: z.string(),
63
- http_password: z.string(),
64
- level: z.number().default(0),
65
- });
66
-
67
- export const RequestSchema = z.object({
68
- data: z.discriminatedUnion('type', [
69
- BaseTrojanUser,
70
- BaseVlessUser,
71
- BaseShadowsocksUser,
72
- BaseShadowsocks2022User,
73
- BaseSocksUser,
74
- BaseHttpUser,
75
- ]),
76
- });
77
-
78
- export type Request = z.infer<typeof RequestSchema>;
79
-
80
- export const ResponseSchema = z.object({
81
- response: z.object({
82
- success: z.boolean(),
83
- error: z.string().nullable(),
84
- }),
85
- });
86
-
87
- export type Response = z.infer<typeof ResponseSchema>;
88
- }
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export namespace GetInboundUsersCountCommand {
4
- export const RequestSchema = z.object({
5
- tag: z.string(),
6
- });
7
-
8
- export type Request = z.infer<typeof RequestSchema>;
9
-
10
- export const ResponseSchema = z.object({
11
- response: z.object({
12
- count: z.number(),
13
- }),
14
- });
15
-
16
- export type Response = z.infer<typeof ResponseSchema>;
17
- }