1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +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,5 +1,6 @@
import { CommandParser } from '../client/parser';
import { RedisArgument, BlobStringReply, Command } from '../RESP/types';
import { StreamDeletionPolicy } from './common-stream.types';
import { Tail } from './generic-transformers';
/**
@@ -10,6 +11,7 @@ import { Tail } from './generic-transformers';
* @property TRIM.strategyModifier - Exact ('=') or approximate ('~') trimming
* @property TRIM.threshold - Maximum stream length or minimum ID to retain
* @property TRIM.limit - Maximum number of entries to trim in one call
* @property TRIM.policy - Policy to apply when trimming entries (optional, defaults to KEEPREF)
*/
export interface XAddOptions {
TRIM?: {
@@ -17,6 +19,8 @@ export interface XAddOptions {
strategyModifier?: '=' | '~';
threshold: number;
limit?: number;
/** added in 8.2 */
policy?: StreamDeletionPolicy;
};
}
@@ -58,6 +62,10 @@ export function parseXAddArguments(
if (options.TRIM.limit) {
parser.push('LIMIT', options.TRIM.limit.toString());
}
if (options.TRIM.policy) {
parser.push(options.TRIM.policy);
}
}
parser.push(id);