mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-21 23:12:16 +01:00
16 lines
448 B
TypeScript
16 lines
448 B
TypeScript
import { z } from 'zod';
|
|
import { widgetTypes } from '~/server/db/items';
|
|
|
|
import { commonItemSchema } from './item';
|
|
|
|
export const widgetTypeSchema = z.enum([widgetTypes[0], ...widgetTypes.slice(1)]);
|
|
|
|
export const widgetCreationSchema = z.object({
|
|
id: z.string(),
|
|
kind: z.literal('widget'),
|
|
type: widgetTypeSchema,
|
|
options: z.record(z.string(), z.unknown()),
|
|
});
|
|
|
|
export const widgetSchema = widgetCreationSchema.merge(commonItemSchema);
|