MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / loadLayout

Function loadLayout

graph-ui/src/galaxy/layout-source.ts:151–182  ·  view source on GitHub ↗
(
    project: string,
    options: LayoutSourceOptions = {},
)

Source from the content-addressed store, hash-verified

149 * Flaechen dieses Servers gerade schweigt.
150 */
151export async function loadLayout(
152 project: string,
153 options: LayoutSourceOptions = {},
154): Promise<GraphData> {
155 const route = layoutUrl(project, options.maxNodes ?? LAYOUT_NODE_BUDGET);
156 const url = `${options.base ?? ''}${route}`;
157 const doFetch = options.fetch ?? globalThis.fetch;
158 let response: Response;
159 try {
160 response = await doFetch(url, {
161 headers: { Accept: 'application/json' },
162 ...(options.signal !== undefined ? { signal: options.signal } : {}),
163 });
164 } catch (error) {
165 const message = error instanceof Error ? error.message : String(error);
166 throw new LayoutError(0, `${LAYOUT_ROUTE} war nicht erreichbar: ${message}`);
167 }
168 const body = await response.text();
169 if (!response.ok) {
170 throw new LayoutError(
171 response.status,
172 `${LAYOUT_ROUTE} antwortete mit HTTP ${response.status}: ${body.slice(0, 200)}`,
173 );
174 }
175 let parsed: unknown;
176 try {
177 parsed = JSON.parse(body) as unknown;
178 } catch {
179 throw new LayoutError(response.status, `${LAYOUT_ROUTE} lieferte kein JSON: ${body.slice(0, 200)}`);
180 }
181 return readGraphData(parsed);
182}

Callers 2

GalaxyPanelFunction · 0.90

Calls 3

layoutUrlFunction · 0.90
readGraphDataFunction · 0.85
textMethod · 0.45

Tested by

no test coverage detected