@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/chunk-RYSRH3HC.mjs +1084 -0
- package/dist/commands.d.ts +205 -0
- package/dist/commands.js +1201 -0
- package/dist/commands.mjs +218 -0
- package/dist/index.d.ts +1001 -0
- package/dist/index.js +1750 -0
- package/dist/index.mjs +858 -0
- package/dist/zunionstore-f1aa0b4a.d.ts +689 -0
- package/package.json +1 -75
- package/README.md +0 -63
- package/dist/main/client.d.ts +0 -21
- package/dist/main/client.js +0 -564
- package/dist/main/index-cjs.d.ts +0 -1
- package/dist/main/index-cjs.js +0 -120
- package/dist/main/types.d.ts +0 -179
- package/dist/main/types.js +0 -2
- package/dist/module/client.d.ts +0 -21
- package/dist/module/client.js +0 -559
- package/dist/module/index.d.ts +0 -3
- package/dist/module/index.js +0 -3
- package/dist/module/types.d.ts +0 -179
- package/dist/module/types.js +0 -1
- package/jest.config.js +0 -5
- package/src/client.ts +0 -626
- package/src/index-cjs.ts +0 -117
- package/src/index.ts +0 -118
- package/src/types.ts +0 -410
- package/tsconfig.json +0 -20
- package/tsconfig.module.json +0 -8
|
@@ -0,0 +1,689 @@
|
|
|
1
|
+
declare type HttpRequest = {
|
|
2
|
+
path?: string[];
|
|
3
|
+
/**
|
|
4
|
+
* Request body will be serialized to json
|
|
5
|
+
*/
|
|
6
|
+
body?: unknown;
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
retries?: number;
|
|
9
|
+
};
|
|
10
|
+
declare type HttpClientConfig = {
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
};
|
|
14
|
+
declare class HttpClient {
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
constructor(config: HttpClientConfig);
|
|
18
|
+
private request;
|
|
19
|
+
post<TResponse>(req: HttpRequest): Promise<TResponse>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Command offers default (de)serialization and the exec method to all commands.
|
|
24
|
+
*
|
|
25
|
+
* TData represents what the user will enter or receive,
|
|
26
|
+
* TResult is the raw data returned from upstash, which may need to be transformed or parsed.
|
|
27
|
+
*/
|
|
28
|
+
declare abstract class Command<TData, TResult> {
|
|
29
|
+
readonly command: string[];
|
|
30
|
+
deserialize: (result: TResult) => TData;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new command instance.
|
|
33
|
+
*
|
|
34
|
+
* You can define a custom `deserialize` function. By default we try to deserialize as json.
|
|
35
|
+
*/
|
|
36
|
+
constructor(command: (string | unknown)[], opts?: {
|
|
37
|
+
deserialize?: (result: TResult) => TData;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Execute the command using a client.
|
|
41
|
+
*/
|
|
42
|
+
exec(client: HttpClient): Promise<TData>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @see https://redis.io/commands/append
|
|
47
|
+
*/
|
|
48
|
+
declare class AppendCommand extends Command<number, number> {
|
|
49
|
+
constructor(key: string, value: string);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @see https://redis.io/commands/bitcount
|
|
54
|
+
*/
|
|
55
|
+
declare class BitCountCommand extends Command<number, number> {
|
|
56
|
+
constructor(key: string, start?: never, end?: never);
|
|
57
|
+
constructor(key: string, start: number, end: number);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @see https://redis.io/commands/bitpos
|
|
62
|
+
*/
|
|
63
|
+
declare class BitPosCommand extends Command<number, number> {
|
|
64
|
+
constructor(key: string, start: number, end: number);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @see https://redis.io/commands/decr
|
|
69
|
+
*/
|
|
70
|
+
declare class DecrCommand extends Command<number, number> {
|
|
71
|
+
constructor(key: string);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @see https://redis.io/commands/decrby
|
|
76
|
+
*/
|
|
77
|
+
declare class DecrByCommand extends Command<number, number> {
|
|
78
|
+
constructor(key: string, decrement: number);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare type NonEmptyArray<T> = [T, ...T[]];
|
|
82
|
+
declare type CommandArgs<TCommand extends new (...args: any) => any> = ConstructorParameters<TCommand>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @see https://redis.io/commands/del
|
|
86
|
+
*/
|
|
87
|
+
declare class DelCommand extends Command<number, number> {
|
|
88
|
+
constructor(...keys: NonEmptyArray<string>);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @see https://redis.io/commands/echo
|
|
93
|
+
*/
|
|
94
|
+
declare class EchoCommand extends Command<string, string> {
|
|
95
|
+
constructor(message: string);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @see https://redis.io/commands/exists
|
|
100
|
+
*/
|
|
101
|
+
declare class ExistsCommand extends Command<0 | 1, "0" | "1"> {
|
|
102
|
+
constructor(...keys: NonEmptyArray<string>);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @see https://redis.io/commands/expire
|
|
107
|
+
*/
|
|
108
|
+
declare class ExpireCommand extends Command<0 | 1, "0" | "1"> {
|
|
109
|
+
constructor(key: string, seconds: number);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @see https://redis.io/commands/expireat
|
|
114
|
+
*/
|
|
115
|
+
declare class ExpireAtCommand extends Command<0 | 1, "0" | "1"> {
|
|
116
|
+
constructor(key: string, unix: number);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @see https://redis.io/commands/flushall
|
|
121
|
+
*/
|
|
122
|
+
declare class FlushAllCommand extends Command<"OK", "OK"> {
|
|
123
|
+
constructor(opts?: {
|
|
124
|
+
async?: boolean;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @see https://redis.io/commands/flushdb
|
|
130
|
+
*/
|
|
131
|
+
declare class FlushDBCommand extends Command<"OK", "OK"> {
|
|
132
|
+
constructor(opts?: {
|
|
133
|
+
async?: boolean;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @see https://redis.io/commands/get
|
|
139
|
+
*/
|
|
140
|
+
declare class GetCommand<TData = string> extends Command<TData | null, unknown | null> {
|
|
141
|
+
constructor(key: string);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @see https://redis.io/commands/getbit
|
|
146
|
+
*/
|
|
147
|
+
declare class GetBitCommand extends Command<0 | 1, "0" | "1"> {
|
|
148
|
+
constructor(key: string, offset: number);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @see https://redis.io/commands/getrange
|
|
153
|
+
*/
|
|
154
|
+
declare class GetRangeCommand extends Command<string, string> {
|
|
155
|
+
constructor(key: string, start: number, end: number);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @see https://redis.io/commands/hdel
|
|
160
|
+
*/
|
|
161
|
+
declare class HDelCommand extends Command<0 | 1, "0" | "1"> {
|
|
162
|
+
constructor(key: string, field: string);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @see https://redis.io/commands/hexists
|
|
167
|
+
*/
|
|
168
|
+
declare class HExistsCommand extends Command<number, number> {
|
|
169
|
+
constructor(key: string, field: string);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @see https://redis.io/commands/hget
|
|
174
|
+
*/
|
|
175
|
+
declare class HGetCommand<TData> extends Command<TData | null, unknown | null> {
|
|
176
|
+
constructor(key: string, field: string);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @see https://redis.io/commands/hgetall
|
|
181
|
+
*/
|
|
182
|
+
declare class HGetAllCommand<TData extends Record<string, unknown>> extends Command<TData | null, unknown | null> {
|
|
183
|
+
constructor(key: string);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @see https://redis.io/commands/hincrby
|
|
188
|
+
*/
|
|
189
|
+
declare class HIncrByCommand extends Command<number, number> {
|
|
190
|
+
constructor(key: string, field: string, increment: number);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @see https://redis.io/commands/hincrbyfloat
|
|
195
|
+
*/
|
|
196
|
+
declare class HIncrByFloatCommand extends Command<number, number> {
|
|
197
|
+
constructor(key: string, field: string, increment: number);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @see https://redis.io/commands/hkeys
|
|
202
|
+
*/
|
|
203
|
+
declare class HKeysCommand extends Command<string[], string[]> {
|
|
204
|
+
constructor(key: string);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @see https://redis.io/commands/hlen
|
|
209
|
+
*/
|
|
210
|
+
declare class HLenCommand extends Command<number, number> {
|
|
211
|
+
constructor(key: string);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* hmget returns an object of all requested fields from a hash
|
|
216
|
+
* The field values are returned as an object like this:
|
|
217
|
+
* ```ts
|
|
218
|
+
* {[fieldName: string]: T | null}
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
* In case the hash does not exist or all fields are empty `null` is returned
|
|
222
|
+
*
|
|
223
|
+
* @see https://redis.io/commands/hmget
|
|
224
|
+
*/
|
|
225
|
+
declare class HMGetCommand<TData extends Record<string, unknown>> extends Command<TData | null, (string | null)[]> {
|
|
226
|
+
constructor(key: string, ...fields: string[]);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
declare type ScanCommandOptions = {
|
|
230
|
+
match?: string;
|
|
231
|
+
count?: number;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* @see https://redis.io/commands/scan
|
|
235
|
+
*/
|
|
236
|
+
declare class ScanCommand extends Command<[number, string[]], [number, string[]]> {
|
|
237
|
+
constructor(cursor: number, opts?: ScanCommandOptions);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @see https://redis.io/commands/hscan
|
|
242
|
+
*/
|
|
243
|
+
declare class HScanCommand extends Command<[
|
|
244
|
+
number,
|
|
245
|
+
(string | number)[]
|
|
246
|
+
], [
|
|
247
|
+
number,
|
|
248
|
+
(string | number)[]
|
|
249
|
+
]> {
|
|
250
|
+
constructor(key: string, cursor: number, opts?: ScanCommandOptions);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @see https://redis.io/commands/hstrlen
|
|
255
|
+
*/
|
|
256
|
+
declare class HStrLenCommand extends Command<number, number> {
|
|
257
|
+
constructor(key: string, field: string);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @see https://redis.io/commands/hvals
|
|
262
|
+
*/
|
|
263
|
+
declare class HValsCommand<TData extends unknown[]> extends Command<TData, unknown[]> {
|
|
264
|
+
constructor(key: string);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @see https://redis.io/commands/incr
|
|
269
|
+
*/
|
|
270
|
+
declare class IncrCommand extends Command<number, number> {
|
|
271
|
+
constructor(key: string);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @see https://redis.io/commands/incrby
|
|
276
|
+
*/
|
|
277
|
+
declare class IncrByCommand extends Command<number, number> {
|
|
278
|
+
constructor(key: string, value: number);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* @see https://redis.io/commands/incrbyfloat
|
|
283
|
+
*/
|
|
284
|
+
declare class IncrByFloatCommand extends Command<number, number> {
|
|
285
|
+
constructor(key: string, value: number);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @see https://redis.io/commands/keys
|
|
290
|
+
*/
|
|
291
|
+
declare class KeysCommand extends Command<string[], string[]> {
|
|
292
|
+
constructor(pattern: string);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare class LIndexCommand<TData = string> extends Command<TData | null, unknown | null> {
|
|
296
|
+
constructor(key: string, index: number);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @see https://redis.io/commands/llen
|
|
301
|
+
*/
|
|
302
|
+
declare class LLenCommand extends Command<number, number> {
|
|
303
|
+
constructor(key: string);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @see https://redis.io/commands/lpop
|
|
308
|
+
*/
|
|
309
|
+
declare class LPopCommand<TData = string> extends Command<TData | null, unknown | null> {
|
|
310
|
+
constructor(key: string);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
declare class LRangeCommand<TData = string> extends Command<TData[], unknown[]> {
|
|
314
|
+
constructor(key: string, start: number, end: number);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
declare class LTrimCommand extends Command<"OK", "OK"> {
|
|
318
|
+
constructor(key: string, start: number, end: number);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @see https://redis.io/commands/mget
|
|
323
|
+
*/
|
|
324
|
+
declare class MGetCommand<TData extends unknown[]> extends Command<TData, (string | null)[]> {
|
|
325
|
+
constructor(...keys: [string, ...string[]]);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* @see https://redis.io/commands/persist
|
|
330
|
+
*/
|
|
331
|
+
declare class PersistCommand extends Command<0 | 1, "0" | "1"> {
|
|
332
|
+
constructor(key: string);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @see https://redis.io/commands/pexpire
|
|
337
|
+
*/
|
|
338
|
+
declare class PExpireCommand extends Command<0 | 1, "0" | "1"> {
|
|
339
|
+
constructor(key: string, milliseconds: number);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @see https://redis.io/commands/pexpireat
|
|
344
|
+
*/
|
|
345
|
+
declare class PExpireAtCommand extends Command<0 | 1, "0" | "1"> {
|
|
346
|
+
constructor(key: string, unix: number);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @see https://redis.io/commands/ping
|
|
351
|
+
*/
|
|
352
|
+
declare class PingCommand extends Command<string | "PONG", string | "PONG"> {
|
|
353
|
+
constructor(message?: string);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* @see https://redis.io/commands/pttl
|
|
358
|
+
*/
|
|
359
|
+
declare class PTtlCommand extends Command<number, number> {
|
|
360
|
+
constructor(key: string);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* @see https://redis.io/commands/rename
|
|
365
|
+
*/
|
|
366
|
+
declare class RenameCommand extends Command<"OK", "OK"> {
|
|
367
|
+
constructor(source: string, destination: string);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* @see https://redis.io/commands/renamenx
|
|
372
|
+
*/
|
|
373
|
+
declare class RenameNXCommand extends Command<0 | 1, "0" | "1"> {
|
|
374
|
+
constructor(source: string, destination: string);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @see https://redis.io/commands/rpop
|
|
379
|
+
*/
|
|
380
|
+
declare class RPopCommand<TData = string> extends Command<TData | null, unknown | null> {
|
|
381
|
+
constructor(key: string);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* @see https://redis.io/commands/scard
|
|
386
|
+
*/
|
|
387
|
+
declare class SCardCommand extends Command<number, number> {
|
|
388
|
+
constructor(key: string);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* @see https://redis.io/commands/sdiff
|
|
393
|
+
*/
|
|
394
|
+
declare class SDiffCommand<TData> extends Command<TData[], unknown[]> {
|
|
395
|
+
constructor(key: string, ...keys: string[]);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @see https://redis.io/commands/sdiffstpre
|
|
400
|
+
*/
|
|
401
|
+
declare class SDiffStoreCommand extends Command<number, number> {
|
|
402
|
+
constructor(destination: string, ...keys: NonEmptyArray<string>);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare type SetCommandOptions = ({
|
|
406
|
+
ex: number;
|
|
407
|
+
px?: never;
|
|
408
|
+
} | {
|
|
409
|
+
ex?: never;
|
|
410
|
+
px: number;
|
|
411
|
+
} | {
|
|
412
|
+
ex?: never;
|
|
413
|
+
px?: never;
|
|
414
|
+
}) & ({
|
|
415
|
+
nx: true;
|
|
416
|
+
xx?: never;
|
|
417
|
+
} | {
|
|
418
|
+
xx: true;
|
|
419
|
+
nx?: never;
|
|
420
|
+
} | {
|
|
421
|
+
xx?: never;
|
|
422
|
+
nx?: never;
|
|
423
|
+
});
|
|
424
|
+
/**
|
|
425
|
+
* @see https://redis.io/commands/set
|
|
426
|
+
*/
|
|
427
|
+
declare class SetCommand<TData, TResult = "OK"> extends Command<TData, TResult> {
|
|
428
|
+
constructor(key: string, value: TData, opts?: SetCommandOptions);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* @see https://redis.io/commands/setbit
|
|
433
|
+
*/
|
|
434
|
+
declare class SetBitCommand extends Command<0 | 1, "0" | "1"> {
|
|
435
|
+
constructor(key: string, offset: number, value: 0 | 1);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* @see https://redis.io/commands/setrange
|
|
440
|
+
*/
|
|
441
|
+
declare class SetRangeCommand extends Command<number, number> {
|
|
442
|
+
constructor(key: string, offset: number, value: string);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @see https://redis.io/commands/sinter
|
|
447
|
+
*/
|
|
448
|
+
declare class SInterCommand<TData = string> extends Command<TData[], unknown[]> {
|
|
449
|
+
constructor(key: string, ...keys: string[]);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @see https://redis.io/commands/sinterstore
|
|
454
|
+
*/
|
|
455
|
+
declare class SInterStoreCommand<TData = string> extends Command<TData[], unknown[]> {
|
|
456
|
+
constructor(destination: string, key: string, ...keys: string[]);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* @see https://redis.io/commands/smembers
|
|
461
|
+
*/
|
|
462
|
+
declare class SMembersCommand<TData = string> extends Command<TData[], unknown[]> {
|
|
463
|
+
constructor(key: string);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* @see https://redis.io/commands/spop
|
|
468
|
+
*/
|
|
469
|
+
declare class SPopCommand<TData = number> extends Command<TData | null, string | null> {
|
|
470
|
+
constructor(key: string, count?: number);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* @see https://redis.io/commands/srandmember
|
|
475
|
+
*/
|
|
476
|
+
declare class SRandMemberCommand<TData> extends Command<TData | null, string | null> {
|
|
477
|
+
constructor(key: string, count?: number);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @see https://redis.io/commands/sscan
|
|
482
|
+
*/
|
|
483
|
+
declare class SScanCommand extends Command<[
|
|
484
|
+
number,
|
|
485
|
+
(string | number)[]
|
|
486
|
+
], [
|
|
487
|
+
number,
|
|
488
|
+
(string | number)[]
|
|
489
|
+
]> {
|
|
490
|
+
constructor(key: string, cursor: number, opts?: ScanCommandOptions);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* @see https://redis.io/commands/strlen
|
|
495
|
+
*/
|
|
496
|
+
declare class StrLenCommand extends Command<number, number> {
|
|
497
|
+
constructor(key: string);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* @see https://redis.io/commands/sunion
|
|
502
|
+
*/
|
|
503
|
+
declare class SUnionCommand<TData> extends Command<TData[], string[]> {
|
|
504
|
+
constructor(key: string, ...keys: string[]);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* @see https://redis.io/commands/sunionstore
|
|
509
|
+
*/
|
|
510
|
+
declare class SUnionStoreCommand extends Command<number, number> {
|
|
511
|
+
constructor(destination: string, key: string, ...keys: string[]);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* @see https://redis.io/commands/touch
|
|
516
|
+
*/
|
|
517
|
+
declare class TouchCommand extends Command<number, number> {
|
|
518
|
+
constructor(...keys: string[]);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* @see https://redis.io/commands/ttl
|
|
523
|
+
*/
|
|
524
|
+
declare class TtlCommand extends Command<number, number> {
|
|
525
|
+
constructor(key: string);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
declare type Type = "string" | "list" | "set" | "zset" | "hash" | "none";
|
|
529
|
+
/**
|
|
530
|
+
* @see https://redis.io/commands/type
|
|
531
|
+
*/
|
|
532
|
+
declare class TypeCommand extends Command<Type, Type> {
|
|
533
|
+
constructor(key: string);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @see https://redis.io/commands/unlink
|
|
538
|
+
*/
|
|
539
|
+
declare class UnlinkCommand extends Command<number, number> {
|
|
540
|
+
constructor(...keys: string[]);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
declare type ZAddCommandOptions = ({
|
|
544
|
+
nx: true;
|
|
545
|
+
xx?: never;
|
|
546
|
+
} | {
|
|
547
|
+
nx?: never;
|
|
548
|
+
xx: true;
|
|
549
|
+
} | {
|
|
550
|
+
nx?: never;
|
|
551
|
+
xx?: never;
|
|
552
|
+
}) & {
|
|
553
|
+
ch?: true;
|
|
554
|
+
};
|
|
555
|
+
declare type ZAddCommandOptionsWithIncr = ZAddCommandOptions & {
|
|
556
|
+
incr: true;
|
|
557
|
+
};
|
|
558
|
+
declare type ScoreMember<TData> = {
|
|
559
|
+
score: number;
|
|
560
|
+
member: TData;
|
|
561
|
+
};
|
|
562
|
+
/**
|
|
563
|
+
* @see https://redis.io/commands/zadd
|
|
564
|
+
*/
|
|
565
|
+
declare class ZAddCommand<TData = string> extends Command<number | null, number | null> {
|
|
566
|
+
constructor(key: string, scoreMember: ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]);
|
|
567
|
+
constructor(key: string, opts: ZAddCommandOptions | ZAddCommandOptionsWithIncr, ...scoreMemberPairs: [ScoreMember<TData>, ...ScoreMember<TData>[]]);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @see https://redis.io/commands/zcard
|
|
572
|
+
*/
|
|
573
|
+
declare class ZCardCommand extends Command<number, number> {
|
|
574
|
+
constructor(key: string);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @see https://redis.io/commands/zcount
|
|
579
|
+
*/
|
|
580
|
+
declare class ZCountCommand extends Command<number, number> {
|
|
581
|
+
constructor(key: string, min: number | string, max: number | string);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
declare type ZInterStoreCommandOptions = {
|
|
585
|
+
aggregate?: "sum" | "min" | "max";
|
|
586
|
+
} & ({
|
|
587
|
+
weight: number;
|
|
588
|
+
weights?: never;
|
|
589
|
+
} | {
|
|
590
|
+
weight?: never;
|
|
591
|
+
weights: number[];
|
|
592
|
+
} | {
|
|
593
|
+
weight?: never;
|
|
594
|
+
weights?: never;
|
|
595
|
+
});
|
|
596
|
+
/**
|
|
597
|
+
* @see https://redis.io/commands/zInterstore
|
|
598
|
+
*/
|
|
599
|
+
declare class ZInterStoreCommand extends Command<number, number> {
|
|
600
|
+
constructor(destination: string, numKeys: 1, key: string, opts?: ZInterStoreCommandOptions);
|
|
601
|
+
constructor(destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* @see https://redis.io/commands/zlexcount
|
|
606
|
+
*/
|
|
607
|
+
declare class ZLexCountCommand extends Command<number, number> {
|
|
608
|
+
constructor(key: string, min: string, max: string);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* @see https://redis.io/commands/zpopmax
|
|
613
|
+
*/
|
|
614
|
+
declare class ZPopMaxCommand<TData> extends Command<TData[], string[]> {
|
|
615
|
+
constructor(key: string, count?: number);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* @see https://redis.io/commands/zpopmin
|
|
620
|
+
*/
|
|
621
|
+
declare class ZPopMinCommand<TData> extends Command<TData[], string[]> {
|
|
622
|
+
constructor(key: string, count?: number);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare type ZRangeCommandOptions = {
|
|
626
|
+
withScores?: boolean;
|
|
627
|
+
};
|
|
628
|
+
/**
|
|
629
|
+
* @see https://redis.io/commands/zrange
|
|
630
|
+
*/
|
|
631
|
+
declare class ZRangeCommand<TData extends unknown[]> extends Command<TData, string[]> {
|
|
632
|
+
constructor(key: string, min: number | `(${number}`, max: number | `(${number}`, opts?: ZRangeCommandOptions);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* @see https://redis.io/commands/zremrangebylex
|
|
637
|
+
*/
|
|
638
|
+
declare class ZRemRangeByLexCommand extends Command<number, number> {
|
|
639
|
+
constructor(key: string, min: string, max: string);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* @see https://redis.io/commands/zremrangebyrank
|
|
644
|
+
*/
|
|
645
|
+
declare class ZRemRangeByRankCommand extends Command<number, number> {
|
|
646
|
+
constructor(key: string, start: number, stop: number);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* @see https://redis.io/commands/zremrangebyscore
|
|
651
|
+
*/
|
|
652
|
+
declare class ZRemRangeByScoreCommand extends Command<number, number> {
|
|
653
|
+
constructor(key: string, min: number, max: number);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* @see https://redis.io/commands/zscan
|
|
658
|
+
*/
|
|
659
|
+
declare class ZScanCommand extends Command<[
|
|
660
|
+
number,
|
|
661
|
+
(string | number)[]
|
|
662
|
+
], [
|
|
663
|
+
number,
|
|
664
|
+
(string | number)[]
|
|
665
|
+
]> {
|
|
666
|
+
constructor(key: string, cursor: number, opts?: ScanCommandOptions);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
declare type ZUnionStoreCommandOptions = {
|
|
670
|
+
aggregate?: "sum" | "min" | "max";
|
|
671
|
+
} & ({
|
|
672
|
+
weight: number;
|
|
673
|
+
weights?: never;
|
|
674
|
+
} | {
|
|
675
|
+
weight?: never;
|
|
676
|
+
weights: number[];
|
|
677
|
+
} | {
|
|
678
|
+
weight?: never;
|
|
679
|
+
weights?: never;
|
|
680
|
+
});
|
|
681
|
+
/**
|
|
682
|
+
* @see https://redis.io/commands/zunionstore
|
|
683
|
+
*/
|
|
684
|
+
declare class ZUnionStoreCommand extends Command<number, number> {
|
|
685
|
+
constructor(destination: string, numKeys: 1, key: string, opts?: ZUnionStoreCommandOptions);
|
|
686
|
+
constructor(destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export { SetBitCommand as $, AppendCommand as A, BitCountCommand as B, CommandArgs as C, DecrCommand as D, EchoCommand as E, FlushAllCommand as F, GetCommand as G, HttpClient as H, IncrCommand as I, LTrimCommand as J, KeysCommand as K, LIndexCommand as L, MGetCommand as M, NonEmptyArray as N, PExpireCommand as O, PersistCommand as P, PExpireAtCommand as Q, PingCommand as R, PTtlCommand as S, RenameCommand as T, RenameNXCommand as U, RPopCommand as V, ScanCommand as W, SCardCommand as X, SDiffCommand as Y, SDiffStoreCommand as Z, SetCommandOptions as _, BitPosCommand as a, SetRangeCommand as a0, SInterCommand as a1, SInterStoreCommand as a2, SMembersCommand as a3, SPopCommand as a4, SRandMemberCommand as a5, SScanCommand as a6, StrLenCommand as a7, SUnionCommand as a8, SUnionStoreCommand as a9, ZUnionStoreCommandOptions as aA, TouchCommand as aa, TtlCommand as ab, TypeCommand as ac, UnlinkCommand as ad, ScoreMember as ae, ZAddCommandOptions as af, ZAddCommandOptionsWithIncr as ag, ZCardCommand as ah, ZCountCommand as ai, ZInterStoreCommand as aj, ZLexCountCommand as ak, ZPopMaxCommand as al, ZPopMinCommand as am, ZRangeCommand as an, ZRemRangeByLexCommand as ao, ZRemRangeByRankCommand as ap, ZRemRangeByScoreCommand as aq, ZScanCommand as ar, ZUnionStoreCommand as as, Type as at, Command as au, ScanCommandOptions as av, SetCommand as aw, ZAddCommand as ax, ZInterStoreCommandOptions as ay, ZRangeCommandOptions as az, DecrByCommand as b, DelCommand as c, ExistsCommand as d, ExpireCommand as e, ExpireAtCommand as f, FlushDBCommand as g, GetBitCommand as h, GetRangeCommand as i, HDelCommand as j, HExistsCommand as k, HGetCommand as l, HGetAllCommand as m, HIncrByCommand as n, HIncrByFloatCommand as o, HKeysCommand as p, HLenCommand as q, HMGetCommand as r, HScanCommand as s, HStrLenCommand as t, HValsCommand as u, IncrByCommand as v, IncrByFloatCommand as w, LLenCommand as x, LPopCommand as y, LRangeCommand as z };
|