Compare commits
No commits in common. "develop" and "master" have entirely different histories.
|
@ -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
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"preset": [
|
|
||||||
"@lumeweb/node-library-preset"
|
|
||||||
]
|
|
||||||
}
|
|
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,14 +0,0 @@
|
||||||
## [0.0.2-develop.5](https://git.lumeweb.com/LumeWeb/rpc/compare/v0.0.2-develop.4...v0.0.2-develop.5) (2023-07-23)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* add setKeepAlive ([a72f55c](https://git.lumeweb.com/LumeWeb/rpc/commit/a72f55c888617cd12c97f173b0c31518dddff627))
|
|
||||||
|
|
||||||
## [0.0.2-develop.4](https://git.lumeweb.com/LumeWeb/rpc/compare/v0.0.2-develop.3...v0.0.2-develop.4) (2023-07-23)
|
|
||||||
|
|
||||||
## [0.0.2-develop.3](https://git.lumeweb.com/LumeWeb/rpc/compare/v0.0.2-develop.2...v0.0.2-develop.3) (2023-07-05)
|
|
||||||
|
|
||||||
## [0.0.2-develop.2](https://git.lumeweb.com/LumeWeb/rpc/compare/v0.0.2-develop.1...v0.0.2-develop.2) (2023-07-04)
|
|
||||||
|
|
||||||
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/rpc/compare/v0.0.1...v0.0.2-develop.1) (2023-07-01)
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
import ProtomuxRPC from "protomux-rpc";
|
||||||
|
export default class RPC extends ProtomuxRPC {
|
||||||
|
constructor(stream: any, options?: {});
|
||||||
|
request(method: any, value?: any | string, options?: {}): Promise<any>;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=index.d.ts.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,cAAc,CAAC;AAOvC,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,WAAW;gBAC9B,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK;IAW/B,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,GAAE,GAAG,GAAG,MAAW,EAAE,OAAO,KAAK;CAGlE"}
|
|
@ -0,0 +1,21 @@
|
||||||
|
// @ts-ignore
|
||||||
|
import ProtomuxRPC from "protomux-rpc";
|
||||||
|
// @ts-ignore
|
||||||
|
import c from "compact-encoding";
|
||||||
|
import b4a from "b4a";
|
||||||
|
const ID = b4a.from("lumeweb");
|
||||||
|
export default class RPC extends ProtomuxRPC {
|
||||||
|
constructor(stream, options = {}) {
|
||||||
|
options = {
|
||||||
|
...{
|
||||||
|
id: ID,
|
||||||
|
valueEncoding: c.json,
|
||||||
|
},
|
||||||
|
...options,
|
||||||
|
};
|
||||||
|
super(stream, options);
|
||||||
|
}
|
||||||
|
async request(method, value = "", options = {}) {
|
||||||
|
return super.request(method, value, options);
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
|
@ -1,30 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/rpc",
|
"name": "@lumeweb/rpc",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.2-develop.5",
|
"version": "0.1.0",
|
||||||
"main": "lib/index.js",
|
"main": "dist/index.js",
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "gitea@git.lumeweb.com:LumeWeb/rpc.git"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"compact-encoding": "2.12.0",
|
"compact-encoding": "^2.11.0",
|
||||||
"protomux-rpc": "1.4.1"
|
"protomux-rpc": "^1.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@lumeweb/node-library-preset": "^0.2.7",
|
"@types/b4a": "^1.6.0",
|
||||||
"presetter": "*"
|
"prettier": "^2.8.0"
|
||||||
},
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "presetter bootstrap",
|
|
||||||
"build": "run build",
|
|
||||||
"semantic-release": "semantic-release"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib/**"
|
|
||||||
],
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
29
src/index.ts
29
src/index.ts
|
@ -1,3 +1,4 @@
|
||||||
|
// @ts-ignore
|
||||||
import ProtomuxRPC from "protomux-rpc";
|
import ProtomuxRPC from "protomux-rpc";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import c from "compact-encoding";
|
import c from "compact-encoding";
|
||||||
|
@ -6,8 +7,6 @@ import b4a from "b4a";
|
||||||
const ID = b4a.from("lumeweb");
|
const ID = b4a.from("lumeweb");
|
||||||
|
|
||||||
export default class RPC extends ProtomuxRPC {
|
export default class RPC extends ProtomuxRPC {
|
||||||
private _ready: Promise<void>;
|
|
||||||
|
|
||||||
constructor(stream: any, options = {}) {
|
constructor(stream: any, options = {}) {
|
||||||
options = {
|
options = {
|
||||||
...{
|
...{
|
||||||
|
@ -17,35 +16,9 @@ export default class RPC extends ProtomuxRPC {
|
||||||
...options,
|
...options,
|
||||||
};
|
};
|
||||||
super(stream, options);
|
super(stream, options);
|
||||||
|
|
||||||
this._ready = new Promise((resolve, reject) => {
|
|
||||||
stream.on("open", onopen);
|
|
||||||
stream.on("destroy", ondestroy);
|
|
||||||
|
|
||||||
function onopen(handshake) {
|
|
||||||
removeListener();
|
|
||||||
resolve(handshake);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ondestroy() {
|
|
||||||
removeListener();
|
|
||||||
reject(new Error("Client could not connect"));
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeListener() {
|
|
||||||
stream.off("open", onopen);
|
|
||||||
stream.off("destroy", ondestroy);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
stream.setKeepAlive(5000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async request(method: any, value: any | string = "", options = {}) {
|
async request(method: any, value: any | string = "", options = {}) {
|
||||||
return super.request(method, value, options);
|
return super.request(method, value, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
get ready(): Promise<void> {
|
|
||||||
return this._ready;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue