Compare commits
33 Commits
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 53bc0a9fc5 | |
Derrick Hammer | 5aec957be2 | |
semantic-release-bot | c87eb3d36e | |
Derrick Hammer | 9ca2b44fc5 | |
Derrick Hammer | 571b65135a | |
semantic-release-bot | b3baa80dd0 | |
Derrick Hammer | df25afd000 | |
Derrick Hammer | c225edd2f3 | |
semantic-release-bot | 43c4810e8a | |
Derrick Hammer | 4a32e3dd72 | |
Derrick Hammer | 39f9250201 | |
semantic-release-bot | b491b25e30 | |
Derrick Hammer | 7406fa2596 | |
Derrick Hammer | 12522ca10e | |
semantic-release-bot | 4db427ce2b | |
Derrick Hammer | 1ef420ee15 | |
Derrick Hammer | f22107f501 | |
semantic-release-bot | 56e889bdcb | |
Derrick Hammer | 2e6857fae7 | |
Derrick Hammer | f7f8e553c4 | |
semantic-release-bot | 50d491fe38 | |
Derrick Hammer | c08fd5bf02 | |
semantic-release-bot | 89c5c6f6c2 | |
Derrick Hammer | 4c698eb4b5 | |
semantic-release-bot | 7f61f0666a | |
Derrick Hammer | 0d8d04b5d1 | |
Derrick Hammer | c329921aa4 | |
Derrick Hammer | 9fa4e3eb12 | |
semantic-release-bot | fe220ee0e5 | |
Derrick Hammer | 9ca41e3261 | |
semantic-release-bot | 533b8a32d5 | |
Derrick Hammer | 2445de5711 | |
Derrick Hammer | fb6b5c4b52 |
|
@ -0,0 +1,13 @@
|
||||||
|
name: Build/Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- develop-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
main:
|
||||||
|
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||||
|
secrets: inherit
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"preset": [
|
||||||
|
"@lumeweb/node-library-preset"
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
# [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)
|
|
@ -1 +0,0 @@
|
||||||
export declare const dnsClient: import("@lumeweb/kernel-dns-client").DnsClient;
|
|
|
@ -1,2 +0,0 @@
|
||||||
import { createClient } from "@lumeweb/kernel-dns-client";
|
|
||||||
export const dnsClient = createClient();
|
|
|
@ -1,22 +0,0 @@
|
||||||
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";
|
|
|
@ -1,42 +0,0 @@
|
||||||
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,19 +1,31 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/kernel-libresolver",
|
"name": "@lumeweb/kernel-libresolver",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0-develop.10",
|
||||||
"main": "dist/index.js",
|
"main": "lib/index.js",
|
||||||
"dependencies": {
|
"type": "module",
|
||||||
"@lumeweb/kernel-dns-client": "git+https://git.lumeweb.com/LumeWeb/kernel-dns-client.git",
|
"repository": {
|
||||||
"@lumeweb/kernel-libresolver": "git+https://git.lumeweb.com/LumeWeb/kernel-libresolver.git",
|
"type": "git",
|
||||||
"@lumeweb/kernel-rpc-client": "git+https://git.lumeweb.com/LumeWeb/kernel-rpc-client.git",
|
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-libresolver.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/relay-types": "git+https://git.lumeweb.com/LumeWeb/relay-types.git",
|
"@lumeweb/node-library-preset": "^0.2.7",
|
||||||
"@types/node": "^18.14.0",
|
"presetter": "*"
|
||||||
"prettier": "^2.8.4",
|
},
|
||||||
"typescript": "^4.9.5"
|
"readme": "ERROR: No README data found!",
|
||||||
|
"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,33 +1,20 @@
|
||||||
import { addHandler, ActiveQuery, handleMessage } from "libkmodule";
|
import {
|
||||||
|
addHandler,
|
||||||
|
ActiveQuery,
|
||||||
|
handleMessage,
|
||||||
|
} from "@lumeweb/libkernel/module";
|
||||||
|
|
||||||
import type {
|
import type { DNSResult } from "@lumeweb/libresolver";
|
||||||
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 { DnsClient } from "@lumeweb/kernel-dns-client";
|
import { ResolverModule } from "@lumeweb/kernel-dns-client";
|
||||||
import { ResolverOptions } from "@lumeweb/libresolver/src/types.js";
|
|
||||||
|
|
||||||
let resolver: ResolverModule | ResolverModuleBase;
|
let resolver: ResolverModule;
|
||||||
|
|
||||||
export interface ResolverModule {
|
export function setup(rm: 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;
|
||||||
|
@ -51,7 +38,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);
|
||||||
|
@ -70,6 +57,10 @@ function handleGetSupportedTlds(aq: ActiveQuery) {
|
||||||
aq.respond(resolver.getSupportedTlds());
|
aq.respond(resolver.getSupportedTlds());
|
||||||
}
|
}
|
||||||
|
|
||||||
export * from "@lumeweb/libresolver/dist/util.js";
|
async function handleReady(aq: ActiveQuery) {
|
||||||
export * from "@lumeweb/libresolver/dist/types.js";
|
aq.respond(await resolver.ready());
|
||||||
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";
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "esnext",
|
|
||||||
"declaration": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"outDir": "./dist",
|
|
||||||
"strict": true,
|
|
||||||
"allowSyntheticDefaultImports": true
|
|
||||||
},
|
|
||||||
"include": ["src"],
|
|
||||||
"exclude": ["node_modules", "**/__tests__/*"]
|
|
||||||
}
|
|
Loading…
Reference in New Issue