(params: {
workflowId: string
deploymentVersionId: string
requestId: string
state: { blocks?: Record<string, unknown> }
})
| 529 | } |
| 530 | |
| 531 | async function syncMcpToolsIfStillActive(params: { |
| 532 | workflowId: string |
| 533 | deploymentVersionId: string |
| 534 | requestId: string |
| 535 | state: { blocks?: Record<string, unknown> } |
| 536 | }): Promise<void> { |
| 537 | const tools = await db.transaction(async (tx) => { |
| 538 | await setWorkflowMcpTransactionLockTimeout(tx) |
| 539 | |
| 540 | const [workflowRecord] = await tx |
| 541 | .select({ id: workflowTable.id }) |
| 542 | .from(workflowTable) |
| 543 | .where(eq(workflowTable.id, params.workflowId)) |
| 544 | .for('update') |
| 545 | .limit(1) |
| 546 | |
| 547 | if (!workflowRecord) return [] |
| 548 | |
| 549 | const [versionRow] = await tx |
| 550 | .select({ id: workflowDeploymentVersion.id }) |
| 551 | .from(workflowDeploymentVersion) |
| 552 | .where( |
| 553 | and( |
| 554 | eq(workflowDeploymentVersion.workflowId, params.workflowId), |
| 555 | eq(workflowDeploymentVersion.id, params.deploymentVersionId), |
| 556 | eq(workflowDeploymentVersion.isActive, true) |
| 557 | ) |
| 558 | ) |
| 559 | .limit(1) |
| 560 | |
| 561 | if (!versionRow) return [] |
| 562 | |
| 563 | return syncMcpToolsForWorkflow({ |
| 564 | workflowId: params.workflowId, |
| 565 | requestId: params.requestId, |
| 566 | state: params.state, |
| 567 | context: 'deployment-outbox', |
| 568 | tx, |
| 569 | notify: false, |
| 570 | throwOnError: true, |
| 571 | }) |
| 572 | }) |
| 573 | notifyMcpToolServers(tools) |
| 574 | } |
| 575 | |
| 576 | async function createSchedulesIfStillActive(params: { |
| 577 | workflowId: string |
no test coverage detected