fix(orchestration): ToRemoteJoinerHelper property building (#5130)
* fix(orchestration): ToRemoteJoinerHelper property building * update fix
This commit is contained in:
committed by
GitHub
parent
d709521826
commit
02fe4d1364
@@ -49,22 +49,22 @@ describe("toRemoteJoinerQuery", () => {
|
||||
fields: ["id", "title", "handle"],
|
||||
expands: [
|
||||
{
|
||||
property: "product.variants",
|
||||
property: "variants",
|
||||
fields: ["sku"],
|
||||
},
|
||||
{
|
||||
property: "product.variants.shipping_profiles",
|
||||
property: "variants.shipping_profiles",
|
||||
},
|
||||
{
|
||||
property: "product.variants.shipping_profiles.profile",
|
||||
property: "variants.shipping_profiles.profile",
|
||||
fields: ["id", "name"],
|
||||
},
|
||||
{
|
||||
property: "product.variants.options",
|
||||
property: "variants.options",
|
||||
fields: ["value"],
|
||||
},
|
||||
{
|
||||
property: "product.options",
|
||||
property: "options",
|
||||
fields: ["value", "name"],
|
||||
},
|
||||
],
|
||||
@@ -106,7 +106,7 @@ describe("toRemoteJoinerQuery", () => {
|
||||
fields: ["id", "title", "handle"],
|
||||
expands: [
|
||||
{
|
||||
property: "product.variants",
|
||||
property: "variants",
|
||||
directives: [
|
||||
{
|
||||
name: "directiveName",
|
||||
@@ -116,10 +116,10 @@ describe("toRemoteJoinerQuery", () => {
|
||||
fields: ["sku"],
|
||||
},
|
||||
{
|
||||
property: "product.variants.shipping_profiles",
|
||||
property: "variants.shipping_profiles",
|
||||
},
|
||||
{
|
||||
property: "product.variants.shipping_profiles.profile",
|
||||
property: "variants.shipping_profiles.profile",
|
||||
args: [
|
||||
{
|
||||
name: "context",
|
||||
|
||||
@@ -7,7 +7,7 @@ export function toRemoteJoinerQuery(obj: any): RemoteJoinerQuery {
|
||||
expands: [],
|
||||
}
|
||||
|
||||
function extractRecursive(obj, parentName = "") {
|
||||
function extractRecursive(obj, parentName = "", isEntryPoint = true) {
|
||||
for (const key in obj) {
|
||||
const value = obj[key]
|
||||
|
||||
@@ -21,7 +21,6 @@ export function toRemoteJoinerQuery(obj: any): RemoteJoinerQuery {
|
||||
property: entityName,
|
||||
}
|
||||
|
||||
const isEntryPoint = parentName === ""
|
||||
const reference = isEntryPoint ? remoteJoinerQuery : expandObj
|
||||
|
||||
if (value.__args) {
|
||||
@@ -47,7 +46,7 @@ export function toRemoteJoinerQuery(obj: any): RemoteJoinerQuery {
|
||||
remoteJoinerQuery.expands!.push(expandObj)
|
||||
}
|
||||
|
||||
extractRecursive(value, entityName)
|
||||
extractRecursive(value, isEntryPoint ? "" : entityName, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user