import { t as trpc } from './trpc-client-Bucti7HD.js';
import '@trpc/client';

const GET = async ({ params, url }) => {
  const { agent, type, id } = params;
  const ts = url.searchParams.get("ts") || void 0;
  const runParam = Number(url.searchParams.get("run")) - 1 || void 0;
  try {
    const content = await trpc.tests.resultEntry.query({
      agent,
      testId: id,
      resultKey: type,
      timestamp: ts,
      index: runParam
    });
    return new Response(content, { headers: { "content-type": "text/plain; charset=utf-8" } });
  } catch (e) {
    console.error(e);
    return new Response("Failed to read report", { status: 500 });
  }
};

export { GET };
//# sourceMappingURL=_server.ts-CKK2ujPA.js.map
