1
0
mirror of https://github.com/redis/node-redis.git synced 2025-07-31 05:44:24 +03:00
Commit Graph

256 Commits

Author SHA1 Message Date
1f405e94de [CAE-342] Enabled all tests 2025-03-10 09:46:12 +02:00
32048199eb [CAE-342] Some tests 2025-03-07 17:16:39 +02:00
d2544201fd [CAE-342] Disabled one more test 2025-03-06 12:16:25 +02:00
726829693d [CAE-342] Fixed issue with sentinel connect 2025-03-06 12:07:42 +02:00
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
6066692cb9 Release client@5.0.0-next.6 2025-01-30 11:02:54 +02:00
6d21de3f31 feat(auth): add Entra ID identity provider integration for Redis client authentication (#2877)
* feat(auth): refactor authentication mechanism to use CredentialsProvider

- Introduce new credential providers: AsyncCredentialsProvider, StreamingCredentialsProvider
- Update client handshake process to use the new CredentialsProviders and to support async credentials fetch / credentials refresh
- Internal conversion of username/password to a CredentialsProvider
- Modify URL parsing to accommodate the new authentication structure
- Tests

* feat(auth): auth extensions

Introduces TokenManager and supporting classes to handle token acquisition, automatic
refresh, and updates via identity providers. This foundation enables consistent
authentication token management across different identity provider implementations.

Key additions:
- Add TokenManager to obtain and maintain auth tokens from identity providers
  with automated refresh scheduling based on TTL and configurable thresholds
- Add IdentityProvider interface for token acquisition from auth providers
- Implement Token class for managing token state and TTL tracking
- Include configurable retry mechanism with exponential backoff and jitter
- Add comprehensive test suite covering refresh cycles and error handling

This change establishes the core infrastructure needed for reliable token
lifecycle management across different authentication providers.

* feat(auth): add Entra ID identity provider integration

Introduces Entra ID (former Azure AD) authentication support with multiple authentication flows
and automated token lifecycle management.

Key additions:
- Add EntraIdCredentialsProvider for handling Entra ID authentication flows
- Implement MSALIdentityProvider to integrate with MSAL/EntraID authentication library
- Add support for multiple authentication methods:
  - Managed identities (system and user-assigned)
  - Client credentials with certificate
  - Client credentials with secret
  - Authorization Code flow with PKCE
- Add factory class with builder methods for each authentication flow
- Include sample Express server implementation for Authorization Code flow
- Add comprehensive configuration options for authority and token management

* feat(test-utils): improve cluster testing

- Add support for configuring replica authentication with 'masterauth'
- Allow default client configuration during test cluster creation

This improves the testing framework's flexibility by automatically
configuring replica authentication when '--requirepass' is used and
enabling custom client configurations across cluster nodes.

* feat(auth): add EntraId integration tests

- Add integration tests for token renewal and re-authentication flows
- Update credentials provider to use uniqueId as username instead of account username
- Add test utilities for loading Redis endpoint configurations
- Split TypeScript configs into separate files for samples and integration tests
- Remove `@redis/authx` package and nest it under `@`
2025-01-30 10:29:19 +02:00
ffa7d2525c Fix cluster-slots discover race condition again (#2867) 2024-11-25 15:36:33 -05:00
9a3e1c5e03 Fix creation of cluster client again (#2870)
* shallow copy of this.#options.defaults.socket

* shallow copy of this.#options.defaults.socket

* nit

* fix redis create cluster client again

---------

Co-authored-by: Max Gruenfelder <maximilian.gruenfelder@sap.com>
Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-11-25 15:28:44 -05:00
8dab27ed02 fix sentinel generics (#2859)
* fix sentinel generics

* comment nit
2024-11-04 10:23:34 -05: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
dca39e1402 Release client@5.0.0-next.5 2024-10-15 17:30:06 +02: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
b493afac60 Release client@1.6.0 2024-07-29 10:29:17 -04: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
60c1c466ba Release client@1.5.17 2024-07-02 13:37:23 -04:00
4ac97eeaac fix createCluster - copy options.defaults.socket before modifying it (#2783)
* shallow copy of this.#options.defaults.socket

* shallow copy of this.#options.defaults.socket

* nit

---------

Co-authored-by: Max Gruenfelder <maximilian.gruenfelder@sap.com>
Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-07-02 09:00:27 -07:00
d5518e0b5f Release client@1.5.16 2024-05-16 14:01:01 -04:00
d7f7f79e53 Release client@1.5.15 2024-05-16 13:53:52 -04:00
bfa803fa55 Fix race condition when slots are re-calculated (#2731) 2024-05-16 10:17:32 -07:00
03ab4fbd6c Release client@1.5.14 2024-02-05 09:24:20 -05:00
295647cf9d fix(clustered pubsub): check that client.isOpen before calling client.disconnect() when unsubscribing (#2687)
* Confirm the client isOpen before disconnecting

* Write tests

* fix tests

* fix tests

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-01-29 00:25:26 -08:00
bb6f14cf7e Release client@1.5.13 2023-12-18 15:18:29 -05:00
f4680f0849 fix #2665 - handle errors in multi/pipeline replies (#2666)
* fix #2665 - handle errors in multi/pipeline replies

* fix MultiErrorReply replies type

* run tests on all versions, remove console.log, fix bug

* add errors iterator helper

* test `.errors()` as well
2023-12-18 15:15:21 -05:00
debd277002 Release client@1.5.12 2023-11-20 13:48:13 -05:00
623b56b5ca fix cluster.sUnsubscribe - make listener optional 2023-11-20 13:40:38 -05:00
68d835d7a2 fix #2632 - handle socket close in "socket initiator" phase (#2653) 2023-11-20 13:16:36 -05: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
d1fdf1e7e2 Release client@1.5.11 2023-09-22 07:01:48 -04:00
38e9a40d1a fix #2619 #2618 #2617 #2616 - support for node >= 14 2023-09-22 07:00:26 -04:00
fef006cc1d Release client@1.5.10 2023-09-19 17:53:20 -04: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
fb255eb5d0 Have client.connect() return a Promise<RedisClient> (#2602)
* Connect returns the instance of the client

* Added a test

* No auto setup

* Added a bit of docs

* fix the return type, test, and the docs

* fix return type

* Update packages/client/lib/client/index.spec.ts

Co-authored-by: Francisco Presencia <franciscop@users.noreply.github.com>

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-09-18 17:40:08 -04:00
4976231f24 upgrade deps, remove node 14 & 16 from tests matrix 2023-09-18 17:23:01 -04:00
504a05baad Release client@1.5.9 2023-08-23 15:16:51 -04:00
fe74e322dd upgrade deps 2023-08-23 14:53:26 -04:00
bc8abd5a38 fixes #2524 delaying graceful exit while pingInterval is set (#2525)
* fixes #2524

* `clearTimeout` in `disconnect` too

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-08-23 13:20:20 -04:00
2baf5df23c Release client@1.5.8 2023-05-31 15:46:32 +03:00