feat(medusa,orchestration): Decouple Product in Cart domain (#4945)

This commit is contained in:
Carlos R. L. Rodrigues
2023-09-08 12:24:46 -03:00
committed by GitHub
parent 1958809fa9
commit 4b0e3fb2a7
22 changed files with 459 additions and 221 deletions

View File

@@ -557,14 +557,15 @@ export class RemoteJoiner {
parsedExpands: Map<string, RemoteExpandProperty>
): Map<string, RemoteExpandProperty> {
const mergedExpands = new Map<string, RemoteExpandProperty>(parsedExpands)
const mergedPaths = new Map<string, string>()
const mergedPaths = new Map<string, RemoteExpandProperty>()
for (const [path, expand] of mergedExpands.entries()) {
const currentServiceName = expand.serviceConfig.serviceName
let parentPath = expand.parent
while (parentPath) {
const parentExpand = mergedExpands.get(parentPath)
const parentExpand =
mergedExpands.get(parentPath) ?? mergedPaths.get(parentPath)
if (
!parentExpand ||
parentExpand.serviceConfig.serviceName !== currentServiceName
@@ -588,7 +589,7 @@ export class RemoteJoiner {
targetExpand.args = expand.args
mergedExpands.delete(path)
mergedPaths.set(path, parentPath)
mergedPaths.set(path, expand)
parentPath = parentExpand.parent
}