@redis/time-series 1.0.4 → 1.1.0

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.
@@ -1,10 +1,15 @@
1
1
  import { TimeSeriesEncoding, TimeSeriesDuplicatePolicies, Labels, Timestamp } from '.';
2
+ export interface TsIgnoreOptions {
3
+ MAX_TIME_DIFF: number;
4
+ MAX_VAL_DIFF: number;
5
+ }
2
6
  interface AddOptions {
3
7
  RETENTION?: number;
4
8
  ENCODING?: TimeSeriesEncoding;
5
9
  CHUNK_SIZE?: number;
6
10
  ON_DUPLICATE?: TimeSeriesDuplicatePolicies;
7
11
  LABELS?: Labels;
12
+ IGNORE?: TsIgnoreOptions;
8
13
  }
9
14
  export declare const FIRST_KEY_INDEX = 1;
10
15
  export declare function transformArguments(key: string, timestamp: Timestamp, value: number, options?: AddOptions): Array<string>;
@@ -17,6 +17,7 @@ function transformArguments(key, timestamp, value, options) {
17
17
  args.push('ON_DUPLICATE', options.ON_DUPLICATE);
18
18
  }
19
19
  (0, _1.pushLabelsArgument)(args, options?.LABELS);
20
+ (0, _1.pushIgnoreArgument)(args, options?.IGNORE);
20
21
  return args;
21
22
  }
22
23
  exports.transformArguments = transformArguments;
@@ -1,10 +1,12 @@
1
1
  import { Labels, TimeSeriesDuplicatePolicies } from '.';
2
+ import { TsIgnoreOptions } from './ADD';
2
3
  export declare const FIRST_KEY_INDEX = 1;
3
4
  interface AlterOptions {
4
5
  RETENTION?: number;
5
6
  CHUNK_SIZE?: number;
6
7
  DUPLICATE_POLICY?: TimeSeriesDuplicatePolicies;
7
8
  LABELS?: Labels;
9
+ IGNORE?: TsIgnoreOptions;
8
10
  }
9
11
  export declare function transformArguments(key: string, options?: AlterOptions): Array<string>;
10
12
  export declare function transformReply(): 'OK';
