@upstash/redis 1.23.2 → 1.23.4
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/esm/pkg/commands/xrange.js +16 -17
- package/esm/pkg/pipeline.js +6 -0
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/script/pkg/commands/xrange.js +16 -17
- package/script/pkg/pipeline.js +6 -0
- package/script/version.js +1 -1
- package/types/pkg/pipeline.d.ts +4 -0
- package/types/version.d.ts +1 -1
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
20
|
-
|
|
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
|
|
32
|
+
deserialize: (result) => deserialize(result),
|
|
34
33
|
...opts,
|
|
35
34
|
});
|
|
36
35
|
}
|
package/esm/pkg/pipeline.js
CHANGED
|
@@ -1190,6 +1190,12 @@ export class Pipeline {
|
|
|
1190
1190
|
this.commandOptions = opts.commandOptions;
|
|
1191
1191
|
this.multiExec = opts.multiExec ?? false;
|
|
1192
1192
|
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Returns the length of pipeline before the execution
|
|
1195
|
+
*/
|
|
1196
|
+
length() {
|
|
1197
|
+
return this.commands.length;
|
|
1198
|
+
}
|
|
1193
1199
|
/**
|
|
1194
1200
|
* Pushes a command into the pipeline and returns a chainable instance of the
|
|
1195
1201
|
* pipeline
|
package/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "v1.23.
|
|
1
|
+
export const VERSION = "v1.23.4";
|
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.
|
|
6
|
+
"version": "v1.23.4",
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
|
35
|
+
deserialize: (result) => deserialize(result),
|
|
37
36
|
...opts,
|
|
38
37
|
});
|
|
39
38
|
}
|
package/script/pkg/pipeline.js
CHANGED
|
@@ -1193,6 +1193,12 @@ class Pipeline {
|
|
|
1193
1193
|
this.commandOptions = opts.commandOptions;
|
|
1194
1194
|
this.multiExec = opts.multiExec ?? false;
|
|
1195
1195
|
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Returns the length of pipeline before the execution
|
|
1198
|
+
*/
|
|
1199
|
+
length() {
|
|
1200
|
+
return this.commands.length;
|
|
1201
|
+
}
|
|
1196
1202
|
/**
|
|
1197
1203
|
* Pushes a command into the pipeline and returns a chainable instance of the
|
|
1198
1204
|
* pipeline
|
package/script/version.js
CHANGED
package/types/pkg/pipeline.d.ts
CHANGED
|
@@ -66,6 +66,10 @@ export declare class Pipeline<TCommands extends Command<any, any>[] = []> {
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
exec: <TCommandResults extends unknown[] = [] extends TCommands ? unknown[] : InferResponseData<TCommands>>() => Promise<TCommandResults>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns the length of pipeline before the execution
|
|
71
|
+
*/
|
|
72
|
+
length(): number;
|
|
69
73
|
/**
|
|
70
74
|
* Pushes a command into the pipeline and returns a chainable instance of the
|
|
71
75
|
* pipeline
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "v1.23.
|
|
1
|
+
export declare const VERSION = "v1.23.4";
|