* Type guard to check if a block is a base64 image block
( block: unknown, )
| 38 | * Type guard to check if a block is a base64 image block |
| 39 | */ |
| 40 | function isBase64ImageBlock( |
| 41 | block: unknown, |
| 42 | ): block is { type: 'image'; source: { type: 'base64'; data: string } } { |
| 43 | if (typeof block !== 'object' || block === null) return false |
| 44 | const b = block as Record<string, unknown> |
| 45 | if (b.type !== 'image') return false |
| 46 | if (typeof b.source !== 'object' || b.source === null) return false |
| 47 | const source = b.source as Record<string, unknown> |
| 48 | return source.type === 'base64' && typeof source.data === 'string' |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Validates that all images in messages are within the API size limit. |
no outgoing calls
no test coverage detected