Line data Source code
1 : import { z } from 'zod'
2 :
3 : import type { NodeProperty } from '@comfyorg/graph-model/nodeProperty'
4 :
5 : import { parseNodePropertyArray } from './parseNodePropertyArray'
6 :
7 2356 : export const serializedProxyWidgetTupleSchema = z.union([
8 : z.tuple([z.string(), z.string(), z.string()]),
9 : z.tuple([z.string(), z.string()])
10 : ])
11 : export type SerializedProxyWidgetTuple = z.infer<
12 : typeof serializedProxyWidgetTupleSchema
13 : >
14 2356 : const proxyWidgetsPropertySchema = z.array(serializedProxyWidgetTupleSchema)
15 : type ProxyWidgetsProperty = z.infer<typeof proxyWidgetsPropertySchema>
16 :
17 134 : export function parseProxyWidgets(
18 : property: NodeProperty | undefined
19 : ): ProxyWidgetsProperty {
20 134 : return parseNodePropertyArray(
21 : property,
22 : proxyWidgetsPropertySchema,
23 : 'properties.proxyWidgets'
24 : )
25 : }
|