starpc 0.32.7 → 0.32.9

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/Makefile CHANGED
@@ -68,6 +68,7 @@ node_modules:
68
68
  genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_STARPC)
69
69
  shopt -s globstar; \
70
70
  set -eo pipefail; \
71
+ export PROTOBUF_GO_TYPES_PKG=github.com/aperturerobotics/protobuf-go-lite/types; \
71
72
  export PROJECT=$$(go list -m); \
72
73
  export PATH=$$(pwd)/hack/bin:$${PATH}; \
73
74
  export OUT=./vendor; \
@@ -9,6 +9,11 @@ export async function runClientTest(client) {
9
9
  body: 'Hello world!',
10
10
  });
11
11
  console.log('success: output', result.body);
12
+ console.log('Calling Echo: unary call with empty request/response...');
13
+ await demoServiceClient.DoNothing({
14
+ body: 'Hello world!',
15
+ });
16
+ console.log('success');
12
17
  // observable for client requests
13
18
  const clientRequestStream = pushable({
14
19
  objectMode: true,
@@ -1,7 +1,7 @@
1
- import { EchoMsg } from "./echo.pb.js";
2
- import { Message, MethodKind } from "@aptre/protobuf-es-lite";
3
- import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
4
- import { MessageStream, ProtoRpc } from "starpc";
1
+ import { EchoMsg } from './echo.pb.js';
2
+ import { Empty, Message, MethodKind } from '@aptre/protobuf-es-lite';
3
+ import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js';
4
+ import { MessageStream, ProtoRpc } from 'starpc';
5
5
  /**
6
6
  * Echoer service returns the given message.
7
7
  *
@@ -117,6 +117,17 @@ export declare const EchoerDefinition: {
117
117
  }>>;
118
118
  readonly kind: MethodKind.BiDiStreaming;
119
119
  };
120
+ /**
121
+ * DoNothing does nothing.
122
+ *
123
+ * @generated from rpc echo.Echoer.DoNothing
124
+ */
125
+ readonly DoNothing: {
126
+ readonly name: "DoNothing";
127
+ readonly I: import("@aptre/protobuf-es-lite").MessageType<Message<{}>>;
128
+ readonly O: import("@aptre/protobuf-es-lite").MessageType<Message<{}>>;
129
+ readonly kind: MethodKind.Unary;
130
+ };
120
131
  };
121
132
  };
122
133
  /**
@@ -155,6 +166,12 @@ export interface Echoer {
155
166
  * @generated from rpc echo.Echoer.RpcStream
156
167
  */
157
168
  RpcStream(request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal): MessageStream<RpcStreamPacket>;
169
+ /**
170
+ * DoNothing does nothing.
171
+ *
172
+ * @generated from rpc echo.Echoer.DoNothing
173
+ */
174
+ DoNothing(request: Message<Empty>, abortSignal?: AbortSignal): Promise<Message<Empty>>;
158
175
  }
159
176
  export declare const EchoerServiceName: "echo.Echoer";
