ioredis 4.27.7 → 4.27.11

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,32 @@
1
+ ## [4.27.11](https://github.com/luin/ioredis/compare/v4.27.10...v4.27.11) (2021-10-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * make export interface compatible with jest ([#1445](https://github.com/luin/ioredis/issues/1445)) ([2728dbe](https://github.com/luin/ioredis/commit/2728dbe5289ebc8603484bc85c01632cfab98204))
7
+
8
+ ## [4.27.10](https://github.com/luin/ioredis/compare/v4.27.9...v4.27.10) (2021-10-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **cluster:** lazyConnect with pipeline ([#1408](https://github.com/luin/ioredis/issues/1408)) ([b798107](https://github.com/luin/ioredis/commit/b798107e4123d0027ef1bdb3319cd00516221f3b))
14
+
15
+ ## [4.27.9](https://github.com/luin/ioredis/compare/v4.27.8...v4.27.9) (2021-08-30)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Fix undefined property warning in executeAutoPipeline ([#1425](https://github.com/luin/ioredis/issues/1425)) ([f898672](https://github.com/luin/ioredis/commit/f898672a29753774eeb6e166c28ed6f548533517))
21
+ * improve proto checking for hgetall [skip ci] ([#1418](https://github.com/luin/ioredis/issues/1418)) ([cba83cb](https://github.com/luin/ioredis/commit/cba83cba2dba25e59ad87c85d740f15f78e45e14))
22
+
23
+ ## [4.27.8](https://github.com/luin/ioredis/compare/v4.27.7...v4.27.8) (2021-08-18)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * handle malicious keys for hgetall ([#1416](https://github.com/luin/ioredis/issues/1416)) ([7d73b9d](https://github.com/luin/ioredis/commit/7d73b9d07b52ec077f235292aa15c7aca203bba9)), closes [#1267](https://github.com/luin/ioredis/issues/1267)
29
+
1
30
  ## [4.27.7](https://github.com/luin/ioredis/compare/v4.27.6...v4.27.7) (2021-08-01)
2
31
 
3
32
 
package/README.md CHANGED
@@ -578,7 +578,7 @@ redis.get("k3", (err, result) => {
578
578
  });
579
579
  ```
580
580
 
581
- Another useful example of a reply transformer is one that changes `hgetall` to return array of arrays instead of objects which avoids a unwanted conversation of hash keys to strings when dealing with binary hash keys:
581
+ Another useful example of a reply transformer is one that changes `hgetall` to return array of arrays instead of objects which avoids an unwanted conversation of hash keys to strings when dealing with binary hash keys:
582
582
 
583
583
  ```javascript
584
584
  Redis.Command.setReplyTransformer("hgetall", (result) => {
@@ -27,6 +27,16 @@ function executeAutoPipeline(client, slotKey) {
27
27
  if (client._runningAutoPipelines.has(slotKey)) {
28
28
  return;
29
29
  }
30
+ if (!client._autoPipelines.has(slotKey)) {
31
+ /*
32
+ Rare edge case. Somehow, something has deleted this running autopipeline in an immediate
33
+ call to executeAutoPipeline.
34
+
35
+ Maybe the callback in the pipeline.exec is sometimes called in the same tick,
36
+ e.g. if redis is disconnected?
37
+ */
38
+ return;
39
+ }
30
40
  client._runningAutoPipelines.add(slotKey);
31
41
  // Get the pipeline and immediately delete it so that new commands are queued on a new pipeline
32
42
  const pipeline = client._autoPipelines.get(slotKey);
@@ -90,6 +100,8 @@ function executeWithAutoPipelining(client, functionName, commandName, args, call
90
100
  const CustomPromise = PromiseContainer.get();
91
101
  // On cluster mode let's wait for slots to be available
92
102
  if (client.isCluster && !client.slots.length) {
103
+ if (client.status === "wait")
104
+ client.connect().catch(lodash_1.noop);
93
105
  return new CustomPromise(function (resolve, reject) {
94
106
  client.delayUntilReady((err) => {
95
107
  if (err) {
package/built/command.js CHANGED
@@ -313,7 +313,21 @@ Command.setReplyTransformer("hgetall", function (result) {
313
313
  if (Array.isArray(result)) {
314
314
  const obj = {};
315
315
  for (let i = 0; i < result.length; i += 2) {
316
- obj[result[i]] = result[i + 1];
316
+ const key = result[i];
317
+ const value = result[i + 1];
318
+ if (key in obj) {
319
+ // can only be truthy if the property is special somehow, like '__proto__' or 'constructor'
320
+ // https://github.com/luin/ioredis/issues/1267
321
+ Object.defineProperty(obj, key, {
322
+ value,
323
+ configurable: true,
324
+ enumerable: true,
325
+ writable: true,
326
+ });
327
+ }
328
+ else {
329
+ obj[key] = value;
330
+ }
317
331
  }
318
332
  return obj;
319
333
  }
package/built/pipeline.js CHANGED
@@ -8,6 +8,7 @@ const calculateSlot = require("cluster-key-slot");
8
8
  const pMap = require("p-map");
9
9
  const PromiseContainer = require("./promiseContainer");
10
10
  const commander_1 = require("./commander");
11
+ const utils_1 = require("./utils");
11
12
  /*
12
13
  This function derives from the cluster-key-slot implementation.
13
14
  Instead of checking that all keys have the same slot, it checks that all slots are served by the same set of nodes.
@@ -140,7 +141,8 @@ Pipeline.prototype.fillResult = function (value, position) {
140
141
  moved: function (slot, key) {
141
142
  _this.preferKey = key;
142
143
  _this.redis.slots[errv[1]] = [key];
143
- _this.redis._groupsBySlot[errv[1]] = _this.redis._groupsIds[_this.redis.slots[errv[1]].join(";")];
144
+ _this.redis._groupsBySlot[errv[1]] =
145
+ _this.redis._groupsIds[_this.redis.slots[errv[1]].join(";")];
144
146
  _this.redis.refreshSlotsCache();
145
147
  _this.exec();
146
148
  },
@@ -214,6 +216,8 @@ Pipeline.prototype.execBuffer = util_1.deprecate(function () {
214
216
  Pipeline.prototype.exec = function (callback) {
215
217
  // Wait for the cluster to be connected, since we need nodes information before continuing
216
218
  if (this.isCluster && !this.redis.slots.length) {
219
+ if (this.redis.status === "wait")
220
+ this.redis.connect().catch(utils_1.noop);
217
221
  this.redis.delayUntilReady((err) => {
218
222
  if (err) {
219
223
  callback(err);
@@ -29,6 +29,8 @@ function addTransactionSupport(redis) {
29
29
  pipeline.exec = function (callback) {
30
30
  // Wait for the cluster to be connected, since we need nodes information before continuing
31
31
  if (this.isCluster && !this.redis.slots.length) {
32
+ if (this.redis.status === "wait")
33
+ this.redis.connect().catch(utils_1.noop);
32
34
  return standard_as_callback_1.default(new Promise((resolve, reject) => {
33
35
  this.redis.delayUntilReady((err) => {
34
36
  if (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ioredis",
3
- "version": "4.27.7",
3
+ "version": "4.27.11",
4
4
  "description": "A robust, performance-focused and full-featured Redis client for Node.js.",
5
5
  "main": "built/index.js",
6
6
  "files": [
@@ -76,7 +76,7 @@
76
76
  "server-destroy": "^1.0.1",
77
77
  "sinon": "^9.0.1",
78
78
  "ts-node": "^8.8.1",
79
- "typescript": "^3.8.3",
79
+ "typescript": "3.8.3",
80
80
  "uuid": "^8.3.0"
81
81
  },
82
82
  "engines": {