Compare commits

...

14 Commits

Author SHA1 Message Date
semantic-release-bot 5f71c2e9e7 chore(release): 0.0.2-develop.5 [skip ci]
## [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](a72f55c888))
2023-07-23 18:09:21 +00:00
Derrick Hammer 7d0c447328
Merge remote-tracking branch 'origin/develop' into develop 2023-07-23 14:08:33 -04:00
Derrick Hammer a72f55c888
fix: add setKeepAlive 2023-07-23 14:08:18 -04:00
semantic-release-bot 3ff3c0a402 chore(release): 0.0.2-develop.4 [skip ci]
## [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)
2023-07-23 17:55:43 +00:00
Derrick Hammer d489f2d9a7
Merge remote-tracking branch 'origin/develop' into develop 2023-07-23 13:54:52 -04:00
Derrick Hammer b73edb9029
refactor: improve logic of ready promise 2023-07-23 13:54:42 -04:00
semantic-release-bot a85477adc8 chore(release): 0.0.2-develop.3 [skip ci]
## [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)
2023-07-05 01:30:18 +00:00
Derrick Hammer f7ae821bef
Merge remote-tracking branch 'origin/develop' into develop 2023-07-04 21:28:09 -04:00
Derrick Hammer 923f388891
dep: update protomux-rpc 2023-07-04 21:28:02 -04:00
semantic-release-bot 9c83c96f36 chore(release): 0.0.2-develop.2 [skip ci]
## [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)
2023-07-04 08:34:30 +00:00
Derrick Hammer 621a0f3cb0
Merge remote-tracking branch 'origin/develop' into develop 2023-07-04 04:33:25 -04:00
Derrick Hammer a92630172d
refactor: add ready getter that returns a promise hooked on the open event 2023-07-04 04:33:19 -04:00
semantic-release-bot 880794fe1a chore(release): 0.0.2-develop.1 [skip ci]
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/rpc/compare/v0.0.1...v0.0.2-develop.1) (2023-07-01)
2023-07-01 07:26:10 +00:00
Derrick Hammer d0f2c04819
refactor: update deps and use new ci process 2023-07-01 03:25:12 -04:00
10 changed files with 19256 additions and 58 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"
]
}

14
CHANGELOG.md Normal file
View File

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

6
dist/index.d.ts vendored
View File

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

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

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

21
dist/index.js vendored
View File

@ -1,21 +0,0 @@
// @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);
}
}

19174
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,30 @@
{
"name": "@lumeweb/rpc",
"type": "module",
"version": "0.1.0",
"main": "dist/index.js",
"version": "0.0.2-develop.5",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/rpc.git"
},
"dependencies": {
"compact-encoding": "^2.11.0",
"protomux-rpc": "^1.3.0"
"compact-encoding": "2.12.0",
"protomux-rpc": "1.4.1"
},
"devDependencies": {
"@types/b4a": "^1.6.0",
"prettier": "^2.8.0"
"@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"
},
"files": [
"lib/**"
],
"publishConfig": {
"access": "public"
}
}

View File

@ -1,4 +1,3 @@
// @ts-ignore
import ProtomuxRPC from "protomux-rpc";
// @ts-ignore
import c from "compact-encoding";
@ -7,6 +6,8 @@ import b4a from "b4a";
const ID = b4a.from("lumeweb");
export default class RPC extends ProtomuxRPC {
private _ready: Promise<void>;
constructor(stream: any, options = {}) {
options = {
...{
@ -16,9 +17,35 @@ export default class RPC extends ProtomuxRPC {
...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 = {}) {
return super.request(method, value, options);
}
get ready(): Promise<void> {
return this._ready;
}
}

View File

@ -1,23 +0,0 @@
{
"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"
]
}