New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vue/apollo-components

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/apollo-components - npm Package Compare versions

Comparing version 4.0.0-alpha.15 to 4.0.0-alpha.16

273

dist/vue-apollo-components.esm.js

@@ -58,3 +58,3 @@ import gql from 'graphql-tag';

function isDataFilled(data) {
return Object.keys(data).length > 0;
return data && Object.keys(data).length > 0;
}

@@ -324,164 +324,146 @@

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @returns {Function} A new, throttled, function.
*/
function throttle(delay, noTrailing, callback, debounceMode) {
/*
* After wrapper has stopped being called, this timeout ensures that
* `callback` is executed at the proper times in `throttle` and `end`
* debounce modes.
*/
var timeoutID;
var cancelled = false; // Keep track of the last time `callback` was executed.
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lastExec = 0; // Function to clear existing timeout
var index_umd = createCommonjsModule(function (module, exports) {
(function (global, factory) {
factory(exports) ;
})(commonjsGlobal, function (exports) {
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
} // Function to cancel next exec
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @returns {Function} A new, throttled, function.
*/
function throttle(delay, noTrailing, callback, debounceMode) {
/*
* After wrapper has stopped being called, this timeout ensures that
* `callback` is executed at the proper times in `throttle` and `end`
* debounce modes.
*/
var timeoutID;
var cancelled = false; // Keep track of the last time `callback` was executed.
function cancel() {
clearExistingTimeout();
cancelled = true;
} // `noTrailing` defaults to falsy.
var lastExec = 0; // Function to clear existing timeout
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
} // Function to cancel next exec
if (typeof noTrailing !== 'boolean') {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
/*
* The `wrapper` function encapsulates all of the throttling / debouncing
* functionality and when executed will limit the rate at which `callback`
* is executed.
*/
function cancel() {
clearExistingTimeout();
cancelled = true;
} // `noTrailing` defaults to falsy.
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
var self = this;
var elapsed = Date.now() - lastExec;
if (typeof noTrailing !== 'boolean') {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
/*
* The `wrapper` function encapsulates all of the throttling / debouncing
* functionality and when executed will limit the rate at which `callback`
* is executed.
*/
if (cancelled) {
return;
} // Execute `callback` and update the `lastExec` timestamp.
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
function exec() {
lastExec = Date.now();
callback.apply(self, arguments_);
}
/*
* If `debounceMode` is true (at begin) this is used to clear the flag
* to allow future `callback` executions.
*/
var self = this;
var elapsed = Date.now() - lastExec;
if (cancelled) {
return;
} // Execute `callback` and update the `lastExec` timestamp.
function clear() {
timeoutID = undefined;
}
if (debounceMode && !timeoutID) {
/*
* Since `wrapper` is being called for the first time and
* `debounceMode` is true (at begin), execute `callback`.
*/
exec();
}
function exec() {
lastExec = Date.now();
callback.apply(self, arguments_);
}
/*
* If `debounceMode` is true (at begin) this is used to clear the flag
* to allow future `callback` executions.
*/
clearExistingTimeout();
if (debounceMode === undefined && elapsed > delay) {
/*
* In throttle mode, if `delay` time has been exceeded, execute
* `callback`.
*/
exec();
} else if (noTrailing !== true) {
/*
* In trailing throttle mode, since `delay` time has not been
* exceeded, schedule `callback` to execute `delay` ms after most
* recent execution.
*
* If `debounceMode` is true (at begin), schedule `clear` to execute
* after `delay` ms.
*
* If `debounceMode` is false (at end), schedule `callback` to
* execute after `delay` ms.
*/
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
function clear() {
timeoutID = undefined;
}
wrapper.cancel = cancel; // Return the wrapper function.
if (debounceMode && !timeoutID) {
/*
* Since `wrapper` is being called for the first time and
* `debounceMode` is true (at begin), execute `callback`.
*/
exec();
}
return wrapper;
}
/* eslint-disable no-undefined */
clearExistingTimeout();
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @returns {Function} A new, debounced function.
*/
if (debounceMode === undefined && elapsed > delay) {
/*
* In throttle mode, if `delay` time has been exceeded, execute
* `callback`.
*/
exec();
} else if (noTrailing !== true) {
/*
* In trailing throttle mode, since `delay` time has not been
* exceeded, schedule `callback` to execute `delay` ms after most
* recent execution.
*
* If `debounceMode` is true (at begin), schedule `clear` to execute
* after `delay` ms.
*
* If `debounceMode` is false (at end), schedule `callback` to
* execute after `delay` ms.
*/
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
wrapper.cancel = cancel; // Return the wrapper function.
function debounce(delay, atBegin, callback) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
}
return wrapper;
}
/* eslint-disable no-undefined */
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @returns {Function} A new, debounced function.
*/
function debounce(delay, atBegin, callback) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
}
exports.debounce = debounce;
exports.throttle = throttle;
Object.defineProperty(exports, '__esModule', {
value: true
});
});
var esm = /*#__PURE__*/Object.freeze({
__proto__: null,
debounce: debounce,
throttle: throttle
});
unwrapExports(index_umd);

@@ -494,4 +476,4 @@ function factory(action) {

var throttle = factory(index_umd.throttle);
var debounce = factory(index_umd.debounce);
var throttle$1 = factory(esm.throttle);
var debounce$1 = factory(esm.debounce);

@@ -533,2 +515,6 @@ var addGqlError = function addGqlError(error) {

"default": 'div'
},
context: {
type: Object,
"default": undefined
}

@@ -559,3 +545,3 @@ },

this.$apollo.mutate(_objectSpread2({
return this.$apollo.mutate(_objectSpread2({
mutation: mutation,

@@ -566,3 +552,4 @@ client: this.clientId,

update: this.update,
refetchQueries: this.refetchQueries
refetchQueries: this.refetchQueries,
context: this.context
}, options)).then(function (result) {

@@ -604,3 +591,3 @@ _this.$emit('done', result);

plugin.version = "4.0.0-alpha.15"; // Apollo provider
plugin.version = "4.0.0-alpha.16"; // Apollo provider

@@ -607,0 +594,0 @@ var ApolloProvider = plugin; // Components

@@ -1,1 +0,1 @@

var VueApolloComponents=function(t,r,e){"use strict";function o(e,t){var o,r=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)),r}function n(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){var e,o;e=r,t=n[o=t],o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;var i={name:"ApolloQuery",provide:function(){return{getDollarApollo:this.getDollarApollo,getApolloQuery:this.getApolloQuery}},props:{query:{type:[Function,Object],required:!0},variables:{type:Object,default:void 0},fetchPolicy:{type:String,default:void 0},pollInterval:{type:Number,default:void 0},notifyOnNetworkStatusChange:{type:Boolean,default:void 0},context:{type:Object,default:void 0},update:{type:Function,default:function(t){return t}},skip:{type:Boolean,default:!1},debounce:{type:Number,default:0},throttle:{type:Number,default:0},clientId:{type:String,default:void 0},deep:{type:Boolean,default:void 0},tag:{type:String,default:"div"},prefetch:{type:Boolean,default:!0},options:{type:Object,default:function(){return{}}}},data:function(){return{result:{data:null,loading:!1,networkStatus:7,error:null},times:0}},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})},"$data.$apolloData.loading":function(t){this.$emit("loading",!!t)}},apollo:{$client:function(){return this.clientId},query:function(){return n(n({query:function(){return"function"==typeof this.query?this.query(r):this.query},variables:function(){return this.variables},fetchPolicy:this.fetchPolicy,pollInterval:this.pollInterval,debounce:this.debounce,throttle:this.throttle,notifyOnNetworkStatusChange:this.notifyOnNetworkStatusChange,context:function(){return this.context},skip:function(){return this.skip},deep:this.deep,prefetch:this.prefetch},this.options),{},{manual:!0,result:function(t){console.log(t);var e=t,o=e.errors,r=e.loading,n=e.networkStatus,e=t.error;t=Object.assign({},t),o&&o.length&&((e=new Error("Apollo errors occurred (".concat(o.length,")"))).graphQLErrors=o);o={};r?Object.assign(o,this.$_previousData,t.data):e?Object.assign(o,this.$apollo.queries.query.observer.getLastResult()||{},t.data):(o=t.data,this.$_previousData=t.data);t=o,t=0<Object.keys(t).length;this.result={data:t?this.update(o):void 0,fullData:t?o:void 0,loading:r,error:e,networkStatus:n},this.times=++this.$_times,this.$emit("result",this.result)},error:function(t){this.result.loading=!1,this.result.error=t,this.$emit("error",t)}})}},created:function(){this.$_times=0},methods:{getDollarApollo:function(){return this.$apollo},getApolloQuery:function(){return this.$apollo.queries.query}},render:function(){var t=this.$slots.default({result:this.result,times:this.times,query:this.$apollo.queries.query,isLoading:this.$apolloData.loading,gqlError:this.result&&this.result.error&&this.result.error.gqlError});return this.tag?e.h(this.tag,t):t}},l=0,u={name:"ApolloSubscribeToMore",inject:["getDollarApollo","getApolloQuery"],props:{document:{type:[Function,Object],required:!0},variables:{type:Object,default:void 0},updateQuery:{type:Function,default:void 0}},watch:{document:"refresh",variables:"refresh"},created:function(){this.$_key="sub_component_".concat(l++)},mounted:function(){this.refresh()},beforeUnmount:function(){this.destroy()},methods:{destroy:function(){this.$_sub&&this.$_sub.destroy()},refresh:function(){this.destroy();var t=this.document;"function"==typeof t&&(t=t(r)),this.$_sub=this.getDollarApollo().addSmartSubscription(this.$_key,{document:t,variables:this.variables,updateQuery:this.updateQuery,linkedQuery:this.getApolloQuery()})}},render:function(){return null}};var a,s,c=(function(t){function r(l,u,a,s){var c,p=!1,d=0;function h(){c&&clearTimeout(c)}function t(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];var r=this,n=Date.now()-d;function i(){d=Date.now(),a.apply(r,e)}p||(s&&!c&&i(),h(),void 0===s&&l<n?i():!0!==u&&(c=setTimeout(s?function(){c=void 0}:i,void 0===s?l-n:l)))}return"boolean"!=typeof u&&(s=a,a=u,u=void 0),t.cancel=function(){h(),p=!0},t}(t=t).debounce=function(t,e,o){return void 0===o?r(t,e,!1):r(t,o,!1!==e)},t.throttle=r,Object.defineProperty(t,"__esModule",{value:!0})}((a={exports:{}},a.exports)),a.exports);function p(o){return function(t,e){return o(e,t)}}(s=c)&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")&&s.default;p(c.throttle),p(c.debounce);var d={props:{mutation:{type:[Function,Object],required:!0},variables:{type:Object,default:void 0},optimisticResponse:{type:Object,default:void 0},update:{type:Function,default:void 0},refetchQueries:{type:Function,default:void 0},clientId:{type:String,default:void 0},tag:{type:String,default:"div"}},data:function(){return{loading:!1,error:null}},watch:{loading:function(t){this.$emit("loading",t)}},methods:{mutate:function(t){var o=this;this.loading=!0,this.error=null;var e=this.mutation;"function"==typeof e&&(e=e(r)),this.$apollo.mutate(n({mutation:e,client:this.clientId,variables:this.variables,optimisticResponse:this.optimisticResponse,update:this.update,refetchQueries:this.refetchQueries},t)).then(function(t){o.$emit("done",t),o.loading=!1}).catch(function(t){var e;(e=t).graphQLErrors&&e.graphQLErrors.length&&(e.gqlError=e.graphQLErrors[0]),o.error=t,o.$emit("error",t),o.loading=!1})}},render:function(){var t=this.$slots.default({mutate:this.mutate,loading:this.loading,error:this.error,gqlError:this.error&&this.error.gqlError});return this.tag?e.h(this.tag,t):t}},h={};function f(t,e){t.component("ApolloQuery",i),t.component("ApolloQuery",i),t.component("ApolloSubscribeToMore",u),t.component("ApolloSubscribeToMore",u),t.component("ApolloMutation",d),t.component("ApolloMutation",d)}h.install=f,h.version="4.0.0-alpha.15";var y=h,g=i,b=u,v=d,m=null;return"undefined"!=typeof window?m=window.Vue:"undefined"!=typeof global&&(m=global.Vue),m&&m.use(h),t.ApolloMutation=v,t.ApolloProvider=y,t.ApolloQuery=g,t.ApolloSubscribeToMore=b,t.default=h,t.install=f,t}({},gql,vue);
var VueApolloComponents=function(t,r,e){"use strict";function o(e,t){var o,r=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)),r}function n(r){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){var e,o;e=r,t=n[o=t],o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}r=r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r;var i={name:"ApolloQuery",provide:function(){return{getDollarApollo:this.getDollarApollo,getApolloQuery:this.getApolloQuery}},props:{query:{type:[Function,Object],required:!0},variables:{type:Object,default:void 0},fetchPolicy:{type:String,default:void 0},pollInterval:{type:Number,default:void 0},notifyOnNetworkStatusChange:{type:Boolean,default:void 0},context:{type:Object,default:void 0},update:{type:Function,default:function(t){return t}},skip:{type:Boolean,default:!1},debounce:{type:Number,default:0},throttle:{type:Number,default:0},clientId:{type:String,default:void 0},deep:{type:Boolean,default:void 0},tag:{type:String,default:"div"},prefetch:{type:Boolean,default:!0},options:{type:Object,default:function(){return{}}}},data:function(){return{result:{data:null,loading:!1,networkStatus:7,error:null},times:0}},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})},"$data.$apolloData.loading":function(t){this.$emit("loading",!!t)}},apollo:{$client:function(){return this.clientId},query:function(){return n(n({query:function(){return"function"==typeof this.query?this.query(r):this.query},variables:function(){return this.variables},fetchPolicy:this.fetchPolicy,pollInterval:this.pollInterval,debounce:this.debounce,throttle:this.throttle,notifyOnNetworkStatusChange:this.notifyOnNetworkStatusChange,context:function(){return this.context},skip:function(){return this.skip},deep:this.deep,prefetch:this.prefetch},this.options),{},{manual:!0,result:function(t){console.log(t);var e=t,o=e.errors,r=e.loading,n=e.networkStatus,e=t.error;t=Object.assign({},t),o&&o.length&&((e=new Error("Apollo errors occurred (".concat(o.length,")"))).graphQLErrors=o);o={};r?Object.assign(o,this.$_previousData,t.data):e?Object.assign(o,this.$apollo.queries.query.observer.getLastResult()||{},t.data):(o=t.data,this.$_previousData=t.data);t=(t=o)&&0<Object.keys(t).length;this.result={data:t?this.update(o):void 0,fullData:t?o:void 0,loading:r,error:e,networkStatus:n},this.times=++this.$_times,this.$emit("result",this.result)},error:function(t){this.result.loading=!1,this.result.error=t,this.$emit("error",t)}})}},created:function(){this.$_times=0},methods:{getDollarApollo:function(){return this.$apollo},getApolloQuery:function(){return this.$apollo.queries.query}},render:function(){var t=this.$slots.default({result:this.result,times:this.times,query:this.$apollo.queries.query,isLoading:this.$apolloData.loading,gqlError:this.result&&this.result.error&&this.result.error.gqlError});return this.tag?e.h(this.tag,t):t}},l=0,u={name:"ApolloSubscribeToMore",inject:["getDollarApollo","getApolloQuery"],props:{document:{type:[Function,Object],required:!0},variables:{type:Object,default:void 0},updateQuery:{type:Function,default:void 0}},watch:{document:"refresh",variables:"refresh"},created:function(){this.$_key="sub_component_".concat(l++)},mounted:function(){this.refresh()},beforeUnmount:function(){this.destroy()},methods:{destroy:function(){this.$_sub&&this.$_sub.destroy()},refresh:function(){this.destroy();var t=this.document;"function"==typeof t&&(t=t(r)),this.$_sub=this.getDollarApollo().addSmartSubscription(this.$_key,{document:t,variables:this.variables,updateQuery:this.updateQuery,linkedQuery:this.getApolloQuery()})}},render:function(){return null}};function a(l,u,a,s){var c,p=!1,d=0;function h(){c&&clearTimeout(c)}function t(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];var r=this,n=Date.now()-d;function i(){d=Date.now(),a.apply(r,e)}p||(s&&!c&&i(),h(),void 0===s&&l<n?i():!0!==u&&(c=setTimeout(s?function(){c=void 0}:i,void 0===s?l-n:l)))}return"boolean"!=typeof u&&(s=a,a=u,u=void 0),t.cancel=function(){h(),p=!0},t}var s=Object.freeze({__proto__:null,debounce:function(t,e,o){return void 0===o?a(t,e,!1):a(t,o,!1!==e)},throttle:a});function c(o){return function(t,e){return o(e,t)}}c(s.throttle),c(s.debounce);var p={props:{mutation:{type:[Function,Object],required:!0},variables:{type:Object,default:void 0},optimisticResponse:{type:Object,default:void 0},update:{type:Function,default:void 0},refetchQueries:{type:Function,default:void 0},clientId:{type:String,default:void 0},tag:{type:String,default:"div"},context:{type:Object,default:void 0}},data:function(){return{loading:!1,error:null}},watch:{loading:function(t){this.$emit("loading",t)}},methods:{mutate:function(t){var o=this;this.loading=!0,this.error=null;var e=this.mutation;return"function"==typeof e&&(e=e(r)),this.$apollo.mutate(n({mutation:e,client:this.clientId,variables:this.variables,optimisticResponse:this.optimisticResponse,update:this.update,refetchQueries:this.refetchQueries,context:this.context},t)).then(function(t){o.$emit("done",t),o.loading=!1}).catch(function(t){var e;(e=t).graphQLErrors&&e.graphQLErrors.length&&(e.gqlError=e.graphQLErrors[0]),o.error=t,o.$emit("error",t),o.loading=!1})}},render:function(){var t=this.$slots.default({mutate:this.mutate,loading:this.loading,error:this.error,gqlError:this.error&&this.error.gqlError});return this.tag?e.h(this.tag,t):t}},d={};function h(t,e){t.component("ApolloQuery",i),t.component("ApolloQuery",i),t.component("ApolloSubscribeToMore",u),t.component("ApolloSubscribeToMore",u),t.component("ApolloMutation",p),t.component("ApolloMutation",p)}d.install=h,d.version="4.0.0-alpha.16";var f=d,y=i,g=u,b=p,s=null;return"undefined"!=typeof window?s=window.Vue:"undefined"!=typeof global&&(s=global.Vue),s&&s.use(d),t.ApolloMutation=b,t.ApolloProvider=f,t.ApolloQuery=y,t.ApolloSubscribeToMore=g,t.default=d,t.install=h,t}({},gql,vue);

@@ -63,3 +63,3 @@ (function (global, factory) {

function isDataFilled(data) {
return Object.keys(data).length > 0;
return data && Object.keys(data).length > 0;
}

@@ -329,164 +329,146 @@

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @returns {Function} A new, throttled, function.
*/
function throttle(delay, noTrailing, callback, debounceMode) {
/*
* After wrapper has stopped being called, this timeout ensures that
* `callback` is executed at the proper times in `throttle` and `end`
* debounce modes.
*/
var timeoutID;
var cancelled = false; // Keep track of the last time `callback` was executed.
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var lastExec = 0; // Function to clear existing timeout
var index_umd = createCommonjsModule(function (module, exports) {
(function (global, factory) {
factory(exports) ;
})(commonjsGlobal, function (exports) {
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
} // Function to cancel next exec
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @returns {Function} A new, throttled, function.
*/
function throttle(delay, noTrailing, callback, debounceMode) {
/*
* After wrapper has stopped being called, this timeout ensures that
* `callback` is executed at the proper times in `throttle` and `end`
* debounce modes.
*/
var timeoutID;
var cancelled = false; // Keep track of the last time `callback` was executed.
function cancel() {
clearExistingTimeout();
cancelled = true;
} // `noTrailing` defaults to falsy.
var lastExec = 0; // Function to clear existing timeout
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
} // Function to cancel next exec
if (typeof noTrailing !== 'boolean') {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
/*
* The `wrapper` function encapsulates all of the throttling / debouncing
* functionality and when executed will limit the rate at which `callback`
* is executed.
*/
function cancel() {
clearExistingTimeout();
cancelled = true;
} // `noTrailing` defaults to falsy.
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
var self = this;
var elapsed = Date.now() - lastExec;
if (typeof noTrailing !== 'boolean') {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
/*
* The `wrapper` function encapsulates all of the throttling / debouncing
* functionality and when executed will limit the rate at which `callback`
* is executed.
*/
if (cancelled) {
return;
} // Execute `callback` and update the `lastExec` timestamp.
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
function exec() {
lastExec = Date.now();
callback.apply(self, arguments_);
}
/*
* If `debounceMode` is true (at begin) this is used to clear the flag
* to allow future `callback` executions.
*/
var self = this;
var elapsed = Date.now() - lastExec;
if (cancelled) {
return;
} // Execute `callback` and update the `lastExec` timestamp.
function clear() {
timeoutID = undefined;
}
if (debounceMode && !timeoutID) {
/*
* Since `wrapper` is being called for the first time and
* `debounceMode` is true (at begin), execute `callback`.
*/
exec();
}
function exec() {
lastExec = Date.now();
callback.apply(self, arguments_);
}
/*
* If `debounceMode` is true (at begin) this is used to clear the flag
* to allow future `callback` executions.
*/
clearExistingTimeout();
if (debounceMode === undefined && elapsed > delay) {
/*
* In throttle mode, if `delay` time has been exceeded, execute
* `callback`.
*/
exec();
} else if (noTrailing !== true) {
/*
* In trailing throttle mode, since `delay` time has not been
* exceeded, schedule `callback` to execute `delay` ms after most
* recent execution.
*
* If `debounceMode` is true (at begin), schedule `clear` to execute
* after `delay` ms.
*
* If `debounceMode` is false (at end), schedule `callback` to
* execute after `delay` ms.
*/
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
function clear() {
timeoutID = undefined;
}
wrapper.cancel = cancel; // Return the wrapper function.
if (debounceMode && !timeoutID) {
/*
* Since `wrapper` is being called for the first time and
* `debounceMode` is true (at begin), execute `callback`.
*/
exec();
}
return wrapper;
}
/* eslint-disable no-undefined */
clearExistingTimeout();
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @returns {Function} A new, debounced function.
*/
if (debounceMode === undefined && elapsed > delay) {
/*
* In throttle mode, if `delay` time has been exceeded, execute
* `callback`.
*/
exec();
} else if (noTrailing !== true) {
/*
* In trailing throttle mode, since `delay` time has not been
* exceeded, schedule `callback` to execute `delay` ms after most
* recent execution.
*
* If `debounceMode` is true (at begin), schedule `clear` to execute
* after `delay` ms.
*
* If `debounceMode` is false (at end), schedule `callback` to
* execute after `delay` ms.
*/
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
wrapper.cancel = cancel; // Return the wrapper function.
function debounce(delay, atBegin, callback) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
}
return wrapper;
}
/* eslint-disable no-undefined */
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @returns {Function} A new, debounced function.
*/
function debounce(delay, atBegin, callback) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
}
exports.debounce = debounce;
exports.throttle = throttle;
Object.defineProperty(exports, '__esModule', {
value: true
});
});
var esm = /*#__PURE__*/Object.freeze({
__proto__: null,
debounce: debounce,
throttle: throttle
});
unwrapExports(index_umd);

@@ -499,4 +481,4 @@ function factory(action) {

var throttle = factory(index_umd.throttle);
var debounce = factory(index_umd.debounce);
var throttle$1 = factory(esm.throttle);
var debounce$1 = factory(esm.debounce);

@@ -538,2 +520,6 @@ var addGqlError = function addGqlError(error) {

"default": 'div'
},
context: {
type: Object,
"default": undefined
}

@@ -564,3 +550,3 @@ },

this.$apollo.mutate(_objectSpread2({
return this.$apollo.mutate(_objectSpread2({
mutation: mutation,

@@ -571,3 +557,4 @@ client: this.clientId,

update: this.update,
refetchQueries: this.refetchQueries
refetchQueries: this.refetchQueries,
context: this.context
}, options)).then(function (result) {

@@ -609,3 +596,3 @@ _this.$emit('done', result);

plugin.version = "4.0.0-alpha.15"; // Apollo provider
plugin.version = "4.0.0-alpha.16"; // Apollo provider

@@ -612,0 +599,0 @@ var ApolloProvider = plugin; // Components

{
"name": "@vue/apollo-components",
"version": "4.0.0-alpha.15",
"version": "4.0.0-alpha.16",
"description": "Apollo GraphQL components for Vue.js",

@@ -37,3 +37,3 @@ "main": "dist/vue-apollo-components.umd.js",

"dependencies": {
"@vue/apollo-option": "^4.0.0-alpha.15"
"@vue/apollo-option": "^4.0.0-alpha.16"
},

@@ -73,3 +73,3 @@ "peerDependencies": {

},
"gitHead": "e952766bcf556791402fbaf90498fff7ef362d1f"
"gitHead": "cb0e79489177be4d4c90cbe8a442e812c194cb4a"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc