feat: Add emitEvent step + cleanup (#7643)
* feat: Add emitEvent step + cleanup * fix typo * fix typo
This commit is contained in:
committed by
GitHub
parent
3cd2d60daa
commit
2e77a076b8
@@ -14,7 +14,7 @@ export function buildExpectedEventMessageShape(options: {
|
||||
metadata: {
|
||||
action: options.action,
|
||||
eventGroupId: options.eventGroupId,
|
||||
service: "fulfillment",
|
||||
source: "fulfillment",
|
||||
object: options.object,
|
||||
},
|
||||
data: options.data,
|
||||
|
||||
@@ -17,154 +17,154 @@ import {
|
||||
|
||||
export const eventBuilders = {
|
||||
createdFulfillment: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "fulfillment",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedFulfillment: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "fulfillment",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdFulfillmentAddress: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "fulfillment_address",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdFulfillmentItem: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "fulfillment_item",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdFulfillmentLabel: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "fulfillment_label",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedFulfillmentLabel: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "fulfillment_label",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
deletedFulfillmentLabel: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "fulfillment_label",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdShippingProfile: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "shipping_profile",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdShippingOptionType: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "shipping_option_type",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedShippingOptionType: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "shipping_option_type",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
deletedShippingOptionType: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "shipping_option_type",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdShippingOptionRule: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "shipping_option_rule",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedShippingOptionRule: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "shipping_option_rule",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
deletedShippingOptionRule: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "shipping_option_rule",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdShippingOption: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "shipping_option",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedShippingOption: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "shipping_option",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdFulfillmentSet: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "fulfillment_set",
|
||||
isMainEntity: true,
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedFulfillmentSet: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "fulfillment_set",
|
||||
isMainEntity: true,
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
deletedFulfillmentSet: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "fulfillment_set",
|
||||
isMainEntity: true,
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdServiceZone: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "service_zone",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedServiceZone: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "service_zone",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
deletedServiceZone: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "service_zone",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
createdGeoZone: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "geo_zone",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
updatedGeoZone: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "geo_zone",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
}),
|
||||
deletedGeoZone: eventBuilderFactory({
|
||||
service: Modules.FULFILLMENT,
|
||||
source: Modules.FULFILLMENT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "geo_zone",
|
||||
eventsEnum: FulfillmentEvents,
|
||||
|
||||
@@ -10,17 +10,17 @@ import {
|
||||
ReservationItemDTO,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
arrayDifference,
|
||||
CommonEvents,
|
||||
EmitEvents,
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
InventoryEvents,
|
||||
isDefined,
|
||||
isString,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
ModulesSdkUtils,
|
||||
arrayDifference,
|
||||
isDefined,
|
||||
isString,
|
||||
partitionArray,
|
||||
promiseAll,
|
||||
} from "@medusajs/utils"
|
||||
@@ -241,7 +241,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
created.map((reservationItem) => ({
|
||||
eventName: InventoryEvents.reservation_item_created,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "reservation-item",
|
||||
context,
|
||||
@@ -340,7 +340,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
result.map((inventoryItem) => ({
|
||||
eventName: InventoryEvents.created,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "inventory-item",
|
||||
context,
|
||||
@@ -393,7 +393,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
created.map((inventoryLevel) => ({
|
||||
eventName: InventoryEvents.inventory_level_created,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "inventory-level",
|
||||
context,
|
||||
@@ -453,7 +453,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
result.map((inventoryItem) => ({
|
||||
eventName: InventoryEvents.updated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "inventory-item",
|
||||
context,
|
||||
@@ -492,7 +492,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
result[0].map((inventoryLevel) => ({
|
||||
eventName: InventoryEvents.inventory_level_deleted,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "inventory-level",
|
||||
context,
|
||||
@@ -523,7 +523,7 @@ export default class InventoryModuleService<
|
||||
|
||||
context.messageAggregator?.saveRawMessageData({
|
||||
eventName: InventoryEvents.inventory_level_deleted,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "inventory-level",
|
||||
context,
|
||||
@@ -565,7 +565,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
levels.map((inventoryLevel) => ({
|
||||
eventName: InventoryEvents.inventory_level_updated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "inventory-level",
|
||||
context,
|
||||
@@ -648,7 +648,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
result.map((reservationItem) => ({
|
||||
eventName: InventoryEvents.inventory_level_updated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "reservation-item",
|
||||
context,
|
||||
@@ -801,7 +801,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
reservations.map((reservationItem) => ({
|
||||
eventName: InventoryEvents.reservation_item_deleted,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "reservation-item",
|
||||
context,
|
||||
@@ -843,7 +843,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
reservations.map((reservationItem) => ({
|
||||
eventName: InventoryEvents.reservation_item_deleted,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "reservation-item",
|
||||
context,
|
||||
@@ -880,7 +880,7 @@ export default class InventoryModuleService<
|
||||
context.messageAggregator?.saveRawMessageData(
|
||||
reservations.map((reservationItem) => ({
|
||||
eventName: InventoryEvents.reservation_item_created,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "reservation-item",
|
||||
context,
|
||||
@@ -949,7 +949,7 @@ export default class InventoryModuleService<
|
||||
|
||||
context.messageAggregator?.saveRawMessageData({
|
||||
eventName: InventoryEvents.inventory_level_updated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "inventory-level",
|
||||
context,
|
||||
|
||||
@@ -13,12 +13,12 @@ import {
|
||||
CommonEvents,
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
isDefined,
|
||||
mapObjectTo,
|
||||
MapToConfig,
|
||||
MedusaContext,
|
||||
MedusaError,
|
||||
ModulesSdkUtils,
|
||||
isDefined,
|
||||
mapObjectTo,
|
||||
} from "@medusajs/utils"
|
||||
import { LinkService } from "@services"
|
||||
import { shouldForceTransaction } from "../utils"
|
||||
@@ -210,7 +210,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
eventName: this.entityName_ + "." + CommonEvents.ATTACHED,
|
||||
body: {
|
||||
metadata: {
|
||||
service: this.serviceName_,
|
||||
source: this.serviceName_,
|
||||
action: CommonEvents.ATTACHED,
|
||||
object: this.entityName_,
|
||||
eventGroupId: sharedContext.eventGroupId,
|
||||
@@ -263,7 +263,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
eventName: this.entityName_ + "." + CommonEvents.DETACHED,
|
||||
body: {
|
||||
metadata: {
|
||||
service: this.serviceName_,
|
||||
source: this.serviceName_,
|
||||
action: CommonEvents.DETACHED,
|
||||
object: this.entityName_,
|
||||
eventGroupId: sharedContext.eventGroupId,
|
||||
@@ -314,7 +314,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
eventName: this.entityName_ + "." + CommonEvents.DETACHED,
|
||||
body: {
|
||||
metadata: {
|
||||
service: this.serviceName_,
|
||||
source: this.serviceName_,
|
||||
action: CommonEvents.DETACHED,
|
||||
object: this.entityName_,
|
||||
eventGroupId: sharedContext.eventGroupId,
|
||||
@@ -374,7 +374,7 @@ export default class LinkModuleService<TLink> implements ILinkModule {
|
||||
eventName: this.entityName_ + "." + CommonEvents.ATTACHED,
|
||||
body: {
|
||||
metadata: {
|
||||
service: this.serviceName_,
|
||||
source: this.serviceName_,
|
||||
action: CommonEvents.ATTACHED,
|
||||
object: this.entityName_,
|
||||
eventGroupId: sharedContext.eventGroupId,
|
||||
|
||||
@@ -508,7 +508,7 @@ moduleIntegrationTestRunner({
|
||||
expect(events).toHaveLength(4)
|
||||
expect(events[0]).toEqual(
|
||||
composeMessage(PricingEvents.price_list_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_list",
|
||||
data: { id: priceList.id },
|
||||
@@ -516,7 +516,7 @@ moduleIntegrationTestRunner({
|
||||
)
|
||||
expect(events[1]).toEqual(
|
||||
composeMessage(PricingEvents.price_list_rule_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_list_rule",
|
||||
data: { id: priceList.price_list_rules?.[0].id },
|
||||
@@ -524,7 +524,7 @@ moduleIntegrationTestRunner({
|
||||
)
|
||||
expect(events[2]).toEqual(
|
||||
composeMessage(PricingEvents.price_list_rule_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_list_rule",
|
||||
data: { id: priceList.price_list_rules?.[1].id },
|
||||
@@ -532,7 +532,7 @@ moduleIntegrationTestRunner({
|
||||
)
|
||||
expect(events[3]).toEqual(
|
||||
composeMessage(PricingEvents.price_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price",
|
||||
data: { id: priceList.prices![0].id },
|
||||
@@ -867,7 +867,7 @@ moduleIntegrationTestRunner({
|
||||
expect(events).toHaveLength(2)
|
||||
expect(events[0]).toEqual(
|
||||
composeMessage(PricingEvents.price_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price",
|
||||
data: { id: priceList.prices![0].id },
|
||||
@@ -875,7 +875,7 @@ moduleIntegrationTestRunner({
|
||||
)
|
||||
expect(events[1]).toEqual(
|
||||
composeMessage(PricingEvents.price_rule_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_rule",
|
||||
data: { id: priceList.prices![0].price_rules![0].id },
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "medusa-test-utils"
|
||||
import { PriceSetRuleType } from "../../../../src"
|
||||
import { seedPriceData } from "../../../__fixtures__/seed-price-data"
|
||||
import { CommonEvents, PricingEvents, composeMessage } from "@medusajs/utils"
|
||||
import { CommonEvents, composeMessage, PricingEvents } from "@medusajs/utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
@@ -446,7 +446,7 @@ moduleIntegrationTestRunner({
|
||||
expect(events).toHaveLength(3)
|
||||
expect(events[0]).toEqual(
|
||||
composeMessage(PricingEvents.price_set_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_set",
|
||||
data: { id: priceSet.id },
|
||||
@@ -455,7 +455,7 @@ moduleIntegrationTestRunner({
|
||||
|
||||
expect(events[1]).toEqual(
|
||||
composeMessage(PricingEvents.price_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price",
|
||||
data: { id: priceSet.prices![0].id },
|
||||
@@ -464,7 +464,7 @@ moduleIntegrationTestRunner({
|
||||
|
||||
expect(events[2]).toEqual(
|
||||
composeMessage(PricingEvents.price_rule_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_rule",
|
||||
data: {
|
||||
@@ -694,7 +694,7 @@ moduleIntegrationTestRunner({
|
||||
expect(events).toHaveLength(2)
|
||||
expect(events[0]).toEqual(
|
||||
composeMessage(PricingEvents.price_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price",
|
||||
data: { id: priceSet.prices![1].id },
|
||||
@@ -702,7 +702,7 @@ moduleIntegrationTestRunner({
|
||||
)
|
||||
expect(events[1]).toEqual(
|
||||
composeMessage(PricingEvents.price_rule_created, {
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_rule",
|
||||
data: { id: priceSet.prices![1].price_rules[0].id },
|
||||
|
||||
@@ -1,50 +1,49 @@
|
||||
import {} from "@models"
|
||||
import {
|
||||
Modules,
|
||||
CommonEvents,
|
||||
PricingEvents,
|
||||
eventBuilderFactory,
|
||||
Modules,
|
||||
PricingEvents,
|
||||
} from "@medusajs/utils"
|
||||
|
||||
export const eventBuilders = {
|
||||
createdPriceSet: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_set",
|
||||
eventsEnum: PricingEvents,
|
||||
}),
|
||||
createdPriceSetRuleType: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_set_rule_type",
|
||||
eventsEnum: PricingEvents,
|
||||
}),
|
||||
createdPrice: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price",
|
||||
eventsEnum: PricingEvents,
|
||||
}),
|
||||
createdPriceRule: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_rule",
|
||||
eventsEnum: PricingEvents,
|
||||
}),
|
||||
createdPriceList: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_list",
|
||||
eventsEnum: PricingEvents,
|
||||
}),
|
||||
createdPriceListRule: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "price_list_rule",
|
||||
eventsEnum: PricingEvents,
|
||||
}),
|
||||
attachedPriceListRule: eventBuilderFactory({
|
||||
service: Modules.PRICING,
|
||||
source: Modules.PRICING,
|
||||
action: CommonEvents.ATTACHED,
|
||||
object: "price_list_rule",
|
||||
eventsEnum: PricingEvents,
|
||||
|
||||
@@ -279,7 +279,7 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
composeMessage(ProductEvents.product_tag_updated, {
|
||||
data: { id: productTag.id },
|
||||
object: "product_tag",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
}),
|
||||
])
|
||||
@@ -321,7 +321,7 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
composeMessage(ProductEvents.product_tag_created, {
|
||||
data: { id: productTag[0].id },
|
||||
object: "product_tag",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
}),
|
||||
])
|
||||
@@ -375,13 +375,13 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
composeMessage(ProductEvents.product_tag_created, {
|
||||
data: { id: newTag.id },
|
||||
object: "product_tag",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
}),
|
||||
composeMessage(ProductEvents.product_tag_updated, {
|
||||
data: { id: updatedTag.id },
|
||||
object: "product_tag",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -211,7 +211,7 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
composeMessage(ProductEvents.product_variant_updated, {
|
||||
data: { id: variantOne.id },
|
||||
object: "product_variant",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
}),
|
||||
])
|
||||
@@ -241,7 +241,7 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
composeMessage(ProductEvents.product_variant_updated, {
|
||||
data: { id: variantOne.id },
|
||||
object: "product_variant",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
}),
|
||||
])
|
||||
@@ -312,7 +312,7 @@ moduleIntegrationTestRunner<IProductModuleService>({
|
||||
composeMessage(ProductEvents.product_variant_created, {
|
||||
data: { id: variant.id },
|
||||
object: "product_variant",
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
}),
|
||||
])
|
||||
|
||||
@@ -7,94 +7,94 @@ import {
|
||||
|
||||
export const eventBuilders = {
|
||||
createdProduct: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "product",
|
||||
eventsEnum: ProductEvents,
|
||||
isMainEntity: true,
|
||||
}),
|
||||
updatedProduct: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "product",
|
||||
eventsEnum: ProductEvents,
|
||||
isMainEntity: true,
|
||||
}),
|
||||
deletedProduct: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "product",
|
||||
eventsEnum: ProductEvents,
|
||||
isMainEntity: true,
|
||||
}),
|
||||
createdProductVariant: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "product_variant",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
updatedProductVariant: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "product_variant",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
deletedProductVariant: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "product_variant",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
createdProductOption: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "product_option",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
updatedProductOption: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "product_option",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
deletedProductOption: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "product_option",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
createdProductType: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "product_type",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
updatedProductType: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "product_type",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
deletedProductType: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "product_type",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
createdProductTag: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "product_tag",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
updatedProductTag: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "product_tag",
|
||||
eventsEnum: ProductEvents,
|
||||
}),
|
||||
deletedProductTag: eventBuilderFactory({
|
||||
service: Modules.PRODUCT,
|
||||
source: Modules.PRODUCT,
|
||||
action: CommonEvents.DELETED,
|
||||
object: "product_tag",
|
||||
eventsEnum: ProductEvents,
|
||||
|
||||
@@ -94,7 +94,7 @@ export default class UserModuleService<
|
||||
sharedContext.messageAggregator?.saveRawMessageData(
|
||||
invites.map((invite) => ({
|
||||
eventName: UserEvents.invite_token_generated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: "token_generated",
|
||||
object: "invite",
|
||||
context: sharedContext,
|
||||
@@ -149,7 +149,7 @@ export default class UserModuleService<
|
||||
sharedContext.messageAggregator?.saveRawMessageData(
|
||||
users.map((user) => ({
|
||||
eventName: UserEvents.created,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "user",
|
||||
context: sharedContext,
|
||||
@@ -188,7 +188,7 @@ export default class UserModuleService<
|
||||
sharedContext.messageAggregator?.saveRawMessageData(
|
||||
updatedUsers.map((user) => ({
|
||||
eventName: UserEvents.updated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "user",
|
||||
context: sharedContext,
|
||||
@@ -227,7 +227,7 @@ export default class UserModuleService<
|
||||
sharedContext.messageAggregator?.saveRawMessageData(
|
||||
invites.map((invite) => ({
|
||||
eventName: UserEvents.invite_created,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.CREATED,
|
||||
object: "invite",
|
||||
context: sharedContext,
|
||||
@@ -238,7 +238,7 @@ export default class UserModuleService<
|
||||
sharedContext.messageAggregator?.saveRawMessageData(
|
||||
invites.map((invite) => ({
|
||||
eventName: UserEvents.invite_token_generated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: "token_generated",
|
||||
object: "invite",
|
||||
context: sharedContext,
|
||||
@@ -296,7 +296,7 @@ export default class UserModuleService<
|
||||
sharedContext.messageAggregator?.saveRawMessageData(
|
||||
serializedInvites.map((invite) => ({
|
||||
eventName: UserEvents.invite_updated,
|
||||
service: this.constructor.name,
|
||||
source: this.constructor.name,
|
||||
action: CommonEvents.UPDATED,
|
||||
object: "invite",
|
||||
context: sharedContext,
|
||||
|
||||
Reference in New Issue
Block a user