Compare commits

..

No commits in common. "develop" and "master" have entirely different histories.

11 changed files with 119 additions and 18460 deletions

View File

@ -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

View File

@ -1,5 +0,0 @@
{
"preset": [
"@lumeweb/node-library-preset"
]
}

View File

@ -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)

1
dist/client.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare const dnsClient: import("@lumeweb/kernel-dns-client").DnsClient;

2
dist/client.js vendored Normal file
View File

@ -0,0 +1,2 @@
import { createClient } from "@lumeweb/kernel-dns-client";
export const dnsClient = createClient();

22
dist/index.d.ts vendored Normal file
View File

@ -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";

42
dist/index.js vendored Normal file
View File

@ -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";

18366
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +1,19 @@
{
"name": "@lumeweb/kernel-libresolver",
"version": "0.1.0-develop.10",
"main": "lib/index.js",
"type": "module",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-libresolver.git"
"version": "0.1.0",
"main": "dist/index.js",
"dependencies": {
"@lumeweb/kernel-dns-client": "git+https://git.lumeweb.com/LumeWeb/kernel-dns-client.git",
"@lumeweb/kernel-libresolver": "git+https://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": {
"@lumeweb/node-library-preset": "^0.2.7",
"presetter": "*"
},
"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"
"@lumeweb/relay-types": "git+https://git.lumeweb.com/LumeWeb/relay-types.git",
"@types/node": "^18.14.0",
"prettier": "^2.8.4",
"typescript": "^4.9.5"
}
}

View File

@ -1,20 +1,33 @@
import {
addHandler,
ActiveQuery,
handleMessage,
} from "@lumeweb/libkernel/module";
import { addHandler, ActiveQuery, handleMessage } from "libkmodule";
import type { DNSResult } from "@lumeweb/libresolver";
import type {
DNSResult,
ResolverModule as ResolverModuleBase,
} from "@lumeweb/libresolver";
import { DNS_RECORD_TYPE } from "@lumeweb/libresolver";
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("register", handleRegister);
addHandler("ready", handleReady);
addHandler("getSupportedTlds", handleGetSupportedTlds);
onmessage = handleMessage;
resolver = rm;
@ -38,7 +51,7 @@ async function handleResolve(aq: ActiveQuery) {
ret = await resolver.resolve(
aq.callerInput.domain,
aq.callerInput?.options ?? { type: DNS_RECORD_TYPE.CONTENT },
aq.callerInput?.bypassCache || false,
aq.callerInput?.bypassCache || false
);
} catch (e: any) {
aq.reject(e);
@ -57,10 +70,6 @@ function handleGetSupportedTlds(aq: ActiveQuery) {
aq.respond(resolver.getSupportedTlds());
}
async function handleReady(aq: ActiveQuery) {
aq.respond(await resolver.ready());
}
export * from "@lumeweb/libresolver/lib/util.js";
export * from "@lumeweb/libresolver/lib/types.js";
export { AbstractResolverModule } from "@lumeweb/libresolver/lib/resolverModule.js";
export * from "@lumeweb/libresolver/dist/util.js";
export * from "@lumeweb/libresolver/dist/types.js";
export { AbstractResolverModule } from "@lumeweb/libresolver/dist/resolverModule.js";

12
tsconfig.json Normal file
View File

@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "esnext",
"declaration": true,
"moduleResolution": "node",
"outDir": "./dist",
"strict": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
}