@remnawave/backend-contract 0.0.28 → 0.0.31

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.
@@ -10,27 +10,19 @@ var UpdateNodeCommand;
10
10
  UpdateNodeCommand.RequestSchema = models_1.NodesSchema.pick({
11
11
  uuid: true,
12
12
  }).extend({
13
- name: zod_1.z.string().min(5, 'Name is required').optional(),
14
- address: zod_1.z.string().min(2, 'Address is required').optional(),
15
- port: zod_1.z.number().int().min(1, 'Port is required').optional(),
16
- isTrafficTrackingActive: zod_1.z.boolean().optional(),
17
- trafficLimitBytes: zod_1.z
13
+ name: zod_1.z.optional(zod_1.z.string().min(5, 'Min. 5 characters')),
14
+ address: zod_1.z.optional(zod_1.z.string().min(2, 'Min. 2 characters')),
15
+ port: zod_1.z.optional(zod_1.z.number()),
16
+ isTrafficTrackingActive: zod_1.z.optional(zod_1.z.boolean()),
17
+ trafficLimitBytes: zod_1.z.optional(zod_1.z.number().min(0, 'Traffic limit must be greater than 0')),
18
+ notifyPercent: zod_1.z.optional(zod_1.z
18
19
  .number()
19
- .int()
20
- .min(0, 'Traffic limit must be greater than 0')
21
- .optional(),
22
- notifyPercent: zod_1.z
23
- .number()
24
- .int()
25
20
  .min(0, 'Notify percent must be greater than 0')
26
- .max(100, 'Notify percent must be less than 100')
27
- .optional(),
28
- trafficResetDay: zod_1.z
21
+ .max(100, 'Notify percent must be less than 100')),
22
+ trafficResetDay: zod_1.z.optional(zod_1.z
29
23
  .number()
30
- .int()
31
24
  .min(1, 'Traffic reset day must be greater than 0')
32
- .max(31, 'Traffic reset day must be less than 31')
33
- .optional(),
25
+ .max(31, 'Traffic reset day must be less than 31')),
34
26
  });
35
27
  UpdateNodeCommand.ResponseSchema = zod_1.z.object({
36
28
  response: models_1.NodesSchema,
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./get-config.command"), exports);
18
+ __exportStar(require("./update-config.command"), exports);
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateXrayConfigCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const api_1 = require("../../api");
6
+ var UpdateXrayConfigCommand;
7
+ (function (UpdateXrayConfigCommand) {
8
+ UpdateXrayConfigCommand.url = api_1.REST_API.XRAY.UPDATE_CONFIG;
9
+ UpdateXrayConfigCommand.RequestSchema = zod_1.z.record(zod_1.z.any());
10
+ UpdateXrayConfigCommand.ResponseSchema = zod_1.z.object({
11
+ response: zod_1.z.object({
12
+ config: zod_1.z.record(zod_1.z.any()),
13
+ }),
14
+ });
15
+ })(UpdateXrayConfigCommand || (exports.UpdateXrayConfigCommand = UpdateXrayConfigCommand = {}));
@@ -258,4 +258,9 @@ exports.ERRORS = {
258
258
  message: 'Update host error',
259
259
  httpCode: 500,
260
260
  },
261
+ CREATE_CONFIG_ERROR: {
262
+ code: 'A053',
263
+ message: 'Create config error',
264
+ httpCode: 500,
265
+ },
261
266
  };
@@ -8,27 +8,23 @@ export namespace UpdateNodeCommand {
8
8
  export const RequestSchema = NodesSchema.pick({
9
9
  uuid: true,
10
10
  }).extend({
11
- name: z.string().min(5, 'Name is required').optional(),
12
- address: z.string().min(2, 'Address is required').optional(),
13
- port: z.number().int().min(1, 'Port is required').optional(),
14
- isTrafficTrackingActive: z.boolean().optional(),
15
- trafficLimitBytes: z
16
- .number()
17
- .int()
18
- .min(0, 'Traffic limit must be greater than 0')
19
- .optional(),
20
- notifyPercent: z
21
- .number()
22
- .int()
23
- .min(0, 'Notify percent must be greater than 0')
24
- .max(100, 'Notify percent must be less than 100')
25
- .optional(),
26
- trafficResetDay: z
27
- .number()
28
- .int()
29
- .min(1, 'Traffic reset day must be greater than 0')
30
- .max(31, 'Traffic reset day must be less than 31')
31
- .optional(),
11
+ name: z.optional(z.string().min(5, 'Min. 5 characters')),
12
+ address: z.optional(z.string().min(2, 'Min. 2 characters')),
13
+ port: z.optional(z.number()),
14
+ isTrafficTrackingActive: z.optional(z.boolean()),
15
+ trafficLimitBytes: z.optional(z.number().min(0, 'Traffic limit must be greater than 0')),
16
+ notifyPercent: z.optional(
17
+ z
18
+ .number()
19
+ .min(0, 'Notify percent must be greater than 0')
20
+ .max(100, 'Notify percent must be less than 100'),
21
+ ),
22
+ trafficResetDay: z.optional(
23
+ z
24
+ .number()
25
+ .min(1, 'Traffic reset day must be greater than 0')
26
+ .max(31, 'Traffic reset day must be less than 31'),
27
+ ),
32
28
  });
33
29
 
34
30
  export type Request = z.infer<typeof RequestSchema>;
@@ -1 +1,2 @@
1
1
  export * from './get-config.command';
2
+ export * from './update-config.command';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import { REST_API } from '../../api';
3
+
4
+ export namespace UpdateXrayConfigCommand {
5
+ export const url = REST_API.XRAY.UPDATE_CONFIG;
6
+
7
+ export const RequestSchema = z.record(z.any());
8
+
9
+ export type Request = z.infer<typeof RequestSchema>;
10
+
11
+ export const ResponseSchema = z.object({
12
+ response: z.object({
13
+ config: z.record(z.any()),
14
+ }),
15
+ });
16
+
17
+ export type Response = z.infer<typeof ResponseSchema>;
18
+ }
@@ -255,4 +255,9 @@ export const ERRORS = {
255
255
  message: 'Update host error',
256
256
  httpCode: 500,
257
257
  },
258
+ CREATE_CONFIG_ERROR: {
259
+ code: 'A053',
260
+ message: 'Create config error',
261
+ httpCode: 500,
262
+ },
258
263
  } as const;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "0.0.28",
3
+ "version": "0.0.31",
4
4
  "description": "A contract library for Remnawave",
5
5
  "main": "index.js",
6
6
  "scripts": {