Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("graphql"),require("apollo-fetch")):"function"==typeof define&&define.amd?define(["exports","graphql","apollo-fetch"],t):t(e.blips={},e.GraphQL,e.ApolloFetch)}(this,function(e,t,r){"use strict";function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function o(e,t){return t={exports:{}},e(t,t.exports),t.exports}function i(){}function u(){u.init.call(this)}function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function a(e,t,r,n){var o,u,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((u=e._events)?(u.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),u=e._events),a=u[t]):(u=e._events=new i,e._eventsCount=0),a){if("function"==typeof a?a=u[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(o=c(e))&&o>0&&a.length>o){a.warned=!0;var s=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(s)}}else a=u[t]=r,++e._eventsCount;return e}function s(e,t,r){function n(){e.removeListener(t,n),o||(o=!0,r.apply(e,arguments))}var o=!1;return n.listener=r,n}function f(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function l(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}function p(e){return!!y(e)}function h(e){var t=null!=e&&e.length;return"number"==typeof t&&t>=0&&t%1==0}function v(e){var t=y(e);if(t)return t.call(e)}function y(e){if(null!=e){var t=X&&e[X]||e["@@iterator"];if("function"==typeof t)return t}}function d(e){if(null!=e){var t=v(e);if(t)return t;if(h(e))return new b(e)}}function b(e){this._o=e,this._i=0}function m(e){var t=g(e);if(t)return t.call(e)}function g(e){if(null!=e){var t=ue&&e[ue]||e["@@asyncIterator"];if("function"==typeof t)return t}}function w(e){if(null!=e){var t=m(e);if(t)return t;var r=d(e);if(r)return new O(r)}}function O(e){this._i=e}function _(e,t,r,n){function o(e,t){return j(e,t,r.slice(),n.slice())}var i=Ie(e),u=Ie(t);return!Ce(function(e,t){return!Ce(o,t,e)},u,i)}function j(e,t,r,n){if(qe(e,t))return!0;var o=Qe(e);if(o!==Qe(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===Fe(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!qe(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!qe(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=r.length-1;i>=0;){if(r[i]===e)return n[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&_(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&_(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=Ge(e);if(u.length!==Ge(t).length)return!1;var c=r.concat([e]),a=n.concat([t]);for(i=u.length-1;i>=0;){var s=u[i];if(!xe(s,t)||!j(t[s],e[s],c,a))return!1;i-=1}return!0}function E(e,t,r){for(var n=r.next();!n.done;){if((t=e["@@transducer/step"](t,n.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n=r.next()}return e["@@transducer/result"](t)}function x(e,t,r,n){return e["@@transducer/result"](r[n](Xe(e["@@transducer/step"],e),t))}function k(e){return function(e,t){var r=this[e];return mt(r,e),dt(r)?je(t)?r:function(e,t){if(!bt(t))return[];var r=Object.entries(t)[0],n=r[0],o=r[1];return e.filter(function(e){return e[n]===o})}(r,t):je(t)?r:function(e,t){if(bt(t)){var r=Object.entries(t)[0]||{},n=r[0],o=r[1];return Object.entries(e).filter(function(e){return e[1][n]===o}).reduce(function(e,t){var r;return wt({},e,(r={},r[t[0]]=t[1],r))},{})}return e[t]}(r,t)}}function S(e){return function(e,t,r){var n=this[e];return mt(n,e),dt(n)?function(e,t){return this[e]=[].concat(this[e]||[],[t]),t}.call(this,e,t):function(e,t,r){var n;return Ee(!je(t),"You forgot to specify the payload"),Ee(!je(r),"You are trying to post to a collection object but haven't specified an identifier. Try again with \"clerk.post('"+e+"', payload, identifier)\""),this[e]=_t({},this[e]||{},(n={},n[r]=t,n)),t}.call(this,e,t,r)}}function A(e){return function(e,t,r){var n=this[e];return mt(n,e),dt(n)?function(e,t,r){if(je(r))return this[e]=[].concat(this[e],[t]),t;Ee(bt(r),"When updating a resource inside a list you have to specify an identifier object containing the key/value pair you want to match.");var n=Object.entries(r)[0],o=n[0],i=n[1],u=this[e].findIndex(function(e){return e[o]===i});return this[e]=[].concat(this[e].slice(0,u),[t],this[e].slice(u+1)),t}.call(this,e,t,r):function(e,t,r){var n;return Ee(!je(r),"You are trying to update a resource but haven't specified the identifier. Try again with \"clerk.put('"+e+"', payload, identifier)\""),this[e]=Et({},this[e]||{},(n={},n[r]=t,n)),t}.call(this,e,t,r)}}function P(e){return function(e,t,r){var n=this[e];return mt(n,e),Ee(!je(r),"You are trying to patch a resource but haven't specified the identifier. Try again with \"clerk.patch('"+e+"', payload, key)\""),dt(n)?function(e,t,r){Ee(bt(r),"When patching a resource inside a list you have to specify an identifier object containing the key/value pair you want to match.");var n=Object.entries(r)[0],o=n[0],i=n[1],u=this[e].findIndex(function(e){return e[o]===i});if(u>=0){var c=St(this[e][u],gt(t));return this[e]=[].concat(this[e].slice(0,u),[c],this[e].slice(u+1)),c}}.call(this,e,t,r):function(e,t,r){var n;if(Ee(!je(r),"You are trying to update a resource but haven't specified the identifier. Try again with \"clerk.put('"+e+"', payload, identifier)\""),!je(this[e][r])){var o=St(this[e][r],gt(t));return this[e]=At({},this[e]||{},(n={},n[r]=o,n)),o}}.call(this,e,t,r)}}function T(e){return function(e,t){if(!je(t)){var r=this[e];return mt(r,e),dt(r)?function(e,t){if(bt(t)){var r=Object.entries(t)[0],n=r[0],o=r[1],i=this[e].findIndex(function(e){return e[n]===o});if(i>=0){var u=this[e][i];return this[e]=[].concat(this[e].slice(0,i),this[e].slice(i+1)),u}}}.call(this,e,t):function(e,t){var r=this[e][t];if(!je(r))return this[e]=Tt([t],this[e]),r}.call(this,e,t)}}}function L(e,t,r){var n=!!e;return"function"==typeof e&&(n=!!e(r)),n?"function"==typeof t?t(r):t:r}function I(e,t){return null===t?"null"===e.toLowerCase():void 0===t?"undefined"===e.toLowerCase():e.toLowerCase()===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(t).toLowerCase()}function C(e){return"string"==typeof e?!e:I("object",e)?!Object.values(e).length:I("array",e)?!e.length:I("Map",e)?!e.size:!!I("Set",e)&&!e.size}function F(e){var t=this;return new Nt(function(r){return qt(regeneratorRuntime.mark(function n(){var o,i,u,c,a,s,f;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,o=!0,i=!1,u=void 0,t.prev=4,c=Ft(e);case 6:return t.next=8,c.next();case 8:return a=t.sent,o=a.done,t.next=12,a.value;case 12:if(s=t.sent,o){t.next=19;break}r.next(f=s);case 16:o=!0,t.next=6;break;case 19:t.next=25;break;case 21:t.prev=21,t.t0=t.catch(4),i=!0,u=t.t0;case 25:if(t.prev=25,t.prev=26,o||!c.return){t.next=30;break}return t.next=30,c.return();case 30:if(t.prev=30,!i){t.next=33;break}throw u;case 33:return t.finish(30);case 34:return t.finish(25);case 35:t.next=41;break;case 37:t.prev=37,t.t1=t.catch(0),e.return(),r.error(t.t1);case 41:case"end":return t.stop()}},n,t,[[0,37],[4,21,25,35],[26,,30,34]])}))(),function(){r.complete(),e.return()}})}function q(e,t){if(!t||"object"!==(void 0===t?"undefined":Ct(t))||t.hasOwnProperty("length")||t.hasOwnProperty("size"))return e;var r=t.store,n=Rt(t,["store"]);r&&console.warn(Dt);var o=Object.keys(n),i=Array.isArray(o),u=0;for(o=i?o:o[Symbol.iterator]();;){var c;if(i){if(u>=o.length)break;c=o[u++]}else{if((u=o.next()).done)break;c=u.value}var a=c;e.hasOwnProperty(a)&&console.warn(Gt(a))}return Mt({},e,n)}function M(e){return null==e}function R(e){for(var t=[],r=[],n=Array.isArray(i=e),o=0,i=n?i:i[Symbol.iterator]();;){var u;if(n){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}var c=u||{},a=c.data,s=c.errors;s&&(t=[].concat(t,s)),a&&(r=[].concat(r,[a]))}var f=function(e){return L(C,function(){},e.reduce(function(e,t){return I("object",t)&&!M(t)?Mt({},e,t):e},{}))}(r),l=function(e){return L(C,function(){},e.reduce(function(e,t){var r;if(M(t)||C(t))return e;var n=t.path?t.path[0]:I("object",t)?t.constructor.name:"Errors";return Mt({},e,(r={},r[n]=[].concat(e[n]||[],[t]),r))},{}))}(t);return Mt({},f?{data:f}:{},l?{errors:l}:{})}function N(e){return!(e.kind!==t.Kind.OPERATION_DEFINITION)}function D(e){if("subscription"===e.operation&&1!==e.selectionSet.selections.length)return new t.GraphQLError(function(e){return(e?'Subscription "'+e+'" ':"Anonymous Subscription ")+"must select only one top level field."}(e.name&&e.name.value),e.selectionSet.selections.slice(1))}function G(e,r){if(!e.name&&r>1)return new t.GraphQLError("This anonymous operation must be the only defined operation.",[e])}function Q(e,r){if(function(e){return!(e.kind!==t.Kind.FRAGMENT_DEFINITION)}(e)){var n=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).name.value}(e);if(r[n])return new t.GraphQLError(function(e){return'There can be only one fragment named "'+e+'".'}(n),[r[n],e.name]);r[n]=e.name}}function U(e){for(var t=function(e){return e.definitions.filter(N)}(e).length,r=Object.create(null),n=[],o=Array.isArray(u=e.definitions),i=0,u=o?u:u[Symbol.iterator]();;){var c;if(o){if(i>=u.length)break;c=u[i++]}else{if((i=u.next()).done)break;c=i.value}var a=c,s=G(a,t)||Q(a,r)||D(a);s&&n.push(s)}return n}function Y(){function e(e){var r=e;try{r=function(e){return"string"==typeof e?t.parse(e):e}(e)}catch(e){return{document:r,errors:[e]}}var n=w?t.validate(w,r):U(r);return Mt({document:r},!C(n)&&{errors:n})}function n(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.variables,o=void 0===n?{}:n,i=r.context,u=arguments[2],c=arguments[3];return e(w,t,{},q(j,void 0===i?{}:i),Mt({},E,o),u,c)}}function o(e,t){if(e)if(I("function",e))x.use(e);else{if(!I("array",e))throw new TypeError(Bt(t));for(var r=Array.isArray(o=e),n=0,o=r?o:o[Symbol.iterator]();;){var i;if(r){if(n>=o.length)break;i=o[n++]}else{if((n=o.next()).done)break;i=n.value}x.use(i)}}}function i(t){return function(r,n,o,i){var u=e(r),c=u.document,a=u.errors;if(a)return Promise.resolve({errors:a});if(o)return k(c,n,o,i);if(1===c.definitions.length&&function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).operation}(c.definitions[0])===t)return k(c,n,o,i);return function(e){return new Promise(function(t){for(var r=[],n=function(){if(o){if(i>=u.length)return"break";c=u[i++]}else{if((i=u.next()).done)return"break";c=i.value}var e=c;r.push(new Promise(function(t){e.then(function(e){return t(e)},function(e){return t({errors:[e]})})}))},o=Array.isArray(u=e),i=0,u=o?u:u[Symbol.iterator]();;){var c;if("break"===n())break}Promise.all(r).then(function(e){t(R(e))})})}(c.definitions.filter(function(e){return e.operation===t}).map(function(e){return k(t)(e,n,e.name.value,i)}))}}var u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=u.typeDefs,a=u.resolvers,s=this,f=arguments[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=l.variables,h=void 0===p?{}:p,v=l.context,y=void 0===v?{}:v,d=l.fetch,b=void 0===d?{}:d,m=new ge,g=void 0,w=void 0,O=void 0,_=void 0,j=void 0,E=void 0,x=void 0,k=n(t.execute),S=n(t.subscribe);return g=Mt({},f)||{},_=new It(g),O=L("function"==typeof a,a({pubsub:m,withFilter:we}),a),c&&(w=K({typeDefs:c,resolvers:O})),E=h,j=q({store:Mt({},_)},y),b.uri&&(x=r.createApolloFetch({uri:b.uri}),o(b.middleware,"middleware"),o(b.afterware,"afterware")),{get state(){return g},get schema(){return w},query:i("query"),mutate:i("mutation"),subscribe:function(){var r=qt(regeneratorRuntime.mark(function r(n,o,i,u){var c,a,f,l,p;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(c=e(n),a=c.document,!(f=c.errors)){r.next=3;break}return r.abrupt("return",Promise.resolve({errors:f}));case 3:if((l=a.definitions.filter(function(e){return"subscription"===e.operation})).length>=1){r.next=8;break}return r.abrupt("return",Promise.resolve({errors:[new t.GraphQLError(zt)]}));case 8:if(l.length<=1){r.next=10;break}return r.abrupt("return",Promise.resolve({errors:[new t.GraphQLError(Wt)]}));case 10:return r.next=12,S(a,o,i,u);case 12:return p=r.sent,p.toObservable=function(){return F(p)},r.abrupt("return",p);case 15:case"end":return r.stop()}},r,s)}));return function(e,t,n,o){return r.apply(this,arguments)}}(),fetch:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).variables,r=void 0===t?{}:t,n=arguments[2];if(!x||!I("function",x))throw Error($t);return x({query:e,variables:r,operationName:n})},graphql:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).variables,r=void 0===t?{}:t,n=arguments[2];if(Qt[Ut]||(console.warn(Ut),Qt[Ut]=!0),!x||!I("function",x))throw Error($t);return x({query:e,variables:r,operationName:n})}}}var $="default"in t?t.default:t,z="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},W=o(function(e,t){function r(e,t,r,n,o){var i={};return function(){var u=((Error().stack||"").match(/(?:\s+at\s.+){2}\s+at\s(.+)/)||[void 0,""])[1];if(!((u=/\)$/.test(u)?u.match(/[^(]+(?=\)$)/)[0]:u.trim())in i)){i[u]=!0;var c;switch(e){case"class":c="Class";break;case"property":c="Property";break;case"method":c="Method";break;case"function":c="Function"}c+=" `"+t+"` has been deprecated",n&&(c+=" since version "+n),r&&(c+=", use `"+r+"` instead"),c+=".",u&&(c+="\n at "+u),o&&(c+="\nCheck out "+o+" for more information."),console.warn(c)}}}function n(e,n,o,i,u,c){var a=(t.options.getWarner||r)(e,n,i,u,c),s={enumerable:(o=o||{writable:!0,enumerable:!1,configurable:!0}).enumerable,configurable:o.configurable};if(o.get||o.set)o.get&&(s.get=function(){return a(),o.get.call(this)}),o.set&&(s.set=function(e){return a(),o.set.call(this,e)});else{var f=o.value;s.get=function(){return a(),f},o.writable&&(s.set=function(e){a(),f=e})}return s}function o(e,n,o,i,u){for(var c=(t.options.getWarner||r)(e,n.name,o,i,u),a=function(){return c(),n.apply(this,arguments)},s=0,f=Object.getOwnPropertyNames(n);f.length>s;s++){var l=f[s],p=Object.getOwnPropertyDescriptor(n,l);p.writable?a[l]=n[l]:p.configurable&&Object.defineProperty(a,l,p)}return a}function i(){for(var e=[],t=0;arguments.length>t;t++)e[t-0]=arguments[t];var r=e[e.length-1];r="function"==typeof r?e.pop():void 0;var i,u,c,a=e[0];return"string"==typeof a?(i=a,u=e[1],c=e[2]):a&&(i=a.alternative,u=a.version,c=a.url),r?o("function",r,i,u,c):function(e,t,r){if("string"==typeof t){return n(r&&"function"==typeof r.value?"method":"property",t,r,i,u,c)}if("function"==typeof e){for(var a=o("class",e,i,u,c),s=e.name,f=0,l=Object.getOwnPropertyNames(a);l.length>f;f++){var p=l[f],h=Object.getOwnPropertyDescriptor(a,p);(h=n("class",s,h,i,u,c)).writable?a[p]=e[p]:h.configurable&&Object.defineProperty(a,p,h)}return a}}}t.options={getWarner:void 0},t.deprecated=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i});n(W);var B=o(function(e,t){function r(e){return void 0!==e.kind}function n(e,t){void 0===t&&(t=[]);var o=[];return e.forEach(function(e){if(r(e)&&(e=$.print(e)),"function"==typeof e)-1===t.indexOf(e)&&(t.push(e),o=o.concat(n(e(),t)));else{if("string"!=typeof e){throw new m("typeDef array must contain only strings and functions, got "+typeof e)}o.push(e.trim())}}),function(e){return e.reduce(function(e,t){return-1===e.indexOf(t)?e.concat([t]):e},[])}(o.map(function(e){return e.trim()})).join("\n")}function o(e){var t,o=e;if(r(e))t=e;else if("string"!=typeof o){if(!Array.isArray(o)){throw new m("typeDefs must be a string, array or schema AST, got "+typeof o)}o=n(o)}"string"==typeof o&&(t=$.parse(o));var u=d.buildASTSchema(t),c=i(t);return c.definitions.length>0&&(u=d.extendSchema(u,c)),u}function i(e){var t=e.definitions.filter(function(e){return e.kind===$.Kind.TYPE_EXTENSION_DEFINITION});return Object.assign({},e,{definitions:t})}function u(e,t){var r=e.getTypeMap();Object.keys(r).forEach(function(e){var n=r[e];if(!b.getNamedType(n).name.startsWith("__")&&n instanceof b.GraphQLObjectType){var o=n.getFields();Object.keys(o).forEach(function(r){t(o[r],e,r)})}})}function c(e,t){[e.getQueryType(),e.getMutationType(),e.getSubscriptionType()].filter(function(e){return!!e}).forEach(function(r){var n=function(e){var t,r=Math.random();return function(n,o,i,u){return u.operation.__runAtMostOnce||(u.operation.__runAtMostOnce={}),u.operation.__runAtMostOnce[r]||(u.operation.__runAtMostOnce[r]=!0,t=e(n,o,i,u)),t}}(t),o=r.getFields();Object.keys(o).forEach(function(i){o[i].resolve=r===e.getSubscriptionType()?h(o[i].resolve,t):h(o[i].resolve,n)})})}function a(e,t){Object.keys(t).forEach(function(r){var n=e.getType(r);if(!n&&"__schema"!==r)throw new m('"'+r+'" defined in resolvers, but not in schema');Object.keys(t[r]).forEach(function(e){if(e.startsWith("__"))n[e.substring(2)]=t[r][e];else if(n instanceof b.GraphQLScalarType)n[e]=t[r][e];else{var o=function(e){return e instanceof b.GraphQLObjectType||e instanceof b.GraphQLInterfaceType?e.getFields():void 0}(n);if(!o)throw new m(r+" was defined in resolvers, but it's not an object");if(!o[e])throw new m(r+"."+e+" defined in resolvers, but not in schema");var i=o[e],u=t[r][e];if("function"==typeof u)s(i,{resolve:u});else{if("object"!=typeof u)throw new m("Resolver "+r+"."+e+" must be object or function");s(i,u)}}})})}function s(e,t){Object.keys(t).forEach(function(r){e[r]=t[r]})}function f(e,t){void 0===t&&(t={});var r=t.requireResolversForArgs,n=void 0!==r&&r,o=t.requireResolversForNonScalar,i=void 0!==o&&o,c=t.requireResolversForAllFields,a=void 0!==c&&c;if(a&&(n||i))throw new TypeError("requireResolversForAllFields takes precedence over the more specific assertions. Please configure either requireResolversForAllFields or requireResolversForArgs / requireResolversForNonScalar, but not a combination of them.");u(e,function(e,t,r){a&&l(e,t,r),n&&e.args.length>0&&l(e,t,r),!i||b.getNamedType(e.type)instanceof b.GraphQLScalarType||l(e,t,r)})}function l(e,t,r){if(e.resolve){if("function"!=typeof e.resolve)throw new m('Resolver "'+t+"."+r+'" must be a function')}else console.warn('Resolve function missing for "'+t+"."+r+'". To disable this warning check https://github.com/apollostack/graphql-tools/issues/131')}function p(e,t){if(!t)throw Error("Must provide a logger");if("function"!=typeof t.log)throw Error("Logger.log must be a function");u(e,function(e,r,n){e.resolve=function(e,t,r){void 0===e&&(e=$.defaultFieldResolver);var n=function(e){var n=Error();n.stack=e.stack,r&&(n.originalMessage=e.message,n.message="Error in resolver "+r+"\n"+e.message),t.log(n)};return function(t,r,o,i){try{var u=e(t,r,o,i);return u&&"function"==typeof u.then&&"function"==typeof u.catch&&u.catch(function(e){var t=e instanceof Error?e:Error(e);return n(t),e}),u}catch(e){throw n(e),e}}}(e.resolve,t,r+"."+n)})}function h(e,t){return function(r,n,o,i){return Promise.resolve(t(r,n,o,i)).then(function(t){return e?e(t,n,o,i):$.defaultFieldResolver(t,n,o,i)})}}function v(e){u(e,function(e,t,r){e.resolve=function(e,t){void 0===e&&(e=$.defaultFieldResolver);return function(r,n,o,i){var u=e(r,n,o,i);if(void 0===u)throw Error('Resolve function for "'+t+'" returned undefined');return u}}(e.resolve,t+"."+r)})}var y=z&&z.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var d=$,b=$,m=function(e){function t(t){var r=e.call(this,t)||this;return r.message=t,Error.captureStackTrace(r,r.constructor),r}return y(t,e),t}(Error);t.SchemaError=m,t.makeExecutableSchema=function(e){var t=e.resolvers,r=void 0===t?{}:t,n=e.connectors,i=e.allowUndefinedInResolve,u=e.resolverValidationOptions,s=function(e,t,r,n,i){if("object"!=typeof i)throw new m("Expected `resolverValidationOptions` to be an object");if(!e)throw new m("Must provide typeDefs");if(!t)throw new m("Must provide resolvers");var u=o(e);return a(u,t),f(u,i),n||v(u),r&&p(u,r),u}(e.typeDefs,r,e.logger,void 0===i||i,void 0===u?{}:u);return"function"==typeof r.__schema&&c(s,r.__schema),n&&g(s,n),s},t.concatenateTypeDefs=n,t.buildSchemaFromTypeDefinitions=o,t.extractExtensionDefinitions=i,t.forEachField=u;var g=W.deprecated({version:"0.7.0",url:"https://github.com/apollostack/graphql-tools/issues/140"},function(e,t){if(!(e&&e instanceof b.GraphQLSchema))throw Error("schema must be an instance of GraphQLSchema. This error could be caused by installing more than one version of GraphQL-JS");if("object"!=typeof t){throw Error("Expected connectors to be of type object, got "+typeof t)}if(0===Object.keys(t).length)throw Error("Expected connectors to not be an empty object");if(Array.isArray(t))throw Error("Expected connectors to be of type object, got Array");if(e._apolloConnectorsAttached)throw Error("Connectors already attached to context, cannot attach more than once");e._apolloConnectorsAttached=!0;c(e,function(e,r,n){if("object"!=typeof n)throw Error("Cannot attach connector because context is not an object: "+typeof n);return void 0===n.connectors&&(n.connectors={}),Object.keys(t).forEach(function(e){var r=t[e];if(!r.prototype)throw Error("Connector must be a function or an class");n.connectors[e]=new r(n)}),e})});t.attachConnectorsToContext=g,t.addSchemaLevelResolveFunction=c,t.addResolveFunctionsToSchema=a,t.assertResolveFunctionsPresent=f,t.addErrorLoggingToSchema=p,t.chainResolvers=function(e){return function(t,r,n,o){return e.reduce(function(e,t){return t?t(e,r,n,o):$.defaultFieldResolver(e,r,n,o)},t)}},t.addCatchUndefinedToSchema=v});n(B);var K=B.makeExecutableSchema;i.prototype=Object.create(null),u.EventEmitter=u,u.usingDomains=!1,u.prototype.domain=void 0,u.prototype._events=void 0,u.prototype._maxListeners=void 0,u.defaultMaxListeners=10,u.init=function(){this.domain=null,u.usingDomains&&(!(void 0).active||this instanceof(void 0).Domain||(this.domain=(void 0).active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new i,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||0>e||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},u.prototype.getMaxListeners=function(){return c(this)},u.prototype.emit=function(e){var t,r,n,o,i,u,c,a="error"===e;if(u=this._events)a=a&&null==u.error;else if(!a)return!1;if(c=this.domain,a){if(t=arguments[1],!c){if(t instanceof Error)throw t;var s=Error('Uncaught, unspecified "error" event. ('+t+")");throw s.context=t,s}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=c,t.domainThrown=!1,c.emit("error",t),!1}if(!(r=u[e]))return!1;var f="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,o=l(e,n),i=0;n>i;++i)o[i].call(r)}(r,f,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var o=e.length,i=l(e,o),u=0;o>u;++u)i[u].call(r,n)}(r,f,this,arguments[1]);break;case 3:!function(e,t,r,n,o){if(t)e.call(r,n,o);else for(var i=e.length,u=l(e,i),c=0;i>c;++c)u[c].call(r,n,o)}(r,f,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,o,i){if(t)e.call(r,n,o,i);else for(var u=e.length,c=l(e,u),a=0;u>a;++a)c[a].call(r,n,o,i)}(r,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=Array(n-1),i=1;n>i;i++)o[i-1]=arguments[i];!function(e,t,r,n){if(t)e.apply(r,n);else for(var o=e.length,i=l(e,o),u=0;o>u;++u)i[u].apply(r,n)}(r,f,this,o)}return!0},u.prototype.on=u.prototype.addListener=function(e,t){return a(this,e,t,!1)},u.prototype.prependListener=function(e,t){return a(this,e,t,!0)},u.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,s(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,s(this,e,t)),this},u.prototype.removeListener=function(e,t){var r,n,o,u,c;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new i:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,u=r.length;u-- >0;)if(r[u]===t||r[u].listener&&r[u].listener===t){c=r[u].listener,o=u;break}if(0>o)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new i,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,o=e.length;o>n;r+=1,n+=1)e[r]=e[n];e.pop()}(r,o);n.removeListener&&this.emit("removeListener",e,c||t)}return this},u.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new i,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new i:delete r[e]),this;if(0===arguments.length){for(var n,o=Object.keys(r),u=0;o.length>u;++u)"removeListener"!==(n=o[u])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new i,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},u.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;t.length>r;++r)t[r]=e[r].listener||e[r];return t}(t):[]},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},u.prototype.listenerCount=f,u.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var V=Object.freeze({default:u,EventEmitter:u}),X="function"==typeof Symbol&&Symbol.iterator,J=X||"@@iterator",H=J,Z=p,ee=h,te=function(e){return Object(e)===e&&(h(e)||p(e))},re=v,ne=y,oe=d;b.prototype[J]=function(){return this},b.prototype.next=function(){return void 0!==this._o&&this._o.length>this._i?{value:this._o[this._i++],done:!1}:(this._o=void 0,{value:void 0,done:!0})};var ie=function(e,t,r){if(null!=e){if("function"==typeof e.forEach)return e.forEach(t,r);var n=0,o=v(e);if(o){for(var i;!(i=o.next()).done;)if(t.call(r,i.value,n++,e),n>9999999)throw new TypeError("Near-infinite iteration.")}else if(h(e))for(;e.length>n;n++)e.hasOwnProperty(n)&&t.call(r,e[n],n,e)}},ue="function"==typeof Symbol&&Symbol.asyncIterator,ce=ue||"@@asyncIterator",ae=ce,se=function(e){return!!g(e)},fe=m,le=g,pe=w;O.prototype[ce]=function(){return this},O.prototype.next=function(){var e=this._i.next();return Promise.resolve(e.value).then(function(t){return{value:t,done:e.done}})};var he={$$iterator:H,isIterable:Z,isArrayLike:ee,isCollection:te,getIterator:re,getIteratorMethod:ne,createIterator:oe,forEach:ie,$$asyncIterator:ae,isAsyncIterable:se,getAsyncIterator:fe,getAsyncIteratorMethod:le,createAsyncIterator:pe,forAwaitEach:function(e,t,r){var n=w(e);if(n){var o=0;return new Promise(function(i,u){function c(){return n.next().then(function(n){n.done?i():Promise.resolve(t.call(r,n.value,o++,e)).then(c).catch(u)}).catch(u)}c()})}}},ve=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.eventEmitterAsyncIterator=function(e,t){var r=[],n=[],o="string"==typeof t?[t]:t,i=!0,u=function(e){0!==r.length?r.shift()({value:e,done:!1}):n.push(e)},c=function(){i&&(i=!1,a(),r.forEach(function(e){return e({value:void 0,done:!0})}),r.length=0,n.length=0)},a=function(){for(var t=0,r=o;r.length>t;t++)e.removeListener(r[t],u)};return function(){for(var t=0,r=o;r.length>t;t++)e.addListener(r[t],u)}(),s={next:function(){return i?new Promise(function(e){0!==n.length?e({value:n.shift(),done:!1}):r.push(e)}):this.return()},return:function(){return c(),Promise.resolve({value:void 0,done:!0})},throw:function(e){return c(),Promise.reject(e)}},s[he.$$asyncIterator]=function(){return this},s;var s}});n(ve);var ye=V&&u||V,de=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.ee=new ye.EventEmitter,this.subscriptions={},this.subIdCounter=0}return e.prototype.publish=function(e,t){return this.ee.emit(e,t),!0},e.prototype.subscribe=function(e,t){return this.ee.addListener(e,t),this.subIdCounter=this.subIdCounter+1,this.subscriptions[this.subIdCounter]=[e,t],Promise.resolve(this.subIdCounter)},e.prototype.unsubscribe=function(e){var t=this.subscriptions[e],r=t[0],n=t[1];delete this.subscriptions[e],this.ee.removeListener(r,n)},e.prototype.asyncIterator=function(e){return ve.eventEmitterAsyncIterator(this.ee,e)},e}();t.PubSub=r});n(de);var be=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.withFilter=function(e,t){return function(r,n,o,i){var u=e(r,n,o,i),c=function(){return u.next().then(function(e){return Promise.all([e,Promise.resolve(t(e.value,n,o,i)).catch(function(){return!1})])}).then(function(e){var t=e[0];return!0===e[1]||!0===t.done?t:c()})};return a={next:function(){return c()},return:function(){return u.return()},throw:function(e){return u.throw(e)}},a[he.$$asyncIterator]=function(){return this},a;var a}}});n(be);var me=o(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.PubSub=de.PubSub,t.withFilter=be.withFilter});n(me);var ge=me.PubSub,we=me.withFilter,Oe=function(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]},_e=function(e){return function t(r){return 0===arguments.length||Oe(r)?t:e.apply(this,arguments)}},je=_e(function(e){return null==e}),Ee=function(e,t,r,n,o,i,u,c){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[r,n,o,i,u,c],f=0;(a=Error(t.replace(/%s/g,function(){return s[f++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},xe=function(e,t){return Object.prototype.hasOwnProperty.call(t,e)},ke=Object.prototype.toString,Se=function(){return"[object Arguments]"===ke.call(arguments)?function(e){return"[object Arguments]"===ke.call(e)}:function(e){return xe("callee",e)}},Ae=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)},Pe=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Te=function(e){return"[object String]"===Object.prototype.toString.call(e)},Le=function(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return Oe(r)?t:_e(function(t){return e(r,t)});default:return Oe(r)&&Oe(n)?t:Oe(r)?_e(function(t){return e(t,n)}):Oe(n)?_e(function(t){return e(r,t)}):e(r,n)}}},Ie=function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r},Ce=function(e,t,r){for(var n=0,o=r.length;o>n;){if(e(t,r[n]))return!0;n+=1}return!1},Fe=function(e){var t=(e+"").match(/^function (\w*)/);return null==t?"":t[1]},qe=Le(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}),Me=!{toString:null}.propertyIsEnumerable("toString"),Re=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Ne=function(){return arguments.propertyIsEnumerable("length")}(),De=function(e,t){for(var r=0;e.length>r;){if(e[r]===t)return!0;r+=1}return!1},Ge=_e("function"!=typeof Object.keys||Ne?function(e){if(Object(e)!==e)return[];var t,r,n=[],o=Ne&&Se(e);for(t in e)!xe(t,e)||o&&"length"===t||(n[n.length]=t);if(Me)for(r=Re.length-1;r>=0;)xe(t=Re[r],e)&&!De(n,t)&&(n[n.length]=t),r-=1;return n}:function(e){return Object(e)!==e?[]:Object.keys(e)}),Qe=_e(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}),Ue=j,Ye=Le(function(e,t){return Ue(e,t,[],[])}),$e=function(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,n){return t.apply(this,arguments)};case 4:return function(e,r,n,o){return t.apply(this,arguments)};case 5:return function(e,r,n,o,i){return t.apply(this,arguments)};case 6:return function(e,r,n,o,i,u){return t.apply(this,arguments)};case 7:return function(e,r,n,o,i,u,c){return t.apply(this,arguments)};case 8:return function(e,r,n,o,i,u,c,a){return t.apply(this,arguments)};case 9:return function(e,r,n,o,i,u,c,a,s){return t.apply(this,arguments)};case 10:return function(e,r,n,o,i,u,c,a,s,f){return t.apply(this,arguments)};default:throw Error("First argument to _arity must be a non-negative integer no greater than ten")}},ze=function(e,t){return function(){return t.call(this,e.apply(this,arguments))}},We=function(e){return function t(r,n,o){switch(arguments.length){case 0:return t;case 1:return Oe(r)?t:Le(function(t,n){return e(r,t,n)});case 2:return Oe(r)&&Oe(n)?t:Oe(r)?Le(function(t,r){return e(t,n,r)}):Oe(n)?Le(function(t,n){return e(r,t,n)}):_e(function(t){return e(r,n,t)});default:return Oe(r)&&Oe(n)&&Oe(o)?t:Oe(r)&&Oe(n)?Le(function(t,r){return e(t,r,o)}):Oe(r)&&Oe(o)?Le(function(t,r){return e(t,n,r)}):Oe(n)&&Oe(o)?Le(function(t,n){return e(r,t,n)}):Oe(r)?_e(function(t){return e(t,n,o)}):Oe(n)?_e(function(t){return e(r,t,o)}):Oe(o)?_e(function(t){return e(r,n,t)}):e(r,n,o)}}},Be=_e(function(e){return!!Ae(e)||!!e&&("object"==typeof e&&(!Te(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))}),Ke=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),Ve=function(e){return new Ke(e)},Xe=Le(function(e,t){return $e(e.length,function(){return e.apply(t,arguments)})}),Je="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",He=function(e,t,r){if("function"==typeof e&&(e=Ve(e)),Be(r))return function(e,t,r){for(var n=0,o=r.length;o>n;){if((t=e["@@transducer/step"](t,r[n]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n+=1}return e["@@transducer/result"](t)}(e,t,r);if("function"==typeof r["fantasy-land/reduce"])return x(e,t,r,"fantasy-land/reduce");if(null!=r[Je])return E(e,t,r[Je]());if("function"==typeof r.next)return E(e,t,r);if("function"==typeof r.reduce)return x(e,t,r,"reduce");throw new TypeError("reduce: list must be array or iterable")},Ze=We(He),et=function(e,t){return function(){var r=arguments.length;if(0===r)return t();var n=arguments[r-1];return Ae(n)||"function"!=typeof n[e]?t.apply(this,arguments):n[e].apply(n,Array.prototype.slice.call(arguments,0,r-1))}},tt=_e(et("tail",We(et("slice",function(e,t,r){return Array.prototype.slice.call(r,e,t)}))(1,1/0))),rt=function(){if(0===arguments.length)throw Error("pipe requires at least one argument");return $e(arguments[0].length,Ze(ze,arguments[0],tt(arguments)))},nt=_e(function(e){return Te(e)?e.split("").reverse().join(""):Array.prototype.slice.call(e,0).reverse()}),ot=function(){if(0===arguments.length)throw Error("compose requires at least one argument");return rt.apply(this,nt(arguments))},it=function(e){return function(){return!e.apply(this,arguments)}},ut=function(e){return"function"==typeof e["@@transducer/step"]},ct=function(e,t,r){return function(){if(0===arguments.length)return r();var n=Array.prototype.slice.call(arguments,0),o=n.pop();if(!Ae(o)){for(var i=0;e.length>i;){if("function"==typeof o[e[i]])return o[e[i]].apply(o,n);i+=1}if(ut(o))return t.apply(null,n)(o)}return r.apply(this,arguments)}},at=function(e,t){for(var r=0,n=t.length,o=[];n>r;)e(t[r])&&(o[o.length]=t[r]),r+=1;return o},st=function(){return this.xf["@@transducer/init"]()},ft=function(e){return this.xf["@@transducer/result"](e)},lt=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=st,e.prototype["@@transducer/result"]=ft,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}(),pt=Le(ct(["filter"],Le(function(e,t){return new lt(e,t)}),function(e,t){return Pe(t)?He(function(r,n){return e(t[n])&&(r[n]=t[n]),r},{},Ge(t)):at(e,t)})),ht=Le(function(e,t){return pt(it(e),t)}),vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yt=function(e){return ot(Ye(e),Qe)},dt=yt("Array"),bt=yt("Object"),mt=function(e,t){Ee(!je(e),'The "'+t+"\" collection does not exist. You can create one using your clerk instance by running(clerk.addCollection('"+t+"'))"),Ee("object"===(void 0===e?"undefined":vt(e)),'"'+t+'" is not a collection. You can access it like any other property on the state object')},gt=ht(yt("Undefined")),wt=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Ot=function(e){return k()},_t=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jt=function(e){return S()},Et=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},xt=function(e){return A()},kt="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,n=arguments.length;n>r;){var o=arguments[r];if(null!=o)for(var i in o)xe(i,o)&&(t[i]=o[i]);r+=1}return t},St=Le(function(e,t){return kt({},e,t)}),At=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Pt=function(e){return P()},Tt=Le(function(e,t){for(var r={},n={},o=0,i=e.length;i>o;)n[e[o]]=1,o+=1;for(var u in t)n.hasOwnProperty(u)||(r[u]=t[u]);return r}),Lt=function(e){return T()},It=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.state=t,this.get=Ot(t).bind(t),this.post=jt(t).bind(t),this.put=xt(t).bind(t),this.patch=Pt(t).bind(t),this.delete=Lt(t).bind(t)}return e.prototype.getCollection=function(e){return this.state[e]},e.prototype.addCollection=function(e){return this.state[e]=new(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object),this.state[e]},e.prototype.removeCollection=function(e){var t=this.state[e];return null!=t&&delete this.state[e],t},e}(),Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ft=function(e){if("function"==typeof Symbol){if(Symbol.asyncIterator){var t=e[Symbol.asyncIterator];if(null!=t)return t.call(e)}if(Symbol.iterator)return e[Symbol.iterator]()}throw new TypeError("Object is not async iterable")},qt=(function(){function e(e){this.value=e}function t(t){function r(o,i){try{var u=t[o](i),c=u.value;c instanceof e?Promise.resolve(c.value).then(function(e){r("next",e)},function(e){r("throw",e)}):n(u.done?"return":"normal",u.value)}catch(e){n("throw",e)}}function n(e,t){switch(e){case"return":o.resolve({value:t,done:!0});break;case"throw":o.reject(t);break;default:o.resolve({value:t,done:!1})}(o=o.next)?r(o.key,o.arg):i=null}var o,i;this._invoke=function(e,t){return new Promise(function(n,u){var c={key:e,arg:t,resolve:n,reject:u,next:null};i?i=i.next=c:(o=i=c,r(e,t))})},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){function n(o,i){try{var u=t[o](i),c=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(c).then(function(e){n("next",e)},function(e){n("throw",e)});e(c)}return n("next")})}}),Mt=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Rt=function(e,t){var r={};for(var n in e)0>t.indexOf(n)&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},Nt=o(function(e,t){!function(e,t){function r(e){return"function"==typeof Symbol&&!!Symbol[e]}function n(e){return r(e)?Symbol[e]:"@@"+e}function o(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function i(e){var t=e.constructor;return void 0!==t&&null===(t=t[n("species")])&&(t=void 0),void 0!==t?t:l}function u(e,t){Object.keys(t).forEach(function(r){var n=Object.getOwnPropertyDescriptor(t,r);n.enumerable=!1,Object.defineProperty(e,r,n)})}function c(e){var t=e._cleanup;t&&(e._cleanup=void 0,t())}function a(e){return void 0===e._observer}function s(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;var r=o(e,"start");if(r&&r.call(e,this),!a(this)){e=new f(this);try{var n=t.call(void 0,e);if(null!=n){if("function"==typeof n.unsubscribe)n=function(e){return function(){e.unsubscribe()}}(n);else if("function"!=typeof n)throw new TypeError(n+" is not a function");this._cleanup=n}}catch(t){return void e.error(t)}a(this)&&c(this)}}function f(e){this._subscription=e}function l(e){if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable"));u(s.prototype={},{get closed(){return a(this)},unsubscribe:function(){!function(e){if(a(e))return;e._observer=void 0,c(e)}(this)}});u(f.prototype={},{get closed(){return a(this._subscription)},next:function(e){var t=this._subscription;if(!a(t)){var r=t._observer,n=o(r,"next");if(n)return n.call(r,e)}},error:function(e){var t=this._subscription;if(a(t))throw e;var r=t._observer;t._observer=void 0;try{var n=o(r,"error");if(!n)throw e;e=n.call(r,e)}catch(e){try{c(t)}finally{throw e}}return c(t),e},complete:function(e){var t=this._subscription;if(!a(t)){var r=t._observer;t._observer=void 0;try{var n=o(r,"complete");e=n?n.call(r,e):void 0}catch(e){try{c(t)}finally{throw e}}return c(t),e}}});u(l.prototype,{subscribe:function(e){for(var t=[],r=1;arguments.length>r;++r)t.push(arguments[r]);return"function"==typeof e&&(e={next:e,error:t[0],complete:t[1]}),new s(e,this._subscriber)},forEach:function(e){var t=this;return new Promise(function(r,n){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var r=this._subscription;if(!r.closed)try{return e(t)}catch(e){n(e),r.unsubscribe()}},error:n,complete:r})})},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this);return new r(function(r){return t.subscribe({next:function(t){if(!r.closed){try{t=e(t)}catch(e){return r.error(e)}return r.next(t)}},error:function(e){return r.error(e)},complete:function(e){return r.complete(e)}})})},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this);return new r(function(r){return t.subscribe({next:function(t){if(!r.closed){try{if(!e(t))return}catch(e){return r.error(e)}return r.next(t)}},error:function(e){return r.error(e)},complete:function(){return r.complete()}})})},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this),n=arguments.length>1,o=!1,u=arguments[1],c=u;return new r(function(r){return t.subscribe({next:function(t){if(!r.closed){var i=!o;if(o=!0,!i||n)try{c=e(c,t)}catch(e){return r.error(e)}else c=t}},error:function(e){r.error(e)},complete:function(){o||n?(r.next(c),r.complete()):r.error(new TypeError("Cannot reduce an empty sequence"))}})})},flatMap:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this);return new r(function(r){function n(){o&&0===i.length&&r.complete()}var o=!1,i=[],u=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return void r.error(e)}l.from(t).subscribe({_subscription:null,start:function(e){i.push(this._subscription=e)},next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(this._subscription);0>e||i.splice(e,1),n()}})},error:function(e){return r.error(e)},complete:function(){o=!0,n()}});return function(){i.forEach(function(e){return e.unsubscribe()}),u.unsubscribe()}})}}),Object.defineProperty(l.prototype,n("observable"),{value:function(){return this},writable:!0,configurable:!0}),u(l,{from:function(e){var t="function"==typeof this?this:l;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,n("observable"));if(i){var u=i.call(e);if(Object(u)!==u)throw new TypeError(u+" is not an object");return u.constructor===t?u:new t(function(e){return u.subscribe(e)})}if(r("iterator")&&(i=o(e,n("iterator"))))return new t(function(t){for(var r,n=i.call(e)[Symbol.iterator]();!(r=n.next()).done;){var o=r.value;if(t.next(o),t.closed)return}t.complete()});if(Array.isArray(e))return new t(function(t){for(var r=0;e.length>r;++r)if(t.next(e[r]),t.closed)return;t.complete()});throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;arguments.length>t;++t)e.push(arguments[t]);var r="function"==typeof this?this:l;return new r(function(t){for(var r=0;e.length>r;++r)if(t.next(e[r]),t.closed)return;t.complete()})}}),Object.defineProperty(l,n("species"),{get:function(){return this},configurable:!0}),e.Observable=l}(t)}).Observable,Dt='You cannot extend the context with an object containing a "store" prop. It will be omitted and the other props will be added',Gt=function(e){return'The "'+e+"\" property already exists in the context object. Make sure you haven't replaced anything important"},Qt={},Ut=' The "graphql" method is deprecated and will be removed in the 1.0 release. Use the "fetch" method instead.',Yt='The "createStore" method is deprecated and will be removed in the 1.0 release. Use "new BlipsClient(...)" instead',$t='You are trying to use "BlipsClient.fetch" without it being configured.',zt="No subscription operation defined in query",Wt="Only one subscription operation is allowed per query",Bt=function(){return"The fetch "+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"middleware/afterware")+" must be a function or an array of functions"};e.BlipsClient=Y,e.createStore=function(){Qt[Yt]||(console.warn(Yt),Qt[Yt]=!0);for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(Y,[null].concat(t)))},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("graphql")):"function"==typeof define&&define.amd?define(["exports","graphql"],t):t(e.blips={},e.GraphQL)}(this,function(e,t){"use strict";function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t){return t={exports:{}},e(t,t.exports),t.exports}function o(){}function i(){i.init.call(this)}function u(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function s(e,t,r,n){var i,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),a=s[t]):(s=e._events=new o,e._eventsCount=0),a){if("function"==typeof a?a=s[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(i=u(e))&&i>0&&a.length>i){a.warned=!0;var c=Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(c)}}else a=s[t]=r,++e._eventsCount;return e}function a(e,t,r){function n(){e.removeListener(t,n),o||(o=!0,r.apply(e,arguments))}var o=!1;return n.listener=r,n}function c(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function f(e,t){for(var r=Array(t);t--;)r[t]=e[t];return r}function l(e){return!!y(e)}function h(e){var t=null!=e&&e.length;return"number"==typeof t&&t>=0&&t%1==0}function p(e){var t=y(e);if(t)return t.call(e)}function y(e){if(null!=e){var t=V&&e[V]||e["@@iterator"];if("function"==typeof t)return t}}function d(e){if(null!=e){var t=p(e);if(t)return t;if(h(e))return new v(e)}}function v(e){this._o=e,this._i=0}function b(e){var t=m(e);if(t)return t.call(e)}function m(e){if(null!=e){var t=se&&e[se]||e["@@asyncIterator"];if("function"==typeof t)return t}}function w(e){if(null!=e){var t=b(e);if(t)return t;var r=d(e);if(r)return new g(r)}}function g(e){this._i=e}function O(e,t,r){var n=this,o=function(){if(e.length>0){var i=e.shift();i&&i.apply(n,[t,o])}else r(t)};o()}function _(e){void 0===e&&(e={});var t=e.constructOptions,r=e.customFetch,n=e.uri||"/graphql",o=[],i=[],u=[],s=[],a=function(e){var a,c={},f=Array.isArray(e);return function(e,t){return new Promise(function(r,n){t?O(i.slice(),e,r):O(o.slice(),e,r)})}(f?{requests:e,options:c}:{request:e,options:c},f).then(function(e){return(t||function(e,t){var r;try{r=JSON.stringify(e)}catch(e){throw Error("Network request failed. Payload is not serializable: "+e.message)}return _e({body:r,method:"POST"},t,{headers:_e({Accept:"*/*","Content-Type":"application/json"},t.headers||[])})})(e.request||e.requests,e.options)}).then(function(e){return c=_e({},e),(r||fetch)(n,c)}).then(function(e){return e.text().then(function(t){try{var r=JSON.parse(t);return e.raw=t,e.parsed=r,e}catch(r){return a=r,e.raw=t,e}})}).then(function(e){return function(e,t){return new Promise(function(r,n){t?O(s.slice(),e,r):O(u.slice(),e,r)})}({response:e,options:c},f)}).then(function(e){var t=e.response;if(t.parsed){if(!f)return _e({},t.parsed);if(Array.isArray(t.parsed))return t.parsed;!function(e){var t=Error("A batched Operation of responses for ");throw t.response=e,t}(t)}else!function(e,t){var r;throw r=Error(e&&e.status>=300?"Network request failed with status "+e.status+' - "'+e.statusText+'"':"Network request failed to return valid JSON"),r.response=e,r.parseError=t,r}(t,a)})};return a.use=function(e){if("function"!=typeof e)throw Error("Middleware must be a function");return o.push(e),a},a.useAfter=function(e){if("function"!=typeof e)throw Error("Afterware must be a function");return u.push(e),a},a.batchUse=function(e){if("function"!=typeof e)throw Error("Middleware must be a function");return i.push(e),a},a.batchUseAfter=function(e){if("function"!=typeof e)throw Error("Afterware must be a function");return s.push(e),a},a}function E(e,t,r,n){function o(e,t){return x(e,t,r.slice(),n.slice())}var i=Fe(e),u=Fe(t);return!qe(function(e,t){return!qe(o,t,e)},u,i)}function x(e,t,r,n){if(Be(e,t))return!0;var o=Qe(e);if(o!==Qe(t))return!1;if(null==e||null==t)return!1;if("function"==typeof e["fantasy-land/equals"]||"function"==typeof t["fantasy-land/equals"])return"function"==typeof e["fantasy-land/equals"]&&e["fantasy-land/equals"](t)&&"function"==typeof t["fantasy-land/equals"]&&t["fantasy-land/equals"](e);if("function"==typeof e.equals||"function"==typeof t.equals)return"function"==typeof e.equals&&e.equals(t)&&"function"==typeof t.equals&&t.equals(e);switch(o){case"Arguments":case"Array":case"Object":if("function"==typeof e.constructor&&"Promise"===Re(e.constructor))return e===t;break;case"Boolean":case"Number":case"String":if(typeof e!=typeof t||!Be(e.valueOf(),t.valueOf()))return!1;break;case"Date":if(!Be(e.valueOf(),t.valueOf()))return!1;break;case"Error":return e.name===t.name&&e.message===t.message;case"RegExp":if(e.source!==t.source||e.global!==t.global||e.ignoreCase!==t.ignoreCase||e.multiline!==t.multiline||e.sticky!==t.sticky||e.unicode!==t.unicode)return!1}for(var i=r.length-1;i>=0;){if(r[i]===e)return n[i]===t;i-=1}switch(o){case"Map":return e.size===t.size&&E(e.entries(),t.entries(),r.concat([e]),n.concat([t]));case"Set":return e.size===t.size&&E(e.values(),t.values(),r.concat([e]),n.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=Ge(e);if(u.length!==Ge(t).length)return!1;var s=r.concat([e]),a=n.concat([t]);for(i=u.length-1;i>=0;){var c=u[i];if(!Te(c,t)||!x(t[c],e[c],s,a))return!1;i-=1}return!0}function j(e,t,r){for(var n=r.next();!n.done;){if((t=e["@@transducer/step"](t,n.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n=r.next()}return e["@@transducer/result"](t)}function A(e,t,r,n){return e["@@transducer/result"](r[n](Xe(e["@@transducer/step"],e),t))}function T(e){return function(e,t){var r=this[e];return gt(r,e),mt(r)?je(t)?r:function(e,t){if(!wt(t))return[];var r=Object.entries(t)[0],n=r[0],o=r[1];return e.filter(function(e){return e[n]===o})}(r,t):je(t)?r:function(e,t){if(wt(t)){var r=Object.entries(t)[0]||{},n=r[0],o=r[1];return Object.entries(e).filter(function(e){return e[1][n]===o}).reduce(function(e,t){var r;return _t({},e,(r={},r[t[0]]=t[1],r))},{})}return e[t]}(r,t)}}function P(e){return function(e,t,r){var n=this[e];return gt(n,e),mt(n)?function(e,t){return this[e]=[].concat(this[e]||[],[t]),t}.call(this,e,t):function(e,t,r){var n;return Ae(!je(t),"You forgot to specify the payload"),Ae(!je(r),"You are trying to post to a collection object but haven't specified an identifier. Try again with \"clerk.post('"+e+"', payload, identifier)\""),this[e]=xt({},this[e]||{},(n={},n[r]=t,n)),t}.call(this,e,t,r)}}function S(e){return function(e,t,r){var n=this[e];return gt(n,e),mt(n)?function(e,t,r){if(je(r))return this[e]=[].concat(this[e],[t]),t;Ae(wt(r),"When updating a resource inside a list you have to specify an identifier object containing the key/value pair you want to match.");var n=Object.entries(r)[0],o=n[0],i=n[1],u=this[e].findIndex(function(e){return e[o]===i});return this[e]=[].concat(this[e].slice(0,u),[t],this[e].slice(u+1)),t}.call(this,e,t,r):function(e,t,r){var n;return Ae(!je(r),"You are trying to update a resource but haven't specified the identifier. Try again with \"clerk.put('"+e+"', payload, identifier)\""),this[e]=At({},this[e]||{},(n={},n[r]=t,n)),t}.call(this,e,t,r)}}function k(e){return function(e,t,r){var n=this[e];return gt(n,e),Ae(!je(r),"You are trying to patch a resource but haven't specified the identifier. Try again with \"clerk.patch('"+e+"', payload, key)\""),mt(n)?function(e,t,r){Ae(wt(r),"When patching a resource inside a list you have to specify an identifier object containing the key/value pair you want to match.");var n=Object.entries(r)[0],o=n[0],i=n[1],u=this[e].findIndex(function(e){return e[o]===i});if(u>=0){var s=St(this[e][u],Ot(t));return this[e]=[].concat(this[e].slice(0,u),[s],this[e].slice(u+1)),s}}.call(this,e,t,r):function(e,t,r){var n;if(Ae(!je(r),"You are trying to update a resource but haven't specified the identifier. Try again with \"clerk.put('"+e+"', payload, identifier)\""),!je(this[e][r])){var o=St(this[e][r],Ot(t));return this[e]=kt({},this[e]||{},(n={},n[r]=o,n)),o}}.call(this,e,t,r)}}function L(e){return function(e,t){if(!je(t)){var r=this[e];return gt(r,e),mt(r)?function(e,t){if(wt(t)){var r=Object.entries(t)[0],n=r[0],o=r[1],i=this[e].findIndex(function(e){return e[n]===o});if(i>=0){var u=this[e][i];return this[e]=[].concat(this[e].slice(0,i),this[e].slice(i+1)),u}}}.call(this,e,t):function(e,t){var r=this[e][t];if(!je(r))return this[e]=It([t],this[e]),r}.call(this,e,t)}}}function I(e,t,r){var n=!!e;return"function"==typeof e&&(n=!!e(r)),n?"function"==typeof t?t(r):t:r}function C(e,t){return null===t?"null"===e.toLowerCase():void 0===t?"undefined"===e.toLowerCase():e.toLowerCase()===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(t).toLowerCase()}function F(e){return"string"==typeof e?!e:C("object",e)?!Object.values(e).length:C("array",e)?!e.length:C("Map",e)?!e.size:!!C("Set",e)&&!e.size}function q(e){var t=this;return new Mt(function(r){return Bt(regeneratorRuntime.mark(function n(){var o,i,u,s,a,c,f;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,o=!0,i=!1,u=void 0,t.prev=4,s=Rt(e);case 6:return t.next=8,s.next();case 8:return a=t.sent,o=a.done,t.next=12,a.value;case 12:if(c=t.sent,o){t.next=19;break}r.next(f=c);case 16:o=!0,t.next=6;break;case 19:t.next=25;break;case 21:t.prev=21,t.t0=t.catch(4),i=!0,u=t.t0;case 25:if(t.prev=25,t.prev=26,o||!s.return){t.next=30;break}return t.next=30,s.return();case 30:if(t.prev=30,!i){t.next=33;break}throw u;case 33:return t.finish(30);case 34:return t.finish(25);case 35:t.next=41;break;case 37:t.prev=37,t.t1=t.catch(0),e.return(),r.error(t.t1);case 41:case"end":return t.stop()}},n,t,[[0,37],[4,21,25,35],[26,,30,34]])}))(),function(){r.complete(),e.return()}})}function R(e,t){if(!t||"object"!==(void 0===t?"undefined":qt(t))||t.hasOwnProperty("length")||t.hasOwnProperty("size"))return e;var r=t.store,n=Dt(t,["store"]);r&&console.warn(Nt);var o=Object.keys(n),i=Array.isArray(o),u=0;for(o=i?o:o[Symbol.iterator]();;){var s;if(i){if(u>=o.length)break;s=o[u++]}else{if((u=o.next()).done)break;s=u.value}var a=s;e.hasOwnProperty(a)&&console.warn(Gt(a))}return Ut({},e,n)}function B(e){return null==e}function U(e){for(var t=[],r=[],n=Array.isArray(i=e),o=0,i=n?i:i[Symbol.iterator]();;){var u;if(n){if(o>=i.length)break;u=i[o++]}else{if((o=i.next()).done)break;u=o.value}var s=u||{},a=s.data,c=s.errors;c&&(t=[].concat(t,c)),a&&(r=[].concat(r,[a]))}var f=function(e){return I(F,function(){},e.reduce(function(e,t){return C("object",t)&&!B(t)?Ut({},e,t):e},{}))}(r),l=function(e){return I(F,function(){},e.reduce(function(e,t){var r;if(B(t)||F(t))return e;var n=t.path?t.path[0]:C("object",t)?t.constructor.name:"Errors";return Ut({},e,(r={},r[n]=[].concat(e[n]||[],[t]),r))},{}))}(t);return Ut({},f?{data:f}:{},l?{errors:l}:{})}function D(e){return!(e.kind!==t.Kind.OPERATION_DEFINITION)}function M(e){if("subscription"===e.operation&&1!==e.selectionSet.selections.length)return new t.GraphQLError(function(e){return(e?'Subscription "'+e+'" ':"Anonymous Subscription ")+"must select only one top level field."}(e.name&&e.name.value),e.selectionSet.selections.slice(1))}function N(e,r){if(!e.name&&r>1)return new t.GraphQLError("This anonymous operation must be the only defined operation.",[e])}function G(e,r){if(function(e){return!(e.kind!==t.Kind.FRAGMENT_DEFINITION)}(e)){var n=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).name.value}(e);if(r[n])return new t.GraphQLError(function(e){return'There can be only one fragment named "'+e+'".'}(n),[r[n],e.name]);r[n]=e.name}}function Q(e){for(var t=function(e){return e.definitions.filter(D)}(e).length,r=Object.create(null),n=[],o=Array.isArray(u=e.definitions),i=0,u=o?u:u[Symbol.iterator]();;){var s;if(o){if(i>=u.length)break;s=u[i++]}else{if((i=u.next()).done)break;s=i.value}var a=s,c=N(a,t)||G(a,r)||M(a);c&&n.push(c)}return n}function z(){function e(e){var r=e;try{r=function(e){return"string"==typeof e?t.parse(e):e}(e)}catch(e){return{document:r,errors:[e]}}var n=w?t.validate(w,r):Q(r);return Ut({document:r},!F(n)&&{errors:n})}function r(e){return function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.variables,o=void 0===n?{}:n,i=r.context,u=arguments[2],s=arguments[3];return e(w,t,{},R(E,void 0===i?{}:i),Ut({},x,o),u,s)}}function n(e,t){if(e)if(C("function",e))j.use(e);else{if(!C("array",e))throw new TypeError(Jt(t));for(var r=Array.isArray(o=e),n=0,o=r?o:o[Symbol.iterator]();;){var i;if(r){if(n>=o.length)break;i=o[n++]}else{if((n=o.next()).done)break;i=n.value}j.use(i)}}}function o(t){return function(r,n,o,i){var u=e(r),s=u.document,a=u.errors;if(a)return Promise.resolve({errors:a});if(o)return A(s,n,o,i);var c=s.definitions.filter(function(e){return e.operation===t});return 1===c.length?A(s,n,o,i):function(e){return new Promise(function(t){for(var r=[],n=function(){if(o){if(i>=u.length)return"break";s=u[i++]}else{if((i=u.next()).done)return"break";s=i.value}var e=s;r.push(new Promise(function(t){e.then(function(e){return t(e)},function(e){return t({errors:[e]})})}))},o=Array.isArray(u=e),i=0,u=o?u:u[Symbol.iterator]();;){var s;if("break"===n())break}Promise.all(r).then(function(e){t(U(e))})})}(c.map(function(e){return A(s,n,e.name.value,i)}))}}var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=i.typeDefs,s=i.resolvers,a=this,c=arguments[1],f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=f.variables,h=void 0===l?{}:l,p=f.context,y=void 0===p?{}:p,d=f.fetch,v=void 0===d?{}:d,b=new ge,m=void 0,w=void 0,g=void 0,O=void 0,E=void 0,x=void 0,j=void 0,A=r(t.execute),T=r(t.subscribe);return m=Ut({},c)||{},O=new Ft(m),g=I("function"==typeof s,s({pubsub:b,withFilter:Oe}),s),u&&(w=J({typeDefs:u,resolvers:g})),x=h,E=R({store:Ut({},O)},y),v.uri&&(j=_({uri:v.uri}),n(v.middleware,"middleware"),n(v.afterware,"afterware")),{get state(){return m},get schema(){return w},query:o("query"),mutate:o("mutation"),subscribe:function(){var r=Bt(regeneratorRuntime.mark(function r(n,o,i,u){var s,c,f,l,h;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(s=e(n),c=s.document,!(f=s.errors)){r.next=3;break}return r.abrupt("return",Promise.resolve({errors:f}));case 3:if((l=c.definitions.filter(function(e){return"subscription"===e.operation})).length>=1){r.next=8;break}return r.abrupt("return",Promise.resolve({errors:[new t.GraphQLError(Wt)]}));case 8:if(l.length<=1){r.next=10;break}return r.abrupt("return",Promise.resolve({errors:[new t.GraphQLError(Ht)]}));case 10:return r.next=12,T(c,o,i,u);case 12:return h=r.sent,h.toObservable=function(){return q(h)},r.abrupt("return",h);case 15:case"end":return r.stop()}},r,a)}));return function(e,t,n,o){return r.apply(this,arguments)}}(),fetch:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).variables,r=void 0===t?{}:t,n=arguments[2];if(!j||!C("function",j))throw Error(Yt);return j({query:e,variables:r,operationName:n})},graphql:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).variables,r=void 0===t?{}:t,n=arguments[2];if(Qt[zt]||(console.warn(zt),Qt[zt]=!0),!j||!C("function",j))throw Error(Yt);return j({query:e,variables:r,operationName:n})}}}var $="default"in t?t.default:t,Y="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},W=n(function(e,t){function r(e,t,r,n,o){var i={};return function(){var u=((Error().stack||"").match(/(?:\s+at\s.+){2}\s+at\s(.+)/)||[void 0,""])[1];if(!((u=/\)$/.test(u)?u.match(/[^(]+(?=\)$)/)[0]:u.trim())in i)){i[u]=!0;var s;switch(e){case"class":s="Class";break;case"property":s="Property";break;case"method":s="Method";break;case"function":s="Function"}s+=" `"+t+"` has been deprecated",n&&(s+=" since version "+n),r&&(s+=", use `"+r+"` instead"),s+=".",u&&(s+="\n at "+u),o&&(s+="\nCheck out "+o+" for more information."),console.warn(s)}}}function n(e,n,o,i,u,s){var a=(t.options.getWarner||r)(e,n,i,u,s),c={enumerable:(o=o||{writable:!0,enumerable:!1,configurable:!0}).enumerable,configurable:o.configurable};if(o.get||o.set)o.get&&(c.get=function(){return a(),o.get.call(this)}),o.set&&(c.set=function(e){return a(),o.set.call(this,e)});else{var f=o.value;c.get=function(){return a(),f},o.writable&&(c.set=function(e){a(),f=e})}return c}function o(e,n,o,i,u){for(var s=(t.options.getWarner||r)(e,n.name,o,i,u),a=function(){return s(),n.apply(this,arguments)},c=0,f=Object.getOwnPropertyNames(n);f.length>c;c++){var l=f[c],h=Object.getOwnPropertyDescriptor(n,l);h.writable?a[l]=n[l]:h.configurable&&Object.defineProperty(a,l,h)}return a}function i(){for(var e=[],t=0;arguments.length>t;t++)e[t-0]=arguments[t];var r=e[e.length-1];r="function"==typeof r?e.pop():void 0;var i,u,s,a=e[0];return"string"==typeof a?(i=a,u=e[1],s=e[2]):a&&(i=a.alternative,u=a.version,s=a.url),r?o("function",r,i,u,s):function(e,t,r){if("string"==typeof t){return n(r&&"function"==typeof r.value?"method":"property",t,r,i,u,s)}if("function"==typeof e){for(var a=o("class",e,i,u,s),c=e.name,f=0,l=Object.getOwnPropertyNames(a);l.length>f;f++){var h=l[f],p=Object.getOwnPropertyDescriptor(a,h);(p=n("class",c,p,i,u,s)).writable?a[h]=e[h]:p.configurable&&Object.defineProperty(a,h,p)}return a}}}t.options={getWarner:void 0},t.deprecated=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i});r(W);var H=n(function(e,t){function r(e){return void 0!==e.kind}function n(e,t){void 0===t&&(t=[]);var o=[];return e.forEach(function(e){if(r(e)&&(e=$.print(e)),"function"==typeof e)-1===t.indexOf(e)&&(t.push(e),o=o.concat(n(e(),t)));else{if("string"!=typeof e){throw new m("typeDef array must contain only strings and functions, got "+typeof e)}o.push(e.trim())}}),function(e){return e.reduce(function(e,t){return-1===e.indexOf(t)?e.concat([t]):e},[])}(o.map(function(e){return e.trim()})).join("\n")}function o(e){var t,o=e;if(r(e))t=e;else if("string"!=typeof o){if(!Array.isArray(o)){throw new m("typeDefs must be a string, array or schema AST, got "+typeof o)}o=n(o)}"string"==typeof o&&(t=$.parse(o));var u=v.buildASTSchema(t),s=i(t);return s.definitions.length>0&&(u=v.extendSchema(u,s)),u}function i(e){var t=e.definitions.filter(function(e){return e.kind===$.Kind.TYPE_EXTENSION_DEFINITION});return Object.assign({},e,{definitions:t})}function u(e,t){var r=e.getTypeMap();Object.keys(r).forEach(function(e){var n=r[e];if(!b.getNamedType(n).name.startsWith("__")&&n instanceof b.GraphQLObjectType){var o=n.getFields();Object.keys(o).forEach(function(r){t(o[r],e,r)})}})}function s(e,t){[e.getQueryType(),e.getMutationType(),e.getSubscriptionType()].filter(function(e){return!!e}).forEach(function(r){var n=function(e){var t,r=Math.random();return function(n,o,i,u){return u.operation.__runAtMostOnce||(u.operation.__runAtMostOnce={}),u.operation.__runAtMostOnce[r]||(u.operation.__runAtMostOnce[r]=!0,t=e(n,o,i,u)),t}}(t),o=r.getFields();Object.keys(o).forEach(function(i){o[i].resolve=r===e.getSubscriptionType()?p(o[i].resolve,t):p(o[i].resolve,n)})})}function a(e,t){Object.keys(t).forEach(function(r){var n=e.getType(r);if(!n&&"__schema"!==r)throw new m('"'+r+'" defined in resolvers, but not in schema');Object.keys(t[r]).forEach(function(e){if(e.startsWith("__"))n[e.substring(2)]=t[r][e];else if(n instanceof b.GraphQLScalarType)n[e]=t[r][e];else{var o=function(e){return e instanceof b.GraphQLObjectType||e instanceof b.GraphQLInterfaceType?e.getFields():void 0}(n);if(!o)throw new m(r+" was defined in resolvers, but it's not an object");if(!o[e])throw new m(r+"."+e+" defined in resolvers, but not in schema");var i=o[e],u=t[r][e];if("function"==typeof u)c(i,{resolve:u});else{if("object"!=typeof u)throw new m("Resolver "+r+"."+e+" must be object or function");c(i,u)}}})})}function c(e,t){Object.keys(t).forEach(function(r){e[r]=t[r]})}function f(e,t){void 0===t&&(t={});var r=t.requireResolversForArgs,n=void 0!==r&&r,o=t.requireResolversForNonScalar,i=void 0!==o&&o,s=t.requireResolversForAllFields,a=void 0!==s&&s;if(a&&(n||i))throw new TypeError("requireResolversForAllFields takes precedence over the more specific assertions. Please configure either requireResolversForAllFields or requireResolversForArgs / requireResolversForNonScalar, but not a combination of them.");u(e,function(e,t,r){a&&l(e,t,r),n&&e.args.length>0&&l(e,t,r),!i||b.getNamedType(e.type)instanceof b.GraphQLScalarType||l(e,t,r)})}function l(e,t,r){if(e.resolve){if("function"!=typeof e.resolve)throw new m('Resolver "'+t+"."+r+'" must be a function')}else console.warn('Resolve function missing for "'+t+"."+r+'". To disable this warning check https://github.com/apollostack/graphql-tools/issues/131')}function h(e,t){if(!t)throw Error("Must provide a logger");if("function"!=typeof t.log)throw Error("Logger.log must be a function");u(e,function(e,r,n){e.resolve=function(e,t,r){void 0===e&&(e=$.defaultFieldResolver);var n=function(e){var n=Error();n.stack=e.stack,r&&(n.originalMessage=e.message,n.message="Error in resolver "+r+"\n"+e.message),t.log(n)};return function(t,r,o,i){try{var u=e(t,r,o,i);return u&&"function"==typeof u.then&&"function"==typeof u.catch&&u.catch(function(e){var t=e instanceof Error?e:Error(e);return n(t),e}),u}catch(e){throw n(e),e}}}(e.resolve,t,r+"."+n)})}function p(e,t){return function(r,n,o,i){return Promise.resolve(t(r,n,o,i)).then(function(t){return e?e(t,n,o,i):$.defaultFieldResolver(t,n,o,i)})}}function y(e){u(e,function(e,t,r){e.resolve=function(e,t){void 0===e&&(e=$.defaultFieldResolver);return function(r,n,o,i){var u=e(r,n,o,i);if(void 0===u)throw Error('Resolve function for "'+t+'" returned undefined');return u}}(e.resolve,t+"."+r)})}var d=Y&&Y.__extends||function(){var e=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])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var v=$,b=$,m=function(e){function t(t){var r=e.call(this,t)||this;return r.message=t,Error.captureStackTrace(r,r.constructor),r}return d(t,e),t}(Error);t.SchemaError=m,t.makeExecutableSchema=function(e){var t=e.resolvers,r=void 0===t?{}:t,n=e.connectors,i=e.allowUndefinedInResolve,u=e.resolverValidationOptions,c=function(e,t,r,n,i){if("object"!=typeof i)throw new m("Expected `resolverValidationOptions` to be an object");if(!e)throw new m("Must provide typeDefs");if(!t)throw new m("Must provide resolvers");var u=o(e);return a(u,t),f(u,i),n||y(u),r&&h(u,r),u}(e.typeDefs,r,e.logger,void 0===i||i,void 0===u?{}:u);return"function"==typeof r.__schema&&s(c,r.__schema),n&&w(c,n),c},t.concatenateTypeDefs=n,t.buildSchemaFromTypeDefinitions=o,t.extractExtensionDefinitions=i,t.forEachField=u;var w=W.deprecated({version:"0.7.0",url:"https://github.com/apollostack/graphql-tools/issues/140"},function(e,t){if(!(e&&e instanceof b.GraphQLSchema))throw Error("schema must be an instance of GraphQLSchema. This error could be caused by installing more than one version of GraphQL-JS");if("object"!=typeof t){throw Error("Expected connectors to be of type object, got "+typeof t)}if(0===Object.keys(t).length)throw Error("Expected connectors to not be an empty object");if(Array.isArray(t))throw Error("Expected connectors to be of type object, got Array");if(e._apolloConnectorsAttached)throw Error("Connectors already attached to context, cannot attach more than once");e._apolloConnectorsAttached=!0;s(e,function(e,r,n){if("object"!=typeof n)throw Error("Cannot attach connector because context is not an object: "+typeof n);return void 0===n.connectors&&(n.connectors={}),Object.keys(t).forEach(function(e){var r=t[e];if(!r.prototype)throw Error("Connector must be a function or an class");n.connectors[e]=new r(n)}),e})});t.attachConnectorsToContext=w,t.addSchemaLevelResolveFunction=s,t.addResolveFunctionsToSchema=a,t.assertResolveFunctionsPresent=f,t.addErrorLoggingToSchema=h,t.chainResolvers=function(e){return function(t,r,n,o){return e.reduce(function(e,t){return t?t(e,r,n,o):$.defaultFieldResolver(e,r,n,o)},t)}},t.addCatchUndefinedToSchema=y});r(H);var J=H.makeExecutableSchema;o.prototype=Object.create(null),i.EventEmitter=i,i.usingDomains=!1,i.prototype.domain=void 0,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.init=function(){this.domain=null,i.usingDomains&&(!(void 0).active||this instanceof(void 0).Domain||(this.domain=(void 0).active)),this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new o,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||0>e||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(e){var t,r,n,o,i,u,s,a="error"===e;if(u=this._events)a=a&&null==u.error;else if(!a)return!1;if(s=this.domain,a){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=u[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,o=f(e,n),i=0;n>i;++i)o[i].call(r)}(r,l,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var o=e.length,i=f(e,o),u=0;o>u;++u)i[u].call(r,n)}(r,l,this,arguments[1]);break;case 3:!function(e,t,r,n,o){if(t)e.call(r,n,o);else for(var i=e.length,u=f(e,i),s=0;i>s;++s)u[s].call(r,n,o)}(r,l,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,o,i){if(t)e.call(r,n,o,i);else for(var u=e.length,s=f(e,u),a=0;u>a;++a)s[a].call(r,n,o,i)}(r,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=Array(n-1),i=1;n>i;i++)o[i-1]=arguments[i];!function(e,t,r,n){if(t)e.apply(r,n);else for(var o=e.length,i=f(e,o),u=0;o>u;++u)i[u].apply(r,n)}(r,l,this,o)}return!0},i.prototype.on=i.prototype.addListener=function(e,t){return s(this,e,t,!1)},i.prototype.prependListener=function(e,t){return s(this,e,t,!0)},i.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,a(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,a(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,i,u,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(n=this._events))return this;if(!(r=n[e]))return this;if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new o:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,u=r.length;u-- >0;)if(r[u]===t||r[u].listener&&r[u].listener===t){s=r[u].listener,i=u;break}if(0>i)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new o,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,o=e.length;o>n;r+=1,n+=1)e[r]=e[n];e.pop()}(r,i);n.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.removeAllListeners=function(e){var t,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new o,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new o:delete r[e]),this;if(0===arguments.length){for(var n,i=Object.keys(r),u=0;i.length>u;++u)"removeListener"!==(n=i[u])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=new o,this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},i.prototype.listeners=function(e){var t,r=this._events;return r&&(t=r[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=Array(e.length),r=0;t.length>r;++r)t[r]=e[r].listener||e[r];return t}(t):[]},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):c.call(e,t)},i.prototype.listenerCount=c,i.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var K=Object.freeze({default:i,EventEmitter:i}),V="function"==typeof Symbol&&Symbol.iterator,X=V||"@@iterator",Z=X,ee=l,te=h,re=function(e){return Object(e)===e&&(h(e)||l(e))},ne=p,oe=y,ie=d;v.prototype[X]=function(){return this},v.prototype.next=function(){return void 0!==this._o&&this._o.length>this._i?{value:this._o[this._i++],done:!1}:(this._o=void 0,{value:void 0,done:!0})};var ue=function(e,t,r){if(null!=e){if("function"==typeof e.forEach)return e.forEach(t,r);var n=0,o=p(e);if(o){for(var i;!(i=o.next()).done;)if(t.call(r,i.value,n++,e),n>9999999)throw new TypeError("Near-infinite iteration.")}else if(h(e))for(;e.length>n;n++)e.hasOwnProperty(n)&&t.call(r,e[n],n,e)}},se="function"==typeof Symbol&&Symbol.asyncIterator,ae=se||"@@asyncIterator",ce=ae,fe=function(e){return!!m(e)},le=b,he=m,pe=w;g.prototype[ae]=function(){return this},g.prototype.next=function(){var e=this._i.next();return Promise.resolve(e.value).then(function(t){return{value:t,done:e.done}})};var ye={$$iterator:Z,isIterable:ee,isArrayLike:te,isCollection:re,getIterator:ne,getIteratorMethod:oe,createIterator:ie,forEach:ue,$$asyncIterator:ce,isAsyncIterable:fe,getAsyncIterator:le,getAsyncIteratorMethod:he,createAsyncIterator:pe,forAwaitEach:function(e,t,r){var n=w(e);if(n){var o=0;return new Promise(function(i,u){function s(){return n.next().then(function(n){n.done?i():Promise.resolve(t.call(r,n.value,o++,e)).then(s).catch(u)}).catch(u)}s()})}}},de=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.eventEmitterAsyncIterator=function(e,t){var r=[],n=[],o="string"==typeof t?[t]:t,i=!0,u=function(e){0!==r.length?r.shift()({value:e,done:!1}):n.push(e)},s=function(){i&&(i=!1,a(),r.forEach(function(e){return e({value:void 0,done:!0})}),r.length=0,n.length=0)},a=function(){for(var t=0,r=o;r.length>t;t++)e.removeListener(r[t],u)};return function(){for(var t=0,r=o;r.length>t;t++)e.addListener(r[t],u)}(),c={next:function(){return i?new Promise(function(e){0!==n.length?e({value:n.shift(),done:!1}):r.push(e)}):this.return()},return:function(){return s(),Promise.resolve({value:void 0,done:!0})},throw:function(e){return s(),Promise.reject(e)}},c[ye.$$asyncIterator]=function(){return this},c;var c}});r(de);var ve=K&&i||K,be=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.ee=new ve.EventEmitter,this.subscriptions={},this.subIdCounter=0}return e.prototype.publish=function(e,t){return this.ee.emit(e,t),!0},e.prototype.subscribe=function(e,t){return this.ee.addListener(e,t),this.subIdCounter=this.subIdCounter+1,this.subscriptions[this.subIdCounter]=[e,t],Promise.resolve(this.subIdCounter)},e.prototype.unsubscribe=function(e){var t=this.subscriptions[e],r=t[0],n=t[1];delete this.subscriptions[e],this.ee.removeListener(r,n)},e.prototype.asyncIterator=function(e){return de.eventEmitterAsyncIterator(this.ee,e)},e}();t.PubSub=r});r(be);var me=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.withFilter=function(e,t){return function(r,n,o,i){var u=e(r,n,o,i),s=function(){return u.next().then(function(e){return Promise.all([e,Promise.resolve(t(e.value,n,o,i)).catch(function(){return!1})])}).then(function(e){var t=e[0];return!0===e[1]||!0===t.done?t:s()})};return a={next:function(){return s()},return:function(){return u.return()},throw:function(e){return u.throw(e)}},a[ye.$$asyncIterator]=function(){return this},a;var a}}});r(me);var we=n(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.PubSub=be.PubSub,t.withFilter=me.withFilter});r(we);var ge=we.PubSub,Oe=we.withFilter;!function(e){function t(e){if("string"!=typeof e&&(e+=""),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function r(e){return"string"!=typeof e&&(e+=""),e}function n(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return p.iterable&&(t[Symbol.iterator]=function(){return t}),t}function o(e){this.map={},e instanceof o?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function i(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function u(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function s(e){var t=new FileReader,r=u(t);return t.readAsArrayBuffer(e),r}function a(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function c(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(p.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(p.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(p.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=""+e;else if(p.arrayBuffer&&p.blob&&d(e))this._bodyArrayBuffer=a(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!p.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!v(e))throw Error("unsupported BodyInit type");this._bodyArrayBuffer=a(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):p.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},p.blob&&(this.blob=function(){var e=i(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?i(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var e=i(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,r=u(t);return t.readAsText(e),r}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),n=0;t.length>n;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},p.formData&&(this.formData=function(){return this.text().then(l)}),this.json=function(){return this.text().then(JSON.parse)},this}function f(e,t){var r=(t=t||{}).body;if(e instanceof f){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new o(e.headers)),this.method=e.method,this.mode=e.mode,r||null==e._bodyInit||(r=e._bodyInit,e.bodyUsed=!0)}else this.url=e+"";if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new o(t.headers)),this.method=function(e){var t=e.toUpperCase();return b.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function l(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}}),t}function h(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=this.status>=200&&300>this.status,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new o(t.headers),this.url=t.url||"",this._initBody(e)}if(!e.fetch){var p={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(p.arrayBuffer)var y=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=function(e){return e&&DataView.prototype.isPrototypeOf(e)},v=ArrayBuffer.isView||function(e){return e&&y.indexOf(Object.prototype.toString.call(e))>-1};o.prototype.append=function(e,n){e=t(e),n=r(n);var o=this.map[e];this.map[e]=o?o+","+n:n},o.prototype.delete=function(e){delete this.map[t(e)]},o.prototype.get=function(e){return e=t(e),this.has(e)?this.map[e]:null},o.prototype.has=function(e){return this.map.hasOwnProperty(t(e))},o.prototype.set=function(e,n){this.map[t(e)]=r(n)},o.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},o.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),n(e)},o.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),n(e)},o.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),n(e)},p.iterable&&(o.prototype[Symbol.iterator]=o.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},c.call(f.prototype),c.call(h.prototype),h.prototype.clone=function(){return new h(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new o(this.headers),url:this.url})},h.error=function(){var e=new h(null,{status:0,statusText:""});return e.type="error",e};var m=[301,302,303,307,308];h.redirect=function(e,t){if(-1===m.indexOf(t))throw new RangeError("Invalid status code");return new h(null,{status:t,headers:{location:e}})},e.Headers=o,e.Request=f,e.Response=h,e.fetch=function(e,t){return new Promise(function(r,n){var i=new f(e,t),u=new XMLHttpRequest;u.onload=function(){var e={status:u.status,statusText:u.statusText,headers:function(e){var t=new o;return e.split(/\r?\n/).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}}),t}(u.getAllResponseHeaders()||"")};e.url="responseURL"in u?u.responseURL:e.headers.get("X-Request-URL");r(new h("response"in u?u.response:u.responseText,e))},u.onerror=function(){n(new TypeError("Network request failed"))},u.ontimeout=function(){n(new TypeError("Network request failed"))},u.open(i.method,i.url,!0),"include"===i.credentials&&(u.withCredentials=!0),"responseType"in u&&p.blob&&(u.responseType="blob"),i.headers.forEach(function(e,t){u.setRequestHeader(t,e)}),u.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}}("undefined"!=typeof self?self:void 0);self.fetch.bind(self);var _e=Object.assign||function(e){for(var t,r=1,n=arguments.length;n>r;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Ee=function(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]},xe=function(e){return function t(r){return 0===arguments.length||Ee(r)?t:e.apply(this,arguments)}},je=xe(function(e){return null==e}),Ae=function(e,t,r,n,o,i,u,s){if(!e){var a;if(void 0===t)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,i,u,s],f=0;(a=Error(t.replace(/%s/g,function(){return c[f++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},Te=function(e,t){return Object.prototype.hasOwnProperty.call(t,e)},Pe=Object.prototype.toString,Se=function(){return"[object Arguments]"===Pe.call(arguments)?function(e){return"[object Arguments]"===Pe.call(e)}:function(e){return Te("callee",e)}},ke=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)},Le=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Ie=function(e){return"[object String]"===Object.prototype.toString.call(e)},Ce=function(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return Ee(r)?t:xe(function(t){return e(r,t)});default:return Ee(r)&&Ee(n)?t:Ee(r)?xe(function(t){return e(t,n)}):Ee(n)?xe(function(t){return e(r,t)}):e(r,n)}}},Fe=function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r},qe=function(e,t,r){for(var n=0,o=r.length;o>n;){if(e(t,r[n]))return!0;n+=1}return!1},Re=function(e){var t=(e+"").match(/^function (\w*)/);return null==t?"":t[1]},Be=Ce(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}),Ue=!{toString:null}.propertyIsEnumerable("toString"),De=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],Me=function(){return arguments.propertyIsEnumerable("length")}(),Ne=function(e,t){for(var r=0;e.length>r;){if(e[r]===t)return!0;r+=1}return!1},Ge=xe("function"!=typeof Object.keys||Me?function(e){if(Object(e)!==e)return[];var t,r,n=[],o=Me&&Se(e);for(t in e)!Te(t,e)||o&&"length"===t||(n[n.length]=t);if(Ue)for(r=De.length-1;r>=0;)Te(t=De[r],e)&&!Ne(n,t)&&(n[n.length]=t),r-=1;return n}:function(e){return Object(e)!==e?[]:Object.keys(e)}),Qe=xe(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}),ze=x,$e=Ce(function(e,t){return ze(e,t,[],[])}),Ye=function(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,n){return t.apply(this,arguments)};case 4:return function(e,r,n,o){return t.apply(this,arguments)};case 5:return function(e,r,n,o,i){return t.apply(this,arguments)};case 6:return function(e,r,n,o,i,u){return t.apply(this,arguments)};case 7:return function(e,r,n,o,i,u,s){return t.apply(this,arguments)};case 8:return function(e,r,n,o,i,u,s,a){return t.apply(this,arguments)};case 9:return function(e,r,n,o,i,u,s,a,c){return t.apply(this,arguments)};case 10:return function(e,r,n,o,i,u,s,a,c,f){return t.apply(this,arguments)};default:throw Error("First argument to _arity must be a non-negative integer no greater than ten")}},We=function(e,t){return function(){return t.call(this,e.apply(this,arguments))}},He=function(e){return function t(r,n,o){switch(arguments.length){case 0:return t;case 1:return Ee(r)?t:Ce(function(t,n){return e(r,t,n)});case 2:return Ee(r)&&Ee(n)?t:Ee(r)?Ce(function(t,r){return e(t,n,r)}):Ee(n)?Ce(function(t,n){return e(r,t,n)}):xe(function(t){return e(r,n,t)});default:return Ee(r)&&Ee(n)&&Ee(o)?t:Ee(r)&&Ee(n)?Ce(function(t,r){return e(t,r,o)}):Ee(r)&&Ee(o)?Ce(function(t,r){return e(t,n,r)}):Ee(n)&&Ee(o)?Ce(function(t,n){return e(r,t,n)}):Ee(r)?xe(function(t){return e(t,n,o)}):Ee(n)?xe(function(t){return e(r,t,o)}):Ee(o)?xe(function(t){return e(r,n,t)}):e(r,n,o)}}},Je=xe(function(e){return!!ke(e)||!!e&&("object"==typeof e&&(!Ie(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))}),Ke=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}(),Ve=function(e){return new Ke(e)},Xe=Ce(function(e,t){return Ye(e.length,function(){return e.apply(t,arguments)})}),Ze="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator",et=function(e,t,r){if("function"==typeof e&&(e=Ve(e)),Je(r))return function(e,t,r){for(var n=0,o=r.length;o>n;){if((t=e["@@transducer/step"](t,r[n]))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}n+=1}return e["@@transducer/result"](t)}(e,t,r);if("function"==typeof r["fantasy-land/reduce"])return A(e,t,r,"fantasy-land/reduce");if(null!=r[Ze])return j(e,t,r[Ze]());if("function"==typeof r.next)return j(e,t,r);if("function"==typeof r.reduce)return A(e,t,r,"reduce");throw new TypeError("reduce: list must be array or iterable")},tt=He(et),rt=function(e,t){return function(){var r=arguments.length;if(0===r)return t();var n=arguments[r-1];return ke(n)||"function"!=typeof n[e]?t.apply(this,arguments):n[e].apply(n,Array.prototype.slice.call(arguments,0,r-1))}},nt=xe(rt("tail",He(rt("slice",function(e,t,r){return Array.prototype.slice.call(r,e,t)}))(1,1/0))),ot=function(){if(0===arguments.length)throw Error("pipe requires at least one argument");return Ye(arguments[0].length,tt(We,arguments[0],nt(arguments)))},it=xe(function(e){return Ie(e)?e.split("").reverse().join(""):Array.prototype.slice.call(e,0).reverse()}),ut=function(){if(0===arguments.length)throw Error("compose requires at least one argument");return ot.apply(this,it(arguments))},st=function(e){return function(){return!e.apply(this,arguments)}},at=function(e){return"function"==typeof e["@@transducer/step"]},ct=function(e,t,r){return function(){if(0===arguments.length)return r();var n=Array.prototype.slice.call(arguments,0),o=n.pop();if(!ke(o)){for(var i=0;e.length>i;){if("function"==typeof o[e[i]])return o[e[i]].apply(o,n);i+=1}if(at(o))return t.apply(null,n)(o)}return r.apply(this,arguments)}},ft=function(e,t){for(var r=0,n=t.length,o=[];n>r;)e(t[r])&&(o[o.length]=t[r]),r+=1;return o},lt=function(){return this.xf["@@transducer/init"]()},ht=function(e){return this.xf["@@transducer/result"](e)},pt=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=lt,e.prototype["@@transducer/result"]=ht,e.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},e}(),yt=Ce(ct(["filter"],Ce(function(e,t){return new pt(e,t)}),function(e,t){return Le(t)?et(function(r,n){return e(t[n])&&(r[n]=t[n]),r},{},Ge(t)):ft(e,t)})),dt=Ce(function(e,t){return yt(st(e),t)}),vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bt=function(e){return ut($e(e),Qe)},mt=bt("Array"),wt=bt("Object"),gt=function(e,t){Ae(!je(e),'The "'+t+"\" collection does not exist. You can create one using your clerk instance by running(clerk.addCollection('"+t+"'))"),Ae("object"===(void 0===e?"undefined":vt(e)),'"'+t+'" is not a collection. You can access it like any other property on the state object')},Ot=dt(bt("Undefined")),_t=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Et=function(e){return T()},xt=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},jt=function(e){return P()},At=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Tt=function(e){return S()},Pt="function"==typeof Object.assign?Object.assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),r=1,n=arguments.length;n>r;){var o=arguments[r];if(null!=o)for(var i in o)Te(i,o)&&(t[i]=o[i]);r+=1}return t},St=Ce(function(e,t){return Pt({},e,t)}),kt=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lt=function(e){return k()},It=Ce(function(e,t){for(var r={},n={},o=0,i=e.length;i>o;)n[e[o]]=1,o+=1;for(var u in t)n.hasOwnProperty(u)||(r[u]=t[u]);return r}),Ct=function(e){return L()},Ft=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.state=t,this.get=Et(t).bind(t),this.post=jt(t).bind(t),this.put=Tt(t).bind(t),this.patch=Lt(t).bind(t),this.delete=Ct(t).bind(t)}return e.prototype.getCollection=function(e){return this.state[e]},e.prototype.addCollection=function(e){return this.state[e]=new(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object),this.state[e]},e.prototype.removeCollection=function(e){var t=this.state[e];return null!=t&&delete this.state[e],t},e}(),qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rt=function(e){if("function"==typeof Symbol){if(Symbol.asyncIterator){var t=e[Symbol.asyncIterator];if(null!=t)return t.call(e)}if(Symbol.iterator)return e[Symbol.iterator]()}throw new TypeError("Object is not async iterable")},Bt=(function(){function e(e){this.value=e}function t(t){function r(o,i){try{var u=t[o](i),s=u.value;s instanceof e?Promise.resolve(s.value).then(function(e){r("next",e)},function(e){r("throw",e)}):n(u.done?"return":"normal",u.value)}catch(e){n("throw",e)}}function n(e,t){switch(e){case"return":o.resolve({value:t,done:!0});break;case"throw":o.reject(t);break;default:o.resolve({value:t,done:!1})}(o=o.next)?r(o.key,o.arg):i=null}var o,i;this._invoke=function(e,t){return new Promise(function(n,u){var s={key:e,arg:t,resolve:n,reject:u,next:null};i?i=i.next=s:(o=i=s,r(e,t))})},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,r){function n(o,i){try{var u=t[o](i),s=u.value}catch(e){return void r(e)}if(!u.done)return Promise.resolve(s).then(function(e){n("next",e)},function(e){n("throw",e)});e(s)}return n("next")})}}),Ut=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Dt=function(e,t){var r={};for(var n in e)0>t.indexOf(n)&&Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},Mt=n(function(e,t){!function(e,t){function r(e){return"function"==typeof Symbol&&!!Symbol[e]}function n(e){return r(e)?Symbol[e]:"@@"+e}function o(e,t){var r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function i(e){var t=e.constructor;return void 0!==t&&null===(t=t[n("species")])&&(t=void 0),void 0!==t?t:l}function u(e,t){Object.keys(t).forEach(function(r){var n=Object.getOwnPropertyDescriptor(t,r);n.enumerable=!1,Object.defineProperty(e,r,n)})}function s(e){var t=e._cleanup;t&&(e._cleanup=void 0,t())}function a(e){return void 0===e._observer}function c(e,t){if(Object(e)!==e)throw new TypeError("Observer must be an object");this._cleanup=void 0,this._observer=e;var r=o(e,"start");if(r&&r.call(e,this),!a(this)){e=new f(this);try{var n=t.call(void 0,e);if(null!=n){if("function"==typeof n.unsubscribe)n=function(e){return function(){e.unsubscribe()}}(n);else if("function"!=typeof n)throw new TypeError(n+" is not a function");this._cleanup=n}}catch(t){return void e.error(t)}a(this)&&s(this)}}function f(e){this._subscription=e}function l(e){if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}"function"!=typeof Symbol||Symbol.observable||(Symbol.observable=Symbol("observable"));u(c.prototype={},{get closed(){return a(this)},unsubscribe:function(){!function(e){if(a(e))return;e._observer=void 0,s(e)}(this)}});u(f.prototype={},{get closed(){return a(this._subscription)},next:function(e){var t=this._subscription;if(!a(t)){var r=t._observer,n=o(r,"next");if(n)return n.call(r,e)}},error:function(e){var t=this._subscription;if(a(t))throw e;var r=t._observer;t._observer=void 0;try{var n=o(r,"error");if(!n)throw e;e=n.call(r,e)}catch(e){try{s(t)}finally{throw e}}return s(t),e},complete:function(e){var t=this._subscription;if(!a(t)){var r=t._observer;t._observer=void 0;try{var n=o(r,"complete");e=n?n.call(r,e):void 0}catch(e){try{s(t)}finally{throw e}}return s(t),e}}});u(l.prototype,{subscribe:function(e){for(var t=[],r=1;arguments.length>r;++r)t.push(arguments[r]);return"function"==typeof e&&(e={next:e,error:t[0],complete:t[1]}),new c(e,this._subscriber)},forEach:function(e){var t=this;return new Promise(function(r,n){if("function"!=typeof e)return Promise.reject(new TypeError(e+" is not a function"));t.subscribe({_subscription:null,start:function(e){if(Object(e)!==e)throw new TypeError(e+" is not an object");this._subscription=e},next:function(t){var r=this._subscription;if(!r.closed)try{return e(t)}catch(e){n(e),r.unsubscribe()}},error:n,complete:r})})},map:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this);return new r(function(r){return t.subscribe({next:function(t){if(!r.closed){try{t=e(t)}catch(e){return r.error(e)}return r.next(t)}},error:function(e){return r.error(e)},complete:function(e){return r.complete(e)}})})},filter:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this);return new r(function(r){return t.subscribe({next:function(t){if(!r.closed){try{if(!e(t))return}catch(e){return r.error(e)}return r.next(t)}},error:function(e){return r.error(e)},complete:function(){return r.complete()}})})},reduce:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this),n=arguments.length>1,o=!1,u=arguments[1],s=u;return new r(function(r){return t.subscribe({next:function(t){if(!r.closed){var i=!o;if(o=!0,!i||n)try{s=e(s,t)}catch(e){return r.error(e)}else s=t}},error:function(e){r.error(e)},complete:function(){o||n?(r.next(s),r.complete()):r.error(new TypeError("Cannot reduce an empty sequence"))}})})},flatMap:function(e){var t=this;if("function"!=typeof e)throw new TypeError(e+" is not a function");var r=i(this);return new r(function(r){function n(){o&&0===i.length&&r.complete()}var o=!1,i=[],u=t.subscribe({next:function(t){if(e)try{t=e(t)}catch(e){return void r.error(e)}l.from(t).subscribe({_subscription:null,start:function(e){i.push(this._subscription=e)},next:function(e){r.next(e)},error:function(e){r.error(e)},complete:function(){var e=i.indexOf(this._subscription);0>e||i.splice(e,1),n()}})},error:function(e){return r.error(e)},complete:function(){o=!0,n()}});return function(){i.forEach(function(e){return e.unsubscribe()}),u.unsubscribe()}})}}),Object.defineProperty(l.prototype,n("observable"),{value:function(){return this},writable:!0,configurable:!0}),u(l,{from:function(e){var t="function"==typeof this?this:l;if(null==e)throw new TypeError(e+" is not an object");var i=o(e,n("observable"));if(i){var u=i.call(e);if(Object(u)!==u)throw new TypeError(u+" is not an object");return u.constructor===t?u:new t(function(e){return u.subscribe(e)})}if(r("iterator")&&(i=o(e,n("iterator"))))return new t(function(t){for(var r,n=i.call(e)[Symbol.iterator]();!(r=n.next()).done;){var o=r.value;if(t.next(o),t.closed)return}t.complete()});if(Array.isArray(e))return new t(function(t){for(var r=0;e.length>r;++r)if(t.next(e[r]),t.closed)return;t.complete()});throw new TypeError(e+" is not observable")},of:function(){for(var e=[],t=0;arguments.length>t;++t)e.push(arguments[t]);var r="function"==typeof this?this:l;return new r(function(t){for(var r=0;e.length>r;++r)if(t.next(e[r]),t.closed)return;t.complete()})}}),Object.defineProperty(l,n("species"),{get:function(){return this},configurable:!0}),e.Observable=l}(t)}).Observable,Nt='You cannot extend the context with an object containing a "store" prop. It will be omitted and the other props will be added',Gt=function(e){return'The "'+e+"\" property already exists in the context object. Make sure you haven't replaced anything important"},Qt={},zt=' The "graphql" method is deprecated and will be removed in the 1.0 release. Use the "fetch" method instead.',$t='The "createStore" method is deprecated and will be removed in the 1.0 release. Use "new BlipsClient(...)" instead',Yt='You are trying to use "BlipsClient.fetch" without it being configured.',Wt="No subscription operation defined in query",Ht="Only one subscription operation is allowed per query",Jt=function(){return"The fetch "+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"middleware/afterware")+" must be a function or an array of functions"};e.BlipsClient=z,e.createStore=function(){Qt[$t]||(console.warn($t),Qt[$t]=!0);for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return new(Function.prototype.bind.apply(z,[null].concat(t)))},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=blips.min.js.map |
@@ -11,3 +11,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
import { isEmpty, when, isType, toObservable, extendContext, getDocument, promiseBatch, getOperationType, validateWithoutSchema } from './utils'; | ||
import { isEmpty, when, isType, toObservable, extendContext, getDocument, promiseBatch, validateWithoutSchema } from './utils'; | ||
@@ -123,4 +123,8 @@ var loggedWarnings = {}; | ||
var executableOperations = document.definitions.filter(function (definition) { | ||
return definition.operation === operationType; | ||
}); | ||
// If there's just one operation definition of the correct type execute it | ||
if (document.definitions.length === 1 && getOperationType(document.definitions[0]) === operationType) { | ||
if (executableOperations.length === 1) { | ||
return _executor(document, options, operationName, resolveFn); | ||
@@ -130,8 +134,4 @@ } | ||
// otherwise: | ||
var executableOperations = document.definitions.filter(function (definition) { | ||
return definition.operation === operationType; | ||
}); | ||
return promiseBatch(executableOperations.map(function (operation) { | ||
return _executor(operationType)(operation, options, operation.name.value, resolveFn); | ||
return _executor(document, options, operation.name.value, resolveFn); | ||
})); | ||
@@ -138,0 +138,0 @@ }; |
@@ -138,4 +138,8 @@ 'use strict'; | ||
var executableOperations = document.definitions.filter(function (definition) { | ||
return definition.operation === operationType; | ||
}); | ||
// If there's just one operation definition of the correct type execute it | ||
if (document.definitions.length === 1 && (0, _utils.getOperationType)(document.definitions[0]) === operationType) { | ||
if (executableOperations.length === 1) { | ||
return _executor(document, options, operationName, resolveFn); | ||
@@ -145,8 +149,4 @@ } | ||
// otherwise: | ||
var executableOperations = document.definitions.filter(function (definition) { | ||
return definition.operation === operationType; | ||
}); | ||
return (0, _utils.promiseBatch)(executableOperations.map(function (operation) { | ||
return _executor(operationType)(operation, options, operation.name.value, resolveFn); | ||
return _executor(document, options, operation.name.value, resolveFn); | ||
})); | ||
@@ -153,0 +153,0 @@ }; |
{ | ||
"name": "blips", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "State management for the GraphQL heads", | ||
@@ -23,2 +23,3 @@ "repository": { | ||
"dependencies": { | ||
"apollo-fetch": "0.6.0", | ||
"graphql-subscriptions": "0.5.4", | ||
@@ -31,3 +32,2 @@ "graphql-tools": "2.5.1", | ||
"devDependencies": { | ||
"apollo-fetch": "0.6.0", | ||
"babel-cli": "6.26.0", | ||
@@ -70,4 +70,3 @@ "babel-eslint": "8.0.1", | ||
"peerDependencies": { | ||
"graphql": "^0.11.7", | ||
"apollo-fetch": "^0.6.0" | ||
"graphql": "^0.11.7" | ||
}, | ||
@@ -74,0 +73,0 @@ "scripts": { |
@@ -7,3 +7,3 @@ # <a href='https://github.com/monojack/blips'> | ||
State container for JavaScript applications | ||
Client for managing application state with GraphQL operations. | ||
@@ -20,3 +20,3 @@ [![Build Status](https://travis-ci.org/monojack/blips.svg?branch=master)](https://travis-ci.org/monojack/blips) | ||
* [installation](#installation) | ||
* [creating the store](#creating-the-store) | ||
* [the client instance](#the-client-instance) | ||
* [operations and execution](#operations-and-execution) | ||
@@ -32,7 +32,8 @@ * [subscriptions](#subscriptions) | ||
**Blips** exposes a simple, GraphQL-like API for managing your application | ||
state, which is contained inside a single _store_. | ||
**Blips** exposes a simple interface for managing your application state with | ||
GraphQL. | ||
The store can only be changed through **_mutations_**, you can read from it | ||
through **_queries_** and can also listen for changes with **_subscriptions_**. | ||
The state is contained inside a single _store_ object. It can only be changed | ||
through **_mutations_**, you can read from it through **_queries_** and can also | ||
listen for changes with **_subscriptions_**. | ||
@@ -56,10 +57,12 @@ ## The why? | ||
```bash | ||
npm install blips | ||
npm install blips graphql | ||
``` | ||
### Creating the store | ||
### The client instance | ||
Creating a client requires type definitions, resolvers and an optional object | ||
containing the initial state. | ||
> new BlipsClient({ typeDefs [, resolvers] } [, initialState] [, config] ) | ||
Creating a client requires type definitions, optional resolvers, optional | ||
initial state and an optional configuration object. | ||
##### typeDefs | ||
@@ -153,3 +156,3 @@ | ||
// new BlipsClient({ typeDefs [, resolvers] } [, initialState] [, options] ) | ||
// new BlipsClient({ typeDefs [, resolvers] } [, initialState] [, config] ) | ||
const client = new BlipsClient(schemaDef, initialState) | ||
@@ -169,4 +172,2 @@ ``` | ||
* `schema`: getter for your generated schema. | ||
* `store`: provides access to the state object and a couple of CRUD methods for | ||
managing it, provided through | ||
[state-clerk](https://github.com/monojack/state-clerk). | ||
@@ -337,5 +338,5 @@ * `query`: method for executing queries. | ||
In order to use subscriptions with **Blips**, you need to have access to the | ||
store's `PubSub` instance. We can achieve that by passing a `resolvers` function | ||
instead of an object when creating the client instance. This function accepts as | ||
first argument an object containing the `PubSub` instance and the | ||
client's `PubSub` instance. We can achieve that by passing a `resolvers` | ||
function instead of an object when creating the client instance. This function | ||
accepts as first argument an object containing the `PubSub` instance and the | ||
[`withFilter`](https://github.com/apollographql/graphql-subscriptions#filters) | ||
@@ -342,0 +343,0 @@ method. |
@@ -15,3 +15,2 @@ import { GraphQLError, execute, subscribe, validate, } from 'graphql' | ||
promiseBatch, | ||
getOperationType, | ||
validateWithoutSchema, | ||
@@ -106,7 +105,8 @@ } from './utils' | ||
const executableOperations = document.definitions.filter( | ||
definition => definition.operation === operationType | ||
) | ||
// If there's just one operation definition of the correct type execute it | ||
if ( | ||
document.definitions.length === 1 && | ||
getOperationType(document.definitions[0]) === operationType | ||
) { | ||
if (executableOperations.length === 1) { | ||
return _executor(document, options, operationName, resolveFn) | ||
@@ -116,15 +116,6 @@ } | ||
// otherwise: | ||
const executableOperations = document.definitions.filter( | ||
definition => definition.operation === operationType | ||
) | ||
return promiseBatch( | ||
executableOperations.map(operation => | ||
_executor(operationType)( | ||
operation, | ||
options, | ||
operation.name.value, | ||
resolveFn | ||
) | ||
) | ||
executableOperations.map(operation => { | ||
return _executor(document, options, operation.name.value, resolveFn) | ||
}) | ||
) | ||
@@ -131,0 +122,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
900440
30
8088
669
18
+ Addedapollo-fetch@0.6.0