UNPKG

@gqty/cli

Version:

## Visit [https://gqty.dev/docs/cli/codegen](https://gqty.dev/docs/cli/codegen)

2 lines (1 loc) 582 B
import*as i from"graphql";import{loadOrGenerateConfig as m,defaultConfig as p}from"./config.mjs";import*as o from"./deps.js";const h=async(t,{headers:e}={})=>{const a=async({document:n,variables:s})=>{var r;e||(e=((r=(await m()).config.introspection)==null?void 0:r.headers)||p.introspection.headers);const c=i.print(n);return await(await o.fetch(t,{method:"POST",headers:{"Content-Type":"application/json",...e},body:JSON.stringify({query:c,variables:s})})).json()};return o.wrapSchema({schema:await o.schemaFromExecutor(a,{endpoint:t}),executor:a})};export{h as getRemoteSchema};