/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { MediaItem, MediaItem$inboundSchema, MediaItem$Outbound, MediaItem$outboundSchema, } from "./mediaitem.js"; export type Data = MediaItem | string | boolean; export type WorkflowRunOutputModel = { id: string; runId: string; data: { [k: string]: Array }; nodeMeta?: any | null | undefined; createdAt: Date; updatedAt: Date; type?: string | null | undefined; nodeId?: string | null | undefined; }; /** @internal */ export const Data$inboundSchema: z.ZodType = z .union([MediaItem$inboundSchema, z.string(), z.boolean()]); /** @internal */ export type Data$Outbound = MediaItem$Outbound | string | boolean; /** @internal */ export const Data$outboundSchema: z.ZodType = z.union([MediaItem$outboundSchema, z.string(), z.boolean()]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Data$ { /** @deprecated use `Data$inboundSchema` instead. */ export const inboundSchema = Data$inboundSchema; /** @deprecated use `Data$outboundSchema` instead. */ export const outboundSchema = Data$outboundSchema; /** @deprecated use `Data$Outbound` instead. */ export type Outbound = Data$Outbound; } export function dataToJSON(data: Data): string { return JSON.stringify(Data$outboundSchema.parse(data)); } export function dataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Data$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Data' from JSON`, ); } /** @internal */ export const WorkflowRunOutputModel$inboundSchema: z.ZodType< WorkflowRunOutputModel, z.ZodTypeDef, unknown > = z.object({ id: z.string(), run_id: z.string(), data: z.record( z.array(z.union([MediaItem$inboundSchema, z.string(), z.boolean()])), ), node_meta: z.nullable(z.any()).optional(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)), type: z.nullable(z.string()).optional(), node_id: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "run_id": "runId", "node_meta": "nodeMeta", "created_at": "createdAt", "updated_at": "updatedAt", "node_id": "nodeId", }); }); /** @internal */ export type WorkflowRunOutputModel$Outbound = { id: string; run_id: string; data: { [k: string]: Array }; node_meta?: any | null | undefined; created_at: string; updated_at: string; type?: string | null | undefined; node_id?: string | null | undefined; }; /** @internal */ export const WorkflowRunOutputModel$outboundSchema: z.ZodType< WorkflowRunOutputModel$Outbound, z.ZodTypeDef, WorkflowRunOutputModel > = z.object({ id: z.string(), runId: z.string(), data: z.record( z.array(z.union([MediaItem$outboundSchema, z.string(), z.boolean()])), ), nodeMeta: z.nullable(z.any()).optional(), createdAt: z.date().transform(v => v.toISOString()), updatedAt: z.date().transform(v => v.toISOString()), type: z.nullable(z.string()).optional(), nodeId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { runId: "run_id", nodeMeta: "node_meta", createdAt: "created_at", updatedAt: "updated_at", nodeId: "node_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace WorkflowRunOutputModel$ { /** @deprecated use `WorkflowRunOutputModel$inboundSchema` instead. */ export const inboundSchema = WorkflowRunOutputModel$inboundSchema; /** @deprecated use `WorkflowRunOutputModel$outboundSchema` instead. */ export const outboundSchema = WorkflowRunOutputModel$outboundSchema; /** @deprecated use `WorkflowRunOutputModel$Outbound` instead. */ export type Outbound = WorkflowRunOutputModel$Outbound; } export function workflowRunOutputModelToJSON( workflowRunOutputModel: WorkflowRunOutputModel, ): string { return JSON.stringify( WorkflowRunOutputModel$outboundSchema.parse(workflowRunOutputModel), ); } export function workflowRunOutputModelFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WorkflowRunOutputModel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkflowRunOutputModel' from JSON`, ); }