feat(medusa): Modules initializer (#3352)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { IEventBusService, IInventoryService } from "@medusajs/medusa"
|
||||
import {
|
||||
ExternalModuleDeclaration,
|
||||
InternalModuleDeclaration,
|
||||
MedusaModule,
|
||||
} from "@medusajs/modules-sdk"
|
||||
import { InventoryServiceInitializeOptions } from "../types"
|
||||
|
||||
export const initialize = async (
|
||||
options?: InventoryServiceInitializeOptions | ExternalModuleDeclaration,
|
||||
injectedDependencies?: {
|
||||
eventBusService: IEventBusService
|
||||
}
|
||||
): Promise<IInventoryService> => {
|
||||
const serviceKey = "inventoryService"
|
||||
const loaded = await MedusaModule.bootstrap(
|
||||
serviceKey,
|
||||
"@medusajs/inventory",
|
||||
options as InternalModuleDeclaration | ExternalModuleDeclaration,
|
||||
injectedDependencies
|
||||
)
|
||||
|
||||
return loaded[serviceKey] as IInventoryService
|
||||
}
|
||||
Reference in New Issue
Block a user