/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { EventSource, EventSource$inboundSchema } from "./eventsource.js"; export type EventName = { /** * The name of the event. */ name: string; source: EventSource; /** * Number of times the event has occurred. */ occurrences: number; /** * The first time the event occurred. */ firstSeen: Date; /** * The last time the event occurred. */ lastSeen: Date; }; /** @internal */ export const EventName$inboundSchema: z.ZodMiniType = z .pipe( z.object({ name: z.string(), source: EventSource$inboundSchema, occurrences: z.int(), first_seen: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), last_seen: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), }), z.transform((v) => { return remap$(v, { "first_seen": "firstSeen", "last_seen": "lastSeen", }); }), ); export function eventNameFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EventName$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EventName' from JSON`, ); }