/** * Shared JSON response helpers for the The Nook license API routes. * Underscore-prefixed file — not a route. */ export function json(data: unknown, status = 200): Response { return new Response(JSON.stringify(data), { status, headers: { "Content-Type": "application/json" } }); } export function error(message: string, status: number): Response { return json({ error: message }, status); } const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; export function isUuid(value: unknown): value is string { return typeof value === "string" && UUID_RE.test(value); }