starpc 0.16.0 → 0.16.1

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.
@@ -8,6 +8,7 @@ export { Packet, CallStart, CallData } from './rpcproto.pb.js';
8
8
  export { Mux, StaticMux, createMux } from './mux.js';
9
9
  export { BroadcastChannelDuplex, newBroadcastChannelDuplex, BroadcastChannelConn, } from './broadcast-channel.js';
10
10
  export { MessagePortIterable, newMessagePortIterable, MessagePortConn, } from './message-port.js';
11
+ export { MessageDefinition, DecodeMessageTransform, buildDecodeMessageTransform, EncodeMessageTransform, buildEncodeMessageTransform, } from './message.js';
11
12
  export { ValueCtr } from './value-ctr.js';
12
13
  export { OpenStreamCtr } from './open-stream-ctr.js';
13
14
  export { writeToPushable } from './pushable';
@@ -7,6 +7,7 @@ export { Packet, CallStart, CallData } from './rpcproto.pb.js';
7
7
  export { StaticMux, createMux } from './mux.js';
8
8
  export { BroadcastChannelDuplex, newBroadcastChannelDuplex, BroadcastChannelConn, } from './broadcast-channel.js';
9
9
  export { MessagePortIterable, newMessagePortIterable, MessagePortConn, } from './message-port.js';
10
+ export { buildDecodeMessageTransform, buildEncodeMessageTransform, } from './message.js';
10
11
  export { ValueCtr } from './value-ctr.js';
11
12
  export { OpenStreamCtr } from './open-stream-ctr.js';
12
13
  export { writeToPushable } from './pushable';
@@ -4,8 +4,7 @@ export interface MessageDefinition<T> {
4
4
  encode(message: T, writer?: pbjs.Writer): pbjs.Writer;
5
5
  decode(input: pbjs.Reader | Uint8Array, length?: number): T;
6
6
  }
7
- type DecodeMessageTransform<T> = (source: Source<Uint8Array | Uint8Array[]>) => AsyncIterable<T>;
7
+ export type DecodeMessageTransform<T> = (source: Source<Uint8Array | Uint8Array[]>) => AsyncIterable<T>;
8
8
  export declare function buildDecodeMessageTransform<T>(def: MessageDefinition<T>): DecodeMessageTransform<T>;
9
- type EncodeMessageTransform<T> = (source: Source<T | T[]>) => AsyncIterable<Uint8Array>;
9
+ export type EncodeMessageTransform<T> = (source: Source<T | T[]>) => AsyncIterable<Uint8Array>;
10
10
  export declare function buildEncodeMessageTransform<T>(def: MessageDefinition<T>): EncodeMessageTransform<T>;
11
- export {};
@@ -1,8 +1,8 @@
1
1
  import { Packet } from './rpcproto.pb.js';
2
2
  import { Uint8ArrayList } from 'uint8arraylist';
3
3
  import { Transform } from 'it-pipe';
4
- export declare const decodePacketSource: (source: import("it-stream-types").Source<Uint8Array | Uint8Array[]>) => AsyncIterable<Packet>;
5
- export declare const encodePacketSource: (source: import("it-stream-types").Source<Packet | Packet[]>) => AsyncIterable<Uint8Array>;
4
+ export declare const decodePacketSource: import("./message.js").DecodeMessageTransform<Packet>;
5
+ export declare const encodePacketSource: import("./message.js").EncodeMessageTransform<Packet>;
6
6
  export declare function prependLengthPrefixTransform(): Transform<Uint8Array | Uint8ArrayList, Uint8Array>;
7
7
  export declare function parseLengthPrefixTransform(): Transform<Uint8Array | Uint8ArrayList, Uint8ArrayList>;
8
8
  export declare function encodeUint32Le(value: number): Uint8Array;
package/go.mod CHANGED
@@ -9,8 +9,8 @@ require (
9
9
  )
10
10
 
