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
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import * as pageLinks from "@/server/routers/contentstack/schemas/pageLinks"
|
||||
|
||||
import { imageRefsSchema, imageSchema } from "../blocks/image"
|
||||
import {
|
||||
imageContainerRefsSchema,
|
||||
imageContainerSchema,
|
||||
} from "../blocks/imageContainer"
|
||||
import {
|
||||
linkRefsUnionSchema,
|
||||
linkUnionSchema,
|
||||
transformPageLink,
|
||||
} from "../pageLinks"
|
||||
|
||||
import { ContentEnum } from "@/types/enums/content"
|
||||
import { SidebarEnums } from "@/types/enums/sidebar"
|
||||
@@ -27,14 +30,10 @@ export const contentSchema = z.object({
|
||||
.discriminatedUnion("__typename", [
|
||||
imageContainerSchema,
|
||||
imageSchema,
|
||||
pageLinks.contentPageSchema,
|
||||
pageLinks.loyaltyPageSchema,
|
||||
pageLinks.collectionPageSchema,
|
||||
pageLinks.hotelPageSchema,
|
||||
pageLinks.accountPageSchema,
|
||||
...linkUnionSchema.options,
|
||||
])
|
||||
.transform((data) => {
|
||||
const link = pageLinks.transform(data)
|
||||
const link = transformPageLink(data)
|
||||
if (link) {
|
||||
return link
|
||||
}
|
||||
@@ -55,11 +54,7 @@ export const contentSchema = z.object({
|
||||
|
||||
const actualRefs = z.discriminatedUnion("__typename", [
|
||||
imageContainerRefsSchema,
|
||||
pageLinks.contentPageRefSchema,
|
||||
pageLinks.loyaltyPageRefSchema,
|
||||
pageLinks.collectionPageRefSchema,
|
||||
pageLinks.hotelPageRefSchema,
|
||||
pageLinks.accountPageRefSchema,
|
||||
...linkRefsUnionSchema.options,
|
||||
])
|
||||
|
||||
type Ref = typeof actualRefs._type
|
||||
|
||||
Reference in New Issue
Block a user