commander.d.ts 1.7 KB

123456789101112131415161718192021222324252627282930
  1. import { ClientCommandOptions } from './client';
  2. import { CommandOptions } from './command-options';
  3. import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandReply, RedisFunction, RedisFunctions, RedisModules, RedisScript, RedisScripts } from './commands';
  4. type Instantiable<T = any> = new (...args: Array<any>) => T;
  5. type CommandsExecutor<C extends RedisCommand = RedisCommand> = (command: C, args: Array<unknown>, name: string) => unknown;
  6. interface AttachCommandsConfig<C extends RedisCommand> {
  7. BaseClass: Instantiable;
  8. commands: Record<string, C>;
  9. executor: CommandsExecutor<C>;
  10. }
  11. export declare function attachCommands<C extends RedisCommand>({ BaseClass, commands, executor }: AttachCommandsConfig<C>): void;
  12. interface AttachExtensionsConfig<T extends Instantiable = Instantiable> {
  13. BaseClass: T;
  14. modulesExecutor: CommandsExecutor;
  15. modules?: RedisModules;
  16. functionsExecutor: CommandsExecutor<RedisFunction>;
  17. functions?: RedisFunctions;
  18. scriptsExecutor: CommandsExecutor<RedisScript>;
  19. scripts?: RedisScripts;
  20. }
  21. export declare function attachExtensions(config: AttachExtensionsConfig): any;
  22. export declare function transformCommandArguments<T = ClientCommandOptions>(command: RedisCommand, args: Array<unknown>): {
  23. jsArgs: Array<unknown>;
  24. args: RedisCommandArguments;
  25. options: CommandOptions<T> | undefined;
  26. };
  27. export declare function transformLegacyCommandArguments(args: Array<any>): Array<any>;
  28. export declare function transformCommandReply<C extends RedisCommand>(command: C, rawReply: unknown, preserved: unknown): RedisCommandReply<C>;
  29. export declare function fCallArguments(name: RedisCommandArgument, fn: RedisFunction, args: RedisCommandArguments): RedisCommandArguments;
  30. export {};