@upstash/redis 0.0.0-ci.f2a52c0f → 0.0.0-ci.f407f833
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/lpos.js +19 -0
- package/esm/pkg/commands/mod.js +1 -0
- package/esm/pkg/commands/sdiffstore.js +1 -1
- package/esm/pkg/commands/zrange.js +6 -0
- package/esm/pkg/pipeline.js +10 -1
- package/esm/pkg/redis.js +22 -1
- package/package.json +1 -1
- package/script/pkg/commands/lpos.js +23 -0
- package/script/pkg/commands/mod.js +1 -0
- package/script/pkg/commands/sdiffstore.js +1 -1
- package/script/pkg/commands/zrange.js +6 -0
- package/script/pkg/pipeline.js +9 -0
- package/script/pkg/redis.js +21 -0
- package/types/pkg/commands/bitop.d.ts +0 -1
- package/types/pkg/commands/bitpos.d.ts +1 -1
- package/types/pkg/commands/lpop.d.ts +1 -1
- package/types/pkg/commands/lpos.d.ts +15 -0
- package/types/pkg/commands/mget.d.ts +1 -1
- package/types/pkg/commands/mod.d.ts +1 -0
- package/types/pkg/commands/rpop.d.ts +2 -2
- package/types/pkg/commands/sdiffstore.d.ts +1 -1
- package/types/pkg/commands/spop.d.ts +2 -2
- package/types/pkg/commands/zadd.d.ts +1 -1
- package/types/pkg/commands/zrange.d.ts +7 -0
- package/types/pkg/pipeline.d.ts +13 -5
- package/types/pkg/redis.d.ts +19 -7
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/lpos
|
|
4
|
+
*/
|
|
5
|
+
export class LPosCommand extends Command {
|
|
6
|
+
constructor(cmd, opts) {
|
|
7
|
+
const args = ["lpos", cmd[0], cmd[1]];
|
|
8
|
+
if (typeof cmd[2]?.rank === "number") {
|
|
9
|
+
args.push("rank", cmd[2].rank);
|
|
10
|
+
}
|
|
11
|
+
if (typeof cmd[2]?.count === "number") {
|
|
12
|
+
args.push("count", cmd[2].count);
|
|
13
|
+
}
|
|
14
|
+
if (typeof cmd[2]?.maxLen === "number") {
|
|
15
|
+
args.push("maxLen", cmd[2].maxLen);
|
|
16
|
+
}
|
|
17
|
+
super(args, opts);
|
|
18
|
+
}
|
|
19
|
+
}
|
package/esm/pkg/commands/mod.js
CHANGED
|
@@ -12,6 +12,12 @@ export class ZRangeCommand extends Command {
|
|
|
12
12
|
if (opts?.byLex) {
|
|
13
13
|
command.push("bylex");
|
|
14
14
|
}
|
|
15
|
+
if (opts?.rev) {
|
|
16
|
+
command.push("rev");
|
|
17
|
+
}
|
|
18
|
+
if (typeof opts?.count !== "undefined" && typeof opts?.offset !== "undefined") {
|
|
19
|
+
command.push("limit", opts.offset, opts.count);
|
|
20
|
+
}
|
|
15
21
|
if (opts?.withScores) {
|
|
16
22
|
command.push("withscores");
|
|
17
23
|
}
|
package/esm/pkg/pipeline.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
1
|
+
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { UpstashError } from "./error.js";
|
|
3
3
|
/**
|
|
4
4
|
* Upstash REST API supports command pipelining to send multiple commands in
|
|
@@ -475,6 +475,15 @@ export class Pipeline {
|
|
|
475
475
|
writable: true,
|
|
476
476
|
value: (...args) => this.chain(new LPopCommand(args, this.commandOptions))
|
|
477
477
|
});
|
|
478
|
+
/**
|
|
479
|
+
* @see https://redis.io/commands/lpos
|
|
480
|
+
*/
|
|
481
|
+
Object.defineProperty(this, "lpos", {
|
|
482
|
+
enumerable: true,
|
|
483
|
+
configurable: true,
|
|
484
|
+
writable: true,
|
|
485
|
+
value: (...args) => this.chain(new LPosCommand(args, this.commandOptions))
|
|
486
|
+
});
|
|
478
487
|
/**
|
|
479
488
|
* @see https://redis.io/commands/lpush
|
|
480
489
|
*/
|
package/esm/pkg/redis.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
1
|
+
import { AppendCommand, BitCountCommand, BitOpCommand, BitPosCommand, DBSizeCommand, DecrByCommand, DecrCommand, DelCommand, EchoCommand, EvalCommand, EvalshaCommand, ExistsCommand, ExpireAtCommand, ExpireCommand, FlushAllCommand, FlushDBCommand, GetBitCommand, GetCommand, GetRangeCommand, GetSetCommand, HDelCommand, HExistsCommand, HGetAllCommand, HGetCommand, HIncrByCommand, HIncrByFloatCommand, HKeysCommand, HLenCommand, HMGetCommand, HMSetCommand, HScanCommand, HSetCommand, HSetNXCommand, HStrLenCommand, HValsCommand, IncrByCommand, IncrByFloatCommand, IncrCommand, KeysCommand, LIndexCommand, LInsertCommand, LLenCommand, LPopCommand, LPosCommand, LPushCommand, LPushXCommand, LRangeCommand, LRemCommand, LSetCommand, LTrimCommand, MGetCommand, MSetCommand, MSetNXCommand, PersistCommand, PExpireAtCommand, PExpireCommand, PingCommand, PSetEXCommand, PTtlCommand, PublishCommand, RandomKeyCommand, RenameCommand, RenameNXCommand, RPopCommand, RPushCommand, RPushXCommand, SAddCommand, ScanCommand, SCardCommand, ScriptExistsCommand, ScriptFlushCommand, ScriptLoadCommand, SDiffCommand, SDiffStoreCommand, SetBitCommand, SetCommand, SetExCommand, SetNxCommand, SetRangeCommand, SInterCommand, SInterStoreCommand, SIsMemberCommand, SMembersCommand, SMoveCommand, SPopCommand, SRandMemberCommand, SRemCommand, SScanCommand, StrLenCommand, SUnionCommand, SUnionStoreCommand, TimeCommand, TouchCommand, TtlCommand, TypeCommand, UnlinkCommand, ZAddCommand, ZCardCommand, ZCountCommand, ZIncrByCommand, ZInterStoreCommand, ZLexCountCommand, ZPopMaxCommand, ZPopMinCommand, ZRangeCommand, ZRankCommand, ZRemCommand, ZRemRangeByLexCommand, ZRemRangeByRankCommand, ZRemRangeByScoreCommand, ZRevRankCommand, ZScanCommand, ZScoreCommand, ZUnionStoreCommand, } from "./commands/mod.js";
|
|
2
2
|
import { Pipeline } from "./pipeline.js";
|
|
3
3
|
/**
|
|
4
4
|
* Serverless redis client for upstash.
|
|
@@ -28,6 +28,18 @@ export class Redis {
|
|
|
28
28
|
writable: true,
|
|
29
29
|
value: void 0
|
|
30
30
|
});
|
|
31
|
+
/**
|
|
32
|
+
* Wrap a new middleware around the HTTP client.
|
|
33
|
+
*/
|
|
34
|
+
Object.defineProperty(this, "use", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: (middleware) => {
|
|
39
|
+
const makeRequest = this.client.request.bind(this.client);
|
|
40
|
+
this.client.request = (req) => middleware(req, makeRequest);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
31
43
|
/**
|
|
32
44
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
33
45
|
*
|
|
@@ -426,6 +438,15 @@ export class Redis {
|
|
|
426
438
|
writable: true,
|
|
427
439
|
value: (...args) => new LPopCommand(args, this.opts).exec(this.client)
|
|
428
440
|
});
|
|
441
|
+
/**
|
|
442
|
+
* @see https://redis.io/commands/lpos
|
|
443
|
+
*/
|
|
444
|
+
Object.defineProperty(this, "lpos", {
|
|
445
|
+
enumerable: true,
|
|
446
|
+
configurable: true,
|
|
447
|
+
writable: true,
|
|
448
|
+
value: (...args) => new LPosCommand(args, this.opts).exec(this.client)
|
|
449
|
+
});
|
|
429
450
|
/**
|
|
430
451
|
* @see https://redis.io/commands/lpush
|
|
431
452
|
*/
|
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": "v0.0.0-ci.
|
|
6
|
+
"version": "v0.0.0-ci.f407f833",
|
|
7
7
|
"description": "An HTTP/REST based Redis client built on top of Upstash REST API.",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LPosCommand = void 0;
|
|
4
|
+
const command_js_1 = require("./command.js");
|
|
5
|
+
/**
|
|
6
|
+
* @see https://redis.io/commands/lpos
|
|
7
|
+
*/
|
|
8
|
+
class LPosCommand extends command_js_1.Command {
|
|
9
|
+
constructor(cmd, opts) {
|
|
10
|
+
const args = ["lpos", cmd[0], cmd[1]];
|
|
11
|
+
if (typeof cmd[2]?.rank === "number") {
|
|
12
|
+
args.push("rank", cmd[2].rank);
|
|
13
|
+
}
|
|
14
|
+
if (typeof cmd[2]?.count === "number") {
|
|
15
|
+
args.push("count", cmd[2].count);
|
|
16
|
+
}
|
|
17
|
+
if (typeof cmd[2]?.maxLen === "number") {
|
|
18
|
+
args.push("maxLen", cmd[2].maxLen);
|
|
19
|
+
}
|
|
20
|
+
super(args, opts);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.LPosCommand = LPosCommand;
|
|
@@ -58,6 +58,7 @@ __exportStar(require("./lindex.js"), exports);
|
|
|
58
58
|
__exportStar(require("./linsert.js"), exports);
|
|
59
59
|
__exportStar(require("./llen.js"), exports);
|
|
60
60
|
__exportStar(require("./lpop.js"), exports);
|
|
61
|
+
__exportStar(require("./lpos.js"), exports);
|
|
61
62
|
__exportStar(require("./lpush.js"), exports);
|
|
62
63
|
__exportStar(require("./lpushx.js"), exports);
|
|
63
64
|
__exportStar(require("./lrange.js"), exports);
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SDiffStoreCommand = void 0;
|
|
4
4
|
const command_js_1 = require("./command.js");
|
|
5
5
|
/**
|
|
6
|
-
* @see https://redis.io/commands/
|
|
6
|
+
* @see https://redis.io/commands/sdiffstore
|
|
7
7
|
*/
|
|
8
8
|
class SDiffStoreCommand extends command_js_1.Command {
|
|
9
9
|
constructor(cmd, opts) {
|
|
@@ -15,6 +15,12 @@ class ZRangeCommand extends command_js_1.Command {
|
|
|
15
15
|
if (opts?.byLex) {
|
|
16
16
|
command.push("bylex");
|
|
17
17
|
}
|
|
18
|
+
if (opts?.rev) {
|
|
19
|
+
command.push("rev");
|
|
20
|
+
}
|
|
21
|
+
if (typeof opts?.count !== "undefined" && typeof opts?.offset !== "undefined") {
|
|
22
|
+
command.push("limit", opts.offset, opts.count);
|
|
23
|
+
}
|
|
18
24
|
if (opts?.withScores) {
|
|
19
25
|
command.push("withscores");
|
|
20
26
|
}
|
package/script/pkg/pipeline.js
CHANGED
|
@@ -478,6 +478,15 @@ class Pipeline {
|
|
|
478
478
|
writable: true,
|
|
479
479
|
value: (...args) => this.chain(new mod_js_1.LPopCommand(args, this.commandOptions))
|
|
480
480
|
});
|
|
481
|
+
/**
|
|
482
|
+
* @see https://redis.io/commands/lpos
|
|
483
|
+
*/
|
|
484
|
+
Object.defineProperty(this, "lpos", {
|
|
485
|
+
enumerable: true,
|
|
486
|
+
configurable: true,
|
|
487
|
+
writable: true,
|
|
488
|
+
value: (...args) => this.chain(new mod_js_1.LPosCommand(args, this.commandOptions))
|
|
489
|
+
});
|
|
481
490
|
/**
|
|
482
491
|
* @see https://redis.io/commands/lpush
|
|
483
492
|
*/
|
package/script/pkg/redis.js
CHANGED
|
@@ -31,6 +31,18 @@ class Redis {
|
|
|
31
31
|
writable: true,
|
|
32
32
|
value: void 0
|
|
33
33
|
});
|
|
34
|
+
/**
|
|
35
|
+
* Wrap a new middleware around the HTTP client.
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(this, "use", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: (middleware) => {
|
|
42
|
+
const makeRequest = this.client.request.bind(this.client);
|
|
43
|
+
this.client.request = (req) => middleware(req, makeRequest);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
34
46
|
/**
|
|
35
47
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
36
48
|
*
|
|
@@ -429,6 +441,15 @@ class Redis {
|
|
|
429
441
|
writable: true,
|
|
430
442
|
value: (...args) => new mod_js_1.LPopCommand(args, this.opts).exec(this.client)
|
|
431
443
|
});
|
|
444
|
+
/**
|
|
445
|
+
* @see https://redis.io/commands/lpos
|
|
446
|
+
*/
|
|
447
|
+
Object.defineProperty(this, "lpos", {
|
|
448
|
+
enumerable: true,
|
|
449
|
+
configurable: true,
|
|
450
|
+
writable: true,
|
|
451
|
+
value: (...args) => new mod_js_1.LPosCommand(args, this.opts).exec(this.client)
|
|
452
|
+
});
|
|
432
453
|
/**
|
|
433
454
|
* @see https://redis.io/commands/lpush
|
|
434
455
|
*/
|
|
@@ -6,7 +6,6 @@ export declare class BitOpCommand extends Command<number, number> {
|
|
|
6
6
|
constructor(cmd: [
|
|
7
7
|
op: "and" | "or" | "xor",
|
|
8
8
|
destinationKey: string,
|
|
9
|
-
sourceKey: string,
|
|
10
9
|
...sourceKeys: string[]
|
|
11
10
|
], opts?: CommandOptions<number, number>);
|
|
12
11
|
constructor(cmd: [op: "not", destinationKey: string, sourceKey: string], opts?: CommandOptions<number, number>);
|
|
@@ -3,5 +3,5 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
3
3
|
* @see https://redis.io/commands/bitpos
|
|
4
4
|
*/
|
|
5
5
|
export declare class BitPosCommand extends Command<number, number> {
|
|
6
|
-
constructor(cmd: [key: string,
|
|
6
|
+
constructor(cmd: [key: string, bit: 0 | 1, start?: number, end?: number], opts?: CommandOptions<number, number>);
|
|
7
7
|
}
|
|
@@ -3,5 +3,5 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
3
3
|
* @see https://redis.io/commands/lpop
|
|
4
4
|
*/
|
|
5
5
|
export declare class LPopCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
6
|
-
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
6
|
+
constructor(cmd: [key: string, count?: number], opts?: CommandOptions<unknown | null, TData | null>);
|
|
7
7
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Command, CommandOptions } from "./command.js";
|
|
2
|
+
/**
|
|
3
|
+
* @see https://redis.io/commands/lpos
|
|
4
|
+
*/
|
|
5
|
+
export declare class LPosCommand<TData = number> extends Command<TData, TData> {
|
|
6
|
+
constructor(cmd: [
|
|
7
|
+
key: string,
|
|
8
|
+
element: unknown,
|
|
9
|
+
opts?: {
|
|
10
|
+
rank?: number;
|
|
11
|
+
count?: number;
|
|
12
|
+
maxLen?: number;
|
|
13
|
+
}
|
|
14
|
+
], opts?: CommandOptions<TData, TData>);
|
|
15
|
+
}
|
|
@@ -3,5 +3,5 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
3
3
|
* @see https://redis.io/commands/mget
|
|
4
4
|
*/
|
|
5
5
|
export declare class MGetCommand<TData extends unknown[]> extends Command<(string | null)[], TData> {
|
|
6
|
-
constructor(cmd: [...keys:
|
|
6
|
+
constructor(cmd: [...keys: string[]], opts?: CommandOptions<(string | null)[], TData>);
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @see https://redis.io/commands/rpop
|
|
4
4
|
*/
|
|
5
|
-
export declare class RPopCommand<TData = string> extends Command<unknown | null, TData | null> {
|
|
6
|
-
constructor(cmd: [key: string], opts?: CommandOptions<unknown | null, TData | null>);
|
|
5
|
+
export declare class RPopCommand<TData extends unknown | unknown[] = string> extends Command<unknown | null, TData | null> {
|
|
6
|
+
constructor(cmd: [key: string, count?: number], opts?: CommandOptions<unknown | null, TData | null>);
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, CommandOptions } from "./command.js";
|
|
2
2
|
/**
|
|
3
|
-
* @see https://redis.io/commands/
|
|
3
|
+
* @see https://redis.io/commands/sdiffstore
|
|
4
4
|
*/
|
|
5
5
|
export declare class SDiffStoreCommand extends Command<number, number> {
|
|
6
6
|
constructor(cmd: [destination: string, ...keys: string[]], opts?: CommandOptions<number, number>);
|
|
@@ -2,6 +2,6 @@ import { Command, CommandOptions } from "./command.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* @see https://redis.io/commands/spop
|
|
4
4
|
*/
|
|
5
|
-
export declare class SPopCommand<TData> extends Command<string | null, TData | null> {
|
|
6
|
-
constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | null, TData | null>);
|
|
5
|
+
export declare class SPopCommand<TData> extends Command<string | string[] | null, TData | null> {
|
|
6
|
+
constructor([key, count]: [key: string, count?: number], opts?: CommandOptions<string | string[] | null, TData | null>);
|
|
7
7
|
}
|
|
@@ -30,6 +30,6 @@ export declare class ZAddCommand<TData = string> extends Command<number | null,
|
|
|
30
30
|
constructor(cmd: [
|
|
31
31
|
key: string,
|
|
32
32
|
opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr,
|
|
33
|
-
...scoreMemberPairs:
|
|
33
|
+
...scoreMemberPairs: ScoreMember<TData>[]
|
|
34
34
|
], opts?: CommandOptions<number | null, number | null>);
|
|
35
35
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command, CommandOptions } from "./command.js";
|
|
2
2
|
export declare type ZRangeCommandOptions = {
|
|
3
3
|
withScores?: boolean;
|
|
4
|
+
rev?: boolean;
|
|
4
5
|
} & ({
|
|
5
6
|
byScore: true;
|
|
6
7
|
byLex?: never;
|
|
@@ -10,6 +11,12 @@ export declare type ZRangeCommandOptions = {
|
|
|
10
11
|
} | {
|
|
11
12
|
byScore?: never;
|
|
12
13
|
byLex?: never;
|
|
14
|
+
}) & ({
|
|
15
|
+
offset: number;
|
|
16
|
+
count: number;
|
|
17
|
+
} | {
|
|
18
|
+
offset?: never;
|
|
19
|
+
count?: never;
|
|
13
20
|
});
|
|
14
21
|
/**
|
|
15
22
|
* @see https://redis.io/commands/zrange
|
package/types/pkg/pipeline.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
|
|
1
|
+
import { DelCommand, ExistsCommand, FlushAllCommand, MGetCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
|
|
2
2
|
import { CommandOptions } from "./commands/command.js";
|
|
3
3
|
import { Requester } from "./http.js";
|
|
4
4
|
import { CommandArgs } from "./types.js";
|
|
@@ -79,7 +79,7 @@ export declare class Pipeline {
|
|
|
79
79
|
/**
|
|
80
80
|
* @see https://redis.io/commands/bitpos
|
|
81
81
|
*/
|
|
82
|
-
bitpos: (key: string,
|
|
82
|
+
bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => this;
|
|
83
83
|
/**
|
|
84
84
|
* @see https://redis.io/commands/dbsize
|
|
85
85
|
*/
|
|
@@ -241,7 +241,15 @@ export declare class Pipeline {
|
|
|
241
241
|
/**
|
|
242
242
|
* @see https://redis.io/commands/lpop
|
|
243
243
|
*/
|
|
244
|
-
lpop: <TData>(key: string) => this;
|
|
244
|
+
lpop: <TData>(key: string, count?: number | undefined) => this;
|
|
245
|
+
/**
|
|
246
|
+
* @see https://redis.io/commands/lpos
|
|
247
|
+
*/
|
|
248
|
+
lpos: <TData>(key: string, element: unknown, opts?: {
|
|
249
|
+
rank?: number | undefined;
|
|
250
|
+
count?: number | undefined;
|
|
251
|
+
maxLen?: number | undefined;
|
|
252
|
+
} | undefined) => this;
|
|
245
253
|
/**
|
|
246
254
|
* @see https://redis.io/commands/lpush
|
|
247
255
|
*/
|
|
@@ -269,7 +277,7 @@ export declare class Pipeline {
|
|
|
269
277
|
/**
|
|
270
278
|
* @see https://redis.io/commands/mget
|
|
271
279
|
*/
|
|
272
|
-
mget: <TData extends unknown[]>(
|
|
280
|
+
mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => this;
|
|
273
281
|
/**
|
|
274
282
|
* @see https://redis.io/commands/mset
|
|
275
283
|
*/
|
|
@@ -325,7 +333,7 @@ export declare class Pipeline {
|
|
|
325
333
|
/**
|
|
326
334
|
* @see https://redis.io/commands/rpop
|
|
327
335
|
*/
|
|
328
|
-
rpop: <TData = string>(key: string) => this;
|
|
336
|
+
rpop: <TData = string>(key: string, count?: number | undefined) => this;
|
|
329
337
|
/**
|
|
330
338
|
* @see https://redis.io/commands/rpush
|
|
331
339
|
*/
|
package/types/pkg/redis.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CommandOptions, DelCommand, ExistsCommand, FlushAllCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
|
|
2
|
-
import { Requester } from "./http.js";
|
|
1
|
+
import { CommandOptions, DelCommand, ExistsCommand, FlushAllCommand, MGetCommand, PingCommand, ScoreMember, ScriptExistsCommand, SetCommandOptions, TouchCommand, UnlinkCommand, ZAddCommandOptions, ZAddCommandOptionsWithIncr, ZRangeCommandOptions } from "./commands/mod.js";
|
|
2
|
+
import { Requester, UpstashRequest, UpstashResponse } from "./http.js";
|
|
3
3
|
import { Pipeline } from "./pipeline.js";
|
|
4
4
|
import type { CommandArgs } from "./types.js";
|
|
5
5
|
export declare type RedisOptions = {
|
|
@@ -14,7 +14,7 @@ export declare type RedisOptions = {
|
|
|
14
14
|
* Serverless redis client for upstash.
|
|
15
15
|
*/
|
|
16
16
|
export declare class Redis {
|
|
17
|
-
protected
|
|
17
|
+
protected client: Requester;
|
|
18
18
|
protected opts?: CommandOptions<any, any>;
|
|
19
19
|
/**
|
|
20
20
|
* Create a new redis client
|
|
@@ -28,6 +28,10 @@ export declare class Redis {
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
constructor(client: Requester, opts?: RedisOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Wrap a new middleware around the HTTP client.
|
|
33
|
+
*/
|
|
34
|
+
use: <TResult = unknown>(middleware: (r: UpstashRequest, next: <TResult_1 = unknown>(req: UpstashRequest) => Promise<UpstashResponse<TResult_1>>) => Promise<UpstashResponse<TResult>>) => void;
|
|
31
35
|
/**
|
|
32
36
|
* Create a new pipeline that allows you to send requests in bulk.
|
|
33
37
|
*
|
|
@@ -52,7 +56,7 @@ export declare class Redis {
|
|
|
52
56
|
/**
|
|
53
57
|
* @see https://redis.io/commands/bitpos
|
|
54
58
|
*/
|
|
55
|
-
bitpos: (key: string,
|
|
59
|
+
bitpos: (key: string, bit: 0 | 1, start?: number | undefined, end?: number | undefined) => Promise<number>;
|
|
56
60
|
/**
|
|
57
61
|
* @see https://redis.io/commands/dbsize
|
|
58
62
|
*/
|
|
@@ -214,7 +218,15 @@ export declare class Redis {
|
|
|
214
218
|
/**
|
|
215
219
|
* @see https://redis.io/commands/lpop
|
|
216
220
|
*/
|
|
217
|
-
lpop: <TData>(key: string) => Promise<TData | null>;
|
|
221
|
+
lpop: <TData>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
222
|
+
/**
|
|
223
|
+
* @see https://redis.io/commands/lpos
|
|
224
|
+
*/
|
|
225
|
+
lpos: <TData = number>(key: string, element: unknown, opts?: {
|
|
226
|
+
rank?: number | undefined;
|
|
227
|
+
count?: number | undefined;
|
|
228
|
+
maxLen?: number | undefined;
|
|
229
|
+
} | undefined) => Promise<TData>;
|
|
218
230
|
/**
|
|
219
231
|
* @see https://redis.io/commands/lpush
|
|
220
232
|
*/
|
|
@@ -242,7 +254,7 @@ export declare class Redis {
|
|
|
242
254
|
/**
|
|
243
255
|
* @see https://redis.io/commands/mget
|
|
244
256
|
*/
|
|
245
|
-
mget: <TData extends unknown[]>(
|
|
257
|
+
mget: <TData extends unknown[]>(...args: CommandArgs<typeof MGetCommand>) => Promise<TData>;
|
|
246
258
|
/**
|
|
247
259
|
* @see https://redis.io/commands/mset
|
|
248
260
|
*/
|
|
@@ -298,7 +310,7 @@ export declare class Redis {
|
|
|
298
310
|
/**
|
|
299
311
|
* @see https://redis.io/commands/rpop
|
|
300
312
|
*/
|
|
301
|
-
rpop: <TData = string>(key: string) => Promise<TData | null>;
|
|
313
|
+
rpop: <TData = string>(key: string, count?: number | undefined) => Promise<TData | null>;
|
|
302
314
|
/**
|
|
303
315
|
* @see https://redis.io/commands/rpush
|
|
304
316
|
*/
|