diff --git a/packages/client/lib/cluster/commands.ts b/packages/client/lib/cluster/commands.ts index a8527cf235f..48ca4b29872 100644 --- a/packages/client/lib/cluster/commands.ts +++ b/packages/client/lib/cluster/commands.ts @@ -155,6 +155,7 @@ import * as XRANGE from '../commands/XRANGE'; import * as XREAD from '../commands/XREAD'; import * as XREADGROUP from '../commands/XREADGROUP'; import * as XREVRANGE from '../commands/XREVRANGE'; +import * as XSETID from '../commands/XSETID'; import * as XTRIM from '../commands/XTRIM'; import * as ZADD from '../commands/ZADD'; import * as ZCARD from '../commands/ZCARD'; @@ -508,6 +509,8 @@ export default { xReadGroup: XREADGROUP, XREVRANGE, xRevRange: XREVRANGE, + XSETID, + xSetId: XSETID, XTRIM, xTrim: XTRIM, ZADD, diff --git a/packages/client/lib/commands/XSETID.spec.ts b/packages/client/lib/commands/XSETID.spec.ts new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/client/lib/commands/XSETID.ts b/packages/client/lib/commands/XSETID.ts new file mode 100644 index 00000000000..76acc7ebab4 --- /dev/null +++ b/packages/client/lib/commands/XSETID.ts @@ -0,0 +1,28 @@ +import { RedisCommandArgument, RedisCommandArguments } from '.'; + +export const FIRST_KEY_INDEX = 1; + +interface XSetIdOptions { + ENTRIESADDED?: number; + MAXDELETEDID?: RedisCommandArgument; +} + +export function transformArguments( + key: RedisCommandArgument, + lastId: RedisCommandArgument, + options?: XSetIdOptions +): RedisCommandArguments { + const args = ['XSETID', key, lastId]; + + if (options?.ENTRIESADDED) { + args.push('ENTRIESADDED', options.ENTRIESADDED.toString()); + } + + if (options?.MAXDELETEDID) { + args.push('MAXDELETEDID', options.MAXDELETEDID); + } + + return args; +} + +export declare function transformReply(): 'OK';