You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-10 11:43:01 +03:00
RESP3 Support - Some commands responses in RESP3 aren't stable yet and therefore return an "untyped" ReplyUnion. Sentinel TypeMapping Correctly types Multi commands Note: some API changes to be further documented in v4-to-v5.md
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { RedisArgument, Command, NumberReply, TuplesToMapReply, UnwrapReply, Resp2Reply, SimpleStringReply, TypeMapping } from '@redis/client/dist/lib/RESP/types';
|
|
import { transformInfoV2Reply } from '../bloom';
|
|
|
|
export type CfInfoReplyMap = TuplesToMapReply<[
|
|
[SimpleStringReply<'Size'>, NumberReply],
|
|
[SimpleStringReply<'Number of buckets'>, NumberReply],
|
|
[SimpleStringReply<'Number of filters'>, NumberReply],
|
|
[SimpleStringReply<'Number of items inserted'>, NumberReply],
|
|
[SimpleStringReply<'Number of items deleted'>, NumberReply],
|
|
[SimpleStringReply<'Bucket size'>, NumberReply],
|
|
[SimpleStringReply<'Expansion rate'>, NumberReply],
|
|
[SimpleStringReply<'Max iterations'>, NumberReply]
|
|
]>;
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: 1,
|
|
IS_READ_ONLY: true,
|
|
transformArguments(key: RedisArgument) {
|
|
return ['CF.INFO', key];
|
|
},
|
|
transformReply: {
|
|
2: (reply: UnwrapReply<Resp2Reply<CfInfoReplyMap>>, _, typeMapping?: TypeMapping): CfInfoReplyMap => {
|
|
return transformInfoV2Reply<CfInfoReplyMap>(reply, typeMapping);
|
|
},
|
|
3: undefined as unknown as () => CfInfoReplyMap
|
|
}
|
|
} as const satisfies Command;
|