feat(core, event-bus): Compensate emit event step utility (#13281)

* feat(core, event-bus): Compensate emit event step utility

* tests

* Update changeset to remove integration-tests-modules

Removed integration-tests-modules from changeset.

* revert test script
This commit is contained in:
Adrien de Peretti
2025-08-25 15:08:09 +02:00
committed by GitHub
parent 73a25abecb
commit fc49253273
11 changed files with 547 additions and 22 deletions
@@ -5,6 +5,7 @@ import {
import { Modules } from "@medusajs/framework/utils"
import {
StepExecutionContext,
StepResponse,
createStep,
} from "@medusajs/framework/workflows-sdk"
@@ -85,6 +86,25 @@ export const emitEventStep = createStep(
}
await eventBus.emit(message)
return new StepResponse({
eventGroupId: context.eventGroupId,
eventName: input.eventName,
})
},
async (data: void) => {}
async (data, context) => {
if (!data || !data?.eventGroupId) {
return
}
const { container } = context
const eventBus: IEventBusModuleService = container.resolve(
Modules.EVENT_BUS
)
await eventBus.clearGroupedEvents(data!.eventGroupId, {
eventNames: [data!.eventName],
})
}
)