(workflowId: string, runs = 1)
| 249 | } |
| 250 | |
| 251 | export async function updateWorkflowRunCounts(workflowId: string, runs = 1) { |
| 252 | try { |
| 253 | const workflow = await getWorkflowById(workflowId) |
| 254 | if (!workflow) { |
| 255 | logger.error(`Workflow ${workflowId} not found`) |
| 256 | throw new Error(`Workflow ${workflowId} not found`) |
| 257 | } |
| 258 | |
| 259 | await db |
| 260 | .update(workflowTable) |
| 261 | .set({ |
| 262 | runCount: workflow.runCount + runs, |
| 263 | lastRunAt: new Date(), |
| 264 | }) |
| 265 | .where(eq(workflowTable.id, workflowId)) |
| 266 | |
| 267 | return { |
| 268 | success: true, |
| 269 | runsAdded: runs, |
| 270 | newTotal: workflow.runCount + runs, |
| 271 | } |
| 272 | } catch (error) { |
| 273 | logger.error(`Error updating workflow stats for ${workflowId}`, error) |
| 274 | throw error |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | export const workflowHasResponseBlock = ( |
| 279 | executionResult: Pick<ExecutionResult, 'success' | 'logs'> |
no test coverage detected