Comparing version 1.0.6 to 1.0.7
@@ -49,3 +49,2 @@ 'use strict'; | ||
const final = _.unionWith(current, others, Node.equals); | ||
this._items = this._items.concat(final); | ||
@@ -55,7 +54,8 @@ this._currentBatch = []; | ||
// Fetch history | ||
const nexts = Lazy(other.items).map((f) => f.next).flatten().toArray(); | ||
const nexts = _.flatten(other.items.map((f) => f.next)); | ||
Promise.map(nexts, (f) => { | ||
let all = this.items.map((f) => f.hash); | ||
let all = this.items.map((a) => a.hash); | ||
return this._fetchRecursive(this._ipfs, f, all, MaxHistory, 0).then((history) => { | ||
history.reverse().forEach((e) => this._insert(e)) // Insert to the log | ||
history.forEach((b) => this._insert(b)); | ||
return history; | ||
}); | ||
@@ -101,13 +101,7 @@ }, { concurrency: 1 }).then((r) => resolve(final)); | ||
// Process next node | ||
const handle = Lazy(node.next) | ||
.async() | ||
.map((f) => this._fetchRecursive(ipfs, f, all, amount, depth)) | ||
.toArray() | ||
handle.onError(reject); | ||
handle.onComplete((array) => { | ||
result = result.concat(array); | ||
Promise.all(result).then((res) => resolve(Lazy(res).flatten().toArray())); | ||
}); | ||
Promise.map(node.next, (f) => this._fetchRecursive(ipfs, f, all, amount, depth), { concurrency: 1 }) | ||
.then((res) => { | ||
result = _.flatten(res.concat(result)); | ||
resolve(result); | ||
}); | ||
}).catch(reject); | ||
@@ -114,0 +108,0 @@ }); |
{ | ||
"name": "ipfs-log", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Append-only log for IPFS", | ||
@@ -5,0 +5,0 @@ "main": "lib/log.js", |
@@ -428,4 +428,4 @@ 'use strict'; | ||
assert.equal(items.length, 2); | ||
assert.equal(items[0].hash, 'Qmcpgub1qRG5XHed1qNciwb74uasUhQVEhP35oaZZ7UWbi'); | ||
assert.equal(items[1].hash, 'QmRMUN4WJdpYydRLpbipaNoLQNXiw9ifRpPht5APaLFqrR'); | ||
assert.equal(items[0].hash, 'QmRMUN4WJdpYydRLpbipaNoLQNXiw9ifRpPht5APaLFqrR'); | ||
assert.equal(items[1].hash, 'Qmcpgub1qRG5XHed1qNciwb74uasUhQVEhP35oaZZ7UWbi'); | ||
done(); | ||
@@ -441,5 +441,5 @@ })); | ||
assert.equal(items.length, 3); | ||
assert.equal(items[2].hash, 'QmRMUN4WJdpYydRLpbipaNoLQNXiw9ifRpPht5APaLFqrR'); | ||
assert.equal(items[0].hash, 'QmRMUN4WJdpYydRLpbipaNoLQNXiw9ifRpPht5APaLFqrR'); | ||
assert.equal(items[1].hash, 'Qmcpgub1qRG5XHed1qNciwb74uasUhQVEhP35oaZZ7UWbi'); | ||
assert.equal(items[0].hash, 'QmQM4Xg6EGGGEKRYu3jX3cpTcXK53XvSgQpxZd2qGY1L2V'); | ||
assert.equal(items[2].hash, 'QmQM4Xg6EGGGEKRYu3jX3cpTcXK53XvSgQpxZd2qGY1L2V'); | ||
done(); | ||
@@ -460,4 +460,4 @@ })); | ||
assert.equal(items.length, amount); | ||
assert.equal(items[0].hash, _.last(nodes).hash); | ||
assert.equal(_.last(items).hash, nodes[0].hash); | ||
assert.equal(items[0].hash, nodes[0].hash); | ||
assert.equal(_.last(items).hash, _.last(nodes).hash); | ||
done(); | ||
@@ -474,4 +474,4 @@ })); | ||
assert.equal(items.length, 2); | ||
assert.equal(items[0].hash, 'QmQM4Xg6EGGGEKRYu3jX3cpTcXK53XvSgQpxZd2qGY1L2V'); | ||
assert.equal(items[1].hash, 'Qmcpgub1qRG5XHed1qNciwb74uasUhQVEhP35oaZZ7UWbi'); | ||
assert.equal(items[0].hash, 'Qmcpgub1qRG5XHed1qNciwb74uasUhQVEhP35oaZZ7UWbi'); | ||
assert.equal(items[1].hash, 'QmQM4Xg6EGGGEKRYu3jX3cpTcXK53XvSgQpxZd2qGY1L2V'); | ||
done(); | ||
@@ -478,0 +478,0 @@ })); |
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
47694
1162