diff --git a/packages/client/lib/sentinel/index.ts b/packages/client/lib/sentinel/index.ts index d25fa03e55..92a87fbb14 100644 --- a/packages/client/lib/sentinel/index.ts +++ b/packages/client/lib/sentinel/index.ts @@ -93,10 +93,10 @@ export class RedisSentinelClient< RESP extends RespVersions = 2, TYPE_MAPPING extends TypeMapping = {} >( + options: RedisSentinelOptions, internal: RedisSentinelInternal, clientInfo: ClientInfo, commandOptions?: CommandOptions, - options?: RedisSentinelOptions ) { return RedisSentinelClient.factory(options)(internal, clientInfo, commandOptions); } @@ -272,7 +272,7 @@ export default class RedisSentinel< this.#options = options; - if (options?.commandOptions) { + if (options.commandOptions) { this.#commandOptions = options.commandOptions; } @@ -307,7 +307,7 @@ export default class RedisSentinel< Sentinel.prototype.Multi = RedisSentinelMultiCommand.extend(config); - return (options?: Omit>) => { + return (options: Omit>) => { // returning a "proxy" to prevent the namespaces.self to leak between "proxies" return Object.create(new Sentinel(options)) as RedisSentinelType; }; @@ -319,7 +319,7 @@ export default class RedisSentinel< S extends RedisScripts = {}, RESP extends RespVersions = 2, TYPE_MAPPING extends TypeMapping = {} - >(options?: RedisSentinelOptions) { + >(options: RedisSentinelOptions) { return RedisSentinel.factory(options)(options); } @@ -409,7 +409,7 @@ export default class RedisSentinel< try { return await fn( - RedisSentinelClient.create(this._self.#internal, clientInfo, this._self.#commandOptions, this._self.#options) + RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions) ); } finally { const promise = this._self.#internal.releaseClientLease(clientInfo); @@ -510,7 +510,7 @@ export default class RedisSentinel< async aquire(): Promise> { const clientInfo = await this._self.#internal.getClientLease(); - return RedisSentinelClient.create(this._self.#internal, clientInfo, this._self.#commandOptions, this._self.#options); + return RedisSentinelClient.create(this._self.#options, this._self.#internal, clientInfo, this._self.#commandOptions); } getSentinelNode(): RedisNode | undefined { diff --git a/packages/client/lib/sentinel/types.ts b/packages/client/lib/sentinel/types.ts index 1f868ec517..428e7bccd6 100644 --- a/packages/client/lib/sentinel/types.ts +++ b/packages/client/lib/sentinel/types.ts @@ -29,14 +29,16 @@ export interface RedisSentinelOptions< * The maximum number of times a command will retry due to topology changes. */ maxCommandRediscovers?: number; + // TODO: omit properties that users shouldn't be able to specify for sentinel at this level /** * The configuration values for every node in the cluster. Use this for example when specifying an ACL user to connect with */ - nodeClientOptions?: RedisClientOptions; + nodeClientOptions?: RedisClientOptions; + // TODO: omit properties that users shouldn't be able to specify for sentinel at this level /** * The configuration values for every sentinel in the cluster. Use this for example when specifying an ACL user to connect with */ - sentinelClientOptions?: RedisClientOptions; + sentinelClientOptions?: RedisClientOptions; /** * The number of clients connected to the master node */