MCPcopy Index your code
hub / github.com/simstudioai/sim / getWorkflowLockStatus

Function getWorkflowLockStatus

packages/platform-authz/src/workflow.ts:142–173  ·  view source on GitHub ↗
(workflowId: string)

Source from the content-addressed store, hash-verified

140}
141
142export async function getWorkflowLockStatus(workflowId: string): Promise<LockStatus> {
143 const [wf] = await db
144 .select({
145 locked: workflow.locked,
146 folderId: workflow.folderId,
147 })
148 .from(workflow)
149 .where(and(eq(workflow.id, workflowId), isNull(workflow.archivedAt)))
150 .limit(1)
151
152 if (!wf) {
153 return {
154 locked: false,
155 directLocked: false,
156 inheritedLocked: false,
157 lockedBy: null,
158 lockedFolderId: null,
159 }
160 }
161
162 if (wf.locked) {
163 return {
164 locked: true,
165 directLocked: true,
166 inheritedLocked: false,
167 lockedBy: 'workflow',
168 lockedFolderId: null,
169 }
170 }
171
172 return getFolderLockStatus(wf.folderId)
173}
174
175export async function assertWorkflowMutable(workflowId: string): Promise<void> {
176 const status = await getWorkflowLockStatus(workflowId)

Callers 1

assertWorkflowMutableFunction · 0.85

Calls 2

getFolderLockStatusFunction · 0.85
eqFunction · 0.50

Tested by

no test coverage detected