feat: Add emitEvent step + cleanup (#7643)

* feat: Add emitEvent step + cleanup

* fix typo

* fix typo
This commit is contained in:
Adrien de Peretti
2024-06-07 11:52:19 +02:00
committed by GitHub
parent 3cd2d60daa
commit 2e77a076b8
19 changed files with 178 additions and 117 deletions

View File

@@ -5,7 +5,7 @@ import { Context, EventBusTypes } from "@medusajs/types"
*
* @example
* const createdFulfillment = eventBuilderFactory({
* service: Modules.FULFILLMENT,
* source: Modules.FULFILLMENT,
* action: CommonEvents.CREATED,
* object: "fulfillment",
* eventsEnum: FulfillmentEvents,
@@ -27,13 +27,13 @@ export function eventBuilderFactory({
action,
object,
eventsEnum,
service,
source,
}: {
isMainEntity?: boolean
action: string
object: string
eventsEnum: Record<string, string>
service: string
source: string
}) {
return function ({
data,
@@ -51,7 +51,7 @@ export function eventBuilderFactory({
data.forEach((dataItem) => {
messages.push({
service,
source,
action,
context: sharedContext,
data: { id: dataItem.id },