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
@@ -41,7 +41,7 @@ export const SettingsAccountsBlocklistInput = ({
emailOrDomain: z
.string()
.trim()
.email(t`Invalid email or domain`)
.pipe(z.email({ error: t`Invalid email or domain` }))
.or(
z.string().refine(
(value) =>
@@ -5,7 +5,7 @@ import { type ConnectionParameters } from '~/generated/graphql';
const connectionParameters = z
.object({
host: z.string().default(''),
port: z.number().int().nullable().default(null),
port: z.int().nullable().default(null),
username: z.string().optional(),
password: z.string().default(''),
secure: z.boolean().default(true),
@@ -18,14 +18,14 @@ const connectionParameters = z
return true;
},
{
message: 'Port must be a positive number when configuring this protocol',
path: ['port'],
error: 'Port must be a positive number when configuring this protocol',
},
);
export const connectionImapSmtpCalDav = z
.object({
handle: z.string().email('Invalid email address'),
handle: z.email('Invalid email address'),
IMAP: connectionParameters.optional(),
SMTP: connectionParameters.optional(),
CALDAV: connectionParameters.optional(),
@@ -37,9 +37,9 @@ export const connectionImapSmtpCalDav = z
);
},
{
message:
'At least one account type (IMAP, SMTP, or CalDAV) must be completely configured',
path: ['handle'],
error:
'At least one account type (IMAP, SMTP, or CalDAV) must be completely configured',
},
);