1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

prepare 4.1.0 (#2111)

* increase test coverage

* @node-redis to @redis

* ugprade deps

* fix benchmark

* use 7.0 docker (not rc), update readmes, clean code, fix @-redis import

* update readme

* fix function in cluster

* update docs

Co-authored-by: Chayim <chayim@users.noreply.github.com>

* Update clustering.md

* add subpackages move warning

* drop support for node 12

* upgrade deps

* fix tsconfig.base.json

Co-authored-by: Chayim <chayim@users.noreply.github.com>
This commit is contained in:
Leibale Eidelman
2022-05-02 11:48:12 -04:00
committed by GitHub
parent baf67fd87f
commit 0752f143a6
89 changed files with 3866 additions and 1862 deletions

View File

@@ -16,8 +16,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: ['12', '14', '16'] node-version: ['14', '16', '17', '18']
redis-version: ['5', '6.0', '6.2', '7.0-rc3'] redis-version: ['5', '6.0', '6.2', '7.0']
steps: steps:
- uses: actions/checkout@v2.3.4 - uses: actions/checkout@v2.3.4
with: with:

111
README.md
View File

@@ -4,22 +4,28 @@
[![Coverage](https://codecov.io/gh/redis/node-redis/branch/master/graph/badge.svg?token=xcfqHhJC37)](https://codecov.io/gh/redis/node-redis) [![Coverage](https://codecov.io/gh/redis/node-redis/branch/master/graph/badge.svg?token=xcfqHhJC37)](https://codecov.io/gh/redis/node-redis)
[![License](https://img.shields.io/github/license/redis/node-redis.svg)](https://github.com/redis/node-redis/blob/master/LICENSE) [![License](https://img.shields.io/github/license/redis/node-redis.svg)](https://github.com/redis/node-redis/blob/master/LICENSE)
[![LGTM alerts](https://img.shields.io/lgtm/alerts/g/redis/node-redis.svg?logo=LGTM)](https://lgtm.com/projects/g/redis/node-redis/alerts) [![LGTM alerts](https://img.shields.io/lgtm/alerts/g/redis/node-redis.svg?logo=LGTM)](https://lgtm.com/projects/g/redis/node-redis/alerts)
[![Chat](https://img.shields.io/discord/697882427875393627.svg)](https://discord.gg/redis)
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). [![Discord](https://img.shields.io/discord/697882427875393627.svg?style=social&logo=discord)](https://discord.gg/redis)
[![Twitch](https://img.shields.io/twitch/status/redisinc?style=social)](https://www.twitch.tv/redisinc)
[![YouTube](https://img.shields.io/youtube/channel/views/UCD78lHSwYqMlyetR0_P4Vig?style=social)](https://www.youtube.com/redisinc)
[![Twitter](https://img.shields.io/twitter/follow/redisinc?style=social)](https://twitter.com/redisinc)
node-redis is a modern, high performance [Redis](https://redis.io) client for Node.js.
## Packages ## Packages
| Name | Description | | Name | Description |
|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [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) | | [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) |
| [@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/) | | [@redis/client](./packages/client) | [![Downloads](https://img.shields.io/npm/dm/@redis/client.svg)](https://www.npmjs.com/package/@redis/client) [![Version](https://img.shields.io/npm/v/@redis/client.svg)](https://www.npmjs.com/package/@redis/client) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/client/) |
| [@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 | | [@redis/bloom](./packages/bloom) | [![Downloads](https://img.shields.io/npm/dm/@redis/bloom.svg)](https://www.npmjs.com/package/@redis/bloom) [![Version](https://img.shields.io/npm/v/@redis/bloom.svg)](https://www.npmjs.com/package/@redis/bloom) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/bloom/) [Redis Bloom](https://oss.redis.com/redisbloom/) commands |
| [@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 | | [@redis/graph](./packages/graph) | [![Downloads](https://img.shields.io/npm/dm/@redis/graph.svg)](https://www.npmjs.com/package/@redis/graph) [![Version](https://img.shields.io/npm/v/@redis/graph.svg)](https://www.npmjs.com/package/@redis/graph) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/graph/) [Redis Graph](https://oss.redis.com/redisgraph/) commands |
| [@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 | | [@redis/json](./packages/json) | [![Downloads](https://img.shields.io/npm/dm/@redis/json.svg)](https://www.npmjs.com/package/@redis/json) [![Version](https://img.shields.io/npm/v/@redis/json.svg)](https://www.npmjs.com/package/@redis/json) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/json/) [Redis JSON](https://oss.redis.com/redisjson/) commands |
| [@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 | | [@redis/search](./packages/search) | [![Downloads](https://img.shields.io/npm/dm/@redis/search.svg)](https://www.npmjs.com/package/@redis/search) [![Version](https://img.shields.io/npm/v/@redis/search.svg)](https://www.npmjs.com/package/@redis/search) [![Docs](https://img.shields.io/badge/-documentation-dc382c)](https://redis.js.org/documentation/search/) [Redis Search](https://oss.redis.com/redisearch/) commands |
| [@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 | | [@redis/time-series](./packages/time-series) | [![Downloads](https://img.shields.io/npm/dm/@redis/time-series.svg)](https://www.npmjs.com/package/@redis/time-series) [![Version](https://img.shields.io/npm/v/@redis/time-series.svg)](https://www.npmjs.com/package/@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 |
> :warning: In version 4.1.0 we moved our subpackages from `@node-redis` to `@redis`. If you're just using `npm install redis`, you don't need to do anything—it'll upgrade automatically. If you're using the subpackages directly, you'll need to point to the new scope (e.g. `@redis/client` instead of `@node-redis/client`).
## Installation ## Installation
@@ -219,36 +225,84 @@ client.scanIterator({
}); });
``` ```
### Lua Scripts ### [Programmability](https://redis.io/docs/manual/programmability/)
Define new functions using [Lua scripts](https://redis.io/commands/eval) which execute on the Redis server: Redis provides a programming interface allowing code execution on the redis server.
#### [Functions](https://redis.io/docs/manual/programmability/functions-intro/)
The following example retrieves a key in redis, returning the value of the key, incremented by an integer. For example, if your key _foo_ has the value _17_ and we run `add('foo', 25)`, it returns the answer to Life, the Universe and Everything.
```lua
#!lua name=library
redis.register_function {
function_name = 'add',
callback = function(keys, args) return redis.call('GET', keys[1]) + args[1] end,
flags = { 'no-writes' }
}
```
Here is the same example, but in a format that can be pasted into the `redis-cli`.
```
FUNCTION LOAD "#!lua name=library\nredis.register_function{function_name=\"add\", callback=function(keys, args) return redis.call('GET', keys[1])+args[1] end, flags={\"no-writes\"}}"
```
Load the prior redis function on the _redis server_ before running the example below.
```typescript ```typescript
import { createClient, defineScript } from 'redis'; import { createClient } from 'redis';
(async () => { const client = createClient({
const client = createClient({ functions: {
scripts: { library: {
add: defineScript({ add: {
NUMBER_OF_KEYS: 1, NUMBER_OF_KEYS: 1,
SCRIPT:
'local val = redis.pcall("GET", KEYS[1]);' +
'return val + ARGV[1];',
transformArguments(key: string, toAdd: number): Array<string> { transformArguments(key: string, toAdd: number): Array<string> {
return [key, toAdd.toString()]; return [key, toAdd.toString()];
}, },
transformReply(reply: number): number { transformReply(reply: number): number {
return reply; return reply;
} }
}) }
} }
}); }
});
await client.connect(); await client.connect();
await client.set('key', '1'); await client.set('key', '1');
await client.add('key', 2); // 3 await client.library.add('key', 2); // 3
})(); ```
#### [Lua Scripts](https://redis.io/docs/manual/programmability/eval-intro/)
The following is an end-to-end example of the prior concept.
```typescript
import { createClient, defineScript } from 'redis';
const client = createClient({
scripts: {
add: defineScript({
NUMBER_OF_KEYS: 1,
SCRIPT:
'return redis.call("GET", KEYS[1]) + ARGV[1];',
transformArguments(key: string, toAdd: number): Array<string> {
return [key, toAdd.toString()];
},
transformReply(reply: number): number {
return reply;
}
})
}
});
await client.connect();
await client.set('key', '1');
await client.add('key', 2); // 3
``` ```
### Disconnecting ### Disconnecting
@@ -323,9 +377,10 @@ Node Redis is supported with the following versions of Redis:
| Version | Supported | | Version | Supported |
|---------|--------------------| |---------|--------------------|
| 7.0.z | :heavy_check_mark: |
| 6.2.z | :heavy_check_mark: | | 6.2.z | :heavy_check_mark: |
| 6.0.z | :heavy_check_mark: | | 6.0.z | :heavy_check_mark: |
| 5.y.z | :heavy_check_mark: | | 5.0.z | :heavy_check_mark: |
| < 5.0 | :x: | | < 5.0 | :x: |
> Node Redis should work with older versions of Redis, but it is not fully tested and we cannot offer support. > Node Redis should work with older versions of Redis, but it is not fully tested and we cannot offer support.

View File

@@ -1,4 +1,4 @@
import { createClient } from '@node-redis/client'; import { createClient } from '@redis/client';
export default async (host) => { export default async (host) => {
const client = createClient({ const client = createClient({

View File

@@ -1,4 +1,4 @@
import { createClient } from '@node-redis/client'; import { createClient } from '@redis/client';
export default async (host, { randomString }) => { export default async (host, { randomString }) => {
const client = createClient({ const client = createClient({

View File

@@ -1,20 +1,20 @@
{ {
"name": "@node-redis/client-benchmark", "name": "@redis/client-benchmark",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@node-redis/client-benchmark", "name": "@redis/client-benchmark",
"dependencies": { "dependencies": {
"@node-redis/client": "../packages/client", "@redis/client": "../packages/client",
"hdr-histogram-js": "3.0.0", "hdr-histogram-js": "3.0.0",
"ioredis": "5.0.4", "ioredis": "5.0.4",
"redis-v3": "npm:redis@4.0.6", "redis-v3": "npm:redis@3.1.2",
"yargs": "17.4.1" "yargs": "17.4.1"
} }
}, },
"../packages/client": { "../packages/client": {
"name": "@node-redis/client", "name": "@redis/client",
"version": "1.0.5", "version": "1.0.5",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -24,12 +24,12 @@
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.29",
"@types/sinon": "^10.0.11", "@types/sinon": "^10.0.11",
"@types/yallist": "^4.0.1", "@types/yallist": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.20.0", "@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.20.0", "@typescript-eslint/parser": "^5.21.0",
"eslint": "^8.14.0", "eslint": "^8.14.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^14.14.2",
@@ -53,50 +53,10 @@
"resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.1.1.tgz",
"integrity": "sha512-fsR4P/ROllzf/7lXYyElUJCheWdTJVJvOTps8v9IWKFATxR61ANOlnoPqhH099xYLrJGpc2ZQ28B3rMeUt5VQg==" "integrity": "sha512-fsR4P/ROllzf/7lXYyElUJCheWdTJVJvOTps8v9IWKFATxR61ANOlnoPqhH099xYLrJGpc2ZQ28B3rMeUt5VQg=="
}, },
"node_modules/@node-redis/bloom": { "node_modules/@redis/client": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@node-redis/bloom/-/bloom-1.0.1.tgz",
"integrity": "sha512-mXEBvEIgF4tUzdIN89LiYsbi6//EdpFA7L8M+DHCvePXg+bfHWi+ct5VI6nHUFQE5+ohm/9wmgihCH3HSkeKsw==",
"peerDependencies": {
"@node-redis/client": "^1.0.0"
}
},
"node_modules/@node-redis/client": {
"resolved": "../packages/client", "resolved": "../packages/client",
"link": true "link": true
}, },
"node_modules/@node-redis/graph": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@node-redis/graph/-/graph-1.0.0.tgz",
"integrity": "sha512-mRSo8jEGC0cf+Rm7q8mWMKKKqkn6EAnA9IA2S3JvUv/gaWW/73vil7GLNwion2ihTptAm05I9LkepzfIXUKX5g==",
"peerDependencies": {
"@node-redis/client": "^1.0.0"
}
},
"node_modules/@node-redis/json": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@node-redis/json/-/json-1.0.2.tgz",
"integrity": "sha512-qVRgn8WfG46QQ08CghSbY4VhHFgaTY71WjpwRBGEuqGPfWwfRcIf3OqSpR7Q/45X+v3xd8mvYjywqh0wqJ8T+g==",
"peerDependencies": {
"@node-redis/client": "^1.0.0"
}
},
"node_modules/@node-redis/search": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@node-redis/search/-/search-1.0.5.tgz",
"integrity": "sha512-MCOL8iCKq4v+3HgEQv8zGlSkZyXSXtERgrAJ4TSryIG/eLFy84b57KmNNa/V7M1Q2Wd2hgn2nPCGNcQtk1R1OQ==",
"peerDependencies": {
"@node-redis/client": "^1.0.0"
}
},
"node_modules/@node-redis/time-series": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@node-redis/time-series/-/time-series-1.0.2.tgz",
"integrity": "sha512-HGQ8YooJ8Mx7l28tD7XjtB3ImLEjlUxG1wC1PAjxu6hPJqjPshUZxAICzDqDjtIbhDTf48WXXUcx8TQJB1XTKA==",
"peerDependencies": {
"@node-redis/client": "^1.0.0"
}
},
"node_modules/ansi-regex": { "node_modules/ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -281,6 +241,11 @@
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
}, },
"node_modules/redis-commands": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz",
"integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ=="
},
"node_modules/redis-errors": { "node_modules/redis-errors": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz",
@@ -302,16 +267,29 @@
}, },
"node_modules/redis-v3": { "node_modules/redis-v3": {
"name": "redis", "name": "redis",
"version": "4.0.6", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/redis/-/redis-4.0.6.tgz", "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz",
"integrity": "sha512-IaPAxgF5dV0jx+A9l6yd6R9/PAChZIoAskDVRzUODeLDNhsMlq7OLLTmu0AwAr0xjrJ1bibW5xdpRwqIQ8Q0Xg==", "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==",
"dependencies": { "dependencies": {
"@node-redis/bloom": "1.0.1", "denque": "^1.5.0",
"@node-redis/client": "1.0.5", "redis-commands": "^1.7.0",
"@node-redis/graph": "1.0.0", "redis-errors": "^1.2.0",
"@node-redis/json": "1.0.2", "redis-parser": "^3.0.0"
"@node-redis/search": "1.0.5", },
"@node-redis/time-series": "1.0.2" "engines": {
"node": ">=10"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-redis"
}
},
"node_modules/redis-v3/node_modules/denque": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz",
"integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==",
"engines": {
"node": ">=0.10"
} }
}, },
"node_modules/require-directory": { "node_modules/require-directory": {
@@ -412,22 +390,16 @@
"resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.1.1.tgz",
"integrity": "sha512-fsR4P/ROllzf/7lXYyElUJCheWdTJVJvOTps8v9IWKFATxR61ANOlnoPqhH099xYLrJGpc2ZQ28B3rMeUt5VQg==" "integrity": "sha512-fsR4P/ROllzf/7lXYyElUJCheWdTJVJvOTps8v9IWKFATxR61ANOlnoPqhH099xYLrJGpc2ZQ28B3rMeUt5VQg=="
}, },
"@node-redis/bloom": { "@redis/client": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@node-redis/bloom/-/bloom-1.0.1.tgz",
"integrity": "sha512-mXEBvEIgF4tUzdIN89LiYsbi6//EdpFA7L8M+DHCvePXg+bfHWi+ct5VI6nHUFQE5+ohm/9wmgihCH3HSkeKsw==",
"requires": {}
},
"@node-redis/client": {
"version": "file:../packages/client", "version": "file:../packages/client",
"requires": { "requires": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.29",
"@types/sinon": "^10.0.11", "@types/sinon": "^10.0.11",
"@types/yallist": "^4.0.1", "@types/yallist": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.20.0", "@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.20.0", "@typescript-eslint/parser": "^5.21.0",
"cluster-key-slot": "1.1.0", "cluster-key-slot": "1.1.0",
"eslint": "^8.14.0", "eslint": "^8.14.0",
"generic-pool": "3.8.2", "generic-pool": "3.8.2",
@@ -441,30 +413,6 @@
"yallist": "4.0.0" "yallist": "4.0.0"
} }
}, },
"@node-redis/graph": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@node-redis/graph/-/graph-1.0.0.tgz",
"integrity": "sha512-mRSo8jEGC0cf+Rm7q8mWMKKKqkn6EAnA9IA2S3JvUv/gaWW/73vil7GLNwion2ihTptAm05I9LkepzfIXUKX5g==",
"requires": {}
},
"@node-redis/json": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@node-redis/json/-/json-1.0.2.tgz",
"integrity": "sha512-qVRgn8WfG46QQ08CghSbY4VhHFgaTY71WjpwRBGEuqGPfWwfRcIf3OqSpR7Q/45X+v3xd8mvYjywqh0wqJ8T+g==",
"requires": {}
},
"@node-redis/search": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@node-redis/search/-/search-1.0.5.tgz",
"integrity": "sha512-MCOL8iCKq4v+3HgEQv8zGlSkZyXSXtERgrAJ4TSryIG/eLFy84b57KmNNa/V7M1Q2Wd2hgn2nPCGNcQtk1R1OQ==",
"requires": {}
},
"@node-redis/time-series": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@node-redis/time-series/-/time-series-1.0.2.tgz",
"integrity": "sha512-HGQ8YooJ8Mx7l28tD7XjtB3ImLEjlUxG1wC1PAjxu6hPJqjPshUZxAICzDqDjtIbhDTf48WXXUcx8TQJB1XTKA==",
"requires": {}
},
"ansi-regex": { "ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -590,6 +538,11 @@
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
"integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="
}, },
"redis-commands": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz",
"integrity": "sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ=="
},
"redis-errors": { "redis-errors": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz",
@@ -604,16 +557,21 @@
} }
}, },
"redis-v3": { "redis-v3": {
"version": "npm:redis@4.0.6", "version": "npm:redis@3.1.2",
"resolved": "https://registry.npmjs.org/redis/-/redis-4.0.6.tgz", "resolved": "https://registry.npmjs.org/redis/-/redis-3.1.2.tgz",
"integrity": "sha512-IaPAxgF5dV0jx+A9l6yd6R9/PAChZIoAskDVRzUODeLDNhsMlq7OLLTmu0AwAr0xjrJ1bibW5xdpRwqIQ8Q0Xg==", "integrity": "sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==",
"requires": { "requires": {
"@node-redis/bloom": "1.0.1", "denque": "^1.5.0",
"@node-redis/client": "1.0.5", "redis-commands": "^1.7.0",
"@node-redis/graph": "1.0.0", "redis-errors": "^1.2.0",
"@node-redis/json": "1.0.2", "redis-parser": "^3.0.0"
"@node-redis/search": "1.0.5", },
"@node-redis/time-series": "1.0.2" "dependencies": {
"denque": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz",
"integrity": "sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw=="
}
} }
}, },
"require-directory": { "require-directory": {

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/client-benchmark", "name": "@redis/client-benchmark",
"private": true, "private": true,
"main": "./lib", "main": "./lib",
"type": "module", "type": "module",
@@ -7,10 +7,10 @@
"start": "node ." "start": "node ."
}, },
"dependencies": { "dependencies": {
"@node-redis/client": "../packages/client", "@redis/client": "../packages/client",
"hdr-histogram-js": "3.0.0", "hdr-histogram-js": "3.0.0",
"ioredis": "5.0.4", "ioredis": "5.0.4",
"redis-v3": "npm:redis@4.0.6", "redis-v3": "npm:redis@3.1.2",
"yargs": "17.4.1" "yargs": "17.4.1"
} }
} }

View File

@@ -19,7 +19,7 @@ If `socket.write()` returns `false`—meaning that ["all or part of the data was
Redis has support for [modules](https://redis.io/modules) and running [Lua scripts](../README.md#lua-scripts) within the Redis context. To take advantage of typing within these scenarios, `RedisClient` and `RedisCluster` should be used with [typeof](https://www.typescriptlang.org/docs/handbook/2/typeof-types.html), rather than the base types `RedisClientType` and `RedisClusterType`. Redis has support for [modules](https://redis.io/modules) and running [Lua scripts](../README.md#lua-scripts) within the Redis context. To take advantage of typing within these scenarios, `RedisClient` and `RedisCluster` should be used with [typeof](https://www.typescriptlang.org/docs/handbook/2/typeof-types.html), rather than the base types `RedisClientType` and `RedisClusterType`.
```typescript ```typescript
import { createClient } from '@node-redis/client'; import { createClient } from '@redis/client';
export const client = createClient(); export const client = createClient();

View File

@@ -3,24 +3,25 @@
| Property | Default | Description | | Property | Default | Description |
|--------------------------|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |--------------------------|------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| url | | `redis[s]://[[username][:password]@][host][:port][/db-number]` (see [`redis`](https://www.iana.org/assignments/uri-schemes/prov/redis) and [`rediss`](https://www.iana.org/assignments/uri-schemes/prov/rediss) IANA registration for more details) | | url | | `redis[s]://[[username][:password]@][host][:port][/db-number]` (see [`redis`](https://www.iana.org/assignments/uri-schemes/prov/redis) and [`rediss`](https://www.iana.org/assignments/uri-schemes/prov/rediss) IANA registration for more details) |
| socket | | Object defining socket connection properties. Any [`net.createConnection`](https://nodejs.org/api/net.html#netcreateconnectionoptions-connectlistener) option that is not listed here is supported as well | | socket | | Socket connection properties. Unlisted [`net.connect`](https://nodejs.org/api/net.html#socketconnectoptions-connectlistener) properties (and [`tls.connect`](https://nodejs.org/api/tls.html#tlsconnectoptions-callback)) are also supported |
| socket.port | `6379` | Port to connect to | | socket.port | `6379` | Redis server port |
| socket.host | `'localhost'` | Hostname to connect to | | socket.host | `'localhost'` | Redis server hostname |
| socket.family | `0` | Version of IP stack. Must be `4 \| 6 \| 0`. The value `0` indicates that both IPv4 and IPv6 addresses are allowed. | | socket.family | `0` | IP Stack version (one of `4 \| 6 \| 0`) |
| socket.path | | UNIX Socket to connect to | | socket.path | | Path to the UNIX Socket |
| socket.connectTimeout | `5000` | The timeout for connecting to the Redis Server (in milliseconds) | | socket.connectTimeout | `5000` | Connection Timeout (in milliseconds) |
| socket.noDelay | `true` | Enable/disable the use of [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay) | | socket.noDelay | `true` | Toggle [`Nagle's algorithm`](https://nodejs.org/api/net.html#net_socket_setnodelay_nodelay) |
| socket.keepAlive | `5000` | Enable/disable the [`keep-alive`](https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay) functionality | | socket.keepAlive | `5000` | Toggle [`keep-alive`](https://nodejs.org/api/net.html#net_socket_setkeepalive_enable_initialdelay) functionality |
| socket.tls | | See explanation and examples [below](#TLS) | | socket.tls | | See explanation and examples [below](#TLS) |
| socket.reconnectStrategy | `retries => Math.min(retries * 50, 500)` | A function containing the [Reconnect Strategy](#reconnect-strategy) logic | | socket.reconnectStrategy | `retries => Math.min(retries * 50, 500)` | A function containing the [Reconnect Strategy](#reconnect-strategy) logic |
| username | | ACL username ([see ACL guide](https://redis.io/topics/acl)) | | username | | ACL username ([see ACL guide](https://redis.io/topics/acl)) |
| password | | ACL password or the old "--requirepass" password | | password | | ACL password or the old "--requirepass" password |
| name | | Connection name ([see `CLIENT SETNAME`](https://redis.io/commands/client-setname)) | | name | | Connection name ([see `CLIENT SETNAME`](https://redis.io/commands/client-setname)) |
| database | | Database number to connect to (see [`SELECT`](https://redis.io/commands/select) command) | | database | | Redis database number (see [`SELECT`](https://redis.io/commands/select) command) |
| modules | | Object defining which [Redis Modules](../README.md#packages) to include | | modules | | Included [Redis Modules](../README.md#packages) |
| scripts | | Object defining Lua Scripts to use with this client (see [Lua Scripts](../README.md#lua-scripts)) | | scripts | | Script definitions (see [Lua Scripts](../README.md#lua-scripts)) |
| functions | | Function definitions (see [Functions](../README.md#functions)) |
| commandsQueueMaxLength | | Maximum length of the client's internal command queue | | commandsQueueMaxLength | | Maximum length of the client's internal command queue |
| disableOfflineQueue | `false` | Disables offline queuing, see the [FAQ](./FAQ.md#what-happens-when-the-network-goes-down) for details | | disableOfflineQueue | `false` | Disables offline queuing, see [FAQ](./FAQ.md#what-happens-when-the-network-goes-down) |
| readonly | `false` | Connect in [`READONLY`](https://redis.io/commands/readonly) mode | | readonly | `false` | Connect in [`READONLY`](https://redis.io/commands/readonly) mode |
| legacyMode | `false` | Maintain some backwards compatibility (see the [Migration Guide](./v3-to-v4.md)) | | legacyMode | `false` | Maintain some backwards compatibility (see the [Migration Guide](./v3-to-v4.md)) |
| isolationPoolOptions | | See the [Isolated Execution Guide](./isolated-execution.md) | | isolationPoolOptions | | See the [Isolated Execution Guide](./isolated-execution.md) |
@@ -31,12 +32,12 @@ You can implement a custom reconnect strategy as a function:
- Receives the number of retries attempted so far. - Receives the number of retries attempted so far.
- Returns `number | Error`: - Returns `number | Error`:
- `number`: the wait time in milliseconds prior attempting to reconnect. - `number`: wait time in milliseconds prior to attempting a reconnect.
- `Error`: closes the client and flushes the internal command queues. - `Error`: closes the client and flushes internal command queues.
## TLS ## TLS
When creating a client, set `socket.tls` to `true` to enable TLS. Below are some basic examples. To enable TLS, set `socket.tls` to `true`. Below are some basic examples.
> For configuration options see [tls.connect](https://nodejs.org/api/tls.html#tlsconnectoptions-callback) and [tls.createSecureContext](https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions), as those are the underlying functions used by this library. > For configuration options see [tls.connect](https://nodejs.org/api/tls.html#tlsconnectoptions-callback) and [tls.createSecureContext](https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions), as those are the underlying functions used by this library.

View File

@@ -7,25 +7,23 @@ Connecting to a cluster is a bit different. Create the client by specifying some
```typescript ```typescript
import { createCluster } from 'redis'; import { createCluster } from 'redis';
(async () => { const cluster = createCluster({
const cluster = createCluster({ rootNodes: [
rootNodes: [ {
{ url: 'redis://10.0.0.1:30001'
url: 'redis://10.0.0.1:30001' },
}, {
{ url: 'redis://10.0.0.2:30002'
url: 'redis://10.0.0.2:30002' }
} ]
] });
});
cluster.on('error', (err) => console.log('Redis Cluster Error', err)); cluster.on('error', (err) => console.log('Redis Cluster Error', err));
await cluster.connect(); await cluster.connect();
await cluster.set('key', 'value'); await cluster.set('key', 'value');
const value = await cluster.get('key'); const value = await cluster.get('key');
})();
``` ```
## `createCluster` configuration ## `createCluster` configuration
@@ -38,15 +36,15 @@ import { createCluster } from 'redis';
| defaults | | The default configuration values for every client in the cluster. Use this for example when specifying an ACL user to connect with | | defaults | | The default configuration values for every client in the cluster. Use this for example when specifying an ACL user to connect with |
| useReplicas | `false` | When `true`, distribute load by executing readonly commands (such as `GET`, `GEOSEARCH`, etc.) across all cluster nodes. When `false`, only use master nodes | | useReplicas | `false` | When `true`, distribute load by executing readonly commands (such as `GET`, `GEOSEARCH`, etc.) across all cluster nodes. When `false`, only use master nodes |
| maxCommandRedirections | `16` | The maximum number of times a command will be redirected due to `MOVED` or `ASK` errors | | maxCommandRedirections | `16` | The maximum number of times a command will be redirected due to `MOVED` or `ASK` errors |
| nodeAddressMap | | Object defining the [node address mapping](#node-address-map) | | nodeAddressMap | | Defines the [node address mapping](#node-address-map) |
| modules | | Object defining which [Redis Modules](../README.md#modules) to include | | modules | | Included [Redis Modules](../README.md#packages) |
| scripts | | Object defining Lua Scripts to use with this client (see [Lua Scripts](../README.md#lua-scripts)) | | scripts | | Script definitions (see [Lua Scripts](../README.md#lua-scripts)) |
| functions | | Function definitions (see [Functions](../README.md#functions)) |
## Node Address Map ## Node Address Map
Your cluster might be configured to work within an internal network that your local environment doesn't have access to. For example, your development machine could only have access to external addresses, but the cluster returns its internal addresses. In this scenario, it's useful to provide a map from those internal addresses to the external ones. A node address map is required when a redis cluster is configured with addresses that are inaccessible by the machine running the redis client.
This is a mapping of addresses and ports, with the values being the accessible address/port combination. Example:
The configuration for this is a simple mapping. Just provide a `nodeAddressMap` property mapping the internal addresses and ports to the external addresses and ports. Then, any address provided to `rootNodes` or returned from the cluster will be mapped accordingly:
```javascript ```javascript
createCluster({ createCluster({
@@ -68,12 +66,12 @@ createCluster({
### Commands that operate on Redis Keys ### Commands that operate on Redis Keys
Commands such as `GET`, `SET`, etc. will be routed by the first key, for instance `MGET 1 2 3` will be routed by the key `1`. Commands such as `GET`, `SET`, etc. are routed by the first key, for instance `MGET 1 2 3` will be routed by the key `1`.
### [Server Commands](https://redis.io/commands#server) ### [Server Commands](https://redis.io/commands#server)
Admin commands such as `MEMORY STATS`, `FLUSHALL`, etc. are not attached to the cluster, and should be executed on a specific node using `.getSlot()` or `.getAllMasters()`. Admin commands such as `MEMORY STATS`, `FLUSHALL`, etc. are not attached to the cluster, and must be executed on a specific node via `.getSlotMaster()`.
### "Forwarded Commands" ### "Forwarded Commands"
Some commands (e.g. `PUBLISH`) are forwarded to other cluster nodes by the Redis server. The client will send these commands to a random node in order to spread the load across the cluster. Certain commands (e.g. `PUBLISH`) are forwarded to other cluster nodes by the Redis server. This client sends these commands to a random node in order to spread the load across the cluster.

View File

@@ -2,7 +2,7 @@
// Requires the RedisTimeSeries module: https://redistimeseries.io/ // Requires the RedisTimeSeries module: https://redistimeseries.io/
import { createClient } from 'redis'; import { createClient } from 'redis';
import { TimeSeriesDuplicatePolicies, TimeSeriesEncoding, TimeSeriesAggregationType } from '@node-redis/time-series'; import { TimeSeriesDuplicatePolicies, TimeSeriesEncoding, TimeSeriesAggregationType } from '@redis/time-series';
async function timeSeries() { async function timeSeries() {
const client = createClient(); const client = createClient();
@@ -11,7 +11,7 @@ async function timeSeries() {
await client.del('mytimeseries'); await client.del('mytimeseries');
try { try {
// Create a timeseries // Create a timeseries
// https://oss.redis.com/redistimeseries/commands/#tscreate // https://oss.redis.com/redistimeseries/commands/#tscreate
const created = await client.ts.create('mytimeseries', { const created = await client.ts.create('mytimeseries', {
RETENTION: 86400000, // 1 day in milliseconds RETENTION: 86400000, // 1 day in milliseconds
@@ -97,7 +97,7 @@ async function timeSeries() {
// Get some information about the state of the timeseries. // Get some information about the state of the timeseries.
// https://oss.redis.com/redistimeseries/commands/#tsinfo // https://oss.redis.com/redistimeseries/commands/#tsinfo
const tsInfo = await client.ts.info('mytimeseries'); const tsInfo = await client.ts.info('mytimeseries');
// tsInfo looks like this: // tsInfo looks like this:
// { // {
// totalSamples: 1440, // totalSamples: 1440,

View File

@@ -8,19 +8,19 @@ import {
createCluster as _createCluster, createCluster as _createCluster,
RedisClusterOptions, RedisClusterOptions,
RedisClusterType as _RedisClusterType RedisClusterType as _RedisClusterType
} from '@node-redis/client'; } from '@redis/client';
import RedisBloomModules from '@node-redis/bloom'; import RedisBloomModules from '@redis/bloom';
import RedisGraph from '@node-redis/graph'; import RedisGraph from '@redis/graph';
import RedisJSON from '@node-redis/json'; import RedisJSON from '@redis/json';
import RediSearch from '@node-redis/search'; import RediSearch from '@redis/search';
import RedisTimeSeries from '@node-redis/time-series'; import RedisTimeSeries from '@redis/time-series';
export * from '@node-redis/client'; export * from '@redis/client';
export * from '@node-redis/bloom'; export * from '@redis/bloom';
export * from '@node-redis/graph'; export * from '@redis/graph';
export * from '@node-redis/json'; export * from '@redis/json';
export * from '@node-redis/search'; export * from '@redis/search';
export * from '@node-redis/time-series'; export * from '@redis/time-series';
const modules = { const modules = {
...RedisBloomModules, ...RedisBloomModules,

5004
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,18 +23,18 @@
"gh-pages": "gh-pages -d ./documentation -e ./documentation -u 'documentation-bot <documentation@bot>'" "gh-pages": "gh-pages -d ./documentation -e ./documentation -u 'documentation-bot <documentation@bot>'"
}, },
"dependencies": { "dependencies": {
"@node-redis/bloom": "1.0.1", "@redis/bloom": "1.0.1",
"@node-redis/client": "1.0.6", "@redis/client": "1.0.6",
"@node-redis/graph": "1.0.0", "@redis/graph": "1.0.0",
"@node-redis/json": "1.0.2", "@redis/json": "1.0.2",
"@node-redis/search": "1.0.5", "@redis/search": "1.0.5",
"@node-redis/time-series": "1.0.2" "@redis/time-series": "1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@tsconfig/node12": "^1.0.9", "@tsconfig/node14": "^1.0.1",
"gh-pages": "^3.2.3", "gh-pages": "^3.2.3",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"typescript": "^4.6.3" "typescript": "^4.6.4"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -1,4 +1,4 @@
# @node-redis/bloom # @redis/bloom
This package provides support for the [RedisBloom](https://redisbloom.io) module, which adds additional probabilistic data structures to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RediBloom commands. This package provides support for the [RedisBloom](https://redisbloom.io) module, which adds additional probabilistic data structures to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RediBloom commands.

View File

@@ -4,4 +4,4 @@ export function transformArguments(key: string, item: string): Array<string> {
return ['BF.ADD', key, item]; return ['BF.ADD', key, item];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -6,4 +6,4 @@ export function transformArguments(key: string, item: string): Array<string> {
return ['BF.EXISTS', key, item]; return ['BF.EXISTS', key, item];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,4 +1,4 @@
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;
@@ -43,4 +43,4 @@ export function transformArguments(
return args; return args;
} }
export { transformBooleanArrayReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,4 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -4,4 +4,4 @@ export function transformArguments(key: string, items: Array<string>): Array<str
return ['BF.MADD', key, ...items]; return ['BF.MADD', key, ...items];
} }
export { transformBooleanArrayReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -6,4 +6,4 @@ export function transformArguments(key: string, items: Array<string>): Array<str
return ['BF.MEXISTS', key, ...items]; return ['BF.MEXISTS', key, ...items];
} }
export { transformBooleanArrayReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -4,4 +4,4 @@ export function transformArguments(key: string, item: string): Array<string> {
return ['CF.ADD', key, item]; return ['CF.ADD', key, item];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -4,4 +4,4 @@ export function transformArguments(key: string, item: string): Array<string> {
return ['CF.ADDNX', key, item]; return ['CF.ADDNX', key, item];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -4,4 +4,4 @@ export function transformArguments(key: string, item: string): Array<string> {
return ['CF.DEL', key, item]; return ['CF.DEL', key, item];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -6,4 +6,4 @@ export function transformArguments(key: string, item: string): Array<string> {
return ['CF.EXISTS', key, item]; return ['CF.EXISTS', key, item];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { InsertOptions, pushInsertOptions } from "."; import { InsertOptions, pushInsertOptions } from ".";
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;
@@ -15,4 +15,4 @@ export function transformArguments(
); );
} }
export { transformBooleanArrayReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { InsertOptions, pushInsertOptions } from "."; import { InsertOptions, pushInsertOptions } from ".";
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;
@@ -15,4 +15,4 @@ export function transformArguments(
); );
} }
export { transformBooleanArrayReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanArrayReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,4 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -10,8 +10,8 @@ import * as INSERTNX from './INSERTNX';
import * as LOADCHUNK from './LOADCHUNK'; import * as LOADCHUNK from './LOADCHUNK';
import * as RESERVE from './RESERVE'; import * as RESERVE from './RESERVE';
import * as SCANDUMP from './SCANDUMP'; import * as SCANDUMP from './SCANDUMP';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
export default { export default {
ADD, ADD,

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import TestUtils from '@node-redis/test-utils'; import TestUtils from '@redis/test-utils';
import RedisBloomModules from '.'; import RedisBloomModules from '.';
export default new TestUtils({ export default new TestUtils({

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/bloom", "name": "@redis/bloom",
"version": "1.0.1", "version": "1.0.1",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
@@ -13,17 +13,17 @@
"documentation": "typedoc" "documentation": "typedoc"
}, },
"peerDependencies": { "peerDependencies": {
"@node-redis/client": "^1.0.0" "@redis/client": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typedoc": "^0.22.15", "typedoc": "^0.22.15",
"typescript": "^4.6.3" "typescript": "^4.6.4"
} }
} }

View File

@@ -1,3 +1,3 @@
# @node-redis/client # @redis/client
The source code and documentation for this package are in the main [node-redis](https://github.com/redis/node-redis) repo. The source code and documentation for this package are in the main [node-redis](https://github.com/redis/node-redis) repo.

View File

@@ -347,10 +347,6 @@ export default class RedisCommandsQueue {
return encoded; return encoded;
} }
rejectLastCommand(err: unknown): void {
this.#waitingForReply.pop()!.reject(err);
}
onReplyChunk(chunk: Buffer): void { onReplyChunk(chunk: Buffer): void {
this.#decoder.write(chunk); this.#decoder.write(chunk);
} }

View File

@@ -29,6 +29,7 @@ export const MATH_FUNCTION = {
library: { library: {
square: { square: {
NAME: 'square', NAME: 'square',
IS_READ_ONLY: true,
NUMBER_OF_KEYS: 0, NUMBER_OF_KEYS: 0,
transformArguments(number: number): Array<string> { transformArguments(number: number): Array<string> {
return [number.toString()]; return [number.toString()];
@@ -722,8 +723,11 @@ describe('Client', () => {
await subscriber.connect(); await subscriber.connect();
try { try {
const listener = spy(); const channelListener = spy();
await subscriber.subscribe('channel', listener); await subscriber.subscribe('channel', channelListener);
const patternListener = spy();
await subscriber.pSubscribe('channe*', patternListener);
await Promise.all([ await Promise.all([
once(subscriber, 'error'), once(subscriber, 'error'),
@@ -736,7 +740,8 @@ describe('Client', () => {
await once(subscriber, 'ready'); await once(subscriber, 'ready');
await Promise.all([ await Promise.all([
waitTillBeenCalled(listener), waitTillBeenCalled(channelListener),
waitTillBeenCalled(patternListener),
publisher.publish('channel', 'message') publisher.publish('channel', 'message')
]); ]);
} finally { } finally {

View File

@@ -399,23 +399,25 @@ export default class RedisClient<
async functionsExecuter<F extends RedisFunction>( async functionsExecuter<F extends RedisFunction>(
fn: F, fn: F,
args: Array<unknown> args: Array<unknown>,
name: string
): Promise<RedisCommandReply<F>> { ): Promise<RedisCommandReply<F>> {
const { args: redisArgs, options } = transformCommandArguments(fn, args); const { args: redisArgs, options } = transformCommandArguments(fn, args);
return transformCommandReply( return transformCommandReply(
fn, fn,
await this.executeFunction(fn, redisArgs, options), await this.executeFunction(name, fn, redisArgs, options),
redisArgs.preserve redisArgs.preserve
); );
} }
executeFunction( executeFunction(
name: string,
fn: RedisFunction, fn: RedisFunction,
args: RedisCommandArguments, args: RedisCommandArguments,
options?: ClientCommandOptions options?: ClientCommandOptions
): Promise<RedisCommandRawReply> { ): Promise<RedisCommandRawReply> {
return this.#sendCommand( return this.#sendCommand(
fCallArguments(fn, args), fCallArguments(name, fn, args),
options options
); );
} }

View File

@@ -141,8 +141,8 @@ export default class RedisClientMultiCommand {
return this; return this;
} }
functionsExecutor(fn: RedisFunction, args: Array<unknown>): this { functionsExecutor(fn: RedisFunction, args: Array<unknown>, name: string): this {
this.#multi.addFunction(fn, args); this.#multi.addFunction(name, fn, args);
return this; return this;
} }

View File

@@ -124,12 +124,14 @@ export default class RedisCluster<
async functionsExecutor<F extends RedisFunction>( async functionsExecutor<F extends RedisFunction>(
fn: F, fn: F,
args: Array<unknown> args: Array<unknown>,
name: string,
): Promise<RedisCommandReply<F>> { ): Promise<RedisCommandReply<F>> {
const { args: redisArgs, options } = transformCommandArguments(fn, args); const { args: redisArgs, options } = transformCommandArguments(fn, args);
return transformCommandReply( return transformCommandReply(
fn, fn,
await this.executeFunction( await this.executeFunction(
name,
fn, fn,
args, args,
redisArgs, redisArgs,
@@ -140,6 +142,7 @@ export default class RedisCluster<
} }
async executeFunction( async executeFunction(
name: string,
fn: RedisFunction, fn: RedisFunction,
originalArgs: Array<unknown>, originalArgs: Array<unknown>,
redisArgs: RedisCommandArguments, redisArgs: RedisCommandArguments,
@@ -148,7 +151,7 @@ export default class RedisCluster<
return this.#execute( return this.#execute(
RedisCluster.extractFirstKey(fn, originalArgs, redisArgs), RedisCluster.extractFirstKey(fn, originalArgs, redisArgs),
fn.IS_READ_ONLY, fn.IS_READ_ONLY,
client => client.executeFunction(fn, redisArgs, options) client => client.executeFunction(name, fn, redisArgs, options)
); );
} }

View File

@@ -103,8 +103,8 @@ export default class RedisClusterMultiCommand {
return this; return this;
} }
functionsExecutor(fn: RedisFunction, args: Array<unknown>): this { functionsExecutor(fn: RedisFunction, args: Array<unknown>, name: string): this {
const transformedArguments = this.#multi.addFunction(fn, args); const transformedArguments = this.#multi.addFunction(name, fn, args);
this.#firstKey ??= RedisCluster.extractFirstKey(fn, args, transformedArguments); this.#firstKey ??= RedisCluster.extractFirstKey(fn, args, transformedArguments);
return this; return this;
} }

View File

@@ -1,11 +1,11 @@
import { CommandOptions, isCommandOptions } from './command-options'; import { CommandOptions, isCommandOptions } from './command-options';
import { RedisCommand, RedisCommandArguments, RedisCommandReply, RedisFunction, RedisFunctions, RedisModules, RedisScript, RedisScripts } from './commands'; import { RedisCommand, RedisCommandArgument, RedisCommandArguments, RedisCommandReply, RedisFunction, RedisFunctions, RedisModules, RedisScript, RedisScripts } from './commands';
type Instantiable<T = any> = new (...args: Array<any>) => T; type Instantiable<T = any> = new (...args: Array<any>) => T;
type CommandsExecutor<C extends RedisCommand = RedisCommand> = type CommandsExecutor<C extends RedisCommand = RedisCommand> =
(command: C, args: Array<unknown>) => unknown; (command: C, args: Array<unknown>, name: string) => unknown;
interface AttachCommandsConfig<C extends RedisCommand> { interface AttachCommandsConfig<C extends RedisCommand> {
BaseClass: Instantiable; BaseClass: Instantiable;
@@ -20,7 +20,7 @@ export function attachCommands<C extends RedisCommand>({
}: AttachCommandsConfig<C>): void { }: AttachCommandsConfig<C>): void {
for (const [name, command] of Object.entries(commands)) { for (const [name, command] of Object.entries(commands)) {
BaseClass.prototype[name] = function (...args: Array<unknown>): unknown { BaseClass.prototype[name] = function (...args: Array<unknown>): unknown {
return executor.call(this, command, args); return executor.call(this, command, args, name);
}; };
} }
} }
@@ -95,7 +95,7 @@ function attachWithNamespaces<C extends RedisCommand>({
Commander.prototype[namespace] = {}; Commander.prototype[namespace] = {};
for (const [name, command] of Object.entries(commands)) { for (const [name, command] of Object.entries(commands)) {
Commander.prototype[namespace][name] = function (...args: Array<unknown>): unknown { Commander.prototype[namespace][name] = function (...args: Array<unknown>): unknown {
return executor.call(this.self, command, args); return executor.call(this.self, command, args, name);
}; };
} }
} }
@@ -138,10 +138,14 @@ export function transformCommandReply<C extends RedisCommand>(
return command.transformReply(rawReply, preserved); return command.transformReply(rawReply, preserved);
} }
export function fCallArguments(fn: RedisFunction, args: RedisCommandArguments): RedisCommandArguments { export function fCallArguments(
name: RedisCommandArgument,
fn: RedisFunction,
args: RedisCommandArguments
): RedisCommandArguments {
const actualArgs: RedisCommandArguments = [ const actualArgs: RedisCommandArguments = [
fn.IS_READ_ONLY ? 'FCALL_RO' : 'FCALL', fn.IS_READ_ONLY ? 'FCALL_RO' : 'FCALL',
fn.NAME name
]; ];
if (fn.NUMBER_OF_KEYS !== undefined) { if (fn.NUMBER_OF_KEYS !== undefined) {

View File

@@ -60,7 +60,6 @@ export interface RedisModules {
} }
export interface RedisFunction extends RedisCommand { export interface RedisFunction extends RedisCommand {
NAME: string;
NUMBER_OF_KEYS?: number; NUMBER_OF_KEYS?: number;
} }

View File

@@ -23,8 +23,9 @@ export default class RedisMultiCommand {
}); });
} }
addFunction(fn: RedisFunction, args: Array<unknown>): RedisCommandArguments { addFunction(name: string, fn: RedisFunction, args: Array<unknown>): RedisCommandArguments {
const transformedArguments = fCallArguments( const transformedArguments = fCallArguments(
name,
fn, fn,
fn.transformArguments(...args) fn.transformArguments(...args)
); );

View File

@@ -1,4 +1,4 @@
import TestUtils from '@node-redis/test-utils'; import TestUtils from '@redis/test-utils';
import { SinonSpy } from 'sinon'; import { SinonSpy } from 'sinon';
import { promiseTimeout } from './utils'; import { promiseTimeout } from './utils';

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/client", "name": "@redis/client",
"version": "1.0.5", "version": "1.0.5",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
@@ -20,23 +20,23 @@
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"@types/sinon": "^10.0.11", "@types/sinon": "^10.0.11",
"@types/yallist": "^4.0.1", "@types/yallist": "^4.0.1",
"@typescript-eslint/eslint-plugin": "^5.20.0", "@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.20.0", "@typescript-eslint/parser": "^5.21.0",
"eslint": "^8.14.0", "eslint": "^8.14.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"sinon": "^13.0.2", "sinon": "^13.0.2",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typedoc": "^0.22.15", "typedoc": "^0.22.15",
"typescript": "^4.6.3" "typescript": "^4.6.4"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=14"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@@ -1 +1 @@
# @node-redis/graph # @redis/graph

View File

@@ -1,4 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands/index'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands/index';
import { pushQueryArguments } from '.'; import { pushQueryArguments } from '.';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushQueryArguments } from '.'; import { pushQueryArguments } from '.';
export { FIRST_KEY_INDEX } from './QUERY'; export { FIRST_KEY_INDEX } from './QUERY';

View File

@@ -7,7 +7,7 @@ import * as PROFILE from './PROFILE';
import * as QUERY_RO from './QUERY_RO'; import * as QUERY_RO from './QUERY_RO';
import * as QUERY from './QUERY'; import * as QUERY from './QUERY';
import * as SLOWLOG from './SLOWLOG'; import * as SLOWLOG from './SLOWLOG';
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
export default { export default {
CONFIG_GET, CONFIG_GET,

View File

@@ -1,4 +1,4 @@
import TestUtils from '@node-redis/test-utils'; import TestUtils from '@redis/test-utils';
import RedisGraph from '.'; import RedisGraph from '.';
export default new TestUtils({ export default new TestUtils({

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/graph", "name": "@redis/graph",
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
@@ -13,17 +13,17 @@
"documentation": "typedoc" "documentation": "typedoc"
}, },
"peerDependencies": { "peerDependencies": {
"@node-redis/client": "^1.0.0" "@redis/client": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typedoc": "^0.22.15", "typedoc": "^0.22.15",
"typescript": "^4.6.3" "typescript": "^4.6.4"
} }
} }

View File

@@ -1,4 +1,4 @@
# @node-redis/json # @redis/json
This package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON commands. This package provides support for the [RedisJSON](https://redisjson.io) module, which adds JSON as a native data type to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisJSON commands.

View File

@@ -1,4 +1,4 @@
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import TestUtils from '@node-redis/test-utils'; import TestUtils from '@redis/test-utils';
import RedisJSON from '.'; import RedisJSON from '.';
export default new TestUtils({ export default new TestUtils({

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/json", "name": "@redis/json",
"version": "1.0.2", "version": "1.0.2",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
@@ -13,17 +13,17 @@
"documentation": "typedoc" "documentation": "typedoc"
}, },
"peerDependencies": { "peerDependencies": {
"@node-redis/client": "^1.0.0" "@redis/client": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typedoc": "^0.22.15", "typedoc": "^0.22.15",
"typescript": "^4.6.3" "typescript": "^4.6.4"
} }
} }

View File

@@ -1,4 +1,4 @@
# @node-redis/search # @redis/search
This package provides support for the [RediSearch](https://redisearch.io) module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the RedisJSON module. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RediSearch commands. This package provides support for the [RediSearch](https://redisearch.io) module, which adds indexing and querying support for data stored in Redis Hashes or as JSON documents with the RedisJSON module. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RediSearch commands.

View File

@@ -1,5 +1,5 @@
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArgument, transformTuplesReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArgument, transformTuplesReply } from '@redis/client/dist/lib/commands/generic-transformers';
import { Params, PropertyName, pushArgumentsWithLength, pushParamsArgs, pushSortByArguments, SortByProperty } from '.'; import { Params, PropertyName, pushArgumentsWithLength, pushParamsArgs, pushSortByArguments, SortByProperty } from '.';
export enum AggregateSteps { export enum AggregateSteps {

View File

@@ -1,4 +1,4 @@
import { pushOptionalVerdictArgument } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushOptionalVerdictArgument } from '@redis/client/dist/lib/commands/generic-transformers';
import { RedisSearchLanguages, PropertyName, RediSearchSchema, pushSchema } from '.'; import { RedisSearchLanguages, PropertyName, RediSearchSchema, pushSchema } from '.';
interface CreateOptions { interface CreateOptions {

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export function transformArguments(dictionary: string, term: string | Array<string>): RedisCommandArguments { export function transformArguments(dictionary: string, term: string | Array<string>): RedisCommandArguments {
return pushVerdictArguments(['FT.DICTADD', dictionary], term); return pushVerdictArguments(['FT.DICTADD', dictionary], term);

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export function transformArguments(dictionary: string, term: string | Array<string>): RedisCommandArguments { export function transformArguments(dictionary: string, term: string | Array<string>): RedisCommandArguments {
return pushVerdictArguments(['FT.DICTDEL', dictionary], term); return pushVerdictArguments(['FT.DICTDEL', dictionary], term);

View File

@@ -1,5 +1,5 @@
import { RedisCommandArgument } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument } from '@redis/client/dist/lib/commands';
import { transformTuplesReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { transformTuplesReply } from '@redis/client/dist/lib/commands/generic-transformers';
export function transformArguments(index: string): Array<string> { export function transformArguments(index: string): Array<string> {
return ['FT.INFO', index]; return ['FT.INFO', index];

View File

@@ -1,6 +1,6 @@
import { SearchOptions, SearchRawReply, transformReply as transformSearchReply } from './SEARCH'; import { SearchOptions, SearchRawReply, transformReply as transformSearchReply } from './SEARCH';
import { pushSearchOptions, ProfileOptions, ProfileRawReply, ProfileReply, transformProfile } from '.'; import { pushSearchOptions, ProfileOptions, ProfileRawReply, ProfileReply, transformProfile } from '.';
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { transformTuplesReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { transformTuplesReply } from '@redis/client/dist/lib/commands/generic-transformers';
import { pushSearchOptions, RedisSearchLanguages, Params, PropertyName, SortByProperty, SearchReply } from '.'; import { pushSearchOptions, RedisSearchLanguages, Params, PropertyName, SortByProperty, SearchReply } from '.';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -2,4 +2,4 @@ export function transformArguments(key: string, string: string): Array<string> {
return ['FT.SUGDEL', key, string]; return ['FT.SUGDEL', key, string];
} }
export { transformBooleanReply as transformReply } from '@node-redis/client/dist/lib/commands/generic-transformers'; export { transformBooleanReply as transformReply } from '@redis/client/dist/lib/commands/generic-transformers';

View File

@@ -1,5 +1,5 @@
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
interface SynUpdateOptions { interface SynUpdateOptions {
SKIPINITIALSCAN?: true; SKIPINITIALSCAN?: true;

View File

@@ -28,8 +28,8 @@ import * as SUGLEN from './SUGLEN';
import * as SYNDUMP from './SYNDUMP'; import * as SYNDUMP from './SYNDUMP';
import * as SYNUPDATE from './SYNUPDATE'; import * as SYNUPDATE from './SYNUPDATE';
import * as TAGVALS from './TAGVALS'; import * as TAGVALS from './TAGVALS';
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushOptionalVerdictArgument, pushVerdictArgument } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushOptionalVerdictArgument, pushVerdictArgument } from '@redis/client/dist/lib/commands/generic-transformers';
import { SearchOptions } from './SEARCH'; import { SearchOptions } from './SEARCH';
export default { export default {

View File

@@ -1,4 +1,4 @@
import TestUtils from '@node-redis/test-utils'; import TestUtils from '@redis/test-utils';
import RediSearch from '.'; import RediSearch from '.';
export default new TestUtils({ export default new TestUtils({

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/search", "name": "@redis/search",
"version": "1.0.5", "version": "1.0.5",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
@@ -13,17 +13,17 @@
"documentation": "typedoc" "documentation": "typedoc"
}, },
"peerDependencies": { "peerDependencies": {
"@node-redis/client": "^1.0.0" "@redis/client": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typedoc": "^0.22.15", "typedoc": "^0.22.15",
"typescript": "^4.6.3" "typescript": "^4.6.4"
} }
} }

View File

@@ -1,8 +1,8 @@
import { createConnection } from 'net'; import { createConnection } from 'net';
import { once } from 'events'; import { once } from 'events';
import { RedisModules, RedisFunctions, RedisScripts } from '@node-redis/client/lib/commands'; import { RedisModules, RedisFunctions, RedisScripts } from '@redis/client/lib/commands';
import RedisClient, { RedisClientType } from '@node-redis/client/lib/client'; import RedisClient, { RedisClientType } from '@redis/client/lib/client';
import { promiseTimeout } from '@node-redis/client/lib/utils'; import { promiseTimeout } from '@redis/client/lib/utils';
import * as path from 'path'; import * as path from 'path';
import { promisify } from 'util'; import { promisify } from 'util';
import { exec } from 'child_process'; import { exec } from 'child_process';

View File

@@ -1,6 +1,6 @@
import { RedisModules, RedisFunctions, RedisScripts } from '@node-redis/client/lib/commands'; import { RedisModules, RedisFunctions, RedisScripts } from '@redis/client/lib/commands';
import RedisClient, { RedisClientOptions, RedisClientType } from '@node-redis/client/lib/client'; import RedisClient, { RedisClientOptions, RedisClientType } from '@redis/client/lib/client';
import RedisCluster, { RedisClusterOptions, RedisClusterType } from '@node-redis/client/lib/cluster'; import RedisCluster, { RedisClusterOptions, RedisClusterType } from '@redis/client/lib/cluster';
import { RedisServerDockerConfig, spawnRedisServer, spawnRedisCluster } from './dockers'; import { RedisServerDockerConfig, spawnRedisServer, spawnRedisCluster } from './dockers';
import yargs from 'yargs'; import yargs from 'yargs';
import { hideBin } from 'yargs/helpers'; import { hideBin } from 'yargs/helpers';

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/test-utils", "name": "@redis/test-utils",
"private": true, "private": true,
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -7,18 +7,18 @@
"build": "tsc" "build": "tsc"
}, },
"peerDependencies": { "peerDependencies": {
"@node-redis/client": "^1.0.0" "@redis/client": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/mocha": "^9.1.1", "@types/mocha": "^9.1.1",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"@types/yargs": "^17.0.10", "@types/yargs": "^17.0.10",
"mocha": "^9.2.2", "mocha": "^10.0.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typescript": "^4.6.3", "typescript": "^4.6.4",
"yargs": "^17.4.1" "yargs": "^17.4.1"
} }
} }

View File

@@ -1,4 +1,4 @@
# @node-redis/time-series # @redis/time-series
This package provides support for the [RedisTimeSeries](https://redistimeseries.io) module, which adds a time series data structure to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisTimeSeries commands. This package provides support for the [RedisTimeSeries](https://redistimeseries.io) module, which adds a time series data structure to Redis. It extends the [Node Redis client](https://github.com/redis/node-redis) to include functions for each of the RedisTimeSeries commands.

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { IncrDecrOptions, transformIncrDecrArguments } from '.'; import { IncrDecrOptions, transformIncrDecrArguments } from '.';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { Timestamp, transformTimestampArgument } from '.'; import { Timestamp, transformTimestampArgument } from '.';
export const FIRTS_KEY_INDEX = 1; export const FIRTS_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { IncrDecrOptions, transformIncrDecrArguments } from '.'; import { IncrDecrOptions, transformIncrDecrArguments } from '.';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { Filter, pushFilterArgument, RawLabels, SampleRawReply, SampleReply, transformSampleReply } from '.'; import { Filter, pushFilterArgument, RawLabels, SampleRawReply, SampleReply, transformSampleReply } from '.';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { MRangeOptions, Timestamp, pushMRangeArguments, Filter } from '.'; import { MRangeOptions, Timestamp, pushMRangeArguments, Filter } from '.';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { Timestamp, MRangeWithLabelsOptions, pushMRangeWithLabelsArguments } from '.'; import { Timestamp, MRangeWithLabelsOptions, pushMRangeWithLabelsArguments } from '.';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { MRangeOptions, Timestamp, pushMRangeArguments, Filter } from '.'; import { MRangeOptions, Timestamp, pushMRangeArguments, Filter } from '.';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { Timestamp, MRangeWithLabelsOptions, pushMRangeWithLabelsArguments, Filter } from '.'; import { Timestamp, MRangeWithLabelsOptions, pushMRangeWithLabelsArguments, Filter } from '.';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,5 +1,5 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
import { Filter } from '.'; import { Filter } from '.';
export const IS_READ_ONLY = true; export const IS_READ_ONLY = true;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { RangeOptions, Timestamp, pushRangeArguments, SampleRawReply, SampleReply, transformRangeReply } from '.'; import { RangeOptions, Timestamp, pushRangeArguments, SampleRawReply, SampleReply, transformRangeReply } from '.';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { RangeOptions, Timestamp, pushRangeArguments, SampleRawReply, SampleReply, transformRangeReply } from '.'; import { RangeOptions, Timestamp, pushRangeArguments, SampleRawReply, SampleReply, transformRangeReply } from '.';
export const FIRST_KEY_INDEX = 1; export const FIRST_KEY_INDEX = 1;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { strict as assert } from 'assert'; import { strict as assert } from 'assert';
import { import {
transformTimestampArgument, transformTimestampArgument,

View File

@@ -19,8 +19,8 @@ import * as MRANGE from './MRANGE';
import * as MRANGE_WITHLABELS from './MRANGE_WITHLABELS'; import * as MRANGE_WITHLABELS from './MRANGE_WITHLABELS';
import * as MREVRANGE from './MREVRANGE'; import * as MREVRANGE from './MREVRANGE';
import * as MREVRANGE_WITHLABELS from './MREVRANGE_WITHLABELS'; import * as MREVRANGE_WITHLABELS from './MREVRANGE_WITHLABELS';
import { RedisCommandArguments } from '@node-redis/client/dist/lib/commands'; import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArguments } from '@node-redis/client/dist/lib/commands/generic-transformers'; import { pushVerdictArguments } from '@redis/client/dist/lib/commands/generic-transformers';
export default { export default {
ADD, ADD,

View File

@@ -1,4 +1,4 @@
import TestUtils from '@node-redis/test-utils'; import TestUtils from '@redis/test-utils';
import TimeSeries from '.'; import TimeSeries from '.';
export default new TestUtils({ export default new TestUtils({

View File

@@ -1,5 +1,5 @@
{ {
"name": "@node-redis/time-series", "name": "@redis/time-series",
"version": "1.0.2", "version": "1.0.2",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
@@ -13,17 +13,17 @@
"documentation": "typedoc" "documentation": "typedoc"
}, },
"peerDependencies": { "peerDependencies": {
"@node-redis/client": "^1.0.0" "@redis/client": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2", "@istanbuljs/nyc-config-typescript": "^1.0.2",
"@node-redis/test-utils": "*", "@redis/test-utils": "*",
"@types/node": "^17.0.26", "@types/node": "^17.0.31",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"release-it": "^14.14.2", "release-it": "^15.0.0",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.7.0", "ts-node": "^10.7.0",
"typedoc": "^0.22.15", "typedoc": "^0.22.15",
"typescript": "^4.6.3" "typescript": "^4.6.4"
} }
} }

View File

@@ -1,5 +1,5 @@
{ {
"extends": "@tsconfig/node12/tsconfig.json", "extends": "@tsconfig/node14/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"declaration": true, "declaration": true,
"allowJs": true, "allowJs": true,