@@ -9,6 +9,7 @@ function transformArguments(key, options) {
9
9
  (0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
10
10
  (0, _1.pushDuplicatePolicy)(args, options?.DUPLICATE_POLICY);
11
11
  (0, _1.pushLabelsArgument)(args, options?.LABELS);
12
+ (0, _1.pushIgnoreArgument)(args, options?.IGNORE);
12
13
  return args;
13
14
  }
14
15
  exports.transformArguments = transformArguments;
@@ -1,4 +1,5 @@
1
1
  import { TimeSeriesEncoding, TimeSeriesDuplicatePolicies, Labels } from '.';
2
+ import { TsIgnoreOptions } from './ADD';
2
3
  export declare const FIRST_KEY_INDEX = 1;
3
4
  interface CreateOptions {
4
5
  RETENTION?: number;
@@ -6,6 +7,7 @@ interface CreateOptions {
6
7
  CHUNK_SIZE?: number;
7
8
  DUPLICATE_POLICY?: TimeSeriesDuplicatePolicies;
8
9
  LABELS?: Labels;
10
+ IGNORE?: TsIgnoreOptions;
9
11
  }
10
12
  export declare function transformArguments(key: string, options?: CreateOptions): Array<string>;
11
13
  export declare function transformReply(): 'OK';
@@ -10,6 +10,7 @@ function transformArguments(key, options) {
10
10
  (0, _1.pushChunkSizeArgument)(args, options?.CHUNK_SIZE);
11
11
  (0, _1.pushDuplicatePolicy)(args, options?.DUPLICATE_POLICY);
12
12
  (0, _1.pushLabelsArgument)(args, options?.LABELS);
13
+ (0, _1.pushIgnoreArgument)(args, options?.IGNORE);
13
14
  return args;
14
15
  }
15
16
  exports.transformArguments = transformArguments;
@@ -2,7 +2,7 @@ import { TimeSeriesAggregationType, TimeSeriesDuplicatePolicies } from '.';
2
2
  export declare const FIRST_KEY_INDEX = 1;
3
3
  export declare const IS_READ_ONLY = true;
4
4
  export declare function transformArguments(key: string): Array<string>;
5
- export declare type InfoRawReply = [
5
+ export type InfoRawReply = [
6
6
  'totalSamples',
7
7
  number,
8
8
  'memoryUsage',
@@ -1,7 +1,7 @@
1
1
  import { InfoRawReply, InfoReply } from './INFO';
2
2
  export { IS_READ_ONLY, FIRST_KEY_INDEX } from './INFO';
3
3
  export declare function transformArguments(key: string): Array<string>;
4
- declare type InfoDebugRawReply = [
4
+ type InfoDebugRawReply = [
5
5
  ...InfoRawReply,
6
6
  'keySelfName',
7
7
  string,
@@ -5,7 +5,7 @@ export interface MGetOptions {
5
5
  LATEST?: boolean;
6
6
  }
7
7
  export declare function transformArguments(filter: Filter, options?: MGetOptions): RedisCommandArguments;
8
- export declare type MGetRawReply = Array<[
8
+ export type MGetRawReply = Array<[
9
9
  key: string,
10
10
  labels: RawLabels,
11
11
  sample: SampleRawReply
@@ -105,8 +105,9 @@ export declare enum TimeSeriesReducers {
105
105
  VAR_P = "VAR.P",
106
106
  VAR_S = "VAR.S"
107
107
  }
108
- export declare type Timestamp = number | Date | string;
108
+ export type Timestamp = number | Date | string;
109
109
  export declare function transformTimestampArgument(timestamp: Timestamp): string;
110
+ export declare function pushIgnoreArgument(args: RedisCommandArguments, ignore?: ADD.TsIgnoreOptions): void;
110
111
  export declare function pushRetentionArgument(args: RedisCommandArguments, retention?: number): RedisCommandArguments;
111
112
  export declare enum TimeSeriesEncoding {
112
113
  COMPRESSED = "COMPRESSED",
@@ -115,8 +116,8 @@ export declare enum TimeSeriesEncoding {
115
116
  export declare function pushEncodingArgument(args: RedisCommandArguments, encoding?: TimeSeriesEncoding): RedisCommandArguments;
116
117
  export declare function pushChunkSizeArgument(args: RedisCommandArguments, chunkSize?: number): RedisCommandArguments;
117
118
  export declare function pushDuplicatePolicy(args: RedisCommandArguments, duplicatePolicy?: TimeSeriesDuplicatePolicies): RedisCommandArguments;
118
- export declare type RawLabels = Array<[label: string, value: string]>;
119
- export declare type Labels = {
119
+ export type RawLabels = Array<[label: string, value: string]>;
120
+ export type Labels = {
120
121
  [label: string]: string;
121
122
  };
122
123
  export declare function transformLablesReply(reply: RawLabels): Labels;
@@ -129,7 +130,7 @@ export interface IncrDecrOptions {
129
130
  LABELS?: Labels;
130
131
  }
131
132
  export declare function transformIncrDecrArguments(command: 'TS.INCRBY' | 'TS.DECRBY', key: string, value: number, options?: IncrDecrOptions): RedisCommandArguments;
132
- export declare type SampleRawReply = [timestamp: number, value: string];
133
+ export type SampleRawReply = [timestamp: number, value: string];
133
134
  export interface SampleReply {
134
135
  timestamp: number;
135
136
  value: number;
@@ -162,20 +163,20 @@ interface MRangeGroupBy {
162
163
  reducer: TimeSeriesReducers;
163
164
  }
164
165
  export declare function pushMRangeGroupByArguments(args: RedisCommandArguments, groupBy?: MRangeGroupBy): RedisCommandArguments;
165
- export declare type Filter = string | Array<string>;
166
+ export type Filter = string | Array<string>;
166
167
  export declare function pushFilterArgument(args: RedisCommandArguments, filter: string | Array<string>): RedisCommandArguments;
167
168
  export interface MRangeOptions extends RangeOptions {
168
169
  GROUPBY?: MRangeGroupBy;
169
170
  }
170
171
  export declare function pushMRangeArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: Filter, options?: MRangeOptions): RedisCommandArguments;
171
- export declare type SelectedLabels = string | Array<string>;
172
+ export type SelectedLabels = string | Array<string>;
172
173
  export declare function pushWithLabelsArgument(args: RedisCommandArguments, selectedLabels?: SelectedLabels): RedisCommandArguments;
173
174
  export interface MRangeWithLabelsOptions extends MRangeOptions {
174
175
  SELECTED_LABELS?: SelectedLabels;
175
176
  }
176
177
  export declare function pushMRangeWithLabelsArguments(args: RedisCommandArguments, fromTimestamp: Timestamp, toTimestamp: Timestamp, filter: Filter, options?: MRangeWithLabelsOptions): RedisCommandArguments;
177
178
  export declare function transformRangeReply(reply: Array<SampleRawReply>): Array<SampleReply>;
178
- declare type MRangeRawReply = Array<[
179
+ type MRangeRawReply = Array<[
179
180
  key: string,
180
181
  labels: RawLabels,
181
182
  samples: Array<SampleRawReply>
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pushLatestArgument = exports.transformMRangeWithLabelsReply = exports.transformMRangeReply = exports.transformRangeReply = exports.pushMRangeWithLabelsArguments = exports.pushWithLabelsArgument = exports.pushMRangeArguments = exports.pushFilterArgument = exports.pushMRangeGroupByArguments = exports.pushRangeArguments = exports.TimeSeriesBucketTimestamp = exports.transformSampleReply = exports.transformIncrDecrArguments = exports.pushLabelsArgument = exports.transformLablesReply = exports.pushDuplicatePolicy = exports.pushChunkSizeArgument = exports.pushEncodingArgument = exports.TimeSeriesEncoding = exports.pushRetentionArgument = exports.transformTimestampArgument = exports.TimeSeriesReducers = exports.TimeSeriesDuplicatePolicies = exports.TimeSeriesAggregationType = void 0;
3
+ exports.pushLatestArgument = exports.transformMRangeWithLabelsReply = exports.transformMRangeReply = exports.transformRangeReply = exports.pushMRangeWithLabelsArguments = exports.pushWithLabelsArgument = exports.pushMRangeArguments = exports.pushFilterArgument = exports.pushMRangeGroupByArguments = exports.pushRangeArguments = exports.TimeSeriesBucketTimestamp = exports.transformSampleReply = exports.transformIncrDecrArguments = exports.pushLabelsArgument = exports.transformLablesReply = exports.pushDuplicatePolicy = exports.pushChunkSizeArgument = exports.pushEncodingArgument = exports.TimeSeriesEncoding = exports.pushRetentionArgument = exports.pushIgnoreArgument = exports.transformTimestampArgument = exports.TimeSeriesReducers = exports.TimeSeriesDuplicatePolicies = exports.TimeSeriesAggregationType = void 0;
4
4
  const ADD = require("./ADD");
5
5
  const ALTER = require("./ALTER");
6
6
  const CREATE = require("./CREATE");
@@ -88,7 +88,7 @@ var TimeSeriesAggregationType;
88
88
  TimeSeriesAggregationType["VAR_P"] = "VAR.P";
89
89
  TimeSeriesAggregationType["VAR_S"] = "VAR.S";
90
90
  TimeSeriesAggregationType["TWA"] = "TWA";
91
- })(TimeSeriesAggregationType = exports.TimeSeriesAggregationType || (exports.TimeSeriesAggregationType = {}));
91
+ })(TimeSeriesAggregationType || (exports.TimeSeriesAggregationType = TimeSeriesAggregationType = {}));
92
92
  var TimeSeriesDuplicatePolicies;
93
93
  (function (TimeSeriesDuplicatePolicies) {
94
94
  TimeSeriesDuplicatePolicies["BLOCK"] = "BLOCK";
@@ -97,7 +97,7 @@ var TimeSeriesDuplicatePolicies;
97
97
  TimeSeriesDuplicatePolicies["MIN"] = "MIN";
98
98
  TimeSeriesDuplicatePolicies["MAX"] = "MAX";
99
99
  TimeSeriesDuplicatePolicies["SUM"] = "SUM";
100
- })(TimeSeriesDuplicatePolicies = exports.TimeSeriesDuplicatePolicies || (exports.TimeSeriesDuplicatePolicies = {}));
100
+ })(TimeSeriesDuplicatePolicies || (exports.TimeSeriesDuplicatePolicies = TimeSeriesDuplicatePolicies = {}));
101
101
  var TimeSeriesReducers;
102
102
  (function (TimeSeriesReducers) {
103
103
  TimeSeriesReducers["AVG"] = "AVG";
@@ -114,7 +114,7 @@ var TimeSeriesReducers;
114
114
  TimeSeriesReducers["STD_S"] = "STD.S";
115
115
  TimeSeriesReducers["VAR_P"] = "VAR.P";
116
116
  TimeSeriesReducers["VAR_S"] = "VAR.S";
117
- })(TimeSeriesReducers = exports.TimeSeriesReducers || (exports.TimeSeriesReducers = {}));
117
+ })(TimeSeriesReducers || (exports.TimeSeriesReducers = TimeSeriesReducers = {}));
118
118
  function transformTimestampArgument(timestamp) {
119
119
  if (typeof timestamp === 'string')
120
120
  return timestamp;
@@ -123,8 +123,14 @@ function transformTimestampArgument(timestamp) {
123
123
  timestamp.getTime()).toString();
124
124
  }
125
125
  exports.transformTimestampArgument = transformTimestampArgument;
126
+ function pushIgnoreArgument(args, ignore) {
127
+ if (ignore !== undefined) {
128
+ args.push('IGNORE', ignore.MAX_TIME_DIFF.toString(), ignore.MAX_VAL_DIFF.toString());
129
+ }
130
+ }
131
+ exports.pushIgnoreArgument = pushIgnoreArgument;
126
132
  function pushRetentionArgument(args, retention) {
127
- if (retention) {
133
+ if (retention !== undefined) {
128
134
  args.push('RETENTION', retention.toString());
129
135
  }
130
136
  return args;
@@ -134,23 +140,23 @@ var TimeSeriesEncoding;
134
140
  (function (TimeSeriesEncoding) {
135
141
  TimeSeriesEncoding["COMPRESSED"] = "COMPRESSED";
136
142
  TimeSeriesEncoding["UNCOMPRESSED"] = "UNCOMPRESSED";
137
- })(TimeSeriesEncoding = exports.TimeSeriesEncoding || (exports.TimeSeriesEncoding = {}));
143
+ })(TimeSeriesEncoding || (exports.TimeSeriesEncoding = TimeSeriesEncoding = {}));
138
144
  function pushEncodingArgument(args, encoding) {
139
- if (encoding) {
145
+ if (encoding !== undefined) {
140
146
  args.push('ENCODING', encoding);
141
147
  }
142
148
  return args;
143
149
  }
144
150
  exports.pushEncodingArgument = pushEncodingArgument;
145
151
  function pushChunkSizeArgument(args, chunkSize) {
146
- if (chunkSize) {
152
+ if (chunkSize !== undefined) {
147
153
  args.push('CHUNK_SIZE', chunkSize.toString());
148
154
  }
149
155
  return args;
150
156
  }
151
157
  exports.pushChunkSizeArgument = pushChunkSizeArgument;
152
158
  function pushDuplicatePolicy(args, duplicatePolicy) {
153
- if (duplicatePolicy) {
159
+ if (duplicatePolicy !== undefined) {
154
160
  args.push('DUPLICATE_POLICY', duplicatePolicy);
155
161
  }
156
162
  return args;
@@ -204,7 +210,7 @@ var TimeSeriesBucketTimestamp;
204
210
  TimeSeriesBucketTimestamp["LOW"] = "-";
205
211
  TimeSeriesBucketTimestamp["HIGH"] = "+";
206
212
  TimeSeriesBucketTimestamp["MID"] = "~";
207
- })(TimeSeriesBucketTimestamp = exports.TimeSeriesBucketTimestamp || (exports.TimeSeriesBucketTimestamp = {}));
213
+ })(TimeSeriesBucketTimestamp || (exports.TimeSeriesBucketTimestamp = TimeSeriesBucketTimestamp = {}));
208
214
  function pushRangeArguments(args, fromTimestamp, toTimestamp, options) {
209
215
  args.push(transformTimestampArgument(fromTimestamp), transformTimestampArgument(toTimestamp));
210
216
  pushLatestArgument(args, options?.LATEST);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redis/time-series",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,12 +18,24 @@
18
18
  "devDependencies": {
19
19
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
20
20
  "@redis/test-utils": "*",
21
- "@types/node": "^18.11.6",
21
+ "@types/node": "^20.6.2",
22
22
  "nyc": "^15.1.0",
23
- "release-it": "^15.5.0",
23
+ "release-it": "^16.1.5",
24
24
  "source-map-support": "^0.5.21",
25
25
  "ts-node": "^10.9.1",
26
- "typedoc": "^0.23.18",
27
- "typescript": "^4.8.4"
28
- }
26
+ "typedoc": "^0.25.1",
27
+ "typescript": "^5.2.2"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git://github.com/redis/node-redis.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/redis/node-redis/issues"
35
+ },
36
+ "homepage": "https://github.com/redis/node-redis/tree/master/packages/time-series",
37
+ "keywords": [
38
+ "redis",
39
+ "RedisTimeSeries"
40
+ ]
29
41
  }