chore(medusa,orchestration,link-modules,modules-sdk): internal services as modules (#4925)

This commit is contained in:
Carlos R. L. Rodrigues
2023-09-04 11:36:05 -03:00
committed by GitHub
parent 85fa90d9c6
commit a4906d0ac0
15 changed files with 348 additions and 110 deletions

View File

@@ -17,8 +17,17 @@ export class RemoteQuery {
private customRemoteFetchData?: RemoteFetchDataCallback
constructor(
modulesLoaded?: LoadedModule[],
customRemoteFetchData?: RemoteFetchDataCallback
{
modulesLoaded,
customRemoteFetchData,
servicesConfig,
}: {
modulesLoaded?: LoadedModule[]
customRemoteFetchData?: RemoteFetchDataCallback
servicesConfig?: ModuleJoinerConfig[]
} = {
servicesConfig: [],
}
) {
if (!modulesLoaded?.length) {
modulesLoaded = MedusaModule.getLoadedModules().map(
@@ -26,7 +35,6 @@ export class RemoteQuery {
)
}
const servicesConfig: ModuleJoinerConfig[] = []
for (const mod of modulesLoaded) {
if (!mod.__definition.isQueryable) {
continue
@@ -41,7 +49,7 @@ export class RemoteQuery {
}
this.modulesMap.set(serviceName, mod)
servicesConfig.push(mod.__joinerConfig)
servicesConfig!.push(mod.__joinerConfig)
}
this.customRemoteFetchData = customRemoteFetchData
@@ -65,7 +73,7 @@ export class RemoteQuery {
this.remoteJoiner.setFetchDataCallback(remoteFetchData)
}
private static getAllFieldsAndRelations(
public static getAllFieldsAndRelations(
data: any,
prefix = "",
args: Record<string, unknown[]> = {}