fix: build erorr
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m55s

This commit is contained in:
2024-04-26 19:12:34 +02:00
parent 98a4e6e34d
commit 99638cc699

View File

@@ -0,0 +1,34 @@
import type { RequestHandler } from "./$types";
import { MemoryRuntimeExecutor } from "$lib/runtime-executor";
import { RemoteNodeRegistry } from "$lib/node-registry-client";
import { createPerformanceStore } from "$lib/performance";
const registry = new RemoteNodeRegistry("");
const runtime = new MemoryRuntimeExecutor(registry);
const performanceStore = createPerformanceStore();
runtime.perf = performanceStore;
export const prerender = false;
export const POST: RequestHandler = async ({ request, fetch }) => {
const { graph, settings } = await request.json();
if (!graph || !settings) {
return new Response("Invalid request", { status: 400 });
}
registry.fetch = fetch;
await registry.load(graph.nodes.map(node => node.type))
const res = await runtime.execute(graph, settings);
let headers: Record<string, string> = { "Content-Type": "application/octet-stream" };
if (runtime.perf) {
headers["performance"] = JSON.stringify(runtime.perf.get());
}
return new Response(res, { headers });
}