/* * 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"; import { Spec, Spec$inboundSchema, Spec$Outbound, Spec$outboundSchema, } from "./spec.js"; export type Storage1 = { spec?: Spec | null | undefined; }; /** * Set to true to make default export to IPFS. To customize the * * @remarks * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. */ export type Ipfs = Storage1 | boolean; export type Storage = { /** * Set to true to make default export to IPFS. To customize the * * @remarks * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. */ ipfs?: Storage1 | boolean | null | undefined; }; /** @internal */ export const Storage1$inboundSchema: z.ZodType< Storage1, z.ZodTypeDef, unknown > = z.object({ spec: z.nullable(Spec$inboundSchema).optional(), }); /** @internal */ export type Storage1$Outbound = { spec?: Spec$Outbound | null | undefined; }; /** @internal */ export const Storage1$outboundSchema: z.ZodType< Storage1$Outbound, z.ZodTypeDef, Storage1 > = z.object({ spec: z.nullable(Spec$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Storage1$ { /** @deprecated use `Storage1$inboundSchema` instead. */ export const inboundSchema = Storage1$inboundSchema; /** @deprecated use `Storage1$outboundSchema` instead. */ export const outboundSchema = Storage1$outboundSchema; /** @deprecated use `Storage1$Outbound` instead. */ export type Outbound = Storage1$Outbound; } export function storage1ToJSON(storage1: Storage1): string { return JSON.stringify(Storage1$outboundSchema.parse(storage1)); } export function storage1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Storage1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Storage1' from JSON`, ); } /** @internal */ export const Ipfs$inboundSchema: z.ZodType = z .union([z.lazy(() => Storage1$inboundSchema), z.boolean()]); /** @internal */ export type Ipfs$Outbound = Storage1$Outbound | boolean; /** @internal */ export const Ipfs$outboundSchema: z.ZodType = z.union([z.lazy(() => Storage1$outboundSchema), z.boolean()]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Ipfs$ { /** @deprecated use `Ipfs$inboundSchema` instead. */ export const inboundSchema = Ipfs$inboundSchema; /** @deprecated use `Ipfs$outboundSchema` instead. */ export const outboundSchema = Ipfs$outboundSchema; /** @deprecated use `Ipfs$Outbound` instead. */ export type Outbound = Ipfs$Outbound; } export function ipfsToJSON(ipfs: Ipfs): string { return JSON.stringify(Ipfs$outboundSchema.parse(ipfs)); } export function ipfsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Ipfs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Ipfs' from JSON`, ); } /** @internal */ export const Storage$inboundSchema: z.ZodType = z.object({ ipfs: z.nullable( z.union([z.lazy(() => Storage1$inboundSchema), z.boolean()]), ).optional(), }); /** @internal */ export type Storage$Outbound = { ipfs?: Storage1$Outbound | boolean | null | undefined; }; /** @internal */ export const Storage$outboundSchema: z.ZodType< Storage$Outbound, z.ZodTypeDef, Storage > = z.object({ ipfs: z.nullable( z.union([z.lazy(() => Storage1$outboundSchema), z.boolean()]), ).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Storage$ { /** @deprecated use `Storage$inboundSchema` instead. */ export const inboundSchema = Storage$inboundSchema; /** @deprecated use `Storage$outboundSchema` instead. */ export const outboundSchema = Storage$outboundSchema; /** @deprecated use `Storage$Outbound` instead. */ export type Outbound = Storage$Outbound; } export function storageToJSON(storage: Storage): string { return JSON.stringify(Storage$outboundSchema.parse(storage)); } export function storageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Storage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Storage' from JSON`, ); }