import 'reflect-metadata' ; import { Container , interfaces } from 'inversify' ; /**
 * `skipBaseClassChecks: true`
 * https://github.com/inversify/InversifyJS/blob/master/wiki/inheritance.md#workaround-e-skip-base-class-injectable-checks
 * is needed because of the abstract `EventRepository` class
 */ const container = new Container ( { skipBaseClassChecks : true } ) ; export const DI = { registerProviders : ( ... providers ) => providers . forEach ( p => container . bind ( p ) . toSelf ( ) ) , registerFactory : ( identifier , factory ) => container . bind ( identifier ) . toFactory ( factory ) , registerConstant : ( identifier , constant ) => container . bind ( identifier ) . toConstantValue ( constant ) , registerSingleton : ( identifier , provider ? ) => provider ? container . bind ( identifier ) . to ( provider ) . inSingletonScope ( ) : container . bind ( identifier ) . toSelf ( ) . inSingletonScope ( ) , registerSingletons : ( ... providers ) => providers . forEach ( p => container . bind ( p ) . to ( p ) . inSingletonScope ( ) ) , getProvider : ( provider ) : any => container . get ( provider ) , bootstrap : ( provider ) : any => container . get ( provider ) , overrideProvider : ( provider , newProvider ) => { container . unbind ( provider ) ; container . bind ( provider ) . to ( newProvider ) ; } , getContainer : ( ) => container , } ;