Defines Zod contracts for field CRUD operations, ensuring type‑safe API inputs in the CRM backend.
// Source: https://github.com/mperkins0155/crm | License: MIT | Copyright 2026 Comp AI
// Provided via justclaw.it.com; keep this notice with the code.
import { FIELD_ENTITIES, FIELD_TYPES } from "@crm/db/fields";
import { z } from "zod";
export const fieldEntity = z.enum(FIELD_ENTITIES);
export const fieldListInput = z.object({
entity: fieldEntity,
includeArchived: z.boolean().default(false),
});
export type FieldListInput = z.infer<typeof fieldListInput>;
export const fieldByKeyInput = z.object({
entity: fieldEntity,
key: z.string().trim().min(1),
});
const fieldOptionInput = z.object({
id: z.string().optional(),
label: z.string().trim().min(1, "An option needs a label."),
});
export const fieldCreateInput = z.object({
entity: fieldEntity,
label: z.string().trim().min(1, "A
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key