* Fetches a collection's display name, caching in syncContext.
( accessToken: string, collectionId: string, syncContext?: Record<string, unknown> )
| 401 | * Fetches a collection's display name, caching in syncContext. |
| 402 | */ |
| 403 | async function fetchCollectionName( |
| 404 | accessToken: string, |
| 405 | collectionId: string, |
| 406 | syncContext?: Record<string, unknown> |
| 407 | ): Promise<string> { |
| 408 | const names = (syncContext?.collectionNames ?? {}) as Record<string, string> |
| 409 | if (names[collectionId]) return names[collectionId] |
| 410 | |
| 411 | const name = await fetchCollectionNameDirect(accessToken, collectionId) |
| 412 | |
| 413 | if (syncContext) { |
| 414 | const cached = (syncContext.collectionNames ?? {}) as Record<string, string> |
| 415 | cached[collectionId] = name |
| 416 | syncContext.collectionNames = cached |
| 417 | } |
| 418 | |
| 419 | return name |
| 420 | } |
| 421 | |
| 422 | /** |
| 423 | * Fetches a collection's display name directly from the API. |
no test coverage detected