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.8 to 0.0.9

lib/__tests__/annotations.js

2

lib/core/AnnotationResolverImpl.js

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

value: function addRelation(id /*: DepId*/) {
var cache = this._cache;
var parents = this._parents;

@@ -148,3 +149,2 @@

var parent /*: Set<DepId>*/ = parents[j];
parent.add(dep.base.id);
for (var i = 0, l = relations.length; i < l; i++) {

@@ -151,0 +151,0 @@ parent.add(relations[i]);

@@ -82,2 +82,5 @@ 'use strict';

if (!driver) {
throw new TypeError('Provide AnnotationDriver');
}
return {

@@ -84,0 +87,0 @@ /* eslint-disable no-unused-vars */

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

}, {
key: 'hasAnnotation',
value: function hasAnnotation(dep /*: Dependency*/) {
return !!(dep /*: Function*/)[metaSymbol];
}
}, {
key: 'getAnnotation',

@@ -51,0 +56,0 @@ value: function getAnnotation(dep /*: Dependency<V>*/) {

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

});
exports.merge = exports.getFunctionName = exports.createAnnotations = exports.createPureStateDi = exports.BaseCollection = exports.SymbolMetaDriver = exports.DefaultIdCreator = undefined;
var _createAnnotations = require('./createAnnotations');
var _createAnnotations2 = _interopRequireDefault(_createAnnotations);
var _createPureStateDi = require('./createPureStateDi');

@@ -12,6 +17,2 @@

var _createAnnotations = require('./createAnnotations');
var _createAnnotations2 = _interopRequireDefault(_createAnnotations);
var _getFunctionName = require('./utils/getFunctionName');

@@ -21,2 +22,6 @@

var _merge = require('./utils/merge');
var _merge2 = _interopRequireDefault(_merge);
var _BaseCollection = require('./utils/BaseCollection');

@@ -26,15 +31,19 @@

var _merge = require('./utils/merge');
var _DefaultIdCreator = require('./core/DefaultIdCreator');
var _merge2 = _interopRequireDefault(_merge);
var _DefaultIdCreator2 = _interopRequireDefault(_DefaultIdCreator);
var _SymbolMetaDriver = require('./drivers/SymbolMetaDriver');
var _SymbolMetaDriver2 = _interopRequireDefault(_SymbolMetaDriver);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
BaseCollection: _BaseCollection2.default,
createPureStateDi: _createPureStateDi2.default,
createAnnotations: _createAnnotations2.default,
getFunctionName: _getFunctionName2.default,
merge: _merge2.default
};
exports.DefaultIdCreator = _DefaultIdCreator2.default;
exports.SymbolMetaDriver = _SymbolMetaDriver2.default;
exports.BaseCollection = _BaseCollection2.default;
exports.createPureStateDi = _createPureStateDi2.default;
exports.createAnnotations = _createAnnotations2.default;
exports.getFunctionName = _getFunctionName2.default;
exports.merge = _merge2.default;
//# sourceMappingURL=index.js.map

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

/*:: export type AnnotationDriver = {
hasAnnotation(dep: Dependency): boolean;
getAnnotation<V, A: AnyAnnotation>(dep: Dependency<V>): A; // eslint-disable-line

@@ -40,0 +41,0 @@ annotate<V, T: Dependency<V>, A: AnyAnnotation>(dep: T, annotation: A): T; // eslint-disable-line

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

var _merge = require('../../../utils/merge');
var _merge2 = _interopRequireDefault(_merge);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -18,4 +22,5 @@

/* eslint-enable no-unused-vars */
/*:: import type {Cursor} from '../../../interfaces/modelInterfaces'*/
/*:: import type {Cursor} from '../../../interfaces/modelInterfaces'*/
function setInPath /*:: <V: Object, S: Object>*/(newModel /*: V*/, state /*: S*/, path /*: Array<string>*/, index /*: number*/) /*: S|V*/ {

@@ -30,3 +35,3 @@ if (index === path.length) {

return state.copy(rec);
return (0, _merge2.default)(state, rec);
}

@@ -33,0 +38,0 @@

@@ -48,5 +48,13 @@ 'use strict';

var annotation /*: ModelAnnotation*/ = driver.getAnnotation(obj.constructor);
var info = annotation.info;
var annotation /*: ModelAnnotation*/ = undefined;
try {
annotation = driver.getAnnotation(obj.constructor);
} catch (e) {
e.message = e.message + ', path: ' + statePath.join('.');
throw e;
}
var _annotation = annotation;
var info = _annotation.info;
if (!info.statePath.length) {

@@ -59,3 +67,3 @@ info.statePath = statePath;

var prop /*: any*/ = obj[key];
if (prop !== null && (typeof prop === 'undefined' ? 'undefined' : (0, _typeof3.default)(prop)) === 'object') {
if (prop !== null && (typeof prop === 'undefined' ? 'undefined' : (0, _typeof3.default)(prop)) === 'object' && driver.hasAnnotation(prop.constructor)) {
info.childs.push(prop.constructor);

@@ -62,0 +70,0 @@ propCreators[key] = setupStateAnnotations(driver, prop, statePath.concat(key));

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

this.base = new _pluginImpls.DepBaseImpl(id, info);
this.base.relations.push(id);
this._cursor = cursor;

@@ -120,0 +121,0 @@ this._fromJS = fromJS;

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

this.base = new _pluginImpls.DepBaseImpl(id, info);
this.base.relations.push(id);
this._cursor = cursor;

@@ -49,0 +50,0 @@ this._fromJS = fromJS;

{
"name": "reactive-di",
"version": "0.0.8",
"version": "0.0.9",
"description": "Reactive dependency injection",

@@ -9,4 +9,4 @@ "publishConfig": {

"main": "lib/index.js",
"options": {
"builddir": "lib"
"config": {
"builddir": "."
},

@@ -21,5 +21,5 @@ "scripts": {

"update": "ncu -ua && npm install",
"clean": "rm -rf $npm_package_options_builddir coverage interfaces",
"build": "npm run clean && babel src --source-maps --out-dir $npm_package_options_builddir && cp -rf src/interfaces ./ && rm -rf lib/__tests__ interfaces/annotation* interfaces/node* interfaces/plugin*",
"build.dev": "npm run build -- --watch",
"clean": "rm -rf $npm_package_config_builddir/lib coverage interfaces",
"build": "npm run clean && cp -rf src/interfaces ./ && rm -rf lib/__tests__ interfaces/annotation* interfaces/node* interfaces/plugin* && babel src --source-maps --out-dir $npm_package_config_builddir/lib",
"build.dev": "babel src --source-maps --out-dir $npm_package_config_builddir/lib --watch",
"lint": "exit 0 && eslint src",

@@ -26,0 +26,0 @@ "check": "flow check",

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