/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 74b6bb8b7b5a */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import * as discriminatedUnionTypes from "../../types/discriminatedUnion.js"; import { discriminatedUnion } from "../../types/discriminatedUnion.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { JSONPatchPayloadResponse, JSONPatchPayloadResponse$inboundSchema, } from "./jsonpatchpayloadresponse.js"; import { JSONPayloadResponse, JSONPayloadResponse$inboundSchema, } from "./jsonpayloadresponse.js"; /** * The current state or incremental update for the task. */ export type Payload = | (JSONPayloadResponse & { type: "json" }) | JSONPatchPayloadResponse | discriminatedUnionTypes.Unknown<"type">; /** * Attributes for custom task in-progress events with streaming updates. */ export type CustomTaskInProgressAttributesResponse = { /** * Unique identifier for the custom task within the workflow. */ customTaskId: string; /** * The type/category of the custom task (e.g., 'llm_call', 'api_request'). */ customTaskType: string; /** * The current state or incremental update for the task. */ payload: | (JSONPayloadResponse & { type: "json" }) | JSONPatchPayloadResponse | discriminatedUnionTypes.Unknown<"type">; }; /** @internal */ export const Payload$inboundSchema: z.ZodType = discriminatedUnion("type", { json: JSONPayloadResponse$inboundSchema.and( z.object({ type: z.literal("json") }), ), json_patch: JSONPatchPayloadResponse$inboundSchema, }); export function payloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Payload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Payload' from JSON`, ); } /** @internal */ export const CustomTaskInProgressAttributesResponse$inboundSchema: z.ZodType< CustomTaskInProgressAttributesResponse, unknown > = z.object({ custom_task_id: z.string(), custom_task_type: z.string(), payload: discriminatedUnion("type", { json: JSONPayloadResponse$inboundSchema.and( z.object({ type: z.literal("json") }), ), json_patch: JSONPatchPayloadResponse$inboundSchema, }), }).transform((v) => { return remap$(v, { "custom_task_id": "customTaskId", "custom_task_type": "customTaskType", }); }); export function customTaskInProgressAttributesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomTaskInProgressAttributesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomTaskInProgressAttributesResponse' from JSON`, ); }