@upstash/redis 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/client.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  import fetch from 'isomorphic-unfetch';
2
2
  import {
3
3
  ClientObjectProps,
4
- EdgeCacheType,
5
4
  MethodReturn,
6
5
  Part,
7
- RequestConfig,
8
6
  ReturnType,
9
7
  Upstash,
10
8
  } from './types';
@@ -15,48 +13,38 @@ import {
15
13
  function parseOptions(
16
14
  url?: string | ClientObjectProps,
17
15
  token?: string,
18
- edgeUrl?: string,
19
- readFromEdge?: boolean,
20
16
  requestOptions: undefined | RequestInit = {}
21
17
  ): ClientObjectProps {
22
18
  if (typeof url === 'object' && url !== null) {
23
- return parseOptions(
24
- url.url,
25
- url.token,
26
- url.edgeUrl,
27
- url.readFromEdge,
28
- url.requestOptions
29
- );
19
+ return parseOptions(url.url, url.token, url.requestOptions);
30
20
  }
31
21
 
32
22
  // try auto fill from env variables
33
23
  if (!url && typeof window === 'undefined') {
34
24
  url = process.env.UPSTASH_REDIS_REST_URL;
35
25
  token = process.env.UPSTASH_REDIS_REST_TOKEN;
36
- edgeUrl = process.env.UPSTASH_REDIS_EDGE_URL;
37
26
  }
38
27
 
39
- readFromEdge = edgeUrl ? readFromEdge ?? true : false;
40
-
41
- return edgeUrl
42
- ? { url: url as string, token, edgeUrl, readFromEdge, requestOptions }
43
- : { url: url as string, token, requestOptions };
28
+ return { url: url as string, token, requestOptions };
44
29
  }
45
30
 
46
31
  /**
47
32
  * Fetch
48
33
  */
49
34
  async function fetchData(
50
- url: string,
51
35
  options: ClientObjectProps,
52
- init: RequestInit
36
+ ...parts: Part[]
53
37
  ): Promise<ReturnType> {
38
+ if (!options.url) {
39
+ throw 'Database url not found?';
40
+ }
41
+
54
42
  try {
55
- const res = await fetch(url, {
56
- ...init,
43
+ const res = await fetch(options.url!, {
44
+ method: 'POST',
45
+ body: JSON.stringify(parts),
57
46
  headers: {
58
47
  Authorization: `Bearer ${options.token}`,
59
- ...init.headers,
60
48
  ...options.requestOptions?.headers,
61
49
  },
62
50
  ...options.requestOptions,
@@ -73,106 +61,34 @@ async function fetchData(
73
61
  )}`;
74
62
  }
75
63
 
76
- let edge = false;
77
- let cache: EdgeCacheType = null;
78
-
79
- switch (res.headers.get('x-cache')) {
80
- case 'Hit from cloudfront':
81
- edge = true;
82
- cache = 'hit';
83
- break;
84
- case 'Miss from cloudfront':
85
- edge = true;
86
- cache = 'miss';
87
- break;
88
- }
89
-
90
64
  return {
91
65
  data: data.result,
92
66
  error: null,
93
- metadata: { edge, cache },
94
67
  };
95
68
  } catch (err) {
96
69
  return {
97
70
  data: null,
98
71
  // @ts-ignore
99
72
  error: err,
100
- metadata: { edge: false, cache: null },
101
73
  };
102
74
  }
103
75
  }
104
76
 
105
- /**
106
- * Request
107
- */
108
- function request(
109
- options: ClientObjectProps,
110
- config: RequestConfig,
111
- ...parts: Part[]
112
- ): MethodReturn {
113
- if (!options.url) {
114
- throw 'Database url not found?';
115
- }
116
-
117
- if (!options.edgeUrl) {
118
- if (options.readFromEdge || config?.edge) {
119
- throw 'You need to set Edge Url to read from edge.';
120
- }
121
- }
122
-
123
- let fromEdge = !!options.edgeUrl && options.readFromEdge !== false;
124
-
125
- if (config === undefined) {
126
- fromEdge = false;
127
- } else if (options.edgeUrl) {
128
- fromEdge = config?.edge ?? true;
129
- }
130
-
131
- if (fromEdge) {
132
- const command = encodeURI(parts.join('/'));
133
- const edgeUrlWithPath = `${options.edgeUrl!}/${command}`;
134
- return fetchData(edgeUrlWithPath, options, { method: 'GET' });
135
- } else {
136
- return fetchData(options.url!, options, {
137
- method: 'POST',
138
- body: JSON.stringify(parts),
139
- });
140
- }
141
- }
142
-
143
- function hasConfig(options: ClientObjectProps, command: string, a: any) {
144
- let lastArg;
145
- let args = [...a];
146
-
147
- if (a.length > 0) {
148
- lastArg = args.pop();
149
- }
150
-
151
- if (typeof lastArg === 'object' && lastArg !== null) {
152
- return request(options, lastArg, command, ...args);
153
- } else {
154
- return request(options, {}, command, ...a);
155
- }
156
- }
157
-
158
77
  /**
159
78
  * Creates a Upstash Redis instance
160
79
  *
161
80
  * @constructor
162
- * @param {string} url - database rest url
163
- * @param {string} token - database rest token
164
- * @param {Object} options - database config
165
- * @param {string} [options.url] - database rest url
166
- * @param {string} [options.token] - database rest token
167
- * @param {string} [options.edgeUrl] - database rest edge url
168
- * @param {string} [options.readFromEdge] - database rest read from edge
81
+ * @param {Object} options
82
+ * @param {string} [options.url]
83
+ * @param {string} [options.token]
84
+ * @param {Object} [options.requestOptions]
169
85
  *
170
86
  * @example
171
87
  * ```js
172
88
  * import upstash from '@upstash/redis'
173
89
  *
174
90
  * const redis1 = upstash('url', token);
175
- * const redis2 = upstash({ url: '', token: '', edgeUrl: '', readFromEdge: false });
91
+ * const redis2 = upstash({ url: '', token: '', requestOptions: {} });
176
92
  * ```
177
93
  */
178
94
 
@@ -191,8 +107,6 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
191
107
  {
192
108
  url: undefined,
193
109
  token: undefined,
194
- edgeUrl: undefined,
195
- readFromEdge: undefined,
196
110
  },
197
111
  parseOptions(arguments[0], arguments[1])
198
112
  );
@@ -203,58 +117,58 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
203
117
  */
204
118
 
205
119
  function append() {
206
- return request(options, undefined, 'append', ...arguments);
120
+ return fetchData(options, 'append', ...arguments);
207
121
  }
208
122
  function decr() {
209
- return request(options, undefined, 'decr', ...arguments);
123
+ return fetchData(options, 'decr', ...arguments);
210
124
  }
211
125
  function decrby() {
212
- return request(options, undefined, 'decrby', ...arguments);
126
+ return fetchData(options, 'decrby', ...arguments);
213
127
  }
214
128
  function get() {
215
- return hasConfig(options, 'get', arguments);
129
+ return fetchData(options, 'get', ...arguments);
216
130
  }
217
131
  function getrange() {
218
- return hasConfig(options, 'getrange', arguments);
132
+ return fetchData(options, 'getrange', ...arguments);
219
133
  }
220
134
  function getset() {
221
- return request(options, undefined, 'getset', ...arguments);
135
+ return fetchData(options, 'getset', ...arguments);
222
136
  }
223
137
  function incr() {
224
- return request(options, undefined, 'incr', ...arguments);
138
+ return fetchData(options, 'incr', ...arguments);
225
139
  }
226
140
  function incrby() {
227
- return request(options, undefined, 'incrby', ...arguments);
141
+ return fetchData(options, 'incrby', ...arguments);
228
142
  }
229
143
  function incrbyfloat() {
230
- return request(options, undefined, 'incrbyfloat', ...arguments);
144
+ return fetchData(options, 'incrbyfloat', ...arguments);
231
145
  }
232
146
  function mget() {
233
- return hasConfig(options, 'mget', arguments);
147
+ return fetchData(options, 'mget', ...arguments);
234
148
  }
235
149
  function mset() {
236
- return request(options, undefined, 'mset', ...arguments);
150
+ return fetchData(options, 'mset', ...arguments);
237
151
  }
238
152
  function msetnx() {
239
- return request(options, undefined, 'msetnx', ...arguments);
153
+ return fetchData(options, 'msetnx', ...arguments);
240
154
  }
241
155
  function psetex() {
242
- return request(options, undefined, 'psetex', ...arguments);
156
+ return fetchData(options, 'psetex', ...arguments);
243
157
  }
244
158
  function set() {
245
- return request(options, undefined, 'set', ...arguments);
159
+ return fetchData(options, 'set', ...arguments);
246
160
  }
247
161
  function setex() {
248
- return request(options, undefined, 'setex', ...arguments);
162
+ return fetchData(options, 'setex', ...arguments);
249
163
  }
250
164
  function setnx() {
251
- return request(options, undefined, 'setnx', ...arguments);
165
+ return fetchData(options, 'setnx', ...arguments);
252
166
  }
253
167
  function setrange() {
254
- return request(options, undefined, 'setrange', ...arguments);
168
+ return fetchData(options, 'setrange', ...arguments);
255
169
  }
256
170
  function strlen() {
257
- return hasConfig(options, 'strlen', arguments);
171
+ return fetchData(options, 'strlen', ...arguments);
258
172
  }
259
173
 
260
174
  /**
@@ -262,19 +176,19 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
262
176
  */
263
177
 
264
178
  function bitcount() {
265
- return hasConfig(options, 'bitcount', arguments);
179
+ return fetchData(options, 'bitcount', ...arguments);
266
180
  }
267
181
  function bitop() {
268
- return request(options, undefined, 'bitop', ...arguments);
182
+ return fetchData(options, 'bitop', ...arguments);
269
183
  }
270
184
  function bitpos() {
271
- return hasConfig(options, 'bitpos', arguments);
185
+ return fetchData(options, 'bitpos', ...arguments);
272
186
  }
273
187
  function getbit() {
274
- return hasConfig(options, 'getbit', arguments);
188
+ return fetchData(options, 'getbit', ...arguments);
275
189
  }
276
190
  function setbit() {
277
- return request(options, undefined, 'setbit', ...arguments);
191
+ return fetchData(options, 'setbit', ...arguments);
278
192
  }
279
193
 
280
194
  /**
@@ -282,10 +196,10 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
282
196
  */
283
197
 
284
198
  function echo() {
285
- return hasConfig(options, 'echo', arguments);
199
+ return fetchData(options, 'echo', ...arguments);
286
200
  }
287
201
  function ping() {
288
- return hasConfig(options, 'ping', arguments);
202
+ return fetchData(options, 'ping', ...arguments);
289
203
  }
290
204
 
291
205
  /**
@@ -293,46 +207,46 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
293
207
  */
294
208
 
295
209
  function hdel(): MethodReturn {
296
- return request(options, undefined, 'hdel', ...arguments);
210
+ return fetchData(options, 'hdel', ...arguments);
297
211
  }
298
212
  function hexists(): MethodReturn {
299
- return hasConfig(options, 'hexists', arguments);
213
+ return fetchData(options, 'hexists', ...arguments);
300
214
  }
301
215
  function hget(): MethodReturn {
302
- return hasConfig(options, 'hget', arguments);
216
+ return fetchData(options, 'hget', ...arguments);
303
217
  }
304
218
  function hgetall(): MethodReturn {
305
- return hasConfig(options, 'hgetall', arguments);
219
+ return fetchData(options, 'hgetall', ...arguments);
306
220
  }
307
221
  function hincrby(): MethodReturn {
308
- return request(options, undefined, 'hincrby', ...arguments);
222
+ return fetchData(options, 'hincrby', ...arguments);
309
223
  }
310
224
  function hincrbyfloat(): MethodReturn {
311
- return request(options, undefined, 'hincrbyfloat', ...arguments);
225
+ return fetchData(options, 'hincrbyfloat', ...arguments);
312
226
  }
313
227
  function hkeys(): MethodReturn {
314
- return hasConfig(options, 'hkeys', arguments);
228
+ return fetchData(options, 'hkeys', ...arguments);
315
229
  }
316
230
  function hlen(): MethodReturn {
317
- return hasConfig(options, 'hlen', arguments);
231
+ return fetchData(options, 'hlen', ...arguments);
318
232
  }
319
233
  function hmget(): MethodReturn {
320
- return hasConfig(options, 'hmget', arguments);
234
+ return fetchData(options, 'hmget', ...arguments);
321
235
  }
322
236
  function hmset(): MethodReturn {
323
- return request(options, undefined, 'hmset', ...arguments);
237
+ return fetchData(options, 'hmset', ...arguments);
324
238
  }
325
239
  function hscan(): MethodReturn {
326
- return request(options, undefined, 'hscan', ...arguments);
240
+ return fetchData(options, 'hscan', ...arguments);
327
241
  }
328
242
  function hset(): MethodReturn {
329
- return request(options, undefined, 'hset', ...arguments);
243
+ return fetchData(options, 'hset', ...arguments);
330
244
  }
331
245
  function hsetnx(): MethodReturn {
332
- return request(options, undefined, 'hsetnx', ...arguments);
246
+ return fetchData(options, 'hsetnx', ...arguments);
333
247
  }
334
248
  function hvals(): MethodReturn {
335
- return hasConfig(options, 'hvals', arguments);
249
+ return fetchData(options, 'hvals', ...arguments);
336
250
  }
337
251
 
338
252
  /**
@@ -340,55 +254,55 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
340
254
  */
341
255
 
342
256
  function del(): MethodReturn {
343
- return request(options, undefined, 'del', ...arguments);
257
+ return fetchData(options, 'del', ...arguments);
344
258
  }
345
259
  function exists(): MethodReturn {
346
- return hasConfig(options, 'exists', arguments);
260
+ return fetchData(options, 'exists', ...arguments);
347
261
  }
348
262
  function expire(): MethodReturn {
349
- return request(options, undefined, 'expire', ...arguments);
263
+ return fetchData(options, 'expire', ...arguments);
350
264
  }
351
265
  function expireat(): MethodReturn {
352
- return request(options, undefined, 'expireat', ...arguments);
266
+ return fetchData(options, 'expireat', ...arguments);
353
267
  }
354
268
  function keys(): MethodReturn {
355
- return hasConfig(options, 'keys', arguments);
269
+ return fetchData(options, 'keys', ...arguments);
356
270
  }
357
271
  function persist(): MethodReturn {
358
- return request(options, undefined, 'persist', ...arguments);
272
+ return fetchData(options, 'persist', ...arguments);
359
273
  }
360
274
  function pexpire(): MethodReturn {
361
- return request(options, undefined, 'pexpire', ...arguments);
275
+ return fetchData(options, 'pexpire', ...arguments);
362
276
  }
363
277
  function pexpireat(): MethodReturn {
364
- return request(options, undefined, 'pexpireat', ...arguments);
278
+ return fetchData(options, 'pexpireat', ...arguments);
365
279
  }
366
280
  function pttl(): MethodReturn {
367
- return hasConfig(options, 'pttl', arguments);
281
+ return fetchData(options, 'pttl', ...arguments);
368
282
  }
369
283
  function randomkey(): MethodReturn {
370
- return request(options, undefined, 'randomkey', ...arguments);
284
+ return fetchData(options, 'randomkey', ...arguments);
371
285
  }
372
286
  function rename(): MethodReturn {
373
- return request(options, undefined, 'rename', ...arguments);
287
+ return fetchData(options, 'rename', ...arguments);
374
288
  }
375
289
  function renamenx(): MethodReturn {
376
- return request(options, undefined, 'renamenx', ...arguments);
290
+ return fetchData(options, 'renamenx', ...arguments);
377
291
  }
378
292
  function scan(): MethodReturn {
379
- return request(options, undefined, 'scan', ...arguments);
293
+ return fetchData(options, 'scan', ...arguments);
380
294
  }
381
295
  function touch(): MethodReturn {
382
- return request(options, undefined, 'touch', ...arguments);
296
+ return fetchData(options, 'touch', ...arguments);
383
297
  }
384
298
  function ttl(): MethodReturn {
385
- return hasConfig(options, 'ttl', arguments);
299
+ return fetchData(options, 'ttl', ...arguments);
386
300
  }
387
301
  function type(): MethodReturn {
388
- return hasConfig(options, 'type', arguments);
302
+ return fetchData(options, 'type', ...arguments);
389
303
  }
390
304
  function unlink(): MethodReturn {
391
- return request(options, undefined, 'unlink', ...arguments);
305
+ return fetchData(options, 'unlink', ...arguments);
392
306
  }
393
307
 
394
308
  /**
@@ -396,46 +310,46 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
396
310
  */
397
311
 
398
312
  function lindex(): MethodReturn {
399
- return hasConfig(options, 'lindex', arguments);
313
+ return fetchData(options, 'lindex', ...arguments);
400
314
  }
401
315
  function linsert(): MethodReturn {
402
- return request(options, undefined, 'linsert', ...arguments);
316
+ return fetchData(options, 'linsert', ...arguments);
403
317
  }
404
318
  function llen(): MethodReturn {
405
- return hasConfig(options, 'llen', arguments);
319
+ return fetchData(options, 'llen', ...arguments);
406
320
  }
407
321
  function lpop(): MethodReturn {
408
- return request(options, undefined, 'lpop', ...arguments);
322
+ return fetchData(options, 'lpop', ...arguments);
409
323
  }
410
324
  function lpush(): MethodReturn {
411
- return request(options, undefined, 'lpush', ...arguments);
325
+ return fetchData(options, 'lpush', ...arguments);
412
326
  }
413
327
  function lpushx(): MethodReturn {
414
- return request(options, undefined, 'lpushx', ...arguments);
328
+ return fetchData(options, 'lpushx', ...arguments);
415
329
  }
416
330
  function lrange(): MethodReturn {
417
- return hasConfig(options, 'lrange', arguments);
331
+ return fetchData(options, 'lrange', ...arguments);
418
332
  }
419
333
  function lrem(): MethodReturn {
420
- return request(options, undefined, 'lrem', ...arguments);
334
+ return fetchData(options, 'lrem', ...arguments);
421
335
  }
422
336
  function lset(): MethodReturn {
423
- return request(options, undefined, 'lset', ...arguments);
337
+ return fetchData(options, 'lset', ...arguments);
424
338
  }
425
339
  function ltrim(): MethodReturn {
426
- return request(options, undefined, 'ltrim', ...arguments);
340
+ return fetchData(options, 'ltrim', ...arguments);
427
341
  }
428
342
  function rpop(): MethodReturn {
429
- return request(options, undefined, 'rpop', ...arguments);
343
+ return fetchData(options, 'rpop', ...arguments);
430
344
  }
431
345
  function rpoplpush(): MethodReturn {
432
- return request(options, undefined, 'rpoplpush', ...arguments);
346
+ return fetchData(options, 'rpoplpush', ...arguments);
433
347
  }
434
348
  function rpush(): MethodReturn {
435
- return request(options, undefined, 'rpush', ...arguments);
349
+ return fetchData(options, 'rpush', ...arguments);
436
350
  }
437
351
  function rpushx(): MethodReturn {
438
- return request(options, undefined, 'rpushx', ...arguments);
352
+ return fetchData(options, 'rpushx', ...arguments);
439
353
  }
440
354
 
441
355
  /**
@@ -443,19 +357,19 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
443
357
  */
444
358
 
445
359
  function dbsize(): MethodReturn {
446
- return hasConfig(options, 'dbsize', arguments);
360
+ return fetchData(options, 'dbsize', ...arguments);
447
361
  }
448
362
  function flushall(): MethodReturn {
449
- return request(options, undefined, 'flushall', ...arguments);
363
+ return fetchData(options, 'flushall', ...arguments);
450
364
  }
451
365
  function flushdb(): MethodReturn {
452
- return request(options, undefined, 'flushdb', ...arguments);
366
+ return fetchData(options, 'flushdb', ...arguments);
453
367
  }
454
368
  function info(): MethodReturn {
455
- return hasConfig(options, 'info', arguments);
369
+ return fetchData(options, 'info', ...arguments);
456
370
  }
457
371
  function time(): MethodReturn {
458
- return request(options, undefined, 'time', ...arguments);
372
+ return fetchData(options, 'time', ...arguments);
459
373
  }
460
374
 
461
375
  /**
@@ -463,46 +377,46 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
463
377
  */
464
378
 
465
379
  function sadd(): MethodReturn {
466
- return request(options, undefined, 'sadd', ...arguments);
380
+ return fetchData(options, 'sadd', ...arguments);
467
381
  }
468
382
  function scard(): MethodReturn {
469
- return request(options, undefined, 'scard', ...arguments);
383
+ return fetchData(options, 'scard', ...arguments);
470
384
  }
471
385
  function sdiff(): MethodReturn {
472
- return hasConfig(options, 'sdiff', arguments);
386
+ return fetchData(options, 'sdiff', ...arguments);
473
387
  }
474
388
  function sdiffstore(): MethodReturn {
475
- return request(options, undefined, 'sdiffstore', ...arguments);
389
+ return fetchData(options, 'sdiffstore', ...arguments);
476
390
  }
477
391
  function sinter(): MethodReturn {
478
- return hasConfig(options, 'sinter', arguments);
392
+ return fetchData(options, 'sinter', ...arguments);
479
393
  }
480
394
  function sinterstore(): MethodReturn {
481
- return request(options, undefined, 'sinterstore', ...arguments);
395
+ return fetchData(options, 'sinterstore', ...arguments);
482
396
  }
483
397
  function sismember(): MethodReturn {
484
- return hasConfig(options, 'sismember', arguments);
398
+ return fetchData(options, 'sismember', ...arguments);
485
399
  }
486
400
  function smembers(): MethodReturn {
487
- return hasConfig(options, 'smembers', arguments);
401
+ return fetchData(options, 'smembers', ...arguments);
488
402
  }
489
403
  function smove(): MethodReturn {
490
- return request(options, undefined, 'smove', ...arguments);
404
+ return fetchData(options, 'smove', ...arguments);
491
405
  }
492
406
  function spop(): MethodReturn {
493
- return request(options, undefined, 'spop', ...arguments);
407
+ return fetchData(options, 'spop', ...arguments);
494
408
  }
495
409
  function srandmember(): MethodReturn {
496
- return hasConfig(options, 'srandmember', arguments);
410
+ return fetchData(options, 'srandmember', ...arguments);
497
411
  }
498
412
  function srem(): MethodReturn {
499
- return request(options, undefined, 'srem', ...arguments);
413
+ return fetchData(options, 'srem', ...arguments);
500
414
  }
501
415
  function sunion(): MethodReturn {
502
- return hasConfig(options, 'sunion', arguments);
416
+ return fetchData(options, 'sunion', ...arguments);
503
417
  }
504
418
  function sunionstore(): MethodReturn {
505
- return request(options, undefined, 'sunionstore', ...arguments);
419
+ return fetchData(options, 'sunionstore', ...arguments);
506
420
  }
507
421
 
508
422
  /**
@@ -510,70 +424,70 @@ function upstash(url?: string | ClientObjectProps, token?: string): Upstash {
510
424
  */
511
425
 
512
426
  function zadd(): MethodReturn {
513
- return request(options, undefined, 'zadd', ...arguments);
427
+ return fetchData(options, 'zadd', ...arguments);
514
428
  }
515
429
  function zcard(): MethodReturn {
516
- return hasConfig(options, 'zcard', arguments);
430
+ return fetchData(options, 'zcard', ...arguments);
517
431
  }
518
432
  function zcount(): MethodReturn {
519
- return hasConfig(options, 'zcount', arguments);
433
+ return fetchData(options, 'zcount', ...arguments);
520
434
  }
521
435
  function zincrby(): MethodReturn {
522
- return request(options, undefined, 'zincrby', ...arguments);
436
+ return fetchData(options, 'zincrby', ...arguments);
523
437
  }
524
438
  function zinterstore(): MethodReturn {
525
- return request(options, undefined, 'zinterstore', ...arguments);
439
+ return fetchData(options, 'zinterstore', ...arguments);
526
440
  }
527
441
  function zlexcount(): MethodReturn {
528
- return hasConfig(options, 'zlexcount', arguments);
442
+ return fetchData(options, 'zlexcount', ...arguments);
529
443
  }
530
444
  function zpopmax(): MethodReturn {
531
- return request(options, undefined, 'zpopmax', ...arguments);
445
+ return fetchData(options, 'zpopmax', ...arguments);
532
446
  }
533
447
  function zpopmin(): MethodReturn {
534
- return request(options, undefined, 'zpopmin', ...arguments);
448
+ return fetchData(options, 'zpopmin', ...arguments);
535
449
  }
536
450
  function zrange(): MethodReturn {
537
- return hasConfig(options, 'zrange', arguments);
451
+ return fetchData(options, 'zrange', ...arguments);
538
452
  }
539
453
  function zrangebylex(): MethodReturn {
540
- return hasConfig(options, 'zrangebylex', arguments);
454
+ return fetchData(options, 'zrangebylex', ...arguments);
541
455
  }
542
456
  function zrangebyscore(): MethodReturn {
543
- return hasConfig(options, 'zrangebyscore', arguments);
457
+ return fetchData(options, 'zrangebyscore', ...arguments);
544
458
  }
545
459
  function zrank(): MethodReturn {
546
- return hasConfig(options, 'zrank', arguments);
460
+ return fetchData(options, 'zrank', ...arguments);
547
461
  }
548
462
  function zrem(): MethodReturn {
549
- return request(options, undefined, 'zrem', ...arguments);
463
+ return fetchData(options, 'zrem', ...arguments);
550
464
  }
551
465
  function zremrangebylex(): MethodReturn {
552
- return request(options, undefined, 'zremrangebylex', ...arguments);
466
+ return fetchData(options, 'zremrangebylex', ...arguments);
553
467
  }
554
468
  function zremrangebyrank(): MethodReturn {
555
- return request(options, undefined, 'zremrangebyrank', ...arguments);
469
+ return fetchData(options, 'zremrangebyrank', ...arguments);
556
470
  }
557
471
  function zremrangebyscore(): MethodReturn {
558
- return request(options, undefined, 'zremrangebyscore', ...arguments);
472
+ return fetchData(options, 'zremrangebyscore', ...arguments);
559
473
  }
560
474
  function zrevrange(): MethodReturn {
561
- return hasConfig(options, 'zrevrange', arguments);
475
+ return fetchData(options, 'zrevrange', ...arguments);
562
476
  }
563
477
  function zrevrangebylex(): MethodReturn {
564
- return hasConfig(options, 'zrevrangebylex', arguments);
478
+ return fetchData(options, 'zrevrangebylex', ...arguments);
565
479
  }
566
480
  function zrevrangebyscore(): MethodReturn {
567
- return hasConfig(options, 'zrevrangebyscore', arguments);
481
+ return fetchData(options, 'zrevrangebyscore', ...arguments);
568
482
  }
569
483
  function zrevrank(): MethodReturn {
570
- return hasConfig(options, 'zrevrank', arguments);
484
+ return fetchData(options, 'zrevrank', ...arguments);
571
485
  }
572
486
  function zscore(): MethodReturn {
573
- return hasConfig(options, 'zscore', arguments);
487
+ return fetchData(options, 'zscore', ...arguments);
574
488
  }
575
489
  function zunionstore(): MethodReturn {
576
- return request(options, undefined, 'zunionstore', ...arguments);
490
+ return fetchData(options, 'zunionstore', ...arguments);
577
491
  }
578
492
 
579
493
  return {