Line data Source code
1 : import { z } from 'zod'
2 :
3 : import type { NodeProperty } from '@comfyorg/graph-model/nodeProperty'
4 : import { toNodeId } from '@comfyorg/graph-model/nodeId'
5 :
6 : import { parseNodePropertyArray } from './parseNodePropertyArray'
7 :
8 2356 : const previewExposureSchema = z.object({
9 : name: z.string(),
10 : sourceNodeId: z.string().transform(toNodeId),
11 : sourcePreviewName: z.string()
12 : })
13 : export type PreviewExposure = z.infer<typeof previewExposureSchema>
14 :
15 2356 : const previewExposuresPropertySchema = z.array(previewExposureSchema)
16 :
17 985 : export function parsePreviewExposures(
18 : property: NodeProperty | undefined
19 : ): PreviewExposure[] {
20 985 : return parseNodePropertyArray<PreviewExposure>(
21 : property,
22 : previewExposuresPropertySchema,
23 : 'properties.previewExposures'
24 : )
25 : }
|