Feat: Move container bindings declaration merging within the framework (#9467)
This commit is contained in:
@@ -6,7 +6,13 @@ import {
|
||||
TransactionHandlerType,
|
||||
TransactionState,
|
||||
} from "@medusajs/orchestration"
|
||||
import { Context, LoadedModule, MedusaContainer } from "@medusajs/types"
|
||||
import {
|
||||
Context,
|
||||
IEventBusModuleService,
|
||||
LoadedModule,
|
||||
Logger,
|
||||
MedusaContainer,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
isPresent,
|
||||
@@ -514,7 +520,7 @@ function attachOnFinishReleaseEvents(
|
||||
const flowEventGroupId = transaction.getFlow().metadata?.eventGroupId
|
||||
|
||||
const logger =
|
||||
(flow.container as MedusaContainer).resolve(
|
||||
(flow.container as MedusaContainer).resolve<Logger>(
|
||||
ContainerRegistrationKeys.LOGGER,
|
||||
{ allowUnregistered: true }
|
||||
) || console
|
||||
@@ -539,10 +545,11 @@ function attachOnFinishReleaseEvents(
|
||||
|
||||
await onFinish?.(args)
|
||||
|
||||
const eventBusService = (flow.container as MedusaContainer).resolve(
|
||||
Modules.EVENT_BUS,
|
||||
{ allowUnregistered: true }
|
||||
)
|
||||
const eventBusService = (
|
||||
flow.container as MedusaContainer
|
||||
).resolve<IEventBusModuleService>(Modules.EVENT_BUS, {
|
||||
allowUnregistered: true,
|
||||
})
|
||||
|
||||
if (!eventBusService || !flowEventGroupId) {
|
||||
return
|
||||
|
||||
@@ -2216,7 +2216,9 @@ describe("Workflow composer", function () {
|
||||
throwOnError: false,
|
||||
})
|
||||
|
||||
const eventBusMock = container.resolve(Modules.EVENT_BUS)
|
||||
const eventBusMock = container.resolve<IEventBusModuleService>(
|
||||
Modules.EVENT_BUS
|
||||
)
|
||||
|
||||
expect(eventBusMock.emit).toHaveBeenCalledTimes(1)
|
||||
expect(eventBusMock.releaseGroupedEvents).toHaveBeenCalledTimes(0)
|
||||
|
||||
Reference in New Issue
Block a user