summaryrefslogtreecommitdiff
path: root/packages/astro-rss
diff options
context:
space:
mode:
authorGravatar Tak Tran <ematipico@users.noreply.github.com> 2024-01-22 12:09:16 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-01-22 12:09:16 +0000
commitcfc02c7440e6ccf7957d8445e45417b4f84c971e (patch)
tree60234e51b81837b20cb1153e519278def82185c9 /packages/astro-rss
parent73d74402007896204ee965f6553dc83b3dec8d2f (diff)
downloadastro-cfc02c7440e6ccf7957d8445e45417b4f84c971e.tar.gz
astro-cfc02c7440e6ccf7957d8445e45417b4f84c971e.tar.zst
astro-cfc02c7440e6ccf7957d8445e45417b4f84c971e.zip
[ci] format
Diffstat (limited to 'packages/astro-rss')
-rw-r--r--packages/astro-rss/src/schema.ts54
1 files changed, 28 insertions, 26 deletions
diff --git a/packages/astro-rss/src/schema.ts b/packages/astro-rss/src/schema.ts
index 773d39cf2..a3604bdeb 100644
--- a/packages/astro-rss/src/schema.ts
+++ b/packages/astro-rss/src/schema.ts
@@ -1,28 +1,30 @@
import { z } from 'astro/zod';
-export const rssSchema = z.object({
- title: z.string().optional(),
- description: z.string().optional(),
- pubDate: z
- .union([z.string(), z.number(), z.date()])
- .optional()
- .transform((value) => (value === undefined ? value : new Date(value)))
- .refine((value) => (value === undefined ? value : !isNaN(value.getTime()))),
- customData: z.string().optional(),
- categories: z.array(z.string()).optional(),
- author: z.string().optional(),
- commentsUrl: z.string().optional(),
- source: z.object({ url: z.string().url(), title: z.string() }).optional(),
- enclosure: z
- .object({
- url: z.string(),
- length: z.number().positive().int().finite(),
- type: z.string(),
- })
- .optional(),
- link: z.string().optional(),
- content: z.string().optional(),
-}).refine(val => val.title || val.description, {
- message: "At least title or description must be provided.",
- path: ["title", "description"]
-}) \ No newline at end of file
+export const rssSchema = z
+ .object({
+ title: z.string().optional(),
+ description: z.string().optional(),
+ pubDate: z
+ .union([z.string(), z.number(), z.date()])
+ .optional()
+ .transform((value) => (value === undefined ? value : new Date(value)))
+ .refine((value) => (value === undefined ? value : !isNaN(value.getTime()))),
+ customData: z.string().optional(),
+ categories: z.array(z.string()).optional(),
+ author: z.string().optional(),
+ commentsUrl: z.string().optional(),
+ source: z.object({ url: z.string().url(), title: z.string() }).optional(),
+ enclosure: z
+ .object({
+ url: z.string(),
+ length: z.number().positive().int().finite(),
+ type: z.string(),
+ })
+ .optional(),
+ link: z.string().optional(),
+ content: z.string().optional(),
+ })
+ .refine((val) => val.title || val.description, {
+ message: 'At least title or description must be provided.',
+ path: ['title', 'description'],
+ });