chore(): Module Internal Events (#13296)
* chore(): Ensure the product module emits all necessary events * chore(): Ensure the product module emits all necessary events * Update events tests * more events and fixes * more tests and category fixes * more tests and category fixes * Add todo * update updateProduct_ event emitting and adjust test * Adjust update products implementation to rely on already computed events * rm unnecessary update variants events * Fix formatting in changeset for product events * refactor: Manage event emitting automatically (WIP) * refactor: Manage event emitting automatically (WIP) * chore(api-key): Add missing emit events and refactoring * chore(cart): Add missing emit events and refactoring * chore(customer): Add missing emit events and refactoring * chore(fufillment, utils): Add missing emit events and refactoring * chore(fufillment, utils): Add missing emit events and refactoring * chore(inventory): Add missing emit events and refactoring * chore(notification): Add missing emit events and refactoring * chore(utils): Remove medusa service event handling legacy * chore(product): Add missing emit events and refactoring * chore(order): Add missing emit events and refactoring * chore(payment): Add missing emit events and refactoring * chore(pricing, util): Add missing emit events and refactoring, fix internal service upsertWithReplace event dispatching * chore(promotions): Add missing emit events and refactoring * chore(region): Add missing emit events and refactoring * chore(sales-channel): Add missing emit events and refactoring * chore(settings): Add missing emit events and refactoring * chore(stock-location): Add missing emit events and refactoring * chore(store): Add missing emit events and refactoring * chore(taxes): Add missing emit events and refactoring * chore(user): Add missing emit events and refactoring * fix unit tests * rm changeset for regeneration * Create changeset for Medusa.js patch updates Add a changeset for patch updates to multiple Medusa.js modules. * rm unused product event builders * address feedback * remove old changeset * fix event action for token generated * fix user module events * fix import * fix promotion events * add new module integration tests shard * fix medusa service * revert shard * fix event action * fix pipeline * fix pipeline --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
afe21741c4
commit
e8822f3e69
@@ -17,6 +17,7 @@ import {
|
||||
UpsertStockLocationInput,
|
||||
} from "@medusajs/framework/types"
|
||||
import {
|
||||
EmitEvents,
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
isString,
|
||||
@@ -86,7 +87,9 @@ export default class StockLocationModuleService
|
||||
data: CreateStockLocationInput[],
|
||||
context: Context
|
||||
): Promise<StockLocationTypes.StockLocationDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async createStockLocations(
|
||||
data: CreateStockLocationInput | CreateStockLocationInput[],
|
||||
@@ -101,7 +104,7 @@ export default class StockLocationModuleService
|
||||
const serialized = await this.baseRepository_.serialize<
|
||||
| StockLocationTypes.StockLocationDTO
|
||||
| StockLocationTypes.StockLocationDTO[]
|
||||
>(created, { populate: true })
|
||||
>(created)
|
||||
|
||||
return Array.isArray(data) ? serialized : serialized[0]
|
||||
}
|
||||
@@ -124,6 +127,7 @@ export default class StockLocationModuleService
|
||||
): Promise<StockLocationTypes.StockLocationDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
async upsertStockLocations(
|
||||
data: UpsertStockLocationInput | UpsertStockLocationInput[],
|
||||
@MedusaContext() context: Context = {}
|
||||
@@ -179,6 +183,7 @@ export default class StockLocationModuleService
|
||||
input: UpdateStockLocationInput,
|
||||
context?: Context
|
||||
): Promise<StockLocationTypes.StockLocationDTO[]>
|
||||
|
||||
/**
|
||||
* Updates an existing stock location.
|
||||
* @param stockLocationId - The ID of the stock location to update.
|
||||
@@ -187,6 +192,7 @@ export default class StockLocationModuleService
|
||||
* @returns The updated stock location.
|
||||
*/
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateStockLocations(
|
||||
idOrSelector: string | FilterableStockLocationProps,
|
||||
@@ -208,7 +214,7 @@ export default class StockLocationModuleService
|
||||
const serialized = await this.baseRepository_.serialize<
|
||||
| StockLocationTypes.StockLocationDTO
|
||||
| StockLocationTypes.StockLocationDTO[]
|
||||
>(updated, { populate: true })
|
||||
>(updated)
|
||||
|
||||
return Array.isArray(data) ? serialized : serialized[0]
|
||||
}
|
||||
@@ -239,6 +245,7 @@ export default class StockLocationModuleService
|
||||
): Promise<StockLocationTypes.StockLocationAddressDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
// @ts-expect-error
|
||||
async updateStockLocationAddresses(
|
||||
data:
|
||||
@@ -253,7 +260,7 @@ export default class StockLocationModuleService
|
||||
const serialized = await this.baseRepository_.serialize<
|
||||
| StockLocationTypes.StockLocationAddressDTO
|
||||
| StockLocationTypes.StockLocationAddressDTO[]
|
||||
>(updated, { populate: true })
|
||||
>(updated)
|
||||
|
||||
return Array.isArray(data) ? serialized : serialized[0]
|
||||
}
|
||||
@@ -276,6 +283,7 @@ export default class StockLocationModuleService
|
||||
): Promise<StockLocationTypes.StockLocationAddressDTO[]>
|
||||
|
||||
@InjectManager()
|
||||
@EmitEvents()
|
||||
async upsertStockLocationAddresses(
|
||||
data: UpsertStockLocationAddressInput | UpsertStockLocationAddressInput[],
|
||||
@MedusaContext() context: Context = {}
|
||||
|
||||
Reference in New Issue
Block a user