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

35 lines
1.3 KiB
TypeScript

import { z } from "zod";
// Validation schemas for document API request bodies. All LLM/user-supplied
// input is validated at the boundary before it touches the database.
const uuid = z.string().uuid();
// POST /api/documents — create metadata for a document without content yet.
export const createDocumentSchema = z.object({
filename: z.string().trim().min(1).max(500),
mime_type: z.string().trim().min(1).max(200).optional(),
size_bytes: z.number().int().min(0).max(2_000_000_000).optional(),
project_id: uuid.nullable().optional(),
storage_key: z.string().trim().max(1000).nullable().optional(),
});
export type CreateDocumentInput = z.infer<typeof createDocumentSchema>;
// POST /api/documents/upload — accept text directly or base64-encoded text.
export const uploadDocumentSchema = z
.object({
filename: z.string().trim().min(1).max(500),
mime_type: z.string().trim().min(1).max(200).optional(),
project_id: uuid.nullable().optional(),
// Exactly one of `text` or `content_base64` must be provided.
text: z.string().optional(),
content_base64: z.string().optional(),
})
.refine(
(v) => typeof v.text === "string" || typeof v.content_base64 === "string",
{ message: "Provide either `text` or `content_base64`." }
);
export type UploadDocumentInput = z.infer<typeof uploadDocumentSchema>;