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

Function workspaceExists

apps/sim/lib/workspaces/permissions/utils.ts:44–60  ·  view source on GitHub ↗
(
  workspaceId: string,
  options?: { includeArchived?: boolean }
)

Source from the content-addressed store, hash-verified

42 * @returns True if the workspace exists, false otherwise
43 */
44export async function workspaceExists(
45 workspaceId: string,
46 options?: { includeArchived?: boolean }
47): Promise<boolean> {
48 const { includeArchived = false } = options ?? {}
49 const [ws] = await db
50 .select({ id: workspace.id })
51 .from(workspace)
52 .where(
53 includeArchived
54 ? eq(workspace.id, workspaceId)
55 : and(eq(workspace.id, workspaceId), isNull(workspace.archivedAt))
56 )
57 .limit(1)
58
59 return !!ws
60}
61
62/**
63 * Get a workspace by ID for existence check

Callers 3

utils.test.tsFile · 0.90
route.tsFile · 0.90
getWorkspaceByIdFunction · 0.85

Calls 1

eqFunction · 0.50

Tested by

no test coverage detected