@upstash/redis 0.0.0-ci.596c3dae-20221124 → 0.0.0-ci.5dc8a64a1d213ed26a30ad534b73faf791cb75c6
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/.npmrc +1 -0
- package/README.md +18 -4
- package/cloudflare.d.mts +45 -0
- package/{types/platforms/cloudflare.d.ts → cloudflare.d.ts} +10 -8
- package/cloudflare.js +1 -0
- package/cloudflare.mjs +1 -0
- package/fastly.d.mts +43 -0
- package/{types/platforms/fastly.d.ts → fastly.d.ts} +8 -6
- package/fastly.js +1 -0
- package/fastly.mjs +1 -0
- package/{types/platforms/node_with_fetch.d.ts → nodejs.d.mts} +24 -7
- package/{types/platforms/nodejs.d.ts → nodejs.d.ts} +8 -6
- package/nodejs.js +1 -0
- package/nodejs.mjs +1 -0
- package/package.json +29 -38
- package/redis-e3e8473f.d.ts +1795 -0
- package/.releaserc +0 -14
- package/esm/deps/deno.land/x/base64@v0.2.1/base.js +0 -100
- package/esm/deps/deno.land/x/base64@v0.2.1/base64url.js +0 -9
- package/esm/deps/deno.land/x/sha1@v1.0.3/deps.js +0 -1
- package/esm/deps/deno.land/x/sha1@v1.0.3/mod.js +0 -191
- package/esm/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +0 -50
- package/esm/package.json +0 -3
- package/esm/pkg/commands/append.js +0 -9
- package/esm/pkg/commands/bitcount.js +0 -16
- package/esm/pkg/commands/bitop.js +0 -9
- package/esm/pkg/commands/bitpos.js +0 -9
- package/esm/pkg/commands/command.js +0 -57
- package/esm/pkg/commands/dbsize.js +0 -9
- package/esm/pkg/commands/decr.js +0 -9
- package/esm/pkg/commands/decrby.js +0 -9
- package/esm/pkg/commands/del.js +0 -9
- package/esm/pkg/commands/echo.js +0 -9
- package/esm/pkg/commands/eval.js +0 -9
- package/esm/pkg/commands/evalsha.js +0 -9
- package/esm/pkg/commands/exists.js +0 -9
- package/esm/pkg/commands/expire.js +0 -9
- package/esm/pkg/commands/expireat.js +0 -9
- package/esm/pkg/commands/flushall.js +0 -13
- package/esm/pkg/commands/flushdb.js +0 -13
- package/esm/pkg/commands/get.js +0 -9
- package/esm/pkg/commands/getbit.js +0 -9
- package/esm/pkg/commands/getdel.js +0 -9
- package/esm/pkg/commands/getrange.js +0 -9
- package/esm/pkg/commands/getset.js +0 -9
- package/esm/pkg/commands/hdel.js +0 -9
- package/esm/pkg/commands/hexists.js +0 -9
- package/esm/pkg/commands/hget.js +0 -9
- package/esm/pkg/commands/hgetall.js +0 -29
- package/esm/pkg/commands/hincrby.js +0 -9
- package/esm/pkg/commands/hincrbyfloat.js +0 -9
- package/esm/pkg/commands/hkeys.js +0 -9
- package/esm/pkg/commands/hlen.js +0 -9
- package/esm/pkg/commands/hmget.js +0 -35
- package/esm/pkg/commands/hmset.js +0 -13
- package/esm/pkg/commands/hrandfield.js +0 -39
- package/esm/pkg/commands/hscan.js +0 -16
- package/esm/pkg/commands/hset.js +0 -13
- package/esm/pkg/commands/hsetnx.js +0 -9
- package/esm/pkg/commands/hstrlen.js +0 -9
- package/esm/pkg/commands/hvals.js +0 -9
- package/esm/pkg/commands/incr.js +0 -9
- package/esm/pkg/commands/incrby.js +0 -9
- package/esm/pkg/commands/incrbyfloat.js +0 -9
- package/esm/pkg/commands/keys.js +0 -9
- package/esm/pkg/commands/lindex.js +0 -6
- package/esm/pkg/commands/linsert.js +0 -6
- package/esm/pkg/commands/llen.js +0 -9
- package/esm/pkg/commands/lpop.js +0 -9
- package/esm/pkg/commands/lpos.js +0 -19
- package/esm/pkg/commands/lpush.js +0 -9
- package/esm/pkg/commands/lpushx.js +0 -9
- package/esm/pkg/commands/lrange.js +0 -6
- package/esm/pkg/commands/lrem.js +0 -6
- package/esm/pkg/commands/lset.js +0 -6
- package/esm/pkg/commands/ltrim.js +0 -6
- package/esm/pkg/commands/mget.js +0 -9
- package/esm/pkg/commands/mod.js +0 -117
- package/esm/pkg/commands/mset.js +0 -12
- package/esm/pkg/commands/msetnx.js +0 -9
- package/esm/pkg/commands/persist.js +0 -9
- package/esm/pkg/commands/pexpire.js +0 -9
- package/esm/pkg/commands/pexpireat.js +0 -9
- package/esm/pkg/commands/ping.js +0 -13
- package/esm/pkg/commands/psetex.js +0 -9
- package/esm/pkg/commands/pttl.js +0 -9
- package/esm/pkg/commands/publish.js +0 -9
- package/esm/pkg/commands/randomkey.js +0 -9
- package/esm/pkg/commands/rename.js +0 -9
- package/esm/pkg/commands/renamenx.js +0 -9
- package/esm/pkg/commands/rpop.js +0 -9
- package/esm/pkg/commands/rpush.js +0 -9
- package/esm/pkg/commands/rpushx.js +0 -9
- package/esm/pkg/commands/sadd.js +0 -9
- package/esm/pkg/commands/scan.js +0 -19
- package/esm/pkg/commands/scard.js +0 -9
- package/esm/pkg/commands/script_exists.js +0 -12
- package/esm/pkg/commands/script_flush.js +0 -16
- package/esm/pkg/commands/script_load.js +0 -9
- package/esm/pkg/commands/sdiff.js +0 -9
- package/esm/pkg/commands/sdiffstore.js +0 -9
- package/esm/pkg/commands/set.js +0 -36
- package/esm/pkg/commands/setbit.js +0 -9
- package/esm/pkg/commands/setex.js +0 -9
- package/esm/pkg/commands/setnx.js +0 -9
- package/esm/pkg/commands/setrange.js +0 -9
- package/esm/pkg/commands/sinter.js +0 -9
- package/esm/pkg/commands/sinterstore.js +0 -9
- package/esm/pkg/commands/sismember.js +0 -9
- package/esm/pkg/commands/smembers.js +0 -9
- package/esm/pkg/commands/smove.js +0 -9
- package/esm/pkg/commands/spop.js +0 -13
- package/esm/pkg/commands/srandmember.js +0 -13
- package/esm/pkg/commands/srem.js +0 -9
- package/esm/pkg/commands/sscan.js +0 -16
- package/esm/pkg/commands/strlen.js +0 -9
- package/esm/pkg/commands/sunion.js +0 -9
- package/esm/pkg/commands/sunionstore.js +0 -9
- package/esm/pkg/commands/time.js +0 -9
- package/esm/pkg/commands/touch.js +0 -9
- package/esm/pkg/commands/ttl.js +0 -9
- package/esm/pkg/commands/type.js +0 -9
- package/esm/pkg/commands/unlink.js +0 -9
- package/esm/pkg/commands/zadd.js +0 -26
- package/esm/pkg/commands/zcard.js +0 -9
- package/esm/pkg/commands/zcount.js +0 -9
- package/esm/pkg/commands/zincrby.js +0 -9
- package/esm/pkg/commands/zinterstore.js +0 -27
- package/esm/pkg/commands/zlexcount.js +0 -9
- package/esm/pkg/commands/zmscore.js +0 -10
- package/esm/pkg/commands/zpopmax.js +0 -13
- package/esm/pkg/commands/zpopmin.js +0 -13
- package/esm/pkg/commands/zrange.js +0 -26
- package/esm/pkg/commands/zrank.js +0 -9
- package/esm/pkg/commands/zrem.js +0 -9
- package/esm/pkg/commands/zremrangebylex.js +0 -9
- package/esm/pkg/commands/zremrangebyrank.js +0 -9
- package/esm/pkg/commands/zremrangebyscore.js +0 -9
- package/esm/pkg/commands/zrevrank.js +0 -9
- package/esm/pkg/commands/zscan.js +0 -16
- package/esm/pkg/commands/zscore.js +0 -9
- package/esm/pkg/commands/zunionstore.js +0 -27
- package/esm/pkg/error.js +0 -9
- package/esm/pkg/http.js +0 -157
- package/esm/pkg/pipeline.js +0 -1171
- package/esm/pkg/redis.js +0 -1144
- package/esm/pkg/script.js +0 -77
- package/esm/pkg/types.js +0 -1
- package/esm/pkg/util.js +0 -31
- package/esm/platforms/cloudflare.js +0 -70
- package/esm/platforms/fastly.js +0 -41
- package/esm/platforms/node_with_fetch.js +0 -73
- package/esm/platforms/nodejs.js +0 -72
- package/esm/version.js +0 -1
- package/script/deps/deno.land/x/base64@v0.2.1/base.js +0 -104
- package/script/deps/deno.land/x/base64@v0.2.1/base64url.js +0 -13
- package/script/deps/deno.land/x/sha1@v1.0.3/deps.js +0 -6
- package/script/deps/deno.land/x/sha1@v1.0.3/mod.js +0 -196
- package/script/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.js +0 -55
- package/script/package.json +0 -3
- package/script/pkg/commands/append.js +0 -13
- package/script/pkg/commands/bitcount.js +0 -20
- package/script/pkg/commands/bitop.js +0 -13
- package/script/pkg/commands/bitpos.js +0 -13
- package/script/pkg/commands/command.js +0 -61
- package/script/pkg/commands/dbsize.js +0 -13
- package/script/pkg/commands/decr.js +0 -13
- package/script/pkg/commands/decrby.js +0 -13
- package/script/pkg/commands/del.js +0 -13
- package/script/pkg/commands/echo.js +0 -13
- package/script/pkg/commands/eval.js +0 -13
- package/script/pkg/commands/evalsha.js +0 -13
- package/script/pkg/commands/exists.js +0 -13
- package/script/pkg/commands/expire.js +0 -13
- package/script/pkg/commands/expireat.js +0 -13
- package/script/pkg/commands/flushall.js +0 -17
- package/script/pkg/commands/flushdb.js +0 -17
- package/script/pkg/commands/get.js +0 -13
- package/script/pkg/commands/getbit.js +0 -13
- package/script/pkg/commands/getdel.js +0 -13
- package/script/pkg/commands/getrange.js +0 -13
- package/script/pkg/commands/getset.js +0 -13
- package/script/pkg/commands/hdel.js +0 -13
- package/script/pkg/commands/hexists.js +0 -13
- package/script/pkg/commands/hget.js +0 -13
- package/script/pkg/commands/hgetall.js +0 -33
- package/script/pkg/commands/hincrby.js +0 -13
- package/script/pkg/commands/hincrbyfloat.js +0 -13
- package/script/pkg/commands/hkeys.js +0 -13
- package/script/pkg/commands/hlen.js +0 -13
- package/script/pkg/commands/hmget.js +0 -39
- package/script/pkg/commands/hmset.js +0 -17
- package/script/pkg/commands/hrandfield.js +0 -43
- package/script/pkg/commands/hscan.js +0 -20
- package/script/pkg/commands/hset.js +0 -17
- package/script/pkg/commands/hsetnx.js +0 -13
- package/script/pkg/commands/hstrlen.js +0 -13
- package/script/pkg/commands/hvals.js +0 -13
- package/script/pkg/commands/incr.js +0 -13
- package/script/pkg/commands/incrby.js +0 -13
- package/script/pkg/commands/incrbyfloat.js +0 -13
- package/script/pkg/commands/keys.js +0 -13
- package/script/pkg/commands/lindex.js +0 -10
- package/script/pkg/commands/linsert.js +0 -10
- package/script/pkg/commands/llen.js +0 -13
- package/script/pkg/commands/lpop.js +0 -13
- package/script/pkg/commands/lpos.js +0 -23
- package/script/pkg/commands/lpush.js +0 -13
- package/script/pkg/commands/lpushx.js +0 -13
- package/script/pkg/commands/lrange.js +0 -10
- package/script/pkg/commands/lrem.js +0 -10
- package/script/pkg/commands/lset.js +0 -10
- package/script/pkg/commands/ltrim.js +0 -10
- package/script/pkg/commands/mget.js +0 -13
- package/script/pkg/commands/mod.js +0 -133
- package/script/pkg/commands/mset.js +0 -16
- package/script/pkg/commands/msetnx.js +0 -13
- package/script/pkg/commands/persist.js +0 -13
- package/script/pkg/commands/pexpire.js +0 -13
- package/script/pkg/commands/pexpireat.js +0 -13
- package/script/pkg/commands/ping.js +0 -17
- package/script/pkg/commands/psetex.js +0 -13
- package/script/pkg/commands/pttl.js +0 -13
- package/script/pkg/commands/publish.js +0 -13
- package/script/pkg/commands/randomkey.js +0 -13
- package/script/pkg/commands/rename.js +0 -13
- package/script/pkg/commands/renamenx.js +0 -13
- package/script/pkg/commands/rpop.js +0 -13
- package/script/pkg/commands/rpush.js +0 -13
- package/script/pkg/commands/rpushx.js +0 -13
- package/script/pkg/commands/sadd.js +0 -13
- package/script/pkg/commands/scan.js +0 -23
- package/script/pkg/commands/scard.js +0 -13
- package/script/pkg/commands/script_exists.js +0 -16
- package/script/pkg/commands/script_flush.js +0 -20
- package/script/pkg/commands/script_load.js +0 -13
- package/script/pkg/commands/sdiff.js +0 -13
- package/script/pkg/commands/sdiffstore.js +0 -13
- package/script/pkg/commands/set.js +0 -40
- package/script/pkg/commands/setbit.js +0 -13
- package/script/pkg/commands/setex.js +0 -13
- package/script/pkg/commands/setnx.js +0 -13
- package/script/pkg/commands/setrange.js +0 -13
- package/script/pkg/commands/sinter.js +0 -13
- package/script/pkg/commands/sinterstore.js +0 -13
- package/script/pkg/commands/sismember.js +0 -13
- package/script/pkg/commands/smembers.js +0 -13
- package/script/pkg/commands/smove.js +0 -13
- package/script/pkg/commands/spop.js +0 -17
- package/script/pkg/commands/srandmember.js +0 -17
- package/script/pkg/commands/srem.js +0 -13
- package/script/pkg/commands/sscan.js +0 -20
- package/script/pkg/commands/strlen.js +0 -13
- package/script/pkg/commands/sunion.js +0 -13
- package/script/pkg/commands/sunionstore.js +0 -13
- package/script/pkg/commands/time.js +0 -13
- package/script/pkg/commands/touch.js +0 -13
- package/script/pkg/commands/ttl.js +0 -13
- package/script/pkg/commands/type.js +0 -13
- package/script/pkg/commands/unlink.js +0 -13
- package/script/pkg/commands/zadd.js +0 -30
- package/script/pkg/commands/zcard.js +0 -13
- package/script/pkg/commands/zcount.js +0 -13
- package/script/pkg/commands/zincrby.js +0 -13
- package/script/pkg/commands/zinterstore.js +0 -31
- package/script/pkg/commands/zlexcount.js +0 -13
- package/script/pkg/commands/zmscore.js +0 -14
- package/script/pkg/commands/zpopmax.js +0 -17
- package/script/pkg/commands/zpopmin.js +0 -17
- package/script/pkg/commands/zrange.js +0 -30
- package/script/pkg/commands/zrank.js +0 -13
- package/script/pkg/commands/zrem.js +0 -13
- package/script/pkg/commands/zremrangebylex.js +0 -13
- package/script/pkg/commands/zremrangebyrank.js +0 -13
- package/script/pkg/commands/zremrangebyscore.js +0 -13
- package/script/pkg/commands/zrevrank.js +0 -13
- package/script/pkg/commands/zscan.js +0 -20
- package/script/pkg/commands/zscore.js +0 -13
- package/script/pkg/commands/zunionstore.js +0 -31
- package/script/pkg/error.js +0 -13
- package/script/pkg/http.js +0 -161
- package/script/pkg/pipeline.js +0 -1175
- package/script/pkg/redis.js +0 -1148
- package/script/pkg/script.js +0 -81
- package/script/pkg/types.js +0 -2
- package/script/pkg/util.js +0 -35
- package/script/platforms/cloudflare.js +0 -97
- package/script/platforms/fastly.js +0 -68
- package/script/platforms/node_with_fetch.js +0 -100
- package/script/platforms/nodejs.js +0 -99
- package/script/version.js +0 -4
- package/types/deps/deno.land/x/base64@v0.2.1/base.d.ts +0 -5
- package/types/deps/deno.land/x/base64@v0.2.1/base64url.d.ts +0 -1
- package/types/deps/deno.land/x/sha1@v1.0.3/deps.d.ts +0 -1
- package/types/deps/deno.land/x/sha1@v1.0.3/mod.d.ts +0 -26
- package/types/deps/denopkg.com/chiefbiiko/std-encoding@v1.0.0/mod.d.ts +0 -3
- package/types/pkg/commands/append.d.ts +0 -7
- package/types/pkg/commands/bitcount.d.ts +0 -8
- package/types/pkg/commands/bitop.d.ts +0 -12
- package/types/pkg/commands/bitpos.d.ts +0 -7
- package/types/pkg/commands/command.d.ts +0 -37
- package/types/pkg/commands/dbsize.d.ts +0 -7
- package/types/pkg/commands/decr.d.ts +0 -7
- package/types/pkg/commands/decrby.d.ts +0 -7
- package/types/pkg/commands/del.d.ts +0 -7
- package/types/pkg/commands/echo.d.ts +0 -7
- package/types/pkg/commands/eval.d.ts +0 -7
- package/types/pkg/commands/evalsha.d.ts +0 -7
- package/types/pkg/commands/exists.d.ts +0 -7
- package/types/pkg/commands/expire.d.ts +0 -7
- package/types/pkg/commands/expireat.d.ts +0 -7
- package/types/pkg/commands/flushall.d.ts +0 -9
- package/types/pkg/commands/flushdb.d.ts +0 -9
- package/types/pkg/commands/get.d.ts +0 -7
- package/types/pkg/commands/getbit.d.ts +0 -7
- package/types/pkg/commands/getdel.d.ts +0 -7
- package/types/pkg/commands/getrange.d.ts +0 -7
- package/types/pkg/commands/getset.d.ts +0 -7
- package/types/pkg/commands/hdel.d.ts +0 -7
- package/types/pkg/commands/hexists.d.ts +0 -7
- package/types/pkg/commands/hget.d.ts +0 -7
- package/types/pkg/commands/hgetall.d.ts +0 -7
- package/types/pkg/commands/hincrby.d.ts +0 -7
- package/types/pkg/commands/hincrbyfloat.d.ts +0 -7
- package/types/pkg/commands/hkeys.d.ts +0 -7
- package/types/pkg/commands/hlen.d.ts +0 -7
- package/types/pkg/commands/hmget.d.ts +0 -15
- package/types/pkg/commands/hmset.d.ts +0 -9
- package/types/pkg/commands/hrandfield.d.ts +0 -9
- package/types/pkg/commands/hscan.d.ts +0 -24
- package/types/pkg/commands/hset.d.ts +0 -9
- package/types/pkg/commands/hsetnx.d.ts +0 -7
- package/types/pkg/commands/hstrlen.d.ts +0 -7
- package/types/pkg/commands/hvals.d.ts +0 -7
- package/types/pkg/commands/incr.d.ts +0 -7
- package/types/pkg/commands/incrby.d.ts +0 -7
- package/types/pkg/commands/incrbyfloat.d.ts +0 -7
- package/types/pkg/commands/keys.d.ts +0 -7
- package/types/pkg/commands/lindex.d.ts +0 -4
- package/types/pkg/commands/linsert.d.ts +0 -9
- package/types/pkg/commands/llen.d.ts +0 -7
- package/types/pkg/commands/lpop.d.ts +0 -7
- package/types/pkg/commands/lpos.d.ts +0 -15
- package/types/pkg/commands/lpush.d.ts +0 -7
- package/types/pkg/commands/lpushx.d.ts +0 -7
- package/types/pkg/commands/lrange.d.ts +0 -4
- package/types/pkg/commands/lrem.d.ts +0 -4
- package/types/pkg/commands/lset.d.ts +0 -4
- package/types/pkg/commands/ltrim.d.ts +0 -4
- package/types/pkg/commands/mget.d.ts +0 -7
- package/types/pkg/commands/mod.d.ts +0 -117
- package/types/pkg/commands/mset.d.ts +0 -9
- package/types/pkg/commands/msetnx.d.ts +0 -9
- package/types/pkg/commands/persist.d.ts +0 -7
- package/types/pkg/commands/pexpire.d.ts +0 -7
- package/types/pkg/commands/pexpireat.d.ts +0 -7
- package/types/pkg/commands/ping.d.ts +0 -7
- package/types/pkg/commands/psetex.d.ts +0 -7
- package/types/pkg/commands/pttl.d.ts +0 -7
- package/types/pkg/commands/publish.d.ts +0 -7
- package/types/pkg/commands/randomkey.d.ts +0 -7
- package/types/pkg/commands/rename.d.ts +0 -7
- package/types/pkg/commands/renamenx.d.ts +0 -7
- package/types/pkg/commands/rpop.d.ts +0 -7
- package/types/pkg/commands/rpush.d.ts +0 -7
- package/types/pkg/commands/rpushx.d.ts +0 -7
- package/types/pkg/commands/sadd.d.ts +0 -7
- package/types/pkg/commands/scan.d.ts +0 -18
- package/types/pkg/commands/scard.d.ts +0 -7
- package/types/pkg/commands/script_exists.d.ts +0 -7
- package/types/pkg/commands/script_flush.d.ts +0 -14
- package/types/pkg/commands/script_load.d.ts +0 -7
- package/types/pkg/commands/sdiff.d.ts +0 -7
- package/types/pkg/commands/sdiffstore.d.ts +0 -7
- package/types/pkg/commands/set.d.ts +0 -55
- package/types/pkg/commands/setbit.d.ts +0 -7
- package/types/pkg/commands/setex.d.ts +0 -7
- package/types/pkg/commands/setnx.d.ts +0 -7
- package/types/pkg/commands/setrange.d.ts +0 -7
- package/types/pkg/commands/sinter.d.ts +0 -7
- package/types/pkg/commands/sinterstore.d.ts +0 -7
- package/types/pkg/commands/sismember.d.ts +0 -7
- package/types/pkg/commands/smembers.d.ts +0 -7
- package/types/pkg/commands/smove.d.ts +0 -7
- package/types/pkg/commands/spop.d.ts +0 -7
- package/types/pkg/commands/srandmember.d.ts +0 -7
- package/types/pkg/commands/srem.d.ts +0 -7
- package/types/pkg/commands/sscan.d.ts +0 -24
- package/types/pkg/commands/strlen.d.ts +0 -7
- package/types/pkg/commands/sunion.d.ts +0 -7
- package/types/pkg/commands/sunionstore.d.ts +0 -7
- package/types/pkg/commands/time.d.ts +0 -7
- package/types/pkg/commands/touch.d.ts +0 -7
- package/types/pkg/commands/ttl.d.ts +0 -7
- package/types/pkg/commands/type.d.ts +0 -8
- package/types/pkg/commands/unlink.d.ts +0 -7
- package/types/pkg/commands/zadd.d.ts +0 -35
- package/types/pkg/commands/zcard.d.ts +0 -7
- package/types/pkg/commands/zcount.d.ts +0 -7
- package/types/pkg/commands/zincrby.d.ts +0 -7
- package/types/pkg/commands/zinterstore.d.ts +0 -30
- package/types/pkg/commands/zlexcount.d.ts +0 -7
- package/types/pkg/commands/zmscore.d.ts +0 -7
- package/types/pkg/commands/zpopmax.d.ts +0 -7
- package/types/pkg/commands/zpopmin.d.ts +0 -7
- package/types/pkg/commands/zrange.d.ts +0 -42
- package/types/pkg/commands/zrank.d.ts +0 -7
- package/types/pkg/commands/zrem.d.ts +0 -7
- package/types/pkg/commands/zremrangebylex.d.ts +0 -7
- package/types/pkg/commands/zremrangebyrank.d.ts +0 -7
- package/types/pkg/commands/zremrangebyscore.d.ts +0 -7
- package/types/pkg/commands/zrevrank.d.ts +0 -7
- package/types/pkg/commands/zscan.d.ts +0 -24
- package/types/pkg/commands/zscore.d.ts +0 -7
- package/types/pkg/commands/zunionstore.d.ts +0 -30
- package/types/pkg/error.d.ts +0 -6
- package/types/pkg/http.d.ts +0 -102
- package/types/pkg/pipeline.d.ts +0 -565
- package/types/pkg/redis.d.ts +0 -556
- package/types/pkg/script.d.ts +0 -42
- package/types/pkg/types.d.ts +0 -1
- package/types/pkg/util.d.ts +0 -1
- package/types/version.d.ts +0 -1
package/.npmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//registry.npmjs.org/:_authToken=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
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ supported.
|
|
|
27
27
|
|
|
28
28
|
### Install
|
|
29
29
|
|
|
30
|
-
####
|
|
30
|
+
#### Node.js
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
npm install @upstash/redis
|
|
@@ -36,7 +36,7 @@ npm install @upstash/redis
|
|
|
36
36
|
#### Deno
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
import { Redis } from "https://
|
|
39
|
+
import { Redis } from "https://esm.sh/@upstash/redis";
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### Create database
|
|
@@ -81,6 +81,13 @@ data = await redis.spop('animals', 1)
|
|
|
81
81
|
console.log(data)
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
## Troubleshooting
|
|
85
|
+
|
|
86
|
+
We have a
|
|
87
|
+
[dedicated page](https://docs.upstash.com/redis/sdks/javascriptsdk/troubleshooting)
|
|
88
|
+
for common problems. If you can't find a solution, please
|
|
89
|
+
[open an issue](https://github.com/upstash/upstash-redis/issues/new).
|
|
90
|
+
|
|
84
91
|
## Docs
|
|
85
92
|
|
|
86
93
|
See [the documentation](https://docs.upstash.com/features/javascriptsdk) for
|
|
@@ -88,7 +95,7 @@ details.
|
|
|
88
95
|
|
|
89
96
|
## Contributing
|
|
90
97
|
|
|
91
|
-
### [Install
|
|
98
|
+
### [Install Bun](https://bun.sh/docs/installation)
|
|
92
99
|
|
|
93
100
|
### Database
|
|
94
101
|
|
|
@@ -98,9 +105,16 @@ the url and token
|
|
|
98
105
|
### Running tests
|
|
99
106
|
|
|
100
107
|
```sh
|
|
101
|
-
|
|
108
|
+
bun run test
|
|
102
109
|
```
|
|
103
110
|
|
|
111
|
+
### Building
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
bun run build
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
|
|
104
118
|
### Telemetry
|
|
105
119
|
|
|
106
120
|
This library sends anonymous telemetry data to help us improve your experience.
|
package/cloudflare.d.mts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './redis-e3e8473f.js';
|
|
2
|
+
export { c as Requester, U as UpstashRequest, d as UpstashResponse } from './redis-e3e8473f.js';
|
|
3
|
+
|
|
4
|
+
type Env = {
|
|
5
|
+
UPSTASH_DISABLE_TELEMETRY?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Connection credentials for upstash redis.
|
|
10
|
+
* Get them from https://console.upstash.com/redis/<uuid>
|
|
11
|
+
*/
|
|
12
|
+
type RedisConfigCloudflare = {
|
|
13
|
+
/**
|
|
14
|
+
* UPSTASH_REDIS_REST_URL
|
|
15
|
+
*/
|
|
16
|
+
url: string;
|
|
17
|
+
/**
|
|
18
|
+
* UPSTASH_REDIS_REST_TOKEN
|
|
19
|
+
*/
|
|
20
|
+
token: string;
|
|
21
|
+
} & RedisOptions & RequesterConfig & Env;
|
|
22
|
+
/**
|
|
23
|
+
* Serverless redis client for upstash.
|
|
24
|
+
*/
|
|
25
|
+
declare class Redis extends Redis$1 {
|
|
26
|
+
/**
|
|
27
|
+
* Create a new redis client
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const redis = new Redis({
|
|
32
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
33
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
constructor(config: RedisConfigCloudflare, env?: Env);
|
|
38
|
+
static fromEnv(env?: {
|
|
39
|
+
UPSTASH_REDIS_REST_URL: string;
|
|
40
|
+
UPSTASH_REDIS_REST_TOKEN: string;
|
|
41
|
+
UPSTASH_DISABLE_TELEMETRY?: string;
|
|
42
|
+
}, opts?: Omit<RedisConfigCloudflare, "url" | "token">): Redis;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { Redis, RedisConfigCloudflare };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './redis-e3e8473f.js';
|
|
2
|
+
export { c as Requester, U as UpstashRequest, d as UpstashResponse } from './redis-e3e8473f.js';
|
|
3
|
+
|
|
4
|
+
type Env = {
|
|
5
5
|
UPSTASH_DISABLE_TELEMETRY?: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
/**
|
|
9
9
|
* Connection credentials for upstash redis.
|
|
10
10
|
* Get them from https://console.upstash.com/redis/<uuid>
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
type RedisConfigCloudflare = {
|
|
13
13
|
/**
|
|
14
14
|
* UPSTASH_REDIS_REST_URL
|
|
15
15
|
*/
|
|
@@ -18,11 +18,11 @@ export declare type RedisConfigCloudflare = {
|
|
|
18
18
|
* UPSTASH_REDIS_REST_TOKEN
|
|
19
19
|
*/
|
|
20
20
|
token: string;
|
|
21
|
-
} &
|
|
21
|
+
} & RedisOptions & RequesterConfig & Env;
|
|
22
22
|
/**
|
|
23
23
|
* Serverless redis client for upstash.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
declare class Redis extends Redis$1 {
|
|
26
26
|
/**
|
|
27
27
|
* Create a new redis client
|
|
28
28
|
*
|
|
@@ -41,3 +41,5 @@ export declare class Redis extends core.Redis {
|
|
|
41
41
|
UPSTASH_DISABLE_TELEMETRY?: string;
|
|
42
42
|
}, opts?: Omit<RedisConfigCloudflare, "url" | "token">): Redis;
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
export { Redis, RedisConfigCloudflare };
|
package/cloudflare.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ce=Object.create;var jt=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var ge=(s,n)=>{for(var t in n)jt(s,t,{get:n[t],enumerable:!0})},oe=(s,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of he(n))!Ce.call(s,m)&&m!==t&&jt(s,m,{get:()=>n[m],enumerable:!(o=ue(n,m))||o.enumerable});return s};var se=(s,n,t)=>(t=s!=null?ce(le(s)):{},oe(n||!s||!s.__esModule?jt(t,"default",{value:s,enumerable:!0}):t,s)),xe=s=>oe(jt({},"__esModule",{value:!0}),s);var we={};ge(we,{Redis:()=>ee});module.exports=xe(we);var p=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var Wt=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(c=>setTimeout(c,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new p(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:c})=>({result:te(i),error:c})):{result:te(r.result),error:r.error}:r}};function me(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function te(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?me(t):Array.isArray(t)?t.map(te):t):n=null;break}case"string":{n=s==="OK"?"OK":me(s);break}default:break}return n}function re(s){let n=Array.isArray(s)?s.map(t=>{try{return re(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ae(s){try{return re(s)}catch{return s}}var fe=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=fe,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ae:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new p(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var u=class extends e{constructor(n,t){super(["append",...n],t)}};var h=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var l=class extends e{constructor(n,t){super(["bitop",...n],t)}};var C=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var g=class extends e{constructor(n){super(["dbsize"],n)}};var x=class extends e{constructor(n,t){super(["decr",...n],t)}};var f=class extends e{constructor(n,t){super(["decrby",...n],t)}};var b=class extends e{constructor(n,t){super(["del",...n],t)}};var y=class extends e{constructor(n,t){super(["echo",...n],t)}};var T=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var O=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var D=class extends e{constructor(n,t){super(["exists",...n],t)}};var w=class extends e{constructor(n,t){super(["expire",...n],t)}};var k=class extends e{constructor(n,t){super(["expireat",...n],t)}};var A=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var S=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var R=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:c})=>[i,a,c])),super(r,m)}};var v=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var E=class extends e{constructor(n,t){super(["get",...n],t)}};var M=class extends e{constructor(n,t){super(["getbit",...n],t)}};var P=class extends e{constructor(n,t){super(["getdel",...n],t)}};var z=class extends e{constructor(n,t){super(["getrange",...n],t)}};var J=class extends e{constructor(n,t){super(["getset",...n],t)}};var L=class extends e{constructor(n,t){super(["hdel",...n],t)}};var Z=class extends e{constructor(n,t){super(["hexists",...n],t)}};var I=class extends e{constructor(n,t){super(["hget",...n],t)}};function be(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var K=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>be(o),...t})}};var U=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var N=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var B=class extends e{constructor([n],t){super(["hkeys",n],t)}};var H=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ye(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var G=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ye(t,m),...o})}};var q=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function Te(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>Te(m):t?.deserialize,...t})}};var $=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var F=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var X=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var j=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var W=class extends e{constructor(n,t){super(["hvals",...n],t)}};var V=class extends e{constructor(n,t){super(["incr",...n],t)}};var Y=class extends e{constructor(n,t){super(["incrby",...n],t)}};var Q=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var nn=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var tn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var en=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var on=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var sn=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var mn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var rn=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var dn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var cn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var un=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var hn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var ln=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var yn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var On=class extends e{constructor(n,t){super(["keys",...n],t)}};var Dn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var wn=class extends e{constructor(n,t){super(["linsert",...n],t)}};var kn=class extends e{constructor(n,t){super(["llen",...n],t)}};var An=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Sn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Rn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var vn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var En=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var zn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Jn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Ln=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Zn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var In=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var Kn=class extends e{constructor(n,t){super(["persist",...n],t)}};var Un=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Nn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Bn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Hn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Gn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var qn=class extends e{constructor(n,t){super(["publish",...n],t)}};var _n=class extends e{constructor(n){super(["randomkey"],n)}};var $n=class extends e{constructor(n,t){super(["rename",...n],t)}};var Fn=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var Xn=class extends e{constructor(n,t){super(["rpop",...n],t)}};var jn=class extends e{constructor(n,t){super(["rpush",...n],t)}};var Wn=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var Vn=class extends e{constructor(n,t){super(["sadd",...n],t)}};var Yn=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var Qn=class extends e{constructor(n,t){super(["scard",...n],t)}};var nt=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var tt=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var et=class extends e{constructor(n,t){super(["script","load",...n],t)}};var ot=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var st=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var mt=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var rt=class extends e{constructor(n,t){super(["setbit",...n],t)}};var at=class extends e{constructor(n,t){super(["setex",...n],t)}};var it=class extends e{constructor(n,t){super(["setnx",...n],t)}};var pt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var dt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ct=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var ut=class extends e{constructor(n,t){super(["sismember",...n],t)}};var ht=class extends e{constructor(n,t){super(["smembers",...n],t)}};var lt=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Ct=class extends e{constructor(n,t){super(["smove",...n],t)}};var gt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var xt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var ft=class extends e{constructor(n,t){super(["srem",...n],t)}};var bt=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var yt=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Tt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Ot=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var Dt=class extends e{constructor(n){super(["time"],n)}};var wt=class extends e{constructor(n,t){super(["touch",...n],t)}};var kt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var At=class extends e{constructor(n,t){super(["type",...n],t)}};var St=class extends e{constructor(n,t){super(["unlink",...n],t)}};var Vt=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,c]of Object.entries(o))a.push(i,c);super(a,r)}};function Oe(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var Yt=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>Oe(i),...r})}};var d=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Rt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var vt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Et=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Mt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Pt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var zt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Jt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Lt=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Zt=class extends e{constructor(n,t){super(["zrank",...n],t)}};var It=class extends e{constructor(n,t){super(["zrem",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var Ut=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Nt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Bt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Ht=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Gt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var qt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var _t=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var $t=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var Ft=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var Xt=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new p(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new u(n,this.commandOptions));bitcount=(...n)=>this.chain(new h(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new l([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new C(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new $t(n,this.commandOptions));dbsize=()=>this.chain(new g(this.commandOptions));decr=(...n)=>this.chain(new x(n,this.commandOptions));decrby=(...n)=>this.chain(new f(n,this.commandOptions));del=(...n)=>this.chain(new b(n,this.commandOptions));echo=(...n)=>this.chain(new y(n,this.commandOptions));eval=(...n)=>this.chain(new T(n,this.commandOptions));evalsha=(...n)=>this.chain(new O(n,this.commandOptions));exists=(...n)=>this.chain(new D(n,this.commandOptions));expire=(...n)=>this.chain(new w(n,this.commandOptions));expireat=(...n)=>this.chain(new k(n,this.commandOptions));flushall=n=>this.chain(new A(n,this.commandOptions));flushdb=(...n)=>this.chain(new S(n,this.commandOptions));get=(...n)=>this.chain(new E(n,this.commandOptions));getbit=(...n)=>this.chain(new M(n,this.commandOptions));getdel=(...n)=>this.chain(new P(n,this.commandOptions));getrange=(...n)=>this.chain(new z(n,this.commandOptions));getset=(n,t)=>this.chain(new J([n,t],this.commandOptions));hdel=(...n)=>this.chain(new L(n,this.commandOptions));hexists=(...n)=>this.chain(new Z(n,this.commandOptions));hget=(...n)=>this.chain(new I(n,this.commandOptions));hgetall=(...n)=>this.chain(new K(n,this.commandOptions));hincrby=(...n)=>this.chain(new U(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new N(n,this.commandOptions));hkeys=(...n)=>this.chain(new B(n,this.commandOptions));hlen=(...n)=>this.chain(new H(n,this.commandOptions));hmget=(...n)=>this.chain(new G(n,this.commandOptions));hmset=(n,t)=>this.chain(new q([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new _([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new $(n,this.commandOptions));hset=(n,t)=>this.chain(new F([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new X([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new j(n,this.commandOptions));hvals=(...n)=>this.chain(new W(n,this.commandOptions));incr=(...n)=>this.chain(new V(n,this.commandOptions));incrby=(...n)=>this.chain(new Y(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new Q(n,this.commandOptions));keys=(...n)=>this.chain(new On(n,this.commandOptions));lindex=(...n)=>this.chain(new Dn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new wn([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new kn(n,this.commandOptions));lmove=(...n)=>this.chain(new An(n,this.commandOptions));lpop=(...n)=>this.chain(new Sn(n,this.commandOptions));lpos=(...n)=>this.chain(new Rn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new vn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new En([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Mn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Pn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new zn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Jn(n,this.commandOptions));mget=(...n)=>this.chain(new Ln(n,this.commandOptions));mset=n=>this.chain(new Zn([n],this.commandOptions));msetnx=n=>this.chain(new In([n],this.commandOptions));persist=(...n)=>this.chain(new Kn(n,this.commandOptions));pexpire=(...n)=>this.chain(new Un(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Nn(n,this.commandOptions));ping=n=>this.chain(new Bn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Hn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Gn(n,this.commandOptions));publish=(...n)=>this.chain(new qn(n,this.commandOptions));randomkey=()=>this.chain(new _n(this.commandOptions));rename=(...n)=>this.chain(new $n(n,this.commandOptions));renamenx=(...n)=>this.chain(new Fn(n,this.commandOptions));rpop=(...n)=>this.chain(new Xn(n,this.commandOptions));rpush=(n,...t)=>this.chain(new jn([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new Wn([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new Vn([n,...t],this.commandOptions));scan=(...n)=>this.chain(new Yn(n,this.commandOptions));scard=(...n)=>this.chain(new Qn(n,this.commandOptions));scriptExists=(...n)=>this.chain(new nt(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new tt(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new et(n,this.commandOptions));sdiff=(...n)=>this.chain(new ot(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new st(n,this.commandOptions));set=(n,t,o)=>this.chain(new mt([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new rt(n,this.commandOptions));setex=(n,t,o)=>this.chain(new at([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new it([n,t],this.commandOptions));setrange=(...n)=>this.chain(new pt(n,this.commandOptions));sinter=(...n)=>this.chain(new dt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ct(n,this.commandOptions));sismember=(n,t)=>this.chain(new ut([n,t],this.commandOptions));smembers=(...n)=>this.chain(new ht(n,this.commandOptions));smismember=(n,t)=>this.chain(new lt([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Ct([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new gt(n,this.commandOptions));srandmember=(...n)=>this.chain(new xt(n,this.commandOptions));srem=(n,...t)=>this.chain(new ft([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new bt(n,this.commandOptions));strlen=(...n)=>this.chain(new yt(n,this.commandOptions));sunion=(...n)=>this.chain(new Tt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Ot(n,this.commandOptions));time=()=>this.chain(new Dt(this.commandOptions));touch=(...n)=>this.chain(new wt(n,this.commandOptions));ttl=(...n)=>this.chain(new kt(n,this.commandOptions));type=(...n)=>this.chain(new At(n,this.commandOptions));unlink=(...n)=>this.chain(new St(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Rt(n,this.commandOptions));zcount=(...n)=>this.chain(new vt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Et([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Mt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Pt(n,this.commandOptions));zmscore=(...n)=>this.chain(new Ft(n,this.commandOptions));zpopmax=(...n)=>this.chain(new zt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Jt(n,this.commandOptions));zrange=(...n)=>this.chain(new Lt(n,this.commandOptions));zrank=(n,t)=>this.chain(new Zt([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new It([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new Kt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new Ut(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Nt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Bt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Ht(n,this.commandOptions));zscore=(n,t)=>this.chain(new Gt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new _t(n,this.commandOptions));zunion=(...n)=>this.chain(new qt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new nn(n,this.commandOptions)),arrindex:(...n)=>this.chain(new tn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new en(n,this.commandOptions)),arrlen:(...n)=>this.chain(new on(n,this.commandOptions)),arrpop:(...n)=>this.chain(new sn(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new mn(n,this.commandOptions)),clear:(...n)=>this.chain(new rn(n,this.commandOptions)),del:(...n)=>this.chain(new an(n,this.commandOptions)),forget:(...n)=>this.chain(new pn(n,this.commandOptions)),geoadd:(...n)=>new R(n,this.commandOptions).exec(this.client),geodist:(...n)=>new v(n,this.commandOptions).exec(this.client),get:(...n)=>this.chain(new dn(n,this.commandOptions)),mget:(...n)=>this.chain(new cn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new un(n,this.commandOptions)),nummultby:(...n)=>this.chain(new hn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new ln(n,this.commandOptions)),objlen:(...n)=>this.chain(new Cn(n,this.commandOptions)),resp:(...n)=>this.chain(new gn(n,this.commandOptions)),set:(...n)=>this.chain(new xn(n,this.commandOptions)),strappend:(...n)=>this.chain(new fn(n,this.commandOptions)),strlen:(...n)=>this.chain(new bn(n,this.commandOptions)),toggle:(...n)=>this.chain(new yn(n,this.commandOptions)),type:(...n)=>this.chain(new Tn(n,this.commandOptions))}}};var ie=se(require("crypto-js/enc-hex")),pe=se(require("crypto-js/sha1")),Qt=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return ie.default.stringify((0,pe.default)(n))}};var ne=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new nn(n,this.opts).exec(this.client),arrindex:(...n)=>new tn(n,this.opts).exec(this.client),arrinsert:(...n)=>new en(n,this.opts).exec(this.client),arrlen:(...n)=>new on(n,this.opts).exec(this.client),arrpop:(...n)=>new sn(n,this.opts).exec(this.client),arrtrim:(...n)=>new mn(n,this.opts).exec(this.client),clear:(...n)=>new rn(n,this.opts).exec(this.client),del:(...n)=>new an(n,this.opts).exec(this.client),forget:(...n)=>new pn(n,this.opts).exec(this.client),geoadd:(...n)=>new R(n,this.opts).exec(this.client),geodist:(...n)=>new v(n,this.opts).exec(this.client),get:(...n)=>new dn(n,this.opts).exec(this.client),mget:(...n)=>new cn(n,this.opts).exec(this.client),numincrby:(...n)=>new un(n,this.opts).exec(this.client),nummultby:(...n)=>new hn(n,this.opts).exec(this.client),objkeys:(...n)=>new ln(n,this.opts).exec(this.client),objlen:(...n)=>new Cn(n,this.opts).exec(this.client),resp:(...n)=>new gn(n,this.opts).exec(this.client),set:(...n)=>new xn(n,this.opts).exec(this.client),strappend:(...n)=>new fn(n,this.opts).exec(this.client),strlen:(...n)=>new bn(n,this.opts).exec(this.client),toggle:(...n)=>new yn(n,this.opts).exec(this.client),type:(...n)=>new Tn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new Qt(this,n)}pipeline=()=>new Xt({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new Xt({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new u(n,this.opts).exec(this.client);bitcount=(...n)=>new h(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new l([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new C(n,this.opts).exec(this.client);dbsize=()=>new g(this.opts).exec(this.client);decr=(...n)=>new x(n,this.opts).exec(this.client);decrby=(...n)=>new f(n,this.opts).exec(this.client);del=(...n)=>new b(n,this.opts).exec(this.client);echo=(...n)=>new y(n,this.opts).exec(this.client);eval=(...n)=>new T(n,this.opts).exec(this.client);evalsha=(...n)=>new O(n,this.opts).exec(this.client);exists=(...n)=>new D(n,this.opts).exec(this.client);expire=(...n)=>new w(n,this.opts).exec(this.client);expireat=(...n)=>new k(n,this.opts).exec(this.client);flushall=n=>new A(n,this.opts).exec(this.client);flushdb=(...n)=>new S(n,this.opts).exec(this.client);get=(...n)=>new E(n,this.opts).exec(this.client);getbit=(...n)=>new M(n,this.opts).exec(this.client);getdel=(...n)=>new P(n,this.opts).exec(this.client);getrange=(...n)=>new z(n,this.opts).exec(this.client);getset=(n,t)=>new J([n,t],this.opts).exec(this.client);hdel=(...n)=>new L(n,this.opts).exec(this.client);hexists=(...n)=>new Z(n,this.opts).exec(this.client);hget=(...n)=>new I(n,this.opts).exec(this.client);hgetall=(...n)=>new K(n,this.opts).exec(this.client);hincrby=(...n)=>new U(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new N(n,this.opts).exec(this.client);hkeys=(...n)=>new B(n,this.opts).exec(this.client);hlen=(...n)=>new H(n,this.opts).exec(this.client);hmget=(...n)=>new G(n,this.opts).exec(this.client);hmset=(n,t)=>new q([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new _([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new $(n,this.opts).exec(this.client);hset=(n,t)=>new F([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new X([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new j(n,this.opts).exec(this.client);hvals=(...n)=>new W(n,this.opts).exec(this.client);incr=(...n)=>new V(n,this.opts).exec(this.client);incrby=(...n)=>new Y(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new Q(n,this.opts).exec(this.client);keys=(...n)=>new On(n,this.opts).exec(this.client);lindex=(...n)=>new Dn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new wn([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new kn(n,this.opts).exec(this.client);lmove=(...n)=>new An(n,this.opts).exec(this.client);lpop=(...n)=>new Sn(n,this.opts).exec(this.client);lpos=(...n)=>new Rn(n,this.opts).exec(this.client);lpush=(n,...t)=>new vn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new En([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Mn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Pn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new zn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Jn(n,this.opts).exec(this.client);mget=(...n)=>new Ln(n,this.opts).exec(this.client);mset=n=>new Zn([n],this.opts).exec(this.client);msetnx=n=>new In([n],this.opts).exec(this.client);persist=(...n)=>new Kn(n,this.opts).exec(this.client);pexpire=(...n)=>new Un(n,this.opts).exec(this.client);pexpireat=(...n)=>new Nn(n,this.opts).exec(this.client);ping=n=>new Bn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Hn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Gn(n,this.opts).exec(this.client);publish=(...n)=>new qn(n,this.opts).exec(this.client);randomkey=()=>new _n().exec(this.client);rename=(...n)=>new $n(n,this.opts).exec(this.client);renamenx=(...n)=>new Fn(n,this.opts).exec(this.client);rpop=(...n)=>new Xn(n,this.opts).exec(this.client);rpush=(n,...t)=>new jn([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new Wn([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new Vn([n,...t],this.opts).exec(this.client);scan=(...n)=>new Yn(n,this.opts).exec(this.client);scard=(...n)=>new Qn(n,this.opts).exec(this.client);scriptExists=(...n)=>new nt(n,this.opts).exec(this.client);scriptFlush=(...n)=>new tt(n,this.opts).exec(this.client);scriptLoad=(...n)=>new et(n,this.opts).exec(this.client);sdiff=(...n)=>new ot(n,this.opts).exec(this.client);sdiffstore=(...n)=>new st(n,this.opts).exec(this.client);set=(n,t,o)=>new mt([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new rt(n,this.opts).exec(this.client);setex=(n,t,o)=>new at([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new it([n,t],this.opts).exec(this.client);setrange=(...n)=>new pt(n,this.opts).exec(this.client);sinter=(...n)=>new dt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ct(n,this.opts).exec(this.client);sismember=(n,t)=>new ut([n,t],this.opts).exec(this.client);smismember=(n,t)=>new lt([n,t],this.opts).exec(this.client);smembers=(...n)=>new ht(n,this.opts).exec(this.client);smove=(n,t,o)=>new Ct([n,t,o],this.opts).exec(this.client);spop=(...n)=>new gt(n,this.opts).exec(this.client);srandmember=(...n)=>new xt(n,this.opts).exec(this.client);srem=(n,...t)=>new ft([n,...t],this.opts).exec(this.client);sscan=(...n)=>new bt(n,this.opts).exec(this.client);strlen=(...n)=>new yt(n,this.opts).exec(this.client);sunion=(...n)=>new Tt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Ot(n,this.opts).exec(this.client);time=()=>new Dt().exec(this.client);touch=(...n)=>new wt(n,this.opts).exec(this.client);ttl=(...n)=>new kt(n,this.opts).exec(this.client);type=(...n)=>new At(n,this.opts).exec(this.client);unlink=(...n)=>new St(n,this.opts).exec(this.client);xadd=(...n)=>new Vt(n,this.opts).exec(this.client);xrange=(...n)=>new Yt(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Rt(n,this.opts).exec(this.client);zcount=(...n)=>new vt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new $t(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Et([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Mt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Pt(n,this.opts).exec(this.client);zmscore=(...n)=>new Ft(n,this.opts).exec(this.client);zpopmax=(...n)=>new zt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Jt(n,this.opts).exec(this.client);zrange=(...n)=>new Lt(n,this.opts).exec(this.client);zrank=(n,t)=>new Zt([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new It([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new Kt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new Ut(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Nt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Bt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Ht(n,this.opts).exec(this.client);zscore=(n,t)=>new Gt([n,t],this.opts).exec(this.client);zunion=(...n)=>new qt(n,this.opts).exec(this.client);zunionstore=(...n)=>new _t(n,this.opts).exec(this.client)};var de="v0.0.0-ci.5dc8a64a1d213ed26a30ad534b73faf791cb75c6";var ee=class s extends ne{constructor(n,t){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let o=new Wt({retry:n.retry,baseUrl:n.url,headers:{authorization:`Bearer ${n.token}`},responseEncoding:n.responseEncoding});super(o,{enableTelemetry:!t?.UPSTASH_DISABLE_TELEMETRY,automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({platform:"cloudflare",sdk:`@upstash/redis@${de}`})}static fromEnv(n,t){let o=n?.UPSTASH_REDIS_REST_URL??UPSTASH_REDIS_REST_URL,m=n?.UPSTASH_REDIS_REST_TOKEN??UPSTASH_REDIS_REST_TOKEN;if(!o)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");if(!m)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");return new s({...t,url:o,token:m},n)}};0&&(module.exports={Redis});
|
package/cloudflare.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var jt=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(c=>setTimeout(c,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new p(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:c})=>({result:ne(i),error:c})):{result:ne(r.result),error:r.error}:r}};function te(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function ne(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?te(t):Array.isArray(t)?t.map(ne):t):n=null;break}case"string":{n=s==="OK"?"OK":te(s);break}default:break}return n}function ee(s){let n=Array.isArray(s)?s.map(t=>{try{return ee(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function oe(s){try{return ee(s)}catch{return s}}var re=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=re,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??oe:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new p(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var u=class extends e{constructor(n,t){super(["append",...n],t)}};var h=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var l=class extends e{constructor(n,t){super(["bitop",...n],t)}};var C=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var g=class extends e{constructor(n){super(["dbsize"],n)}};var x=class extends e{constructor(n,t){super(["decr",...n],t)}};var f=class extends e{constructor(n,t){super(["decrby",...n],t)}};var b=class extends e{constructor(n,t){super(["del",...n],t)}};var y=class extends e{constructor(n,t){super(["echo",...n],t)}};var T=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var O=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var D=class extends e{constructor(n,t){super(["exists",...n],t)}};var w=class extends e{constructor(n,t){super(["expire",...n],t)}};var k=class extends e{constructor(n,t){super(["expireat",...n],t)}};var A=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var S=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var R=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:c})=>[i,a,c])),super(r,m)}};var v=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var E=class extends e{constructor(n,t){super(["get",...n],t)}};var M=class extends e{constructor(n,t){super(["getbit",...n],t)}};var P=class extends e{constructor(n,t){super(["getdel",...n],t)}};var z=class extends e{constructor(n,t){super(["getrange",...n],t)}};var J=class extends e{constructor(n,t){super(["getset",...n],t)}};var L=class extends e{constructor(n,t){super(["hdel",...n],t)}};var Z=class extends e{constructor(n,t){super(["hexists",...n],t)}};var I=class extends e{constructor(n,t){super(["hget",...n],t)}};function ae(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var K=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>ae(o),...t})}};var U=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var N=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var B=class extends e{constructor([n],t){super(["hkeys",n],t)}};var H=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ie(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var G=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ie(t,m),...o})}};var q=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function pe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var _=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>pe(m):t?.deserialize,...t})}};var $=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var F=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var X=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var j=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var W=class extends e{constructor(n,t){super(["hvals",...n],t)}};var V=class extends e{constructor(n,t){super(["incr",...n],t)}};var Y=class extends e{constructor(n,t){super(["incrby",...n],t)}};var Q=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var nn=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var tn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var en=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var on=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var sn=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var mn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var rn=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var dn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var cn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var un=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var hn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var ln=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var yn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var Tn=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var On=class extends e{constructor(n,t){super(["keys",...n],t)}};var Dn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var wn=class extends e{constructor(n,t){super(["linsert",...n],t)}};var kn=class extends e{constructor(n,t){super(["llen",...n],t)}};var An=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Sn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Rn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var vn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var En=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var zn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Jn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var Ln=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Zn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var In=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var Kn=class extends e{constructor(n,t){super(["persist",...n],t)}};var Un=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Nn=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Bn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Hn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Gn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var qn=class extends e{constructor(n,t){super(["publish",...n],t)}};var _n=class extends e{constructor(n){super(["randomkey"],n)}};var $n=class extends e{constructor(n,t){super(["rename",...n],t)}};var Fn=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var Xn=class extends e{constructor(n,t){super(["rpop",...n],t)}};var jn=class extends e{constructor(n,t){super(["rpush",...n],t)}};var Wn=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var Vn=class extends e{constructor(n,t){super(["sadd",...n],t)}};var Yn=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var Qn=class extends e{constructor(n,t){super(["scard",...n],t)}};var nt=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var tt=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var et=class extends e{constructor(n,t){super(["script","load",...n],t)}};var ot=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var st=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var mt=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var rt=class extends e{constructor(n,t){super(["setbit",...n],t)}};var at=class extends e{constructor(n,t){super(["setex",...n],t)}};var it=class extends e{constructor(n,t){super(["setnx",...n],t)}};var pt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var dt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ct=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var ut=class extends e{constructor(n,t){super(["sismember",...n],t)}};var ht=class extends e{constructor(n,t){super(["smembers",...n],t)}};var lt=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Ct=class extends e{constructor(n,t){super(["smove",...n],t)}};var gt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var xt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var ft=class extends e{constructor(n,t){super(["srem",...n],t)}};var bt=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var yt=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Tt=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Ot=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var Dt=class extends e{constructor(n){super(["time"],n)}};var wt=class extends e{constructor(n,t){super(["touch",...n],t)}};var kt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var At=class extends e{constructor(n,t){super(["type",...n],t)}};var St=class extends e{constructor(n,t){super(["unlink",...n],t)}};var Wt=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,c]of Object.entries(o))a.push(i,c);super(a,r)}};function de(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var Vt=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>de(i),...r})}};var d=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Rt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var vt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Et=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var Mt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Pt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var zt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Jt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Lt=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Zt=class extends e{constructor(n,t){super(["zrank",...n],t)}};var It=class extends e{constructor(n,t){super(["zrem",...n],t)}};var Kt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var Ut=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Nt=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Bt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Ht=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Gt=class extends e{constructor(n,t){super(["zscore",...n],t)}};var qt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var _t=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var $t=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var Ft=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var Xt=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new p(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new u(n,this.commandOptions));bitcount=(...n)=>this.chain(new h(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new l([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new C(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new $t(n,this.commandOptions));dbsize=()=>this.chain(new g(this.commandOptions));decr=(...n)=>this.chain(new x(n,this.commandOptions));decrby=(...n)=>this.chain(new f(n,this.commandOptions));del=(...n)=>this.chain(new b(n,this.commandOptions));echo=(...n)=>this.chain(new y(n,this.commandOptions));eval=(...n)=>this.chain(new T(n,this.commandOptions));evalsha=(...n)=>this.chain(new O(n,this.commandOptions));exists=(...n)=>this.chain(new D(n,this.commandOptions));expire=(...n)=>this.chain(new w(n,this.commandOptions));expireat=(...n)=>this.chain(new k(n,this.commandOptions));flushall=n=>this.chain(new A(n,this.commandOptions));flushdb=(...n)=>this.chain(new S(n,this.commandOptions));get=(...n)=>this.chain(new E(n,this.commandOptions));getbit=(...n)=>this.chain(new M(n,this.commandOptions));getdel=(...n)=>this.chain(new P(n,this.commandOptions));getrange=(...n)=>this.chain(new z(n,this.commandOptions));getset=(n,t)=>this.chain(new J([n,t],this.commandOptions));hdel=(...n)=>this.chain(new L(n,this.commandOptions));hexists=(...n)=>this.chain(new Z(n,this.commandOptions));hget=(...n)=>this.chain(new I(n,this.commandOptions));hgetall=(...n)=>this.chain(new K(n,this.commandOptions));hincrby=(...n)=>this.chain(new U(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new N(n,this.commandOptions));hkeys=(...n)=>this.chain(new B(n,this.commandOptions));hlen=(...n)=>this.chain(new H(n,this.commandOptions));hmget=(...n)=>this.chain(new G(n,this.commandOptions));hmset=(n,t)=>this.chain(new q([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new _([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new $(n,this.commandOptions));hset=(n,t)=>this.chain(new F([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new X([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new j(n,this.commandOptions));hvals=(...n)=>this.chain(new W(n,this.commandOptions));incr=(...n)=>this.chain(new V(n,this.commandOptions));incrby=(...n)=>this.chain(new Y(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new Q(n,this.commandOptions));keys=(...n)=>this.chain(new On(n,this.commandOptions));lindex=(...n)=>this.chain(new Dn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new wn([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new kn(n,this.commandOptions));lmove=(...n)=>this.chain(new An(n,this.commandOptions));lpop=(...n)=>this.chain(new Sn(n,this.commandOptions));lpos=(...n)=>this.chain(new Rn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new vn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new En([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new Mn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Pn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new zn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Jn(n,this.commandOptions));mget=(...n)=>this.chain(new Ln(n,this.commandOptions));mset=n=>this.chain(new Zn([n],this.commandOptions));msetnx=n=>this.chain(new In([n],this.commandOptions));persist=(...n)=>this.chain(new Kn(n,this.commandOptions));pexpire=(...n)=>this.chain(new Un(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Nn(n,this.commandOptions));ping=n=>this.chain(new Bn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Hn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Gn(n,this.commandOptions));publish=(...n)=>this.chain(new qn(n,this.commandOptions));randomkey=()=>this.chain(new _n(this.commandOptions));rename=(...n)=>this.chain(new $n(n,this.commandOptions));renamenx=(...n)=>this.chain(new Fn(n,this.commandOptions));rpop=(...n)=>this.chain(new Xn(n,this.commandOptions));rpush=(n,...t)=>this.chain(new jn([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new Wn([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new Vn([n,...t],this.commandOptions));scan=(...n)=>this.chain(new Yn(n,this.commandOptions));scard=(...n)=>this.chain(new Qn(n,this.commandOptions));scriptExists=(...n)=>this.chain(new nt(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new tt(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new et(n,this.commandOptions));sdiff=(...n)=>this.chain(new ot(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new st(n,this.commandOptions));set=(n,t,o)=>this.chain(new mt([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new rt(n,this.commandOptions));setex=(n,t,o)=>this.chain(new at([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new it([n,t],this.commandOptions));setrange=(...n)=>this.chain(new pt(n,this.commandOptions));sinter=(...n)=>this.chain(new dt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ct(n,this.commandOptions));sismember=(n,t)=>this.chain(new ut([n,t],this.commandOptions));smembers=(...n)=>this.chain(new ht(n,this.commandOptions));smismember=(n,t)=>this.chain(new lt([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Ct([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new gt(n,this.commandOptions));srandmember=(...n)=>this.chain(new xt(n,this.commandOptions));srem=(n,...t)=>this.chain(new ft([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new bt(n,this.commandOptions));strlen=(...n)=>this.chain(new yt(n,this.commandOptions));sunion=(...n)=>this.chain(new Tt(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Ot(n,this.commandOptions));time=()=>this.chain(new Dt(this.commandOptions));touch=(...n)=>this.chain(new wt(n,this.commandOptions));ttl=(...n)=>this.chain(new kt(n,this.commandOptions));type=(...n)=>this.chain(new At(n,this.commandOptions));unlink=(...n)=>this.chain(new St(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Rt(n,this.commandOptions));zcount=(...n)=>this.chain(new vt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Et([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new Mt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Pt(n,this.commandOptions));zmscore=(...n)=>this.chain(new Ft(n,this.commandOptions));zpopmax=(...n)=>this.chain(new zt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Jt(n,this.commandOptions));zrange=(...n)=>this.chain(new Lt(n,this.commandOptions));zrank=(n,t)=>this.chain(new Zt([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new It([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new Kt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new Ut(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Nt(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Bt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Ht(n,this.commandOptions));zscore=(n,t)=>this.chain(new Gt([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new _t(n,this.commandOptions));zunion=(...n)=>this.chain(new qt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new nn(n,this.commandOptions)),arrindex:(...n)=>this.chain(new tn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new en(n,this.commandOptions)),arrlen:(...n)=>this.chain(new on(n,this.commandOptions)),arrpop:(...n)=>this.chain(new sn(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new mn(n,this.commandOptions)),clear:(...n)=>this.chain(new rn(n,this.commandOptions)),del:(...n)=>this.chain(new an(n,this.commandOptions)),forget:(...n)=>this.chain(new pn(n,this.commandOptions)),geoadd:(...n)=>new R(n,this.commandOptions).exec(this.client),geodist:(...n)=>new v(n,this.commandOptions).exec(this.client),get:(...n)=>this.chain(new dn(n,this.commandOptions)),mget:(...n)=>this.chain(new cn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new un(n,this.commandOptions)),nummultby:(...n)=>this.chain(new hn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new ln(n,this.commandOptions)),objlen:(...n)=>this.chain(new Cn(n,this.commandOptions)),resp:(...n)=>this.chain(new gn(n,this.commandOptions)),set:(...n)=>this.chain(new xn(n,this.commandOptions)),strappend:(...n)=>this.chain(new fn(n,this.commandOptions)),strlen:(...n)=>this.chain(new bn(n,this.commandOptions)),toggle:(...n)=>this.chain(new yn(n,this.commandOptions)),type:(...n)=>this.chain(new Tn(n,this.commandOptions))}}};import ce from"crypto-js/enc-hex";import ue from"crypto-js/sha1";var Yt=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return ce.stringify(ue(n))}};var Qt=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new nn(n,this.opts).exec(this.client),arrindex:(...n)=>new tn(n,this.opts).exec(this.client),arrinsert:(...n)=>new en(n,this.opts).exec(this.client),arrlen:(...n)=>new on(n,this.opts).exec(this.client),arrpop:(...n)=>new sn(n,this.opts).exec(this.client),arrtrim:(...n)=>new mn(n,this.opts).exec(this.client),clear:(...n)=>new rn(n,this.opts).exec(this.client),del:(...n)=>new an(n,this.opts).exec(this.client),forget:(...n)=>new pn(n,this.opts).exec(this.client),geoadd:(...n)=>new R(n,this.opts).exec(this.client),geodist:(...n)=>new v(n,this.opts).exec(this.client),get:(...n)=>new dn(n,this.opts).exec(this.client),mget:(...n)=>new cn(n,this.opts).exec(this.client),numincrby:(...n)=>new un(n,this.opts).exec(this.client),nummultby:(...n)=>new hn(n,this.opts).exec(this.client),objkeys:(...n)=>new ln(n,this.opts).exec(this.client),objlen:(...n)=>new Cn(n,this.opts).exec(this.client),resp:(...n)=>new gn(n,this.opts).exec(this.client),set:(...n)=>new xn(n,this.opts).exec(this.client),strappend:(...n)=>new fn(n,this.opts).exec(this.client),strlen:(...n)=>new bn(n,this.opts).exec(this.client),toggle:(...n)=>new yn(n,this.opts).exec(this.client),type:(...n)=>new Tn(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new Yt(this,n)}pipeline=()=>new Xt({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new Xt({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new u(n,this.opts).exec(this.client);bitcount=(...n)=>new h(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new l([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new C(n,this.opts).exec(this.client);dbsize=()=>new g(this.opts).exec(this.client);decr=(...n)=>new x(n,this.opts).exec(this.client);decrby=(...n)=>new f(n,this.opts).exec(this.client);del=(...n)=>new b(n,this.opts).exec(this.client);echo=(...n)=>new y(n,this.opts).exec(this.client);eval=(...n)=>new T(n,this.opts).exec(this.client);evalsha=(...n)=>new O(n,this.opts).exec(this.client);exists=(...n)=>new D(n,this.opts).exec(this.client);expire=(...n)=>new w(n,this.opts).exec(this.client);expireat=(...n)=>new k(n,this.opts).exec(this.client);flushall=n=>new A(n,this.opts).exec(this.client);flushdb=(...n)=>new S(n,this.opts).exec(this.client);get=(...n)=>new E(n,this.opts).exec(this.client);getbit=(...n)=>new M(n,this.opts).exec(this.client);getdel=(...n)=>new P(n,this.opts).exec(this.client);getrange=(...n)=>new z(n,this.opts).exec(this.client);getset=(n,t)=>new J([n,t],this.opts).exec(this.client);hdel=(...n)=>new L(n,this.opts).exec(this.client);hexists=(...n)=>new Z(n,this.opts).exec(this.client);hget=(...n)=>new I(n,this.opts).exec(this.client);hgetall=(...n)=>new K(n,this.opts).exec(this.client);hincrby=(...n)=>new U(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new N(n,this.opts).exec(this.client);hkeys=(...n)=>new B(n,this.opts).exec(this.client);hlen=(...n)=>new H(n,this.opts).exec(this.client);hmget=(...n)=>new G(n,this.opts).exec(this.client);hmset=(n,t)=>new q([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new _([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new $(n,this.opts).exec(this.client);hset=(n,t)=>new F([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new X([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new j(n,this.opts).exec(this.client);hvals=(...n)=>new W(n,this.opts).exec(this.client);incr=(...n)=>new V(n,this.opts).exec(this.client);incrby=(...n)=>new Y(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new Q(n,this.opts).exec(this.client);keys=(...n)=>new On(n,this.opts).exec(this.client);lindex=(...n)=>new Dn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new wn([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new kn(n,this.opts).exec(this.client);lmove=(...n)=>new An(n,this.opts).exec(this.client);lpop=(...n)=>new Sn(n,this.opts).exec(this.client);lpos=(...n)=>new Rn(n,this.opts).exec(this.client);lpush=(n,...t)=>new vn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new En([n,...t],this.opts).exec(this.client);lrange=(...n)=>new Mn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Pn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new zn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Jn(n,this.opts).exec(this.client);mget=(...n)=>new Ln(n,this.opts).exec(this.client);mset=n=>new Zn([n],this.opts).exec(this.client);msetnx=n=>new In([n],this.opts).exec(this.client);persist=(...n)=>new Kn(n,this.opts).exec(this.client);pexpire=(...n)=>new Un(n,this.opts).exec(this.client);pexpireat=(...n)=>new Nn(n,this.opts).exec(this.client);ping=n=>new Bn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Hn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Gn(n,this.opts).exec(this.client);publish=(...n)=>new qn(n,this.opts).exec(this.client);randomkey=()=>new _n().exec(this.client);rename=(...n)=>new $n(n,this.opts).exec(this.client);renamenx=(...n)=>new Fn(n,this.opts).exec(this.client);rpop=(...n)=>new Xn(n,this.opts).exec(this.client);rpush=(n,...t)=>new jn([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new Wn([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new Vn([n,...t],this.opts).exec(this.client);scan=(...n)=>new Yn(n,this.opts).exec(this.client);scard=(...n)=>new Qn(n,this.opts).exec(this.client);scriptExists=(...n)=>new nt(n,this.opts).exec(this.client);scriptFlush=(...n)=>new tt(n,this.opts).exec(this.client);scriptLoad=(...n)=>new et(n,this.opts).exec(this.client);sdiff=(...n)=>new ot(n,this.opts).exec(this.client);sdiffstore=(...n)=>new st(n,this.opts).exec(this.client);set=(n,t,o)=>new mt([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new rt(n,this.opts).exec(this.client);setex=(n,t,o)=>new at([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new it([n,t],this.opts).exec(this.client);setrange=(...n)=>new pt(n,this.opts).exec(this.client);sinter=(...n)=>new dt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ct(n,this.opts).exec(this.client);sismember=(n,t)=>new ut([n,t],this.opts).exec(this.client);smismember=(n,t)=>new lt([n,t],this.opts).exec(this.client);smembers=(...n)=>new ht(n,this.opts).exec(this.client);smove=(n,t,o)=>new Ct([n,t,o],this.opts).exec(this.client);spop=(...n)=>new gt(n,this.opts).exec(this.client);srandmember=(...n)=>new xt(n,this.opts).exec(this.client);srem=(n,...t)=>new ft([n,...t],this.opts).exec(this.client);sscan=(...n)=>new bt(n,this.opts).exec(this.client);strlen=(...n)=>new yt(n,this.opts).exec(this.client);sunion=(...n)=>new Tt(n,this.opts).exec(this.client);sunionstore=(...n)=>new Ot(n,this.opts).exec(this.client);time=()=>new Dt().exec(this.client);touch=(...n)=>new wt(n,this.opts).exec(this.client);ttl=(...n)=>new kt(n,this.opts).exec(this.client);type=(...n)=>new At(n,this.opts).exec(this.client);unlink=(...n)=>new St(n,this.opts).exec(this.client);xadd=(...n)=>new Wt(n,this.opts).exec(this.client);xrange=(...n)=>new Vt(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Rt(n,this.opts).exec(this.client);zcount=(...n)=>new vt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new $t(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Et([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new Mt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Pt(n,this.opts).exec(this.client);zmscore=(...n)=>new Ft(n,this.opts).exec(this.client);zpopmax=(...n)=>new zt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Jt(n,this.opts).exec(this.client);zrange=(...n)=>new Lt(n,this.opts).exec(this.client);zrank=(n,t)=>new Zt([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new It([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new Kt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new Ut(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Nt(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Bt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Ht(n,this.opts).exec(this.client);zscore=(n,t)=>new Gt([n,t],this.opts).exec(this.client);zunion=(...n)=>new qt(n,this.opts).exec(this.client);zunionstore=(...n)=>new _t(n,this.opts).exec(this.client)};var se="v0.0.0-ci.5dc8a64a1d213ed26a30ad534b73faf791cb75c6";var me=class s extends Qt{constructor(n,t){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let o=new jt({retry:n.retry,baseUrl:n.url,headers:{authorization:`Bearer ${n.token}`},responseEncoding:n.responseEncoding});super(o,{enableTelemetry:!t?.UPSTASH_DISABLE_TELEMETRY,automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({platform:"cloudflare",sdk:`@upstash/redis@${se}`})}static fromEnv(n,t){let o=n?.UPSTASH_REDIS_REST_URL??UPSTASH_REDIS_REST_URL,m=n?.UPSTASH_REDIS_REST_TOKEN??UPSTASH_REDIS_REST_TOKEN;if(!o)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`");if(!m)throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`");return new s({...t,url:o,token:m},n)}};export{me as Redis};
|
package/fastly.d.mts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './redis-e3e8473f.js';
|
|
2
|
+
export { c as Requester, U as UpstashRequest, d as UpstashResponse } from './redis-e3e8473f.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Connection credentials for upstash redis.
|
|
6
|
+
* Get them from https://console.upstash.com/redis/<uuid>
|
|
7
|
+
*/
|
|
8
|
+
type RedisConfigFastly = {
|
|
9
|
+
/**
|
|
10
|
+
* UPSTASH_REDIS_REST_URL
|
|
11
|
+
*/
|
|
12
|
+
url: string;
|
|
13
|
+
/**
|
|
14
|
+
* UPSTASH_REDIS_REST_TOKEN
|
|
15
|
+
*/
|
|
16
|
+
token: string;
|
|
17
|
+
/**
|
|
18
|
+
* A Request can be forwarded to any backend defined on your service. Backends
|
|
19
|
+
* can be created via the Fastly CLI, API, or web interface, and are
|
|
20
|
+
* referenced by name.
|
|
21
|
+
*/
|
|
22
|
+
backend: string;
|
|
23
|
+
} & RedisOptions & RequesterConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Serverless redis client for upstash.
|
|
26
|
+
*/
|
|
27
|
+
declare class Redis extends Redis$1 {
|
|
28
|
+
/**
|
|
29
|
+
* Create a new redis client
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const redis = new Redis({
|
|
34
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
35
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
36
|
+
* backend: "upstash-db",
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
constructor(config: RedisConfigFastly);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { Redis, RedisConfigFastly };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { R as RedisOptions, a as RequesterConfig, b as Redis$1 } from './redis-e3e8473f.js';
|
|
2
|
+
export { c as Requester, U as UpstashRequest, d as UpstashResponse } from './redis-e3e8473f.js';
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash redis.
|
|
6
6
|
* Get them from https://console.upstash.com/redis/<uuid>
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
type RedisConfigFastly = {
|
|
9
9
|
/**
|
|
10
10
|
* UPSTASH_REDIS_REST_URL
|
|
11
11
|
*/
|
|
@@ -20,11 +20,11 @@ export declare type RedisConfigFastly = {
|
|
|
20
20
|
* referenced by name.
|
|
21
21
|
*/
|
|
22
22
|
backend: string;
|
|
23
|
-
} &
|
|
23
|
+
} & RedisOptions & RequesterConfig;
|
|
24
24
|
/**
|
|
25
25
|
* Serverless redis client for upstash.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
declare class Redis extends Redis$1 {
|
|
28
28
|
/**
|
|
29
29
|
* Create a new redis client
|
|
30
30
|
*
|
|
@@ -39,3 +39,5 @@ export declare class Redis extends core.Redis {
|
|
|
39
39
|
*/
|
|
40
40
|
constructor(config: RedisConfigFastly);
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
export { Redis, RedisConfigFastly };
|
package/fastly.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var ce=Object.create;var Wt=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,Ce=Object.prototype.hasOwnProperty;var ge=(s,n)=>{for(var t in n)Wt(s,t,{get:n[t],enumerable:!0})},oe=(s,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of he(n))!Ce.call(s,m)&&m!==t&&Wt(s,m,{get:()=>n[m],enumerable:!(o=ue(n,m))||o.enumerable});return s};var se=(s,n,t)=>(t=s!=null?ce(le(s)):{},oe(n||!s||!s.__esModule?Wt(t,"default",{value:s,enumerable:!0}):t,s)),xe=s=>oe(Wt({},"__esModule",{value:!0}),s);var De={};ge(De,{Redis:()=>ee});module.exports=xe(De);var p=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var Vt=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(c=>setTimeout(c,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new p(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:c})=>({result:te(i),error:c})):{result:te(r.result),error:r.error}:r}};function me(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function te(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?me(t):Array.isArray(t)?t.map(te):t):n=null;break}case"string":{n=s==="OK"?"OK":me(s);break}default:break}return n}function re(s){let n=Array.isArray(s)?s.map(t=>{try{return re(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function ae(s){try{return re(s)}catch{return s}}var fe=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=fe,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??ae:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new p(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var u=class extends e{constructor(n,t){super(["append",...n],t)}};var h=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var l=class extends e{constructor(n,t){super(["bitop",...n],t)}};var C=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var g=class extends e{constructor(n){super(["dbsize"],n)}};var x=class extends e{constructor(n,t){super(["decr",...n],t)}};var f=class extends e{constructor(n,t){super(["decrby",...n],t)}};var b=class extends e{constructor(n,t){super(["del",...n],t)}};var y=class extends e{constructor(n,t){super(["echo",...n],t)}};var O=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var T=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var w=class extends e{constructor(n,t){super(["exists",...n],t)}};var D=class extends e{constructor(n,t){super(["expire",...n],t)}};var k=class extends e{constructor(n,t){super(["expireat",...n],t)}};var A=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var S=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var R=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:c})=>[i,a,c])),super(r,m)}};var v=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var M=class extends e{constructor(n,t){super(["get",...n],t)}};var z=class extends e{constructor(n,t){super(["getbit",...n],t)}};var J=class extends e{constructor(n,t){super(["getdel",...n],t)}};var P=class extends e{constructor(n,t){super(["getrange",...n],t)}};var Z=class extends e{constructor(n,t){super(["getset",...n],t)}};var E=class extends e{constructor(n,t){super(["hdel",...n],t)}};var K=class extends e{constructor(n,t){super(["hexists",...n],t)}};var L=class extends e{constructor(n,t){super(["hget",...n],t)}};function be(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var N=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>be(o),...t})}};var I=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var U=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var B=class extends e{constructor([n],t){super(["hkeys",n],t)}};var G=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ye(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var H=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ye(t,m),...o})}};var q=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function Oe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var F=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>Oe(m):t?.deserialize,...t})}};var $=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var X=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var j=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var W=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var V=class extends e{constructor(n,t){super(["hvals",...n],t)}};var Y=class extends e{constructor(n,t){super(["incr",...n],t)}};var Q=class extends e{constructor(n,t){super(["incrby",...n],t)}};var _=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var nn=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var tn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var en=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var on=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var sn=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var mn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var rn=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var dn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var cn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var un=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var hn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var ln=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var yn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var Tn=class extends e{constructor(n,t){super(["keys",...n],t)}};var wn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var Dn=class extends e{constructor(n,t){super(["linsert",...n],t)}};var kn=class extends e{constructor(n,t){super(["llen",...n],t)}};var An=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Sn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Rn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var vn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var zn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Jn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Zn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var En=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Kn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Ln=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var Nn=class extends e{constructor(n,t){super(["persist",...n],t)}};var In=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Un=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Bn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Gn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Hn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var qn=class extends e{constructor(n,t){super(["publish",...n],t)}};var Fn=class extends e{constructor(n){super(["randomkey"],n)}};var $n=class extends e{constructor(n,t){super(["rename",...n],t)}};var Xn=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var jn=class extends e{constructor(n,t){super(["rpop",...n],t)}};var Wn=class extends e{constructor(n,t){super(["rpush",...n],t)}};var Vn=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var Yn=class extends e{constructor(n,t){super(["sadd",...n],t)}};var Qn=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var _n=class extends e{constructor(n,t){super(["scard",...n],t)}};var nt=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var tt=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var et=class extends e{constructor(n,t){super(["script","load",...n],t)}};var ot=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var st=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var mt=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var rt=class extends e{constructor(n,t){super(["setbit",...n],t)}};var at=class extends e{constructor(n,t){super(["setex",...n],t)}};var it=class extends e{constructor(n,t){super(["setnx",...n],t)}};var pt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var dt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ct=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var ut=class extends e{constructor(n,t){super(["sismember",...n],t)}};var ht=class extends e{constructor(n,t){super(["smembers",...n],t)}};var lt=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Ct=class extends e{constructor(n,t){super(["smove",...n],t)}};var gt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var xt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var ft=class extends e{constructor(n,t){super(["srem",...n],t)}};var bt=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var yt=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Ot=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Tt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var wt=class extends e{constructor(n){super(["time"],n)}};var Dt=class extends e{constructor(n,t){super(["touch",...n],t)}};var kt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var At=class extends e{constructor(n,t){super(["type",...n],t)}};var St=class extends e{constructor(n,t){super(["unlink",...n],t)}};var Yt=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,c]of Object.entries(o))a.push(i,c);super(a,r)}};function Te(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var Qt=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>Te(i),...r})}};var d=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Rt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var vt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Mt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var zt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Jt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Pt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Zt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Et=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Kt=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zrem",...n],t)}};var Nt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var It=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Ut=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Bt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Gt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Ht=class extends e{constructor(n,t){super(["zscore",...n],t)}};var qt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var Ft=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var $t=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var Xt=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var jt=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new p(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new u(n,this.commandOptions));bitcount=(...n)=>this.chain(new h(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new l([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new C(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new $t(n,this.commandOptions));dbsize=()=>this.chain(new g(this.commandOptions));decr=(...n)=>this.chain(new x(n,this.commandOptions));decrby=(...n)=>this.chain(new f(n,this.commandOptions));del=(...n)=>this.chain(new b(n,this.commandOptions));echo=(...n)=>this.chain(new y(n,this.commandOptions));eval=(...n)=>this.chain(new O(n,this.commandOptions));evalsha=(...n)=>this.chain(new T(n,this.commandOptions));exists=(...n)=>this.chain(new w(n,this.commandOptions));expire=(...n)=>this.chain(new D(n,this.commandOptions));expireat=(...n)=>this.chain(new k(n,this.commandOptions));flushall=n=>this.chain(new A(n,this.commandOptions));flushdb=(...n)=>this.chain(new S(n,this.commandOptions));get=(...n)=>this.chain(new M(n,this.commandOptions));getbit=(...n)=>this.chain(new z(n,this.commandOptions));getdel=(...n)=>this.chain(new J(n,this.commandOptions));getrange=(...n)=>this.chain(new P(n,this.commandOptions));getset=(n,t)=>this.chain(new Z([n,t],this.commandOptions));hdel=(...n)=>this.chain(new E(n,this.commandOptions));hexists=(...n)=>this.chain(new K(n,this.commandOptions));hget=(...n)=>this.chain(new L(n,this.commandOptions));hgetall=(...n)=>this.chain(new N(n,this.commandOptions));hincrby=(...n)=>this.chain(new I(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new U(n,this.commandOptions));hkeys=(...n)=>this.chain(new B(n,this.commandOptions));hlen=(...n)=>this.chain(new G(n,this.commandOptions));hmget=(...n)=>this.chain(new H(n,this.commandOptions));hmset=(n,t)=>this.chain(new q([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new F([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new $(n,this.commandOptions));hset=(n,t)=>this.chain(new X([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new j([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new W(n,this.commandOptions));hvals=(...n)=>this.chain(new V(n,this.commandOptions));incr=(...n)=>this.chain(new Y(n,this.commandOptions));incrby=(...n)=>this.chain(new Q(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new _(n,this.commandOptions));keys=(...n)=>this.chain(new Tn(n,this.commandOptions));lindex=(...n)=>this.chain(new wn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new Dn([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new kn(n,this.commandOptions));lmove=(...n)=>this.chain(new An(n,this.commandOptions));lpop=(...n)=>this.chain(new Sn(n,this.commandOptions));lpos=(...n)=>this.chain(new Rn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new vn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Mn([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new zn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Jn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Pn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Zn(n,this.commandOptions));mget=(...n)=>this.chain(new En(n,this.commandOptions));mset=n=>this.chain(new Kn([n],this.commandOptions));msetnx=n=>this.chain(new Ln([n],this.commandOptions));persist=(...n)=>this.chain(new Nn(n,this.commandOptions));pexpire=(...n)=>this.chain(new In(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Un(n,this.commandOptions));ping=n=>this.chain(new Bn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Hn(n,this.commandOptions));publish=(...n)=>this.chain(new qn(n,this.commandOptions));randomkey=()=>this.chain(new Fn(this.commandOptions));rename=(...n)=>this.chain(new $n(n,this.commandOptions));renamenx=(...n)=>this.chain(new Xn(n,this.commandOptions));rpop=(...n)=>this.chain(new jn(n,this.commandOptions));rpush=(n,...t)=>this.chain(new Wn([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new Vn([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new Yn([n,...t],this.commandOptions));scan=(...n)=>this.chain(new Qn(n,this.commandOptions));scard=(...n)=>this.chain(new _n(n,this.commandOptions));scriptExists=(...n)=>this.chain(new nt(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new tt(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new et(n,this.commandOptions));sdiff=(...n)=>this.chain(new ot(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new st(n,this.commandOptions));set=(n,t,o)=>this.chain(new mt([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new rt(n,this.commandOptions));setex=(n,t,o)=>this.chain(new at([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new it([n,t],this.commandOptions));setrange=(...n)=>this.chain(new pt(n,this.commandOptions));sinter=(...n)=>this.chain(new dt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ct(n,this.commandOptions));sismember=(n,t)=>this.chain(new ut([n,t],this.commandOptions));smembers=(...n)=>this.chain(new ht(n,this.commandOptions));smismember=(n,t)=>this.chain(new lt([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Ct([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new gt(n,this.commandOptions));srandmember=(...n)=>this.chain(new xt(n,this.commandOptions));srem=(n,...t)=>this.chain(new ft([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new bt(n,this.commandOptions));strlen=(...n)=>this.chain(new yt(n,this.commandOptions));sunion=(...n)=>this.chain(new Ot(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Tt(n,this.commandOptions));time=()=>this.chain(new wt(this.commandOptions));touch=(...n)=>this.chain(new Dt(n,this.commandOptions));ttl=(...n)=>this.chain(new kt(n,this.commandOptions));type=(...n)=>this.chain(new At(n,this.commandOptions));unlink=(...n)=>this.chain(new St(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Rt(n,this.commandOptions));zcount=(...n)=>this.chain(new vt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Mt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new zt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Jt(n,this.commandOptions));zmscore=(...n)=>this.chain(new Xt(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Pt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Zt(n,this.commandOptions));zrange=(...n)=>this.chain(new Et(n,this.commandOptions));zrank=(n,t)=>this.chain(new Kt([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Lt([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new Nt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new It(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Ut(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Bt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Gt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new Ft(n,this.commandOptions));zunion=(...n)=>this.chain(new qt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new nn(n,this.commandOptions)),arrindex:(...n)=>this.chain(new tn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new en(n,this.commandOptions)),arrlen:(...n)=>this.chain(new on(n,this.commandOptions)),arrpop:(...n)=>this.chain(new sn(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new mn(n,this.commandOptions)),clear:(...n)=>this.chain(new rn(n,this.commandOptions)),del:(...n)=>this.chain(new an(n,this.commandOptions)),forget:(...n)=>this.chain(new pn(n,this.commandOptions)),geoadd:(...n)=>new R(n,this.commandOptions).exec(this.client),geodist:(...n)=>new v(n,this.commandOptions).exec(this.client),get:(...n)=>this.chain(new dn(n,this.commandOptions)),mget:(...n)=>this.chain(new cn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new un(n,this.commandOptions)),nummultby:(...n)=>this.chain(new hn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new ln(n,this.commandOptions)),objlen:(...n)=>this.chain(new Cn(n,this.commandOptions)),resp:(...n)=>this.chain(new gn(n,this.commandOptions)),set:(...n)=>this.chain(new xn(n,this.commandOptions)),strappend:(...n)=>this.chain(new fn(n,this.commandOptions)),strlen:(...n)=>this.chain(new bn(n,this.commandOptions)),toggle:(...n)=>this.chain(new yn(n,this.commandOptions)),type:(...n)=>this.chain(new On(n,this.commandOptions))}}};var ie=se(require("crypto-js/enc-hex")),pe=se(require("crypto-js/sha1")),_t=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return ie.default.stringify((0,pe.default)(n))}};var ne=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new nn(n,this.opts).exec(this.client),arrindex:(...n)=>new tn(n,this.opts).exec(this.client),arrinsert:(...n)=>new en(n,this.opts).exec(this.client),arrlen:(...n)=>new on(n,this.opts).exec(this.client),arrpop:(...n)=>new sn(n,this.opts).exec(this.client),arrtrim:(...n)=>new mn(n,this.opts).exec(this.client),clear:(...n)=>new rn(n,this.opts).exec(this.client),del:(...n)=>new an(n,this.opts).exec(this.client),forget:(...n)=>new pn(n,this.opts).exec(this.client),geoadd:(...n)=>new R(n,this.opts).exec(this.client),geodist:(...n)=>new v(n,this.opts).exec(this.client),get:(...n)=>new dn(n,this.opts).exec(this.client),mget:(...n)=>new cn(n,this.opts).exec(this.client),numincrby:(...n)=>new un(n,this.opts).exec(this.client),nummultby:(...n)=>new hn(n,this.opts).exec(this.client),objkeys:(...n)=>new ln(n,this.opts).exec(this.client),objlen:(...n)=>new Cn(n,this.opts).exec(this.client),resp:(...n)=>new gn(n,this.opts).exec(this.client),set:(...n)=>new xn(n,this.opts).exec(this.client),strappend:(...n)=>new fn(n,this.opts).exec(this.client),strlen:(...n)=>new bn(n,this.opts).exec(this.client),toggle:(...n)=>new yn(n,this.opts).exec(this.client),type:(...n)=>new On(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new _t(this,n)}pipeline=()=>new jt({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new jt({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new u(n,this.opts).exec(this.client);bitcount=(...n)=>new h(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new l([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new C(n,this.opts).exec(this.client);dbsize=()=>new g(this.opts).exec(this.client);decr=(...n)=>new x(n,this.opts).exec(this.client);decrby=(...n)=>new f(n,this.opts).exec(this.client);del=(...n)=>new b(n,this.opts).exec(this.client);echo=(...n)=>new y(n,this.opts).exec(this.client);eval=(...n)=>new O(n,this.opts).exec(this.client);evalsha=(...n)=>new T(n,this.opts).exec(this.client);exists=(...n)=>new w(n,this.opts).exec(this.client);expire=(...n)=>new D(n,this.opts).exec(this.client);expireat=(...n)=>new k(n,this.opts).exec(this.client);flushall=n=>new A(n,this.opts).exec(this.client);flushdb=(...n)=>new S(n,this.opts).exec(this.client);get=(...n)=>new M(n,this.opts).exec(this.client);getbit=(...n)=>new z(n,this.opts).exec(this.client);getdel=(...n)=>new J(n,this.opts).exec(this.client);getrange=(...n)=>new P(n,this.opts).exec(this.client);getset=(n,t)=>new Z([n,t],this.opts).exec(this.client);hdel=(...n)=>new E(n,this.opts).exec(this.client);hexists=(...n)=>new K(n,this.opts).exec(this.client);hget=(...n)=>new L(n,this.opts).exec(this.client);hgetall=(...n)=>new N(n,this.opts).exec(this.client);hincrby=(...n)=>new I(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new U(n,this.opts).exec(this.client);hkeys=(...n)=>new B(n,this.opts).exec(this.client);hlen=(...n)=>new G(n,this.opts).exec(this.client);hmget=(...n)=>new H(n,this.opts).exec(this.client);hmset=(n,t)=>new q([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new F([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new $(n,this.opts).exec(this.client);hset=(n,t)=>new X([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new j([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new W(n,this.opts).exec(this.client);hvals=(...n)=>new V(n,this.opts).exec(this.client);incr=(...n)=>new Y(n,this.opts).exec(this.client);incrby=(...n)=>new Q(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new _(n,this.opts).exec(this.client);keys=(...n)=>new Tn(n,this.opts).exec(this.client);lindex=(...n)=>new wn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new Dn([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new kn(n,this.opts).exec(this.client);lmove=(...n)=>new An(n,this.opts).exec(this.client);lpop=(...n)=>new Sn(n,this.opts).exec(this.client);lpos=(...n)=>new Rn(n,this.opts).exec(this.client);lpush=(n,...t)=>new vn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Mn([n,...t],this.opts).exec(this.client);lrange=(...n)=>new zn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Jn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Pn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Zn(n,this.opts).exec(this.client);mget=(...n)=>new En(n,this.opts).exec(this.client);mset=n=>new Kn([n],this.opts).exec(this.client);msetnx=n=>new Ln([n],this.opts).exec(this.client);persist=(...n)=>new Nn(n,this.opts).exec(this.client);pexpire=(...n)=>new In(n,this.opts).exec(this.client);pexpireat=(...n)=>new Un(n,this.opts).exec(this.client);ping=n=>new Bn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Hn(n,this.opts).exec(this.client);publish=(...n)=>new qn(n,this.opts).exec(this.client);randomkey=()=>new Fn().exec(this.client);rename=(...n)=>new $n(n,this.opts).exec(this.client);renamenx=(...n)=>new Xn(n,this.opts).exec(this.client);rpop=(...n)=>new jn(n,this.opts).exec(this.client);rpush=(n,...t)=>new Wn([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new Vn([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new Yn([n,...t],this.opts).exec(this.client);scan=(...n)=>new Qn(n,this.opts).exec(this.client);scard=(...n)=>new _n(n,this.opts).exec(this.client);scriptExists=(...n)=>new nt(n,this.opts).exec(this.client);scriptFlush=(...n)=>new tt(n,this.opts).exec(this.client);scriptLoad=(...n)=>new et(n,this.opts).exec(this.client);sdiff=(...n)=>new ot(n,this.opts).exec(this.client);sdiffstore=(...n)=>new st(n,this.opts).exec(this.client);set=(n,t,o)=>new mt([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new rt(n,this.opts).exec(this.client);setex=(n,t,o)=>new at([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new it([n,t],this.opts).exec(this.client);setrange=(...n)=>new pt(n,this.opts).exec(this.client);sinter=(...n)=>new dt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ct(n,this.opts).exec(this.client);sismember=(n,t)=>new ut([n,t],this.opts).exec(this.client);smismember=(n,t)=>new lt([n,t],this.opts).exec(this.client);smembers=(...n)=>new ht(n,this.opts).exec(this.client);smove=(n,t,o)=>new Ct([n,t,o],this.opts).exec(this.client);spop=(...n)=>new gt(n,this.opts).exec(this.client);srandmember=(...n)=>new xt(n,this.opts).exec(this.client);srem=(n,...t)=>new ft([n,...t],this.opts).exec(this.client);sscan=(...n)=>new bt(n,this.opts).exec(this.client);strlen=(...n)=>new yt(n,this.opts).exec(this.client);sunion=(...n)=>new Ot(n,this.opts).exec(this.client);sunionstore=(...n)=>new Tt(n,this.opts).exec(this.client);time=()=>new wt().exec(this.client);touch=(...n)=>new Dt(n,this.opts).exec(this.client);ttl=(...n)=>new kt(n,this.opts).exec(this.client);type=(...n)=>new At(n,this.opts).exec(this.client);unlink=(...n)=>new St(n,this.opts).exec(this.client);xadd=(...n)=>new Yt(n,this.opts).exec(this.client);xrange=(...n)=>new Qt(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Rt(n,this.opts).exec(this.client);zcount=(...n)=>new vt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new $t(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Mt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new zt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Jt(n,this.opts).exec(this.client);zmscore=(...n)=>new Xt(n,this.opts).exec(this.client);zpopmax=(...n)=>new Pt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Zt(n,this.opts).exec(this.client);zrange=(...n)=>new Et(n,this.opts).exec(this.client);zrank=(n,t)=>new Kt([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Lt([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new Nt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new It(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Ut(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Bt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Gt(n,this.opts).exec(this.client);zscore=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zunion=(...n)=>new qt(n,this.opts).exec(this.client);zunionstore=(...n)=>new Ft(n,this.opts).exec(this.client)};var de="v0.0.0-ci.5dc8a64a1d213ed26a30ad534b73faf791cb75c6";var ee=class extends ne{constructor(n){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new Vt({baseUrl:n.url,retry:n.retry,headers:{authorization:`Bearer ${n.token}`},options:{backend:n.backend},responseEncoding:n.responseEncoding});super(t,{automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({sdk:`@upstash/redis@${de}`,platform:"fastly"})}};0&&(module.exports={Redis});
|
package/fastly.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=class extends Error{constructor(n){super(n),this.name="UpstashError"}};var Wt=class{baseUrl;headers;options;retry;constructor(n){this.options={backend:n.options?.backend,agent:n.agent,responseEncoding:n.responseEncoding??"base64",cache:n.cache},this.baseUrl=n.baseUrl.replace(/\/$/,""),this.headers={"Content-Type":"application/json",...n.headers},this.options.responseEncoding==="base64"&&(this.headers["Upstash-Encoding"]="base64"),typeof n?.retry=="boolean"&&n?.retry===!1?this.retry={attempts:1,backoff:()=>0}:this.retry={attempts:n?.retry?.retries??5,backoff:n?.retry?.backoff??(t=>Math.exp(t)*50)}}mergeTelemetry(n){function t(o,m,r){return r&&(o[m]?o[m]=[o[m],r].join(","):o[m]=r),o}this.headers=t(this.headers,"Upstash-Telemetry-Runtime",n.runtime),this.headers=t(this.headers,"Upstash-Telemetry-Platform",n.platform),this.headers=t(this.headers,"Upstash-Telemetry-Sdk",n.sdk)}async request(n){let t={cache:this.options.cache,method:"POST",headers:this.headers,body:JSON.stringify(n.body),keepalive:!0,agent:this.options?.agent,backend:this.options?.backend},o=null,m=null;for(let a=0;a<=this.retry.attempts;a++)try{o=await fetch([this.baseUrl,...n.path??[]].join("/"),t);break}catch(i){m=i,await new Promise(c=>setTimeout(c,this.retry.backoff(a)))}if(!o)throw m??new Error("Exhausted all retries");let r=await o.json();if(!o.ok)throw new p(`${r.error}, command was: ${JSON.stringify(n.body)}`);return this.options?.responseEncoding==="base64"?Array.isArray(r)?r.map(({result:i,error:c})=>({result:ne(i),error:c})):{result:ne(r.result),error:r.error}:r}};function te(s){let n="";try{let t=atob(s),o=t.length,m=new Uint8Array(o);for(let r=0;r<o;r++)m[r]=t.charCodeAt(r);n=new TextDecoder().decode(m)}catch{n=s}return n}function ne(s){let n;switch(typeof s){case"undefined":return s;case"number":{n=s;break}case"object":{Array.isArray(s)?n=s.map(t=>typeof t=="string"?te(t):Array.isArray(t)?t.map(ne):t):n=null;break}case"string":{n=s==="OK"?"OK":te(s);break}default:break}return n}function ee(s){let n=Array.isArray(s)?s.map(t=>{try{return ee(t)}catch{return t}}):JSON.parse(s);return typeof n=="number"&&n.toString()!==s?s:n}function oe(s){try{return ee(s)}catch{return s}}var re=s=>{switch(typeof s){case"string":case"number":case"boolean":return s;default:return JSON.stringify(s)}},e=class{command;serialize;deserialize;constructor(n,t){this.serialize=re,this.deserialize=typeof t?.automaticDeserialization>"u"||t.automaticDeserialization?t?.deserialize??oe:o=>o,this.command=n.map(o=>this.serialize(o))}async exec(n){let{result:t,error:o}=await n.request({body:this.command});if(o)throw new p(o);if(typeof t>"u")throw new Error("Request did not return a result");return this.deserialize(t)}};var u=class extends e{constructor(n,t){super(["append",...n],t)}};var h=class extends e{constructor([n,t,o],m){let r=["bitcount",n];typeof t=="number"&&r.push(t),typeof o=="number"&&r.push(o),super(r,m)}};var l=class extends e{constructor(n,t){super(["bitop",...n],t)}};var C=class extends e{constructor(n,t){super(["bitpos",...n],t)}};var g=class extends e{constructor(n){super(["dbsize"],n)}};var x=class extends e{constructor(n,t){super(["decr",...n],t)}};var f=class extends e{constructor(n,t){super(["decrby",...n],t)}};var b=class extends e{constructor(n,t){super(["del",...n],t)}};var y=class extends e{constructor(n,t){super(["echo",...n],t)}};var O=class extends e{constructor([n,t,o],m){super(["eval",n,t.length,...t,...o??[]],m)}};var T=class extends e{constructor([n,t,o],m){super(["evalsha",n,t.length,...t,...o??[]],m)}};var w=class extends e{constructor(n,t){super(["exists",...n],t)}};var D=class extends e{constructor(n,t){super(["expire",...n],t)}};var k=class extends e{constructor(n,t){super(["expireat",...n],t)}};var A=class extends e{constructor(n,t){let o=["flushall"];n&&n.length>0&&n[0].async&&o.push("async"),super(o,t)}};var S=class extends e{constructor([n],t){let o=["flushdb"];n?.async&&o.push("async"),super(o,t)}};var R=class extends e{constructor([n,t,...o],m){let r=["geoadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"latitude"in t&&t.latitude&&r.push(t.longitude,t.latitude,t.member),r.push(...o.flatMap(({latitude:a,longitude:i,member:c})=>[i,a,c])),super(r,m)}};var v=class extends e{constructor([n,t,o,m="M"],r){super(["GEODIST",n,t,o,m],r)}};var M=class extends e{constructor(n,t){super(["get",...n],t)}};var z=class extends e{constructor(n,t){super(["getbit",...n],t)}};var J=class extends e{constructor(n,t){super(["getdel",...n],t)}};var P=class extends e{constructor(n,t){super(["getrange",...n],t)}};var Z=class extends e{constructor(n,t){super(["getset",...n],t)}};var E=class extends e{constructor(n,t){super(["hdel",...n],t)}};var K=class extends e{constructor(n,t){super(["hexists",...n],t)}};var L=class extends e{constructor(n,t){super(["hget",...n],t)}};function ae(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{!Number.isNaN(Number(o))&&!Number.isSafeInteger(o)?n[t]=o:n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var N=class extends e{constructor(n,t){super(["hgetall",...n],{deserialize:o=>ae(o),...t})}};var I=class extends e{constructor(n,t){super(["hincrby",...n],t)}};var U=class extends e{constructor(n,t){super(["hincrbyfloat",...n],t)}};var B=class extends e{constructor([n],t){super(["hkeys",n],t)}};var G=class extends e{constructor(n,t){super(["hlen",...n],t)}};function ie(s,n){if(n.length===0||n.every(o=>o===null))return null;let t={};for(let o=0;o<s.length;o++)try{t[s[o]]=JSON.parse(n[o])}catch{t[s[o]]=n[o]}return t}var H=class extends e{constructor([n,...t],o){super(["hmget",n,...t],{deserialize:m=>ie(t,m),...o})}};var q=class extends e{constructor([n,t],o){super(["hmset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};function pe(s){if(s.length===0)return null;let n={};for(;s.length>=2;){let t=s.shift(),o=s.shift();try{n[t]=JSON.parse(o)}catch{n[t]=o}}return n}var F=class extends e{constructor(n,t){let o=["hrandfield",n[0]];typeof n[1]=="number"&&o.push(n[1]),n[2]&&o.push("WITHVALUES"),super(o,{deserialize:n[2]?m=>pe(m):t?.deserialize,...t})}};var $=class extends e{constructor([n,t,o],m){let r=["hscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var X=class extends e{constructor([n,t],o){super(["hset",n,...Object.entries(t).flatMap(([m,r])=>[m,r])],o)}};var j=class extends e{constructor(n,t){super(["hsetnx",...n],t)}};var W=class extends e{constructor(n,t){super(["hstrlen",...n],t)}};var V=class extends e{constructor(n,t){super(["hvals",...n],t)}};var Y=class extends e{constructor(n,t){super(["incr",...n],t)}};var Q=class extends e{constructor(n,t){super(["incrby",...n],t)}};var _=class extends e{constructor(n,t){super(["incrbyfloat",...n],t)}};var nn=class extends e{constructor(n,t){super(["JSON.ARRAPPEND",...n],t)}};var tn=class extends e{constructor(n,t){super(["JSON.ARRINDEX",...n],t)}};var en=class extends e{constructor(n,t){super(["JSON.ARRINSERT",...n],t)}};var on=class extends e{constructor(n,t){super(["JSON.ARRLEN",n[0],n[1]??"$"],t)}};var sn=class extends e{constructor(n,t){super(["JSON.ARRPOP",...n],t)}};var mn=class extends e{constructor(n,t){let o=n[1]??"$",m=n[2]??0,r=n[3]??0;super(["JSON.ARRTRIM",n[0],o,m,r],t)}};var rn=class extends e{constructor(n,t){super(["JSON.CLEAR",...n],t)}};var an=class extends e{constructor(n,t){super(["JSON.DEL",...n],t)}};var pn=class extends e{constructor(n,t){super(["JSON.FORGET",...n],t)}};var dn=class extends e{constructor(n,t){let o=["JSON.GET"];typeof n[1]=="string"?o.push(...n):(o.push(n[0]),n[1]&&(n[1].indent&&o.push("INDENT",n[1].indent),n[1].newline&&o.push("NEWLINE",n[1].newline),n[1].space&&o.push("SPACE",n[1].space)),o.push(...n.slice(2))),super(o,t)}};var cn=class extends e{constructor(n,t){super(["JSON.MGET",...n[0],n[1]],t)}};var un=class extends e{constructor(n,t){super(["JSON.NUMINCRBY",...n],t)}};var hn=class extends e{constructor(n,t){super(["JSON.NUMMULTBY",...n],t)}};var ln=class extends e{constructor(n,t){super(["JSON.OBJKEYS",...n],t)}};var Cn=class extends e{constructor(n,t){super(["JSON.OBJLEN",...n],t)}};var gn=class extends e{constructor(n,t){super(["JSON.RESP",...n],t)}};var xn=class extends e{constructor(n,t){let o=["JSON.SET",n[0],n[1],n[2]];n[3]&&(n[3].nx?o.push("NX"):n[3].xx&&o.push("XX")),super(o,t)}};var fn=class extends e{constructor(n,t){super(["JSON.STRAPPEND",...n],t)}};var bn=class extends e{constructor(n,t){super(["JSON.STRLEN",...n],t)}};var yn=class extends e{constructor(n,t){super(["JSON.TOGGLE",...n],t)}};var On=class extends e{constructor(n,t){super(["JSON.TYPE",...n],t)}};var Tn=class extends e{constructor(n,t){super(["keys",...n],t)}};var wn=class extends e{constructor(n,t){super(["lindex",...n],t)}};var Dn=class extends e{constructor(n,t){super(["linsert",...n],t)}};var kn=class extends e{constructor(n,t){super(["llen",...n],t)}};var An=class extends e{constructor(n,t){super(["lmove",...n],t)}};var Sn=class extends e{constructor(n,t){super(["lpop",...n],t)}};var Rn=class extends e{constructor(n,t){let o=["lpos",n[0],n[1]];typeof n[2]?.rank=="number"&&o.push("rank",n[2].rank),typeof n[2]?.count=="number"&&o.push("count",n[2].count),typeof n[2]?.maxLen=="number"&&o.push("maxLen",n[2].maxLen),super(o,t)}};var vn=class extends e{constructor(n,t){super(["lpush",...n],t)}};var Mn=class extends e{constructor(n,t){super(["lpushx",...n],t)}};var zn=class extends e{constructor(n,t){super(["lrange",...n],t)}};var Jn=class extends e{constructor(n,t){super(["lrem",...n],t)}};var Pn=class extends e{constructor(n,t){super(["lset",...n],t)}};var Zn=class extends e{constructor(n,t){super(["ltrim",...n],t)}};var En=class extends e{constructor(n,t){let o=Array.isArray(n[0])?n[0]:n;super(["mget",...o],t)}};var Kn=class extends e{constructor([n],t){super(["mset",...Object.entries(n).flatMap(([o,m])=>[o,m])],t)}};var Ln=class extends e{constructor([n],t){super(["msetnx",...Object.entries(n).flatMap(o=>o)],t)}};var Nn=class extends e{constructor(n,t){super(["persist",...n],t)}};var In=class extends e{constructor(n,t){super(["pexpire",...n],t)}};var Un=class extends e{constructor(n,t){super(["pexpireat",...n],t)}};var Bn=class extends e{constructor(n,t){let o=["ping"];typeof n<"u"&&typeof n[0]<"u"&&o.push(n[0]),super(o,t)}};var Gn=class extends e{constructor(n,t){super(["psetex",...n],t)}};var Hn=class extends e{constructor(n,t){super(["pttl",...n],t)}};var qn=class extends e{constructor(n,t){super(["publish",...n],t)}};var Fn=class extends e{constructor(n){super(["randomkey"],n)}};var $n=class extends e{constructor(n,t){super(["rename",...n],t)}};var Xn=class extends e{constructor(n,t){super(["renamenx",...n],t)}};var jn=class extends e{constructor(n,t){super(["rpop",...n],t)}};var Wn=class extends e{constructor(n,t){super(["rpush",...n],t)}};var Vn=class extends e{constructor(n,t){super(["rpushx",...n],t)}};var Yn=class extends e{constructor(n,t){super(["sadd",...n],t)}};var Qn=class extends e{constructor([n,t],o){let m=["scan",n];t?.match&&m.push("match",t.match),typeof t?.count=="number"&&m.push("count",t.count),t?.type&&t.type.length>0&&m.push("type",t.type),super(m,o)}};var _n=class extends e{constructor(n,t){super(["scard",...n],t)}};var nt=class extends e{constructor(n,t){super(["script","exists",...n],{deserialize:o=>o,...t})}};var tt=class extends e{constructor([n],t){let o=["script","flush"];n?.sync?o.push("sync"):n?.async&&o.push("async"),super(o,t)}};var et=class extends e{constructor(n,t){super(["script","load",...n],t)}};var ot=class extends e{constructor(n,t){super(["sdiff",...n],t)}};var st=class extends e{constructor(n,t){super(["sdiffstore",...n],t)}};var mt=class extends e{constructor([n,t,o],m){let r=["set",n,t];o&&("nx"in o&&o.nx?r.push("nx"):"xx"in o&&o.xx&&r.push("xx"),"get"in o&&o.get&&r.push("get"),"ex"in o&&typeof o.ex=="number"?r.push("ex",o.ex):"px"in o&&typeof o.px=="number"?r.push("px",o.px):"exat"in o&&typeof o.exat=="number"?r.push("exat",o.exat):"pxat"in o&&typeof o.pxat=="number"?r.push("pxat",o.pxat):"keepTtl"in o&&o.keepTtl&&r.push("keepTtl")),super(r,m)}};var rt=class extends e{constructor(n,t){super(["setbit",...n],t)}};var at=class extends e{constructor(n,t){super(["setex",...n],t)}};var it=class extends e{constructor(n,t){super(["setnx",...n],t)}};var pt=class extends e{constructor(n,t){super(["setrange",...n],t)}};var dt=class extends e{constructor(n,t){super(["sinter",...n],t)}};var ct=class extends e{constructor(n,t){super(["sinterstore",...n],t)}};var ut=class extends e{constructor(n,t){super(["sismember",...n],t)}};var ht=class extends e{constructor(n,t){super(["smembers",...n],t)}};var lt=class extends e{constructor(n,t){super(["smismember",n[0],...n[1]],t)}};var Ct=class extends e{constructor(n,t){super(["smove",...n],t)}};var gt=class extends e{constructor([n,t],o){let m=["spop",n];typeof t=="number"&&m.push(t),super(m,o)}};var xt=class extends e{constructor([n,t],o){let m=["srandmember",n];typeof t=="number"&&m.push(t),super(m,o)}};var ft=class extends e{constructor(n,t){super(["srem",...n],t)}};var bt=class extends e{constructor([n,t,o],m){let r=["sscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var yt=class extends e{constructor(n,t){super(["strlen",...n],t)}};var Ot=class extends e{constructor(n,t){super(["sunion",...n],t)}};var Tt=class extends e{constructor(n,t){super(["sunionstore",...n],t)}};var wt=class extends e{constructor(n){super(["time"],n)}};var Dt=class extends e{constructor(n,t){super(["touch",...n],t)}};var kt=class extends e{constructor(n,t){super(["ttl",...n],t)}};var At=class extends e{constructor(n,t){super(["type",...n],t)}};var St=class extends e{constructor(n,t){super(["unlink",...n],t)}};var Vt=class extends e{constructor([n,t,o,m],r){let a=["XADD",n];m&&(m.nomkStream&&a.push("NOMKSTREAM"),m.trim&&(a.push(m.trim.type,m.trim.comparison,m.trim.threshold),typeof m.trim.limit<"u"&&a.push("LIMIT",m.trim.limit))),a.push(t);for(let[i,c]of Object.entries(o))a.push(i,c);super(a,r)}};function de(s){let n={};for(let t of s)for(;t.length>=2;){let o=t.shift(),m=t.shift();for((o in n)||(n[o]={});m.length>=2;){let r=m.shift(),a=m.shift();try{n[o][r]=JSON.parse(a)}catch{n[o][r]=a}}}return n}var Yt=class extends e{constructor([n,t,o,m],r){let a=["XRANGE",n,t,o];typeof m=="number"&&a.push("COUNT",m),super(a,{deserialize:i=>de(i),...r})}};var d=class extends e{constructor([n,t,...o],m){let r=["zadd",n];"nx"in t&&t.nx?r.push("nx"):"xx"in t&&t.xx&&r.push("xx"),"ch"in t&&t.ch&&r.push("ch"),"incr"in t&&t.incr&&r.push("incr"),"score"in t&&"member"in t&&r.push(t.score,t.member),r.push(...o.flatMap(({score:a,member:i})=>[a,i])),super(r,m)}};var Rt=class extends e{constructor(n,t){super(["zcard",...n],t)}};var vt=class extends e{constructor(n,t){super(["zcount",...n],t)}};var Mt=class extends e{constructor(n,t){super(["zincrby",...n],t)}};var zt=class extends e{constructor([n,t,o,m],r){let a=["zinterstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var Jt=class extends e{constructor(n,t){super(["zlexcount",...n],t)}};var Pt=class extends e{constructor([n,t],o){let m=["zpopmax",n];typeof t=="number"&&m.push(t),super(m,o)}};var Zt=class extends e{constructor([n,t],o){let m=["zpopmin",n];typeof t=="number"&&m.push(t),super(m,o)}};var Et=class extends e{constructor([n,t,o,m],r){let a=["zrange",n,t,o];m?.byScore&&a.push("byscore"),m?.byLex&&a.push("bylex"),m?.rev&&a.push("rev"),typeof m?.count<"u"&&typeof m?.offset<"u"&&a.push("limit",m.offset,m.count),m?.withScores&&a.push("withscores"),super(a,r)}};var Kt=class extends e{constructor(n,t){super(["zrank",...n],t)}};var Lt=class extends e{constructor(n,t){super(["zrem",...n],t)}};var Nt=class extends e{constructor(n,t){super(["zremrangebylex",...n],t)}};var It=class extends e{constructor(n,t){super(["zremrangebyrank",...n],t)}};var Ut=class extends e{constructor(n,t){super(["zremrangebyscore",...n],t)}};var Bt=class extends e{constructor(n,t){super(["zrevrank",...n],t)}};var Gt=class extends e{constructor([n,t,o],m){let r=["zscan",n,t];o?.match&&r.push("match",o.match),typeof o?.count=="number"&&r.push("count",o.count),super(r,m)}};var Ht=class extends e{constructor(n,t){super(["zscore",...n],t)}};var qt=class extends e{constructor([n,t,o],m){let r=["zunion",n];Array.isArray(t)?r.push(...t):r.push(t),o&&("weights"in o&&o.weights?r.push("weights",...o.weights):"weight"in o&&typeof o.weight=="number"&&r.push("weights",o.weight),"aggregate"in o&&r.push("aggregate",o.aggregate),o?.withScores&&r.push("withscores")),super(r,m)}};var Ft=class extends e{constructor([n,t,o,m],r){let a=["zunionstore",n,t];Array.isArray(o)?a.push(...o):a.push(o),m&&("weights"in m&&m.weights?a.push("weights",...m.weights):"weight"in m&&typeof m.weight=="number"&&a.push("weights",m.weight),"aggregate"in m&&a.push("aggregate",m.aggregate)),super(a,r)}};var $t=class extends e{constructor(n,t){super(["zdiffstore",...n],t)}};var Xt=class extends e{constructor(n,t){let[o,m]=n;super(["zmscore",o,...m],t)}};var jt=class{client;commands;commandOptions;multiExec;constructor(n){this.client=n.client,this.commands=[],this.commandOptions=n.commandOptions,this.multiExec=n.multiExec??!1}exec=async()=>{if(this.commands.length===0)throw new Error("Pipeline is empty");let n=this.multiExec?["multi-exec"]:["pipeline"];return(await this.client.request({path:n,body:Object.values(this.commands).map(o=>o.command)})).map(({error:o,result:m},r)=>{if(o)throw new p(`Command ${r+1} [ ${this.commands[r].command[0]} ] failed: ${o}`);return this.commands[r].deserialize(m)})};length(){return this.commands.length}chain(n){return this.commands.push(n),this}append=(...n)=>this.chain(new u(n,this.commandOptions));bitcount=(...n)=>this.chain(new h(n,this.commandOptions));bitop=(n,t,o,...m)=>this.chain(new l([n,t,o,...m],this.commandOptions));bitpos=(...n)=>this.chain(new C(n,this.commandOptions));zdiffstore=(...n)=>this.chain(new $t(n,this.commandOptions));dbsize=()=>this.chain(new g(this.commandOptions));decr=(...n)=>this.chain(new x(n,this.commandOptions));decrby=(...n)=>this.chain(new f(n,this.commandOptions));del=(...n)=>this.chain(new b(n,this.commandOptions));echo=(...n)=>this.chain(new y(n,this.commandOptions));eval=(...n)=>this.chain(new O(n,this.commandOptions));evalsha=(...n)=>this.chain(new T(n,this.commandOptions));exists=(...n)=>this.chain(new w(n,this.commandOptions));expire=(...n)=>this.chain(new D(n,this.commandOptions));expireat=(...n)=>this.chain(new k(n,this.commandOptions));flushall=n=>this.chain(new A(n,this.commandOptions));flushdb=(...n)=>this.chain(new S(n,this.commandOptions));get=(...n)=>this.chain(new M(n,this.commandOptions));getbit=(...n)=>this.chain(new z(n,this.commandOptions));getdel=(...n)=>this.chain(new J(n,this.commandOptions));getrange=(...n)=>this.chain(new P(n,this.commandOptions));getset=(n,t)=>this.chain(new Z([n,t],this.commandOptions));hdel=(...n)=>this.chain(new E(n,this.commandOptions));hexists=(...n)=>this.chain(new K(n,this.commandOptions));hget=(...n)=>this.chain(new L(n,this.commandOptions));hgetall=(...n)=>this.chain(new N(n,this.commandOptions));hincrby=(...n)=>this.chain(new I(n,this.commandOptions));hincrbyfloat=(...n)=>this.chain(new U(n,this.commandOptions));hkeys=(...n)=>this.chain(new B(n,this.commandOptions));hlen=(...n)=>this.chain(new G(n,this.commandOptions));hmget=(...n)=>this.chain(new H(n,this.commandOptions));hmset=(n,t)=>this.chain(new q([n,t],this.commandOptions));hrandfield=(n,t,o)=>this.chain(new F([n,t,o],this.commandOptions));hscan=(...n)=>this.chain(new $(n,this.commandOptions));hset=(n,t)=>this.chain(new X([n,t],this.commandOptions));hsetnx=(n,t,o)=>this.chain(new j([n,t,o],this.commandOptions));hstrlen=(...n)=>this.chain(new W(n,this.commandOptions));hvals=(...n)=>this.chain(new V(n,this.commandOptions));incr=(...n)=>this.chain(new Y(n,this.commandOptions));incrby=(...n)=>this.chain(new Q(n,this.commandOptions));incrbyfloat=(...n)=>this.chain(new _(n,this.commandOptions));keys=(...n)=>this.chain(new Tn(n,this.commandOptions));lindex=(...n)=>this.chain(new wn(n,this.commandOptions));linsert=(n,t,o,m)=>this.chain(new Dn([n,t,o,m],this.commandOptions));llen=(...n)=>this.chain(new kn(n,this.commandOptions));lmove=(...n)=>this.chain(new An(n,this.commandOptions));lpop=(...n)=>this.chain(new Sn(n,this.commandOptions));lpos=(...n)=>this.chain(new Rn(n,this.commandOptions));lpush=(n,...t)=>this.chain(new vn([n,...t],this.commandOptions));lpushx=(n,...t)=>this.chain(new Mn([n,...t],this.commandOptions));lrange=(...n)=>this.chain(new zn(n,this.commandOptions));lrem=(n,t,o)=>this.chain(new Jn([n,t,o],this.commandOptions));lset=(n,t,o)=>this.chain(new Pn([n,t,o],this.commandOptions));ltrim=(...n)=>this.chain(new Zn(n,this.commandOptions));mget=(...n)=>this.chain(new En(n,this.commandOptions));mset=n=>this.chain(new Kn([n],this.commandOptions));msetnx=n=>this.chain(new Ln([n],this.commandOptions));persist=(...n)=>this.chain(new Nn(n,this.commandOptions));pexpire=(...n)=>this.chain(new In(n,this.commandOptions));pexpireat=(...n)=>this.chain(new Un(n,this.commandOptions));ping=n=>this.chain(new Bn(n,this.commandOptions));psetex=(n,t,o)=>this.chain(new Gn([n,t,o],this.commandOptions));pttl=(...n)=>this.chain(new Hn(n,this.commandOptions));publish=(...n)=>this.chain(new qn(n,this.commandOptions));randomkey=()=>this.chain(new Fn(this.commandOptions));rename=(...n)=>this.chain(new $n(n,this.commandOptions));renamenx=(...n)=>this.chain(new Xn(n,this.commandOptions));rpop=(...n)=>this.chain(new jn(n,this.commandOptions));rpush=(n,...t)=>this.chain(new Wn([n,...t],this.commandOptions));rpushx=(n,...t)=>this.chain(new Vn([n,...t],this.commandOptions));sadd=(n,...t)=>this.chain(new Yn([n,...t],this.commandOptions));scan=(...n)=>this.chain(new Qn(n,this.commandOptions));scard=(...n)=>this.chain(new _n(n,this.commandOptions));scriptExists=(...n)=>this.chain(new nt(n,this.commandOptions));scriptFlush=(...n)=>this.chain(new tt(n,this.commandOptions));scriptLoad=(...n)=>this.chain(new et(n,this.commandOptions));sdiff=(...n)=>this.chain(new ot(n,this.commandOptions));sdiffstore=(...n)=>this.chain(new st(n,this.commandOptions));set=(n,t,o)=>this.chain(new mt([n,t,o],this.commandOptions));setbit=(...n)=>this.chain(new rt(n,this.commandOptions));setex=(n,t,o)=>this.chain(new at([n,t,o],this.commandOptions));setnx=(n,t)=>this.chain(new it([n,t],this.commandOptions));setrange=(...n)=>this.chain(new pt(n,this.commandOptions));sinter=(...n)=>this.chain(new dt(n,this.commandOptions));sinterstore=(...n)=>this.chain(new ct(n,this.commandOptions));sismember=(n,t)=>this.chain(new ut([n,t],this.commandOptions));smembers=(...n)=>this.chain(new ht(n,this.commandOptions));smismember=(n,t)=>this.chain(new lt([n,t],this.commandOptions));smove=(n,t,o)=>this.chain(new Ct([n,t,o],this.commandOptions));spop=(...n)=>this.chain(new gt(n,this.commandOptions));srandmember=(...n)=>this.chain(new xt(n,this.commandOptions));srem=(n,...t)=>this.chain(new ft([n,...t],this.commandOptions));sscan=(...n)=>this.chain(new bt(n,this.commandOptions));strlen=(...n)=>this.chain(new yt(n,this.commandOptions));sunion=(...n)=>this.chain(new Ot(n,this.commandOptions));sunionstore=(...n)=>this.chain(new Tt(n,this.commandOptions));time=()=>this.chain(new wt(this.commandOptions));touch=(...n)=>this.chain(new Dt(n,this.commandOptions));ttl=(...n)=>this.chain(new kt(n,this.commandOptions));type=(...n)=>this.chain(new At(n,this.commandOptions));unlink=(...n)=>this.chain(new St(n,this.commandOptions));zadd=(...n)=>"score"in n[1]?this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions)):this.chain(new d([n[0],n[1],...n.slice(2)],this.commandOptions));zcard=(...n)=>this.chain(new Rt(n,this.commandOptions));zcount=(...n)=>this.chain(new vt(n,this.commandOptions));zincrby=(n,t,o)=>this.chain(new Mt([n,t,o],this.commandOptions));zinterstore=(...n)=>this.chain(new zt(n,this.commandOptions));zlexcount=(...n)=>this.chain(new Jt(n,this.commandOptions));zmscore=(...n)=>this.chain(new Xt(n,this.commandOptions));zpopmax=(...n)=>this.chain(new Pt(n,this.commandOptions));zpopmin=(...n)=>this.chain(new Zt(n,this.commandOptions));zrange=(...n)=>this.chain(new Et(n,this.commandOptions));zrank=(n,t)=>this.chain(new Kt([n,t],this.commandOptions));zrem=(n,...t)=>this.chain(new Lt([n,...t],this.commandOptions));zremrangebylex=(...n)=>this.chain(new Nt(n,this.commandOptions));zremrangebyrank=(...n)=>this.chain(new It(n,this.commandOptions));zremrangebyscore=(...n)=>this.chain(new Ut(n,this.commandOptions));zrevrank=(n,t)=>this.chain(new Bt([n,t],this.commandOptions));zscan=(...n)=>this.chain(new Gt(n,this.commandOptions));zscore=(n,t)=>this.chain(new Ht([n,t],this.commandOptions));zunionstore=(...n)=>this.chain(new Ft(n,this.commandOptions));zunion=(...n)=>this.chain(new qt(n,this.commandOptions));get json(){return{arrappend:(...n)=>this.chain(new nn(n,this.commandOptions)),arrindex:(...n)=>this.chain(new tn(n,this.commandOptions)),arrinsert:(...n)=>this.chain(new en(n,this.commandOptions)),arrlen:(...n)=>this.chain(new on(n,this.commandOptions)),arrpop:(...n)=>this.chain(new sn(n,this.commandOptions)),arrtrim:(...n)=>this.chain(new mn(n,this.commandOptions)),clear:(...n)=>this.chain(new rn(n,this.commandOptions)),del:(...n)=>this.chain(new an(n,this.commandOptions)),forget:(...n)=>this.chain(new pn(n,this.commandOptions)),geoadd:(...n)=>new R(n,this.commandOptions).exec(this.client),geodist:(...n)=>new v(n,this.commandOptions).exec(this.client),get:(...n)=>this.chain(new dn(n,this.commandOptions)),mget:(...n)=>this.chain(new cn(n,this.commandOptions)),numincrby:(...n)=>this.chain(new un(n,this.commandOptions)),nummultby:(...n)=>this.chain(new hn(n,this.commandOptions)),objkeys:(...n)=>this.chain(new ln(n,this.commandOptions)),objlen:(...n)=>this.chain(new Cn(n,this.commandOptions)),resp:(...n)=>this.chain(new gn(n,this.commandOptions)),set:(...n)=>this.chain(new xn(n,this.commandOptions)),strappend:(...n)=>this.chain(new fn(n,this.commandOptions)),strlen:(...n)=>this.chain(new bn(n,this.commandOptions)),toggle:(...n)=>this.chain(new yn(n,this.commandOptions)),type:(...n)=>this.chain(new On(n,this.commandOptions))}}};import ce from"crypto-js/enc-hex";import ue from"crypto-js/sha1";var Qt=class{script;sha1;redis;constructor(n,t){this.redis=n,this.sha1=this.digest(t),this.script=t}async eval(n,t){return await this.redis.eval(this.script,n,t)}async evalsha(n,t){return await this.redis.evalsha(this.sha1,n,t)}async exec(n,t){return await this.redis.evalsha(this.sha1,n,t).catch(async m=>{if(m instanceof Error&&m.message.toLowerCase().includes("noscript"))return await this.redis.eval(this.script,n,t);throw m})}digest(n){return ce.stringify(ue(n))}};var _t=class{client;opts;enableTelemetry;constructor(n,t){this.client=n,this.opts=t,this.enableTelemetry=t?.enableTelemetry??!0}get json(){return{arrappend:(...n)=>new nn(n,this.opts).exec(this.client),arrindex:(...n)=>new tn(n,this.opts).exec(this.client),arrinsert:(...n)=>new en(n,this.opts).exec(this.client),arrlen:(...n)=>new on(n,this.opts).exec(this.client),arrpop:(...n)=>new sn(n,this.opts).exec(this.client),arrtrim:(...n)=>new mn(n,this.opts).exec(this.client),clear:(...n)=>new rn(n,this.opts).exec(this.client),del:(...n)=>new an(n,this.opts).exec(this.client),forget:(...n)=>new pn(n,this.opts).exec(this.client),geoadd:(...n)=>new R(n,this.opts).exec(this.client),geodist:(...n)=>new v(n,this.opts).exec(this.client),get:(...n)=>new dn(n,this.opts).exec(this.client),mget:(...n)=>new cn(n,this.opts).exec(this.client),numincrby:(...n)=>new un(n,this.opts).exec(this.client),nummultby:(...n)=>new hn(n,this.opts).exec(this.client),objkeys:(...n)=>new ln(n,this.opts).exec(this.client),objlen:(...n)=>new Cn(n,this.opts).exec(this.client),resp:(...n)=>new gn(n,this.opts).exec(this.client),set:(...n)=>new xn(n,this.opts).exec(this.client),strappend:(...n)=>new fn(n,this.opts).exec(this.client),strlen:(...n)=>new bn(n,this.opts).exec(this.client),toggle:(...n)=>new yn(n,this.opts).exec(this.client),type:(...n)=>new On(n,this.opts).exec(this.client)}}use=n=>{let t=this.client.request.bind(this.client);this.client.request=o=>n(o,t)};addTelemetry=n=>{if(this.enableTelemetry)try{this.client.mergeTelemetry(n)}catch{}};createScript(n){return new Qt(this,n)}pipeline=()=>new jt({client:this.client,commandOptions:this.opts,multiExec:!1});multi=()=>new jt({client:this.client,commandOptions:this.opts,multiExec:!0});append=(...n)=>new u(n,this.opts).exec(this.client);bitcount=(...n)=>new h(n,this.opts).exec(this.client);bitop=(n,t,o,...m)=>new l([n,t,o,...m],this.opts).exec(this.client);bitpos=(...n)=>new C(n,this.opts).exec(this.client);dbsize=()=>new g(this.opts).exec(this.client);decr=(...n)=>new x(n,this.opts).exec(this.client);decrby=(...n)=>new f(n,this.opts).exec(this.client);del=(...n)=>new b(n,this.opts).exec(this.client);echo=(...n)=>new y(n,this.opts).exec(this.client);eval=(...n)=>new O(n,this.opts).exec(this.client);evalsha=(...n)=>new T(n,this.opts).exec(this.client);exists=(...n)=>new w(n,this.opts).exec(this.client);expire=(...n)=>new D(n,this.opts).exec(this.client);expireat=(...n)=>new k(n,this.opts).exec(this.client);flushall=n=>new A(n,this.opts).exec(this.client);flushdb=(...n)=>new S(n,this.opts).exec(this.client);get=(...n)=>new M(n,this.opts).exec(this.client);getbit=(...n)=>new z(n,this.opts).exec(this.client);getdel=(...n)=>new J(n,this.opts).exec(this.client);getrange=(...n)=>new P(n,this.opts).exec(this.client);getset=(n,t)=>new Z([n,t],this.opts).exec(this.client);hdel=(...n)=>new E(n,this.opts).exec(this.client);hexists=(...n)=>new K(n,this.opts).exec(this.client);hget=(...n)=>new L(n,this.opts).exec(this.client);hgetall=(...n)=>new N(n,this.opts).exec(this.client);hincrby=(...n)=>new I(n,this.opts).exec(this.client);hincrbyfloat=(...n)=>new U(n,this.opts).exec(this.client);hkeys=(...n)=>new B(n,this.opts).exec(this.client);hlen=(...n)=>new G(n,this.opts).exec(this.client);hmget=(...n)=>new H(n,this.opts).exec(this.client);hmset=(n,t)=>new q([n,t],this.opts).exec(this.client);hrandfield=(n,t,o)=>new F([n,t,o],this.opts).exec(this.client);hscan=(...n)=>new $(n,this.opts).exec(this.client);hset=(n,t)=>new X([n,t],this.opts).exec(this.client);hsetnx=(n,t,o)=>new j([n,t,o],this.opts).exec(this.client);hstrlen=(...n)=>new W(n,this.opts).exec(this.client);hvals=(...n)=>new V(n,this.opts).exec(this.client);incr=(...n)=>new Y(n,this.opts).exec(this.client);incrby=(...n)=>new Q(n,this.opts).exec(this.client);incrbyfloat=(...n)=>new _(n,this.opts).exec(this.client);keys=(...n)=>new Tn(n,this.opts).exec(this.client);lindex=(...n)=>new wn(n,this.opts).exec(this.client);linsert=(n,t,o,m)=>new Dn([n,t,o,m],this.opts).exec(this.client);llen=(...n)=>new kn(n,this.opts).exec(this.client);lmove=(...n)=>new An(n,this.opts).exec(this.client);lpop=(...n)=>new Sn(n,this.opts).exec(this.client);lpos=(...n)=>new Rn(n,this.opts).exec(this.client);lpush=(n,...t)=>new vn([n,...t],this.opts).exec(this.client);lpushx=(n,...t)=>new Mn([n,...t],this.opts).exec(this.client);lrange=(...n)=>new zn(n,this.opts).exec(this.client);lrem=(n,t,o)=>new Jn([n,t,o],this.opts).exec(this.client);lset=(n,t,o)=>new Pn([n,t,o],this.opts).exec(this.client);ltrim=(...n)=>new Zn(n,this.opts).exec(this.client);mget=(...n)=>new En(n,this.opts).exec(this.client);mset=n=>new Kn([n],this.opts).exec(this.client);msetnx=n=>new Ln([n],this.opts).exec(this.client);persist=(...n)=>new Nn(n,this.opts).exec(this.client);pexpire=(...n)=>new In(n,this.opts).exec(this.client);pexpireat=(...n)=>new Un(n,this.opts).exec(this.client);ping=n=>new Bn(n,this.opts).exec(this.client);psetex=(n,t,o)=>new Gn([n,t,o],this.opts).exec(this.client);pttl=(...n)=>new Hn(n,this.opts).exec(this.client);publish=(...n)=>new qn(n,this.opts).exec(this.client);randomkey=()=>new Fn().exec(this.client);rename=(...n)=>new $n(n,this.opts).exec(this.client);renamenx=(...n)=>new Xn(n,this.opts).exec(this.client);rpop=(...n)=>new jn(n,this.opts).exec(this.client);rpush=(n,...t)=>new Wn([n,...t],this.opts).exec(this.client);rpushx=(n,...t)=>new Vn([n,...t],this.opts).exec(this.client);sadd=(n,...t)=>new Yn([n,...t],this.opts).exec(this.client);scan=(...n)=>new Qn(n,this.opts).exec(this.client);scard=(...n)=>new _n(n,this.opts).exec(this.client);scriptExists=(...n)=>new nt(n,this.opts).exec(this.client);scriptFlush=(...n)=>new tt(n,this.opts).exec(this.client);scriptLoad=(...n)=>new et(n,this.opts).exec(this.client);sdiff=(...n)=>new ot(n,this.opts).exec(this.client);sdiffstore=(...n)=>new st(n,this.opts).exec(this.client);set=(n,t,o)=>new mt([n,t,o],this.opts).exec(this.client);setbit=(...n)=>new rt(n,this.opts).exec(this.client);setex=(n,t,o)=>new at([n,t,o],this.opts).exec(this.client);setnx=(n,t)=>new it([n,t],this.opts).exec(this.client);setrange=(...n)=>new pt(n,this.opts).exec(this.client);sinter=(...n)=>new dt(n,this.opts).exec(this.client);sinterstore=(...n)=>new ct(n,this.opts).exec(this.client);sismember=(n,t)=>new ut([n,t],this.opts).exec(this.client);smismember=(n,t)=>new lt([n,t],this.opts).exec(this.client);smembers=(...n)=>new ht(n,this.opts).exec(this.client);smove=(n,t,o)=>new Ct([n,t,o],this.opts).exec(this.client);spop=(...n)=>new gt(n,this.opts).exec(this.client);srandmember=(...n)=>new xt(n,this.opts).exec(this.client);srem=(n,...t)=>new ft([n,...t],this.opts).exec(this.client);sscan=(...n)=>new bt(n,this.opts).exec(this.client);strlen=(...n)=>new yt(n,this.opts).exec(this.client);sunion=(...n)=>new Ot(n,this.opts).exec(this.client);sunionstore=(...n)=>new Tt(n,this.opts).exec(this.client);time=()=>new wt().exec(this.client);touch=(...n)=>new Dt(n,this.opts).exec(this.client);ttl=(...n)=>new kt(n,this.opts).exec(this.client);type=(...n)=>new At(n,this.opts).exec(this.client);unlink=(...n)=>new St(n,this.opts).exec(this.client);xadd=(...n)=>new Vt(n,this.opts).exec(this.client);xrange=(...n)=>new Yt(n,this.opts).exec(this.client);zadd=(...n)=>"score"in n[1]?new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client):new d([n[0],n[1],...n.slice(2)],this.opts).exec(this.client);zcard=(...n)=>new Rt(n,this.opts).exec(this.client);zcount=(...n)=>new vt(n,this.opts).exec(this.client);zdiffstore=(...n)=>new $t(n,this.opts).exec(this.client);zincrby=(n,t,o)=>new Mt([n,t,o],this.opts).exec(this.client);zinterstore=(...n)=>new zt(n,this.opts).exec(this.client);zlexcount=(...n)=>new Jt(n,this.opts).exec(this.client);zmscore=(...n)=>new Xt(n,this.opts).exec(this.client);zpopmax=(...n)=>new Pt(n,this.opts).exec(this.client);zpopmin=(...n)=>new Zt(n,this.opts).exec(this.client);zrange=(...n)=>new Et(n,this.opts).exec(this.client);zrank=(n,t)=>new Kt([n,t],this.opts).exec(this.client);zrem=(n,...t)=>new Lt([n,...t],this.opts).exec(this.client);zremrangebylex=(...n)=>new Nt(n,this.opts).exec(this.client);zremrangebyrank=(...n)=>new It(n,this.opts).exec(this.client);zremrangebyscore=(...n)=>new Ut(n,this.opts).exec(this.client);zrevrank=(n,t)=>new Bt([n,t],this.opts).exec(this.client);zscan=(...n)=>new Gt(n,this.opts).exec(this.client);zscore=(n,t)=>new Ht([n,t],this.opts).exec(this.client);zunion=(...n)=>new qt(n,this.opts).exec(this.client);zunionstore=(...n)=>new Ft(n,this.opts).exec(this.client)};var se="v0.0.0-ci.5dc8a64a1d213ed26a30ad534b73faf791cb75c6";var me=class extends _t{constructor(n){(n.url.startsWith(" ")||n.url.endsWith(" ")||/\r|\n/.test(n.url))&&console.warn("The redis url contains whitespace or newline, which can cause errors!"),(n.token.startsWith(" ")||n.token.endsWith(" ")||/\r|\n/.test(n.token))&&console.warn("The redis token contains whitespace or newline, which can cause errors!");let t=new Wt({baseUrl:n.url,retry:n.retry,headers:{authorization:`Bearer ${n.token}`},options:{backend:n.backend},responseEncoding:n.responseEncoding});super(t,{automaticDeserialization:n.automaticDeserialization}),this.addTelemetry({sdk:`@upstash/redis@${se}`,platform:"fastly"})}};export{me as Redis};
|