1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Add Redis 8.2 New Stream Commands (#3029)

* chore: update Redis version from 8.2-RC1-pre to 8.2-rc1

* feat: implement XDELEX command for Redis 8.2

* feat: implement XACKDEL command for Redis 8.2

* refactor: create shared stream deletion types
  for Redis 8.2 commands

* feat: add Redis 8.2 deletion policies to XTRIM
  command

* feat: add Redis 8.2 deletion policies to XADD commands

* fix: correct XDELEX command method name and test parameter
This commit is contained in:
Pavel Pashov
2025-07-25 17:58:28 +03:00
committed by GitHub
parent ff8319d2d7
commit d941ec5a4c
19 changed files with 746 additions and 22 deletions

View File

@@ -1,16 +1,20 @@
import { CommandParser } from '../client/parser';
import { NumberReply, Command, RedisArgument } from '../RESP/types';
import { StreamDeletionPolicy } from './common-stream.types';
/**
* Options for the XTRIM command
*
* @property strategyModifier - Exact ('=') or approximate ('~') trimming
* @property LIMIT - Maximum number of entries to trim in one call (Redis 6.2+)
* @property policy - Policy to apply when deleting entries (optional, defaults to KEEPREF)
*/
export interface XTrimOptions {
strategyModifier?: '=' | '~';
/** added in 6.2 */
LIMIT?: number;
/** added in 8.2 */
policy?: StreamDeletionPolicy;
}
/**
@@ -49,6 +53,10 @@ export default {
if (options?.LIMIT) {
parser.push('LIMIT', options.LIMIT.toString());
}
if (options?.policy) {
parser.push(options.policy);
}
},
transformReply: undefined as unknown as () => NumberReply
} as const satisfies Command;