fix(BOOK-453): avoid linkConnection invalid * fix(BOOK-453): avoid linkConnection invalid * test * test * test * Merge master
22 lines
429 B
TypeScript
22 lines
429 B
TypeScript
import { z } from "zod"
|
|
|
|
import { linkRefsUnionSchema } from "../../pageLinks"
|
|
|
|
export const linkConnectionRefsSchema = z
|
|
.object({
|
|
linkConnection: z.object({
|
|
edges: z.array(
|
|
z.object({
|
|
node: linkRefsUnionSchema,
|
|
})
|
|
),
|
|
}),
|
|
})
|
|
.transform((data) => {
|
|
if (!data.linkConnection.edges.length) {
|
|
return null
|
|
}
|
|
|
|
return data.linkConnection.edges[0].node?.system
|
|
})
|