Migrate from Zod v3 to v4 (#14639)

Closes [#1526](https://github.com/twentyhq/core-team-issues/issues/1526)

---------

Co-authored-by: Félix Malfait <felix@twenty.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
Abdul Rahman
2025-09-24 21:59:05 +05:30
committed by GitHub
parent 8d78032357
commit 3cada58908
98 changed files with 809 additions and 1075 deletions
@@ -15,7 +15,7 @@ const RelativeDateValueSchema = z.object({
}
return true;
}, {
message: 'Amount is required for NEXT and PAST directions and must be positive',
error: 'Amount is required for NEXT and PAST directions and must be positive'
});
export const safeParseRelativeDateFilterValue = (
@@ -16,7 +16,7 @@ export const absoluteUrlSchema = z.string().transform((value, ctx) => {
// if the hostname is a number, it's not a valid url
// if we let URL() parse it, it will throw cast an IP address and we lose the information
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: "custom",
message: 'domain is not a valid url',
});
@@ -28,14 +28,14 @@ export const absoluteUrlSchema = z.string().transform((value, ctx) => {
return absoluteUrl;
}
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: "custom",
message: 'domain is not a valid url',
});
return z.NEVER;
} catch {
ctx.addIssue({
code: z.ZodIssueCode.custom,
code: "custom",
message: 'domain is not a valid url',
});