Files
nodarium/app/src/lib/runtime/remote-runtime-executor.ts
2026-02-02 16:22:14 +01:00

19 lines
508 B
TypeScript

import type { Graph, RuntimeExecutor } from '@nodarium/types';
export class RemoteRuntimeExecutor implements RuntimeExecutor {
constructor(private url: string) {}
async execute(graph: Graph, settings: Record<string, unknown>): Promise<Int32Array> {
const res = await fetch(this.url, {
method: 'POST',
body: JSON.stringify({ graph, settings })
});
if (!res.ok) {
throw new Error(`Failed to execute graph`);
}
return new Int32Array(await res.arrayBuffer());
}
}