From c57da8b78bca5f6d3bb76d2c7baf5aafc5bbde4d Mon Sep 17 00:00:00 2001 From: Leibale Eidelman Date: Tue, 8 Mar 2022 17:26:13 -0500 Subject: [PATCH] add missing FIRST_KEY_INDEX (#2028) --- packages/client/lib/commands/DEL.ts | 2 ++ packages/client/lib/commands/DUMP.ts | 2 ++ packages/client/lib/commands/GEOADD.ts | 4 ++-- packages/client/lib/commands/HSET.ts | 4 ++-- packages/client/lib/commands/LINDEX.ts | 2 ++ packages/client/lib/commands/LMOVE.ts | 4 ++-- packages/client/lib/commands/MOVE.ts | 2 ++ packages/client/lib/commands/SORT.ts | 3 +-- packages/client/lib/commands/WATCH.ts | 2 ++ 9 files changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/client/lib/commands/DEL.ts b/packages/client/lib/commands/DEL.ts index 7597cf09cb..d60abe0f28 100644 --- a/packages/client/lib/commands/DEL.ts +++ b/packages/client/lib/commands/DEL.ts @@ -1,6 +1,8 @@ import { RedisCommandArgument, RedisCommandArguments } from '.'; import { pushVerdictArguments } from './generic-transformers'; +export const FIRST_KEY_INDEX = 1; + export function transformArguments( keys: RedisCommandArgument | Array ): RedisCommandArguments { diff --git a/packages/client/lib/commands/DUMP.ts b/packages/client/lib/commands/DUMP.ts index 79805795ed..fd4354db45 100644 --- a/packages/client/lib/commands/DUMP.ts +++ b/packages/client/lib/commands/DUMP.ts @@ -1,5 +1,7 @@ import { RedisCommandArgument, RedisCommandArguments } from '.'; +export const FIRST_KEY_INDEX = 1; + export function transformArguments(key: RedisCommandArgument): RedisCommandArguments { return ['DUMP', key]; } diff --git a/packages/client/lib/commands/GEOADD.ts b/packages/client/lib/commands/GEOADD.ts index 74adeda514..daccb0842e 100644 --- a/packages/client/lib/commands/GEOADD.ts +++ b/packages/client/lib/commands/GEOADD.ts @@ -1,6 +1,8 @@ import { RedisCommandArgument, RedisCommandArguments } from '.'; import { GeoCoordinates } from './generic-transformers'; +export const FIRST_KEY_INDEX = 1; + interface GeoMember extends GeoCoordinates { member: RedisCommandArgument; } @@ -21,8 +23,6 @@ interface GeoAddCommonOptions { type GeoAddOptions = SetGuards & GeoAddCommonOptions; -export const FIRST_KEY_INDEX = 1; - export function transformArguments( key: RedisCommandArgument, toAdd: GeoMember | Array, options?: GeoAddOptions diff --git a/packages/client/lib/commands/HSET.ts b/packages/client/lib/commands/HSET.ts index 81bde83d22..1fe1743b6a 100644 --- a/packages/client/lib/commands/HSET.ts +++ b/packages/client/lib/commands/HSET.ts @@ -1,5 +1,7 @@ import { RedisCommandArgument, RedisCommandArguments } from '.'; +export const FIRST_KEY_INDEX = 1; + type Types = RedisCommandArgument | number; type HSETObject = Record; @@ -8,8 +10,6 @@ type HSETMap = Map; type HSETTuples = Array<[Types, Types]> | Array; -export const FIRST_KEY_INDEX = 1; - type GenericArguments = [key: RedisCommandArgument]; type SingleFieldArguments = [...generic: GenericArguments, field: Types, value: Types]; diff --git a/packages/client/lib/commands/LINDEX.ts b/packages/client/lib/commands/LINDEX.ts index bb657de3cb..8e74ad8aae 100644 --- a/packages/client/lib/commands/LINDEX.ts +++ b/packages/client/lib/commands/LINDEX.ts @@ -1,5 +1,7 @@ import { RedisCommandArgument, RedisCommandArguments } from '.'; +export const FIRST_KEY_INDEX = 1; + export const IS_READ_ONLY = true; export function transformArguments( diff --git a/packages/client/lib/commands/LMOVE.ts b/packages/client/lib/commands/LMOVE.ts index 96946722ef..7332d1a007 100644 --- a/packages/client/lib/commands/LMOVE.ts +++ b/packages/client/lib/commands/LMOVE.ts @@ -1,9 +1,9 @@ import { RedisCommandArgument, RedisCommandArguments } from '.'; -export type LMoveSide = 'LEFT' | 'RIGHT'; - export const FIRST_KEY_INDEX = 1; +export type LMoveSide = 'LEFT' | 'RIGHT'; + export function transformArguments( source: RedisCommandArgument, destination: RedisCommandArgument, diff --git a/packages/client/lib/commands/MOVE.ts b/packages/client/lib/commands/MOVE.ts index f446fd18dc..17cc6742c5 100644 --- a/packages/client/lib/commands/MOVE.ts +++ b/packages/client/lib/commands/MOVE.ts @@ -1,3 +1,5 @@ +export const FIRST_KEY_INDEX = 1; + export function transformArguments(key: string, db: number): Array { return ['MOVE', key, db.toString()]; } diff --git a/packages/client/lib/commands/SORT.ts b/packages/client/lib/commands/SORT.ts index 0305d93144..dfa38dc756 100644 --- a/packages/client/lib/commands/SORT.ts +++ b/packages/client/lib/commands/SORT.ts @@ -2,7 +2,6 @@ export const FIRST_KEY_INDEX = 1; export const IS_READ_ONLY = true; - interface SortOptions { BY?: string; LIMIT?: { @@ -25,7 +24,7 @@ export function transformArguments(key: string, options?: SortOptions): Array): RedisCommandArguments { return pushVerdictArguments(['WATCH'], key); }