@@ -47,6 +47,8 @@ interface NodeThumbnail {
4747 outputHandleDefs ?: ( OutputHandleDef | GroupDividerDef ) [ ] ;
4848 additionalOutputs ?: boolean ;
4949 additionalOutputDefs ?: OutputHandleDef [ ] ;
50+ conditionHandleDefs ?: ConditionHandleDef [ ] ;
51+ defaultConditionHandleDef ?: DefaultConditionHandleDef ;
5052 slots ?: SlotProvider [ ] ;
5153 slotNodeDefs ?: SlotNodeDef [ ] ;
5254 handleInputsFrom ?: HandleInputFrom [ ] ;
@@ -88,6 +90,22 @@ interface InputHandleDef extends OutputHandleDef {
8890
8991interface ValueHandleDef extends InputHandleDef { }
9092
93+ interface ConditionExpression {
94+ input_handle : string ;
95+ operator : string ;
96+ value ?: any ;
97+ }
98+
99+ interface DefaultConditionHandleDef {
100+ handle : string ;
101+ description ?: string ;
102+ }
103+
104+ interface ConditionHandleDef extends DefaultConditionHandleDef {
105+ logical ?: string ;
106+ expressions ?: ConditionExpression [ ] ;
107+ }
108+
91109interface HandleInputFrom {
92110 handle : string ;
93111 value ?: any ;
@@ -150,6 +168,13 @@ interface Node {
150168 slots ?: SlotProvider [ ] ;
151169
152170 slot ?: InlineSlotBlock ;
171+
172+ conditions ?: InlineConditionBlock ;
173+ }
174+
175+ interface InlineConditionBlock {
176+ cases ?: ConditionHandleDef [ ] ;
177+ default ?: DefaultConditionHandleDef ;
153178}
154179
155180interface InlineSlotBlock {
@@ -182,6 +207,7 @@ enum NODE_TYPE {
182207 SubflowNode = "subflow_node" ,
183208 SlotNode = "slot_node" ,
184209 ValueNode = "value_node" ,
210+ ConditionNode = "condition_node" ,
185211}
186212
187213const isFile = async ( path : string ) : Promise < boolean > => {
@@ -377,6 +403,13 @@ export class Thumbnail implements ThumbnailProvider {
377403 node . slots = raw . slots ;
378404 node . handleInputsFrom = raw . inputs_from ;
379405 }
406+ else if ( typeof raw . conditions === "object" && raw . conditions ) {
407+ node . type = NODE_TYPE . ConditionNode ;
408+ node . inputHandleDefs = raw . inputs_def ;
409+ node . conditionHandleDefs = raw . conditions . cases ;
410+ node . defaultConditionHandleDef = raw . conditions . default ;
411+ node . handleInputsFrom = raw . inputs_from ;
412+ }
380413 else {
381414 // Not implemented.
382415 node . type = NODE_TYPE . ErrorNode ;
0 commit comments