fix(link-modules): fix warn on readonly links (#7403)
This commit is contained in:
@@ -12,7 +12,8 @@ export function generateGraphQLSchema(
|
|||||||
let fieldNames!: string[]
|
let fieldNames!: string[]
|
||||||
let entityName!: string
|
let entityName!: string
|
||||||
|
|
||||||
if (!joinerConfig.isReadOnlyLink) {
|
const isReadOnlyLink = joinerConfig.isReadOnlyLink
|
||||||
|
if (!isReadOnlyLink) {
|
||||||
fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey)
|
fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey)
|
||||||
|
|
||||||
entityName = toPascalCase(
|
entityName = toPascalCase(
|
||||||
@@ -31,7 +32,11 @@ export function generateGraphQLSchema(
|
|||||||
|
|
||||||
for (const extend of joinerConfig.extends ?? []) {
|
for (const extend of joinerConfig.extends ?? []) {
|
||||||
const extendedModule = MedusaModule.getModuleInstance(extend.serviceName)
|
const extendedModule = MedusaModule.getModuleInstance(extend.serviceName)
|
||||||
if (!extendedModule && !extend.relationship.isInternalService) {
|
if (
|
||||||
|
!isReadOnlyLink &&
|
||||||
|
!extendedModule &&
|
||||||
|
!extend.relationship.isInternalService
|
||||||
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Module ${extend.serviceName} not found. Please verify that the module is configured and installed, also the module must be loaded before the link modules.`
|
`Module ${extend.serviceName} not found. Please verify that the module is configured and installed, also the module must be loaded before the link modules.`
|
||||||
)
|
)
|
||||||
@@ -69,7 +74,7 @@ export function generateGraphQLSchema(
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joinerConfig.isReadOnlyLink) {
|
if (isReadOnlyLink) {
|
||||||
return typeDef
|
return typeDef
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user