fix(core): update

This commit is contained in:
Philipp Kunz 2022-10-21 11:55:42 +02:00
parent f479c11574
commit d479cd9e7e
7 changed files with 69 additions and 6 deletions

View File

@ -13,6 +13,10 @@
"build": "(tsbuild --web --allowimplicitany)",
"buildDocs": "(tsdoc)"
},
"dependencies": {
"@types/ping": "^0.4.1",
"ping": "^0.4.2"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^2.0.5",

View File

@ -8,6 +8,12 @@ specifiers:
'@gitzone/tstest': ^1.0.44
'@pushrocks/tapbundle': ^5.0.3
'@types/node': ^18.11.2
'@types/ping': ^0.4.1
ping: ^0.4.2
dependencies:
'@types/ping': 0.4.1
ping: 0.4.2
devDependencies:
'@gitzone/tsbuild': 2.1.65
@ -1136,6 +1142,10 @@ packages:
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
dev: true
/@types/ping/0.4.1:
resolution: {integrity: sha512-q/D+xQvoqrHvntvz2A0Pb0ImYwnN3zakluUp8O2qoogGoVMVbdY2K/ulxHcCh9TzYzVoojayHBa9gYQDIZ4v0A==}
dev: false
/@types/qs/6.9.7:
resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==}
dev: true
@ -3466,6 +3476,14 @@ packages:
engines: {node: '>=8.6'}
dev: true
/ping/0.4.2:
resolution: {integrity: sha512-1uAw0bzHtrPbPo2s6no06oZAzY6KqKclEJR1JRZKIHKXKlPdrz9N0/1MPPB+BbrvMjN3Mk0pcod3bfLNZFRo9w==}
engines: {node: '>=4.0.0'}
dependencies:
q: 1.5.1
underscore: 1.13.6
dev: false
/pkg-dir/4.2.0:
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==}
engines: {node: '>=8'}
@ -3555,6 +3573,11 @@ packages:
- utf-8-validate
dev: true
/q/1.5.1:
resolution: {integrity: sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=}
engines: {node: '>=0.6.0', teleport: '>=0.2.0'}
dev: false
/qs/6.11.0:
resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==}
engines: {node: '>=0.6'}
@ -4165,6 +4188,10 @@ packages:
through: 2.3.8
dev: true
/underscore/1.13.6:
resolution: {integrity: sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==}
dev: false
/unicode-trie/0.3.1:
resolution: {integrity: sha1-1nHd3YkQGgi6w3tqUWEBBgIFIIU=}
dependencies:

View File

@ -1,8 +1,15 @@
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartping from '../ts/index.js';
tap.test('first test', async () => {
console.log(smartping);
let testPing: smartping.Smartping;
tap.test('should create an instance of Smartping', async () => {
testPing = new smartping.Smartping();
expect(testPing).toBeInstanceOf(smartping.Smartping);
});
tap.test('should detect alive', async () => {
await expectAsync(testPing.pingAlive('lossless.com', 1000)).toBeTrue();
})
tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartping',
version: '1.0.4',
version: '1.0.5',
description: 'a ping utility'
}

View File

@ -1,3 +1,3 @@
import * as plugins from './smartping.plugins.js';
export let demoExport = 'Hi there! :) This is an exported string';
export * from './smartping.classes.smartping.js';

View File

@ -0,0 +1,22 @@
import * as plugins from './smartping.plugins.js';
export class Smartping {
public async ping(hostArg: string, timeoutArg: number = 500): Promise<plugins.ping.PingResponse> {
const result = await plugins.ping.promise.probe(hostArg, {
timeout: timeoutArg
})
return result;
}
public async pingAlive(hostArg: string, timeoutArg: number = 500): Promise<boolean> {
const result = await plugins.ping.promise.probe(hostArg, {
timeout: timeoutArg
}).catch();
//console.log(result);
if (result.alive) {
return true;
} else {
return false;
}
}
}

View File

@ -1,2 +1,5 @@
const removeme = {};
export { removeme };
import ping from 'ping';
export {
ping
}