feat: csv validation

This commit is contained in:
Eli Bosley
2025-01-19 22:02:54 -05:00
parent a1a046f900
commit 89d756ef4e

View File

@@ -22,7 +22,23 @@ const RemoteConfigSchema = z.object({
idtoken: z.string(),
refreshtoken: z.string(),
dynamicRemoteAccessType: z.nativeEnum(DynamicRemoteAccessType),
ssoSubIds: z.string(),
ssoSubIds: z
.string()
.transform((val) => {
// If valid, return as is
if (val === '' || val.split(',').every((id) => id.trim().match(/^[a-zA-Z0-9-]+$/))) {
return val;
}
// Otherwise, replace with an empty string
return '';
})
.refine(
(val) => val === '' || val.split(',').every((id) => id.trim().match(/^[a-zA-Z0-9-]+$/)),
{
message:
'ssoSubIds must be empty or a comma-separated list of alphanumeric strings with dashes',
}
),
});
const LocalConfigSchema = z.object({});