(options: StartBlockOutputOptions)
| 583 | } |
| 584 | |
| 585 | export function buildStartBlockOutput(options: StartBlockOutputOptions): NormalizedBlockOutput { |
| 586 | const { resolution, workflowInput } = options |
| 587 | const inputFormat = extractInputFormat(resolution.block) |
| 588 | const legacyStarterMode = |
| 589 | resolution.path === StartBlockPath.LEGACY_STARTER |
| 590 | ? getSerializedLegacyStarterMode(resolution.block) |
| 591 | : null |
| 592 | |
| 593 | if (pathConsumesInputFormat(resolution.path, legacyStarterMode)) { |
| 594 | assertNoReservedInputFormatFields(inputFormat, resolution.block) |
| 595 | } |
| 596 | |
| 597 | const { finalInput, structuredInput, hasStructured } = deriveInputFromFormat( |
| 598 | inputFormat, |
| 599 | workflowInput |
| 600 | ) |
| 601 | |
| 602 | let output: NormalizedBlockOutput |
| 603 | |
| 604 | switch (resolution.path) { |
| 605 | case StartBlockPath.UNIFIED: |
| 606 | output = buildUnifiedStartOutput(workflowInput, structuredInput, hasStructured) |
| 607 | break |
| 608 | |
| 609 | case StartBlockPath.SPLIT_API: |
| 610 | case StartBlockPath.SPLIT_INPUT: |
| 611 | output = buildApiOrInputOutput(finalInput, workflowInput) |
| 612 | break |
| 613 | |
| 614 | case StartBlockPath.SPLIT_CHAT: |
| 615 | output = buildChatOutput(workflowInput) |
| 616 | break |
| 617 | |
| 618 | case StartBlockPath.SPLIT_MANUAL: |
| 619 | output = buildManualTriggerOutput(finalInput, workflowInput) |
| 620 | break |
| 621 | |
| 622 | case StartBlockPath.EXTERNAL_TRIGGER: |
| 623 | output = buildIntegrationTriggerOutput(workflowInput, structuredInput, hasStructured) |
| 624 | break |
| 625 | |
| 626 | case StartBlockPath.LEGACY_STARTER: |
| 627 | output = buildLegacyStarterOutput(finalInput, workflowInput, legacyStarterMode) |
| 628 | break |
| 629 | |
| 630 | default: |
| 631 | output = buildManualTriggerOutput(finalInput, workflowInput) |
| 632 | } |
| 633 | |
| 634 | assertNoReservedStartOutputFields(output, resolution.block) |
| 635 | return output |
| 636 | } |
no test coverage detected