* Validate entry point runtime inputs configuration
( _graph: WorkflowGraphDto, compiledDefinition: WorkflowDefinition, errors: ValidationError[], warnings: ValidationError[], )
| 455 | * Validate entry point runtime inputs configuration |
| 456 | */ |
| 457 | function validateEntryPointConfiguration( |
| 458 | _graph: WorkflowGraphDto, |
| 459 | compiledDefinition: WorkflowDefinition, |
| 460 | errors: ValidationError[], |
| 461 | warnings: ValidationError[], |
| 462 | ) { |
| 463 | const entryPointActions = compiledDefinition.actions.filter( |
| 464 | (action) => action.componentId === 'core.workflow.entrypoint', |
| 465 | ); |
| 466 | |
| 467 | if (entryPointActions.length === 0) { |
| 468 | errors.push({ |
| 469 | node: 'entry-point', |
| 470 | field: 'componentId', |
| 471 | message: 'Entry Point is required to start the workflow', |
| 472 | severity: 'error', |
| 473 | suggestion: 'Add an Entry Point component to define how the workflow is invoked', |
| 474 | }); |
| 475 | } else if (entryPointActions.length > 1) { |
| 476 | errors.push({ |
| 477 | node: 'entry-point', |
| 478 | field: 'componentId', |
| 479 | message: 'Only one Entry Point is allowed per workflow', |
| 480 | severity: 'error', |
| 481 | suggestion: 'Remove additional Entry Point components', |
| 482 | }); |
| 483 | } |
| 484 | |
| 485 | for (const action of entryPointActions) { |
| 486 | const runtimeInputs = action.params?.runtimeInputs; |
| 487 | |
| 488 | if (!Array.isArray(runtimeInputs)) { |
| 489 | errors.push({ |
| 490 | node: action.ref, |
| 491 | field: 'runtimeInputs', |
| 492 | message: 'Entry Point requires runtimeInputs configuration', |
| 493 | severity: 'error', |
| 494 | suggestion: 'Configure runtime inputs to collect data when the workflow is triggered', |
| 495 | }); |
| 496 | } else if (runtimeInputs.length === 0) { |
| 497 | warnings.push({ |
| 498 | node: action.ref, |
| 499 | field: 'runtimeInputs', |
| 500 | message: 'Entry Point has no runtime inputs configured', |
| 501 | severity: 'warning', |
| 502 | suggestion: 'Add runtime inputs if you need to collect data when the workflow is triggered', |
| 503 | }); |
| 504 | } else { |
| 505 | // Validate runtime input definitions |
| 506 | for (const runtimeInput of runtimeInputs) { |
| 507 | if (!runtimeInput.id || !runtimeInput.label || !runtimeInput.type) { |
| 508 | errors.push({ |
| 509 | node: action.ref, |
| 510 | field: 'runtimeInputs', |
| 511 | message: 'Runtime input definition missing required fields (id, label, type)', |
| 512 | severity: 'error', |
| 513 | suggestion: 'Ensure each runtime input has id, label, and type fields', |
| 514 | }); |
no test coverage detected