Commander.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import Command from "../Command";
  2. import { WriteableStream } from "../types";
  3. import RedisCommander, { ClientContext } from "./RedisCommander";
  4. export interface CommanderOptions {
  5. keyPrefix?: string;
  6. showFriendlyErrorStack?: boolean;
  7. }
  8. declare class Commander<Context extends ClientContext = {
  9. type: "default";
  10. }> {
  11. options: CommanderOptions;
  12. /**
  13. * @ignore
  14. */
  15. scriptsSet: {};
  16. /**
  17. * @ignore
  18. */
  19. addedBuiltinSet: Set<string>;
  20. /**
  21. * Return supported builtin commands
  22. */
  23. getBuiltinCommands(): string[];
  24. /**
  25. * Create a builtin command
  26. */
  27. createBuiltinCommand(commandName: string): {
  28. string: any;
  29. buffer: any;
  30. };
  31. /**
  32. * Create add builtin command
  33. */
  34. addBuiltinCommand(commandName: string): void;
  35. /**
  36. * Define a custom command using lua script
  37. */
  38. defineCommand(name: string, definition: {
  39. lua: string;
  40. numberOfKeys?: number;
  41. readOnly?: boolean;
  42. }): void;
  43. /**
  44. * @ignore
  45. */
  46. sendCommand(command: Command, stream?: WriteableStream, node?: unknown): unknown;
  47. }
  48. interface Commander<Context> extends RedisCommander<Context> {
  49. }
  50. export default Commander;