13 lines
305 B
TypeScript
13 lines
305 B
TypeScript
import { z } from 'zod';
|
|
export const text = (max: number, min = 1) =>
|
|
z
|
|
.string()
|
|
.trim()
|
|
.min(min)
|
|
.max(max)
|
|
.regex(/^[^<>\u0000-\u001F\u007F]*$/, 'Plain text only');
|
|
export const ids = z
|
|
.array(z.uuid())
|
|
.max(20)
|
|
.refine((values) => new Set(values).size === values.length);
|