UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

76 lines (66 loc) 1.85 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../lib/primitives.js"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smartUnion.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export const Tag = { Symbol: "symbol", } as const; export type Tag = ClosedEnum<typeof Tag>; /** * an object to be decoded into a globally shared symbol */ export type PropertyKey3 = { tag: Tag; key: string; }; export type PropertyKey = PropertyKey3 | string | number; /** @internal */ export const Tag$inboundSchema: z.ZodNativeEnum<typeof Tag> = z.nativeEnum(Tag); /** @internal */ export const PropertyKey3$inboundSchema: z.ZodType< PropertyKey3, z.ZodTypeDef, unknown > = z.object({ _tag: Tag$inboundSchema, key: types.string(), }).transform((v) => { return remap$(v, { "_tag": "tag", }); }); export function propertyKey3FromJSON( jsonString: string, ): SafeParseResult<PropertyKey3, SDKValidationError> { return safeParse( jsonString, (x) => PropertyKey3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PropertyKey3' from JSON`, ); } /** @internal */ export const PropertyKey$inboundSchema: z.ZodType< PropertyKey, z.ZodTypeDef, unknown > = smartUnion([ z.lazy(() => PropertyKey3$inboundSchema), types.string(), types.number(), ]); export function propertyKeyFromJSON( jsonString: string, ): SafeParseResult<PropertyKey, SDKValidationError> { return safeParse( jsonString, (x) => PropertyKey$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PropertyKey' from JSON`, ); }