Skip to content

Commit 55db6d4

Browse files
authored
chore(deps): update nestjs dependencies (#2830)
* fix: update Redis cache implementation and dependencies Signed-off-by: John Bair <john.bair@swirldslabs.com> * chore(deps): downgrade @hiero-ledger/proto and @hiero-ledger/sdk dependencies Signed-off-by: John Bair <john.bair@swirldslabs.com> * chore(deps): update pnpm-lock.yaml Signed-off-by: John Bair <john.bair@swirldslabs.com> * fix: update controller routes to use curly braces for optional parameters Signed-off-by: John Bair <john.bair@swirldslabs.com> * chore(deps): refactor @nestjs dependencies to use catalog for versioning Signed-off-by: John Bair <john.bair@swirldslabs.com> --------- Signed-off-by: John Bair <john.bair@swirldslabs.com>
1 parent eeea2bc commit 55db6d4

10 files changed

Lines changed: 342 additions & 555 deletions

File tree

back-end/apps/api/src/auth/auth.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
} from '@nestjs/common';
88
import { ConfigService } from '@nestjs/config';
99
import { JwtService } from '@nestjs/jwt';
10+
import type { StringValue } from 'ms';
1011

1112
import { totp } from 'otplib';
1213
import * as bcrypt from 'bcryptjs';
@@ -71,7 +72,7 @@ export class AuthService {
7172
/* The user is already verified, return jwt */
7273
async login(user: User) {
7374
const payload: JwtPayload = { userId: user.id, email: user.email };
74-
const expiresIn = `${this.configService.get('JWT_EXPIRATION')}d`;
75+
const expiresIn = `${this.configService.get('JWT_EXPIRATION')}d` as StringValue;
7576

7677
const accessToken: string = this.jwtService.sign(payload, {
7778
expiresIn,

back-end/apps/api/src/transactions/approvers/approvers.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
} from '../dto';
3030

3131
@ApiTags('Transaction Approvers')
32-
@Controller('transactions/:transactionId?/approvers')
32+
@Controller('transactions{/:transactionId}/approvers')
3333
@UseGuards(JwtBlackListAuthGuard, JwtAuthGuard, VerifiedUserGuard)
3434
@Serialize(TransactionApproverDto)
3535
export class ApproversController {

back-end/apps/api/src/transactions/comments/comments.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { CommentsService } from './comments.service';
1212
import { CreateCommentDto } from '../dto/create-comment.dto';
1313

1414
@ApiTags('Transaction Comments')
15-
@Controller('transactions/:transactionId?/comments')
15+
@Controller('transactions{/:transactionId}/comments')
1616
@UseGuards(JwtBlackListAuthGuard, JwtAuthGuard, VerifiedUserGuard)
1717
//TODO add serializer
1818
export class CommentsController {

back-end/apps/api/src/transactions/observers/observers.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
import { ObserversService } from './observers.service';
2626

2727
@ApiTags('Transaction Observers')
28-
@Controller('transactions/:transactionId?/observers')
28+
@Controller('transactions{/:transactionId}/observers')
2929
@UseGuards(JwtBlackListAuthGuard, JwtAuthGuard, VerifiedUserGuard)
3030
@Serialize(TransactionObserverDto)
3131
export class ObserversController {

back-end/apps/api/src/transactions/signers/signers.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
import { SignersService } from './signers.service';
3636

3737
@ApiTags('Transaction Signers')
38-
@Controller('transactions/:transactionId?/signers')
38+
@Controller('transactions{/:transactionId}/signers')
3939
@UseGuards(JwtBlackListAuthGuard, JwtAuthGuard, VerifiedUserGuard)
4040
export class SignersController {
4141
constructor(private signaturesService: SignersService) {}

back-end/apps/api/src/user-keys/user-keys.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { UpdateUserKeyMnemonicHashDto, UploadUserKeyDto, UserKeyDto } from './dt
2121
import { UserKeysService } from './user-keys.service';
2222

2323
@ApiTags('User Keys')
24-
@Controller('user/:userId?/keys')
24+
@Controller('user{/:userId}/keys')
2525
@UseGuards(JwtBlackListAuthGuard, JwtAuthGuard, VerifiedUserGuard)
2626
@Serialize(UserKeyDto)
2727
export class UserKeysController {
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
1-
import { Inject, Module } from '@nestjs/common';
1+
import { Inject, Module, type OnModuleDestroy } from '@nestjs/common';
22
import { ConfigService } from '@nestjs/config';
33
import { CacheModule, CACHE_MANAGER, Cache } from '@nestjs/cache-manager';
44

5-
import { redisStore } from 'cache-manager-redis-yet';
6-
import type { RedisClientOptions } from 'redis';
5+
import { createKeyv } from '@keyv/redis';
6+
77
@Module({
88
imports: [
9-
CacheModule.registerAsync<RedisClientOptions>({
9+
CacheModule.registerAsync({
1010
isGlobal: true,
11-
useFactory: async (configService: ConfigService) => {
12-
return {
13-
store: await redisStore({
14-
url: configService.getOrThrow('REDIS_URL'),
15-
ttl:
16-
configService.get<number>('REDIS_DEFAULT_TTL_MS', { infer: true }) || 1 * 60 * 1_000,
17-
}),
18-
};
19-
},
11+
useFactory: (configService: ConfigService) => ({
12+
stores: [createKeyv(configService.getOrThrow('REDIS_URL'))],
13+
ttl:
14+
configService.get<number>('REDIS_DEFAULT_TTL_MS', { infer: true }) || 1 * 60 * 1_000,
15+
}),
2016
inject: [ConfigService],
2117
}),
2218
],
2319
})
24-
export class RedisCacheModule {
20+
export class RedisCacheModule implements OnModuleDestroy {
2521
constructor(@Inject(CACHE_MANAGER) private cache: Cache) {}
2622

2723
onModuleDestroy() {
28-
// @ts-expect-error client is not visible
29-
const client = this.cache.store.client;
30-
client.quit();
24+
return this.cache.disconnect();
3125
}
3226
}

back-end/package.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,34 @@
3939
"dependencies": {
4040
"@hiero-ledger/proto": "catalog:",
4141
"@hiero-ledger/sdk": "catalog:",
42-
"@nest-lab/throttler-storage-redis": "1.1.1",
43-
"@nestjs/axios": "3.1.3",
44-
"@nestjs/cache-manager": "2.2.2",
45-
"@nestjs/common": "10.4.22",
46-
"@nestjs/config": "3.3.0",
47-
"@nestjs/core": "10.4.22",
48-
"@nestjs/jwt": "10.2.0",
49-
"@nestjs/microservices": "10.4.22",
50-
"@nestjs/passport": "10.0.3",
51-
"@nestjs/platform-express": "10.4.22",
52-
"@nestjs/platform-socket.io": "10.4.22",
53-
"@nestjs/schedule": "4.1.1",
54-
"@nestjs/swagger": "8.1.1",
42+
"@keyv/redis": "5.1.6",
43+
"@nest-lab/throttler-storage-redis": "1.2.0",
44+
"@nestjs/axios": "4.0.1",
45+
"@nestjs/cache-manager": "3.1.2",
46+
"@nestjs/common": "catalog:nestjs-core",
47+
"@nestjs/config": "4.0.4",
48+
"@nestjs/core": "catalog:nestjs-core",
49+
"@nestjs/jwt": "11.0.2",
50+
"@nestjs/microservices": "catalog:nestjs-core",
51+
"@nestjs/passport": "11.0.5",
52+
"@nestjs/platform-express": "catalog:nestjs-core",
53+
"@nestjs/platform-socket.io": "catalog:nestjs-core",
54+
"@nestjs/schedule": "6.1.3",
55+
"@nestjs/swagger": "11.4.2",
5556
"@nestjs/throttler": "6.5.0",
56-
"@nestjs/typeorm": "10.0.2",
57-
"@nestjs/websockets": "10.4.22",
57+
"@nestjs/typeorm": "11.0.1",
58+
"@nestjs/websockets": "catalog:nestjs-core",
5859
"argon2": "catalog:",
5960
"axios": "catalog:",
6061
"bcryptjs": "catalog:",
6162
"cache-manager": "7.2.8",
62-
"cache-manager-redis-yet": "5.1.5",
6363
"class-transformer": "0.5.1",
6464
"class-validator": "0.14.1",
6565
"dotenv": "catalog:",
6666
"express": "5.2.1",
6767
"ioredis": "5.10.1",
6868
"joi": "18.2.1",
69+
"keyv": "5.6.0",
6970
"murlock": "4.4.0",
7071
"nats": "2.29.3",
7172
"nest-winston": "1.10.2",
@@ -84,7 +85,7 @@
8485
"@hashgraph/hedera-local": "2.39.4",
8586
"@nestjs/cli": "11.0.16",
8687
"@nestjs/schematics": "11.0.9",
87-
"@nestjs/testing": "10.4.22",
88+
"@nestjs/testing": "catalog:nestjs-core",
8889
"@testcontainers/postgresql": "11.13.0",
8990
"@testcontainers/rabbitmq": "11.13.0",
9091
"@testcontainers/redis": "11.13.0",

0 commit comments

Comments
 (0)