index.d.ts 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. import * as ADD from './ADD';
  2. import * as ALTER from './ALTER';
  3. import * as CREATE from './CREATE';
  4. import * as CREATERULE from './CREATERULE';
  5. import * as DECRBY from './DECRBY';
  6. import * as DEL from './DEL';
  7. import * as DELETERULE from './DELETERULE';
  8. import * as GET from './GET';
  9. import * as INCRBY from './INCRBY';
  10. import * as INFO_DEBUG from './INFO_DEBUG';
  11. import * as INFO from './INFO';
  12. import * as MADD from './MADD';
  13. import * as MGET from './MGET';
  14. import * as MGET_WITHLABELS from './MGET_WITHLABELS';
  15. import * as QUERYINDEX from './QUERYINDEX';
  16. import * as RANGE from './RANGE';
  17. import * as REVRANGE from './REVRANGE';
  18. import * as MRANGE from './MRANGE';
  19. import * as MRANGE_WITHLABELS from './MRANGE_WITHLABELS';
  20. import * as MREVRANGE from './MREVRANGE';
  21. import * as MREVRANGE_WITHLABELS from './MREVRANGE_WITHLABELS';
  22. import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
  23. declare const _default: {
  24. ADD: typeof ADD;
  25. add: typeof ADD;
  26. ALTER: typeof ALTER;
  27. alter: typeof ALTER;
  28. CREATE: typeof CREATE;
  29. create: typeof CREATE;
  30. CREATERULE: typeof CREATERULE;
  31. createRule: typeof CREATERULE;
  32. DECRBY: typeof DECRBY;
  33. decrBy: typeof DECRBY;
  34. DEL: typeof DEL;
  35. del: typeof DEL;
  36. DELETERULE: typeof DELETERULE;
  37. deleteRule: typeof DELETERULE;
  38. GET: typeof GET;
  39. get: typeof GET;
  40. INCRBY: typeof INCRBY;
  41. incrBy: typeof INCRBY;
  42. INFO_DEBUG: typeof INFO_DEBUG;
  43. infoDebug: typeof INFO_DEBUG;
  44. INFO: typeof INFO;
  45. info: typeof INFO;
  46. MADD: typeof MADD;
  47. mAdd: typeof MADD;
  48. MGET: typeof MGET;
  49. mGet: typeof MGET;
  50. MGET_WITHLABELS: typeof MGET_WITHLABELS;
  51. mGetWithLabels: typeof MGET_WITHLABELS;
  52. QUERYINDEX: typeof QUERYINDEX;
  53. queryIndex: typeof QUERYINDEX;
  54. RANGE: typeof RANGE;
  55. range: typeof RANGE;
  56. REVRANGE: typeof REVRANGE;
  57. revRange: typeof REVRANGE;
  58. MRANGE: typeof MRANGE;
  59. mRange: typeof MRANGE;
  60. MRANGE_WITHLABELS: typeof MRANGE_WITHLABELS;
  61. mRangeWithLabels: typeof MRANGE_WITHLABELS;
  62. MREVRANGE: typeof MREVRANGE;
  63. mRevRange: typeof MREVRANGE;
  64. MREVRANGE_WITHLABELS: typeof MREVRANGE_WITHLABELS;
  65. mRevRangeWithLabels: typeof MREVRANGE_WITHLABELS;
  66. };
  67. export default _default;
  68. export declare enum TimeSeriesAggregationType {
  69. AVG = "AVG",
  70. AVERAGE = "AVG",
  71. FIRST = "FIRST",
  72. LAST = "LAST",
  73. MIN = "MIN",
  74. MINIMUM = "MIN",
  75. MAX = "MAX",
  76. MAXIMUM = "MAX",
  77. SUM = "SUM",
  78. RANGE = "RANGE",
  79. COUNT = "COUNT",
  80. STD_P = "STD.P",
  81. STD_S = "STD.S",
  82. VAR_P = "VAR.P",
  83. VAR_S = "VAR.S",
  84. TWA = "TWA"
  85. }
  86. export declare enum TimeSeriesDuplicatePolicies {
  87. BLOCK = "BLOCK",
  88. FIRST = "FIRST",
  89. LAST = "LAST",
  90. MIN = "MIN",
  91. MAX = "MAX",
  92. SUM = "SUM"
  93. }
  94. export declare enum TimeSeriesReducers {
  95. AVG = "AVG",
  96. SUM = "SUM",
  97. MIN = "MIN",
  98. MINIMUM = "MIN",
  99. MAX = "MAX",
  100. MAXIMUM = "MAX",
  101. RANGE = "range",
  102. COUNT = "COUNT",
  103. STD_P = "STD.P",
  104. STD_S = "STD.S",
  105. VAR_P = "VAR.P",
  106. VAR_S = "VAR.S"
  107. }
  108. export type Timestamp = number | Date | string;
  109. export declare function transformTimestampArgument(timestamp: Timestamp): string;
  110. export declare function pushRetentionArgument(args: RedisCommandArguments, retention?: number): RedisCommandArguments;
  111. export declare enum TimeSeriesEncoding {
  112. COMPRESSED = "COMPRESSED",
  113. UNCOMPRESSED = "UNCOMPRESSED"
  114. }
  115. export declare function pushEncodingArgument(args: RedisCommandArguments, encoding?: TimeSeriesEncoding): RedisCommandArguments;
  116. export declare function pushChunkSizeArgument(args: RedisCommandArguments, chunkSize?: number): RedisCommandArguments;
  117. export declare function pushDuplicatePolicy(args: RedisCommandArguments, duplicatePolicy?: TimeSeriesDuplicatePolicies): RedisCommandArguments;
  118. export type RawLabels = Array<[label: string, value: string]>;
  119. export type Labels = {
  120. [label: string]: string;
  121. };
  122. export declare function transformLablesReply(reply: RawLabels): Labels;
  123. export declare function pushLabelsArgument(args: RedisCommandArguments, labels?: Labels): RedisCommandArguments;
  124. export interface IncrDecrOptions {
  125. TIMESTAMP?: Timestamp;
  126. RETENTION?: number;
  127. UNCOMPRESSED?: boolean;
  128. CHUNK_SIZE?: number;
  129. LABELS?: Labels;
  130. }
  131. export declare function transformIncrDecrArguments(command: 'TS.INCRBY' | 'TS.DECRBY', key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments;
  132. export type SampleRawReply = [timestamp: number, value: string];
  133. export interface SampleReply {
  134. timestamp: number;
  135. value: number;
  136. }
  137. export declare function transformSampleReply(reply: SampleRawReply): SampleReply;
  138. export declare enum TimeSeriesBucketTimestamp {
  139. LOW = "-",
  140. HIGH = "+",
  141. MID = "~"
  142. }
  143. export interface RangeOptions {
  144. LATEST?: boolean;
  145. FILTER_BY_TS?: Array<Timestamp>;
  146. FILTER_BY_VALUE?: {
  147. min: number;
  148. max: number;
  149. };
  150. COUNT?: number;
  151. ALIGN?: Timestamp;
  152. AGGREGATION?: {
  153. type: TimeSeriesAggregationType;
  154. timeBucket: Timestamp;
  155. BUCKETTIMESTAMP?: TimeSeriesBucketTimestamp;
  156. EMPTY?: boolean;
  157. };
  158. }
  159. export declare function pushRangeArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, options?: RangeOptions): RedisCommandArguments;
  160. interface MRangeGroupBy {
  161. label: string;
  162. reducer: TimeSeriesReducers;
  163. }
  164. export declare function pushMRangeGroupByArguments(args: RedisCommandArguments, groupBy?: MRangeGroupBy): RedisCommandArguments;
  165. export type Filter = string | Array<string>;
  166. export declare function pushFilterArgument(args: RedisCommandArguments, filter: string | Array<string>): RedisCommandArguments;
  167. export interface MRangeOptions extends RangeOptions {
  168. GROUPBY?: MRangeGroupBy;
  169. }
  170. export declare function pushMRangeArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: Filter, options?: MRangeOptions): RedisCommandArguments;
  171. export type SelectedLabels = string | Array<string>;
  172. export declare function pushWithLabelsArgument(args: RedisCommandArguments, selectedLabels?: SelectedLabels): RedisCommandArguments;
  173. export interface MRangeWithLabelsOptions extends MRangeOptions {
  174. SELECTED_LABELS?: SelectedLabels;
  175. }
  176. export declare function pushMRangeWithLabelsArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: Filter, options?: MRangeWithLabelsOptions): RedisCommandArguments;
  177. export declare function transformRangeReply(reply: Array<SampleRawReply>): Array<SampleReply>;
  178. type MRangeRawReply = Array<[
  179. key: string,
  180. labels: RawLabels,
  181. samples: Array<SampleRawReply>
  182. ]>;
  183. interface MRangeReplyItem {
  184. key: string;
  185. samples: Array<SampleReply>;
  186. }
  187. export declare function transformMRangeReply(reply: MRangeRawReply): Array<MRangeReplyItem>;
  188. export interface MRangeWithLabelsReplyItem extends MRangeReplyItem {
  189. labels: Labels;
  190. }
  191. export declare function transformMRangeWithLabelsReply(reply: MRangeRawReply): Array<MRangeWithLabelsReplyItem>;
  192. export declare function pushLatestArgument(args: RedisCommandArguments, latest?: boolean): RedisCommandArguments;