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

Method request

graph-ui/src/app/atlas-api.ts:123–157  ·  view source on GitHub ↗

* One request, any method. The writing routes of the projects panel * (POST /api/index, POST /api/adr, DELETE /api/project) go through here * with a JSON body; the error carries the status so a caller can tell * "busy, try later" (423) from "refused" (403) from "not there" (404).

(method: 'GET' | 'POST' | 'DELETE', route: string, payload?: unknown)

Source from the content-addressed store, hash-verified

121 * "busy, try later" (423) from "refused" (403) from "not there" (404).
122 */
123 private async request(method: 'GET' | 'POST' | 'DELETE', route: string, payload?: unknown): Promise<unknown> {
124 const url = `${this.options.base ?? ''}${route}`;
125 const doFetch = this.options.fetch ?? globalThis.fetch;
126 let response: Response;
127 try {
128 const init: RequestInit = { method, headers: { Accept: 'application/json' } };
129 if (payload !== undefined) {
130 init.headers = { Accept: 'application/json', 'Content-Type': 'application/json' };
131 init.body = JSON.stringify(payload);
132 }
133 if (this.options.signal !== undefined) init.signal = this.options.signal;
134 response = await doFetch(url, init);
135 } catch (error) {
136 const message = error instanceof Error ? error.message : String(error);
137 const failure = new AtlasApiError(route, 0, `${route} war nicht erreichbar: ${message}`);
138 // Ein abgebrochener Aufruf ist die Sache des Aufrufers und kein Fehler des Servers.
139 if (this.options.signal?.aborted) throw failure;
140 throw announce(failure);
141 }
142 const body = await response.text();
143 if (!response.ok) {
144 throw announce(
145 new AtlasApiError(route, response.status, `${route} antwortete mit HTTP ${response.status}: ${body.slice(0, 200)}`),
146 body.slice(0, 400),
147 );
148 }
149 try {
150 return JSON.parse(body) as unknown;
151 } catch {
152 throw announce(
153 new AtlasApiError(route, response.status, `${route} lieferte kein JSON: ${body.slice(0, 200)}`),
154 body.slice(0, 400),
155 );
156 }
157 }
158
159 /**
160 * Eine Ebene des Datei-Baums. `path` leer heisst Projektwurzel.

Callers 15

saveConfigurationMethod · 0.95
getJsonMethod · 0.95
startIndexMethod · 0.95
deleteProjectMethod · 0.95
saveAdrMethod · 0.95
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
routeForFunction · 0.45
routeForFunction · 0.45

Calls 2

announceFunction · 0.70
textMethod · 0.45

Tested by

no test coverage detected