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

Function ledgerFor

e2e/src/surfaces/autumn.ts:351–384  ·  view source on GitHub ↗
(operationId: string)

Source from the content-addressed store, hash-verified

349 });
350
351 const ledgerFor = (operationId: string) =>
352 Effect.gen(function* () {
353 const response = yield* Effect.promise(() => fetch(`${autumnUrl}/_emulate/ledger`));
354 if (!response.ok) {
355 return yield* Effect.fail(
356 `autumn ledger responded ${response.status}: ${yield* Effect.promise(() => response.text())}`,
357 );
358 }
359 const body = (yield* Effect.promise(() => response.json())) as {
360 readonly entries?: ReadonlyArray<{
361 readonly operationId?: string;
362 readonly method?: string;
363 readonly path?: string;
364 readonly faulted?: boolean;
365 readonly request?: { readonly body?: unknown };
366 }>;
367 };
368 return (body.entries ?? [])
369 .filter((entry) => entry.operationId === operationId)
370 .map((entry) => {
371 const requestBody = entry.request?.body;
372 const customerId =
373 typeof requestBody === "object" && requestBody !== null
374 ? (requestBody as { readonly customer_id?: unknown }).customer_id
375 : undefined;
376 return {
377 operationId: entry.operationId,
378 method: entry.method ?? "",
379 path: entry.path ?? "",
380 faulted: entry.faulted === true,
381 customerId: typeof customerId === "string" ? customerId : undefined,
382 };
383 });
384 });
385
386 return {
387 usageEvents,

Callers

nothing calls this directly

Calls 3

textMethod · 0.65
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected