@upstash/redis 0.1.22 → 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.
Files changed (51) hide show
  1. package/dist/chunk-RYSRH3HC.mjs +1084 -0
  2. package/dist/commands.d.ts +205 -0
  3. package/dist/commands.js +1201 -0
  4. package/dist/commands.mjs +218 -0
  5. package/dist/index.d.ts +1001 -0
  6. package/dist/index.js +1750 -0
  7. package/dist/index.mjs +858 -0
  8. package/dist/zunionstore-f1aa0b4a.d.ts +689 -0
  9. package/package.json +1 -84
  10. package/README.md +0 -103
  11. package/dist/main/src/client.d.ts +0 -25
  12. package/dist/main/src/client.d.ts.map +0 -1
  13. package/dist/main/src/client.js +0 -748
  14. package/dist/main/src/client.js.map +0 -1
  15. package/dist/main/src/index.d.ts +0 -73
  16. package/dist/main/src/index.d.ts.map +0 -1
  17. package/dist/main/src/index.js +0 -124
  18. package/dist/main/src/index.js.map +0 -1
  19. package/dist/main/src/type.d.ts +0 -466
  20. package/dist/main/src/type.d.ts.map +0 -1
  21. package/dist/main/src/type.js +0 -3
  22. package/dist/main/src/type.js.map +0 -1
  23. package/dist/main/utils/helper.d.ts +0 -5
  24. package/dist/main/utils/helper.d.ts.map +0 -1
  25. package/dist/main/utils/helper.js +0 -20
  26. package/dist/main/utils/helper.js.map +0 -1
  27. package/dist/module/src/client.d.ts +0 -25
  28. package/dist/module/src/client.d.ts.map +0 -1
  29. package/dist/module/src/client.js +0 -743
  30. package/dist/module/src/client.js.map +0 -1
  31. package/dist/module/src/index.d.ts +0 -73
  32. package/dist/module/src/index.d.ts.map +0 -1
  33. package/dist/module/src/index.js +0 -5
  34. package/dist/module/src/index.js.map +0 -1
  35. package/dist/module/src/type.d.ts +0 -466
  36. package/dist/module/src/type.d.ts.map +0 -1
  37. package/dist/module/src/type.js +0 -2
  38. package/dist/module/src/type.js.map +0 -1
  39. package/dist/module/utils/helper.d.ts +0 -5
  40. package/dist/module/utils/helper.d.ts.map +0 -1
  41. package/dist/module/utils/helper.js +0 -13
  42. package/dist/module/utils/helper.js.map +0 -1
  43. package/dist/umd/upstash-redis.js +0 -1
  44. package/jest.config.js +0 -5
  45. package/src/client.ts +0 -1232
  46. package/src/index.ts +0 -233
  47. package/src/type.ts +0 -1194
  48. package/tsconfig.json +0 -18
  49. package/tsconfig.module.json +0 -7
  50. package/utils/helper.ts +0 -17
  51. package/webpack.config.js +0 -34
