Files
web/packages/trpc/lib/routers/contentstack/destinationOverviewPage/output.ts
Linus Flood 5fc93472f4 Merged in feat/rework-contentstack (pull request #3493)
Feat(SW-3708): refactor contentstack fetching (removing all refs) and cache invalidation

* Remove all REFS

* Revalidate correct language

* PR fixes

* PR fixes

* Throw when errors from contentstack api


Approved-by: Joakim Jäderberg
2026-01-27 12:38:36 +00:00

37 lines
1.0 KiB
TypeScript

import { z } from "zod"
import { DestinationOverviewPageEnum } from "../../../types/destinationOverviewPage"
import { discriminatedUnionArray } from "../../../utils/discriminatedUnion"
import { cardGallerySchema } from "../schemas/blocks/cardGallery"
import { mapLocationSchema } from "../schemas/mapLocation"
import { systemSchema } from "../schemas/system"
const destinationOverviewPageCardGallery = z
.object({
__typename: z.literal(
DestinationOverviewPageEnum.ContentStack.blocks.CardGallery
),
})
.merge(cardGallerySchema)
export const blocksSchema = z.discriminatedUnion("__typename", [
destinationOverviewPageCardGallery,
])
export const destinationOverviewPageSchema = z.object({
destination_overview_page: z.object({
heading: z.string().nullish(),
blocks: discriminatedUnionArray(blocksSchema.options),
location: mapLocationSchema,
system: systemSchema.merge(
z.object({
created_at: z.string(),
updated_at: z.string(),
})
),
}),
trackingProps: z.object({
url: z.string(),
}),
})