import { BindingScopeEnum , BindingTypeEnum } from "../constants/literal_types" ; import { interfaces } from "../interfaces/interfaces" ; import { id } from "../utils/id" ; class Binding < TActivated > implements interfaces . Binding < TActivated > { public id : number ; public moduleId ! : interfaces . ContainerModuleBase [ "id" ] ; public activated : boolean ; public serviceIdentifier : interfaces . ServiceIdentifier < TActivated > ; public implementationType : interfaces . Newable < TActivated > | TActivated | null ; public cache : TActivated | Promise < TActivated > | null ; public dynamicValue : interfaces . DynamicValue < TActivated > | null ; public scope : interfaces . BindingScope ; public type : interfaces . BindingType ; public factory : interfaces . FactoryCreator < unknown > | null ; public provider : interfaces . ProviderCreator < unknown > | null ; public constraint : interfaces . ConstraintFunction ; public onActivation : interfaces . BindingActivation < TActivated > | null ; public onDeactivation : interfaces . BindingDeactivation < TActivated > | null ; public constructor ( serviceIdentifier , scope ) { this . id = id ( ) ; this . activated = false ; this . serviceIdentifier = serviceIdentifier ; this . scope = scope ; this . type = BindingTypeEnum . Invalid ; this . constraint = ( request ) => true ; this . implementationType = null ; this . cache = null ; this . factory = null ; this . provider = null ; this . onActivation = null ; this . onDeactivation = null ; this . dynamicValue = null ; } public clone ( ) { const clone = new Binding ( this . serviceIdentifier , this . scope ) ; clone . activated = ( clone . scope === BindingScopeEnum . Singleton ) ? this . activated : false ; clone . implementationType = this . implementationType ; clone . dynamicValue = this . dynamicValue ; clone . scope = this . scope ; clone . type = this . type ; clone . factory = this . factory ; clone . provider = this . provider ; clone . constraint = this . constraint ; clone . onActivation = this . onActivation ; clone . onDeactivation = this . onDeactivation ; clone . cache = this . cache ; return clone ; } } export { Binding } ;