(block: SerializedBlock, key: string)
| 110 | } |
| 111 | |
| 112 | function readMetadataSubBlockValue(block: SerializedBlock, key: string): unknown { |
| 113 | const metadata = block.metadata |
| 114 | if (!metadata || typeof metadata !== 'object') { |
| 115 | return undefined |
| 116 | } |
| 117 | |
| 118 | const maybeWithSubBlocks = metadata as typeof metadata & { |
| 119 | subBlocks?: Record<string, unknown> |
| 120 | } |
| 121 | |
| 122 | const raw = maybeWithSubBlocks.subBlocks?.[key] |
| 123 | if (!raw || typeof raw !== 'object' || Array.isArray(raw)) { |
| 124 | return undefined |
| 125 | } |
| 126 | |
| 127 | return (raw as { value?: unknown }).value |
| 128 | } |
| 129 | |
| 130 | function extractInputFormat(block: SerializedBlock): InputFormatField[] { |
| 131 | const fromMetadata = readMetadataSubBlockValue(block, 'inputFormat') |
no outgoing calls
no test coverage detected