apollo-angular-link-http
Version:
An Apollo Link to allow sending a single http request per operation.
2 lines • 2.72 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common/http"),require("apollo-link"),require("graphql"),require("apollo-angular-link-http-common"),require("extract-files")):"function"==typeof define&&define.amd?define("apollo-angular-link-http",["exports","@angular/core","@angular/common/http","apollo-link","graphql","apollo-angular-link-http-common","extract-files"],t):t((e=e||self).ngApolloLinkHttp={},e.ng.core,e.ng.common.http,e.apolloLink.core,e.graphql,e.ngApolloLinkHttpCommon,e.extractFiles)}(this,(function(e,t,n,r,o,i,u){"use strict";var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function p(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}var a=function(e){function t(t,n){var l=e.call(this)||this;return l.httpClient=t,l.options=n,l.requester=function(e){return new r.Observable((function(t){var n=e.getContext(),r=function(e,t){return i.prioritize(n[e],l.options[e],t)},p=r("includeQuery",!0),a=r("includeExtensions",!1),c=r("method","POST"),s=r("uri","graphql"),f=r("withCredentials"),h=r("useMultipart"),d={method:c,url:"function"==typeof s?s(e):s,body:{operationName:e.operationName,variables:e.variables},options:{withCredentials:f,useMultipart:h,headers:l.options.headers}};a&&(d.body.extensions=e.extensions),p&&(d.body.query=o.print(e.query)),n.headers&&(d.options.headers=i.mergeHeaders(d.options.headers,n.headers));var y=i.fetch(d,l.httpClient,u.extractFiles).subscribe({next:function(n){e.setContext({response:n}),t.next(n.body)},error:function(e){return t.error(e)},complete:function(){return t.complete()}});return function(){y.closed||y.unsubscribe()}}))},l}return function(e,t){function n(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.request=function(e){return this.requester(e)},t}(r.ApolloLink),c=function(){function e(e){this.httpClient=e}return e.prototype.create=function(e){return new a(this.httpClient,e)},e.ctorParameters=function(){return[{type:n.HttpClient}]},e=p([t.Injectable()],e)}(),s=[c],f=function(){function e(){}return e=p([t.NgModule({providers:s})],e)}();e.HttpLink=c,e.HttpLinkHandler=a,e.HttpLinkModule=f,e.PROVIDERS=s,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngApolloLinkHttp.umd.min.js.map