/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: af3e1aa8c1b3 */ import * as z from "zod/v4"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LogicalExpression, LogicalExpression$inboundSchema, } from "./logicalexpression.js"; import { ToolProperties, ToolProperties$inboundSchema, } from "./toolproperties.js"; export type RequiresConfirmation = | LogicalExpression | ToolProperties | Array; export type SkipConfirmation = | LogicalExpression | ToolProperties | Array; export type ToolExecutionConfiguration = { requiresConfirmation?: | LogicalExpression | ToolProperties | Array | null | undefined; skipConfirmation?: | LogicalExpression | ToolProperties | Array | null | undefined; include?: Array | null | undefined; exclude?: Array | null | undefined; }; /** @internal */ export const RequiresConfirmation$inboundSchema: z.ZodType< RequiresConfirmation, unknown > = smartUnion([ LogicalExpression$inboundSchema, ToolProperties$inboundSchema, z.array(z.string()), ]); export function requiresConfirmationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RequiresConfirmation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequiresConfirmation' from JSON`, ); } /** @internal */ export const SkipConfirmation$inboundSchema: z.ZodType< SkipConfirmation, unknown > = smartUnion([ LogicalExpression$inboundSchema, ToolProperties$inboundSchema, z.array(z.string()), ]); export function skipConfirmationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SkipConfirmation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SkipConfirmation' from JSON`, ); } /** @internal */ export const ToolExecutionConfiguration$inboundSchema: z.ZodType< ToolExecutionConfiguration, unknown > = z.object({ requires_confirmation: z.nullable( smartUnion([ LogicalExpression$inboundSchema, ToolProperties$inboundSchema, z.array(z.string()), ]), ).optional(), skip_confirmation: z.nullable( smartUnion([ LogicalExpression$inboundSchema, ToolProperties$inboundSchema, z.array(z.string()), ]), ).optional(), include: z.nullable(z.array(z.string())).optional(), exclude: z.nullable(z.array(z.string())).optional(), }).transform((v) => { return remap$(v, { "requires_confirmation": "requiresConfirmation", "skip_confirmation": "skipConfirmation", }); }); export function toolExecutionConfigurationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ToolExecutionConfiguration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolExecutionConfiguration' from JSON`, ); }