@@ -0,0 +1,1084 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+
18
+ // pkg/error.ts
19
+ var UpstashError = class extends Error {
20
+ constructor(message) {
21
+ super(message);
22
+ this.name = "UpstashError";
23
+ }
24
+ };
25
+
26
+ // pkg/util.ts
27
+ function parseRecursive(obj) {
28
+ return Array.isArray(obj) ? obj.map((o) => {
29
+ try {
30
+ return parseRecursive(o);
31
+ } catch {
32
+ return o;
33
+ }
34
+ }) : JSON.parse(obj);
35
+ }
36
+ function parseResponse(result) {
37
+ try {
38
+ return parseRecursive(result);
39
+ } catch {
40
+ return result;
41
+ }
42
+ }
43
+
44
+ // pkg/command.ts
45
+ var Command = class {
46
+ constructor(command, opts) {
47
+ var _a;
48
+ this.command = command.map((c) => typeof c === "string" ? c : JSON.stringify(c));
49
+ this.deserialize = (_a = opts == null ? void 0 : opts.deserialize) != null ? _a : parseResponse;
50
+ }
51
+ async exec(client) {
52
+ const { result, error } = await client.post({
53
+ body: this.command
54
+ });
55
+ if (error) {
56
+ throw new UpstashError(error);
57
+ }
58
+ if (typeof result === "undefined") {
59
+ throw new Error(`Request did not return a result`);
60
+ }
61
+ return this.deserialize(result);
62
+ }
63
+ };
64
+
65
+ // pkg/commands/append.ts
66
+ var AppendCommand = class extends Command {
67
+ constructor(key, value) {
68
+ super(["append", key, value]);
69
+ }
70
+ };
71
+
72
+ // pkg/commands/bitcount.ts
73
+ var BitCountCommand = class extends Command {
74
+ constructor(key, start, end) {
75
+ const command = ["bitcount", key];
76
+ if (typeof start === "number") {
77
+ command.push(start);
78
+ }
79
+ if (typeof end === "number") {
80
+ command.push(end);
81
+ }
82
+ super(command);
83
+ }
84
+ };
85
+
86
+ // pkg/commands/bitop.ts
87
+ var BitOpCommand = class extends Command {
88
+ constructor(op, destinationKey, sourceKey, ...sourceKeys) {
89
+ super(["bitop", op, destinationKey, sourceKey, ...sourceKeys]);
90
+ }
91
+ };
92
+
93
+ // pkg/commands/bitpos.ts
94
+ var BitPosCommand = class extends Command {
95
+ constructor(key, start, end) {
96
+ super(["bitpos", key, start, end]);
97
+ }
98
+ };
99
+
100
+ // pkg/commands/dbsize.ts
101
+ var DBSizeCommand = class extends Command {
102
+ constructor() {
103
+ super(["dbsize"]);
104
+ }
105
+ };
106
+
107
+ // pkg/commands/decr.ts
108
+ var DecrCommand = class extends Command {
109
+ constructor(key) {
110
+ super(["decr", key]);
111
+ }
112
+ };
113
+
114
+ // pkg/commands/decrby.ts
115
+ var DecrByCommand = class extends Command {
116
+ constructor(key, decrement) {
117
+ super(["decrby", key, decrement]);
118
+ }
119
+ };
120
+
121
+ // pkg/commands/del.ts
122
+ var DelCommand = class extends Command {
123
+ constructor(...keys) {
124
+ super(["del", ...keys]);
125
+ }
126
+ };
127
+
128
+ // pkg/commands/echo.ts
129
+ var EchoCommand = class extends Command {
130
+ constructor(message) {
131
+ super(["echo", message]);
132
+ }
133
+ };
134
+
135
+ // pkg/commands/exists.ts
136
+ var ExistsCommand = class extends Command {
137
+ constructor(...keys) {
138
+ super(["exists", ...keys]);
139
+ }
140
+ };
141
+
142
+ // pkg/commands/expire.ts
143
+ var ExpireCommand = class extends Command {
144
+ constructor(key, seconds) {
145
+ super(["expire", key, seconds]);
146
+ }
147
+ };
148
+
149
+ // pkg/commands/expireat.ts
150
+ var ExpireAtCommand = class extends Command {
151
+ constructor(key, unix) {
152
+ super(["expireat", key, unix]);
153
+ }
154
+ };
155
+
156
+ // pkg/commands/flushall.ts
157
+ var FlushAllCommand = class extends Command {
158
+ constructor(opts) {
159
+ const command = ["flushall"];
160
+ if (opts == null ? void 0 : opts.async) {
161
+ command.push("async");
162
+ }
163
+ super(command);
164
+ }
165
+ };
166
+
167
+ // pkg/commands/flushdb.ts
168
+ var FlushDBCommand = class extends Command {
169
+ constructor(opts) {
170
+ const command = ["flushdb"];
171
+ if (opts == null ? void 0 : opts.async) {
172
+ command.push("async");
173
+ }
174
+ super(command);
175
+ }
176
+ };
177
+
178
+ // pkg/commands/get.ts
179
+ var GetCommand = class extends Command {
180
+ constructor(key) {
181
+ super(["get", key]);
182
+ }
183
+ };
184
+
185
+ // pkg/commands/getbit.ts
186
+ var GetBitCommand = class extends Command {
187
+ constructor(key, offset) {
188
+ super(["getbit", key, offset]);
189
+ }
190
+ };
191
+
192
+ // pkg/commands/getrange.ts
193
+ var GetRangeCommand = class extends Command {
194
+ constructor(key, start, end) {
195
+ super(["getrange", key, start, end]);
196
+ }
197
+ };
198
+
199
+ // pkg/commands/getset.ts
200
+ var GetSetCommand = class extends Command {
201
+ constructor(key, value) {
202
+ super(["getset", key, value]);
203
+ }
204
+ };
205
+
206
+ // pkg/commands/hdel.ts
207
+ var HDelCommand = class extends Command {
208
+ constructor(key, field) {
209
+ super(["hdel", key, field]);
210
+ }
211
+ };
212
+
213
+ // pkg/commands/hexists.ts
214
+ var HExistsCommand = class extends Command {
215
+ constructor(key, field) {
216
+ super(["hexists", key, field]);
217
+ }
218
+ };
219
+
220
+ // pkg/commands/hget.ts
221
+ var HGetCommand = class extends Command {
222
+ constructor(key, field) {
223
+ super(["hget", key, field]);
224
+ }
225
+ };
226
+
227
+ // pkg/commands/hgetall.ts
228
+ function deserialize(result) {
229
+ if (result.length === 0) {
230
+ return null;
231
+ }
232
+ const obj = {};
233
+ while (result.length >= 2) {
234
+ const key = result.shift();
235
+ const value = result.shift();
236
+ try {
237
+ obj[key] = JSON.parse(value);
238
+ } catch {
239
+ obj[key] = value;
240
+ }
241
+ }
242
+ return obj;
243
+ }
244
+ var HGetAllCommand = class extends Command {
245
+ constructor(key) {
246
+ super(["hgetall", key], { deserialize: (result) => deserialize(result) });
247
+ }
248
+ };
249
+
250
+ // pkg/commands/hincrby.ts
251
+ var HIncrByCommand = class extends Command {
252
+ constructor(key, field, increment) {
253
+ super(["hincrby", key, field, increment]);
254
+ }
255
+ };
256
+
257
+ // pkg/commands/hincrbyfloat.ts
258
+ var HIncrByFloatCommand = class extends Command {
259
+ constructor(key, field, increment) {
260
+ super(["hincrbyfloat", key, field, increment]);
261
+ }
262
+ };
263
+
264
+ // pkg/commands/hkeys.ts
265
+ var HKeysCommand = class extends Command {
266
+ constructor(key) {
267
+ super(["hkeys", key]);
268
+ }
269
+ };
270
+
271
+ // pkg/commands/hlen.ts
272
+ var HLenCommand = class extends Command {
273
+ constructor(key) {
274
+ super(["hlen", key]);
275
+ }
276
+ };
277
+
278
+ // pkg/commands/hmget.ts
279
+ function deserialize2(fields, result) {
280
+ if (result.length === 0 || result.every((field) => field === null)) {
281
+ return null;
282
+ }
283
+ const obj = {};
284
+ for (let i = 0; i < fields.length; i++) {
285
+ try {
286
+ obj[fields[i]] = JSON.parse(result[i]);
287
+ } catch {
288
+ obj[fields[i]] = result[i];
289
+ }
290
+ }
291
+ return obj;
292
+ }
293
+ var HMGetCommand = class extends Command {
294
+ constructor(key, ...fields) {
295
+ super(["hmget", key, ...fields], {
296
+ deserialize: (result) => deserialize2(fields, result)
297
+ });
298
+ }
299
+ };
300
+
301
+ // pkg/commands/hmset.ts
302
+ var HMSetCommand = class extends Command {
303
+ constructor(key, kv) {
304
+ super(["hmset", key, ...Object.entries(kv).flatMap(([field, value]) => [field, value])]);
305
+ }
306
+ };
307
+
308
+ // pkg/commands/hscan.ts
309
+ var HScanCommand = class extends Command {
310
+ constructor(key, cursor, opts) {
311
+ const command = ["hscan", key, cursor];
312
+ if (opts == null ? void 0 : opts.match) {
313
+ command.push("match", opts.match);
314
+ }
315
+ if (typeof (opts == null ? void 0 : opts.count) === "number") {
316
+ command.push("count", opts.count);
317
+ }
318
+ super(command);
319
+ }
320
+ };
321
+
322
+ // pkg/commands/hset.ts
323
+ var HSetCommand = class extends Command {
324
+ constructor(key, field, value) {
325
+ super(["hset", key, field, value]);
326
+ }
327
+ };
328
+
329
+ // pkg/commands/hsetnx.ts
330
+ var HSetNXCommand = class extends Command {
331
+ constructor(key, field, value) {
332
+ super(["hsetnx", key, field, value]);
333
+ }
334
+ };
335
+
336
+ // pkg/commands/hstrlen.ts
337
+ var HStrLenCommand = class extends Command {
338
+ constructor(key, field) {
339
+ super(["hstrlen", key, field]);
340
+ }
341
+ };
342
+
343
+ // pkg/commands/hvals.ts
344
+ var HValsCommand = class extends Command {
345
+ constructor(key) {
346
+ super(["hvals", key]);
347
+ }
348
+ };
349
+
350
+ // pkg/commands/incr.ts
351
+ var IncrCommand = class extends Command {
352
+ constructor(key) {
353
+ super(["incr", key]);
354
+ }
355
+ };
356
+
357
+ // pkg/commands/incrby.ts
358
+ var IncrByCommand = class extends Command {
359
+ constructor(key, value) {
360
+ super(["incrby", key, value]);
361
+ }
362
+ };
363
+
364
+ // pkg/commands/incrbyfloat.ts
365
+ var IncrByFloatCommand = class extends Command {
366
+ constructor(key, value) {
367
+ super(["incrbyfloat", key, value]);
368
+ }
369
+ };
370
+
371
+ // pkg/commands/keys.ts
372
+ var KeysCommand = class extends Command {
373
+ constructor(pattern) {
374
+ super(["keys", pattern]);
375
+ }
376
+ };
377
+
378
+ // pkg/commands/lindex.ts
379
+ var LIndexCommand = class extends Command {
380
+ constructor(key, index) {
381
+ super(["lindex", key, index]);
382
+ }
383
+ };
384
+
385
+ // pkg/commands/linsert.ts
386
+ var LInsertCommand = class extends Command {
387
+ constructor(key, direction, pivot, value) {
388
+ super(["linsert", key, direction, pivot, value]);
389
+ }
390
+ };
391
+
392
+ // pkg/commands/llen.ts
393
+ var LLenCommand = class extends Command {
394
+ constructor(key) {
395
+ super(["llen", key]);
396
+ }
397
+ };
398
+
399
+ // pkg/commands/lpop.ts
400
+ var LPopCommand = class extends Command {
401
+ constructor(key) {
402
+ super(["lpop", key]);
403
+ }
404
+ };
405
+
406
+ // pkg/commands/lpush.ts
407
+ var LPushCommand = class extends Command {
408
+ constructor(key, ...elements) {
409
+ super(["lpush", key, ...elements]);
410
+ }
411
+ };
412
+
413
+ // pkg/commands/lpushx.ts
414
+ var LPushXCommand = class extends Command {
415
+ constructor(key, ...elements) {
416
+ super(["lpushx", key, ...elements]);
417
+ }
418
+ };
419
+
420
+ // pkg/commands/lrange.ts
421
+ var LRangeCommand = class extends Command {
422
+ constructor(key, start, end) {
423
+ super(["lrange", key, start, end]);
424
+ }
425
+ };
426
+
427
+ // pkg/commands/lrem.ts
428
+ var LRemCommand = class extends Command {
429
+ constructor(key, count, value) {
430
+ super(["lrem", key, count, value]);
431
+ }
432
+ };
433
+
434
+ // pkg/commands/lset.ts
435
+ var LSetCommand = class extends Command {
436
+ constructor(key, value, index) {
437
+ super(["lset", key, index, value]);
438
+ }
439
+ };
440
+
441
+ // pkg/commands/ltrim.ts
442
+ var LTrimCommand = class extends Command {
443
+ constructor(key, start, end) {
444
+ super(["ltrim", key, start, end]);
445
+ }
446
+ };
447
+
448
+ // pkg/commands/mget.ts
449
+ var MGetCommand = class extends Command {
450
+ constructor(...keys) {
451
+ super(["mget", ...keys]);
452
+ }
453
+ };
454
+
455
+ // pkg/commands/mset.ts
456
+ var MSetCommand = class extends Command {
457
+ constructor(kv) {
458
+ super(["mset", ...Object.entries(kv).flatMap(([key, value]) => [key, value])]);
459
+ }
460
+ };
461
+
462
+ // pkg/commands/msetnx.ts
463
+ var MSetNXCommand = class extends Command {
464
+ constructor(kv) {
465
+ super(["msetnx", ...Object.entries(kv).flatMap((_) => _)]);
466
+ }
467
+ };
468
+
469
+ // pkg/commands/persist.ts
470
+ var PersistCommand = class extends Command {
471
+ constructor(key) {
472
+ super(["persist", key]);
473
+ }
474
+ };
475
+
476
+ // pkg/commands/pexpire.ts
477
+ var PExpireCommand = class extends Command {
478
+ constructor(key, milliseconds) {
479
+ super(["pexpire", key, milliseconds]);
480
+ }
481
+ };
482
+
483
+ // pkg/commands/pexpireat.ts
484
+ var PExpireAtCommand = class extends Command {
485
+ constructor(key, unix) {
486
+ super(["pexpireat", key, unix]);
487
+ }
488
+ };
489
+
490
+ // pkg/commands/ping.ts
491
+ var PingCommand = class extends Command {
492
+ constructor(message) {
493
+ const command = ["ping"];
494
+ if (typeof message !== "undefined") {
495
+ command.push(message);
496
+ }
497
+ super(command);
498
+ }
499
+ };
500
+
501
+ // pkg/commands/psetex.ts
502
+ var PSetEXCommand = class extends Command {
503
+ constructor(key, ttl, value) {
504
+ super(["psetex", key, ttl, value]);
505
+ }
506
+ };
507
+
508
+ // pkg/commands/pttl.ts
509
+ var PTtlCommand = class extends Command {
510
+ constructor(key) {
511
+ super(["pttl", key]);
512
+ }
513
+ };
514
+
515
+ // pkg/commands/randomkey.ts
516
+ var RandomKeyCommand = class extends Command {
517
+ constructor() {
518
+ super(["randomkey"]);
519
+ }
520
+ };
521
+
522
+ // pkg/commands/rename.ts
523
+ var RenameCommand = class extends Command {
524
+ constructor(source, destination) {
525
+ super(["rename", source, destination]);
526
+ }
527
+ };
528
+
529
+ // pkg/commands/renamenx.ts
530
+ var RenameNXCommand = class extends Command {
531
+ constructor(source, destination) {
532
+ super(["renamenx", source, destination]);
533
+ }
534
+ };
535
+
536
+ // pkg/commands/rpop.ts
537
+ var RPopCommand = class extends Command {
538
+ constructor(key) {
539
+ super(["rpop", key]);
540
+ }
541
+ };
542
+
543
+ // pkg/commands/rpush.ts
544
+ var RPushCommand = class extends Command {
545
+ constructor(key, ...elements) {
546
+ super(["rpush", key, ...elements]);
547
+ }
548
+ };
549
+
550
+ // pkg/commands/rpushx.ts
551
+ var RPushXCommand = class extends Command {
552
+ constructor(key, ...elements) {
553
+ super(["rpushx", key, ...elements]);
554
+ }
555
+ };
556
+
557
+ // pkg/commands/sadd.ts
558
+ var SAddCommand = class extends Command {
559
+ constructor(key, ...members) {
560
+ super(["sadd", key, ...members]);
561
+ }
562
+ };
563
+
564
+ // pkg/commands/scan.ts
565
+ var ScanCommand = class extends Command {
566
+ constructor(cursor, opts) {
567
+ const command = ["scan", cursor];
568
+ if (opts == null ? void 0 : opts.match) {
569
+ command.push("match", opts.match);
570
+ }
571
+ if (typeof (opts == null ? void 0 : opts.count) === "number") {
572
+ command.push("count", opts.count);
573
+ }
574
+ super(command);
575
+ }
576
+ };
577
+
578
+ // pkg/commands/scard.ts
579
+ var SCardCommand = class extends Command {
580
+ constructor(key) {
581
+ super(["scard", key]);
582
+ }
583
+ };
584
+
585
+ // pkg/commands/sdiff.ts
586
+ var SDiffCommand = class extends Command {
587
+ constructor(key, ...keys) {
588
+ super(["sdiff", key, ...keys]);
589
+ }
590
+ };
591
+
592
+ // pkg/commands/sdiffstore.ts
593
+ var SDiffStoreCommand = class extends Command {
594
+ constructor(destination, ...keys) {
595
+ super(["sdiffstore", destination, ...keys]);
596
+ }
597
+ };
598
+
599
+ // pkg/commands/set.ts
600
+ var SetCommand = class extends Command {
601
+ constructor(key, value, opts) {
602
+ const command = ["set", key, value];
603
+ if (opts) {
604
+ if ("ex" in opts && typeof opts.ex === "number") {
605
+ command.push("ex", opts.ex);
606
+ } else if ("px" in opts && typeof opts.px === "number") {
607
+ command.push("px", opts.px);
608
+ }
609
+ if ("nx" in opts && opts.nx) {
610
+ command.push("nx");
611
+ } else if ("xx" in opts && opts.xx) {
612
+ command.push("xx");
613
+ }
614
+ }
615
+ super(command);
616
+ }
617
+ };
618
+
619
+ // pkg/commands/setbit.ts
620
+ var SetBitCommand = class extends Command {
621
+ constructor(key, offset, value) {
622
+ super(["setbit", key, offset, value]);
623
+ }
624
+ };
625
+
626
+ // pkg/commands/setex.ts
627
+ var SetExCommand = class extends Command {
628
+ constructor(key, ttl, value) {
629
+ super(["setex", key, ttl, value]);
630
+ }
631
+ };
632
+
633
+ // pkg/commands/setnx.ts
634
+ var SetNxCommand = class extends Command {
635
+ constructor(key, value) {
636
+ super(["setnx", key, value]);
637
+ }
638
+ };
639
+
640
+ // pkg/commands/setrange.ts
641
+ var SetRangeCommand = class extends Command {
642
+ constructor(key, offset, value) {
643
+ super(["setrange", key, offset, value]);
644
+ }
645
+ };
646
+
647
+ // pkg/commands/sinter.ts
648
+ var SInterCommand = class extends Command {
649
+ constructor(key, ...keys) {
650
+ super(["sinter", key, ...keys]);
651
+ }
652
+ };
653
+
654
+ // pkg/commands/sinterstore.ts
655
+ var SInterStoreCommand = class extends Command {
656
+ constructor(destination, key, ...keys) {
657
+ super(["sinterstore", destination, key, ...keys]);
658
+ }
659
+ };
660
+
661
+ // pkg/commands/sismember.ts
662
+ var SIsMemberCommand = class extends Command {
663
+ constructor(key, member) {
664
+ super(["sismember", key, member]);
665
+ }
666
+ };
667
+
668
+ // pkg/commands/smembers.ts
669
+ var SMembersCommand = class extends Command {
670
+ constructor(key) {
671
+ super(["smembers", key]);
672
+ }
673
+ };
674
+
675
+ // pkg/commands/smove.ts
676
+ var SMoveCommand = class extends Command {
677
+ constructor(source, destination, member) {
678
+ super(["smove", source, destination, member]);
679
+ }
680
+ };
681
+
682
+ // pkg/commands/spop.ts
683
+ var SPopCommand = class extends Command {
684
+ constructor(key, count) {
685
+ const command = ["spop", key];
686
+ if (typeof count === "number") {
687
+ command.push(count);
688
+ }
689
+ super(command);
690
+ }
691
+ };
692
+
693
+ // pkg/commands/srandmember.ts
694
+ var SRandMemberCommand = class extends Command {
695
+ constructor(key, count) {
696
+ const command = ["srandmember", key];
697
+ if (typeof count === "number") {
698
+ command.push(count);
699
+ }
700
+ super(command);
701
+ }
702
+ };
703
+
704
+ // pkg/commands/srem.ts
705
+ var SRemCommand = class extends Command {
706
+ constructor(key, ...members) {
707
+ super(["srem", key, ...members]);
708
+ }
709
+ };
710
+
711
+ // pkg/commands/sscan.ts
712
+ var SScanCommand = class extends Command {
713
+ constructor(key, cursor, opts) {
714
+ const command = ["sscan", key, cursor];
715
+ if (opts == null ? void 0 : opts.match) {
716
+ command.push("match", opts.match);
717
+ }
718
+ if (typeof (opts == null ? void 0 : opts.count) === "number") {
719
+ command.push("count", opts.count);
720
+ }
721
+ super(command);
722
+ }
723
+ };
724
+
725
+ // pkg/commands/strlen.ts
726
+ var StrLenCommand = class extends Command {
727
+ constructor(key) {
728
+ super(["strlen", key]);
729
+ }
730
+ };
731
+
732
+ // pkg/commands/sunion.ts
733
+ var SUnionCommand = class extends Command {
734
+ constructor(key, ...keys) {
735
+ super(["sunion", key, ...keys]);
736
+ }
737
+ };
738
+
739
+ // pkg/commands/sunionstore.ts
740
+ var SUnionStoreCommand = class extends Command {
741
+ constructor(destination, key, ...keys) {
742
+ super(["sunionstore", destination, key, ...keys]);
743
+ }
744
+ };
745
+
746
+ // pkg/commands/time.ts
747
+ var TimeCommand = class extends Command {
748
+ constructor() {
749
+ super(["time"]);
750
+ }
751
+ };
752
+
753
+ // pkg/commands/touch.ts
754
+ var TouchCommand = class extends Command {
755
+ constructor(...keys) {
756
+ super(["touch", ...keys]);
757
+ }
758
+ };
759
+
760
+ // pkg/commands/ttl.ts
761
+ var TtlCommand = class extends Command {
762
+ constructor(key) {
763
+ super(["ttl", key]);
764
+ }
765
+ };
766
+
767
+ // pkg/commands/type.ts
768
+ var TypeCommand = class extends Command {
769
+ constructor(key) {
770
+ super(["type", key]);
771
+ }
772
+ };
773
+
774
+ // pkg/commands/unlink.ts
775
+ var UnlinkCommand = class extends Command {
776
+ constructor(...keys) {
777
+ super(["unlink", ...keys]);
778
+ }
779
+ };
780
+
781
+ // pkg/commands/zadd.ts
782
+ var ZAddCommand = class extends Command {
783
+ constructor(key, arg1, ...arg2) {
784
+ const command = ["zadd", key];
785
+ if ("nx" in arg1 && arg1.nx) {
786
+ command.push("nx");
787
+ } else if ("xx" in arg1 && arg1.xx) {
788
+ command.push("xx");
789
+ }
790
+ if ("ch" in arg1 && arg1.ch) {
791
+ command.push("ch");
792
+ }
793
+ if ("incr" in arg1 && arg1.incr) {
794
+ command.push("incr");
795
+ }
796
+ if ("score" in arg1 && "member" in arg1) {
797
+ command.push(arg1.score, arg1.member);
798
+ }
799
+ command.push(...arg2.flatMap(({ score, member }) => [score, member]));
800
+ super(command);
801
+ }
802
+ };
803
+
804
+ // pkg/commands/zcard.ts
805
+ var ZCardCommand = class extends Command {
806
+ constructor(key) {
807
+ super(["zcard", key]);
808
+ }
809
+ };
810
+
811
+ // pkg/commands/zcount.ts
812
+ var ZCountCommand = class extends Command {
813
+ constructor(key, min, max) {
814
+ super(["zcount", key, min, max]);
815
+ }
816
+ };
817
+
818
+ // pkg/commands/zincrby.ts
819
+ var ZIncrByComand = class extends Command {
820
+ constructor(key, increment, member) {
821
+ super(["zincrby", key, increment, member]);
822
+ }
823
+ };
824
+
825
+ // pkg/commands/zinterstore.ts
826
+ var ZInterStoreCommand = class extends Command {
827
+ constructor(destination, numKeys, keyOrKeys, opts) {
828
+ const command = ["zinterstore", destination, numKeys];
829
+ if (Array.isArray(keyOrKeys)) {
830
+ command.push(...keyOrKeys);
831
+ } else {
832
+ command.push(keyOrKeys);
833
+ }
834
+ if (opts) {
835
+ if ("weights" in opts && opts.weights) {
836
+ command.push("weights", ...opts.weights);
837
+ } else if ("weight" in opts && typeof opts.weight === "number") {
838
+ command.push("weights", opts.weight);
839
+ }
840
+ if ("aggregate" in opts) {
841
+ command.push("aggregate", opts.aggregate);
842
+ }
843
+ }
844
+ super(command);
845
+ }
846
+ };
847
+
848
+ // pkg/commands/zlexcount.ts
849
+ var ZLexCountCommand = class extends Command {
850
+ constructor(key, min, max) {
851
+ super(["zlexcount", key, min, max]);
852
+ }
853
+ };
854
+
855
+ // pkg/commands/zpopmax.ts
856
+ var ZPopMaxCommand = class extends Command {
857
+ constructor(key, count) {
858
+ const command = ["zpopmax", key];
859
+ if (typeof count === "number") {
860
+ command.push(count);
861
+ }
862
+ super(command);
863
+ }
864
+ };
865
+
866
+ // pkg/commands/zpopmin.ts
867
+ var ZPopMinCommand = class extends Command {
868
+ constructor(key, count) {
869
+ const command = ["zpopmin", key];
870
+ if (typeof count === "number") {
871
+ command.push(count);
872
+ }
873
+ super(command);
874
+ }
875
+ };
876
+
877
+ // pkg/commands/zrange.ts
878
+ var ZRangeCommand = class extends Command {
879
+ constructor(key, min, max, opts) {
880
+ const command = ["zrange", key, min, max];
881
+ if (opts == null ? void 0 : opts.withScores) {
882
+ command.push("withscores");
883
+ }
884
+ super(command);
885
+ }
886
+ };
887
+
888
+ // pkg/commands/zrank.ts
889
+ var ZRankCommand = class extends Command {
890
+ constructor(key, member) {
891
+ super(["zrank", key, member]);
892
+ }
893
+ };
894
+
895
+ // pkg/commands/zrem.ts
896
+ var ZRemCommand = class extends Command {
897
+ constructor(key, ...members) {
898
+ super(["zrem", key, ...members]);
899
+ }
900
+ };
901
+
902
+ // pkg/commands/zremrangebylex.ts
903
+ var ZRemRangeByLexCommand = class extends Command {
904
+ constructor(key, min, max) {
905
+ super(["zremrangebylex", key, min, max]);
906
+ }
907
+ };
908
+
909
+ // pkg/commands/zremrangebyrank.ts
910
+ var ZRemRangeByRankCommand = class extends Command {
911
+ constructor(key, start, stop) {
912
+ super(["zremrangebyrank", key, start, stop]);
913
+ }
914
+ };
915
+
916
+ // pkg/commands/zremrangebyscore.ts
917
+ var ZRemRangeByScoreCommand = class extends Command {
918
+ constructor(key, min, max) {
919
+ super(["zremrangebyscore", key, min, max]);
920
+ }
921
+ };
922
+
923
+ // pkg/commands/zrevrank.ts
924
+ var ZRevRankCommand = class extends Command {
925
+ constructor(key, member) {
926
+ super(["zrevrank", key, member]);
927
+ }
928
+ };
929
+
930
+ // pkg/commands/zscan.ts
931
+ var ZScanCommand = class extends Command {
932
+ constructor(key, cursor, opts) {
933
+ const command = ["zscan", key, cursor];
934
+ if (opts == null ? void 0 : opts.match) {
935
+ command.push("match", opts.match);
936
+ }
937
+ if (typeof (opts == null ? void 0 : opts.count) === "number") {
938
+ command.push("count", opts.count);
939
+ }
940
+ super(command);
941
+ }
942
+ };
943
+
944
+ // pkg/commands/zscore.ts
945
+ var ZScoreCommand = class extends Command {
946
+ constructor(key, member) {
947
+ super(["zscore", key, member]);
948
+ }
949
+ };
950
+
951
+ // pkg/commands/zunionstore.ts
952
+ var ZUnionStoreCommand = class extends Command {
953
+ constructor(destination, numKeys, keyOrKeys, opts) {
954
+ const command = ["zunionstore", destination, numKeys];
955
+ if (Array.isArray(keyOrKeys)) {
956
+ command.push(...keyOrKeys);
957
+ } else {
958
+ command.push(keyOrKeys);
959
+ }
960
+ if (opts) {
961
+ if ("weights" in opts && opts.weights) {
962
+ command.push("weights", ...opts.weights);
963
+ } else if ("weight" in opts && typeof opts.weight === "number") {
964
+ command.push("weights", opts.weight);
965
+ }
966
+ if ("aggregate" in opts) {
967
+ command.push("aggregate", opts.aggregate);
968
+ }
969
+ }
970
+ super(command);
971
+ }
972
+ };
973
+
974
+ export {
975
+ __spreadValues,
976
+ UpstashError,
977
+ AppendCommand,
978
+ BitCountCommand,
979
+ BitOpCommand,
980
+ BitPosCommand,
981
+ DBSizeCommand,
982
+ DecrCommand,
983
+ DecrByCommand,
984
+ DelCommand,
985
+ EchoCommand,
986
+ ExistsCommand,
987
+ ExpireCommand,
988
+ ExpireAtCommand,
989
+ FlushAllCommand,
990
+ FlushDBCommand,
991
+ GetCommand,
992
+ GetBitCommand,
993
+ GetRangeCommand,
994
+ GetSetCommand,
995
+ HDelCommand,
996
+ HExistsCommand,
997
+ HGetCommand,
998
+ HGetAllCommand,
999
+ HIncrByCommand,
1000
+ HIncrByFloatCommand,
1001
+ HKeysCommand,
1002
+ HLenCommand,
1003
+ HMGetCommand,
1004
+ HMSetCommand,
1005
+ HScanCommand,
1006
+ HSetCommand,
1007
+ HSetNXCommand,
1008
+ HStrLenCommand,
1009
+ HValsCommand,
1010
+ IncrCommand,
1011
+ IncrByCommand,
1012
+ IncrByFloatCommand,
1013
+ KeysCommand,
1014
+ LIndexCommand,
1015
+ LInsertCommand,
1016
+ LLenCommand,
1017
+ LPopCommand,
1018
+ LPushCommand,
1019
+ LPushXCommand,
1020
+ LRangeCommand,
1021
+ LRemCommand,
1022
+ LSetCommand,
1023
+ LTrimCommand,
1024
+ MGetCommand,
1025
+ MSetCommand,
1026
+ MSetNXCommand,
1027
+ PersistCommand,
1028
+ PExpireCommand,
1029
+ PExpireAtCommand,
1030
+ PingCommand,
1031
+ PSetEXCommand,
1032
+ PTtlCommand,
1033
+ RandomKeyCommand,
1034
+ RenameCommand,
1035
+ RenameNXCommand,
1036
+ RPopCommand,
1037
+ RPushCommand,
1038
+ RPushXCommand,
1039
+ SAddCommand,
1040
+ ScanCommand,
1041
+ SCardCommand,
1042
+ SDiffCommand,
1043
+ SDiffStoreCommand,
1044
+ SetCommand,
1045
+ SetBitCommand,
1046
+ SetExCommand,
1047
+ SetNxCommand,
1048
+ SetRangeCommand,
1049
+ SInterCommand,
1050
+ SInterStoreCommand,
1051
+ SIsMemberCommand,
1052
+ SMembersCommand,
1053
+ SMoveCommand,
1054
+ SPopCommand,
1055
+ SRandMemberCommand,
1056
+ SRemCommand,
1057
+ SScanCommand,
1058
+ StrLenCommand,
1059
+ SUnionCommand,
1060
+ SUnionStoreCommand,
1061
+ TimeCommand,
1062
+ TouchCommand,
1063
+ TtlCommand,
1064
+ TypeCommand,
1065
+ UnlinkCommand,
1066
+ ZAddCommand,
1067
+ ZCardCommand,
1068
+ ZCountCommand,
1069
+ ZIncrByComand,
1070
+ ZInterStoreCommand,
1071
+ ZLexCountCommand,
1072
+ ZPopMaxCommand,
1073
+ ZPopMinCommand,
1074
+ ZRangeCommand,
1075
+ ZRankCommand,
1076
+ ZRemCommand,
1077
+ ZRemRangeByLexCommand,
1078
+ ZRemRangeByRankCommand,
1079
+ ZRemRangeByScoreCommand,
1080
+ ZRevRankCommand,
1081
+ ZScanCommand,
1082
+ ZScoreCommand,
1083
+ ZUnionStoreCommand
1084
+ };