@oxog/vld 2.4.0 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +165 -1
- package/README.md +113 -1
- package/dist/chunks/errors-core-BU14-Dk8.js +1 -0
- package/dist/cjs/chunks/errors-core-C0mA6tfa.cjs +1 -0
- package/dist/cjs/cli/bin.cjs +1 -1
- package/dist/cjs/codecs/index.cjs +1 -1
- package/dist/cjs/coercion/index.cjs +1 -1
- package/dist/cjs/compile.cjs +1 -1
- package/dist/cjs/errors.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locales/af.cjs +1 -1
- package/dist/cjs/locales/ar.cjs +1 -1
- package/dist/cjs/locales/bn.cjs +1 -1
- package/dist/cjs/locales/da.cjs +1 -1
- package/dist/cjs/locales/de.cjs +1 -1
- package/dist/cjs/locales/en.cjs +1 -1
- package/dist/cjs/locales/es-MX.cjs +1 -1
- package/dist/cjs/locales/es.cjs +1 -1
- package/dist/cjs/locales/fi.cjs +1 -1
- package/dist/cjs/locales/fr.cjs +1 -1
- package/dist/cjs/locales/gu.cjs +1 -1
- package/dist/cjs/locales/hi.cjs +1 -1
- package/dist/cjs/locales/id.cjs +1 -1
- package/dist/cjs/locales/it.cjs +1 -1
- package/dist/cjs/locales/ja.cjs +1 -1
- package/dist/cjs/locales/kn.cjs +1 -1
- package/dist/cjs/locales/ko.cjs +1 -1
- package/dist/cjs/locales/ne.cjs +1 -1
- package/dist/cjs/locales/nl.cjs +1 -1
- package/dist/cjs/locales/no.cjs +1 -1
- package/dist/cjs/locales/pl.cjs +1 -1
- package/dist/cjs/locales/pt-BR-v4.cjs +1 -1
- package/dist/cjs/locales/pt-BR.cjs +1 -1
- package/dist/cjs/locales/pt.cjs +1 -1
- package/dist/cjs/locales/ru.cjs +1 -1
- package/dist/cjs/locales/sk.cjs +1 -1
- package/dist/cjs/locales/sv.cjs +1 -1
- package/dist/cjs/locales/sw.cjs +1 -1
- package/dist/cjs/locales/th.cjs +1 -1
- package/dist/cjs/locales/tr.cjs +1 -1
- package/dist/cjs/locales/vi.cjs +1 -1
- package/dist/cjs/locales/zh.cjs +1 -1
- package/dist/cjs/mini.cjs +1 -1
- package/dist/cjs/v3/index.cjs +1 -1
- package/dist/cjs/v4/core/index.cjs +1 -1
- package/dist/cjs/v4/index.cjs +1 -1
- package/dist/cjs/v4/mini/index.cjs +1 -1
- package/dist/cjs/v4-mini/index.cjs +1 -1
- package/dist/cjs/validators/any.cjs +1 -1
- package/dist/cjs/validators/array-v2.cjs +1 -0
- package/dist/cjs/validators/array.cjs +1 -1
- package/dist/cjs/validators/base.cjs +1 -1
- package/dist/cjs/validators/base64.cjs +1 -1
- package/dist/cjs/validators/bigint-v2.cjs +1 -0
- package/dist/cjs/validators/bigint.cjs +1 -1
- package/dist/cjs/validators/boolean.cjs +1 -1
- package/dist/cjs/validators/codec.cjs +1 -1
- package/dist/cjs/validators/composite-v2.cjs +1 -0
- package/dist/cjs/validators/custom.cjs +1 -1
- package/dist/cjs/validators/date-v2.cjs +1 -0
- package/dist/cjs/validators/date.cjs +1 -1
- package/dist/cjs/validators/discriminated-union.cjs +1 -1
- package/dist/cjs/validators/enum.cjs +1 -1
- package/dist/cjs/validators/file.cjs +1 -1
- package/dist/cjs/validators/function.cjs +1 -1
- package/dist/cjs/validators/hex.cjs +1 -1
- package/dist/cjs/validators/index.cjs +1 -1
- package/dist/cjs/validators/intersection.cjs +1 -1
- package/dist/cjs/validators/json.cjs +1 -1
- package/dist/cjs/validators/lazy.cjs +1 -1
- package/dist/cjs/validators/leaf-v2.cjs +1 -0
- package/dist/cjs/validators/literal.cjs +1 -1
- package/dist/cjs/validators/map.cjs +1 -1
- package/dist/cjs/validators/nan.cjs +1 -1
- package/dist/cjs/validators/never.cjs +1 -1
- package/dist/cjs/validators/null.cjs +1 -1
- package/dist/cjs/validators/number-v2.cjs +1 -0
- package/dist/cjs/validators/number.cjs +1 -1
- package/dist/cjs/validators/object-v2.cjs +1 -0
- package/dist/cjs/validators/object.cjs +1 -1
- package/dist/cjs/validators/promise.cjs +1 -1
- package/dist/cjs/validators/record.cjs +1 -1
- package/dist/cjs/validators/set.cjs +1 -1
- package/dist/cjs/validators/string-bool.cjs +1 -1
- package/dist/cjs/validators/string-formats.cjs +1 -1
- package/dist/cjs/validators/string-v2.cjs +1 -0
- package/dist/cjs/validators/string.cjs +1 -1
- package/dist/cjs/validators/symbol.cjs +1 -1
- package/dist/cjs/validators/template-literal.cjs +1 -1
- package/dist/cjs/validators/tuple.cjs +1 -1
- package/dist/cjs/validators/uint8array.cjs +1 -1
- package/dist/cjs/validators/undefined.cjs +1 -1
- package/dist/cjs/validators/union-v2.cjs +1 -0
- package/dist/cjs/validators/union.cjs +1 -1
- package/dist/cjs/validators/unknown.cjs +1 -1
- package/dist/cjs/validators/void.cjs +1 -1
- package/dist/cjs/validators/wrapper-v2.cjs +1 -0
- package/dist/cjs/validators/xor.cjs +1 -1
- package/dist/errors-core.d.ts +3 -0
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +168 -12
- package/dist/index.js +1 -1
- package/dist/locales/af.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/bn.js +1 -1
- package/dist/locales/da.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/en.js +1 -1
- package/dist/locales/es-MX.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fi.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/gu.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/kn.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/ne.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/no.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt-BR-v4.js +1 -1
- package/dist/locales/pt-BR.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/sk.js +1 -1
- package/dist/locales/sv.js +1 -1
- package/dist/locales/sw.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/types.d.ts +1 -0
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh.js +1 -1
- package/dist/v3/index.js +1 -1
- package/dist/v4/core/index.js +1 -1
- package/dist/v4/index.js +1 -1
- package/dist/v4/mini/index.js +1 -1
- package/dist/v4-mini/index.js +1 -1
- package/dist/validators/array-v2.d.ts +113 -0
- package/dist/validators/array-v2.js +1 -0
- package/dist/validators/array.js +1 -1
- package/dist/validators/base.js +1 -1
- package/dist/validators/base64.js +1 -1
- package/dist/validators/bigint-v2.d.ts +105 -0
- package/dist/validators/bigint-v2.js +1 -0
- package/dist/validators/bigint.js +1 -1
- package/dist/validators/boolean.js +1 -1
- package/dist/validators/codec.js +1 -1
- package/dist/validators/composite-v2.d.ts +59 -0
- package/dist/validators/composite-v2.js +1 -0
- package/dist/validators/date-v2.d.ts +140 -0
- package/dist/validators/date-v2.js +1 -0
- package/dist/validators/date.js +1 -1
- package/dist/validators/enum.js +1 -1
- package/dist/validators/file.js +1 -1
- package/dist/validators/function.js +1 -1
- package/dist/validators/hex.js +1 -1
- package/dist/validators/intersection.js +1 -1
- package/dist/validators/leaf-v2.d.ts +138 -0
- package/dist/validators/leaf-v2.js +1 -0
- package/dist/validators/literal.js +1 -1
- package/dist/validators/map.js +1 -1
- package/dist/validators/nan.js +1 -1
- package/dist/validators/never.js +1 -1
- package/dist/validators/null.js +1 -1
- package/dist/validators/number-v2.d.ts +252 -0
- package/dist/validators/number-v2.js +1 -0
- package/dist/validators/number.js +1 -1
- package/dist/validators/object-v2.d.ts +40 -0
- package/dist/validators/object-v2.js +1 -0
- package/dist/validators/object.js +1 -1
- package/dist/validators/record.js +1 -1
- package/dist/validators/set.js +1 -1
- package/dist/validators/string-formats.js +1 -1
- package/dist/validators/string-v2.d.ts +274 -0
- package/dist/validators/string-v2.js +1 -0
- package/dist/validators/string.js +1 -1
- package/dist/validators/symbol.js +1 -1
- package/dist/validators/tuple.js +1 -1
- package/dist/validators/uint8array.js +1 -1
- package/dist/validators/undefined.js +1 -1
- package/dist/validators/union-v2.d.ts +28 -0
- package/dist/validators/union-v2.js +1 -0
- package/dist/validators/void.js +1 -1
- package/dist/validators/wrapper-v2.d.ts +74 -0
- package/dist/validators/wrapper-v2.js +1 -0
- package/dist/zod-error.d.ts +84 -0
- package/package.json +1 -1
- package/dist/chunks/errors-core-CerMg2rq.js +0 -1
- package/dist/cjs/chunks/errors-core-DrydF46s.cjs +0 -1
package/dist/v4/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{base64 as Z,base64url as S,cidrv4 as $,cidrv6 as F,coerce as I,cuid as T,cuid2 as U,decode as D,decodeAsync as E,e164 as L,email as N,emoji as P,encode as O,encodeAsync as R,endsWith as M,float32 as J,float64 as K,guid as X,includes as _,int as G,int32 as H,int64 as W,ipv4 as Q,ipv6 as Y,iso as oo,jwt as ao,ksuid as ro,length as so,lowercase as eo,mac as to,maxLength as lo,maxSize as no,mime as io,minLength as mo,minSize as co,multipleOf as po,nanoid as Vo,negative as Zo,nonnegative as uo,nonpositive as go,normalize as fo,parse as yo,parseAsync as So,positive as xo,regex as $o,safeDecode as Fo,safeDecodeAsync as vo,safeEncode as jo,safeEncodeAsync as bo,safeParse as Io,safeParseAsync as To,size as ho,slugify as Co,startsWith as Uo,stringFormat as Do,toLowerCase as Eo,toUpperCase as Lo,trim as Bo,uint32 as No,uint64 as Po,ulid as Ao,uppercase as Oo,url as Ro,uuid as wo,uuidv4 as zo,uuidv6 as ko,uuidv7 as Mo,xid as Jo,toJSONSchema as Ko,any as Xo,array as _o,bigint as Go,boolean as Ho,catch as Wo,check as qo,codec as Qo,creditCard as Yo,custom as oa,date as aa,discriminatedUnion as ra,enum as sa,nativeEnum as ea,file as ta,_function as da,number as la,intersection as na,lazy as ia,literal as ma,map as ca,nan as pa,never as Va,nonoptional as Za,null as ua,nullable as ga,object as fa,optional as ya,overwrite as Sa,pipe as xa,promise as $a,property as Fa,readonly as va,record as ja,refine as ba,set as Ia,string as Ta,stringbool as ha,superRefine as Ca,symbol as Ua,templateLiteral as Da,transform as Ea,tuple as La,undefined as Ba,union as Na,unknown as Pa,void as Aa,xor as Oa}from"../../index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,_ZodString,base64Bytes,clone,config,core,createLogger,createNoOpLogger,deepPartial,core as default,describe,disableLogging,enableDebug,exactOptional,formatError,fromJSONSchema,getErrorMap,getLogger,gt,gte,hash,hex,hexBytes,hostname,httpUrl,initLogger,input,instanceof,json,keyof,locales,looseObject,looseRecord,lt,lte,mapSchema,meta,nullish,output,partialRecord,prefault,preprocess,regexes,setErrorMap,setLogLevel,strictObject,uint8Array,util,default as v,z}from"../../index.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../../errors.js";export{VldCatch as $ZodCatch,VldDefault as $ZodDefault,VldExactOptional as $ZodExactOptional,VldRefine as $ZodNonOptional,VldNullable as $ZodNullable,VldOptional as $ZodOptional,VldPipe as $ZodPipe,VldPrefault as $ZodPrefault,VldPreprocess as $ZodPreprocess,VldReadonly as $ZodReadonly,VldTransform as $ZodTransform,VldBase as $ZodType,VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../../validators/base.js";export{VldString as $ZodString,VldString as ZodString}from"../../validators/string.js";export{VldNumber as $ZodNumber,VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../../validators/number.js";export{VldBoolean as $ZodBoolean,VldBoolean as ZodBoolean}from"../../validators/boolean.js";export{VldBigInt as $ZodBigInt,VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat}from"../../validators/bigint.js";export{VldSymbol as $ZodSymbol,VldSymbol as ZodSymbol}from"../../validators/symbol.js";export{VldUndefined as $ZodUndefined,VldUndefined as ZodUndefined}from"../../validators/undefined.js";export{VldNull as $ZodNull,VldNull as ZodNull}from"../../validators/null.js";export{VldAny as $ZodAny,VldAny as ZodAny}from"../../validators/any.js";export{VldUnknown as $ZodUnknown,VldUnknown as ZodUnknown}from"../../validators/unknown.js";export{VldNever as $ZodNever,VldNever as ZodNever}from"../../validators/never.js";export{VldVoid as $ZodVoid,VldVoid as ZodVoid}from"../../validators/void.js";export{VldDate as $ZodDate,VldDate as ZodDate}from"../../validators/date.js";export{VldArray as $ZodArray,VldArray as ZodArray}from"../../validators/array.js";import{VldObject as Ra}from"../../validators/object.js";export{VldUnion as $ZodUnion,VldUnion as ZodUnion}from"../../validators/union.js";export{VldIntersection as $ZodIntersection,VldIntersection,VldIntersection as ZodIntersection}from"../../validators/intersection.js";export{VldTuple as $ZodTuple,VldTuple as ZodTuple}from"../../validators/tuple.js";export{VldRecord as $ZodRecord,VldRecord as ZodRecord}from"../../validators/record.js";export{VldMap as $ZodMap,VldMap as ZodMap}from"../../validators/map.js";export{VldSet as $ZodSet,VldSet as ZodSet}from"../../validators/set.js";export{VldEnum as $ZodEnum,VldEnum as ZodEnum}from"../../validators/enum.js";export{VldLiteral as $ZodLiteral,VldLiteral as ZodLiteral}from"../../validators/literal.js";export{VldFile as $ZodFile,VldFile as ZodFile}from"../../validators/file.js";export{VldLazy as $ZodLazy,VldLazy as ZodLazy}from"../../validators/lazy.js";export{VldPromise as $ZodPromise,VldPromise as ZodPromise}from"../../validators/promise.js";export{VldCustom as $ZodCustom,VldCustom as ZodCustom,VldCustom as ZodSuccess}from"../../validators/custom.js";export{VldBase64 as $ZodBase64,VldBase64 as $ZodBase64URL}from"../../validators/base64.js";export{VldCodec as $ZodCodec,VldCodec as ZodCodec}from"../../validators/codec.js";export{VldDiscriminatedUnion as $ZodDiscriminatedUnion,VldDiscriminatedUnion as ZodDiscriminatedUnion}from"../../validators/discriminated-union.js";export{VldFunction as $ZodFunction,VldFunction as ZodFunction}from"../../validators/function.js";export{VldJson as $ZodSuccess,VldJson as ZodJSON}from"../../validators/json.js";export{VldNan as $ZodNaN,VldNan as ZodNaN}from"../../validators/nan.js";export{VldTemplateLiteral as $ZodTemplateLiteral,VldTemplateLiteral as ZodTemplateLiteral}from"../../validators/template-literal.js";export{VldXor as $ZodXor,VldXor as ZodXor}from"../../validators/xor.js";export{VldStringFormat as $ZodBigIntFormat,VldStringFormat as $ZodCIDRv4,VldStringFormat as $ZodCIDRv6,VldStringFormat as $ZodCUID,VldStringFormat as $ZodCUID2,VldStringFormat as $ZodCreditCard,VldStringFormat as $ZodCustomStringFormat,VldStringFormat as $ZodE164,VldStringFormat as $ZodEmail,VldStringFormat as $ZodEmoji,VldStringFormat as $ZodGUID,VldStringFormat as $ZodIPv4,VldStringFormat as $ZodIPv6,VldStringFormat as $ZodISODate,VldStringFormat as $ZodISODateTime,VldStringFormat as $ZodISODuration,VldStringFormat as $ZodISOTime,VldStringFormat as $ZodJWT,VldStringFormat as $ZodKSUID,VldStringFormat as $ZodMAC,VldStringFormat as $ZodNanoID,VldStringFormat as $ZodNumberFormat,VldStringFormat as $ZodStringFormat,VldStringFormat as $ZodULID,VldStringFormat as $ZodURL,VldStringFormat as $ZodUUID,VldStringFormat as $ZodXID,VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID,isValidCreditCard}from"../../validators/string-formats.js";export{registry as $ZodRegistry,globalRegistry,registry}from"../../registry.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,properties as _properties,applyCompiled,compile,compileFn,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../../compile.js";import{success as wa}from"../../compat/result.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../../compat/result.js";export{V as $ZodError,V as $ZodRealError,V as VldError,V as ZodError,V as ZodRealError}from"../../chunks/errors-core-CerMg2rq.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../../kernel.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../../locales/runtime.js";export{s as setLocaleAsync}from"../../chunks/index-CKPStM3V.js";const za=o=>"string"==typeof o?o:o?.message||o?.error,ka=o=>"function"==typeof o[0]&&o.length>1,Ma=(o,a=0)=>o[ka(o)?a+1:a],Ja=(o,a=0)=>o[ka(o)?a+1:a],Ka=(o,a=0)=>{const r=Ja(o,a);return Array.isArray(r)?r:o.slice(a)},Xa=o=>()=>{throw new Error(`${o} is an internal Zod core compatibility placeholder`)};class _a extends Error{}class Ga extends Error{}class Ha{}class Wa extends Ha{}class qa extends Ha{}class Qa extends Ha{}class Ya extends Ha{}class or extends Ha{}class ar extends Ha{}class rr extends Ha{}class sr extends Ha{}class er extends Ha{}class tr extends Ha{}class dr extends Ha{}class lr extends Ha{}class nr extends Ha{}class ir extends Ha{}class mr extends Ha{}class cr extends Ha{}class pr extends Ha{}class Vr extends Ha{}class Zr extends Ha{}class ur extends Ha{}class gr extends Ha{}const fr=Ra;class yr{}const Sr={};class xr{}const $r={},Fr={major:4,minor:4,patch:3},vr=(o,a)=>{var r;return(r=class{constructor(o){Object.defineProperty(this,"_zod",{value:{def:o},enumerable:!1}),a?.(this,o)}}).displayName=o,r},jr=yo,br=(...o)=>{const a=Ma(o),r=Ja(o,1);return a.default("function"==typeof r?r():r)},Ir=Io,Tr=So,hr=To,Cr=O,Ur=jo,Dr=D,Er=Fo,Lr=R,Br=bo,Nr=E,Pr=vo,Ar=(...o)=>Ta(),Or=(...o)=>la(),Rr=(...o)=>Ho(),wr=(...o)=>Go(),zr=(...o)=>Ua(),kr=(...o)=>Ba(),Mr=(...o)=>ua(),Jr=(...o)=>Xo(),Kr=(...o)=>Pa(),Xr=(...o)=>Va(),_r=(...o)=>Aa(),Gr=(...o)=>aa(),Hr=(...o)=>_o(Ma(o)),Wr=(...o)=>fa(Ja(o)),qr=(...o)=>Na(...Ka(o)),Qr=(...o)=>na(Ma(o),Ma(o,1)),Yr=(...o)=>La(...Ka(o)),os=(...o)=>ja(Ma(o,ka(o)?1:0)),as=(...o)=>ca(Ma(o),Ma(o,1)),rs=(...o)=>Ia(Ma(o)),ss=(...o)=>{const a=Ja(o);return Array.isArray(a)?sa(...a):ea(a)},es=(...o)=>ea(Ja(o)),ts=(...o)=>ma(Ja(o)),ds=(...o)=>ta(),ls=(...o)=>ia(Ja(o)),ns=(...o)=>$a(Ma(o)),is=(...o)=>ya(Ma(o)),ms=(...o)=>ga(Ma(o)),cs=(...o)=>Za(Ma(o)),ps=(...o)=>va(Ma(o)),Vs=(...o)=>Da(...Ka(o)),Zs=(...o)=>ha(Ja(o)),us=(...o)=>pa(),gs=N,fs=X,ys=wo,Ss=zo,xs=ko,$s=Mo,Fs=Ro,vs=P,js=Vo,bs=T,Is=U,Ts=Ao,hs=Jo,Cs=ro,Us=Q,Ds=Y,Es=$,Ls=F,Bs=Z,Ns=S,Ps=L,As=ao,Os=oo.dateTime,Rs=oo.date,ws=oo.time,zs=oo.duration,ks=to,Ms=io,Js=Do,Ks=(o,a)=>la().min(o,za(a)),Xs=(o,a)=>la().max(o,za(a)),_s=(o,a)=>la().gt(o,za(a)),Gs=(o,a)=>la().gte(o,za(a)),Hs=(o,a)=>la().lt(o,za(a)),Ws=(o,a)=>la().lte(o,za(a)),qs=G,Qs=H,Ys=No,oe=W,ae=Po,re=J,se=K,ee=xo,te=Zo,de=go,le=uo,ne=po,ie=mo,me=lo,ce=so,pe=ho,Ve=co,Ze=no,ue=$o,ge=Uo,fe=M,ye=_,Se=eo,xe=Oo,$e=Bo,Fe=fo,ve=Co,je=Eo,be=Lo,Ie=(...o)=>qo(Ja(o)),Te=(...o)=>oa(Ja(o)),he=(...o)=>ba(Ja(o),Ja(o,1)),Ce=(...o)=>Ca(Ma(o),Ja(o,1)),Ue=(...o)=>Ea(Ja(o)),De=(...o)=>Sa(Ja(o)),Ee=(...o)=>xa(Ma(o),Ma(o,1)),Le=(...o)=>Wo(Ma(o),Ja(o,1)),Be=(...o)=>wa(Ja(o)),Ne=(...o)=>Fa(Ja(o),Ma(o,1),Ja(o,2)),Pe=I.string,Ae=I.number,Oe=I.boolean,Re=I.bigint,we=I.date,ze=(...o)=>Qo(Ma(o),Ma(o,1),Ja(o,2)),ke=(...o)=>da(),Me=(...o)=>ra(Ja(o),...Ka(o,1)),Je=(...o)=>Oa(...Ka(o)),Ke=()=>Ko,Xe=()=>Ko,_e=()=>({}),Ge=o=>o,He=()=>({}),We=o=>o,qe=o=>o.map(String).join("."),Qe=o=>Z().safeParse(o).success,Ye=o=>S().safeParse(o).success,ot=o=>ao().safeParse(o).success,at=(...o)=>Yo(Ja(o)),rt=o=>{const a=o;if(a&&"object"==typeof a["~standard"]&&null!==a["~standard"])return a["~standard"];const r=o;if("function"!=typeof r?.safeParse)throw new TypeError("standardProps expects a VLD schema");return{validate:o=>{const a=r.safeParse(o);return a.success?{value:a.data}:{issues:[{message:a.error?.message??"Invalid input"}]}},vendor:"vld",version:1}},st=(o,a,r,s,e)=>{const t="function"==typeof a.unrepresentable?a.unrepresentable({zodSchema:o,path:s.path,message:e}):a.unrepresentable;if("any"===t)return!1;if(void 0===t||"throw"===t)throw new Error(e);return Object.assign(r,{...t}),!0},et=Xa("_checkInternal"),tt=Xa("$ZodCyclicError"),dt=Xa("attachMemoizer"),nt=Xa("isBackEdge"),it=o=>!(!o||"object"!=typeof o)&&"ZodLazy"===o._def?.typeName,mt=1,ct=2,pt=Symbol.for("zod.compile.invalid"),Vt=o=>Y().safeParse(o).success,Zt=o=>F().safeParse(o).success,ut=o=>/^[A-Za-z0-9.-]+$/.test(o),ft=o=>/^[a-z][a-z0-9+\-.]*$/i.test(o),yt=o=>{try{return new URL(o)}catch{return null}},St=o=>o.replace(/[\t\n\r]/g,""),xt=(o,a)=>Array.isArray(o)&&Array.isArray(a)?[...o,...a]:o&&a&&"object"==typeof o&&"object"==typeof a?{...o,...a}:a;export{_a as $ZodAsyncError,Ha as $ZodCheck,Wa as $ZodCheckBigIntFormat,qa as $ZodCheckEndsWith,Qa as $ZodCheckGreaterThan,Ya as $ZodCheckIncludes,or as $ZodCheckLengthEquals,ar as $ZodCheckLessThan,rr as $ZodCheckLowerCase,sr as $ZodCheckMaxLength,er as $ZodCheckMaxSize,tr as $ZodCheckMimeType,dr as $ZodCheckMinLength,lr as $ZodCheckMinSize,nr as $ZodCheckMultipleOf,ir as $ZodCheckNumberFormat,mr as $ZodCheckOverwrite,cr as $ZodCheckProperty,pr as $ZodCheckRegex,Vr as $ZodCheckSizeEquals,Zr as $ZodCheckStartsWith,ur as $ZodCheckStringFormat,gr as $ZodCheckUpperCase,tt as $ZodCyclicError,Ga as $ZodEncodeError,Ra as $ZodObject,fr as $ZodObjectJIT,vr as $constructor,yr as Doc,pt as INVALID,Sr as JSONSchema,xr as JSONSchemaGenerator,mt as URL_BAD_FORMAT,ct as URL_UNPARSEABLE,Ra as ZodObject,Jr as _any,Hr as _array,Bs as _base64,Ns as _base64url,wr as _bigint,Rr as _boolean,Le as _catch,Ie as _check,et as _checkInternal,Es as _cidrv4,Ls as _cidrv6,ze as _codec,Re as _coercedBigint,Oe as _coercedBoolean,we as _coercedDate,Ae as _coercedNumber,Pe as _coercedString,at as _creditCard,bs as _cuid,Is as _cuid2,Te as _custom,Gr as _date,Dr as _decode,Nr as _decodeAsync,br as _default,Me as _discriminatedUnion,Ps as _e164,gs as _email,vs as _emoji,Cr as _encode,Lr as _encodeAsync,fe as _endsWith,ss as _enum,ds as _file,re as _float32,se as _float64,ke as _function,_s as _gt,Gs as _gte,fs as _guid,ye as _includes,qs as _int,Qs as _int32,oe as _int64,Qr as _intersection,Us as _ipv4,Ds as _ipv6,Rs as _isoDate,Os as _isoDateTime,zs as _isoDuration,ws as _isoTime,As as _jwt,Cs as _ksuid,ls as _lazy,ce as _length,ts as _literal,Se as _lowercase,Hs as _lt,Ws as _lte,ks as _mac,as as _map,Xs as _max,me as _maxLength,Ze as _maxSize,Ms as _mime,Ks as _min,ie as _minLength,Ve as _minSize,ne as _multipleOf,us as _nan,js as _nanoid,es as _nativeEnum,te as _negative,Xr as _never,le as _nonnegative,cs as _nonoptional,de as _nonpositive,Fe as _normalize,Mr as _null,ms as _nullable,Or as _number,Wr as _object,is as _optional,De as _overwrite,jr as _parse,Tr as _parseAsync,Ee as _pipe,ee as _positive,ns as _promise,Ne as _property,ps as _readonly,os as _record,he as _refine,ue as _regex,Er as _safeDecode,Pr as _safeDecodeAsync,Ur as _safeEncode,Br as _safeEncodeAsync,Ir as _safeParse,hr as _safeParseAsync,rs as _set,pe as _size,ve as _slugify,ge as _startsWith,Ar as _string,Js as _stringFormat,Zs as _stringbool,Be as _success,Ce as _superRefine,zr as _symbol,Vs as _templateLiteral,je as _toLowerCase,be as _toUpperCase,Ue as _transform,$e as _trim,Yr as _tuple,Ys as _uint32,ae as _uint64,Ts as _ulid,kr as _undefined,qr as _union,Kr as _unknown,xe as _uppercase,Fs as _url,ys as _uuid,Ss as _uuidv4,xs as _uuidv6,$s as _uuidv7,_r as _void,hs as _xid,Je as _xor,Xo as any,_o as array,dt as attachMemoizer,Z as base64,S as base64url,Go as bigint,Ho as boolean,Wo as catch,qo as check,$ as cidrv4,F as cidrv6,Qo as codec,I as coerce,Xe as createStandardJSONSchemaMethod,Ke as createToJSONSchemaMethod,Yo as creditCard,T as cuid,U as cuid2,oa as custom,aa as date,D as decode,E as decodeAsync,ra as discriminatedUnion,L as e164,N as email,P as emoji,O as encode,R as encodeAsync,M as endsWith,sa as enum,_e as extractDefs,ta as file,Ge as finalize,J as float32,K as float64,da as function,$r as globalConfig,X as guid,st as handleUnrepresentable,_ as includes,He as initializeContext,G as int,H as int32,W as int64,na as intersection,Q as ipv4,Y as ipv6,nt as isBackEdge,it as isRecursiveSchema,Qe as isValidBase64,Ye as isValidBase64URL,Zt as isValidCIDRv6,Vt as isValidIPv6,ot as isValidJWT,oo as iso,ao as jwt,ro as ksuid,ia as lazy,so as length,ma as literal,eo as lowercase,to as mac,ca as map,lo as maxLength,no as maxSize,xt as mergeValues,io as mime,mo as minLength,co as minSize,po as multipleOf,pa as nan,Vo as nanoid,ea as nativeEnum,Zo as negative,Va as never,uo as nonnegative,Za as nonoptional,go as nonpositive,fo as normalize,ua as null,ga as nullable,la as number,fa as object,ya as optional,Sa as overwrite,yo as parse,So as parseAsync,yt as parseURLObject,xa as pipe,xo as positive,We as process,$a as promise,Fa as property,va as readonly,ja as record,ba as refine,$o as regex,Fo as safeDecode,vo as safeDecodeAsync,jo as safeEncode,bo as safeEncodeAsync,Io as safeParse,To as safeParseAsync,Ia as set,ho as size,Co as slugify,rt as standardProps,Uo as startsWith,Ta as string,Do as stringFormat,ha as stringbool,St as stripTabAndNewline,wa as success,Ca as superRefine,Ua as symbol,Da as templateLiteral,qe as toDotPath,Ko as toJSONSchema,Eo as toLowerCase,Lo as toUpperCase,Ea as transform,Bo as trim,La as tuple,No as uint32,Po as uint64,Ao as ulid,Ba as undefined,Na as union,Pa as unknown,Oo as uppercase,Ro as url,ut as urlHostnameOk,ft as urlProtocolOk,wo as uuid,zo as uuidv4,ko as uuidv6,Mo as uuidv7,Fr as version,Aa as void,Jo as xid,Oa as xor};
|
|
1
|
+
import{base64 as Z,base64url as S,cidrv4 as $,cidrv6 as F,coerce as I,cuid as T,cuid2 as E,decode as U,decodeAsync as D,e164 as L,email as N,emoji as P,encode as O,encodeAsync as R,endsWith as M,float32 as J,float64 as K,guid as X,includes as _,int as G,int32 as H,int64 as W,ipv4 as Q,ipv6 as Y,iso as oo,jwt as ao,ksuid as ro,length as eo,lowercase as so,mac as to,maxLength as lo,maxSize as no,mime as io,minLength as mo,minSize as co,multipleOf as po,nanoid as Zo,negative as Vo,nonnegative as uo,nonpositive as go,normalize as fo,parse as yo,parseAsync as So,positive as xo,regex as $o,safeDecode as Fo,safeDecodeAsync as vo,safeEncode as jo,safeEncodeAsync as bo,safeParse as Io,safeParseAsync as To,size as ho,slugify as Eo,startsWith as Co,stringFormat as Uo,toLowerCase as Do,toUpperCase as Lo,trim as Bo,uint32 as No,uint64 as Po,ulid as Ao,uppercase as Oo,url as Ro,uuid as wo,uuidv4 as zo,uuidv6 as ko,uuidv7 as Mo,xid as Jo,toJSONSchema as Ko,any as Xo,array as _o,bigint as Go,boolean as Ho,catch as Wo,check as qo,codec as Qo,creditCard as Yo,custom as oa,date as aa,discriminatedUnion as ra,enum as ea,nativeEnum as sa,file as ta,_function as da,number as la,intersection as na,lazy as ia,literal as ma,map as ca,nan as pa,never as Za,nonoptional as Va,null as ua,nullable as ga,object as fa,optional as ya,overwrite as Sa,pipe as xa,promise as $a,property as Fa,readonly as va,record as ja,refine as ba,set as Ia,string as Ta,stringbool as ha,superRefine as Ea,symbol as Ca,templateLiteral as Ua,transform as Da,tuple as La,undefined as Ba,union as Na,unknown as Pa,void as Aa,xor as Oa}from"../../index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,ZodLikeError,_ZodString,base64Bytes,clone,config,core,createLogger,createNoOpLogger,deepPartial,core as default,describe,disableLogging,enableDebug,exactOptional,formatError,fromJSONSchema,getErrorMap,getLogger,gt,gte,hash,hex,hexBytes,hostname,httpUrl,initLogger,input,instanceof,json,keyof,locales,looseObject,looseRecord,lt,lte,mapSchema,meta,nullish,output,partialRecord,prefault,preprocess,regexes,setErrorMap,setLogLevel,strictObject,toZodError,toZodSafeResult,uint8Array,util,default as v,vV2,z}from"../../index.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../../errors.js";export{VldCatch as $ZodCatch,VldDefault as $ZodDefault,VldExactOptional as $ZodExactOptional,VldRefine as $ZodNonOptional,VldNullable as $ZodNullable,VldOptional as $ZodOptional,VldPipe as $ZodPipe,VldPrefault as $ZodPrefault,VldPreprocess as $ZodPreprocess,VldReadonly as $ZodReadonly,VldTransform as $ZodTransform,VldBase as $ZodType,VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../../validators/base.js";export{VldString as $ZodString,VldString as ZodString}from"../../validators/string.js";export{VldNumber as $ZodNumber,VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../../validators/number.js";export{VldBoolean as $ZodBoolean,VldBoolean as ZodBoolean}from"../../validators/boolean.js";export{VldBigInt as $ZodBigInt,VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat}from"../../validators/bigint.js";export{VldSymbol as $ZodSymbol,VldSymbol as ZodSymbol}from"../../validators/symbol.js";export{VldUndefined as $ZodUndefined,VldUndefined as ZodUndefined}from"../../validators/undefined.js";export{VldNull as $ZodNull,VldNull as ZodNull}from"../../validators/null.js";export{VldAny as $ZodAny,VldAny as ZodAny}from"../../validators/any.js";export{VldUnknown as $ZodUnknown,VldUnknown as ZodUnknown}from"../../validators/unknown.js";export{VldNever as $ZodNever,VldNever as ZodNever}from"../../validators/never.js";export{VldVoid as $ZodVoid,VldVoid as ZodVoid}from"../../validators/void.js";export{VldDate as $ZodDate,VldDate as ZodDate}from"../../validators/date.js";export{VldArray as $ZodArray,VldArray as ZodArray}from"../../validators/array.js";import{VldObject as Ra}from"../../validators/object.js";export{VldUnion as $ZodUnion,VldUnion as ZodUnion}from"../../validators/union.js";export{VldIntersection as $ZodIntersection,VldIntersection,VldIntersection as ZodIntersection}from"../../validators/intersection.js";export{VldTuple as $ZodTuple,VldTuple as ZodTuple}from"../../validators/tuple.js";export{VldRecord as $ZodRecord,VldRecord as ZodRecord}from"../../validators/record.js";export{VldMap as $ZodMap,VldMap as ZodMap}from"../../validators/map.js";export{VldSet as $ZodSet,VldSet as ZodSet}from"../../validators/set.js";export{VldEnum as $ZodEnum,VldEnum as ZodEnum}from"../../validators/enum.js";export{VldLiteral as $ZodLiteral,VldLiteral as ZodLiteral}from"../../validators/literal.js";export{VldFile as $ZodFile,VldFile as ZodFile}from"../../validators/file.js";export{VldLazy as $ZodLazy,VldLazy as ZodLazy}from"../../validators/lazy.js";export{VldPromise as $ZodPromise,VldPromise as ZodPromise}from"../../validators/promise.js";export{VldCustom as $ZodCustom,VldCustom as ZodCustom,VldCustom as ZodSuccess}from"../../validators/custom.js";export{VldBase64 as $ZodBase64,VldBase64 as $ZodBase64URL}from"../../validators/base64.js";export{VldCodec as $ZodCodec,VldCodec as ZodCodec}from"../../validators/codec.js";export{VldDiscriminatedUnion as $ZodDiscriminatedUnion,VldDiscriminatedUnion as ZodDiscriminatedUnion}from"../../validators/discriminated-union.js";export{VldFunction as $ZodFunction,VldFunction as ZodFunction}from"../../validators/function.js";export{VldJson as $ZodSuccess,VldJson as ZodJSON}from"../../validators/json.js";export{VldNan as $ZodNaN,VldNan as ZodNaN}from"../../validators/nan.js";export{VldTemplateLiteral as $ZodTemplateLiteral,VldTemplateLiteral as ZodTemplateLiteral}from"../../validators/template-literal.js";export{VldXor as $ZodXor,VldXor as ZodXor}from"../../validators/xor.js";export{VldStringFormat as $ZodBigIntFormat,VldStringFormat as $ZodCIDRv4,VldStringFormat as $ZodCIDRv6,VldStringFormat as $ZodCUID,VldStringFormat as $ZodCUID2,VldStringFormat as $ZodCreditCard,VldStringFormat as $ZodCustomStringFormat,VldStringFormat as $ZodE164,VldStringFormat as $ZodEmail,VldStringFormat as $ZodEmoji,VldStringFormat as $ZodGUID,VldStringFormat as $ZodIPv4,VldStringFormat as $ZodIPv6,VldStringFormat as $ZodISODate,VldStringFormat as $ZodISODateTime,VldStringFormat as $ZodISODuration,VldStringFormat as $ZodISOTime,VldStringFormat as $ZodJWT,VldStringFormat as $ZodKSUID,VldStringFormat as $ZodMAC,VldStringFormat as $ZodNanoID,VldStringFormat as $ZodNumberFormat,VldStringFormat as $ZodStringFormat,VldStringFormat as $ZodULID,VldStringFormat as $ZodURL,VldStringFormat as $ZodUUID,VldStringFormat as $ZodXID,VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID,isValidCreditCard}from"../../validators/string-formats.js";export{registry as $ZodRegistry,globalRegistry,registry}from"../../registry.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,properties as _properties,applyCompiled,compile,compileFn,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../../compile.js";import{success as wa}from"../../compat/result.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../../compat/result.js";export{V as $ZodError,V as $ZodRealError,V as VldError,V as ZodError,V as ZodRealError}from"../../chunks/errors-core-BU14-Dk8.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../../kernel.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../../locales/runtime.js";export{s as setLocaleAsync}from"../../chunks/index-CKPStM3V.js";const za=o=>"string"==typeof o?o:o?.message||o?.error,ka=o=>"function"==typeof o[0]&&o.length>1,Ma=(o,a=0)=>o[ka(o)?a+1:a],Ja=(o,a=0)=>o[ka(o)?a+1:a],Ka=(o,a=0)=>{const r=Ja(o,a);return Array.isArray(r)?r:o.slice(a)},Xa=o=>()=>{throw new Error(`${o} is an internal Zod core compatibility placeholder`)};class _a extends Error{}class Ga extends Error{}class Ha{}class Wa extends Ha{}class qa extends Ha{}class Qa extends Ha{}class Ya extends Ha{}class or extends Ha{}class ar extends Ha{}class rr extends Ha{}class er extends Ha{}class sr extends Ha{}class tr extends Ha{}class dr extends Ha{}class lr extends Ha{}class nr extends Ha{}class ir extends Ha{}class mr extends Ha{}class cr extends Ha{}class pr extends Ha{}class Zr extends Ha{}class Vr extends Ha{}class ur extends Ha{}class gr extends Ha{}const fr=Ra;class yr{}const Sr={};class xr{}const $r={},Fr={major:4,minor:4,patch:3},vr=(o,a)=>{var r;return(r=class{constructor(o){Object.defineProperty(this,"_zod",{value:{def:o},enumerable:!1}),a?.(this,o)}}).displayName=o,r},jr=yo,br=(...o)=>{const a=Ma(o),r=Ja(o,1);return a.default("function"==typeof r?r():r)},Ir=Io,Tr=So,hr=To,Er=O,Cr=jo,Ur=U,Dr=Fo,Lr=R,Br=bo,Nr=D,Pr=vo,Ar=(...o)=>Ta(),Or=(...o)=>la(),Rr=(...o)=>Ho(),wr=(...o)=>Go(),zr=(...o)=>Ca(),kr=(...o)=>Ba(),Mr=(...o)=>ua(),Jr=(...o)=>Xo(),Kr=(...o)=>Pa(),Xr=(...o)=>Za(),_r=(...o)=>Aa(),Gr=(...o)=>aa(),Hr=(...o)=>_o(Ma(o)),Wr=(...o)=>fa(Ja(o)),qr=(...o)=>Na(...Ka(o)),Qr=(...o)=>na(Ma(o),Ma(o,1)),Yr=(...o)=>La(...Ka(o)),oe=(...o)=>ja(Ma(o,ka(o)?1:0)),ae=(...o)=>ca(Ma(o),Ma(o,1)),re=(...o)=>Ia(Ma(o)),ee=(...o)=>{const a=Ja(o);return Array.isArray(a)?ea(...a):sa(a)},se=(...o)=>sa(Ja(o)),te=(...o)=>ma(Ja(o)),de=(...o)=>ta(),le=(...o)=>ia(Ja(o)),ne=(...o)=>$a(Ma(o)),ie=(...o)=>ya(Ma(o)),me=(...o)=>ga(Ma(o)),ce=(...o)=>Va(Ma(o)),pe=(...o)=>va(Ma(o)),Ze=(...o)=>Ua(...Ka(o)),Ve=(...o)=>ha(Ja(o)),ue=(...o)=>pa(),ge=N,fe=X,ye=wo,Se=zo,xe=ko,$e=Mo,Fe=Ro,ve=P,je=Zo,be=T,Ie=E,Te=Ao,he=Jo,Ee=ro,Ce=Q,Ue=Y,De=$,Le=F,Be=Z,Ne=S,Pe=L,Ae=ao,Oe=oo.dateTime,Re=oo.date,we=oo.time,ze=oo.duration,ke=to,Me=io,Je=Uo,Ke=(o,a)=>la().min(o,za(a)),Xe=(o,a)=>la().max(o,za(a)),_e=(o,a)=>la().gt(o,za(a)),Ge=(o,a)=>la().gte(o,za(a)),He=(o,a)=>la().lt(o,za(a)),We=(o,a)=>la().lte(o,za(a)),qe=G,Qe=H,Ye=No,os=W,as=Po,rs=J,es=K,ss=xo,ts=Vo,ds=go,ls=uo,ns=po,is=mo,ms=lo,cs=eo,ps=ho,Zs=co,Vs=no,us=$o,gs=Co,fs=M,ys=_,Ss=so,xs=Oo,$s=Bo,Fs=fo,vs=Eo,js=Do,bs=Lo,Is=(...o)=>qo(Ja(o)),Ts=(...o)=>oa(Ja(o)),hs=(...o)=>ba(Ja(o),Ja(o,1)),Es=(...o)=>Ea(Ma(o),Ja(o,1)),Cs=(...o)=>Da(Ja(o)),Us=(...o)=>Sa(Ja(o)),Ds=(...o)=>xa(Ma(o),Ma(o,1)),Ls=(...o)=>Wo(Ma(o),Ja(o,1)),Bs=(...o)=>wa(Ja(o)),Ns=(...o)=>Fa(Ja(o),Ma(o,1),Ja(o,2)),Ps=I.string,As=I.number,Os=I.boolean,Rs=I.bigint,ws=I.date,zs=(...o)=>Qo(Ma(o),Ma(o,1),Ja(o,2)),ks=(...o)=>da(),Ms=(...o)=>ra(Ja(o),...Ka(o,1)),Js=(...o)=>Oa(...Ka(o)),Ks=()=>Ko,Xs=()=>Ko,_s=()=>({}),Gs=o=>o,Hs=()=>({}),Ws=o=>o,qs=o=>o.map(String).join("."),Qs=o=>Z().safeParse(o).success,Ys=o=>S().safeParse(o).success,ot=o=>ao().safeParse(o).success,at=(...o)=>Yo(Ja(o)),rt=o=>{const a=o;if(a&&"object"==typeof a["~standard"]&&null!==a["~standard"])return a["~standard"];const r=o;if("function"!=typeof r?.safeParse)throw new TypeError("standardProps expects a VLD schema");return{validate:o=>{const a=r.safeParse(o);return a.success?{value:a.data}:{issues:[{message:a.error?.message??"Invalid input"}]}},vendor:"vld",version:1}},et=(o,a,r,e,s)=>{const t="function"==typeof a.unrepresentable?a.unrepresentable({zodSchema:o,path:e.path,message:s}):a.unrepresentable;if("any"===t)return!1;if(void 0===t||"throw"===t)throw new Error(s);return Object.assign(r,{...t}),!0},st=Xa("_checkInternal"),tt=Xa("$ZodCyclicError"),dt=Xa("attachMemoizer"),nt=Xa("isBackEdge"),it=o=>!(!o||"object"!=typeof o)&&"ZodLazy"===o._def?.typeName,mt=1,ct=2,pt=Symbol.for("zod.compile.invalid"),Zt=o=>Y().safeParse(o).success,Vt=o=>F().safeParse(o).success,ut=o=>/^[A-Za-z0-9.-]+$/.test(o),ft=o=>/^[a-z][a-z0-9+\-.]*$/i.test(o),yt=o=>{try{return new URL(o)}catch{return null}},St=o=>o.replace(/[\t\n\r]/g,""),xt=(o,a)=>Array.isArray(o)&&Array.isArray(a)?[...o,...a]:o&&a&&"object"==typeof o&&"object"==typeof a?{...o,...a}:a;export{_a as $ZodAsyncError,Ha as $ZodCheck,Wa as $ZodCheckBigIntFormat,qa as $ZodCheckEndsWith,Qa as $ZodCheckGreaterThan,Ya as $ZodCheckIncludes,or as $ZodCheckLengthEquals,ar as $ZodCheckLessThan,rr as $ZodCheckLowerCase,er as $ZodCheckMaxLength,sr as $ZodCheckMaxSize,tr as $ZodCheckMimeType,dr as $ZodCheckMinLength,lr as $ZodCheckMinSize,nr as $ZodCheckMultipleOf,ir as $ZodCheckNumberFormat,mr as $ZodCheckOverwrite,cr as $ZodCheckProperty,pr as $ZodCheckRegex,Zr as $ZodCheckSizeEquals,Vr as $ZodCheckStartsWith,ur as $ZodCheckStringFormat,gr as $ZodCheckUpperCase,tt as $ZodCyclicError,Ga as $ZodEncodeError,Ra as $ZodObject,fr as $ZodObjectJIT,vr as $constructor,yr as Doc,pt as INVALID,Sr as JSONSchema,xr as JSONSchemaGenerator,mt as URL_BAD_FORMAT,ct as URL_UNPARSEABLE,Ra as ZodObject,Jr as _any,Hr as _array,Be as _base64,Ne as _base64url,wr as _bigint,Rr as _boolean,Ls as _catch,Is as _check,st as _checkInternal,De as _cidrv4,Le as _cidrv6,zs as _codec,Rs as _coercedBigint,Os as _coercedBoolean,ws as _coercedDate,As as _coercedNumber,Ps as _coercedString,at as _creditCard,be as _cuid,Ie as _cuid2,Ts as _custom,Gr as _date,Ur as _decode,Nr as _decodeAsync,br as _default,Ms as _discriminatedUnion,Pe as _e164,ge as _email,ve as _emoji,Er as _encode,Lr as _encodeAsync,fs as _endsWith,ee as _enum,de as _file,rs as _float32,es as _float64,ks as _function,_e as _gt,Ge as _gte,fe as _guid,ys as _includes,qe as _int,Qe as _int32,os as _int64,Qr as _intersection,Ce as _ipv4,Ue as _ipv6,Re as _isoDate,Oe as _isoDateTime,ze as _isoDuration,we as _isoTime,Ae as _jwt,Ee as _ksuid,le as _lazy,cs as _length,te as _literal,Ss as _lowercase,He as _lt,We as _lte,ke as _mac,ae as _map,Xe as _max,ms as _maxLength,Vs as _maxSize,Me as _mime,Ke as _min,is as _minLength,Zs as _minSize,ns as _multipleOf,ue as _nan,je as _nanoid,se as _nativeEnum,ts as _negative,Xr as _never,ls as _nonnegative,ce as _nonoptional,ds as _nonpositive,Fs as _normalize,Mr as _null,me as _nullable,Or as _number,Wr as _object,ie as _optional,Us as _overwrite,jr as _parse,Tr as _parseAsync,Ds as _pipe,ss as _positive,ne as _promise,Ns as _property,pe as _readonly,oe as _record,hs as _refine,us as _regex,Dr as _safeDecode,Pr as _safeDecodeAsync,Cr as _safeEncode,Br as _safeEncodeAsync,Ir as _safeParse,hr as _safeParseAsync,re as _set,ps as _size,vs as _slugify,gs as _startsWith,Ar as _string,Je as _stringFormat,Ve as _stringbool,Bs as _success,Es as _superRefine,zr as _symbol,Ze as _templateLiteral,js as _toLowerCase,bs as _toUpperCase,Cs as _transform,$s as _trim,Yr as _tuple,Ye as _uint32,as as _uint64,Te as _ulid,kr as _undefined,qr as _union,Kr as _unknown,xs as _uppercase,Fe as _url,ye as _uuid,Se as _uuidv4,xe as _uuidv6,$e as _uuidv7,_r as _void,he as _xid,Js as _xor,Xo as any,_o as array,dt as attachMemoizer,Z as base64,S as base64url,Go as bigint,Ho as boolean,Wo as catch,qo as check,$ as cidrv4,F as cidrv6,Qo as codec,I as coerce,Xs as createStandardJSONSchemaMethod,Ks as createToJSONSchemaMethod,Yo as creditCard,T as cuid,E as cuid2,oa as custom,aa as date,U as decode,D as decodeAsync,ra as discriminatedUnion,L as e164,N as email,P as emoji,O as encode,R as encodeAsync,M as endsWith,ea as enum,_s as extractDefs,ta as file,Gs as finalize,J as float32,K as float64,da as function,$r as globalConfig,X as guid,et as handleUnrepresentable,_ as includes,Hs as initializeContext,G as int,H as int32,W as int64,na as intersection,Q as ipv4,Y as ipv6,nt as isBackEdge,it as isRecursiveSchema,Qs as isValidBase64,Ys as isValidBase64URL,Vt as isValidCIDRv6,Zt as isValidIPv6,ot as isValidJWT,oo as iso,ao as jwt,ro as ksuid,ia as lazy,eo as length,ma as literal,so as lowercase,to as mac,ca as map,lo as maxLength,no as maxSize,xt as mergeValues,io as mime,mo as minLength,co as minSize,po as multipleOf,pa as nan,Zo as nanoid,sa as nativeEnum,Vo as negative,Za as never,uo as nonnegative,Va as nonoptional,go as nonpositive,fo as normalize,ua as null,ga as nullable,la as number,fa as object,ya as optional,Sa as overwrite,yo as parse,So as parseAsync,yt as parseURLObject,xa as pipe,xo as positive,Ws as process,$a as promise,Fa as property,va as readonly,ja as record,ba as refine,$o as regex,Fo as safeDecode,vo as safeDecodeAsync,jo as safeEncode,bo as safeEncodeAsync,Io as safeParse,To as safeParseAsync,Ia as set,ho as size,Eo as slugify,rt as standardProps,Co as startsWith,Ta as string,Uo as stringFormat,ha as stringbool,St as stripTabAndNewline,wa as success,Ea as superRefine,Ca as symbol,Ua as templateLiteral,qs as toDotPath,Ko as toJSONSchema,Do as toLowerCase,Lo as toUpperCase,Da as transform,Bo as trim,La as tuple,No as uint32,Po as uint64,Ao as ulid,Ba as undefined,Na as union,Pa as unknown,Oo as uppercase,Ro as url,ut as urlHostnameOk,ft as urlProtocolOk,wo as uuid,zo as uuidv4,ko as uuidv6,Mo as uuidv7,Fr as version,Aa as void,Jo as xid,Oa as xor};
|
package/dist/v4/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,number,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,void,xid,xor,z}from"../index.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,compile,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../compile.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../chunks/errors-core-
|
|
1
|
+
export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,ZodLikeError,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,number,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,toZodError,toZodSafeResult,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,vV2,void,xid,xor,z}from"../index.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,compile,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../compile.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../chunks/errors-core-BU14-Dk8.js";export{VldIntersection,VldIntersection as ZodIntersection}from"../validators/intersection.js";export{VldAny as ZodAny}from"../validators/any.js";export{VldArray as ZodArray}from"../validators/array.js";export{VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID}from"../validators/string-formats.js";export{VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat}from"../validators/bigint.js";export{VldBoolean as ZodBoolean}from"../validators/boolean.js";export{VldCodec as ZodCodec}from"../validators/codec.js";export{VldCustom as ZodCustom,VldCustom as ZodSuccess}from"../validators/custom.js";export{VldDate as ZodDate}from"../validators/date.js";export{VldDiscriminatedUnion as ZodDiscriminatedUnion}from"../validators/discriminated-union.js";export{VldEnum as ZodEnum}from"../validators/enum.js";export{VldFile as ZodFile}from"../validators/file.js";export{VldFunction as ZodFunction}from"../validators/function.js";export{VldJson as ZodJSON}from"../validators/json.js";export{VldLazy as ZodLazy}from"../validators/lazy.js";export{VldLiteral as ZodLiteral}from"../validators/literal.js";export{VldMap as ZodMap}from"../validators/map.js";export{VldNan as ZodNaN}from"../validators/nan.js";export{VldNever as ZodNever}from"../validators/never.js";export{VldNull as ZodNull}from"../validators/null.js";export{VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../validators/number.js";export{VldObject as ZodObject}from"../validators/object.js";export{VldPromise as ZodPromise}from"../validators/promise.js";export{VldRecord as ZodRecord}from"../validators/record.js";export{VldSet as ZodSet}from"../validators/set.js";export{VldString as ZodString}from"../validators/string.js";export{VldSymbol as ZodSymbol}from"../validators/symbol.js";export{VldTemplateLiteral as ZodTemplateLiteral}from"../validators/template-literal.js";export{VldTuple as ZodTuple}from"../validators/tuple.js";export{VldUndefined as ZodUndefined}from"../validators/undefined.js";export{VldUnion as ZodUnion}from"../validators/union.js";export{VldUnknown as ZodUnknown}from"../validators/unknown.js";export{VldVoid as ZodVoid}from"../validators/void.js";export{VldXor as ZodXor}from"../validators/xor.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../kernel.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../errors.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../locales/runtime.js";export{globalRegistry,registry}from"../registry.js";export{s as setLocaleAsync}from"../chunks/index-CKPStM3V.js";const Z=(o,r)=>o.default("function"==typeof r?r():r);export{Z as _default};
|
package/dist/v4/mini/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{_default,catchall,exactPartial,extend,maximum,merge,minimum,omit,partial,pick,required,safeExtend}from"../../v4-mini/index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,number,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,void,xid,xor,z}from"../../index.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldBrand as ZodMiniBrand,VldCatch as ZodMiniCatch,VldDefault as ZodMiniDefault,VldExactOptional as ZodMiniExactOptional,VldRefine as ZodMiniNonOptional,VldNullable as ZodMiniNullable,VldOptional as ZodMiniOptional,VldPipe as ZodMiniPipe,VldPrefault as ZodMiniPrefault,VldReadonly as ZodMiniReadonly,VldTransform as ZodMiniTransform,VldBase as ZodMiniType,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../../chunks/errors-core-
|
|
1
|
+
export{_default,catchall,exactPartial,extend,maximum,merge,minimum,omit,partial,pick,required,safeExtend}from"../../v4-mini/index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,ZodLikeError,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,number,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,toZodError,toZodSafeResult,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,vV2,void,xid,xor,z}from"../../index.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldBrand as ZodMiniBrand,VldCatch as ZodMiniCatch,VldDefault as ZodMiniDefault,VldExactOptional as ZodMiniExactOptional,VldRefine as ZodMiniNonOptional,VldNullable as ZodMiniNullable,VldOptional as ZodMiniOptional,VldPipe as ZodMiniPipe,VldPrefault as ZodMiniPrefault,VldReadonly as ZodMiniReadonly,VldTransform as ZodMiniTransform,VldBase as ZodMiniType,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../../chunks/errors-core-BU14-Dk8.js";export{VldIntersection,VldIntersection as ZodIntersection,VldIntersection as ZodMiniIntersection}from"../../validators/intersection.js";export{VldAny as ZodAny,VldAny as ZodMiniAny}from"../../validators/any.js";export{VldArray as ZodArray,VldArray as ZodMiniArray}from"../../validators/array.js";export{VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodMiniBase64,VldStringFormat as ZodMiniBase64URL,VldStringFormat as ZodMiniCIDRv4,VldStringFormat as ZodMiniCIDRv6,VldStringFormat as ZodMiniCUID,VldStringFormat as ZodMiniCUID2,VldStringFormat as ZodMiniCreditCard,VldStringFormat as ZodMiniCustomStringFormat,VldStringFormat as ZodMiniE164,VldStringFormat as ZodMiniEmail,VldStringFormat as ZodMiniEmoji,VldStringFormat as ZodMiniGUID,VldStringFormat as ZodMiniIPv4,VldStringFormat as ZodMiniIPv6,VldStringFormat as ZodMiniISODate,VldStringFormat as ZodMiniISODateTime,VldStringFormat as ZodMiniISODuration,VldStringFormat as ZodMiniISOTime,VldStringFormat as ZodMiniJWT,VldStringFormat as ZodMiniKSUID,VldStringFormat as ZodMiniMAC,VldStringFormat as ZodMiniNanoID,VldStringFormat as ZodMiniStringFormat,VldStringFormat as ZodMiniULID,VldStringFormat as ZodMiniURL,VldStringFormat as ZodMiniUUID,VldStringFormat as ZodMiniXID,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID}from"../../validators/string-formats.js";export{VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat,VldBigInt as ZodMiniBigInt,VldBigInt as ZodMiniBigIntFormat}from"../../validators/bigint.js";export{VldBoolean as ZodBoolean,VldBoolean as ZodMiniBoolean}from"../../validators/boolean.js";export{VldCodec as ZodCodec,VldCodec as ZodMiniCodec}from"../../validators/codec.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,compile,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../../compile.js";export{VldCustom as ZodCustom,VldCustom as ZodMiniCustom,VldCustom as ZodMiniSuccess,VldCustom as ZodSuccess}from"../../validators/custom.js";export{VldDate as ZodDate,VldDate as ZodMiniDate}from"../../validators/date.js";export{VldDiscriminatedUnion as ZodDiscriminatedUnion,VldDiscriminatedUnion as ZodMiniDiscriminatedUnion}from"../../validators/discriminated-union.js";export{VldEnum as ZodEnum,VldEnum as ZodMiniEnum}from"../../validators/enum.js";export{VldFile as ZodFile,VldFile as ZodMiniFile}from"../../validators/file.js";export{VldFunction as ZodFunction,VldFunction as ZodMiniFunction}from"../../validators/function.js";export{VldJson as ZodJSON}from"../../validators/json.js";export{VldLazy as ZodLazy,VldLazy as ZodMiniLazy}from"../../validators/lazy.js";export{VldLiteral as ZodLiteral,VldLiteral as ZodMiniLiteral}from"../../validators/literal.js";export{VldMap as ZodMap,VldMap as ZodMiniMap}from"../../validators/map.js";export{VldNan as ZodMiniNaN,VldNan as ZodNaN}from"../../validators/nan.js";export{VldNever as ZodMiniNever,VldNever as ZodNever}from"../../validators/never.js";export{VldNull as ZodMiniNull,VldNull as ZodNull}from"../../validators/null.js";export{VldNumber as ZodMiniNumber,VldNumber as ZodMiniNumberFormat,VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../../validators/number.js";export{VldObject as ZodMiniObject,VldObject as ZodObject}from"../../validators/object.js";export{VldPromise as ZodMiniPromise,VldPromise as ZodPromise}from"../../validators/promise.js";export{VldRecord as ZodMiniRecord,VldRecord as ZodRecord}from"../../validators/record.js";export{VldSet as ZodMiniSet,VldSet as ZodSet}from"../../validators/set.js";export{VldString as ZodMiniString,VldString as ZodString}from"../../validators/string.js";export{VldSymbol as ZodMiniSymbol,VldSymbol as ZodSymbol}from"../../validators/symbol.js";export{VldTemplateLiteral as ZodMiniTemplateLiteral,VldTemplateLiteral as ZodTemplateLiteral}from"../../validators/template-literal.js";export{VldTuple as ZodMiniTuple,VldTuple as ZodTuple}from"../../validators/tuple.js";export{VldUndefined as ZodMiniUndefined,VldUndefined as ZodUndefined}from"../../validators/undefined.js";export{VldUnion as ZodMiniUnion,VldUnion as ZodUnion}from"../../validators/union.js";export{VldUnknown as ZodMiniUnknown,VldUnknown as ZodUnknown}from"../../validators/unknown.js";export{VldVoid as ZodMiniVoid,VldVoid as ZodVoid}from"../../validators/void.js";export{VldXor as ZodMiniXor,VldXor as ZodXor}from"../../validators/xor.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../../kernel.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../../errors.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../../locales/runtime.js";export{globalRegistry,registry}from"../../registry.js";export{s as setLocaleAsync}from"../../chunks/index-CKPStM3V.js";
|
package/dist/v4-mini/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{number as Z}from"../index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,void,xid,xor,z}from"../index.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,compile,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../compile.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldBrand as ZodMiniBrand,VldCatch as ZodMiniCatch,VldDefault as ZodMiniDefault,VldExactOptional as ZodMiniExactOptional,VldRefine as ZodMiniNonOptional,VldNullable as ZodMiniNullable,VldOptional as ZodMiniOptional,VldPipe as ZodMiniPipe,VldPrefault as ZodMiniPrefault,VldReadonly as ZodMiniReadonly,VldTransform as ZodMiniTransform,VldBase as ZodMiniType,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../chunks/errors-core-
|
|
1
|
+
import{number as Z}from"../index.js";export{$brand,$input,$output,NEVER,TimePrecision,ZodFirstPartyTypeKind,ZodIssueCode,ZodLikeError,_ZodString,_function,any,array,base64,base64Bytes,base64url,bigint,boolean,catch,check,cidrv4,cidrv6,clone,codec,coerce,config,core,createLogger,createNoOpLogger,creditCard,cuid,cuid2,custom,date,decode,decodeAsync,deepPartial,default,describe,disableLogging,discriminatedUnion,e164,email,emoji,enableDebug,encode,encodeAsync,endsWith,enum,exactOptional,file,float32,float64,formatError,fromJSONSchema,_function as function,getErrorMap,getLogger,gt,gte,guid,hash,hex,hexBytes,hostname,httpUrl,includes,initLogger,input,instanceof,int,int32,int64,intersection,ipv4,ipv6,iso,json,jwt,keyof,ksuid,lazy,length,literal,locales,looseObject,looseRecord,lowercase,lt,lte,mac,map,mapSchema,maxLength,maxSize,meta,mime,minLength,minSize,multipleOf,nan,nanoid,nativeEnum,negative,never,nonnegative,nonoptional,nonpositive,normalize,null,nullable,nullish,object,optional,output,overwrite,parse,parseAsync,partialRecord,pipe,positive,prefault,preprocess,promise,property,readonly,record,refine,regex,regexes,safeDecode,safeDecodeAsync,safeEncode,safeEncodeAsync,safeParse,safeParseAsync,set,setErrorMap,setLogLevel,size,slugify,startsWith,strictObject,string,stringFormat,stringbool,superRefine,symbol,templateLiteral,toJSONSchema,toLowerCase,toUpperCase,toZodError,toZodSafeResult,transform,trim,tuple,uint32,uint64,uint8Array,ulid,undefined,union,unknown,uppercase,url,util,uuid,uuidv4,uuidv6,uuidv7,default as v,vV2,void,xid,xor,z}from"../index.js";export{ZodCompileAsyncError,ZodCompileError,ZodCompileUnsupportedError,compile,getDiscriminatedOption,memoizer,properties,toZod,validate,validateAsync,compileFn as zodCompileFn}from"../compile.js";export{Err,Ok,ResultUtils,all,failure,flatMap,fromNullable,isErr,isOk,isResult,mapErr,match,success,tryCatch,tryCatchAsync,unwrap,unwrapOr}from"../compat/result.js";export{VldBase,VldMeta,VldBrand as ZodBranded,VldCatch as ZodCatch,VldDefault as ZodDefault,VldExactOptional as ZodExactOptional,VldMeta as ZodMeta,VldBrand as ZodMiniBrand,VldCatch as ZodMiniCatch,VldDefault as ZodMiniDefault,VldExactOptional as ZodMiniExactOptional,VldRefine as ZodMiniNonOptional,VldNullable as ZodMiniNullable,VldOptional as ZodMiniOptional,VldPipe as ZodMiniPipe,VldPrefault as ZodMiniPrefault,VldReadonly as ZodMiniReadonly,VldTransform as ZodMiniTransform,VldBase as ZodMiniType,VldRefine as ZodNonOptional,VldNullable as ZodNullable,VldOptional as ZodOptional,VldPipe as ZodPipe,VldPrefault as ZodPrefault,VldPreprocess as ZodPreprocess,VldReadonly as ZodReadonly,VldTransform as ZodTransform,VldBase as ZodType}from"../validators/base.js";export{V as VldError,V as ZodError,V as ZodRealError}from"../chunks/errors-core-BU14-Dk8.js";export{VldIntersection,VldIntersection as ZodIntersection,VldIntersection as ZodMiniIntersection}from"../validators/intersection.js";export{VldAny as ZodAny,VldAny as ZodMiniAny}from"../validators/any.js";export{VldArray as ZodArray,VldArray as ZodMiniArray}from"../validators/array.js";export{VldStringFormat as ZodBase64,VldStringFormat as ZodBase64URL,VldStringFormat as ZodCIDRv4,VldStringFormat as ZodCIDRv6,VldStringFormat as ZodCUID,VldStringFormat as ZodCUID2,VldStringFormat as ZodCreditCard,VldStringFormat as ZodCustomStringFormat,VldStringFormat as ZodE164,VldStringFormat as ZodEmail,VldStringFormat as ZodEmoji,VldStringFormat as ZodGUID,VldStringFormat as ZodIPv4,VldStringFormat as ZodIPv6,VldStringFormat as ZodISODate,VldStringFormat as ZodISODateTime,VldStringFormat as ZodISODuration,VldStringFormat as ZodISOTime,VldStringFormat as ZodJWT,VldStringFormat as ZodKSUID,VldStringFormat as ZodMAC,VldStringFormat as ZodMiniBase64,VldStringFormat as ZodMiniBase64URL,VldStringFormat as ZodMiniCIDRv4,VldStringFormat as ZodMiniCIDRv6,VldStringFormat as ZodMiniCUID,VldStringFormat as ZodMiniCUID2,VldStringFormat as ZodMiniCreditCard,VldStringFormat as ZodMiniCustomStringFormat,VldStringFormat as ZodMiniE164,VldStringFormat as ZodMiniEmail,VldStringFormat as ZodMiniEmoji,VldStringFormat as ZodMiniGUID,VldStringFormat as ZodMiniIPv4,VldStringFormat as ZodMiniIPv6,VldStringFormat as ZodMiniISODate,VldStringFormat as ZodMiniISODateTime,VldStringFormat as ZodMiniISODuration,VldStringFormat as ZodMiniISOTime,VldStringFormat as ZodMiniJWT,VldStringFormat as ZodMiniKSUID,VldStringFormat as ZodMiniMAC,VldStringFormat as ZodMiniNanoID,VldStringFormat as ZodMiniStringFormat,VldStringFormat as ZodMiniULID,VldStringFormat as ZodMiniURL,VldStringFormat as ZodMiniUUID,VldStringFormat as ZodMiniXID,VldStringFormat as ZodNanoID,VldStringFormat as ZodStringFormat,VldStringFormat as ZodULID,VldStringFormat as ZodURL,VldStringFormat as ZodUUID,VldStringFormat as ZodXID}from"../validators/string-formats.js";export{VldBigInt as ZodBigInt,VldBigInt as ZodBigIntFormat,VldBigInt as ZodMiniBigInt,VldBigInt as ZodMiniBigIntFormat}from"../validators/bigint.js";export{VldBoolean as ZodBoolean,VldBoolean as ZodMiniBoolean}from"../validators/boolean.js";export{VldCodec as ZodCodec,VldCodec as ZodMiniCodec}from"../validators/codec.js";export{VldCustom as ZodCustom,VldCustom as ZodMiniCustom,VldCustom as ZodMiniSuccess,VldCustom as ZodSuccess}from"../validators/custom.js";export{VldDate as ZodDate,VldDate as ZodMiniDate}from"../validators/date.js";export{VldDiscriminatedUnion as ZodDiscriminatedUnion,VldDiscriminatedUnion as ZodMiniDiscriminatedUnion}from"../validators/discriminated-union.js";export{VldEnum as ZodEnum,VldEnum as ZodMiniEnum}from"../validators/enum.js";export{VldFile as ZodFile,VldFile as ZodMiniFile}from"../validators/file.js";export{VldFunction as ZodFunction,VldFunction as ZodMiniFunction}from"../validators/function.js";export{VldJson as ZodJSON}from"../validators/json.js";export{VldLazy as ZodLazy,VldLazy as ZodMiniLazy}from"../validators/lazy.js";export{VldLiteral as ZodLiteral,VldLiteral as ZodMiniLiteral}from"../validators/literal.js";export{VldMap as ZodMap,VldMap as ZodMiniMap}from"../validators/map.js";export{VldNan as ZodMiniNaN,VldNan as ZodNaN}from"../validators/nan.js";export{VldNever as ZodMiniNever,VldNever as ZodNever}from"../validators/never.js";export{VldNull as ZodMiniNull,VldNull as ZodNull}from"../validators/null.js";export{VldNumber as ZodMiniNumber,VldNumber as ZodMiniNumberFormat,VldNumber as ZodNumber,VldNumber as ZodNumberFormat}from"../validators/number.js";export{VldObject as ZodMiniObject,VldObject as ZodObject}from"../validators/object.js";export{VldPromise as ZodMiniPromise,VldPromise as ZodPromise}from"../validators/promise.js";export{VldRecord as ZodMiniRecord,VldRecord as ZodRecord}from"../validators/record.js";export{VldSet as ZodMiniSet,VldSet as ZodSet}from"../validators/set.js";export{VldString as ZodMiniString,VldString as ZodString}from"../validators/string.js";export{VldSymbol as ZodMiniSymbol,VldSymbol as ZodSymbol}from"../validators/symbol.js";export{VldTemplateLiteral as ZodMiniTemplateLiteral,VldTemplateLiteral as ZodTemplateLiteral}from"../validators/template-literal.js";export{VldTuple as ZodMiniTuple,VldTuple as ZodTuple}from"../validators/tuple.js";export{VldUndefined as ZodMiniUndefined,VldUndefined as ZodUndefined}from"../validators/undefined.js";export{VldUnion as ZodMiniUnion,VldUnion as ZodUnion}from"../validators/union.js";export{VldUnknown as ZodMiniUnknown,VldUnknown as ZodUnknown}from"../validators/unknown.js";export{VldVoid as ZodMiniVoid,VldVoid as ZodVoid}from"../validators/void.js";export{VldXor as ZodMiniXor,VldXor as ZodXor}from"../validators/xor.js";export{b as base64Json,a as base64ToBytes,c as base64ToUint8Array,d as base64UrlToBytes,e as base64urlToBytes,f as bytesToUtf8,g as epochMillisToDate,h as epochSecondsToDate,i as hexLowerToBytes,j as hexToBytes,k as hexToUint8Array,l as invertCodec,m as isoDatetimeToDate,n as jsonCodec,o as jwtPayload,p as numberToBigInt,s as stringToBigInt,q as stringToBoolean,r as stringToHttpURL,t as stringToInt,u as stringToNumber,v as stringToURL,w as stringToUint8Array,x as uint8ArrayToBase64,y as uint8ArrayToBase64Url,z as uint8ArrayToHex,A as uint8ArrayToString,B as uriComponent,C as utf8ToBytes}from"../chunks/index-CkbfQQ4n.js";export{blue,bold,createTheme,cyan,dim,gray,green,grey,italic,magenta,default as pigment,red,strip,supportsColor,underline,vldTheme,white,yellow}from"../pigment.js";export{createEmitter,createEventBus,withEmitter}from"../compat/emitter.js";export{createVldKernel,definePlugin,getVldKernel,resetVldKernel,usePlugin}from"../kernel.js";export{flattenError,prettifyError,prettifyErrorColored,prettifyErrorPlain,treeifyError}from"../errors.js";export{getLocale,getMessages,getSupportedLocales,isLocaleLoaded,isLocaleSupported,registerLocale,setLocale}from"../locales/runtime.js";export{globalRegistry,registry}from"../registry.js";export{s as setLocaleAsync}from"../chunks/index-CKPStM3V.js";function S(o){return Object.keys(o).filter(a=>o[a])}function M(o){return"string"==typeof o?o:o?.message||o?.error}const F=(o,a)=>o.pick(...S(a)),I=(o,a)=>o.omit(...S(a)),T=o=>o.partial(),U=o=>o.required(),D=(o,a)=>o.extend(a),E=(o,a)=>o.safeExtend(a),L=(o,a)=>a&&"function"==typeof a.parse?o.merge(a):o.extend(a),N=(o,a)=>o.catchall(a),O=(o,a)=>o.default("function"==typeof a?a():a),R=(o,a)=>{const r=M(a);return Z().min(o,r)},P=(o,a)=>{const r=M(a);return Z().max(o,r)},J=o=>o.exactPartial();export{O as _default,N as catchall,J as exactPartial,D as extend,P as maximum,L as merge,R as minimum,Z as number,I as omit,T as partial,F as pick,U as required,E as safeExtend};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VldArrayV2 — array validator with single-def + check-class pattern.
|
|
3
|
+
* Public API mirrors the legacy VldArray 1:1. Exposed via v.arrayV2().
|
|
4
|
+
*/
|
|
5
|
+
import { VldBase, type ErrorParam, type ParseResult } from './base.js';
|
|
6
|
+
type SimpleItemMode = 'string' | 'number' | 'boolean' | undefined;
|
|
7
|
+
export interface VldArrayCheckIssue {
|
|
8
|
+
code: string;
|
|
9
|
+
path: (string | number)[];
|
|
10
|
+
message: string;
|
|
11
|
+
[k: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface VldArrayCheckPayload {
|
|
14
|
+
length: number;
|
|
15
|
+
issues: VldArrayCheckIssue[];
|
|
16
|
+
}
|
|
17
|
+
export declare abstract class VldArrayCheck {
|
|
18
|
+
abstract readonly kind: 'minLength' | 'maxLength' | 'exactLength' | 'nonempty' | 'unique';
|
|
19
|
+
abstract readonly message: string | undefined;
|
|
20
|
+
abstract check(value: {
|
|
21
|
+
length: number;
|
|
22
|
+
items?: unknown[];
|
|
23
|
+
}, payload: VldArrayCheckPayload): void;
|
|
24
|
+
abstract meta(): Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
export declare class VldArrayCheckMin extends VldArrayCheck {
|
|
27
|
+
readonly minLength: number;
|
|
28
|
+
readonly kind: "minLength";
|
|
29
|
+
constructor(minLength: number, msg?: string);
|
|
30
|
+
get message(): string | undefined;
|
|
31
|
+
private _msg;
|
|
32
|
+
check(v: {
|
|
33
|
+
length: number;
|
|
34
|
+
}, p: VldArrayCheckPayload): void;
|
|
35
|
+
meta(): {
|
|
36
|
+
kind: string;
|
|
37
|
+
value: number;
|
|
38
|
+
message: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare class VldArrayCheckMax extends VldArrayCheck {
|
|
42
|
+
readonly maxLength: number;
|
|
43
|
+
readonly kind: "maxLength";
|
|
44
|
+
constructor(maxLength: number, msg?: string);
|
|
45
|
+
get message(): string | undefined;
|
|
46
|
+
private _msg;
|
|
47
|
+
check(v: {
|
|
48
|
+
length: number;
|
|
49
|
+
}, p: VldArrayCheckPayload): void;
|
|
50
|
+
meta(): {
|
|
51
|
+
kind: string;
|
|
52
|
+
value: number;
|
|
53
|
+
message: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare class VldArrayCheckLength extends VldArrayCheck {
|
|
57
|
+
readonly exactLength: number;
|
|
58
|
+
readonly kind: "exactLength";
|
|
59
|
+
constructor(exactLength: number, msg?: string);
|
|
60
|
+
get message(): string | undefined;
|
|
61
|
+
private _msg;
|
|
62
|
+
check(v: {
|
|
63
|
+
length: number;
|
|
64
|
+
}, p: VldArrayCheckPayload): void;
|
|
65
|
+
meta(): {
|
|
66
|
+
kind: string;
|
|
67
|
+
value: number;
|
|
68
|
+
message: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export declare class VldArrayCheckUnique extends VldArrayCheck {
|
|
72
|
+
readonly kind: "unique";
|
|
73
|
+
constructor(msg?: string);
|
|
74
|
+
get message(): string | undefined;
|
|
75
|
+
private _msg;
|
|
76
|
+
check(v: {
|
|
77
|
+
length: number;
|
|
78
|
+
items: unknown[];
|
|
79
|
+
}, p: VldArrayCheckPayload): void;
|
|
80
|
+
meta(): {
|
|
81
|
+
kind: string;
|
|
82
|
+
message: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface VldArrayDef {
|
|
86
|
+
readonly type: 'array';
|
|
87
|
+
readonly itemValidator: VldBase<unknown, any>;
|
|
88
|
+
readonly checks: ReadonlyArray<VldArrayCheck>;
|
|
89
|
+
readonly simpleItemMode: SimpleItemMode;
|
|
90
|
+
readonly hasUnique: boolean;
|
|
91
|
+
readonly errorMessage?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare class VldArrayV2<T> extends VldBase<unknown[], T[]> {
|
|
94
|
+
readonly __def: VldArrayDef;
|
|
95
|
+
constructor(def: VldArrayDef);
|
|
96
|
+
static create<T>(itemValidator: VldBase<unknown, T>): VldArrayV2<T>;
|
|
97
|
+
get element(): VldBase<unknown, T>;
|
|
98
|
+
unwrap(): VldBase<unknown, T>;
|
|
99
|
+
get isSimple(): boolean;
|
|
100
|
+
parse(value: unknown): T[];
|
|
101
|
+
parseKnownArray(value: unknown[]): T[];
|
|
102
|
+
safeParse(value: unknown): ParseResult<T[]>;
|
|
103
|
+
protected withDef(def: Partial<VldArrayDef> & {
|
|
104
|
+
type: 'array';
|
|
105
|
+
}): VldArrayV2<T>;
|
|
106
|
+
min(length: number, message?: ErrorParam): VldArrayV2<T>;
|
|
107
|
+
max(length: number, message?: ErrorParam): VldArrayV2<T>;
|
|
108
|
+
length(length: number, message?: ErrorParam): VldArrayV2<T>;
|
|
109
|
+
nonempty(message?: ErrorParam): VldArrayV2<T>;
|
|
110
|
+
unique(message?: ErrorParam): VldArrayV2<T>;
|
|
111
|
+
between(min: number, max: number, message?: ErrorParam): VldArrayV2<T>;
|
|
112
|
+
}
|
|
113
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{VldBase as e,VLD_VALIDATOR_TYPES as t}from"./base.js";import{V as s,c as r,g as a}from"../chunks/errors-core-BU14-Dk8.js";import{getMessages as i}from"../locales/runtime.js";class VldArrayCheck{}class VldArrayCheckMin extends VldArrayCheck{constructor(e,t){super(),this.minLength=e,this.kind="minLength",this._msg=t}get message(){return this._msg}check(e,t){e.length<this.minLength&&t.issues.push({code:"too_small",path:[],origin:"array",minimum:this.minLength,inclusive:!0,message:this._msg||`Array must have at least ${this.minLength} items`})}meta(){return{kind:"minLength",value:this.minLength,message:this._msg}}}class VldArrayCheckMax extends VldArrayCheck{constructor(e,t){super(),this.maxLength=e,this.kind="maxLength",this._msg=t}get message(){return this._msg}check(e,t){e.length>this.maxLength&&t.issues.push({code:"too_big",path:[],origin:"array",maximum:this.maxLength,inclusive:!0,message:this._msg||`Array must have at most ${this.maxLength} items`})}meta(){return{kind:"maxLength",value:this.maxLength,message:this._msg}}}class VldArrayCheckLength extends VldArrayCheck{constructor(e,t){super(),this.exactLength=e,this.kind="exactLength",this._msg=t}get message(){return this._msg}check(e,t){e.length!==this.exactLength&&t.issues.push({code:"too_big",path:[],origin:"array",exact:this.exactLength,message:this._msg||`Array must have exactly ${this.exactLength} items`})}meta(){return{kind:"exactLength",value:this.exactLength,message:this._msg}}}class VldArrayCheckUnique extends VldArrayCheck{constructor(e){super(),this.kind="unique",this._msg=e}get message(){return this._msg}check(e,t){const s=new Set;for(let r=0;r<e.items.length;r++){const a=e.items[r];if(s.has(a))return void t.issues.push({code:"custom",path:[r],message:this._msg||`Duplicate item at index ${r}`});s.add(a)}}meta(){return{kind:"unique",message:this._msg}}}function n(e){if(!0===e.isSimple)switch(e.validatorType){case t.STRING:return"string";case t.NUMBER:return"number";case t.BOOLEAN:return"boolean";default:return}}class VldArrayV2 extends e{constructor(e){super(t.ARRAY),this.__def=e}static create(e){return new VldArrayV2({type:"array",itemValidator:e,checks:Object.freeze([]),simpleItemMode:n(e),hasUnique:!1})}get element(){return this.__def.itemValidator}unwrap(){return this.__def.itemValidator}get isSimple(){return 0===this.__def.checks.length}parse(e){if(!Array.isArray(e))throw new s([r("array",a(e),this.__def.errorMessage)]);return this.parseKnownArray(e)}parseKnownArray(e){const t=this.__def,r=t.checks;if(r.length>0)for(let a=0;a<r.length;a++){const i=r[a];if("minLength"===i.kind&&e.length<i.minLength)throw new s([{code:"too_small",path:[],origin:"array",minimum:i.minLength,inclusive:!0,message:i.message||`Array must have at least ${i.minLength} items`}]);if("maxLength"===i.kind&&e.length>i.maxLength)throw new s([{code:"too_big",path:[],origin:"array",maximum:i.maxLength,inclusive:!0,message:i.message||`Array must have at most ${i.maxLength} items`}]);if("exactLength"===i.kind&&e.length!==i.exactLength)throw new s([{code:"too_big",path:[],origin:"array",exact:i.exactLength,message:i.message||`Array must have exactly ${i.exactLength} items`}]);if("unique"===i.kind&&t.hasUnique){const t=new Set;for(let r=0;r<e.length;r++){const a=e[r];if(t.has(a))throw new s([{code:"custom",path:[r],message:i.message||`Duplicate item at index ${r}`}]);t.add(a)}}}const a=e.length,n=new Array(a),h=t.simpleItemMode,c=t.itemValidator;if(void 0!==h)for(let t=0;t<a;t++){const s=e[t];switch(h){case"string":if("string"!=typeof s)throw new Error(i().arrayItem(t,i().invalidString));n[t]=s;break;case"number":if("number"!=typeof s||isNaN(s))throw new Error(i().arrayItem(t,i().invalidNumber));n[t]=s;break;case"boolean":if("boolean"!=typeof s)throw new Error(i().arrayItem(t,i().invalidBoolean));n[t]=s}}else for(let t=0;t<a;t++)n[t]=c.parse(e[t]);return n}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:e instanceof s?e:new s([{code:"custom",path:[],message:String(e)}])}}}withDef(e){const t={...this.__def,...e,type:"array"};return new this.constructor(t)}min(e,t){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMin(e,t)]})}max(e,t){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMax(e,t)]})}length(e,t){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckLength(e,t)]})}nonempty(e){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMin(1,e)]})}unique(e){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckUnique(e)],hasUnique:!0})}between(e,t,s){return this.withDef({type:"array",checks:[...this.__def.checks,new VldArrayCheckMin(e,s),new VldArrayCheckMax(t,s)]})}}export{VldArrayCheck,VldArrayCheckLength,VldArrayCheckMax,VldArrayCheckMin,VldArrayCheckUnique,VldArrayV2};
|
package/dist/validators/array.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VldBase as e,VLD_VALIDATOR_TYPES as r}from"./base.js";import{getMessages as t}from"../locales/runtime.js";import{V as n,c as i,g as a}from"../chunks/errors-core-
|
|
1
|
+
import{VldBase as e,VLD_VALIDATOR_TYPES as r}from"./base.js";import{getMessages as t}from"../locales/runtime.js";import{V as n,c as i,g as a}from"../chunks/errors-core-BU14-Dk8.js";function s(e){return new n([{code:"invalid_array",path:[],message:e}])}function o(e,r){return new n([{code:"too_small",path:[],origin:"array",minimum:e,inclusive:!0,message:r}])}class VldArray extends e{constructor(e){super(r.ARRAY),this.config=e,this._simpleItemMode=this.getSimpleItemMode(e.itemValidator)}getSimpleItemMode(e){if(!0===e.isSimple)switch(e.validatorType){case r.STRING:return"string";case r.NUMBER:return"number";case r.BOOLEAN:return"boolean";default:return}}static create(e){return new VldArray({itemValidator:e})}get element(){return this.config.itemValidator}unwrap(){return this.config.itemValidator}parse(e){if(!Array.isArray(e)){const r=this.config.errorMessage||t().invalidArray;throw new n([i("array",a(e),r)])}return this.parseArrayValue(e)}parseKnownArray(e){return this.parseArrayValue(e)}parseArrayValue(e){if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw o(this.config.exactLength,this.config.errorMessage||t().arrayLength(this.config.exactLength));if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw o(this.config.minLength,this.config.errorMessage||t().arrayMin(this.config.minLength));if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw r=this.config.maxLength,i=this.config.errorMessage||t().arrayMax(this.config.maxLength),new n([{code:"too_big",path:[],origin:"array",maximum:r,inclusive:!0,message:i}]);var r,i;const a=e.length,s=new Array(a),c=this._simpleItemMode;if(void 0!==c){for(let r=0;r<a;r++){const n=e[r];switch(c){case"string":if("string"!=typeof n)throw new Error(t().arrayItem(r,t().invalidString));s[r]=n;break;case"number":if("number"!=typeof n||isNaN(n))throw new Error(t().arrayItem(r,t().invalidNumber));s[r]=n;break;case"boolean":if("boolean"!=typeof n)throw new Error(t().arrayItem(r,t().invalidBoolean));s[r]=n}}return this.config.unique&&this.checkUnique(s),s}for(let r=0;r<a;r++)try{s[r]=this.config.itemValidator.parse(e[r])}catch(e){const n=e instanceof Error?e.message:String(e);throw new Error(t().arrayItem(r,n))}return this.config.unique&&this.checkUnique(s),s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return e instanceof n?{success:!1,error:e}:{success:!1,error:s(e.message)}}}encode(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=this.config.itemValidator.encode(e[t]);return r}safeEncode(e){try{return{success:!0,data:this.encode(e)}}catch(e){return{success:!1,error:s(e.message)}}}async encodeAsync(e){this.validateEncodedArray(e);const r=new Array(e.length);for(let t=0;t<e.length;t++)r[t]=await this.config.itemValidator.encodeAsync(e[t]);return r}async safeEncodeAsync(e){try{return{success:!0,data:await this.encodeAsync(e)}}catch(e){return{success:!1,error:s(e.message)}}}validateEncodedArray(e){if(!Array.isArray(e))throw new Error(this.config.errorMessage||t().invalidArray);if(void 0!==this.config.exactLength&&e.length!==this.config.exactLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.minLength&&e.length<this.config.minLength)throw new Error(this.config.errorMessage);if(void 0!==this.config.maxLength&&e.length>this.config.maxLength)throw new Error(this.config.errorMessage);this.config.unique&&this.checkUnique(e)}checkUnique(e){const r=new Set,t=new WeakMap;for(const n of e){let e;if("object"==typeof n&&null!==n){const r=t.get(n);if(void 0!==r)e=r;else{const r=this.stableStringify(n);e=r,t.set(n,r)}}else e=n;if(r.has(e))throw new Error("Array must contain unique items");r.add(e)}}stableStringify(e){const r=new WeakSet,t=(e,n=0)=>{if(n>100)return'"[Max Depth Exceeded]"';if(null===e)return"null";if(void 0===e)return"undefined";if("object"!=typeof e)return JSON.stringify(e);if(r.has(e))return'"[Circular]"';r.add(e);try{if(Array.isArray(e)){return`[${e.map(e=>t(e,n+1)).join(",")}]`}const r=Object.keys(e).sort();return`{${r.map(r=>`${JSON.stringify(r)}:${t(e[r],n+1)}`).join(",")}}`}finally{r.delete(e)}};try{return t(e)}catch{return String(e)}}min(e,r){return new VldArray({...this.config,minLength:e,errorMessage:r||t().arrayMin(e)})}max(e,r){return new VldArray({...this.config,maxLength:e,errorMessage:r||t().arrayMax(e)})}length(e,r){return new VldArray({...this.config,exactLength:e,minLength:void 0,maxLength:void 0,errorMessage:r||t().arrayLength(e)})}nonempty(e){return new VldArray({...this.config,minLength:1,errorMessage:e||t().arrayEmpty})}unique(e){return new VldArray({...this.config,unique:!0,errorMessage:e||"Array must contain unique items"})}between(e,r,t){return new VldArray({...this.config,minLength:e,maxLength:r,errorMessage:t||`Array length must be between ${e} and ${r}`})}}export{VldArray};
|
package/dist/validators/base.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{globalRegistry as e}from"../registry.js";import{V as t}from"../chunks/errors-core-CerMg2rq.js";function s(e){if(e instanceof t)return e;const s=e instanceof Error?e.message:String(e);return new t([{code:"custom",path:[],message:s}])}const r={STRING:"string",STRING_FORMAT:"stringFormat",STRING_BOOL:"stringBool",NUMBER:"number",BOOLEAN:"boolean",DATE:"date",BIGINT:"bigint",UNDEFINED:"undefined",NULL:"null",UNKNOWN:"unknown",ANY:"any",VOID:"void",NEVER:"never",SYMBOL:"symbol",NAN:"nan",HEX:"hex",BASE64:"base64",UINT8_ARRAY:"uint8Array",COERCE_STRING:"coerceString",COERCE_NUMBER:"coerceNumber",COERCE_BOOLEAN:"coerceBoolean",COERCE_DATE:"coerceDate",COERCE_BIGINT:"coerceBigint",OBJECT:"object",ARRAY:"array",TUPLE:"tuple",SET:"set",MAP:"map",RECORD:"record",UNION:"union",DISCRIMINATED_UNION:"discriminatedUnion",INTERSECTION:"intersection",XOR:"xor",ENUM:"enum",LITERAL:"literal",LAZY:"lazy",CUSTOM:"custom",FUNCTION:"function",FILE:"file",JSON:"json",TEMPLATE_LITERAL:"templateLiteral",PROMISE:"promise",OPTIONAL:"optional",NULLABLE:"nullable",NULLISH:"nullish",EXACT_OPTIONAL:"exactOptional",DEFAULT:"default",CATCH:"catch",REFINE:"refine",TRANSFORM:"transform",PIPE:"pipe",PREPROCESS:"preprocess",SUPER_REFINE:"superRefine",BRAND:"brand",READONLY:"readonly",META:"meta",PREFAULT:"prefault",PREFault:"prefault",CODEC:"codec"};function a(e,t){if("string"==typeof e)return e;if("function"==typeof e){const s=e(void 0);return"string"==typeof s?s:"object"==typeof s&&s?.message?s.message:t}if("object"==typeof e&&null!==e){if("string"==typeof e.error)return e.error;if("function"==typeof e.error)return e.error({})||t;if("string"==typeof e.message)return e.message}return t}function i(e){return null!==e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}let n;function o(e){n=e}function h(e){return"function"==typeof e?e():function(e){if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(null!==e&&"object"==typeof e){const t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return{...e}}return e}(e)}function u(e){if(!0===e.isSimple)switch(e.validatorType){case r.STRING:return"string";case r.NUMBER:return"number";case r.BOOLEAN:return"boolean";case r.BIGINT:return"bigint";case r.SYMBOL:return"symbol";default:return}}function l(e,t){switch(e){case"string":return"string"==typeof t?t:void 0;case"number":return"number"!=typeof t||isNaN(t)?void 0:t;case"boolean":return"boolean"==typeof t?t:void 0;case"bigint":return"bigint"==typeof t?t:void 0;case"symbol":return"symbol"==typeof t?t:void 0;default:return}}class VldBase{constructor(e="unknown"){this.validatorType=e}get type(){return this.validatorType}get _def(){return{typeName:"Zod"+this.validatorType.charAt(0).toUpperCase()+this.validatorType.slice(1),...this.config||{}}}get def(){return this._def}get _zod(){return this._def}get"~standard"(){return{version:1,vendor:"vld",validate:e=>{const t=this.safeParse(e);return t.success?{value:t.data}:{issues:[{message:t.error.message}]}},types:void 0}}async parseAsync(e){return this.parse(e)}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}decode(e){return this.parse(e)}safeDecode(e){return this.safeParse(e)}async decodeAsync(e){return this.parseAsync(e)}async safeDecodeAsync(e){return this.safeParseAsync(e)}encode(e){return this.parse(e)}safeEncode(e){const t=this.safeParse(e);return t.success?{success:!0,data:t.data}:t}async encodeAsync(e){return this.parseAsync(e)}async safeEncodeAsync(e){const t=await this.safeParseAsync(e);return t.success?{success:!0,data:t.data}:t}spa(e){return this.safeParseAsync(e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}clone(){return this}isValid(e){return this.safeParse(e).success}parseOrDefault(e,t){const s=this.safeParse(e);if(s.success)return s.data;const r=this.safeParse(t);if(!r.success)throw new Error(`Invalid default value provided: ${r.error.message}`);return r.data}refine(e,t){return new VldRefine(this,e,t)}superRefine(e){return new VldSuperRefine(this,e)}transform(e){return new VldTransform(this,e)}default(e){return new VldDefault(this,e)}prefault(e){return new VldPrefault(this,e)}nonoptional(e){return new VldRefine(this,e=>void 0!==e,a(e,"Expected non-optional value"))}array(){return n.array(this)}or(e){return n.union(this,e)}and(e){return n.intersection(this,e)}overwrite(e){return new VldTransform(this,e)}with(...e){return new VldSuperRefine(this,(t,s)=>{const r={value:t,issues:[]},a=[];for(const t of e){const e="function"==typeof t?t:t._zod?.check;if(!e)continue;const s=e(r);i(s)&&a.push(Promise.resolve(s))}const n=()=>{for(const e of r.issues)s.addIssue(void 0===e.code?{message:e.message||"Custom check failed"}:{message:e.message||"Custom check failed",code:e.code})};if(a.length>0)return Promise.all(a).then(n);n()})}toJSONSchema(e){return n.toJSONSchema(this,e)}catch(e){return new VldCatch(this,e)}optional(){return new VldOptional(this)}nullable(){return new VldNullable(this)}nullish(){return new VldNullish(this)}exactOptional(){return new VldExactOptional(this)}pipe(e){return new VldPipe(this,e)}readonly(){return new VldReadonly(this)}brand(){return new VldBrand(this)}apply(e){return e(this)}check(e,t){return this.refine(e,t)}meta(t){if(void 0===t)return e.get(this)??this.baseValidator?.meta?.()??this.schema?.meta?.()??this.inner?.meta?.();const s=new VldMeta(this,t);return e.add(s,t),s}register(e,t){return e.add(this,t),this}describe(e){return this.meta({description:e})}get description(){return this.meta()?.description??this.baseValidator?.description??this.schema?.description??this.inner?.description}}class VldMeta extends VldBase{constructor(e,t){super(r.META),this.baseValidator=e,this.metadata=t}parse(e){return this.baseValidator.parse(e)}safeParse(e){return this.baseValidator.safeParse(e)}getMeta(){return{...this.metadata}}meta(t){if(void 0===t)return{...this.metadata,...e.get(this)};const s=new VldMeta(this.baseValidator,{...this.metadata,...t});return e.add(s,s.getMeta()),s}describe(e){return this.meta({description:e})}}class VldReadonly extends VldBase{constructor(e){super(r.READONLY),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldBrand extends VldBase{constructor(e){super(r.BRAND),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldRefine extends VldBase{constructor(e,t,s){super(r.REFINE),this.baseValidator=e,this.predicate=t,this.customMessage=s??"Refinement check failed","object"==typeof s&&null!==s&&"path"in s&&Array.isArray(s.path)&&(this.refinePath=s.path)}_createIssue(e){if("function"==typeof this.customMessage){const t=this.customMessage(e);return"string"==typeof t?{code:"custom",path:this.refinePath??[],message:t}:{code:"custom",path:t?.path??this.refinePath??[],message:t?.message??"Refinement check failed"}}if("object"==typeof this.customMessage&&null!==this.customMessage){const e=this.customMessage.message??this.customMessage.error,t="function"==typeof e?e({}):"string"==typeof e?e:"Refinement check failed";return{code:"custom",path:this.customMessage.path??this.refinePath??[],message:t}}return{code:"custom",path:this.refinePath??[],message:"string"==typeof this.customMessage?this.customMessage:"Refinement check failed"}}parse(e){const s=this.baseValidator.parse(e),r=this.predicate(s);if(i(r))throw new Error("Use parseAsync for async refinements");if(!r)throw new t([this._createIssue(s)]);return s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const s=await this.baseValidator.parseAsync(e);if(!await this.predicate(s))throw new t([this._createIssue(s)]);return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldRefine(e,this.predicate,this.customMessage)}min(e,t){return this._wrap(this.baseValidator.min?.(e,t)??this.baseValidator)}max(e,t){return this._wrap(this.baseValidator.max?.(e,t)??this.baseValidator)}length(e,t){return this._wrap(this.baseValidator.length?.(e,t)??this.baseValidator)}email(e){return this._wrap(this.baseValidator.email?.(e)??this.baseValidator)}url(e){return this._wrap(this.baseValidator.url?.(e)??this.baseValidator)}uuid(e){return this._wrap(this.baseValidator.uuid?.(e)??this.baseValidator)}regex(e,t){return this._wrap(this.baseValidator.regex?.(e,t)??this.baseValidator)}startsWith(e,t){return this._wrap(this.baseValidator.startsWith?.(e,t)??this.baseValidator)}endsWith(e,t){return this._wrap(this.baseValidator.endsWith?.(e,t)??this.baseValidator)}includes(e,t){return this._wrap(this.baseValidator.includes?.(e,t)??this.baseValidator)}ip(e){return this._wrap(this.baseValidator.ip?.(e)??this.baseValidator)}ipv4(e){return this._wrap(this.baseValidator.ipv4?.(e)??this.baseValidator)}ipv6(e){return this._wrap(this.baseValidator.ipv6?.(e)??this.baseValidator)}nonempty(e){return this._wrap(this.baseValidator.nonempty?.(e)??this.baseValidator)}trim(){return this._wrap(this.baseValidator.trim?.()??this.baseValidator)}toLowerCase(){return this._wrap(this.baseValidator.toLowerCase?.()??this.baseValidator)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this.baseValidator.toUpperCase?.()??this.baseValidator)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this.baseValidator.positive?.(e)??this.baseValidator)}negative(e){return this._wrap(this.baseValidator.negative?.(e)??this.baseValidator)}nonnegative(e){return this._wrap(this.baseValidator.nonnegative?.(e)??this.baseValidator)}nonpositive(e){return this._wrap(this.baseValidator.nonpositive?.(e)??this.baseValidator)}int(e){return this._wrap(this.baseValidator.int?.(e)??this.baseValidator)}finite(e){return this._wrap(this.baseValidator.finite?.(e)??this.baseValidator)}safe(e){return this._wrap(this.baseValidator.safe?.(e)??this.baseValidator)}multipleOf(e,t){return this._wrap(this.baseValidator.multipleOf?.(e,t)??this.baseValidator)}step(e,t){return this._wrap(this.baseValidator.step?.(e,t)??this.baseValidator)}gt(e,t){return this._wrap(this.baseValidator.gt?.(e,t)??this.baseValidator)}gte(e,t){return this._wrap(this.baseValidator.gte?.(e,t)??this.baseValidator)}lt(e,t){return this._wrap(this.baseValidator.lt?.(e,t)??this.baseValidator)}lte(e,t){return this._wrap(this.baseValidator.lte?.(e,t)??this.baseValidator)}extend(e){return this._wrap(this.baseValidator.extend?.(e)??this.baseValidator)}merge(e){return this._wrap(this.baseValidator.merge?.(e)??this.baseValidator)}pick(...e){return this._wrap(this.baseValidator.pick?.(...e)??this.baseValidator)}omit(...e){return this._wrap(this.baseValidator.omit?.(...e)??this.baseValidator)}partial(){return this._wrap(this.baseValidator.partial?.()??this.baseValidator)}required(){return this._wrap(this.baseValidator.required?.()??this.baseValidator)}strict(e){return this._wrap(this.baseValidator.strict?.(e)??this.baseValidator)}passthrough(){return this._wrap(this.baseValidator.passthrough?.()??this.baseValidator)}strip(){return this._wrap(this.baseValidator.strip?.()??this.baseValidator)}catchall(e){return this._wrap(this.baseValidator.catchall?.(e)??this.baseValidator)}get shape(){return this.baseValidator.shape}get keyof(){return this.baseValidator.keyof}unwrap(){return this.baseValidator.unwrap?this.baseValidator.unwrap():this.baseValidator}get element(){return this.baseValidator.element}}class VldTransform extends VldBase{constructor(e,t){super(r.TRANSFORM),this.baseValidator=e,this.transformer=t}parse(e){const t=this.baseValidator.parse(e);try{const e=this.transformer(t);if(i(e))throw new Error("Use parseAsync for async transforms");return e}catch(e){throw new Error(`Transform failed: ${e.message}`)}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const t=await this.baseValidator.parseAsync(e);try{return await this.transformer(t)}catch(e){throw new Error(`Transform failed: ${e.message}`)}}}class VldDefault extends VldBase{constructor(e,t){super(r.DEFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?h(this.defaultValue):this.baseValidator.parse(e)}safeParse(e){return void 0===e?{success:!0,data:h(this.defaultValue)}:this.baseValidator.safeParse(e)}prefault(e){return new VldPrefault(this.baseValidator,void 0===e?this.defaultValue:e)}unwrap(){return this.baseValidator}removeDefault(){return this.baseValidator}}class VldPrefault extends VldBase{constructor(e,t){super(r.PREFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?this.baseValidator.parse(h(this.defaultValue)):this.baseValidator.parse(e)}safeParse(e){return void 0===e?this.baseValidator.safeParse(h(this.defaultValue)):this.baseValidator.safeParse(e)}prefault(e){return void 0===e?this:new VldPrefault(this.baseValidator,e)}unwrap(){return this.baseValidator}}class VldCatch extends VldBase{constructor(e,t){super(r.CATCH),this.baseValidator=e,this.fallbackValue=t,this.simpleMode=u(e);const s=e.safeParse(t);if(!s.success)throw new Error(`Invalid fallback value: ${s.error.message}`)}parse(e){const t=l(this.simpleMode,e);if(void 0!==t)return t;if(void 0!==this.simpleMode)return this.fallbackValue;try{return this.baseValidator.parse(e)}catch{return this.fallbackValue}}safeParse(e){const t=l(this.simpleMode,e);if(void 0!==t)return{success:!0,data:t};if(void 0!==this.simpleMode)return{success:!0,data:this.fallbackValue};const s=this.baseValidator.safeParse(e);return s.success?s:{success:!0,data:this.fallbackValue}}}class VldOptional extends VldBase{constructor(e){super(r.OPTIONAL),this.baseValidator=e,this.simpleMode=u(e)}parseSimpleValue(e){return l(this.simpleMode,e)}static create(e){return new VldOptional(e)}parse(e){if(void 0===e)return;const t=this.parseSimpleValue(e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=this.parseSimpleValue(e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldExactOptional extends VldBase{constructor(e){super(r.EXACT_OPTIONAL),this.baseValidator=e,this.simpleMode=u(e)}static create(e){return new VldExactOptional(e)}parse(e){if(void 0===e)return;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullable extends VldBase{constructor(e){super(r.NULLABLE),this.baseValidator=e,this.simpleMode=u(e)}static create(e){return new VldNullable(e)}parse(e){if(null===e)return null;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null===e)return{success:!0,data:null};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullish extends VldBase{constructor(e){super(r.NULLISH),this.baseValidator=e,this.simpleMode=u(e)}static create(e){return new VldNullish(e)}parse(e){if(null==e)return e;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null==e)return{success:!0,data:e};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldPipe extends VldBase{constructor(e,t){super(r.PIPE),this.first=e,this.second=t}parse(e){const t=this.first.parse(e);return this.second.parse(t)}safeParse(e){const t=this.first.safeParse(e);return t.success?this.second.safeParse(t.data):{success:!1,error:t.error}}}class VldSuperRefine extends VldBase{constructor(e,t){super(r.SUPER_REFINE),this._inner=e,this._refinement=t}parse(e){const s=this._inner.parse(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(s,a)instanceof Promise)throw new Error("Use parseAsync for async refinements");if(r.length>0)throw new t(r,r.map(e=>e.message).join("; "));return s}safeParse(e){const r=this._inner.safeParse(e);if(!r.success)return{success:!1,error:s(r.error)};const a=[],i={addIssue:e=>{a.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(r.data,i)instanceof Promise)throw new Error("Use safeParseAsync for async refinements");return a.length>0?{success:!1,error:new t(a,a.map(e=>e.message).join("; "))}:r}async parseAsync(e){const s=await this._inner.parseAsync(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(await this._refinement(s,a),r.length>0)throw new t(r,r.map(e=>e.message).join("; "));return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldSuperRefine(e,this._refinement)}min(e,t){return this._wrap(this._inner.min?.(e,t)??this._inner)}max(e,t){return this._wrap(this._inner.max?.(e,t)??this._inner)}length(e,t){return this._wrap(this._inner.length?.(e,t)??this._inner)}email(e){return this._wrap(this._inner.email?.(e)??this._inner)}url(e){return this._wrap(this._inner.url?.(e)??this._inner)}uuid(e){return this._wrap(this._inner.uuid?.(e)??this._inner)}regex(e,t){return this._wrap(this._inner.regex?.(e,t)??this._inner)}startsWith(e,t){return this._wrap(this._inner.startsWith?.(e,t)??this._inner)}endsWith(e,t){return this._wrap(this._inner.endsWith?.(e,t)??this._inner)}includes(e,t){return this._wrap(this._inner.includes?.(e,t)??this._inner)}ip(e){return this._wrap(this._inner.ip?.(e)??this._inner)}ipv4(e){return this._wrap(this._inner.ipv4?.(e)??this._inner)}ipv6(e){return this._wrap(this._inner.ipv6?.(e)??this._inner)}nonempty(e){return this._wrap(this._inner.nonempty?.(e)??this._inner)}trim(){return this._wrap(this._inner.trim?.()??this._inner)}toLowerCase(){return this._wrap(this._inner.toLowerCase?.()??this._inner)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this._inner.toUpperCase?.()??this._inner)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this._inner.positive?.(e)??this._inner)}negative(e){return this._wrap(this._inner.negative?.(e)??this._inner)}nonnegative(e){return this._wrap(this._inner.nonnegative?.(e)??this._inner)}nonpositive(e){return this._wrap(this._inner.nonpositive?.(e)??this._inner)}int(e){return this._wrap(this._inner.int?.(e)??this._inner)}finite(e){return this._wrap(this._inner.finite?.(e)??this._inner)}safe(e){return this._wrap(this._inner.safe?.(e)??this._inner)}multipleOf(e,t){return this._wrap(this._inner.multipleOf?.(e,t)??this._inner)}step(e,t){return this._wrap(this._inner.step?.(e,t)??this._inner)}gt(e,t){return this._wrap(this._inner.gt?.(e,t)??this._inner)}gte(e,t){return this._wrap(this._inner.gte?.(e,t)??this._inner)}lt(e,t){return this._wrap(this._inner.lt?.(e,t)??this._inner)}lte(e,t){return this._wrap(this._inner.lte?.(e,t)??this._inner)}extend(e){return this._wrap(this._inner.extend?.(e)??this._inner)}merge(e){return this._wrap(this._inner.merge?.(e)??this._inner)}pick(...e){return this._wrap(this._inner.pick?.(...e)??this._inner)}omit(...e){return this._wrap(this._inner.omit?.(...e)??this._inner)}partial(){return this._wrap(this._inner.partial?.()??this._inner)}required(){return this._wrap(this._inner.required?.()??this._inner)}strict(e){return this._wrap(this._inner.strict?.(e)??this._inner)}passthrough(){return this._wrap(this._inner.passthrough?.()??this._inner)}strip(){return this._wrap(this._inner.strip?.()??this._inner)}catchall(e){return this._wrap(this._inner.catchall?.(e)??this._inner)}get shape(){return this._inner.shape}get keyof(){return this._inner.keyof}unwrap(){return this._inner.unwrap?this._inner.unwrap():this._inner}get element(){return this._inner.element}}class VldPreprocess extends VldBase{constructor(e,t){super(r.PREPROCESS),this._preprocessor=e,this._schema=t}static create(e,t){return new VldPreprocess(e,t)}parse(e){const t=this._preprocessor(e);return this._schema.parse(t)}safeParse(e){try{const t=this._preprocessor(e);return this._schema.safeParse(t)}catch(e){return{success:!1,error:s(e)}}}}export{r as VLD_VALIDATOR_TYPES,VldBase,VldBrand,VldCatch,VldDefault,VldExactOptional,VldMeta,VldNullable,VldNullish,VldOptional,VldPipe,VldPrefault,VldPreprocess,VldReadonly,VldRefine,VldSuperRefine,VldTransform,o as configureSchemaCompositionFactories,s as ensureVldError,i as isPromiseLike,a as resolveErrorMessage};
|
|
1
|
+
import{globalRegistry as e}from"../registry.js";import{V as t}from"../chunks/errors-core-BU14-Dk8.js";function s(e){if(e instanceof t)return e;const s=e instanceof Error?e.message:String(e);return new t([{code:"custom",path:[],message:s}])}const r={STRING:"string",STRING_FORMAT:"stringFormat",STRING_BOOL:"stringBool",NUMBER:"number",BOOLEAN:"boolean",DATE:"date",BIGINT:"bigint",UNDEFINED:"undefined",NULL:"null",UNKNOWN:"unknown",ANY:"any",VOID:"void",NEVER:"never",SYMBOL:"symbol",NAN:"nan",HEX:"hex",BASE64:"base64",UINT8_ARRAY:"uint8Array",COERCE_STRING:"coerceString",COERCE_NUMBER:"coerceNumber",COERCE_BOOLEAN:"coerceBoolean",COERCE_DATE:"coerceDate",COERCE_BIGINT:"coerceBigint",OBJECT:"object",ARRAY:"array",TUPLE:"tuple",SET:"set",MAP:"map",RECORD:"record",UNION:"union",DISCRIMINATED_UNION:"discriminatedUnion",INTERSECTION:"intersection",XOR:"xor",ENUM:"enum",LITERAL:"literal",LAZY:"lazy",CUSTOM:"custom",FUNCTION:"function",FILE:"file",JSON:"json",TEMPLATE_LITERAL:"templateLiteral",PROMISE:"promise",OPTIONAL:"optional",NULLABLE:"nullable",NULLISH:"nullish",EXACT_OPTIONAL:"exactOptional",DEFAULT:"default",CATCH:"catch",REFINE:"refine",TRANSFORM:"transform",PIPE:"pipe",PREPROCESS:"preprocess",SUPER_REFINE:"superRefine",BRAND:"brand",READONLY:"readonly",META:"meta",PREFAULT:"prefault",PREFault:"prefault",CODEC:"codec"};function a(e,t){if("string"==typeof e)return e;if("function"==typeof e){const s=e(void 0);return"string"==typeof s?s:"object"==typeof s&&s?.message?s.message:t}if("object"==typeof e&&null!==e){if("string"==typeof e.error)return e.error;if("function"==typeof e.error)return e.error({})||t;if("string"==typeof e.message)return e.message}return t}function i(e){return null!==e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}let n;function o(e){n=e}function h(e){return"function"==typeof e?e():function(e){if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(null!==e&&"object"==typeof e){const t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return{...e}}return e}(e)}function u(e){if(!0===e.isSimple)switch(e.validatorType){case r.STRING:return"string";case r.NUMBER:return"number";case r.BOOLEAN:return"boolean";case r.BIGINT:return"bigint";case r.SYMBOL:return"symbol";default:return}}function l(e,t){switch(e){case"string":return"string"==typeof t?t:void 0;case"number":return"number"!=typeof t||isNaN(t)?void 0:t;case"boolean":return"boolean"==typeof t?t:void 0;case"bigint":return"bigint"==typeof t?t:void 0;case"symbol":return"symbol"==typeof t?t:void 0;default:return}}class VldBase{constructor(e="unknown"){this.validatorType=e}get type(){return this.validatorType}get _def(){return{typeName:"Zod"+this.validatorType.charAt(0).toUpperCase()+this.validatorType.slice(1),...this.config||{}}}get def(){return this._def}get _zod(){return this._def}get"~standard"(){return{version:1,vendor:"vld",validate:e=>{const t=this.safeParse(e);return t.success?{value:t.data}:{issues:[{message:t.error.message}]}},types:void 0}}async parseAsync(e){return this.parse(e)}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}decode(e){return this.parse(e)}safeDecode(e){return this.safeParse(e)}async decodeAsync(e){return this.parseAsync(e)}async safeDecodeAsync(e){return this.safeParseAsync(e)}encode(e){return this.parse(e)}safeEncode(e){const t=this.safeParse(e);return t.success?{success:!0,data:t.data}:t}async encodeAsync(e){return this.parseAsync(e)}async safeEncodeAsync(e){const t=await this.safeParseAsync(e);return t.success?{success:!0,data:t.data}:t}spa(e){return this.safeParseAsync(e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}clone(){return this}isValid(e){return this.safeParse(e).success}parseOrDefault(e,t){const s=this.safeParse(e);if(s.success)return s.data;const r=this.safeParse(t);if(!r.success)throw new Error(`Invalid default value provided: ${r.error.message}`);return r.data}refine(e,t){return new VldRefine(this,e,t)}superRefine(e){return new VldSuperRefine(this,e)}transform(e){return new VldTransform(this,e)}default(e){return new VldDefault(this,e)}prefault(e){return new VldPrefault(this,e)}nonoptional(e){return new VldRefine(this,e=>void 0!==e,a(e,"Expected non-optional value"))}array(){return n.array(this)}or(e){return n.union(this,e)}and(e){return n.intersection(this,e)}overwrite(e){return new VldTransform(this,e)}with(...e){return new VldSuperRefine(this,(t,s)=>{const r={value:t,issues:[]},a=[];for(const t of e){const e="function"==typeof t?t:t._zod?.check;if(!e)continue;const s=e(r);i(s)&&a.push(Promise.resolve(s))}const n=()=>{for(const e of r.issues)s.addIssue(void 0===e.code?{message:e.message||"Custom check failed"}:{message:e.message||"Custom check failed",code:e.code})};if(a.length>0)return Promise.all(a).then(n);n()})}toJSONSchema(e){return n.toJSONSchema(this,e)}catch(e){return new VldCatch(this,e)}optional(){return new VldOptional(this)}nullable(){return new VldNullable(this)}nullish(){return new VldNullish(this)}exactOptional(){return new VldExactOptional(this)}pipe(e){return new VldPipe(this,e)}readonly(){return new VldReadonly(this)}brand(){return new VldBrand(this)}apply(e){return e(this)}check(e,t){return this.refine(e,t)}meta(t){if(void 0===t)return e.get(this)??this.baseValidator?.meta?.()??this.schema?.meta?.()??this.inner?.meta?.();const s=new VldMeta(this,t);return e.add(s,t),s}register(e,t){return e.add(this,t),this}describe(e){return this.meta({description:e})}get description(){return this.meta()?.description??this.baseValidator?.description??this.schema?.description??this.inner?.description}}class VldMeta extends VldBase{constructor(e,t){super(r.META),this.baseValidator=e,this.metadata=t}parse(e){return this.baseValidator.parse(e)}safeParse(e){return this.baseValidator.safeParse(e)}getMeta(){return{...this.metadata}}meta(t){if(void 0===t)return{...this.metadata,...e.get(this)};const s=new VldMeta(this.baseValidator,{...this.metadata,...t});return e.add(s,s.getMeta()),s}describe(e){return this.meta({description:e})}}class VldReadonly extends VldBase{constructor(e){super(r.READONLY),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldBrand extends VldBase{constructor(e){super(r.BRAND),this.baseValidator=e}parse(e){return this.baseValidator.parse(e)}safeParse(e){const t=this.baseValidator.safeParse(e);return t.success?{success:!0,data:t.data}:{success:!1,error:t.error}}}class VldRefine extends VldBase{constructor(e,t,s){super(r.REFINE),this.baseValidator=e,this.predicate=t,this.customMessage=s??"Refinement check failed","object"==typeof s&&null!==s&&"path"in s&&Array.isArray(s.path)&&(this.refinePath=s.path)}_createIssue(e){if("function"==typeof this.customMessage){const t=this.customMessage(e);return"string"==typeof t?{code:"custom",path:this.refinePath??[],message:t}:{code:"custom",path:t?.path??this.refinePath??[],message:t?.message??"Refinement check failed"}}if("object"==typeof this.customMessage&&null!==this.customMessage){const e=this.customMessage.message??this.customMessage.error,t="function"==typeof e?e({}):"string"==typeof e?e:"Refinement check failed";return{code:"custom",path:this.customMessage.path??this.refinePath??[],message:t}}return{code:"custom",path:this.refinePath??[],message:"string"==typeof this.customMessage?this.customMessage:"Refinement check failed"}}parse(e){const s=this.baseValidator.parse(e),r=this.predicate(s);if(i(r))throw new Error("Use parseAsync for async refinements");if(!r)throw new t([this._createIssue(s)]);return s}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const s=await this.baseValidator.parseAsync(e);if(!await this.predicate(s))throw new t([this._createIssue(s)]);return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldRefine(e,this.predicate,this.customMessage)}min(e,t){return this._wrap(this.baseValidator.min?.(e,t)??this.baseValidator)}max(e,t){return this._wrap(this.baseValidator.max?.(e,t)??this.baseValidator)}length(e,t){return this._wrap(this.baseValidator.length?.(e,t)??this.baseValidator)}email(e){return this._wrap(this.baseValidator.email?.(e)??this.baseValidator)}url(e){return this._wrap(this.baseValidator.url?.(e)??this.baseValidator)}uuid(e){return this._wrap(this.baseValidator.uuid?.(e)??this.baseValidator)}regex(e,t){return this._wrap(this.baseValidator.regex?.(e,t)??this.baseValidator)}startsWith(e,t){return this._wrap(this.baseValidator.startsWith?.(e,t)??this.baseValidator)}endsWith(e,t){return this._wrap(this.baseValidator.endsWith?.(e,t)??this.baseValidator)}includes(e,t){return this._wrap(this.baseValidator.includes?.(e,t)??this.baseValidator)}ip(e){return this._wrap(this.baseValidator.ip?.(e)??this.baseValidator)}ipv4(e){return this._wrap(this.baseValidator.ipv4?.(e)??this.baseValidator)}ipv6(e){return this._wrap(this.baseValidator.ipv6?.(e)??this.baseValidator)}nonempty(e){return this._wrap(this.baseValidator.nonempty?.(e)??this.baseValidator)}trim(){return this._wrap(this.baseValidator.trim?.()??this.baseValidator)}toLowerCase(){return this._wrap(this.baseValidator.toLowerCase?.()??this.baseValidator)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this.baseValidator.toUpperCase?.()??this.baseValidator)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this.baseValidator.positive?.(e)??this.baseValidator)}negative(e){return this._wrap(this.baseValidator.negative?.(e)??this.baseValidator)}nonnegative(e){return this._wrap(this.baseValidator.nonnegative?.(e)??this.baseValidator)}nonpositive(e){return this._wrap(this.baseValidator.nonpositive?.(e)??this.baseValidator)}int(e){return this._wrap(this.baseValidator.int?.(e)??this.baseValidator)}finite(e){return this._wrap(this.baseValidator.finite?.(e)??this.baseValidator)}safe(e){return this._wrap(this.baseValidator.safe?.(e)??this.baseValidator)}multipleOf(e,t){return this._wrap(this.baseValidator.multipleOf?.(e,t)??this.baseValidator)}step(e,t){return this._wrap(this.baseValidator.step?.(e,t)??this.baseValidator)}gt(e,t){return this._wrap(this.baseValidator.gt?.(e,t)??this.baseValidator)}gte(e,t){return this._wrap(this.baseValidator.gte?.(e,t)??this.baseValidator)}lt(e,t){return this._wrap(this.baseValidator.lt?.(e,t)??this.baseValidator)}lte(e,t){return this._wrap(this.baseValidator.lte?.(e,t)??this.baseValidator)}extend(e){return this._wrap(this.baseValidator.extend?.(e)??this.baseValidator)}merge(e){return this._wrap(this.baseValidator.merge?.(e)??this.baseValidator)}pick(...e){return this._wrap(this.baseValidator.pick?.(...e)??this.baseValidator)}omit(...e){return this._wrap(this.baseValidator.omit?.(...e)??this.baseValidator)}partial(){return this._wrap(this.baseValidator.partial?.()??this.baseValidator)}required(){return this._wrap(this.baseValidator.required?.()??this.baseValidator)}strict(e){return this._wrap(this.baseValidator.strict?.(e)??this.baseValidator)}passthrough(){return this._wrap(this.baseValidator.passthrough?.()??this.baseValidator)}strip(){return this._wrap(this.baseValidator.strip?.()??this.baseValidator)}catchall(e){return this._wrap(this.baseValidator.catchall?.(e)??this.baseValidator)}get shape(){return this.baseValidator.shape}get keyof(){return this.baseValidator.keyof}unwrap(){return this.baseValidator.unwrap?this.baseValidator.unwrap():this.baseValidator}get element(){return this.baseValidator.element}}class VldTransform extends VldBase{constructor(e,t){super(r.TRANSFORM),this.baseValidator=e,this.transformer=t}parse(e){const t=this.baseValidator.parse(e);try{const e=this.transformer(t);if(i(e))throw new Error("Use parseAsync for async transforms");return e}catch(e){throw new Error(`Transform failed: ${e.message}`)}}safeParse(e){try{return{success:!0,data:this.parse(e)}}catch(e){return{success:!1,error:s(e)}}}async parseAsync(e){const t=await this.baseValidator.parseAsync(e);try{return await this.transformer(t)}catch(e){throw new Error(`Transform failed: ${e.message}`)}}}class VldDefault extends VldBase{constructor(e,t){super(r.DEFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?h(this.defaultValue):this.baseValidator.parse(e)}safeParse(e){return void 0===e?{success:!0,data:h(this.defaultValue)}:this.baseValidator.safeParse(e)}prefault(e){return new VldPrefault(this.baseValidator,void 0===e?this.defaultValue:e)}unwrap(){return this.baseValidator}removeDefault(){return this.baseValidator}}class VldPrefault extends VldBase{constructor(e,t){super(r.PREFAULT),this.baseValidator=e,this.defaultValue=t}parse(e){return void 0===e?this.baseValidator.parse(h(this.defaultValue)):this.baseValidator.parse(e)}safeParse(e){return void 0===e?this.baseValidator.safeParse(h(this.defaultValue)):this.baseValidator.safeParse(e)}prefault(e){return void 0===e?this:new VldPrefault(this.baseValidator,e)}unwrap(){return this.baseValidator}}class VldCatch extends VldBase{constructor(e,t){super(r.CATCH),this.baseValidator=e,this.fallbackValue=t,this.simpleMode=u(e);const s=e.safeParse(t);if(!s.success)throw new Error(`Invalid fallback value: ${s.error.message}`)}parse(e){const t=l(this.simpleMode,e);if(void 0!==t)return t;if(void 0!==this.simpleMode)return this.fallbackValue;try{return this.baseValidator.parse(e)}catch{return this.fallbackValue}}safeParse(e){const t=l(this.simpleMode,e);if(void 0!==t)return{success:!0,data:t};if(void 0!==this.simpleMode)return{success:!0,data:this.fallbackValue};const s=this.baseValidator.safeParse(e);return s.success?s:{success:!0,data:this.fallbackValue}}}class VldOptional extends VldBase{constructor(e){super(r.OPTIONAL),this.baseValidator=e,this.simpleMode=u(e)}parseSimpleValue(e){return l(this.simpleMode,e)}static create(e){return new VldOptional(e)}parse(e){if(void 0===e)return;const t=this.parseSimpleValue(e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=this.parseSimpleValue(e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldExactOptional extends VldBase{constructor(e){super(r.EXACT_OPTIONAL),this.baseValidator=e,this.simpleMode=u(e)}static create(e){return new VldExactOptional(e)}parse(e){if(void 0===e)return;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(void 0===e)return{success:!0,data:void 0};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullable extends VldBase{constructor(e){super(r.NULLABLE),this.baseValidator=e,this.simpleMode=u(e)}static create(e){return new VldNullable(e)}parse(e){if(null===e)return null;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null===e)return{success:!0,data:null};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldNullish extends VldBase{constructor(e){super(r.NULLISH),this.baseValidator=e,this.simpleMode=u(e)}static create(e){return new VldNullish(e)}parse(e){if(null==e)return e;const t=l(this.simpleMode,e);return void 0!==t?t:this.baseValidator.parse(e)}safeParse(e){if(null==e)return{success:!0,data:e};const t=l(this.simpleMode,e);return void 0!==t?{success:!0,data:t}:this.baseValidator.safeParse(e)}unwrap(){return this.baseValidator}}class VldPipe extends VldBase{constructor(e,t){super(r.PIPE),this.first=e,this.second=t}parse(e){const t=this.first.parse(e);return this.second.parse(t)}safeParse(e){const t=this.first.safeParse(e);return t.success?this.second.safeParse(t.data):{success:!1,error:t.error}}}class VldSuperRefine extends VldBase{constructor(e,t){super(r.SUPER_REFINE),this._inner=e,this._refinement=t}parse(e){const s=this._inner.parse(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(s,a)instanceof Promise)throw new Error("Use parseAsync for async refinements");if(r.length>0)throw new t(r,r.map(e=>e.message).join("; "));return s}safeParse(e){const r=this._inner.safeParse(e);if(!r.success)return{success:!1,error:s(r.error)};const a=[],i={addIssue:e=>{a.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(this._refinement(r.data,i)instanceof Promise)throw new Error("Use safeParseAsync for async refinements");return a.length>0?{success:!1,error:new t(a,a.map(e=>e.message).join("; "))}:r}async parseAsync(e){const s=await this._inner.parseAsync(e),r=[],a={addIssue:e=>{r.push({code:e.code||"custom",path:e.path??[],message:e.message||"Validation error"})},path:[]};if(await this._refinement(s,a),r.length>0)throw new t(r,r.map(e=>e.message).join("; "));return s}async safeParseAsync(e){try{return{success:!0,data:await this.parseAsync(e)}}catch(e){return{success:!1,error:s(e)}}}_wrap(e){return new VldSuperRefine(e,this._refinement)}min(e,t){return this._wrap(this._inner.min?.(e,t)??this._inner)}max(e,t){return this._wrap(this._inner.max?.(e,t)??this._inner)}length(e,t){return this._wrap(this._inner.length?.(e,t)??this._inner)}email(e){return this._wrap(this._inner.email?.(e)??this._inner)}url(e){return this._wrap(this._inner.url?.(e)??this._inner)}uuid(e){return this._wrap(this._inner.uuid?.(e)??this._inner)}regex(e,t){return this._wrap(this._inner.regex?.(e,t)??this._inner)}startsWith(e,t){return this._wrap(this._inner.startsWith?.(e,t)??this._inner)}endsWith(e,t){return this._wrap(this._inner.endsWith?.(e,t)??this._inner)}includes(e,t){return this._wrap(this._inner.includes?.(e,t)??this._inner)}ip(e){return this._wrap(this._inner.ip?.(e)??this._inner)}ipv4(e){return this._wrap(this._inner.ipv4?.(e)??this._inner)}ipv6(e){return this._wrap(this._inner.ipv6?.(e)??this._inner)}nonempty(e){return this._wrap(this._inner.nonempty?.(e)??this._inner)}trim(){return this._wrap(this._inner.trim?.()??this._inner)}toLowerCase(){return this._wrap(this._inner.toLowerCase?.()??this._inner)}lowercase(){return this.toLowerCase()}toUpperCase(){return this._wrap(this._inner.toUpperCase?.()??this._inner)}uppercase(){return this.toUpperCase()}positive(e){return this._wrap(this._inner.positive?.(e)??this._inner)}negative(e){return this._wrap(this._inner.negative?.(e)??this._inner)}nonnegative(e){return this._wrap(this._inner.nonnegative?.(e)??this._inner)}nonpositive(e){return this._wrap(this._inner.nonpositive?.(e)??this._inner)}int(e){return this._wrap(this._inner.int?.(e)??this._inner)}finite(e){return this._wrap(this._inner.finite?.(e)??this._inner)}safe(e){return this._wrap(this._inner.safe?.(e)??this._inner)}multipleOf(e,t){return this._wrap(this._inner.multipleOf?.(e,t)??this._inner)}step(e,t){return this._wrap(this._inner.step?.(e,t)??this._inner)}gt(e,t){return this._wrap(this._inner.gt?.(e,t)??this._inner)}gte(e,t){return this._wrap(this._inner.gte?.(e,t)??this._inner)}lt(e,t){return this._wrap(this._inner.lt?.(e,t)??this._inner)}lte(e,t){return this._wrap(this._inner.lte?.(e,t)??this._inner)}extend(e){return this._wrap(this._inner.extend?.(e)??this._inner)}merge(e){return this._wrap(this._inner.merge?.(e)??this._inner)}pick(...e){return this._wrap(this._inner.pick?.(...e)??this._inner)}omit(...e){return this._wrap(this._inner.omit?.(...e)??this._inner)}partial(){return this._wrap(this._inner.partial?.()??this._inner)}required(){return this._wrap(this._inner.required?.()??this._inner)}strict(e){return this._wrap(this._inner.strict?.(e)??this._inner)}passthrough(){return this._wrap(this._inner.passthrough?.()??this._inner)}strip(){return this._wrap(this._inner.strip?.()??this._inner)}catchall(e){return this._wrap(this._inner.catchall?.(e)??this._inner)}get shape(){return this._inner.shape}get keyof(){return this._inner.keyof}unwrap(){return this._inner.unwrap?this._inner.unwrap():this._inner}get element(){return this._inner.element}}class VldPreprocess extends VldBase{constructor(e,t){super(r.PREPROCESS),this._preprocessor=e,this._schema=t}static create(e,t){return new VldPreprocess(e,t)}parse(e){const t=this._preprocessor(e);return this._schema.parse(t)}safeParse(e){try{const t=this._preprocessor(e);return this._schema.safeParse(t)}catch(e){return{success:!1,error:s(e)}}}}export{r as VLD_VALIDATOR_TYPES,VldBase,VldBrand,VldCatch,VldDefault,VldExactOptional,VldMeta,VldNullable,VldNullish,VldOptional,VldPipe,VldPrefault,VldPreprocess,VldReadonly,VldRefine,VldSuperRefine,VldTransform,o as configureSchemaCompositionFactories,s as ensureVldError,i as isPromiseLike,a as resolveErrorMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VldBase as e,VLD_VALIDATOR_TYPES as s}from"./base.js";import{createIssue as r}from"../errors.js";import{getMessages as t}from"../locales/runtime.js";import{V as a}from"../chunks/errors-core-
|
|
1
|
+
import{VldBase as e,VLD_VALIDATOR_TYPES as s}from"./base.js";import{createIssue as r}from"../errors.js";import{getMessages as t}from"../locales/runtime.js";import{V as a}from"../chunks/errors-core-BU14-Dk8.js";class VldBase64 extends e{constructor(e=!1){super(s.BASE64),this.urlSafe=e}parse(e){const s=this.safeParse(e);if(!s.success)throw s.error;return s.data}safeParse(e){if("string"!=typeof e)return{success:!1,error:new a([r("invalid_type",[],t().expectedString)])};return(this.urlSafe?VldBase64.BASE64_URL_REGEX:VldBase64.BASE64_REGEX).test(e)?!this.urlSafe&&e.length>0&&e.length%4!=0?{success:!1,error:new a([r("custom",[],t().invalidBase64)])}:{success:!0,data:e}:{success:!1,error:new a([r("custom",[],t().invalidBase64)])}}urlSafeMode(){return new VldBase64(!0)}static create(e=!1){return new VldBase64(e)}}VldBase64.BASE64_REGEX=/^[A-Za-z0-9+/]*={0,2}$/,VldBase64.BASE64_URL_REGEX=/^[A-Za-z0-9_-]*={0,2}$/;export{VldBase64};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VldBigIntV2 — OPTIMIZED: check returns Issue | null.
|
|
3
|
+
*/
|
|
4
|
+
import { VldBase, type ErrorParam, type ParseResult } from './base.js';
|
|
5
|
+
import { type VldIssue } from '../errors-core.js';
|
|
6
|
+
export declare abstract class VldBigIntCheck {
|
|
7
|
+
abstract readonly kind: 'min' | 'max' | 'gt' | 'lt' | 'multipleOf' | 'positive' | 'negative' | 'nonnegative' | 'nonpositive';
|
|
8
|
+
abstract check(value: bigint): VldIssue | null;
|
|
9
|
+
abstract meta(): Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
export declare class VldBigIntCheckMin extends VldBigIntCheck {
|
|
12
|
+
private _msg?;
|
|
13
|
+
readonly kind: "min";
|
|
14
|
+
private _threshold;
|
|
15
|
+
constructor(threshold: bigint | number | string, _msg?: string | undefined);
|
|
16
|
+
check(value: bigint): VldIssue | null;
|
|
17
|
+
meta(): {
|
|
18
|
+
kind: string;
|
|
19
|
+
value: bigint;
|
|
20
|
+
message: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare class VldBigIntCheckMax extends VldBigIntCheck {
|
|
24
|
+
private _msg?;
|
|
25
|
+
readonly kind: "max";
|
|
26
|
+
private _threshold;
|
|
27
|
+
constructor(threshold: bigint | number | string, _msg?: string | undefined);
|
|
28
|
+
check(value: bigint): VldIssue | null;
|
|
29
|
+
meta(): {
|
|
30
|
+
kind: string;
|
|
31
|
+
value: bigint;
|
|
32
|
+
message: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare class VldBigIntCheckGt extends VldBigIntCheck {
|
|
36
|
+
private _msg?;
|
|
37
|
+
readonly kind: "gt";
|
|
38
|
+
private _threshold;
|
|
39
|
+
constructor(threshold: bigint | number | string, _msg?: string | undefined);
|
|
40
|
+
check(value: bigint): VldIssue | null;
|
|
41
|
+
meta(): {
|
|
42
|
+
kind: string;
|
|
43
|
+
value: bigint;
|
|
44
|
+
message: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export declare class VldBigIntCheckLt extends VldBigIntCheck {
|
|
48
|
+
private _msg?;
|
|
49
|
+
readonly kind: "lt";
|
|
50
|
+
private _threshold;
|
|
51
|
+
constructor(threshold: bigint | number | string, _msg?: string | undefined);
|
|
52
|
+
check(value: bigint): VldIssue | null;
|
|
53
|
+
meta(): {
|
|
54
|
+
kind: string;
|
|
55
|
+
value: bigint;
|
|
56
|
+
message: string | undefined;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export declare class VldBigIntCheckMultipleOf extends VldBigIntCheck {
|
|
60
|
+
private _msg?;
|
|
61
|
+
readonly kind: "multipleOf";
|
|
62
|
+
private _divisor;
|
|
63
|
+
constructor(divisor: bigint | number | string, _msg?: string | undefined);
|
|
64
|
+
check(value: bigint): VldIssue | null;
|
|
65
|
+
meta(): {
|
|
66
|
+
kind: string;
|
|
67
|
+
value: bigint;
|
|
68
|
+
message: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export interface VldBigIntDef {
|
|
72
|
+
readonly type: 'bigint';
|
|
73
|
+
readonly checks: ReadonlyArray<VldBigIntCheck>;
|
|
74
|
+
readonly jsonSchema?: {
|
|
75
|
+
minimum?: string;
|
|
76
|
+
maximum?: string;
|
|
77
|
+
multipleOf?: string;
|
|
78
|
+
format?: string;
|
|
79
|
+
} | undefined;
|
|
80
|
+
readonly errorMessage?: string | undefined;
|
|
81
|
+
readonly isSimple: boolean;
|
|
82
|
+
}
|
|
83
|
+
export declare class VldBigIntV2 extends VldBase<bigint, bigint> {
|
|
84
|
+
readonly __def: VldBigIntDef;
|
|
85
|
+
constructor(def?: VldBigIntDef);
|
|
86
|
+
static create(): VldBigIntV2;
|
|
87
|
+
get isSimple(): boolean;
|
|
88
|
+
parse(value: unknown): bigint;
|
|
89
|
+
parseKnownBigInt(value: bigint): bigint;
|
|
90
|
+
safeParse(value: unknown): ParseResult<bigint>;
|
|
91
|
+
protected withDef(def: Partial<VldBigIntDef> & {
|
|
92
|
+
type: 'bigint';
|
|
93
|
+
}): VldBigIntV2;
|
|
94
|
+
min(value: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
95
|
+
max(value: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
96
|
+
positive(message?: ErrorParam): VldBigIntV2;
|
|
97
|
+
negative(message?: ErrorParam): VldBigIntV2;
|
|
98
|
+
nonnegative(message?: ErrorParam): VldBigIntV2;
|
|
99
|
+
nonpositive(message?: ErrorParam): VldBigIntV2;
|
|
100
|
+
gt(value: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
101
|
+
lt(value: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
102
|
+
gte(value: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
103
|
+
lte(value: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
104
|
+
multipleOf(divisor: bigint | number | string, message?: ErrorParam): VldBigIntV2;
|
|
105
|
+
}
|