@redis/time-series 2.0.0-next.1 → 2.0.0-next.2
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/dist/lib/commands/ADD.js +9 -7
- package/dist/lib/commands/ALTER.js +8 -6
- package/dist/lib/commands/CREATE.js +9 -7
- package/dist/lib/commands/CREATERULE.d.ts +0 -1
- package/dist/lib/commands/CREATERULE.js +5 -2
- package/dist/lib/commands/DECRBY.js +31 -6
- package/dist/lib/commands/DEL.js +6 -4
- package/dist/lib/commands/DELETERULE.js +3 -1
- package/dist/lib/commands/GET.js +3 -1
- package/dist/lib/commands/INCRBY.js +11 -7
- package/dist/lib/commands/MADD.js +5 -3
- package/dist/lib/commands/MGET.js +10 -5
- package/dist/lib/commands/MGET_WITHLABELS.js +8 -6
- package/dist/lib/commands/MRANGE.js +13 -8
- package/dist/lib/commands/MRANGE_WITHLABELS.js +14 -10
- package/dist/lib/commands/MREVRANGE.js +31 -6
- package/dist/lib/commands/MREVRANGE_WITHLABELS.js +31 -6
- package/dist/lib/commands/QUERYINDEX.js +5 -3
- package/dist/lib/commands/RANGE.js +16 -11
- package/dist/lib/commands/REVRANGE.js +31 -6
- package/dist/lib/commands/index.js +83 -70
- package/dist/lib/index.js +14 -3
- package/package.json +2 -2
package/dist/lib/commands/ADD.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
exports.default = {
|
|
3
5
|
FIRST_KEY_INDEX: 1,
|
|
4
6
|
IS_READ_ONLY: false,
|
|
5
7
|
transformArguments(key, timestamp, value, options) {
|
|
6
8
|
const args = [
|
|
7
9
|
'TS.ADD',
|
|
8
10
|
key,
|
|
9
|
-
transformTimestampArgument(timestamp),
|
|
11
|
+
(0, _1.transformTimestampArgument)(timestamp),
|
|
10
12
|
value.toString()
|
|
11
13
|
];
|
|
12
|
-
pushRetentionArgument(args, options?.RETENTION);
|
|
13
|
-
pushEncodingArgument(args, options?.ENCODING);
|
|
14
|
-
pushChunkSizeArgument(args, options?.CHUNK_SIZE);
|
|
14
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
15
|
+
(0, _1.pushEncodingArgument)(args, options?.ENCODING);
|
|
16
|
+
(0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
|
|
15
17
|
if (options?.ON_DUPLICATE) {
|
|
16
18
|
args.push('ON_DUPLICATE', options.ON_DUPLICATE);
|
|
17
19
|
}
|
|
18
|
-
pushLabelsArgument(args, options?.LABELS);
|
|
20
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
19
21
|
return args;
|
|
20
22
|
},
|
|
21
23
|
transformReply: undefined
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
exports.default = {
|
|
3
5
|
FIRST_KEY_INDEX: 1,
|
|
4
6
|
IS_READ_ONLY: false,
|
|
5
7
|
transformArguments(key, options) {
|
|
6
8
|
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);
|
|
9
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
10
|
+
(0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
|
|
11
|
+
(0, _1.pushDuplicatePolicy)(args, options?.DUPLICATE_POLICY);
|
|
12
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
11
13
|
return args;
|
|
12
14
|
},
|
|
13
15
|
transformReply: undefined
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
exports.default = {
|
|
3
5
|
FIRST_KEY_INDEX: 1,
|
|
4
6
|
IS_READ_ONLY: false,
|
|
5
7
|
transformArguments(key, options) {
|
|
6
8
|
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);
|
|
9
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
10
|
+
(0, _1.pushEncodingArgument)(args, options?.ENCODING);
|
|
11
|
+
(0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
|
|
12
|
+
(0, _1.pushDuplicatePolicy)(args, options?.DUPLICATE_POLICY);
|
|
13
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
12
14
|
return args;
|
|
13
15
|
},
|
|
14
16
|
transformReply: undefined
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TIME_SERIES_AGGREGATION_TYPE = void 0;
|
|
4
|
+
exports.TIME_SERIES_AGGREGATION_TYPE = {
|
|
2
5
|
AVG: 'AVG',
|
|
3
6
|
FIRST: 'FIRST',
|
|
4
7
|
LAST: 'LAST',
|
|
@@ -13,7 +16,7 @@ export const TIME_SERIES_AGGREGATION_TYPE = {
|
|
|
13
16
|
VAR_S: 'VAR.S',
|
|
14
17
|
TWA: 'TWA'
|
|
15
18
|
};
|
|
16
|
-
|
|
19
|
+
exports.default = {
|
|
17
20
|
FIRST_KEY_INDEX: 1,
|
|
18
21
|
IS_READ_ONLY: false,
|
|
19
22
|
transformArguments(sourceKey, destinationKey, aggregationType, bucketDuration, alignTimestamp) {
|
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const INCRBY_1 = __importStar(require("./INCRBY"));
|
|
27
|
+
exports.default = {
|
|
28
|
+
FIRST_KEY_INDEX: INCRBY_1.default.FIRST_KEY_INDEX,
|
|
29
|
+
IS_READ_ONLY: INCRBY_1.default.IS_READ_ONLY,
|
|
30
|
+
transformArguments: INCRBY_1.transformIncrByArguments.bind(undefined, 'TS.DECRBY'),
|
|
31
|
+
transformReply: INCRBY_1.default.transformReply
|
|
7
32
|
};
|
package/dist/lib/commands/DEL.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
exports.default = {
|
|
3
5
|
FIRST_KEY_INDEX: 1,
|
|
4
6
|
IS_READ_ONLY: false,
|
|
5
7
|
transformArguments(key, fromTimestamp, toTimestamp) {
|
|
6
8
|
return [
|
|
7
9
|
'TS.DEL',
|
|
8
10
|
key,
|
|
9
|
-
transformTimestampArgument(fromTimestamp),
|
|
10
|
-
transformTimestampArgument(toTimestamp)
|
|
11
|
+
(0, _1.transformTimestampArgument)(fromTimestamp),
|
|
12
|
+
(0, _1.transformTimestampArgument)(toTimestamp)
|
|
11
13
|
];
|
|
12
14
|
},
|
|
13
15
|
transformReply: undefined
|
package/dist/lib/commands/GET.js
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformIncrByArguments = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
function transformIncrByArguments(command, key, value, options) {
|
|
3
6
|
const args = [
|
|
4
7
|
command,
|
|
5
8
|
key,
|
|
6
9
|
value.toString()
|
|
7
10
|
];
|
|
8
11
|
if (options?.TIMESTAMP !== undefined && options?.TIMESTAMP !== null) {
|
|
9
|
-
args.push('TIMESTAMP', transformTimestampArgument(options.TIMESTAMP));
|
|
12
|
+
args.push('TIMESTAMP', (0, _1.transformTimestampArgument)(options.TIMESTAMP));
|
|
10
13
|
}
|
|
11
|
-
pushRetentionArgument(args, options?.RETENTION);
|
|
14
|
+
(0, _1.pushRetentionArgument)(args, options?.RETENTION);
|
|
12
15
|
if (options?.UNCOMPRESSED) {
|
|
13
16
|
args.push('UNCOMPRESSED');
|
|
14
17
|
}
|
|
15
|
-
pushChunkSizeArgument(args, options?.CHUNK_SIZE);
|
|
16
|
-
pushLabelsArgument(args, options?.LABELS);
|
|
18
|
+
(0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
|
|
19
|
+
(0, _1.pushLabelsArgument)(args, options?.LABELS);
|
|
17
20
|
return args;
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
exports.transformIncrByArguments = transformIncrByArguments;
|
|
23
|
+
exports.default = {
|
|
20
24
|
FIRST_KEY_INDEX: 1,
|
|
21
25
|
IS_READ_ONLY: false,
|
|
22
26
|
transformArguments: transformIncrByArguments.bind(undefined, 'TS.INCRBY'),
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
exports.default = {
|
|
3
5
|
FIRST_KEY_INDEX: 1,
|
|
4
6
|
IS_READ_ONLY: false,
|
|
5
7
|
transformArguments(toAdd) {
|
|
6
8
|
const args = ['TS.MADD'];
|
|
7
9
|
for (const { key, timestamp, value } of toAdd) {
|
|
8
|
-
args.push(key, transformTimestampArgument(timestamp), value.toString());
|
|
10
|
+
args.push(key, (0, _1.transformTimestampArgument)(timestamp), value.toString());
|
|
9
11
|
}
|
|
10
12
|
return args;
|
|
11
13
|
},
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pushFilterArgument = exports.pushLatestArgument = void 0;
|
|
4
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
|
+
function pushLatestArgument(args, latest) {
|
|
3
6
|
if (latest) {
|
|
4
7
|
args.push('LATEST');
|
|
5
8
|
}
|
|
6
9
|
return args;
|
|
7
10
|
}
|
|
8
|
-
|
|
11
|
+
exports.pushLatestArgument = pushLatestArgument;
|
|
12
|
+
function pushFilterArgument(args, filter) {
|
|
9
13
|
args.push('FILTER');
|
|
10
|
-
return pushVariadicArguments(args, filter);
|
|
14
|
+
return (0, generic_transformers_1.pushVariadicArguments)(args, filter);
|
|
11
15
|
}
|
|
12
|
-
|
|
16
|
+
exports.pushFilterArgument = pushFilterArgument;
|
|
17
|
+
exports.default = {
|
|
13
18
|
FIRST_KEY_INDEX: undefined,
|
|
14
19
|
IS_READ_ONLY: true,
|
|
15
20
|
transformArguments(filter, options) {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const MGET_1 = require("./MGET");
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.default = {
|
|
4
6
|
FIRST_KEY_INDEX: undefined,
|
|
5
7
|
IS_READ_ONLY: true,
|
|
6
8
|
transformArguments(filter, options) {
|
|
7
|
-
let args = pushLatestArgument(['TS.MGET'], options?.LATEST);
|
|
8
|
-
args = pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
|
9
|
-
return pushFilterArgument(args, filter);
|
|
9
|
+
let args = (0, MGET_1.pushLatestArgument)(['TS.MGET'], options?.LATEST);
|
|
10
|
+
args = (0, _1.pushWithLabelsArgument)(args, options?.SELECTED_LABELS);
|
|
11
|
+
return (0, MGET_1.pushFilterArgument)(args, filter);
|
|
10
12
|
},
|
|
11
13
|
// TODO
|
|
12
14
|
transformReply: undefined
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformMRangeArguments = exports.pushGroupByArgument = exports.TIME_SERIES_REDUCERS = void 0;
|
|
4
|
+
const RANGE_1 = require("./RANGE");
|
|
5
|
+
const MGET_1 = require("./MGET");
|
|
6
|
+
exports.TIME_SERIES_REDUCERS = {
|
|
4
7
|
AVG: 'AVG',
|
|
5
8
|
SUM: 'SUM',
|
|
6
9
|
MIN: 'MIN',
|
|
@@ -12,18 +15,20 @@ export const TIME_SERIES_REDUCERS = {
|
|
|
12
15
|
VAR_P: 'VAR.P',
|
|
13
16
|
VAR_S: 'VAR.S'
|
|
14
17
|
};
|
|
15
|
-
|
|
18
|
+
function pushGroupByArgument(args, groupBy) {
|
|
16
19
|
if (groupBy) {
|
|
17
20
|
args.push('GROUPBY', groupBy.label, 'REDUCE', groupBy.reducer);
|
|
18
21
|
}
|
|
19
22
|
return args;
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
args =
|
|
24
|
+
exports.pushGroupByArgument = pushGroupByArgument;
|
|
25
|
+
function transformMRangeArguments(command, fromTimestamp, toTimestamp, filter, options) {
|
|
26
|
+
let args = (0, RANGE_1.pushRangeArguments)([command], fromTimestamp, toTimestamp, options);
|
|
27
|
+
args = (0, MGET_1.pushFilterArgument)(args, filter);
|
|
24
28
|
return pushGroupByArgument(args, options?.GROUPBY);
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
exports.transformMRangeArguments = transformMRangeArguments;
|
|
31
|
+
exports.default = {
|
|
27
32
|
FIRST_KEY_INDEX: undefined,
|
|
28
33
|
IS_READ_ONLY: true,
|
|
29
34
|
transformArguments: transformMRangeArguments.bind(undefined, 'TS.MRANGE'),
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformMRangeWithLabelsArguments = void 0;
|
|
4
|
+
const MRANGE_1 = require("./MRANGE");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const MGET_1 = require("./MGET");
|
|
7
|
+
const RANGE_1 = require("./RANGE");
|
|
8
|
+
function transformMRangeWithLabelsArguments(command, fromTimestamp, toTimestamp, filter, options) {
|
|
9
|
+
let args = (0, RANGE_1.pushRangeArguments)([command], fromTimestamp, toTimestamp, options);
|
|
10
|
+
args = (0, _1.pushWithLabelsArgument)(args, options?.SELECTED_LABELS);
|
|
11
|
+
args = (0, MGET_1.pushFilterArgument)(args, filter);
|
|
12
|
+
return (0, MRANGE_1.pushGroupByArgument)(args, options?.GROUPBY);
|
|
10
13
|
}
|
|
11
|
-
|
|
14
|
+
exports.transformMRangeWithLabelsArguments = transformMRangeWithLabelsArguments;
|
|
15
|
+
exports.default = {
|
|
12
16
|
FIRST_KEY_INDEX: undefined,
|
|
13
17
|
IS_READ_ONLY: true,
|
|
14
18
|
transformArguments: transformMRangeWithLabelsArguments.bind(undefined, 'TS.MRANGE'),
|
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const MRANGE_1 = __importStar(require("./MRANGE"));
|
|
27
|
+
exports.default = {
|
|
28
|
+
FIRST_KEY_INDEX: MRANGE_1.default.FIRST_KEY_INDEX,
|
|
29
|
+
IS_READ_ONLY: MRANGE_1.default.IS_READ_ONLY,
|
|
30
|
+
transformArguments: MRANGE_1.transformMRangeArguments.bind(undefined, 'TS.MREVRANGE'),
|
|
31
|
+
transformReply: MRANGE_1.default.transformReply
|
|
7
32
|
};
|
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const MRANGE_WITHLABELS_1 = __importStar(require("./MRANGE_WITHLABELS"));
|
|
27
|
+
exports.default = {
|
|
28
|
+
FIRST_KEY_INDEX: MRANGE_WITHLABELS_1.default.FIRST_KEY_INDEX,
|
|
29
|
+
IS_READ_ONLY: MRANGE_WITHLABELS_1.default.IS_READ_ONLY,
|
|
30
|
+
transformArguments: MRANGE_WITHLABELS_1.transformMRangeWithLabelsArguments.bind(undefined, 'TS.MREVRANGE'),
|
|
31
|
+
transformReply: MRANGE_WITHLABELS_1.default.transformReply
|
|
7
32
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
4
|
+
exports.default = {
|
|
3
5
|
FIRST_KEY_INDEX: undefined,
|
|
4
6
|
IS_READ_ONLY: true,
|
|
5
7
|
transformArguments(filter) {
|
|
6
|
-
return pushVariadicArguments(['TS.QUERYINDEX'], filter);
|
|
8
|
+
return (0, generic_transformers_1.pushVariadicArguments)(['TS.QUERYINDEX'], filter);
|
|
7
9
|
},
|
|
8
10
|
transformReply: {
|
|
9
11
|
2: undefined,
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformRangeArguments = exports.pushRangeArguments = exports.TIME_SERIES_BUCKET_TIMESTAMP = void 0;
|
|
4
|
+
const _1 = require(".");
|
|
5
|
+
exports.TIME_SERIES_BUCKET_TIMESTAMP = {
|
|
3
6
|
LOW: '-',
|
|
4
7
|
MIDDLE: '~',
|
|
5
8
|
END: '+'
|
|
6
9
|
};
|
|
7
|
-
|
|
8
|
-
args.push(transformTimestampArgument(fromTimestamp), transformTimestampArgument(toTimestamp));
|
|
10
|
+
function pushRangeArguments(args, fromTimestamp, toTimestamp, options) {
|
|
11
|
+
args.push((0, _1.transformTimestampArgument)(fromTimestamp), (0, _1.transformTimestampArgument)(toTimestamp));
|
|
9
12
|
if (options?.LATEST) {
|
|
10
13
|
args.push('LATEST');
|
|
11
14
|
}
|
|
12
15
|
if (options?.FILTER_BY_TS) {
|
|
13
16
|
args.push('FILTER_BY_TS');
|
|
14
17
|
for (const timestamp of options.FILTER_BY_TS) {
|
|
15
|
-
args.push(transformTimestampArgument(timestamp));
|
|
18
|
+
args.push((0, _1.transformTimestampArgument)(timestamp));
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
if (options?.FILTER_BY_VALUE) {
|
|
@@ -23,9 +26,9 @@ export function pushRangeArguments(args, fromTimestamp, toTimestamp, options) {
|
|
|
23
26
|
}
|
|
24
27
|
if (options?.AGGREGATION) {
|
|
25
28
|
if (options?.ALIGN !== undefined) {
|
|
26
|
-
args.push('ALIGN', transformTimestampArgument(options.ALIGN));
|
|
29
|
+
args.push('ALIGN', (0, _1.transformTimestampArgument)(options.ALIGN));
|
|
27
30
|
}
|
|
28
|
-
args.push('AGGREGATION', options.AGGREGATION.type, transformTimestampArgument(options.AGGREGATION.timeBucket));
|
|
31
|
+
args.push('AGGREGATION', options.AGGREGATION.type, (0, _1.transformTimestampArgument)(options.AGGREGATION.timeBucket));
|
|
29
32
|
if (options.AGGREGATION.BUCKETTIMESTAMP) {
|
|
30
33
|
args.push('BUCKETTIMESTAMP', options.AGGREGATION.BUCKETTIMESTAMP);
|
|
31
34
|
}
|
|
@@ -35,19 +38,21 @@ export function pushRangeArguments(args, fromTimestamp, toTimestamp, options) {
|
|
|
35
38
|
}
|
|
36
39
|
return args;
|
|
37
40
|
}
|
|
38
|
-
|
|
41
|
+
exports.pushRangeArguments = pushRangeArguments;
|
|
42
|
+
function transformRangeArguments(command, key, fromTimestamp, toTimestamp, options) {
|
|
39
43
|
return pushRangeArguments([command, key], fromTimestamp, toTimestamp, options);
|
|
40
44
|
}
|
|
41
|
-
|
|
45
|
+
exports.transformRangeArguments = transformRangeArguments;
|
|
46
|
+
exports.default = {
|
|
42
47
|
FIRST_KEY_INDEX: 1,
|
|
43
48
|
IS_READ_ONLY: true,
|
|
44
49
|
transformArguments: transformRangeArguments.bind(undefined, 'TS.RANGE'),
|
|
45
50
|
transformReply: {
|
|
46
51
|
2(reply) {
|
|
47
|
-
return reply.map(sample => transformSampleReply['2'](sample));
|
|
52
|
+
return reply.map(sample => _1.transformSampleReply['2'](sample));
|
|
48
53
|
},
|
|
49
54
|
3(reply) {
|
|
50
|
-
return reply.map(sample => transformSampleReply['3'](sample));
|
|
55
|
+
return reply.map(sample => _1.transformSampleReply['3'](sample));
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
};
|
|
@@ -1,7 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const RANGE_1 = __importStar(require("./RANGE"));
|
|
27
|
+
exports.default = {
|
|
28
|
+
FIRST_KEY_INDEX: RANGE_1.default.FIRST_KEY_INDEX,
|
|
29
|
+
IS_READ_ONLY: RANGE_1.default.IS_READ_ONLY,
|
|
30
|
+
transformArguments: RANGE_1.transformRangeArguments.bind(undefined, 'TS.REVRANGE'),
|
|
31
|
+
transformReply: RANGE_1.default.transformReply
|
|
7
32
|
};
|
|
@@ -1,89 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pushWithLabelsArgument = exports.transformSampleReply = exports.pushLabelsArgument = exports.transformTimestampArgument = exports.pushDuplicatePolicy = exports.TIME_SERIES_DUPLICATE_POLICIES = exports.pushChunkSizeArgument = exports.pushEncodingArgument = exports.TIME_SERIES_ENCODING = exports.pushRetentionArgument = void 0;
|
|
7
|
+
const ADD_1 = __importDefault(require("./ADD"));
|
|
8
|
+
const ALTER_1 = __importDefault(require("./ALTER"));
|
|
9
|
+
const CREATE_1 = __importDefault(require("./CREATE"));
|
|
10
|
+
const CREATERULE_1 = __importDefault(require("./CREATERULE"));
|
|
11
|
+
const DECRBY_1 = __importDefault(require("./DECRBY"));
|
|
12
|
+
const DEL_1 = __importDefault(require("./DEL"));
|
|
13
|
+
const DELETERULE_1 = __importDefault(require("./DELETERULE"));
|
|
14
|
+
const GET_1 = __importDefault(require("./GET"));
|
|
15
|
+
const INCRBY_1 = __importDefault(require("./INCRBY"));
|
|
10
16
|
// import INFO_DEBUG from './INFO_DEBUG';
|
|
11
17
|
// import INFO from './INFO';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ADD,
|
|
25
|
-
add:
|
|
26
|
-
ALTER,
|
|
27
|
-
alter:
|
|
28
|
-
CREATE,
|
|
29
|
-
create:
|
|
30
|
-
CREATERULE,
|
|
31
|
-
createRule:
|
|
32
|
-
DECRBY,
|
|
33
|
-
decrBy:
|
|
34
|
-
DEL,
|
|
35
|
-
del:
|
|
36
|
-
DELETERULE,
|
|
37
|
-
deleteRule:
|
|
38
|
-
GET,
|
|
39
|
-
get:
|
|
40
|
-
INCRBY,
|
|
41
|
-
incrBy:
|
|
18
|
+
const MADD_1 = __importDefault(require("./MADD"));
|
|
19
|
+
const MGET_WITHLABELS_1 = __importDefault(require("./MGET_WITHLABELS"));
|
|
20
|
+
const MGET_1 = __importDefault(require("./MGET"));
|
|
21
|
+
const MRANGE_WITHLABELS_1 = __importDefault(require("./MRANGE_WITHLABELS"));
|
|
22
|
+
const MRANGE_1 = __importDefault(require("./MRANGE"));
|
|
23
|
+
const MREVRANGE_WITHLABELS_1 = __importDefault(require("./MREVRANGE_WITHLABELS"));
|
|
24
|
+
const MREVRANGE_1 = __importDefault(require("./MREVRANGE"));
|
|
25
|
+
const QUERYINDEX_1 = __importDefault(require("./QUERYINDEX"));
|
|
26
|
+
const RANGE_1 = __importDefault(require("./RANGE"));
|
|
27
|
+
const REVRANGE_1 = __importDefault(require("./REVRANGE"));
|
|
28
|
+
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
29
|
+
exports.default = {
|
|
30
|
+
ADD: ADD_1.default,
|
|
31
|
+
add: ADD_1.default,
|
|
32
|
+
ALTER: ALTER_1.default,
|
|
33
|
+
alter: ALTER_1.default,
|
|
34
|
+
CREATE: CREATE_1.default,
|
|
35
|
+
create: CREATE_1.default,
|
|
36
|
+
CREATERULE: CREATERULE_1.default,
|
|
37
|
+
createRule: CREATERULE_1.default,
|
|
38
|
+
DECRBY: DECRBY_1.default,
|
|
39
|
+
decrBy: DECRBY_1.default,
|
|
40
|
+
DEL: DEL_1.default,
|
|
41
|
+
del: DEL_1.default,
|
|
42
|
+
DELETERULE: DELETERULE_1.default,
|
|
43
|
+
deleteRule: DELETERULE_1.default,
|
|
44
|
+
GET: GET_1.default,
|
|
45
|
+
get: GET_1.default,
|
|
46
|
+
INCRBY: INCRBY_1.default,
|
|
47
|
+
incrBy: INCRBY_1.default,
|
|
42
48
|
// INFO_DEBUG,
|
|
43
49
|
// infoDebug: INFO_DEBUG,
|
|
44
50
|
// INFO,
|
|
45
51
|
// info: INFO,
|
|
46
|
-
MADD,
|
|
47
|
-
mAdd:
|
|
48
|
-
MGET_WITHLABELS,
|
|
49
|
-
mGetWithLabels:
|
|
50
|
-
MGET,
|
|
51
|
-
mGet:
|
|
52
|
-
MRANGE_WITHLABELS,
|
|
53
|
-
mRangeWithLabels:
|
|
54
|
-
MRANGE,
|
|
55
|
-
mRange:
|
|
56
|
-
MREVRANGE_WITHLABELS,
|
|
57
|
-
mRevRangeWithLabels:
|
|
58
|
-
MREVRANGE,
|
|
59
|
-
mRevRange:
|
|
60
|
-
QUERYINDEX,
|
|
61
|
-
queryIndex:
|
|
62
|
-
RANGE,
|
|
63
|
-
range:
|
|
64
|
-
REVRANGE,
|
|
65
|
-
revRange:
|
|
52
|
+
MADD: MADD_1.default,
|
|
53
|
+
mAdd: MADD_1.default,
|
|
54
|
+
MGET_WITHLABELS: MGET_WITHLABELS_1.default,
|
|
55
|
+
mGetWithLabels: MGET_WITHLABELS_1.default,
|
|
56
|
+
MGET: MGET_1.default,
|
|
57
|
+
mGet: MGET_1.default,
|
|
58
|
+
MRANGE_WITHLABELS: MRANGE_WITHLABELS_1.default,
|
|
59
|
+
mRangeWithLabels: MRANGE_WITHLABELS_1.default,
|
|
60
|
+
MRANGE: MRANGE_1.default,
|
|
61
|
+
mRange: MRANGE_1.default,
|
|
62
|
+
MREVRANGE_WITHLABELS: MREVRANGE_WITHLABELS_1.default,
|
|
63
|
+
mRevRangeWithLabels: MREVRANGE_WITHLABELS_1.default,
|
|
64
|
+
MREVRANGE: MREVRANGE_1.default,
|
|
65
|
+
mRevRange: MREVRANGE_1.default,
|
|
66
|
+
QUERYINDEX: QUERYINDEX_1.default,
|
|
67
|
+
queryIndex: QUERYINDEX_1.default,
|
|
68
|
+
RANGE: RANGE_1.default,
|
|
69
|
+
range: RANGE_1.default,
|
|
70
|
+
REVRANGE: REVRANGE_1.default,
|
|
71
|
+
revRange: REVRANGE_1.default
|
|
66
72
|
};
|
|
67
|
-
|
|
73
|
+
function pushRetentionArgument(args, retention) {
|
|
68
74
|
if (retention !== undefined) {
|
|
69
75
|
args.push('RETENTION', retention.toString());
|
|
70
76
|
}
|
|
71
77
|
}
|
|
72
|
-
|
|
78
|
+
exports.pushRetentionArgument = pushRetentionArgument;
|
|
79
|
+
exports.TIME_SERIES_ENCODING = {
|
|
73
80
|
COMPRESSED: 'COMPRESSED',
|
|
74
81
|
UNCOMPRESSED: 'UNCOMPRESSED'
|
|
75
82
|
};
|
|
76
|
-
|
|
83
|
+
function pushEncodingArgument(args, encoding) {
|
|
77
84
|
if (encoding !== undefined) {
|
|
78
85
|
args.push('ENCODING', encoding);
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
|
-
|
|
88
|
+
exports.pushEncodingArgument = pushEncodingArgument;
|
|
89
|
+
function pushChunkSizeArgument(args, chunkSize) {
|
|
82
90
|
if (chunkSize !== undefined) {
|
|
83
91
|
args.push('CHUNK_SIZE', chunkSize.toString());
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
|
-
|
|
94
|
+
exports.pushChunkSizeArgument = pushChunkSizeArgument;
|
|
95
|
+
exports.TIME_SERIES_DUPLICATE_POLICIES = {
|
|
87
96
|
BLOCK: 'BLOCK',
|
|
88
97
|
FIRST: 'FIRST',
|
|
89
98
|
LAST: 'LAST',
|
|
@@ -91,19 +100,21 @@ export const TIME_SERIES_DUPLICATE_POLICIES = {
|
|
|
91
100
|
MAX: 'MAX',
|
|
92
101
|
SUM: 'SUM'
|
|
93
102
|
};
|
|
94
|
-
|
|
103
|
+
function pushDuplicatePolicy(args, duplicatePolicy) {
|
|
95
104
|
if (duplicatePolicy !== undefined) {
|
|
96
105
|
args.push('DUPLICATE_POLICY', duplicatePolicy);
|
|
97
106
|
}
|
|
98
107
|
}
|
|
99
|
-
|
|
108
|
+
exports.pushDuplicatePolicy = pushDuplicatePolicy;
|
|
109
|
+
function transformTimestampArgument(timestamp) {
|
|
100
110
|
if (typeof timestamp === 'string')
|
|
101
111
|
return timestamp;
|
|
102
112
|
return (typeof timestamp === 'number' ?
|
|
103
113
|
timestamp :
|
|
104
114
|
timestamp.getTime()).toString();
|
|
105
115
|
}
|
|
106
|
-
|
|
116
|
+
exports.transformTimestampArgument = transformTimestampArgument;
|
|
117
|
+
function pushLabelsArgument(args, labels) {
|
|
107
118
|
if (labels) {
|
|
108
119
|
args.push('LABELS');
|
|
109
120
|
for (const [label, value] of Object.entries(labels)) {
|
|
@@ -112,7 +123,8 @@ export function pushLabelsArgument(args, labels) {
|
|
|
112
123
|
}
|
|
113
124
|
return args;
|
|
114
125
|
}
|
|
115
|
-
|
|
126
|
+
exports.pushLabelsArgument = pushLabelsArgument;
|
|
127
|
+
exports.transformSampleReply = {
|
|
116
128
|
2(reply) {
|
|
117
129
|
const [timestamp, value] = reply;
|
|
118
130
|
return {
|
|
@@ -128,13 +140,14 @@ export const transformSampleReply = {
|
|
|
128
140
|
};
|
|
129
141
|
}
|
|
130
142
|
};
|
|
131
|
-
|
|
143
|
+
function pushWithLabelsArgument(args, selectedLabels) {
|
|
132
144
|
if (!selectedLabels) {
|
|
133
145
|
args.push('WITHLABELS');
|
|
134
146
|
return args;
|
|
135
147
|
}
|
|
136
148
|
else {
|
|
137
149
|
args.push('SELECTED_LABELS');
|
|
138
|
-
return pushVariadicArguments(args, selectedLabels);
|
|
150
|
+
return (0, generic_transformers_1.pushVariadicArguments)(args, selectedLabels);
|
|
139
151
|
}
|
|
140
152
|
}
|
|
153
|
+
exports.pushWithLabelsArgument = pushWithLabelsArgument;
|
package/dist/lib/index.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TIME_SERIES_BUCKET_TIMESTAMP = exports.TIME_SERIES_AGGREGATION_TYPE = exports.TIME_SERIES_DUPLICATE_POLICIES = exports.TIME_SERIES_ENCODING = exports.default = void 0;
|
|
7
|
+
var commands_1 = require("./commands");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(commands_1).default; } });
|
|
9
|
+
Object.defineProperty(exports, "TIME_SERIES_ENCODING", { enumerable: true, get: function () { return commands_1.TIME_SERIES_ENCODING; } });
|
|
10
|
+
Object.defineProperty(exports, "TIME_SERIES_DUPLICATE_POLICIES", { enumerable: true, get: function () { return commands_1.TIME_SERIES_DUPLICATE_POLICIES; } });
|
|
11
|
+
var CREATERULE_1 = require("./commands/CREATERULE");
|
|
12
|
+
Object.defineProperty(exports, "TIME_SERIES_AGGREGATION_TYPE", { enumerable: true, get: function () { return CREATERULE_1.TIME_SERIES_AGGREGATION_TYPE; } });
|
|
13
|
+
var RANGE_1 = require("./commands/RANGE");
|
|
14
|
+
Object.defineProperty(exports, "TIME_SERIES_BUCKET_TIMESTAMP", { enumerable: true, get: function () { return RANGE_1.TIME_SERIES_BUCKET_TIMESTAMP; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis/time-series",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"test": "nyc -r text-summary -r lcov mocha -r tsx './lib/**/*.spec.ts'"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@redis/client": "^2.0.0-next.
|
|
15
|
+
"@redis/client": "^2.0.0-next.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@redis/test-utils": "*"
|