File size: 1,762 Bytes
6111b2b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import { z } from "zod";
export const freeProxySourceSchema = z.enum(["1proxy", "proxifly", "iplocate"]);
export const freeProxyListSchema = z.object({
sources: z
.string()
.optional()
.transform((val) => (val ? val.split(",").filter(Boolean) : undefined))
.pipe(z.array(freeProxySourceSchema).optional()),
protocol: z.enum(["http", "https", "socks4", "socks5"]).optional(),
country: z
.string()
.max(2)
.optional()
.transform((v) => v?.toUpperCase()),
minQuality: z.coerce.number().int().min(0).max(100).optional(),
limit: z.coerce.number().int().min(1).max(1000).optional(),
offset: z.coerce.number().int().min(0).optional(),
onlyNotInPool: z
.string()
.optional()
.transform((v) => v === "1" || v === "true"),
});
export const freeProxySyncSchema = z.object({
sources: z.array(freeProxySourceSchema).optional(),
});
export const freeProxyBulkAddSchema = z.object({
ids: z.array(z.string().uuid()).min(1).max(100),
});
export const vercelDeploySchema = z.object({
// Vercel personal access tokens are not strictly versioned but follow a
// base-64-ish alphanumeric format. Reject obviously-malformed inputs early
// so users get clearer feedback than a Vercel 401 (and so accidentally
// pasting an OpenAI/Anthropic key is caught at the boundary).
token: z
.string()
.min(20, "Vercel token looks too short")
.max(200)
.regex(
/^[A-Za-z0-9_-]+$/,
"Vercel token must contain only alphanumeric, underscore, or hyphen"
),
projectName: z
.string()
.min(3)
.max(52)
.regex(/^[a-z0-9-]+$/, "Project name must be lowercase alphanumeric with hyphens")
.default("omniroute-relay"),
});
|