UNPKG

@lowdefy/graphql-federated

Version:
14 lines (13 loc) 11.1 MB
/*! For license information please see 7.index.js.LICENSE.txt */ exports.id=7,exports.ids=[7],exports.modules={33107:e=>{"use strict";e.exports={i8:"2.25.0"}},86387:e=>{"use strict";e.exports=JSON.parse('{"name":"apollo-tracing","version":"0.15.0","description":"Collect and expose trace data for GraphQL requests","main":"./dist/index.js","types":"./dist/index.d.ts","license":"MIT","repository":"apollographql/apollo-tracing-js","author":"Apollo <opensource@apollographql.com>","engines":{"node":">=4.0"},"dependencies":{"apollo-server-env":"^3.1.0","apollo-server-plugin-base":"^0.13.0"},"peerDependencies":{"graphql":"^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0"},"gitHead":"42983b06a381aee6333fd11d5af7bd7fa0d549ec"}')},27170:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.buildServiceDefinition=void 0;const n=r(13191),i=r(44600),s=r(30669);function o(e){return(new Array).concat(...e)}function a(e,t){for(const[r,i]of Object.entries(t)){const t=e.getType(r);if(!n.isObjectType(t))continue;const s=t.getFields();for(const[e,r]of Object.entries(i)){if(e.startsWith("__")){t[e.substring(2)]=r;continue}const n=s[e];n&&("function"==typeof r?n.resolve=r:(r.resolve&&(n.resolve=r.resolve),r.subscribe&&(n.subscribe=r.subscribe)))}}}t.buildServiceDefinition=function(e){const t=[],r=Object.create(null),u=Object.create(null),c=Object.create(null),p=[],l=[];for(let t of e){i.isNode(t)&&i.isDocumentNode(t)&&(t={typeDefs:t});for(const e of t.typeDefs.definitions)if(n.isTypeDefinitionNode(e)){const t=e.name.value;r[t]?r[t].push(e):r[t]=[e]}else if(n.isTypeExtensionNode(e)){const t=e.name.value;u[t]?u[t].push(e):u[t]=[e]}else if(e.kind===n.Kind.DIRECTIVE_DEFINITION){const t=e.name.value;c[t]?c[t].push(e):c[t]=[e]}else e.kind===n.Kind.SCHEMA_DEFINITION?p.push(e):e.kind===n.Kind.SCHEMA_EXTENSION&&l.push(e)}for(const[e,i]of Object.entries(r))i.length>1&&t.push(new n.GraphQLError(`Type "${e}" was defined more than once.`,i));for(const[e,r]of Object.entries(c))r.length>1&&t.push(new n.GraphQLError(`Directive "${e}" was defined more than once.`,r));let m;if(p.length>0||l.length>0){m={};const e=p[p.length-1],t=o([e,...l].map((e=>e.operationTypes)).filter(s.isNotNullOrUndefined));for(const i of t){const t=i.type.name.value,s=i.operation;if(m[s])throw new n.GraphQLError(`Must provide only one ${s} type in schema.`,[e]);if(!r[t]&&!u[t])throw new n.GraphQLError(`Specified ${s} type "${t}" not found in document.`,[e]);m[s]=t}}else m={query:"Query",mutation:"Mutation",subscription:"Subscription"};for(const[e,i]of Object.entries(u))r[e]||(Object.values(m).includes(e)?r[e]=[{kind:n.Kind.OBJECT_TYPE_DEFINITION,name:{kind:n.Kind.NAME,value:e}}]:t.push(new n.GraphQLError(`Cannot extend type "${e}" because it does not exist in the existing schema.`,i)));if(t.length>0)return{errors:t};try{const t=o(Object.values(r)),i=o(Object.values(c));let s=n.buildASTSchema({kind:n.Kind.DOCUMENT,definitions:[...t,...i]});const p=o(Object.values(u));p.length>0&&(s=n.extendSchema(s,{kind:n.Kind.DOCUMENT,definitions:p}));for(const t of e)t.resolvers&&a(s,t.resolvers);return{schema:s}}catch(e){return{errors:[e]}}}},14501:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(25776),t),i(r(27906),t),i(r(27170),t)},27906:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(97365),t),i(r(46373),t)},46373:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},97365:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},44600:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDocumentNode=t.isNode=void 0;const n=r(13191);function i(e){return e&&"string"==typeof e.kind}t.isNode=i,t.isDocumentNode=function(e){return i(e)&&e.kind===n.Kind.DOCUMENT}},25776:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(60886),t),i(r(30669),t),i(r(44600),t)},60886:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.invariant=void 0,t.invariant=function(e,t){if(!e)throw new Error(t)}},30669:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNotNullOrUndefined=void 0,t.isNotNullOrUndefined=function(e){return null!=e}},39717:(e,t,r)=>{"use strict";t.__esModule=!0,t.GraphQLUpload=void 0;const n=new(r(13191).GraphQLScalarType)({name:"Upload",description:"The `Upload` scalar type represents a file upload.",parseValue:e=>e,parseLiteral(){throw new Error("‘Upload’ scalar literal unsupported.")},serialize(){throw new Error("‘Upload’ scalar serialization unsupported.")}});t.GraphQLUpload=n},92178:(e,t)=>{"use strict";t.__esModule=!0,t.SPEC_URL=void 0,t.SPEC_URL="https://github.com/jaydenseric/graphql-multipart-request-spec"},4820:(e,t,r)=>{"use strict";t.__esModule=!0,t.graphqlUploadExpress=void 0;var n=r(83725);t.graphqlUploadExpress=({processRequest:e=n.processRequest,...t}={})=>(r,n,i)=>{if(!r.is("multipart/form-data"))return i();const s=new Promise((e=>r.on("end",e))),{send:o}=n;n.send=(...e)=>{s.then((()=>{n.send=o,n.send(...e)}))},e(r,n,t).then((e=>{r.body=e,i()})).catch((e=>{e.status&&e.expose&&n.status(e.status),i(e)}))}},34568:(e,t,r)=>{"use strict";t.__esModule=!0,t.graphqlUploadKoa=void 0;var n=r(83725);t.graphqlUploadKoa=({processRequest:e=n.processRequest,...t}={})=>async(r,n)=>{if(!r.request.is("multipart/form-data"))return n();const i=new Promise((e=>r.req.on("end",e)));try{r.request.body=await e(r.req,r.res,t),await n()}finally{await i}}},67375:(e,t)=>{"use strict";t.__esModule=!0,t.ignoreStream=void 0,t.ignoreStream=e=>{e.on("error",(()=>{})),e.resume()}},79542:(e,t,r)=>{"use strict";t.__esModule=!0,t.graphqlUploadExpress=t.graphqlUploadKoa=t.processRequest=t.GraphQLUpload=void 0;var n=r(39717);t.GraphQLUpload=n.GraphQLUpload;var i=r(83725);t.processRequest=i.processRequest;var s=r(34568);t.graphqlUploadKoa=s.graphqlUploadKoa;var o=r(4820);t.graphqlUploadExpress=o.graphqlUploadExpress},13696:(e,t)=>{"use strict";t.__esModule=!0,t.isEnumerableObject=void 0,t.isEnumerableObject=e=>"object"==typeof e&&null!==e&&!Array.isArray(e)},83725:(e,t,r)=>{"use strict";t.__esModule=!0,t.processRequest=void 0;var n=l(r(31669)),i=l(r(7973)),s=r(87053),o=l(r(73545)),a=l(r(64456)),u=r(92178),c=r(67375),p=r(13696);function l(e){return e&&e.__esModule?e:{default:e}}class m{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{this.file=t,e(t)},this.reject=t})),this.promise.catch((()=>{}))}}t.processRequest=(e,t,{maxFieldSize:r=1e6,maxFileSize:l=1/0,maxFiles:d=1/0}={})=>new Promise(((y,h)=>{let b,f,g,S,N,v;const T=new i.default({headers:e.headers,limits:{fieldSize:r,fields:2,fileSize:l,files:d}}),I=t=>{if(!f){if(f=t,h(f),T.destroy(),g&&g.destroy(f),v)for(const e of v.values())e.file||e.reject(f);e.unpipe(T),setImmediate((()=>{e.resume()}))}},k=()=>{if(!b&&(b=!0,v))for(const e of v.values())e.file&&e.file.capacitor.destroy()},C=()=>{I((0,o.default)(499,"Request disconnected during file upload stream parsing."))};T.on("field",((e,t,n,i)=>{if(!f){if(i)return I((0,o.default)(413,`The ‘${e}’ multipart field value exceeds the ${r} byte size limit.`));switch(e){case"operations":try{S=JSON.parse(t)}catch(e){return I((0,o.default)(400,`Invalid JSON in the ‘operations’ multipart field (${u.SPEC_URL}).`))}if(!(0,p.isEnumerableObject)(S)&&!Array.isArray(S))return I((0,o.default)(400,`Invalid type for the ‘operations’ multipart field (${u.SPEC_URL}).`));N=(0,a.default)(S);break;case"map":{if(!S)return I((0,o.default)(400,`Misordered multipart fields; ‘map’ should follow ‘operations’ (${u.SPEC_URL}).`));let e;try{e=JSON.parse(t)}catch(e){return I((0,o.default)(400,`Invalid JSON in the ‘map’ multipart field (${u.SPEC_URL}).`))}if(!(0,p.isEnumerableObject)(e))return I((0,o.default)(400,`Invalid type for the ‘map’ multipart field (${u.SPEC_URL}).`));const r=Object.entries(e);if(r.length>d)return I((0,o.default)(413,`${d} max file uploads exceeded.`));v=new Map;for(const[e,t]of r){if(!Array.isArray(t))return I((0,o.default)(400,`Invalid type for the ‘map’ multipart field entry key ‘${e}’ array (${u.SPEC_URL}).`));v.set(e,new m);for(const[r,n]of t.entries()){if("string"!=typeof n)return I((0,o.default)(400,`Invalid type for the ‘map’ multipart field entry key ‘${e}’ array index ‘${r}’ value (${u.SPEC_URL}).`));try{N.set(n,v.get(e).promise)}catch(t){return I((0,o.default)(400,`Invalid object path for the ‘map’ multipart field entry key ‘${e}’ array index ‘${r}’ value ‘${n}’ (${u.SPEC_URL}).`))}}}y(S)}}}})),T.on("file",((e,t,r,i,a)=>{if(f)return void(0,c.ignoreStream)(t);if(!v)return(0,c.ignoreStream)(t),I((0,o.default)(400,`Misordered multipart fields; files should follow ‘map’ (${u.SPEC_URL}).`));g=t,t.on("end",(()=>{g=null}));const p=v.get(e);if(!p)return void(0,c.ignoreStream)(t);const m=new s.WriteStream;m.on("error",(()=>{t.unpipe(),t.resume()})),t.on("limit",(()=>{t.unpipe(),m.destroy((0,o.default)(413,`File truncated as it exceeds the ${l} byte size limit.`))})),t.on("error",(e=>{t.unpipe(),m.destroy(f||e)})),t.pipe(m);const d={filename:r,mimetype:a,encoding:i,createReadStream(){const e=m.error||(b?f:null);if(e)throw e;return m.createReadStream()}};let y;Object.defineProperty(d,"stream",{get:n.default.deprecate((function(){return y||(y=this.createReadStream()),y}),"File upload property ‘stream’ is deprecated. Use ‘createReadStream()’ instead.")}),Object.defineProperty(d,"capacitor",{value:m}),p.resolve(d)})),T.once("filesLimit",(()=>I((0,o.default)(413,`${d} max file uploads exceeded.`)))),T.once("finish",(()=>{if(e.unpipe(T),e.resume(),!S)return I((0,o.default)(400,`Missing multipart field ‘operations’ (${u.SPEC_URL}).`));if(!v)return I((0,o.default)(400,`Missing multipart field ‘map’ (${u.SPEC_URL}).`));for(const e of v.values())e.file||e.reject((0,o.default)(400,"File missing in the request."))})),T.once("error",I),t.once("finish",k),t.once("close",k),e.once("close",C),e.once("end",(()=>{e.removeListener("close",C)})),e.pipe(T)}))},96604:(e,t,r)=>{"use strict";e.exports=function(e,t){if(!e._opts.allErrors)throw new Error("ajv-errors: Ajv option allErrors must be true");return e._opts.jsonPointers||(console.warn("ajv-errors: Ajv option jsonPointers changed to true"),e._opts.jsonPointers=!0),e.addKeyword("errorMessage",{inline:r(48900),statements:!0,valid:!0,errors:"full",config:{KEYWORD_PROPERTY_PARAMS:{required:"missingProperty",dependencies:"property"},options:t||{}},metaSchema:{type:["string","object"],properties:{properties:{$ref:"#/definitions/stringMap"},items:{$ref:"#/definitions/stringList"},required:{$ref:"#/definitions/stringOrMap"},dependencies:{$ref:"#/definitions/stringOrMap"}},additionalProperties:{type:"string"},definitions:{stringMap:{type:["object"],additionalProperties:{type:"string"}},stringOrMap:{type:["string","object"],additionalProperties:{type:"string"}},stringList:{type:["array"],items:{type:"string"}}}}}),e}},48900:e=>{"use strict";e.exports=function(e,t,r){var n=" ",i=e.level,s=e.dataLevel,o=e.schema[t],a=e.schemaPath+e.util.getProperty(t),u=(e.errSchemaPath,e.opts.allErrors,"data"+(s||""));if(!1!==e.createErrors){var c=/\$\{[^\}]+\}/,p=/\$\{([^\}]+)\}/g,l=/^\'\'\s*\+\s*|\s*\+\s*\'\'$/g,m=e.self.getKeyword(t).config,d="_em_dataPath"+i,y="_em_i"+i,h="_em_key"+i,b="_em_keyProp"+i,f="_em_err"+i,g="_em_child"+i,S="_em_childKeyword"+i,N="_em_matches"+i,v="_em_isArray"+i,T="_em_errors"+i,I="_em_message"+i,k="_em_paramsErrors"+i,C="_em_propParam"+i,A="_em_keywordPropParams"+i,x="_em_templates"+i,_=e.util.toQuotedString(e.errSchemaPath);if(n+=" if (errors > 0) { var "+d+" = (dataPath || '') + "+e.errorPath+"; var "+y+", "+f+", "+T+"; ","object"==typeof o){var D={},E={},R={properties:{},items:{}},w=!1,P=!1,q=!1;for(var M in o)switch(M){case"properties":for(var L in o.properties)P=!0,R.properties[L]=[];break;case"items":for(var O=0;O<o.items.length;O++)q=!0,R.items[O]=[];break;default:if("object"==typeof o[M])for(var L in w=!0,E[M]={},o[M])E[M][L]=[];else D[M]=[]}var U=Object.keys(D);if(U.length){n+=" "+y+" = 0; "+T+" = "+JSON.stringify(D)+"; var "+x+" = { ";var B=!1,G=U;if(G)for(var j=-1,F=G.length-1;j<F;)M=G[j+=1],c.test(o[M])&&(B&&(n+=","),n+=e.util.toQuotedString(M)+": "+me(o[M])+" ",B=!0);n+=" }; while ("+y+" < errors) { "+f+" = vErrors["+y+"]; if ( "+f+".keyword != '"+t+"' ",m.options.keepErrors&&(n+=" && !"+f+".emUsed "),n+=" && "+f+".keyword in "+T+" && "+f+".dataPath == "+d+" && "+f+".schemaPath.indexOf("+_+") == 0 && /^\\/[^\\/]*$/.test("+f+".schemaPath.slice("+e.errSchemaPath.length+"))) { "+T+"["+f+".keyword].push("+f+"); ",m.options.keepErrors?n+=" "+f+".emUsed = true; ":n+=" vErrors.splice("+y+", 1); errors--; ",n+=" } else { "+y+"++; } } ",m.options.singleError&&(n+=" var "+I+" = ''; var "+k+" = []; "),n+=" for (var "+h+" in "+T+") { if ("+T+"["+h+"].length) { ",m.options.singleError?(n+=" if ("+I+") { "+I+" += ","string"==typeof m.options.singleError?n+=" "+e.util.toQuotedString(m.options.singleError)+" ":n+=" '; ' ",n+="; } "+I+" += "+h+" in "+x+" ? "+x+"["+h+"] () : validate.schema"+a+"["+h+"]; "+k+" = "+k+".concat("+T+"["+h+"]); } } "):n+=" var "+I+" = "+h+" in "+x+" ? "+x+"["+h+"] () : validate.schema"+a+"["+h+"]; var "+k+" = "+T+"["+h+"]; ",n+=" var err = { keyword: '"+t+"' , dataPath: "+d+" , schemaPath: "+_+" + '/"+t+"' , params: { errors: "+k+" } , message: "+I+" ",e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" }; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",m.options.singleError||(n+=" } } ")}if(w){n+=" "+y+" = 0; "+T+" = "+JSON.stringify(E)+"; var "+k+", "+C+"; var "+A+" = "+JSON.stringify(m.KEYWORD_PROPERTY_PARAMS)+"; var "+x+" = { ",B=!1;var V=Object.keys(E);if(V)for(var z=-1,K=V.length-1;z<K;){var W=o[M=V[z+=1]];B&&(n+=","),n+=e.util.toQuotedString(M)+": { ",B=!0;var H=!1,J=Object.keys(W);if(J)for(var Y=-1,Q=J.length-1;Y<Q;)L=J[Y+=1],c.test(W[L])&&(H&&(n+=","),n+=e.util.toQuotedString(L)+": "+me(W[L])+" ",H=!0);n+=" } "}n+=" }; while ("+y+" < errors) { "+f+" = vErrors["+y+"]; if ( "+f+".keyword != '"+t+"' ",m.options.keepErrors&&(n+=" && !"+f+".emUsed "),n+=" && "+f+".keyword in "+T+" && "+f+".dataPath == "+d+" && "+f+".schemaPath.indexOf("+_+") == 0 && /^\\/[^\\/]*$/.test("+f+".schemaPath.slice("+e.errSchemaPath.length+"))) { "+C+" = "+A+"["+f+".keyword]; "+k+" = "+T+"["+f+".keyword]["+f+".params["+C+"]]; if ("+k+") { "+k+".push("+f+"); ",m.options.keepErrors?n+=" "+f+".emUsed = true; ":n+=" vErrors.splice("+y+", 1); errors--; ",n+=" } else { "+y+"++; } } else { "+y+"++; } } for (var "+h+" in "+T+") { for (var "+b+" in "+T+"["+h+"]) { "+k+" = "+T+"["+h+"]["+b+"]; if ("+k+".length) { var "+I+" = "+h+" in "+x+" && "+b+" in "+x+"["+h+"] ? "+x+"["+h+"]["+b+"] () : validate.schema"+a+"["+h+"]["+b+"]; var err = { keyword: '"+t+"' , dataPath: "+d+" , schemaPath: "+_+" + '/"+t+"' , params: { errors: "+k+" } , message: "+I+" ",e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" }; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } } "}if(P||q){if(n+=" var "+v+" = Array.isArray("+u+"); if ",P&&q){n+=" (typeof "+u+" == 'object') { ";var $="["+S+"]";n+=" "+y+" = 0; if ("+v+") { var "+S+" = 'items'; "+T+" = "+JSON.stringify(R.items)+"; ",n+=" var "+x+" = { ",B=!1;var Z=Object.keys(R.items);if(Z)for(var X=-1,ee=Z.length-1;X<ee;)M=Z[X+=1],c.test(o.items[M])&&(B&&(n+=","),n+=e.util.toQuotedString(M)+": "+me(o.items[M])+" ",B=!0);n+=" }; } else { var "+S+" = 'properties'; "+T+" = "+JSON.stringify(R.properties)+"; ",n+=" var "+x+" = { ",B=!1;var te=Object.keys(R.properties);if(te)for(var re=-1,ne=te.length-1;re<ne;)M=te[re+=1],c.test(o.properties[M])&&(B&&(n+=","),n+=e.util.toQuotedString(M)+": "+me(o.properties[M])+" ",B=!0);n+=" }; } "}else if(P){n+=" (typeof "+u+" == 'object' && !"+v+") { ",$=".properties",n+=" "+y+" = 0; "+T+" = "+JSON.stringify(R.properties)+"; ",n+=" var "+x+" = { ",B=!1;var ie=Object.keys(R.properties);if(ie)for(var se=-1,oe=ie.length-1;se<oe;)M=ie[se+=1],c.test(o.properties[M])&&(B&&(n+=","),n+=e.util.toQuotedString(M)+": "+me(o.properties[M])+" ",B=!0);n+=" }; "}else{n+=" ("+v+") { ",$=".items",n+=" "+y+" = 0; "+T+" = "+JSON.stringify(R.items)+"; ",n+=" var "+x+" = { ",B=!1;var ae=Object.keys(R.items);if(ae)for(var ue=-1,ce=ae.length-1;ue<ce;)M=ae[ue+=1],c.test(o.items[M])&&(B&&(n+=","),n+=e.util.toQuotedString(M)+": "+me(o.items[M])+" ",B=!0);n+=" }; "}n+=" var "+g+", "+N+"; while ("+y+" < errors) { "+f+" = vErrors["+y+"]; if ( "+f+".keyword != '"+t+"' ",m.options.keepErrors&&(n+=" && !"+f+".emUsed "),n+=" && "+f+".dataPath.indexOf("+d+") == 0 && ("+N+" = "+f+".dataPath.slice("+d+".length).match(/^\\/([^\\/]*)(?:\\/|$)/), "+g+" = "+N+" && "+N+"[1].replace(/~1/g, '/').replace(/~0/g, '~') ) !== undefined && "+g+" in "+T+") { "+T+"["+g+"].push("+f+"); ",m.options.keepErrors?n+=" "+f+".emUsed = true; ":n+=" vErrors.splice("+y+", 1); errors--; ",n+=" } else { "+y+"++; } } for (var "+h+" in "+T+") { if ("+T+"["+h+"].length) { var err = { keyword: '"+t+"' , dataPath: "+d+" + '/' + "+h+".replace(/~/g, '~0').replace(/\\//g, '~1') , schemaPath: "+_+" + '/"+t+"' , params: { errors: "+T+"["+h+"] } , message: "+h+" in "+x+" ? "+x+"["+h+"] () : validate.schema"+a+$+"["+h+"] ",e.opts.verbose&&(n+=" , schema: validate.schema"+a+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" }; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } } "}}var pe="string"==typeof o?o:o._;pe&&(n+=" "+y+" = 0; "+T+" = []; while ("+y+" < errors) { "+f+" = vErrors["+y+"]; if ( "+f+".keyword != '"+t+"' ",m.options.keepErrors&&(n+=" && !"+f+".emUsed "),n+=" && ("+f+".dataPath == "+d+" || ("+f+".dataPath.indexOf("+d+") == 0 && "+f+".dataPath["+d+".length] == '/')) && "+f+".schemaPath.indexOf("+_+") == 0 && "+f+".schemaPath["+e.errSchemaPath.length+"] == '/') { "+T+".push("+f+"); ",m.options.keepErrors?n+=" "+f+".emUsed = true; ":n+=" vErrors.splice("+y+", 1); errors--; ",n+=" } else { "+y+"++; } } if ("+T+".length) { var err = { keyword: '"+t+"' , dataPath: "+d+" , schemaPath: "+_+" + '/"+t+"' , params: { errors: "+T+" } , message: "+le(pe)+" ",e.opts.verbose&&(n+=" , schema: "+e.util.toQuotedString(pe)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),n+=" }; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "),n+=" }"}function le(t){return t=e.util.escapeQuotes(t),c.test(t)?("'"+t.replace(p,(function(t,r){return"' + JSON.stringify("+e.util.getData(r,s,e.dataPathArr)+") + '"}))+"'").replace(l,""):"'"+t+"'"}function me(e){return"function() { return "+le(e)+"; }"}return n}},69906:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.__testing__=t.plugin=t.CacheScope=void 0;const n=r(13191);var i;function s(e){if(!e)return;const t=e.find((e=>"cacheControl"===e.name.value));if(!t)return;if(!t.arguments)return;const r=t.arguments.find((e=>"maxAge"===e.name.value)),n=t.arguments.find((e=>"scope"===e.name.value));return{maxAge:r&&r.value&&"IntValue"===r.value.kind?parseInt(r.value.value):void 0,scope:n&&n.value&&"EnumValue"===n.value.kind?n.value.value:void 0}}function o(e,t){return t?{maxAge:void 0!==t.maxAge?t.maxAge:e.maxAge,scope:t.scope||e.scope}:e}function a(e){let t,r=i.Public;for(const n of e.values())void 0!==n.maxAge&&(t=void 0!==t?Math.min(t,n.maxAge):n.maxAge),n.scope===i.Private&&(r=i.Private);return t?{maxAge:t,scope:r}:void 0}function u(e,t,r){const n=e.get(t);n?e.set(t,o(n,r)):e.set(t,r)}!function(e){e.Public="PUBLIC",e.Private="PRIVATE"}(i=t.CacheScope||(t.CacheScope={})),t.plugin=(e=Object.create(null))=>({requestDidStart(t){const r=e.defaultMaxAge||0,i=new Map;function c(){t.overallCachePolicy||(t.overallCachePolicy=a(i))}return{executionDidStart:()=>({executionDidEnd:()=>c(),willResolveField({info:e}){let t={};const a=n.getNamedType(e.returnType);(a instanceof n.GraphQLObjectType||a instanceof n.GraphQLInterfaceType)&&a.astNode&&(t=o(t,s(a.astNode.directives)));const c=e.parentType.getFields()[e.fieldName];c.astNode&&(t=o(t,s(c.astNode.directives))),(a instanceof n.GraphQLObjectType||a instanceof n.GraphQLInterfaceType||!e.path.prev)&&void 0===t.maxAge&&(t.maxAge=r),void 0===t.maxAge&&void 0===t.scope||u(i,e.path,t),e.cacheControl={setCacheHint:t=>{u(i,e.path,t)},cacheHint:t}}}),responseForOperation:()=>(c(),null),willSendResponse(t){const{response:r,overallCachePolicy:s}=t;if(r.errors)return;const o=s||(t.overallCachePolicy=a(i));if(o&&e.calculateHttpHeaders&&r.http&&r.http.headers.set("Cache-Control",`max-age=${o.maxAge}, ${o.scope.toLowerCase()}`),!1!==e.stripFormattedExtensions)return;const u=r.extensions||(r.extensions=Object.create(null));if(void 0!==u.cacheControl)throw new Error("The cacheControl information already existed.");u.cacheControl={version:1,hints:Array.from(i).map((([e,t])=>Object.assign({path:[...n.responsePathAsArray(e)]},t)))}}}}}),t.__testing__={addHint:u,computeOverallCachePolicy:a}},1438:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.defaultEngineReportingSignature=t.operationHash=t.operationRegistrySignature=t.defaultUsageReportingSignature=t.defaultOperationRegistrySignature=void 0;var s=r(645);Object.defineProperty(t,"defaultOperationRegistrySignature",{enumerable:!0,get:function(){return s.defaultOperationRegistrySignature}}),Object.defineProperty(t,"defaultUsageReportingSignature",{enumerable:!0,get:function(){return s.defaultUsageReportingSignature}}),Object.defineProperty(t,"operationRegistrySignature",{enumerable:!0,get:function(){return s.operationRegistrySignature}}),Object.defineProperty(t,"operationHash",{enumerable:!0,get:function(){return s.operationHash}}),Object.defineProperty(t,"defaultEngineReportingSignature",{enumerable:!0,get:function(){return s.defaultUsageReportingSignature}}),i(r(19662),t)},645:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.operationHash=t.defaultOperationRegistrySignature=t.operationRegistrySignature=t.defaultUsageReportingSignature=void 0;const n=r(49118),i=r(29299);function s(e,t,r={preserveStringAndNumericLiterals:!1}){const i=n.dropUnusedDefinitions(e,t),s=r.preserveStringAndNumericLiterals?i:n.hideStringAndNumericLiterals(i);return n.printWithReducedWhitespace(n.sortAST(s))}t.defaultUsageReportingSignature=function(e,t){return n.printWithReducedWhitespace(n.sortAST(n.removeAliases(n.hideLiterals(n.dropUnusedDefinitions(e,t)))))},t.operationRegistrySignature=s,t.defaultOperationRegistrySignature=function(e,t){return s(e,t,{preserveStringAndNumericLiterals:!1})},t.operationHash=function(e){return i.createHash("sha256").update(e).digest("hex")}},79352:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GraphQLSchemaValidationError=void 0;class r extends Error{constructor(e){super(),this.errors=e,this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),this.message=e.map((e=>e.message)).join("\n\n")}}t.GraphQLSchemaValidationError=r},88469:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.addResolversToSchema=t.buildSchemaFromSDL=t.modulesFromSDL=void 0;const i=r(13191),s=r(35870),o=r(62518),a=r(79352),u=r(70844),c=n(r(44589)),p=r(89371),l=r(61926),m=[p.KnownTypeNamesRule,p.UniqueDirectivesPerLocationRule];try{const e=r(54919).j;e&&m.push(e)}catch(e){}const d=u.specifiedSDLRules.filter((e=>!m.includes(e)));function y(e){return Array.isArray(e)?e.map((e=>o.isNode(e)&&o.isDocumentNode(e)?{typeDefs:e}:e)):[{typeDefs:e}]}t.modulesFromSDL=y,t.buildSchemaFromSDL=function(e,t){const r=y(e),n=i.concatAST(r.map((e=>e.typeDefs))),o=s.validateSDL(n,t,d);if(o.length>0)throw new a.GraphQLSchemaValidationError(o);const u=Object.create(null),p=Object.create(null),m=[],g=[],S=[];for(const e of n.definitions)if(i.isTypeDefinitionNode(e)){const t=e.name.value;u[t]?u[t].push(e):u[t]=[e]}else if(i.isTypeExtensionNode(e)){const t=e.name.value;p[t]?p[t].push(e):p[t]=[e]}else e.kind===i.Kind.DIRECTIVE_DEFINITION?m.push(e):e.kind===i.Kind.SCHEMA_DEFINITION?g.push(e):e.kind===i.Kind.SCHEMA_EXTENSION&&S.push(e);let N=t||new i.GraphQLSchema({query:void 0});const v=[];for(const[e,t]of Object.entries(p))if(!u[e]){const e=t[0],r=e.kind,n={kind:h[r],name:e.name};v.push(n)}let T;if(N=i.extendSchema(N,{kind:i.Kind.DOCUMENT,definitions:[...c.default(Object.values(u)),...v,...m]},{assumeValidSDL:!0}),N=i.extendSchema(N,{kind:i.Kind.DOCUMENT,definitions:c.default(Object.values(p))},{assumeValidSDL:!0}),g.length>0||S.length>0){T={};const e=c.default([...g,...S].map((e=>e.operationTypes)).filter(f));for(const{operation:t,type:r}of e)T[t]=r.name.value}else T={query:"Query",mutation:"Mutation",subscription:"Subscription"};N=new i.GraphQLSchema(Object.assign(Object.assign({},N.toConfig()),l.mapValues(T,(e=>e?N.getType(e):void 0))));for(const e of r)e.resolvers&&b(N,e.resolvers);return N};const h={[i.Kind.SCALAR_TYPE_EXTENSION]:i.Kind.SCALAR_TYPE_DEFINITION,[i.Kind.OBJECT_TYPE_EXTENSION]:i.Kind.OBJECT_TYPE_DEFINITION,[i.Kind.INTERFACE_TYPE_EXTENSION]:i.Kind.INTERFACE_TYPE_DEFINITION,[i.Kind.UNION_TYPE_EXTENSION]:i.Kind.UNION_TYPE_DEFINITION,[i.Kind.ENUM_TYPE_EXTENSION]:i.Kind.ENUM_TYPE_DEFINITION,[i.Kind.INPUT_OBJECT_TYPE_EXTENSION]:i.Kind.INPUT_OBJECT_TYPE_DEFINITION};function b(e,t){for(const[r,n]of Object.entries(t)){const t=e.getType(r);if(i.isAbstractType(t))for(const[e,r]of Object.entries(n))e.startsWith("__")&&(t[e.substring(2)]=r);if(i.isScalarType(t))for(const e in n)t[e]=n[e];if(i.isEnumType(t)){const e=t.getValues(),r={};e.forEach((e=>{let t=n[e.name];void 0===t&&(t=e.name),r[e.name]={value:t,deprecationReason:e.deprecationReason,description:e.description,astNode:e.astNode,extensions:void 0}})),Object.assign(t,new i.GraphQLEnumType(Object.assign(Object.assign({},t.toConfig()),{values:r})))}if(!i.isObjectType(t))continue;const s=t.getFields();for(const[e,r]of Object.entries(n)){if(e.startsWith("__")){t[e.substring(2)]=r;continue}const n=s[e];n&&(n.resolve="function"==typeof r?r:r.resolve)}}}function f(e){return null!=e}t.addResolversToSchema=b},19662:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(88469),t),i(r(79352),t),i(r(63010),t),i(r(68110),t),i(r(31062),t)},31062:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},68110:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},63010:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transformSchema=void 0;const n=r(13191),i=r(61926);t.transformSchema=function(e,t){const r=Object.create(null);for(const i of Object.values(e.getTypeMap())){if(n.isIntrospectionType(i))continue;const e=t(i);if(null===e)continue;const s=e||i;r[s.name]=a(s)}const s=e.toConfig();return new n.GraphQLSchema(Object.assign(Object.assign({},s),{types:Object.values(r),query:p(s.query),mutation:p(s.mutation),subscription:p(s.subscription),directives:(o=s.directives,o.map((e=>{const t=e.toConfig();return new n.GraphQLDirective(Object.assign(Object.assign({},t),{args:m(t.args)}))})))}));var o;function a(e){if(n.isObjectType(e)){const t=e.toConfig();return new n.GraphQLObjectType(Object.assign(Object.assign({},t),{interfaces:()=>t.interfaces.map(c),fields:()=>l(t.fields)}))}if(n.isInterfaceType(e)){const t=e.toConfig();return new n.GraphQLInterfaceType(Object.assign(Object.assign({},t),{fields:()=>l(t.fields)}))}if(n.isUnionType(e)){const t=e.toConfig();return new n.GraphQLUnionType(Object.assign(Object.assign({},t),{types:()=>t.types.map(c)}))}if(n.isInputObjectType(e)){const t=e.toConfig();return new n.GraphQLInputObjectType(Object.assign(Object.assign({},t),{fields:()=>{return e=t.fields,i.mapValues(e,(e=>Object.assign(Object.assign({},e),{type:u(e.type)})));var e}}))}return e}function u(e){return n.isListType(e)?new n.GraphQLList(u(e.ofType)):n.isNonNullType(e)?new n.GraphQLNonNull(u(e.ofType)):c(e)}function c(e){return r[e.name]||e}function p(e){return e?c(e):void 0}function l(e){return i.mapValues(e,(e=>Object.assign(Object.assign({},e),{type:u(e.type),args:e.args?m(e.args):void 0})))}function m(e){return i.mapValues(e,(e=>Object.assign(Object.assign({},e),{type:u(e.type)})))}}},49118:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.printWithReducedWhitespace=t.removeAliases=t.sortAST=t.dropUnusedDefinitions=t.hideStringAndNumericLiterals=t.hideLiterals=void 0;const i=r(88407),s=r(38830),o=r(8380),a=n(r(1919));function u(e,...t){if(e)return a.default(e,...t)}t.hideLiterals=function(e){return i.visit(e,{IntValue:e=>Object.assign(Object.assign({},e),{value:"0"}),FloatValue:e=>Object.assign(Object.assign({},e),{value:"0"}),StringValue:e=>Object.assign(Object.assign({},e),{value:"",block:!1}),ListValue:e=>Object.assign(Object.assign({},e),{values:[]}),ObjectValue:e=>Object.assign(Object.assign({},e),{fields:[]})})},t.hideStringAndNumericLiterals=function(e){return i.visit(e,{IntValue:e=>Object.assign(Object.assign({},e),{value:"0"}),FloatValue:e=>Object.assign(Object.assign({},e),{value:"0"}),StringValue:e=>Object.assign(Object.assign({},e),{value:"",block:!1})})},t.dropUnusedDefinitions=function(e,t){return o.separateOperations(e)[t]||e},t.sortAST=function(e){return i.visit(e,{Document:e=>Object.assign(Object.assign({},e),{definitions:a.default(e.definitions,"kind","name.value")}),OperationDefinition:e=>Object.assign(Object.assign({},e),{variableDefinitions:u(e.variableDefinitions,"variable.name.value")}),SelectionSet:e=>Object.assign(Object.assign({},e),{selections:a.default(e.selections,"kind","name.value")}),Field:e=>Object.assign(Object.assign({},e),{arguments:u(e.arguments,"name.value")}),FragmentSpread:e=>Object.assign(Object.assign({},e),{directives:u(e.directives,"name.value")}),InlineFragment:e=>Object.assign(Object.assign({},e),{directives:u(e.directives,"name.value")}),FragmentDefinition:e=>Object.assign(Object.assign({},e),{directives:u(e.directives,"name.value"),variableDefinitions:u(e.variableDefinitions,"variable.name.value")}),Directive:e=>Object.assign(Object.assign({},e),{arguments:u(e.arguments,"name.value")})})},t.removeAliases=function(e){return i.visit(e,{Field:e=>Object.assign(Object.assign({},e),{alias:void 0})})},t.printWithReducedWhitespace=function(e){const t=i.visit(e,{StringValue:e=>Object.assign(Object.assign({},e),{value:Buffer.from(e.value,"utf8").toString("hex"),block:!1})});return s.print(t).replace(/\s+/g," ").replace(/([^_a-zA-Z0-9]) /g,((e,t)=>t)).replace(/ ([^_a-zA-Z0-9])/g,((e,t)=>t)).replace(/"([a-f0-9]+)"/g,((e,t)=>JSON.stringify(Buffer.from(t,"hex").toString("utf8"))))}},29299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createHash=void 0;const n=r(39410);t.createHash=function(e){return n.isNodeLike?r(76417).createHash(e):r(55316)(e)}},62518:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDocumentNode=t.isNode=void 0;const n=r(13191);function i(e){return e&&"string"==typeof e.kind}t.isNode=i,t.isDocumentNode=function(e){return i(e)&&e.kind===n.Kind.DOCUMENT}},39410:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeLike=void 0,t.isNodeLike="object"==typeof process&&process&&process.release&&process.versions&&"string"==typeof process.versions.node},61926:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mapValues=void 0,t.mapValues=function(e,t){const r=Object.create(null);for(const[n,i]of Object.entries(e))r[n]=t(i);return r}},56694:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ApolloLink:()=>R,Observable:()=>i,concat:()=>E,createOperation:()=>k,empty:()=>x,execute:()=>w,from:()=>_,fromError:()=>I,fromPromise:()=>T,getOperationName:()=>g,makePromise:()=>v,split:()=>D,toPromise:()=>N});var n=r(26356);const i=r.n(n)();var s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function o(e,t){function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a,u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},c="Invariant Violation",p=Object.setPrototypeOf,l=void 0===p?function(e,t){return e.__proto__=t,e}:p,m=function(e){function t(r){void 0===r&&(r=c);var n=e.call(this,"number"==typeof r?c+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=c,l(n,t.prototype),n}return o(t,e),t}(Error);function d(e,t){if(!e)throw new m(t)}function y(e){return function(){return console[e].apply(console,arguments)}}(a=d||(d={})).warn=y("warn"),a.error=y("error");var h={env:{}};if("object"==typeof process)h=process;else try{Function("stub","process = stub")(h)}catch(e){}r(96220);var b,f=Object.prototype;function g(e){return e.definitions.filter((function(e){return"OperationDefinition"===e.kind&&e.name})).map((function(e){return e.name.value}))[0]||null}function S(e){return e.request.length<=1}function N(e){var t=!1;return new Promise((function(r,n){e.subscribe({next:function(e){t||(t=!0,r(e))},error:n})}))}f.toString,f.hasOwnProperty,new Map,"function"==typeof WeakMap&&"object"==typeof navigator&&navigator.product,Object.prototype.toString,Object.prototype.hasOwnProperty,Object.create({}),o((function(e,t){var r=b.call(this,e)||this;return r.link=t,r}),b=Error);var v=N;function T(e){return new i((function(t){e.then((function(e){t.next(e),t.complete()})).catch(t.error.bind(t))}))}function I(e){return new i((function(t){t.error(e)}))}function k(e,t){var r=u({},e);return Object.defineProperty(t,"setContext",{enumerable:!1,value:function(e){r=u({},r,"function"==typeof e?e(r):e)}}),Object.defineProperty(t,"getContext",{enumerable:!1,value:function(){return u({},r)}}),Object.defineProperty(t,"toKey",{enumerable:!1,value:function(){return function(e){var t=e.query,r=e.variables,n=e.operationName;return JSON.stringify([n,t,r])}(t)}}),t}function C(e,t){return t?t(e):i.of()}function A(e){return"function"==typeof e?new R(e):e}function x(){return new R((function(){return i.of()}))}function _(e){return 0===e.length?x():e.map(A).reduce((function(e,t){return e.concat(t)}))}function D(e,t,r){var n=A(t),s=A(r||new R(C));return S(n)&&S(s)?new R((function(t){return e(t)?n.request(t)||i.of():s.request(t)||i.of()})):new R((function(t,r){return e(t)?n.request(t,r)||i.of():s.request(t,r)||i.of()}))}var E=function(e,t){var r=A(e);if(S(r))return r;var n=A(t);return S(n)?new R((function(e){return r.request(e,(function(e){return n.request(e)||i.of()}))||i.of()})):new R((function(e,t){return r.request(e,(function(e){return n.request(e,t)||i.of()}))||i.of()}))},R=function(){function e(e){e&&(this.request=e)}return e.prototype.split=function(t,r,n){return this.concat(D(t,r,n||new e(C)))},e.prototype.concat=function(e){return E(this,e)},e.prototype.request=function(e,t){throw new m(1)},e.empty=x,e.from=_,e.split=D,e.execute=w,e}();function w(e,t){return e.request(k(t.context,function(e){var t={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return t.operationName||(t.operationName="string"!=typeof t.query?g(t.query):""),t}(function(e){for(var t=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];if(t.indexOf(i)<0)throw new m(2)}return e}(t))))||i.of()}},18542:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ApolloServerBase=void 0;const o=r(24100),a=r(11631),u=r(4016),c=s(r(11353)),p=r(13191),l=s(r(33433)),m=r(725),d=s(r(26839)),y=r(23632),h=r(80808),b=r(83665),f=r(72518),g=r(36575),S=r(20873),N=r(81322),v=r(14501),T=r(95884),I=r(69906),k=r(18568),C=s(r(68356)),A=r(71796),x=r(42370),_=r(37822),D=e=>({Field(t){"__schema"!==t.name.value&&"__type"!==t.name.value||e.reportError(new p.GraphQLError("GraphQL introspection is not allowed by Apollo Server, but the query contained __schema or __type. To enable introspection, pass introspection: true to ApolloServer in production",[t]))}}),E=process&&!1;function R(e){return Buffer.byteLength(JSON.stringify(e),"utf8")}class w extends Error{constructor(e){super(`Unreachable case: ${e}`)}}t.ApolloServerBase=class{constructor(e){if(this.graphqlPath="/graphql",this.requestOptions=Object.create(null),this.plugins=[],this.toDispose=new Set,this.toDisposeLast=new Set,!e)throw new Error("ApolloServer requires options.");this.config=e;const{context:t,resolvers:r,schema:s,schemaDirectives:o,modules:a,typeDefs:u,parseOptions:p={},introspection:l,mocks:y,mockEntireSchema:h,extensions:f,subscriptions:g,uploads:N,playground:v,plugins:T,gateway:I,cacheControl:k,experimental_approximateDocumentStoreMiB:x,stopOnTerminationSignals:_,apollo:R,engine:w}=e,P=i(e,["context","resolvers","schema","schemaDirectives","modules","typeDefs","parseOptions","introspection","mocks","mockEntireSchema","extensions","subscriptions","uploads","playground","plugins","gateway","cacheControl","experimental_approximateDocumentStoreMiB","stopOnTerminationSignals","apollo","engine"]);if(void 0!==w&&R)throw new Error("You cannot provide both `engine` and `apollo` to `new ApolloServer()`. For details on how to migrate all of your options out of `engine`, see https://go.apollo.dev/s/migration-engine-plugins");if(e.logger)this.logger=e.logger;else{const e=c.default.getLogger("apollo-server");!0===this.config.debug?e.setLevel(c.default.levels.DEBUG):e.setLevel(c.default.levels.INFO),this.logger=e}if(this.apolloConfig=A.determineApolloConfig(R,w,this.logger),I&&(a||s||u||r))throw new Error("Cannot define both `gateway` and any of: `modules`, `schema`, `typeDefs`, or `resolvers`");if(this.parseOptions=p,this.context=t,"boolean"==typeof l&&!l||void 0===l){const e=[D];P.validationRules=P.validationRules?P.validationRules.concat(e):e}if(P.cache||(P.cache=new m.InMemoryLRUCache),!1!==P.persistedQueries){const e=P.persistedQueries||Object.create(null),{cache:t=P.cache}=e,r=i(e,["cache"]);P.persistedQueries=Object.assign({cache:new m.PrefixingKeyValueCache(t,S.APQ_CACHE_PREFIX)},r)}else delete P.persistedQueries;if(this.requestOptions=P,!1!==N&&!E)if(this.supportsUploads()){if(!d.default)throw this.logger.error(["*****************************************************************","* *","* ERROR! Manual intervention is necessary for Node.js < v8.5.0! *","* *","*****************************************************************","","The third-party `graphql-upload` package, which is used to implement","file uploads in Apollo Server 2.x, no longer supports Node.js LTS","versions prior to Node.js v8.5.0.","","Deployments which NEED file upload capabilities should update to","Node.js >= v8.5.0 to continue using uploads.","","If this server DOES NOT NEED file uploads and wishes to continue","using this version of Node.js, uploads can be disabled by adding:",""," uploads: false,","","...to the options for Apollo Server and re-deploying the server.","","For more information, see https://bit.ly/gql-upload-node-6.",""].join("\n")),new Error("`graphql-upload` is no longer supported on Node.js < v8.5.0. See https://bit.ly/gql-upload-node-6.");this.uploadsConfig=!0===N||void 0===N?{}:N}else if(N)throw new Error("This implementation of ApolloServer does not support file uploads because the environment cannot accept multi-part forms");if(I&&!1!==g)throw new Error(["Subscriptions are not yet compatible with the gateway.","Set `subscriptions: false` in Apollo Server's constructor to","explicitly disable subscriptions (which are on by default)","and allow for gateway functionality."].join(" "));if(!1!==g)if(this.supportsSubscriptions())this.subscriptionServerOptions=!0===g||void 0===g?{path:this.graphqlPath}:"string"==typeof g?{path:g}:Object.assign({path:this.graphqlPath},g),this.subscriptionsPath=this.subscriptionServerOptions.path;else if(g)throw new Error("This implementation of ApolloServer does not support GraphQL subscriptions.");if(this.playgroundOptions=b.createPlaygroundOptions(v),this.ensurePluginInstantiation(T),"boolean"==typeof _?_:"object"==typeof w&&"boolean"==typeof w.handleSignals?w.handleSignals:C.default){let e=!1;["SIGINT","SIGTERM"].forEach((t=>{const r=()=>n(this,void 0,void 0,(function*(){if(!e){e=!0;try{yield this.stop()}catch(e){this.logger.error(`stop() threw during ${t} shutdown`),this.logger.error(e),process.exit(1)}process.kill(process.pid,t)}}));process.on(t,r),this.toDisposeLast.add((()=>n(this,void 0,void 0,(function*(){process.removeListener(t,r)}))))}))}I?(this.state={phase:"initialized with gateway",gateway:I},this.requestOptions.executor=I.executor):(this.state={phase:"initialized with schema",schemaDerivedData:this.generateSchemaDerivedData(this.constructSchema())},this.schema=this.state.schemaDerivedData.schema),this.serverlessFramework()&&this.ensureStarting()}setGraphQLPath(e){this.graphqlPath=e}start(){return n(this,void 0,void 0,(function*(){if(this.serverlessFramework())throw new Error("When using an ApolloServer subclass from a serverless framework package, you don't need to call start(); just call createHandler().");return yield this._start()}))}_start(){var e;return n(this,void 0,void 0,(function*(){const t=this.state;if("initialized with gateway"!==t.phase&&"initialized with schema"!==t.phase)throw new Error(`called start() with surprising state ${t.phase}`);const r=l.default();this.state={phase:"starting",barrier:r};let i=!1;try{const s="initialized with schema"===t.phase?t.schemaDerivedData:this.generateSchemaDerivedData(yield this.startGatewayAndLoadSchema(t.gateway));i=!0,this.state={phase:"invoking serverWillStart",barrier:r,schemaDerivedData:s};const o={logger:this.logger,schema:s.schema,schemaHash:s.schemaHash,apollo:this.apolloConfig,serverlessFramework:this.serverlessFramework(),engine:{serviceID:this.apolloConfig.graphId,apiKeyHash:this.apolloConfig.keyHash}};(null===(e=this.requestOptions.persistedQueries)||void 0===e?void 0:e.cache)&&(o.persistedQueries={cache:this.requestOptions.persistedQueries.cache});const a=(yield Promise.all(this.plugins.map((e=>e.serverWillStart&&e.serverWillStart(o))))).filter((e=>"object"==typeof e&&!!e.serverWillStop));this.toDispose.add((()=>n(this,void 0,void 0,(function*(){yield Promise.all(a.map((({serverWillStop:e})=>null==e?void 0:e())))})))),this.state={phase:"started",schemaDerivedData:s}}catch(e){throw this.state={phase:"failed to start",error:e,loadedSchema:i},e}finally{r.resolve()}}))}willStart(){return n(this,void 0,void 0,(function*(){this.ensureStarting()}))}ensureStarted(){return n(this,void 0,void 0,(function*(){for(;;)switch(this.state.phase){case"initialized with gateway":case"initialized with schema":try{yield this._start()}catch(e){}break;case"starting":case"invoking serverWillStart":yield this.state.barrier;break;case"failed to start":throw this.logStartupError(this.state.error),new Error("This data graph is missing a valid configuration. More details may be available in the server logs.");case"started":return this.state.schemaDerivedData;case"stopping":throw new Error("Cannot execute GraphQL operations while the server is stopping.");case"stopped":throw new Error("Cannot execute GraphQL operations after the server has stopped.");default:throw new w(this.state)}}))}ensureStarting(){"initialized with gateway"!==this.state.phase&&"initialized with schema"!==this.state.phase||this._start().catch((e=>this.logStartupError(e)))}logStartupError(e){const t=this.serverlessFramework()?"An error occurred during Apollo Server startup.":"Apollo Server was started implicitly and an error occurred during startup. (Consider calling `await server.start()` immediately after `server = new ApolloServer()` so you can handle these errors directly before starting your web server.)";this.logger.error(t+" All GraphQL requests will now fail. The startup error was: "+(e&&e.message||e))}startGatewayAndLoadSchema(e){return n(this,void 0,void 0,(function*(){const t=e.onSchemaChange((e=>{"started"===this.state.phase&&(this.state.schemaDerivedData=this.generateSchemaDerivedData(e))}));this.toDispose.add((()=>n(this,void 0,void 0,(function*(){return t()}))));const r=this.apolloConfig.keyHash&&this.apolloConfig.graphId?{apiKeyHash:this.apolloConfig.keyHash,graphId:this.apolloConfig.graphId,graphVariant:this.apolloConfig.graphVariant}:void 0,i=yield e.load({apollo:this.apolloConfig,engine:r});return this.toDispose.add((()=>n(this,void 0,void 0,(function*(){var t;return yield null===(t=e.stop)||void 0===t?void 0:t.call(e)})))),i.schema}))}constructSchema(){const{schema:e,modules:t,typeDefs:n,resolvers:i,schemaDirectives:s,parseOptions:a}=this.config;if(e)return e;if(t){const{schema:e,errors:r}=v.buildServiceDefinition(t);if(r&&r.length>0)throw new Error(r.map((e=>e.message)).join("\n\n"));return e}if(!n)throw Error("Apollo Server requires either an existing schema, modules or typeDefs");const u=Array.isArray(n)?n:[n];if(g.isDirectiveDefined(u,"cacheControl")||u.push(h.gql` enum CacheControlScope { PUBLIC PRIVATE } directive @cacheControl( maxAge: Int scope: CacheControlScope ) on FIELD_DEFINITION | OBJECT | INTERFACE `),this.uploadsConfig){const{GraphQLUpload:e}=r(79542);Array.isArray(i)?i.every((e=>!e.Upload))&&i.push({Upload:e}):i&&!i.Upload&&(i.Upload=e),u.push(h.gql` scalar Upload `)}return o.makeExecutableSchema({typeDefs:u,schemaDirectives:s,resolvers:i,parseOptions:a})}generateSchemaDerivedData(e){const t=f.generateSchemaHash(e),{mocks:r,mockEntireSchema:n,extensions:i}=this.config;(r||void 0!==n&&!1!==r)&&o.addMockFunctionsToSchema({schema:e,mocks:"boolean"==typeof r||void 0===r?{}:r,preserveResolvers:void 0!==n&&!n});const s=[];return s.push(...i||[]),{schema:e,schemaHash:t,extensions:s,documentStore:this.initializeDocumentStore()}}stop(){return n(this,void 0,void 0,(function*(){if("stopped"!==this.state.phase)if("stopping"!==this.state.phase){this.state={phase:"stopping",barrier:l.default()};try{yield Promise.all([...this.toDispose].map((e=>e()))),this.subscriptionServer&&this.subscriptionServer.close(),yield Promise.all([...this.toDisposeLast].map((e=>e())))}catch(e){return void(this.state={phase:"stopped",stopError:e})}this.state={phase:"stopped",stopError:null}}else{yield this.state.barrier;const e=this.state;if("stopped"!==e.phase)throw Error(`Surprising post-stopping state ${e.phase}`);if(e.stopError)throw e.stopError}else if(this.state.stopError)throw this.state.stopError}))}installSubscriptionHandlers(e){if(!this.subscriptionServerOptions){if(this.config.gateway)throw Error("Subscriptions are not supported when operating as a gateway");throw this.supportsSubscriptions()?Error("Subscriptions are disabled, due to subscriptions set to false in the ApolloServer constructor"):Error("Subscriptions are not supported, choose an integration, such as apollo-server-express that allows persistent connections")}const{SubscriptionServer:t}=r(61008),{onDisconnect:i,onConnect:s,keepAlive:o,path:c}=this.subscriptionServerOptions;let l;switch(this.state.phase){case"initialized with schema":case"invoking serverWillStart":case"started":l=this.state.schemaDerivedData.sch