Compare commits

..

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

14 changed files with 146 additions and 18428 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,25 +0,0 @@
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/kernel-dns-client/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-04)
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/kernel-dns-client/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-09-03)
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/kernel-dns-client/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-09-02)
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/kernel-dns-client/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-dns-client/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-24)
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/kernel-dns-client/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-dns-client/compare/v0.0.2-develop.1...v0.1.0-develop.1) (2023-07-15)
### Features
* add ready method to ResolverModule ([62b7fb0](https://git.lumeweb.com/LumeWeb/kernel-dns-client/commit/62b7fb0292c82f28b134710770f550054bbbbc81))
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/kernel-dns-client/compare/v0.0.1...v0.0.2-develop.1) (2023-07-05)
### Reverts
* Revert "*Update register to use loadBound" ([b856cf1](https://git.lumeweb.com/LumeWeb/kernel-dns-client/commit/b856cf16d2e4e70b9e4e6d6ff6d6f4351a68177e))

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

@ -0,0 +1,17 @@
import { Client } from "@lumeweb/libkernel-universal";
import { DNSResult, ResolverOptions } from "@lumeweb/libresolver";
import { ResolverModule } from "./module.js";
export declare class DnsClient extends Client {
get resolvers(): Promise<Set<ResolverModule>>;
register(): Promise<void>;
registerResolver(module: string): Promise<void>;
clear(): Promise<void>;
resolve(
domain: string,
options?: ResolverOptions,
bypassCache?: boolean
): Promise<DNSResult>;
}
export declare const createClient: (...args: any) => DnsClient;
export * from "./module.js";
//# sourceMappingURL=index.d.ts.map

1
dist/index.d.ts.map vendored Normal file
View File

@ -0,0 +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;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"}

29
dist/index.js vendored Normal file
View File

@ -0,0 +1,29 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
import { DNS_RECORD_TYPE, } from "@lumeweb/libresolver";
import { createModule } from "./module.js";
const MODULE = "vAA-phmM1ztqu8zGBKF2nM3b8N_IQGWlB6J_doi2FhqS-A";
export class DnsClient extends Client {
get resolvers() {
return this.callModuleReturn("getResolvers").then((resolvers) => {
return new Set(resolvers.map((resolver) => {
return createModule(resolver, this);
}));
});
}
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 });
}
}
export const createClient = factory(DnsClient, MODULE);
export * from "./module.js";

21
dist/module.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
import { Client } from "@lumeweb/libkernel-universal";
import { DnsClient } from "./index.js";
import { DNSResult, ResolverOptions } from "@lumeweb/libresolver";
export declare class ResolverModule extends Client {
private domain;
constructor(domain: string, resolver?: DnsClient);
private _resolver?;
get resolver(): DnsClient;
set resolver(value: DnsClient);
resolve(
domain: string,
options: ResolverOptions,
bypassCache: boolean
): Promise<DNSResult>;
getSupportedTlds(): Promise<string[]>;
}
export declare const createModule: (
module: string,
client: DnsClient
) => ResolverModule;
//# sourceMappingURL=module.d.ts.map

1
dist/module.d.ts.map vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACL,SAAS,EAET,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,cAAe,SAAQ,MAAM;IACxC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS;IAMhD,OAAO,CAAC,SAAS,CAAC,CAAY;IAE9B,IAAI,QAAQ,IAAI,SAAS,CAExB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,SAAS,EAE5B;IAEK,OAAO,CACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,SAAS,CAAC;IAWf,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG5C;AAED,eAAO,MAAM,YAAY,WACf,MAAM,UACN,SAAS,KAChB,cAC8D,CAAC"}

33
dist/module.js vendored Normal file
View File

@ -0,0 +1,33 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
import { resolverError, } from "@lumeweb/libresolver";
export class ResolverModule extends Client {
domain;
constructor(domain, resolver) {
super();
this._resolver = resolver;
this.domain = domain;
}
_resolver;
get resolver() {
return this._resolver;
}
set resolver(value) {
this._resolver = value;
}
async resolve(domain, options, bypassCache) {
try {
return this.callModuleReturn("resolve", {
domain,
options,
bypassCache,
});
}
catch (e) {
return resolverError(e);
}
}
async getSupportedTlds() {
return this.callModuleReturn("getSupportedTlds");
}
}
export const createModule = (module, client) => factory(ResolverModule, module)(module, client);

