chore: Treat internal event differently, primarely do not display info logs for those events (#8767)

* chore: Treat internal event differently, primarely do not display info log for those events

* revert doc

* add few tests

* only set internal option if present

* revert to previous condition

* start including feedback after discussion

* include feedback

* fix modules integration tests

* fix modules integration tests

* fix event bus local
This commit is contained in:
Adrien de Peretti
2024-08-28 16:46:40 +02:00
committed by GitHub
parent 6cfe9bd874
commit 5bec38538a
27 changed files with 915 additions and 465 deletions
@@ -8,10 +8,10 @@ import {
ProductTypes,
} from "@medusajs/types"
import {
Image as ProductImage,
Product,
ProductCategory,
ProductCollection,
Image as ProductImage,
ProductOption,
ProductOptionValue,
ProductTag,
@@ -875,7 +875,10 @@ export default class ProductModuleService
collections.map(({ id }) => ({
name: ProductCollectionEvents.COLLECTION_CREATED,
data: { id },
}))
})),
{
internal: true,
}
)
return Array.isArray(data) ? createdCollections : createdCollections[0]
@@ -948,7 +951,10 @@ export default class ProductModuleService
created.map(({ id }) => ({
name: ProductCollectionEvents.COLLECTION_CREATED,
data: { id },
}))
})),
{
internal: true,
}
)
}
@@ -957,7 +963,10 @@ export default class ProductModuleService
updated.map(({ id }) => ({
name: ProductCollectionEvents.COLLECTION_UPDATED,
data: { id },
}))
})),
{
internal: true,
}
)
}
@@ -1018,7 +1027,10 @@ export default class ProductModuleService
updatedCollections.map(({ id }) => ({
name: ProductCollectionEvents.COLLECTION_UPDATED,
data: { id },
}))
})),
{
internal: true,
}
)
return isString(idOrSelector) ? updatedCollections[0] : updatedCollections
@@ -1281,7 +1293,10 @@ export default class ProductModuleService
createdProducts.map(({ id }) => ({
name: ProductEvents.PRODUCT_CREATED,
data: { id },
}))
})),
{
internal: true,
}
)
return Array.isArray(data) ? createdProducts : createdProducts[0]
@@ -1329,7 +1344,10 @@ export default class ProductModuleService
created.map(({ id }) => ({
name: ProductEvents.PRODUCT_CREATED,
data: { id },
}))
})),
{
internal: true,
}
)
}
@@ -1338,7 +1356,10 @@ export default class ProductModuleService
updated.map(({ id }) => ({
name: ProductEvents.PRODUCT_UPDATED,
data: { id },
}))
})),
{
internal: true,
}
)
}
@@ -1392,7 +1413,10 @@ export default class ProductModuleService
updatedProducts.map(({ id }) => ({
name: ProductEvents.PRODUCT_UPDATED,
data: { id },
}))
})),
{
internal: true,
}
)
return isString(idOrSelector) ? updatedProducts[0] : updatedProducts