(block: SerializedBlock)
| 119 | type ValidatedInputFormatField = Required<Pick<InputFormatField, 'name' | 'type'>> |
| 120 | |
| 121 | function extractInputFormatFromBlock(block: SerializedBlock): ValidatedInputFormatField[] { |
| 122 | const metadata = block.metadata as { subBlocks?: Record<string, { value?: unknown }> } | undefined |
| 123 | const subBlocksValue = metadata?.subBlocks?.inputFormat?.value |
| 124 | const legacyValue = block.config?.params?.inputFormat |
| 125 | const inputFormatValue = subBlocksValue ?? legacyValue |
| 126 | |
| 127 | if (!Array.isArray(inputFormatValue) || inputFormatValue.length === 0) { |
| 128 | return [] |
| 129 | } |
| 130 | |
| 131 | return inputFormatValue.filter( |
| 132 | (field): field is ValidatedInputFormatField => |
| 133 | field && |
| 134 | typeof field === 'object' && |
| 135 | 'name' in field && |
| 136 | 'type' in field && |
| 137 | typeof field.name === 'string' && |
| 138 | typeof field.type === 'string' |
| 139 | ) |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Process file fields in workflow input based on the start block's inputFormat |
no outgoing calls
no test coverage detected