feat(medusa-app): Link initialization should respect migrationOnly flag (#14493)
* feat(medusa-app): Link initialization should respect migrationOnly flag * Create cyan-taxis-behave.md
This commit is contained in:
committed by
GitHub
parent
568742826f
commit
bb599a26de
6
.changeset/cyan-taxis-behave.md
Normal file
6
.changeset/cyan-taxis-behave.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/link-modules": patch
|
||||||
|
"@medusajs/modules-sdk": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat(medusa-app): Link initialization should respect migrationOnly flag
|
||||||
@@ -204,6 +204,7 @@ async function initializeLinks({
|
|||||||
linkModules,
|
linkModules,
|
||||||
injectedDependencies,
|
injectedDependencies,
|
||||||
moduleExports,
|
moduleExports,
|
||||||
|
migrationOnly = false,
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
let resources = moduleExports
|
let resources = moduleExports
|
||||||
@@ -220,7 +221,9 @@ async function initializeLinks({
|
|||||||
const linkResolution = await initialize(
|
const linkResolution = await initialize(
|
||||||
config,
|
config,
|
||||||
linkModules,
|
linkModules,
|
||||||
injectedDependencies
|
injectedDependencies,
|
||||||
|
undefined,
|
||||||
|
migrationOnly
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -488,6 +491,7 @@ async function MedusaApp_({
|
|||||||
linkModules,
|
linkModules,
|
||||||
injectedDependencies,
|
injectedDependencies,
|
||||||
moduleExports: isMedusaModule(linkModule) ? linkModule : undefined,
|
moduleExports: isMedusaModule(linkModule) ? linkModule : undefined,
|
||||||
|
migrationOnly,
|
||||||
})
|
})
|
||||||
|
|
||||||
const loadedSchema = getLoadedSchema()
|
const loadedSchema = getLoadedSchema()
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export type LinkModuleBootstrapOptions = {
|
|||||||
moduleExports?: ModuleExports
|
moduleExports?: ModuleExports
|
||||||
injectedDependencies?: Record<string, any>
|
injectedDependencies?: Record<string, any>
|
||||||
cwd?: string
|
cwd?: string
|
||||||
|
migrationOnly?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RegisterModuleJoinerConfig =
|
export type RegisterModuleJoinerConfig =
|
||||||
@@ -652,6 +653,7 @@ class MedusaModule {
|
|||||||
moduleExports,
|
moduleExports,
|
||||||
injectedDependencies,
|
injectedDependencies,
|
||||||
cwd,
|
cwd,
|
||||||
|
migrationOnly,
|
||||||
}: LinkModuleBootstrapOptions): Promise<{
|
}: LinkModuleBootstrapOptions): Promise<{
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}> {
|
}> {
|
||||||
@@ -720,6 +722,7 @@ class MedusaModule {
|
|||||||
await moduleLoader({
|
await moduleLoader({
|
||||||
container,
|
container,
|
||||||
moduleResolutions,
|
moduleResolutions,
|
||||||
|
migrationOnly,
|
||||||
logger: logger_,
|
logger: logger_,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ export const initialize = async (
|
|||||||
| InternalModuleDeclaration,
|
| InternalModuleDeclaration,
|
||||||
pluginLinksDefinitions?: ModuleJoinerConfig[],
|
pluginLinksDefinitions?: ModuleJoinerConfig[],
|
||||||
injectedDependencies?: InitializeModuleInjectableDependencies,
|
injectedDependencies?: InitializeModuleInjectableDependencies,
|
||||||
cwd?: string
|
cwd?: string,
|
||||||
|
migrationOnly?: boolean
|
||||||
): Promise<{ [link: string]: ILinkModule }> => {
|
): Promise<{ [link: string]: ILinkModule }> => {
|
||||||
const allLinks = {}
|
const allLinks = {}
|
||||||
const modulesLoadedKeys = MedusaModule.getLoadedModules().map(
|
const modulesLoadedKeys = MedusaModule.getLoadedModules().map(
|
||||||
@@ -170,6 +171,7 @@ export const initialize = async (
|
|||||||
moduleExports: moduleDefinition,
|
moduleExports: moduleDefinition,
|
||||||
injectedDependencies,
|
injectedDependencies,
|
||||||
cwd,
|
cwd,
|
||||||
|
migrationOnly,
|
||||||
})
|
})
|
||||||
|
|
||||||
allLinks[serviceKey as string] = Object.values(loaded)[0]
|
allLinks[serviceKey as string] = Object.values(loaded)[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user