- Migration 0002_craftvia_domain: 27 Fachtabellen inkl. RLS (enable_tenant_rls) - TENANT_MODELS (db.ts, backup/topology.ts) um alle Fachmodelle ergänzt - moduleGuard liefert DB-autoritative Rechte; ServiceCtx für Domänen-Services - Verträge: Statusmaschine, Events, Nummernkreise, Sichtbarkeits-Scopes, Job-Queues + Worker, KI-Provider-Interfaces, Sync-Envelope - docs/craftvia/ARCHITEKTUR.md mit Lanes, Ownership und DoD Gate: tsc, lint, build, 22/22 Tests grün. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
1.2 KiB
TypeScript
24 lines
1.2 KiB
TypeScript
import type { JobPayload, JobQueueName } from "../queues";
|
|
|
|
export type JobProcessor = (payload: JobPayload) => Promise<void>;
|
|
|
|
/**
|
|
* 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<Record<JobQueueName, () => Promise<JobProcessor>>> = {
|
|
// 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<void> {
|
|
const load = PROCESSORS[name];
|
|
if (!load) throw new Error(`no processor registered for ${name}`);
|
|
const process = await load();
|
|
await process(payload);
|
|
}
|