* Creates a linear workflow with N blocks. * First block is a starter, rest are function blocks.
(blockCount: number)
| 287 | * First block is a starter, rest are function blocks. |
| 288 | */ |
| 289 | static linear(blockCount: number): WorkflowBuilder { |
| 290 | const builder = new WorkflowBuilder() |
| 291 | const spacing = 200 |
| 292 | |
| 293 | for (let i = 0; i < blockCount; i++) { |
| 294 | const id = `block-${i}` |
| 295 | const position = { x: i * spacing, y: 0 } |
| 296 | |
| 297 | if (i === 0) { |
| 298 | builder.addStarter(id, position) |
| 299 | } else { |
| 300 | builder.addFunction(id, position, `Step ${i}`) |
| 301 | } |
| 302 | |
| 303 | if (i > 0) { |
| 304 | builder.connect(`block-${i - 1}`, id) |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | return builder |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Creates a branching workflow with a condition. |
no test coverage detected