(flow: FlowRaw)
| 2 | import { omit } from 'lodash-es'; |
| 3 | |
| 4 | export function constructFlowTree(flow: FlowRaw): Flow { |
| 5 | const rootOperation = flow.operations.find((operation) => operation.id === flow.operation) ?? null; |
| 6 | |
| 7 | const operationTree = constructOperationTree(rootOperation, flow.operations); |
| 8 | |
| 9 | const flowTree: Flow = { |
| 10 | ...omit(flow, 'operations'), |
| 11 | operation: operationTree, |
| 12 | options: flow.options ?? {}, |
| 13 | }; |
| 14 | |
| 15 | return flowTree; |
| 16 | } |
| 17 | |
| 18 | function constructOperationTree(root: OperationRaw | null, operations: OperationRaw[]): Operation | null { |
| 19 | if (root === null) { |
no test coverage detected