( rateLimit: RateLimitResult, userId: string, workflowId: string )
| 13 | * unauthorized callers cannot probe workflow existence. |
| 14 | */ |
| 15 | export async function resolveV1DeploymentWorkflow( |
| 16 | rateLimit: RateLimitResult, |
| 17 | userId: string, |
| 18 | workflowId: string |
| 19 | ): Promise< |
| 20 | | { ok: true; workflow: ActiveWorkflowRecord; workspaceId: string } |
| 21 | | { ok: false; response: NextResponse } |
| 22 | > { |
| 23 | const workflow = await getActiveWorkflowRecord(workflowId) |
| 24 | if (!workflow?.workspaceId) { |
| 25 | return { ok: false, response: workflowNotFoundResponse() } |
| 26 | } |
| 27 | |
| 28 | const accessError = await validateWorkspaceAccess( |
| 29 | rateLimit, |
| 30 | userId, |
| 31 | workflow.workspaceId, |
| 32 | 'admin' |
| 33 | ) |
| 34 | if (accessError) { |
| 35 | return { ok: false, response: workflowNotFoundResponse() } |
| 36 | } |
| 37 | |
| 38 | return { ok: true, workflow, workspaceId: workflow.workspaceId } |
| 39 | } |
no test coverage detected