18 lines
397 B
TypeScript
18 lines
397 B
TypeScript
import * as v from 'valibot';
|
|
|
|
const hexSchema = z.string().regex(/^#[a-f0-9]{6}$/i);
|
|
|
|
const roleSchema = v.object({
|
|
id: v.fallback(v.string(), ''),
|
|
name: v.fallback(v.string(), ''),
|
|
color: hexSchema.catch(''),
|
|
permissions: v.fallback(v.string(), ''),
|
|
highlighted: v.fallback(v.boolean(), true),
|
|
});
|
|
|
|
type Role = v.InferOutput<typeof roleSchema>;
|
|
|
|
export {
|
|
roleSchema,
|
|
type Role,
|
|
};
|