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", "name": "@lumeweb/protomux-rpc-web",
"version": "0.1.0", "version": "0.0.2-develop.1",
"type": "module", "type": "module",
"dependencies": { "main": "lib/index.js",
"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"
},
"devDependencies": { "devDependencies": {
"@types/node": "^18.15.11", "@lumeweb/node-library-preset": "^0.2.7",
"prettier": "^2.8.7", "presetter": "*"
"typescript": "^5.0.4" },
"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"; import EventEmitter from "events";
// @ts-ignore import Protomux from "@lumeweb/kernel-protomux-client";
import Protomux from "protomux";
// @ts-ignore // @ts-ignore
import c from "compact-encoding"; import c from "compact-encoding";
// @ts-ignore // @ts-ignore
import bitfield from "compact-encoding-bitfield"; import bitfield from "compact-encoding-bitfield";
// @ts-ignore // @ts-ignore
import bits from "bits-to-bytes"; import bits from "bits-to-bytes";
import * as buffer from "buffer";
export default class ProtomuxRPC extends EventEmitter { export default class ProtomuxRPC extends EventEmitter {
private _id: number; private _id: number;
@ -80,9 +78,7 @@ export default class ProtomuxRPC extends EventEmitter {
onmessage: this._onresponse.bind(this), onmessage: this._onresponse.bind(this),
}); });
this._channel.open(options?.handshake); await this._channel.open(options?.handshake);
await this._channel.ready;
} }
_onopen(handshake: any) { _onopen(handshake: any) {
@ -115,12 +111,13 @@ export default class ProtomuxRPC extends EventEmitter {
method: string; method: string;
value: any; value: any;
}) { }) {
let error = null; let error: string | null = null;
const responder = this._responders.get(method); const responder = this._responders.get(method);
if (responder === undefined) error = `unknown method '${method}'`; if (responder === undefined) {
else { error = `unknown method '${method}'`;
} else {
const { const {
valueEncoding = this._defaultValueEncoding, valueEncoding = this._defaultValueEncoding,
requestEncoding = valueEncoding, 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__/*"]
}