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