fix(link-modules): Fix link module initialization (#4990)
**What** Add a new configuration on the relationship to specify if the relation is consumed from an internal service (from medusa core). In that case do not check if the service is part of the loaded modules
This commit is contained in:
committed by
GitHub
parent
d971d5cf91
commit
a87d07655b
6
.changeset/stupid-terms-ring.md
Normal file
6
.changeset/stupid-terms-ring.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/link-modules": patch
|
||||
"@medusajs/types": patch
|
||||
---
|
||||
|
||||
fix(link-modules): Fix link module initialization
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from "./inventory-level-stock-location"
|
||||
export * from "./product-variant-inventory-item"
|
||||
export * from "./product-variant-money-amount"
|
||||
export * from "./product-shipping-profile"
|
||||
|
||||
@@ -24,9 +24,10 @@ export const ProductShippingProfile: ModuleJoinerConfig = {
|
||||
},
|
||||
{
|
||||
serviceName: "shippingProfileService",
|
||||
isInternalService: true,
|
||||
primaryKey: "id",
|
||||
foreignKey: "profile_id",
|
||||
alias: "shipping_profile",
|
||||
alias: "profile",
|
||||
},
|
||||
],
|
||||
extends: [
|
||||
|
||||
@@ -90,8 +90,10 @@ export const initialize = async (
|
||||
continue
|
||||
}
|
||||
} else if (
|
||||
!modulesLoadedKeys.includes(primary.serviceName) ||
|
||||
!modulesLoadedKeys.includes(foreign.serviceName)
|
||||
(!primary.isInternalService &&
|
||||
!modulesLoadedKeys.includes(primary.serviceName)) ||
|
||||
(!foreign.isInternalService &&
|
||||
!modulesLoadedKeys.includes(foreign.serviceName))
|
||||
) {
|
||||
continue
|
||||
}
|
||||
@@ -176,8 +178,10 @@ export async function runMigrations(
|
||||
allLinks.add(serviceKey)
|
||||
|
||||
if (
|
||||
!modulesLoadedKeys.includes(primary.serviceName) ||
|
||||
!modulesLoadedKeys.includes(foreign.serviceName)
|
||||
(!primary.isInternalService &&
|
||||
!modulesLoadedKeys.includes(primary.serviceName)) ||
|
||||
(!foreign.isInternalService &&
|
||||
!modulesLoadedKeys.includes(foreign.serviceName))
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -168,6 +168,7 @@ export type ModuleJoinerConfig = Omit<
|
||||
}
|
||||
|
||||
export declare type ModuleJoinerRelationship = JoinerRelationship & {
|
||||
isInternalService?: boolean // If true, the relationship is an internal service from the medusa core TODO: Remove when there are no more "internal" services
|
||||
deleteCascade?: boolean // If true, the link joiner will cascade deleting the relationship
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user