@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/README.md CHANGED
@@ -58,38 +58,6 @@ import { set } from '@upstash/redis';
58
58
 
59
59
  > If you define `UPSTASH_REDIS_REST_URL` and` UPSTASH_REDIS_REST_TOKEN` environment variables, you can skip the auth().
60
60
 
61
- ### Edge Support
62
-
63
- Once you set `edgeUrl`, all read commands are fetched using edge url. The REST URL is used for write/update commands.
64
-
65
- ```typescript
66
- import { auth, get } from '@upstash/redis';
67
-
68
- auth({
69
- url: 'UPSTASH_REDIS_REST_URL',
70
- token: 'UPSTASH_REDIS_REST_TOKEN',
71
- edgeUrl: 'UPSTASH_REDIS_EDGE_URL',
72
- });
73
-
74
- (async () => {
75
- try {
76
- // the below reads using edge url
77
- const { data, error, metadata } = await get('key');
78
- if (error) throw error;
79
- console.log(data);
80
- // -> null | string
81
- console.log(metadata);
82
- // -> { edge: boolean, cache: null | 'miss' | 'hit' }
83
-
84
- // the below reads using REST url (non-edge)
85
- const get1 = await get('key', { edge: false });
86
- if (get1.error) throw get1.error;
87
- } catch (error) {
88
- console.error(error);
89
- }
90
- })();
91
- ```
92
-
93
61
  ## Docs
94
62
 
