diff --git a/CHANGELOG.md b/CHANGELOG.md index ada796067e..2e0370e1b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/node/npm/glide/index.ts b/node/npm/glide/index.ts index f9f35d8685..b22818940d 100644 --- a/node/npm/glide/index.ts +++ b/node/npm/glide/index.ts @@ -113,9 +113,12 @@ function initialize() { ZaddOptions, ScoreBoundry, UpdateOptions, + ProtocolVersion, RangeByIndex, RangeByScore, RangeByLex, + ReadFrom, + RedisCredentials, SortedSetRange, StreamTrimOptions, StreamAddOptions, @@ -181,9 +184,12 @@ function initialize() { ZaddOptions, ScoreBoundry, UpdateOptions, + ProtocolVersion, RangeByIndex, RangeByScore, RangeByLex, + ReadFrom, + RedisCredentials, SortedSetRange, StreamTrimOptions, StreamAddOptions, diff --git a/node/src/BaseClient.ts b/node/src/BaseClient.ts index bdf192a33a..3d0a6c284c 100644 --- a/node/src/BaseClient.ts +++ b/node/src/BaseClient.ts @@ -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. @@ -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. @@ -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