Skip to content

Commit

Permalink
chore(private-credential): ifThenElse in formatLogicNode
Browse files Browse the repository at this point in the history
  • Loading branch information
martonmoro committed Dec 20, 2024
1 parent ea0b926 commit ccc2e65
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/features/src/web-connector/utils/render-payload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ const formatLogicNode = (node: LogicNode, level = 0): string => {
throw Error("CONSTANT node must have 'data'")
}
return `${node.data}`
case "ifThenElse":
if (!node.condition || !node.thenNode || !node.elseNode) {
throw Error(
"IF_THEN_ELSE node must have 'condition', 'thenNode', and 'elseNode'",
)
}
return `${indent}If this condition is true:\n${indent}- ${formatLogicNode(node.condition, level + 1)}\n${indent}Then:\n${indent}- ${formatLogicNode(node.thenNode, level + 1)}\n${indent}Otherwise:\n${indent}- ${formatLogicNode(node.elseNode, level + 1)}`

default:
throw Error(`Unknown node type: ${node.type}`)
Expand Down

0 comments on commit ccc2e65

Please sign in to comment.