You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
(docs) add jsdoc comments to command parsers (#2984)
* (docs) bloom: add jsdocs for all commands * (docs) json: add jsdocs * (docs) search: add jsdocs for all commands * (docs) jsdocs for std commands * (docs) jsdoc comments to time series commands
This commit is contained in:
@@ -2,10 +2,22 @@ import { CommandParser } from '../client/parser';
|
||||
import { RedisArgument, TuplesReply, BlobStringReply, ArrayReply, NullReply, UnwrapReply, Command, TypeMapping } from '../RESP/types';
|
||||
import { StreamMessageRawReply, transformStreamMessageNullReply } from './generic-transformers';
|
||||
|
||||
/**
|
||||
* Options for the XAUTOCLAIM command
|
||||
*
|
||||
* @property COUNT - Limit the number of messages to claim
|
||||
*/
|
||||
export interface XAutoClaimOptions {
|
||||
COUNT?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Raw reply structure for XAUTOCLAIM command
|
||||
*
|
||||
* @property nextId - The ID to use for the next XAUTOCLAIM call
|
||||
* @property messages - Array of claimed messages or null entries
|
||||
* @property deletedMessages - Array of message IDs that no longer exist
|
||||
*/
|
||||
export type XAutoClaimRawReply = TuplesReply<[
|
||||
nextId: BlobStringReply,
|
||||
messages: ArrayReply<StreamMessageRawReply | NullReply>,
|
||||
@@ -14,6 +26,19 @@ export type XAutoClaimRawReply = TuplesReply<[
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
/**
|
||||
* Constructs the XAUTOCLAIM command to automatically claim pending messages in a consumer group
|
||||
*
|
||||
* @param parser - The command parser
|
||||
* @param key - The stream key
|
||||
* @param group - The consumer group name
|
||||
* @param consumer - The consumer name that will claim the messages
|
||||
* @param minIdleTime - Minimum idle time in milliseconds for a message to be claimed
|
||||
* @param start - Message ID to start scanning from
|
||||
* @param options - Additional options for the claim operation
|
||||
* @returns Object containing nextId, claimed messages, and list of deleted message IDs
|
||||
* @see https://redis.io/commands/xautoclaim/
|
||||
*/
|
||||
parseCommand(
|
||||
parser: CommandParser,
|
||||
key: RedisArgument,
|
||||
@@ -31,6 +56,14 @@ export default {
|
||||
parser.push('COUNT', options.COUNT.toString());
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Transforms the raw XAUTOCLAIM reply into a structured object
|
||||
*
|
||||
* @param reply - Raw reply from Redis
|
||||
* @param preserve - Preserve options (unused)
|
||||
* @param typeMapping - Type mapping for message fields
|
||||
* @returns Structured object containing nextId, messages, and deletedMessages
|
||||
*/
|
||||
transformReply(reply: UnwrapReply<XAutoClaimRawReply>, preserve?: any, typeMapping?: TypeMapping) {
|
||||
return {
|
||||
nextId: reply[0],
|
||||
|
Reference in New Issue
Block a user