MCPcopy
hub / github.com/simstudioai/sim / linear

Method linear

packages/testing/src/builders/workflow.builder.ts:289–309  ·  view source on GitHub ↗

* Creates a linear workflow with N blocks. * First block is a starter, rest are function blocks.

(blockCount: number)

Source from the content-addressed store, hash-verified

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.

Callers 2

store.test.tsFile · 0.80

Calls 3

addStarterMethod · 0.95
addFunctionMethod · 0.95
connectMethod · 0.95

Tested by

no test coverage detected