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

Function getActiveWorkflowContext

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

Source from the content-addressed store, hash-verified

17}
18
19export async function getActiveWorkflowContext(
20 workflowId: string
21): Promise<ActiveWorkflowContext | null> {
22 const rows = await db
23 .select({
24 workflow,
25 workspaceId: workspace.id,
26 workspaceOrganizationId: workspace.organizationId,
27 })
28 .from(workflow)
29 .innerJoin(workspace, eq(workflow.workspaceId, workspace.id))
30 .where(
31 and(eq(workflow.id, workflowId), isNull(workflow.archivedAt), isNull(workspace.archivedAt))
32 )
33 .limit(1)
34
35 if (rows.length === 0) {
36 return null
37 }
38
39 return {
40 workflow: rows[0].workflow,
41 workspaceId: rows[0].workspaceId,
42 workspaceOrganizationId: rows[0].workspaceOrganizationId,
43 }
44}
45
46export async function getActiveWorkflowRecord(
47 workflowId: string

Calls 1

eqFunction · 0.50

Tested by

no test coverage detected