fix(core): update

This commit is contained in:
Philipp Kunz 2020-08-05 15:37:51 +00:00
parent c8cf590a5a
commit b463aea274
8 changed files with 9920 additions and 665 deletions

4
.gitignore vendored
View File

@ -15,8 +15,6 @@ node_modules/
# builds # builds
dist/ dist/
dist_web/ dist_*/
dist_serve/
dist_ts_web/
# custom # custom

View File

@ -19,22 +19,23 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless - lossless
- docker - docker
- notpriv - notpriv
snyk: audit:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install --ignore-scripts - npmci command npm install --ignore-scripts
- npmci command snyk test - npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high
tags: tags:
- lossless
- docker - docker
- notpriv
# ==================== # ====================
# test stage # test stage
@ -49,9 +50,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -62,9 +61,7 @@ testBuild:
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -84,6 +81,8 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm"] "enum": ["website", "element", "service", "npm", "wcc"]
} }
} }
} }

10484
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,11 +3,11 @@
"version": "4.0.3", "version": "4.0.3",
"private": false, "private": false,
"description": "smart dns methods written in TypeScript", "description": "smart dns methods written in TypeScript",
"main": "dist/index.js", "main": "dist_ts/index.js",
"typings": "dist/index.d.ts", "typings": "dist_ts/index.d.ts",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "(tsbuild)" "build": "(tsbuild --web)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -25,28 +25,32 @@
}, },
"homepage": "https://gitlab.com/pushrocks/dnsly#README", "homepage": "https://gitlab.com/pushrocks/dnsly#README",
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.6", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartpromise": "^3.0.6", "@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrequest": "^1.1.47", "@pushrocks/smartrequest": "^1.1.47",
"@tsclass/tsclass": "^3.0.6" "@tsclass/tsclass": "^3.0.21"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.17", "@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.28", "@gitzone/tstest": "^1.0.43",
"@pushrocks/tapbundle": "^3.2.0", "@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^13.7.1", "@types/node": "^14.0.27",
"tslint": "^6.0.0", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
"ts_web/**/*", "ts_web/**/*",
"dist/**/*", "dist/**/*",
"dist_web/**/*", "dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*", "dist_ts_web/**/*",
"assets/**/*", "assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

View File

@ -8,13 +8,20 @@ smart dns methods written in TypeScript
* [docs (typedoc)](https://pushrocks.gitlab.io/smartdns/) * [docs (typedoc)](https://pushrocks.gitlab.io/smartdns/)
## Status for master ## Status for master
[![pipeline status](https://gitlab.com/pushrocks/smartdns/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartdns/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smartdns/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartdns/commits/master) Status Category | Status Badge
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartdns.svg)](https://www.npmjs.com/package/@pushrocks/smartdns) -- | --
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartdns/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartdns) GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartdns/badges/master/pipeline.svg)](https://lossless.cloud)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartdns/badges/master/coverage.svg)](https://lossless.cloud)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartdns)](https://lossless.cloud)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartdns)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartdns)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartdns)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartdns)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage

View File

@ -15,8 +15,8 @@ tap.test('should get an A DNS Record', async () => {
name: 'dnsly_a.bleu.de', name: 'dnsly_a.bleu.de',
value: '127.0.0.1', value: '127.0.0.1',
dnsSecEnabled: false, dnsSecEnabled: false,
type: 'A' type: 'A',
} },
]); ]);
}); });
@ -26,8 +26,8 @@ tap.test('should get an AAAA Record', async () => {
name: 'dnsly_aaaa.bleu.de', name: 'dnsly_aaaa.bleu.de',
value: '::1', value: '::1',
dnsSecEnabled: false, dnsSecEnabled: false,
type: 'AAAA' type: 'AAAA',
} },
]); ]);
}); });
@ -37,8 +37,8 @@ tap.test('should get a txt record', async () => {
name: 'dnsly_txt.bleu.de', name: 'dnsly_txt.bleu.de',
value: 'sometext_txt', value: 'sometext_txt',
type: 'TXT', type: 'TXT',
dnsSecEnabled: false dnsSecEnabled: false,
} },
]); ]);
}); });

View File

@ -29,7 +29,7 @@ export class Smartdns {
AAAA: 28, AAAA: 28,
CNAME: 5, CNAME: 5,
MX: 15, MX: 15,
TXT: 16 TXT: 16,
}; };
/** /**
@ -59,7 +59,9 @@ export class Smartdns {
const myRecordArray = await this.getRecordWithNodeDNS(recordNameArg, recordTypeArg); const myRecordArray = await this.getRecordWithNodeDNS(recordNameArg, recordTypeArg);
const myRecord = myRecordArray[0].value; const myRecord = myRecordArray[0].value;
if (myRecord === expectedValue) { if (myRecord === expectedValue) {
console.log(`smartdns: .checkUntilAvailable() verified that wanted >>>${recordTypeArg}<<< record exists for >>>${recordNameArg}<<< with value >>>${expectedValue}<<<`); console.log(
`smartdns: .checkUntilAvailable() verified that wanted >>>${recordTypeArg}<<< record exists for >>>${recordNameArg}<<< with value >>>${expectedValue}<<<`
);
return true; return true;
} else { } else {
await plugins.smartdelay.delayFor(intervalArg); await plugins.smartdelay.delayFor(intervalArg);
@ -104,9 +106,12 @@ export class Smartdns {
recordNameArg: string, recordNameArg: string,
recordTypeArg: plugins.tsclass.network.TDnsRecordType recordTypeArg: plugins.tsclass.network.TDnsRecordType
): Promise<plugins.tsclass.network.IDnsRecord[]> { ): Promise<plugins.tsclass.network.IDnsRecord[]> {
const requestUrl = `https://dns.google/resolve?name=${recordNameArg}&type=${recordTypeArg}&do=1`; const requestUrl = `https://cloudflare-dns.com/dns-query?name=${recordNameArg}&type=${recordTypeArg}&do=1`;
const response = await plugins.smartrequest.request(requestUrl, { const response = await plugins.smartrequest.request(requestUrl, {
method: 'GET' method: 'GET',
headers: {
accept: 'application/dns-json',
},
}); });
const returnArray: plugins.tsclass.network.IDnsRecord[] = []; const returnArray: plugins.tsclass.network.IDnsRecord[] = [];
const responseBody: IGoogleDNSHTTPSResponse = response.body; const responseBody: IGoogleDNSHTTPSResponse = response.body;
@ -121,7 +126,7 @@ export class Smartdns {
name: dnsEntry.name, name: dnsEntry.name,
type: this.convertDnsTypeNumberToTypeName(dnsEntry.type), type: this.convertDnsTypeNumberToTypeName(dnsEntry.type),
dnsSecEnabled: responseBody.AD, dnsSecEnabled: responseBody.AD,
value: dnsEntry.data value: dnsEntry.data,
}); });
} }
// console.log(responseBody); // console.log(responseBody);
@ -148,7 +153,7 @@ export class Smartdns {
name: recordNameArg, name: recordNameArg,
value: recordsArg[recordKey][0], value: recordsArg[recordKey][0],
type: recordTypeArg, type: recordTypeArg,
dnsSecEnabled: false dnsSecEnabled: false,
}); });
} }
done.resolve(returnArray); done.resolve(returnArray);