├── .deepsource.toml ├── .github ├── ISSUE_TEMPLATE │ ├── BUG-REPORT.yml │ ├── DOCUMENTATION.yml │ └── FEATURE-REQUEST.yml ├── PULL_REQUEST_TEMPLATE.md ├── release-drafter │ ├── bloom-config.yml │ ├── graph-config.yml │ ├── json-config.yml │ ├── search-config.yml │ └── time-series-config.yml └── workflows │ ├── codeql.yml │ ├── documentation.yml │ ├── release-drafter-bloom.yml │ ├── release-drafter-graph.yml │ ├── release-drafter-json.yml │ ├── release-drafter-search.yml │ ├── release-drafter-time-series.yml │ └── tests.yml ├── .gitignore ├── .npmignore ├── .release-it.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── benchmark ├── .gitignore ├── lib │ ├── defaults.yml │ ├── index.js │ ├── ping │ │ ├── ioredis.js │ │ ├── ping.yml │ │ ├── v3.js │ │ └── v4.js │ ├── runner.js │ └── set-get-delete-string │ │ ├── 1KB.yml │ │ ├── 1MB.yml │ │ ├── 8B.yml │ │ ├── index.js │ │ ├── ioredis.js │ │ ├── v3.js │ │ └── v4.js ├── package-lock.json ├── package.json └── requirements.txt ├── docs ├── FAQ.md ├── client-configuration.md ├── clustering.md ├── isolated-execution.md ├── pub-sub.md └── v3-to-v4.md ├── examples ├── .gitignore ├── README.md ├── blocking-list-pop.js ├── bloom-filter.js ├── check-connection-status.js ├── command-with-modifiers.js ├── connect-as-acl-user.js ├── connect-to-cluster.js ├── count-min-sketch.js ├── cuckoo-filter.js ├── dump-and-restore.js ├── get-server-time.js ├── hyperloglog.js ├── lua-multi-incr.js ├── managing-json.js ├── package.json ├── pubsub-publisher.js ├── pubsub-subscriber.js ├── search-hashes.js ├── search-json.js ├── search-knn.js ├── set-scan.js ├── sorted-set.js ├── stream-consumer-group.js ├── stream-consumer.js ├── stream-producer.js ├── time-series.js ├── topk.js ├── transaction-with-arbitrary-commands.js └── transaction-with-watch.js ├── index.ts ├── package-lock.json ├── package.json ├── packages ├── bloom │ ├── .npmignore │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── lib │ │ ├── commands │ │ │ ├── bloom │ │ │ │ ├── ADD.spec.ts │ │ │ │ ├── ADD.ts │ │ │ │ ├── CARD.spec.ts │ │ │ │ ├── CARD.ts │ │ │ │ ├── EXISTS.spec.ts │ │ │ │ ├── EXISTS.ts │ │ │ │ ├── INFO.spec.ts │ │ │ │ ├── INFO.ts │ │ │ │ ├── INSERT.spec.ts │ │ │ │ ├── INSERT.ts │ │ │ │ ├── LOADCHUNK.spec.ts │ │ │ │ ├── LOADCHUNK.ts │ │ │ │ ├── MADD.spec.ts │ │ │ │ ├── MADD.ts │ │ │ │ ├── MEXISTS.spec.ts │ │ │ │ ├── MEXISTS.ts │ │ │ │ ├── RESERVE.spec.ts │ │ │ │ ├── RESERVE.ts │ │ │ │ ├── SCANDUMP.spec.ts │ │ │ │ ├── SCANDUMP.ts │ │ │ │ └── index.ts │ │ │ ├── count-min-sketch │ │ │ │ ├── INCRBY.spec.ts │ │ │ │ ├── INCRBY.ts │ │ │ │ ├── INFO.spec.ts │ │ │ │ ├── INFO.ts │ │ │ │ ├── INITBYDIM.spec.ts │ │ │ │ ├── INITBYDIM.ts │ │ │ │ ├── INITBYPROB.spec.ts │ │ │ │ ├── INITBYPROB.ts │ │ │ │ ├── MERGE.spec.ts │ │ │ │ ├── MERGE.ts │ │ │ │ ├── QUERY.spec.ts │ │ │ │ ├── QUERY.ts │ │ │ │ └── index.ts │ │ │ ├── cuckoo │ │ │ │ ├── ADD.spec.ts │ │ │ │ ├── ADD.ts │ │ │ │ ├── ADDNX.spec.ts │ │ │ │ ├── ADDNX.ts │ │ │ │ ├── COUNT.spec.ts │ │ │ │ ├── COUNT.ts │ │ │ │ ├── DEL.spec.ts │ │ │ │ ├── DEL.ts │ │ │ │ ├── EXISTS.spec.ts │ │ │ │ ├── EXISTS.ts │ │ │ │ ├── INFO.spec.ts │ │ │ │ ├── INFO.ts │ │ │ │ ├── INSERT.spec.ts │ │ │ │ ├── INSERT.ts │ │ │ │ ├── INSERTNX.spec.ts │ │ │ │ ├── INSERTNX.ts │ │ │ │ ├── LOADCHUNK.spec.ts │ │ │ │ ├── LOADCHUNK.ts │ │ │ │ ├── RESERVE.spec.ts │ │ │ │ ├── RESERVE.ts │ │ │ │ ├── SCANDUMP.spec.ts │ │ │ │ ├── SCANDUMP.ts │ │ │ │ ├── index.spec.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── t-digest │ │ │ │ ├── ADD.spec.ts │ │ │ │ ├── ADD.ts │ │ │ │ ├── BYRANK.spec.ts │ │ │ │ ├── BYRANK.ts │ │ │ │ ├── BYREVRANK.spec.ts │ │ │ │ ├── BYREVRANK.ts │ │ │ │ ├── CDF.spec.ts │ │ │ │ ├── CDF.ts │ │ │ │ ├── CREATE.spec.ts │ │ │ │ ├── CREATE.ts │ │ │ │ ├── INFO.spec.ts │ │ │ │ ├── INFO.ts │ │ │ │ ├── MAX.spec.ts │ │ │ │ ├── MAX.ts │ │ │ │ ├── MERGE.spec.ts │ │ │ │ ├── MERGE.ts │ │ │ │ ├── MIN.spec.ts │ │ │ │ ├── MIN.ts │ │ │ │ ├── QUANTILE.spec.ts │ │ │ │ ├── QUANTILE.ts │ │ │ │ ├── RANK.spec.ts │ │ │ │ ├── RANK.ts │ │ │ │ ├── RESET.spec.ts │ │ │ │ ├── RESET.ts │ │ │ │ ├── REVRANK.spec.ts │ │ │ │ ├── REVRANK.ts │ │ │ │ ├── TRIMMED_MEAN.spec.ts │ │ │ │ ├── TRIMMED_MEAN.ts │ │ │ │ ├── index.spec.ts │ │ │ │ └── index.ts │ │ │ └── top-k │ │ │ │ ├── ADD.spec.ts │ │ │ │ ├── ADD.ts │ │ │ │ ├── COUNT.spec.ts │ │ │ │ ├── COUNT.ts │ │ │ │ ├── INCRBY.spec.ts │ │ │ │ ├── INCRBY.ts │ │ │ │ ├── INFO.spec.ts │ │ │ │ ├── INFO.ts │ │ │ │ ├── LIST.spec.ts │ │ │ │ ├── LIST.ts │ │ │ │ ├── LIST_WITHCOUNT.spec.ts │ │ │ │ ├── LIST_WITHCOUNT.ts │ │ │ │ ├── QUERY.spec.ts │ │ │ │ ├── QUERY.ts │ │ │ │ ├── RESERVE.spec.ts │ │ │ │ ├── RESERVE.ts │ │ │ │ └── index.ts │ │ ├── index.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── client │ ├── .eslintrc.json │ ├── .npmignore │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── index.ts │ ├── lib │ │ ├── client │ │ │ ├── RESP2 │ │ │ │ ├── composers │ │ │ │ │ ├── buffer.spec.ts │ │ │ │ │ ├── buffer.ts │ │ │ │ │ ├── interface.ts │ │ │ │ │ ├── string.spec.ts │ │ │ │ │ └── string.ts │ │ │ │ ├── decoder.spec.ts │ │ │ │ ├── decoder.ts │ │ │ │ ├── encoder.spec.ts │ │ │ │ └── encoder.ts │ │ │ ├── commands-queue.ts │ │ │ ├── commands.ts │ │ │ ├── index.spec.ts │ │ │ ├── index.ts │ │ │ ├── multi-command.ts │ │ │ ├── pub-sub.spec.ts │ │ │ ├── pub-sub.ts │ │ │ ├── socket.spec.ts │ │ │ └── socket.ts │ │ ├── cluster │ │ │ ├── cluster-slots.ts │ │ │ ├── commands.ts │ │ │ ├── index.spec.ts │ │ │ ├── index.ts │ │ │ └── multi-command.ts │ │ ├── command-options.ts │ │ ├── commander.ts │ │ ├── commands │ │ │ ├── ACL_CAT.spec.ts │ │ │ ├── ACL_CAT.ts │ │ │ ├── ACL_DELUSER.spec.ts │ │ │ ├── ACL_DELUSER.ts │ │ │ ├── ACL_DRYRUN.spec.ts │ │ │ ├── ACL_DRYRUN.ts │ │ │ ├── ACL_GENPASS.spec.ts │ │ │ ├── ACL_GENPASS.ts │ │ │ ├── ACL_GETUSER.spec.ts │ │ │ ├── ACL_GETUSER.ts │ │ │ ├── ACL_LIST.spec.ts │ │ │ ├── ACL_LIST.ts │ │ │ ├── ACL_LOAD.spec.ts │ │ │ ├── ACL_LOAD.ts │ │ │ ├── ACL_LOG.spec.ts │ │ │ ├── ACL_LOG.ts │ │ │ ├── ACL_LOG_RESET.spec.ts │ │ │ ├── ACL_LOG_RESET.ts │ │ │ ├── ACL_SAVE.spec.ts │ │ │ ├── ACL_SAVE.ts │ │ │ ├── ACL_SETUSER.spec.ts │ │ │ ├── ACL_SETUSER.ts │ │ │ ├── ACL_USERS.spec.ts │ │ │ ├── ACL_USERS.ts │ │ │ ├── ACL_WHOAMI.spec.ts │ │ │ ├── ACL_WHOAMI.ts │ │ │ ├── APPEND.spec.ts │ │ │ ├── APPEND.ts │ │ │ ├── ASKING.spec.ts │ │ │ ├── ASKING.ts │ │ │ ├── AUTH.spec.ts │ │ │ ├── AUTH.ts │ │ │ ├── BGREWRITEAOF.spec.ts │ │ │ ├── BGREWRITEAOF.ts │ │ │ ├── BGSAVE.spec.ts │ │ │ ├── BGSAVE.ts │ │ │ ├── BITCOUNT.spec.ts │ │ │ ├── BITCOUNT.ts │ │ │ ├── BITFIELD.spec.ts │ │ │ ├── BITFIELD.ts │ │ │ ├── BITFIELD_RO.spec.ts │ │ │ ├── BITFIELD_RO.ts │ │ │ ├── BITOP.spec.ts │ │ │ ├── BITOP.ts │ │ │ ├── BITPOS.spec.ts │ │ │ ├── BITPOS.ts │ │ │ ├── BLMOVE.spec.ts │ │ │ ├── BLMOVE.ts │ │ │ ├── BLMPOP.spec.ts │ │ │ ├── BLMPOP.ts │ │ │ ├── BLPOP.spec.ts │ │ │ ├── BLPOP.ts │ │ │ ├── BRPOP.spec.ts │ │ │ ├── BRPOP.ts │ │ │ ├── BRPOPLPUSH.spec.ts │ │ │ ├── BRPOPLPUSH.ts │ │ │ ├── BZMPOP.spec.ts │ │ │ ├── BZMPOP.ts │ │ │ ├── BZPOPMAX.spec.ts │ │ │ ├── BZPOPMAX.ts │ │ │ ├── BZPOPMIN.spec.ts │ │ │ ├── BZPOPMIN.ts │ │ │ ├── CLIENT_CACHING.spec.ts │ │ │ ├── CLIENT_CACHING.ts │ │ │ ├── CLIENT_GETNAME.spec.ts │ │ │ ├── CLIENT_GETNAME.ts │ │ │ ├── CLIENT_GETREDIR.spec.ts │ │ │ ├── CLIENT_GETREDIR.ts │ │ │ ├── CLIENT_ID.spec.ts │ │ │ ├── CLIENT_ID.ts │ │ │ ├── CLIENT_INFO.spec.ts │ │ │ ├── CLIENT_INFO.ts │ │ │ ├── CLIENT_KILL.spec.ts │ │ │ ├── CLIENT_KILL.ts │ │ │ ├── CLIENT_LIST.spec.ts │ │ │ ├── CLIENT_LIST.ts │ │ │ ├── CLIENT_NO-EVICT.spec.ts │ │ │ ├── CLIENT_NO-EVICT.ts │ │ │ ├── CLIENT_NO-TOUCH.spec.ts │ │ │ ├── CLIENT_NO-TOUCH.ts │ │ │ ├── CLIENT_PAUSE.spec.ts │ │ │ ├── CLIENT_PAUSE.ts │ │ │ ├── CLIENT_SETNAME.spec.ts │ │ │ ├── CLIENT_SETNAME.ts │ │ │ ├── CLIENT_TRACKING.spec.ts │ │ │ ├── CLIENT_TRACKING.ts │ │ │ ├── CLIENT_TRACKINGINFO.spec.ts │ │ │ ├── CLIENT_TRACKINGINFO.ts │ │ │ ├── CLIENT_UNPAUSE.spec.ts │ │ │ ├── CLIENT_UNPAUSE.ts │ │ │ ├── CLUSTER_ADDSLOTS.spec.ts │ │ │ ├── CLUSTER_ADDSLOTS.ts │ │ │ ├── CLUSTER_ADDSLOTSRANGE.spec.ts │ │ │ ├── CLUSTER_ADDSLOTSRANGE.ts │ │ │ ├── CLUSTER_BUMPEPOCH.spec.ts │ │ │ ├── CLUSTER_BUMPEPOCH.ts │ │ │ ├── CLUSTER_COUNT-FAILURE-REPORTS.spec.ts │ │ │ ├── CLUSTER_COUNT-FAILURE-REPORTS.ts │ │ │ ├── CLUSTER_COUNTKEYSINSLOT.spec.ts │ │ │ ├── CLUSTER_COUNTKEYSINSLOT.ts │ │ │ ├── CLUSTER_DELSLOTS.spec.ts │ │ │ ├── CLUSTER_DELSLOTS.ts │ │ │ ├── CLUSTER_DELSLOTSRANGE.spec.ts │ │ │ ├── CLUSTER_DELSLOTSRANGE.ts │ │ │ ├── CLUSTER_FAILOVER.spec.ts │ │ │ ├── CLUSTER_FAILOVER.ts │ │ │ ├── CLUSTER_FLUSHSLOTS.spec.ts │ │ │ ├── CLUSTER_FLUSHSLOTS.ts │ │ │ ├── CLUSTER_FORGET.spec.ts │ │ │ ├── CLUSTER_FORGET.ts │ │ │ ├── CLUSTER_GETKEYSINSLOT.spec.ts │ │ │ ├── CLUSTER_GETKEYSINSLOT.ts │ │ │ ├── CLUSTER_INFO.spec.ts │ │ │ ├── CLUSTER_INFO.ts │ │ │ ├── CLUSTER_KEYSLOT.spec.ts │ │ │ ├── CLUSTER_KEYSLOT.ts │ │ │ ├── CLUSTER_LINKS.spec.ts │ │ │ ├── CLUSTER_LINKS.ts │ │ │ ├── CLUSTER_MEET.spec.ts │ │ │ ├── CLUSTER_MEET.ts │ │ │ ├── CLUSTER_MYID.spec.ts │ │ │ ├── CLUSTER_MYID.ts │ │ │ ├── CLUSTER_MYSHARDID.spec.ts │ │ │ ├── CLUSTER_MYSHARDID.ts │ │ │ ├── CLUSTER_NODES.spec.ts │ │ │ ├── CLUSTER_NODES.ts │ │ │ ├── CLUSTER_REPLICAS.spec.ts │ │ │ ├── CLUSTER_REPLICAS.ts │ │ │ ├── CLUSTER_REPLICATE.spec.ts │ │ │ ├── CLUSTER_REPLICATE.ts │ │ │ ├── CLUSTER_RESET.spec.ts │ │ │ ├── CLUSTER_RESET.ts │ │ │ ├── CLUSTER_SAVECONFIG.spec.ts │ │ │ ├── CLUSTER_SAVECONFIG.ts │ │ │ ├── CLUSTER_SET-CONFIG-EPOCH.spec.ts │ │ │ ├── CLUSTER_SET-CONFIG-EPOCH.ts │ │ │ ├── CLUSTER_SETSLOT.spec.ts │ │ │ ├── CLUSTER_SETSLOT.ts │ │ │ ├── CLUSTER_SLOTS.spec.ts │ │ │ ├── CLUSTER_SLOTS.ts │ │ │ ├── COMMAND.spec.ts │ │ │ ├── COMMAND.ts │ │ │ ├── COMMAND_COUNT.spec.ts │ │ │ ├── COMMAND_COUNT.ts │ │ │ ├── COMMAND_GETKEYS.spec.ts │ │ │ ├── COMMAND_GETKEYS.ts │ │ │ ├── COMMAND_GETKEYSANDFLAGS.spec.ts │ │ │ ├── COMMAND_GETKEYSANDFLAGS.ts │ │ │ ├── COMMAND_INFO.spec.ts │ │ │ ├── COMMAND_INFO.ts │ │ │ ├── COMMAND_LIST.spec.ts │ │ │ ├── COMMAND_LIST.ts │ │ │ ├── CONFIG_GET.spec.ts │ │ │ ├── CONFIG_GET.ts │ │ │ ├── CONFIG_RESETSTAT.spec.ts │ │ │ ├── CONFIG_RESETSTAT.ts │ │ │ ├── CONFIG_REWRITE.spec.ts │ │ │ ├── CONFIG_REWRITE.ts │ │ │ ├── CONFIG_SET.spec.ts │ │ │ ├── CONFIG_SET.ts │ │ │ ├── COPY.spec.ts │ │ │ ├── COPY.ts │ │ │ ├── DBSIZE.spec.ts │ │ │ ├── DBSIZE.ts │ │ │ ├── DECR.spec.ts │ │ │ ├── DECR.ts │ │ │ ├── DECRBY.spec.ts │ │ │ ├── DECRBY.ts │ │ │ ├── DEL.spec.ts │ │ │ ├── DEL.ts │ │ │ ├── DISCARD.spec.ts │ │ │ ├── DISCARD.ts │ │ │ ├── DUMP.spec.ts │ │ │ ├── DUMP.ts │ │ │ ├── ECHO.spec.ts │ │ │ ├── ECHO.ts │ │ │ ├── EVAL.spec.ts │ │ │ ├── EVAL.ts │ │ │ ├── EVALSHA.spec.ts │ │ │ ├── EVALSHA.ts │ │ │ ├── EVALSHA_RO.spec.ts │ │ │ ├── EVALSHA_RO.ts │ │ │ ├── EVAL_RO.spec.ts │ │ │ ├── EVAL_RO.ts │ │ │ ├── EXISTS.spec.ts │ │ │ ├── EXISTS.ts │ │ │ ├── EXPIRE.spec.ts │ │ │ ├── EXPIRE.ts │ │ │ ├── EXPIREAT.spec.ts │ │ │ ├── EXPIREAT.ts │ │ │ ├── EXPIRETIME.spec.ts │ │ │ ├── EXPIRETIME.ts │ │ │ ├── FAILOVER.spec.ts │ │ │ ├── FAILOVER.ts │ │ │ ├── FCALL.spec.ts │ │ │ ├── FCALL.ts │ │ │ ├── FCALL_RO.spec.ts │ │ │ ├── FCALL_RO.ts │ │ │ ├── FLUSHALL.spec.ts │ │ │ ├── FLUSHALL.ts │ │ │ ├── FLUSHDB.spec.ts │ │ │ ├── FLUSHDB.ts │ │ │ ├── FUNCTION_DELETE.spec.ts │ │ │ ├── FUNCTION_DELETE.ts │ │ │ ├── FUNCTION_DUMP.spec.ts │ │ │ ├── FUNCTION_DUMP.ts │ │ │ ├── FUNCTION_FLUSH.spec.ts │ │ │ ├── FUNCTION_FLUSH.ts │ │ │ ├── FUNCTION_KILL.spec.ts │ │ │ ├── FUNCTION_KILL.ts │ │ │ ├── FUNCTION_LIST.spec.ts │ │ │ ├── FUNCTION_LIST.ts │ │ │ ├── FUNCTION_LIST_WITHCODE.spec.ts │ │ │ ├── FUNCTION_LIST_WITHCODE.ts │ │ │ ├── FUNCTION_LOAD.spec.ts │ │ │ ├── FUNCTION_LOAD.ts │ │ │ ├── FUNCTION_RESTORE.spec.ts │ │ │ ├── FUNCTION_RESTORE.ts │ │ │ ├── FUNCTION_STATS.spec.ts │ │ │ ├── FUNCTION_STATS.ts │ │ │ ├── GEOADD.spec.ts │ │ │ ├── GEOADD.ts │ │ │ ├── GEODIST.spec.ts │ │ │ ├── GEODIST.ts │ │ │ ├── GEOHASH.spec.ts │ │ │ ├── GEOHASH.ts │ │ │ ├── GEOPOS.spec.ts │ │ │ ├── GEOPOS.ts │ │ │ ├── GEORADIUS.spec.ts │ │ │ ├── GEORADIUS.ts │ │ │ ├── GEORADIUSBYMEMBER.spec.ts │ │ │ ├── GEORADIUSBYMEMBER.ts │ │ │ ├── GEORADIUSBYMEMBERSTORE.spec.ts │ │ │ ├── GEORADIUSBYMEMBERSTORE.ts │ │ │ ├── GEORADIUSBYMEMBER_RO.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_RO.ts │ │ │ ├── GEORADIUSBYMEMBER_RO_WITH.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_RO_WITH.ts │ │ │ ├── GEORADIUSBYMEMBER_WITH.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_WITH.ts │ │ │ ├── GEORADIUSSTORE.spec.ts │ │ │ ├── GEORADIUSSTORE.ts │ │ │ ├── GEORADIUS_RO.spec.ts │ │ │ ├── GEORADIUS_RO.ts │ │ │ ├── GEORADIUS_RO_WITH.spec.ts │ │ │ ├── GEORADIUS_RO_WITH.ts │ │ │ ├── GEORADIUS_WITH.spec.ts │ │ │ ├── GEORADIUS_WITH.ts │ │ │ ├── GEOSEARCH.spec.ts │ │ │ ├── GEOSEARCH.ts │ │ │ ├── GEOSEARCHSTORE.spec.ts │ │ │ ├── GEOSEARCHSTORE.ts │ │ │ ├── GEOSEARCH_WITH.spec.ts │ │ │ ├── GEOSEARCH_WITH.ts │ │ │ ├── GET.spec.ts │ │ │ ├── GET.ts │ │ │ ├── GETBIT.spec.ts │ │ │ ├── GETBIT.ts │ │ │ ├── GETDEL.spec.ts │ │ │ ├── GETDEL.ts │ │ │ ├── GETEX.spec.ts │ │ │ ├── GETEX.ts │ │ │ ├── GETRANGE.spec.ts │ │ │ ├── GETRANGE.ts │ │ │ ├── GETSET.spec.ts │ │ │ ├── GETSET.ts │ │ │ ├── HDEL.spec.ts │ │ │ ├── HDEL.ts │ │ │ ├── HELLO.spec.ts │ │ │ ├── HELLO.ts │ │ │ ├── HEXISTS.spec.ts │ │ │ ├── HEXISTS.ts │ │ │ ├── HGET.spec.ts │ │ │ ├── HGET.ts │ │ │ ├── HGETALL.spec.ts │ │ │ ├── HGETALL.ts │ │ │ ├── HINCRBY.spec.ts │ │ │ ├── HINCRBY.ts │ │ │ ├── HINCRBYFLOAT.spec.ts │ │ │ ├── HINCRBYFLOAT.ts │ │ │ ├── HKEYS.spec.ts │ │ │ ├── HKEYS.ts │ │ │ ├── HLEN.spec.ts │ │ │ ├── HLEN.ts │ │ │ ├── HMGET.spec.ts │ │ │ ├── HMGET.ts │ │ │ ├── HRANDFIELD.spec.ts │ │ │ ├── HRANDFIELD.ts │ │ │ ├── HRANDFIELD_COUNT.spec.ts │ │ │ ├── HRANDFIELD_COUNT.ts │ │ │ ├── HRANDFIELD_COUNT_WITHVALUES.spec.ts │ │ │ ├── HRANDFIELD_COUNT_WITHVALUES.ts │ │ │ ├── HSCAN.spec.ts │ │ │ ├── HSCAN.ts │ │ │ ├── HSET.spec.ts │ │ │ ├── HSET.ts │ │ │ ├── HSETNX.spec.ts │ │ │ ├── HSETNX.ts │ │ │ ├── HSTRLEN.spec.ts │ │ │ ├── HSTRLEN.ts │ │ │ ├── HVALS.spec.ts │ │ │ ├── HVALS.ts │ │ │ ├── INCR.spec.ts │ │ │ ├── INCR.ts │ │ │ ├── INCRBY.spec.ts │ │ │ ├── INCRBY.ts │ │ │ ├── INCRBYFLOAT.spec.ts │ │ │ ├── INCRBYFLOAT.ts │ │ │ ├── INFO.spec.ts │ │ │ ├── INFO.ts │ │ │ ├── KEYS.spec.ts │ │ │ ├── KEYS.ts │ │ │ ├── LASTSAVE.spec.ts │ │ │ ├── LASTSAVE.ts │ │ │ ├── LATENCY_DOCTOR.spec.ts │ │ │ ├── LATENCY_DOCTOR.ts │ │ │ ├── LATENCY_GRAPH.spec.ts │ │ │ ├── LATENCY_GRAPH.ts │ │ │ ├── LATENCY_HISTORY.spec.ts │ │ │ ├── LATENCY_HISTORY.ts │ │ │ ├── LATENCY_LATEST.spec.ts │ │ │ ├── LATENCY_LATEST.ts │ │ │ ├── LCS.spec.ts │ │ │ ├── LCS.ts │ │ │ ├── LCS_IDX.spec.ts │ │ │ ├── LCS_IDX.ts │ │ │ ├── LCS_IDX_WITHMATCHLEN.spec.ts │ │ │ ├── LCS_IDX_WITHMATCHLEN.ts │ │ │ ├── LCS_LEN.spec.ts │ │ │ ├── LCS_LEN.ts │ │ │ ├── LINDEX.spec.ts │ │ │ ├── LINDEX.ts │ │ │ ├── LINSERT.spec.ts │ │ │ ├── LINSERT.ts │ │ │ ├── LLEN.spec.ts │ │ │ ├── LLEN.ts │ │ │ ├── LMOVE.spec.ts │ │ │ ├── LMOVE.ts │ │ │ ├── LMPOP.spec.ts │ │ │ ├── LMPOP.ts │ │ │ ├── LOLWUT.spec.ts │ │ │ ├── LOLWUT.ts │ │ │ ├── LPOP.spec.ts │ │ │ ├── LPOP.ts │ │ │ ├── LPOP_COUNT.spec.ts │ │ │ ├── LPOP_COUNT.ts │ │ │ ├── LPOS.spec.ts │ │ │ ├── LPOS.ts │ │ │ ├── LPOS_COUNT.spec.ts │ │ │ ├── LPOS_COUNT.ts │ │ │ ├── LPUSH.spec.ts │ │ │ ├── LPUSH.ts │ │ │ ├── LPUSHX.spec.ts │ │ │ ├── LPUSHX.ts │ │ │ ├── LRANGE.spec.ts │ │ │ ├── LRANGE.ts │ │ │ ├── LREM.spec.ts │ │ │ ├── LREM.ts │ │ │ ├── LSET.spec.ts │ │ │ ├── LSET.ts │ │ │ ├── LTRIM.spec.ts │ │ │ ├── LTRIM.ts │ │ │ ├── MEMORY_DOCTOR.spec.ts │ │ │ ├── MEMORY_DOCTOR.ts │ │ │ ├── MEMORY_MALLOC-STATS.spec.ts │ │ │ ├── MEMORY_MALLOC-STATS.ts │ │ │ ├── MEMORY_PURGE.spec.ts │ │ │ ├── MEMORY_PURGE.ts │ │ │ ├── MEMORY_STATS.spec.ts │ │ │ ├── MEMORY_STATS.ts │ │ │ ├── MEMORY_USAGE.spec.ts │ │ │ ├── MEMORY_USAGE.ts │ │ │ ├── MGET.spec.ts │ │ │ ├── MGET.ts │ │ │ ├── MIGRATE.spec.ts │ │ │ ├── MIGRATE.ts │ │ │ ├── MODULE_LIST.spec.ts │ │ │ ├── MODULE_LIST.ts │ │ │ ├── MODULE_LOAD.spec.ts │ │ │ ├── MODULE_LOAD.ts │ │ │ ├── MODULE_UNLOAD.spec.ts │ │ │ ├── MODULE_UNLOAD.ts │ │ │ ├── MOVE.spec.ts │ │ │ ├── MOVE.ts │ │ │ ├── MSET.spec.ts │ │ │ ├── MSET.ts │ │ │ ├── MSETNX.spec.ts │ │ │ ├── MSETNX.ts │ │ │ ├── OBJECT_ENCODING.spec.ts │ │ │ ├── OBJECT_ENCODING.ts │ │ │ ├── OBJECT_FREQ.spec.ts │ │ │ ├── OBJECT_FREQ.ts │ │ │ ├── OBJECT_IDLETIME.spec.ts │ │ │ ├── OBJECT_IDLETIME.ts │ │ │ ├── OBJECT_REFCOUNT.spec.ts │ │ │ ├── OBJECT_REFCOUNT.ts │ │ │ ├── PERSIST.spec.ts │ │ │ ├── PERSIST.ts │ │ │ ├── PEXPIRE.spec.ts │ │ │ ├── PEXPIRE.ts │ │ │ ├── PEXPIREAT.spec.ts │ │ │ ├── PEXPIREAT.ts │ │ │ ├── PEXPIRETIME.spec.ts │ │ │ ├── PEXPIRETIME.ts │ │ │ ├── PFADD.spec.ts │ │ │ ├── PFADD.ts │ │ │ ├── PFCOUNT.spec.ts │ │ │ ├── PFCOUNT.ts │ │ │ ├── PFMERGE.spec.ts │ │ │ ├── PFMERGE.ts │ │ │ ├── PING.spec.ts │ │ │ ├── PING.ts │ │ │ ├── PSETEX.spec.ts │ │ │ ├── PSETEX.ts │ │ │ ├── PTTL.spec.ts │ │ │ ├── PTTL.ts │ │ │ ├── PUBLISH.spec.ts │ │ │ ├── PUBLISH.ts │ │ │ ├── PUBSUB_CHANNELS.spec.ts │ │ │ ├── PUBSUB_CHANNELS.ts │ │ │ ├── PUBSUB_NUMPAT.spec.ts │ │ │ ├── PUBSUB_NUMPAT.ts │ │ │ ├── PUBSUB_NUMSUB.spec.ts │ │ │ ├── PUBSUB_NUMSUB.ts │ │ │ ├── PUBSUB_SHARDCHANNELS.spec.ts │ │ │ ├── PUBSUB_SHARDCHANNELS.ts │ │ │ ├── PUBSUB_SHARDNUMSUB.spec.ts │ │ │ ├── PUBSUB_SHARDNUMSUB.ts │ │ │ ├── RANDOMKEY.spec.ts │ │ │ ├── RANDOMKEY.ts │ │ │ ├── READONLY.spec.ts │ │ │ ├── READONLY.ts │ │ │ ├── READWRITE.spec.ts │ │ │ ├── READWRITE.ts │ │ │ ├── RENAME.spec.ts │ │ │ ├── RENAME.ts │ │ │ ├── RENAMENX.spec.ts │ │ │ ├── RENAMENX.ts │ │ │ ├── REPLICAOF.spec.ts │ │ │ ├── REPLICAOF.ts │ │ │ ├── RESTORE-ASKING.spec.ts │ │ │ ├── RESTORE-ASKING.ts │ │ │ ├── RESTORE.spec.ts │ │ │ ├── RESTORE.ts │ │ │ ├── ROLE.spec.ts │ │ │ ├── ROLE.ts │ │ │ ├── RPOP.spec.ts │ │ │ ├── RPOP.ts │ │ │ ├── RPOPLPUSH.spec.ts │ │ │ ├── RPOPLPUSH.ts │ │ │ ├── RPOP_COUNT.spec.ts │ │ │ ├── RPOP_COUNT.ts │ │ │ ├── RPUSH.spec.ts │ │ │ ├── RPUSH.ts │ │ │ ├── RPUSHX.spec.ts │ │ │ ├── RPUSHX.ts │ │ │ ├── SADD.spec.ts │ │ │ ├── SADD.ts │ │ │ ├── SAVE.spec.ts │ │ │ ├── SAVE.ts │ │ │ ├── SCAN.spec.ts │ │ │ ├── SCAN.ts │ │ │ ├── SCARD.spec.ts │ │ │ ├── SCARD.ts │ │ │ ├── SCRIPT_DEBUG.spec.ts │ │ │ ├── SCRIPT_DEBUG.ts │ │ │ ├── SCRIPT_EXISTS.spec.ts │ │ │ ├── SCRIPT_EXISTS.ts │ │ │ ├── SCRIPT_FLUSH.spec.ts │ │ │ ├── SCRIPT_FLUSH.ts │ │ │ ├── SCRIPT_KILL.spec.ts │ │ │ ├── SCRIPT_KILL.ts │ │ │ ├── SCRIPT_LOAD.spec.ts │ │ │ ├── SCRIPT_LOAD.ts │ │ │ ├── SDIFF.spec.ts │ │ │ ├── SDIFF.ts │ │ │ ├── SDIFFSTORE.spec.ts │ │ │ ├── SDIFFSTORE.ts │ │ │ ├── SET.spec.ts │ │ │ ├── SET.ts │ │ │ ├── SETBIT.spec.ts │ │ │ ├── SETBIT.ts │ │ │ ├── SETEX.spec.ts │ │ │ ├── SETEX.ts │ │ │ ├── SETNX .spec.ts │ │ │ ├── SETNX.ts │ │ │ ├── SETRANGE.spec.ts │ │ │ ├── SETRANGE.ts │ │ │ ├── SHUTDOWN.spec.ts │ │ │ ├── SHUTDOWN.ts │ │ │ ├── SINTER.spec.ts │ │ │ ├── SINTER.ts │ │ │ ├── SINTERCARD.spec.ts │ │ │ ├── SINTERCARD.ts │ │ │ ├── SINTERSTORE.spec.ts │ │ │ ├── SINTERSTORE.ts │ │ │ ├── SISMEMBER.spec.ts │ │ │ ├── SISMEMBER.ts │ │ │ ├── SMEMBERS.spec.ts │ │ │ ├── SMEMBERS.ts │ │ │ ├── SMISMEMBER.spec.ts │ │ │ ├── SMISMEMBER.ts │ │ │ ├── SMOVE.spec.ts │ │ │ ├── SMOVE.ts │ │ │ ├── SORT.spec.ts │ │ │ ├── SORT.ts │ │ │ ├── SORT_RO.spec.ts │ │ │ ├── SORT_RO.ts │ │ │ ├── SORT_STORE.spec.ts │ │ │ ├── SORT_STORE.ts │ │ │ ├── SPOP.spec.ts │ │ │ ├── SPOP.ts │ │ │ ├── SPUBLISH.spec.ts │ │ │ ├── SPUBLISH.ts │ │ │ ├── SRANDMEMBER.spec.ts │ │ │ ├── SRANDMEMBER.ts │ │ │ ├── SRANDMEMBER_COUNT.spec.ts │ │ │ ├── SRANDMEMBER_COUNT.ts │ │ │ ├── SREM.spec.ts │ │ │ ├── SREM.ts │ │ │ ├── SSCAN.spec.ts │ │ │ ├── SSCAN.ts │ │ │ ├── STRLEN.spec.ts │ │ │ ├── STRLEN.ts │ │ │ ├── SUNION.spec.ts │ │ │ ├── SUNION.ts │ │ │ ├── SUNIONSTORE.spec.ts │ │ │ ├── SUNIONSTORE.ts │ │ │ ├── SWAPDB.spec.ts │ │ │ ├── SWAPDB.ts │ │ │ ├── TIME.spec.ts │ │ │ ├── TIME.ts │ │ │ ├── TOUCH.spec.ts │ │ │ ├── TOUCH.ts │ │ │ ├── TTL.spec.ts │ │ │ ├── TTL.ts │ │ │ ├── TYPE.spec.ts │ │ │ ├── TYPE.ts │ │ │ ├── UNLINK.spec.ts │ │ │ ├── UNLINK.ts │ │ │ ├── UNWATCH.spec.ts │ │ │ ├── UNWATCH.ts │ │ │ ├── WAIT.spec.ts │ │ │ ├── WAIT.ts │ │ │ ├── WATCH.spec.ts │ │ │ ├── WATCH.ts │ │ │ ├── XACK.spec.ts │ │ │ ├── XACK.ts │ │ │ ├── XADD.spec.ts │ │ │ ├── XADD.ts │ │ │ ├── XAUTOCLAIM.spec.ts │ │ │ ├── XAUTOCLAIM.ts │ │ │ ├── XAUTOCLAIM_JUSTID.spec.ts │ │ │ ├── XAUTOCLAIM_JUSTID.ts │ │ │ ├── XCLAIM.spec.ts │ │ │ ├── XCLAIM.ts │ │ │ ├── XCLAIM_JUSTID.spec.ts │ │ │ ├── XCLAIM_JUSTID.ts │ │ │ ├── XDEL.spec.ts │ │ │ ├── XDEL.ts │ │ │ ├── XGROUP_CREATE.spec.ts │ │ │ ├── XGROUP_CREATE.ts │ │ │ ├── XGROUP_CREATECONSUMER.spec.ts │ │ │ ├── XGROUP_CREATECONSUMER.ts │ │ │ ├── XGROUP_DELCONSUMER.spec.ts │ │ │ ├── XGROUP_DELCONSUMER.ts │ │ │ ├── XGROUP_DESTROY.spec.ts │ │ │ ├── XGROUP_DESTROY.ts │ │ │ ├── XGROUP_SETID.spec.ts │ │ │ ├── XGROUP_SETID.ts │ │ │ ├── XINFO_CONSUMERS.spec.ts │ │ │ ├── XINFO_CONSUMERS.ts │ │ │ ├── XINFO_GROUPS.spec.ts │ │ │ ├── XINFO_GROUPS.ts │ │ │ ├── XINFO_STREAM.spec.ts │ │ │ ├── XINFO_STREAM.ts │ │ │ ├── XLEN.spec.ts │ │ │ ├── XLEN.ts │ │ │ ├── XPENDING.spec.ts │ │ │ ├── XPENDING.ts │ │ │ ├── XPENDING_RANGE.spec.ts │ │ │ ├── XPENDING_RANGE.ts │ │ │ ├── XRANGE.spec.ts │ │ │ ├── XRANGE.ts │ │ │ ├── XREAD.spec.ts │ │ │ ├── XREAD.ts │ │ │ ├── XREADGROUP.spec.ts │ │ │ ├── XREADGROUP.ts │ │ │ ├── XREVRANGE.spec.ts │ │ │ ├── XREVRANGE.ts │ │ │ ├── XSETID.spec.ts │ │ │ ├── XSETID.ts │ │ │ ├── XTRIM.spec.ts │ │ │ ├── XTRIM.ts │ │ │ ├── ZADD.spec.ts │ │ │ ├── ZADD.ts │ │ │ ├── ZCARD.spec.ts │ │ │ ├── ZCARD.ts │ │ │ ├── ZCOUNT.spec.ts │ │ │ ├── ZCOUNT.ts │ │ │ ├── ZDIFF.spec.ts │ │ │ ├── ZDIFF.ts │ │ │ ├── ZDIFFSTORE.spec.ts │ │ │ ├── ZDIFFSTORE.ts │ │ │ ├── ZDIFF_WITHSCORES.spec.ts │ │ │ ├── ZDIFF_WITHSCORES.ts │ │ │ ├── ZINCRBY.spec.ts │ │ │ ├── ZINCRBY.ts │ │ │ ├── ZINTER.spec.ts │ │ │ ├── ZINTER.ts │ │ │ ├── ZINTERCARD.spec.ts │ │ │ ├── ZINTERCARD.ts │ │ │ ├── ZINTERSTORE.spec.ts │ │ │ ├── ZINTERSTORE.ts │ │ │ ├── ZINTER_WITHSCORES.spec.ts │ │ │ ├── ZINTER_WITHSCORES.ts │ │ │ ├── ZLEXCOUNT.spec.ts │ │ │ ├── ZLEXCOUNT.ts │ │ │ ├── ZMPOP.spec.ts │ │ │ ├── ZMPOP.ts │ │ │ ├── ZMSCORE.spec.ts │ │ │ ├── ZMSCORE.ts │ │ │ ├── ZPOPMAX.spec.ts │ │ │ ├── ZPOPMAX.ts │ │ │ ├── ZPOPMAX_COUNT.spec.ts │ │ │ ├── ZPOPMAX_COUNT.ts │ │ │ ├── ZPOPMIN.spec.ts │ │ │ ├── ZPOPMIN.ts │ │ │ ├── ZPOPMIN_COUNT.spec.ts │ │ │ ├── ZPOPMIN_COUNT.ts │ │ │ ├── ZRANDMEMBER.spec.ts │ │ │ ├── ZRANDMEMBER.ts │ │ │ ├── ZRANDMEMBER_COUNT.spec.ts │ │ │ ├── ZRANDMEMBER_COUNT.ts │ │ │ ├── ZRANDMEMBER_COUNT_WITHSCORES.spec.ts │ │ │ ├── ZRANDMEMBER_COUNT_WITHSCORES.ts │ │ │ ├── ZRANGE.spec.ts │ │ │ ├── ZRANGE.ts │ │ │ ├── ZRANGEBYLEX.spec.ts │ │ │ ├── ZRANGEBYLEX.ts │ │ │ ├── ZRANGEBYSCORE.spec.ts │ │ │ ├── ZRANGEBYSCORE.ts │ │ │ ├── ZRANGEBYSCORE_WITHSCORES.spec.ts │ │ │ ├── ZRANGEBYSCORE_WITHSCORES.ts │ │ │ ├── ZRANGESTORE.spec.ts │ │ │ ├── ZRANGESTORE.ts │ │ │ ├── ZRANGE_WITHSCORES.spec.ts │ │ │ ├── ZRANGE_WITHSCORES.ts │ │ │ ├── ZRANK.spec.ts │ │ │ ├── ZRANK.ts │ │ │ ├── ZREM.spec.ts │ │ │ ├── ZREM.ts │ │ │ ├── ZREMRANGEBYLEX.spec.ts │ │ │ ├── ZREMRANGEBYLEX.ts │ │ │ ├── ZREMRANGEBYRANK.spec.ts │ │ │ ├── ZREMRANGEBYRANK.ts │ │ │ ├── ZREMRANGEBYSCORE.spec.ts │ │ │ ├── ZREMRANGEBYSCORE.ts │ │ │ ├── ZREVRANK.spec.ts │ │ │ ├── ZREVRANK.ts │ │ │ ├── ZSCAN.spec.ts │ │ │ ├── ZSCAN.ts │ │ │ ├── ZSCORE.spec.ts │ │ │ ├── ZSCORE.ts │ │ │ ├── ZUNION.spec.ts │ │ │ ├── ZUNION.ts │ │ │ ├── ZUNIONSTORE.spec.ts │ │ │ ├── ZUNIONSTORE.ts │ │ │ ├── ZUNION_WITHSCORES.spec.ts │ │ │ ├── ZUNION_WITHSCORES.ts │ │ │ ├── generic-transformers.spec.ts │ │ │ ├── generic-transformers.ts │ │ │ └── index.ts │ │ ├── errors.ts │ │ ├── lua-script.ts │ │ ├── multi-command.spec.ts │ │ ├── multi-command.ts │ │ ├── test-utils.ts │ │ └── utils.ts │ ├── package.json │ └── tsconfig.json ├── graph │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── lib │ │ ├── commands │ │ │ ├── CONFIG_GET.spec.ts │ │ │ ├── CONFIG_GET.ts │ │ │ ├── CONFIG_SET.spec.ts │ │ │ ├── CONFIG_SET.ts │ │ │ ├── DELETE.spec.ts │ │ │ ├── DELETE.ts │ │ │ ├── EXPLAIN.spec.ts │ │ │ ├── EXPLAIN.ts │ │ │ ├── LIST.spec.ts │ │ │ ├── LIST.ts │ │ │ ├── PROFILE.spec.ts │ │ │ ├── PROFILE.ts │ │ │ ├── QUERY.spec.ts │ │ │ ├── QUERY.ts │ │ │ ├── RO_QUERY.spec.ts │ │ │ ├── RO_QUERY.ts │ │ │ ├── SLOWLOG.spec.ts │ │ │ ├── SLOWLOG.ts │ │ │ ├── index.spec.ts │ │ │ └── index.ts │ │ ├── graph.spec.ts │ │ ├── graph.ts │ │ ├── index.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── json │ ├── .npmignore │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── lib │ │ ├── commands │ │ │ ├── ARRAPPEND.spec.ts │ │ │ ├── ARRAPPEND.ts │ │ │ ├── ARRINDEX.spec.ts │ │ │ ├── ARRINDEX.ts │ │ │ ├── ARRINSERT.spec.ts │ │ │ ├── ARRINSERT.ts │ │ │ ├── ARRLEN.spec.ts │ │ │ ├── ARRLEN.ts │ │ │ ├── ARRPOP.spec.ts │ │ │ ├── ARRPOP.ts │ │ │ ├── ARRTRIM.spec.ts │ │ │ ├── ARRTRIM.ts │ │ │ ├── DEBUG_MEMORY.spec.ts │ │ │ ├── DEBUG_MEMORY.ts │ │ │ ├── DEL.spec.ts │ │ │ ├── DEL.ts │ │ │ ├── FORGET.spec.ts │ │ │ ├── FORGET.ts │ │ │ ├── GET.spec.ts │ │ │ ├── GET.ts │ │ │ ├── MERGE.spec.ts │ │ │ ├── MERGE.ts │ │ │ ├── MGET.spec.ts │ │ │ ├── MGET.ts │ │ │ ├── MSET.spec.ts │ │ │ ├── MSET.ts │ │ │ ├── NUMINCRBY.spec.ts │ │ │ ├── NUMINCRBY.ts │ │ │ ├── NUMMULTBY.spec.ts │ │ │ ├── NUMMULTBY.ts │ │ │ ├── OBJKEYS.spec.ts │ │ │ ├── OBJKEYS.ts │ │ │ ├── OBJLEN.spec.ts │ │ │ ├── OBJLEN.ts │ │ │ ├── RESP.spec.ts │ │ │ ├── RESP.ts │ │ │ ├── SET.spec.ts │ │ │ ├── SET.ts │ │ │ ├── STRAPPEND.spec.ts │ │ │ ├── STRAPPEND.ts │ │ │ ├── STRLEN.spec.ts │ │ │ ├── STRLEN.ts │ │ │ ├── TYPE.spec.ts │ │ │ ├── TYPE.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── search │ ├── .npmignore │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── lib │ │ ├── commands │ │ │ ├── AGGREGATE.spec.ts │ │ │ ├── AGGREGATE.ts │ │ │ ├── AGGREGATE_WITHCURSOR.spec.ts │ │ │ ├── AGGREGATE_WITHCURSOR.ts │ │ │ ├── ALIASADD.spec.ts │ │ │ ├── ALIASADD.ts │ │ │ ├── ALIASDEL.spec.ts │ │ │ ├── ALIASDEL.ts │ │ │ ├── ALIASUPDATE.spec.ts │ │ │ ├── ALIASUPDATE.ts │ │ │ ├── ALTER.spec.ts │ │ │ ├── ALTER.ts │ │ │ ├── CONFIG_GET.spec.ts │ │ │ ├── CONFIG_GET.ts │ │ │ ├── CONFIG_SET.spec.ts │ │ │ ├── CONFIG_SET.ts │ │ │ ├── CREATE.spec.ts │ │ │ ├── CREATE.ts │ │ │ ├── CURSOR_DEL.spec.ts │ │ │ ├── CURSOR_DEL.ts │ │ │ ├── CURSOR_READ.spec.ts │ │ │ ├── CURSOR_READ.ts │ │ │ ├── DICTADD.spec.ts │ │ │ ├── DICTADD.ts │ │ │ ├── DICTDEL.spec.ts │ │ │ ├── DICTDEL.ts │ │ │ ├── DICTDUMP.spec.ts │ │ │ ├── DICTDUMP.ts │ │ │ ├── DROPINDEX.spec.ts │ │ │ ├── DROPINDEX.ts │ │ │ ├── EXPLAIN.spec.ts │ │ │ ├── EXPLAIN.ts │ │ │ ├── EXPLAINCLI.spec.ts │ │ │ ├── EXPLAINCLI.ts │ │ │ ├── INFO.spec.ts │ │ │ ├── INFO.ts │ │ │ ├── PROFILE_AGGREGATE.spec.ts │ │ │ ├── PROFILE_AGGREGATE.ts │ │ │ ├── PROFILE_SEARCH.spec.ts │ │ │ ├── PROFILE_SEARCH.ts │ │ │ ├── SEARCH.spec.ts │ │ │ ├── SEARCH.ts │ │ │ ├── SEARCH_NOCONTENT.spec.ts │ │ │ ├── SEARCH_NOCONTENT.ts │ │ │ ├── SPELLCHECK.spec.ts │ │ │ ├── SPELLCHECK.ts │ │ │ ├── SUGADD.spec.ts │ │ │ ├── SUGADD.ts │ │ │ ├── SUGDEL.spec.ts │ │ │ ├── SUGDEL.ts │ │ │ ├── SUGGET.spec.ts │ │ │ ├── SUGGET.ts │ │ │ ├── SUGGET_WITHPAYLOADS.spec.ts │ │ │ ├── SUGGET_WITHPAYLOADS.ts │ │ │ ├── SUGGET_WITHSCORES.spec.ts │ │ │ ├── SUGGET_WITHSCORES.ts │ │ │ ├── SUGGET_WITHSCORES_WITHPAYLOADS.spec.ts │ │ │ ├── SUGGET_WITHSCORES_WITHPAYLOADS.ts │ │ │ ├── SUGLEN.spec.ts │ │ │ ├── SUGLEN.ts │ │ │ ├── SYNDUMP.spec.ts │ │ │ ├── SYNDUMP.ts │ │ │ ├── SYNUPDATE.spec.ts │ │ │ ├── SYNUPDATE.ts │ │ │ ├── TAGVALS.spec.ts │ │ │ ├── TAGVALS.ts │ │ │ ├── _LIST.spec.ts │ │ │ ├── _LIST.ts │ │ │ ├── index.spec.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── test-utils │ ├── docker │ │ ├── Dockerfile │ │ └── entrypoint.sh │ ├── lib │ │ ├── dockers.ts │ │ └── index.ts │ ├── package.json │ └── tsconfig.json └── time-series │ ├── .npmignore │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── lib │ ├── commands │ │ ├── ADD.spec.ts │ │ ├── ADD.ts │ │ ├── ALTER.spec.ts │ │ ├── ALTER.ts │ │ ├── CREATE.spec.ts │ │ ├── CREATE.ts │ │ ├── CREATERULE.spec.ts │ │ ├── CREATERULE.ts │ │ ├── DECRBY.spec.ts │ │ ├── DECRBY.ts │ │ ├── DEL.spec.ts │ │ ├── DEL.ts │ │ ├── DELETERULE.spec.ts │ │ ├── DELETERULE.ts │ │ ├── GET.spec.ts │ │ ├── GET.ts │ │ ├── INCRBY.spec.ts │ │ ├── INCRBY.ts │ │ ├── INFO.spec.ts │ │ ├── INFO.ts │ │ ├── INFO_DEBUG.spec.ts │ │ ├── INFO_DEBUG.ts │ │ ├── MADD.spec.ts │ │ ├── MADD.ts │ │ ├── MGET.spec.ts │ │ ├── MGET.ts │ │ ├── MGET_WITHLABELS.spec.ts │ │ ├── MGET_WITHLABELS.ts │ │ ├── MRANGE.spec.ts │ │ ├── MRANGE.ts │ │ ├── MRANGE_WITHLABELS.spec.ts │ │ ├── MRANGE_WITHLABELS.ts │ │ ├── MREVRANGE.spec.ts │ │ ├── MREVRANGE.ts │ │ ├── MREVRANGE_WITHLABELS.spec.ts │ │ ├── MREVRANGE_WITHLABELS.ts │ │ ├── QUERYINDEX.spec.ts │ │ ├── QUERYINDEX.ts │ │ ├── RANGE.spec.ts │ │ ├── RANGE.ts │ │ ├── REVRANGE.spec.ts │ │ ├── REVRANGE.ts │ │ ├── index.spec.ts │ │ └── index.ts │ ├── index.ts │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── tsconfig.base.json └── tsconfig.json /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [[analyzers]] 4 | name = "javascript" 5 | enabled = true 6 | 7 | [analyzers.meta] 8 | environment = ["nodejs"] 9 | dialect = "typescript" 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/DOCUMENTATION.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | description: Any questions or issues relating to the project documentation. 3 | labels: [Documentation] 4 | body: 5 | - type: textarea 6 | id: description 7 | attributes: 8 | label: Description 9 | description: Ask your question or describe your issue here. 10 | validations: 11 | required: true 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .nyc_output/ 3 | .vscode/ 4 | coverage/ 5 | dist/ 6 | node_modules/ 7 | .DS_Store 8 | dump.rdb 9 | documentation/ 10 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .github/ 2 | .vscode/ 3 | docs/ 4 | examples/ 5 | packages/ 6 | .deepsource.toml 7 | .release-it.json 8 | CONTRIBUTING.md 9 | SECURITY.md 10 | index.ts 11 | tsconfig.base.json 12 | tsconfig.json 13 | -------------------------------------------------------------------------------- /.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "redis@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # (Fork) Node-Redis 2 | 3 | Fork of upstream with a fix to `@redis/client`, republished as `@farcaster/client`. 4 | 5 | Relevant patch: https://github.com/redis/node-redis/pull/2731/files 6 | -------------------------------------------------------------------------------- /benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | *.js.json 2 | -------------------------------------------------------------------------------- /benchmark/lib/ping/ioredis.js: -------------------------------------------------------------------------------- 1 | import Redis from 'ioredis'; 2 | 3 | export default async (host) => { 4 | const client = new Redis({ 5 | host, 6 | lazyConnect: true 7 | }); 8 | 9 | await client.connect(); 10 | 11 | return { 12 | benchmark() { 13 | return client.ping(); 14 | }, 15 | teardown() { 16 | return client.disconnect(); 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /benchmark/lib/ping/ping.yml: -------------------------------------------------------------------------------- 1 | name: "ping" 2 | 3 | clientconfig: 4 | - command: | 5 | npm install -ws 6 | npm run build:tests-tools 7 | cd benchmark 8 | npm install 9 | npm run start -- --name ping --redis-server-host ${server_private_ip} 10 | -------------------------------------------------------------------------------- /benchmark/lib/ping/v3.js: -------------------------------------------------------------------------------- 1 | import { createClient } from 'redis-v3'; 2 | import { once } from 'events'; 3 | import { promisify } from 'util'; 4 | 5 | export default async (host) => { 6 | const client = createClient({ host }), 7 | pingAsync = promisify(client.ping).bind(client), 8 | quitAsync = promisify(client.quit).bind(client); 9 | 10 | await once(client, 'connect'); 11 | 12 | return { 13 | benchmark() { 14 | return pingAsync(); 15 | }, 16 | teardown() { 17 | return quitAsync(); 18 | } 19 | }; 20 | 21 | }; 22 | -------------------------------------------------------------------------------- /benchmark/lib/ping/v4.js: -------------------------------------------------------------------------------- 1 | import { createClient } from '@redis/client'; 2 | 3 | export default async (host) => { 4 | const client = createClient({ 5 | socket: { 6 | host 7 | } 8 | }); 9 | 10 | await client.connect(); 11 | 12 | return { 13 | benchmark() { 14 | return client.ping(); 15 | }, 16 | teardown() { 17 | return client.disconnect(); 18 | } 19 | }; 20 | }; 21 | -------------------------------------------------------------------------------- /benchmark/lib/set-get-delete-string/1KB.yml: -------------------------------------------------------------------------------- 1 | name: "set-get-delete-string-1KB" 2 | 3 | clientconfig: 4 | - command: | 5 | npm install -ws 6 | npm run build:tests-tools 7 | cd benchmark 8 | npm install 9 | npm run start -- --name set-get-delete-string --size 1024 --redis-server-host ${server_private_ip} 10 | -------------------------------------------------------------------------------- /benchmark/lib/set-get-delete-string/1MB.yml: -------------------------------------------------------------------------------- 1 | name: "set-get-delete-string-1MB" 2 | 3 | clientconfig: 4 | - command: | 5 | npm install -ws 6 | npm run build:tests-tools 7 | cd benchmark 8 | npm install 9 | npm run start -- --name set-get-delete-string --size 1048576 --redis-server-host ${server_private_ip} 10 | -------------------------------------------------------------------------------- /benchmark/lib/set-get-delete-string/8B.yml: -------------------------------------------------------------------------------- 1 | name: "set-get-delete-string-8B" 2 | 3 | clientconfig: 4 | - command: | 5 | npm install -ws 6 | npm run build:tests-tools 7 | cd benchmark 8 | npm install 9 | npm run start -- --name set-get-delete-string --size 8 --redis-server-host ${server_private_ip} 10 | -------------------------------------------------------------------------------- /benchmark/lib/set-get-delete-string/index.js: -------------------------------------------------------------------------------- 1 | import yargs from 'yargs'; 2 | import { hideBin } from 'yargs/helpers'; 3 | import { randomBytes } from 'crypto'; 4 | 5 | const { size } = yargs(hideBin(process.argv)) 6 | .option('size', { 7 | type: 'number', 8 | default: 1024, 9 | demandOption: true 10 | }) 11 | .parseSync(); 12 | 13 | export const randomString = randomBytes(size).toString('ascii'); 14 | -------------------------------------------------------------------------------- /benchmark/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@redis/client-benchmark", 3 | "private": true, 4 | "main": "./lib", 5 | "type": "module", 6 | "scripts": { 7 | "start": "node ." 8 | }, 9 | "dependencies": { 10 | "@redis/client": "../packages/client", 11 | "hdr-histogram-js": "3.0.0", 12 | "ioredis": "5.3.2", 13 | "redis-v3": "npm:redis@3.1.2", 14 | "yargs": "17.7.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /benchmark/requirements.txt: -------------------------------------------------------------------------------- 1 | redisbench_admin>=0.5.24 2 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | -------------------------------------------------------------------------------- /examples/command-with-modifiers.js: -------------------------------------------------------------------------------- 1 | // Define a custom script that shows example of SET command 2 | // with several modifiers. 3 | 4 | import { createClient } from 'redis'; 5 | 6 | const client = createClient(); 7 | 8 | await client.connect(); 9 | await client.del('mykey'); 10 | 11 | let result = await client.set('mykey', 'myvalue', { 12 | EX: 60, 13 | GET: true 14 | }); 15 | 16 | console.log(result); //null 17 | 18 | result = await client.set('mykey', 'newvalue', { 19 | EX: 60, 20 | GET: true 21 | }); 22 | 23 | console.log(result); //myvalue 24 | 25 | await client.quit(); 26 | -------------------------------------------------------------------------------- /examples/get-server-time.js: -------------------------------------------------------------------------------- 1 | // Get the time from the Redis Server. 2 | 3 | import { createClient } from 'redis'; 4 | 5 | const client = createClient(); 6 | await client.connect(); 7 | 8 | const serverTime = await client.time(); 9 | // 2022-02-25T12:57:40.000Z { microseconds: 351346 } 10 | console.log(serverTime); 11 | 12 | await client.quit(); 13 | -------------------------------------------------------------------------------- /examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-redis-examples", 3 | "version": "1.0.0", 4 | "description": "node-redis 4 example script", 5 | "main": "index.js", 6 | "private": true, 7 | "type": "module", 8 | "dependencies": { 9 | "redis": "../" 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /examples/set-scan.js: -------------------------------------------------------------------------------- 1 | // An example script that shows how to use the SSCAN iterator functionality to retrieve the contents of a Redis set. 2 | // Create the set in redis-cli with this command: 3 | // sadd setName a b c d e f g h i j k l m n o p q 4 | 5 | import { createClient } from 'redis'; 6 | 7 | const client = createClient(); 8 | await client.connect(); 9 | 10 | const setName = 'setName'; 11 | for await (const member of client.sScanIterator(setName)) { 12 | console.log(member); 13 | } 14 | 15 | await client.quit(); 16 | -------------------------------------------------------------------------------- /packages/bloom/.npmignore: -------------------------------------------------------------------------------- 1 | .nyc_output/ 2 | coverage/ 3 | lib/ 4 | .nycrc.json 5 | .release-it.json 6 | tsconfig.json 7 | -------------------------------------------------------------------------------- /packages/bloom/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": ["dist", "**/*.spec.ts", "lib/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/bloom/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "bloom@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "publishArgs": ["--access", "public"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/ADD.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, item: string): Array { 4 | return ['BF.ADD', key, item]; 5 | } 6 | 7 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/CARD.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string): Array { 6 | return ['BF.CARD', key]; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/EXISTS.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, item: string): Array { 6 | return ['BF.EXISTS', key, item]; 7 | } 8 | 9 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 10 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/LOADCHUNK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: string, 7 | iteretor: number, 8 | chunk: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['BF.LOADCHUNK', key, iteretor.toString(), chunk]; 11 | } 12 | 13 | export declare function transformReply(): 'OK'; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/MADD.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, items: Array): Array { 4 | return ['BF.MADD', key, ...items]; 5 | } 6 | 7 | export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/MEXISTS.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, items: Array): Array { 6 | return ['BF.MEXISTS', key, ...items]; 7 | } 8 | 9 | export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 10 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/INITBYDIM.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, width: number, depth: number): Array { 4 | return ['CMS.INITBYDIM', key, width.toString(), depth.toString()]; 5 | } 6 | 7 | export declare function transformReply(): 'OK'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/INITBYPROB.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, error: number, probability: number): Array { 4 | return ['CMS.INITBYPROB', key, error.toString(), probability.toString()]; 5 | } 6 | 7 | export declare function transformReply(): 'OK'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/QUERY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: string, 10 | items: string | Array 11 | ): RedisCommandArguments { 12 | return pushVerdictArguments(['CMS.QUERY', key], items); 13 | } 14 | 15 | export declare function transformReply(): Array; 16 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/index.ts: -------------------------------------------------------------------------------- 1 | import * as INCRBY from './INCRBY'; 2 | import * as INFO from './INFO'; 3 | import * as INITBYDIM from './INITBYDIM'; 4 | import * as INITBYPROB from './INITBYPROB'; 5 | import * as MERGE from './MERGE'; 6 | import * as QUERY from './QUERY'; 7 | 8 | export default { 9 | INCRBY, 10 | incrBy: INCRBY, 11 | INFO, 12 | info: INFO, 13 | INITBYDIM, 14 | initByDim: INITBYDIM, 15 | INITBYPROB, 16 | initByProb: INITBYPROB, 17 | MERGE, 18 | merge: MERGE, 19 | QUERY, 20 | query: QUERY 21 | }; 22 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/ADD.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, item: string): Array { 4 | return ['CF.ADD', key, item]; 5 | } 6 | 7 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/ADDNX.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, item: string): Array { 4 | return ['CF.ADDNX', key, item]; 5 | } 6 | 7 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/COUNT.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, item: string): Array { 4 | return ['CF.COUNT', key, item]; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/DEL.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, item: string): Array { 4 | return ['CF.DEL', key, item]; 5 | } 6 | 7 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 8 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/EXISTS.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, item: string): Array { 6 | return ['CF.EXISTS', key, item]; 7 | } 8 | 9 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 10 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/LOADCHUNK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: string, 7 | iterator: number, 8 | chunk: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['CF.LOADCHUNK', key, iterator.toString(), chunk]; 11 | } 12 | 13 | export declare function transformReply(): 'OK'; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/SCANDUMP.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, iterator: number): Array { 4 | return ['CF.SCANDUMP', key, iterator.toString()]; 5 | } 6 | 7 | type ScanDumpRawReply = [ 8 | iterator: number, 9 | chunk: string | null 10 | ]; 11 | 12 | interface ScanDumpReply { 13 | iterator: number; 14 | chunk: string | null; 15 | } 16 | 17 | export function transformReply([iterator, chunk]: ScanDumpRawReply): ScanDumpReply { 18 | return { 19 | iterator, 20 | chunk 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/index.ts: -------------------------------------------------------------------------------- 1 | import bf from './bloom'; 2 | import cms from './count-min-sketch'; 3 | import cf from './cuckoo'; 4 | import tDigest from './t-digest'; 5 | import topK from './top-k'; 6 | 7 | export default { 8 | bf, 9 | cms, 10 | cf, 11 | tDigest, 12 | topK 13 | }; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/ADD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | values: Array 8 | ): RedisCommandArguments { 9 | const args = ['TDIGEST.ADD', key]; 10 | for (const item of values) { 11 | args.push(item.toString()); 12 | } 13 | 14 | return args; 15 | } 16 | 17 | export declare function transformReply(): 'OK'; 18 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/BYRANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | ranks: Array 10 | ): RedisCommandArguments { 11 | const args = ['TDIGEST.BYRANK', key]; 12 | for (const rank of ranks) { 13 | args.push(rank.toString()); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export { transformDoublesReply as transformReply } from '.'; 20 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/BYREVRANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | ranks: Array 10 | ): RedisCommandArguments { 11 | const args = ['TDIGEST.BYREVRANK', key]; 12 | for (const rank of ranks) { 13 | args.push(rank.toString()); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export { transformDoublesReply as transformReply } from '.'; 20 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/CDF.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | values: Array 10 | ): RedisCommandArguments { 11 | const args = ['TDIGEST.CDF', key]; 12 | for (const item of values) { 13 | args.push(item.toString()); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export { transformDoublesReply as transformReply } from '.'; 20 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/CREATE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { CompressionOption, pushCompressionArgument } from '.'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | options?: CompressionOption 9 | ): RedisCommandArguments { 10 | return pushCompressionArgument( 11 | ['TDIGEST.CREATE', key], 12 | options 13 | ); 14 | } 15 | 16 | export declare function transformReply(): 'OK'; 17 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/MAX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return [ 9 | 'TDIGEST.MAX', 10 | key 11 | ]; 12 | } 13 | 14 | export { transformDoubleReply as transformReply } from '.'; 15 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/MIN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return [ 9 | 'TDIGEST.MIN', 10 | key 11 | ]; 12 | } 13 | 14 | export { transformDoubleReply as transformReply } from '.'; 15 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/RANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | values: Array 10 | ): RedisCommandArguments { 11 | const args = ['TDIGEST.RANK', key]; 12 | for (const item of values) { 13 | args.push(item.toString()); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export declare function transformReply(): Array; 20 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/RESET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['TDIGEST.RESET', key]; 7 | } 8 | 9 | export declare function transformReply(): 'OK'; 10 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/REVRANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | values: Array 10 | ): RedisCommandArguments { 11 | const args = ['TDIGEST.REVRANK', key]; 12 | for (const item of values) { 13 | args.push(item.toString()); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export declare function transformReply(): Array; 20 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/top-k/ADD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: string, 8 | items: string | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['TOPK.ADD', key], items); 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/top-k/COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: string, 10 | items: string | Array 11 | ): RedisCommandArguments { 12 | return pushVerdictArguments(['TOPK.COUNT', key], items); 13 | } 14 | 15 | export declare function transformReply(): Array; 16 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/top-k/LIST.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string): Array { 6 | return ['TOPK.LIST', key]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/top-k/QUERY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: string, 10 | items: string | Array 11 | ): RedisCommandArguments { 12 | return pushVerdictArguments(['TOPK.QUERY', key], items); 13 | } 14 | 15 | export declare function transformReply(): Array; 16 | -------------------------------------------------------------------------------- /packages/bloom/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './commands'; 2 | -------------------------------------------------------------------------------- /packages/bloom/lib/test-utils.ts: -------------------------------------------------------------------------------- 1 | import TestUtils from '@redis/test-utils'; 2 | import RedisBloomModules from '.'; 3 | 4 | export default new TestUtils({ 5 | dockerImageName: 'redislabs/rebloom', 6 | dockerImageVersionArgument: 'redisbloom-version', 7 | defaultDockerVersion: 'edge' 8 | }); 9 | 10 | export const GLOBAL = { 11 | SERVERS: { 12 | OPEN: { 13 | serverArguments: ['--loadmodule /usr/lib/redis/modules/redisbloom.so'], 14 | clientOptions: { 15 | modules: RedisBloomModules 16 | } 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/bloom/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ], 9 | "exclude": [ 10 | "./lib/test-utils.ts", 11 | "./lib/**/*.spec.ts" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "./lib" 16 | ], 17 | "entryPointStrategy": "expand", 18 | "out": "../../documentation/bloom" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/client/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "plugins": [ 5 | "@typescript-eslint" 6 | ], 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/eslint-recommended", 10 | "plugin:@typescript-eslint/recommended" 11 | ], 12 | "rules": { 13 | "semi": [2, "always"] 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/client/.npmignore: -------------------------------------------------------------------------------- 1 | .nyc_output/ 2 | coverage/ 3 | documentation/ 4 | lib/ 5 | .eslintrc.json 6 | .nycrc.json 7 | .release-it.json 8 | dump.rdb 9 | index.ts 10 | tsconfig.json 11 | -------------------------------------------------------------------------------- /packages/client/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": ["dist", "**/*.spec.ts", "lib/test-utils.ts", "examples/*"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/client/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "client@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "publishArgs": ["--access", "public"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/client/README.md: -------------------------------------------------------------------------------- 1 | # @redis/client 2 | 3 | The source code and documentation for this package are in the main [node-redis](https://github.com/redis/node-redis) repo. 4 | -------------------------------------------------------------------------------- /packages/client/lib/client/RESP2/composers/buffer.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import BufferComposer from './buffer'; 3 | 4 | describe('Buffer Composer', () => { 5 | const composer = new BufferComposer(); 6 | 7 | it('should compose two buffers', () => { 8 | composer.write(Buffer.from([0])); 9 | assert.deepEqual( 10 | composer.end(Buffer.from([1])), 11 | Buffer.from([0, 1]) 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/client/RESP2/composers/buffer.ts: -------------------------------------------------------------------------------- 1 | import { Composer } from './interface'; 2 | 3 | export default class BufferComposer implements Composer { 4 | private chunks: Array = []; 5 | 6 | write(buffer: Buffer): void { 7 | this.chunks.push(buffer); 8 | } 9 | 10 | end(buffer: Buffer): Buffer { 11 | this.write(buffer); 12 | return Buffer.concat(this.chunks.splice(0)); 13 | } 14 | 15 | reset() { 16 | this.chunks = []; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/client/lib/client/RESP2/composers/interface.ts: -------------------------------------------------------------------------------- 1 | export interface Composer { 2 | write(buffer: Buffer): void; 3 | 4 | end(buffer: Buffer): T; 5 | 6 | reset(): void; 7 | } 8 | -------------------------------------------------------------------------------- /packages/client/lib/client/RESP2/composers/string.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import StringComposer from './string'; 3 | 4 | describe('String Composer', () => { 5 | const composer = new StringComposer(); 6 | 7 | it('should compose two strings', () => { 8 | composer.write(Buffer.from([0])); 9 | assert.deepEqual( 10 | composer.end(Buffer.from([1])), 11 | Buffer.from([0, 1]).toString() 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/command-options.ts: -------------------------------------------------------------------------------- 1 | const symbol = Symbol('Command Options'); 2 | 3 | export type CommandOptions = T & { 4 | readonly [symbol]: true; 5 | }; 6 | 7 | export function commandOptions(options: T): CommandOptions { 8 | (options as any)[symbol] = true; 9 | return options as CommandOptions; 10 | } 11 | 12 | export function isCommandOptions(options: any): options is CommandOptions { 13 | return options?.[symbol] === true; 14 | } 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_CAT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(categoryName?: RedisCommandArgument): RedisCommandArguments { 4 | const args: RedisCommandArguments = ['ACL', 'CAT']; 5 | 6 | if (categoryName) { 7 | args.push(categoryName); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_DELUSER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export function transformArguments( 5 | username: RedisCommandArgument | Array 6 | ): RedisCommandArguments { 7 | return pushVerdictArguments(['ACL', 'DELUSER'], username); 8 | } 9 | 10 | export declare function transformReply(): number; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_DRYRUN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments( 6 | username: RedisCommandArgument, 7 | command: Array 8 | ): RedisCommandArguments { 9 | return [ 10 | 'ACL', 11 | 'DRYRUN', 12 | username, 13 | ...command 14 | ]; 15 | } 16 | 17 | export declare function transformReply(): RedisCommandArgument; 18 | 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_GENPASS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(bits?: number): RedisCommandArguments { 4 | const args = ['ACL', 'GENPASS']; 5 | 6 | if (bits) { 7 | args.push(bits.toString()); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): RedisCommandArgument; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LIST.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './ACL_LIST'; 4 | 5 | describe('ACL LIST', () => { 6 | testUtils.isVersionGreaterThanHook([6]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['ACL', 'LIST'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LIST.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ACL', 'LIST']; 5 | } 6 | 7 | export declare function transformReply(): Array; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOAD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './ACL_SAVE'; 4 | 5 | describe('ACL SAVE', () => { 6 | testUtils.isVersionGreaterThanHook([6]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['ACL', 'SAVE'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOAD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ACL', 'LOAD']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOG_RESET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './ACL_LOG_RESET'; 4 | 5 | describe('ACL LOG RESET', () => { 6 | testUtils.isVersionGreaterThanHook([6]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['ACL', 'LOG', 'RESET'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOG_RESET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ACL', 'LOG', 'RESET']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_SAVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './ACL_LOAD'; 4 | 5 | describe('ACL LOAD', () => { 6 | testUtils.isVersionGreaterThanHook([6]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['ACL', 'LOAD'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_SAVE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ACL', 'SAVE']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_SETUSER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export function transformArguments( 5 | username: RedisCommandArgument, 6 | rule: RedisCommandArgument | Array 7 | ): RedisCommandArguments { 8 | return pushVerdictArguments(['ACL', 'SETUSER', username], rule); 9 | } 10 | 11 | export declare function transformReply(): RedisCommandArgument; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_USERS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './ACL_USERS'; 4 | 5 | describe('ACL USERS', () => { 6 | testUtils.isVersionGreaterThanHook([6]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['ACL', 'USERS'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_USERS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ACL', 'USERS']; 5 | } 6 | 7 | export declare function transformReply(): Array; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_WHOAMI.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './ACL_WHOAMI'; 4 | 5 | describe('ACL WHOAMI', () => { 6 | testUtils.isVersionGreaterThanHook([6]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['ACL', 'WHOAMI'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_WHOAMI.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ACL', 'WHOAMI']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/APPEND.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './APPEND'; 3 | 4 | describe('APPEND', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('key', 'value'), 8 | ['APPEND', 'key', 'value'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/APPEND.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | value: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['APPEND', key, value]; 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ASKING.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './ASKING'; 3 | 4 | describe('ASKING', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['ASKING'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ASKING.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments, RedisCommandArgument } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['ASKING']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/AUTH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export interface AuthOptions { 4 | username?: RedisCommandArgument; 5 | password: RedisCommandArgument; 6 | } 7 | 8 | export function transformArguments({ username, password }: AuthOptions): RedisCommandArguments { 9 | if (!username) { 10 | return ['AUTH', password]; 11 | } 12 | 13 | return ['AUTH', username, password]; 14 | } 15 | 16 | export declare function transformReply(): RedisCommandArgument; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BGREWRITEAOF.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './BGREWRITEAOF'; 3 | 4 | describe('BGREWRITEAOF', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['BGREWRITEAOF'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BGREWRITEAOF.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['BGREWRITEAOF']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BGSAVE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | interface BgSaveOptions { 4 | SCHEDULE?: true; 5 | } 6 | 7 | export function transformArguments(options?: BgSaveOptions): RedisCommandArguments { 8 | const args = ['BGSAVE']; 9 | 10 | if (options?.SCHEDULE) { 11 | args.push('SCHEDULE'); 12 | } 13 | 14 | return args; 15 | } 16 | 17 | export declare function transformReply(): RedisCommandArgument; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BRPOP.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument | Array, 8 | timeout: number 9 | ): RedisCommandArguments { 10 | const args = pushVerdictArguments(['BRPOP'], key); 11 | 12 | args.push(timeout.toString()); 13 | 14 | return args; 15 | } 16 | 17 | export { transformReply } from './BLPOP'; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BRPOPLPUSH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | source: RedisCommandArgument, 7 | destination: RedisCommandArgument, 8 | timeout: number 9 | ): RedisCommandArguments { 10 | return ['BRPOPLPUSH', source, destination, timeout.toString()]; 11 | } 12 | 13 | export declare function transformReply(): RedisCommandArgument | null; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BZPOPMIN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument | Array, 8 | timeout: number 9 | ): RedisCommandArguments { 10 | const args = pushVerdictArguments(['BZPOPMIN'], key); 11 | 12 | args.push(timeout.toString()); 13 | 14 | return args; 15 | } 16 | 17 | export { transformReply } from './BZPOPMAX'; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_CACHING.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(value: boolean): RedisCommandArguments { 4 | return [ 5 | 'CLIENT', 6 | 'CACHING', 7 | value ? 'YES' : 'NO' 8 | ]; 9 | } 10 | 11 | export declare function transformReply(): 'OK' | Buffer; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETNAME.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLIENT_GETNAME'; 3 | 4 | describe('CLIENT GETNAME', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['CLIENT', 'GETNAME'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETNAME.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['CLIENT', 'GETNAME']; 5 | } 6 | 7 | export declare function transformReply(): string | null; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETREDIR.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLIENT_GETREDIR'; 3 | 4 | describe('CLIENT GETREDIR', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['CLIENT', 'GETREDIR'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETREDIR.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['CLIENT', 'GETREDIR']; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_ID.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(): Array { 4 | return ['CLIENT', 'ID']; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_NO-EVICT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(value: boolean): RedisCommandArguments { 4 | return [ 5 | 'CLIENT', 6 | 'NO-EVICT', 7 | value ? 'ON' : 'OFF' 8 | ]; 9 | } 10 | 11 | export declare function transformReply(): 'OK' | Buffer; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_NO-TOUCH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(value: boolean): RedisCommandArguments { 4 | return [ 5 | 'CLIENT', 6 | 'NO-TOUCH', 7 | value ? 'ON' : 'OFF' 8 | ]; 9 | } 10 | 11 | export declare function transformReply(): 'OK' | Buffer; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_PAUSE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments( 4 | timeout: number, 5 | mode?: 'WRITE' | 'ALL' 6 | ): RedisCommandArguments { 7 | const args = [ 8 | 'CLIENT', 9 | 'PAUSE', 10 | timeout.toString() 11 | ]; 12 | 13 | if (mode) { 14 | args.push(mode); 15 | } 16 | 17 | return args; 18 | } 19 | 20 | export declare function transformReply(): 'OK' | Buffer; 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_SETNAME.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLIENT_SETNAME'; 3 | 4 | describe('CLIENT SETNAME', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('name'), 8 | ['CLIENT', 'SETNAME', 'name'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_SETNAME.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(name: RedisCommandArgument): RedisCommandArguments { 4 | return ['CLIENT', 'SETNAME', name]; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_UNPAUSE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['CLIENT', 'UNPAUSE']; 5 | } 6 | 7 | export declare function transformReply(): 'OK' | Buffer; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_ADDSLOTS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushVerdictNumberArguments } from './generic-transformers'; 3 | 4 | export function transformArguments(slots: number | Array): RedisCommandArguments { 5 | return pushVerdictNumberArguments( 6 | ['CLUSTER', 'ADDSLOTS'], 7 | slots 8 | ); 9 | } 10 | 11 | export declare function transformReply(): string; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_ADDSLOTSRANGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushSlotRangesArguments, SlotRange } from './generic-transformers'; 3 | 4 | export function transformArguments( 5 | ranges: SlotRange | Array 6 | ): RedisCommandArguments { 7 | return pushSlotRangesArguments( 8 | ['CLUSTER', 'ADDSLOTSRANGE'], 9 | ranges 10 | ); 11 | } 12 | 13 | export declare function transformReply(): 'OK'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_BUMPEPOCH.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['CLUSTER', 'BUMPEPOCH']; 3 | } 4 | 5 | export declare function transformReply(): 'BUMPED' | 'STILL'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_COUNT-FAILURE-REPORTS.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(nodeId: string): Array { 2 | return ['CLUSTER', 'COUNT-FAILURE-REPORTS', nodeId]; 3 | } 4 | 5 | export declare function transformReply(): number; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_COUNTKEYSINSLOT.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(slot: number): Array { 2 | return ['CLUSTER', 'COUNTKEYSINSLOT', slot.toString()]; 3 | } 4 | 5 | export declare function transformReply(): number; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_DELSLOTS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushVerdictNumberArguments } from './generic-transformers'; 3 | 4 | export function transformArguments(slots: number | Array): RedisCommandArguments { 5 | return pushVerdictNumberArguments( 6 | ['CLUSTER', 'DELSLOTS'], 7 | slots 8 | ); 9 | } 10 | 11 | export declare function transformReply(): 'OK'; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_DELSLOTSRANGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushSlotRangesArguments, SlotRange } from './generic-transformers'; 3 | 4 | export function transformArguments( 5 | ranges: SlotRange | Array 6 | ): RedisCommandArguments { 7 | return pushSlotRangesArguments( 8 | ['CLUSTER', 'DELSLOTSRANGE'], 9 | ranges 10 | ); 11 | } 12 | 13 | export declare function transformReply(): 'OK'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FAILOVER.ts: -------------------------------------------------------------------------------- 1 | export enum FailoverModes { 2 | FORCE = 'FORCE', 3 | TAKEOVER = 'TAKEOVER' 4 | } 5 | 6 | export function transformArguments(mode?: FailoverModes): Array { 7 | const args = ['CLUSTER', 'FAILOVER']; 8 | 9 | if (mode) { 10 | args.push(mode); 11 | } 12 | 13 | return args; 14 | } 15 | 16 | export declare function transformReply(): 'OK'; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FLUSHSLOTS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLUSTER_FLUSHSLOTS'; 3 | 4 | describe('CLUSTER FLUSHSLOTS', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['CLUSTER', 'FLUSHSLOTS'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FLUSHSLOTS.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['CLUSTER', 'FLUSHSLOTS']; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FORGET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLUSTER_FORGET'; 3 | 4 | describe('CLUSTER FORGET', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('0'), 8 | ['CLUSTER', 'FORGET', '0'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FORGET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(nodeId: string): Array { 2 | return ['CLUSTER', 'FORGET', nodeId]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_GETKEYSINSLOT.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(slot: number, count: number): Array { 2 | return ['CLUSTER', 'GETKEYSINSLOT', slot.toString(), count.toString()]; 3 | } 4 | 5 | export declare function transformReply(): Array; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_KEYSLOT.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(key: string): Array { 2 | return ['CLUSTER', 'KEYSLOT', key]; 3 | } 4 | 5 | export declare function transformReply(): number; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MEET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLUSTER_MEET'; 3 | 4 | describe('CLUSTER MEET', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('127.0.0.1', 6379), 8 | ['CLUSTER', 'MEET', '127.0.0.1', '6379'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MEET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(ip: string, port: number): Array { 2 | return ['CLUSTER', 'MEET', ip, port.toString()]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MYID.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['CLUSTER', 'MYID']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MYSHARDID.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments() { 4 | return ['CLUSTER', 'MYSHARDID']; 5 | } 6 | 7 | export declare function transformReply(): string | Buffer; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICAS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLUSTER_REPLICAS'; 3 | 4 | describe('CLUSTER REPLICAS', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('0'), 8 | ['CLUSTER', 'REPLICAS', '0'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICAS.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(nodeId: string): Array { 2 | return ['CLUSTER', 'REPLICAS', nodeId]; 3 | } 4 | 5 | export { transformReply } from './CLUSTER_NODES'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICATE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLUSTER_REPLICATE'; 3 | 4 | describe('CLUSTER REPLICATE', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('0'), 8 | ['CLUSTER', 'REPLICATE', '0'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICATE.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(nodeId: string): Array { 2 | return ['CLUSTER', 'REPLICATE', nodeId]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_RESET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(mode?: 'HARD' | 'SOFT'): Array { 2 | const args = ['CLUSTER', 'RESET']; 3 | 4 | if (mode) { 5 | args.push(mode); 6 | } 7 | 8 | return args; 9 | } 10 | 11 | export declare function transformReply(): string; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SAVECONFIG.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['CLUSTER', 'SAVECONFIG']; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SET-CONFIG-EPOCH.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CLUSTER_SET-CONFIG-EPOCH'; 3 | 4 | describe('CLUSTER SET-CONFIG-EPOCH', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(0), 8 | ['CLUSTER', 'SET-CONFIG-EPOCH', '0'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SET-CONFIG-EPOCH.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(configEpoch: number): Array { 2 | return ['CLUSTER', 'SET-CONFIG-EPOCH', configEpoch.toString()]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SETSLOT.ts: -------------------------------------------------------------------------------- 1 | export enum ClusterSlotStates { 2 | IMPORTING = 'IMPORTING', 3 | MIGRATING = 'MIGRATING', 4 | STABLE = 'STABLE', 5 | NODE = 'NODE' 6 | } 7 | 8 | export function transformArguments( 9 | slot: number, 10 | state: ClusterSlotStates, 11 | nodeId?: string 12 | ): Array { 13 | const args = ['CLUSTER', 'SETSLOT', slot.toString(), state]; 14 | 15 | if (nodeId) { 16 | args.push(nodeId); 17 | } 18 | 19 | return args; 20 | } 21 | 22 | export declare function transformReply(): 'OK'; 23 | -------------------------------------------------------------------------------- /packages/client/lib/commands/COMMAND.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers'; 3 | 4 | export const IS_READ_ONLY = true; 5 | 6 | export function transformArguments(): RedisCommandArguments { 7 | return ['COMMAND']; 8 | } 9 | 10 | export function transformReply(reply: Array): Array { 11 | return reply.map(transformCommandReply); 12 | } 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/COMMAND_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(): RedisCommandArguments { 6 | return ['COMMAND', 'COUNT']; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/COMMAND_GETKEYS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(args: Array): RedisCommandArguments { 6 | return ['COMMAND', 'GETKEYS', ...args]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/COMMAND_INFO.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers'; 3 | 4 | export const IS_READ_ONLY = true; 5 | 6 | export function transformArguments(commands: Array): RedisCommandArguments { 7 | return ['COMMAND', 'INFO', ...commands]; 8 | } 9 | 10 | export function transformReply(reply: Array): Array { 11 | return reply.map(command => command ? transformCommandReply(command) : null); 12 | } 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_GET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CONFIG_GET'; 3 | 4 | describe('CONFIG GET', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('*'), 8 | ['CONFIG', 'GET', '*'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_GET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(parameter: string): Array { 2 | return ['CONFIG', 'GET', parameter]; 3 | } 4 | 5 | export { transformTuplesReply as transformReply } from './generic-transformers'; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_RESETSTAT.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CONFIG_RESETSTAT'; 3 | 4 | describe('CONFIG RESETSTAT', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['CONFIG', 'RESETSTAT'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_RESETSTAT.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['CONFIG', 'RESETSTAT']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_REWRITE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './CONFIG_REWRITE'; 3 | 4 | describe('CONFIG REWRITE', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['CONFIG', 'REWRITE'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_REWRITE.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['CONFIG', 'REWRITE']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DBSIZE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './DBSIZE'; 4 | 5 | describe('DBSIZE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments(), 9 | ['DBSIZE'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.dbSize', async client => { 14 | assert.equal( 15 | await client.dbSize(), 16 | 0 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DBSIZE.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(): Array { 4 | return ['DBSIZE']; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DECR.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './DECR'; 4 | 5 | describe('DECR', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['DECR', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.decr', async client => { 14 | assert.equal( 15 | await client.decr('key'), 16 | -1 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DECR.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['DECR', key]; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DECRBY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | decrement: number 8 | ): RedisCommandArguments { 9 | return ['DECRBY', key, decrement.toString()]; 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | keys: RedisCommandArgument | Array 8 | ): RedisCommandArguments { 9 | return pushVerdictArguments(['DEL'], keys); 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DISCARD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './DISCARD'; 3 | 4 | describe('DISCARD', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['DISCARD'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DISCARD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument } from '.'; 2 | 3 | export function transformArguments(): Array { 4 | return ['DISCARD']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DUMP.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | 4 | describe('DUMP', () => { 5 | testUtils.testWithClient('client.dump', async client => { 6 | assert.equal( 7 | await client.dump('key'), 8 | null 9 | ); 10 | }, GLOBAL.SERVERS.OPEN); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DUMP.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['DUMP', key]; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ECHO.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(message: RedisCommandArgument): RedisCommandArguments { 6 | return ['ECHO', message]; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVAL.ts: -------------------------------------------------------------------------------- 1 | import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers'; 2 | 3 | export const FIRST_KEY_INDEX = evalFirstKeyIndex; 4 | 5 | export function transformArguments(script: string, options?: EvalOptions): Array { 6 | return pushEvalArguments(['EVAL', script], options); 7 | } 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './EVALSHA'; 3 | 4 | describe('EVALSHA', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('sha1', { 8 | keys: ['key'], 9 | arguments: ['argument'] 10 | }), 11 | ['EVALSHA', 'sha1', '1', 'key', 'argument'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA.ts: -------------------------------------------------------------------------------- 1 | import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers'; 2 | 3 | export const FIRST_KEY_INDEX = evalFirstKeyIndex; 4 | 5 | export function transformArguments(sha1: string, options?: EvalOptions): Array { 6 | return pushEvalArguments(['EVALSHA', sha1], options); 7 | } 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA_RO.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './EVALSHA_RO'; 4 | 5 | describe('EVALSHA_RO', () => { 6 | testUtils.isVersionGreaterThanHook([7]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments('sha1', { 11 | keys: ['key'], 12 | arguments: ['argument'] 13 | }), 14 | ['EVALSHA_RO', 'sha1', '1', 'key', 'argument'] 15 | ); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA_RO.ts: -------------------------------------------------------------------------------- 1 | import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers'; 2 | 3 | export const FIRST_KEY_INDEX = evalFirstKeyIndex; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(sha1: string, options?: EvalOptions): Array { 8 | return pushEvalArguments(['EVALSHA_RO', sha1], options); 9 | } 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVAL_RO.ts: -------------------------------------------------------------------------------- 1 | import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers'; 2 | 3 | export const FIRST_KEY_INDEX = evalFirstKeyIndex; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(script: string, options?: EvalOptions): Array { 8 | return pushEvalArguments(['EVAL_RO', script], options); 9 | } 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EXISTS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | keys: RedisCommandArgument | Array 10 | ): RedisCommandArguments { 11 | return pushVerdictArguments(['EXISTS'], keys); 12 | } 13 | 14 | export declare function transformReply(): number; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EXPIRE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | seconds: number, 8 | mode?: 'NX' | 'XX' | 'GT' | 'LT' 9 | ): RedisCommandArguments { 10 | const args = ['EXPIRE', key, seconds.toString()]; 11 | 12 | if (mode) { 13 | args.push(mode); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export { transformBooleanReply as transformReply } from './generic-transformers'; 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EXPIRETIME.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['EXPIRETIME', key]; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FCALL.ts: -------------------------------------------------------------------------------- 1 | import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers'; 2 | 3 | export const FIRST_KEY_INDEX = evalFirstKeyIndex; 4 | 5 | export function transformArguments(fn: string, options?: EvalOptions): Array { 6 | return pushEvalArguments(['FCALL', fn], options); 7 | } 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FCALL_RO.ts: -------------------------------------------------------------------------------- 1 | import { evalFirstKeyIndex, EvalOptions, pushEvalArguments } from './generic-transformers'; 2 | 3 | export const FIRST_KEY_INDEX = evalFirstKeyIndex; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(fn: string, options?: EvalOptions): Array { 8 | return pushEvalArguments(['FCALL_RO', fn], options); 9 | } 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FLUSHALL.ts: -------------------------------------------------------------------------------- 1 | export enum RedisFlushModes { 2 | ASYNC = 'ASYNC', 3 | SYNC = 'SYNC' 4 | } 5 | 6 | export function transformArguments(mode?: RedisFlushModes): Array { 7 | const args = ['FLUSHALL']; 8 | 9 | if (mode) { 10 | args.push(mode); 11 | } 12 | 13 | return args; 14 | } 15 | 16 | export declare function transformReply(): string; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FLUSHDB.ts: -------------------------------------------------------------------------------- 1 | import { RedisFlushModes } from './FLUSHALL'; 2 | 3 | export function transformArguments(mode?: RedisFlushModes): Array { 4 | const args = ['FLUSHDB']; 5 | 6 | if (mode) { 7 | args.push(mode); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): string; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_DELETE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(library: string): RedisCommandArguments { 4 | return ['FUNCTION', 'DELETE', library]; 5 | } 6 | 7 | export declare function transformReply(): 'OK'; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_DUMP.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['FUNCTION', 'DUMP']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_FLUSH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(mode?: 'ASYNC' | 'SYNC'): RedisCommandArguments { 4 | const args = ['FUNCTION', 'FLUSH']; 5 | 6 | if (mode) { 7 | args.push(mode); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): 'OK'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_KILL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils from '../test-utils'; 3 | import { transformArguments } from './FUNCTION_KILL'; 4 | 5 | describe('FUNCTION KILL', () => { 6 | testUtils.isVersionGreaterThanHook([7]); 7 | 8 | it('transformArguments', () => { 9 | assert.deepEqual( 10 | transformArguments(), 11 | ['FUNCTION', 'KILL'] 12 | ); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_KILL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['FUNCTION', 'KILL']; 5 | } 6 | 7 | export declare function transformReply(): 'OK'; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_LOAD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | interface FunctionLoadOptions { 4 | REPLACE?: boolean; 5 | } 6 | 7 | export function transformArguments( 8 | code: string, 9 | options?: FunctionLoadOptions 10 | ): RedisCommandArguments { 11 | const args = ['FUNCTION', 'LOAD']; 12 | 13 | if (options?.REPLACE) { 14 | args.push('REPLACE'); 15 | } 16 | 17 | args.push(code); 18 | 19 | return args; 20 | } 21 | 22 | export declare function transformReply(): string; 23 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_RESTORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments( 4 | dump: RedisCommandArgument, 5 | mode?: 'FLUSH' | 'APPEND' | 'REPLACE' 6 | ): RedisCommandArguments { 7 | const args = ['FUNCTION', 'RESTORE', dump]; 8 | 9 | if (mode) { 10 | args.push(mode); 11 | } 12 | 13 | return args; 14 | } 15 | 16 | export declare function transformReply(): 'OK'; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GEOHASH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: RedisCommandArgument, 10 | member: RedisCommandArgument | Array 11 | ): RedisCommandArguments { 12 | return pushVerdictArguments(['GEOHASH', key], member); 13 | } 14 | 15 | export declare function transformReply(): Array; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['GET', key]; 9 | } 10 | 11 | export declare function transformReply(): RedisCommandArgument | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETBIT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { BitValue } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: RedisCommandArgument, 10 | offset: number 11 | ): RedisCommandArguments { 12 | return ['GETBIT', key, offset.toString()]; 13 | } 14 | 15 | export declare function transformReply(): BitValue; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETDEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['GETDEL', key]; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument | null; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETRANGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | start: number, 10 | end: number 11 | ): RedisCommandArguments { 12 | return ['GETRANGE', key, start.toString(), end.toString()]; 13 | } 14 | 15 | export declare function transformReply(): RedisCommandArgument; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETSET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | value: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['GETSET', key, value]; 10 | } 11 | 12 | export declare function transformReply(): RedisCommandArgument | null; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HDEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | field: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['HDEL', key], field); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HEXISTS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | field: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['HEXISTS', key, field]; 10 | } 11 | 12 | export { transformBooleanReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HGET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | field: RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return ['HGET', key, field]; 12 | } 13 | 14 | export declare function transformReply(): RedisCommandArgument | undefined; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HGETALL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export const TRANSFORM_LEGACY_REPLY = true; 8 | 9 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 10 | return ['HGETALL', key]; 11 | } 12 | 13 | export { transformTuplesReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HINCRBY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | field: RedisCommandArgument, 8 | increment: number 9 | ): RedisCommandArguments { 10 | return ['HINCRBY', key, field, increment.toString()]; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HINCRBYFLOAT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | field: RedisCommandArgument, 8 | increment: number 9 | ): RedisCommandArguments { 10 | return ['HINCRBYFLOAT', key, field, increment.toString()]; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HKEYS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['HKEYS', key]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HLEN.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './HLEN'; 4 | 5 | describe('HLEN', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['HLEN', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.hLen', async client => { 14 | assert.equal( 15 | await client.hLen('key'), 16 | 0 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HLEN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['HLEN', key]; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HMGET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: RedisCommandArgument, 10 | fields: RedisCommandArgument | Array 11 | ): RedisCommandArguments { 12 | return pushVerdictArguments(['HMGET', key], fields); 13 | } 14 | 15 | export declare function transformReply(): Array; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HRANDFIELD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['HRANDFIELD', key]; 9 | } 10 | 11 | export declare function transformReply(): RedisCommandArgument | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HRANDFIELD_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformHRandFieldArguments } from './HRANDFIELD'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './HRANDFIELD'; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | count: number 9 | ): RedisCommandArguments { 10 | return [ 11 | ...transformHRandFieldArguments(key), 12 | count.toString() 13 | ]; 14 | } 15 | 16 | export declare function transformReply(): Array; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HSETNX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | field: RedisCommandArgument, 8 | value: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['HSETNX', key, field, value]; 11 | } 12 | 13 | export { transformBooleanReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HSTRLEN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | field: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['HSTRLEN', key, field]; 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HVALS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['HVALS', key]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCR.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './INCR'; 4 | 5 | describe('INCR', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['INCR', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.incr', async client => { 14 | assert.equal( 15 | await client.incr('key'), 16 | 1 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCR.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['INCR', key]; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCRBY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | increment: number 8 | ): RedisCommandArguments { 9 | return ['INCRBY', key, increment.toString()]; 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCRBYFLOAT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | increment: number 8 | ): RedisCommandArguments { 9 | return ['INCRBYFLOAT', key, increment.toString()]; 10 | } 11 | 12 | export declare function transformReply(): RedisCommandArgument; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INFO.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './INFO'; 3 | 4 | describe('INFO', () => { 5 | describe('transformArguments', () => { 6 | it('simple', () => { 7 | assert.deepEqual( 8 | transformArguments(), 9 | ['INFO'] 10 | ); 11 | }); 12 | 13 | it('server section', () => { 14 | assert.deepEqual( 15 | transformArguments('server'), 16 | ['INFO', 'server'] 17 | ); 18 | }); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INFO.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(section?: string): Array { 4 | const args = ['INFO']; 5 | 6 | if (section) { 7 | args.push(section); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): string; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/KEYS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | 4 | describe('KEYS', () => { 5 | testUtils.testWithClient('client.keys', async client => { 6 | assert.deepEqual( 7 | await client.keys('pattern'), 8 | [] 9 | ); 10 | }, GLOBAL.SERVERS.OPEN); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/KEYS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(pattern: RedisCommandArgument): RedisCommandArguments { 4 | return ['KEYS', pattern]; 5 | } 6 | 7 | export declare function transformReply(): Array; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LASTSAVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './LASTSAVE'; 4 | 5 | describe('LASTSAVE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments(), 9 | ['LASTSAVE'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.lastSave', async client => { 14 | assert.ok((await client.lastSave()) instanceof Date); 15 | }, GLOBAL.SERVERS.OPEN); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LASTSAVE.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(): Array { 4 | return ['LASTSAVE']; 5 | } 6 | 7 | export function transformReply(reply: number): Date { 8 | return new Date(reply); 9 | } 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LATENCY_DOCTOR.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['LATENCY', 'DOCTOR']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LATENCY_LATEST.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(): RedisCommandArguments { 4 | return ['LATENCY', 'LATEST']; 5 | } 6 | 7 | export declare function transformReply(): Array<[ 8 | name: string, 9 | timestamp: number, 10 | latestLatency: number, 11 | allTimeLatency: number 12 | ]>; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LCS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key1: RedisCommandArgument, 9 | key2: RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return [ 12 | 'LCS', 13 | key1, 14 | key2 15 | ]; 16 | } 17 | 18 | export declare function transformReply(): string | Buffer; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LCS_LEN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformLcsArguments } from './LCS'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './LCS'; 5 | 6 | export function transformArguments( 7 | key1: RedisCommandArgument, 8 | key2: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | const args = transformLcsArguments(key1, key2); 11 | args.push('LEN'); 12 | return args; 13 | } 14 | 15 | export declare function transformReply(): number; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LINDEX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | index: number 10 | ): RedisCommandArguments { 11 | return ['LINDEX', key, index.toString()]; 12 | } 13 | 14 | export declare function transformReply(): RedisCommandArgument | null; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LLEN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['LLEN', key]; 9 | } 10 | 11 | export declare function transformReply(): number; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LOLWUT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(version?: number, ...optionalArguments: Array): Array { 6 | const args = ['LOLWUT']; 7 | 8 | if (version) { 9 | args.push( 10 | 'VERSION', 11 | version.toString(), 12 | ...optionalArguments.map(String), 13 | ); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export declare function transformReply(): RedisCommandArgument; 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPOP.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['LPOP', key]; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument | null; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPOP_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | count: number 8 | ): RedisCommandArguments { 9 | return ['LPOP', key, count.toString()]; 10 | } 11 | 12 | export declare function transformReply(): Array | null; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPUSH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | elements: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['LPUSH', key], elements);} 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPUSHX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | element: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['LPUSHX', key], element); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LRANGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | start: number, 10 | stop: number 11 | ): RedisCommandArguments { 12 | return [ 13 | 'LRANGE', 14 | key, 15 | start.toString(), 16 | stop.toString() 17 | ]; 18 | } 19 | 20 | export declare function transformReply(): Array; 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LREM.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | count: number, 8 | element: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return [ 11 | 'LREM', 12 | key, 13 | count.toString(), 14 | element 15 | ]; 16 | } 17 | 18 | export declare function transformReply(): number; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LSET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | index: number, 8 | element: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return [ 11 | 'LSET', 12 | key, 13 | index.toString(), 14 | element 15 | ]; 16 | } 17 | 18 | export declare function transformReply(): RedisCommandArgument; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LTRIM.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | start: number, 8 | stop: number 9 | ): RedisCommandArguments { 10 | return [ 11 | 'LTRIM', 12 | key, 13 | start.toString(), 14 | stop.toString() 15 | ]; 16 | } 17 | 18 | export declare function transformReply(): RedisCommandArgument; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_DOCTOR.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['MEMORY', 'DOCTOR']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_MALLOC-STATS.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['MEMORY', 'MALLOC-STATS']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_PURGE.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['MEMORY', 'PURGE']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_USAGE.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | interface MemoryUsageOptions { 6 | SAMPLES?: number; 7 | } 8 | 9 | export function transformArguments(key: string, options?: MemoryUsageOptions): Array { 10 | const args = ['MEMORY', 'USAGE', key]; 11 | 12 | if (options?.SAMPLES) { 13 | args.push('SAMPLES', options.SAMPLES.toString()); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export declare function transformReply(): number | null; 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MGET.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | keys: Array 9 | ): RedisCommandArguments { 10 | return ['MGET', ...keys]; 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_LIST.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './MODULE_LIST'; 3 | 4 | describe('MODULE LIST', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['MODULE', 'LIST'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_LIST.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['MODULE', 'LIST']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_LOAD.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(path: string, moduleArgs?: Array): Array { 2 | const args = ['MODULE', 'LOAD', path]; 3 | 4 | if (moduleArgs) { 5 | args.push(...moduleArgs); 6 | } 7 | 8 | return args; 9 | } 10 | 11 | export declare function transformReply(): string; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_UNLOAD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './MODULE_UNLOAD'; 3 | 4 | describe('MODULE UNLOAD', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('name'), 8 | ['MODULE', 'UNLOAD', 'name'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_UNLOAD.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(name: string): Array { 2 | return ['MODULE', 'UNLOAD', name]; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MOVE.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, db: number): Array { 4 | return ['MOVE', key, db.toString()]; 5 | } 6 | 7 | export { transformBooleanReply as transformReply } from './generic-transformers'; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_ENCODING.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['OBJECT', 'ENCODING', key]; 9 | } 10 | 11 | export declare function transformReply(): string | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_FREQ.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['OBJECT', 'FREQ', key]; 9 | } 10 | 11 | export declare function transformReply(): number | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_IDLETIME.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['OBJECT', 'IDLETIME', key]; 9 | } 10 | 11 | export declare function transformReply(): number | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_REFCOUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['OBJECT', 'REFCOUNT', key]; 9 | } 10 | 11 | export declare function transformReply(): number | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PERSIST.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['PERSIST', key]; 7 | } 8 | 9 | export { transformBooleanReply as transformReply } from './generic-transformers'; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PEXPIRE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | milliseconds: number, 8 | mode?: 'NX' | 'XX' | 'GT' | 'LT' 9 | ): RedisCommandArguments { 10 | const args = ['PEXPIRE', key, milliseconds.toString()]; 11 | 12 | if (mode) { 13 | args.push(mode); 14 | } 15 | 16 | return args; 17 | } 18 | 19 | export { transformBooleanReply as transformReply } from './generic-transformers'; 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PEXPIRETIME.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['PEXPIRETIME', key]; 7 | } 8 | 9 | export declare function transformReply(): number; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PFADD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | element: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['PFADD', key], element); 11 | } 12 | 13 | export { transformBooleanReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PFCOUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument | Array 8 | ): RedisCommandArguments { 9 | return pushVerdictArguments(['PFCOUNT'], key); 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PFMERGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments(destination: string, source: string | Array): RedisCommandArguments { 7 | return pushVerdictArguments(['PFMERGE', destination], source); 8 | } 9 | 10 | export declare function transformReply(): string; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PING.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export function transformArguments(message?: RedisCommandArgument): RedisCommandArguments { 4 | const args: RedisCommandArguments = ['PING']; 5 | if (message) { 6 | args.push(message); 7 | } 8 | 9 | return args; 10 | } 11 | 12 | export declare function transformReply(): RedisCommandArgument; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PSETEX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | milliseconds: number, 8 | value: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return [ 11 | 'PSETEX', 12 | key, 13 | milliseconds.toString(), 14 | value 15 | ]; 16 | } 17 | 18 | export declare function transformReply(): RedisCommandArgument; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PTTL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './PTTL'; 4 | 5 | describe('PTTL', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['PTTL', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.pTTL', async client => { 14 | assert.equal( 15 | await client.pTTL('key'), 16 | -2 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PTTL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['PTTL', key]; 9 | } 10 | 11 | export declare function transformReply(): number; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBLISH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments( 6 | channel: RedisCommandArgument, 7 | message: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['PUBLISH', channel, message]; 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBSUB_CHANNELS.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(pattern?: string): Array { 4 | const args = ['PUBSUB', 'CHANNELS']; 5 | 6 | if (pattern) { 7 | args.push(pattern); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBSUB_NUMPAT.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(): Array { 4 | return ['PUBSUB', 'NUMPAT']; 5 | } 6 | 7 | export declare function transformReply(): string; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBSUB_SHARDCHANNELS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments( 6 | pattern?: RedisCommandArgument 7 | ): RedisCommandArguments { 8 | const args: RedisCommandArguments = ['PUBSUB', 'SHARDCHANNELS']; 9 | if (pattern) args.push(pattern); 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RANDOMKEY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(): RedisCommandArguments { 6 | return ['RANDOMKEY']; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument | null; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READONLY.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './READONLY'; 3 | 4 | describe('READONLY', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['READONLY'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READONLY.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['READONLY']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READWRITE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './READWRITE'; 3 | 4 | describe('READWRITE', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['READWRITE'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READWRITE.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['READWRITE']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RENAME.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | newKey: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['RENAME', key, newKey]; 10 | } 11 | 12 | export declare function transformReply(): RedisCommandArgument; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RENAMENX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | newKey: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['RENAMENX', key, newKey]; 10 | } 11 | 12 | export { transformBooleanReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/REPLICAOF.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './REPLICAOF'; 3 | 4 | describe('REPLICAOF', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('host', 1), 8 | ['REPLICAOF', 'host', '1'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/REPLICAOF.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(host: string, port: number): Array { 2 | return ['REPLICAOF', host, port.toString()]; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RESTORE-ASKING.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './RESTORE-ASKING'; 3 | 4 | describe('RESTORE-ASKING', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['RESTORE-ASKING'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RESTORE-ASKING.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['RESTORE-ASKING']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPOP.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['RPOP', key]; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument | null; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPOPLPUSH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | source: RedisCommandArgument, 7 | destination: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['RPOPLPUSH', source, destination]; 10 | } 11 | 12 | export declare function transformReply(): RedisCommandArgument | null; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPOP_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | count: number 8 | ): RedisCommandArguments { 9 | return ['RPOP', key, count.toString()]; 10 | } 11 | 12 | export declare function transformReply(): Array | null; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPUSH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | element: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['RPUSH', key], element); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPUSHX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | element: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['RPUSHX', key], element); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SADD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | members: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['SADD', key], members); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SAVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './SAVE'; 3 | 4 | describe('SAVE', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['SAVE'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SAVE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument } from '.'; 2 | 3 | export function transformArguments(): Array { 4 | return ['SAVE']; 5 | } 6 | 7 | export declare function transformReply(): RedisCommandArgument; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCARD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './SCARD'; 4 | 5 | describe('SCARD', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['SCARD', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.sCard', async client => { 14 | assert.equal( 15 | await client.sCard('key'), 16 | 0 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCARD.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string): Array { 4 | return ['SCARD', key]; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_DEBUG.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(mode: 'YES' | 'SYNC' | 'NO'): Array { 2 | return ['SCRIPT', 'DEBUG', mode]; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_EXISTS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export function transformArguments(sha1: string | Array): RedisCommandArguments { 5 | return pushVerdictArguments(['SCRIPT', 'EXISTS'], sha1); 6 | } 7 | 8 | export { transformBooleanArrayReply as transformReply } from './generic-transformers'; 9 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_FLUSH.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(mode?: 'ASYNC' | 'SYNC'): Array { 2 | const args = ['SCRIPT', 'FLUSH']; 3 | 4 | if (mode) { 5 | args.push(mode); 6 | } 7 | 8 | return args; 9 | } 10 | 11 | export declare function transformReply(): string; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_KILL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './SCRIPT_KILL'; 3 | 4 | describe('SCRIPT KILL', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments(), 8 | ['SCRIPT', 'KILL'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_KILL.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['SCRIPT', 'KILL']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_LOAD.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(script: string): Array { 2 | return ['SCRIPT', 'LOAD', script]; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SDIFF.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | keys: RedisCommandArgument | Array 10 | ): RedisCommandArguments { 11 | return pushVerdictArguments(['SDIFF'], keys); 12 | } 13 | 14 | export declare function transformReply(): Array; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SDIFFSTORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | destination: RedisCommandArgument, 8 | keys: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['SDIFFSTORE', destination], keys); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETBIT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { BitValue } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | offset: number, 9 | value: BitValue 10 | ): RedisCommandArguments { 11 | return ['SETBIT', key, offset.toString(), value.toString()]; 12 | } 13 | 14 | export declare function transformReply(): BitValue; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETEX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | seconds: number, 8 | value: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return [ 11 | 'SETEX', 12 | key, 13 | seconds.toString(), 14 | value 15 | ]; 16 | } 17 | 18 | export declare function transformReply(): RedisCommandArgument; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETNX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | value: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['SETNX', key, value]; 10 | } 11 | 12 | export { transformBooleanReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETRANGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | offset: number, 8 | value: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['SETRANGE', key, offset.toString(), value]; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SHUTDOWN.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(mode?: 'NOSAVE' | 'SAVE'): Array { 2 | const args = ['SHUTDOWN']; 3 | 4 | if (mode) { 5 | args.push(mode); 6 | } 7 | 8 | return args; 9 | } 10 | 11 | export declare function transformReply(): void; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SINTER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | keys: RedisCommandArgument | Array 10 | ): RedisCommandArguments { 11 | return pushVerdictArguments(['SINTER'], keys); 12 | } 13 | 14 | export declare function transformReply(): Array; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SINTERSTORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | destination: RedisCommandArgument, 8 | keys: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['SINTERSTORE', destination], keys); 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SISMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | member: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['SISMEMBER', key, member]; 10 | } 11 | 12 | export { transformBooleanReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SMEMBERS.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['SMEMBERS', key]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SMISMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | members: Array 8 | ): RedisCommandArguments { 9 | return ['SMISMEMBER', key, ...members]; 10 | } 11 | 12 | export { transformBooleanArrayReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SMOVE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | source: RedisCommandArgument, 7 | destination: RedisCommandArgument, 8 | member: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['SMOVE', source, destination, member]; 11 | } 12 | 13 | export { transformBooleanReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SORT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushSortArguments, SortOptions } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: string, 8 | options?: SortOptions 9 | ): RedisCommandArguments { 10 | return pushSortArguments(['SORT', key], options); 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SORT_RO.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushSortArguments, SortOptions } from "./generic-transformers"; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: string, 10 | options?: SortOptions 11 | ): RedisCommandArguments { 12 | return pushSortArguments(['SORT_RO', key], options); 13 | } 14 | 15 | export declare function transformReply(): Array; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SORT_STORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { SortOptions } from './generic-transformers'; 3 | import { transformArguments as transformSortArguments } from './SORT'; 4 | 5 | export const FIRST_KEY_INDEX = 1; 6 | 7 | export function transformArguments( 8 | source: string, 9 | destination: string, 10 | options?: SortOptions 11 | ): RedisCommandArguments { 12 | const args = transformSortArguments(source, options); 13 | args.push('STORE', destination); 14 | return args; 15 | } 16 | 17 | export declare function transformReply(): number; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SPOP.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | count?: number 8 | ): RedisCommandArguments { 9 | const args = ['SPOP', key]; 10 | 11 | if (typeof count === 'number') { 12 | args.push(count.toString()); 13 | } 14 | 15 | return args; 16 | } 17 | 18 | export declare function transformReply(): Array; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SPUBLISH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export const FIRST_KEY_INDEX = 1; 6 | 7 | export function transformArguments( 8 | channel: RedisCommandArgument, 9 | message: RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return ['SPUBLISH', channel, message]; 12 | } 13 | 14 | export declare function transformReply(): number; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SRANDMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return ['SRANDMEMBER', key]; 7 | } 8 | 9 | export declare function transformReply(): RedisCommandArgument | null; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SRANDMEMBER_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformSRandMemberArguments } from './SRANDMEMBER'; 3 | 4 | export { FIRST_KEY_INDEX } from './SRANDMEMBER'; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | count: number 9 | ): RedisCommandArguments { 10 | return [ 11 | ...transformSRandMemberArguments(key), 12 | count.toString() 13 | ]; 14 | } 15 | 16 | export declare function transformReply(): Array; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SREM.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | members: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['SREM', key], members); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/STRLEN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['STRLEN', key]; 9 | } 10 | 11 | export declare function transformReply(): number; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SUNION.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | keys: RedisCommandArgument | Array 10 | ): RedisCommandArguments { 11 | return pushVerdictArguments(['SUNION'], keys); 12 | } 13 | 14 | export declare function transformReply(): Array; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SUNIONSTORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | destination: RedisCommandArgument, 8 | keys: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['SUNIONSTORE', destination], keys); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SWAPDB.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(index1: number, index2: number): Array { 2 | return ['SWAPDB', index1.toString(), index2.toString()]; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TIME.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['TIME']; 3 | } 4 | 5 | interface TimeReply extends Date { 6 | microseconds: number; 7 | } 8 | 9 | export function transformReply(reply: [string, string]): TimeReply { 10 | const seconds = Number(reply[0]), 11 | microseconds = Number(reply[1]), 12 | d: Partial = new Date(seconds * 1000 + microseconds / 1000); 13 | d.microseconds = microseconds; 14 | return d as TimeReply; 15 | } 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TOUCH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument | Array 8 | ): RedisCommandArguments { 9 | return pushVerdictArguments(['TOUCH'], key); 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TTL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './TTL'; 4 | 5 | describe('TTL', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['TTL', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.ttl', async client => { 14 | assert.equal( 15 | await client.ttl('key'), 16 | -2 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TTL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['TTL', key]; 9 | } 10 | 11 | export declare function transformReply(): number; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TYPE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './TYPE'; 4 | 5 | describe('TYPE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['TYPE', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.type', async client => { 14 | assert.equal( 15 | await client.type('key'), 16 | 'none' 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TYPE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['TYPE', key]; 9 | } 10 | 11 | export declare function transformReply(): RedisCommandArgument; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/UNLINK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument | Array 8 | ): RedisCommandArguments { 9 | return pushVerdictArguments(['UNLINK'], key); 10 | } 11 | 12 | export declare function transformReply(): number; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/UNWATCH.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './UNWATCH'; 4 | 5 | describe('UNWATCH', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments(), 9 | ['UNWATCH'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.unwatch', async client => { 14 | assert.equal( 15 | await client.unwatch(), 16 | 'OK' 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/UNWATCH.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['UNWATCH']; 3 | } 4 | 5 | export declare function transformReply(): string; 6 | -------------------------------------------------------------------------------- /packages/client/lib/commands/WAIT.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './WAIT'; 4 | 5 | describe('WAIT', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments(0, 1), 9 | ['WAIT', '0', '1'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.wait', async client => { 14 | assert.equal( 15 | await client.wait(0, 1), 16 | 0 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/WAIT.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(numberOfReplicas: number, timeout: number): Array { 4 | return ['WAIT', numberOfReplicas.toString(), timeout.toString()]; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/client/lib/commands/WATCH.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments(key: string | Array): RedisCommandArguments { 7 | return pushVerdictArguments(['WATCH'], key); 8 | } 9 | 10 | export declare function transformReply(): string; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XACK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | group: RedisCommandArgument, 9 | id: RedisCommandArgument | Array 10 | ): RedisCommandArguments { 11 | return pushVerdictArguments(['XACK', key, group], id); 12 | } 13 | 14 | export declare function transformReply(): number; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XCLAIM_JUSTID.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformXClaimArguments } from './XCLAIM'; 3 | 4 | export { FIRST_KEY_INDEX } from './XCLAIM'; 5 | 6 | export function transformArguments(...args: Parameters): RedisCommandArguments { 7 | return [ 8 | ...transformXClaimArguments(...args), 9 | 'JUSTID' 10 | ]; 11 | } 12 | 13 | export declare function transformReply(): Array; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XDEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | id: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['XDEL', key], id); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_CREATECONSUMER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | group: RedisCommandArgument, 8 | consumer: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['XGROUP', 'CREATECONSUMER', key, group, consumer]; 11 | } 12 | 13 | export { transformBooleanReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_DELCONSUMER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | group: RedisCommandArgument, 8 | consumer: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['XGROUP', 'DELCONSUMER', key, group, consumer]; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_DESTROY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | group: RedisCommandArgument 8 | ): RedisCommandArguments { 9 | return ['XGROUP', 'DESTROY', key, group]; 10 | } 11 | 12 | export { transformBooleanReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_SETID.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 2; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | group: RedisCommandArgument, 8 | id: RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return ['XGROUP', 'SETID', key, group, id]; 11 | } 12 | 13 | export declare function transformReply(): RedisCommandArgument; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XLEN.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './XLEN'; 4 | 5 | describe('XLEN', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['XLEN', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.xLen', async client => { 14 | assert.equal( 15 | await client.xLen('key'), 16 | 0 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XLEN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['XLEN', key]; 9 | } 10 | 11 | export declare function transformReply(): number; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XSETID.spec.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StrawHat1Luffy/node-redis/5c9a4336590de9bdb3c3b316b7479951a1719a19/packages/client/lib/commands/XSETID.spec.ts -------------------------------------------------------------------------------- /packages/client/lib/commands/ZCARD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './ZCARD'; 4 | 5 | describe('ZCARD', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('key'), 9 | ['ZCARD', 'key'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.zCard', async client => { 14 | assert.equal( 15 | await client.zCard('key'), 16 | 0 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZCARD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['ZCARD', key]; 9 | } 10 | 11 | export declare function transformReply(): number; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZDIFF.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArgument } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 2; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | keys: Array | RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return pushVerdictArgument(['ZDIFF'], keys); 12 | } 13 | 14 | export declare function transformReply(): Array; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZDIFFSTORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArgument } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | destination: RedisCommandArgument, 8 | keys: Array | RedisCommandArgument 9 | ): RedisCommandArguments { 10 | return pushVerdictArgument(['ZDIFFSTORE', destination], keys); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZDIFF_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZDiffArguments } from './ZDIFF'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZDIFF'; 5 | 6 | export function transformArguments(...args: Parameters): RedisCommandArguments { 7 | return [ 8 | ...transformZDiffArguments(...args), 9 | 'WITHSCORES' 10 | ]; 11 | } 12 | 13 | export { transformSortedSetWithScoresReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZINTER_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZInterArguments } from './ZINTER'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZINTER'; 5 | 6 | export function transformArguments(...args: Parameters): RedisCommandArguments { 7 | return [ 8 | ...transformZInterArguments(...args), 9 | 'WITHSCORES' 10 | ]; 11 | } 12 | 13 | export { transformSortedSetWithScoresReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZLEXCOUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | min: RedisCommandArgument, 10 | max: RedisCommandArgument 11 | ): RedisCommandArguments { 12 | return [ 13 | 'ZLEXCOUNT', 14 | key, 15 | min, 16 | max 17 | ]; 18 | } 19 | 20 | export declare function transformReply(): number; 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZMSCORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export const IS_READ_ONLY = true; 7 | 8 | export function transformArguments( 9 | key: RedisCommandArgument, 10 | member: RedisCommandArgument | Array 11 | ): RedisCommandArguments { 12 | return pushVerdictArguments(['ZMSCORE', key], member); 13 | } 14 | 15 | export { transformNumberInfinityNullArrayReply as transformReply } from './generic-transformers'; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMAX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return [ 7 | 'ZPOPMAX', 8 | key 9 | ]; 10 | } 11 | 12 | export { transformSortedSetMemberNullReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMAX_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZPopMaxArguments } from './ZPOPMAX'; 3 | 4 | export { FIRST_KEY_INDEX } from './ZPOPMAX'; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | count: number 9 | ): RedisCommandArguments { 10 | return [ 11 | ...transformZPopMaxArguments(key), 12 | count.toString() 13 | ]; 14 | } 15 | 16 | export { transformSortedSetWithScoresReply as transformReply } from './generic-transformers'; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMIN.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 6 | return [ 7 | 'ZPOPMIN', 8 | key 9 | ]; 10 | } 11 | 12 | export { transformSortedSetMemberNullReply as transformReply } from './generic-transformers'; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMIN_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZPopMinArguments } from './ZPOPMIN'; 3 | 4 | export { FIRST_KEY_INDEX } from './ZPOPMIN'; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | count: number 9 | ): RedisCommandArguments { 10 | return [ 11 | ...transformZPopMinArguments(key), 12 | count.toString() 13 | ]; 14 | } 15 | 16 | export { transformSortedSetWithScoresReply as transformReply } from './generic-transformers'; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANDMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { 8 | return ['ZRANDMEMBER', key]; 9 | } 10 | 11 | export declare function transformReply(): RedisCommandArgument | null; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANDMEMBER_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZRandMemberArguments } from './ZRANDMEMBER'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZRANDMEMBER'; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | count: number 9 | ): RedisCommandArguments { 10 | return [ 11 | ...transformZRandMemberArguments(key), 12 | count.toString() 13 | ]; 14 | } 15 | 16 | export declare function transformReply(): Array; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANGE_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZRangeArguments } from './ZRANGE'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZRANGE'; 5 | 6 | export function transformArguments(...args: Parameters): RedisCommandArguments { 7 | return [ 8 | ...transformZRangeArguments(...args), 9 | 'WITHSCORES' 10 | ]; 11 | } 12 | 13 | export { transformSortedSetWithScoresReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | member: RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return ['ZRANK', key, member]; 12 | } 13 | 14 | export declare function transformReply(): number | null; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZREM.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | import { pushVerdictArguments } from './generic-transformers'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments( 7 | key: RedisCommandArgument, 8 | member: RedisCommandArgument | Array 9 | ): RedisCommandArguments { 10 | return pushVerdictArguments(['ZREM', key], member); 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZREMRANGEBYRANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments( 6 | key: RedisCommandArgument, 7 | start: number, 8 | stop: number 9 | ): RedisCommandArguments { 10 | return ['ZREMRANGEBYRANK', key, start.toString(), stop.toString()]; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZREVRANK.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | member: RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return ['ZREVRANK', key, member]; 12 | } 13 | 14 | export declare function transformReply(): number | null; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZSCORE.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument, RedisCommandArguments } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments( 8 | key: RedisCommandArgument, 9 | member: RedisCommandArgument 10 | ): RedisCommandArguments { 11 | return ['ZSCORE', key, member]; 12 | } 13 | 14 | export { transformNumberInfinityNullReply as transformReply } from './generic-transformers'; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZUNION_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '.'; 2 | import { transformArguments as transformZUnionArguments } from './ZUNION'; 3 | 4 | export { FIRST_KEY_INDEX, IS_READ_ONLY } from './ZUNION'; 5 | 6 | export function transformArguments(...args: Parameters): RedisCommandArguments { 7 | return [ 8 | ...transformZUnionArguments(...args), 9 | 'WITHSCORES' 10 | ]; 11 | } 12 | 13 | export { transformSortedSetWithScoresReply as transformReply } from './generic-transformers'; 14 | -------------------------------------------------------------------------------- /packages/client/lib/utils.ts: -------------------------------------------------------------------------------- 1 | export function promiseTimeout(ms: number): Promise { 2 | return new Promise(resolve => setTimeout(resolve, ms)); 3 | } 4 | -------------------------------------------------------------------------------- /packages/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./index.ts", 8 | "./lib/**/*.ts", 9 | "./package.json" 10 | ], 11 | "exclude": [ 12 | "./lib/test-utils.ts", 13 | "./lib/**/*.spec.ts" 14 | ], 15 | "ts-node": { 16 | "transpileOnly": true 17 | }, 18 | "typedocOptions": { 19 | "entryPoints": [ 20 | "./index.ts", 21 | "./lib" 22 | ], 23 | "entryPointStrategy": "expand", 24 | "out": "../../documentation/client" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/graph/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": ["dist", "**/*.spec.ts", "lib/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/graph/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "graph@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "publishArgs": ["--access", "public"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/CONFIG_GET.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(configKey: string): Array { 4 | return ['GRAPH.CONFIG', 'GET', configKey]; 5 | } 6 | 7 | type ConfigItem = [ 8 | configKey: string, 9 | value: number 10 | ]; 11 | 12 | export declare function transformReply(): ConfigItem | Array; 13 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/CONFIG_SET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(configKey: string, value: number): Array { 2 | return [ 3 | 'GRAPH.CONFIG', 4 | 'SET', 5 | configKey, 6 | value.toString() 7 | ]; 8 | } 9 | 10 | export declare function transformReply(): 'OK'; 11 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/DELETE.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string): Array { 4 | return ['GRAPH.DELETE', key]; 5 | } 6 | 7 | export declare function transformReply(): string; 8 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/EXPLAIN.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, query: string): Array { 6 | return ['GRAPH.EXPLAIN', key, query]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/LIST.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './LIST'; 4 | 5 | describe('LIST', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments(), 9 | ['GRAPH.LIST'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.graph.list', async client => { 14 | assert.deepEqual( 15 | await client.graph.list(), 16 | [] 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/LIST.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(): Array { 4 | return ['GRAPH.LIST']; 5 | } 6 | 7 | export declare function transformReply(): Array; 8 | -------------------------------------------------------------------------------- /packages/graph/lib/commands/PROFILE.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, query: string): Array { 6 | return ['GRAPH.PROFILE', key, query]; 7 | } 8 | 9 | export declare function transformReply(): Array; 10 | -------------------------------------------------------------------------------- /packages/graph/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './commands'; 2 | export { default as Graph } from './graph'; 3 | -------------------------------------------------------------------------------- /packages/graph/lib/test-utils.ts: -------------------------------------------------------------------------------- 1 | import TestUtils from '@redis/test-utils'; 2 | import RedisGraph from '.'; 3 | 4 | export default new TestUtils({ 5 | dockerImageName: 'redislabs/redisgraph', 6 | dockerImageVersionArgument: 'redisgraph-version' 7 | }); 8 | 9 | export const GLOBAL = { 10 | SERVERS: { 11 | OPEN: { 12 | serverArguments: ['--loadmodule /usr/lib/redis/modules/redisgraph.so'], 13 | clientOptions: { 14 | modules: { 15 | graph: RedisGraph 16 | } 17 | } 18 | } 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /packages/graph/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ], 9 | "exclude": [ 10 | "./lib/test-utils.ts", 11 | "./lib/**/*.spec.ts" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "./lib" 16 | ], 17 | "entryPointStrategy": "expand", 18 | "out": "../../documentation/graph" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/json/.npmignore: -------------------------------------------------------------------------------- 1 | .nyc_output/ 2 | coverage/ 3 | lib/ 4 | .nycrc.json 5 | .release-it.json 6 | tsconfig.json 7 | -------------------------------------------------------------------------------- /packages/json/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": ["dist", "**/*.spec.ts", "lib/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/json/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "json@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "publishArgs": ["--access", "public"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/json/lib/commands/ARRAPPEND.ts: -------------------------------------------------------------------------------- 1 | import { RedisJSON, transformRedisJsonArgument } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: string, path: string, ...jsons: Array): Array { 6 | const args = ['JSON.ARRAPPEND', key, path]; 7 | 8 | for (const json of jsons) { 9 | args.push(transformRedisJsonArgument(json)); 10 | } 11 | 12 | return args; 13 | } 14 | 15 | export declare function transformReply(): number | Array; 16 | -------------------------------------------------------------------------------- /packages/json/lib/commands/ARRINSERT.ts: -------------------------------------------------------------------------------- 1 | import { RedisJSON, transformRedisJsonArgument } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: string, path: string, index: number, ...jsons: Array): Array { 6 | const args = ['JSON.ARRINSERT', key, path, index.toString()]; 7 | 8 | for (const json of jsons) { 9 | args.push(transformRedisJsonArgument(json)); 10 | } 11 | 12 | return args; 13 | } 14 | 15 | export declare function transformReply(): number | Array; 16 | -------------------------------------------------------------------------------- /packages/json/lib/commands/ARRLEN.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, path?: string): Array { 6 | const args = ['JSON.ARRLEN', key]; 7 | 8 | if (path) { 9 | args.push(path); 10 | } 11 | 12 | return args; 13 | } 14 | 15 | export declare function transformReply(): number | Array; 16 | -------------------------------------------------------------------------------- /packages/json/lib/commands/ARRTRIM.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path: string, start: number, stop: number): Array { 4 | return ['JSON.ARRTRIM', key, path, start.toString(), stop.toString()]; 5 | } 6 | 7 | export declare function transformReply(): number | Array; 8 | -------------------------------------------------------------------------------- /packages/json/lib/commands/DEBUG_MEMORY.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 2; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.DEBUG', 'MEMORY', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/json/lib/commands/DEL.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.DEL', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/json/lib/commands/FORGET.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.FORGET', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): number; 14 | -------------------------------------------------------------------------------- /packages/json/lib/commands/MERGE.ts: -------------------------------------------------------------------------------- 1 | import { RedisJSON, transformRedisJsonArgument } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(key: string, path: string, json: RedisJSON): Array { 6 | return ['JSON.MERGE', key, path, transformRedisJsonArgument(json)]; 7 | } 8 | 9 | export declare function transformReply(): 'OK'; 10 | -------------------------------------------------------------------------------- /packages/json/lib/commands/MGET.ts: -------------------------------------------------------------------------------- 1 | import { RedisJSON, transformRedisJsonNullReply } from '.'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(keys: Array, path: string): Array { 6 | return [ 7 | 'JSON.MGET', 8 | ...keys, 9 | path 10 | ]; 11 | } 12 | 13 | export function transformReply(reply: Array): Array { 14 | return reply.map(transformRedisJsonNullReply); 15 | } 16 | -------------------------------------------------------------------------------- /packages/json/lib/commands/NUMINCRBY.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path: string, by: number): Array { 4 | return ['JSON.NUMINCRBY', key, path, by.toString()]; 5 | } 6 | 7 | export { transformNumbersReply as transformReply } from '.'; 8 | -------------------------------------------------------------------------------- /packages/json/lib/commands/NUMMULTBY.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path: string, by: number): Array { 4 | return ['JSON.NUMMULTBY', key, path, by.toString()]; 5 | } 6 | 7 | export { transformNumbersReply as transformReply } from '.'; 8 | -------------------------------------------------------------------------------- /packages/json/lib/commands/OBJKEYS.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.OBJKEYS', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): Array | null | Array | null>; 14 | -------------------------------------------------------------------------------- /packages/json/lib/commands/OBJLEN.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.OBJLEN', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): number | null | Array; 14 | -------------------------------------------------------------------------------- /packages/json/lib/commands/RESP.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.RESP', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | type RESPReply = Array; 14 | 15 | export declare function transformReply(): RESPReply; 16 | -------------------------------------------------------------------------------- /packages/json/lib/commands/STRLEN.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export const IS_READ_ONLY = true; 4 | 5 | export function transformArguments(key: string, path?: string): Array { 6 | const args = ['JSON.STRLEN', key]; 7 | 8 | if (path) { 9 | args.push(path); 10 | } 11 | 12 | return args; 13 | } 14 | 15 | export declare function transformReply(): number; 16 | -------------------------------------------------------------------------------- /packages/json/lib/commands/TYPE.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(key: string, path?: string): Array { 4 | const args = ['JSON.TYPE', key]; 5 | 6 | if (path) { 7 | args.push(path); 8 | } 9 | 10 | return args; 11 | } 12 | 13 | export declare function transformReply(): string | null | Array; 14 | -------------------------------------------------------------------------------- /packages/json/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './commands'; 2 | -------------------------------------------------------------------------------- /packages/json/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ], 9 | "exclude": [ 10 | "./lib/test-utils.ts", 11 | "./lib/**/*.spec.ts" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "./lib" 16 | ], 17 | "entryPointStrategy": "expand", 18 | "out": "../../documentation/json" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/search/.npmignore: -------------------------------------------------------------------------------- 1 | .nyc_output/ 2 | coverage/ 3 | lib/ 4 | .nycrc.json 5 | .release-it.json 6 | tsconfig.json 7 | -------------------------------------------------------------------------------- /packages/search/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": ["dist", "**/*.spec.ts", "lib/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/search/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "search@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "publishArgs": ["--access", "public"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASADD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './ALIASADD'; 3 | 4 | describe('ALIASADD', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('alias', 'index'), 8 | ['FT.ALIASADD', 'alias', 'index'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASADD.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(name: string, index: string): Array { 2 | return ['FT.ALIASADD', name, index]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASDEL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './ALIASDEL'; 3 | 4 | describe('ALIASDEL', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('alias', 'index'), 8 | ['FT.ALIASDEL', 'alias', 'index'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASDEL.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(name: string, index: string): Array { 2 | return ['FT.ALIASDEL', name, index]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASUPDATE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './ALIASUPDATE'; 3 | 4 | describe('ALIASUPDATE', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('alias', 'index'), 8 | ['FT.ALIASUPDATE', 'alias', 'index'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASUPDATE.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(name: string, index: string): Array { 2 | return ['FT.ALIASUPDATE', name, index]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALTER.ts: -------------------------------------------------------------------------------- 1 | import { RediSearchSchema, pushSchema } from '.'; 2 | 3 | export function transformArguments(index: string, schema: RediSearchSchema): Array { 4 | const args = ['FT.ALTER', index, 'SCHEMA', 'ADD']; 5 | pushSchema(args, schema); 6 | 7 | return args; 8 | } 9 | 10 | export declare function transformReply(): 'OK'; 11 | -------------------------------------------------------------------------------- /packages/search/lib/commands/CONFIG_GET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(option: string) { 2 | return ['FT.CONFIG', 'GET', option]; 3 | } 4 | 5 | interface ConfigGetReply { 6 | [option: string]: string | null; 7 | } 8 | 9 | export function transformReply(rawReply: Array<[string, string | null]>): ConfigGetReply { 10 | const transformedReply: ConfigGetReply = Object.create(null); 11 | for (const [key, value] of rawReply) { 12 | transformedReply[key] = value; 13 | } 14 | 15 | return transformedReply; 16 | } 17 | -------------------------------------------------------------------------------- /packages/search/lib/commands/CONFIG_SET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './CONFIG_SET'; 4 | 5 | describe('CONFIG SET', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments('TIMEOUT', '500'), 9 | ['FT.CONFIG', 'SET', 'TIMEOUT', '500'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/search/lib/commands/CONFIG_SET.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(option: string, value: string): Array { 2 | return ['FT.CONFIG', 'SET', option, value]; 3 | } 4 | 5 | export declare function transformReply(): 'OK'; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/CURSOR_DEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArgument } from '@redis/client/dist/lib/commands'; 2 | 3 | export const FIRST_KEY_INDEX = 1; 4 | 5 | export function transformArguments(index: RedisCommandArgument, cursorId: number) { 6 | return [ 7 | 'FT.CURSOR', 8 | 'DEL', 9 | index, 10 | cursorId.toString() 11 | ]; 12 | } 13 | 14 | export declare function transformReply(): 'OK'; 15 | -------------------------------------------------------------------------------- /packages/search/lib/commands/DICTADD.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | 4 | export function transformArguments(dictionary: string, term: string | Array): RedisCommandArguments { 5 | return pushVerdictArguments(['FT.DICTADD', dictionary], term); 6 | } 7 | 8 | export declare function transformReply(): number; 9 | -------------------------------------------------------------------------------- /packages/search/lib/commands/DICTDEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | 4 | export function transformArguments(dictionary: string, term: string | Array): RedisCommandArguments { 5 | return pushVerdictArguments(['FT.DICTDEL', dictionary], term); 6 | } 7 | 8 | export declare function transformReply(): number; 9 | -------------------------------------------------------------------------------- /packages/search/lib/commands/DICTDUMP.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(dictionary: string): Array { 2 | return ['FT.DICTDUMP', dictionary]; 3 | } 4 | 5 | export declare function transformReply(): Array; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/DROPINDEX.ts: -------------------------------------------------------------------------------- 1 | interface DropIndexOptions { 2 | DD?: true; 3 | } 4 | 5 | export function transformArguments(index: string, options?: DropIndexOptions): Array { 6 | const args = ['FT.DROPINDEX', index]; 7 | 8 | if (options?.DD) { 9 | args.push('DD'); 10 | } 11 | 12 | return args; 13 | } 14 | 15 | export declare function transformReply(): 'OK'; 16 | -------------------------------------------------------------------------------- /packages/search/lib/commands/EXPLAINCLI.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import { transformArguments } from './EXPLAINCLI'; 3 | 4 | describe('EXPLAINCLI', () => { 5 | it('transformArguments', () => { 6 | assert.deepEqual( 7 | transformArguments('index', '*'), 8 | ['FT.EXPLAINCLI', 'index', '*'] 9 | ); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/EXPLAINCLI.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(index: string, query: string): Array { 4 | return ['FT.EXPLAINCLI', index, query]; 5 | } 6 | 7 | export declare function transformReply(): Array; 8 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SUGADD.ts: -------------------------------------------------------------------------------- 1 | interface SugAddOptions { 2 | INCR?: true; 3 | PAYLOAD?: string; 4 | } 5 | 6 | export function transformArguments(key: string, string: string, score: number, options?: SugAddOptions): Array { 7 | const args = ['FT.SUGADD', key, string, score.toString()]; 8 | 9 | if (options?.INCR) { 10 | args.push('INCR'); 11 | } 12 | 13 | if (options?.PAYLOAD) { 14 | args.push('PAYLOAD', options.PAYLOAD); 15 | } 16 | 17 | return args; 18 | } 19 | 20 | export declare function transformReply(): number; 21 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SUGDEL.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(key: string, string: string): Array { 2 | return ['FT.SUGDEL', key, string]; 3 | } 4 | 5 | export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers'; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SUGGET.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export interface SugGetOptions { 4 | FUZZY?: true; 5 | MAX?: number; 6 | } 7 | 8 | export function transformArguments(key: string, prefix: string, options?: SugGetOptions): Array { 9 | const args = ['FT.SUGGET', key, prefix]; 10 | 11 | if (options?.FUZZY) { 12 | args.push('FUZZY'); 13 | } 14 | 15 | if (options?.MAX) { 16 | args.push('MAX', options.MAX.toString()); 17 | } 18 | 19 | return args; 20 | } 21 | 22 | export declare function transformReply(): null | Array; 23 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SUGLEN.ts: -------------------------------------------------------------------------------- 1 | export const IS_READ_ONLY = true; 2 | 3 | export function transformArguments(key: string): Array { 4 | return ['FT.SUGLEN', key]; 5 | } 6 | 7 | export declare function transformReply(): number; 8 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SYNDUMP.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(index: string): Array { 2 | return ['FT.SYNDUMP', index]; 3 | } 4 | 5 | export declare function transformReply(): Array; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/TAGVALS.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(index: string, fieldName: string): Array { 2 | return ['FT.TAGVALS', index, fieldName]; 3 | } 4 | 5 | export declare function transformReply(): Array; 6 | -------------------------------------------------------------------------------- /packages/search/lib/commands/_LIST.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import { transformArguments } from './_LIST'; 4 | 5 | describe('_LIST', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | transformArguments(), 9 | ['FT._LIST'] 10 | ); 11 | }); 12 | 13 | testUtils.testWithClient('client.ft._list', async client => { 14 | assert.deepEqual( 15 | await client.ft._list(), 16 | [] 17 | ); 18 | }, GLOBAL.SERVERS.OPEN); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/search/lib/commands/_LIST.ts: -------------------------------------------------------------------------------- 1 | export function transformArguments(): Array { 2 | return ['FT._LIST']; 3 | } 4 | 5 | export declare function transformReply(): Array; 6 | -------------------------------------------------------------------------------- /packages/search/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './commands'; 2 | 3 | export { RediSearchSchema, RedisSearchLanguages, SchemaFieldTypes, SchemaTextFieldPhonetics, SearchReply, VectorAlgorithms } from './commands'; 4 | export { AggregateGroupByReducers, AggregateSteps } from './commands/AGGREGATE'; 5 | export { SearchOptions } from './commands/SEARCH'; 6 | -------------------------------------------------------------------------------- /packages/search/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ], 9 | "exclude": [ 10 | "./lib/test-utils.ts", 11 | "./lib/**/*.spec.ts" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "./lib" 16 | ], 17 | "entryPointStrategy": "expand", 18 | "out": "../../documentation/search" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/test-utils/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG IMAGE 2 | FROM ${IMAGE} 3 | 4 | ARG REDIS_ARGUMENTS 5 | ENV REDIS_ARGUMENTS=${REDIS_ARGUMENTS} 6 | 7 | COPY ./entrypoint.sh / 8 | 9 | ENTRYPOINT ["/entrypoint.sh"] 10 | -------------------------------------------------------------------------------- /packages/test-utils/docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | redis-server $REDIS_ARGUMENTS 4 | -------------------------------------------------------------------------------- /packages/test-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /packages/time-series/.npmignore: -------------------------------------------------------------------------------- 1 | .nyc_output/ 2 | coverage/ 3 | lib/ 4 | .nycrc.json 5 | .release-it.json 6 | tsconfig.json 7 | -------------------------------------------------------------------------------- /packages/time-series/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": ["dist", "**/*.spec.ts", "lib/test-utils.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /packages/time-series/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "time-series@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "publishArgs": ["--access", "public"] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/DECRBY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { IncrDecrOptions, transformIncrDecrArguments } from '.'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments(key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments { 7 | return transformIncrDecrArguments('TS.DECRBY', key, value, options); 8 | } 9 | 10 | export declare function transformReply(): number; 11 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/DEL.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { Timestamp, transformTimestampArgument } from '.'; 3 | 4 | export const FIRTS_KEY_INDEX = 1; 5 | 6 | export function transformArguments(key: string, fromTimestamp: Timestamp, toTimestamp: Timestamp): RedisCommandArguments { 7 | return [ 8 | 'TS.DEL', 9 | key, 10 | transformTimestampArgument(fromTimestamp), 11 | transformTimestampArgument(toTimestamp) 12 | ]; 13 | } 14 | 15 | export declare function transformReply(): number; 16 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/DELETERULE.ts: -------------------------------------------------------------------------------- 1 | export const FIRST_KEY_INDEX = 1; 2 | 3 | export function transformArguments(sourceKey: string, destinationKey: string): Array { 4 | return [ 5 | 'TS.DELETERULE', 6 | sourceKey, 7 | destinationKey 8 | ]; 9 | } 10 | 11 | export declare function transformReply(): 'OK'; 12 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/INCRBY.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { IncrDecrOptions, transformIncrDecrArguments } from '.'; 3 | 4 | export const FIRST_KEY_INDEX = 1; 5 | 6 | export function transformArguments(key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments { 7 | return transformIncrDecrArguments('TS.INCRBY', key, value, options); 8 | } 9 | 10 | export declare function transformReply(): number; 11 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/QUERYINDEX.ts: -------------------------------------------------------------------------------- 1 | import { RedisCommandArguments } from '@redis/client/dist/lib/commands'; 2 | import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers'; 3 | import { Filter } from '.'; 4 | 5 | export const IS_READ_ONLY = true; 6 | 7 | export function transformArguments(filter: Filter): RedisCommandArguments { 8 | return pushVerdictArguments(['TS.QUERYINDEX'], filter); 9 | } 10 | 11 | export declare function transformReply(): Array; 12 | -------------------------------------------------------------------------------- /packages/time-series/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './commands'; 2 | 3 | export { 4 | TimeSeriesDuplicatePolicies, 5 | TimeSeriesEncoding, 6 | TimeSeriesAggregationType, 7 | TimeSeriesReducers, 8 | TimeSeriesBucketTimestamp 9 | } from './commands'; 10 | -------------------------------------------------------------------------------- /packages/time-series/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ], 9 | "exclude": [ 10 | "./lib/test-utils.ts", 11 | "./lib/**/*.spec.ts" 12 | ], 13 | "typedocOptions": { 14 | "entryPoints": [ 15 | "./lib" 16 | ], 17 | "entryPointStrategy": "expand", 18 | "out": "../../documentation/time-series" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@tsconfig/node14/tsconfig.json", 3 | "compilerOptions": { 4 | "declaration": true, 5 | "allowJs": true, 6 | "useDefineForClassFields": true, 7 | "esModuleInterop": false, 8 | "resolveJsonModule": true 9 | }, 10 | "ts-node": { 11 | "files": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./index.ts" 8 | ] 9 | } 10 | --------------------------------------------------------------------------------