diff --git a/lib/redis.interfaces.ts b/lib/redis.interfaces.ts index 08edbd2..1dd7fc3 100644 --- a/lib/redis.interfaces.ts +++ b/lib/redis.interfaces.ts @@ -1,10 +1,8 @@ import { ModuleMetadata, Type } from '@nestjs/common/interfaces'; -import * as Redis from 'ioredis'; - -export type Redis = Redis.Redis; +import { RedisOptions } from 'ioredis'; export interface RedisModuleOptions { - config: Redis.RedisOptions & { url?: string }; + config: RedisOptions & { url?: string }; } export interface RedisModuleOptionsFactory { diff --git a/lib/redis.module.spec.ts b/lib/redis.module.spec.ts index 3d63145..21abebe 100644 --- a/lib/redis.module.spec.ts +++ b/lib/redis.module.spec.ts @@ -1,10 +1,9 @@ import { Injectable } from '@nestjs/common'; -import * as Redis from 'ioredis'; +import Redis from 'ioredis'; import { Test, TestingModule } from '@nestjs/testing'; import { RedisModule } from './redis.module'; import { getRedisConnectionToken } from './redis.utils'; import { InjectRedis } from './redis.decorators'; -import { Redis as RedisType } from './redis.interfaces'; describe('RedisModule', () => { it('Instance Redis', async () => { @@ -53,7 +52,7 @@ describe('RedisModule', () => { @Injectable() class TestProvider { - constructor(@InjectRedis() private readonly redis: RedisType) {} + constructor(@InjectRedis() private readonly redis: Redis) {} getClient() { return this.redis; diff --git a/lib/redis.utils.ts b/lib/redis.utils.ts index c7a0f3e..9e3572c 100644 --- a/lib/redis.utils.ts +++ b/lib/redis.utils.ts @@ -1,5 +1,5 @@ import { RedisModuleOptions } from './redis.interfaces'; -import * as Redis from 'ioredis'; +import Redis from 'ioredis'; import { REDIS_MODULE_CONNECTION, REDIS_MODULE_CONNECTION_TOKEN, diff --git a/package.json b/package.json index 1e0a864..28c6da1 100644 --- a/package.json +++ b/package.json @@ -27,18 +27,17 @@ "peerDependencies": { "@nestjs/common": "^6.7.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", "@nestjs/core": "^6.7.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", - "ioredis": "^4.0.0" + "ioredis": "^5.0.0" }, "devDependencies": { "@nestjs/common": "7.6.18", "@nestjs/core": "7.6.18", "@nestjs/testing": "7.6.18", - "@types/ioredis": "4.28.2", "@types/jest": "27.0.1", "@typescript-eslint/eslint-plugin": "4.33.0", "@typescript-eslint/parser": "4.33.0", "husky": "7.0.4", - "ioredis": "4.28.2", + "ioredis": "^5.3.1", "jest": "27.2.5", "lint-staged": "11.2.0", "prettier": "2.3.2", diff --git a/yarn.lock b/yarn.lock index 2eae328..5fefefd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -513,6 +513,11 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@ioredis/commands@^1.1.1": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" + integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b" @@ -871,13 +876,6 @@ dependencies: "@types/node" "*" -"@types/ioredis@4.28.2": - version "4.28.2" - resolved "https://registry.yarnpkg.com/@types/ioredis/-/ioredis-4.28.2.tgz#7ff68944cbb58afefb2a1d8b250ebf48760e93c9" - integrity sha512-kOCG4ExodOAoslFjsUzwAK1fxqVRx3JX5m7lm3MkWf5WkDwNTtXBtlBig6cQyFwS7P7TPaTWRreQaMwl7e1FFA== - dependencies: - "@types/node" "*" - "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -1785,6 +1783,13 @@ debug@^4.3.1: dependencies: ms "2.1.2" +debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + decamelize-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" @@ -1823,10 +1828,10 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= -denque@^1.1.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/denque/-/denque-1.4.1.tgz#6744ff7641c148c3f8a69c307e51235c1f4a37cf" - integrity sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ== +denque@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" + integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== detect-indent@^6.0.0: version "6.0.0" @@ -2428,19 +2433,17 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -ioredis@4.28.2: - version "4.28.2" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.28.2.tgz#493ccd5d869fd0ec86c96498192718171f6c9203" - integrity sha512-kQ+Iv7+c6HsDdPP2XUHaMv8DhnSeAeKEwMbaoqsXYbO+03dItXt7+5jGQDRyjdRUV2rFJbzg7P4Qt1iX2tqkOg== +ioredis@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.3.1.tgz#55d394a51258cee3af9e96c21c863b1a97bf951f" + integrity sha512-C+IBcMysM6v52pTLItYMeV4Hz7uriGtoJdz7SSBDX6u+zwSYGirLdQh3L7t/OItWITcw3gTFMjJReYUwS4zihg== dependencies: + "@ioredis/commands" "^1.1.1" cluster-key-slot "^1.1.0" - debug "^4.3.1" - denque "^1.1.0" + debug "^4.3.4" + denque "^2.1.0" lodash.defaults "^4.2.0" - lodash.flatten "^4.4.0" lodash.isarguments "^3.1.0" - p-map "^2.1.0" - redis-commands "1.7.0" redis-errors "^1.2.0" redis-parser "^3.0.0" standard-as-callback "^2.1.0" @@ -3235,11 +3238,6 @@ lodash.defaults@^4.2.0: resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw= -lodash.flatten@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" - integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= - lodash.isarguments@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" @@ -3639,11 +3637,6 @@ p-locate@^5.0.0: dependencies: p-limit "^3.0.2" -p-map@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" - integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== - p-map@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" @@ -3985,11 +3978,6 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" -redis-commands@1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.7.0.tgz#15a6fea2d58281e27b1cd1acfb4b293e278c3a89" - integrity sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ== - redis-errors@^1.0.0, redis-errors@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad"