├── .deepsource.toml ├── .github ├── ISSUE_TEMPLATE │ ├── BUG-REPORT.yml │ ├── DOCUMENTATION.yml │ └── FEATURE-REQUEST.yml ├── PULL_REQUEST_TEMPLATE.md ├── release-drafter-base.yml ├── release-drafter │ ├── bloom-config.yml │ ├── entraid-config.yml │ ├── json-config.yml │ ├── search-config.yml │ └── time-series-config.yml └── workflows │ ├── codeql.yml │ ├── documentation.yml │ ├── release-drafter-bloom.yml │ ├── release-drafter-entraid.yml │ ├── release-drafter-json.yml │ ├── release-drafter-search.yml │ ├── release-drafter-time-series.yml │ └── tests.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── benchmark ├── .gitignore ├── lib │ ├── defaults.yml │ ├── index.js │ ├── ping │ │ ├── ioredis-auto-pipeline.js │ │ ├── ioredis.js │ │ ├── local-resp2.js │ │ ├── local-resp3-buffer-proxy.js │ │ ├── local-resp3-buffer.js │ │ ├── local-resp3-module-with-flags.js │ │ ├── local-resp3-module.js │ │ ├── local-resp3.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 ├── RESP.md ├── client-configuration.md ├── clustering.md ├── command-options.md ├── pool.md ├── programmability.md ├── pub-sub.md ├── scan-iterators.md ├── sentinel.md ├── todo.md ├── transactions.md ├── v3-to-v4.md ├── v4-to-v5.md └── v5.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 ├── package-lock.json ├── package.json ├── packages ├── bloom │ ├── .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 │ │ │ │ ├── helpers.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.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.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 │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── index.ts │ ├── lib │ │ ├── RESP │ │ │ ├── decoder.spec.ts │ │ │ ├── decoder.ts │ │ │ ├── encoder.spec.ts │ │ │ ├── encoder.ts │ │ │ ├── types.ts │ │ │ └── verbatim-string.ts │ │ ├── authx │ │ │ ├── credentials-provider.ts │ │ │ ├── disposable.ts │ │ │ ├── identity-provider.ts │ │ │ ├── index.ts │ │ │ ├── token-manager.spec.ts │ │ │ ├── token-manager.ts │ │ │ └── token.ts │ │ ├── client │ │ │ ├── cache.spec.ts │ │ │ ├── cache.ts │ │ │ ├── commands-queue.ts │ │ │ ├── index.spec.ts │ │ │ ├── index.ts │ │ │ ├── legacy-mode.spec.ts │ │ │ ├── legacy-mode.ts │ │ │ ├── linked-list.spec.ts │ │ │ ├── linked-list.ts │ │ │ ├── multi-command.ts │ │ │ ├── parser.ts │ │ │ ├── pool.spec.ts │ │ │ ├── pool.ts │ │ │ ├── pub-sub.spec.ts │ │ │ ├── pub-sub.ts │ │ │ ├── socket.spec.ts │ │ │ └── socket.ts │ │ ├── cluster │ │ │ ├── cluster-slots.spec.ts │ │ │ ├── cluster-slots.ts │ │ │ ├── index.spec.ts │ │ │ ├── index.ts │ │ │ └── multi-command.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 │ │ │ ├── GEORADIUSBYMEMBER_RO.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_RO.ts │ │ │ ├── GEORADIUSBYMEMBER_RO_WITH.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_RO_WITH.ts │ │ │ ├── GEORADIUSBYMEMBER_STORE.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_STORE.ts │ │ │ ├── GEORADIUSBYMEMBER_WITH.spec.ts │ │ │ ├── GEORADIUSBYMEMBER_WITH.ts │ │ │ ├── GEORADIUS_RO.spec.ts │ │ │ ├── GEORADIUS_RO.ts │ │ │ ├── GEORADIUS_RO_WITH.spec.ts │ │ │ ├── GEORADIUS_RO_WITH.ts │ │ │ ├── GEORADIUS_STORE.spec.ts │ │ │ ├── GEORADIUS_STORE.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 │ │ │ ├── HEXPIRE.spec.ts │ │ │ ├── HEXPIRE.ts │ │ │ ├── HEXPIREAT.spec.ts │ │ │ ├── HEXPIREAT.ts │ │ │ ├── HEXPIRETIME.spec.ts │ │ │ ├── HEXPIRETIME.ts │ │ │ ├── HGET.spec.ts │ │ │ ├── HGET.ts │ │ │ ├── HGETALL.spec.ts │ │ │ ├── HGETALL.ts │ │ │ ├── HGETDEL.spec.ts │ │ │ ├── HGETDEL.ts │ │ │ ├── HGETEX.spec.ts │ │ │ ├── HGETEX.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 │ │ │ ├── HPERSIST.spec.ts │ │ │ ├── HPERSIST.ts │ │ │ ├── HPEXPIRE.spec.ts │ │ │ ├── HPEXPIRE.ts │ │ │ ├── HPEXPIREAT.spec.ts │ │ │ ├── HPEXPIREAT.ts │ │ │ ├── HPEXPIRETIME.spec.ts │ │ │ ├── HPEXPIRETIME.ts │ │ │ ├── HPTTL.spec.ts │ │ │ ├── HPTTL.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 │ │ │ ├── HSCAN_NOVALUES.spec.ts │ │ │ ├── HSCAN_NOVALUES.ts │ │ │ ├── HSET.spec.ts │ │ │ ├── HSET.ts │ │ │ ├── HSETEX.spec.ts │ │ │ ├── HSETEX.ts │ │ │ ├── HSETNX.spec.ts │ │ │ ├── HSETNX.ts │ │ │ ├── HSTRLEN.spec.ts │ │ │ ├── HSTRLEN.ts │ │ │ ├── HTTL.spec.ts │ │ │ ├── HTTL.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 │ │ │ ├── SPOP_COUNT.spec.ts │ │ │ ├── SPOP_COUNT.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 │ │ │ ├── WAIT.spec.ts │ │ │ ├── WAIT.ts │ │ │ ├── XACK.spec.ts │ │ │ ├── XACK.ts │ │ │ ├── XADD.spec.ts │ │ │ ├── XADD.ts │ │ │ ├── XADD_NOMKSTREAM.spec.ts │ │ │ ├── XADD_NOMKSTREAM.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 │ │ │ ├── ZADD_INCR.spec.ts │ │ │ ├── ZADD_INCR.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 │ │ │ ├── ZRANK_WITHSCORE.spec.ts │ │ │ ├── ZRANK_WITHSCORE.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 │ │ ├── sentinel │ │ │ ├── commands │ │ │ │ ├── SENTINEL_MASTER.ts │ │ │ │ ├── SENTINEL_MONITOR.ts │ │ │ │ ├── SENTINEL_REPLICAS.ts │ │ │ │ ├── SENTINEL_SENTINELS.ts │ │ │ │ ├── SENTINEL_SET.ts │ │ │ │ └── index.ts │ │ │ ├── index.spec.ts │ │ │ ├── index.ts │ │ │ ├── module.ts │ │ │ ├── multi-commands.ts │ │ │ ├── pub-sub-proxy.ts │ │ │ ├── test-util.ts │ │ │ ├── types.ts │ │ │ ├── utils.ts │ │ │ └── wait-queue.ts │ │ ├── single-entry-cache.spec.ts │ │ ├── single-entry-cache.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── entraid │ ├── .nycrc.json │ ├── .release-it.json │ ├── README.md │ ├── index.ts │ ├── integration-tests │ │ └── entraid-integration.spec.ts │ ├── lib │ │ ├── azure-identity-provider.ts │ │ ├── entra-id-credentials-provider-factory.ts │ │ ├── entraid-credentials-provider.spec.ts │ │ ├── entraid-credentials-provider.ts │ │ ├── index.ts │ │ ├── msal-identity-provider.ts │ │ └── test-utils.ts │ ├── package.json │ ├── samples │ │ ├── auth-code-pkce │ │ │ └── index.ts │ │ └── interactive-browser │ │ │ └── index.ts │ ├── tsconfig.integration-tests.json │ ├── tsconfig.json │ └── tsconfig.samples.json ├── json │ ├── .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 │ │ │ ├── CLEAR.spec.ts │ │ │ ├── CLEAR.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 │ │ │ ├── TOGGLE.spec.ts │ │ │ ├── TOGGLE.ts │ │ │ ├── TYPE.spec.ts │ │ │ ├── TYPE.ts │ │ │ ├── helpers.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── redis │ ├── .release-it.json │ ├── README.md │ ├── index.ts │ ├── package.json │ └── tsconfig.json ├── search │ ├── .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 │ │ ├── dialect │ │ │ └── default.ts │ │ ├── index.ts │ │ └── test-utils.ts │ ├── package.json │ └── tsconfig.json ├── test-utils │ ├── docker │ │ ├── Dockerfile │ │ └── entrypoint.sh │ ├── lib │ │ ├── cae-client-testing.ts │ │ ├── dockers.ts │ │ ├── index.spec.ts │ │ └── index.ts │ ├── package.json │ └── tsconfig.json └── time-series │ ├── .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_SELECTED_LABELS.spec.ts │ │ ├── MGET_SELECTED_LABELS.ts │ │ ├── MGET_WITHLABELS.spec.ts │ │ ├── MGET_WITHLABELS.ts │ │ ├── MRANGE.spec.ts │ │ ├── MRANGE.ts │ │ ├── MRANGE_GROUPBY.spec.ts │ │ ├── MRANGE_GROUPBY.ts │ │ ├── MRANGE_SELECTED_LABELS.spec.ts │ │ ├── MRANGE_SELECTED_LABELS.ts │ │ ├── MRANGE_SELECTED_LABELS_GROUPBY.spec.ts │ │ ├── MRANGE_SELECTED_LABELS_GROUPBY.ts │ │ ├── MRANGE_WITHLABELS.spec.ts │ │ ├── MRANGE_WITHLABELS.ts │ │ ├── MRANGE_WITHLABELS_GROUPBY.spec.ts │ │ ├── MRANGE_WITHLABELS_GROUPBY.ts │ │ ├── MREVRANGE.spec.ts │ │ ├── MREVRANGE.ts │ │ ├── MREVRANGE_GROUPBY.spec.ts │ │ ├── MREVRANGE_GROUPBY.ts │ │ ├── MREVRANGE_SELECTED_LABELS.spec.ts │ │ ├── MREVRANGE_SELECTED_LABELS.ts │ │ ├── MREVRANGE_SELECTED_LABELS_GROUPBY.spec.ts │ │ ├── MREVRANGE_SELECTED_LABELS_GROUPBY.ts │ │ ├── MREVRANGE_WITHLABELS.spec.ts │ │ ├── MREVRANGE_WITHLABELS.ts │ │ ├── MREVRANGE_WITHLABELS_GROUPBY.spec.ts │ │ ├── MREVRANGE_WITHLABELS_GROUPBY.ts │ │ ├── QUERYINDEX.spec.ts │ │ ├── QUERYINDEX.ts │ │ ├── RANGE.spec.ts │ │ ├── RANGE.ts │ │ ├── REVRANGE.spec.ts │ │ ├── REVRANGE.ts │ │ ├── helpers.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 | tsconfig.tsbuildinfo 11 | -------------------------------------------------------------------------------- /benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | *.js.json 2 | -------------------------------------------------------------------------------- /benchmark/lib/ping/ioredis-auto-pipeline.js: -------------------------------------------------------------------------------- 1 | import Redis from 'ioredis'; 2 | 3 | export default async (host) => { 4 | const client = new Redis({ 5 | host, 6 | lazyConnect: true, 7 | enableAutoPipelining: true 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/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/local-resp2.js: -------------------------------------------------------------------------------- 1 | import { createClient } from 'redis-local'; 2 | 3 | export default async (host) => { 4 | const client = createClient({ 5 | socket: { 6 | host 7 | }, 8 | RESP: 2 9 | }); 10 | 11 | await client.connect(); 12 | 13 | return { 14 | benchmark() { 15 | return client.ping(); 16 | }, 17 | teardown() { 18 | return client.disconnect(); 19 | } 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /benchmark/lib/ping/local-resp3-buffer-proxy.js: -------------------------------------------------------------------------------- 1 | import { createClient, RESP_TYPES } from 'redis-local'; 2 | 3 | export default async (host) => { 4 | const client = createClient({ 5 | socket: { 6 | host 7 | }, 8 | RESP: 3 9 | }).withTypeMapping({ 10 | [RESP_TYPES.SIMPLE_STRING]: Buffer 11 | }); 12 | 13 | await client.connect(); 14 | 15 | return { 16 | benchmark() { 17 | return client.ping(); 18 | }, 19 | teardown() { 20 | return client.disconnect(); 21 | } 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /benchmark/lib/ping/local-resp3-buffer.js: -------------------------------------------------------------------------------- 1 | import { createClient, RESP_TYPES } from 'redis-local'; 2 | 3 | export default async (host) => { 4 | const client = createClient({ 5 | socket: { 6 | host 7 | }, 8 | commandOptions: { 9 | [RESP_TYPES.SIMPLE_STRING]: Buffer 10 | }, 11 | RESP: 3 12 | }); 13 | 14 | await client.connect(); 15 | 16 | return { 17 | benchmark() { 18 | return client.ping(); 19 | }, 20 | teardown() { 21 | return client.disconnect(); 22 | } 23 | }; 24 | }; 25 | -------------------------------------------------------------------------------- /benchmark/lib/ping/local-resp3-module-with-flags.js: -------------------------------------------------------------------------------- 1 | import { createClient } from 'redis-local'; 2 | import PING from 'redis-local/dist/lib/commands/PING.js'; 3 | 4 | export default async (host) => { 5 | const client = createClient({ 6 | socket: { 7 | host 8 | }, 9 | RESP: 3, 10 | modules: { 11 | module: { 12 | ping: PING.default 13 | } 14 | } 15 | }); 16 | 17 | await client.connect(); 18 | 19 | return { 20 | benchmark() { 21 | return client.withTypeMapping({}).module.ping(); 22 | }, 23 | teardown() { 24 | return client.disconnect(); 25 | } 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /benchmark/lib/ping/local-resp3-module.js: -------------------------------------------------------------------------------- 1 | import { createClient } from 'redis-local'; 2 | import PING from 'redis-local/dist/lib/commands/PING.js'; 3 | 4 | export default async (host) => { 5 | const client = createClient({ 6 | socket: { 7 | host 8 | }, 9 | RESP: 3, 10 | modules: { 11 | module: { 12 | ping: PING.default 13 | } 14 | } 15 | }); 16 | 17 | await client.connect(); 18 | 19 | return { 20 | benchmark() { 21 | return client.module.ping(); 22 | }, 23 | teardown() { 24 | return client.disconnect(); 25 | } 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /benchmark/lib/ping/local-resp3.js: -------------------------------------------------------------------------------- 1 | import { createClient } from 'redis-local'; 2 | 3 | export default async (host) => { 4 | const client = createClient({ 5 | socket: { 6 | host 7 | }, 8 | RESP: 3 9 | }); 10 | 11 | await client.connect(); 12 | 13 | return { 14 | benchmark() { 15 | return client.ping(); 16 | }, 17 | teardown() { 18 | return client.disconnect(); 19 | } 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /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 'node:events'; 3 | import { promisify } from 'node: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-v4'; 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 'node: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/lib/set-get-delete-string/ioredis.js: -------------------------------------------------------------------------------- 1 | import Redis from 'ioredis'; 2 | 3 | export default async (host, { randomString }) => { 4 | const client = new Redis({ 5 | host, 6 | lazyConnect: true 7 | }); 8 | 9 | await client.connect(); 10 | 11 | return { 12 | benchmark() { 13 | return Promise.all([ 14 | client.set(randomString, randomString), 15 | client.get(randomString), 16 | client.del(randomString) 17 | ]); 18 | }, 19 | teardown() { 20 | return client.disconnect(); 21 | } 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /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 | "hdr-histogram-js": "3.0.0", 11 | "ioredis": "5", 12 | "redis-local": "file:../packages/client", 13 | "redis-v3": "npm:redis@3", 14 | "redis-v4": "npm:redis@4", 15 | "yargs": "17.7.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /benchmark/requirements.txt: -------------------------------------------------------------------------------- 1 | redisbench_admin>=0.5.24 2 | -------------------------------------------------------------------------------- /docs/todo.md: -------------------------------------------------------------------------------- 1 | - "Isolation Pool" -> pool 2 | - Cluster request response policies (either implement, or block "server" commands in cluster) 3 | 4 | Docs: 5 | - [Command Options](./command-options.md) 6 | - [RESP](./RESP.md) 7 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | -------------------------------------------------------------------------------- /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 | // In v5, TIME returns [unixTimestamp: string, microseconds: string] instead of Date 10 | // Example: ['1708956789', '123456'] 11 | console.log(serverTime); 12 | 13 | // Convert to JavaScript Date if needed 14 | const [seconds, microseconds] = serverTime; 15 | const date = new Date(parseInt(seconds) * 1000 + parseInt(microseconds) / 1000); 16 | console.log('Converted to Date:', date); 17 | 18 | client.close(); 19 | -------------------------------------------------------------------------------- /examples/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-redis-examples", 3 | "version": "1.0.0", 4 | "description": "node-redis 5 example script", 5 | "main": "index.js", 6 | "private": true, 7 | "type": "module", 8 | "dependencies": { 9 | "redis": "../packages/redis" 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /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 | "versionArgs": ["--workspaces-update=false"], 9 | "publishArgs": ["--access", "public"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/ADD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 8 | parser.push('BF.ADD'); 9 | parser.pushKey(key); 10 | parser.push(item); 11 | }, 12 | transformReply: transformBooleanReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/CARD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('BF.CARD'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/EXISTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 8 | parser.push('BF.EXISTS'); 9 | parser.pushKey(key); 10 | parser.push(item); 11 | }, 12 | transformReply: transformBooleanReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/bloom/LOADCHUNK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) { 7 | parser.push('BF.LOADCHUNK'); 8 | parser.pushKey(key); 9 | parser.push(iterator.toString(), chunk); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/INITBYDIM.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, width: number, depth: number) { 7 | parser.push('CMS.INITBYDIM'); 8 | parser.pushKey(key); 9 | parser.push(width.toString(), depth.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/INITBYPROB.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, error: number, probability: number) { 7 | parser.push('CMS.INITBYPROB'); 8 | parser.pushKey(key); 9 | parser.push(error.toString(), probability.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/count-min-sketch/index.ts: -------------------------------------------------------------------------------- 1 | import type { RedisCommands } from '@redis/client/dist/lib/RESP/types'; 2 | import INCRBY from './INCRBY'; 3 | import INFO from './INFO'; 4 | import INITBYDIM from './INITBYDIM'; 5 | import INITBYPROB from './INITBYPROB'; 6 | import MERGE from './MERGE'; 7 | import QUERY from './QUERY'; 8 | 9 | export default { 10 | INCRBY, 11 | incrBy: INCRBY, 12 | INFO, 13 | info: INFO, 14 | INITBYDIM, 15 | initByDim: INITBYDIM, 16 | INITBYPROB, 17 | initByProb: INITBYPROB, 18 | MERGE, 19 | merge: MERGE, 20 | QUERY, 21 | query: QUERY 22 | } as const satisfies RedisCommands; 23 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/ADD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 8 | parser.push('CF.ADD'); 9 | parser.pushKey(key); 10 | parser.push(item); 11 | }, 12 | transformReply: transformBooleanReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/ADDNX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 8 | parser.push('CF.ADDNX'); 9 | parser.pushKey(key); 10 | parser.push(item); 11 | }, 12 | transformReply: transformBooleanReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 7 | parser.push('CF.COUNT'); 8 | parser.pushKey(key); 9 | parser.push(item); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/DEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 8 | parser.push('CF.DEL'); 9 | parser.pushKey(key); 10 | parser.push(item); 11 | }, 12 | transformReply: transformBooleanReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/EXISTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { 8 | parser.push('CF.EXISTS'); 9 | parser.pushKey(key); 10 | parser.push(item); 11 | }, 12 | transformReply: transformBooleanReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/INSERTNX.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import INSERT, { parseCfInsertArguments } from './INSERT'; 3 | 4 | export default { 5 | IS_READ_ONLY: INSERT.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('CF.INSERTNX'); 8 | parseCfInsertArguments(...args); 9 | }, 10 | transformReply: INSERT.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/cuckoo/LOADCHUNK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) { 7 | parser.push('CF.LOADCHUNK'); 8 | parser.pushKey(key); 9 | parser.push(iterator.toString(), chunk); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/index.ts: -------------------------------------------------------------------------------- 1 | import { RedisModules } from '@redis/client'; 2 | import bf from './bloom'; 3 | import cms from './count-min-sketch'; 4 | import cf from './cuckoo'; 5 | import tDigest from './t-digest'; 6 | import topK from './top-k'; 7 | 8 | export default { 9 | bf, 10 | cms, 11 | cf, 12 | tDigest, 13 | topK 14 | } as const satisfies RedisModules; 15 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/ADD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, values: Array) { 7 | parser.push('TDIGEST.ADD'); 8 | parser.pushKey(key); 9 | 10 | for (const value of values) { 11 | parser.push(value.toString()); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/BYREVRANK.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import BYRANK, { transformByRankArguments } from './BYRANK'; 3 | 4 | export default { 5 | IS_READ_ONLY: BYRANK.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('TDIGEST.BYREVRANK'); 8 | transformByRankArguments(...args); 9 | }, 10 | transformReply: BYRANK.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/MAX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformDoubleReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('TDIGEST.MAX'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: transformDoubleReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/MIN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import { transformDoubleReply } from '@redis/client/dist/lib/commands/generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('TDIGEST.MIN'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: transformDoubleReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/RESET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('TDIGEST.RESET'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/t-digest/REVRANK.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import RANK, { transformRankArguments } from './RANK'; 3 | 4 | export default { 5 | IS_READ_ONLY: RANK.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('TDIGEST.REVRANK'); 8 | transformRankArguments(...args); 9 | }, 10 | transformReply: RANK.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/bloom/lib/commands/top-k/LIST.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('TOPK.LIST'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /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 TestUtils.createFromConfig({ 5 | dockerImageName: 'redislabs/client-libs-test', 6 | dockerImageVersionArgument: 'redis-version', 7 | defaultDockerVersion: '8.0-M05-pre' 8 | }); 9 | 10 | export const GLOBAL = { 11 | SERVERS: { 12 | OPEN: { 13 | serverArguments: [], 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/.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 | "versionArgs": ["--workspaces-update=false"], 9 | "publishArgs": ["--access", "public"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /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/RESP/verbatim-string.ts: -------------------------------------------------------------------------------- 1 | export class VerbatimString extends String { 2 | constructor( 3 | public format: string, 4 | value: string 5 | ) { 6 | super(value); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/client/lib/authx/disposable.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Represents a resource that can be disposed. 3 | */ 4 | export interface Disposable { 5 | dispose(): void; 6 | } -------------------------------------------------------------------------------- /packages/client/lib/authx/index.ts: -------------------------------------------------------------------------------- 1 | export { TokenManager, TokenManagerConfig, TokenStreamListener, RetryPolicy, IDPError } from './token-manager'; 2 | export { 3 | CredentialsProvider, 4 | StreamingCredentialsProvider, 5 | UnableToObtainNewCredentialsError, 6 | CredentialsError, 7 | StreamingCredentialsListener, 8 | AsyncCredentialsProvider, 9 | ReAuthenticationError, 10 | BasicAuth 11 | } from './credentials-provider'; 12 | export { Token } from './token'; 13 | export { IdentityProvider, TokenResponse } from './identity-provider'; 14 | 15 | export { Disposable } from './disposable' -------------------------------------------------------------------------------- /packages/client/lib/client/pool.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | 4 | describe('RedisClientPool', () => { 5 | testUtils.testWithClientPool('sendCommand', async pool => { 6 | assert.equal( 7 | await pool.sendCommand(['PING']), 8 | 'PONG' 9 | ); 10 | }, GLOBAL.SERVERS.OPEN); 11 | }); 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_CAT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, categoryName?: RedisArgument) { 8 | parser.push('ACL', 'CAT'); 9 | if (categoryName) { 10 | parser.push(categoryName); 11 | } 12 | }, 13 | transformReply: undefined as unknown as () => ArrayReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_DELUSER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, username: RedisVariadicArgument) { 9 | parser.push('ACL', 'DELUSER'); 10 | parser.pushVariadic(username); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_DRYRUN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, username: RedisArgument, command: Array) { 8 | parser.push('ACL', 'DRYRUN', username, ...command); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> | BlobStringReply 11 | } as const satisfies Command; 12 | 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_GENPASS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, bits?: number) { 8 | parser.push('ACL', 'GENPASS'); 9 | if (bits) { 10 | parser.push(bits.toString()); 11 | } 12 | }, 13 | transformReply: undefined as unknown as () => BlobStringReply 14 | } as const satisfies Command; 15 | 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LIST.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('ACL', 'LIST'); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOAD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils from '../test-utils'; 3 | import ACL_LOAD from './ACL_LOAD'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('ACL LOAD', () => { 7 | testUtils.isVersionGreaterThanHook([6]); 8 | 9 | it('transformArguments', () => { 10 | assert.deepEqual( 11 | parseArgs(ACL_LOAD), 12 | ['ACL', 'LOAD'] 13 | ); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOAD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('ACL', 'LOAD'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_LOG_RESET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | import ACL_LOG from './ACL_LOG'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: ACL_LOG.IS_READ_ONLY, 8 | parseCommand(parser: CommandParser) { 9 | parser.push('ACL', 'LOG', 'RESET'); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_SAVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils from '../test-utils'; 3 | import ACL_SAVE from './ACL_SAVE'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('ACL SAVE', () => { 7 | testUtils.isVersionGreaterThanHook([6]); 8 | 9 | it('transformArguments', () => { 10 | assert.deepEqual( 11 | parseArgs(ACL_SAVE), 12 | ['ACL', 'SAVE'] 13 | ); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_SAVE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('ACL', 'SAVE'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_SETUSER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, username: RedisArgument, rule: RedisVariadicArgument) { 9 | parser.push('ACL', 'SETUSER', username); 10 | parser.pushVariadic(rule); 11 | }, 12 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_USERS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils from '../test-utils'; 3 | import ACL_USERS from './ACL_USERS'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('ACL USERS', () => { 7 | testUtils.isVersionGreaterThanHook([6]); 8 | 9 | it('transformArguments', () => { 10 | assert.deepEqual( 11 | parseArgs(ACL_USERS), 12 | ['ACL', 'USERS'] 13 | ); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_USERS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('ACL', 'USERS'); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_WHOAMI.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils from '../test-utils'; 3 | import ACL_WHOAMI from './ACL_WHOAMI'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('ACL WHOAMI', () => { 7 | testUtils.isVersionGreaterThanHook([6]); 8 | 9 | it('transformArguments', () => { 10 | assert.deepEqual( 11 | parseArgs(ACL_WHOAMI), 12 | ['ACL', 'WHOAMI'] 13 | ); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ACL_WHOAMI.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('ACL', 'WHOAMI'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/APPEND.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, value: RedisArgument) { 7 | parser.push('APPEND', key, value); 8 | }, 9 | 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ASKING.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import ASKING from './ASKING'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('ASKING', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(ASKING), 9 | ['ASKING'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ASKING.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export const ASKING_CMD = 'ASKING'; 5 | 6 | export default { 7 | NOT_KEYED_COMMAND: true, 8 | IS_READ_ONLY: true, 9 | parseCommand(parser: CommandParser) { 10 | parser.push(ASKING_CMD); 11 | }, 12 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BGREWRITEAOF.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('BGREWRITEAOF'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BGSAVE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export interface BgSaveOptions { 5 | SCHEDULE?: boolean; 6 | } 7 | 8 | export default { 9 | NOT_KEYED_COMMAND: true, 10 | IS_READ_ONLY: true, 11 | parseCommand(parser: CommandParser, options?: BgSaveOptions) { 12 | parser.push('BGSAVE'); 13 | if (options?.SCHEDULE) { 14 | parser.push('SCHEDULE'); 15 | } 16 | }, 17 | transformReply: undefined as unknown as () => SimpleStringReply 18 | } as const satisfies Command; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BLMPOP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command } from '../RESP/types'; 3 | import LMPOP, { LMPopArguments, parseLMPopArguments } from './LMPOP'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, timeout: number, ...args: LMPopArguments) { 8 | parser.push('BLMPOP', timeout.toString()); 9 | parseLMPopArguments(parser, ...args); 10 | }, 11 | transformReply: LMPOP.transformReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BRPOP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | import BLPOP from './BLPOP'; 5 | 6 | export default { 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, key: RedisVariadicArgument, timeout: number) { 9 | parser.push('BRPOP'); 10 | parser.pushKeys(key); 11 | parser.push(timeout.toString()); 12 | }, 13 | transformReply: BLPOP.transformReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BRPOPLPUSH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, source: RedisArgument, destination: RedisArgument, timeout: number) { 7 | parser.push('BRPOPLPUSH'); 8 | parser.pushKeys([source, destination]); 9 | parser.push(timeout.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BZMPOP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command } from '../RESP/types'; 3 | import ZMPOP, { parseZMPopArguments, ZMPopArguments } from './ZMPOP'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, timeout: number, ...args: ZMPopArguments) { 8 | parser.push('BZMPOP', timeout.toString()); 9 | parseZMPopArguments(parser, ...args); 10 | }, 11 | transformReply: ZMPOP.transformReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/BZPOPMIN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | import BZPOPMAX from './BZPOPMAX'; 5 | 6 | export default { 7 | IS_READ_ONLY: BZPOPMAX.IS_READ_ONLY, 8 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument, timeout: number) { 9 | parser.push('BZPOPMIN'); 10 | parser.pushKeys(keys); 11 | parser.push(timeout.toString()); 12 | }, 13 | transformReply: BZPOPMAX.transformReply 14 | } as const satisfies Command; 15 | 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_CACHING.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, value: boolean) { 8 | parser.push( 9 | 'CLIENT', 10 | 'CACHING', 11 | value ? 'YES' : 'NO' 12 | ); 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETNAME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLIENT', 'GETNAME'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETREDIR.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CLIENT_GETREDIR from './CLIENT_GETREDIR'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CLIENT GETREDIR', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CLIENT_GETREDIR), 9 | ['CLIENT', 'GETREDIR'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_GETREDIR.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLIENT', 'GETREDIR'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_ID.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import CLIENT_ID from './CLIENT_ID'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('CLIENT ID', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(CLIENT_ID), 10 | ['CLIENT', 'ID'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.clientId', async client => { 15 | assert.equal( 16 | typeof (await client.clientId()), 17 | 'number' 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_ID.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLIENT', 'ID'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_NO-EVICT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, value: boolean) { 8 | parser.push( 9 | 'CLIENT', 10 | 'NO-EVICT', 11 | value ? 'ON' : 'OFF' 12 | ); 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_NO-TOUCH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, value: boolean) { 8 | parser.push( 9 | 'CLIENT', 10 | 'NO-TOUCH', 11 | value ? 'ON' : 'OFF' 12 | ); 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 15 | } as const satisfies Command; 16 | 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_PAUSE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, timeout: number, mode?: 'WRITE' | 'ALL') { 8 | parser.push('CLIENT', 'PAUSE', timeout.toString()); 9 | if (mode) { 10 | parser.push(mode); 11 | } 12 | }, 13 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_SETNAME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, name: RedisArgument) { 8 | parser.push('CLIENT', 'SETNAME', name); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLIENT_UNPAUSE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLIENT', 'UNPAUSE'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_ADDSLOTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, slots: number | Array) { 8 | parser.push('CLUSTER', 'ADDSLOTS'); 9 | parser.pushVariadicNumber(slots); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_ADDSLOTSRANGE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | import { parseSlotRangesArguments, SlotRange } from './generic-transformers'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, ranges: SlotRange | Array) { 9 | parser.push('CLUSTER', 'ADDSLOTSRANGE'); 10 | parseSlotRangesArguments(parser, ranges); 11 | }, 12 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_BUMPEPOCH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'BUMPEPOCH'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'BUMPED' | 'STILL'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_COUNT-FAILURE-REPORTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, nodeId: RedisArgument) { 8 | parser.push('CLUSTER', 'COUNT-FAILURE-REPORTS', nodeId); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_COUNTKEYSINSLOT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, slot: number) { 8 | parser.push('CLUSTER', 'COUNTKEYSINSLOT', slot.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_DELSLOTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, slots: number | Array) { 8 | parser.push('CLUSTER', 'DELSLOTS'); 9 | parser.pushVariadicNumber(slots); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_DELSLOTSRANGE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | import { parseSlotRangesArguments, SlotRange } from './generic-transformers'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser:CommandParser, ranges: SlotRange | Array) { 9 | parser.push('CLUSTER', 'DELSLOTSRANGE'); 10 | parseSlotRangesArguments(parser, ranges); 11 | }, 12 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FLUSHSLOTS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CLUSTER_FLUSHSLOTS from './CLUSTER_FLUSHSLOTS'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CLUSTER FLUSHSLOTS', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CLUSTER_FLUSHSLOTS), 9 | ['CLUSTER', 'FLUSHSLOTS'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FLUSHSLOTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'FLUSHSLOTS'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FORGET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CLUSTER_FORGET from './CLUSTER_FORGET'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CLUSTER FORGET', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CLUSTER_FORGET, '0'), 9 | ['CLUSTER', 'FORGET', '0'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_FORGET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, nodeId: RedisArgument) { 8 | parser.push('CLUSTER', 'FORGET', nodeId); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_GETKEYSINSLOT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, slot: number, count: number) { 8 | parser.push('CLUSTER', 'GETKEYSINSLOT', slot.toString(), count.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_INFO.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { VerbatimStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'INFO'); 9 | }, 10 | transformReply: undefined as unknown as () => VerbatimStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_KEYSLOT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command, NumberReply, RedisArgument } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('CLUSTER', 'KEYSLOT', key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MEET.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CLUSTER_MEET from './CLUSTER_MEET'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CLUSTER MEET', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CLUSTER_MEET, '127.0.0.1', 6379), 9 | ['CLUSTER', 'MEET', '127.0.0.1', '6379'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MEET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, host: string, port: number) { 8 | parser.push('CLUSTER', 'MEET', host, port.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MYID.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'MYID'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_MYSHARDID.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'MYSHARDID'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_NODES.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { VerbatimStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'NODES'); 9 | }, 10 | transformReply: undefined as unknown as () => VerbatimStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICAS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, nodeId: RedisArgument) { 8 | parser.push('CLUSTER', 'REPLICAS', nodeId); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICATE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CLUSTER_REPLICATE from './CLUSTER_REPLICATE'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CLUSTER REPLICATE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CLUSTER_REPLICATE, '0'), 9 | ['CLUSTER', 'REPLICATE', '0'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_REPLICATE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, nodeId: RedisArgument) { 8 | parser.push('CLUSTER', 'REPLICATE', nodeId); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_RESET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export interface ClusterResetOptions { 5 | mode?: 'HARD' | 'SOFT'; 6 | } 7 | 8 | export default { 9 | NOT_KEYED_COMMAND: true, 10 | IS_READ_ONLY: true, 11 | parseCommand(parser: CommandParser, options?: ClusterResetOptions) { 12 | parser.push('CLUSTER', 'RESET'); 13 | 14 | if (options?.mode) { 15 | parser.push(options.mode); 16 | } 17 | }, 18 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 19 | } as const satisfies Command; 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SAVECONFIG.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CLUSTER', 'SAVECONFIG'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SET-CONFIG-EPOCH.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CLUSTER_SET_CONFIG_EPOCH from './CLUSTER_SET-CONFIG-EPOCH'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CLUSTER SET-CONFIG-EPOCH', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CLUSTER_SET_CONFIG_EPOCH, 0), 9 | ['CLUSTER', 'SET-CONFIG-EPOCH', '0'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CLUSTER_SET-CONFIG-EPOCH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, configEpoch: number) { 8 | parser.push('CLUSTER', 'SET-CONFIG-EPOCH', configEpoch.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/COMMAND_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('COMMAND', 'COUNT'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/COMMAND_GETKEYS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, args: Array) { 8 | parser.push('COMMAND', 'GETKEYS'); 9 | parser.push(...args); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_RESETSTAT.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CONFIG_RESETSTAT from './CONFIG_RESETSTAT'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CONFIG RESETSTAT', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CONFIG_RESETSTAT), 9 | ['CONFIG', 'RESETSTAT'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_RESETSTAT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CONFIG', 'RESETSTAT'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_REWRITE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import CONFIG_REWRITE from './CONFIG_REWRITE'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('CONFIG REWRITE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(CONFIG_REWRITE), 9 | ['CONFIG', 'REWRITE'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/CONFIG_REWRITE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('CONFIG', 'REWRITE'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DBSIZE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import DBSIZE from './DBSIZE'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('DBSIZE', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(DBSIZE), 10 | ['DBSIZE'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.dbSize', async client => { 15 | assert.equal( 16 | await client.dbSize(), 17 | 0 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DBSIZE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('DBSIZE'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DECR.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument) { 6 | parser.push('DECR'); 7 | parser.pushKey(key); 8 | }, 9 | transformReply: undefined as unknown as () => NumberReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DECRBY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, decrement: number) { 6 | parser.push('DECRBY'); 7 | parser.pushKey(key); 8 | parser.push(decrement.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 8 | parser.push('DEL'); 9 | parser.pushKeys(keys); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DISCARD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import DISCARD from './DISCARD'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('DISCARD', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(DISCARD), 9 | ['DISCARD'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DISCARD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser) { 6 | parser.push('DISCARD'); 7 | }, 8 | transformReply: undefined as unknown as () => SimpleStringReply 9 | } as const satisfies Command; 10 | -------------------------------------------------------------------------------- /packages/client/lib/commands/DUMP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('DUMP'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ECHO.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import ECHO from './ECHO'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('ECHO', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(ECHO, 'message'), 10 | ['ECHO', 'message'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.echo', async client => { 15 | assert.equal( 16 | await client.echo('message'), 17 | 'message' 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ECHO.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, message: RedisArgument) { 8 | parser.push('ECHO', message); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import EVALSHA from './EVALSHA'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('EVALSHA', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(EVALSHA, 'sha1', { 9 | keys: ['key'], 10 | arguments: ['argument'] 11 | }), 12 | ['EVALSHA', 'sha1', '1', 'key', 'argument'] 13 | ); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import EVAL, { parseEvalArguments } from './EVAL'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('EVALSHA'); 8 | parseEvalArguments(...args); 9 | }, 10 | transformReply: EVAL.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA_RO.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils from '../test-utils'; 3 | import EVALSHA_RO from './EVALSHA_RO'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('EVALSHA_RO', () => { 7 | testUtils.isVersionGreaterThanHook([7]); 8 | 9 | it('transformArguments', () => { 10 | assert.deepEqual( 11 | parseArgs(EVALSHA_RO, 'sha1', { 12 | keys: ['key'], 13 | arguments: ['argument'] 14 | }), 15 | ['EVALSHA_RO', 'sha1', '1', 'key', 'argument'] 16 | ); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVALSHA_RO.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import EVAL, { parseEvalArguments } from './EVAL'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('EVALSHA_RO'); 8 | parseEvalArguments(...args); 9 | }, 10 | transformReply: EVAL.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EVAL_RO.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import EVAL, { parseEvalArguments } from './EVAL'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('EVAL_RO'); 8 | parseEvalArguments(...args); 9 | }, 10 | transformReply: EVAL.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EXISTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 9 | parser.push('EXISTS'); 10 | parser.pushKeys(keys); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EXPIRE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | seconds: number, 10 | mode?: 'NX' | 'XX' | 'GT' | 'LT' 11 | ) { 12 | parser.push('EXPIRE'); 13 | parser.pushKey(key); 14 | parser.push(seconds.toString()); 15 | if (mode) { 16 | parser.push(mode); 17 | } 18 | }, 19 | transformReply: undefined as unknown as () => NumberReply 20 | } as const satisfies Command; 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/EXPIRETIME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('EXPIRETIME'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FCALL.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import EVAL, { parseEvalArguments } from './EVAL'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('FCALL'); 8 | parseEvalArguments(...args); 9 | }, 10 | transformReply: EVAL.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FCALL_RO.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import EVAL, { parseEvalArguments } from './EVAL'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(...args: Parameters) { 7 | args[0].push('FCALL_RO'); 8 | parseEvalArguments(...args); 9 | }, 10 | transformReply: EVAL.transformReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FLUSHDB.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | import { RedisFlushMode } from './FLUSHALL'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: false, 8 | parseCommand(parser: CommandParser, mode?: RedisFlushMode) { 9 | parser.push('FLUSHDB'); 10 | if (mode) { 11 | parser.push(mode); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_DELETE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, library: RedisArgument) { 8 | parser.push('FUNCTION', 'DELETE', library); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_DUMP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('FUNCTION', 'DUMP') 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_FLUSH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | import { RedisFlushMode } from './FLUSHALL'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: false, 8 | parseCommand(parser: CommandParser, mode?: RedisFlushMode) { 9 | parser.push('FUNCTION', 'FLUSH'); 10 | 11 | if (mode) { 12 | parser.push(mode); 13 | } 14 | }, 15 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 16 | } as const satisfies Command; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_KILL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils from '../test-utils'; 3 | import FUNCTION_KILL from './FUNCTION_KILL'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('FUNCTION KILL', () => { 7 | testUtils.isVersionGreaterThanHook([7]); 8 | 9 | it('transformArguments', () => { 10 | assert.deepEqual( 11 | parseArgs(FUNCTION_KILL), 12 | ['FUNCTION', 'KILL'] 13 | ); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/FUNCTION_KILL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('FUNCTION', 'KILL'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GEOHASH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, key: RedisArgument, member: RedisVariadicArgument) { 9 | parser.push('GEOHASH'); 10 | parser.pushKey(key); 11 | parser.pushVariadic(member); 12 | }, 13 | transformReply: undefined as unknown as () => ArrayReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GEORADIUSBYMEMBER_RO.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import GEORADIUSBYMEMBER, { parseGeoRadiusByMemberArguments } from './GEORADIUSBYMEMBER'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(...args: Parameters) { 8 | const parser = args[0]; 9 | parser.push('GEORADIUSBYMEMBER_RO'); 10 | parseGeoRadiusByMemberArguments(...args); 11 | }, 12 | transformReply: GEORADIUSBYMEMBER.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GEORADIUSBYMEMBER_RO_WITH.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import GEORADIUSBYMEMBER_WITH, { parseGeoRadiusByMemberWithArguments } from './GEORADIUSBYMEMBER_WITH'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(...args: Parameters) { 8 | const parser = args[0]; 9 | parser.push('GEORADIUSBYMEMBER_RO'); 10 | parseGeoRadiusByMemberWithArguments(...args); 11 | }, 12 | transformReply: GEORADIUSBYMEMBER_WITH.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GEORADIUS_RO.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import GEORADIUS, { parseGeoRadiusArguments } from './GEORADIUS'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(...args: Parameters) { 8 | args[0].push('GEORADIUS_RO'); 9 | parseGeoRadiusArguments(...args); 10 | }, 11 | transformReply: GEORADIUS.transformReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GEORADIUS_RO_WITH.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import { parseGeoRadiusWithArguments } from './GEORADIUS_WITH'; 3 | import GEORADIUS_WITH from './GEORADIUS_WITH'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(...args: Parameters) { 9 | args[0].push('GEORADIUS_RO'); 10 | parseGeoRadiusWithArguments(...args); 11 | }, 12 | transformReply: GEORADIUS_WITH.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('GET'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETBIT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command, RedisArgument } from '../RESP/types'; 3 | import { BitValue } from './generic-transformers'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, key: RedisArgument, offset: number) { 9 | parser.push('GETBIT'); 10 | parser.pushKey(key); 11 | parser.push(offset.toString()); 12 | }, 13 | transformReply: undefined as unknown as () => NumberReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETDEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('GETDEL'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETRANGE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, start: number, end: number) { 8 | parser.push('GETRANGE'); 9 | parser.pushKey(key); 10 | parser.push(start.toString(), end.toString()); 11 | }, 12 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/GETSET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, value: RedisArgument) { 7 | parser.push('GETSET'); 8 | parser.pushKey(key); 9 | parser.push(value); 10 | }, 11 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HDEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, field: RedisVariadicArgument) { 7 | parser.push('HDEL'); 8 | parser.pushKey(key); 9 | parser.pushVariadic(field); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HEXISTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, field: RedisArgument) { 8 | parser.push('HEXISTS'); 9 | parser.pushKey(key); 10 | parser.push(field); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply<0 | 1> 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HGET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, field: RedisArgument) { 8 | parser.push('HGET'); 9 | parser.pushKey(key); 10 | parser.push(field); 11 | }, 12 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HGETDEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisVariadicArgument } from './generic-transformers'; 3 | import { RedisArgument, ArrayReply, BlobStringReply, NullReply, Command } from '../RESP/types'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, fields: RedisVariadicArgument) { 7 | parser.push('HGETDEL'); 8 | parser.pushKey(key); 9 | parser.push('FIELDS') 10 | parser.pushVariadicWithLength(fields); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HINCRBY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand( 6 | parser: CommandParser, 7 | key: RedisArgument, 8 | field: RedisArgument, 9 | increment: number 10 | ) { 11 | parser.push('HINCRBY'); 12 | parser.pushKey(key); 13 | parser.push(field, increment.toString()); 14 | }, 15 | transformReply: undefined as unknown as () => NumberReply 16 | } as const satisfies Command; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HINCRBYFLOAT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand( 6 | parser: CommandParser, 7 | key: RedisArgument, 8 | field: RedisArgument, 9 | increment: number 10 | ) { 11 | parser.push('HINCRBYFLOAT'); 12 | parser.pushKey(key); 13 | parser.push(field, increment.toString()); 14 | }, 15 | transformReply: undefined as unknown as () => BlobStringReply 16 | } as const satisfies Command; 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HKEYS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('HKEYS') 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HLEN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('HLEN'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HRANDFIELD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('HRANDFIELD'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HRANDFIELD_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 7 | parser.push('HRANDFIELD'); 8 | parser.pushKey(key); 9 | parser.push(count.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HRANDFIELD_COUNT_WITHVALUES.spec.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redis/node-redis/e4a1ca467fcbc1942fa6eb2f7b60b081110544e4/packages/client/lib/commands/HRANDFIELD_COUNT_WITHVALUES.spec.ts -------------------------------------------------------------------------------- /packages/client/lib/commands/HSCAN_NOVALUES.ts: -------------------------------------------------------------------------------- 1 | import { BlobStringReply, Command } from '../RESP/types'; 2 | import HSCAN from './HSCAN'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(...args: Parameters) { 7 | const parser = args[0]; 8 | 9 | HSCAN.parseCommand(...args); 10 | parser.push('NOVALUES'); 11 | }, 12 | transformReply([cursor, fields]: [BlobStringReply, Array]) { 13 | return { 14 | cursor, 15 | fields 16 | }; 17 | } 18 | } as const satisfies Command; 19 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HSETNX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, Command, NumberReply } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | field: RedisArgument, 10 | value: RedisArgument 11 | ) { 12 | parser.push('HSETNX'); 13 | parser.pushKey(key); 14 | parser.push(field, value); 15 | }, 16 | transformReply: undefined as unknown as () => NumberReply<0 | 1> 17 | } as const satisfies Command; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HSTRLEN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, field: RedisArgument) { 8 | parser.push('HSTRLEN'); 9 | parser.pushKey(key); 10 | parser.push(field); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/HVALS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('HVALS'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCR.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument) { 6 | parser.push('INCR'); 7 | parser.pushKey(key); 8 | }, 9 | transformReply: undefined as unknown as () => NumberReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCRBY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, increment: number) { 6 | parser.push('INCRBY'); 7 | parser.pushKey(key); 8 | parser.push(increment.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INCRBYFLOAT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, increment: number) { 6 | parser.push('INCRBYFLOAT'); 7 | parser.pushKey(key); 8 | parser.push(increment.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/INFO.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, VerbatimStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, section?: RedisArgument) { 8 | parser.push('INFO'); 9 | 10 | if (section) { 11 | parser.push(section); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => VerbatimStringReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/KEYS.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | 4 | describe('KEYS', () => { 5 | testUtils.testWithClient('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 { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, pattern: RedisArgument) { 8 | parser.push('KEYS', pattern); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LASTSAVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import LASTSAVE from './LASTSAVE'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('LASTSAVE', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(LASTSAVE), 10 | ['LASTSAVE'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.lastSave', async client => { 15 | assert.equal( 16 | typeof await client.lastSave(), 17 | 'number' 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LASTSAVE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('LASTSAVE'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LATENCY_DOCTOR.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('LATENCY', 'DOCTOR'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LATENCY_LATEST.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('LATENCY', 'LATEST'); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply<[ 11 | name: BlobStringReply, 12 | timestamp: NumberReply, 13 | latestLatency: NumberReply, 14 | allTimeLatency: NumberReply 15 | ]> 16 | } as const satisfies Command; 17 | 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LCS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand( 7 | parser: CommandParser, 8 | key1: RedisArgument, 9 | key2: RedisArgument 10 | ) { 11 | parser.push('LCS'); 12 | parser.pushKeys([key1, key2]); 13 | }, 14 | transformReply: undefined as unknown as () => BlobStringReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LCS_LEN.ts: -------------------------------------------------------------------------------- 1 | import { NumberReply, Command } from '../RESP/types'; 2 | import LCS from './LCS'; 3 | 4 | export default { 5 | IS_READ_ONLY: LCS.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | const parser = args[0]; 8 | 9 | LCS.parseCommand(...args); 10 | parser.push('LEN'); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LINDEX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, index: number) { 8 | parser.push('LINDEX'); 9 | parser.pushKey(key); 10 | parser.push(index.toString()); 11 | }, 12 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LLEN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('LLEN'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPOP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument) { 6 | parser.push('LPOP'); 7 | parser.pushKey(key); 8 | }, 9 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPOP_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NullReply, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import LPOP from './LPOP'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 8 | LPOP.parseCommand(parser, key); 9 | parser.push(count.toString()) 10 | }, 11 | transformReply: undefined as unknown as () => NullReply | ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPUSH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, elements: RedisVariadicArgument) { 7 | parser.push('LPUSH'); 8 | parser.pushKey(key); 9 | parser.pushVariadic(elements); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LPUSHX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, elements: RedisVariadicArgument) { 7 | parser.push('LPUSHX'); 8 | parser.pushKey(key); 9 | parser.pushVariadic(elements); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LRANGE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, start: number, stop: number) { 8 | parser.push('LRANGE'); 9 | parser.pushKey(key); 10 | parser.push(start.toString(), stop.toString()) 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LREM.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, count: number, element: RedisArgument) { 7 | parser.push('LREM'); 8 | parser.pushKey(key); 9 | parser.push(count.toString()); 10 | parser.push(element); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LSET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, index: number, element: RedisArgument) { 7 | parser.push('LSET'); 8 | parser.pushKey(key); 9 | parser.push(index.toString(), element); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/LTRIM.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, start: number, stop: number) { 6 | parser.push('LTRIM'); 7 | parser.pushKey(key); 8 | parser.push(start.toString(), stop.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_DOCTOR.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('MEMORY', 'DOCTOR'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_MALLOC-STATS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('MEMORY', 'MALLOC-STATS'); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MEMORY_PURGE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('MEMORY', 'PURGE'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MGET.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, keys: Array) { 8 | parser.push('MGET'); 9 | parser.pushKeys(keys); 10 | }, 11 | transformReply: undefined as unknown as () => Array 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_LIST.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import MODULE_LIST from './MODULE_LIST'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('MODULE LIST', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(MODULE_LIST), 9 | ['MODULE', 'LIST'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_LOAD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, path: RedisArgument, moduleArguments?: Array) { 8 | parser.push('MODULE', 'LOAD', path); 9 | 10 | if (moduleArguments) { 11 | parser.push(...moduleArguments); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_UNLOAD.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import MODULE_UNLOAD from './MODULE_UNLOAD'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('MODULE UNLOAD', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(MODULE_UNLOAD, 'name'), 9 | ['MODULE', 'UNLOAD', 'name'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MODULE_UNLOAD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, name: RedisArgument) { 8 | parser.push('MODULE', 'UNLOAD', name); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MOVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import MOVE from './MOVE'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('MOVE', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(MOVE, 'key', 1), 10 | ['MOVE', 'key', '1'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.move', async client => { 15 | assert.equal( 16 | await client.move('key', 1), 17 | 0 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MOVE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, db: number) { 6 | parser.push('MOVE'); 7 | parser.pushKey(key); 8 | parser.push(db.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/MSETNX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | import { MSetArguments, parseMSetArguments } from './MSET'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, toSet: MSetArguments) { 8 | parser.push('MSETNX'); 9 | return parseMSetArguments(parser, toSet); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_ENCODING.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('OBJECT', 'ENCODING'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_FREQ.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('OBJECT', 'FREQ'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_IDLETIME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('OBJECT', 'IDLETIME'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/OBJECT_REFCOUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('OBJECT', 'REFCOUNT'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PERSIST.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument) { 6 | parser.push('PERSIST'); 7 | parser.pushKey(key); 8 | }, 9 | transformReply: undefined as unknown as () => NumberReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PEXPIRE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | ms: number, 10 | mode?: 'NX' | 'XX' | 'GT' | 'LT' 11 | ) { 12 | parser.push('PEXPIRE'); 13 | parser.pushKey(key); 14 | parser.push(ms.toString()); 15 | 16 | if (mode) { 17 | parser.push(mode); 18 | } 19 | }, 20 | transformReply: undefined as unknown as () => NumberReply 21 | } as const satisfies Command; 22 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PEXPIRETIME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('PEXPIRETIME'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PFADD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, element?: RedisVariadicArgument) { 8 | parser.push('PFADD') 9 | parser.pushKey(key); 10 | if (element) { 11 | parser.pushVariadic(element); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => NumberReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PFCOUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 8 | parser.push('PFCOUNT'); 9 | parser.pushKeys(keys); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PING.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, message?: RedisArgument) { 8 | parser.push('PING'); 9 | if (message) { 10 | parser.push(message); 11 | } 12 | }, 13 | transformReply: undefined as unknown as () => SimpleStringReply | BlobStringReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PSETEX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, ms: number, value: RedisArgument) { 6 | parser.push('PSETEX'); 7 | parser.pushKey(key); 8 | parser.push(ms.toString(), value); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PTTL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('PTTL'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBLISH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | IS_FORWARD_COMMAND: true, 8 | parseCommand(parser: CommandParser, channel: RedisArgument, message: RedisArgument) { 9 | parser.push('PUBLISH', channel, message); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBSUB_CHANNELS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, pattern?: RedisArgument) { 8 | parser.push('PUBSUB', 'CHANNELS'); 9 | 10 | if (pattern) { 11 | parser.push(pattern); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => ArrayReply 15 | } as const satisfies Command; 16 | 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBSUB_NUMPAT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('PUBSUB', 'NUMPAT'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/PUBSUB_SHARDCHANNELS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, pattern?: RedisArgument) { 8 | parser.push('PUBSUB', 'SHARDCHANNELS'); 9 | 10 | if (pattern) { 11 | parser.push(pattern); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => ArrayReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RANDOMKEY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('RANDOMKEY'); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READONLY.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import READONLY from './READONLY'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('READONLY', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(READONLY), 9 | ['READONLY'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READONLY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('READONLY'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READWRITE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import READWRITE from './READWRITE'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('READWRITE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(READWRITE), 9 | ['READWRITE'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/READWRITE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('READWRITE'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RENAME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, newKey: RedisArgument) { 7 | parser.push('RENAME'); 8 | parser.pushKeys([key, newKey]); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RENAMENX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, newKey: RedisArgument) { 7 | parser.push('RENAMENX'); 8 | parser.pushKeys([key, newKey]); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/REPLICAOF.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import REPLICAOF from './REPLICAOF'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('REPLICAOF', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(REPLICAOF, 'host', 1), 9 | ['REPLICAOF', 'host', '1'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/REPLICAOF.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, host: string, port: number) { 8 | parser.push('REPLICAOF', host, port.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RESTORE-ASKING.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import RESTORE_ASKING from './RESTORE-ASKING'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('RESTORE-ASKING', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(RESTORE_ASKING), 9 | ['RESTORE-ASKING'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RESTORE-ASKING.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('RESTORE-ASKING'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPOP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument) { 6 | parser.push('RPOP'); 7 | parser.pushKey(key); 8 | }, 9 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPOPLPUSH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, source: RedisArgument, destination: RedisArgument) { 6 | parser.push('RPOPLPUSH'); 7 | parser.pushKeys([source, destination]); 8 | }, 9 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPOP_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 6 | parser.push('RPOP'); 7 | parser.pushKey(key); 8 | parser.push(count.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => ArrayReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPUSH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, element: RedisVariadicArgument) { 7 | parser.push('RPUSH'); 8 | parser.pushKey(key); 9 | parser.pushVariadic(element); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/RPUSHX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, element: RedisVariadicArgument) { 7 | parser.push('RPUSHX'); 8 | parser.pushKey(key); 9 | parser.pushVariadic(element); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SADD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, key: RedisArgument, members: RedisVariadicArgument) { 7 | parser.push('SADD'); 8 | parser.pushKey(key); 9 | parser.pushVariadic(members); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SAVE.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import SAVE from './SAVE'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('SAVE', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(SAVE), 9 | ['SAVE'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SAVE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('SAVE'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCARD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('SCARD'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_DEBUG.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, mode: 'YES' | 'SYNC' | 'NO') { 8 | parser.push('SCRIPT', 'DEBUG', mode); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_EXISTS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | NOT_KEYED_COMMAND: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, sha1: RedisVariadicArgument) { 9 | parser.push('SCRIPT', 'EXISTS'); 10 | parser.pushVariadic(sha1); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_FLUSH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, mode?: 'ASYNC' | 'SYNC') { 8 | parser.push('SCRIPT', 'FLUSH'); 9 | 10 | if (mode) { 11 | parser.push(mode); 12 | } 13 | }, 14 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_KILL.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import SCRIPT_KILL from './SCRIPT_KILL'; 3 | import { parseArgs } from './generic-transformers'; 4 | 5 | describe('SCRIPT KILL', () => { 6 | it('transformArguments', () => { 7 | assert.deepEqual( 8 | parseArgs(SCRIPT_KILL), 9 | ['SCRIPT', 'KILL'] 10 | ); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_KILL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('SCRIPT', 'KILL'); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SCRIPT_LOAD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command, RedisArgument } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, script: RedisArgument) { 8 | parser.push('SCRIPT', 'LOAD', script); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SDIFF.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 9 | parser.push('SDIFF'); 10 | parser.pushKeys(keys); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SDIFFSTORE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, destination: RedisArgument, keys: RedisVariadicArgument) { 7 | parser.push('SDIFFSTORE'); 8 | parser.pushKey(destination); 9 | parser.pushKeys(keys); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETBIT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { BitValue } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, offset: number, value: BitValue) { 8 | parser.push('SETBIT'); 9 | parser.pushKey(key); 10 | parser.push(offset.toString(), value.toString()); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETEX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, seconds: number, value: RedisArgument) { 6 | parser.push('SETEX'); 7 | parser.pushKey(key); 8 | parser.push(seconds.toString(), value); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETNX.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, value: RedisArgument) { 6 | parser.push('SETNX'); 7 | parser.pushKey(key); 8 | parser.push(value); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SETRANGE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, key: RedisArgument, offset: number, value: RedisArgument) { 6 | parser.push('SETRANGE'); 7 | parser.pushKey(key); 8 | parser.push(offset.toString(), value); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SINTER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 9 | parser.push('SINTER'); 10 | parser.pushKeys(keys); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SINTERSTORE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, destination: RedisArgument, keys: RedisVariadicArgument) { 8 | parser.push('SINTERSTORE'); 9 | parser.pushKey(destination) 10 | parser.pushKeys(keys); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SISMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command, RedisArgument } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, member: RedisArgument) { 8 | parser.push('SISMEMBER'); 9 | parser.pushKey(key); 10 | parser.push(member); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SMEMBERS.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, SetReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('SMEMBERS'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: { 12 | 2: undefined as unknown as () => ArrayReply, 13 | 3: undefined as unknown as () => SetReply 14 | } 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SMISMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, members: Array) { 8 | parser.push('SMISMEMBER'); 9 | parser.pushKey(key); 10 | parser.pushVariadic(members); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SMOVE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, source: RedisArgument, destination: RedisArgument, member: RedisArgument) { 7 | parser.push('SMOVE'); 8 | parser.pushKeys([source, destination]); 9 | parser.push(member); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SORT_RO.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import SORT, { parseSortArguments } from './SORT'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(...args: Parameters) { 7 | const parser = args[0]; 8 | 9 | parser.push('SORT_RO'); 10 | parseSortArguments(...args); 11 | }, 12 | transformReply: SORT.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SORT_STORE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import SORT, { SortOptions } from './SORT'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, source: RedisArgument, destination: RedisArgument, options?: SortOptions) { 8 | SORT.parseCommand(parser, source, options); 9 | parser.push('STORE', destination); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SPOP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('SPOP'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SPOP_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 7 | parser.push('SPOP'); 8 | parser.pushKey(key); 9 | parser.push(count.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SPUBLISH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, channel: RedisArgument, message: RedisArgument) { 7 | parser.push('SPUBLISH'); 8 | parser.pushKey(channel); 9 | parser.push(message); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SRANDMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('SRANDMEMBER') 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SRANDMEMBER_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import SRANDMEMBER from './SRANDMEMBER'; 4 | 5 | export default { 6 | IS_READ_ONLY: SRANDMEMBER.IS_READ_ONLY, 7 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 8 | SRANDMEMBER.parseCommand(parser, key); 9 | parser.push(count.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SREM.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command, RedisArgument } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, members: RedisVariadicArgument) { 8 | parser.push('SREM'); 9 | parser.pushKey(key); 10 | parser.pushVariadic(members); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/STRLEN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('STRLEN'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SUNION.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | CACHEABLE: true, 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 9 | parser.push('SUNION'); 10 | parser.pushKeys(keys); 11 | }, 12 | transformReply: undefined as unknown as () => ArrayReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SUNIONSTORE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, destination: RedisArgument, keys: RedisVariadicArgument) { 8 | parser.push('SUNIONSTORE'); 9 | parser.pushKey(destination); 10 | parser.pushKeys(keys); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SWAPDB.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import SWAPDB from './SWAPDB'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('SWAPDB', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(SWAPDB, 0, 1), 10 | ['SWAPDB', '0', '1'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.swapDb', async client => { 15 | assert.equal( 16 | await client.swapDb(0, 1), 17 | 'OK' 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/SWAPDB.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, index1: number, index2: number) { 8 | parser.push('SWAPDB', index1.toString(), index2.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TIME.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { BlobStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('TIME'); 9 | }, 10 | transformReply: undefined as unknown as () => [ 11 | unixTimestamp: BlobStringReply<`${number}`>, 12 | microseconds: BlobStringReply<`${number}`> 13 | ] 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TOUCH.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisVariadicArgument) { 8 | parser.push('TOUCH'); 9 | parser.pushKeys(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TTL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('TTL'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/TYPE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('TYPE'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => SimpleStringReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/UNLINK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 8 | parser.push('UNLINK'); 9 | parser.pushKeys(keys); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/WAIT.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import WAIT from './WAIT'; 4 | import { parseArgs } from './generic-transformers'; 5 | 6 | describe('WAIT', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(WAIT, 0, 1), 10 | ['WAIT', '0', '1'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.wait', async client => { 15 | assert.equal( 16 | await client.wait(0, 1), 17 | 0 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/WAIT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, numberOfReplicas: number, timeout: number) { 8 | parser.push('WAIT', numberOfReplicas.toString(), timeout.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => NumberReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XACK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, Command, RedisArgument } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, group: RedisArgument, id: RedisVariadicArgument) { 8 | parser.push('XACK'); 9 | parser.pushKey(key); 10 | parser.push(group) 11 | parser.pushVariadic(id); 12 | }, 13 | transformReply: undefined as unknown as () => NumberReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XADD_NOMKSTREAM.ts: -------------------------------------------------------------------------------- 1 | import { BlobStringReply, NullReply, Command } from '../RESP/types'; 2 | import { Tail } from './generic-transformers'; 3 | import { parseXAddArguments } from './XADD'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(...args: Tail>) { 8 | return parseXAddArguments('NOMKSTREAM', ...args); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XCLAIM_JUSTID.ts: -------------------------------------------------------------------------------- 1 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 2 | import XCLAIM from './XCLAIM'; 3 | 4 | export default { 5 | IS_READ_ONLY: XCLAIM.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | const parser = args[0]; 8 | XCLAIM.parseCommand(...args); 9 | parser.push('JUSTID'); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XDEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, id: RedisVariadicArgument) { 8 | parser.push('XDEL'); 9 | parser.pushKey(key); 10 | parser.pushVariadic(id); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_CREATECONSUMER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, Command, NumberReply } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | group: RedisArgument, 10 | consumer: RedisArgument 11 | ) { 12 | parser.push('XGROUP', 'CREATECONSUMER'); 13 | parser.pushKey(key); 14 | parser.push(group, consumer); 15 | }, 16 | transformReply: undefined as unknown as () => NumberReply 17 | } as const satisfies Command; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_DELCONSUMER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | group: RedisArgument, 10 | consumer: RedisArgument 11 | ) { 12 | parser.push('XGROUP', 'DELCONSUMER'); 13 | parser.pushKey(key); 14 | parser.push(group, consumer); 15 | }, 16 | transformReply: undefined as unknown as () => NumberReply 17 | } as const satisfies Command; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XGROUP_DESTROY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, group: RedisArgument) { 7 | parser.push('XGROUP', 'DESTROY'); 8 | parser.pushKey(key); 9 | parser.push(group); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/XLEN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('XLEN'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZCARD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('ZCARD'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZDIFF.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 8 | parser.push('ZDIFF'); 9 | parser.pushKeysLength(keys); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZDIFFSTORE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, destination: RedisArgument, inputKeys: RedisVariadicArgument) { 8 | parser.push('ZDIFFSTORE'); 9 | parser.pushKey(destination); 10 | parser.pushKeysLength(inputKeys); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZDIFF_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command } from '../RESP/types'; 3 | import { RedisVariadicArgument, transformSortedSetReply } from './generic-transformers'; 4 | import ZDIFF from './ZDIFF'; 5 | 6 | 7 | export default { 8 | IS_READ_ONLY: ZDIFF.IS_READ_ONLY, 9 | parseCommand(parser: CommandParser, keys: RedisVariadicArgument) { 10 | ZDIFF.parseCommand(parser, keys); 11 | parser.push('WITHSCORES'); 12 | }, 13 | transformReply: transformSortedSetReply 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZINCRBY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, Command } from '../RESP/types'; 3 | import { transformDoubleArgument, transformDoubleReply } from './generic-transformers'; 4 | 5 | export default { 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | increment: number, 10 | member: RedisArgument 11 | ) { 12 | parser.push('ZINCRBY'); 13 | parser.pushKey(key); 14 | parser.push(transformDoubleArgument(increment), member); 15 | }, 16 | transformReply: transformDoubleReply 17 | } as const satisfies Command; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZINTER_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import { transformSortedSetReply } from './generic-transformers'; 3 | import ZINTER from './ZINTER'; 4 | 5 | 6 | export default { 7 | IS_READ_ONLY: ZINTER.IS_READ_ONLY, 8 | parseCommand(...args: Parameters) { 9 | ZINTER.parseCommand(...args); 10 | args[0].push('WITHSCORES'); 11 | }, 12 | transformReply: transformSortedSetReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZLEXCOUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand( 8 | parser: CommandParser, 9 | key: RedisArgument, 10 | min: RedisArgument, 11 | max: RedisArgument 12 | ) { 13 | parser.push('ZLEXCOUNT'); 14 | parser.pushKey(key); 15 | parser.push(min); 16 | parser.push(max); 17 | }, 18 | transformReply: undefined as unknown as () => NumberReply 19 | } as const satisfies Command; 20 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMAX_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, Command } from '../RESP/types'; 3 | import { transformSortedSetReply } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 8 | parser.push('ZPOPMAX'); 9 | parser.pushKey(key); 10 | parser.push(count.toString()); 11 | }, 12 | transformReply: transformSortedSetReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMIN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, Command } from '../RESP/types'; 3 | import ZPOPMAX from './ZPOPMAX'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument) { 8 | parser.push('ZPOPMIN'); 9 | parser.pushKey(key); 10 | }, 11 | transformReply: ZPOPMAX.transformReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZPOPMIN_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, Command } from '../RESP/types'; 3 | import { transformSortedSetReply } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 8 | parser.push('ZPOPMIN'); 9 | parser.pushKey(key); 10 | parser.push(count.toString()); 11 | }, 12 | transformReply: transformSortedSetReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANDMEMBER.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('ZRANDMEMBER'); 8 | parser.pushKey(key); 9 | }, 10 | transformReply: undefined as unknown as () => BlobStringReply | NullReply 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANDMEMBER_COUNT.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types'; 3 | import ZRANDMEMBER from './ZRANDMEMBER'; 4 | 5 | export default { 6 | IS_READ_ONLY: ZRANDMEMBER.IS_READ_ONLY, 7 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 8 | ZRANDMEMBER.parseCommand(parser, key); 9 | parser.push(count.toString()); 10 | }, 11 | transformReply: undefined as unknown as () => ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANDMEMBER_COUNT_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { Command, RedisArgument } from '../RESP/types'; 3 | import { transformSortedSetReply } from './generic-transformers'; 4 | import ZRANDMEMBER_COUNT from './ZRANDMEMBER_COUNT'; 5 | 6 | export default { 7 | IS_READ_ONLY: ZRANDMEMBER_COUNT.IS_READ_ONLY, 8 | parseCommand(parser: CommandParser, key: RedisArgument, count: number) { 9 | ZRANDMEMBER_COUNT.parseCommand(parser, key, count); 10 | parser.push('WITHSCORES'); 11 | }, 12 | transformReply: transformSortedSetReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANGEBYSCORE_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import { transformSortedSetReply } from './generic-transformers'; 3 | import ZRANGEBYSCORE from './ZRANGEBYSCORE'; 4 | 5 | export default { 6 | CACHEABLE: ZRANGEBYSCORE.CACHEABLE, 7 | IS_READ_ONLY: ZRANGEBYSCORE.IS_READ_ONLY, 8 | parseCommand(...args: Parameters) { 9 | const parser = args[0]; 10 | 11 | ZRANGEBYSCORE.parseCommand(...args); 12 | parser.push('WITHSCORES'); 13 | }, 14 | transformReply: transformSortedSetReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANGE_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import { transformSortedSetReply } from './generic-transformers'; 3 | import ZRANGE from './ZRANGE'; 4 | 5 | export default { 6 | CACHEABLE: ZRANGE.CACHEABLE, 7 | IS_READ_ONLY: ZRANGE.IS_READ_ONLY, 8 | parseCommand(...args: Parameters) { 9 | const parser = args[0]; 10 | 11 | ZRANGE.parseCommand(...args); 12 | parser.push('WITHSCORES'); 13 | }, 14 | transformReply: transformSortedSetReply 15 | } as const satisfies Command; 16 | 17 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZRANK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, NullReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, member: RedisArgument) { 8 | parser.push('ZRANK'); 9 | parser.pushKey(key); 10 | parser.push(member); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply | NullReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZREM.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | import { RedisVariadicArgument } from './generic-transformers'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand( 8 | parser: CommandParser, 9 | key: RedisArgument, 10 | member: RedisVariadicArgument 11 | ) { 12 | parser.push('ZREM'); 13 | parser.pushKey(key); 14 | parser.pushVariadic(member); 15 | }, 16 | transformReply: undefined as unknown as () => NumberReply 17 | } as const satisfies Command; 18 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZREMRANGEBYRANK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '../RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand( 7 | parser: CommandParser, 8 | key: RedisArgument, 9 | start: number, 10 | stop: number 11 | ) { 12 | parser.push('ZREMRANGEBYRANK'); 13 | parser.pushKey(key); 14 | parser.push( 15 | start.toString(), 16 | stop.toString() 17 | ); 18 | }, 19 | transformReply: undefined as unknown as () => NumberReply 20 | } as const satisfies Command; 21 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZREVRANK.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../client/parser'; 2 | import { NumberReply, NullReply, Command, RedisArgument } from '../RESP/types'; 3 | 4 | export default { 5 | CACHEABLE: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, key: RedisArgument, member: RedisArgument) { 8 | parser.push('ZREVRANK'); 9 | parser.pushKey(key); 10 | parser.push(member); 11 | }, 12 | transformReply: undefined as unknown as () => NumberReply | NullReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZSCORE.ts: -------------------------------------------------------------------------------- 1 | 2 | import { CommandParser } from '../client/parser'; 3 | import { RedisArgument, Command } from '../RESP/types'; 4 | import { transformNullableDoubleReply } from './generic-transformers'; 5 | 6 | export default { 7 | CACHEABLE: true, 8 | IS_READ_ONLY: true, 9 | parseCommand(parser: CommandParser, key: RedisArgument, member: RedisArgument) { 10 | parser.push('ZSCORE'); 11 | parser.pushKey(key); 12 | parser.push(member); 13 | }, 14 | transformReply: transformNullableDoubleReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/commands/ZUNION_WITHSCORES.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '../RESP/types'; 2 | import { transformSortedSetReply } from './generic-transformers'; 3 | import ZUNION from './ZUNION'; 4 | 5 | 6 | export default { 7 | IS_READ_ONLY: ZUNION.IS_READ_ONLY, 8 | parseCommand(...args: Parameters) { 9 | const parser = args[0]; 10 | 11 | ZUNION.parseCommand(...args); 12 | parser.push('WITHSCORES'); 13 | }, 14 | transformReply: transformSortedSetReply 15 | } as const satisfies Command; 16 | -------------------------------------------------------------------------------- /packages/client/lib/lua-script.ts: -------------------------------------------------------------------------------- 1 | import { createHash } from 'node:crypto'; 2 | import { Command } from './RESP/types'; 3 | 4 | export type RedisScriptConfig = Command & { 5 | SCRIPT: string | Buffer; 6 | NUMBER_OF_KEYS?: number; 7 | } 8 | 9 | export interface SHA1 { 10 | SHA1: string; 11 | } 12 | 13 | export function defineScript(script: S): S & SHA1 { 14 | return { 15 | ...script, 16 | SHA1: scriptSha1(script.SCRIPT) 17 | }; 18 | } 19 | 20 | export function scriptSha1(script: RedisScriptConfig['SCRIPT']): string { 21 | return createHash('sha1').update(script).digest('hex'); 22 | } 23 | -------------------------------------------------------------------------------- /packages/client/lib/sentinel/commands/SENTINEL_MASTER.ts: -------------------------------------------------------------------------------- 1 | import { RedisArgument, MapReply, BlobStringReply, Command } from '../../RESP/types'; 2 | import { CommandParser } from '../../client/parser'; 3 | import { transformTuplesReply } from '../../commands/generic-transformers'; 4 | 5 | export default { 6 | parseCommand(parser: CommandParser, dbname: RedisArgument) { 7 | parser.push('SENTINEL', 'MASTER', dbname); 8 | }, 9 | transformReply: { 10 | 2: transformTuplesReply, 11 | 3: undefined as unknown as () => MapReply 12 | } 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/client/lib/sentinel/commands/SENTINEL_MONITOR.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '../../client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '../../RESP/types'; 3 | 4 | export default { 5 | parseCommand(parser: CommandParser, dbname: RedisArgument, host: RedisArgument, port: RedisArgument, quorum: RedisArgument) { 6 | parser.push('SENTINEL', 'MONITOR', dbname, host, port, quorum); 7 | }, 8 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 9 | } as const satisfies Command; 10 | -------------------------------------------------------------------------------- /packages/client/lib/sentinel/module.ts: -------------------------------------------------------------------------------- 1 | 2 | import { RedisModules } from '../RESP/types'; 3 | import sentinel from './commands'; 4 | 5 | export default { 6 | sentinel 7 | } as const satisfies RedisModules; 8 | -------------------------------------------------------------------------------- /packages/client/lib/sentinel/wait-queue.ts: -------------------------------------------------------------------------------- 1 | import { SinglyLinkedList } from '../client/linked-list'; 2 | 3 | export class WaitQueue { 4 | #list = new SinglyLinkedList(); 5 | #queue = new SinglyLinkedList<(item: T) => unknown>(); 6 | 7 | push(value: T) { 8 | const resolve = this.#queue.shift(); 9 | if (resolve !== undefined) { 10 | resolve(value); 11 | return; 12 | } 13 | 14 | this.#list.push(value); 15 | } 16 | 17 | shift() { 18 | return this.#list.shift(); 19 | } 20 | 21 | wait() { 22 | return new Promise(resolve => this.#queue.push(resolve)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 | "./lib/sentinel/test-util.ts" 15 | ], 16 | "typedocOptions": { 17 | "entryPoints": [ 18 | "./index.ts", 19 | "./lib" 20 | ], 21 | "entryPointStrategy": "expand", 22 | "out": "../../documentation/client", 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/entraid/.nycrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@istanbuljs/nyc-config-typescript", 3 | "exclude": [ 4 | "integration-tests", 5 | "samples", 6 | "dist", 7 | "**/*.spec.ts", 8 | "lib/test-utils.ts" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/entraid/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "entraid@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | }, 7 | "npm": { 8 | "versionArgs": ["--workspaces-update=false"], 9 | "publishArgs": ["--access", "public"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/entraid/index.ts: -------------------------------------------------------------------------------- 1 | export * from './lib/index' -------------------------------------------------------------------------------- /packages/entraid/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './entra-id-credentials-provider-factory'; 2 | export * from './entraid-credentials-provider'; 3 | export * from './msal-identity-provider'; -------------------------------------------------------------------------------- /packages/entraid/tsconfig.integration-tests.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "./integration-tests/**/*.ts", 5 | "./lib/**/*.ts" 6 | ], 7 | "compilerOptions": { 8 | "noEmit": true 9 | }, 10 | } -------------------------------------------------------------------------------- /packages/entraid/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts", 8 | "./index.ts" 9 | ], 10 | "exclude": [ 11 | "./lib/**/*.spec.ts", 12 | "./lib/test-util.ts", 13 | ], 14 | "typedocOptions": { 15 | "entryPoints": [ 16 | "./lib" 17 | ], 18 | "entryPointStrategy": "expand", 19 | "out": "../../documentation/entraid" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/entraid/tsconfig.samples.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "./samples/**/*.ts", 5 | "./lib/**/*.ts" 6 | ], 7 | "compilerOptions": { 8 | "noEmit": true 9 | } 10 | } -------------------------------------------------------------------------------- /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 | "versionArgs": ["--workspaces-update=false"], 9 | "publishArgs": ["--access", "public"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/json/lib/commands/NUMMULTBY.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; 3 | import NUMINCRBY from './NUMINCRBY'; 4 | 5 | export default { 6 | IS_READ_ONLY: false, 7 | parseCommand(parser: CommandParser, key: RedisArgument, path: RedisArgument, by: number) { 8 | parser.push('JSON.NUMMULTBY'); 9 | parser.pushKey(key); 10 | parser.push(path, by.toString()); 11 | }, 12 | transformReply: NUMINCRBY.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/json/lib/commands/RESP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from "@redis/client/dist/lib/client/parser"; 2 | import { Command, RedisArgument } from "@redis/client/dist/lib/RESP/types"; 3 | 4 | type RESPReply = Array; 5 | 6 | export default { 7 | IS_READ_ONLY: true, 8 | parseCommand(parser: CommandParser, key: RedisArgument, path?: string) { 9 | parser.push('JSON.RESP'); 10 | parser.pushKey(key); 11 | if (path !== undefined) { 12 | parser.push(path); 13 | } 14 | }, 15 | transformReply: undefined as unknown as () => RESPReply 16 | } as const satisfies Command; -------------------------------------------------------------------------------- /packages/json/lib/commands/TOGGLE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, ArrayReply, NumberReply, NullReply, Command, } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, key: RedisArgument, path: RedisArgument) { 7 | parser.push('JSON.TOGGLE'); 8 | parser.pushKey(key); 9 | parser.push(path); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply | NullReply | ArrayReply 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/json/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { default } from './commands'; 2 | -------------------------------------------------------------------------------- /packages/json/lib/test-utils.ts: -------------------------------------------------------------------------------- 1 | import TestUtils from '@redis/test-utils'; 2 | import RedisJSON from '.'; 3 | 4 | export default TestUtils.createFromConfig({ 5 | dockerImageName: 'redislabs/client-libs-test', 6 | dockerImageVersionArgument: 'redis-version', 7 | defaultDockerVersion: '8.0-M05-pre' 8 | }); 9 | 10 | export const GLOBAL = { 11 | SERVERS: { 12 | OPEN: { 13 | serverArguments: [], 14 | clientOptions: { 15 | modules: { 16 | json: RedisJSON 17 | } 18 | } 19 | } 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /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/redis/.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "tagName": "redis@${version}", 4 | "commitMessage": "Release ${tagName}", 5 | "tagAnnotation": "Release ${tagName}" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/redis/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./index.ts" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /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 | "versionArgs": ["--workspaces-update=false"], 9 | "publishArgs": ["--access", "public"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASADD.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, alias: RedisArgument, index: RedisArgument) { 8 | parser.push('FT.ALIASADD', alias, index); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASDEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, alias: RedisArgument) { 8 | parser.push('FT.ALIASDEL', alias); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/ALIASUPDATE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, alias: RedisArgument, index: RedisArgument) { 8 | parser.push('FT.ALIASUPDATE', alias, index); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/CURSOR_DEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { SimpleStringReply, Command, RedisArgument, NumberReply, UnwrapReply } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, index: RedisArgument, cursorId: UnwrapReply) { 8 | parser.push('FT.CURSOR', 'DEL', index, cursorId.toString()); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/search/lib/commands/DICTDUMP.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, ArrayReply, SetReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser, dictionary: RedisArgument) { 8 | parser.push('FT.DICTDUMP', dictionary); 9 | }, 10 | transformReply: { 11 | 2: undefined as unknown as () => ArrayReply, 12 | 3: undefined as unknown as () => SetReply 13 | } 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SUGDEL.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument, string: RedisArgument) { 7 | parser.push('FT.SUGDEL'); 8 | parser.pushKey(key); 9 | parser.push(string); 10 | }, 11 | transformReply: undefined as unknown as () => NumberReply<0 | 1> 12 | } as const satisfies Command; 13 | -------------------------------------------------------------------------------- /packages/search/lib/commands/SUGLEN.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: true, 6 | parseCommand(parser: CommandParser, key: RedisArgument) { 7 | parser.push('FT.SUGLEN', key); 8 | }, 9 | transformReply: undefined as unknown as () => NumberReply 10 | } as const satisfies Command; 11 | -------------------------------------------------------------------------------- /packages/search/lib/commands/_LIST.spec.ts: -------------------------------------------------------------------------------- 1 | import { strict as assert } from 'node:assert'; 2 | import testUtils, { GLOBAL } from '../test-utils'; 3 | import _LIST from './_LIST'; 4 | import { parseArgs } from '@redis/client/lib/commands/generic-transformers'; 5 | 6 | describe('_LIST', () => { 7 | it('transformArguments', () => { 8 | assert.deepEqual( 9 | parseArgs(_LIST), 10 | ['FT._LIST'] 11 | ); 12 | }); 13 | 14 | testUtils.testWithClient('client.ft._list', async client => { 15 | assert.deepEqual( 16 | await client.ft._list(), 17 | [] 18 | ); 19 | }, GLOBAL.SERVERS.OPEN); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/search/lib/commands/_LIST.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { ArrayReply, SetReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: true, 6 | IS_READ_ONLY: true, 7 | parseCommand(parser: CommandParser) { 8 | parser.push('FT._LIST'); 9 | }, 10 | transformReply: { 11 | 2: undefined as unknown as () => ArrayReply, 12 | 3: undefined as unknown as () => SetReply 13 | } 14 | } as const satisfies Command; 15 | -------------------------------------------------------------------------------- /packages/search/lib/dialect/default.ts: -------------------------------------------------------------------------------- 1 | export const DEFAULT_DIALECT = '2'; 2 | -------------------------------------------------------------------------------- /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/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@redis/test-utils", 3 | "private": true, 4 | "main": "./dist/lib/index.js", 5 | "types": "./dist/lib/index.d.ts", 6 | "scripts": { 7 | "test": "nyc -r text-summary -r lcov mocha -r tsx './lib/**/*.spec.ts'" 8 | }, 9 | "peerDependencies": { 10 | "@redis/client": "*" 11 | }, 12 | "devDependencies": { 13 | "@types/yargs": "^17.0.32", 14 | "yargs": "^17.7.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/test-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist" 5 | }, 6 | "include": [ 7 | "./lib/**/*.ts" 8 | ], 9 | "references": [{ 10 | "path": "../client" 11 | }] 12 | } 13 | -------------------------------------------------------------------------------- /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 | "versionArgs": ["--workspaces-update=false"], 9 | "publishArgs": ["--access", "public"] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/DECRBY.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import INCRBY, { parseIncrByArguments } from './INCRBY'; 3 | 4 | export default { 5 | IS_READ_ONLY: INCRBY.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | const parser = args[0]; 8 | 9 | parser.push('TS.DECRBY'); 10 | parseIncrByArguments(...args); 11 | }, 12 | transformReply: INCRBY.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/DELETERULE.ts: -------------------------------------------------------------------------------- 1 | import { CommandParser } from '@redis/client/dist/lib/client/parser'; 2 | import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; 3 | 4 | export default { 5 | IS_READ_ONLY: false, 6 | parseCommand(parser: CommandParser, sourceKey: RedisArgument, destinationKey: RedisArgument) { 7 | parser.push('TS.DELETERULE'); 8 | parser.pushKeys([sourceKey, destinationKey]); 9 | }, 10 | transformReply: undefined as unknown as () => SimpleStringReply<'OK'> 11 | } as const satisfies Command; 12 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/MREVRANGE.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import MRANGE, { createTransformMRangeArguments } from './MRANGE'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: MRANGE.NOT_KEYED_COMMAND, 6 | IS_READ_ONLY: MRANGE.IS_READ_ONLY, 7 | parseCommand: createTransformMRangeArguments('TS.MREVRANGE'), 8 | transformReply: MRANGE.transformReply, 9 | } as const satisfies Command; 10 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/MREVRANGE_GROUPBY.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import MRANGE_GROUPBY, { createTransformMRangeGroupByArguments } from './MRANGE_GROUPBY'; 3 | 4 | export default { 5 | IS_READ_ONLY: MRANGE_GROUPBY.IS_READ_ONLY, 6 | parseCommand: createTransformMRangeGroupByArguments('TS.MREVRANGE'), 7 | transformReply: MRANGE_GROUPBY.transformReply, 8 | } as const satisfies Command; 9 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/MREVRANGE_SELECTED_LABELS.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import MRANGE_SELECTED_LABELS, { createTransformMRangeSelectedLabelsArguments } from './MRANGE_SELECTED_LABELS'; 3 | 4 | export default { 5 | IS_READ_ONLY: MRANGE_SELECTED_LABELS.IS_READ_ONLY, 6 | parseCommand: createTransformMRangeSelectedLabelsArguments('TS.MREVRANGE'), 7 | transformReply: MRANGE_SELECTED_LABELS.transformReply, 8 | } as const satisfies Command; 9 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/MREVRANGE_SELECTED_LABELS_GROUPBY.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import MRANGE_SELECTED_LABELS_GROUPBY, { createMRangeSelectedLabelsGroupByTransformArguments } from './MRANGE_SELECTED_LABELS_GROUPBY'; 3 | 4 | export default { 5 | IS_READ_ONLY: MRANGE_SELECTED_LABELS_GROUPBY.IS_READ_ONLY, 6 | parseCommand: createMRangeSelectedLabelsGroupByTransformArguments('TS.MREVRANGE'), 7 | transformReply: MRANGE_SELECTED_LABELS_GROUPBY.transformReply, 8 | } as const satisfies Command; 9 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/MREVRANGE_WITHLABELS.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import MRANGE_WITHLABELS, { createTransformMRangeWithLabelsArguments } from './MRANGE_WITHLABELS'; 3 | 4 | export default { 5 | NOT_KEYED_COMMAND: MRANGE_WITHLABELS.NOT_KEYED_COMMAND, 6 | IS_READ_ONLY: MRANGE_WITHLABELS.IS_READ_ONLY, 7 | parseCommand: createTransformMRangeWithLabelsArguments('TS.MREVRANGE'), 8 | transformReply: MRANGE_WITHLABELS.transformReply, 9 | } as const satisfies Command; 10 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/MREVRANGE_WITHLABELS_GROUPBY.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import MRANGE_WITHLABELS_GROUPBY, { createMRangeWithLabelsGroupByTransformArguments } from './MRANGE_WITHLABELS_GROUPBY'; 3 | 4 | export default { 5 | IS_READ_ONLY: MRANGE_WITHLABELS_GROUPBY.IS_READ_ONLY, 6 | parseCommand: createMRangeWithLabelsGroupByTransformArguments('TS.MREVRANGE'), 7 | transformReply: MRANGE_WITHLABELS_GROUPBY.transformReply, 8 | } as const satisfies Command; 9 | -------------------------------------------------------------------------------- /packages/time-series/lib/commands/REVRANGE.ts: -------------------------------------------------------------------------------- 1 | import { Command } from '@redis/client/dist/lib/RESP/types'; 2 | import RANGE, { transformRangeArguments } from './RANGE'; 3 | 4 | export default { 5 | IS_READ_ONLY: RANGE.IS_READ_ONLY, 6 | parseCommand(...args: Parameters) { 7 | const parser = args[0]; 8 | 9 | parser.push('TS.REVRANGE'); 10 | transformRangeArguments(...args); 11 | }, 12 | transformReply: RANGE.transformReply 13 | } as const satisfies Command; 14 | -------------------------------------------------------------------------------- /packages/time-series/lib/index.ts: -------------------------------------------------------------------------------- 1 | export { 2 | default, 3 | TIME_SERIES_ENCODING, TimeSeriesEncoding, 4 | TIME_SERIES_DUPLICATE_POLICIES, TimeSeriesDuplicatePolicies 5 | } from './commands'; 6 | export { TIME_SERIES_AGGREGATION_TYPE, TimeSeriesAggregationType } from './commands/CREATERULE'; 7 | export { TIME_SERIES_BUCKET_TIMESTAMP, TimeSeriesBucketTimestamp } from './commands/RANGE'; 8 | export { TIME_SERIES_REDUCERS, TimeSeriesReducer } from './commands/MRANGE_GROUPBY'; 9 | -------------------------------------------------------------------------------- /packages/time-series/lib/test-utils.ts: -------------------------------------------------------------------------------- 1 | import TestUtils from '@redis/test-utils'; 2 | import TimeSeries from '.'; 3 | 4 | export default TestUtils.createFromConfig({ 5 | dockerImageName: 'redislabs/client-libs-test', 6 | dockerImageVersionArgument: 'redis-version', 7 | defaultDockerVersion: '8.0-M05-pre' 8 | }); 9 | 10 | export const GLOBAL = { 11 | SERVERS: { 12 | OPEN: { 13 | serverArguments: [], 14 | clientOptions: { 15 | modules: { 16 | ts: TimeSeries 17 | } 18 | } 19 | } 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /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 | "compilerOptions": { 3 | "lib": ["ES2023"], 4 | "module": "NodeNext", 5 | "moduleResolution": "NodeNext", 6 | "target": "ES2022", 7 | 8 | "strict": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "noUnusedLocals": true, 11 | "esModuleInterop": true, 12 | "skipLibCheck": true, 13 | 14 | "composite": true, 15 | "sourceMap": true, 16 | "declaration": true, 17 | "declarationMap": true, 18 | "allowJs": true, 19 | "resolveJsonModule": true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { 5 | "path": "./packages/client" 6 | }, 7 | { 8 | "path": "./packages/test-utils" 9 | }, 10 | { 11 | "path": "./packages/bloom" 12 | }, 13 | { 14 | "path": "./packages/json" 15 | }, 16 | { 17 | "path": "./packages/search" 18 | }, 19 | { 20 | "path": "./packages/time-series" 21 | }, 22 | { 23 | "path": "./packages/entraid" 24 | }, 25 | { 26 | "path": "./packages/redis" 27 | } 28 | ] 29 | } 30 | --------------------------------------------------------------------------------