diff --git a/dist/vue-apollo.esm.js b/dist/vue-apollo.esm.js index 5cb9e02..7f7bc05 100644 --- a/dist/vue-apollo.esm.js +++ b/dist/vue-apollo.esm.js @@ -665,7 +665,7 @@ function () { } else if (error.networkError) { console.error("Error sending the ".concat(this.type, " '").concat(this.key, "'"), error.networkError); } else { - console.error("[vue-apollo] An error has occured for ".concat(this.type, " '").concat(this.key, "'")); + console.error("[vue-apollo] An error has occurred for ".concat(this.type, " '").concat(this.key, "'")); if (Array.isArray(error)) { var _console; @@ -1513,7 +1513,7 @@ function formatObjectValue(value, previouslySeenValues) { if (value) { var customInspectFn = getCustomFn(value); - if (customInspectFn) { + if (customInspectFn !== undefined) { // $FlowFixMe(>=0.90.0) var customValue = customInspectFn.call(value); // check for infinite recursion @@ -1633,8 +1633,10 @@ classObject) { * */ function invariant(condition, message) { + var booleanCondition = Boolean(condition); /* istanbul ignore else */ - if (!condition) { + + if (!booleanCondition) { throw new Error(message); } } @@ -1872,14 +1874,14 @@ function lpad(len, str) { return whitespace(len - str.length) + str; } +function _typeof$2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); } /** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. */ + function GraphQLError( // eslint-disable-line no-redeclare message, nodes, source, positions, path, originalError, extensions) { // Compute list of blame nodes. @@ -1925,7 +1927,15 @@ message, nodes, source, positions, path, originalError, extensions) { }, []); } - var _extensions = extensions || originalError && originalError.extensions; + var _extensions = extensions; + + if (_extensions == null && originalError != null) { + var originalExtensions = originalError.extensions; + + if (originalExtensions != null && _typeof$2(originalExtensions) === 'object') { + _extensions = originalExtensions; + } + } Object.defineProperties(this, { message: { @@ -2070,24 +2080,11 @@ function dedentBlockStringValue(rawString) { // Expand a block string's raw value into independent lines. var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. - var commonIndent = null; + var commonIndent = getBlockStringIndentation(lines); - for (var i = 1; i < lines.length; i++) { - var line = lines[i]; - var indent = leadingWhitespace(line); - - if (indent < line.length && (commonIndent === null || indent < commonIndent)) { - commonIndent = indent; - - if (commonIndent === 0) { - break; - } - } - } - - if (commonIndent) { - for (var _i = 1; _i < lines.length; _i++) { - lines[_i] = lines[_i].slice(commonIndent); + if (commonIndent !== 0) { + for (var i = 1; i < lines.length; i++) { + lines[i] = lines[i].slice(commonIndent); } } // Remove leading and trailing blank lines. @@ -2102,6 +2099,29 @@ function dedentBlockStringValue(rawString) { return lines.join('\n'); +} // @internal + +function getBlockStringIndentation(lines) { + var commonIndent = null; + + for (var i = 1; i < lines.length; i++) { + var line = lines[i]; + var indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + if (commonIndent === null || indent < commonIndent) { + commonIndent = indent; + + if (commonIndent === 0) { + break; + } + } + } + + return commonIndent === null ? 0 : commonIndent; } function leadingWhitespace(str) { @@ -2201,13 +2221,10 @@ var TokenKind = Object.freeze({ BLOCK_STRING: 'BlockString', COMMENT: 'Comment' }); -/** - * The enum type representing the token kinds values. - */ - /** * A helper function to describe a token as a string for debugging */ + function getTokenDesc(token) { var value = token.value; return value ? "".concat(token.kind, " \"").concat(value, "\"") : token.kind; @@ -2631,17 +2648,19 @@ function readString(source, start, line, col, prev) { break; case 117: - // u - var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); + { + // uXXXX + var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); - if (charCode < 0) { - throw syntaxError(source, position, 'Invalid character escape sequence: ' + "\\u".concat(body.slice(position + 1, position + 5), ".")); + if (charCode < 0) { + throw syntaxError(source, position, 'Invalid character escape sequence: ' + "\\u".concat(body.slice(position + 1, position + 5), ".")); + } + + value += String.fromCharCode(charCode); + position += 4; + break; } - value += String.fromCharCode(charCode); - position += 4; - break; - default: throw syntaxError(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); } @@ -4219,7 +4238,7 @@ function parseDirectiveLocation(lexer) { var start = lexer.token; var name = parseName(lexer); - if (DirectiveLocation.hasOwnProperty(name.value)) { + if (DirectiveLocation[name.value] !== undefined) { return name; } @@ -4704,7 +4723,7 @@ var CApolloQuery = { _result = Object.assign({}, _result); if (errors && errors.length) { - error = new Error("Apollo errors occured (".concat(errors.length, ")")); + error = new Error("Apollo errors occurred (".concat(errors.length, ")")); error.graphQLErrors = errors; } @@ -5132,7 +5151,7 @@ function install(Vue, options) { } ApolloProvider.install = install; // eslint-disable-next-line no-undef -ApolloProvider.version = "3.0.0-beta.30"; // Apollo provider +ApolloProvider.version = "3.0.0-rc.1"; // Apollo provider var ApolloProvider$1 = ApolloProvider; // Components diff --git a/dist/vue-apollo.min.js b/dist/vue-apollo.min.js index 77a6d8e..1c61230 100644 --- a/dist/vue-apollo.min.js +++ b/dist/vue-apollo.min.js @@ -1 +1 @@ -var VueApollo=function(t){"use strict";function r(t){return(r="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})(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n.provide() is deprecated. Use the 'apolloProvider' option instead with the provider object directly."),s({},t,this)}}]),e}(),$="function"==typeof Symbol?Symbol.for("nodejs.util.inspect.custom"):void 0;function C(t){return(C="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})(t)}var L=10,D=2;function P(t,e){switch(C(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return function(t,e){if(-1!==e.indexOf(t))return"[Circular]";var n=[].concat(e,[t]);if(t){var r=function(t){var e=t[String($)];if("function"==typeof e)return e;if("function"==typeof t.inspect)return t.inspect}(t);if(r){var i=r.call(t);if(i!==t)return"string"==typeof i?i:P(i,n)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>D)return"[Array]";for(var n=Math.min(L,t.length),r=t.length-n,i=[],o=0;oD)return"["+function(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){var n=t.constructor.name;if("string"==typeof n)return n}return e}(n)+"]";return"{ "+t.map(function(t){var e=P(n[t],r);return t+": "+e}).join(", ")+" }"}(t,n)}return String(t)}(t,e);default:return String(t)}}function F(t){var e=1",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function W(t){var e=t.value;return e?"".concat(t.kind,' "').concat(e,'"'):t.kind}function Z(t,e,n,r,i,o,a){this.kind=t,this.start=e,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=o,this.next=null}function tt(t){return isNaN(t)?z.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function et(t,e){var n=t.source,r=n.body,i=r.length,o=function(t,e,n){var r=t.length,i=e;for(;i `subscribe` option is deprecated. Use the `$subscribe` option instead."),n.$subscribe)for(var a in n.$subscribe)this.$apollo.addSmartSubscription(a,n.$subscribe[a])}}}function ve(t,e,n,r){void 0!==n&&("function"==typeof n?t.defineReactiveSetter(e,n,r):t[e]=n)}function ye(){this.$_apollo&&(this.$_apollo.destroy(),this.$_apollo=null)}function be(t,e){t.mixin(l({},"1"===e?{init:pe}:{},"2"===e?{data:function(){return{$apolloData:{queries:{},loading:0,data:this.$_apolloInitData}}},beforeCreate:function(){pe.call(this),function(){var n=this;this.$_apolloInitData={};var t=this.$options.apollo;if(t){var e=function(e){"$"!==e.charAt(0)&&(t[e].manual||fe(n.$options.props,e)||fe(n.$options.computed,e)||fe(n.$options.methods,e)||Object.defineProperty(n,e,{get:function(){return n.$data.$apolloData.data[e]},set:function(t){return n.$_apolloInitData[e]=t},enumerable:!0,configurable:!0}))};for(var r in t)e(r)}}.call(this)},serverPrefetch:function(){if(this.$_apolloPromises)return Promise.all(this.$_apolloPromises)}}:{},{created:de,destroyed:ye}))}var Ee=["$subscribe"];function me(t,e){if(!me.installed){me.installed=!0;var n=(m.Vue=t).version.substr(0,t.version.indexOf(".")),u=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,n){if(!t)return e;if(!e)return t;for(var r=Object.assign({},A(t,Ee),t.data),i=Object.assign({},A(e,Ee),e.data),o={},a=0;a.provide() is deprecated. Use the 'apolloProvider' option instead with the provider object directly."),s({},e,this)}}]),e}(),$="function"==typeof Symbol?Symbol.for("nodejs.util.inspect.custom"):void 0;function C(t){return(C="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})(t)}var L=10,D=2;function P(t,e){switch(C(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return function(t,e){if(-1!==e.indexOf(t))return"[Circular]";var n=[].concat(e,[t]);if(t){var r=function(t){var e=t[String($)];if("function"==typeof e)return e;if("function"==typeof t.inspect)return t.inspect}(t);if(void 0!==r){var i=r.call(t);if(i!==t)return"string"==typeof i?i:P(i,n)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>D)return"[Array]";for(var n=Math.min(L,t.length),r=t.length-n,i=[],o=0;oD)return"["+function(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){var n=t.constructor.name;if("string"==typeof n)return n}return e}(e)+"]";return"{ "+t.map(function(t){return t+": "+P(e[t],n)}).join(", ")+" }"}(t,n)}return String(t)}(t,e);default:return String(t)}}function F(t,e){var n=1",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Z(t){var e=t.value;return e?"".concat(t.kind,' "').concat(e,'"'):t.kind}function tt(t,e,n,r,i,o,a){this.kind=t,this.start=e,this.end=n,this.line=r,this.column=i,this.value=a,this.prev=o,this.next=null}function et(t){return isNaN(t)?W.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function nt(t,e){var n=t.source,r=n.body,i=r.length,o=function(t,e,n){var r=t.length,i=e;for(;i `subscribe` option is deprecated. Use the `$subscribe` option instead."),n.$subscribe)for(var a in n.$subscribe)this.$apollo.addSmartSubscription(a,n.$subscribe[a])}}}function ye(t,e,n,r){void 0!==n&&("function"==typeof n?t.defineReactiveSetter(e,n,r):t[e]=n)}function be(){this.$_apollo&&(this.$_apollo.destroy(),this.$_apollo=null)}function Ee(t,e){t.mixin(l({},"1"===e?{init:de}:{},"2"===e?{data:function(){return{$apolloData:{queries:{},loading:0,data:this.$_apolloInitData}}},beforeCreate:function(){de.call(this),function(){var n=this;this.$_apolloInitData={};var t=this.$options.apollo;if(t){var e=function(e){"$"!==e.charAt(0)&&(t[e].manual||pe(n.$options.props,e)||pe(n.$options.computed,e)||pe(n.$options.methods,e)||Object.defineProperty(n,e,{get:function(){return n.$data.$apolloData.data[e]},set:function(t){return n.$_apolloInitData[e]=t},enumerable:!0,configurable:!0}))};for(var r in t)e(r)}}.call(this)},serverPrefetch:function(){if(this.$_apolloPromises)return Promise.all(this.$_apolloPromises)}}:{},{created:ve,destroyed:be}))}var me=["$subscribe"];function ge(t,e){if(!ge.installed){ge.installed=!0;var n=(m.Vue=t).version.substr(0,t.version.indexOf(".")),u=t.config.optionMergeStrategies.methods;t.config.optionMergeStrategies.apollo=function(t,e,n){if(!t)return e;if(!e)return t;for(var r=Object.assign({},A(t,me),t.data),i=Object.assign({},A(e,me),e.data),o={},a=0;a=0.90.0) var customValue = customInspectFn.call(value); // check for infinite recursion @@ -1639,8 +1639,10 @@ * */ function invariant(condition, message) { + var booleanCondition = Boolean(condition); /* istanbul ignore else */ - if (!condition) { + + if (!booleanCondition) { throw new Error(message); } } @@ -1878,14 +1880,14 @@ return whitespace(len - str.length) + str; } + function _typeof$2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); } /** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. */ + function GraphQLError( // eslint-disable-line no-redeclare message, nodes, source, positions, path, originalError, extensions) { // Compute list of blame nodes. @@ -1931,7 +1933,15 @@ }, []); } - var _extensions = extensions || originalError && originalError.extensions; + var _extensions = extensions; + + if (_extensions == null && originalError != null) { + var originalExtensions = originalError.extensions; + + if (originalExtensions != null && _typeof$2(originalExtensions) === 'object') { + _extensions = originalExtensions; + } + } Object.defineProperties(this, { message: { @@ -2076,24 +2086,11 @@ // Expand a block string's raw value into independent lines. var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. - var commonIndent = null; + var commonIndent = getBlockStringIndentation(lines); - for (var i = 1; i < lines.length; i++) { - var line = lines[i]; - var indent = leadingWhitespace(line); - - if (indent < line.length && (commonIndent === null || indent < commonIndent)) { - commonIndent = indent; - - if (commonIndent === 0) { - break; - } - } - } - - if (commonIndent) { - for (var _i = 1; _i < lines.length; _i++) { - lines[_i] = lines[_i].slice(commonIndent); + if (commonIndent !== 0) { + for (var i = 1; i < lines.length; i++) { + lines[i] = lines[i].slice(commonIndent); } } // Remove leading and trailing blank lines. @@ -2108,6 +2105,29 @@ return lines.join('\n'); + } // @internal + + function getBlockStringIndentation(lines) { + var commonIndent = null; + + for (var i = 1; i < lines.length; i++) { + var line = lines[i]; + var indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + if (commonIndent === null || indent < commonIndent) { + commonIndent = indent; + + if (commonIndent === 0) { + break; + } + } + } + + return commonIndent === null ? 0 : commonIndent; } function leadingWhitespace(str) { @@ -2207,13 +2227,10 @@ BLOCK_STRING: 'BlockString', COMMENT: 'Comment' }); - /** - * The enum type representing the token kinds values. - */ - /** * A helper function to describe a token as a string for debugging */ + function getTokenDesc(token) { var value = token.value; return value ? "".concat(token.kind, " \"").concat(value, "\"") : token.kind; @@ -2637,17 +2654,19 @@ break; case 117: - // u - var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); + { + // uXXXX + var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); - if (charCode < 0) { - throw syntaxError(source, position, 'Invalid character escape sequence: ' + "\\u".concat(body.slice(position + 1, position + 5), ".")); + if (charCode < 0) { + throw syntaxError(source, position, 'Invalid character escape sequence: ' + "\\u".concat(body.slice(position + 1, position + 5), ".")); + } + + value += String.fromCharCode(charCode); + position += 4; + break; } - value += String.fromCharCode(charCode); - position += 4; - break; - default: throw syntaxError(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); } @@ -4225,7 +4244,7 @@ var start = lexer.token; var name = parseName(lexer); - if (DirectiveLocation.hasOwnProperty(name.value)) { + if (DirectiveLocation[name.value] !== undefined) { return name; } @@ -4710,7 +4729,7 @@ _result = Object.assign({}, _result); if (errors && errors.length) { - error = new Error("Apollo errors occured (".concat(errors.length, ")")); + error = new Error("Apollo errors occurred (".concat(errors.length, ")")); error.graphQLErrors = errors; } @@ -5138,7 +5157,7 @@ } ApolloProvider.install = install; // eslint-disable-next-line no-undef - ApolloProvider.version = "3.0.0-beta.30"; // Apollo provider + ApolloProvider.version = "3.0.0-rc.1"; // Apollo provider var ApolloProvider$1 = ApolloProvider; // Components diff --git a/package.json b/package.json index 0c18ee4..adf7d77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-apollo", - "version": "3.0.0-beta.30", + "version": "3.0.0-rc.1", "description": "Use Apollo and GraphQL with Vue.js", "main": "dist/vue-apollo.umd.js", "module": "dist/vue-apollo.esm.js",