diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js
index 0d9f497..fc96501 100644
--- a/dist/vue-apollo.esm.js
+++ b/dist/vue-apollo.esm.js
@@ -1487,7 +1487,7 @@ function stubArray() {
return [];
}
-var index = omit;
+var lodash_omit = omit;
/**
* lodash (Custom Build)
@@ -1927,7 +1927,7 @@ function toNumber(value) {
: (reIsBadHex.test(value) ? NAN : +value);
}
-var index$1 = throttle$1;
+var lodash_throttle = throttle$1;
/**
* lodash (Custom Build)
@@ -2305,7 +2305,7 @@ function toNumber$1(value) {
: (reIsBadHex$1.test(value) ? NAN$1 : +value);
}
-var index$2 = debounce$2;
+var lodash_debounce = debounce$2;
var Globals = {};
@@ -2319,9 +2319,9 @@ function factory(action) {
};
}
-var throttle = factory(index$1);
+var throttle = factory(lodash_throttle);
-var debounce = factory(index$2);
+var debounce = factory(lodash_debounce);
function getMergedDefinition(def) {
return Globals.Vue.util.mergeOptions({}, def);
@@ -2598,7 +2598,7 @@ var SmartApollo = function () {
}, {
key: 'generateApolloOptions',
value: function generateApolloOptions(variables) {
- var apolloOptions = index(this.options, this.vueApolloSpecialKeys);
+ var apolloOptions = lodash_omit(this.options, this.vueApolloSpecialKeys);
apolloOptions.variables = variables;
return apolloOptions;
}
@@ -3037,15 +3037,26 @@ var DollarApollo = function () {
}, {
key: 'addSmartQuery',
value: function addSmartQuery(key, options) {
+ var _this3 = this;
+
options = reapply(options, this.vm);
var smart = this.queries[key] = new SmartQuery(this.vm, key, options, false);
smart.autostart();
- if (options.subscribeToMore) {
- this.addSmartSubscription(key, _extends({}, options.subscribeToMore, {
- linkedQuery: smart
- }));
+ var subs = options.subscribeToMore;
+ if (subs) {
+ if (Array.isArray(subs)) {
+ subs.forEach(function (sub, index) {
+ _this3.addSmartSubscription('' + key + index, _extends({}, sub, {
+ linkedQuery: smart
+ }));
+ });
+ } else {
+ this.addSmartSubscription(key, _extends({}, subs, {
+ linkedQuery: smart
+ }));
+ }
}
return smart;
@@ -3063,10 +3074,10 @@ var DollarApollo = function () {
}, {
key: 'defineReactiveSetter',
value: function defineReactiveSetter(key, func) {
- var _this3 = this;
+ var _this4 = this;
this._watchers.push(this.vm.$watch(func, function (value) {
- _this3[key] = value;
+ _this4[key] = value;
}, {
immediate: true
}));
@@ -3286,7 +3297,7 @@ var ApolloProvider$1 = function () {
// Query
return new Promise(function (resolve, reject) {
- var options = index(queryOptions, VUE_APOLLO_QUERY_KEYWORDS);
+ var options = lodash_omit(queryOptions, VUE_APOLLO_QUERY_KEYWORDS);
options.variables = variables;
client.query(options).then(resolve, reject);
});
@@ -3407,8 +3418,8 @@ function install(Vue, options) {
if (!toVal) return fromVal;
if (!fromVal) return toVal;
- var toData = Object.assign({}, index(toVal, keywords), toVal.data);
- var fromData = Object.assign({}, index(fromVal, keywords), fromVal.data);
+ var toData = Object.assign({}, lodash_omit(toVal, keywords), toVal.data);
+ var fromData = Object.assign({}, lodash_omit(fromVal, keywords), fromVal.data);
var map = {};
for (var i = 0; i < keywords.length; i++) {
diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js
index 839b4d5..3d1bfd3 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&&u(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i-1}function A(t,e){var r=this.__data__,i=V(r,t);return i<0?r.push([t,e]):r[i][1]=e,this}function P(t){var e=-1,r=t?t.length:0;for(this.clear();++e=Tt&&(a=f,l=!1,e=new M(e));t:for(;++u0&&r(a)?e>1?R(a,e-1,r,i,n):o(n,a):i||(n[n.length]=a)}return n}function D(t,e,r){var i=e(t);return he(t)?i:o(i,r(t))}function I(t){if(!lt(t)||Y(t))return!1;var e=ut(t)||p(t)?te:It;return e.test(rt(t))}function K(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),W(t,e,function(e,r){return r in t})}function W(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=Lt}function lt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ct(t){return!!t&&"object"==typeof t}function ft(t){return"symbol"==typeof t||ct(t)&&Zt.call(t)==Rt}function ht(t){return ot(t)?C(t,!0):K(t)}function pt(){return[]}function vt(t,e,r){function i(e){var r=h,i=p;return h=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,b=setTimeout(u,e),_?i(t):y}function o(t){var r=t-d,i=t-g,n=e-r;return m?xe(n,v-i):n}function s(t){var r=t-d,i=t-g;return void 0===d||r>=e||r<0||m&&i>=v}function u(){var t=Ee();return s(t)?a(t):void(b=setTimeout(u,o(t)))}function a(t){return b=void 0,w&&h?i(t):(h=p=void 0,y)}function l(){void 0!==b&&clearTimeout(b),g=0,h=d=p=b=void 0}function c(){return void 0===b?y:a(Ee())}function f(){var t=Ee(),r=s(t);if(h=arguments,p=this,d=t,r){if(void 0===b)return n(d);if(m)return b=setTimeout(u,e),i(d)}return void 0===b&&(b=setTimeout(u,e)),y}var h,p,v,y,b,d,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(ye);return e=_t(e)||0,bt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?$e(_t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),f.cancel=l,f.flush=c,f}function yt(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError(ye);return bt(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 bt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function dt(t){return!!t&&"object"==typeof t}function gt(t){return"symbol"==typeof t||dt(t)&&Pe.call(t)==de}function _t(t){if("number"==typeof t)return t;if(gt(t))return be;if(bt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=bt(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)?be:+t}function mt(t,e,r){function i(e){var r=h,i=p;return h=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,b=setTimeout(u,e),_?i(t):y}function o(t){var r=t-d,i=t-g,n=e-r;return m?Je(n,v-i):n}function s(t){var r=t-d,i=t-g;return void 0===d||r>=e||r<0||m&&i>=v}function u(){var t=Ue();return s(t)?a(t):void(b=setTimeout(u,o(t)))}function a(t){return b=void 0,w&&h?i(t):(h=p=void 0,y)}function l(){void 0!==b&&clearTimeout(b),g=0,h=d=p=b=void 0}function c(){return void 0===b?y:a(Ue())}function f(){var t=Ue(),r=s(t);if(h=arguments,p=this,d=t,r){if(void 0===b)return n(d);if(m)return b=setTimeout(u,e),i(d)}return void 0===b&&(b=setTimeout(u,e)),y}var h,p,v,y,b,d,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(Te);return e=jt(e)||0,wt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?Ge(jt(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),f.cancel=l,f.flush=c,f}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)&&We.call(t)==qe}function jt(t){if("number"==typeof t)return t;if(Ot(t))return Me;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(Le,"");var r=Ve.test(t);return r||Ne.test(t)?Re(t.slice(2),r?2:8):Ce.test(t)?Me:+t}function St(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function At(t){return Be.Vue.util.mergeOptions({},t)}function Pt(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function $t(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,Be.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={},u=0;u3&&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 u=this.options.document.bind(this.vm);this.options.document=u(),this._watchers.push(this.vm.$watch(u,function(t){n.options.document=t,n.refresh()}))}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?He(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:"catchError",value:function(t){if(t.graphQLErrors&&0!==t.graphQLErrors.length){console.error("GraphQL execution errors for "+this.type+" '"+this.key+"'");var e=!0,r=!1,i=void 0;try{for(var n,o=t.graphQLErrors[Symbol.iterator]();!(e=(n=o.next()).done);e=!0){var s=n.value;console.error(s)}}catch(t){r=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(r)throw i}}}else if(t.networkError)console.error("Error sending the "+this.type+" '"+this.key+"'",t.networkError);else if(console.error("[vue-apollo] An error has occured for "+this.type+" '"+this.key+"'"),Array.isArray(t)){var u;(u=console).error.apply(u,ur(t))}else console.error(t);"function"==typeof this.options.error&&this.options.error.call(this.vm,t)}},{key:"destroy",value:function(){this.stop();var t=!0,e=!1,r=void 0;try{for(var i,n=this._watchers[Symbol.iterator]();!(t=(i=n.next()).done);t=!0){var o=i.value;o()}}catch(t){e=!0,r=t}finally{try{!t&&n.return&&n.return()}finally{if(e)throw r}}}},{key:"skip",get:function(){return this._skip},set:function(t){t?this.stop():this.start(),this._skip=t}}]),t}(),lr=function(t){function e(t,r,i){var n=!(arguments.length>3&&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(),"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.vm[this.key]=e[this.key]),"function"==typeof this.options.result&&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:"applyLoadingModifier",value:function(t){this.options.loadingKey&&(this.vm[this.options.loadingKey]+=t),this.options.watchLoading&&this.options.watchLoading.call(this.vm,1===t,t)}},{key:"loadingDone",value:function(){this.loading&&this.applyLoadingModifier(-1),this.loading=!1}},{key:"fetchMore",value:function(){if(this.observer){var t;return this.maySetLoading(!0),(t=this.observer).fetchMore.apply(t,arguments)}}},{key:"subscribeToMore",value:function(){if(this.observer){var t;return{unsubscribe:(t=this.observer).subscribeToMore.apply(t,arguments)}}}},{key:"refetch",value:function(t){var e=this;if(t&&(this.options.variables=t),this.observer){var r=this.observer.refetch(t).then(function(t){t.loading||e.loadingDone()});return this.maySetLoading(),r}}},{key:"setVariables",value:function(t,e){if(this.options.variables=t,this.observer){var r=this.observer.setVariables(t,e);return this.maySetLoading(),r}}},{key:"setOptions",value:function(t){if(Object.assign(this.options,t),this.observer){var e=this.observer.setOptions(t);return this.maySetLoading(),e}}},{key:"startPolling",value:function(){if(this.observer){var t;return(t=this.observer).startPolling.apply(t,arguments)}}},{key:"stopPolling",value:function(){if(this.observer){var t;return(t=this.observer).stopPolling.apply(t,arguments)}}}]),e}(ar),cr=function(t){function e(){var t,r,i,n;tr(this,e);for(var o=arguments.length,s=Array(o),u=0;u `subscribe` option is deprecated. Use the `$subscribe` option instead."),e.$subscribe)for(var r in e.$subscribe)this.$apollo.addSmartSubscription(r,e.$subscribe[r]);xt(this.$apollo,"skipAll",e.$skipAll),xt(this.$apollo,"skipAllQueries",e.$skipAllQueries),xt(this.$apollo,"skipAllSubscriptions",e.$skipAllSubscriptions),xt(this.$apollo,"client",e.$client)}}};hr.install=Et;var dr=hr,gr=null;"undefined"!=typeof window?gr=window.Vue:"undefined"!=typeof global&&(gr=global.Vue),gr&&gr.use(hr),t.install=Et,t.ApolloProvider=dr,t.default=hr,t.willPrefetch=$t}(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&&u(t,e,0)>-1}function i(t,e,r){for(var i=-1,n=t?t.length:0;++i-1}function A(t,e){var r=this.__data__,i=V(r,t);return i<0?r.push([t,e]):r[i][1]=e,this}function P(t){var e=-1,r=t?t.length:0;for(this.clear();++e=Tt&&(a=f,l=!1,e=new M(e));t:for(;++u0&&r(a)?e>1?R(a,e-1,r,i,n):o(n,a):i||(n[n.length]=a)}return n}function D(t,e,r){var i=e(t);return he(t)?i:o(i,r(t))}function I(t){if(!lt(t)||Y(t))return!1;var e=ut(t)||p(t)?te:It;return e.test(rt(t))}function K(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),W(t,e,function(e,r){return r in t})}function W(t,e,r){for(var i=-1,n=e.length,o={};++i-1&&t%1==0&&t-1&&t%1==0&&t<=Lt}function lt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ct(t){return!!t&&"object"==typeof t}function ft(t){return"symbol"==typeof t||ct(t)&&Zt.call(t)==Rt}function ht(t){return ot(t)?C(t,!0):K(t)}function pt(){return[]}function vt(t,e,r){function i(e){var r=h,i=p;return h=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,b=setTimeout(u,e),_?i(t):y}function o(t){var r=t-d,i=t-g,n=e-r;return m?xe(n,v-i):n}function s(t){var r=t-d,i=t-g;return void 0===d||r>=e||r<0||m&&i>=v}function u(){var t=Ee();return s(t)?a(t):void(b=setTimeout(u,o(t)))}function a(t){return b=void 0,w&&h?i(t):(h=p=void 0,y)}function l(){void 0!==b&&clearTimeout(b),g=0,h=d=p=b=void 0}function c(){return void 0===b?y:a(Ee())}function f(){var t=Ee(),r=s(t);if(h=arguments,p=this,d=t,r){if(void 0===b)return n(d);if(m)return b=setTimeout(u,e),i(d)}return void 0===b&&(b=setTimeout(u,e)),y}var h,p,v,y,b,d,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(ye);return e=_t(e)||0,bt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?$e(_t(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),f.cancel=l,f.flush=c,f}function yt(t,e,r){var i=!0,n=!0;if("function"!=typeof t)throw new TypeError(ye);return bt(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 bt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function dt(t){return!!t&&"object"==typeof t}function gt(t){return"symbol"==typeof t||dt(t)&&Pe.call(t)==de}function _t(t){if("number"==typeof t)return t;if(gt(t))return be;if(bt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=bt(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)?be:+t}function mt(t,e,r){function i(e){var r=h,i=p;return h=p=void 0,g=e,y=t.apply(i,r)}function n(t){return g=t,b=setTimeout(u,e),_?i(t):y}function o(t){var r=t-d,i=t-g,n=e-r;return m?Je(n,v-i):n}function s(t){var r=t-d,i=t-g;return void 0===d||r>=e||r<0||m&&i>=v}function u(){var t=Ue();return s(t)?a(t):void(b=setTimeout(u,o(t)))}function a(t){return b=void 0,w&&h?i(t):(h=p=void 0,y)}function l(){void 0!==b&&clearTimeout(b),g=0,h=d=p=b=void 0}function c(){return void 0===b?y:a(Ue())}function f(){var t=Ue(),r=s(t);if(h=arguments,p=this,d=t,r){if(void 0===b)return n(d);if(m)return b=setTimeout(u,e),i(d)}return void 0===b&&(b=setTimeout(u,e)),y}var h,p,v,y,b,d,g=0,_=!1,m=!1,w=!0;if("function"!=typeof t)throw new TypeError(Te);return e=jt(e)||0,wt(r)&&(_=!!r.leading,m="maxWait"in r,v=m?Ge(jt(r.maxWait)||0,e):v,w="trailing"in r?!!r.trailing:w),f.cancel=l,f.flush=c,f}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)&&We.call(t)==qe}function jt(t){if("number"==typeof t)return t;if(Ot(t))return Me;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(Le,"");var r=Ve.test(t);return r||Ne.test(t)?Re(t.slice(2),r?2:8):Ce.test(t)?Me:+t}function St(t){return function(e,r){return"number"==typeof r?t(e,r):t(e,r.wait,r)}}function At(t){return Be.Vue.util.mergeOptions({},t)}function Pt(t,e){for(;"function"==typeof t;)t=t.call(e);return t}function $t(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,Be.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={},u=0;u3&&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 u=this.options.document.bind(this.vm);this.options.document=u(),this._watchers.push(this.vm.$watch(u,function(t){n.options.document=t,n.refresh()}))}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?He(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:"catchError",value:function(t){if(t.graphQLErrors&&0!==t.graphQLErrors.length){console.error("GraphQL execution errors for "+this.type+" '"+this.key+"'");var e=!0,r=!1,i=void 0;try{for(var n,o=t.graphQLErrors[Symbol.iterator]();!(e=(n=o.next()).done);e=!0){var s=n.value;console.error(s)}}catch(t){r=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(r)throw i}}}else if(t.networkError)console.error("Error sending the "+this.type+" '"+this.key+"'",t.networkError);else if(console.error("[vue-apollo] An error has occured for "+this.type+" '"+this.key+"'"),Array.isArray(t)){var u;(u=console).error.apply(u,ur(t))}else console.error(t);"function"==typeof this.options.error&&this.options.error.call(this.vm,t)}},{key:"destroy",value:function(){this.stop();var t=!0,e=!1,r=void 0;try{for(var i,n=this._watchers[Symbol.iterator]();!(t=(i=n.next()).done);t=!0){var o=i.value;o()}}catch(t){e=!0,r=t}finally{try{!t&&n.return&&n.return()}finally{if(e)throw r}}}},{key:"skip",get:function(){return this._skip},set:function(t){t?this.stop():this.start(),this._skip=t}}]),t}(),lr=function(t){function e(t,r,i){var n=!(arguments.length>3&&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(),"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.vm[this.key]=e[this.key]),"function"==typeof this.options.result&&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:"applyLoadingModifier",value:function(t){this.options.loadingKey&&(this.vm[this.options.loadingKey]+=t),this.options.watchLoading&&this.options.watchLoading.call(this.vm,1===t,t)}},{key:"loadingDone",value:function(){this.loading&&this.applyLoadingModifier(-1),this.loading=!1}},{key:"fetchMore",value:function(){if(this.observer){var t;return this.maySetLoading(!0),(t=this.observer).fetchMore.apply(t,arguments)}}},{key:"subscribeToMore",value:function(){if(this.observer){var t;return{unsubscribe:(t=this.observer).subscribeToMore.apply(t,arguments)}}}},{key:"refetch",value:function(t){var e=this;if(t&&(this.options.variables=t),this.observer){var r=this.observer.refetch(t).then(function(t){t.loading||e.loadingDone()});return this.maySetLoading(),r}}},{key:"setVariables",value:function(t,e){if(this.options.variables=t,this.observer){var r=this.observer.setVariables(t,e);return this.maySetLoading(),r}}},{key:"setOptions",value:function(t){if(Object.assign(this.options,t),this.observer){var e=this.observer.setOptions(t);return this.maySetLoading(),e}}},{key:"startPolling",value:function(){if(this.observer){var t;return(t=this.observer).startPolling.apply(t,arguments)}}},{key:"stopPolling",value:function(){if(this.observer){var t;return(t=this.observer).stopPolling.apply(t,arguments)}}}]),e}(ar),cr=function(t){function e(){var t,r,i,n;tr(this,e);for(var o=arguments.length,s=Array(o),u=0;u `subscribe` option is deprecated. Use the `$subscribe` option instead."),e.$subscribe)for(var r in e.$subscribe)this.$apollo.addSmartSubscription(r,e.$subscribe[r]);xt(this.$apollo,"skipAll",e.$skipAll),xt(this.$apollo,"skipAllQueries",e.$skipAllQueries),xt(this.$apollo,"skipAllSubscriptions",e.$skipAllSubscriptions),xt(this.$apollo,"client",e.$client)}}};hr.install=Et;var dr=hr,gr=null;"undefined"!=typeof window?gr=window.Vue:"undefined"!=typeof global&&(gr=global.Vue),gr&&gr.use(hr),t.install=Et,t.ApolloProvider=dr,t.default=hr,t.willPrefetch=$t}(this.VueApollo=this.VueApollo||{});
diff --git a/dist/vue-apollo.umd.js b/dist/vue-apollo.umd.js
index b04df34..8d4b72c 100644
--- a/dist/vue-apollo.umd.js
+++ b/dist/vue-apollo.umd.js
@@ -1493,7 +1493,7 @@ function stubArray() {
return [];
}
-var index = omit;
+var lodash_omit = omit;
/**
* lodash (Custom Build)
@@ -1933,7 +1933,7 @@ function toNumber(value) {
: (reIsBadHex.test(value) ? NAN : +value);
}
-var index$1 = throttle$1;
+var lodash_throttle = throttle$1;
/**
* lodash (Custom Build)
@@ -2311,7 +2311,7 @@ function toNumber$1(value) {
: (reIsBadHex$1.test(value) ? NAN$1 : +value);
}
-var index$2 = debounce$2;
+var lodash_debounce = debounce$2;
var Globals = {};
@@ -2325,9 +2325,9 @@ function factory(action) {
};
}
-var throttle = factory(index$1);
+var throttle = factory(lodash_throttle);
-var debounce = factory(index$2);
+var debounce = factory(lodash_debounce);
function getMergedDefinition(def) {
return Globals.Vue.util.mergeOptions({}, def);
@@ -2604,7 +2604,7 @@ var SmartApollo = function () {
}, {
key: 'generateApolloOptions',
value: function generateApolloOptions(variables) {
- var apolloOptions = index(this.options, this.vueApolloSpecialKeys);
+ var apolloOptions = lodash_omit(this.options, this.vueApolloSpecialKeys);
apolloOptions.variables = variables;
return apolloOptions;
}
@@ -3043,15 +3043,26 @@ var DollarApollo = function () {
}, {
key: 'addSmartQuery',
value: function addSmartQuery(key, options) {
+ var _this3 = this;
+
options = reapply(options, this.vm);
var smart = this.queries[key] = new SmartQuery(this.vm, key, options, false);
smart.autostart();
- if (options.subscribeToMore) {
- this.addSmartSubscription(key, _extends({}, options.subscribeToMore, {
- linkedQuery: smart
- }));
+ var subs = options.subscribeToMore;
+ if (subs) {
+ if (Array.isArray(subs)) {
+ subs.forEach(function (sub, index) {
+ _this3.addSmartSubscription('' + key + index, _extends({}, sub, {
+ linkedQuery: smart
+ }));
+ });
+ } else {
+ this.addSmartSubscription(key, _extends({}, subs, {
+ linkedQuery: smart
+ }));
+ }
}
return smart;
@@ -3069,10 +3080,10 @@ var DollarApollo = function () {
}, {
key: 'defineReactiveSetter',
value: function defineReactiveSetter(key, func) {
- var _this3 = this;
+ var _this4 = this;
this._watchers.push(this.vm.$watch(func, function (value) {
- _this3[key] = value;
+ _this4[key] = value;
}, {
immediate: true
}));
@@ -3292,7 +3303,7 @@ var ApolloProvider$1 = function () {
// Query
return new Promise(function (resolve, reject) {
- var options = index(queryOptions, VUE_APOLLO_QUERY_KEYWORDS);
+ var options = lodash_omit(queryOptions, VUE_APOLLO_QUERY_KEYWORDS);
options.variables = variables;
client.query(options).then(resolve, reject);
});
@@ -3413,8 +3424,8 @@ function install(Vue, options) {
if (!toVal) return fromVal;
if (!fromVal) return toVal;
- var toData = Object.assign({}, index(toVal, keywords), toVal.data);
- var fromData = Object.assign({}, index(fromVal, keywords), fromVal.data);
+ var toData = Object.assign({}, lodash_omit(toVal, keywords), toVal.data);
+ var fromData = Object.assign({}, lodash_omit(fromVal, keywords), fromVal.data);
var map = {};
for (var i = 0; i < keywords.length; i++) {
diff --git a/package.json b/package.json
index 0f5f39a..7af8050 100644
--- a/package.json
+++ b/package.json
@@ -1,12 +1,12 @@
{
"name": "vue-apollo",
- "version": "2.1.0-beta.21",
+ "version": "2.1.0-beta.22",
"description": "Vue apollo integration",
"main": "dist/vue-apollo.umd.js",
"module": "dist/vue-apollo.esm.js",
"unpkg": "dist/vue-apollo.min.js",
"scripts": {
- "build": "rimraf ./dist && npm run build:browser && npm run build:es && npm run build:umd",
+ "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",