import type { JobPayload, JobQueueName } from "../queues"; export type JobProcessor = (payload: JobPayload) => Promise; /** * Processor registry. Each lane adds exactly ONE line for its queue, e.g. * [JOB_QUEUES.importExtraction]: () => import("./import-extraction").then((m) => m.process), * Lazy imports keep the app bundle free of worker-only dependencies (Playwright etc.). */ export const PROCESSORS: Partial Promise>> = { // lane-imports: "import-extraction": () => import("./import-extraction").then((m) => m.process), // lane-lotse: "transcription": () => import("./transcription").then((m) => m.process), // lane-reports: "report-pdf": () => import("./report-pdf").then((m) => m.process), // lane-field: "image-derivatives": () => import("./image-derivatives").then((m) => m.process), }; /** Inline fallback when no Redis is available (dev/demo). */ export async function runInline(name: JobQueueName, payload: JobPayload): Promise { const load = PROCESSORS[name]; if (!load) throw new Error(`no processor registered for ${name}`); const process = await load(); await process(payload); }