Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer f1bbbf540d
*Update dist 2023-04-09 14:15:54 -04:00
Derrick Hammer 1e8924d5ac
*add registerResolver method 2023-04-09 14:15:40 -04:00
4 changed files with 30 additions and 15 deletions

5
dist/index.d.ts vendored
View File

@ -2,9 +2,10 @@ import { Client } from "@lumeweb/libkernel-universal";
import { DNSResult, ResolverOptions } from "@lumeweb/libresolver";
import { ResolverModule } from "./module.js";
export declare class DnsClient extends Client {
register(): Promise<void>;
clear(): Promise<void>;
get resolvers(): Promise<Set<ResolverModule>>;
register(): Promise<void>;
registerResolver(module: string): Promise<void>;
clear(): Promise<void>;
resolve(
domain: string,
options?: ResolverOptions,

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,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAEL,SAAS,EACT,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAC;AAI3D,qBAAa,SAAU,SAAQ,MAAM;IACtB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAGzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAGnC,IAAI,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAQ5C;IACY,OAAO,CAClB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAmD,EAC5D,WAAW,GAAE,OAAe,GAC3B,OAAO,CAAC,SAAS,CAAC;CAGtB;AAED,eAAO,MAAM,YAAY,6BAAwC,CAAC;AAClE,cAAc,aAAa,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAEL,SAAS,EACT,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAC;AAI3D,qBAAa,SAAU,SAAQ,MAAM;IACnC,IAAI,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAQ5C;IAEY,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM/C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,OAAO,CAClB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,eAAmD,EAC5D,WAAW,GAAE,OAAe,GAC3B,OAAO,CAAC,SAAS,CAAC;CAGtB;AAED,eAAO,MAAM,YAAY,6BAAwC,CAAC;AAClE,cAAc,aAAa,CAAC"}

17
dist/index.js vendored
View File

@ -3,12 +3,6 @@ import { DNS_RECORD_TYPE, } from "@lumeweb/libresolver";
import { createModule } from "./module.js";
const MODULE = "vAA-phmM1ztqu8zGBKF2nM3b8N_IQGWlB6J_doi2FhqS-A";
export class DnsClient extends Client {
async register() {
return this.callModuleReturn("register");
}
async clear() {
return this.callModuleReturn("clear");
}
get resolvers() {
return this.callModuleReturn("getResolvers").then((resolvers) => {
return new Set(resolvers.map((resolver) => {
@ -16,6 +10,17 @@ export class DnsClient extends Client {
}));
});
}
async register() {
return this.callModuleReturn("register");
}
async registerResolver(module) {
const bag = await this.loadBound(module);
const ret = await bag.callModule("register");
return ret[0];
}
async clear() {
return this.callModuleReturn("clear");
}
async resolve(domain, options = { type: DNS_RECORD_TYPE.CONTENT }, bypassCache = false) {
return this.callModuleReturn("resolve", { domain, options, bypassCache });
}

View File

@ -9,12 +9,6 @@ import { createModule, ResolverModule } from "./module.js";
const MODULE = "vAA-phmM1ztqu8zGBKF2nM3b8N_IQGWlB6J_doi2FhqS-A";
export class DnsClient extends Client {
public async register(): Promise<void> {
return this.callModuleReturn("register");
}
public async clear(): Promise<void> {
return this.callModuleReturn("clear");
}
get resolvers(): Promise<Set<ResolverModule>> {
return this.callModuleReturn("getResolvers").then((resolvers: string[]) => {
return new Set(
@ -24,6 +18,21 @@ export class DnsClient extends Client {
);
});
}
public async register(): Promise<void> {
return this.callModuleReturn("register");
}
public async registerResolver(module: string): Promise<void> {
const bag = await this.loadBound(module);
const ret = await bag.callModule("register");
return ret[0];
}
public async clear(): Promise<void> {
return this.callModuleReturn("clear");
}
public async resolve(
domain: string,
options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT },