mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-29 07:11:00 +00:00
2859 lines
78 KiB
JavaScript
2859 lines
78 KiB
JavaScript
import {
|
|
$ZodAny,
|
|
$ZodArray,
|
|
$ZodBase64,
|
|
$ZodBase64URL,
|
|
$ZodBigInt,
|
|
$ZodBigIntFormat,
|
|
$ZodBoolean,
|
|
$ZodCIDRv4,
|
|
$ZodCIDRv6,
|
|
$ZodCUID,
|
|
$ZodCUID2,
|
|
$ZodCatch,
|
|
$ZodCheck,
|
|
$ZodCodec,
|
|
$ZodCustom,
|
|
$ZodCustomStringFormat,
|
|
$ZodDate,
|
|
$ZodDefault,
|
|
$ZodDiscriminatedUnion,
|
|
$ZodE164,
|
|
$ZodEmail,
|
|
$ZodEmoji,
|
|
$ZodEncodeError,
|
|
$ZodEnum,
|
|
$ZodError,
|
|
$ZodExactOptional,
|
|
$ZodFile,
|
|
$ZodFunction,
|
|
$ZodGUID,
|
|
$ZodIPv4,
|
|
$ZodIPv6,
|
|
$ZodISODate,
|
|
$ZodISODateTime,
|
|
$ZodISODuration,
|
|
$ZodISOTime,
|
|
$ZodIntersection,
|
|
$ZodJWT,
|
|
$ZodKSUID,
|
|
$ZodLazy,
|
|
$ZodLiteral,
|
|
$ZodMAC,
|
|
$ZodMap,
|
|
$ZodNaN,
|
|
$ZodNanoID,
|
|
$ZodNever,
|
|
$ZodNonOptional,
|
|
$ZodNull,
|
|
$ZodNullable,
|
|
$ZodNumber,
|
|
$ZodNumberFormat,
|
|
$ZodObjectJIT,
|
|
$ZodOptional,
|
|
$ZodPipe,
|
|
$ZodPrefault,
|
|
$ZodPreprocess,
|
|
$ZodPromise,
|
|
$ZodReadonly,
|
|
$ZodRecord,
|
|
$ZodSet,
|
|
$ZodString,
|
|
$ZodStringFormat,
|
|
$ZodSuccess,
|
|
$ZodSymbol,
|
|
$ZodTemplateLiteral,
|
|
$ZodTransform,
|
|
$ZodTuple,
|
|
$ZodType,
|
|
$ZodULID,
|
|
$ZodURL,
|
|
$ZodUUID,
|
|
$ZodUndefined,
|
|
$ZodUnion,
|
|
$ZodUnknown,
|
|
$ZodVoid,
|
|
$ZodXID,
|
|
$ZodXor,
|
|
$brand,
|
|
$constructor,
|
|
$input,
|
|
$output,
|
|
NEVER,
|
|
TimePrecision,
|
|
_any,
|
|
_array,
|
|
_base64,
|
|
_base64url,
|
|
_bigint,
|
|
_boolean,
|
|
_cidrv4,
|
|
_cidrv6,
|
|
_coercedBigint,
|
|
_coercedBoolean,
|
|
_coercedDate,
|
|
_coercedNumber,
|
|
_coercedString,
|
|
_cuid,
|
|
_cuid2,
|
|
_custom,
|
|
_date,
|
|
_decode,
|
|
_decodeAsync,
|
|
_e164,
|
|
_email,
|
|
_emoji,
|
|
_encode,
|
|
_encodeAsync,
|
|
_endsWith,
|
|
_file,
|
|
_float32,
|
|
_float64,
|
|
_gt,
|
|
_gte,
|
|
_guid,
|
|
_includes,
|
|
_int,
|
|
_int32,
|
|
_int64,
|
|
_ipv4,
|
|
_ipv6,
|
|
_isoDate,
|
|
_isoDateTime,
|
|
_isoDuration,
|
|
_isoTime,
|
|
_jwt,
|
|
_ksuid,
|
|
_length,
|
|
_lowercase,
|
|
_lt,
|
|
_lte,
|
|
_mac,
|
|
_maxLength,
|
|
_maxSize,
|
|
_mime,
|
|
_minLength,
|
|
_minSize,
|
|
_multipleOf,
|
|
_nan,
|
|
_nanoid,
|
|
_negative,
|
|
_never,
|
|
_nonnegative,
|
|
_nonpositive,
|
|
_normalize,
|
|
_null,
|
|
_number,
|
|
_overwrite,
|
|
_parse,
|
|
_parseAsync,
|
|
_positive,
|
|
_property,
|
|
_refine,
|
|
_regex,
|
|
_safeDecode,
|
|
_safeDecodeAsync,
|
|
_safeEncode,
|
|
_safeEncodeAsync,
|
|
_safeParse,
|
|
_safeParseAsync,
|
|
_size,
|
|
_slugify,
|
|
_startsWith,
|
|
_string,
|
|
_stringFormat,
|
|
_stringbool,
|
|
_superRefine,
|
|
_symbol,
|
|
_toLowerCase,
|
|
_toUpperCase,
|
|
_trim,
|
|
_uint32,
|
|
_uint64,
|
|
_ulid,
|
|
_undefined,
|
|
_unknown,
|
|
_uppercase,
|
|
_url,
|
|
_uuid,
|
|
_uuidv4,
|
|
_uuidv6,
|
|
_uuidv7,
|
|
_void,
|
|
_xid,
|
|
anyProcessor,
|
|
arrayProcessor,
|
|
bigintProcessor,
|
|
booleanProcessor,
|
|
catchProcessor,
|
|
clone,
|
|
config,
|
|
core_exports,
|
|
createStandardJSONSchemaMethod,
|
|
createToJSONSchemaMethod,
|
|
customProcessor,
|
|
dateProcessor,
|
|
defaultProcessor,
|
|
describe,
|
|
en_default,
|
|
enumProcessor,
|
|
fileProcessor,
|
|
flattenError,
|
|
formatError,
|
|
functionProcessor,
|
|
globalRegistry,
|
|
intersectionProcessor,
|
|
jsonStringifyReplacer,
|
|
lazyProcessor,
|
|
literalProcessor,
|
|
locales_exports,
|
|
mapProcessor,
|
|
meta,
|
|
nanProcessor,
|
|
neverProcessor,
|
|
nonoptionalProcessor,
|
|
nullProcessor,
|
|
nullableProcessor,
|
|
numberProcessor,
|
|
objectProcessor,
|
|
optionalProcessor,
|
|
pipeProcessor,
|
|
prefaultProcessor,
|
|
prettifyError,
|
|
promiseProcessor,
|
|
readonlyProcessor,
|
|
recordProcessor,
|
|
regexes_exports,
|
|
registry,
|
|
setProcessor,
|
|
stringProcessor,
|
|
successProcessor,
|
|
symbolProcessor,
|
|
templateLiteralProcessor,
|
|
toJSONSchema,
|
|
transformProcessor,
|
|
treeifyError,
|
|
tupleProcessor,
|
|
undefinedProcessor,
|
|
unionProcessor,
|
|
unknownProcessor,
|
|
util_exports,
|
|
voidProcessor
|
|
} from "./chunk-FIUNT47R.js";
|
|
import {
|
|
__export
|
|
} from "./chunk-G3PMV62Z.js";
|
|
|
|
// node_modules/zod/v4/classic/external.js
|
|
var external_exports = {};
|
|
__export(external_exports, {
|
|
$brand: () => $brand,
|
|
$input: () => $input,
|
|
$output: () => $output,
|
|
NEVER: () => NEVER,
|
|
TimePrecision: () => TimePrecision,
|
|
ZodAny: () => ZodAny,
|
|
ZodArray: () => ZodArray,
|
|
ZodBase64: () => ZodBase64,
|
|
ZodBase64URL: () => ZodBase64URL,
|
|
ZodBigInt: () => ZodBigInt,
|
|
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
ZodBoolean: () => ZodBoolean,
|
|
ZodCIDRv4: () => ZodCIDRv4,
|
|
ZodCIDRv6: () => ZodCIDRv6,
|
|
ZodCUID: () => ZodCUID,
|
|
ZodCUID2: () => ZodCUID2,
|
|
ZodCatch: () => ZodCatch,
|
|
ZodCodec: () => ZodCodec,
|
|
ZodCustom: () => ZodCustom,
|
|
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
ZodDate: () => ZodDate,
|
|
ZodDefault: () => ZodDefault,
|
|
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
ZodE164: () => ZodE164,
|
|
ZodEmail: () => ZodEmail,
|
|
ZodEmoji: () => ZodEmoji,
|
|
ZodEnum: () => ZodEnum,
|
|
ZodError: () => ZodError,
|
|
ZodExactOptional: () => ZodExactOptional,
|
|
ZodFile: () => ZodFile,
|
|
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
ZodFunction: () => ZodFunction,
|
|
ZodGUID: () => ZodGUID,
|
|
ZodIPv4: () => ZodIPv4,
|
|
ZodIPv6: () => ZodIPv6,
|
|
ZodISODate: () => ZodISODate,
|
|
ZodISODateTime: () => ZodISODateTime,
|
|
ZodISODuration: () => ZodISODuration,
|
|
ZodISOTime: () => ZodISOTime,
|
|
ZodIntersection: () => ZodIntersection,
|
|
ZodIssueCode: () => ZodIssueCode,
|
|
ZodJWT: () => ZodJWT,
|
|
ZodKSUID: () => ZodKSUID,
|
|
ZodLazy: () => ZodLazy,
|
|
ZodLiteral: () => ZodLiteral,
|
|
ZodMAC: () => ZodMAC,
|
|
ZodMap: () => ZodMap,
|
|
ZodNaN: () => ZodNaN,
|
|
ZodNanoID: () => ZodNanoID,
|
|
ZodNever: () => ZodNever,
|
|
ZodNonOptional: () => ZodNonOptional,
|
|
ZodNull: () => ZodNull,
|
|
ZodNullable: () => ZodNullable,
|
|
ZodNumber: () => ZodNumber,
|
|
ZodNumberFormat: () => ZodNumberFormat,
|
|
ZodObject: () => ZodObject,
|
|
ZodOptional: () => ZodOptional,
|
|
ZodPipe: () => ZodPipe,
|
|
ZodPrefault: () => ZodPrefault,
|
|
ZodPreprocess: () => ZodPreprocess,
|
|
ZodPromise: () => ZodPromise,
|
|
ZodReadonly: () => ZodReadonly,
|
|
ZodRealError: () => ZodRealError,
|
|
ZodRecord: () => ZodRecord,
|
|
ZodSet: () => ZodSet,
|
|
ZodString: () => ZodString,
|
|
ZodStringFormat: () => ZodStringFormat,
|
|
ZodSuccess: () => ZodSuccess,
|
|
ZodSymbol: () => ZodSymbol,
|
|
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
ZodTransform: () => ZodTransform,
|
|
ZodTuple: () => ZodTuple,
|
|
ZodType: () => ZodType,
|
|
ZodULID: () => ZodULID,
|
|
ZodURL: () => ZodURL,
|
|
ZodUUID: () => ZodUUID,
|
|
ZodUndefined: () => ZodUndefined,
|
|
ZodUnion: () => ZodUnion,
|
|
ZodUnknown: () => ZodUnknown,
|
|
ZodVoid: () => ZodVoid,
|
|
ZodXID: () => ZodXID,
|
|
ZodXor: () => ZodXor,
|
|
_ZodString: () => _ZodString,
|
|
_default: () => _default,
|
|
_function: () => _function,
|
|
any: () => any,
|
|
array: () => array,
|
|
base64: () => base64,
|
|
base64url: () => base64url,
|
|
bigint: () => bigint,
|
|
boolean: () => boolean,
|
|
catch: () => _catch,
|
|
check: () => check,
|
|
cidrv4: () => cidrv4,
|
|
cidrv6: () => cidrv6,
|
|
clone: () => clone,
|
|
codec: () => codec,
|
|
coerce: () => coerce_exports,
|
|
config: () => config,
|
|
core: () => core_exports,
|
|
cuid: () => cuid,
|
|
cuid2: () => cuid2,
|
|
custom: () => custom,
|
|
date: () => date2,
|
|
decode: () => decode,
|
|
decodeAsync: () => decodeAsync,
|
|
describe: () => describe2,
|
|
discriminatedUnion: () => discriminatedUnion,
|
|
e164: () => e164,
|
|
email: () => email,
|
|
emoji: () => emoji,
|
|
encode: () => encode,
|
|
encodeAsync: () => encodeAsync,
|
|
endsWith: () => _endsWith,
|
|
enum: () => _enum,
|
|
exactOptional: () => exactOptional,
|
|
file: () => file,
|
|
flattenError: () => flattenError,
|
|
float32: () => float32,
|
|
float64: () => float64,
|
|
formatError: () => formatError,
|
|
fromJSONSchema: () => fromJSONSchema,
|
|
function: () => _function,
|
|
getErrorMap: () => getErrorMap,
|
|
globalRegistry: () => globalRegistry,
|
|
gt: () => _gt,
|
|
gte: () => _gte,
|
|
guid: () => guid,
|
|
hash: () => hash,
|
|
hex: () => hex,
|
|
hostname: () => hostname,
|
|
httpUrl: () => httpUrl,
|
|
includes: () => _includes,
|
|
instanceof: () => _instanceof,
|
|
int: () => int,
|
|
int32: () => int32,
|
|
int64: () => int64,
|
|
intersection: () => intersection,
|
|
invertCodec: () => invertCodec,
|
|
ipv4: () => ipv4,
|
|
ipv6: () => ipv6,
|
|
iso: () => iso_exports,
|
|
json: () => json,
|
|
jwt: () => jwt,
|
|
keyof: () => keyof,
|
|
ksuid: () => ksuid,
|
|
lazy: () => lazy,
|
|
length: () => _length,
|
|
literal: () => literal,
|
|
locales: () => locales_exports,
|
|
looseObject: () => looseObject,
|
|
looseRecord: () => looseRecord,
|
|
lowercase: () => _lowercase,
|
|
lt: () => _lt,
|
|
lte: () => _lte,
|
|
mac: () => mac,
|
|
map: () => map,
|
|
maxLength: () => _maxLength,
|
|
maxSize: () => _maxSize,
|
|
meta: () => meta2,
|
|
mime: () => _mime,
|
|
minLength: () => _minLength,
|
|
minSize: () => _minSize,
|
|
multipleOf: () => _multipleOf,
|
|
nan: () => nan,
|
|
nanoid: () => nanoid,
|
|
nativeEnum: () => nativeEnum,
|
|
negative: () => _negative,
|
|
never: () => never,
|
|
nonnegative: () => _nonnegative,
|
|
nonoptional: () => nonoptional,
|
|
nonpositive: () => _nonpositive,
|
|
normalize: () => _normalize,
|
|
null: () => _null2,
|
|
nullable: () => nullable,
|
|
nullish: () => nullish,
|
|
number: () => number,
|
|
object: () => object,
|
|
optional: () => optional,
|
|
overwrite: () => _overwrite,
|
|
parse: () => parse,
|
|
parseAsync: () => parseAsync,
|
|
partialRecord: () => partialRecord,
|
|
pipe: () => pipe,
|
|
positive: () => _positive,
|
|
prefault: () => prefault,
|
|
preprocess: () => preprocess,
|
|
prettifyError: () => prettifyError,
|
|
promise: () => promise,
|
|
property: () => _property,
|
|
readonly: () => readonly,
|
|
record: () => record,
|
|
refine: () => refine,
|
|
regex: () => _regex,
|
|
regexes: () => regexes_exports,
|
|
registry: () => registry,
|
|
safeDecode: () => safeDecode,
|
|
safeDecodeAsync: () => safeDecodeAsync,
|
|
safeEncode: () => safeEncode,
|
|
safeEncodeAsync: () => safeEncodeAsync,
|
|
safeParse: () => safeParse,
|
|
safeParseAsync: () => safeParseAsync,
|
|
set: () => set,
|
|
setErrorMap: () => setErrorMap,
|
|
size: () => _size,
|
|
slugify: () => _slugify,
|
|
startsWith: () => _startsWith,
|
|
strictObject: () => strictObject,
|
|
string: () => string,
|
|
stringFormat: () => stringFormat,
|
|
stringbool: () => stringbool,
|
|
success: () => success,
|
|
superRefine: () => superRefine,
|
|
symbol: () => symbol,
|
|
templateLiteral: () => templateLiteral,
|
|
toJSONSchema: () => toJSONSchema,
|
|
toLowerCase: () => _toLowerCase,
|
|
toUpperCase: () => _toUpperCase,
|
|
transform: () => transform,
|
|
treeifyError: () => treeifyError,
|
|
trim: () => _trim,
|
|
tuple: () => tuple,
|
|
uint32: () => uint32,
|
|
uint64: () => uint64,
|
|
ulid: () => ulid,
|
|
undefined: () => _undefined2,
|
|
union: () => union,
|
|
unknown: () => unknown,
|
|
uppercase: () => _uppercase,
|
|
url: () => url,
|
|
util: () => util_exports,
|
|
uuid: () => uuid,
|
|
uuidv4: () => uuidv4,
|
|
uuidv6: () => uuidv6,
|
|
uuidv7: () => uuidv7,
|
|
void: () => _void2,
|
|
xid: () => xid,
|
|
xor: () => xor
|
|
});
|
|
|
|
// node_modules/zod/v4/classic/schemas.js
|
|
var schemas_exports = {};
|
|
__export(schemas_exports, {
|
|
ZodAny: () => ZodAny,
|
|
ZodArray: () => ZodArray,
|
|
ZodBase64: () => ZodBase64,
|
|
ZodBase64URL: () => ZodBase64URL,
|
|
ZodBigInt: () => ZodBigInt,
|
|
ZodBigIntFormat: () => ZodBigIntFormat,
|
|
ZodBoolean: () => ZodBoolean,
|
|
ZodCIDRv4: () => ZodCIDRv4,
|
|
ZodCIDRv6: () => ZodCIDRv6,
|
|
ZodCUID: () => ZodCUID,
|
|
ZodCUID2: () => ZodCUID2,
|
|
ZodCatch: () => ZodCatch,
|
|
ZodCodec: () => ZodCodec,
|
|
ZodCustom: () => ZodCustom,
|
|
ZodCustomStringFormat: () => ZodCustomStringFormat,
|
|
ZodDate: () => ZodDate,
|
|
ZodDefault: () => ZodDefault,
|
|
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
ZodE164: () => ZodE164,
|
|
ZodEmail: () => ZodEmail,
|
|
ZodEmoji: () => ZodEmoji,
|
|
ZodEnum: () => ZodEnum,
|
|
ZodExactOptional: () => ZodExactOptional,
|
|
ZodFile: () => ZodFile,
|
|
ZodFunction: () => ZodFunction,
|
|
ZodGUID: () => ZodGUID,
|
|
ZodIPv4: () => ZodIPv4,
|
|
ZodIPv6: () => ZodIPv6,
|
|
ZodIntersection: () => ZodIntersection,
|
|
ZodJWT: () => ZodJWT,
|
|
ZodKSUID: () => ZodKSUID,
|
|
ZodLazy: () => ZodLazy,
|
|
ZodLiteral: () => ZodLiteral,
|
|
ZodMAC: () => ZodMAC,
|
|
ZodMap: () => ZodMap,
|
|
ZodNaN: () => ZodNaN,
|
|
ZodNanoID: () => ZodNanoID,
|
|
ZodNever: () => ZodNever,
|
|
ZodNonOptional: () => ZodNonOptional,
|
|
ZodNull: () => ZodNull,
|
|
ZodNullable: () => ZodNullable,
|
|
ZodNumber: () => ZodNumber,
|
|
ZodNumberFormat: () => ZodNumberFormat,
|
|
ZodObject: () => ZodObject,
|
|
ZodOptional: () => ZodOptional,
|
|
ZodPipe: () => ZodPipe,
|
|
ZodPrefault: () => ZodPrefault,
|
|
ZodPreprocess: () => ZodPreprocess,
|
|
ZodPromise: () => ZodPromise,
|
|
ZodReadonly: () => ZodReadonly,
|
|
ZodRecord: () => ZodRecord,
|
|
ZodSet: () => ZodSet,
|
|
ZodString: () => ZodString,
|
|
ZodStringFormat: () => ZodStringFormat,
|
|
ZodSuccess: () => ZodSuccess,
|
|
ZodSymbol: () => ZodSymbol,
|
|
ZodTemplateLiteral: () => ZodTemplateLiteral,
|
|
ZodTransform: () => ZodTransform,
|
|
ZodTuple: () => ZodTuple,
|
|
ZodType: () => ZodType,
|
|
ZodULID: () => ZodULID,
|
|
ZodURL: () => ZodURL,
|
|
ZodUUID: () => ZodUUID,
|
|
ZodUndefined: () => ZodUndefined,
|
|
ZodUnion: () => ZodUnion,
|
|
ZodUnknown: () => ZodUnknown,
|
|
ZodVoid: () => ZodVoid,
|
|
ZodXID: () => ZodXID,
|
|
ZodXor: () => ZodXor,
|
|
_ZodString: () => _ZodString,
|
|
_default: () => _default,
|
|
_function: () => _function,
|
|
any: () => any,
|
|
array: () => array,
|
|
base64: () => base64,
|
|
base64url: () => base64url,
|
|
bigint: () => bigint,
|
|
boolean: () => boolean,
|
|
catch: () => _catch,
|
|
check: () => check,
|
|
cidrv4: () => cidrv4,
|
|
cidrv6: () => cidrv6,
|
|
codec: () => codec,
|
|
cuid: () => cuid,
|
|
cuid2: () => cuid2,
|
|
custom: () => custom,
|
|
date: () => date2,
|
|
describe: () => describe2,
|
|
discriminatedUnion: () => discriminatedUnion,
|
|
e164: () => e164,
|
|
email: () => email,
|
|
emoji: () => emoji,
|
|
enum: () => _enum,
|
|
exactOptional: () => exactOptional,
|
|
file: () => file,
|
|
float32: () => float32,
|
|
float64: () => float64,
|
|
function: () => _function,
|
|
guid: () => guid,
|
|
hash: () => hash,
|
|
hex: () => hex,
|
|
hostname: () => hostname,
|
|
httpUrl: () => httpUrl,
|
|
instanceof: () => _instanceof,
|
|
int: () => int,
|
|
int32: () => int32,
|
|
int64: () => int64,
|
|
intersection: () => intersection,
|
|
invertCodec: () => invertCodec,
|
|
ipv4: () => ipv4,
|
|
ipv6: () => ipv6,
|
|
json: () => json,
|
|
jwt: () => jwt,
|
|
keyof: () => keyof,
|
|
ksuid: () => ksuid,
|
|
lazy: () => lazy,
|
|
literal: () => literal,
|
|
looseObject: () => looseObject,
|
|
looseRecord: () => looseRecord,
|
|
mac: () => mac,
|
|
map: () => map,
|
|
meta: () => meta2,
|
|
nan: () => nan,
|
|
nanoid: () => nanoid,
|
|
nativeEnum: () => nativeEnum,
|
|
never: () => never,
|
|
nonoptional: () => nonoptional,
|
|
null: () => _null2,
|
|
nullable: () => nullable,
|
|
nullish: () => nullish,
|
|
number: () => number,
|
|
object: () => object,
|
|
optional: () => optional,
|
|
partialRecord: () => partialRecord,
|
|
pipe: () => pipe,
|
|
prefault: () => prefault,
|
|
preprocess: () => preprocess,
|
|
promise: () => promise,
|
|
readonly: () => readonly,
|
|
record: () => record,
|
|
refine: () => refine,
|
|
set: () => set,
|
|
strictObject: () => strictObject,
|
|
string: () => string,
|
|
stringFormat: () => stringFormat,
|
|
stringbool: () => stringbool,
|
|
success: () => success,
|
|
superRefine: () => superRefine,
|
|
symbol: () => symbol,
|
|
templateLiteral: () => templateLiteral,
|
|
transform: () => transform,
|
|
tuple: () => tuple,
|
|
uint32: () => uint32,
|
|
uint64: () => uint64,
|
|
ulid: () => ulid,
|
|
undefined: () => _undefined2,
|
|
union: () => union,
|
|
unknown: () => unknown,
|
|
url: () => url,
|
|
uuid: () => uuid,
|
|
uuidv4: () => uuidv4,
|
|
uuidv6: () => uuidv6,
|
|
uuidv7: () => uuidv7,
|
|
void: () => _void2,
|
|
xid: () => xid,
|
|
xor: () => xor
|
|
});
|
|
|
|
// node_modules/zod/v4/classic/checks.js
|
|
var checks_exports = {};
|
|
__export(checks_exports, {
|
|
endsWith: () => _endsWith,
|
|
gt: () => _gt,
|
|
gte: () => _gte,
|
|
includes: () => _includes,
|
|
length: () => _length,
|
|
lowercase: () => _lowercase,
|
|
lt: () => _lt,
|
|
lte: () => _lte,
|
|
maxLength: () => _maxLength,
|
|
maxSize: () => _maxSize,
|
|
mime: () => _mime,
|
|
minLength: () => _minLength,
|
|
minSize: () => _minSize,
|
|
multipleOf: () => _multipleOf,
|
|
negative: () => _negative,
|
|
nonnegative: () => _nonnegative,
|
|
nonpositive: () => _nonpositive,
|
|
normalize: () => _normalize,
|
|
overwrite: () => _overwrite,
|
|
positive: () => _positive,
|
|
property: () => _property,
|
|
regex: () => _regex,
|
|
size: () => _size,
|
|
slugify: () => _slugify,
|
|
startsWith: () => _startsWith,
|
|
toLowerCase: () => _toLowerCase,
|
|
toUpperCase: () => _toUpperCase,
|
|
trim: () => _trim,
|
|
uppercase: () => _uppercase
|
|
});
|
|
|
|
// node_modules/zod/v4/classic/iso.js
|
|
var iso_exports = {};
|
|
__export(iso_exports, {
|
|
ZodISODate: () => ZodISODate,
|
|
ZodISODateTime: () => ZodISODateTime,
|
|
ZodISODuration: () => ZodISODuration,
|
|
ZodISOTime: () => ZodISOTime,
|
|
date: () => date,
|
|
datetime: () => datetime,
|
|
duration: () => duration,
|
|
time: () => time
|
|
});
|
|
var ZodISODateTime = $constructor("ZodISODateTime", (inst, def) => {
|
|
$ZodISODateTime.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function datetime(params) {
|
|
return _isoDateTime(ZodISODateTime, params);
|
|
}
|
|
var ZodISODate = $constructor("ZodISODate", (inst, def) => {
|
|
$ZodISODate.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function date(params) {
|
|
return _isoDate(ZodISODate, params);
|
|
}
|
|
var ZodISOTime = $constructor("ZodISOTime", (inst, def) => {
|
|
$ZodISOTime.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function time(params) {
|
|
return _isoTime(ZodISOTime, params);
|
|
}
|
|
var ZodISODuration = $constructor("ZodISODuration", (inst, def) => {
|
|
$ZodISODuration.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function duration(params) {
|
|
return _isoDuration(ZodISODuration, params);
|
|
}
|
|
|
|
// node_modules/zod/v4/classic/errors.js
|
|
var initializer = (inst, issues) => {
|
|
$ZodError.init(inst, issues);
|
|
inst.name = "ZodError";
|
|
Object.defineProperties(inst, {
|
|
format: {
|
|
value: (mapper) => formatError(inst, mapper)
|
|
// enumerable: false,
|
|
},
|
|
flatten: {
|
|
value: (mapper) => flattenError(inst, mapper)
|
|
// enumerable: false,
|
|
},
|
|
addIssue: {
|
|
value: (issue) => {
|
|
inst.issues.push(issue);
|
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
}
|
|
// enumerable: false,
|
|
},
|
|
addIssues: {
|
|
value: (issues2) => {
|
|
inst.issues.push(...issues2);
|
|
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
}
|
|
// enumerable: false,
|
|
},
|
|
isEmpty: {
|
|
get() {
|
|
return inst.issues.length === 0;
|
|
}
|
|
// enumerable: false,
|
|
}
|
|
});
|
|
};
|
|
var ZodError = $constructor("ZodError", initializer);
|
|
var ZodRealError = $constructor("ZodError", initializer, {
|
|
Parent: Error
|
|
});
|
|
|
|
// node_modules/zod/v4/classic/parse.js
|
|
var parse = _parse(ZodRealError);
|
|
var parseAsync = _parseAsync(ZodRealError);
|
|
var safeParse = _safeParse(ZodRealError);
|
|
var safeParseAsync = _safeParseAsync(ZodRealError);
|
|
var encode = _encode(ZodRealError);
|
|
var decode = _decode(ZodRealError);
|
|
var encodeAsync = _encodeAsync(ZodRealError);
|
|
var decodeAsync = _decodeAsync(ZodRealError);
|
|
var safeEncode = _safeEncode(ZodRealError);
|
|
var safeDecode = _safeDecode(ZodRealError);
|
|
var safeEncodeAsync = _safeEncodeAsync(ZodRealError);
|
|
var safeDecodeAsync = _safeDecodeAsync(ZodRealError);
|
|
|
|
// node_modules/zod/v4/classic/schemas.js
|
|
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
function _installLazyMethods(inst, group, methods) {
|
|
const proto = Object.getPrototypeOf(inst);
|
|
let installed = _installedGroups.get(proto);
|
|
if (!installed) {
|
|
installed = /* @__PURE__ */ new Set();
|
|
_installedGroups.set(proto, installed);
|
|
}
|
|
if (installed.has(group))
|
|
return;
|
|
installed.add(group);
|
|
for (const key in methods) {
|
|
const fn = methods[key];
|
|
Object.defineProperty(proto, key, {
|
|
configurable: true,
|
|
enumerable: false,
|
|
get() {
|
|
const bound = fn.bind(this);
|
|
Object.defineProperty(this, key, {
|
|
configurable: true,
|
|
writable: true,
|
|
enumerable: true,
|
|
value: bound
|
|
});
|
|
return bound;
|
|
},
|
|
set(v) {
|
|
Object.defineProperty(this, key, {
|
|
configurable: true,
|
|
writable: true,
|
|
enumerable: true,
|
|
value: v
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}
|
|
var ZodType = $constructor("ZodType", (inst, def) => {
|
|
$ZodType.init(inst, def);
|
|
Object.assign(inst["~standard"], {
|
|
jsonSchema: {
|
|
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
output: createStandardJSONSchemaMethod(inst, "output")
|
|
}
|
|
});
|
|
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
inst.def = def;
|
|
inst.type = def.type;
|
|
Object.defineProperty(inst, "_def", { value: def });
|
|
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
inst.spa = inst.safeParseAsync;
|
|
inst.encode = (data, params) => encode(inst, data, params);
|
|
inst.decode = (data, params) => decode(inst, data, params);
|
|
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
_installLazyMethods(inst, "ZodType", {
|
|
check(...chks) {
|
|
const def2 = this.def;
|
|
return this.clone(util_exports.mergeDefs(def2, {
|
|
checks: [
|
|
...def2.checks ?? [],
|
|
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
]
|
|
}), { parent: true });
|
|
},
|
|
with(...chks) {
|
|
return this.check(...chks);
|
|
},
|
|
clone(def2, params) {
|
|
return clone(this, def2, params);
|
|
},
|
|
brand() {
|
|
return this;
|
|
},
|
|
register(reg, meta3) {
|
|
reg.add(this, meta3);
|
|
return this;
|
|
},
|
|
refine(check2, params) {
|
|
return this.check(refine(check2, params));
|
|
},
|
|
superRefine(refinement, params) {
|
|
return this.check(superRefine(refinement, params));
|
|
},
|
|
overwrite(fn) {
|
|
return this.check(_overwrite(fn));
|
|
},
|
|
optional() {
|
|
return optional(this);
|
|
},
|
|
exactOptional() {
|
|
return exactOptional(this);
|
|
},
|
|
nullable() {
|
|
return nullable(this);
|
|
},
|
|
nullish() {
|
|
return optional(nullable(this));
|
|
},
|
|
nonoptional(params) {
|
|
return nonoptional(this, params);
|
|
},
|
|
array() {
|
|
return array(this);
|
|
},
|
|
or(arg) {
|
|
return union([this, arg]);
|
|
},
|
|
and(arg) {
|
|
return intersection(this, arg);
|
|
},
|
|
transform(tx) {
|
|
return pipe(this, transform(tx));
|
|
},
|
|
default(d) {
|
|
return _default(this, d);
|
|
},
|
|
prefault(d) {
|
|
return prefault(this, d);
|
|
},
|
|
catch(params) {
|
|
return _catch(this, params);
|
|
},
|
|
pipe(target) {
|
|
return pipe(this, target);
|
|
},
|
|
readonly() {
|
|
return readonly(this);
|
|
},
|
|
describe(description) {
|
|
const cl = this.clone();
|
|
globalRegistry.add(cl, { description });
|
|
return cl;
|
|
},
|
|
meta(...args) {
|
|
if (args.length === 0)
|
|
return globalRegistry.get(this);
|
|
const cl = this.clone();
|
|
globalRegistry.add(cl, args[0]);
|
|
return cl;
|
|
},
|
|
isOptional() {
|
|
return this.safeParse(void 0).success;
|
|
},
|
|
isNullable() {
|
|
return this.safeParse(null).success;
|
|
},
|
|
apply(fn) {
|
|
return fn(this);
|
|
}
|
|
});
|
|
Object.defineProperty(inst, "description", {
|
|
get() {
|
|
return globalRegistry.get(inst)?.description;
|
|
},
|
|
configurable: true
|
|
});
|
|
return inst;
|
|
});
|
|
var _ZodString = $constructor("_ZodString", (inst, def) => {
|
|
$ZodString.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
|
|
const bag = inst._zod.bag;
|
|
inst.format = bag.format ?? null;
|
|
inst.minLength = bag.minimum ?? null;
|
|
inst.maxLength = bag.maximum ?? null;
|
|
_installLazyMethods(inst, "_ZodString", {
|
|
regex(...args) {
|
|
return this.check(_regex(...args));
|
|
},
|
|
includes(...args) {
|
|
return this.check(_includes(...args));
|
|
},
|
|
startsWith(...args) {
|
|
return this.check(_startsWith(...args));
|
|
},
|
|
endsWith(...args) {
|
|
return this.check(_endsWith(...args));
|
|
},
|
|
min(...args) {
|
|
return this.check(_minLength(...args));
|
|
},
|
|
max(...args) {
|
|
return this.check(_maxLength(...args));
|
|
},
|
|
length(...args) {
|
|
return this.check(_length(...args));
|
|
},
|
|
nonempty(...args) {
|
|
return this.check(_minLength(1, ...args));
|
|
},
|
|
lowercase(params) {
|
|
return this.check(_lowercase(params));
|
|
},
|
|
uppercase(params) {
|
|
return this.check(_uppercase(params));
|
|
},
|
|
trim() {
|
|
return this.check(_trim());
|
|
},
|
|
normalize(...args) {
|
|
return this.check(_normalize(...args));
|
|
},
|
|
toLowerCase() {
|
|
return this.check(_toLowerCase());
|
|
},
|
|
toUpperCase() {
|
|
return this.check(_toUpperCase());
|
|
},
|
|
slugify() {
|
|
return this.check(_slugify());
|
|
}
|
|
});
|
|
});
|
|
var ZodString = $constructor("ZodString", (inst, def) => {
|
|
$ZodString.init(inst, def);
|
|
_ZodString.init(inst, def);
|
|
inst.email = (params) => inst.check(_email(ZodEmail, params));
|
|
inst.url = (params) => inst.check(_url(ZodURL, params));
|
|
inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
|
|
inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
|
|
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
|
|
inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
|
|
inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
|
|
inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
|
|
inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
|
|
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
|
|
inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
|
|
inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
|
|
inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
|
|
inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
|
|
inst.xid = (params) => inst.check(_xid(ZodXID, params));
|
|
inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
|
|
inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
|
|
inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
|
|
inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
|
|
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
|
|
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
inst.datetime = (params) => inst.check(datetime(params));
|
|
inst.date = (params) => inst.check(date(params));
|
|
inst.time = (params) => inst.check(time(params));
|
|
inst.duration = (params) => inst.check(duration(params));
|
|
});
|
|
function string(params) {
|
|
return _string(ZodString, params);
|
|
}
|
|
var ZodStringFormat = $constructor("ZodStringFormat", (inst, def) => {
|
|
$ZodStringFormat.init(inst, def);
|
|
_ZodString.init(inst, def);
|
|
});
|
|
var ZodEmail = $constructor("ZodEmail", (inst, def) => {
|
|
$ZodEmail.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function email(params) {
|
|
return _email(ZodEmail, params);
|
|
}
|
|
var ZodGUID = $constructor("ZodGUID", (inst, def) => {
|
|
$ZodGUID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function guid(params) {
|
|
return _guid(ZodGUID, params);
|
|
}
|
|
var ZodUUID = $constructor("ZodUUID", (inst, def) => {
|
|
$ZodUUID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function uuid(params) {
|
|
return _uuid(ZodUUID, params);
|
|
}
|
|
function uuidv4(params) {
|
|
return _uuidv4(ZodUUID, params);
|
|
}
|
|
function uuidv6(params) {
|
|
return _uuidv6(ZodUUID, params);
|
|
}
|
|
function uuidv7(params) {
|
|
return _uuidv7(ZodUUID, params);
|
|
}
|
|
var ZodURL = $constructor("ZodURL", (inst, def) => {
|
|
$ZodURL.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function url(params) {
|
|
return _url(ZodURL, params);
|
|
}
|
|
function httpUrl(params) {
|
|
return _url(ZodURL, {
|
|
protocol: regexes_exports.httpProtocol,
|
|
hostname: regexes_exports.domain,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodEmoji = $constructor("ZodEmoji", (inst, def) => {
|
|
$ZodEmoji.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function emoji(params) {
|
|
return _emoji(ZodEmoji, params);
|
|
}
|
|
var ZodNanoID = $constructor("ZodNanoID", (inst, def) => {
|
|
$ZodNanoID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function nanoid(params) {
|
|
return _nanoid(ZodNanoID, params);
|
|
}
|
|
var ZodCUID = $constructor("ZodCUID", (inst, def) => {
|
|
$ZodCUID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function cuid(params) {
|
|
return _cuid(ZodCUID, params);
|
|
}
|
|
var ZodCUID2 = $constructor("ZodCUID2", (inst, def) => {
|
|
$ZodCUID2.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function cuid2(params) {
|
|
return _cuid2(ZodCUID2, params);
|
|
}
|
|
var ZodULID = $constructor("ZodULID", (inst, def) => {
|
|
$ZodULID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function ulid(params) {
|
|
return _ulid(ZodULID, params);
|
|
}
|
|
var ZodXID = $constructor("ZodXID", (inst, def) => {
|
|
$ZodXID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function xid(params) {
|
|
return _xid(ZodXID, params);
|
|
}
|
|
var ZodKSUID = $constructor("ZodKSUID", (inst, def) => {
|
|
$ZodKSUID.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function ksuid(params) {
|
|
return _ksuid(ZodKSUID, params);
|
|
}
|
|
var ZodIPv4 = $constructor("ZodIPv4", (inst, def) => {
|
|
$ZodIPv4.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function ipv4(params) {
|
|
return _ipv4(ZodIPv4, params);
|
|
}
|
|
var ZodMAC = $constructor("ZodMAC", (inst, def) => {
|
|
$ZodMAC.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function mac(params) {
|
|
return _mac(ZodMAC, params);
|
|
}
|
|
var ZodIPv6 = $constructor("ZodIPv6", (inst, def) => {
|
|
$ZodIPv6.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function ipv6(params) {
|
|
return _ipv6(ZodIPv6, params);
|
|
}
|
|
var ZodCIDRv4 = $constructor("ZodCIDRv4", (inst, def) => {
|
|
$ZodCIDRv4.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function cidrv4(params) {
|
|
return _cidrv4(ZodCIDRv4, params);
|
|
}
|
|
var ZodCIDRv6 = $constructor("ZodCIDRv6", (inst, def) => {
|
|
$ZodCIDRv6.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function cidrv6(params) {
|
|
return _cidrv6(ZodCIDRv6, params);
|
|
}
|
|
var ZodBase64 = $constructor("ZodBase64", (inst, def) => {
|
|
$ZodBase64.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function base64(params) {
|
|
return _base64(ZodBase64, params);
|
|
}
|
|
var ZodBase64URL = $constructor("ZodBase64URL", (inst, def) => {
|
|
$ZodBase64URL.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function base64url(params) {
|
|
return _base64url(ZodBase64URL, params);
|
|
}
|
|
var ZodE164 = $constructor("ZodE164", (inst, def) => {
|
|
$ZodE164.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function e164(params) {
|
|
return _e164(ZodE164, params);
|
|
}
|
|
var ZodJWT = $constructor("ZodJWT", (inst, def) => {
|
|
$ZodJWT.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function jwt(params) {
|
|
return _jwt(ZodJWT, params);
|
|
}
|
|
var ZodCustomStringFormat = $constructor("ZodCustomStringFormat", (inst, def) => {
|
|
$ZodCustomStringFormat.init(inst, def);
|
|
ZodStringFormat.init(inst, def);
|
|
});
|
|
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
}
|
|
function hostname(_params) {
|
|
return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
|
|
}
|
|
function hex(_params) {
|
|
return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params);
|
|
}
|
|
function hash(alg, params) {
|
|
const enc = params?.enc ?? "hex";
|
|
const format = `${alg}_${enc}`;
|
|
const regex = regexes_exports[format];
|
|
if (!regex)
|
|
throw new Error(`Unrecognized hash format: ${format}`);
|
|
return _stringFormat(ZodCustomStringFormat, format, regex, params);
|
|
}
|
|
var ZodNumber = $constructor("ZodNumber", (inst, def) => {
|
|
$ZodNumber.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
|
|
_installLazyMethods(inst, "ZodNumber", {
|
|
gt(value, params) {
|
|
return this.check(_gt(value, params));
|
|
},
|
|
gte(value, params) {
|
|
return this.check(_gte(value, params));
|
|
},
|
|
min(value, params) {
|
|
return this.check(_gte(value, params));
|
|
},
|
|
lt(value, params) {
|
|
return this.check(_lt(value, params));
|
|
},
|
|
lte(value, params) {
|
|
return this.check(_lte(value, params));
|
|
},
|
|
max(value, params) {
|
|
return this.check(_lte(value, params));
|
|
},
|
|
int(params) {
|
|
return this.check(int(params));
|
|
},
|
|
safe(params) {
|
|
return this.check(int(params));
|
|
},
|
|
positive(params) {
|
|
return this.check(_gt(0, params));
|
|
},
|
|
nonnegative(params) {
|
|
return this.check(_gte(0, params));
|
|
},
|
|
negative(params) {
|
|
return this.check(_lt(0, params));
|
|
},
|
|
nonpositive(params) {
|
|
return this.check(_lte(0, params));
|
|
},
|
|
multipleOf(value, params) {
|
|
return this.check(_multipleOf(value, params));
|
|
},
|
|
step(value, params) {
|
|
return this.check(_multipleOf(value, params));
|
|
},
|
|
finite() {
|
|
return this;
|
|
}
|
|
});
|
|
const bag = inst._zod.bag;
|
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
inst.isFinite = true;
|
|
inst.format = bag.format ?? null;
|
|
});
|
|
function number(params) {
|
|
return _number(ZodNumber, params);
|
|
}
|
|
var ZodNumberFormat = $constructor("ZodNumberFormat", (inst, def) => {
|
|
$ZodNumberFormat.init(inst, def);
|
|
ZodNumber.init(inst, def);
|
|
});
|
|
function int(params) {
|
|
return _int(ZodNumberFormat, params);
|
|
}
|
|
function float32(params) {
|
|
return _float32(ZodNumberFormat, params);
|
|
}
|
|
function float64(params) {
|
|
return _float64(ZodNumberFormat, params);
|
|
}
|
|
function int32(params) {
|
|
return _int32(ZodNumberFormat, params);
|
|
}
|
|
function uint32(params) {
|
|
return _uint32(ZodNumberFormat, params);
|
|
}
|
|
var ZodBoolean = $constructor("ZodBoolean", (inst, def) => {
|
|
$ZodBoolean.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => booleanProcessor(inst, ctx, json2, params);
|
|
});
|
|
function boolean(params) {
|
|
return _boolean(ZodBoolean, params);
|
|
}
|
|
var ZodBigInt = $constructor("ZodBigInt", (inst, def) => {
|
|
$ZodBigInt.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
|
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
|
|
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
|
|
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
|
|
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
|
|
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
const bag = inst._zod.bag;
|
|
inst.minValue = bag.minimum ?? null;
|
|
inst.maxValue = bag.maximum ?? null;
|
|
inst.format = bag.format ?? null;
|
|
});
|
|
function bigint(params) {
|
|
return _bigint(ZodBigInt, params);
|
|
}
|
|
var ZodBigIntFormat = $constructor("ZodBigIntFormat", (inst, def) => {
|
|
$ZodBigIntFormat.init(inst, def);
|
|
ZodBigInt.init(inst, def);
|
|
});
|
|
function int64(params) {
|
|
return _int64(ZodBigIntFormat, params);
|
|
}
|
|
function uint64(params) {
|
|
return _uint64(ZodBigIntFormat, params);
|
|
}
|
|
var ZodSymbol = $constructor("ZodSymbol", (inst, def) => {
|
|
$ZodSymbol.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => symbolProcessor(inst, ctx, json2, params);
|
|
});
|
|
function symbol(params) {
|
|
return _symbol(ZodSymbol, params);
|
|
}
|
|
var ZodUndefined = $constructor("ZodUndefined", (inst, def) => {
|
|
$ZodUndefined.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => undefinedProcessor(inst, ctx, json2, params);
|
|
});
|
|
function _undefined2(params) {
|
|
return _undefined(ZodUndefined, params);
|
|
}
|
|
var ZodNull = $constructor("ZodNull", (inst, def) => {
|
|
$ZodNull.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => nullProcessor(inst, ctx, json2, params);
|
|
});
|
|
function _null2(params) {
|
|
return _null(ZodNull, params);
|
|
}
|
|
var ZodAny = $constructor("ZodAny", (inst, def) => {
|
|
$ZodAny.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => anyProcessor(inst, ctx, json2, params);
|
|
});
|
|
function any() {
|
|
return _any(ZodAny);
|
|
}
|
|
var ZodUnknown = $constructor("ZodUnknown", (inst, def) => {
|
|
$ZodUnknown.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor(inst, ctx, json2, params);
|
|
});
|
|
function unknown() {
|
|
return _unknown(ZodUnknown);
|
|
}
|
|
var ZodNever = $constructor("ZodNever", (inst, def) => {
|
|
$ZodNever.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2, params);
|
|
});
|
|
function never(params) {
|
|
return _never(ZodNever, params);
|
|
}
|
|
var ZodVoid = $constructor("ZodVoid", (inst, def) => {
|
|
$ZodVoid.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => voidProcessor(inst, ctx, json2, params);
|
|
});
|
|
function _void2(params) {
|
|
return _void(ZodVoid, params);
|
|
}
|
|
var ZodDate = $constructor("ZodDate", (inst, def) => {
|
|
$ZodDate.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
|
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
const c = inst._zod.bag;
|
|
inst.minDate = c.minimum ? new Date(c.minimum) : null;
|
|
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
});
|
|
function date2(params) {
|
|
return _date(ZodDate, params);
|
|
}
|
|
var ZodArray = $constructor("ZodArray", (inst, def) => {
|
|
$ZodArray.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params);
|
|
inst.element = def.element;
|
|
_installLazyMethods(inst, "ZodArray", {
|
|
min(n, params) {
|
|
return this.check(_minLength(n, params));
|
|
},
|
|
nonempty(params) {
|
|
return this.check(_minLength(1, params));
|
|
},
|
|
max(n, params) {
|
|
return this.check(_maxLength(n, params));
|
|
},
|
|
length(n, params) {
|
|
return this.check(_length(n, params));
|
|
},
|
|
unwrap() {
|
|
return this.element;
|
|
}
|
|
});
|
|
});
|
|
function array(element, params) {
|
|
return _array(ZodArray, element, params);
|
|
}
|
|
function keyof(schema) {
|
|
const shape = schema._zod.def.shape;
|
|
return _enum(Object.keys(shape));
|
|
}
|
|
var ZodObject = $constructor("ZodObject", (inst, def) => {
|
|
$ZodObjectJIT.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params);
|
|
util_exports.defineLazy(inst, "shape", () => {
|
|
return def.shape;
|
|
});
|
|
_installLazyMethods(inst, "ZodObject", {
|
|
keyof() {
|
|
return _enum(Object.keys(this._zod.def.shape));
|
|
},
|
|
catchall(catchall) {
|
|
return this.clone({ ...this._zod.def, catchall });
|
|
},
|
|
passthrough() {
|
|
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
},
|
|
loose() {
|
|
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
},
|
|
strict() {
|
|
return this.clone({ ...this._zod.def, catchall: never() });
|
|
},
|
|
strip() {
|
|
return this.clone({ ...this._zod.def, catchall: void 0 });
|
|
},
|
|
extend(incoming) {
|
|
return util_exports.extend(this, incoming);
|
|
},
|
|
safeExtend(incoming) {
|
|
return util_exports.safeExtend(this, incoming);
|
|
},
|
|
merge(other) {
|
|
return util_exports.merge(this, other);
|
|
},
|
|
pick(mask) {
|
|
return util_exports.pick(this, mask);
|
|
},
|
|
omit(mask) {
|
|
return util_exports.omit(this, mask);
|
|
},
|
|
partial(...args) {
|
|
return util_exports.partial(ZodOptional, this, args[0]);
|
|
},
|
|
required(...args) {
|
|
return util_exports.required(ZodNonOptional, this, args[0]);
|
|
}
|
|
});
|
|
});
|
|
function object(shape, params) {
|
|
const def = {
|
|
type: "object",
|
|
shape: shape ?? {},
|
|
...util_exports.normalizeParams(params)
|
|
};
|
|
return new ZodObject(def);
|
|
}
|
|
function strictObject(shape, params) {
|
|
return new ZodObject({
|
|
type: "object",
|
|
shape,
|
|
catchall: never(),
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
function looseObject(shape, params) {
|
|
return new ZodObject({
|
|
type: "object",
|
|
shape,
|
|
catchall: unknown(),
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodUnion = $constructor("ZodUnion", (inst, def) => {
|
|
$ZodUnion.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
|
|
inst.options = def.options;
|
|
});
|
|
function union(options, params) {
|
|
return new ZodUnion({
|
|
type: "union",
|
|
options,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodXor = $constructor("ZodXor", (inst, def) => {
|
|
ZodUnion.init(inst, def);
|
|
$ZodXor.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
|
|
inst.options = def.options;
|
|
});
|
|
function xor(options, params) {
|
|
return new ZodXor({
|
|
type: "union",
|
|
options,
|
|
inclusive: false,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodDiscriminatedUnion = $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
ZodUnion.init(inst, def);
|
|
$ZodDiscriminatedUnion.init(inst, def);
|
|
});
|
|
function discriminatedUnion(discriminator, options, params) {
|
|
return new ZodDiscriminatedUnion({
|
|
type: "union",
|
|
options,
|
|
discriminator,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodIntersection = $constructor("ZodIntersection", (inst, def) => {
|
|
$ZodIntersection.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params);
|
|
});
|
|
function intersection(left, right) {
|
|
return new ZodIntersection({
|
|
type: "intersection",
|
|
left,
|
|
right
|
|
});
|
|
}
|
|
var ZodTuple = $constructor("ZodTuple", (inst, def) => {
|
|
$ZodTuple.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params);
|
|
inst.rest = (rest) => inst.clone({
|
|
...inst._zod.def,
|
|
rest
|
|
});
|
|
});
|
|
function tuple(items, _paramsOrRest, _params) {
|
|
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
const params = hasRest ? _params : _paramsOrRest;
|
|
const rest = hasRest ? _paramsOrRest : null;
|
|
return new ZodTuple({
|
|
type: "tuple",
|
|
items,
|
|
rest,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodRecord = $constructor("ZodRecord", (inst, def) => {
|
|
$ZodRecord.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params);
|
|
inst.keyType = def.keyType;
|
|
inst.valueType = def.valueType;
|
|
});
|
|
function record(keyType, valueType, params) {
|
|
if (!valueType || !valueType._zod) {
|
|
return new ZodRecord({
|
|
type: "record",
|
|
keyType: string(),
|
|
valueType: keyType,
|
|
...util_exports.normalizeParams(valueType)
|
|
});
|
|
}
|
|
return new ZodRecord({
|
|
type: "record",
|
|
keyType,
|
|
valueType,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
function partialRecord(keyType, valueType, params) {
|
|
const k = clone(keyType);
|
|
k._zod.values = void 0;
|
|
return new ZodRecord({
|
|
type: "record",
|
|
keyType: k,
|
|
valueType,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
function looseRecord(keyType, valueType, params) {
|
|
return new ZodRecord({
|
|
type: "record",
|
|
keyType,
|
|
valueType,
|
|
mode: "loose",
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodMap = $constructor("ZodMap", (inst, def) => {
|
|
$ZodMap.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params);
|
|
inst.keyType = def.keyType;
|
|
inst.valueType = def.valueType;
|
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
inst.size = (...args) => inst.check(_size(...args));
|
|
});
|
|
function map(keyType, valueType, params) {
|
|
return new ZodMap({
|
|
type: "map",
|
|
keyType,
|
|
valueType,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodSet = $constructor("ZodSet", (inst, def) => {
|
|
$ZodSet.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => setProcessor(inst, ctx, json2, params);
|
|
inst.min = (...args) => inst.check(_minSize(...args));
|
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
inst.size = (...args) => inst.check(_size(...args));
|
|
});
|
|
function set(valueType, params) {
|
|
return new ZodSet({
|
|
type: "set",
|
|
valueType,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodEnum = $constructor("ZodEnum", (inst, def) => {
|
|
$ZodEnum.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
|
|
inst.enum = def.entries;
|
|
inst.options = Object.values(def.entries);
|
|
const keys = new Set(Object.keys(def.entries));
|
|
inst.extract = (values, params) => {
|
|
const newEntries = {};
|
|
for (const value of values) {
|
|
if (keys.has(value)) {
|
|
newEntries[value] = def.entries[value];
|
|
} else
|
|
throw new Error(`Key ${value} not found in enum`);
|
|
}
|
|
return new ZodEnum({
|
|
...def,
|
|
checks: [],
|
|
...util_exports.normalizeParams(params),
|
|
entries: newEntries
|
|
});
|
|
};
|
|
inst.exclude = (values, params) => {
|
|
const newEntries = { ...def.entries };
|
|
for (const value of values) {
|
|
if (keys.has(value)) {
|
|
delete newEntries[value];
|
|
} else
|
|
throw new Error(`Key ${value} not found in enum`);
|
|
}
|
|
return new ZodEnum({
|
|
...def,
|
|
checks: [],
|
|
...util_exports.normalizeParams(params),
|
|
entries: newEntries
|
|
});
|
|
};
|
|
});
|
|
function _enum(values, params) {
|
|
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
return new ZodEnum({
|
|
type: "enum",
|
|
entries,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
function nativeEnum(entries, params) {
|
|
return new ZodEnum({
|
|
type: "enum",
|
|
entries,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodLiteral = $constructor("ZodLiteral", (inst, def) => {
|
|
$ZodLiteral.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params);
|
|
inst.values = new Set(def.values);
|
|
Object.defineProperty(inst, "value", {
|
|
get() {
|
|
if (def.values.length > 1) {
|
|
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
}
|
|
return def.values[0];
|
|
}
|
|
});
|
|
});
|
|
function literal(value, params) {
|
|
return new ZodLiteral({
|
|
type: "literal",
|
|
values: Array.isArray(value) ? value : [value],
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodFile = $constructor("ZodFile", (inst, def) => {
|
|
$ZodFile.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => fileProcessor(inst, ctx, json2, params);
|
|
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
});
|
|
function file(params) {
|
|
return _file(ZodFile, params);
|
|
}
|
|
var ZodTransform = $constructor("ZodTransform", (inst, def) => {
|
|
$ZodTransform.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
|
|
inst._zod.parse = (payload, _ctx) => {
|
|
if (_ctx.direction === "backward") {
|
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
}
|
|
payload.addIssue = (issue) => {
|
|
if (typeof issue === "string") {
|
|
payload.issues.push(util_exports.issue(issue, payload.value, def));
|
|
} else {
|
|
const _issue = issue;
|
|
if (_issue.fatal)
|
|
_issue.continue = false;
|
|
_issue.code ?? (_issue.code = "custom");
|
|
_issue.input ?? (_issue.input = payload.value);
|
|
_issue.inst ?? (_issue.inst = inst);
|
|
payload.issues.push(util_exports.issue(_issue));
|
|
}
|
|
};
|
|
const output = def.transform(payload.value, payload);
|
|
if (output instanceof Promise) {
|
|
return output.then((output2) => {
|
|
payload.value = output2;
|
|
payload.fallback = true;
|
|
return payload;
|
|
});
|
|
}
|
|
payload.value = output;
|
|
payload.fallback = true;
|
|
return payload;
|
|
};
|
|
});
|
|
function transform(fn) {
|
|
return new ZodTransform({
|
|
type: "transform",
|
|
transform: fn
|
|
});
|
|
}
|
|
var ZodOptional = $constructor("ZodOptional", (inst, def) => {
|
|
$ZodOptional.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function optional(innerType) {
|
|
return new ZodOptional({
|
|
type: "optional",
|
|
innerType
|
|
});
|
|
}
|
|
var ZodExactOptional = $constructor("ZodExactOptional", (inst, def) => {
|
|
$ZodExactOptional.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function exactOptional(innerType) {
|
|
return new ZodExactOptional({
|
|
type: "optional",
|
|
innerType
|
|
});
|
|
}
|
|
var ZodNullable = $constructor("ZodNullable", (inst, def) => {
|
|
$ZodNullable.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function nullable(innerType) {
|
|
return new ZodNullable({
|
|
type: "nullable",
|
|
innerType
|
|
});
|
|
}
|
|
function nullish(innerType) {
|
|
return optional(nullable(innerType));
|
|
}
|
|
var ZodDefault = $constructor("ZodDefault", (inst, def) => {
|
|
$ZodDefault.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
inst.removeDefault = inst.unwrap;
|
|
});
|
|
function _default(innerType, defaultValue) {
|
|
return new ZodDefault({
|
|
type: "default",
|
|
innerType,
|
|
get defaultValue() {
|
|
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
}
|
|
});
|
|
}
|
|
var ZodPrefault = $constructor("ZodPrefault", (inst, def) => {
|
|
$ZodPrefault.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function prefault(innerType, defaultValue) {
|
|
return new ZodPrefault({
|
|
type: "prefault",
|
|
innerType,
|
|
get defaultValue() {
|
|
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
}
|
|
});
|
|
}
|
|
var ZodNonOptional = $constructor("ZodNonOptional", (inst, def) => {
|
|
$ZodNonOptional.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function nonoptional(innerType, params) {
|
|
return new ZodNonOptional({
|
|
type: "nonoptional",
|
|
innerType,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodSuccess = $constructor("ZodSuccess", (inst, def) => {
|
|
$ZodSuccess.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => successProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function success(innerType) {
|
|
return new ZodSuccess({
|
|
type: "success",
|
|
innerType
|
|
});
|
|
}
|
|
var ZodCatch = $constructor("ZodCatch", (inst, def) => {
|
|
$ZodCatch.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
inst.removeCatch = inst.unwrap;
|
|
});
|
|
function _catch(innerType, catchValue) {
|
|
return new ZodCatch({
|
|
type: "catch",
|
|
innerType,
|
|
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
});
|
|
}
|
|
var ZodNaN = $constructor("ZodNaN", (inst, def) => {
|
|
$ZodNaN.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => nanProcessor(inst, ctx, json2, params);
|
|
});
|
|
function nan(params) {
|
|
return _nan(ZodNaN, params);
|
|
}
|
|
var ZodPipe = $constructor("ZodPipe", (inst, def) => {
|
|
$ZodPipe.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
|
|
inst.in = def.in;
|
|
inst.out = def.out;
|
|
});
|
|
function pipe(in_, out) {
|
|
return new ZodPipe({
|
|
type: "pipe",
|
|
in: in_,
|
|
out
|
|
// ...util.normalizeParams(params),
|
|
});
|
|
}
|
|
var ZodCodec = $constructor("ZodCodec", (inst, def) => {
|
|
ZodPipe.init(inst, def);
|
|
$ZodCodec.init(inst, def);
|
|
});
|
|
function codec(in_, out, params) {
|
|
return new ZodCodec({
|
|
type: "pipe",
|
|
in: in_,
|
|
out,
|
|
transform: params.decode,
|
|
reverseTransform: params.encode
|
|
});
|
|
}
|
|
function invertCodec(codec2) {
|
|
const def = codec2._zod.def;
|
|
return new ZodCodec({
|
|
type: "pipe",
|
|
in: def.out,
|
|
out: def.in,
|
|
transform: def.reverseTransform,
|
|
reverseTransform: def.transform
|
|
});
|
|
}
|
|
var ZodPreprocess = $constructor("ZodPreprocess", (inst, def) => {
|
|
ZodPipe.init(inst, def);
|
|
$ZodPreprocess.init(inst, def);
|
|
});
|
|
var ZodReadonly = $constructor("ZodReadonly", (inst, def) => {
|
|
$ZodReadonly.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function readonly(innerType) {
|
|
return new ZodReadonly({
|
|
type: "readonly",
|
|
innerType
|
|
});
|
|
}
|
|
var ZodTemplateLiteral = $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
$ZodTemplateLiteral.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => templateLiteralProcessor(inst, ctx, json2, params);
|
|
});
|
|
function templateLiteral(parts, params) {
|
|
return new ZodTemplateLiteral({
|
|
type: "template_literal",
|
|
parts,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
}
|
|
var ZodLazy = $constructor("ZodLazy", (inst, def) => {
|
|
$ZodLazy.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.getter();
|
|
});
|
|
function lazy(getter) {
|
|
return new ZodLazy({
|
|
type: "lazy",
|
|
getter
|
|
});
|
|
}
|
|
var ZodPromise = $constructor("ZodPromise", (inst, def) => {
|
|
$ZodPromise.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => promiseProcessor(inst, ctx, json2, params);
|
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
});
|
|
function promise(innerType) {
|
|
return new ZodPromise({
|
|
type: "promise",
|
|
innerType
|
|
});
|
|
}
|
|
var ZodFunction = $constructor("ZodFunction", (inst, def) => {
|
|
$ZodFunction.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => functionProcessor(inst, ctx, json2, params);
|
|
});
|
|
function _function(params) {
|
|
return new ZodFunction({
|
|
type: "function",
|
|
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
output: params?.output ?? unknown()
|
|
});
|
|
}
|
|
var ZodCustom = $constructor("ZodCustom", (inst, def) => {
|
|
$ZodCustom.init(inst, def);
|
|
ZodType.init(inst, def);
|
|
inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
|
|
});
|
|
function check(fn) {
|
|
const ch = new $ZodCheck({
|
|
check: "custom"
|
|
// ...util.normalizeParams(params),
|
|
});
|
|
ch._zod.check = fn;
|
|
return ch;
|
|
}
|
|
function custom(fn, _params) {
|
|
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
}
|
|
function refine(fn, _params = {}) {
|
|
return _refine(ZodCustom, fn, _params);
|
|
}
|
|
function superRefine(fn, params) {
|
|
return _superRefine(fn, params);
|
|
}
|
|
var describe2 = describe;
|
|
var meta2 = meta;
|
|
function _instanceof(cls, params = {}) {
|
|
const inst = new ZodCustom({
|
|
type: "custom",
|
|
check: "custom",
|
|
fn: (data) => data instanceof cls,
|
|
abort: true,
|
|
...util_exports.normalizeParams(params)
|
|
});
|
|
inst._zod.bag.Class = cls;
|
|
inst._zod.check = (payload) => {
|
|
if (!(payload.value instanceof cls)) {
|
|
payload.issues.push({
|
|
code: "invalid_type",
|
|
expected: cls.name,
|
|
input: payload.value,
|
|
inst,
|
|
path: [...inst._zod.def.path ?? []]
|
|
});
|
|
}
|
|
};
|
|
return inst;
|
|
}
|
|
var stringbool = (...args) => _stringbool({
|
|
Codec: ZodCodec,
|
|
Boolean: ZodBoolean,
|
|
String: ZodString
|
|
}, ...args);
|
|
function json(params) {
|
|
const jsonSchema = lazy(() => {
|
|
return union([string(params), number(), boolean(), _null2(), array(jsonSchema), record(string(), jsonSchema)]);
|
|
});
|
|
return jsonSchema;
|
|
}
|
|
function preprocess(fn, schema) {
|
|
return new ZodPreprocess({
|
|
type: "pipe",
|
|
in: transform(fn),
|
|
out: schema
|
|
});
|
|
}
|
|
|
|
// node_modules/zod/v4/classic/compat.js
|
|
var ZodIssueCode = {
|
|
invalid_type: "invalid_type",
|
|
too_big: "too_big",
|
|
too_small: "too_small",
|
|
invalid_format: "invalid_format",
|
|
not_multiple_of: "not_multiple_of",
|
|
unrecognized_keys: "unrecognized_keys",
|
|
invalid_union: "invalid_union",
|
|
invalid_key: "invalid_key",
|
|
invalid_element: "invalid_element",
|
|
invalid_value: "invalid_value",
|
|
custom: "custom"
|
|
};
|
|
function setErrorMap(map2) {
|
|
config({
|
|
customError: map2
|
|
});
|
|
}
|
|
function getErrorMap() {
|
|
return config().customError;
|
|
}
|
|
var ZodFirstPartyTypeKind;
|
|
/* @__PURE__ */ (function(ZodFirstPartyTypeKind2) {
|
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
|
|
// node_modules/zod/v4/classic/from-json-schema.js
|
|
var z = {
|
|
...schemas_exports,
|
|
...checks_exports,
|
|
iso: iso_exports
|
|
};
|
|
var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([
|
|
// Schema identification
|
|
"$schema",
|
|
"$ref",
|
|
"$defs",
|
|
"definitions",
|
|
// Core schema keywords
|
|
"$id",
|
|
"id",
|
|
"$comment",
|
|
"$anchor",
|
|
"$vocabulary",
|
|
"$dynamicRef",
|
|
"$dynamicAnchor",
|
|
// Type
|
|
"type",
|
|
"enum",
|
|
"const",
|
|
// Composition
|
|
"anyOf",
|
|
"oneOf",
|
|
"allOf",
|
|
"not",
|
|
// Object
|
|
"properties",
|
|
"required",
|
|
"additionalProperties",
|
|
"patternProperties",
|
|
"propertyNames",
|
|
"minProperties",
|
|
"maxProperties",
|
|
// Array
|
|
"items",
|
|
"prefixItems",
|
|
"additionalItems",
|
|
"minItems",
|
|
"maxItems",
|
|
"uniqueItems",
|
|
"contains",
|
|
"minContains",
|
|
"maxContains",
|
|
// String
|
|
"minLength",
|
|
"maxLength",
|
|
"pattern",
|
|
"format",
|
|
// Number
|
|
"minimum",
|
|
"maximum",
|
|
"exclusiveMinimum",
|
|
"exclusiveMaximum",
|
|
"multipleOf",
|
|
// Already handled metadata
|
|
"description",
|
|
"default",
|
|
// Content
|
|
"contentEncoding",
|
|
"contentMediaType",
|
|
"contentSchema",
|
|
// Unsupported (error-throwing)
|
|
"unevaluatedItems",
|
|
"unevaluatedProperties",
|
|
"if",
|
|
"then",
|
|
"else",
|
|
"dependentSchemas",
|
|
"dependentRequired",
|
|
// OpenAPI
|
|
"nullable",
|
|
"readOnly"
|
|
]);
|
|
function detectVersion(schema, defaultTarget) {
|
|
const $schema = schema.$schema;
|
|
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
return "draft-2020-12";
|
|
}
|
|
if ($schema === "http://json-schema.org/draft-07/schema#") {
|
|
return "draft-7";
|
|
}
|
|
if ($schema === "http://json-schema.org/draft-04/schema#") {
|
|
return "draft-4";
|
|
}
|
|
return defaultTarget ?? "draft-2020-12";
|
|
}
|
|
function resolveRef(ref, ctx) {
|
|
if (!ref.startsWith("#")) {
|
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
}
|
|
const path = ref.slice(1).split("/").filter(Boolean);
|
|
if (path.length === 0) {
|
|
return ctx.rootSchema;
|
|
}
|
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
if (path[0] === defsKey) {
|
|
const key = path[1];
|
|
if (!key || !ctx.defs[key]) {
|
|
throw new Error(`Reference not found: ${ref}`);
|
|
}
|
|
return ctx.defs[key];
|
|
}
|
|
throw new Error(`Reference not found: ${ref}`);
|
|
}
|
|
function convertBaseSchema(schema, ctx) {
|
|
if (schema.not !== void 0) {
|
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
return z.never();
|
|
}
|
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
}
|
|
if (schema.unevaluatedItems !== void 0) {
|
|
throw new Error("unevaluatedItems is not supported");
|
|
}
|
|
if (schema.unevaluatedProperties !== void 0) {
|
|
throw new Error("unevaluatedProperties is not supported");
|
|
}
|
|
if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0) {
|
|
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
}
|
|
if (schema.dependentSchemas !== void 0 || schema.dependentRequired !== void 0) {
|
|
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
}
|
|
if (schema.$ref) {
|
|
const refPath = schema.$ref;
|
|
if (ctx.refs.has(refPath)) {
|
|
return ctx.refs.get(refPath);
|
|
}
|
|
if (ctx.processing.has(refPath)) {
|
|
return z.lazy(() => {
|
|
if (!ctx.refs.has(refPath)) {
|
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
}
|
|
return ctx.refs.get(refPath);
|
|
});
|
|
}
|
|
ctx.processing.add(refPath);
|
|
const resolved = resolveRef(refPath, ctx);
|
|
const zodSchema2 = convertSchema(resolved, ctx);
|
|
ctx.refs.set(refPath, zodSchema2);
|
|
ctx.processing.delete(refPath);
|
|
return zodSchema2;
|
|
}
|
|
if (schema.enum !== void 0) {
|
|
const enumValues = schema.enum;
|
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
return z.null();
|
|
}
|
|
if (enumValues.length === 0) {
|
|
return z.never();
|
|
}
|
|
if (enumValues.length === 1) {
|
|
return z.literal(enumValues[0]);
|
|
}
|
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
return z.enum(enumValues);
|
|
}
|
|
const literalSchemas = enumValues.map((v) => z.literal(v));
|
|
if (literalSchemas.length < 2) {
|
|
return literalSchemas[0];
|
|
}
|
|
return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
}
|
|
if (schema.const !== void 0) {
|
|
return z.literal(schema.const);
|
|
}
|
|
const type = schema.type;
|
|
if (Array.isArray(type)) {
|
|
const typeSchemas = type.map((t) => {
|
|
const typeSchema = { ...schema, type: t };
|
|
return convertBaseSchema(typeSchema, ctx);
|
|
});
|
|
if (typeSchemas.length === 0) {
|
|
return z.never();
|
|
}
|
|
if (typeSchemas.length === 1) {
|
|
return typeSchemas[0];
|
|
}
|
|
return z.union(typeSchemas);
|
|
}
|
|
if (!type) {
|
|
return z.any();
|
|
}
|
|
let zodSchema;
|
|
switch (type) {
|
|
case "string": {
|
|
let stringSchema = z.string();
|
|
if (schema.format) {
|
|
const format = schema.format;
|
|
if (format === "email") {
|
|
stringSchema = stringSchema.check(z.email());
|
|
} else if (format === "uri" || format === "uri-reference") {
|
|
stringSchema = stringSchema.check(z.url());
|
|
} else if (format === "uuid" || format === "guid") {
|
|
stringSchema = stringSchema.check(z.uuid());
|
|
} else if (format === "date-time") {
|
|
stringSchema = stringSchema.check(z.iso.datetime());
|
|
} else if (format === "date") {
|
|
stringSchema = stringSchema.check(z.iso.date());
|
|
} else if (format === "time") {
|
|
stringSchema = stringSchema.check(z.iso.time());
|
|
} else if (format === "duration") {
|
|
stringSchema = stringSchema.check(z.iso.duration());
|
|
} else if (format === "ipv4") {
|
|
stringSchema = stringSchema.check(z.ipv4());
|
|
} else if (format === "ipv6") {
|
|
stringSchema = stringSchema.check(z.ipv6());
|
|
} else if (format === "mac") {
|
|
stringSchema = stringSchema.check(z.mac());
|
|
} else if (format === "cidr") {
|
|
stringSchema = stringSchema.check(z.cidrv4());
|
|
} else if (format === "cidr-v6") {
|
|
stringSchema = stringSchema.check(z.cidrv6());
|
|
} else if (format === "base64") {
|
|
stringSchema = stringSchema.check(z.base64());
|
|
} else if (format === "base64url") {
|
|
stringSchema = stringSchema.check(z.base64url());
|
|
} else if (format === "e164") {
|
|
stringSchema = stringSchema.check(z.e164());
|
|
} else if (format === "jwt") {
|
|
stringSchema = stringSchema.check(z.jwt());
|
|
} else if (format === "emoji") {
|
|
stringSchema = stringSchema.check(z.emoji());
|
|
} else if (format === "nanoid") {
|
|
stringSchema = stringSchema.check(z.nanoid());
|
|
} else if (format === "cuid") {
|
|
stringSchema = stringSchema.check(z.cuid());
|
|
} else if (format === "cuid2") {
|
|
stringSchema = stringSchema.check(z.cuid2());
|
|
} else if (format === "ulid") {
|
|
stringSchema = stringSchema.check(z.ulid());
|
|
} else if (format === "xid") {
|
|
stringSchema = stringSchema.check(z.xid());
|
|
} else if (format === "ksuid") {
|
|
stringSchema = stringSchema.check(z.ksuid());
|
|
}
|
|
}
|
|
if (typeof schema.minLength === "number") {
|
|
stringSchema = stringSchema.min(schema.minLength);
|
|
}
|
|
if (typeof schema.maxLength === "number") {
|
|
stringSchema = stringSchema.max(schema.maxLength);
|
|
}
|
|
if (schema.pattern) {
|
|
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
}
|
|
zodSchema = stringSchema;
|
|
break;
|
|
}
|
|
case "number":
|
|
case "integer": {
|
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
if (typeof schema.minimum === "number") {
|
|
numberSchema = numberSchema.min(schema.minimum);
|
|
}
|
|
if (typeof schema.maximum === "number") {
|
|
numberSchema = numberSchema.max(schema.maximum);
|
|
}
|
|
if (typeof schema.exclusiveMinimum === "number") {
|
|
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
|
|
numberSchema = numberSchema.gt(schema.minimum);
|
|
}
|
|
if (typeof schema.exclusiveMaximum === "number") {
|
|
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
|
|
numberSchema = numberSchema.lt(schema.maximum);
|
|
}
|
|
if (typeof schema.multipleOf === "number") {
|
|
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
}
|
|
zodSchema = numberSchema;
|
|
break;
|
|
}
|
|
case "boolean": {
|
|
zodSchema = z.boolean();
|
|
break;
|
|
}
|
|
case "null": {
|
|
zodSchema = z.null();
|
|
break;
|
|
}
|
|
case "object": {
|
|
const shape = {};
|
|
const properties = schema.properties || {};
|
|
const requiredSet = new Set(schema.required || []);
|
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
}
|
|
if (schema.propertyNames) {
|
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any();
|
|
if (Object.keys(shape).length === 0) {
|
|
zodSchema = z.record(keySchema, valueSchema);
|
|
break;
|
|
}
|
|
const objectSchema2 = z.object(shape).passthrough();
|
|
const recordSchema = z.looseRecord(keySchema, valueSchema);
|
|
zodSchema = z.intersection(objectSchema2, recordSchema);
|
|
break;
|
|
}
|
|
if (schema.patternProperties) {
|
|
const patternProps = schema.patternProperties;
|
|
const patternKeys = Object.keys(patternProps);
|
|
const looseRecords = [];
|
|
for (const pattern of patternKeys) {
|
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
const keySchema = z.string().regex(new RegExp(pattern));
|
|
looseRecords.push(z.looseRecord(keySchema, patternValue));
|
|
}
|
|
const schemasToIntersect = [];
|
|
if (Object.keys(shape).length > 0) {
|
|
schemasToIntersect.push(z.object(shape).passthrough());
|
|
}
|
|
schemasToIntersect.push(...looseRecords);
|
|
if (schemasToIntersect.length === 0) {
|
|
zodSchema = z.object({}).passthrough();
|
|
} else if (schemasToIntersect.length === 1) {
|
|
zodSchema = schemasToIntersect[0];
|
|
} else {
|
|
let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
result = z.intersection(result, schemasToIntersect[i]);
|
|
}
|
|
zodSchema = result;
|
|
}
|
|
break;
|
|
}
|
|
const objectSchema = z.object(shape);
|
|
if (schema.additionalProperties === false) {
|
|
zodSchema = objectSchema.strict();
|
|
} else if (typeof schema.additionalProperties === "object") {
|
|
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
} else {
|
|
zodSchema = objectSchema.passthrough();
|
|
}
|
|
break;
|
|
}
|
|
case "array": {
|
|
const prefixItems = schema.prefixItems;
|
|
const items = schema.items;
|
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
if (rest) {
|
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
} else {
|
|
zodSchema = z.tuple(tupleItems);
|
|
}
|
|
if (typeof schema.minItems === "number") {
|
|
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
}
|
|
if (typeof schema.maxItems === "number") {
|
|
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
}
|
|
} else if (Array.isArray(items)) {
|
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
if (rest) {
|
|
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
} else {
|
|
zodSchema = z.tuple(tupleItems);
|
|
}
|
|
if (typeof schema.minItems === "number") {
|
|
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
}
|
|
if (typeof schema.maxItems === "number") {
|
|
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
}
|
|
} else if (items !== void 0) {
|
|
const element = convertSchema(items, ctx);
|
|
let arraySchema = z.array(element);
|
|
if (typeof schema.minItems === "number") {
|
|
arraySchema = arraySchema.min(schema.minItems);
|
|
}
|
|
if (typeof schema.maxItems === "number") {
|
|
arraySchema = arraySchema.max(schema.maxItems);
|
|
}
|
|
zodSchema = arraySchema;
|
|
} else {
|
|
zodSchema = z.array(z.any());
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
throw new Error(`Unsupported type: ${type}`);
|
|
}
|
|
return zodSchema;
|
|
}
|
|
function convertSchema(schema, ctx) {
|
|
if (typeof schema === "boolean") {
|
|
return schema ? z.any() : z.never();
|
|
}
|
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
const anyOfUnion = z.union(options);
|
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
}
|
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
const oneOfUnion = z.xor(options);
|
|
baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
}
|
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
if (schema.allOf.length === 0) {
|
|
baseSchema = hasExplicitType ? baseSchema : z.any();
|
|
} else {
|
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
result = z.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
}
|
|
baseSchema = result;
|
|
}
|
|
}
|
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
baseSchema = z.nullable(baseSchema);
|
|
}
|
|
if (schema.readOnly === true) {
|
|
baseSchema = z.readonly(baseSchema);
|
|
}
|
|
if (schema.default !== void 0) {
|
|
baseSchema = baseSchema.default(schema.default);
|
|
}
|
|
const extraMeta = {};
|
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
for (const key of coreMetadataKeys) {
|
|
if (key in schema) {
|
|
extraMeta[key] = schema[key];
|
|
}
|
|
}
|
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
for (const key of contentMetadataKeys) {
|
|
if (key in schema) {
|
|
extraMeta[key] = schema[key];
|
|
}
|
|
}
|
|
for (const key of Object.keys(schema)) {
|
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
extraMeta[key] = schema[key];
|
|
}
|
|
}
|
|
if (Object.keys(extraMeta).length > 0) {
|
|
ctx.registry.add(baseSchema, extraMeta);
|
|
}
|
|
if (schema.description) {
|
|
baseSchema = baseSchema.describe(schema.description);
|
|
}
|
|
return baseSchema;
|
|
}
|
|
function fromJSONSchema(schema, params) {
|
|
if (typeof schema === "boolean") {
|
|
return schema ? z.any() : z.never();
|
|
}
|
|
let normalized;
|
|
try {
|
|
normalized = JSON.parse(JSON.stringify(schema));
|
|
} catch {
|
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
}
|
|
const version = detectVersion(normalized, params?.defaultTarget);
|
|
const defs = normalized.$defs || normalized.definitions || {};
|
|
const ctx = {
|
|
version,
|
|
defs,
|
|
refs: /* @__PURE__ */ new Map(),
|
|
processing: /* @__PURE__ */ new Set(),
|
|
rootSchema: normalized,
|
|
registry: params?.registry ?? globalRegistry
|
|
};
|
|
return convertSchema(normalized, ctx);
|
|
}
|
|
|
|
// node_modules/zod/v4/classic/coerce.js
|
|
var coerce_exports = {};
|
|
__export(coerce_exports, {
|
|
bigint: () => bigint2,
|
|
boolean: () => boolean2,
|
|
date: () => date3,
|
|
number: () => number2,
|
|
string: () => string2
|
|
});
|
|
function string2(params) {
|
|
return _coercedString(ZodString, params);
|
|
}
|
|
function number2(params) {
|
|
return _coercedNumber(ZodNumber, params);
|
|
}
|
|
function boolean2(params) {
|
|
return _coercedBoolean(ZodBoolean, params);
|
|
}
|
|
function bigint2(params) {
|
|
return _coercedBigint(ZodBigInt, params);
|
|
}
|
|
function date3(params) {
|
|
return _coercedDate(ZodDate, params);
|
|
}
|
|
|
|
// node_modules/zod/v4/classic/external.js
|
|
config(en_default());
|
|
|
|
// node_modules/zod/index.js
|
|
var zod_default = external_exports;
|
|
export {
|
|
$brand,
|
|
$input,
|
|
$output,
|
|
NEVER,
|
|
TimePrecision,
|
|
ZodAny,
|
|
ZodArray,
|
|
ZodBase64,
|
|
ZodBase64URL,
|
|
ZodBigInt,
|
|
ZodBigIntFormat,
|
|
ZodBoolean,
|
|
ZodCIDRv4,
|
|
ZodCIDRv6,
|
|
ZodCUID,
|
|
ZodCUID2,
|
|
ZodCatch,
|
|
ZodCodec,
|
|
ZodCustom,
|
|
ZodCustomStringFormat,
|
|
ZodDate,
|
|
ZodDefault,
|
|
ZodDiscriminatedUnion,
|
|
ZodE164,
|
|
ZodEmail,
|
|
ZodEmoji,
|
|
ZodEnum,
|
|
ZodError,
|
|
ZodExactOptional,
|
|
ZodFile,
|
|
ZodFirstPartyTypeKind,
|
|
ZodFunction,
|
|
ZodGUID,
|
|
ZodIPv4,
|
|
ZodIPv6,
|
|
ZodISODate,
|
|
ZodISODateTime,
|
|
ZodISODuration,
|
|
ZodISOTime,
|
|
ZodIntersection,
|
|
ZodIssueCode,
|
|
ZodJWT,
|
|
ZodKSUID,
|
|
ZodLazy,
|
|
ZodLiteral,
|
|
ZodMAC,
|
|
ZodMap,
|
|
ZodNaN,
|
|
ZodNanoID,
|
|
ZodNever,
|
|
ZodNonOptional,
|
|
ZodNull,
|
|
ZodNullable,
|
|
ZodNumber,
|
|
ZodNumberFormat,
|
|
ZodObject,
|
|
ZodOptional,
|
|
ZodPipe,
|
|
ZodPrefault,
|
|
ZodPreprocess,
|
|
ZodPromise,
|
|
ZodReadonly,
|
|
ZodRealError,
|
|
ZodRecord,
|
|
ZodSet,
|
|
ZodString,
|
|
ZodStringFormat,
|
|
ZodSuccess,
|
|
ZodSymbol,
|
|
ZodTemplateLiteral,
|
|
ZodTransform,
|
|
ZodTuple,
|
|
ZodType,
|
|
ZodULID,
|
|
ZodURL,
|
|
ZodUUID,
|
|
ZodUndefined,
|
|
ZodUnion,
|
|
ZodUnknown,
|
|
ZodVoid,
|
|
ZodXID,
|
|
ZodXor,
|
|
_ZodString,
|
|
_default,
|
|
_function,
|
|
any,
|
|
array,
|
|
base64,
|
|
base64url,
|
|
bigint,
|
|
boolean,
|
|
_catch as catch,
|
|
check,
|
|
cidrv4,
|
|
cidrv6,
|
|
clone,
|
|
codec,
|
|
coerce_exports as coerce,
|
|
config,
|
|
core_exports as core,
|
|
cuid,
|
|
cuid2,
|
|
custom,
|
|
date2 as date,
|
|
decode,
|
|
decodeAsync,
|
|
zod_default as default,
|
|
describe2 as describe,
|
|
discriminatedUnion,
|
|
e164,
|
|
email,
|
|
emoji,
|
|
encode,
|
|
encodeAsync,
|
|
_endsWith as endsWith,
|
|
_enum as enum,
|
|
exactOptional,
|
|
file,
|
|
flattenError,
|
|
float32,
|
|
float64,
|
|
formatError,
|
|
fromJSONSchema,
|
|
_function as function,
|
|
getErrorMap,
|
|
globalRegistry,
|
|
_gt as gt,
|
|
_gte as gte,
|
|
guid,
|
|
hash,
|
|
hex,
|
|
hostname,
|
|
httpUrl,
|
|
_includes as includes,
|
|
_instanceof as instanceof,
|
|
int,
|
|
int32,
|
|
int64,
|
|
intersection,
|
|
invertCodec,
|
|
ipv4,
|
|
ipv6,
|
|
iso_exports as iso,
|
|
json,
|
|
jwt,
|
|
keyof,
|
|
ksuid,
|
|
lazy,
|
|
_length as length,
|
|
literal,
|
|
locales_exports as locales,
|
|
looseObject,
|
|
looseRecord,
|
|
_lowercase as lowercase,
|
|
_lt as lt,
|
|
_lte as lte,
|
|
mac,
|
|
map,
|
|
_maxLength as maxLength,
|
|
_maxSize as maxSize,
|
|
meta2 as meta,
|
|
_mime as mime,
|
|
_minLength as minLength,
|
|
_minSize as minSize,
|
|
_multipleOf as multipleOf,
|
|
nan,
|
|
nanoid,
|
|
nativeEnum,
|
|
_negative as negative,
|
|
never,
|
|
_nonnegative as nonnegative,
|
|
nonoptional,
|
|
_nonpositive as nonpositive,
|
|
_normalize as normalize,
|
|
_null2 as null,
|
|
nullable,
|
|
nullish,
|
|
number,
|
|
object,
|
|
optional,
|
|
_overwrite as overwrite,
|
|
parse,
|
|
parseAsync,
|
|
partialRecord,
|
|
pipe,
|
|
_positive as positive,
|
|
prefault,
|
|
preprocess,
|
|
prettifyError,
|
|
promise,
|
|
_property as property,
|
|
readonly,
|
|
record,
|
|
refine,
|
|
_regex as regex,
|
|
regexes_exports as regexes,
|
|
registry,
|
|
safeDecode,
|
|
safeDecodeAsync,
|
|
safeEncode,
|
|
safeEncodeAsync,
|
|
safeParse,
|
|
safeParseAsync,
|
|
set,
|
|
setErrorMap,
|
|
_size as size,
|
|
_slugify as slugify,
|
|
_startsWith as startsWith,
|
|
strictObject,
|
|
string,
|
|
stringFormat,
|
|
stringbool,
|
|
success,
|
|
superRefine,
|
|
symbol,
|
|
templateLiteral,
|
|
toJSONSchema,
|
|
_toLowerCase as toLowerCase,
|
|
_toUpperCase as toUpperCase,
|
|
transform,
|
|
treeifyError,
|
|
_trim as trim,
|
|
tuple,
|
|
uint32,
|
|
uint64,
|
|
ulid,
|
|
_undefined2 as undefined,
|
|
union,
|
|
unknown,
|
|
_uppercase as uppercase,
|
|
url,
|
|
util_exports as util,
|
|
uuid,
|
|
uuidv4,
|
|
uuidv6,
|
|
uuidv7,
|
|
_void2 as void,
|
|
xid,
|
|
xor,
|
|
external_exports as z
|
|
};
|
|
//# sourceMappingURL=zod.js.map
|