@upstash/redis 0.2.1 → 1.0.0-alpha.0

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/dist/index.mjs ADDED
@@ -0,0 +1,858 @@
1
+ import {
2
+ AppendCommand,
3
+ BitCountCommand,
4
+ BitOpCommand,
5
+ BitPosCommand,
6
+ DBSizeCommand,
7
+ DecrByCommand,
8
+ DecrCommand,
9
+ DelCommand,
10
+ EchoCommand,
11
+ ExistsCommand,
12
+ ExpireAtCommand,
13
+ ExpireCommand,
14
+ FlushAllCommand,
15
+ FlushDBCommand,
16
+ GetBitCommand,
17
+ GetCommand,
18
+ GetRangeCommand,
19
+ GetSetCommand,
20
+ HDelCommand,
21
+ HExistsCommand,
22
+ HGetAllCommand,
23
+ HGetCommand,
24
+ HIncrByCommand,
25
+ HIncrByFloatCommand,
26
+ HKeysCommand,
27
+ HLenCommand,
28
+ HMGetCommand,
29
+ HMSetCommand,
30
+ HScanCommand,
31
+ HSetCommand,
32
+ HSetNXCommand,
33
+ HStrLenCommand,
34
+ HValsCommand,
35
+ IncrByCommand,
36
+ IncrByFloatCommand,
37
+ IncrCommand,
38
+ KeysCommand,
39
+ LIndexCommand,
40
+ LInsertCommand,
41
+ LLenCommand,
42
+ LPopCommand,
43
+ LPushCommand,
44
+ LPushXCommand,
45
+ LRangeCommand,
46
+ LRemCommand,
47
+ LSetCommand,
48
+ LTrimCommand,
49
+ MGetCommand,
50
+ MSetCommand,
51
+ MSetNXCommand,
52
+ PExpireAtCommand,
53
+ PExpireCommand,
54
+ PSetEXCommand,
55
+ PTtlCommand,
56
+ PersistCommand,
57
+ PingCommand,
58
+ RPopCommand,
59
+ RPushCommand,
60
+ RPushXCommand,
61
+ RandomKeyCommand,
62
+ RenameCommand,
63
+ RenameNXCommand,
64
+ SAddCommand,
65
+ SCardCommand,
66
+ SDiffCommand,
67
+ SDiffStoreCommand,
68
+ SInterCommand,
69
+ SInterStoreCommand,
70
+ SIsMemberCommand,
71
+ SMembersCommand,
72
+ SMoveCommand,
73
+ SPopCommand,
74
+ SRandMemberCommand,
75
+ SRemCommand,
76
+ SScanCommand,
77
+ SUnionCommand,
78
+ SUnionStoreCommand,
79
+ ScanCommand,
80
+ SetBitCommand,
81
+ SetCommand,
82
+ SetExCommand,
83
+ SetNxCommand,
84
+ SetRangeCommand,
85
+ StrLenCommand,
86
+ TimeCommand,
87
+ TouchCommand,
88
+ TtlCommand,
89
+ TypeCommand,
90
+ UnlinkCommand,
91
+ UpstashError,
92
+ ZAddCommand,
93
+ ZCardCommand,
94
+ ZCountCommand,
95
+ ZIncrByComand,
96
+ ZInterStoreCommand,
97
+ ZLexCountCommand,
98
+ ZPopMaxCommand,
99
+ ZPopMinCommand,
100
+ ZRangeCommand,
101
+ ZRankCommand,
102
+ ZRemCommand,
103
+ ZRemRangeByLexCommand,
104
+ ZRemRangeByRankCommand,
105
+ ZRemRangeByScoreCommand,
106
+ ZRevRankCommand,
107
+ ZScanCommand,
108
+ ZScoreCommand,
109
+ ZUnionStoreCommand,
110
+ __spreadValues
111
+ } from "./chunk-RYSRH3HC.mjs";
112
+
113
+ // pkg/http.ts
114
+ import "isomorphic-fetch";
115
+ var HttpClient = class {
116
+ constructor(config) {
117
+ var _a;
118
+ this.baseUrl = config.baseUrl.replace(/\/$/, "");
119
+ this.headers = (_a = config.headers) != null ? _a : {};
120
+ }
121
+ async request(method, req) {
122
+ if (!req.path) {
123
+ req.path = [];
124
+ }
125
+ const headers = __spreadValues(__spreadValues({
126
+ "Content-Type": "application/json"
127
+ }, this.headers), req.headers);
128
+ const res = await fetch([this.baseUrl, ...req.path].join("/"), {
129
+ method,
130
+ headers,
131
+ body: JSON.stringify(req.body)
132
+ });
133
+ const body = await res.json();
134
+ if (!res.ok) {
135
+ throw new UpstashError(body.error);
136
+ }
137
+ return body;
138
+ }
139
+ async post(req) {
140
+ return await this.request("POST", req);
141
+ }
142
+ };
143
+
144
+ // pkg/pipeline.ts
145
+ var Pipeline = class {
146
+ constructor(client) {
147
+ this.client = client;
148
+ this.commands = [];
149
+ }
150
+ async exec() {
151
+ if (this.commands.length === 0) {
152
+ throw new Error("Pipeline is empty");
153
+ }
154
+ const res = await this.client.post({
155
+ path: ["pipeline"],
156
+ body: Object.values(this.commands).map((c) => c.command)
157
+ });
158
+ return res.map(({ error, result }, i) => {
159
+ if (error) {
160
+ throw new UpstashError(`Command ${i + 1} [ ${this.commands[i].command[0]} ] failed: ${error}`);
161
+ }
162
+ return this.commands[i].deserialize(result);
163
+ });
164
+ }
165
+ chain(command) {
166
+ this.commands.push(command);
167
+ return this;
168
+ }
169
+ append(...args) {
170
+ return this.chain(new AppendCommand(...args));
171
+ }
172
+ bitcount(...args) {
173
+ return this.chain(new BitCountCommand(...args));
174
+ }
175
+ bitop(op, destinationKey, sourceKey, ...sourceKeys) {
176
+ return this.chain(new BitOpCommand(op, destinationKey, sourceKey, ...sourceKeys));
177
+ }
178
+ bitpos(...args) {
179
+ return this.chain(new BitPosCommand(...args));
180
+ }
181
+ dbsize() {
182
+ return this.chain(new DBSizeCommand());
183
+ }
184
+ decr(...args) {
185
+ return this.chain(new DecrCommand(...args));
186
+ }
187
+ decrby(...args) {
188
+ return this.chain(new DecrByCommand(...args));
189
+ }
190
+ del(...args) {
191
+ return this.chain(new DelCommand(...args));
192
+ }
193
+ echo(...args) {
194
+ return this.chain(new EchoCommand(...args));
195
+ }
196
+ exists(...args) {
197
+ return this.chain(new ExistsCommand(...args));
198
+ }
199
+ expire(...args) {
200
+ return this.chain(new ExpireCommand(...args));
201
+ }
202
+ expireat(...args) {
203
+ return this.chain(new ExpireAtCommand(...args));
204
+ }
205
+ flushall(...args) {
206
+ return this.chain(new FlushAllCommand(...args));
207
+ }
208
+ flushdb(...args) {
209
+ return this.chain(new FlushDBCommand(...args));
210
+ }
211
+ get(...args) {
212
+ return this.chain(new GetCommand(...args));
213
+ }
214
+ getbit(...args) {
215
+ return this.chain(new GetBitCommand(...args));
216
+ }
217
+ getrange(...args) {
218
+ return this.chain(new GetRangeCommand(...args));
219
+ }
220
+ getset(key, value) {
221
+ return this.chain(new GetSetCommand(key, value));
222
+ }
223
+ hdel(...args) {
224
+ return this.chain(new HDelCommand(...args));
225
+ }
226
+ hexists(...args) {
227
+ return this.chain(new HExistsCommand(...args));
228
+ }
229
+ hget(...args) {
230
+ return this.chain(new HGetCommand(...args));
231
+ }
232
+ hgetall(...args) {
233
+ return this.chain(new HGetAllCommand(...args));
234
+ }
235
+ hincrby(...args) {
236
+ return this.chain(new HIncrByCommand(...args));
237
+ }
238
+ hincrbyfloat(...args) {
239
+ return this.chain(new HIncrByFloatCommand(...args));
240
+ }
241
+ hkeys(...args) {
242
+ return this.chain(new HKeysCommand(...args));
243
+ }
244
+ hlen(...args) {
245
+ return this.chain(new HLenCommand(...args));
246
+ }
247
+ hmget(...args) {
248
+ return this.chain(new HMGetCommand(...args));
249
+ }
250
+ hmset(key, kv) {
251
+ return this.chain(new HMSetCommand(key, kv));
252
+ }
253
+ hscan(...args) {
254
+ return this.chain(new HScanCommand(...args));
255
+ }
256
+ hset(key, field, value) {
257
+ return this.chain(new HSetCommand(key, field, value));
258
+ }
259
+ hsetnx(key, field, value) {
260
+ return this.chain(new HSetNXCommand(key, field, value));
261
+ }
262
+ hstrlen(...args) {
263
+ return this.chain(new HStrLenCommand(...args));
264
+ }
265
+ hvals(...args) {
266
+ return this.chain(new HValsCommand(...args));
267
+ }
268
+ incr(...args) {
269
+ return this.chain(new IncrCommand(...args));
270
+ }
271
+ incrby(...args) {
272
+ return this.chain(new IncrByCommand(...args));
273
+ }
274
+ incrbyfloat(...args) {
275
+ return this.chain(new IncrByFloatCommand(...args));
276
+ }
277
+ keys(...args) {
278
+ return this.chain(new KeysCommand(...args));
279
+ }
280
+ lindex(...args) {
281
+ return this.chain(new LIndexCommand(...args));
282
+ }
283
+ linsert(key, direction, pivot, value) {
284
+ return this.chain(new LInsertCommand(key, direction, pivot, value));
285
+ }
286
+ llen(...args) {
287
+ return this.chain(new LLenCommand(...args));
288
+ }
289
+ lpop(...args) {
290
+ return this.chain(new LPopCommand(...args));
291
+ }
292
+ lpush(key, ...elements) {
293
+ return this.chain(new LPushCommand(key, ...elements));
294
+ }
295
+ lpushx(key, ...elements) {
296
+ return this.chain(new LPushXCommand(key, ...elements));
297
+ }
298
+ lrange(...args) {
299
+ return this.chain(new LRangeCommand(...args));
300
+ }
301
+ lrem(key, count, value) {
302
+ return this.chain(new LRemCommand(key, count, value));
303
+ }
304
+ lset(key, value, index) {
305
+ return this.chain(new LSetCommand(key, value, index));
306
+ }
307
+ ltrim(...args) {
308
+ return this.chain(new LTrimCommand(...args));
309
+ }
310
+ mget(...args) {
311
+ return this.chain(new MGetCommand(...args));
312
+ }
313
+ mset(kv) {
314
+ return this.chain(new MSetCommand(kv));
315
+ }
316
+ msetnx(kv) {
317
+ return this.chain(new MSetNXCommand(kv));
318
+ }
319
+ persist(...args) {
320
+ return this.chain(new PersistCommand(...args));
321
+ }
322
+ pexpire(...args) {
323
+ return this.chain(new PExpireCommand(...args));
324
+ }
325
+ pexpireat(...args) {
326
+ return this.chain(new PExpireAtCommand(...args));
327
+ }
328
+ ping(...args) {
329
+ return this.chain(new PingCommand(...args));
330
+ }
331
+ psetex(key, ttl, value) {
332
+ return this.chain(new PSetEXCommand(key, ttl, value));
333
+ }
334
+ pttl(...args) {
335
+ return this.chain(new PTtlCommand(...args));
336
+ }
337
+ randomkey() {
338
+ return this.chain(new RandomKeyCommand());
339
+ }
340
+ rename(...args) {
341
+ return this.chain(new RenameCommand(...args));
342
+ }
343
+ renamenx(...args) {
344
+ return this.chain(new RenameNXCommand(...args));
345
+ }
346
+ rpop(...args) {
347
+ return this.chain(new RPopCommand(...args));
348
+ }
349
+ rpush(key, ...elements) {
350
+ return this.chain(new RPushCommand(key, ...elements));
351
+ }
352
+ rpushx(key, ...elements) {
353
+ return this.chain(new RPushXCommand(key, ...elements));
354
+ }
355
+ sadd(key, ...members) {
356
+ return this.chain(new SAddCommand(key, ...members));
357
+ }
358
+ scan(...args) {
359
+ return this.chain(new ScanCommand(...args));
360
+ }
361
+ scard(...args) {
362
+ return this.chain(new SCardCommand(...args));
363
+ }
364
+ sdiff(...args) {
365
+ return this.chain(new SDiffCommand(...args));
366
+ }
367
+ sdiffstore(...args) {
368
+ return this.chain(new SDiffStoreCommand(...args));
369
+ }
370
+ set(key, value, opts) {
371
+ return this.chain(new SetCommand(key, value, opts));
372
+ }
373
+ setbit(...args) {
374
+ return this.chain(new SetBitCommand(...args));
375
+ }
376
+ setex(key, ttl, value) {
377
+ return this.chain(new SetExCommand(key, ttl, value));
378
+ }
379
+ setnx(key, value) {
380
+ return this.chain(new SetNxCommand(key, value));
381
+ }
382
+ setrange(...args) {
383
+ return this.chain(new SetRangeCommand(...args));
384
+ }
385
+ sinter(...args) {
386
+ return this.chain(new SInterCommand(...args));
387
+ }
388
+ sinterstore(...args) {
389
+ return this.chain(new SInterStoreCommand(...args));
390
+ }
391
+ sismember(key, member) {
392
+ return this.chain(new SIsMemberCommand(key, member));
393
+ }
394
+ smembers(...args) {
395
+ return this.chain(new SMembersCommand(...args));
396
+ }
397
+ smove(source, destination, member) {
398
+ return this.chain(new SMoveCommand(source, destination, member));
399
+ }
400
+ spop(...args) {
401
+ return this.chain(new SPopCommand(...args));
402
+ }
403
+ srandmember(...args) {
404
+ return this.chain(new SRandMemberCommand(...args));
405
+ }
406
+ srem(key, ...members) {
407
+ return this.chain(new SRemCommand(key, ...members));
408
+ }
409
+ sscan(...args) {
410
+ return this.chain(new SScanCommand(...args));
411
+ }
412
+ strlen(...args) {
413
+ return this.chain(new StrLenCommand(...args));
414
+ }
415
+ sunion(...args) {
416
+ return this.chain(new SUnionCommand(...args));
417
+ }
418
+ sunionstore(...args) {
419
+ return this.chain(new SUnionStoreCommand(...args));
420
+ }
421
+ time() {
422
+ return this.chain(new TimeCommand());
423
+ }
424
+ touch(...args) {
425
+ return this.chain(new TouchCommand(...args));
426
+ }
427
+ ttl(...args) {
428
+ return this.chain(new TtlCommand(...args));
429
+ }
430
+ type(...args) {
431
+ return this.chain(new TypeCommand(...args));
432
+ }
433
+ unlink(...args) {
434
+ return this.chain(new UnlinkCommand(...args));
435
+ }
436
+ zadd(key, arg1, ...arg2) {
437
+ return this.chain(new ZAddCommand(key, arg1, ...arg2));
438
+ }
439
+ zcard(...args) {
440
+ return this.chain(new ZCardCommand(...args));
441
+ }
442
+ zcount(...args) {
443
+ return this.chain(new ZCountCommand(...args));
444
+ }
445
+ zincrby(key, increment, member) {
446
+ return this.chain(new ZIncrByComand(key, increment, member));
447
+ }
448
+ zinterstore(...args) {
449
+ return this.chain(new ZInterStoreCommand(...args));
450
+ }
451
+ zlexcount(...args) {
452
+ return this.chain(new ZLexCountCommand(...args));
453
+ }
454
+ zpopmax(...args) {
455
+ return this.chain(new ZPopMaxCommand(...args));
456
+ }
457
+ zpopmin(...args) {
458
+ return this.chain(new ZPopMinCommand(...args));
459
+ }
460
+ zrange(...args) {
461
+ return this.chain(new ZRangeCommand(...args));
462
+ }
463
+ zrank(key, member) {
464
+ return this.chain(new ZRankCommand(key, member));
465
+ }
466
+ zrem(key, ...members) {
467
+ return this.chain(new ZRemCommand(key, ...members));
468
+ }
469
+ zremrangebylex(...args) {
470
+ return this.chain(new ZRemRangeByLexCommand(...args));
471
+ }
472
+ zremrangebyrank(...args) {
473
+ return this.chain(new ZRemRangeByRankCommand(...args));
474
+ }
475
+ zremrangebyscore(...args) {
476
+ return this.chain(new ZRemRangeByScoreCommand(...args));
477
+ }
478
+ zrevrank(key, member) {
479
+ return this.chain(new ZRevRankCommand(key, member));
480
+ }
481
+ zscan(...args) {
482
+ return this.chain(new ZScanCommand(...args));
483
+ }
484
+ zscore(key, member) {
485
+ return this.chain(new ZScoreCommand(key, member));
486
+ }
487
+ zunionstore(...args) {
488
+ return this.chain(new ZUnionStoreCommand(...args));
489
+ }
490
+ };
491
+
492
+ // pkg/redis.ts
493
+ var Redis = class {
494
+ constructor(config) {
495
+ this.client = new HttpClient({
496
+ baseUrl: config.url,
497
+ headers: {
498
+ authorization: `Bearer ${config.token}`
499
+ }
500
+ });
501
+ }
502
+ static fromEnv() {
503
+ if (typeof (process == null ? void 0 : process.env) === "undefined") {
504
+ throw new Error("Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please use `fromCloudflareEnv()` instead");
505
+ }
506
+ const url = process.env["UPSTASH_REDIS_REST_URL"];
507
+ if (!url) {
508
+ throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
509
+ }
510
+ const token = process.env["UPSTASH_REDIS_REST_TOKEN"];
511
+ if (!token) {
512
+ throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");
513
+ }
514
+ return new Redis({ url, token });
515
+ }
516
+ static fromCloudflareEnv() {
517
+ const url = UPSTASH_REDIS_REST_URL;
518
+ const token = UPSTASH_REDIS_REST_TOKEN;
519
+ if (!url) {
520
+ throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
521
+ }
522
+ if (!token) {
523
+ throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");
524
+ }
525
+ return new Redis({ url, token });
526
+ }
527
+ pipeline() {
528
+ return new Pipeline(this.client);
529
+ }
530
+ append(...args) {
531
+ return new AppendCommand(...args).exec(this.client);
532
+ }
533
+ bitcount(...args) {
534
+ return new BitCountCommand(...args).exec(this.client);
535
+ }
536
+ bitop(op, destinationKey, sourceKey, ...sourceKeys) {
537
+ return new BitOpCommand(op, destinationKey, sourceKey, ...sourceKeys).exec(this.client);
538
+ }
539
+ bitpos(...args) {
540
+ return new BitPosCommand(...args).exec(this.client);
541
+ }
542
+ dbsize() {
543
+ return new DBSizeCommand().exec(this.client);
544
+ }
545
+ decr(...args) {
546
+ return new DecrCommand(...args).exec(this.client);
547
+ }
548
+ decrby(...args) {
549
+ return new DecrByCommand(...args).exec(this.client);
550
+ }
551
+ del(...args) {
552
+ return new DelCommand(...args).exec(this.client);
553
+ }
554
+ echo(...args) {
555
+ return new EchoCommand(...args).exec(this.client);
556
+ }
557
+ exists(...args) {
558
+ return new ExistsCommand(...args).exec(this.client);
559
+ }
560
+ expire(...args) {
561
+ return new ExpireCommand(...args).exec(this.client);
562
+ }
563
+ expireat(...args) {
564
+ return new ExpireAtCommand(...args).exec(this.client);
565
+ }
566
+ flushall(...args) {
567
+ return new FlushAllCommand(...args).exec(this.client);
568
+ }
569
+ flushdb(...args) {
570
+ return new FlushDBCommand(...args).exec(this.client);
571
+ }
572
+ get(...args) {
573
+ return new GetCommand(...args).exec(this.client);
574
+ }
575
+ getbit(...args) {
576
+ return new GetBitCommand(...args).exec(this.client);
577
+ }
578
+ getrange(...args) {
579
+ return new GetRangeCommand(...args).exec(this.client);
580
+ }
581
+ getset(key, value) {
582
+ return new GetSetCommand(key, value).exec(this.client);
583
+ }
584
+ hdel(...args) {
585
+ return new HDelCommand(...args).exec(this.client);
586
+ }
587
+ hexists(...args) {
588
+ return new HExistsCommand(...args).exec(this.client);
589
+ }
590
+ hget(...args) {
591
+ return new HGetCommand(...args).exec(this.client);
592
+ }
593
+ hgetall(...args) {
594
+ return new HGetAllCommand(...args).exec(this.client);
595
+ }
596
+ hincrby(...args) {
597
+ return new HIncrByCommand(...args).exec(this.client);
598
+ }
599
+ hincrbyfloat(...args) {
600
+ return new HIncrByFloatCommand(...args).exec(this.client);
601
+ }
602
+ hkeys(...args) {
603
+ return new HKeysCommand(...args).exec(this.client);
604
+ }
605
+ hlen(...args) {
606
+ return new HLenCommand(...args).exec(this.client);
607
+ }
608
+ hmget(...args) {
609
+ return new HMGetCommand(...args).exec(this.client);
610
+ }
611
+ hmset(key, kv) {
612
+ return new HMSetCommand(key, kv).exec(this.client);
613
+ }
614
+ hscan(...args) {
615
+ return new HScanCommand(...args).exec(this.client);
616
+ }
617
+ hset(key, field, value) {
618
+ return new HSetCommand(key, field, value).exec(this.client);
619
+ }
620
+ hsetnx(key, field, value) {
621
+ return new HSetNXCommand(key, field, value).exec(this.client);
622
+ }
623
+ hstrlen(...args) {
624
+ return new HStrLenCommand(...args).exec(this.client);
625
+ }
626
+ hvals(...args) {
627
+ return new HValsCommand(...args).exec(this.client);
628
+ }
629
+ incr(...args) {
630
+ return new IncrCommand(...args).exec(this.client);
631
+ }
632
+ incrby(...args) {
633
+ return new IncrByCommand(...args).exec(this.client);
634
+ }
635
+ incrbyfloat(...args) {
636
+ return new IncrByFloatCommand(...args).exec(this.client);
637
+ }
638
+ keys(...args) {
639
+ return new KeysCommand(...args).exec(this.client);
640
+ }
641
+ lindex(...args) {
642
+ return new LIndexCommand(...args).exec(this.client);
643
+ }
644
+ linsert(key, direction, pivot, value) {
645
+ return new LInsertCommand(key, direction, pivot, value).exec(this.client);
646
+ }
647
+ llen(...args) {
648
+ return new LLenCommand(...args).exec(this.client);
649
+ }
650
+ lpop(...args) {
651
+ return new LPopCommand(...args).exec(this.client);
652
+ }
653
+ lpush(key, ...elements) {
654
+ return new LPushCommand(key, ...elements).exec(this.client);
655
+ }
656
+ lpushx(key, ...elements) {
657
+ return new LPushXCommand(key, ...elements).exec(this.client);
658
+ }
659
+ lrange(...args) {
660
+ return new LRangeCommand(...args).exec(this.client);
661
+ }
662
+ lrem(key, count, value) {
663
+ return new LRemCommand(key, count, value).exec(this.client);
664
+ }
665
+ lset(key, value, index) {
666
+ return new LSetCommand(key, value, index).exec(this.client);
667
+ }
668
+ ltrim(...args) {
669
+ return new LTrimCommand(...args).exec(this.client);
670
+ }
671
+ mget(...args) {
672
+ return new MGetCommand(...args).exec(this.client);
673
+ }
674
+ mset(kv) {
675
+ return new MSetCommand(kv).exec(this.client);
676
+ }
677
+ msetnx(kv) {
678
+ return new MSetNXCommand(kv).exec(this.client);
679
+ }
680
+ persist(...args) {
681
+ return new PersistCommand(...args).exec(this.client);
682
+ }
683
+ pexpire(...args) {
684
+ return new PExpireCommand(...args).exec(this.client);
685
+ }
686
+ pexpireat(...args) {
687
+ return new PExpireAtCommand(...args).exec(this.client);
688
+ }
689
+ ping(...args) {
690
+ return new PingCommand(...args).exec(this.client);
691
+ }
692
+ psetex(key, ttl, value) {
693
+ return new PSetEXCommand(key, ttl, value).exec(this.client);
694
+ }
695
+ pttl(...args) {
696
+ return new PTtlCommand(...args).exec(this.client);
697
+ }
698
+ randomkey() {
699
+ return new RandomKeyCommand().exec(this.client);
700
+ }
701
+ rename(...args) {
702
+ return new RenameCommand(...args).exec(this.client);
703
+ }
704
+ renamenx(...args) {
705
+ return new RenameNXCommand(...args).exec(this.client);
706
+ }
707
+ rpop(...args) {
708
+ return new RPopCommand(...args).exec(this.client);
709
+ }
710
+ rpush(key, ...elements) {
711
+ return new RPushCommand(key, ...elements).exec(this.client);
712
+ }
713
+ rpushx(key, ...elements) {
714
+ return new RPushXCommand(key, ...elements).exec(this.client);
715
+ }
716
+ sadd(key, ...members) {
717
+ return new SAddCommand(key, ...members).exec(this.client);
718
+ }
719
+ scan(...args) {
720
+ return new ScanCommand(...args).exec(this.client);
721
+ }
722
+ scard(...args) {
723
+ return new SCardCommand(...args).exec(this.client);
724
+ }
725
+ sdiff(...args) {
726
+ return new SDiffCommand(...args).exec(this.client);
727
+ }
728
+ sdiffstore(...args) {
729
+ return new SDiffStoreCommand(...args).exec(this.client);
730
+ }
731
+ set(key, value, opts) {
732
+ return new SetCommand(key, value, opts).exec(this.client);
733
+ }
734
+ setbit(...args) {
735
+ return new SetBitCommand(...args).exec(this.client);
736
+ }
737
+ setex(key, ttl, value) {
738
+ return new SetExCommand(key, ttl, value).exec(this.client);
739
+ }
740
+ setnx(key, value) {
741
+ return new SetNxCommand(key, value).exec(this.client);
742
+ }
743
+ setrange(...args) {
744
+ return new SetRangeCommand(...args).exec(this.client);
745
+ }
746
+ sinter(...args) {
747
+ return new SInterCommand(...args).exec(this.client);
748
+ }
749
+ sinterstore(...args) {
750
+ return new SInterStoreCommand(...args).exec(this.client);
751
+ }
752
+ sismember(key, member) {
753
+ return new SIsMemberCommand(key, member).exec(this.client);
754
+ }
755
+ smembers(...args) {
756
+ return new SMembersCommand(...args).exec(this.client);
757
+ }
758
+ smove(source, destination, member) {
759
+ return new SMoveCommand(source, destination, member).exec(this.client);
760
+ }
761
+ spop(...args) {
762
+ return new SPopCommand(...args).exec(this.client);
763
+ }
764
+ srandmember(...args) {
765
+ return new SRandMemberCommand(...args).exec(this.client);
766
+ }
767
+ srem(key, ...members) {
768
+ return new SRemCommand(key, ...members).exec(this.client);
769
+ }
770
+ sscan(...args) {
771
+ return new SScanCommand(...args).exec(this.client);
772
+ }
773
+ strlen(...args) {
774
+ return new StrLenCommand(...args).exec(this.client);
775
+ }
776
+ sunion(...args) {
777
+ return new SUnionCommand(...args).exec(this.client);
778
+ }
779
+ sunionstore(...args) {
780
+ return new SUnionStoreCommand(...args).exec(this.client);
781
+ }
782
+ time() {
783
+ return new TimeCommand().exec(this.client);
784
+ }
785
+ touch(...args) {
786
+ return new TouchCommand(...args).exec(this.client);
787
+ }
788
+ ttl(...args) {
789
+ return new TtlCommand(...args).exec(this.client);
790
+ }
791
+ type(...args) {
792
+ return new TypeCommand(...args).exec(this.client);
793
+ }
794
+ unlink(...args) {
795
+ return new UnlinkCommand(...args).exec(this.client);
796
+ }
797
+ zadd(key, arg1, ...arg2) {
798
+ if ("score" in arg1) {
799
+ return new ZAddCommand(key, arg1, ...arg2).exec(this.client);
800
+ }
801
+ return new ZAddCommand(key, arg1, ...arg2).exec(this.client);
802
+ }
803
+ zcard(...args) {
804
+ return new ZCardCommand(...args).exec(this.client);
805
+ }
806
+ zcount(...args) {
807
+ return new ZCountCommand(...args).exec(this.client);
808
+ }
809
+ zincrby(key, increment, member) {
810
+ return new ZIncrByComand(key, increment, member).exec(this.client);
811
+ }
812
+ zinterstore(...args) {
813
+ return new ZInterStoreCommand(...args).exec(this.client);
814
+ }
815
+ zlexcount(...args) {
816
+ return new ZLexCountCommand(...args).exec(this.client);
817
+ }
818
+ zpopmax(...args) {
819
+ return new ZPopMaxCommand(...args).exec(this.client);
820
+ }
821
+ zpopmin(...args) {
822
+ return new ZPopMinCommand(...args).exec(this.client);
823
+ }
824
+ zrange(...args) {
825
+ return new ZRangeCommand(...args).exec(this.client);
826
+ }
827
+ zrank(key, member) {
828
+ return new ZRankCommand(key, member).exec(this.client);
829
+ }
830
+ zrem(key, ...members) {
831
+ return new ZRemCommand(key, ...members).exec(this.client);
832
+ }
833
+ zremrangebylex(...args) {
834
+ return new ZRemRangeByLexCommand(...args).exec(this.client);
835
+ }
836
+ zremrangebyrank(...args) {
837
+ return new ZRemRangeByRankCommand(...args).exec(this.client);
838
+ }
839
+ zremrangebyscore(...args) {
840
+ return new ZRemRangeByScoreCommand(...args).exec(this.client);
841
+ }
842
+ zrevrank(key, member) {
843
+ return new ZRevRankCommand(key, member).exec(this.client);
844
+ }
845
+ zscan(...args) {
846
+ return new ZScanCommand(...args).exec(this.client);
847
+ }
848
+ zscore(key, member) {
849
+ return new ZScoreCommand(key, member).exec(this.client);
850
+ }
851
+ zunionstore(...args) {
852
+ return new ZUnionStoreCommand(...args).exec(this.client);
853
+ }
854
+ };
855
+ export {
856
+ Redis,
857
+ UpstashError
858
+ };