cqrs-eventdenormalizer
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -15,3 +15,3 @@ 'use strict'; | ||
} | ||
return item.value instanceof ViewBuilder; | ||
@@ -38,3 +38,3 @@ } | ||
var name = item.value.name; | ||
if (name === '') { | ||
@@ -75,4 +75,4 @@ item.name = name; | ||
}; | ||
items.forEach(function (item) { | ||
items.forEach(function (item) { | ||
if (isViewBuilder(item)) { | ||
@@ -102,3 +102,3 @@ debug('found viewBuilder at: ' + item.path); | ||
}); | ||
return res; | ||
@@ -112,5 +112,5 @@ } | ||
} | ||
var res = scan(items); | ||
callback(null, res); | ||
@@ -166,3 +166,3 @@ }); | ||
reorderEventExtenders(obj, ordered); | ||
return ordered; | ||
@@ -172,3 +172,3 @@ } | ||
function load (dir, callback) { | ||
analyze(dir, function (err, dividedByTypes) { | ||
@@ -180,7 +180,7 @@ if (err) { | ||
var structured = reorder(dividedByTypes); | ||
callback(err, structured) | ||
}) | ||
callback(err, structured); | ||
}); | ||
} | ||
module.exports = load; |
@@ -25,3 +25,3 @@ 'use strict'; | ||
dir = path.resolve(dir); | ||
var results = []; | ||
@@ -33,7 +33,7 @@ fs.readdir(dir, function (err, list) { | ||
} | ||
var pending = list.length; | ||
if (pending === 0) return callback(null, results); | ||
list.forEach(function (file) { | ||
@@ -45,3 +45,3 @@ var pathFull = path.join(dir, file); | ||
} | ||
// if directory, go deep... | ||
@@ -55,3 +55,3 @@ if (stat && stat.isDirectory()) { | ||
} | ||
// if a file we are looking for | ||
@@ -61,3 +61,3 @@ if (isValidFileType(pathFull)) { | ||
} | ||
// of just an other file, skip... | ||
@@ -73,3 +73,3 @@ if (!--pending) callback(null, results); | ||
var res = []; | ||
paths.forEach(function (p) { | ||
@@ -81,3 +81,3 @@ if (p.indexOf(root) >= 0) { | ||
} | ||
var splits = part.split(path.sep); | ||
@@ -87,3 +87,3 @@ var withoutFileName = splits; | ||
var fileName = path.basename(part); | ||
var dottiedBase = ''; | ||
@@ -105,7 +105,7 @@ withoutFileName.forEach(function (s, i) { | ||
// } | ||
if (!required || _.isEmpty(required)) { | ||
return; | ||
} | ||
if (_.isArray(required)) { | ||
@@ -137,3 +137,3 @@ _.each(required, function (req) { | ||
}); | ||
return res; | ||
@@ -148,4 +148,40 @@ } | ||
} | ||
var res = pathToJson(dir, paths); | ||
var dottiesParts = []; | ||
res.forEach(function (r) { | ||
var parts = r.dottiedBase.split('.'); | ||
parts.forEach(function (p, i) { | ||
if (!dottiesParts[i]) { | ||
return dottiesParts[i] = { count: 1, name: p }; | ||
} | ||
if (dottiesParts[i].name !== p) { | ||
dottiesParts[i].count++; | ||
} | ||
}); | ||
}); | ||
var toRemove = ''; | ||
for (var pi = 0, plen = dottiesParts.length; pi < plen; pi++) { | ||
if (dottiesParts[pi].count === 1) { | ||
toRemove += dottiesParts[pi].name; | ||
} else { | ||
break; | ||
} | ||
} | ||
if (toRemove.length > 0) { | ||
res.forEach(function (r) { | ||
if (r.dottiedBase === toRemove) { | ||
r.dottiedBase = ''; | ||
} else { | ||
r.dottiedBase = r.dottiedBase.substring(toRemove.length + 1); | ||
} | ||
}); | ||
} | ||
callback(null, res); | ||
@@ -152,0 +188,0 @@ }); |
{ | ||
"author": "adrai", | ||
"name": "cqrs-eventdenormalizer", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -0,1 +1,4 @@ | ||
## [v1.3.3](https://github.com/adrai/node-cqrs-eventdenormalizer/compare/v1.3.2...v1.3.3) | ||
- optimize structureParser | ||
## [v1.3.2](https://github.com/adrai/node-cqrs-eventdenormalizer/compare/v1.3.1...v1.3.2) | ||
@@ -2,0 +5,0 @@ - introduce noReplay flag on collection |
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
212355
3341