@upstash/redis 1.0.0-alpha.2 → 1.0.0-alpha.7
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/README.md +256 -0
- package/{dist/chunk-7YUZYRJS.mjs → chunk-7YUZYRJS.mjs} +0 -0
- package/{dist/chunk-FJSI5EBJ.mjs → chunk-AHCVU33N.mjs} +2 -2
- package/{dist/chunk-ZIB6XPPC.mjs → chunk-HGM7M7CJ.mjs} +9 -4
- package/{dist/chunk-U7OXAQMQ.mjs → chunk-HIDCSH5S.mjs} +0 -1
- package/{dist/chunk-Y5TC4HX2.mjs → chunk-T66TTHSV.mjs} +5 -5
- package/{dist/cloudflare.d.ts → cloudflare.d.ts} +2 -2
- package/{dist/cloudflare.js → cloudflare.js} +12 -9
- package/{dist/cloudflare.mjs → cloudflare.mjs} +3 -3
- package/{dist/commands.d.ts → commands.d.ts} +5 -3
- package/{dist/commands.js → commands.js} +10 -4
- package/{dist/commands.mjs → commands.mjs} +3 -1
- package/{dist/fastly.d.ts → fastly.d.ts} +2 -2
- package/{dist/fastly.js → fastly.js} +12 -9
- package/{dist/fastly.mjs → fastly.mjs} +3 -3
- package/{dist/http.d.ts → http.d.ts} +0 -0
- package/{dist/http.js → http.js} +0 -1
- package/{dist/http.mjs → http.mjs} +1 -1
- package/{dist/index.d.ts → index.d.ts} +2 -2
- package/{dist/index.js → index.js} +13 -10
- package/index.mjs +13 -0
- package/{dist/nodejs.d.ts → nodejs.d.ts} +2 -2
- package/{dist/nodejs.js → nodejs.js} +13 -10
- package/nodejs.mjs +10 -0
- package/package.json +1 -1
- package/{dist/redis-dd052782.d.ts → redis-71fa1ee6.d.ts} +7 -3
- package/{dist/zunionstore-dffa797d.d.ts → zunionstore-b38007ba.d.ts} +1 -1
- package/.eslintrc.js +0 -49
- package/.prettierrc.js +0 -7
- package/LICENSE +0 -21
- package/dist/index.mjs +0 -13
- package/dist/nodejs.mjs +0 -10
- package/dist/package.json +0 -1
- package/jest.config.js +0 -195
- package/pkg/cloudflare.ts +0 -77
- package/pkg/command.ts +0 -40
- package/pkg/commands/append.test.ts +0 -28
- package/pkg/commands/append.ts +0 -10
- package/pkg/commands/bitcount.test.ts +0 -36
- package/pkg/commands/bitcount.ts +0 -19
- package/pkg/commands/bitop.test.ts +0 -44
- package/pkg/commands/bitop.ts +0 -22
- package/pkg/commands/bitpos.test.ts +0 -26
- package/pkg/commands/bitpos.ts +0 -10
- package/pkg/commands/dbsize.test.ts +0 -17
- package/pkg/commands/dbsize.ts +0 -10
- package/pkg/commands/decr.test.ts +0 -22
- package/pkg/commands/decr.ts +0 -10
- package/pkg/commands/decrby.test.ts +0 -23
- package/pkg/commands/decrby.ts +0 -10
- package/pkg/commands/del.test.ts +0 -38
- package/pkg/commands/del.ts +0 -11
- package/pkg/commands/echo.test.ts +0 -11
- package/pkg/commands/echo.ts +0 -10
- package/pkg/commands/exists.test.ts +0 -37
- package/pkg/commands/exists.ts +0 -11
- package/pkg/commands/expire.test.ts +0 -22
- package/pkg/commands/expire.ts +0 -10
- package/pkg/commands/expireat.test.ts +0 -24
- package/pkg/commands/expireat.ts +0 -10
- package/pkg/commands/flushall.test.ts +0 -17
- package/pkg/commands/flushall.ts +0 -13
- package/pkg/commands/flushdb.test.ts +0 -17
- package/pkg/commands/flushdb.ts +0 -13
- package/pkg/commands/get.test.ts +0 -34
- package/pkg/commands/get.ts +0 -10
- package/pkg/commands/getbit.test.ts +0 -16
- package/pkg/commands/getbit.ts +0 -10
- package/pkg/commands/getrange.test.ts +0 -25
- package/pkg/commands/getrange.ts +0 -10
- package/pkg/commands/getset.test.ts +0 -33
- package/pkg/commands/getset.ts +0 -10
- package/pkg/commands/hdel.test.ts +0 -30
- package/pkg/commands/hdel.ts +0 -10
- package/pkg/commands/hexists.test.ts +0 -31
- package/pkg/commands/hexists.ts +0 -10
- package/pkg/commands/hget.test.ts +0 -47
- package/pkg/commands/hget.ts +0 -10
- package/pkg/commands/hgetall.test.ts +0 -32
- package/pkg/commands/hgetall.ts +0 -35
- package/pkg/commands/hincrby.test.ts +0 -27
- package/pkg/commands/hincrby.ts +0 -10
- package/pkg/commands/hincrbyfloat.test.ts +0 -25
- package/pkg/commands/hincrbyfloat.ts +0 -10
- package/pkg/commands/hkeys.test.ts +0 -22
- package/pkg/commands/hkeys.ts +0 -10
- package/pkg/commands/hlen.test.ts +0 -24
- package/pkg/commands/hlen.ts +0 -10
- package/pkg/commands/hmget.test.ts +0 -48
- package/pkg/commands/hmget.ts +0 -41
- package/pkg/commands/hmset.test.ts +0 -24
- package/pkg/commands/hmset.ts +0 -10
- package/pkg/commands/hscan.test.ts +0 -46
- package/pkg/commands/hscan.ts +0 -22
- package/pkg/commands/hset.test.ts +0 -21
- package/pkg/commands/hset.ts +0 -10
- package/pkg/commands/hsetnx.test.ts +0 -37
- package/pkg/commands/hsetnx.ts +0 -10
- package/pkg/commands/hstrlen.test.ts +0 -24
- package/pkg/commands/hstrlen.ts +0 -10
- package/pkg/commands/hvals.test.ts +0 -23
- package/pkg/commands/hvals.ts +0 -10
- package/pkg/commands/incr.test.ts +0 -23
- package/pkg/commands/incr.ts +0 -10
- package/pkg/commands/incrby.test.ts +0 -23
- package/pkg/commands/incrby.ts +0 -10
- package/pkg/commands/incrbyfloat.test.ts +0 -24
- package/pkg/commands/incrbyfloat.ts +0 -10
- package/pkg/commands/index.ts +0 -107
- package/pkg/commands/keys.test.ts +0 -17
- package/pkg/commands/keys.ts +0 -10
- package/pkg/commands/lindex.test.ts +0 -33
- package/pkg/commands/lindex.ts +0 -7
- package/pkg/commands/linsert.test.ts +0 -19
- package/pkg/commands/linsert.ts +0 -6
- package/pkg/commands/llen.test.ts +0 -26
- package/pkg/commands/llen.ts +0 -10
- package/pkg/commands/lpop.test.ts +0 -27
- package/pkg/commands/lpop.ts +0 -10
- package/pkg/commands/lpush.test.ts +0 -17
- package/pkg/commands/lpush.ts +0 -11
- package/pkg/commands/lpushx.test.ts +0 -29
- package/pkg/commands/lpushx.ts +0 -11
- package/pkg/commands/lrange.test.ts +0 -22
- package/pkg/commands/lrange.ts +0 -7
- package/pkg/commands/lrem.test.ts +0 -19
- package/pkg/commands/lrem.ts +0 -6
- package/pkg/commands/lset.test.ts +0 -40
- package/pkg/commands/lset.ts +0 -7
- package/pkg/commands/ltrim.test.ts +0 -29
- package/pkg/commands/ltrim.ts +0 -7
- package/pkg/commands/mget.test.ts +0 -44
- package/pkg/commands/mget.ts +0 -9
- package/pkg/commands/mset.test.ts +0 -24
- package/pkg/commands/mset.ts +0 -10
- package/pkg/commands/msetnx.test.ts +0 -46
- package/pkg/commands/msetnx.ts +0 -10
- package/pkg/commands/persist.test.ts +0 -22
- package/pkg/commands/persist.ts +0 -10
- package/pkg/commands/pexpire.test.ts +0 -24
- package/pkg/commands/pexpire.ts +0 -10
- package/pkg/commands/pexpireat.test.ts +0 -24
- package/pkg/commands/pexpireat.ts +0 -10
- package/pkg/commands/ping.test.ts +0 -19
- package/pkg/commands/ping.ts +0 -13
- package/pkg/commands/psetex.test.ts +0 -23
- package/pkg/commands/psetex.ts +0 -10
- package/pkg/commands/pttl.test.ts +0 -17
- package/pkg/commands/pttl.ts +0 -10
- package/pkg/commands/randomkey.test.ts +0 -17
- package/pkg/commands/randomkey.ts +0 -10
- package/pkg/commands/rename.test.ts +0 -18
- package/pkg/commands/rename.ts +0 -10
- package/pkg/commands/renamenx.test.ts +0 -32
- package/pkg/commands/renamenx.ts +0 -10
- package/pkg/commands/rpop.test.ts +0 -27
- package/pkg/commands/rpop.ts +0 -10
- package/pkg/commands/rpush.test.ts +0 -17
- package/pkg/commands/rpush.ts +0 -11
- package/pkg/commands/rpushx.test.ts +0 -29
- package/pkg/commands/rpushx.ts +0 -11
- package/pkg/commands/sadd.test.ts +0 -16
- package/pkg/commands/sadd.ts +0 -11
- package/pkg/commands/scan.test.ts +0 -50
- package/pkg/commands/scan.ts +0 -21
- package/pkg/commands/scard.test.ts +0 -15
- package/pkg/commands/scard.ts +0 -9
- package/pkg/commands/sdiff.test.ts +0 -20
- package/pkg/commands/sdiff.ts +0 -9
- package/pkg/commands/sdiffstore.test.ts +0 -21
- package/pkg/commands/sdiffstore.ts +0 -10
- package/pkg/commands/set.test.ts +0 -112
- package/pkg/commands/set.ts +0 -53
- package/pkg/commands/setbit.test.ts +0 -16
- package/pkg/commands/setbit.ts +0 -10
- package/pkg/commands/setex.test.ts +0 -22
- package/pkg/commands/setex.ts +0 -10
- package/pkg/commands/setnx.test.ts +0 -27
- package/pkg/commands/setnx.ts +0 -10
- package/pkg/commands/setrange.test.ts +0 -25
- package/pkg/commands/setrange.ts +0 -10
- package/pkg/commands/sinter.test.ts +0 -36
- package/pkg/commands/sinter.ts +0 -9
- package/pkg/commands/sinterstore.test.ts +0 -21
- package/pkg/commands/sinterstore.ts +0 -9
- package/pkg/commands/sismember.test.ts +0 -30
- package/pkg/commands/sismember.ts +0 -9
- package/pkg/commands/smembers.test.ts +0 -22
- package/pkg/commands/smembers.ts +0 -10
- package/pkg/commands/smove.test.ts +0 -18
- package/pkg/commands/smove.ts +0 -9
- package/pkg/commands/spop.test.ts +0 -35
- package/pkg/commands/spop.ts +0 -13
- package/pkg/commands/srandmember.test.ts +0 -32
- package/pkg/commands/srandmember.ts +0 -13
- package/pkg/commands/srem.test.ts +0 -18
- package/pkg/commands/srem.ts +0 -10
- package/pkg/commands/sscan.test.ts +0 -50
- package/pkg/commands/sscan.ts +0 -22
- package/pkg/commands/strlen.test.ts +0 -16
- package/pkg/commands/strlen.ts +0 -10
- package/pkg/commands/sunion.test.ts +0 -22
- package/pkg/commands/sunion.ts +0 -10
- package/pkg/commands/sunionstore.test.ts +0 -29
- package/pkg/commands/sunionstore.ts +0 -10
- package/pkg/commands/time.test.ts +0 -11
- package/pkg/commands/time.ts +0 -9
- package/pkg/commands/touch.test.ts +0 -20
- package/pkg/commands/touch.ts +0 -10
- package/pkg/commands/ttl.test.ts +0 -17
- package/pkg/commands/ttl.ts +0 -10
- package/pkg/commands/type.test.ts +0 -72
- package/pkg/commands/type.ts +0 -11
- package/pkg/commands/unlink.test.ts +0 -21
- package/pkg/commands/unlink.ts +0 -10
- package/pkg/commands/zadd.test.ts +0 -177
- package/pkg/commands/zadd.ts +0 -64
- package/pkg/commands/zcard.test.ts +0 -15
- package/pkg/commands/zcard.ts +0 -10
- package/pkg/commands/zcount.test.ts +0 -15
- package/pkg/commands/zcount.ts +0 -9
- package/pkg/commands/zincrby.test.ts +0 -20
- package/pkg/commands/zincrby.ts +0 -9
- package/pkg/commands/zinterstore.test.ts +0 -239
- package/pkg/commands/zinterstore.ts +0 -55
- package/pkg/commands/zlexcount.test.ts +0 -22
- package/pkg/commands/zlexcount.ts +0 -9
- package/pkg/commands/zpopmax.test.ts +0 -45
- package/pkg/commands/zpopmax.ts +0 -13
- package/pkg/commands/zpopmin.test.ts +0 -49
- package/pkg/commands/zpopmin.ts +0 -13
- package/pkg/commands/zrange.test.ts +0 -52
- package/pkg/commands/zrange.ts +0 -22
- package/pkg/commands/zrank.test.ts +0 -22
- package/pkg/commands/zrank.ts +0 -10
- package/pkg/commands/zrem.test.ts +0 -20
- package/pkg/commands/zrem.ts +0 -10
- package/pkg/commands/zremrangebylex.test.ts +0 -26
- package/pkg/commands/zremrangebylex.ts +0 -9
- package/pkg/commands/zremrangebyrank.test.ts +0 -27
- package/pkg/commands/zremrangebyrank.ts +0 -9
- package/pkg/commands/zremrangebyscore.test.ts +0 -24
- package/pkg/commands/zremrangebyscore.ts +0 -9
- package/pkg/commands/zrevrank.test.ts +0 -22
- package/pkg/commands/zrevrank.ts +0 -10
- package/pkg/commands/zscan.test.ts +0 -50
- package/pkg/commands/zscan.ts +0 -22
- package/pkg/commands/zscore.test.ts +0 -18
- package/pkg/commands/zscore.ts +0 -10
- package/pkg/commands/zunionstore.test.ts +0 -215
- package/pkg/commands/zunionstore.ts +0 -55
- package/pkg/commands/zz.ts +0 -1
- package/pkg/error.ts +0 -9
- package/pkg/fastly.ts +0 -54
- package/pkg/http.test.ts +0 -34
- package/pkg/http.ts +0 -62
- package/pkg/index.ts +0 -2
- package/pkg/nodejs.ts +0 -83
- package/pkg/pipeline.test.ts +0 -177
- package/pkg/pipeline.ts +0 -999
- package/pkg/redis.ts +0 -930
- package/pkg/test-utils.ts +0 -41
- package/pkg/types.ts +0 -4
- package/pkg/util.ts +0 -22
- package/pnpm-lock.yaml +0 -3940
- package/tsconfig.json +0 -100
- package/tsconfig.module.json +0 -8
- package/tsup.config.ts +0 -16
package/pkg/pipeline.ts
DELETED
|
@@ -1,999 +0,0 @@
|
|
|
1
|
-
import { NonEmptyArray } from "./types"
|
|
2
|
-
import { Command } from "./command"
|
|
3
|
-
import {
|
|
4
|
-
AppendCommand,
|
|
5
|
-
BitCountCommand,
|
|
6
|
-
BitOpCommand,
|
|
7
|
-
BitPosCommand,
|
|
8
|
-
DBSizeCommand,
|
|
9
|
-
DecrByCommand,
|
|
10
|
-
DecrCommand,
|
|
11
|
-
DelCommand,
|
|
12
|
-
EchoCommand,
|
|
13
|
-
ExistsCommand,
|
|
14
|
-
ExpireAtCommand,
|
|
15
|
-
ExpireCommand,
|
|
16
|
-
FlushAllCommand,
|
|
17
|
-
FlushDBCommand,
|
|
18
|
-
GetBitCommand,
|
|
19
|
-
GetCommand,
|
|
20
|
-
GetRangeCommand,
|
|
21
|
-
GetSetCommand,
|
|
22
|
-
HDelCommand,
|
|
23
|
-
HExistsCommand,
|
|
24
|
-
HGetAllCommand,
|
|
25
|
-
HGetCommand,
|
|
26
|
-
HIncrByCommand,
|
|
27
|
-
HIncrByFloatCommand,
|
|
28
|
-
HKeysCommand,
|
|
29
|
-
HLenCommand,
|
|
30
|
-
HMGetCommand,
|
|
31
|
-
HMSetCommand,
|
|
32
|
-
HScanCommand,
|
|
33
|
-
HSetCommand,
|
|
34
|
-
HSetNXCommand,
|
|
35
|
-
HStrLenCommand,
|
|
36
|
-
HValsCommand,
|
|
37
|
-
IncrByCommand,
|
|
38
|
-
IncrCommand,
|
|
39
|
-
KeysCommand,
|
|
40
|
-
LIndexCommand,
|
|
41
|
-
LInsertCommand,
|
|
42
|
-
LLenCommand,
|
|
43
|
-
LPopCommand,
|
|
44
|
-
LPushCommand,
|
|
45
|
-
LPushXCommand,
|
|
46
|
-
LRangeCommand,
|
|
47
|
-
LRemCommand,
|
|
48
|
-
LSetCommand,
|
|
49
|
-
LTrimCommand,
|
|
50
|
-
MGetCommand,
|
|
51
|
-
MSetCommand,
|
|
52
|
-
MSetNXCommand,
|
|
53
|
-
PersistCommand,
|
|
54
|
-
PExpireAtCommand,
|
|
55
|
-
PExpireCommand,
|
|
56
|
-
PingCommand,
|
|
57
|
-
PSetEXCommand,
|
|
58
|
-
PTtlCommand,
|
|
59
|
-
RandomKeyCommand,
|
|
60
|
-
RenameCommand,
|
|
61
|
-
RenameNXCommand,
|
|
62
|
-
RPopCommand,
|
|
63
|
-
RPushCommand,
|
|
64
|
-
RPushXCommand,
|
|
65
|
-
SAddCommand,
|
|
66
|
-
ScanCommand,
|
|
67
|
-
SCardCommand,
|
|
68
|
-
SDiffCommand,
|
|
69
|
-
SDiffStoreCommand,
|
|
70
|
-
SetBitCommand,
|
|
71
|
-
SetCommand,
|
|
72
|
-
SetExCommand,
|
|
73
|
-
SetNxCommand,
|
|
74
|
-
SetRangeCommand,
|
|
75
|
-
SInterCommand,
|
|
76
|
-
SIsMemberCommand,
|
|
77
|
-
SMembersCommand,
|
|
78
|
-
SMoveCommand,
|
|
79
|
-
SPopCommand,
|
|
80
|
-
SRemCommand,
|
|
81
|
-
SScanCommand,
|
|
82
|
-
StrLenCommand,
|
|
83
|
-
SUnionCommand,
|
|
84
|
-
TimeCommand,
|
|
85
|
-
TouchCommand,
|
|
86
|
-
TtlCommand,
|
|
87
|
-
TypeCommand,
|
|
88
|
-
UnlinkCommand,
|
|
89
|
-
ZAddCommand,
|
|
90
|
-
ZCardCommand,
|
|
91
|
-
ZCountCommand,
|
|
92
|
-
ZIncrByComand,
|
|
93
|
-
ZLexCountCommand,
|
|
94
|
-
ZPopMaxCommand,
|
|
95
|
-
ZPopMinCommand,
|
|
96
|
-
ZRangeCommand,
|
|
97
|
-
ZRankCommand,
|
|
98
|
-
ZRemCommand,
|
|
99
|
-
ZRemRangeByLexCommand,
|
|
100
|
-
ZRemRangeByRankCommand,
|
|
101
|
-
ZRevRankCommand,
|
|
102
|
-
ZScanCommand,
|
|
103
|
-
ZScoreCommand,
|
|
104
|
-
SetCommandOptions,
|
|
105
|
-
ScoreMember,
|
|
106
|
-
ZAddCommandOptions,
|
|
107
|
-
ZAddCommandOptionsWithIncr,
|
|
108
|
-
IncrByFloatCommand,
|
|
109
|
-
SInterStoreCommand,
|
|
110
|
-
SRandMemberCommand,
|
|
111
|
-
SUnionStoreCommand,
|
|
112
|
-
ZInterStoreCommand,
|
|
113
|
-
ZRemRangeByScoreCommand,
|
|
114
|
-
ZUnionStoreCommand,
|
|
115
|
-
} from "./commands"
|
|
116
|
-
import { HttpClient } from "./http"
|
|
117
|
-
import { CommandArgs } from "./types"
|
|
118
|
-
import { UpstashError } from "./error"
|
|
119
|
-
import { UpstashResponse } from "./http"
|
|
120
|
-
/**
|
|
121
|
-
* Upstash REST API supports command pipelining to send multiple commands in
|
|
122
|
-
* batch, instead of sending each command one by one and waiting for a response.
|
|
123
|
-
* When using pipelines, several commands are sent using a single HTTP request,
|
|
124
|
-
* and a single JSON array response is returned. Each item in the response array
|
|
125
|
-
* corresponds to the command in the same order within the pipeline.
|
|
126
|
-
*
|
|
127
|
-
* **NOTE:**
|
|
128
|
-
*
|
|
129
|
-
* Execution of the pipeline is not atomic. Even though each command in
|
|
130
|
-
* the pipeline will be executed in order, commands sent by other clients can
|
|
131
|
-
* interleave with the pipeline.
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* **Examples:**
|
|
135
|
-
*
|
|
136
|
-
* ```ts
|
|
137
|
-
* const p = redis.pipeline()
|
|
138
|
-
* p.set("key","value")
|
|
139
|
-
* p.get("key")
|
|
140
|
-
* const res = await p.exec()
|
|
141
|
-
* ```
|
|
142
|
-
*
|
|
143
|
-
* You can also chain commands together
|
|
144
|
-
* ```ts
|
|
145
|
-
* const p = redis.pipeline()
|
|
146
|
-
* const res = await p.set("key","value").get("key").exec()
|
|
147
|
-
* ```
|
|
148
|
-
*
|
|
149
|
-
* It's not possible to infer correct types with a dynamic pipeline, so you can
|
|
150
|
-
* override the response type manually:
|
|
151
|
-
* ```ts
|
|
152
|
-
* redis.pipeline()
|
|
153
|
-
* .set("key", { greeting: "hello"})
|
|
154
|
-
* .get("key")
|
|
155
|
-
* .exec<["OK", { greeting: string } ]>()
|
|
156
|
-
*
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
export class Pipeline {
|
|
160
|
-
private client: HttpClient
|
|
161
|
-
private commands: Command<unknown, unknown>[]
|
|
162
|
-
|
|
163
|
-
constructor(client: HttpClient) {
|
|
164
|
-
this.client = client
|
|
165
|
-
|
|
166
|
-
this.commands = []
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Send the pipeline request to upstash.
|
|
171
|
-
*
|
|
172
|
-
* Returns an array with the results of all pipelined commands.
|
|
173
|
-
*
|
|
174
|
-
* You can define a return type manually to make working in typescript easier
|
|
175
|
-
* ```ts
|
|
176
|
-
* redis.pipeline().get("key").exec<[{ greeting: string }]>()
|
|
177
|
-
* ```
|
|
178
|
-
*/
|
|
179
|
-
public async exec<TCommandResults extends unknown[] = unknown[]>(): Promise<TCommandResults> {
|
|
180
|
-
if (this.commands.length === 0) {
|
|
181
|
-
throw new Error("Pipeline is empty")
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const res = await this.client.request<UpstashResponse<any>[]>({
|
|
185
|
-
path: ["pipeline"],
|
|
186
|
-
body: Object.values(this.commands).map((c) => c.command),
|
|
187
|
-
})
|
|
188
|
-
return res.map(({ error, result }, i) => {
|
|
189
|
-
if (error) {
|
|
190
|
-
throw new UpstashError(
|
|
191
|
-
`Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`,
|
|
192
|
-
)
|
|
193
|
-
}
|
|
194
|
-
return this.commands[i].deserialize(result)
|
|
195
|
-
}) as TCommandResults
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Pushes a command into the pipelien and returns a chainable instance of the
|
|
200
|
-
* pipeline
|
|
201
|
-
*/
|
|
202
|
-
private chain<T>(command: Command<T, any>): this {
|
|
203
|
-
this.commands.push(command)
|
|
204
|
-
return this
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* @see https://redis.io/commands/append
|
|
209
|
-
*/
|
|
210
|
-
public append(...args: CommandArgs<typeof AppendCommand>): this {
|
|
211
|
-
return this.chain(new AppendCommand(...args))
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* @see https://redis.io/commands/bitcount
|
|
216
|
-
*/
|
|
217
|
-
public bitcount(...args: CommandArgs<typeof BitCountCommand>): this {
|
|
218
|
-
return this.chain(new BitCountCommand(...args))
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* @see https://redis.io/commands/bitop
|
|
223
|
-
*/
|
|
224
|
-
public bitop(
|
|
225
|
-
op: "and" | "or" | "xor",
|
|
226
|
-
destinationKey: string,
|
|
227
|
-
sourceKey: string,
|
|
228
|
-
...sourceKeys: string[]
|
|
229
|
-
): this
|
|
230
|
-
// eslint-disable-next-line no-dupe-class-members,@typescript-eslint/no-unused-vars
|
|
231
|
-
public bitop(op: "not", destinationKey: string, sourceKey: string): this
|
|
232
|
-
|
|
233
|
-
// eslint-disable-next-line no-dupe-class-members,@typescript-eslint/no-unused-vars
|
|
234
|
-
public bitop(
|
|
235
|
-
op: "and" | "or" | "xor" | "not",
|
|
236
|
-
destinationKey: string,
|
|
237
|
-
sourceKey: string,
|
|
238
|
-
...sourceKeys: string[]
|
|
239
|
-
): this {
|
|
240
|
-
return this.chain(new BitOpCommand(op as any, destinationKey, sourceKey, ...sourceKeys))
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* @see https://redis.io/commands/bitpos
|
|
245
|
-
*/
|
|
246
|
-
public bitpos(...args: CommandArgs<typeof BitPosCommand>): this {
|
|
247
|
-
return this.chain(new BitPosCommand(...args))
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* @see https://redis.io/commands/dbsize
|
|
252
|
-
*/
|
|
253
|
-
public dbsize(): this {
|
|
254
|
-
return this.chain(new DBSizeCommand())
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* @see https://redis.io/commands/decr
|
|
259
|
-
*/
|
|
260
|
-
public decr(...args: CommandArgs<typeof DecrCommand>): this {
|
|
261
|
-
return this.chain(new DecrCommand(...args))
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* @see https://redis.io/commands/decrby
|
|
266
|
-
*/
|
|
267
|
-
public decrby(...args: CommandArgs<typeof DecrByCommand>): this {
|
|
268
|
-
return this.chain(new DecrByCommand(...args))
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* @see https://redis.io/commands/del
|
|
273
|
-
*/
|
|
274
|
-
public del(...args: CommandArgs<typeof DelCommand>): this {
|
|
275
|
-
return this.chain(new DelCommand(...args))
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* @see https://redis.io/commands/echo
|
|
280
|
-
*/
|
|
281
|
-
public echo(...args: CommandArgs<typeof EchoCommand>): this {
|
|
282
|
-
return this.chain(new EchoCommand(...args))
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @see https://redis.io/commands/exists
|
|
287
|
-
*/
|
|
288
|
-
public exists(...args: CommandArgs<typeof ExistsCommand>): this {
|
|
289
|
-
return this.chain(new ExistsCommand(...args))
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* @see https://redis.io/commands/expire
|
|
294
|
-
*/
|
|
295
|
-
public expire(...args: CommandArgs<typeof ExpireCommand>): this {
|
|
296
|
-
return this.chain(new ExpireCommand(...args))
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* @see https://redis.io/commands/expireat
|
|
301
|
-
*/
|
|
302
|
-
public expireat(...args: CommandArgs<typeof ExpireAtCommand>): this {
|
|
303
|
-
return this.chain(new ExpireAtCommand(...args))
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* @see https://redis.io/commands/flushall
|
|
308
|
-
*/
|
|
309
|
-
public flushall(...args: CommandArgs<typeof FlushAllCommand>): this {
|
|
310
|
-
return this.chain(new FlushAllCommand(...args))
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
* @see https://redis.io/commands/flushdb
|
|
315
|
-
*/
|
|
316
|
-
public flushdb(...args: CommandArgs<typeof FlushDBCommand>): this {
|
|
317
|
-
return this.chain(new FlushDBCommand(...args))
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* @see https://redis.io/commands/get
|
|
322
|
-
*/
|
|
323
|
-
public get<TData>(...args: CommandArgs<typeof GetCommand>): this {
|
|
324
|
-
return this.chain(new GetCommand<TData>(...args))
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* @see https://redis.io/commands/getbit
|
|
329
|
-
*/
|
|
330
|
-
public getbit(...args: CommandArgs<typeof GetBitCommand>): this {
|
|
331
|
-
return this.chain(new GetBitCommand(...args))
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* @see https://redis.io/commands/getrange
|
|
336
|
-
*/
|
|
337
|
-
public getrange(...args: CommandArgs<typeof GetRangeCommand>): this {
|
|
338
|
-
return this.chain(new GetRangeCommand(...args))
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @see https://redis.io/commands/getset
|
|
343
|
-
*/
|
|
344
|
-
public getset<TData>(key: string, value: TData): this {
|
|
345
|
-
return this.chain(new GetSetCommand<TData>(key, value))
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* @see https://redis.io/commands/hdel
|
|
350
|
-
*/
|
|
351
|
-
public hdel(...args: CommandArgs<typeof HDelCommand>): this {
|
|
352
|
-
return this.chain(new HDelCommand(...args))
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* @see https://redis.io/commands/hexists
|
|
357
|
-
*/
|
|
358
|
-
public hexists(...args: CommandArgs<typeof HExistsCommand>): this {
|
|
359
|
-
return this.chain(new HExistsCommand(...args))
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* @see https://redis.io/commands/hget
|
|
364
|
-
*/
|
|
365
|
-
public hget<TData>(...args: CommandArgs<typeof HGetCommand>): this {
|
|
366
|
-
return this.chain(new HGetCommand<TData>(...args))
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* @see https://redis.io/commands/hgetall
|
|
371
|
-
*/
|
|
372
|
-
public hgetall<TData extends Record<string, unknown>>(
|
|
373
|
-
...args: CommandArgs<typeof HGetAllCommand>
|
|
374
|
-
): this {
|
|
375
|
-
return this.chain(new HGetAllCommand<TData>(...args))
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* @see https://redis.io/commands/hincrby
|
|
380
|
-
*/
|
|
381
|
-
public hincrby(...args: CommandArgs<typeof HIncrByCommand>): this {
|
|
382
|
-
return this.chain(new HIncrByCommand(...args))
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* @see https://redis.io/commands/hincrbyfloat
|
|
387
|
-
*/
|
|
388
|
-
public hincrbyfloat(...args: CommandArgs<typeof HIncrByFloatCommand>): this {
|
|
389
|
-
return this.chain(new HIncrByFloatCommand(...args))
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* @see https://redis.io/commands/hkeys
|
|
394
|
-
*/
|
|
395
|
-
public hkeys(...args: CommandArgs<typeof HKeysCommand>): this {
|
|
396
|
-
return this.chain(new HKeysCommand(...args))
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* @see https://redis.io/commands/hlen
|
|
401
|
-
*/
|
|
402
|
-
public hlen(...args: CommandArgs<typeof HLenCommand>): this {
|
|
403
|
-
return this.chain(new HLenCommand(...args))
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* @see https://redis.io/commands/hmget
|
|
408
|
-
*/
|
|
409
|
-
public hmget<TData extends Record<string, unknown>>(
|
|
410
|
-
...args: CommandArgs<typeof HMGetCommand>
|
|
411
|
-
): this {
|
|
412
|
-
return this.chain(new HMGetCommand<TData>(...args))
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* @see https://redis.io/commands/hmset
|
|
417
|
-
*/
|
|
418
|
-
public hmset<TData>(key: string, kv: { [field: string]: TData }): this {
|
|
419
|
-
return this.chain(new HMSetCommand(key, kv))
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* @see https://redis.io/commands/hscan
|
|
424
|
-
*/
|
|
425
|
-
public hscan(...args: CommandArgs<typeof HScanCommand>): this {
|
|
426
|
-
return this.chain(new HScanCommand(...args))
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* @see https://redis.io/commands/hset
|
|
431
|
-
*/
|
|
432
|
-
public hset<TData>(key: string, field: string, value: TData): this {
|
|
433
|
-
return this.chain(new HSetCommand<TData>(key, field, value))
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* @see https://redis.io/commands/hsetnx
|
|
438
|
-
*/
|
|
439
|
-
public hsetnx<TData>(key: string, field: string, value: TData): this {
|
|
440
|
-
return this.chain(new HSetNXCommand<TData>(key, field, value))
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* @see https://redis.io/commands/hstrlen
|
|
445
|
-
*/
|
|
446
|
-
public hstrlen(...args: CommandArgs<typeof HStrLenCommand>): this {
|
|
447
|
-
return this.chain(new HStrLenCommand(...args))
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
* @see https://redis.io/commands/hvals
|
|
452
|
-
*/
|
|
453
|
-
public hvals(...args: CommandArgs<typeof HValsCommand>): this {
|
|
454
|
-
return this.chain(new HValsCommand(...args))
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* @see https://redis.io/commands/incr
|
|
459
|
-
*/
|
|
460
|
-
public incr(...args: CommandArgs<typeof IncrCommand>): this {
|
|
461
|
-
return this.chain(new IncrCommand(...args))
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* @see https://redis.io/commands/incrby
|
|
466
|
-
*/
|
|
467
|
-
public incrby(...args: CommandArgs<typeof IncrByCommand>): this {
|
|
468
|
-
return this.chain(new IncrByCommand(...args))
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @see https://redis.io/commands/incrbyfloat
|
|
473
|
-
*/
|
|
474
|
-
public incrbyfloat(...args: CommandArgs<typeof IncrByFloatCommand>): this {
|
|
475
|
-
return this.chain(new IncrByFloatCommand(...args))
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* @see https://redis.io/commands/keys
|
|
480
|
-
*/
|
|
481
|
-
public keys(...args: CommandArgs<typeof KeysCommand>): this {
|
|
482
|
-
return this.chain(new KeysCommand(...args))
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* @see https://redis.io/commands/lindex
|
|
487
|
-
*/
|
|
488
|
-
public lindex(...args: CommandArgs<typeof LIndexCommand>): this {
|
|
489
|
-
return this.chain(new LIndexCommand(...args))
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* @see https://redis.io/commands/linsert
|
|
494
|
-
*/
|
|
495
|
-
public linsert<TData>(
|
|
496
|
-
key: string,
|
|
497
|
-
direction: "before" | "after",
|
|
498
|
-
pivot: TData,
|
|
499
|
-
value: TData,
|
|
500
|
-
): this {
|
|
501
|
-
return this.chain(new LInsertCommand<TData>(key, direction, pivot, value))
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* @see https://redis.io/commands/llen
|
|
506
|
-
*/
|
|
507
|
-
public llen(...args: CommandArgs<typeof LLenCommand>): this {
|
|
508
|
-
return this.chain(new LLenCommand(...args))
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* @see https://redis.io/commands/lpop
|
|
513
|
-
*/
|
|
514
|
-
public lpop<TData>(...args: CommandArgs<typeof LPopCommand>): this {
|
|
515
|
-
return this.chain(new LPopCommand<TData>(...args))
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* @see https://redis.io/commands/lpush
|
|
520
|
-
*/
|
|
521
|
-
public lpush<TData>(key: string, ...elements: NonEmptyArray<TData>): this {
|
|
522
|
-
return this.chain(new LPushCommand<TData>(key, ...elements))
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* @see https://redis.io/commands/lpushx
|
|
527
|
-
*/
|
|
528
|
-
public lpushx<TData>(key: string, ...elements: NonEmptyArray<TData>): this {
|
|
529
|
-
return this.chain(new LPushXCommand<TData>(key, ...elements))
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* @see https://redis.io/commands/lrange
|
|
534
|
-
*/
|
|
535
|
-
public lrange<TResult = string>(...args: CommandArgs<typeof LRangeCommand>): this {
|
|
536
|
-
return this.chain(new LRangeCommand<TResult>(...args))
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* @see https://redis.io/commands/lrem
|
|
541
|
-
*/
|
|
542
|
-
public lrem<TData>(key: string, count: number, value: TData): this {
|
|
543
|
-
return this.chain(new LRemCommand(key, count, value))
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* @see https://redis.io/commands/lset
|
|
548
|
-
*/
|
|
549
|
-
public lset<TData>(key: string, value: TData, index: number): this {
|
|
550
|
-
return this.chain(new LSetCommand(key, value, index))
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* @see https://redis.io/commands/ltrim
|
|
555
|
-
*/
|
|
556
|
-
public ltrim(...args: CommandArgs<typeof LTrimCommand>): this {
|
|
557
|
-
return this.chain(new LTrimCommand(...args))
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* @see https://redis.io/commands/mget
|
|
562
|
-
*/
|
|
563
|
-
public mget<TData extends [unknown, ...unknown[]]>(
|
|
564
|
-
...args: CommandArgs<typeof MGetCommand>
|
|
565
|
-
): this {
|
|
566
|
-
return this.chain(new MGetCommand<TData>(...args))
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* @see https://redis.io/commands/mset
|
|
571
|
-
*/
|
|
572
|
-
public mset<TData>(kv: { [key: string]: TData }): this {
|
|
573
|
-
return this.chain(new MSetCommand<TData>(kv))
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* @see https://redis.io/commands/msetnx
|
|
578
|
-
*/
|
|
579
|
-
public msetnx<TData>(kv: { [key: string]: TData }): this {
|
|
580
|
-
return this.chain(new MSetNXCommand<TData>(kv))
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* @see https://redis.io/commands/persist
|
|
585
|
-
*/
|
|
586
|
-
public persist(...args: CommandArgs<typeof PersistCommand>): this {
|
|
587
|
-
return this.chain(new PersistCommand(...args))
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* @see https://redis.io/commands/pexpire
|
|
592
|
-
*/
|
|
593
|
-
public pexpire(...args: CommandArgs<typeof PExpireCommand>): this {
|
|
594
|
-
return this.chain(new PExpireCommand(...args))
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* @see https://redis.io/commands/pexpireat
|
|
599
|
-
*/
|
|
600
|
-
public pexpireat(...args: CommandArgs<typeof PExpireAtCommand>): this {
|
|
601
|
-
return this.chain(new PExpireAtCommand(...args))
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* @see https://redis.io/commands/ping
|
|
606
|
-
*/
|
|
607
|
-
public ping(...args: CommandArgs<typeof PingCommand>): this {
|
|
608
|
-
return this.chain(new PingCommand(...args))
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* @see https://redis.io/commands/psetex
|
|
613
|
-
*/
|
|
614
|
-
public psetex<TData>(key: string, ttl: number, value: TData): this {
|
|
615
|
-
return this.chain(new PSetEXCommand<TData>(key, ttl, value))
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
/**
|
|
619
|
-
* @see https://redis.io/commands/pttl
|
|
620
|
-
*/
|
|
621
|
-
public pttl(...args: CommandArgs<typeof PTtlCommand>): this {
|
|
622
|
-
return this.chain(new PTtlCommand(...args))
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* @see https://redis.io/commands/randomkey
|
|
627
|
-
*/
|
|
628
|
-
public randomkey(): this {
|
|
629
|
-
return this.chain(new RandomKeyCommand())
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* @see https://redis.io/commands/rename
|
|
634
|
-
*/
|
|
635
|
-
public rename(...args: CommandArgs<typeof RenameCommand>): this {
|
|
636
|
-
return this.chain(new RenameCommand(...args))
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
/**
|
|
640
|
-
* @see https://redis.io/commands/renamenx
|
|
641
|
-
*/
|
|
642
|
-
public renamenx(...args: CommandArgs<typeof RenameNXCommand>): this {
|
|
643
|
-
return this.chain(new RenameNXCommand(...args))
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
/**
|
|
647
|
-
* @see https://redis.io/commands/rpop
|
|
648
|
-
*/
|
|
649
|
-
public rpop<TData = string>(...args: CommandArgs<typeof RPopCommand>): this {
|
|
650
|
-
return this.chain(new RPopCommand<TData>(...args))
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
/**
|
|
654
|
-
* @see https://redis.io/commands/rpush
|
|
655
|
-
*/
|
|
656
|
-
public rpush<TData>(key: string, ...elements: NonEmptyArray<TData>): this {
|
|
657
|
-
return this.chain(new RPushCommand(key, ...elements))
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* @see https://redis.io/commands/rpushx
|
|
662
|
-
*/
|
|
663
|
-
public rpushx<TData>(key: string, ...elements: NonEmptyArray<TData>): this {
|
|
664
|
-
return this.chain(new RPushXCommand(key, ...elements))
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* @see https://redis.io/commands/sadd
|
|
669
|
-
*/
|
|
670
|
-
public sadd<TData>(key: string, ...members: NonEmptyArray<TData>): this {
|
|
671
|
-
return this.chain(new SAddCommand<TData>(key, ...members))
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* @see https://redis.io/commands/scan
|
|
676
|
-
*/
|
|
677
|
-
public scan(...args: CommandArgs<typeof ScanCommand>): this {
|
|
678
|
-
return this.chain(new ScanCommand(...args))
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* @see https://redis.io/commands/scard
|
|
683
|
-
*/
|
|
684
|
-
public scard(...args: CommandArgs<typeof SCardCommand>): this {
|
|
685
|
-
return this.chain(new SCardCommand(...args))
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* @see https://redis.io/commands/sdiff
|
|
690
|
-
*/
|
|
691
|
-
public sdiff(...args: CommandArgs<typeof SDiffCommand>): this {
|
|
692
|
-
return this.chain(new SDiffCommand(...args))
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* @see https://redis.io/commands/sdiffstore
|
|
697
|
-
*/
|
|
698
|
-
public sdiffstore(...args: CommandArgs<typeof SDiffStoreCommand>): this {
|
|
699
|
-
return this.chain(new SDiffStoreCommand(...args))
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* @see https://redis.io/commands/set
|
|
704
|
-
*/
|
|
705
|
-
public set<TData>(key: string, value: TData, opts?: SetCommandOptions): this {
|
|
706
|
-
return this.chain(new SetCommand<TData>(key, value, opts))
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* @see https://redis.io/commands/setbit
|
|
711
|
-
*/
|
|
712
|
-
public setbit(...args: CommandArgs<typeof SetBitCommand>): this {
|
|
713
|
-
return this.chain(new SetBitCommand(...args))
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* @see https://redis.io/commands/setex
|
|
718
|
-
*/
|
|
719
|
-
public setex<TData>(key: string, ttl: number, value: TData): this {
|
|
720
|
-
return this.chain(new SetExCommand<TData>(key, ttl, value))
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* @see https://redis.io/commands/setnx
|
|
725
|
-
*/
|
|
726
|
-
public setnx<TData>(key: string, value: TData): this {
|
|
727
|
-
return this.chain(new SetNxCommand<TData>(key, value))
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* @see https://redis.io/commands/setrange
|
|
732
|
-
*/
|
|
733
|
-
public setrange(...args: CommandArgs<typeof SetRangeCommand>): this {
|
|
734
|
-
return this.chain(new SetRangeCommand(...args))
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
/**
|
|
738
|
-
* @see https://redis.io/commands/sinter
|
|
739
|
-
*/
|
|
740
|
-
public sinter(...args: CommandArgs<typeof SInterCommand>): this {
|
|
741
|
-
return this.chain(new SInterCommand(...args))
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* @see https://redis.io/commands/sinterstore
|
|
746
|
-
*/
|
|
747
|
-
public sinterstore(...args: CommandArgs<typeof SInterStoreCommand>): this {
|
|
748
|
-
return this.chain(new SInterStoreCommand(...args))
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
/**
|
|
752
|
-
* @see https://redis.io/commands/sismember
|
|
753
|
-
*/
|
|
754
|
-
public sismember<TData>(key: string, member: TData): this {
|
|
755
|
-
return this.chain(new SIsMemberCommand<TData>(key, member))
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
/**
|
|
759
|
-
* @see https://redis.io/commands/smembers
|
|
760
|
-
*/
|
|
761
|
-
public smembers(...args: CommandArgs<typeof SMembersCommand>): this {
|
|
762
|
-
return this.chain(new SMembersCommand(...args))
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* @see https://redis.io/commands/smove
|
|
767
|
-
*/
|
|
768
|
-
public smove<TData>(source: string, destination: string, member: TData): this {
|
|
769
|
-
return this.chain(new SMoveCommand<TData>(source, destination, member))
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* @see https://redis.io/commands/spop
|
|
774
|
-
*/
|
|
775
|
-
public spop<TData>(...args: CommandArgs<typeof SPopCommand>): this {
|
|
776
|
-
return this.chain(new SPopCommand<TData>(...args))
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
/**
|
|
780
|
-
* @see https://redis.io/commands/srandmember
|
|
781
|
-
*/
|
|
782
|
-
public srandmember<TData>(...args: CommandArgs<typeof SRandMemberCommand>): this {
|
|
783
|
-
return this.chain(new SRandMemberCommand<TData>(...args))
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* @see https://redis.io/commands/srem
|
|
788
|
-
*/
|
|
789
|
-
public srem<TData>(key: string, ...members: NonEmptyArray<TData>): this {
|
|
790
|
-
return this.chain(new SRemCommand<TData>(key, ...members))
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
* @see https://redis.io/commands/sscan
|
|
795
|
-
*/
|
|
796
|
-
public sscan(...args: CommandArgs<typeof SScanCommand>): this {
|
|
797
|
-
return this.chain(new SScanCommand(...args))
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
/**
|
|
801
|
-
* @see https://redis.io/commands/strlen
|
|
802
|
-
*/
|
|
803
|
-
public strlen(...args: CommandArgs<typeof StrLenCommand>): this {
|
|
804
|
-
return this.chain(new StrLenCommand(...args))
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* @see https://redis.io/commands/sunion
|
|
809
|
-
*/
|
|
810
|
-
public sunion(...args: CommandArgs<typeof SUnionCommand>): this {
|
|
811
|
-
return this.chain(new SUnionCommand(...args))
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* @see https://redis.io/commands/sunionstore
|
|
815
|
-
*/
|
|
816
|
-
public sunionstore(...args: CommandArgs<typeof SUnionStoreCommand>): this {
|
|
817
|
-
return this.chain(new SUnionStoreCommand(...args))
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
/**
|
|
821
|
-
* @see https://redis.io/commands/time
|
|
822
|
-
*/
|
|
823
|
-
public time(): this {
|
|
824
|
-
return this.chain(new TimeCommand())
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* @see https://redis.io/commands/touch
|
|
829
|
-
*/
|
|
830
|
-
public touch(...args: CommandArgs<typeof TouchCommand>): this {
|
|
831
|
-
return this.chain(new TouchCommand(...args))
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* @see https://redis.io/commands/ttl
|
|
836
|
-
*/
|
|
837
|
-
public ttl(...args: CommandArgs<typeof TtlCommand>): this {
|
|
838
|
-
return this.chain(new TtlCommand(...args))
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* @see https://redis.io/commands/type
|
|
843
|
-
*/
|
|
844
|
-
public type(...args: CommandArgs<typeof TypeCommand>): this {
|
|
845
|
-
return this.chain(new TypeCommand(...args))
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* @see https://redis.io/commands/unlink
|
|
850
|
-
*/
|
|
851
|
-
public unlink(...args: CommandArgs<typeof UnlinkCommand>): this {
|
|
852
|
-
return this.chain(new UnlinkCommand(...args))
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
/**
|
|
856
|
-
* @see https://redis.io/commands/zadd
|
|
857
|
-
*/
|
|
858
|
-
// eslint-disable-next-line no-dupe-class-members,@typescript-eslint/no-unused-vars
|
|
859
|
-
public zadd<TData>(
|
|
860
|
-
key: string,
|
|
861
|
-
scoreMember: ScoreMember<TData>,
|
|
862
|
-
...scoreMemberPairs: ScoreMember<TData>[]
|
|
863
|
-
): this
|
|
864
|
-
// eslint-disable-next-line no-dupe-class-members,@typescript-eslint/no-unused-vars
|
|
865
|
-
public zadd<TData>(
|
|
866
|
-
key: string,
|
|
867
|
-
opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr,
|
|
868
|
-
...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]
|
|
869
|
-
): this
|
|
870
|
-
// eslint-disable-next-line no-dupe-class-members
|
|
871
|
-
public zadd<TData>(
|
|
872
|
-
key: string,
|
|
873
|
-
arg1: ScoreMember<TData> | ZAddCommandOptions | ZAddCommandOptionsWithIncr,
|
|
874
|
-
...arg2: ScoreMember<TData>[]
|
|
875
|
-
): this {
|
|
876
|
-
// if ("score" in arg1) {
|
|
877
|
-
// return this.chain(new ZAddCommand<TData>(key, arg1 as ScoreMember<TData>, ...arg2))
|
|
878
|
-
// }
|
|
879
|
-
return this.chain(new ZAddCommand<TData>(key, arg1 as any, ...arg2))
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
/**
|
|
883
|
-
* @see https://redis.io/commands/zcard
|
|
884
|
-
*/
|
|
885
|
-
public zcard(...args: CommandArgs<typeof ZCardCommand>): this {
|
|
886
|
-
return this.chain(new ZCardCommand(...args))
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
/**
|
|
890
|
-
* @see https://redis.io/commands/zcount
|
|
891
|
-
*/
|
|
892
|
-
public zcount(...args: CommandArgs<typeof ZCountCommand>): this {
|
|
893
|
-
return this.chain(new ZCountCommand(...args))
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
/**
|
|
897
|
-
* @see https://redis.io/commands/zincrby
|
|
898
|
-
*/
|
|
899
|
-
public zincrby<TData>(key: string, increment: number, member: TData): this {
|
|
900
|
-
return this.chain(new ZIncrByComand<TData>(key, increment, member))
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* @see https://redis.io/commands/zinterstore
|
|
905
|
-
*/
|
|
906
|
-
public zinterstore(...args: CommandArgs<typeof ZInterStoreCommand>): this {
|
|
907
|
-
return this.chain(new ZInterStoreCommand(...args))
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* @see https://redis.io/commands/zlexcount
|
|
912
|
-
*/
|
|
913
|
-
public zlexcount(...args: CommandArgs<typeof ZLexCountCommand>): this {
|
|
914
|
-
return this.chain(new ZLexCountCommand(...args))
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* @see https://redis.io/commands/zpopmax
|
|
919
|
-
*/
|
|
920
|
-
public zpopmax<TData>(...args: CommandArgs<typeof ZPopMaxCommand>): this {
|
|
921
|
-
return this.chain(new ZPopMaxCommand<TData>(...args))
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
/**
|
|
925
|
-
* @see https://redis.io/commands/zpopmin
|
|
926
|
-
*/
|
|
927
|
-
public zpopmin<TData>(...args: CommandArgs<typeof ZPopMinCommand>): this {
|
|
928
|
-
return this.chain(new ZPopMinCommand<TData>(...args))
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
/**
|
|
932
|
-
* @see https://redis.io/commands/zrange
|
|
933
|
-
*/
|
|
934
|
-
public zrange<TData extends unknown[]>(...args: CommandArgs<typeof ZRangeCommand>): this {
|
|
935
|
-
return this.chain(new ZRangeCommand<TData>(...args))
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/**
|
|
939
|
-
* @see https://redis.io/commands/zrank
|
|
940
|
-
*/
|
|
941
|
-
public zrank<TData>(key: string, member: TData): this {
|
|
942
|
-
return this.chain(new ZRankCommand<TData>(key, member))
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
/**
|
|
946
|
-
* @see https://redis.io/commands/zrem
|
|
947
|
-
*/
|
|
948
|
-
public zrem<TData>(key: string, ...members: NonEmptyArray<TData>): this {
|
|
949
|
-
return this.chain(new ZRemCommand<TData>(key, ...members))
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* @see https://redis.io/commands/zremrangebylex
|
|
954
|
-
*/
|
|
955
|
-
public zremrangebylex(...args: CommandArgs<typeof ZRemRangeByLexCommand>): this {
|
|
956
|
-
return this.chain(new ZRemRangeByLexCommand(...args))
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
/**
|
|
960
|
-
* @see https://redis.io/commands/zremrangebyrank
|
|
961
|
-
*/
|
|
962
|
-
public zremrangebyrank(...args: CommandArgs<typeof ZRemRangeByRankCommand>): this {
|
|
963
|
-
return this.chain(new ZRemRangeByRankCommand(...args))
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
/**
|
|
967
|
-
* @see https://redis.io/commands/zremrangebyscore
|
|
968
|
-
*/
|
|
969
|
-
public zremrangebyscore(...args: CommandArgs<typeof ZRemRangeByScoreCommand>): this {
|
|
970
|
-
return this.chain(new ZRemRangeByScoreCommand(...args))
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
/**
|
|
974
|
-
* @see https://redis.io/commands/zrevrank
|
|
975
|
-
*/
|
|
976
|
-
public zrevrank<TData>(key: string, member: TData): this {
|
|
977
|
-
return this.chain(new ZRevRankCommand<TData>(key, member))
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
/**
|
|
981
|
-
* @see https://redis.io/commands/zscan
|
|
982
|
-
*/
|
|
983
|
-
public zscan(...args: CommandArgs<typeof ZScanCommand>): this {
|
|
984
|
-
return this.chain(new ZScanCommand(...args))
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* @see https://redis.io/commands/zscore
|
|
989
|
-
*/
|
|
990
|
-
public zscore<TData>(key: string, member: TData): this {
|
|
991
|
-
return this.chain(new ZScoreCommand<TData>(key, member))
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* @see https://redis.io/commands/zunionstore
|
|
995
|
-
*/
|
|
996
|
-
public zunionstore(...args: CommandArgs<typeof ZUnionStoreCommand>): this {
|
|
997
|
-
return this.chain(new ZUnionStoreCommand(...args))
|
|
998
|
-
}
|
|
999
|
-
}
|