Commit 8958256d authored by Axel Bocciarelli's avatar Axel Bocciarelli
Browse files

Merge branch 'with-built-files' into 'master'

Commit built files to fix installation issue in other projects

See merge request !2
parents f795f301 fe6b021d
......@@ -6,7 +6,6 @@ node_modules
# builds
build
dist
.rpt2_cache
# misc
......
import { each, values, camelCase, upperFirst, get, isFunction, isEqual } from 'lodash';
import Immutable from 'seamless-immutable';
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
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;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var ProviderRegistry = function () {
function ProviderRegistry() {
classCallCheck(this, ProviderRegistry);
this.instances = {};
this.started = false;
}
createClass(ProviderRegistry, [{
key: 'start',
value: function start(store) {
this.store = store;
each(this.instances, function (i, k) {
i.start();
i.setStore(store);
});
this.started = true;
}
}, {
key: 'register',
value: function register(key, instance) {
var _this = this;
this.instances[key] = instance;
if (this.started) {
setTimeout(function () {
instance.start();
if (_this.store) instance.setStore(_this.store);
}, 0);
}
}
}]);
return ProviderRegistry;
}();
var ReducerRegistry = function () {
function ReducerRegistry() {
classCallCheck(this, ReducerRegistry);
this.reducers = {};
this.onChange = null;
}
createClass(ReducerRegistry, [{
key: 'getReducers',
value: function getReducers() {
return values(this.reducers).length ? this.reducers : { default: function _default() {
return {};
} };
}
}, {
key: 'register',
value: function register(key, reducer, instance) {
this.reducers[key] = reducer;
if (this.onChange) this.onChange(this.getReducers());
}
}, {
key: 'setOnChange',
value: function setOnChange(fn) {
this.onChange = fn;
}
}]);
return ReducerRegistry;
}();
var Selectors = function () {
function Selectors(key) {
classCallCheck(this, Selectors);
this.selectors = {};
this.key = key;
}
createClass(Selectors, [{
key: 'get',
value: function get$$1(selector, state, extra) {
if (!selector) return state[this.key];
if (this.selectors[selector]) {
if (isFunction(this.selectors[selector])) {
return this.selectors[selector].call(this, state, extra);
}
return get(state, this.selectors[selector]);
}
var fn = 'select' + upperFirst(camelCase(selector));
if (this[fn]) {
return this[fn](state);
}
throw new Error('Cant find a selector ' + selector + ' on ' + this.key + ' Selector');
}
}]);
return Selectors;
}();
var CachedSelectors = function (_Selectors) {
inherits(CachedSelectors, _Selectors);
function CachedSelectors(props) {
classCallCheck(this, CachedSelectors);
var _this = possibleConstructorReturn(this, (CachedSelectors.__proto__ || Object.getPrototypeOf(CachedSelectors)).call(this, props));
_this.cache = {};
_this.doGet = Selectors.prototype.get.bind(_this);
return _this;
}
createClass(CachedSelectors, [{
key: 'get',
value: function get$$1(selector, state, extra) {
var val = this.doGet(selector, state, extra);
var key = selector + ':' + extra;
if (!isEqual(val, this.cache[key])) {
this.cache[key] = val;
return val;
}
return this.cache[key];
}
}]);
return CachedSelectors;
}(Selectors);
var Actions = function () {
function Actions(key) {
classCallCheck(this, Actions);
this.actions = [];
this.asyncActions = {};
this._actions = {};
this.key = key;
}
createClass(Actions, [{
key: 'setSelector',
value: function setSelector(selector) {
this.selector = selector;
}
}, {
key: 'setStore',
value: function setStore(store) {
this.store = store;
}
}, {
key: 'slice',
value: function slice(state) {
return state[this.key];
}
}, {
key: 'start',
value: function start() {
var _this = this;
each(this.actions, function (a) {
return _this.createAction(a);
});
each(this.asyncActions, function (p, a) {
return _this.createAsyncAction(a, p);
});
}
}, {
key: 'createAction',
value: function createAction(type) {
this._actions[type] = {};
}
}, {
key: 'simpleAction',
value: function simpleAction(ty, payload) {
return {
type: ty,
payload: payload
};
}
}, {
key: 'createAsyncAction',
value: function createAsyncAction(type, props) {
this._actions[type] = _extends({
async: true
}, props);
this._actions[type + '_RESOLVED'] = {};
this._actions[type + '_REJECTED'] = {};
}
// https://github.com/civicsource/redux-rsi/blob/master/src/asyncify-action.js
}, {
key: 'asyncifyAction',
value: function asyncifyAction(action) {
return {
request: action,
completed: function completed(response) {
return {
type: action.type + '_RESOLVED',
payload: response,
meta: action.payload // the original payload
};
},
failed: function failed(err) {
return {
type: action.type + '_REJECTED',
payload: err,
meta: action.payload, // the original payload
error: true
};
}
};
}
}, {
key: 'asyncAction',
value: function asyncAction(type, payload) {
var _this2 = this;
var props = this._actions[type];
var asyncAction = this.asyncifyAction(this.simpleAction(type, payload));
return function (dispatch, getState) {
var promise = props.promise(payload, _this2.selector(null, getState()));
if (!promise) {
console.log('No promise for', type, payload);
return null;
}
dispatch(asyncAction.request);
return promise.then(function (response) {
// https://github.com/civicsource/redux-rsi/blob/master/src/create-ajax-action.js
// (removed, breaks then chaining)
dispatch(asyncAction.completed(response));
// Allow building complex actions by calling another function after
// this dispatch
var fn = 'dispatch' + upperFirst(camelCase(type)) + 'ResolvedAfter';
if (_this2[fn]) _this2[fn](response);
// for chaining
return response;
}).catch(function (error) {
console.log('asyncAction error', error);
var msg = error;
if (error.response) {
if (error.response.status === 422) {
msg = 'Invalid Fields: ';
each(error.response.data.description, function (v, k) {
msg += k + ': ' + v + '\n';
});
} else {
msg = error.response.data.error;
}
}
dispatch(asyncAction.failed(msg));
// Allow building complex actions by calling another function after
// this dispatch
var fn = 'dispatch' + upperFirst(camelCase(type)) + 'RejectedAfter';
if (_this2[fn]) _this2[fn](error);
// for chaining
throw error;
});
};
}
}, {
key: 'dispatch',
value: function dispatch(ty, payload) {
if (!(ty in this._actions)) throw new Error(ty + ' not registered on ' + this.key + ' Actions');
var fn = 'dispatch' + upperFirst(camelCase(ty));
if (this[fn]) {
return this.store.dispatch(this[fn](payload));
}
var action = this._actions[ty];
if (action.async) return this.store.dispatch(this.asyncAction(ty, payload));
return this.store.dispatch(this.simpleAction(ty, payload));
}
}, {
key: 'dispatchSimple',
value: function dispatchSimple(ty, payload) {
if (!(ty in this._actions)) throw new Error(ty + ' not registered on ' + this.key + ' Actions');
return this.store.dispatch(this.simpleAction(ty, payload));
}
}]);
return Actions;
}();
var Reducers = function () {
function Reducers() {
classCallCheck(this, Reducers);
this.initialState = {};
}
createClass(Reducers, [{
key: 'merge',
value: function merge(state, newState) {
return Immutable.merge(state, newState);
}
}, {
key: 'mergeDeep',
value: function mergeDeep(state, newState) {
return Immutable.merge(state, newState, { deep: true });
}
}, {
key: 'setIn',
value: function setIn(state, path, value) {
return Immutable.setIn(state, path, value);
}
}, {
key: 'without',
value: function without(object, key) {
return Immutable.without(object, key);
}
}, {
key: 'immutable',
value: function immutable(object) {
return Immutable.from(object);
}
}, {
key: 'reducer',
value: function reducer(state, action) {
var _state = state;
if (!_state) _state = Immutable.from(this.initialState);
var fn = 'on' + upperFirst(camelCase(action.type));
if (this[fn]) {
return this[fn](_state, action);
}
return _state;
}
}]);
return Reducers;
}();
var reducerRegistry = new ReducerRegistry();
var providerRegistry = new ProviderRegistry();
// Provider encapsulates all interactions with store
var Provider = function () {
createClass(Provider, [{
key: 'setStore',
value: function setStore(store) {
this.store = store;
if (this.actions) this.actions.setStore(store);
}
}]);
function Provider(key) {
var _this = this;
classCallCheck(this, Provider);
this.actions = null;
this.reducers = null;
this.selectors = null;
this.selector = function (selector, state, extra) {
if (_this.selectors) {
if (selector) {
return _this.selectors.get(selector, _this.slice(state), extra);
}
return _this.slice(state);
}
return null;
};
this.dispatch = function (action, payload) {
if (_this.actions) {
return _this.actions.dispatch(action, payload);
}
return null;
};
this.key = key;
providerRegistry.register(key, this);
}
// initialise the children classes and register the reducer
// into the registry
createClass(Provider, [{
key: 'start',
value: function start() {
if (this.actions) {
this.actions = new this.actions(this.key);
this.actions.start();
this.actions.setSelector(this.selector);
}
if (this.reducers) this.reducers = new this.reducers(this.key);
if (this.selectors) this.selectors = new this.selectors(this.key);
// register this provider into the reducerRegistry
reducerRegistry.register(this.key, this.reducer.bind(this), this);
return this;
}
// call a reducer
}, {
key: 'reducer',
value: function reducer(state, action) {
if (this.reducers) {
return this.reducers.reducer(state, action);
}
return state;
}
// get the store slice relating to this provider
}, {
key: 'slice',
value: function slice(state) {
return state[this.key];
}
// get a selector from the current slice of the store
// dispatch an action
}]);
return Provider;
}();
export { Selectors, CachedSelectors, Actions, Reducers, reducerRegistry, providerRegistry, Provider };
//# sourceMappingURL=index.es.js.map
{"version":3,"file":"index.es.js","sources":["../src/ProviderRegistry.js","../src/ReducerRegistry.js","../src/Selectors.js","../src/CachedSelectors.js","../src/Actions.js","../src/Reducers.js","../src/index.js"],"sourcesContent":["import { each } from 'lodash'\n\nexport default class ProviderRegistry {\n instances = {}\n\n started = false\n\n start(store) {\n this.store = store\n each(this.instances, (i, k) => {\n i.start()\n i.setStore(store)\n })\n\n this.started = true\n }\n\n register(key, instance) {\n this.instances[key] = instance\n\n if (this.started) {\n setTimeout(() => {\n instance.start()\n if (this.store) instance.setStore(this.store)\n }, 0)\n }\n }\n}\n","import { values } from 'lodash'\n\nexport default class ReducerRegistry {\n reducers = {}\n\n onChange = null\n\n getReducers() {\n return values(this.reducers).length ? this.reducers : { default: () => ({}) }\n }\n\n register(key, reducer, instance) {\n this.reducers[key] = reducer\n if (this.onChange) this.onChange(this.getReducers())\n }\n\n setOnChange(fn) {\n this.onChange = fn\n }\n}\n","import {\n camelCase, upperFirst, get, isFunction\n} from 'lodash'\n\nexport default class Selectors {\n selectors = {}\n\n constructor(key) {\n this.key = key\n }\n\n get(selector, state, extra) {\n if (!selector) return state[this.key]\n\n if (this.selectors[selector]) {\n if (isFunction(this.selectors[selector])) {\n return this.selectors[selector].call(this, state, extra)\n }\n\n return get(state, this.selectors[selector])\n }\n\n const fn = `select${upperFirst(camelCase(selector))}`\n if (this[fn]) {\n return this[fn](state)\n }\n\n throw new Error(`Cant find a selector ${selector} on ${this.key} Selector`)\n }\n}\n","import { isEqual } from 'lodash'\nimport Selectors from './Selectors'\n\nexport default class CachedSelectors extends Selectors {\n constructor(props) {\n super(props)\n this.cache = {}\n this.doGet = Selectors.prototype.get.bind(this)\n }\n\n get(selector, state, extra) {\n const val = this.doGet(selector, state, extra)\n\n const key = `${selector}:${extra}`\n if (!isEqual(val, this.cache[key])) {\n this.cache[key] = val\n return val\n }\n\n return this.cache[key]\n }\n}\n","import { camelCase, upperFirst, each } from 'lodash'\n\nexport default class Actions {\n actions = []\n\n asyncActions = {}\n\n _actions = {}\n\n constructor(key) {\n this.key = key\n }\n\n setSelector(selector) {\n this.selector = selector\n }\n\n setStore(store) {\n this.store = store\n }\n\n slice(state) {\n return state[this.key]\n }\n\n start() {\n each(this.actions, (a) => this.createAction(a))\n each(this.asyncActions, (p, a) => this.createAsyncAction(a, p))\n }\n\n createAction(type) {\n this._actions[type] = {}\n }\n\n simpleAction(ty, payload) {\n return {\n type: ty,\n payload\n }\n }\n\n createAsyncAction(type, props) {\n this._actions[type] = {\n async: true,\n ...props\n }\n\n this._actions[`${type}_RESOLVED`] = {}\n this._actions[`${type}_REJECTED`] = {}\n }\n\n // https://github.com/civicsource/redux-rsi/blob/master/src/asyncify-action.js\n asyncifyAction(action) {\n return {\n request: action,\n completed: (response) => ({\n type: `${action.type}_RESOLVED`,\n payload: response,\n meta: action.payload // the original payload\n }),\n failed: (err) => ({\n type: `${action.type}_REJECTED`,\n payload: err,\n meta: action.payload, // the original payload\n error: true\n })\n }\n }\n\n asyncAction(type, payload) {\n const props = this._actions[type]\n const asyncAction = this.asyncifyAction(this.simpleAction(type, payload))\n\n return (dispatch, getState) => {\n const promise = props.promise(payload, this.selector(null, getState()))\n if (!promise) {\n console.log('No promise for', type, payload)\n return null\n }\n\n dispatch(asyncAction.request)\n return promise.then((response) => {\n // https://github.com/civicsource/redux-rsi/blob/master/src/create-ajax-action.js\n // (removed, breaks then chaining)\n dispatch(asyncAction.completed(response))\n\n // Allow building complex actions by calling another function after\n // this dispatch\n const fn = `dispatch${upperFirst(camelCase(type))}ResolvedAfter`\n if (this[fn]) this[fn](response)\n\n // for chaining\n return response\n }).catch((error) => {\n console.log('asyncAction error', error)\n let msg = error\n if (error.response) {\n if (error.response.status === 422) {\n msg = 'Invalid Fields: '\n each(error.response.data.description, (v, k) => { msg += `${k}: ${v}\\n` })\n } else {\n msg = error.response.data.error\n }\n }\n\n dispatch(asyncAction.failed(msg))\n\n // Allow building complex actions by calling another function after\n // this dispatch\n const fn = `dispatch${upperFirst(camelCase(type))}RejectedAfter`\n if (this[fn]) this[fn](error)\n\n // for chaining\n throw error\n })\n }\n }\n\n dispatch(ty, payload) {\n if (!(ty in this._actions)) throw new Error(`${ty} not registered on ${this.key} Actions`)\n const fn = `dispatch${upperFirst(camelCase(ty))}`\n if (this[fn]) {\n return this.store.dispatch(this[fn](payload))\n }\n const action = this._actions[ty]\n if (action.async) return this.store.dispatch(this.asyncAction(ty, payload))\n return this.store.dispatch(this.simpleAction(ty, payload))\n }\n\n dispatchSimple(ty, payload) {\n if (!(ty in this._actions)) throw new Error(`${ty} not registered on ${this.key} Actions`)\n\n return this.store.dispatch(this.simpleAction(ty, payload))\n }\n}\n","import { camelCase, upperFirst } from 'lodash'\nimport Immutable from 'seamless-immutable'\n\nexport default class Reducers {\n initialState = {}\n\n merge(state, newState) {\n return Immutable.merge(state, newState)\n }\n\n mergeDeep(state, newState) {\n return Immutable.merge(state, newState, { deep: true })\n }\n\n setIn(state, path, value) {\n return Immutable.setIn(state, path, value)\n }\n\n without(object, key) {\n return Immutable.without(object, key)\n }\n\n immutable(object) {\n return Immutable.from(object)\n }\n\n reducer(state, action) {\n let _state = state\n if (!_state) _state = Immutable.from(this.initialState)\n\n const fn = `on${upperFirst(camelCase(action.type))}`\n if (this[fn]) {\n return this[fn](_state, action)\n }\n\n return _state\n }\n}\n","import ProviderRegistry from './ProviderRegistry'\nimport ReducerRegistry from './ReducerRegistry'\n\nexport Selectors from './Selectors'\nexport CachedSelectors from './CachedSelectors'\nexport Actions from './Actions'\nexport Reducers from './Reducers'\n\nexport const reducerRegistry = new ReducerRegistry()\nexport const providerRegistry = new ProviderRegistry()\n\n// Provider encapsulates all interactions with store\nexport class Provider {\n actions = null\n\n reducers = null\n\n selectors = null\n\n setStore(store) {\n this.store = store\n if (this.actions) this.actions.setStore(store)\n }\n\n constructor(key) {\n this.key = key\n providerRegistry.register(key, this)\n }\n\n // initialise the children classes and register the reducer\n // into the registry\n start() {\n if (this.actions) {\n this.actions = new this.actions(this.key)\n this.actions.start()\n this.actions.setSelector(this.selector)\n }\n if (this.reducers) this.reducers = new this.reducers(this.key)\n if (this.selectors) this.selectors = new this.selectors(this.key)\n\n // register this provider into the reducerRegistry\n reducerRegistry.register(this.key, this.reducer.bind(this), this)\n\n return this\n }\n\n // call a reducer\n reducer(state, action) {\n if (this.reducers) {\n return this.reducers.reducer(state, action)\n }\n return state\n }\n\n // get the store slice relating to this provider\n slice(state) {\n return state[this.key]\n }\n\n // get a selector from the current slice of the store\n selector = (selector, state, extra) => {\n if (this.selectors) {\n if (selector) {\n return this.selectors.get(selector, this.slice(state), extra)\n }\n return this.slice(state)\n }\n\n return null\n }\n\n // dispatch an action\n dispatch = (action, payload) => {\n if (this.actions) {\n return this.actions.dispatch(action, payload)\n }\n\n return null\n }\n}\n"],"names":["ProviderRegistry","instances","started","store","i","k","start","setStore","key","instance","ReducerRegistry","reducers","onChange","values","length","default","reducer","getReducers","fn","Selectors","selectors","selector","state","extra","isFunction","call","get","upperFirst","camelCase","Error","CachedSelectors","props","cache","doGet","prototype","bind","val","isEqual","Actions","actions","asyncActions","_actions","a","createAction","p","createAsyncAction","type","ty","payload","action","response","err","asyncAction","asyncifyAction","simpleAction","dispatch","getState","promise","log","request","then","completed","catch","error","msg","status","data","description","v","failed","async","Reducers","initialState","newState","Immutable","merge","deep","path","value","setIn","object","without","from","_state","reducerRegistry","providerRegistry","Provider","slice","register","setSelector"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEqBA;;;SACnBC,YAAY;SAEZC,UAAU;;;;;0BAEJC,OAAO;WACNA,KAAL,GAAaA,KAAb;WACK,KAAKF,SAAV,EAAqB,UAACG,CAAD,EAAIC,CAAJ,EAAU;UAC3BC,KAAF;UACEC,QAAF,CAAWJ,KAAX;OAFF;;WAKKD,OAAL,GAAe,IAAf;;;;6BAGOM,KAAKC,UAAU;;;WACjBR,SAAL,CAAeO,GAAf,IAAsBC,QAAtB;;UAEI,KAAKP,OAAT,EAAkB;mBACL,YAAM;mBACNI,KAAT;cACI,MAAKH,KAAT,EAAgBM,SAASF,QAAT,CAAkB,MAAKJ,KAAvB;SAFlB,EAGG,CAHH;;;;;;;ICnBeO;;;SACnBC,WAAW;SAEXC,WAAW;;;;;kCAEG;aACLC,OAAO,KAAKF,QAAZ,EAAsBG,MAAtB,GAA+B,KAAKH,QAApC,GAA+C,EAAEI,SAAS;iBAAO,EAAP;SAAX,EAAtD;;;;6BAGOP,KAAKQ,SAASP,UAAU;WAC1BE,QAAL,CAAcH,GAAd,IAAqBQ,OAArB;UACI,KAAKJ,QAAT,EAAmB,KAAKA,QAAL,CAAc,KAAKK,WAAL,EAAd;;;;gCAGTC,IAAI;WACTN,QAAL,GAAgBM,EAAhB;;;;;;ICbiBC;qBAGPX,GAAZ,EAAiB;;SAFjBY,SAEiB,GAFL,EAE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,GAAiB,IAAI,KAAKA,SAAT,CAAmB,KAAKZ,GAAxB,CAAjB;;;sBAGJgF,QAAhB,CAAyB,KAAKhF,GAA9B,EAAmC,KAAKQ,OAAL,CAAamB,IAAb,CAAkB,IAAlB,CAAnC,EAA4D,IAA5D;;aAEO,IAAP;;;;;;;4BAIMb,KAnCV,EAmCiB2B,MAnCjB,EAmCyB;UACjB,KAAKtC,QAAT,EAAmB;eACV,KAAKA,QAAL,CAAcK,OAAd,CAAsBM,KAAtB,EAA6B2B,MAA7B,CAAP;;aAEK3B,KAAP;;;;;;;0BAIIA,KA3CR,EA2Ce;aACJA,MAAM,KAAKd,GAAX,CAAP;;;;;;;;;;;;;;"}
\ No newline at end of file
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var lodash = require('lodash');
var Immutable = _interopDefault(require('seamless-immutable'));
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
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;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var ProviderRegistry = function () {
function ProviderRegistry() {
classCallCheck(this, ProviderRegistry);
this.instances = {};
this.started = false;
}
createClass(ProviderRegistry, [{
key: 'start',
value: function start(store) {
this.store = store;
lodash.each(this.instances, function (i, k) {
i.start();
i.setStore(store);
});
this.started = true;
}
}, {
key: 'register',
value: function register(key, instance) {
var _this = this;
this.instances[key