You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix: loop over arguments instead of spreading (#2160)
* fix: loop over arguments instead of spreading * update to use concat * use the returned array from pushVerdictArguments (instead of assuming it'll push to the original array) * fix "Type 'RedisCommandArguments' is not assignable to type 'string[]'." * fix "Argument of type 'RedisCommandArgument | RedisCommandArguments[]' is not assignable to parameter of type 'RedisCommandArgument | RedisCommandArgument[]'" * fix "Type 'RedisCommandArguments' is not assignable to type 'string[]'" Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
pushFilterArgument
|
||||
} from '.';
|
||||
import { MGetRawReply, MGetReply } from './MGET';
|
||||
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
@@ -18,14 +19,9 @@ interface MGetWithLabelsOptions {
|
||||
export function transformArguments(
|
||||
filter: Filter,
|
||||
options?: MGetWithLabelsOptions
|
||||
): Array<string> {
|
||||
const args = ['TS.MGET'];
|
||||
|
||||
pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
||||
|
||||
pushFilterArgument(args, filter);
|
||||
|
||||
return args;
|
||||
): RedisCommandArguments {
|
||||
const args = pushWithLabelsArgument(['TS.MGET'], options?.SELECTED_LABELS);
|
||||
return pushFilterArgument(args, filter);
|
||||
}
|
||||
|
||||
export interface MGetWithLabelsReply extends MGetReply {
|
||||
|
@@ -313,8 +313,7 @@ export type Filter = string | Array<string>;
|
||||
|
||||
export function pushFilterArgument(args: RedisCommandArguments, filter: string | Array<string>): RedisCommandArguments {
|
||||
args.push('FILTER');
|
||||
pushVerdictArguments(args, filter);
|
||||
return args;
|
||||
return pushVerdictArguments(args, filter);
|
||||
}
|
||||
|
||||
export interface MRangeOptions extends RangeOptions {
|
||||
@@ -328,10 +327,9 @@ export function pushMRangeArguments(
|
||||
filter: Filter,
|
||||
options?: MRangeOptions
|
||||
): RedisCommandArguments {
|
||||
pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
pushFilterArgument(args, filter);
|
||||
pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
return args;
|
||||
args = pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
args = pushFilterArgument(args, filter);
|
||||
return pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
}
|
||||
|
||||
export type SelectedLabels = string | Array<string>;
|
||||
@@ -341,7 +339,7 @@ export function pushWithLabelsArgument(args: RedisCommandArguments, selectedLabe
|
||||
args.push('WITHLABELS');
|
||||
} else {
|
||||
args.push('SELECTED_LABELS');
|
||||
pushVerdictArguments(args, selectedLabels);
|
||||
args = pushVerdictArguments(args, selectedLabels);
|
||||
}
|
||||
|
||||
return args;
|
||||
@@ -358,11 +356,10 @@ export function pushMRangeWithLabelsArguments(
|
||||
filter: Filter,
|
||||
options?: MRangeWithLabelsOptions
|
||||
): RedisCommandArguments {
|
||||
pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
||||
pushFilterArgument(args, filter);
|
||||
pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
return args;
|
||||
args = pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
||||
args = pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
||||
args = pushFilterArgument(args, filter);
|
||||
return pushMRangeGroupByArguments(args, options?.GROUPBY);
|
||||
}
|
||||
|
||||
export function transformRangeReply(reply: Array<SampleRawReply>): Array<SampleReply> {
|
||||
|
Reference in New Issue
Block a user