Files
cfw-autumn/shared/models/eventModels/eventModels.ts
2025-01-24 15:29:50 +00:00

26 lines
538 B
TypeScript

import { z } from "zod";
export const EventSchema = z.object({
// Internal usage
id: z.string(),
env: z.string(),
org_id: z.string(),
// Submitted by the client
customer_id: z.string().nonempty(),
event_name: z.string().nonempty(),
// Optional
properties: z.record(z.string(), z.any()),
idempotency_key: z.string().optional(),
timestamp: z.number().optional(),
});
export const CreateEventSchema = EventSchema.omit({
id: true,
env: true,
org_id: true,
});
export type Event = z.infer<typeof EventSchema>;