Skip to content

Commit b751a2a

Browse files
committed
chore: upgrade deps & format code
1 parent 8c832ee commit b751a2a

30 files changed

+3472
-2047
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"typescript.tsdk": "./node_modules/typescript/lib",
23
// Disable the default formatter, use eslint instead
34
"prettier.enable": false,
45
"editor.formatOnSave": false,

package.json

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,31 @@
4747
"@fastify/cookie": "^9.4.0",
4848
"@fastify/multipart": "^8.3.0",
4949
"@fastify/static": "^7.0.4",
50-
"@liaoliaots/nestjs-redis": "^9.0.5",
50+
"@liaoliaots/nestjs-redis": "^10.0.0",
5151
"@nestjs-modules/mailer": "^2.0.2",
5252
"@nestjs/axios": "^3.0.3",
5353
"@nestjs/bull": "^10.2.1",
5454
"@nestjs/cache-manager": "^2.2.2",
55-
"@nestjs/common": "^10.4.1",
55+
"@nestjs/common": "^10.4.4",
5656
"@nestjs/config": "^3.2.3",
57-
"@nestjs/core": "^10.4.1",
57+
"@nestjs/core": "^10.4.4",
5858
"@nestjs/event-emitter": "^2.0.4",
5959
"@nestjs/jwt": "^10.2.0",
6060
"@nestjs/passport": "^10.0.3",
61-
"@nestjs/platform-fastify": "^10.4.1",
62-
"@nestjs/platform-socket.io": "^10.4.1",
63-
"@nestjs/schedule": "^4.1.0",
64-
"@nestjs/swagger": "^7.4.0",
61+
"@nestjs/platform-fastify": "^10.4.4",
62+
"@nestjs/platform-socket.io": "^10.4.4",
63+
"@nestjs/schedule": "^4.1.1",
64+
"@nestjs/swagger": "^7.4.2",
6565
"@nestjs/terminus": "^10.2.3",
6666
"@nestjs/throttler": "^6.2.1",
6767
"@nestjs/typeorm": "^10.0.2",
68-
"@nestjs/websockets": "^10.4.1",
68+
"@nestjs/websockets": "^10.4.4",
6969
"@socket.io/redis-adapter": "^8.3.0",
7070
"@socket.io/redis-emitter": "^5.1.0",
7171
"axios": "^1.7.7",
72-
"bull": "^4.16.2",
72+
"bull": "^4.16.3",
7373
"cache-manager": "^5.7.6",
74-
"cache-manager-ioredis-yet": "^2.1.1",
74+
"cache-manager-ioredis-yet": "^2.1.2",
7575
"class-transformer": "^0.5.1",
7676
"class-validator": "^0.14.1",
7777
"cron": "^3.1.7",
@@ -83,45 +83,45 @@
8383
"helmet": "^7.1.0",
8484
"ioredis": "^5.4.1",
8585
"lodash": "^4.17.21",
86-
"mysql2": "^3.11.0",
86+
"mysql2": "^3.11.3",
8787
"nanoid": "^3.3.7",
8888
"nestjs-cls": "^4.4.1",
8989
"nodemailer": "^6.9.15",
9090
"passport": "^0.7.0",
9191
"passport-google-oauth20": "^2.0.0",
9292
"passport-jwt": "^4.0.1",
9393
"passport-local": "^1.0.0",
94-
"qiniu": "^7.12.0",
94+
"qiniu": "^7.13.0",
9595
"qs": "^6.13.0",
9696
"reflect-metadata": "^0.2.2",
9797
"rxjs": "^7.8.1",
98-
"socket.io": "^4.7.5",
98+
"socket.io": "^4.8.0",
9999
"stacktrace-js": "^2.0.2",
100100
"svg-captcha": "^1.4.0",
101101
"systeminformation": "^5.23.5",
102102
"ts-node": "^10.9.2",
103103
"typeorm": "0.3.17",
104-
"ua-parser-js": "^1.0.38",
104+
"ua-parser-js": "^1.0.39",
105105
"winston": "^3.14.2",
106106
"winston-daily-rotate-file": "^5.0.0"
107107
},
108108
"devDependencies": {
109-
"@antfu/eslint-config": "^3.3.2",
109+
"@antfu/eslint-config": "^3.7.3",
110110
"@compodoc/compodoc": "^1.1.25",
111111
"@nestjs/cli": "^10.4.5",
112112
"@nestjs/schematics": "^10.1.4",
113-
"@nestjs/testing": "^10.4.1",
113+
"@nestjs/testing": "^10.4.4",
114114
"@types/cache-manager": "^4.0.6",
115115
"@types/jest": "29.5.12",
116-
"@types/lodash": "^4.17.7",
116+
"@types/lodash": "^4.17.10",
117117
"@types/multer": "^1.4.12",
118118
"@types/node": "^20.14.11",
119119
"@types/passport-jwt": "^4.0.1",
120-
"@types/qs": "^6.9.15",
120+
"@types/qs": "^6.9.16",
121121
"@types/supertest": "^6.0.2",
122122
"@types/ua-parser-js": "^0.7.39",
123123
"cross-env": "^7.0.3",
124-
"eslint": "^9.9.1",
124+
"eslint": "^9.11.1",
125125
"jest": "^29.7.0",
126126
"lint-staged": "^15.2.10",
127127
"rimraf": "^6.0.1",
@@ -131,15 +131,12 @@
131131
"ts-jest": "^29.1.2",
132132
"ts-loader": "^9.5.1",
133133
"tsconfig-paths": "^4.2.0",
134-
"typescript": "^5.5.4"
134+
"tsx": "^4.19.1",
135+
"typescript": "~5.5.4"
135136
},
136137
"pnpm": {
137138
"peerDependencyRules": {
138-
"allowedVersions": {
139-
"@liaoliaots/nestjs-redis>@nestjs/common": "^10.0.0",
140-
"@liaoliaots/nestjs-redis>@nestjs/core": "^10.0.0",
141-
"eslint": "^9.2.0"
142-
}
139+
"allowedVersions": {}
143140
}
144141
},
145142
"jest": {

pnpm-lock.yaml

Lines changed: 3379 additions & 1966 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { ClassSerializerInterceptor, Module } from '@nestjs/common'
1+
import type { FastifyRequest } from 'fastify'
22

3+
import { ClassSerializerInterceptor, Module } from '@nestjs/common'
34
import { ConfigModule } from '@nestjs/config'
4-
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'
55

6+
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'
67
import { ThrottlerGuard } from '@nestjs/throttler'
78
import { ClsModule } from 'nestjs-cls'
8-
import type { FastifyRequest } from 'fastify'
99

1010
import config from '~/config'
1111
import { SharedModule } from '~/shared/shared.module'

src/common/decorators/bypass.decorator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { SetMetadata } from '@nestjs/common'
22

3-
export const BYPASS_KEY = '__bypass_key__'
3+
export const BYPASS_KEY = Symbol('__bypass_key__')
44

55
/**
66
* 当不需要转换成基础返回格式时添加该装饰器

src/common/decorators/cookie.decorator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { createParamDecorator } from '@nestjs/common'
21
import type { ExecutionContext } from '@nestjs/common'
32
import type { FastifyRequest } from 'fastify'
3+
import { createParamDecorator } from '@nestjs/common'
44

55
export const Cookies = createParamDecorator((data: string, ctx: ExecutionContext) => {
66
const request = ctx.switchToHttp().getRequest<FastifyRequest>()

src/common/decorators/http.decorator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { createParamDecorator } from '@nestjs/common'
2-
31
import type { ExecutionContext } from '@nestjs/common'
2+
43
import type { FastifyRequest } from 'fastify'
4+
import { createParamDecorator } from '@nestjs/common'
55

66
import { getIp } from '~/utils/ip.util'
77

src/common/decorators/idempotence.decorator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { SetMetadata } from '@nestjs/common'
22

33
import { IdempotenceOption } from '../interceptors/idempotence.interceptor'
44

5-
export const HTTP_IDEMPOTENCE_KEY = '__idempotence_key__'
6-
export const HTTP_IDEMPOTENCE_OPTIONS = '__idempotence_options__'
5+
export const HTTP_IDEMPOTENCE_KEY = Symbol('__idempotence_key__')
6+
export const HTTP_IDEMPOTENCE_OPTIONS = Symbol('__idempotence_options__')
77

88
/**
99
* 幂等
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Inject } from '@nestjs/common'
2+
3+
export const REDIS_CLIENT = Symbol('REDIS_CLIENT')
4+
5+
// 自定义 InjectRedis 装饰器
6+
export const InjectRedis = () => Inject(REDIS_CLIENT)

src/common/interceptors/idempotence.interceptor.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
import type {
2+
CallHandler,
3+
ExecutionContext,
4+
NestInterceptor,
5+
} from '@nestjs/common'
6+
7+
import type { FastifyRequest } from 'fastify'
18
import {
29
ConflictException,
310
Injectable,
411
SetMetadata,
512
} from '@nestjs/common'
6-
713
import { Reflector } from '@nestjs/core'
814
import { catchError, tap } from 'rxjs'
9-
import type {
10-
CallHandler,
11-
ExecutionContext,
12-
NestInterceptor,
13-
} from '@nestjs/common'
14-
import type { FastifyRequest } from 'fastify'
1515

1616
import { CacheService } from '~/shared/redis/cache.service'
1717
import { hashString } from '~/utils'

src/common/interceptors/transform.interceptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { FastifyRequest } from 'fastify'
12
import {
23
CallHandler,
34
ExecutionContext,
@@ -9,7 +10,6 @@ import { Reflector } from '@nestjs/core'
910
import qs from 'qs'
1011
import { Observable } from 'rxjs'
1112
import { map } from 'rxjs/operators'
12-
import type { FastifyRequest } from 'fastify'
1313

1414
import { ResOp } from '~/common/model/response.model'
1515

src/helper/crud/crud.factory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { Type } from '@nestjs/common'
2+
13
import {
24
Body,
35
Controller,
@@ -8,11 +10,9 @@ import {
810
Put,
911
Query,
1012
} from '@nestjs/common'
11-
1213
import { ApiBody, IntersectionType, PartialType } from '@nestjs/swagger'
1314
import { upperFirst } from 'lodash'
1415
import pluralize from 'pluralize'
15-
import type { Type } from '@nestjs/common'
1616

1717
import { ApiResult } from '~/common/decorators/api-result.decorator'
1818
import { IdParam } from '~/common/decorators/id-param.decorator'

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import type { ConfigKeyPaths } from './config'
12
import cluster from 'node:cluster'
2-
import path from 'node:path'
33

4+
import path from 'node:path'
45
import {
56
HttpStatus,
67
Logger,
@@ -9,19 +10,18 @@ import {
910
} from '@nestjs/common'
1011
import { ConfigService } from '@nestjs/config'
1112
import { NestFactory } from '@nestjs/core'
13+
1214
import { NestFastifyApplication } from '@nestjs/platform-fastify'
1315

1416
import { useContainer } from 'class-validator'
1517

1618
import { AppModule } from './app.module'
17-
1819
import { fastifyApp } from './common/adapters/fastify.adapter'
1920
import { RedisIoAdapter } from './common/adapters/socket.adapter'
2021
import { LoggingInterceptor } from './common/interceptors/logging.interceptor'
2122
import { isDev, isMainProcess } from './global/env'
2223
import { setupSwagger } from './setup-swagger'
2324
import { LoggerService } from './shared/logger/logger.service'
24-
import type { ConfigKeyPaths } from './config'
2525

2626
declare const module: any
2727

src/modules/auth/auth.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { Inject, Injectable } from '@nestjs/common'
3-
42
import Redis from 'ioredis'
3+
54
import { isEmpty } from 'lodash'
5+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
66

77
import { BusinessException } from '~/common/exceptions/biz.exception'
88

src/modules/auth/controllers/captcha.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { Controller, Get, Query } from '@nestjs/common'
32
import { ApiOperation, ApiTags } from '@nestjs/swagger'
4-
53
import Redis from 'ioredis'
4+
65
import { isEmpty } from 'lodash'
76
import * as svgCaptcha from 'svg-captcha'
8-
97
import { ApiResult } from '~/common/decorators/api-result.decorator'
8+
9+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
1010
import { genCaptchaImgKey } from '~/helper/genRedisKey'
1111
import { generateUUID } from '~/utils'
1212

src/modules/auth/guards/jwt-auth.guard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import {
32
ExecutionContext,
43
Inject,
@@ -10,9 +9,10 @@ import { AuthGuard } from '@nestjs/passport'
109
import { FastifyRequest } from 'fastify'
1110
import Redis from 'ioredis'
1211
import { isEmpty, isNil } from 'lodash'
13-
1412
import { ExtractJwt } from 'passport-jwt'
1513

14+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
15+
1616
import { BusinessException } from '~/common/exceptions/biz.exception'
1717
import { AppConfig, IAppConfig, RouterWhiteList } from '~/config'
1818
import { ErrorEnum } from '~/constants/error-code.constant'

src/modules/auth/services/captcha.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { Injectable } from '@nestjs/common'
3-
42
import Redis from 'ioredis'
3+
54
import { isEmpty } from 'lodash'
5+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
66

77
import { BusinessException } from '~/common/exceptions/biz.exception'
88
import { ErrorEnum } from '~/constants/error-code.constant'

src/modules/auth/services/token.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { Inject, Injectable } from '@nestjs/common'
32
import { JwtService } from '@nestjs/jwt'
43
import dayjs from 'dayjs'
5-
64
import Redis from 'ioredis'
75

6+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
7+
88
import { ISecurityConfig, SecurityConfig } from '~/config'
99
import { genOnlineUserKey } from '~/helper/genRedisKey'
1010
import { RoleService } from '~/modules/system/role/role.service'

src/modules/system/menu/menu.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { Injectable } from '@nestjs/common'
32
import { InjectRepository } from '@nestjs/typeorm'
43
import Redis from 'ioredis'
54
import { concat, isEmpty, isNil, uniq } from 'lodash'
6-
75
import { In, IsNull, Like, Not, Repository } from 'typeorm'
86

7+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
8+
99
import { BusinessException } from '~/common/exceptions/biz.exception'
1010
import { RedisKeys } from '~/constants/cache.constant'
1111
import { ErrorEnum } from '~/constants/error-code.constant'

src/modules/system/online/online.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { Injectable } from '@nestjs/common'
3-
42
import Redis from 'ioredis'
53

64
import { throttle } from 'lodash'
5+
76
import { UAParser } from 'ua-parser-js'
7+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
88

99
import { BusinessException } from '~/common/exceptions/biz.exception'
1010
import { ErrorEnum } from '~/constants/error-code.constant'

src/modules/system/task/task.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { InjectQueue } from '@nestjs/bull'
32
import {
43
BadRequestException,
@@ -14,6 +13,7 @@ import { Queue } from 'bull'
1413
import Redis from 'ioredis'
1514
import { isEmpty, isNil } from 'lodash'
1615
import { Like, Repository } from 'typeorm'
16+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
1717

1818
import { BusinessException } from '~/common/exceptions/biz.exception'
1919
import { ErrorEnum } from '~/constants/error-code.constant'

src/modules/user/user.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { InjectRedis } from '@liaoliaots/nestjs-redis'
21
import { BadRequestException, Injectable } from '@nestjs/common'
32
import { InjectEntityManager, InjectRepository } from '@nestjs/typeorm'
43
import Redis from 'ioredis'
54
import { isEmpty, isNil } from 'lodash'
6-
75
import { EntityManager, In, Like, Repository } from 'typeorm'
86

7+
import { InjectRedis } from '~/common/decorators/inject-redis.decorator'
8+
99
import { BusinessException } from '~/common/exceptions/biz.exception'
1010
import { ErrorEnum } from '~/constants/error-code.constant'
1111
import { ROOT_ROLE_ID, SYS_USER_INITPASSWORD } from '~/constants/system.constant'

0 commit comments

Comments
 (0)