Function
documentBlock
(part: MediaPart, format: DocumentFormat, bytes: string)
Source from the content-addressed store, hash-verified
| 50 | } as const satisfies Record<string, DocumentFormat> |
| 51 | |
| 52 | const documentBlock = (part: MediaPart, format: DocumentFormat, bytes: string): DocumentBlock => ({ |
| 53 | document: { |
| 54 | format, |
| 55 | name: part.filename ?? `document.${format}`, |
| 56 | source: { bytes }, |
| 57 | }, |
| 58 | }) |
| 59 | |
| 60 | // Route by MIME. Known image/document formats lower into a typed block; anything |
| 61 | // else fails with a clear error instead of silently degrading to a malformed |
Tested by
no test coverage detected