media embed element

This commit is contained in:
Nate Kelley 2025-08-02 13:16:06 -06:00
parent 709c3bf627
commit 1f8cdd1677
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 1098 additions and 329 deletions

File diff suppressed because it is too large Load Diff

View File

@ -326,6 +326,15 @@ export const MetricElementSchema = z.object({
caption: z.array(z.union([TextSchema, ParagraphElementSchema])).default([]),
});
export const MediaEmbedElementSchema = z.object({
type: z.literal('media_embed'),
id: z.string().optional(),
url: z.string(),
width: z.union([z.number(), z.string().regex(/^(?:\d+px|\d+%)$/)]).optional(),
children: z.array(SimpleTextSchema).default([]),
caption: z.array(z.union([TextSchema, ParagraphElementSchema])).default([]),
});
/**
* Composite Schemas
* -----------------
@ -355,6 +364,7 @@ export const ReportElementSchema = z.discriminatedUnion('type', [
FileElementSchema,
MetricElementSchema,
ToggleElementSchema,
MediaEmbedElementSchema,
]);
// Array of report elements for complete documents