import { z } from "zod"; import { isReservedName } from "./reserved-names"; export const accountName = z .string() .trim() .min(1) .max(39) .regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/, "Use letters, numbers and single hyphens") .refine((name) => !isReservedName(name), "That name is reserved"); export const repoName = z .string() .trim() .min(1) .max(100) .regex(/^[A-Za-z0-9._-]+$/, "Use letters, numbers, '.', '-' and '_'") .refine((name) => !name.endsWith(".git") && name !== "." && name !== "..", "Invalid repository name"); export const repoRef = z.object({ owner: z.string().min(1), repo: z.string().min(1) }); export const password = z.string().min(8, "Use at least 8 characters").max(200); export const email = z.email(); export const markdownBody = z.string().max(65536); export const title = z.string().trim().min(1, "Title is required").max(256); export const labelColor = z.string().regex(/^[0-9a-fA-F]{6}$/, "Use a 6-digit hex color"); export const secretName = z .string() .regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "Secret names must be valid environment variable names") .max(100);