chore(): upgrade mikro orm (#13450)

This commit is contained in:
Adrien de Peretti
2025-09-19 21:39:18 +02:00
committed by GitHub
parent 4c1c1dd4c0
commit 8ece06d8ed
64 changed files with 836 additions and 700 deletions

View File

@@ -12,7 +12,7 @@ export async function createCampaigns(
campaignsData?: CreateCampaignDTO[]
): Promise<Campaign[]> {
if (!campaignsData) {
const cp = JSON.parse(JSON.stringify(defaultCampaignsData))
const cp = structuredClone(defaultCampaignsData)
const starts_at = new Date(TODAY)
starts_at.setDate(starts_at.getDate() - 1)

View File

@@ -39,10 +39,10 @@
"devDependencies": {
"@medusajs/framework": "2.10.3",
"@medusajs/test-utils": "2.10.3",
"@mikro-orm/cli": "6.4.3",
"@mikro-orm/core": "6.4.3",
"@mikro-orm/migrations": "6.4.3",
"@mikro-orm/postgresql": "6.4.3",
"@mikro-orm/cli": "6.5.4",
"@mikro-orm/core": "6.5.4",
"@mikro-orm/migrations": "6.5.4",
"@mikro-orm/postgresql": "6.5.4",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"jest": "^29.7.0",
@@ -52,9 +52,9 @@
},
"peerDependencies": {
"@medusajs/framework": "2.10.3",
"@mikro-orm/core": "6.4.3",
"@mikro-orm/migrations": "6.4.3",
"@mikro-orm/postgresql": "6.4.3",
"@mikro-orm/core": "6.5.4",
"@mikro-orm/migrations": "6.5.4",
"@mikro-orm/postgresql": "6.5.4",
"awilix": "^8.0.1"
}
}

View File

@@ -690,7 +690,9 @@ export default class PromotionModuleService
sharedContext
)
return Array.isArray(data) ? promotions : promotions[0]
return await this.baseRepository_.serialize<
PromotionTypes.PromotionDTO | PromotionTypes.PromotionDTO[]
>(Array.isArray(data) ? promotions : promotions[0])
}
@InjectTransactionManager()
@@ -949,6 +951,7 @@ export default class PromotionModuleService
): Promise<PromotionTypes.PromotionDTO[]>
@InjectManager()
@EmitEvents()
// @ts-expect-error
async updatePromotions(
data:
@@ -1165,6 +1168,7 @@ export default class PromotionModuleService
}
@InjectManager()
@EmitEvents()
async addPromotionRules(
promotionId: string,
rulesData: PromotionTypes.CreatePromotionRuleDTO[],
@@ -1288,6 +1292,8 @@ export default class PromotionModuleService
validatePromotionRuleAttributes(rulesData)
const promotionRuleValuesDataToCreate: CreatePromotionRuleValueDTO[] = []
for (const ruleData of rulesData) {
const { values, ...rest } = ruleData
const promotionRuleData: CreatePromotionRuleDTO = {
@@ -1308,12 +1314,14 @@ export default class PromotionModuleService
promotion_rule: createdPromotionRule,
}))
await this.promotionRuleValueService_.create(
promotionRuleValuesData,
sharedContext
)
promotionRuleValuesDataToCreate.push(...promotionRuleValuesData)
}
await this.promotionRuleValueService_.create(
promotionRuleValuesDataToCreate,
sharedContext
)
return createdPromotionRules
}
@@ -1630,7 +1638,7 @@ export default class PromotionModuleService
@EmitEvents()
async addPromotionsToCampaign(
data: PromotionTypes.AddPromotionsToCampaignDTO,
@MedusaContext() sharedContext?: Context
@MedusaContext() sharedContext: Context = {}
): Promise<{ ids: string[] }> {
const ids = await this.addPromotionsToCampaign_(data, sharedContext)