160
177
  export declare class EchoerClient implements Echoer {
@@ -193,4 +210,10 @@ export declare class EchoerClient implements Echoer {
193
210
  * @generated from rpc echo.Echoer.RpcStream
194
211
  */
195
212
  RpcStream(request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal): MessageStream<RpcStreamPacket>;
213
+ /**
214
+ * DoNothing does nothing.
215
+ *
216
+ * @generated from rpc echo.Echoer.DoNothing
217
+ */
218
+ DoNothing(request: Message<Empty>, abortSignal?: AbortSignal): Promise<Message<Empty>>;
196
219
  }
@@ -1,17 +1,17 @@
1
1
  // @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
3
3
  /* eslint-disable */
4
- import { EchoMsg } from "./echo.pb.js";
5
- import { MethodKind } from "@aptre/protobuf-es-lite";
6
- import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
7
- import { buildDecodeMessageTransform, buildEncodeMessageTransform } from "starpc";
4
+ import { EchoMsg } from './echo.pb.js';
5
+ import { Empty, MethodKind } from '@aptre/protobuf-es-lite';
6
+ import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js';
7
+ import { buildDecodeMessageTransform, buildEncodeMessageTransform, } from 'starpc';
8
8
  /**
9
9
  * Echoer service returns the given message.
10
10
  *
11
11
  * @generated from service echo.Echoer
12
12
  */
13
13
  export const EchoerDefinition = {
14
- typeName: "echo.Echoer",
14
+ typeName: 'echo.Echoer',
15
15
  methods: {
16
16
  /**
17
17
  * Echo returns the given message.
@@ -19,7 +19,7 @@ export const EchoerDefinition = {
19
19
  * @generated from rpc echo.Echoer.Echo
20
20
  */
21
21
  Echo: {
22
- name: "Echo",
22
+ name: 'Echo',
23
23
  I: EchoMsg,
24
24
  O: EchoMsg,
25
25
  kind: MethodKind.Unary,
@@ -30,7 +30,7 @@ export const EchoerDefinition = {
30
30
  * @generated from rpc echo.Echoer.EchoServerStream
31
31
  */
32
32
  EchoServerStream: {
33
- name: "EchoServerStream",
33
+ name: 'EchoServerStream',
34
34
  I: EchoMsg,
35
35
  O: EchoMsg,
36
36
  kind: MethodKind.ServerStreaming,
@@ -41,7 +41,7 @@ export const EchoerDefinition = {
41
41
  * @generated from rpc echo.Echoer.EchoClientStream
42
42
  */
43
43
  EchoClientStream: {
44
- name: "EchoClientStream",
44
+ name: 'EchoClientStream',
45
45
  I: EchoMsg,
46
46
  O: EchoMsg,
47
47
  kind: MethodKind.ClientStreaming,
@@ -52,7 +52,7 @@ export const EchoerDefinition = {
52
52
  * @generated from rpc echo.Echoer.EchoBidiStream
53
53
  */
54
54
  EchoBidiStream: {
55
- name: "EchoBidiStream",
55
+ name: 'EchoBidiStream',
56
56
  I: EchoMsg,
57
57
  O: EchoMsg,
58
58
  kind: MethodKind.BiDiStreaming,
@@ -63,12 +63,23 @@ export const EchoerDefinition = {
63
63
  * @generated from rpc echo.Echoer.RpcStream
64
64
  */
65
65
  RpcStream: {
66
- name: "RpcStream",
66
+ name: 'RpcStream',
67
67
  I: RpcStreamPacket,
68
68
  O: RpcStreamPacket,
69
69
  kind: MethodKind.BiDiStreaming,
70
70
  },
71
- }
71
+ /**
72
+ * DoNothing does nothing.
73
+ *
74
+ * @generated from rpc echo.Echoer.DoNothing
75
+ */
76
+ DoNothing: {
77
+ name: 'DoNothing',
78
+ I: Empty,
79
+ O: Empty,
80
+ kind: MethodKind.Unary,
81
+ },
82
+ },
72
83
  };
73
84
  export const EchoerServiceName = EchoerDefinition.typeName;
74
85
  export class EchoerClient {
@@ -82,6 +93,7 @@ export class EchoerClient {
82
93
  this.EchoClientStream = this.EchoClientStream.bind(this);
83
94
  this.EchoBidiStream = this.EchoBidiStream.bind(this);
84
95
  this.RpcStream = this.RpcStream.bind(this);
96
+ this.DoNothing = this.DoNothing.bind(this);
85
97
  }
86
98
  /**
87
99
  * Echo returns the given message.
@@ -130,4 +142,14 @@ export class EchoerClient {
130
142
  const result = this.rpc.bidirectionalStreamingRequest(this.service, EchoerDefinition.methods.RpcStream.name, buildEncodeMessageTransform(RpcStreamPacket)(request), abortSignal || undefined);
131
143
  return buildDecodeMessageTransform(RpcStreamPacket)(result);
132
144
  }
145
+ /**
146
+ * DoNothing does nothing.
147
+ *
148
+ * @generated from rpc echo.Echoer.DoNothing
149
+ */
150
+ async DoNothing(request, abortSignal) {
151
+ const requestMsg = Empty.create(request);
152
+ const result = await this.rpc.request(this.service, EchoerDefinition.methods.DoNothing.name, Empty.toBinary(requestMsg), abortSignal || undefined);
153
+ return Empty.fromBinary(result);
154
+ }
133
155
  }
@@ -1,4 +1,4 @@
1
- import { Message } from '@aptre/protobuf-es-lite';
1
+ import { Empty, Message } from '@aptre/protobuf-es-lite';
2
2
  import { EchoMsg } from './echo.pb.js';
3
3
  import { Server } from '../srpc/server.js';
4
4
  import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js';
@@ -12,4 +12,5 @@ export declare class EchoerServer implements Echoer {
12
12
  EchoClientStream(request: MessageStream<EchoMsg>): Promise<Message<EchoMsg>>;
13
13
  EchoBidiStream(request: MessageStream<EchoMsg>): MessageStream<EchoMsg>;
14
14
  RpcStream(request: MessageStream<RpcStreamPacket>): MessageStream<RpcStreamPacket>;
15
+ DoNothing(): Promise<Empty>;
15
16
  }
@@ -40,4 +40,7 @@ export class EchoerServer {
40
40
  return this.proxyServer.rpcStreamHandler;
41
41
  });
42
42
  }
43
+ async DoNothing() {
44
+ return {};
45
+ }
43
46
  }
@@ -1,5 +1,5 @@
1
1
  // Code generated by protoc-gen-go-lite. DO NOT EDIT.
2
- // protoc-gen-go-lite version: v0.6.2
2
+ // protoc-gen-go-lite version: v0.6.5-0.20240516053737-24f165191893
3
3
  // source: github.com/aperturerobotics/starpc/e2e/mock/mock.proto
4
4
 
5
5
  package e2e_mock
@@ -14,6 +14,12 @@ export async function runClientTest(client: Client) {
14
14
  })
15
15
  console.log('success: output', result.body)
16
16
 
17
+ console.log('Calling Echo: unary call with empty request/response...')
18
+ await demoServiceClient.DoNothing({
19
+ body: 'Hello world!',
20
+ })
21
+ console.log('success')
22
+
17
23
  // observable for client requests
18
24
  const clientRequestStream = pushable<Message<EchoMsg>>({
19
25
  objectMode: true,
package/echo/echo.pb.go CHANGED
@@ -1,5 +1,5 @@
1
1
  // Code generated by protoc-gen-go-lite. DO NOT EDIT.
2
- // protoc-gen-go-lite version: v0.6.2
2
+ // protoc-gen-go-lite version: v0.6.5-0.20240516053737-24f165191893
3
3
  // source: github.com/aperturerobotics/starpc/echo/echo.proto
4
4
 
5
5
  package echo
@@ -12,6 +12,7 @@ import (
12
12
 
13
13
  protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
14
14
  json "github.com/aperturerobotics/protobuf-go-lite/json"
15
+ _ "github.com/aperturerobotics/protobuf-go-lite/types/known/emptypb"
15
16
  _ "github.com/aperturerobotics/starpc/rpcstream"
16
17
  )
17
18
 
package/echo/echo.proto CHANGED
@@ -2,6 +2,7 @@ syntax = "proto3";
2
2
  package echo;
3
3
 
4
4
  import "github.com/aperturerobotics/starpc/rpcstream/rpcstream.proto";
5
+ import "google/protobuf/empty.proto";
5
6
 
6
7
  // Echoer service returns the given message.
7
8
  service Echoer {
@@ -15,6 +16,8 @@ service Echoer {
15
16
  rpc EchoBidiStream(stream EchoMsg) returns (stream EchoMsg);
16
17
  // RpcStream opens a nested rpc call stream.
17
18
  rpc RpcStream(stream .rpcstream.RpcStreamPacket) returns (stream .rpcstream.RpcStreamPacket);
19
+ // DoNothing does nothing.
20
+ rpc DoNothing(.google.protobuf.Empty) returns (.google.protobuf.Empty);
18
21
  }
19
22
 
20
23
  // EchoMsg is the message body for Echo.
@@ -7,6 +7,7 @@ package echo
7
7
  import (
8
8
  context "context"
9
9
 
10
+ emptypb "github.com/aperturerobotics/protobuf-go-lite/types/known/emptypb"
10
11
  rpcstream "github.com/aperturerobotics/starpc/rpcstream"
11
12
  srpc "github.com/aperturerobotics/starpc/srpc"
12
13
  )
@@ -19,6 +20,7 @@ type SRPCEchoerClient interface {
19
20
  EchoClientStream(ctx context.Context) (SRPCEchoer_EchoClientStreamClient, error)
20
21
  EchoBidiStream(ctx context.Context) (SRPCEchoer_EchoBidiStreamClient, error)
21
22
  RpcStream(ctx context.Context) (SRPCEchoer_RpcStreamClient, error)
23
+ DoNothing(ctx context.Context, in *emptypb.Empty) (*emptypb.Empty, error)
22
24
  }
23
25
 
24
26
  type srpcEchoerClient struct {
@@ -204,12 +206,22 @@ func (x *srpcEchoer_RpcStreamClient) RecvTo(m *rpcstream.RpcStreamPacket) error
204
206
  return x.MsgRecv(m)
205
207
  }
206
208
 
209
+ func (c *srpcEchoerClient) DoNothing(ctx context.Context, in *emptypb.Empty) (*emptypb.Empty, error) {
210
+ out := new(emptypb.Empty)
211
+ err := c.cc.ExecCall(ctx, c.serviceID, "DoNothing", in, out)
212
+ if err != nil {
213
+ return nil, err
214
+ }
215
+ return out, nil
216
+ }
217
+
207
218
  type SRPCEchoerServer interface {
208
219
  Echo(context.Context, *EchoMsg) (*EchoMsg, error)
209
220
  EchoServerStream(*EchoMsg, SRPCEchoer_EchoServerStreamStream) error
210
221
  EchoClientStream(SRPCEchoer_EchoClientStreamStream) (*EchoMsg, error)
211
222
  EchoBidiStream(SRPCEchoer_EchoBidiStreamStream) error
212
223
  RpcStream(SRPCEchoer_RpcStreamStream) error
224
+ DoNothing(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
213
225
  }
214
226
 
215
227
  type SRPCEchoerUnimplementedServer struct{}
@@ -234,6 +246,10 @@ func (s *SRPCEchoerUnimplementedServer) RpcStream(SRPCEchoer_RpcStreamStream) er
234
246
  return srpc.ErrUnimplemented
235
247
  }
236
248
 
249
+ func (s *SRPCEchoerUnimplementedServer) DoNothing(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
250
+ return nil, srpc.ErrUnimplemented
251
+ }
252
+
237
253
  const SRPCEchoerServiceID = "echo.Echoer"
238
254
 
239
255
  type SRPCEchoerHandler struct {
@@ -265,6 +281,7 @@ func (SRPCEchoerHandler) GetMethodIDs() []string {
265
281
  "EchoClientStream",
266
282
  "EchoBidiStream",
267
283
  "RpcStream",
284
+ "DoNothing",
268
285
  }
269
286
  }
270
287
 
@@ -287,6 +304,8 @@ func (d *SRPCEchoerHandler) InvokeMethod(
287
304
  return true, d.InvokeMethod_EchoBidiStream(d.impl, strm)
288
305
  case "RpcStream":
289
306
  return true, d.InvokeMethod_RpcStream(d.impl, strm)
307
+ case "DoNothing":
308
+ return true, d.InvokeMethod_DoNothing(d.impl, strm)
290
309
  default:
291
310
  return false, nil
292
311
  }
@@ -332,6 +351,18 @@ func (SRPCEchoerHandler) InvokeMethod_RpcStream(impl SRPCEchoerServer, strm srpc
332
351
  return impl.RpcStream(clientStrm)
333
352
  }
334
353
 
354
+ func (SRPCEchoerHandler) InvokeMethod_DoNothing(impl SRPCEchoerServer, strm srpc.Stream) error {
355
+ req := new(emptypb.Empty)
356
+ if err := strm.MsgRecv(req); err != nil {
357
+ return err
358
+ }
359
+ out, err := impl.DoNothing(strm.Context(), req)
360
+ if err != nil {
361
+ return err
362
+ }
363
+ return strm.MsgSend(out)
364
+ }
365
+
335
366
  type SRPCEchoer_EchoStream interface {
336
367
  srpc.Stream
337
368
  }
@@ -458,3 +489,11 @@ func (x *srpcEchoer_RpcStreamStream) Recv() (*rpcstream.RpcStreamPacket, error)
458
489
  func (x *srpcEchoer_RpcStreamStream) RecvTo(m *rpcstream.RpcStreamPacket) error {
459
490
  return x.MsgRecv(m)
460
491
  }
492
+
493
+ type SRPCEchoer_DoNothingStream interface {
494
+ srpc.Stream
495
+ }
496
+
497
+ type srpcEchoer_DoNothingStream struct {
498
+ srpc.Stream
499
+ }
@@ -2,10 +2,15 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import { EchoMsg } from "./echo.pb.js";
6
- import { Message, MethodKind } from "@aptre/protobuf-es-lite";
7
- import { RpcStreamPacket } from "../rpcstream/rpcstream.pb.js";
8
- import { buildDecodeMessageTransform, buildEncodeMessageTransform, MessageStream, ProtoRpc } from "starpc";
5
+ import { EchoMsg } from './echo.pb.js'
6
+ import { Empty, Message, MethodKind } from '@aptre/protobuf-es-lite'
7
+ import { RpcStreamPacket } from '../rpcstream/rpcstream.pb.js'
8
+ import {
9
+ buildDecodeMessageTransform,
10
+ buildEncodeMessageTransform,
11
+ MessageStream,
12
+ ProtoRpc,
13
+ } from 'starpc'
9
14
 
10
15
  /**
11
16
  * Echoer service returns the given message.
@@ -13,7 +18,7 @@ import { buildDecodeMessageTransform, buildEncodeMessageTransform, MessageStream
13
18
  * @generated from service echo.Echoer
14
19
  */
15
20
  export const EchoerDefinition = {
16
- typeName: "echo.Echoer",
21
+ typeName: 'echo.Echoer',
17
22
  methods: {
18
23
  /**
19
24
  * Echo returns the given message.
@@ -21,7 +26,7 @@ export const EchoerDefinition = {
21
26
  * @generated from rpc echo.Echoer.Echo
22
27
  */
23
28
  Echo: {
24
- name: "Echo",
29
+ name: 'Echo',
25
30
  I: EchoMsg,
26
31
  O: EchoMsg,
27
32
  kind: MethodKind.Unary,
@@ -32,7 +37,7 @@ export const EchoerDefinition = {
32
37
  * @generated from rpc echo.Echoer.EchoServerStream
33
38
  */
34
39
  EchoServerStream: {
35
- name: "EchoServerStream",
40
+ name: 'EchoServerStream',
36
41
  I: EchoMsg,
37
42
  O: EchoMsg,
38
43
  kind: MethodKind.ServerStreaming,
@@ -43,7 +48,7 @@ export const EchoerDefinition = {
43
48
  * @generated from rpc echo.Echoer.EchoClientStream
44
49
  */
45
50
  EchoClientStream: {
46
- name: "EchoClientStream",
51
+ name: 'EchoClientStream',
47
52
  I: EchoMsg,
48
53
  O: EchoMsg,
49
54
  kind: MethodKind.ClientStreaming,
@@ -54,7 +59,7 @@ export const EchoerDefinition = {
54
59
  * @generated from rpc echo.Echoer.EchoBidiStream
55
60
  */
56
61
  EchoBidiStream: {
57
- name: "EchoBidiStream",
62
+ name: 'EchoBidiStream',
58
63
  I: EchoMsg,
59
64
  O: EchoMsg,
60
65
  kind: MethodKind.BiDiStreaming,
@@ -65,13 +70,24 @@ export const EchoerDefinition = {
65
70
  * @generated from rpc echo.Echoer.RpcStream
66
71
  */
67
72
  RpcStream: {
68
- name: "RpcStream",
73
+ name: 'RpcStream',
69
74
  I: RpcStreamPacket,
70
75
  O: RpcStreamPacket,
71
76
  kind: MethodKind.BiDiStreaming,
72
77
  },
73
- }
74
- } as const;
78
+ /**
79
+ * DoNothing does nothing.
80
+ *
81
+ * @generated from rpc echo.Echoer.DoNothing
82
+ */
83
+ DoNothing: {
84
+ name: 'DoNothing',
85
+ I: Empty,
86
+ O: Empty,
87
+ kind: MethodKind.Unary,
88
+ },
89
+ },
90
+ } as const
75
91
 
76
92
  /**
77
93
  * Echoer service returns the given message.
@@ -85,9 +101,9 @@ export interface Echoer {
85
101
  * @generated from rpc echo.Echoer.Echo
86
102
  */
87
103
  Echo(
88
- request: Message<EchoMsg>, abortSignal?: AbortSignal
89
- ):
90
- Promise<Message<EchoMsg>>
104
+ request: Message<EchoMsg>,
105
+ abortSignal?: AbortSignal,
106
+ ): Promise<Message<EchoMsg>>
91
107
 
92
108
  /**
93
109
  * EchoServerStream is an example of a server -> client one-way stream.
@@ -95,9 +111,9 @@ Promise<Message<EchoMsg>>
95
111
  * @generated from rpc echo.Echoer.EchoServerStream
96
112
  */
97
113
  EchoServerStream(
98
- request: Message<EchoMsg>, abortSignal?: AbortSignal
99
- ):
100
- MessageStream<EchoMsg>
114
+ request: Message<EchoMsg>,
115
+ abortSignal?: AbortSignal,
116
+ ): MessageStream<EchoMsg>
101
117
 
102
118
  /**
103
119
  * EchoClientStream is an example of client->server one-way stream.
@@ -105,9 +121,9 @@ MessageStream<EchoMsg>
105
121
  * @generated from rpc echo.Echoer.EchoClientStream
106
122
  */
107
123
  EchoClientStream(
108
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
109
- ):
110
- Promise<Message<EchoMsg>>
124
+ request: MessageStream<EchoMsg>,
125
+ abortSignal?: AbortSignal,
126
+ ): Promise<Message<EchoMsg>>
111
127
 
112
128
  /**
113
129
  * EchoBidiStream is an example of a two-way stream.
@@ -115,9 +131,9 @@ Promise<Message<EchoMsg>>
115
131
  * @generated from rpc echo.Echoer.EchoBidiStream
116
132
  */
117
133
  EchoBidiStream(
118
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
119
- ):
120
- MessageStream<EchoMsg>
134
+ request: MessageStream<EchoMsg>,
135
+ abortSignal?: AbortSignal,
136
+ ): MessageStream<EchoMsg>
121
137
 
122
138
  /**
123
139
  * RpcStream opens a nested rpc call stream.
@@ -125,10 +141,19 @@ MessageStream<EchoMsg>
125
141
  * @generated from rpc echo.Echoer.RpcStream
126
142
  */
127
143
  RpcStream(
128
- request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
129
- ):
130
- MessageStream<RpcStreamPacket>
144
+ request: MessageStream<RpcStreamPacket>,
145
+ abortSignal?: AbortSignal,
146
+ ): MessageStream<RpcStreamPacket>
131
147
 
148
+ /**
149
+ * DoNothing does nothing.
150
+ *
151
+ * @generated from rpc echo.Echoer.DoNothing
152
+ */
153
+ DoNothing(
154
+ request: Message<Empty>,
155
+ abortSignal?: AbortSignal,
156
+ ): Promise<Message<Empty>>
132
157
  }
133
158
 
134
159
  export const EchoerServiceName = EchoerDefinition.typeName
@@ -144,6 +169,7 @@ export class EchoerClient implements Echoer {
144
169
  this.EchoClientStream = this.EchoClientStream.bind(this)
145
170
  this.EchoBidiStream = this.EchoBidiStream.bind(this)
146
171
  this.RpcStream = this.RpcStream.bind(this)
172
+ this.DoNothing = this.DoNothing.bind(this)
147
173
  }
148
174
  /**
149
175
  * Echo returns the given message.
@@ -151,9 +177,9 @@ export class EchoerClient implements Echoer {
151
177
  * @generated from rpc echo.Echoer.Echo
152
178
  */
153
179
  async Echo(
154
- request: Message<EchoMsg>, abortSignal?: AbortSignal
155
- ):
156
- Promise<Message<EchoMsg>> {
180
+ request: Message<EchoMsg>,
181
+ abortSignal?: AbortSignal,
182
+ ): Promise<Message<EchoMsg>> {
157
183
  const requestMsg = EchoMsg.create(request)
158
184
  const result = await this.rpc.request(
159
185
  this.service,
@@ -170,9 +196,9 @@ Promise<Message<EchoMsg>> {
170
196
  * @generated from rpc echo.Echoer.EchoServerStream
171
197
  */
172
198
  EchoServerStream(
173
- request: Message<EchoMsg>, abortSignal?: AbortSignal
174
- ):
175
- MessageStream<EchoMsg> {
199
+ request: Message<EchoMsg>,
200
+ abortSignal?: AbortSignal,
201
+ ): MessageStream<EchoMsg> {
176
202
  const requestMsg = EchoMsg.create(request)
177
203
  const result = this.rpc.serverStreamingRequest(
178
204
  this.service,
@@ -189,9 +215,9 @@ MessageStream<EchoMsg> {
189
215
  * @generated from rpc echo.Echoer.EchoClientStream
190
216
  */
191
217
  async EchoClientStream(
192
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
193
- ):
194
- Promise<Message<EchoMsg>> {
218
+ request: MessageStream<EchoMsg>,
219
+ abortSignal?: AbortSignal,
220
+ ): Promise<Message<EchoMsg>> {
195
221
  const result = await this.rpc.clientStreamingRequest(
196
222
  this.service,
197
223
  EchoerDefinition.methods.EchoClientStream.name,
@@ -207,9 +233,9 @@ Promise<Message<EchoMsg>> {
207
233
  * @generated from rpc echo.Echoer.EchoBidiStream
208
234
  */
209
235
  EchoBidiStream(
210
- request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
211
- ):
212
- MessageStream<EchoMsg> {
236
+ request: MessageStream<EchoMsg>,
237
+ abortSignal?: AbortSignal,
238
+ ): MessageStream<EchoMsg> {
213
239
  const result = this.rpc.bidirectionalStreamingRequest(
214
240
  this.service,
215
241
  EchoerDefinition.methods.EchoBidiStream.name,
@@ -225,9 +251,9 @@ MessageStream<EchoMsg> {
225
251
  * @generated from rpc echo.Echoer.RpcStream
226
252
  */
227
253
  RpcStream(
228
- request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
229
- ):
230
- MessageStream<RpcStreamPacket> {
254
+ request: MessageStream<RpcStreamPacket>,
255
+ abortSignal?: AbortSignal,
256
+ ): MessageStream<RpcStreamPacket> {
231
257
  const result = this.rpc.bidirectionalStreamingRequest(
232
258
  this.service,
233
259
  EchoerDefinition.methods.RpcStream.name,
@@ -237,4 +263,22 @@ MessageStream<RpcStreamPacket> {
237
263
  return buildDecodeMessageTransform(RpcStreamPacket)(result)
238
264
  }
239
265
 
266
+ /**
267
+ * DoNothing does nothing.
268
+ *
269
+ * @generated from rpc echo.Echoer.DoNothing
270
+ */
271
+ async DoNothing(
272
+ request: Message<Empty>,
273
+ abortSignal?: AbortSignal,
274
+ ): Promise<Message<Empty>> {
275
+ const requestMsg = Empty.create(request)
276
+ const result = await this.rpc.request(
277
+ this.service,
278
+ EchoerDefinition.methods.DoNothing.name,
279
+ Empty.toBinary(requestMsg),
280
+ abortSignal || undefined,
281
+ )
282
+ return Empty.fromBinary(result)
283
+ }
240
284
  }
package/echo/server.go CHANGED
@@ -6,6 +6,7 @@ import (
6
6
  "io"
7
7
  "time"
8
8
 
9
+ "github.com/aperturerobotics/protobuf-go-lite/types/known/emptypb"
9
10
  rpcstream "github.com/aperturerobotics/starpc/rpcstream"
10
11
  srpc "github.com/aperturerobotics/starpc/srpc"
11
12
  )
@@ -87,5 +88,10 @@ func (r *EchoServer) RpcStream(stream SRPCEchoer_RpcStreamStream) error {
87
88
  })
88
89
  }
89
90
 
91
+ // DoNothing does nothing.
92
+ func (r *EchoServer) DoNothing(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
93
+ return &emptypb.Empty{}, nil
94
+ }
95
+
90
96
  // _ is a type assertion
91
97
  var _ SRPCEchoerServer = ((*EchoServer)(nil))
package/echo/server.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import first from 'it-first'
2
- import { Message } from '@aptre/protobuf-es-lite'
2
+ import { Empty, Message } from '@aptre/protobuf-es-lite'
3
3
  import { EchoMsg } from './echo.pb.js'
4
4
  import { Server } from '../srpc/server.js'
5
5
  import { messagePushable, writeToPushable } from '../srpc/pushable.js'
@@ -62,4 +62,8 @@ export class EchoerServer implements Echoer {
62
62
  },
63
63
  )
64
64
  }
65
+
66
+ public async DoNothing(): Promise<Empty> {
67
+ return {}
68
+ }
65
69
  }
package/go.mod CHANGED
@@ -2,30 +2,32 @@ module github.com/aperturerobotics/starpc
2
2
 
3
3
  go 1.22
4
4
 
5
- // Optional: this fork uses go-protobuf-lite.
6
- replace github.com/libp2p/go-libp2p => github.com/aperturerobotics/go-libp2p v0.33.1-0.20240504075939-591fc65373be // aperture
5
+ // This fork uses go-protobuf-lite and adds post-quantum crypto support.
6
+ replace github.com/libp2p/go-libp2p => github.com/aperturerobotics/go-libp2p v0.33.1-0.20240511072027-002c32698a19 // aperture
7
7
 
8
- // Optional: this fork avoids importing net/http on wasm.
8
+ // This fork uses go-protobuf-lite.
9
+ replace github.com/libp2p/go-msgio => github.com/aperturerobotics/go-libp2p-msgio v0.0.0-20240511033615-1b69178aa5c8 // aperture
10
+
11
+ // This fork avoids importing net/http on wasm.
9
12
  replace nhooyr.io/websocket => github.com/paralin/nhooyr-websocket v1.8.12-0.20240504231911-2358de657064 // aperture-1
10
13
 
11
14
  require (
12
- github.com/aperturerobotics/protobuf-go-lite v0.6.3 // latest
15
+ github.com/aperturerobotics/protobuf-go-lite v0.6.5 // latest
13
16
  github.com/aperturerobotics/util v1.23.1 // latest
14
17
  )
15
18
 
16
19
  require (
17
20
  github.com/libp2p/go-libp2p v0.33.2 // latest
18
21
  github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48 // master
22
+ github.com/pkg/errors v0.9.1 // latest
19
23
  github.com/sirupsen/logrus v1.9.3 // latest
20
24
  google.golang.org/protobuf v1.34.1 // latest
21
25
  nhooyr.io/websocket v1.8.11 // latest
22
26
  )
23
27
 
24
- require github.com/pkg/errors v0.9.1
25
-
26
28
  require (
27
29
  github.com/aperturerobotics/json-iterator-lite v1.0.0 // indirect
28
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
30
+ github.com/cloudflare/circl v1.3.8 // indirect
29
31
  github.com/ipfs/go-cid v0.4.1 // indirect
30
32
  github.com/klauspost/cpuid/v2 v2.2.7 // indirect
31
33
  github.com/libp2p/go-buffer-pool v0.1.0 // indirect
@@ -35,7 +37,6 @@ require (
35
37
  github.com/multiformats/go-base36 v0.2.0 // indirect
36
38
  github.com/multiformats/go-multiaddr v0.12.3 // indirect
37
39
  github.com/multiformats/go-multibase v0.2.0 // indirect
38
- github.com/multiformats/go-multicodec v0.9.0 // indirect
39
40
  github.com/multiformats/go-multihash v0.2.3 // indirect
40
41
  github.com/multiformats/go-multistream v0.5.0 // indirect
41
42
  github.com/multiformats/go-varint v0.0.7 // indirect
package/go.sum CHANGED
@@ -1,18 +1,16 @@
1
- github.com/aperturerobotics/go-libp2p v0.33.1-0.20240504075939-591fc65373be h1:PZi7dbdjWqHa0TE1lD0f5WxzshL/qPp9fZ1K55fGo1c=
2
- github.com/aperturerobotics/go-libp2p v0.33.1-0.20240504075939-591fc65373be/go.mod h1:gA6iEEVpQcx0xpygG/U0wkm+DfII4zoPc3EWViXC5b0=
1
+ github.com/aperturerobotics/go-libp2p v0.33.1-0.20240511072027-002c32698a19 h1:ZpnWhPCmYo//h1Jx9iOGPGG1cbFRM7Ij+ms+mCK6RUo=
2
+ github.com/aperturerobotics/go-libp2p v0.33.1-0.20240511072027-002c32698a19/go.mod h1:/TIElEA8TzmHQTgGJQyzg0zHNZRCMYbdKyOsKwn9i6E=
3
3
  github.com/aperturerobotics/json-iterator-lite v1.0.0 h1:cihbrYWoK/S2RYXhJLpDZd+GUjVvFJN+D3w1VOqqHRI=
4
4
  github.com/aperturerobotics/json-iterator-lite v1.0.0/go.mod h1:snaApCEDtrHHP6UWSLKiYNOZU9A5NyzccKenx9oZEzg=
5
- github.com/aperturerobotics/protobuf-go-lite v0.6.3 h1:AZ821ntYqzCpq6jE5rWJwJLikYbaa63Nka7YfW9EJdE=
6
- github.com/aperturerobotics/protobuf-go-lite v0.6.3/go.mod h1:YTbfnUj3feSULhs8VgepAHFnF3wUc0CPj4jd2axy21I=
5
+ github.com/aperturerobotics/protobuf-go-lite v0.6.5 h1:AuPPcZ7ZaJe9ZYYC4gF7/5/Xbn9Mt9uXyV3+ADWy+Ys=
6
+ github.com/aperturerobotics/protobuf-go-lite v0.6.5/go.mod h1:YTbfnUj3feSULhs8VgepAHFnF3wUc0CPj4jd2axy21I=
7
7
  github.com/aperturerobotics/util v1.23.1 h1:pEeBrN5UUNy83OFyv9d7BQod8O++j5ZwIkEuYGdpRXw=
8
8
  github.com/aperturerobotics/util v1.23.1/go.mod h1:dO8P8Ut5xNPpLrPPpn7kM/aJL+qT20C5Ppcs1GE0VNg=
9
+ github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI=
10
+ github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
9
11
  github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
10
12
  github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
11
13
  github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12
- github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y=
13
- github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
14
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
15
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
16
14
  github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
17
15
  github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
18
16
  github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
@@ -37,8 +35,6 @@ github.com/multiformats/go-multiaddr v0.12.3 h1:hVBXvPRcKG0w80VinQ23P5t7czWgg65B
37
35
  github.com/multiformats/go-multiaddr v0.12.3/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII=
38
36
  github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g=
39
37
  github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk=
40
- github.com/multiformats/go-multicodec v0.9.0 h1:pb/dlPnzee/Sxv/j4PmkDRxCOi3hXTz3IbPKOXWJkmg=
41
- github.com/multiformats/go-multicodec v0.9.0/go.mod h1:L3QTQvMIaVBkXOXXtVmYE+LI16i14xuaojr/H7Ai54k=
42
38
  github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U=
43
39
  github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM=
44
40
  github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf/QGkvOGQAyiE=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.32.7",
3
+ "version": "0.32.9",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -82,22 +82,22 @@
82
82
  "./{srpc,echo,e2e,integration,rpcstream,cmd}/**/(*.ts|*.tsx|*.html|*.css)": "prettier --config .prettierrc.yaml --write"
83
83
  },
84
84
  "devDependencies": {
85
- "@typescript-eslint/eslint-plugin": "^7.8.0",
86
- "@typescript-eslint/parser": "^7.8.0",
85
+ "@typescript-eslint/eslint-plugin": "^7.9.0",
86
+ "@typescript-eslint/parser": "^7.9.0",
87
87
  "depcheck": "^1.4.6",
88
- "esbuild": "^0.21.0",
88
+ "esbuild": "^0.21.3",
89
89
  "eslint": "^9.1.1",
90
90
  "eslint-config-prettier": "^9.1.0",
91
91
  "lint-staged": "^15.2.2",
92
92
  "pre-commit": "^1.2.2",
93
93
  "prettier": "^3.2.4",
94
- "rimraf": "^5.0.6",
95
- "tsx": "^4.9.4",
94
+ "rimraf": "^5.0.7",
95
+ "tsx": "^4.10.2",
96
96
  "typescript": "^5.3.2"
97
97
  },
98
98
  "dependencies": {
99
99
  "@aptre/it-ws": "^1.0.0",
100
- "@aptre/protobuf-es-lite": "^0.4.3",
100
+ "@aptre/protobuf-es-lite": "^0.4.4",
101
101
  "@chainsafe/libp2p-yamux": "^6.0.2",
102
102
  "@libp2p/interface": "^1.3.1",
103
103
  "@libp2p/logger": "^4.0.12",
@@ -1,5 +1,5 @@
1
1
  // Code generated by protoc-gen-go-lite. DO NOT EDIT.
2
- // protoc-gen-go-lite version: v0.6.2
2
+ // protoc-gen-go-lite version: v0.6.5-0.20240516053737-24f165191893
3
3
  // source: github.com/aperturerobotics/starpc/srpc/rpcproto.proto
4
4
 
5
5
  package srpc