/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: aa256f7ecc7b */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { smartUnion } from "../../types/smartUnion.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ToolProperties, ToolProperties$inboundSchema, } from "./toolproperties.js"; export const LogicalExpressionType = { And: "and", Or: "or", } as const; export type LogicalExpressionType = OpenEnum; export type LogicalExpression = { type: LogicalExpressionType; expressions: Array>; }; export type Expression = LogicalExpression | ToolProperties | Array; /** @internal */ export const LogicalExpressionType$inboundSchema: z.ZodType< LogicalExpressionType, unknown > = openEnums.inboundSchema(LogicalExpressionType); /** @internal */ export const LogicalExpression$inboundSchema: z.ZodType< LogicalExpression, unknown > = z.object({ type: LogicalExpressionType$inboundSchema, expressions: z.array( smartUnion([ z.lazy(() => LogicalExpression$inboundSchema), ToolProperties$inboundSchema, z.array(z.string()), ]), ), }); export function logicalExpressionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LogicalExpression$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogicalExpression' from JSON`, ); } /** @internal */ export const Expression$inboundSchema: z.ZodType = smartUnion([ z.lazy(() => LogicalExpression$inboundSchema), ToolProperties$inboundSchema, z.array(z.string()), ]); export function expressionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Expression$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Expression' from JSON`, ); }