/* * 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"; 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 > = z.object({ path: z.string(), value: z.any().optional(), }); /** @internal */ export type ExtendPaths$Outbound = { path: string; value?: any | undefined; }; /** @internal */ export const ExtendPaths$outboundSchema: z.ZodType< ExtendPaths$Outbound, z.ZodTypeDef, ExtendPaths > = z.object({ path: z.string(), value: z.any().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ExtendPaths$ { /** @deprecated use `ExtendPaths$inboundSchema` instead. */ export const inboundSchema = ExtendPaths$inboundSchema; /** @deprecated use `ExtendPaths$outboundSchema` instead. */ export const outboundSchema = ExtendPaths$outboundSchema; /** @deprecated use `ExtendPaths$Outbound` instead. */ export type Outbound = ExtendPaths$Outbound; } 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 > = z.object({ service_id: z.string(), operation_id: z.string().optional(), extend_object: z.record(z.any()).optional(), extend_paths: z.array(z.lazy(() => ExtendPaths$inboundSchema)).optional(), }).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 > = 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", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PassThroughBody$ { /** @deprecated use `PassThroughBody$inboundSchema` instead. */ export const inboundSchema = PassThroughBody$inboundSchema; /** @deprecated use `PassThroughBody$outboundSchema` instead. */ export const outboundSchema = PassThroughBody$outboundSchema; /** @deprecated use `PassThroughBody$Outbound` instead. */ export type Outbound = PassThroughBody$Outbound; } 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`, ); }