During a Rhai script callback functions' execution, our application would like to create and maintain additional values as global variables that can be later used by other router request lifecycles
fn subgraph_service(service, subgraph){
let v = Router.EXTRA_VARIABLE;
let f = |request| {
print(v);
};
service.map_request(f);
Router.EXTRA_VARIABLE++;
}
Describe alternatives you've considered
A coprocessor can achieve this but we would like to use Rhai to improve performance by minimizing communication costs between the coprocessor and the router
Additional context
Add any other context or screenshots about the feature request here.
Is your feature request related to a problem? Please describe.
Currently, Rhai's support for global variables is limited to only things that are maintained by
Router.*
(https://www.apollographql.com/docs/router/customizations/rhai/#global-variables) without the option to store additional onesDescribe the solution you'd like
During a Rhai script callback functions' execution, our application would like to create and maintain additional values as global variables that can be later used by other router request lifecycles
Describe alternatives you've considered
A coprocessor can achieve this but we would like to use Rhai to improve performance by minimizing communication costs between the coprocessor and the router
Additional context
Add any other context or screenshots about the feature request here.