18347
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,18 @@
{ {
"name": "@lumeweb/kernel-dns-client", "name": "@lumeweb/kernel-dns-client",
"version": "0.1.0-develop.7", "version": "0.1.0",
"type": "module", "type": "module",
"main": "lib/index.js", "main": "dist/index.js",
"repository": { "dependencies": {
"type": "git", "@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-dns-client.git" "@lumeweb/libresolver": "git+https://git.lumeweb.com/LumeWeb/libresolver.git",
"libkernel": "^0.1.43",
"libkmodule": "^0.2.44",
"libskynet": "^0.0.62"
}, },
"devDependencies": { "devDependencies": {
"@lumeweb/node-library-preset": "^0.2.7", "@types/node": "^18.0.6",
"presetter": "*" "prettier": "^2.7.1",
}, "typescript": "^4.9.5"
"readme": "ERROR: No README data found!",
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/libkernel": "^0.1.0-develop.44",
"@lumeweb/libresolver": "^0.1.0-develop.1"
},
"files": [
"lib"
],
"publishConfig": {
"access": "public"
} }
} }

View File

@ -1,4 +1,4 @@
import { Client, factory } from "@lumeweb/libkernel/module"; import { Client, factory } from "@lumeweb/libkernel-universal";
import { import {
DNS_RECORD_TYPE, DNS_RECORD_TYPE,
DNSResult, DNSResult,
@ -6,7 +6,7 @@ import {
} from "@lumeweb/libresolver"; } from "@lumeweb/libresolver";
import { createModule, ResolverModule } from "./module.js"; import { createModule, ResolverModule } from "./module.js";
const MODULE = "zdiN14h2ecmQ27hMFiL9ZrH2ZbE6s3ZbUJ7L1gDZiXazdRie9Sa5uRRpvb"; const MODULE = "vAA-phmM1ztqu8zGBKF2nM3b8N_IQGWlB6J_doi2FhqS-A";
export class DnsClient extends Client { export class DnsClient extends Client {
get resolvers(): Promise<Set<ResolverModule>> { get resolvers(): Promise<Set<ResolverModule>> {
@ -14,7 +14,7 @@ export class DnsClient extends Client {
return new Set( return new Set(
resolvers.map((resolver: string): ResolverModule => { resolvers.map((resolver: string): ResolverModule => {
return createModule(resolver, this); return createModule(resolver, this);
}), })
); );
}); });
} }
@ -24,7 +24,7 @@ export class DnsClient extends Client {
} }
public async registerResolver(module: string): Promise<void> { public async registerResolver(module: string): Promise<void> {
const bag = await this.getBound(module); const bag = await this.loadBound(module);
const ret = await bag.callModule("register"); const ret = await bag.callModule("register");
return ret[0]; return ret[0];
} }
@ -36,7 +36,7 @@ export class DnsClient extends Client {
public async resolve( public async resolve(
domain: string, domain: string,
options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT }, options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT },
bypassCache: boolean = false, bypassCache: boolean = false
): Promise<DNSResult> { ): Promise<DNSResult> {
return this.callModuleReturn("resolve", { domain, options, bypassCache }); return this.callModuleReturn("resolve", { domain, options, bypassCache });
} }

View File

@ -1,4 +1,4 @@
import { Client, factory } from "@lumeweb/libkernel/module"; import { Client, factory } from "@lumeweb/libkernel-universal";
import { DnsClient } from "./index.js"; import { DnsClient } from "./index.js";
import { import {
DNSResult, DNSResult,
@ -9,8 +9,8 @@ import {
export class ResolverModule extends Client { export class ResolverModule extends Client {
private domain: string; private domain: string;
constructor(module: string, domain: string, resolver?: DnsClient) { constructor(domain: string, resolver?: DnsClient) {
super(module); super();
this._resolver = resolver; this._resolver = resolver;
this.domain = domain; this.domain = domain;
} }
@ -28,7 +28,7 @@ export class ResolverModule extends Client {
async resolve( async resolve(
domain: string, domain: string,
options: ResolverOptions, options: ResolverOptions,
bypassCache: boolean, bypassCache: boolean
): Promise<DNSResult> { ): Promise<DNSResult> {
try { try {
return this.callModuleReturn("resolve", { return this.callModuleReturn("resolve", {
@ -40,18 +40,13 @@ export class ResolverModule extends Client {
return resolverError(e as Error); return resolverError(e as Error);
} }
} }
async getSupportedTlds(): Promise<string[]> { async getSupportedTlds(): Promise<string[]> {
return this.callModuleReturn("getSupportedTlds"); return this.callModuleReturn("getSupportedTlds");
} }
async ready(): Promise<any> {
return this.callModuleReturn("ready");
}
} }
export const createModule = ( export const createModule = (
module: string, module: string,
client: DnsClient, client: DnsClient
): ResolverModule => ): ResolverModule =>
factory<ResolverModule>(ResolverModule, module)(module, client); factory<ResolverModule>(ResolverModule, module)(module, client);

23
tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"declaration": true,
"strict": true,
"module": "esnext",
"target": "esnext",
"esModuleInterop": true,
"sourceMap": false,
"rootDir": "src",
"outDir": "dist",
"typeRoots": [
"node_modules/@types",
],
"moduleResolution": "node",
"declarationMap": true,
"declarationDir": "dist",
"emitDeclarationOnly": false,
"allowJs": true
},
"include": [
"src"
]
}