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