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

Function getScopeDropReason

apps/sim/stores/workflows/workflow/edge-validation.ts:24–48  ·  view source on GitHub ↗
(edge: Edge, blocks: Record<string, BlockState>)

Source from the content-addressed store, hash-verified

22}
23
24function getScopeDropReason(edge: Edge, blocks: Record<string, BlockState>): string | null {
25 const sourceBlock = blocks[edge.source]
26 const targetBlock = blocks[edge.target]
27
28 if (!sourceBlock || !targetBlock) {
29 return 'edge references a missing block'
30 }
31
32 const sourceParent = getParentId(sourceBlock)
33 const targetParent = getParentId(targetBlock)
34
35 if (sourceParent === targetParent) {
36 return null
37 }
38
39 if (targetParent === edge.source && isContainerBlock(sourceBlock)) {
40 return null
41 }
42
43 if (sourceParent === edge.target && isContainerBlock(targetBlock)) {
44 return null
45 }
46
47 return `blocks are in different scopes (${sourceParent ?? 'root'} -> ${targetParent ?? 'root'})`
48}
49
50export function validateEdges(
51 edges: Edge[],

Callers 1

validateEdgesFunction · 0.85

Calls 2

getParentIdFunction · 0.85
isContainerBlockFunction · 0.70

Tested by

no test coverage detected