Compare commits

...

46 Commits

Author SHA1 Message Date
semantic-release-bot 4bb0959bf1 chore(release): 0.0.2-develop.1 [skip ci]
## [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](b856cf16d2))
2023-07-05 09:37:17 +00:00
Derrick Hammer c762506f13
ci: setup 2023-07-05 05:33:35 -04:00
Derrick Hammer c9c7bfe498
refactor: move to new sdks 2023-07-05 05:33:18 -04:00
Derrick Hammer f1bbbf540d
*Update dist 2023-04-09 14:15:54 -04:00
Derrick Hammer 1e8924d5ac
*add registerResolver method 2023-04-09 14:15:40 -04:00
Derrick Hammer 7c3da38a15
*Update dist 2023-04-09 14:04:08 -04:00
Derrick Hammer 360beb9d69
*Update hash 2023-04-09 14:03:57 -04:00
Derrick Hammer c21e6910de
*Update dist 2023-04-01 14:31:18 -04:00
Derrick Hammer 44cdff4665
*Ready no longer exists 2023-04-01 14:31:01 -04:00
Derrick Hammer 614dc20900
*Update dist 2023-03-27 09:46:38 -04:00
Derrick Hammer f01738940f
*Update module hash 2023-03-27 09:46:13 -04:00
Derrick Hammer 8bd4e71424
*Update dist 2023-02-20 14:54:49 -05:00
Derrick Hammer 248d99f9ba
*Update module hash 2023-02-20 14:54:33 -05:00
Derrick Hammer b094b6ffe5
*Update dist 2023-02-19 21:16:21 -05:00
Derrick Hammer cf6435ef1e
*Update dist 2023-02-19 20:57:49 -05:00
Derrick Hammer 827505438d
*Refactor resolvers getter to return a Set of resolver client classes 2023-02-19 20:57:12 -05:00
Derrick Hammer 2bf62cbd3e
*add ResolverModule client class and factory 2023-02-19 20:49:06 -05:00
Derrick Hammer dd1b25aa30
*Update dist 2023-02-19 20:21:59 -05:00
Derrick Hammer f6a7322347
*Change getResolvers to a getter to match the real api 2023-02-19 20:21:41 -05:00
Derrick Hammer 10e01f44fa
*Update dist 2023-02-19 16:44:38 -05:00
Derrick Hammer 27dba64c45
*Fix resolve 2023-02-19 16:44:20 -05:00
Derrick Hammer d2735c5470
*Update dist 2023-02-19 16:42:13 -05:00
Derrick Hammer 63cec2129f
*Add resolve method 2023-02-19 16:42:03 -05:00
Derrick Hammer a0800a0feb
*Update dist 2023-02-19 16:35:34 -05:00
Derrick Hammer 5838b30141
*Fix return type 2023-02-19 16:35:19 -05:00
Derrick Hammer 69638955f1
*Update dist 2023-02-19 16:34:33 -05:00
Derrick Hammer 63cf33e617
*Fix getResolvers method 2023-02-19 16:34:18 -05:00
Derrick Hammer b856cf16d2
Revert "*Update register to use loadBound"
This reverts commit 096da60801.
2023-02-19 16:30:02 -05:00
Derrick Hammer 221ebe70c0
Revert "*Update dist"
This reverts commit e3697e8f5d.
2023-02-19 16:30:01 -05:00
Derrick Hammer e3697e8f5d
*Update dist 2023-02-19 16:27:37 -05:00
Derrick Hammer 096da60801
*Update register to use loadBound 2023-02-19 16:27:24 -05:00
Derrick Hammer 91b1c89bc4
*Update dist 2023-02-19 16:22:59 -05:00
Derrick Hammer 3f96c6d1de
*Update dist 2023-02-19 16:21:12 -05:00
Derrick Hammer 5a2c703afe
*rewrite for new system 2023-02-19 16:20:38 -05:00
Derrick Hammer 19caf515d5
*Update dist 2022-08-20 12:49:59 -04:00
Derrick Hammer 2f0e1fa4b8
*Set options to default to a content record type 2022-08-20 12:49:30 -04:00
Derrick Hammer 109ac99045
*Update dist 2022-08-18 19:45:51 -04:00
Derrick Hammer 32e2edaf6b
*add getResolvers method 2022-08-18 19:45:31 -04:00
Derrick Hammer f3fb63d2b8
*Update dist 2022-08-18 16:52:45 -04:00
Derrick Hammer b3942d8df8
*Remove buffer 2022-08-18 16:52:22 -04:00
Derrick Hammer 52821f43b6
*Update to new API and support registration of resolver modules 2022-08-18 16:51:48 -04:00
Derrick Hammer 1ba24bee76
*Update dist 2022-08-14 06:54:52 -04:00
Derrick Hammer 47dc0be026
*Add ready method 2022-08-14 06:54:39 -04:00
Derrick Hammer ac9cc4cf0d *Update dist 2022-07-21 13:22:02 -04:00
Derrick Hammer 25cefe8485 *Dynamically load libraries 2022-07-21 13:21:41 -04:00
Derrick Hammer d3be614120 *Initial version 2022-07-20 07:11:06 -04:00
8 changed files with 18543 additions and 1 deletions

