redis 4.0.1 → 4.0.2
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 +25 -10
- package/dist/index.d.ts +122 -2
- package/dist/index.js +7 -1
- package/package.json +13 -12
package/README.md
CHANGED
|
@@ -75,6 +75,16 @@ await client.hGetAll('key'); // { field1: 'value1', field2: 'value2' }
|
|
|
75
75
|
await client.hVals('key'); // ['value1', 'value2']
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
`Buffer`s are supported as well:
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
await client.hSet('key', 'field', Buffer.from('value')); // 'OK'
|
|
82
|
+
await client.hGetAll(
|
|
83
|
+
commandOptions({ returnBuffers: true }),
|
|
84
|
+
'key'
|
|
85
|
+
); // { field: <Buffer 76 61 6c 75 65> }
|
|
86
|
+
```
|
|
87
|
+
|
|
78
88
|
### Unsupported Redis Commands
|
|
79
89
|
|
|
80
90
|
If you want to run commands and/or use arguments that Node Redis doesn't know about (yet!) use `.sendCommand()`:
|
|
@@ -112,7 +122,11 @@ This pattern works especially well for blocking commands—such as `BLPOP` and `
|
|
|
112
122
|
```typescript
|
|
113
123
|
import { commandOptions } from 'redis';
|
|
114
124
|
|
|
115
|
-
const blPopPromise = client.blPop(
|
|
125
|
+
const blPopPromise = client.blPop(
|
|
126
|
+
commandOptions({ isolated: true }),
|
|
127
|
+
'key',
|
|
128
|
+
0
|
|
129
|
+
);
|
|
116
130
|
|
|
117
131
|
await client.lPush('key', ['1', '2']);
|
|
118
132
|
|
|
@@ -282,15 +296,15 @@ Check out the [Clustering Guide](./docs/clustering.md) when using Node Redis to
|
|
|
282
296
|
|
|
283
297
|
The Node Redis client class is an Nodejs EventEmitter and it emits an event each time the network status changes:
|
|
284
298
|
|
|
285
|
-
| Event name
|
|
286
|
-
|
|
287
|
-
| connect | The client is initiating a connection to the server. |
|
|
288
|
-
| ready | The client successfully initiated the connection to the server. |
|
|
289
|
-
| end | The client disconnected the connection to the server via `.quit()` or `.disconnect()`. |
|
|
290
|
-
| error | When a network error has occurred, such as unable to connect to the server or the connection closed unexpectedly. | The error object, such as `SocketClosedUnexpectedlyError: Socket closed unexpectedly` or `Error: connect ECONNREFUSED [IP]:[PORT]` |
|
|
291
|
-
| reconnecting | The client is trying to reconnect to the server. |
|
|
299
|
+
| Event name | Scenes | Arguments to be passed to the listener |
|
|
300
|
+
|----------------|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
301
|
+
| `connect` | The client is initiating a connection to the server. | _No argument_ |
|
|
302
|
+
| `ready` | The client successfully initiated the connection to the server. | _No argument_ |
|
|
303
|
+
| `end` | The client disconnected the connection to the server via `.quit()` or `.disconnect()`. | _No argument_ |
|
|
304
|
+
| `error` | When a network error has occurred, such as unable to connect to the server or the connection closed unexpectedly. | 1 argument: The error object, such as `SocketClosedUnexpectedlyError: Socket closed unexpectedly` or `Error: connect ECONNREFUSED [IP]:[PORT]` |
|
|
305
|
+
| `reconnecting` | The client is trying to reconnect to the server. | _No argument_ |
|
|
292
306
|
|
|
293
|
-
The client will not emit any other events beyond those listed above.
|
|
307
|
+
The client will not emit [any other events](./docs/v3-to-v4.md#all-the-removed-events) beyond those listed above.
|
|
294
308
|
|
|
295
309
|
## Supported Redis versions
|
|
296
310
|
|
|
@@ -307,10 +321,11 @@ Node Redis is supported with the following versions of Redis:
|
|
|
307
321
|
|
|
308
322
|
## Packages
|
|
309
323
|
|
|
310
|
-
|
|
|
324
|
+
| Name | Description |
|
|
311
325
|
|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
312
326
|
| [redis](./) | [](https://www.npmjs.com/package/redis) [](https://www.npmjs.com/package/redis) |
|
|
313
327
|
| [@node-redis/client](./packages/client) | [](https://www.npmjs.com/package/@node-redis/client) [](https://www.npmjs.com/package/@node-redis/client) [](https://redis.js.org/documentation/client/) |
|
|
328
|
+
| [@node-redis/bloom](./packages/bloom) | [](https://www.npmjs.com/package/@node-redis/bloom) [](https://www.npmjs.com/package/@node-redis/bloom) [](https://redis.js.org/documentation/bloom/) [Redis Bloom](https://oss.redis.com/redisbloom/) commands |
|
|
314
329
|
| [@node-redis/json](./packages/json) | [](https://www.npmjs.com/package/@node-redis/json) [](https://www.npmjs.com/package/@node-redis/json) [](https://redis.js.org/documentation/json/) [Redis JSON](https://oss.redis.com/redisjson/) commands |
|
|
315
330
|
| [@node-redis/search](./packages/search) | [](https://www.npmjs.com/package/@node-redis/search) [](https://www.npmjs.com/package/@node-redis/search) [](https://redis.js.org/documentation/search/) [Redis Search](https://oss.redis.com/redisearch/) commands |
|
|
316
331
|
| [@node-redis/time-series](./packages/time-series) | [](https://www.npmjs.com/package/@node-redis/time-series) [](https://www.npmjs.com/package/@node-redis/time-series) [](https://redis.js.org/documentation/time-series/) [Redis Time-Series](https://oss.redis.com/redistimeseries/) commands |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType } from '@node-redis/client';
|
|
2
2
|
import { RedisScripts } from '@node-redis/client/dist/lib/commands';
|
|
3
3
|
export * from '@node-redis/client';
|
|
4
|
+
export * from '@node-redis/bloom';
|
|
4
5
|
export * from '@node-redis/json';
|
|
5
6
|
export * from '@node-redis/search';
|
|
7
|
+
export * from '@node-redis/time-series';
|
|
6
8
|
declare const modules: {
|
|
7
9
|
json: {
|
|
8
10
|
ARRAPPEND: typeof import("@node-redis/json/dist/commands/ARRAPPEND");
|
|
@@ -108,6 +110,124 @@ declare const modules: {
|
|
|
108
110
|
TAGVALS: typeof import("@node-redis/search/dist/commands/TAGVALS");
|
|
109
111
|
tagVals: typeof import("@node-redis/search/dist/commands/TAGVALS");
|
|
110
112
|
};
|
|
113
|
+
ts: {
|
|
114
|
+
ADD: typeof import("@node-redis/time-series/dist/commands/ADD");
|
|
115
|
+
add: typeof import("@node-redis/time-series/dist/commands/ADD");
|
|
116
|
+
ALTER: typeof import("@node-redis/time-series/dist/commands/ALTER");
|
|
117
|
+
alter: typeof import("@node-redis/time-series/dist/commands/ALTER");
|
|
118
|
+
CREATE: typeof import("@node-redis/time-series/dist/commands/CREATE");
|
|
119
|
+
create: typeof import("@node-redis/time-series/dist/commands/CREATE");
|
|
120
|
+
CREATERULE: typeof import("@node-redis/time-series/dist/commands/CREATERULE");
|
|
121
|
+
createRule: typeof import("@node-redis/time-series/dist/commands/CREATERULE");
|
|
122
|
+
DECRBY: typeof import("@node-redis/time-series/dist/commands/DECRBY");
|
|
123
|
+
decrBy: typeof import("@node-redis/time-series/dist/commands/DECRBY");
|
|
124
|
+
DEL: typeof import("@node-redis/time-series/dist/commands/DEL");
|
|
125
|
+
del: typeof import("@node-redis/time-series/dist/commands/DEL");
|
|
126
|
+
DELETERULE: typeof import("@node-redis/time-series/dist/commands/DELETERULE");
|
|
127
|
+
deleteRule: typeof import("@node-redis/time-series/dist/commands/DELETERULE");
|
|
128
|
+
GET: typeof import("@node-redis/time-series/dist/commands/GET");
|
|
129
|
+
get: typeof import("@node-redis/time-series/dist/commands/GET");
|
|
130
|
+
INCRBY: typeof import("@node-redis/time-series/dist/commands/INCRBY");
|
|
131
|
+
incrBy: typeof import("@node-redis/time-series/dist/commands/INCRBY");
|
|
132
|
+
INFO_DEBUG: typeof import("@node-redis/time-series/dist/commands/INFO_DEBUG");
|
|
133
|
+
infoDebug: typeof import("@node-redis/time-series/dist/commands/INFO_DEBUG");
|
|
134
|
+
INFO: typeof import("@node-redis/time-series/dist/commands/INFO");
|
|
135
|
+
info: typeof import("@node-redis/time-series/dist/commands/INFO");
|
|
136
|
+
MADD: typeof import("@node-redis/time-series/dist/commands/MADD");
|
|
137
|
+
mAdd: typeof import("@node-redis/time-series/dist/commands/MADD");
|
|
138
|
+
MGET: typeof import("@node-redis/time-series/dist/commands/MGET");
|
|
139
|
+
mGet: typeof import("@node-redis/time-series/dist/commands/MGET");
|
|
140
|
+
MGET_WITHLABELS: typeof import("@node-redis/time-series/dist/commands/MGET_WITHLABELS");
|
|
141
|
+
mGetWithLabels: typeof import("@node-redis/time-series/dist/commands/MGET_WITHLABELS");
|
|
142
|
+
QUERYINDEX: typeof import("@node-redis/time-series/dist/commands/QUERYINDEX");
|
|
143
|
+
queryIndex: typeof import("@node-redis/time-series/dist/commands/QUERYINDEX");
|
|
144
|
+
RANGE: typeof import("@node-redis/time-series/dist/commands/RANGE");
|
|
145
|
+
range: typeof import("@node-redis/time-series/dist/commands/RANGE");
|
|
146
|
+
REVRANGE: typeof import("@node-redis/time-series/dist/commands/REVRANGE");
|
|
147
|
+
revRange: typeof import("@node-redis/time-series/dist/commands/REVRANGE");
|
|
148
|
+
MRANGE: typeof import("@node-redis/time-series/dist/commands/MRANGE");
|
|
149
|
+
mRange: typeof import("@node-redis/time-series/dist/commands/MRANGE");
|
|
150
|
+
MRANGE_WITHLABELS: typeof import("@node-redis/time-series/dist/commands/MRANGE_WITHLABELS");
|
|
151
|
+
mRangeWithLabels: typeof import("@node-redis/time-series/dist/commands/MRANGE_WITHLABELS");
|
|
152
|
+
MREVRANGE: typeof import("@node-redis/time-series/dist/commands/MREVRANGE");
|
|
153
|
+
mRevRange: typeof import("@node-redis/time-series/dist/commands/MREVRANGE");
|
|
154
|
+
MREVRANGE_WITHLABELS: typeof import("@node-redis/time-series/dist/commands/MREVRANGE_WITHLABELS");
|
|
155
|
+
mRevRangeWithLabels: typeof import("@node-redis/time-series/dist/commands/MREVRANGE_WITHLABELS");
|
|
156
|
+
};
|
|
157
|
+
bf: {
|
|
158
|
+
ADD: typeof import("@node-redis/bloom/dist/commands/bloom/ADD");
|
|
159
|
+
add: typeof import("@node-redis/bloom/dist/commands/bloom/ADD");
|
|
160
|
+
EXISTS: typeof import("@node-redis/bloom/dist/commands/bloom/EXISTS");
|
|
161
|
+
exists: typeof import("@node-redis/bloom/dist/commands/bloom/EXISTS");
|
|
162
|
+
INFO: typeof import("@node-redis/bloom/dist/commands/bloom/INFO");
|
|
163
|
+
info: typeof import("@node-redis/bloom/dist/commands/bloom/INFO");
|
|
164
|
+
INSERT: typeof import("@node-redis/bloom/dist/commands/bloom/INSERT");
|
|
165
|
+
insert: typeof import("@node-redis/bloom/dist/commands/bloom/INSERT");
|
|
166
|
+
LOADCHUNK: typeof import("@node-redis/bloom/dist/commands/bloom/LOADCHUNK");
|
|
167
|
+
loadChunk: typeof import("@node-redis/bloom/dist/commands/bloom/LOADCHUNK");
|
|
168
|
+
MADD: typeof import("@node-redis/bloom/dist/commands/bloom/MADD");
|
|
169
|
+
mAdd: typeof import("@node-redis/bloom/dist/commands/bloom/MADD");
|
|
170
|
+
MEXISTS: typeof import("@node-redis/bloom/dist/commands/bloom/MEXISTS");
|
|
171
|
+
mExists: typeof import("@node-redis/bloom/dist/commands/bloom/MEXISTS");
|
|
172
|
+
RESERVE: typeof import("@node-redis/bloom/dist/commands/bloom/RESERVE");
|
|
173
|
+
reserve: typeof import("@node-redis/bloom/dist/commands/bloom/RESERVE");
|
|
174
|
+
SCANDUMP: typeof import("@node-redis/bloom/dist/commands/bloom/SCANDUMP");
|
|
175
|
+
scanDump: typeof import("@node-redis/bloom/dist/commands/bloom/SCANDUMP");
|
|
176
|
+
};
|
|
177
|
+
cms: {
|
|
178
|
+
INCRBY: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INCRBY");
|
|
179
|
+
incrBy: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INCRBY");
|
|
180
|
+
INFO: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INFO");
|
|
181
|
+
info: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INFO");
|
|
182
|
+
INITBYDIM: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYDIM");
|
|
183
|
+
initByDim: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYDIM");
|
|
184
|
+
INITBYPROB: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYPROB");
|
|
185
|
+
initByProb: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYPROB");
|
|
186
|
+
MERGE: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/MERGE");
|
|
187
|
+
merge: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/MERGE");
|
|
188
|
+
QUERY: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/QUERY");
|
|
189
|
+
query: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/QUERY");
|
|
190
|
+
};
|
|
191
|
+
cf: {
|
|
192
|
+
ADD: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADD");
|
|
193
|
+
add: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADD");
|
|
194
|
+
ADDNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADDNX");
|
|
195
|
+
addNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADDNX");
|
|
196
|
+
COUNT: typeof import("@node-redis/bloom/dist/commands/cuckoo/COUNT");
|
|
197
|
+
count: typeof import("@node-redis/bloom/dist/commands/cuckoo/COUNT");
|
|
198
|
+
DEL: typeof import("@node-redis/bloom/dist/commands/cuckoo/DEL");
|
|
199
|
+
del: typeof import("@node-redis/bloom/dist/commands/cuckoo/DEL");
|
|
200
|
+
EXISTS: typeof import("@node-redis/bloom/dist/commands/cuckoo/EXISTS");
|
|
201
|
+
exists: typeof import("@node-redis/bloom/dist/commands/cuckoo/EXISTS");
|
|
202
|
+
INFO: typeof import("@node-redis/bloom/dist/commands/cuckoo/INFO");
|
|
203
|
+
info: typeof import("@node-redis/bloom/dist/commands/cuckoo/INFO");
|
|
204
|
+
INSERT: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERT");
|
|
205
|
+
insert: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERT");
|
|
206
|
+
INSERTNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERTNX");
|
|
207
|
+
insertNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERTNX");
|
|
208
|
+
LOADCHUNK: typeof import("@node-redis/bloom/dist/commands/cuckoo/LOADCHUNK");
|
|
209
|
+
loadChunk: typeof import("@node-redis/bloom/dist/commands/cuckoo/LOADCHUNK");
|
|
210
|
+
RESERVE: typeof import("@node-redis/bloom/dist/commands/cuckoo/RESERVE");
|
|
211
|
+
reserve: typeof import("@node-redis/bloom/dist/commands/cuckoo/RESERVE");
|
|
212
|
+
SCANDUMP: typeof import("@node-redis/bloom/dist/commands/cuckoo/SCANDUMP");
|
|
213
|
+
scanDump: typeof import("@node-redis/bloom/dist/commands/cuckoo/SCANDUMP");
|
|
214
|
+
};
|
|
215
|
+
topK: {
|
|
216
|
+
ADD: typeof import("@node-redis/bloom/dist/commands/top-k/ADD");
|
|
217
|
+
add: typeof import("@node-redis/bloom/dist/commands/top-k/ADD");
|
|
218
|
+
COUNT: typeof import("@node-redis/bloom/dist/commands/top-k/COUNT");
|
|
219
|
+
count: typeof import("@node-redis/bloom/dist/commands/top-k/COUNT");
|
|
220
|
+
INCRBY: typeof import("@node-redis/bloom/dist/commands/top-k/INCRBY");
|
|
221
|
+
incrBy: typeof import("@node-redis/bloom/dist/commands/top-k/INCRBY");
|
|
222
|
+
INFO: typeof import("@node-redis/bloom/dist/commands/top-k/INFO");
|
|
223
|
+
info: typeof import("@node-redis/bloom/dist/commands/top-k/INFO");
|
|
224
|
+
LIST: typeof import("@node-redis/bloom/dist/commands/top-k/LIST");
|
|
225
|
+
list: typeof import("@node-redis/bloom/dist/commands/top-k/LIST");
|
|
226
|
+
QUERY: typeof import("@node-redis/bloom/dist/commands/top-k/QUERY");
|
|
227
|
+
query: typeof import("@node-redis/bloom/dist/commands/top-k/QUERY");
|
|
228
|
+
RESERVE: typeof import("@node-redis/bloom/dist/commands/top-k/RESERVE");
|
|
229
|
+
reserve: typeof import("@node-redis/bloom/dist/commands/top-k/RESERVE");
|
|
230
|
+
};
|
|
111
231
|
};
|
|
112
|
-
export declare function createClient<S extends RedisScripts
|
|
113
|
-
export declare function createCluster<S extends RedisScripts
|
|
232
|
+
export declare function createClient<S extends RedisScripts>(options?: Omit<RedisClientOptions<never, S>, 'modules'>): RedisClientType<typeof modules, S>;
|
|
233
|
+
export declare function createCluster<S extends RedisScripts>(options: Omit<RedisClusterOptions<never, S>, 'modules'>): RedisClusterType<typeof modules, S>;
|
package/dist/index.js
CHANGED
|
@@ -12,14 +12,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.createCluster = exports.createClient = void 0;
|
|
14
14
|
const client_1 = require("@node-redis/client");
|
|
15
|
+
const bloom_1 = require("@node-redis/bloom");
|
|
15
16
|
const json_1 = require("@node-redis/json");
|
|
16
17
|
const search_1 = require("@node-redis/search");
|
|
18
|
+
const time_series_1 = require("@node-redis/time-series");
|
|
17
19
|
__exportStar(require("@node-redis/client"), exports);
|
|
20
|
+
__exportStar(require("@node-redis/bloom"), exports);
|
|
18
21
|
__exportStar(require("@node-redis/json"), exports);
|
|
19
22
|
__exportStar(require("@node-redis/search"), exports);
|
|
23
|
+
__exportStar(require("@node-redis/time-series"), exports);
|
|
20
24
|
const modules = {
|
|
25
|
+
...bloom_1.default,
|
|
21
26
|
json: json_1.default,
|
|
22
|
-
ft: search_1.default
|
|
27
|
+
ft: search_1.default,
|
|
28
|
+
ts: time_series_1.default
|
|
23
29
|
};
|
|
24
30
|
function createClient(options) {
|
|
25
31
|
return (0, client_1.createClient)({
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redis",
|
|
3
3
|
"description": "A modern, high performance Redis client",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/"
|
|
10
|
+
],
|
|
8
11
|
"workspaces": [
|
|
9
12
|
"./packages/*"
|
|
10
13
|
],
|
|
@@ -20,17 +23,17 @@
|
|
|
20
23
|
"gh-pages": "gh-pages -d ./documentation -e ./documentation -u 'documentation-bot <documentation@bot>'"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@node-redis/
|
|
24
|
-
"@node-redis/
|
|
25
|
-
"@node-redis/
|
|
26
|
-
"@node-redis/
|
|
26
|
+
"@node-redis/bloom": "^1.0.0",
|
|
27
|
+
"@node-redis/client": "^1.0.2",
|
|
28
|
+
"@node-redis/json": "^1.0.2",
|
|
29
|
+
"@node-redis/search": "^1.0.2",
|
|
30
|
+
"@node-redis/time-series": "^1.0.1"
|
|
27
31
|
},
|
|
28
32
|
"devDependencies": {
|
|
29
33
|
"@tsconfig/node12": "^1.0.9",
|
|
30
34
|
"gh-pages": "^3.2.3",
|
|
31
|
-
"release-it": "^14.
|
|
32
|
-
"
|
|
33
|
-
"typescript": "^4.5.3"
|
|
35
|
+
"release-it": "^14.12.1",
|
|
36
|
+
"typescript": "^4.5.4"
|
|
34
37
|
},
|
|
35
38
|
"repository": {
|
|
36
39
|
"type": "git",
|
|
@@ -40,10 +43,8 @@
|
|
|
40
43
|
"url": "https://github.com/redis/node-redis/issues"
|
|
41
44
|
},
|
|
42
45
|
"homepage": "https://github.com/redis/node-redis",
|
|
43
|
-
"files": [
|
|
44
|
-
"dist/"
|
|
45
|
-
],
|
|
46
46
|
"engines": {
|
|
47
|
-
"npm": ">=7"
|
|
47
|
+
"npm": ">=7",
|
|
48
|
+
"typescript": ">=4"
|
|
48
49
|
}
|
|
49
50
|
}
|