@remnawave/backend-contract 2.0.0-alpha.35 → 2.0.0-alpha.37

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 (73) hide show
  1. package/build/backend/api/controllers/auth.d.ts +2 -0
  2. package/build/backend/api/controllers/auth.d.ts.map +1 -1
  3. package/build/backend/api/controllers/auth.js +2 -0
  4. package/build/backend/api/routes.d.ts +2 -0
  5. package/build/backend/api/routes.d.ts.map +1 -1
  6. package/build/backend/api/routes.js +2 -0
  7. package/build/backend/commands/auth/get-status.command.d.ts +22 -0
  8. package/build/backend/commands/auth/get-status.command.d.ts.map +1 -1
  9. package/build/backend/commands/auth/get-status.command.js +3 -0
  10. package/build/backend/commands/auth/oauth2/authorize.command.d.ts +35 -0
  11. package/build/backend/commands/auth/oauth2/authorize.command.d.ts.map +1 -0
  12. package/build/backend/commands/auth/oauth2/authorize.command.js +20 -0
  13. package/build/backend/commands/auth/oauth2/callback.command.d.ts +42 -0
  14. package/build/backend/commands/auth/oauth2/callback.command.d.ts.map +1 -0
  15. package/build/backend/commands/auth/oauth2/callback.command.js +22 -0
  16. package/build/backend/commands/auth/oauth2/index.d.ts +2 -0
  17. package/build/backend/commands/auth/oauth2/index.d.ts.map +1 -1
  18. package/build/backend/commands/auth/oauth2/index.js +2 -0
  19. package/build/backend/commands/infra-billing/create-bill-record.command.d.ts +6 -6
  20. package/build/backend/commands/infra-billing/create-billing-node.command.d.ts +12 -12
  21. package/build/backend/commands/infra-billing/delete-bill-record-by-uuid.command.d.ts +6 -6
  22. package/build/backend/commands/infra-billing/delete-billing-node-by-uuid.command.d.ts +12 -12
  23. package/build/backend/commands/infra-billing/get-bill-records.command.d.ts +6 -6
  24. package/build/backend/commands/infra-billing/get-billing-nodes.command.d.ts +12 -12
  25. package/build/backend/commands/infra-billing/update-billing-node.command.d.ts +12 -12
  26. package/build/backend/commands/nodes/actions/disable.command.d.ts +30 -30
  27. package/build/backend/commands/nodes/actions/enable.command.d.ts +30 -30
  28. package/build/backend/commands/nodes/actions/reorder.command.d.ts +30 -30
  29. package/build/backend/commands/nodes/create.command.d.ts +30 -30
  30. package/build/backend/commands/nodes/get-all.command.d.ts +30 -30
  31. package/build/backend/commands/nodes/get-one.command.d.ts +30 -30
  32. package/build/backend/commands/nodes/update.command.d.ts +30 -30
  33. package/build/backend/constants/errors/errors.d.ts +15 -0
  34. package/build/backend/constants/errors/errors.d.ts.map +1 -1
  35. package/build/backend/constants/errors/errors.js +15 -0
  36. package/build/backend/constants/headers/{headers.contants.d.ts → headers.constants.d.ts} +1 -1
  37. package/build/backend/constants/headers/headers.constants.d.ts.map +1 -0
  38. package/build/backend/constants/headers/index.d.ts +1 -1
  39. package/build/backend/constants/headers/index.d.ts.map +1 -1
  40. package/build/backend/constants/headers/index.js +1 -1
  41. package/build/backend/constants/index.d.ts +1 -0
  42. package/build/backend/constants/index.d.ts.map +1 -1
  43. package/build/backend/constants/index.js +1 -0
  44. package/build/backend/constants/metrics/metric-names.constant.d.ts +1 -0
  45. package/build/backend/constants/metrics/metric-names.constant.d.ts.map +1 -1
  46. package/build/backend/constants/metrics/metric-names.constant.js +1 -0
  47. package/build/backend/constants/oauth2/index.d.ts +2 -0
  48. package/build/backend/constants/oauth2/index.d.ts.map +1 -0
  49. package/build/backend/constants/oauth2/index.js +17 -0
  50. package/build/backend/constants/oauth2/providers.contants.d.ts +8 -0
  51. package/build/backend/constants/oauth2/providers.contants.d.ts.map +1 -0
  52. package/build/backend/constants/oauth2/providers.contants.js +8 -0
  53. package/build/backend/models/infra-billing-history-record.schema.d.ts +2 -2
  54. package/build/backend/models/infra-billing-node.schema.d.ts +4 -4
  55. package/build/backend/models/infra-provider.schema.js +1 -1
  56. package/build/backend/models/nodes.schema.d.ts +14 -14
  57. package/build/frontend/api/controllers/auth.js +2 -0
  58. package/build/frontend/api/routes.js +2 -0
  59. package/build/frontend/commands/auth/get-status.command.js +3 -0
  60. package/build/frontend/commands/auth/oauth2/authorize.command.js +20 -0
  61. package/build/frontend/commands/auth/oauth2/callback.command.js +22 -0
  62. package/build/frontend/commands/auth/oauth2/index.js +2 -0
  63. package/build/frontend/constants/errors/errors.js +15 -0
  64. package/build/frontend/constants/headers/index.js +1 -1
  65. package/build/frontend/constants/index.js +1 -0
  66. package/build/frontend/constants/metrics/metric-names.constant.js +1 -0
  67. package/build/frontend/constants/oauth2/index.js +17 -0
  68. package/build/frontend/constants/oauth2/providers.contants.js +8 -0
  69. package/build/frontend/models/infra-provider.schema.js +1 -1
  70. package/package.json +1 -1
  71. package/build/backend/constants/headers/headers.contants.d.ts.map +0 -1
  72. /package/build/backend/constants/headers/{headers.contants.js → headers.constants.js} +0 -0
  73. /package/build/frontend/constants/headers/{headers.contants.js → headers.constants.js} +0 -0
