@windrun-huaiin/backend-core 12.0.0 → 14.0.0
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/dist/_virtual/_commonjs-dynamic-modules.js +7 -0
- package/dist/_virtual/_commonjs-dynamic-modules.mjs +5 -0
- package/dist/_virtual/_commonjsHelpers.js +10 -0
- package/dist/_virtual/_commonjsHelpers.mjs +7 -0
- package/dist/_virtual/aes.js +5 -0
- package/dist/_virtual/aes.mjs +3 -0
- package/dist/_virtual/blowfish.js +5 -0
- package/dist/_virtual/blowfish.mjs +3 -0
- package/dist/_virtual/cipher-core.js +5 -0
- package/dist/_virtual/cipher-core.mjs +3 -0
- package/dist/_virtual/core.js +5 -0
- package/dist/_virtual/core.mjs +3 -0
- package/dist/_virtual/enc-base64.js +5 -0
- package/dist/_virtual/enc-base64.mjs +3 -0
- package/dist/_virtual/enc-base64url.js +5 -0
- package/dist/_virtual/enc-base64url.mjs +3 -0
- package/dist/_virtual/enc-utf16.js +5 -0
- package/dist/_virtual/enc-utf16.mjs +3 -0
- package/dist/_virtual/evpkdf.js +5 -0
- package/dist/_virtual/evpkdf.mjs +3 -0
- package/dist/_virtual/format-hex.js +5 -0
- package/dist/_virtual/format-hex.mjs +3 -0
- package/dist/_virtual/hmac.js +5 -0
- package/dist/_virtual/hmac.mjs +3 -0
- package/dist/_virtual/index.js +11 -0
- package/dist/_virtual/index.mjs +7 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.mjs +3 -0
- package/dist/_virtual/lib-typedarrays.js +5 -0
- package/dist/_virtual/lib-typedarrays.mjs +3 -0
- package/dist/_virtual/md5.js +5 -0
- package/dist/_virtual/md5.mjs +3 -0
- package/dist/_virtual/mode-cfb.js +5 -0
- package/dist/_virtual/mode-cfb.mjs +3 -0
- package/dist/_virtual/mode-ctr-gladman.js +5 -0
- package/dist/_virtual/mode-ctr-gladman.mjs +3 -0
- package/dist/_virtual/mode-ctr.js +5 -0
- package/dist/_virtual/mode-ctr.mjs +3 -0
- package/dist/_virtual/mode-ecb.js +5 -0
- package/dist/_virtual/mode-ecb.mjs +3 -0
- package/dist/_virtual/mode-ofb.js +5 -0
- package/dist/_virtual/mode-ofb.mjs +3 -0
- package/dist/_virtual/pad-ansix923.js +5 -0
- package/dist/_virtual/pad-ansix923.mjs +3 -0
- package/dist/_virtual/pad-iso10126.js +5 -0
- package/dist/_virtual/pad-iso10126.mjs +3 -0
- package/dist/_virtual/pad-iso97971.js +5 -0
- package/dist/_virtual/pad-iso97971.mjs +3 -0
- package/dist/_virtual/pad-nopadding.js +5 -0
- package/dist/_virtual/pad-nopadding.mjs +3 -0
- package/dist/_virtual/pad-zeropadding.js +5 -0
- package/dist/_virtual/pad-zeropadding.mjs +3 -0
- package/dist/_virtual/pbkdf2.js +5 -0
- package/dist/_virtual/pbkdf2.mjs +3 -0
- package/dist/_virtual/rabbit-legacy.js +5 -0
- package/dist/_virtual/rabbit-legacy.mjs +3 -0
- package/dist/_virtual/rabbit.js +5 -0
- package/dist/_virtual/rabbit.mjs +3 -0
- package/dist/_virtual/rc4.js +5 -0
- package/dist/_virtual/rc4.mjs +3 -0
- package/dist/_virtual/ripemd160.js +5 -0
- package/dist/_virtual/ripemd160.mjs +3 -0
- package/dist/_virtual/sha1.js +5 -0
- package/dist/_virtual/sha1.mjs +3 -0
- package/dist/_virtual/sha224.js +5 -0
- package/dist/_virtual/sha224.mjs +3 -0
- package/dist/_virtual/sha256.js +5 -0
- package/dist/_virtual/sha256.mjs +3 -0
- package/dist/_virtual/sha3.js +5 -0
- package/dist/_virtual/sha3.mjs +3 -0
- package/dist/_virtual/sha384.js +5 -0
- package/dist/_virtual/sha384.mjs +3 -0
- package/dist/_virtual/sha512.js +5 -0
- package/dist/_virtual/sha512.mjs +3 -0
- package/dist/_virtual/tripledes.js +5 -0
- package/dist/_virtual/tripledes.mjs +3 -0
- package/dist/_virtual/x64-core.js +5 -0
- package/dist/_virtual/x64-core.mjs +3 -0
- package/dist/index.js +48 -0
- package/dist/index.mjs +7 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +48 -0
- package/dist/lib/index.mjs +7 -0
- package/dist/lib/upstash/index.d.ts +7 -0
- package/dist/lib/upstash/index.d.ts.map +1 -0
- package/dist/lib/upstash/qstash.d.ts +36 -0
- package/dist/lib/upstash/qstash.d.ts.map +1 -0
- package/dist/lib/upstash/qstash.js +134 -0
- package/dist/lib/upstash/qstash.mjs +128 -0
- package/dist/lib/upstash/redis-counter.d.ts +17 -0
- package/dist/lib/upstash/redis-counter.d.ts.map +1 -0
- package/dist/lib/upstash/redis-counter.js +40 -0
- package/dist/lib/upstash/redis-counter.mjs +35 -0
- package/dist/lib/upstash/redis-favorite.d.ts +21 -0
- package/dist/lib/upstash/redis-favorite.d.ts.map +1 -0
- package/dist/lib/upstash/redis-favorite.js +60 -0
- package/dist/lib/upstash/redis-favorite.mjs +54 -0
- package/dist/lib/upstash/redis-like.d.ts +21 -0
- package/dist/lib/upstash/redis-like.d.ts.map +1 -0
- package/dist/lib/upstash/redis-like.js +60 -0
- package/dist/lib/upstash/redis-like.mjs +54 -0
- package/dist/lib/upstash/redis-lock.d.ts +13 -0
- package/dist/lib/upstash/redis-lock.d.ts.map +1 -0
- package/dist/lib/upstash/redis-lock.js +59 -0
- package/dist/lib/upstash/redis-lock.mjs +55 -0
- package/dist/lib/upstash/redis-structures.d.ts +63 -0
- package/dist/lib/upstash/redis-structures.d.ts.map +1 -0
- package/dist/lib/upstash/redis-structures.js +175 -0
- package/dist/lib/upstash/redis-structures.mjs +159 -0
- package/dist/lib/upstash-config.d.ts +19 -0
- package/dist/lib/upstash-config.d.ts.map +1 -0
- package/dist/lib/upstash-config.js +247 -0
- package/dist/lib/upstash-config.mjs +242 -0
- package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.js +1848 -0
- package/dist/node_modules/.pnpm/@upstash_qstash@2.10.1/node_modules/@upstash/qstash/chunk-35B33QW3.mjs +1830 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.js +5308 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/chunk-IH7W44G6.mjs +5302 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.js +116 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.37.0/node_modules/@upstash/redis/nodejs.mjs +113 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js +248 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.mjs +246 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.js +485 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.mjs +483 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.js +906 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.mjs +904 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.js +818 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.mjs +816 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.js +146 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.mjs +144 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.js +158 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.mjs +156 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.js +159 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.mjs +157 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.js +146 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.mjs +144 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.js +77 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.mjs +75 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.js +153 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.mjs +151 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.js +62 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +60 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.js +86 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.mjs +84 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.js +278 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.mjs +276 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.js +91 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.mjs +89 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.js +127 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.mjs +125 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.js +69 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.mjs +67 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js +51 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.mjs +49 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.js +65 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.mjs +63 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.js +60 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.mjs +58 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.js +55 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.mjs +53 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.js +51 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.mjs +49 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.js +41 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.mjs +39 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.js +58 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.mjs +56 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.js +157 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.mjs +155 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.js +204 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.mjs +202 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.js +206 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.mjs +204 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.js +153 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.mjs +151 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.js +277 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.mjs +275 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.js +160 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.mjs +158 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.js +91 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.mjs +89 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.js +209 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.mjs +207 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.js +337 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.mjs +335 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.js +95 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.mjs +93 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.js +337 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.mjs +335 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.js +793 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.mjs +791 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.js +314 -0
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.mjs +312 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.js +26 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/compact/verify.mjs +24 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.js +127 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jws/flattened/verify.mjs +125 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.js +20 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/jwt/verify.mjs +18 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.js +31 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/key/import.mjs +29 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.js +18 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/buffer_utils.mjs +14 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.js +82 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/check_key_type.mjs +80 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.js +103 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/crypto_key.mjs +101 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.js +7 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/epoch.mjs +3 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.js +38 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/invalid_key_input.mjs +33 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.js +27 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_disjoint.mjs +23 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.js +21 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_jwk.mjs +16 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.js +22 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/is_object.mjs +18 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.js +111 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/jwt_claims_set.mjs +107 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.js +61 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/secs.mjs +57 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.js +16 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_algorithms.mjs +12 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.js +40 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/lib/validate_crit.mjs +36 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.js +15 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/base64url.mjs +13 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.js +23 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/check_key_length.mjs +19 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.js +30 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/dsa_digest.mjs +26 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.js +60 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_named_curve.mjs +56 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.js +35 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/get_sign_verify_key.mjs +31 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.js +20 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/hmac_digest.mjs +16 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.js +15 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_like.mjs +10 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.js +28 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/is_key_object.mjs +5 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.js +14 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/jwk_to_key.mjs +10 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.js +115 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/node_key.mjs +111 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.js +42 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/sign.mjs +19 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.js +54 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/verify.mjs +31 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.js +32 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/runtime/webcrypto.mjs +7 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.js +69 -0
- package/dist/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/esm/util/errors.mjs +60 -0
- package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.js +422 -0
- package/dist/node_modules/.pnpm/neverthrow@7.2.0/node_modules/neverthrow/dist/index.es.mjs +415 -0
- package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.js +6 -0
- package/dist/node_modules/.pnpm/uncrypto@0.1.3/node_modules/uncrypto/dist/crypto.web.mjs +4 -0
- package/dist/prisma/prisma.d.ts +1 -1
- package/dist/prisma/prisma.d.ts.map +1 -1
- package/package.json +14 -11
- package/src/lib/index.ts +2 -0
- package/src/lib/upstash/index.ts +6 -0
- package/src/lib/upstash/qstash.ts +159 -0
- package/src/lib/upstash/redis-counter.ts +35 -0
- package/src/lib/upstash/redis-favorite.ts +56 -0
- package/src/lib/upstash/redis-like.ts +56 -0
- package/src/lib/upstash/redis-lock.ts +59 -0
- package/src/lib/upstash/redis-structures.ts +200 -0
- package/src/lib/upstash-config.ts +261 -0
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.js +0 -54
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/errors.mjs +0 -51
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.js +0 -44
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/iso.mjs +0 -35
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.js +0 -31
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/parse.mjs +0 -18
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.js +0 -587
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/classic/schemas.mjs +0 -527
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.js +0 -447
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/api.mjs +0 -399
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.js +0 -245
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/checks.mjs +0 -232
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.js +0 -68
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/core.mjs +0 -62
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.js +0 -39
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/doc.mjs +0 -37
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.js +0 -80
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/errors.mjs +0 -75
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.js +0 -101
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/parse.mjs +0 -86
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.js +0 -102
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/regexes.mjs +0 -76
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.js +0 -56
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/registries.mjs +0 -52
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.js +0 -1205
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/schemas.mjs +0 -1157
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.js +0 -407
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/util.mjs +0 -374
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/versions.mjs +0 -7
|
@@ -1,1157 +0,0 @@
|
|
|
1
|
-
import { $ZodCheckStringFormat, $ZodCheck } from './checks.mjs';
|
|
2
|
-
import { $constructor, globalConfig, $ZodAsyncError, $ZodEncodeError, config } from './core.mjs';
|
|
3
|
-
import { Doc } from './doc.mjs';
|
|
4
|
-
import { safeParse, safeParseAsync } from './parse.mjs';
|
|
5
|
-
import { string, datetime, date, time, duration, email, guid, uuid, hostname, emoji, nanoid, cuid, cuid2, ulid, xid, ksuid, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164 } from './regexes.mjs';
|
|
6
|
-
import { allowsEval, cached, isObject, esc, defineLazy, cleanRegex, aborted, getEnumValues, propertyKeyTypes, escapeRegex, prefixIssues, optionalKeys, finalizeIssue, isPlainObject, issue } from './util.mjs';
|
|
7
|
-
export { clone } from './util.mjs';
|
|
8
|
-
import { version } from './versions.mjs';
|
|
9
|
-
|
|
10
|
-
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
11
|
-
var _a;
|
|
12
|
-
inst ?? (inst = {});
|
|
13
|
-
inst._zod.def = def; // set _def property
|
|
14
|
-
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
15
|
-
inst._zod.version = version;
|
|
16
|
-
const checks = [...(inst._zod.def.checks ?? [])];
|
|
17
|
-
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
18
|
-
if (inst._zod.traits.has("$ZodCheck")) {
|
|
19
|
-
checks.unshift(inst);
|
|
20
|
-
}
|
|
21
|
-
for (const ch of checks) {
|
|
22
|
-
for (const fn of ch._zod.onattach) {
|
|
23
|
-
fn(inst);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (checks.length === 0) {
|
|
27
|
-
// deferred initializer
|
|
28
|
-
// inst._zod.parse is not yet defined
|
|
29
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
30
|
-
inst._zod.deferred?.push(() => {
|
|
31
|
-
inst._zod.run = inst._zod.parse;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
const runChecks = (payload, checks, ctx) => {
|
|
36
|
-
let isAborted = aborted(payload);
|
|
37
|
-
let asyncResult;
|
|
38
|
-
for (const ch of checks) {
|
|
39
|
-
if (ch._zod.def.when) {
|
|
40
|
-
const shouldRun = ch._zod.def.when(payload);
|
|
41
|
-
if (!shouldRun)
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
else if (isAborted) {
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
const currLen = payload.issues.length;
|
|
48
|
-
const _ = ch._zod.check(payload);
|
|
49
|
-
if (_ instanceof Promise && ctx?.async === false) {
|
|
50
|
-
throw new $ZodAsyncError();
|
|
51
|
-
}
|
|
52
|
-
if (asyncResult || _ instanceof Promise) {
|
|
53
|
-
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
54
|
-
await _;
|
|
55
|
-
const nextLen = payload.issues.length;
|
|
56
|
-
if (nextLen === currLen)
|
|
57
|
-
return;
|
|
58
|
-
if (!isAborted)
|
|
59
|
-
isAborted = aborted(payload, currLen);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const nextLen = payload.issues.length;
|
|
64
|
-
if (nextLen === currLen)
|
|
65
|
-
continue;
|
|
66
|
-
if (!isAborted)
|
|
67
|
-
isAborted = aborted(payload, currLen);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (asyncResult) {
|
|
71
|
-
return asyncResult.then(() => {
|
|
72
|
-
return payload;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return payload;
|
|
76
|
-
};
|
|
77
|
-
// const handleChecksResult = (
|
|
78
|
-
// checkResult: ParsePayload,
|
|
79
|
-
// originalResult: ParsePayload,
|
|
80
|
-
// ctx: ParseContextInternal
|
|
81
|
-
// ): util.MaybeAsync<ParsePayload> => {
|
|
82
|
-
// // if the checks mutated the value && there are no issues, re-parse the result
|
|
83
|
-
// if (checkResult.value !== originalResult.value && !checkResult.issues.length)
|
|
84
|
-
// return inst._zod.parse(checkResult, ctx);
|
|
85
|
-
// return originalResult;
|
|
86
|
-
// };
|
|
87
|
-
const handleCanaryResult = (canary, payload, ctx) => {
|
|
88
|
-
// abort if the canary is aborted
|
|
89
|
-
if (aborted(canary)) {
|
|
90
|
-
canary.aborted = true;
|
|
91
|
-
return canary;
|
|
92
|
-
}
|
|
93
|
-
// run checks first, then
|
|
94
|
-
const checkResult = runChecks(payload, checks, ctx);
|
|
95
|
-
if (checkResult instanceof Promise) {
|
|
96
|
-
if (ctx.async === false)
|
|
97
|
-
throw new $ZodAsyncError();
|
|
98
|
-
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
99
|
-
}
|
|
100
|
-
return inst._zod.parse(checkResult, ctx);
|
|
101
|
-
};
|
|
102
|
-
inst._zod.run = (payload, ctx) => {
|
|
103
|
-
if (ctx.skipChecks) {
|
|
104
|
-
return inst._zod.parse(payload, ctx);
|
|
105
|
-
}
|
|
106
|
-
if (ctx.direction === "backward") {
|
|
107
|
-
// run canary
|
|
108
|
-
// initial pass (no checks)
|
|
109
|
-
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
110
|
-
if (canary instanceof Promise) {
|
|
111
|
-
return canary.then((canary) => {
|
|
112
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
116
|
-
}
|
|
117
|
-
// forward
|
|
118
|
-
const result = inst._zod.parse(payload, ctx);
|
|
119
|
-
if (result instanceof Promise) {
|
|
120
|
-
if (ctx.async === false)
|
|
121
|
-
throw new $ZodAsyncError();
|
|
122
|
-
return result.then((result) => runChecks(result, checks, ctx));
|
|
123
|
-
}
|
|
124
|
-
return runChecks(result, checks, ctx);
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
inst["~standard"] = {
|
|
128
|
-
validate: (value) => {
|
|
129
|
-
try {
|
|
130
|
-
const r = safeParse(inst, value);
|
|
131
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
132
|
-
}
|
|
133
|
-
catch (_) {
|
|
134
|
-
return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
vendor: "zod",
|
|
138
|
-
version: 1,
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
142
|
-
$ZodType.init(inst, def);
|
|
143
|
-
inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? string(inst._zod.bag);
|
|
144
|
-
inst._zod.parse = (payload, _) => {
|
|
145
|
-
if (def.coerce)
|
|
146
|
-
try {
|
|
147
|
-
payload.value = String(payload.value);
|
|
148
|
-
}
|
|
149
|
-
catch (_) { }
|
|
150
|
-
if (typeof payload.value === "string")
|
|
151
|
-
return payload;
|
|
152
|
-
payload.issues.push({
|
|
153
|
-
expected: "string",
|
|
154
|
-
code: "invalid_type",
|
|
155
|
-
input: payload.value,
|
|
156
|
-
inst,
|
|
157
|
-
});
|
|
158
|
-
return payload;
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
|
|
162
|
-
// check initialization must come first
|
|
163
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
164
|
-
$ZodString.init(inst, def);
|
|
165
|
-
});
|
|
166
|
-
const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
|
|
167
|
-
def.pattern ?? (def.pattern = guid);
|
|
168
|
-
$ZodStringFormat.init(inst, def);
|
|
169
|
-
});
|
|
170
|
-
const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
|
|
171
|
-
if (def.version) {
|
|
172
|
-
const versionMap = {
|
|
173
|
-
v1: 1,
|
|
174
|
-
v2: 2,
|
|
175
|
-
v3: 3,
|
|
176
|
-
v4: 4,
|
|
177
|
-
v5: 5,
|
|
178
|
-
v6: 6,
|
|
179
|
-
v7: 7,
|
|
180
|
-
v8: 8,
|
|
181
|
-
};
|
|
182
|
-
const v = versionMap[def.version];
|
|
183
|
-
if (v === undefined)
|
|
184
|
-
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
185
|
-
def.pattern ?? (def.pattern = uuid(v));
|
|
186
|
-
}
|
|
187
|
-
else
|
|
188
|
-
def.pattern ?? (def.pattern = uuid());
|
|
189
|
-
$ZodStringFormat.init(inst, def);
|
|
190
|
-
});
|
|
191
|
-
const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
192
|
-
def.pattern ?? (def.pattern = email);
|
|
193
|
-
$ZodStringFormat.init(inst, def);
|
|
194
|
-
});
|
|
195
|
-
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
196
|
-
$ZodStringFormat.init(inst, def);
|
|
197
|
-
inst._zod.check = (payload) => {
|
|
198
|
-
try {
|
|
199
|
-
// Trim whitespace from input
|
|
200
|
-
const trimmed = payload.value.trim();
|
|
201
|
-
// @ts-ignore
|
|
202
|
-
const url = new URL(trimmed);
|
|
203
|
-
if (def.hostname) {
|
|
204
|
-
def.hostname.lastIndex = 0;
|
|
205
|
-
if (!def.hostname.test(url.hostname)) {
|
|
206
|
-
payload.issues.push({
|
|
207
|
-
code: "invalid_format",
|
|
208
|
-
format: "url",
|
|
209
|
-
note: "Invalid hostname",
|
|
210
|
-
pattern: hostname.source,
|
|
211
|
-
input: payload.value,
|
|
212
|
-
inst,
|
|
213
|
-
continue: !def.abort,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (def.protocol) {
|
|
218
|
-
def.protocol.lastIndex = 0;
|
|
219
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
|
|
220
|
-
payload.issues.push({
|
|
221
|
-
code: "invalid_format",
|
|
222
|
-
format: "url",
|
|
223
|
-
note: "Invalid protocol",
|
|
224
|
-
pattern: def.protocol.source,
|
|
225
|
-
input: payload.value,
|
|
226
|
-
inst,
|
|
227
|
-
continue: !def.abort,
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// Set the output value based on normalize flag
|
|
232
|
-
if (def.normalize) {
|
|
233
|
-
// Use normalized URL
|
|
234
|
-
payload.value = url.href;
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
// Preserve the original input (trimmed)
|
|
238
|
-
payload.value = trimmed;
|
|
239
|
-
}
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
catch (_) {
|
|
243
|
-
payload.issues.push({
|
|
244
|
-
code: "invalid_format",
|
|
245
|
-
format: "url",
|
|
246
|
-
input: payload.value,
|
|
247
|
-
inst,
|
|
248
|
-
continue: !def.abort,
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
});
|
|
253
|
-
const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
|
|
254
|
-
def.pattern ?? (def.pattern = emoji());
|
|
255
|
-
$ZodStringFormat.init(inst, def);
|
|
256
|
-
});
|
|
257
|
-
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
258
|
-
def.pattern ?? (def.pattern = nanoid);
|
|
259
|
-
$ZodStringFormat.init(inst, def);
|
|
260
|
-
});
|
|
261
|
-
const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
|
|
262
|
-
def.pattern ?? (def.pattern = cuid);
|
|
263
|
-
$ZodStringFormat.init(inst, def);
|
|
264
|
-
});
|
|
265
|
-
const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
|
|
266
|
-
def.pattern ?? (def.pattern = cuid2);
|
|
267
|
-
$ZodStringFormat.init(inst, def);
|
|
268
|
-
});
|
|
269
|
-
const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
|
|
270
|
-
def.pattern ?? (def.pattern = ulid);
|
|
271
|
-
$ZodStringFormat.init(inst, def);
|
|
272
|
-
});
|
|
273
|
-
const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
|
|
274
|
-
def.pattern ?? (def.pattern = xid);
|
|
275
|
-
$ZodStringFormat.init(inst, def);
|
|
276
|
-
});
|
|
277
|
-
const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
278
|
-
def.pattern ?? (def.pattern = ksuid);
|
|
279
|
-
$ZodStringFormat.init(inst, def);
|
|
280
|
-
});
|
|
281
|
-
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
282
|
-
def.pattern ?? (def.pattern = datetime(def));
|
|
283
|
-
$ZodStringFormat.init(inst, def);
|
|
284
|
-
});
|
|
285
|
-
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
286
|
-
def.pattern ?? (def.pattern = date);
|
|
287
|
-
$ZodStringFormat.init(inst, def);
|
|
288
|
-
});
|
|
289
|
-
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
290
|
-
def.pattern ?? (def.pattern = time(def));
|
|
291
|
-
$ZodStringFormat.init(inst, def);
|
|
292
|
-
});
|
|
293
|
-
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
294
|
-
def.pattern ?? (def.pattern = duration);
|
|
295
|
-
$ZodStringFormat.init(inst, def);
|
|
296
|
-
});
|
|
297
|
-
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
298
|
-
def.pattern ?? (def.pattern = ipv4);
|
|
299
|
-
$ZodStringFormat.init(inst, def);
|
|
300
|
-
inst._zod.onattach.push((inst) => {
|
|
301
|
-
const bag = inst._zod.bag;
|
|
302
|
-
bag.format = `ipv4`;
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
306
|
-
def.pattern ?? (def.pattern = ipv6);
|
|
307
|
-
$ZodStringFormat.init(inst, def);
|
|
308
|
-
inst._zod.onattach.push((inst) => {
|
|
309
|
-
const bag = inst._zod.bag;
|
|
310
|
-
bag.format = `ipv6`;
|
|
311
|
-
});
|
|
312
|
-
inst._zod.check = (payload) => {
|
|
313
|
-
try {
|
|
314
|
-
// @ts-ignore
|
|
315
|
-
new URL(`http://[${payload.value}]`);
|
|
316
|
-
// return;
|
|
317
|
-
}
|
|
318
|
-
catch {
|
|
319
|
-
payload.issues.push({
|
|
320
|
-
code: "invalid_format",
|
|
321
|
-
format: "ipv6",
|
|
322
|
-
input: payload.value,
|
|
323
|
-
inst,
|
|
324
|
-
continue: !def.abort,
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
});
|
|
329
|
-
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
330
|
-
def.pattern ?? (def.pattern = cidrv4);
|
|
331
|
-
$ZodStringFormat.init(inst, def);
|
|
332
|
-
});
|
|
333
|
-
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
334
|
-
def.pattern ?? (def.pattern = cidrv6); // not used for validation
|
|
335
|
-
$ZodStringFormat.init(inst, def);
|
|
336
|
-
inst._zod.check = (payload) => {
|
|
337
|
-
const parts = payload.value.split("/");
|
|
338
|
-
try {
|
|
339
|
-
if (parts.length !== 2)
|
|
340
|
-
throw new Error();
|
|
341
|
-
const [address, prefix] = parts;
|
|
342
|
-
if (!prefix)
|
|
343
|
-
throw new Error();
|
|
344
|
-
const prefixNum = Number(prefix);
|
|
345
|
-
if (`${prefixNum}` !== prefix)
|
|
346
|
-
throw new Error();
|
|
347
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
348
|
-
throw new Error();
|
|
349
|
-
// @ts-ignore
|
|
350
|
-
new URL(`http://[${address}]`);
|
|
351
|
-
}
|
|
352
|
-
catch {
|
|
353
|
-
payload.issues.push({
|
|
354
|
-
code: "invalid_format",
|
|
355
|
-
format: "cidrv6",
|
|
356
|
-
input: payload.value,
|
|
357
|
-
inst,
|
|
358
|
-
continue: !def.abort,
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
});
|
|
363
|
-
////////////////////////////// ZodBase64 //////////////////////////////
|
|
364
|
-
function isValidBase64(data) {
|
|
365
|
-
if (data === "")
|
|
366
|
-
return true;
|
|
367
|
-
if (data.length % 4 !== 0)
|
|
368
|
-
return false;
|
|
369
|
-
try {
|
|
370
|
-
// @ts-ignore
|
|
371
|
-
atob(data);
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
catch {
|
|
375
|
-
return false;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
379
|
-
def.pattern ?? (def.pattern = base64);
|
|
380
|
-
$ZodStringFormat.init(inst, def);
|
|
381
|
-
inst._zod.onattach.push((inst) => {
|
|
382
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
383
|
-
});
|
|
384
|
-
inst._zod.check = (payload) => {
|
|
385
|
-
if (isValidBase64(payload.value))
|
|
386
|
-
return;
|
|
387
|
-
payload.issues.push({
|
|
388
|
-
code: "invalid_format",
|
|
389
|
-
format: "base64",
|
|
390
|
-
input: payload.value,
|
|
391
|
-
inst,
|
|
392
|
-
continue: !def.abort,
|
|
393
|
-
});
|
|
394
|
-
};
|
|
395
|
-
});
|
|
396
|
-
////////////////////////////// ZodBase64 //////////////////////////////
|
|
397
|
-
function isValidBase64URL(data) {
|
|
398
|
-
if (!base64url.test(data))
|
|
399
|
-
return false;
|
|
400
|
-
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
401
|
-
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
402
|
-
return isValidBase64(padded);
|
|
403
|
-
}
|
|
404
|
-
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
405
|
-
def.pattern ?? (def.pattern = base64url);
|
|
406
|
-
$ZodStringFormat.init(inst, def);
|
|
407
|
-
inst._zod.onattach.push((inst) => {
|
|
408
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
409
|
-
});
|
|
410
|
-
inst._zod.check = (payload) => {
|
|
411
|
-
if (isValidBase64URL(payload.value))
|
|
412
|
-
return;
|
|
413
|
-
payload.issues.push({
|
|
414
|
-
code: "invalid_format",
|
|
415
|
-
format: "base64url",
|
|
416
|
-
input: payload.value,
|
|
417
|
-
inst,
|
|
418
|
-
continue: !def.abort,
|
|
419
|
-
});
|
|
420
|
-
};
|
|
421
|
-
});
|
|
422
|
-
const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
|
|
423
|
-
def.pattern ?? (def.pattern = e164);
|
|
424
|
-
$ZodStringFormat.init(inst, def);
|
|
425
|
-
});
|
|
426
|
-
////////////////////////////// ZodJWT //////////////////////////////
|
|
427
|
-
function isValidJWT(token, algorithm = null) {
|
|
428
|
-
try {
|
|
429
|
-
const tokensParts = token.split(".");
|
|
430
|
-
if (tokensParts.length !== 3)
|
|
431
|
-
return false;
|
|
432
|
-
const [header] = tokensParts;
|
|
433
|
-
if (!header)
|
|
434
|
-
return false;
|
|
435
|
-
// @ts-ignore
|
|
436
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
437
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
|
|
438
|
-
return false;
|
|
439
|
-
if (!parsedHeader.alg)
|
|
440
|
-
return false;
|
|
441
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
|
|
442
|
-
return false;
|
|
443
|
-
return true;
|
|
444
|
-
}
|
|
445
|
-
catch {
|
|
446
|
-
return false;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
450
|
-
$ZodStringFormat.init(inst, def);
|
|
451
|
-
inst._zod.check = (payload) => {
|
|
452
|
-
if (isValidJWT(payload.value, def.alg))
|
|
453
|
-
return;
|
|
454
|
-
payload.issues.push({
|
|
455
|
-
code: "invalid_format",
|
|
456
|
-
format: "jwt",
|
|
457
|
-
input: payload.value,
|
|
458
|
-
inst,
|
|
459
|
-
continue: !def.abort,
|
|
460
|
-
});
|
|
461
|
-
};
|
|
462
|
-
});
|
|
463
|
-
const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
|
|
464
|
-
$ZodType.init(inst, def);
|
|
465
|
-
inst._zod.parse = (payload) => payload;
|
|
466
|
-
});
|
|
467
|
-
const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
|
|
468
|
-
$ZodType.init(inst, def);
|
|
469
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
470
|
-
payload.issues.push({
|
|
471
|
-
expected: "never",
|
|
472
|
-
code: "invalid_type",
|
|
473
|
-
input: payload.value,
|
|
474
|
-
inst,
|
|
475
|
-
});
|
|
476
|
-
return payload;
|
|
477
|
-
};
|
|
478
|
-
});
|
|
479
|
-
function handleArrayResult(result, final, index) {
|
|
480
|
-
if (result.issues.length) {
|
|
481
|
-
final.issues.push(...prefixIssues(index, result.issues));
|
|
482
|
-
}
|
|
483
|
-
final.value[index] = result.value;
|
|
484
|
-
}
|
|
485
|
-
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
486
|
-
$ZodType.init(inst, def);
|
|
487
|
-
inst._zod.parse = (payload, ctx) => {
|
|
488
|
-
const input = payload.value;
|
|
489
|
-
if (!Array.isArray(input)) {
|
|
490
|
-
payload.issues.push({
|
|
491
|
-
expected: "array",
|
|
492
|
-
code: "invalid_type",
|
|
493
|
-
input,
|
|
494
|
-
inst,
|
|
495
|
-
});
|
|
496
|
-
return payload;
|
|
497
|
-
}
|
|
498
|
-
payload.value = Array(input.length);
|
|
499
|
-
const proms = [];
|
|
500
|
-
for (let i = 0; i < input.length; i++) {
|
|
501
|
-
const item = input[i];
|
|
502
|
-
const result = def.element._zod.run({
|
|
503
|
-
value: item,
|
|
504
|
-
issues: [],
|
|
505
|
-
}, ctx);
|
|
506
|
-
if (result instanceof Promise) {
|
|
507
|
-
proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
handleArrayResult(result, payload, i);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
if (proms.length) {
|
|
514
|
-
return Promise.all(proms).then(() => payload);
|
|
515
|
-
}
|
|
516
|
-
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
517
|
-
};
|
|
518
|
-
});
|
|
519
|
-
function handlePropertyResult(result, final, key, input) {
|
|
520
|
-
if (result.issues.length) {
|
|
521
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
522
|
-
}
|
|
523
|
-
if (result.value === undefined) {
|
|
524
|
-
if (key in input) {
|
|
525
|
-
final.value[key] = undefined;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
else {
|
|
529
|
-
final.value[key] = result.value;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
function normalizeDef(def) {
|
|
533
|
-
const keys = Object.keys(def.shape);
|
|
534
|
-
for (const k of keys) {
|
|
535
|
-
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
536
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
const okeys = optionalKeys(def.shape);
|
|
540
|
-
return {
|
|
541
|
-
...def,
|
|
542
|
-
keys,
|
|
543
|
-
keySet: new Set(keys),
|
|
544
|
-
numKeys: keys.length,
|
|
545
|
-
optionalKeys: new Set(okeys),
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
549
|
-
const unrecognized = [];
|
|
550
|
-
// iterate over input keys
|
|
551
|
-
const keySet = def.keySet;
|
|
552
|
-
const _catchall = def.catchall._zod;
|
|
553
|
-
const t = _catchall.def.type;
|
|
554
|
-
for (const key of Object.keys(input)) {
|
|
555
|
-
if (keySet.has(key))
|
|
556
|
-
continue;
|
|
557
|
-
if (t === "never") {
|
|
558
|
-
unrecognized.push(key);
|
|
559
|
-
continue;
|
|
560
|
-
}
|
|
561
|
-
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
562
|
-
if (r instanceof Promise) {
|
|
563
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
|
|
564
|
-
}
|
|
565
|
-
else {
|
|
566
|
-
handlePropertyResult(r, payload, key, input);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
if (unrecognized.length) {
|
|
570
|
-
payload.issues.push({
|
|
571
|
-
code: "unrecognized_keys",
|
|
572
|
-
keys: unrecognized,
|
|
573
|
-
input,
|
|
574
|
-
inst,
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
if (!proms.length)
|
|
578
|
-
return payload;
|
|
579
|
-
return Promise.all(proms).then(() => {
|
|
580
|
-
return payload;
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
584
|
-
// requires cast because technically $ZodObject doesn't extend
|
|
585
|
-
$ZodType.init(inst, def);
|
|
586
|
-
// const sh = def.shape;
|
|
587
|
-
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
588
|
-
if (!desc?.get) {
|
|
589
|
-
const sh = def.shape;
|
|
590
|
-
Object.defineProperty(def, "shape", {
|
|
591
|
-
get: () => {
|
|
592
|
-
const newSh = { ...sh };
|
|
593
|
-
Object.defineProperty(def, "shape", {
|
|
594
|
-
value: newSh,
|
|
595
|
-
});
|
|
596
|
-
return newSh;
|
|
597
|
-
},
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
601
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
602
|
-
const shape = def.shape;
|
|
603
|
-
const propValues = {};
|
|
604
|
-
for (const key in shape) {
|
|
605
|
-
const field = shape[key]._zod;
|
|
606
|
-
if (field.values) {
|
|
607
|
-
propValues[key] ?? (propValues[key] = new Set());
|
|
608
|
-
for (const v of field.values)
|
|
609
|
-
propValues[key].add(v);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
return propValues;
|
|
613
|
-
});
|
|
614
|
-
const isObject$1 = isObject;
|
|
615
|
-
const catchall = def.catchall;
|
|
616
|
-
let value;
|
|
617
|
-
inst._zod.parse = (payload, ctx) => {
|
|
618
|
-
value ?? (value = _normalized.value);
|
|
619
|
-
const input = payload.value;
|
|
620
|
-
if (!isObject$1(input)) {
|
|
621
|
-
payload.issues.push({
|
|
622
|
-
expected: "object",
|
|
623
|
-
code: "invalid_type",
|
|
624
|
-
input,
|
|
625
|
-
inst,
|
|
626
|
-
});
|
|
627
|
-
return payload;
|
|
628
|
-
}
|
|
629
|
-
payload.value = {};
|
|
630
|
-
const proms = [];
|
|
631
|
-
const shape = value.shape;
|
|
632
|
-
for (const key of value.keys) {
|
|
633
|
-
const el = shape[key];
|
|
634
|
-
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
635
|
-
if (r instanceof Promise) {
|
|
636
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
|
|
637
|
-
}
|
|
638
|
-
else {
|
|
639
|
-
handlePropertyResult(r, payload, key, input);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (!catchall) {
|
|
643
|
-
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
644
|
-
}
|
|
645
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
646
|
-
};
|
|
647
|
-
});
|
|
648
|
-
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
649
|
-
// requires cast because technically $ZodObject doesn't extend
|
|
650
|
-
$ZodObject.init(inst, def);
|
|
651
|
-
const superParse = inst._zod.parse;
|
|
652
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
653
|
-
const generateFastpass = (shape) => {
|
|
654
|
-
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
655
|
-
const normalized = _normalized.value;
|
|
656
|
-
const parseStr = (key) => {
|
|
657
|
-
const k = esc(key);
|
|
658
|
-
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
659
|
-
};
|
|
660
|
-
doc.write(`const input = payload.value;`);
|
|
661
|
-
const ids = Object.create(null);
|
|
662
|
-
let counter = 0;
|
|
663
|
-
for (const key of normalized.keys) {
|
|
664
|
-
ids[key] = `key_${counter++}`;
|
|
665
|
-
}
|
|
666
|
-
// A: preserve key order {
|
|
667
|
-
doc.write(`const newResult = {};`);
|
|
668
|
-
for (const key of normalized.keys) {
|
|
669
|
-
const id = ids[key];
|
|
670
|
-
const k = esc(key);
|
|
671
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
672
|
-
doc.write(`
|
|
673
|
-
if (${id}.issues.length) {
|
|
674
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
675
|
-
...iss,
|
|
676
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
677
|
-
})));
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
if (${id}.value === undefined) {
|
|
682
|
-
if (${k} in input) {
|
|
683
|
-
newResult[${k}] = undefined;
|
|
684
|
-
}
|
|
685
|
-
} else {
|
|
686
|
-
newResult[${k}] = ${id}.value;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
`);
|
|
690
|
-
}
|
|
691
|
-
doc.write(`payload.value = newResult;`);
|
|
692
|
-
doc.write(`return payload;`);
|
|
693
|
-
const fn = doc.compile();
|
|
694
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
695
|
-
};
|
|
696
|
-
let fastpass;
|
|
697
|
-
const isObject$1 = isObject;
|
|
698
|
-
const jit = !globalConfig.jitless;
|
|
699
|
-
const allowsEval$1 = allowsEval;
|
|
700
|
-
const fastEnabled = jit && allowsEval$1.value; // && !def.catchall;
|
|
701
|
-
const catchall = def.catchall;
|
|
702
|
-
let value;
|
|
703
|
-
inst._zod.parse = (payload, ctx) => {
|
|
704
|
-
value ?? (value = _normalized.value);
|
|
705
|
-
const input = payload.value;
|
|
706
|
-
if (!isObject$1(input)) {
|
|
707
|
-
payload.issues.push({
|
|
708
|
-
expected: "object",
|
|
709
|
-
code: "invalid_type",
|
|
710
|
-
input,
|
|
711
|
-
inst,
|
|
712
|
-
});
|
|
713
|
-
return payload;
|
|
714
|
-
}
|
|
715
|
-
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
716
|
-
// always synchronous
|
|
717
|
-
if (!fastpass)
|
|
718
|
-
fastpass = generateFastpass(def.shape);
|
|
719
|
-
payload = fastpass(payload, ctx);
|
|
720
|
-
if (!catchall)
|
|
721
|
-
return payload;
|
|
722
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
723
|
-
}
|
|
724
|
-
return superParse(payload, ctx);
|
|
725
|
-
};
|
|
726
|
-
});
|
|
727
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
728
|
-
for (const result of results) {
|
|
729
|
-
if (result.issues.length === 0) {
|
|
730
|
-
final.value = result.value;
|
|
731
|
-
return final;
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
const nonaborted = results.filter((r) => !aborted(r));
|
|
735
|
-
if (nonaborted.length === 1) {
|
|
736
|
-
final.value = nonaborted[0].value;
|
|
737
|
-
return nonaborted[0];
|
|
738
|
-
}
|
|
739
|
-
final.issues.push({
|
|
740
|
-
code: "invalid_union",
|
|
741
|
-
input: final.value,
|
|
742
|
-
inst,
|
|
743
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))),
|
|
744
|
-
});
|
|
745
|
-
return final;
|
|
746
|
-
}
|
|
747
|
-
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
748
|
-
$ZodType.init(inst, def);
|
|
749
|
-
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
|
|
750
|
-
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
751
|
-
defineLazy(inst._zod, "values", () => {
|
|
752
|
-
if (def.options.every((o) => o._zod.values)) {
|
|
753
|
-
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
754
|
-
}
|
|
755
|
-
return undefined;
|
|
756
|
-
});
|
|
757
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
758
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
759
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
760
|
-
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
761
|
-
}
|
|
762
|
-
return undefined;
|
|
763
|
-
});
|
|
764
|
-
const single = def.options.length === 1;
|
|
765
|
-
const first = def.options[0]._zod.run;
|
|
766
|
-
inst._zod.parse = (payload, ctx) => {
|
|
767
|
-
if (single) {
|
|
768
|
-
return first(payload, ctx);
|
|
769
|
-
}
|
|
770
|
-
let async = false;
|
|
771
|
-
const results = [];
|
|
772
|
-
for (const option of def.options) {
|
|
773
|
-
const result = option._zod.run({
|
|
774
|
-
value: payload.value,
|
|
775
|
-
issues: [],
|
|
776
|
-
}, ctx);
|
|
777
|
-
if (result instanceof Promise) {
|
|
778
|
-
results.push(result);
|
|
779
|
-
async = true;
|
|
780
|
-
}
|
|
781
|
-
else {
|
|
782
|
-
if (result.issues.length === 0)
|
|
783
|
-
return result;
|
|
784
|
-
results.push(result);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
if (!async)
|
|
788
|
-
return handleUnionResults(results, payload, inst, ctx);
|
|
789
|
-
return Promise.all(results).then((results) => {
|
|
790
|
-
return handleUnionResults(results, payload, inst, ctx);
|
|
791
|
-
});
|
|
792
|
-
};
|
|
793
|
-
});
|
|
794
|
-
const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
795
|
-
$ZodType.init(inst, def);
|
|
796
|
-
inst._zod.parse = (payload, ctx) => {
|
|
797
|
-
const input = payload.value;
|
|
798
|
-
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
|
|
799
|
-
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
|
|
800
|
-
const async = left instanceof Promise || right instanceof Promise;
|
|
801
|
-
if (async) {
|
|
802
|
-
return Promise.all([left, right]).then(([left, right]) => {
|
|
803
|
-
return handleIntersectionResults(payload, left, right);
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
return handleIntersectionResults(payload, left, right);
|
|
807
|
-
};
|
|
808
|
-
});
|
|
809
|
-
function mergeValues(a, b) {
|
|
810
|
-
// const aType = parse.t(a);
|
|
811
|
-
// const bType = parse.t(b);
|
|
812
|
-
if (a === b) {
|
|
813
|
-
return { valid: true, data: a };
|
|
814
|
-
}
|
|
815
|
-
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
816
|
-
return { valid: true, data: a };
|
|
817
|
-
}
|
|
818
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
819
|
-
const bKeys = Object.keys(b);
|
|
820
|
-
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
821
|
-
const newObj = { ...a, ...b };
|
|
822
|
-
for (const key of sharedKeys) {
|
|
823
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
|
824
|
-
if (!sharedValue.valid) {
|
|
825
|
-
return {
|
|
826
|
-
valid: false,
|
|
827
|
-
mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
newObj[key] = sharedValue.data;
|
|
831
|
-
}
|
|
832
|
-
return { valid: true, data: newObj };
|
|
833
|
-
}
|
|
834
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
835
|
-
if (a.length !== b.length) {
|
|
836
|
-
return { valid: false, mergeErrorPath: [] };
|
|
837
|
-
}
|
|
838
|
-
const newArray = [];
|
|
839
|
-
for (let index = 0; index < a.length; index++) {
|
|
840
|
-
const itemA = a[index];
|
|
841
|
-
const itemB = b[index];
|
|
842
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
843
|
-
if (!sharedValue.valid) {
|
|
844
|
-
return {
|
|
845
|
-
valid: false,
|
|
846
|
-
mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
|
|
847
|
-
};
|
|
848
|
-
}
|
|
849
|
-
newArray.push(sharedValue.data);
|
|
850
|
-
}
|
|
851
|
-
return { valid: true, data: newArray };
|
|
852
|
-
}
|
|
853
|
-
return { valid: false, mergeErrorPath: [] };
|
|
854
|
-
}
|
|
855
|
-
function handleIntersectionResults(result, left, right) {
|
|
856
|
-
if (left.issues.length) {
|
|
857
|
-
result.issues.push(...left.issues);
|
|
858
|
-
}
|
|
859
|
-
if (right.issues.length) {
|
|
860
|
-
result.issues.push(...right.issues);
|
|
861
|
-
}
|
|
862
|
-
if (aborted(result))
|
|
863
|
-
return result;
|
|
864
|
-
const merged = mergeValues(left.value, right.value);
|
|
865
|
-
if (!merged.valid) {
|
|
866
|
-
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
867
|
-
}
|
|
868
|
-
result.value = merged.data;
|
|
869
|
-
return result;
|
|
870
|
-
}
|
|
871
|
-
const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
872
|
-
$ZodType.init(inst, def);
|
|
873
|
-
const values = getEnumValues(def.entries);
|
|
874
|
-
const valuesSet = new Set(values);
|
|
875
|
-
inst._zod.values = valuesSet;
|
|
876
|
-
inst._zod.pattern = new RegExp(`^(${values
|
|
877
|
-
.filter((k) => propertyKeyTypes.has(typeof k))
|
|
878
|
-
.map((o) => (typeof o === "string" ? escapeRegex(o) : o.toString()))
|
|
879
|
-
.join("|")})$`);
|
|
880
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
881
|
-
const input = payload.value;
|
|
882
|
-
if (valuesSet.has(input)) {
|
|
883
|
-
return payload;
|
|
884
|
-
}
|
|
885
|
-
payload.issues.push({
|
|
886
|
-
code: "invalid_value",
|
|
887
|
-
values,
|
|
888
|
-
input,
|
|
889
|
-
inst,
|
|
890
|
-
});
|
|
891
|
-
return payload;
|
|
892
|
-
};
|
|
893
|
-
});
|
|
894
|
-
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
895
|
-
$ZodType.init(inst, def);
|
|
896
|
-
inst._zod.parse = (payload, ctx) => {
|
|
897
|
-
if (ctx.direction === "backward") {
|
|
898
|
-
throw new $ZodEncodeError(inst.constructor.name);
|
|
899
|
-
}
|
|
900
|
-
const _out = def.transform(payload.value, payload);
|
|
901
|
-
if (ctx.async) {
|
|
902
|
-
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
903
|
-
return output.then((output) => {
|
|
904
|
-
payload.value = output;
|
|
905
|
-
return payload;
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
if (_out instanceof Promise) {
|
|
909
|
-
throw new $ZodAsyncError();
|
|
910
|
-
}
|
|
911
|
-
payload.value = _out;
|
|
912
|
-
return payload;
|
|
913
|
-
};
|
|
914
|
-
});
|
|
915
|
-
function handleOptionalResult(result, input) {
|
|
916
|
-
if (result.issues.length && input === undefined) {
|
|
917
|
-
return { issues: [], value: undefined };
|
|
918
|
-
}
|
|
919
|
-
return result;
|
|
920
|
-
}
|
|
921
|
-
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
922
|
-
$ZodType.init(inst, def);
|
|
923
|
-
inst._zod.optin = "optional";
|
|
924
|
-
inst._zod.optout = "optional";
|
|
925
|
-
defineLazy(inst._zod, "values", () => {
|
|
926
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
|
|
927
|
-
});
|
|
928
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
929
|
-
const pattern = def.innerType._zod.pattern;
|
|
930
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
|
|
931
|
-
});
|
|
932
|
-
inst._zod.parse = (payload, ctx) => {
|
|
933
|
-
if (def.innerType._zod.optin === "optional") {
|
|
934
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
935
|
-
if (result instanceof Promise)
|
|
936
|
-
return result.then((r) => handleOptionalResult(r, payload.value));
|
|
937
|
-
return handleOptionalResult(result, payload.value);
|
|
938
|
-
}
|
|
939
|
-
if (payload.value === undefined) {
|
|
940
|
-
return payload;
|
|
941
|
-
}
|
|
942
|
-
return def.innerType._zod.run(payload, ctx);
|
|
943
|
-
};
|
|
944
|
-
});
|
|
945
|
-
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
946
|
-
$ZodType.init(inst, def);
|
|
947
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
948
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
949
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
950
|
-
const pattern = def.innerType._zod.pattern;
|
|
951
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
952
|
-
});
|
|
953
|
-
defineLazy(inst._zod, "values", () => {
|
|
954
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
955
|
-
});
|
|
956
|
-
inst._zod.parse = (payload, ctx) => {
|
|
957
|
-
// Forward direction (decode): allow null to pass through
|
|
958
|
-
if (payload.value === null)
|
|
959
|
-
return payload;
|
|
960
|
-
return def.innerType._zod.run(payload, ctx);
|
|
961
|
-
};
|
|
962
|
-
});
|
|
963
|
-
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
964
|
-
$ZodType.init(inst, def);
|
|
965
|
-
// inst._zod.qin = "true";
|
|
966
|
-
inst._zod.optin = "optional";
|
|
967
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
968
|
-
inst._zod.parse = (payload, ctx) => {
|
|
969
|
-
if (ctx.direction === "backward") {
|
|
970
|
-
return def.innerType._zod.run(payload, ctx);
|
|
971
|
-
}
|
|
972
|
-
// Forward direction (decode): apply defaults for undefined input
|
|
973
|
-
if (payload.value === undefined) {
|
|
974
|
-
payload.value = def.defaultValue;
|
|
975
|
-
/**
|
|
976
|
-
* $ZodDefault returns the default value immediately in forward direction.
|
|
977
|
-
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
978
|
-
return payload;
|
|
979
|
-
}
|
|
980
|
-
// Forward direction: continue with default handling
|
|
981
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
982
|
-
if (result instanceof Promise) {
|
|
983
|
-
return result.then((result) => handleDefaultResult(result, def));
|
|
984
|
-
}
|
|
985
|
-
return handleDefaultResult(result, def);
|
|
986
|
-
};
|
|
987
|
-
});
|
|
988
|
-
function handleDefaultResult(payload, def) {
|
|
989
|
-
if (payload.value === undefined) {
|
|
990
|
-
payload.value = def.defaultValue;
|
|
991
|
-
}
|
|
992
|
-
return payload;
|
|
993
|
-
}
|
|
994
|
-
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
995
|
-
$ZodType.init(inst, def);
|
|
996
|
-
inst._zod.optin = "optional";
|
|
997
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
998
|
-
inst._zod.parse = (payload, ctx) => {
|
|
999
|
-
if (ctx.direction === "backward") {
|
|
1000
|
-
return def.innerType._zod.run(payload, ctx);
|
|
1001
|
-
}
|
|
1002
|
-
// Forward direction (decode): apply prefault for undefined input
|
|
1003
|
-
if (payload.value === undefined) {
|
|
1004
|
-
payload.value = def.defaultValue;
|
|
1005
|
-
}
|
|
1006
|
-
return def.innerType._zod.run(payload, ctx);
|
|
1007
|
-
};
|
|
1008
|
-
});
|
|
1009
|
-
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1010
|
-
$ZodType.init(inst, def);
|
|
1011
|
-
defineLazy(inst._zod, "values", () => {
|
|
1012
|
-
const v = def.innerType._zod.values;
|
|
1013
|
-
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
1014
|
-
});
|
|
1015
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1016
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1017
|
-
if (result instanceof Promise) {
|
|
1018
|
-
return result.then((result) => handleNonOptionalResult(result, inst));
|
|
1019
|
-
}
|
|
1020
|
-
return handleNonOptionalResult(result, inst);
|
|
1021
|
-
};
|
|
1022
|
-
});
|
|
1023
|
-
function handleNonOptionalResult(payload, inst) {
|
|
1024
|
-
if (!payload.issues.length && payload.value === undefined) {
|
|
1025
|
-
payload.issues.push({
|
|
1026
|
-
code: "invalid_type",
|
|
1027
|
-
expected: "nonoptional",
|
|
1028
|
-
input: payload.value,
|
|
1029
|
-
inst,
|
|
1030
|
-
});
|
|
1031
|
-
}
|
|
1032
|
-
return payload;
|
|
1033
|
-
}
|
|
1034
|
-
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
1035
|
-
$ZodType.init(inst, def);
|
|
1036
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1037
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1038
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1039
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1040
|
-
if (ctx.direction === "backward") {
|
|
1041
|
-
return def.innerType._zod.run(payload, ctx);
|
|
1042
|
-
}
|
|
1043
|
-
// Forward direction (decode): apply catch logic
|
|
1044
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1045
|
-
if (result instanceof Promise) {
|
|
1046
|
-
return result.then((result) => {
|
|
1047
|
-
payload.value = result.value;
|
|
1048
|
-
if (result.issues.length) {
|
|
1049
|
-
payload.value = def.catchValue({
|
|
1050
|
-
...payload,
|
|
1051
|
-
error: {
|
|
1052
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1053
|
-
},
|
|
1054
|
-
input: payload.value,
|
|
1055
|
-
});
|
|
1056
|
-
payload.issues = [];
|
|
1057
|
-
}
|
|
1058
|
-
return payload;
|
|
1059
|
-
});
|
|
1060
|
-
}
|
|
1061
|
-
payload.value = result.value;
|
|
1062
|
-
if (result.issues.length) {
|
|
1063
|
-
payload.value = def.catchValue({
|
|
1064
|
-
...payload,
|
|
1065
|
-
error: {
|
|
1066
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
1067
|
-
},
|
|
1068
|
-
input: payload.value,
|
|
1069
|
-
});
|
|
1070
|
-
payload.issues = [];
|
|
1071
|
-
}
|
|
1072
|
-
return payload;
|
|
1073
|
-
};
|
|
1074
|
-
});
|
|
1075
|
-
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
1076
|
-
$ZodType.init(inst, def);
|
|
1077
|
-
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1078
|
-
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1079
|
-
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1080
|
-
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
1081
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1082
|
-
if (ctx.direction === "backward") {
|
|
1083
|
-
const right = def.out._zod.run(payload, ctx);
|
|
1084
|
-
if (right instanceof Promise) {
|
|
1085
|
-
return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
1086
|
-
}
|
|
1087
|
-
return handlePipeResult(right, def.in, ctx);
|
|
1088
|
-
}
|
|
1089
|
-
const left = def.in._zod.run(payload, ctx);
|
|
1090
|
-
if (left instanceof Promise) {
|
|
1091
|
-
return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
1092
|
-
}
|
|
1093
|
-
return handlePipeResult(left, def.out, ctx);
|
|
1094
|
-
};
|
|
1095
|
-
});
|
|
1096
|
-
function handlePipeResult(left, next, ctx) {
|
|
1097
|
-
if (left.issues.length) {
|
|
1098
|
-
// prevent further checks
|
|
1099
|
-
left.aborted = true;
|
|
1100
|
-
return left;
|
|
1101
|
-
}
|
|
1102
|
-
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1103
|
-
}
|
|
1104
|
-
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
1105
|
-
$ZodType.init(inst, def);
|
|
1106
|
-
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1107
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1108
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1109
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1110
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1111
|
-
if (ctx.direction === "backward") {
|
|
1112
|
-
return def.innerType._zod.run(payload, ctx);
|
|
1113
|
-
}
|
|
1114
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1115
|
-
if (result instanceof Promise) {
|
|
1116
|
-
return result.then(handleReadonlyResult);
|
|
1117
|
-
}
|
|
1118
|
-
return handleReadonlyResult(result);
|
|
1119
|
-
};
|
|
1120
|
-
});
|
|
1121
|
-
function handleReadonlyResult(payload) {
|
|
1122
|
-
payload.value = Object.freeze(payload.value);
|
|
1123
|
-
return payload;
|
|
1124
|
-
}
|
|
1125
|
-
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
1126
|
-
$ZodCheck.init(inst, def);
|
|
1127
|
-
$ZodType.init(inst, def);
|
|
1128
|
-
inst._zod.parse = (payload, _) => {
|
|
1129
|
-
return payload;
|
|
1130
|
-
};
|
|
1131
|
-
inst._zod.check = (payload) => {
|
|
1132
|
-
const input = payload.value;
|
|
1133
|
-
const r = def.fn(input);
|
|
1134
|
-
if (r instanceof Promise) {
|
|
1135
|
-
return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
1136
|
-
}
|
|
1137
|
-
handleRefineResult(r, payload, input, inst);
|
|
1138
|
-
return;
|
|
1139
|
-
};
|
|
1140
|
-
});
|
|
1141
|
-
function handleRefineResult(result, payload, input, inst) {
|
|
1142
|
-
if (!result) {
|
|
1143
|
-
const _iss = {
|
|
1144
|
-
code: "custom",
|
|
1145
|
-
input,
|
|
1146
|
-
inst, // incorporates params.error into issue reporting
|
|
1147
|
-
path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
|
|
1148
|
-
continue: !inst._zod.def.abort,
|
|
1149
|
-
// params: inst._zod.def.params,
|
|
1150
|
-
};
|
|
1151
|
-
if (inst._zod.def.params)
|
|
1152
|
-
_iss.params = inst._zod.def.params;
|
|
1153
|
-
payload.issues.push(issue(_iss));
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
export { $ZodArray, $ZodBase64, $ZodBase64URL, $ZodCIDRv4, $ZodCIDRv6, $ZodCUID, $ZodCUID2, $ZodCatch, $ZodCustom, $ZodDefault, $ZodE164, $ZodEmail, $ZodEmoji, $ZodEnum, $ZodGUID, $ZodIPv4, $ZodIPv6, $ZodISODate, $ZodISODateTime, $ZodISODuration, $ZodISOTime, $ZodIntersection, $ZodJWT, $ZodKSUID, $ZodNanoID, $ZodNever, $ZodNonOptional, $ZodNullable, $ZodObject, $ZodObjectJIT, $ZodOptional, $ZodPipe, $ZodPrefault, $ZodReadonly, $ZodString, $ZodStringFormat, $ZodTransform, $ZodType, $ZodULID, $ZodURL, $ZodUUID, $ZodUnion, $ZodUnknown, $ZodXID, isValidBase64, isValidBase64URL, isValidJWT };
|