( msg: SDKMessage, )
| 19 | * skipped (non-user type, missing/empty content). |
| 20 | */ |
| 21 | export function extractInboundMessageFields( |
| 22 | msg: SDKMessage, |
| 23 | ): |
| 24 | | { content: string | Array<ContentBlockParam>; uuid: UUID | undefined } |
| 25 | | undefined { |
| 26 | if (msg.type !== 'user') return undefined |
| 27 | const content = msg.message?.content |
| 28 | if (!content) return undefined |
| 29 | if (Array.isArray(content) && content.length === 0) return undefined |
| 30 | |
| 31 | const uuid = |
| 32 | 'uuid' in msg && typeof msg.uuid === 'string' |
| 33 | ? (msg.uuid as UUID) |
| 34 | : undefined |
| 35 | |
| 36 | return { |
| 37 | content: Array.isArray(content) ? normalizeImageBlocks(content) : content, |
| 38 | uuid, |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Normalize image content blocks from bridge clients. iOS/web clients may |
no test coverage detected