*Update dist
This commit is contained in:
parent
3f96c6d1de
commit
91b1c89bc4
|
@ -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
|
||||||
|
|
|
@ -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"}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue