I'm trying to combine multiple GraphQL queries into one query using JavaScript.
I am looking for something like this:
let query3 = mergeQueries(query1, query2);
We won't know beforehand which queries will be combined.
Suppose I have queries like this:
input query1:
{
post(id: 1234) {
title
description
}
}
input query2:
{
post(id: 1234) {
tags
author {
name
}
}
}
Then I would like the result query3 to be:
result query3:
{
post(id: 1234) {
title
tags
description
author {
name
}
}
}
This would be the same functionality as lodash _.merge()
does for JSON objects, but then with GraphQL queries instead of JSON objects.