Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer e8e59421b8
*Add dist 2023-02-19 14:42:51 -05:00
Derrick Hammer bf72ae3695
*Initial version 2023-02-19 14:42:15 -05:00
7 changed files with 103 additions and 4 deletions

20
LICENSE
View File

@ -1,9 +1,21 @@
MIT License
Copyright (c) <year> <copyright holders>
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 in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

@ -0,0 +1,12 @@
import { Client } from "@lumeweb/libkernel-universal";
export interface Response {
id?: number;
error?: string;
result: any;
}
export declare class HandshakeClient extends Client {
ready(): Promise<void>;
query(method: string, params: any): Promise<Response>;
}
export declare const createClient: (...args: any) => HandshakeClient;
//# 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;AAI/D,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,GAAG,CAAC;CACb;AAED,qBAAa,eAAgB,SAAQ,MAAM;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAGnE;AAED,eAAO,MAAM,YAAY,mCAAoD,CAAC"}

11
dist/index.js vendored Normal file
View File

@ -0,0 +1,11 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
const MODULE = "AAAWj15-dWy44kfNabXtrcgt9Hae2klbZoHRK9bci5x2nQ";
export class HandshakeClient extends Client {
async ready() {
return this.callModuleReturn("ready");
}
async query(method, params) {
return this.callModuleReturn("query", { method, params });
}
}
export const createClient = factory(HandshakeClient, MODULE);

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "@lumeweb/kernel-handshake-client",
"version": "0.1.0",
"type": "module",
"main": "dist/index.js",
"dependencies": {
"@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
"@noble/hashes": "^1.2.0",
"@siaweb/libweb": "git+https://git.lumeweb.com/LumeWeb/libsiaweb.git",
"backoff.js": "^1.0.4",
"eventemitter3": "^5.0.0"
},
"devDependencies": {
"@types/node": "^18.13.0",
"prettier": "^2.8.4",
"pretty": "^2.0.0",
"typescript": "^4.9.5"
}
}

21
src/index.ts Normal file
View File

@ -0,0 +1,21 @@
import { Client, factory } from "@lumeweb/libkernel-universal";
const MODULE = "AAAWj15-dWy44kfNabXtrcgt9Hae2klbZoHRK9bci5x2nQ";
export interface Response {
id?: number;
error?: string;
result: any;
}
export class HandshakeClient extends Client {
public async ready(): Promise<void> {
return this.callModuleReturn("ready");
}
public async query(method: string, params: any): Promise<Response> {
return this.callModuleReturn("query", { method, params });
}
}
export const createClient = factory<HandshakeClient>(HandshakeClient, MODULE);

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