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

Function isFolderInWorkspace

packages/platform-authz/src/workflow.ts:210–226  ·  view source on GitHub ↗
(
  folderId: string | null | undefined,
  workspaceId: string
)

Source from the content-addressed store, hash-verified

208 * folder references when a workflow's `folderId` is set from request input.
209 */
210export async function isFolderInWorkspace(
211 folderId: string | null | undefined,
212 workspaceId: string
213): Promise<boolean> {
214 if (!folderId) return true
215
216 const [folder] = await db
217 .select({
218 workspaceId: workflowFolder.workspaceId,
219 archivedAt: workflowFolder.archivedAt,
220 })
221 .from(workflowFolder)
222 .where(eq(workflowFolder.id, folderId))
223 .limit(1)
224
225 return Boolean(folder && folder.workspaceId === workspaceId && !folder.archivedAt)
226}
227
228/**
229 * Throws {@link FolderNotFoundError} (HTTP 400) when `folderId` does not belong to

Callers 3

performCreateWorkflowFunction · 0.90
performUpdateWorkflowFunction · 0.90
assertFolderInWorkspaceFunction · 0.85

Calls 1

eqFunction · 0.50

Tested by

no test coverage detected