@graphql-mesh/serve-runtime
Version:
18 lines (17 loc) • 497 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.useCustomAgent = useCustomAgent;
function useCustomAgent(agentFactory) {
return {
onFetch(payload) {
const agent = agentFactory(payload);
if (agent != null) {
payload.setOptions({
...payload.options,
// @ts-expect-error - `agent` is there
agent,
});
}
},
};
}
;