fix(core): update

This commit is contained in:
Philipp Kunz 2019-04-17 20:05:07 +02:00
parent 2ce69f4a8e
commit df861590c8
4 changed files with 45 additions and 84 deletions

104
package-lock.json generated
View File

@ -14,6 +14,26 @@
"nan": "^2.9.2" "nan": "^2.9.2"
} }
}, },
"@babel/code-frame": {
"version": "7.0.0",
"resolved": "https://verdaccio.lossless.one/@babel%2fcode-frame/-/code-frame-7.0.0.tgz",
"integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==",
"dev": true,
"requires": {
"@babel/highlight": "^7.0.0"
}
},
"@babel/highlight": {
"version": "7.0.0",
"resolved": "https://verdaccio.lossless.one/@babel%2fhighlight/-/highlight-7.0.0.tgz",
"integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==",
"dev": true,
"requires": {
"chalk": "^2.0.0",
"esutils": "^2.0.2",
"js-tokens": "^4.0.0"
}
},
"@gitzone/tsbuild": { "@gitzone/tsbuild": {
"version": "2.1.8", "version": "2.1.8",
"resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.8.tgz", "resolved": "https://verdaccio.lossless.one/@gitzone%2ftsbuild/-/tsbuild-2.1.8.tgz",
@ -503,59 +523,6 @@
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true "dev": true
}, },
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://verdaccio.lossless.one/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
},
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://verdaccio.lossless.one/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
},
"ansi-styles": {
"version": "2.2.1",
"resolved": "https://verdaccio.lossless.one/ansi-styles/-/ansi-styles-2.2.1.tgz",
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=",
"dev": true
},
"chalk": {
"version": "1.1.3",
"resolved": "https://verdaccio.lossless.one/chalk/-/chalk-1.1.3.tgz",
"integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=",
"dev": true,
"requires": {
"ansi-styles": "^2.2.1",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://verdaccio.lossless.one/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"supports-color": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/supports-color/-/supports-color-2.0.0.tgz",
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
"dev": true
}
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -959,23 +926,6 @@
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
"dev": true "dev": true
}, },
"has-ansi": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/has-ansi/-/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
},
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://verdaccio.lossless.one/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
}
}
},
"has-flag": { "has-flag": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-3.0.0.tgz", "resolved": "https://verdaccio.lossless.one/has-flag/-/has-flag-3.0.0.tgz",
@ -1076,9 +1026,9 @@
"integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw==" "integrity": "sha512-M7kLczedRMYX4L8Mdh4MzyAMM9O5osx+4FcOQuTvr3A9F2D9S5JXheN0ewNbrvK2UatkTRhL5ejGmGSjNMiZuw=="
}, },
"js-tokens": { "js-tokens": {
"version": "3.0.2", "version": "4.0.0",
"resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-3.0.2.tgz", "resolved": "https://verdaccio.lossless.one/js-tokens/-/js-tokens-4.0.0.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
"dev": true "dev": true
}, },
"js-yaml": { "js-yaml": {
@ -1684,12 +1634,12 @@
"dev": true "dev": true
}, },
"tslint": { "tslint": {
"version": "5.15.0", "version": "5.16.0",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.15.0.tgz", "resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.16.0.tgz",
"integrity": "sha512-6bIEujKR21/3nyeoX2uBnE8s+tMXCQXhqMmaIPJpHmXJoBJPTLcI7/VHRtUwMhnLVdwLqqY3zmd8Dxqa5CVdJA==", "integrity": "sha512-UxG2yNxJ5pgGwmMzPMYh/CCnCnh0HfPgtlVRDs1ykZklufFBL1ZoTlWFRz2NQjcoEiDoRp+JyT0lhBbbH/obyA==",
"dev": true, "dev": true,
"requires": { "requires": {
"babel-code-frame": "^6.22.0", "@babel/code-frame": "^7.0.0",
"builtin-modules": "^1.1.1", "builtin-modules": "^1.1.1",
"chalk": "^2.3.0", "chalk": "^2.3.0",
"commander": "^2.12.1", "commander": "^2.12.1",

View File

@ -8,14 +8,14 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tsrun test/)", "test": "(tstest test/)",
"build": "(tsbuild)" "build": "(tsbuild)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.8", "@gitzone/tsbuild": "^2.1.8",
"@gitzone/tstest": "^1.0.20", "@gitzone/tstest": "^1.0.20",
"@pushrocks/tapbundle": "^3.0.9", "@pushrocks/tapbundle": "^3.0.9",
"tslint": "^5.15.0", "tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"dependencies": { "dependencies": {

View File

@ -20,8 +20,18 @@ network diagnostics
```typescript ```typescript
import * as smartnetwork from 'smartnetwork'; import * as smartnetwork from 'smartnetwork';
testSmartNetwork = new smartnetwork.SmartNetwork(); const testSmartNetwork = new smartnetwork.SmartNetwork();
testSmartNetwork.getSpeed const run = async () => {
// measure average speed over a period of 5 seconds
// the structure of speedResult is self explanatory using TypeScript (or the linked TypeDoc above)
const speedResult = testSmartNetwork.getSpeed(5000)
//
const isLocalPortAvailable: boolean = await testSmartNetwork.isLocalPortAvailable(1234);
const isRemotePortAvailable: boolean = await testSmartNetwork.isRemotePortAvailable('google.com:80');
const isRemotePortAvailable: boolean = await testSmartNetwork.isRemotePortAvailable('google.com', 80);
}
``` ```
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.

View File

@ -1,6 +1,6 @@
import * as plugins from './smartnetwork.plugins'; import * as plugins from './smartnetwork.plugins';
export class ISpeedtestData { export interface ISpeedtestData {
speeds: { speeds: {
download: number; download: number;
upload: number; upload: number;
@ -112,12 +112,13 @@ export class SmartNetwork {
plugins.portscanner.checkPortStatus(port, domainPart, (err, status ) => { plugins.portscanner.checkPortStatus(port, domainPart, (err, status ) => {
if (err) { if (err) {
throw err; console.log(err);
return done.resolve(false);
} }
if (status === 'open') { if (status === 'open') {
done.resolve(true); done.resolve(true);
} else { } else {
done.resolve(false) done.resolve(false);
} }
}) })
const result = await done.promise; const result = await done.promise;