Underground-Digital/Workflow-Engine
0
1import hashlib2from typing import Literal, Optional3 4from pydantic import BaseModel5 6from core.workflow.utils.condition.entities import Condition7 8 9class RunCondition(BaseModel):10 type: Literal["branch_identify", "condition"]11 """condition type"""12 13 branch_identify: Optional[str] = None14 """branch identify like: sourceHandle, required when type is branch_identify"""15 16 conditions: Optional[list[Condition]] = None17 """conditions to run the node, required when type is condition"""18 19 @property20 def hash(self) -> str:21 return hashlib.sha256(self.model_dump_json().encode()).hexdigest()22 