(
instance: T,
moduleRef: Module,
collection: Map<InjectionToken, InstanceWrapper>,
ctx: ContextId,
wrapper?: InstanceWrapper,
)
| 888 | } |
| 889 | |
| 890 | public async loadPerContext<T = any>( |
| 891 | instance: T, |
| 892 | moduleRef: Module, |
| 893 | collection: Map<InjectionToken, InstanceWrapper>, |
| 894 | ctx: ContextId, |
| 895 | wrapper?: InstanceWrapper, |
| 896 | ): Promise<T> { |
| 897 | if (!wrapper) { |
| 898 | const injectionToken = (instance as any).constructor!; |
| 899 | wrapper = collection.get(injectionToken); |
| 900 | } else { |
| 901 | wrapper = collection.get(wrapper.token) ?? wrapper; |
| 902 | } |
| 903 | await this.loadInstance( |
| 904 | wrapper!, |
| 905 | collection, |
| 906 | moduleRef, |
| 907 | this.createResolutionContext(ctx, wrapper), |
| 908 | ); |
| 909 | await this.loadEnhancersPerContext(wrapper!, ctx, wrapper); |
| 910 | |
| 911 | const host = wrapper!.getInstanceByContextId( |
| 912 | this.getContextId(ctx, wrapper!), |
| 913 | wrapper!.id, |
| 914 | ); |
| 915 | return host && (host.instance as T); |
| 916 | } |
| 917 | |
| 918 | public async loadEnhancersPerContext( |
| 919 | wrapper: InstanceWrapper, |
no test coverage detected