* chore: ability to group events on redis event bus * chore: fix tests * Update packages/modules/event-bus-redis/src/services/event-bus-redis.ts Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com> * chore: change shape of input and body data * chore: fix builds * chore: address comments * chore: fix unit test --------- Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
23 lines
520 B
TypeScript
23 lines
520 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,
|
|
metadata: {
|
|
action: options.action,
|
|
eventGroupId: options.eventGroupId,
|
|
source: "fulfillment",
|
|
object: options.object,
|
|
},
|
|
data: options.data,
|
|
options: options.options,
|
|
}
|
|
}
|