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

Function isWorkflowBlockAncestorLocked

packages/workflow-types/src/workflow.ts:102–118  ·  view source on GitHub ↗
(
  blockId: string,
  blocks: Record<string, WorkflowLockBlock>
)

Source from the content-addressed store, hash-verified

100 * Checks whether any parent container in a block's ancestry is locked.
101 */
102export function isWorkflowBlockAncestorLocked(
103 blockId: string,
104 blocks: Record<string, WorkflowLockBlock>
105): boolean {
106 const visited = new Set<string>()
107 let parentId = getWorkflowBlockParentId(blocks[blockId])
108
109 while (parentId && !visited.has(parentId)) {
110 visited.add(parentId)
111 const parent = blocks[parentId]
112 if (!parent) return false
113 if (parent.locked) return true
114 parentId = getWorkflowBlockParentId(parent)
115 }
116
117 return false
118}
119
120/**
121 * Checks whether a block is locked directly or protected by a locked ancestor.

Callers 2

isAncestorProtectedFunction · 0.90
isWorkflowBlockProtectedFunction · 0.85

Calls 2

getWorkflowBlockParentIdFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected