@remnawave/backend-contract
Advanced tools
Comparing version 0.0.49 to 0.0.50
@@ -13,4 +13,3 @@ "use strict"; | ||
uuid: true, | ||
}) | ||
.extend({ | ||
}).extend({ | ||
name: zod_1.z.optional(zod_1.z.string().min(5, 'Min. 5 characters')), | ||
@@ -29,13 +28,2 @@ address: zod_1.z.optional(zod_1.z.string().min(2, 'Min. 2 characters')), | ||
.max(31, 'Traffic reset day must be less than 31')), | ||
}) | ||
.refine((data) => { | ||
if (data.isTrafficTrackingActive) { | ||
return (data.trafficLimitBytes != null && | ||
data.notifyPercent != null && | ||
data.trafficResetDay != null); | ||
} | ||
return true; | ||
}, { | ||
message: 'Traffic tracking fields are required when isTrafficTrackingActive is true', | ||
path: ['trafficLimitBytes', 'notifyPercent', 'trafficResetDay'], | ||
}); | ||
@@ -42,0 +30,0 @@ UpdateNodeCommand.ResponseSchema = zod_1.z.object({ |
@@ -11,41 +11,21 @@ import { z } from 'zod'; | ||
uuid: true, | ||
}) | ||
.extend({ | ||
name: z.optional(z.string().min(5, 'Min. 5 characters')), | ||
address: z.optional(z.string().min(2, 'Min. 2 characters')), | ||
port: z.optional(z.number()), | ||
isTrafficTrackingActive: z.optional(z.boolean()), | ||
trafficLimitBytes: z.optional( | ||
z.number().min(0, 'Traffic limit must be greater than 0'), | ||
), | ||
notifyPercent: z.optional( | ||
z | ||
.number() | ||
.min(0, 'Notify percent must be greater than 0') | ||
.max(100, 'Notify percent must be less than 100'), | ||
), | ||
trafficResetDay: z.optional( | ||
z | ||
.number() | ||
.min(1, 'Traffic reset day must be greater than 0') | ||
.max(31, 'Traffic reset day must be less than 31'), | ||
), | ||
}) | ||
.refine( | ||
(data) => { | ||
if (data.isTrafficTrackingActive) { | ||
return ( | ||
data.trafficLimitBytes != null && | ||
data.notifyPercent != null && | ||
data.trafficResetDay != null | ||
); | ||
} | ||
return true; | ||
}, | ||
{ | ||
message: | ||
'Traffic tracking fields are required when isTrafficTrackingActive is true', | ||
path: ['trafficLimitBytes', 'notifyPercent', 'trafficResetDay'], | ||
}, | ||
); | ||
}).extend({ | ||
name: z.optional(z.string().min(5, 'Min. 5 characters')), | ||
address: z.optional(z.string().min(2, 'Min. 2 characters')), | ||
port: z.optional(z.number()), | ||
isTrafficTrackingActive: z.optional(z.boolean()), | ||
trafficLimitBytes: z.optional(z.number().min(0, 'Traffic limit must be greater than 0')), | ||
notifyPercent: z.optional( | ||
z | ||
.number() | ||
.min(0, 'Notify percent must be greater than 0') | ||
.max(100, 'Notify percent must be less than 100'), | ||
), | ||
trafficResetDay: z.optional( | ||
z | ||
.number() | ||
.min(1, 'Traffic reset day must be greater than 0') | ||
.max(31, 'Traffic reset day must be less than 31'), | ||
), | ||
}); | ||
@@ -52,0 +32,0 @@ export type Request = z.infer<typeof RequestSchema>; |
{ | ||
"name": "@remnawave/backend-contract", | ||
"version": "0.0.49", | ||
"version": "0.0.50", | ||
"description": "A contract library for Remnawave", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
157100
3858