*Initial version

This commit is contained in:
Derrick Hammer 2022-07-20 07:11:06 -04:00
parent 0440702514
commit d3be614120
7 changed files with 93 additions and 1 deletions

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

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

@ -0,0 +1,2 @@
export declare function resolve(domain: string, params: any, force?: boolean): Promise<any>;
//# 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":"AAsBA,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,UAAQ,gBAQvE"}

19
dist/index.js vendored Normal file
View File

@ -0,0 +1,19 @@
import { callModule as callModuleKernel, connectModule as connectModuleKernel, } from "libkernel";
import { callModule as callModuleModule, connectModule as connectModuleModule, } from "libkmodule";
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A";
let callModule, connectModule;
if (window.document) {
callModule = callModuleKernel;
connectModule = connectModuleKernel;
}
else {
callModule = callModuleModule;
connectModule = connectModuleModule;
}
export async function resolve(domain, params, force = false) {
const [resp, err] = await callModule(DNS_MODULE, "resolve", { domain, params, force });
if (err) {
throw new Error(err);
}
return resp;
}

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "@lumeweb/kernel-dns-client",
"version": "0.1.0",
"type": "module",
"main": "dist/index.js",
"dependencies": {
"buffer": "^6.0.3",
"libkernel": "^0.1.43",
"libkmodule": "^0.2.44",
"libskynet": "^0.0.62"
},
"devDependencies": {
"@types/node": "^18.0.6",
"prettier": "^2.7.1"
}
}

31
src/index.ts Normal file
View File

@ -0,0 +1,31 @@
import {
callModule as callModuleKernel,
connectModule as connectModuleKernel,
} from "libkernel";
import {
callModule as callModuleModule,
connectModule as connectModuleModule,
} from "libkmodule";
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A";
let callModule: typeof callModuleModule,
connectModule: typeof connectModuleModule;
if (window.document) {
callModule = callModuleKernel;
connectModule = connectModuleKernel;
} else {
callModule = callModuleModule;
connectModule = connectModuleModule;
}
export async function resolve(domain: string, params: any, force = false) {
const [resp, err] = await callModule(DNS_MODULE, "resolve", {domain, params, force});
if (err) {
throw new Error(err);
}
return resp;
}

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"
]
}