Files
web/server/routers/contentstack/schemas/blocks/contentEmbeds.ts
Erik Tiekstra bf76c6277f Merged in feat/support-for-all-page-links (pull request #1212)
Feat/support for all page links

* feat: added all page link connections to queries

* feat: updated output files


Approved-by: Fredrik Thorsson
Approved-by: Matilda Landström
2025-01-27 11:21:37 +00:00

39 lines
878 B
TypeScript

import { z } from "zod"
import {
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
transformPageLink,
} from "../pageLinks"
import { imageSchema } from "./image"
import { imageContainerSchema } from "./imageContainer"
export const contentEmbedsSchema = z
.discriminatedUnion("__typename", [
imageContainerSchema,
imageSchema,
accountPageSchema,
collectionPageSchema,
contentPageSchema,
destinationCityPageSchema,
destinationCountryPageSchema,
destinationOverviewPageSchema,
hotelPageSchema,
loyaltyPageSchema,
startPageSchema,
])
.transform((data) => {
const link = transformPageLink(data)
if (link) {
return link
}
return data
})