@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,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Like a target. Returns true if the like was added, false if it already existed, null if Redis is unavailable.
|
|
3
|
+
*/
|
|
4
|
+
export declare const likeTarget: (targetId: string, userId: string) => Promise<boolean | null>;
|
|
5
|
+
/**
|
|
6
|
+
* Unlike a target. Returns true if removed, false if it didn't exist, null if Redis is unavailable.
|
|
7
|
+
*/
|
|
8
|
+
export declare const unlikeTarget: (targetId: string, userId: string) => Promise<boolean | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Check whether a user liked a target. Returns null if Redis is unavailable.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isTargetLiked: (targetId: string, userId: string) => Promise<boolean | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Get like count for a target (unique by user). Returns null if Redis is unavailable.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTargetLikeCount: (targetId: string) => Promise<number | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Get target ids liked by a user. Returns null if Redis is unavailable.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getUserLikedTargets: (userId: string) => Promise<string[] | null>;
|
|
21
|
+
//# sourceMappingURL=redis-like.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-like.d.ts","sourceRoot":"","sources":["../../../src/lib/upstash/redis-like.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,UAAU,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAYzF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAY3F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAU,UAAU,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAQ5F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAOhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAOjF,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var upstashConfig = require('../upstash-config.js');
|
|
5
|
+
|
|
6
|
+
const likeTargetKey = (targetId) => `like:target:${targetId}`;
|
|
7
|
+
const likeUserKey = (userId) => `like:user:${userId}`;
|
|
8
|
+
/**
|
|
9
|
+
* Like a target. Returns true if the like was added, false if it already existed, null if Redis is unavailable.
|
|
10
|
+
*/
|
|
11
|
+
const likeTarget = (targetId, userId) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
+
const redis = upstashConfig.getRedis();
|
|
13
|
+
if (!redis) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const added = yield redis.sadd(likeTargetKey(targetId), userId);
|
|
17
|
+
if (added === 1) {
|
|
18
|
+
yield redis.sadd(likeUserKey(userId), targetId);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Unlike a target. Returns true if removed, false if it didn't exist, null if Redis is unavailable.
|
|
25
|
+
*/
|
|
26
|
+
const unlikeTarget = (targetId, userId) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
const redis = upstashConfig.getRedis();
|
|
28
|
+
if (!redis) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const removed = yield redis.srem(likeTargetKey(targetId), userId);
|
|
32
|
+
if (removed === 1) {
|
|
33
|
+
yield redis.srem(likeUserKey(userId), targetId);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Check whether a user liked a target. Returns null if Redis is unavailable.
|
|
40
|
+
*/
|
|
41
|
+
const isTargetLiked = (targetId, userId) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
const redis = upstashConfig.getRedis();
|
|
43
|
+
if (!redis) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const result = yield redis.sismember(likeTargetKey(targetId), userId);
|
|
47
|
+
return result === 1;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Get like count for a target (unique by user). Returns null if Redis is unavailable.
|
|
51
|
+
*/
|
|
52
|
+
const getTargetLikeCount = (targetId) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
const redis = upstashConfig.getRedis();
|
|
54
|
+
if (!redis) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return redis.scard(likeTargetKey(targetId));
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Get target ids liked by a user. Returns null if Redis is unavailable.
|
|
61
|
+
*/
|
|
62
|
+
const getUserLikedTargets = (userId) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const redis = upstashConfig.getRedis();
|
|
64
|
+
if (!redis) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return redis.smembers(likeUserKey(userId));
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
exports.getTargetLikeCount = getTargetLikeCount;
|
|
71
|
+
exports.getUserLikedTargets = getUserLikedTargets;
|
|
72
|
+
exports.isTargetLiked = isTargetLiked;
|
|
73
|
+
exports.likeTarget = likeTarget;
|
|
74
|
+
exports.unlikeTarget = unlikeTarget;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __awaiter } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs';
|
|
2
|
+
import { getRedis } from '../upstash-config.mjs';
|
|
3
|
+
|
|
4
|
+
const likeTargetKey = (targetId) => `like:target:${targetId}`;
|
|
5
|
+
const likeUserKey = (userId) => `like:user:${userId}`;
|
|
6
|
+
/**
|
|
7
|
+
* Like a target. Returns true if the like was added, false if it already existed, null if Redis is unavailable.
|
|
8
|
+
*/
|
|
9
|
+
const likeTarget = (targetId, userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
const redis = getRedis();
|
|
11
|
+
if (!redis) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const added = yield redis.sadd(likeTargetKey(targetId), userId);
|
|
15
|
+
if (added === 1) {
|
|
16
|
+
yield redis.sadd(likeUserKey(userId), targetId);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Unlike a target. Returns true if removed, false if it didn't exist, null if Redis is unavailable.
|
|
23
|
+
*/
|
|
24
|
+
const unlikeTarget = (targetId, userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const redis = getRedis();
|
|
26
|
+
if (!redis) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const removed = yield redis.srem(likeTargetKey(targetId), userId);
|
|
30
|
+
if (removed === 1) {
|
|
31
|
+
yield redis.srem(likeUserKey(userId), targetId);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Check whether a user liked a target. Returns null if Redis is unavailable.
|
|
38
|
+
*/
|
|
39
|
+
const isTargetLiked = (targetId, userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const redis = getRedis();
|
|
41
|
+
if (!redis) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const result = yield redis.sismember(likeTargetKey(targetId), userId);
|
|
45
|
+
return result === 1;
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Get like count for a target (unique by user). Returns null if Redis is unavailable.
|
|
49
|
+
*/
|
|
50
|
+
const getTargetLikeCount = (targetId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const redis = getRedis();
|
|
52
|
+
if (!redis) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return redis.scard(likeTargetKey(targetId));
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Get target ids liked by a user. Returns null if Redis is unavailable.
|
|
59
|
+
*/
|
|
60
|
+
const getUserLikedTargets = (userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
const redis = getRedis();
|
|
62
|
+
if (!redis) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return redis.smembers(likeUserKey(userId));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export { getTargetLikeCount, getUserLikedTargets, isTargetLiked, likeTarget, unlikeTarget };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acquire a distributed lock. Returns the lock token or null when unavailable.
|
|
3
|
+
*/
|
|
4
|
+
export declare const acquireLock: (key: string, ttlMs: number) => Promise<string | null>;
|
|
5
|
+
/**
|
|
6
|
+
* Release a distributed lock. Returns false when the lock client is unavailable.
|
|
7
|
+
*/
|
|
8
|
+
export declare const releaseLock: (key: string, token: string) => Promise<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* Run a function under a distributed lock. Returns null when the lock is unavailable.
|
|
11
|
+
*/
|
|
12
|
+
export declare const withLock: <T>(key: string, ttlMs: number, fn: () => Promise<T> | T) => Promise<T | null>;
|
|
13
|
+
//# sourceMappingURL=redis-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-lock.d.ts","sourceRoot":"","sources":["../../../src/lib/upstash/redis-lock.ts"],"names":[],"mappings":"AAuCA;;GAEG;AACH,eAAO,MAAM,WAAW,GAAU,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAMnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAU,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,OAAO,CAM7E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,GAAU,CAAC,EAC9B,KAAK,MAAM,EACX,OAAO,MAAM,EACb,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,KACvB,OAAO,CAAC,CAAC,GAAG,IAAI,CAgBlB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var index = require('../../_virtual/index.js');
|
|
5
|
+
var upstashConfig = require('../upstash-config.js');
|
|
6
|
+
|
|
7
|
+
let cachedLock = null;
|
|
8
|
+
let lockInitAttempted = false;
|
|
9
|
+
const createLock = (redis) => {
|
|
10
|
+
const LockCtor = index.distExports.Lock;
|
|
11
|
+
try {
|
|
12
|
+
return new LockCtor({ redis });
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
return new LockCtor(redis);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const getLock = () => {
|
|
19
|
+
if (cachedLock) {
|
|
20
|
+
return cachedLock;
|
|
21
|
+
}
|
|
22
|
+
if (lockInitAttempted) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
lockInitAttempted = true;
|
|
26
|
+
const redis = upstashConfig.getRedis();
|
|
27
|
+
if (!redis) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
cachedLock = createLock(redis);
|
|
31
|
+
return cachedLock;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Acquire a distributed lock. Returns the lock token or null when unavailable.
|
|
35
|
+
*/
|
|
36
|
+
const acquireLock = (key, ttlMs) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
const lock = getLock();
|
|
38
|
+
if (!lock) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return lock.acquire(key, ttlMs);
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* Release a distributed lock. Returns false when the lock client is unavailable.
|
|
45
|
+
*/
|
|
46
|
+
const releaseLock = (key, token) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
const lock = getLock();
|
|
48
|
+
if (!lock) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return lock.release(key, token);
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* Run a function under a distributed lock. Returns null when the lock is unavailable.
|
|
55
|
+
*/
|
|
56
|
+
const withLock = (key, ttlMs, fn) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
57
|
+
const lock = getLock();
|
|
58
|
+
if (!lock) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const token = yield lock.acquire(key, ttlMs);
|
|
62
|
+
if (!token) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
return yield fn();
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
yield lock.release(key, token);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
exports.acquireLock = acquireLock;
|
|
74
|
+
exports.releaseLock = releaseLock;
|
|
75
|
+
exports.withLock = withLock;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { __awaiter } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.mjs';
|
|
2
|
+
import { d as distExports } from '../../_virtual/index.mjs';
|
|
3
|
+
import { getRedis } from '../upstash-config.mjs';
|
|
4
|
+
|
|
5
|
+
let cachedLock = null;
|
|
6
|
+
let lockInitAttempted = false;
|
|
7
|
+
const createLock = (redis) => {
|
|
8
|
+
const LockCtor = distExports.Lock;
|
|
9
|
+
try {
|
|
10
|
+
return new LockCtor({ redis });
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
return new LockCtor(redis);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const getLock = () => {
|
|
17
|
+
if (cachedLock) {
|
|
18
|
+
return cachedLock;
|
|
19
|
+
}
|
|
20
|
+
if (lockInitAttempted) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
lockInitAttempted = true;
|
|
24
|
+
const redis = getRedis();
|
|
25
|
+
if (!redis) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
cachedLock = createLock(redis);
|
|
29
|
+
return cachedLock;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Acquire a distributed lock. Returns the lock token or null when unavailable.
|
|
33
|
+
*/
|
|
34
|
+
const acquireLock = (key, ttlMs) => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const lock = getLock();
|
|
36
|
+
if (!lock) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return lock.acquire(key, ttlMs);
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Release a distributed lock. Returns false when the lock client is unavailable.
|
|
43
|
+
*/
|
|
44
|
+
const releaseLock = (key, token) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
const lock = getLock();
|
|
46
|
+
if (!lock) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
return lock.release(key, token);
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Run a function under a distributed lock. Returns null when the lock is unavailable.
|
|
53
|
+
*/
|
|
54
|
+
const withLock = (key, ttlMs, fn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
+
const lock = getLock();
|
|
56
|
+
if (!lock) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const token = yield lock.acquire(key, ttlMs);
|
|
60
|
+
if (!token) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
return yield fn();
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
yield lock.release(key, token);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { acquireLock, releaseLock, withLock };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set a plain string value with optional TTL (seconds).
|
|
3
|
+
*/
|
|
4
|
+
export declare const setString: (key: string, value: string, ttlSec?: number) => Promise<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Get a plain string value. Returns null if Redis is unavailable or key missing.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getString: (key: string) => Promise<string | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Store an object as JSON string with optional TTL (seconds).
|
|
11
|
+
*/
|
|
12
|
+
export declare const setJson: <T>(key: string, value: T, ttlSec?: number) => Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Get an object stored as JSON string. Returns null if missing or invalid JSON.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getJson: <T>(key: string) => Promise<T | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Delete a key. Returns false if Redis is unavailable.
|
|
19
|
+
*/
|
|
20
|
+
export declare const deleteKey: (key: string) => Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Set a hash field value.
|
|
23
|
+
*/
|
|
24
|
+
export declare const setHashField: (key: string, field: string, value: string) => Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Get a hash field value.
|
|
27
|
+
*/
|
|
28
|
+
export declare const getHashField: (key: string, field: string) => Promise<string | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Store a hash field as JSON string.
|
|
31
|
+
*/
|
|
32
|
+
export declare const setHashJson: <T>(key: string, field: string, value: T) => Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a hash field stored as JSON string.
|
|
35
|
+
*/
|
|
36
|
+
export declare const getHashJson: <T>(key: string, field: string) => Promise<T | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Get all hash fields.
|
|
39
|
+
*/
|
|
40
|
+
export declare const getHashAll: (key: string) => Promise<Record<string, string> | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Remove a hash field.
|
|
43
|
+
*/
|
|
44
|
+
export declare const deleteHashField: (key: string, field: string) => Promise<boolean>;
|
|
45
|
+
type ListDirection = 'left' | 'right';
|
|
46
|
+
/**
|
|
47
|
+
* Push values to a list. Returns list length or null if Redis is unavailable.
|
|
48
|
+
*/
|
|
49
|
+
export declare const pushList: (key: string, values: string[], direction?: ListDirection) => Promise<number | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Pop a value from a list.
|
|
52
|
+
*/
|
|
53
|
+
export declare const popList: (key: string, direction?: ListDirection) => Promise<string | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Get a range from a list.
|
|
56
|
+
*/
|
|
57
|
+
export declare const rangeList: (key: string, start?: number, stop?: number) => Promise<string[] | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Get list length.
|
|
60
|
+
*/
|
|
61
|
+
export declare const listLength: (key: string) => Promise<number | null>;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=redis-structures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-structures.d.ts","sourceRoot":"","sources":["../../../src/lib/upstash/redis-structures.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,EACX,OAAO,MAAM,EACb,SAAS,MAAM,KACd,OAAO,CAAC,OAAO,CAajB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAOlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAU,CAAC,EAC7B,KAAK,MAAM,EACX,OAAO,CAAC,EACR,SAAS,MAAM,KACd,OAAO,CAAC,OAAO,CAcjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAU,CAAC,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAgB9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,OAAO,CAQ5D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,KAAK,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,OAAO,CAQ7F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAU,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAOpF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EACjC,KAAK,MAAM,EACX,OAAO,MAAM,EACb,OAAO,CAAC,KACP,OAAO,CAAC,OAAO,CASjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EAAE,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAgBjF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAQnF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAU,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OAAO,CAAC,OAAO,CAQjF,CAAC;AAEF,KAAK,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,QAAQ,GACnB,KAAK,MAAM,EACX,QAAQ,MAAM,EAAE,EAChB,YAAW,aAAuB,KACjC,OAAO,CAAC,MAAM,GAAG,IAAI,CAavB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAClB,KAAK,MAAM,EACX,YAAW,aAAuB,KACjC,OAAO,CAAC,MAAM,GAAG,IAAI,CAOvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,EACX,cAAS,EACT,aAAS,KACR,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAOzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAU,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAOnE,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js');
|
|
4
|
+
var upstashConfig = require('../upstash-config.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Set a plain string value with optional TTL (seconds).
|
|
8
|
+
*/
|
|
9
|
+
const setString = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
const redis = upstashConfig.getRedis();
|
|
11
|
+
if (!redis) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (ttlSec && ttlSec > 0) {
|
|
15
|
+
yield redis.set(key, value, { ex: ttlSec });
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
yield redis.set(key, value);
|
|
19
|
+
return true;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Get a plain string value. Returns null if Redis is unavailable or key missing.
|
|
23
|
+
*/
|
|
24
|
+
const getString = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const redis = upstashConfig.getRedis();
|
|
26
|
+
if (!redis) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return redis.get(key);
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Store an object as JSON string with optional TTL (seconds).
|
|
33
|
+
*/
|
|
34
|
+
const setJson = (key, value, ttlSec) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
const redis = upstashConfig.getRedis();
|
|
36
|
+
if (!redis) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const payload = JSON.stringify(value);
|
|
40
|
+
if (ttlSec && ttlSec > 0) {
|
|
41
|
+
yield redis.set(key, payload, { ex: ttlSec });
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
yield redis.set(key, payload);
|
|
45
|
+
return true;
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Get an object stored as JSON string. Returns null if missing or invalid JSON.
|
|
49
|
+
*/
|
|
50
|
+
const getJson = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
const redis = upstashConfig.getRedis();
|
|
52
|
+
if (!redis) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
const payload = yield redis.get(key);
|
|
56
|
+
if (!payload) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
return JSON.parse(payload);
|
|
61
|
+
}
|
|
62
|
+
catch (_a) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Delete a key. Returns false if Redis is unavailable.
|
|
68
|
+
*/
|
|
69
|
+
const deleteKey = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
const redis = upstashConfig.getRedis();
|
|
71
|
+
if (!redis) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
const deleted = yield redis.del(key);
|
|
75
|
+
return deleted > 0;
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Set a hash field value.
|
|
79
|
+
*/
|
|
80
|
+
const setHashField = (key, field, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
const redis = upstashConfig.getRedis();
|
|
82
|
+
if (!redis) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const result = yield redis.hset(key, { [field]: value });
|
|
86
|
+
return result > 0;
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* Get a hash field value.
|
|
90
|
+
*/
|
|
91
|
+
const getHashField = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const redis = upstashConfig.getRedis();
|
|
93
|
+
if (!redis) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return redis.hget(key, field);
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Store a hash field as JSON string.
|
|
100
|
+
*/
|
|
101
|
+
const setHashJson = (key, field, value) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
const redis = upstashConfig.getRedis();
|
|
103
|
+
if (!redis) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const payload = JSON.stringify(value);
|
|
107
|
+
const result = yield redis.hset(key, { [field]: payload });
|
|
108
|
+
return result > 0;
|
|
109
|
+
});
|
|
110
|
+
/**
|
|
111
|
+
* Get a hash field stored as JSON string.
|
|
112
|
+
*/
|
|
113
|
+
const getHashJson = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
114
|
+
const redis = upstashConfig.getRedis();
|
|
115
|
+
if (!redis) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const payload = yield redis.hget(key, field);
|
|
119
|
+
if (!payload) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
return JSON.parse(payload);
|
|
124
|
+
}
|
|
125
|
+
catch (_a) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
/**
|
|
130
|
+
* Get all hash fields.
|
|
131
|
+
*/
|
|
132
|
+
const getHashAll = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
const redis = upstashConfig.getRedis();
|
|
134
|
+
if (!redis) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const result = yield redis.hgetall(key);
|
|
138
|
+
return result !== null && result !== void 0 ? result : {};
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Remove a hash field.
|
|
142
|
+
*/
|
|
143
|
+
const deleteHashField = (key, field) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
+
const redis = upstashConfig.getRedis();
|
|
145
|
+
if (!redis) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const removed = yield redis.hdel(key, field);
|
|
149
|
+
return removed > 0;
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Push values to a list. Returns list length or null if Redis is unavailable.
|
|
153
|
+
*/
|
|
154
|
+
const pushList = (key_1, values_1, ...args_1) => tslib_es6.__awaiter(void 0, [key_1, values_1, ...args_1], void 0, function* (key, values, direction = 'right') {
|
|
155
|
+
const redis = upstashConfig.getRedis();
|
|
156
|
+
if (!redis) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
if (values.length === 0) {
|
|
160
|
+
return redis.llen(key);
|
|
161
|
+
}
|
|
162
|
+
return direction === 'left'
|
|
163
|
+
? redis.lpush(key, ...values)
|
|
164
|
+
: redis.rpush(key, ...values);
|
|
165
|
+
});
|
|
166
|
+
/**
|
|
167
|
+
* Pop a value from a list.
|
|
168
|
+
*/
|
|
169
|
+
const popList = (key_1, ...args_1) => tslib_es6.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, direction = 'right') {
|
|
170
|
+
const redis = upstashConfig.getRedis();
|
|
171
|
+
if (!redis) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
return direction === 'left' ? redis.lpop(key) : redis.rpop(key);
|
|
175
|
+
});
|
|
176
|
+
/**
|
|
177
|
+
* Get a range from a list.
|
|
178
|
+
*/
|
|
179
|
+
const rangeList = (key_1, ...args_1) => tslib_es6.__awaiter(void 0, [key_1, ...args_1], void 0, function* (key, start = 0, stop = -1) {
|
|
180
|
+
const redis = upstashConfig.getRedis();
|
|
181
|
+
if (!redis) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
return redis.lrange(key, start, stop);
|
|
185
|
+
});
|
|
186
|
+
/**
|
|
187
|
+
* Get list length.
|
|
188
|
+
*/
|
|
189
|
+
const listLength = (key) => tslib_es6.__awaiter(void 0, void 0, void 0, function* () {
|
|
190
|
+
const redis = upstashConfig.getRedis();
|
|
191
|
+
if (!redis) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
return redis.llen(key);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
exports.deleteHashField = deleteHashField;
|
|
198
|
+
exports.deleteKey = deleteKey;
|
|
199
|
+
exports.getHashAll = getHashAll;
|
|
200
|
+
exports.getHashField = getHashField;
|
|
201
|
+
exports.getHashJson = getHashJson;
|
|
202
|
+
exports.getJson = getJson;
|
|
203
|
+
exports.getString = getString;
|
|
204
|
+
exports.listLength = listLength;
|
|
205
|
+
exports.popList = popList;
|
|
206
|
+
exports.pushList = pushList;
|
|
207
|
+
exports.rangeList = rangeList;
|
|
208
|
+
exports.setHashField = setHashField;
|
|
209
|
+
exports.setHashJson = setHashJson;
|
|
210
|
+
exports.setJson = setJson;
|
|
211
|
+
exports.setString = setString;
|