feat(modules-sdk): define link (#7743)
This commit is contained in:
committed by
GitHub
parent
0886869148
commit
bc0c65c6b3
@@ -80,10 +80,15 @@ export type LinkModuleBootstrapOptions = {
|
||||
injectedDependencies?: Record<string, any>
|
||||
}
|
||||
|
||||
export type RegisterModuleJoinerConfig =
|
||||
| ModuleJoinerConfig
|
||||
| ((modules: ModuleJoinerConfig[]) => ModuleJoinerConfig)
|
||||
|
||||
export class MedusaModule {
|
||||
private static instances_: Map<string, { [key: string]: IModuleService }> =
|
||||
new Map()
|
||||
private static modules_: Map<string, ModuleAlias[]> = new Map()
|
||||
private static customLinks_: RegisterModuleJoinerConfig[] = []
|
||||
private static loading_: Map<string, Promise<any>> = new Map()
|
||||
private static joinerConfig_: Map<string, ModuleJoinerConfig> = new Map()
|
||||
private static moduleResolutions_: Map<string, ModuleResolution> = new Map()
|
||||
@@ -203,6 +208,14 @@ export class MedusaModule {
|
||||
return config
|
||||
}
|
||||
|
||||
public static setCustomLink(config: RegisterModuleJoinerConfig): void {
|
||||
MedusaModule.customLinks_.push(config)
|
||||
}
|
||||
|
||||
public static getCustomLinks(): RegisterModuleJoinerConfig[] {
|
||||
return MedusaModule.customLinks_
|
||||
}
|
||||
|
||||
public static getModuleInstance(
|
||||
moduleKey: string,
|
||||
alias?: string
|
||||
|
||||
Reference in New Issue
Block a user