chore: update ioredis to v5

This commit is contained in:
Innei
2022-04-05 15:31:21 +08:00
parent e7548e08c0
commit 47c6ab83c2
6 changed files with 45 additions and 51 deletions

View File

@@ -146,7 +146,6 @@
"@types/fs-extra": "9.0.13",
"@types/get-image-colors": "4.0.1",
"@types/html-minifier": "4.0.2",
"@types/ioredis": "4.28.10",
"@types/jest": "27.4.1",
"@types/js-yaml": "4.0.5",
"@types/jsdom": "16.2.14",
@@ -164,7 +163,7 @@
"cross-env": "7.0.3",
"eslint": "*",
"husky": "7.0.4",
"ioredis": "4.28.5",
"ioredis": "5.0.3",
"jest": "27.5.1",
"lint-staged": "12.3.7",
"prettier": "2.6.2",
@@ -183,7 +182,7 @@
},
"resolutions": {
"typescript": "4.6.3",
"ioredis": "4.28.5",
"ioredis": "^5",
"webpack": "5.71.0"
}
}

72
pnpm-lock.yaml generated
View File

@@ -2,7 +2,7 @@ lockfileVersion: 5.3
overrides:
typescript: 4.6.3
ioredis: 4.28.5
ioredis: ^5
webpack: 5.71.0
specifiers:
@@ -39,7 +39,6 @@ specifiers:
'@types/fs-extra': 9.0.13
'@types/get-image-colors': 4.0.1
'@types/html-minifier': 4.0.2
'@types/ioredis': 4.28.10
'@types/jest': 27.4.1
'@types/js-yaml': 4.0.5
'@types/jsdom': 16.2.14
@@ -79,7 +78,7 @@ specifiers:
husky: 7.0.4
image-size: 1.0.1
inquirer: '*'
ioredis: 4.28.5
ioredis: ^5
isbot: 3.4.5
jest: 27.5.1
js-yaml: '*'
@@ -208,7 +207,6 @@ devDependencies:
'@types/fs-extra': 9.0.13
'@types/get-image-colors': 4.0.1
'@types/html-minifier': 4.0.2
'@types/ioredis': 4.28.10
'@types/jest': 27.4.1
'@types/js-yaml': 4.0.5
'@types/jsdom': 16.2.14
@@ -226,7 +224,7 @@ devDependencies:
cross-env: 7.0.3
eslint: 8.11.0
husky: 7.0.4
ioredis: 4.28.5
ioredis: 5.0.3
jest: 27.5.1_ts-node@10.7.0
lint-staged: 12.3.7
prettier: 2.6.2
@@ -503,7 +501,7 @@ packages:
'@babel/traverse': 7.17.3
'@babel/types': 7.17.0
convert-source-map: 1.8.0
debug: 4.3.3
debug: 4.3.4
gensync: 1.0.0-beta.2
json5: 2.2.0
lodash: 4.17.21
@@ -899,7 +897,7 @@ packages:
'@babel/helper-split-export-declaration': 7.16.7
'@babel/parser': 7.17.8
'@babel/types': 7.17.0
debug: 4.3.3
debug: 4.3.4
globals: 11.12.0
lodash: 4.17.21
transitivePeerDependencies:
@@ -1044,6 +1042,9 @@ packages:
engines: {node: '>= 16.0.0'}
dev: false
/@ioredis/commands/1.1.1:
resolution: {integrity: sha512-fsR4P/ROllzf/7lXYyElUJCheWdTJVJvOTps8v9IWKFATxR61ANOlnoPqhH099xYLrJGpc2ZQ28B3rMeUt5VQg==}
/@istanbuljs/load-nyc-config/1.1.0:
resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==}
engines: {node: '>=8'}
@@ -1859,12 +1860,6 @@ packages:
'@types/uglify-js': 3.13.1
dev: true
/@types/ioredis/4.28.10:
resolution: {integrity: sha512-69LyhUgrXdgcNDv7ogs1qXZomnfOEnSmrmMFqKgt1XMJxmoOSG/u3wYy13yACIfKuMJ8IhKgHafDO3sx19zVQQ==}
dependencies:
'@types/node': 16.11.26
dev: true
/@types/istanbul-lib-coverage/2.0.4:
resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==}
dev: true
@@ -2137,7 +2132,7 @@ packages:
optional: true
dependencies:
'@typescript-eslint/utils': 5.16.0_eslint@8.11.0+typescript@4.6.3
debug: 4.3.3
debug: 4.3.4
eslint: 8.11.0
tsutils: 3.21.0_typescript@4.6.3
typescript: 4.6.3
@@ -2166,7 +2161,7 @@ packages:
dependencies:
'@typescript-eslint/types': 5.15.0
'@typescript-eslint/visitor-keys': 5.15.0
debug: 4.3.3
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
semver: 7.3.5
@@ -2187,7 +2182,7 @@ packages:
dependencies:
'@typescript-eslint/types': 5.16.0
'@typescript-eslint/visitor-keys': 5.16.0
debug: 4.3.3
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
semver: 7.3.5
@@ -2687,7 +2682,7 @@ packages:
resolution: {integrity: sha512-XW2CMCmZaCmCCsIaJaLKxAzPwF37fXi1KGxNOvedOpeisLdmxZnblGc3hpHWYnlP+KOUxZsazh43WXNHgXpbqw==}
dependencies:
archy: 1.0.0
debug: 4.3.3
debug: 4.3.4
fastq: 1.13.0
queue-microtask: 1.2.3
transitivePeerDependencies:
@@ -2913,7 +2908,7 @@ packages:
resolution: {integrity: sha512-TCxbp9ceuFveTKWuNaCX8QjoC41rAlHen4s63u9Yd+iXlw3efYmimc/u935PKPxSdhkXpnMes4mxtK3/yb0L4g==}
engines: {node: '>=6.0.0'}
dependencies:
ioredis: 4.28.5
ioredis: 5.0.3
transitivePeerDependencies:
- supports-color
dev: false
@@ -3436,6 +3431,17 @@ packages:
supports-color: 9.2.1
dev: true
/debug/4.3.4:
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies:
ms: 2.1.2
/decimal.js/10.3.1:
resolution: {integrity: sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==}
@@ -3469,10 +3475,6 @@ packages:
resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=}
dev: false
/denque/1.5.1:
resolution: {integrity: sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==}
engines: {node: '>=0.10'}
/denque/2.0.1:
resolution: {integrity: sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==}
engines: {node: '>=0.10'}
@@ -4670,7 +4672,7 @@ packages:
dependencies:
'@tootallnate/once': 1.1.2
agent-base: 6.0.2
debug: 4.3.3
debug: 4.3.4
transitivePeerDependencies:
- supports-color
dev: true
@@ -4840,18 +4842,16 @@ packages:
engines: {node: '>= 0.10'}
dev: true
/ioredis/4.28.5:
resolution: {integrity: sha512-3GYo0GJtLqgNXj4YhrisLaNNvWSNwSS2wS4OELGfGxH8I69+XfNdnmV1AyN+ZqMh0i7eX+SWjrwFKDBDgfBC1A==}
engines: {node: '>=6'}
/ioredis/5.0.3:
resolution: {integrity: sha512-hKxywVypoGGUJDyfnMufO0VNkuIaQufo2/PJ5SOYBKWgf4+gCnZEPaBPle615k08euY9/B9DKytVtwZROF7HaA==}
engines: {node: '>=12.22.0'}
dependencies:
'@ioredis/commands': 1.1.1
cluster-key-slot: 1.1.0
debug: 4.3.3
denque: 1.5.1
debug: 4.3.4
denque: 2.0.1
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
@@ -5071,7 +5071,7 @@ packages:
resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==}
engines: {node: '>=10'}
dependencies:
debug: 4.3.3
debug: 4.3.4
istanbul-lib-coverage: 3.2.0
source-map: 0.6.1
transitivePeerDependencies:
@@ -5960,6 +5960,7 @@ packages:
/lodash.flatten/4.4.0:
resolution: {integrity: sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=}
dev: false
/lodash.foreach/4.5.0:
resolution: {integrity: sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=}
@@ -6677,10 +6678,6 @@ packages:
dependencies:
p-limit: 2.3.0
/p-map/2.1.0:
resolution: {integrity: sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==}
engines: {node: '>=6'}
/p-map/4.0.0:
resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==}
engines: {node: '>=10'}
@@ -7029,9 +7026,6 @@ packages:
resolve: 1.22.0
dev: true
/redis-commands/1.7.0:
resolution: {integrity: sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==}
/redis-errors/1.2.0:
resolution: {integrity: sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=}
engines: {node: '>=4'}

View File

@@ -5,7 +5,7 @@
* @author Surmon <https://github.com/surmon-china>
*/
import redisStore from 'cache-manager-ioredis'
import IORedis from 'ioredis'
import { RedisOptions } from 'ioredis'
import {
CacheModuleOptions,
@@ -19,7 +19,7 @@ import { REDIS } from '~/app.config'
export class CacheConfigService implements CacheOptionsFactory {
// 缓存配置
public createCacheOptions(): CacheModuleOptions {
const redisOptions: IORedis.RedisOptions = {
const redisOptions: RedisOptions = {
host: REDIS.host as string,
port: REDIS.port as number,
}

View File

@@ -1,4 +1,4 @@
import IORedis from 'ioredis'
import { Redis } from 'ioredis'
import { isAsyncFunction } from 'util/types'
import { Injectable } from '@nestjs/common'
@@ -64,7 +64,7 @@ export class TaskQueueService {
class RedisMap<K extends string, V = unknown> {
constructor(
private readonly redis: IORedis.Redis,
private readonly redis: Redis,
private readonly hashName: string,
) {
this.hashName = `${RedisMap.key}${hashName}#`

View File

@@ -1,4 +1,4 @@
import IORedis from 'ioredis'
import IORedis, { Redis } from 'ioredis'
import { Logger } from '@nestjs/common'
@@ -7,8 +7,8 @@ import { REDIS } from '~/app.config'
import { isTest } from '../global/env.global'
class RedisSubPub {
public pubClient: IORedis.Redis
public subClient: IORedis.Redis
public pubClient: Redis
public subClient: Redis
constructor(private channelPrefix: string = 'mx-channel#') {
if (!isTest) {
this.init()

View File

@@ -1,9 +1,10 @@
import IORedis from 'ioredis'
import IORedis, { Redis } from 'ioredis'
import RedisMemoryServer from 'redis-memory-server'
import { CacheService } from '~/processors/cache/cache.service'
export class MockCacheService {
private client: IORedis.Redis
private client: Redis
constructor(port: number, host: string) {
this.client = new IORedis(port, host)
}