@redocly/graphql-docs
Version:
Redocly GraphQL docs
2 lines (1 loc) • 1.34 kB
JavaScript
var a=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var b=(t,n)=>{for(var e in n)a(t,e,{get:n[e],enumerable:!0})},j=(t,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of y(n))!l.call(t,r)&&r!==e&&a(t,r,{get:()=>n[r],enumerable:!(o=w(n,r))||o.enumerable});return t};var m=t=>j(a({},"__esModule",{value:!0}),t);var g={};b(g,{fetchIntrospection:()=>O});module.exports=m(g);var u=require("graphql"),v=function(t,n,e,o){function r(c){return c instanceof e?c:new e(function(s){s(c)})}return new(e||(e=Promise))(function(c,s){function h(i){try{f(o.next(i))}catch(p){s(p)}}function d(i){try{f(o.throw(i))}catch(p){s(p)}}function f(i){i.done?c(i.value):r(i.value).then(h,d)}f((o=o.apply(t,n||[])).next())})};function O(t,n){return v(this,void 0,void 0,function*(){if(!global.fetch)throw new Error("GraphQL API introspection is not supported outside of a browser.");const e=JSON.stringify({query:(0,u.getIntrospectionQuery)()}),o=yield fetch(t,{method:"POST",headers:_(n),body:e}).then(r=>r.json());if(o.errors)throw new Error("GraphQL service replied with errors: "+JSON.stringify(o.errors));return o.data})}function _(t){return Object.assign({"Content-Type":"application/json",Accept:"application/json"},t)}0&&(module.exports={fetchIntrospection});