feat: restructure events payload (#8143)
* refactor: restructure events payload Breaking change: This PR changes the event payload accepted by the event listeners * refactor: fix failing tests and implement feedback * add integration tests * fix timeout --------- Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
This commit is contained in:
co-authored by
Adrien de Peretti
parent
5813216c88
commit
f579f0b3be
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
Event,
|
||||
IEventBusModuleService,
|
||||
MedusaContainer,
|
||||
MessageBody,
|
||||
Subscriber,
|
||||
} from "@medusajs/types"
|
||||
import { kebabCase, ModuleRegistrationName } from "@medusajs/utils"
|
||||
@@ -193,10 +193,9 @@ export class SubscriberLoader {
|
||||
const subscriberId = this.inferIdentifier(fileName, config, handler)
|
||||
|
||||
for (const e of events) {
|
||||
const subscriber = async (data: MessageBody<T>) => {
|
||||
const subscriber = async (data: T) => {
|
||||
return await handler({
|
||||
eventName: e,
|
||||
data,
|
||||
event: { name: e, ...data } as unknown as Event<T>,
|
||||
container: this.container_,
|
||||
pluginOptions: this.pluginOptions_,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user