@evosphere/legato
Advanced tools
Comparing version 0.0.1 to 0.0.2
31
index.js
@@ -59,11 +59,5 @@ // @flow | ||
*/ | ||
function Bundle(params : { name: string }) { | ||
let definitions = {}; | ||
function Bundle(params : { name: string, definitions: () => ServiceMap }) { | ||
this.name = params.name; | ||
this.register = function(ref : string, service : ServiceType) { | ||
definitions[ref] = service; | ||
}; | ||
this.getDefinitions = () => definitions; | ||
this.getDefinitions = params.getDefinitions.bind(this); | ||
} | ||
@@ -85,2 +79,8 @@ | ||
if(typeof params.getDefinitions !== "function") { | ||
throw new Error( | ||
"You must provide a getDefinitions function that will return an object whose keys are" + | ||
"references and values services." | ||
) | ||
} | ||
return new Bundle(params); | ||
@@ -113,2 +113,3 @@ }; | ||
let initialized : boolean = false; | ||
let bundles = []; | ||
@@ -154,2 +155,7 @@ /** | ||
if(Object.keys(definitions).length === 0) { | ||
initialized = true; | ||
return; | ||
} | ||
let currentDef; | ||
@@ -207,6 +213,7 @@ let keepGoing = true; | ||
addBundle(bundle : BundleType) { | ||
let definitions = bundle.getDefinitions(); | ||
for(let ref in definitions) { | ||
if(definitions.hasOwnProperty(ref)) { | ||
this.register(ref, definitions[ref]); | ||
bundles.push(bundle); | ||
const bundleDefs = bundle.getDefinitions(); | ||
for(let ref in bundleDefs) { | ||
if(bundleDefs.hasOwnProperty(ref)) { | ||
this.register(ref, bundleDefs[ref]); | ||
} | ||
@@ -213,0 +220,0 @@ } |
{ | ||
"name": "@evosphere/legato", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Service management system", | ||
@@ -23,3 +23,6 @@ "main": "index.js", | ||
"jest": "^20.0.4" | ||
}, | ||
"dependencies": { | ||
"shaara-core": "^0.1.0" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
104503
1
7
211
1
+ Addedshaara-core@^0.1.0
+ Addedshaara-core@0.1.0(transitive)