Skip to content

Commit

Permalink
Node: Exported client configuration types (valkey-io#2023)
Browse files Browse the repository at this point in the history
* Fix exports.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
  • Loading branch information
Yury-Fridlyand authored Jul 29, 2024
1 parent d693105 commit f69904e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#### Changes
* Node: Exported client configuration types ([#2023](https://github.com/valkey-io/valkey-glide/pull/2023))
* Java, Python: Update docs for GEOSEARCH command ([#2017](https://github.com/valkey-io/valkey-glide/pull/2017))
* Node: Added FUNCTION LIST command ([#2019](https://github.com/valkey-io/valkey-glide/pull/2019))
* Node: Added GEOSEARCH command ([#2007](https://github.com/valkey-io/valkey-glide/pull/2007))
Expand Down
6 changes: 6 additions & 0 deletions node/npm/glide/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,12 @@ function initialize() {
ZaddOptions,
ScoreBoundry,
UpdateOptions,
ProtocolVersion,
RangeByIndex,
RangeByScore,
RangeByLex,
ReadFrom,
RedisCredentials,
SortedSetRange,
StreamTrimOptions,
StreamAddOptions,
Expand Down Expand Up @@ -181,9 +184,12 @@ function initialize() {
ZaddOptions,
ScoreBoundry,
UpdateOptions,
ProtocolVersion,
RangeByIndex,
RangeByScore,
RangeByLex,
ReadFrom,
RedisCredentials,
SortedSetRange,
StreamTrimOptions,
StreamAddOptions,
Expand Down
11 changes: 8 additions & 3 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ export type ReturnType =
| ReturnTypeAttribute
| ReturnType[];

type RedisCredentials = {
/** Represents the credentials for connecting to a server. */
export type RedisCredentials = {
/**
* The username that will be used for authenticating connections to the Redis servers.
* If not supplied, "default" will be used.
Expand All @@ -210,13 +211,17 @@ type RedisCredentials = {
password: string;
};

type ReadFrom =
/** Represents the client's read from strategy. */
export type ReadFrom =
/** Always get from primary, in order to get the freshest data.*/
| "primary"
/** Spread the requests between all replicas in a round robin manner.
If no replica is available, route the requests to the primary.*/
| "preferReplica";

/**
* Configuration settings for creating a client. Shared settings for standalone and cluster clients.
*/
export type BaseClientConfiguration = {
/**
* DNS Addresses and ports of known nodes in the cluster.
Expand Down Expand Up @@ -3954,7 +3959,7 @@ export class BaseClient {
): connection_request.IConnectionRequest {
const readFrom = options.readFrom
? this.MAP_READ_FROM_STRATEGY[options.readFrom]
: undefined;
: connection_request.ReadFrom.Primary;
const authenticationInfo =
options.credentials !== undefined &&
"password" in options.credentials
Expand Down

0 comments on commit f69904e

Please sign in to comment.