*Update dist
This commit is contained in:
parent
3f96c6d1de
commit
91b1c89bc4
|
@ -1,11 +1,9 @@
|
|||
import { ResolverOptions } from "@lumeweb/resolver-common";
|
||||
export declare function resolve(
|
||||
domain: string,
|
||||
options?: ResolverOptions,
|
||||
bypassCache?: boolean
|
||||
): Promise<any>;
|
||||
export declare function register(): Promise<void>;
|
||||
export declare function clear(): Promise<void>;
|
||||
export declare function getResolvers(): Promise<any>;
|
||||
export declare function ready(): Promise<any>;
|
||||
import { Client } from "@lumeweb/libkernel-universal";
|
||||
export declare class DnsClient extends Client {
|
||||
register(): Promise<void>;
|
||||
clear(): Promise<void>;
|
||||
getResolvers(): Promise<void>;
|
||||
ready(): Promise<void>;
|
||||
}
|
||||
export declare const createClient: (...args: any) => DnsClient;
|
||||
//# 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";
|
||||
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A";
|
||||
let callModule, connectModule;
|
||||
async function loadLibs() {
|
||||
if (callModule && connectModule) {
|
||||
return;
|
||||
import { Client, factory } from "@lumeweb/libkernel-universal";
|
||||
const MODULE = "PACYNuYbp_5hgCjMK16EGcytB9QCxDLe4_uitahwePdeaA";
|
||||
export class DnsClient extends Client {
|
||||
async register() {
|
||||
return this.callModuleReturn("register");
|
||||
}
|
||||
if (typeof window !== "undefined" && window?.document) {
|
||||
const pkg = await import("libkernel");
|
||||
callModule = pkg.callModule;
|
||||
connectModule = pkg.connectModule;
|
||||
async clear() {
|
||||
return this.callModuleReturn("clear");
|
||||
}
|
||||
else {
|
||||
const pkg = await import("libkmodule");
|
||||
callModule = pkg.callModule;
|
||||
connectModule = pkg.connectModule;
|
||||
async getResolvers() {
|
||||
return this.callModuleReturn("clear");
|
||||
}
|
||||
async ready() {
|
||||
return this.callModuleReturn("ready");
|
||||
}
|
||||
}
|
||||
export async function resolve(domain, options = { type: DNS_RECORD_TYPE.CONTENT }, bypassCache = false) {
|
||||
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;
|
||||
}
|
||||
export const createClient = factory(DnsClient, MODULE);
|
||||
|
|
Loading…
Reference in New Issue