reactive-di
Advanced tools
Comparing version 0.0.26 to 0.0.28
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _annotations = require('../annotations'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,6 +13,2 @@ var _promise = require('babel-runtime/core-js/promise'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
exports.createState = createState; | ||
@@ -60,10 +54,8 @@ | ||
(0, _createClass3.default)(C, [{ | ||
key: 'copy', | ||
value: function copy(rec /*: {v?: string}*/) { | ||
var next = new C(); | ||
next.v = rec.v || this.v; | ||
return next; | ||
} | ||
}]); | ||
C.prototype.copy = function copy(rec /*: {v?: string}*/) { | ||
var next = new C(); | ||
next.v = rec.v || this.v; | ||
return next; | ||
}; | ||
return C; | ||
@@ -85,10 +77,8 @@ }(); | ||
(0, _createClass3.default)(B, [{ | ||
key: 'copy', | ||
value: function copy(rec /*: {v?: number}*/) { | ||
var next = new B(); | ||
next.v = rec.v || this.v; | ||
return next; | ||
} | ||
}]); | ||
B.prototype.copy = function copy(rec /*: {v?: number}*/) { | ||
var next = new B(); | ||
next.v = rec.v || this.v; | ||
return next; | ||
}; | ||
return B; | ||
@@ -107,12 +97,10 @@ }(); | ||
(0, _createClass3.default)(A, [{ | ||
key: 'copy', | ||
value: function copy(rec /*: {b?: B, c?: C, v?: number}*/) { | ||
var next = new A(); | ||
next.b = rec.b || this.b; | ||
next.c = rec.c || this.c; | ||
next.v = rec.v || this.v; | ||
return next; | ||
} | ||
}]); | ||
A.prototype.copy = function copy(rec /*: {b?: B, c?: C, v?: number}*/) { | ||
var next = new A(); | ||
next.b = rec.b || this.b; | ||
next.c = rec.c || this.c; | ||
next.v = rec.v || this.v; | ||
return next; | ||
}; | ||
return A; | ||
@@ -129,10 +117,8 @@ }(); | ||
(0, _createClass3.default)(AppState, [{ | ||
key: 'copy', | ||
value: function copy(rec /*: {a?: A}*/) { | ||
var next = new AppState(); | ||
next.a = rec.a || this.a; | ||
return next; | ||
} | ||
}]); | ||
AppState.prototype.copy = function copy(rec /*: {a?: A}*/) { | ||
var next = new AppState(); | ||
next.a = rec.a || this.a; | ||
return next; | ||
}; | ||
return AppState; | ||
@@ -139,0 +125,0 @@ }(); |
'use strict'; | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _promise = require('babel-runtime/core-js/promise'); | ||
@@ -61,3 +57,3 @@ | ||
model(C); | ||
var resolveData /*: Function*/ = undefined; | ||
var resolveData /*: Function*/ = void 0; | ||
var dataSource = new _promise2.default(function (resolve) { | ||
@@ -77,10 +73,8 @@ resolveData = resolve; | ||
(0, _createClass3.default)(AppState, [{ | ||
key: 'copy', | ||
value: function copy(rec /*: {c?: C}*/) { | ||
var next = new AppState(); | ||
next.c = rec.c || this.c; | ||
return next; | ||
} | ||
}]); | ||
AppState.prototype.copy = function copy(rec /*: {c?: C}*/) { | ||
var next = new AppState(); | ||
next.c = rec.c || this.c; | ||
return next; | ||
}; | ||
return AppState; | ||
@@ -87,0 +81,0 @@ }(); |
'use strict'; | ||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | ||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
@@ -91,3 +87,3 @@ | ||
(0, _classCallCheck3.default)(this, Observer2); | ||
return (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(Observer2).apply(this, arguments)); | ||
return (0, _possibleConstructorReturn3.default)(this, _Observer.apply(this, arguments)); | ||
} | ||
@@ -100,3 +96,3 @@ | ||
var observer2 /*: Observer*/ = new Observer2(); | ||
var observable /*: Observable*/ = undefined; | ||
var observable /*: Observable*/ = void 0; | ||
var bSet = di(bSetter); | ||
@@ -103,0 +99,0 @@ var observableProps = _annotations2.default.observable({ b: B }); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.syncsetter = exports.syncsetterAnnotation = exports.asyncsetter = exports.asyncsetterAnnotation = exports.observable = exports.observableAnnotation = exports.reset = exports.resetAnnotation = exports.pendingLoaderAnnotation = exports.pendingLoader = exports.loader = exports.loaderAnnotation = exports.model = exports.modelAnnotation = exports.factory = exports.factoryAnnotation = exports.meta = exports.klassAnnotation = exports.klass = exports.alias = undefined; | ||
@@ -7,0 +5,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -19,6 +17,2 @@ var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _zenObservable = require('zen-observable'); | ||
@@ -76,4 +70,5 @@ | ||
if (_target.base.isRecalculate) { | ||
var data = _target.resolve(); | ||
for (var j = 0, k = _observers.length; j < k; j++) { | ||
_observers[j].next(_target.resolve()); | ||
_observers[j].next(data); | ||
} | ||
@@ -85,27 +80,25 @@ } | ||
(0, _createClass3.default)(ListenerManagerImpl, [{ | ||
key: 'add', | ||
value: function add(target /*: ResolvableDep<V>*/) { | ||
var self = this; | ||
var observers /*: Array<Observer<V, E>>*/ = []; | ||
var listener /*: Listener*/ = { | ||
observers: observers, | ||
target: target | ||
}; | ||
self._listeners.push(listener); | ||
ListenerManagerImpl.prototype.add = function add(target /*: ResolvableDep<V>*/) { | ||
var self = this; | ||
var observers /*: Array<Observer<V, E>>*/ = []; | ||
var listener /*: Listener*/ = { | ||
observers: observers, | ||
target: target | ||
}; | ||
self._listeners.push(listener); | ||
function subscriberFn(observer /*: SubscriptionObserver*/) /*: Subscription*/ { | ||
function listenersFilter(dep /*: SubscriptionObserver*/) /*: boolean*/ { | ||
return dep !== observer; | ||
} | ||
function unsubscribe() /*: void*/ { | ||
listener.observers = listener.observers.filter(listenersFilter); | ||
} | ||
listener.observers.push(observer); | ||
return { unsubscribe: unsubscribe }; | ||
function subscriberFn(observer /*: SubscriptionObserver*/) /*: () => void*/ { | ||
function listenersFilter(dep /*: SubscriptionObserver*/) /*: boolean*/ { | ||
return dep !== observer; | ||
} | ||
function unsubscribe() /*: void*/ { | ||
listener.observers = listener.observers.filter(listenersFilter); | ||
} | ||
listener.observers.push(observer); | ||
return unsubscribe; | ||
} | ||
return new _zenObservable2.default(subscriberFn); | ||
} | ||
}]); | ||
return new _zenObservable2.default(subscriberFn); | ||
}; | ||
return ListenerManagerImpl; | ||
@@ -131,86 +124,77 @@ }(); | ||
(0, _createClass3.default)(AnnotationResolverImpl, [{ | ||
key: 'newRoot', | ||
value: function newRoot() { | ||
return new AnnotationResolverImpl(this.middlewares, this._deps, this.createCursor, this._plugins, this._idCreator, this.listeners, this._cache); | ||
AnnotationResolverImpl.prototype.newRoot = function newRoot() { | ||
return new AnnotationResolverImpl(this.middlewares, this._deps, this.createCursor, this._plugins, this._idCreator, this.listeners, this._cache); | ||
}; | ||
AnnotationResolverImpl.prototype.begin = function begin(dep /*: Dep*/) { | ||
this._parents.push(new _set2.default()); | ||
this._cache[dep.base.id] = dep; | ||
}; | ||
AnnotationResolverImpl.prototype.end = function end(dep /*: T*/) { | ||
var parents = this._parents; | ||
var cache = this._cache; | ||
var depSet /*: Set<DepId>*/ = parents.pop(); | ||
var relations = dep.base.relations; | ||
var plugin /*: Plugin*/ = this._plugins[dep.kind]; | ||
function iteratePathSet(relationId /*: DepId*/) /*: void*/ { | ||
var target /*: ResolvableDep*/ = cache[relationId]; | ||
relations.push(relationId); | ||
plugin.finalize(dep, target); | ||
} | ||
}, { | ||
key: 'begin', | ||
value: function begin(dep /*: Dep*/) { | ||
this._parents.push(new _set2.default()); | ||
this._cache[dep.base.id] = dep; | ||
depSet.forEach(iteratePathSet); | ||
}; | ||
AnnotationResolverImpl.prototype.addRelation = function addRelation(id /*: DepId*/) { | ||
var parents = this._parents; | ||
for (var i = 0, l = parents.length; i < l; i++) { | ||
parents[i].add(id); | ||
} | ||
}, { | ||
key: 'end', | ||
value: function end(dep /*: T*/) { | ||
var parents = this._parents; | ||
var cache = this._cache; | ||
}; | ||
var depSet /*: Set<DepId>*/ = parents.pop(); | ||
var relations = dep.base.relations; | ||
AnnotationResolverImpl.prototype.createId = function createId() { | ||
return this._idCreator.createId(); | ||
}; | ||
var plugin /*: Plugin*/ = this._plugins[dep.kind]; | ||
function iteratePathSet(relationId /*: DepId*/) /*: void*/ { | ||
var target /*: ResolvableDep*/ = cache[relationId]; | ||
relations.push(relationId); | ||
plugin.finalize(dep, target); | ||
AnnotationResolverImpl.prototype.resolveAnnotation = function resolveAnnotation(annotation /*: Annotation*/) { | ||
var dep /*: ?Dep*/ = this._cache[annotation.id]; | ||
if (!dep) { | ||
var plugin /*: ?Plugin*/ = this._plugins[annotation.kind]; | ||
if (!plugin) { | ||
throw new Error('Plugin not found for annotation ' + (0, _getFunctionName2.default)(annotation.target)); | ||
} | ||
depSet.forEach(iteratePathSet); | ||
} | ||
}, { | ||
key: 'addRelation', | ||
value: function addRelation(id /*: DepId*/) { | ||
plugin.create(annotation, (this /*: AnnotationResolver*/)); | ||
dep = this._cache[annotation.id]; | ||
} else if (this._parents.length) { | ||
var parents = this._parents; | ||
var relations = dep.base.relations; | ||
for (var i = 0, l = parents.length; i < l; i++) { | ||
parents[i].add(id); | ||
for (var j = 0, k = parents.length; j < k; j++) { | ||
var parent /*: Set<DepId>*/ = parents[j]; | ||
for (var i = 0, l = relations.length; i < l; i++) { | ||
parent.add(relations[i]); | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'createId', | ||
value: function createId() { | ||
return this._idCreator.createId(); | ||
} | ||
}, { | ||
key: 'resolveAnnotation', | ||
value: function resolveAnnotation(annotation /*: Annotation*/) { | ||
var dep /*: ?Dep*/ = this._cache[annotation.id]; | ||
if (!dep) { | ||
var plugin /*: ?Plugin*/ = this._plugins[annotation.kind]; | ||
if (!plugin) { | ||
throw new Error('Plugin not found for annotation ' + (0, _getFunctionName2.default)(annotation.target)); | ||
} | ||
plugin.create(annotation, (this /*: AnnotationResolver*/)); | ||
dep = this._cache[annotation.id]; | ||
} else if (this._parents.length) { | ||
var parents = this._parents; | ||
var relations = dep.base.relations; | ||
for (var j = 0, k = parents.length; j < k; j++) { | ||
var parent /*: Set<DepId>*/ = parents[j]; | ||
for (var i = 0, l = relations.length; i < l; i++) { | ||
parent.add(relations[i]); | ||
} | ||
} | ||
} | ||
return dep; | ||
}; | ||
return dep; | ||
AnnotationResolverImpl.prototype._getAnnotation = function _getAnnotation(annotatedDep /*: Dependency*/) { | ||
var annotation /*: ?Annotation*/ = this._deps.get(annotatedDep); | ||
if (!annotation) { | ||
throw new Error('Can\'t find annotation for ' + (0, _getFunctionName2.default)(annotatedDep)); | ||
} | ||
}, { | ||
key: '_getAnnotation', | ||
value: function _getAnnotation(annotatedDep /*: Dependency*/) { | ||
var annotation /*: ?Annotation*/ = this._deps.get(annotatedDep); | ||
if (!annotation) { | ||
throw new Error('Can\'t find annotation for ' + (0, _getFunctionName2.default)(annotatedDep)); | ||
} | ||
return annotation; | ||
} | ||
}, { | ||
key: 'resolve', | ||
value: function resolve(annotatedDep /*: Dependency|Annotation*/) { | ||
return this.resolveAnnotation((typeof annotatedDep === 'undefined' ? 'undefined' : (0, _typeof3.default)(annotatedDep)) === 'object' ? annotatedDep : this._getAnnotation(annotatedDep)); | ||
} | ||
}]); | ||
return annotation; | ||
}; | ||
AnnotationResolverImpl.prototype.resolve = function resolve(annotatedDep /*: Dependency|Annotation*/) { | ||
return this.resolveAnnotation((typeof annotatedDep === 'undefined' ? 'undefined' : (0, _typeof3.default)(annotatedDep)) === 'object' ? annotatedDep : this._getAnnotation(annotatedDep)); | ||
}; | ||
return AnnotationResolverImpl; | ||
@@ -217,0 +201,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -31,8 +25,6 @@ | ||
(0, _createClass3.default)(DefaultIdCreator, [{ | ||
key: 'createId', | ||
value: function createId() { | ||
return this._salt + '.' + ++this._lastId; | ||
} | ||
}]); | ||
DefaultIdCreator.prototype.createId = function createId() { | ||
return this._salt + '.' + ++this._lastId; | ||
}; | ||
return DefaultIdCreator; | ||
@@ -39,0 +31,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _map = require('babel-runtime/core-js/map'); | ||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | ||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
@@ -20,6 +14,2 @@ | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
@@ -29,6 +19,2 @@ | ||
var _get2 = require('babel-runtime/helpers/get'); | ||
var _get3 = _interopRequireDefault(_get2); | ||
var _inherits2 = require('babel-runtime/helpers/inherits'); | ||
@@ -85,3 +71,3 @@ | ||
var _this = (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(AnnotationMap).call(this)); | ||
var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this)); | ||
@@ -103,25 +89,22 @@ for (var i = 0, l = deps.length; i < l; i++) { | ||
(0, _createClass3.default)(AnnotationMap, [{ | ||
key: 'has', | ||
value: function has(key /*: K*/) { | ||
if (!(0, _get3.default)((0, _getPrototypeOf2.default)(AnnotationMap.prototype), 'has', this).call(this, key)) { | ||
return this._driver.hasAnnotation(key); | ||
AnnotationMap.prototype.has = function has(key /*: K*/) { | ||
if (!_Map.prototype.has.call(this, key)) { | ||
return this._driver.hasAnnotation(key); | ||
} | ||
return true; | ||
}; | ||
AnnotationMap.prototype.get /*:: <V: Annotation> */ = function get(key /*: K*/) { | ||
// eslint-disable-line | ||
var value /*: ?V*/ = (_Map.prototype.get.call(this, key) /*: any*/); | ||
if (!value) { | ||
value = this._driver.getAnnotation(key); | ||
if (value) { | ||
this.set(key, value); | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get( /*:: <V: Annotation> */key /*: K*/) { | ||
// eslint-disable-line | ||
var value /*: ?V*/ = ((0, _get3.default)((0, _getPrototypeOf2.default)(AnnotationMap.prototype), 'get', this).call(this, key) /*: any*/); | ||
if (!value) { | ||
value = this._driver.getAnnotation(key); | ||
if (value) { | ||
this.set(key, value); | ||
} | ||
} | ||
return value; | ||
} | ||
}]); | ||
return value; | ||
}; | ||
return AnnotationMap; | ||
@@ -128,0 +111,0 @@ }(_map2.default); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _ClassPlugin = require('./plugins/class/ClassPlugin'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _symbol = require('babel-runtime/core-js/symbol'); | ||
@@ -38,27 +32,23 @@ | ||
(0, _createClass3.default)(SymbolMetaDriver, [{ | ||
key: 'annotate', | ||
value: function annotate(dep /*: T*/, annotation /*: A*/) { | ||
// eslint-disable-line | ||
if ((dep /*: Function*/)[metaSymbol]) { | ||
throw new Error('Annotation already defined for ' + ((dep /*: Function*/).displayName || String(dep))); | ||
} | ||
(dep /*: Function*/)[metaSymbol] = annotation; // eslint-disable-line | ||
return dep; | ||
SymbolMetaDriver.prototype.annotate = function annotate(dep /*: T*/, annotation /*: A*/) { | ||
// eslint-disable-line | ||
if ((dep /*: Function*/)[metaSymbol]) { | ||
throw new Error('Annotation already defined for ' + ((dep /*: Function*/).displayName || String(dep))); | ||
} | ||
}, { | ||
key: 'hasAnnotation', | ||
value: function hasAnnotation(dep /*: Dependency*/) { | ||
return !!(dep /*: Function*/)[metaSymbol]; | ||
(dep /*: Function*/)[metaSymbol] = annotation; // eslint-disable-line | ||
return dep; | ||
}; | ||
SymbolMetaDriver.prototype.hasAnnotation = function hasAnnotation(dep /*: Dependency*/) { | ||
return !!(dep /*: Function*/)[metaSymbol]; | ||
}; | ||
SymbolMetaDriver.prototype.getAnnotation = function getAnnotation(dep /*: Dependency<V>*/) { | ||
var annotation /*: A*/ = (dep /*: Function*/)[metaSymbol]; | ||
if (!annotation || !annotation.kind) { | ||
throw new TypeError('Can\'t get not annotated dependency: ' + ((dep /*: Function*/).displayName || String(dep))); | ||
} | ||
}, { | ||
key: 'getAnnotation', | ||
value: function getAnnotation(dep /*: Dependency<V>*/) { | ||
var annotation /*: A*/ = (dep /*: Function*/)[metaSymbol]; | ||
if (!annotation || !annotation.kind) { | ||
throw new TypeError('Can\'t get not annotated dependency: ' + ((dep /*: Function*/).displayName || String(dep))); | ||
} | ||
return annotation; | ||
} | ||
}]); | ||
return annotation; | ||
}; | ||
return SymbolMetaDriver; | ||
@@ -65,0 +55,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.merge = exports.getFunctionName = exports.createPureStateDi = exports.BaseCollection = exports.SymbolMetaDriver = exports.DefaultIdCreator = exports.defaultPlugins = undefined; | ||
@@ -7,0 +5,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.default = createPureCursorCreator; | ||
@@ -7,0 +5,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _typeof2 = require('babel-runtime/helpers/typeof'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.alias = alias; | ||
@@ -7,0 +5,0 @@ /*:: import type {AliasAnnotation} from 'reactive-di/i/plugins/aliasInterfaces'*/ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.ClassDepImpl = undefined; | ||
@@ -12,6 +10,2 @@ | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _defaultFinalizer = require('../../pluginsCommon/defaultFinalizer'); | ||
@@ -59,24 +53,21 @@ | ||
(0, _createClass3.default)(ClassDepImpl, [{ | ||
key: 'resolve', | ||
value: function resolve() { | ||
if (!this.base.isRecalculate) { | ||
return this._value; | ||
} | ||
var args = (0, _resolveDeps2.default)(this._depArgs); | ||
var obj /*: V*/ = (0, _fastCall.fastCreateObject)(this._target, args.deps); | ||
if (args.middlewares) { | ||
obj = (0, _createProxy.createObjectProxy)(obj, args.middlewares); | ||
} | ||
this.base.isRecalculate = false; | ||
this._value = obj; | ||
ClassDepImpl.prototype.resolve = function resolve() { | ||
if (!this.base.isRecalculate) { | ||
return this._value; | ||
} | ||
}, { | ||
key: 'init', | ||
value: function init(depArgs /*: DepArgs*/) { | ||
this._depArgs = depArgs; | ||
var args = (0, _resolveDeps2.default)(this._depArgs); | ||
var obj /*: V*/ = (0, _fastCall.fastCreateObject)(this._target, args.deps); | ||
if (args.middlewares) { | ||
obj = (0, _createProxy.createObjectProxy)(obj, args.middlewares); | ||
} | ||
}]); | ||
this.base.isRecalculate = false; | ||
this._value = obj; | ||
return this._value; | ||
}; | ||
ClassDepImpl.prototype.init = function init(depArgs /*: DepArgs*/) { | ||
this._depArgs = depArgs; | ||
}; | ||
return ClassDepImpl; | ||
@@ -95,18 +86,15 @@ }(); | ||
(0, _createClass3.default)(ClassPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: ClassAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
annotation.id = acc.createId(); // eslint-disable-line | ||
var dep /*: ClassDepImpl<V>*/ = new ClassDepImpl(annotation); | ||
var resolver = new _DepsResolverImpl2.default(acc); | ||
acc.begin(dep); | ||
dep.init(resolver.getDeps(annotation.deps, annotation.target, dep.base.tags)); | ||
acc.end(dep); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: ClassDep*/, target /*: Dep*/) { | ||
(0, _defaultFinalizer2.default)(dep.base, target); | ||
} | ||
}]); | ||
ClassPlugin.prototype.create = function create(annotation /*: ClassAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
annotation.id = acc.createId(); // eslint-disable-line | ||
var dep /*: ClassDepImpl<V>*/ = new ClassDepImpl(annotation); | ||
var resolver = new _DepsResolverImpl2.default(acc); | ||
acc.begin(dep); | ||
dep.init(resolver.getDeps(annotation.deps, annotation.target, dep.base.tags)); | ||
acc.end(dep); | ||
}; | ||
ClassPlugin.prototype.finalize = function finalize(dep /*: ClassDep*/, target /*: Dep*/) { | ||
(0, _defaultFinalizer2.default)(dep.base, target); | ||
}; | ||
return ClassPlugin; | ||
@@ -113,0 +101,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.klass = klass; | ||
@@ -7,0 +5,0 @@ exports.klassAnnotation = klassAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.factory = factory; | ||
@@ -7,0 +5,0 @@ exports.factoryAnnotation = factoryAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.FactoryDepImpl = undefined; | ||
@@ -12,6 +10,2 @@ | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _defaultFinalizer = require('../../pluginsCommon/defaultFinalizer'); | ||
@@ -64,33 +58,31 @@ | ||
(0, _createClass3.default)(FactoryDepImpl, [{ | ||
key: 'init', | ||
value: function init(depArgs /*: DepArgs*/) { | ||
this._depArgs = depArgs; | ||
FactoryDepImpl.prototype.init = function init(depArgs /*: DepArgs*/) { | ||
this._depArgs = depArgs; | ||
}; | ||
FactoryDepImpl.prototype.resolve = function resolve() { | ||
if (!this.base.isRecalculate) { | ||
return this._value; | ||
} | ||
}, { | ||
key: 'resolve', | ||
value: function resolve() { | ||
if (!this.base.isRecalculate) { | ||
return this._value; | ||
} | ||
var _resolveDeps = (0, _resolveDeps3.default)(this._depArgs); | ||
var _resolveDeps = (0, _resolveDeps3.default)(this._depArgs); | ||
var deps = _resolveDeps.deps; | ||
var middlewares = _resolveDeps.middlewares; | ||
// debugger | ||
var deps = _resolveDeps.deps; | ||
var middlewares = _resolveDeps.middlewares; | ||
// debugger | ||
var fn /*: V*/ = (0, _fastCall.fastCall)(this._target, deps); | ||
if (middlewares) { | ||
if (typeof fn !== 'function') { | ||
throw new Error('No callable returns from ' + this.base.displayName); | ||
} | ||
fn = (0, _createProxy.createFunctionProxy)(fn, middlewares); | ||
var fn /*: V*/ = void 0; | ||
fn = (0, _fastCall.fastCall)(this._target, deps); | ||
if (middlewares) { | ||
if (typeof fn !== 'function') { | ||
throw new Error('No callable returns from ' + this.base.displayName); | ||
} | ||
this._value = fn; | ||
this.base.isRecalculate = false; | ||
fn = (0, _createProxy.createFunctionProxy)(fn, middlewares); | ||
} | ||
this._value = fn; | ||
this.base.isRecalculate = false; | ||
return this._value; | ||
} | ||
}]); | ||
return this._value; | ||
}; | ||
return FactoryDepImpl; | ||
@@ -109,18 +101,15 @@ }(); | ||
(0, _createClass3.default)(FactoryPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: FactoryAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
annotation.id = acc.createId(); // eslint-disable-line | ||
var dep = new FactoryDepImpl(annotation); | ||
var resolver = new _DepsResolverImpl2.default(acc); | ||
acc.begin(dep); | ||
dep.init(resolver.getDeps(annotation.deps, annotation.target, dep.base.tags)); | ||
acc.end(dep); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: FactoryDep*/, target /*: AnyDep*/) { | ||
(0, _defaultFinalizer2.default)(dep.base, target); | ||
} | ||
}]); | ||
FactoryPlugin.prototype.create = function create(annotation /*: FactoryAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
annotation.id = acc.createId(); // eslint-disable-line | ||
var dep = new FactoryDepImpl(annotation); | ||
var resolver = new _DepsResolverImpl2.default(acc); | ||
acc.begin(dep); | ||
dep.init(resolver.getDeps(annotation.deps, annotation.target, dep.base.tags)); | ||
acc.end(dep); | ||
}; | ||
FactoryPlugin.prototype.finalize = function finalize(dep /*: FactoryDep*/, target /*: AnyDep*/) { | ||
(0, _defaultFinalizer2.default)(dep.base, target); | ||
}; | ||
return FactoryPlugin; | ||
@@ -127,0 +116,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.loader = loader; | ||
@@ -7,0 +5,0 @@ exports.pendingLoader = pendingLoader; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,6 +13,2 @@ var _promise = require('babel-runtime/core-js/promise'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _defaultFinalizer = require('../../pluginsCommon/defaultFinalizer'); | ||
@@ -57,33 +51,29 @@ | ||
(0, _createClass3.default)(LoaderDepImpl, [{ | ||
key: 'init', | ||
value: function init(setterDep /*: AsyncSetterDep<V>*/, model /*: ModelDep<V>*/) { | ||
this._setterDep = setterDep; | ||
this._model = model; | ||
LoaderDepImpl.prototype.init = function init(setterDep /*: AsyncSetterDep<V>*/, model /*: ModelDep<V>*/) { | ||
this._setterDep = setterDep; | ||
this._model = model; | ||
}; | ||
LoaderDepImpl.prototype.reset = function reset() { | ||
this._setterDep.reset(); | ||
this._setter = null; | ||
this.base.isRecalculate = true; | ||
}; | ||
LoaderDepImpl.prototype.resolve = function resolve() { | ||
if (!this.base.isRecalculate) { | ||
return this._value; | ||
} | ||
}, { | ||
key: 'reset', | ||
value: function reset() { | ||
this._setterDep.reset(); | ||
this._setter = null; | ||
this.base.isRecalculate = true; | ||
var setter /*: SetFn*/ = this._setterDep.resolve(); | ||
if (this._setter !== setter) { | ||
this._setter = setter; | ||
_promise2.default.resolve().then(setter); | ||
} | ||
}, { | ||
key: 'resolve', | ||
value: function resolve() { | ||
if (!this.base.isRecalculate) { | ||
return this._value; | ||
} | ||
var setter /*: SetFn*/ = this._setterDep.resolve(); | ||
if (this._setter !== setter) { | ||
this._setter = setter; | ||
_promise2.default.resolve().then(setter); | ||
} | ||
this.base.isRecalculate = false; | ||
this._value = this._model.resolve(); | ||
return this._value; | ||
}; | ||
this.base.isRecalculate = false; | ||
this._value = this._model.resolve(); | ||
return this._value; | ||
} | ||
}]); | ||
return LoaderDepImpl; | ||
@@ -102,37 +92,34 @@ }(); | ||
(0, _createClass3.default)(LoaderPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: LoaderAnnotation<V, E>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var dep /*: LoaderDepImpl<V>*/ = new LoaderDepImpl(annotation); | ||
acc.begin(dep); | ||
var model /*: ModelDep*/ = acc.resolve(annotation.model); | ||
if (model.kind !== 'model') { | ||
throw new Error('Not an model ' + model.base.displayName + ' in ' + dep.base.displayName); | ||
} | ||
LoaderPlugin.prototype.create = function create(annotation /*: LoaderAnnotation<V, E>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var dep /*: LoaderDepImpl<V>*/ = new LoaderDepImpl(annotation); | ||
acc.begin(dep); | ||
var model /*: ModelDep*/ = acc.resolve(annotation.model); | ||
if (model.kind !== 'model') { | ||
throw new Error('Not an model ' + model.base.displayName + ' in ' + dep.base.displayName); | ||
} | ||
var asyncSetterAnnotation /*: AsyncSetterAnnotation<V, E>*/ = { | ||
kind: 'asyncsetter', | ||
id: id + '.asyncsetter', | ||
isPending: annotation.isPending, | ||
model: annotation.model, | ||
deps: annotation.deps, | ||
target: annotation.target | ||
}; | ||
var asyncSetterAnnotation /*: AsyncSetterAnnotation<V, E>*/ = { | ||
kind: 'asyncsetter', | ||
id: id + '.asyncsetter', | ||
isPending: annotation.isPending, | ||
model: annotation.model, | ||
deps: annotation.deps, | ||
target: annotation.target | ||
}; | ||
var setterDep /*: AsyncSetterDep*/ = acc.resolveAnnotation(asyncSetterAnnotation); | ||
if (setterDep.kind !== 'asyncsetter') { | ||
throw new Error('Not a setter: ' + setterDep.base.displayName + ' in ' + dep.base.displayName); | ||
} | ||
var setterDep /*: AsyncSetterDep*/ = acc.resolveAnnotation(asyncSetterAnnotation); | ||
if (setterDep.kind !== 'asyncsetter') { | ||
throw new Error('Not a setter: ' + setterDep.base.displayName + ' in ' + dep.base.displayName); | ||
} | ||
dep.init(setterDep, model); | ||
dep.init(setterDep, model); | ||
acc.end(dep); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: LoaderDep*/, target /*: Dep*/) { | ||
(0, _defaultFinalizer2.default)(dep.base, target); | ||
} | ||
}]); | ||
acc.end(dep); | ||
}; | ||
LoaderPlugin.prototype.finalize = function finalize(dep /*: LoaderDep*/, target /*: Dep*/) { | ||
(0, _defaultFinalizer2.default)(dep.base, target); | ||
}; | ||
return LoaderPlugin; | ||
@@ -139,0 +126,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.reset = reset; | ||
@@ -7,0 +5,0 @@ exports.resetAnnotation = resetAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _pluginImpls = require('../../pluginsCommon/pluginImpls'); | ||
@@ -47,8 +41,6 @@ | ||
(0, _createClass3.default)(ResetDepImpl, [{ | ||
key: 'resolve', | ||
value: function resolve() { | ||
return this._value; | ||
} | ||
}]); | ||
ResetDepImpl.prototype.resolve = function resolve() { | ||
return this._value; | ||
}; | ||
return ResetDepImpl; | ||
@@ -67,19 +59,16 @@ }(); | ||
(0, _createClass3.default)(ResetPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: ResetAnnotation<V, E>*/, acc /*: AnnotationResolver*/) { | ||
var loaderDep /*: LoaderDep<V>*/ = acc.resolve(annotation.target); | ||
annotation.id = loaderDep.base.id + '.reset'; // eslint-disable-line | ||
if (loaderDep.kind !== 'loader') { | ||
throw new Error('Not a loader as target in ' + loaderDep.base.displayName); | ||
} | ||
var dep /*: ResetDep*/ = new ResetDepImpl(annotation, loaderDep); | ||
acc.begin(dep); | ||
acc.end(dep); | ||
ResetPlugin.prototype.create = function create(annotation /*: ResetAnnotation<V, E>*/, acc /*: AnnotationResolver*/) { | ||
var loaderDep /*: LoaderDep<V>*/ = acc.resolve(annotation.target); | ||
annotation.id = loaderDep.base.id + '.reset'; // eslint-disable-line | ||
if (loaderDep.kind !== 'loader') { | ||
throw new Error('Not a loader as target in ' + loaderDep.base.displayName); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: ResetDep*/, target /*: Dep*/) {} // eslint-disable-line | ||
var dep /*: ResetDep*/ = new ResetDepImpl(annotation, loaderDep); | ||
acc.begin(dep); | ||
acc.end(dep); | ||
}; | ||
}]); | ||
ResetPlugin.prototype.finalize = function finalize(dep /*: ResetDep*/, target /*: Dep*/) {}; // eslint-disable-line | ||
return ResetPlugin; | ||
@@ -86,0 +75,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.meta = meta; | ||
@@ -7,0 +5,0 @@ /*:: import type {Dependency} from 'reactive-di/i/annotationInterfaces'*/ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _merge = require('../../utils/merge'); | ||
@@ -89,23 +83,21 @@ | ||
(0, _createClass3.default)(MetaDepImpl, [{ | ||
key: 'resolve', | ||
value: function resolve() { | ||
var base = this.base; | ||
var sources = this.sources; | ||
MetaDepImpl.prototype.resolve = function resolve() { | ||
var base = this.base; | ||
var sources = this.sources; | ||
if (!base.isRecalculate) { | ||
return this._value; | ||
} | ||
var meta /*: EntityMeta<E>*/ = new _pluginImpls.EntityMetaImpl({ | ||
fulfilled: true | ||
}); | ||
for (var i = 0, l = sources.length; i < l; i++) { | ||
var sourceDep = sources[i]; | ||
updateMeta(meta, sourceDep.meta); | ||
} | ||
this._value = (0, _merge2.default)(this._value, meta); | ||
base.isRecalculate = false; | ||
if (!base.isRecalculate) { | ||
return this._value; | ||
} | ||
}]); | ||
var meta /*: EntityMeta<E>*/ = new _pluginImpls.EntityMetaImpl({ | ||
fulfilled: true | ||
}); | ||
for (var i = 0, l = sources.length; i < l; i++) { | ||
var sourceDep = sources[i]; | ||
updateMeta(meta, sourceDep.meta); | ||
} | ||
this._value = (0, _merge2.default)(this._value, meta); | ||
base.isRecalculate = false; | ||
return this._value; | ||
}; | ||
return MetaDepImpl; | ||
@@ -124,26 +116,23 @@ }(); | ||
(0, _createClass3.default)(MetaPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: MetaAnnotation*/, acc /*: AnnotationResolver*/) { | ||
var id /*: DepId*/ = annotation.id = acc.createId(); // eslint-disable-line | ||
var dep /*: MetaDep<E>*/ = new MetaDepImpl(annotation); | ||
MetaPlugin.prototype.create = function create(annotation /*: MetaAnnotation*/, acc /*: AnnotationResolver*/) { | ||
var id /*: DepId*/ = annotation.id = acc.createId(); // eslint-disable-line | ||
var dep /*: MetaDep<E>*/ = new MetaDepImpl(annotation); | ||
acc.addRelation(id); | ||
var newAcc /*: AnnotationResolver*/ = acc.newRoot(); | ||
newAcc.begin(dep); | ||
var deps = annotation.deps; | ||
for (var i = 0, l = deps.length; i < l; i++) { | ||
newAcc.resolve(deps[i]); | ||
} | ||
newAcc.end(dep); | ||
acc.addRelation(id); | ||
var newAcc /*: AnnotationResolver*/ = acc.newRoot(); | ||
newAcc.begin(dep); | ||
var deps = annotation.deps; | ||
for (var i = 0, l = deps.length; i < l; i++) { | ||
newAcc.resolve(deps[i]); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: MetaDep<E>*/, target /*: Dep|AsyncSetterDep*/) { | ||
if (target.kind === 'asyncsetter') { | ||
target.metaOwners.push(dep.base); | ||
dep.sources.push((target /*: MetaSource*/)); | ||
} | ||
newAcc.end(dep); | ||
}; | ||
MetaPlugin.prototype.finalize = function finalize(dep /*: MetaDep<E>*/, target /*: Dep|AsyncSetterDep*/) { | ||
if (target.kind === 'asyncsetter') { | ||
target.metaOwners.push(dep.base); | ||
dep.sources.push((target /*: MetaSource*/)); | ||
} | ||
}]); | ||
}; | ||
return MetaPlugin; | ||
@@ -150,0 +139,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _pluginImpls = require('../../../pluginsCommon/pluginImpls'); | ||
@@ -51,41 +45,36 @@ | ||
(0, _createClass3.default)(ModelDepImpl, [{ | ||
key: 'reset', | ||
value: function reset() { | ||
var dataOwners = this.dataOwners; | ||
ModelDepImpl.prototype.reset = function reset() { | ||
var dataOwners = this.dataOwners; | ||
for (var i = 0, l = dataOwners.length; i < l; i++) { | ||
dataOwners[i].isRecalculate = true; | ||
} | ||
for (var i = 0, l = dataOwners.length; i < l; i++) { | ||
dataOwners[i].isRecalculate = true; | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(value /*: V*/) { | ||
var isChanged /*: boolean*/ = this._cursor.set(value); | ||
if (isChanged) { | ||
this._value = value; | ||
this.reset(); | ||
} | ||
}; | ||
return isChanged; | ||
ModelDepImpl.prototype.set = function set(value /*: V*/) { | ||
var isChanged /*: boolean*/ = this._cursor.set(value); | ||
if (isChanged) { | ||
this._value = value; | ||
this.reset(); | ||
} | ||
}, { | ||
key: 'setFromJS', | ||
value: function setFromJS(data /*: Object*/) { | ||
this.set(this._fromJS(data)); | ||
} | ||
}, { | ||
key: 'resolve', | ||
value: function resolve() { | ||
var base = this.base; | ||
if (!base.isRecalculate) { | ||
return this._value; | ||
} | ||
base.isRecalculate = false; | ||
this._value = this._cursor.get(); | ||
return isChanged; | ||
}; | ||
ModelDepImpl.prototype.setFromJS = function setFromJS(data /*: Object*/) { | ||
this.set(this._fromJS(data)); | ||
}; | ||
ModelDepImpl.prototype.resolve = function resolve() { | ||
var base = this.base; | ||
if (!base.isRecalculate) { | ||
return this._value; | ||
} | ||
}]); | ||
base.isRecalculate = false; | ||
this._value = this._cursor.get(); | ||
return this._value; | ||
}; | ||
return ModelDepImpl; | ||
@@ -92,0 +81,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.model = model; | ||
@@ -7,0 +5,0 @@ exports.modelAnnotation = modelAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _ModelDepImpl = require('./impl/ModelDepImpl'); | ||
@@ -43,39 +37,36 @@ | ||
(0, _createClass3.default)(ModelPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: ModelAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
var id /*: string*/ = annotation.id = acc.createId(); // eslint-disable-line | ||
var cursor /*: Cursor<V>*/ = acc.createCursor(annotation.statePath); | ||
var dep /*: ModelDep<V>*/ = new _ModelDepImpl2.default(annotation, cursor); | ||
acc.addRelation(id); | ||
ModelPlugin.prototype.create = function create(annotation /*: ModelAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
var id /*: string*/ = annotation.id = acc.createId(); // eslint-disable-line | ||
var cursor /*: Cursor<V>*/ = acc.createCursor(annotation.statePath); | ||
var dep /*: ModelDep<V>*/ = new _ModelDepImpl2.default(annotation, cursor); | ||
acc.addRelation(id); | ||
var childs = annotation.childs; | ||
var childs = annotation.childs; | ||
acc.begin(dep); | ||
for (var i = 0, l = childs.length; i < l; i++) { | ||
acc.resolve(childs[i]); | ||
} | ||
acc.end(dep); | ||
acc.begin(dep); | ||
for (var i = 0, l = childs.length; i < l; i++) { | ||
acc.resolve(childs[i]); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: ModelDep*/, child /*: Dep|ModelDep*/) { | ||
var base = dep.base; | ||
acc.end(dep); | ||
}; | ||
switch (child.kind) { | ||
case 'model': | ||
{ | ||
var childBase = child.base; | ||
var childOwners = child.dataOwners; | ||
ModelPlugin.prototype.finalize = function finalize(dep /*: ModelDep*/, child /*: Dep|ModelDep*/) { | ||
var base = dep.base; | ||
dep.dataOwners.push(childBase); | ||
childOwners.push((base /*: Cacheable*/)); | ||
childBase.relations.push(base.id); | ||
break; | ||
} | ||
default: | ||
throw new TypeError('Unhandlered dep type: ' + child.kind); | ||
} | ||
switch (child.kind) { | ||
case 'model': | ||
{ | ||
var childBase = child.base; | ||
var childOwners = child.dataOwners; | ||
dep.dataOwners.push(childBase); | ||
childOwners.push((base /*: Cacheable*/)); | ||
childBase.relations.push(base.id); | ||
break; | ||
} | ||
default: | ||
throw new TypeError('Unhandlered dep type: ' + child.kind); | ||
} | ||
}]); | ||
}; | ||
return ModelPlugin; | ||
@@ -82,0 +73,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.observable = observable; | ||
@@ -7,0 +5,0 @@ exports.observableAnnotation = observableAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _pluginImpls = require('../../pluginsCommon/pluginImpls'); | ||
@@ -52,8 +46,6 @@ | ||
(0, _createClass3.default)(ObservableDepImpl, [{ | ||
key: 'resolve', | ||
value: function resolve() { | ||
return this._value; | ||
} | ||
}]); | ||
ObservableDepImpl.prototype.resolve = function resolve() { | ||
return this._value; | ||
}; | ||
return ObservableDepImpl; | ||
@@ -72,28 +64,25 @@ }(); | ||
(0, _createClass3.default)(ObservablePlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: ObservableAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var factoryAnnotation /*: FactoryAnnotation<V>*/ = { | ||
kind: 'factory', | ||
id: id + '.factory', | ||
target: annotation.target, | ||
deps: annotation.deps ? [annotation.deps] : [] | ||
}; | ||
ObservablePlugin.prototype.create = function create(annotation /*: ObservableAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var factoryAnnotation /*: FactoryAnnotation<V>*/ = { | ||
kind: 'factory', | ||
id: id + '.factory', | ||
target: annotation.target, | ||
deps: annotation.deps ? [annotation.deps] : [] | ||
}; | ||
var factoryDep /*: FactoryDep<V>*/ = acc.newRoot().resolveAnnotation(factoryAnnotation); | ||
if (factoryDep.kind !== 'factory') { | ||
throw new Error('Not a factory: ' + factoryDep.base.displayName + ' in ' + annotation.kind); | ||
} | ||
var observable /*: Observable<V, E>*/ = acc.listeners.add(factoryDep); | ||
(observable /*: any*/).displayName = 'observable@' + factoryDep.base.displayName; | ||
var dep /*: ObservableDep<V, E>*/ = new ObservableDepImpl(annotation, factoryDep, observable); | ||
acc.begin(dep); | ||
acc.end(dep); | ||
var factoryDep /*: FactoryDep<V>*/ = acc.newRoot().resolveAnnotation(factoryAnnotation); | ||
if (factoryDep.kind !== 'factory') { | ||
throw new Error('Not a factory: ' + factoryDep.base.displayName + ' in ' + annotation.kind); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: ObservableAnnotation*/, target /*: Object*/) {} // eslint-disable-line | ||
var observable /*: Observable<V, E>*/ = acc.listeners.add(factoryDep); | ||
(observable /*: any*/).displayName = 'observable@' + factoryDep.base.displayName; | ||
var dep /*: ObservableDep<V, E>*/ = new ObservableDepImpl(annotation, factoryDep, observable); | ||
acc.begin(dep); | ||
acc.end(dep); | ||
}; | ||
}]); | ||
ObservablePlugin.prototype.finalize = function finalize(dep /*: ObservableAnnotation*/, target /*: Object*/) {}; // eslint-disable-line | ||
return ObservablePlugin; | ||
@@ -100,0 +89,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.asyncsetter = asyncsetter; | ||
@@ -7,0 +5,0 @@ exports.asyncsetterAnnotation = asyncsetterAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _createSetterInvoker = require('./impl/createSetterInvoker'); | ||
@@ -47,30 +41,27 @@ | ||
(0, _createClass3.default)(AsyncSetterPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: AsyncSetterAnnotation<V, E>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var newAcc = acc.newRoot(); | ||
var model /*: ModelDep<V>*/ = newAcc.resolve(annotation.model); | ||
if (model.kind !== 'model') { | ||
throw new Error('Not a model dep type: ' + model.kind + ' in ' + model.base.info.displayName); | ||
} | ||
var dep /*: AsyncSetterDepImpl<V, E>*/ = new _AsyncSetterDepImpl2.default(annotation, newAcc.listeners.notify, model); | ||
newAcc.begin(dep); | ||
dep.setInvoker((0, _createSetterInvoker2.default)(annotation.target, annotation.deps, dep.base.tags, model, newAcc)); | ||
newAcc.end(dep); | ||
acc.addRelation(id); | ||
var childSetters = dep.childSetters; | ||
AsyncSetterPlugin.prototype.create = function create(annotation /*: AsyncSetterAnnotation<V, E>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var newAcc = acc.newRoot(); | ||
var model /*: ModelDep<V>*/ = newAcc.resolve(annotation.model); | ||
if (model.kind !== 'model') { | ||
throw new Error('Not a model dep type: ' + model.kind + ' in ' + model.base.info.displayName); | ||
} | ||
var dep /*: AsyncSetterDepImpl<V, E>*/ = new _AsyncSetterDepImpl2.default(annotation, newAcc.listeners.notify, model); | ||
newAcc.begin(dep); | ||
dep.setInvoker((0, _createSetterInvoker2.default)(annotation.target, annotation.deps, dep.base.tags, model, newAcc)); | ||
newAcc.end(dep); | ||
acc.addRelation(id); | ||
var childSetters = dep.childSetters; | ||
for (var i = 0, l = childSetters.length; i < l; i++) { | ||
acc.addRelation(childSetters[i].base.id); | ||
} | ||
for (var i = 0, l = childSetters.length; i < l; i++) { | ||
acc.addRelation(childSetters[i].base.id); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: AsyncSetterDep*/, target /*: Object|AsyncSetterDep*/) { | ||
if (target.kind === 'asyncsetter') { | ||
dep.childSetters.push(target); | ||
} | ||
}; | ||
AsyncSetterPlugin.prototype.finalize = function finalize(dep /*: AsyncSetterDep*/, target /*: Object|AsyncSetterDep*/) { | ||
if (target.kind === 'asyncsetter') { | ||
dep.childSetters.push(target); | ||
} | ||
}]); | ||
}; | ||
return AsyncSetterPlugin; | ||
@@ -77,0 +68,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _promise = require('babel-runtime/core-js/promise'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,6 +13,2 @@ var _promise = require('babel-runtime/core-js/promise'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _promiseToObservable = require('../../../utils/promiseToObservable'); | ||
@@ -61,19 +55,15 @@ | ||
(0, _createClass3.default)(RollbackObserver, [{ | ||
key: 'next', | ||
value: function next(value /*: ?V*/) { | ||
this._observer.next(value); | ||
} | ||
}, { | ||
key: 'error', | ||
value: function error(err /*: E*/) { | ||
this._model.set(this._oldValue); | ||
this._observer.error(err); | ||
} | ||
}, { | ||
key: 'complete', | ||
value: function complete() { | ||
this._observer.complete(); | ||
} | ||
}]); | ||
RollbackObserver.prototype.next = function next(value /*: ?V*/) { | ||
this._observer.next(value); | ||
}; | ||
RollbackObserver.prototype.error = function error(err /*: E*/) { | ||
this._model.set(this._oldValue); | ||
this._observer.error(err); | ||
}; | ||
RollbackObserver.prototype.complete = function complete() { | ||
this._observer.complete(); | ||
}; | ||
return RollbackObserver; | ||
@@ -128,120 +118,110 @@ }(); | ||
(0, _createClass3.default)(AsyncSetterDepImpl, [{ | ||
key: 'setInvoker', | ||
value: function setInvoker(invoker /*: Invoker<AsyncResult<V, E>>*/) { | ||
this._invoker = invoker; | ||
AsyncSetterDepImpl.prototype.setInvoker = function setInvoker(invoker /*: Invoker<AsyncResult<V, E>>*/) { | ||
this._invoker = invoker; | ||
}; | ||
AsyncSetterDepImpl.prototype.reset = function reset() { | ||
this._subscription.unsubscribe(); | ||
this._subscription = defaultSubscription; | ||
this._model.reset(); | ||
this._createPromise(); | ||
this._setMeta((0, _asyncHelpers.setPending)(this.meta)); | ||
}; | ||
AsyncSetterDepImpl.prototype._setMeta = function _setMeta(meta /*: EntityMeta<E>*/) { | ||
if (meta === this.meta) { | ||
return false; | ||
} | ||
}, { | ||
key: 'reset', | ||
value: function reset() { | ||
this._subscription.unsubscribe(); | ||
this._subscription = defaultSubscription; | ||
this._model.reset(); | ||
this._createPromise(); | ||
this._setMeta((0, _asyncHelpers.setPending)(this.meta)); | ||
this.meta = meta; | ||
var metaOwners = this.metaOwners; | ||
for (var i = 0, l = metaOwners.length; i < l; i++) { | ||
metaOwners[i].isRecalculate = true; | ||
} | ||
}, { | ||
key: '_setMeta', | ||
value: function _setMeta(meta /*: EntityMeta<E>*/) { | ||
if (meta === this.meta) { | ||
return false; | ||
} | ||
this.meta = meta; | ||
return true; | ||
}; | ||
var metaOwners = this.metaOwners; | ||
AsyncSetterDepImpl.prototype._setterResolver = function _setterResolver(args /*: Array<any>*/) { | ||
var oldValue /*: V*/ = this._model.resolve(); | ||
var result /*: AsyncResult<V, E>*/ = this._invoker.invoke(args); | ||
var initial /*: ?V*/ = void 0; | ||
var asyncResult /*: Promise<V>|Observable<V, E>*/ = void 0; | ||
if (Array.isArray(result)) { | ||
initial = result[0]; | ||
asyncResult = result[1]; | ||
} else { | ||
asyncResult = result; | ||
} | ||
for (var i = 0, l = metaOwners.length; i < l; i++) { | ||
metaOwners[i].isRecalculate = true; | ||
} | ||
return true; | ||
} | ||
}, { | ||
key: '_setterResolver', | ||
value: function _setterResolver(args /*: Array<any>*/) { | ||
var oldValue /*: V*/ = this._model.resolve(); | ||
var result /*: AsyncResult<V, E>*/ = this._invoker.invoke(args); | ||
var initial /*: ?V*/ = undefined; | ||
var asyncResult /*: Promise<V>|Observable<V, E>*/ = undefined; | ||
if (Array.isArray(result)) { | ||
initial = result[0]; | ||
asyncResult = result[1]; | ||
var observable /*: Observable<V, E>*/ = void 0; | ||
var isPromise /*: boolean*/ = false; | ||
if (asyncResult) { | ||
isPromise = typeof (asyncResult /*: Object*/).then === 'function'; | ||
if (isPromise) { | ||
observable = (0, _promiseToObservable2.default)(((asyncResult /*: any*/) /*: Promise<V>*/)); | ||
this._setMeta((0, _asyncHelpers.setPending)(this.meta)); | ||
this._notify(); | ||
} else if (typeof asyncResult.subscribe === 'function') { | ||
observable = ((asyncResult /*: any*/) /*: Observable<V, E>*/); | ||
} else { | ||
asyncResult = result; | ||
throw new Error(this.base.displayName + ' must return Promise or Observable in AsyncResult'); | ||
} | ||
var observable /*: Observable<V, E>*/ = undefined; | ||
var isPromise /*: boolean*/ = false; | ||
if (asyncResult) { | ||
isPromise = typeof (asyncResult /*: Object*/).then === 'function'; | ||
if (isPromise) { | ||
observable = (0, _promiseToObservable2.default)(((asyncResult /*: any*/) /*: Promise<V>*/)); | ||
this._setMeta((0, _asyncHelpers.setPending)(this.meta)); | ||
this._notify(); | ||
} else if (typeof asyncResult.subscribe === 'function') { | ||
observable = ((asyncResult /*: any*/) /*: Observable<V, E>*/); | ||
} else { | ||
throw new Error(this.base.displayName + ' must return Promise or Observable in AsyncResult'); | ||
} | ||
this._subscription.unsubscribe(); | ||
this._subscription.unsubscribe(); | ||
this._createPromise(); | ||
this._subscription = observable.subscribe(new RollbackObserver((this /*: Observer<?V, E>*/), this._model, oldValue)); | ||
} | ||
if (initial) { | ||
this._model.set(initial); | ||
} | ||
if (initial || isPromise) { | ||
this._notify(); | ||
} | ||
}; | ||
this._createPromise(); | ||
this._subscription = observable.subscribe(new RollbackObserver((this /*: Observer<?V, E>*/), this._model, oldValue)); | ||
} | ||
if (initial) { | ||
this._model.set(initial); | ||
} | ||
if (initial || isPromise) { | ||
this._notify(); | ||
} | ||
AsyncSetterDepImpl.prototype._createPromise = function _createPromise() { | ||
if (this._exposed) { | ||
return; | ||
} | ||
}, { | ||
key: '_createPromise', | ||
value: function _createPromise() { | ||
if (this._exposed) { | ||
return; | ||
} | ||
var _createPromiseHandler = (0, _asyncHelpers.createPromiseHandlers)(); | ||
var _createPromiseHandler = (0, _asyncHelpers.createPromiseHandlers)(); | ||
var promise = _createPromiseHandler.promise; | ||
var exposed = _createPromiseHandler.exposed; | ||
var promise = _createPromiseHandler.promise; | ||
var exposed = _createPromiseHandler.exposed; | ||
this.promise = promise; | ||
this._exposed = exposed; | ||
this.promise = promise; | ||
this._exposed = exposed; | ||
}; | ||
AsyncSetterDepImpl.prototype.next = function next(value /*: ?V*/) { | ||
var newMeta = (0, _asyncHelpers.setSuccess)(this.meta); | ||
var isMetaChanged = this._setMeta(newMeta); | ||
var isDataChanged = !value || this._model.set(value); | ||
if (this._exposed) { | ||
this._exposed.success(); | ||
this._exposed = null; | ||
} | ||
}, { | ||
key: 'next', | ||
value: function next(value /*: ?V*/) { | ||
var newMeta = (0, _asyncHelpers.setSuccess)(this.meta); | ||
var isMetaChanged = this._setMeta(newMeta); | ||
var isDataChanged = !value || this._model.set(value); | ||
if (this._exposed) { | ||
this._exposed.success(); | ||
this._exposed = null; | ||
} | ||
if (isMetaChanged || isDataChanged) { | ||
this._notify(); | ||
} | ||
if (isMetaChanged || isDataChanged) { | ||
this._notify(); | ||
} | ||
}, { | ||
key: 'error', | ||
value: function error(err /*: E*/) { | ||
if (this._exposed) { | ||
this._exposed.error(err); | ||
this._exposed = null; | ||
} | ||
if (this._setMeta((0, _asyncHelpers.setError)(this.meta, err))) { | ||
this._notify(); | ||
} | ||
}; | ||
AsyncSetterDepImpl.prototype.error = function error(err /*: E*/) { | ||
if (this._exposed) { | ||
this._exposed.error(err); | ||
this._exposed = null; | ||
} | ||
}, { | ||
key: 'complete', | ||
value: function complete() {} | ||
}, { | ||
key: 'resolve', | ||
value: function resolve() { | ||
return this._value; | ||
if (this._setMeta((0, _asyncHelpers.setError)(this.meta, err))) { | ||
this._notify(); | ||
} | ||
}]); | ||
}; | ||
AsyncSetterDepImpl.prototype.complete = function complete() {}; | ||
AsyncSetterDepImpl.prototype.resolve = function resolve() { | ||
return this._value; | ||
}; | ||
return AsyncSetterDepImpl; | ||
@@ -248,0 +228,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
exports.default = createSetterInvoker; | ||
@@ -55,21 +49,19 @@ | ||
(0, _createClass3.default)(SetterInvoker, [{ | ||
key: 'invoke', | ||
value: function invoke(args /*: Array<any>*/) { | ||
var _resolveDeps = (0, _resolveDeps3.default)(this._depArgs); | ||
SetterInvoker.prototype.invoke = function invoke(args /*: Array<any>*/) { | ||
var _resolveDeps = (0, _resolveDeps3.default)(this._depArgs); | ||
var deps = _resolveDeps.deps; | ||
var middlewares = _resolveDeps.middlewares; // eslint-disable-line | ||
var deps = _resolveDeps.deps; | ||
var middlewares = _resolveDeps.middlewares; // eslint-disable-line | ||
var result /*: Result*/ = (0, _fastCall.fastCall)(this._target, [this._model.resolve()].concat(deps, args)); | ||
if (middlewares) { | ||
var middleareArgs = [result].concat(args); | ||
for (var i = 0, l = middlewares.length; i < l; i++) { | ||
(0, _fastCall.fastCall)(middlewares[i], middleareArgs); | ||
} | ||
var result /*: Result*/ = (0, _fastCall.fastCall)(this._target, [this._model.resolve()].concat(deps, args)); | ||
if (middlewares) { | ||
var middleareArgs = [result].concat(args); | ||
for (var i = 0, l = middlewares.length; i < l; i++) { | ||
(0, _fastCall.fastCall)(middlewares[i], middleareArgs); | ||
} | ||
} | ||
return result; | ||
} | ||
}]); | ||
return result; | ||
}; | ||
return SetterInvoker; | ||
@@ -76,0 +68,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _pluginImpls = require('../../../pluginsCommon/pluginImpls'); | ||
@@ -51,8 +45,6 @@ | ||
(0, _createClass3.default)(SyncSetterDepImpl, [{ | ||
key: 'resolve', | ||
value: function resolve() { | ||
return this._value; | ||
} | ||
}]); | ||
SyncSetterDepImpl.prototype.resolve = function resolve() { | ||
return this._value; | ||
}; | ||
return SyncSetterDepImpl; | ||
@@ -59,0 +51,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.syncsetter = syncsetter; | ||
@@ -7,0 +5,0 @@ exports.syncsetterAnnotation = syncsetterAnnotation; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _createSetterInvoker = require('./impl/createSetterInvoker'); | ||
@@ -45,20 +39,17 @@ | ||
(0, _createClass3.default)(SyncSetterPlugin, [{ | ||
key: 'create', | ||
value: function create(annotation /*: SyncSetterAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var newAcc = acc.newRoot(); | ||
var model /*: ModelDep<V>*/ = newAcc.resolve(annotation.model); | ||
if (model.kind !== 'model') { | ||
throw new Error('Not a model dep type: ' + model.kind + ' in ' + model.base.displayName); | ||
} | ||
var dep /*: SyncSetterDepImpl<V>*/ = new _SyncSetterDepImpl2.default(annotation, newAcc.listeners.notify, model, (0, _createSetterInvoker2.default)(annotation.target, annotation.deps, [annotation.kind], model, newAcc)); | ||
newAcc.begin(dep); | ||
newAcc.end(dep); | ||
SyncSetterPlugin.prototype.create = function create(annotation /*: SyncSetterAnnotation<V>*/, acc /*: AnnotationResolver*/) { | ||
var id = annotation.id = acc.createId(); // eslint-disable-line | ||
var newAcc = acc.newRoot(); | ||
var model /*: ModelDep<V>*/ = newAcc.resolve(annotation.model); | ||
if (model.kind !== 'model') { | ||
throw new Error('Not a model dep type: ' + model.kind + ' in ' + model.base.displayName); | ||
} | ||
}, { | ||
key: 'finalize', | ||
value: function finalize(dep /*: SyncSetterDep*/, target /*: Object*/) {} // eslint-disable-line | ||
var dep /*: SyncSetterDepImpl<V>*/ = new _SyncSetterDepImpl2.default(annotation, newAcc.listeners.notify, model, (0, _createSetterInvoker2.default)(annotation.target, annotation.deps, [annotation.kind], model, newAcc)); | ||
newAcc.begin(dep); | ||
newAcc.end(dep); | ||
}; | ||
}]); | ||
SyncSetterPlugin.prototype.finalize = function finalize(dep /*: SyncSetterDep*/, target /*: Object*/) {}; // eslint-disable-line | ||
return SyncSetterPlugin; | ||
@@ -65,0 +56,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.default = defaultFinalizer; | ||
@@ -7,0 +5,0 @@ /*:: import type {Cacheable} from 'reactive-di/i/nodeInterfaces'*/ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -15,6 +13,2 @@ var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -49,52 +43,49 @@ | ||
(0, _createClass3.default)(DepsResolverImpl, [{ | ||
key: '_getMiddlewares', | ||
value: function _getMiddlewares(annotatedDep /*: Dependency*/, tags /*: Array<Tag>*/) { | ||
var acc = this._acc; | ||
var middlewares = acc.middlewares; | ||
DepsResolverImpl.prototype._getMiddlewares = function _getMiddlewares(annotatedDep /*: Dependency*/, tags /*: Array<Tag>*/) { | ||
var acc = this._acc; | ||
var middlewares = acc.middlewares; | ||
var ids /*: Array<Dependency|Tag>*/ = [annotatedDep].concat(tags); | ||
var middlewareDeps /*: Array<ResolvableDep>*/ = []; | ||
for (var i = 0, l = ids.length; i < l; i++) { | ||
var depMiddlewares /*: ?Array<Dependency>*/ = middlewares.get(ids[i]); | ||
if (depMiddlewares) { | ||
for (var j = 0, k = depMiddlewares.length; j < k; j++) { | ||
middlewareDeps.push(acc.resolve(depMiddlewares[j])); | ||
} | ||
var ids /*: Array<Dependency|Tag>*/ = [annotatedDep].concat(tags); | ||
var middlewareDeps /*: Array<ResolvableDep>*/ = []; | ||
for (var i = 0, l = ids.length; i < l; i++) { | ||
var depMiddlewares /*: ?Array<Dependency>*/ = middlewares.get(ids[i]); | ||
if (depMiddlewares) { | ||
for (var j = 0, k = depMiddlewares.length; j < k; j++) { | ||
middlewareDeps.push(acc.resolve(depMiddlewares[j])); | ||
} | ||
} | ||
return middlewareDeps.length ? middlewareDeps : null; | ||
} | ||
}, { | ||
key: 'getDeps', | ||
value: function getDeps(deps /*: Array<DepItem>*/, target /*: Dependency*/, tags /*: Array<Tag>*/) { | ||
var acc = this._acc; | ||
var depNames /*: ?Array<string>*/ = null; | ||
var resolvedDeps /*: Array<ResolvableDep>*/ = []; | ||
if (deps.length) { | ||
if ((0, _typeof3.default)(deps[0]) === 'object' && deps.length === 1) { | ||
depNames = []; | ||
var argsObject /*: SimpleMap<string, Dependency>*/ = ((deps[0] /*: any*/) /*: SimpleMap<string, Dependency>*/); | ||
for (var key in argsObject) { | ||
// eslint-disable-line | ||
resolvedDeps.push(acc.resolve(argsObject[key])); | ||
depNames.push(key); | ||
} | ||
} else { | ||
for (var i = 0, l = deps.length; i < l; i++) { | ||
var dep /*: ResolvableDep*/ = acc.resolve(((deps /*: any*/) /*: Array<Dependency>*/)[i]); | ||
resolvedDeps.push(dep); | ||
} | ||
return middlewareDeps.length ? middlewareDeps : null; | ||
}; | ||
DepsResolverImpl.prototype.getDeps = function getDeps(deps /*: Array<DepItem>*/, target /*: Dependency*/, tags /*: Array<Tag>*/) { | ||
var acc = this._acc; | ||
var depNames /*: ?Array<string>*/ = null; | ||
var resolvedDeps /*: Array<ResolvableDep>*/ = []; | ||
if (deps.length) { | ||
if ((0, _typeof3.default)(deps[0]) === 'object' && deps.length === 1) { | ||
depNames = []; | ||
var argsObject /*: SimpleMap<string, Dependency>*/ = ((deps[0] /*: any*/) /*: SimpleMap<string, Dependency>*/); | ||
for (var key in argsObject) { | ||
// eslint-disable-line | ||
resolvedDeps.push(acc.resolve(argsObject[key])); | ||
depNames.push(key); | ||
} | ||
} else { | ||
for (var i = 0, l = deps.length; i < l; i++) { | ||
var dep /*: ResolvableDep*/ = acc.resolve(((deps /*: any*/) /*: Array<Dependency>*/)[i]); | ||
resolvedDeps.push(dep); | ||
} | ||
} | ||
} | ||
return { | ||
deps: resolvedDeps, | ||
depNames: depNames, | ||
middlewares: this._getMiddlewares(target, tags) | ||
}; | ||
} | ||
}]); | ||
return { | ||
deps: resolvedDeps, | ||
depNames: depNames, | ||
middlewares: this._getMiddlewares(target, tags) | ||
}; | ||
}; | ||
return DepsResolverImpl; | ||
@@ -101,0 +92,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _SymbolMetaDriver = require('../drivers/SymbolMetaDriver'); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.EntityMetaImpl = exports.DepBaseImpl = undefined; | ||
@@ -7,0 +5,0 @@ |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.default = resolveDeps; | ||
@@ -41,4 +39,4 @@ /*:: import type { | ||
resolvedMiddlewares = []; | ||
for (var i = 0, j = middlewares.length; i < j; i++) { | ||
var mdl /*: AnyDep*/ = middlewares[i]; | ||
for (var _i = 0, _j = middlewares.length; _i < _j; _i++) { | ||
var mdl /*: AnyDep*/ = middlewares[_i]; | ||
if (mdl.kind !== 'factory' || mdl.kind !== 'class') { | ||
@@ -45,0 +43,0 @@ throw new Error('Not an factory or class: ' + mdl.base.displayName); |
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | ||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
@@ -24,6 +20,2 @@ | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { return { powerAssertContext: { value: value, events: this.captured }, source: source }; }; return PowerAssertRecorder; }(); | ||
@@ -65,8 +57,6 @@ /* eslint-env mocha */ | ||
(0, _createClass3.default)(TestEl, [{ | ||
key: 'copy', | ||
value: function copy(rec /*: TestElRec*/) { | ||
return (0, _merge2.default)(this, rec); | ||
} | ||
}]); | ||
TestEl.prototype.copy = function copy(rec /*: TestElRec*/) { | ||
return (0, _merge2.default)(this, rec); | ||
}; | ||
return TestEl; | ||
@@ -80,11 +70,9 @@ }(); | ||
(0, _classCallCheck3.default)(this, TestColl); | ||
return (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(TestColl).apply(this, arguments)); | ||
return (0, _possibleConstructorReturn3.default)(this, _BaseCollection.apply(this, arguments)); | ||
} | ||
(0, _createClass3.default)(TestColl, [{ | ||
key: 'createItem', | ||
value: function createItem(rec /*: Object*/) { | ||
return new TestEl(rec); | ||
} | ||
}]); | ||
TestColl.prototype.createItem = function createItem(rec /*: Object*/) { | ||
return new TestEl(rec); | ||
}; | ||
return TestColl; | ||
@@ -481,25 +469,17 @@ }(_BaseCollection3.default); | ||
// $FlowDisable | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (var _iterator = testColl, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) { | ||
var _ref; | ||
try { | ||
for (var _iterator = (0, _getIterator3.default)(testColl), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var item = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
items.push(item.id); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
var item = _ref; | ||
items.push(item.id); | ||
} | ||
@@ -506,0 +486,0 @@ |
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _powerAssertRecorder = function () { function PowerAssertRecorder() { this.captured = []; } PowerAssertRecorder.prototype._capt = function _capt(value, espath) { this.captured.push({ value: value, espath: espath }); return value; }; PowerAssertRecorder.prototype._expr = function _expr(value, source) { return { powerAssertContext: { value: value, events: this.captured }, source: source }; }; return PowerAssertRecorder; }(); | ||
@@ -102,13 +98,10 @@ /* eslint-env mocha */ | ||
(0, _createClass3.default)(My, [{ | ||
key: 'a', | ||
value: function a(val /*: string*/) { | ||
return val + '1'; | ||
} | ||
}, { | ||
key: 'b', | ||
value: function b(val /*: number*/) { | ||
return val + 1; | ||
} | ||
}]); | ||
My.prototype.a = function a(val /*: string*/) { | ||
return val + '1'; | ||
}; | ||
My.prototype.b = function b(val /*: number*/) { | ||
return val + 1; | ||
}; | ||
return My; | ||
@@ -115,0 +108,0 @@ }(); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -11,6 +9,2 @@ var _iterator = require('babel-runtime/core-js/symbol/iterator'); | ||
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray'); | ||
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2); | ||
var _extends2 = require('babel-runtime/helpers/extends'); | ||
@@ -28,6 +22,2 @@ | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _merge = require('./merge'); | ||
@@ -80,181 +70,161 @@ | ||
(0, _createClass3.default)(BaseCollection, [{ | ||
key: '_copy', | ||
value: function _copy(rec /*: CollectionRec<Item>*/) { | ||
// TODO: remove type convertation after flow implements @@iterator to real classes | ||
return (((0, _merge2.default)(this, rec) /*: any*/) /*: Collection<Item>*/); | ||
} | ||
}, { | ||
key: '_getDeleted', | ||
value: function _getDeleted(id /*: Id*/) { | ||
var oldItems = this.items; | ||
var items /*: Array<Item>*/ = []; | ||
var deleted /*: DeletedItems<Item>*/ = {}; | ||
for (var i = 0, l = oldItems.length; i < l; i++) { | ||
var item = oldItems[i]; | ||
if (item.id !== id) { | ||
items.push(item); | ||
} else { | ||
deleted[id] = [item, i]; | ||
} | ||
} | ||
BaseCollection.prototype._copy = function _copy(rec /*: CollectionRec<Item>*/) { | ||
// TODO: remove type convertation after flow implements @@iterator to real classes | ||
return (((0, _merge2.default)(this, rec) /*: any*/) /*: Collection<Item>*/); | ||
}; | ||
return { items: items, deleted: deleted }; | ||
} | ||
}, { | ||
key: '_recsToItems', | ||
value: function _recsToItems(recs /*: Array<ItemRec>*/) { | ||
var items /*: Array<Item>*/ = []; | ||
var itemsMap /*: ItemsMap<Item>*/ = {}; | ||
for (var i = 0, l = recs.length; i < l; i++) { | ||
var item /*: Item*/ = this.createItem(recs[i]); | ||
itemsMap[item.id] = item; | ||
BaseCollection.prototype._getDeleted = function _getDeleted(id /*: Id*/) { | ||
var oldItems = this.items; | ||
var items /*: Array<Item>*/ = []; | ||
var deleted /*: DeletedItems<Item>*/ = {}; | ||
for (var i = 0, l = oldItems.length; i < l; i++) { | ||
var item = oldItems[i]; | ||
if (item.id !== id) { | ||
items.push(item); | ||
} else { | ||
deleted[id] = [item, i]; | ||
} | ||
} | ||
return items; | ||
return { items: items, deleted: deleted }; | ||
}; | ||
BaseCollection.prototype._recsToItems = function _recsToItems(recs /*: Array<ItemRec>*/) { | ||
var items /*: Array<Item>*/ = []; | ||
var itemsMap /*: ItemsMap<Item>*/ = {}; | ||
for (var i = 0, l = recs.length; i < l; i++) { | ||
var item /*: Item*/ = this.createItem(recs[i]); | ||
itemsMap[item.id] = item; | ||
items.push(item); | ||
} | ||
}, { | ||
key: 'toJS', | ||
value: function toJS() { | ||
return this.items; | ||
} | ||
}, { | ||
key: 'toJSON', | ||
value: function toJSON() { | ||
return (0, _stringify2.default)(this.toJS()); | ||
} | ||
}, { | ||
key: 'fromArray', | ||
value: function fromArray(recs /*: Array<ItemRec>*/) { | ||
return this._copy({ | ||
items: this._recsToItems(recs), | ||
deleted: {} | ||
}); | ||
} | ||
}, { | ||
key: 'add', | ||
value: function add(item /*: Item*/) { | ||
return this._copy({ | ||
items: this.items.concat([item]) | ||
}); | ||
} | ||
}, { | ||
key: 'remove', | ||
value: function remove(id /*: Id*/) { | ||
return this._copy({ | ||
items: this._getDeleted(id).items | ||
}); | ||
} | ||
}, { | ||
key: 'softRemove', | ||
value: function softRemove(id /*: Id*/) { | ||
return this._copy((0, _extends3.default)({}, this._getDeleted(id))); | ||
} | ||
}, { | ||
key: 'restore', | ||
value: function restore(id /*: Id*/) { | ||
if (!this.deleted[id]) { | ||
throw new Error('Can\'t restore: element doesn\'t exists in collection: ' + id); | ||
} | ||
var _deleted$id = (0, _slicedToArray3.default)(this.deleted[id], 2); | ||
return items; | ||
}; | ||
var item = _deleted$id[0]; | ||
var index = _deleted$id[1]; | ||
BaseCollection.prototype.toJS = function toJS() { | ||
return this.items; | ||
}; | ||
delete this.deleted[id]; | ||
var items = [].concat(this.items); | ||
items.splice(index, 0, item); | ||
return this._copy({ items: items }); | ||
BaseCollection.prototype.toJSON = function toJSON() { | ||
return (0, _stringify2.default)(this.toJS()); | ||
}; | ||
BaseCollection.prototype.fromArray = function fromArray(recs /*: Array<ItemRec>*/) { | ||
return this._copy({ | ||
items: this._recsToItems(recs), | ||
deleted: {} | ||
}); | ||
}; | ||
BaseCollection.prototype.add = function add(item /*: Item*/) { | ||
return this._copy({ | ||
items: this.items.concat([item]) | ||
}); | ||
}; | ||
BaseCollection.prototype.remove = function remove(id /*: Id*/) { | ||
return this._copy({ | ||
items: this._getDeleted(id).items | ||
}); | ||
}; | ||
BaseCollection.prototype.softRemove = function softRemove(id /*: Id*/) { | ||
return this._copy((0, _extends3.default)({}, this._getDeleted(id))); | ||
}; | ||
BaseCollection.prototype.restore = function restore(id /*: Id*/) { | ||
if (!this.deleted[id]) { | ||
throw new Error('Can\'t restore: element doesn\'t exists in collection: ' + id); | ||
} | ||
}, { | ||
key: 'get', | ||
value: function get(id /*: Id*/) { | ||
var items = this.items; | ||
var _deleted$id = this.deleted[id]; | ||
var item = _deleted$id[0]; | ||
var index = _deleted$id[1]; | ||
for (var i = 0, l = items.length; i < l; i++) { | ||
if (items[i].id === id) { | ||
return items[i]; | ||
} | ||
delete this.deleted[id]; | ||
var items = [].concat(this.items); | ||
items.splice(index, 0, item); | ||
return this._copy({ items: items }); | ||
}; | ||
BaseCollection.prototype.get = function get(id /*: Id*/) { | ||
var items = this.items; | ||
for (var i = 0, l = items.length; i < l; i++) { | ||
if (items[i].id === id) { | ||
return items[i]; | ||
} | ||
throw new Error('Can\'t get: element doesn\'t exists in collection: ' + id); | ||
} | ||
}, { | ||
key: 'update', | ||
value: function update(id /*: ?Id|SelectorFn<Item>*/, updateFn /*: UpdateFn<Item>*/) { | ||
var oldItems /*: Array<Item>*/ = this.items; | ||
var items /*: Array<Item>*/ = []; | ||
var isFound /*: boolean*/ = false; | ||
var isChanged /*: boolean*/ = false; | ||
for (var i = 0, l = oldItems.length; i < l; i++) { | ||
var item = oldItems[i]; | ||
throw new Error('Can\'t get: element doesn\'t exists in collection: ' + id); | ||
}; | ||
var isMatch /*: boolean*/ = undefined; | ||
if (id === null) { | ||
isMatch = true; | ||
} else if (typeof id === 'function') { | ||
isMatch = (id /*: SelectorFn<Item>*/)(item); | ||
} else { | ||
isMatch = item.id === id; | ||
} | ||
BaseCollection.prototype.update = function update(id /*: ?Id|SelectorFn<Item>*/, updateFn /*: UpdateFn<Item>*/) { | ||
var oldItems /*: Array<Item>*/ = this.items; | ||
var items /*: Array<Item>*/ = []; | ||
var isFound /*: boolean*/ = false; | ||
var isChanged /*: boolean*/ = false; | ||
for (var i = 0, l = oldItems.length; i < l; i++) { | ||
var item = oldItems[i]; | ||
if (!isMatch) { | ||
items.push(item); | ||
} else { | ||
isFound = true; | ||
var newItem /*: Item*/ = updateFn(item); | ||
if (item !== newItem) { | ||
isChanged = true; | ||
} | ||
items.push(newItem); | ||
var isMatch /*: boolean*/ = void 0; | ||
if (id === null) { | ||
isMatch = true; | ||
} else if (typeof id === 'function') { | ||
isMatch = (id /*: SelectorFn<Item>*/)(item); | ||
} else { | ||
isMatch = item.id === id; | ||
} | ||
if (!isMatch) { | ||
items.push(item); | ||
} else { | ||
isFound = true; | ||
var newItem /*: Item*/ = updateFn(item); | ||
if (item !== newItem) { | ||
isChanged = true; | ||
} | ||
items.push(newItem); | ||
} | ||
if (!isFound) { | ||
throw new Error('Can\'t update: element doesn\'t exists in collection: ' + id); | ||
} | ||
return isChanged ? this._copy({ items: items }) : (this /*: any*/); | ||
} | ||
}, { | ||
key: 'set', | ||
value: function set(id /*: Id*/, newItem /*: Item*/) { | ||
return this.update(id, function () { | ||
return newItem; | ||
}); | ||
if (!isFound) { | ||
throw new Error('Can\'t update: element doesn\'t exists in collection: ' + id); | ||
} | ||
}, { | ||
key: 'find', | ||
value: function find(findFn /*: FindFn<Item>*/) { | ||
return this.items.find(findFn); | ||
} | ||
}, { | ||
key: 'map', | ||
value: function map(mapFn /*: MapFn<Item, V>*/) { | ||
return this.items.map(mapFn); | ||
} | ||
}, { | ||
key: 'filter', | ||
value: function filter(filterFn /*: FilterFn<Item>*/) { | ||
var items = this.items.filter(filterFn); | ||
return items.length !== this.length ? this._copy({ items: items }) : (this /*: any*/); | ||
} | ||
}, { | ||
key: 'sort', | ||
value: function sort(sortFn /*: SortFn<Item>*/) { | ||
var oldItems = this.items; | ||
var items = oldItems.sort(sortFn); | ||
return isChanged ? this._copy({ items: items }) : (this /*: any*/); | ||
}; | ||
var isChanged /*: boolean*/ = false; | ||
for (var i = 0, l = items.length; i < l; i++) { | ||
if (items[i].id !== oldItems[i].id) { | ||
isChanged = true; | ||
break; | ||
} | ||
BaseCollection.prototype.set = function set(id /*: Id*/, newItem /*: Item*/) { | ||
return this.update(id, function () { | ||
return newItem; | ||
}); | ||
}; | ||
BaseCollection.prototype.find = function find(findFn /*: FindFn<Item>*/) { | ||
return this.items.find(findFn); | ||
}; | ||
BaseCollection.prototype.map = function map(mapFn /*: MapFn<Item, V>*/) { | ||
return this.items.map(mapFn); | ||
}; | ||
BaseCollection.prototype.filter = function filter(filterFn /*: FilterFn<Item>*/) { | ||
var items = this.items.filter(filterFn); | ||
return items.length !== this.length ? this._copy({ items: items }) : (this /*: any*/); | ||
}; | ||
BaseCollection.prototype.sort = function sort(sortFn /*: SortFn<Item>*/) { | ||
var oldItems = this.items; | ||
var items = oldItems.sort(sortFn); | ||
var isChanged /*: boolean*/ = false; | ||
for (var i = 0, l = items.length; i < l; i++) { | ||
if (items[i].id !== oldItems[i].id) { | ||
isChanged = true; | ||
break; | ||
} | ||
} | ||
return isChanged ? this._copy({ items: items }) : (this /*: any*/); | ||
} | ||
}]); | ||
return isChanged ? this._copy({ items: items }) : (this /*: any*/); | ||
}; | ||
return BaseCollection; | ||
@@ -269,3 +239,3 @@ }(); | ||
next: function next() { | ||
var rec = undefined; | ||
var rec = void 0; | ||
if (this._pos < this.items.length) { | ||
@@ -272,0 +242,0 @@ rec = { value: this.items[this._pos], done: false }; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _toConsumableArray2 = require("babel-runtime/helpers/toConsumableArray"); | ||
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); | ||
exports.__esModule = true; | ||
exports.fastCreateObject = fastCreateObject; | ||
exports.fastCallMethod = fastCallMethod; | ||
exports.fastCall = fastCall; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function fastCreateObject /*:: <T>*/(target /*: Class<T>*/, args /*: Array<any>*/) /*: T*/ { | ||
@@ -36,3 +26,3 @@ switch (args.length) { | ||
default: | ||
return new (Function.prototype.bind.apply((target /*: any*/), [null].concat((0, _toConsumableArray3.default)(args))))(); | ||
return new (Function.prototype.bind.apply((target /*: any*/), [null].concat(args)))(); | ||
} | ||
@@ -83,5 +73,5 @@ } | ||
default: | ||
return fn.apply(undefined, (0, _toConsumableArray3.default)(args)); | ||
return fn.apply(undefined, args); | ||
} | ||
} | ||
//# sourceMappingURL=fastCall.js.map |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.default = getFunctionName; | ||
@@ -7,0 +5,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
@@ -7,0 +5,0 @@ var _extends2 = require("babel-runtime/helpers/extends"); |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.__esModule = true; | ||
exports.default = promiseToObservable; | ||
@@ -7,0 +5,0 @@ |
{ | ||
"name": "reactive-di", | ||
"version": "0.0.26", | ||
"version": "0.0.28", | ||
"description": "Reactive dependency injection", | ||
@@ -61,4 +61,4 @@ "publishConfig": { | ||
"devDependencies": { | ||
"babel-cli": "^6.5.1", | ||
"babel-core": "^6.5.2", | ||
"babel-cli": "^6.6.5", | ||
"babel-core": "^6.7.2", | ||
"babel-plugin-espower": "^2.1.2", | ||
@@ -69,11 +69,11 @@ "babel-plugin-flow-comments": "^6.3.19", | ||
"babel-plugin-syntax-flow": "^6.5.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.5.0", | ||
"babel-plugin-transform-runtime": "^6.5.2", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.7.0", | ||
"babel-plugin-transform-runtime": "^6.6.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-runtime": "5.x.x", | ||
"eslint-config-airplus": "^1.1.8", | ||
"glob": "^7.0.0", | ||
"eslint-config-airplus": "^1.1.9", | ||
"glob": "^7.0.3", | ||
"mocha": "^2.4.5", | ||
"power-assert": "^1.2.0", | ||
"power-assert": "^1.3.1", | ||
"sinon": "^1.17.3" | ||
@@ -80,0 +80,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
395644
4457