You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Graph (#1887)
* init * implement graph commands * add graph to packages table * fix ts.infoDebug * fix redisearch tests * Update INFO_DEBUG.ts * fix INFO.spec.ts * test QUERY and SLOWLOG Co-authored-by: Avital-Fine <avital.fine@redis.com>
This commit is contained in:
@@ -11,11 +11,12 @@ node-redis is a modern, high performance [Redis](https://redis.io) client for No
|
|||||||
|
|
||||||
## Packages
|
## Packages
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|---------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| [redis](./) | [](https://www.npmjs.com/package/redis) [](https://www.npmjs.com/package/redis) |
|
| [redis](./) | [](https://www.npmjs.com/package/redis) [](https://www.npmjs.com/package/redis) |
|
||||||
| [@node-redis/client](./packages/client) | [](https://www.npmjs.com/package/@node-redis/client) [](https://www.npmjs.com/package/@node-redis/client) [](https://redis.js.org/documentation/client/) |
|
| [@node-redis/client](./packages/client) | [](https://www.npmjs.com/package/@node-redis/client) [](https://www.npmjs.com/package/@node-redis/client) [](https://redis.js.org/documentation/client/) |
|
||||||
| [@node-redis/bloom](./packages/bloom) | [](https://www.npmjs.com/package/@node-redis/bloom) [](https://www.npmjs.com/package/@node-redis/bloom) [](https://redis.js.org/documentation/bloom/) [Redis Bloom](https://oss.redis.com/redisbloom/) commands |
|
| [@node-redis/bloom](./packages/bloom) | [](https://www.npmjs.com/package/@node-redis/bloom) [](https://www.npmjs.com/package/@node-redis/bloom) [](https://redis.js.org/documentation/bloom/) [Redis Bloom](https://oss.redis.com/redisbloom/) commands |
|
||||||
|
| [@node-redis/graph](./packages/graph) | [](https://www.npmjs.com/package/@node-redis/graph) [](https://www.npmjs.com/package/@node-redis/graph) [](https://redis.js.org/documentation/graph/) [Redis Graph](https://oss.redis.com/redisgraph/) commands |
|
||||||
| [@node-redis/json](./packages/json) | [](https://www.npmjs.com/package/@node-redis/json) [](https://www.npmjs.com/package/@node-redis/json) [](https://redis.js.org/documentation/json/) [Redis JSON](https://oss.redis.com/redisjson/) commands |
|
| [@node-redis/json](./packages/json) | [](https://www.npmjs.com/package/@node-redis/json) [](https://www.npmjs.com/package/@node-redis/json) [](https://redis.js.org/documentation/json/) [Redis JSON](https://oss.redis.com/redisjson/) commands |
|
||||||
| [@node-redis/search](./packages/search) | [](https://www.npmjs.com/package/@node-redis/search) [](https://www.npmjs.com/package/@node-redis/search) [](https://redis.js.org/documentation/search/) [Redis Search](https://oss.redis.com/redisearch/) commands |
|
| [@node-redis/search](./packages/search) | [](https://www.npmjs.com/package/@node-redis/search) [](https://www.npmjs.com/package/@node-redis/search) [](https://redis.js.org/documentation/search/) [Redis Search](https://oss.redis.com/redisearch/) commands |
|
||||||
| [@node-redis/time-series](./packages/time-series) | [](https://www.npmjs.com/package/@node-redis/time-series) [](https://www.npmjs.com/package/@node-redis/time-series) [](https://redis.js.org/documentation/time-series/) [Redis Time-Series](https://oss.redis.com/redistimeseries/) commands |
|
| [@node-redis/time-series](./packages/time-series) | [](https://www.npmjs.com/package/@node-redis/time-series) [](https://www.npmjs.com/package/@node-redis/time-series) [](https://redis.js.org/documentation/time-series/) [Redis Time-Series](https://oss.redis.com/redistimeseries/) commands |
|
||||||
|
3
index.ts
3
index.ts
@@ -1,18 +1,21 @@
|
|||||||
import { createClient as _createClient, createCluster as _createCluster, RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType } from '@node-redis/client';
|
import { createClient as _createClient, createCluster as _createCluster, RedisClientOptions, RedisClientType, RedisClusterOptions, RedisClusterType } from '@node-redis/client';
|
||||||
import { RedisScripts } from '@node-redis/client/dist/lib/commands';
|
import { RedisScripts } from '@node-redis/client/dist/lib/commands';
|
||||||
import RedisBloomModules from '@node-redis/bloom';
|
import RedisBloomModules from '@node-redis/bloom';
|
||||||
|
import RedisGraph from '@node-redis/graph';
|
||||||
import RedisJSON from '@node-redis/json';
|
import RedisJSON from '@node-redis/json';
|
||||||
import RediSearch from '@node-redis/search';
|
import RediSearch from '@node-redis/search';
|
||||||
import RedisTimeSeries from '@node-redis/time-series';
|
import RedisTimeSeries from '@node-redis/time-series';
|
||||||
|
|
||||||
export * from '@node-redis/client';
|
export * from '@node-redis/client';
|
||||||
export * from '@node-redis/bloom';
|
export * from '@node-redis/bloom';
|
||||||
|
export * from '@node-redis/graph';
|
||||||
export * from '@node-redis/json';
|
export * from '@node-redis/json';
|
||||||
export * from '@node-redis/search';
|
export * from '@node-redis/search';
|
||||||
export * from '@node-redis/time-series';
|
export * from '@node-redis/time-series';
|
||||||
|
|
||||||
const modules = {
|
const modules = {
|
||||||
...RedisBloomModules,
|
...RedisBloomModules,
|
||||||
|
graph: RedisGraph,
|
||||||
json: RedisJSON,
|
json: RedisJSON,
|
||||||
ft: RediSearch,
|
ft: RediSearch,
|
||||||
ts: RedisTimeSeries
|
ts: RedisTimeSeries
|
||||||
|
73
package-lock.json
generated
73
package-lock.json
generated
@@ -570,6 +570,10 @@
|
|||||||
"resolved": "packages/client",
|
"resolved": "packages/client",
|
||||||
"link": true
|
"link": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@node-redis/graph": {
|
||||||
|
"resolved": "packages/graph",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/@node-redis/json": {
|
"node_modules/@node-redis/json": {
|
||||||
"resolved": "packages/json",
|
"resolved": "packages/json",
|
||||||
"link": true
|
"link": true
|
||||||
@@ -876,9 +880,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "17.0.10",
|
"version": "17.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz",
|
||||||
"integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==",
|
"integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/parse-json": {
|
"node_modules/@types/parse-json": {
|
||||||
@@ -6434,7 +6438,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -6459,7 +6463,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"@types/redis-parser": "^3.0.0",
|
"@types/redis-parser": "^3.0.0",
|
||||||
"@types/sinon": "^10.0.8",
|
"@types/sinon": "^10.0.8",
|
||||||
"@types/yallist": "^4.0.1",
|
"@types/yallist": "^4.0.1",
|
||||||
@@ -6478,6 +6482,25 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"packages/graph": {
|
||||||
|
"name": "@node-redis/graph",
|
||||||
|
"version": "1.0.0-rc",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
|
"@node-redis/test-utils": "*",
|
||||||
|
"@types/node": "^17.0.12",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
|
"release-it": "^14.12.4",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"typedoc": "^0.22.11",
|
||||||
|
"typescript": "^4.5.5"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@node-redis/client": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"packages/json": {
|
"packages/json": {
|
||||||
"name": "@node-redis/json",
|
"name": "@node-redis/json",
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -6485,7 +6508,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -6504,7 +6527,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -6521,7 +6544,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@types/mocha": "^9.1.0",
|
"@types/mocha": "^9.1.0",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"@types/yargs": "^17.0.8",
|
"@types/yargs": "^17.0.8",
|
||||||
"mocha": "^9.2.0",
|
"mocha": "^9.2.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
@@ -6541,7 +6564,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -6971,7 +6994,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -6985,7 +7008,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"@types/redis-parser": "^3.0.0",
|
"@types/redis-parser": "^3.0.0",
|
||||||
"@types/sinon": "^10.0.8",
|
"@types/sinon": "^10.0.8",
|
||||||
"@types/yallist": "^4.0.1",
|
"@types/yallist": "^4.0.1",
|
||||||
@@ -7005,12 +7028,26 @@
|
|||||||
"yallist": "4.0.0"
|
"yallist": "4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@node-redis/graph": {
|
||||||
|
"version": "file:packages/graph",
|
||||||
|
"requires": {
|
||||||
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
|
"@node-redis/test-utils": "*",
|
||||||
|
"@types/node": "^17.0.12",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
|
"release-it": "^14.12.4",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"typedoc": "^0.22.11",
|
||||||
|
"typescript": "^4.5.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@node-redis/json": {
|
"@node-redis/json": {
|
||||||
"version": "file:packages/json",
|
"version": "file:packages/json",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -7024,7 +7061,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -7038,7 +7075,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@types/mocha": "^9.1.0",
|
"@types/mocha": "^9.1.0",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"@types/yargs": "^17.0.8",
|
"@types/yargs": "^17.0.8",
|
||||||
"mocha": "^9.2.0",
|
"mocha": "^9.2.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
@@ -7053,7 +7090,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.12",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
@@ -7326,9 +7363,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "17.0.10",
|
"version": "17.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz",
|
||||||
"integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==",
|
"integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.13",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
|
@@ -6,6 +6,10 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"./lib/**/*.ts"
|
"./lib/**/*.ts"
|
||||||
],
|
],
|
||||||
|
"exclude": [
|
||||||
|
"./lib/test-utils.ts",
|
||||||
|
"./lib/**/*.spec.ts"
|
||||||
|
],
|
||||||
"typedocOptions": {
|
"typedocOptions": {
|
||||||
"entryPoints": [
|
"entryPoints": [
|
||||||
"./lib"
|
"./lib"
|
||||||
|
@@ -22,9 +22,9 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.13",
|
||||||
"@types/redis-parser": "^3.0.0",
|
"@types/redis-parser": "^3.0.0",
|
||||||
"@types/sinon": "^10.0.8",
|
"@types/sinon": "^10.0.9",
|
||||||
"@types/yallist": "^4.0.1",
|
"@types/yallist": "^4.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
"@typescript-eslint/eslint-plugin": "^5.10.1",
|
||||||
"@typescript-eslint/parser": "^5.10.1",
|
"@typescript-eslint/parser": "^5.10.1",
|
||||||
|
4
packages/graph/.nycrc.json
Normal file
4
packages/graph/.nycrc.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "@istanbuljs/nyc-config-typescript",
|
||||||
|
"exclude": ["**/*.spec.ts", "lib/test-utils.ts"]
|
||||||
|
}
|
10
packages/graph/.release-it.json
Normal file
10
packages/graph/.release-it.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"git": {
|
||||||
|
"tagName": "graph@${version}",
|
||||||
|
"commitMessage": "Release ${tagName}",
|
||||||
|
"tagAnnotation": "Release ${tagName}"
|
||||||
|
},
|
||||||
|
"npm": {
|
||||||
|
"publishArgs": ["--access", "public"]
|
||||||
|
}
|
||||||
|
}
|
1
packages/graph/README.md
Normal file
1
packages/graph/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# @node-redis/graph
|
22
packages/graph/lib/commands/CONFIG_GET.spec.ts
Normal file
22
packages/graph/lib/commands/CONFIG_GET.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './CONFIG_GET';
|
||||||
|
|
||||||
|
describe('CONFIG GET', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('TIMEOUT'),
|
||||||
|
['GRAPH.CONFIG', 'GET', 'TIMEOUT']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.configGet', async client => {
|
||||||
|
assert.deepEqual(
|
||||||
|
await client.graph.configGet('TIMEOUT'),
|
||||||
|
[
|
||||||
|
'TIMEOUT',
|
||||||
|
0
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
12
packages/graph/lib/commands/CONFIG_GET.ts
Normal file
12
packages/graph/lib/commands/CONFIG_GET.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(configKey: string): Array<string> {
|
||||||
|
return ['GRAPH.CONFIG', 'GET', configKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConfigItem = [
|
||||||
|
configKey: string,
|
||||||
|
value: number
|
||||||
|
];
|
||||||
|
|
||||||
|
export declare function transformReply(): ConfigItem | Array<ConfigItem>;
|
19
packages/graph/lib/commands/CONFIG_SET.spec.ts
Normal file
19
packages/graph/lib/commands/CONFIG_SET.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './CONFIG_SET';
|
||||||
|
|
||||||
|
describe('CONFIG SET', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('TIMEOUT', 0),
|
||||||
|
['GRAPH.CONFIG', 'SET', 'TIMEOUT', '0']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.configSet', async client => {
|
||||||
|
assert.equal(
|
||||||
|
await client.graph.configSet('TIMEOUT', 0),
|
||||||
|
'OK'
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
10
packages/graph/lib/commands/CONFIG_SET.ts
Normal file
10
packages/graph/lib/commands/CONFIG_SET.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
export function transformArguments(configKey: string, value: number): Array<string> {
|
||||||
|
return [
|
||||||
|
'GRAPH.CONFIG',
|
||||||
|
'SET',
|
||||||
|
configKey,
|
||||||
|
value.toString()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): 'OK';
|
21
packages/graph/lib/commands/DELETE.spec.ts
Normal file
21
packages/graph/lib/commands/DELETE.spec.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './DELETE';
|
||||||
|
|
||||||
|
describe('', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key'),
|
||||||
|
['GRAPH.DELETE', 'key']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.delete', async client => {
|
||||||
|
await client.graph.query('key', 'RETURN 1');
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
typeof await client.graph.delete('key'),
|
||||||
|
'string'
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
7
packages/graph/lib/commands/DELETE.ts
Normal file
7
packages/graph/lib/commands/DELETE.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export function transformArguments(key: string): Array<string> {
|
||||||
|
return ['GRAPH.DELETE', key];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): string;
|
18
packages/graph/lib/commands/EXPLAIN.spec.ts
Normal file
18
packages/graph/lib/commands/EXPLAIN.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './EXPLAIN';
|
||||||
|
|
||||||
|
describe('EXPLAIN', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key', 'RETURN 0'),
|
||||||
|
['GRAPH.EXPLAIN', 'key', 'RETURN 0']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.explain', async client => {
|
||||||
|
const reply = await client.graph.explain('key', 'RETURN 0');
|
||||||
|
assert.ok(Array.isArray(reply));
|
||||||
|
assert.ok(!reply.find(x => typeof x !== 'string'));
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
9
packages/graph/lib/commands/EXPLAIN.ts
Normal file
9
packages/graph/lib/commands/EXPLAIN.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(key: string, query: string): Array<string> {
|
||||||
|
return ['GRAPH.EXPLAIN', key, query];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transfromReply(): Array<string>;
|
19
packages/graph/lib/commands/LIST.spec.ts
Normal file
19
packages/graph/lib/commands/LIST.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './LIST';
|
||||||
|
|
||||||
|
describe('LIST', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments(),
|
||||||
|
['GRAPH.LIST']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.list', async client => {
|
||||||
|
assert.deepEqual(
|
||||||
|
await client.graph.list(),
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
7
packages/graph/lib/commands/LIST.ts
Normal file
7
packages/graph/lib/commands/LIST.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(): Array<string> {
|
||||||
|
return ['GRAPH.LIST'];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transformReply(): Array<string>;
|
18
packages/graph/lib/commands/PROFILE.spec.ts
Normal file
18
packages/graph/lib/commands/PROFILE.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './PROFILE';
|
||||||
|
|
||||||
|
describe('PROFILE', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key', 'RETURN 0'),
|
||||||
|
['GRAPH.PROFILE', 'key', 'RETURN 0']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.profile', async client => {
|
||||||
|
const reply = await client.graph.profile('key', 'RETURN 0');
|
||||||
|
assert.ok(Array.isArray(reply));
|
||||||
|
assert.ok(!reply.find(x => typeof x !== 'string'));
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
9
packages/graph/lib/commands/PROFILE.ts
Normal file
9
packages/graph/lib/commands/PROFILE.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(key: string, query: string): Array<string> {
|
||||||
|
return ['GRAPH.PROFILE', key, query];
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare function transfromReply(): Array<string>;
|
22
packages/graph/lib/commands/QUERY.spec.ts
Normal file
22
packages/graph/lib/commands/QUERY.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './QUERY';
|
||||||
|
|
||||||
|
describe('QUERY', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key', '*', 100),
|
||||||
|
['GRAPH.QUERY', 'key', '*', '100']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.query', async client => {
|
||||||
|
await client.graph.query('key',
|
||||||
|
"CREATE (r:human {name:'roi', age:34}), (a:human {name:'amit', age:32}), (r)-[:knows]->(a)"
|
||||||
|
);
|
||||||
|
const reply = await client.graph.query('key',
|
||||||
|
"MATCH (r:human)-[:knows]->(a:human) RETURN r.age, r.name"
|
||||||
|
);
|
||||||
|
assert.equal(reply.data.length, 1);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
43
packages/graph/lib/commands/QUERY.ts
Normal file
43
packages/graph/lib/commands/QUERY.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands/index';
|
||||||
|
import { pushQueryArguments } from '.';
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export function transformArguments(
|
||||||
|
graph: RedisCommandArgument,
|
||||||
|
query: RedisCommandArgument,
|
||||||
|
timeout?: number
|
||||||
|
): RedisCommandArguments {
|
||||||
|
return pushQueryArguments(
|
||||||
|
['GRAPH.QUERY'],
|
||||||
|
graph,
|
||||||
|
query,
|
||||||
|
timeout
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
type Headers = Array<string>;
|
||||||
|
|
||||||
|
type Data = Array<Array<string | number | null>>;
|
||||||
|
|
||||||
|
type Metadata = Array<string>;
|
||||||
|
|
||||||
|
type QueryRawReply = [
|
||||||
|
headers: Headers,
|
||||||
|
data: Data,
|
||||||
|
metadata: Metadata
|
||||||
|
];
|
||||||
|
|
||||||
|
interface QueryReply {
|
||||||
|
headers: Headers,
|
||||||
|
data: Data,
|
||||||
|
metadata: Metadata
|
||||||
|
};
|
||||||
|
|
||||||
|
export function transformReply(reply: QueryRawReply): QueryReply {
|
||||||
|
return {
|
||||||
|
headers: reply[0],
|
||||||
|
data: reply[1],
|
||||||
|
metadata: reply[2]
|
||||||
|
};
|
||||||
|
}
|
22
packages/graph/lib/commands/QUERY_RO.spec.ts
Normal file
22
packages/graph/lib/commands/QUERY_RO.spec.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './QUERY_RO';
|
||||||
|
|
||||||
|
describe('QUERY_RO', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key', '*', 100),
|
||||||
|
['GRAPH.RO_QUERY', 'key', '*', '100']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.queryRo', async client => {
|
||||||
|
await client.graph.query('key',
|
||||||
|
"CREATE (r:human {name:'roi', age:34}), (a:human {name:'amit', age:32}), (r)-[:knows]->(a)"
|
||||||
|
);
|
||||||
|
const reply = await client.graph.queryRo('key',
|
||||||
|
"MATCH (r:human)-[:knows]->(a:human) RETURN r.age, r.name"
|
||||||
|
);
|
||||||
|
assert.equal(reply.data.length, 1);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
21
packages/graph/lib/commands/QUERY_RO.ts
Normal file
21
packages/graph/lib/commands/QUERY_RO.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
|
import { pushQueryArguments } from '.';
|
||||||
|
|
||||||
|
export { FIRST_KEY_INDEX } from './QUERY';
|
||||||
|
|
||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export function transformArguments(
|
||||||
|
graph: RedisCommandArgument,
|
||||||
|
query: RedisCommandArgument,
|
||||||
|
timeout?: number
|
||||||
|
): RedisCommandArguments {
|
||||||
|
return pushQueryArguments(
|
||||||
|
['GRAPH.RO_QUERY'],
|
||||||
|
graph,
|
||||||
|
query,
|
||||||
|
timeout
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { transformReply } from './QUERY';
|
18
packages/graph/lib/commands/SLOWLOG.spec.ts
Normal file
18
packages/graph/lib/commands/SLOWLOG.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { strict as assert } from 'assert';
|
||||||
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
|
import { transformArguments } from './SLOWLOG';
|
||||||
|
|
||||||
|
describe('SLOWLOG', () => {
|
||||||
|
it('transformArguments', () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
transformArguments('key'),
|
||||||
|
['GRAPH.SLOWLOG', 'key']
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testUtils.testWithClient('client.graph.slowLog', async client => {
|
||||||
|
await client.graph.query('key', 'RETURN 1');
|
||||||
|
const reply = await client.graph.slowLog('key');
|
||||||
|
assert.equal(reply.length, 1);
|
||||||
|
}, GLOBAL.SERVERS.OPEN);
|
||||||
|
});
|
30
packages/graph/lib/commands/SLOWLOG.ts
Normal file
30
packages/graph/lib/commands/SLOWLOG.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
export const IS_READ_ONLY = true;
|
||||||
|
|
||||||
|
export const FIRST_KEY_INDEX = 1;
|
||||||
|
|
||||||
|
export function transformArguments(key: string) {
|
||||||
|
return ['GRAPH.SLOWLOG', key];
|
||||||
|
}
|
||||||
|
|
||||||
|
type SlowLogRawReply = Array<[
|
||||||
|
timestamp: string,
|
||||||
|
command: string,
|
||||||
|
query: string,
|
||||||
|
took: string
|
||||||
|
]>;
|
||||||
|
|
||||||
|
type SlowLogReply = Array<{
|
||||||
|
timestamp: Date;
|
||||||
|
command: string;
|
||||||
|
query: string;
|
||||||
|
took: number;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export function transformReply(logs: SlowLogRawReply): SlowLogReply {
|
||||||
|
return logs.map(([timestamp, command, query, took]) => ({
|
||||||
|
timestamp: new Date(Number(timestamp) * 1000),
|
||||||
|
command,
|
||||||
|
query,
|
||||||
|
took: Number(took)
|
||||||
|
}));
|
||||||
|
}
|
49
packages/graph/lib/commands/index.ts
Normal file
49
packages/graph/lib/commands/index.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import * as CONFIG_GET from './CONFIG_GET';
|
||||||
|
import * as CONFIG_SET from './CONFIG_SET';;
|
||||||
|
import * as DELETE from './DELETE';
|
||||||
|
import * as EXPLAIN from './EXPLAIN';
|
||||||
|
import * as LIST from './LIST';
|
||||||
|
import * as PROFILE from './PROFILE';
|
||||||
|
import * as QUERY_RO from './QUERY_RO';
|
||||||
|
import * as QUERY from './QUERY';
|
||||||
|
import * as SLOWLOG from './SLOWLOG';
|
||||||
|
import { RedisCommandArgument, RedisCommandArguments } from '@node-redis/client/dist/lib/commands';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
CONFIG_GET,
|
||||||
|
configGet: CONFIG_GET,
|
||||||
|
CONFIG_SET,
|
||||||
|
configSet: CONFIG_SET,
|
||||||
|
DELETE,
|
||||||
|
delete: DELETE,
|
||||||
|
EXPLAIN,
|
||||||
|
explain: EXPLAIN,
|
||||||
|
LIST,
|
||||||
|
list: LIST,
|
||||||
|
PROFILE,
|
||||||
|
profile: PROFILE,
|
||||||
|
QUERY_RO,
|
||||||
|
queryRo: QUERY_RO,
|
||||||
|
QUERY,
|
||||||
|
query: QUERY,
|
||||||
|
SLOWLOG,
|
||||||
|
slowLog: SLOWLOG
|
||||||
|
};
|
||||||
|
|
||||||
|
export function pushQueryArguments(
|
||||||
|
args: RedisCommandArguments,
|
||||||
|
graph: RedisCommandArgument,
|
||||||
|
query: RedisCommandArgument,
|
||||||
|
timeout?: number
|
||||||
|
): RedisCommandArguments {
|
||||||
|
args.push(
|
||||||
|
graph,
|
||||||
|
query
|
||||||
|
);
|
||||||
|
|
||||||
|
if (timeout !== undefined) {
|
||||||
|
args.push(timeout.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
1
packages/graph/lib/index.ts
Normal file
1
packages/graph/lib/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default } from './commands';
|
21
packages/graph/lib/test-utils.ts
Normal file
21
packages/graph/lib/test-utils.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import TestUtils from '@node-redis/test-utils';
|
||||||
|
import RedisGraph from '.';
|
||||||
|
|
||||||
|
export default new TestUtils({
|
||||||
|
dockerImageName: 'redislabs/redisgraph',
|
||||||
|
dockerImageVersionArgument: 'redisgraph-version',
|
||||||
|
defaultDockerVersion: '2.8.7'
|
||||||
|
});
|
||||||
|
|
||||||
|
export const GLOBAL = {
|
||||||
|
SERVERS: {
|
||||||
|
OPEN: {
|
||||||
|
serverArguments: ['--loadmodule /usr/lib/redis/modules/redisgraph.so'],
|
||||||
|
clientOptions: {
|
||||||
|
modules: {
|
||||||
|
graph: RedisGraph
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
29
packages/graph/package.json
Normal file
29
packages/graph/package.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "@node-redis/graph",
|
||||||
|
"version": "1.0.0-rc",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"dist/"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"test": "nyc -r text-summary -r lcov mocha -r source-map-support/register -r ts-node/register './lib/**/*.spec.ts'",
|
||||||
|
"build": "tsc",
|
||||||
|
"documentation": "typedoc"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@node-redis/client": "^1.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
|
"@node-redis/test-utils": "*",
|
||||||
|
"@types/node": "^17.0.13",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
|
"release-it": "^14.12.4",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"typedoc": "^0.22.11",
|
||||||
|
"typescript": "^4.5.5"
|
||||||
|
}
|
||||||
|
}
|
20
packages/graph/tsconfig.json
Normal file
20
packages/graph/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./dist"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./lib/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"./lib/test-utils.ts",
|
||||||
|
"./lib/**/*.spec.ts"
|
||||||
|
],
|
||||||
|
"typedocOptions": {
|
||||||
|
"entryPoints": [
|
||||||
|
"./lib"
|
||||||
|
],
|
||||||
|
"entryPointStrategy": "expand",
|
||||||
|
"out": "../../documentation/graph"
|
||||||
|
}
|
||||||
|
}
|
@@ -4,7 +4,7 @@ import RedisJSON from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/rejson',
|
dockerImageName: 'redislabs/rejson',
|
||||||
dockerImageVersionArgument: 'rejson-version',
|
dockerImageVersionArgument: 'rejson-version',
|
||||||
defaultDockerVersion: '2.0.2'
|
defaultDockerVersion: '2.0.6'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.13",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
|
@@ -340,7 +340,7 @@ describe('CREATE', () => {
|
|||||||
testUtils.testWithClient('client.ft.create', async client => {
|
testUtils.testWithClient('client.ft.create', async client => {
|
||||||
assert.equal(
|
assert.equal(
|
||||||
await client.ft.create('index', {
|
await client.ft.create('index', {
|
||||||
field: SchemaFieldTypes.TEXT // TODO: shouldn't be mandatory
|
field: SchemaFieldTypes.TEXT
|
||||||
}),
|
}),
|
||||||
'OK'
|
'OK'
|
||||||
);
|
);
|
||||||
|
@@ -22,7 +22,7 @@ describe('DROPINDEX', () => {
|
|||||||
|
|
||||||
testUtils.testWithClient('client.ft.dropIndex', async client => {
|
testUtils.testWithClient('client.ft.dropIndex', async client => {
|
||||||
await client.ft.create('index', {
|
await client.ft.create('index', {
|
||||||
field: SchemaFieldTypes.TEXT // TODO: shouldn't be mandatory
|
field: SchemaFieldTypes.TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
|
import { SchemaFieldTypes } from '.';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './INFO';
|
import { transformArguments } from './INFO';
|
||||||
|
|
||||||
@@ -11,8 +12,8 @@ describe('INFO', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.ft.info', async client => {
|
testUtils.testWithClient('client.ft.info', async client => {
|
||||||
await client.ft.create('index', {}, {
|
await client.ft.create('index', {
|
||||||
ON: 'HASH' // TODO: shouldn't be mandatory
|
field: SchemaFieldTypes.TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@@ -25,7 +26,16 @@ describe('INFO', () => {
|
|||||||
keyType: 'HASH',
|
keyType: 'HASH',
|
||||||
prefixes: ['']
|
prefixes: ['']
|
||||||
},
|
},
|
||||||
attributes: [],
|
attributes: [[
|
||||||
|
'identifier',
|
||||||
|
'field',
|
||||||
|
'attribute',
|
||||||
|
'field',
|
||||||
|
'type',
|
||||||
|
'TEXT',
|
||||||
|
'WEIGHT',
|
||||||
|
'1'
|
||||||
|
]],
|
||||||
numDocs: '0',
|
numDocs: '0',
|
||||||
maxDocId: '0',
|
maxDocId: '0',
|
||||||
numTerms: '0',
|
numTerms: '0',
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './SYNDUMP';
|
import { transformArguments } from './SYNDUMP';
|
||||||
|
import { SchemaFieldTypes } from '.';
|
||||||
|
|
||||||
describe('SYNDUMP', () => {
|
describe('SYNDUMP', () => {
|
||||||
it('transformArguments', () => {
|
it('transformArguments', () => {
|
||||||
@@ -11,8 +12,8 @@ describe('SYNDUMP', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.ft.synDump', async client => {
|
testUtils.testWithClient('client.ft.synDump', async client => {
|
||||||
await client.ft.create('index', {}, {
|
await client.ft.create('index', {
|
||||||
ON: 'HASH' // TODO: shouldn't be mandatory
|
field: SchemaFieldTypes.TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './SYNUPDATE';
|
import { transformArguments } from './SYNUPDATE';
|
||||||
|
import { SchemaFieldTypes } from '.';
|
||||||
|
|
||||||
describe('SYNUPDATE', () => {
|
describe('SYNUPDATE', () => {
|
||||||
describe('transformArguments', () => {
|
describe('transformArguments', () => {
|
||||||
@@ -27,8 +28,8 @@ describe('SYNUPDATE', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUtils.testWithClient('client.ft.synUpdate', async client => {
|
testUtils.testWithClient('client.ft.synUpdate', async client => {
|
||||||
await client.ft.create('index', {}, {
|
await client.ft.create('index', {
|
||||||
ON: 'HASH' // TODO: shouldn't be mandatory
|
field: SchemaFieldTypes.TEXT
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
@@ -4,7 +4,7 @@ import RediSearch from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/redisearch',
|
dockerImageName: 'redislabs/redisearch',
|
||||||
dockerImageVersionArgument: 'redisearch-version',
|
dockerImageVersionArgument: 'redisearch-version',
|
||||||
defaultDockerVersion: '2.2.1'
|
defaultDockerVersion: '2.2.7'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.13",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@types/mocha": "^9.1.0",
|
"@types/mocha": "^9.1.0",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.13",
|
||||||
"@types/yargs": "^17.0.8",
|
"@types/yargs": "^17.0.8",
|
||||||
"mocha": "^9.2.0",
|
"mocha": "^9.2.0",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
|
@@ -44,6 +44,7 @@ describe('INFO_DEBUG', () => {
|
|||||||
key: 'key2',
|
key: 'key2',
|
||||||
timeBucket: 5
|
timeBucket: 5
|
||||||
}],
|
}],
|
||||||
|
keySelfName: 'key',
|
||||||
chunks: [{
|
chunks: [{
|
||||||
startTimestamp: 1,
|
startTimestamp: 1,
|
||||||
endTimestamp: 1,
|
endTimestamp: 1,
|
||||||
|
@@ -16,6 +16,8 @@ export function transformArguments(key: string): Array<string> {
|
|||||||
type InfoDebugRawReply = [
|
type InfoDebugRawReply = [
|
||||||
...infoArgs: InfoRawReply,
|
...infoArgs: InfoRawReply,
|
||||||
_: string,
|
_: string,
|
||||||
|
keySelfName: string,
|
||||||
|
_: string,
|
||||||
chunks: Array<[
|
chunks: Array<[
|
||||||
_: string,
|
_: string,
|
||||||
startTimestamp: number,
|
startTimestamp: number,
|
||||||
@@ -31,6 +33,7 @@ type InfoDebugRawReply = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
interface InfoDebugReply extends InfoReply {
|
interface InfoDebugReply extends InfoReply {
|
||||||
|
keySelfName: string;
|
||||||
chunks: Array<{
|
chunks: Array<{
|
||||||
startTimestamp: number;
|
startTimestamp: number;
|
||||||
endTimestamp: number;
|
endTimestamp: number;
|
||||||
@@ -42,7 +45,8 @@ interface InfoDebugReply extends InfoReply {
|
|||||||
|
|
||||||
export function transformReply(rawReply: InfoDebugRawReply): InfoDebugReply {
|
export function transformReply(rawReply: InfoDebugRawReply): InfoDebugReply {
|
||||||
const reply = transformInfoReply(rawReply as unknown as InfoRawReply);
|
const reply = transformInfoReply(rawReply as unknown as InfoRawReply);
|
||||||
(reply as InfoDebugReply).chunks = rawReply[25].map(chunk => ({
|
(reply as InfoDebugReply).keySelfName = rawReply[25];
|
||||||
|
(reply as InfoDebugReply).chunks = rawReply[27].map(chunk => ({
|
||||||
startTimestamp: chunk[1],
|
startTimestamp: chunk[1],
|
||||||
endTimestamp: chunk[3],
|
endTimestamp: chunk[3],
|
||||||
samples: chunk[5],
|
samples: chunk[5],
|
||||||
|
@@ -4,7 +4,7 @@ import TimeSeries from '.';
|
|||||||
export default new TestUtils({
|
export default new TestUtils({
|
||||||
dockerImageName: 'redislabs/redistimeseries',
|
dockerImageName: 'redislabs/redistimeseries',
|
||||||
dockerImageVersionArgument: 'timeseries-version',
|
dockerImageVersionArgument: 'timeseries-version',
|
||||||
defaultDockerVersion: '1.6.0'
|
defaultDockerVersion: '1.6.8'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GLOBAL = {
|
export const GLOBAL = {
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||||
"@node-redis/test-utils": "*",
|
"@node-redis/test-utils": "*",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.13",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"release-it": "^14.12.4",
|
"release-it": "^14.12.4",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
|
Reference in New Issue
Block a user