@upstash/redis 1.23.2 → 1.23.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.
@@ -1,23 +1,22 @@
1
1
  import { Command } from "./command.js";
2
2
  function deserialize(result) {
3
- if (result.length === 0) {
4
- return {};
5
- }
6
3
  const obj = {};
7
- while (result.length >= 2) {
8
- const streamId = result.shift();
9
- const entries = result.shift();
10
- if (!(streamId in obj)) {
11
- obj[streamId] = {};
12
- }
13
- while (entries.length >= 2) {
14
- const field = entries.shift();
15
- const value = entries.shift();
16
- try {
17
- obj[streamId][field] = JSON.parse(value);
4
+ for (const e of result) {
5
+ while (e.length >= 2) {
6
+ const streamId = e.shift();
7
+ const entries = e.shift();
8
+ if (!(streamId in obj)) {
9
+ obj[streamId] = {};
18
10
  }
19
- catch {
20
- obj[streamId][field] = value;
11
+ while (entries.length >= 2) {
12
+ const field = entries.shift();
13
+ const value = entries.shift();
14
+ try {
15
+ obj[streamId][field] = JSON.parse(value);
16
+ }
17
+ catch {
18
+ obj[streamId][field] = value;
19
+ }
21
20
  }
22
21
  }
23
22
  }
@@ -30,7 +29,7 @@ export class XRangeCommand extends Command {
30
29
  command.push("COUNT", count);
31
30
  }
32
31
  super(command, {
33
- deserialize: (result) => deserialize(result[0]),
32
+ deserialize: (result) => deserialize(result),
34
33
  ...opts,
35
34
  });
36
35
  }
package/esm/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "v1.23.2";
1
+ export const VERSION = "v1.23.3";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/platforms/nodejs.js",
4
4
  "types": "./types/platforms/nodejs.d.ts",
5
5
  "name": "@upstash/redis",
6
- "version": "v1.23.2",
6
+ "version": "v1.23.3",
7
7
  "description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
8
8
  "repository": {
9
9
  "type": "git",
@@ -3,24 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.XRangeCommand = void 0;
4
4
  const command_js_1 = require("./command.js");
5
5
  function deserialize(result) {
6
- if (result.length === 0) {
7
- return {};
8
- }
9
6
  const obj = {};
10
- while (result.length >= 2) {
11
- const streamId = result.shift();
12
- const entries = result.shift();
13
- if (!(streamId in obj)) {
14
- obj[streamId] = {};
15
- }
16
- while (entries.length >= 2) {
17
- const field = entries.shift();
18
- const value = entries.shift();
19
- try {
20
- obj[streamId][field] = JSON.parse(value);
7
+ for (const e of result) {
8
+ while (e.length >= 2) {
9
+ const streamId = e.shift();
10
+ const entries = e.shift();
11
+ if (!(streamId in obj)) {
12
+ obj[streamId] = {};
21
13
  }
22
- catch {
23
- obj[streamId][field] = value;
14
+ while (entries.length >= 2) {
15
+ const field = entries.shift();
16
+ const value = entries.shift();
17
+ try {
18
+ obj[streamId][field] = JSON.parse(value);
19
+ }
20
+ catch {
21
+ obj[streamId][field] = value;
22
+ }
24
23
  }
25
24
  }
26
25
  }
@@ -33,7 +32,7 @@ class XRangeCommand extends command_js_1.Command {
33
32
  command.push("COUNT", count);
34
33
  }
35
34
  super(command, {
36
- deserialize: (result) => deserialize(result[0]),
35
+ deserialize: (result) => deserialize(result),
37
36
  ...opts,
38
37
  });
39
38
  }
package/script/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = "v1.23.2";
4
+ exports.VERSION = "v1.23.3";
@@ -1 +1 @@
1
- export declare const VERSION = "v1.23.2";
1
+ export declare const VERSION = "v1.23.3";