95
63
  See [the documentation](https://docs.upstash.com/features/javascriptsdk) for details.
@@ -3,20 +3,17 @@ import { ClientObjectProps, Upstash } from './types';
3
3
  * Creates a Upstash Redis instance
4
4
  *
5
5
  * @constructor
6
- * @param {string} url - database rest url
7
- * @param {string} token - database rest token
8
- * @param {Object} options - database config
9
- * @param {string} [options.url] - database rest url
10
- * @param {string} [options.token] - database rest token
11
- * @param {string} [options.edgeUrl] - database rest edge url
12
- * @param {string} [options.readFromEdge] - database rest read from edge
6
+ * @param {Object} options
7
+ * @param {string} [options.url]
8
+ * @param {string} [options.token]
9
+ * @param {Object} [options.requestOptions]
13
10
  *
14
11
  * @example
15
12
  * ```js
16
13
  * import upstash from '@upstash/redis'
17
14
  *
18
15
  * const redis1 = upstash('url', token);
19
- * const redis2 = upstash({ url: '', token: '', edgeUrl: '', readFromEdge: false });
16
+ * const redis2 = upstash({ url: '', token: '', requestOptions: {} });
20
17
  * ```
21
18
  */
22
19
  declare function upstash(options?: ClientObjectProps): Upstash;
@@ -7,31 +7,30 @@ const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
7
7
  /**
8
8
  * Parse Options
9
9
  */
10
- function parseOptions(url, token, edgeUrl, readFromEdge, requestOptions = {}) {
10
+ function parseOptions(url, token, requestOptions = {}) {
11
11
  if (typeof url === 'object' && url !== null) {
12
- return parseOptions(url.url, url.token, url.edgeUrl, url.readFromEdge, url.requestOptions);
12
+ return parseOptions(url.url, url.token, url.requestOptions);
13
13
  }
14
14
  // try auto fill from env variables
15
15
  if (!url && typeof window === 'undefined') {
16
16
  url = process.env.UPSTASH_REDIS_REST_URL;
17
17
  token = process.env.UPSTASH_REDIS_REST_TOKEN;
18
- edgeUrl = process.env.UPSTASH_REDIS_EDGE_URL;
19
18
  }
20
- readFromEdge = edgeUrl ? readFromEdge ?? true : false;
21
- return edgeUrl
22
- ? { url: url, token, edgeUrl, readFromEdge, requestOptions }
23
- : { url: url, token, requestOptions };
19
+ return { url: url, token, requestOptions };
24
20
  }
25
21
  /**
26
22
  * Fetch
27
23
  */
28
- async function fetchData(url, options, init) {
24
+ async function fetchData(options, ...parts) {
25
+ if (!options.url) {
26
+ throw 'Database url not found?';
27
+ }
29
28
  try {
30
- const res = await (0, isomorphic_unfetch_1.default)(url, {
31
- ...init,
29
+ const res = await (0, isomorphic_unfetch_1.default)(options.url, {
30
+ method: 'POST',
31
+ body: JSON.stringify(parts),
32
32
  headers: {
33
33
  Authorization: `Bearer ${options.token}`,
34
- ...init.headers,
35
34
  ...options.requestOptions?.headers,
36
35
  },
37
36
  ...options.requestOptions,
@@ -42,22 +41,9 @@ async function fetchData(url, options, init) {
42
41
  throw data.error;
43
42
  throw `Upstash failed with (${res.status}): ${JSON.stringify(data, null, 2)}`;
44
43
  }
45
- let edge = false;
46
- let cache = null;
47
- switch (res.headers.get('x-cache')) {
48
- case 'Hit from cloudfront':
49
- edge = true;
50
- cache = 'hit';
51
- break;
52
- case 'Miss from cloudfront':
53
- edge = true;
54
- cache = 'miss';
55
- break;
56
- }
57
44
  return {
58
45
  data: data.result,
59
46
  error: null,
60
- metadata: { edge, cache },
61
47
  };
62
48
  }
63
49
  catch (err) {
@@ -65,54 +51,9 @@ async function fetchData(url, options, init) {
65
51
  data: null,
66
52
  // @ts-ignore
67
53
  error: err,
68
- metadata: { edge: false, cache: null },
69
54
  };
70
55
  }
71
56
  }
72
- /**
73
- * Request
74
- */
75
- function request(options, config, ...parts) {
76
- if (!options.url) {
77
- throw 'Database url not found?';
78
- }
79
- if (!options.edgeUrl) {
80
- if (options.readFromEdge || config?.edge) {
81
- throw 'You need to set Edge Url to read from edge.';
82
- }
83
- }
84
- let fromEdge = !!options.edgeUrl && options.readFromEdge !== false;
85
- if (config === undefined) {
86
- fromEdge = false;
87
- }
88
- else if (options.edgeUrl) {
89
- fromEdge = config?.edge ?? true;
90
- }
91
- if (fromEdge) {
92
- const command = encodeURI(parts.join('/'));
93
- const edgeUrlWithPath = `${options.edgeUrl}/${command}`;
94
- return fetchData(edgeUrlWithPath, options, { method: 'GET' });
95
- }
96
- else {
97
- return fetchData(options.url, options, {
98
- method: 'POST',
99
- body: JSON.stringify(parts),
100
- });
101
- }
102
- }
103
- function hasConfig(options, command, a) {
104
- let lastArg;
105
- let args = [...a];
106
- if (a.length > 0) {
107
- lastArg = args.pop();
108
- }
109
- if (typeof lastArg === 'object' && lastArg !== null) {
110
- return request(options, lastArg, command, ...args);
111
- }
112
- else {
113
- return request(options, {}, command, ...a);
114
- }
115
- }
116
57
  function upstash(url, token) {
117
58
  const options = parseOptions(url, token);
118
59
  /**
@@ -122,369 +63,367 @@ function upstash(url, token) {
122
63
  Object.assign(options, {
123
64
  url: undefined,
124
65
  token: undefined,
125
- edgeUrl: undefined,
126
- readFromEdge: undefined,
127
66
  }, parseOptions(arguments[0], arguments[1]));
128
67
  }
129
68
  /**
130
69
  * STRING
131
70
  */
132
71
  function append() {
133
- return request(options, undefined, 'append', ...arguments);
72
+ return fetchData(options, 'append', ...arguments);
134
73
  }
135
74
  function decr() {
136
- return request(options, undefined, 'decr', ...arguments);
75
+ return fetchData(options, 'decr', ...arguments);
137
76
  }
138
77
  function decrby() {
139
- return request(options, undefined, 'decrby', ...arguments);
78
+ return fetchData(options, 'decrby', ...arguments);
140
79
  }
141
80
  function get() {
142
- return hasConfig(options, 'get', arguments);
81
+ return fetchData(options, 'get', ...arguments);
143
82
  }
144
83
  function getrange() {
145
- return hasConfig(options, 'getrange', arguments);
84
+ return fetchData(options, 'getrange', ...arguments);
146
85
  }
147
86
  function getset() {
148
- return request(options, undefined, 'getset', ...arguments);
87
+ return fetchData(options, 'getset', ...arguments);
149
88
  }
150
89
  function incr() {
151
- return request(options, undefined, 'incr', ...arguments);
90
+ return fetchData(options, 'incr', ...arguments);
152
91
  }
153
92
  function incrby() {
154
- return request(options, undefined, 'incrby', ...arguments);
93
+ return fetchData(options, 'incrby', ...arguments);
155
94
  }
156
95
  function incrbyfloat() {
157
- return request(options, undefined, 'incrbyfloat', ...arguments);
96
+ return fetchData(options, 'incrbyfloat', ...arguments);
158
97
  }
159
98
  function mget() {
160
- return hasConfig(options, 'mget', arguments);
99
+ return fetchData(options, 'mget', ...arguments);
161
100
  }
162
101
  function mset() {
163
- return request(options, undefined, 'mset', ...arguments);
102
+ return fetchData(options, 'mset', ...arguments);
164
103
  }
165
104
  function msetnx() {
166
- return request(options, undefined, 'msetnx', ...arguments);
105
+ return fetchData(options, 'msetnx', ...arguments);
167
106
  }
168
107
  function psetex() {
169
- return request(options, undefined, 'psetex', ...arguments);
108
+ return fetchData(options, 'psetex', ...arguments);
170
109
  }
171
110
  function set() {
172
- return request(options, undefined, 'set', ...arguments);
111
+ return fetchData(options, 'set', ...arguments);
173
112
  }
174
113
  function setex() {
175
- return request(options, undefined, 'setex', ...arguments);
114
+ return fetchData(options, 'setex', ...arguments);
176
115
  }
177
116
  function setnx() {
178
- return request(options, undefined, 'setnx', ...arguments);
117
+ return fetchData(options, 'setnx', ...arguments);
179
118
  }
180
119
  function setrange() {
181
- return request(options, undefined, 'setrange', ...arguments);
120
+ return fetchData(options, 'setrange', ...arguments);
182
121
  }
183
122
  function strlen() {
184
- return hasConfig(options, 'strlen', arguments);
123
+ return fetchData(options, 'strlen', ...arguments);
185
124
  }
186
125
  /**
187
126
  * BITMAPS
188
127
  */
189
128
  function bitcount() {
190
- return hasConfig(options, 'bitcount', arguments);
129
+ return fetchData(options, 'bitcount', ...arguments);
191
130
  }
192
131
  function bitop() {
193
- return request(options, undefined, 'bitop', ...arguments);
132
+ return fetchData(options, 'bitop', ...arguments);
194
133
  }
195
134
  function bitpos() {
196
- return hasConfig(options, 'bitpos', arguments);
135
+ return fetchData(options, 'bitpos', ...arguments);
197
136
  }
198
137
  function getbit() {
199
- return hasConfig(options, 'getbit', arguments);
138
+ return fetchData(options, 'getbit', ...arguments);
200
139
  }
201
140
  function setbit() {
202
- return request(options, undefined, 'setbit', ...arguments);
141
+ return fetchData(options, 'setbit', ...arguments);
203
142
  }
204
143
  /**
205
144
  * CONNECTION
206
145
  */
207
146
  function echo() {
208
- return hasConfig(options, 'echo', arguments);
147
+ return fetchData(options, 'echo', ...arguments);
209
148
  }
210
149
  function ping() {
211
- return hasConfig(options, 'ping', arguments);
150
+ return fetchData(options, 'ping', ...arguments);
212
151
  }
213
152
  /**
214
153
  * HASHES
215
154
  */
216
155
  function hdel() {
217
- return request(options, undefined, 'hdel', ...arguments);
156
+ return fetchData(options, 'hdel', ...arguments);
218
157
  }
219
158
  function hexists() {
220
- return hasConfig(options, 'hexists', arguments);
159
+ return fetchData(options, 'hexists', ...arguments);
221
160
  }
222
161
  function hget() {
223
- return hasConfig(options, 'hget', arguments);
162
+ return fetchData(options, 'hget', ...arguments);
224
163
  }
225
164
  function hgetall() {
226
- return hasConfig(options, 'hgetall', arguments);
165
+ return fetchData(options, 'hgetall', ...arguments);
227
166
  }
228
167
  function hincrby() {
229
- return request(options, undefined, 'hincrby', ...arguments);
168
+ return fetchData(options, 'hincrby', ...arguments);
230
169
  }
231
170
  function hincrbyfloat() {
232
- return request(options, undefined, 'hincrbyfloat', ...arguments);
171
+ return fetchData(options, 'hincrbyfloat', ...arguments);
233
172
  }
234
173
  function hkeys() {
235
- return hasConfig(options, 'hkeys', arguments);
174
+ return fetchData(options, 'hkeys', ...arguments);
236
175
  }
237
176
  function hlen() {
238
- return hasConfig(options, 'hlen', arguments);
177
+ return fetchData(options, 'hlen', ...arguments);
239
178
  }
240
179
  function hmget() {
241
- return hasConfig(options, 'hmget', arguments);
180
+ return fetchData(options, 'hmget', ...arguments);
242
181
  }
243
182
  function hmset() {
244
- return request(options, undefined, 'hmset', ...arguments);
183
+ return fetchData(options, 'hmset', ...arguments);
245
184
  }
246
185
  function hscan() {
247
- return request(options, undefined, 'hscan', ...arguments);
186
+ return fetchData(options, 'hscan', ...arguments);
248
187
  }
249
188
  function hset() {
250
- return request(options, undefined, 'hset', ...arguments);
189
+ return fetchData(options, 'hset', ...arguments);
251
190
  }
252
191
  function hsetnx() {
253
- return request(options, undefined, 'hsetnx', ...arguments);
192
+ return fetchData(options, 'hsetnx', ...arguments);
254
193
  }
255
194
  function hvals() {
256
- return hasConfig(options, 'hvals', arguments);
195
+ return fetchData(options, 'hvals', ...arguments);
257
196
  }
258
197
  /**
259
198
  * KEYS
260
199
  */
261
200
  function del() {
262
- return request(options, undefined, 'del', ...arguments);
201
+ return fetchData(options, 'del', ...arguments);
263
202
  }
264
203
  function exists() {
265
- return hasConfig(options, 'exists', arguments);
204
+ return fetchData(options, 'exists', ...arguments);
266
205
  }
267
206
  function expire() {
268
- return request(options, undefined, 'expire', ...arguments);
207
+ return fetchData(options, 'expire', ...arguments);
269
208
  }
270
209
  function expireat() {
271
- return request(options, undefined, 'expireat', ...arguments);
210
+ return fetchData(options, 'expireat', ...arguments);
272
211
  }
273
212
  function keys() {
274
- return hasConfig(options, 'keys', arguments);
213
+ return fetchData(options, 'keys', ...arguments);
275
214
  }
276
215
  function persist() {
277
- return request(options, undefined, 'persist', ...arguments);
216
+ return fetchData(options, 'persist', ...arguments);
278
217
  }
279
218
  function pexpire() {
280
- return request(options, undefined, 'pexpire', ...arguments);
219
+ return fetchData(options, 'pexpire', ...arguments);
281
220
  }
282
221
  function pexpireat() {
283
- return request(options, undefined, 'pexpireat', ...arguments);
222
+ return fetchData(options, 'pexpireat', ...arguments);
284
223
  }
285
224
  function pttl() {
286
- return hasConfig(options, 'pttl', arguments);
225
+ return fetchData(options, 'pttl', ...arguments);
287
226
  }
288
227
  function randomkey() {
289
- return request(options, undefined, 'randomkey', ...arguments);
228
+ return fetchData(options, 'randomkey', ...arguments);
290
229
  }
291
230
  function rename() {
292
- return request(options, undefined, 'rename', ...arguments);
231
+ return fetchData(options, 'rename', ...arguments);
293
232
  }
294
233
  function renamenx() {
295
- return request(options, undefined, 'renamenx', ...arguments);
234
+ return fetchData(options, 'renamenx', ...arguments);
296
235
  }
297
236
  function scan() {
298
- return request(options, undefined, 'scan', ...arguments);
237
+ return fetchData(options, 'scan', ...arguments);
299
238
  }
300
239
  function touch() {
301
- return request(options, undefined, 'touch', ...arguments);
240
+ return fetchData(options, 'touch', ...arguments);
302
241
  }
303
242
  function ttl() {
304
- return hasConfig(options, 'ttl', arguments);
243
+ return fetchData(options, 'ttl', ...arguments);
305
244
  }
306
245
  function type() {
307
- return hasConfig(options, 'type', arguments);
246
+ return fetchData(options, 'type', ...arguments);
308
247
  }
309
248
  function unlink() {
310
- return request(options, undefined, 'unlink', ...arguments);
249
+ return fetchData(options, 'unlink', ...arguments);
311
250
  }
312
251
  /**
313
252
  * LISTS
314
253
  */
315
254
  function lindex() {
316
- return hasConfig(options, 'lindex', arguments);
255
+ return fetchData(options, 'lindex', ...arguments);
317
256
  }
318
257
  function linsert() {
319
- return request(options, undefined, 'linsert', ...arguments);
258
+ return fetchData(options, 'linsert', ...arguments);
320
259
  }
321
260
  function llen() {
322
- return hasConfig(options, 'llen', arguments);
261
+ return fetchData(options, 'llen', ...arguments);
323
262
  }
324
263
  function lpop() {
325
- return request(options, undefined, 'lpop', ...arguments);
264
+ return fetchData(options, 'lpop', ...arguments);
326
265
  }
327
266
  function lpush() {
328
- return request(options, undefined, 'lpush', ...arguments);
267
+ return fetchData(options, 'lpush', ...arguments);
329
268
  }
330
269
  function lpushx() {
331
- return request(options, undefined, 'lpushx', ...arguments);
270
+ return fetchData(options, 'lpushx', ...arguments);
332
271
  }
333
272
  function lrange() {
334
- return hasConfig(options, 'lrange', arguments);
273
+ return fetchData(options, 'lrange', ...arguments);
335
274
  }
336
275
  function lrem() {
337
- return request(options, undefined, 'lrem', ...arguments);
276
+ return fetchData(options, 'lrem', ...arguments);
338
277
  }
339
278
  function lset() {
340
- return request(options, undefined, 'lset', ...arguments);
279
+ return fetchData(options, 'lset', ...arguments);
341
280
  }
342
281
  function ltrim() {
343
- return request(options, undefined, 'ltrim', ...arguments);
282
+ return fetchData(options, 'ltrim', ...arguments);
344
283
  }
345
284
  function rpop() {
346
- return request(options, undefined, 'rpop', ...arguments);
285
+ return fetchData(options, 'rpop', ...arguments);
347
286
  }
348
287
  function rpoplpush() {
349
- return request(options, undefined, 'rpoplpush', ...arguments);
288
+ return fetchData(options, 'rpoplpush', ...arguments);
350
289
  }
351
290
  function rpush() {
352
- return request(options, undefined, 'rpush', ...arguments);
291
+ return fetchData(options, 'rpush', ...arguments);
353
292
  }
354
293
  function rpushx() {
355
- return request(options, undefined, 'rpushx', ...arguments);
294
+ return fetchData(options, 'rpushx', ...arguments);
356
295
  }
357
296
  /**
358
297
  * SERVER
359
298
  */
360
299
  function dbsize() {
361
- return hasConfig(options, 'dbsize', arguments);
300
+ return fetchData(options, 'dbsize', ...arguments);
362
301
  }
363
302
  function flushall() {
364
- return request(options, undefined, 'flushall', ...arguments);
303
+ return fetchData(options, 'flushall', ...arguments);
365
304
  }
366
305
  function flushdb() {
367
- return request(options, undefined, 'flushdb', ...arguments);
306
+ return fetchData(options, 'flushdb', ...arguments);
368
307
  }
369
308
  function info() {
370
- return hasConfig(options, 'info', arguments);
309
+ return fetchData(options, 'info', ...arguments);
371
310
  }
372
311
  function time() {
373
- return request(options, undefined, 'time', ...arguments);
312
+ return fetchData(options, 'time', ...arguments);
374
313
  }
375
314
  /**
376
315
  * SET
377
316
  */
378
317
  function sadd() {
379
- return request(options, undefined, 'sadd', ...arguments);
318
+ return fetchData(options, 'sadd', ...arguments);
380
319
  }
381
320
  function scard() {
382
- return request(options, undefined, 'scard', ...arguments);
321
+ return fetchData(options, 'scard', ...arguments);
383
322
  }
384
323
  function sdiff() {
385
- return hasConfig(options, 'sdiff', arguments);
324
+ return fetchData(options, 'sdiff', ...arguments);
386
325
  }
387
326
  function sdiffstore() {
388
- return request(options, undefined, 'sdiffstore', ...arguments);
327
+ return fetchData(options, 'sdiffstore', ...arguments);
389
328
  }
390
329
  function sinter() {
391
- return hasConfig(options, 'sinter', arguments);
330
+ return fetchData(options, 'sinter', ...arguments);
392
331
  }
393
332
  function sinterstore() {
394
- return request(options, undefined, 'sinterstore', ...arguments);
333
+ return fetchData(options, 'sinterstore', ...arguments);
395
334
  }
396
335
  function sismember() {
397
- return hasConfig(options, 'sismember', arguments);
336
+ return fetchData(options, 'sismember', ...arguments);
398
337
  }
399
338
  function smembers() {
400
- return hasConfig(options, 'smembers', arguments);
339
+ return fetchData(options, 'smembers', ...arguments);
401
340
  }
402
341
  function smove() {
403
- return request(options, undefined, 'smove', ...arguments);
342
+ return fetchData(options, 'smove', ...arguments);
404
343
  }
405
344
  function spop() {
406
- return request(options, undefined, 'spop', ...arguments);
345
+ return fetchData(options, 'spop', ...arguments);
407
346
  }
408
347
  function srandmember() {
409
- return hasConfig(options, 'srandmember', arguments);
348
+ return fetchData(options, 'srandmember', ...arguments);
410
349
  }
411
350
  function srem() {
412
- return request(options, undefined, 'srem', ...arguments);
351
+ return fetchData(options, 'srem', ...arguments);
413
352
  }
414
353
  function sunion() {
415
- return hasConfig(options, 'sunion', arguments);
354
+ return fetchData(options, 'sunion', ...arguments);
416
355
  }
417
356
  function sunionstore() {
418
- return request(options, undefined, 'sunionstore', ...arguments);
357
+ return fetchData(options, 'sunionstore', ...arguments);
419
358
  }
420
359
  /**
421
360
  * SORTED SETS
422
361
  */
423
362
  function zadd() {
424
- return request(options, undefined, 'zadd', ...arguments);
363
+ return fetchData(options, 'zadd', ...arguments);
425
364
  }
426
365
  function zcard() {
427
- return hasConfig(options, 'zcard', arguments);
366
+ return fetchData(options, 'zcard', ...arguments);
428
367
  }
429
368
  function zcount() {
430
- return hasConfig(options, 'zcount', arguments);
369
+ return fetchData(options, 'zcount', ...arguments);
431
370
  }
432
371
  function zincrby() {
433
- return request(options, undefined, 'zincrby', ...arguments);
372
+ return fetchData(options, 'zincrby', ...arguments);
434
373
  }
435
374
  function zinterstore() {
436
- return request(options, undefined, 'zinterstore', ...arguments);
375
+ return fetchData(options, 'zinterstore', ...arguments);
437
376
  }
438
377
  function zlexcount() {
439
- return hasConfig(options, 'zlexcount', arguments);
378
+ return fetchData(options, 'zlexcount', ...arguments);
440
379
  }
441
380
  function zpopmax() {
442
- return request(options, undefined, 'zpopmax', ...arguments);
381
+ return fetchData(options, 'zpopmax', ...arguments);
443
382
  }
444
383
  function zpopmin() {
445
- return request(options, undefined, 'zpopmin', ...arguments);
384
+ return fetchData(options, 'zpopmin', ...arguments);
446
385
  }
447
386
  function zrange() {
448
- return hasConfig(options, 'zrange', arguments);
387
+ return fetchData(options, 'zrange', ...arguments);
449
388
  }
450
389
  function zrangebylex() {
451
- return hasConfig(options, 'zrangebylex', arguments);
390
+ return fetchData(options, 'zrangebylex', ...arguments);
452
391
  }
453
392
  function zrangebyscore() {
454
- return hasConfig(options, 'zrangebyscore', arguments);
393
+ return fetchData(options, 'zrangebyscore', ...arguments);
455
394
  }
456
395
  function zrank() {
457
- return hasConfig(options, 'zrank', arguments);
396
+ return fetchData(options, 'zrank', ...arguments);
458
397
  }
459
398
  function zrem() {
460
- return request(options, undefined, 'zrem', ...arguments);
399
+ return fetchData(options, 'zrem', ...arguments);
461
400
  }
462
401
  function zremrangebylex() {
463
- return request(options, undefined, 'zremrangebylex', ...arguments);
402
+ return fetchData(options, 'zremrangebylex', ...arguments);
464
403
  }
465
404
  function zremrangebyrank() {
466
- return request(options, undefined, 'zremrangebyrank', ...arguments);
405
+ return fetchData(options, 'zremrangebyrank', ...arguments);
467
406
  }
468
407
  function zremrangebyscore() {
469
- return request(options, undefined, 'zremrangebyscore', ...arguments);
408
+ return fetchData(options, 'zremrangebyscore', ...arguments);
470
409
  }
471
410
  function zrevrange() {
472
- return hasConfig(options, 'zrevrange', arguments);
411
+ return fetchData(options, 'zrevrange', ...arguments);
473
412
  }
474
413
  function zrevrangebylex() {
475
- return hasConfig(options, 'zrevrangebylex', arguments);
414
+ return fetchData(options, 'zrevrangebylex', ...arguments);
476
415
  }
477
416
  function zrevrangebyscore() {
478
- return hasConfig(options, 'zrevrangebyscore', arguments);
417
+ return fetchData(options, 'zrevrangebyscore', ...arguments);
479
418
  }
480
419
  function zrevrank() {
481
- return hasConfig(options, 'zrevrank', arguments);
420
+ return fetchData(options, 'zrevrank', ...arguments);
482
421
  }
483
422
  function zscore() {
484
- return hasConfig(options, 'zscore', arguments);
423
+ return fetchData(options, 'zscore', ...arguments);
485
424
  }
486
425
  function zunionstore() {
487
- return request(options, undefined, 'zunionstore', ...arguments);
426
+ return fetchData(options, 'zunionstore', ...arguments);
488
427
  }
489
428
  return {
490
429
  auth,