(
context: ExecutionContext,
state: ExecutionState,
triggerBlockId?: string
)
| 574 | } |
| 575 | |
| 576 | private initializeStarterBlock( |
| 577 | context: ExecutionContext, |
| 578 | state: ExecutionState, |
| 579 | triggerBlockId?: string |
| 580 | ): void { |
| 581 | let startResolution: ReturnType<typeof resolveExecutorStartBlock> | null = null |
| 582 | |
| 583 | if (triggerBlockId) { |
| 584 | const triggerBlock = this.workflow.blocks.find((b) => b.id === triggerBlockId) |
| 585 | if (!triggerBlock) { |
| 586 | this.execLogger.error('Specified trigger block not found in workflow', { |
| 587 | triggerBlockId, |
| 588 | }) |
| 589 | throw new Error(`Trigger block not found: ${triggerBlockId}`) |
| 590 | } |
| 591 | |
| 592 | startResolution = buildResolutionFromBlock(triggerBlock) |
| 593 | |
| 594 | if (!startResolution) { |
| 595 | startResolution = { |
| 596 | blockId: triggerBlock.id, |
| 597 | block: triggerBlock, |
| 598 | path: StartBlockPath.SPLIT_MANUAL, |
| 599 | } |
| 600 | } |
| 601 | } else { |
| 602 | startResolution = resolveExecutorStartBlock(this.workflow.blocks, { |
| 603 | execution: 'manual', |
| 604 | isChildWorkflow: false, |
| 605 | }) |
| 606 | |
| 607 | if (!startResolution?.block) { |
| 608 | this.execLogger.warn('No start block found in workflow') |
| 609 | return |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | if (state.getBlockStates().has(startResolution.block.id)) { |
| 614 | return |
| 615 | } |
| 616 | |
| 617 | const blockOutput = buildStartBlockOutput({ |
| 618 | resolution: startResolution, |
| 619 | workflowInput: this.workflowInput, |
| 620 | }) |
| 621 | |
| 622 | state.setBlockState(startResolution.block.id, { |
| 623 | output: blockOutput, |
| 624 | executed: false, |
| 625 | executionTime: 0, |
| 626 | }) |
| 627 | } |
| 628 | } |
no test coverage detected