From 2745e3d301010722bf83cbd027e3c70c497da67d Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:03:48 +0200 Subject: [PATCH 01/22] Apollo 2 support --- src/apollo-provider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apollo-provider.js b/src/apollo-provider.js index 7f01887..5fe7f6c 100644 --- a/src/apollo-provider.js +++ b/src/apollo-provider.js @@ -147,7 +147,7 @@ export class ApolloProvider { const states = {} for (const key in this.clients) { const client = this.clients[key] - const state = { [client.reduxRootKey || 'apollo']: client.getInitialState() } + const state = client.cache.extract() states[`${finalOptions.exportNamespace}${key}`] = state } return states From 6ebaa13fe35bee54d67db9d7171ae4a59813b4a5 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:04:04 +0200 Subject: [PATCH 02/22] Apollo 2 docs update --- README.md | 120 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 70 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 26644a8..6003ee7 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,14 @@ # Apollo and GraphQL for Vue.js [![npm](https://img.shields.io/npm/v/vue-apollo.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) -[![vue1](https://img.shields.io/badge/apollo-1.x-blue.svg)](http://apollodata.com/) +[![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) ![schema](https://cdn-images-1.medium.com/max/800/1*H9AANoofLqjS10Xd5TwRYw.png) -Integrates [apollo](http://www.apollostack.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/) +**Warning! This README is related to the next version of vue-apollo. For the stable release, see [here](https://github.com/Akryum/vue-apollo/tree/master).** + +Integrates [apollo](http://www.apollodata.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/) [icon More vue-apollo examples](https://github.com/Akryum/vue-apollo-example) @@ -50,20 +52,26 @@ Integrates [apollo](http://www.apollostack.com/) in your [Vue](http://vuejs.org) Try and install these packages before server side set (of packages), add apollo to meteor.js before then, too. - npm install --save vue-apollo apollo-client + npm install --save vue-apollo@next graphql apollo-client apollo-link apollo-link-http apollo-cache-inmemory graphql-tag In your app, create an `ApolloClient` instance and install the `VueApollo` plugin: ```javascript import Vue from 'vue' -import { ApolloClient, createBatchingNetworkInterface } from 'apollo-client' +import { ApolloClient } from 'apollo-client' +import { HttpLink } from 'apollo-link-http' +import { InMemoryCache } from 'apollo-cache-inmemory' import VueApollo from 'vue-apollo' +const httpLink = new HttpLink({ + // You should use an absolute URL here + uri: 'http://localhost:3020/graphql', +}) + // Create the apollo client const apolloClient = new ApolloClient({ - networkInterface: createBatchingNetworkInterface({ - uri: 'http://localhost:3020/graphql', - }), + link: httpLink, + cache: new InMemoryCache(), connectToDevTools: true, }) @@ -684,50 +692,57 @@ export const resolvers = { To make enable the websocket-based subscription, a bit of additional setup is required: +``` +npm install --save apollo-link-ws apollo-utilities +``` + ```javascript import Vue from 'vue' -import { ApolloClient, createNetworkInterface } from 'apollo-client' +import { ApolloClient } from 'apollo-client' +import { HttpLink } from 'apollo-link-http' +import { InMemoryCache } from 'apollo-cache-inmemory' // New Imports -import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws' +import { split } from 'apollo-link' +import { WebSocketLink } from 'apollo-link-ws' +import { getMainDefinition } from 'apollo-utilities' + import VueApollo from 'vue-apollo' -// Create the network interface -const networkInterface = createNetworkInterface({ - uri: 'http://localhost:3000/graphql', - transportBatching: true, +const httpLink = new HttpLink({ + // You should use an absolute URL here + uri: 'http://localhost:3020/graphql', }) -// Create the subscription websocket client -const wsClient = new SubscriptionClient('ws://localhost:3000/subscriptions', { - reconnect: true, +// Create the subscription websocket link +const wsLink = new WebSocketLink({ + uri: 'ws://localhost:3000/subscriptions', + options: { + reconnect: true, + }, }) -// Extend the network interface with the subscription client -const networkInterfaceWithSubscriptions = addGraphQLSubscriptions( - networkInterface, - wsClient, +// using the ability to split links, you can send data to each link +// depending on what kind of operation is being sent +const link = split( + // split based on operation type + ({ query }) => { + const { kind, operation } = getMainDefinition(query) + return kind === 'OperationDefinition' && + operation === 'subscription' + }, + wsLink, + httpLink ) -// Create the apollo client with the new network interface +// Create the apollo client const apolloClient = new ApolloClient({ - networkInterface: networkInterfaceWithSubscriptions, + link, + cache: new InMemoryCache(), connectToDevTools: true, }) -// Install the plugin like before -Vue.use(VueApollo, { - apolloClient, -}) - -// Your app is now subscription-ready! - -import App from './App.vue' - -new Vue({ - el: '#app', - render: h => h(App) -}) - +// Install the vue plugin like before +Vue.use(VueApollo) ``` ### subscribeToMore @@ -1346,7 +1361,9 @@ Here is an example: // src/api/apollo.js import Vue from 'vue' -import { ApolloClient, createNetworkInterface } from 'apollo-client' +import { ApolloClient } from 'apollo-client' +import { HttpLink } from 'apollo-link-http' +import { InMemoryCache } from 'apollo-cache-inmemory' import VueApollo from 'vue-apollo' // Install the vue plugin @@ -1354,29 +1371,32 @@ Vue.use(VueApollo) // Create the apollo client export function createApolloClient (ssr = false) { - let initialState + const httpLink = new HttpLink({ + // You should use an absolute URL here + uri: ENDPOINT + '/graphql', + }) + + const cache = new InMemoryCache() // If on the client, recover the injected state - if (!ssr && typeof window !== 'undefined') { - const state = window.__APOLLO_STATE__ - if (state) { - // If you have multiple clients, use `state.` - initialState = state.defaultClient + if (!ssr) { + // If on the client, recover the injected state + if (typeof window !== 'undefined') { + const state = window.__APOLLO_STATE__ + if (state) { + // If you have multiple clients, use `state.` + cache.restore(state.defaultClient) + } } } const apolloClient = new ApolloClient({ - networkInterface: createNetworkInterface({ - // You should use an absolute URL here - uri: 'https://api.graph.cool/simple/v1/cj1jvw20v3n310152sv0sirl7', - transportBatching: true, - }), + link: httpLink, + cache, ...(ssr ? { // Set this on the server to optimize queries when SSR ssrMode: true, } : { - // Inject the state on the client - initialState, // This will temporary disable query force-fetching ssrForceFetchDelay: 100, }), From e32a5aff5ce797b22031a997b2285c28c79051df Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:04:10 +0200 Subject: [PATCH 03/22] Version bump --- dist/vue-apollo.esm.js | 15 +-------------- dist/vue-apollo.min.js | 2 +- dist/vue-apollo.umd.js | 15 +-------------- package.json | 4 ++-- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js index f078d01..b3be2d6 100644 --- a/dist/vue-apollo.esm.js +++ b/dist/vue-apollo.esm.js @@ -2380,20 +2380,7 @@ var createClass = function () { -var defineProperty = function (obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -}; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { @@ -3376,7 +3363,7 @@ var ApolloProvider$1 = function () { var states = {}; for (var key in this.clients) { var client = this.clients[key]; - var state = defineProperty({}, client.reduxRootKey || 'apollo', client.getInitialState()); + var state = client.cache.extract(); states['' + finalOptions.exportNamespace + key] = state; } return states; diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js index dd499e8..b7ea4ed 100644 --- a/dist/vue-apollo.min.js +++ b/dist/vue-apollo.min.js @@ -1 +1 @@ -!function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){var r=t?t.length:0;return!!r&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i-1}function S(t,e){var r=this.__data__,i=V(r,t);return i<0?r.push([t,e]):r[i][1]=e,this}function A(t){var e=-1,r=t?t.length:0;for(this.clear();++e=Qt&&(u=h,l=!1,e=new T(e));t:for(;++a0&&r(u)?e>1?R(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function D(t,e,r){var i=e(t);return fe(t)?i:o(i,r(t))}function N(t){if(!lt(t)||Y(t))return!1;var e=at(t)||p(t)?te:Nt;return e.test(rt(t))}function I(t){if(!lt(t))return tt(t);var e=Z(t),r=[];for(var i in t)("constructor"!=i||!e&&Yt.call(t,i))&&r.push(i);return r}function F(t,e){return t=Object(t),H(t,e,function(e,r){return r in t})}function H(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=Mt}function lt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ct(t){return!!t&&"object"==typeof t}function ht(t){return"symbol"==typeof t||ct(t)&&Zt.call(t)==Rt}function ft(t){return ot(t)?C(t,!0):I(t)}function pt(){return[]}function vt(t,e,r){function i(e){var r=f,i=p;return f=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,d=setTimeout(a,e),_?i(t):y}function o(t){var r=t-b,i=t-g,n=e-r;return m?xe(n,v-i):n}function s(t){var r=t-b,i=t-g;return void 0===b||r>=e||r<0||m&&i>=v}function a(){var t=Ee();return s(t)?u(t):void(d=setTimeout(a,o(t)))}function u(t){return d=void 0,w&&f?i(t):(f=p=void 0,y)}function l(){void 0!==d&&clearTimeout(d),g=0,f=b=p=d=void 0}function c(){return void 0===d?y:u(Ee())}function h(){var t=Ee(),r=s(t);if(f=arguments,p=this,b=t,r){if(void 0===d)return n(b);if(m)return d=setTimeout(a,e),i(b)}return void 0===d&&(d=setTimeout(a,e)),y}var f,p,v,y,d,b,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(ye);return e=_t(e)||0,dt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?Pe(_t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),h.cancel=l,h.flush=c,h}function yt(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError(ye);return dt(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),vt(t,e,{leading:i,maxWait:e,trailing:n})}function dt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function bt(t){return!!t&&"object"==typeof t}function gt(t){return"symbol"==typeof t||bt(t)&&Ae.call(t)==be}function _t(t){if("number"==typeof t)return t;if(gt(t))return de;if(dt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=dt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ge,"");var r=me.test(t);return r||we.test(t)?ke(t.slice(2),r?2:8):_e.test(t)?de:+t}function mt(t,e,r){function i(e){var r=f,i=p;return f=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,d=setTimeout(a,e),_?i(t):y}function o(t){var r=t-b,i=t-g,n=e-r;return m?Ge(n,v-i):n}function s(t){var r=t-b,i=t-g;return void 0===b||r>=e||r<0||m&&i>=v}function a(){var t=Je();return s(t)?u(t):void(d=setTimeout(a,o(t)))}function u(t){return d=void 0,w&&f?i(t):(f=p=void 0,y)}function l(){void 0!==d&&clearTimeout(d),g=0,f=b=p=d=void 0}function c(){return void 0===d?y:u(Je())}function h(){var t=Je(),r=s(t);if(f=arguments,p=this,b=t,r){if(void 0===d)return n(b);if(m)return d=setTimeout(a,e),i(b)}return void 0===d&&(d=setTimeout(a,e)),y}var f,p,v,y,d,b,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(Qe);return e=jt(e)||0,wt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?We(jt(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),h.cancel=l,h.flush=c,h}function wt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function kt(t){return!!t&&"object"==typeof t}function Ot(t){return"symbol"==typeof t||kt(t)&&He.call(t)==qe}function jt(t){if("number"==typeof t)return t;if(Ot(t))return Te;if(wt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=wt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Me,"");var r=Ve.test(t);return r||Ke.test(t)?Re(t.slice(2),r?2:8):Ce.test(t)?Te:+t}function $t(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function St(t){return ze.Vue.util.mergeOptions({},t)}function At(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function Pt(t){return pr.push(t),t}function xt(t,e,r){"undefined"!=typeof r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function Et(t,e){if(!Et.installed){Et.installed=!0,ze.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},ve(t,vr),t.data),o=Object.assign({},ve(e,vr),e.data),s={},a=0;a3&&void 0!==arguments[3])||arguments[3];if(tr(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return er(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Be(e,this.options.throttle):e,e=this.options.debounce?Xe(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=ve(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];if(tr(this,e),!i.query){var o=i;i={query:o}}var s=sr(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return s.type="query",s.vueApolloSpecialKeys=Ye,s.loading=!1,s}return or(e,t),er(e,[{key:"stop",value:function(){nr(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)})),this.maySetLoading(),nr(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0)}},{key:"nextResult",value:function(t){var e=t.data,r=t.loading;r||this.loadingDone();var i="function"==typeof this.options.result;"undefined"==typeof e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?i||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),i&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){nr(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};fr.install=Et;var br=fr,gr=null;"undefined"!=typeof window?gr=window.Vue:"undefined"!=typeof global&&(gr=global.Vue),gr&&gr.use(fr),t.install=Et,t.ApolloProvider=br,t.default=fr,t.willPrefetch=Pt}(this.VueApollo=this.VueApollo||{}); +!function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){var r=t?t.length:0;return!!r&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i-1}function S(t,e){var r=this.__data__,i=V(r,t);return i<0?r.push([t,e]):r[i][1]=e,this}function A(t){var e=-1,r=t?t.length:0;for(this.clear();++e=Qt&&(u=h,l=!1,e=new T(e));t:for(;++a0&&r(u)?e>1?D(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function N(t,e,r){var i=e(t);return fe(t)?i:o(i,r(t))}function R(t){if(!lt(t)||Y(t))return!1;var e=at(t)||p(t)?te:Rt;return e.test(rt(t))}function F(t){if(!lt(t))return tt(t);var e=Z(t),r=[];for(var i in t)("constructor"!=i||!e&&Yt.call(t,i))&&r.push(i);return r}function I(t,e){return t=Object(t),H(t,e,function(e,r){return r in t})}function H(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=Mt}function lt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ct(t){return!!t&&"object"==typeof t}function ht(t){return"symbol"==typeof t||ct(t)&&Zt.call(t)==Dt}function ft(t){return ot(t)?C(t,!0):F(t)}function pt(){return[]}function vt(t,e,r){function i(e){var r=f,i=p;return f=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,d=setTimeout(a,e),_?i(t):y}function o(t){var r=t-b,i=t-g,n=e-r;return m?xe(n,v-i):n}function s(t){var r=t-b,i=t-g;return void 0===b||r>=e||r<0||m&&i>=v}function a(){var t=Ee();return s(t)?u(t):void(d=setTimeout(a,o(t)))}function u(t){return d=void 0,w&&f?i(t):(f=p=void 0,y)}function l(){void 0!==d&&clearTimeout(d),g=0,f=b=p=d=void 0}function c(){return void 0===d?y:u(Ee())}function h(){var t=Ee(),r=s(t);if(f=arguments,p=this,b=t,r){if(void 0===d)return n(b);if(m)return d=setTimeout(a,e),i(b)}return void 0===d&&(d=setTimeout(a,e)),y}var f,p,v,y,d,b,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(ye);return e=_t(e)||0,dt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?Pe(_t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),h.cancel=l,h.flush=c,h}function yt(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError(ye);return dt(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),vt(t,e,{leading:i,maxWait:e,trailing:n})}function dt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function bt(t){return!!t&&"object"==typeof t}function gt(t){return"symbol"==typeof t||bt(t)&&Ae.call(t)==be}function _t(t){if("number"==typeof t)return t;if(gt(t))return de;if(dt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=dt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ge,"");var r=me.test(t);return r||we.test(t)?ke(t.slice(2),r?2:8):_e.test(t)?de:+t}function mt(t,e,r){function i(e){var r=f,i=p;return f=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,d=setTimeout(a,e),_?i(t):y}function o(t){var r=t-b,i=t-g,n=e-r;return m?Ge(n,v-i):n}function s(t){var r=t-b,i=t-g;return void 0===b||r>=e||r<0||m&&i>=v}function a(){var t=Je();return s(t)?u(t):void(d=setTimeout(a,o(t)))}function u(t){return d=void 0,w&&f?i(t):(f=p=void 0,y)}function l(){void 0!==d&&clearTimeout(d),g=0,f=b=p=d=void 0}function c(){return void 0===d?y:u(Je())}function h(){var t=Je(),r=s(t);if(f=arguments,p=this,b=t,r){if(void 0===d)return n(b);if(m)return d=setTimeout(a,e),i(b)}return void 0===d&&(d=setTimeout(a,e)),y}var f,p,v,y,d,b,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(Qe);return e=$t(e)||0,wt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?We($t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),h.cancel=l,h.flush=c,h}function wt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function kt(t){return!!t&&"object"==typeof t}function Ot(t){return"symbol"==typeof t||kt(t)&&He.call(t)==qe}function $t(t){if("number"==typeof t)return t;if(Ot(t))return Te;if(wt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=wt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Me,"");var r=Ve.test(t);return r||Ke.test(t)?De(t.slice(2),r?2:8):Ce.test(t)?Te:+t}function jt(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function St(t){return ze.Vue.util.mergeOptions({},t)}function At(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function Pt(t){return fr.push(t),t}function xt(t,e,r){"undefined"!=typeof r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function Et(t,e){if(!Et.installed){Et.installed=!0,ze.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},ve(t,pr),t.data),o=Object.assign({},ve(e,pr),e.data),s={},a=0;a3&&void 0!==arguments[3])||arguments[3];if(tr(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return er(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Be(e,this.options.throttle):e,e=this.options.debounce?Xe(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=ve(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];if(tr(this,e),!i.query){var o=i;i={query:o}}var s=or(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return s.type="query",s.vueApolloSpecialKeys=Ye,s.loading=!1,s}return nr(e,t),er(e,[{key:"stop",value:function(){ir(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)})),this.maySetLoading(),ir(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0)}},{key:"nextResult",value:function(t){var e=t.data,r=t.loading;r||this.loadingDone();var i="function"==typeof this.options.result;"undefined"==typeof e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?i||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),i&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){ir(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};hr.install=Et;var dr=hr,br=null;"undefined"!=typeof window?br=window.Vue:"undefined"!=typeof global&&(br=global.Vue),br&&br.use(hr),t.install=Et,t.ApolloProvider=dr,t.default=hr,t.willPrefetch=Pt}(this.VueApollo=this.VueApollo||{}); diff --git a/dist/vue-apollo.umd.js b/dist/vue-apollo.umd.js index 11acbf4..84a73a7 100644 --- a/dist/vue-apollo.umd.js +++ b/dist/vue-apollo.umd.js @@ -2386,20 +2386,7 @@ var createClass = function () { -var defineProperty = function (obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -}; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { @@ -3382,7 +3369,7 @@ var ApolloProvider$1 = function () { var states = {}; for (var key in this.clients) { var client = this.clients[key]; - var state = defineProperty({}, client.reduxRootKey || 'apollo', client.getInitialState()); + var state = client.cache.extract(); states['' + finalOptions.exportNamespace + key] = state; } return states; diff --git a/package.json b/package.json index 120ec87..ccc8cb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-apollo", - "version": "2.1.0-rc.8", + "version": "3.0.0-alpha.1", "description": "Vue apollo integration", "main": "dist/vue-apollo.umd.js", "module": "dist/vue-apollo.esm.js", @@ -32,7 +32,7 @@ }, "homepage": "https://github.com/Akryum/vue-apollo#readme", "peerDependencies": { - "apollo-client": "^1.0.1" + "apollo-client": "^2.0.0" }, "dependencies": { "lodash.debounce": "^4.0.8", From c17f722b624935e4e5e25e711f30560444ad3ae4 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:18:41 +0200 Subject: [PATCH 04/22] Migration path --- README.md | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) diff --git a/README.md b/README.md index 6003ee7..2adacc3 100644 --- a/README.md +++ b/README.md @@ -1491,6 +1491,199 @@ router.onReady(() => { --- +# Migration + +## Migrating from vue-apollo 2.x and apollo 1.x + +The main changes are related to the apollo client setup. Your components code shouldn't be affected. Apollo now uses a more flexible [apollo-link](https://github.com/apollographql/apollo-link) system that allows compositing multiple links together to add more features (like batching, offline support and more). + +### Installation + +#### Packages + +**Before** + +``` +npm install --save vue-apollo apollo-client +``` + +**After** + +``` +npm install --save vue-apollo@next graphql apollo-client apollo-link apollo-link-http apollo-cache-inmemory graphql-tag +``` + +#### Imports + +**Before** + +```js +import Vue from 'vue' +import { ApolloClient, createBatchingNetworkInterface } from 'apollo-client' +import VueApollo from 'vue-apollo' +``` + +**After** + +```js +import Vue from 'vue' +import { ApolloClient } from 'apollo-client' +import { HttpLink } from 'apollo-link-http' +import { InMemoryCache } from 'apollo-cache-inmemory' +import VueApollo from 'vue-apollo' +``` + +#### Plugin Setup + +**Before** + +```js +// Create the apollo client +const apolloClient = new ApolloClient({ + networkInterface: createBatchingNetworkInterface({ + uri: 'http://localhost:3020/graphql', + }), + connectToDevTools: true, +}) + +// Install the vue plugin +Vue.use(VueApollo) +``` + +**After** + +```js +const httpLink = new HttpLink({ + // You should use an absolute URL here + uri: 'http://localhost:3020/graphql', +}) + +// Create the apollo client +const apolloClient = new ApolloClient({ + link: httpLink, + cache: new InMemoryCache(), + connectToDevTools: true, +}) + +// Install the vue plugin +Vue.use(VueApollo) +``` + +### Mutations + +Query reducers have been removed. Use the `update` API to update the cache now. + +### Subscriptions + +#### Packages + +**Before** + +``` +npm install --save subscriptions-transport-ws +``` + +**After** + +``` +npm install --save apollo-link-ws apollo-utilities +``` + +#### Imports + +**Before** + +```js +import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws' +``` + +**After** + +```js +import { split } from 'apollo-link' +import { WebSocketLink } from 'apollo-link-ws' +import { getMainDefinition } from 'apollo-utilities' +``` + +#### Apollo Setup + +**Before** + +```js +// Create the network interface +const networkInterface = createNetworkInterface({ + uri: 'http://localhost:3000/graphql', + transportBatching: true, +}) + +// Create the subscription websocket client +const wsClient = new SubscriptionClient('ws://localhost:3000/subscriptions', { + reconnect: true, +}) + +// Extend the network interface with the subscription client +const networkInterfaceWithSubscriptions = addGraphQLSubscriptions( + networkInterface, + wsClient, +) + +// Create the apollo client with the new network interface +const apolloClient = new ApolloClient({ + networkInterface: networkInterfaceWithSubscriptions, + connectToDevTools: true, +}) + +// Install the plugin like before +Vue.use(VueApollo) +``` + +**After** + +```js +const httpLink = new HttpLink({ + // You should use an absolute URL here + uri: 'http://localhost:3020/graphql', +}) + +// Create the subscription websocket link +const wsLink = new WebSocketLink({ + uri: 'ws://localhost:3000/subscriptions', + options: { + reconnect: true, + }, +}) + +// using the ability to split links, you can send data to each link +// depending on what kind of operation is being sent +const link = split( + // split based on operation type + ({ query }) => { + const { kind, operation } = getMainDefinition(query) + return kind === 'OperationDefinition' && + operation === 'subscription' + }, + wsLink, + httpLink +) + +// Create the apollo client +const apolloClient = new ApolloClient({ + link, + cache: new InMemoryCache(), + connectToDevTools: true, +}) + +// Install the vue plugin like before +Vue.use(VueApollo) +``` + + +
+ +Learn more at the [official apollo documentation](https://www.apollographql.com/docs/react/2.0-migration.html). + +--- + # API Reference WIP (PR welcome!) From bcba1f4180a39eadb85a5e62fba5a8ea11443984 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:20:14 +0200 Subject: [PATCH 05/22] Migration updates --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2adacc3..d2ff76a 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Integrates [apollo](http://www.apollodata.com/) in your [Vue](http://vuejs.org) - [Skip all](#skip-all) - [Multiple clients](#multiple-clients) - [Server-Side Rendering](#server-side-rendering) +- [Migration](#migration) - [API Reference](#api-reference) ## Installation @@ -1501,13 +1502,13 @@ The main changes are related to the apollo client setup. Your components code sh #### Packages -**Before** +Before: ``` npm install --save vue-apollo apollo-client ``` -**After** +After: ``` npm install --save vue-apollo@next graphql apollo-client apollo-link apollo-link-http apollo-cache-inmemory graphql-tag @@ -1515,7 +1516,7 @@ npm install --save vue-apollo@next graphql apollo-client apollo-link apollo-link #### Imports -**Before** +Before: ```js import Vue from 'vue' @@ -1523,7 +1524,7 @@ import { ApolloClient, createBatchingNetworkInterface } from 'apollo-client' import VueApollo from 'vue-apollo' ``` -**After** +After: ```js import Vue from 'vue' @@ -1535,7 +1536,7 @@ import VueApollo from 'vue-apollo' #### Plugin Setup -**Before** +Before: ```js // Create the apollo client @@ -1550,7 +1551,7 @@ const apolloClient = new ApolloClient({ Vue.use(VueApollo) ``` -**After** +After: ```js const httpLink = new HttpLink({ @@ -1577,13 +1578,13 @@ Query reducers have been removed. Use the `update` API to update the cache now. #### Packages -**Before** +Before: ``` npm install --save subscriptions-transport-ws ``` -**After** +After: ``` npm install --save apollo-link-ws apollo-utilities @@ -1591,13 +1592,13 @@ npm install --save apollo-link-ws apollo-utilities #### Imports -**Before** +Before: ```js import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws' ``` -**After** +After: ```js import { split } from 'apollo-link' @@ -1607,7 +1608,7 @@ import { getMainDefinition } from 'apollo-utilities' #### Apollo Setup -**Before** +Before: ```js // Create the network interface @@ -1637,7 +1638,7 @@ const apolloClient = new ApolloClient({ Vue.use(VueApollo) ``` -**After** +After: ```js const httpLink = new HttpLink({ From 6ef0777646e90048cfeb6a1b8f13ec9a118eb996 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:24:55 +0200 Subject: [PATCH 06/22] Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2ff76a..018d3ad 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Apollo and GraphQL for Vue.js -[![npm](https://img.shields.io/npm/v/vue-apollo.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) +[![npm](https://img.shields.io/badge/vue-apollo-next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) From 66d48ce029b1dc620b0feef725115a55215fc8b6 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:25:50 +0200 Subject: [PATCH 07/22] Badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 018d3ad..1579cfc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Apollo and GraphQL for Vue.js -[![npm](https://img.shields.io/badge/vue-apollo-next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) +[![npm](https://img.shields.io/badge/v-next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) From 7ade0c8f4d5ac9f2461985111db8aac5412b684e Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sat, 28 Oct 2017 16:27:26 +0200 Subject: [PATCH 08/22] Badge fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1579cfc..e2a9904 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Apollo and GraphQL for Vue.js -[![npm](https://img.shields.io/badge/v-next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) +[![npm](https://img.shields.io/badge/v-next-blue.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) From 185104a3794e27c919dd772cabbd34c7991f7b27 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Wed, 1 Nov 2017 16:32:52 +0100 Subject: [PATCH 09/22] Update build config --- .babelrc | 10 +- .eslintignore | 2 + build/rollup.config.base.js | 27 + .../rollup.config.browser.js | 10 +- .../rollup.config.es.js | 6 +- .../rollup.config.umd.js | 6 +- dist/vue-apollo.esm.js | 117 +- dist/vue-apollo.min.js | 2 +- dist/vue-apollo.umd.js | 116 +- package.json | 31 +- rollup.config.base.js | 23 - src/index.js | 3 + yarn.lock | 1479 ++++++++++------- 13 files changed, 1145 insertions(+), 687 deletions(-) create mode 100644 .eslintignore create mode 100644 build/rollup.config.base.js rename rollup.config.browser.js => build/rollup.config.browser.js (59%) rename rollup.config.es.js => build/rollup.config.es.js (60%) rename rollup.config.umd.js => build/rollup.config.umd.js (60%) delete mode 100644 rollup.config.base.js diff --git a/.babelrc b/.babelrc index 3678052..deaf78e 100644 --- a/.babelrc +++ b/.babelrc @@ -1,11 +1,9 @@ { "presets": [ - [ - "es2015", - { - "modules": false - } - ], + ["env", { "modules": false }], "stage-0" + ], + "plugins": [ + "external-helpers" ] } diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..b947077 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules/ +dist/ diff --git a/build/rollup.config.base.js b/build/rollup.config.base.js new file mode 100644 index 0000000..f4e3460 --- /dev/null +++ b/build/rollup.config.base.js @@ -0,0 +1,27 @@ +import babel from 'rollup-plugin-babel' +import cjs from 'rollup-plugin-commonjs' +import replace from 'rollup-plugin-replace' +import resolve from 'rollup-plugin-node-resolve' + +const config = require('../package.json') + +export default { + input: 'src/index.js', + name: 'vue-apollo', + plugins: [ + resolve({ + jsnext: true, + main: true, + browser: true, + }), + cjs({ + exclude: 'src/**', + }), + babel({ + exclude: 'node_modules/**', + }), + replace({ + VERSION: JSON.stringify(config.version), + }), + ], +} diff --git a/rollup.config.browser.js b/build/rollup.config.browser.js similarity index 59% rename from rollup.config.browser.js rename to build/rollup.config.browser.js index baae637..21abb07 100644 --- a/rollup.config.browser.js +++ b/build/rollup.config.browser.js @@ -1,11 +1,13 @@ import base from './rollup.config.base' import uglify from 'rollup-plugin-uglify' -import { minify } from 'uglify-js-harmony' +import { minify } from 'uglify-es' const config = Object.assign({}, base, { - dest: 'dist/vue-apollo.min.js', - format: 'iife', - moduleName: 'VueApollo', + output: { + file: 'dist/vue-apollo.min.js', + format: 'iife', + }, + name: 'VueApollo', }) config.plugins.push(uglify({}, minify)) diff --git a/rollup.config.es.js b/build/rollup.config.es.js similarity index 60% rename from rollup.config.es.js rename to build/rollup.config.es.js index 3c49df3..2971298 100644 --- a/rollup.config.es.js +++ b/build/rollup.config.es.js @@ -1,8 +1,10 @@ import base from './rollup.config.base' const config = Object.assign({}, base, { - dest: 'dist/vue-apollo.esm.js', - format: 'es', + output: { + file: 'dist/vue-apollo.esm.js', + format: 'es', + }, }) export default config diff --git a/rollup.config.umd.js b/build/rollup.config.umd.js similarity index 60% rename from rollup.config.umd.js rename to build/rollup.config.umd.js index ddfc9b7..46375c9 100644 --- a/rollup.config.umd.js +++ b/build/rollup.config.umd.js @@ -1,8 +1,10 @@ import base from './rollup.config.base' const config = Object.assign({}, base, { - dest: 'dist/vue-apollo.umd.js', - format: 'umd', + output: { + file: 'dist/vue-apollo.umd.js', + format: 'umd', + }, }) export default config diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js index b3be2d6..85cd0ce 100644 --- a/dist/vue-apollo.esm.js +++ b/dist/vue-apollo.esm.js @@ -2346,7 +2346,118 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol +var asyncGenerator = function () { + function AwaitValue(value) { + this.value = value; + } + function AsyncGenerator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function (resolve, reject) { + var request = { + key: key, + arg: arg, + resolve: resolve, + reject: reject, + next: null + }; + + if (back) { + back = back.next = request; + } else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + + if (value instanceof AwaitValue) { + Promise.resolve(value.value).then(function (arg) { + resume("next", arg); + }, function (arg) { + resume("throw", arg); + }); + } else { + settle(result.done ? "return" : "normal", result.value); + } + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ + value: value, + done: true + }); + break; + + case "throw": + front.reject(value); + break; + + default: + front.resolve({ + value: value, + done: false + }); + break; + } + + front = front.next; + + if (front) { + resume(front.key, front.arg); + } else { + back = null; + } + } + + this._invoke = send; + + if (typeof gen.return !== "function") { + this.return = undefined; + } + } + + if (typeof Symbol === "function" && Symbol.asyncIterator) { + AsyncGenerator.prototype[Symbol.asyncIterator] = function () { + return this; + }; + } + + AsyncGenerator.prototype.next = function (arg) { + return this._invoke("next", arg); + }; + + AsyncGenerator.prototype.throw = function (arg) { + return this._invoke("throw", arg); + }; + + AsyncGenerator.prototype.return = function (arg) { + return this._invoke("return", arg); + }; + + return { + wrap: function (fn) { + return function () { + return new AsyncGenerator(fn.apply(this, arguments)); + }; + }, + await: function (value) { + return new AwaitValue(value); + } + }; +}(); @@ -3535,6 +3646,9 @@ function install(Vue, options) { ApolloProvider$1.install = install; +// eslint-disable-next-line no-undef +ApolloProvider$1.version = "3.0.0-alpha.1"; + var ApolloProvider$$1 = ApolloProvider$1; // Auto-install @@ -3548,4 +3662,5 @@ if (GlobalVue) { GlobalVue.use(ApolloProvider$1); } -export { install, ApolloProvider$$1 as ApolloProvider, willPrefetch };export default ApolloProvider$1; +export { install, ApolloProvider$$1 as ApolloProvider, willPrefetch }; +export default ApolloProvider$1; diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js index b7ea4ed..15b1a96 100644 --- a/dist/vue-apollo.min.js +++ b/dist/vue-apollo.min.js @@ -1 +1 @@ -!function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){var r=t?t.length:0;return!!r&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i-1}function S(t,e){var r=this.__data__,i=V(r,t);return i<0?r.push([t,e]):r[i][1]=e,this}function A(t){var e=-1,r=t?t.length:0;for(this.clear();++e=Qt&&(u=h,l=!1,e=new T(e));t:for(;++a0&&r(u)?e>1?D(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function N(t,e,r){var i=e(t);return fe(t)?i:o(i,r(t))}function R(t){if(!lt(t)||Y(t))return!1;var e=at(t)||p(t)?te:Rt;return e.test(rt(t))}function F(t){if(!lt(t))return tt(t);var e=Z(t),r=[];for(var i in t)("constructor"!=i||!e&&Yt.call(t,i))&&r.push(i);return r}function I(t,e){return t=Object(t),H(t,e,function(e,r){return r in t})}function H(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=Mt}function lt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ct(t){return!!t&&"object"==typeof t}function ht(t){return"symbol"==typeof t||ct(t)&&Zt.call(t)==Dt}function ft(t){return ot(t)?C(t,!0):F(t)}function pt(){return[]}function vt(t,e,r){function i(e){var r=f,i=p;return f=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,d=setTimeout(a,e),_?i(t):y}function o(t){var r=t-b,i=t-g,n=e-r;return m?xe(n,v-i):n}function s(t){var r=t-b,i=t-g;return void 0===b||r>=e||r<0||m&&i>=v}function a(){var t=Ee();return s(t)?u(t):void(d=setTimeout(a,o(t)))}function u(t){return d=void 0,w&&f?i(t):(f=p=void 0,y)}function l(){void 0!==d&&clearTimeout(d),g=0,f=b=p=d=void 0}function c(){return void 0===d?y:u(Ee())}function h(){var t=Ee(),r=s(t);if(f=arguments,p=this,b=t,r){if(void 0===d)return n(b);if(m)return d=setTimeout(a,e),i(b)}return void 0===d&&(d=setTimeout(a,e)),y}var f,p,v,y,d,b,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(ye);return e=_t(e)||0,dt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?Pe(_t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),h.cancel=l,h.flush=c,h}function yt(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError(ye);return dt(r)&&(i="leading"in r?!!r.leading:i,n="trailing"in r?!!r.trailing:n),vt(t,e,{leading:i,maxWait:e,trailing:n})}function dt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function bt(t){return!!t&&"object"==typeof t}function gt(t){return"symbol"==typeof t||bt(t)&&Ae.call(t)==be}function _t(t){if("number"==typeof t)return t;if(gt(t))return de;if(dt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=dt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ge,"");var r=me.test(t);return r||we.test(t)?ke(t.slice(2),r?2:8):_e.test(t)?de:+t}function mt(t,e,r){function i(e){var r=f,i=p;return f=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,d=setTimeout(a,e),_?i(t):y}function o(t){var r=t-b,i=t-g,n=e-r;return m?Ge(n,v-i):n}function s(t){var r=t-b,i=t-g;return void 0===b||r>=e||r<0||m&&i>=v}function a(){var t=Je();return s(t)?u(t):void(d=setTimeout(a,o(t)))}function u(t){return d=void 0,w&&f?i(t):(f=p=void 0,y)}function l(){void 0!==d&&clearTimeout(d),g=0,f=b=p=d=void 0}function c(){return void 0===d?y:u(Je())}function h(){var t=Je(),r=s(t);if(f=arguments,p=this,b=t,r){if(void 0===d)return n(b);if(m)return d=setTimeout(a,e),i(b)}return void 0===d&&(d=setTimeout(a,e)),y}var f,p,v,y,d,b,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(Qe);return e=$t(e)||0,wt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?We($t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),h.cancel=l,h.flush=c,h}function wt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function kt(t){return!!t&&"object"==typeof t}function Ot(t){return"symbol"==typeof t||kt(t)&&He.call(t)==qe}function $t(t){if("number"==typeof t)return t;if(Ot(t))return Te;if(wt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=wt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Me,"");var r=Ve.test(t);return r||Ke.test(t)?De(t.slice(2),r?2:8):Ce.test(t)?Te:+t}function jt(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function St(t){return ze.Vue.util.mergeOptions({},t)}function At(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function Pt(t){return fr.push(t),t}function xt(t,e,r){"undefined"!=typeof r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function Et(t,e){if(!Et.installed){Et.installed=!0,ze.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},ve(t,pr),t.data),o=Object.assign({},ve(e,pr),e.data),s={},a=0;a3&&void 0!==arguments[3])||arguments[3];if(tr(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return er(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Be(e,this.options.throttle):e,e=this.options.debounce?Xe(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=ve(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];if(tr(this,e),!i.query){var o=i;i={query:o}}var s=or(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return s.type="query",s.vueApolloSpecialKeys=Ye,s.loading=!1,s}return nr(e,t),er(e,[{key:"stop",value:function(){ir(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)})),this.maySetLoading(),ir(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0)}},{key:"nextResult",value:function(t){var e=t.data,r=t.loading;r||this.loadingDone();var i="function"==typeof this.options.result;"undefined"==typeof e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?i||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),i&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){ir(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};hr.install=Et;var dr=hr,br=null;"undefined"!=typeof window?br=window.Vue:"undefined"!=typeof global&&(br=global.Vue),br&&br.use(hr),t.install=Et,t.ApolloProvider=dr,t.default=hr,t.willPrefetch=Pt}(this.VueApollo=this.VueApollo||{}); +var VueApollo=function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){return!!(t?t.length:0)&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i=ht&&(u=h,l=!1,e=new g(e));t:for(;++a0&&r(u)?e>1?k(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function O(t,e,r){var i=e(t);return Ht(t)?i:o(i,r(t))}function j(t){return!(!W(t)||q(t))&&(F(t)||p(t)?Qt:mt).test(K(t))}function S(t){if(!W(t))return C(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&Et.call(t,i))&&r.push(i);return r}function $(t,e){return t=Object(t),A(t,e,function(e,r){return r in t})}function A(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=vt}function W(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function G(t){return!!t&&"object"==typeof t}function J(t){return"symbol"==typeof t||G(t)&&Lt.call(t)==gt}function U(t){return R(t)?m(t,!0):S(t)}function z(){return[]}function B(t,e,r){function i(e){var r=c,i=h;return c=h=void 0,d=e,p=t.apply(i,r)}function n(t){return d=t,v=setTimeout(a,e),b?i(t):p}function o(t){var r=e-(t-y);return g?oe(r,f-(t-d)):r}function s(t){var r=t-y;return void 0===y||r>=e||r<0||g&&t-d>=f}function a(){var t=se();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=se(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(Gt);return e=tt(e)||0,X(r)&&(b=!!r.leading,f=(g="maxWait"in r)?ne(tt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(se())},l}function X(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&ie.call(t)==Ut}function tt(t){if("number"==typeof t)return t;if(Z(t))return Jt;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(zt,"");var r=Xt.test(t);return r||Yt.test(t)?Zt(t.slice(2),r?2:8):Bt.test(t)?Jt:+t}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return!!t&&"object"==typeof t}function it(t){return"symbol"==typeof t||rt(t)&&ge.call(t)==le}function nt(t){if("number"==typeof t)return t;if(it(t))return ue;if(et(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=et(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ce,"");var r=fe.test(t);return r||pe.test(t)?ve(t.slice(2),r?2:8):he.test(t)?ue:+t}function ot(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function st(t){return ke.Vue.util.mergeOptions({},t)}function at(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function ut(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function lt(t,e){if(!lt.installed){lt.installed=!0,ke.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},Wt(t,Ne),t.data),o=Object.assign({},Wt(e,Ne),e.data),s={},a=0;a-1},d.prototype.set=function(t,e){var r=this.__data__,i=_(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},b.prototype.clear=function(){this.__data__={hash:new y,map:new(Nt||d),string:new y}},b.prototype.delete=function(t){return x(this,t).delete(t)},b.prototype.get=function(t){return x(this,t).get(t)},b.prototype.has=function(t){return x(this,t).has(t)},b.prototype.set=function(t,e){return x(this,t).set(t,e),this},g.prototype.add=g.prototype.push=function(t){return this.__data__.set(t,ft),this},g.prototype.has=function(t){return this.__data__.has(t)};var It=Kt?v(Kt,Object):z,Ft=Kt?function(t){for(var e=[];t;)o(e,It(t)),t=qt(t);return e}:z,Ht=Array.isArray,Wt=function(t,r){return r=Dt(void 0===r?t.length-1:r,0),function(){for(var i=arguments,n=-1,o=Dt(i.length-r,0),s=Array(o);++n=e||r<0||g&&t-d>=f}function a(){var t=we();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=we(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(ae);return e=nt(e)||0,et(r)&&(b=!!r.leading,f=(g="maxWait"in r)?me(nt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(we())},l}),Se=["variables","watch","update","result","error","loadingKey","watchLoading","skip","throttle","debounce","subscribeToMore","prefetch","manual"],$e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=(function(){function t(t){this.value=t}function e(e){function r(n,o){try{var s=e[n](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(s.done?"return":"normal",s.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}(n=n.next)?r(n.key,n.arg):o=null}var n,o;this._invoke=function(t,e){return new Promise(function(i,s){var a={key:t,arg:e,resolve:i,reject:s,next:null};o?o=o.next=a:(n=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),Pe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(Ae(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return Pe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Oe(e,this.options.throttle):e,e=this.options.debounce?je(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=Wt(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];Ae(this,e),i.query||(i={query:i});var o=Qe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return o.type="query",o.vueApolloSpecialKeys=Se,o.loading=!1,o}return Le(e,qe),Pe(e,[{key:"stop",value:function(){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)})),this.maySetLoading(),Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0)}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};Ke.install=lt,Ke.version="3.0.0-alpha.1";var Fe=Ke,He=null;return"undefined"!=typeof window?He=window.Vue:"undefined"!=typeof global&&(He=global.Vue),He&&He.use(Ke),t.install=lt,t.ApolloProvider=Fe,t.default=Ke,t.willPrefetch=function(t){return De.push(t),t},t}({}); diff --git a/dist/vue-apollo.umd.js b/dist/vue-apollo.umd.js index 84a73a7..5fea74e 100644 --- a/dist/vue-apollo.umd.js +++ b/dist/vue-apollo.umd.js @@ -1,7 +1,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global['vue-apollo'] = global['vue-apollo'] || {}))); + (factory((global['vue-apollo'] = {}))); }(this, (function (exports) { 'use strict'; var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; @@ -2352,7 +2352,118 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol +var asyncGenerator = function () { + function AwaitValue(value) { + this.value = value; + } + function AsyncGenerator(gen) { + var front, back; + + function send(key, arg) { + return new Promise(function (resolve, reject) { + var request = { + key: key, + arg: arg, + resolve: resolve, + reject: reject, + next: null + }; + + if (back) { + back = back.next = request; + } else { + front = back = request; + resume(key, arg); + } + }); + } + + function resume(key, arg) { + try { + var result = gen[key](arg); + var value = result.value; + + if (value instanceof AwaitValue) { + Promise.resolve(value.value).then(function (arg) { + resume("next", arg); + }, function (arg) { + resume("throw", arg); + }); + } else { + settle(result.done ? "return" : "normal", result.value); + } + } catch (err) { + settle("throw", err); + } + } + + function settle(type, value) { + switch (type) { + case "return": + front.resolve({ + value: value, + done: true + }); + break; + + case "throw": + front.reject(value); + break; + + default: + front.resolve({ + value: value, + done: false + }); + break; + } + + front = front.next; + + if (front) { + resume(front.key, front.arg); + } else { + back = null; + } + } + + this._invoke = send; + + if (typeof gen.return !== "function") { + this.return = undefined; + } + } + + if (typeof Symbol === "function" && Symbol.asyncIterator) { + AsyncGenerator.prototype[Symbol.asyncIterator] = function () { + return this; + }; + } + + AsyncGenerator.prototype.next = function (arg) { + return this._invoke("next", arg); + }; + + AsyncGenerator.prototype.throw = function (arg) { + return this._invoke("throw", arg); + }; + + AsyncGenerator.prototype.return = function (arg) { + return this._invoke("return", arg); + }; + + return { + wrap: function (fn) { + return function () { + return new AsyncGenerator(fn.apply(this, arguments)); + }; + }, + await: function (value) { + return new AwaitValue(value); + } + }; +}(); @@ -3541,6 +3652,9 @@ function install(Vue, options) { ApolloProvider$1.install = install; +// eslint-disable-next-line no-undef +ApolloProvider$1.version = "3.0.0-alpha.1"; + var ApolloProvider$$1 = ApolloProvider$1; // Auto-install diff --git a/package.json b/package.json index ccc8cb6..85e62a8 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,9 @@ "unpkg": "dist/vue-apollo.min.js", "scripts": { "build": "npm run build:browser && npm run build:es && npm run build:umd", - "build:browser": "rollup --config rollup.config.browser.js", - "build:es": "rollup --config rollup.config.es.js", - "build:umd": "rollup --config rollup.config.umd.js", + "build:browser": "rollup --config build/rollup.config.browser.js", + "build:es": "rollup --config build/rollup.config.es.js", + "build:umd": "rollup --config build/rollup.config.umd.js", "prepublish": "npm run build", "dev": "npm-watch" }, @@ -40,22 +40,25 @@ "lodash.throttle": "^4.1.1" }, "devDependencies": { - "babel-cli": "^6.14.0", + "babel-core": "^6.26.0", "babel-eslint": "^7.1.1", "babel-plugin-external-helpers": "^6.22.0", - "babel-preset-es2015": "^6.24.1", + "babel-preset-env": "^1.6.1", "babel-preset-stage-0": "^6.24.1", - "eslint": "^3.12.1", - "eslint-config-standard": "^7.1.0", + "eslint": "^4.10.0", + "eslint-config-standard": "^10.2.1", + "eslint-plugin-import": "^2.8.0", + "eslint-plugin-node": "^5.2.1", "eslint-plugin-promise": "^3.4.0", - "eslint-plugin-standard": "^2.0.1", - "npm-watch": "^0.1.6", + "eslint-plugin-standard": "^3.0.1", + "npm-watch": "^0.3.0", "rimraf": "^2.6.1", - "rollup": "^0.41.6", - "rollup-plugin-babel": "^2.7.1", - "rollup-plugin-commonjs": "^8.0.2", + "rollup": "^0.50.0", + "rollup-plugin-babel": "^3.0.2", + "rollup-plugin-commonjs": "^8.2.6", "rollup-plugin-node-resolve": "^3.0.0", - "rollup-plugin-uglify": "^1.0.2", - "uglify-js-harmony": "^2.7.7" + "rollup-plugin-replace": "^2.0.0", + "rollup-plugin-uglify": "^2.0.1", + "uglify-es": "^3.1.6" } } diff --git a/rollup.config.base.js b/rollup.config.base.js deleted file mode 100644 index 3d4d36f..0000000 --- a/rollup.config.base.js +++ /dev/null @@ -1,23 +0,0 @@ -import commonjs from 'rollup-plugin-commonjs' -import resolve from 'rollup-plugin-node-resolve' -import babel from 'rollup-plugin-babel' - -export default { - entry: 'src/index.js', - exports: 'named', - moduleName: 'vue-apollo', - plugins: [ - resolve({ - jsnext: true, - main: true, - browser: true, - }), - commonjs(), - babel({ - exclude: 'node_modules/**', - plugins: [ - 'external-helpers', - ], - }), - ], -} diff --git a/src/index.js b/src/index.js index 6bf300d..67ecace 100644 --- a/src/index.js +++ b/src/index.js @@ -149,6 +149,9 @@ export function install (Vue, options) { apolloProvider.install = install +// eslint-disable-next-line no-undef +apolloProvider.version = VERSION + export const ApolloProvider = apolloProvider export { willPrefetch } from './apollo-provider' diff --git a/yarn.lock b/yarn.lock index a57d1dc..633855c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3,8 +3,8 @@ abbrev@1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.0.tgz#d0554c2256636e2f56e7c2e5ad183f859428d81f" + version "1.1.1" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" acorn-jsx@^3.0.0: version "3.0.1" @@ -16,32 +16,39 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.1.tgz#53fe161111f912ab999ee887a90a0bc52822fd75" +acorn@^5.1.1, acorn@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" -ajv-keywords@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" -ajv@^4.7.0, ajv@^4.9.1: +ajv@^4.9.1: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" -align-text@^0.1.1, align-text@^0.1.3: - version "0.1.4" - resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" +ajv@^5.2.0, ajv@^5.2.3: + version "5.3.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda" dependencies: - kind-of "^3.0.2" - longest "^1.0.1" - repeat-string "^1.5.2" + co "^4.6.0" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" -ansi-escapes@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-align@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" + dependencies: + string-width "^2.0.0" + +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" ansi-regex@^2.0.0: version "2.1.1" @@ -55,6 +62,12 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.1.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" + dependencies: + color-convert "^1.9.0" + anymatch@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" @@ -63,8 +76,8 @@ anymatch@^1.3.0: normalize-path "^2.0.0" aproba@^1.0.3: - version "1.1.2" - resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.1.2.tgz#45c6629094de4e96f693ef7eab74ae079c240fc1" + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" are-we-there-yet@~1.1.2: version "1.1.4" @@ -123,10 +136,6 @@ async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" -async@~0.2.6: - version "0.2.10" - resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1" - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -139,28 +148,7 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-cli@^6.14.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-cli/-/babel-cli-6.26.0.tgz#502ab54874d7db88ad00b887a06383ce03d002f1" - dependencies: - babel-core "^6.26.0" - babel-polyfill "^6.26.0" - babel-register "^6.26.0" - babel-runtime "^6.26.0" - commander "^2.11.0" - convert-source-map "^1.5.0" - fs-readdir-recursive "^1.0.0" - glob "^7.1.2" - lodash "^4.17.4" - output-file-sync "^1.1.2" - path-is-absolute "^1.0.1" - slash "^1.0.0" - source-map "^0.5.6" - v8flags "^2.1.1" - optionalDependencies: - chokidar "^1.6.1" - -babel-code-frame@^6.16.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: +babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: @@ -168,7 +156,7 @@ babel-code-frame@^6.16.0, babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-core@6, babel-core@^6.26.0: +babel-core@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.26.0.tgz#af32f78b31a6fcef119c87b0fd8d9753f03a0bb8" dependencies: @@ -406,7 +394,7 @@ babel-plugin-transform-async-generator-functions@^6.24.1: babel-plugin-syntax-async-generators "^6.5.0" babel-runtime "^6.22.0" -babel-plugin-transform-async-to-generator@^6.24.1: +babel-plugin-transform-async-to-generator@^6.22.0, babel-plugin-transform-async-to-generator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz#6536e378aff6cb1d5517ac0e40eb3e9fc8d08761" dependencies: @@ -460,7 +448,7 @@ babel-plugin-transform-es2015-block-scoped-functions@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-block-scoping@^6.24.1: +babel-plugin-transform-es2015-block-scoping@^6.23.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz#d70f5299c1308d05c12f463813b0a09e73b1895f" dependencies: @@ -470,7 +458,7 @@ babel-plugin-transform-es2015-block-scoping@^6.24.1: babel-types "^6.26.0" lodash "^4.17.4" -babel-plugin-transform-es2015-classes@^6.24.1, babel-plugin-transform-es2015-classes@^6.9.0: +babel-plugin-transform-es2015-classes@^6.23.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz#5a4c58a50c9c9461e564b4b2a3bfabc97a2584db" dependencies: @@ -484,33 +472,33 @@ babel-plugin-transform-es2015-classes@^6.24.1, babel-plugin-transform-es2015-cla babel-traverse "^6.24.1" babel-types "^6.24.1" -babel-plugin-transform-es2015-computed-properties@^6.24.1: +babel-plugin-transform-es2015-computed-properties@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz#6fe2a8d16895d5634f4cd999b6d3480a308159b3" dependencies: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-plugin-transform-es2015-destructuring@^6.22.0: +babel-plugin-transform-es2015-destructuring@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-duplicate-keys@^6.24.1: +babel-plugin-transform-es2015-duplicate-keys@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz#73eb3d310ca969e3ef9ec91c53741a6f1576423e" dependencies: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-plugin-transform-es2015-for-of@^6.22.0: +babel-plugin-transform-es2015-for-of@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-function-name@^6.24.1: +babel-plugin-transform-es2015-function-name@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz#834c89853bc36b1af0f3a4c5dbaa94fd8eacaa8b" dependencies: @@ -524,7 +512,7 @@ babel-plugin-transform-es2015-literals@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-modules-amd@^6.24.1: +babel-plugin-transform-es2015-modules-amd@^6.22.0, babel-plugin-transform-es2015-modules-amd@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz#3b3e54017239842d6d19c3011c4bd2f00a00d154" dependencies: @@ -532,7 +520,7 @@ babel-plugin-transform-es2015-modules-amd@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-plugin-transform-es2015-modules-commonjs@^6.24.1: +babel-plugin-transform-es2015-modules-commonjs@^6.23.0, babel-plugin-transform-es2015-modules-commonjs@^6.24.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz#0d8394029b7dc6abe1a97ef181e00758dd2e5d8a" dependencies: @@ -541,7 +529,7 @@ babel-plugin-transform-es2015-modules-commonjs@^6.24.1: babel-template "^6.26.0" babel-types "^6.26.0" -babel-plugin-transform-es2015-modules-systemjs@^6.24.1: +babel-plugin-transform-es2015-modules-systemjs@^6.23.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz#ff89a142b9119a906195f5f106ecf305d9407d23" dependencies: @@ -549,7 +537,7 @@ babel-plugin-transform-es2015-modules-systemjs@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-plugin-transform-es2015-modules-umd@^6.24.1: +babel-plugin-transform-es2015-modules-umd@^6.23.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz#ac997e6285cd18ed6176adb607d602344ad38468" dependencies: @@ -557,14 +545,14 @@ babel-plugin-transform-es2015-modules-umd@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-plugin-transform-es2015-object-super@^6.24.1: +babel-plugin-transform-es2015-object-super@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz#24cef69ae21cb83a7f8603dad021f572eb278f8d" dependencies: babel-helper-replace-supers "^6.24.1" babel-runtime "^6.22.0" -babel-plugin-transform-es2015-parameters@^6.24.1: +babel-plugin-transform-es2015-parameters@^6.23.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz#57ac351ab49caf14a97cd13b09f66fdf0a625f2b" dependencies: @@ -575,7 +563,7 @@ babel-plugin-transform-es2015-parameters@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" -babel-plugin-transform-es2015-shorthand-properties@^6.24.1: +babel-plugin-transform-es2015-shorthand-properties@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz#24f875d6721c87661bbd99a4622e51f14de38aa0" dependencies: @@ -588,7 +576,7 @@ babel-plugin-transform-es2015-spread@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-sticky-regex@^6.24.1: +babel-plugin-transform-es2015-sticky-regex@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz#00c1cdb1aca71112cdf0cf6126c2ed6b457ccdbc" dependencies: @@ -602,13 +590,13 @@ babel-plugin-transform-es2015-template-literals@^6.22.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-typeof-symbol@^6.22.0: +babel-plugin-transform-es2015-typeof-symbol@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-unicode-regex@^6.24.1: +babel-plugin-transform-es2015-unicode-regex@^6.22.0: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz#d38b12f42ea7323f729387f18a7c5ae1faeb35e9" dependencies: @@ -616,7 +604,7 @@ babel-plugin-transform-es2015-unicode-regex@^6.24.1: babel-runtime "^6.22.0" regexpu-core "^2.0.0" -babel-plugin-transform-exponentiation-operator@^6.24.1: +babel-plugin-transform-exponentiation-operator@^6.22.0, babel-plugin-transform-exponentiation-operator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz#2ab0c9c7f3098fa48907772bb813fe41e8de3a0e" dependencies: @@ -645,7 +633,7 @@ babel-plugin-transform-object-rest-spread@^6.22.0: babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.26.0" -babel-plugin-transform-regenerator@^6.24.1: +babel-plugin-transform-regenerator@^6.22.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz#e0703696fbde27f0a3efcacf8b4dca2f7b3a8f2f" dependencies: @@ -658,42 +646,40 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-polyfill@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" - dependencies: - babel-runtime "^6.26.0" - core-js "^2.5.0" - regenerator-runtime "^0.10.5" - -babel-preset-es2015@^6.24.1: - version "6.24.1" - resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz#d44050d6bc2c9feea702aaf38d727a0210538939" +babel-preset-env@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.6.1.tgz#a18b564cc9b9afdf4aae57ae3c1b0d99188e6f48" dependencies: babel-plugin-check-es2015-constants "^6.22.0" + babel-plugin-syntax-trailing-function-commas "^6.22.0" + babel-plugin-transform-async-to-generator "^6.22.0" babel-plugin-transform-es2015-arrow-functions "^6.22.0" babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoping "^6.24.1" - babel-plugin-transform-es2015-classes "^6.24.1" - babel-plugin-transform-es2015-computed-properties "^6.24.1" - babel-plugin-transform-es2015-destructuring "^6.22.0" - babel-plugin-transform-es2015-duplicate-keys "^6.24.1" - babel-plugin-transform-es2015-for-of "^6.22.0" - babel-plugin-transform-es2015-function-name "^6.24.1" + babel-plugin-transform-es2015-block-scoping "^6.23.0" + babel-plugin-transform-es2015-classes "^6.23.0" + babel-plugin-transform-es2015-computed-properties "^6.22.0" + babel-plugin-transform-es2015-destructuring "^6.23.0" + babel-plugin-transform-es2015-duplicate-keys "^6.22.0" + babel-plugin-transform-es2015-for-of "^6.23.0" + babel-plugin-transform-es2015-function-name "^6.22.0" babel-plugin-transform-es2015-literals "^6.22.0" - babel-plugin-transform-es2015-modules-amd "^6.24.1" - babel-plugin-transform-es2015-modules-commonjs "^6.24.1" - babel-plugin-transform-es2015-modules-systemjs "^6.24.1" - babel-plugin-transform-es2015-modules-umd "^6.24.1" - babel-plugin-transform-es2015-object-super "^6.24.1" - babel-plugin-transform-es2015-parameters "^6.24.1" - babel-plugin-transform-es2015-shorthand-properties "^6.24.1" + babel-plugin-transform-es2015-modules-amd "^6.22.0" + babel-plugin-transform-es2015-modules-commonjs "^6.23.0" + babel-plugin-transform-es2015-modules-systemjs "^6.23.0" + babel-plugin-transform-es2015-modules-umd "^6.23.0" + babel-plugin-transform-es2015-object-super "^6.22.0" + babel-plugin-transform-es2015-parameters "^6.23.0" + babel-plugin-transform-es2015-shorthand-properties "^6.22.0" babel-plugin-transform-es2015-spread "^6.22.0" - babel-plugin-transform-es2015-sticky-regex "^6.24.1" + babel-plugin-transform-es2015-sticky-regex "^6.22.0" babel-plugin-transform-es2015-template-literals "^6.22.0" - babel-plugin-transform-es2015-typeof-symbol "^6.22.0" - babel-plugin-transform-es2015-unicode-regex "^6.24.1" - babel-plugin-transform-regenerator "^6.24.1" + babel-plugin-transform-es2015-typeof-symbol "^6.23.0" + babel-plugin-transform-es2015-unicode-regex "^6.22.0" + babel-plugin-transform-exponentiation-operator "^6.22.0" + babel-plugin-transform-regenerator "^6.22.0" + browserslist "^2.1.2" + invariant "^2.2.2" + semver "^5.3.0" babel-preset-stage-0@^6.24.1: version "6.24.1" @@ -812,6 +798,18 @@ boom@2.x.x: dependencies: hoek "2.x.x" +boxen@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.2.2.tgz#3f1d4032c30ffea9d4b02c322eaf2ea741dcbce5" + dependencies: + ansi-align "^2.0.0" + camelcase "^4.0.0" + chalk "^2.0.1" + cli-boxes "^1.0.0" + string-width "^2.0.0" + term-size "^1.2.0" + widest-line "^1.0.0" + brace-expansion@^1.1.7: version "1.1.8" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" @@ -833,7 +831,14 @@ browser-resolve@^1.11.0: dependencies: resolve "1.1.7" -builtin-modules@^1.1.0: +browserslist@^2.1.2: + version "2.6.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.6.1.tgz#cc65a05ad6131ebda26f076f2822ba1bc826376b" + dependencies: + caniuse-lite "^1.0.30000755" + electron-to-chromium "^1.3.27" + +builtin-modules@^1.0.0, builtin-modules@^1.1.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -847,22 +852,23 @@ callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" -camelcase@^1.0.2: - version "1.2.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39" +camelcase@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + +caniuse-lite@^1.0.30000755: + version "1.0.30000756" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000756.tgz#3da701c1521b9fab87004c6de7c97fa47dbeaad2" + +capture-stack-trace@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz#4a6fa07399c26bba47f0b2496b4d0fb408c5550d" caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" -center-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad" - dependencies: - align-text "^0.1.3" - lazy-cache "^1.0.3" - -chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -872,7 +878,15 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chokidar@^1.4.3, chokidar@^1.6.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + dependencies: + ansi-styles "^3.1.0" + escape-string-regexp "^1.0.5" + supports-color "^4.0.0" + +chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" dependencies: @@ -891,24 +905,20 @@ circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" -cli-cursor@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" +cli-boxes@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" + +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" dependencies: - restore-cursor "^1.0.1" + restore-cursor "^2.0.0" cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" -cliui@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1" - dependencies: - center-align "^0.1.1" - right-align "^0.1.1" - wordwrap "0.0.2" - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -917,13 +927,23 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +color-convert@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + dependencies: + color-name "^1.1.1" + +color-name@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.5.tgz#938370a57b4a51dea2c77c15d5c5fdf895164009" dependencies: delayed-stream "~1.0.0" -commander@^2.11.0: +commander@~2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" @@ -931,7 +951,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.5.2: +concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -939,46 +959,60 @@ concat-stream@^1.5.2: readable-stream "^2.2.2" typedarray "^0.0.6" -configstore@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/configstore/-/configstore-1.4.0.tgz#c35781d0501d268c25c54b8b17f6240e8a4fb021" +configstore@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.1.tgz#094ee662ab83fad9917678de114faaea8fcdca90" dependencies: + dot-prop "^4.1.0" graceful-fs "^4.1.2" - mkdirp "^0.5.0" - object-assign "^4.0.1" - os-tmpdir "^1.0.0" - osenv "^0.1.0" - uuid "^2.0.1" - write-file-atomic "^1.1.2" - xdg-basedir "^2.0.0" + make-dir "^1.0.0" + unique-string "^1.0.0" + write-file-atomic "^2.0.0" + xdg-basedir "^3.0.0" console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + convert-source-map@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" core-js@^2.4.0, core-js@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.0.tgz#569c050918be6486b3837552028ae0466b717086" + version "2.5.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b" core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +create-error-class@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" + dependencies: + capture-stack-trace "^1.0.0" + +cross-spawn@^5.0.1, cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" dependencies: boom "2.x.x" -d@1: +crypto-random-string@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" - dependencies: - es5-ext "^0.10.9" + resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" dashdash@^1.12.0: version "1.14.1" @@ -986,15 +1020,17 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -debug@^2.1.1, debug@^2.2.0, debug@^2.6.8: - version "2.6.8" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" +debug@^2.2.0, debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" -decamelize@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" +debug@^3.0.1: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" deep-extend@~0.4.0: version "0.4.2" @@ -1030,6 +1066,13 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + doctrine@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" @@ -1037,155 +1080,146 @@ doctrine@^2.0.0: esutils "^2.0.2" isarray "^1.0.0" +dot-prop@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" + dependencies: + is-obj "^1.0.0" + +duplexer3@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" + duplexer@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" -duplexify@^3.2.0: - version "3.5.1" - resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.5.1.tgz#4e1516be68838bc90a49994f0b39a6e5960befcd" - dependencies: - end-of-stream "^1.0.0" - inherits "^2.0.1" - readable-stream "^2.0.0" - stream-shift "^1.0.0" - ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" dependencies: jsbn "~0.1.0" -end-of-stream@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.0.tgz#7a90d833efda6cfa6eac0f4949dbb0fad3a63206" - dependencies: - once "^1.4.0" +electron-to-chromium@^1.3.27: + version "1.3.27" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" -es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.30" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.30.tgz#7141a16836697dbabfaaaeee41495ce29f52c939" +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" dependencies: - es6-iterator "2" - es6-symbol "~3.1" + is-arrayish "^0.2.1" -es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-symbol "^3.1" - -es6-map@^0.1.3: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-set "~0.1.5" - es6-symbol "~3.1.1" - event-emitter "~0.3.5" - -es6-promise@^3.0.2: +es6-promise@^3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" -es6-set@~0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-symbol "3.1.1" - event-emitter "~0.3.5" - -es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" - dependencies: - d "1" - es5-ext "~0.10.14" - -es6-weak-map@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-iterator "^2.0.1" - es6-symbol "^3.1.1" - escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" -escope@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" +eslint-config-standard@^10.2.1: + version "10.2.1" + resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-10.2.1.tgz#c061e4d066f379dc17cd562c64e819b4dd454591" + +eslint-import-resolver-node@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" + dependencies: + debug "^2.6.8" + resolve "^1.2.0" + +eslint-module-utils@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + +eslint-plugin-import@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.6.8" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.1" + eslint-module-utils "^2.1.1" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + read-pkg-up "^2.0.0" + +eslint-plugin-node@^5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz#80df3253c4d7901045ec87fa660a284e32bdca29" + dependencies: + ignore "^3.3.6" + minimatch "^3.0.4" + resolve "^1.3.3" + semver "5.3.0" + +eslint-plugin-promise@^3.4.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.6.0.tgz#54b7658c8f454813dc2a870aff8152ec4969ba75" + +eslint-plugin-standard@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2" + +eslint-scope@^3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: - es6-map "^0.1.3" - es6-weak-map "^2.0.1" esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-standard@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-7.1.0.tgz#47e769ea0739f5b2d5693b1a501c21c9650fafcf" - -eslint-plugin-promise@^3.4.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-3.5.0.tgz#78fbb6ffe047201627569e85a6c5373af2a68fca" - -eslint-plugin-standard@^2.0.1: - version "2.3.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-2.3.1.tgz#6765bd2a6d9ecdc7bdf1b145ae4bb30e2b7b86f8" - -eslint@^3.12.1: - version "3.19.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" +eslint@^4.10.0: + version "4.10.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.10.0.tgz#f25d0d7955c81968c2309aa5c9a229e045176bb7" dependencies: - babel-code-frame "^6.16.0" - chalk "^1.1.3" - concat-stream "^1.5.2" - debug "^2.1.1" + ajv "^5.2.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" doctrine "^2.0.0" - escope "^3.6.0" - espree "^3.4.0" + eslint-scope "^3.7.1" + espree "^3.5.1" esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" - glob "^7.0.3" - globals "^9.14.0" - ignore "^3.2.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^9.17.0" + ignore "^3.3.3" imurmurhash "^0.1.4" - inquirer "^0.12.0" - is-my-json-valid "^2.10.0" + inquirer "^3.0.6" is-resolvable "^1.0.0" - js-yaml "^3.5.1" - json-stable-stringify "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify "^1.0.1" levn "^0.3.0" - lodash "^4.0.0" - mkdirp "^0.5.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.1" - pluralize "^1.2.1" - progress "^1.1.8" - require-uncached "^1.0.2" - shelljs "^0.7.5" - strip-bom "^3.0.0" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^3.7.8" + table "^4.0.1" text-table "~0.2.0" - user-home "^2.0.0" -espree@^3.4.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.0.tgz#98358625bdd055861ea27e2867ea729faf463d8d" +espree@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.1.tgz#0c988b8ab46db53100a1954ae4ba995ddd27d87e" dependencies: acorn "^5.1.1" acorn-jsx "^3.0.0" @@ -1227,13 +1261,6 @@ esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -event-emitter@~0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - dependencies: - d "1" - es5-ext "~0.10.14" - event-stream@~3.3.0: version "3.3.4" resolved "https://registry.yarnpkg.com/event-stream/-/event-stream-3.3.4.tgz#4ab4c9a0f5a54db9338b4c34d86bfce8f4b35571" @@ -1246,9 +1273,17 @@ event-stream@~3.3.0: stream-combiner "~0.0.4" through "~2.3.1" -exit-hook@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" expand-brackets@^0.1.4: version "0.1.5" @@ -1266,6 +1301,14 @@ extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +external-editor@^2.0.4: + version "2.0.5" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.5.tgz#52c249a3981b9ba187c7cacf5beb50bf1d91a6bc" + dependencies: + iconv-lite "^0.4.17" + jschardet "^1.4.2" + tmp "^0.0.33" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -1276,16 +1319,23 @@ extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" +fast-deep-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" -figures@^1.3.5: - version "1.7.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" dependencies: escape-string-regexp "^1.0.5" - object-assign "^4.1.0" file-entry-cache@^2.0.0: version "2.0.0" @@ -1308,9 +1358,22 @@ fill-range@^2.1.0: repeat-element "^1.1.2" repeat-string "^1.5.2" +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + flat-cache@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" dependencies: circular-json "^0.3.1" del "^2.0.2" @@ -1343,10 +1406,6 @@ from@~0: version "0.1.7" resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" -fs-readdir-recursive@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz#8cd1745c8b4f8a29c8caec392476921ba195f560" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -1375,6 +1434,14 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2: mkdirp ">=0.5 0" rimraf "2" +function-bind@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -1388,15 +1455,9 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -generate-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" - -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - dependencies: - is-property "^1.0.0" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" getpass@^0.1.1: version "0.1.7" @@ -1417,7 +1478,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: +glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: @@ -1428,7 +1489,13 @@ glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^9.14.0, globals@^9.18.0: +global-dirs@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.0.tgz#10d34039e0df04272e262cf24224f7209434df4f" + dependencies: + ini "^1.3.4" + +globals@^9.17.0, globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -1443,22 +1510,23 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -got@^3.2.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/got/-/got-3.3.1.tgz#e5d0ed4af55fc3eef4d56007769d98192bcb2eca" +got@^6.7.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" dependencies: - duplexify "^3.2.0" - infinity-agent "^2.0.0" + create-error-class "^3.0.0" + duplexer3 "^0.1.4" + get-stream "^3.0.0" is-redirect "^1.0.0" + is-retry-allowed "^1.0.0" is-stream "^1.0.0" lowercase-keys "^1.0.0" - nested-error-stacks "^1.0.0" - object-assign "^3.0.0" - prepend-http "^1.0.0" - read-all-stream "^3.0.0" - timed-out "^2.0.0" + safe-buffer "^5.0.1" + timed-out "^4.0.0" + unzip-response "^2.0.1" + url-parse-lax "^1.0.0" -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4: +graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" @@ -1479,11 +1547,21 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" -hawk@~3.1.3: +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + +hawk@3.1.3, hawk@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/hawk/-/hawk-3.1.3.tgz#078444bd7c1640b0fe540d2c9b73d59678e8e1c4" dependencies: @@ -1503,6 +1581,10 @@ home-or-tmp@^2.0.0: os-homedir "^1.0.0" os-tmpdir "^1.0.1" +hosted-git-info@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + http-signature@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf" @@ -1511,22 +1593,26 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" -ignore-by-default@^1.0.0: +iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + +ignore-by-default@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" -ignore@^3.2.0: - version "3.3.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.4.tgz#85ab6d0a9ca8b27b31604c09efe1c14dc21ab872" +ignore@^3.3.3, ignore@^3.3.6: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" + +import-lazy@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" -infinity-agent@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/infinity-agent/-/infinity-agent-2.0.3.tgz#45e0e2ff7a9eb030b27d62b74b3744b7a7ac4216" - inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1534,42 +1620,43 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: +inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -ini@~1.3.0: +ini@^1.3.4, ini@~1.3.0: version "1.3.4" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" -inquirer@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" +inquirer@^3.0.6: + version "3.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" - chalk "^1.0.0" - cli-cursor "^1.0.1" + ansi-escapes "^3.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" cli-width "^2.0.0" - figures "^1.3.5" + external-editor "^2.0.4" + figures "^2.0.0" lodash "^4.3.0" - readline2 "^1.0.1" - run-async "^0.1.0" - rx-lite "^3.1.2" - string-width "^1.0.1" - strip-ansi "^3.0.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" through "^2.3.6" -interpret@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" - invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: loose-envify "^1.0.0" +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -1577,8 +1664,14 @@ is-binary-path@^1.0.0: binary-extensions "^1.0.0" is-buffer@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.5.tgz#1f3b26ef613b214b88cbca23cc6c01d87961eecc" + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" is-dotfile@^1.0.0: version "1.0.3" @@ -1620,19 +1713,17 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" +is-installed-globally@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80" + dependencies: + global-dirs "^0.1.0" + is-path-inside "^1.0.0" + is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" -is-my-json-valid@^2.10.0: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz#5a846777e2c2620d1e69104e5d3a03b1f6088f11" - dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" - is-npm@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-1.0.0.tgz#f2fb63a65e4905b406c86072765a1a4dc793b9f4" @@ -1649,6 +1740,10 @@ is-number@^3.0.0: dependencies: kind-of "^3.0.2" +is-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -1673,9 +1768,9 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" -is-property@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" is-redirect@^1.0.0: version "1.0.0" @@ -1687,7 +1782,11 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" -is-stream@^1.0.0: +is-retry-allowed@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz#11a060568b67339444033d0125a61a20d564fb34" + +is-stream@^1.0.0, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -1699,6 +1798,10 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" @@ -1713,9 +1816,9 @@ js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@^3.5.1: - version "3.9.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0" +js-yaml@^3.9.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" dependencies: argparse "^1.0.7" esprima "^4.0.0" @@ -1724,6 +1827,10 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +jschardet@^1.4.2: + version "1.6.0" + resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.6.0.tgz#c7d1a71edcff2839db2f9ec30fc5d5ebd3c1a678" + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -1732,11 +1839,15 @@ jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" -json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: +json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" dependencies: @@ -1754,10 +1865,6 @@ jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" - jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -1779,15 +1886,11 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" -latest-version@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-1.0.1.tgz#72cfc46e3e8d1be651e1ebb54ea9f6ea96f374bb" +latest-version@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" dependencies: - package-json "^1.0.0" - -lazy-cache@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e" + package-json "^4.0.0" levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -1796,6 +1899,22 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" + dependencies: + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" + +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + lodash._baseassign@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" @@ -1835,6 +1954,10 @@ lodash.assign@^3.0.0: lodash._createassigner "^3.0.0" lodash.keys "^3.0.0" +lodash.cond@^4.3.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -1874,14 +1997,10 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" -lodash@^4.0.0, lodash@^4.17.4, lodash@^4.3.0: +lodash@^4.17.4, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" -longest@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" - loose-envify@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" @@ -1892,12 +2011,25 @@ lowercase-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.0.tgz#4e3366b39e7f5457e35f1324bdf6f88d0bfc7306" +lru-cache@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + magic-string@^0.22.4: version "0.22.4" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.4.tgz#31039b4e40366395618c1d6cf8193c53917475ff" dependencies: vlq "^0.2.1" +make-dir@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.1.0.tgz#19b4369fe48c116f53c2af95ad102c0e39e85d51" + dependencies: + pify "^3.0.0" + map-stream@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" @@ -1920,17 +2052,21 @@ micromatch@^2.1.5, micromatch@^2.3.11: parse-glob "^3.0.4" regex-cache "^0.4.2" -mime-db@~1.29.0: - version "1.29.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.29.0.tgz#48d26d235589651704ac5916ca06001914266878" +mime-db@~1.30.0: + version "1.30.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" mime-types@^2.1.12, mime-types@~2.1.7: - version "2.1.16" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.16.tgz#2b858a52e5ecd516db897ac2be87487830698e23" + version "2.1.17" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.17.tgz#09d7a393f03e995a79f8af857b70a9e0ab16557a" dependencies: - mime-db "~1.29.0" + mime-db "~1.30.0" -minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.4: +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + +minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: @@ -1944,7 +2080,7 @@ minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" -"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1: +"mkdirp@>=0.5 0", mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -1954,52 +2090,47 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" nan@^2.3.0: - version "2.6.2" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" + version "2.7.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" -nested-error-stacks@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/nested-error-stacks/-/nested-error-stacks-1.0.2.tgz#19f619591519f096769a5ba9a86e6eeec823c3cf" - dependencies: - inherits "~2.0.1" - node-pre-gyp@^0.6.36: - version "0.6.36" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz#db604112cb74e0d477554e9b505b17abddfab786" + version "0.6.38" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.38.tgz#e92a20f83416415bb4086f6d1fb78b3da73d113d" dependencies: + hawk "3.1.3" mkdirp "^0.5.1" nopt "^4.0.1" npmlog "^4.0.2" rc "^1.1.7" - request "^2.81.0" + request "2.81.0" rimraf "^2.6.1" semver "^5.3.0" tar "^2.2.1" tar-pack "^3.4.0" -nodemon@^1.3.8: - version "1.11.0" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.11.0.tgz#226c562bd2a7b13d3d7518b49ad4828a3623d06c" +nodemon@^1.12.1: + version "1.12.1" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.12.1.tgz#996a56dc49d9f16bbf1b78a4de08f13634b3878d" dependencies: - chokidar "^1.4.3" - debug "^2.2.0" - es6-promise "^3.0.2" - ignore-by-default "^1.0.0" + chokidar "^1.7.0" + debug "^2.6.8" + es6-promise "^3.3.1" + ignore-by-default "^1.0.1" lodash.defaults "^3.1.2" - minimatch "^3.0.0" - ps-tree "^1.0.1" - touch "1.0.0" + minimatch "^3.0.4" + ps-tree "^1.1.0" + touch "^3.1.0" undefsafe "0.0.3" - update-notifier "0.5.0" + update-notifier "^2.2.0" nopt@^4.0.1: version "4.0.1" @@ -2014,17 +2145,32 @@ nopt@~1.0.10: dependencies: abbrev "1" +normalize-package-data@^2.3.2: + version "2.4.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^2.0.0, normalize-path@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" dependencies: remove-trailing-separator "^1.0.1" -npm-watch@^0.1.6: - version "0.1.9" - resolved "https://registry.yarnpkg.com/npm-watch/-/npm-watch-0.1.9.tgz#30991072ce8cee0d72c0c75ac648c14a039b9902" +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" dependencies: - nodemon "^1.3.8" + path-key "^2.0.0" + +npm-watch@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/npm-watch/-/npm-watch-0.3.0.tgz#8f4272c0143e2f4720dbafb111fb91d015fbf82d" + dependencies: + nodemon "^1.12.1" through2 "^2.0.0" npmlog@^4.0.2: @@ -2044,10 +2190,6 @@ oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" -object-assign@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" - object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -2059,15 +2201,17 @@ object.omit@^2.0.0: for-own "^0.1.4" is-extendable "^0.1.1" -once@^1.3.0, once@^1.3.3, once@^1.4.0: +once@^1.3.0, once@^1.3.3: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" dependencies: wrappy "1" -onetime@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" optionator@^0.8.2: version "0.8.2" @@ -2084,31 +2228,39 @@ os-homedir@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" -os-tmpdir@^1.0.0, os-tmpdir@^1.0.1: +os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" -osenv@^0.1.0, osenv@^0.1.4: +osenv@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.4.tgz#42fe6d5953df06c8064be6f176c3d05aaaa34644" dependencies: os-homedir "^1.0.0" os-tmpdir "^1.0.0" -output-file-sync@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/output-file-sync/-/output-file-sync-1.1.2.tgz#d0a33eefe61a205facb90092e826598d5245ce76" - dependencies: - graceful-fs "^4.1.4" - mkdirp "^0.5.1" - object-assign "^4.1.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" -package-json@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/package-json/-/package-json-1.2.0.tgz#c8ecac094227cdf76a316874ed05e27cc939a0e0" +p-limit@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" dependencies: - got "^3.2.0" - registry-url "^3.0.0" + p-limit "^1.1.0" + +package-json@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" + dependencies: + got "^6.7.1" + registry-auth-token "^3.0.1" + registry-url "^3.0.3" + semver "^5.1.0" parse-glob@^3.0.4: version "3.0.4" @@ -2119,18 +2271,44 @@ parse-glob@^3.0.4: is-extglob "^1.0.0" is-glob "^2.0.0" +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" -path-is-inside@^1.0.1: +path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + pause-stream@0.0.11: version "0.0.11" resolved "https://registry.yarnpkg.com/pause-stream/-/pause-stream-0.0.11.tgz#fe5a34b0cbce12b5aa6a2b403ee2e73b602f1445" @@ -2145,6 +2323,10 @@ pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -2155,15 +2337,21 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pluralize@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -prepend-http@^1.0.0: +prepend-http@^1.0.1: version "1.0.4" resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" @@ -2172,23 +2360,27 @@ preserve@^0.2.0: resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" private@^0.1.6, private@^0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1" + version "0.1.8" + resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" -progress@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" -ps-tree@^1.0.1: +ps-tree@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ps-tree/-/ps-tree-1.1.0.tgz#b421b24140d6203f1ed3c76996b4427b08e8c014" dependencies: event-stream "~3.3.0" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -2204,23 +2396,31 @@ randomatic@^1.1.3: is-number "^3.0.0" kind-of "^4.0.0" -rc@^1.0.1, rc@^1.1.7: - version "1.2.1" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.1.tgz#2e03e8e42ee450b8cb3dce65be1bf8974e1dfd95" +rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: + version "1.2.2" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" dependencies: deep-extend "~0.4.0" ini "~1.3.0" minimist "^1.2.0" strip-json-comments "~2.0.1" -read-all-stream@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/read-all-stream/-/read-all-stream-3.1.0.tgz#35c3e177f2078ef789ee4bfafa4373074eaef4fa" +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" dependencies: - pinkie-promise "^2.0.0" - readable-stream "^2.0.0" + find-up "^2.0.0" + read-pkg "^2.0.0" -readable-stream@^2.0.0, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2: +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" + +readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2: version "2.3.3" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" dependencies: @@ -2241,27 +2441,9 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - dependencies: - resolve "^1.1.6" - regenerate@^1.2.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" - -regenerator-runtime@^0.10.5: - version "0.10.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + version "1.3.3" + resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" regenerator-runtime@^0.11.0: version "0.11.0" @@ -2276,11 +2458,10 @@ regenerator-transform@^0.10.0: private "^0.1.6" regex-cache@^0.4.2: - version "0.4.3" - resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.3.tgz#9b1a6c35d4d0dfcef5711ae651e8e9d3d7114145" + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" dependencies: is-equal-shallow "^0.1.3" - is-primitive "^2.0.0" regexpu-core@^2.0.0: version "2.0.0" @@ -2290,7 +2471,14 @@ regexpu-core@^2.0.0: regjsgen "^0.2.0" regjsparser "^0.1.4" -registry-url@^3.0.0: +registry-auth-token@^3.0.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.1.tgz#fb0d3289ee0d9ada2cbb52af5dfe66cb070d3006" + dependencies: + rc "^1.1.6" + safe-buffer "^5.0.1" + +registry-url@^3.0.3: version "3.1.0" resolved "https://registry.yarnpkg.com/registry-url/-/registry-url-3.1.0.tgz#3d4ef870f73dde1d77f0cf9a381432444e174942" dependencies: @@ -2318,19 +2506,13 @@ repeat-string@^1.5.2: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" -repeating@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeating/-/repeating-1.1.3.tgz#3d4114218877537494f97f77f9785fab810fa4ac" - dependencies: - is-finite "^1.0.0" - repeating@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" dependencies: is-finite "^1.0.0" -request@^2.81.0: +request@2.81.0: version "2.81.0" resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" dependencies: @@ -2357,7 +2539,7 @@ request@^2.81.0: tunnel-agent "^0.6.0" uuid "^3.0.0" -require-uncached@^1.0.2: +require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: @@ -2372,45 +2554,36 @@ resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.1.6, resolve@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" +resolve@^1.1.6, resolve@^1.2.0, resolve@^1.3.3, resolve@^1.4.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: path-parse "^1.0.5" -restore-cursor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" dependencies: - exit-hook "^1.0.0" - onetime "^1.0.0" - -right-align@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef" - dependencies: - align-text "^0.1.1" + onetime "^2.0.0" + signal-exit "^3.0.2" rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + version "2.6.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" -rollup-plugin-babel@^2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-2.7.1.tgz#16528197b0f938a1536f44683c7a93d573182f57" +rollup-plugin-babel@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.2.tgz#a2765dea0eaa8aece351c983573300d17497495b" dependencies: - babel-core "6" - babel-plugin-transform-es2015-classes "^6.9.0" - object-assign "^4.1.0" rollup-pluginutils "^1.5.0" -rollup-plugin-commonjs@^8.0.2: - version "8.2.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.0.tgz#d7b16ebb9a36b754df888fc552dfa775c1174f9d" +rollup-plugin-commonjs@^8.2.6: + version "8.2.6" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.6.tgz#27e5b9069ff94005bb01e01bb46a1e4873784677" dependencies: - acorn "^5.1.1" + acorn "^5.2.1" estree-walker "^0.5.0" magic-string "^0.22.4" resolve "^1.4.0" @@ -2425,11 +2598,19 @@ rollup-plugin-node-resolve@^3.0.0: is-module "^1.0.0" resolve "^1.1.6" -rollup-plugin-uglify@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-1.0.2.tgz#d4aa6f5df13522eae1ba17780c7c4c7096038359" +rollup-plugin-replace@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.0.0.tgz#19074089c8ed57184b8cc64e967a03d095119277" dependencies: - uglify-js "^2.6.1" + magic-string "^0.22.4" + minimatch "^3.0.2" + rollup-pluginutils "^2.0.1" + +rollup-plugin-uglify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-2.0.1.tgz#67b37ad1efdafbd83af4c36b40c189ee4866c969" + dependencies: + uglify-js "^3.0.9" rollup-pluginutils@^1.5.0: version "1.5.2" @@ -2445,21 +2626,25 @@ rollup-pluginutils@^2.0.1: estree-walker "^0.3.0" micromatch "^2.3.11" -rollup@^0.41.6: - version "0.41.6" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a" - dependencies: - source-map-support "^0.4.0" +rollup@^0.50.0: + version "0.50.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.50.0.tgz#4c158f4e780e6cb33ff0dbfc184a52cc58cd5f3b" -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" dependencies: - once "^1.3.0" + is-promise "^2.1.0" -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" @@ -2471,10 +2656,14 @@ semver-diff@^2.0.0: dependencies: semver "^5.0.3" -semver@^5.0.3, semver@^5.3.0: +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" +semver@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" + set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -2483,15 +2672,17 @@ set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" -shelljs@^0.7.5: - version "0.7.8" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" + shebang-regex "^1.0.0" -signal-exit@^3.0.0: +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + +signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -2499,13 +2690,11 @@ slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" -slice-ansi@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" - -slide@^1.1.5: - version "1.1.6" - resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" sntp@1.x.x: version "1.0.9" @@ -2513,16 +2702,34 @@ sntp@1.x.x: dependencies: hoek "2.x.x" -source-map-support@^0.4.0, source-map-support@^0.4.15: - version "0.4.16" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.16.tgz#16fecf98212467d017d586a2af68d628b9421cd8" +source-map-support@^0.4.15: + version "0.4.18" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" dependencies: source-map "^0.5.6" -source-map@^0.5.6, source-map@~0.5.1: +source-map@^0.5.6: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" +source-map@~0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + split@0.3: version "0.3.3" resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f" @@ -2553,16 +2760,6 @@ stream-combiner@~0.0.4: dependencies: duplexer "~0.1.1" -stream-shift@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - -string-length@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-1.0.1.tgz#56970fb1c38558e9e70b728bf3de269ac45adfac" - dependencies: - strip-ansi "^3.0.0" - string-width@^1.0.1, string-width@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -2571,7 +2768,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: +string-width@^2.0.0, string-width@^2.1.0, string-width@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -2604,6 +2801,10 @@ strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -2612,20 +2813,26 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -table@^3.7.8: - version "3.8.3" - resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" +supports-color@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" dependencies: - ajv "^4.7.0" - ajv-keywords "^1.0.0" - chalk "^1.1.1" - lodash "^4.0.0" - slice-ansi "0.0.4" - string-width "^2.0.0" + has-flag "^2.0.0" + +table@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" tar-pack@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.0.tgz#23be2d7f671a8339376cbdb0b8fe3fdebf317984" + version "3.4.1" + resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.4.1.tgz#e1dbc03a9b9d3ba07e896ad027317eb679a10a1f" dependencies: debug "^2.2.0" fstream "^1.0.10" @@ -2644,6 +2851,12 @@ tar@^2.2.1: fstream "^1.0.2" inherits "2" +term-size@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/term-size/-/term-size-1.2.0.tgz#458b83887f288fc56d6fffbfad262e26638efa69" + dependencies: + execa "^0.7.0" + text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -2659,23 +2872,29 @@ through@2, through@^2.3.6, through@~2.3, through@~2.3.1: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" -timed-out@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-2.0.0.tgz#f38b0ae81d3747d628001f41dafc652ace671c0a" +timed-out@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + dependencies: + os-tmpdir "~1.0.2" to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" -touch@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/touch/-/touch-1.0.0.tgz#449cbe2dbae5a8c8038e30d71fa0ff464947c4de" +touch@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" dependencies: nopt "~1.0.10" tough-cookie@~2.3.0: - version "2.3.2" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" + version "2.3.3" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561" dependencies: punycode "^1.4.1" @@ -2707,27 +2926,19 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -uglify-js-harmony@^2.7.7: - version "2.7.7" - resolved "https://registry.yarnpkg.com/uglify-js-harmony/-/uglify-js-harmony-2.7.7.tgz#6a43993211fa5da2f1e58416d61f329327eef335" +uglify-es@^3.1.6: + version "3.1.6" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.1.6.tgz#b0f818c055a7e9538abc2286e70c743f2938311f" dependencies: - async "~0.2.6" - source-map "~0.5.1" - uglify-to-browserify "~1.0.0" - yargs "~3.10.0" + commander "~2.11.0" + source-map "~0.6.1" -uglify-js@^2.6.1: - version "2.8.29" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" +uglify-js@^3.0.9: + version "3.1.6" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.6.tgz#918832602036e95d2318e11f27ee8461a8592c5d" dependencies: - source-map "~0.5.1" - yargs "~3.10.0" - optionalDependencies: - uglify-to-browserify "~1.0.0" - -uglify-to-browserify@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" + commander "~2.11.0" + source-map "~0.6.1" uid-number@^0.0.6: version "0.0.6" @@ -2737,45 +2948,50 @@ undefsafe@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-0.0.3.tgz#ecca3a03e56b9af17385baac812ac83b994a962f" -update-notifier@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-0.5.0.tgz#07b5dc2066b3627ab3b4f530130f7eddda07a4cc" +unique-string@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a" dependencies: - chalk "^1.0.0" - configstore "^1.0.0" + crypto-random-string "^1.0.0" + +unzip-response@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" + +update-notifier@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.3.0.tgz#4e8827a6bb915140ab093559d7014e3ebb837451" + dependencies: + boxen "^1.2.1" + chalk "^2.0.1" + configstore "^3.0.0" + import-lazy "^2.1.0" + is-installed-globally "^0.1.0" is-npm "^1.0.0" - latest-version "^1.0.0" - repeating "^1.1.2" + latest-version "^3.0.0" semver-diff "^2.0.0" - string-length "^1.0.0" + xdg-basedir "^3.0.0" -user-home@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" - -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" +url-parse-lax@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" dependencies: - os-homedir "^1.0.0" + prepend-http "^1.0.1" util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" -uuid@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a" - uuid@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" -v8flags@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.1.1.tgz#aab1a1fa30d45f88dd321148875ac02c0b55e5b4" +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" dependencies: - user-home "^1.1.1" + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" verror@1.10.0: version "1.10.0" @@ -2786,8 +3002,14 @@ verror@1.10.0: extsprintf "^1.2.0" vlq@^0.2.1: - version "0.2.2" - resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.2.tgz#e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1" + version "0.2.3" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" + +which@^1.2.9: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" wide-align@^1.1.0: version "1.1.2" @@ -2795,13 +3017,11 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2" -window-size@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" - -wordwrap@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" +widest-line@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-1.0.0.tgz#0c09c85c2a94683d0d7eaf8ee097d564bf0e105c" + dependencies: + string-width "^1.0.1" wordwrap@~1.0.0: version "1.0.0" @@ -2811,13 +3031,13 @@ wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" -write-file-atomic@^1.1.2: - version "1.3.4" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" +write-file-atomic@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab" dependencies: graceful-fs "^4.1.11" imurmurhash "^0.1.4" - slide "^1.1.5" + signal-exit "^3.0.2" write@^0.2.1: version "0.2.1" @@ -2825,21 +3045,14 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -xdg-basedir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-2.0.0.tgz#edbc903cc385fc04523d966a335504b5504d1bd2" - dependencies: - os-homedir "^1.0.0" +xdg-basedir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" -xtend@^4.0.0, xtend@~4.0.1: +xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" -yargs@~3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" - dependencies: - camelcase "^1.0.2" - cliui "^2.1.0" - decamelize "^1.0.0" - window-size "0.1.0" +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" From 7889a0d590c2458398bf942b592b437b5d24030a Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Wed, 1 Nov 2017 21:04:12 +0100 Subject: [PATCH 10/22] Fix data not updating if 'variables' changes and apollo doesn't need a request --- src/smart-apollo.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/smart-apollo.js b/src/smart-apollo.js index 16aade0..c9c174d 100644 --- a/src/smart-apollo.js +++ b/src/smart-apollo.js @@ -199,7 +199,11 @@ export class SmartQuery extends SmartApollo { }) } - this.maySetLoading() + const currentResult = this.maySetLoading() + + if (!currentResult.loading) { + this.nextResult(currentResult) + } super.executeApollo(variables) } @@ -212,6 +216,7 @@ export class SmartQuery extends SmartApollo { } this.loading = true } + return currentResult } nextResult (result) { From c9c3ce42242662e6aac41ab18b9ec6921f97722a Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Wed, 1 Nov 2017 21:04:18 +0100 Subject: [PATCH 11/22] Version bump --- dist/vue-apollo.esm.js | 9 +++++++-- dist/vue-apollo.min.js | 2 +- dist/vue-apollo.umd.js | 9 +++++++-- package.json | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js index 85cd0ce..ff9a221 100644 --- a/dist/vue-apollo.esm.js +++ b/dist/vue-apollo.esm.js @@ -2872,7 +2872,11 @@ var SmartQuery = function (_SmartApollo) { }); } - this.maySetLoading(); + var currentResult = this.maySetLoading(); + + if (!currentResult.loading) { + this.nextResult(currentResult); + } get(SmartQuery.prototype.__proto__ || Object.getPrototypeOf(SmartQuery.prototype), 'executeApollo', this).call(this, variables); } @@ -2888,6 +2892,7 @@ var SmartQuery = function (_SmartApollo) { } this.loading = true; } + return currentResult; } }, { key: 'nextResult', @@ -3647,7 +3652,7 @@ function install(Vue, options) { ApolloProvider$1.install = install; // eslint-disable-next-line no-undef -ApolloProvider$1.version = "3.0.0-alpha.1"; +ApolloProvider$1.version = "3.0.0-alpha.2"; var ApolloProvider$$1 = ApolloProvider$1; diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js index 15b1a96..b15bfd5 100644 --- a/dist/vue-apollo.min.js +++ b/dist/vue-apollo.min.js @@ -1 +1 @@ -var VueApollo=function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){return!!(t?t.length:0)&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i=ht&&(u=h,l=!1,e=new g(e));t:for(;++a0&&r(u)?e>1?k(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function O(t,e,r){var i=e(t);return Ht(t)?i:o(i,r(t))}function j(t){return!(!W(t)||q(t))&&(F(t)||p(t)?Qt:mt).test(K(t))}function S(t){if(!W(t))return C(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&Et.call(t,i))&&r.push(i);return r}function $(t,e){return t=Object(t),A(t,e,function(e,r){return r in t})}function A(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=vt}function W(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function G(t){return!!t&&"object"==typeof t}function J(t){return"symbol"==typeof t||G(t)&&Lt.call(t)==gt}function U(t){return R(t)?m(t,!0):S(t)}function z(){return[]}function B(t,e,r){function i(e){var r=c,i=h;return c=h=void 0,d=e,p=t.apply(i,r)}function n(t){return d=t,v=setTimeout(a,e),b?i(t):p}function o(t){var r=e-(t-y);return g?oe(r,f-(t-d)):r}function s(t){var r=t-y;return void 0===y||r>=e||r<0||g&&t-d>=f}function a(){var t=se();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=se(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(Gt);return e=tt(e)||0,X(r)&&(b=!!r.leading,f=(g="maxWait"in r)?ne(tt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(se())},l}function X(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&ie.call(t)==Ut}function tt(t){if("number"==typeof t)return t;if(Z(t))return Jt;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(zt,"");var r=Xt.test(t);return r||Yt.test(t)?Zt(t.slice(2),r?2:8):Bt.test(t)?Jt:+t}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return!!t&&"object"==typeof t}function it(t){return"symbol"==typeof t||rt(t)&&ge.call(t)==le}function nt(t){if("number"==typeof t)return t;if(it(t))return ue;if(et(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=et(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ce,"");var r=fe.test(t);return r||pe.test(t)?ve(t.slice(2),r?2:8):he.test(t)?ue:+t}function ot(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function st(t){return ke.Vue.util.mergeOptions({},t)}function at(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function ut(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function lt(t,e){if(!lt.installed){lt.installed=!0,ke.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},Wt(t,Ne),t.data),o=Object.assign({},Wt(e,Ne),e.data),s={},a=0;a-1},d.prototype.set=function(t,e){var r=this.__data__,i=_(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},b.prototype.clear=function(){this.__data__={hash:new y,map:new(Nt||d),string:new y}},b.prototype.delete=function(t){return x(this,t).delete(t)},b.prototype.get=function(t){return x(this,t).get(t)},b.prototype.has=function(t){return x(this,t).has(t)},b.prototype.set=function(t,e){return x(this,t).set(t,e),this},g.prototype.add=g.prototype.push=function(t){return this.__data__.set(t,ft),this},g.prototype.has=function(t){return this.__data__.has(t)};var It=Kt?v(Kt,Object):z,Ft=Kt?function(t){for(var e=[];t;)o(e,It(t)),t=qt(t);return e}:z,Ht=Array.isArray,Wt=function(t,r){return r=Dt(void 0===r?t.length-1:r,0),function(){for(var i=arguments,n=-1,o=Dt(i.length-r,0),s=Array(o);++n=e||r<0||g&&t-d>=f}function a(){var t=we();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=we(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(ae);return e=nt(e)||0,et(r)&&(b=!!r.leading,f=(g="maxWait"in r)?me(nt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(we())},l}),Se=["variables","watch","update","result","error","loadingKey","watchLoading","skip","throttle","debounce","subscribeToMore","prefetch","manual"],$e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=(function(){function t(t){this.value=t}function e(e){function r(n,o){try{var s=e[n](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(s.done?"return":"normal",s.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}(n=n.next)?r(n.key,n.arg):o=null}var n,o;this._invoke=function(t,e){return new Promise(function(i,s){var a={key:t,arg:e,resolve:i,reject:s,next:null};o?o=o.next=a:(n=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),Pe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(Ae(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return Pe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Oe(e,this.options.throttle):e,e=this.options.debounce?je(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=Wt(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];Ae(this,e),i.query||(i={query:i});var o=Qe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return o.type="query",o.vueApolloSpecialKeys=Se,o.loading=!1,o}return Le(e,qe),Pe(e,[{key:"stop",value:function(){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)})),this.maySetLoading(),Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0)}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};Ke.install=lt,Ke.version="3.0.0-alpha.1";var Fe=Ke,He=null;return"undefined"!=typeof window?He=window.Vue:"undefined"!=typeof global&&(He=global.Vue),He&&He.use(Ke),t.install=lt,t.ApolloProvider=Fe,t.default=Ke,t.willPrefetch=function(t){return De.push(t),t},t}({}); +var VueApollo=function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){return!!(t?t.length:0)&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i=ht&&(u=h,l=!1,e=new g(e));t:for(;++a0&&r(u)?e>1?k(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function O(t,e,r){var i=e(t);return Ht(t)?i:o(i,r(t))}function j(t){return!(!W(t)||q(t))&&(F(t)||p(t)?Qt:mt).test(K(t))}function S(t){if(!W(t))return C(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&Et.call(t,i))&&r.push(i);return r}function $(t,e){return t=Object(t),A(t,e,function(e,r){return r in t})}function A(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=vt}function W(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function G(t){return!!t&&"object"==typeof t}function J(t){return"symbol"==typeof t||G(t)&&Lt.call(t)==gt}function U(t){return N(t)?m(t,!0):S(t)}function z(){return[]}function B(t,e,r){function i(e){var r=c,i=h;return c=h=void 0,d=e,p=t.apply(i,r)}function n(t){return d=t,v=setTimeout(a,e),b?i(t):p}function o(t){var r=e-(t-y);return g?oe(r,f-(t-d)):r}function s(t){var r=t-y;return void 0===y||r>=e||r<0||g&&t-d>=f}function a(){var t=se();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=se(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(Gt);return e=tt(e)||0,X(r)&&(b=!!r.leading,f=(g="maxWait"in r)?ne(tt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(se())},l}function X(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&ie.call(t)==Ut}function tt(t){if("number"==typeof t)return t;if(Z(t))return Jt;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(zt,"");var r=Xt.test(t);return r||Yt.test(t)?Zt(t.slice(2),r?2:8):Bt.test(t)?Jt:+t}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return!!t&&"object"==typeof t}function it(t){return"symbol"==typeof t||rt(t)&&ge.call(t)==le}function nt(t){if("number"==typeof t)return t;if(it(t))return ue;if(et(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=et(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ce,"");var r=fe.test(t);return r||pe.test(t)?ve(t.slice(2),r?2:8):he.test(t)?ue:+t}function ot(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function st(t){return ke.Vue.util.mergeOptions({},t)}function at(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function ut(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function lt(t,e){if(!lt.installed){lt.installed=!0,ke.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},Wt(t,De),t.data),o=Object.assign({},Wt(e,De),e.data),s={},a=0;a-1},d.prototype.set=function(t,e){var r=this.__data__,i=_(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},b.prototype.clear=function(){this.__data__={hash:new y,map:new(Dt||d),string:new y}},b.prototype.delete=function(t){return x(this,t).delete(t)},b.prototype.get=function(t){return x(this,t).get(t)},b.prototype.has=function(t){return x(this,t).has(t)},b.prototype.set=function(t,e){return x(this,t).set(t,e),this},g.prototype.add=g.prototype.push=function(t){return this.__data__.set(t,ft),this},g.prototype.has=function(t){return this.__data__.has(t)};var It=Kt?v(Kt,Object):z,Ft=Kt?function(t){for(var e=[];t;)o(e,It(t)),t=qt(t);return e}:z,Ht=Array.isArray,Wt=function(t,r){return r=Rt(void 0===r?t.length-1:r,0),function(){for(var i=arguments,n=-1,o=Rt(i.length-r,0),s=Array(o);++n=e||r<0||g&&t-d>=f}function a(){var t=we();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=we(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(ae);return e=nt(e)||0,et(r)&&(b=!!r.leading,f=(g="maxWait"in r)?me(nt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(we())},l}),Se=["variables","watch","update","result","error","loadingKey","watchLoading","skip","throttle","debounce","subscribeToMore","prefetch","manual"],$e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=(function(){function t(t){this.value=t}function e(e){function r(n,o){try{var s=e[n](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(s.done?"return":"normal",s.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}(n=n.next)?r(n.key,n.arg):o=null}var n,o;this._invoke=function(t,e){return new Promise(function(i,s){var a={key:t,arg:e,resolve:i,reject:s,next:null};o?o=o.next=a:(n=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),Pe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(Ae(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return Pe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Oe(e,this.options.throttle):e,e=this.options.debounce?je(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=Wt(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];Ae(this,e),i.query||(i={query:i});var o=Qe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return o.type="query",o.vueApolloSpecialKeys=Se,o.loading=!1,o}return Le(e,qe),Pe(e,[{key:"stop",value:function(){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)}));var r=this.maySetLoading();r.loading||this.nextResult(r),Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();return(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0),e}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};Ke.install=lt,Ke.version="3.0.0-alpha.2";var Fe=Ke,He=null;return"undefined"!=typeof window?He=window.Vue:"undefined"!=typeof global&&(He=global.Vue),He&&He.use(Ke),t.install=lt,t.ApolloProvider=Fe,t.default=Ke,t.willPrefetch=function(t){return Re.push(t),t},t}({}); diff --git a/dist/vue-apollo.umd.js b/dist/vue-apollo.umd.js index 5fea74e..9d90b6e 100644 --- a/dist/vue-apollo.umd.js +++ b/dist/vue-apollo.umd.js @@ -2878,7 +2878,11 @@ var SmartQuery = function (_SmartApollo) { }); } - this.maySetLoading(); + var currentResult = this.maySetLoading(); + + if (!currentResult.loading) { + this.nextResult(currentResult); + } get(SmartQuery.prototype.__proto__ || Object.getPrototypeOf(SmartQuery.prototype), 'executeApollo', this).call(this, variables); } @@ -2894,6 +2898,7 @@ var SmartQuery = function (_SmartApollo) { } this.loading = true; } + return currentResult; } }, { key: 'nextResult', @@ -3653,7 +3658,7 @@ function install(Vue, options) { ApolloProvider$1.install = install; // eslint-disable-next-line no-undef -ApolloProvider$1.version = "3.0.0-alpha.1"; +ApolloProvider$1.version = "3.0.0-alpha.2"; var ApolloProvider$$1 = ApolloProvider$1; diff --git a/package.json b/package.json index 85e62a8..c7aeeaa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-apollo", - "version": "3.0.0-alpha.1", + "version": "3.0.0-alpha.2", "description": "Vue apollo integration", "main": "dist/vue-apollo.umd.js", "module": "dist/vue-apollo.esm.js", From 8dcdb9299fea201d158fc1cff2a0c7903d0a3d7d Mon Sep 17 00:00:00 2001 From: joe-re Date: Fri, 22 Dec 2017 22:38:05 +0900 Subject: [PATCH 12/22] TypeScript support (#160) * TypeScript support * set defaultOptions key to VueApollo constructor --- .gitignore | 1 + .npmignore | 1 + package.json | 15 ++- types/index.d.ts | 4 + types/test/App.ts | 194 +++++++++++++++++++++++++++++++++++++++ types/test/index.ts | 19 ++++ types/test/tsconfig.json | 28 ++++++ types/vue-apollo.d.ts | 84 +++++++++++++++++ types/vue.d.ts | 15 +++ yarn.lock | 96 +++++++++++++++++++ 10 files changed, 455 insertions(+), 2 deletions(-) create mode 100644 types/index.d.ts create mode 100644 types/test/App.ts create mode 100644 types/test/index.ts create mode 100644 types/test/tsconfig.json create mode 100644 types/vue-apollo.d.ts create mode 100644 types/vue.d.ts diff --git a/.gitignore b/.gitignore index c2658d7..c4d3bd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +types/test/*.js diff --git a/.npmignore b/.npmignore index 8eba6c8..fa50248 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ src/ +types/test/ diff --git a/package.json b/package.json index c7aeeaa..d283df4 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,15 @@ "main": "dist/vue-apollo.umd.js", "module": "dist/vue-apollo.esm.js", "unpkg": "dist/vue-apollo.min.js", + "typings": "types/index.d.ts", "scripts": { "build": "npm run build:browser && npm run build:es && npm run build:umd", "build:browser": "rollup --config build/rollup.config.browser.js", "build:es": "rollup --config build/rollup.config.es.js", "build:umd": "rollup --config build/rollup.config.umd.js", "prepublish": "npm run build", - "dev": "npm-watch" + "dev": "npm-watch", + "test:types": "tsc -p types/test" }, "watch": { "build": "src/*.js" @@ -40,6 +42,11 @@ "lodash.throttle": "^4.1.1" }, "devDependencies": { + "@types/graphql": "^0.11.7", + "apollo-cache-inmemory": "^1.1.1", + "apollo-client": "^2.0.3", + "apollo-link": "^1.0.3", + "apollo-link-http": "^1.2.0", "babel-core": "^6.26.0", "babel-eslint": "^7.1.1", "babel-plugin-external-helpers": "^6.22.0", @@ -51,6 +58,8 @@ "eslint-plugin-node": "^5.2.1", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", + "graphql": "^0.11.7", + "graphql-tag": "^2.5.0", "npm-watch": "^0.3.0", "rimraf": "^2.6.1", "rollup": "^0.50.0", @@ -59,6 +68,8 @@ "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-replace": "^2.0.0", "rollup-plugin-uglify": "^2.0.1", - "uglify-es": "^3.1.6" + "typescript": "^2.6.2", + "uglify-es": "^3.1.6", + "vue": "^2.5.9" } } diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..f99e279 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,4 @@ +import './vue' +import { VueApollo } from './vue-apollo'; + +export default VueApollo; \ No newline at end of file diff --git a/types/test/App.ts b/types/test/App.ts new file mode 100644 index 0000000..803fde5 --- /dev/null +++ b/types/test/App.ts @@ -0,0 +1,194 @@ +// this example src is https://github.com/Akryum/vue-apollo-example +import gql from 'graphql-tag'; +import Vue from 'vue'; +const pageSize = 10; +const SUB_QUERY = gql`subscription tags($type: String!) { + tagAdded(type: $type) { + id + label + type + } +}`; +export default Vue.extend({ + data () { + return { + newTag: null, + updateCount: 0, + type: 'City', + skipQuery: false, + loading: 0, + tagsLoading: 0, + tagsPageLoading: 0, + showTag: 'random', + showMoreEnabled: true, + page: 0, + _type: '' + } + }, + apollo: { + $client: 'a', + $loadingKey: 'loading', + tags() { + return { + query: gql`query tagList ($type: String!) { + tags(type: $type) { + id + label + } + }`, + // Reactive variables + variables () { + return { + type: this.type, + }; + }, + manual: true, + pollInterval: 300, + result (result) { + this.updateCount ++; + }, + skip () { + return this.skipQuery + }, + fetchPolicy: 'cache-and-network', + subscribeToMore: [{ + document: SUB_QUERY, + variables () { + return { type: this.type, } + }, + updateQuery: (previousResult, { subscriptionData }) => { + console.log('new tag', subscriptionData.data.tagAdded) + if (previousResult.tags.find((tag: any) => tag.id === subscriptionData.data.tagAdded.id)) { + return previousResult + } + return { + tags: [ + ...previousResult.tags, + subscriptionData.data.tagAdded, + ], + } + }, + }], + } + }, + randomTag: { + query () { + if (this.showTag === 'random') { + return gql`{ + randomTag { + id + label + type + } + }` + } else if (this.showTag === 'last') { + return gql`{ + randomTag: lastTag { + id + label + type + } + }` + } + }, + }, + tagsPage: { + // GraphQL Query + query: gql`query tagsPage ($page: Int!, $pageSize: Int!) { + tagsPage(page: $page, size: $pageSize) { + tags { + id + label + type + } + hasMore + } + }`, + variables: { + page: 0, + pageSize, + }, + }, + }, + methods: { + addTag() { + const newTag = this.newTag; + this.$apollo.mutate({ + mutation: gql`mutation ($type: String!, $label: String!) { + addTag(type: $type, label: $label) { + id + label + } + }`, + variables: { type: this.type, label: newTag, }, + updateQueries: { + tagList: (previousResult, { mutationResult }) => { + const { data } = mutationResult; + if (!data) { return previousResult } + if (previousResult.tags.find((tag: any) => tag.id === data.addTag.id)) { + return previousResult + } + return { tags: [ ...previousResult.tags, data.addTag ] }; + }, + }, + optimisticResponse: { + __typename: 'Mutation', + addTag: { + __typename: 'Tag', + id: -1, + label: newTag, + type: this.type, + }, + }, + }).then((data) => { + console.log(data); + }).catch((error) => { + console.error(error); + this.newTag = newTag; + }); + }, + showMore() { + this.page ++; + this.$apollo.queries.tagsPage.fetchMore({ + variables: { + page: this.page, + pageSize, + }, + // Mutate the previous result + updateQuery: (previousResult: any, result: { fetchMoreResult: any }) => { + const { fetchMoreResult } = result; + const newTags = fetchMoreResult.tagsPage.tags; + const hasMore = fetchMoreResult.tagsPage.hasMore; + this.showMoreEnabled = hasMore; + return { + tagsPage: { + __typename: previousResult.tagsPage.__typename, + tags: [ + ...previousResult.tagsPage.tags, + // Add the new tags + ...newTags, + ], + hasMore, + }, + }; + }, + }); + }, + refetchTags () { + this.$apollo.queries.tags.refetch() + }, + }, +mounted() { + const observer = this.$apollo.subscribe({ + query: SUB_QUERY, + variables: { + type: 'Companies', + }, + }); + observer.subscribe({ + next(data) { + console.log('this.$apollo.subscribe', data); + }, + }); + }, +}); \ No newline at end of file diff --git a/types/test/index.ts b/types/test/index.ts new file mode 100644 index 0000000..f179784 --- /dev/null +++ b/types/test/index.ts @@ -0,0 +1,19 @@ +import Vue from 'vue' + +import 'isomorphic-fetch' +import { ApolloClient } from 'apollo-client' +import { HttpLink } from 'apollo-link-http' +import { ApolloLink, split } from 'apollo-link' +import { getMainDefinition } from 'apollo-utilities' + +import VueApollo from '../index' +import App from './App' + +const httpLink = new HttpLink({ uri: 'https://dummy.test.com' }) +const cache: any = 'dummy cache'; +const apolloClient = new ApolloClient({ link: httpLink, cache, connectToDevTools: true }) +const apolloProvider = new VueApollo({ defaultClient: apolloClient }) + +Vue.use(VueApollo) + +new Vue({ el: '#app', apolloProvider, render: h => h(App), }) \ No newline at end of file diff --git a/types/test/tsconfig.json b/types/test/tsconfig.json new file mode 100644 index 0000000..9ebbc08 --- /dev/null +++ b/types/test/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": [ + "es5", + "es6", + "dom", + "es2015.core", + "es2015.collection", + "es2015.generator", + "es2015.iterable", + "es2015.promise", + "es2015.proxy", + "es2015.reflect", + "es2015.symbol", + "es2015.symbol.wellknown", + "esnext.asynciterable" + ], + "module": "es2015", + "moduleResolution": "node", + "experimentalDecorators": true, + "strict": true + }, + "include": [ + "*.ts", + "../*.d.ts" + ] +} diff --git a/types/vue-apollo.d.ts b/types/vue-apollo.d.ts new file mode 100644 index 0000000..87007eb --- /dev/null +++ b/types/vue-apollo.d.ts @@ -0,0 +1,84 @@ +import Vue, { PluginObject, PluginFunction } from 'vue'; +import { DocumentNode } from 'graphql'; +import { ApolloClient } from 'apollo-client'; +import { WatchQueryOptions, MutationOptions, SubscriptionOptions, SubscribeToMoreOptions, ObservableQuery, NetworkStatus } from 'apollo-client' +import { DataProxy } from 'apollo-cache'; +import { subscribe } from 'graphql/subscription/subscribe'; + +// include Omit type from https://github.com/Microsoft/TypeScript/issues/12215 +type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; +type Omit = { [P in Diff]?: T[P] }; + +type VueApolloOptions = { + $skip?: boolean, + $skipAllQueries?: boolean, + $skipAllSubscriptions?: boolean, + $client?: string, + $loadingKey?: string, + $error?: Function +} + +export class VueApollo implements PluginObject<{}> { + [key: string]: any; + install: PluginFunction<{}>; + constructor (options: { defaultClient: ApolloClient<{}>, defaultOptions?: VueApolloOptions }); + static install(pVue: typeof Vue, options?:{} | undefined): void; +} + +type ApolloVueThisType = V & { [key: string]: any }; +type VariableFn = ((this: ApolloVueThisType) => Object) | Object; +type ApolloVueUpdateQueryFn = (this: ApolloVueThisType, previousQueryResult: { [key: string]: any }, options: { + error: any, + subscriptionData: { data: any; }; + variables?: { [key: string]: any; }; +}) => Object; + +interface ApolloVueSubscribeToMoreOptions { + document: DocumentNode; + variables?: VariableFn; + updateQuery?: ApolloVueUpdateQueryFn; + onError?: (error: Error) => void; +} + +type _WatchQueryOptions = Omit; // exclude query prop because it causes type incorrectly error +export interface VueApolloQueryOptions extends _WatchQueryOptions { + query: ((this: ApolloVueThisType) => DocumentNode) | DocumentNode; + variables?: VariableFn; + update?: (this: ApolloVueThisType, data: R) => any; + result?: (this: ApolloVueThisType, data: R, loader: any, netWorkStatus: NetworkStatus) => void; + error?: (this: ApolloVueThisType, error: any) => void; + loadingKey?: string; + watchLoading?: (isLoading: boolean, countModifier: number) => void; + skip?: (this: ApolloVueThisType) => boolean | boolean; + manual?: boolean; + subscribeToMore?: ApolloVueSubscribeToMoreOptions | ApolloVueSubscribeToMoreOptions[]; +} + +export interface VueApolloMutationOptions extends MutationOptions { + mutation: DocumentNode; + variables?: VariableFn; + optimisticResponse?: ((this: ApolloVueThisType) => any) | Object; +} + +export interface VueApolloSubscriptionOptions extends SubscriptionOptions { + query: DocumentNode; + variables?: VariableFn; + result?: (this: V, data: R) => void; +} + +type Query = (key: string, options: VueApolloQueryOptions) => void; +type Mutate = (params: VueApolloMutationOptions) => Promise; +type Subscribe = (params: SubscriptionOptions) => ObservableQuery; +export interface ApolloProperty { + [key: string]: Query | Mutate | Subscribe; // smart query + queries: any; + mutate: Mutate; + subscribe: Subscribe; +} +type QueryComponentProperty = ((this: ApolloVueThisType) => VueApolloQueryOptions) | VueApolloQueryOptions +type SubscribeComponentProperty = VueApolloSubscriptionOptions | { [key: string]: VueApolloSubscriptionOptions } + +export interface VueApolloComponentOption extends VueApolloOptions { + [key: string]: QueryComponentProperty | SubscribeComponentProperty | string | boolean | Function | undefined; + $subscribe?: SubscribeComponentProperty; +} diff --git a/types/vue.d.ts b/types/vue.d.ts new file mode 100644 index 0000000..183a284 --- /dev/null +++ b/types/vue.d.ts @@ -0,0 +1,15 @@ +import Vue from "vue"; +import { VueApollo, VueApolloComponentOption, ApolloProperty } from './vue-apollo'; + +declare module "vue/types/options" { + interface ComponentOptions { + apolloProvider?: VueApollo; + apollo?: VueApolloComponentOption; + } +} + +declare module "vue/types/vue" { + interface Vue { + $apollo: ApolloProperty; + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 633855c..e783976 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,18 @@ # yarn lockfile v1 +"@types/async@2.0.45": + version "2.0.45" + resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.45.tgz#0cfe971d7ed5542695740338e0455c91078a0e83" + +"@types/graphql@^0.11.7": + version "0.11.7" + resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.11.7.tgz#da39a2f7c74e793e32e2bb7b3b68da1691532dd5" + +"@types/zen-observable@0.5.3", "@types/zen-observable@^0.5.3": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.5.3.tgz#91b728599544efbb7386d8b6633693a3c2e7ade5" + abbrev@1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -75,6 +87,54 @@ anymatch@^1.3.0: micromatch "^2.1.5" normalize-path "^2.0.0" +apollo-cache-inmemory@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.1.1.tgz#1511f00eb845da88504abf867f408c3026a909ba" + dependencies: + apollo-cache "^1.0.1" + apollo-utilities "^1.0.2" + graphql-anywhere "^4.0.1" + +apollo-cache@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.0.1.tgz#66c16141173bc752d3ad3dce990310c10dfc4076" + dependencies: + apollo-utilities "^1.0.2" + +apollo-client@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.0.3.tgz#f99f32e2c851bbd52da1e1b113ce8f6a0cf94945" + dependencies: + "@types/zen-observable" "^0.5.3" + apollo-cache "^1.0.1" + apollo-link "^1.0.0" + apollo-link-dedup "^1.0.0" + apollo-utilities "^1.0.2" + symbol-observable "^1.0.2" + zen-observable "^0.6.0" + optionalDependencies: + "@types/async" "2.0.45" + +apollo-link-dedup@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.2.tgz#bab659dde41f8dd627839142d4dad90e55251110" + +apollo-link-http@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.2.0.tgz#48464c2ebfa6474f7a89908696827d66b2deb5cc" + +apollo-link@^1.0.0, apollo-link@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.0.3.tgz#759c36abeeb99e227eca45f919ee07fb8fee911e" + dependencies: + "@types/zen-observable" "0.5.3" + apollo-utilities "^1.0.0" + zen-observable "^0.6.0" + +apollo-utilities@^1.0.0, apollo-utilities@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.2.tgz#bcf348a7e613e82e2624ddb5be2b9f6bf1259c6d" + aproba@^1.0.3: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -1530,6 +1590,22 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +graphql-anywhere@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.0.1.tgz#eb53ed5c56ef42e21d34dc22951e3da38f88a342" + dependencies: + apollo-utilities "^1.0.2" + +graphql-tag@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.5.0.tgz#b43bfd8b5babcd2c205ad680c03e98b238934e0f" + +graphql@^0.11.7: + version "0.11.7" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.7.tgz#e5abaa9cb7b7cccb84e9f0836bf4370d268750c6" + dependencies: + iterall "1.1.3" + har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" @@ -1812,6 +1888,10 @@ isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" +iterall@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.1.3.tgz#1cbbff96204056dde6656e2ed2e2226d0e6d72c9" + js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" @@ -2819,6 +2899,10 @@ supports-color@^4.0.0: dependencies: has-flag "^2.0.0" +symbol-observable@^1.0.2: + version "1.1.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.1.0.tgz#5c68fd8d54115d9dfb72a84720549222e8db9b32" + table@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" @@ -2926,6 +3010,10 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" +typescript@^2.6.2: + version "2.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" + uglify-es@^3.1.6: version "3.1.6" resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.1.6.tgz#b0f818c055a7e9538abc2286e70c743f2938311f" @@ -3005,6 +3093,10 @@ vlq@^0.2.1: version "0.2.3" resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" +vue@^2.5.9: + version "2.5.9" + resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.9.tgz#b2380cd040915dca69881dafd121d760952e65f7" + which@^1.2.9: version "1.3.0" resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" @@ -3056,3 +3148,7 @@ xtend@~4.0.1: yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + +zen-observable@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.6.0.tgz#8a6157ed15348d185d948cfc4a59d90a2c0f70ee" From 91dc053c93766bfdaec912d36d28000ab10eb62c Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Fri, 22 Dec 2017 15:03:08 +0100 Subject: [PATCH 13/22] Version bump --- README.md | 4 ++-- dist/vue-apollo.esm.js | 2 +- dist/vue-apollo.min.js | 2 +- dist/vue-apollo.umd.js | 2 +- package.json | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e2a9904..456fe34 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Apollo and GraphQL for Vue.js -[![npm](https://img.shields.io/badge/v-next-blue.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) +[![npm](https://img.shields.io/npm/v/npm/next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) ![schema](https://cdn-images-1.medium.com/max/800/1*H9AANoofLqjS10Xd5TwRYw.png) -**Warning! This README is related to the next version of vue-apollo. For the stable release, see [here](https://github.com/Akryum/vue-apollo/tree/master).** +**Warning! This README is related to the next version of vue-apollo (that supports Apollo 2.x). For the old release (supporting only Apollo 1.x), see [here](https://github.com/Akryum/vue-apollo/tree/master).** Integrates [apollo](http://www.apollodata.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/) diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js index ff9a221..14fb390 100644 --- a/dist/vue-apollo.esm.js +++ b/dist/vue-apollo.esm.js @@ -3652,7 +3652,7 @@ function install(Vue, options) { ApolloProvider$1.install = install; // eslint-disable-next-line no-undef -ApolloProvider$1.version = "3.0.0-alpha.2"; +ApolloProvider$1.version = "3.0.0-alpha.3"; var ApolloProvider$$1 = ApolloProvider$1; diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js index b15bfd5..0b9d2f2 100644 --- a/dist/vue-apollo.min.js +++ b/dist/vue-apollo.min.js @@ -1 +1 @@ -var VueApollo=function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){return!!(t?t.length:0)&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i=ht&&(u=h,l=!1,e=new g(e));t:for(;++a0&&r(u)?e>1?k(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function O(t,e,r){var i=e(t);return Ht(t)?i:o(i,r(t))}function j(t){return!(!W(t)||q(t))&&(F(t)||p(t)?Qt:mt).test(K(t))}function S(t){if(!W(t))return C(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&Et.call(t,i))&&r.push(i);return r}function $(t,e){return t=Object(t),A(t,e,function(e,r){return r in t})}function A(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=vt}function W(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function G(t){return!!t&&"object"==typeof t}function J(t){return"symbol"==typeof t||G(t)&&Lt.call(t)==gt}function U(t){return N(t)?m(t,!0):S(t)}function z(){return[]}function B(t,e,r){function i(e){var r=c,i=h;return c=h=void 0,d=e,p=t.apply(i,r)}function n(t){return d=t,v=setTimeout(a,e),b?i(t):p}function o(t){var r=e-(t-y);return g?oe(r,f-(t-d)):r}function s(t){var r=t-y;return void 0===y||r>=e||r<0||g&&t-d>=f}function a(){var t=se();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=se(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(Gt);return e=tt(e)||0,X(r)&&(b=!!r.leading,f=(g="maxWait"in r)?ne(tt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(se())},l}function X(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&ie.call(t)==Ut}function tt(t){if("number"==typeof t)return t;if(Z(t))return Jt;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(zt,"");var r=Xt.test(t);return r||Yt.test(t)?Zt(t.slice(2),r?2:8):Bt.test(t)?Jt:+t}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return!!t&&"object"==typeof t}function it(t){return"symbol"==typeof t||rt(t)&&ge.call(t)==le}function nt(t){if("number"==typeof t)return t;if(it(t))return ue;if(et(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=et(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ce,"");var r=fe.test(t);return r||pe.test(t)?ve(t.slice(2),r?2:8):he.test(t)?ue:+t}function ot(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function st(t){return ke.Vue.util.mergeOptions({},t)}function at(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function ut(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function lt(t,e){if(!lt.installed){lt.installed=!0,ke.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},Wt(t,De),t.data),o=Object.assign({},Wt(e,De),e.data),s={},a=0;a-1},d.prototype.set=function(t,e){var r=this.__data__,i=_(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},b.prototype.clear=function(){this.__data__={hash:new y,map:new(Dt||d),string:new y}},b.prototype.delete=function(t){return x(this,t).delete(t)},b.prototype.get=function(t){return x(this,t).get(t)},b.prototype.has=function(t){return x(this,t).has(t)},b.prototype.set=function(t,e){return x(this,t).set(t,e),this},g.prototype.add=g.prototype.push=function(t){return this.__data__.set(t,ft),this},g.prototype.has=function(t){return this.__data__.has(t)};var It=Kt?v(Kt,Object):z,Ft=Kt?function(t){for(var e=[];t;)o(e,It(t)),t=qt(t);return e}:z,Ht=Array.isArray,Wt=function(t,r){return r=Rt(void 0===r?t.length-1:r,0),function(){for(var i=arguments,n=-1,o=Rt(i.length-r,0),s=Array(o);++n=e||r<0||g&&t-d>=f}function a(){var t=we();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=we(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(ae);return e=nt(e)||0,et(r)&&(b=!!r.leading,f=(g="maxWait"in r)?me(nt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(we())},l}),Se=["variables","watch","update","result","error","loadingKey","watchLoading","skip","throttle","debounce","subscribeToMore","prefetch","manual"],$e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=(function(){function t(t){this.value=t}function e(e){function r(n,o){try{var s=e[n](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(s.done?"return":"normal",s.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}(n=n.next)?r(n.key,n.arg):o=null}var n,o;this._invoke=function(t,e){return new Promise(function(i,s){var a={key:t,arg:e,resolve:i,reject:s,next:null};o?o=o.next=a:(n=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),Pe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(Ae(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return Pe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Oe(e,this.options.throttle):e,e=this.options.debounce?je(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=Wt(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];Ae(this,e),i.query||(i={query:i});var o=Qe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return o.type="query",o.vueApolloSpecialKeys=Se,o.loading=!1,o}return Le(e,qe),Pe(e,[{key:"stop",value:function(){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)}));var r=this.maySetLoading();r.loading||this.nextResult(r),Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();return(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0),e}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};Ke.install=lt,Ke.version="3.0.0-alpha.2";var Fe=Ke,He=null;return"undefined"!=typeof window?He=window.Vue:"undefined"!=typeof global&&(He=global.Vue),He&&He.use(Ke),t.install=lt,t.ApolloProvider=Fe,t.default=Ke,t.willPrefetch=function(t){return Re.push(t),t},t}({}); +var VueApollo=function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){return!!(t?t.length:0)&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i=ht&&(u=h,l=!1,e=new g(e));t:for(;++a0&&r(u)?e>1?k(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function O(t,e,r){var i=e(t);return Ht(t)?i:o(i,r(t))}function j(t){return!(!W(t)||q(t))&&(F(t)||p(t)?Qt:mt).test(K(t))}function S(t){if(!W(t))return C(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&Et.call(t,i))&&r.push(i);return r}function $(t,e){return t=Object(t),A(t,e,function(e,r){return r in t})}function A(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=vt}function W(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function G(t){return!!t&&"object"==typeof t}function J(t){return"symbol"==typeof t||G(t)&&Lt.call(t)==gt}function U(t){return N(t)?m(t,!0):S(t)}function z(){return[]}function B(t,e,r){function i(e){var r=c,i=h;return c=h=void 0,d=e,p=t.apply(i,r)}function n(t){return d=t,v=setTimeout(a,e),b?i(t):p}function o(t){var r=e-(t-y);return g?oe(r,f-(t-d)):r}function s(t){var r=t-y;return void 0===y||r>=e||r<0||g&&t-d>=f}function a(){var t=se();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=se(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(Gt);return e=tt(e)||0,X(r)&&(b=!!r.leading,f=(g="maxWait"in r)?ne(tt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(se())},l}function X(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&ie.call(t)==Ut}function tt(t){if("number"==typeof t)return t;if(Z(t))return Jt;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(zt,"");var r=Xt.test(t);return r||Yt.test(t)?Zt(t.slice(2),r?2:8):Bt.test(t)?Jt:+t}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return!!t&&"object"==typeof t}function it(t){return"symbol"==typeof t||rt(t)&&ge.call(t)==le}function nt(t){if("number"==typeof t)return t;if(it(t))return ue;if(et(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=et(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ce,"");var r=fe.test(t);return r||pe.test(t)?ve(t.slice(2),r?2:8):he.test(t)?ue:+t}function ot(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function st(t){return ke.Vue.util.mergeOptions({},t)}function at(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function ut(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function lt(t,e){if(!lt.installed){lt.installed=!0,ke.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},Wt(t,De),t.data),o=Object.assign({},Wt(e,De),e.data),s={},a=0;a-1},d.prototype.set=function(t,e){var r=this.__data__,i=_(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},b.prototype.clear=function(){this.__data__={hash:new y,map:new(Dt||d),string:new y}},b.prototype.delete=function(t){return x(this,t).delete(t)},b.prototype.get=function(t){return x(this,t).get(t)},b.prototype.has=function(t){return x(this,t).has(t)},b.prototype.set=function(t,e){return x(this,t).set(t,e),this},g.prototype.add=g.prototype.push=function(t){return this.__data__.set(t,ft),this},g.prototype.has=function(t){return this.__data__.has(t)};var It=Kt?v(Kt,Object):z,Ft=Kt?function(t){for(var e=[];t;)o(e,It(t)),t=qt(t);return e}:z,Ht=Array.isArray,Wt=function(t,r){return r=Rt(void 0===r?t.length-1:r,0),function(){for(var i=arguments,n=-1,o=Rt(i.length-r,0),s=Array(o);++n=e||r<0||g&&t-d>=f}function a(){var t=we();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=we(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(ae);return e=nt(e)||0,et(r)&&(b=!!r.leading,f=(g="maxWait"in r)?me(nt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(we())},l}),Se=["variables","watch","update","result","error","loadingKey","watchLoading","skip","throttle","debounce","subscribeToMore","prefetch","manual"],$e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=(function(){function t(t){this.value=t}function e(e){function r(n,o){try{var s=e[n](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(s.done?"return":"normal",s.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}(n=n.next)?r(n.key,n.arg):o=null}var n,o;this._invoke=function(t,e){return new Promise(function(i,s){var a={key:t,arg:e,resolve:i,reject:s,next:null};o?o=o.next=a:(n=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),Pe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(Ae(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return Pe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Oe(e,this.options.throttle):e,e=this.options.debounce?je(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=Wt(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];Ae(this,e),i.query||(i={query:i});var o=Qe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return o.type="query",o.vueApolloSpecialKeys=Se,o.loading=!1,o}return Le(e,qe),Pe(e,[{key:"stop",value:function(){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)}));var r=this.maySetLoading();r.loading||this.nextResult(r),Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();return(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0),e}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};Ke.install=lt,Ke.version="3.0.0-alpha.3";var Fe=Ke,He=null;return"undefined"!=typeof window?He=window.Vue:"undefined"!=typeof global&&(He=global.Vue),He&&He.use(Ke),t.install=lt,t.ApolloProvider=Fe,t.default=Ke,t.willPrefetch=function(t){return Re.push(t),t},t}({}); diff --git a/dist/vue-apollo.umd.js b/dist/vue-apollo.umd.js index 9d90b6e..535089a 100644 --- a/dist/vue-apollo.umd.js +++ b/dist/vue-apollo.umd.js @@ -3658,7 +3658,7 @@ function install(Vue, options) { ApolloProvider$1.install = install; // eslint-disable-next-line no-undef -ApolloProvider$1.version = "3.0.0-alpha.2"; +ApolloProvider$1.version = "3.0.0-alpha.3"; var ApolloProvider$$1 = ApolloProvider$1; diff --git a/package.json b/package.json index d283df4..1fbf7ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-apollo", - "version": "3.0.0-alpha.2", + "version": "3.0.0-alpha.3", "description": "Vue apollo integration", "main": "dist/vue-apollo.umd.js", "module": "dist/vue-apollo.esm.js", @@ -11,8 +11,9 @@ "build:browser": "rollup --config build/rollup.config.browser.js", "build:es": "rollup --config build/rollup.config.es.js", "build:umd": "rollup --config build/rollup.config.umd.js", - "prepublish": "npm run build", + "prepublishOnly": "npm run test && npm run build", "dev": "npm-watch", + "test": "npm run test:types", "test:types": "tsc -p types/test" }, "watch": { From 4c5a70a3e670855811eb547f0f5dff6b19c2270f Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Fri, 22 Dec 2017 15:04:47 +0100 Subject: [PATCH 14/22] Fix badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 456fe34..9e29a38 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Apollo and GraphQL for Vue.js -[![npm](https://img.shields.io/npm/v/npm/next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) +[![npm](https://img.shields.io/npm/v/vue-apollo/next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) From eee91e5dc206bd7af9bee92360e3279f41a7cc66 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Fri, 5 Jan 2018 13:48:05 +0100 Subject: [PATCH 15/22] Updated links + some minor fixes and changes --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9e29a38..f49e6b5 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Apollo and GraphQL for Vue.js [![npm](https://img.shields.io/npm/v/vue-apollo/next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) -[![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](http://apollodata.com/) +[![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](https://www.apollographql.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) ![schema](https://cdn-images-1.medium.com/max/800/1*H9AANoofLqjS10Xd5TwRYw.png) **Warning! This README is related to the next version of vue-apollo (that supports Apollo 2.x). For the old release (supporting only Apollo 1.x), see [here](https://github.com/Akryum/vue-apollo/tree/master).** -Integrates [apollo](http://www.apollodata.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/) +Integrates [apollo](https://www.apollographql.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/) [icon More vue-apollo examples](https://github.com/Akryum/vue-apollo-example) @@ -108,7 +108,7 @@ new Vue({ }) ``` -You can access the [apollo-client](http://dev.apollodata.com/core/apollo-client-api.html) instances with `this.$apollo.provider.defaultClient` or `this.$apollo.provider.clients.` (for [Multiple clients](#multiple-clients)) in all your vue components. +You can access the [apollo-client](https://www.apollographql.com/docs/react/) instances with `this.$apollo.provider.defaultClient` or `this.$apollo.provider.clients.` (for [Multiple clients](#multiple-clients)) in all your vue components. ## Queries @@ -122,7 +122,7 @@ Use `gql` to write your GraphQL queries: import gql from 'graphql-tag' ``` -Put the [gql](http://docs.apollostack.com/apollo-client/core.html#gql) query directly as the value: +Put the [gql](https://github.com/apollographql/graphql-tag) query directly as the value: ```javascript apollo: { @@ -166,7 +166,7 @@ export const resolvers = { } ``` -For more info, visit the [apollo doc](http://dev.apollodata.com/tools/). +For more info, visit the [apollo doc](https://www.apollographql.com/docs/apollo-server/). You can then use your property as usual in your vue component: @@ -207,9 +207,9 @@ You can use the apollo `watchQuery` options in the object, like: - `pollInterval` - ... -See the [apollo doc](http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient\.watchQuery) for more details. +See the [apollo doc](https://www.apollographql.com/docs/react/reference/index.html#ApolloClient\.watchQuery) for more details. -For example, you could add the `forceFetch` apollo option like this: +For example, you could add the `fetchPolicy` apollo option like this: ```javascript apollo: { @@ -414,7 +414,7 @@ this.$apollo.queries.tags.skip = true These are the available advanced options you can use: - `update(data) {return ...}` to customize the value that is set in the vue property, for example if the field names don't match. -- `result(ApolloQueryResult)` is a hook called when a result is received (see documentation for [ApolloQueryResult](http://dev.apollodata.com/core/apollo-client-api.html#ApolloQueryResult)). +- `result(ApolloQueryResult)` is a hook called when a result is received (see documentation for [ApolloQueryResult](https://github.com/apollographql/apollo-client/blob/master/packages/apollo-client/src/core/types.ts)). - `error(error)` is a hook called when there are errors. `error` is an Apollo error object with either a `graphQLErrors` property or a `networkError` property. - `loadingKey` will update the component data property you pass as the value. You should initialize this property to `0` in the component `data()` hook. When the query is loading, this property will be incremented by 1; when it is no longer loading, it will be decremented by 1. That way, the property can represent a counter of currently loading queries. - `watchLoading(isLoading, countModifier)` is a hook called when the loading state of the query changes. The `countModifier` parameter is either equal to `1` when the query is loading, or `-1` when the query is no longer loading. @@ -573,7 +573,9 @@ created () { ## Mutations -Mutations are queries that change your data state on your apollo server. For more info, visit the [apollo doc](http://dev.apollodata.com/core/apollo-client-api.html#ApolloClient\.mutate). There is a mutation-focused [example app](https://github.com/Akryum/vue-apollo-todos) you can look at. +Mutations are queries that change your data state on your apollo server. For more info, visit the [apollo doc](https://www.apollographql.com/docs/react/reference/index.html#ApolloClient\.mutate). There is a mutation-focused [example app](https://github.com/Akryum/vue-apollo-todos) you can look at. + +**You shouldn't send the `__typename` fields in the variables, so it is not recommended to send an Apollo result object directly.** ```javascript methods: { From 13c522f659f8e0b7aeab7890957553b871826815 Mon Sep 17 00:00:00 2001 From: Jake Ho Date: Wed, 24 Jan 2018 11:45:30 +0800 Subject: [PATCH 16/22] fix TypeScript error when multiple clients are used --- types/vue-apollo.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vue-apollo.d.ts b/types/vue-apollo.d.ts index 87007eb..c56b10c 100644 --- a/types/vue-apollo.d.ts +++ b/types/vue-apollo.d.ts @@ -21,7 +21,7 @@ type VueApolloOptions = { export class VueApollo implements PluginObject<{}> { [key: string]: any; install: PluginFunction<{}>; - constructor (options: { defaultClient: ApolloClient<{}>, defaultOptions?: VueApolloOptions }); + constructor (options: { defaultClient: ApolloClient<{}>, defaultOptions?: VueApolloOptions, clients: { [key: string]:any } }); static install(pVue: typeof Vue, options?:{} | undefined): void; } From 7be557987c8c87d4455fab8c80fb47eb9592de8f Mon Sep 17 00:00:00 2001 From: Jake Ho Date: Wed, 31 Jan 2018 09:40:56 +0800 Subject: [PATCH 17/22] make the clients parameter optional and use the 'ApolloClient' type --- types/vue-apollo.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/vue-apollo.d.ts b/types/vue-apollo.d.ts index c56b10c..cd97848 100644 --- a/types/vue-apollo.d.ts +++ b/types/vue-apollo.d.ts @@ -21,7 +21,7 @@ type VueApolloOptions = { export class VueApollo implements PluginObject<{}> { [key: string]: any; install: PluginFunction<{}>; - constructor (options: { defaultClient: ApolloClient<{}>, defaultOptions?: VueApolloOptions, clients: { [key: string]:any } }); + constructor (options: { defaultClient: ApolloClient<{}>, defaultOptions?: VueApolloOptions, clients?: { [key: string]: ApolloClient<{}> } }); static install(pVue: typeof Vue, options?:{} | undefined): void; } From 96570a169a68de12d922e6a2cd4571c30611e393 Mon Sep 17 00:00:00 2001 From: Dustin B Date: Wed, 7 Feb 2018 10:40:43 -0800 Subject: [PATCH 18/22] Don't require the key to match the query name (#186) In "manual" mode, the user is setting the manually working with the value, so an error should not be thrown if the key isn't present in the response. --- src/smart-apollo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/smart-apollo.js b/src/smart-apollo.js index c9c174d..7bd5aef 100644 --- a/src/smart-apollo.js +++ b/src/smart-apollo.js @@ -232,7 +232,7 @@ export class SmartQuery extends SmartApollo { // No result } else if (typeof this.options.update === 'function') { this.vm[this.key] = this.options.update.call(this.vm, data) - } else if (data[this.key] === undefined) { + } else if (data[this.key] === undefined && !this.options.manual) { console.error(`Missing ${this.key} attribute on result`, data) } else if (!this.options.manual) { this.vm[this.key] = data[this.key] From 1019f32701b3cb810e72e2349deca30f1b78e640 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Wed, 7 Feb 2018 20:19:32 +0100 Subject: [PATCH 19/22] Update deps --- package.json | 12 +- yarn.lock | 1142 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 833 insertions(+), 321 deletions(-) diff --git a/package.json b/package.json index 1fbf7ba..8f296cb 100644 --- a/package.json +++ b/package.json @@ -43,32 +43,32 @@ "lodash.throttle": "^4.1.1" }, "devDependencies": { - "@types/graphql": "^0.11.7", + "@types/graphql": "^0.12.3", "apollo-cache-inmemory": "^1.1.1", "apollo-client": "^2.0.3", "apollo-link": "^1.0.3", "apollo-link-http": "^1.2.0", "babel-core": "^6.26.0", - "babel-eslint": "^7.1.1", + "babel-eslint": "^8.2.1", "babel-plugin-external-helpers": "^6.22.0", "babel-preset-env": "^1.6.1", "babel-preset-stage-0": "^6.24.1", "eslint": "^4.10.0", "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.8.0", - "eslint-plugin-node": "^5.2.1", + "eslint-plugin-node": "^6.0.0", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", - "graphql": "^0.11.7", + "graphql": "^0.12.3", "graphql-tag": "^2.5.0", "npm-watch": "^0.3.0", "rimraf": "^2.6.1", - "rollup": "^0.50.0", + "rollup": "^0.55.3", "rollup-plugin-babel": "^3.0.2", "rollup-plugin-commonjs": "^8.2.6", "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-replace": "^2.0.0", - "rollup-plugin-uglify": "^2.0.1", + "rollup-plugin-uglify": "^3.0.0", "typescript": "^2.6.2", "uglify-es": "^3.1.6", "vue": "^2.5.9" diff --git a/yarn.lock b/yarn.lock index e783976..5615653 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,13 +2,65 @@ # yarn lockfile v1 -"@types/async@2.0.45": - version "2.0.45" - resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.45.tgz#0cfe971d7ed5542695740338e0455c91078a0e83" +"@babel/code-frame@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.36.tgz#2349d7ec04b3a06945ae173280ef8579b63728e4" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" -"@types/graphql@^0.11.7": - version "0.11.7" - resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.11.7.tgz#da39a2f7c74e793e32e2bb7b3b68da1691532dd5" +"@babel/helper-function-name@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.36.tgz#366e3bc35147721b69009f803907c4d53212e88d" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.36" + "@babel/template" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + +"@babel/helper-get-function-arity@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.36.tgz#f5383bac9a96b274828b10d98900e84ee43e32b8" + dependencies: + "@babel/types" "7.0.0-beta.36" + +"@babel/template@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.36.tgz#02e903de5d68bd7899bce3c5b5447e59529abb00" + dependencies: + "@babel/code-frame" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + lodash "^4.2.0" + +"@babel/traverse@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.36.tgz#1dc6f8750e89b6b979de5fe44aa993b1a2192261" + dependencies: + "@babel/code-frame" "7.0.0-beta.36" + "@babel/helper-function-name" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + debug "^3.0.1" + globals "^11.1.0" + invariant "^2.2.0" + lodash "^4.2.0" + +"@babel/types@7.0.0-beta.36": + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.36.tgz#64f2004353de42adb72f9ebb4665fc35b5499d23" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + +"@types/async@2.0.47": + version "2.0.47" + resolved "https://registry.yarnpkg.com/@types/async/-/async-2.0.47.tgz#f49ba1dd1f189486beb6e1d070a850f6ab4bd521" + +"@types/graphql@^0.12.3": + version "0.12.3" + resolved "https://registry.yarnpkg.com/@types/graphql/-/graphql-0.12.3.tgz#c429585aaa4523135e0ab4e12dec72d2d913946f" "@types/zen-observable@0.5.3", "@types/zen-observable@^0.5.3": version "0.5.3" @@ -28,9 +80,9 @@ acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.1.1, acorn@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7" +acorn@^5.2.1, acorn@^5.4.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" ajv-keywords@^2.1.0: version "2.1.1" @@ -43,9 +95,9 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.2.0, ajv@^5.2.3: - version "5.3.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.3.0.tgz#4414ff74a50879c208ee5fdc826e32c303549eda" +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: co "^4.6.0" fast-deep-equal "^1.0.0" @@ -80,60 +132,64 @@ ansi-styles@^3.1.0: dependencies: color-convert "^1.9.0" -anymatch@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.2.tgz#553dcb8f91e3c889845dfdba34c77721b90b9d7a" +anymatch@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" dependencies: - micromatch "^2.1.5" - normalize-path "^2.0.0" + micromatch "^3.1.4" + normalize-path "^2.1.1" apollo-cache-inmemory@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.1.1.tgz#1511f00eb845da88504abf867f408c3026a909ba" + version "1.1.7" + resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.1.7.tgz#15e6200f70431414d29bd5f20e86d81739e26430" dependencies: - apollo-cache "^1.0.1" - apollo-utilities "^1.0.2" - graphql-anywhere "^4.0.1" + apollo-cache "^1.1.2" + apollo-utilities "^1.0.6" + graphql-anywhere "^4.1.3" -apollo-cache@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.0.1.tgz#66c16141173bc752d3ad3dce990310c10dfc4076" +apollo-cache@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.2.tgz#b1843a0e01d3837239e9925cfaa1d786599b77a9" dependencies: - apollo-utilities "^1.0.2" + apollo-utilities "^1.0.6" apollo-client@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.0.3.tgz#f99f32e2c851bbd52da1e1b113ce8f6a0cf94945" + version "2.2.2" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.2.2.tgz#55d7b7a85d28161a6ecddd86cde8180be52193f6" dependencies: "@types/zen-observable" "^0.5.3" - apollo-cache "^1.0.1" + apollo-cache "^1.1.2" apollo-link "^1.0.0" apollo-link-dedup "^1.0.0" - apollo-utilities "^1.0.2" + apollo-utilities "^1.0.6" symbol-observable "^1.0.2" - zen-observable "^0.6.0" + zen-observable "^0.7.0" optionalDependencies: - "@types/async" "2.0.45" + "@types/async" "2.0.47" apollo-link-dedup@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.2.tgz#bab659dde41f8dd627839142d4dad90e55251110" + version "1.0.5" + resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.5.tgz#1c213d7ebbe48e74b016fffacd7e6a53dc309e32" + dependencies: + apollo-link "^1.0.7" apollo-link-http@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.2.0.tgz#48464c2ebfa6474f7a89908696827d66b2deb5cc" + version "1.3.2" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.3.2.tgz#63537ee5ecf9c004efb0317f1222b7dbc6f21559" + dependencies: + apollo-link "^1.0.7" -apollo-link@^1.0.0, apollo-link@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.0.3.tgz#759c36abeeb99e227eca45f919ee07fb8fee911e" +apollo-link@^1.0.0, apollo-link@^1.0.3, apollo-link@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.0.7.tgz#42cd38a7378332fc3e41a214ff6a6e5e703a556f" dependencies: "@types/zen-observable" "0.5.3" apollo-utilities "^1.0.0" zen-observable "^0.6.0" -apollo-utilities@^1.0.0, apollo-utilities@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.2.tgz#bcf348a7e613e82e2624ddb5be2b9f6bf1259c6d" +apollo-utilities@^1.0.0, apollo-utilities@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.6.tgz#7bfd7a702b5225c9a4591fe28c5899d9b5f08889" aproba@^1.0.3: version "1.2.0" @@ -158,10 +214,18 @@ arr-diff@^2.0.0: dependencies: arr-flatten "^1.0.1" -arr-flatten@^1.0.1: +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + +arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -176,6 +240,10 @@ array-unique@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" @@ -192,6 +260,10 @@ assert-plus@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234" +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" @@ -200,6 +272,10 @@ asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" +atob@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" + aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" @@ -240,18 +316,20 @@ babel-core@^6.26.0: slash "^1.0.0" source-map "^0.5.6" -babel-eslint@^7.1.1: - version "7.2.3" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.3.tgz#b2fe2d80126470f5c19442dc757253a897710827" +babel-eslint@^8.2.1: + version "8.2.1" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.1.tgz#136888f3c109edc65376c23ebf494f36a3e03951" dependencies: - babel-code-frame "^6.22.0" - babel-traverse "^6.23.1" - babel-types "^6.23.0" - babylon "^6.17.0" + "@babel/code-frame" "7.0.0-beta.36" + "@babel/traverse" "7.0.0-beta.36" + "@babel/types" "7.0.0-beta.36" + babylon "7.0.0-beta.36" + eslint-scope "~3.7.1" + eslint-visitor-keys "^1.0.0" babel-generator@^6.26.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5" + version "6.26.1" + resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90" dependencies: babel-messages "^6.23.0" babel-runtime "^6.26.0" @@ -259,7 +337,7 @@ babel-generator@^6.26.0: detect-indent "^4.0.0" jsesc "^1.3.0" lodash "^4.17.4" - source-map "^0.5.6" + source-map "^0.5.7" trim-right "^1.0.1" babel-helper-bindify-decorators@^6.24.1: @@ -805,7 +883,7 @@ babel-template@^6.24.1, babel-template@^6.26.0: babylon "^6.18.0" lodash "^4.17.4" -babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.26.0: +babel-traverse@^6.24.1, babel-traverse@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" dependencies: @@ -819,7 +897,7 @@ babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.26.0: invariant "^2.2.2" lodash "^4.17.4" -babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.26.0: +babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" dependencies: @@ -828,7 +906,11 @@ babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.26 lodash "^4.17.4" to-fast-properties "^1.0.3" -babylon@^6.17.0, babylon@^6.18.0: +babylon@7.0.0-beta.36: + version "7.0.0-beta.36" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.36.tgz#3a3683ba6a9a1e02b0aa507c8e63435e39305b9e" + +babylon@^6.18.0: version "6.18.0" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" @@ -836,6 +918,18 @@ balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" + bcrypt-pbkdf@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d" @@ -843,8 +937,8 @@ bcrypt-pbkdf@^1.0.0: tweetnacl "^0.14.3" binary-extensions@^1.0.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.10.0.tgz#9aeb9a6c5e88638aad171e167f5900abe24835d0" + version "1.11.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205" block-stream@*: version "0.0.9" @@ -859,8 +953,8 @@ boom@2.x.x: hoek "2.x.x" boxen@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.2.2.tgz#3f1d4032c30ffea9d4b02c322eaf2ea741dcbce5" + version "1.3.0" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b" dependencies: ansi-align "^2.0.0" camelcase "^4.0.0" @@ -868,7 +962,7 @@ boxen@^1.2.1: cli-boxes "^1.0.0" string-width "^2.0.0" term-size "^1.2.0" - widest-line "^1.0.0" + widest-line "^2.0.0" brace-expansion@^1.1.7: version "1.1.8" @@ -885,23 +979,47 @@ braces@^1.8.2: preserve "^0.2.0" repeat-element "^1.1.2" -browser-resolve@^1.11.0: - version "1.11.2" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-1.11.2.tgz#8ff09b0a2c421718a1051c260b32e48f442938ce" +braces@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.0.tgz#a46941cb5fb492156b3d6a656e06c35364e3e66e" dependencies: - resolve "1.1.7" + arr-flatten "^1.1.0" + array-unique "^0.3.2" + define-property "^1.0.0" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" browserslist@^2.1.2: - version "2.6.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.6.1.tgz#cc65a05ad6131ebda26f076f2822ba1bc826376b" + version "2.11.3" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-2.11.3.tgz#fe36167aed1bbcde4827ebfe71347a2cc70b99b2" dependencies: - caniuse-lite "^1.0.30000755" - electron-to-chromium "^1.3.27" + caniuse-lite "^1.0.30000792" + electron-to-chromium "^1.3.30" builtin-modules@^1.0.0, builtin-modules@^1.1.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" + caller-path@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" @@ -916,9 +1034,9 @@ camelcase@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" -caniuse-lite@^1.0.30000755: - version "1.0.30000756" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000756.tgz#3da701c1521b9fab87004c6de7c97fa47dbeaad2" +caniuse-lite@^1.0.30000792: + version "1.0.30000804" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000804.tgz#8729a143d65378e8936adbb161f550e9c49fc09d" capture-stack-trace@^1.0.0: version "1.0.0" @@ -946,16 +1064,22 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" -chokidar@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + +chokidar@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.0.tgz#6686313c541d3274b2a5c01233342037948c911b" dependencies: - anymatch "^1.3.0" + anymatch "^2.0.0" async-each "^1.0.0" - glob-parent "^2.0.0" + braces "^2.3.0" + glob-parent "^3.1.0" inherits "^2.0.1" is-binary-path "^1.0.0" - is-glob "^2.0.0" + is-glob "^4.0.0" + normalize-path "^2.1.1" path-is-absolute "^1.0.0" readdirp "^2.0.0" optionalDependencies: @@ -965,6 +1089,15 @@ circular-json@^0.3.1: version "0.3.3" resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + cli-boxes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143" @@ -987,9 +1120,16 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + color-convert@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a" + version "1.9.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" dependencies: color-name "^1.1.1" @@ -1003,9 +1143,13 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@~2.11.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" +commander@~2.13.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" + +component-emitter@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" concat-map@0.0.1: version "0.0.1" @@ -1039,12 +1183,16 @@ contains-path@^0.1.0: resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" convert-source-map@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5" + version "1.5.1" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.1.tgz#b8278097b9bc229365de5c62cf5fcaed8b5599e5" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" core-js@^2.4.0, core-js@^2.5.0: - version "2.5.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b" + version "2.5.3" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e" core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" @@ -1080,18 +1228,22 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -debug@^2.2.0, debug@^2.6.8: +debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" -debug@^3.0.1: +debug@^3.0.1, debug@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + deep-extend@~0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" @@ -1100,6 +1252,18 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + dependencies: + is-descriptor "^1.0.0" + del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" @@ -1126,6 +1290,10 @@ detect-indent@^4.0.0: dependencies: repeating "^2.0.0" +detect-libc@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" + doctrine@1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" @@ -1133,12 +1301,11 @@ doctrine@1.5.0: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: esutils "^2.0.2" - isarray "^1.0.0" dot-prop@^4.1.0: version "4.2.0" @@ -1160,9 +1327,9 @@ ecc-jsbn@~0.1.1: dependencies: jsbn "~0.1.0" -electron-to-chromium@^1.3.27: - version "1.3.27" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d" +electron-to-chromium@^1.3.30: + version "1.3.33" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.33.tgz#bf00703d62a7c65238136578c352d6c5c042a545" error-ex@^1.2.0: version "1.3.1" @@ -1170,10 +1337,6 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es6-promise@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" - escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1183,11 +1346,11 @@ eslint-config-standard@^10.2.1: resolved "https://registry.yarnpkg.com/eslint-config-standard/-/eslint-config-standard-10.2.1.tgz#c061e4d066f379dc17cd562c64e819b4dd454591" eslint-import-resolver-node@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" dependencies: - debug "^2.6.8" - resolve "^1.2.0" + debug "^2.6.9" + resolve "^1.5.0" eslint-module-utils@^2.1.1: version "2.1.1" @@ -1211,14 +1374,14 @@ eslint-plugin-import@^2.8.0: minimatch "^3.0.3" read-pkg-up "^2.0.0" -eslint-plugin-node@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.2.1.tgz#80df3253c4d7901045ec87fa660a284e32bdca29" +eslint-plugin-node@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-6.0.0.tgz#5ad5ee6b5346aec6cc9cde0b8619caed2c6d8f25" dependencies: ignore "^3.3.6" minimatch "^3.0.4" resolve "^1.3.3" - semver "5.3.0" + semver "^5.4.1" eslint-plugin-promise@^3.4.0: version "3.6.0" @@ -1228,39 +1391,43 @@ eslint-plugin-standard@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-3.0.1.tgz#34d0c915b45edc6f010393c7eef3823b08565cf2" -eslint-scope@^3.7.1: +eslint-scope@^3.7.1, eslint-scope@~3.7.1: version "3.7.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + eslint@^4.10.0: - version "4.10.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.10.0.tgz#f25d0d7955c81968c2309aa5c9a229e045176bb7" + version "4.17.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.17.0.tgz#dc24bb51ede48df629be7031c71d9dc0ee4f3ddf" dependencies: - ajv "^5.2.0" + ajv "^5.3.0" babel-code-frame "^6.22.0" chalk "^2.1.0" concat-stream "^1.6.0" cross-spawn "^5.1.0" - debug "^3.0.1" - doctrine "^2.0.0" + debug "^3.1.0" + doctrine "^2.1.0" eslint-scope "^3.7.1" - espree "^3.5.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.2" esquery "^1.0.0" - estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" functional-red-black-tree "^1.0.1" glob "^7.1.2" - globals "^9.17.0" + globals "^11.0.1" ignore "^3.3.3" imurmurhash "^0.1.4" inquirer "^3.0.6" is-resolvable "^1.0.0" js-yaml "^3.9.1" - json-stable-stringify "^1.0.1" + json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" lodash "^4.17.4" minimatch "^3.0.2" @@ -1277,11 +1444,11 @@ eslint@^4.10.0: table "^4.0.1" text-table "~0.2.0" -espree@^3.5.1: - version "3.5.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.1.tgz#0c988b8ab46db53100a1954ae4ba995ddd27d87e" +espree@^3.5.2: + version "3.5.3" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" dependencies: - acorn "^5.1.1" + acorn "^5.4.0" acorn-jsx "^3.0.0" esprima@^4.0.0: @@ -1301,7 +1468,7 @@ esrecurse@^4.1.0: estraverse "^4.1.0" object-assign "^4.0.1" -estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -1314,8 +1481,8 @@ estree-walker@^0.3.0: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa" estree-walker@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.0.tgz#aae3b57c42deb8010e349c892462f0e71c5dd1aa" + version "0.5.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.1.tgz#64fc375053abc6f57d73e9bd2f004644ad3c5854" esutils@^2.0.2: version "2.0.2" @@ -1351,22 +1518,47 @@ expand-brackets@^0.1.4: dependencies: is-posix-bracket "^0.1.0" +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + expand-range@^1.8.1: version "1.8.2" resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" dependencies: fill-range "^2.1.0" +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" external-editor@^2.0.4: - version "2.0.5" - resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.5.tgz#52c249a3981b9ba187c7cacf5beb50bf1d91a6bc" + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" dependencies: + chardet "^0.4.0" iconv-lite "^0.4.17" - jschardet "^1.4.2" tmp "^0.0.33" extglob@^0.3.1: @@ -1375,10 +1567,27 @@ extglob@^0.3.1: dependencies: is-extglob "^1.0.0" -extsprintf@1.3.0, extsprintf@^1.2.0: +extglob@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extsprintf@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" +extsprintf@^1.2.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" + fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" @@ -1418,6 +1627,15 @@ fill-range@^2.1.0: repeat-element "^1.1.2" repeat-string "^1.5.2" +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + find-up@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" @@ -1440,7 +1658,7 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -for-in@^1.0.1: +for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -1462,6 +1680,12 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + dependencies: + map-cache "^0.2.2" + from@~0: version "0.1.7" resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" @@ -1471,11 +1695,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" fsevents@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.2.tgz#3282b713fb3ad80ede0e9fcf4611b5aa6fc033f4" + version "1.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.1.3.tgz#11f82318f5fe7bb2cd22965a108e9306208216d8" dependencies: nan "^2.3.0" - node-pre-gyp "^0.6.36" + node-pre-gyp "^0.6.39" fstream-ignore@^1.0.5: version "1.0.5" @@ -1519,6 +1743,10 @@ get-stream@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -1538,6 +1766,13 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" +glob-parent@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" + dependencies: + is-glob "^3.1.0" + path-dirname "^1.0.0" + glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -1550,12 +1785,16 @@ glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: path-is-absolute "^1.0.0" global-dirs@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.0.tgz#10d34039e0df04272e262cf24224f7209434df4f" + version "0.1.1" + resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" dependencies: ini "^1.3.4" -globals@^9.17.0, globals@^9.18.0: +globals@^11.0.1, globals@^11.1.0: + version "11.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" + +globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -1590,19 +1829,19 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" -graphql-anywhere@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.0.1.tgz#eb53ed5c56ef42e21d34dc22951e3da38f88a342" +graphql-anywhere@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.3.tgz#ddd857d45d1538f55e8364c6c7a9016817a5ea92" dependencies: - apollo-utilities "^1.0.2" + apollo-utilities "^1.0.6" graphql-tag@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.5.0.tgz#b43bfd8b5babcd2c205ad680c03e98b238934e0f" + version "2.7.1" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.7.1.tgz#17e0beae35d5b4580b419891d40bf525c19c8b61" -graphql@^0.11.7: - version "0.11.7" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.11.7.tgz#e5abaa9cb7b7cccb84e9f0836bf4370d268750c6" +graphql@^0.12.3: + version "0.12.3" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.12.3.tgz#11668458bbe28261c0dcb6e265f515ba79f6ce07" dependencies: iterall "1.1.3" @@ -1631,6 +1870,33 @@ has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" + +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + has@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" @@ -1701,8 +1967,8 @@ inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" ini@^1.3.4, ini@~1.3.0: - version "1.3.4" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.4.tgz#0537cb79daf59b59a1a517dff706c86ec039162e" + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" inquirer@^3.0.6: version "3.3.0" @@ -1723,12 +1989,24 @@ inquirer@^3.0.6: strip-ansi "^4.0.0" through "^2.3.6" -invariant@^2.2.2: +invariant@^2.2.0, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: loose-envify "^1.0.0" +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + dependencies: + kind-of "^6.0.0" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" @@ -1749,6 +2027,34 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" @@ -1759,14 +2065,24 @@ is-equal-shallow@^0.1.3: dependencies: is-primitive "^2.0.0" -is-extendable@^0.1.1: +is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + dependencies: + is-plain-object "^2.0.4" + is-extglob@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" +is-extglob@^2.1.0, is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" @@ -1789,6 +2105,18 @@ is-glob@^2.0.0, is-glob@^2.0.1: dependencies: is-extglob "^1.0.0" +is-glob@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" + dependencies: + is-extglob "^2.1.0" + +is-glob@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + dependencies: + is-extglob "^2.1.1" + is-installed-globally@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80" @@ -1820,6 +2148,12 @@ is-obj@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" +is-odd@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-odd/-/is-odd-1.0.0.tgz#3b8a932eb028b3775c39bb09e91767accdb69088" + dependencies: + is-number "^3.0.0" + is-path-cwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d" @@ -1831,11 +2165,17 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-inside@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" dependencies: path-is-inside "^1.0.1" +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" + is-posix-bracket@^0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" @@ -1853,10 +2193,8 @@ is-redirect@^1.0.0: resolved "https://registry.yarnpkg.com/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24" is-resolvable@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" - dependencies: - tryit "^1.0.1" + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" is-retry-allowed@^1.0.0: version "1.1.0" @@ -1884,6 +2222,10 @@ isobject@^2.0.0: dependencies: isarray "1.0.0" +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -1907,10 +2249,6 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" -jschardet@^1.4.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.6.0.tgz#c7d1a71edcff2839db2f9ec30fc5d5ebd3c1a678" - jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -1927,6 +2265,10 @@ json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" @@ -1954,7 +2296,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -kind-of@^3.0.2: +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" dependencies: @@ -1966,12 +2308,26 @@ kind-of@^4.0.0: dependencies: is-buffer "^1.1.5" +kind-of@^5.0.0, kind-of@^5.0.2: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + latest-version@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/latest-version/-/latest-version-3.1.0.tgz#a205383fea322b33b5ae3b18abee0dc2f356ee15" dependencies: package-json "^4.0.0" +lazy-cache@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" + dependencies: + set-getter "^0.1.0" + levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -1995,45 +2351,6 @@ locate-path@^2.0.0: p-locate "^2.0.0" path-exists "^3.0.0" -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" - dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" - -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" - -lodash._bindcallback@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" - -lodash._createassigner@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11" - dependencies: - lodash._bindcallback "^3.0.0" - lodash._isiterateecall "^3.0.0" - lodash.restparam "^3.0.0" - -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" - -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" - -lodash.assign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash.assign/-/lodash.assign-3.2.0.tgz#3ce9f0234b4b2223e296b8fa0ac1fee8ebca64fa" - dependencies: - lodash._baseassign "^3.0.0" - lodash._createassigner "^3.0.0" - lodash.keys "^3.0.0" - lodash.cond@^4.3.0: version "4.5.2" resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" @@ -2042,44 +2359,17 @@ lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" -lodash.defaults@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-3.1.2.tgz#c7308b18dbf8bc9372d701a73493c61192bd2e2c" - dependencies: - lodash.assign "^3.0.0" - lodash.restparam "^3.0.0" - -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" - -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" - dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" - lodash.omit@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.omit/-/lodash.omit-4.5.0.tgz#6eb19ae5a1ee1dd9df0b969e66ce0b7fa30b5e60" -lodash.restparam@^3.0.0: - version "3.6.1" - resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" - lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" -lodash@^4.17.4, lodash@^4.3.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" loose-envify@^1.0.0: version "1.3.1" @@ -2110,11 +2400,21 @@ make-dir@^1.0.0: dependencies: pify "^3.0.0" +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + map-stream@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194" -micromatch@^2.1.5, micromatch@^2.3.11: +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + dependencies: + object-visit "^1.0.0" + +micromatch@^2.3.11: version "2.3.11" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" dependencies: @@ -2132,6 +2432,24 @@ micromatch@^2.1.5, micromatch@^2.3.11: parse-glob "^3.0.4" regex-cache "^0.4.2" +micromatch@^3.1.4: + version "3.1.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.5.tgz#d05e168c206472dfbca985bfef4f57797b4cd4ba" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.0" + define-property "^1.0.0" + extend-shallow "^2.0.1" + extglob "^2.0.2" + fragment-cache "^0.2.1" + kind-of "^6.0.0" + nanomatch "^1.2.5" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + mime-db@~1.30.0: version "1.30.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.30.0.tgz#74c643da2dd9d6a45399963465b26d5ca7d71f01" @@ -2143,8 +2461,8 @@ mime-types@^2.1.12, mime-types@~2.1.7: mime-db "~1.30.0" mimic-fn@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" minimatch@^3.0.0, minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: version "3.0.4" @@ -2160,6 +2478,13 @@ minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" +mixin-deep@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + "mkdirp@>=0.5 0", mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" @@ -2175,17 +2500,34 @@ mute-stream@0.0.7: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" nan@^2.3.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" + version "2.8.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.8.0.tgz#ed715f3fe9de02b57a5e6252d90a96675e1f085a" + +nanomatch@^1.2.5: + version "1.2.7" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.7.tgz#53cd4aa109ff68b7f869591fdc9d10daeeea3e79" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^1.0.0" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + is-odd "^1.0.0" + kind-of "^5.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" -node-pre-gyp@^0.6.36: - version "0.6.38" - resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.38.tgz#e92a20f83416415bb4086f6d1fb78b3da73d113d" +node-pre-gyp@^0.6.39: + version "0.6.39" + resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz#c00e96860b23c0e1420ac7befc5044e1d78d8649" dependencies: + detect-libc "^1.0.2" hawk "3.1.3" mkdirp "^0.5.1" nopt "^4.0.1" @@ -2198,19 +2540,18 @@ node-pre-gyp@^0.6.36: tar-pack "^3.4.0" nodemon@^1.12.1: - version "1.12.1" - resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.12.1.tgz#996a56dc49d9f16bbf1b78a4de08f13634b3878d" + version "1.14.12" + resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.14.12.tgz#fe059424b15ebdb107696287a558d9cf53a63999" dependencies: - chokidar "^1.7.0" - debug "^2.6.8" - es6-promise "^3.3.1" + chokidar "^2.0.0" + debug "^3.1.0" ignore-by-default "^1.0.1" - lodash.defaults "^3.1.2" minimatch "^3.0.4" - ps-tree "^1.1.0" + pstree.remy "^1.1.0" + semver "^5.4.1" touch "^3.1.0" - undefsafe "0.0.3" - update-notifier "^2.2.0" + undefsafe "^2.0.1" + update-notifier "^2.3.0" nopt@^4.0.1: version "4.0.1" @@ -2234,7 +2575,7 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.0.0, normalize-path@^2.0.1: +normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" dependencies: @@ -2274,6 +2615,20 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + dependencies: + isobject "^3.0.0" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -2281,6 +2636,12 @@ object.omit@^2.0.0: for-own "^0.1.4" is-extendable "^0.1.1" +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + dependencies: + isobject "^3.0.1" + once@^1.3.0, once@^1.3.3: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -2324,8 +2685,10 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" p-limit@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.1.0.tgz#b07ff2d9a5d88bec806035895a2bab66a27988bc" + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + dependencies: + p-try "^1.0.0" p-locate@^2.0.0: version "2.0.0" @@ -2333,6 +2696,10 @@ p-locate@^2.0.0: dependencies: p-limit "^1.1.0" +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + package-json@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/package-json/-/package-json-4.0.1.tgz#8869a0401253661c4c4ca3da6c2121ed555f5eed" @@ -2357,6 +2724,14 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + +path-dirname@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" + path-exists@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" @@ -2427,6 +2802,10 @@ pluralize@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -2461,6 +2840,12 @@ pseudomap@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" +pstree.remy@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/pstree.remy/-/pstree.remy-1.1.0.tgz#f2af27265bd3e5b32bbfcc10e80bac55ba78688b" + dependencies: + ps-tree "^1.1.0" + punycode@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" @@ -2477,8 +2862,8 @@ randomatic@^1.1.3: kind-of "^4.0.0" rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: - version "1.2.2" - resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.2.tgz#d8ce9cb57e8d64d9c7badd9876c7c34cbe3c7077" + version "1.2.5" + resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.5.tgz#275cd687f6e3b36cc756baa26dfee80a790301fd" dependencies: deep-extend "~0.4.0" ini "~1.3.0" @@ -2526,8 +2911,8 @@ regenerate@^1.2.1: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" regenerator-runtime@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz#7e54fe5b5ccd5d6624ea6255c3473be090b802e1" + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" regenerator-transform@^0.10.0: version "0.10.1" @@ -2543,6 +2928,12 @@ regex-cache@^0.4.2: dependencies: is-equal-shallow "^0.1.3" +regex-not@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.0.tgz#42f83e39771622df826b02af176525d6a5f157f9" + dependencies: + extend-shallow "^2.0.1" + regexpu-core@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-2.0.0.tgz#49d038837b8dcf8bfa5b9a42139938e6ea2ae240" @@ -2552,8 +2943,8 @@ regexpu-core@^2.0.0: regjsparser "^0.1.4" registry-auth-token@^3.0.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.1.tgz#fb0d3289ee0d9ada2cbb52af5dfe66cb070d3006" + version "3.3.2" + resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.2.tgz#851fd49038eecb586911115af845260eec983f20" dependencies: rc "^1.1.6" safe-buffer "^5.0.1" @@ -2582,7 +2973,7 @@ repeat-element@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" -repeat-string@^1.5.2: +repeat-string@^1.5.2, repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" @@ -2630,11 +3021,11 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" -resolve@1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" -resolve@^1.1.6, resolve@^1.2.0, resolve@^1.3.3, resolve@^1.4.0: +resolve@^1.1.6, resolve@^1.3.3, resolve@^1.4.0, resolve@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -2654,14 +3045,14 @@ rimraf@2, rimraf@^2.2.8, rimraf@^2.5.1, rimraf@^2.6.1: glob "^7.0.5" rollup-plugin-babel@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.2.tgz#a2765dea0eaa8aece351c983573300d17497495b" + version "3.0.3" + resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-3.0.3.tgz#63adedc863130327512a4a9006efc2241c5b7c15" dependencies: rollup-pluginutils "^1.5.0" rollup-plugin-commonjs@^8.2.6: - version "8.2.6" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.6.tgz#27e5b9069ff94005bb01e01bb46a1e4873784677" + version "8.3.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.3.0.tgz#91b4ba18f340951e39ed7b1901f377a80ab3f9c3" dependencies: acorn "^5.2.1" estree-walker "^0.5.0" @@ -2670,10 +3061,9 @@ rollup-plugin-commonjs@^8.2.6: rollup-pluginutils "^2.0.1" rollup-plugin-node-resolve@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.0.tgz#8b897c4c3030d5001277b0514b25d2ca09683ee0" + version "3.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.2.tgz#38babc12fd404cc2ba1ff68648fe43fa3ffee6b0" dependencies: - browser-resolve "^1.11.0" builtin-modules "^1.1.0" is-module "^1.0.0" resolve "^1.1.6" @@ -2686,11 +3076,11 @@ rollup-plugin-replace@^2.0.0: minimatch "^3.0.2" rollup-pluginutils "^2.0.1" -rollup-plugin-uglify@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-2.0.1.tgz#67b37ad1efdafbd83af4c36b40c189ee4866c969" +rollup-plugin-uglify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-3.0.0.tgz#a34eca24617709c6bf1778e9653baafa06099b86" dependencies: - uglify-js "^3.0.9" + uglify-es "^3.3.7" rollup-pluginutils@^1.5.0: version "1.5.2" @@ -2706,9 +3096,9 @@ rollup-pluginutils@^2.0.1: estree-walker "^0.3.0" micromatch "^2.3.11" -rollup@^0.50.0: - version "0.50.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.50.0.tgz#4c158f4e780e6cb33ff0dbfc184a52cc58cd5f3b" +rollup@^0.55.3: + version "0.55.3" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.55.3.tgz#0af082a766d51c3058430c8372442ff5207d8736" run-async@^2.2.0: version "2.3.0" @@ -2736,22 +3126,42 @@ semver-diff@^2.0.0: dependencies: semver "^5.0.3" -"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" - -semver@5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" +set-getter@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" + dependencies: + to-object-path "^0.3.0" + set-immediate-shim@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" +set-value@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.1" + to-object-path "^0.3.0" + +set-value@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -2776,19 +3186,60 @@ slice-ansi@1.0.0: dependencies: is-fullwidth-code-point "^2.0.0" +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.1.tgz#e12b5487faded3e3dea0ac91e9400bf75b401370" + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^2.0.0" + sntp@1.x.x: version "1.0.9" resolved "https://registry.yarnpkg.com/sntp/-/sntp-1.0.9.tgz#6541184cc90aeea6c6e7b35e2659082443c66198" dependencies: hoek "2.x.x" +source-map-resolve@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.1.tgz#7ad0f593f2281598e854df80f19aae4b92d7a11a" + dependencies: + atob "^2.0.0" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + source-map-support@^0.4.15: version "0.4.18" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f" dependencies: source-map "^0.5.6" -source-map@^0.5.6: +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + +source-map@^0.5.6, source-map@^0.5.7: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -2810,6 +3261,12 @@ spdx-license-ids@^1.0.2: version "1.2.2" resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + dependencies: + extend-shallow "^3.0.0" + split@0.3: version "0.3.3" resolved "https://registry.yarnpkg.com/split/-/split-0.3.3.tgz#cd0eea5e63a211dfff7eb0f091c4133e2d0dd28f" @@ -2834,6 +3291,13 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + stream-combiner@~0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.0.4.tgz#4d5e433c185261dde623ca3f44c586bcf5c4ad14" @@ -2900,8 +3364,8 @@ supports-color@^4.0.0: has-flag "^2.0.0" symbol-observable@^1.0.2: - version "1.1.0" - resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.1.0.tgz#5c68fd8d54115d9dfb72a84720549222e8db9b32" + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" table@^4.0.1: version "4.0.2" @@ -2970,6 +3434,31 @@ to-fast-properties@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.1.tgz#15358bee4a2c83bd76377ba1dc049d0f18837aae" + dependencies: + define-property "^0.2.5" + extend-shallow "^2.0.1" + regex-not "^1.0.0" + touch@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/touch/-/touch-3.1.0.tgz#fe365f5f75ec9ed4e56825e0bb76d24ab74af83b" @@ -2986,10 +3475,6 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" -tryit@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -3011,30 +3496,34 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" typescript@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4" + version "2.7.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.1.tgz#bb3682c2c791ac90e7c6210b26478a8da085c359" -uglify-es@^3.1.6: - version "3.1.6" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.1.6.tgz#b0f818c055a7e9538abc2286e70c743f2938311f" +uglify-es@^3.1.6, uglify-es@^3.3.7: + version "3.3.9" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" dependencies: - commander "~2.11.0" - source-map "~0.6.1" - -uglify-js@^3.0.9: - version "3.1.6" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.1.6.tgz#918832602036e95d2318e11f27ee8461a8592c5d" - dependencies: - commander "~2.11.0" + commander "~2.13.0" source-map "~0.6.1" uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" -undefsafe@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-0.0.3.tgz#ecca3a03e56b9af17385baac812ac83b994a962f" +undefsafe@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/undefsafe/-/undefsafe-2.0.1.tgz#03b2f2a16c94556e14b2edef326cd66aaf82707a" + dependencies: + debug "^2.2.0" + +union-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^0.4.3" unique-string@^1.0.0: version "1.0.0" @@ -3042,11 +3531,18 @@ unique-string@^1.0.0: dependencies: crypto-random-string "^1.0.0" +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + dependencies: + has-value "^0.3.1" + isobject "^3.0.0" + unzip-response@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" -update-notifier@^2.2.0: +update-notifier@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.3.0.tgz#4e8827a6bb915140ab093559d7014e3ebb837451" dependencies: @@ -3060,19 +3556,31 @@ update-notifier@^2.2.0: semver-diff "^2.0.0" xdg-basedir "^3.0.0" +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + url-parse-lax@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73" dependencies: prepend-http "^1.0.1" +use@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/use/-/use-2.0.2.tgz#ae28a0d72f93bf22422a18a2e379993112dec8e8" + dependencies: + define-property "^0.2.5" + isobject "^3.0.0" + lazy-cache "^2.0.2" + util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" uuid@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" + version "3.2.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" validate-npm-package-license@^3.0.1: version "3.0.1" @@ -3094,8 +3602,8 @@ vlq@^0.2.1: resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" vue@^2.5.9: - version "2.5.9" - resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.9.tgz#b2380cd040915dca69881dafd121d760952e65f7" + version "2.5.13" + resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.13.tgz#95bd31e20efcf7a7f39239c9aa6787ce8cf578e1" which@^1.2.9: version "1.3.0" @@ -3109,11 +3617,11 @@ wide-align@^1.1.0: dependencies: string-width "^1.0.2" -widest-line@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-1.0.0.tgz#0c09c85c2a94683d0d7eaf8ee097d564bf0e105c" +widest-line@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-2.0.0.tgz#0142a4e8a243f8882c0233aa0e0281aa76152273" dependencies: - string-width "^1.0.1" + string-width "^2.1.1" wordwrap@~1.0.0: version "1.0.0" @@ -3150,5 +3658,9 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" zen-observable@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.6.0.tgz#8a6157ed15348d185d948cfc4a59d90a2c0f70ee" + version "0.6.1" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.6.1.tgz#01dbed3bc8d02cbe9ee1112c83e04c807f647244" + +zen-observable@^0.7.0: + version "0.7.1" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.7.1.tgz#f84075c0ee085594d3566e1d6454207f126411b3" From 66504309599ce9d4a31feb8fd5f065d790349c86 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 11 Feb 2018 21:55:43 +0100 Subject: [PATCH 20/22] Query components + loading + provider improvements --- README.md | 119 ++++++++++- build/rollup.config.base.js | 1 - build/rollup.config.browser.js | 2 +- build/rollup.config.es.js | 1 + build/rollup.config.umd.js | 1 + package.json | 10 +- src/apollo-provider.js | 41 +++- src/components/ApolloQuery.js | 167 ++++++++++++++++ src/components/ApolloSubscribeToMore.js | 69 +++++++ src/dollar-apollo.js | 11 +- src/index.js | 91 +++++---- src/smart-apollo.js | 252 ++---------------------- src/smart-query.js | 215 ++++++++++++++++++++ src/smart-subscription.js | 48 +++++ yarn.lock | 134 ++++++------- 15 files changed, 788 insertions(+), 374 deletions(-) create mode 100644 src/components/ApolloQuery.js create mode 100644 src/components/ApolloSubscribeToMore.js create mode 100644 src/smart-query.js create mode 100644 src/smart-subscription.js diff --git a/README.md b/README.md index f49e6b5..af282d6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![npm](https://img.shields.io/npm/v/vue-apollo/next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](https://www.apollographql.com/) -[![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) +[![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.2+-brightgreen.svg)](https://vuejs.org/) ![schema](https://cdn-images-1.medium.com/max/800/1*H9AANoofLqjS10Xd5TwRYw.png) @@ -10,6 +10,8 @@ Integrates [apollo](https://www.apollographql.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/) +[icon Vue-cli plugin](https://github.com/Akryum/vue-cli-plugin-apollo) + [icon More vue-apollo examples](https://github.com/Akryum/vue-apollo-example) [icon Apollo graphql server example](https://github.com/Akryum/apollo-server-example) @@ -28,6 +30,7 @@ Integrates [apollo](https://www.apollographql.com/) in your [Vue](http://vuejs.o - [Queries](#queries) - [Simple query](#simple-query) - [Query with parameters](#query-with-parameters) + - [Loading state](#loading-state) - [Option function](#option-function) - [Reactive query definition](#reactive-query-definition) - [Reactive parameters](#reactive-parameters) @@ -46,14 +49,17 @@ Integrates [apollo](https://www.apollographql.com/) in your [Vue](http://vuejs.o - [Skip all](#skip-all) - [Multiple clients](#multiple-clients) - [Server-Side Rendering](#server-side-rendering) +- [Query Components](#query-components) - [Migration](#migration) - [API Reference](#api-reference) ## Installation +**If you are using vue-cli 3.x, you can [use this vue-cli plugin](https://github.com/Akryum/vue-cli-plugin-apollo) to get started in a few minutes!** + Try and install these packages before server side set (of packages), add apollo to meteor.js before then, too. - npm install --save vue-apollo@next graphql apollo-client apollo-link apollo-link-http apollo-cache-inmemory graphql-tag + npm install --save vue-apollo graphql apollo-client apollo-link apollo-link-http apollo-cache-inmemory graphql-tag In your app, create an `ApolloClient` instance and install the `VueApollo` plugin: @@ -91,7 +97,7 @@ const apolloProvider = new VueApollo({ new Vue({ el: '#app', - apolloProvider, + provide: apolloProvider.provide(), render: h => h(App), }) ``` @@ -267,12 +273,26 @@ And then use it in your vue component:

Ping

- {{ping}} + {{ ping }}

``` +### Loading state + +You can display a loading state thanks to the `$apollo.loading` prop: + +```html +
Loading...
+``` + +Or for this specific `ping` query: + +```html +
Loading...
+``` + ### Option function You can use a function to initialize the key: @@ -1260,6 +1280,14 @@ export default willPrefetch({ }) ``` +The second parameter is optional: it's a callback that gets the context and should return a boolean indicating if the component should be prefetched: + +```js +willPrefetch({ + // Component definition... +}, context => context.url === '/foo') +``` + ### On the server To prefetch all the apollo queries you marked, use the `apolloProvider.prefetchAll` method. The first argument is the context object passed to the `prefetch` hooks (see above). It is recommended to pass the vue-router `currentRoute` object. The second argument is the array of component definition to include (e.g. from `router.getMatchedComponents` method). The third argument is an optional `options` object. It returns a promise resolved when all the apollo queries are loaded. @@ -1492,6 +1520,89 @@ router.onReady(() => { }) ``` +## Query components + +(WIP) You can use the `ApolloQuery` (or `apollo-query`) component to make watched Apollo queries directly in your template: + +```html + + + +``` + +Props: + +- `query`: GraphQL query (transformed by `graphql-tag`) +- `variables`: Object of GraphQL variables +- `fetchPolicy`: See [apollo fetchPolicy](https://www.apollographql.com/docs/react/basics/queries.html#graphql-config-options-fetchPolicy) +- `pollInterval`: See [apollo pollInterval](https://www.apollographql.com/docs/react/basics/queries.html#graphql-config-options-pollInterval) +- `notifyOnNetworkStatusChange`: See [apollo notifyOnNetworkStatusChange](https://www.apollographql.com/docs/react/basics/queries.html#graphql-config-options-notifyOnNetworkStatusChange) +- `context`: See [apollo context](https://www.apollographql.com/docs/react/basics/queries.html#graphql-config-options-context) +- `skip`: Boolean disabling query fetching +- `clienId`: Used to resolve the Apollo Client used (defined in ApolloProvider) +- `tag`: String HTML tag name (default: `div`) + +Scoped slot props: +- `result`: Apollo Query result + - `result.data`: Data returned by the query + - `result.loading`: Boolean indicating that a request is in flight + - `result.error`: Eventual error for the current result + - `result.networkStatus`: See [apollo networkStatus](https://www.apollographql.com/docs/react/basics/queries.html#graphql-query-data-networkStatus) +- `query`: Smart Query associated with the component + +(WIP) You can subscribe to mode data with the `ApolloSubscribeToMore` (or `apollo-subscribe-to-more`) component: + +```html + + + +``` + +*You can put as many of those as you want inside a `` component.* + --- # Migration diff --git a/build/rollup.config.base.js b/build/rollup.config.base.js index f4e3460..0bd0731 100644 --- a/build/rollup.config.base.js +++ b/build/rollup.config.base.js @@ -7,7 +7,6 @@ const config = require('../package.json') export default { input: 'src/index.js', - name: 'vue-apollo', plugins: [ resolve({ jsnext: true, diff --git a/build/rollup.config.browser.js b/build/rollup.config.browser.js index 21abb07..0818621 100644 --- a/build/rollup.config.browser.js +++ b/build/rollup.config.browser.js @@ -6,8 +6,8 @@ const config = Object.assign({}, base, { output: { file: 'dist/vue-apollo.min.js', format: 'iife', + name: 'VueApollo', }, - name: 'VueApollo', }) config.plugins.push(uglify({}, minify)) diff --git a/build/rollup.config.es.js b/build/rollup.config.es.js index 2971298..de8bc8a 100644 --- a/build/rollup.config.es.js +++ b/build/rollup.config.es.js @@ -4,6 +4,7 @@ const config = Object.assign({}, base, { output: { file: 'dist/vue-apollo.esm.js', format: 'es', + name: 'vue-apollo', }, }) diff --git a/build/rollup.config.umd.js b/build/rollup.config.umd.js index 46375c9..0c92304 100644 --- a/build/rollup.config.umd.js +++ b/build/rollup.config.umd.js @@ -4,6 +4,7 @@ const config = Object.assign({}, base, { output: { file: 'dist/vue-apollo.umd.js', format: 'umd', + name: 'vue-apollo', }, }) diff --git a/package.json b/package.json index 8f296cb..5936351 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,11 @@ "build:es": "rollup --config build/rollup.config.es.js", "build:umd": "rollup --config build/rollup.config.umd.js", "prepublishOnly": "npm run test && npm run build", - "dev": "npm-watch", - "test": "npm run test:types", + "dev": "nodemon --exec 'npm run build' --watch src", + "test": "npm run test:eslint && npm run test:types", + "test:eslint": "eslint --ext .js src", "test:types": "tsc -p types/test" }, - "watch": { - "build": "src/*.js" - }, "repository": { "type": "git", "url": "git+https://github.com/Akryum/vue-apollo.git" @@ -61,7 +59,7 @@ "eslint-plugin-standard": "^3.0.1", "graphql": "^0.12.3", "graphql-tag": "^2.5.0", - "npm-watch": "^0.3.0", + "nodemon": "^1.14.12", "rimraf": "^2.6.1", "rollup": "^0.55.3", "rollup-plugin-babel": "^3.0.2", diff --git a/src/apollo-provider.js b/src/apollo-provider.js index 5fe7f6c..c74dd7f 100644 --- a/src/apollo-provider.js +++ b/src/apollo-provider.js @@ -16,14 +16,20 @@ export class ApolloProvider { this.prefetchQueries = [] } - willPrefetchQuery (queryOptions, client) { + provide (key = '$apolloProvider') { + return { + [key]: this, + } + } + + addQueryToPrefetch (queryOptions, client) { this.prefetchQueries.push({ queryOptions, client, }) } - willPrefetch (component) { + prefetchComponent (component, context) { component = getMergedDefinition(component) const apolloOptions = component.apollo @@ -42,14 +48,14 @@ export class ApolloProvider { ) ) ) { - this.willPrefetchQuery(options, options.client || componentClient) + this.addQueryToPrefetch(options, options.client || componentClient) } } } - willPrefetchComponents (definitions) { + prefetchComponents (definitions) { for (const def of definitions) { - this.willPrefetch(def) + this.prefetchComponent(def) } } @@ -65,11 +71,21 @@ export class ApolloProvider { }, options) if (components) { - this.willPrefetchComponents(components) + this.prefetchComponents(components) } if (finalOptions.includeGlobal) { - this.willPrefetchComponents(globalPrefetchs) + this.prefetchComponents(globalPrefetchs.filter( + ({ component, contextCallback }) => { + let result = true + if (typeof contextCallback === 'function') { + result = !!contextCallback(context) + } + return result + } + ).map( + ({ component }) => component + ), context) } return Promise.all(this.prefetchQueries.map( @@ -166,7 +182,14 @@ export class ApolloProvider { const globalPrefetchs = [] -export function willPrefetch (component) { - globalPrefetchs.push(component) +export function willPrefetch (component, contextCallback = null) { + globalPrefetchs.push({ component, contextCallback }) return component } + +// Global access for libraries +if (typeof window !== 'undefined') { + window.vueApolloWillPrefetch = willPrefetch +} else if (typeof global !== 'undefined') { + global.vueApolloWillPrefetch = willPrefetch +} diff --git a/src/components/ApolloQuery.js b/src/components/ApolloQuery.js new file mode 100644 index 0000000..75651c9 --- /dev/null +++ b/src/components/ApolloQuery.js @@ -0,0 +1,167 @@ +function isDataFilled (data) { + return Object.keys(data).length > 0 +} + +export default { + name: 'ApolloQuery', + + provide () { + return { + getDollarApollo: this.getDollarApollo, + getApolloQuery: this.getApolloQuery, + } + }, + + props: { + query: { + type: Object, + required: true, + }, + + variables: { + type: Object, + default: null, + }, + + fetchPolicy: { + type: String, + default: 'cache-first', + }, + + pollInterval: { + type: Number, + default: 0, + }, + + notifyOnNetworkStatusChange: { + type: Boolean, + default: false, + }, + + context: { + type: Object, + default: null, + }, + + skip: { + type: Boolean, + default: false, + }, + + clientId: { + type: String, + default: undefined, + }, + + tag: { + type: String, + default: 'div', + }, + }, + + data () { + return { + result: { + data: null, + loading: false, + networkStatus: 7, + error: null, + }, + } + }, + + watch: { + fetchPolicy (value) { + this.$apollo.queries.query.setOptions({ + fetchPolicy: value, + }) + }, + + pollInterval (value) { + this.$apollo.queries.query.setOptions({ + pollInterval: value, + }) + }, + + notifyOnNetworkStatusChange (value) { + this.$apollo.queries.query.setOptions({ + notifyOnNetworkStatusChange: value, + }) + }, + }, + + apollo: { + $client () { + return this.clientId + }, + + query () { + return { + query () { return this.query }, + variables () { return this.variables }, + fetchPolicy: this.fetchPolicy, + pollInterval: this.pollInterval, + notifyOnNetworkStatusChange: this.notifyOnNetworkStatusChange, + context () { return this.context }, + skip () { return this.skip }, + manual: true, + result (result) { + const { errors, loading, networkStatus } = result + let { error } = result + result = Object.assign({}, result) + + if (errors && errors.length) { + error = new Error(`Apollo errors occured (${errors.length})`) + error.graphQLErrors = errors + } + + let data = {} + + if (loading) { + Object.assign(data, this.$_previousData, result.data) + } else if (error) { + Object.assign(data, this.$apollo.queries.query.observer.getLastResult() || {}, result.data) + } else { + data = result.data + this.$_previousData = result.data + } + + this.result = { + data: isDataFilled(data) ? data : undefined, + loading, + error, + networkStatus, + } + }, + error (error) { + this.result.loading = false + this.result.error = error + console.log(this.$apollo.queries.query.observer.currentResult()) + }, + } + }, + }, + + methods: { + getDollarApollo () { + return this.$apollo + }, + + getApolloQuery () { + return this.$apollo.queries.query + }, + }, + + render (h) { + let result = this.$scopedSlots.default({ + result: this.result, + query: this.$apollo.queries.query, + }) + if (Array.isArray(result)) { + result.concat(this.$slots.default) + } else { + result = [result].concat(this.$slots.default) + } + return h(this.tag, result) + }, +} diff --git a/src/components/ApolloSubscribeToMore.js b/src/components/ApolloSubscribeToMore.js new file mode 100644 index 0000000..05b9431 --- /dev/null +++ b/src/components/ApolloSubscribeToMore.js @@ -0,0 +1,69 @@ +let uid = 0 + +export default { + name: 'ApolloSubscribeToMore', + + inject: [ + 'getDollarApollo', + 'getApolloQuery', + ], + + props: { + document: { + type: Object, + required: true, + }, + + variables: { + type: Object, + default: null, + }, + + updateQuery: { + type: Function, + default: null, + }, + }, + + watch: { + document: 'refresh', + variables: 'refresh', + }, + + created () { + this.$_key = `sub_component_${uid++}` + }, + + mounted () { + this.refresh() + }, + + beforeDestroy () { + this.destroy() + }, + + methods: { + destroy () { + if (this.$_sub) { + this.$_sub.destroy() + } + }, + + refresh () { + this.destroy() + + this.$_sub = this.getDollarApollo().addSmartSubscription(this.$_key, { + document: this.document, + variables: this.variables, + updateQuery: this.updateQuery, + linkedQuery: this.getApolloQuery(), + }) + + console.log(this.$_key, this.$_sub) + }, + }, + + render (h) { + return null + }, +} diff --git a/src/dollar-apollo.js b/src/dollar-apollo.js index 67e265e..3866c27 100644 --- a/src/dollar-apollo.js +++ b/src/dollar-apollo.js @@ -1,4 +1,5 @@ -import { SmartQuery, SmartSubscription } from './smart-apollo' +import SmartQuery from './smart-query' +import SmartSubscription from './smart-subscription' import { reapply } from './utils' export class DollarApollo { @@ -15,14 +16,14 @@ export class DollarApollo { } get provider () { - return this._apolloProvider || this.vm.$root._apolloProvider + return this.vm.$apolloProvider } query (options) { return this.getClient(options).query(options) } - getClient (options) { + getClient (options = null) { if (!options || !options.client) { if (typeof this.client === 'object') { return this.client @@ -75,6 +76,10 @@ export class DollarApollo { } } + get loading () { + return this.vm.$data.$apolloData && this.vm.$data.$apolloData.loading !== 0 + } + addSmartQuery (key, options) { options = reapply(options, this.vm) diff --git a/src/index.js b/src/index.js index 67ecace..9d168c7 100644 --- a/src/index.js +++ b/src/index.js @@ -1,30 +1,24 @@ import omit from 'lodash.omit' import { DollarApollo } from './dollar-apollo' import { ApolloProvider as apolloProvider } from './apollo-provider' +import CApolloQuery from './components/ApolloQuery' +import CApolloSubscribeToMore from './components/ApolloSubscribeToMore' import { Globals } from './utils' const keywords = [ '$subscribe', ] -const prepare = function prepare () { - let apolloProvider - if (this.$options.apolloProvider) { - apolloProvider = this._apolloProvider = this.$options.apolloProvider - } else { - apolloProvider = this.$root._apolloProvider - } +const launch = function launch () { + const apolloProvider = this.$apolloProvider - if (this._apolloPrepared) return - this._apolloPrepared = true + if (this._apolloLaunched || !apolloProvider) return + this._apolloLaunched = true // Prepare properties let apollo = this.$options.apollo if (apollo) { - this._apolloQueries = {} - this._apolloInitData = {} - if (!apollo.$init) { apollo.$init = true @@ -34,22 +28,6 @@ const prepare = function prepare () { } } - // watchQuery - for (let key in apollo) { - if (key.charAt(0) !== '$') { - this._apolloInitData[key] = null - this._apolloQueries[key] = apollo[key] - } - } - } -} - -const launch = function launch () { - if (this._apolloLaunched) return - this._apolloLaunched = true - - let apollo = this.$options.apollo - if (apollo) { defineReactiveSetter(this.$apollo, 'skipAll', apollo.$skipAll) defineReactiveSetter(this.$apollo, 'skipAllQueries', apollo.$skipAllQueries) defineReactiveSetter(this.$apollo, 'skipAllSubscriptions', apollo.$skipAllSubscriptions) @@ -57,16 +35,14 @@ const launch = function launch () { defineReactiveSetter(this.$apollo, 'loadingKey', apollo.$loadingKey) defineReactiveSetter(this.$apollo, 'error', apollo.$error) defineReactiveSetter(this.$apollo, 'watchLoading', apollo.$watchLoading) - } - if (this._apolloQueries) { // watchQuery - for (let key in this._apolloQueries) { - this.$apollo.addSmartQuery(key, this._apolloQueries[key]) + for (let key in apollo) { + if (key.charAt(0) !== '$') { + this.$apollo.addSmartQuery(key, apollo[key]) + } } - } - if (apollo) { if (apollo.subscribe) { Globals.Vue.util.warn('vue-apollo -> `subscribe` option is deprecated. Use the `$subscribe` option instead.') } @@ -123,17 +99,35 @@ export function install (Vue, options) { }, }) + const vueVersion = Vue.version.substr(0, Vue.version.indexOf('.')) + Vue.mixin({ + ...vueVersion === '1' ? { + init () { + let apolloProvider + if (this.$options.apolloProvider) { + apolloProvider = this._apolloProvider = this.$options.apolloProvider + } else { + apolloProvider = this.$root._apolloProvider + } + this.$apolloProvider = apolloProvider + }, + } : {}, - // Vue 1.x - init: prepare, - // Vue 2.x - beforeCreate: prepare, + ...vueVersion === '2' ? { + inject: { + $apolloProvider: { default: null }, + }, - // Better devtools support - data () { - return this._apolloInitData || {} - }, + data () { + return this.$options.apollo ? { + '$apolloData': { + queries: {}, + loading: 0, + }, + } : {} + }, + } : {}, created: launch, @@ -145,6 +139,13 @@ export function install (Vue, options) { }, }) + + if (vueVersion === '2') { + Vue.component('apollo-query', CApolloQuery) + Vue.component('ApolloQuery', CApolloQuery) + Vue.component('apollo-subscribe-to-more', CApolloSubscribeToMore) + Vue.component('ApolloSubscribeToMore', CApolloSubscribeToMore) + } } apolloProvider.install = install @@ -152,10 +153,14 @@ apolloProvider.install = install // eslint-disable-next-line no-undef apolloProvider.version = VERSION +// Apollo provider export const ApolloProvider = apolloProvider - export { willPrefetch } from './apollo-provider' +// Components +export const ApolloQuery = CApolloQuery +export const ApolloSubscribeToMore = CApolloSubscribeToMore + // Auto-install let GlobalVue = null if (typeof window !== 'undefined') { diff --git a/src/smart-apollo.js b/src/smart-apollo.js index 7bd5aef..e493fea 100644 --- a/src/smart-apollo.js +++ b/src/smart-apollo.js @@ -1,8 +1,7 @@ import omit from 'lodash.omit' import { throttle, debounce } from './utils' -import { VUE_APOLLO_QUERY_KEYWORDS } from './consts' -class SmartApollo { +export default class SmartApollo { type = null vueApolloSpecialKeys = [] @@ -12,6 +11,7 @@ class SmartApollo { this.options = Object.assign({}, options) this._skip = false this._watchers = [] + this._destroyed = false // Query callback if (typeof this.options.query === 'function') { @@ -32,6 +32,16 @@ class SmartApollo { })) } + // Apollo context + if (typeof this.options.context === 'function') { + const cb = this.options.context.bind(this.vm) + this.options.context = cb() + this._watchers.push(this.vm.$watch(cb, context => { + this.options.context = context + this.refresh() + })) + } + if (this.vm.$isServer) { this.options.fetchPolicy = 'cache-first' } @@ -146,244 +156,12 @@ class SmartApollo { } destroy () { + if (this._destroyed) return + + this._destroyed = true this.stop() for (const unwatch of this._watchers) { unwatch() } } } - -export class SmartQuery extends SmartApollo { - type = 'query' - vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS - loading = false - - constructor (vm, key, options, autostart = true) { - // Simple query - if (!options.query) { - const query = options - options = { - query, - } - } - - super(vm, key, options, autostart) - } - - stop () { - super.stop() - - if (this.observer) { - this.observer.stopPolling() - this.observer = null - } - } - - executeApollo (variables) { - if (this.observer) { - // Update variables - // Don't use setVariables directly or it will ignore cache - this.observer.setOptions(this.generateApolloOptions(variables)) - } else { - if (this.sub) { - this.sub.unsubscribe() - } - - // Create observer - this.observer = this.vm.$apollo.watchQuery(this.generateApolloOptions(variables)) - - // Create subscription - this.sub = this.observer.subscribe({ - next: this.nextResult.bind(this), - error: this.catchError.bind(this), - }) - } - - const currentResult = this.maySetLoading() - - if (!currentResult.loading) { - this.nextResult(currentResult) - } - - super.executeApollo(variables) - } - - maySetLoading (force = false) { - const currentResult = this.observer.currentResult() - if (force || currentResult.loading) { - if (!this.loading) { - this.applyLoadingModifier(1) - } - this.loading = true - } - return currentResult - } - - nextResult (result) { - const { data, loading } = result - - if (!loading) { - this.loadingDone() - } - - const hasResultCallback = typeof this.options.result === 'function' - - if (typeof data === 'undefined') { - // No result - } else if (typeof this.options.update === 'function') { - this.vm[this.key] = this.options.update.call(this.vm, data) - } else if (data[this.key] === undefined && !this.options.manual) { - console.error(`Missing ${this.key} attribute on result`, data) - } else if (!this.options.manual) { - this.vm[this.key] = data[this.key] - } else if (!hasResultCallback) { - console.error(`${this.key} query must have a 'result' hook in manual mode`) - } - - if (hasResultCallback) { - this.options.result.call(this.vm, result) - } - } - - catchError (error) { - super.catchError(error) - this.loadingDone() - } - - get loadingKey () { - return this.options.loadingKey || this.vm.$apollo.loadingKey - } - - watchLoading (...args) { - this.options.watchLoading && this.options.watchLoading.call(this.vm, ...args) - this.vm.$apollo.watchLoading && this.vm.$apollo.watchLoading.call(this.vm, ...args) - this.vm.$apollo.provider.watchLoading && this.vm.$apollo.provider.watchLoading.call(this.vm, ...args) - } - - applyLoadingModifier (value) { - const loadingKey = this.loadingKey - if (loadingKey && typeof this.vm[loadingKey] === 'number') { - this.vm[loadingKey] += value - } - - this.watchLoading(value === 1, value) - } - - loadingDone () { - if (this.loading) { - this.applyLoadingModifier(-1) - } - this.loading = false - } - - fetchMore (...args) { - if (this.observer) { - this.maySetLoading(true) - return this.observer.fetchMore(...args).then(result => { - if (!result.loading) { - this.loadingDone() - } - return result - }) - } - } - - subscribeToMore (...args) { - if (this.observer) { - return { - unsubscribe: this.observer.subscribeToMore(...args), - } - } - } - - refetch (variables) { - variables && (this.options.variables = variables) - if (this.observer) { - const result = this.observer.refetch(variables).then((result) => { - if (!result.loading) { - this.loadingDone() - } - return result - }) - this.maySetLoading() - return result - } - } - - setVariables (variables, tryFetch) { - this.options.variables = variables - if (this.observer) { - const result = this.observer.setVariables(variables, tryFetch) - this.maySetLoading() - return result - } - } - - setOptions (options) { - Object.assign(this.options, options) - if (this.observer) { - const result = this.observer.setOptions(options) - this.maySetLoading() - return result - } - } - - startPolling (...args) { - if (this.observer) { - return this.observer.startPolling(...args) - } - } - - stopPolling (...args) { - if (this.observer) { - return this.observer.stopPolling(...args) - } - } -} - -export class SmartSubscription extends SmartApollo { - type = 'subscription' - vueApolloSpecialKeys = [ - 'variables', - 'result', - 'error', - 'throttle', - 'debounce', - 'linkedQuery', - ] - - executeApollo (variables) { - const variablesJson = JSON.stringify(variables) - if (this.sub) { - // do nothing if subscription is already running using exactly the same variables - if (variablesJson === this.previousVariablesJson) { - return - } - this.sub.unsubscribe() - } - this.previousVariablesJson = variablesJson - - const apolloOptions = this.generateApolloOptions(variables) - - if (this.options.linkedQuery) { - this.sub = this.options.linkedQuery.subscribeToMore(apolloOptions) - } else { - // Create observer - this.observer = this.vm.$apollo.subscribe(apolloOptions) - - // Create subscription - this.sub = this.observer.subscribe({ - next: this.nextResult.bind(this), - error: this.catchError.bind(this), - }) - } - - super.executeApollo(variables) - } - - nextResult (data) { - if (typeof this.options.result === 'function') { - this.options.result.call(this.vm, data) - } - } -} diff --git a/src/smart-query.js b/src/smart-query.js new file mode 100644 index 0000000..b96ef5d --- /dev/null +++ b/src/smart-query.js @@ -0,0 +1,215 @@ +import SmartApollo from './smart-apollo' +import { VUE_APOLLO_QUERY_KEYWORDS } from './consts' + +export default class SmartQuery extends SmartApollo { + type = 'query' + vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS + _loading = false + + constructor (vm, key, options, autostart = true) { + // Simple query + if (!options.query) { + const query = options + options = { + query, + } + } + + // Add reactive data related to the query + if (vm.$data.$apolloData && !vm.$data.$apolloData.queries[key]) { + vm.$set(vm.$data.$apolloData.queries, key, { + loading: false, + }) + } + + super(vm, key, options, autostart) + } + + get client () { + return this.vm.$apollo.getClient(this.options) + } + + get loading () { + return this.vm.$data.$apolloData ? this.vm.$data.$apolloData.queries[this.key].loading : this._loading + } + + set loading (value) { + if (this._loading !== value) { + this._loading = value + if (this.vm.$data.$apolloData) { + this.vm.$data.$apolloData.queries[this.key].loading = value + this.vm.$data.$apolloData.loading += value ? 1 : -1 + } + } + } + + stop () { + super.stop() + + if (this.observer) { + this.observer.stopPolling() + this.observer = null + } + } + + executeApollo (variables) { + if (this.observer) { + // Update variables + // Don't use setVariables directly or it will ignore cache + this.observer.setOptions(this.generateApolloOptions(variables)) + } else { + if (this.sub) { + this.sub.unsubscribe() + } + + // Create observer + this.observer = this.vm.$apollo.watchQuery(this.generateApolloOptions(variables)) + + // Create subscription + this.sub = this.observer.subscribe({ + next: this.nextResult.bind(this), + error: this.catchError.bind(this), + }) + } + + const currentResult = this.maySetLoading() + + if (!currentResult.loading) { + this.nextResult(currentResult) + } + + super.executeApollo(variables) + } + + maySetLoading (force = false) { + const currentResult = this.observer.currentResult() + if (force || currentResult.loading) { + if (!this.loading) { + this.applyLoadingModifier(1) + } + this.loading = true + } + return currentResult + } + + nextResult (result) { + const { data, loading } = result + + if (!loading) { + this.loadingDone() + } + + const hasResultCallback = typeof this.options.result === 'function' + + if (typeof data === 'undefined') { + // No result + } else if (typeof this.options.update === 'function') { + this.vm[this.key] = this.options.update.call(this.vm, data) + } else if (data[this.key] === undefined && !this.options.manual) { + console.error(`Missing ${this.key} attribute on result`, data) + } else if (!this.options.manual) { + this.vm[this.key] = data[this.key] + } else if (!hasResultCallback) { + console.error(`${this.key} query must have a 'result' hook in manual mode`) + } + + if (hasResultCallback) { + this.options.result.call(this.vm, result) + } + } + + catchError (error) { + super.catchError(error) + this.loadingDone() + } + + get loadingKey () { + return this.options.loadingKey || this.vm.$apollo.loadingKey + } + + watchLoading (...args) { + this.options.watchLoading && this.options.watchLoading.call(this.vm, ...args) + this.vm.$apollo.watchLoading && this.vm.$apollo.watchLoading.call(this.vm, ...args) + this.vm.$apollo.provider.watchLoading && this.vm.$apollo.provider.watchLoading.call(this.vm, ...args) + } + + applyLoadingModifier (value) { + const loadingKey = this.loadingKey + if (loadingKey && typeof this.vm[loadingKey] === 'number') { + this.vm[loadingKey] += value + } + + this.watchLoading(value === 1, value) + } + + loadingDone () { + if (this.loading) { + this.applyLoadingModifier(-1) + } + this.loading = false + } + + fetchMore (...args) { + if (this.observer) { + this.maySetLoading(true) + return this.observer.fetchMore(...args).then(result => { + if (!result.loading) { + this.loadingDone() + } + return result + }) + } + } + + subscribeToMore (...args) { + if (this.observer) { + return { + unsubscribe: this.observer.subscribeToMore(...args), + } + } + } + + refetch (variables) { + variables && (this.options.variables = variables) + if (this.observer) { + const result = this.observer.refetch(variables).then((result) => { + if (!result.loading) { + this.loadingDone() + } + return result + }) + this.maySetLoading() + return result + } + } + + setVariables (variables, tryFetch) { + this.options.variables = variables + if (this.observer) { + const result = this.observer.setVariables(variables, tryFetch) + this.maySetLoading() + return result + } + } + + setOptions (options) { + Object.assign(this.options, options) + if (this.observer) { + const result = this.observer.setOptions(options) + this.maySetLoading() + return result + } + } + + startPolling (...args) { + if (this.observer) { + return this.observer.startPolling(...args) + } + } + + stopPolling (...args) { + if (this.observer) { + return this.observer.stopPolling(...args) + } + } +} diff --git a/src/smart-subscription.js b/src/smart-subscription.js new file mode 100644 index 0000000..aa4045e --- /dev/null +++ b/src/smart-subscription.js @@ -0,0 +1,48 @@ +import SmartApollo from './smart-apollo' + +export default class SmartSubscription extends SmartApollo { + type = 'subscription' + vueApolloSpecialKeys = [ + 'variables', + 'result', + 'error', + 'throttle', + 'debounce', + 'linkedQuery', + ] + + executeApollo (variables) { + const variablesJson = JSON.stringify(variables) + if (this.sub) { + // do nothing if subscription is already running using exactly the same variables + if (variablesJson === this.previousVariablesJson) { + return + } + this.sub.unsubscribe() + } + this.previousVariablesJson = variablesJson + + const apolloOptions = this.generateApolloOptions(variables) + + if (this.options.linkedQuery) { + this.sub = this.options.linkedQuery.subscribeToMore(apolloOptions) + } else { + // Create observer + this.observer = this.vm.$apollo.subscribe(apolloOptions) + + // Create subscription + this.sub = this.observer.subscribe({ + next: this.nextResult.bind(this), + error: this.catchError.bind(this), + }) + } + + super.executeApollo(variables) + } + + nextResult (data) { + if (typeof this.options.result === 'function') { + this.options.result.call(this.vm, data) + } + } +} diff --git a/yarn.lock b/yarn.lock index 5615653..4c8c68b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -126,7 +126,7 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.1.0: +ansi-styles@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" dependencies: @@ -154,8 +154,8 @@ apollo-cache@^1.1.2: apollo-utilities "^1.0.6" apollo-client@^2.0.3: - version "2.2.2" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.2.2.tgz#55d7b7a85d28161a6ecddd86cde8180be52193f6" + version "2.2.3" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.2.3.tgz#a8df51c9ff89acb0d98de81b911e56b1ce468ca3" dependencies: "@types/zen-observable" "^0.5.3" apollo-cache "^1.1.2" @@ -168,24 +168,24 @@ apollo-client@^2.0.3: "@types/async" "2.0.47" apollo-link-dedup@^1.0.0: - version "1.0.5" - resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.5.tgz#1c213d7ebbe48e74b016fffacd7e6a53dc309e32" + version "1.0.6" + resolved "https://registry.yarnpkg.com/apollo-link-dedup/-/apollo-link-dedup-1.0.6.tgz#566ab421a5f6ef41995e2e386f575600d51b1408" dependencies: - apollo-link "^1.0.7" + apollo-link "^1.1.0" apollo-link-http@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.3.2.tgz#63537ee5ecf9c004efb0317f1222b7dbc6f21559" + version "1.3.3" + resolved "https://registry.yarnpkg.com/apollo-link-http/-/apollo-link-http-1.3.3.tgz#cb792c73266607e6361c8c1cc4dd42d405ca08f1" dependencies: - apollo-link "^1.0.7" + apollo-link "^1.1.0" -apollo-link@^1.0.0, apollo-link@^1.0.3, apollo-link@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.0.7.tgz#42cd38a7378332fc3e41a214ff6a6e5e703a556f" +apollo-link@^1.0.0, apollo-link@^1.0.3, apollo-link@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.1.0.tgz#9d573b16387ee0d8e147b1f319e42c8c562f18f7" dependencies: "@types/zen-observable" "0.5.3" apollo-utilities "^1.0.0" - zen-observable "^0.6.0" + zen-observable "^0.7.0" apollo-utilities@^1.0.0, apollo-utilities@^1.0.6: version "1.0.6" @@ -965,8 +965,8 @@ boxen@^1.2.1: widest-line "^2.0.0" brace-expansion@^1.1.7: - version "1.1.8" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.8.tgz#c07b211c7c952ec1f8efd51a77ef0d1d3990a292" + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -1035,8 +1035,8 @@ camelcase@^4.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" caniuse-lite@^1.0.30000792: - version "1.0.30000804" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000804.tgz#8729a143d65378e8936adbb161f550e9c49fc09d" + version "1.0.30000808" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000808.tgz#7d759b5518529ea08b6705a19e70dbf401628ffc" capture-stack-trace@^1.0.0: version "1.0.0" @@ -1057,20 +1057,20 @@ chalk@^1.1.3: supports-color "^2.0.0" chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" + version "2.3.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796" dependencies: - ansi-styles "^3.1.0" + ansi-styles "^3.2.0" escape-string-regexp "^1.0.5" - supports-color "^4.0.0" + supports-color "^5.2.0" chardet@^0.4.0: version "0.4.2" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" chokidar@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.0.tgz#6686313c541d3274b2a5c01233342037948c911b" + version "2.0.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.0.1.tgz#6e67e9998fe10e8f651e975ca62460456ff8e297" dependencies: anymatch "^2.0.0" async-each "^1.0.0" @@ -1082,6 +1082,7 @@ chokidar@^2.0.0: normalize-path "^2.1.1" path-is-absolute "^1.0.0" readdirp "^2.0.0" + upath "1.0.0" optionalDependencies: fsevents "^1.0.0" @@ -1143,9 +1144,9 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@~2.13.0: - version "2.13.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" +commander@~2.14.1: + version "2.14.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa" component-emitter@^1.2.1: version "1.2.1" @@ -1836,8 +1837,8 @@ graphql-anywhere@^4.1.3: apollo-utilities "^1.0.6" graphql-tag@^2.5.0: - version "2.7.1" - resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.7.1.tgz#17e0beae35d5b4580b419891d40bf525c19c8b61" + version "2.7.3" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.7.3.tgz#5040112a1b4623285ef017c252276f0dea37f03f" graphql@^0.12.3: version "0.12.3" @@ -1862,9 +1863,9 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" -has-flag@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" has-unicode@^2.0.0: version "2.0.1" @@ -2367,6 +2368,10 @@ lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" +lodash@3.x: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + lodash@^4.17.4, lodash@^4.2.0, lodash@^4.3.0: version "4.17.5" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" @@ -2539,7 +2544,7 @@ node-pre-gyp@^0.6.39: tar "^2.2.1" tar-pack "^3.4.0" -nodemon@^1.12.1: +nodemon@^1.14.12: version "1.14.12" resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.14.12.tgz#fe059424b15ebdb107696287a558d9cf53a63999" dependencies: @@ -2587,13 +2592,6 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-watch@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/npm-watch/-/npm-watch-0.3.0.tgz#8f4272c0143e2f4720dbafb111fb91d015fbf82d" - dependencies: - nodemon "^1.12.1" - through2 "^2.0.0" - npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -2822,9 +2820,9 @@ private@^0.1.6, private@^0.1.7: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" progress@^2.0.0: version "2.0.0" @@ -2885,14 +2883,14 @@ read-pkg@^2.0.0: normalize-package-data "^2.3.2" path-type "^2.0.0" -readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.1.5, readable-stream@^2.2.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c" +readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.4, readable-stream@^2.2.2: + version "2.3.4" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" dependencies: core-util-is "~1.0.0" inherits "~2.0.3" isarray "~1.0.0" - process-nextick-args "~1.0.6" + process-nextick-args "~2.0.0" safe-buffer "~5.1.1" string_decoder "~1.0.3" util-deprecate "~1.0.1" @@ -3097,8 +3095,8 @@ rollup-pluginutils@^2.0.1: micromatch "^2.3.11" rollup@^0.55.3: - version "0.55.3" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.55.3.tgz#0af082a766d51c3058430c8372442ff5207d8736" + version "0.55.5" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.55.5.tgz#2f88c300f7cf24b5ec2dca8a6aba73b04e087e93" run-async@^2.2.0: version "2.3.0" @@ -3357,11 +3355,11 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^4.0.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" +supports-color@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a" dependencies: - has-flag "^2.0.0" + has-flag "^3.0.0" symbol-observable@^1.0.2: version "1.2.0" @@ -3409,13 +3407,6 @@ text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" -through2@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" - dependencies: - readable-stream "^2.1.5" - xtend "~4.0.1" - through@2, through@^2.3.6, through@~2.3, through@~2.3.1: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -3500,10 +3491,10 @@ typescript@^2.6.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.1.tgz#bb3682c2c791ac90e7c6210b26478a8da085c359" uglify-es@^3.1.6, uglify-es@^3.3.7: - version "3.3.9" - resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677" + version "3.3.10" + resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.10.tgz#8b0b7992cebe20edc26de1bf325cef797b8f3fa5" dependencies: - commander "~2.13.0" + commander "~2.14.1" source-map "~0.6.1" uid-number@^0.0.6: @@ -3516,6 +3507,10 @@ undefsafe@^2.0.1: dependencies: debug "^2.2.0" +underscore.string@2.3.x: + version "2.3.3" + resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-2.3.3.tgz#71c08bf6b428b1133f37e78fa3a21c82f7329b0d" + union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" @@ -3542,6 +3537,13 @@ unzip-response@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-2.0.1.tgz#d2f0f737d16b0615e72a6935ed04214572d56f97" +upath@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.0.tgz#b4706b9461ca8473adf89133d235689ca17f3656" + dependencies: + lodash "3.x" + underscore.string "2.3.x" + update-notifier@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.3.0.tgz#4e8827a6bb915140ab093559d7014e3ebb837451" @@ -3649,18 +3651,10 @@ xdg-basedir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xdg-basedir/-/xdg-basedir-3.0.0.tgz#496b2cc109eca8dbacfe2dc72b603c17c5870ad4" -xtend@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" - yallist@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" -zen-observable@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.6.1.tgz#01dbed3bc8d02cbe9ee1112c83e04c807f647244" - zen-observable@^0.7.0: version "0.7.1" resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.7.1.tgz#f84075c0ee085594d3566e1d6454207f126411b3" From 921c7e17b57139c87387cfd0961713c07cbd8c1f Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 11 Feb 2018 21:57:56 +0100 Subject: [PATCH 21/22] Version bump --- dist/vue-apollo.esm.js | 638 ++++++++++++++++++++++++++-------------- dist/vue-apollo.min.js | 2 +- dist/vue-apollo.umd.js | 640 +++++++++++++++++++++++++++-------------- package.json | 2 +- 4 files changed, 864 insertions(+), 418 deletions(-) diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js index 14fb390..d2c5098 100644 --- a/dist/vue-apollo.esm.js +++ b/dist/vue-apollo.esm.js @@ -1619,7 +1619,7 @@ var now = function() { * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ -function debounce$1(func, wait, options) { +function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, @@ -1785,7 +1785,7 @@ function debounce$1(func, wait, options) { * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ -function throttle$1(func, wait, options) { +function throttle(func, wait, options) { var leading = true, trailing = true; @@ -1796,7 +1796,7 @@ function throttle$1(func, wait, options) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } - return debounce$1(func, wait, { + return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing @@ -1927,7 +1927,7 @@ function toNumber(value) { : (reIsBadHex.test(value) ? NAN : +value); } -var lodash_throttle = throttle$1; +var lodash_throttle = throttle; /** * lodash (Custom Build) @@ -2059,7 +2059,7 @@ var now$1 = function() { * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ -function debounce$2(func, wait, options) { +function debounce$1(func, wait, options) { var lastArgs, lastThis, maxWait, @@ -2305,7 +2305,7 @@ function toNumber$1(value) { : (reIsBadHex$1.test(value) ? NAN$1 : +value); } -var lodash_debounce = debounce$2; +var lodash_debounce = debounce$1; var Globals = {}; @@ -2319,9 +2319,9 @@ function factory(action) { }; } -var throttle = factory(lodash_throttle); +var throttle$1 = factory(lodash_throttle); -var debounce = factory(lodash_debounce); +var debounce$2 = factory(lodash_debounce); function getMergedDefinition(def) { return Globals.Vue.util.mergeOptions({}, def); @@ -2334,8 +2334,6 @@ function reapply(options, context) { return options; } -var VUE_APOLLO_QUERY_KEYWORDS = ['variables', 'watch', 'update', 'result', 'error', 'loadingKey', 'watchLoading', 'skip', 'throttle', 'debounce', 'subscribeToMore', 'prefetch', 'manual']; - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { @@ -2346,118 +2344,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol -var asyncGenerator = function () { - function AwaitValue(value) { - this.value = value; - } - function AsyncGenerator(gen) { - var front, back; - - function send(key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - - if (back) { - back = back.next = request; - } else { - front = back = request; - resume(key, arg); - } - }); - } - - function resume(key, arg) { - try { - var result = gen[key](arg); - var value = result.value; - - if (value instanceof AwaitValue) { - Promise.resolve(value.value).then(function (arg) { - resume("next", arg); - }, function (arg) { - resume("throw", arg); - }); - } else { - settle(result.done ? "return" : "normal", result.value); - } - } catch (err) { - settle("throw", err); - } - } - - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: true - }); - break; - - case "throw": - front.reject(value); - break; - - default: - front.resolve({ - value: value, - done: false - }); - break; - } - - front = front.next; - - if (front) { - resume(front.key, front.arg); - } else { - back = null; - } - } - - this._invoke = send; - - if (typeof gen.return !== "function") { - this.return = undefined; - } - } - - if (typeof Symbol === "function" && Symbol.asyncIterator) { - AsyncGenerator.prototype[Symbol.asyncIterator] = function () { - return this; - }; - } - - AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); - }; - - AsyncGenerator.prototype.throw = function (arg) { - return this._invoke("throw", arg); - }; - - AsyncGenerator.prototype.return = function (arg) { - return this._invoke("return", arg); - }; - - return { - wrap: function (fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; - }, - await: function (value) { - return new AwaitValue(value); - } - }; -}(); @@ -2491,7 +2378,20 @@ var createClass = function () { +var defineProperty = function (obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +}; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { @@ -2608,6 +2508,7 @@ var SmartApollo = function () { this.options = Object.assign({}, options); this._skip = false; this._watchers = []; + this._destroyed = false; // Query callback if (typeof this.options.query === 'function') { @@ -2628,6 +2529,16 @@ var SmartApollo = function () { })); } + // Apollo context + if (typeof this.options.context === 'function') { + var cb = this.options.context.bind(this.vm); + this.options.context = cb(); + this._watchers.push(this.vm.$watch(cb, function (context) { + _this.options.context = context; + _this.refresh(); + })); + } + if (this.vm.$isServer) { this.options.fetchPolicy = 'cache-first'; } @@ -2673,8 +2584,8 @@ var SmartApollo = function () { this.starting = true; if (typeof this.options.variables === 'function') { var cb = this.executeApollo.bind(this); - cb = this.options.throttle ? throttle(cb, this.options.throttle) : cb; - cb = this.options.debounce ? debounce(cb, this.options.debounce) : cb; + cb = this.options.throttle ? throttle$1(cb, this.options.throttle) : cb; + cb = this.options.debounce ? debounce$2(cb, this.options.debounce) : cb; this.unwatchVariables = this.vm.$watch(function () { return _this2.options.variables.call(_this2.vm); }, cb, { @@ -2774,6 +2685,9 @@ var SmartApollo = function () { }, { key: 'destroy', value: function destroy() { + if (this._destroyed) return; + + this._destroyed = true; this.stop(); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; @@ -2817,6 +2731,8 @@ var SmartApollo = function () { return SmartApollo; }(); +var VUE_APOLLO_QUERY_KEYWORDS = ['variables', 'watch', 'update', 'result', 'error', 'loadingKey', 'watchLoading', 'skip', 'throttle', 'debounce', 'subscribeToMore', 'prefetch', 'manual']; + var SmartQuery = function (_SmartApollo) { inherits(SmartQuery, _SmartApollo); @@ -2832,12 +2748,19 @@ var SmartQuery = function (_SmartApollo) { }; } - var _this3 = possibleConstructorReturn(this, (SmartQuery.__proto__ || Object.getPrototypeOf(SmartQuery)).call(this, vm, key, options, autostart)); + // Add reactive data related to the query + if (vm.$data.$apolloData && !vm.$data.$apolloData.queries[key]) { + vm.$set(vm.$data.$apolloData.queries, key, { + loading: false + }); + } - _this3.type = 'query'; - _this3.vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS; - _this3.loading = false; - return _this3; + var _this = possibleConstructorReturn(this, (SmartQuery.__proto__ || Object.getPrototypeOf(SmartQuery)).call(this, vm, key, options, autostart)); + + _this.type = 'query'; + _this.vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS; + _this._loading = false; + return _this; } createClass(SmartQuery, [{ @@ -2911,7 +2834,7 @@ var SmartQuery = function (_SmartApollo) { // No result } else if (typeof this.options.update === 'function') { this.vm[this.key] = this.options.update.call(this.vm, data); - } else if (data[this.key] === undefined) { + } else if (data[this.key] === undefined && !this.options.manual) { console.error('Missing ' + this.key + ' attribute on result', data); } else if (!this.options.manual) { this.vm[this.key] = data[this.key]; @@ -2932,15 +2855,15 @@ var SmartQuery = function (_SmartApollo) { }, { key: 'watchLoading', value: function watchLoading() { - var _options$watchLoading, _vm$$apollo$watchLoad, _vm$$apollo$provider$2; + var _options$watchLoading, _vm$$apollo$watchLoad, _vm$$apollo$provider$; - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } this.options.watchLoading && (_options$watchLoading = this.options.watchLoading).call.apply(_options$watchLoading, [this.vm].concat(args)); this.vm.$apollo.watchLoading && (_vm$$apollo$watchLoad = this.vm.$apollo.watchLoading).call.apply(_vm$$apollo$watchLoad, [this.vm].concat(args)); - this.vm.$apollo.provider.watchLoading && (_vm$$apollo$provider$2 = this.vm.$apollo.provider.watchLoading).call.apply(_vm$$apollo$provider$2, [this.vm].concat(args)); + this.vm.$apollo.provider.watchLoading && (_vm$$apollo$provider$ = this.vm.$apollo.provider.watchLoading).call.apply(_vm$$apollo$provider$, [this.vm].concat(args)); } }, { key: 'applyLoadingModifier', @@ -2963,7 +2886,7 @@ var SmartQuery = function (_SmartApollo) { }, { key: 'fetchMore', value: function fetchMore() { - var _this4 = this; + var _this2 = this; if (this.observer) { var _observer; @@ -2971,7 +2894,7 @@ var SmartQuery = function (_SmartApollo) { this.maySetLoading(true); return (_observer = this.observer).fetchMore.apply(_observer, arguments).then(function (result) { if (!result.loading) { - _this4.loadingDone(); + _this2.loadingDone(); } return result; }); @@ -2991,13 +2914,13 @@ var SmartQuery = function (_SmartApollo) { }, { key: 'refetch', value: function refetch(variables) { - var _this5 = this; + var _this3 = this; variables && (this.options.variables = variables); if (this.observer) { var result = this.observer.refetch(variables).then(function (result) { if (!result.loading) { - _this5.loadingDone(); + _this3.loadingDone(); } return result; }); @@ -3043,6 +2966,25 @@ var SmartQuery = function (_SmartApollo) { return (_observer4 = this.observer).stopPolling.apply(_observer4, arguments); } } + }, { + key: 'client', + get: function get$$1() { + return this.vm.$apollo.getClient(this.options); + } + }, { + key: 'loading', + get: function get$$1() { + return this.vm.$data.$apolloData ? this.vm.$data.$apolloData.queries[this.key].loading : this._loading; + }, + set: function set$$1(value) { + if (this._loading !== value) { + this._loading = value; + if (this.vm.$data.$apolloData) { + this.vm.$data.$apolloData.queries[this.key].loading = value; + this.vm.$data.$apolloData.loading += value ? 1 : -1; + } + } + } }, { key: 'loadingKey', get: function get$$1() { @@ -3052,21 +2994,21 @@ var SmartQuery = function (_SmartApollo) { return SmartQuery; }(SmartApollo); -var SmartSubscription = function (_SmartApollo2) { - inherits(SmartSubscription, _SmartApollo2); +var SmartSubscription = function (_SmartApollo) { + inherits(SmartSubscription, _SmartApollo); function SmartSubscription() { var _ref; - var _temp, _this6, _ret; + var _temp, _this, _ret; classCallCheck(this, SmartSubscription); - for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - return _ret = (_temp = (_this6 = possibleConstructorReturn(this, (_ref = SmartSubscription.__proto__ || Object.getPrototypeOf(SmartSubscription)).call.apply(_ref, [this].concat(args))), _this6), _this6.type = 'subscription', _this6.vueApolloSpecialKeys = ['variables', 'result', 'error', 'throttle', 'debounce', 'linkedQuery'], _temp), possibleConstructorReturn(_this6, _ret); + return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = SmartSubscription.__proto__ || Object.getPrototypeOf(SmartSubscription)).call.apply(_ref, [this].concat(args))), _this), _this.type = 'subscription', _this.vueApolloSpecialKeys = ['variables', 'result', 'error', 'throttle', 'debounce', 'linkedQuery'], _temp), possibleConstructorReturn(_this, _ret); } createClass(SmartSubscription, [{ @@ -3132,7 +3074,9 @@ var DollarApollo = function () { } }, { key: 'getClient', - value: function getClient(options) { + value: function getClient() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + if (!options || !options.client) { if (_typeof(this.client) === 'object') { return this.client; @@ -3286,7 +3230,12 @@ var DollarApollo = function () { }, { key: 'provider', get: function get$$1() { - return this._apolloProvider || this.vm.$root._apolloProvider; + return this.vm.$apolloProvider; + } + }, { + key: 'loading', + get: function get$$1() { + return this.vm.$data.$apolloData && this.vm.$data.$apolloData.loading !== 0; } }, { key: 'skipAllQueries', @@ -3312,7 +3261,7 @@ var DollarApollo = function () { return DollarApollo; }(); -var ApolloProvider$1 = function () { +var ApolloProvider = function () { function ApolloProvider(options) { classCallCheck(this, ApolloProvider); @@ -3329,16 +3278,23 @@ var ApolloProvider$1 = function () { } createClass(ApolloProvider, [{ - key: 'willPrefetchQuery', - value: function willPrefetchQuery(queryOptions, client) { + key: 'provide', + value: function provide() { + var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '$apolloProvider'; + + return defineProperty({}, key, this); + } + }, { + key: 'addQueryToPrefetch', + value: function addQueryToPrefetch(queryOptions, client) { this.prefetchQueries.push({ queryOptions: queryOptions, client: client }); } }, { - key: 'willPrefetch', - value: function willPrefetch(component) { + key: 'prefetchComponent', + value: function prefetchComponent(component, context) { component = getMergedDefinition(component); var apolloOptions = component.apollo; @@ -3350,13 +3306,13 @@ var ApolloProvider$1 = function () { for (var key in apolloOptions) { var options = apolloOptions[key]; if (key.charAt(0) !== '$' && (!options.query || (typeof options.ssr === 'undefined' || options.ssr) && typeof options.prefetch !== 'undefined' && options.prefetch)) { - this.willPrefetchQuery(options, options.client || componentClient); + this.addQueryToPrefetch(options, options.client || componentClient); } } } }, { - key: 'willPrefetchComponents', - value: function willPrefetchComponents(definitions) { + key: 'prefetchComponents', + value: function prefetchComponents(definitions) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; @@ -3365,7 +3321,7 @@ var ApolloProvider$1 = function () { for (var _iterator = definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var def = _step.value; - this.willPrefetch(def); + this.prefetchComponent(def); } } catch (err) { _didIteratorError = true; @@ -3398,11 +3354,23 @@ var ApolloProvider$1 = function () { }, options); if (components) { - this.willPrefetchComponents(components); + this.prefetchComponents(components); } if (finalOptions.includeGlobal) { - this.willPrefetchComponents(globalPrefetchs); + this.prefetchComponents(globalPrefetchs.filter(function (_ref2) { + var component = _ref2.component, + contextCallback = _ref2.contextCallback; + + var result = true; + if (typeof contextCallback === 'function') { + result = !!contextCallback(context); + } + return result; + }).map(function (_ref3) { + var component = _ref3.component; + return component; + }), context); } return Promise.all(this.prefetchQueries.map(function (o) { @@ -3502,30 +3470,277 @@ var ApolloProvider$1 = function () { var globalPrefetchs = []; function willPrefetch(component) { - globalPrefetchs.push(component); + var contextCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + globalPrefetchs.push({ component: component, contextCallback: contextCallback }); return component; } +// Global access for libraries +if (typeof window !== 'undefined') { + window.vueApolloWillPrefetch = willPrefetch; +} else if (typeof global !== 'undefined') { + global.vueApolloWillPrefetch = willPrefetch; +} + +function isDataFilled(data) { + return Object.keys(data).length > 0; +} + +var CApolloQuery = { + name: 'ApolloQuery', + + provide: function provide() { + return { + getDollarApollo: this.getDollarApollo, + getApolloQuery: this.getApolloQuery + }; + }, + + + props: { + query: { + type: Object, + required: true + }, + + variables: { + type: Object, + default: null + }, + + fetchPolicy: { + type: String, + default: 'cache-first' + }, + + pollInterval: { + type: Number, + default: 0 + }, + + notifyOnNetworkStatusChange: { + type: Boolean, + default: false + }, + + context: { + type: Object, + default: null + }, + + skip: { + type: Boolean, + default: false + }, + + clientId: { + type: String, + default: undefined + }, + + tag: { + type: String, + default: 'div' + } + }, + + data: function data() { + return { + result: { + data: null, + loading: false, + networkStatus: 7, + error: null + } + }; + }, + + + watch: { + fetchPolicy: function fetchPolicy(value) { + this.$apollo.queries.query.setOptions({ + fetchPolicy: value + }); + }, + pollInterval: function pollInterval(value) { + this.$apollo.queries.query.setOptions({ + pollInterval: value + }); + }, + notifyOnNetworkStatusChange: function notifyOnNetworkStatusChange(value) { + this.$apollo.queries.query.setOptions({ + notifyOnNetworkStatusChange: value + }); + } + }, + + apollo: { + $client: function $client() { + return this.clientId; + }, + query: function query() { + return { + query: function query() { + return this.query; + }, + variables: function variables() { + return this.variables; + }, + + fetchPolicy: this.fetchPolicy, + pollInterval: this.pollInterval, + notifyOnNetworkStatusChange: this.notifyOnNetworkStatusChange, + context: function context() { + return this.context; + }, + skip: function skip() { + return this.skip; + }, + + manual: true, + result: function result(_result) { + var _result2 = _result, + errors = _result2.errors, + loading = _result2.loading, + networkStatus = _result2.networkStatus; + var _result3 = _result, + error = _result3.error; + + _result = Object.assign({}, _result); + + if (errors && errors.length) { + error = new Error('Apollo errors occured (' + errors.length + ')'); + error.graphQLErrors = errors; + } + + var data = {}; + + if (loading) { + Object.assign(data, this.$_previousData, _result.data); + } else if (error) { + Object.assign(data, this.$apollo.queries.query.observer.getLastResult() || {}, _result.data); + } else { + data = _result.data; + this.$_previousData = _result.data; + } + + this.result = { + data: isDataFilled(data) ? data : undefined, + loading: loading, + error: error, + networkStatus: networkStatus + }; + }, + error: function error(_error) { + this.result.loading = false; + this.result.error = _error; + console.log(this.$apollo.queries.query.observer.currentResult()); + } + }; + } + }, + + methods: { + getDollarApollo: function getDollarApollo() { + return this.$apollo; + }, + getApolloQuery: function getApolloQuery() { + return this.$apollo.queries.query; + } + }, + + render: function render(h) { + var result = this.$scopedSlots.default({ + result: this.result, + query: this.$apollo.queries.query + }); + if (Array.isArray(result)) { + result.concat(this.$slots.default); + } else { + result = [result].concat(this.$slots.default); + } + return h(this.tag, result); + } +}; + +var uid = 0; + +var CApolloSubscribeToMore = { + name: 'ApolloSubscribeToMore', + + inject: ['getDollarApollo', 'getApolloQuery'], + + props: { + document: { + type: Object, + required: true + }, + + variables: { + type: Object, + default: null + }, + + updateQuery: { + type: Function, + default: null + } + }, + + watch: { + document: 'refresh', + variables: 'refresh' + }, + + created: function created() { + this.$_key = 'sub_component_' + uid++; + }, + mounted: function mounted() { + this.refresh(); + }, + beforeDestroy: function beforeDestroy() { + this.destroy(); + }, + + + methods: { + destroy: function destroy() { + if (this.$_sub) { + this.$_sub.destroy(); + } + }, + refresh: function refresh() { + this.destroy(); + + this.$_sub = this.getDollarApollo().addSmartSubscription(this.$_key, { + document: this.document, + variables: this.variables, + updateQuery: this.updateQuery, + linkedQuery: this.getApolloQuery() + }); + + console.log(this.$_key, this.$_sub); + } + }, + + render: function render(h) { + return null; + } +}; + var keywords = ['$subscribe']; -var prepare = function prepare() { - var apolloProvider = void 0; - if (this.$options.apolloProvider) { - apolloProvider = this._apolloProvider = this.$options.apolloProvider; - } else { - apolloProvider = this.$root._apolloProvider; - } +var launch = function launch() { + var apolloProvider = this.$apolloProvider; - if (this._apolloPrepared) return; - this._apolloPrepared = true; + if (this._apolloLaunched || !apolloProvider) return; + this._apolloLaunched = true; // Prepare properties var apollo = this.$options.apollo; if (apollo) { - this._apolloQueries = {}; - this._apolloInitData = {}; - if (!apollo.$init) { apollo.$init = true; @@ -3535,22 +3750,6 @@ var prepare = function prepare() { } } - // watchQuery - for (var key in apollo) { - if (key.charAt(0) !== '$') { - this._apolloInitData[key] = null; - this._apolloQueries[key] = apollo[key]; - } - } - } -}; - -var launch = function launch() { - if (this._apolloLaunched) return; - this._apolloLaunched = true; - - var apollo = this.$options.apollo; - if (apollo) { defineReactiveSetter(this.$apollo, 'skipAll', apollo.$skipAll); defineReactiveSetter(this.$apollo, 'skipAllQueries', apollo.$skipAllQueries); defineReactiveSetter(this.$apollo, 'skipAllSubscriptions', apollo.$skipAllSubscriptions); @@ -3558,16 +3757,14 @@ var launch = function launch() { defineReactiveSetter(this.$apollo, 'loadingKey', apollo.$loadingKey); defineReactiveSetter(this.$apollo, 'error', apollo.$error); defineReactiveSetter(this.$apollo, 'watchLoading', apollo.$watchLoading); - } - if (this._apolloQueries) { // watchQuery - for (var key in this._apolloQueries) { - this.$apollo.addSmartQuery(key, this._apolloQueries[key]); + for (var key in apollo) { + if (key.charAt(0) !== '$') { + this.$apollo.addSmartQuery(key, apollo[key]); + } } - } - if (apollo) { if (apollo.subscribe) { Globals.Vue.util.warn('vue-apollo -> `subscribe` option is deprecated. Use the `$subscribe` option instead.'); } @@ -3616,7 +3813,7 @@ function install(Vue, options) { // Lazy creation Object.defineProperty(Vue.prototype, '$apollo', { - get: function get() { + get: function get$$1() { if (!this._apollo) { this._apollo = new DollarApollo(this); } @@ -3624,18 +3821,32 @@ function install(Vue, options) { } }); - Vue.mixin({ + var vueVersion = Vue.version.substr(0, Vue.version.indexOf('.')); - // Vue 1.x - init: prepare, - // Vue 2.x - beforeCreate: prepare, - - // Better devtools support - data: function data() { - return this._apolloInitData || {}; + Vue.mixin(_extends({}, vueVersion === '1' ? { + init: function init() { + var apolloProvider = void 0; + if (this.$options.apolloProvider) { + apolloProvider = this._apolloProvider = this.$options.apolloProvider; + } else { + apolloProvider = this.$root._apolloProvider; + } + this.$apolloProvider = apolloProvider; + } + } : {}, vueVersion === '2' ? { + inject: { + $apolloProvider: { default: null } }, + data: function data() { + return this.$options.apollo ? { + '$apolloData': { + queries: {}, + loading: 0 + } + } : {}; + } + } : {}, { created: launch, @@ -3646,15 +3857,26 @@ function install(Vue, options) { } } - }); + })); + + if (vueVersion === '2') { + Vue.component('apollo-query', CApolloQuery); + Vue.component('ApolloQuery', CApolloQuery); + Vue.component('apollo-subscribe-to-more', CApolloSubscribeToMore); + Vue.component('ApolloSubscribeToMore', CApolloSubscribeToMore); + } } -ApolloProvider$1.install = install; +ApolloProvider.install = install; // eslint-disable-next-line no-undef -ApolloProvider$1.version = "3.0.0-alpha.3"; +ApolloProvider.version = "3.0.0-beta.1"; -var ApolloProvider$$1 = ApolloProvider$1; +// Apollo provider +var ApolloProvider$1 = ApolloProvider; +// Components +var ApolloQuery = CApolloQuery; +var ApolloSubscribeToMore = CApolloSubscribeToMore; // Auto-install var GlobalVue = null; @@ -3664,8 +3886,8 @@ if (typeof window !== 'undefined') { GlobalVue = global.Vue; } if (GlobalVue) { - GlobalVue.use(ApolloProvider$1); + GlobalVue.use(ApolloProvider); } -export { install, ApolloProvider$$1 as ApolloProvider, willPrefetch }; -export default ApolloProvider$1; +export default ApolloProvider; +export { install, ApolloProvider$1 as ApolloProvider, ApolloQuery, ApolloSubscribeToMore, willPrefetch }; diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js index 0b9d2f2..94db382 100644 --- a/dist/vue-apollo.min.js +++ b/dist/vue-apollo.min.js @@ -1 +1 @@ -var VueApollo=function(t){"use strict";function e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function r(t,e){return!!(t?t.length:0)&&a(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i=ht&&(u=h,l=!1,e=new g(e));t:for(;++a0&&r(u)?e>1?k(u,e-1,r,i,n):o(n,u):i||(n[n.length]=u)}return n}function O(t,e,r){var i=e(t);return Ht(t)?i:o(i,r(t))}function j(t){return!(!W(t)||q(t))&&(F(t)||p(t)?Qt:mt).test(K(t))}function S(t){if(!W(t))return C(t);var e=M(t),r=[];for(var i in t)("constructor"!=i||!e&&Et.call(t,i))&&r.push(i);return r}function $(t,e){return t=Object(t),A(t,e,function(e,r){return r in t})}function A(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=vt}function W(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function G(t){return!!t&&"object"==typeof t}function J(t){return"symbol"==typeof t||G(t)&&Lt.call(t)==gt}function U(t){return N(t)?m(t,!0):S(t)}function z(){return[]}function B(t,e,r){function i(e){var r=c,i=h;return c=h=void 0,d=e,p=t.apply(i,r)}function n(t){return d=t,v=setTimeout(a,e),b?i(t):p}function o(t){var r=e-(t-y);return g?oe(r,f-(t-d)):r}function s(t){var r=t-y;return void 0===y||r>=e||r<0||g&&t-d>=f}function a(){var t=se();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=se(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(Gt);return e=tt(e)||0,X(r)&&(b=!!r.leading,f=(g="maxWait"in r)?ne(tt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(se())},l}function X(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Y(t){return!!t&&"object"==typeof t}function Z(t){return"symbol"==typeof t||Y(t)&&ie.call(t)==Ut}function tt(t){if("number"==typeof t)return t;if(Z(t))return Jt;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(zt,"");var r=Xt.test(t);return r||Yt.test(t)?Zt(t.slice(2),r?2:8):Bt.test(t)?Jt:+t}function et(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function rt(t){return!!t&&"object"==typeof t}function it(t){return"symbol"==typeof t||rt(t)&&ge.call(t)==le}function nt(t){if("number"==typeof t)return t;if(it(t))return ue;if(et(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=et(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(ce,"");var r=fe.test(t);return r||pe.test(t)?ve(t.slice(2),r?2:8):he.test(t)?ue:+t}function ot(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function st(t){return ke.Vue.util.mergeOptions({},t)}function at(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function ut(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function lt(t,e){if(!lt.installed){lt.installed=!0,ke.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,i){if(!t)return e;if(!e)return t;for(var n=Object.assign({},Wt(t,De),t.data),o=Object.assign({},Wt(e,De),e.data),s={},a=0;a-1},d.prototype.set=function(t,e){var r=this.__data__,i=_(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},b.prototype.clear=function(){this.__data__={hash:new y,map:new(Dt||d),string:new y}},b.prototype.delete=function(t){return x(this,t).delete(t)},b.prototype.get=function(t){return x(this,t).get(t)},b.prototype.has=function(t){return x(this,t).has(t)},b.prototype.set=function(t,e){return x(this,t).set(t,e),this},g.prototype.add=g.prototype.push=function(t){return this.__data__.set(t,ft),this},g.prototype.has=function(t){return this.__data__.has(t)};var It=Kt?v(Kt,Object):z,Ft=Kt?function(t){for(var e=[];t;)o(e,It(t)),t=qt(t);return e}:z,Ht=Array.isArray,Wt=function(t,r){return r=Rt(void 0===r?t.length-1:r,0),function(){for(var i=arguments,n=-1,o=Rt(i.length-r,0),s=Array(o);++n=e||r<0||g&&t-d>=f}function a(){var t=we();if(s(t))return u(t);v=setTimeout(a,o(t))}function u(t){return v=void 0,m&&c?i(t):(c=h=void 0,p)}function l(){var t=we(),r=s(t);if(c=arguments,h=this,y=t,r){if(void 0===v)return n(y);if(g)return v=setTimeout(a,e),i(y)}return void 0===v&&(v=setTimeout(a,e)),p}var c,h,f,p,v,y,d=0,b=!1,g=!1,m=!0;if("function"!=typeof t)throw new TypeError(ae);return e=nt(e)||0,et(r)&&(b=!!r.leading,f=(g="maxWait"in r)?me(nt(r.maxWait)||0,e):f,m="trailing"in r?!!r.trailing:m),l.cancel=function(){void 0!==v&&clearTimeout(v),d=0,c=y=h=v=void 0},l.flush=function(){return void 0===v?p:u(we())},l}),Se=["variables","watch","update","result","error","loadingKey","watchLoading","skip","throttle","debounce","subscribeToMore","prefetch","manual"],$e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ae=(function(){function t(t){this.value=t}function e(e){function r(n,o){try{var s=e[n](o),a=s.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(s.done?"return":"normal",s.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}(n=n.next)?r(n.key,n.arg):o=null}var n,o;this._invoke=function(t,e){return new Promise(function(i,s){var a={key:t,arg:e,resolve:i,reject:s,next:null};o?o=o.next=a:(n=o=a,r(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),Pe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(Ae(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},i),this._skip=!1,this._watchers=[],"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){n.options.query=t,n.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){n.options.document=t,n.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),o&&this.autostart()}return Pe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Oe(e,this.options.throttle):e,e=this.options.debounce?je(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=Wt(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o3&&void 0!==arguments[3])||arguments[3];Ae(this,e),i.query||(i={query:i});var o=Qe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,i,n));return o.type="query",o.vueApolloSpecialKeys=Se,o.loading=!1,o}return Le(e,qe),Pe(e,[{key:"stop",value:function(){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)}));var r=this.maySetLoading();r.loading||this.nextResult(r),Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();return(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0),e}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0===e[this.key]?console.error("Missing "+this.key+" attribute on result",e):this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){Ee(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,i=arguments.length,n=Array(i),o=0;o `subscribe` option is deprecated. Use the `$subscribe` option instead."),t.$subscribe))for(var r in t.$subscribe)this.$apollo.addSmartSubscription(r,t.$subscribe[r])}};Ke.install=lt,Ke.version="3.0.0-alpha.3";var Fe=Ke,He=null;return"undefined"!=typeof window?He=window.Vue:"undefined"!=typeof global&&(He=global.Vue),He&&He.use(Ke),t.install=lt,t.ApolloProvider=Fe,t.default=Ke,t.willPrefetch=function(t){return Re.push(t),t},t}({}); +var VueApollo=function(t){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=200,o="__lodash_hash_undefined__",i=1/0,n=9007199254740991,s="[object Arguments]",a="[object Function]",l="[object GeneratorFunction]",u="[object Symbol]",c=/^\[object .+?Constructor\]$/,h=/^(?:0|[1-9]\d*)$/,f="object"==typeof e&&e&&e.Object===Object&&e,p="object"==typeof self&&self&&self.Object===Object&&self,v=f||p||Function("return this")();function y(t,e){return!!(t?t.length:0)&&function(t,e,r){if(e!=e)return function(t,e,r,o){var i=t.length,n=r+(o?1:-1);for(;o?n--:++n-1}function d(t,e,r){for(var o=-1,i=t?t.length:0;++o-1},K.prototype.set=function(t,e){var r=this.__data__,o=H(r,t);return o<0?r.push([t,e]):r[o][1]=e,this},I.prototype.clear=function(){this.__data__={hash:new V,map:new(N||K),string:new V}},I.prototype.delete=function(t){return U(this,t).delete(t)},I.prototype.get=function(t){return U(this,t).get(t)},I.prototype.has=function(t){return U(this,t).has(t)},I.prototype.set=function(t,e){return U(this,t).set(t,e),this},F.prototype.add=F.prototype.push=function(t){return this.__data__.set(t,o),this},F.prototype.has=function(t){return this.__data__.has(t)};var X=D?k(D,Object):ht,Y=D?function(t){for(var e=[];t;)g(e,X(t)),t=E(t);return e}:ht;function Z(t){return nt(t)||rt(t)||!!(C&&t&&t[C])}function tt(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||h.test(t))&&t>-1&&t%1==0&&t-1&&t%1==0&&t<=n}(t.length)&&!at(t)}function at(t){var e=lt(t)?q.call(t):"";return e==a||e==l}function lt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ut(t){return!!t&&"object"==typeof t}function ct(t){return st(t)?W(t,!0):J(t)}function ht(){return[]}var ft=(ot=function(t,e){return null==t?{}:(e=b(function t(e,r,o,i,n){var s=-1,a=e.length;for(o||(o=Z),n||(n=[]);++s0&&o(l)?r>1?t(l,r-1,o,i,n):g(n,l):i||(n[n.length]=l)}return n}(e,1),et),function(t,e){return function(t,e,r){for(var o=-1,i=e.length,n={};++o=r&&(a=_,l=!1,e=new F(e));t:for(;++s=e||r<0||h&&t-u>=n}function y(){var t=At();if(v(t))return d(t);a=setTimeout(y,function(t){var r=e-(t-l);return h?jt(r,n-(t-u)):r}(t))}function d(t){return a=void 0,f&&o?p(t):(o=i=void 0,s)}function b(){var t=At(),r=v(t);if(o=arguments,i=this,l=t,r){if(void 0===a)return function(t){return u=t,a=setTimeout(y,e),c?p(t):s}(l);if(h)return a=setTimeout(y,e),p(l)}return void 0===a&&(a=setTimeout(y,e)),s}return e=xt(e)||0,qt(r)&&(c=!!r.leading,n=(h="maxWait"in r)?St(xt(r.maxWait)||0,e):n,f="trailing"in r?!!r.trailing:f),b.cancel=function(){void 0!==a&&clearTimeout(a),u=0,o=l=i=a=void 0},b.flush=function(){return void 0===a?s:d(At())},b}function qt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function xt(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&Ot.call(t)==yt}(t))return vt;if(qt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=qt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(dt,"");var r=gt.test(t);return r||mt.test(t)?_t(t.slice(2),r?2:8):bt.test(t)?vt:+t}var Qt=function(t,e,r){var o=!0,i=!0;if("function"!=typeof t)throw new TypeError(pt);return qt(r)&&(o="leading"in r?!!r.leading:o,i="trailing"in r?!!r.trailing:i),Pt(t,e,{leading:o,maxWait:e,trailing:i})},Et="Expected a function",Lt=NaN,Tt="[object Symbol]",Ct=/^\s+|\s+$/g,Dt=/^[-+]0x[0-9a-f]+$/i,Mt=/^0b[01]+$/i,Nt=/^0o[0-7]+$/i,Rt=parseInt,Vt="object"==typeof e&&e&&e.Object===Object&&e,Kt="object"==typeof self&&self&&self.Object===Object&&self,It=Vt||Kt||Function("return this")(),Ft=Object.prototype.toString,Wt=Math.max,Ht=Math.min,Gt=function(){return It.Date.now()};function Jt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Bt(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&Ft.call(t)==Tt}(t))return Lt;if(Jt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Jt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Ct,"");var r=Mt.test(t);return r||Nt.test(t)?Rt(t.slice(2),r?2:8):Dt.test(t)?Lt:+t}var Ut=function(t,e,r){var o,i,n,s,a,l,u=0,c=!1,h=!1,f=!0;if("function"!=typeof t)throw new TypeError(Et);function p(e){var r=o,n=i;return o=i=void 0,u=e,s=t.apply(n,r)}function v(t){var r=t-l;return void 0===l||r>=e||r<0||h&&t-u>=n}function y(){var t=Gt();if(v(t))return d(t);a=setTimeout(y,function(t){var r=e-(t-l);return h?Ht(r,n-(t-u)):r}(t))}function d(t){return a=void 0,f&&o?p(t):(o=i=void 0,s)}function b(){var t=Gt(),r=v(t);if(o=arguments,i=this,l=t,r){if(void 0===a)return function(t){return u=t,a=setTimeout(y,e),c?p(t):s}(l);if(h)return a=setTimeout(y,e),p(l)}return void 0===a&&(a=setTimeout(y,e)),s}return e=Bt(e)||0,Jt(r)&&(c=!!r.leading,n=(h="maxWait"in r)?Wt(Bt(r.maxWait)||0,e):n,f="trailing"in r?!!r.trailing:f),b.cancel=function(){void 0!==a&&clearTimeout(a),u=0,o=l=i=a=void 0},b.flush=function(){return void 0===a?s:d(Gt())},b},zt={};function Xt(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}var Yt=Xt(Qt),Zt=Xt(Ut);function te(t,e){for(;"function"==typeof t;)t=t.call(e);return t}var ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},re=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},oe=function(){function t(t,e){for(var r=0;r3&&void 0!==arguments[3])||arguments[3];if(re(this,t),this.type=null,this.vueApolloSpecialKeys=[],this.vm=e,this.key=r,this.options=Object.assign({},o),this._skip=!1,this._watchers=[],this._destroyed=!1,"function"==typeof this.options.query){var s=this.options.query.bind(this.vm);this.options.query=s(),this._watchers.push(this.vm.$watch(s,function(t){i.options.query=t,i.refresh()}))}if("function"==typeof this.options.document){var a=this.options.document.bind(this.vm);this.options.document=a(),this._watchers.push(this.vm.$watch(a,function(t){i.options.document=t,i.refresh()}))}if("function"==typeof this.options.context){var l=this.options.context.bind(this.vm);this.options.context=l(),this._watchers.push(this.vm.$watch(l,function(t){i.options.context=t,i.refresh()}))}this.vm.$isServer&&(this.options.fetchPolicy="cache-first"),n&&this.autostart()}return oe(t,[{key:"autostart",value:function(){"function"==typeof this.options.skip?this._watchers.push(this.vm.$watch(this.options.skip.bind(this.vm),this.skipChanged.bind(this),{immediate:!0})):this.options.skip?this._skip=!0:this.start()}},{key:"skipChanged",value:function(t,e){t!==e&&(this.skip=t)}},{key:"refresh",value:function(){this._skip||(this.stop(),this.start())}},{key:"start",value:function(){var t=this;if(this.starting=!0,"function"==typeof this.options.variables){var e=this.executeApollo.bind(this);e=this.options.throttle?Yt(e,this.options.throttle):e,e=this.options.debounce?Zt(e,this.options.debounce):e,this.unwatchVariables=this.vm.$watch(function(){return t.options.variables.call(t.vm)},e,{immediate:!0})}else this.executeApollo(this.options.variables)}},{key:"stop",value:function(){this.unwatchVariables&&(this.unwatchVariables(),this.unwatchVariables=null),this.sub&&(this.sub.unsubscribe(),this.sub=null)}},{key:"generateApolloOptions",value:function(t){var e=ft(this.options,this.vueApolloSpecialKeys);return e.variables=t,e}},{key:"executeApollo",value:function(t){this.starting=!1}},{key:"nextResult",value:function(){throw new Error("Not implemented")}},{key:"errorHandler",value:function(){for(var t,e,r,o=arguments.length,i=Array(o),n=0;n3&&void 0!==arguments[3])||arguments[3];(re(this,e),o.query)||(o={query:o});t.$data.$apolloData&&!t.$data.$apolloData.queries[r]&&t.$set(t.$data.$apolloData.queries,r,{loading:!1});var n=ae(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r,o,i));return n.type="query",n.vueApolloSpecialKeys=ce,n._loading=!1,n}return se(e,ue),oe(e,[{key:"stop",value:function(){ne(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this),this.observer&&(this.observer.stopPolling(),this.observer=null)}},{key:"executeApollo",value:function(t){this.observer?this.observer.setOptions(this.generateApolloOptions(t)):(this.sub&&this.sub.unsubscribe(),this.observer=this.vm.$apollo.watchQuery(this.generateApolloOptions(t)),this.sub=this.observer.subscribe({next:this.nextResult.bind(this),error:this.catchError.bind(this)}));var r=this.maySetLoading();r.loading||this.nextResult(r),ne(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"executeApollo",this).call(this,t)}},{key:"maySetLoading",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.observer.currentResult();return(t||e.loading)&&(this.loading||this.applyLoadingModifier(1),this.loading=!0),e}},{key:"nextResult",value:function(t){var e=t.data;t.loading||this.loadingDone();var r="function"==typeof this.options.result;void 0===e||("function"==typeof this.options.update?this.vm[this.key]=this.options.update.call(this.vm,e):void 0!==e[this.key]||this.options.manual?this.options.manual?r||console.error(this.key+" query must have a 'result' hook in manual mode"):this.vm[this.key]=e[this.key]:console.error("Missing "+this.key+" attribute on result",e)),r&&this.options.result.call(this.vm,t)}},{key:"catchError",value:function(t){ne(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"catchError",this).call(this,t),this.loadingDone()}},{key:"watchLoading",value:function(){for(var t,e,r,o=arguments.length,i=Array(o),n=0;n0&&void 0!==arguments[0]?arguments[0]:null;if(!t||!t.client){if("object"===ee(this.client))return this.client;if(this.client){if(this.provider.clients){var e=this.provider.clients[this.client];if(!e)throw new Error("[vue-apollo] Missing client '"+this.client+"' in 'apolloProvider'");return e}throw new Error("[vue-apollo] Missing 'clients' options in 'apolloProvider'")}return this.provider.defaultClient}var r=this.provider.clients[t.client];if(!r)throw new Error("[vue-apollo] Missing client '"+t.client+"' in 'apolloProvider'");return r}},{key:"watchQuery",value:function(t){var e=this,r=this.getClient(t).watchQuery(t),o=r.subscribe.bind(r);return r.subscribe=function(t){var r=o(t);return e._apolloSubscriptions.push(r),r},r}},{key:"mutate",value:function(t){return this.getClient(t).mutate(t)}},{key:"subscribe",value:function(t){var e=this;if(!this.vm.$isServer){var r=this.getClient(t).subscribe(t),o=r.subscribe.bind(r);return r.subscribe=function(t){var r=o(t);return e._apolloSubscriptions.push(r),r},r}}},{key:"addSmartQuery",value:function(t,e){var r=this;e=te(e,this.vm);var o=this.queries[t]=new he(this.vm,t,e,!1);if(o.autostart(),!this.vm.$isServer){var i=e.subscribeToMore;i&&(Array.isArray(i)?i.forEach(function(e,i){r.addSmartSubscription(""+t+i,ie({},e,{linkedQuery:o}))}):this.addSmartSubscription(t,ie({},i,{linkedQuery:o})))}return o}},{key:"addSmartSubscription",value:function(t,e){if(!this.vm.$isServer){e=te(e,this.vm);var r=this.subscriptions[t]=new fe(this.vm,t,e,!1);return r.autostart(),r}}},{key:"defineReactiveSetter",value:function(t,e){var r=this;this._watchers.push(this.vm.$watch(e,function(e){r[t]=e},{immediate:!0}))}},{key:"destroy",value:function(){var t=!0,e=!1,r=void 0;try{for(var o,i=this._watchers[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){(0,o.value)()}}catch(t){e=!0,r=t}finally{try{!t&&i.return&&i.return()}finally{if(e)throw r}}for(var n in this.queries)this.queries[n].destroy();for(var s in this.subscriptions)this.subscriptions[s].destroy();this._apolloSubscriptions.forEach(function(t){t.unsubscribe()}),this._apolloSubscriptions=null,this.vm=null}},{key:"provider",get:function(){return this.vm.$apolloProvider}},{key:"loading",get:function(){return this.vm.$data.$apolloData&&0!==this.vm.$data.$apolloData.loading}},{key:"skipAllQueries",set:function(t){for(var e in this.queries)this.queries[e].skip=t}},{key:"skipAllSubscriptions",set:function(t){for(var e in this.subscriptions)this.subscriptions[e].skip=t}},{key:"skipAll",set:function(t){this.skipAllQueries=t,this.skipAllSubscriptions=t}}]),t}(),ve=function(){function t(e){if(re(this,t),!e)throw new Error("Options argument required");this.clients=e.clients||{},this.clients.defaultClient=this.defaultClient=e.defaultClient,this.defaultOptions=e.defaultOptions,this.watchLoading=e.watchLoading,this.errorHandler=e.errorHandler,this.prefetchQueries=[]}return oe(t,[{key:"provide",value:function(){return function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:"$apolloProvider",this)}},{key:"addQueryToPrefetch",value:function(t,e){this.prefetchQueries.push({queryOptions:t,client:e})}},{key:"prefetchComponent",value:function(t,e){var r;r=t;var o=(t=zt.Vue.util.mergeOptions({},r)).apollo;if(o){var i=o.$client;for(var n in o){var s=o[n];"$"===n.charAt(0)||s.query&&(void 0!==s.ssr&&!s.ssr||void 0===s.prefetch||!s.prefetch)||this.addQueryToPrefetch(s,s.client||i)}}}},{key:"prefetchComponents",value:function(t){var e=!0,r=!1,o=void 0;try{for(var i,n=t[Symbol.iterator]();!(e=(i=n.next()).done);e=!0){var s=i.value;this.prefetchComponent(s)}}catch(t){r=!0,o=t}finally{try{!e&&n.return&&n.return()}finally{if(r)throw o}}}},{key:"prefetchAll",value:function(t,e,r){var o=this;r||!e||Array.isArray(e)||(r=e,e=void 0);var i=Object.assign({},{includeGlobal:!0},r);return e&&this.prefetchComponents(e),i.includeGlobal&&this.prefetchComponents(ye.filter(function(e){e.component;var r=e.contextCallback,o=!0;return"function"==typeof r&&(o=!!r(t)),o}).map(function(t){return t.component}),t),Promise.all(this.prefetchQueries.map(function(e){return o.prefetchQuery(e.queryOptions,t,e.client)}))}},{key:"prefetchQuery",value:function(t,e,r){var o=void 0;if(r){if("string"==typeof r&&!(r=this.clients[r]))throw new Error("[vue-apollo] Missing client '"+r+"' in 'apolloProvider'")}else r=this.defaultClient;if(t.query){var i=t.prefetch,n=void 0===i?"undefined":ee(i);if("undefined"!==n){var s=void 0;if(!(s="function"===n?i(e):i))return Promise.resolve();if("boolean"===n){var a=t.variables;o=void 0!==a?"function"==typeof a?a.call(e):a:void 0}else o=s}}else t={query:t};return new Promise(function(e,i){var n=ft(t,[].concat(le(ce),["fetchPolicy"]));n.variables=o,n.fetchPolicy="network-only",r.query(n).then(e,i)})}},{key:"getStates",value:function(t){var e=Object.assign({},{exportNamespace:""},t),r={};for(var o in this.clients){var i=this.clients[o].cache.extract();r[""+e.exportNamespace+o]=i}return r}},{key:"exportStates",value:function(t){var e=Object.assign({},{globalName:"__APOLLO_STATE__",attachTo:"window"},t),r=this.getStates(e);return e.attachTo+"."+e.globalName+" = "+JSON.stringify(r)+";"}}]),t}(),ye=[];function de(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return ye.push({component:t,contextCallback:e}),t}"undefined"!=typeof window?window.vueApolloWillPrefetch=de:"undefined"!=typeof global&&(global.vueApolloWillPrefetch=de);var be={name:"ApolloQuery",provide:function(){return{getDollarApollo:this.getDollarApollo,getApolloQuery:this.getApolloQuery}},props:{query:{type:Object,required:!0},variables:{type:Object,default:null},fetchPolicy:{type:String,default:"cache-first"},pollInterval:{type:Number,default:0},notifyOnNetworkStatusChange:{type:Boolean,default:!1},context:{type:Object,default:null},skip:{type:Boolean,default:!1},clientId:{type:String,default:void 0},tag:{type:String,default:"div"}},data:function(){return{result:{data:null,loading:!1,networkStatus:7,error:null}}},watch:{fetchPolicy:function(t){this.$apollo.queries.query.setOptions({fetchPolicy:t})},pollInterval:function(t){this.$apollo.queries.query.setOptions({pollInterval:t})},notifyOnNetworkStatusChange:function(t){this.$apollo.queries.query.setOptions({notifyOnNetworkStatusChange:t})}},apollo:{$client:function(){return this.clientId},query:function(){return{query:function(){return this.query},variables:function(){return this.variables},fetchPolicy:this.fetchPolicy,pollInterval:this.pollInterval,notifyOnNetworkStatusChange:this.notifyOnNetworkStatusChange,context:function(){return this.context},skip:function(){return this.skip},manual:!0,result:function(t){var e=t,r=e.errors,o=e.loading,i=e.networkStatus,n=t.error;t=Object.assign({},t),r&&r.length&&((n=new Error("Apollo errors occured ("+r.length+")")).graphQLErrors=r);var s={};o?Object.assign(s,this.$_previousData,t.data):n?Object.assign(s,this.$apollo.queries.query.observer.getLastResult()||{},t.data):(s=t.data,this.$_previousData=t.data),this.result={data:function(t){return Object.keys(t).length>0}(s)?s:void 0,loading:o,error:n,networkStatus:i}},error:function(t){this.result.loading=!1,this.result.error=t,console.log(this.$apollo.queries.query.observer.currentResult())}}}},methods:{getDollarApollo:function(){return this.$apollo},getApolloQuery:function(){return this.$apollo.queries.query}},render:function(t){var e=this.$scopedSlots.default({result:this.result,query:this.$apollo.queries.query});return Array.isArray(e)?e.concat(this.$slots.default):e=[e].concat(this.$slots.default),t(this.tag,e)}},ge=0,me={name:"ApolloSubscribeToMore",inject:["getDollarApollo","getApolloQuery"],props:{document:{type:Object,required:!0},variables:{type:Object,default:null},updateQuery:{type:Function,default:null}},watch:{document:"refresh",variables:"refresh"},created:function(){this.$_key="sub_component_"+ge++},mounted:function(){this.refresh()},beforeDestroy:function(){this.destroy()},methods:{destroy:function(){this.$_sub&&this.$_sub.destroy()},refresh:function(){this.destroy(),this.$_sub=this.getDollarApollo().addSmartSubscription(this.$_key,{document:this.document,variables:this.variables,updateQuery:this.updateQuery,linkedQuery:this.getApolloQuery()}),console.log(this.$_key,this.$_sub)}},render:function(t){return null}},_e=["$subscribe"],ke=function(){var t=this.$apolloProvider;if(!this._apolloLaunched&&t){this._apolloLaunched=!0;var e=this.$options.apollo;if(e){for(var r in e.$init||(e.$init=!0,t.defaultOptions&&(e=this.$options.apollo=Object.assign({},t.defaultOptions,e))),$e(this.$apollo,"skipAll",e.$skipAll),$e(this.$apollo,"skipAllQueries",e.$skipAllQueries),$e(this.$apollo,"skipAllSubscriptions",e.$skipAllSubscriptions),$e(this.$apollo,"client",e.$client),$e(this.$apollo,"loadingKey",e.$loadingKey),$e(this.$apollo,"error",e.$error),$e(this.$apollo,"watchLoading",e.$watchLoading),e)"$"!==r.charAt(0)&&this.$apollo.addSmartQuery(r,e[r]);if(e.subscribe&&zt.Vue.util.warn("vue-apollo -> `subscribe` option is deprecated. Use the `$subscribe` option instead."),e.$subscribe)for(var o in e.$subscribe)this.$apollo.addSmartSubscription(o,e.$subscribe[o])}}};function $e(t,e,r){void 0!==r&&("function"==typeof r?t.defineReactiveSetter(e,r):t[e]=r)}function we(t,e){if(!we.installed){we.installed=!0,zt.Vue=t;var r=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,o){if(!t)return e;if(!e)return t;for(var i=Object.assign({},ft(t,_e),t.data),n=Object.assign({},ft(e,_e),e.data),s={},a=0;a<_e.length;a++){var l=_e[a];s[l]=r(t[l],e[l])}return Object.assign(s,r(i,n))},Object.defineProperty(t.prototype,"$apollo",{get:function(){return this._apollo||(this._apollo=new pe(this)),this._apollo}});var o=t.version.substr(0,t.version.indexOf("."));t.mixin(ie({},"1"===o?{init:function(){var t=void 0;t=this.$options.apolloProvider?this._apolloProvider=this.$options.apolloProvider:this.$root._apolloProvider,this.$apolloProvider=t}}:{},"2"===o?{inject:{$apolloProvider:{default:null}},data:function(){return this.$options.apollo?{$apolloData:{queries:{},loading:0}}:{}}}:{},{created:ke,destroyed:function(){this._apollo&&(this._apollo.destroy(),this._apollo=null)}})),"2"===o&&(t.component("apollo-query",be),t.component("ApolloQuery",be),t.component("apollo-subscribe-to-more",me),t.component("ApolloSubscribeToMore",me))}}ve.install=we,ve.version="3.0.0-beta.1";var Oe=ve,Se=be,je=me,Ae=null;return"undefined"!=typeof window?Ae=window.Vue:"undefined"!=typeof global&&(Ae=global.Vue),Ae&&Ae.use(ve),t.install=we,t.ApolloProvider=Oe,t.ApolloQuery=Se,t.ApolloSubscribeToMore=je,t.default=ve,t.willPrefetch=de,t}({}); diff --git a/dist/vue-apollo.umd.js b/dist/vue-apollo.umd.js index 535089a..6955582 100644 --- a/dist/vue-apollo.umd.js +++ b/dist/vue-apollo.umd.js @@ -1625,7 +1625,7 @@ var now = function() { * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ -function debounce$1(func, wait, options) { +function debounce(func, wait, options) { var lastArgs, lastThis, maxWait, @@ -1791,7 +1791,7 @@ function debounce$1(func, wait, options) { * // Cancel the trailing throttled invocation. * jQuery(window).on('popstate', throttled.cancel); */ -function throttle$1(func, wait, options) { +function throttle(func, wait, options) { var leading = true, trailing = true; @@ -1802,7 +1802,7 @@ function throttle$1(func, wait, options) { leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } - return debounce$1(func, wait, { + return debounce(func, wait, { 'leading': leading, 'maxWait': wait, 'trailing': trailing @@ -1933,7 +1933,7 @@ function toNumber(value) { : (reIsBadHex.test(value) ? NAN : +value); } -var lodash_throttle = throttle$1; +var lodash_throttle = throttle; /** * lodash (Custom Build) @@ -2065,7 +2065,7 @@ var now$1 = function() { * // Cancel the trailing debounced invocation. * jQuery(window).on('popstate', debounced.cancel); */ -function debounce$2(func, wait, options) { +function debounce$1(func, wait, options) { var lastArgs, lastThis, maxWait, @@ -2311,7 +2311,7 @@ function toNumber$1(value) { : (reIsBadHex$1.test(value) ? NAN$1 : +value); } -var lodash_debounce = debounce$2; +var lodash_debounce = debounce$1; var Globals = {}; @@ -2325,9 +2325,9 @@ function factory(action) { }; } -var throttle = factory(lodash_throttle); +var throttle$1 = factory(lodash_throttle); -var debounce = factory(lodash_debounce); +var debounce$2 = factory(lodash_debounce); function getMergedDefinition(def) { return Globals.Vue.util.mergeOptions({}, def); @@ -2340,8 +2340,6 @@ function reapply(options, context) { return options; } -var VUE_APOLLO_QUERY_KEYWORDS = ['variables', 'watch', 'update', 'result', 'error', 'loadingKey', 'watchLoading', 'skip', 'throttle', 'debounce', 'subscribeToMore', 'prefetch', 'manual']; - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { @@ -2352,118 +2350,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol -var asyncGenerator = function () { - function AwaitValue(value) { - this.value = value; - } - function AsyncGenerator(gen) { - var front, back; - - function send(key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - - if (back) { - back = back.next = request; - } else { - front = back = request; - resume(key, arg); - } - }); - } - - function resume(key, arg) { - try { - var result = gen[key](arg); - var value = result.value; - - if (value instanceof AwaitValue) { - Promise.resolve(value.value).then(function (arg) { - resume("next", arg); - }, function (arg) { - resume("throw", arg); - }); - } else { - settle(result.done ? "return" : "normal", result.value); - } - } catch (err) { - settle("throw", err); - } - } - - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: true - }); - break; - - case "throw": - front.reject(value); - break; - - default: - front.resolve({ - value: value, - done: false - }); - break; - } - - front = front.next; - - if (front) { - resume(front.key, front.arg); - } else { - back = null; - } - } - - this._invoke = send; - - if (typeof gen.return !== "function") { - this.return = undefined; - } - } - - if (typeof Symbol === "function" && Symbol.asyncIterator) { - AsyncGenerator.prototype[Symbol.asyncIterator] = function () { - return this; - }; - } - - AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); - }; - - AsyncGenerator.prototype.throw = function (arg) { - return this._invoke("throw", arg); - }; - - AsyncGenerator.prototype.return = function (arg) { - return this._invoke("return", arg); - }; - - return { - wrap: function (fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; - }, - await: function (value) { - return new AwaitValue(value); - } - }; -}(); @@ -2497,7 +2384,20 @@ var createClass = function () { +var defineProperty = function (obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; +}; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { @@ -2614,6 +2514,7 @@ var SmartApollo = function () { this.options = Object.assign({}, options); this._skip = false; this._watchers = []; + this._destroyed = false; // Query callback if (typeof this.options.query === 'function') { @@ -2634,6 +2535,16 @@ var SmartApollo = function () { })); } + // Apollo context + if (typeof this.options.context === 'function') { + var cb = this.options.context.bind(this.vm); + this.options.context = cb(); + this._watchers.push(this.vm.$watch(cb, function (context) { + _this.options.context = context; + _this.refresh(); + })); + } + if (this.vm.$isServer) { this.options.fetchPolicy = 'cache-first'; } @@ -2679,8 +2590,8 @@ var SmartApollo = function () { this.starting = true; if (typeof this.options.variables === 'function') { var cb = this.executeApollo.bind(this); - cb = this.options.throttle ? throttle(cb, this.options.throttle) : cb; - cb = this.options.debounce ? debounce(cb, this.options.debounce) : cb; + cb = this.options.throttle ? throttle$1(cb, this.options.throttle) : cb; + cb = this.options.debounce ? debounce$2(cb, this.options.debounce) : cb; this.unwatchVariables = this.vm.$watch(function () { return _this2.options.variables.call(_this2.vm); }, cb, { @@ -2780,6 +2691,9 @@ var SmartApollo = function () { }, { key: 'destroy', value: function destroy() { + if (this._destroyed) return; + + this._destroyed = true; this.stop(); var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; @@ -2823,6 +2737,8 @@ var SmartApollo = function () { return SmartApollo; }(); +var VUE_APOLLO_QUERY_KEYWORDS = ['variables', 'watch', 'update', 'result', 'error', 'loadingKey', 'watchLoading', 'skip', 'throttle', 'debounce', 'subscribeToMore', 'prefetch', 'manual']; + var SmartQuery = function (_SmartApollo) { inherits(SmartQuery, _SmartApollo); @@ -2838,12 +2754,19 @@ var SmartQuery = function (_SmartApollo) { }; } - var _this3 = possibleConstructorReturn(this, (SmartQuery.__proto__ || Object.getPrototypeOf(SmartQuery)).call(this, vm, key, options, autostart)); + // Add reactive data related to the query + if (vm.$data.$apolloData && !vm.$data.$apolloData.queries[key]) { + vm.$set(vm.$data.$apolloData.queries, key, { + loading: false + }); + } - _this3.type = 'query'; - _this3.vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS; - _this3.loading = false; - return _this3; + var _this = possibleConstructorReturn(this, (SmartQuery.__proto__ || Object.getPrototypeOf(SmartQuery)).call(this, vm, key, options, autostart)); + + _this.type = 'query'; + _this.vueApolloSpecialKeys = VUE_APOLLO_QUERY_KEYWORDS; + _this._loading = false; + return _this; } createClass(SmartQuery, [{ @@ -2917,7 +2840,7 @@ var SmartQuery = function (_SmartApollo) { // No result } else if (typeof this.options.update === 'function') { this.vm[this.key] = this.options.update.call(this.vm, data); - } else if (data[this.key] === undefined) { + } else if (data[this.key] === undefined && !this.options.manual) { console.error('Missing ' + this.key + ' attribute on result', data); } else if (!this.options.manual) { this.vm[this.key] = data[this.key]; @@ -2938,15 +2861,15 @@ var SmartQuery = function (_SmartApollo) { }, { key: 'watchLoading', value: function watchLoading() { - var _options$watchLoading, _vm$$apollo$watchLoad, _vm$$apollo$provider$2; + var _options$watchLoading, _vm$$apollo$watchLoad, _vm$$apollo$provider$; - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } this.options.watchLoading && (_options$watchLoading = this.options.watchLoading).call.apply(_options$watchLoading, [this.vm].concat(args)); this.vm.$apollo.watchLoading && (_vm$$apollo$watchLoad = this.vm.$apollo.watchLoading).call.apply(_vm$$apollo$watchLoad, [this.vm].concat(args)); - this.vm.$apollo.provider.watchLoading && (_vm$$apollo$provider$2 = this.vm.$apollo.provider.watchLoading).call.apply(_vm$$apollo$provider$2, [this.vm].concat(args)); + this.vm.$apollo.provider.watchLoading && (_vm$$apollo$provider$ = this.vm.$apollo.provider.watchLoading).call.apply(_vm$$apollo$provider$, [this.vm].concat(args)); } }, { key: 'applyLoadingModifier', @@ -2969,7 +2892,7 @@ var SmartQuery = function (_SmartApollo) { }, { key: 'fetchMore', value: function fetchMore() { - var _this4 = this; + var _this2 = this; if (this.observer) { var _observer; @@ -2977,7 +2900,7 @@ var SmartQuery = function (_SmartApollo) { this.maySetLoading(true); return (_observer = this.observer).fetchMore.apply(_observer, arguments).then(function (result) { if (!result.loading) { - _this4.loadingDone(); + _this2.loadingDone(); } return result; }); @@ -2997,13 +2920,13 @@ var SmartQuery = function (_SmartApollo) { }, { key: 'refetch', value: function refetch(variables) { - var _this5 = this; + var _this3 = this; variables && (this.options.variables = variables); if (this.observer) { var result = this.observer.refetch(variables).then(function (result) { if (!result.loading) { - _this5.loadingDone(); + _this3.loadingDone(); } return result; }); @@ -3049,6 +2972,25 @@ var SmartQuery = function (_SmartApollo) { return (_observer4 = this.observer).stopPolling.apply(_observer4, arguments); } } + }, { + key: 'client', + get: function get$$1() { + return this.vm.$apollo.getClient(this.options); + } + }, { + key: 'loading', + get: function get$$1() { + return this.vm.$data.$apolloData ? this.vm.$data.$apolloData.queries[this.key].loading : this._loading; + }, + set: function set$$1(value) { + if (this._loading !== value) { + this._loading = value; + if (this.vm.$data.$apolloData) { + this.vm.$data.$apolloData.queries[this.key].loading = value; + this.vm.$data.$apolloData.loading += value ? 1 : -1; + } + } + } }, { key: 'loadingKey', get: function get$$1() { @@ -3058,21 +3000,21 @@ var SmartQuery = function (_SmartApollo) { return SmartQuery; }(SmartApollo); -var SmartSubscription = function (_SmartApollo2) { - inherits(SmartSubscription, _SmartApollo2); +var SmartSubscription = function (_SmartApollo) { + inherits(SmartSubscription, _SmartApollo); function SmartSubscription() { var _ref; - var _temp, _this6, _ret; + var _temp, _this, _ret; classCallCheck(this, SmartSubscription); - for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - return _ret = (_temp = (_this6 = possibleConstructorReturn(this, (_ref = SmartSubscription.__proto__ || Object.getPrototypeOf(SmartSubscription)).call.apply(_ref, [this].concat(args))), _this6), _this6.type = 'subscription', _this6.vueApolloSpecialKeys = ['variables', 'result', 'error', 'throttle', 'debounce', 'linkedQuery'], _temp), possibleConstructorReturn(_this6, _ret); + return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = SmartSubscription.__proto__ || Object.getPrototypeOf(SmartSubscription)).call.apply(_ref, [this].concat(args))), _this), _this.type = 'subscription', _this.vueApolloSpecialKeys = ['variables', 'result', 'error', 'throttle', 'debounce', 'linkedQuery'], _temp), possibleConstructorReturn(_this, _ret); } createClass(SmartSubscription, [{ @@ -3138,7 +3080,9 @@ var DollarApollo = function () { } }, { key: 'getClient', - value: function getClient(options) { + value: function getClient() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + if (!options || !options.client) { if (_typeof(this.client) === 'object') { return this.client; @@ -3292,7 +3236,12 @@ var DollarApollo = function () { }, { key: 'provider', get: function get$$1() { - return this._apolloProvider || this.vm.$root._apolloProvider; + return this.vm.$apolloProvider; + } + }, { + key: 'loading', + get: function get$$1() { + return this.vm.$data.$apolloData && this.vm.$data.$apolloData.loading !== 0; } }, { key: 'skipAllQueries', @@ -3318,7 +3267,7 @@ var DollarApollo = function () { return DollarApollo; }(); -var ApolloProvider$1 = function () { +var ApolloProvider = function () { function ApolloProvider(options) { classCallCheck(this, ApolloProvider); @@ -3335,16 +3284,23 @@ var ApolloProvider$1 = function () { } createClass(ApolloProvider, [{ - key: 'willPrefetchQuery', - value: function willPrefetchQuery(queryOptions, client) { + key: 'provide', + value: function provide() { + var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '$apolloProvider'; + + return defineProperty({}, key, this); + } + }, { + key: 'addQueryToPrefetch', + value: function addQueryToPrefetch(queryOptions, client) { this.prefetchQueries.push({ queryOptions: queryOptions, client: client }); } }, { - key: 'willPrefetch', - value: function willPrefetch(component) { + key: 'prefetchComponent', + value: function prefetchComponent(component, context) { component = getMergedDefinition(component); var apolloOptions = component.apollo; @@ -3356,13 +3312,13 @@ var ApolloProvider$1 = function () { for (var key in apolloOptions) { var options = apolloOptions[key]; if (key.charAt(0) !== '$' && (!options.query || (typeof options.ssr === 'undefined' || options.ssr) && typeof options.prefetch !== 'undefined' && options.prefetch)) { - this.willPrefetchQuery(options, options.client || componentClient); + this.addQueryToPrefetch(options, options.client || componentClient); } } } }, { - key: 'willPrefetchComponents', - value: function willPrefetchComponents(definitions) { + key: 'prefetchComponents', + value: function prefetchComponents(definitions) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; @@ -3371,7 +3327,7 @@ var ApolloProvider$1 = function () { for (var _iterator = definitions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var def = _step.value; - this.willPrefetch(def); + this.prefetchComponent(def); } } catch (err) { _didIteratorError = true; @@ -3404,11 +3360,23 @@ var ApolloProvider$1 = function () { }, options); if (components) { - this.willPrefetchComponents(components); + this.prefetchComponents(components); } if (finalOptions.includeGlobal) { - this.willPrefetchComponents(globalPrefetchs); + this.prefetchComponents(globalPrefetchs.filter(function (_ref2) { + var component = _ref2.component, + contextCallback = _ref2.contextCallback; + + var result = true; + if (typeof contextCallback === 'function') { + result = !!contextCallback(context); + } + return result; + }).map(function (_ref3) { + var component = _ref3.component; + return component; + }), context); } return Promise.all(this.prefetchQueries.map(function (o) { @@ -3508,30 +3476,277 @@ var ApolloProvider$1 = function () { var globalPrefetchs = []; function willPrefetch(component) { - globalPrefetchs.push(component); + var contextCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + globalPrefetchs.push({ component: component, contextCallback: contextCallback }); return component; } +// Global access for libraries +if (typeof window !== 'undefined') { + window.vueApolloWillPrefetch = willPrefetch; +} else if (typeof global !== 'undefined') { + global.vueApolloWillPrefetch = willPrefetch; +} + +function isDataFilled(data) { + return Object.keys(data).length > 0; +} + +var CApolloQuery = { + name: 'ApolloQuery', + + provide: function provide() { + return { + getDollarApollo: this.getDollarApollo, + getApolloQuery: this.getApolloQuery + }; + }, + + + props: { + query: { + type: Object, + required: true + }, + + variables: { + type: Object, + default: null + }, + + fetchPolicy: { + type: String, + default: 'cache-first' + }, + + pollInterval: { + type: Number, + default: 0 + }, + + notifyOnNetworkStatusChange: { + type: Boolean, + default: false + }, + + context: { + type: Object, + default: null + }, + + skip: { + type: Boolean, + default: false + }, + + clientId: { + type: String, + default: undefined + }, + + tag: { + type: String, + default: 'div' + } + }, + + data: function data() { + return { + result: { + data: null, + loading: false, + networkStatus: 7, + error: null + } + }; + }, + + + watch: { + fetchPolicy: function fetchPolicy(value) { + this.$apollo.queries.query.setOptions({ + fetchPolicy: value + }); + }, + pollInterval: function pollInterval(value) { + this.$apollo.queries.query.setOptions({ + pollInterval: value + }); + }, + notifyOnNetworkStatusChange: function notifyOnNetworkStatusChange(value) { + this.$apollo.queries.query.setOptions({ + notifyOnNetworkStatusChange: value + }); + } + }, + + apollo: { + $client: function $client() { + return this.clientId; + }, + query: function query() { + return { + query: function query() { + return this.query; + }, + variables: function variables() { + return this.variables; + }, + + fetchPolicy: this.fetchPolicy, + pollInterval: this.pollInterval, + notifyOnNetworkStatusChange: this.notifyOnNetworkStatusChange, + context: function context() { + return this.context; + }, + skip: function skip() { + return this.skip; + }, + + manual: true, + result: function result(_result) { + var _result2 = _result, + errors = _result2.errors, + loading = _result2.loading, + networkStatus = _result2.networkStatus; + var _result3 = _result, + error = _result3.error; + + _result = Object.assign({}, _result); + + if (errors && errors.length) { + error = new Error('Apollo errors occured (' + errors.length + ')'); + error.graphQLErrors = errors; + } + + var data = {}; + + if (loading) { + Object.assign(data, this.$_previousData, _result.data); + } else if (error) { + Object.assign(data, this.$apollo.queries.query.observer.getLastResult() || {}, _result.data); + } else { + data = _result.data; + this.$_previousData = _result.data; + } + + this.result = { + data: isDataFilled(data) ? data : undefined, + loading: loading, + error: error, + networkStatus: networkStatus + }; + }, + error: function error(_error) { + this.result.loading = false; + this.result.error = _error; + console.log(this.$apollo.queries.query.observer.currentResult()); + } + }; + } + }, + + methods: { + getDollarApollo: function getDollarApollo() { + return this.$apollo; + }, + getApolloQuery: function getApolloQuery() { + return this.$apollo.queries.query; + } + }, + + render: function render(h) { + var result = this.$scopedSlots.default({ + result: this.result, + query: this.$apollo.queries.query + }); + if (Array.isArray(result)) { + result.concat(this.$slots.default); + } else { + result = [result].concat(this.$slots.default); + } + return h(this.tag, result); + } +}; + +var uid = 0; + +var CApolloSubscribeToMore = { + name: 'ApolloSubscribeToMore', + + inject: ['getDollarApollo', 'getApolloQuery'], + + props: { + document: { + type: Object, + required: true + }, + + variables: { + type: Object, + default: null + }, + + updateQuery: { + type: Function, + default: null + } + }, + + watch: { + document: 'refresh', + variables: 'refresh' + }, + + created: function created() { + this.$_key = 'sub_component_' + uid++; + }, + mounted: function mounted() { + this.refresh(); + }, + beforeDestroy: function beforeDestroy() { + this.destroy(); + }, + + + methods: { + destroy: function destroy() { + if (this.$_sub) { + this.$_sub.destroy(); + } + }, + refresh: function refresh() { + this.destroy(); + + this.$_sub = this.getDollarApollo().addSmartSubscription(this.$_key, { + document: this.document, + variables: this.variables, + updateQuery: this.updateQuery, + linkedQuery: this.getApolloQuery() + }); + + console.log(this.$_key, this.$_sub); + } + }, + + render: function render(h) { + return null; + } +}; + var keywords = ['$subscribe']; -var prepare = function prepare() { - var apolloProvider = void 0; - if (this.$options.apolloProvider) { - apolloProvider = this._apolloProvider = this.$options.apolloProvider; - } else { - apolloProvider = this.$root._apolloProvider; - } +var launch = function launch() { + var apolloProvider = this.$apolloProvider; - if (this._apolloPrepared) return; - this._apolloPrepared = true; + if (this._apolloLaunched || !apolloProvider) return; + this._apolloLaunched = true; // Prepare properties var apollo = this.$options.apollo; if (apollo) { - this._apolloQueries = {}; - this._apolloInitData = {}; - if (!apollo.$init) { apollo.$init = true; @@ -3541,22 +3756,6 @@ var prepare = function prepare() { } } - // watchQuery - for (var key in apollo) { - if (key.charAt(0) !== '$') { - this._apolloInitData[key] = null; - this._apolloQueries[key] = apollo[key]; - } - } - } -}; - -var launch = function launch() { - if (this._apolloLaunched) return; - this._apolloLaunched = true; - - var apollo = this.$options.apollo; - if (apollo) { defineReactiveSetter(this.$apollo, 'skipAll', apollo.$skipAll); defineReactiveSetter(this.$apollo, 'skipAllQueries', apollo.$skipAllQueries); defineReactiveSetter(this.$apollo, 'skipAllSubscriptions', apollo.$skipAllSubscriptions); @@ -3564,16 +3763,14 @@ var launch = function launch() { defineReactiveSetter(this.$apollo, 'loadingKey', apollo.$loadingKey); defineReactiveSetter(this.$apollo, 'error', apollo.$error); defineReactiveSetter(this.$apollo, 'watchLoading', apollo.$watchLoading); - } - if (this._apolloQueries) { // watchQuery - for (var key in this._apolloQueries) { - this.$apollo.addSmartQuery(key, this._apolloQueries[key]); + for (var key in apollo) { + if (key.charAt(0) !== '$') { + this.$apollo.addSmartQuery(key, apollo[key]); + } } - } - if (apollo) { if (apollo.subscribe) { Globals.Vue.util.warn('vue-apollo -> `subscribe` option is deprecated. Use the `$subscribe` option instead.'); } @@ -3622,7 +3819,7 @@ function install(Vue, options) { // Lazy creation Object.defineProperty(Vue.prototype, '$apollo', { - get: function get() { + get: function get$$1() { if (!this._apollo) { this._apollo = new DollarApollo(this); } @@ -3630,18 +3827,32 @@ function install(Vue, options) { } }); - Vue.mixin({ + var vueVersion = Vue.version.substr(0, Vue.version.indexOf('.')); - // Vue 1.x - init: prepare, - // Vue 2.x - beforeCreate: prepare, - - // Better devtools support - data: function data() { - return this._apolloInitData || {}; + Vue.mixin(_extends({}, vueVersion === '1' ? { + init: function init() { + var apolloProvider = void 0; + if (this.$options.apolloProvider) { + apolloProvider = this._apolloProvider = this.$options.apolloProvider; + } else { + apolloProvider = this.$root._apolloProvider; + } + this.$apolloProvider = apolloProvider; + } + } : {}, vueVersion === '2' ? { + inject: { + $apolloProvider: { default: null } }, + data: function data() { + return this.$options.apollo ? { + '$apolloData': { + queries: {}, + loading: 0 + } + } : {}; + } + } : {}, { created: launch, @@ -3652,15 +3863,26 @@ function install(Vue, options) { } } - }); + })); + + if (vueVersion === '2') { + Vue.component('apollo-query', CApolloQuery); + Vue.component('ApolloQuery', CApolloQuery); + Vue.component('apollo-subscribe-to-more', CApolloSubscribeToMore); + Vue.component('ApolloSubscribeToMore', CApolloSubscribeToMore); + } } -ApolloProvider$1.install = install; +ApolloProvider.install = install; // eslint-disable-next-line no-undef -ApolloProvider$1.version = "3.0.0-alpha.3"; +ApolloProvider.version = "3.0.0-beta.1"; -var ApolloProvider$$1 = ApolloProvider$1; +// Apollo provider +var ApolloProvider$1 = ApolloProvider; +// Components +var ApolloQuery = CApolloQuery; +var ApolloSubscribeToMore = CApolloSubscribeToMore; // Auto-install var GlobalVue = null; @@ -3670,12 +3892,14 @@ if (typeof window !== 'undefined') { GlobalVue = global.Vue; } if (GlobalVue) { - GlobalVue.use(ApolloProvider$1); + GlobalVue.use(ApolloProvider); } exports.install = install; -exports.ApolloProvider = ApolloProvider$$1; -exports['default'] = ApolloProvider$1; +exports.ApolloProvider = ApolloProvider$1; +exports.ApolloQuery = ApolloQuery; +exports.ApolloSubscribeToMore = ApolloSubscribeToMore; +exports.default = ApolloProvider; exports.willPrefetch = willPrefetch; Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/package.json b/package.json index 5936351..291e4dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-apollo", - "version": "3.0.0-alpha.3", + "version": "3.0.0-beta.1", "description": "Vue apollo integration", "main": "dist/vue-apollo.umd.js", "module": "dist/vue-apollo.esm.js", From ba6fc4a47f9021f4c3c0438e02c34d94da25b961 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Sun, 11 Feb 2018 21:59:31 +0100 Subject: [PATCH 22/22] Readme update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af282d6..7a449bf 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Apollo and GraphQL for Vue.js -[![npm](https://img.shields.io/npm/v/vue-apollo/next.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) +[![npm](https://img.shields.io/npm/v/vue-apollo.svg) ![npm](https://img.shields.io/npm/dm/vue-apollo.svg)](https://www.npmjs.com/package/vue-apollo) [![vue1](https://img.shields.io/badge/apollo-2.x-blue.svg)](https://www.apollographql.com/) [![vue1](https://img.shields.io/badge/vue-1.x-brightgreen.svg) ![vue2](https://img.shields.io/badge/vue-2.2+-brightgreen.svg)](https://vuejs.org/) ![schema](https://cdn-images-1.medium.com/max/800/1*H9AANoofLqjS10Xd5TwRYw.png) -**Warning! This README is related to the next version of vue-apollo (that supports Apollo 2.x). For the old release (supporting only Apollo 1.x), see [here](https://github.com/Akryum/vue-apollo/tree/master).** +**Warning! This README is related to the next version of vue-apollo (that supports Apollo 2.x). For the old release (supporting only Apollo 1.x), see [here](https://github.com/Akryum/vue-apollo/tree/apollo-1).** Integrates [apollo](https://www.apollographql.com/) in your [Vue](http://vuejs.org) components with declarative queries. Compatible with Vue 1.0+ and 2.0+. [Live demo](https://jsfiddle.net/Akryum/oyejk2qL/)