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>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
import { PROVIDER_IDS } from "@/lib/integrations/registry";
|
|
|
|
// Zod schemas for the Integrations API boundary. The per-provider `config`
|
|
// object is validated separately against the provider's own schema (see
|
|
// validateConfig in the registry) — here we only validate the envelope.
|
|
|
|
const providerEnum = z.enum(
|
|
PROVIDER_IDS as unknown as [string, ...string[]]
|
|
);
|
|
|
|
export const createIntegrationSchema = z.object({
|
|
provider: providerEnum,
|
|
name: z.string().trim().min(1, "A name is required.").max(120),
|
|
// Provider-specific config; shape validated by the registry, not here.
|
|
config: z.record(z.string(), z.unknown()).optional(),
|
|
});
|
|
|
|
export type CreateIntegrationInput = z.infer<typeof createIntegrationSchema>;
|
|
|
|
export const updateIntegrationSchema = z
|
|
.object({
|
|
name: z.string().trim().min(1, "A name is required.").max(120).optional(),
|
|
status: z.enum(["active", "disabled"]).optional(),
|
|
config: z.record(z.string(), z.unknown()).optional(),
|
|
})
|
|
.refine(
|
|
(v) =>
|
|
v.name !== undefined || v.status !== undefined || v.config !== undefined,
|
|
{ message: "Provide at least one field to update." }
|
|
);
|
|
|
|
export type UpdateIntegrationInput = z.infer<typeof updateIntegrationSchema>;
|