/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ComputeEvent = { data: { [k: string]: any }; id: string; timestamp: Date; type: string; }; /** @internal */ export const ComputeEvent$inboundSchema: z.ZodType< ComputeEvent, z.ZodTypeDef, unknown > = z.object({ data: z.record(z.any()), id: z.string(), timestamp: z.string().datetime({ offset: true }).transform(v => new Date(v)), type: z.string(), }); /** @internal */ export type ComputeEvent$Outbound = { data: { [k: string]: any }; id: string; timestamp: string; type: string; }; /** @internal */ export const ComputeEvent$outboundSchema: z.ZodType< ComputeEvent$Outbound, z.ZodTypeDef, ComputeEvent > = z.object({ data: z.record(z.any()), id: z.string(), timestamp: z.date().transform(v => v.toISOString()), type: z.string(), }); export function computeEventToJSON(computeEvent: ComputeEvent): string { return JSON.stringify(ComputeEvent$outboundSchema.parse(computeEvent)); } export function computeEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ComputeEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ComputeEvent' from JSON`, ); }