(workspaceId?: string, options?: { scope?: WorkflowQueryScope })
| 109 | } |
| 110 | |
| 111 | export function useWorkflows(workspaceId?: string, options?: { scope?: WorkflowQueryScope }) { |
| 112 | const { scope = 'active' } = options || {} |
| 113 | |
| 114 | return useQuery({ |
| 115 | queryKey: workflowKeys.list(workspaceId, scope), |
| 116 | queryFn: workspaceId ? getWorkflowListQueryOptions(workspaceId, scope).queryFn : skipToken, |
| 117 | placeholderData: keepPreviousData, |
| 118 | staleTime: WORKFLOW_LIST_STALE_TIME, |
| 119 | }) |
| 120 | } |
| 121 | |
| 122 | const selectWorkflowMap = (data: WorkflowMetadata[]): Record<string, WorkflowMetadata> => |
| 123 | Object.fromEntries(data.map((w) => [w.id, w])) |
no test coverage detected