MCPcopy Create free account
hub / github.com/simstudioai/sim / findStartBlock

Method findStartBlock

apps/sim/lib/workflows/triggers/triggers.ts:411–427  ·  view source on GitHub ↗

* Find the appropriate start block for a given execution context

(
    blocks: Record<string, T>,
    executionType: 'chat' | 'manual' | 'api' | 'external',
    isChildWorkflow = false
  )

Source from the content-addressed store, hash-verified

409 * Find the appropriate start block for a given execution context
410 */
411 static findStartBlock<T extends { type: string; subBlocks?: any }>(
412 blocks: Record<string, T>,
413 executionType: 'chat' | 'manual' | 'api' | 'external',
414 isChildWorkflow = false
415 ): (StartBlockCandidate<T> & { block: T }) | null {
416 const candidates = resolveStartCandidates(blocks, {
417 execution: executionType,
418 isChildWorkflow,
419 })
420
421 if (candidates.length === 0) {
422 return null
423 }
424
425 const [primary] = candidates
426 return primary
427 }
428
429 /**
430 * Check if multiple triggers of a restricted type exist

Callers 4

executeWorkflowCoreFunction · 0.80
WorkflowSidebarBodyFunction · 0.80
ChatFunction · 0.80
executeWorkflowFunction · 0.80

Calls 1

resolveStartCandidatesFunction · 0.85

Tested by

no test coverage detected