MCPcopy Index your code
hub / github.com/bytebase/bytebase / composeDatabases

Function composeDatabases

frontend/src/react/stores/app/database.ts:51–64  ·  view source on GitHub ↗
(
    databases: Database[]
  )

Source from the content-addressed store, hash-verified

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.

Callers 3

upsertDatabasesFunction · 0.85
fetchByNameFunction · 0.85
createDatabaseSliceFunction · 0.85

Calls 3

unknownInstanceResourceFunction · 0.90
getFunction · 0.85

Tested by

no test coverage detected