You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix #1783 - fix some commands in legacy mode
This commit is contained in:
@@ -320,6 +320,10 @@ export default class RedisClient<M extends RedisModules, S extends RedisScripts>
|
||||
this.#defineLegacyCommand(name);
|
||||
}
|
||||
|
||||
for (const name of Object.keys(COMMANDS)) {
|
||||
(this as any)[name.toLowerCase()] = (this as any)[name];
|
||||
}
|
||||
|
||||
// hard coded commands
|
||||
this.#defineLegacyCommand('SELECT');
|
||||
this.#defineLegacyCommand('select');
|
||||
@@ -336,8 +340,8 @@ export default class RedisClient<M extends RedisModules, S extends RedisScripts>
|
||||
}
|
||||
|
||||
#defineLegacyCommand(name: string): void {
|
||||
(this as any).#v4[name] = (this as any)[name].bind(this);
|
||||
(this as any)[name] = (this as any)[name.toLowerCase()] =
|
||||
this.#v4[name] = (this as any)[name].bind(this);
|
||||
(this as any)[name] =
|
||||
(...args: Array<unknown>): void => (this as any).sendCommand(name, ...args);
|
||||
}
|
||||
|
||||
|
@@ -78,11 +78,15 @@ export default class RedisClientMultiCommand {
|
||||
for (const name of Object.keys(COMMANDS)) {
|
||||
this.#defineLegacyCommand(name);
|
||||
}
|
||||
|
||||
for (const name of Object.keys(COMMANDS)) {
|
||||
(this as any)[name.toLowerCase()] = (this as any)[name];
|
||||
}
|
||||
}
|
||||
|
||||
#defineLegacyCommand(name: string): void {
|
||||
(this as any).v4[name] = (this as any)[name].bind(this.v4);
|
||||
(this as any)[name] = (this as any)[name.toLowerCase()] =
|
||||
this.v4[name] = (this as any)[name].bind(this.v4);
|
||||
(this as any)[name] =
|
||||
(...args: Array<unknown>): void => (this as any).addCommand(name, args);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user