title: Connection "default" was not found - TypeORM, NestJS and external NPM Package
body: <p>I'm using NestJs to create a couple of applications and I want to move the code from a NestInterceptor for an external NPM Package so I can use the same interceptor in multiple applications.</p>
  
  <p>The problem is that the same code that works when used "locally" just stop working when moved to the external package.</p>
  
  <p>Here's the code for the interceptor:</p>
  
  <pre><code>import { Injectable, NestInterceptor, CallHandler, ExecutionContext } from '@nestjs/common'
  import { map } from 'rxjs/operators'
  import { getManager } from 'typeorm'
  import jwt_decode from 'jwt-decode'
  
  @Injectable()
  export class MyInterceptor implements NestInterceptor {
    entity: any
  
    constructor(entity: any) {
      this.entity = entity
    }
  
    async intercept(context: ExecutionContext, next: CallHandler): Promise&lt;any&gt; {
  
      const request = context.switchToHttp().getRequest()
  
      const repository = getManager().getRepository(this.entity)
  
      return next.handle().pipe(map((data) =&gt; data))
    }
  }
  </code></pre>
  
  <p>Here's a given controller:</p>
  
  <pre><code>import { myInterceptor } from "../src/interceptors/interceptor.ts";
  
  @UseInterceptors(new CompanyIdInterceptor(User))
  export class UserController {
  }
  </code></pre>
  
  <p>This works fine, but if a move the file to an external NPM package and import from it like this:</p>
  
  <pre><code>import { myInterceptor } from "mynpmpackage";
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>[Nest] 24065   - 04/18/2019, 10:04 AM   [ExceptionsHandler] Connection "default" was not found. +26114ms
  ConnectionNotFoundError: Connection "default" was not found.
      at new ConnectionNotFoundError (/home/andre/Services/npm-sdk/src/error/ConnectionNotFoundError.ts:8:9)
      at ConnectionManager.get (/home/andre/Services/npm-sdk/src/connection/ConnectionManager.ts:40:19)
  </code></pre>
  
  <p>Any ideas, on what causes this and how to solve it?</p>