chore: remove container registration name (#9137)
This commit is contained in:
committed by
GitHub
parent
ab4a422fc8
commit
950cf9af79
@@ -15,20 +15,17 @@ import {
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
arrayDifference,
|
||||
composeLinkName,
|
||||
composeTableName,
|
||||
ContainerRegistrationKeys,
|
||||
lowerCaseFirst,
|
||||
ModuleRegistrationName,
|
||||
Modules,
|
||||
simpleHash,
|
||||
toPascalCase,
|
||||
} from "@medusajs/utils"
|
||||
import * as linkDefinitions from "../definitions"
|
||||
import { MigrationsExecutionPlanner } from "../migration"
|
||||
import { InitializeModuleInjectableDependencies } from "../types"
|
||||
import {
|
||||
composeLinkName,
|
||||
composeTableName,
|
||||
generateGraphQLSchema,
|
||||
} from "../utils"
|
||||
import { generateGraphQLSchema } from "../utils"
|
||||
import { getLinkModuleDefinition } from "./module-definition"
|
||||
|
||||
export const initialize = async (
|
||||
@@ -86,14 +83,12 @@ export const initialize = async (
|
||||
}
|
||||
|
||||
const serviceKey = !definition.isReadOnlyLink
|
||||
? lowerCaseFirst(
|
||||
definition.serviceName ??
|
||||
composeLinkName(
|
||||
primary.serviceName,
|
||||
primary.foreignKey,
|
||||
foreign.serviceName,
|
||||
foreign.foreignKey
|
||||
)
|
||||
? definition.serviceName ??
|
||||
composeLinkName(
|
||||
primary.serviceName,
|
||||
primary.foreignKey,
|
||||
foreign.serviceName,
|
||||
foreign.foreignKey
|
||||
)
|
||||
: simpleHash(JSON.stringify(definition.extends))
|
||||
|
||||
@@ -159,9 +154,8 @@ export const initialize = async (
|
||||
|
||||
const linkModuleDefinition: LinkModuleDefinition = {
|
||||
key: serviceKey,
|
||||
registrationName: serviceKey,
|
||||
label: serviceKey,
|
||||
dependencies: [ModuleRegistrationName.EVENT_BUS],
|
||||
dependencies: [Modules.EVENT_BUS],
|
||||
defaultModuleDeclaration: {
|
||||
scope: MODULE_SCOPE.INTERNAL,
|
||||
resources: injectedDependencies?.[
|
||||
@@ -218,15 +212,14 @@ export function getMigrationPlanner(
|
||||
}
|
||||
|
||||
const [primary, foreign] = definition.relationships ?? []
|
||||
const serviceKey = lowerCaseFirst(
|
||||
const serviceKey =
|
||||
definition.serviceName ??
|
||||
composeLinkName(
|
||||
primary.serviceName,
|
||||
primary.foreignKey,
|
||||
foreign.serviceName,
|
||||
foreign.foreignKey
|
||||
)
|
||||
)
|
||||
composeLinkName(
|
||||
primary.serviceName,
|
||||
primary.foreignKey,
|
||||
foreign.serviceName,
|
||||
foreign.foreignKey
|
||||
)
|
||||
|
||||
if (allLinks.has(serviceKey)) {
|
||||
throw new Error(`Link module ${serviceKey} already exists.`)
|
||||
|
||||
Reference in New Issue
Block a user