Compare commits
No commits in common. "v0.0.2-develop.1" and "v0.0.1" have entirely different histories.
v0.0.2-dev
...
v0.0.1
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -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)
|
|
File diff suppressed because it is too large
Load Diff
32
package.json
32
package.json
|
@ -1,29 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/protomux-rpc-web",
|
"name": "@lumeweb/protomux-rpc-web",
|
||||||
"version": "0.0.2-develop.1",
|
"version": "0.1.0",
|
||||||
"type": "module",
|
"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": {
|
"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": [
|
"devDependencies": {
|
||||||
"lib"
|
"@types/node": "^18.15.11",
|
||||||
],
|
"prettier": "^2.8.7",
|
||||||
"publishConfig": {
|
"typescript": "^5.0.4"
|
||||||
"access": "public"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
src/index.ts
15
src/index.ts
|
@ -1,11 +1,13 @@
|
||||||
import EventEmitter from "events";
|
import EventEmitter from "events";
|
||||||
import Protomux from "@lumeweb/kernel-protomux-client";
|
// @ts-ignore
|
||||||
|
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;
|
||||||
|
@ -78,7 +80,9 @@ export default class ProtomuxRPC extends EventEmitter {
|
||||||
onmessage: this._onresponse.bind(this),
|
onmessage: this._onresponse.bind(this),
|
||||||
});
|
});
|
||||||
|
|
||||||
await this._channel.open(options?.handshake);
|
this._channel.open(options?.handshake);
|
||||||
|
|
||||||
|
await this._channel.ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onopen(handshake: any) {
|
_onopen(handshake: any) {
|
||||||
|
@ -111,13 +115,12 @@ export default class ProtomuxRPC extends EventEmitter {
|
||||||
method: string;
|
method: string;
|
||||||
value: any;
|
value: any;
|
||||||
}) {
|
}) {
|
||||||
let error: string | null = null;
|
let error = null;
|
||||||
|
|
||||||
const responder = this._responders.get(method);
|
const responder = this._responders.get(method);
|
||||||
|
|
||||||
if (responder === undefined) {
|
if (responder === undefined) error = `unknown method '${method}'`;
|
||||||
error = `unknown method '${method}'`;
|
else {
|
||||||
} else {
|
|
||||||
const {
|
const {
|
||||||
valueEncoding = this._defaultValueEncoding,
|
valueEncoding = this._defaultValueEncoding,
|
||||||
requestEncoding = valueEncoding,
|
requestEncoding = valueEncoding,
|
||||||
|
|
|
@ -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__/*"]
|
||||||
|
}
|
Loading…
Reference in New Issue