@upstash/redis 0.1.22 → 0.2.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/README.md +13 -53
- package/dist/main/client.d.ts +21 -0
- package/dist/main/client.js +556 -0
- package/dist/main/index-cjs.d.ts +1 -0
- package/dist/main/index-cjs.js +120 -0
- package/dist/main/types.d.ts +177 -0
- package/dist/main/{src/type.js → types.js} +0 -1
- package/dist/module/client.d.ts +21 -0
- package/dist/module/client.js +551 -0
- package/dist/module/index.d.ts +3 -0
- package/dist/module/index.js +3 -0
- package/dist/module/types.d.ts +177 -0
- package/dist/module/types.js +1 -0
- package/package.json +16 -25
- package/src/client.ts +307 -921
- package/src/index-cjs.ts +117 -0
- package/src/index.ts +4 -119
- package/src/types.ts +408 -0
- package/tsconfig.json +9 -7
- package/tsconfig.module.json +3 -2
- package/dist/main/src/client.d.ts +0 -25
- package/dist/main/src/client.d.ts.map +0 -1
- package/dist/main/src/client.js +0 -748
- 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 -466
- 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/src/client.d.ts +0 -25
- package/dist/module/src/client.d.ts.map +0 -1
- package/dist/module/src/client.js +0 -743
- package/dist/module/src/client.js.map +0 -1
- package/dist/module/src/index.d.ts +0 -73
- package/dist/module/src/index.d.ts.map +0 -1
- package/dist/module/src/index.js +0 -5
- package/dist/module/src/index.js.map +0 -1
- package/dist/module/src/type.d.ts +0 -466
- package/dist/module/src/type.d.ts.map +0 -1
- package/dist/module/src/type.js +0 -2
- package/dist/module/src/type.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/src/type.ts +0 -1194
- package/utils/helper.ts +0 -17
- package/webpack.config.js +0 -34
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ An HTTP/REST based Redis client built on top of [Upstash REST API](https://docs.
|
|
|
9
9
|
It is the only connectionless (HTTP based) Redis client and designed for:
|
|
10
10
|
|
|
11
11
|
- Serverless functions (AWS Lambda ...)
|
|
12
|
-
- Cloudflare Workers (see [the example](https://github.com/upstash/upstash-redis/tree/master/examples/workers
|
|
12
|
+
- Cloudflare Workers (see [the example](https://github.com/upstash/upstash-redis/tree/master/examples/cloudflare-workers))
|
|
13
13
|
- Fastly Compute@Edge
|
|
14
14
|
- Next.js, Jamstack ...
|
|
15
15
|
- Client side web/mobile applications
|
|
@@ -26,78 +26,38 @@ See [the list of APIs](https://docs.upstash.com/features/restapi#rest---redis-ap
|
|
|
26
26
|
npm install @upstash/redis
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
### Usage with
|
|
29
|
+
### Usage with Promise
|
|
30
30
|
|
|
31
31
|
```typescript
|
|
32
|
-
import
|
|
32
|
+
import { auth, set } from '@upstash/redis';
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
auth('UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN');
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
if (error) {
|
|
38
|
-
return console.error(error);
|
|
39
|
-
}
|
|
36
|
+
set('key', 'value').then(({ data }) => {
|
|
40
37
|
console.log(data);
|
|
38
|
+
// -> "OK"
|
|
41
39
|
});
|
|
42
40
|
```
|
|
43
41
|
|
|
44
|
-
### Usage with async/await
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import upstash from '@upstash/redis';
|
|
48
|
-
|
|
49
|
-
const redis = upstash('UPSTASH_REDIS_REST_URL', 'UPSTASH_REDIS_REST_TOKEN');
|
|
50
|
-
|
|
51
|
-
(async () => {
|
|
52
|
-
try {
|
|
53
|
-
const { data, error } = await redis.get('key');
|
|
54
|
-
if (error) throw error;
|
|
55
|
-
console.log(data);
|
|
56
|
-
} catch (error) {
|
|
57
|
-
console.error(error);
|
|
58
|
-
}
|
|
59
|
-
})();
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
If you define `UPSTASH_REDIS_REST_URL` and` UPSTASH_REDIS_REST_TOKEN` environment variables, you can run the Redis commands directly.
|
|
42
|
+
### Usage with async/await
|
|
63
43
|
|
|
64
44
|
```typescript
|
|
65
|
-
import {
|
|
45
|
+
import { set } from '@upstash/redis';
|
|
66
46
|
|
|
67
47
|
(async () => {
|
|
68
48
|
try {
|
|
69
|
-
const { data, error } = await
|
|
49
|
+
const { data, error } = await set('key', 'value');
|
|
70
50
|
if (error) throw error;
|
|
71
51
|
console.log(data);
|
|
52
|
+
// -> "OK"
|
|
72
53
|
} catch (error) {
|
|
73
54
|
console.error(error);
|
|
74
55
|
}
|
|
75
56
|
})();
|
|
76
57
|
```
|
|
77
58
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
> Only GET requests are supported in Edge Caching. As a result, write/update commands are not supported.
|
|
59
|
+
> If you define `UPSTASH_REDIS_REST_URL` and` UPSTASH_REDIS_REST_TOKEN` environment variables, you can skip the auth().
|
|
81
60
|
|
|
82
|
-
|
|
83
|
-
import upstash from '@upstash/redis';
|
|
61
|
+
## Docs
|
|
84
62
|
|
|
85
|
-
|
|
86
|
-
url: 'UPSTASH_REDIS_REST_URL',
|
|
87
|
-
token: 'UPSTASH_REDIS_REST_TOKEN',
|
|
88
|
-
edgeUrl: 'UPSTASH_REDIS_EDGE_URL',
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
(async () => {
|
|
92
|
-
try {
|
|
93
|
-
const { data, error, metadata } = await redis.get('key');
|
|
94
|
-
if (error) throw error;
|
|
95
|
-
console.log(data);
|
|
96
|
-
// -> null | string
|
|
97
|
-
console.log(metadata);
|
|
98
|
-
// -> { edge: boolean, cache: null | 'miss' | 'hit' }
|
|
99
|
-
} catch (error) {
|
|
100
|
-
console.error(error);
|
|
101
|
-
}
|
|
102
|
-
})();
|
|
103
|
-
```
|
|
63
|
+
See [the documentation](https://docs.upstash.com/features/javascriptsdk) for details.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ClientObjectProps, Upstash } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Upstash Redis instance
|
|
4
|
+
*
|
|
5
|
+
* @constructor
|
|
6
|
+
* @param {Object} options
|
|
7
|
+
* @param {string} [options.url]
|
|
8
|
+
* @param {string} [options.token]
|
|
9
|
+
* @param {Object} [options.requestOptions]
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* import upstash from '@upstash/redis'
|
|
14
|
+
*
|
|
15
|
+
* const redis1 = upstash('url', token);
|
|
16
|
+
* const redis2 = upstash({ url: '', token: '', requestOptions: {} });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare function upstash(options?: ClientObjectProps): Upstash;
|
|
20
|
+
declare function upstash(url?: string, token?: string): Upstash;
|
|
21
|
+
export default upstash;
|
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
|
|
16
|
+
/**
|
|
17
|
+
* Parse Options
|
|
18
|
+
*/
|
|
19
|
+
function parseOptions(url, token, requestOptions = {}) {
|
|
20
|
+
if (typeof url === 'object' && url !== null) {
|
|
21
|
+
return parseOptions(url.url, url.token, url.requestOptions);
|
|
22
|
+
}
|
|
23
|
+
// try auto fill from env variables
|
|
24
|
+
if (!url && typeof window === 'undefined') {
|
|
25
|
+
url = process.env.UPSTASH_REDIS_REST_URL;
|
|
26
|
+
token = process.env.UPSTASH_REDIS_REST_TOKEN;
|
|
27
|
+
}
|
|
28
|
+
return { url: url, token, requestOptions };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetch
|
|
32
|
+
*/
|
|
33
|
+
function fetchData(options, ...parts) {
|
|
34
|
+
var _a;
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
if (!options.url) {
|
|
37
|
+
throw 'Database url not found?';
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const res = yield (0, isomorphic_unfetch_1.default)(options.url, Object.assign({ method: 'POST', body: JSON.stringify(parts), headers: Object.assign({ Authorization: `Bearer ${options.token}` }, (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.headers) }, options.requestOptions));
|
|
41
|
+
const data = yield res.json();
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
if (data.error)
|
|
44
|
+
throw data.error;
|
|
45
|
+
throw `Upstash failed with (${res.status}): ${JSON.stringify(data, null, 2)}`;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
data: data.result,
|
|
49
|
+
error: null,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
return {
|
|
54
|
+
data: null,
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
error: err,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function upstash(url, token) {
|
|
62
|
+
const options = parseOptions(url, token);
|
|
63
|
+
/**
|
|
64
|
+
* Auth
|
|
65
|
+
*/
|
|
66
|
+
function auth() {
|
|
67
|
+
Object.assign(options, {
|
|
68
|
+
url: undefined,
|
|
69
|
+
token: undefined,
|
|
70
|
+
}, parseOptions(arguments[0], arguments[1]));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* STRING
|
|
74
|
+
*/
|
|
75
|
+
function append() {
|
|
76
|
+
return fetchData(options, 'append', ...arguments);
|
|
77
|
+
}
|
|
78
|
+
function decr() {
|
|
79
|
+
return fetchData(options, 'decr', ...arguments);
|
|
80
|
+
}
|
|
81
|
+
function decrby() {
|
|
82
|
+
return fetchData(options, 'decrby', ...arguments);
|
|
83
|
+
}
|
|
84
|
+
function get() {
|
|
85
|
+
return fetchData(options, 'get', ...arguments);
|
|
86
|
+
}
|
|
87
|
+
function getrange() {
|
|
88
|
+
return fetchData(options, 'getrange', ...arguments);
|
|
89
|
+
}
|
|
90
|
+
function getset() {
|
|
91
|
+
return fetchData(options, 'getset', ...arguments);
|
|
92
|
+
}
|
|
93
|
+
function incr() {
|
|
94
|
+
return fetchData(options, 'incr', ...arguments);
|
|
95
|
+
}
|
|
96
|
+
function incrby() {
|
|
97
|
+
return fetchData(options, 'incrby', ...arguments);
|
|
98
|
+
}
|
|
99
|
+
function incrbyfloat() {
|
|
100
|
+
return fetchData(options, 'incrbyfloat', ...arguments);
|
|
101
|
+
}
|
|
102
|
+
function mget() {
|
|
103
|
+
return fetchData(options, 'mget', ...arguments);
|
|
104
|
+
}
|
|
105
|
+
function mset() {
|
|
106
|
+
return fetchData(options, 'mset', ...arguments);
|
|
107
|
+
}
|
|
108
|
+
function msetnx() {
|
|
109
|
+
return fetchData(options, 'msetnx', ...arguments);
|
|
110
|
+
}
|
|
111
|
+
function psetex() {
|
|
112
|
+
return fetchData(options, 'psetex', ...arguments);
|
|
113
|
+
}
|
|
114
|
+
function set() {
|
|
115
|
+
return fetchData(options, 'set', ...arguments);
|
|
116
|
+
}
|
|
117
|
+
function setex() {
|
|
118
|
+
return fetchData(options, 'setex', ...arguments);
|
|
119
|
+
}
|
|
120
|
+
function setnx() {
|
|
121
|
+
return fetchData(options, 'setnx', ...arguments);
|
|
122
|
+
}
|
|
123
|
+
function setrange() {
|
|
124
|
+
return fetchData(options, 'setrange', ...arguments);
|
|
125
|
+
}
|
|
126
|
+
function strlen() {
|
|
127
|
+
return fetchData(options, 'strlen', ...arguments);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* BITMAPS
|
|
131
|
+
*/
|
|
132
|
+
function bitcount() {
|
|
133
|
+
return fetchData(options, 'bitcount', ...arguments);
|
|
134
|
+
}
|
|
135
|
+
function bitop() {
|
|
136
|
+
return fetchData(options, 'bitop', ...arguments);
|
|
137
|
+
}
|
|
138
|
+
function bitpos() {
|
|
139
|
+
return fetchData(options, 'bitpos', ...arguments);
|
|
140
|
+
}
|
|
141
|
+
function getbit() {
|
|
142
|
+
return fetchData(options, 'getbit', ...arguments);
|
|
143
|
+
}
|
|
144
|
+
function setbit() {
|
|
145
|
+
return fetchData(options, 'setbit', ...arguments);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* CONNECTION
|
|
149
|
+
*/
|
|
150
|
+
function echo() {
|
|
151
|
+
return fetchData(options, 'echo', ...arguments);
|
|
152
|
+
}
|
|
153
|
+
function ping() {
|
|
154
|
+
return fetchData(options, 'ping', ...arguments);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* HASHES
|
|
158
|
+
*/
|
|
159
|
+
function hdel() {
|
|
160
|
+
return fetchData(options, 'hdel', ...arguments);
|
|
161
|
+
}
|
|
162
|
+
function hexists() {
|
|
163
|
+
return fetchData(options, 'hexists', ...arguments);
|
|
164
|
+
}
|
|
165
|
+
function hget() {
|
|
166
|
+
return fetchData(options, 'hget', ...arguments);
|
|
167
|
+
}
|
|
168
|
+
function hgetall() {
|
|
169
|
+
return fetchData(options, 'hgetall', ...arguments);
|
|
170
|
+
}
|
|
171
|
+
function hincrby() {
|
|
172
|
+
return fetchData(options, 'hincrby', ...arguments);
|
|
173
|
+
}
|
|
174
|
+
function hincrbyfloat() {
|
|
175
|
+
return fetchData(options, 'hincrbyfloat', ...arguments);
|
|
176
|
+
}
|
|
177
|
+
function hkeys() {
|
|
178
|
+
return fetchData(options, 'hkeys', ...arguments);
|
|
179
|
+
}
|
|
180
|
+
function hlen() {
|
|
181
|
+
return fetchData(options, 'hlen', ...arguments);
|
|
182
|
+
}
|
|
183
|
+
function hmget() {
|
|
184
|
+
return fetchData(options, 'hmget', ...arguments);
|
|
185
|
+
}
|
|
186
|
+
function hmset() {
|
|
187
|
+
return fetchData(options, 'hmset', ...arguments);
|
|
188
|
+
}
|
|
189
|
+
function hscan() {
|
|
190
|
+
return fetchData(options, 'hscan', ...arguments);
|
|
191
|
+
}
|
|
192
|
+
function hset() {
|
|
193
|
+
return fetchData(options, 'hset', ...arguments);
|
|
194
|
+
}
|
|
195
|
+
function hsetnx() {
|
|
196
|
+
return fetchData(options, 'hsetnx', ...arguments);
|
|
197
|
+
}
|
|
198
|
+
function hvals() {
|
|
199
|
+
return fetchData(options, 'hvals', ...arguments);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* KEYS
|
|
203
|
+
*/
|
|
204
|
+
function del() {
|
|
205
|
+
return fetchData(options, 'del', ...arguments);
|
|
206
|
+
}
|
|
207
|
+
function exists() {
|
|
208
|
+
return fetchData(options, 'exists', ...arguments);
|
|
209
|
+
}
|
|
210
|
+
function expire() {
|
|
211
|
+
return fetchData(options, 'expire', ...arguments);
|
|
212
|
+
}
|
|
213
|
+
function expireat() {
|
|
214
|
+
return fetchData(options, 'expireat', ...arguments);
|
|
215
|
+
}
|
|
216
|
+
function keys() {
|
|
217
|
+
return fetchData(options, 'keys', ...arguments);
|
|
218
|
+
}
|
|
219
|
+
function persist() {
|
|
220
|
+
return fetchData(options, 'persist', ...arguments);
|
|
221
|
+
}
|
|
222
|
+
function pexpire() {
|
|
223
|
+
return fetchData(options, 'pexpire', ...arguments);
|
|
224
|
+
}
|
|
225
|
+
function pexpireat() {
|
|
226
|
+
return fetchData(options, 'pexpireat', ...arguments);
|
|
227
|
+
}
|
|
228
|
+
function pttl() {
|
|
229
|
+
return fetchData(options, 'pttl', ...arguments);
|
|
230
|
+
}
|
|
231
|
+
function randomkey() {
|
|
232
|
+
return fetchData(options, 'randomkey', ...arguments);
|
|
233
|
+
}
|
|
234
|
+
function rename() {
|
|
235
|
+
return fetchData(options, 'rename', ...arguments);
|
|
236
|
+
}
|
|
237
|
+
function renamenx() {
|
|
238
|
+
return fetchData(options, 'renamenx', ...arguments);
|
|
239
|
+
}
|
|
240
|
+
function scan() {
|
|
241
|
+
return fetchData(options, 'scan', ...arguments);
|
|
242
|
+
}
|
|
243
|
+
function touch() {
|
|
244
|
+
return fetchData(options, 'touch', ...arguments);
|
|
245
|
+
}
|
|
246
|
+
function ttl() {
|
|
247
|
+
return fetchData(options, 'ttl', ...arguments);
|
|
248
|
+
}
|
|
249
|
+
function type() {
|
|
250
|
+
return fetchData(options, 'type', ...arguments);
|
|
251
|
+
}
|
|
252
|
+
function unlink() {
|
|
253
|
+
return fetchData(options, 'unlink', ...arguments);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* LISTS
|
|
257
|
+
*/
|
|
258
|
+
function lindex() {
|
|
259
|
+
return fetchData(options, 'lindex', ...arguments);
|
|
260
|
+
}
|
|
261
|
+
function linsert() {
|
|
262
|
+
return fetchData(options, 'linsert', ...arguments);
|
|
263
|
+
}
|
|
264
|
+
function llen() {
|
|
265
|
+
return fetchData(options, 'llen', ...arguments);
|
|
266
|
+
}
|
|
267
|
+
function lpop() {
|
|
268
|
+
return fetchData(options, 'lpop', ...arguments);
|
|
269
|
+
}
|
|
270
|
+
function lpush() {
|
|
271
|
+
return fetchData(options, 'lpush', ...arguments);
|
|
272
|
+
}
|
|
273
|
+
function lpushx() {
|
|
274
|
+
return fetchData(options, 'lpushx', ...arguments);
|
|
275
|
+
}
|
|
276
|
+
function lrange() {
|
|
277
|
+
return fetchData(options, 'lrange', ...arguments);
|
|
278
|
+
}
|
|
279
|
+
function lrem() {
|
|
280
|
+
return fetchData(options, 'lrem', ...arguments);
|
|
281
|
+
}
|
|
282
|
+
function lset() {
|
|
283
|
+
return fetchData(options, 'lset', ...arguments);
|
|
284
|
+
}
|
|
285
|
+
function ltrim() {
|
|
286
|
+
return fetchData(options, 'ltrim', ...arguments);
|
|
287
|
+
}
|
|
288
|
+
function rpop() {
|
|
289
|
+
return fetchData(options, 'rpop', ...arguments);
|
|
290
|
+
}
|
|
291
|
+
function rpoplpush() {
|
|
292
|
+
return fetchData(options, 'rpoplpush', ...arguments);
|
|
293
|
+
}
|
|
294
|
+
function rpush() {
|
|
295
|
+
return fetchData(options, 'rpush', ...arguments);
|
|
296
|
+
}
|
|
297
|
+
function rpushx() {
|
|
298
|
+
return fetchData(options, 'rpushx', ...arguments);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* SERVER
|
|
302
|
+
*/
|
|
303
|
+
function dbsize() {
|
|
304
|
+
return fetchData(options, 'dbsize', ...arguments);
|
|
305
|
+
}
|
|
306
|
+
function flushall() {
|
|
307
|
+
return fetchData(options, 'flushall', ...arguments);
|
|
308
|
+
}
|
|
309
|
+
function flushdb() {
|
|
310
|
+
return fetchData(options, 'flushdb', ...arguments);
|
|
311
|
+
}
|
|
312
|
+
function info() {
|
|
313
|
+
return fetchData(options, 'info', ...arguments);
|
|
314
|
+
}
|
|
315
|
+
function time() {
|
|
316
|
+
return fetchData(options, 'time', ...arguments);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* SET
|
|
320
|
+
*/
|
|
321
|
+
function sadd() {
|
|
322
|
+
return fetchData(options, 'sadd', ...arguments);
|
|
323
|
+
}
|
|
324
|
+
function scard() {
|
|
325
|
+
return fetchData(options, 'scard', ...arguments);
|
|
326
|
+
}
|
|
327
|
+
function sdiff() {
|
|
328
|
+
return fetchData(options, 'sdiff', ...arguments);
|
|
329
|
+
}
|
|
330
|
+
function sdiffstore() {
|
|
331
|
+
return fetchData(options, 'sdiffstore', ...arguments);
|
|
332
|
+
}
|
|
333
|
+
function sinter() {
|
|
334
|
+
return fetchData(options, 'sinter', ...arguments);
|
|
335
|
+
}
|
|
336
|
+
function sinterstore() {
|
|
337
|
+
return fetchData(options, 'sinterstore', ...arguments);
|
|
338
|
+
}
|
|
339
|
+
function sismember() {
|
|
340
|
+
return fetchData(options, 'sismember', ...arguments);
|
|
341
|
+
}
|
|
342
|
+
function smembers() {
|
|
343
|
+
return fetchData(options, 'smembers', ...arguments);
|
|
344
|
+
}
|
|
345
|
+
function smove() {
|
|
346
|
+
return fetchData(options, 'smove', ...arguments);
|
|
347
|
+
}
|
|
348
|
+
function spop() {
|
|
349
|
+
return fetchData(options, 'spop', ...arguments);
|
|
350
|
+
}
|
|
351
|
+
function srandmember() {
|
|
352
|
+
return fetchData(options, 'srandmember', ...arguments);
|
|
353
|
+
}
|
|
354
|
+
function srem() {
|
|
355
|
+
return fetchData(options, 'srem', ...arguments);
|
|
356
|
+
}
|
|
357
|
+
function sunion() {
|
|
358
|
+
return fetchData(options, 'sunion', ...arguments);
|
|
359
|
+
}
|
|
360
|
+
function sunionstore() {
|
|
361
|
+
return fetchData(options, 'sunionstore', ...arguments);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* SORTED SETS
|
|
365
|
+
*/
|
|
366
|
+
function zadd() {
|
|
367
|
+
return fetchData(options, 'zadd', ...arguments);
|
|
368
|
+
}
|
|
369
|
+
function zcard() {
|
|
370
|
+
return fetchData(options, 'zcard', ...arguments);
|
|
371
|
+
}
|
|
372
|
+
function zcount() {
|
|
373
|
+
return fetchData(options, 'zcount', ...arguments);
|
|
374
|
+
}
|
|
375
|
+
function zincrby() {
|
|
376
|
+
return fetchData(options, 'zincrby', ...arguments);
|
|
377
|
+
}
|
|
378
|
+
function zinterstore() {
|
|
379
|
+
return fetchData(options, 'zinterstore', ...arguments);
|
|
380
|
+
}
|
|
381
|
+
function zlexcount() {
|
|
382
|
+
return fetchData(options, 'zlexcount', ...arguments);
|
|
383
|
+
}
|
|
384
|
+
function zpopmax() {
|
|
385
|
+
return fetchData(options, 'zpopmax', ...arguments);
|
|
386
|
+
}
|
|
387
|
+
function zpopmin() {
|
|
388
|
+
return fetchData(options, 'zpopmin', ...arguments);
|
|
389
|
+
}
|
|
390
|
+
function zrange() {
|
|
391
|
+
return fetchData(options, 'zrange', ...arguments);
|
|
392
|
+
}
|
|
393
|
+
function zrangebylex() {
|
|
394
|
+
return fetchData(options, 'zrangebylex', ...arguments);
|
|
395
|
+
}
|
|
396
|
+
function zrangebyscore() {
|
|
397
|
+
return fetchData(options, 'zrangebyscore', ...arguments);
|
|
398
|
+
}
|
|
399
|
+
function zrank() {
|
|
400
|
+
return fetchData(options, 'zrank', ...arguments);
|
|
401
|
+
}
|
|
402
|
+
function zrem() {
|
|
403
|
+
return fetchData(options, 'zrem', ...arguments);
|
|
404
|
+
}
|
|
405
|
+
function zremrangebylex() {
|
|
406
|
+
return fetchData(options, 'zremrangebylex', ...arguments);
|
|
407
|
+
}
|
|
408
|
+
function zremrangebyrank() {
|
|
409
|
+
return fetchData(options, 'zremrangebyrank', ...arguments);
|
|
410
|
+
}
|
|
411
|
+
function zremrangebyscore() {
|
|
412
|
+
return fetchData(options, 'zremrangebyscore', ...arguments);
|
|
413
|
+
}
|
|
414
|
+
function zrevrange() {
|
|
415
|
+
return fetchData(options, 'zrevrange', ...arguments);
|
|
416
|
+
}
|
|
417
|
+
function zrevrangebylex() {
|
|
418
|
+
return fetchData(options, 'zrevrangebylex', ...arguments);
|
|
419
|
+
}
|
|
420
|
+
function zrevrangebyscore() {
|
|
421
|
+
return fetchData(options, 'zrevrangebyscore', ...arguments);
|
|
422
|
+
}
|
|
423
|
+
function zrevrank() {
|
|
424
|
+
return fetchData(options, 'zrevrank', ...arguments);
|
|
425
|
+
}
|
|
426
|
+
function zscore() {
|
|
427
|
+
return fetchData(options, 'zscore', ...arguments);
|
|
428
|
+
}
|
|
429
|
+
function zunionstore() {
|
|
430
|
+
return fetchData(options, 'zunionstore', ...arguments);
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
auth,
|
|
434
|
+
// STRING
|
|
435
|
+
append,
|
|
436
|
+
decr,
|
|
437
|
+
decrby,
|
|
438
|
+
get,
|
|
439
|
+
getrange,
|
|
440
|
+
getset,
|
|
441
|
+
incr,
|
|
442
|
+
incrby,
|
|
443
|
+
incrbyfloat,
|
|
444
|
+
mget,
|
|
445
|
+
mset,
|
|
446
|
+
msetnx,
|
|
447
|
+
psetex,
|
|
448
|
+
set,
|
|
449
|
+
setex,
|
|
450
|
+
setnx,
|
|
451
|
+
setrange,
|
|
452
|
+
strlen,
|
|
453
|
+
// BITMAPS
|
|
454
|
+
bitcount,
|
|
455
|
+
bitop,
|
|
456
|
+
bitpos,
|
|
457
|
+
getbit,
|
|
458
|
+
setbit,
|
|
459
|
+
// CONNECTION
|
|
460
|
+
echo,
|
|
461
|
+
ping,
|
|
462
|
+
// HASHES
|
|
463
|
+
hdel,
|
|
464
|
+
hexists,
|
|
465
|
+
hget,
|
|
466
|
+
hgetall,
|
|
467
|
+
hincrby,
|
|
468
|
+
hincrbyfloat,
|
|
469
|
+
hkeys,
|
|
470
|
+
hlen,
|
|
471
|
+
hmget,
|
|
472
|
+
hmset,
|
|
473
|
+
hscan,
|
|
474
|
+
hset,
|
|
475
|
+
hsetnx,
|
|
476
|
+
hvals,
|
|
477
|
+
// KEYS
|
|
478
|
+
del,
|
|
479
|
+
exists,
|
|
480
|
+
expire,
|
|
481
|
+
expireat,
|
|
482
|
+
keys,
|
|
483
|
+
persist,
|
|
484
|
+
pexpire,
|
|
485
|
+
pexpireat,
|
|
486
|
+
pttl,
|
|
487
|
+
randomkey,
|
|
488
|
+
rename,
|
|
489
|
+
renamenx,
|
|
490
|
+
scan,
|
|
491
|
+
touch,
|
|
492
|
+
ttl,
|
|
493
|
+
type,
|
|
494
|
+
unlink,
|
|
495
|
+
// LISTS
|
|
496
|
+
lindex,
|
|
497
|
+
linsert,
|
|
498
|
+
llen,
|
|
499
|
+
lpop,
|
|
500
|
+
lpush,
|
|
501
|
+
lpushx,
|
|
502
|
+
lrange,
|
|
503
|
+
lrem,
|
|
504
|
+
lset,
|
|
505
|
+
ltrim,
|
|
506
|
+
rpop,
|
|
507
|
+
rpoplpush,
|
|
508
|
+
rpush,
|
|
509
|
+
rpushx,
|
|
510
|
+
// SERVER
|
|
511
|
+
dbsize,
|
|
512
|
+
flushall,
|
|
513
|
+
flushdb,
|
|
514
|
+
info,
|
|
515
|
+
time,
|
|
516
|
+
// SET
|
|
517
|
+
sadd,
|
|
518
|
+
scard,
|
|
519
|
+
sdiff,
|
|
520
|
+
sdiffstore,
|
|
521
|
+
sinter,
|
|
522
|
+
sinterstore,
|
|
523
|
+
sismember,
|
|
524
|
+
smembers,
|
|
525
|
+
smove,
|
|
526
|
+
spop,
|
|
527
|
+
srandmember,
|
|
528
|
+
srem,
|
|
529
|
+
sunion,
|
|
530
|
+
sunionstore,
|
|
531
|
+
// SORTED SETS
|
|
532
|
+
zadd,
|
|
533
|
+
zcard,
|
|
534
|
+
zcount,
|
|
535
|
+
zincrby,
|
|
536
|
+
zinterstore,
|
|
537
|
+
zlexcount,
|
|
538
|
+
zpopmax,
|
|
539
|
+
zpopmin,
|
|
540
|
+
zrange,
|
|
541
|
+
zrangebylex,
|
|
542
|
+
zrangebyscore,
|
|
543
|
+
zrank,
|
|
544
|
+
zrem,
|
|
545
|
+
zremrangebylex,
|
|
546
|
+
zremrangebyrank,
|
|
547
|
+
zremrangebyscore,
|
|
548
|
+
zrevrange,
|
|
549
|
+
zrevrangebylex,
|
|
550
|
+
zrevrangebyscore,
|
|
551
|
+
zrevrank,
|
|
552
|
+
zscore,
|
|
553
|
+
zunionstore,
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
exports.default = upstash;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|