@@ -144,14 +144,14 @@ export declare const InfraBillingNodeSchema: z.ZodObject<{
144
144
  uuid: string;
145
145
  createdAt: Date;
146
146
  updatedAt: Date;
147
- nodeUuid: string;
148
- providerUuid: string;
149
147
  provider: {
150
148
  uuid: string;
151
149
  name: string;
152
150
  faviconLink: string | null;
153
151
  loginUrl: string | null;
154
152
  };
153
+ nodeUuid: string;
154
+ providerUuid: string;
155
155
  node: {
156
156
  uuid: string;
157
157
  name: string;
@@ -162,14 +162,14 @@ export declare const InfraBillingNodeSchema: z.ZodObject<{
162
162
  uuid: string;
163
163
  createdAt: string;
164
164
  updatedAt: string;
165
- nodeUuid: string;
166
- providerUuid: string;
167
165
  provider: {
168
166
  uuid: string;
169
167
  name: string;
170
168
  faviconLink: string | null;
171
169
  loginUrl: string | null;
172
170
  };
171
+ nodeUuid: string;
172
+ providerUuid: string;
173
173
  node: {
174
174
  uuid: string;
175
175
  name: string;
@@ -20,7 +20,7 @@ exports.InfraProviderSchema = zod_1.z.object({
20
20
  totalBills: zod_1.z.number(),
21
21
  }),
22
22
  billingNodes: zod_1.z.array(zod_1.z.object({
23
- nodeUuid: zod_1.z.string(),
23
+ nodeUuid: zod_1.z.string().uuid(),
24
24
  name: zod_1.z.string(),
25
25
  countryCode: zod_1.z.string(),
26
26
  })),
@@ -110,6 +110,14 @@ export declare const NodesSchema: z.ZodObject<{
110
110
  uuid: string;
111
111
  createdAt: Date;
112
112
  updatedAt: Date;
113
+ provider: {
114
+ uuid: string;
115
+ createdAt: Date;
116
+ updatedAt: Date;
117
+ name: string;
118
+ faviconLink: string | null;
119
+ loginUrl: string | null;
120
+ } | null;
113
121
  name: string;
114
122
  port: number | null;
115
123
  countryCode: string;
@@ -149,18 +157,18 @@ export declare const NodesSchema: z.ZodObject<{
149
157
  }[];
150
158
  };
151
159
  providerUuid: string | null;
160
+ }, {
161
+ uuid: string;
162
+ createdAt: string;
163
+ updatedAt: string;
152
164
  provider: {
153
165
  uuid: string;
154
- createdAt: Date;
155
- updatedAt: Date;
166
+ createdAt: string;
167
+ updatedAt: string;
156
168
  name: string;
157
169
  faviconLink: string | null;
158
170
  loginUrl: string | null;
159
171
  } | null;
160
- }, {
161
- uuid: string;
162
- createdAt: string;
163
- updatedAt: string;
164
172
  name: string;
165
173
  port: number | null;
166
174
  countryCode: string;
@@ -200,13 +208,5 @@ export declare const NodesSchema: z.ZodObject<{
200
208
  }[];
201
209
  };
202
210
  providerUuid: string | null;
203
- provider: {
204
- uuid: string;
205
- createdAt: string;
206
- updatedAt: string;
207
- name: string;
208
- faviconLink: string | null;
209
- loginUrl: string | null;
210
- } | null;
211
211
  }>;
212
212
  //# sourceMappingURL=nodes.schema.d.ts.map
@@ -8,5 +8,7 @@ exports.AUTH_ROUTES = {
8
8
  GET_STATUS: 'status',
9
9
  OAUTH2: {
10
10
  TELEGRAM_CALLBACK: 'oauth2/tg/callback',
11
+ AUTHORIZE: 'oauth2/authorize',
12
+ CALLBACK: 'oauth2/callback',
11
13
  },
12
14
  };
@@ -45,6 +45,8 @@ exports.REST_API = {
45
45
  GET_STATUS: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.GET_STATUS}`,
46
46
  OAUTH2: {
47
47
  TELEGRAM_CALLBACK: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.OAUTH2.TELEGRAM_CALLBACK}`,
48
+ AUTHORIZE: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.OAUTH2.AUTHORIZE}`,
49
+ CALLBACK: `${exports.ROOT}/${CONTROLLERS.AUTH_CONTROLLER}/${CONTROLLERS.AUTH_ROUTES.OAUTH2.CALLBACK}`,
48
50
  },
49
51
  },
50
52
  API_TOKENS: {
@@ -18,6 +18,9 @@ var GetStatusCommand;
18
18
  botId: zod_1.z.number(),
19
19
  })
20
20
  .nullable(),
21
+ oauth2: zod_1.z.object({
22
+ providers: zod_1.z.record(zod_1.z.nativeEnum(constants_1.OAUTH2_PROVIDERS), zod_1.z.boolean()),
23
+ }),
21
24
  }),
22
25
  });
23
26
  })(GetStatusCommand || (exports.GetStatusCommand = GetStatusCommand = {}));
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuth2AuthorizeCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const api_1 = require("../../../api");
7
+ var OAuth2AuthorizeCommand;
8
+ (function (OAuth2AuthorizeCommand) {
9
+ OAuth2AuthorizeCommand.url = api_1.REST_API.AUTH.OAUTH2.AUTHORIZE;
10
+ OAuth2AuthorizeCommand.TSQ_url = OAuth2AuthorizeCommand.url;
11
+ OAuth2AuthorizeCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.AUTH_ROUTES.OAUTH2.AUTHORIZE, 'post', 'Initiate OAuth2 authorization');
12
+ OAuth2AuthorizeCommand.RequestSchema = zod_1.z.object({
13
+ provider: zod_1.z.nativeEnum(constants_1.OAUTH2_PROVIDERS),
14
+ });
15
+ OAuth2AuthorizeCommand.ResponseSchema = zod_1.z.object({
16
+ response: zod_1.z.object({
17
+ authorizationUrl: zod_1.z.nullable(zod_1.z.string().url()),
18
+ }),
19
+ });
20
+ })(OAuth2AuthorizeCommand || (exports.OAuth2AuthorizeCommand = OAuth2AuthorizeCommand = {}));
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuth2CallbackCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const api_1 = require("../../../api");
7
+ var OAuth2CallbackCommand;
8
+ (function (OAuth2CallbackCommand) {
9
+ OAuth2CallbackCommand.url = api_1.REST_API.AUTH.OAUTH2.CALLBACK;
10
+ OAuth2CallbackCommand.TSQ_url = OAuth2CallbackCommand.url;
11
+ OAuth2CallbackCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.AUTH_ROUTES.OAUTH2.CALLBACK, 'post', 'Callback from OAuth2');
12
+ OAuth2CallbackCommand.RequestSchema = zod_1.z.object({
13
+ provider: zod_1.z.nativeEnum(constants_1.OAUTH2_PROVIDERS),
14
+ code: zod_1.z.string(),
15
+ state: zod_1.z.string(),
16
+ });
17
+ OAuth2CallbackCommand.ResponseSchema = zod_1.z.object({
18
+ response: zod_1.z.object({
19
+ accessToken: zod_1.z.string(),
20
+ }),
21
+ });
22
+ })(OAuth2CallbackCommand || (exports.OAuth2CallbackCommand = OAuth2CallbackCommand = {}));
@@ -14,4 +14,6 @@ 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("./authorize.command"), exports);
18
+ __exportStar(require("./callback.command"), exports);
17
19
  __exportStar(require("./telegram-callback.command"), exports);
@@ -725,4 +725,19 @@ exports.ERRORS = {
725
725
  message: 'This name is reserved by Remnawave. Please use a different name.',
726
726
  httpCode: 400,
727
727
  },
728
+ UPDATE_CONFIG_PROFILE_ERROR: {
729
+ code: 'A146',
730
+ message: 'Update config profile error',
731
+ httpCode: 500,
732
+ },
733
+ OAUTH2_PROVIDER_NOT_FOUND: {
734
+ code: 'A147',
735
+ message: 'OAuth2 provider not found',
736
+ httpCode: 404,
737
+ },
738
+ OAUTH2_AUTHORIZE_ERROR: {
739
+ code: 'A148',
740
+ message: 'OAuth2 authorize error',
741
+ httpCode: 500,
742
+ },
728
743
  };
@@ -14,4 +14,4 @@ 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("./headers.contants"), exports);
17
+ __exportStar(require("./headers.constants"), exports);
@@ -22,6 +22,7 @@ __exportStar(require("./hosts"), exports);
22
22
  __exportStar(require("./messaging"), exports);
23
23
  __exportStar(require("./metrics"), exports);
24
24
  __exportStar(require("./nodes"), exports);
25
+ __exportStar(require("./oauth2"), exports);
25
26
  __exportStar(require("./roles"), exports);
26
27
  __exportStar(require("./subscription-template"), exports);
27
28
  __exportStar(require("./templates"), exports);
@@ -5,6 +5,7 @@ exports.METRIC_NAMES = {
5
5
  NODE_ONLINE_USERS: 'node_online_users',
6
6
  NODE_STATUS: 'node_status',
7
7
  USERS_STATUS: 'users_status',
8
+ USERS_ONLINE_STATS: 'users_online_stats',
8
9
  USERS_TOTAL: 'users_total',
9
10
  NODE_INBOUND_UPLOAD_BYTES: 'node_inbound_upload_bytes',
10
11
  NODE_INBOUND_DOWNLOAD_BYTES: 'node_inbound_download_bytes',
@@ -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("./providers.contants"), exports);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAUTH2_PROVIDERS_VALUES = exports.OAUTH2_PROVIDERS = void 0;
4
+ exports.OAUTH2_PROVIDERS = {
5
+ GITHUB: 'github',
6
+ POCKETID: 'pocketid',
7
+ };
8
+ exports.OAUTH2_PROVIDERS_VALUES = Object.values(exports.OAUTH2_PROVIDERS);
@@ -20,7 +20,7 @@ exports.InfraProviderSchema = zod_1.z.object({
20
20
  totalBills: zod_1.z.number(),
21
21
  }),
22
22
  billingNodes: zod_1.z.array(zod_1.z.object({
23
- nodeUuid: zod_1.z.string(),
23
+ nodeUuid: zod_1.z.string().uuid(),
24
24
  name: zod_1.z.string(),
25
25
  countryCode: zod_1.z.string(),
26
26
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "2.0.0-alpha.35",
3
+ "version": "2.0.0-alpha.37",
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":"headers.contants.d.ts","sourceRoot":"","sources":["../../../../constants/headers/headers.contants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,eAAO,MAAM,6BAA6B,YAAY,CAAC"}