import { z } from "../../../contracts/zod.ts"; export const referenceResourceListQuerySchema = z .object({ cursor: z.string().min(1).optional(), limit: z.coerce.number().int().min(1).max(100).default(20), tags: z .preprocess( (value) => value === undefined ? undefined : Array.isArray(value) ? value : [value], z.array(z.string().trim().min(1)).readonly(), ) .optional(), }) .strict(); export const referenceResourceParamsSchema = z .object({ resourceId: z.string().trim().min(1).max(120), }) .strict(); export const referenceResourceDtoSchema = z .object({ id: z.string().min(1).max(120), name: z.string().min(1).max(240), createdAt: z.string().datetime().optional(), }) .strip(); export type ReferenceResourceDto = z.output< typeof referenceResourceDtoSchema >; export const referenceProblemSchema = z .object({ type: z.string().min(1).max(512), title: z.string().min(1).max(240), status: z.int().min(100).max(599), code: z.string().min(1).max(120).optional(), /** 03-04. 422 field issues; backend messages are stripped. */ issues: z .array( z .object({ path: z.string().min(1).max(120), code: z.string().min(1).max(80), }) .strip(), ) .max(50) .optional(), }) .strip(); export type ReferenceProblem = z.output; export const createReferenceResourceCommandSchema = z .object({ name: z.string().trim().min(1).max(120), note: z.string().trim().max(500).optional(), }) .strict();