Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer 4642c10bf2
*Update dist 2023-02-19 21:13:16 -05:00
Derrick Hammer 69bb1f7c60
*Change types so setup doesnt throw an error
*ts-ignore setting resolver
2023-02-19 21:12:57 -05:00
3 changed files with 9 additions and 4 deletions

7
dist/index.d.ts vendored
View File

@ -1,4 +1,7 @@
import type { DNSResult } from "@lumeweb/libresolver"; import type {
DNSResult,
ResolverModule as ResolverModuleBase,
} from "@lumeweb/libresolver";
import { DnsClient } from "@lumeweb/kernel-dns-client"; import { DnsClient } from "@lumeweb/kernel-dns-client";
import { ResolverOptions } from "@lumeweb/libresolver/src/types.js"; import { ResolverOptions } from "@lumeweb/libresolver/src/types.js";
export interface ResolverModule { export interface ResolverModule {
@ -13,7 +16,7 @@ export interface ResolverModule {
getSupportedTlds(): Promise<string[]>; getSupportedTlds(): Promise<string[]>;
getSupportedTlds(): any; getSupportedTlds(): any;
} }
export declare function setup(rm: ResolverModule): void; export declare function setup(rm: ResolverModule | ResolverModuleBase): void;
export * from "@lumeweb/libresolver/dist/util.js"; export * from "@lumeweb/libresolver/dist/util.js";
export * from "@lumeweb/libresolver/dist/types.js"; export * from "@lumeweb/libresolver/dist/types.js";
export { AbstractResolverModule } from "@lumeweb/libresolver/dist/resolverModule.js"; export { AbstractResolverModule } from "@lumeweb/libresolver/dist/resolverModule.js";

1
dist/index.js vendored
View File

@ -8,6 +8,7 @@ export function setup(rm) {
addHandler("getSupportedTlds", handleGetSupportedTlds); addHandler("getSupportedTlds", handleGetSupportedTlds);
onmessage = handleMessage; onmessage = handleMessage;
resolver = rm; resolver = rm;
// @ts-ignore
resolver.resolver = dnsClient; resolver.resolver = dnsClient;
} }
async function handleRegister(aq) { async function handleRegister(aq) {

View File

@ -9,7 +9,7 @@ import { dnsClient } from "./client.js";
import { DnsClient } from "@lumeweb/kernel-dns-client"; import { DnsClient } from "@lumeweb/kernel-dns-client";
import { ResolverOptions } from "@lumeweb/libresolver/src/types.js"; import { ResolverOptions } from "@lumeweb/libresolver/src/types.js";
let resolver: ResolverModule; let resolver: ResolverModule | ResolverModuleBase;
export interface ResolverModule { export interface ResolverModule {
get resolver(): DnsClient; get resolver(): DnsClient;
@ -25,12 +25,13 @@ export interface ResolverModule {
getSupportedTlds(): any; getSupportedTlds(): any;
} }
export function setup(rm: ResolverModule) { export function setup(rm: ResolverModule | ResolverModuleBase) {
addHandler("resolve", handleResolve); addHandler("resolve", handleResolve);
addHandler("register", handleRegister); addHandler("register", handleRegister);
addHandler("getSupportedTlds", handleGetSupportedTlds); addHandler("getSupportedTlds", handleGetSupportedTlds);
onmessage = handleMessage; onmessage = handleMessage;
resolver = rm; resolver = rm;
// @ts-ignore
resolver.resolver = dnsClient; resolver.resolver = dnsClient;
} }