* Builds the metadata object carried on every document, used both for tag mapping * (`mapTags`) and for downstream display. Kept in one place so listing and * single-item fetches emit identical metadata.
(
item: MondayItem,
board: { id: string; name: string }
)
| 215 | * single-item fetches emit identical metadata. |
| 216 | */ |
| 217 | function itemMetadata( |
| 218 | item: MondayItem, |
| 219 | board: { id: string; name: string } |
| 220 | ): Record<string, unknown> { |
| 221 | return { |
| 222 | boardId: board.id, |
| 223 | boardName: board.name, |
| 224 | itemName: item.name ?? '', |
| 225 | groupTitle: item.group?.title ?? '', |
| 226 | state: item.state ?? '', |
| 227 | creatorName: item.creator?.name ?? '', |
| 228 | createdAt: item.created_at ?? undefined, |
| 229 | updatedAt: item.updated_at ?? undefined, |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Produces a fully-hydrated document from a single `items_page` element. The list |