@xyo-network/dns 3.6.0-rc.8 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/DnsRecordType.d.ts +15 -14
- package/dist/neutral/DnsRecordType.d.ts.map +1 -1
- package/dist/neutral/DnsReturnCode.d.ts +13 -13
- package/dist/neutral/DnsReturnCode.d.ts.map +1 -1
- package/dist/neutral/domainResolve.d.ts.map +1 -1
- package/dist/neutral/googleDnsOverHttps.d.ts.map +1 -1
- package/dist/neutral/index.mjs +29 -31
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +5 -6
- package/src/DnsRecordType.ts +16 -14
- package/src/DnsReturnCode.ts +12 -12
- package/src/domainResolve.ts +1 -1
- package/src/googleDnsOverHttps.ts +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
A
|
|
3
|
-
AAAA
|
|
4
|
-
CAA
|
|
5
|
-
CNAME
|
|
6
|
-
DNAME
|
|
7
|
-
MX
|
|
8
|
-
NS
|
|
9
|
-
PTR
|
|
10
|
-
SOA
|
|
11
|
-
SPF
|
|
12
|
-
SRV
|
|
13
|
-
TXT
|
|
14
|
-
}
|
|
1
|
+
export declare const DnsRecordType: {
|
|
2
|
+
readonly A: 1;
|
|
3
|
+
readonly AAAA: 28;
|
|
4
|
+
readonly CAA: 257;
|
|
5
|
+
readonly CNAME: 5;
|
|
6
|
+
readonly DNAME: 39;
|
|
7
|
+
readonly MX: 15;
|
|
8
|
+
readonly NS: 2;
|
|
9
|
+
readonly PTR: 12;
|
|
10
|
+
readonly SOA: 6;
|
|
11
|
+
readonly SPF: 99;
|
|
12
|
+
readonly SRV: 33;
|
|
13
|
+
readonly TXT: 16;
|
|
14
|
+
};
|
|
15
|
+
export type DnsRecordType = typeof DnsRecordType[keyof typeof DnsRecordType];
|
|
15
16
|
//# sourceMappingURL=DnsRecordType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnsRecordType.d.ts","sourceRoot":"","sources":["../../src/DnsRecordType.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"DnsRecordType.d.ts","sourceRoot":"","sources":["../../src/DnsRecordType.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;CAahB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
declare
|
|
2
|
-
NoError
|
|
3
|
-
QueryFormatError
|
|
4
|
-
ServerFailed
|
|
5
|
-
DomainDoesNotExist
|
|
6
|
-
NotImplemented
|
|
7
|
-
Refused
|
|
8
|
-
NameShouldNotExist
|
|
9
|
-
RRSetShouldNotExist
|
|
10
|
-
|
|
11
|
-
NotInZone
|
|
12
|
-
}
|
|
13
|
-
export
|
|
1
|
+
export declare const DnsReturnCode: {
|
|
2
|
+
NoError: number;
|
|
3
|
+
QueryFormatError: number;
|
|
4
|
+
ServerFailed: number;
|
|
5
|
+
DomainDoesNotExist: number;
|
|
6
|
+
NotImplemented: number;
|
|
7
|
+
Refused: number;
|
|
8
|
+
NameShouldNotExist: number;
|
|
9
|
+
RRSetShouldNotExist: number;
|
|
10
|
+
NotAuthoritative: number;
|
|
11
|
+
NotInZone: number;
|
|
12
|
+
};
|
|
13
|
+
export type DnsReturnCode = typeof DnsReturnCode[keyof typeof DnsReturnCode];
|
|
14
14
|
//# sourceMappingURL=DnsReturnCode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DnsReturnCode.d.ts","sourceRoot":"","sources":["../../src/DnsReturnCode.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"DnsReturnCode.d.ts","sourceRoot":"","sources":["../../src/DnsReturnCode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;CAWzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domainResolve.d.ts","sourceRoot":"","sources":["../../src/domainResolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD;;;;GAIG;AACH,QAAA,MAAM,aAAa,YAAmB,MAAM,
|
|
1
|
+
{"version":3,"file":"domainResolve.d.ts","sourceRoot":"","sources":["../../src/domainResolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGlD;;;;GAIG;AACH,QAAA,MAAM,aAAa,YAAmB,MAAM,SAAQ,aAAa,wEAIhE,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"googleDnsOverHttps.d.ts","sourceRoot":"","sources":["../../src/googleDnsOverHttps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,QAAA,MAAM,kBAAkB,SAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"googleDnsOverHttps.d.ts","sourceRoot":"","sources":["../../src/googleDnsOverHttps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,QAAA,MAAM,kBAAkB,SAAgB,MAAM,SAAQ,aAAa,6BAElE,CAAA;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
// src/DnsRecordType.ts
|
|
2
|
-
var DnsRecordType =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})(DnsRecordType || {});
|
|
2
|
+
var DnsRecordType = {
|
|
3
|
+
A: 1,
|
|
4
|
+
AAAA: 28,
|
|
5
|
+
CAA: 257,
|
|
6
|
+
CNAME: 5,
|
|
7
|
+
DNAME: 39,
|
|
8
|
+
MX: 15,
|
|
9
|
+
NS: 2,
|
|
10
|
+
PTR: 12,
|
|
11
|
+
SOA: 6,
|
|
12
|
+
SPF: 99,
|
|
13
|
+
SRV: 33,
|
|
14
|
+
TXT: 16
|
|
15
|
+
};
|
|
17
16
|
|
|
18
17
|
// src/DnsReturnCode.ts
|
|
19
|
-
var DnsReturnCode =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})(DnsReturnCode || {});
|
|
18
|
+
var DnsReturnCode = {
|
|
19
|
+
NoError: 0,
|
|
20
|
+
QueryFormatError: 1,
|
|
21
|
+
ServerFailed: 2,
|
|
22
|
+
DomainDoesNotExist: 3,
|
|
23
|
+
NotImplemented: 4,
|
|
24
|
+
Refused: 5,
|
|
25
|
+
NameShouldNotExist: 6,
|
|
26
|
+
RRSetShouldNotExist: 7,
|
|
27
|
+
NotAuthoritative: 8,
|
|
28
|
+
NotInZone: 9
|
|
29
|
+
};
|
|
32
30
|
|
|
33
31
|
// src/googleDnsOverHttps.ts
|
|
34
32
|
import { axios } from "@xylabs/axios";
|
|
35
|
-
var googleDnsOverHttps = async (name, type =
|
|
33
|
+
var googleDnsOverHttps = async (name, type = DnsRecordType.A) => {
|
|
36
34
|
return (await axios.get(`https://dns.google/resolve?name=${name}&type=${type}`)).data;
|
|
37
35
|
};
|
|
38
36
|
|
|
39
37
|
// src/domainResolve.ts
|
|
40
|
-
var domainResolve = async (domain, type =
|
|
38
|
+
var domainResolve = async (domain, type = DnsRecordType.A) => {
|
|
41
39
|
if (domain) {
|
|
42
40
|
return await googleDnsOverHttps(domain, type);
|
|
43
41
|
}
|
|
@@ -47,7 +45,7 @@ var domainResolve = async (domain, type = 1 /* A */) => {
|
|
|
47
45
|
var domainExists = async (domain) => {
|
|
48
46
|
if (domain === void 0) return false;
|
|
49
47
|
const dnsResult = await domainResolve(domain);
|
|
50
|
-
return dnsResult?.Status ===
|
|
48
|
+
return dnsResult?.Status === DnsReturnCode.NoError;
|
|
51
49
|
};
|
|
52
50
|
export {
|
|
53
51
|
DnsRecordType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/DnsRecordType.ts","../../src/DnsReturnCode.ts","../../src/googleDnsOverHttps.ts","../../src/domainResolve.ts","../../src/domainExists.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../src/DnsRecordType.ts","../../src/DnsReturnCode.ts","../../src/googleDnsOverHttps.ts","../../src/domainResolve.ts","../../src/domainExists.ts"],"sourcesContent":["export const DnsRecordType = {\n A: 1,\n AAAA: 28,\n CAA: 257,\n CNAME: 5,\n DNAME: 39,\n MX: 15,\n NS: 2,\n PTR: 12,\n SOA: 6,\n SPF: 99,\n SRV: 33,\n TXT: 16,\n} as const\n\nexport type DnsRecordType = typeof DnsRecordType[keyof typeof DnsRecordType]\n","export const DnsReturnCode = {\n NoError: 0,\n QueryFormatError: 1,\n ServerFailed: 2,\n DomainDoesNotExist: 3,\n NotImplemented: 4,\n Refused: 5,\n NameShouldNotExist: 6,\n RRSetShouldNotExist: 7,\n NotAuthoritative: 8,\n NotInZone: 9,\n}\n\nexport type DnsReturnCode = typeof DnsReturnCode[keyof typeof DnsReturnCode]\n","import { axios } from '@xylabs/axios'\n\nimport { DnsRecordType } from './DnsRecordType.ts'\nimport type { GoogleDnsResult } from './GoogleDnsResult.ts'\n\nconst googleDnsOverHttps = async (name: string, type: DnsRecordType = DnsRecordType.A) => {\n return (await axios.get<GoogleDnsResult>(`https://dns.google/resolve?name=${name}&type=${type}`)).data\n}\n\nexport { googleDnsOverHttps }\n","import { DnsRecordType } from './DnsRecordType.ts'\nimport { googleDnsOverHttps } from './googleDnsOverHttps.ts'\n\n/**\n * Resolves DNS information (resolves using DNS)\n * @param domain - string\n * @returns GoogleDnsResult\n */\nconst domainResolve = async (domain?: string, type: DnsRecordType = DnsRecordType.A) => {\n if (domain) {\n return await googleDnsOverHttps(domain, type)\n }\n}\n\nexport { domainResolve }\n","import { DnsReturnCode } from './DnsReturnCode.ts'\nimport { domainResolve } from './domainResolve.ts'\n\n/**\n * Checks if a domain exists (resolves using DNS)\n * @param domain - string\n * @returns boolean\n */\nconst domainExists = async (domain?: string) => {\n if (domain === undefined) return false\n const dnsResult = await domainResolve(domain)\n return dnsResult?.Status === DnsReturnCode.NoError\n}\n\nexport { domainExists }\n"],"mappings":";AAAO,IAAM,gBAAgB;AAAA,EAC3B,GAAG;AAAA,EACH,MAAM;AAAA,EACN,KAAK;AAAA,EACL,OAAO;AAAA,EACP,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;;;ACbO,IAAM,gBAAgB;AAAA,EAC3B,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,WAAW;AACb;;;ACXA,SAAS,aAAa;AAKtB,IAAM,qBAAqB,OAAO,MAAc,OAAsB,cAAc,MAAM;AACxF,UAAQ,MAAM,MAAM,IAAqB,mCAAmC,IAAI,SAAS,IAAI,EAAE,GAAG;AACpG;;;ACCA,IAAM,gBAAgB,OAAO,QAAiB,OAAsB,cAAc,MAAM;AACtF,MAAI,QAAQ;AACV,WAAO,MAAM,mBAAmB,QAAQ,IAAI;AAAA,EAC9C;AACF;;;ACJA,IAAM,eAAe,OAAO,WAAoB;AAC9C,MAAI,WAAW,OAAW,QAAO;AACjC,QAAM,YAAY,MAAM,cAAc,MAAM;AAC5C,SAAO,WAAW,WAAW,cAAc;AAC7C;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/dns",
|
|
3
|
-
"version": "3.6.0
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -29,15 +29,14 @@
|
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/axios": "^4.4.
|
|
32
|
+
"@xylabs/axios": "^4.4.26"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@xylabs/ts-scripts-yarn3": "^4.2.
|
|
36
|
-
"@xylabs/tsconfig": "^4.2.
|
|
35
|
+
"@xylabs/ts-scripts-yarn3": "^4.2.6",
|
|
36
|
+
"@xylabs/tsconfig": "^4.2.6",
|
|
37
37
|
"typescript": "^5.7.2"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
|
-
}
|
|
42
|
-
"stableVersion": "3.5.2"
|
|
41
|
+
}
|
|
43
42
|
}
|
package/src/DnsRecordType.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
A
|
|
3
|
-
AAAA
|
|
4
|
-
CAA
|
|
5
|
-
CNAME
|
|
6
|
-
DNAME
|
|
7
|
-
MX
|
|
8
|
-
NS
|
|
9
|
-
PTR
|
|
10
|
-
SOA
|
|
11
|
-
SPF
|
|
12
|
-
SRV
|
|
13
|
-
TXT
|
|
14
|
-
}
|
|
1
|
+
export const DnsRecordType = {
|
|
2
|
+
A: 1,
|
|
3
|
+
AAAA: 28,
|
|
4
|
+
CAA: 257,
|
|
5
|
+
CNAME: 5,
|
|
6
|
+
DNAME: 39,
|
|
7
|
+
MX: 15,
|
|
8
|
+
NS: 2,
|
|
9
|
+
PTR: 12,
|
|
10
|
+
SOA: 6,
|
|
11
|
+
SPF: 99,
|
|
12
|
+
SRV: 33,
|
|
13
|
+
TXT: 16,
|
|
14
|
+
} as const
|
|
15
|
+
|
|
16
|
+
export type DnsRecordType = typeof DnsRecordType[keyof typeof DnsRecordType]
|
package/src/DnsReturnCode.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
NoError
|
|
3
|
-
QueryFormatError
|
|
4
|
-
ServerFailed
|
|
5
|
-
DomainDoesNotExist
|
|
6
|
-
NotImplemented
|
|
7
|
-
Refused
|
|
8
|
-
NameShouldNotExist
|
|
9
|
-
RRSetShouldNotExist
|
|
10
|
-
|
|
11
|
-
NotInZone
|
|
1
|
+
export const DnsReturnCode = {
|
|
2
|
+
NoError: 0,
|
|
3
|
+
QueryFormatError: 1,
|
|
4
|
+
ServerFailed: 2,
|
|
5
|
+
DomainDoesNotExist: 3,
|
|
6
|
+
NotImplemented: 4,
|
|
7
|
+
Refused: 5,
|
|
8
|
+
NameShouldNotExist: 6,
|
|
9
|
+
RRSetShouldNotExist: 7,
|
|
10
|
+
NotAuthoritative: 8,
|
|
11
|
+
NotInZone: 9,
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type DnsReturnCode = typeof DnsReturnCode[keyof typeof DnsReturnCode]
|
package/src/domainResolve.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { googleDnsOverHttps } from './googleDnsOverHttps.ts'
|
|
|
6
6
|
* @param domain - string
|
|
7
7
|
* @returns GoogleDnsResult
|
|
8
8
|
*/
|
|
9
|
-
const domainResolve = async (domain?: string, type = DnsRecordType.A) => {
|
|
9
|
+
const domainResolve = async (domain?: string, type: DnsRecordType = DnsRecordType.A) => {
|
|
10
10
|
if (domain) {
|
|
11
11
|
return await googleDnsOverHttps(domain, type)
|
|
12
12
|
}
|
|
@@ -3,7 +3,7 @@ import { axios } from '@xylabs/axios'
|
|
|
3
3
|
import { DnsRecordType } from './DnsRecordType.ts'
|
|
4
4
|
import type { GoogleDnsResult } from './GoogleDnsResult.ts'
|
|
5
5
|
|
|
6
|
-
const googleDnsOverHttps = async (name: string, type = DnsRecordType.A) => {
|
|
6
|
+
const googleDnsOverHttps = async (name: string, type: DnsRecordType = DnsRecordType.A) => {
|
|
7
7
|
return (await axios.get<GoogleDnsResult>(`https://dns.google/resolve?name=${name}&type=${type}`)).data
|
|
8
8
|
}
|
|
9
9
|
|