@upstash/redis 1.40.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/{chunk-RLVWMRRX.mjs → chunk-CGMWROAN.mjs} +557 -4
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +557 -4
- package/cloudflare.mjs +1 -1
- package/docs/advanced.mdx +83 -0
- package/docs/commands/array/arcount.mdx +28 -0
- package/docs/commands/array/ardel.mdx +30 -0
- package/docs/commands/array/ardelrange.mdx +32 -0
- package/docs/commands/array/arget.mdx +33 -0
- package/docs/commands/array/argetrange.mdx +38 -0
- package/docs/commands/array/argrep.mdx +69 -0
- package/docs/commands/array/arinfo.mdx +49 -0
- package/docs/commands/array/arinsert.mdx +32 -0
- package/docs/commands/array/arlastitems.mdx +40 -0
- package/docs/commands/array/arlen.mdx +28 -0
- package/docs/commands/array/armget.mdx +31 -0
- package/docs/commands/array/armset.mdx +31 -0
- package/docs/commands/array/arnext.mdx +25 -0
- package/docs/commands/array/arop.mdx +44 -0
- package/docs/commands/array/arring.mdx +36 -0
- package/docs/commands/array/arscan.mdx +42 -0
- package/docs/commands/array/arseek.mdx +34 -0
- package/docs/commands/array/arset.mdx +35 -0
- package/docs/commands/auth/echo.mdx +24 -0
- package/docs/commands/auth/ping.mdx +21 -0
- package/docs/commands/bitmap/bitcount.mdx +39 -0
- package/docs/commands/bitmap/bitop.mdx +142 -0
- package/docs/commands/bitmap/bitpos.mdx +39 -0
- package/docs/commands/bitmap/getbit.mdx +28 -0
- package/docs/commands/bitmap/setbit.mdx +31 -0
- package/docs/commands/connection/client_setinfo.mdx +91 -0
- package/docs/commands/functions/call.mdx +72 -0
- package/docs/commands/functions/call_ro.mdx +57 -0
- package/docs/commands/functions/delete.mdx +22 -0
- package/docs/commands/functions/flush.mdx +16 -0
- package/docs/commands/functions/list.mdx +72 -0
- package/docs/commands/functions/load.mdx +64 -0
- package/docs/commands/functions/stats.mdx +46 -0
- package/docs/commands/generic/del.mdx +29 -0
- package/docs/commands/generic/exists.mdx +26 -0
- package/docs/commands/generic/expire.mdx +29 -0
- package/docs/commands/generic/expireat.mdx +29 -0
- package/docs/commands/generic/keys.mdx +32 -0
- package/docs/commands/generic/persist.mdx +23 -0
- package/docs/commands/generic/pexpire.mdx +28 -0
- package/docs/commands/generic/pexpireat.mdx +29 -0
- package/docs/commands/generic/pttl.mdx +23 -0
- package/docs/commands/generic/randomkey.mdx +21 -0
- package/docs/commands/generic/rename.mdx +28 -0
- package/docs/commands/generic/renamenx.mdx +28 -0
- package/docs/commands/generic/scan.mdx +38 -0
- package/docs/commands/generic/touch.mdx +23 -0
- package/docs/commands/generic/ttl.mdx +23 -0
- package/docs/commands/generic/type.mdx +27 -0
- package/docs/commands/generic/unlink.mdx +29 -0
- package/docs/commands/hash/hdel.mdx +28 -0
- package/docs/commands/hash/hexists.mdx +30 -0
- package/docs/commands/hash/hexpire.mdx +49 -0
- package/docs/commands/hash/hexpireat.mdx +48 -0
- package/docs/commands/hash/hexpiretime.mdx +35 -0
- package/docs/commands/hash/hget.mdx +29 -0
- package/docs/commands/hash/hgetall.mdx +27 -0
- package/docs/commands/hash/hgetdel.mdx +67 -0
- package/docs/commands/hash/hgetex.mdx +123 -0
- package/docs/commands/hash/hincrby.mdx +34 -0
- package/docs/commands/hash/hincrbyfloat.mdx +34 -0
- package/docs/commands/hash/hkeys.mdx +28 -0
- package/docs/commands/hash/hlen.mdx +28 -0
- package/docs/commands/hash/hmget.mdx +33 -0
- package/docs/commands/hash/hpersist.mdx +37 -0
- package/docs/commands/hash/hpexpire.mdx +50 -0
- package/docs/commands/hash/hpexpireat.mdx +48 -0
- package/docs/commands/hash/hpexpiretime.mdx +35 -0
- package/docs/commands/hash/hpttl.mdx +35 -0
- package/docs/commands/hash/hrandfield.mdx +57 -0
- package/docs/commands/hash/hscan.mdx +65 -0
- package/docs/commands/hash/hset.mdx +32 -0
- package/docs/commands/hash/hsetex.mdx +186 -0
- package/docs/commands/hash/hsetnx.mdx +30 -0
- package/docs/commands/hash/hstrlen.mdx +28 -0
- package/docs/commands/hash/httl.mdx +35 -0
- package/docs/commands/hash/hvals.mdx +29 -0
- package/docs/commands/json/arrappend.mdx +35 -0
- package/docs/commands/json/arrindex.mdx +37 -0
- package/docs/commands/json/arrinsert.mdx +34 -0
- package/docs/commands/json/arrlen.mdx +26 -0
- package/docs/commands/json/arrpop.mdx +36 -0
- package/docs/commands/json/arrtrim.mdx +34 -0
- package/docs/commands/json/clear.mdx +30 -0
- package/docs/commands/json/del.mdx +26 -0
- package/docs/commands/json/forget.mdx +26 -0
- package/docs/commands/json/get.mdx +53 -0
- package/docs/commands/json/merge.mdx +32 -0
- package/docs/commands/json/mget.mdx +27 -0
- package/docs/commands/json/mset.mdx +26 -0
- package/docs/commands/json/numincrby.mdx +33 -0
- package/docs/commands/json/nummultby.mdx +33 -0
- package/docs/commands/json/objkeys.mdx +27 -0
- package/docs/commands/json/objlen.mdx +27 -0
- package/docs/commands/json/set.mdx +42 -0
- package/docs/commands/json/strappend.mdx +32 -0
- package/docs/commands/json/strlen.mdx +26 -0
- package/docs/commands/json/toggle.mdx +28 -0
- package/docs/commands/json/type.mdx +28 -0
- package/docs/commands/list/lindex.mdx +32 -0
- package/docs/commands/list/linsert.mdx +41 -0
- package/docs/commands/list/llen.mdx +26 -0
- package/docs/commands/list/lmove.mdx +34 -0
- package/docs/commands/list/lpop.mdx +37 -0
- package/docs/commands/list/lpos.mdx +56 -0
- package/docs/commands/list/lpush.mdx +32 -0
- package/docs/commands/list/lpushx.mdx +38 -0
- package/docs/commands/list/lrange.mdx +37 -0
- package/docs/commands/list/lrem.mdx +33 -0
- package/docs/commands/list/lset.mdx +34 -0
- package/docs/commands/list/ltrim.mdx +33 -0
- package/docs/commands/list/rpop.mdx +37 -0
- package/docs/commands/list/rpush.mdx +32 -0
- package/docs/commands/list/rpushx.mdx +38 -0
- package/docs/commands/overview.mdx +692 -0
- package/docs/commands/pubsub/psubscribe.mdx +36 -0
- package/docs/commands/pubsub/publish.mdx +27 -0
- package/docs/commands/pubsub/subscribe.mdx +28 -0
- package/docs/commands/scripts/eval.mdx +36 -0
- package/docs/commands/scripts/eval_ro.mdx +36 -0
- package/docs/commands/scripts/evalsha.mdx +36 -0
- package/docs/commands/scripts/evalsha_ro.mdx +36 -0
- package/docs/commands/scripts/script_exists.mdx +26 -0
- package/docs/commands/scripts/script_flush.mdx +28 -0
- package/docs/commands/scripts/script_load.mdx +28 -0
- package/docs/commands/server/dbsize.mdx +22 -0
- package/docs/commands/server/flushall.mdx +25 -0
- package/docs/commands/server/flushdb.mdx +25 -0
- package/docs/commands/set/sadd.mdx +32 -0
- package/docs/commands/set/scard.mdx +26 -0
- package/docs/commands/set/sdiff.mdx +27 -0
- package/docs/commands/set/sdiffstore.mdx +32 -0
- package/docs/commands/set/sinter.mdx +27 -0
- package/docs/commands/set/sinterstore.mdx +33 -0
- package/docs/commands/set/sismember.mdx +30 -0
- package/docs/commands/set/smembers.mdx +25 -0
- package/docs/commands/set/smismember.mdx +31 -0
- package/docs/commands/set/smove.mdx +34 -0
- package/docs/commands/set/spop.mdx +36 -0
- package/docs/commands/set/srandmember.mdx +36 -0
- package/docs/commands/set/srem.mdx +29 -0
- package/docs/commands/set/sscan.mdx +39 -0
- package/docs/commands/set/sunion.mdx +27 -0
- package/docs/commands/set/sunionstore.mdx +33 -0
- package/docs/commands/stream/xack.mdx +37 -0
- package/docs/commands/stream/xackdel.mdx +211 -0
- package/docs/commands/stream/xadd.mdx +137 -0
- package/docs/commands/stream/xautoclaim.mdx +80 -0
- package/docs/commands/stream/xclaim.mdx +84 -0
- package/docs/commands/stream/xdel.mdx +34 -0
- package/docs/commands/stream/xdelex.mdx +119 -0
- package/docs/commands/stream/xgroup.mdx +141 -0
- package/docs/commands/stream/xinfo.mdx +77 -0
- package/docs/commands/stream/xlen.mdx +22 -0
- package/docs/commands/stream/xpending.mdx +75 -0
- package/docs/commands/stream/xrange.mdx +59 -0
- package/docs/commands/stream/xread.mdx +65 -0
- package/docs/commands/stream/xreadgroup.mdx +87 -0
- package/docs/commands/stream/xrevrange.mdx +65 -0
- package/docs/commands/stream/xtrim.mdx +75 -0
- package/docs/commands/string/append.mdx +28 -0
- package/docs/commands/string/decr.mdx +27 -0
- package/docs/commands/string/decrby.mdx +30 -0
- package/docs/commands/string/get.mdx +34 -0
- package/docs/commands/string/getdel.mdx +29 -0
- package/docs/commands/string/getrange.mdx +34 -0
- package/docs/commands/string/getset.mdx +28 -0
- package/docs/commands/string/incr.mdx +27 -0
- package/docs/commands/string/incrby.mdx +30 -0
- package/docs/commands/string/incrbyfloat.mdx +30 -0
- package/docs/commands/string/mget.mdx +31 -0
- package/docs/commands/string/mset.mdx +32 -0
- package/docs/commands/string/msetnx.mdx +29 -0
- package/docs/commands/string/set.mdx +79 -0
- package/docs/commands/string/setrange.mdx +38 -0
- package/docs/commands/string/strlen.mdx +26 -0
- package/docs/commands/transaction.mdx +22 -0
- package/docs/commands/zset/zadd.mdx +102 -0
- package/docs/commands/zset/zcard.mdx +31 -0
- package/docs/commands/zset/zcount.mdx +47 -0
- package/docs/commands/zset/zdiffstore.mdx +33 -0
- package/docs/commands/zset/zincrby.mdx +37 -0
- package/docs/commands/zset/zinterstore.mdx +98 -0
- package/docs/commands/zset/zlexcount.mdx +43 -0
- package/docs/commands/zset/zmscore.mdx +34 -0
- package/docs/commands/zset/zpopmax.mdx +25 -0
- package/docs/commands/zset/zpopmin.mdx +25 -0
- package/docs/commands/zset/zrange.mdx +85 -0
- package/docs/commands/zset/zrank.mdx +29 -0
- package/docs/commands/zset/zrem.mdx +33 -0
- package/docs/commands/zset/zremrangebylex.mdx +32 -0
- package/docs/commands/zset/zremrangebyrank.mdx +32 -0
- package/docs/commands/zset/zremrangebyscore.mdx +32 -0
- package/docs/commands/zset/zrevrank.mdx +29 -0
- package/docs/commands/zset/zscan.mdx +58 -0
- package/docs/commands/zset/zscore.mdx +34 -0
- package/docs/commands/zset/zunionstore.mdx +98 -0
- package/docs/deployment.mdx +117 -0
- package/docs/developing.mdx +118 -0
- package/docs/getstarted.mdx +68 -0
- package/docs/overview.mdx +29 -0
- package/docs/pipelining/auto-pipeline.mdx +108 -0
- package/docs/pipelining/pipeline-transaction.mdx +65 -0
- package/docs/retries.mdx +24 -0
- package/docs/troubleshooting.mdx +80 -0
- package/{error-BNzLTXJG.d.mts → error-4e36-PC0.d.mts} +838 -8
- package/{error-BNzLTXJG.d.ts → error-4e36-PC0.d.ts} +838 -8
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +557 -4
- package/fastly.mjs +1 -1
- package/nodejs.d.mts +34 -2
- package/nodejs.d.ts +34 -2
- package/nodejs.js +586 -4
- package/nodejs.mjs +30 -1
- package/package.json +16 -5
- package/src/pkg/auto-pipeline.ts +284 -0
- package/src/pkg/commands/append.ts +12 -0
- package/src/pkg/commands/arcount.ts +14 -0
- package/src/pkg/commands/ardel.ts +19 -0
- package/src/pkg/commands/ardelrange.ts +19 -0
- package/src/pkg/commands/arget.ts +17 -0
- package/src/pkg/commands/argetrange.ts +20 -0
- package/src/pkg/commands/argrep.ts +109 -0
- package/src/pkg/commands/arinfo.ts +88 -0
- package/src/pkg/commands/arinsert.ts +24 -0
- package/src/pkg/commands/arlastitems.ts +29 -0
- package/src/pkg/commands/arlen.ts +23 -0
- package/src/pkg/commands/armget.ts +18 -0
- package/src/pkg/commands/armset.ts +26 -0
- package/src/pkg/commands/arnext.ts +20 -0
- package/src/pkg/commands/arop.ts +48 -0
- package/src/pkg/commands/arring.ts +23 -0
- package/src/pkg/commands/arscan.ts +44 -0
- package/src/pkg/commands/arseek.ts +17 -0
- package/src/pkg/commands/arset.ts +20 -0
- package/src/pkg/commands/bitcount.ts +30 -0
- package/src/pkg/commands/bitfield.ts +50 -0
- package/src/pkg/commands/bitop.ts +35 -0
- package/src/pkg/commands/bitpos.ts +15 -0
- package/src/pkg/commands/client_setinfo.ts +17 -0
- package/src/pkg/commands/command.ts +142 -0
- package/src/pkg/commands/copy.ts +22 -0
- package/src/pkg/commands/dbsize.ts +12 -0
- package/src/pkg/commands/decr.ts +12 -0
- package/src/pkg/commands/decrby.ts +12 -0
- package/src/pkg/commands/del.ts +12 -0
- package/src/pkg/commands/echo.ts +12 -0
- package/src/pkg/commands/eval.ts +18 -0
- package/src/pkg/commands/evalRo.ts +18 -0
- package/src/pkg/commands/evalsha.ts +18 -0
- package/src/pkg/commands/evalshaRo.ts +18 -0
- package/src/pkg/commands/exec.ts +23 -0
- package/src/pkg/commands/exists.ts +12 -0
- package/src/pkg/commands/expire.ts +13 -0
- package/src/pkg/commands/expireat.ts +16 -0
- package/src/pkg/commands/fcall.ts +15 -0
- package/src/pkg/commands/fcall_ro.ts +18 -0
- package/src/pkg/commands/flushall.ts +15 -0
- package/src/pkg/commands/flushdb.ts +15 -0
- package/src/pkg/commands/function_delete.ts +12 -0
- package/src/pkg/commands/function_flush.ts +12 -0
- package/src/pkg/commands/function_list.ts +77 -0
- package/src/pkg/commands/function_load.ts +31 -0
- package/src/pkg/commands/function_stats.ts +42 -0
- package/src/pkg/commands/geo_add.ts +54 -0
- package/src/pkg/commands/geo_dist.ts +19 -0
- package/src/pkg/commands/geo_hash.ts +23 -0
- package/src/pkg/commands/geo_pos.ts +39 -0
- package/src/pkg/commands/geo_search.ts +140 -0
- package/src/pkg/commands/geo_search_store.ts +69 -0
- package/src/pkg/commands/get.ts +15 -0
- package/src/pkg/commands/getbit.ts +12 -0
- package/src/pkg/commands/getdel.ts +15 -0
- package/src/pkg/commands/getex.ts +36 -0
- package/src/pkg/commands/getrange.ts +15 -0
- package/src/pkg/commands/getset.ts +15 -0
- package/src/pkg/commands/hdel.ts +12 -0
- package/src/pkg/commands/hexists.ts +12 -0
- package/src/pkg/commands/hexpire.ts +30 -0
- package/src/pkg/commands/hexpireat.ts +30 -0
- package/src/pkg/commands/hexpiretime.ts +13 -0
- package/src/pkg/commands/hget.ts +18 -0
- package/src/pkg/commands/hgetall.ts +44 -0
- package/src/pkg/commands/hgetdel.ts +30 -0
- package/src/pkg/commands/hgetex.ts +56 -0
- package/src/pkg/commands/hincrby.ts +15 -0
- package/src/pkg/commands/hincrbyfloat.ts +15 -0
- package/src/pkg/commands/hkeys.ts +12 -0
- package/src/pkg/commands/hlen.ts +12 -0
- package/src/pkg/commands/hmget.ts +53 -0
- package/src/pkg/commands/hmset.ts +14 -0
- package/src/pkg/commands/hpersist.ts +13 -0
- package/src/pkg/commands/hpexpire.ts +30 -0
- package/src/pkg/commands/hpexpireat.ts +30 -0
- package/src/pkg/commands/hpexpiretime.ts +13 -0
- package/src/pkg/commands/hpttl.ts +13 -0
- package/src/pkg/commands/hrandfield.ts +52 -0
- package/src/pkg/commands/hscan.ts +31 -0
- package/src/pkg/commands/hset.ts +15 -0
- package/src/pkg/commands/hsetex.ts +59 -0
- package/src/pkg/commands/hsetnx.ts +15 -0
- package/src/pkg/commands/hstrlen.ts +12 -0
- package/src/pkg/commands/httl.ts +13 -0
- package/src/pkg/commands/hvals.ts +12 -0
- package/src/pkg/commands/incr.ts +12 -0
- package/src/pkg/commands/incrby.ts +12 -0
- package/src/pkg/commands/incrbyfloat.ts +12 -0
- package/src/pkg/commands/json_arrappend.ts +18 -0
- package/src/pkg/commands/json_arrindex.ts +15 -0
- package/src/pkg/commands/json_arrinsert.ts +18 -0
- package/src/pkg/commands/json_arrlen.ts +15 -0
- package/src/pkg/commands/json_arrpop.ts +15 -0
- package/src/pkg/commands/json_arrtrim.ts +19 -0
- package/src/pkg/commands/json_clear.ts +12 -0
- package/src/pkg/commands/json_del.ts +12 -0
- package/src/pkg/commands/json_forget.ts +12 -0
- package/src/pkg/commands/json_get.ts +45 -0
- package/src/pkg/commands/json_merge.ts +18 -0
- package/src/pkg/commands/json_mget.ts +12 -0
- package/src/pkg/commands/json_mset.ts +27 -0
- package/src/pkg/commands/json_numincrby.ts +15 -0
- package/src/pkg/commands/json_nummultby.ts +15 -0
- package/src/pkg/commands/json_objkeys.ts +15 -0
- package/src/pkg/commands/json_objlen.ts +15 -0
- package/src/pkg/commands/json_resp.ts +11 -0
- package/src/pkg/commands/json_set.ts +35 -0
- package/src/pkg/commands/json_strappend.ts +15 -0
- package/src/pkg/commands/json_strlen.ts +15 -0
- package/src/pkg/commands/json_toggle.ts +12 -0
- package/src/pkg/commands/json_type.ts +12 -0
- package/src/pkg/commands/keys.ts +12 -0
- package/src/pkg/commands/lindex.ts +11 -0
- package/src/pkg/commands/linsert.ts +10 -0
- package/src/pkg/commands/llen.ts +12 -0
- package/src/pkg/commands/lmove.ts +20 -0
- package/src/pkg/commands/lmpop.ts +19 -0
- package/src/pkg/commands/lpop.ts +18 -0
- package/src/pkg/commands/lpos.ts +26 -0
- package/src/pkg/commands/lpush.ts +12 -0
- package/src/pkg/commands/lpushx.ts +12 -0
- package/src/pkg/commands/lrange.ts +11 -0
- package/src/pkg/commands/lrem.ts +10 -0
- package/src/pkg/commands/lset.ts +8 -0
- package/src/pkg/commands/ltrim.ts +8 -0
- package/src/pkg/commands/mget.ts +15 -0
- package/src/pkg/commands/mod.ts +222 -0
- package/src/pkg/commands/mset.ts +12 -0
- package/src/pkg/commands/msetnx.ts +12 -0
- package/src/pkg/commands/persist.ts +12 -0
- package/src/pkg/commands/pexpire.ts +16 -0
- package/src/pkg/commands/pexpireat.ts +16 -0
- package/src/pkg/commands/pfadd.ts +11 -0
- package/src/pkg/commands/pfcount.ts +11 -0
- package/src/pkg/commands/pfmerge.ts +11 -0
- package/src/pkg/commands/ping.ts +15 -0
- package/src/pkg/commands/psetex.ts +14 -0
- package/src/pkg/commands/psubscribe.ts +26 -0
- package/src/pkg/commands/pttl.ts +12 -0
- package/src/pkg/commands/publish.ts +12 -0
- package/src/pkg/commands/randomkey.ts +12 -0
- package/src/pkg/commands/rename.ts +12 -0
- package/src/pkg/commands/renamenx.ts +12 -0
- package/src/pkg/commands/rpop.ts +21 -0
- package/src/pkg/commands/rpush.ts +12 -0
- package/src/pkg/commands/rpushx.ts +12 -0
- package/src/pkg/commands/sadd.ts +15 -0
- package/src/pkg/commands/scan.ts +63 -0
- package/src/pkg/commands/scard.ts +11 -0
- package/src/pkg/commands/script_exists.ts +15 -0
- package/src/pkg/commands/script_flush.ts +22 -0
- package/src/pkg/commands/script_load.ts +12 -0
- package/src/pkg/commands/sdiff.ts +11 -0
- package/src/pkg/commands/sdiffstore.ts +14 -0
- package/src/pkg/commands/search/command-builder.ts +162 -0
- package/src/pkg/commands/search/index.ts +4 -0
- package/src/pkg/commands/search/schema-builder.ts +320 -0
- package/src/pkg/commands/search/search.ts +218 -0
- package/src/pkg/commands/search/types.ts +1029 -0
- package/src/pkg/commands/search/utils.ts +275 -0
- package/src/pkg/commands/set.ts +52 -0
- package/src/pkg/commands/setbit.ts +15 -0
- package/src/pkg/commands/setex.ts +11 -0
- package/src/pkg/commands/setnx.ts +11 -0
- package/src/pkg/commands/setrange.ts +15 -0
- package/src/pkg/commands/sinter.ts +11 -0
- package/src/pkg/commands/sintercard.ts +19 -0
- package/src/pkg/commands/sinterstore.ts +14 -0
- package/src/pkg/commands/sismember.ts +11 -0
- package/src/pkg/commands/smembers.ts +12 -0
- package/src/pkg/commands/smismember.ts +17 -0
- package/src/pkg/commands/smove.ts +14 -0
- package/src/pkg/commands/spop.ts +18 -0
- package/src/pkg/commands/srandmember.ts +18 -0
- package/src/pkg/commands/srem.ts +11 -0
- package/src/pkg/commands/sscan.ts +31 -0
- package/src/pkg/commands/strlen.ts +12 -0
- package/src/pkg/commands/subscribe.ts +254 -0
- package/src/pkg/commands/sunion.ts +12 -0
- package/src/pkg/commands/sunionstore.ts +15 -0
- package/src/pkg/commands/time.ts +10 -0
- package/src/pkg/commands/touch.ts +12 -0
- package/src/pkg/commands/ttl.ts +12 -0
- package/src/pkg/commands/type.ts +13 -0
- package/src/pkg/commands/types.ts +201 -0
- package/src/pkg/commands/unlink.ts +12 -0
- package/src/pkg/commands/vector/index.ts +11 -0
- package/src/pkg/commands/vector/types.ts +63 -0
- package/src/pkg/commands/vector/utils.ts +67 -0
- package/src/pkg/commands/vector/vector.ts +131 -0
- package/src/pkg/commands/vector_add.ts +18 -0
- package/src/pkg/commands/vector_count.ts +11 -0
- package/src/pkg/commands/vector_create.ts +28 -0
- package/src/pkg/commands/vector_del.ts +13 -0
- package/src/pkg/commands/vector_drop.ts +13 -0
- package/src/pkg/commands/vector_get.ts +18 -0
- package/src/pkg/commands/vector_info.ts +25 -0
- package/src/pkg/commands/vector_query.ts +24 -0
- package/src/pkg/commands/xack.ts +16 -0
- package/src/pkg/commands/xackdel.ts +21 -0
- package/src/pkg/commands/xadd.ts +70 -0
- package/src/pkg/commands/xautoclaim.ts +31 -0
- package/src/pkg/commands/xclaim.ts +56 -0
- package/src/pkg/commands/xdel.ts +16 -0
- package/src/pkg/commands/xdelex.ts +25 -0
- package/src/pkg/commands/xgroup.ts +101 -0
- package/src/pkg/commands/xinfo.ts +28 -0
- package/src/pkg/commands/xlen.ts +12 -0
- package/src/pkg/commands/xpending.ts +44 -0
- package/src/pkg/commands/xrange.ts +49 -0
- package/src/pkg/commands/xread.ts +78 -0
- package/src/pkg/commands/xreadgroup.ts +74 -0
- package/src/pkg/commands/xrevrange.ts +48 -0
- package/src/pkg/commands/xtrim.ts +25 -0
- package/src/pkg/commands/zadd.ts +54 -0
- package/src/pkg/commands/zcard.ts +12 -0
- package/src/pkg/commands/zcount.ts +14 -0
- package/src/pkg/commands/zdiffstore.ts +15 -0
- package/src/pkg/commands/zincrby.ts +14 -0
- package/src/pkg/commands/zinterstore.ts +51 -0
- package/src/pkg/commands/zlexcount.ts +11 -0
- package/src/pkg/commands/zmscore.ts +16 -0
- package/src/pkg/commands/zpopmax.ts +18 -0
- package/src/pkg/commands/zpopmin.ts +18 -0
- package/src/pkg/commands/zrange.ts +72 -0
- package/src/pkg/commands/zrank.ts +14 -0
- package/src/pkg/commands/zrem.ts +11 -0
- package/src/pkg/commands/zremrangebylex.ts +11 -0
- package/src/pkg/commands/zremrangebyrank.ts +14 -0
- package/src/pkg/commands/zremrangebyscore.ts +18 -0
- package/src/pkg/commands/zrevrank.ts +14 -0
- package/src/pkg/commands/zscan.ts +31 -0
- package/src/pkg/commands/zscore.ts +15 -0
- package/src/pkg/commands/zunion.ts +54 -0
- package/src/pkg/commands/zunionstore.ts +52 -0
- package/src/pkg/error.ts +28 -0
- package/src/pkg/http.ts +458 -0
- package/src/pkg/index.ts +1 -0
- package/src/pkg/pipeline.ts +2041 -0
- package/src/pkg/redis.ts +2130 -0
- package/src/pkg/script.ts +100 -0
- package/src/pkg/scriptRo.ts +98 -0
- package/src/pkg/types.ts +35 -0
- package/src/pkg/util.ts +115 -0
- package/src/platforms/cloudflare.ts +162 -0
- package/src/platforms/fastly.ts +105 -0
- package/src/platforms/nodejs.ts +231 -0
- package/src/version.ts +1 -0
package/src/pkg/redis.ts
ADDED
|
@@ -0,0 +1,2130 @@
|
|
|
1
|
+
import { createAutoPipelineProxy } from "../pkg/auto-pipeline";
|
|
2
|
+
import type {
|
|
3
|
+
CommandOptions,
|
|
4
|
+
ScoreMember,
|
|
5
|
+
SetCommandOptions,
|
|
6
|
+
ZAddCommandOptions,
|
|
7
|
+
ZRangeCommandOptions,
|
|
8
|
+
ScanCommandOptions,
|
|
9
|
+
ScanResultStandard,
|
|
10
|
+
ScanResultWithType,
|
|
11
|
+
} from "./commands/mod";
|
|
12
|
+
import type { ArGrepOptions, ArMSetValues, ArOpOperation } from "./commands/mod";
|
|
13
|
+
import {
|
|
14
|
+
AppendCommand,
|
|
15
|
+
ArCountCommand,
|
|
16
|
+
ArDelCommand,
|
|
17
|
+
ArDelRangeCommand,
|
|
18
|
+
ArGetCommand,
|
|
19
|
+
ArGetRangeCommand,
|
|
20
|
+
ArGrepCommand,
|
|
21
|
+
ArInfoCommand,
|
|
22
|
+
ArInsertCommand,
|
|
23
|
+
ArLastItemsCommand,
|
|
24
|
+
ArLenCommand,
|
|
25
|
+
ArMGetCommand,
|
|
26
|
+
ArMSetCommand,
|
|
27
|
+
ArNextCommand,
|
|
28
|
+
ArOpCommand,
|
|
29
|
+
ArRingCommand,
|
|
30
|
+
ArScanCommand,
|
|
31
|
+
ArSeekCommand,
|
|
32
|
+
ArSetCommand,
|
|
33
|
+
BitCountCommand,
|
|
34
|
+
BitFieldCommand,
|
|
35
|
+
BitOpCommand,
|
|
36
|
+
BitPosCommand,
|
|
37
|
+
ClientSetInfoCommand,
|
|
38
|
+
CopyCommand,
|
|
39
|
+
DBSizeCommand,
|
|
40
|
+
DecrByCommand,
|
|
41
|
+
DecrCommand,
|
|
42
|
+
DelCommand,
|
|
43
|
+
EchoCommand,
|
|
44
|
+
EvalROCommand,
|
|
45
|
+
EvalCommand,
|
|
46
|
+
EvalshaROCommand,
|
|
47
|
+
EvalshaCommand,
|
|
48
|
+
ExecCommand,
|
|
49
|
+
ExistsCommand,
|
|
50
|
+
ExpireAtCommand,
|
|
51
|
+
ExpireCommand,
|
|
52
|
+
FCallCommand,
|
|
53
|
+
FCallRoCommand,
|
|
54
|
+
FlushAllCommand,
|
|
55
|
+
FlushDBCommand,
|
|
56
|
+
FunctionDeleteCommand,
|
|
57
|
+
FunctionFlushCommand,
|
|
58
|
+
FunctionListCommand,
|
|
59
|
+
FunctionLoadCommand,
|
|
60
|
+
FunctionStatsCommand,
|
|
61
|
+
GeoAddCommand,
|
|
62
|
+
GeoDistCommand,
|
|
63
|
+
GeoHashCommand,
|
|
64
|
+
GeoPosCommand,
|
|
65
|
+
GeoSearchCommand,
|
|
66
|
+
GeoSearchStoreCommand,
|
|
67
|
+
GetBitCommand,
|
|
68
|
+
GetCommand,
|
|
69
|
+
GetDelCommand,
|
|
70
|
+
GetExCommand,
|
|
71
|
+
GetRangeCommand,
|
|
72
|
+
GetSetCommand,
|
|
73
|
+
HDelCommand,
|
|
74
|
+
HExistsCommand,
|
|
75
|
+
HExpireCommand,
|
|
76
|
+
HExpireAtCommand,
|
|
77
|
+
HExpireTimeCommand,
|
|
78
|
+
HTtlCommand,
|
|
79
|
+
HPExpireCommand,
|
|
80
|
+
HPExpireAtCommand,
|
|
81
|
+
HPExpireTimeCommand,
|
|
82
|
+
HPTtlCommand,
|
|
83
|
+
HPersistCommand,
|
|
84
|
+
HGetAllCommand,
|
|
85
|
+
HGetCommand,
|
|
86
|
+
HGetDelCommand,
|
|
87
|
+
HGetExCommand,
|
|
88
|
+
HIncrByCommand,
|
|
89
|
+
HIncrByFloatCommand,
|
|
90
|
+
HKeysCommand,
|
|
91
|
+
HLenCommand,
|
|
92
|
+
HMGetCommand,
|
|
93
|
+
HMSetCommand,
|
|
94
|
+
HRandFieldCommand,
|
|
95
|
+
HScanCommand,
|
|
96
|
+
HSetCommand,
|
|
97
|
+
HSetExCommand,
|
|
98
|
+
HSetNXCommand,
|
|
99
|
+
HStrLenCommand,
|
|
100
|
+
HValsCommand,
|
|
101
|
+
IncrByCommand,
|
|
102
|
+
IncrByFloatCommand,
|
|
103
|
+
IncrCommand,
|
|
104
|
+
JsonArrAppendCommand,
|
|
105
|
+
JsonArrIndexCommand,
|
|
106
|
+
JsonArrInsertCommand,
|
|
107
|
+
JsonArrLenCommand,
|
|
108
|
+
JsonArrPopCommand,
|
|
109
|
+
JsonArrTrimCommand,
|
|
110
|
+
JsonClearCommand,
|
|
111
|
+
JsonDelCommand,
|
|
112
|
+
JsonForgetCommand,
|
|
113
|
+
JsonGetCommand,
|
|
114
|
+
JsonMergeCommand,
|
|
115
|
+
JsonMGetCommand,
|
|
116
|
+
JsonMSetCommand,
|
|
117
|
+
JsonNumIncrByCommand,
|
|
118
|
+
JsonNumMultByCommand,
|
|
119
|
+
JsonObjKeysCommand,
|
|
120
|
+
JsonObjLenCommand,
|
|
121
|
+
JsonRespCommand,
|
|
122
|
+
JsonSetCommand,
|
|
123
|
+
JsonStrAppendCommand,
|
|
124
|
+
JsonStrLenCommand,
|
|
125
|
+
JsonToggleCommand,
|
|
126
|
+
JsonTypeCommand,
|
|
127
|
+
KeysCommand,
|
|
128
|
+
LIndexCommand,
|
|
129
|
+
LInsertCommand,
|
|
130
|
+
LLenCommand,
|
|
131
|
+
LMoveCommand,
|
|
132
|
+
LPopCommand,
|
|
133
|
+
LPosCommand,
|
|
134
|
+
LPushCommand,
|
|
135
|
+
LPushXCommand,
|
|
136
|
+
LRangeCommand,
|
|
137
|
+
LRemCommand,
|
|
138
|
+
LSetCommand,
|
|
139
|
+
LTrimCommand,
|
|
140
|
+
LmPopCommand,
|
|
141
|
+
MGetCommand,
|
|
142
|
+
MSetCommand,
|
|
143
|
+
MSetNXCommand,
|
|
144
|
+
PExpireAtCommand,
|
|
145
|
+
PExpireCommand,
|
|
146
|
+
PSetEXCommand,
|
|
147
|
+
PTtlCommand,
|
|
148
|
+
PersistCommand,
|
|
149
|
+
PfAddCommand,
|
|
150
|
+
PfCountCommand,
|
|
151
|
+
PfMergeCommand,
|
|
152
|
+
PingCommand,
|
|
153
|
+
PublishCommand,
|
|
154
|
+
RPopCommand,
|
|
155
|
+
RPushCommand,
|
|
156
|
+
RPushXCommand,
|
|
157
|
+
RandomKeyCommand,
|
|
158
|
+
RenameCommand,
|
|
159
|
+
RenameNXCommand,
|
|
160
|
+
SAddCommand,
|
|
161
|
+
SCardCommand,
|
|
162
|
+
SDiffCommand,
|
|
163
|
+
SDiffStoreCommand,
|
|
164
|
+
SInterCommand,
|
|
165
|
+
SInterCardCommand,
|
|
166
|
+
SInterStoreCommand,
|
|
167
|
+
SIsMemberCommand,
|
|
168
|
+
SMIsMemberCommand,
|
|
169
|
+
SMembersCommand,
|
|
170
|
+
SMoveCommand,
|
|
171
|
+
SPopCommand,
|
|
172
|
+
SRandMemberCommand,
|
|
173
|
+
SRemCommand,
|
|
174
|
+
SScanCommand,
|
|
175
|
+
SUnionCommand,
|
|
176
|
+
SUnionStoreCommand,
|
|
177
|
+
ScanCommand,
|
|
178
|
+
ScriptExistsCommand,
|
|
179
|
+
ScriptFlushCommand,
|
|
180
|
+
ScriptLoadCommand,
|
|
181
|
+
SetBitCommand,
|
|
182
|
+
SetCommand,
|
|
183
|
+
SetExCommand,
|
|
184
|
+
SetNxCommand,
|
|
185
|
+
SetRangeCommand,
|
|
186
|
+
StrLenCommand,
|
|
187
|
+
TimeCommand,
|
|
188
|
+
TouchCommand,
|
|
189
|
+
TtlCommand,
|
|
190
|
+
TypeCommand,
|
|
191
|
+
UnlinkCommand,
|
|
192
|
+
XAckCommand,
|
|
193
|
+
XAckDelCommand,
|
|
194
|
+
XAddCommand,
|
|
195
|
+
XAutoClaim,
|
|
196
|
+
XClaimCommand,
|
|
197
|
+
XDelCommand,
|
|
198
|
+
XDelExCommand,
|
|
199
|
+
XGroupCommand,
|
|
200
|
+
XInfoCommand,
|
|
201
|
+
XLenCommand,
|
|
202
|
+
XPendingCommand,
|
|
203
|
+
XRangeCommand,
|
|
204
|
+
XReadCommand,
|
|
205
|
+
XReadGroupCommand,
|
|
206
|
+
XRevRangeCommand,
|
|
207
|
+
XTrimCommand,
|
|
208
|
+
ZAddCommand,
|
|
209
|
+
ZCardCommand,
|
|
210
|
+
ZCountCommand,
|
|
211
|
+
ZIncrByCommand,
|
|
212
|
+
ZInterStoreCommand,
|
|
213
|
+
ZLexCountCommand,
|
|
214
|
+
ZPopMaxCommand,
|
|
215
|
+
ZPopMinCommand,
|
|
216
|
+
ZRangeCommand,
|
|
217
|
+
ZRankCommand,
|
|
218
|
+
ZRemCommand,
|
|
219
|
+
ZRemRangeByLexCommand,
|
|
220
|
+
ZRemRangeByRankCommand,
|
|
221
|
+
ZRemRangeByScoreCommand,
|
|
222
|
+
ZRevRankCommand,
|
|
223
|
+
ZScanCommand,
|
|
224
|
+
ZScoreCommand,
|
|
225
|
+
ZUnionCommand,
|
|
226
|
+
ZUnionStoreCommand,
|
|
227
|
+
} from "./commands/mod";
|
|
228
|
+
import {
|
|
229
|
+
type CreateIndexParameters,
|
|
230
|
+
type NestedIndexSchema,
|
|
231
|
+
type FlatIndexSchema,
|
|
232
|
+
} from "./commands/search";
|
|
233
|
+
import type { InitIndexParameters } from "./commands/search/search";
|
|
234
|
+
import { createIndex, initIndex, listAliases, addAlias, delAlias } from "./commands/search/search";
|
|
235
|
+
import type { CreateVectorIndexParameters } from "./commands/vector/vector";
|
|
236
|
+
import { createVectorIndex, initVectorIndex } from "./commands/vector/vector";
|
|
237
|
+
import { Subscriber } from "./commands/subscribe";
|
|
238
|
+
import { ZDiffStoreCommand } from "./commands/zdiffstore";
|
|
239
|
+
import { ZMScoreCommand } from "./commands/zmscore";
|
|
240
|
+
import type { Requester, UpstashRequest, UpstashResponse } from "./http";
|
|
241
|
+
import { Pipeline } from "./pipeline";
|
|
242
|
+
import { Script } from "./script";
|
|
243
|
+
import { ScriptRO } from "./scriptRo";
|
|
244
|
+
import type { CommandArgs, RedisOptions, Telemetry } from "./types";
|
|
245
|
+
|
|
246
|
+
// See https://github.com/upstash/upstash-redis/issues/342
|
|
247
|
+
// why we need this export
|
|
248
|
+
export type { RedisOptions } from "./types";
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Serverless redis client for upstash.
|
|
252
|
+
*/
|
|
253
|
+
export class Redis {
|
|
254
|
+
protected client: Requester;
|
|
255
|
+
protected opts?: CommandOptions<any, any>;
|
|
256
|
+
protected enableTelemetry: boolean;
|
|
257
|
+
protected enableAutoPipelining: boolean;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Create a new redis client
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```typescript
|
|
264
|
+
* const redis = new Redis({
|
|
265
|
+
* url: "<UPSTASH_REDIS_REST_URL>",
|
|
266
|
+
* token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
267
|
+
* });
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
constructor(client: Requester, opts?: RedisOptions) {
|
|
271
|
+
this.client = client;
|
|
272
|
+
this.opts = opts;
|
|
273
|
+
this.enableTelemetry = opts?.enableTelemetry ?? true;
|
|
274
|
+
|
|
275
|
+
if (opts?.readYourWrites === false) {
|
|
276
|
+
this.client.readYourWrites = false;
|
|
277
|
+
}
|
|
278
|
+
this.enableAutoPipelining = opts?.enableAutoPipelining ?? true;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
get readYourWritesSyncToken(): string | undefined {
|
|
282
|
+
return this.client.upstashSyncToken;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
set readYourWritesSyncToken(session: string | undefined) {
|
|
286
|
+
this.client.upstashSyncToken = session;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
get json() {
|
|
290
|
+
return {
|
|
291
|
+
/**
|
|
292
|
+
* @see https://redis.io/commands/json.arrappend
|
|
293
|
+
* @see node_modules/@upstash/redis/docs/commands/json/arrappend.mdx
|
|
294
|
+
*/
|
|
295
|
+
arrappend: (...args: CommandArgs<typeof JsonArrAppendCommand>) =>
|
|
296
|
+
new JsonArrAppendCommand(args, this.opts).exec(this.client),
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* @see https://redis.io/commands/json.arrindex
|
|
300
|
+
* @see node_modules/@upstash/redis/docs/commands/json/arrindex.mdx
|
|
301
|
+
*/
|
|
302
|
+
arrindex: (...args: CommandArgs<typeof JsonArrIndexCommand>) =>
|
|
303
|
+
new JsonArrIndexCommand(args, this.opts).exec(this.client),
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* @see https://redis.io/commands/json.arrinsert
|
|
307
|
+
* @see node_modules/@upstash/redis/docs/commands/json/arrinsert.mdx
|
|
308
|
+
*/
|
|
309
|
+
arrinsert: (...args: CommandArgs<typeof JsonArrInsertCommand>) =>
|
|
310
|
+
new JsonArrInsertCommand(args, this.opts).exec(this.client),
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @see https://redis.io/commands/json.arrlen
|
|
314
|
+
* @see node_modules/@upstash/redis/docs/commands/json/arrlen.mdx
|
|
315
|
+
*/
|
|
316
|
+
arrlen: (...args: CommandArgs<typeof JsonArrLenCommand>) =>
|
|
317
|
+
new JsonArrLenCommand(args, this.opts).exec(this.client),
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @see https://redis.io/commands/json.arrpop
|
|
321
|
+
* @see node_modules/@upstash/redis/docs/commands/json/arrpop.mdx
|
|
322
|
+
*/
|
|
323
|
+
arrpop: (...args: CommandArgs<typeof JsonArrPopCommand>) =>
|
|
324
|
+
new JsonArrPopCommand(args, this.opts).exec(this.client),
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @see https://redis.io/commands/json.arrtrim
|
|
328
|
+
* @see node_modules/@upstash/redis/docs/commands/json/arrtrim.mdx
|
|
329
|
+
*/
|
|
330
|
+
arrtrim: (...args: CommandArgs<typeof JsonArrTrimCommand>) =>
|
|
331
|
+
new JsonArrTrimCommand(args, this.opts).exec(this.client),
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* @see https://redis.io/commands/json.clear
|
|
335
|
+
* @see node_modules/@upstash/redis/docs/commands/json/clear.mdx
|
|
336
|
+
*/
|
|
337
|
+
clear: (...args: CommandArgs<typeof JsonClearCommand>) =>
|
|
338
|
+
new JsonClearCommand(args, this.opts).exec(this.client),
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* @see https://redis.io/commands/json.del
|
|
342
|
+
* @see node_modules/@upstash/redis/docs/commands/json/del.mdx
|
|
343
|
+
*/
|
|
344
|
+
del: (...args: CommandArgs<typeof JsonDelCommand>) =>
|
|
345
|
+
new JsonDelCommand(args, this.opts).exec(this.client),
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @see https://redis.io/commands/json.forget
|
|
349
|
+
* @see node_modules/@upstash/redis/docs/commands/json/forget.mdx
|
|
350
|
+
*/
|
|
351
|
+
forget: (...args: CommandArgs<typeof JsonForgetCommand>) =>
|
|
352
|
+
new JsonForgetCommand(args, this.opts).exec(this.client),
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @see https://redis.io/commands/json.get
|
|
356
|
+
* @see node_modules/@upstash/redis/docs/commands/json/get.mdx
|
|
357
|
+
*/
|
|
358
|
+
get: <TData>(...args: CommandArgs<typeof JsonGetCommand>) =>
|
|
359
|
+
new JsonGetCommand<TData>(args, this.opts).exec(this.client),
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @see https://redis.io/commands/json.merge
|
|
363
|
+
* @see node_modules/@upstash/redis/docs/commands/json/merge.mdx
|
|
364
|
+
*/
|
|
365
|
+
merge: (...args: CommandArgs<typeof JsonMergeCommand>) =>
|
|
366
|
+
new JsonMergeCommand(args, this.opts).exec(this.client),
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @see https://redis.io/commands/json.mget
|
|
370
|
+
* @see node_modules/@upstash/redis/docs/commands/json/mget.mdx
|
|
371
|
+
*/
|
|
372
|
+
mget: <TData>(...args: CommandArgs<typeof JsonMGetCommand>) =>
|
|
373
|
+
new JsonMGetCommand<TData>(args, this.opts).exec(this.client),
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* @see https://redis.io/commands/json.mset
|
|
377
|
+
* @see node_modules/@upstash/redis/docs/commands/json/mset.mdx
|
|
378
|
+
*/
|
|
379
|
+
mset: (...args: CommandArgs<typeof JsonMSetCommand>) =>
|
|
380
|
+
new JsonMSetCommand(args, this.opts).exec(this.client),
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @see https://redis.io/commands/json.numincrby
|
|
384
|
+
* @see node_modules/@upstash/redis/docs/commands/json/numincrby.mdx
|
|
385
|
+
*/
|
|
386
|
+
numincrby: (...args: CommandArgs<typeof JsonNumIncrByCommand>) =>
|
|
387
|
+
new JsonNumIncrByCommand(args, this.opts).exec(this.client),
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* @see https://redis.io/commands/json.nummultby
|
|
391
|
+
* @see node_modules/@upstash/redis/docs/commands/json/nummultby.mdx
|
|
392
|
+
*/
|
|
393
|
+
nummultby: (...args: CommandArgs<typeof JsonNumMultByCommand>) =>
|
|
394
|
+
new JsonNumMultByCommand(args, this.opts).exec(this.client),
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* @see https://redis.io/commands/json.objkeys
|
|
398
|
+
* @see node_modules/@upstash/redis/docs/commands/json/objkeys.mdx
|
|
399
|
+
*/
|
|
400
|
+
objkeys: (...args: CommandArgs<typeof JsonObjKeysCommand>) =>
|
|
401
|
+
new JsonObjKeysCommand(args, this.opts).exec(this.client),
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @see https://redis.io/commands/json.objlen
|
|
405
|
+
* @see node_modules/@upstash/redis/docs/commands/json/objlen.mdx
|
|
406
|
+
*/
|
|
407
|
+
objlen: (...args: CommandArgs<typeof JsonObjLenCommand>) =>
|
|
408
|
+
new JsonObjLenCommand(args, this.opts).exec(this.client),
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* @see https://redis.io/commands/json.resp
|
|
412
|
+
*/
|
|
413
|
+
resp: (...args: CommandArgs<typeof JsonRespCommand>) =>
|
|
414
|
+
new JsonRespCommand(args, this.opts).exec(this.client),
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @see https://redis.io/commands/json.set
|
|
418
|
+
* @see node_modules/@upstash/redis/docs/commands/json/set.mdx
|
|
419
|
+
*/
|
|
420
|
+
set: (...args: CommandArgs<typeof JsonSetCommand>) =>
|
|
421
|
+
new JsonSetCommand(args, this.opts).exec(this.client),
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @see https://redis.io/commands/json.strappend
|
|
425
|
+
* @see node_modules/@upstash/redis/docs/commands/json/strappend.mdx
|
|
426
|
+
*/
|
|
427
|
+
strappend: (...args: CommandArgs<typeof JsonStrAppendCommand>) =>
|
|
428
|
+
new JsonStrAppendCommand(args, this.opts).exec(this.client),
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* @see https://redis.io/commands/json.strlen
|
|
432
|
+
* @see node_modules/@upstash/redis/docs/commands/json/strlen.mdx
|
|
433
|
+
*/
|
|
434
|
+
strlen: (...args: CommandArgs<typeof JsonStrLenCommand>) =>
|
|
435
|
+
new JsonStrLenCommand(args, this.opts).exec(this.client),
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* @see https://redis.io/commands/json.toggle
|
|
439
|
+
* @see node_modules/@upstash/redis/docs/commands/json/toggle.mdx
|
|
440
|
+
*/
|
|
441
|
+
toggle: (...args: CommandArgs<typeof JsonToggleCommand>) =>
|
|
442
|
+
new JsonToggleCommand(args, this.opts).exec(this.client),
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @see https://redis.io/commands/json.type
|
|
446
|
+
* @see node_modules/@upstash/redis/docs/commands/json/type.mdx
|
|
447
|
+
*/
|
|
448
|
+
type: (...args: CommandArgs<typeof JsonTypeCommand>) =>
|
|
449
|
+
new JsonTypeCommand(args, this.opts).exec(this.client),
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
get functions() {
|
|
454
|
+
return {
|
|
455
|
+
/**
|
|
456
|
+
* @see https://redis.io/docs/latest/commands/function-load/
|
|
457
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/load.mdx
|
|
458
|
+
*/
|
|
459
|
+
load: (...args: CommandArgs<typeof FunctionLoadCommand>) =>
|
|
460
|
+
new FunctionLoadCommand(args, this.opts).exec(this.client),
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* @see https://redis.io/docs/latest/commands/function-list/
|
|
464
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/list.mdx
|
|
465
|
+
*/
|
|
466
|
+
list: (...args: CommandArgs<typeof FunctionListCommand>) =>
|
|
467
|
+
new FunctionListCommand(args, this.opts).exec(this.client),
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @see https://redis.io/docs/latest/commands/function-delete/
|
|
471
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/delete.mdx
|
|
472
|
+
*/
|
|
473
|
+
delete: (...args: CommandArgs<typeof FunctionDeleteCommand>) =>
|
|
474
|
+
new FunctionDeleteCommand(args, this.opts).exec(this.client),
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @see https://redis.io/docs/latest/commands/function-flush/
|
|
478
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/flush.mdx
|
|
479
|
+
*/
|
|
480
|
+
flush: () => new FunctionFlushCommand(this.opts).exec(this.client),
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* @see https://redis.io/docs/latest/commands/function-stats/
|
|
484
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/stats.mdx
|
|
485
|
+
*
|
|
486
|
+
* Note: `running_script` field is not supported and therefore not included in the type.
|
|
487
|
+
*/
|
|
488
|
+
stats: () => new FunctionStatsCommand(this.opts).exec(this.client),
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* @see https://redis.io/docs/latest/commands/fcall/
|
|
492
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/call.mdx
|
|
493
|
+
*/
|
|
494
|
+
call: <TData = unknown>(...args: CommandArgs<typeof FCallCommand<TData>>) =>
|
|
495
|
+
new FCallCommand<TData>(args, this.opts).exec(this.client),
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* @see https://redis.io/docs/latest/commands/fcall_ro/
|
|
499
|
+
* @see node_modules/@upstash/redis/docs/commands/functions/call_ro.mdx
|
|
500
|
+
*/
|
|
501
|
+
callRo: <TData = unknown>(...args: CommandArgs<typeof FCallRoCommand<TData>>) =>
|
|
502
|
+
new FCallRoCommand<TData>(args, this.opts).exec(this.client),
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Wrap a new middleware around the HTTP client.
|
|
507
|
+
*/
|
|
508
|
+
use = <TResult = unknown>(
|
|
509
|
+
middleware: (
|
|
510
|
+
r: UpstashRequest,
|
|
511
|
+
next: <TResult = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult>>
|
|
512
|
+
) => Promise<UpstashResponse<TResult>>
|
|
513
|
+
) => {
|
|
514
|
+
const makeRequest = this.client.request.bind(this.client);
|
|
515
|
+
this.client.request = (req: UpstashRequest) => middleware(req, makeRequest) as any;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Technically this is not private, we can hide it from intellisense by doing this
|
|
520
|
+
*/
|
|
521
|
+
protected addTelemetry = (telemetry: Telemetry) => {
|
|
522
|
+
if (!this.enableTelemetry) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
try {
|
|
526
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
527
|
+
// @ts-ignore - The `Requester` interface does not know about this method but it will be there
|
|
528
|
+
// as long as the user uses the standard HttpClient
|
|
529
|
+
this.client.mergeTelemetry(telemetry);
|
|
530
|
+
} catch {
|
|
531
|
+
// ignore
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Creates a new script.
|
|
537
|
+
*
|
|
538
|
+
* Scripts offer the ability to optimistically try to execute a script without having to send the
|
|
539
|
+
* entire script to the server. If the script is loaded on the server, it tries again by sending
|
|
540
|
+
* the entire script. Afterwards, the script is cached on the server.
|
|
541
|
+
*
|
|
542
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
543
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
544
|
+
* to receive raw strings.
|
|
545
|
+
*
|
|
546
|
+
* @param script - The script to create
|
|
547
|
+
* @param opts - Optional options to pass to the script `{ readonly?: boolean }`
|
|
548
|
+
* @returns A new script
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```ts
|
|
552
|
+
* const redis = new Redis({...})
|
|
553
|
+
*
|
|
554
|
+
* const script = redis.createScript<string>("return ARGV[1];")
|
|
555
|
+
* const arg1 = await script.eval([], ["Hello World"])
|
|
556
|
+
* expect(arg1, "Hello World")
|
|
557
|
+
* ```
|
|
558
|
+
* @example
|
|
559
|
+
* ```ts
|
|
560
|
+
* const redis = new Redis({...})
|
|
561
|
+
*
|
|
562
|
+
* const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
|
|
563
|
+
* const arg1 = await script.evalRo([], ["Hello World"])
|
|
564
|
+
* expect(arg1, "Hello World")
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
|
|
568
|
+
createScript<TResult = unknown, TReadonly extends boolean = false>(
|
|
569
|
+
script: string,
|
|
570
|
+
opts?: { readonly?: TReadonly }
|
|
571
|
+
): TReadonly extends true ? ScriptRO<TResult> : Script<TResult> {
|
|
572
|
+
return opts?.readonly ? (new ScriptRO(this, script) as any) : (new Script(this, script) as any);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
get search() {
|
|
576
|
+
return {
|
|
577
|
+
createIndex: <TSchema extends NestedIndexSchema | FlatIndexSchema>(
|
|
578
|
+
params: CreateIndexParameters<TSchema>
|
|
579
|
+
) => {
|
|
580
|
+
return createIndex<TSchema>(this.client, params);
|
|
581
|
+
},
|
|
582
|
+
|
|
583
|
+
index: <TSchema extends NestedIndexSchema | FlatIndexSchema>(
|
|
584
|
+
params: InitIndexParameters<TSchema>
|
|
585
|
+
) => {
|
|
586
|
+
return initIndex<TSchema>(this.client, params);
|
|
587
|
+
},
|
|
588
|
+
|
|
589
|
+
alias: {
|
|
590
|
+
list: () => {
|
|
591
|
+
return listAliases(this.client);
|
|
592
|
+
},
|
|
593
|
+
|
|
594
|
+
add: ({ indexName, alias }: { indexName: string; alias: string }) => {
|
|
595
|
+
return addAlias(this.client, { indexName, alias });
|
|
596
|
+
},
|
|
597
|
+
|
|
598
|
+
delete: ({ alias }: { alias: string }) => {
|
|
599
|
+
return delAlias(this.client, { alias });
|
|
600
|
+
},
|
|
601
|
+
},
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Vector index commands.
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
* ```typescript
|
|
610
|
+
* const index = await redis.vector.createIndex({ name: "docs", dimension: 3, metric: "COSINE" });
|
|
611
|
+
* await index.add("doc-1", [0.1, 0.2, 0.3]);
|
|
612
|
+
* const hits = await index.query({ vector: [0.1, 0.2, 0.3], topK: 5 });
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
get vector() {
|
|
616
|
+
return {
|
|
617
|
+
/**
|
|
618
|
+
* Creates a vector index and returns a handle to it.
|
|
619
|
+
*/
|
|
620
|
+
createIndex: (params: CreateVectorIndexParameters) => {
|
|
621
|
+
return createVectorIndex(this.client, params, this.opts);
|
|
622
|
+
},
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Returns a handle to an existing vector index without sending any command.
|
|
626
|
+
*/
|
|
627
|
+
index: (name: string) => {
|
|
628
|
+
return initVectorIndex(this.client, name, this.opts);
|
|
629
|
+
},
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Create a new pipeline that allows you to send requests in bulk.
|
|
635
|
+
*
|
|
636
|
+
* @see {@link Pipeline}
|
|
637
|
+
*/
|
|
638
|
+
pipeline = () =>
|
|
639
|
+
new Pipeline({
|
|
640
|
+
client: this.client,
|
|
641
|
+
commandOptions: this.opts,
|
|
642
|
+
multiExec: false,
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
protected autoPipeline = () => {
|
|
646
|
+
return createAutoPipelineProxy(this);
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Create a new transaction to allow executing multiple steps atomically.
|
|
651
|
+
*
|
|
652
|
+
* All the commands in a transaction are serialized and executed sequentially. A request sent by
|
|
653
|
+
* another client will never be served in the middle of the execution of a Redis Transaction. This
|
|
654
|
+
* guarantees that the commands are executed as a single isolated operation.
|
|
655
|
+
*
|
|
656
|
+
* @see {@link Pipeline}
|
|
657
|
+
*/
|
|
658
|
+
multi = () =>
|
|
659
|
+
new Pipeline({
|
|
660
|
+
client: this.client,
|
|
661
|
+
commandOptions: this.opts,
|
|
662
|
+
multiExec: true,
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Returns an instance that can be used to execute `BITFIELD` commands on one key.
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* ```typescript
|
|
670
|
+
* redis.set("mykey", 0);
|
|
671
|
+
* const result = await redis.bitfield("mykey")
|
|
672
|
+
* .set("u4", 0, 16)
|
|
673
|
+
* .incr("u4", "#1", 1)
|
|
674
|
+
* .exec();
|
|
675
|
+
* console.log(result); // [0, 1]
|
|
676
|
+
* ```
|
|
677
|
+
*
|
|
678
|
+
* @see https://redis.io/commands/bitfield
|
|
679
|
+
*/
|
|
680
|
+
bitfield = (...args: CommandArgs<typeof BitFieldCommand>) =>
|
|
681
|
+
new BitFieldCommand(args, this.client, this.opts);
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* @see https://redis.io/commands/append
|
|
685
|
+
* @see node_modules/@upstash/redis/docs/commands/string/append.mdx
|
|
686
|
+
*/
|
|
687
|
+
append = (...args: CommandArgs<typeof AppendCommand>) =>
|
|
688
|
+
new AppendCommand(args, this.opts).exec(this.client);
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* @see https://upstash.com/docs/redis/commands/array/arcount
|
|
692
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arcount.mdx
|
|
693
|
+
*/
|
|
694
|
+
arcount = (...args: CommandArgs<typeof ArCountCommand>) =>
|
|
695
|
+
new ArCountCommand(args, this.opts).exec(this.client);
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* @see https://upstash.com/docs/redis/commands/array/ardel
|
|
699
|
+
* @see node_modules/@upstash/redis/docs/commands/array/ardel.mdx
|
|
700
|
+
*/
|
|
701
|
+
ardel = (...args: CommandArgs<typeof ArDelCommand>) =>
|
|
702
|
+
new ArDelCommand(args, this.opts).exec(this.client);
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* @see https://upstash.com/docs/redis/commands/array/ardelrange
|
|
706
|
+
* @see node_modules/@upstash/redis/docs/commands/array/ardelrange.mdx
|
|
707
|
+
*/
|
|
708
|
+
ardelrange = (...args: CommandArgs<typeof ArDelRangeCommand>) =>
|
|
709
|
+
new ArDelRangeCommand(args, this.opts).exec(this.client);
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* @see https://upstash.com/docs/redis/commands/array/arget
|
|
713
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arget.mdx
|
|
714
|
+
*/
|
|
715
|
+
arget = <TData = string>(...args: CommandArgs<typeof ArGetCommand>) =>
|
|
716
|
+
new ArGetCommand<TData>(args, this.opts).exec(this.client);
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* @see https://upstash.com/docs/redis/commands/array/argetrange
|
|
720
|
+
* @see node_modules/@upstash/redis/docs/commands/array/argetrange.mdx
|
|
721
|
+
*/
|
|
722
|
+
argetrange = <TData = string>(...args: CommandArgs<typeof ArGetRangeCommand>) =>
|
|
723
|
+
new ArGetRangeCommand<TData>(args, this.opts).exec(this.client);
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* @see https://upstash.com/docs/redis/commands/array/argrep
|
|
727
|
+
* @see node_modules/@upstash/redis/docs/commands/array/argrep.mdx
|
|
728
|
+
*/
|
|
729
|
+
argrep = <TData = string, TOpts extends ArGrepOptions = ArGrepOptions>(
|
|
730
|
+
key: string,
|
|
731
|
+
start: number | string,
|
|
732
|
+
end: number | string,
|
|
733
|
+
opts: TOpts
|
|
734
|
+
) => new ArGrepCommand<TData, TOpts>([key, start, end, opts], this.opts).exec(this.client);
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* @see https://upstash.com/docs/redis/commands/array/arinfo
|
|
738
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arinfo.mdx
|
|
739
|
+
*/
|
|
740
|
+
arinfo = (...args: CommandArgs<typeof ArInfoCommand>) =>
|
|
741
|
+
new ArInfoCommand(args, this.opts).exec(this.client);
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* @see https://upstash.com/docs/redis/commands/array/arinsert
|
|
745
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arinsert.mdx
|
|
746
|
+
*/
|
|
747
|
+
arinsert = <TData>(key: string, ...values: TData[]) =>
|
|
748
|
+
new ArInsertCommand<TData>([key, ...values], this.opts).exec(this.client);
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* @see https://upstash.com/docs/redis/commands/array/arlastitems
|
|
752
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arlastitems.mdx
|
|
753
|
+
*/
|
|
754
|
+
arlastitems = <TData = string>(...args: CommandArgs<typeof ArLastItemsCommand>) =>
|
|
755
|
+
new ArLastItemsCommand<TData>(args, this.opts).exec(this.client);
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* @see https://upstash.com/docs/redis/commands/array/arlen
|
|
759
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arlen.mdx
|
|
760
|
+
*/
|
|
761
|
+
arlen = (...args: CommandArgs<typeof ArLenCommand>) =>
|
|
762
|
+
new ArLenCommand(args, this.opts).exec(this.client);
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* @see https://upstash.com/docs/redis/commands/array/armget
|
|
766
|
+
* @see node_modules/@upstash/redis/docs/commands/array/armget.mdx
|
|
767
|
+
*/
|
|
768
|
+
armget = <TData = string>(...args: CommandArgs<typeof ArMGetCommand>) =>
|
|
769
|
+
new ArMGetCommand<TData>(args, this.opts).exec(this.client);
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* @see https://upstash.com/docs/redis/commands/array/armset
|
|
773
|
+
* @see node_modules/@upstash/redis/docs/commands/array/armset.mdx
|
|
774
|
+
*/
|
|
775
|
+
armset = <TData>(key: string, values: ArMSetValues<TData>) =>
|
|
776
|
+
new ArMSetCommand<TData>([key, values], this.opts).exec(this.client);
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* @see https://upstash.com/docs/redis/commands/array/arnext
|
|
780
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arnext.mdx
|
|
781
|
+
*/
|
|
782
|
+
arnext = (...args: CommandArgs<typeof ArNextCommand>) =>
|
|
783
|
+
new ArNextCommand(args, this.opts).exec(this.client);
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* @see https://upstash.com/docs/redis/commands/array/arop
|
|
787
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arop.mdx
|
|
788
|
+
*/
|
|
789
|
+
arop = <TData = string>(
|
|
790
|
+
key: string,
|
|
791
|
+
start: number | string,
|
|
792
|
+
end: number | string,
|
|
793
|
+
operation: ArOpOperation<TData>
|
|
794
|
+
) => new ArOpCommand<TData>([key, start, end, operation], this.opts).exec(this.client);
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* @see https://upstash.com/docs/redis/commands/array/arring
|
|
798
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arring.mdx
|
|
799
|
+
*/
|
|
800
|
+
arring = <TData>(key: string, size: number, ...values: TData[]) =>
|
|
801
|
+
new ArRingCommand<TData>([key, size, ...values], this.opts).exec(this.client);
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* @see https://upstash.com/docs/redis/commands/array/arscan
|
|
805
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arscan.mdx
|
|
806
|
+
*/
|
|
807
|
+
arscan = <TData = string>(...args: CommandArgs<typeof ArScanCommand>) =>
|
|
808
|
+
new ArScanCommand<TData>(args, this.opts).exec(this.client);
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* @see https://upstash.com/docs/redis/commands/array/arseek
|
|
812
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arseek.mdx
|
|
813
|
+
*/
|
|
814
|
+
arseek = (...args: CommandArgs<typeof ArSeekCommand>) =>
|
|
815
|
+
new ArSeekCommand(args, this.opts).exec(this.client);
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* @see https://upstash.com/docs/redis/commands/array/arset
|
|
819
|
+
* @see node_modules/@upstash/redis/docs/commands/array/arset.mdx
|
|
820
|
+
*/
|
|
821
|
+
arset = <TData>(key: string, index: number | string, ...values: TData[]) =>
|
|
822
|
+
new ArSetCommand<TData>([key, index, ...values], this.opts).exec(this.client);
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* @see https://redis.io/commands/bitcount
|
|
826
|
+
* @see node_modules/@upstash/redis/docs/commands/bitmap/bitcount.mdx
|
|
827
|
+
*/
|
|
828
|
+
bitcount = (...args: CommandArgs<typeof BitCountCommand>) =>
|
|
829
|
+
new BitCountCommand(args, this.opts).exec(this.client);
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* @see https://redis.io/commands/bitop
|
|
833
|
+
* @see node_modules/@upstash/redis/docs/commands/bitmap/bitop.mdx
|
|
834
|
+
*/
|
|
835
|
+
bitop: {
|
|
836
|
+
(
|
|
837
|
+
op: "and" | "or" | "xor",
|
|
838
|
+
destinationKey: string,
|
|
839
|
+
sourceKey: string,
|
|
840
|
+
...sourceKeys: string[]
|
|
841
|
+
): Promise<number>;
|
|
842
|
+
(op: "not", destinationKey: string, sourceKey: string): Promise<number>;
|
|
843
|
+
(
|
|
844
|
+
op: "diff" | "diff1" | "andor",
|
|
845
|
+
destinationKey: string,
|
|
846
|
+
x: string,
|
|
847
|
+
...y: string[]
|
|
848
|
+
): Promise<number>;
|
|
849
|
+
(op: "one", destinationKey: string, ...sourceKeys: string[]): Promise<number>;
|
|
850
|
+
} = (
|
|
851
|
+
op: "and" | "or" | "xor" | "not" | "diff" | "diff1" | "andor" | "one",
|
|
852
|
+
destinationKey: string,
|
|
853
|
+
sourceKey: string,
|
|
854
|
+
...sourceKeys: string[]
|
|
855
|
+
) =>
|
|
856
|
+
new BitOpCommand([op as any, destinationKey, sourceKey, ...sourceKeys], this.opts).exec(
|
|
857
|
+
this.client
|
|
858
|
+
);
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* @see https://redis.io/commands/bitpos
|
|
862
|
+
* @see node_modules/@upstash/redis/docs/commands/bitmap/bitpos.mdx
|
|
863
|
+
*/
|
|
864
|
+
bitpos = (...args: CommandArgs<typeof BitPosCommand>) =>
|
|
865
|
+
new BitPosCommand(args, this.opts).exec(this.client);
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* @see https://redis.io/commands/client-setinfo
|
|
869
|
+
* @see node_modules/@upstash/redis/docs/commands/connection/client_setinfo.mdx
|
|
870
|
+
*/
|
|
871
|
+
clientSetinfo = (...args: CommandArgs<typeof ClientSetInfoCommand>) =>
|
|
872
|
+
new ClientSetInfoCommand(args, this.opts).exec(this.client);
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* @see https://redis.io/commands/copy
|
|
876
|
+
*/
|
|
877
|
+
copy = (...args: CommandArgs<typeof CopyCommand>) =>
|
|
878
|
+
new CopyCommand(args, this.opts).exec(this.client);
|
|
879
|
+
|
|
880
|
+
/**
|
|
881
|
+
* @see https://redis.io/commands/dbsize
|
|
882
|
+
* @see node_modules/@upstash/redis/docs/commands/server/dbsize.mdx
|
|
883
|
+
*/
|
|
884
|
+
dbsize = () => new DBSizeCommand(this.opts).exec(this.client);
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
|
+
* @see https://redis.io/commands/decr
|
|
888
|
+
* @see node_modules/@upstash/redis/docs/commands/string/decr.mdx
|
|
889
|
+
*/
|
|
890
|
+
decr = (...args: CommandArgs<typeof DecrCommand>) =>
|
|
891
|
+
new DecrCommand(args, this.opts).exec(this.client);
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* @see https://redis.io/commands/decrby
|
|
895
|
+
* @see node_modules/@upstash/redis/docs/commands/string/decrby.mdx
|
|
896
|
+
*/
|
|
897
|
+
decrby = (...args: CommandArgs<typeof DecrByCommand>) =>
|
|
898
|
+
new DecrByCommand(args, this.opts).exec(this.client);
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* @see https://redis.io/commands/del
|
|
902
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/del.mdx
|
|
903
|
+
*/
|
|
904
|
+
del = (...args: CommandArgs<typeof DelCommand>) =>
|
|
905
|
+
new DelCommand(args, this.opts).exec(this.client);
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* @see https://redis.io/commands/echo
|
|
909
|
+
* @see node_modules/@upstash/redis/docs/commands/auth/echo.mdx
|
|
910
|
+
*/
|
|
911
|
+
echo = (...args: CommandArgs<typeof EchoCommand>) =>
|
|
912
|
+
new EchoCommand(args, this.opts).exec(this.client);
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* @see https://redis.io/commands/eval_ro
|
|
916
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/eval_ro.mdx
|
|
917
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
918
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
919
|
+
* to receive raw strings.
|
|
920
|
+
*/
|
|
921
|
+
evalRo = <TArgs extends unknown[], TData = unknown>(
|
|
922
|
+
...args: [script: string, keys: string[], args: TArgs]
|
|
923
|
+
) => new EvalROCommand<TArgs, TData>(args, this.opts).exec(this.client);
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* @see https://redis.io/commands/eval
|
|
927
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/eval.mdx
|
|
928
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
929
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
930
|
+
* to receive raw strings.
|
|
931
|
+
*/
|
|
932
|
+
eval = <TArgs extends unknown[], TData = unknown>(
|
|
933
|
+
...args: [script: string, keys: string[], args: TArgs]
|
|
934
|
+
) => new EvalCommand<TArgs, TData>(args, this.opts).exec(this.client);
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* @see https://redis.io/commands/evalsha_ro
|
|
938
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/evalsha_ro.mdx
|
|
939
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
940
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
941
|
+
* to receive raw strings.
|
|
942
|
+
*/
|
|
943
|
+
evalshaRo = <TArgs extends unknown[], TData = unknown>(
|
|
944
|
+
...args: [sha1: string, keys: string[], args: TArgs]
|
|
945
|
+
) => new EvalshaROCommand<TArgs, TData>(args, this.opts).exec(this.client);
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* @see https://redis.io/commands/evalsha
|
|
949
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/evalsha.mdx
|
|
950
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
951
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
952
|
+
* to receive raw strings.
|
|
953
|
+
*/
|
|
954
|
+
evalsha = <TArgs extends unknown[], TData = unknown>(
|
|
955
|
+
...args: [sha1: string, keys: string[], args: TArgs]
|
|
956
|
+
) => new EvalshaCommand<TArgs, TData>(args, this.opts).exec(this.client);
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Generic method to execute any Redis command.
|
|
960
|
+
*/
|
|
961
|
+
exec = <TResult>(args: [command: string, ...args: (string | number | boolean)[]]) =>
|
|
962
|
+
new ExecCommand<TResult>(args, this.opts).exec(this.client);
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* @see https://redis.io/commands/exists
|
|
966
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/exists.mdx
|
|
967
|
+
*/
|
|
968
|
+
exists = (...args: CommandArgs<typeof ExistsCommand>) =>
|
|
969
|
+
new ExistsCommand(args, this.opts).exec(this.client);
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* @see https://redis.io/commands/expire
|
|
973
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/expire.mdx
|
|
974
|
+
*/
|
|
975
|
+
expire = (...args: CommandArgs<typeof ExpireCommand>) =>
|
|
976
|
+
new ExpireCommand(args, this.opts).exec(this.client);
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* @see https://redis.io/commands/expireat
|
|
980
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/expireat.mdx
|
|
981
|
+
*/
|
|
982
|
+
expireat = (...args: CommandArgs<typeof ExpireAtCommand>) =>
|
|
983
|
+
new ExpireAtCommand(args, this.opts).exec(this.client);
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* @see https://redis.io/commands/flushall
|
|
987
|
+
* @see node_modules/@upstash/redis/docs/commands/server/flushall.mdx
|
|
988
|
+
*/
|
|
989
|
+
flushall = (args?: CommandArgs<typeof FlushAllCommand>) =>
|
|
990
|
+
new FlushAllCommand(args, this.opts).exec(this.client);
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* @see https://redis.io/commands/flushdb
|
|
994
|
+
* @see node_modules/@upstash/redis/docs/commands/server/flushdb.mdx
|
|
995
|
+
*/
|
|
996
|
+
flushdb = (...args: CommandArgs<typeof FlushDBCommand>) =>
|
|
997
|
+
new FlushDBCommand(args, this.opts).exec(this.client);
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* @see https://redis.io/commands/geoadd
|
|
1001
|
+
*/
|
|
1002
|
+
geoadd = <TData>(...args: CommandArgs<typeof GeoAddCommand<TData>>) =>
|
|
1003
|
+
new GeoAddCommand<TData>(args, this.opts).exec(this.client);
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* @see https://redis.io/commands/geopos
|
|
1007
|
+
*/
|
|
1008
|
+
geopos = <TData>(...args: CommandArgs<typeof GeoPosCommand<TData>>) =>
|
|
1009
|
+
new GeoPosCommand<TData>(args, this.opts).exec(this.client);
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* @see https://redis.io/commands/geodist
|
|
1013
|
+
*/
|
|
1014
|
+
geodist = <TData>(...args: CommandArgs<typeof GeoDistCommand<TData>>) =>
|
|
1015
|
+
new GeoDistCommand<TData>(args, this.opts).exec(this.client);
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* @see https://redis.io/commands/geohash
|
|
1019
|
+
*/
|
|
1020
|
+
geohash = <TData>(...args: CommandArgs<typeof GeoHashCommand<TData>>) =>
|
|
1021
|
+
new GeoHashCommand<TData>(args, this.opts).exec(this.client);
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* @see https://redis.io/commands/geosearch
|
|
1025
|
+
*/
|
|
1026
|
+
geosearch = <TData>(...args: CommandArgs<typeof GeoSearchCommand<TData>>) =>
|
|
1027
|
+
new GeoSearchCommand<TData>(args, this.opts).exec(this.client);
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* @see https://redis.io/commands/geosearchstore
|
|
1031
|
+
*/
|
|
1032
|
+
geosearchstore = <TData>(...args: CommandArgs<typeof GeoSearchStoreCommand<TData>>) =>
|
|
1033
|
+
new GeoSearchStoreCommand<TData>(args, this.opts).exec(this.client);
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* @see https://redis.io/commands/get
|
|
1037
|
+
* @see node_modules/@upstash/redis/docs/commands/string/get.mdx
|
|
1038
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1039
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1040
|
+
* to receive raw strings.
|
|
1041
|
+
*/
|
|
1042
|
+
get = <TData>(...args: CommandArgs<typeof GetCommand>) =>
|
|
1043
|
+
new GetCommand<TData>(args, this.opts).exec(this.client);
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* @see https://redis.io/commands/getbit
|
|
1047
|
+
* @see node_modules/@upstash/redis/docs/commands/bitmap/getbit.mdx
|
|
1048
|
+
*/
|
|
1049
|
+
getbit = (...args: CommandArgs<typeof GetBitCommand>) =>
|
|
1050
|
+
new GetBitCommand(args, this.opts).exec(this.client);
|
|
1051
|
+
/**
|
|
1052
|
+
* @see https://redis.io/commands/getdel
|
|
1053
|
+
* @see node_modules/@upstash/redis/docs/commands/string/getdel.mdx
|
|
1054
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1055
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1056
|
+
* to receive raw strings.
|
|
1057
|
+
*/
|
|
1058
|
+
getdel = <TData>(...args: CommandArgs<typeof GetDelCommand>) =>
|
|
1059
|
+
new GetDelCommand<TData>(args, this.opts).exec(this.client);
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* @see https://redis.io/commands/getex
|
|
1063
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1064
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1065
|
+
* to receive raw strings.
|
|
1066
|
+
*/
|
|
1067
|
+
getex = <TData>(...args: CommandArgs<typeof GetExCommand>) =>
|
|
1068
|
+
new GetExCommand<TData>(args, this.opts).exec(this.client);
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* @see https://redis.io/commands/getrange
|
|
1072
|
+
* @see node_modules/@upstash/redis/docs/commands/string/getrange.mdx
|
|
1073
|
+
*/
|
|
1074
|
+
getrange = (...args: CommandArgs<typeof GetRangeCommand>) =>
|
|
1075
|
+
new GetRangeCommand(args, this.opts).exec(this.client);
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* @see https://redis.io/commands/getset
|
|
1079
|
+
* @see node_modules/@upstash/redis/docs/commands/string/getset.mdx
|
|
1080
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1081
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1082
|
+
* to receive raw strings.
|
|
1083
|
+
*/
|
|
1084
|
+
getset = <TData>(key: string, value: TData) =>
|
|
1085
|
+
new GetSetCommand<TData>([key, value], this.opts).exec(this.client);
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* @see https://redis.io/commands/hdel
|
|
1089
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hdel.mdx
|
|
1090
|
+
*/
|
|
1091
|
+
hdel = (...args: CommandArgs<typeof HDelCommand>) =>
|
|
1092
|
+
new HDelCommand(args, this.opts).exec(this.client);
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* @see https://redis.io/commands/hexists
|
|
1096
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hexists.mdx
|
|
1097
|
+
*/
|
|
1098
|
+
hexists = (...args: CommandArgs<typeof HExistsCommand>) =>
|
|
1099
|
+
new HExistsCommand(args, this.opts).exec(this.client);
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* @see https://redis.io/commands/hexpire
|
|
1103
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hexpire.mdx
|
|
1104
|
+
*/
|
|
1105
|
+
hexpire = (...args: CommandArgs<typeof HExpireCommand>) =>
|
|
1106
|
+
new HExpireCommand(args, this.opts).exec(this.client);
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* @see https://redis.io/commands/hexpireat
|
|
1110
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hexpireat.mdx
|
|
1111
|
+
*/
|
|
1112
|
+
hexpireat = (...args: CommandArgs<typeof HExpireAtCommand>) =>
|
|
1113
|
+
new HExpireAtCommand(args, this.opts).exec(this.client);
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @see https://redis.io/commands/hexpiretime
|
|
1117
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hexpiretime.mdx
|
|
1118
|
+
*/
|
|
1119
|
+
hexpiretime = (...args: CommandArgs<typeof HExpireTimeCommand>) =>
|
|
1120
|
+
new HExpireTimeCommand(args, this.opts).exec(this.client);
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* @see https://redis.io/commands/httl
|
|
1124
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/httl.mdx
|
|
1125
|
+
*/
|
|
1126
|
+
httl = (...args: CommandArgs<typeof HTtlCommand>) =>
|
|
1127
|
+
new HTtlCommand(args, this.opts).exec(this.client);
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* @see https://redis.io/commands/hpexpire
|
|
1131
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hpexpire.mdx
|
|
1132
|
+
*/
|
|
1133
|
+
hpexpire = (...args: CommandArgs<typeof HPExpireCommand>) =>
|
|
1134
|
+
new HPExpireCommand(args, this.opts).exec(this.client);
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* @see https://redis.io/commands/hpexpireat
|
|
1138
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hpexpireat.mdx
|
|
1139
|
+
*/
|
|
1140
|
+
hpexpireat = (...args: CommandArgs<typeof HPExpireAtCommand>) =>
|
|
1141
|
+
new HPExpireAtCommand(args, this.opts).exec(this.client);
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* @see https://redis.io/commands/hpexpiretime
|
|
1145
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hpexpiretime.mdx
|
|
1146
|
+
*/
|
|
1147
|
+
hpexpiretime = (...args: CommandArgs<typeof HPExpireTimeCommand>) =>
|
|
1148
|
+
new HPExpireTimeCommand(args, this.opts).exec(this.client);
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* @see https://redis.io/commands/hpttl
|
|
1152
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hpttl.mdx
|
|
1153
|
+
*/
|
|
1154
|
+
hpttl = (...args: CommandArgs<typeof HPTtlCommand>) =>
|
|
1155
|
+
new HPTtlCommand(args, this.opts).exec(this.client);
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* @see https://redis.io/commands/hpersist
|
|
1159
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hpersist.mdx
|
|
1160
|
+
*/
|
|
1161
|
+
hpersist = (...args: CommandArgs<typeof HPersistCommand>) =>
|
|
1162
|
+
new HPersistCommand(args, this.opts).exec(this.client);
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* @see https://redis.io/commands/hget
|
|
1166
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hget.mdx
|
|
1167
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1168
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1169
|
+
* to receive raw strings.
|
|
1170
|
+
*/
|
|
1171
|
+
hget = <TData>(...args: CommandArgs<typeof HGetCommand>) =>
|
|
1172
|
+
new HGetCommand<TData>(args, this.opts).exec(this.client);
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* @see https://redis.io/commands/hgetall
|
|
1176
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hgetall.mdx
|
|
1177
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1178
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1179
|
+
* to receive raw strings.
|
|
1180
|
+
* With automaticDeserialization: false, hgetall returns a flat array instead, such as
|
|
1181
|
+
* ["text", "123", "version", "1"], and [] for a missing key.
|
|
1182
|
+
*/
|
|
1183
|
+
hgetall = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof HGetAllCommand>) =>
|
|
1184
|
+
new HGetAllCommand<TData>(args, this.opts).exec(this.client);
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* @see https://redis.io/commands/hgetdel
|
|
1188
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hgetdel.mdx
|
|
1189
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1190
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1191
|
+
* to receive raw strings.
|
|
1192
|
+
* With automaticDeserialization: false, hgetdel returns an array of values in field order instead,
|
|
1193
|
+
* such as ["123", null], with null for each field when the key is missing.
|
|
1194
|
+
*/
|
|
1195
|
+
hgetdel = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof HGetDelCommand>) =>
|
|
1196
|
+
new HGetDelCommand<TData>(args, this.opts).exec(this.client);
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* @see https://redis.io/commands/hgetex
|
|
1200
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hgetex.mdx
|
|
1201
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1202
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1203
|
+
* to receive raw strings.
|
|
1204
|
+
* With automaticDeserialization: false, hgetex returns an array of values in field order instead,
|
|
1205
|
+
* such as ["123", null], with null for each field when the key is missing.
|
|
1206
|
+
*/
|
|
1207
|
+
hgetex = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof HGetExCommand>) =>
|
|
1208
|
+
new HGetExCommand<TData>(args, this.opts).exec(this.client);
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* @see https://redis.io/commands/hincrby
|
|
1212
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hincrby.mdx
|
|
1213
|
+
*/
|
|
1214
|
+
hincrby = (...args: CommandArgs<typeof HIncrByCommand>) =>
|
|
1215
|
+
new HIncrByCommand(args, this.opts).exec(this.client);
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* @see https://redis.io/commands/hincrbyfloat
|
|
1219
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hincrbyfloat.mdx
|
|
1220
|
+
*/
|
|
1221
|
+
hincrbyfloat = (...args: CommandArgs<typeof HIncrByFloatCommand>) =>
|
|
1222
|
+
new HIncrByFloatCommand(args, this.opts).exec(this.client);
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* @see https://redis.io/commands/hkeys
|
|
1226
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hkeys.mdx
|
|
1227
|
+
*/
|
|
1228
|
+
hkeys = (...args: CommandArgs<typeof HKeysCommand>) =>
|
|
1229
|
+
new HKeysCommand(args, this.opts).exec(this.client);
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* @see https://redis.io/commands/hlen
|
|
1233
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hlen.mdx
|
|
1234
|
+
*/
|
|
1235
|
+
hlen = (...args: CommandArgs<typeof HLenCommand>) =>
|
|
1236
|
+
new HLenCommand(args, this.opts).exec(this.client);
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* @see https://redis.io/commands/hmget
|
|
1240
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hmget.mdx
|
|
1241
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1242
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1243
|
+
* to receive raw strings.
|
|
1244
|
+
* With automaticDeserialization: false, hmget returns an array of values in field order instead,
|
|
1245
|
+
* such as ["123", null], with null for each field when the key is missing.
|
|
1246
|
+
*/
|
|
1247
|
+
hmget = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof HMGetCommand>) =>
|
|
1248
|
+
new HMGetCommand<TData>(args, this.opts).exec(this.client);
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* @see https://redis.io/commands/hmset
|
|
1252
|
+
*/
|
|
1253
|
+
hmset = <TData>(key: string, kv: Record<string, TData>) =>
|
|
1254
|
+
new HMSetCommand([key, kv], this.opts).exec(this.client);
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* @see https://redis.io/commands/hrandfield
|
|
1258
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hrandfield.mdx
|
|
1259
|
+
*/
|
|
1260
|
+
hrandfield: {
|
|
1261
|
+
(key: string): Promise<string | null>;
|
|
1262
|
+
(key: string, count: number): Promise<string[]>;
|
|
1263
|
+
<TData extends Record<string, unknown>>(
|
|
1264
|
+
key: string,
|
|
1265
|
+
count: number,
|
|
1266
|
+
withValues: boolean
|
|
1267
|
+
): Promise<Partial<TData>>;
|
|
1268
|
+
} = <TData extends string | string[] | Record<string, unknown>>(
|
|
1269
|
+
key: string,
|
|
1270
|
+
count?: number,
|
|
1271
|
+
withValues?: boolean
|
|
1272
|
+
) => new HRandFieldCommand<TData>([key, count, withValues] as any, this.opts).exec(this.client);
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* @see https://redis.io/commands/hscan
|
|
1276
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hscan.mdx
|
|
1277
|
+
*/
|
|
1278
|
+
hscan = (...args: CommandArgs<typeof HScanCommand>) =>
|
|
1279
|
+
new HScanCommand(args, this.opts).exec(this.client);
|
|
1280
|
+
|
|
1281
|
+
/**
|
|
1282
|
+
* @see https://redis.io/commands/hset
|
|
1283
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hset.mdx
|
|
1284
|
+
*/
|
|
1285
|
+
hset = <TData>(key: string, kv: Record<string, TData>) =>
|
|
1286
|
+
new HSetCommand<TData>([key, kv], this.opts).exec(this.client);
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* @see https://redis.io/commands/hsetex
|
|
1290
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hsetex.mdx
|
|
1291
|
+
*/
|
|
1292
|
+
hsetex = <TData>(...args: CommandArgs<typeof HSetExCommand<TData>>) =>
|
|
1293
|
+
new HSetExCommand<TData>(args as any, this.opts).exec(this.client);
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* @see https://redis.io/commands/hsetnx
|
|
1297
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hsetnx.mdx
|
|
1298
|
+
*/
|
|
1299
|
+
hsetnx = <TData>(key: string, field: string, value: TData) =>
|
|
1300
|
+
new HSetNXCommand<TData>([key, field, value], this.opts).exec(this.client);
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* @see https://redis.io/commands/hstrlen
|
|
1304
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hstrlen.mdx
|
|
1305
|
+
*/
|
|
1306
|
+
hstrlen = (...args: CommandArgs<typeof HStrLenCommand>) =>
|
|
1307
|
+
new HStrLenCommand(args, this.opts).exec(this.client);
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* @see https://redis.io/commands/hvals
|
|
1311
|
+
* @see node_modules/@upstash/redis/docs/commands/hash/hvals.mdx
|
|
1312
|
+
*/
|
|
1313
|
+
hvals = (...args: CommandArgs<typeof HValsCommand>) =>
|
|
1314
|
+
new HValsCommand(args, this.opts).exec(this.client);
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* @see https://redis.io/commands/incr
|
|
1318
|
+
* @see node_modules/@upstash/redis/docs/commands/string/incr.mdx
|
|
1319
|
+
*/
|
|
1320
|
+
incr = (...args: CommandArgs<typeof IncrCommand>) =>
|
|
1321
|
+
new IncrCommand(args, this.opts).exec(this.client);
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* @see https://redis.io/commands/incrby
|
|
1325
|
+
* @see node_modules/@upstash/redis/docs/commands/string/incrby.mdx
|
|
1326
|
+
*/
|
|
1327
|
+
incrby = (...args: CommandArgs<typeof IncrByCommand>) =>
|
|
1328
|
+
new IncrByCommand(args, this.opts).exec(this.client);
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* @see https://redis.io/commands/incrbyfloat
|
|
1332
|
+
* @see node_modules/@upstash/redis/docs/commands/string/incrbyfloat.mdx
|
|
1333
|
+
*/
|
|
1334
|
+
incrbyfloat = (...args: CommandArgs<typeof IncrByFloatCommand>) =>
|
|
1335
|
+
new IncrByFloatCommand(args, this.opts).exec(this.client);
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* @see https://redis.io/commands/keys
|
|
1339
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/keys.mdx
|
|
1340
|
+
*/
|
|
1341
|
+
keys = (...args: CommandArgs<typeof KeysCommand>) =>
|
|
1342
|
+
new KeysCommand(args, this.opts).exec(this.client);
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* @see https://redis.io/commands/lindex
|
|
1346
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lindex.mdx
|
|
1347
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1348
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1349
|
+
* to receive raw strings.
|
|
1350
|
+
*/
|
|
1351
|
+
lindex = (...args: CommandArgs<typeof LIndexCommand>) =>
|
|
1352
|
+
new LIndexCommand(args, this.opts).exec(this.client);
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* @see https://redis.io/commands/linsert
|
|
1356
|
+
* @see node_modules/@upstash/redis/docs/commands/list/linsert.mdx
|
|
1357
|
+
*/
|
|
1358
|
+
linsert = <TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) =>
|
|
1359
|
+
new LInsertCommand<TData>([key, direction, pivot, value], this.opts).exec(this.client);
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* @see https://redis.io/commands/llen
|
|
1363
|
+
* @see node_modules/@upstash/redis/docs/commands/list/llen.mdx
|
|
1364
|
+
*/
|
|
1365
|
+
llen = (...args: CommandArgs<typeof LLenCommand>) =>
|
|
1366
|
+
new LLenCommand(args, this.opts).exec(this.client);
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* @see https://redis.io/commands/lmove
|
|
1370
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lmove.mdx
|
|
1371
|
+
*/
|
|
1372
|
+
lmove = <TData = string>(...args: CommandArgs<typeof LMoveCommand>) =>
|
|
1373
|
+
new LMoveCommand<TData>(args, this.opts).exec(this.client);
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* @see https://redis.io/commands/lpop
|
|
1377
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lpop.mdx
|
|
1378
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1379
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1380
|
+
* to receive raw strings.
|
|
1381
|
+
*/
|
|
1382
|
+
lpop = <TData>(...args: CommandArgs<typeof LPopCommand>) =>
|
|
1383
|
+
new LPopCommand<TData>(args, this.opts).exec(this.client);
|
|
1384
|
+
|
|
1385
|
+
/**
|
|
1386
|
+
* @see https://redis.io/commands/lmpop
|
|
1387
|
+
*/
|
|
1388
|
+
lmpop = <TData>(...args: CommandArgs<typeof LmPopCommand>) =>
|
|
1389
|
+
new LmPopCommand<TData>(args, this.opts).exec(this.client);
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* @see https://redis.io/commands/lpos
|
|
1393
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lpos.mdx
|
|
1394
|
+
*/
|
|
1395
|
+
lpos = <TData = number>(...args: CommandArgs<typeof LPosCommand>) =>
|
|
1396
|
+
new LPosCommand<TData>(args, this.opts).exec(this.client);
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* @see https://redis.io/commands/lpush
|
|
1400
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lpush.mdx
|
|
1401
|
+
*/
|
|
1402
|
+
lpush = <TData>(key: string, ...elements: TData[]) =>
|
|
1403
|
+
new LPushCommand<TData>([key, ...elements], this.opts).exec(this.client);
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* @see https://redis.io/commands/lpushx
|
|
1407
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lpushx.mdx
|
|
1408
|
+
*/
|
|
1409
|
+
lpushx = <TData>(key: string, ...elements: TData[]) =>
|
|
1410
|
+
new LPushXCommand<TData>([key, ...elements], this.opts).exec(this.client);
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* @see https://redis.io/commands/lrange
|
|
1414
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lrange.mdx
|
|
1415
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1416
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1417
|
+
* to receive raw strings.
|
|
1418
|
+
*/
|
|
1419
|
+
lrange = <TResult = string>(...args: CommandArgs<typeof LRangeCommand>) =>
|
|
1420
|
+
new LRangeCommand<TResult>(args, this.opts).exec(this.client);
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* @see https://redis.io/commands/lrem
|
|
1424
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lrem.mdx
|
|
1425
|
+
*/
|
|
1426
|
+
lrem = <TData>(key: string, count: number, value: TData) =>
|
|
1427
|
+
new LRemCommand([key, count, value], this.opts).exec(this.client);
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* @see https://redis.io/commands/lset
|
|
1431
|
+
* @see node_modules/@upstash/redis/docs/commands/list/lset.mdx
|
|
1432
|
+
*/
|
|
1433
|
+
lset = <TData>(key: string, index: number, value: TData) =>
|
|
1434
|
+
new LSetCommand([key, index, value], this.opts).exec(this.client);
|
|
1435
|
+
|
|
1436
|
+
/**
|
|
1437
|
+
* @see https://redis.io/commands/ltrim
|
|
1438
|
+
* @see node_modules/@upstash/redis/docs/commands/list/ltrim.mdx
|
|
1439
|
+
*/
|
|
1440
|
+
ltrim = (...args: CommandArgs<typeof LTrimCommand>) =>
|
|
1441
|
+
new LTrimCommand(args, this.opts).exec(this.client);
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* @see https://redis.io/commands/mget
|
|
1445
|
+
* @see node_modules/@upstash/redis/docs/commands/string/mget.mdx
|
|
1446
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1447
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1448
|
+
* to receive raw strings.
|
|
1449
|
+
*/
|
|
1450
|
+
mget = <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) =>
|
|
1451
|
+
new MGetCommand<TData>(args, this.opts).exec(this.client);
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* @see https://redis.io/commands/mset
|
|
1455
|
+
* @see node_modules/@upstash/redis/docs/commands/string/mset.mdx
|
|
1456
|
+
*/
|
|
1457
|
+
mset = <TData>(kv: Record<string, TData>) =>
|
|
1458
|
+
new MSetCommand<TData>([kv], this.opts).exec(this.client);
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* @see https://redis.io/commands/msetnx
|
|
1462
|
+
* @see node_modules/@upstash/redis/docs/commands/string/msetnx.mdx
|
|
1463
|
+
*/
|
|
1464
|
+
msetnx = <TData>(kv: Record<string, TData>) =>
|
|
1465
|
+
new MSetNXCommand<TData>([kv], this.opts).exec(this.client);
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* @see https://redis.io/commands/persist
|
|
1469
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/persist.mdx
|
|
1470
|
+
*/
|
|
1471
|
+
persist = (...args: CommandArgs<typeof PersistCommand>) =>
|
|
1472
|
+
new PersistCommand(args, this.opts).exec(this.client);
|
|
1473
|
+
|
|
1474
|
+
/**
|
|
1475
|
+
* @see https://redis.io/commands/pexpire
|
|
1476
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/pexpire.mdx
|
|
1477
|
+
*/
|
|
1478
|
+
pexpire = (...args: CommandArgs<typeof PExpireCommand>) =>
|
|
1479
|
+
new PExpireCommand(args, this.opts).exec(this.client);
|
|
1480
|
+
|
|
1481
|
+
/**
|
|
1482
|
+
* @see https://redis.io/commands/pexpireat
|
|
1483
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/pexpireat.mdx
|
|
1484
|
+
*/
|
|
1485
|
+
pexpireat = (...args: CommandArgs<typeof PExpireAtCommand>) =>
|
|
1486
|
+
new PExpireAtCommand(args, this.opts).exec(this.client);
|
|
1487
|
+
|
|
1488
|
+
/**
|
|
1489
|
+
* @see https://redis.io/commands/pfadd
|
|
1490
|
+
*/
|
|
1491
|
+
pfadd = (...args: CommandArgs<typeof PfAddCommand>) =>
|
|
1492
|
+
new PfAddCommand(args, this.opts).exec(this.client);
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* @see https://redis.io/commands/pfcount
|
|
1496
|
+
*/
|
|
1497
|
+
pfcount = (...args: CommandArgs<typeof PfCountCommand>) =>
|
|
1498
|
+
new PfCountCommand(args, this.opts).exec(this.client);
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* @see https://redis.io/commands/pfmerge
|
|
1502
|
+
*/
|
|
1503
|
+
pfmerge = (...args: CommandArgs<typeof PfMergeCommand>) =>
|
|
1504
|
+
new PfMergeCommand(args, this.opts).exec(this.client);
|
|
1505
|
+
|
|
1506
|
+
/**
|
|
1507
|
+
* @see https://redis.io/commands/ping
|
|
1508
|
+
* @see node_modules/@upstash/redis/docs/commands/auth/ping.mdx
|
|
1509
|
+
*/
|
|
1510
|
+
ping = (args?: CommandArgs<typeof PingCommand>) =>
|
|
1511
|
+
new PingCommand(args, this.opts).exec(this.client);
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* @see https://redis.io/commands/psetex
|
|
1515
|
+
*/
|
|
1516
|
+
psetex = <TData>(key: string, ttl: number, value: TData) =>
|
|
1517
|
+
new PSetEXCommand<TData>([key, ttl, value], this.opts).exec(this.client);
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* @see https://redis.io/commands/psubscribe
|
|
1521
|
+
* @see node_modules/@upstash/redis/docs/commands/pubsub/psubscribe.mdx
|
|
1522
|
+
* Messages are JSON-parsed automatically: a published "123" arrives as the number 123. Unlike
|
|
1523
|
+
* subscribe, a message that is not valid JSON (such as "hello") never reaches the listener and
|
|
1524
|
+
* emits an "error" event instead. Pass automaticDeserialization: false to the Redis constructor
|
|
1525
|
+
* to receive raw strings.
|
|
1526
|
+
*/
|
|
1527
|
+
psubscribe = <TMessage>(patterns: string | string[]): Subscriber<TMessage> => {
|
|
1528
|
+
const patternArray = Array.isArray(patterns) ? patterns : [patterns];
|
|
1529
|
+
return new Subscriber<TMessage>(this.client, patternArray, true, this.opts);
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* @see https://redis.io/commands/pttl
|
|
1534
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/pttl.mdx
|
|
1535
|
+
*/
|
|
1536
|
+
pttl = (...args: CommandArgs<typeof PTtlCommand>) =>
|
|
1537
|
+
new PTtlCommand(args, this.opts).exec(this.client);
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* @see https://redis.io/commands/publish
|
|
1541
|
+
* @see node_modules/@upstash/redis/docs/commands/pubsub/publish.mdx
|
|
1542
|
+
*/
|
|
1543
|
+
publish = (...args: CommandArgs<typeof PublishCommand>) =>
|
|
1544
|
+
new PublishCommand(args, this.opts).exec(this.client);
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* @see https://redis.io/commands/randomkey
|
|
1548
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/randomkey.mdx
|
|
1549
|
+
*/
|
|
1550
|
+
randomkey = () => new RandomKeyCommand().exec(this.client);
|
|
1551
|
+
|
|
1552
|
+
/**
|
|
1553
|
+
* @see https://redis.io/commands/rename
|
|
1554
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/rename.mdx
|
|
1555
|
+
*/
|
|
1556
|
+
rename = (...args: CommandArgs<typeof RenameCommand>) =>
|
|
1557
|
+
new RenameCommand(args, this.opts).exec(this.client);
|
|
1558
|
+
|
|
1559
|
+
/**
|
|
1560
|
+
* @see https://redis.io/commands/renamenx
|
|
1561
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/renamenx.mdx
|
|
1562
|
+
*/
|
|
1563
|
+
renamenx = (...args: CommandArgs<typeof RenameNXCommand>) =>
|
|
1564
|
+
new RenameNXCommand(args, this.opts).exec(this.client);
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* @see https://redis.io/commands/rpop
|
|
1568
|
+
* @see node_modules/@upstash/redis/docs/commands/list/rpop.mdx
|
|
1569
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1570
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1571
|
+
* to receive raw strings.
|
|
1572
|
+
*/
|
|
1573
|
+
rpop = <TData = string>(...args: CommandArgs<typeof RPopCommand>) =>
|
|
1574
|
+
new RPopCommand<TData>(args, this.opts).exec(this.client);
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* @see https://redis.io/commands/rpush
|
|
1578
|
+
* @see node_modules/@upstash/redis/docs/commands/list/rpush.mdx
|
|
1579
|
+
*/
|
|
1580
|
+
rpush = <TData>(key: string, ...elements: TData[]) =>
|
|
1581
|
+
new RPushCommand([key, ...elements], this.opts).exec(this.client);
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* @see https://redis.io/commands/rpushx
|
|
1585
|
+
* @see node_modules/@upstash/redis/docs/commands/list/rpushx.mdx
|
|
1586
|
+
*/
|
|
1587
|
+
rpushx = <TData>(key: string, ...elements: TData[]) =>
|
|
1588
|
+
new RPushXCommand([key, ...elements], this.opts).exec(this.client);
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* @see https://redis.io/commands/sadd
|
|
1592
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sadd.mdx
|
|
1593
|
+
*/
|
|
1594
|
+
sadd = <TData>(key: string, member: TData, ...members: TData[]) =>
|
|
1595
|
+
new SAddCommand<TData>([key, member, ...members], this.opts).exec(this.client);
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* @see https://redis.io/commands/scan
|
|
1599
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/scan.mdx
|
|
1600
|
+
*/
|
|
1601
|
+
scan(cursor: string | number): Promise<ScanResultStandard>;
|
|
1602
|
+
scan<TOptions extends ScanCommandOptions>(
|
|
1603
|
+
cursor: string | number,
|
|
1604
|
+
opts: TOptions
|
|
1605
|
+
): Promise<TOptions extends { withType: true } ? ScanResultWithType : ScanResultStandard>;
|
|
1606
|
+
scan<TOptions extends ScanCommandOptions>(
|
|
1607
|
+
cursor: string | number,
|
|
1608
|
+
opts?: TOptions
|
|
1609
|
+
): Promise<TOptions extends { withType: true } ? ScanResultWithType : ScanResultStandard> {
|
|
1610
|
+
return new ScanCommand([cursor, opts], this.opts).exec(this.client);
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* @see https://redis.io/commands/scard
|
|
1615
|
+
* @see node_modules/@upstash/redis/docs/commands/set/scard.mdx
|
|
1616
|
+
*/
|
|
1617
|
+
scard = (...args: CommandArgs<typeof SCardCommand>) =>
|
|
1618
|
+
new SCardCommand(args, this.opts).exec(this.client);
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* @see https://redis.io/commands/script-exists
|
|
1622
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/script_exists.mdx
|
|
1623
|
+
*/
|
|
1624
|
+
scriptExists = (...args: CommandArgs<typeof ScriptExistsCommand>) =>
|
|
1625
|
+
new ScriptExistsCommand(args, this.opts).exec(this.client);
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* @see https://redis.io/commands/script-flush
|
|
1629
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/script_flush.mdx
|
|
1630
|
+
*/
|
|
1631
|
+
scriptFlush = (...args: CommandArgs<typeof ScriptFlushCommand>) =>
|
|
1632
|
+
new ScriptFlushCommand(args, this.opts).exec(this.client);
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* @see https://redis.io/commands/script-load
|
|
1636
|
+
* @see node_modules/@upstash/redis/docs/commands/scripts/script_load.mdx
|
|
1637
|
+
*/
|
|
1638
|
+
scriptLoad = (...args: CommandArgs<typeof ScriptLoadCommand>) =>
|
|
1639
|
+
new ScriptLoadCommand(args, this.opts).exec(this.client);
|
|
1640
|
+
/**
|
|
1641
|
+
* @see https://redis.io/commands/sdiff
|
|
1642
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sdiff.mdx
|
|
1643
|
+
*/
|
|
1644
|
+
sdiff = (...args: CommandArgs<typeof SDiffCommand>) =>
|
|
1645
|
+
new SDiffCommand(args, this.opts).exec(this.client);
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* @see https://redis.io/commands/sdiffstore
|
|
1649
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sdiffstore.mdx
|
|
1650
|
+
*/
|
|
1651
|
+
sdiffstore = (...args: CommandArgs<typeof SDiffStoreCommand>) =>
|
|
1652
|
+
new SDiffStoreCommand(args, this.opts).exec(this.client);
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* @see https://redis.io/commands/set
|
|
1656
|
+
* @see node_modules/@upstash/redis/docs/commands/string/set.mdx
|
|
1657
|
+
*/
|
|
1658
|
+
set = <TData>(key: string, value: TData, opts?: SetCommandOptions) =>
|
|
1659
|
+
new SetCommand<TData>([key, value, opts], this.opts).exec(this.client);
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* @see https://redis.io/commands/setbit
|
|
1663
|
+
* @see node_modules/@upstash/redis/docs/commands/bitmap/setbit.mdx
|
|
1664
|
+
*/
|
|
1665
|
+
setbit = (...args: CommandArgs<typeof SetBitCommand>) =>
|
|
1666
|
+
new SetBitCommand(args, this.opts).exec(this.client);
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* @see https://redis.io/commands/setex
|
|
1670
|
+
*/
|
|
1671
|
+
setex = <TData>(key: string, ttl: number, value: TData) =>
|
|
1672
|
+
new SetExCommand<TData>([key, ttl, value], this.opts).exec(this.client);
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* @see https://redis.io/commands/setnx
|
|
1676
|
+
*/
|
|
1677
|
+
setnx = <TData>(key: string, value: TData) =>
|
|
1678
|
+
new SetNxCommand<TData>([key, value], this.opts).exec(this.client);
|
|
1679
|
+
|
|
1680
|
+
/**
|
|
1681
|
+
* @see https://redis.io/commands/setrange
|
|
1682
|
+
* @see node_modules/@upstash/redis/docs/commands/string/setrange.mdx
|
|
1683
|
+
*/
|
|
1684
|
+
setrange = (...args: CommandArgs<typeof SetRangeCommand>) =>
|
|
1685
|
+
new SetRangeCommand(args, this.opts).exec(this.client);
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* @see https://redis.io/commands/sinter
|
|
1689
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sinter.mdx
|
|
1690
|
+
*/
|
|
1691
|
+
sinter = (...args: CommandArgs<typeof SInterCommand>) =>
|
|
1692
|
+
new SInterCommand(args, this.opts).exec(this.client);
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* @see https://redis.io/commands/sintercard
|
|
1696
|
+
*/
|
|
1697
|
+
sintercard = (...args: CommandArgs<typeof SInterCardCommand>) =>
|
|
1698
|
+
new SInterCardCommand(args, this.opts).exec(this.client);
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* @see https://redis.io/commands/sinterstore
|
|
1702
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sinterstore.mdx
|
|
1703
|
+
*/
|
|
1704
|
+
sinterstore = (...args: CommandArgs<typeof SInterStoreCommand>) =>
|
|
1705
|
+
new SInterStoreCommand(args, this.opts).exec(this.client);
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* @see https://redis.io/commands/sismember
|
|
1709
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sismember.mdx
|
|
1710
|
+
*/
|
|
1711
|
+
sismember = <TData>(key: string, member: TData) =>
|
|
1712
|
+
new SIsMemberCommand<TData>([key, member], this.opts).exec(this.client);
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* @see https://redis.io/commands/smismember
|
|
1716
|
+
* @see node_modules/@upstash/redis/docs/commands/set/smismember.mdx
|
|
1717
|
+
*/
|
|
1718
|
+
smismember = <TMembers extends unknown[]>(key: string, members: TMembers) =>
|
|
1719
|
+
new SMIsMemberCommand<TMembers>([key, members], this.opts).exec(this.client);
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* @see https://redis.io/commands/smembers
|
|
1723
|
+
* @see node_modules/@upstash/redis/docs/commands/set/smembers.mdx
|
|
1724
|
+
*/
|
|
1725
|
+
smembers = <TData extends unknown[] = string[]>(...args: CommandArgs<typeof SMembersCommand>) =>
|
|
1726
|
+
new SMembersCommand<TData>(args, this.opts).exec(this.client);
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* @see https://redis.io/commands/smove
|
|
1730
|
+
* @see node_modules/@upstash/redis/docs/commands/set/smove.mdx
|
|
1731
|
+
*/
|
|
1732
|
+
smove = <TData>(source: string, destination: string, member: TData) =>
|
|
1733
|
+
new SMoveCommand<TData>([source, destination, member], this.opts).exec(this.client);
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* @see https://redis.io/commands/spop
|
|
1737
|
+
* @see node_modules/@upstash/redis/docs/commands/set/spop.mdx
|
|
1738
|
+
*/
|
|
1739
|
+
spop = <TData>(...args: CommandArgs<typeof SPopCommand>) =>
|
|
1740
|
+
new SPopCommand<TData>(args, this.opts).exec(this.client);
|
|
1741
|
+
|
|
1742
|
+
/**
|
|
1743
|
+
* @see https://redis.io/commands/srandmember
|
|
1744
|
+
* @see node_modules/@upstash/redis/docs/commands/set/srandmember.mdx
|
|
1745
|
+
*/
|
|
1746
|
+
srandmember = <TData>(...args: CommandArgs<typeof SRandMemberCommand>) =>
|
|
1747
|
+
new SRandMemberCommand<TData>(args, this.opts).exec(this.client);
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* @see https://redis.io/commands/srem
|
|
1751
|
+
* @see node_modules/@upstash/redis/docs/commands/set/srem.mdx
|
|
1752
|
+
*/
|
|
1753
|
+
srem = <TData>(key: string, ...members: TData[]) =>
|
|
1754
|
+
new SRemCommand<TData>([key, ...members], this.opts).exec(this.client);
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* @see https://redis.io/commands/sscan
|
|
1758
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sscan.mdx
|
|
1759
|
+
*/
|
|
1760
|
+
sscan = (...args: CommandArgs<typeof SScanCommand>) =>
|
|
1761
|
+
new SScanCommand(args, this.opts).exec(this.client);
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* @see https://redis.io/commands/strlen
|
|
1765
|
+
* @see node_modules/@upstash/redis/docs/commands/string/strlen.mdx
|
|
1766
|
+
*/
|
|
1767
|
+
strlen = (...args: CommandArgs<typeof StrLenCommand>) =>
|
|
1768
|
+
new StrLenCommand(args, this.opts).exec(this.client);
|
|
1769
|
+
|
|
1770
|
+
/**
|
|
1771
|
+
* @see https://redis.io/commands/subscribe
|
|
1772
|
+
* @see node_modules/@upstash/redis/docs/commands/pubsub/subscribe.mdx
|
|
1773
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1774
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1775
|
+
* to receive raw strings.
|
|
1776
|
+
*/
|
|
1777
|
+
subscribe = <TMessage>(channels: string | string[]): Subscriber<TMessage> => {
|
|
1778
|
+
const channelArray = Array.isArray(channels) ? channels : [channels];
|
|
1779
|
+
return new Subscriber<TMessage>(this.client, channelArray, false, this.opts);
|
|
1780
|
+
};
|
|
1781
|
+
/**
|
|
1782
|
+
* @see https://redis.io/commands/sunion
|
|
1783
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sunion.mdx
|
|
1784
|
+
*/
|
|
1785
|
+
sunion = (...args: CommandArgs<typeof SUnionCommand>) =>
|
|
1786
|
+
new SUnionCommand(args, this.opts).exec(this.client);
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* @see https://redis.io/commands/sunionstore
|
|
1790
|
+
* @see node_modules/@upstash/redis/docs/commands/set/sunionstore.mdx
|
|
1791
|
+
*/
|
|
1792
|
+
sunionstore = (...args: CommandArgs<typeof SUnionStoreCommand>) =>
|
|
1793
|
+
new SUnionStoreCommand(args, this.opts).exec(this.client);
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* @see https://redis.io/commands/time
|
|
1797
|
+
*/
|
|
1798
|
+
time = () => new TimeCommand().exec(this.client);
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* @see https://redis.io/commands/touch
|
|
1802
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/touch.mdx
|
|
1803
|
+
*/
|
|
1804
|
+
touch = (...args: CommandArgs<typeof TouchCommand>) =>
|
|
1805
|
+
new TouchCommand(args, this.opts).exec(this.client);
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* @see https://redis.io/commands/ttl
|
|
1809
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/ttl.mdx
|
|
1810
|
+
*/
|
|
1811
|
+
ttl = (...args: CommandArgs<typeof TtlCommand>) =>
|
|
1812
|
+
new TtlCommand(args, this.opts).exec(this.client);
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* @see https://redis.io/commands/type
|
|
1816
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/type.mdx
|
|
1817
|
+
*/
|
|
1818
|
+
type = (...args: CommandArgs<typeof TypeCommand>) =>
|
|
1819
|
+
new TypeCommand(args, this.opts).exec(this.client);
|
|
1820
|
+
|
|
1821
|
+
/**
|
|
1822
|
+
* @see https://redis.io/commands/unlink
|
|
1823
|
+
* @see node_modules/@upstash/redis/docs/commands/generic/unlink.mdx
|
|
1824
|
+
*/
|
|
1825
|
+
unlink = (...args: CommandArgs<typeof UnlinkCommand>) =>
|
|
1826
|
+
new UnlinkCommand(args, this.opts).exec(this.client);
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* @see https://redis.io/commands/xadd
|
|
1830
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xadd.mdx
|
|
1831
|
+
*/
|
|
1832
|
+
xadd = (...args: CommandArgs<typeof XAddCommand>) =>
|
|
1833
|
+
new XAddCommand(args, this.opts).exec(this.client);
|
|
1834
|
+
|
|
1835
|
+
/**
|
|
1836
|
+
* @see https://redis.io/commands/xack
|
|
1837
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xack.mdx
|
|
1838
|
+
*/
|
|
1839
|
+
xack = (...args: CommandArgs<typeof XAckCommand>) =>
|
|
1840
|
+
new XAckCommand(args, this.opts).exec(this.client);
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* @see https://redis.io/commands/xackdel
|
|
1844
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xackdel.mdx
|
|
1845
|
+
*/
|
|
1846
|
+
xackdel = (...args: CommandArgs<typeof XAckDelCommand>) =>
|
|
1847
|
+
new XAckDelCommand(args, this.opts).exec(this.client);
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* @see https://redis.io/commands/xdel
|
|
1851
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xdel.mdx
|
|
1852
|
+
*/
|
|
1853
|
+
xdel = (...args: CommandArgs<typeof XDelCommand>) =>
|
|
1854
|
+
new XDelCommand(args, this.opts).exec(this.client);
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* @see https://redis.io/commands/xdelex
|
|
1858
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xdelex.mdx
|
|
1859
|
+
*/
|
|
1860
|
+
xdelex = (...args: CommandArgs<typeof XDelExCommand>) =>
|
|
1861
|
+
new XDelExCommand(args, this.opts).exec(this.client);
|
|
1862
|
+
|
|
1863
|
+
/**
|
|
1864
|
+
* @see https://redis.io/commands/xgroup
|
|
1865
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xgroup.mdx
|
|
1866
|
+
*/
|
|
1867
|
+
xgroup = (...args: CommandArgs<typeof XGroupCommand>) =>
|
|
1868
|
+
new XGroupCommand(args, this.opts).exec(this.client);
|
|
1869
|
+
|
|
1870
|
+
/**
|
|
1871
|
+
* @see https://redis.io/commands/xread
|
|
1872
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xread.mdx
|
|
1873
|
+
*/
|
|
1874
|
+
xread = (...args: CommandArgs<typeof XReadCommand>) =>
|
|
1875
|
+
new XReadCommand(args, this.opts).exec(this.client);
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* @see https://redis.io/commands/xreadgroup
|
|
1879
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xreadgroup.mdx
|
|
1880
|
+
*/
|
|
1881
|
+
xreadgroup = (...args: CommandArgs<typeof XReadGroupCommand>) =>
|
|
1882
|
+
new XReadGroupCommand(args, this.opts).exec(this.client);
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* @see https://redis.io/commands/xinfo
|
|
1886
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xinfo.mdx
|
|
1887
|
+
*/
|
|
1888
|
+
xinfo = (...args: CommandArgs<typeof XInfoCommand>) =>
|
|
1889
|
+
new XInfoCommand(args, this.opts).exec(this.client);
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* @see https://redis.io/commands/xlen
|
|
1893
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xlen.mdx
|
|
1894
|
+
*/
|
|
1895
|
+
xlen = (...args: CommandArgs<typeof XLenCommand>) =>
|
|
1896
|
+
new XLenCommand(args, this.opts).exec(this.client);
|
|
1897
|
+
|
|
1898
|
+
/**
|
|
1899
|
+
* @see https://redis.io/commands/xpending
|
|
1900
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xpending.mdx
|
|
1901
|
+
*/
|
|
1902
|
+
xpending = (...args: CommandArgs<typeof XPendingCommand>) =>
|
|
1903
|
+
new XPendingCommand(args, this.opts).exec(this.client);
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* @see https://redis.io/commands/xclaim
|
|
1907
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xclaim.mdx
|
|
1908
|
+
*/
|
|
1909
|
+
xclaim = (...args: CommandArgs<typeof XClaimCommand>) =>
|
|
1910
|
+
new XClaimCommand(args, this.opts).exec(this.client);
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* @see https://redis.io/commands/xautoclaim
|
|
1914
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xautoclaim.mdx
|
|
1915
|
+
*/
|
|
1916
|
+
xautoclaim = (...args: CommandArgs<typeof XAutoClaim>) =>
|
|
1917
|
+
new XAutoClaim(args, this.opts).exec(this.client);
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* @see https://redis.io/commands/xtrim
|
|
1921
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xtrim.mdx
|
|
1922
|
+
*/
|
|
1923
|
+
xtrim = (...args: CommandArgs<typeof XTrimCommand>) =>
|
|
1924
|
+
new XTrimCommand(args, this.opts).exec(this.client);
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* @see https://redis.io/commands/xrange
|
|
1928
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xrange.mdx
|
|
1929
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1930
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1931
|
+
* to receive raw strings.
|
|
1932
|
+
* With automaticDeserialization: false, xrange returns [id, [field, value, ...]] entries instead,
|
|
1933
|
+
* such as [["1790341484470-0", ["text", "123"]]], and [] for a missing key.
|
|
1934
|
+
*/
|
|
1935
|
+
xrange = <TData extends Record<string, unknown>>(...args: CommandArgs<typeof XRangeCommand>) =>
|
|
1936
|
+
new XRangeCommand<Record<string, TData>>(args, this.opts).exec(this.client);
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* @see https://redis.io/commands/xrevrange
|
|
1940
|
+
* @see node_modules/@upstash/redis/docs/commands/stream/xrevrange.mdx
|
|
1941
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
1942
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
1943
|
+
* to receive raw strings.
|
|
1944
|
+
* With automaticDeserialization: false, xrevrange returns [id, [field, value, ...]] entries instead,
|
|
1945
|
+
* such as [["1790341484470-0", ["text", "123"]]], and [] for a missing key.
|
|
1946
|
+
*/
|
|
1947
|
+
xrevrange = <TData extends Record<string, unknown>>(
|
|
1948
|
+
...args: CommandArgs<typeof XRevRangeCommand>
|
|
1949
|
+
) => new XRevRangeCommand<Record<string, TData>>(args, this.opts).exec(this.client);
|
|
1950
|
+
|
|
1951
|
+
/**
|
|
1952
|
+
* @see https://redis.io/commands/zadd
|
|
1953
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zadd.mdx
|
|
1954
|
+
*/
|
|
1955
|
+
zadd = <TData>(
|
|
1956
|
+
...args:
|
|
1957
|
+
| [key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]]
|
|
1958
|
+
| [
|
|
1959
|
+
key: string,
|
|
1960
|
+
opts: ZAddCommandOptions,
|
|
1961
|
+
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]],
|
|
1962
|
+
]
|
|
1963
|
+
) => {
|
|
1964
|
+
if ("score" in args[1]) {
|
|
1965
|
+
return new ZAddCommand<TData>([args[0], args[1], ...(args.slice(2) as any)], this.opts).exec(
|
|
1966
|
+
this.client
|
|
1967
|
+
);
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
return new ZAddCommand<TData>(
|
|
1971
|
+
[args[0], args[1] as any, ...(args.slice(2) as any)],
|
|
1972
|
+
this.opts
|
|
1973
|
+
).exec(this.client);
|
|
1974
|
+
};
|
|
1975
|
+
/**
|
|
1976
|
+
* @see https://redis.io/commands/zcard
|
|
1977
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zcard.mdx
|
|
1978
|
+
*/
|
|
1979
|
+
zcard = (...args: CommandArgs<typeof ZCardCommand>) =>
|
|
1980
|
+
new ZCardCommand(args, this.opts).exec(this.client);
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* @see https://redis.io/commands/zcount
|
|
1984
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zcount.mdx
|
|
1985
|
+
*/
|
|
1986
|
+
zcount = (...args: CommandArgs<typeof ZCountCommand>) =>
|
|
1987
|
+
new ZCountCommand(args, this.opts).exec(this.client);
|
|
1988
|
+
|
|
1989
|
+
/**
|
|
1990
|
+
* @see https://redis.io/commands/zdiffstore
|
|
1991
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zdiffstore.mdx
|
|
1992
|
+
*/
|
|
1993
|
+
zdiffstore = (...args: CommandArgs<typeof ZDiffStoreCommand>) =>
|
|
1994
|
+
new ZDiffStoreCommand(args, this.opts).exec(this.client);
|
|
1995
|
+
|
|
1996
|
+
/**
|
|
1997
|
+
* @see https://redis.io/commands/zincrby
|
|
1998
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zincrby.mdx
|
|
1999
|
+
*/
|
|
2000
|
+
zincrby = <TData>(key: string, increment: number, member: TData) =>
|
|
2001
|
+
new ZIncrByCommand<TData>([key, increment, member], this.opts).exec(this.client);
|
|
2002
|
+
|
|
2003
|
+
/**
|
|
2004
|
+
* @see https://redis.io/commands/zinterstore
|
|
2005
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zinterstore.mdx
|
|
2006
|
+
*/
|
|
2007
|
+
zinterstore = (...args: CommandArgs<typeof ZInterStoreCommand>) =>
|
|
2008
|
+
new ZInterStoreCommand(args, this.opts).exec(this.client);
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* @see https://redis.io/commands/zlexcount
|
|
2012
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zlexcount.mdx
|
|
2013
|
+
*/
|
|
2014
|
+
zlexcount = (...args: CommandArgs<typeof ZLexCountCommand>) =>
|
|
2015
|
+
new ZLexCountCommand(args, this.opts).exec(this.client);
|
|
2016
|
+
|
|
2017
|
+
/**
|
|
2018
|
+
* @see https://redis.io/commands/zmscore
|
|
2019
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zmscore.mdx
|
|
2020
|
+
*/
|
|
2021
|
+
zmscore = (...args: CommandArgs<typeof ZMScoreCommand>) =>
|
|
2022
|
+
new ZMScoreCommand(args, this.opts).exec(this.client);
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* @see https://redis.io/commands/zpopmax
|
|
2026
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zpopmax.mdx
|
|
2027
|
+
*/
|
|
2028
|
+
zpopmax = <TData>(...args: CommandArgs<typeof ZPopMaxCommand>) =>
|
|
2029
|
+
new ZPopMaxCommand<TData>(args, this.opts).exec(this.client);
|
|
2030
|
+
|
|
2031
|
+
/**
|
|
2032
|
+
* @see https://redis.io/commands/zpopmin
|
|
2033
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zpopmin.mdx
|
|
2034
|
+
*/
|
|
2035
|
+
zpopmin = <TData>(...args: CommandArgs<typeof ZPopMinCommand>) =>
|
|
2036
|
+
new ZPopMinCommand<TData>(args, this.opts).exec(this.client);
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
* @see https://redis.io/commands/zrange
|
|
2040
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zrange.mdx
|
|
2041
|
+
* Responses are JSON-parsed automatically: a stored "123" comes back as the number 123, "true" as
|
|
2042
|
+
* true, and '{"a":1}' as an object. Pass automaticDeserialization: false to the Redis constructor
|
|
2043
|
+
* to receive raw strings.
|
|
2044
|
+
*/
|
|
2045
|
+
zrange = <TData extends unknown[]>(
|
|
2046
|
+
...args:
|
|
2047
|
+
| [key: string, min: number, max: number, opts?: ZRangeCommandOptions]
|
|
2048
|
+
| [
|
|
2049
|
+
key: string,
|
|
2050
|
+
min: `(${string}` | `[${string}` | "-" | "+",
|
|
2051
|
+
max: `(${string}` | `[${string}` | "-" | "+",
|
|
2052
|
+
opts: { byLex: true } & ZRangeCommandOptions,
|
|
2053
|
+
]
|
|
2054
|
+
| [
|
|
2055
|
+
key: string,
|
|
2056
|
+
min: number | `(${number}` | "-inf" | "+inf",
|
|
2057
|
+
max: number | `(${number}` | "-inf" | "+inf",
|
|
2058
|
+
opts: { byScore: true } & ZRangeCommandOptions,
|
|
2059
|
+
]
|
|
2060
|
+
) => new ZRangeCommand<TData>(args as any, this.opts).exec(this.client);
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* @see https://redis.io/commands/zrank
|
|
2064
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zrank.mdx
|
|
2065
|
+
*/
|
|
2066
|
+
zrank = <TData>(key: string, member: TData) =>
|
|
2067
|
+
new ZRankCommand<TData>([key, member], this.opts).exec(this.client);
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* @see https://redis.io/commands/zrem
|
|
2071
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zrem.mdx
|
|
2072
|
+
*/
|
|
2073
|
+
zrem = <TData>(key: string, ...members: TData[]) =>
|
|
2074
|
+
new ZRemCommand<TData>([key, ...members], this.opts).exec(this.client);
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* @see https://redis.io/commands/zremrangebylex
|
|
2078
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zremrangebylex.mdx
|
|
2079
|
+
*/
|
|
2080
|
+
zremrangebylex = (...args: CommandArgs<typeof ZRemRangeByLexCommand>) =>
|
|
2081
|
+
new ZRemRangeByLexCommand(args, this.opts).exec(this.client);
|
|
2082
|
+
|
|
2083
|
+
/**
|
|
2084
|
+
* @see https://redis.io/commands/zremrangebyrank
|
|
2085
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zremrangebyrank.mdx
|
|
2086
|
+
*/
|
|
2087
|
+
zremrangebyrank = (...args: CommandArgs<typeof ZRemRangeByRankCommand>) =>
|
|
2088
|
+
new ZRemRangeByRankCommand(args, this.opts).exec(this.client);
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* @see https://redis.io/commands/zremrangebyscore
|
|
2092
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zremrangebyscore.mdx
|
|
2093
|
+
*/
|
|
2094
|
+
zremrangebyscore = (...args: CommandArgs<typeof ZRemRangeByScoreCommand>) =>
|
|
2095
|
+
new ZRemRangeByScoreCommand(args, this.opts).exec(this.client);
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* @see https://redis.io/commands/zrevrank
|
|
2099
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zrevrank.mdx
|
|
2100
|
+
*/
|
|
2101
|
+
zrevrank = <TData>(key: string, member: TData) =>
|
|
2102
|
+
new ZRevRankCommand<TData>([key, member], this.opts).exec(this.client);
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* @see https://redis.io/commands/zscan
|
|
2106
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zscan.mdx
|
|
2107
|
+
*/
|
|
2108
|
+
zscan = (...args: CommandArgs<typeof ZScanCommand>) =>
|
|
2109
|
+
new ZScanCommand(args, this.opts).exec(this.client);
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* @see https://redis.io/commands/zscore
|
|
2113
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zscore.mdx
|
|
2114
|
+
*/
|
|
2115
|
+
zscore = <TData>(key: string, member: TData) =>
|
|
2116
|
+
new ZScoreCommand<TData>([key, member], this.opts).exec(this.client);
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* @see https://redis.io/commands/zunion
|
|
2120
|
+
*/
|
|
2121
|
+
zunion = (...args: CommandArgs<typeof ZUnionCommand>) =>
|
|
2122
|
+
new ZUnionCommand(args, this.opts).exec(this.client);
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* @see https://redis.io/commands/zunionstore
|
|
2126
|
+
* @see node_modules/@upstash/redis/docs/commands/zset/zunionstore.mdx
|
|
2127
|
+
*/
|
|
2128
|
+
zunionstore = (...args: CommandArgs<typeof ZUnionStoreCommand>) =>
|
|
2129
|
+
new ZUnionStoreCommand(args, this.opts).exec(this.client);
|
|
2130
|
+
}
|