ioredis 4.12.2 → 4.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog.md CHANGED
@@ -1,3 +1,36 @@
1
+ ## [4.14.1](https://github.com/luin/ioredis/compare/v4.14.0...v4.14.1) (2019-08-27)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * don’t clobber passed-in tls options with rediss:/ URLs ([#949](https://github.com/luin/ioredis/issues/949)) ([ceefcfa](https://github.com/luin/ioredis/commit/ceefcfa)), closes [#942](https://github.com/luin/ioredis/issues/942) [#940](https://github.com/luin/ioredis/issues/940) [#950](https://github.com/luin/ioredis/issues/950) [#948](https://github.com/luin/ioredis/issues/948)
7
+
8
+ # [4.14.0](https://github.com/luin/ioredis/compare/v4.13.1...v4.14.0) (2019-07-31)
9
+
10
+
11
+ ### Features
12
+
13
+ * support rediss:// URL ([371bb9c](https://github.com/luin/ioredis/commit/371bb9c))
14
+
15
+ ## [4.13.1](https://github.com/luin/ioredis/compare/v4.13.0...v4.13.1) (2019-07-22)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * keep sentinels of options immutable ([bacb7e1](https://github.com/luin/ioredis/commit/bacb7e1)), closes [#936](https://github.com/luin/ioredis/issues/936)
21
+
22
+ # [4.13.0](https://github.com/luin/ioredis/compare/v4.12.2...v4.13.0) (2019-07-19)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **cluster:** suppress errors emitted from internal clients ([9a113ca](https://github.com/luin/ioredis/commit/9a113ca)), closes [#896](https://github.com/luin/ioredis/issues/896) [#899](https://github.com/luin/ioredis/issues/899)
28
+
29
+
30
+ ### Features
31
+
32
+ * **cluster:** support binary keys ([b414ed9](https://github.com/luin/ioredis/commit/b414ed9)), closes [#637](https://github.com/luin/ioredis/issues/637)
33
+
1
34
  ## [4.12.2](https://github.com/luin/ioredis/compare/v4.12.1...v4.12.2) (2019-07-16)
2
35
 
3
36
 
package/README.md CHANGED
@@ -120,7 +120,7 @@ new Redis({
120
120
  });
121
121
  ```
122
122
 
123
- You can also specify connection options as a [`redis://` URL](http://www.iana.org/assignments/uri-schemes/prov/redis):
123
+ You can also specify connection options as a [`redis://` URL](http://www.iana.org/assignments/uri-schemes/prov/redis) or [`rediss://` URL](https://www.iana.org/assignments/uri-schemes/prov/rediss) when using [TLS encryption](#tls-options):
124
124
 
125
125
  ```javascript
126
126
  // Connect to 127.0.0.1:6380, db 4, using password "authpassword":
@@ -703,6 +703,12 @@ var redis = new Redis({
703
703
  });
704
704
  ```
705
705
 
706
+ Alternatively, specify the connection through a [`rediss://` URL](https://www.iana.org/assignments/uri-schemes/prov/rediss).
707
+
708
+ ```javascript
709
+ var redis = new Redis("rediss://redis.my-service.com");
710
+ ```
711
+
706
712
  <hr>
707
713
 
708
714
  ## Sentinel
@@ -614,6 +614,9 @@ class Cluster extends events_1.EventEmitter {
614
614
  retryStrategy: null,
615
615
  connectionName: "ioredisClusterRefresher"
616
616
  });
617
+ // Ignore error events since we will handle
618
+ // exceptions for the CLUSTER SLOTS command.
619
+ duplicatedConnection.on("error", utils_1.noop);
617
620
  duplicatedConnection.cluster("slots", utils_2.timeout((err, result) => {
618
621
  duplicatedConnection.disconnect();
619
622
  if (err) {
@@ -6,8 +6,8 @@ function isSentinelEql(a, b) {
6
6
  }
7
7
  class SentinelIterator {
8
8
  constructor(sentinels) {
9
- this.sentinels = sentinels;
10
9
  this.cursor = 0;
10
+ this.sentinels = sentinels.slice(0);
11
11
  }
12
12
  next() {
13
13
  const done = this.cursor >= this.sentinels.length;
@@ -106,6 +106,7 @@ var debug = utils_1.Debug("redis");
106
106
  * var unixSocketRedis2 = new Redis('/tmp/echo.sock');
107
107
  * var urlRedis = new Redis('redis://user:password@redis-service.com:6379/');
108
108
  * var urlRedis2 = new Redis('//localhost:6379');
109
+ * var urlRedisTls = new Redis('rediss://user:password@redis-service.com:6379/');
109
110
  * var authedRedis = new Redis(6380, '192.168.100.1', { password: 'password' });
110
111
  * ```
111
112
  */
@@ -165,6 +166,7 @@ Redis.prototype.resetOfflineQueue = function () {
165
166
  };
166
167
  Redis.prototype.parseOptions = function () {
167
168
  this.options = {};
169
+ let isTls = false;
168
170
  for (var i = 0; i < arguments.length; ++i) {
169
171
  var arg = arguments[i];
170
172
  if (arg === null || typeof arg === "undefined") {
@@ -175,6 +177,9 @@ Redis.prototype.parseOptions = function () {
175
177
  }
176
178
  else if (typeof arg === "string") {
177
179
  lodash_1.defaults(this.options, utils_1.parseURL(arg));
180
+ if (arg.startsWith("rediss://")) {
181
+ isTls = true;
182
+ }
178
183
  }
179
184
  else if (typeof arg === "number") {
180
185
  this.options.port = arg;
@@ -183,6 +188,9 @@ Redis.prototype.parseOptions = function () {
183
188
  throw new Error("Invalid argument " + arg);
184
189
  }
185
190
  }
191
+ if (isTls) {
192
+ lodash_1.defaults(this.options, { tls: true });
193
+ }
186
194
  lodash_1.defaults(this.options, Redis.defaultOptions);
187
195
  if (typeof this.options.port === "string") {
188
196
  this.options.port = parseInt(this.options.port, 10);
@@ -259,7 +259,7 @@ function parseURL(url) {
259
259
  result.password = parsed.auth.split(":")[1];
260
260
  }
261
261
  if (parsed.pathname) {
262
- if (parsed.protocol === "redis:") {
262
+ if (parsed.protocol === "redis:" || parsed.protocol === "rediss:") {
263
263
  if (parsed.pathname.length > 1) {
264
264
  result.db = parsed.pathname.slice(1);
265
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ioredis",
3
- "version": "4.12.2",
3
+ "version": "4.14.1",
4
4
  "description": "A robust, performance-focused and full-featured Redis client for Node.js.",
5
5
  "main": "built/index.js",
6
6
  "files": [
@@ -30,7 +30,7 @@
30
30
  "author": "luin <i@zihua.li> (http://zihua.li)",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "cluster-key-slot": "^1.0.6",
33
+ "cluster-key-slot": "^1.1.0",
34
34
  "debug": "^4.1.1",
35
35
  "denque": "^1.1.0",
36
36
  "lodash.defaults": "^4.2.0",