upgrade to NestJS 11 (#766)

* upgrade to nest 11

* update dependencies
This commit is contained in:
Philip Okugbe 2025-02-20 21:17:03 +00:00 committed by GitHub
parent 3e5cb92621
commit 64ecef09bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 2985 additions and 2570 deletions

View File

@ -28,47 +28,46 @@
"test:e2e": "jest --config test/jest-e2e.json"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.701.0",
"@aws-sdk/s3-request-presigner": "^3.701.0",
"@casl/ability": "^6.7.2",
"@fastify/cookie": "^9.4.0",
"@fastify/multipart": "^8.3.0",
"@fastify/static": "^7.0.4",
"@nestjs/bullmq": "^10.2.2",
"@nestjs/common": "^10.4.9",
"@nestjs/config": "^3.3.0",
"@nestjs/core": "^10.4.9",
"@nestjs/event-emitter": "^2.1.1",
"@nestjs/jwt": "^10.2.0",
"@nestjs/mapped-types": "^2.0.6",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-fastify": "^10.4.9",
"@nestjs/platform-socket.io": "^10.4.9",
"@nestjs/terminus": "^10.2.3",
"@nestjs/websockets": "^10.4.9",
"@aws-sdk/client-s3": "^3.750.0",
"@aws-sdk/s3-request-presigner": "^3.750.0",
"@casl/ability": "^6.7.3",
"@fastify/cookie": "^11.0.2",
"@fastify/multipart": "^9.0.3",
"@fastify/static": "^8.1.1",
"@nestjs/bullmq": "^11.0.2",
"@nestjs/common": "^11.0.10",
"@nestjs/config": "^4.0.0",
"@nestjs/core": "^11.0.10",
"@nestjs/event-emitter": "^3.0.0",
"@nestjs/jwt": "^11.0.0",
"@nestjs/mapped-types": "^2.1.0",
"@nestjs/passport": "^11.0.5",
"@nestjs/platform-fastify": "^11.0.10",
"@nestjs/platform-socket.io": "^11.0.10",
"@nestjs/terminus": "^11.0.0",
"@nestjs/websockets": "^11.0.10",
"@react-email/components": "0.0.28",
"@react-email/render": "^1.0.2",
"@socket.io/redis-adapter": "^8.3.0",
"bcrypt": "^5.1.1",
"bullmq": "^5.29.1",
"bullmq": "^5.41.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
"cookie": "^1.0.2",
"fix-esm": "^1.0.1",
"fs-extra": "^11.2.0",
"fs-extra": "^11.3.0",
"happy-dom": "^15.11.6",
"kysely": "^0.27.4",
"kysely": "^0.27.5",
"kysely-migration-cli": "^0.4.2",
"mime-types": "^2.1.35",
"nanoid": "^5.0.9",
"nestjs-kysely": "^1.0.0",
"nodemailer": "^6.9.16",
"nanoid": "^5.1.0",
"nestjs-kysely": "^1.1.0",
"nodemailer": "^6.10.0",
"passport-jwt": "^4.0.1",
"pg": "^8.13.1",
"pg": "^8.13.3",
"pg-tsquery": "^8.4.2",
"postmark": "^4.0.5",
"react": "^18.3.1",
"redis": "^4.7.0",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"sanitize-filename-ts": "^1.0.2",
@ -76,36 +75,36 @@
"ws": "^8.18.0"
},
"devDependencies": {
"@eslint/js": "^9.16.0",
"@nestjs/cli": "^10.4.8",
"@nestjs/schematics": "^10.2.3",
"@nestjs/testing": "^10.4.9",
"@eslint/js": "^9.20.0",
"@nestjs/cli": "^11.0.4",
"@nestjs/schematics": "^11.0.1",
"@nestjs/testing": "^11.0.10",
"@types/bcrypt": "^5.0.2",
"@types/debounce": "^1.2.4",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.14",
"@types/mime-types": "^2.1.4",
"@types/node": "^22.10.0",
"@types/node": "^22.13.4",
"@types/nodemailer": "^6.4.17",
"@types/passport-jwt": "^4.0.1",
"@types/pg": "^8.11.10",
"@types/pg": "^8.11.11",
"@types/supertest": "^6.0.2",
"@types/ws": "^8.5.13",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^15.13.0",
"@types/ws": "^8.5.14",
"eslint": "^9.20.1",
"eslint-config-prettier": "^10.0.1",
"globals": "^15.15.0",
"jest": "^29.7.0",
"kysely-codegen": "^0.17.0",
"prettier": "^3.4.1",
"prettier": "^3.5.1",
"react-email": "^3.0.2",
"source-map-support": "^0.5.21",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.1"
},
"jest": {
"moduleFileExtensions": [

View File

@ -1,31 +1,30 @@
import { InjectKysely } from 'nestjs-kysely';
import {
HealthCheckError,
HealthIndicator,
HealthIndicatorResult,
HealthIndicatorService,
} from '@nestjs/terminus';
import { Injectable, Logger } from '@nestjs/common';
import { sql } from 'kysely';
import { KyselyDB } from '@docmost/db/types/kysely.types';
@Injectable()
export class PostgresHealthIndicator extends HealthIndicator {
export class PostgresHealthIndicator {
private readonly logger = new Logger(PostgresHealthIndicator.name);
constructor(@InjectKysely() private readonly db: KyselyDB) {
super();
}
constructor(
private readonly healthIndicatorService: HealthIndicatorService,
@InjectKysely() private readonly db: KyselyDB,
) {}
async pingCheck(key: string): Promise<HealthIndicatorResult> {
const indicator = this.healthIndicatorService.check(key);
try {
await sql`SELECT 1=1`.execute(this.db);
return this.getStatus(key, true);
return indicator.up();
} catch (e) {
this.logger.error(JSON.stringify(e));
throw new HealthCheckError(
`${key} is not available`,
this.getStatus(key, false),
);
return indicator.down(`${key} is not available`);
}
}
}

View File

@ -1,21 +1,23 @@
import {
HealthCheckError,
HealthIndicator,
HealthIndicatorResult,
HealthIndicatorService,
} from '@nestjs/terminus';
import { Injectable, Logger } from '@nestjs/common';
import { EnvironmentService } from '../environment/environment.service';
import { Redis } from 'ioredis';
@Injectable()
export class RedisHealthIndicator extends HealthIndicator {
export class RedisHealthIndicator {
private readonly logger = new Logger(RedisHealthIndicator.name);
constructor(private environmentService: EnvironmentService) {
super();
}
constructor(
private readonly healthIndicatorService: HealthIndicatorService,
private environmentService: EnvironmentService,
) {}
async pingCheck(key: string): Promise<HealthIndicatorResult> {
const indicator = this.healthIndicatorService.check(key);
try {
const redis = new Redis(this.environmentService.getRedisUrl(), {
maxRetriesPerRequest: 15,
@ -23,13 +25,10 @@ export class RedisHealthIndicator extends HealthIndicator {
await redis.ping();
redis.disconnect();
return this.getStatus(key, true);
return indicator.up();
} catch (e) {
this.logger.error(e);
throw new HealthCheckError(
`${key} is not available`,
this.getStatus(key, false),
);
return indicator.down(`${key} is not available`);
}
}
}

View File

@ -61,23 +61,23 @@
"bytes": "^3.1.2",
"cross-env": "^7.0.3",
"date-fns": "^4.1.0",
"dompurify": "^3.2.1",
"dompurify": "^3.2.4",
"fractional-indexing-jittered": "^1.0.0",
"ioredis": "^5.4.1",
"jszip": "^3.10.1",
"linkifyjs": "^4.2.0",
"marked": "^13.0.3",
"uuid": "^11.0.3",
"uuid": "^11.1.0",
"y-indexeddb": "^9.0.12",
"yjs": "^13.6.20"
},
"devDependencies": {
"@nx/js": "20.1.3",
"@types/bytes": "^3.1.4",
"@nx/js": "20.4.5",
"@types/bytes": "^3.1.5",
"@types/uuid": "^10.0.0",
"concurrently": "^9.1.0",
"nx": "20.1.3",
"tsx": "^4.19.2"
"concurrently": "^9.1.2",
"nx": "20.4.5",
"tsx": "^4.19.3"
},
"workspaces": {
"packages": [

5420
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff