fix(utils): Uppercase event action name (#7822)

Currently, the keys of the events contain a lowercased action, e.g. `INVENTORY_ITEM_created`, which is breaking our usage across multiple modules
This commit is contained in:
Oli Juhl
2024-06-24 17:43:49 +00:00
committed by GitHub
parent 96fb7a962e
commit 25210369d9
4 changed files with 43 additions and 4 deletions
@@ -46,13 +46,17 @@ export function eventBuilderFactory({
const aggregator = sharedContext.messageAggregator!
const messages: EventBusTypes.RawMessageFormat[] = []
// The event enums contains event formatted like so [object]_[action] e.g. PRODUCT_CREATED
// We expect the keys of events to be fully uppercased
const eventName = eventsEnum[`${object.toUpperCase()}_${action.toUpperCase()}`]
data.forEach((dataItem) => {
messages.push({
source,
action,
context: sharedContext,
data: { id: dataItem.id },
eventName: eventsEnum[`${object}_${action}`],
eventName,
object,
})
})