Comparing version 0.10.0 to 0.10.1
@@ -117,3 +117,3 @@ "use strict"; | ||
if (msg.value.content && msg.value.content.type === 'contact') { | ||
this.loadHops(); | ||
this.loadHops(() => this.updateNow()); | ||
} | ||
@@ -123,3 +123,3 @@ }); | ||
} | ||
loadHops() { | ||
loadHops(doneCallback) { | ||
if (!this.ssb.friends || !this.ssb.friends.hops) { | ||
@@ -137,2 +137,4 @@ debug('Warning: ssb-friends is missing, scheduling will miss some info'); | ||
this.isLoadingHops = false; | ||
if (doneCallback) | ||
doneCallback(); | ||
}); | ||
@@ -139,0 +141,0 @@ } |
@@ -9,6 +9,7 @@ "use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -15,0 +16,0 @@ }); |
@@ -88,3 +88,3 @@ "use strict"; | ||
const peers = Array.from(this.conn.db().entries()).map(([address, data]) => { | ||
return Object.assign({}, data, { address, state: this.conn.hub().getState(address) }); | ||
return Object.assign(Object.assign({}, data), { address, state: this.conn.hub().getState(address) }); | ||
}); | ||
@@ -94,3 +94,3 @@ for (const [address, data] of this.conn.hub().entries()) { | ||
const [, parsed] = validateAddr(address); | ||
peers.push(Object.assign({}, data, parsed, { address, source: inferSource(address) })); | ||
peers.push(Object.assign(Object.assign(Object.assign({}, data), parsed), { address, source: inferSource(address) })); | ||
} | ||
@@ -105,3 +105,3 @@ } | ||
if (data.key === addr) { | ||
return Object.assign({}, data, { address }); | ||
return Object.assign(Object.assign({}, data), { address }); | ||
} | ||
@@ -132,3 +132,3 @@ } | ||
const dbData = this.conn.db().get(addressString) || {}; | ||
const data = Object.assign({}, dbData, stagedData); | ||
const data = Object.assign(Object.assign({}, dbData), stagedData); | ||
this.conn.connect(addressString, data, cb); | ||
@@ -175,3 +175,3 @@ }; | ||
type: 'discover', | ||
peer: Object.assign({}, parsed, { state: this.conn.hub().getState(addressString), source: source || 'manual' }), | ||
peer: Object.assign(Object.assign({}, parsed), { state: this.conn.hub().getState(addressString), source: source || 'manual' }), | ||
source: source || 'manual', | ||
@@ -178,0 +178,0 @@ }); |
@@ -14,3 +14,3 @@ "use strict"; | ||
db.update(address, (prev) => ({ | ||
ping: Object.assign({}, (prev.ping || {}), { fail: true }), | ||
ping: Object.assign(Object.assign({}, (prev.ping || {})), { fail: true }), | ||
})); | ||
@@ -30,3 +30,3 @@ } | ||
const dbData = db.get(address); | ||
hub.update(address, Object.assign({}, dbData, stagedData)); | ||
hub.update(address, Object.assign(Object.assign({}, dbData), stagedData)); | ||
} | ||
@@ -50,3 +50,3 @@ function onConnectingFailed(ev) { | ||
const dbData = db.get(address); | ||
hub.update(address, Object.assign({}, dbData, stagedData)); | ||
hub.update(address, Object.assign(Object.assign({}, dbData), stagedData)); | ||
if (ev.details.isClient) | ||
@@ -53,0 +53,0 @@ setupPing(address, ev.details.rpc); |
{ | ||
"name": "ssb-conn", | ||
"description": "SSB plugin for establishing and managing peer connections", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"homepage": "https://github.com/staltz/ssb-conn", | ||
@@ -43,3 +43,3 @@ "main": "lib/index.js", | ||
"tape": "^4.9.2", | ||
"typescript": "3.5.x" | ||
"typescript": "3.6.x" | ||
}, | ||
@@ -46,0 +46,0 @@ "scripts": { |
@@ -111,3 +111,3 @@ import ConnQuery = require('ssb-conn-query'); | ||
if (msg.value.content && msg.value.content.type === 'contact') { | ||
this.loadHops(); | ||
this.loadHops(() => this.updateNow()); | ||
} | ||
@@ -118,3 +118,3 @@ }); | ||
private loadHops() { | ||
private loadHops(doneCallback?: () => void) { | ||
if (!this.ssb.friends || !this.ssb.friends.hops) { | ||
@@ -133,2 +133,3 @@ debug('Warning: ssb-friends is missing, scheduling will miss some info'); | ||
this.isLoadingHops = false; | ||
if (doneCallback) doneCallback(); | ||
}); | ||
@@ -135,0 +136,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
132052
2387