danitseitlin / redis-modules-sdk-ts

A Software development kit for easier connection and execution of Redis Modules commands.
Apache License 2.0
185 stars 29 forks source link

Fix range+revrange return types in Timeseries #202

Closed HartS closed 2 years ago

HartS commented 2 years ago

The return types for range and revrange are wrong, they should be [number, string][] instead of number[].

At a glance it looks like several other types are wrong here also, but I haven't looked into it too much.

The existing test suite still passes with these changes

danitseitlin commented 2 years ago

@HartS Hi! thank you for the review :) Can you share an example of the output of the command?

HartS commented 2 years ago

@danitseitlin the output of which command exactly?

danitseitlin commented 2 years ago

@danitseitlin the output of which command exactly?

Revrange and Range to verify that the output will indeed contain an 2 dimensional array of a number in index 0 and string in index 1.

HartS commented 2 years ago

@danitseitlin :

> ts = new rms.RedisTimeSeries(...)
RedisTimeSeries {
  name: 'RedisTimeSeries',
  redisOptions: { ... },
  isHandleError: true,
  showDebugLogs: false,
  returnRawResponse: false,
  clusterOptions: undefined,
  rtsCommander: RedisTimeSeriesCommander {}
}
> ts.connect()
Promise { undefined }
> ts.range('ts:binance.BUSD/USDT.asks_LAST_60000', '-', '+').then((x)=>console.log(x))
Promise { <pending> }
> [
  [ 1648209960000, '9.995E-1' ],
  [ 1648212120000, '9.995E-1' ],
  [ 1648212420000, '9.995E-1' ],
  [ 1648216080000, '9.995E-1' ],
  [ 1648216920000, '9.995E-1' ],
  [ 1648216980000, '9.995E-1' ],
  [ 1648217040000, '9.995E-1' ],
  [ 1648227540000, '9.997E-1' ],
  [ 1648230660000, '9.997E-1' ],
  [ 1648230720000, '9.997E-1' ],
  [ 1648231680000, '9.997E-1' ],
  [ 1648231740000, '9.997E-1' ],
  [ 1648232100000, '9.997E-1' ],
  [ 1648242660000, '9.997E-1' ]
]