@redis/time-series 1.0.5 → 2.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/lib/commands/ADD.d.ts +16 -0
  2. package/dist/lib/commands/ADD.js +22 -0
  3. package/dist/lib/commands/ALTER.d.ts +10 -0
  4. package/dist/lib/commands/ALTER.js +14 -0
  5. package/dist/lib/commands/CREATE.d.ts +16 -0
  6. package/dist/lib/commands/CREATE.js +15 -0
  7. package/dist/lib/commands/CREATERULE.d.ts +25 -0
  8. package/dist/lib/commands/CREATERULE.js +34 -0
  9. package/dist/lib/commands/DECRBY.d.ts +7 -0
  10. package/dist/lib/commands/DECRBY.js +7 -0
  11. package/dist/lib/commands/DEL.d.ts +9 -0
  12. package/dist/lib/commands/DEL.js +14 -0
  13. package/dist/lib/commands/DELETERULE.d.ts +8 -0
  14. package/dist/lib/commands/DELETERULE.js +12 -0
  15. package/dist/lib/commands/GET.d.ts +21 -0
  16. package/dist/lib/commands/GET.js +25 -0
  17. package/dist/lib/commands/INCRBY.d.ts +17 -0
  18. package/dist/lib/commands/INCRBY.js +24 -0
  19. package/dist/lib/commands/INFO.d.ts +0 -0
  20. package/dist/lib/commands/INFO.js +77 -0
  21. package/dist/lib/commands/INFO_DEBUG.d.ts +0 -0
  22. package/dist/lib/commands/INFO_DEBUG.js +53 -0
  23. package/dist/lib/commands/MADD.d.ts +14 -0
  24. package/dist/lib/commands/MADD.js +13 -0
  25. package/dist/lib/commands/MGET.d.ts +14 -0
  26. package/dist/lib/commands/MGET.js +22 -0
  27. package/dist/lib/commands/MGET_WITHLABELS.d.ts +12 -0
  28. package/dist/lib/commands/MGET_WITHLABELS.js +13 -0
  29. package/dist/lib/commands/MRANGE.d.ts +32 -0
  30. package/dist/lib/commands/MRANGE.js +32 -0
  31. package/dist/lib/commands/MRANGE_WITHLABELS.d.ts +15 -0
  32. package/dist/lib/commands/MRANGE_WITHLABELS.js +17 -0
  33. package/dist/lib/commands/MREVRANGE.d.ts +7 -0
  34. package/dist/lib/commands/MREVRANGE.js +7 -0
  35. package/dist/lib/commands/MREVRANGE_WITHLABELS.d.ts +7 -0
  36. package/dist/lib/commands/MREVRANGE_WITHLABELS.js +7 -0
  37. package/dist/lib/commands/QUERYINDEX.d.ts +12 -0
  38. package/dist/lib/commands/QUERYINDEX.js +12 -0
  39. package/dist/lib/commands/RANGE.d.ts +44 -0
  40. package/dist/lib/commands/RANGE.js +53 -0
  41. package/dist/lib/commands/REVRANGE.d.ts +16 -0
  42. package/dist/lib/commands/REVRANGE.js +7 -0
  43. package/dist/lib/commands/index.d.ts +333 -0
  44. package/dist/lib/commands/index.js +140 -0
  45. package/dist/lib/index.d.ts +3 -0
  46. package/dist/lib/index.js +3 -0
  47. package/package.json +8 -17
  48. package/dist/commands/ADD.d.ts +0 -12
  49. package/dist/commands/ADD.js +0 -22
  50. package/dist/commands/ALTER.d.ts +0 -11
  51. package/dist/commands/ALTER.js +0 -14
  52. package/dist/commands/CREATE.d.ts +0 -12
  53. package/dist/commands/CREATE.js +0 -15
  54. package/dist/commands/CREATERULE.d.ts +0 -4
  55. package/dist/commands/CREATERULE.js +0 -19
  56. package/dist/commands/DECRBY.d.ts +0 -5
  57. package/dist/commands/DECRBY.js +0 -9
  58. package/dist/commands/DEL.d.ts +0 -5
  59. package/dist/commands/DEL.js +0 -14
  60. package/dist/commands/DELETERULE.d.ts +0 -3
  61. package/dist/commands/DELETERULE.js +0 -12
  62. package/dist/commands/GET.d.ts +0 -10
  63. package/dist/commands/GET.js +0 -16
  64. package/dist/commands/INCRBY.d.ts +0 -5
  65. package/dist/commands/INCRBY.js +0 -9
  66. package/dist/commands/INFO.d.ts +0 -52
  67. package/dist/commands/INFO.js +0 -33
  68. package/dist/commands/INFO_DEBUG.d.ts +0 -32
  69. package/dist/commands/INFO_DEBUG.js +0 -26
  70. package/dist/commands/MADD.d.ts +0 -10
  71. package/dist/commands/MADD.js +0 -13
  72. package/dist/commands/MGET.d.ts +0 -17
  73. package/dist/commands/MGET.js +0 -17
  74. package/dist/commands/MGET_WITHLABELS.d.ts +0 -13
  75. package/dist/commands/MGET_WITHLABELS.js +0 -19
  76. package/dist/commands/MRANGE.d.ts +0 -5
  77. package/dist/commands/MRANGE.js +0 -11
  78. package/dist/commands/MRANGE_WITHLABELS.d.ts +0 -5
  79. package/dist/commands/MRANGE_WITHLABELS.js +0 -11
  80. package/dist/commands/MREVRANGE.d.ts +0 -5
  81. package/dist/commands/MREVRANGE.js +0 -11
  82. package/dist/commands/MREVRANGE_WITHLABELS.d.ts +0 -5
  83. package/dist/commands/MREVRANGE_WITHLABELS.js +0 -11
  84. package/dist/commands/QUERYINDEX.d.ts +0 -5
  85. package/dist/commands/QUERYINDEX.js +0 -9
  86. package/dist/commands/RANGE.d.ts +0 -6
  87. package/dist/commands/RANGE.js +0 -14
  88. package/dist/commands/REVRANGE.d.ts +0 -6
  89. package/dist/commands/REVRANGE.js +0 -14
  90. package/dist/commands/index.d.ts +0 -192
  91. package/dist/commands/index.js +0 -307
  92. package/dist/index.d.ts +0 -2
  93. package/dist/index.js +0 -11
