Compare commits
9 Commits
v0.0.1
...
v0.0.2-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 5bbdbd8548 | |
Derrick Hammer | 2e7dadd19d | |
Derrick Hammer | 1fb9c77d55 | |
Derrick Hammer | 31ac340721 | |
Derrick Hammer | 2e98dd16d1 | |
Derrick Hammer | c459f1f0a3 | |
Derrick Hammer | 5b443ed66d | |
Derrick Hammer | 2d9272cd42 | |
Derrick Hammer | 9beb8f14b5 |
|
@ -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
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"preset": [
|
||||||
|
"@lumeweb/node-library-preset"
|
||||||
|
]
|
||||||
|
}
|
|
@ -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)
|
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
15
src/index.ts
15
src/index.ts
|
@ -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,
|
||||||
|
|
|
@ -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__/*"]
|
|
||||||
}
|
|
Loading…
Reference in New Issue