NodeRedis/node-redis

View on GitHub
packages/client/lib/commands/CLIENT_TRACKINGINFO.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { CommandParser } from '../client/parser';
import { TuplesToMapReply, BlobStringReply, SetReply, NumberReply, ArrayReply, UnwrapReply, Resp2Reply, Command } from '../RESP/types';

type TrackingInfo = TuplesToMapReply<[
  [BlobStringReply<'flags'>, SetReply<BlobStringReply>],
  [BlobStringReply<'redirect'>, NumberReply],
  [BlobStringReply<'prefixes'>, ArrayReply<BlobStringReply>]
]>;

export default {
  NOT_KEYED_COMMAND: true,
  IS_READ_ONLY: true,
  parseCommand(parser: CommandParser) {
    parser.push('CLIENT', 'TRACKINGINFO');
  },
  transformReply: {
    2: (reply: UnwrapReply<Resp2Reply<TrackingInfo>>) => ({
      flags: reply[1],
      redirect: reply[3],
      prefixes: reply[5]
    }),
    3: undefined as unknown as () => TrackingInfo
  }
} as const satisfies Command;