@remnawave/backend-contract 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,13 +35,28 @@ var UpdateUserCommand;
35
35
  });
36
36
  }
37
37
  }),
38
- enabledInbounds: zod_1.z
38
+ // enabledInbounds: z
39
+ // .array(
40
+ // InboundsSchema.pick({
41
+ // uuid: true,
42
+ // }),
43
+ // {
44
+ // invalid_type_error: 'Enabled inbounds must be an array',
45
+ // },
46
+ // )
47
+ // .optional(),
48
+ enabledInbounds: zod_1.z.preprocess((val) => {
49
+ if (Array.isArray(val)) {
50
+ return val.map((uuid) => ({ uuid }));
51
+ }
52
+ return [];
53
+ }, zod_1.z
39
54
  .array(models_1.InboundsSchema.pick({
40
55
  uuid: true,
41
56
  }), {
42
- invalid_type_error: 'Enabled inbounds must be an array',
57
+ invalid_type_error: 'Enabled inbounds must be an array of objects with uuid',
43
58
  })
44
- .optional(),
59
+ .optional()),
45
60
  expireAt: zod_1.z.coerce
46
61
  .date({
47
62
  required_error: 'Expiration date is required',
@@ -33,16 +33,35 @@ export namespace UpdateUserCommand {
33
33
  });
34
34
  }
35
35
  }),
36
- enabledInbounds: z
37
- .array(
38
- InboundsSchema.pick({
39
- uuid: true,
40
- }),
41
- {
42
- invalid_type_error: 'Enabled inbounds must be an array',
43
- },
44
- )
45
- .optional(),
36
+ // enabledInbounds: z
37
+ // .array(
38
+ // InboundsSchema.pick({
39
+ // uuid: true,
40
+ // }),
41
+ // {
42
+ // invalid_type_error: 'Enabled inbounds must be an array',
43
+ // },
44
+ // )
45
+ // .optional(),
46
+ enabledInbounds: z.preprocess(
47
+ (val) => {
48
+ if (Array.isArray(val)) {
49
+ return val.map((uuid) => ({ uuid }));
50
+ }
51
+ return [];
52
+ },
53
+ z
54
+ .array(
55
+ InboundsSchema.pick({
56
+ uuid: true,
57
+ }),
58
+ {
59
+ invalid_type_error:
60
+ 'Enabled inbounds must be an array of objects with uuid',
61
+ },
62
+ )
63
+ .optional(),
64
+ ),
46
65
  expireAt: z.coerce
47
66
  .date({
48
67
  required_error: 'Expiration date is required',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "A contract library for Remnawave",
5
5
  "main": "index.js",
6
6
  "scripts": {