@windrun-huaiin/backend-core 12.0.0 → 13.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 +7 -0
- package/dist/_virtual/index.mjs +5 -0
- package/dist/_virtual/index2.js +9 -0
- package/dist/_virtual/index2.mjs +7 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index3.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 +46 -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 +46 -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 +130 -0
- package/dist/lib/upstash/qstash.mjs +124 -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 +55 -0
- package/dist/lib/upstash/redis-counter.mjs +50 -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 +74 -0
- package/dist/lib/upstash/redis-favorite.mjs +68 -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 +74 -0
- package/dist/lib/upstash/redis-like.mjs +68 -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 +75 -0
- package/dist/lib/upstash/redis-lock.mjs +71 -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 +211 -0
- package/dist/lib/upstash/redis-structures.mjs +195 -0
- package/dist/lib/upstash-config.d.ts +11 -0
- package/dist/lib/upstash-config.d.ts.map +1 -0
- package/dist/lib/upstash-config.js +53 -0
- package/dist/lib/upstash-config.mjs +50 -0
- package/dist/node_modules/.pnpm/@upstash_lock@0.2.1_typescript@5.9.3/node_modules/@upstash/lock/dist/index.js +191 -0
- package/dist/node_modules/.pnpm/@upstash_lock@0.2.1_typescript@5.9.3/node_modules/@upstash/lock/dist/index.mjs +189 -0
- package/dist/node_modules/.pnpm/@upstash_qstash@2.8.4/node_modules/@upstash/qstash/chunk-RQPZUJXG.js +1419 -0
- package/dist/node_modules/.pnpm/@upstash_qstash@2.8.4/node_modules/@upstash/qstash/chunk-RQPZUJXG.mjs +1403 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.36.1/node_modules/@upstash/redis/chunk-LLI2WIYN.js +4691 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.36.1/node_modules/@upstash/redis/chunk-LLI2WIYN.mjs +4686 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.36.1/node_modules/@upstash/redis/nodejs.js +115 -0
- package/dist/node_modules/.pnpm/@upstash_redis@1.36.1/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 +5 -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 +25 -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 +20 -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 +109 -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 +59 -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 +14 -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 +38 -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 +21 -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 +28 -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 +58 -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 +33 -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 +18 -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 +26 -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 +12 -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 +113 -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 +40 -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 +52 -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/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 +157 -0
- package/src/lib/upstash/redis-counter.ts +51 -0
- package/src/lib/upstash/redis-favorite.ts +75 -0
- package/src/lib/upstash/redis-like.ts +75 -0
- package/src/lib/upstash/redis-lock.ts +85 -0
- package/src/lib/upstash/redis-structures.ts +249 -0
- package/src/lib/upstash-config.ts +54 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
const defaultErrorConfig = {
|
|
2
|
+
withStackTrace: false,
|
|
3
|
+
};
|
|
4
|
+
// Custom error object
|
|
5
|
+
// Context / discussion: https://github.com/supermacro/neverthrow/pull/215
|
|
6
|
+
const createNeverThrowError = (message, result, config = defaultErrorConfig) => {
|
|
7
|
+
const data = result.isOk()
|
|
8
|
+
? { type: 'Ok', value: result.value }
|
|
9
|
+
: { type: 'Err', value: result.error };
|
|
10
|
+
const maybeStack = config.withStackTrace ? new Error().stack : undefined;
|
|
11
|
+
return {
|
|
12
|
+
data,
|
|
13
|
+
message,
|
|
14
|
+
stack: maybeStack,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/******************************************************************************
|
|
19
|
+
Copyright (c) Microsoft Corporation.
|
|
20
|
+
|
|
21
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
22
|
+
purpose with or without fee is hereby granted.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
25
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
26
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
27
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
28
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
29
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
31
|
+
***************************************************************************** */
|
|
32
|
+
/* global Reflect, Promise */
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, [])).next());
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function __values(o) {
|
|
46
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
47
|
+
if (m) return m.call(o);
|
|
48
|
+
if (o && typeof o.length === "number") return {
|
|
49
|
+
next: function () {
|
|
50
|
+
if (o && i >= o.length) o = void 0;
|
|
51
|
+
return { value: o && o[i++], done: !o };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function __await(v) {
|
|
58
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
62
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
63
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
64
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
65
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
66
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
67
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
68
|
+
function fulfill(value) { resume("next", value); }
|
|
69
|
+
function reject(value) { resume("throw", value); }
|
|
70
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function __asyncDelegator(o) {
|
|
74
|
+
var i, p;
|
|
75
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
76
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function __asyncValues(o) {
|
|
80
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
81
|
+
var m = o[Symbol.asyncIterator], i;
|
|
82
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
83
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
84
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
class ResultAsync {
|
|
88
|
+
constructor(res) {
|
|
89
|
+
this._promise = res;
|
|
90
|
+
}
|
|
91
|
+
static fromSafePromise(promise) {
|
|
92
|
+
const newPromise = promise.then((value) => new Ok(value));
|
|
93
|
+
return new ResultAsync(newPromise);
|
|
94
|
+
}
|
|
95
|
+
static fromPromise(promise, errorFn) {
|
|
96
|
+
const newPromise = promise
|
|
97
|
+
.then((value) => new Ok(value))
|
|
98
|
+
.catch((e) => new Err(errorFn(e)));
|
|
99
|
+
return new ResultAsync(newPromise);
|
|
100
|
+
}
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
|
+
static fromThrowable(fn, errorFn) {
|
|
103
|
+
return (...args) => {
|
|
104
|
+
return new ResultAsync((() => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
try {
|
|
106
|
+
return new Ok(yield fn(...args));
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
return new Err(errorFn ? errorFn(error) : error);
|
|
110
|
+
}
|
|
111
|
+
}))());
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static combine(asyncResultList) {
|
|
115
|
+
return combineResultAsyncList(asyncResultList);
|
|
116
|
+
}
|
|
117
|
+
static combineWithAllErrors(asyncResultList) {
|
|
118
|
+
return combineResultAsyncListWithAllErrors(asyncResultList);
|
|
119
|
+
}
|
|
120
|
+
map(f) {
|
|
121
|
+
return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
if (res.isErr()) {
|
|
123
|
+
return new Err(res.error);
|
|
124
|
+
}
|
|
125
|
+
return new Ok(yield f(res.value));
|
|
126
|
+
})));
|
|
127
|
+
}
|
|
128
|
+
andThrough(f) {
|
|
129
|
+
return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
if (res.isErr()) {
|
|
131
|
+
return new Err(res.error);
|
|
132
|
+
}
|
|
133
|
+
const newRes = yield f(res.value);
|
|
134
|
+
if (newRes.isErr()) {
|
|
135
|
+
return new Err(newRes.error);
|
|
136
|
+
}
|
|
137
|
+
return new Ok(res.value);
|
|
138
|
+
})));
|
|
139
|
+
}
|
|
140
|
+
andTee(f) {
|
|
141
|
+
return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
if (res.isErr()) {
|
|
143
|
+
return new Err(res.error);
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
yield f(res.value);
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
// Tee does not care about the error
|
|
150
|
+
}
|
|
151
|
+
return new Ok(res.value);
|
|
152
|
+
})));
|
|
153
|
+
}
|
|
154
|
+
mapErr(f) {
|
|
155
|
+
return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
if (res.isOk()) {
|
|
157
|
+
return new Ok(res.value);
|
|
158
|
+
}
|
|
159
|
+
return new Err(yield f(res.error));
|
|
160
|
+
})));
|
|
161
|
+
}
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
163
|
+
andThen(f) {
|
|
164
|
+
return new ResultAsync(this._promise.then((res) => {
|
|
165
|
+
if (res.isErr()) {
|
|
166
|
+
return new Err(res.error);
|
|
167
|
+
}
|
|
168
|
+
const newValue = f(res.value);
|
|
169
|
+
return newValue instanceof ResultAsync ? newValue._promise : newValue;
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
173
|
+
orElse(f) {
|
|
174
|
+
return new ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
if (res.isErr()) {
|
|
176
|
+
return f(res.error);
|
|
177
|
+
}
|
|
178
|
+
return new Ok(res.value);
|
|
179
|
+
})));
|
|
180
|
+
}
|
|
181
|
+
match(ok, _err) {
|
|
182
|
+
return this._promise.then((res) => res.match(ok, _err));
|
|
183
|
+
}
|
|
184
|
+
unwrapOr(t) {
|
|
185
|
+
return this._promise.then((res) => res.unwrapOr(t));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
|
|
189
|
+
*/
|
|
190
|
+
safeUnwrap() {
|
|
191
|
+
return __asyncGenerator(this, arguments, function* safeUnwrap_1() {
|
|
192
|
+
return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap()))))));
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// Makes ResultAsync implement PromiseLike<Result>
|
|
196
|
+
then(successCallback, failureCallback) {
|
|
197
|
+
return this._promise.then(successCallback, failureCallback);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const errAsync = (err) => new ResultAsync(Promise.resolve(new Err(err)));
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Short circuits on the FIRST Err value that we find
|
|
204
|
+
*/
|
|
205
|
+
const combineResultList = (resultList) => {
|
|
206
|
+
let acc = ok([]);
|
|
207
|
+
for (const result of resultList) {
|
|
208
|
+
if (result.isErr()) {
|
|
209
|
+
acc = err(result.error);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
acc.map((list) => list.push(result.value));
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return acc;
|
|
217
|
+
};
|
|
218
|
+
/* This is the typesafe version of Promise.all
|
|
219
|
+
*
|
|
220
|
+
* Takes a list of ResultAsync<T, E> and success if all inner results are Ok values
|
|
221
|
+
* or fails if one (or more) of the inner results are Err values
|
|
222
|
+
*/
|
|
223
|
+
const combineResultAsyncList = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
|
|
224
|
+
/**
|
|
225
|
+
* Give a list of all the errors we find
|
|
226
|
+
*/
|
|
227
|
+
const combineResultListWithAllErrors = (resultList) => {
|
|
228
|
+
let acc = ok([]);
|
|
229
|
+
for (const result of resultList) {
|
|
230
|
+
if (result.isErr() && acc.isErr()) {
|
|
231
|
+
acc.error.push(result.error);
|
|
232
|
+
}
|
|
233
|
+
else if (result.isErr() && acc.isOk()) {
|
|
234
|
+
acc = err([result.error]);
|
|
235
|
+
}
|
|
236
|
+
else if (result.isOk() && acc.isOk()) {
|
|
237
|
+
acc.value.push(result.value);
|
|
238
|
+
}
|
|
239
|
+
// do nothing when result.isOk() && acc.isErr()
|
|
240
|
+
}
|
|
241
|
+
return acc;
|
|
242
|
+
};
|
|
243
|
+
const combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
|
|
244
|
+
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
246
|
+
var Result;
|
|
247
|
+
(function (Result) {
|
|
248
|
+
/**
|
|
249
|
+
* Wraps a function with a try catch, creating a new function with the same
|
|
250
|
+
* arguments but returning `Ok` if successful, `Err` if the function throws
|
|
251
|
+
*
|
|
252
|
+
* @param fn function to wrap with ok on success or err on failure
|
|
253
|
+
* @param errorFn when an error is thrown, this will wrap the error result if provided
|
|
254
|
+
*/
|
|
255
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
256
|
+
function fromThrowable(fn, errorFn) {
|
|
257
|
+
return (...args) => {
|
|
258
|
+
try {
|
|
259
|
+
const result = fn(...args);
|
|
260
|
+
return ok(result);
|
|
261
|
+
}
|
|
262
|
+
catch (e) {
|
|
263
|
+
return err(errorFn ? errorFn(e) : e);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
Result.fromThrowable = fromThrowable;
|
|
268
|
+
function combine(resultList) {
|
|
269
|
+
return combineResultList(resultList);
|
|
270
|
+
}
|
|
271
|
+
Result.combine = combine;
|
|
272
|
+
function combineWithAllErrors(resultList) {
|
|
273
|
+
return combineResultListWithAllErrors(resultList);
|
|
274
|
+
}
|
|
275
|
+
Result.combineWithAllErrors = combineWithAllErrors;
|
|
276
|
+
})(Result || (Result = {}));
|
|
277
|
+
const ok = (value) => new Ok(value);
|
|
278
|
+
function err(err) {
|
|
279
|
+
return new Err(err);
|
|
280
|
+
}
|
|
281
|
+
class Ok {
|
|
282
|
+
constructor(value) {
|
|
283
|
+
this.value = value;
|
|
284
|
+
}
|
|
285
|
+
isOk() {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
isErr() {
|
|
289
|
+
return !this.isOk();
|
|
290
|
+
}
|
|
291
|
+
map(f) {
|
|
292
|
+
return ok(f(this.value));
|
|
293
|
+
}
|
|
294
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
295
|
+
mapErr(_f) {
|
|
296
|
+
return ok(this.value);
|
|
297
|
+
}
|
|
298
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
299
|
+
andThen(f) {
|
|
300
|
+
return f(this.value);
|
|
301
|
+
}
|
|
302
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
303
|
+
andThrough(f) {
|
|
304
|
+
return f(this.value).map((_value) => this.value);
|
|
305
|
+
}
|
|
306
|
+
andTee(f) {
|
|
307
|
+
try {
|
|
308
|
+
f(this.value);
|
|
309
|
+
}
|
|
310
|
+
catch (e) {
|
|
311
|
+
// Tee doesn't care about the error
|
|
312
|
+
}
|
|
313
|
+
return ok(this.value);
|
|
314
|
+
}
|
|
315
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
316
|
+
orElse(_f) {
|
|
317
|
+
return ok(this.value);
|
|
318
|
+
}
|
|
319
|
+
asyncAndThen(f) {
|
|
320
|
+
return f(this.value);
|
|
321
|
+
}
|
|
322
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
323
|
+
asyncAndThrough(f) {
|
|
324
|
+
return f(this.value).map(() => this.value);
|
|
325
|
+
}
|
|
326
|
+
asyncMap(f) {
|
|
327
|
+
return ResultAsync.fromSafePromise(f(this.value));
|
|
328
|
+
}
|
|
329
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
330
|
+
unwrapOr(_v) {
|
|
331
|
+
return this.value;
|
|
332
|
+
}
|
|
333
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
334
|
+
match(ok, _err) {
|
|
335
|
+
return ok(this.value);
|
|
336
|
+
}
|
|
337
|
+
safeUnwrap() {
|
|
338
|
+
const value = this.value;
|
|
339
|
+
/* eslint-disable-next-line require-yield */
|
|
340
|
+
return (function* () {
|
|
341
|
+
return value;
|
|
342
|
+
})();
|
|
343
|
+
}
|
|
344
|
+
_unsafeUnwrap(_) {
|
|
345
|
+
return this.value;
|
|
346
|
+
}
|
|
347
|
+
_unsafeUnwrapErr(config) {
|
|
348
|
+
throw createNeverThrowError('Called `_unsafeUnwrapErr` on an Ok', this, config);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
class Err {
|
|
352
|
+
constructor(error) {
|
|
353
|
+
this.error = error;
|
|
354
|
+
}
|
|
355
|
+
isOk() {
|
|
356
|
+
return false;
|
|
357
|
+
}
|
|
358
|
+
isErr() {
|
|
359
|
+
return !this.isOk();
|
|
360
|
+
}
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
362
|
+
map(_f) {
|
|
363
|
+
return err(this.error);
|
|
364
|
+
}
|
|
365
|
+
mapErr(f) {
|
|
366
|
+
return err(f(this.error));
|
|
367
|
+
}
|
|
368
|
+
andThrough(_f) {
|
|
369
|
+
return err(this.error);
|
|
370
|
+
}
|
|
371
|
+
andTee(_f) {
|
|
372
|
+
return err(this.error);
|
|
373
|
+
}
|
|
374
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
375
|
+
andThen(_f) {
|
|
376
|
+
return err(this.error);
|
|
377
|
+
}
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
|
|
379
|
+
orElse(f) {
|
|
380
|
+
return f(this.error);
|
|
381
|
+
}
|
|
382
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
383
|
+
asyncAndThen(_f) {
|
|
384
|
+
return errAsync(this.error);
|
|
385
|
+
}
|
|
386
|
+
asyncAndThrough(_f) {
|
|
387
|
+
return errAsync(this.error);
|
|
388
|
+
}
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
390
|
+
asyncMap(_f) {
|
|
391
|
+
return errAsync(this.error);
|
|
392
|
+
}
|
|
393
|
+
unwrapOr(v) {
|
|
394
|
+
return v;
|
|
395
|
+
}
|
|
396
|
+
match(_ok, err) {
|
|
397
|
+
return err(this.error);
|
|
398
|
+
}
|
|
399
|
+
safeUnwrap() {
|
|
400
|
+
const error = this.error;
|
|
401
|
+
return (function* () {
|
|
402
|
+
yield err(error);
|
|
403
|
+
throw new Error('Do not use this generator out of `safeTry`');
|
|
404
|
+
})();
|
|
405
|
+
}
|
|
406
|
+
_unsafeUnwrap(config) {
|
|
407
|
+
throw createNeverThrowError('Called `_unsafeUnwrap` on an Err', this, config);
|
|
408
|
+
}
|
|
409
|
+
_unsafeUnwrapErr(_) {
|
|
410
|
+
return this.error;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
Result.fromThrowable;
|
|
414
|
+
|
|
415
|
+
export { Err, Ok, Result, ResultAsync, err, errAsync, ok };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windrun-huaiin/backend-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Shared backend primitives: Prisma schema/client, database services, routing helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -84,15 +84,18 @@
|
|
|
84
84
|
"LICENSE"
|
|
85
85
|
],
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@clerk/nextjs": "^6.
|
|
87
|
+
"@clerk/nextjs": "^6.39.0",
|
|
88
88
|
"@prisma/client": "^6.17.1",
|
|
89
|
-
"
|
|
89
|
+
"@upstash/redis": "^1.34.0",
|
|
90
|
+
"@upstash/qstash": "^2.7.0",
|
|
91
|
+
"@upstash/lock": "^0.2.1",
|
|
92
|
+
"next": "16.1.6",
|
|
90
93
|
"prisma": "^6.17.1",
|
|
91
94
|
"stripe": "20.0.0",
|
|
92
|
-
"svix": "^1.
|
|
93
|
-
"zod": "^4.
|
|
94
|
-
"@windrun-huaiin/
|
|
95
|
-
"@windrun-huaiin/
|
|
95
|
+
"svix": "^1.86.0",
|
|
96
|
+
"zod": "^4.3.6",
|
|
97
|
+
"@windrun-huaiin/lib": "^13.0.0",
|
|
98
|
+
"@windrun-huaiin/third-ui": "^13.0.0"
|
|
96
99
|
},
|
|
97
100
|
"devDependencies": {
|
|
98
101
|
"@rollup/plugin-alias": "^5.1.1",
|
|
@@ -100,16 +103,16 @@
|
|
|
100
103
|
"@rollup/plugin-node-resolve": "16.0.1",
|
|
101
104
|
"@rollup/plugin-typescript": "12.1.4",
|
|
102
105
|
"rollup": "4.46.2",
|
|
103
|
-
"@types/node": "
|
|
106
|
+
"@types/node": "^25.3.2",
|
|
104
107
|
"typescript": "^5.8.3"
|
|
105
108
|
},
|
|
106
109
|
"peerDependencies": {
|
|
107
|
-
"@clerk/nextjs": "^6.
|
|
110
|
+
"@clerk/nextjs": "^6.39.0",
|
|
108
111
|
"@prisma/client": "^6.17.1",
|
|
109
|
-
"next": "16.
|
|
112
|
+
"next": "16.1.6",
|
|
110
113
|
"prisma": "^6.17.1",
|
|
111
114
|
"stripe": "20.0.0",
|
|
112
|
-
"svix": "^1.
|
|
115
|
+
"svix": "^1.86.0"
|
|
113
116
|
},
|
|
114
117
|
"publishConfig": {
|
|
115
118
|
"access": "public"
|
package/src/lib/index.ts
CHANGED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Receiver } from '@upstash/qstash';
|
|
2
|
+
import { getQstash } from '../upstash-config';
|
|
3
|
+
|
|
4
|
+
let cachedReceiver: Receiver | null = null;
|
|
5
|
+
let receiverInitAttempted = false;
|
|
6
|
+
|
|
7
|
+
const isTruthy = (value: string | undefined): boolean =>
|
|
8
|
+
value === '1' || value === 'true' || value === 'TRUE';
|
|
9
|
+
|
|
10
|
+
const shouldSkipVerify = (): boolean =>
|
|
11
|
+
process.env.NODE_ENV === 'development' && isTruthy(process.env.SKIP_UPSTASH_QSTASH_VERIFY);
|
|
12
|
+
|
|
13
|
+
const getReceiver = (): Receiver | null => {
|
|
14
|
+
if (cachedReceiver) {
|
|
15
|
+
return cachedReceiver;
|
|
16
|
+
}
|
|
17
|
+
if (receiverInitAttempted) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
receiverInitAttempted = true;
|
|
21
|
+
|
|
22
|
+
const currentSigningKey = process.env.QSTASH_CURRENT_SIGNING_KEY;
|
|
23
|
+
const nextSigningKey = process.env.QSTASH_NEXT_SIGNING_KEY;
|
|
24
|
+
if (!currentSigningKey || !nextSigningKey) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
cachedReceiver = new Receiver({
|
|
29
|
+
currentSigningKey,
|
|
30
|
+
nextSigningKey,
|
|
31
|
+
});
|
|
32
|
+
return cachedReceiver;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type PublishBody = Record<string, unknown> | string | number | boolean | null;
|
|
36
|
+
|
|
37
|
+
export interface PublishMessageOptions {
|
|
38
|
+
url: string;
|
|
39
|
+
body: PublishBody;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Publish a message. Returns message id or null if QStash is unavailable.
|
|
44
|
+
*/
|
|
45
|
+
export const publishMessage = async (options: PublishMessageOptions): Promise<string | null> => {
|
|
46
|
+
const client = getQstash();
|
|
47
|
+
if (!client) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const result = await (client as any).publishJSON({
|
|
52
|
+
url: options.url,
|
|
53
|
+
body: options.body,
|
|
54
|
+
});
|
|
55
|
+
return typeof result === 'string' ? result : result?.messageId ?? null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Publish a delayed message. Returns message id or null if QStash is unavailable.
|
|
60
|
+
*/
|
|
61
|
+
export const publishDelayedMessage = async (
|
|
62
|
+
options: PublishMessageOptions & { delaySec: number }
|
|
63
|
+
): Promise<string | null> => {
|
|
64
|
+
const client = getQstash();
|
|
65
|
+
if (!client) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const result = await (client as any).publishJSON({
|
|
70
|
+
url: options.url,
|
|
71
|
+
body: options.body,
|
|
72
|
+
delay: options.delaySec,
|
|
73
|
+
});
|
|
74
|
+
return typeof result === 'string' ? result : result?.messageId ?? null;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export interface ScheduleMessageOptions extends PublishMessageOptions {
|
|
78
|
+
cron: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Schedule a recurring message. Returns schedule id or null if QStash is unavailable.
|
|
83
|
+
*/
|
|
84
|
+
export const scheduleMessage = async (options: ScheduleMessageOptions): Promise<string | null> => {
|
|
85
|
+
const client = getQstash();
|
|
86
|
+
if (!client) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const anyClient = client as any;
|
|
91
|
+
const result =
|
|
92
|
+
(await anyClient.schedules?.create?.({
|
|
93
|
+
url: options.url,
|
|
94
|
+
body: options.body,
|
|
95
|
+
cron: options.cron,
|
|
96
|
+
})) ??
|
|
97
|
+
(await anyClient.publishJSON?.({
|
|
98
|
+
url: options.url,
|
|
99
|
+
body: options.body,
|
|
100
|
+
cron: options.cron,
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
return typeof result === 'string' ? result : result?.scheduleId ?? result?.id ?? null;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Cancel a scheduled message. Returns false if QStash is unavailable.
|
|
108
|
+
*/
|
|
109
|
+
export const cancelSchedule = async (scheduleId: string): Promise<boolean> => {
|
|
110
|
+
const client = getQstash();
|
|
111
|
+
if (!client) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const anyClient = client as any;
|
|
116
|
+
if (anyClient.schedules?.delete) {
|
|
117
|
+
await anyClient.schedules.delete(scheduleId);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
if (anyClient.schedules?.remove) {
|
|
121
|
+
await anyClient.schedules.remove(scheduleId);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export interface VerifyQstashOptions {
|
|
128
|
+
signature: string;
|
|
129
|
+
body: string;
|
|
130
|
+
url: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Verify QStash signature. Throws on failure in non-dev environments.
|
|
135
|
+
*/
|
|
136
|
+
export const verifyQstashSignature = async (options: VerifyQstashOptions): Promise<boolean> => {
|
|
137
|
+
if (shouldSkipVerify()) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const receiver = getReceiver();
|
|
142
|
+
if (!receiver) {
|
|
143
|
+
throw new Error('QStash signing keys are missing');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const verifier = (receiver as any).verify ?? (receiver as any).verifySignature;
|
|
147
|
+
if (!verifier) {
|
|
148
|
+
throw new Error('QStash receiver verify method is unavailable');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
await verifier.call(receiver, {
|
|
152
|
+
signature: options.signature,
|
|
153
|
+
body: options.body,
|
|
154
|
+
url: options.url,
|
|
155
|
+
});
|
|
156
|
+
return true;
|
|
157
|
+
};
|