13
.github/workflows/ci.yml vendored Normal file
View File

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

5
.presetterrc.json Normal file
View File

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

6
CHANGELOG.md Normal file
View File

@ -0,0 +1,6 @@
## [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))

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Lume Web
Copyright (c) 2022 Hammer Technologies LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

18390
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

30
package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "@lumeweb/kernel-dns-client",
"version": "0.0.2-develop.1",
"type": "module",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-dns-client.git"
},
"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/libkernel": "^0.1.0-develop.14",
"@lumeweb/libresolver": "^0.0.2-develop.1"
},
"files": [
"lib"
],
"publishConfig": {
"access": "public"
}
}

46
src/index.ts Normal file
View File

@ -0,0 +1,46 @@
import { Client, factory } from "@lumeweb/libkernel/module";
import {
DNS_RECORD_TYPE,
DNSResult,
ResolverOptions,
} from "@lumeweb/libresolver";
import { createModule, ResolverModule } from "./module.js";
const MODULE = "zduJC2T9pCyTnrYvEacy64LAufhjfpQdpz5sweUgDdGqy4u18LK6yvKLqM";
export class DnsClient extends Client {
get resolvers(): Promise<Set<ResolverModule>> {
return this.callModuleReturn("getResolvers").then((resolvers: string[]) => {
return new Set(
resolvers.map((resolver: string): ResolverModule => {
return createModule(resolver, this);
}),
);
});
}
public async register(): Promise<void> {
return this.callModuleReturn("register");
}
public async registerResolver(module: string): Promise<void> {
const bag = await this.getBound(module);
const ret = await bag.callModule("register");
return ret[0];
}
public async clear(): Promise<void> {
return this.callModuleReturn("clear");
}
public async resolve(
domain: string,
options: ResolverOptions = { type: DNS_RECORD_TYPE.CONTENT },
bypassCache: boolean = false,
): Promise<DNSResult> {
return this.callModuleReturn("resolve", { domain, options, bypassCache });
}
}
export const createClient = factory<DnsClient>(DnsClient, MODULE);
export * from "./module.js";

52
src/module.ts Normal file
View File

@ -0,0 +1,52 @@
import { Client, factory } from "@lumeweb/libkernel/module";
import { DnsClient } from "./index.js";
import {
DNSResult,
resolverError,
ResolverOptions,
} from "@lumeweb/libresolver";
export class ResolverModule extends Client {
private domain: string;
constructor(module: string, domain: string, resolver?: DnsClient) {
super(module);
this._resolver = resolver;
this.domain = domain;
}
private _resolver?: DnsClient;
get resolver(): DnsClient {
return this._resolver as DnsClient;
}
set resolver(value: DnsClient) {
this._resolver = value;
}
async resolve(
domain: string,
options: ResolverOptions,
bypassCache: boolean,
): Promise<DNSResult> {
try {
return this.callModuleReturn("resolve", {
domain,
options,
bypassCache,
});
} catch (e) {
return resolverError(e as Error);
}
}
async getSupportedTlds(): Promise<string[]> {
return this.callModuleReturn("getSupportedTlds");
}
}
export const createModule = (
module: string,
client: DnsClient,
): ResolverModule =>
factory<ResolverModule>(ResolverModule, module)(module, client);