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

Function createLinearWorkflow

packages/testing/src/factories/workflow.factory.ts:50–80  ·  view source on GitHub ↗
(blockCount: number, spacing = 200)

Source from the content-addressed store, hash-verified

48 * ```
49 */
50export function createLinearWorkflow(blockCount: number, spacing = 200): any {
51 if (blockCount < 1) {
52 return createWorkflowState()
53 }
54
55 const blocks: Record<string, any> = {}
56 const blockIds: string[] = []
57
58 for (let i = 0; i < blockCount; i++) {
59 const id = `block-${i}`
60 blockIds.push(id)
61
62 if (i === 0) {
63 blocks[id] = createStarterBlock({
64 id,
65 position: { x: i * spacing, y: 0 },
66 })
67 } else {
68 blocks[id] = createFunctionBlock({
69 id,
70 name: `Step ${i}`,
71 position: { x: i * spacing, y: 0 },
72 })
73 }
74 }
75
76 return createWorkflowState({
77 blocks,
78 edges: createLinearEdges(blockIds),
79 })
80}
81
82/**
83 * Creates a workflow with a branching condition.

Callers 1

Calls 5

createStarterBlockFunction · 0.90
createFunctionBlockFunction · 0.90
createLinearEdgesFunction · 0.90
createWorkflowStateFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected