diff --git a/dist/index.d.ts b/dist/index.d.ts index d803700..fa842b2 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,2 +1,3 @@ import type { ResolverModule } from "@lumeweb/resolver-common"; export declare function setup(rm: ResolverModule): void; +export * from "./resolverRegistry.js"; diff --git a/dist/index.js b/dist/index.js index 87e384c..c67fa5e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -30,3 +30,4 @@ async function handleResolve(aq) { } aq.respond(ret); } +export * from "./resolverRegistry.js"; diff --git a/dist/resolverRegistry.d.ts b/dist/resolverRegistry.d.ts new file mode 100644 index 0000000..dc633e2 --- /dev/null +++ b/dist/resolverRegistry.d.ts @@ -0,0 +1,8 @@ +import { DNSResult, ResolverOptions } from "@lumeweb/resolver-common"; +export declare class ResolverRegistry { + resolve( + domain: string, + options?: ResolverOptions, + bypassCache?: boolean + ): Promise; +} diff --git a/dist/resolverRegistry.js b/dist/resolverRegistry.js new file mode 100644 index 0000000..d27063a --- /dev/null +++ b/dist/resolverRegistry.js @@ -0,0 +1,14 @@ +import { DNS_RECORD_TYPE, resolverError, } from "@lumeweb/resolver-common"; +import { resolve } from "@lumeweb/kernel-dns-client"; +export class ResolverRegistry { + async resolve(domain, options = { type: DNS_RECORD_TYPE.DEFAULT }, bypassCache = false) { + let result; + try { + result = await resolve(domain, options, bypassCache); + } + catch (e) { + return resolverError(e); + } + return result; + } +}