*Update dist

This commit is contained in:
Derrick Hammer 2023-02-19 16:22:59 -05:00
parent 3f96c6d1de
commit 91b1c89bc4
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 22 additions and 61 deletions

18
dist/index.d.ts vendored
View File

@ -1,11 +1,9 @@
import { ResolverOptions } from "@lumeweb/resolver-common"; import { Client } from "@lumeweb/libkernel-universal";
export declare function resolve( export declare class DnsClient extends Client {
domain: string, register(): Promise<void>;
options?: ResolverOptions, clear(): Promise<void>;
bypassCache?: boolean getResolvers(): Promise<void>;
): Promise<any>; ready(): Promise<void>;
export declare function register(): Promise<void>; }
export declare function clear(): Promise<void>; export declare const createClient: (...args: any) => DnsClient;
export declare function getResolvers(): Promise<any>;
export declare function ready(): Promise<any>;
//# sourceMappingURL=index.d.ts.map //# sourceMappingURL=index.d.ts.map

2
dist/index.d.ts.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAqB5E,wBAAsB,OAAO,CAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAmD,EAC5D,WAAW,UAAQ,gBAcpB;AAED,wBAAsB,QAAQ,kBAG7B;AAED,wBAAsB,KAAK,kBAG1B;AAED,wBAAsB,YAAY,iBASjC;AAED,wBAAsB,KAAK,iBAS1B"} {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAI/D,qBAAa,SAAU,SAAQ,MAAM;IACtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAGzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAGtB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAG7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC;AAED,eAAO,MAAM,YAAY,6BAAwC,CAAC"}

63
dist/index.js vendored
View File

@ -1,54 +1,17 @@
import { DNS_RECORD_TYPE } from "@lumeweb/resolver-common"; import { Client, factory } from "@lumeweb/libkernel-universal";
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A"; const MODULE = "PACYNuYbp_5hgCjMK16EGcytB9QCxDLe4_uitahwePdeaA";
let callModule, connectModule; export class DnsClient extends Client {
async function loadLibs() { async register() {
if (callModule && connectModule) { return this.callModuleReturn("register");
return;
} }
if (typeof window !== "undefined" && window?.document) { async clear() {
const pkg = await import("libkernel"); return this.callModuleReturn("clear");
callModule = pkg.callModule;
connectModule = pkg.connectModule;
} }
else { async getResolvers() {
const pkg = await import("libkmodule"); return this.callModuleReturn("clear");
callModule = pkg.callModule; }
connectModule = pkg.connectModule; async ready() {
return this.callModuleReturn("ready");
} }
} }
export async function resolve(domain, options = { type: DNS_RECORD_TYPE.CONTENT }, bypassCache = false) { export const createClient = factory(DnsClient, MODULE);
await loadLibs();
const [resp, err] = await callModule(DNS_MODULE, "resolve", {
domain,
options,
bypassCache,
});
if (err) {
throw new Error(err);
}
return resp;
}
export async function register() {
await loadLibs();
await callModule(DNS_MODULE, "register");
}
export async function clear() {
await loadLibs();
await callModule(DNS_MODULE, "clear");
}
export async function getResolvers() {
await loadLibs();
const [resp, err] = await callModule(DNS_MODULE, "getResolvers");
if (err) {
throw new Error(err);
}
return resp;
}
export async function ready() {
await loadLibs();
const [resp, err] = await callModule(DNS_MODULE, "ready");
if (err) {
throw new Error(err);
}
return resp;
}