From 16e94b5737db88e22baaf508589bfde7a2118dfb Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 18 Aug 2022 10:58:17 -0400 Subject: [PATCH] *Add dist --- dist/index.d.ts | 3 +++ dist/index.d.ts.map | 1 + dist/index.js | 2 ++ dist/resolverModule.d.ts | 13 +++++++++++++ dist/resolverModule.d.ts.map | 1 + dist/resolverModule.js | 13 +++++++++++++ dist/types.d.ts | 26 ++++++++++++++++++++++++++ dist/types.d.ts.map | 1 + dist/types.js | 11 +++++++++++ dist/util.d.ts | 5 +++++ dist/util.d.ts.map | 1 + dist/util.js | 21 +++++++++++++++++++++ 12 files changed, 98 insertions(+) create mode 100644 dist/index.d.ts create mode 100644 dist/index.d.ts.map create mode 100644 dist/index.js create mode 100644 dist/resolverModule.d.ts create mode 100644 dist/resolverModule.d.ts.map create mode 100644 dist/resolverModule.js create mode 100644 dist/types.d.ts create mode 100644 dist/types.d.ts.map create mode 100644 dist/types.js create mode 100644 dist/util.d.ts create mode 100644 dist/util.d.ts.map create mode 100644 dist/util.js diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..535b96f --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,3 @@ +export * from "./types.js"; +export * from "./resolverModule.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map new file mode 100644 index 0000000..14b675a --- /dev/null +++ b/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..3e7483c --- /dev/null +++ b/dist/index.js @@ -0,0 +1,2 @@ +export * from "./types.js"; +export * from "./resolverModule.js"; diff --git a/dist/resolverModule.d.ts b/dist/resolverModule.d.ts new file mode 100644 index 0000000..ddcb07f --- /dev/null +++ b/dist/resolverModule.d.ts @@ -0,0 +1,13 @@ +import type { DNSResult, ResolverOptions } from "./types.js"; +export default interface ResolverModule { + constructor(resolver: any): void; + resolve(domain: string, options: ResolverOptions, bypassCache: boolean): Promise; +} +export declare abstract class AbstractResolverModule { + protected resolver: any; + constructor(resolver: any); + abstract resolve(input: string, options: ResolverOptions, force: boolean): Promise; + getSupportedTlds(): string[]; + isTldSupported(domain: string): boolean; +} +//# sourceMappingURL=resolverModule.d.ts.map \ No newline at end of file diff --git a/dist/resolverModule.d.ts.map b/dist/resolverModule.d.ts.map new file mode 100644 index 0000000..b7270ee --- /dev/null +++ b/dist/resolverModule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"resolverModule.d.ts","sourceRoot":"","sources":["../src/resolverModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7D,MAAM,CAAC,OAAO,WAAW,cAAc;IACrC,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;IAEjC,OAAO,CACL,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,SAAS,CAAC,CAAC;CACvB;AAED,8BAAsB,sBAAsB;IAC1C,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC;gBAEZ,QAAQ,EAAE,GAAG;IAIzB,QAAQ,CAAC,OAAO,CACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,SAAS,CAAC;IAErB,gBAAgB,IAAI,MAAM,EAAE;IAI5B,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAGxC"} \ No newline at end of file diff --git a/dist/resolverModule.js b/dist/resolverModule.js new file mode 100644 index 0000000..88513f5 --- /dev/null +++ b/dist/resolverModule.js @@ -0,0 +1,13 @@ +import { getTld } from "./util.js"; +export class AbstractResolverModule { + resolver; + constructor(resolver) { + this.resolver = resolver; + } + getSupportedTlds() { + return []; + } + isTldSupported(domain) { + return this.getSupportedTlds().includes(getTld(domain)); + } +} diff --git a/dist/types.d.ts b/dist/types.d.ts new file mode 100644 index 0000000..3c060c8 --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,26 @@ +export interface ResolverOptions { + type: any; + customType?: string; + records: any[]; + options: any; +} +export interface DNSResult { + records: any[]; + error?: Error; +} +export interface DNSRecord { + type: string; + customType?: string; + value: string; +} +declare const DNS_RECORD_TYPE: { + A: string; + CNAME: string; + NS: string; + CONTENT: string; + TEXT: string; + ALL: string; + CUSTOM: string; +}; +export { DNS_RECORD_TYPE }; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/types.d.ts.map b/dist/types.d.ts.map new file mode 100644 index 0000000..f2d64b1 --- /dev/null +++ b/dist/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,QAAA,MAAM,eAAe;;;;;;;;CAQpB,CAAC;AAIF,OAAO,EAAE,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/types.js b/dist/types.js new file mode 100644 index 0000000..cdb140d --- /dev/null +++ b/dist/types.js @@ -0,0 +1,11 @@ +const DNS_RECORD_TYPE = { + A: "A", + CNAME: "CNAME", + NS: "NS", + CONTENT: "CONTENT", + TEXT: "TEXT", + ALL: "ALL", + CUSTOM: "CUSTOM", +}; +Object.freeze(DNS_RECORD_TYPE); +export { DNS_RECORD_TYPE }; diff --git a/dist/util.d.ts b/dist/util.d.ts new file mode 100644 index 0000000..0ce4670 --- /dev/null +++ b/dist/util.d.ts @@ -0,0 +1,5 @@ +export declare function getTld(domain: string): string; +export declare function getSld(domain: string): string; +export declare function isIp(ip: string): boolean; +export declare function isDomain(domain: string): boolean; +//# sourceMappingURL=util.d.ts.map \ No newline at end of file diff --git a/dist/util.d.ts.map b/dist/util.d.ts.map new file mode 100644 index 0000000..374805c --- /dev/null +++ b/dist/util.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAS7C;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,WAI9B;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,WAItC"} \ No newline at end of file diff --git a/dist/util.js b/dist/util.js new file mode 100644 index 0000000..231cc45 --- /dev/null +++ b/dist/util.js @@ -0,0 +1,21 @@ +export function getTld(domain) { + if (domain.includes(".")) { + domain = domain.split(".")[domain.split(".").length - 1]; + } + return domain; +} +export function getSld(domain) { + if (domain.includes(".")) { + domain = domain + .split(".") + .slice(0, domain.split(".").length - 1) + .join("."); + } + return domain; +} +export function isIp(ip) { + return /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ip); +} +export function isDomain(domain) { + return /(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/.test(domain); +}