**What** This pr includes some cleanup and refactoring around the abstract event emitter method for the module service to not rely on a named class property but instead on resolution naming. Includes fulfillment set events on creation. The idea is that if that pr allows us to align and agreed on the approach as well as including the cleanup for other pr to use, If this gets merged I ll continue with another pr to do the rest of the event management partially fix CORE-1735
25 lines
554 B
TypeScript
25 lines
554 B
TypeScript
import { EventBusTypes } from "@medusajs/types"
|
|
|
|
export function buildExpectedEventMessageShape(options: {
|
|
eventName: string
|
|
action: string
|
|
object: string
|
|
eventGroupId?: string
|
|
data: any
|
|
options?: Record<string, unknown>
|
|
}): EventBusTypes.Message {
|
|
return {
|
|
eventName: options.eventName,
|
|
body: {
|
|
metadata: {
|
|
action: options.action,
|
|
eventGroupId: options.eventGroupId,
|
|
service: "fulfillment",
|
|
object: options.object,
|
|
},
|
|
data: options.data,
|
|
},
|
|
options: options.options,
|
|
}
|
|
}
|