chore(): upgrade mikro orm (#13450)
This commit is contained in:
committed by
GitHub
parent
4c1c1dd4c0
commit
8ece06d8ed
@@ -16,6 +16,7 @@ describe("Internal Module Service Factory", () => {
|
||||
[modelRepositoryName]: {
|
||||
transaction: (task) => task(),
|
||||
getFreshManager: jest.fn().mockReturnThis(),
|
||||
getActiveManager: jest.fn().mockReturnThis(),
|
||||
find: jest.fn(),
|
||||
findAndCount: jest.fn(),
|
||||
create: jest.fn(),
|
||||
@@ -28,6 +29,7 @@ describe("Internal Module Service Factory", () => {
|
||||
[`composite${Model.name}Repository`]: {
|
||||
transaction: (task) => task(),
|
||||
getFreshManager: jest.fn().mockReturnThis(),
|
||||
getActiveManager: jest.fn().mockReturnThis(),
|
||||
find: jest.fn(),
|
||||
findAndCount: jest.fn(),
|
||||
create: jest.fn(),
|
||||
|
||||
@@ -7,6 +7,7 @@ const baseRepoMock = {
|
||||
serialize: jest.fn().mockImplementation((item) => item),
|
||||
transaction: (task) => task("transactionManager"),
|
||||
getFreshManager: jest.fn().mockReturnThis(),
|
||||
getActiveManager: jest.fn().mockReturnThis(),
|
||||
}
|
||||
|
||||
const defaultContext = {
|
||||
|
||||
@@ -23,7 +23,7 @@ export function InjectManager(managerProperty?: string): MethodDecorator {
|
||||
const originalContext = args[argIndex] ?? {}
|
||||
const copiedContext = {} as Context
|
||||
for (const key in originalContext) {
|
||||
if (key === "manager" || key === "transactionManager") {
|
||||
if (key === "transactionManager") {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ export function InjectManager(managerProperty?: string): MethodDecorator {
|
||||
)
|
||||
}
|
||||
|
||||
copiedContext.manager =
|
||||
originalContext.manager ?? resourceWithManager.getFreshManager()
|
||||
copiedContext.manager ??=
|
||||
resourceWithManager.getFreshManager(originalContext)
|
||||
|
||||
if (originalContext?.transactionManager) {
|
||||
copiedContext.transactionManager = originalContext?.transactionManager
|
||||
|
||||
@@ -35,7 +35,7 @@ export function InjectTransactionManager(
|
||||
async (transactionManager) => {
|
||||
const copiedContext = {} as Context
|
||||
for (const key in originalContext) {
|
||||
if (key === "manager" || key === "transactionManager") {
|
||||
if (key === "transactionManager") {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -52,10 +52,6 @@ export function InjectTransactionManager(
|
||||
|
||||
copiedContext.transactionManager = transactionManager
|
||||
|
||||
if (originalContext?.manager) {
|
||||
copiedContext.manager = originalContext?.manager
|
||||
}
|
||||
|
||||
copiedContext.__type = MedusaContextType
|
||||
|
||||
args[argIndex] = copiedContext
|
||||
@@ -63,6 +59,7 @@ export function InjectTransactionManager(
|
||||
return await originalMethod.apply(this, args)
|
||||
},
|
||||
{
|
||||
manager: originalContext?.manager,
|
||||
transaction: originalContext?.transactionManager,
|
||||
isolationLevel: (originalContext as Context)?.isolationLevel,
|
||||
enableNestedTransactions:
|
||||
|
||||
Reference in New Issue
Block a user