redis 4.0.0 → 4.0.4

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
@@ -1,12 +1,26 @@
1
1
  # Node-Redis
2
2
 
3
- [![Tests](https://img.shields.io/github/workflow/status/redis/node-redis/Tests/master.svg?label=tests)](https://codecov.io/gh/redis/node-redis)
3
+ [![Tests](https://img.shields.io/github/workflow/status/redis/node-redis/Tests/master.svg?label=tests)](https://github.com/redis/node-redis/actions/workflows/tests.yml)
4
4
  [![Coverage](https://codecov.io/gh/redis/node-redis/branch/master/graph/badge.svg?token=xcfqHhJC37)](https://codecov.io/gh/redis/node-redis)
5
- [![License](https://img.shields.io/github/license/redis/node-redis.svg)](https://codecov.io/gh/redis/node-redis)
6
- [![Chat](https://img.shields.io/discord/697882427875393627.svg)](https://discord.gg/XMMVgxUm)
5
+ [![License](https://img.shields.io/github/license/redis/node-redis.svg)](https://github.com/redis/node-redis/blob/master/LICENSE)
6
+ [![LGTM alerts](https://img.shields.io/lgtm/alerts/g/redis/node-redis.svg?logo=LGTM)](https://lgtm.com/projects/g/redis/node-redis/alerts)
7
+ [![Chat](https://img.shields.io/discord/697882427875393627.svg)](https://discord.gg/redis)
7
8
 
8
9
  node-redis is a modern, high performance [Redis](https://redis.io) client for Node.js with built-in support for Redis 6.2 commands and modules including [RediSearch](https://redisearch.io) and [RedisJSON](https://redisjson.io).
9
10
 
11
+
12
+ ## Packages
13
+
14
+ | Name | Description |
15
+ |---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
16
+ | [redis](./) | [![Downloads](https://img.shields.io/npm/dm/redis.svg)](https://www.npmjs.com/package/redis) [![Version](https://img.shields.io/npm/v/redis.svg)](https://www.npmjs.com/package/redis) |
17
+ | [@node-redis/client](./packages/client) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/client.svg)](https://www.npmjs.com/package/@node-redis/client) [![Version](https://img.shields.io/npm/v/@node-redis/client.svg)](https://www.npmjs.com/package/@node-redis/client) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/client/) |
18
+ | [@node-redis/bloom](./packages/bloom) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/bloom.svg)](https://www.npmjs.com/package/@node-redis/bloom) [![Version](https://img.shields.io/npm/v/@node-redis/bloom.svg)](https://www.npmjs.com/package/@node-redis/bloom) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/bloom/) [Redis Bloom](https://oss.redis.com/redisbloom/) commands |
19
+ | [@node-redis/graph](./packages/graph) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/graph.svg)](https://www.npmjs.com/package/@node-redis/graph) [![Version](https://img.shields.io/npm/v/@node-redis/graph.svg)](https://www.npmjs.com/package/@node-redis/graph) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/graph/) [Redis Graph](https://oss.redis.com/redisgraph/) commands |
20
+ | [@node-redis/json](./packages/json) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/json.svg)](https://www.npmjs.com/package/@node-redis/json) [![Version](https://img.shields.io/npm/v/@node-redis/json.svg)](https://www.npmjs.com/package/@node-redis/json) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/json/) [Redis JSON](https://oss.redis.com/redisjson/) commands |
21
+ | [@node-redis/search](./packages/search) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/search.svg)](https://www.npmjs.com/package/@node-redis/search) [![Version](https://img.shields.io/npm/v/@node-redis/search.svg)](https://www.npmjs.com/package/@node-redis/search) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/search/) [Redis Search](https://oss.redis.com/redisearch/) commands |
22
+ | [@node-redis/time-series](./packages/time-series) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/time-series.svg)](https://www.npmjs.com/package/@node-redis/time-series) [![Version](https://img.shields.io/npm/v/@node-redis/time-series.svg)](https://www.npmjs.com/package/@node-redis/time-series) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/time-series/) [Redis Time-Series](https://oss.redis.com/redistimeseries/) commands |
23
+
10
24
  ## Installation
11
25
 
12
26
  ```bash
@@ -74,6 +88,16 @@ await client.hGetAll('key'); // { field1: 'value1', field2: 'value2' }
74
88
  await client.hVals('key'); // ['value1', 'value2']
75
89
  ```
76
90
 
91
+ `Buffer`s are supported as well:
92
+
93
+ ```typescript
94
+ await client.hSet('key', 'field', Buffer.from('value')); // 'OK'
95
+ await client.hGetAll(
96
+ commandOptions({ returnBuffers: true }),
97
+ 'key'
98
+ ); // { field: <Buffer 76 61 6c 75 65> }
99
+ ```
100
+
77
101
  ### Unsupported Redis Commands
78
102
 
79
103
  If you want to run commands and/or use arguments that Node Redis doesn't know about (yet!) use `.sendCommand()`:
@@ -111,7 +135,11 @@ This pattern works especially well for blocking commands—such as `BLPOP` and `
111
135
  ```typescript
112
136
  import { commandOptions } from 'redis';
113
137
 
114
- const blPopPromise = client.blPop(commandOptions({ isolated: true }), 'key', 0);
138
+ const blPopPromise = client.blPop(
139
+ commandOptions({ isolated: true }),
140
+ 'key',
141
+ 0
142
+ );
115
143
 
116
144
  await client.lPush('key', ['1', '2']);
117
145
 
@@ -180,7 +208,7 @@ This works with `HSCAN`, `SSCAN`, and `ZSCAN` too:
180
208
  ```typescript
181
209
  for await (const { field, value } of client.hScanIterator('hash')) {}
182
210
  for await (const member of client.sScanIterator('set')) {}
183
- for await (const { score, member } of client.zScanIterator('sorted-set')) {}
211
+ for await (const { score, value } of client.zScanIterator('sorted-set')) {}
184
212
  ```
185
213
 
186
214
  You can override the default options by providing a configuration object:
@@ -277,6 +305,20 @@ await Promise.all([
277
305
 
278
306
  Check out the [Clustering Guide](./docs/clustering.md) when using Node Redis to connect to a Redis Cluster.
279
307
 
308
+ ### Events
309
+
310
+ The Node Redis client class is an Nodejs EventEmitter and it emits an event each time the network status changes:
311
+
312
+ | Event name | Scenes | Arguments to be passed to the listener |
313
+ |----------------|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
314
+ | `connect` | The client is initiating a connection to the server. | _No argument_ |
315
+ | `ready` | The client successfully initiated the connection to the server. | _No argument_ |
316
+ | `end` | The client disconnected the connection to the server via `.quit()` or `.disconnect()`. | _No argument_ |
317
+ | `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]` |
318
+ | `reconnecting` | The client is trying to reconnect to the server. | _No argument_ |
319
+
320
+ The client will not emit [any other events](./docs/v3-to-v4.md#all-the-removed-events) beyond those listed above.
321
+
280
322
  ## Supported Redis versions
281
323
 
282
324
  Node Redis is supported with the following versions of Redis:
@@ -290,15 +332,6 @@ Node Redis is supported with the following versions of Redis:
290
332
 
291
333
  > Node Redis should work with older versions of Redis, but it is not fully tested and we cannot offer support.
292
334
 
293
- ## Packages
294
-
295
- | Name | Description |
296
- |-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
297
- | [redis](./) | [![Downloads](https://img.shields.io/npm/dm/redis.svg)](https://www.npmjs.com/package/redis/v/next) [![Version](https://img.shields.io/npm/v/redis/next.svg)](https://www.npmjs.com/package/redis/v/next) |
298
- | [@node-redis/client](./packages/client) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/client.svg)](https://www.npmjs.com/package/@node-redis/client/v/next) [![Version](https://img.shields.io/npm/v/@node-redis/client/next.svg)](https://www.npmjs.com/package/@node-redis/client/v/next) |
299
- | [@node-redis/json](./packages/json) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/json.svg)](https://www.npmjs.com/package/@node-redis/json/v/next) [![Version](https://img.shields.io/npm/v/@node-redis/json/next.svg)](https://www.npmjs.com/package/@node-redis/json/v/next) [Redis JSON](https://oss.redis.com/redisjson/) commands |
300
- | [@node-redis/search](./packages/search) | [![Downloads](https://img.shields.io/npm/dm/@node-redis/search.svg)](https://www.npmjs.com/package/@node-redis/search/v/next) [![Version](https://img.shields.io/npm/v/@node-redis/search/next.svg)](https://www.npmjs.com/package/@node-redis/search/v/next) [Redis Search](https://oss.redis.com/redisearch/) commands |
301
-
302
335
  ## Contributing
303
336
 
304
337
  If you'd like to contribute, check out the [contributing guide](CONTRIBUTING.md).
package/dist/index.d.ts CHANGED
@@ -1,10 +1,31 @@
1
- import { RedisScripts } from '@node-redis/client/dist/lib/commands';
2
- import { RedisClientOptions, RedisClientType } from '@node-redis/client/dist/lib/client';
3
- import { RedisClusterOptions, RedisClusterType } from '@node-redis/client/dist/lib/cluster';
1
+ import { RedisModules, RedisScripts, RedisClientOptions, RedisClientType as _RedisClientType, RedisClusterOptions, RedisClusterType as _RedisClusterType } from '@node-redis/client';
4
2
  export * from '@node-redis/client';
3
+ export * from '@node-redis/bloom';
4
+ export * from '@node-redis/graph';
5
5
  export * from '@node-redis/json';
6
6
  export * from '@node-redis/search';
7
+ export * from '@node-redis/time-series';
7
8
  declare const modules: {
9
+ graph: {
10
+ CONFIG_GET: typeof import("@node-redis/graph/dist/commands/CONFIG_GET");
11
+ configGet: typeof import("@node-redis/graph/dist/commands/CONFIG_GET");
12
+ CONFIG_SET: typeof import("@node-redis/graph/dist/commands/CONFIG_SET");
13
+ configSet: typeof import("@node-redis/graph/dist/commands/CONFIG_SET");
14
+ DELETE: typeof import("@node-redis/graph/dist/commands/DELETE");
15
+ delete: typeof import("@node-redis/graph/dist/commands/DELETE");
16
+ EXPLAIN: typeof import("@node-redis/graph/dist/commands/EXPLAIN");
17
+ explain: typeof import("@node-redis/graph/dist/commands/EXPLAIN");
18
+ LIST: typeof import("@node-redis/graph/dist/commands/LIST");
19
+ list: typeof import("@node-redis/graph/dist/commands/LIST");
20
+ PROFILE: typeof import("@node-redis/graph/dist/commands/PROFILE");
21
+ profile: typeof import("@node-redis/graph/dist/commands/PROFILE");
22
+ QUERY_RO: typeof import("@node-redis/graph/dist/commands/QUERY_RO");
23
+ queryRo: typeof import("@node-redis/graph/dist/commands/QUERY_RO");
24
+ QUERY: typeof import("@node-redis/graph/dist/commands/QUERY");
25
+ query: typeof import("@node-redis/graph/dist/commands/QUERY");
26
+ SLOWLOG: typeof import("@node-redis/graph/dist/commands/SLOWLOG");
27
+ slowLog: typeof import("@node-redis/graph/dist/commands/SLOWLOG");
28
+ };
8
29
  json: {
9
30
  ARRAPPEND: typeof import("@node-redis/json/dist/commands/ARRAPPEND");
10
31
  arrAppend: typeof import("@node-redis/json/dist/commands/ARRAPPEND");
@@ -50,6 +71,8 @@ declare const modules: {
50
71
  ft: {
51
72
  _LIST: typeof import("@node-redis/search/dist/commands/_LIST");
52
73
  _list: typeof import("@node-redis/search/dist/commands/_LIST");
74
+ ALTER: typeof import("@node-redis/search/dist/commands/ALTER");
75
+ alter: typeof import("@node-redis/search/dist/commands/ALTER");
53
76
  AGGREGATE: typeof import("@node-redis/search/dist/commands/AGGREGATE");
54
77
  aggregate: typeof import("@node-redis/search/dist/commands/AGGREGATE");
55
78
  ALIASADD: typeof import("@node-redis/search/dist/commands/ALIASADD");
@@ -78,6 +101,10 @@ declare const modules: {
78
101
  explainCli: typeof import("@node-redis/search/dist/commands/EXPLAINCLI");
79
102
  INFO: typeof import("@node-redis/search/dist/commands/INFO");
80
103
  info: typeof import("@node-redis/search/dist/commands/INFO");
104
+ PROFILESEARCH: typeof import("@node-redis/search/dist/commands/PROFILE_SEARCH");
105
+ profileSearch: typeof import("@node-redis/search/dist/commands/PROFILE_SEARCH");
106
+ PROFILEAGGREGATE: typeof import("@node-redis/search/dist/commands/PROFILE_AGGREGATE");
107
+ profileAggregate: typeof import("@node-redis/search/dist/commands/PROFILE_AGGREGATE");
81
108
  SEARCH: typeof import("@node-redis/search/dist/commands/SEARCH");
82
109
  search: typeof import("@node-redis/search/dist/commands/SEARCH");
83
110
  SPELLCHECK: typeof import("@node-redis/search/dist/commands/SPELLCHECK");
@@ -103,6 +130,127 @@ declare const modules: {
103
130
  TAGVALS: typeof import("@node-redis/search/dist/commands/TAGVALS");
104
131
  tagVals: typeof import("@node-redis/search/dist/commands/TAGVALS");
105
132
  };
133
+ ts: {
134
+ ADD: typeof import("@node-redis/time-series/dist/commands/ADD");
135
+ add: typeof import("@node-redis/time-series/dist/commands/ADD");
136
+ ALTER: typeof import("@node-redis/time-series/dist/commands/ALTER");
137
+ alter: typeof import("@node-redis/time-series/dist/commands/ALTER");
138
+ CREATE: typeof import("@node-redis/time-series/dist/commands/CREATE");
139
+ create: typeof import("@node-redis/time-series/dist/commands/CREATE");
140
+ CREATERULE: typeof import("@node-redis/time-series/dist/commands/CREATERULE");
141
+ createRule: typeof import("@node-redis/time-series/dist/commands/CREATERULE");
142
+ DECRBY: typeof import("@node-redis/time-series/dist/commands/DECRBY");
143
+ decrBy: typeof import("@node-redis/time-series/dist/commands/DECRBY");
144
+ DEL: typeof import("@node-redis/time-series/dist/commands/DEL");
145
+ del: typeof import("@node-redis/time-series/dist/commands/DEL");
146
+ DELETERULE: typeof import("@node-redis/time-series/dist/commands/DELETERULE");
147
+ deleteRule: typeof import("@node-redis/time-series/dist/commands/DELETERULE");
148
+ GET: typeof import("@node-redis/time-series/dist/commands/GET");
149
+ get: typeof import("@node-redis/time-series/dist/commands/GET");
150
+ INCRBY: typeof import("@node-redis/time-series/dist/commands/INCRBY");
151
+ incrBy: typeof import("@node-redis/time-series/dist/commands/INCRBY");
152
+ INFO_DEBUG: typeof import("@node-redis/time-series/dist/commands/INFO_DEBUG");
153
+ infoDebug: typeof import("@node-redis/time-series/dist/commands/INFO_DEBUG");
154
+ INFO: typeof import("@node-redis/time-series/dist/commands/INFO");
155
+ info: typeof import("@node-redis/time-series/dist/commands/INFO");
156
+ MADD: typeof import("@node-redis/time-series/dist/commands/MADD");
157
+ mAdd: typeof import("@node-redis/time-series/dist/commands/MADD");
158
+ MGET: typeof import("@node-redis/time-series/dist/commands/MGET");
159
+ mGet: typeof import("@node-redis/time-series/dist/commands/MGET");
160
+ MGET_WITHLABELS: typeof import("@node-redis/time-series/dist/commands/MGET_WITHLABELS");
161
+ mGetWithLabels: typeof import("@node-redis/time-series/dist/commands/MGET_WITHLABELS");
162
+ QUERYINDEX: typeof import("@node-redis/time-series/dist/commands/QUERYINDEX");
163
+ queryIndex: typeof import("@node-redis/time-series/dist/commands/QUERYINDEX");
164
+ RANGE: typeof import("@node-redis/time-series/dist/commands/RANGE");
165
+ range: typeof import("@node-redis/time-series/dist/commands/RANGE");
166
+ REVRANGE: typeof import("@node-redis/time-series/dist/commands/REVRANGE");
167
+ revRange: typeof import("@node-redis/time-series/dist/commands/REVRANGE");
168
+ MRANGE: typeof import("@node-redis/time-series/dist/commands/MRANGE");
169
+ mRange: typeof import("@node-redis/time-series/dist/commands/MRANGE");
170
+ MRANGE_WITHLABELS: typeof import("@node-redis/time-series/dist/commands/MRANGE_WITHLABELS");
171
+ mRangeWithLabels: typeof import("@node-redis/time-series/dist/commands/MRANGE_WITHLABELS");
172
+ MREVRANGE: typeof import("@node-redis/time-series/dist/commands/MREVRANGE");
173
+ mRevRange: typeof import("@node-redis/time-series/dist/commands/MREVRANGE");
174
+ MREVRANGE_WITHLABELS: typeof import("@node-redis/time-series/dist/commands/MREVRANGE_WITHLABELS");
175
+ mRevRangeWithLabels: typeof import("@node-redis/time-series/dist/commands/MREVRANGE_WITHLABELS");
176
+ };
177
+ bf: {
178
+ ADD: typeof import("@node-redis/bloom/dist/commands/bloom/ADD");
179
+ add: typeof import("@node-redis/bloom/dist/commands/bloom/ADD");
180
+ EXISTS: typeof import("@node-redis/bloom/dist/commands/bloom/EXISTS");
181
+ exists: typeof import("@node-redis/bloom/dist/commands/bloom/EXISTS");
182
+ INFO: typeof import("@node-redis/bloom/dist/commands/bloom/INFO");
183
+ info: typeof import("@node-redis/bloom/dist/commands/bloom/INFO");
184
+ INSERT: typeof import("@node-redis/bloom/dist/commands/bloom/INSERT");
185
+ insert: typeof import("@node-redis/bloom/dist/commands/bloom/INSERT");
186
+ LOADCHUNK: typeof import("@node-redis/bloom/dist/commands/bloom/LOADCHUNK");
187
+ loadChunk: typeof import("@node-redis/bloom/dist/commands/bloom/LOADCHUNK");
188
+ MADD: typeof import("@node-redis/bloom/dist/commands/bloom/MADD");
189
+ mAdd: typeof import("@node-redis/bloom/dist/commands/bloom/MADD");
190
+ MEXISTS: typeof import("@node-redis/bloom/dist/commands/bloom/MEXISTS");
191
+ mExists: typeof import("@node-redis/bloom/dist/commands/bloom/MEXISTS");
192
+ RESERVE: typeof import("@node-redis/bloom/dist/commands/bloom/RESERVE");
193
+ reserve: typeof import("@node-redis/bloom/dist/commands/bloom/RESERVE");
194
+ SCANDUMP: typeof import("@node-redis/bloom/dist/commands/bloom/SCANDUMP");
195
+ scanDump: typeof import("@node-redis/bloom/dist/commands/bloom/SCANDUMP");
196
+ };
197
+ cms: {
198
+ INCRBY: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INCRBY");
199
+ incrBy: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INCRBY");
200
+ INFO: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INFO");
201
+ info: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INFO");
202
+ INITBYDIM: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYDIM");
203
+ initByDim: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYDIM");
204
+ INITBYPROB: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYPROB");
205
+ initByProb: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/INITBYPROB");
206
+ MERGE: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/MERGE");
207
+ merge: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/MERGE");
208
+ QUERY: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/QUERY");
209
+ query: typeof import("@node-redis/bloom/dist/commands/count-min-sketch/QUERY");
210
+ };
211
+ cf: {
212
+ ADD: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADD");
213
+ add: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADD");
214
+ ADDNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADDNX");
215
+ addNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/ADDNX");
216
+ COUNT: typeof import("@node-redis/bloom/dist/commands/cuckoo/COUNT");
217
+ count: typeof import("@node-redis/bloom/dist/commands/cuckoo/COUNT");
218
+ DEL: typeof import("@node-redis/bloom/dist/commands/cuckoo/DEL");
219
+ del: typeof import("@node-redis/bloom/dist/commands/cuckoo/DEL");
220
+ EXISTS: typeof import("@node-redis/bloom/dist/commands/cuckoo/EXISTS");
221
+ exists: typeof import("@node-redis/bloom/dist/commands/cuckoo/EXISTS");
222
+ INFO: typeof import("@node-redis/bloom/dist/commands/cuckoo/INFO");
223
+ info: typeof import("@node-redis/bloom/dist/commands/cuckoo/INFO");
224
+ INSERT: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERT");
225
+ insert: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERT");
226
+ INSERTNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERTNX");
227
+ insertNX: typeof import("@node-redis/bloom/dist/commands/cuckoo/INSERTNX");
228
+ LOADCHUNK: typeof import("@node-redis/bloom/dist/commands/cuckoo/LOADCHUNK");
229
+ loadChunk: typeof import("@node-redis/bloom/dist/commands/cuckoo/LOADCHUNK");
230
+ RESERVE: typeof import("@node-redis/bloom/dist/commands/cuckoo/RESERVE");
231
+ reserve: typeof import("@node-redis/bloom/dist/commands/cuckoo/RESERVE");
232
+ SCANDUMP: typeof import("@node-redis/bloom/dist/commands/cuckoo/SCANDUMP");
233
+ scanDump: typeof import("@node-redis/bloom/dist/commands/cuckoo/SCANDUMP");
234
+ };
235
+ topK: {
236
+ ADD: typeof import("@node-redis/bloom/dist/commands/top-k/ADD");
237
+ add: typeof import("@node-redis/bloom/dist/commands/top-k/ADD");
238
+ COUNT: typeof import("@node-redis/bloom/dist/commands/top-k/COUNT");
239
+ count: typeof import("@node-redis/bloom/dist/commands/top-k/COUNT");
240
+ INCRBY: typeof import("@node-redis/bloom/dist/commands/top-k/INCRBY");
241
+ incrBy: typeof import("@node-redis/bloom/dist/commands/top-k/INCRBY");
242
+ INFO: typeof import("@node-redis/bloom/dist/commands/top-k/INFO");
243
+ info: typeof import("@node-redis/bloom/dist/commands/top-k/INFO");
244
+ LIST: typeof import("@node-redis/bloom/dist/commands/top-k/LIST");
245
+ list: typeof import("@node-redis/bloom/dist/commands/top-k/LIST");
246
+ QUERY: typeof import("@node-redis/bloom/dist/commands/top-k/QUERY");
247
+ query: typeof import("@node-redis/bloom/dist/commands/top-k/QUERY");
248
+ RESERVE: typeof import("@node-redis/bloom/dist/commands/top-k/RESERVE");
249
+ reserve: typeof import("@node-redis/bloom/dist/commands/top-k/RESERVE");
250
+ };
106
251
  };
107
- export declare function createClient<S extends RedisScripts = Record<string, never>>(options?: Omit<RedisClientOptions<never, S>, 'modules'>): RedisClientType<typeof modules, S>;
108
- export declare function createCluster<S extends RedisScripts = Record<string, never>>(options: Omit<RedisClusterOptions<never, S>, 'modules'>): RedisClusterType<typeof modules, S>;
252
+ export declare type RedisDefaultModules = typeof modules;
253
+ export declare type RedisClientType<M extends RedisModules = RedisDefaultModules, S extends RedisScripts = Record<string, never>> = _RedisClientType<M, S>;
254
+ export declare function createClient<M extends RedisModules, S extends RedisScripts>(options?: RedisClientOptions<M, S>): _RedisClientType<RedisDefaultModules & M, S>;
255
+ export declare type RedisClusterType<M extends RedisModules = RedisDefaultModules, S extends RedisScripts = Record<string, never>> = _RedisClusterType<M, S>;
256
+ export declare function createCluster<M extends RedisModules, S extends RedisScripts>(options: RedisClusterOptions<M, S>): RedisClusterType<RedisDefaultModules & M, S>;
package/dist/index.js CHANGED
@@ -12,26 +12,41 @@ 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");
16
+ const graph_1 = require("@node-redis/graph");
15
17
  const json_1 = require("@node-redis/json");
16
18
  const search_1 = require("@node-redis/search");
19
+ const time_series_1 = require("@node-redis/time-series");
17
20
  __exportStar(require("@node-redis/client"), exports);
21
+ __exportStar(require("@node-redis/bloom"), exports);
22
+ __exportStar(require("@node-redis/graph"), exports);
18
23
  __exportStar(require("@node-redis/json"), exports);
19
24
  __exportStar(require("@node-redis/search"), exports);
25
+ __exportStar(require("@node-redis/time-series"), exports);
20
26
  const modules = {
27
+ ...bloom_1.default,
28
+ graph: graph_1.default,
21
29
  json: json_1.default,
22
- ft: search_1.default
30
+ ft: search_1.default,
31
+ ts: time_series_1.default
23
32
  };
24
33
  function createClient(options) {
25
34
  return (0, client_1.createClient)({
26
35
  ...options,
27
- modules
36
+ modules: {
37
+ ...modules,
38
+ ...options === null || options === void 0 ? void 0 : options.modules
39
+ }
28
40
  });
29
41
  }
30
42
  exports.createClient = createClient;
31
43
  function createCluster(options) {
32
44
  return (0, client_1.createCluster)({
33
45
  ...options,
34
- modules
46
+ modules: {
47
+ ...modules,
48
+ ...options === null || options === void 0 ? void 0 : options.modules
49
+ }
35
50
  });
36
51
  }
37
52
  exports.createCluster = createCluster;
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "redis",
3
- "version": "4.0.0",
3
+ "description": "A modern, high performance Redis client",
4
+ "version": "4.0.4",
4
5
  "license": "MIT",
5
6
  "main": "./dist/index.js",
6
7
  "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist/"
10
+ ],
7
11
  "workspaces": [
8
12
  "./packages/*"
9
13
  ],
@@ -14,17 +18,23 @@
14
18
  "build:tests-tools": "npm run build:client && npm run build:test-utils",
15
19
  "build:modules": "find ./packages -mindepth 1 -maxdepth 1 -type d ! -name 'client' ! -name 'test-utils' -exec npm run build -w {} \\;",
16
20
  "build": "tsc",
17
- "build-all": "npm run build:client && npm run build:test-utils && npm run build:modules && npm run build"
21
+ "build-all": "npm run build:client && npm run build:test-utils && npm run build:modules && npm run build",
22
+ "documentation": "npm run documentation -ws --if-present",
23
+ "gh-pages": "gh-pages -d ./documentation -e ./documentation -u 'documentation-bot <documentation@bot>'"
18
24
  },
19
25
  "dependencies": {
20
- "@node-redis/client": "^1.0.0",
21
- "@node-redis/json": "^1.0.0",
22
- "@node-redis/search": "^1.0.0"
26
+ "@node-redis/bloom": "1.0.1",
27
+ "@node-redis/client": "1.0.4",
28
+ "@node-redis/graph": "1.0.0",
29
+ "@node-redis/json": "1.0.2",
30
+ "@node-redis/search": "1.0.3",
31
+ "@node-redis/time-series": "1.0.2"
23
32
  },
24
33
  "devDependencies": {
25
34
  "@tsconfig/node12": "^1.0.9",
26
- "release-it": "^14.11.8",
27
- "typescript": "^4.5.2"
35
+ "gh-pages": "^3.2.3",
36
+ "release-it": "^14.12.1",
37
+ "typescript": "^4.5.4"
28
38
  },
29
39
  "repository": {
30
40
  "type": "git",
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/node-redis.iml" filepath="$PROJECT_DIR$/.idea/node-redis.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
package/dump.rdb DELETED
Binary file
@@ -1,72 +0,0 @@
1
- import { createCluster } from 'redis';
2
- import { strict as assert } from 'assert';
3
- import { promises as fs } from 'fs';
4
-
5
- const cluster = createCluster({
6
- rootNodes: [{
7
- socket: {
8
- host: 'redis-14416.ned.shahar.demo.redislabs.com',
9
- port: 14416
10
- }
11
- }],
12
- defaults: {
13
- password: 'osscluster'
14
- }
15
- });
16
-
17
- cluster.on('error', err => console.error('Redis Cluster Error', err));
18
-
19
- try {
20
- await cluster.connect();
21
-
22
- await Promise.all([
23
- ...cluster.getMasters().map(({ client }) => client.flushAll()),
24
- fs.writeFile('./error.log', '')
25
- ]);
26
-
27
- await promiseConcurrency(setAndGet, { end: 500000, concurrency: 1000 });
28
- } finally {
29
- await cluster.disconnect();
30
- }
31
-
32
- async function setAndGet(i) {
33
- const str = i.toString();
34
-
35
- await cluster.set(str, str);
36
-
37
- assert.equal(
38
- await cluster.get(str),
39
- str
40
- );
41
- }
42
-
43
- function promiseConcurrency(fn, { start = 0, end, concurrency }) {
44
- return new Promise(resolve => {
45
- let num = start,
46
- inProgress = 0;
47
-
48
- function run() {
49
- ++inProgress;
50
-
51
- const i = num++;
52
- if (i % 1000 === 0) {
53
- console.log('!!!', i);
54
- }
55
-
56
- fn(i)
57
- .finally(() => --inProgress)
58
- .then(() => {
59
- if (num < end) {
60
- run();
61
- } else if (inProgress === 0) {
62
- resolve();
63
- }
64
- })
65
- .catch(err => fs.appendFile('./error.log', `${i.toString()} - ${err.toString()}\n\n-------\n\n`));
66
- }
67
-
68
- for (let i = 0; i < concurrency; i++) {
69
- run();
70
- }
71
- });
72
- }
package/scripts/error.log DELETED
File without changes
@@ -1,28 +0,0 @@
1
- {
2
- "name": "node-redis-scripts",
3
- "lockfileVersion": 2,
4
- "requires": true,
5
- "packages": {
6
- "..": {
7
- "version": "4.0.0-rc.4",
8
- "license": "MIT",
9
- "workspaces": [
10
- "./packages/*"
11
- ],
12
- "dependencies": {
13
- "@node-redis/client": "^1.0.0-rc.0",
14
- "@node-redis/json": "^1.0.0-rc.0",
15
- "@node-redis/search": "^1.0.0-rc.0"
16
- },
17
- "devDependencies": {
18
- "@tsconfig/node12": "^1.0.9",
19
- "release-it": "^14.11.7",
20
- "typescript": "^4.4.4"
21
- }
22
- },
23
- "node_modules/redis": {
24
- "resolved": "..",
25
- "link": true
26
- }
27
- }
28
- }
@@ -1,47 +0,0 @@
1
- {
2
- "name": "node-redis-scripts",
3
- "lockfileVersion": 2,
4
- "requires": true,
5
- "packages": {
6
- "": {
7
- "name": "node-redis-scripts",
8
- "dependencies": {
9
- "redis": "../"
10
- }
11
- },
12
- "..": {
13
- "version": "4.0.0-rc.4",
14
- "license": "MIT",
15
- "workspaces": [
16
- "./packages/*"
17
- ],
18
- "dependencies": {
19
- "@node-redis/client": "^1.0.0-rc.0",
20
- "@node-redis/json": "^1.0.0-rc.0",
21
- "@node-redis/search": "^1.0.0-rc.0"
22
- },
23
- "devDependencies": {
24
- "@tsconfig/node12": "^1.0.9",
25
- "release-it": "^14.11.7",
26
- "typescript": "^4.4.4"
27
- }
28
- },
29
- "node_modules/redis": {
30
- "resolved": "..",
31
- "link": true
32
- }
33
- },
34
- "dependencies": {
35
- "redis": {
36
- "version": "file:..",
37
- "requires": {
38
- "@node-redis/client": "^1.0.0-rc.0",
39
- "@node-redis/json": "^1.0.0-rc.0",
40
- "@node-redis/search": "^1.0.0-rc.0",
41
- "@tsconfig/node12": "^1.0.9",
42
- "release-it": "^14.11.7",
43
- "typescript": "^4.4.4"
44
- }
45
- }
46
- }
47
- }
@@ -1,9 +0,0 @@
1
- {
2
- "name": "node-redis-scripts",
3
- "private": true,
4
- "type": "module",
5
- "dependencies": {
6
- "redis": "../"
7
- }
8
- }
9
-