(
databases: Database[]
)
| 49 | // projects and guarantees `instanceResource` is populated (with a fallback) |
| 50 | // so consumers can read engine / instance off any database. |
| 51 | const composeDatabases = async ( |
| 52 | databases: Database[] |
| 53 | ): Promise<Database[]> => { |
| 54 | await get().batchFetchProjects(databases.map((db) => db.project)); |
| 55 | for (const database of databases) { |
| 56 | if (!database.instanceResource) { |
| 57 | database.instanceResource = { |
| 58 | ...unknownInstanceResource(), |
| 59 | name: instanceResourceNameFromDatabase(database.name), |
| 60 | }; |
| 61 | } |
| 62 | } |
| 63 | return databases; |
| 64 | }; |
| 65 | |
| 66 | // Compose then immutably merge into the by-name cache; returns the composed |
| 67 | // list so callers can hand it straight back to their consumers. |
no test coverage detected