Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reactive-di

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactive-di - npm Package Compare versions

Comparing version 0.0.15 to 0.0.18

dist/plugins/setter/AsyncSetterAnnotationImpl.js

1

dist/__tests__/annotations.js

@@ -18,3 +18,2 @@ 'use strict';

/*:: import type {
Annotations,
AnnotationDriver

@@ -21,0 +20,0 @@ } from 'reactive-di/i/annotationInterfaces'*/

@@ -31,6 +31,7 @@ 'use strict';

/*:: import type {AsyncResult} from 'reactive-di/i/plugins/setterInterfaces'*/
var model = _annotations2.default.model;
var asyncmodel = _annotations2.default.asyncmodel;
var loader = _annotations2.default.loader;
var setter = _annotations2.default.setter;
var syncsetter = _annotations2.default.syncsetter;
var asyncsetter = _annotations2.default.asyncsetter;
function createState() /*: {

@@ -62,6 +63,6 @@ A: Function,

asyncmodel(C);
model(C);
function cLoader(c /*: C*/) /*: Observable<C, Error>*/ {
return (0, _promiseToObservable2.default)(_promise2.default.resolve(c.copy({ v: 'test2' })));
function cLoader(c /*: C*/) /*: AsyncResult<C, Error>*/ {
return [c, _promise2.default.resolve(c.copy({ v: 'test2' }))];
}

@@ -110,3 +111,3 @@ loader(C)(cLoader);

asyncmodel(A);
model(A);

@@ -132,6 +133,6 @@ var AppState = function () {

function aSetter(a /*: A*/, v /*: number*/) /*: Observable<A, Error>*/ {
return (0, _promiseToObservable2.default)(_promise2.default.resolve(a.copy({ v: v })));
function aSetter(a /*: A*/, v /*: number*/) /*: AsyncResult<A, Error>*/ {
return [a, (0, _promiseToObservable2.default)(_promise2.default.resolve(a.copy({ v: v })))];
}
setter(A)(aSetter);
asyncsetter(A)(aSetter);

@@ -141,3 +142,3 @@ function bSetter(b /*: B*/, v /*: number*/) /*: B*/ {

}
setter(B)(bSetter);
syncsetter(B)(bSetter);

@@ -144,0 +145,0 @@ return {

@@ -40,5 +40,8 @@ 'use strict';

/*:: import type {
AsyncResult,
EntityMeta
} from 'reactive-di/i/plugins/setterInterfaces'*/
var model = _annotations2.default.model;
var meta = _annotations2.default.meta;
var asyncmodel = _annotations2.default.asyncmodel;
var factory = _annotations2.default.factory;

@@ -61,9 +64,11 @@ var loader = _annotations2.default.loader;

asyncmodel(C);
model(C);
var resolveData /*: Function*/ = undefined;
var dataSource = new _promise2.default(function (resolve) {
resolveData = resolve;
});
var observable = (0, _promiseToObservable2.default)(dataSource);
var dataSource = _promise2.default.resolve(new C('test2'));
function cLoader(c /*: C*/) /*: Observable<C, Error>*/ {
// eslint-disable-line
return (0, _promiseToObservable2.default)(dataSource);
function cLoader(c /*: C*/) /*: AsyncResult<C, Error>*/ {
return [c, observable];
}

@@ -92,11 +97,10 @@ loader(C)(cLoader);

var di = (0, _createPureStateDi2.default)(new AppState());
var MyDep = _sinon2.default.spy(function (c /*: C*/, meta /*: EntityMeta*/) {
return { v: c.v, meta: meta };
var MyDep = _sinon2.default.spy(function (c /*: C*/, m /*: EntityMeta*/) {
return { v: c.v, meta: m };
});
factory(cLoader, meta(cLoader))(MyDep);
_powerAssert2.default.deepEqual(_rec._expr(_rec._capt(di(_rec._capt(MyDep, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert.deepEqual(di(MyDep), { v: \'test1\', meta: { fulfilled: false, pending: true, reason: null, rejected: false } })',
filepath: 'src/__tests__/DiAsyncTest.js',
line: 51
line: 55
}), _rec2._expr(_rec2._capt({

@@ -113,5 +117,6 @@ v: 'test1',

filepath: 'src/__tests__/DiAsyncTest.js',
line: 51
line: 55
}));
resolveData(new C('test2'));
return dataSource.then(function () {

@@ -124,3 +129,3 @@ var _rec3 = new _powerAssertRecorder(),

filepath: 'src/__tests__/DiAsyncTest.js',
line: 62
line: 67
}), _rec4._expr(_rec4._capt({

@@ -137,3 +142,3 @@ v: 'test2',

filepath: 'src/__tests__/DiAsyncTest.js',
line: 62
line: 67
}));

@@ -140,0 +145,0 @@ });

@@ -26,3 +26,2 @@ 'use strict';

var model = _annotations2.default.model;
var factory = _annotations2.default.factory;

@@ -50,3 +49,3 @@

filepath: 'src/__tests__/DiCacheTest.js',
line: 24
line: 23
}));

@@ -81,3 +80,3 @@ });

filepath: 'src/__tests__/DiCacheTest.js',
line: 39
line: 38
}));

@@ -87,3 +86,3 @@ (0, _powerAssert2.default)(_rec3._expr(_rec3._capt(_rec3._capt(_rec3._capt(fn, 'arguments/0/callee/object/object').firstCall, 'arguments/0/callee/object').calledWith(_rec3._capt({ v: 123 }, 'arguments/0/arguments/0')), 'arguments/0'), {

filepath: 'src/__tests__/DiCacheTest.js',
line: 40
line: 39
}));

@@ -93,3 +92,3 @@ (0, _powerAssert2.default)(_rec4._expr(_rec4._capt(_rec4._capt(_rec4._capt(fn, 'arguments/0/callee/object/object').secondCall, 'arguments/0/callee/object').calledWith(_rec4._capt({ v: 321 }, 'arguments/0/arguments/0')), 'arguments/0'), {

filepath: 'src/__tests__/DiCacheTest.js',
line: 41
line: 40
}));

@@ -119,3 +118,3 @@ });

filepath: 'src/__tests__/DiCacheTest.js',
line: 53
line: 52
}));

@@ -150,3 +149,3 @@ });

filepath: 'src/__tests__/DiCacheTest.js',
line: 68
line: 67
}));

@@ -153,0 +152,0 @@ });

@@ -57,3 +57,2 @@ 'use strict';

/* eslint-disable padded-blocks */
it('should return class instance', function () {

@@ -73,8 +72,6 @@ var _rec = new _powerAssertRecorder();

filepath: 'src/__tests__/DiContainerTest.js',
line: 40
line: 39
}));
});
/* eslint-enable padded-blocks */
/* eslint-disable padded-blocks */
it('should cache class instance', function () {

@@ -85,5 +82,8 @@ var _rec2 = new _powerAssertRecorder(),

var di = (0, _createPureStateDi2.default)(new AppState());
var Test = _sinon2.default.spy(function TestBase() {
var TestBase = function TestBase() {
(0, _classCallCheck3.default)(this, TestBase);
});
};
var Test = _sinon2.default.spy(TestBase);
klass()(Test);

@@ -95,3 +95,3 @@ var instance1 = di(Test);

filepath: 'src/__tests__/DiContainerTest.js',
line: 51
line: 49
}));

@@ -101,6 +101,5 @@ (0, _powerAssert2.default)(_rec3._expr(_rec3._capt(_rec3._capt(Test, 'arguments/0/object').calledOnce, 'arguments/0'), {

filepath: 'src/__tests__/DiContainerTest.js',
line: 52
line: 50
}));
});
/* eslint-enable padded-blocks */

@@ -123,3 +122,3 @@ it('should cache factory return value', function () {

filepath: 'src/__tests__/DiContainerTest.js',
line: 66
line: 63
}));

@@ -129,3 +128,3 @@ (0, _powerAssert2.default)(_rec5._expr(_rec5._capt(_rec5._capt(test, 'arguments/0/object').calledOnce, 'arguments/0'), {

filepath: 'src/__tests__/DiContainerTest.js',
line: 67
line: 64
}));

@@ -143,5 +142,7 @@ });

var TestFake = _sinon2.default.spy(function Test() {
var Test = function Test() {
(0, _classCallCheck3.default)(this, Test);
});
};
var TestFake = _sinon2.default.spy(Test);
klass(MyDep)(TestFake);

@@ -153,3 +154,3 @@

filepath: 'src/__tests__/DiContainerTest.js',
line: 81
line: 78
}));

@@ -167,5 +168,7 @@ });

var TestFake = _sinon2.default.spy(function Test() {
var Test = function Test() {
(0, _classCallCheck3.default)(this, Test);
});
};
var TestFake = _sinon2.default.spy(Test);
klass({ fac: MyDep })(TestFake);

@@ -177,3 +180,3 @@

filepath: 'src/__tests__/DiContainerTest.js',
line: 95
line: 92
}));

@@ -180,0 +183,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');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
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; }(); /* eslint-env mocha */

@@ -24,2 +40,6 @@

var _zenObservable = require('zen-observable');
var _zenObservable2 = _interopRequireDefault(_zenObservable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -45,3 +65,3 @@

var bSet = di(bSetter);
var observable /*: Observable*/ = di(observableProps); //eslint-disable-line
di(observableProps);
bSet(321);

@@ -51,10 +71,11 @@ (0, _powerAssert2.default)(_rec._expr(_rec._capt(_rec._capt(fn, 'arguments/0/object').notCalled, 'arguments/0'), {

filepath: 'src/__tests__/DiEventsTest.js',
line: 22
line: 23
}));
});
it('should update mounted listener', function () {
it('should send data to all subscribers', function () {
var _rec2 = new _powerAssertRecorder(),
_rec3 = new _powerAssertRecorder(),
_rec4 = new _powerAssertRecorder();
_rec4 = new _powerAssertRecorder(),
_rec5 = new _powerAssertRecorder();

@@ -68,3 +89,70 @@ var _createState2 = (0, _TestState.createState)();

var di = (0, _createPureStateDi2.default)(new AppState());
var observer /*: Observer*/ = { //eslint-disable-line
var Observer1 = function Observer1() {
(0, _classCallCheck3.default)(this, Observer1);
this.next = _sinon2.default.spy();
this.complete = _sinon2.default.spy();
this.error = _sinon2.default.spy();
};
var Observer2 = function (_Observer) {
(0, _inherits3.default)(Observer2, _Observer);
function Observer2() {
(0, _classCallCheck3.default)(this, Observer2);
return (0, _possibleConstructorReturn3.default)(this, (0, _getPrototypeOf2.default)(Observer2).apply(this, arguments));
}
return Observer2;
}(Observer1);
var observer1 /*: Observer*/ = new Observer1();
var observer2 /*: Observer*/ = new Observer2();
var observable /*: Observable*/ = undefined;
var bSet = di(bSetter);
function observableProps() {}
_annotations2.default.observable({ b: B })(observableProps);
observable = di(observableProps).observable;
observable.subscribe(observer1);
observable.subscribe(observer2);
bSet(321);
(0, _powerAssert2.default)(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(observer1, 'arguments/0/object/object').next, 'arguments/0/object').calledOnce, 'arguments/0'), {
content: 'assert(observer1.next.calledOnce)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 51
}));
(0, _powerAssert2.default)(_rec3._expr(_rec3._capt(_rec3._capt(_rec3._capt(_rec3._capt(observer1, 'arguments/0/callee/object/object/object').next, 'arguments/0/callee/object/object').firstCall, 'arguments/0/callee/object').calledWith(_rec3._capt({ b: _rec3._capt({ v: 321 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observer1.next.firstCall.calledWith({ b: { v: 321 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 52
}));
(0, _powerAssert2.default)(_rec4._expr(_rec4._capt(_rec4._capt(_rec4._capt(observer2, 'arguments/0/object/object').next, 'arguments/0/object').calledOnce, 'arguments/0'), {
content: 'assert(observer2.next.calledOnce)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 54
}));
(0, _powerAssert2.default)(_rec5._expr(_rec5._capt(_rec5._capt(_rec5._capt(_rec5._capt(observer2, 'arguments/0/callee/object/object/object').next, 'arguments/0/callee/object/object').firstCall, 'arguments/0/callee/object').calledWith(_rec5._capt({ b: _rec5._capt({ v: 321 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observer2.next.firstCall.calledWith({ b: { v: 321 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 55
}));
});
it('should update mounted listener', function () {
var _rec6 = new _powerAssertRecorder(),
_rec7 = new _powerAssertRecorder(),
_rec8 = new _powerAssertRecorder();
var _createState3 = (0, _TestState.createState)();
var B = _createState3.B;
var AppState = _createState3.AppState;
var bSetter = _createState3.bSetter;
var di = (0, _createPureStateDi2.default)(new AppState());
var observer /*: Observer*/ = {
next: _sinon2.default.spy(),

@@ -81,16 +169,16 @@ complete: _sinon2.default.spy(),

(0, _powerAssert2.default)(_rec2._expr(_rec2._capt(_rec2._capt(_rec2._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').calledTwice, 'arguments/0'), {
(0, _powerAssert2.default)(_rec6._expr(_rec6._capt(_rec6._capt(_rec6._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').calledTwice, 'arguments/0'), {
content: 'assert(observer.next.calledTwice)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 40
line: 73
}));
(0, _powerAssert2.default)(_rec3._expr(_rec3._capt(_rec3._capt(_rec3._capt(_rec3._capt(observer, 'arguments/0/callee/object/object/object').next, 'arguments/0/callee/object/object').firstCall, 'arguments/0/callee/object').calledWith(_rec3._capt({ b: _rec3._capt({ v: 321 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
(0, _powerAssert2.default)(_rec7._expr(_rec7._capt(_rec7._capt(_rec7._capt(_rec7._capt(observer, 'arguments/0/callee/object/object/object').next, 'arguments/0/callee/object/object').firstCall, 'arguments/0/callee/object').calledWith(_rec7._capt({ b: _rec7._capt({ v: 321 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observer.next.firstCall.calledWith({ b: { v: 321 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 41
line: 74
}));
(0, _powerAssert2.default)(_rec4._expr(_rec4._capt(_rec4._capt(_rec4._capt(_rec4._capt(observer, 'arguments/0/callee/object/object/object').next, 'arguments/0/callee/object/object').secondCall, 'arguments/0/callee/object').calledWith(_rec4._capt({ b: _rec4._capt({ v: 333 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
(0, _powerAssert2.default)(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(_rec8._capt(observer, 'arguments/0/callee/object/object/object').next, 'arguments/0/callee/object/object').secondCall, 'arguments/0/callee/object').calledWith(_rec8._capt({ b: _rec8._capt({ v: 333 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observer.next.secondCall.calledWith({ b: { v: 333 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 42
line: 75
}));

@@ -100,13 +188,13 @@ });

it('should not update listener, if changed another path', function () {
var _rec5 = new _powerAssertRecorder();
var _rec9 = new _powerAssertRecorder();
var _createState3 = (0, _TestState.createState)();
var _createState4 = (0, _TestState.createState)();
var C = _createState3.C;
var AppState = _createState3.AppState;
var bSetter = _createState3.bSetter;
var C = _createState4.C;
var AppState = _createState4.AppState;
var bSetter = _createState4.bSetter;
var di = (0, _createPureStateDi2.default)(new AppState());
var observer /*: Observer*/ = { //eslint-disable-line
var observer /*: Observer*/ = {
next: _sinon2.default.spy(),

@@ -123,6 +211,6 @@ complete: _sinon2.default.spy(),

bSet(321);
(0, _powerAssert2.default)(_rec5._expr(_rec5._capt(_rec5._capt(_rec5._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').notCalled, 'arguments/0'), {
(0, _powerAssert2.default)(_rec9._expr(_rec9._capt(_rec9._capt(_rec9._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').notCalled, 'arguments/0'), {
content: 'assert(observer.next.notCalled)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 61
line: 94
}));

@@ -132,13 +220,13 @@ });

it('should not update unsubscribed listener', function () {
var _rec6 = new _powerAssertRecorder(),
_rec7 = new _powerAssertRecorder();
var _rec10 = new _powerAssertRecorder(),
_rec11 = new _powerAssertRecorder();
var _createState4 = (0, _TestState.createState)();
var _createState5 = (0, _TestState.createState)();
var B = _createState4.B;
var AppState = _createState4.AppState;
var bSetter = _createState4.bSetter;
var B = _createState5.B;
var AppState = _createState5.AppState;
var bSetter = _createState5.bSetter;
var di = (0, _createPureStateDi2.default)(new AppState());
var observer /*: Observer*/ = { //eslint-disable-line
var observer /*: Observer*/ = {
next: _sinon2.default.spy(),

@@ -155,11 +243,11 @@ complete: _sinon2.default.spy(),

bSet(333);
(0, _powerAssert2.default)(_rec6._expr(_rec6._capt(_rec6._capt(_rec6._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').calledOnce, 'arguments/0'), {
(0, _powerAssert2.default)(_rec10._expr(_rec10._capt(_rec10._capt(_rec10._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').calledOnce, 'arguments/0'), {
content: 'assert(observer.next.calledOnce)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 79
line: 112
}));
(0, _powerAssert2.default)(_rec7._expr(_rec7._capt(_rec7._capt(_rec7._capt(observer, 'arguments/0/callee/object/object').next, 'arguments/0/callee/object').calledWith(_rec7._capt({ b: _rec7._capt({ v: 321 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
(0, _powerAssert2.default)(_rec11._expr(_rec11._capt(_rec11._capt(_rec11._capt(observer, 'arguments/0/callee/object/object').next, 'arguments/0/callee/object').calledWith(_rec11._capt({ b: _rec11._capt({ v: 321 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observer.next.calledWith({ b: { v: 321 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 80
line: 113
}));

@@ -169,13 +257,13 @@ });

it('should update resubscribed listener', function () {
var _rec8 = new _powerAssertRecorder(),
_rec9 = new _powerAssertRecorder();
var _rec12 = new _powerAssertRecorder(),
_rec13 = new _powerAssertRecorder();
var _createState5 = (0, _TestState.createState)();
var _createState6 = (0, _TestState.createState)();
var B = _createState5.B;
var AppState = _createState5.AppState;
var bSetter = _createState5.bSetter;
var B = _createState6.B;
var AppState = _createState6.AppState;
var bSetter = _createState6.bSetter;
var di = (0, _createPureStateDi2.default)(new AppState());
var observer /*: Observer*/ = { //eslint-disable-line
var observer /*: Observer*/ = {
next: _sinon2.default.spy(),

@@ -195,11 +283,11 @@ complete: _sinon2.default.spy(),

bSet(324);
(0, _powerAssert2.default)(_rec8._expr(_rec8._capt(_rec8._capt(_rec8._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').calledTwice, 'arguments/0'), {
(0, _powerAssert2.default)(_rec12._expr(_rec12._capt(_rec12._capt(_rec12._capt(observer, 'arguments/0/object/object').next, 'arguments/0/object').calledTwice, 'arguments/0'), {
content: 'assert(observer.next.calledTwice)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 101
line: 134
}));
(0, _powerAssert2.default)(_rec9._expr(_rec9._capt(_rec9._capt(_rec9._capt(observer, 'arguments/0/callee/object/object').next, 'arguments/0/callee/object').calledWith(_rec9._capt({ b: _rec9._capt({ v: 324 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
(0, _powerAssert2.default)(_rec13._expr(_rec13._capt(_rec13._capt(_rec13._capt(observer, 'arguments/0/callee/object/object').next, 'arguments/0/callee/object').calledWith(_rec13._capt({ b: _rec13._capt({ v: 324 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observer.next.calledWith({ b: { v: 324 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 102
line: 135
}));

@@ -209,16 +297,15 @@ });

it('should handle one of two subscribed listener', function () {
var _rec10 = new _powerAssertRecorder(),
_rec11 = new _powerAssertRecorder(),
_rec12 = new _powerAssertRecorder();
var _rec14 = new _powerAssertRecorder(),
_rec15 = new _powerAssertRecorder(),
_rec16 = new _powerAssertRecorder();
var _createState6 = (0, _TestState.createState)();
var _createState7 = (0, _TestState.createState)();
var C = _createState6.C;
var B = _createState6.B;
var AppState = _createState6.AppState;
var bSetter = _createState6.bSetter;
var cSetter = _createState6.cSetter;
var C = _createState7.C;
var B = _createState7.B;
var AppState = _createState7.AppState;
var bSetter = _createState7.bSetter;
var di = (0, _createPureStateDi2.default)(new AppState());
var observerB /*: Observer*/ = { //eslint-disable-line
var observerB /*: Observer*/ = {
next: _sinon2.default.spy(),

@@ -228,3 +315,3 @@ complete: _sinon2.default.spy(),

};
var observerC /*: Observer*/ = { //eslint-disable-line
var observerC /*: Observer*/ = {
next: _sinon2.default.spy(),

@@ -235,3 +322,2 @@ complete: _sinon2.default.spy(),

var bSet = di(bSetter);
var cSet = di(cSetter);

@@ -251,16 +337,16 @@ function observablePropsB() {}

(0, _powerAssert2.default)(_rec10._expr(_rec10._capt(_rec10._capt(_rec10._capt(observerB, 'arguments/0/object/object').next, 'arguments/0/object').calledOnce, 'arguments/0'), {
(0, _powerAssert2.default)(_rec14._expr(_rec14._capt(_rec14._capt(_rec14._capt(observerB, 'arguments/0/object/object').next, 'arguments/0/object').calledOnce, 'arguments/0'), {
content: 'assert(observerB.next.calledOnce)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 134
line: 166
}));
(0, _powerAssert2.default)(_rec11._expr(_rec11._capt(_rec11._capt(_rec11._capt(observerB, 'arguments/0/callee/object/object').next, 'arguments/0/callee/object').calledWith(_rec11._capt({ b: _rec11._capt({ v: 333 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
(0, _powerAssert2.default)(_rec15._expr(_rec15._capt(_rec15._capt(_rec15._capt(observerB, 'arguments/0/callee/object/object').next, 'arguments/0/callee/object').calledWith(_rec15._capt({ b: _rec15._capt({ v: 333 }, 'arguments/0/arguments/0/properties/0/value') }, 'arguments/0/arguments/0')), 'arguments/0'), {
content: 'assert(observerB.next.calledWith({ b: { v: 333 } }))',
filepath: 'src/__tests__/DiEventsTest.js',
line: 135
line: 167
}));
(0, _powerAssert2.default)(_rec12._expr(_rec12._capt(_rec12._capt(_rec12._capt(observerC, 'arguments/0/object/object').next, 'arguments/0/object').notCalled, 'arguments/0'), {
(0, _powerAssert2.default)(_rec16._expr(_rec16._capt(_rec16._capt(_rec16._capt(observerC, 'arguments/0/object/object').next, 'arguments/0/object').notCalled, 'arguments/0'), {
content: 'assert(observerC.next.notCalled)',
filepath: 'src/__tests__/DiEventsTest.js',
line: 136
line: 168
}));

@@ -267,0 +353,0 @@ });

@@ -27,6 +27,3 @@ 'use strict';

var getter = _annotations2.default.getter;
var setter = _annotations2.default.setter;
var model = _annotations2.default.model;
var factory = _annotations2.default.factory;
/*:: import type {Getter} from 'reactive-di/i/plugins/getterInterfaces'*/

@@ -42,3 +39,2 @@

var B = _createState.B;
var C = _createState.C;
var AppState = _createState.AppState;

@@ -61,3 +57,3 @@ var bSetter = _createState.bSetter;

filepath: 'src/__tests__/DiSettersGettersTest.js',
line: 34
line: 31
}));

@@ -72,5 +68,3 @@ });

var A = _createState2.A;
var B = _createState2.B;
var C = _createState2.C;
var AppState = _createState2.AppState;

@@ -90,3 +84,3 @@ var bSetter = _createState2.bSetter;

filepath: 'src/__tests__/DiSettersGettersTest.js',
line: 45
line: 42
}));

@@ -97,3 +91,3 @@ bSet(321);

filepath: 'src/__tests__/DiSettersGettersTest.js',
line: 47
line: 44
}));

@@ -100,0 +94,0 @@ });

@@ -10,6 +10,2 @@ 'use strict';

var _sinon = require('sinon');
var _sinon2 = _interopRequireDefault(_sinon);
var _annotations = require('./annotations');

@@ -27,7 +23,3 @@

var getter = _annotations2.default.getter;
var setter = _annotations2.default.setter;
var model = _annotations2.default.model;
var factory = _annotations2.default.factory;
/*:: import type {Getter} from 'reactive-di/i/plugins/getterInterfaces'*/

@@ -42,5 +34,3 @@

var A = _createState.A;
var B = _createState.B;
var C = _createState.C;
var AppState = _createState.AppState;

@@ -61,7 +51,7 @@ var aSetter = _createState.aSetter;

filepath: 'src/__tests__/DiStateTest.js',
line: 30
line: 24
}), _rec2._expr(_rec2._capt({ v: 321 }, 'arguments/1'), {
content: 'assert.deepEqual(di(MyDep), { v: 321 })',
filepath: 'src/__tests__/DiStateTest.js',
line: 30
line: 24
}));

@@ -77,4 +67,2 @@ });

var A = _createState2.A;
var B = _createState2.B;
var C = _createState2.C;
var AppState = _createState2.AppState;

@@ -94,3 +82,3 @@ var bSetter = _createState2.bSetter;

filepath: 'src/__tests__/DiStateTest.js',
line: 41
line: 35
}), _rec4._expr(_rec4._capt({

@@ -107,3 +95,3 @@ b: _rec4._capt({

filepath: 'src/__tests__/DiStateTest.js',
line: 41
line: 35
}));

@@ -118,4 +106,2 @@ });

var A = _createState3.A;
var B = _createState3.B;
var C = _createState3.C;

@@ -137,7 +123,7 @@ var AppState = _createState3.AppState;

filepath: 'src/__tests__/DiStateTest.js',
line: 61
line: 55
}), _rec6._expr(_rec6._capt({ v: 'test' }, 'arguments/1'), {
content: 'assert.deepEqual(di(MyDep), { v: \'test\' })',
filepath: 'src/__tests__/DiStateTest.js',
line: 61
line: 55
}));

@@ -152,5 +138,3 @@ });

var A = _createState4.A;
var B = _createState4.B;
var C = _createState4.C;
var AppState = _createState4.AppState;

@@ -171,7 +155,7 @@ var bSetter = _createState4.bSetter;

filepath: 'src/__tests__/DiStateTest.js',
line: 73
line: 67
}), _rec8._expr(_rec8._capt({ v: 321 }, 'arguments/1'), {
content: 'assert.deepEqual(di(MyDep), { v: 321 })',
filepath: 'src/__tests__/DiStateTest.js',
line: 73
line: 67
}));

@@ -178,0 +162,0 @@ });

@@ -24,3 +24,3 @@ 'use strict';

var model = _annotations2.default.model;
var setter = _annotations2.default.setter;
var syncsetter = _annotations2.default.syncsetter;
function createState() /*: {

@@ -78,3 +78,3 @@ A: Function,

}
setter(A)(aSetter);
syncsetter(A)(aSetter);

@@ -84,3 +84,3 @@ function bSetter(b /*: B*/, v /*: number*/) /*: B*/ {

}
setter(B)(bSetter);
syncsetter(B)(bSetter);

@@ -90,3 +90,3 @@ function cSetter(c /*: C*/, v /*: string*/) /*: C*/ {

}
setter(C)(cSetter);
syncsetter(C)(cSetter);

@@ -93,0 +93,0 @@ return {

@@ -6,8 +6,3 @@ 'use strict';

});
exports.DepArgsImpl = undefined;
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _set = require('babel-runtime/core-js/set');

@@ -21,2 +16,6 @@

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');

@@ -26,6 +25,2 @@

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _zenObservable = require('zen-observable');

@@ -41,3 +36,2 @@

Dependency,
Deps,
AnyAnnotation,

@@ -53,3 +47,2 @@ Tag

AnyDep,
DepArgs,
AnnotationResolver,

@@ -60,18 +53,10 @@ ListenerManager,

/*:: import type {FinalizeFn} from 'reactive-di/i/pluginInterfaces'*/
// implements DepArgs
/*:: import type {Plugin} from 'reactive-di/i/pluginInterfaces'*/
var DepArgsImpl = exports.DepArgsImpl = function DepArgsImpl /*:: <M>*/(deps /*: Array<AnyDep>*/, depNames /*: ?Array<string>*/, middlewares /*: ?Array<M>*/) {
(0, _classCallCheck3.default)(this, DepArgsImpl);
this.deps = deps;
this.depNames = depNames;
this.middlewares = middlewares;
};
// implements ListenerManager
/*:: type Listener<V, E> = {
observers: Array<Observer<V, E>>;
target: ResolvableDep<V>;
};*/
var ListenerManagerImpl = function () {

@@ -87,3 +72,11 @@ function ListenerManagerImpl() {

for (var i = 0, l = listeners.length; i < l; i++) {
listeners[i]();
var _listeners$i = listeners[i];
var _observers = _listeners$i.observers;
var _target = _listeners$i.target;
if (_target.base.isRecalculate) {
for (var j = 0, k = _observers.length; j < k; j++) {
_observers[j].next(_target.resolve());
}
}
}

@@ -97,19 +90,17 @@ };

var self = this;
var base = target.base;
/* eslint-disable no-undef */
var observers /*: Array<Observer<V, E>>*/ = [];
var listener /*: Listener*/ = {
observers: observers,
target: target
};
self._listeners.push(listener);
function subscriberFn(observer /*: SubscriptionObserver*/) /*: Subscription*/ {
/* eslint-enable */
function next() /*: void*/ {
if (base.isRecalculate) {
observer.next(target.resolve());
}
function listenersFilter(dep /*: SubscriptionObserver*/) /*: boolean*/ {
return dep !== observer;
}
function listenersFilter(dep /*: Function*/) /*: boolean*/ {
return dep !== next;
}
function unsubscribe() /*: void*/ {
self._listeners = self._listeners.filter(listenersFilter);
listener.observers = listener.observers.filter(listenersFilter);
}
self._listeners.push(next);
listener.observers.push(observer);
return { unsubscribe: unsubscribe };

@@ -132,3 +123,3 @@ }

this._driver = driver;
this._middlewares = middlewares;
this.middlewares = middlewares;
this._overrides = overrides;

@@ -145,3 +136,3 @@ this.createCursor = createCursor;

value: function newRoot() {
return new AnnotationResolverImpl(this._driver, this._middlewares, this._overrides, this.createCursor, this._plugins, this.listeners, this._cache);
return new AnnotationResolverImpl(this._driver, this.middlewares, this._overrides, this.createCursor, this._plugins, this.listeners, this._cache);
}

@@ -204,2 +195,5 @@ }, {

var plugin /*: Plugin*/ = this._plugins[annotation.kind];
if (!plugin) {
throw new Error('Plugin not found for annotation ' + annotation.base.info.displayName);
}
plugin.create(annotation, (this /*: AnnotationResolver*/));

@@ -220,45 +214,2 @@ dep = this._cache[base.id];

}
}, {
key: '_resolveMiddlewares',
value: function _resolveMiddlewares(annotatedDep /*: Dependency*/, tags /*: Array<Tag>*/) {
var middlewares = this._middlewares;
var ids /*: Array<Dependency|Tag>*/ = [annotatedDep].concat(tags);
var middlewareDeps /*: Array<AnyDep>*/ = [];
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(this.resolve(depMiddlewares[j]));
}
}
}
return middlewareDeps.length ? middlewareDeps : null;
}
}, {
key: 'getDeps',
value: function getDeps(deps /*: ?Deps*/, annotatedDep /*: Dependency*/, tags /*: Array<Tag>*/) {
var depNames /*: ?Array<string>*/ = null;
var resolvedDeps /*: Array<AnyDep>*/ = [];
if (deps && 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(this.resolve(argsObject[key]));
depNames.push(key);
}
} else {
for (var i = 0, l = deps.length; i < l; i++) {
var dep /*: AnyDep*/ = this.resolve(((deps /*: any*/) /*: Array<Dependency>*/)[i]);
resolvedDeps.push(dep);
}
}
}
var middlewares /*: ?Array<AnyDep>*/ = this._resolveMiddlewares(annotatedDep, tags);
return new DepArgsImpl(resolvedDeps, depNames, middlewares);
}
}]);

@@ -265,0 +216,0 @@ return AnnotationResolverImpl;

@@ -8,6 +8,2 @@ 'use strict';

var _AsyncModelAnnotationImpl = require('./plugins/asyncmodel/AsyncModelAnnotationImpl');
var _AsyncModelAnnotationImpl2 = _interopRequireDefault(_AsyncModelAnnotationImpl);
var _ClassAnnotationImpl = require('./plugins/class/ClassAnnotationImpl');

@@ -49,6 +45,10 @@

var _SetterAnnotationImpl = require('./plugins/setter/SetterAnnotationImpl');
var _AsyncSetterAnnotationImpl = require('./plugins/setter/AsyncSetterAnnotationImpl');
var _SetterAnnotationImpl2 = _interopRequireDefault(_SetterAnnotationImpl);
var _AsyncSetterAnnotationImpl2 = _interopRequireDefault(_AsyncSetterAnnotationImpl);
var _SyncSetterAnnotationImpl = require('./plugins/setter/SyncSetterAnnotationImpl');
var _SyncSetterAnnotationImpl2 = _interopRequireDefault(_SyncSetterAnnotationImpl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -64,20 +64,25 @@

} from 'reactive-di/i/annotationInterfaces'*/
/* eslint-disable no-undef */
/*:: import type {
AsyncUpdater,
AnyUpdater
} from 'reactive-di/i/plugins/asyncmodelInterfaces'*/
SyncUpdater
} from 'reactive-di/i/plugins/setterInterfaces'*/
/*:: export type Annotations = {
klass(...deps: Array<DepItem>): <P: Object>(target: Class<P>) => Class<P>;
factory(...deps: Array<DepItem>): <T: DepFn>(target: T) => T;
getter<V: Object>(target: Class<V>): Class<V>;
meta<T: Dependency>(target: T): () => void;
model<V: Object>(target: Class<V>): Class<V>;
asyncmodel<V: Object>(target: Class<V>): Class<V>;
observable<V>(...deps: Array<DepItem>): (target: Dependency<V>) => Dependency<V>;
setter<V: Object, E>(model: Class<V>, ...deps: Array<DepItem>)
: (target: AnyUpdater<V, E>) => AnyUpdater<V, E>;
asyncsetter<V: Object, E>(model: Class<V>, ...deps: Array<DepItem>)
: (target: AsyncUpdater<V, E>) => AsyncUpdater<V, E>;
syncsetter<V: Object>(model: Class<V>, ...deps: Array<DepItem>)
: (target: SyncUpdater<V>) => SyncUpdater<V>;
loader<V: Object, E>(model: Class<V>, ...deps: Array<DepItem>)

@@ -94,3 +99,3 @@ : (target: AsyncUpdater<V, E>) => AsyncUpdater<V, E>;

return {
/* eslint-disable no-unused-vars */
/* eslint-disable no-shadow */

@@ -143,6 +148,3 @@ klass: function klass() {

},
asyncmodel: function asyncmodel(target /*: Class<V>*/) {
return driver.annotate(target, new _AsyncModelAnnotationImpl2.default(ids.createId(), target, tags));
},
setter: function setter(model /*: Class<V>*/) {
asyncsetter: function asyncsetter(model /*: Class<V>*/) {
for (var _len4 = arguments.length, deps = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {

@@ -152,7 +154,7 @@ deps[_key4 - 1] = arguments[_key4];

return function _setter(target /*: AnyUpdater<V, E>*/) /*: AnyUpdater<V, E>*/ {
return driver.annotate(target, new _SetterAnnotationImpl2.default(ids.createId(), model, target, deps, tags));
return function _asyncsetter(target /*: AsyncUpdater<V, E>*/) /*: AsyncUpdater<V, E>*/ {
return driver.annotate(target, new _AsyncSetterAnnotationImpl2.default(ids.createId(), model, target, deps, tags));
};
},
loader: function loader(model /*: Class<V>*/) {
syncsetter: function syncsetter(model /*: Class<V>*/) {
for (var _len5 = arguments.length, deps = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {

@@ -162,2 +164,11 @@ deps[_key5 - 1] = arguments[_key5];

return function _syncsetter(target /*: SyncUpdater<V>*/) /*: SyncUpdater<V>*/ {
return driver.annotate(target, new _SyncSetterAnnotationImpl2.default(ids.createId(), model, target, deps, tags));
};
},
loader: function loader(model /*: Class<V>*/) {
for (var _len6 = arguments.length, deps = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
deps[_key6 - 1] = arguments[_key6];
}
return function _loader(target /*: AsyncUpdater<V, E>*/) /*: AsyncUpdater<V, E>*/ {

@@ -172,6 +183,4 @@ return driver.annotate(target, new _LoaderAnnotationImpl2.default(ids.createId(), target, model, deps, tags));

}
/* eslint-enable no-undef */
};
}
//# sourceMappingURL=createAnnotations.js.map

@@ -21,6 +21,2 @@ 'use strict';

var _AsyncModelPlugin = require('./plugins/asyncmodel/AsyncModelPlugin');
var _AsyncModelPlugin2 = _interopRequireDefault(_AsyncModelPlugin);
var _ClassPlugin = require('./plugins/class/ClassPlugin');

@@ -58,6 +54,10 @@

var _SetterPlugin = require('./plugins/setter/SetterPlugin');
var _SyncSetterPlugin = require('./plugins/setter/SyncSetterPlugin');
var _SetterPlugin2 = _interopRequireDefault(_SetterPlugin);
var _SyncSetterPlugin2 = _interopRequireDefault(_SyncSetterPlugin);
var _AsyncSetterPlugin = require('./plugins/setter/AsyncSetterPlugin');
var _AsyncSetterPlugin2 = _interopRequireDefault(_AsyncSetterPlugin);
var _SymbolMetaDriver = require('./drivers/SymbolMetaDriver');

@@ -81,3 +81,4 @@

factory: new _FactoryPlugin2.default(),
setter: new _SetterPlugin2.default(),
asyncsetter: new _AsyncSetterPlugin2.default(),
syncsetter: new _SyncSetterPlugin2.default(),
getter: new _GetterPlugin2.default(),

@@ -87,3 +88,2 @@ model: new _ModelPlugin2.default(),

reset: new _ResetPlugin2.default(),
asyncmodel: new _AsyncModelPlugin2.default(),
observable: new _ObservablePlugin2.default(),

@@ -90,0 +90,0 @@ meta: new _MetaPlugin2.default()

@@ -21,5 +21,4 @@ 'use strict';

/* eslint-disable no-unused-vars */
/*:: import type {
AnnotationDriver,
AnnotationDriver, // eslint-disable-line
AnyAnnotation,

@@ -42,2 +41,3 @@ Dependency

value: function annotate(dep /*: T*/, annotation /*: A*/) {
// eslint-disable-line
if ((dep /*: Function*/)[metaSymbol]) {

@@ -44,0 +44,0 @@ throw new Error('Annotation already defined for ' + ((dep /*: Function*/).displayName || String(dep)));

@@ -6,3 +6,3 @@ 'use strict';

});
exports.merge = exports.getFunctionName = exports.createAnnotations = exports.createPureStateDi = exports.BaseCollection = exports.SymbolMetaDriver = exports.DefaultIdCreator = undefined;
exports.promiseToObservable = exports.merge = exports.getFunctionName = exports.createAnnotations = exports.createPureStateDi = exports.BaseCollection = exports.SymbolMetaDriver = exports.DefaultIdCreator = undefined;

@@ -25,2 +25,6 @@ var _createAnnotations = require('./createAnnotations');

var _promiseToObservable = require('./utils/promiseToObservable');
var _promiseToObservable2 = _interopRequireDefault(_promiseToObservable);
var _BaseCollection = require('./utils/BaseCollection');

@@ -47,2 +51,3 @@

exports.merge = _merge2.default;
exports.promiseToObservable = _promiseToObservable2.default;
//# sourceMappingURL=index.js.map

@@ -26,8 +26,6 @@ 'use strict';

/*:: type PropCreator<V: Object, N: Object> = (value: V) => N;*/
/*:: type PropCreatorMap = SimpleMap<string, PropCreator>;*/
/* eslint-disable no-undef */
/*:: type PropCreatorMap = SimpleMap<string, PropCreator>;*/
function createFromJS /*:: <T: Object>*/(Proto /*: Class<T>*/, propCreators /*: PropCreatorMap*/) /*: FromJS<T>*/ {
/* eslint-enable no-undef */
return function fromJS /*:: <R: Object>*/(data /*: R*/) /*: T*/ {

@@ -34,0 +32,0 @@ var keys = (0, _keys2.default)(data);

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -26,4 +26,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var ClassAnnotationImpl = function ClassAnnotationImpl /*:: <V: Object>*/(id /*: DepId*/, target /*: Class<V>*/, // eslint-disable-line
deps /*: ?Deps*/, tags /*: Array<string>*/) {
var ClassAnnotationImpl = function ClassAnnotationImpl /*:: <V: Object>*/(id /*: DepId*/, target /*: Class<V>*/, deps /*: ?Deps*/, tags /*: Array<string>*/) {
(0, _classCallCheck3.default)(this, ClassAnnotationImpl);

@@ -34,6 +33,5 @@

this.deps = deps;
} // eslint-disable-line
;
};
exports.default = ClassAnnotationImpl;
//# sourceMappingURL=ClassAnnotationImpl.js.map

@@ -16,15 +16,15 @@ 'use strict';

var _defaultFinalizer = require('../factory/defaultFinalizer');
var _defaultFinalizer = require('../../pluginsCommon/defaultFinalizer');
var _defaultFinalizer2 = _interopRequireDefault(_defaultFinalizer);
var _resolveDeps = require('../factory/resolveDeps');
var _resolveDeps = require('../../pluginsCommon/resolveDeps');
var _resolveDeps2 = _interopRequireDefault(_resolveDeps);
var _InvokerImpl = require('../factory/InvokerImpl');
var _DepsResolverImpl = require('../../pluginsCommon/DepsResolverImpl');
var _InvokerImpl2 = _interopRequireDefault(_InvokerImpl);
var _DepsResolverImpl2 = _interopRequireDefault(_DepsResolverImpl);
var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -42,2 +42,3 @@ var _createProxy = require('../../utils/createProxy');

/*:: import type {
DepArgs,
AnyDep,

@@ -54,9 +55,7 @@ DepBase

ClassDep,
ClassAnnotation,
ClassInvoker
ClassAnnotation
} from 'reactive-di/i/plugins/classInterfaces'*/
var ClassDepImpl = exports.ClassDepImpl = function () {
function ClassDepImpl /*:: <V: Object>*/(id /*: DepId*/, info /*: Info*/, target // eslint-disable-line
/*: Class<V>*/) {
function ClassDepImpl /*:: <V: Object>*/(id /*: DepId*/, info /*: Info*/, target /*: Class<V>*/) {
(0, _classCallCheck3.default)(this, ClassDepImpl);

@@ -66,2 +65,3 @@

this.base = new _pluginImpls.DepBaseImpl(id, info);
this._target = target;
}

@@ -72,14 +72,11 @@

value: function resolve() {
var base = this.base;
var invoker = this._invoker;
if (!base.isRecalculate) {
if (!this.base.isRecalculate) {
return this._value;
}
var args = (0, _resolveDeps2.default)(invoker.depArgs);
var obj /*: V*/ = (0, _fastCall.fastCreateObject)(invoker.target, args.deps);
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);
}
base.isRecalculate = false;
this.base.isRecalculate = false;
this._value = obj;

@@ -90,5 +87,5 @@

}, {
key: 'setInvoker',
value: function setInvoker(invoker /*: ClassInvoker<V>*/) {
this._invoker = invoker;
key: 'init',
value: function init(depArgs /*: DepArgs*/) {
this._depArgs = depArgs;
}

@@ -114,4 +111,5 @@ }]);

var dep /*: ClassDepImpl<V>*/ = new ClassDepImpl(base.id, base.info, base.target);
var resolver = new _DepsResolverImpl2.default(acc);
acc.begin(dep);
dep.setInvoker(new _InvokerImpl2.default(base.target, acc.getDeps(annotation.deps, base.target, base.info.tags)));
dep.init(resolver.getDeps(annotation.deps, base.target, base.info.tags));
acc.end(dep);

@@ -118,0 +116,0 @@ }

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -14,0 +14,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -16,15 +16,15 @@ 'use strict';

var _defaultFinalizer = require('./defaultFinalizer');
var _defaultFinalizer = require('../../pluginsCommon/defaultFinalizer');
var _defaultFinalizer2 = _interopRequireDefault(_defaultFinalizer);
var _resolveDeps2 = require('./resolveDeps');
var _resolveDeps2 = require('../../pluginsCommon/resolveDeps');
var _resolveDeps3 = _interopRequireDefault(_resolveDeps2);
var _InvokerImpl = require('./InvokerImpl');
var _DepsResolverImpl = require('../../pluginsCommon/DepsResolverImpl');
var _InvokerImpl2 = _interopRequireDefault(_InvokerImpl);
var _DepsResolverImpl2 = _interopRequireDefault(_DepsResolverImpl);
var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -38,2 +38,3 @@ var _createProxy = require('../../utils/createProxy');

/*:: import type {
DepFn,
DepId,

@@ -43,2 +44,3 @@ Info

/*:: import type {
DepArgs,
AnyDep,

@@ -50,13 +52,12 @@ DepBase,

/*:: import type {Plugin} from 'reactive-di/i/pluginInterfaces'*/
// implements FactoryDep
/*:: import type {
FactoryDep,
FactoryAnnotation,
FactoryInvoker
FactoryAnnotation
} from 'reactive-di/i/plugins/factoryInterfaces'*/
// implements FactoryDep
var FactoryDepImpl = exports.FactoryDepImpl = function () {
function FactoryDepImpl /*:: <V: any>*/(id /*: DepId*/, info /*: Info*/) {
function FactoryDepImpl /*:: <V: any>*/(id /*: DepId*/, info /*: Info*/, target /*: DepFn<V>*/) {
(0, _classCallCheck3.default)(this, FactoryDepImpl);

@@ -66,2 +67,3 @@

this.base = new _pluginImpls.DepBaseImpl(id, info);
this._target = target;
}

@@ -71,4 +73,4 @@

key: 'init',
value: function init(invoker /*: FactoryInvoker<V>*/) {
this._invoker = invoker;
value: function init(depArgs /*: DepArgs*/) {
this._depArgs = depArgs;
}

@@ -78,10 +80,7 @@ }, {

value: function resolve() {
var base = this.base;
var invoker = this._invoker;
if (!base.isRecalculate) {
if (!this.base.isRecalculate) {
return this._value;
}
var _resolveDeps = (0, _resolveDeps3.default)(invoker.depArgs);
var _resolveDeps = (0, _resolveDeps3.default)(this._depArgs);

@@ -91,6 +90,6 @@ var deps = _resolveDeps.deps;

var fn /*: V*/ = (0, _fastCall.fastCall)(invoker.target, deps);
var fn /*: V*/ = (0, _fastCall.fastCall)(this._target, deps);
if (middlewares) {
if (typeof fn !== 'function') {
throw new Error('No callable returns from dep ' + base.info.displayName);
throw new Error('No callable returns from ' + this.base.info.displayName);
}

@@ -100,3 +99,3 @@ fn = (0, _createProxy.createFunctionProxy)(fn, middlewares);

this._value = fn;
base.isRecalculate = false;
this.base.isRecalculate = false;

@@ -124,4 +123,5 @@ return this._value;

var dep /*: FactoryDepImpl<V>*/ = new FactoryDepImpl(base.id, base.info, base.target);
var resolver = new _DepsResolverImpl2.default(acc);
acc.begin(dep);
dep.init(new _InvokerImpl2.default(base.target, acc.getDeps(annotation.deps, base.target, base.info.tags)));
dep.init(resolver.getDeps(annotation.deps, base.target, base.info.tags));
acc.end(dep);

@@ -128,0 +128,0 @@ }

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -25,6 +25,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var GetterAnnotationImpl = // eslint-disable-line
function GetterAnnotationImpl /*:: <V: Object>*/(id /*: DepId*/, target /*: Class<V>*/, // eslint-disable-line
tags /*: Array<string>*/) {
var GetterAnnotationImpl = function GetterAnnotationImpl /*:: <V: Object>*/(id /*: DepId*/, target /*: Class<V>*/, tags /*: Array<string>*/) {
(0, _classCallCheck3.default)(this, GetterAnnotationImpl);

@@ -31,0 +28,0 @@

@@ -15,3 +15,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -31,3 +31,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/*:: import type {Plugin} from 'reactive-di/i/pluginInterfaces'*/
/*:: import type {AsyncModelDep} from 'reactive-di/i/plugins/asyncmodelInterfaces'*/
/*:: import type {ModelDep} from 'reactive-di/i/plugins/modelInterfaces'*/

@@ -39,3 +38,2 @@ /*:: import type {

} from 'reactive-di/i/plugins/getterInterfaces'*/
/*:: type AnyModelDep<V, E> = ModelDep<V>|AsyncModelDep<V, E>;*/

@@ -83,4 +81,4 @@

var modelDep /*: AnyModelDep<V, E>*/ = (acc.newRoot().resolve(base.target) /*: any*/);
if (modelDep.kind !== 'model' && modelDep.kind !== 'asyncmodel') {
var modelDep /*: ModelDep<V>*/ = (acc.newRoot().resolve(base.target) /*: any*/);
if (modelDep.kind !== 'model') {
throw new Error('Not a model dep type: ' + modelDep.kind + ' in ' + modelDep.base.info.displayName);

@@ -87,0 +85,0 @@ }

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -21,3 +21,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

} from 'reactive-di/i/annotationInterfaces'*/
/*:: import type {AsyncUpdater} from 'reactive-di/i/plugins/asyncmodelInterfaces'*/
/*:: import type {AsyncUpdater} from 'reactive-di/i/plugins/setterInterfaces'*/
// eslint-disable-line

@@ -28,4 +28,3 @@

var LoaderAnnotationImpl = function LoaderAnnotationImpl /*:: <V: Object, E>*/(id /*: DepId*/, target /*: AsyncUpdater<V, E>*/, model /*: Class<V>*/, // eslint-disable-line
deps /*: ?Deps*/, tags /*: Array<string>*/) {
var LoaderAnnotationImpl = function LoaderAnnotationImpl /*:: <V: Object, E>*/(id /*: DepId*/, target /*: AsyncUpdater<V, E>*/, model /*: Class<V>*/, deps /*: ?Deps*/, tags /*: Array<string>*/) {
(0, _classCallCheck3.default)(this, LoaderAnnotationImpl);

@@ -37,6 +36,5 @@

this.deps = deps;
} // eslint-disable-line
;
};
exports.default = LoaderAnnotationImpl;
//# sourceMappingURL=LoaderAnnotationImpl.js.map

@@ -15,11 +15,11 @@ 'use strict';

var _defaultFinalizer = require('../factory/defaultFinalizer');
var _defaultFinalizer = require('../../pluginsCommon/defaultFinalizer');
var _defaultFinalizer2 = _interopRequireDefault(_defaultFinalizer);
var _SetterAnnotationImpl = require('../setter/SetterAnnotationImpl');
var _AsyncSetterAnnotationImpl = require('../setter/AsyncSetterAnnotationImpl');
var _SetterAnnotationImpl2 = _interopRequireDefault(_SetterAnnotationImpl);
var _AsyncSetterAnnotationImpl2 = _interopRequireDefault(_AsyncSetterAnnotationImpl);
var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -34,3 +34,2 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

AnyDep,
Cacheable,
DepBase,

@@ -41,10 +40,6 @@ AnnotationResolver

/*:: import type {Plugin} from 'reactive-di/i/pluginInterfaces'*/
/*:: import type {AsyncModelDep} from 'reactive-di/i/plugins/asyncmodelInterfaces'*/
/*:: import type {
SetFn,
SetterDep
AsyncSetterDep
} from 'reactive-di/i/plugins/setterInterfaces'*/
// implements LoaderDep
/*:: import type {

@@ -55,4 +50,8 @@ LoaderAnnotation,

// implements LoaderDep
/*:: import type {ModelDep} from 'reactive-di/i/plugins/modelInterfaces'*/
var LoaderDepImpl = function () {
function LoaderDepImpl /*:: <V: Object, E>*/(id /*: DepId*/, info /*: Info*/) {
function LoaderDepImpl /*:: <V: Object>*/(id /*: DepId*/, info /*: Info*/) {
(0, _classCallCheck3.default)(this, LoaderDepImpl);

@@ -67,3 +66,3 @@

key: 'init',
value: function init(setterDep /*: SetterDep*/, model /*: AsyncModelDep<V, E>*/) {
value: function init(setterDep /*: AsyncSetterDep<V>*/, model /*: ModelDep<V>*/) {
this._setterDep = setterDep;

@@ -75,4 +74,3 @@ this._model = model;

value: function reset() {
this._setterDep.unsubscribe();
this._model.reset();
this._setterDep.reset();
this._setter = null;

@@ -87,7 +85,3 @@ }

var base = this.base;
var model = this._model;
var setterDep = this._setterDep;
var setter /*: SetFn*/ = setterDep.resolve();
var setter /*: SetFn*/ = this._setterDep.resolve();
if (this._setter !== setter) {

@@ -98,4 +92,4 @@ this._setter = setter;

base.isRecalculate = false;
this._value = model.resolve();
this.base.isRecalculate = false;
this._value = this._model.resolve();
return this._value;

@@ -121,10 +115,11 @@ }

var dep /*: LoaderDepImpl<V, E>*/ = new LoaderDepImpl(base.id, base.info);
var dep /*: LoaderDepImpl<V>*/ = new LoaderDepImpl(base.id, base.info);
acc.begin(dep);
var model /*: AnyDep*/ = acc.resolve(annotation.model);
if (model.kind !== 'asyncmodel') {
throw new Error('Not an asyncmodel ' + model.base.info.displayName + ' in ' + base.info.displayName);
if (model.kind !== 'model') {
throw new Error('Not an model ' + model.base.info.displayName + ' in ' + base.info.displayName);
}
var setterDep /*: AnyDep*/ = acc.resolveAnnotation(new _SetterAnnotationImpl2.default(base.id + '.setter', annotation.model, base.target, annotation.deps, base.info.tags));
if (setterDep.kind !== 'setter') {
var setterDep /*: AnyDep*/ = acc.resolveAnnotation(new _AsyncSetterAnnotationImpl2.default(base.id + '.setter', annotation.model, base.target, annotation.deps, base.info.tags));
if (setterDep.kind !== 'asyncsetter') {
throw new Error('Not a setter: ' + setterDep.base.info.displayName + ' in ' + base.info.displayName);

@@ -131,0 +126,0 @@ }

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -20,3 +20,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

} from 'reactive-di/i/annotationInterfaces'*/
/*:: import type {AsyncUpdater} from 'reactive-di/i/plugins/asyncmodelInterfaces'*/
/*:: import type {AsyncUpdater} from 'reactive-di/i/plugins/setterInterfaces'*/
// eslint-disable-line

@@ -23,0 +23,0 @@

@@ -15,8 +15,4 @@ 'use strict';

var _defaultFinalizer = require('../factory/defaultFinalizer');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');
var _defaultFinalizer2 = _interopRequireDefault(_defaultFinalizer);
var _pluginImpls = require('../../core/pluginImpls');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -89,5 +85,4 @@

key: 'finalize',
value: function finalize(dep /*: ResetDep*/, target /*: AnyDep*/) {
(0, _defaultFinalizer2.default)(dep, target);
}
value: function finalize(dep /*: ResetDep*/, target /*: AnyDep*/) {} // eslint-disable-line
}]);

@@ -94,0 +89,0 @@ return ResetPlugin;

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -14,0 +14,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -7,6 +7,2 @@ 'use strict';

var _promise = require('babel-runtime/core-js/promise');
var _promise2 = _interopRequireDefault(_promise);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

@@ -24,8 +20,4 @@

var _EntityMetaImpl = require('../asyncmodel/EntityMetaImpl');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');
var _EntityMetaImpl2 = _interopRequireDefault(_EntityMetaImpl);
var _pluginImpls = require('../../core/pluginImpls');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -44,14 +36,41 @@

/*:: import type {Plugin} from 'reactive-di/i/pluginInterfaces'*/
/*:: import type {EntityMeta} from 'reactive-di/i/nodeInterfaces'*/
/*:: import type {
EntityMeta,
MetaSource
} from 'reactive-di/i/plugins/asyncmodelInterfaces'*/
// implements MetaDep
/*:: import type {
MetaDep,
MetaSource,
MetaAnnotation
} from 'reactive-di/i/plugins/metaInterfaces'*/
function updateMeta /*:: <E>*/(meta /*: EntityMeta<E>*/, src /*: EntityMeta<E>*/) /*: boolean*/ {
var pending = src.pending;
var rejected = src.rejected;
var fulfilled = src.fulfilled;
var reason = src.reason;
var isChanged = false;
/* eslint-disable no-param-reassign */
if (!fulfilled) {
isChanged = true;
meta.fulfilled = false;
}
if (rejected) {
isChanged = true;
meta.rejected = rejected;
}
if (reason) {
isChanged = true;
meta.reason = reason;
}
if (pending) {
isChanged = true;
meta.pending = pending;
}
/* eslint-enable no-param-reassign */
return isChanged;
}
// implements MetaDep
var MetaDepImpl = function () {

@@ -64,3 +83,5 @@ function MetaDepImpl /*:: <E>*/(id /*: DepId*/, info /*: Info*/) {

this.sources = [];
this._value = new _EntityMetaImpl2.default({ peding: true });
this._value = new _pluginImpls.EntityMetaImpl({
pending: true
});
}

@@ -77,12 +98,10 @@

}
var meta /*: EntityMeta*/ = new _EntityMetaImpl2.default();
var promises /*: Array<Promise<any>>*/ = [];
var meta /*: EntityMeta<E>*/ = new _pluginImpls.EntityMetaImpl({
fulfilled: true
});
for (var i = 0, l = sources.length; i < l; i++) {
var sourceDep = sources[i];
(0, _EntityMetaImpl.updateMeta)(meta, sourceDep.meta);
promises.push(sourceDep.promise);
updateMeta(meta, sourceDep.meta);
}
this._value = (0, _merge2.default)(this._value, meta);
this.promise = _promise2.default.all(promises);
base.isRecalculate = false;

@@ -120,3 +139,3 @@ return this._value;

value: function finalize(dep /*: MetaDep<E>*/, target /*: AnyDep*/) {
if (target.kind === 'asyncmodel') {
if (target.kind === 'asyncsetter') {
target.metaOwners.push(dep.base);

@@ -123,0 +142,0 @@ dep.sources.push((target /*: MetaSource*/));

@@ -15,3 +15,3 @@ 'use strict';

var _pluginImpls = require('../../../core/pluginImpls');
var _pluginImpls = require('../../../pluginsCommon/pluginImpls');

@@ -55,4 +55,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _createClass3.default)(ModelDepImpl, [{
key: '_notifyData',
value: function _notifyData() {
key: 'reset',
value: function reset() {
var dataOwners = this.dataOwners;

@@ -67,6 +67,9 @@

value: function set(value /*: V*/) {
if (this._cursor.set(value)) {
var isChanged /*: boolean*/ = this._cursor.set(value);
if (isChanged) {
this._value = value;
this._notifyData();
this.reset();
}
return isChanged;
}

@@ -73,0 +76,0 @@ }, {

@@ -11,8 +11,4 @@ 'use strict';

var _ModelInfoImpl = require('./ModelInfoImpl');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');
var _ModelInfoImpl2 = _interopRequireDefault(_ModelInfoImpl);
var _pluginImpls = require('../../core/pluginImpls');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -22,7 +18,5 @@

DepId,
AnnotationBase
AnnotationBase,
Dependency
} from 'reactive-di/i/annotationInterfaces'*/
// implements ModelAnnotation
/*:: import type {

@@ -32,6 +26,18 @@ ModelInfo,

} from 'reactive-di/i/plugins/modelInterfaces'*/
// eslint-disable-line
var ModelAnnotationImpl = function ModelAnnotationImpl /*:: <V: Object>*/(id /*: DepId*/, target /*: Class<V>*/, // eslint-disable-line
tags /*: Array<string>*/) {
// implements ModelInfo
/*:: import type {FromJS} from 'reactive-di/i/modelInterfaces'*/
var ModelInfoImpl = function ModelInfoImpl /*:: <V>*/() {
(0, _classCallCheck3.default)(this, ModelInfoImpl);
this.childs = [];
this.statePath = [];
};
// implements ModelAnnotation
var ModelAnnotationImpl = function ModelAnnotationImpl /*:: <V: Object>*/(id /*: DepId*/, target /*: Class<V>*/, tags /*: Array<string>*/) {
(0, _classCallCheck3.default)(this, ModelAnnotationImpl);

@@ -41,7 +47,6 @@

this.base = new _pluginImpls.AnnotationBaseImpl(id, this.kind, tags, target);
this.info = new _ModelInfoImpl2.default();
} // eslint-disable-line
;
this.info = new ModelInfoImpl();
};
exports.default = ModelAnnotationImpl;
//# sourceMappingURL=ModelAnnotationImpl.js.map

@@ -15,6 +15,2 @@ 'use strict';

var _modelFinalizer = require('./modelFinalizer');
var _modelFinalizer2 = _interopRequireDefault(_modelFinalizer);
var _ModelDepImpl = require('./impl/ModelDepImpl');

@@ -29,2 +25,3 @@

AnyDep,
Cacheable,
AnnotationResolver

@@ -37,6 +34,5 @@ } from 'reactive-di/i/nodeInterfaces'*/

// implements Plugin
/*:: import type {
ModelDep,
ModelAnnotation,
ModelAnnotation
} from 'reactive-di/i/plugins/modelInterfaces'*/

@@ -71,3 +67,18 @@

value: function finalize(dep /*: ModelDep*/, child /*: AnyDep*/) {
(0, _modelFinalizer2.default)(dep, child);
var base = dep.base;
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);
}
}

@@ -74,0 +85,0 @@ }]);

@@ -11,3 +11,3 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');

@@ -14,0 +14,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -19,7 +19,6 @@ 'use strict';

var _pluginImpls = require('../../core/pluginImpls');
var _pluginImpls = require('../../pluginsCommon/pluginImpls');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable no-undef */
/*:: import type {

@@ -26,0 +25,0 @@ DepId,

@@ -40,3 +40,3 @@ 'use strict';

Collection, // eslint-disable-line
CollectionItem, // eslint-disable-line
CollectionItem,
ItemRec,

@@ -55,2 +55,3 @@ MapFn,

// implements Collection

@@ -62,2 +63,4 @@ /*:: type ItemsMap<Item> = {

var BaseCollection = function () {
// @@iterator(): Iterator<Item>;
function BaseCollection /*:: <Item: CollectionItem>*/() {

@@ -80,3 +83,4 @@ var rec /*:: ?: CollectionRec<Item>|Array<ItemRec>*/ = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];

value: function _copy(rec /*: CollectionRec<Item>*/) {
return (0, _merge2.default)(this, rec);
// TODO: remove type convertation after flow implements @@iterator to real classes
return (((0, _merge2.default)(this, rec) /*: any*/) /*: Collection<Item>*/);
}

@@ -203,3 +207,3 @@ }, {

return isChanged ? this._copy({ items: items }) : this;
return isChanged ? this._copy({ items: items }) : (this /*: any*/);
}

@@ -228,3 +232,3 @@ }, {

return items.length !== this.length ? this._copy({ items: items }) : this;
return items.length !== this.length ? this._copy({ items: items }) : (this /*: any*/);
}

@@ -245,3 +249,3 @@ }, {

return isChanged ? this._copy({ items: items }) : this;
return isChanged ? this._copy({ items: items }) : (this /*: any*/);
}

@@ -256,3 +260,2 @@ }]);

(BaseCollection.prototype /*: Object*/)[_iterator2.default] = function iterator() {
// eslint-disable-line
return {

@@ -259,0 +262,0 @@ next: function next() {

@@ -18,3 +18,2 @@ "use strict";

function fastCreateObject /*:: <T>*/(target /*: Class<T>*/, args /*: Array<any>*/) /*: T*/ {
/* eslint-disable new-cap */
switch (args.length) {

@@ -40,7 +39,5 @@ case 0:

}
/* eslint-enable new-cap */
}
function fastCallMethod /*:: <T>*/(obj /*: Object*/, fn /*: Function*/, args /*: Array<any>*/) /*: T*/ {
/* eslint-disable new-cap */
switch (args.length) {

@@ -66,7 +63,5 @@ case 0:

}
/* eslint-enable new-cap */
}
function fastCall /*:: <T>*/(fn /*: Function*/, args /*: Array<any>*/) /*: T*/ {
/* eslint-disable new-cap */
switch (args.length) {

@@ -92,4 +87,3 @@ case 0:

}
/* eslint-enable new-cap */
}
//# sourceMappingURL=fastCall.js.map

@@ -19,5 +19,3 @@ "use strict";

/* eslint-disable no-undef */
function merge /*:: <C: Object, R: Object>*/(obj /*: C*/, rec /*: R*/) /*: C*/ {
/* eslint-enable no-undef */
var keys /*: Array<string>*/ = (0, _keys2.default)(rec);

@@ -24,0 +22,0 @@ var isChanged /*: boolean*/ = false;

@@ -22,3 +22,2 @@ 'use strict';

function subscriberFn(observer /*: SubscriptionObserver*/) /*: Subscription*/ {
// eslint-disable-line
function unsubscribe() /*: void*/ {

@@ -25,0 +24,0 @@ // todo: memory leak

/* @flow */
import type {SimpleMap} from 'reactive-di/i/modelInterfaces'
import type {ClassAnnotation} from 'reactive-di/i/plugins/classInterfaces'
import type {FactoryAnnotation} from 'reactive-di/i/plugins/factoryInterfaces'
import type {GetterAnnotation} from 'reactive-di/i/plugins/getterInterfaces'
import type {LoaderAnnotation, ResetAnnotation} from 'reactive-di/i/plugins/loaderInterfaces'
import type {MetaAnnotation} from 'reactive-di/i/plugins/metaInterfaces'
import type {ModelAnnotation} from 'reactive-di/i/plugins/modelInterfaces'
import type {AsyncModelAnnotation} from 'reactive-di/i/plugins/asyncmodelInterfaces'
import type {SetterAnnotation} from 'reactive-di/i/plugins/setterInterfaces'
import type {GetterAnnotation} from 'reactive-di/i/plugins/getterInterfaces'
import type {ObservableAnnotation} from 'reactive-di/i/plugins/observableInterfaces'
import type {LoaderAnnotation, ResetAnnotation} from 'reactive-di/i/plugins/loaderInterfaces'
import type {
AsyncSetterAnnotation,
SyncSetterAnnotation
} from 'reactive-di/i/plugins/setterInterfaces'

@@ -60,5 +61,5 @@ export type DepId = string;

| ObservableAnnotation
| AsyncModelAnnotation
| LoaderAnnotation
| ResetAnnotation
| SetterAnnotation;
| AsyncSetterAnnotation
| SyncSetterAnnotation;
/* @flow */
import type {AsyncModelDep} from 'reactive-di/i/plugins/asyncmodelInterfaces'
import type {ClassDep} from 'reactive-di/i/plugins/classInterfaces'

@@ -14,3 +13,4 @@ import type {FactoryDep} from 'reactive-di/i/plugins/factoryInterfaces'

import type {ObservableDep} from 'reactive-di/i/plugins/observableInterfaces'
import type {SetterDep} from 'reactive-di/i/plugins/setterInterfaces'
import type {SyncSetterDep} from 'reactive-di/i/plugins/setterInterfaces'
import type {AsyncSetterDep} from 'reactive-di/i/plugins/setterInterfaces'
import type {

@@ -21,2 +21,3 @@ Info,

Deps,
Tag,
AnyAnnotation

@@ -32,3 +33,2 @@ } from 'reactive-di/i/annotationInterfaces'

| MetaDep
| AsyncModelDep
| ModelDep

@@ -38,5 +38,13 @@ | LoaderDep

| ResetDep
| SetterDep
| SyncSetterDep
| AsyncSetterDep
| GetterDep;
export type EntityMeta<E> = {
pending: boolean;
rejected: boolean;
fulfilled: boolean;
reason: ?E;
}
export type Cacheable = {

@@ -46,7 +54,2 @@ isRecalculate: boolean;

export type AsyncSubscription = {
refCount: number;
unsubscribe: () => void;
};
export type DepBase = {

@@ -58,11 +61,4 @@ id: DepId;

relations: Array<DepId>;
subscriptions: Array<AsyncSubscription>;
}
export type DepArgs<M> = {
deps: Array<AnyDep>;
depNames: ?Array<string>;
middlewares: ?Array<M>;
}
export type ResolvableDep<V> = {

@@ -81,3 +77,4 @@ base: DepBase;

listeners: ListenerManager;
getDeps(deps: ?Deps, dep: Dependency, tags: Array<string>): DepArgs;
middlewares: Map<Dependency|Tag, Array<Dependency>>;
resolveAnnotation(annotation: AnyAnnotation): AnyDep;

@@ -87,4 +84,18 @@ resolve(annotatedDep: Dependency): AnyDep;

begin(dep: AnyDep): void;
end<T: AnyDep>(dep: T): void; // eslint-disable-line
end(dep: AnyDep): void;
newRoot(): AnnotationResolver;
}
export type DepArgs = {
deps: Array<AnyDep>;
depNames: ?Array<string>;
middlewares: ?Array<AnyDep>;
}
export type Invoker<V> = {
invoke(args: Array<any>): V;
}
export type DepsResolver = {
getDeps(deps: ?Deps, annotatedDep: Dependency, tags: Array<Tag>): DepArgs;
}

@@ -8,11 +8,9 @@ /* @flow */

import type {DepBase} from 'reactive-di/i/nodeInterfaces'
import type {Invoker} from 'reactive-di/i/plugins/factoryInterfaces'
export type ClassAnnotation<V: Object> = {
kind: 'class';
base: AnnotationBase<Class<V>>; // eslint-disable-line
base: AnnotationBase<Class<V>>;
deps: ?Deps;
}
export type ClassInvoker<V> = Invoker<Class<V>, ClassDep>; // eslint-disable-line
export type ClassDep<V: Object> = {

@@ -19,0 +17,0 @@ kind: 'class';

@@ -12,8 +12,2 @@ /* @flow */

export type Hooks<T> = {
onUnmount: () => void;
onMount: () => void;
onUpdate: (currentValue: T, nextValue: T) => void;
}
export type FactoryAnnotation<V> = {

@@ -25,8 +19,2 @@ kind: 'factory';

export type Invoker<V, M> = {
target: V;
depArgs: DepArgs<M>;
}
export type FactoryInvoker<V> = Invoker<DepFn<V>, FactoryDep>;
export type FactoryDep<V: any> = {

@@ -37,3 +25,1 @@ kind: 'factory';

}
export type FactoryAnnotator = (...deps: Array<DepItem>) => <T: DepFn>(target: T) => T; // eslint-disable-line

@@ -8,3 +8,3 @@ /* @flow */

import type {DepBase} from 'reactive-di/i/nodeInterfaces'
import type {AsyncUpdater} from 'reactive-di/i/plugins/asyncmodelInterfaces'
import type {AsyncUpdater} from 'reactive-di/i/plugins/setterInterfaces'

@@ -28,3 +28,3 @@ export type LoaderDep<V: Object> = {

deps: ?Deps;
model: Class<V>; // eslint-disable-line
model: Class<V>;
}

@@ -31,0 +31,0 @@

/* @flow */
import type {AnnotationBase, Dependency} from 'reactive-di/i/annotationInterfaces'
import type {DepBase} from 'reactive-di/i/nodeInterfaces'
import type {EntityMeta, MetaSource} from 'reactive-di/i/plugins/asyncmodelInterfaces'
import type {
DepBase,
EntityMeta,
Cacheable
} from 'reactive-di/i/nodeInterfaces'
export type MetaSource<E> = {
meta: EntityMeta<E>;
metaOwners: Array<Cacheable>;
}
export type MetaAnnotation<V> = {

@@ -15,5 +23,4 @@ kind: 'meta';

base: DepBase;
promise: Promise<any>;
sources: Array<MetaSource>;
resolve: () => EntityMeta<E>;
}

@@ -28,6 +28,7 @@ /* @flow */

base: DepBase;
reset(): void;
resolve(): V;
setFromJS(value: Object): void;
set(value: V): void;
set(value: V): boolean;
dataOwners: Array<Cacheable>;
}

@@ -7,26 +7,51 @@ /* @flow */

} from 'reactive-di/i/annotationInterfaces'
import type {DepBase} from 'reactive-di/i/nodeInterfaces'
import type {
AnyUpdater,
AsyncModelDep
} from 'reactive-di/i/plugins/asyncmodelInterfaces'
EntityMeta,
DepBase,
Cacheable
} from 'reactive-di/i/nodeInterfaces'
import type {ModelDep} from 'reactive-di/i/plugins/modelInterfaces'
export type AnyModelDep<V, E> = ModelDep<V>|AsyncModelDep<V, E>;
export type SetFn = (...args: any) => void;
export type SetterCreator = (model: AnyModelDep) => SetFn;
export type SetterDep = {
kind: 'setter';
export type PromiseSource = {
promise: Promise<void>;
base: DepBase;
unsubscribe(): void;
}
export type AsyncResult<V: Object, E> = [V, Promise<V>|Observable<V, E>];
export type SyncSetterDep = {
kind: 'syncsetter';
base: DepBase;
resolve(): SetFn;
}
export type SetterAnnotation<V: Object, E> = {
kind: 'setter';
base: AnnotationBase<AnyUpdater<V, E>>;
export type AsyncSetterDep<E> = {
kind: 'asyncsetter';
base: DepBase;
meta: EntityMeta<E>;
promise: Promise<void>;
metaOwners: Array<Cacheable>;
childSetters: Array<PromiseSource>;
reset(): void;
resolve(): SetFn;
}
export type AsyncUpdater<V: Object, E> = (model: V, ...x: Array<any>) => AsyncResult<V, E>;
export type SyncUpdater<V: Object> = (model: V, ...x: Array<any>) => V;
export type SyncSetterAnnotation<V: Object> = {
kind: 'syncsetter';
base: AnnotationBase<SyncUpdater<V>>;
deps: ?Deps;
model: Class<V>; // eslint-disable-line
model: Class<V>;
}
export type AsyncSetterAnnotation<V: Object, E> = {
kind: 'asyncsetter';
base: AnnotationBase<AsyncUpdater<V, E>>;
deps: ?Deps;
model: Class<V>;
}
/* @flow */
declare function describe(name: string, cb: () => void): void;
declare function it(name: string, cb: () => void): ?Promise<void>;
declare function it(name: string, cb: (done?: () => void) => void): ?Promise<void>;
{
"name": "reactive-di",
"version": "0.0.15",
"version": "0.0.18",
"description": "Reactive dependency injection",

@@ -16,3 +16,3 @@ "publishConfig": {

"prepublish": "conf/resources/prepublish.sh",
"preversion": "conf/resources/checkgit.sh && npm test",
"preversion": "conf/resources/checkgit.sh && npm test && npm run build",
"postversion": "git push && git push --tags",

@@ -24,3 +24,3 @@ "precommit": "exit 0",

"build.dev": "babel src --source-maps --out-dir $npm_package_config_builddir/dist --watch",
"lint": "exit 0 && eslint src",
"lint": "eslint src",
"check": "flow check",

@@ -65,3 +65,2 @@ "testonly": "mocha",

"babel-core": "^6.5.2",
"babel-eslint": "^5.0.0-0",
"babel-plugin-espower": "^2.1.2",

@@ -77,6 +76,3 @@ "babel-plugin-flow-comments": "^6.3.19",

"babel-runtime": "5.x.x",
"eslint": "^1.x.x",
"eslint-config-airbnb": "5.0.1",
"eslint-config-airplus": "^1.1.1",
"eslint-plugin-react": "^3.16.1",
"eslint-config-airplus": "^1.1.8",
"glob": "^7.0.0",

@@ -83,0 +79,0 @@ "mocha": "^2.4.5",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc