/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ExtendPaths = { /** * JSONPath string specifying where to apply the value. */ path: string; /** * The value to set at the specified path, can be any type. */ value?: any | undefined; }; export type PassThroughBody = { /** * Identifier for the service to which this pass_through should be applied. */ serviceId: string; /** * Optional identifier for a workflow operation to which this pass_through should be applied. This is useful for Unify calls that are making more than one downstream request. */ operationId?: string | undefined; /** * Simple object allowing any properties for direct extension. */ extendObject?: { [k: string]: any } | undefined; /** * Array of objects for structured data modifications via paths. */ extendPaths?: Array | undefined; }; /** @internal */ export const ExtendPaths$inboundSchema: z.ZodType< ExtendPaths, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ path: types.string(), value: types.optional(z.any()), }) ); /** @internal */ export type ExtendPaths$Outbound = { path: string; value?: any | undefined; }; /** @internal */ export const ExtendPaths$outboundSchema: z.ZodType< ExtendPaths$Outbound, z.ZodTypeDef, ExtendPaths > = /* @__PURE__ */ lazySchema$(() => z.object({ path: z.string(), value: z.any().optional(), }) ); export function extendPathsToJSON(extendPaths: ExtendPaths): string { return JSON.stringify(ExtendPaths$outboundSchema.parse(extendPaths)); } export function extendPathsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExtendPaths$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtendPaths' from JSON`, ); } /** @internal */ export const PassThroughBody$inboundSchema: z.ZodType< PassThroughBody, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ service_id: types.string(), operation_id: types.optional(types.string()), extend_object: types.optional(z.record(z.any())), extend_paths: types.optional( z.array(z.lazy(() => ExtendPaths$inboundSchema)), ), }).transform((v) => { return remap$(v, { "service_id": "serviceId", "operation_id": "operationId", "extend_object": "extendObject", "extend_paths": "extendPaths", }); }) ); /** @internal */ export type PassThroughBody$Outbound = { service_id: string; operation_id?: string | undefined; extend_object?: { [k: string]: any } | undefined; extend_paths?: Array | undefined; }; /** @internal */ export const PassThroughBody$outboundSchema: z.ZodType< PassThroughBody$Outbound, z.ZodTypeDef, PassThroughBody > = /* @__PURE__ */ lazySchema$(() => z.object({ serviceId: z.string(), operationId: z.string().optional(), extendObject: z.record(z.any()).optional(), extendPaths: z.array(z.lazy(() => ExtendPaths$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { serviceId: "service_id", operationId: "operation_id", extendObject: "extend_object", extendPaths: "extend_paths", }); }) ); export function passThroughBodyToJSON( passThroughBody: PassThroughBody, ): string { return JSON.stringify(PassThroughBody$outboundSchema.parse(passThroughBody)); } export function passThroughBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PassThroughBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PassThroughBody' from JSON`, ); }