@upstash/redis 1.24.0-next.1 → 1.24.0-next.3
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 +10 -3
- package/cloudflare.d.mts +45 -0
- package/{types/platforms/cloudflare.d.ts → cloudflare.d.ts} +9 -7
- 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 +23 -65
- package/redis-b1b1b1df.d.ts +1959 -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 -66
- 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/geo_add.js +0 -27
- 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/json_arrappend.js +0 -9
- package/esm/pkg/commands/json_arrindex.js +0 -9
- package/esm/pkg/commands/json_arrinsert.js +0 -9
- package/esm/pkg/commands/json_arrlen.js +0 -9
- package/esm/pkg/commands/json_arrpop.js +0 -9
- package/esm/pkg/commands/json_arrtrim.js +0 -12
- package/esm/pkg/commands/json_clear.js +0 -9
- package/esm/pkg/commands/json_del.js +0 -9
- package/esm/pkg/commands/json_forget.js +0 -9
- package/esm/pkg/commands/json_get.js +0 -30
- package/esm/pkg/commands/json_mget.js +0 -9
- package/esm/pkg/commands/json_numincrby.js +0 -9
- package/esm/pkg/commands/json_nummultby.js +0 -9
- package/esm/pkg/commands/json_objkeys.js +0 -9
- package/esm/pkg/commands/json_objlen.js +0 -9
- package/esm/pkg/commands/json_resp.js +0 -9
- package/esm/pkg/commands/json_set.js +0 -18
- package/esm/pkg/commands/json_strappend.js +0 -9
- package/esm/pkg/commands/json_strlen.js +0 -9
- package/esm/pkg/commands/json_toggle.js +0 -9
- package/esm/pkg/commands/json_type.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/lmove.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 -143
- 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/smismember.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/xadd.js +0 -26
- package/esm/pkg/commands/xrange.js +0 -36
- 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/zdiffstore.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 -174
- package/esm/pkg/pipeline.js +0 -1298
- package/esm/pkg/redis.js +0 -1309
- 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 -46
- package/esm/platforms/node_with_fetch.js +0 -85
- package/esm/platforms/nodejs.js +0 -82
- 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 -70
- 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/geo_add.js +0 -31
- 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/json_arrappend.js +0 -13
- package/script/pkg/commands/json_arrindex.js +0 -13
- package/script/pkg/commands/json_arrinsert.js +0 -13
- package/script/pkg/commands/json_arrlen.js +0 -13
- package/script/pkg/commands/json_arrpop.js +0 -13
- package/script/pkg/commands/json_arrtrim.js +0 -16
- package/script/pkg/commands/json_clear.js +0 -13
- package/script/pkg/commands/json_del.js +0 -13
- package/script/pkg/commands/json_forget.js +0 -13
- package/script/pkg/commands/json_get.js +0 -34
- package/script/pkg/commands/json_mget.js +0 -13
- package/script/pkg/commands/json_numincrby.js +0 -13
- package/script/pkg/commands/json_nummultby.js +0 -13
- package/script/pkg/commands/json_objkeys.js +0 -13
- package/script/pkg/commands/json_objlen.js +0 -13
- package/script/pkg/commands/json_resp.js +0 -13
- package/script/pkg/commands/json_set.js +0 -22
- package/script/pkg/commands/json_strappend.js +0 -13
- package/script/pkg/commands/json_strlen.js +0 -13
- package/script/pkg/commands/json_toggle.js +0 -13
- package/script/pkg/commands/json_type.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/lmove.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 -159
- 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/smismember.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/xadd.js +0 -30
- package/script/pkg/commands/xrange.js +0 -40
- 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/zdiffstore.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 -178
- package/script/pkg/pipeline.js +0 -1302
- package/script/pkg/redis.js +0 -1313
- 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 -73
- package/script/platforms/node_with_fetch.js +0 -112
- package/script/platforms/nodejs.js +0 -109
- 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/geo_add.d.ts +0 -25
- 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/json_arrappend.d.ts +0 -7
- package/types/pkg/commands/json_arrindex.d.ts +0 -13
- package/types/pkg/commands/json_arrinsert.d.ts +0 -7
- package/types/pkg/commands/json_arrlen.d.ts +0 -7
- package/types/pkg/commands/json_arrpop.d.ts +0 -7
- package/types/pkg/commands/json_arrtrim.d.ts +0 -7
- package/types/pkg/commands/json_clear.d.ts +0 -7
- package/types/pkg/commands/json_del.d.ts +0 -7
- package/types/pkg/commands/json_forget.d.ts +0 -7
- package/types/pkg/commands/json_get.d.ts +0 -15
- package/types/pkg/commands/json_mget.d.ts +0 -7
- package/types/pkg/commands/json_numincrby.d.ts +0 -7
- package/types/pkg/commands/json_nummultby.d.ts +0 -7
- package/types/pkg/commands/json_objkeys.d.ts +0 -7
- package/types/pkg/commands/json_objlen.d.ts +0 -7
- package/types/pkg/commands/json_resp.d.ts +0 -7
- package/types/pkg/commands/json_set.d.ts +0 -18
- package/types/pkg/commands/json_strappend.d.ts +0 -7
- package/types/pkg/commands/json_strlen.d.ts +0 -7
- package/types/pkg/commands/json_toggle.d.ts +0 -7
- package/types/pkg/commands/json_type.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/lmove.d.ts +0 -12
- 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 -143
- 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/smismember.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/xadd.d.ts +0 -31
- package/types/pkg/commands/xrange.d.ts +0 -9
- 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/zdiffstore.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 -95
- package/types/pkg/pipeline.d.ts +0 -682
- package/types/pkg/redis.d.ts +0 -688
- package/types/pkg/script.d.ts +0 -42
- package/types/pkg/types.d.ts +0 -27
- package/types/pkg/util.d.ts +0 -1
- package/types/version.d.ts +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZInterStoreCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zInterstore
|
|
7
|
-
*/
|
|
8
|
-
class ZInterStoreCommand extends command_js_1.Command {
|
|
9
|
-
constructor([destination, numKeys, keyOrKeys, opts], cmdOpts) {
|
|
10
|
-
const command = ["zinterstore", destination, numKeys];
|
|
11
|
-
if (Array.isArray(keyOrKeys)) {
|
|
12
|
-
command.push(...keyOrKeys);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
command.push(keyOrKeys);
|
|
16
|
-
}
|
|
17
|
-
if (opts) {
|
|
18
|
-
if ("weights" in opts && opts.weights) {
|
|
19
|
-
command.push("weights", ...opts.weights);
|
|
20
|
-
}
|
|
21
|
-
else if ("weight" in opts && typeof opts.weight === "number") {
|
|
22
|
-
command.push("weights", opts.weight);
|
|
23
|
-
}
|
|
24
|
-
if ("aggregate" in opts) {
|
|
25
|
-
command.push("aggregate", opts.aggregate);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
super(command, cmdOpts);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.ZInterStoreCommand = ZInterStoreCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZLexCountCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zlexcount
|
|
7
|
-
*/
|
|
8
|
-
class ZLexCountCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zlexcount", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZLexCountCommand = ZLexCountCommand;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZMScoreCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zmscore
|
|
7
|
-
*/
|
|
8
|
-
class ZMScoreCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
const [key, members] = cmd;
|
|
11
|
-
super(["zmscore", key, ...members], opts);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.ZMScoreCommand = ZMScoreCommand;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZPopMaxCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zpopmax
|
|
7
|
-
*/
|
|
8
|
-
class ZPopMaxCommand extends command_js_1.Command {
|
|
9
|
-
constructor([key, count], opts) {
|
|
10
|
-
const command = ["zpopmax", key];
|
|
11
|
-
if (typeof count === "number") {
|
|
12
|
-
command.push(count);
|
|
13
|
-
}
|
|
14
|
-
super(command, opts);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.ZPopMaxCommand = ZPopMaxCommand;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZPopMinCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zpopmin
|
|
7
|
-
*/
|
|
8
|
-
class ZPopMinCommand extends command_js_1.Command {
|
|
9
|
-
constructor([key, count], opts) {
|
|
10
|
-
const command = ["zpopmin", key];
|
|
11
|
-
if (typeof count === "number") {
|
|
12
|
-
command.push(count);
|
|
13
|
-
}
|
|
14
|
-
super(command, opts);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.ZPopMinCommand = ZPopMinCommand;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRangeCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zrange
|
|
7
|
-
*/
|
|
8
|
-
class ZRangeCommand extends command_js_1.Command {
|
|
9
|
-
constructor([key, min, max, opts], cmdOpts) {
|
|
10
|
-
const command = ["zrange", key, min, max];
|
|
11
|
-
// Either byScore or byLex is allowed
|
|
12
|
-
if (opts?.byScore) {
|
|
13
|
-
command.push("byscore");
|
|
14
|
-
}
|
|
15
|
-
if (opts?.byLex) {
|
|
16
|
-
command.push("bylex");
|
|
17
|
-
}
|
|
18
|
-
if (opts?.rev) {
|
|
19
|
-
command.push("rev");
|
|
20
|
-
}
|
|
21
|
-
if (typeof opts?.count !== "undefined" && typeof opts?.offset !== "undefined") {
|
|
22
|
-
command.push("limit", opts.offset, opts.count);
|
|
23
|
-
}
|
|
24
|
-
if (opts?.withScores) {
|
|
25
|
-
command.push("withscores");
|
|
26
|
-
}
|
|
27
|
-
super(command, cmdOpts);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.ZRangeCommand = ZRangeCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRankCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zrank
|
|
7
|
-
*/
|
|
8
|
-
class ZRankCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zrank", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZRankCommand = ZRankCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRemCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zrem
|
|
7
|
-
*/
|
|
8
|
-
class ZRemCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zrem", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZRemCommand = ZRemCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRemRangeByLexCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zremrangebylex
|
|
7
|
-
*/
|
|
8
|
-
class ZRemRangeByLexCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zremrangebylex", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZRemRangeByLexCommand = ZRemRangeByLexCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRemRangeByRankCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zremrangebyrank
|
|
7
|
-
*/
|
|
8
|
-
class ZRemRangeByRankCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zremrangebyrank", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZRemRangeByRankCommand = ZRemRangeByRankCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRemRangeByScoreCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zremrangebyscore
|
|
7
|
-
*/
|
|
8
|
-
class ZRemRangeByScoreCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zremrangebyscore", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZRemRangeByScoreCommand = ZRemRangeByScoreCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZRevRankCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zrevrank
|
|
7
|
-
*/
|
|
8
|
-
class ZRevRankCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zrevrank", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZRevRankCommand = ZRevRankCommand;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZScanCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zscan
|
|
7
|
-
*/
|
|
8
|
-
class ZScanCommand extends command_js_1.Command {
|
|
9
|
-
constructor([key, cursor, opts], cmdOpts) {
|
|
10
|
-
const command = ["zscan", key, cursor];
|
|
11
|
-
if (opts?.match) {
|
|
12
|
-
command.push("match", opts.match);
|
|
13
|
-
}
|
|
14
|
-
if (typeof opts?.count === "number") {
|
|
15
|
-
command.push("count", opts.count);
|
|
16
|
-
}
|
|
17
|
-
super(command, cmdOpts);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ZScanCommand = ZScanCommand;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZScoreCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zscore
|
|
7
|
-
*/
|
|
8
|
-
class ZScoreCommand extends command_js_1.Command {
|
|
9
|
-
constructor(cmd, opts) {
|
|
10
|
-
super(["zscore", ...cmd], opts);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ZScoreCommand = ZScoreCommand;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZUnionStoreCommand = void 0;
|
|
4
|
-
const command_js_1 = require("./command.js");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://redis.io/commands/zunionstore
|
|
7
|
-
*/
|
|
8
|
-
class ZUnionStoreCommand extends command_js_1.Command {
|
|
9
|
-
constructor([destination, numKeys, keyOrKeys, opts], cmdOpts) {
|
|
10
|
-
const command = ["zunionstore", destination, numKeys];
|
|
11
|
-
if (Array.isArray(keyOrKeys)) {
|
|
12
|
-
command.push(...keyOrKeys);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
command.push(keyOrKeys);
|
|
16
|
-
}
|
|
17
|
-
if (opts) {
|
|
18
|
-
if ("weights" in opts && opts.weights) {
|
|
19
|
-
command.push("weights", ...opts.weights);
|
|
20
|
-
}
|
|
21
|
-
else if ("weight" in opts && typeof opts.weight === "number") {
|
|
22
|
-
command.push("weights", opts.weight);
|
|
23
|
-
}
|
|
24
|
-
if ("aggregate" in opts) {
|
|
25
|
-
command.push("aggregate", opts.aggregate);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
super(command, cmdOpts);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.ZUnionStoreCommand = ZUnionStoreCommand;
|
package/script/pkg/error.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UpstashError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Result of a bad request to upstash
|
|
6
|
-
*/
|
|
7
|
-
class UpstashError extends Error {
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = "UpstashError";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.UpstashError = UpstashError;
|
package/script/pkg/http.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpClient = void 0;
|
|
4
|
-
const error_js_1 = require("./error.js");
|
|
5
|
-
class HttpClient {
|
|
6
|
-
constructor(config) {
|
|
7
|
-
Object.defineProperty(this, "baseUrl", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
configurable: true,
|
|
10
|
-
writable: true,
|
|
11
|
-
value: void 0
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(this, "headers", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: void 0
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(this, "options", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: void 0
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "retry", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: void 0
|
|
30
|
-
});
|
|
31
|
-
this.options = {
|
|
32
|
-
backend: config.options?.backend,
|
|
33
|
-
agent: config.agent,
|
|
34
|
-
responseEncoding: config.responseEncoding ?? "base64",
|
|
35
|
-
cache: config.cache,
|
|
36
|
-
};
|
|
37
|
-
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
38
|
-
this.headers = {
|
|
39
|
-
"Content-Type": "application/json",
|
|
40
|
-
...config.headers,
|
|
41
|
-
};
|
|
42
|
-
if (this.options.responseEncoding === "base64") {
|
|
43
|
-
this.headers["Upstash-Encoding"] = "base64";
|
|
44
|
-
}
|
|
45
|
-
if (typeof config?.retry === "boolean" && config?.retry === false) {
|
|
46
|
-
this.retry = {
|
|
47
|
-
attempts: 1,
|
|
48
|
-
backoff: () => 0,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.retry = {
|
|
53
|
-
attempts: config?.retry?.retries ?? 5,
|
|
54
|
-
backoff: config?.retry?.backoff ??
|
|
55
|
-
((retryCount) => Math.exp(retryCount) * 50),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
mergeTelemetry(telemetry) {
|
|
60
|
-
function merge(obj, key, value) {
|
|
61
|
-
if (!value) {
|
|
62
|
-
return obj;
|
|
63
|
-
}
|
|
64
|
-
if (obj[key]) {
|
|
65
|
-
obj[key] = [obj[key], value].join(",");
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
obj[key] = value;
|
|
69
|
-
}
|
|
70
|
-
return obj;
|
|
71
|
-
}
|
|
72
|
-
this.headers = merge(this.headers, "Upstash-Telemetry-Runtime", telemetry.runtime);
|
|
73
|
-
this.headers = merge(this.headers, "Upstash-Telemetry-Platform", telemetry.platform);
|
|
74
|
-
this.headers = merge(this.headers, "Upstash-Telemetry-Sdk", telemetry.sdk);
|
|
75
|
-
}
|
|
76
|
-
async request(req) {
|
|
77
|
-
const requestOptions = {
|
|
78
|
-
cache: this.options.cache,
|
|
79
|
-
method: "POST",
|
|
80
|
-
headers: this.headers,
|
|
81
|
-
body: JSON.stringify(req.body),
|
|
82
|
-
keepalive: true,
|
|
83
|
-
agent: this.options?.agent,
|
|
84
|
-
/**
|
|
85
|
-
* Fastly specific
|
|
86
|
-
*/
|
|
87
|
-
backend: this.options?.backend,
|
|
88
|
-
};
|
|
89
|
-
let res = null;
|
|
90
|
-
let error = null;
|
|
91
|
-
for (let i = 0; i <= this.retry.attempts; i++) {
|
|
92
|
-
try {
|
|
93
|
-
res = await fetch([this.baseUrl, ...(req.path ?? [])].join("/"), requestOptions);
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
error = err;
|
|
98
|
-
await new Promise((r) => setTimeout(r, this.retry.backoff(i)));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (!res) {
|
|
102
|
-
throw error ?? new Error("Exhausted all retries");
|
|
103
|
-
}
|
|
104
|
-
const body = (await res.json());
|
|
105
|
-
if (!res.ok) {
|
|
106
|
-
throw new error_js_1.UpstashError(`${body.error}, command was: ${JSON.stringify(req.body)}`);
|
|
107
|
-
}
|
|
108
|
-
if (this.options?.responseEncoding === "base64") {
|
|
109
|
-
if (Array.isArray(body)) {
|
|
110
|
-
return body.map(({ result, error }) => ({
|
|
111
|
-
result: decode(result),
|
|
112
|
-
error,
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
115
|
-
const result = decode(body.result);
|
|
116
|
-
return { result, error: body.error };
|
|
117
|
-
}
|
|
118
|
-
return body;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.HttpClient = HttpClient;
|
|
122
|
-
function base64decode(b64) {
|
|
123
|
-
let dec = "";
|
|
124
|
-
try {
|
|
125
|
-
/**
|
|
126
|
-
* Using only atob() is not enough because it doesn't work with unicode characters
|
|
127
|
-
*/
|
|
128
|
-
const binString = atob(b64);
|
|
129
|
-
const size = binString.length;
|
|
130
|
-
const bytes = new Uint8Array(size);
|
|
131
|
-
for (let i = 0; i < size; i++) {
|
|
132
|
-
bytes[i] = binString.charCodeAt(i);
|
|
133
|
-
}
|
|
134
|
-
dec = new TextDecoder().decode(bytes);
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
dec = b64;
|
|
138
|
-
}
|
|
139
|
-
return dec;
|
|
140
|
-
// try {
|
|
141
|
-
// return decodeURIComponent(dec);
|
|
142
|
-
// } catch {
|
|
143
|
-
// return dec;
|
|
144
|
-
// }
|
|
145
|
-
}
|
|
146
|
-
function decode(raw) {
|
|
147
|
-
let result = undefined;
|
|
148
|
-
switch (typeof raw) {
|
|
149
|
-
case "undefined":
|
|
150
|
-
return raw;
|
|
151
|
-
case "number": {
|
|
152
|
-
result = raw;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
case "object": {
|
|
156
|
-
if (Array.isArray(raw)) {
|
|
157
|
-
result = raw.map((v) => typeof v === "string"
|
|
158
|
-
? base64decode(v)
|
|
159
|
-
: Array.isArray(v)
|
|
160
|
-
? v.map(decode)
|
|
161
|
-
: v);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
// If it's not an array it must be null
|
|
165
|
-
// Apparently null is an object in javascript
|
|
166
|
-
result = null;
|
|
167
|
-
}
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
case "string": {
|
|
171
|
-
result = raw === "OK" ? "OK" : base64decode(raw);
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
default:
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
return result;
|
|
178
|
-
}
|