starpc 0.36.3 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/srpc/mux.d.ts +2 -2
- package/dist/srpc/mux.js +4 -4
- package/dist/srpc/server.test.js +1 -1
- package/go.mod +8 -7
- package/go.sum +8 -8
- package/package.json +12 -12
- package/srpc/mux.ts +4 -4
- package/srpc/server.test.ts +1 -1
package/README.md
CHANGED
|
@@ -166,7 +166,7 @@ import { pushable } from 'it-pushable'
|
|
|
166
166
|
const mux = createMux()
|
|
167
167
|
const echoer = new EchoerServer()
|
|
168
168
|
mux.register(createHandler(EchoerDefinition, echoer))
|
|
169
|
-
const server = new Server(mux.
|
|
169
|
+
const server = new Server(mux.lookupMethod)
|
|
170
170
|
|
|
171
171
|
// Create the client connection to the server with an in-memory pipe.
|
|
172
172
|
const clientConn = new Conn()
|
package/dist/srpc/mux.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ export declare function createMux(): StaticMux;
|
|
|
7
7
|
export declare class StaticMux implements Mux {
|
|
8
8
|
private services;
|
|
9
9
|
private lookups;
|
|
10
|
-
get
|
|
10
|
+
get lookupMethod(): LookupMethod;
|
|
11
11
|
register(handler: Handler): void;
|
|
12
12
|
registerLookupMethod(lookupMethod: LookupMethod): void;
|
|
13
|
-
|
|
13
|
+
private _lookupMethod;
|
|
14
14
|
private lookupViaMap;
|
|
15
15
|
private lookupViaLookups;
|
|
16
16
|
}
|
package/dist/srpc/mux.js
CHANGED
|
@@ -10,9 +10,9 @@ export class StaticMux {
|
|
|
10
10
|
// lookups is the list of lookup methods to call.
|
|
11
11
|
// called if the method is not resolved by the services list.
|
|
12
12
|
lookups = [];
|
|
13
|
-
//
|
|
14
|
-
get
|
|
15
|
-
return this.
|
|
13
|
+
// lookupMethod implements the LookupMethod type.
|
|
14
|
+
get lookupMethod() {
|
|
15
|
+
return this._lookupMethod.bind(this);
|
|
16
16
|
}
|
|
17
17
|
register(handler) {
|
|
18
18
|
const serviceID = handler?.getServiceID();
|
|
@@ -30,7 +30,7 @@ export class StaticMux {
|
|
|
30
30
|
registerLookupMethod(lookupMethod) {
|
|
31
31
|
this.lookups.push(lookupMethod);
|
|
32
32
|
}
|
|
33
|
-
async
|
|
33
|
+
async _lookupMethod(serviceID, methodID) {
|
|
34
34
|
if (serviceID) {
|
|
35
35
|
const invokeFn = await this.lookupViaMap(serviceID, methodID);
|
|
36
36
|
if (invokeFn) {
|
package/dist/srpc/server.test.js
CHANGED
|
@@ -7,7 +7,7 @@ describe('srpc server', () => {
|
|
|
7
7
|
let client;
|
|
8
8
|
beforeEach(async () => {
|
|
9
9
|
const mux = createMux();
|
|
10
|
-
const server = new Server(mux.
|
|
10
|
+
const server = new Server(mux.lookupMethod);
|
|
11
11
|
const echoer = new EchoerServer(server);
|
|
12
12
|
mux.register(createHandler(EchoerDefinition, echoer));
|
|
13
13
|
// StreamConn is unnecessary since ChannelStream has packet framing.
|
package/go.mod
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module github.com/aperturerobotics/starpc
|
|
2
2
|
|
|
3
|
-
go 1.23
|
|
3
|
+
go 1.23.0
|
|
4
4
|
|
|
5
|
-
toolchain go1.
|
|
5
|
+
toolchain go1.24.0
|
|
6
6
|
|
|
7
7
|
replace (
|
|
8
8
|
// This fork uses go-protobuf-lite and adds post-quantum crypto support.
|
|
@@ -14,18 +14,19 @@ replace (
|
|
|
14
14
|
|
|
15
15
|
require (
|
|
16
16
|
github.com/aperturerobotics/protobuf-go-lite v0.8.0 // latest
|
|
17
|
-
github.com/aperturerobotics/util v1.
|
|
17
|
+
github.com/aperturerobotics/util v1.28.1 // latest
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
require (
|
|
21
21
|
github.com/coder/websocket v1.8.12 // latest
|
|
22
|
-
github.com/libp2p/go-libp2p v0.
|
|
23
|
-
github.com/libp2p/go-yamux/v4 v4.0.2-0.20240826150533-e92055b23e0e // master
|
|
22
|
+
github.com/libp2p/go-libp2p v0.41.0 // latest
|
|
24
23
|
github.com/pkg/errors v0.9.1 // latest
|
|
25
24
|
github.com/sirupsen/logrus v1.9.3 // latest
|
|
26
|
-
google.golang.org/protobuf v1.36.
|
|
25
|
+
google.golang.org/protobuf v1.36.5 // latest
|
|
27
26
|
)
|
|
28
27
|
|
|
28
|
+
require github.com/libp2p/go-yamux/v4 v4.0.1
|
|
29
|
+
|
|
29
30
|
require (
|
|
30
31
|
github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008 // indirect
|
|
31
32
|
github.com/ipfs/go-cid v0.4.1 // indirect
|
|
@@ -42,7 +43,7 @@ require (
|
|
|
42
43
|
github.com/multiformats/go-varint v0.0.7 // indirect
|
|
43
44
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
|
44
45
|
golang.org/x/crypto v0.31.0 // indirect
|
|
45
|
-
golang.org/x/exp v0.0.0-
|
|
46
|
+
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa // indirect
|
|
46
47
|
golang.org/x/sys v0.28.0 // indirect
|
|
47
48
|
lukechampine.com/blake3 v1.3.0 // indirect
|
|
48
49
|
)
|
package/go.sum
CHANGED
|
@@ -4,8 +4,8 @@ github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3
|
|
|
4
4
|
github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008/go.mod h1:snaApCEDtrHHP6UWSLKiYNOZU9A5NyzccKenx9oZEzg=
|
|
5
5
|
github.com/aperturerobotics/protobuf-go-lite v0.8.0 h1:SoiTAVArmOrNTX31e6CC5Bem6HuOElg3YYNhp4AAPQc=
|
|
6
6
|
github.com/aperturerobotics/protobuf-go-lite v0.8.0/go.mod h1:y49wVEezRHg78uQ2OzLLZbtTTWuox+ChmaTuh6FLJW8=
|
|
7
|
-
github.com/aperturerobotics/util v1.
|
|
8
|
-
github.com/aperturerobotics/util v1.
|
|
7
|
+
github.com/aperturerobotics/util v1.28.1 h1:FpTOt/tsawTrxDz4lrdglK47ZR2p0UM+GBB3zHhSUsc=
|
|
8
|
+
github.com/aperturerobotics/util v1.28.1/go.mod h1:tFCW8S1eUGvEohv9IebTxq5bgVZNfaKGLV9ELa6iKbI=
|
|
9
9
|
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
|
|
10
10
|
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
|
11
11
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
@@ -21,8 +21,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6
|
|
|
21
21
|
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
|
|
22
22
|
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
|
|
23
23
|
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
|
|
24
|
-
github.com/libp2p/go-yamux/v4 v4.0.
|
|
25
|
-
github.com/libp2p/go-yamux/v4 v4.0.
|
|
24
|
+
github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ=
|
|
25
|
+
github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4=
|
|
26
26
|
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
|
|
27
27
|
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
|
|
28
28
|
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
|
@@ -55,14 +55,14 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
|
|
|
55
55
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
|
56
56
|
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
|
57
57
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
|
58
|
-
golang.org/x/exp v0.0.0-
|
|
59
|
-
golang.org/x/exp v0.0.0-
|
|
58
|
+
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4=
|
|
59
|
+
golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
|
|
60
60
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
61
61
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
62
62
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
|
63
63
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
64
|
-
google.golang.org/protobuf v1.36.
|
|
65
|
-
google.golang.org/protobuf v1.36.
|
|
64
|
+
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
|
65
|
+
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
|
66
66
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
67
67
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
68
68
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -80,26 +80,26 @@
|
|
|
80
80
|
"./{srpc,echo,e2e,integration,rpcstream,cmd}/**/(*.ts|*.tsx|*.html|*.css)": "prettier --config .prettierrc.yaml --write"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
84
|
-
"@typescript-eslint/parser": "^8.
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
|
84
|
+
"@typescript-eslint/parser": "^8.26.0",
|
|
85
85
|
"depcheck": "^1.4.6",
|
|
86
86
|
"esbuild": "^0.25.0",
|
|
87
|
-
"eslint": "^9.
|
|
88
|
-
"eslint-config-prettier": "^10.0.
|
|
87
|
+
"eslint": "^9.21.0",
|
|
88
|
+
"eslint-config-prettier": "^10.0.2",
|
|
89
89
|
"husky": "^9.1.7",
|
|
90
90
|
"lint-staged": "^15.4.3",
|
|
91
|
-
"prettier": "^3.5.
|
|
91
|
+
"prettier": "^3.5.3",
|
|
92
92
|
"rimraf": "^6.0.1",
|
|
93
|
-
"tsx": "^4.19.
|
|
94
|
-
"typescript": "^5.
|
|
95
|
-
"vitest": "^3.0.
|
|
93
|
+
"tsx": "^4.19.3",
|
|
94
|
+
"typescript": "^5.8.2",
|
|
95
|
+
"vitest": "^3.0.7"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@aptre/it-ws": "^1.0.1",
|
|
99
99
|
"@aptre/protobuf-es-lite": "^0.4.6",
|
|
100
100
|
"@chainsafe/libp2p-yamux": "^7.0.1",
|
|
101
|
-
"@libp2p/interface": "^2.
|
|
102
|
-
"@libp2p/logger": "^5.1.
|
|
101
|
+
"@libp2p/interface": "^2.6.1",
|
|
102
|
+
"@libp2p/logger": "^5.1.11",
|
|
103
103
|
"event-iterator": "^2.0.0",
|
|
104
104
|
"isomorphic-ws": "^5.0.0",
|
|
105
105
|
"it-first": "^3.0.6",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"it-pushable": "^3.2.3",
|
|
108
108
|
"it-stream-types": "^2.0.2",
|
|
109
109
|
"uint8arraylist": "^2.4.7",
|
|
110
|
-
"ws": "^8.
|
|
110
|
+
"ws": "^8.18.1"
|
|
111
111
|
},
|
|
112
112
|
"resolutions": {
|
|
113
113
|
"@aptre/protobuf-es-lite": "0.4.8"
|
package/srpc/mux.ts
CHANGED
|
@@ -30,9 +30,9 @@ export class StaticMux implements Mux {
|
|
|
30
30
|
// called if the method is not resolved by the services list.
|
|
31
31
|
private lookups: LookupMethod[] = []
|
|
32
32
|
|
|
33
|
-
//
|
|
34
|
-
public get
|
|
35
|
-
return this.
|
|
33
|
+
// lookupMethod implements the LookupMethod type.
|
|
34
|
+
public get lookupMethod(): LookupMethod {
|
|
35
|
+
return this._lookupMethod.bind(this)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
public register(handler: Handler): void {
|
|
@@ -53,7 +53,7 @@ export class StaticMux implements Mux {
|
|
|
53
53
|
this.lookups.push(lookupMethod)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
private async _lookupMethod(
|
|
57
57
|
serviceID: string,
|
|
58
58
|
methodID: string,
|
|
59
59
|
): Promise<InvokeFn | null> {
|
package/srpc/server.test.ts
CHANGED
|
@@ -21,7 +21,7 @@ describe('srpc server', () => {
|
|
|
21
21
|
|
|
22
22
|
beforeEach(async () => {
|
|
23
23
|
const mux = createMux()
|
|
24
|
-
const server = new Server(mux.
|
|
24
|
+
const server = new Server(mux.lookupMethod)
|
|
25
25
|
const echoer = new EchoerServer(server)
|
|
26
26
|
mux.register(createHandler(EchoerDefinition, echoer))
|
|
27
27
|
|