11
11
  require (
12
- github.com/aperturerobotics/util v0.0.0-20221205090205-f776a34d2d0d
13
- github.com/libp2p/go-libp2p v0.24.1
12
+ github.com/aperturerobotics/util v0.0.0-20230105015752-3e6dd02b20c6
13
+ github.com/libp2p/go-libp2p v0.24.2
14
14
  github.com/libp2p/go-yamux/v4 v4.0.1-0.20220919134236-1c09f2ab3ec1
15
15
  github.com/sirupsen/logrus v1.9.0
16
16
  )
@@ -29,13 +29,13 @@ require (
29
29
  github.com/multiformats/go-base32 v0.1.0 // indirect
30
30
  github.com/multiformats/go-base36 v0.2.0 // indirect
31
31
  github.com/multiformats/go-multiaddr v0.8.0 // indirect
32
- github.com/multiformats/go-multibase v0.1.2-0.20220823162309-7160a7347ed1 // indirect
33
- github.com/multiformats/go-multicodec v0.7.1-0.20221017174837-a2baec7ca709 // indirect
34
- github.com/multiformats/go-multihash v0.2.2-0.20221030163302-608669da49b6 // indirect
32
+ github.com/multiformats/go-multibase v0.1.1 // indirect
33
+ github.com/multiformats/go-multicodec v0.7.0 // indirect
34
+ github.com/multiformats/go-multihash v0.2.1 // indirect
35
35
  github.com/multiformats/go-varint v0.0.7 // indirect
36
36
  github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
37
- github.com/spaolacci/murmur3 v1.1.1-0.20190317074736-539464a789e9 // indirect
37
+ github.com/spaolacci/murmur3 v1.1.0 // indirect
38
38
  golang.org/x/crypto v0.3.0 // indirect
39
39
  golang.org/x/sys v0.3.0 // indirect
40
- lukechampine.com/blake3 v1.1.8-0.20220321170924-7afca5966e5e // indirect
40
+ lukechampine.com/blake3 v1.1.7 // indirect
41
41
  )
package/go.sum CHANGED
@@ -1,5 +1,5 @@
1
- github.com/aperturerobotics/util v0.0.0-20221205090205-f776a34d2d0d h1:nYXEY4LHTW7a7Vf+Lt+7icxoc02wIyLCa12xPbFuIxo=
2
- github.com/aperturerobotics/util v0.0.0-20221205090205-f776a34d2d0d/go.mod h1:up2AYcp62UgmFVTm7QhM4USXAKGv73gpb5dHraKmzxQ=
1
+ github.com/aperturerobotics/util v0.0.0-20230105015752-3e6dd02b20c6 h1:YCg1Eyh5M5SvWCpJmdM62iInd0yfZXSGFld10GQIIPA=
2
+ github.com/aperturerobotics/util v0.0.0-20230105015752-3e6dd02b20c6/go.mod h1:up2AYcp62UgmFVTm7QhM4USXAKGv73gpb5dHraKmzxQ=
3
3
  github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4
4
  github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5
5
  github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -52,8 +52,8 @@ github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
52
52
  github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
53
53
  github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
54
54
  github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
55
- github.com/libp2p/go-libp2p v0.24.1 h1:+lS4fqj7RF9egcPq9Yo3iqdRTcDMApzoBbQMhxtwOVw=
56
- github.com/libp2p/go-libp2p v0.24.1/go.mod h1:5LJqbrqFsUzWrq70JHCYqjATlX4ey8Klpct3OEe8hSI=
55
+ github.com/libp2p/go-libp2p v0.24.2 h1:iMViPIcLY0D6zr/f+1Yq9EavCZu2i7eDstsr1nEwSAk=
56
+ github.com/libp2p/go-libp2p v0.24.2/go.mod h1:WuxtL2V8yGjam03D93ZBC19tvOUiPpewYv1xdFGWu1k=
57
57
  github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
58
58
  github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo=
59
59
  github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc=
@@ -77,12 +77,12 @@ github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9
77
77
  github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4=
78
78
  github.com/multiformats/go-multiaddr v0.8.0 h1:aqjksEcqK+iD/Foe1RRFsGZh8+XFiGo7FgUCZlpv3LU=
79
79
  github.com/multiformats/go-multiaddr v0.8.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs=
80
- github.com/multiformats/go-multibase v0.1.2-0.20220823162309-7160a7347ed1 h1:fts9VGSGzcENj3XnQ3iz9LGMAJAqT46fUGyaUDGFuxQ=
81
- github.com/multiformats/go-multibase v0.1.2-0.20220823162309-7160a7347ed1/go.mod h1:ReOVfKN5TNx1Z6d9Ba4GdcbPfPgAT8gC7lSG0ZJjEl4=
82
- github.com/multiformats/go-multicodec v0.7.1-0.20221017174837-a2baec7ca709 h1:XwgbSBFN6TU/aBJk0BLucpFL6I9zL9GMJp+WflbHkos=
83
- github.com/multiformats/go-multicodec v0.7.1-0.20221017174837-a2baec7ca709/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
84
- github.com/multiformats/go-multihash v0.2.2-0.20221030163302-608669da49b6 h1:qLF997Rz0X1WvdcZ2r5CUkLZ2rvdiXwG1JRSrJZEAuE=
85
- github.com/multiformats/go-multihash v0.2.2-0.20221030163302-608669da49b6/go.mod h1:kaHxr8TfO1cxIR/tYxgZ7e59HraJq8arEQQR8E/YNvI=
80
+ github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI=
81
+ github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8=
82
+ github.com/multiformats/go-multicodec v0.7.0 h1:rTUjGOwjlhGHbEMbPoSUJowG1spZTVsITRANCjKTUAQ=
83
+ github.com/multiformats/go-multicodec v0.7.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
84
+ github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108=
85
+ github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc=
86
86
  github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
87
87
  github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
88
88
  github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -93,8 +93,8 @@ github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0
93
93
  github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
94
94
  github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU=
95
95
  github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
96
- github.com/spaolacci/murmur3 v1.1.1-0.20190317074736-539464a789e9 h1:7/iCYp2ii4GgbLhsT4uA8+vNHYYlSY5I5CS6/8e57hE=
97
- github.com/spaolacci/murmur3 v1.1.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
96
+ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
97
+ github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
98
98
  github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
99
99
  github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
100
100
  github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
@@ -150,7 +150,7 @@ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
150
150
  gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
151
151
  gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
152
152
  gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
153
- lukechampine.com/blake3 v1.1.8-0.20220321170924-7afca5966e5e h1:YeQnmA0g9M+7uVBjUXNUpVQRfWrvTu4I5u+DjFudflw=
154
- lukechampine.com/blake3 v1.1.8-0.20220321170924-7afca5966e5e/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
153
+ lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0=
154
+ lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
155
155
  nhooyr.io/websocket v1.8.8-0.20221213223501-14fb98eba64e h1:Sk+k5z84Elo/gfEvX1xQR83Yhd6ETPmVDJTXUd2BxR4=
156
156
  nhooyr.io/websocket v1.8.8-0.20221213223501-14fb98eba64e/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -61,36 +61,36 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@aperturerobotics/ts-common": "^0.3.1",
64
- "@typescript-eslint/eslint-plugin": "^5.46.1",
65
- "@typescript-eslint/parser": "^5.46.1",
64
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
65
+ "@typescript-eslint/parser": "^5.48.0",
66
66
  "bufferutil": "^4.0.7",
67
67
  "depcheck": "^1.4.3",
68
- "esbuild": "^0.16.7",
69
- "eslint": "^8.29.0",
70
- "eslint-config-prettier": "^8.5.0",
71
- "prettier": "^2.8.1",
68
+ "esbuild": "^0.16.16",
69
+ "eslint": "^8.31.0",
70
+ "eslint-config-prettier": "^8.6.0",
71
+ "prettier": "^2.8.2",
72
72
  "rimraf": "^3.0.2",
73
- "ts-proto": "^1.136.0",
73
+ "ts-proto": "^1.137.1",
74
74
  "typescript": "^4.9.4",
75
- "utf-8-validate": "^5.0.10"
75
+ "utf-8-validate": "^6.0.0"
76
76
  },
77
77
  "dependencies": {
78
- "@chainsafe/libp2p-yamux": "^3.0.3",
79
- "@libp2p/interface-connection": "^3.0.4",
80
- "@libp2p/interface-stream-muxer": "^3.0.2",
78
+ "@chainsafe/libp2p-yamux": "^3.0.4",
79
+ "@libp2p/interface-connection": "^3.0.7",
80
+ "@libp2p/interface-stream-muxer": "^3.0.4",
81
81
  "event-iterator": "^2.0.0",
82
82
  "is-promise": "^4.0.0",
83
83
  "isomorphic-ws": "^5.0.0",
84
84
  "it-first": "^2.0.0",
85
- "it-length-prefixed": "^8.0.3",
85
+ "it-length-prefixed": "^8.0.4",
86
86
  "it-pipe": "^2.0.5",
87
- "it-pushable": "^3.1.0",
88
- "it-stream-types": "^1.0.4",
87
+ "it-pushable": "^3.1.2",
88
+ "it-stream-types": "^1.0.5",
89
89
  "it-ws": "^5.0.6",
90
90
  "long": "^5.2.1",
91
- "patch-package": "^6.5.0",
91
+ "patch-package": "^6.5.1",
92
92
  "protobufjs": "^7.1.2",
93
- "uint8arraylist": "^2.4.2",
94
- "ws": "^8.11.0"
93
+ "uint8arraylist": "^2.4.3",
94
+ "ws": "^8.12.0"
95
95
  }
96
96
  }
@@ -2,7 +2,8 @@ package srpc
2
2
 
3
3
  import (
4
4
  "context"
5
- "errors"
5
+
6
+ "github.com/pkg/errors"
6
7
  )
7
8
 
8
9
  // ClientSet wraps a list of clients into one Client.
package/srpc/index.ts CHANGED
@@ -16,6 +16,13 @@ export {
16
16
  newMessagePortIterable,
17
17
  MessagePortConn,
18
18
  } from './message-port.js'
19
+ export {
20
+ MessageDefinition,
21
+ DecodeMessageTransform,
22
+ buildDecodeMessageTransform,
23
+ EncodeMessageTransform,
24
+ buildEncodeMessageTransform,
25
+ } from './message.js'
19
26
  export { ValueCtr } from './value-ctr.js'
20
27
  export { OpenStreamCtr } from './open-stream-ctr.js'
21
28
  export { writeToPushable } from './pushable'
package/srpc/invoker.go CHANGED
@@ -22,7 +22,7 @@ func (s InvokerSlice) InvokeMethod(serviceID, methodID string, strm Stream) (boo
22
22
 
23
23
  found, err := invoker.InvokeMethod(serviceID, methodID, strm)
24
24
  if found || err != nil {
25
- return found && err == nil, err
25
+ return true, err
26
26
  }
27
27
  }
28
28
  return false, nil
package/srpc/message.ts CHANGED
@@ -10,7 +10,7 @@ export interface MessageDefinition<T> {
10
10
  }
11
11
 
12
12
  // DecodeMessageTransform decodes messages to objects.
13
- type DecodeMessageTransform<T> = (
13
+ export type DecodeMessageTransform<T> = (
14
14
  source: Source<Uint8Array | Uint8Array[]>
15
15
  ) => AsyncIterable<T>
16
16
 
@@ -35,7 +35,7 @@ export function buildDecodeMessageTransform<T>(
35
35
  }
36
36
 
37
37
  // EncodeMessageTransform is a transformer that encodes messages.
38
- type EncodeMessageTransform<T> = (
38
+ export type EncodeMessageTransform<T> = (
39
39
  source: Source<T | T[]>
40
40
  ) => AsyncIterable<Uint8Array>
41
41