diff --git a/packages/client/lib/sentinel/index.ts b/packages/client/lib/sentinel/index.ts index d25fa03e559..92a87fbb145 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<M, F, S, RESP, TYPE_MAPPING>, internal: RedisSentinelInternal<M, F, S, RESP, TYPE_MAPPING>, clientInfo: ClientInfo, commandOptions?: CommandOptions<TYPE_MAPPING>, - options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING> ) { 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<RedisSentinelOptions, keyof Exclude<typeof config, undefined>>) => { + return (options: Omit<RedisSentinelOptions, keyof Exclude<typeof config, undefined>>) => { // returning a "proxy" to prevent the namespaces.self to leak between "proxies" return Object.create(new Sentinel(options)) as RedisSentinelType<M, F, S, RESP, TYPE_MAPPING>; }; @@ -319,7 +319,7 @@ export default class RedisSentinel< S extends RedisScripts = {}, RESP extends RespVersions = 2, TYPE_MAPPING extends TypeMapping = {} - >(options?: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) { + >(options: RedisSentinelOptions<M, F, S, RESP, TYPE_MAPPING>) { 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<RedisSentinelClientType<M, F, S, RESP, TYPE_MAPPING>> { 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 1f868ec5177..428e7bccd66 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<M, F, S, RESP, TYPE_MAPPING, RedisTcpSocketOptions>; + nodeClientOptions?: RedisClientOptions<RedisModules, RedisFunctions, RedisScripts, RESP, TYPE_MAPPING, RedisTcpSocketOptions>; + // 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<M, F, S, RESP, TYPE_MAPPING, RedisTcpSocketOptions>; + sentinelClientOptions?: RedisClientOptions<RedisModules, RedisFunctions, RedisScripts, RESP, TYPE_MAPPING, RedisTcpSocketOptions>; /** * The number of clients connected to the master node */