react-apollo
Advanced tools
Comparing version 0.5.11 to 0.5.12
@@ -7,2 +7,6 @@ # Change log | ||
### v0.5.12 | ||
- Full support for both Apollo Client 0.4.21 and 0.5.0. [PR #277](https://github.com/apollostack/react-apollo/pull/277) | ||
### v0.5.11 | ||
@@ -9,0 +13,0 @@ |
@@ -64,3 +64,2 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var react_1 = require('react'); | ||
var flatten = require('lodash.flatten'); | ||
var pick = require('lodash.pick'); | ||
@@ -84,3 +83,11 @@ var shallowEqual_1 = require('./shallowEqual'); | ||
var defaultMapPropsToSkip = function (props) { return false; }; | ||
var observableQueryFields = function (observable) { return pick(observable, 'variables', 'refetch', 'fetchMore', 'updateQuery', 'startPolling', 'stopPolling'); }; | ||
function observableQueryFields(observable) { | ||
var fields = pick(observable, 'variables', 'refetch', 'fetchMore', 'updateQuery', 'startPolling', 'stopPolling'); | ||
Object.keys(fields).forEach(function (key) { | ||
if (typeof fields[key] === 'function') { | ||
fields[key] = fields[key].bind(observable); | ||
} | ||
}); | ||
return fields; | ||
} | ||
function getDisplayName(WrappedComponent) { | ||
@@ -129,9 +136,2 @@ return WrappedComponent.displayName || WrappedComponent.name || 'Component'; | ||
var graphQLDisplayName = "Apollo(" + getDisplayName(WrappedComponent) + ")"; | ||
function calculateFragments(fragments) { | ||
if (!fragments && !operation.fragments.length) | ||
return fragments; | ||
if (!fragments) | ||
return fragments = flatten(operation.fragments.slice()); | ||
return flatten(fragments.concat(operation.fragments)); | ||
} | ||
function calculateOptions(props, newOpts) { | ||
@@ -144,5 +144,2 @@ var opts = mapPropsToOptions(props); | ||
opts = assign({}, opts, newOpts); | ||
if (opts.fragments) { | ||
opts.fragments = calculateFragments(opts.fragments); | ||
} | ||
if (opts.variables || !operation.variables.length) | ||
@@ -304,3 +301,8 @@ return opts; | ||
if (this.querySubscription) { | ||
this.queryObservable._setOptionsNoResult(opts); | ||
if (this.queryObservable._setOptionsNoResult) { | ||
this.queryObservable._setOptionsNoResult(opts); | ||
} | ||
else { | ||
this.queryObservable.setOptions(opts); | ||
} | ||
assign(this.data, { loading: this.queryObservable.currentResult().loading }, observableQueryFields(this.queryObservable)); | ||
@@ -404,3 +406,3 @@ return; | ||
},{"./parser":4,"./shallowEqual":5,"apollo-client":6,"hoist-non-react-statics":8,"invariant":9,"lodash.flatten":10,"lodash.pick":11,"object-assign":12,"react":6}],3:[function(require,module,exports){ | ||
},{"./parser":4,"./shallowEqual":5,"apollo-client":6,"hoist-non-react-statics":8,"invariant":9,"lodash.pick":10,"object-assign":11,"react":6}],3:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -415,3 +417,3 @@ var ApolloProvider_1 = require('./ApolloProvider'); | ||
},{"./ApolloProvider":1,"./graphql":2,"recompose/compose":13}],4:[function(require,module,exports){ | ||
},{"./ApolloProvider":1,"./graphql":2,"recompose/compose":12}],4:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -785,355 +787,2 @@ var apollo_client_1 = require('apollo-client'); | ||
/** Used as references for various `Number` constants. */ | ||
var MAX_SAFE_INTEGER = 9007199254740991; | ||
/** `Object#toString` result references. */ | ||
var argsTag = '[object Arguments]', | ||
funcTag = '[object Function]', | ||
genTag = '[object GeneratorFunction]'; | ||
/** Detect free variable `global` from Node.js. */ | ||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | ||
/** Detect free variable `self`. */ | ||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | ||
/** Used as a reference to the global object. */ | ||
var root = freeGlobal || freeSelf || Function('return this')(); | ||
/** | ||
* Appends the elements of `values` to `array`. | ||
* | ||
* @private | ||
* @param {Array} array The array to modify. | ||
* @param {Array} values The values to append. | ||
* @returns {Array} Returns `array`. | ||
*/ | ||
function arrayPush(array, values) { | ||
var index = -1, | ||
length = values.length, | ||
offset = array.length; | ||
while (++index < length) { | ||
array[offset + index] = values[index]; | ||
} | ||
return array; | ||
} | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** Used to check objects for own properties. */ | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
/** | ||
* Used to resolve the | ||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objectToString = objectProto.toString; | ||
/** Built-in value references. */ | ||
var Symbol = root.Symbol, | ||
propertyIsEnumerable = objectProto.propertyIsEnumerable, | ||
spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; | ||
/** | ||
* The base implementation of `_.flatten` with support for restricting flattening. | ||
* | ||
* @private | ||
* @param {Array} array The array to flatten. | ||
* @param {number} depth The maximum recursion depth. | ||
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration. | ||
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. | ||
* @param {Array} [result=[]] The initial result value. | ||
* @returns {Array} Returns the new flattened array. | ||
*/ | ||
function baseFlatten(array, depth, predicate, isStrict, result) { | ||
var index = -1, | ||
length = array.length; | ||
predicate || (predicate = isFlattenable); | ||
result || (result = []); | ||
while (++index < length) { | ||
var value = array[index]; | ||
if (depth > 0 && predicate(value)) { | ||
if (depth > 1) { | ||
// Recursively flatten arrays (susceptible to call stack limits). | ||
baseFlatten(value, depth - 1, predicate, isStrict, result); | ||
} else { | ||
arrayPush(result, value); | ||
} | ||
} else if (!isStrict) { | ||
result[result.length] = value; | ||
} | ||
} | ||
return result; | ||
} | ||
/** | ||
* Checks if `value` is a flattenable `arguments` object or array. | ||
* | ||
* @private | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`. | ||
*/ | ||
function isFlattenable(value) { | ||
return isArray(value) || isArguments(value) || | ||
!!(spreadableSymbol && value && value[spreadableSymbol]); | ||
} | ||
/** | ||
* Flattens `array` a single level deep. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Array | ||
* @param {Array} array The array to flatten. | ||
* @returns {Array} Returns the new flattened array. | ||
* @example | ||
* | ||
* _.flatten([1, [2, [3, [4]], 5]]); | ||
* // => [1, 2, [3, [4]], 5] | ||
*/ | ||
function flatten(array) { | ||
var length = array ? array.length : 0; | ||
return length ? baseFlatten(array, 1) : []; | ||
} | ||
/** | ||
* Checks if `value` is likely an `arguments` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an `arguments` object, | ||
* else `false`. | ||
* @example | ||
* | ||
* _.isArguments(function() { return arguments; }()); | ||
* // => true | ||
* | ||
* _.isArguments([1, 2, 3]); | ||
* // => false | ||
*/ | ||
function isArguments(value) { | ||
// Safari 8.1 makes `arguments.callee` enumerable in strict mode. | ||
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && | ||
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); | ||
} | ||
/** | ||
* Checks if `value` is classified as an `Array` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an array, else `false`. | ||
* @example | ||
* | ||
* _.isArray([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isArray(document.body.children); | ||
* // => false | ||
* | ||
* _.isArray('abc'); | ||
* // => false | ||
* | ||
* _.isArray(_.noop); | ||
* // => false | ||
*/ | ||
var isArray = Array.isArray; | ||
/** | ||
* Checks if `value` is array-like. A value is considered array-like if it's | ||
* not a function and has a `value.length` that's an integer greater than or | ||
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is array-like, else `false`. | ||
* @example | ||
* | ||
* _.isArrayLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isArrayLike(document.body.children); | ||
* // => true | ||
* | ||
* _.isArrayLike('abc'); | ||
* // => true | ||
* | ||
* _.isArrayLike(_.noop); | ||
* // => false | ||
*/ | ||
function isArrayLike(value) { | ||
return value != null && isLength(value.length) && !isFunction(value); | ||
} | ||
/** | ||
* This method is like `_.isArrayLike` except that it also checks if `value` | ||
* is an object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an array-like object, | ||
* else `false`. | ||
* @example | ||
* | ||
* _.isArrayLikeObject([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isArrayLikeObject(document.body.children); | ||
* // => true | ||
* | ||
* _.isArrayLikeObject('abc'); | ||
* // => false | ||
* | ||
* _.isArrayLikeObject(_.noop); | ||
* // => false | ||
*/ | ||
function isArrayLikeObject(value) { | ||
return isObjectLike(value) && isArrayLike(value); | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Function` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a function, else `false`. | ||
* @example | ||
* | ||
* _.isFunction(_); | ||
* // => true | ||
* | ||
* _.isFunction(/abc/); | ||
* // => false | ||
*/ | ||
function isFunction(value) { | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in Safari 8-9 which returns 'object' for typed array and other constructors. | ||
var tag = isObject(value) ? objectToString.call(value) : ''; | ||
return tag == funcTag || tag == genTag; | ||
} | ||
/** | ||
* Checks if `value` is a valid array-like length. | ||
* | ||
* **Note:** This method is loosely based on | ||
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`. | ||
* @example | ||
* | ||
* _.isLength(3); | ||
* // => true | ||
* | ||
* _.isLength(Number.MIN_VALUE); | ||
* // => false | ||
* | ||
* _.isLength(Infinity); | ||
* // => false | ||
* | ||
* _.isLength('3'); | ||
* // => false | ||
*/ | ||
function isLength(value) { | ||
return typeof value == 'number' && | ||
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | ||
} | ||
/** | ||
* Checks if `value` is the | ||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) | ||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is an object, else `false`. | ||
* @example | ||
* | ||
* _.isObject({}); | ||
* // => true | ||
* | ||
* _.isObject([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObject(_.noop); | ||
* // => true | ||
* | ||
* _.isObject(null); | ||
* // => false | ||
*/ | ||
function isObject(value) { | ||
var type = typeof value; | ||
return !!value && (type == 'object' || type == 'function'); | ||
} | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return !!value && typeof value == 'object'; | ||
} | ||
module.exports = flatten; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],11:[function(require,module,exports){ | ||
(function (global){ | ||
/** | ||
* lodash (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
* Released under MIT license <https://lodash.com/license> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
*/ | ||
/** Used as references for various `Number` constants. */ | ||
var INFINITY = 1 / 0, | ||
@@ -1634,3 +1283,3 @@ MAX_SAFE_INTEGER = 9007199254740991; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],12:[function(require,module,exports){ | ||
},{}],11:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -1720,3 +1369,3 @@ /* eslint-disable no-unused-vars */ | ||
},{}],13:[function(require,module,exports){ | ||
},{}],12:[function(require,module,exports){ | ||
"use strict"; | ||
@@ -1723,0 +1372,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function t(e,n,r){function o(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){"use strict";var r=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},o=t("react"),i=t("react"),a=t("invariant"),u=function(t){function e(e,n){return t.call(this,e,n),a(e.client,'ApolloClient was not passed a client instance. Make sure you pass in your client via the "client" prop.'),this.client=e.client,e.store?(this.store=e.store,void(e.immutable&&e.client.initStore())):(e.client.initStore(),void(this.store=e.client.store))}return r(e,t),e.prototype.getChildContext=function(){return{store:this.store,client:this.client}},e.prototype.render=function(){return o.Children.only(this.props.children)},e.propTypes={store:i.PropTypes.shape({subscribe:i.PropTypes.func.isRequired,dispatch:i.PropTypes.func.isRequired,getState:i.PropTypes.func.isRequired}),client:i.PropTypes.object.isRequired,immutable:i.PropTypes.bool,children:i.PropTypes.element.isRequired},e.childContextTypes={store:i.PropTypes.object.isRequired,client:i.PropTypes.object.isRequired},e}(i.Component);Object.defineProperty(n,"__esModule",{value:!0}),n.default=u},{invariant:9,react:6}],2:[function(t,e,n){"use strict";function r(t){return t.displayName||t.name||"Component"}function o(t){var e="withApollo("+r(t)+")",n=function(n){function r(t,r){n.call(this,t,r),this.client=r.client,p(!!this.client,'Could not find "client" in the context of '+('"'+e+'". ')+"Wrap the root component in an <ApolloProvider>")}return a(r,n),r.prototype.render=function(){var e=f({},this.props);return e.client=this.client,u.createElement(t,e)},r.displayName=e,r.WrappedComponent=t,r.contextTypes={client:u.PropTypes.object.isRequired},r}(u.Component);return h(n,t,{fetchData:!0})}function i(t,e){void 0===e&&(e={});var n=e.options,o=void 0===n?m:n,i=e.skip,c=void 0===i?O:i,T=o;"function"!=typeof T&&(T=function(){return o});var P=c;"function"!=typeof P&&(P=function(){return c});var q=e.props,D=y.parser(t),C=j++;return function(n){function o(t){return t||D.fragments.length?t?s(t.concat(D.fragments)):t=s(D.fragments.slice()):t}function i(t,e){var i=T(t);if(e&&e.variables&&(e.variables=f({},i.variables,e.variables)),e&&(i=f({},i,e)),i.fragments&&(i.fragments=o(i.fragments)),i.variables||!D.variables.length)return i;for(var a={},u=0,s=D.variables;u<s.length;u++){var c=s[u],l=c.variable,h=c.type;l.name&&l.name.value&&("undefined"==typeof t[l.name.value]?"NonNullType"===h.kind?p("undefined"!=typeof t[l.name.value],"The operation '"+D.name+"' wrapping '"+r(n)+"' "+("is expecting a variable: '"+l.name.value+"' but it was not found in the props ")+("passed to '"+m+"'")):a[l.name.value]=null:a[l.name.value]=t[l.name.value])}return i.variables=a,i}function c(e,n){var r=n.client;if(P(e))return!1;if(D.type===y.DocumentType.Mutation||D.type===y.DocumentType.Subscription)return!1;var o=i(e);if(o.ssr===!1||o.skip)return!1;var a=r.watchQuery(f({query:t},o)),u=a.currentResult();return!!u.loading&&a.result()}var m="Apollo("+r(n)+")",O=function(r){function o(t,e){r.call(this,t,e),this.data={},this.version=C,this.client=e.client,p(!!this.client,'Could not find "client" in the context of '+('"'+m+'". ')+"Wrap the root component in an <ApolloProvider>"),this.store=this.client.store,this.type=D.type,P(t)||this.setInitialProps()}return a(o,r),o.prototype.componentDidMount=function(){this.hasMounted=!0,this.type!==y.DocumentType.Mutation&&(P(this.props)||this.subscribeToQuery(this.props))},o.prototype.componentWillReceiveProps=function(t){if(P(t))return void(P(this.props)||(this.data=f({},v),this.unsubscribeFromQuery()));if(!l.default(this.props,t)){if(this.type===y.DocumentType.Mutation)return void this.createWrappedMutation(t,!0);this.haveOwnPropsChanged=!0,this.subscribeToQuery(t)}},o.prototype.shouldComponentUpdate=function(t,e,n){return!!n||this.haveOwnPropsChanged||this.hasOperationDataChanged},o.prototype.componentWillUnmount=function(){this.type===y.DocumentType.Query&&this.unsubscribeFromQuery(),this.type===y.DocumentType.Subscription&&this.unsubscribeFromQuery(),this.hasMounted=!1},o.prototype.calculateOptions=function(t,e){return i(t,e)},o.prototype.calculateResultProps=function(t){var n=this.type===y.DocumentType.Mutation?"mutate":"data";e.name&&(n=e.name);var r=(o={},o[n]=t,o.ownProps=this.props,o);return q?q(r):(i={},i[n]=g(t),i);var o,i},o.prototype.setInitialProps=function(){if(this.type===y.DocumentType.Mutation)return this.createWrappedMutation(this.props);var t=this.calculateOptions(this.props);t.skip?this.data=f({},v):(this.data=f({},b),this.createQuery(t))},o.prototype.createQuery=function(e){this.type===y.DocumentType.Subscription?this.queryObservable=this.client.subscribe(f({query:t},e)):this.queryObservable=this.client.watchQuery(f({query:t},e)),this.initializeData(e)},o.prototype.initializeData=function(t){if(f(this.data,w(this.queryObservable)),this.type===y.DocumentType.Subscription)t=this.calculateOptions(this.props,t),f(this.data,{loading:!0},{variables:t.variables});else if(t.forceFetch)f(this.data,{loading:!0});else{var e=this.queryObservable.currentResult();f(this.data,e.data,{loading:e.loading})}},o.prototype.subscribeToQuery=function(t){var e=this,n=i(t);if(n.skip)return void(this.querySubscription&&(this.hasOperationDataChanged=!0,this.data=f({},v),this.unsubscribeFromQuery(),this.forceRenderChildren()));if(this.querySubscription)return this.queryObservable._setOptionsNoResult(n),void f(this.data,{loading:this.queryObservable.currentResult().loading},w(this.queryObservable));this.queryObservable?this.data.refetch||this.initializeData(n):this.createQuery(n);var r=function(t){e.type===y.DocumentType.Subscription&&(t={data:t,loading:!1,error:null});var n=t.data,r=t.loading,o=t.error,i=void 0===o?null:o,a=Object.keys(w(n));p(0===a.length,"the result of the '"+m+"' operation contains keys that conflict with the return object."+a.map(function(t){return"'"+t+"'"}).join(", ")+" not allowed."),e.hasOperationDataChanged=!0,e.data=f({loading:r,error:i},n,w(e.queryObservable)),e.forceRenderChildren()},o=function(t){if(t instanceof d.ApolloError)return r({error:t});throw t};this.querySubscription=this.queryObservable.subscribe({next:r,error:o})},o.prototype.unsubscribeFromQuery=function(){this.querySubscription&&(this.querySubscription.unsubscribe(),delete this.querySubscription)},o.prototype.forceRenderChildren=function(){this.hasMounted&&this.setState({})},o.prototype.getWrappedInstance=function(){return p(e.withRef,"To access the wrapped instance, you need to specify { withRef: true } in the options"),this.refs.wrappedInstance},o.prototype.createWrappedMutation=function(e,n){var r=this;void 0===n&&(n=!1),this.type===y.DocumentType.Mutation&&(this.data=function(n){return n=r.calculateOptions(e,n),"undefined"==typeof n.variables&&delete n.variables,n.mutation=t,r.client.mutate(n)},n&&(this.hasOperationDataChanged=!0,this.forceRenderChildren()))},o.prototype.render=function(){if(P(this.props))return u.createElement(n,this.props);var t=this,r=t.haveOwnPropsChanged,o=t.hasOperationDataChanged,i=t.renderedElement,a=t.props,s=t.data;this.haveOwnPropsChanged=!1,this.hasOperationDataChanged=!1;var c=this.calculateResultProps(s),l=f({},a,c);return r||o||!i?(e.withRef&&(l.ref="wrappedInstance"),this.renderedElement=u.createElement(n,l),this.renderedElement):i},o.displayName=m,o.WrappedComponent=n,o.contextTypes={store:u.PropTypes.object.isRequired,client:u.PropTypes.object.isRequired},o.fragments=D.fragments,o}(u.Component);return D.type===y.DocumentType.Query&&(O.fetchData=c),h(O,n,{fetchData:!0})}}var a=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},u=t("react"),s=t("lodash.flatten"),c=t("lodash.pick"),l=t("./shallowEqual"),p=t("invariant"),f=t("object-assign"),h=t("hoist-non-react-statics"),d=t("apollo-client"),y=t("./parser"),b={loading:!0,error:null},v={loading:!1,error:null},m=function(t){return{}},g=function(t){return t},O=function(t){return!1},w=function(t){return c(t,"variables","refetch","fetchMore","updateQuery","startPolling","stopPolling")},j=0;n.withApollo=o,Object.defineProperty(n,"__esModule",{value:!0}),n.default=i},{"./parser":4,"./shallowEqual":5,"apollo-client":6,"hoist-non-react-statics":8,invariant:9,"lodash.flatten":10,"lodash.pick":11,"object-assign":12,react:6}],3:[function(t,e,n){"use strict";var r=t("./ApolloProvider");n.ApolloProvider=r.default;var o=t("./graphql");n.graphql=o.default,n.withApollo=o.withApollo;var i=t("recompose/compose");n.compose=i.default},{"./ApolloProvider":1,"./graphql":2,"recompose/compose":13}],4:[function(t,e,n){"use strict";function r(t){var e,n,r,u,s,c,l,p;i(!!t||!!t.kind,"Argument of "+t+" passed to parser was not a valid GraphQL Document. You may need to use 'graphql-tag' or another method to convert your operation into a document"),e=t.definitions.filter(function(t){return"FragmentDefinition"===t.kind}),e=o.createFragment({kind:"Document",definitions:e.slice()}),n=t.definitions.filter(function(t){return"OperationDefinition"===t.kind&&"query"===t.operation}),r=t.definitions.filter(function(t){return"OperationDefinition"===t.kind&&"mutation"===t.operation}),u=t.definitions.filter(function(t){return"OperationDefinition"===t.kind&&"subscription"===t.operation}),!e.length||n.length&&r.length&&u.length||i(!0,"Passing only a fragment to 'graphql' is not yet supported. You must include a query, subscription or mutation as well"),n.length&&r.length&&r.length&&i(n.length+r.length+r.length>1,"react-apollo only supports a query, subscription, or a mutation per HOC. "+t+" had "+n.length+" queries, "+u.length+" subscriptions and "+r.length+" muations. You can use 'compose' to join multiple operation types to a component"),l=n.length?a.Query:a.Mutation,n.length||r.length||(l=a.Subscription),c=n.length?n:r,n.length||r.length||(c=u),1!==c.length&&i(1!==c.length,"react-apollo only supports one defintion per HOC. "+t+" had "+c.length+" definitions. You can use 'compose' to join multiple operation types to a component"),s=c[0].variableDefinitions||[];var f=c[0].name&&"Name"===c[0].name.kind;return p=f?c[0].name.value:"data",e=e.length?e:[],{name:p,type:l,variables:s,fragments:e}}var o=t("apollo-client"),i=t("invariant");!function(t){t[t.Query=0]="Query",t[t.Mutation=1]="Mutation",t[t.Subscription=2]="Subscription"}(n.DocumentType||(n.DocumentType={}));var a=n.DocumentType;n.parser=r},{"apollo-client":6,invariant:9}],5:[function(t,e,n){"use strict";function r(t,e){if(!t||!e)return!0;if(t===e)return!0;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty,i=0;i<n.length;i++)if(!o.call(e,n[i])||t[n[i]]!==e[n[i]])return!1;return!0}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r},{}],6:[function(t,e,n){},{}],7:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(p===setTimeout)return setTimeout(t,0);if((p===r||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function a(t){if(f===clearTimeout)return clearTimeout(t);if((f===o||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function u(){b&&d&&(b=!1,d.length?y=d.concat(y):v=-1,y.length&&s())}function s(){if(!b){var t=i(u);b=!0;for(var e=y.length;e;){for(d=y,y=[];++v<e;)d&&d[v].run();v=-1,e=y.length}d=null,b=!1,a(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var p,f,h=e.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:r}catch(t){p=r}try{f="function"==typeof clearTimeout?clearTimeout:o}catch(t){f=o}}();var d,y=[],b=!1,v=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];y.push(new c(t,e)),1!==y.length||b||i(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],8:[function(t,e,n){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},i="function"==typeof Object.getOwnPropertySymbols;e.exports=function(t,e,n){if("string"!=typeof e){var a=Object.getOwnPropertyNames(e);i&&(a=a.concat(Object.getOwnPropertySymbols(e)));for(var u=0;u<a.length;++u)if(!(r[a[u]]||o[a[u]]||n&&n[a[u]]))try{t[a[u]]=e[a[u]]}catch(t){}}return t}},{}],9:[function(t,e,n){(function(t){"use strict";var n=function(e,n,r,o,i,a,u,s){if("production"!==t.env.NODE_ENV&&void 0===n)throw new Error("invariant requires an error message argument");if(!e){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,o,i,a,u,s],p=0;c=new Error(n.replace(/%s/g,function(){return l[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};e.exports=n}).call(this,t("_process"))},{_process:7}],10:[function(t,e,n){(function(t){function n(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function r(t,e,i,a,u){var s=-1,c=t.length;for(i||(i=o),u||(u=[]);++s<c;){var l=t[s];e>0&&i(l)?e>1?r(l,e-1,i,a,u):n(u,l):a||(u[u.length]=l)}return u}function o(t){return D(t)||a(t)||!!(q&&t&&t[q])}function i(t){var e=t?t.length:0;return e?r(t,1):[]}function a(t){return s(t)&&w.call(t,"callee")&&(!P.call(t,"callee")||j.call(t)==d)}function u(t){return null!=t&&l(t.length)&&!c(t)}function s(t){return f(t)&&u(t)}function c(t){var e=p(t)?j.call(t):"";return e==y||e==b}function l(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function p(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function f(t){return!!t&&"object"==typeof t}var h=9007199254740991,d="[object Arguments]",y="[object Function]",b="[object GeneratorFunction]",v="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,g=v||m||Function("return this")(),O=Object.prototype,w=O.hasOwnProperty,j=O.toString,T=g.Symbol,P=O.propertyIsEnumerable,q=T?T.isConcatSpreadable:void 0,D=Array.isArray;e.exports=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(t,e,n){(function(t){function n(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function r(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function o(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function i(t,e,n,r,a){var u=-1,s=t.length;for(n||(n=c),a||(a=[]);++u<s;){var l=t[u];e>0&&n(l)?e>1?i(l,e-1,n,r,a):o(a,l):r||(a[a.length]=l)}return a}function a(t,e){return t=Object(t),u(t,e,function(e,n){return n in t})}function u(t,e,n){for(var r=-1,o=e.length,i={};++r<o;){var a=e[r],u=t[a];n(u,a)&&(i[a]=u)}return i}function s(t,e){return e=R(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=R(r.length-e,0),a=Array(i);++o<i;)a[o]=r[e+o];o=-1;for(var u=Array(e+1);++o<e;)u[o]=r[o];return u[e]=a,n(t,this,u)}}function c(t){return Q(t)||p(t)||!!(k&&t&&t[k])}function l(t){if("string"==typeof t||m(t))return t;var e=t+"";return"0"==e&&1/t==-g?"-0":e}function p(t){return h(t)&&x.call(t,"callee")&&(!M.call(t,"callee")||A.call(t)==w)}function f(t){return null!=t&&y(t.length)&&!d(t)}function h(t){return v(t)&&f(t)}function d(t){var e=b(t)?A.call(t):"";return e==j||e==T}function y(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=O}function b(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function v(t){return!!t&&"object"==typeof t}function m(t){return"symbol"==typeof t||v(t)&&A.call(t)==P}var g=1/0,O=9007199254740991,w="[object Arguments]",j="[object Function]",T="[object GeneratorFunction]",P="[object Symbol]",q="object"==typeof t&&t&&t.Object===Object&&t,D="object"==typeof self&&self&&self.Object===Object&&self,C=q||D||Function("return this")(),S=Object.prototype,x=S.hasOwnProperty,A=S.toString,E=C.Symbol,M=S.propertyIsEnumerable,k=E?E.isConcatSpreadable:void 0,R=Math.max,Q=Array.isArray,_=s(function(t,e){return null==t?{}:a(t,r(i(e,1),l))});e.exports=_}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],12:[function(t,e,n){"use strict";function r(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var n,o,u=r(t),s=1;s<arguments.length;s++){n=Object(arguments[s]);for(var c in n)i.call(n,c)&&(u[c]=n[c]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(n);for(var l=0;l<o.length;l++)a.call(n,o[l])&&(u[o[l]]=n[o[l]])}}return u}},{}],13:[function(t,e,n){"use strict";function r(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)return function(t){return t};if(1===e.length)return e[0];var r=e[e.length-1];return function(){for(var t=r.apply(void 0,arguments),n=e.length-2;n>=0;n--){var o=e[n];t=o(t)}return t}}n.__esModule=!0,n.default=r},{}]},{},[3]); | ||
!function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){"use strict";var r=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},o=t("react"),i=t("react"),a=t("invariant"),s=function(t){function e(e,n){return t.call(this,e,n),a(e.client,'ApolloClient was not passed a client instance. Make sure you pass in your client via the "client" prop.'),this.client=e.client,e.store?(this.store=e.store,void(e.immutable&&e.client.initStore())):(e.client.initStore(),void(this.store=e.client.store))}return r(e,t),e.prototype.getChildContext=function(){return{store:this.store,client:this.client}},e.prototype.render=function(){return o.Children.only(this.props.children)},e.propTypes={store:i.PropTypes.shape({subscribe:i.PropTypes.func.isRequired,dispatch:i.PropTypes.func.isRequired,getState:i.PropTypes.func.isRequired}),client:i.PropTypes.object.isRequired,immutable:i.PropTypes.bool,children:i.PropTypes.element.isRequired},e.childContextTypes={store:i.PropTypes.object.isRequired,client:i.PropTypes.object.isRequired},e}(i.Component);Object.defineProperty(n,"__esModule",{value:!0}),n.default=s},{invariant:9,react:6}],2:[function(t,e,n){"use strict";function r(t){var e=c(t,"variables","refetch","fetchMore","updateQuery","startPolling","stopPolling");return Object.keys(e).forEach(function(n){"function"==typeof e[n]&&(e[n]=e[n].bind(t))}),e}function o(t){return t.displayName||t.name||"Component"}function i(t){var e="withApollo("+o(t)+")",n=function(n){function r(t,r){n.call(this,t,r),this.client=r.client,p(!!this.client,'Could not find "client" in the context of '+('"'+e+'". ')+"Wrap the root component in an <ApolloProvider>")}return s(r,n),r.prototype.render=function(){var e=f({},this.props);return e.client=this.client,u.createElement(t,e)},r.displayName=e,r.WrappedComponent=t,r.contextTypes={client:u.PropTypes.object.isRequired},r}(u.Component);return h(n,t,{fetchData:!0})}function a(t,e){void 0===e&&(e={});var n=e.options,i=void 0===n?m:n,a=e.skip,c=void 0===a?O:a,T=i;"function"!=typeof T&&(T=function(){return i});var j=c;"function"!=typeof j&&(j=function(){return c});var q=e.props,P=y.parser(t),D=w++;return function(n){function i(t,e){var r=T(t);if(e&&e.variables&&(e.variables=f({},r.variables,e.variables)),e&&(r=f({},r,e)),r.variables||!P.variables.length)return r;for(var i={},a=0,s=P.variables;a<s.length;a++){var u=s[a],l=u.variable,h=u.type;l.name&&l.name.value&&("undefined"==typeof t[l.name.value]?"NonNullType"===h.kind?p("undefined"!=typeof t[l.name.value],"The operation '"+P.name+"' wrapping '"+o(n)+"' "+("is expecting a variable: '"+l.name.value+"' but it was not found in the props ")+("passed to '"+c+"'")):i[l.name.value]=null:i[l.name.value]=t[l.name.value])}return r.variables=i,r}function a(e,n){var r=n.client;if(j(e))return!1;if(P.type===y.DocumentType.Mutation||P.type===y.DocumentType.Subscription)return!1;var o=i(e);if(o.ssr===!1||o.skip)return!1;var a=r.watchQuery(f({query:t},o)),s=a.currentResult();return!!s.loading&&a.result()}var c="Apollo("+o(n)+")",m=function(o){function a(t,e){o.call(this,t,e),this.data={},this.version=D,this.client=e.client,p(!!this.client,'Could not find "client" in the context of '+('"'+c+'". ')+"Wrap the root component in an <ApolloProvider>"),this.store=this.client.store,this.type=P.type,j(t)||this.setInitialProps()}return s(a,o),a.prototype.componentDidMount=function(){this.hasMounted=!0,this.type!==y.DocumentType.Mutation&&(j(this.props)||this.subscribeToQuery(this.props))},a.prototype.componentWillReceiveProps=function(t){if(j(t))return void(j(this.props)||(this.data=f({},b),this.unsubscribeFromQuery()));if(!l.default(this.props,t)){if(this.type===y.DocumentType.Mutation)return void this.createWrappedMutation(t,!0);this.haveOwnPropsChanged=!0,this.subscribeToQuery(t)}},a.prototype.shouldComponentUpdate=function(t,e,n){return!!n||this.haveOwnPropsChanged||this.hasOperationDataChanged},a.prototype.componentWillUnmount=function(){this.type===y.DocumentType.Query&&this.unsubscribeFromQuery(),this.type===y.DocumentType.Subscription&&this.unsubscribeFromQuery(),this.hasMounted=!1},a.prototype.calculateOptions=function(t,e){return i(t,e)},a.prototype.calculateResultProps=function(t){var n=this.type===y.DocumentType.Mutation?"mutate":"data";e.name&&(n=e.name);var r=(o={},o[n]=t,o.ownProps=this.props,o);return q?q(r):(i={},i[n]=g(t),i);var o,i},a.prototype.setInitialProps=function(){if(this.type===y.DocumentType.Mutation)return this.createWrappedMutation(this.props);var t=this.calculateOptions(this.props);t.skip?this.data=f({},b):(this.data=f({},v),this.createQuery(t))},a.prototype.createQuery=function(e){this.type===y.DocumentType.Subscription?this.queryObservable=this.client.subscribe(f({query:t},e)):this.queryObservable=this.client.watchQuery(f({query:t},e)),this.initializeData(e)},a.prototype.initializeData=function(t){if(f(this.data,r(this.queryObservable)),this.type===y.DocumentType.Subscription)t=this.calculateOptions(this.props,t),f(this.data,{loading:!0},{variables:t.variables});else if(t.forceFetch)f(this.data,{loading:!0});else{var e=this.queryObservable.currentResult();f(this.data,e.data,{loading:e.loading})}},a.prototype.subscribeToQuery=function(t){var e=this,n=i(t);if(n.skip)return void(this.querySubscription&&(this.hasOperationDataChanged=!0,this.data=f({},b),this.unsubscribeFromQuery(),this.forceRenderChildren()));if(this.querySubscription)return this.queryObservable._setOptionsNoResult?this.queryObservable._setOptionsNoResult(n):this.queryObservable.setOptions(n),void f(this.data,{loading:this.queryObservable.currentResult().loading},r(this.queryObservable));this.queryObservable?this.data.refetch||this.initializeData(n):this.createQuery(n);var o=function(t){e.type===y.DocumentType.Subscription&&(t={data:t,loading:!1,error:null});var n=t.data,o=t.loading,i=t.error,a=void 0===i?null:i,s=Object.keys(r(n));p(0===s.length,"the result of the '"+c+"' operation contains keys that conflict with the return object."+s.map(function(t){return"'"+t+"'"}).join(", ")+" not allowed."),e.hasOperationDataChanged=!0,e.data=f({loading:o,error:a},n,r(e.queryObservable)),e.forceRenderChildren()},a=function(t){if(t instanceof d.ApolloError)return o({error:t});throw t};this.querySubscription=this.queryObservable.subscribe({next:o,error:a})},a.prototype.unsubscribeFromQuery=function(){this.querySubscription&&(this.querySubscription.unsubscribe(),delete this.querySubscription)},a.prototype.forceRenderChildren=function(){this.hasMounted&&this.setState({})},a.prototype.getWrappedInstance=function(){return p(e.withRef,"To access the wrapped instance, you need to specify { withRef: true } in the options"),this.refs.wrappedInstance},a.prototype.createWrappedMutation=function(e,n){var r=this;void 0===n&&(n=!1),this.type===y.DocumentType.Mutation&&(this.data=function(n){return n=r.calculateOptions(e,n),"undefined"==typeof n.variables&&delete n.variables,n.mutation=t,r.client.mutate(n)},n&&(this.hasOperationDataChanged=!0,this.forceRenderChildren()))},a.prototype.render=function(){if(j(this.props))return u.createElement(n,this.props);var t=this,r=t.haveOwnPropsChanged,o=t.hasOperationDataChanged,i=t.renderedElement,a=t.props,s=t.data;this.haveOwnPropsChanged=!1,this.hasOperationDataChanged=!1;var c=this.calculateResultProps(s),l=f({},a,c);return r||o||!i?(e.withRef&&(l.ref="wrappedInstance"),this.renderedElement=u.createElement(n,l),this.renderedElement):i},a.displayName=c,a.WrappedComponent=n,a.contextTypes={store:u.PropTypes.object.isRequired,client:u.PropTypes.object.isRequired},a.fragments=P.fragments,a}(u.Component);return P.type===y.DocumentType.Query&&(m.fetchData=a),h(m,n,{fetchData:!0})}}var s=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},u=t("react"),c=t("lodash.pick"),l=t("./shallowEqual"),p=t("invariant"),f=t("object-assign"),h=t("hoist-non-react-statics"),d=t("apollo-client"),y=t("./parser"),v={loading:!0,error:null},b={loading:!1,error:null},m=function(t){return{}},g=function(t){return t},O=function(t){return!1},w=0;n.withApollo=i,Object.defineProperty(n,"__esModule",{value:!0}),n.default=a},{"./parser":4,"./shallowEqual":5,"apollo-client":6,"hoist-non-react-statics":8,invariant:9,"lodash.pick":10,"object-assign":11,react:6}],3:[function(t,e,n){"use strict";var r=t("./ApolloProvider");n.ApolloProvider=r.default;var o=t("./graphql");n.graphql=o.default,n.withApollo=o.withApollo;var i=t("recompose/compose");n.compose=i.default},{"./ApolloProvider":1,"./graphql":2,"recompose/compose":12}],4:[function(t,e,n){"use strict";function r(t){var e,n,r,s,u,c,l,p;i(!!t||!!t.kind,"Argument of "+t+" passed to parser was not a valid GraphQL Document. You may need to use 'graphql-tag' or another method to convert your operation into a document"),e=t.definitions.filter(function(t){return"FragmentDefinition"===t.kind}),e=o.createFragment({kind:"Document",definitions:e.slice()}),n=t.definitions.filter(function(t){return"OperationDefinition"===t.kind&&"query"===t.operation}),r=t.definitions.filter(function(t){return"OperationDefinition"===t.kind&&"mutation"===t.operation}),s=t.definitions.filter(function(t){return"OperationDefinition"===t.kind&&"subscription"===t.operation}),!e.length||n.length&&r.length&&s.length||i(!0,"Passing only a fragment to 'graphql' is not yet supported. You must include a query, subscription or mutation as well"),n.length&&r.length&&r.length&&i(n.length+r.length+r.length>1,"react-apollo only supports a query, subscription, or a mutation per HOC. "+t+" had "+n.length+" queries, "+s.length+" subscriptions and "+r.length+" muations. You can use 'compose' to join multiple operation types to a component"),l=n.length?a.Query:a.Mutation,n.length||r.length||(l=a.Subscription),c=n.length?n:r,n.length||r.length||(c=s),1!==c.length&&i(1!==c.length,"react-apollo only supports one defintion per HOC. "+t+" had "+c.length+" definitions. You can use 'compose' to join multiple operation types to a component"),u=c[0].variableDefinitions||[];var f=c[0].name&&"Name"===c[0].name.kind;return p=f?c[0].name.value:"data",e=e.length?e:[],{name:p,type:l,variables:u,fragments:e}}var o=t("apollo-client"),i=t("invariant");!function(t){t[t.Query=0]="Query",t[t.Mutation=1]="Mutation",t[t.Subscription=2]="Subscription"}(n.DocumentType||(n.DocumentType={}));var a=n.DocumentType;n.parser=r},{"apollo-client":6,invariant:9}],5:[function(t,e,n){"use strict";function r(t,e){if(!t||!e)return!0;if(t===e)return!0;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty,i=0;i<n.length;i++)if(!o.call(e,n[i])||t[n[i]]!==e[n[i]])return!1;return!0}Object.defineProperty(n,"__esModule",{value:!0}),n.default=r},{}],6:[function(t,e,n){},{}],7:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(p===setTimeout)return setTimeout(t,0);if((p===r||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function a(t){if(f===clearTimeout)return clearTimeout(t);if((f===o||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function s(){v&&d&&(v=!1,d.length?y=d.concat(y):b=-1,y.length&&u())}function u(){if(!v){var t=i(s);v=!0;for(var e=y.length;e;){for(d=y,y=[];++b<e;)d&&d[b].run();b=-1,e=y.length}d=null,v=!1,a(t)}}function c(t,e){this.fun=t,this.array=e}function l(){}var p,f,h=e.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:r}catch(t){p=r}try{f="function"==typeof clearTimeout?clearTimeout:o}catch(t){f=o}}();var d,y=[],v=!1,b=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];y.push(new c(t,e)),1!==y.length||v||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],8:[function(t,e,n){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},i="function"==typeof Object.getOwnPropertySymbols;e.exports=function(t,e,n){if("string"!=typeof e){var a=Object.getOwnPropertyNames(e);i&&(a=a.concat(Object.getOwnPropertySymbols(e)));for(var s=0;s<a.length;++s)if(!(r[a[s]]||o[a[s]]||n&&n[a[s]]))try{t[a[s]]=e[a[s]]}catch(t){}}return t}},{}],9:[function(t,e,n){(function(t){"use strict";var n=function(e,n,r,o,i,a,s,u){if("production"!==t.env.NODE_ENV&&void 0===n)throw new Error("invariant requires an error message argument");if(!e){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,o,i,a,s,u],p=0;c=new Error(n.replace(/%s/g,function(){return l[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}};e.exports=n}).call(this,t("_process"))},{_process:7}],10:[function(t,e,n){(function(t){function n(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function r(t,e){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function o(t,e){for(var n=-1,r=e.length,o=t.length;++n<r;)t[o+n]=e[n];return t}function i(t,e,n,r,a){var s=-1,u=t.length;for(n||(n=c),a||(a=[]);++s<u;){var l=t[s];e>0&&n(l)?e>1?i(l,e-1,n,r,a):o(a,l):r||(a[a.length]=l)}return a}function a(t,e){return t=Object(t),s(t,e,function(e,n){return n in t})}function s(t,e,n){for(var r=-1,o=e.length,i={};++r<o;){var a=e[r],s=t[a];n(s,a)&&(i[a]=s)}return i}function u(t,e){return e=A(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=A(r.length-e,0),a=Array(i);++o<i;)a[o]=r[e+o];o=-1;for(var s=Array(e+1);++o<e;)s[o]=r[o];return s[e]=a,n(t,this,s)}}function c(t){return Q(t)||p(t)||!!(R&&t&&t[R])}function l(t){if("string"==typeof t||m(t))return t;var e=t+"";return"0"==e&&1/t==-g?"-0":e}function p(t){return h(t)&&k.call(t,"callee")&&(!M.call(t,"callee")||x.call(t)==w)}function f(t){return null!=t&&y(t.length)&&!d(t)}function h(t){return b(t)&&f(t)}function d(t){var e=v(t)?x.call(t):"";return e==T||e==j}function y(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=O}function v(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function b(t){return!!t&&"object"==typeof t}function m(t){return"symbol"==typeof t||b(t)&&x.call(t)==q}var g=1/0,O=9007199254740991,w="[object Arguments]",T="[object Function]",j="[object GeneratorFunction]",q="[object Symbol]",P="object"==typeof t&&t&&t.Object===Object&&t,D="object"==typeof self&&self&&self.Object===Object&&self,C=P||D||Function("return this")(),S=Object.prototype,k=S.hasOwnProperty,x=S.toString,E=C.Symbol,M=S.propertyIsEnumerable,R=E?E.isConcatSpreadable:void 0,A=Math.max,Q=Array.isArray,_=u(function(t,e){return null==t?{}:a(t,r(i(e,1),l))});e.exports=_}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(t,e,n){"use strict";function r(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function o(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(t){o[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(t){return!1}}var i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=o()?Object.assign:function(t,e){for(var n,o,s=r(t),u=1;u<arguments.length;u++){n=Object(arguments[u]);for(var c in n)i.call(n,c)&&(s[c]=n[c]);if(Object.getOwnPropertySymbols){o=Object.getOwnPropertySymbols(n);for(var l=0;l<o.length;l++)a.call(n,o[l])&&(s[o[l]]=n[o[l]])}}return s}},{}],12:[function(t,e,n){"use strict";function r(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)return function(t){return t};if(1===e.length)return e[0];var r=e[e.length-1];return function(){for(var t=r.apply(void 0,arguments),n=e.length-2;n>=0;n--){var o=e[n];t=o(t)}return t}}n.__esModule=!0,n.default=r},{}]},{},[3]); |
@@ -8,3 +8,2 @@ "use strict"; | ||
var react_1 = require('react'); | ||
var flatten = require('lodash.flatten'); | ||
var pick = require('lodash.pick'); | ||
@@ -28,3 +27,11 @@ var shallowEqual_1 = require('./shallowEqual'); | ||
var defaultMapPropsToSkip = function (props) { return false; }; | ||
var observableQueryFields = function (observable) { return pick(observable, 'variables', 'refetch', 'fetchMore', 'updateQuery', 'startPolling', 'stopPolling'); }; | ||
function observableQueryFields(observable) { | ||
var fields = pick(observable, 'variables', 'refetch', 'fetchMore', 'updateQuery', 'startPolling', 'stopPolling'); | ||
Object.keys(fields).forEach(function (key) { | ||
if (typeof fields[key] === 'function') { | ||
fields[key] = fields[key].bind(observable); | ||
} | ||
}); | ||
return fields; | ||
} | ||
function getDisplayName(WrappedComponent) { | ||
@@ -73,9 +80,2 @@ return WrappedComponent.displayName || WrappedComponent.name || 'Component'; | ||
var graphQLDisplayName = "Apollo(" + getDisplayName(WrappedComponent) + ")"; | ||
function calculateFragments(fragments) { | ||
if (!fragments && !operation.fragments.length) | ||
return fragments; | ||
if (!fragments) | ||
return fragments = flatten(operation.fragments.slice()); | ||
return flatten(fragments.concat(operation.fragments)); | ||
} | ||
function calculateOptions(props, newOpts) { | ||
@@ -88,5 +88,2 @@ var opts = mapPropsToOptions(props); | ||
opts = assign({}, opts, newOpts); | ||
if (opts.fragments) { | ||
opts.fragments = calculateFragments(opts.fragments); | ||
} | ||
if (opts.variables || !operation.variables.length) | ||
@@ -248,3 +245,8 @@ return opts; | ||
if (this.querySubscription) { | ||
this.queryObservable._setOptionsNoResult(opts); | ||
if (this.queryObservable._setOptionsNoResult) { | ||
this.queryObservable._setOptionsNoResult(opts); | ||
} | ||
else { | ||
this.queryObservable.setOptions(opts); | ||
} | ||
assign(this.data, { loading: this.queryObservable.currentResult().loading }, observableQueryFields(this.queryObservable)); | ||
@@ -251,0 +253,0 @@ return; |
{ | ||
"name": "react-apollo", | ||
"version": "0.5.11", | ||
"version": "0.5.12", | ||
"description": "React data container for Apollo Client", | ||
@@ -53,3 +53,3 @@ "main": "index.js", | ||
"redux": "^2.0.0 || ^3.0.0", | ||
"apollo-client": "^0.4.21" | ||
"apollo-client": "^0.4.21 || ^0.5.1" | ||
}, | ||
@@ -56,0 +56,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
137993
2055