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