Allow syntactic sugar in config.

This commit is contained in:
Dermot Duffy
2021-11-10 21:09:17 -08:00
parent 19291ae184
commit f84cbcc50d
2 changed files with 11 additions and 9 deletions
+2
View File
@@ -103,6 +103,8 @@ const customActionSchema = z.object({
action: z.literal('fire-dom-event'),
})
export const frigateCardCustomActionSchema = customActionSchema.merge(z.object({
// Syntactic sugar to avoid 'fire-dom-event' as part of an external API.
action: z.literal('fire-dom-event').or(z.literal('custom:frigate-card-action').transform(() => 'fire-dom-event')),
frigate_card_action: z.string(),
}))
export type FrigateCardCustomAction = z.infer<typeof frigateCardCustomActionSchema>;