@redis/time-series 1.0.3
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.
- package/README.md +7 -0
- package/dist/commands/ADD.d.ts +12 -0
- package/dist/commands/ADD.js +22 -0
- package/dist/commands/ALTER.d.ts +9 -0
- package/dist/commands/ALTER.js +12 -0
- package/dist/commands/CREATE.d.ts +12 -0
- package/dist/commands/CREATE.js +17 -0
- package/dist/commands/CREATERULE.d.ts +4 -0
- package/dist/commands/CREATERULE.js +15 -0
- package/dist/commands/DECRBY.d.ts +5 -0
- package/dist/commands/DECRBY.js +9 -0
- package/dist/commands/DEL.d.ts +5 -0
- package/dist/commands/DEL.js +14 -0
- package/dist/commands/DELETERULE.d.ts +3 -0
- package/dist/commands/DELETERULE.js +12 -0
- package/dist/commands/GET.d.ts +5 -0
- package/dist/commands/GET.js +16 -0
- package/dist/commands/INCRBY.d.ts +5 -0
- package/dist/commands/INCRBY.js +9 -0
- package/dist/commands/INFO.d.ts +52 -0
- package/dist/commands/INFO.js +33 -0
- package/dist/commands/INFO_DEBUG.d.ts +32 -0
- package/dist/commands/INFO_DEBUG.js +26 -0
- package/dist/commands/MADD.d.ts +10 -0
- package/dist/commands/MADD.js +13 -0
- package/dist/commands/MGET.d.ts +14 -0
- package/dist/commands/MGET.js +16 -0
- package/dist/commands/MGET_WITHLABELS.d.ts +12 -0
- package/dist/commands/MGET_WITHLABELS.js +21 -0
- package/dist/commands/MRANGE.d.ts +5 -0
- package/dist/commands/MRANGE.js +11 -0
- package/dist/commands/MRANGE_WITHLABELS.d.ts +5 -0
- package/dist/commands/MRANGE_WITHLABELS.js +11 -0
- package/dist/commands/MREVRANGE.d.ts +5 -0
- package/dist/commands/MREVRANGE.js +11 -0
- package/dist/commands/MREVRANGE_WITHLABELS.d.ts +5 -0
- package/dist/commands/MREVRANGE_WITHLABELS.js +11 -0
- package/dist/commands/QUERYINDEX.d.ts +5 -0
- package/dist/commands/QUERYINDEX.js +9 -0
- package/dist/commands/RANGE.d.ts +6 -0
- package/dist/commands/RANGE.js +14 -0
- package/dist/commands/REVRANGE.d.ts +6 -0
- package/dist/commands/REVRANGE.js +14 -0
- package/dist/commands/index.d.ts +169 -0
- package/dist/commands/index.js +265 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @redis/time-series
|
|
2
|
+
|
|
3
|
+
This package provides support for the [RedisTimeSeries](https://redistimeseries.io) module, which adds a time series data structure to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisTimeSeries commands.
|
|
4
|
+
|
|
5
|
+
To use these extra commands, your Redis server must have the RedisTimeSeries module installed.
|
|
6
|
+
|
|
7
|
+
For an example of how to add values to a time series, query a time series, and perform aggregated queries against a time series, see `time-series.js` in the Node Redis examples folder.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TimeSeriesEncoding, TimeSeriesDuplicatePolicies, Labels, Timestamp } from '.';
|
|
2
|
+
interface AddOptions {
|
|
3
|
+
RETENTION?: number;
|
|
4
|
+
ENCODING?: TimeSeriesEncoding;
|
|
5
|
+
CHUNK_SIZE?: number;
|
|
6
|
+
ON_DUPLICATE?: TimeSeriesDuplicatePolicies;
|
|
7
|
+
LABELS?: Labels;
|
|
8
|
+
}
|
|
9
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
10
|
+
export declare function transformArguments(key: string, timestamp: Timestamp, value: number, options?: AddOptions): Array<string>;
|
|
11
|
+
export declare function transformReply(): number;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(key, timestamp, value, options) {
|
|
7
|
+
const args = [
|
|
8
|
+
'TS.ADD',
|
|
9
|
+
key,
|
|
10
|
+
(0, _1.transformTimestampArgument)(timestamp),
|
|
11
|
+
value.toString()
|
|
12
|
+
];
|
|
13
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
14
|
+
(0, _1.pushEncodingArgument)(args, options?.ENCODING);
|
|
15
|
+
(0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
|
|
16
|
+
if (options?.ON_DUPLICATE) {
|
|
17
|
+
args.push('ON_DUPLICATE', options.ON_DUPLICATE);
|
|
18
|
+
}
|
|
19
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
20
|
+
return args;
|
|
21
|
+
}
|
|
22
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Labels } from '.';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
interface AlterOptions {
|
|
4
|
+
RETENTION?: number;
|
|
5
|
+
LABELS?: Labels;
|
|
6
|
+
}
|
|
7
|
+
export declare function transformArguments(key: string, options?: AlterOptions): Array<string>;
|
|
8
|
+
export declare function transformReply(): 'OK';
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(key, options) {
|
|
7
|
+
const args = ['TS.ALTER', key];
|
|
8
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
9
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
10
|
+
return args;
|
|
11
|
+
}
|
|
12
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TimeSeriesEncoding, TimeSeriesDuplicatePolicies, Labels } from '.';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
interface CreateOptions {
|
|
4
|
+
RETENTION?: number;
|
|
5
|
+
ENCODING?: TimeSeriesEncoding;
|
|
6
|
+
CHUNK_SIZE?: number;
|
|
7
|
+
DUPLICATE_POLICY?: TimeSeriesDuplicatePolicies;
|
|
8
|
+
LABELS?: Labels;
|
|
9
|
+
}
|
|
10
|
+
export declare function transformArguments(key: string, options?: CreateOptions): Array<string>;
|
|
11
|
+
export declare function transformReply(): 'OK';
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(key, options) {
|
|
7
|
+
const args = ['TS.CREATE', key];
|
|
8
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
9
|
+
(0, _1.pushEncodingArgument)(args, options?.ENCODING);
|
|
10
|
+
(0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
|
|
11
|
+
if (options?.DUPLICATE_POLICY) {
|
|
12
|
+
args.push('DUPLICATE_POLICY', options.DUPLICATE_POLICY);
|
|
13
|
+
}
|
|
14
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
15
|
+
return args;
|
|
16
|
+
}
|
|
17
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TimeSeriesAggregationType } from '.';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
export declare function transformArguments(sourceKey: string, destinationKey: string, aggregationType: TimeSeriesAggregationType, timeBucket: number): Array<string>;
|
|
4
|
+
export declare function transformReply(): 'OK';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
5
|
+
function transformArguments(sourceKey, destinationKey, aggregationType, timeBucket) {
|
|
6
|
+
return [
|
|
7
|
+
'TS.CREATERULE',
|
|
8
|
+
sourceKey,
|
|
9
|
+
destinationKey,
|
|
10
|
+
'AGGREGATION',
|
|
11
|
+
aggregationType,
|
|
12
|
+
timeBucket.toString()
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { IncrDecrOptions } from '.';
|
|
3
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
4
|
+
export declare function transformArguments(key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments;
|
|
5
|
+
export declare function transformReply(): number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(key, value, options) {
|
|
7
|
+
return (0, _1.transformIncrDecrArguments)('TS.DECRBY', key, value, options);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { Timestamp } from '.';
|
|
3
|
+
export declare const FIRTS_KEY_INDEX = 1;
|
|
4
|
+
export declare function transformArguments(key: string, fromTimestamp: Timestamp, toTimestamp: Timestamp): RedisCommandArguments;
|
|
5
|
+
export declare function transformReply(): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRTS_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRTS_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(key, fromTimestamp, toTimestamp) {
|
|
7
|
+
return [
|
|
8
|
+
'TS.DEL',
|
|
9
|
+
key,
|
|
10
|
+
(0, _1.transformTimestampArgument)(fromTimestamp),
|
|
11
|
+
(0, _1.transformTimestampArgument)(toTimestamp)
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
5
|
+
function transformArguments(sourceKey, destinationKey) {
|
|
6
|
+
return [
|
|
7
|
+
'TS.DELETERULE',
|
|
8
|
+
sourceKey,
|
|
9
|
+
destinationKey,
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SampleRawReply, SampleReply } from '.';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(key: string): Array<string>;
|
|
5
|
+
export declare function transformReply(reply: [] | SampleRawReply): null | SampleReply;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
exports.IS_READ_ONLY = true;
|
|
7
|
+
function transformArguments(key) {
|
|
8
|
+
return ['TS.GET', key];
|
|
9
|
+
}
|
|
10
|
+
exports.transformArguments = transformArguments;
|
|
11
|
+
function transformReply(reply) {
|
|
12
|
+
if (reply.length === 0)
|
|
13
|
+
return null;
|
|
14
|
+
return (0, _1.transformSampleReply)(reply);
|
|
15
|
+
}
|
|
16
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { IncrDecrOptions } from '.';
|
|
3
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
4
|
+
export declare function transformArguments(key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments;
|
|
5
|
+
export declare function transformReply(): number;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(key, value, options) {
|
|
7
|
+
return (0, _1.transformIncrDecrArguments)('TS.INCRBY', key, value, options);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TimeSeriesAggregationType, TimeSeriesDuplicatePolicies } from '.';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(key: string): Array<string>;
|
|
5
|
+
export declare type InfoRawReply = [
|
|
6
|
+
_: string,
|
|
7
|
+
totalSamples: number,
|
|
8
|
+
_: string,
|
|
9
|
+
memoryUsage: number,
|
|
10
|
+
_: string,
|
|
11
|
+
firstTimestamp: number,
|
|
12
|
+
_: string,
|
|
13
|
+
lastTimestamp: number,
|
|
14
|
+
_: string,
|
|
15
|
+
retentionTime: number,
|
|
16
|
+
_: string,
|
|
17
|
+
chunkCount: number,
|
|
18
|
+
_: string,
|
|
19
|
+
chunkSize: number,
|
|
20
|
+
_: string,
|
|
21
|
+
chunkType: string,
|
|
22
|
+
_: string,
|
|
23
|
+
duplicatePolicy: TimeSeriesDuplicatePolicies | null,
|
|
24
|
+
_: string,
|
|
25
|
+
labels: Array<[name: string, value: string]>,
|
|
26
|
+
_: string,
|
|
27
|
+
sourceKey: string | null,
|
|
28
|
+
_: string,
|
|
29
|
+
rules: Array<[key: string, timeBucket: number, aggregationType: TimeSeriesAggregationType]>
|
|
30
|
+
];
|
|
31
|
+
export interface InfoReply {
|
|
32
|
+
totalSamples: number;
|
|
33
|
+
memoryUsage: number;
|
|
34
|
+
firstTimestamp: number;
|
|
35
|
+
lastTimestamp: number;
|
|
36
|
+
retentionTime: number;
|
|
37
|
+
chunkCount: number;
|
|
38
|
+
chunkSize: number;
|
|
39
|
+
chunkType: string;
|
|
40
|
+
duplicatePolicy: TimeSeriesDuplicatePolicies | null;
|
|
41
|
+
labels: Array<{
|
|
42
|
+
name: string;
|
|
43
|
+
value: string;
|
|
44
|
+
}>;
|
|
45
|
+
sourceKey: string | null;
|
|
46
|
+
rules: Array<{
|
|
47
|
+
key: string;
|
|
48
|
+
timeBucket: number;
|
|
49
|
+
aggregationType: TimeSeriesAggregationType;
|
|
50
|
+
}>;
|
|
51
|
+
}
|
|
52
|
+
export declare function transformReply(reply: InfoRawReply): InfoReply;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(key) {
|
|
7
|
+
return ['TS.INFO', key];
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
10
|
+
function transformReply(reply) {
|
|
11
|
+
return {
|
|
12
|
+
totalSamples: reply[1],
|
|
13
|
+
memoryUsage: reply[3],
|
|
14
|
+
firstTimestamp: reply[5],
|
|
15
|
+
lastTimestamp: reply[7],
|
|
16
|
+
retentionTime: reply[9],
|
|
17
|
+
chunkCount: reply[11],
|
|
18
|
+
chunkSize: reply[13],
|
|
19
|
+
chunkType: reply[15],
|
|
20
|
+
duplicatePolicy: reply[17],
|
|
21
|
+
labels: reply[19].map(([name, value]) => ({
|
|
22
|
+
name,
|
|
23
|
+
value
|
|
24
|
+
})),
|
|
25
|
+
sourceKey: reply[21],
|
|
26
|
+
rules: reply[23].map(([key, timeBucket, aggregationType]) => ({
|
|
27
|
+
key,
|
|
28
|
+
timeBucket,
|
|
29
|
+
aggregationType
|
|
30
|
+
}))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { InfoRawReply, InfoReply } from './INFO';
|
|
2
|
+
export { IS_READ_ONLY, FIRST_KEY_INDEX } from './INFO';
|
|
3
|
+
export declare function transformArguments(key: string): Array<string>;
|
|
4
|
+
declare type InfoDebugRawReply = [
|
|
5
|
+
...infoArgs: InfoRawReply,
|
|
6
|
+
_: string,
|
|
7
|
+
keySelfName: string,
|
|
8
|
+
_: string,
|
|
9
|
+
chunks: Array<[
|
|
10
|
+
_: string,
|
|
11
|
+
startTimestamp: number,
|
|
12
|
+
_: string,
|
|
13
|
+
endTimestamp: number,
|
|
14
|
+
_: string,
|
|
15
|
+
samples: number,
|
|
16
|
+
_: string,
|
|
17
|
+
size: number,
|
|
18
|
+
_: string,
|
|
19
|
+
bytesPerSample: string
|
|
20
|
+
]>
|
|
21
|
+
];
|
|
22
|
+
interface InfoDebugReply extends InfoReply {
|
|
23
|
+
keySelfName: string;
|
|
24
|
+
chunks: Array<{
|
|
25
|
+
startTimestamp: number;
|
|
26
|
+
endTimestamp: number;
|
|
27
|
+
samples: number;
|
|
28
|
+
size: number;
|
|
29
|
+
bytesPerSample: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export declare function transformReply(rawReply: InfoDebugRawReply): InfoDebugReply;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.FIRST_KEY_INDEX = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const INFO_1 = require("./INFO");
|
|
5
|
+
var INFO_2 = require("./INFO");
|
|
6
|
+
Object.defineProperty(exports, "IS_READ_ONLY", { enumerable: true, get: function () { return INFO_2.IS_READ_ONLY; } });
|
|
7
|
+
Object.defineProperty(exports, "FIRST_KEY_INDEX", { enumerable: true, get: function () { return INFO_2.FIRST_KEY_INDEX; } });
|
|
8
|
+
function transformArguments(key) {
|
|
9
|
+
const args = (0, INFO_1.transformArguments)(key);
|
|
10
|
+
args.push('DEBUG');
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
exports.transformArguments = transformArguments;
|
|
14
|
+
function transformReply(rawReply) {
|
|
15
|
+
const reply = (0, INFO_1.transformReply)(rawReply);
|
|
16
|
+
reply.keySelfName = rawReply[25];
|
|
17
|
+
reply.chunks = rawReply[27].map(chunk => ({
|
|
18
|
+
startTimestamp: chunk[1],
|
|
19
|
+
endTimestamp: chunk[3],
|
|
20
|
+
samples: chunk[5],
|
|
21
|
+
size: chunk[7],
|
|
22
|
+
bytesPerSample: chunk[9]
|
|
23
|
+
}));
|
|
24
|
+
return reply;
|
|
25
|
+
}
|
|
26
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Timestamp } from '.';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
interface MAddSample {
|
|
4
|
+
key: string;
|
|
5
|
+
timestamp: Timestamp;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function transformArguments(toAdd: Array<MAddSample>): Array<string>;
|
|
9
|
+
export declare function transformReply(): Array<number>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
function transformArguments(toAdd) {
|
|
7
|
+
const args = ['TS.MADD'];
|
|
8
|
+
for (const { key, timestamp, value } of toAdd) {
|
|
9
|
+
args.push(key, (0, _1.transformTimestampArgument)(timestamp), value.toString());
|
|
10
|
+
}
|
|
11
|
+
return args;
|
|
12
|
+
}
|
|
13
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { Filter, RawLabels, SampleRawReply, SampleReply } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(filter: Filter): RedisCommandArguments;
|
|
5
|
+
export declare type MGetRawReply = Array<[
|
|
6
|
+
key: string,
|
|
7
|
+
labels: RawLabels,
|
|
8
|
+
sample: SampleRawReply
|
|
9
|
+
]>;
|
|
10
|
+
export interface MGetReply {
|
|
11
|
+
key: string;
|
|
12
|
+
sample: SampleReply;
|
|
13
|
+
}
|
|
14
|
+
export declare function transformReply(reply: MGetRawReply): Array<MGetReply>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(filter) {
|
|
7
|
+
return (0, _1.pushFilterArgument)(['TS.MGET'], filter);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
10
|
+
function transformReply(reply) {
|
|
11
|
+
return reply.map(([key, _, sample]) => ({
|
|
12
|
+
key,
|
|
13
|
+
sample: (0, _1.transformSampleReply)(sample)
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SelectedLabels, Labels, Filter } from '.';
|
|
2
|
+
import { MGetRawReply, MGetReply } from './MGET';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
interface MGetWithLabelsOptions {
|
|
5
|
+
SELECTED_LABELS?: SelectedLabels;
|
|
6
|
+
}
|
|
7
|
+
export declare function transformArguments(filter: Filter, options?: MGetWithLabelsOptions): Array<string>;
|
|
8
|
+
export interface MGetWithLabelsReply extends MGetReply {
|
|
9
|
+
labels: Labels;
|
|
10
|
+
}
|
|
11
|
+
export declare function transformReply(reply: MGetRawReply): Array<MGetWithLabelsReply>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(filter, options) {
|
|
7
|
+
const args = ['TS.MGET'];
|
|
8
|
+
(0, _1.pushWithLabelsArgument)(args, options?.SELECTED_LABELS);
|
|
9
|
+
(0, _1.pushFilterArgument)(args, filter);
|
|
10
|
+
return args;
|
|
11
|
+
}
|
|
12
|
+
exports.transformArguments = transformArguments;
|
|
13
|
+
;
|
|
14
|
+
function transformReply(reply) {
|
|
15
|
+
return reply.map(([key, labels, sample]) => ({
|
|
16
|
+
key,
|
|
17
|
+
labels: (0, _1.transformLablesReply)(labels),
|
|
18
|
+
sample: (0, _1.transformSampleReply)(sample)
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { MRangeOptions, Timestamp, Filter } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(fromTimestamp: Timestamp, toTimestamp: Timestamp, filters: Filter, options?: MRangeOptions): RedisCommandArguments;
|
|
5
|
+
export { transformMRangeReply as transformReply } from '.';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(fromTimestamp, toTimestamp, filters, options) {
|
|
7
|
+
return (0, _1.pushMRangeArguments)(['TS.MRANGE'], fromTimestamp, toTimestamp, filters, options);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
10
|
+
var _2 = require(".");
|
|
11
|
+
Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return _2.transformMRangeReply; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { Timestamp, MRangeWithLabelsOptions } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(fromTimestamp: Timestamp, toTimestamp: Timestamp, filters: string | Array<string>, options?: MRangeWithLabelsOptions): RedisCommandArguments;
|
|
5
|
+
export { transformMRangeWithLabelsReply as transformReply } from '.';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(fromTimestamp, toTimestamp, filters, options) {
|
|
7
|
+
return (0, _1.pushMRangeWithLabelsArguments)(['TS.MRANGE'], fromTimestamp, toTimestamp, filters, options);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
10
|
+
var _2 = require(".");
|
|
11
|
+
Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return _2.transformMRangeWithLabelsReply; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { MRangeOptions, Timestamp, Filter } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(fromTimestamp: Timestamp, toTimestamp: Timestamp, filters: Filter, options?: MRangeOptions): RedisCommandArguments;
|
|
5
|
+
export { transformMRangeReply as transformReply } from '.';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(fromTimestamp, toTimestamp, filters, options) {
|
|
7
|
+
return (0, _1.pushMRangeArguments)(['TS.MREVRANGE'], fromTimestamp, toTimestamp, filters, options);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
10
|
+
var _2 = require(".");
|
|
11
|
+
Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return _2.transformMRangeReply; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { Timestamp, MRangeWithLabelsOptions, Filter } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(fromTimestamp: Timestamp, toTimestamp: Timestamp, filters: Filter, options?: MRangeWithLabelsOptions): RedisCommandArguments;
|
|
5
|
+
export { transformMRangeWithLabelsReply as transformReply } from '.';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(fromTimestamp, toTimestamp, filters, options) {
|
|
7
|
+
return (0, _1.pushMRangeWithLabelsArguments)(['TS.MREVRANGE'], fromTimestamp, toTimestamp, filters, options);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
10
|
+
var _2 = require(".");
|
|
11
|
+
Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return _2.transformMRangeWithLabelsReply; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { Filter } from '.';
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(filter: Filter): RedisCommandArguments;
|
|
5
|
+
export declare function transformReply(): Array<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.IS_READ_ONLY = void 0;
|
|
4
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(filter) {
|
|
7
|
+
return (0, generic_transformers_1.pushVerdictArguments)(['TS.QUERYINDEX'], filter);
|
|
8
|
+
}
|
|
9
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { RangeOptions, Timestamp, SampleRawReply, SampleReply } from '.';
|
|
3
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
4
|
+
export declare const IS_READ_ONLY = true;
|
|
5
|
+
export declare function transformArguments(key: string, fromTimestamp: Timestamp, toTimestamp: Timestamp, options?: RangeOptions): RedisCommandArguments;
|
|
6
|
+
export declare function transformReply(reply: Array<SampleRawReply>): Array<SampleReply>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
exports.IS_READ_ONLY = true;
|
|
7
|
+
function transformArguments(key, fromTimestamp, toTimestamp, options) {
|
|
8
|
+
return (0, _1.pushRangeArguments)(['TS.RANGE', key], fromTimestamp, toTimestamp, options);
|
|
9
|
+
}
|
|
10
|
+
exports.transformArguments = transformArguments;
|
|
11
|
+
function transformReply(reply) {
|
|
12
|
+
return (0, _1.transformRangeReply)(reply);
|
|
13
|
+
}
|
|
14
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
import { RangeOptions, Timestamp, SampleRawReply, SampleReply } from '.';
|
|
3
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
4
|
+
export declare const IS_READ_ONLY = true;
|
|
5
|
+
export declare function transformArguments(key: string, fromTimestamp: Timestamp, toTimestamp: Timestamp, options?: RangeOptions): RedisCommandArguments;
|
|
6
|
+
export declare function transformReply(reply: Array<SampleRawReply>): Array<SampleReply>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
6
|
+
exports.IS_READ_ONLY = true;
|
|
7
|
+
function transformArguments(key, fromTimestamp, toTimestamp, options) {
|
|
8
|
+
return (0, _1.pushRangeArguments)(['TS.REVRANGE', key], fromTimestamp, toTimestamp, options);
|
|
9
|
+
}
|
|
10
|
+
exports.transformArguments = transformArguments;
|
|
11
|
+
function transformReply(reply) {
|
|
12
|
+
return (0, _1.transformRangeReply)(reply);
|
|
13
|
+
}
|
|
14
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,169 @@
|
|
|
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
|
+
AVERAGE = "avg",
|
|
70
|
+
SUM = "sum",
|
|
71
|
+
MINIMUM = "min",
|
|
72
|
+
MAXIMUM = "max",
|
|
73
|
+
RANGE = "range",
|
|
74
|
+
COUNT = "count",
|
|
75
|
+
FIRST = "first",
|
|
76
|
+
LAST = "last",
|
|
77
|
+
STD_P = "std.p",
|
|
78
|
+
STD_S = "std.s",
|
|
79
|
+
VAR_P = "var.p",
|
|
80
|
+
VAR_S = "var.s"
|
|
81
|
+
}
|
|
82
|
+
export declare enum TimeSeriesDuplicatePolicies {
|
|
83
|
+
BLOCK = "BLOCK",
|
|
84
|
+
FIRST = "FIRST",
|
|
85
|
+
LAST = "LAST",
|
|
86
|
+
MIN = "MIN",
|
|
87
|
+
MAX = "MAX",
|
|
88
|
+
SUM = "SUM"
|
|
89
|
+
}
|
|
90
|
+
export declare enum TimeSeriesReducers {
|
|
91
|
+
SUM = "sum",
|
|
92
|
+
MINIMUM = "min",
|
|
93
|
+
MAXIMUM = "max"
|
|
94
|
+
}
|
|
95
|
+
export declare type Timestamp = number | Date | string;
|
|
96
|
+
export declare function transformTimestampArgument(timestamp: Timestamp): string;
|
|
97
|
+
export declare function pushRetentionArgument(args: RedisCommandArguments, retention?: number): RedisCommandArguments;
|
|
98
|
+
export declare enum TimeSeriesEncoding {
|
|
99
|
+
COMPRESSED = "COMPRESSED",
|
|
100
|
+
UNCOMPRESSED = "UNCOMPRESSED"
|
|
101
|
+
}
|
|
102
|
+
export declare function pushEncodingArgument(args: RedisCommandArguments, encoding?: TimeSeriesEncoding): RedisCommandArguments;
|
|
103
|
+
export declare function pushChunkSizeArgument(args: RedisCommandArguments, chunkSize?: number): RedisCommandArguments;
|
|
104
|
+
export declare type RawLabels = Array<[label: string, value: string]>;
|
|
105
|
+
export declare type Labels = {
|
|
106
|
+
[label: string]: string;
|
|
107
|
+
};
|
|
108
|
+
export declare function transformLablesReply(reply: RawLabels): Labels;
|
|
109
|
+
export declare function pushLabelsArgument(args: RedisCommandArguments, labels?: Labels): RedisCommandArguments;
|
|
110
|
+
export interface IncrDecrOptions {
|
|
111
|
+
TIMESTAMP?: Timestamp;
|
|
112
|
+
RETENTION?: number;
|
|
113
|
+
UNCOMPRESSED?: boolean;
|
|
114
|
+
CHUNK_SIZE?: number;
|
|
115
|
+
LABELS?: Labels;
|
|
116
|
+
}
|
|
117
|
+
export declare function transformIncrDecrArguments(command: 'TS.INCRBY' | 'TS.DECRBY', key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments;
|
|
118
|
+
export declare type SampleRawReply = [timestamp: number, value: string];
|
|
119
|
+
export interface SampleReply {
|
|
120
|
+
timestamp: number;
|
|
121
|
+
value: number;
|
|
122
|
+
}
|
|
123
|
+
export declare function transformSampleReply(reply: SampleRawReply): SampleReply;
|
|
124
|
+
export interface RangeOptions {
|
|
125
|
+
FILTER_BY_TS?: Array<Timestamp>;
|
|
126
|
+
FILTER_BY_VALUE?: {
|
|
127
|
+
min: number;
|
|
128
|
+
max: number;
|
|
129
|
+
};
|
|
130
|
+
COUNT?: number;
|
|
131
|
+
ALIGN?: Timestamp;
|
|
132
|
+
AGGREGATION?: {
|
|
133
|
+
type: TimeSeriesAggregationType;
|
|
134
|
+
timeBucket: Timestamp;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export declare function pushRangeArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, options?: RangeOptions): RedisCommandArguments;
|
|
138
|
+
interface MRangeGroupBy {
|
|
139
|
+
label: string;
|
|
140
|
+
reducer: TimeSeriesReducers;
|
|
141
|
+
}
|
|
142
|
+
export declare function pushMRangeGroupByArguments(args: RedisCommandArguments, groupBy?: MRangeGroupBy): RedisCommandArguments;
|
|
143
|
+
export declare type Filter = string | Array<string>;
|
|
144
|
+
export declare function pushFilterArgument(args: RedisCommandArguments, filter: string | Array<string>): RedisCommandArguments;
|
|
145
|
+
export interface MRangeOptions extends RangeOptions {
|
|
146
|
+
GROUPBY?: MRangeGroupBy;
|
|
147
|
+
}
|
|
148
|
+
export declare function pushMRangeArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: Filter, options?: MRangeOptions): RedisCommandArguments;
|
|
149
|
+
export declare type SelectedLabels = string | Array<string>;
|
|
150
|
+
export declare function pushWithLabelsArgument(args: RedisCommandArguments, selectedLabels?: SelectedLabels): RedisCommandArguments;
|
|
151
|
+
export interface MRangeWithLabelsOptions extends MRangeOptions {
|
|
152
|
+
SELECTED_LABELS?: SelectedLabels;
|
|
153
|
+
}
|
|
154
|
+
export declare function pushMRangeWithLabelsArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: Filter, options?: MRangeWithLabelsOptions): RedisCommandArguments;
|
|
155
|
+
export declare function transformRangeReply(reply: Array<SampleRawReply>): Array<SampleReply>;
|
|
156
|
+
declare type MRangeRawReply = Array<[
|
|
157
|
+
key: string,
|
|
158
|
+
labels: RawLabels,
|
|
159
|
+
samples: Array<SampleRawReply>
|
|
160
|
+
]>;
|
|
161
|
+
interface MRangeReplyItem {
|
|
162
|
+
key: string;
|
|
163
|
+
samples: Array<SampleReply>;
|
|
164
|
+
}
|
|
165
|
+
export declare function transformMRangeReply(reply: MRangeRawReply): Array<MRangeReplyItem>;
|
|
166
|
+
export interface MRangeWithLabelsReplyItem extends MRangeReplyItem {
|
|
167
|
+
labels: Labels;
|
|
168
|
+
}
|
|
169
|
+
export declare function transformMRangeWithLabelsReply(reply: MRangeRawReply): Array<MRangeWithLabelsReplyItem>;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformMRangeWithLabelsReply = exports.transformMRangeReply = exports.transformRangeReply = exports.pushMRangeWithLabelsArguments = exports.pushWithLabelsArgument = exports.pushMRangeArguments = exports.pushFilterArgument = exports.pushMRangeGroupByArguments = exports.pushRangeArguments = exports.transformSampleReply = exports.transformIncrDecrArguments = exports.pushLabelsArgument = exports.transformLablesReply = exports.pushChunkSizeArgument = exports.pushEncodingArgument = exports.TimeSeriesEncoding = exports.pushRetentionArgument = exports.transformTimestampArgument = exports.TimeSeriesReducers = exports.TimeSeriesDuplicatePolicies = exports.TimeSeriesAggregationType = void 0;
|
|
4
|
+
const ADD = require("./ADD");
|
|
5
|
+
const ALTER = require("./ALTER");
|
|
6
|
+
const CREATE = require("./CREATE");
|
|
7
|
+
const CREATERULE = require("./CREATERULE");
|
|
8
|
+
const DECRBY = require("./DECRBY");
|
|
9
|
+
const DEL = require("./DEL");
|
|
10
|
+
const DELETERULE = require("./DELETERULE");
|
|
11
|
+
const GET = require("./GET");
|
|
12
|
+
const INCRBY = require("./INCRBY");
|
|
13
|
+
const INFO_DEBUG = require("./INFO_DEBUG");
|
|
14
|
+
const INFO = require("./INFO");
|
|
15
|
+
const MADD = require("./MADD");
|
|
16
|
+
const MGET = require("./MGET");
|
|
17
|
+
const MGET_WITHLABELS = require("./MGET_WITHLABELS");
|
|
18
|
+
const QUERYINDEX = require("./QUERYINDEX");
|
|
19
|
+
const RANGE = require("./RANGE");
|
|
20
|
+
const REVRANGE = require("./REVRANGE");
|
|
21
|
+
const MRANGE = require("./MRANGE");
|
|
22
|
+
const MRANGE_WITHLABELS = require("./MRANGE_WITHLABELS");
|
|
23
|
+
const MREVRANGE = require("./MREVRANGE");
|
|
24
|
+
const MREVRANGE_WITHLABELS = require("./MREVRANGE_WITHLABELS");
|
|
25
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
26
|
+
exports.default = {
|
|
27
|
+
ADD,
|
|
28
|
+
add: ADD,
|
|
29
|
+
ALTER,
|
|
30
|
+
alter: ALTER,
|
|
31
|
+
CREATE,
|
|
32
|
+
create: CREATE,
|
|
33
|
+
CREATERULE,
|
|
34
|
+
createRule: CREATERULE,
|
|
35
|
+
DECRBY,
|
|
36
|
+
decrBy: DECRBY,
|
|
37
|
+
DEL,
|
|
38
|
+
del: DEL,
|
|
39
|
+
DELETERULE,
|
|
40
|
+
deleteRule: DELETERULE,
|
|
41
|
+
GET,
|
|
42
|
+
get: GET,
|
|
43
|
+
INCRBY,
|
|
44
|
+
incrBy: INCRBY,
|
|
45
|
+
INFO_DEBUG,
|
|
46
|
+
infoDebug: INFO_DEBUG,
|
|
47
|
+
INFO,
|
|
48
|
+
info: INFO,
|
|
49
|
+
MADD,
|
|
50
|
+
mAdd: MADD,
|
|
51
|
+
MGET,
|
|
52
|
+
mGet: MGET,
|
|
53
|
+
MGET_WITHLABELS,
|
|
54
|
+
mGetWithLabels: MGET_WITHLABELS,
|
|
55
|
+
QUERYINDEX,
|
|
56
|
+
queryIndex: QUERYINDEX,
|
|
57
|
+
RANGE,
|
|
58
|
+
range: RANGE,
|
|
59
|
+
REVRANGE,
|
|
60
|
+
revRange: REVRANGE,
|
|
61
|
+
MRANGE,
|
|
62
|
+
mRange: MRANGE,
|
|
63
|
+
MRANGE_WITHLABELS,
|
|
64
|
+
mRangeWithLabels: MRANGE_WITHLABELS,
|
|
65
|
+
MREVRANGE,
|
|
66
|
+
mRevRange: MREVRANGE,
|
|
67
|
+
MREVRANGE_WITHLABELS,
|
|
68
|
+
mRevRangeWithLabels: MREVRANGE_WITHLABELS
|
|
69
|
+
};
|
|
70
|
+
var TimeSeriesAggregationType;
|
|
71
|
+
(function (TimeSeriesAggregationType) {
|
|
72
|
+
TimeSeriesAggregationType["AVERAGE"] = "avg";
|
|
73
|
+
TimeSeriesAggregationType["SUM"] = "sum";
|
|
74
|
+
TimeSeriesAggregationType["MINIMUM"] = "min";
|
|
75
|
+
TimeSeriesAggregationType["MAXIMUM"] = "max";
|
|
76
|
+
TimeSeriesAggregationType["RANGE"] = "range";
|
|
77
|
+
TimeSeriesAggregationType["COUNT"] = "count";
|
|
78
|
+
TimeSeriesAggregationType["FIRST"] = "first";
|
|
79
|
+
TimeSeriesAggregationType["LAST"] = "last";
|
|
80
|
+
TimeSeriesAggregationType["STD_P"] = "std.p";
|
|
81
|
+
TimeSeriesAggregationType["STD_S"] = "std.s";
|
|
82
|
+
TimeSeriesAggregationType["VAR_P"] = "var.p";
|
|
83
|
+
TimeSeriesAggregationType["VAR_S"] = "var.s";
|
|
84
|
+
})(TimeSeriesAggregationType = exports.TimeSeriesAggregationType || (exports.TimeSeriesAggregationType = {}));
|
|
85
|
+
var TimeSeriesDuplicatePolicies;
|
|
86
|
+
(function (TimeSeriesDuplicatePolicies) {
|
|
87
|
+
TimeSeriesDuplicatePolicies["BLOCK"] = "BLOCK";
|
|
88
|
+
TimeSeriesDuplicatePolicies["FIRST"] = "FIRST";
|
|
89
|
+
TimeSeriesDuplicatePolicies["LAST"] = "LAST";
|
|
90
|
+
TimeSeriesDuplicatePolicies["MIN"] = "MIN";
|
|
91
|
+
TimeSeriesDuplicatePolicies["MAX"] = "MAX";
|
|
92
|
+
TimeSeriesDuplicatePolicies["SUM"] = "SUM";
|
|
93
|
+
})(TimeSeriesDuplicatePolicies = exports.TimeSeriesDuplicatePolicies || (exports.TimeSeriesDuplicatePolicies = {}));
|
|
94
|
+
var TimeSeriesReducers;
|
|
95
|
+
(function (TimeSeriesReducers) {
|
|
96
|
+
TimeSeriesReducers["SUM"] = "sum";
|
|
97
|
+
TimeSeriesReducers["MINIMUM"] = "min";
|
|
98
|
+
TimeSeriesReducers["MAXIMUM"] = "max";
|
|
99
|
+
})(TimeSeriesReducers = exports.TimeSeriesReducers || (exports.TimeSeriesReducers = {}));
|
|
100
|
+
function transformTimestampArgument(timestamp) {
|
|
101
|
+
if (typeof timestamp === 'string')
|
|
102
|
+
return timestamp;
|
|
103
|
+
return (typeof timestamp === 'number' ?
|
|
104
|
+
timestamp :
|
|
105
|
+
timestamp.getTime()).toString();
|
|
106
|
+
}
|
|
107
|
+
exports.transformTimestampArgument = transformTimestampArgument;
|
|
108
|
+
function pushRetentionArgument(args, retention) {
|
|
109
|
+
if (retention) {
|
|
110
|
+
args.push('RETENTION', retention.toString());
|
|
111
|
+
}
|
|
112
|
+
return args;
|
|
113
|
+
}
|
|
114
|
+
exports.pushRetentionArgument = pushRetentionArgument;
|
|
115
|
+
var TimeSeriesEncoding;
|
|
116
|
+
(function (TimeSeriesEncoding) {
|
|
117
|
+
TimeSeriesEncoding["COMPRESSED"] = "COMPRESSED";
|
|
118
|
+
TimeSeriesEncoding["UNCOMPRESSED"] = "UNCOMPRESSED";
|
|
119
|
+
})(TimeSeriesEncoding = exports.TimeSeriesEncoding || (exports.TimeSeriesEncoding = {}));
|
|
120
|
+
function pushEncodingArgument(args, encoding) {
|
|
121
|
+
if (encoding) {
|
|
122
|
+
args.push('ENCODING', encoding);
|
|
123
|
+
}
|
|
124
|
+
return args;
|
|
125
|
+
}
|
|
126
|
+
exports.pushEncodingArgument = pushEncodingArgument;
|
|
127
|
+
function pushChunkSizeArgument(args, chunkSize) {
|
|
128
|
+
if (chunkSize) {
|
|
129
|
+
args.push('CHUNK_SIZE', chunkSize.toString());
|
|
130
|
+
}
|
|
131
|
+
return args;
|
|
132
|
+
}
|
|
133
|
+
exports.pushChunkSizeArgument = pushChunkSizeArgument;
|
|
134
|
+
function transformLablesReply(reply) {
|
|
135
|
+
const labels = {};
|
|
136
|
+
for (const [key, value] of reply) {
|
|
137
|
+
labels[key] = value;
|
|
138
|
+
}
|
|
139
|
+
return labels;
|
|
140
|
+
}
|
|
141
|
+
exports.transformLablesReply = transformLablesReply;
|
|
142
|
+
function pushLabelsArgument(args, labels) {
|
|
143
|
+
if (labels) {
|
|
144
|
+
args.push('LABELS');
|
|
145
|
+
for (const [label, value] of Object.entries(labels)) {
|
|
146
|
+
args.push(label, value);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return args;
|
|
150
|
+
}
|
|
151
|
+
exports.pushLabelsArgument = pushLabelsArgument;
|
|
152
|
+
function transformIncrDecrArguments(command, key, value, options) {
|
|
153
|
+
const args = [
|
|
154
|
+
command,
|
|
155
|
+
key,
|
|
156
|
+
value.toString()
|
|
157
|
+
];
|
|
158
|
+
if (options?.TIMESTAMP !== undefined && options?.TIMESTAMP !== null) {
|
|
159
|
+
args.push('TIMESTAMP', transformTimestampArgument(options.TIMESTAMP));
|
|
160
|
+
}
|
|
161
|
+
pushRetentionArgument(args, options?.RETENTION);
|
|
162
|
+
if (options?.UNCOMPRESSED) {
|
|
163
|
+
args.push('UNCOMPRESSED');
|
|
164
|
+
}
|
|
165
|
+
pushChunkSizeArgument(args, options?.CHUNK_SIZE);
|
|
166
|
+
pushLabelsArgument(args, options?.LABELS);
|
|
167
|
+
return args;
|
|
168
|
+
}
|
|
169
|
+
exports.transformIncrDecrArguments = transformIncrDecrArguments;
|
|
170
|
+
function transformSampleReply(reply) {
|
|
171
|
+
return {
|
|
172
|
+
timestamp: reply[0],
|
|
173
|
+
value: Number(reply[1])
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
exports.transformSampleReply = transformSampleReply;
|
|
177
|
+
function pushRangeArguments(args, fromTimestamp, toTimestamp, options) {
|
|
178
|
+
args.push(transformTimestampArgument(fromTimestamp), transformTimestampArgument(toTimestamp));
|
|
179
|
+
if (options?.FILTER_BY_TS) {
|
|
180
|
+
args.push('FILTER_BY_TS');
|
|
181
|
+
for (const ts of options.FILTER_BY_TS) {
|
|
182
|
+
args.push(transformTimestampArgument(ts));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (options?.FILTER_BY_VALUE) {
|
|
186
|
+
args.push('FILTER_BY_VALUE', options.FILTER_BY_VALUE.min.toString(), options.FILTER_BY_VALUE.max.toString());
|
|
187
|
+
}
|
|
188
|
+
if (options?.COUNT) {
|
|
189
|
+
args.push('COUNT', options.COUNT.toString());
|
|
190
|
+
}
|
|
191
|
+
if (options?.ALIGN) {
|
|
192
|
+
args.push('ALIGN', transformTimestampArgument(options.ALIGN));
|
|
193
|
+
}
|
|
194
|
+
if (options?.AGGREGATION) {
|
|
195
|
+
args.push('AGGREGATION', options.AGGREGATION.type, transformTimestampArgument(options.AGGREGATION.timeBucket));
|
|
196
|
+
}
|
|
197
|
+
return args;
|
|
198
|
+
}
|
|
199
|
+
exports.pushRangeArguments = pushRangeArguments;
|
|
200
|
+
function pushMRangeGroupByArguments(args, groupBy) {
|
|
201
|
+
if (groupBy) {
|
|
202
|
+
args.push('GROUPBY', groupBy.label, 'REDUCE', groupBy.reducer);
|
|
203
|
+
}
|
|
204
|
+
return args;
|
|
205
|
+
}
|
|
206
|
+
exports.pushMRangeGroupByArguments = pushMRangeGroupByArguments;
|
|
207
|
+
function pushFilterArgument(args, filter) {
|
|
208
|
+
args.push('FILTER');
|
|
209
|
+
(0, generic_transformers_1.pushVerdictArguments)(args, filter);
|
|
210
|
+
return args;
|
|
211
|
+
}
|
|
212
|
+
exports.pushFilterArgument = pushFilterArgument;
|
|
213
|
+
function pushMRangeArguments(args, fromTimestamp, toTimestamp, filter, options) {
|
|
214
|
+
pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
|
215
|
+
pushFilterArgument(args, filter);
|
|
216
|
+
pushMRangeGroupByArguments(args, options?.GROUPBY);
|
|
217
|
+
return args;
|
|
218
|
+
}
|
|
219
|
+
exports.pushMRangeArguments = pushMRangeArguments;
|
|
220
|
+
function pushWithLabelsArgument(args, selectedLabels) {
|
|
221
|
+
if (!selectedLabels) {
|
|
222
|
+
args.push('WITHLABELS');
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
args.push('SELECTED_LABELS');
|
|
226
|
+
(0, generic_transformers_1.pushVerdictArguments)(args, selectedLabels);
|
|
227
|
+
}
|
|
228
|
+
return args;
|
|
229
|
+
}
|
|
230
|
+
exports.pushWithLabelsArgument = pushWithLabelsArgument;
|
|
231
|
+
function pushMRangeWithLabelsArguments(args, fromTimestamp, toTimestamp, filter, options) {
|
|
232
|
+
pushRangeArguments(args, fromTimestamp, toTimestamp, options);
|
|
233
|
+
pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
|
234
|
+
pushFilterArgument(args, filter);
|
|
235
|
+
pushMRangeGroupByArguments(args, options?.GROUPBY);
|
|
236
|
+
return args;
|
|
237
|
+
}
|
|
238
|
+
exports.pushMRangeWithLabelsArguments = pushMRangeWithLabelsArguments;
|
|
239
|
+
function transformRangeReply(reply) {
|
|
240
|
+
return reply.map(transformSampleReply);
|
|
241
|
+
}
|
|
242
|
+
exports.transformRangeReply = transformRangeReply;
|
|
243
|
+
function transformMRangeReply(reply) {
|
|
244
|
+
const args = [];
|
|
245
|
+
for (const [key, _, sample] of reply) {
|
|
246
|
+
args.push({
|
|
247
|
+
key,
|
|
248
|
+
samples: sample.map(transformSampleReply)
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return args;
|
|
252
|
+
}
|
|
253
|
+
exports.transformMRangeReply = transformMRangeReply;
|
|
254
|
+
function transformMRangeWithLabelsReply(reply) {
|
|
255
|
+
const args = [];
|
|
256
|
+
for (const [key, labels, samples] of reply) {
|
|
257
|
+
args.push({
|
|
258
|
+
key,
|
|
259
|
+
labels: transformLablesReply(labels),
|
|
260
|
+
samples: samples.map(transformSampleReply)
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
return args;
|
|
264
|
+
}
|
|
265
|
+
exports.transformMRangeWithLabelsReply = transformMRangeWithLabelsReply;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimeSeriesAggregationType = exports.TimeSeriesEncoding = exports.TimeSeriesDuplicatePolicies = exports.default = void 0;
|
|
4
|
+
var commands_1 = require("./commands");
|
|
5
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return commands_1.default; } });
|
|
6
|
+
var commands_2 = require("./commands");
|
|
7
|
+
Object.defineProperty(exports, "TimeSeriesDuplicatePolicies", { enumerable: true, get: function () { return commands_2.TimeSeriesDuplicatePolicies; } });
|
|
8
|
+
Object.defineProperty(exports, "TimeSeriesEncoding", { enumerable: true, get: function () { return commands_2.TimeSeriesEncoding; } });
|
|
9
|
+
Object.defineProperty(exports, "TimeSeriesAggregationType", { enumerable: true, get: function () { return commands_2.TimeSeriesAggregationType; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@redis/time-series",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'",
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"documentation": "typedoc"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"@redis/client": "^1.0.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
20
|
+
"@redis/test-utils": "*",
|
|
21
|
+
"@types/node": "^17.0.31",
|
|
22
|
+
"nyc": "^15.1.0",
|
|
23
|
+
"release-it": "^15.0.0",
|
|
24
|
+
"source-map-support": "^0.5.21",
|
|
25
|
+
"ts-node": "^10.7.0",
|
|
26
|
+
"typedoc": "^0.22.15",
|
|
27
|
+
"typescript": "^4.6.4"
|
|
28
|
+
}
|
|
29
|
+
}
|