fix: build erorr
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m55s
All checks were successful
Deploy to GitHub Pages / build_site (push) Successful in 1m55s
This commit is contained in:
34
app/src/routes/runtime/server.ts
Normal file
34
app/src/routes/runtime/server.ts
Normal 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 });
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user