Last active
February 18, 2017 17:21
-
-
Save dabbott/c1dcec0ac74dc7d14e5a3a78d5c7fdd3 to your computer and use it in GitHub Desktop.
react-apollo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function webpackUniversalModuleDefinition(root, factory) { | |
if(typeof exports === 'object' && typeof module === 'object') | |
module.exports = factory(require("react"), require("react-dom/server")); | |
else if(typeof define === 'function' && define.amd) | |
define(["react", "react-dom/server"], factory); | |
else if(typeof exports === 'object') | |
exports["react-apollo"] = factory(require("react"), require("react-dom/server")); | |
else | |
root["react-apollo"] = factory(root["React"], root["ReactDOM"]); | |
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_34__) { | |
return /******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) | |
/******/ return installedModules[moduleId].exports; | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ // Flag the module as loaded | |
/******/ module.l = true; | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ // identity function for calling harmony imports with the correct context | |
/******/ __webpack_require__.i = function(value) { return value; }; | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { | |
/******/ configurable: false, | |
/******/ enumerable: true, | |
/******/ get: getter | |
/******/ }); | |
/******/ } | |
/******/ }; | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = 35); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports) { | |
module.exports = __WEBPACK_EXTERNAL_MODULE_0__; | |
/***/ }), | |
/* 1 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* Copyright 2013-2015, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
*/ | |
/** | |
* Use invariant() to assert state which your program assumes to be true. | |
* | |
* Provide sprintf-style format (only %s is supported) and arguments | |
* to provide information about what broke and what you were | |
* expecting. | |
* | |
* The invariant message will be stripped in production, but the invariant | |
* will remain to ensure logic does not differ in production. | |
*/ | |
var invariant = function(condition, format, a, b, c, d, e, f) { | |
if (process.env.NODE_ENV !== 'production') { | |
if (format === undefined) { | |
throw new Error('invariant requires an error message argument'); | |
} | |
} | |
if (!condition) { | |
var error; | |
if (format === undefined) { | |
error = new Error( | |
'Minified exception occurred; use the non-minified dev environment ' + | |
'for the full error message and additional helpful warnings.' | |
); | |
} else { | |
var args = [a, b, c, d, e, f]; | |
var argIndex = 0; | |
error = new Error( | |
format.replace(/%s/g, function() { return args[argIndex++]; }) | |
); | |
error.name = 'Invariant Violation'; | |
} | |
error.framesToPop = 1; // we don't care about invariant's own frame | |
throw error; | |
} | |
}; | |
module.exports = invariant; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) | |
/***/ }), | |
/* 2 */ | |
/***/ (function(module, exports) { | |
// shim for using process in browser | |
var process = module.exports = {}; | |
// cached from whatever global is present so that test runners that stub it | |
// don't break things. But we need to wrap it in a try catch in case it is | |
// wrapped in strict mode code which doesn't define any globals. It's inside a | |
// function because try/catches deoptimize in certain engines. | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
function defaultSetTimout() { | |
throw new Error('setTimeout has not been defined'); | |
} | |
function defaultClearTimeout () { | |
throw new Error('clearTimeout has not been defined'); | |
} | |
(function () { | |
try { | |
if (typeof setTimeout === 'function') { | |
cachedSetTimeout = setTimeout; | |
} else { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
} catch (e) { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
if (typeof clearTimeout === 'function') { | |
cachedClearTimeout = clearTimeout; | |
} else { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} catch (e) { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} ()) | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
//normal enviroments in sane situations | |
return setTimeout(fun, 0); | |
} | |
// if setTimeout wasn't available but was latter defined | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
cachedSetTimeout = setTimeout; | |
return setTimeout(fun, 0); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedSetTimeout(fun, 0); | |
} catch(e){ | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch(e){ | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
//normal enviroments in sane situations | |
return clearTimeout(marker); | |
} | |
// if clearTimeout wasn't available but was latter defined | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
cachedClearTimeout = clearTimeout; | |
return clearTimeout(marker); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedClearTimeout(marker); | |
} catch (e){ | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedClearTimeout.call(null, marker); | |
} catch (e){ | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | |
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
var queue = []; | |
var draining = false; | |
var currentQueue; | |
var queueIndex = -1; | |
function cleanUpNextTick() { | |
if (!draining || !currentQueue) { | |
return; | |
} | |
draining = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
function drainQueue() { | |
if (draining) { | |
return; | |
} | |
var timeout = runTimeout(cleanUpNextTick); | |
draining = true; | |
var len = queue.length; | |
while(len) { | |
currentQueue = queue; | |
queue = []; | |
while (++queueIndex < len) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
queueIndex = -1; | |
len = queue.length; | |
} | |
currentQueue = null; | |
draining = false; | |
runClearTimeout(timeout); | |
} | |
process.nextTick = function (fun) { | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
for (var i = 1; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (queue.length === 1 && !draining) { | |
runTimeout(drainQueue); | |
} | |
}; | |
// v8 likes predictible objects | |
function Item(fun, array) { | |
this.fun = fun; | |
this.array = array; | |
} | |
Item.prototype.run = function () { | |
this.fun.apply(null, this.array); | |
}; | |
process.title = 'browser'; | |
process.browser = true; | |
process.env = {}; | |
process.argv = []; | |
process.version = ''; // empty string to avoid regexp issues | |
process.versions = {}; | |
function noop() {} | |
process.on = noop; | |
process.addListener = noop; | |
process.once = noop; | |
process.off = noop; | |
process.removeListener = noop; | |
process.removeAllListeners = noop; | |
process.emit = noop; | |
process.binding = function (name) { | |
throw new Error('process.binding is not supported'); | |
}; | |
process.cwd = function () { return '/' }; | |
process.chdir = function (dir) { | |
throw new Error('process.chdir is not supported'); | |
}; | |
process.umask = function() { return 0; }; | |
/***/ }), | |
/* 3 */ | |
/***/ (function(module, exports) { | |
var g; | |
// This works in non-strict mode | |
g = (function() { | |
return this; | |
})(); | |
try { | |
// This works if eval is allowed (see CSP) | |
g = g || Function("return this")() || (1,eval)("this"); | |
} catch(e) { | |
// This works if the window reference is available | |
if(typeof window === "object") | |
g = window; | |
} | |
// g can still be undefined, but nothing to do about it... | |
// We return undefined, instead of nothing here, so it's | |
// easier to handle this case. if(!global) { ...} | |
module.exports = g; | |
/***/ }), | |
/* 4 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__root_js__ = __webpack_require__(23); | |
/** Built-in value references. */ | |
var Symbol = __WEBPACK_IMPORTED_MODULE_0__root_js__["a" /* default */].Symbol; | |
/* harmony default export */ __webpack_exports__["a"] = Symbol; | |
/***/ }), | |
/* 5 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__baseGetTag_js__ = __webpack_require__(17); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getPrototype_js__ = __webpack_require__(19); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__isObjectLike_js__ = __webpack_require__(24); | |
/** `Object#toString` result references. */ | |
var objectTag = '[object Object]'; | |
/** Used for built-in method references. */ | |
var funcProto = Function.prototype, | |
objectProto = Object.prototype; | |
/** Used to resolve the decompiled source of functions. */ | |
var funcToString = funcProto.toString; | |
/** Used to check objects for own properties. */ | |
var hasOwnProperty = objectProto.hasOwnProperty; | |
/** Used to infer the `Object` constructor. */ | |
var objectCtorString = funcToString.call(Object); | |
/** | |
* Checks if `value` is a plain object, that is, an object created by the | |
* `Object` constructor or one with a `[[Prototype]]` of `null`. | |
* | |
* @static | |
* @memberOf _ | |
* @since 0.8.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`. | |
* @example | |
* | |
* function Foo() { | |
* this.a = 1; | |
* } | |
* | |
* _.isPlainObject(new Foo); | |
* // => false | |
* | |
* _.isPlainObject([1, 2, 3]); | |
* // => false | |
* | |
* _.isPlainObject({ 'x': 0, 'y': 0 }); | |
* // => true | |
* | |
* _.isPlainObject(Object.create(null)); | |
* // => true | |
*/ | |
function isPlainObject(value) { | |
if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__isObjectLike_js__["a" /* default */])(value) || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__baseGetTag_js__["a" /* default */])(value) != objectTag) { | |
return false; | |
} | |
var proto = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__getPrototype_js__["a" /* default */])(value); | |
if (proto === null) { | |
return true; | |
} | |
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; | |
return typeof Ctor == 'function' && Ctor instanceof Ctor && | |
funcToString.call(Ctor) == objectCtorString; | |
} | |
/* harmony default export */ __webpack_exports__["a"] = isPlainObject; | |
/***/ }), | |
/* 6 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* eslint-disable no-unused-vars */ | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
var propIsEnumerable = Object.prototype.propertyIsEnumerable; | |
function toObject(val) { | |
if (val === null || val === undefined) { | |
throw new TypeError('Object.assign cannot be called with null or undefined'); | |
} | |
return Object(val); | |
} | |
function shouldUseNative() { | |
try { | |
if (!Object.assign) { | |
return false; | |
} | |
// Detect buggy property enumeration order in older V8 versions. | |
// https://bugs.chromium.org/p/v8/issues/detail?id=4118 | |
var test1 = new String('abc'); // eslint-disable-line | |
test1[5] = 'de'; | |
if (Object.getOwnPropertyNames(test1)[0] === '5') { | |
return false; | |
} | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
var test2 = {}; | |
for (var i = 0; i < 10; i++) { | |
test2['_' + String.fromCharCode(i)] = i; | |
} | |
var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | |
return test2[n]; | |
}); | |
if (order2.join('') !== '0123456789') { | |
return false; | |
} | |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | |
var test3 = {}; | |
'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | |
test3[letter] = letter; | |
}); | |
if (Object.keys(Object.assign({}, test3)).join('') !== | |
'abcdefghijklmnopqrst') { | |
return false; | |
} | |
return true; | |
} catch (e) { | |
// We don't expect any of the above to throw, but better to be safe. | |
return false; | |
} | |
} | |
module.exports = shouldUseNative() ? Object.assign : function (target, source) { | |
var from; | |
var to = toObject(target); | |
var symbols; | |
for (var s = 1; s < arguments.length; s++) { | |
from = Object(arguments[s]); | |
for (var key in from) { | |
if (hasOwnProperty.call(from, key)) { | |
to[key] = from[key]; | |
} | |
} | |
if (Object.getOwnPropertySymbols) { | |
symbols = Object.getOwnPropertySymbols(from); | |
for (var i = 0; i < symbols.length; i++) { | |
if (propIsEnumerable.call(from, symbols[i])) { | |
to[symbols[i]] = from[symbols[i]]; | |
} | |
} | |
} | |
} | |
return to; | |
}; | |
/***/ }), | |
/* 7 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony export (immutable) */ __webpack_exports__["a"] = compose; | |
/** | |
* Composes single-argument functions from right to left. The rightmost | |
* function can take multiple arguments as it provides the signature for | |
* the resulting composite function. | |
* | |
* @param {...Function} funcs The functions to compose. | |
* @returns {Function} A function obtained by composing the argument functions | |
* from right to left. For example, compose(f, g, h) is identical to doing | |
* (...args) => f(g(h(...args))). | |
*/ | |
function compose() { | |
for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) { | |
funcs[_key] = arguments[_key]; | |
} | |
if (funcs.length === 0) { | |
return function (arg) { | |
return arg; | |
}; | |
} | |
if (funcs.length === 1) { | |
return funcs[0]; | |
} | |
var last = funcs[funcs.length - 1]; | |
var rest = funcs.slice(0, -1); | |
return function () { | |
return rest.reduceRight(function (composed, f) { | |
return f(composed); | |
}, last.apply(undefined, arguments)); | |
}; | |
} | |
/***/ }), | |
/* 8 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_lodash_es_isPlainObject__ = __webpack_require__(5); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_symbol_observable__ = __webpack_require__(30); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_symbol_observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_symbol_observable__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ActionTypes; }); | |
/* harmony export (immutable) */ __webpack_exports__["a"] = createStore; | |
/** | |
* These are private action types reserved by Redux. | |
* For any unknown actions, you must return the current state. | |
* If the current state is undefined, you must return the initial state. | |
* Do not reference these action types directly in your code. | |
*/ | |
var ActionTypes = { | |
INIT: '@@redux/INIT' | |
}; | |
/** | |
* Creates a Redux store that holds the state tree. | |
* The only way to change the data in the store is to call `dispatch()` on it. | |
* | |
* There should only be a single store in your app. To specify how different | |
* parts of the state tree respond to actions, you may combine several reducers | |
* into a single reducer function by using `combineReducers`. | |
* | |
* @param {Function} reducer A function that returns the next state tree, given | |
* the current state tree and the action to handle. | |
* | |
* @param {any} [preloadedState] The initial state. You may optionally specify it | |
* to hydrate the state from the server in universal apps, or to restore a | |
* previously serialized user session. | |
* If you use `combineReducers` to produce the root reducer function, this must be | |
* an object with the same shape as `combineReducers` keys. | |
* | |
* @param {Function} enhancer The store enhancer. You may optionally specify it | |
* to enhance the store with third-party capabilities such as middleware, | |
* time travel, persistence, etc. The only store enhancer that ships with Redux | |
* is `applyMiddleware()`. | |
* | |
* @returns {Store} A Redux store that lets you read the state, dispatch actions | |
* and subscribe to changes. | |
*/ | |
function createStore(reducer, preloadedState, enhancer) { | |
var _ref2; | |
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { | |
enhancer = preloadedState; | |
preloadedState = undefined; | |
} | |
if (typeof enhancer !== 'undefined') { | |
if (typeof enhancer !== 'function') { | |
throw new Error('Expected the enhancer to be a function.'); | |
} | |
return enhancer(createStore)(reducer, preloadedState); | |
} | |
if (typeof reducer !== 'function') { | |
throw new Error('Expected the reducer to be a function.'); | |
} | |
var currentReducer = reducer; | |
var currentState = preloadedState; | |
var currentListeners = []; | |
var nextListeners = currentListeners; | |
var isDispatching = false; | |
function ensureCanMutateNextListeners() { | |
if (nextListeners === currentListeners) { | |
nextListeners = currentListeners.slice(); | |
} | |
} | |
/** | |
* Reads the state tree managed by the store. | |
* | |
* @returns {any} The current state tree of your application. | |
*/ | |
function getState() { | |
return currentState; | |
} | |
/** | |
* Adds a change listener. It will be called any time an action is dispatched, | |
* and some part of the state tree may potentially have changed. You may then | |
* call `getState()` to read the current state tree inside the callback. | |
* | |
* You may call `dispatch()` from a change listener, with the following | |
* caveats: | |
* | |
* 1. The subscriptions are snapshotted just before every `dispatch()` call. | |
* If you subscribe or unsubscribe while the listeners are being invoked, this | |
* will not have any effect on the `dispatch()` that is currently in progress. | |
* However, the next `dispatch()` call, whether nested or not, will use a more | |
* recent snapshot of the subscription list. | |
* | |
* 2. The listener should not expect to see all state changes, as the state | |
* might have been updated multiple times during a nested `dispatch()` before | |
* the listener is called. It is, however, guaranteed that all subscribers | |
* registered before the `dispatch()` started will be called with the latest | |
* state by the time it exits. | |
* | |
* @param {Function} listener A callback to be invoked on every dispatch. | |
* @returns {Function} A function to remove this change listener. | |
*/ | |
function subscribe(listener) { | |
if (typeof listener !== 'function') { | |
throw new Error('Expected listener to be a function.'); | |
} | |
var isSubscribed = true; | |
ensureCanMutateNextListeners(); | |
nextListeners.push(listener); | |
return function unsubscribe() { | |
if (!isSubscribed) { | |
return; | |
} | |
isSubscribed = false; | |
ensureCanMutateNextListeners(); | |
var index = nextListeners.indexOf(listener); | |
nextListeners.splice(index, 1); | |
}; | |
} | |
/** | |
* Dispatches an action. It is the only way to trigger a state change. | |
* | |
* The `reducer` function, used to create the store, will be called with the | |
* current state tree and the given `action`. Its return value will | |
* be considered the **next** state of the tree, and the change listeners | |
* will be notified. | |
* | |
* The base implementation only supports plain object actions. If you want to | |
* dispatch a Promise, an Observable, a thunk, or something else, you need to | |
* wrap your store creating function into the corresponding middleware. For | |
* example, see the documentation for the `redux-thunk` package. Even the | |
* middleware will eventually dispatch plain object actions using this method. | |
* | |
* @param {Object} action A plain object representing “what changed”. It is | |
* a good idea to keep actions serializable so you can record and replay user | |
* sessions, or use the time travelling `redux-devtools`. An action must have | |
* a `type` property which may not be `undefined`. It is a good idea to use | |
* string constants for action types. | |
* | |
* @returns {Object} For convenience, the same action object you dispatched. | |
* | |
* Note that, if you use a custom middleware, it may wrap `dispatch()` to | |
* return something else (for example, a Promise you can await). | |
*/ | |
function dispatch(action) { | |
if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_lodash_es_isPlainObject__["a" /* default */])(action)) { | |
throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); | |
} | |
if (typeof action.type === 'undefined') { | |
throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); | |
} | |
if (isDispatching) { | |
throw new Error('Reducers may not dispatch actions.'); | |
} | |
try { | |
isDispatching = true; | |
currentState = currentReducer(currentState, action); | |
} finally { | |
isDispatching = false; | |
} | |
var listeners = currentListeners = nextListeners; | |
for (var i = 0; i < listeners.length; i++) { | |
listeners[i](); | |
} | |
return action; | |
} | |
/** | |
* Replaces the reducer currently used by the store to calculate the state. | |
* | |
* You might need this if your app implements code splitting and you want to | |
* load some of the reducers dynamically. You might also need this if you | |
* implement a hot reloading mechanism for Redux. | |
* | |
* @param {Function} nextReducer The reducer for the store to use instead. | |
* @returns {void} | |
*/ | |
function replaceReducer(nextReducer) { | |
if (typeof nextReducer !== 'function') { | |
throw new Error('Expected the nextReducer to be a function.'); | |
} | |
currentReducer = nextReducer; | |
dispatch({ type: ActionTypes.INIT }); | |
} | |
/** | |
* Interoperability point for observable/reactive libraries. | |
* @returns {observable} A minimal observable of state changes. | |
* For more information, see the observable proposal: | |
* https://github.com/zenparsing/es-observable | |
*/ | |
function observable() { | |
var _ref; | |
var outerSubscribe = subscribe; | |
return _ref = { | |
/** | |
* The minimal observable subscription method. | |
* @param {Object} observer Any object that can be used as an observer. | |
* The observer object should have a `next` method. | |
* @returns {subscription} An object with an `unsubscribe` method that can | |
* be used to unsubscribe the observable from the store, and prevent further | |
* emission of values from the observable. | |
*/ | |
subscribe: function subscribe(observer) { | |
if (typeof observer !== 'object') { | |
throw new TypeError('Expected the observer to be an object.'); | |
} | |
function observeState() { | |
if (observer.next) { | |
observer.next(getState()); | |
} | |
} | |
observeState(); | |
var unsubscribe = outerSubscribe(observeState); | |
return { unsubscribe: unsubscribe }; | |
} | |
}, _ref[__WEBPACK_IMPORTED_MODULE_1_symbol_observable___default.a] = function () { | |
return this; | |
}, _ref; | |
} | |
// When a store is created, an "INIT" action is dispatched so that every | |
// reducer returns their initial state. This effectively populates | |
// the initial state tree. | |
dispatch({ type: ActionTypes.INIT }); | |
return _ref2 = { | |
dispatch: dispatch, | |
subscribe: subscribe, | |
getState: getState, | |
replaceReducer: replaceReducer | |
}, _ref2[__WEBPACK_IMPORTED_MODULE_1_symbol_observable___default.a] = observable, _ref2; | |
} | |
/***/ }), | |
/* 9 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony export (immutable) */ __webpack_exports__["a"] = warning; | |
/** | |
* Prints a warning in the console if it exists. | |
* | |
* @param {String} message The warning message. | |
* @returns {void} | |
*/ | |
function warning(message) { | |
/* eslint-disable no-console */ | |
if (typeof console !== 'undefined' && typeof console.error === 'function') { | |
console.error(message); | |
} | |
/* eslint-enable no-console */ | |
try { | |
// This error was thrown as a convenience so that if you enable | |
// "break on all exceptions" in your console, | |
// it would pause the execution at this line. | |
throw new Error(message); | |
/* eslint-disable no-empty */ | |
} catch (e) {} | |
/* eslint-enable no-empty */ | |
} | |
/***/ }), | |
/* 10 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var ApolloProvider_1 = __webpack_require__(12); | |
exports.ApolloProvider = ApolloProvider_1.default; | |
var graphql_1 = __webpack_require__(13); | |
exports.graphql = graphql_1.default; | |
exports.withApollo = graphql_1.withApollo; | |
var redux_1 = __webpack_require__(29); | |
exports.compose = redux_1.compose; | |
//# sourceMappingURL=browser.js.map | |
/***/ }), | |
/* 11 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var react_1 = __webpack_require__(0); | |
var ReactDOM = __webpack_require__(34); | |
var assign = __webpack_require__(6); | |
function walkTree(element, context, visitor) { | |
var Component = element.type; | |
if (typeof Component === 'function') { | |
var props = assign({}, Component.defaultProps, element.props); | |
var childContext = context; | |
var child = void 0; | |
if (Component.prototype && Component.prototype.isReactComponent) { | |
var instance_1 = new Component(props, context); | |
instance_1.props = instance_1.props || props; | |
instance_1.context = instance_1.context || context; | |
instance_1.setState = function (newState) { | |
instance_1.state = assign({}, instance_1.state, newState); | |
}; | |
if (instance_1.componentWillMount) { | |
instance_1.componentWillMount(); | |
} | |
if (instance_1.getChildContext) { | |
childContext = assign({}, context, instance_1.getChildContext()); | |
} | |
if (visitor(element, instance_1, context) === false) { | |
return; | |
} | |
child = instance_1.render(); | |
} | |
else { | |
if (visitor(element, null, context) === false) { | |
return; | |
} | |
child = Component(props, context); | |
} | |
if (child) { | |
walkTree(child, childContext, visitor); | |
} | |
} | |
else { | |
if (visitor(element, null, context) === false) { | |
return; | |
} | |
if (element.props && element.props.children) { | |
react_1.Children.forEach(element.props.children, function (child) { | |
if (child) { | |
walkTree(child, context, visitor); | |
} | |
}); | |
} | |
} | |
} | |
exports.walkTree = walkTree; | |
function getQueriesFromTree(_a, fetchRoot) { | |
var rootElement = _a.rootElement, _b = _a.rootContext, rootContext = _b === void 0 ? {} : _b; | |
if (fetchRoot === void 0) { fetchRoot = true; } | |
var queries = []; | |
walkTree(rootElement, rootContext, function (element, instance, context) { | |
var skipRoot = !fetchRoot && (element === rootElement); | |
if (instance && typeof instance.fetchData === 'function' && !skipRoot) { | |
var query = instance.fetchData(); | |
if (query) { | |
queries.push({ query: query, element: element, context: context }); | |
return false; | |
} | |
} | |
}); | |
return queries; | |
} | |
function getDataFromTree(rootElement, rootContext, fetchRoot) { | |
if (rootContext === void 0) { rootContext = {}; } | |
if (fetchRoot === void 0) { fetchRoot = true; } | |
var queries = getQueriesFromTree({ rootElement: rootElement, rootContext: rootContext }, fetchRoot); | |
if (!queries.length) | |
return Promise.resolve(); | |
var mappedQueries = queries.map(function (_a) { | |
var query = _a.query, element = _a.element, context = _a.context; | |
return query.then(function (_) { return getDataFromTree(element, context, false); }); | |
}); | |
return Promise.all(mappedQueries).then(function (_) { return null; }); | |
} | |
exports.getDataFromTree = getDataFromTree; | |
function renderToStringWithData(component) { | |
return getDataFromTree(component) | |
.then(function () { return ReactDOM.renderToString(component); }); | |
} | |
exports.renderToStringWithData = renderToStringWithData; | |
function cleanupApolloState(apolloState) { | |
for (var queryId in apolloState.queries) { | |
var fieldsToNotShip = ['minimizedQuery', 'minimizedQueryString']; | |
for (var _i = 0, fieldsToNotShip_1 = fieldsToNotShip; _i < fieldsToNotShip_1.length; _i++) { | |
var field = fieldsToNotShip_1[_i]; | |
delete apolloState.queries[queryId][field]; | |
} | |
} | |
} | |
exports.cleanupApolloState = cleanupApolloState; | |
//# sourceMappingURL=server.js.map | |
/***/ }), | |
/* 12 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var React = __webpack_require__(0); | |
var react_1 = __webpack_require__(0); | |
var invariant = __webpack_require__(1); | |
var ApolloProvider = (function (_super) { | |
__extends(ApolloProvider, _super); | |
function ApolloProvider(props, context) { | |
var _this = _super.call(this, props, context) || this; | |
invariant(props.client, 'ApolloClient was not passed a client instance. Make ' + | |
'sure you pass in your client via the "client" prop.'); | |
_this.client = props.client; | |
if (props.store) { | |
_this.store = props.store; | |
if (props.immutable) | |
props.client.initStore(); | |
return _this; | |
} | |
props.client.initStore(); | |
_this.store = props.client.store; | |
return _this; | |
} | |
ApolloProvider.prototype.getChildContext = function () { | |
return { | |
store: this.store, | |
client: this.client, | |
}; | |
}; | |
ApolloProvider.prototype.render = function () { | |
return React.Children.only(this.props.children); | |
}; | |
return ApolloProvider; | |
}(react_1.Component)); | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.default = ApolloProvider; | |
ApolloProvider.propTypes = { | |
store: react_1.PropTypes.shape({ | |
subscribe: react_1.PropTypes.func.isRequired, | |
dispatch: react_1.PropTypes.func.isRequired, | |
getState: react_1.PropTypes.func.isRequired, | |
}), | |
client: react_1.PropTypes.object.isRequired, | |
immutable: react_1.PropTypes.bool, | |
children: react_1.PropTypes.element.isRequired, | |
}; | |
ApolloProvider.childContextTypes = { | |
store: react_1.PropTypes.object.isRequired, | |
client: react_1.PropTypes.object.isRequired, | |
}; | |
; | |
//# sourceMappingURL=ApolloProvider.js.map | |
/***/ }), | |
/* 13 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var react_1 = __webpack_require__(0); | |
var pick = __webpack_require__(25); | |
var shallowEqual_1 = __webpack_require__(15); | |
var invariant = __webpack_require__(1); | |
var assign = __webpack_require__(6); | |
var hoistNonReactStatics = __webpack_require__(16); | |
var parser_1 = __webpack_require__(14); | |
var defaultMapPropsToOptions = function (props) { return ({}); }; | |
var defaultMapResultToProps = function (props) { return props; }; | |
var defaultMapPropsToSkip = function (props) { return false; }; | |
function observableQueryFields(observable) { | |
var fields = pick(observable, 'variables', 'refetch', 'fetchMore', 'updateQuery', 'startPolling', 'stopPolling', 'subscribeToMore'); | |
Object.keys(fields).forEach(function (key) { | |
if (typeof fields[key] === 'function') { | |
fields[key] = fields[key].bind(observable); | |
} | |
}); | |
return fields; | |
} | |
function getDisplayName(WrappedComponent) { | |
return WrappedComponent.displayName || WrappedComponent.name || 'Component'; | |
} | |
var nextVersion = 0; | |
function withApollo(WrappedComponent, operationOptions) { | |
if (operationOptions === void 0) { operationOptions = {}; } | |
var withDisplayName = "withApollo(" + getDisplayName(WrappedComponent) + ")"; | |
var WithApollo = (function (_super) { | |
__extends(WithApollo, _super); | |
function WithApollo(props, context) { | |
var _this = _super.call(this, props, context) || this; | |
_this.client = context.client; | |
invariant(!!_this.client, "Could not find \"client\" in the context of " + | |
("\"" + withDisplayName + "\". ") + | |
"Wrap the root component in an <ApolloProvider>"); | |
return _this; | |
} | |
WithApollo.prototype.getWrappedInstance = function () { | |
invariant(operationOptions.withRef, "To access the wrapped instance, you need to specify " + | |
"{ withRef: true } in the options"); | |
return this.refs.wrappedInstance; | |
}; | |
WithApollo.prototype.render = function () { | |
var props = assign({}, this.props); | |
props.client = this.client; | |
if (operationOptions.withRef) | |
props.ref = 'wrappedInstance'; | |
return react_1.createElement(WrappedComponent, props); | |
}; | |
return WithApollo; | |
}(react_1.Component)); | |
WithApollo.displayName = withDisplayName; | |
WithApollo.WrappedComponent = WrappedComponent; | |
WithApollo.contextTypes = { client: react_1.PropTypes.object.isRequired }; | |
return hoistNonReactStatics(WithApollo, WrappedComponent, {}); | |
} | |
exports.withApollo = withApollo; | |
; | |
function graphql(document, operationOptions) { | |
if (operationOptions === void 0) { operationOptions = {}; } | |
var _a = operationOptions.options, options = _a === void 0 ? defaultMapPropsToOptions : _a, _b = operationOptions.skip, skip = _b === void 0 ? defaultMapPropsToSkip : _b, _c = operationOptions.alias, alias = _c === void 0 ? 'Apollo' : _c; | |
var mapPropsToOptions = options; | |
if (typeof mapPropsToOptions !== 'function') | |
mapPropsToOptions = function () { return options; }; | |
var mapPropsToSkip = skip; | |
if (typeof mapPropsToSkip !== 'function') | |
mapPropsToSkip = (function () { return skip; }); | |
var mapResultToProps = operationOptions.props; | |
var operation = parser_1.parser(document); | |
var version = nextVersion++; | |
var wrapWithApolloComponent = function (WrappedComponent) { | |
var graphQLDisplayName = alias + "(" + getDisplayName(WrappedComponent) + ")"; | |
var recycler = new ObservableQueryRecycler(); | |
var GraphQL = (function (_super) { | |
__extends(GraphQL, _super); | |
function GraphQL(props, context) { | |
var _this = _super.call(this, props, context) || this; | |
_this.previousData = {}; | |
_this.version = version; | |
_this.client = context.client; | |
invariant(!!_this.client, "Could not find \"client\" in the context of " + | |
("\"" + graphQLDisplayName + "\". ") + | |
"Wrap the root component in an <ApolloProvider>"); | |
_this.store = _this.client.store; | |
_this.type = operation.type; | |
if (_this.shouldSkip(props)) | |
return _this; | |
_this.setInitialProps(); | |
return _this; | |
} | |
GraphQL.prototype.componentDidMount = function () { | |
this.hasMounted = true; | |
if (this.type === parser_1.DocumentType.Mutation) | |
return; | |
if (!this.shouldSkip(this.props)) { | |
this.subscribeToQuery(); | |
} | |
}; | |
GraphQL.prototype.componentWillReceiveProps = function (nextProps) { | |
if (shallowEqual_1.default(this.props, nextProps)) | |
return; | |
this.shouldRerender = true; | |
if (this.type === parser_1.DocumentType.Mutation) { | |
return; | |
} | |
; | |
if (this.type === parser_1.DocumentType.Subscription | |
&& operationOptions.shouldResubscribe | |
&& operationOptions.shouldResubscribe(this.props, nextProps)) { | |
this.unsubscribeFromQuery(); | |
delete this.queryObservable; | |
this.updateQuery(nextProps); | |
this.subscribeToQuery(); | |
return; | |
} | |
if (this.shouldSkip(nextProps)) { | |
if (!this.shouldSkip(this.props)) { | |
this.unsubscribeFromQuery(); | |
} | |
return; | |
} | |
this.updateQuery(nextProps); | |
this.subscribeToQuery(); | |
}; | |
GraphQL.prototype.shouldComponentUpdate = function (nextProps, nextState, nextContext) { | |
return !!nextContext || this.shouldRerender; | |
}; | |
GraphQL.prototype.componentWillUnmount = function () { | |
if (this.type === parser_1.DocumentType.Query) { | |
if (this.queryObservable) { | |
recycler.recycle(this.queryObservable); | |
delete this.queryObservable; | |
} | |
this.unsubscribeFromQuery(); | |
} | |
if (this.type === parser_1.DocumentType.Subscription) | |
this.unsubscribeFromQuery(); | |
this.hasMounted = false; | |
}; | |
GraphQL.prototype.calculateOptions = function (props, newOpts) { | |
if (props === void 0) { props = this.props; } | |
var opts = mapPropsToOptions(props); | |
if (newOpts && newOpts.variables) { | |
newOpts.variables = assign({}, opts.variables, newOpts.variables); | |
} | |
if (newOpts) | |
opts = assign({}, opts, newOpts); | |
if (opts.variables || !operation.variables.length) | |
return opts; | |
var variables = {}; | |
for (var _i = 0, _a = operation.variables; _i < _a.length; _i++) { | |
var _b = _a[_i], variable = _b.variable, type = _b.type; | |
if (!variable.name || !variable.name.value) | |
continue; | |
if (typeof props[variable.name.value] !== 'undefined') { | |
variables[variable.name.value] = props[variable.name.value]; | |
continue; | |
} | |
if (type.kind !== 'NonNullType') { | |
variables[variable.name.value] = null; | |
continue; | |
} | |
invariant(typeof props[variable.name.value] !== 'undefined', "The operation '" + operation.name + "' wrapping '" + getDisplayName(WrappedComponent) + "' " + | |
("is expecting a variable: '" + variable.name.value + "' but it was not found in the props ") + | |
("passed to '" + graphQLDisplayName + "'")); | |
} | |
opts.variables = variables; | |
return opts; | |
}; | |
; | |
GraphQL.prototype.calculateResultProps = function (result) { | |
var name = this.type === parser_1.DocumentType.Mutation ? 'mutate' : 'data'; | |
if (operationOptions.name) | |
name = operationOptions.name; | |
var newResult = (_a = {}, _a[name] = result, _a.ownProps = this.props, _a); | |
if (mapResultToProps) | |
return mapResultToProps(newResult); | |
return _b = {}, _b[name] = defaultMapResultToProps(result), _b; | |
var _a, _b; | |
}; | |
GraphQL.prototype.setInitialProps = function () { | |
if (this.type === parser_1.DocumentType.Mutation) { | |
return; | |
} | |
var opts = this.calculateOptions(this.props); | |
this.createQuery(opts); | |
}; | |
GraphQL.prototype.createQuery = function (opts) { | |
if (this.type === parser_1.DocumentType.Subscription) { | |
this.queryObservable = this.client.subscribe(assign({ | |
query: document, | |
}, opts)); | |
} | |
else { | |
var queryObservable = recycler.reuse(opts); | |
if (queryObservable === null) { | |
this.queryObservable = this.client.watchQuery(assign({ | |
query: document, | |
metadata: { | |
reactComponent: { | |
displayName: graphQLDisplayName, | |
}, | |
}, | |
}, opts)); | |
} | |
else { | |
this.queryObservable = queryObservable; | |
} | |
} | |
}; | |
GraphQL.prototype.updateQuery = function (props) { | |
var opts = this.calculateOptions(props); | |
if (!this.queryObservable) { | |
this.createQuery(opts); | |
} | |
if (this.queryObservable._setOptionsNoResult) { | |
this.queryObservable._setOptionsNoResult(opts); | |
} | |
else { | |
if (this.queryObservable.setOptions) { | |
this.queryObservable.setOptions(opts) | |
.catch(function (error) { return null; }); | |
} | |
} | |
}; | |
GraphQL.prototype.fetchData = function () { | |
if (this.shouldSkip()) | |
return false; | |
if (operation.type === parser_1.DocumentType.Mutation || operation.type === parser_1.DocumentType.Subscription) | |
return false; | |
var opts = this.calculateOptions(); | |
if (opts.ssr === false) | |
return false; | |
if (opts.forceFetch) | |
delete opts.forceFetch; | |
var observable = this.client.watchQuery(assign({ query: document }, opts)); | |
var result = observable.currentResult(); | |
if (result.loading) { | |
return observable.result(); | |
} | |
else { | |
return false; | |
} | |
}; | |
GraphQL.prototype.subscribeToQuery = function () { | |
var _this = this; | |
if (this.querySubscription) { | |
return; | |
} | |
var next = function (results) { | |
if (_this.type === parser_1.DocumentType.Subscription) { | |
_this.lastSubscriptionData = results; | |
results = { data: results }; | |
} | |
var clashingKeys = Object.keys(observableQueryFields(results.data)); | |
invariant(clashingKeys.length === 0, "the result of the '" + graphQLDisplayName + "' operation contains keys that " + | |
"conflict with the return object." + | |
clashingKeys.map(function (k) { return "'" + k + "'"; }).join(', ') + " not allowed."); | |
_this.forceRenderChildren(); | |
}; | |
var handleError = function (error) { | |
if (error.hasOwnProperty('graphQLErrors')) | |
return next({ error: error }); | |
throw error; | |
}; | |
this.querySubscription = this.queryObservable.subscribe({ next: next, error: handleError }); | |
}; | |
GraphQL.prototype.unsubscribeFromQuery = function () { | |
if (this.querySubscription) { | |
this.querySubscription.unsubscribe(); | |
delete this.querySubscription; | |
} | |
}; | |
GraphQL.prototype.shouldSkip = function (props) { | |
if (props === void 0) { props = this.props; } | |
return mapPropsToSkip(props) || | |
mapPropsToOptions(props).skip; | |
}; | |
GraphQL.prototype.forceRenderChildren = function () { | |
this.shouldRerender = true; | |
if (this.hasMounted) | |
this.setState({}); | |
}; | |
GraphQL.prototype.getWrappedInstance = function () { | |
invariant(operationOptions.withRef, "To access the wrapped instance, you need to specify " + | |
"{ withRef: true } in the options"); | |
return this.refs.wrappedInstance; | |
}; | |
GraphQL.prototype.dataForChild = function () { | |
var _this = this; | |
if (this.type === parser_1.DocumentType.Mutation) { | |
return function (mutationOpts) { | |
var opts = _this.calculateOptions(_this.props, mutationOpts); | |
if (typeof opts.variables === 'undefined') | |
delete opts.variables; | |
opts.mutation = document; | |
return _this.client.mutate(opts); | |
}; | |
} | |
var opts = this.calculateOptions(this.props); | |
var data = {}; | |
assign(data, observableQueryFields(this.queryObservable)); | |
if (this.type === parser_1.DocumentType.Subscription) { | |
assign(data, { | |
loading: !this.lastSubscriptionData, | |
variables: opts.variables, | |
}, this.lastSubscriptionData); | |
} | |
else { | |
var currentResult = this.queryObservable.currentResult(); | |
var loading = currentResult.loading, error = currentResult.error, networkStatus = currentResult.networkStatus; | |
assign(data, { loading: loading, error: error, networkStatus: networkStatus }); | |
if (loading) { | |
assign(data, this.previousData, currentResult.data); | |
} | |
else { | |
assign(data, currentResult.data); | |
this.previousData = currentResult.data; | |
} | |
} | |
return data; | |
}; | |
GraphQL.prototype.render = function () { | |
if (this.shouldSkip()) { | |
return react_1.createElement(WrappedComponent, this.props); | |
} | |
var _a = this, shouldRerender = _a.shouldRerender, renderedElement = _a.renderedElement, props = _a.props; | |
this.shouldRerender = false; | |
var data = this.dataForChild(); | |
var clientProps = this.calculateResultProps(data); | |
var mergedPropsAndData = assign({}, props, clientProps); | |
if (!shouldRerender && renderedElement) { | |
return renderedElement; | |
} | |
if (operationOptions.withRef) | |
mergedPropsAndData.ref = 'wrappedInstance'; | |
this.renderedElement = react_1.createElement(WrappedComponent, mergedPropsAndData); | |
return this.renderedElement; | |
}; | |
return GraphQL; | |
}(react_1.Component)); | |
GraphQL.displayName = graphQLDisplayName; | |
GraphQL.WrappedComponent = WrappedComponent; | |
GraphQL.contextTypes = { | |
store: react_1.PropTypes.object.isRequired, | |
client: react_1.PropTypes.object.isRequired, | |
}; | |
return hoistNonReactStatics(GraphQL, WrappedComponent, {}); | |
}; | |
return wrapWithApolloComponent; | |
} | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.default = graphql; | |
; | |
var ObservableQueryRecycler = (function () { | |
function ObservableQueryRecycler() { | |
this.observableQueries = []; | |
} | |
ObservableQueryRecycler.prototype.recycle = function (observableQuery) { | |
observableQuery.stopPolling(); | |
this.observableQueries.push({ | |
observableQuery: observableQuery, | |
subscription: observableQuery.subscribe({}), | |
}); | |
}; | |
ObservableQueryRecycler.prototype.reuse = function (options) { | |
if (this.observableQueries.length <= 0) { | |
return null; | |
} | |
var _a = this.observableQueries.pop(), observableQuery = _a.observableQuery, subscription = _a.subscription; | |
subscription.unsubscribe(); | |
observableQuery.setOptions(options); | |
return observableQuery; | |
}; | |
return ObservableQueryRecycler; | |
}()); | |
//# sourceMappingURL=graphql.js.map | |
/***/ }), | |
/* 14 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var invariant = __webpack_require__(1); | |
(function (DocumentType) { | |
DocumentType[DocumentType["Query"] = 0] = "Query"; | |
DocumentType[DocumentType["Mutation"] = 1] = "Mutation"; | |
DocumentType[DocumentType["Subscription"] = 2] = "Subscription"; | |
})(exports.DocumentType || (exports.DocumentType = {})); | |
var DocumentType = exports.DocumentType; | |
function parser(document) { | |
var variables, type, name; | |
invariant((!!document && !!document.kind), "Argument of " + document + " passed to parser was not a valid GraphQL DocumentNode. You may need to use 'graphql-tag' or another method to convert your operation into a document"); | |
var fragments = document.definitions.filter(function (x) { return x.kind === 'FragmentDefinition'; }); | |
var queries = document.definitions.filter(function (x) { return x.kind === 'OperationDefinition' && x.operation === 'query'; }); | |
var mutations = document.definitions.filter(function (x) { return x.kind === 'OperationDefinition' && x.operation === 'mutation'; }); | |
var subscriptions = document.definitions.filter(function (x) { return x.kind === 'OperationDefinition' && x.operation === 'subscription'; }); | |
invariant(!fragments.length || (queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. You must include a query, subscription or mutation as well"); | |
invariant(((queries.length + mutations.length + subscriptions.length) <= 1), "react-apollo only supports a query, subscription, or a mutation per HOC. " + document + " had " + queries.length + " queries, " + subscriptions.length + " subscriptions and " + mutations.length + " muations. You can use 'compose' to join multiple operation types to a component"); | |
type = queries.length ? DocumentType.Query : DocumentType.Mutation; | |
if (!queries.length && !mutations.length) | |
type = DocumentType.Subscription; | |
var definitions = queries.length ? queries : | |
(mutations.length ? mutations : subscriptions); | |
invariant(definitions.length === 1, "react-apollo only supports one defintion per HOC. " + document + " had " + definitions.length + " definitions. You can use 'compose' to join multiple operation types to a component"); | |
var definition = definitions[0]; | |
variables = definition.variableDefinitions || []; | |
var hasName = definition.name && definition.name.kind === 'Name'; | |
name = hasName ? definition.name.value : 'data'; | |
return { name: name, type: type, variables: variables }; | |
} | |
exports.parser = parser; | |
//# sourceMappingURL=parser.js.map | |
/***/ }), | |
/* 15 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
function shallowEqual(objA, objB) { | |
if (!objA || !objB) | |
return true; | |
if (objA === objB) | |
return true; | |
var keysA = Object.keys(objA); | |
var keysB = Object.keys(objB); | |
if (keysA.length !== keysB.length) | |
return false; | |
var hasOwn = Object.prototype.hasOwnProperty; | |
for (var i = 0; i < keysA.length; i++) { | |
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { | |
return false; | |
} | |
} | |
return true; | |
} | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.default = shallowEqual; | |
//# sourceMappingURL=shallowEqual.js.map | |
/***/ }), | |
/* 16 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/** | |
* Copyright 2015, Yahoo! Inc. | |
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. | |
*/ | |
var REACT_STATICS = { | |
childContextTypes: true, | |
contextTypes: true, | |
defaultProps: true, | |
displayName: true, | |
getDefaultProps: true, | |
mixins: true, | |
propTypes: true, | |
type: true | |
}; | |
var KNOWN_STATICS = { | |
name: true, | |
length: true, | |
prototype: true, | |
caller: true, | |
arguments: true, | |
arity: true | |
}; | |
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function'; | |
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) { | |
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components | |
var keys = Object.getOwnPropertyNames(sourceComponent); | |
/* istanbul ignore else */ | |
if (isGetOwnPropertySymbolsAvailable) { | |
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent)); | |
} | |
for (var i = 0; i < keys.length; ++i) { | |
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) { | |
try { | |
targetComponent[keys[i]] = sourceComponent[keys[i]]; | |
} catch (error) { | |
} | |
} | |
} | |
} | |
return targetComponent; | |
}; | |
/***/ }), | |
/* 17 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Symbol_js__ = __webpack_require__(4); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__getRawTag_js__ = __webpack_require__(20); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__objectToString_js__ = __webpack_require__(21); | |
/** `Object#toString` result references. */ | |
var nullTag = '[object Null]', | |
undefinedTag = '[object Undefined]'; | |
/** Built-in value references. */ | |
var symToStringTag = __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */] ? __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */].toStringTag : undefined; | |
/** | |
* The base implementation of `getTag` without fallbacks for buggy environments. | |
* | |
* @private | |
* @param {*} value The value to query. | |
* @returns {string} Returns the `toStringTag`. | |
*/ | |
function baseGetTag(value) { | |
if (value == null) { | |
return value === undefined ? undefinedTag : nullTag; | |
} | |
value = Object(value); | |
return (symToStringTag && symToStringTag in value) | |
? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__getRawTag_js__["a" /* default */])(value) | |
: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__objectToString_js__["a" /* default */])(value); | |
} | |
/* harmony default export */ __webpack_exports__["a"] = baseGetTag; | |
/***/ }), | |
/* 18 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ | |
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; | |
/* harmony default export */ __webpack_exports__["a"] = freeGlobal; | |
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) | |
/***/ }), | |
/* 19 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__overArg_js__ = __webpack_require__(22); | |
/** Built-in value references. */ | |
var getPrototype = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__overArg_js__["a" /* default */])(Object.getPrototypeOf, Object); | |
/* harmony default export */ __webpack_exports__["a"] = getPrototype; | |
/***/ }), | |
/* 20 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Symbol_js__ = __webpack_require__(4); | |
/** 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 nativeObjectToString = objectProto.toString; | |
/** Built-in value references. */ | |
var symToStringTag = __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */] ? __WEBPACK_IMPORTED_MODULE_0__Symbol_js__["a" /* default */].toStringTag : undefined; | |
/** | |
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. | |
* | |
* @private | |
* @param {*} value The value to query. | |
* @returns {string} Returns the raw `toStringTag`. | |
*/ | |
function getRawTag(value) { | |
var isOwn = hasOwnProperty.call(value, symToStringTag), | |
tag = value[symToStringTag]; | |
try { | |
value[symToStringTag] = undefined; | |
var unmasked = true; | |
} catch (e) {} | |
var result = nativeObjectToString.call(value); | |
if (unmasked) { | |
if (isOwn) { | |
value[symToStringTag] = tag; | |
} else { | |
delete value[symToStringTag]; | |
} | |
} | |
return result; | |
} | |
/* harmony default export */ __webpack_exports__["a"] = getRawTag; | |
/***/ }), | |
/* 21 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/** Used for built-in method references. */ | |
var objectProto = Object.prototype; | |
/** | |
* Used to resolve the | |
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) | |
* of values. | |
*/ | |
var nativeObjectToString = objectProto.toString; | |
/** | |
* Converts `value` to a string using `Object.prototype.toString`. | |
* | |
* @private | |
* @param {*} value The value to convert. | |
* @returns {string} Returns the converted string. | |
*/ | |
function objectToString(value) { | |
return nativeObjectToString.call(value); | |
} | |
/* harmony default export */ __webpack_exports__["a"] = objectToString; | |
/***/ }), | |
/* 22 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/** | |
* Creates a unary function that invokes `func` with its argument transformed. | |
* | |
* @private | |
* @param {Function} func The function to wrap. | |
* @param {Function} transform The argument transform. | |
* @returns {Function} Returns the new function. | |
*/ | |
function overArg(func, transform) { | |
return function(arg) { | |
return func(transform(arg)); | |
}; | |
} | |
/* harmony default export */ __webpack_exports__["a"] = overArg; | |
/***/ }), | |
/* 23 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__freeGlobal_js__ = __webpack_require__(18); | |
/** Detect free variable `self`. */ | |
var freeSelf = typeof self == 'object' && self && self.Object === Object && self; | |
/** Used as a reference to the global object. */ | |
var root = __WEBPACK_IMPORTED_MODULE_0__freeGlobal_js__["a" /* default */] || freeSelf || Function('return this')(); | |
/* harmony default export */ __webpack_exports__["a"] = root; | |
/***/ }), | |
/* 24 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/** | |
* 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 != null && typeof value == 'object'; | |
} | |
/* harmony default export */ __webpack_exports__["a"] = isObjectLike; | |
/***/ }), | |
/* 25 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(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, | |
MAX_SAFE_INTEGER = 9007199254740991; | |
/** `Object#toString` result references. */ | |
var argsTag = '[object Arguments]', | |
funcTag = '[object Function]', | |
genTag = '[object GeneratorFunction]', | |
symbolTag = '[object Symbol]'; | |
/** 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')(); | |
/** | |
* A faster alternative to `Function#apply`, this function invokes `func` | |
* with the `this` binding of `thisArg` and the arguments of `args`. | |
* | |
* @private | |
* @param {Function} func The function to invoke. | |
* @param {*} thisArg The `this` binding of `func`. | |
* @param {Array} args The arguments to invoke `func` with. | |
* @returns {*} Returns the result of `func`. | |
*/ | |
function apply(func, thisArg, args) { | |
switch (args.length) { | |
case 0: return func.call(thisArg); | |
case 1: return func.call(thisArg, args[0]); | |
case 2: return func.call(thisArg, args[0], args[1]); | |
case 3: return func.call(thisArg, args[0], args[1], args[2]); | |
} | |
return func.apply(thisArg, args); | |
} | |
/** | |
* A specialized version of `_.map` for arrays without support for iteratee | |
* shorthands. | |
* | |
* @private | |
* @param {Array} [array] The array to iterate over. | |
* @param {Function} iteratee The function invoked per iteration. | |
* @returns {Array} Returns the new mapped array. | |
*/ | |
function arrayMap(array, iteratee) { | |
var index = -1, | |
length = array ? array.length : 0, | |
result = Array(length); | |
while (++index < length) { | |
result[index] = iteratee(array[index], index, array); | |
} | |
return result; | |
} | |
/** | |
* 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; | |
/* Built-in method references for those with the same name as other `lodash` methods. */ | |
var nativeMax = Math.max; | |
/** | |
* 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; | |
} | |
/** | |
* The base implementation of `_.pick` without support for individual | |
* property identifiers. | |
* | |
* @private | |
* @param {Object} object The source object. | |
* @param {string[]} props The property identifiers to pick. | |
* @returns {Object} Returns the new object. | |
*/ | |
function basePick(object, props) { | |
object = Object(object); | |
return basePickBy(object, props, function(value, key) { | |
return key in object; | |
}); | |
} | |
/** | |
* The base implementation of `_.pickBy` without support for iteratee shorthands. | |
* | |
* @private | |
* @param {Object} object The source object. | |
* @param {string[]} props The property identifiers to pick from. | |
* @param {Function} predicate The function invoked per property. | |
* @returns {Object} Returns the new object. | |
*/ | |
function basePickBy(object, props, predicate) { | |
var index = -1, | |
length = props.length, | |
result = {}; | |
while (++index < length) { | |
var key = props[index], | |
value = object[key]; | |
if (predicate(value, key)) { | |
result[key] = value; | |
} | |
} | |
return result; | |
} | |
/** | |
* The base implementation of `_.rest` which doesn't validate or coerce arguments. | |
* | |
* @private | |
* @param {Function} func The function to apply a rest parameter to. | |
* @param {number} [start=func.length-1] The start position of the rest parameter. | |
* @returns {Function} Returns the new function. | |
*/ | |
function baseRest(func, start) { | |
start = nativeMax(start === undefined ? (func.length - 1) : start, 0); | |
return function() { | |
var args = arguments, | |
index = -1, | |
length = nativeMax(args.length - start, 0), | |
array = Array(length); | |
while (++index < length) { | |
array[index] = args[start + index]; | |
} | |
index = -1; | |
var otherArgs = Array(start + 1); | |
while (++index < start) { | |
otherArgs[index] = args[index]; | |
} | |
otherArgs[start] = array; | |
return apply(func, this, otherArgs); | |
}; | |
} | |
/** | |
* 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]); | |
} | |
/** | |
* Converts `value` to a string key if it's not a string or symbol. | |
* | |
* @private | |
* @param {*} value The value to inspect. | |
* @returns {string|symbol} Returns the key. | |
*/ | |
function toKey(value) { | |
if (typeof value == 'string' || isSymbol(value)) { | |
return value; | |
} | |
var result = (value + ''); | |
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; | |
} | |
/** | |
* 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'; | |
} | |
/** | |
* Checks if `value` is classified as a `Symbol` primitive or object. | |
* | |
* @static | |
* @memberOf _ | |
* @since 4.0.0 | |
* @category Lang | |
* @param {*} value The value to check. | |
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`. | |
* @example | |
* | |
* _.isSymbol(Symbol.iterator); | |
* // => true | |
* | |
* _.isSymbol('abc'); | |
* // => false | |
*/ | |
function isSymbol(value) { | |
return typeof value == 'symbol' || | |
(isObjectLike(value) && objectToString.call(value) == symbolTag); | |
} | |
/** | |
* Creates an object composed of the picked `object` properties. | |
* | |
* @static | |
* @since 0.1.0 | |
* @memberOf _ | |
* @category Object | |
* @param {Object} object The source object. | |
* @param {...(string|string[])} [props] The property identifiers to pick. | |
* @returns {Object} Returns the new object. | |
* @example | |
* | |
* var object = { 'a': 1, 'b': '2', 'c': 3 }; | |
* | |
* _.pick(object, ['a', 'c']); | |
* // => { 'a': 1, 'c': 3 } | |
*/ | |
var pick = baseRest(function(object, props) { | |
return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey)); | |
}); | |
module.exports = pick; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) | |
/***/ }), | |
/* 26 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__compose__ = __webpack_require__(7); | |
/* harmony export (immutable) */ __webpack_exports__["a"] = applyMiddleware; | |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
/** | |
* Creates a store enhancer that applies middleware to the dispatch method | |
* of the Redux store. This is handy for a variety of tasks, such as expressing | |
* asynchronous actions in a concise manner, or logging every action payload. | |
* | |
* See `redux-thunk` package as an example of the Redux middleware. | |
* | |
* Because middleware is potentially asynchronous, this should be the first | |
* store enhancer in the composition chain. | |
* | |
* Note that each middleware will be given the `dispatch` and `getState` functions | |
* as named arguments. | |
* | |
* @param {...Function} middlewares The middleware chain to be applied. | |
* @returns {Function} A store enhancer applying the middleware. | |
*/ | |
function applyMiddleware() { | |
for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { | |
middlewares[_key] = arguments[_key]; | |
} | |
return function (createStore) { | |
return function (reducer, preloadedState, enhancer) { | |
var store = createStore(reducer, preloadedState, enhancer); | |
var _dispatch = store.dispatch; | |
var chain = []; | |
var middlewareAPI = { | |
getState: store.getState, | |
dispatch: function dispatch(action) { | |
return _dispatch(action); | |
} | |
}; | |
chain = middlewares.map(function (middleware) { | |
return middleware(middlewareAPI); | |
}); | |
_dispatch = __WEBPACK_IMPORTED_MODULE_0__compose__["a" /* default */].apply(undefined, chain)(store.dispatch); | |
return _extends({}, store, { | |
dispatch: _dispatch | |
}); | |
}; | |
}; | |
} | |
/***/ }), | |
/* 27 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* harmony export (immutable) */ __webpack_exports__["a"] = bindActionCreators; | |
function bindActionCreator(actionCreator, dispatch) { | |
return function () { | |
return dispatch(actionCreator.apply(undefined, arguments)); | |
}; | |
} | |
/** | |
* Turns an object whose values are action creators, into an object with the | |
* same keys, but with every function wrapped into a `dispatch` call so they | |
* may be invoked directly. This is just a convenience method, as you can call | |
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine. | |
* | |
* For convenience, you can also pass a single function as the first argument, | |
* and get a function in return. | |
* | |
* @param {Function|Object} actionCreators An object whose values are action | |
* creator functions. One handy way to obtain it is to use ES6 `import * as` | |
* syntax. You may also pass a single function. | |
* | |
* @param {Function} dispatch The `dispatch` function available on your Redux | |
* store. | |
* | |
* @returns {Function|Object} The object mimicking the original object, but with | |
* every action creator wrapped into the `dispatch` call. If you passed a | |
* function as `actionCreators`, the return value will also be a single | |
* function. | |
*/ | |
function bindActionCreators(actionCreators, dispatch) { | |
if (typeof actionCreators === 'function') { | |
return bindActionCreator(actionCreators, dispatch); | |
} | |
if (typeof actionCreators !== 'object' || actionCreators === null) { | |
throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?'); | |
} | |
var keys = Object.keys(actionCreators); | |
var boundActionCreators = {}; | |
for (var i = 0; i < keys.length; i++) { | |
var key = keys[i]; | |
var actionCreator = actionCreators[key]; | |
if (typeof actionCreator === 'function') { | |
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); | |
} | |
} | |
return boundActionCreators; | |
} | |
/***/ }), | |
/* 28 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createStore__ = __webpack_require__(8); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_lodash_es_isPlainObject__ = __webpack_require__(5); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_warning__ = __webpack_require__(9); | |
/* harmony export (immutable) */ __webpack_exports__["a"] = combineReducers; | |
function getUndefinedStateErrorMessage(key, action) { | |
var actionType = action && action.type; | |
var actionName = actionType && '"' + actionType.toString() + '"' || 'an action'; | |
return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state.'; | |
} | |
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { | |
var reducerKeys = Object.keys(reducers); | |
var argumentName = action && action.type === __WEBPACK_IMPORTED_MODULE_0__createStore__["b" /* ActionTypes */].INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; | |
if (reducerKeys.length === 0) { | |
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; | |
} | |
if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_lodash_es_isPlainObject__["a" /* default */])(inputState)) { | |
return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"'); | |
} | |
var unexpectedKeys = Object.keys(inputState).filter(function (key) { | |
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; | |
}); | |
unexpectedKeys.forEach(function (key) { | |
unexpectedKeyCache[key] = true; | |
}); | |
if (unexpectedKeys.length > 0) { | |
return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.'); | |
} | |
} | |
function assertReducerSanity(reducers) { | |
Object.keys(reducers).forEach(function (key) { | |
var reducer = reducers[key]; | |
var initialState = reducer(undefined, { type: __WEBPACK_IMPORTED_MODULE_0__createStore__["b" /* ActionTypes */].INIT }); | |
if (typeof initialState === 'undefined') { | |
throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined.'); | |
} | |
var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.'); | |
if (typeof reducer(undefined, { type: type }) === 'undefined') { | |
throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + __WEBPACK_IMPORTED_MODULE_0__createStore__["b" /* ActionTypes */].INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined.'); | |
} | |
}); | |
} | |
/** | |
* Turns an object whose values are different reducer functions, into a single | |
* reducer function. It will call every child reducer, and gather their results | |
* into a single state object, whose keys correspond to the keys of the passed | |
* reducer functions. | |
* | |
* @param {Object} reducers An object whose values correspond to different | |
* reducer functions that need to be combined into one. One handy way to obtain | |
* it is to use ES6 `import * as reducers` syntax. The reducers may never return | |
* undefined for any action. Instead, they should return their initial state | |
* if the state passed to them was undefined, and the current state for any | |
* unrecognized action. | |
* | |
* @returns {Function} A reducer function that invokes every reducer inside the | |
* passed object, and builds a state object with the same shape. | |
*/ | |
function combineReducers(reducers) { | |
var reducerKeys = Object.keys(reducers); | |
var finalReducers = {}; | |
for (var i = 0; i < reducerKeys.length; i++) { | |
var key = reducerKeys[i]; | |
if (process.env.NODE_ENV !== 'production') { | |
if (typeof reducers[key] === 'undefined') { | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils_warning__["a" /* default */])('No reducer provided for key "' + key + '"'); | |
} | |
} | |
if (typeof reducers[key] === 'function') { | |
finalReducers[key] = reducers[key]; | |
} | |
} | |
var finalReducerKeys = Object.keys(finalReducers); | |
if (process.env.NODE_ENV !== 'production') { | |
var unexpectedKeyCache = {}; | |
} | |
var sanityError; | |
try { | |
assertReducerSanity(finalReducers); | |
} catch (e) { | |
sanityError = e; | |
} | |
return function combination() { | |
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | |
var action = arguments[1]; | |
if (sanityError) { | |
throw sanityError; | |
} | |
if (process.env.NODE_ENV !== 'production') { | |
var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache); | |
if (warningMessage) { | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils_warning__["a" /* default */])(warningMessage); | |
} | |
} | |
var hasChanged = false; | |
var nextState = {}; | |
for (var i = 0; i < finalReducerKeys.length; i++) { | |
var key = finalReducerKeys[i]; | |
var reducer = finalReducers[key]; | |
var previousStateForKey = state[key]; | |
var nextStateForKey = reducer(previousStateForKey, action); | |
if (typeof nextStateForKey === 'undefined') { | |
var errorMessage = getUndefinedStateErrorMessage(key, action); | |
throw new Error(errorMessage); | |
} | |
nextState[key] = nextStateForKey; | |
hasChanged = hasChanged || nextStateForKey !== previousStateForKey; | |
} | |
return hasChanged ? nextState : state; | |
}; | |
} | |
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2))) | |
/***/ }), | |
/* 29 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(process) {Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createStore__ = __webpack_require__(8); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__combineReducers__ = __webpack_require__(28); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bindActionCreators__ = __webpack_require__(27); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__applyMiddleware__ = __webpack_require__(26); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__compose__ = __webpack_require__(7); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_warning__ = __webpack_require__(9); | |
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "createStore", function() { return __WEBPACK_IMPORTED_MODULE_0__createStore__["a"]; }); | |
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "combineReducers", function() { return __WEBPACK_IMPORTED_MODULE_1__combineReducers__["a"]; }); | |
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return __WEBPACK_IMPORTED_MODULE_2__bindActionCreators__["a"]; }); | |
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return __WEBPACK_IMPORTED_MODULE_3__applyMiddleware__["a"]; }); | |
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return __WEBPACK_IMPORTED_MODULE_4__compose__["a"]; }); | |
/* | |
* This is a dummy function to check if the function name has been altered by minification. | |
* If the function has been minified and NODE_ENV !== 'production', warn the user. | |
*/ | |
function isCrushed() {} | |
if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') { | |
__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__utils_warning__["a" /* default */])('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.'); | |
} | |
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2))) | |
/***/ }), | |
/* 30 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
module.exports = __webpack_require__(31); | |
/***/ }), | |
/* 31 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(global, module) { | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _ponyfill = __webpack_require__(32); | |
var _ponyfill2 = _interopRequireDefault(_ponyfill); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | |
var root; /* global window */ | |
if (typeof self !== 'undefined') { | |
root = self; | |
} else if (typeof window !== 'undefined') { | |
root = window; | |
} else if (typeof global !== 'undefined') { | |
root = global; | |
} else if (true) { | |
root = module; | |
} else { | |
root = Function('return this')(); | |
} | |
var result = (0, _ponyfill2['default'])(root); | |
exports['default'] = result; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(33)(module))) | |
/***/ }), | |
/* 32 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
exports['default'] = symbolObservablePonyfill; | |
function symbolObservablePonyfill(root) { | |
var result; | |
var _Symbol = root.Symbol; | |
if (typeof _Symbol === 'function') { | |
if (_Symbol.observable) { | |
result = _Symbol.observable; | |
} else { | |
result = _Symbol('observable'); | |
_Symbol.observable = result; | |
} | |
} else { | |
result = '@@observable'; | |
} | |
return result; | |
}; | |
/***/ }), | |
/* 33 */ | |
/***/ (function(module, exports) { | |
module.exports = function(module) { | |
if(!module.webpackPolyfill) { | |
module.deprecate = function() {}; | |
module.paths = []; | |
// module.parent = undefined by default | |
if(!module.children) module.children = []; | |
Object.defineProperty(module, "loaded", { | |
enumerable: true, | |
get: function() { | |
return module.l; | |
} | |
}); | |
Object.defineProperty(module, "id", { | |
enumerable: true, | |
get: function() { | |
return module.i; | |
} | |
}); | |
module.webpackPolyfill = 1; | |
} | |
return module; | |
}; | |
/***/ }), | |
/* 34 */ | |
/***/ (function(module, exports) { | |
module.exports = __WEBPACK_EXTERNAL_MODULE_34__; | |
/***/ }), | |
/* 35 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
function __export(m) { | |
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | |
} | |
__export(__webpack_require__(10)); | |
var server_1 = __webpack_require__(11); | |
exports.getDataFromTree = server_1.getDataFromTree; | |
exports.renderToStringWithData = server_1.renderToStringWithData; | |
//# sourceMappingURL=index.js.map | |
/***/ }) | |
/******/ ]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment