starpc 0.9.1 → 0.10.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.
package/echo/echo.pb.ts CHANGED
@@ -1,60 +1,57 @@
1
1
  /* eslint-disable */
2
- import Long from 'long'
3
- import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js'
4
- import _m0 from 'protobufjs/minimal.js'
2
+ import Long from "long";
3
+ import _m0 from "protobufjs/minimal.js";
4
+ import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
5
5
 
6
- export const protobufPackage = 'echo'
6
+ export const protobufPackage = "echo";
7
7
 
8
8
  /** EchoMsg is the message body for Echo. */
9
9
  export interface EchoMsg {
10
- body: string
10
+ body: string;
11
11
  }
12
12
 
13
13
  function createBaseEchoMsg(): EchoMsg {
14
- return { body: '' }
14
+ return { body: "" };
15
15
  }
16
16
 
17
17
  export const EchoMsg = {
18
- encode(
19
- message: EchoMsg,
20
- writer: _m0.Writer = _m0.Writer.create()
21
- ): _m0.Writer {
22
- if (message.body !== '') {
23
- writer.uint32(10).string(message.body)
18
+ encode(message: EchoMsg, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
19
+ if (message.body !== "") {
20
+ writer.uint32(10).string(message.body);
24
21
  }
25
- return writer
22
+ return writer;
26
23
  },
27
24
 
28
25
  decode(input: _m0.Reader | Uint8Array, length?: number): EchoMsg {
29
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
30
- let end = length === undefined ? reader.len : reader.pos + length
31
- const message = createBaseEchoMsg()
26
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
27
+ let end = length === undefined ? reader.len : reader.pos + length;
28
+ const message = createBaseEchoMsg();
32
29
  while (reader.pos < end) {
33
- const tag = reader.uint32()
30
+ const tag = reader.uint32();
34
31
  switch (tag >>> 3) {
35
32
  case 1:
36
- message.body = reader.string()
37
- break
33
+ message.body = reader.string();
34
+ break;
38
35
  default:
39
- reader.skipType(tag & 7)
40
- break
36
+ reader.skipType(tag & 7);
37
+ break;
41
38
  }
42
39
  }
43
- return message
40
+ return message;
44
41
  },
45
42
 
46
43
  // encodeTransform encodes a source of message objects.
47
44
  // Transform<EchoMsg, Uint8Array>
48
45
  async *encodeTransform(
49
- source: AsyncIterable<EchoMsg | EchoMsg[]> | Iterable<EchoMsg | EchoMsg[]>
46
+ source: AsyncIterable<EchoMsg | EchoMsg[]> | Iterable<EchoMsg | EchoMsg[]>,
50
47
  ): AsyncIterable<Uint8Array> {
51
48
  for await (const pkt of source) {
52
49
  if (Array.isArray(pkt)) {
53
50
  for (const p of pkt) {
54
- yield* [EchoMsg.encode(p).finish()]
51
+ yield* [EchoMsg.encode(p).finish()];
55
52
  }
56
53
  } else {
57
- yield* [EchoMsg.encode(pkt).finish()]
54
+ yield* [EchoMsg.encode(pkt).finish()];
58
55
  }
59
56
  }
60
57
  },
@@ -62,124 +59,100 @@ export const EchoMsg = {
62
59
  // decodeTransform decodes a source of encoded messages.
63
60
  // Transform<Uint8Array, EchoMsg>
64
61
  async *decodeTransform(
65
- source:
66
- | AsyncIterable<Uint8Array | Uint8Array[]>
67
- | Iterable<Uint8Array | Uint8Array[]>
62
+ source: AsyncIterable<Uint8Array | Uint8Array[]> | Iterable<Uint8Array | Uint8Array[]>,
68
63
  ): AsyncIterable<EchoMsg> {
69
64
  for await (const pkt of source) {
70
65
  if (Array.isArray(pkt)) {
71
66
  for (const p of pkt) {
72
- yield* [EchoMsg.decode(p)]
67
+ yield* [EchoMsg.decode(p)];
73
68
  }
74
69
  } else {
75
- yield* [EchoMsg.decode(pkt)]
70
+ yield* [EchoMsg.decode(pkt)];
76
71
  }
77
72
  }
78
73
  },
79
74
 
80
75
  fromJSON(object: any): EchoMsg {
81
- return {
82
- body: isSet(object.body) ? String(object.body) : '',
83
- }
76
+ return { body: isSet(object.body) ? String(object.body) : "" };
84
77
  },
85
78
 
86
79
  toJSON(message: EchoMsg): unknown {
87
- const obj: any = {}
88
- message.body !== undefined && (obj.body = message.body)
89
- return obj
80
+ const obj: any = {};
81
+ message.body !== undefined && (obj.body = message.body);
82
+ return obj;
90
83
  },
91
84
 
92
85
  fromPartial<I extends Exact<DeepPartial<EchoMsg>, I>>(object: I): EchoMsg {
93
- const message = createBaseEchoMsg()
94
- message.body = object.body ?? ''
95
- return message
86
+ const message = createBaseEchoMsg();
87
+ message.body = object.body ?? "";
88
+ return message;
96
89
  },
97
- }
90
+ };
98
91
 
99
92
  /** Echoer service returns the given message. */
100
93
  export interface Echoer {
101
94
  /** Echo returns the given message. */
102
- Echo(request: EchoMsg): Promise<EchoMsg>
95
+ Echo(request: EchoMsg): Promise<EchoMsg>;
103
96
  /** EchoServerStream is an example of a server -> client one-way stream. */
104
- EchoServerStream(request: EchoMsg): AsyncIterable<EchoMsg>
97
+ EchoServerStream(request: EchoMsg): AsyncIterable<EchoMsg>;
105
98
  /** EchoClientStream is an example of client->server one-way stream. */
106
- EchoClientStream(request: AsyncIterable<EchoMsg>): Promise<EchoMsg>
99
+ EchoClientStream(request: AsyncIterable<EchoMsg>): Promise<EchoMsg>;
107
100
  /** EchoBidiStream is an example of a two-way stream. */
108
- EchoBidiStream(request: AsyncIterable<EchoMsg>): AsyncIterable<EchoMsg>
101
+ EchoBidiStream(request: AsyncIterable<EchoMsg>): AsyncIterable<EchoMsg>;
109
102
  /** RpcStream opens a nested rpc call stream. */
110
- RpcStream(
111
- request: AsyncIterable<RpcStreamPacket>
112
- ): AsyncIterable<RpcStreamPacket>
103
+ RpcStream(request: AsyncIterable<RpcStreamPacket>): AsyncIterable<RpcStreamPacket>;
113
104
  }
114
105
 
115
106
  export class EchoerClientImpl implements Echoer {
116
- private readonly rpc: Rpc
107
+ private readonly rpc: Rpc;
117
108
  constructor(rpc: Rpc) {
118
- this.rpc = rpc
119
- this.Echo = this.Echo.bind(this)
120
- this.EchoServerStream = this.EchoServerStream.bind(this)
121
- this.EchoClientStream = this.EchoClientStream.bind(this)
122
- this.EchoBidiStream = this.EchoBidiStream.bind(this)
123
- this.RpcStream = this.RpcStream.bind(this)
109
+ this.rpc = rpc;
110
+ this.Echo = this.Echo.bind(this);
111
+ this.EchoServerStream = this.EchoServerStream.bind(this);
112
+ this.EchoClientStream = this.EchoClientStream.bind(this);
113
+ this.EchoBidiStream = this.EchoBidiStream.bind(this);
114
+ this.RpcStream = this.RpcStream.bind(this);
124
115
  }
125
116
  Echo(request: EchoMsg): Promise<EchoMsg> {
126
- const data = EchoMsg.encode(request).finish()
127
- const promise = this.rpc.request('echo.Echoer', 'Echo', data)
128
- return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)))
117
+ const data = EchoMsg.encode(request).finish();
118
+ const promise = this.rpc.request("echo.Echoer", "Echo", data);
119
+ return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)));
129
120
  }
130
121
 
131
122
  EchoServerStream(request: EchoMsg): AsyncIterable<EchoMsg> {
132
- const data = EchoMsg.encode(request).finish()
133
- const result = this.rpc.serverStreamingRequest(
134
- 'echo.Echoer',
135
- 'EchoServerStream',
136
- data
137
- )
138
- return EchoMsg.decodeTransform(result)
123
+ const data = EchoMsg.encode(request).finish();
124
+ const result = this.rpc.serverStreamingRequest("echo.Echoer", "EchoServerStream", data);
125
+ return EchoMsg.decodeTransform(result);
139
126
  }
140
127
 
141
128
  EchoClientStream(request: AsyncIterable<EchoMsg>): Promise<EchoMsg> {
142
- const data = EchoMsg.encodeTransform(request)
143
- const promise = this.rpc.clientStreamingRequest(
144
- 'echo.Echoer',
145
- 'EchoClientStream',
146
- data
147
- )
148
- return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)))
129
+ const data = EchoMsg.encodeTransform(request);
130
+ const promise = this.rpc.clientStreamingRequest("echo.Echoer", "EchoClientStream", data);
131
+ return promise.then((data) => EchoMsg.decode(new _m0.Reader(data)));
149
132
  }
150
133
 
151
134
  EchoBidiStream(request: AsyncIterable<EchoMsg>): AsyncIterable<EchoMsg> {
152
- const data = EchoMsg.encodeTransform(request)
153
- const result = this.rpc.bidirectionalStreamingRequest(
154
- 'echo.Echoer',
155
- 'EchoBidiStream',
156
- data
157
- )
158
- return EchoMsg.decodeTransform(result)
135
+ const data = EchoMsg.encodeTransform(request);
136
+ const result = this.rpc.bidirectionalStreamingRequest("echo.Echoer", "EchoBidiStream", data);
137
+ return EchoMsg.decodeTransform(result);
159
138
  }
160
139
 
161
- RpcStream(
162
- request: AsyncIterable<RpcStreamPacket>
163
- ): AsyncIterable<RpcStreamPacket> {
164
- const data = RpcStreamPacket.encodeTransform(request)
165
- const result = this.rpc.bidirectionalStreamingRequest(
166
- 'echo.Echoer',
167
- 'RpcStream',
168
- data
169
- )
170
- return RpcStreamPacket.decodeTransform(result)
140
+ RpcStream(request: AsyncIterable<RpcStreamPacket>): AsyncIterable<RpcStreamPacket> {
141
+ const data = RpcStreamPacket.encodeTransform(request);
142
+ const result = this.rpc.bidirectionalStreamingRequest("echo.Echoer", "RpcStream", data);
143
+ return RpcStreamPacket.decodeTransform(result);
171
144
  }
172
145
  }
173
146
 
174
147
  /** Echoer service returns the given message. */
175
- export type EchoerDefinition = typeof EchoerDefinition
148
+ export type EchoerDefinition = typeof EchoerDefinition;
176
149
  export const EchoerDefinition = {
177
- name: 'Echoer',
178
- fullName: 'echo.Echoer',
150
+ name: "Echoer",
151
+ fullName: "echo.Echoer",
179
152
  methods: {
180
153
  /** Echo returns the given message. */
181
154
  echo: {
182
- name: 'Echo',
155
+ name: "Echo",
183
156
  requestType: EchoMsg,
184
157
  requestStream: false,
185
158
  responseType: EchoMsg,
@@ -188,7 +161,7 @@ export const EchoerDefinition = {
188
161
  },
189
162
  /** EchoServerStream is an example of a server -> client one-way stream. */
190
163
  echoServerStream: {
191
- name: 'EchoServerStream',
164
+ name: "EchoServerStream",
192
165
  requestType: EchoMsg,
193
166
  requestStream: false,
194
167
  responseType: EchoMsg,
@@ -197,7 +170,7 @@ export const EchoerDefinition = {
197
170
  },
198
171
  /** EchoClientStream is an example of client->server one-way stream. */
199
172
  echoClientStream: {
200
- name: 'EchoClientStream',
173
+ name: "EchoClientStream",
201
174
  requestType: EchoMsg,
202
175
  requestStream: true,
203
176
  responseType: EchoMsg,
@@ -206,7 +179,7 @@ export const EchoerDefinition = {
206
179
  },
207
180
  /** EchoBidiStream is an example of a two-way stream. */
208
181
  echoBidiStream: {
209
- name: 'EchoBidiStream',
182
+ name: "EchoBidiStream",
210
183
  requestType: EchoMsg,
211
184
  requestStream: true,
212
185
  responseType: EchoMsg,
@@ -215,7 +188,7 @@ export const EchoerDefinition = {
215
188
  },
216
189
  /** RpcStream opens a nested rpc call stream. */
217
190
  rpcStream: {
218
- name: 'RpcStream',
191
+ name: "RpcStream",
219
192
  requestType: RpcStreamPacket,
220
193
  requestStream: true,
221
194
  responseType: RpcStreamPacket,
@@ -223,69 +196,37 @@ export const EchoerDefinition = {
223
196
  options: {},
224
197
  },
225
198
  },
226
- } as const
199
+ } as const;
227
200
 
228
201
  interface Rpc {
229
- request(
230
- service: string,
231
- method: string,
232
- data: Uint8Array
233
- ): Promise<Uint8Array>
234
- clientStreamingRequest(
235
- service: string,
236
- method: string,
237
- data: AsyncIterable<Uint8Array>
238
- ): Promise<Uint8Array>
239
- serverStreamingRequest(
240
- service: string,
241
- method: string,
242
- data: Uint8Array
243
- ): AsyncIterable<Uint8Array>
202
+ request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
203
+ clientStreamingRequest(service: string, method: string, data: AsyncIterable<Uint8Array>): Promise<Uint8Array>;
204
+ serverStreamingRequest(service: string, method: string, data: Uint8Array): AsyncIterable<Uint8Array>;
244
205
  bidirectionalStreamingRequest(
245
206
  service: string,
246
207
  method: string,
247
- data: AsyncIterable<Uint8Array>
248
- ): AsyncIterable<Uint8Array>
208
+ data: AsyncIterable<Uint8Array>,
209
+ ): AsyncIterable<Uint8Array>;
249
210
  }
250
211
 
251
- type Builtin =
252
- | Date
253
- | Function
254
- | Uint8Array
255
- | string
256
- | number
257
- | boolean
258
- | undefined
212
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
259
213
 
260
- export type DeepPartial<T> = T extends Builtin
261
- ? T
262
- : T extends Long
263
- ? string | number | Long
264
- : T extends Array<infer U>
265
- ? Array<DeepPartial<U>>
266
- : T extends ReadonlyArray<infer U>
267
- ? ReadonlyArray<DeepPartial<U>>
268
- : T extends { $case: string }
269
- ? { [K in keyof Omit<T, '$case'>]?: DeepPartial<T[K]> } & {
270
- $case: T['$case']
271
- }
272
- : T extends {}
273
- ? { [K in keyof T]?: DeepPartial<T[K]> }
274
- : Partial<T>
214
+ export type DeepPartial<T> = T extends Builtin ? T
215
+ : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>>
216
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
217
+ : T extends { $case: string } ? { [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]> } & { $case: T["$case"] }
218
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
219
+ : Partial<T>;
275
220
 
276
- type KeysOfUnion<T> = T extends T ? keyof T : never
277
- export type Exact<P, I extends P> = P extends Builtin
278
- ? P
279
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
280
- Exclude<keyof I, KeysOfUnion<P>>,
281
- never
282
- >
221
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
222
+ export type Exact<P, I extends P> = P extends Builtin ? P
223
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
283
224
 
284
225
  if (_m0.util.Long !== Long) {
285
- _m0.util.Long = Long as any
286
- _m0.configure()
226
+ _m0.util.Long = Long as any;
227
+ _m0.configure();
287
228
  }
288
229
 
289
230
  function isSet(value: any): boolean {
290
- return value !== null && value !== undefined
231
+ return value !== null && value !== undefined;
291
232
  }
@@ -1,5 +1,5 @@
1
1
  // Code generated by protoc-gen-srpc. DO NOT EDIT.
2
- // protoc-gen-srpc version: v0.8.6
2
+ // protoc-gen-srpc version: v0.9.2
3
3
  // source: github.com/aperturerobotics/starpc/echo/echo.proto
4
4
 
5
5
  package echo
@@ -1,5 +1,5 @@
1
1
  // Code generated by protoc-gen-go-vtproto. DO NOT EDIT.
2
- // protoc-gen-go-vtproto version: v0.3.1-0.20220531071333-dfd3d322ffb6
2
+ // protoc-gen-go-vtproto version: v0.3.1-0.20220817155510-0ae748fd2007
3
3
  // source: github.com/aperturerobotics/starpc/echo/echo.proto
4
4
 
5
5
  package echo
@@ -21,9 +21,9 @@ const (
21
21
 
22
22
  func (this *EchoMsg) EqualVT(that *EchoMsg) bool {
23
23
  if this == nil {
24
- return that == nil || that.String() == ""
24
+ return that == nil
25
25
  } else if that == nil {
26
- return this.String() == ""
26
+ return false
27
27
  }
28
28
  if this.Body != that.Body {
29
29
  return false
package/go.mod CHANGED
@@ -2,8 +2,6 @@ module github.com/aperturerobotics/starpc
2
2
 
3
3
  go 1.18
4
4
 
5
- replace github.com/libp2p/go-libp2p => github.com/paralin/go-libp2p v0.20.1-0.20220702024301-86e6932dc57e // aperture
6
-
7
5
  require (
8
6
  github.com/pkg/errors v0.9.1
9
7
  google.golang.org/protobuf v1.28.1
@@ -11,39 +9,38 @@ require (
11
9
  )
12
10
 
13
11
  require (
14
- github.com/libp2p/go-libp2p v0.21.0
15
- github.com/libp2p/go-libp2p-core v0.19.1
16
- github.com/libp2p/go-mplex v0.7.1-0.20220702225122-8cbdf39b21f5
12
+ github.com/libp2p/go-libp2p v0.22.0
13
+ github.com/libp2p/go-libp2p-core v0.20.1
14
+ github.com/libp2p/go-mplex v0.7.1-0.20220825125536-a00a1352b54f
17
15
  github.com/sirupsen/logrus v1.9.0
18
16
  )
19
17
 
20
18
  require (
21
- github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect
22
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
19
+ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
23
20
  github.com/gogo/protobuf v1.3.2 // indirect
24
21
  github.com/ipfs/go-cid v0.2.0 // indirect
25
22
  github.com/ipfs/go-log/v2 v2.5.1 // indirect
26
23
  github.com/klauspost/compress v1.15.1 // indirect
27
- github.com/klauspost/cpuid/v2 v2.0.9 // indirect
28
- github.com/libp2p/go-buffer-pool v0.0.2 // indirect
29
- github.com/libp2p/go-openssl v0.0.7 // indirect
30
- github.com/mattn/go-isatty v0.0.14 // indirect
31
- github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
24
+ github.com/klauspost/cpuid/v2 v2.1.0 // indirect
25
+ github.com/libp2p/go-buffer-pool v0.1.0 // indirect
26
+ github.com/libp2p/go-openssl v0.1.0 // indirect
27
+ github.com/mattn/go-isatty v0.0.16 // indirect
28
+ github.com/mattn/go-pointer v0.0.1 // indirect
32
29
  github.com/minio/sha256-simd v1.0.0 // indirect
33
30
  github.com/mr-tron/base58 v1.2.0 // indirect
34
- github.com/multiformats/go-base32 v0.0.3 // indirect
31
+ github.com/multiformats/go-base32 v0.0.4 // indirect
35
32
  github.com/multiformats/go-base36 v0.1.0 // indirect
36
33
  github.com/multiformats/go-multiaddr v0.6.0 // indirect
37
- github.com/multiformats/go-multibase v0.0.3 // indirect
38
- github.com/multiformats/go-multicodec v0.4.1 // indirect
39
- github.com/multiformats/go-multihash v0.1.0 // indirect
34
+ github.com/multiformats/go-multibase v0.1.1 // indirect
35
+ github.com/multiformats/go-multicodec v0.5.0 // indirect
36
+ github.com/multiformats/go-multihash v0.2.1 // indirect
40
37
  github.com/multiformats/go-varint v0.0.6 // indirect
41
38
  github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
42
39
  github.com/spaolacci/murmur3 v1.1.0 // indirect
43
- go.uber.org/atomic v1.7.0 // indirect
44
- go.uber.org/multierr v1.6.0 // indirect
45
- go.uber.org/zap v1.19.1 // indirect
46
- golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
47
- golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
48
- lukechampine.com/blake3 v1.1.6 // indirect
40
+ go.uber.org/atomic v1.10.0 // indirect
41
+ go.uber.org/multierr v1.8.0 // indirect
42
+ go.uber.org/zap v1.22.0 // indirect
43
+ golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
44
+ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
45
+ lukechampine.com/blake3 v1.1.7 // indirect
49
46
  )