remove passthrough, remove redudnant refine
This commit is contained in:
1 parent
9fd006cfff
commit
a1858e8302
2 files changed
+29
-36
No files matched your search
@@ -79,36 +79,34 @@ export const createMonitorBodyValidation = z.object({
|
|||||||
geoCheckInterval: z.number().min(300000).optional(),
|
geoCheckInterval: z.number().min(300000).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const editMonitorBodyValidation = z
|
export const editMonitorBodyValidation = z.object({
|
||||||
.object({
|
name: z.string().optional(),
|
||||||
name: z.string().optional(),
|
type: z.string().optional(),
|
||||||
type: z.string().optional(),
|
url: z.string().optional(),
|
||||||
url: z.string().optional(),
|
statusWindowSize: z.number().min(1).max(20).default(5),
|
||||||
statusWindowSize: z.number().min(1).max(20).default(5),
|
statusWindowThreshold: z.number().min(1).max(100).default(60),
|
||||||
statusWindowThreshold: z.number().min(1).max(100).default(60),
|
description: z.union([z.string(), z.null(), z.literal("")]).optional(),
|
||||||
description: z.union([z.string(), z.null(), z.literal("")]).optional(),
|
interval: z.number().optional(),
|
||||||
interval: z.number().optional(),
|
notifications: z.array(z.string()).optional(),
|
||||||
notifications: z.array(z.string()).optional(),
|
secret: z.string().optional(),
|
||||||
secret: z.string().optional(),
|
ignoreTlsErrors: z.boolean().optional(),
|
||||||
ignoreTlsErrors: z.boolean().optional(),
|
useAdvancedMatching: z.boolean().optional(),
|
||||||
useAdvancedMatching: z.boolean().optional(),
|
jsonPath: z.union([z.string(), z.literal("")]).optional(),
|
||||||
jsonPath: z.union([z.string(), z.literal("")]).optional(),
|
expectedValue: z.union([z.string(), z.literal("")]).optional(),
|
||||||
expectedValue: z.union([z.string(), z.literal("")]).optional(),
|
matchMethod: z.union([z.string(), z.null(), z.literal("")]).optional(),
|
||||||
matchMethod: z.union([z.string(), z.null(), z.literal("")]).optional(),
|
port: z.number().min(1).max(65535).optional(),
|
||||||
port: z.number().min(1).max(65535).optional(),
|
cpuAlertThreshold: z.number().optional(),
|
||||||
cpuAlertThreshold: z.number().optional(),
|
memoryAlertThreshold: z.number().optional(),
|
||||||
memoryAlertThreshold: z.number().optional(),
|
diskAlertThreshold: z.number().optional(),
|
||||||
diskAlertThreshold: z.number().optional(),
|
tempAlertThreshold: z.number().optional(),
|
||||||
tempAlertThreshold: z.number().optional(),
|
gameId: z.union([z.string(), z.literal("")]).optional(),
|
||||||
gameId: z.union([z.string(), z.literal("")]).optional(),
|
grpcServiceName: z.union([z.string(), z.literal("")]).optional(),
|
||||||
grpcServiceName: z.union([z.string(), z.literal("")]).optional(),
|
selectedDisks: z.array(z.string()).optional(),
|
||||||
selectedDisks: z.array(z.string()).optional(),
|
group: z.union([z.string().max(50).trim(), z.null(), z.literal("")]).optional(),
|
||||||
group: z.union([z.string().max(50).trim(), z.null(), z.literal("")]).optional(),
|
geoCheckEnabled: z.boolean().optional(),
|
||||||
geoCheckEnabled: z.boolean().optional(),
|
geoCheckLocations: z.array(z.enum(GeoContinents)).optional(),
|
||||||
geoCheckLocations: z.array(z.enum(GeoContinents)).optional(),
|
geoCheckInterval: z.number().min(300000).optional(),
|
||||||
geoCheckInterval: z.number().min(300000).optional(),
|
});
|
||||||
})
|
|
||||||
.passthrough();
|
|
||||||
|
|
||||||
export const pauseMonitorParamValidation = z.object({
|
export const pauseMonitorParamValidation = z.object({
|
||||||
monitorId: z.string().min(1, "Monitor ID is required"),
|
monitorId: z.string().min(1, "Monitor ID is required"),
|
||||||
|
|||||||
@@ -13,12 +13,7 @@ export const nameValidation = z
|
|||||||
"Names must contain at least 1 letter and may only include letters, currency symbols, spaces, apostrophes, hyphens (-), periods (.), and parentheses ()."
|
"Names must contain at least 1 letter and may only include letters, currency symbols, spaces, apostrophes, hyphens (-), periods (.), and parentheses ()."
|
||||||
);
|
);
|
||||||
|
|
||||||
export const lowercaseEmailValidation = z
|
export const lowercaseEmailValidation = z.email().transform((val) => val.toLowerCase());
|
||||||
.email()
|
|
||||||
.transform((val) => val.toLowerCase())
|
|
||||||
.refine((val) => val === val.toLowerCase(), {
|
|
||||||
message: "Email must be in lowercase",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const booleanCoercion = z.preprocess((val) => {
|
export const booleanCoercion = z.preprocess((val) => {
|
||||||
if (val === "true" || val === true) return true;
|
if (val === "true" || val === true) return true;
|
||||||
|
|||||||
Reference in new issue
Block a user