/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../../lib/schemas.js"; import { Result as SafeParseResult } from "../../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Replace = boolean | string | number | Array | { [k: string]: any; }; export type One = { replace?: | boolean | string | number | Array | { [k: string]: any } | undefined; }; export type MaskingRule = One; /** @internal */ export const Replace$inboundSchema: z.ZodType = z.union([ z.boolean(), z.string(), z.number(), z.array(z.any()), z.record(z.any()), ]); /** @internal */ export type Replace$Outbound = boolean | string | number | Array | { [k: string]: any; }; /** @internal */ export const Replace$outboundSchema: z.ZodType< Replace$Outbound, z.ZodTypeDef, Replace > = z.union([ z.boolean(), z.string(), z.number(), z.array(z.any()), z.record(z.any()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Replace$ { /** @deprecated use `Replace$inboundSchema` instead. */ export const inboundSchema = Replace$inboundSchema; /** @deprecated use `Replace$outboundSchema` instead. */ export const outboundSchema = Replace$outboundSchema; /** @deprecated use `Replace$Outbound` instead. */ export type Outbound = Replace$Outbound; } export function replaceToJSON(replace: Replace): string { return JSON.stringify(Replace$outboundSchema.parse(replace)); } export function replaceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Replace$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Replace' from JSON`, ); } /** @internal */ export const One$inboundSchema: z.ZodType = z .object({ replace: z.union([ z.boolean(), z.string(), z.number(), z.array(z.any()), z.record(z.any()), ]).optional(), }); /** @internal */ export type One$Outbound = { replace?: | boolean | string | number | Array | { [k: string]: any } | undefined; }; /** @internal */ export const One$outboundSchema: z.ZodType = z .object({ replace: z.union([ z.boolean(), z.string(), z.number(), z.array(z.any()), z.record(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 One$ { /** @deprecated use `One$inboundSchema` instead. */ export const inboundSchema = One$inboundSchema; /** @deprecated use `One$outboundSchema` instead. */ export const outboundSchema = One$outboundSchema; /** @deprecated use `One$Outbound` instead. */ export type Outbound = One$Outbound; } export function oneToJSON(one: One): string { return JSON.stringify(One$outboundSchema.parse(one)); } export function oneFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => One$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'One' from JSON`, ); } /** @internal */ export const MaskingRule$inboundSchema: z.ZodType< MaskingRule, z.ZodTypeDef, unknown > = z.lazy(() => One$inboundSchema); /** @internal */ export type MaskingRule$Outbound = One$Outbound; /** @internal */ export const MaskingRule$outboundSchema: z.ZodType< MaskingRule$Outbound, z.ZodTypeDef, MaskingRule > = z.lazy(() => One$outboundSchema); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MaskingRule$ { /** @deprecated use `MaskingRule$inboundSchema` instead. */ export const inboundSchema = MaskingRule$inboundSchema; /** @deprecated use `MaskingRule$outboundSchema` instead. */ export const outboundSchema = MaskingRule$outboundSchema; /** @deprecated use `MaskingRule$Outbound` instead. */ export type Outbound = MaskingRule$Outbound; } export function maskingRuleToJSON(maskingRule: MaskingRule): string { return JSON.stringify(MaskingRule$outboundSchema.parse(maskingRule)); } export function maskingRuleFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MaskingRule$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MaskingRule' from JSON`, ); }