* Creates a workflow with the specified blocks and connects them linearly.
(...blockConfigs: Array<{ id: string; type: string }>)
| 266 | * Creates a workflow with the specified blocks and connects them linearly. |
| 267 | */ |
| 268 | static chain(...blockConfigs: Array<{ id: string; type: string }>): WorkflowBuilder { |
| 269 | const builder = new WorkflowBuilder() |
| 270 | let x = 0 |
| 271 | const spacing = 200 |
| 272 | |
| 273 | blockConfigs.forEach((config, index) => { |
| 274 | builder.addBlock(config.id, config.type, { x, y: 0 }) |
| 275 | x += spacing |
| 276 | |
| 277 | if (index > 0) { |
| 278 | builder.connect(blockConfigs[index - 1].id, config.id) |
| 279 | } |
| 280 | }) |
| 281 | |
| 282 | return builder |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * Creates a linear workflow with N blocks. |
no test coverage detected