Invoke a second request in "onSubgraphExecute" hook before query execution #571
Unanswered
BabakScript
asked this question in
Q&A
Replies: 1 comment 13 replies
-
Hi @ardatan, any suggestion for this? |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys,
I have a use case that I handled before with GraphQL Mesh V0 and I need to re-implement that in Hive now after upgrading to Mesh V1.
I need to manipulate one specific query on a specific subgraph to inject an additional filter to the query on the fly before executing the query.
For this extra filter, I need to call another sub-graph to get the filter values on the fly.
Previously in the Mesh V0 I implemented that with the power of customResolvers so I created a resolver like this:
And set it in my
.meshrc.ts
like this:Now, with Mesh V1 and Hive as a gateway, as I checked, I need to create a custom plugin and use the hooks (probably onSubgraphExecute) to implement the same logic rather than customResolver. But as I realized, there is no SDK available in Hive to invoke the middle query. How can I invoke the middle query in my main query? (I mean the step one)
This is my draft plugin:
Beta Was this translation helpful? Give feedback.
All reactions