@@ -0,0 +1,16 @@
1
+ import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
2
+ import { TimeSeriesEncoding, TimeSeriesDuplicatePolicies, Labels, Timestamp } from '.';
3
+ export interface TsAddOptions {
4
+ RETENTION?: number;
5
+ ENCODING?: TimeSeriesEncoding;
6
+ CHUNK_SIZE?: number;
7
+ ON_DUPLICATE?: TimeSeriesDuplicatePolicies;
8
+ LABELS?: Labels;
9
+ }
10
+ declare const _default: {
11
+ readonly FIRST_KEY_INDEX: 1;
12
+ readonly IS_READ_ONLY: false;
13
+ readonly transformArguments: (this: void, key: RedisArgument, timestamp: Timestamp, value: number, options?: TsAddOptions) => RedisArgument[];
14
+ readonly transformReply: () => NumberReply;
15
+ };
16
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { transformTimestampArgument, pushRetentionArgument, pushEncodingArgument, pushChunkSizeArgument, pushLabelsArgument } from '.';
2
+ export default {
3
+ FIRST_KEY_INDEX: 1,
4
+ IS_READ_ONLY: false,
5
+ transformArguments(key, timestamp, value, options) {
6
+ const args = [
7
+ 'TS.ADD',
8
+ key,
9
+ transformTimestampArgument(timestamp),
10
+ value.toString()
11
+ ];
12
+ pushRetentionArgument(args, options?.RETENTION);
13
+ pushEncodingArgument(args, options?.ENCODING);
14
+ pushChunkSizeArgument(args, options?.CHUNK_SIZE);
15
+ if (options?.ON_DUPLICATE) {
16
+ args.push('ON_DUPLICATE', options.ON_DUPLICATE);
17
+ }
18
+ pushLabelsArgument(args, options?.LABELS);
19
+ return args;
20
+ },
21
+ transformReply: undefined
22
+ };
@@ -0,0 +1,10 @@
1
+ import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
2
+ import { TsCreateOptions } from './CREATE';
3
+ export type TsAlterOptions = Pick<TsCreateOptions, 'RETENTION' | 'CHUNK_SIZE' | 'DUPLICATE_POLICY' | 'LABELS'>;
4
+ declare const _default: {
5
+ readonly FIRST_KEY_INDEX: 1;
6
+ readonly IS_READ_ONLY: false;
7
+ readonly transformArguments: (this: void, key: RedisArgument, options?: TsAlterOptions) => RedisArgument[];
8
+ readonly transformReply: () => SimpleStringReply<'OK'>;
9
+ };
10
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { pushRetentionArgument, pushChunkSizeArgument, pushDuplicatePolicy, pushLabelsArgument } from '.';
2
+ export default {
3
+ FIRST_KEY_INDEX: 1,
4
+ IS_READ_ONLY: false,
5
+ transformArguments(key, options) {
6
+ const args = ['TS.ALTER', key];
7
+ pushRetentionArgument(args, options?.RETENTION);
8
+ pushChunkSizeArgument(args, options?.CHUNK_SIZE);
9
+ pushDuplicatePolicy(args, options?.DUPLICATE_POLICY);
10
+ pushLabelsArgument(args, options?.LABELS);
11
+ return args;
12
+ },
13
+ transformReply: undefined
14
+ };
@@ -0,0 +1,16 @@
1
+ import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
2
+ import { TimeSeriesEncoding, TimeSeriesDuplicatePolicies, Labels } from '.';
3
+ export interface TsCreateOptions {
4
+ RETENTION?: number;
5
+ ENCODING?: TimeSeriesEncoding;
6
+ CHUNK_SIZE?: number;
7
+ DUPLICATE_POLICY?: TimeSeriesDuplicatePolicies;
8
+ LABELS?: Labels;
9
+ }
10
+ declare const _default: {
11
+ readonly FIRST_KEY_INDEX: 1;
12
+ readonly IS_READ_ONLY: false;
13
+ readonly transformArguments: (this: void, key: RedisArgument, options?: TsCreateOptions) => RedisArgument[];
14
+ readonly transformReply: () => SimpleStringReply<'OK'>;
15
+ };
16
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { pushRetentionArgument, pushEncodingArgument, pushChunkSizeArgument, pushDuplicatePolicy, pushLabelsArgument } from '.';
2
+ export default {
3
+ FIRST_KEY_INDEX: 1,
4
+ IS_READ_ONLY: false,
5
+ transformArguments(key, options) {
6
+ const args = ['TS.CREATE', key];
7
+ pushRetentionArgument(args, options?.RETENTION);
8
+ pushEncodingArgument(args, options?.ENCODING);
9
+ pushChunkSizeArgument(args, options?.CHUNK_SIZE);
10
+ pushDuplicatePolicy(args, options?.DUPLICATE_POLICY);
11
+ pushLabelsArgument(args, options?.LABELS);
12
+ return args;
13
+ },
14
+ transformReply: undefined
15
+ };
@@ -0,0 +1,25 @@
1
+ /// <reference types="node" />
2
+ import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
3
+ export declare const TIME_SERIES_AGGREGATION_TYPE: {
4
+ readonly AVG: "AVG";
5
+ readonly FIRST: "FIRST";
6
+ readonly LAST: "LAST";
7
+ readonly MIN: "MIN";
8
+ readonly MAX: "MAX";
9
+ readonly SUM: "SUM";
10
+ readonly RANGE: "RANGE";
11
+ readonly COUNT: "COUNT";
12
+ readonly STD_P: "STD.P";
13
+ readonly STD_S: "STD.S";
14
+ readonly VAR_P: "VAR.P";
15
+ readonly VAR_S: "VAR.S";
16
+ readonly TWA: "TWA";
17
+ };
18
+ export type TimeSeriesAggregationType = typeof TIME_SERIES_AGGREGATION_TYPE[keyof typeof TIME_SERIES_AGGREGATION_TYPE];
19
+ declare const _default: {
20
+ readonly FIRST_KEY_INDEX: 1;
21
+ readonly IS_READ_ONLY: false;
22
+ readonly transformArguments: (this: void, sourceKey: RedisArgument, destinationKey: RedisArgument, aggregationType: TimeSeriesAggregationType, bucketDuration: number, alignTimestamp?: number) => (string | Buffer)[];
23
+ readonly transformReply: () => SimpleStringReply<'OK'>;
24
+ };
25
+ export default _default;
@@ -0,0 +1,34 @@
1
+ export const TIME_SERIES_AGGREGATION_TYPE = {
2
+ AVG: 'AVG',
3
+ FIRST: 'FIRST',
4
+ LAST: 'LAST',
5
+ MIN: 'MIN',
6
+ MAX: 'MAX',
7
+ SUM: 'SUM',
8
+ RANGE: 'RANGE',
9
+ COUNT: 'COUNT',
10
+ STD_P: 'STD.P',
11
+ STD_S: 'STD.S',
12
+ VAR_P: 'VAR.P',
13
+ VAR_S: 'VAR.S',
14
+ TWA: 'TWA'
15
+ };
16
+ export default {
17
+ FIRST_KEY_INDEX: 1,
18
+ IS_READ_ONLY: false,
19
+ transformArguments(sourceKey, destinationKey, aggregationType, bucketDuration, alignTimestamp) {
20
+ const args = [
21
+ 'TS.CREATERULE',
22
+ sourceKey,
23
+ destinationKey,
24
+ 'AGGREGATION',
25
+ aggregationType,
26
+ bucketDuration.toString()
27
+ ];
28
+ if (alignTimestamp !== undefined) {
29
+ args.push(alignTimestamp.toString());
30
+ }
31
+ return args;
32
+ },
33
+ transformReply: undefined
34
+ };
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ readonly FIRST_KEY_INDEX: 1;
3
+ readonly IS_READ_ONLY: false;
4
+ readonly transformArguments: (key: import("@redis/client/dist/lib/RESP/types").RedisArgument, value: number, options?: import("./INCRBY").TsIncrByOptions | undefined) => import("@redis/client/dist/lib/RESP/types").RedisArgument[];
5
+ readonly transformReply: () => import("@redis/client/dist/lib/RESP/types").NumberReply<number>;
6
+ };
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import INCRBY, { transformIncrByArguments } from './INCRBY';
2
+ export default {
3
+ FIRST_KEY_INDEX: INCRBY.FIRST_KEY_INDEX,
4
+ IS_READ_ONLY: INCRBY.IS_READ_ONLY,
5
+ transformArguments: transformIncrByArguments.bind(undefined, 'TS.DECRBY'),
6
+ transformReply: INCRBY.transformReply
7
+ };
@@ -0,0 +1,9 @@
1
+ import { Timestamp } from '.';
2
+ import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
3
+ declare const _default: {
4
+ readonly FIRST_KEY_INDEX: 1;
5
+ readonly IS_READ_ONLY: false;
6
+ readonly transformArguments: (this: void, key: RedisArgument, fromTimestamp: Timestamp, toTimestamp: Timestamp) => RedisArgument[];
7
+ readonly transformReply: () => NumberReply;
8
+ };
9
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { transformTimestampArgument } from '.';
2
+ export default {
3
+ FIRST_KEY_INDEX: 1,
4
+ IS_READ_ONLY: false,
5
+ transformArguments(key, fromTimestamp, toTimestamp) {
6
+ return [
7
+ 'TS.DEL',
8
+ key,
9
+ transformTimestampArgument(fromTimestamp),
10
+ transformTimestampArgument(toTimestamp)
11
+ ];
12
+ },
13
+ transformReply: undefined
14
+ };
@@ -0,0 +1,8 @@
1
+ import { RedisArgument, SimpleStringReply } from '@redis/client/dist/lib/RESP/types';
2
+ declare const _default: {
3
+ readonly FIRST_KEY_INDEX: 1;
4
+ readonly IS_READ_ONLY: false;
5
+ readonly transformArguments: (this: void, sourceKey: RedisArgument, destinationKey: RedisArgument) => RedisArgument[];
6
+ readonly transformReply: () => SimpleStringReply<'OK'>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,12 @@
1
+ export default {
2
+ FIRST_KEY_INDEX: 1,
3
+ IS_READ_ONLY: false,
4
+ transformArguments(sourceKey, destinationKey) {
5
+ return [
6
+ 'TS.DELETERULE',
7
+ sourceKey,
8
+ destinationKey
9
+ ];
10
+ },
11
+ transformReply: undefined
12
+ };
@@ -0,0 +1,21 @@
1
+ import { RedisArgument, TuplesReply, NumberReply, DoubleReply, UnwrapReply, Resp2Reply } from '@redis/client/dist/lib/RESP/types';
2
+ export interface TsGetOptions {
3
+ LATEST?: boolean;
4
+ }
5
+ export type TsGetReply = TuplesReply<[]> | TuplesReply<[NumberReply, DoubleReply]>;
6
+ declare const _default: {
7
+ readonly FIRST_KEY_INDEX: 1;
8
+ readonly IS_READ_ONLY: true;
9
+ readonly transformArguments: (this: void, key: RedisArgument, options?: TsGetOptions) => RedisArgument[];
10
+ readonly transformReply: {
11
+ readonly 2: (this: void, reply: UnwrapReply<Resp2Reply<TsGetReply>>) => {
12
+ timestamp: NumberReply<number>;
13
+ value: number;
14
+ } | null;
15
+ readonly 3: (this: void, reply: UnwrapReply<TsGetReply>) => {
16
+ timestamp: NumberReply<number>;
17
+ value: DoubleReply<number>;
18
+ } | null;
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,25 @@
1
+ export default {
2
+ FIRST_KEY_INDEX: 1,
3
+ IS_READ_ONLY: true,
4
+ transformArguments(key, options) {
5
+ const args = ['TS.GET', key];
6
+ if (options?.LATEST) {
7
+ args.push('LATEST');
8
+ }
9
+ return args;
10
+ },
11
+ transformReply: {
12
+ 2(reply) {
13
+ return reply.length === 0 ? null : {
14
+ timestamp: reply[0],
15
+ value: Number(reply[1])
16
+ };
17
+ },
18
+ 3(reply) {
19
+ return reply.length === 0 ? null : {
20
+ timestamp: reply[0],
21
+ value: reply[1]
22
+ };
23
+ }
24
+ }
25
+ };
@@ -0,0 +1,17 @@
1
+ import { RedisArgument, NumberReply } from '@redis/client/dist/lib/RESP/types';
2
+ import { Timestamp, Labels } from '.';
3
+ export interface TsIncrByOptions {
4
+ TIMESTAMP?: Timestamp;
5
+ RETENTION?: number;
6
+ UNCOMPRESSED?: boolean;
7
+ CHUNK_SIZE?: number;
8
+ LABELS?: Labels;
9
+ }
10
+ export declare function transformIncrByArguments(command: RedisArgument, key: RedisArgument, value: number, options?: TsIncrByOptions): RedisArgument[];
11
+ declare const _default: {
12
+ readonly FIRST_KEY_INDEX: 1;
13
+ readonly IS_READ_ONLY: false;
14
+ readonly transformArguments: (key: RedisArgument, value: number, options?: TsIncrByOptions | undefined) => RedisArgument[];
15
+ readonly transformReply: () => NumberReply;
16
+ };
17
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { transformTimestampArgument, pushRetentionArgument, pushChunkSizeArgument, pushLabelsArgument } from '.';
2
+ export function transformIncrByArguments(command, key, value, options) {
3
+ const args = [
4
+ command,
5
+ key,
6
+ value.toString()
7
+ ];
8
+ if (options?.TIMESTAMP !== undefined && options?.TIMESTAMP !== null) {
9
+ args.push('TIMESTAMP', transformTimestampArgument(options.TIMESTAMP));
10
+ }
11
+ pushRetentionArgument(args, options?.RETENTION);
12
+ if (options?.UNCOMPRESSED) {
13
+ args.push('UNCOMPRESSED');
14
+ }
15
+ pushChunkSizeArgument(args, options?.CHUNK_SIZE);
16
+ pushLabelsArgument(args, options?.LABELS);
17
+ return args;
18
+ }
19
+ export default {
20
+ FIRST_KEY_INDEX: 1,
21
+ IS_READ_ONLY: false,
22
+ transformArguments: transformIncrByArguments.bind(undefined, 'TS.INCRBY'),
23
+ transformReply: undefined
24
+ };
File without changes
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ // import { TimeSeriesAggregationType, TimeSeriesDuplicatePolicies } from '.';
3
+ // export const FIRST_KEY_INDEX = 1;
4
+ // export const IS_READ_ONLY = true;
5
+ // export function transformArguments(key: string): Array<string> {
6
+ // return ['TS.INFO', key];
7
+ // }
8
+ // export type InfoRawReply = [
9
+ // 'totalSamples',
10
+ // number,
11
+ // 'memoryUsage',
12
+ // number,
13
+ // 'firstTimestamp',
14
+ // number,
15
+ // 'lastTimestamp',
16
+ // number,
17
+ // 'retentionTime',
18
+ // number,
19
+ // 'chunkCount',
20
+ // number,
21
+ // 'chunkSize',
22
+ // number,
23
+ // 'chunkType',
24
+ // string,
25
+ // 'duplicatePolicy',
26
+ // TimeSeriesDuplicatePolicies | null,
27
+ // 'labels',
28
+ // Array<[name: string, value: string]>,
29
+ // 'sourceKey',
30
+ // string | null,
31
+ // 'rules',
32
+ // Array<[key: string, timeBucket: number, aggregationType: TimeSeriesAggregationType]>
33
+ // ];
34
+ // export interface InfoReply {
35
+ // totalSamples: number;
36
+ // memoryUsage: number;
37
+ // firstTimestamp: number;
38
+ // lastTimestamp: number;
39
+ // retentionTime: number;
40
+ // chunkCount: number;
41
+ // chunkSize: number;
42
+ // chunkType: string;
43
+ // duplicatePolicy: TimeSeriesDuplicatePolicies | null;
44
+ // labels: Array<{
45
+ // name: string;
46
+ // value: string;
47
+ // }>;
48
+ // sourceKey: string | null;
49
+ // rules: Array<{
50
+ // key: string;
51
+ // timeBucket: number;
52
+ // aggregationType: TimeSeriesAggregationType
53
+ // }>;
54
+ // }
55
+ // export function transformReply(reply: InfoRawReply): InfoReply {
56
+ // return {
57
+ // totalSamples: reply[1],
58
+ // memoryUsage: reply[3],
59
+ // firstTimestamp: reply[5],
60
+ // lastTimestamp: reply[7],
61
+ // retentionTime: reply[9],
62
+ // chunkCount: reply[11],
63
+ // chunkSize: reply[13],
64
+ // chunkType: reply[15],
65
+ // duplicatePolicy: reply[17],
66
+ // labels: reply[19].map(([name, value]) => ({
67
+ // name,
68
+ // value
69
+ // })),
70
+ // sourceKey: reply[21],
71
+ // rules: reply[23].map(([key, timeBucket, aggregationType]) => ({
72
+ // key,
73
+ // timeBucket,
74
+ // aggregationType
75
+ // }))
76
+ // };
77
+ // }
File without changes
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ // import {
3
+ // transformArguments as transformInfoArguments,
4
+ // InfoRawReply,
5
+ // InfoReply,
6
+ // transformReply as transformInfoReply
7
+ // } from './INFO';
8
+ // export { IS_READ_ONLY, FIRST_KEY_INDEX } from './INFO';
9
+ // export function transformArguments(key: string): Array<string> {
10
+ // const args = transformInfoArguments(key);
11
+ // args.push('DEBUG');
12
+ // return args;
13
+ // }
14
+ // type InfoDebugRawReply = [
15
+ // ...InfoRawReply,
16
+ // 'keySelfName',
17
+ // string,
18
+ // 'chunks',
19
+ // Array<[
20
+ // 'startTimestamp',
21
+ // number,
22
+ // 'endTimestamp',
23
+ // number,
24
+ // 'samples',
25
+ // number,
26
+ // 'size',
27
+ // number,
28
+ // 'bytesPerSample',
29
+ // string
30
+ // ]>
31
+ // ];
32
+ // interface InfoDebugReply extends InfoReply {
33
+ // keySelfName: string;
34
+ // chunks: Array<{
35
+ // startTimestamp: number;
36
+ // endTimestamp: number;
37
+ // samples: number;
38
+ // size: number;
39
+ // bytesPerSample: string;
40
+ // }>;
41
+ // }
42
+ // export function transformReply(rawReply: InfoDebugRawReply): InfoDebugReply {
43
+ // const reply = transformInfoReply(rawReply as unknown as InfoRawReply);
44
+ // (reply as InfoDebugReply).keySelfName = rawReply[25];
45
+ // (reply as InfoDebugReply).chunks = rawReply[27].map(chunk => ({
46
+ // startTimestamp: chunk[1],
47
+ // endTimestamp: chunk[3],
48
+ // samples: chunk[5],
49
+ // size: chunk[7],
50
+ // bytesPerSample: chunk[9]
51
+ // }));
52
+ // return reply as InfoDebugReply;
53
+ // }
@@ -0,0 +1,14 @@
1
+ import { Timestamp } from '.';
2
+ import { ArrayReply, NumberReply, SimpleErrorReply } from '@redis/client/dist/lib/RESP/types';
3
+ export interface TsMAddSample {
4
+ key: string;
5
+ timestamp: Timestamp;
6
+ value: number;
7
+ }
8
+ declare const _default: {
9
+ readonly FIRST_KEY_INDEX: 1;
10
+ readonly IS_READ_ONLY: false;
11
+ readonly transformArguments: (this: void, toAdd: Array<TsMAddSample>) => string[];
12
+ readonly transformReply: () => ArrayReply<NumberReply | SimpleErrorReply>;
13
+ };
14
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { transformTimestampArgument } from '.';
2
+ export default {
3
+ FIRST_KEY_INDEX: 1,
4
+ IS_READ_ONLY: false,
5
+ transformArguments(toAdd) {
6
+ const args = ['TS.MADD'];
7
+ for (const { key, timestamp, value } of toAdd) {
8
+ args.push(key, transformTimestampArgument(timestamp), value.toString());
9
+ }
10
+ return args;
11
+ },
12
+ transformReply: undefined
13
+ };
@@ -0,0 +1,14 @@
1
+ import { CommandArguments } from '@redis/client/dist/lib/RESP/types';
2
+ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
3
+ export interface TsMGetOptions {
4
+ LATEST?: boolean;
5
+ }
6
+ export declare function pushLatestArgument(args: CommandArguments, latest?: boolean): CommandArguments;
7
+ export declare function pushFilterArgument(args: CommandArguments, filter: RedisVariadicArgument): CommandArguments;
8
+ declare const _default: {
9
+ readonly FIRST_KEY_INDEX: undefined;
10
+ readonly IS_READ_ONLY: true;
11
+ readonly transformArguments: (this: void, filter: RedisVariadicArgument, options?: TsMGetOptions) => CommandArguments;
12
+ readonly transformReply: () => any;
13
+ };
14
+ export default _default;
@@ -0,0 +1,22 @@
1
+ import { pushVariadicArguments } from '@redis/client/dist/lib/commands/generic-transformers';
2
+ export function pushLatestArgument(args, latest) {
3
+ if (latest) {
4
+ args.push('LATEST');
5
+ }
6
+ return args;
7
+ }
8
+ export function pushFilterArgument(args, filter) {
9
+ args.push('FILTER');
10
+ return pushVariadicArguments(args, filter);
11
+ }
12
+ export default {
13
+ FIRST_KEY_INDEX: undefined,
14
+ IS_READ_ONLY: true,
15
+ transformArguments(filter, options) {
16
+ const args = pushLatestArgument(['TS.MGET'], options?.LATEST);
17
+ return pushFilterArgument(args, filter);
18
+ },
19
+ // TODO
20
+ // transformSampleReply
21
+ transformReply: undefined
22
+ };
@@ -0,0 +1,12 @@
1
+ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
2
+ import { TsMGetOptions } from './MGET';
3
+ export interface TsMGetWithLabelsOptions extends TsMGetOptions {
4
+ SELECTED_LABELS?: RedisVariadicArgument;
5
+ }
6
+ declare const _default: {
7
+ readonly FIRST_KEY_INDEX: undefined;
8
+ readonly IS_READ_ONLY: true;
9
+ readonly transformArguments: (this: void, filter: RedisVariadicArgument, options?: TsMGetWithLabelsOptions) => import("@redis/client/dist/lib/RESP/types").CommandArguments;
10
+ readonly transformReply: () => any;
11
+ };
12
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { pushLatestArgument, pushFilterArgument } from './MGET';
2
+ import { pushWithLabelsArgument } from '.';
3
+ export default {
4
+ FIRST_KEY_INDEX: undefined,
5
+ IS_READ_ONLY: true,
6
+ transformArguments(filter, options) {
7
+ let args = pushLatestArgument(['TS.MGET'], options?.LATEST);
8
+ args = pushWithLabelsArgument(args, options?.SELECTED_LABELS);
9
+ return pushFilterArgument(args, filter);
10
+ },
11
+ // TODO
12
+ transformReply: undefined
13
+ };
@@ -0,0 +1,32 @@
1
+ import { RedisArgument, CommandArguments } from '@redis/client/dist/lib/RESP/types';
2
+ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
3
+ import { Timestamp } from '.';
4
+ import { TsRangeOptions } from './RANGE';
5
+ export declare const TIME_SERIES_REDUCERS: {
6
+ AVG: string;
7
+ SUM: string;
8
+ MIN: string;
9
+ MAX: string;
10
+ RANGE: string;
11
+ COUNT: string;
12
+ STD_P: string;
13
+ STD_S: string;
14
+ VAR_P: string;
15
+ VAR_S: string;
16
+ };
17
+ export type TimeSeriesReducers = typeof TIME_SERIES_REDUCERS[keyof typeof TIME_SERIES_REDUCERS];
18
+ export interface TsMRangeOptions extends TsRangeOptions {
19
+ GROUPBY?: {
20
+ label: RedisArgument;
21
+ reducer: TimeSeriesReducers;
22
+ };
23
+ }
24
+ export declare function pushGroupByArgument(args: CommandArguments, groupBy?: TsMRangeOptions['GROUPBY']): CommandArguments;
25
+ export declare function transformMRangeArguments(command: RedisArgument, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: RedisVariadicArgument, options?: TsMRangeOptions): CommandArguments;
26
+ declare const _default: {
27
+ readonly FIRST_KEY_INDEX: undefined;
28
+ readonly IS_READ_ONLY: true;
29
+ readonly transformArguments: (fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: RedisVariadicArgument, options?: TsMRangeOptions | undefined) => CommandArguments;
30
+ readonly transformReply: () => any;
31
+ };
32
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import { pushRangeArguments } from './RANGE';
2
+ import { pushFilterArgument } from './MGET';
3
+ export const TIME_SERIES_REDUCERS = {
4
+ AVG: 'AVG',
5
+ SUM: 'SUM',
6
+ MIN: 'MIN',
7
+ MAX: 'MAX',
8
+ RANGE: 'RANGE',
9
+ COUNT: 'COUNT',
10
+ STD_P: 'STD.P',
11
+ STD_S: 'STD.S',
12
+ VAR_P: 'VAR.P',
13
+ VAR_S: 'VAR.S'
14
+ };
15
+ export function pushGroupByArgument(args, groupBy) {
16
+ if (groupBy) {
17
+ args.push('GROUPBY', groupBy.label, 'REDUCE', groupBy.reducer);
18
+ }
19
+ return args;
20
+ }
21
+ export function transformMRangeArguments(command, fromTimestamp, toTimestamp, filter, options) {
22
+ let args = pushRangeArguments([command], fromTimestamp, toTimestamp, options);
23
+ args = pushFilterArgument(args, filter);
24
+ return pushGroupByArgument(args, options?.GROUPBY);
25
+ }
26
+ export default {
27
+ FIRST_KEY_INDEX: undefined,
28
+ IS_READ_ONLY: true,
29
+ transformArguments: transformMRangeArguments.bind(undefined, 'TS.MRANGE'),
30
+ // TODO
31
+ transformReply: undefined
32
+ };
@@ -0,0 +1,15 @@
1
+ import { RedisArgument } from '@redis/client/dist/lib/RESP/types';
2
+ import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
3
+ import { TsMRangeOptions } from './MRANGE';
4
+ import { Timestamp } from '.';
5
+ export interface TsMRangeWithLabelsOptions extends TsMRangeOptions {
6
+ SELECTED_LABELS?: RedisVariadicArgument;
7
+ }
8
+ export declare function transformMRangeWithLabelsArguments(command: RedisArgument, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: RedisVariadicArgument, options?: TsMRangeWithLabelsOptions): import("@redis/client/dist/lib/RESP/types").CommandArguments;
9
+ declare const _default: {
10
+ readonly FIRST_KEY_INDEX: undefined;
11
+ readonly IS_READ_ONLY: true;
12
+ readonly transformArguments: (fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: RedisVariadicArgument, options?: TsMRangeWithLabelsOptions | undefined) => import("@redis/client/dist/lib/RESP/types").CommandArguments;
13
+ readonly transformReply: () => any;
14
+ };
15
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import { pushGroupByArgument } from './MRANGE';
2
+ import { pushWithLabelsArgument } from '.';
3
+ import { pushFilterArgument } from './MGET';
4
+ import { pushRangeArguments } from './RANGE';
5
+ export function transformMRangeWithLabelsArguments(command, fromTimestamp, toTimestamp, filter, options) {
6
+ let args = pushRangeArguments([command], fromTimestamp, toTimestamp, options);
7
+ args = pushWithLabelsArgument(args, options?.SELECTED_LABELS);
8
+ args = pushFilterArgument(args, filter);
9
+ return pushGroupByArgument(args, options?.GROUPBY);
10
+ }
11
+ export default {
12
+ FIRST_KEY_INDEX: undefined,
13
+ IS_READ_ONLY: true,
14
+ transformArguments: transformMRangeWithLabelsArguments.bind(undefined, 'TS.MRANGE'),
15
+ // TODO
16
+ transformReply: undefined
17
+ };