import type { Queue, QueueOptions, RunnerFuncs, RunnerOptions, } from "@karakeep/shared/queueing"; import { buildDispatcherService } from "./dispatcher"; import { buildRunnerService } from "./runner"; export interface RestateServicePair { dispatcher: ReturnType>; runner: ReturnType>; } export function buildRestateServices( queue: Queue, funcs: RunnerFuncs, opts: RunnerOptions, queueOpts: QueueOptions, ): RestateServicePair { return { dispatcher: buildDispatcherService(queue, opts, queueOpts), runner: buildRunnerService(queue.name(), funcs, opts), }; }