*Update dist

This commit is contained in:
Derrick Hammer 2023-02-19 21:16:05 -05:00
parent 4642c10bf2
commit 03503c1b77
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
4 changed files with 3 additions and 80 deletions

1
dist/client.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare const dnsClient: import("@lumeweb/kernel-dns-client").DnsClient;

2
dist/client.js vendored Normal file
View File

@ -0,0 +1,2 @@
import { createClient } from "@lumeweb/kernel-dns-client";
export const dnsClient = createClient();

View File

@ -1,31 +0,0 @@
import {
DNSResult,
ResolverOptions,
ResolverModuleConstructor as ResolverModuleConstructorBase,
} from "@lumeweb/libresolver";
import { Client } from "@lumeweb/libkernel-universal";
export interface ResolverModuleConstructor
extends ResolverModuleConstructorBase {
new (resolver: ResolverRegistry): ResolverModule;
}
export declare class ResolverRegistry {
get resolvers(): Promise<Set<ResolverModule>>;
resolve(
domain: string,
options?: ResolverOptions,
bypassCache?: boolean
): Promise<DNSResult>;
register(resolver: ResolverModule): void;
clear(): void;
}
export declare class ResolverModule extends Client {
private resolver;
private domain;
constructor(resolver: ResolverRegistry, domain: string);
resolve(
domain: string,
options: ResolverOptions,
bypassCache: boolean
): Promise<DNSResult>;
getSupportedTlds(): Promise<string[]>;
}

View File

@ -1,49 +0,0 @@
import { DNS_RECORD_TYPE, resolverError, } from "@lumeweb/libresolver";
import { Client, factory } from "@lumeweb/libkernel-universal";
import { dnsClient } from "./client.js";
export class ResolverRegistry {
get resolvers() {
return dnsClient
.getResolvers()
.then((resolvers) => {
return new Set(resolvers.map((resolver) => factory(ResolverModule, resolver)(this, resolver)));
})
.catch(() => {
return new Set();
});
}
async resolve(domain, options = { type: DNS_RECORD_TYPE.CONTENT }, bypassCache = false) {
try {
return dnsClient.resolve(domain, options, bypassCache);
}
catch (e) {
return resolverError(e);
}
}
register(resolver) { }
clear() { }
}
export class ResolverModule extends Client {
resolver;
domain;
constructor(resolver, domain) {
super();
this.resolver = resolver;
this.domain = domain;
}
async resolve(domain, options, bypassCache) {
try {
return this.callModuleReturn("resolve", {
domain,
options,
bypassCache,
});
}
catch (e) {
return resolverError(e);
}
}
async getSupportedTlds() {
return this.callModuleReturn("getSupportedTlds");
}
}