MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / recordBlock

Method recordBlock

e2e/cloud/mcp-sse-replay.test.ts:150–166  ·  view source on GitHub ↗
(block: string)

Source from the content-addressed store, hash-verified

148 }
149
150 private recordBlock(block: string): void {
151 let data = "";
152 let id: string | null = null;
153 for (const line of block.replace(/\r/g, "").split("\n")) {
154 if (line.startsWith("data:")) data += `${line.slice("data:".length).trimStart()}\n`;
155 if (line.startsWith("id:")) id = line.slice("id:".length).trim();
156 }
157 if (id) this.eventIds.push(id);
158 const trimmed = data.trim();
159 if (!trimmed) return;
160 const parsed = JSON.parse(trimmed) as JsonRpcMessage;
161 this.messages.push(parsed);
162 if (typeof parsed.id !== "string") return;
163 const waiters = this.waiters.get(parsed.id) ?? [];
164 this.waiters.delete(parsed.id);
165 for (const waiter of waiters) waiter.resolve(parsed);
166 }
167}
168
169const openGet = async (mcpUrl: string, bearer: string, sessionId: string): Promise<SseCapture> => {

Callers 1

consumeBlocksMethod · 0.95

Calls 5

pushMethod · 0.80
resolveMethod · 0.80
replaceMethod · 0.65
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected