Compare commits
No commits in common. "develop" and "master" have entirely different histories.
|
@ -1,13 +0,0 @@
|
||||||
name: Build/Publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- develop-*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
|
||||||
secrets: inherit
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"preset": [
|
|
||||||
"@lumeweb/node-library-preset"
|
|
||||||
]
|
|
||||||
}
|
|
33
CHANGELOG.md
33
CHANGELOG.md
|
@ -1,33 +0,0 @@
|
||||||
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-09-11)
|
|
||||||
|
|
||||||
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-09-04)
|
|
||||||
|
|
||||||
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-03)
|
|
||||||
|
|
||||||
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-07-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-07-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-07-29)
|
|
||||||
|
|
||||||
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-15)
|
|
||||||
|
|
||||||
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-07-15)
|
|
||||||
|
|
||||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.0.2-develop.2...v0.1.0-develop.1) (2023-07-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* add ready to setup ([c329921](https://git.lumeweb.com/LumeWeb/kernel-libresolver/commit/c329921aa403b65cb5938a8ea421bdbe3796541a))
|
|
||||||
|
|
||||||
## [0.0.2-develop.2](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.0.2-develop.1...v0.0.2-develop.2) (2023-07-14)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* typo in package.json ([9ca41e3](https://git.lumeweb.com/LumeWeb/kernel-libresolver/commit/9ca41e326156244ebaa46b565aed98dfbd20ef7b))
|
|
||||||
|
|
||||||
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/kernel-libresolver/compare/v0.0.1...v0.0.2-develop.1) (2023-07-05)
|
|
|
@ -0,0 +1 @@
|
||||||
|
export declare const dnsClient: import("@lumeweb/kernel-dns-client").DnsClient;
|
|
@ -0,0 +1,2 @@
|
||||||
|
import { createClient } from "@lumeweb/kernel-dns-client";
|
||||||
|
export const dnsClient = createClient();
|
|
@ -0,0 +1,22 @@
|
||||||
|
import type {
|
||||||
|
DNSResult,
|
||||||
|
ResolverModule as ResolverModuleBase,
|
||||||
|
} from "@lumeweb/libresolver";
|
||||||
|
import { DnsClient } from "@lumeweb/kernel-dns-client";
|
||||||
|
import { ResolverOptions } from "@lumeweb/libresolver/src/types.js";
|
||||||
|
export interface ResolverModule {
|
||||||
|
get resolver(): DnsClient;
|
||||||
|
set resolver(value: DnsClient);
|
||||||
|
resolve(
|
||||||
|
domain: string,
|
||||||
|
options: ResolverOptions,
|
||||||
|
bypassCache: boolean
|
||||||
|
): Promise<DNSResult>;
|
||||||
|
getSupportedTlds(): string[];
|
||||||
|
getSupportedTlds(): Promise<string[]>;
|
||||||
|
getSupportedTlds(): any;
|
||||||
|
}
|
||||||
|
export declare function setup(rm: ResolverModule | ResolverModuleBase): void;
|
||||||
|
export * from "@lumeweb/libresolver/dist/util.js";
|
||||||
|
export * from "@lumeweb/libresolver/dist/types.js";
|
||||||
|
export { AbstractResolverModule } from "@lumeweb/libresolver/dist/resolverModule.js";
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { addHandler, handleMessage } from "libkmodule";
|
||||||
|
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
|
||||||
|
import { dnsClient } from "./client.js";
|
||||||
|
let resolver;
|
||||||
|
export function setup(rm) {
|
||||||
|
addHandler("resolve", handleResolve);
|
||||||
|
addHandler("register", handleRegister);
|
||||||
|
addHandler("getSupportedTlds", handleGetSupportedTlds);
|
||||||
|
onmessage = handleMessage;
|
||||||
|
resolver = rm;
|
||||||
|
// @ts-ignore
|
||||||
|
resolver.resolver = dnsClient;
|
||||||
|
}
|
||||||
|
async function handleRegister(aq) {
|
||||||
|
await dnsClient.register();
|
||||||
|
aq.respond();
|
||||||
|
}
|
||||||
|
async function handleResolve(aq) {
|
||||||
|
if (!("domain" in aq.callerInput)) {
|
||||||
|
aq.reject("domain required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let ret;
|
||||||
|
try {
|
||||||
|
ret = await resolver.resolve(aq.callerInput.domain, aq.callerInput?.options ?? { type: DNS_RECORD_TYPE.CONTENT }, aq.callerInput?.bypassCache || false);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
aq.reject(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ret.error) {
|
||||||
|
aq.reject(ret.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
aq.respond(ret);
|
||||||
|
}
|
||||||
|
function handleGetSupportedTlds(aq) {
|
||||||
|
aq.respond(resolver.getSupportedTlds());
|
||||||
|
}
|
||||||
|
export * from "@lumeweb/libresolver/dist/util.js";
|
||||||
|
export * from "@lumeweb/libresolver/dist/types.js";
|
||||||
|
export { AbstractResolverModule } from "@lumeweb/libresolver/dist/resolverModule.js";
|
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
|
@ -1,31 +1,19 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/kernel-libresolver",
|
"name": "@lumeweb/kernel-libresolver",
|
||||||
"version": "0.1.0-develop.10",
|
"version": "0.1.0",
|
||||||
"main": "lib/index.js",
|
"main": "dist/index.js",
|
||||||
"type": "module",
|
"dependencies": {
|
||||||
"repository": {
|
"@lumeweb/kernel-dns-client": "git+https://git.lumeweb.com/LumeWeb/kernel-dns-client.git",
|
||||||
"type": "git",
|
"@lumeweb/kernel-libresolver": "git+https://git.lumeweb.com/LumeWeb/kernel-libresolver.git",
|
||||||
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-libresolver.git"
|
"@lumeweb/kernel-rpc-client": "git+https://git.lumeweb.com/LumeWeb/kernel-rpc-client.git",
|
||||||
|
"@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
|
||||||
|
"@lumeweb/libresolver": "git+https://git.lumeweb.com/LumeWeb/libresolver.git",
|
||||||
|
"libkmodule": "^0.2.53"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@lumeweb/node-library-preset": "^0.2.7",
|
"@lumeweb/relay-types": "git+https://git.lumeweb.com/LumeWeb/relay-types.git",
|
||||||
"presetter": "*"
|
"@types/node": "^18.14.0",
|
||||||
},
|
"prettier": "^2.8.4",
|
||||||
"readme": "ERROR: No README data found!",
|
"typescript": "^4.9.5"
|
||||||
"scripts": {
|
|
||||||
"prepare": "presetter bootstrap",
|
|
||||||
"build": "run build",
|
|
||||||
"semantic-release": "semantic-release"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@lumeweb/kernel-dns-client": "^0.1.0-develop.7",
|
|
||||||
"@lumeweb/libkernel": "^0.1.0-develop.62",
|
|
||||||
"@lumeweb/libresolver": "^0.1.0-develop.1"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
45
src/index.ts
45
src/index.ts
|
@ -1,20 +1,33 @@
|
||||||
import {
|
import { addHandler, ActiveQuery, handleMessage } from "libkmodule";
|
||||||
addHandler,
|
|
||||||
ActiveQuery,
|
|
||||||
handleMessage,
|
|
||||||
} from "@lumeweb/libkernel/module";
|
|
||||||
|
|
||||||
import type { DNSResult } from "@lumeweb/libresolver";
|
import type {
|
||||||
|
DNSResult,
|
||||||
|
ResolverModule as ResolverModuleBase,
|
||||||
|
} from "@lumeweb/libresolver";
|
||||||
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
|
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
|
||||||
import { dnsClient } from "./client.js";
|
import { dnsClient } from "./client.js";
|
||||||
import { ResolverModule } from "@lumeweb/kernel-dns-client";
|
import { DnsClient } from "@lumeweb/kernel-dns-client";
|
||||||
|
import { ResolverOptions } from "@lumeweb/libresolver/src/types.js";
|
||||||
|
|
||||||
let resolver: ResolverModule;
|
let resolver: ResolverModule | ResolverModuleBase;
|
||||||
|
|
||||||
export function setup(rm: ResolverModule) {
|
export interface ResolverModule {
|
||||||
|
get resolver(): DnsClient;
|
||||||
|
set resolver(value: DnsClient);
|
||||||
|
resolve(
|
||||||
|
domain: string,
|
||||||
|
options: ResolverOptions,
|
||||||
|
bypassCache: boolean
|
||||||
|
): Promise<DNSResult>;
|
||||||
|
|
||||||
|
getSupportedTlds(): string[];
|
||||||
|
getSupportedTlds(): Promise<string[]>;
|
||||||
|
getSupportedTlds(): any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setup(rm: ResolverModule | ResolverModuleBase) {
|
||||||
addHandler("resolve", handleResolve);
|
addHandler("resolve", handleResolve);
|
||||||
addHandler("register", handleRegister);
|
addHandler("register", handleRegister);
|
||||||
addHandler("ready", handleReady);
|
|
||||||
addHandler("getSupportedTlds", handleGetSupportedTlds);
|
addHandler("getSupportedTlds", handleGetSupportedTlds);
|
||||||
onmessage = handleMessage;
|
onmessage = handleMessage;
|
||||||
resolver = rm;
|
resolver = rm;
|
||||||
|
@ -38,7 +51,7 @@ async function handleResolve(aq: ActiveQuery) {
|
||||||
ret = await resolver.resolve(
|
ret = await resolver.resolve(
|
||||||
aq.callerInput.domain,
|
aq.callerInput.domain,
|
||||||
aq.callerInput?.options ?? { type: DNS_RECORD_TYPE.CONTENT },
|
aq.callerInput?.options ?? { type: DNS_RECORD_TYPE.CONTENT },
|
||||||
aq.callerInput?.bypassCache || false,
|
aq.callerInput?.bypassCache || false
|
||||||
);
|
);
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
aq.reject(e);
|
aq.reject(e);
|
||||||
|
@ -57,10 +70,6 @@ function handleGetSupportedTlds(aq: ActiveQuery) {
|
||||||
aq.respond(resolver.getSupportedTlds());
|
aq.respond(resolver.getSupportedTlds());
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleReady(aq: ActiveQuery) {
|
export * from "@lumeweb/libresolver/dist/util.js";
|
||||||
aq.respond(await resolver.ready());
|
export * from "@lumeweb/libresolver/dist/types.js";
|
||||||
}
|
export { AbstractResolverModule } from "@lumeweb/libresolver/dist/resolverModule.js";
|
||||||
|
|
||||||
export * from "@lumeweb/libresolver/lib/util.js";
|
|
||||||
export * from "@lumeweb/libresolver/lib/types.js";
|
|
||||||
export { AbstractResolverModule } from "@lumeweb/libresolver/lib/resolverModule.js";
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "esnext",
|
||||||
|
"declaration": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": "./dist",
|
||||||
|
"strict": true,
|
||||||
|
"allowSyntheticDefaultImports": true
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["node_modules", "**/__tests__/*"]
|
||||||
|
}
|
Loading…
Reference in New Issue