Compare commits

..

No commits in common. "v0.0.2-develop.1" and "v0.0.1" have entirely different histories.

7 changed files with 32 additions and 18011 deletions

View File

@ -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

View File

@ -1,5 +0,0 @@
{
"preset": [
"@lumeweb/node-library-preset"
]
}

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +1,17 @@
{
"name": "@lumeweb/protomux-rpc-web",
"version": "0.0.2-develop.1",
"version": "0.1.0",
"type": "module",
"main": "lib/index.js",
"devDependencies": {
"@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"
"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"
},
"files": [
"lib"
],
"publishConfig": {
"access": "public"
"devDependencies": {
"@types/node": "^18.15.11",
"prettier": "^2.8.7",
"typescript": "^5.0.4"
}
}

View File

@ -1,11 +1,13 @@
import EventEmitter from "events";
import Protomux from "@lumeweb/kernel-protomux-client";
// @ts-ignore
import Protomux from "protomux";
// @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;
@ -78,7 +80,9 @@ export default class ProtomuxRPC extends EventEmitter {
onmessage: this._onresponse.bind(this),
});
await this._channel.open(options?.handshake);
this._channel.open(options?.handshake);
await this._channel.ready;
}
_onopen(handshake: any) {
@ -111,13 +115,12 @@ export default class ProtomuxRPC extends EventEmitter {
method: string;
value: any;
}) {
let error: string | null = null;
let error = 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,

13
tsconfig.json Normal file
View File

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