Comparing version 0.4.3 to 0.4.4
55
index.js
@@ -187,2 +187,3 @@ "use strict"; | ||
let prepared_addresses = prepare_address(addressesoptions); | ||
let apians; | ||
let checkmodel = []; | ||
@@ -204,3 +205,3 @@ for (let i = 0; i < addressesoptions.length; i++) { | ||
try { | ||
const a = await this.checkAll(checkmodel); | ||
const a = await this.checkAll(); | ||
for (let i = 0; i < a.length; i++) { | ||
@@ -230,3 +231,3 @@ if (a[i].serial && | ||
'"'); | ||
let apians = JSON.parse(data.stdout); | ||
apians = JSON.parse(data.stdout); | ||
for (let i = 0; i < apians.length; i++) { | ||
@@ -250,3 +251,2 @@ for (let f = 0; f < a.length; f++) { | ||
} | ||
return apians; | ||
} | ||
@@ -263,3 +263,3 @@ catch (err) { | ||
'"'); | ||
let apians = JSON.parse(data.stdout); | ||
apians = JSON.parse(data.stdout); | ||
for (let i = 0; i < apians.length; i++) { | ||
@@ -269,3 +269,2 @@ apians[i].model = "Aurora"; | ||
} | ||
return apians; | ||
} | ||
@@ -282,3 +281,3 @@ } | ||
'"'); | ||
let apians = JSON.parse(data.stdout); | ||
apians = JSON.parse(data.stdout); | ||
for (let i = 0; i < apians.length; i++) { | ||
@@ -302,4 +301,4 @@ for (let f = 0; f < addressesoptions.length; f++) { | ||
} | ||
return apians; | ||
} | ||
return apians; | ||
} | ||
@@ -311,8 +310,7 @@ async check(uuid) { | ||
let exe = this.exec; | ||
let addresses = this.addresses; | ||
let checkanswer = { uuid: uuid }; | ||
for (let i = 0; i < addresses.length; i++) { | ||
if (addresses[i].uuid === uuid) { | ||
checkanswer.hub = addresses[i].hub; | ||
checkanswer.address = addresses[i].address; | ||
for (let i = 0; i < this.addresses.length; i++) { | ||
if (this.addresses[i].uuid === uuid) { | ||
checkanswer.hub = this.addresses[i].hub; | ||
checkanswer.address = this.addresses[i].address; | ||
} | ||
@@ -362,31 +360,10 @@ } | ||
} | ||
async checkAll(adds) { | ||
let addresses = []; | ||
let thisaddresses = this.addresses; | ||
if (adds) { | ||
for (let i = 0; i < thisaddresses.length; i++) { | ||
for (let a = 0; a < adds.length; a++) { | ||
if (thisaddresses[i].uuid === adds[a]) { | ||
addresses.push(thisaddresses[i]); | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
addresses = thisaddresses; | ||
} | ||
async checkAll() { | ||
let allanswers = []; | ||
for (const iterator of addresses) { | ||
try { | ||
const chkansw = await this.check(iterator.uuid); | ||
allanswers.push(chkansw); | ||
for (const iterator of this.addresses) { | ||
const chkansw = await this.check(iterator.uuid); | ||
if (!this.addresses.find((x) => x.uuid === iterator.uuid)) { | ||
this.addresses.push(chkansw); | ||
} | ||
catch (err) { | ||
console.log("err", err); | ||
for (let i = 0; i < thisaddresses.length; i++) { | ||
if (thisaddresses[i].uuid === iterator.uuid) { | ||
allanswers.push(thisaddresses[i]); | ||
} | ||
} | ||
} | ||
allanswers.push(chkansw); | ||
} | ||
@@ -393,0 +370,0 @@ return allanswers; |
60
index.ts
@@ -197,3 +197,3 @@ import { arch } from "os"; | ||
let prepared_addresses = prepare_address(addressesoptions); | ||
let apians: IAPI[]; | ||
let checkmodel = []; | ||
@@ -220,3 +220,3 @@ | ||
try { | ||
const a = await this.checkAll(checkmodel); | ||
const a = await this.checkAll(); | ||
@@ -252,3 +252,3 @@ for (let i = 0; i < a.length; i++) { | ||
let apians: IAPI[] = JSON.parse(data.stdout); | ||
apians = JSON.parse(data.stdout); | ||
for (let i = 0; i < apians.length; i++) { | ||
@@ -268,4 +268,2 @@ for (let f = 0; f < a.length; f++) { | ||
} | ||
return apians; | ||
} catch (err) { | ||
@@ -284,3 +282,3 @@ console.log(err); | ||
let apians: IAPI[] = JSON.parse(data.stdout); | ||
apians = JSON.parse(data.stdout); | ||
for (let i = 0; i < apians.length; i++) { | ||
@@ -290,4 +288,2 @@ apians[i].model = "Aurora"; | ||
} | ||
return apians; | ||
} | ||
@@ -306,3 +302,3 @@ } else { | ||
let apians: IAPI[] = JSON.parse(data.stdout); | ||
apians = JSON.parse(data.stdout); | ||
for (let i = 0; i < apians.length; i++) { | ||
@@ -326,5 +322,4 @@ for (let f = 0; f < addressesoptions.length; f++) { | ||
} | ||
return apians; | ||
} | ||
return apians; | ||
} | ||
@@ -339,10 +334,8 @@ | ||
let addresses = this.addresses; | ||
let checkanswer = <IAddress>{ uuid: uuid }; | ||
for (let i = 0; i < addresses.length; i++) { | ||
if (addresses[i].uuid === uuid) { | ||
checkanswer.hub = addresses[i].hub; | ||
checkanswer.address = addresses[i].address; | ||
for (let i = 0; i < this.addresses.length; i++) { | ||
if (this.addresses[i].uuid === uuid) { | ||
checkanswer.hub = this.addresses[i].hub; | ||
checkanswer.address = this.addresses[i].address; | ||
} | ||
@@ -389,32 +382,11 @@ } | ||
async checkAll(adds?: string[]) { | ||
let addresses: IAddress[] = []; | ||
let thisaddresses = this.addresses; | ||
if (adds) { | ||
for (let i = 0; i < thisaddresses.length; i++) { | ||
for (let a = 0; a < adds.length; a++) { | ||
if (thisaddresses[i].uuid === adds[a]) { | ||
addresses.push(thisaddresses[i]); | ||
} | ||
} | ||
} | ||
} else { | ||
addresses = thisaddresses; | ||
} | ||
async checkAll() { | ||
let allanswers: IAddress[] = []; | ||
for (const iterator of addresses) { | ||
try { | ||
const chkansw = await this.check(iterator.uuid); | ||
allanswers.push(chkansw); | ||
} catch (err) { | ||
console.log("err", err); | ||
for (let i = 0; i < thisaddresses.length; i++) { | ||
if (thisaddresses[i].uuid === iterator.uuid) { | ||
allanswers.push(thisaddresses[i]); | ||
} | ||
} | ||
for (const iterator of this.addresses) { | ||
const chkansw = await this.check(iterator.uuid); | ||
if (!this.addresses.find((x) => x.uuid === iterator.uuid)) { | ||
this.addresses.push(chkansw); | ||
} | ||
allanswers.push(chkansw); | ||
} | ||
@@ -421,0 +393,0 @@ |
{ | ||
"name": "aurorajs", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
182541
868