feat: loosely typed container

This commit is contained in:
Harminder Virk
2024-05-31 15:22:03 +05:30
committed by GitHub
parent 2d956931b3
commit 11528526fa
41 changed files with 255 additions and 114 deletions

View File

@@ -1,5 +1,6 @@
import {
Constructor,
IModuleService,
InternalModuleDeclaration,
Logger,
MedusaContainer,
@@ -158,9 +159,9 @@ export async function loadInternalModule(
if (loaderOnly) {
// The expectation is only to run the loader as standalone, so we do not need to register the service and we need to cleanup all services
const service = container.resolve(registrationName)
await service.__hooks?.onApplicationPrepareShutdown()
await service.__hooks?.onApplicationShutdown()
const service = container.resolve<IModuleService>(registrationName)
await service.__hooks?.onApplicationPrepareShutdown?.()
await service.__hooks?.onApplicationShutdown?.()
}
}