chore(medusa, modules-sdk, types): Refactor modules loading from medusa (#5018)
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
"@medusajs/modules-sdk": patch
|
||||||
|
"@medusajs/types": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore(medusa, modules-sdk, types): Refactor modules loading from medusa
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
moduleHelper,
|
moduleHelper,
|
||||||
moduleLoader,
|
moduleLoader,
|
||||||
|
ModulesDefinition,
|
||||||
|
registerMedusaModule,
|
||||||
registerModules,
|
registerModules,
|
||||||
} from "@medusajs/modules-sdk"
|
} from "@medusajs/modules-sdk"
|
||||||
import { asValue, createContainer } from "awilix"
|
import { asValue, createContainer } from "awilix"
|
||||||
@@ -17,6 +19,7 @@ import passportLoader from "../loaders/passport"
|
|||||||
import repositories from "../loaders/repositories"
|
import repositories from "../loaders/repositories"
|
||||||
import servicesLoader from "../loaders/services"
|
import servicesLoader from "../loaders/services"
|
||||||
import strategiesLoader from "../loaders/strategies"
|
import strategiesLoader from "../loaders/strategies"
|
||||||
|
import modules from "../modules-config"
|
||||||
|
|
||||||
const adminSessionOpts = {
|
const adminSessionOpts = {
|
||||||
cookieName: "session",
|
cookieName: "session",
|
||||||
@@ -31,6 +34,14 @@ const clientSessionOpts = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const moduleResolutions = registerModules({})
|
const moduleResolutions = registerModules({})
|
||||||
|
// Load non legacy modules
|
||||||
|
Object.keys(modules).map((moduleKey) => {
|
||||||
|
moduleResolutions[moduleKey] = registerMedusaModule(
|
||||||
|
moduleKey,
|
||||||
|
ModulesDefinition[moduleKey]
|
||||||
|
)[moduleKey]
|
||||||
|
})
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
projectConfig: {
|
projectConfig: {
|
||||||
jwt_secret: "supersecret",
|
jwt_secret: "supersecret",
|
||||||
@@ -91,24 +102,37 @@ testApp.use((req, res, next) => {
|
|||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
featureFlagLoader(config)
|
let supertestRequest
|
||||||
models({ container, configModule: config, isTest: true })
|
let resolveIsInit
|
||||||
repositories({ container, isTest: true })
|
const isInit = new Promise((resolve) => {
|
||||||
servicesLoader({ container, configModule: config })
|
resolveIsInit = resolve
|
||||||
strategiesLoader({ container, configModule: config })
|
|
||||||
passportLoader({ app: testApp, container, configModule: config })
|
|
||||||
moduleLoader({ container, moduleResolutions })
|
|
||||||
|
|
||||||
testApp.use((req, res, next) => {
|
|
||||||
req.scope = container.createScope()
|
|
||||||
next()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
apiLoader({ container, app: testApp, configModule: config })
|
async function init() {
|
||||||
|
featureFlagLoader(config)
|
||||||
|
models({ container, configModule: config, isTest: true })
|
||||||
|
repositories({ container, isTest: true })
|
||||||
|
servicesLoader({ container, configModule: config })
|
||||||
|
strategiesLoader({ container, configModule: config })
|
||||||
|
await passportLoader({ app: testApp, container, configModule: config })
|
||||||
|
await moduleLoader({ container, moduleResolutions })
|
||||||
|
|
||||||
const supertestRequest = supertest(testApp)
|
testApp.use((req, res, next) => {
|
||||||
|
req.scope = container.createScope()
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
|
await apiLoader({ container, app: testApp, configModule: config })
|
||||||
|
|
||||||
|
supertestRequest = supertest(testApp)
|
||||||
|
resolveIsInit(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
init()
|
||||||
|
|
||||||
export async function request(method, url, opts = {}) {
|
export async function request(method, url, opts = {}) {
|
||||||
|
await isInit
|
||||||
|
|
||||||
const { payload, query, headers = {}, flags = [] } = opts
|
const { payload, query, headers = {}, flags = [] } = opts
|
||||||
|
|
||||||
flags.forEach((flag) => {
|
flags.forEach((flag) => {
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
import { MedusaApp, moduleLoader, registerModules } from "@medusajs/modules-sdk"
|
import {
|
||||||
|
ExternalModuleDeclaration,
|
||||||
|
InternalModuleDeclaration,
|
||||||
|
MedusaApp,
|
||||||
|
moduleLoader,
|
||||||
|
ModulesDefinition,
|
||||||
|
registerModules,
|
||||||
|
} from "@medusajs/modules-sdk"
|
||||||
import { ContainerRegistrationKeys } from "@medusajs/utils"
|
import { ContainerRegistrationKeys } from "@medusajs/utils"
|
||||||
import { asValue } from "awilix"
|
import { asValue } from "awilix"
|
||||||
import { Express, NextFunction, Request, Response } from "express"
|
import { Express, NextFunction, Request, Response } from "express"
|
||||||
@@ -11,7 +18,7 @@ import { Connection } from "typeorm"
|
|||||||
import { joinerConfig } from "../joiner-config"
|
import { joinerConfig } from "../joiner-config"
|
||||||
import modulesConfig from "../modules-config"
|
import modulesConfig from "../modules-config"
|
||||||
import { MedusaContainer } from "../types/global"
|
import { MedusaContainer } from "../types/global"
|
||||||
import { remoteQueryFetchData } from "../utils"
|
import { isObject, remoteQueryFetchData } from "../utils"
|
||||||
import apiLoader from "./api"
|
import apiLoader from "./api"
|
||||||
import loadConfig from "./config"
|
import loadConfig from "./config"
|
||||||
import databaseLoader, { dataSource } from "./database"
|
import databaseLoader, { dataSource } from "./database"
|
||||||
@@ -30,6 +37,7 @@ import searchIndexLoader from "./search-index"
|
|||||||
import servicesLoader from "./services"
|
import servicesLoader from "./services"
|
||||||
import strategiesLoader from "./strategies"
|
import strategiesLoader from "./strategies"
|
||||||
import subscribersLoader from "./subscribers"
|
import subscribersLoader from "./subscribers"
|
||||||
|
import { ConfigModule } from "@medusajs/types"
|
||||||
|
|
||||||
type Options = {
|
type Options = {
|
||||||
directory: string
|
directory: string
|
||||||
@@ -37,6 +45,34 @@ type Options = {
|
|||||||
isTest: boolean
|
isTest: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Merge the modules config from the medusa-config file with the modules config from medusa package
|
||||||
|
* @param modules
|
||||||
|
* @param medusaInternalModulesConfig
|
||||||
|
*/
|
||||||
|
function mergeModulesConfig(
|
||||||
|
modules: ConfigModule["modules"],
|
||||||
|
medusaInternalModulesConfig
|
||||||
|
) {
|
||||||
|
for (const [moduleName, moduleConfig] of Object.entries(modules as any)) {
|
||||||
|
const moduleDefinition = ModulesDefinition[moduleName]
|
||||||
|
|
||||||
|
if (moduleDefinition?.isLegacy) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const isModuleEnabled = moduleConfig === true || isObject(moduleConfig)
|
||||||
|
|
||||||
|
if (!isModuleEnabled) {
|
||||||
|
delete medusaInternalModulesConfig[moduleName]
|
||||||
|
} else {
|
||||||
|
medusaInternalModulesConfig[moduleName] = moduleConfig as Partial<
|
||||||
|
InternalModuleDeclaration | ExternalModuleDeclaration
|
||||||
|
>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default async ({
|
export default async ({
|
||||||
directory: rootDirectory,
|
directory: rootDirectory,
|
||||||
expressApp,
|
expressApp,
|
||||||
@@ -98,10 +134,15 @@ export default async ({
|
|||||||
await pgConnectionLoader({ container, configModule })
|
await pgConnectionLoader({ container, configModule })
|
||||||
|
|
||||||
const modulesActivity = Logger.activity(`Initializing modules${EOL}`)
|
const modulesActivity = Logger.activity(`Initializing modules${EOL}`)
|
||||||
|
|
||||||
track("MODULES_INIT_STARTED")
|
track("MODULES_INIT_STARTED")
|
||||||
await moduleLoader({
|
await moduleLoader({
|
||||||
container,
|
container,
|
||||||
moduleResolutions: registerModules(configModule?.modules),
|
moduleResolutions: registerModules(configModule?.modules, {
|
||||||
|
loadLegacyOnly: featureFlagRouter.isFeatureEnabled(
|
||||||
|
IsolateProductDomainFeatureFlag.key
|
||||||
|
),
|
||||||
|
}),
|
||||||
logger: Logger,
|
logger: Logger,
|
||||||
})
|
})
|
||||||
const modAct = Logger.success(modulesActivity, "Modules initialized") || {}
|
const modAct = Logger.success(modulesActivity, "Modules initialized") || {}
|
||||||
@@ -185,7 +226,10 @@ export default async ({
|
|||||||
Logger.success(searchActivity, "Indexing event emitted") || {}
|
Logger.success(searchActivity, "Indexing event emitted") || {}
|
||||||
track("SEARCH_ENGINE_INDEXING_COMPLETED", { duration: searchAct.duration })
|
track("SEARCH_ENGINE_INDEXING_COMPLETED", { duration: searchAct.duration })
|
||||||
|
|
||||||
|
// Only load non legacy modules, the legacy modules (non migrated yet) are retrieved by the registerModule above
|
||||||
if (featureFlagRouter.isFeatureEnabled(IsolateProductDomainFeatureFlag.key)) {
|
if (featureFlagRouter.isFeatureEnabled(IsolateProductDomainFeatureFlag.key)) {
|
||||||
|
mergeModulesConfig(configModule.modules ?? {}, modulesConfig)
|
||||||
|
|
||||||
const { query } = await MedusaApp({
|
const { query } = await MedusaApp({
|
||||||
modulesConfig,
|
modulesConfig,
|
||||||
servicesConfig: joinerConfig,
|
servicesConfig: joinerConfig,
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { MedusaModuleConfig, Modules } from "@medusajs/modules-sdk"
|
import { MedusaModuleConfig, Modules } from "@medusajs/modules-sdk"
|
||||||
|
|
||||||
const modules: MedusaModuleConfig = [
|
const modules: MedusaModuleConfig = {
|
||||||
{
|
[Modules.PRODUCT]: true,
|
||||||
module: Modules.PRODUCT,
|
}
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
export default modules
|
export default modules
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } =
|
|||||||
{
|
{
|
||||||
[Modules.EVENT_BUS]: {
|
[Modules.EVENT_BUS]: {
|
||||||
key: Modules.EVENT_BUS,
|
key: Modules.EVENT_BUS,
|
||||||
|
isLegacy: true,
|
||||||
registrationName: ModuleRegistrationName.EVENT_BUS,
|
registrationName: ModuleRegistrationName.EVENT_BUS,
|
||||||
defaultPackage: MODULE_PACKAGE_NAMES[Modules.EVENT_BUS],
|
defaultPackage: MODULE_PACKAGE_NAMES[Modules.EVENT_BUS],
|
||||||
label: "EventBusModuleService",
|
label: "EventBusModuleService",
|
||||||
@@ -48,6 +49,7 @@ export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } =
|
|||||||
},
|
},
|
||||||
[Modules.STOCK_LOCATION]: {
|
[Modules.STOCK_LOCATION]: {
|
||||||
key: Modules.STOCK_LOCATION,
|
key: Modules.STOCK_LOCATION,
|
||||||
|
isLegacy: true,
|
||||||
registrationName: ModuleRegistrationName.STOCK_LOCATION,
|
registrationName: ModuleRegistrationName.STOCK_LOCATION,
|
||||||
defaultPackage: false,
|
defaultPackage: false,
|
||||||
label: "StockLocationService",
|
label: "StockLocationService",
|
||||||
@@ -62,6 +64,7 @@ export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } =
|
|||||||
},
|
},
|
||||||
[Modules.INVENTORY]: {
|
[Modules.INVENTORY]: {
|
||||||
key: Modules.INVENTORY,
|
key: Modules.INVENTORY,
|
||||||
|
isLegacy: true,
|
||||||
registrationName: ModuleRegistrationName.INVENTORY,
|
registrationName: ModuleRegistrationName.INVENTORY,
|
||||||
defaultPackage: false,
|
defaultPackage: false,
|
||||||
label: "InventoryService",
|
label: "InventoryService",
|
||||||
@@ -76,6 +79,7 @@ export const ModulesDefinition: { [key: string | Modules]: ModuleDefinition } =
|
|||||||
},
|
},
|
||||||
[Modules.CACHE]: {
|
[Modules.CACHE]: {
|
||||||
key: Modules.CACHE,
|
key: Modules.CACHE,
|
||||||
|
isLegacy: true,
|
||||||
registrationName: ModuleRegistrationName.CACHE,
|
registrationName: ModuleRegistrationName.CACHE,
|
||||||
defaultPackage: MODULE_PACKAGE_NAMES[Modules.CACHE],
|
defaultPackage: MODULE_PACKAGE_NAMES[Modules.CACHE],
|
||||||
label: "CacheService",
|
label: "CacheService",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ describe("module definitions loader", () => {
|
|||||||
registrationName: "testService",
|
registrationName: "testService",
|
||||||
defaultPackage: "@medusajs/test-service",
|
defaultPackage: "@medusajs/test-service",
|
||||||
label: "TestService",
|
label: "TestService",
|
||||||
|
isLegacy: true,
|
||||||
isRequired: false,
|
isRequired: false,
|
||||||
canOverride: true,
|
canOverride: true,
|
||||||
defaultModuleDeclaration: {
|
defaultModuleDeclaration: {
|
||||||
|
|||||||
@@ -11,18 +11,29 @@ import { isObject } from "@medusajs/utils"
|
|||||||
import resolveCwd from "resolve-cwd"
|
import resolveCwd from "resolve-cwd"
|
||||||
import { MODULE_DEFINITIONS, ModulesDefinition } from "../definitions"
|
import { MODULE_DEFINITIONS, ModulesDefinition } from "../definitions"
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param modules
|
||||||
|
* @param isolatedModules Will be removed once the isolated flag is being removed
|
||||||
|
*/
|
||||||
export const registerModules = (
|
export const registerModules = (
|
||||||
modules?: Record<
|
modules?: Record<
|
||||||
string,
|
string,
|
||||||
| false
|
| false
|
||||||
| string
|
| string
|
||||||
| Partial<InternalModuleDeclaration | ExternalModuleDeclaration>
|
| Partial<InternalModuleDeclaration | ExternalModuleDeclaration>
|
||||||
>
|
>,
|
||||||
|
{ loadLegacyOnly } = { loadLegacyOnly: false }
|
||||||
): Record<string, ModuleResolution> => {
|
): Record<string, ModuleResolution> => {
|
||||||
const moduleResolutions = {} as Record<string, ModuleResolution>
|
const moduleResolutions = {} as Record<string, ModuleResolution>
|
||||||
const projectModules = modules ?? {}
|
const projectModules = modules ?? {}
|
||||||
|
|
||||||
for (const definition of MODULE_DEFINITIONS) {
|
for (const definition of MODULE_DEFINITIONS) {
|
||||||
|
// Skip non legacy modules
|
||||||
|
if (loadLegacyOnly && !definition.isLegacy) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
const customConfig = projectModules[definition.key]
|
const customConfig = projectModules[definition.key]
|
||||||
|
|
||||||
const canSkip =
|
const canSkip =
|
||||||
@@ -62,6 +73,12 @@ export const registerMedusaModule = (
|
|||||||
throw new Error(`Module: ${moduleKey} is not defined.`)
|
throw new Error(`Module: ${moduleKey} is not defined.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (modDefinition.isLegacy) {
|
||||||
|
throw new Error(
|
||||||
|
`Module: ${moduleKey} is a legacy module. Please use registerModules instead.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isObject(moduleDeclaration) &&
|
isObject(moduleDeclaration) &&
|
||||||
moduleDeclaration?.scope === MODULE_SCOPE.EXTERNAL
|
moduleDeclaration?.scope === MODULE_SCOPE.EXTERNAL
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { RemoteFetchDataCallback } from "@medusajs/orchestration"
|
import { RemoteFetchDataCallback } from "@medusajs/orchestration"
|
||||||
import {
|
import {
|
||||||
|
ExternalModuleDeclaration,
|
||||||
|
InternalModuleDeclaration,
|
||||||
LoadedModule,
|
LoadedModule,
|
||||||
MODULE_RESOURCE_TYPE,
|
MODULE_RESOURCE_TYPE,
|
||||||
MODULE_SCOPE,
|
MODULE_SCOPE,
|
||||||
ModuleConfig,
|
ModuleDefinition,
|
||||||
ModuleJoinerConfig,
|
ModuleJoinerConfig,
|
||||||
ModuleServiceInitializeOptions,
|
ModuleServiceInitializeOptions,
|
||||||
RemoteJoinerQuery,
|
RemoteJoinerQuery,
|
||||||
@@ -18,13 +20,30 @@ import { MedusaModule } from "./medusa-module"
|
|||||||
import { RemoteLink } from "./remote-link"
|
import { RemoteLink } from "./remote-link"
|
||||||
import { RemoteQuery } from "./remote-query"
|
import { RemoteQuery } from "./remote-query"
|
||||||
|
|
||||||
export type MedusaModuleConfig = (Partial<ModuleConfig> | Modules)[]
|
export type MedusaModuleConfig = {
|
||||||
type SharedResources = {
|
[key: string | Modules]:
|
||||||
database?: ModuleServiceInitializeOptions["database"]
|
| Partial<InternalModuleDeclaration | ExternalModuleDeclaration>
|
||||||
|
| true
|
||||||
}
|
}
|
||||||
|
|
||||||
const isModuleConfig = (obj: any): obj is ModuleConfig => {
|
export type SharedResources = {
|
||||||
return isObject(obj)
|
database?: ModuleServiceInitializeOptions["database"] & {
|
||||||
|
/**
|
||||||
|
* {
|
||||||
|
* name?: string
|
||||||
|
* afterCreate?: Function
|
||||||
|
* min?: number
|
||||||
|
* max?: number
|
||||||
|
* refreshIdle?: boolean
|
||||||
|
* idleTimeoutMillis?: number
|
||||||
|
* reapIntervalMillis?: number
|
||||||
|
* returnToHead?: boolean
|
||||||
|
* priorityRange?: number
|
||||||
|
* log?: (message: string, logLevel: string) => void
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
pool?: Record<string, unknown>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function MedusaApp({
|
export async function MedusaApp({
|
||||||
@@ -83,20 +102,15 @@ export async function MedusaApp({
|
|||||||
const allModules: Record<string, LoadedModule | LoadedModule[]> = {}
|
const allModules: Record<string, LoadedModule | LoadedModule[]> = {}
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
modules.map(async (mod: Partial<ModuleConfig> | Modules) => {
|
Object.keys(modules).map(async (moduleName) => {
|
||||||
let key: Modules | string = mod as Modules
|
const mod = modules[moduleName] as MedusaModuleConfig
|
||||||
|
|
||||||
let path: string
|
let path: string
|
||||||
let declaration: any = {}
|
let declaration: any = {}
|
||||||
|
|
||||||
if (isModuleConfig(mod)) {
|
if (isObject(mod)) {
|
||||||
if (!mod.module) {
|
const mod_ = mod as unknown as InternalModuleDeclaration
|
||||||
throw new Error(
|
path = mod_.resolve ?? MODULE_PACKAGE_NAMES[moduleName]
|
||||||
`Module ${JSON.stringify(mod)} is missing module name.`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
key = mod.module
|
|
||||||
path = mod.path ?? MODULE_PACKAGE_NAMES[key]
|
|
||||||
|
|
||||||
declaration = { ...mod }
|
declaration = { ...mod }
|
||||||
delete declaration.definition
|
delete declaration.definition
|
||||||
@@ -104,10 +118,6 @@ export async function MedusaApp({
|
|||||||
path = MODULE_PACKAGE_NAMES[mod as Modules]
|
path = MODULE_PACKAGE_NAMES[mod as Modules]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path) {
|
|
||||||
throw new Error(`Module ${key} is missing path.`)
|
|
||||||
}
|
|
||||||
|
|
||||||
declaration.scope ??= MODULE_SCOPE.INTERNAL
|
declaration.scope ??= MODULE_SCOPE.INTERNAL
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -118,22 +128,22 @@ export async function MedusaApp({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loaded = (await MedusaModule.bootstrap(
|
const loaded = (await MedusaModule.bootstrap(
|
||||||
key,
|
moduleName,
|
||||||
path,
|
path,
|
||||||
declaration,
|
declaration,
|
||||||
undefined,
|
undefined,
|
||||||
injectedDependencies,
|
injectedDependencies,
|
||||||
isModuleConfig(mod) ? mod.definition : undefined
|
(isObject(mod) ? mod.definition : undefined) as ModuleDefinition
|
||||||
)) as LoadedModule
|
)) as LoadedModule
|
||||||
|
|
||||||
if (allModules[key] && !Array.isArray(allModules[key])) {
|
if (allModules[moduleName] && !Array.isArray(allModules[moduleName])) {
|
||||||
allModules[key] = []
|
allModules[moduleName] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allModules[key]) {
|
if (allModules[moduleName]) {
|
||||||
;(allModules[key] as LoadedModule[]).push(loaded[key])
|
;(allModules[moduleName] as LoadedModule[]).push(loaded[moduleName])
|
||||||
} else {
|
} else {
|
||||||
allModules[key] = loaded[key]
|
allModules[moduleName] = loaded[moduleName]
|
||||||
}
|
}
|
||||||
|
|
||||||
return loaded
|
return loaded
|
||||||
|
|||||||
@@ -31,9 +31,7 @@ export type InternalModuleDeclaration = {
|
|||||||
scope: MODULE_SCOPE.INTERNAL
|
scope: MODULE_SCOPE.INTERNAL
|
||||||
resources: MODULE_RESOURCE_TYPE
|
resources: MODULE_RESOURCE_TYPE
|
||||||
dependencies?: string[]
|
dependencies?: string[]
|
||||||
/**
|
definition?: ModuleDefinition // That represent the definition of the module, such as the one we have for the medusa supported modules. This property is used for custom made modules.
|
||||||
* @deprecated The property should not be used.
|
|
||||||
*/
|
|
||||||
resolve?: string
|
resolve?: string
|
||||||
options?: Record<string, unknown>
|
options?: Record<string, unknown>
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +46,7 @@ export type InternalModuleDeclaration = {
|
|||||||
|
|
||||||
export type ExternalModuleDeclaration = {
|
export type ExternalModuleDeclaration = {
|
||||||
scope: MODULE_SCOPE.EXTERNAL
|
scope: MODULE_SCOPE.EXTERNAL
|
||||||
|
definition?: ModuleDefinition // That represent the definition of the module, such as the one we have for the medusa supported modules. This property is used for custom made modules.
|
||||||
server?: {
|
server?: {
|
||||||
type: "http"
|
type: "http"
|
||||||
url: string
|
url: string
|
||||||
@@ -86,10 +85,8 @@ export type ModuleDefinition = {
|
|||||||
* @deprecated property will be removed in future versions
|
* @deprecated property will be removed in future versions
|
||||||
*/
|
*/
|
||||||
isRequired?: boolean
|
isRequired?: boolean
|
||||||
/**
|
isQueryable?: boolean // If the module is queryable via Remote Joiner
|
||||||
* If the module is queryable via Remote Joiner
|
isLegacy?: boolean // If the module is a legacy module TODO: Remove once all the legacy modules are migrated
|
||||||
*/
|
|
||||||
isQueryable?: boolean
|
|
||||||
dependencies?: string[]
|
dependencies?: string[]
|
||||||
defaultModuleDeclaration:
|
defaultModuleDeclaration:
|
||||||
| InternalModuleDeclaration
|
| InternalModuleDeclaration
|
||||||
|
|||||||
Reference in New Issue
Block a user