import { DIContainer } from './DIContainer' ; import type { IServiceCollection , IServiceConstructor , IServiceInjector } from './IApp' ; import type { ValueToken } from './InjectionToken' ; export interface IDiWrapper { injector : IServiceInjector ; collection : IServiceCollection ; registerChildContainer : ( container : DIContainer ) => void ; } const mainContainer = new DIContainer ( ) ; export const inversifyWrapper = { injector : { getServiceByClass < T > ( ctor ) { return mainContainer . getServiceByClass ( ctor ) ; } , getServiceByToken < T > ( token ) { return mainContainer . getServiceByToken ( token ) ; } , resolveServiceByClass < T > ( ctor ) { return mainContainer . resolveServiceByClass ( ctor ) ; } , } , collection : { addServiceByClass ( Ctor ) { mainContainer . addServiceByClass ( Ctor ) ; } , addServiceByToken < T extends Record < string , unknown > > ( token , value ) { mainContainer . addServiceByToken ( token , value ) ; } , } , registerChildContainer ( container ) { container . bindWithParent ( mainContainer ) ; } , } ;