1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Commit Graph

87 Commits

Author SHA1 Message Date
69d507a572 refactor!: redis 8 compatibility improvements and test infrastructure updates (#2893)
* churn(test): use redislabs/client-libs-test for testing

This  switches our testing infrastructure from redis/redis-stack to
redislabs/client-libs-test Docker image across all packages. This change
also updates the default Docker version from 7.4.0-v1 to 8.0-M04-pre.

* churn(test): verify CONFIG SET / GET compatibility with Redis 8

- Add tests for Redis 8 search configuration settings
- Deprecate Redis Search CONFIG commands in favor of standard CONFIG
- Test read-only config restrictions for Redis 8

* churn(test): handle Redis 8 coordinate precision in GEOPOS

- Update GEOPOS tests to handle increased precision in Redis 8 (17 decimal places vs 14)
- Add precision-aware coordinate comparison helper
- Add comprehensive test suite for coordinate comparison function

* test(search): adapt SUGGET tests for Redis 8 empty results

- Update tests to expect empty array ([]) instead of null for SUGGET variants
- Affects sugGet, sugGetWithPayloads, sugGetWithScores, and sugGetWithScoresWithPayloads

* test(search): support Redis 8 INFO indexes_all field

- Add indexes_all field introduced in Redis 8 to index definition test

* refactor!(search): simplify PROFILE commands to return raw response

- BREAKING CHANGE: FT.PROFILE now returns raw response, letting users implement their own parsing

* test: improve version-specific test coverage

- Add `testWithClientIfVersionWithinRange` method to run tests for specific Redis versions
- Refactor TestUtils to handle version comparisons more accurately
- Update test utilities across Redis modules to run tests against multiple versions, and not against latest only
2025-02-27 10:56:58 +02:00
4708736f3b new "transform arguments" API for better key and metadata extraction (#2733)
* Parser support with all commands

* remove "dist" from all imports for consistency

* address most of my review comments

* small tweak to multi type mapping handling

* tweak multi commands / fix addScript cases

* nits

* addressed all in person review comments

* revert addCommand/addScript changes to multi-commands

addCommand needs to be there for sendCommand like ability within a multi.

If its there, it might as well be used by createCommand() et al, to avoid repeating code.

addScript is there (even though only used once), but now made private to keep the logic for bookkeeping near each other.
2024-10-31 12:16:59 -04:00
b2d35c5286 V5 bringing RESP3, Sentinel and TypeMapping to node-redis
RESP3 Support
   - Some commands responses in RESP3 aren't stable yet and therefore return an "untyped" ReplyUnion.
 
Sentinel

TypeMapping

Correctly types Multi commands

Note: some API changes to be further documented in v4-to-v5.md
2024-10-15 17:46:52 +03:00
18ccc28c2f fix hash expiration tests 2024-07-29 10:11:04 -04:00
6f79b49f73 updated per discussion w/ leibele (#2804) 2024-07-24 13:15:01 -04:00
b884e132fa don't expand/copy rawValues, return it directly. (#2800) 2024-07-23 21:07:32 +03:00
d09aaa311d small internal tweak for maxage per discussion w/ leibele (#2803) 2024-07-23 12:59:27 -04:00
64fca37944 Support the NOVALUES option of HSCAN (#2711)
* Support the NOVALUES option of HSCAN

Issue #2705

The NOVALUES option instructs HSCAN to only return keys, without their
values. This is materialized as a new command, `hScanNoValues`, given
that the return type is different from the usual return type of `hScan`.
Also a new iterator is provided, `hScanNoValuesIterator`, for the same
reason.

* skip hscan novalues test if redis < 7.4

* Also don't test hscan no values iterator < 7.4

---------

Co-authored-by: Shaya Potter <spotter@gmail.com>
2024-07-14 14:20:30 +03:00
7d43a97bc7 add CLIENT KILL maxAge support (v4) (#2761) 2024-07-10 19:45:06 +03:00
b4df2b24a8 add support for all hash field expiration commands (#2787) 2024-07-10 19:44:30 +03:00
a8b81bdd01 Send client user-agent during connection, via CLIENT SETINFO (#2645)
* Add SETINFO support to client connection, with the ability to disable sending the user agent if the end user desires.  * Also enables modifying the user-agent with a tag to enable distinguishing different usages.
2023-11-07 14:43:20 +02:00
e00041e0eb Fix: XAUTOCLAIM after a TRIM with pending messages returns nil (#2565)
* fix(client): XCLAIM & XAUTOCLAIM after a TRIM might return nils

* fix(client): Fix race condition in specs

* revert test utils changes

* make tests faster

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-19 17:37:16 -04:00
4ec97be4f0 fix #1956 - add support for LATENCY HISTORY (#2555)
* added support for LATENCY_HISTORY command

* clean code

* Update LATENCY_HISTORY.ts

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-19 16:21:54 -04:00
6848f3d207 Add support for PUBSUB SHARDNUMSUB (#2541)
* Add support for command 'PUBSUB SHARDNUMSUB'

* Use import from PUBSUB_SHARDNUMSUB

* Add test case for non-empty reply

* clean tests

* run tests in redis >= 7, fix integration test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-19 15:59:02 -04:00
01ca54e907 fix #1970 - add support for RESTORE (#2535)
* - Added RESTORE functionality

* add FIRST_KEY_INDEX, fix tests, clean example, add example to examples table

* use returnBuffers in test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-18 19:45:33 -04:00
8ecfd3ebda Add support for CLUSTER MYSHARDID (#2528)
* Add support for CLUSTER.MYSHARDID command

* Update CLUSTER_MYSHARDID.ts

* Update CLUSTER_MYSHARDID.spec.ts

* add test and clean code

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-18 19:31:03 -04:00
1f97893785 fix ACL GETUSER test 2023-09-18 18:25:13 -04:00
4e610c2f8a Add support for CLIENT NO-TOUCH (#2497) 2023-09-18 17:49:37 -04:00
e696653bf9 Add support for LATENCY LATEST (#2514)
* Add support for LATENCY LATEST.

* Fix the review comments.

* Fix the review comments.

* Update LATENCY_LATEST.ts

* Update dockers.ts

* Update LATENCY_GRAPH.spec.ts

* enable debug mode in tests

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-05-29 09:00:58 -04:00
d4f194352f XINFO CONSUMERS - add support for the inactive field (#2490)
* Support XINFO CONSUMERS: Added the inactive field

* Update XINFO_CONSUMERS.ts

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-05-21 08:06:46 -04:00
3b1bad2296 Add support for sharded PubSub (#2373)
* refactor pubsub, add support for sharded pub sub

* run tests in redis 7 only, fix PUBSUB SHARDCHANNELS test

* add some comments and fix some bugs

* PubSubType, not PubSubTypes 🤦‍♂️

* remove test.txt

* fix some bugs, add tests

* add some tests

* fix #2345 - allow PING in PubSub mode (remove client side validation)

* remove .only

* revert changes in cluster/index.ts

* fix tests minimum version

* handle server sunsubscribe

* add 'sharded-channel-moved' event to docs, improve the events section in the main README (fix #2302)

* exit "resubscribe" if pubsub not active

* Update commands-queue.ts

* Release client@1.5.0-rc.0

* WIP

* use `node:util` instead of `node:util/types` (to support node 14)

* run PubSub resharding test with Redis 7+

* fix inconsistency in live resharding test

* add some tests

* fix iterateAllNodes when starting from a replica

* fix iterateAllNodes random

* fix slotNodesIterator

* fix slotNodesIterator

* clear pubSubNode when node in use

* wait for all nodes cluster state to be ok before testing

* `cluster.minimizeConections` tests

* `client.reconnectStrategry = false | 0` tests

* sharded pubsub + cluster 🎉

* add minimum version to sharded pubsub tests

* add cluster sharded pubsub live reshard test, use stable dockers for tests, make sure to close pubsub clients when a node disconnects from the cluster

* fix "ssubscribe & sunsubscribe" test

* lock search docker to 2.4.9

* change numberOfMasters default to 2

* use edge for bloom

* add tests

* add back getMasters and getSlotMaster as deprecated functions

* add some tests

* fix reconnect strategy + docs

* sharded pubsub docs

* Update pub-sub.md

* some jsdoc, docs, cluster topology test

* clean pub-sub docs

Co-authored-by: Simon Prickett <simon@redislabs.com>

* reconnect startegy docs and bug fix

Co-authored-by: Simon Prickett <simon@redislabs.com>

* refine jsdoc and some docs

Co-authored-by: Simon Prickett <simon@redislabs.com>

* I'm stupid

* fix cluster topology test

* fix cluster topology test

* Update README.md

* Update clustering.md

* Update pub-sub.md

Co-authored-by: Simon Prickett <simon@redislabs.com>
2023-01-25 11:00:39 -05:00
e75a5db3e4 Add CLIENT LIST command and fix CLIENT INFO (#2368)
* fix client info

* add client list

* fix key validation in transformClientInfoReply

* fix issue with field in CLIENT LIST reply

* clean code

* fix multimem

* fix qbufFree argvMem totMem multiMem

Co-authored-by: Leibale <me@leibale.com>
2023-01-25 10:52:59 -05:00
63511e5b9b Add latency graph command (#2359)
* add latency graph command

* fix coding style

* Clean code

* use "enable-debug-command" is redis 7+ only

* Update LATENCY_GRAPH.spec.ts

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-01-18 12:55:38 -05:00
aa75ee49c6 #2038 Resolve legacy mode hGetAll returning in the wrong format compared to v3 results (#2367)
* Ensure that transformReply is optionally passed through to commands in legacy mode within multi

* Execute transformReply on legacy #sendCommand

* Scope transform changes to hGetAll

* Extensible method of transforming legacy replies, expands RedisCommand interface

* check `TRANSFORM_LEGACY_REPLY` on client creation (rather then on command exec), add tests

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-01-18 12:54:29 -05:00
f6093b7b0f fix: zero ttl is ignored (#2349)
* fix: zero ttl is ignored

* Update SET.ts

* Update SET.ts

Co-authored-by: Leibale Eidelman <me@leibale.com>
2022-12-15 12:04:13 -05:00
2a8e11a51d Export SetOptions type in redis/client command (#2268)
* Export setOptions type

* Export setOptions type in commands

* Revert "Export setOptions type in commands"

* Export SetOptions type in redis client

* Export SetOptions type in @redis/client

* Fix lint
2022-09-21 17:05:16 -04:00
e1c0580d65 Fix CLUSTER_NODES ipv6 address parsing (#2269) 2022-09-19 13:31:21 -04:00
ac032d82a0 fix: loop over arguments instead of spreading (#2160)
* fix: loop over arguments instead of spreading

* update to use concat

* use the returned array from pushVerdictArguments (instead of assuming it'll push to the original array)

* fix "Type 'RedisCommandArguments' is not assignable to type 'string[]'."

* fix "Argument of type 'RedisCommandArgument | RedisCommandArguments[]' is not assignable to parameter of type 'RedisCommandArgument | RedisCommandArgument[]'"

* fix "Type 'RedisCommandArguments' is not assignable to type 'string[]'"

Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
2022-07-13 07:01:35 -04:00
f9f5e494dd fixed MIGRATE function when key is array (#2184)
* fix: 2163 push empty string as arg

* fix: updated migrate test with keys array
2022-07-07 14:33:58 -04:00
82f43d9a53 Fix issue with buffers in objects using hSet (#2139)
* Fix issue with buffers in objects using hSet

When using hSet with an object, any buffer values inside the object are converted to strings instead of left as buffers.
This fix specifically handles the special case of buffers, whilst casting everything else strings (to continue "gracefully" handling the case where the value not a valid type).

* Update HSET.ts

* Update HSET.spec.ts

Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
2022-05-26 09:56:10 -04:00
7196b907e5 fix #1915 - CLIENT TRACKINGINFO (#2127)
* fix #1915 - CLIENT TRACKINGINFO

* remove .only
2022-05-12 13:05:27 -04:00
d8db974980 fix #1914 - CLIENT TRACKING (#2126) 2022-05-12 12:56:09 -04:00
429b11e020 fix #1959 - LCS (#2129)
* fix #1959 - LCS

* newlines at end of files
2022-05-11 14:24:07 -04:00
24c2c867f8 fix #1917 - CLIENT UNPAUSE (#2128)
* fix #1917 - CLIENT UNPAUSE

* fix CLIENT UNPAUSE
2022-05-11 14:20:52 -04:00
94dbcc847b fix #1912 - CLIENT PAUSE (#2125)
* fix #1912 - CLIENT PAUSE

* fix client pause

* Update commands.ts
2022-05-11 10:02:29 -04:00
53a96ccce4 fix #1911 - CLIENT NO-EVICT (#2124) 2022-05-11 09:36:23 -04:00
06c1d2c243 Support all GEORADIUS Commands (#2017)
* Support all GEORADIUS Commands

* move store bool to options

* simplify transformReply for store commands

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-05-11 09:36:12 -04:00
0752f143a6 prepare 4.1.0 (#2111)
* increase test coverage

* @node-redis to @redis

* ugprade deps

* fix benchmark

* use 7.0 docker (not rc), update readmes, clean code, fix @-redis import

* update readme

* fix function in cluster

* update docs

Co-authored-by: Chayim <chayim@users.noreply.github.com>

* Update clustering.md

* add subpackages move warning

* drop support for node 12

* upgrade deps

* fix tsconfig.base.json

Co-authored-by: Chayim <chayim@users.noreply.github.com>
2022-05-02 11:48:12 -04:00
baf67fd87f fix #1976 - XSETID (#2104) 2022-04-26 09:05:44 -04:00
b586ccb9d7 fix #1904 - ACL DRYRUN (#2102)
* fix #1904 - ACL DRYRUN

* clean code

* fix test
2022-04-26 09:04:21 -04:00
11c6c24881 Add support for redis functions (#2020)
* fix #1906 - implement BITFIELD_RO

* initial support for redis functions

* fix test utils

* redis functions commands and tests

* upgrade deps

* fix "Property 'uninstall' does not exist on type 'SinonFakeTimers'"

* upgrade dockers version

* Merge branch 'master' of github.com:redis/node-redis into functions

* fix FUNCTION LIST WITHCODE and FUNCTION STATS

* upgrade deps

* set minimum version for FCALL and FCALL_RO

* fix FUNCTION LOAD

* FUNCTION LOAD

* fix FUNCTION LOAD & FUNCTION LIST & FUNCTION LOAD WITHCODE

* fix FUNCTION_LIST_WITHCODE test
2022-04-25 09:09:23 -04:00
b1a0b48d2c Support new muilti pop commands (#2051)
* Support new muilti pop commands

* remove .only

* clean code

* fix for 4558ec6a31

* fix tests

Co-authored-by: leibale <leibale1998@gmail.com>
2022-04-25 07:50:43 -04:00
33a3f3f6c6 run tests with redis 7 as well - copied from #2020 (#2062)
* run tests on redis 7 as well - copied from #2020

* copy some changes from #2020

* clean BITCOUNT
2022-03-30 08:12:21 -04:00
b0fb3bd63f Support COMMAND GETKEYSANDFLAGS (#2039)
* Support COMMAND GETKEYSANDFLAGS

* Update COMMAND_GETKEYSANDFLAGS.spec.ts

remove '.only'

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-30 06:31:26 -04:00
f6f645bdbb Support SORT_RO (#2041)
* Support SORT_RO

* move pushSortReadOnlyArgs and SortReadOnlyOptions to generic-transformers

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-28 18:36:47 -04:00
5821fcbe4d Support CLUSTER commands (#2015)
* Support CLUSTER commands

* add some client tests

* remove only

* delete cluster slaves

* delete reset clietn test

* SET SLOT

* test with client

* fix fail

* Update CLUSTER_COUNTKEYSINSLOT.spec.ts

* move commands to client/commands.ts

* clusterNode

* remove CLUSTER-SET-CONFIG-EPOCH test with client

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-28 18:31:15 -04:00
515adf1346 Support OBJECT [...] commands (#2014)
* Support OBJECT [...] commands

* move commands to cluster/commands.ts

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-27 13:35:01 -04:00
6ca45f674d support command LATENCY DOCTOR (#2053)
* The Latency Doctor Command has been added to the project

* Update LATENCY_DOCTOR.ts

* Update LATENCY_DOCTOR.spec.ts

* Update LATENCY_DOCTOR.spec.ts

Co-authored-by: QuentinRK <q.rankin@outlook.com>
Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
2022-03-27 13:29:10 -04:00
6b8a40a36b Support new cluster commands (#2050)
* Support new cluster commands

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-27 13:06:27 -04:00
fe16dc0eae Support BIT|BYTE option (#2035)
* Support BIT|BYTE option

* clean code

* clean code

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-24 11:00:08 -04:00