()
| 664 | } |
| 665 | |
| 666 | public applyApplicationProviders() { |
| 667 | const applyProvidersMap = this.getApplyProvidersMap(); |
| 668 | const applyRequestProvidersMap = this.getApplyRequestProvidersMap(); |
| 669 | |
| 670 | const getInstanceWrapper = ( |
| 671 | moduleKey: string, |
| 672 | providerKey: string, |
| 673 | collectionKey: 'providers' | 'injectables', |
| 674 | ) => { |
| 675 | const modules = this.container.getModules(); |
| 676 | const collection = modules.get(moduleKey)![collectionKey]; |
| 677 | return collection.get(providerKey); |
| 678 | }; |
| 679 | |
| 680 | // Add global enhancers to the application config |
| 681 | this.applicationProvidersApplyMap.forEach( |
| 682 | ({ moduleKey, providerKey, type, scope }) => { |
| 683 | let instanceWrapper: InstanceWrapper; |
| 684 | if (this.isRequestOrTransient(scope!)) { |
| 685 | instanceWrapper = getInstanceWrapper( |
| 686 | moduleKey, |
| 687 | providerKey, |
| 688 | 'injectables', |
| 689 | )!; |
| 690 | |
| 691 | this.graphInspector.insertAttachedEnhancer(instanceWrapper); |
| 692 | return applyRequestProvidersMap[type as string](instanceWrapper); |
| 693 | } |
| 694 | instanceWrapper = getInstanceWrapper( |
| 695 | moduleKey, |
| 696 | providerKey, |
| 697 | 'providers', |
| 698 | )!; |
| 699 | this.graphInspector.insertAttachedEnhancer(instanceWrapper); |
| 700 | applyProvidersMap[type as string](instanceWrapper.instance); |
| 701 | }, |
| 702 | ); |
| 703 | } |
| 704 | |
| 705 | public getApplyProvidersMap(): { [type: string]: Function } { |
| 706 | return { |
no test coverage detected