Skip to content

Commit

Permalink
refactor(typeorm): remove deprecated function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunnerLivio committed Jun 26, 2022
1 parent 280527f commit d119647
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/health-indicator/database/typeorm.health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ export class TypeOrmHealthIndicator extends HealthIndicator {
/**
* Returns the connection of the current DI context
*/
private getContextConnection(): TypeOrm.Connection | null {
const { getConnectionToken } =
private getContextConnection(): TypeOrm.DataSource | null {
const { getDataSourceToken } =
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('@nestjs/typeorm/dist/common/typeorm.utils') as typeof NestJSTypeOrm;

try {
return this.moduleRef.get(getConnectionToken() as string, {
return this.moduleRef.get(getDataSourceToken(), {
strict: false,
});
} catch (err) {
Expand All @@ -75,7 +75,7 @@ export class TypeOrmHealthIndicator extends HealthIndicator {
private async checkMongoDBConnection(connection: any) {
return new Promise<void>((resolve, reject) => {
const driver = connection.driver as any;
// Hacky workaround which uses the native MongoClient
// FIXME: Hacky workaround which uses the native MongoClient
driver.mongodb.MongoClient.connect(
connection.options.url
? connection.options.url
Expand Down Expand Up @@ -131,7 +131,7 @@ export class TypeOrmHealthIndicator extends HealthIndicator {
let isHealthy = false;
this.checkDependantPackages();

const connection: TypeOrm.Connection | null =
const connection: TypeOrm.DataSource | null =
options.connection || this.getContextConnection();
const timeout = options.timeout || 1000;

Expand Down

0 comments on commit d119647

Please sign in to comment.