Compare commits

...

9 Commits

7 changed files with 18012 additions and 33 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"
]
}

1
CHANGELOG.md Normal file
View File

@ -0,0 +1 @@
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/protomux-rpc-web/compare/v0.0.1...v0.0.2-develop.1) (2023-07-04)

17964
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,29 @@
{
"name": "@lumeweb/protomux-rpc-web",
"version": "0.1.0",
"version": "0.0.2-develop.1",
"type": "module",
"dependencies": {
"bits-to-bytes": "^1.3.0",
"compact-encoding": "^2.11.0",
"compact-encoding-bitfield": "^1.0.0",
"events": "^3.3.0",
"protomux": "^3.4.1"
},
"main": "lib/index.js",
"devDependencies": {
"@types/node": "^18.15.11",
"prettier": "^2.8.7",
"typescript": "^5.0.4"
"@lumeweb/node-library-preset": "^0.2.7",
"presetter": "*"
},
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/protomux-rpc-web.git"
},
"readme": "ERROR: No README data found!",
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/kernel-protomux-client": "^0.0.2-develop.1"
},
"files": [
"lib"
],
"publishConfig": {
"access": "public"
}
}

View File

@ -1,13 +1,11 @@
import EventEmitter from "events";
// @ts-ignore
import Protomux from "protomux";
import Protomux from "@lumeweb/kernel-protomux-client";
// @ts-ignore
import c from "compact-encoding";
// @ts-ignore
import bitfield from "compact-encoding-bitfield";
// @ts-ignore
import bits from "bits-to-bytes";
import * as buffer from "buffer";
export default class ProtomuxRPC extends EventEmitter {
private _id: number;
@ -80,9 +78,7 @@ export default class ProtomuxRPC extends EventEmitter {
onmessage: this._onresponse.bind(this),
});
this._channel.open(options?.handshake);
await this._channel.ready;
await this._channel.open(options?.handshake);
}
_onopen(handshake: any) {
@ -115,12 +111,13 @@ export default class ProtomuxRPC extends EventEmitter {
method: string;
value: any;
}) {
let error = null;
let error: string | null = null;
const responder = this._responders.get(method);
if (responder === undefined) error = `unknown method '${method}'`;
else {
if (responder === undefined) {
error = `unknown method '${method}'`;
} else {
const {
valueEncoding = this._defaultValueEncoding,
requestEncoding = valueEncoding,

View File

@ -1,13 +0,0 @@
{
"compilerOptions": {
"target": "esnext",
"declaration": true,
"moduleResolution": "node",
"outDir": "./dist",
"strict": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"include": ["src"],
"exclude": ["node_modules", "**/__tests__/*"]
}