papertrail/lib/jobs/types.ts
caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

50 lines
1.1 KiB
TypeScript

// Domain types for the job queue and schedules. camelCase shapes returned by
// the repository/queue layer; DB rows are snake_case and mapped in queue.ts.
export const JOB_STATUSES = [
"queued",
"running",
"completed",
"failed",
] as const;
export type JobStatus = (typeof JOB_STATUSES)[number];
export interface Job {
id: string;
orgId: string;
type: string;
payload: Record<string, unknown>;
status: JobStatus;
attempts: number;
maxAttempts: number;
runAfter: string;
lockedAt: string | null;
result: Record<string, unknown> | null;
error: string | null;
createdAt: string;
updatedAt: string;
}
export interface Schedule {
id: string;
orgId: string;
name: string;
type: string;
cron: string;
payload: Record<string, unknown>;
enabled: boolean;
lastRunAt: string | null;
nextRunAt: string | null;
createdAt: string;
updatedAt: string;
}
// Result of processing one tick: how many jobs ran and how many schedules fired.
export interface TickResult {
processedJobs: number;
completedJobs: number;
failedJobs: number;
firedSchedules: number;
}