starpc 0.31.3 → 0.31.5

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
@@ -1,4 +1,4 @@
1
- # https://github.com/aperturerobotics/protobuf-project
1
+ # https://github.com/aperturerobotics/template
2
2
 
3
3
  SHELL:=bash
4
4
  PROTOWRAP=hack/bin/protowrap
@@ -8,7 +8,6 @@ GOIMPORTS=hack/bin/goimports
8
8
  GOFUMPT=hack/bin/gofumpt
9
9
  GOLANGCI_LINT=hack/bin/golangci-lint
10
10
  GO_MOD_OUTDATED=hack/bin/go-mod-outdated
11
- ESBUILD=hack/bin/esbuild
12
11
  GOLIST=go list -f "{{ .Dir }}" -m
13
12
 
14
13
  export GO111MODULE=on
@@ -62,12 +61,6 @@ $(PROTOC_GEN_STARPC):
62
61
  -o ./bin/protoc-gen-go-starpc \
63
62
  github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc
64
63
 
65
- $(ESBUILD):
66
- cd ./hack; \
67
- go build -v \
68
- -o ./bin/esbuild \
69
- github.com/evanw/esbuild/cmd/esbuild
70
-
71
64
  node_modules:
72
65
  yarn install
73
66
 
@@ -77,17 +70,18 @@ genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTO
77
70
  set -eo pipefail; \
78
71
  export PROJECT=$$(go list -m); \
79
72
  export PATH=$$(pwd)/hack/bin:$${PATH}; \
80
- export OUT=$$(pwd)/vendor; \
73
+ export OUT=./vendor; \
81
74
  mkdir -p $${OUT}/$$(dirname $${PROJECT}); \
82
- rm $$(pwd)/vendor/$${PROJECT} || true; \
83
- ln -s $$(pwd) $$(pwd)/vendor/$${PROJECT} ; \
75
+ rm ./vendor/$${PROJECT} || true; \
76
+ ln -s $$(pwd) ./vendor/$${PROJECT} ; \
84
77
  protogen() { \
78
+ PROTO_FILES=$$(git ls-files "$$1"); \
85
79
  $(PROTOWRAP) \
86
80
  -I $${OUT} \
87
81
  --plugin=./node_modules/.bin/protoc-gen-es \
88
82
  --plugin=./cmd/protoc-gen-es-starpc/dev/protoc-gen-es-starpc \
89
83
  --go-lite_out=$${OUT} \
90
- --go-lite_opt=features=marshal+unmarshal+size+equal+json+clone \
84
+ --go-lite_opt=features=marshal+unmarshal+size+equal+json+clone+text \
91
85
  --go-starpc_out=$${OUT} \
92
86
  --es_out=$${OUT} \
93
87
  --es_opt target=ts \
@@ -98,16 +92,33 @@ genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTO
98
92
  --proto_path $${OUT} \
99
93
  --print_structure \
100
94
  --only_specified_files \
101
- $$(\
102
- git \
103
- ls-files "$$1" |\
104
- xargs printf -- \
105
- "$$(pwd)/vendor/$${PROJECT}/%s "); \
95
+ $$(echo "$$PROTO_FILES" | xargs printf -- "./vendor/$${PROJECT}/%s "); \
96
+ for proto_file in $${PROTO_FILES}; do \
97
+ proto_dir=$$(dirname $$proto_file); \
98
+ proto_name=$${proto_file%".proto"}; \
99
+ TS_FILES=$$(git ls-files ":(glob)$${proto_dir}/${proto_name}*_pb.ts"); \
100
+ if [ -z "$$TS_FILES" ]; then continue; fi; \
101
+ for ts_file in $${TS_FILES}; do \
102
+ prettier -w $$ts_file; \
103
+ ts_file_dir=$$(dirname $$ts_file); \
104
+ relative_path=$${ts_file_dir#"./"}; \
105
+ depth=$$(echo $$relative_path | awk -F/ '{print NF+1}'); \
106
+ prefix=$$(printf '../%0.s' $$(seq 1 $$depth)); \
107
+ istmts=$$(grep -oE "from\s+\"$$prefix[^\"]+\"" $$ts_file) || continue; \
108
+ if [ -z "$$istmts" ]; then continue; fi; \
109
+ ipaths=$$(echo "$$istmts" | awk -F'"' '{print $$2}'); \
110
+ for import_path in $$ipaths; do \
111
+ rel_import_path=$$(realpath -s --relative-to=./vendor \
112
+ "./vendor/$${PROJECT}/$${ts_file_dir}/$${import_path}"); \
113
+ go_import_path=$$(echo $$rel_import_path | sed -e "s|^|@go/|"); \
114
+ sed -i -e "s|$$import_path|$$go_import_path|g" $$ts_file; \
115
+ done; \
116
+ done; \
117
+ done; \
106
118
  }; \
107
119
  protogen "./*.proto"; \
108
- rm $$(pwd)/vendor/$${PROJECT} || true
120
+ rm -f ./vendor/$${PROJECT}
109
121
  $(GOIMPORTS) -w ./
110
- npm run format:js
111
122
 
112
123
  .PHONY: gen
113
124
  gen: genproto
@@ -136,7 +147,3 @@ test:
136
147
  format: $(GOFUMPT) $(GOIMPORTS)
137
148
  $(GOIMPORTS) -w ./
138
149
  $(GOFUMPT) -w ./
139
-
140
- .PHONY: integration
141
- integration: node_modules vendor
142
- cd ./integration && bash ./integration.bash
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
4
  import { Message, proto3 } from '@bufbuild/protobuf';
@@ -1,7 +1,7 @@
1
- import { MockMsg } from './mock_pb.js';
2
- import type { PartialMessage } from '@bufbuild/protobuf';
3
- import { MethodKind } from '@bufbuild/protobuf';
4
- import { ProtoRpc } from 'starpc';
1
+ import { MockMsg } from "./mock_pb.js";
2
+ import type { PartialMessage } from "@bufbuild/protobuf";
3
+ import { MethodKind } from "@bufbuild/protobuf";
4
+ import { ProtoRpc } from "starpc";
5
5
  /**
6
6
  * Mock service mocks some RPCs for the e2e tests.
7
7
  *
@@ -1,15 +1,15 @@
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/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
- import { MockMsg } from './mock_pb.js';
5
- import { MethodKind } from '@bufbuild/protobuf';
4
+ import { MockMsg } from "./mock_pb.js";
5
+ import { MethodKind } from "@bufbuild/protobuf";
6
6
  /**
7
7
  * Mock service mocks some RPCs for the e2e tests.
8
8
  *
9
9
  * @generated from service e2e.mock.Mock
10
10
  */
11
11
  export const MockDefinition = {
12
- typeName: 'e2e.mock.Mock',
12
+ typeName: "e2e.mock.Mock",
13
13
  methods: {
14
14
  /**
15
15
  * MockRequest runs a mock unary request.
@@ -17,12 +17,12 @@ export const MockDefinition = {
17
17
  * @generated from rpc e2e.mock.Mock.MockRequest
18
18
  */
19
19
  MockRequest: {
20
- name: 'MockRequest',
20
+ name: "MockRequest",
21
21
  I: MockMsg,
22
22
  O: MockMsg,
23
23
  kind: MethodKind.Unary,
24
24
  },
25
- },
25
+ }
26
26
  };
27
27
  export const MockServiceName = MockDefinition.typeName;
28
28
  export class MockClient {
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 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
4
  import { Message, proto3 } from '@bufbuild/protobuf';
@@ -1,8 +1,8 @@
1
- import { EchoMsg } from './echo_pb.js';
2
- import type { PartialMessage } from '@bufbuild/protobuf';
3
- import { MethodKind } from '@bufbuild/protobuf';
4
- import { RpcStreamPacket } from '../rpcstream/rpcstream_pb.js';
5
- import { MessageStream, ProtoRpc } from 'starpc';
1
+ import { EchoMsg } from "./echo_pb.js";
2
+ import type { PartialMessage } from "@bufbuild/protobuf";
3
+ import { MethodKind } from "@bufbuild/protobuf";
4
+ import { RpcStreamPacket } from "../rpcstream/rpcstream_pb.js";
5
+ import { MessageStream, ProtoRpc } from "starpc";
6
6
  /**
7
7
  * Echoer service returns the given message.
8
8
  *
@@ -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 '@bufbuild/protobuf';
6
- import { RpcStreamPacket } from '../rpcstream/rpcstream_pb.js';
7
- import { buildDecodeMessageTransform, buildEncodeMessageTransform, } from 'starpc';
4
+ import { EchoMsg } from "./echo_pb.js";
5
+ import { MethodKind } from "@bufbuild/protobuf";
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,12 @@ 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
72
  };
73
73
  export const EchoerServiceName = EchoerDefinition.typeName;
74
74
  export class EchoerClient {
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/rpcstream/rpcstream.proto (package rpcstream, syntax proto3)
3
3
  /* eslint-disable */
4
4
  import { Message, proto3 } from '@bufbuild/protobuf';
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/srpc/rpcproto.proto (package srpc, syntax proto3)
3
3
  /* eslint-disable */
4
4
  import { Message, proto3 } from '@bufbuild/protobuf';
@@ -1,11 +1,13 @@
1
1
  // Code generated by protoc-gen-go-lite. DO NOT EDIT.
2
- // protoc-gen-go-lite version: v0.4.9-0.20240422083358-2771ae1ac3df
2
+ // protoc-gen-go-lite version: v0.5.0
3
3
  // source: github.com/aperturerobotics/starpc/e2e/mock/mock.proto
4
4
 
5
5
  package e2e_mock
6
6
 
7
7
  import (
8
8
  io "io"
9
+ strconv "strconv"
10
+ strings "strings"
9
11
 
10
12
  protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
11
13
  json "github.com/aperturerobotics/protobuf-go-lite/json"
@@ -164,6 +166,19 @@ func (m *MockMsg) SizeVT() (n int) {
164
166
  return n
165
167
  }
166
168
 
169
+ func (x *MockMsg) MarshalProtoText() string {
170
+ var sb strings.Builder
171
+ sb.WriteString("MockMsg { ")
172
+ if x.Body != "" {
173
+ sb.WriteString(" body: ")
174
+ sb.WriteString(strconv.Quote(x.Body))
175
+ }
176
+ sb.WriteString("}")
177
+ return sb.String()
178
+ }
179
+ func (x *MockMsg) String() string {
180
+ return x.MarshalProtoText()
181
+ }
167
182
  func (m *MockMsg) UnmarshalVT(dAtA []byte) error {
168
183
  l := len(dAtA)
169
184
  iNdEx := 0
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
@@ -2,10 +2,10 @@
2
2
  // @generated from file github.com/aperturerobotics/starpc/e2e/mock/mock.proto (package e2e.mock, syntax proto3)
3
3
  /* eslint-disable */
4
4
 
5
- import { MockMsg } from './mock_pb.js'
6
- import type { PartialMessage } from '@bufbuild/protobuf'
7
- import { MethodKind } from '@bufbuild/protobuf'
8
- import { ProtoRpc } from 'starpc'
5
+ import { MockMsg } from "./mock_pb.js";
6
+ import type { PartialMessage } from "@bufbuild/protobuf";
7
+ import { MethodKind } from "@bufbuild/protobuf";
8
+ import { ProtoRpc } from "starpc";
9
9
 
10
10
  /**
11
11
  * Mock service mocks some RPCs for the e2e tests.
@@ -13,7 +13,7 @@ import { ProtoRpc } from 'starpc'
13
13
  * @generated from service e2e.mock.Mock
14
14
  */
15
15
  export const MockDefinition = {
16
- typeName: 'e2e.mock.Mock',
16
+ typeName: "e2e.mock.Mock",
17
17
  methods: {
18
18
  /**
19
19
  * MockRequest runs a mock unary request.
@@ -21,13 +21,13 @@ export const MockDefinition = {
21
21
  * @generated from rpc e2e.mock.Mock.MockRequest
22
22
  */
23
23
  MockRequest: {
24
- name: 'MockRequest',
24
+ name: "MockRequest",
25
25
  I: MockMsg,
26
26
  O: MockMsg,
27
27
  kind: MethodKind.Unary,
28
28
  },
29
- },
30
- } as const
29
+ }
30
+ } as const;
31
31
 
32
32
  /**
33
33
  * Mock service mocks some RPCs for the e2e tests.
@@ -41,9 +41,10 @@ export interface Mock {
41
41
  * @generated from rpc e2e.mock.Mock.MockRequest
42
42
  */
43
43
  MockRequest(
44
- request: PartialMessage<MockMsg>,
45
- abortSignal?: AbortSignal,
46
- ): Promise<PartialMessage<MockMsg>>
44
+ request: PartialMessage<MockMsg>, abortSignal?: AbortSignal
45
+ ):
46
+ Promise<PartialMessage<MockMsg>>
47
+
47
48
  }
48
49
 
49
50
  export const MockServiceName = MockDefinition.typeName
@@ -62,9 +63,9 @@ export class MockClient implements Mock {
62
63
  * @generated from rpc e2e.mock.Mock.MockRequest
63
64
  */
64
65
  async MockRequest(
65
- request: PartialMessage<MockMsg>,
66
- abortSignal?: AbortSignal,
67
- ): Promise<PartialMessage<MockMsg>> {
66
+ request: PartialMessage<MockMsg>, abortSignal?: AbortSignal
67
+ ):
68
+ Promise<PartialMessage<MockMsg>> {
68
69
  const requestMsg = new MockMsg(request)
69
70
  const result = await this.rpc.request(
70
71
  this.service,
@@ -74,4 +75,5 @@ export class MockClient implements Mock {
74
75
  )
75
76
  return MockMsg.fromBinary(result)
76
77
  }
78
+
77
79
  }
package/echo/echo.pb.go CHANGED
@@ -1,11 +1,13 @@
1
1
  // Code generated by protoc-gen-go-lite. DO NOT EDIT.
2
- // protoc-gen-go-lite version: v0.4.9-0.20240422083358-2771ae1ac3df
2
+ // protoc-gen-go-lite version: v0.5.0
3
3
  // source: github.com/aperturerobotics/starpc/echo/echo.proto
4
4
 
5
5
  package echo
6
6
 
7
7
  import (
8
8
  io "io"
9
+ strconv "strconv"
10
+ strings "strings"
9
11
 
10
12
  protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
11
13
  json "github.com/aperturerobotics/protobuf-go-lite/json"
@@ -165,6 +167,19 @@ func (m *EchoMsg) SizeVT() (n int) {
165
167
  return n
166
168
  }
167
169
 
170
+ func (x *EchoMsg) MarshalProtoText() string {
171
+ var sb strings.Builder
172
+ sb.WriteString("EchoMsg { ")
173
+ if x.Body != "" {
174
+ sb.WriteString(" body: ")
175
+ sb.WriteString(strconv.Quote(x.Body))
176
+ }
177
+ sb.WriteString("}")
178
+ return sb.String()
179
+ }
180
+ func (x *EchoMsg) String() string {
181
+ return x.MarshalProtoText()
182
+ }
168
183
  func (m *EchoMsg) UnmarshalVT(dAtA []byte) error {
169
184
  l := len(dAtA)
170
185
  iNdEx := 0
package/echo/echo_pb.ts CHANGED
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 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
4
 
@@ -2,16 +2,11 @@
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 type { PartialMessage } from '@bufbuild/protobuf'
7
- import { MethodKind } from '@bufbuild/protobuf'
8
- import { RpcStreamPacket } from '../rpcstream/rpcstream_pb.js'
9
- import {
10
- buildDecodeMessageTransform,
11
- buildEncodeMessageTransform,
12
- MessageStream,
13
- ProtoRpc,
14
- } from 'starpc'
5
+ import { EchoMsg } from "./echo_pb.js";
6
+ import type { PartialMessage } from "@bufbuild/protobuf";
7
+ import { MethodKind } from "@bufbuild/protobuf";
8
+ import { RpcStreamPacket } from "../rpcstream/rpcstream_pb.js";
9
+ import { buildDecodeMessageTransform, buildEncodeMessageTransform, MessageStream, ProtoRpc } from "starpc";
15
10
 
16
11
  /**
17
12
  * Echoer service returns the given message.
@@ -19,7 +14,7 @@ import {
19
14
  * @generated from service echo.Echoer
20
15
  */
21
16
  export const EchoerDefinition = {
22
- typeName: 'echo.Echoer',
17
+ typeName: "echo.Echoer",
23
18
  methods: {
24
19
  /**
25
20
  * Echo returns the given message.
@@ -27,7 +22,7 @@ export const EchoerDefinition = {
27
22
  * @generated from rpc echo.Echoer.Echo
28
23
  */
29
24
  Echo: {
30
- name: 'Echo',
25
+ name: "Echo",
31
26
  I: EchoMsg,
32
27
  O: EchoMsg,
33
28
  kind: MethodKind.Unary,
@@ -38,7 +33,7 @@ export const EchoerDefinition = {
38
33
  * @generated from rpc echo.Echoer.EchoServerStream
39
34
  */
40
35
  EchoServerStream: {
41
- name: 'EchoServerStream',
36
+ name: "EchoServerStream",
42
37
  I: EchoMsg,
43
38
  O: EchoMsg,
44
39
  kind: MethodKind.ServerStreaming,
@@ -49,7 +44,7 @@ export const EchoerDefinition = {
49
44
  * @generated from rpc echo.Echoer.EchoClientStream
50
45
  */
51
46
  EchoClientStream: {
52
- name: 'EchoClientStream',
47
+ name: "EchoClientStream",
53
48
  I: EchoMsg,
54
49
  O: EchoMsg,
55
50
  kind: MethodKind.ClientStreaming,
@@ -60,7 +55,7 @@ export const EchoerDefinition = {
60
55
  * @generated from rpc echo.Echoer.EchoBidiStream
61
56
  */
62
57
  EchoBidiStream: {
63
- name: 'EchoBidiStream',
58
+ name: "EchoBidiStream",
64
59
  I: EchoMsg,
65
60
  O: EchoMsg,
66
61
  kind: MethodKind.BiDiStreaming,
@@ -71,13 +66,13 @@ export const EchoerDefinition = {
71
66
  * @generated from rpc echo.Echoer.RpcStream
72
67
  */
73
68
  RpcStream: {
74
- name: 'RpcStream',
69
+ name: "RpcStream",
75
70
  I: RpcStreamPacket,
76
71
  O: RpcStreamPacket,
77
72
  kind: MethodKind.BiDiStreaming,
78
73
  },
79
- },
80
- } as const
74
+ }
75
+ } as const;
81
76
 
82
77
  /**
83
78
  * Echoer service returns the given message.
@@ -91,9 +86,9 @@ export interface Echoer {
91
86
  * @generated from rpc echo.Echoer.Echo
92
87
  */
93
88
  Echo(
94
- request: PartialMessage<EchoMsg>,
95
- abortSignal?: AbortSignal,
96
- ): Promise<PartialMessage<EchoMsg>>
89
+ request: PartialMessage<EchoMsg>, abortSignal?: AbortSignal
90
+ ):
91
+ Promise<PartialMessage<EchoMsg>>
97
92
 
98
93
  /**
99
94
  * EchoServerStream is an example of a server -> client one-way stream.
@@ -101,9 +96,9 @@ export interface Echoer {
101
96
  * @generated from rpc echo.Echoer.EchoServerStream
102
97
  */
103
98
  EchoServerStream(
104
- request: PartialMessage<EchoMsg>,
105
- abortSignal?: AbortSignal,
106
- ): MessageStream<EchoMsg>
99
+ request: PartialMessage<EchoMsg>, abortSignal?: AbortSignal
100
+ ):
101
+ MessageStream<EchoMsg>
107
102
 
108
103
  /**
109
104
  * EchoClientStream is an example of client->server one-way stream.
@@ -111,9 +106,9 @@ export interface Echoer {
111
106
  * @generated from rpc echo.Echoer.EchoClientStream
112
107
  */
113
108
  EchoClientStream(
114
- request: MessageStream<EchoMsg>,
115
- abortSignal?: AbortSignal,
116
- ): Promise<PartialMessage<EchoMsg>>
109
+ request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
110
+ ):
111
+ Promise<PartialMessage<EchoMsg>>
117
112
 
118
113
  /**
119
114
  * EchoBidiStream is an example of a two-way stream.
@@ -121,9 +116,9 @@ export interface Echoer {
121
116
  * @generated from rpc echo.Echoer.EchoBidiStream
122
117
  */
123
118
  EchoBidiStream(
124
- request: MessageStream<EchoMsg>,
125
- abortSignal?: AbortSignal,
126
- ): MessageStream<EchoMsg>
119
+ request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
120
+ ):
121
+ MessageStream<EchoMsg>
127
122
 
128
123
  /**
129
124
  * RpcStream opens a nested rpc call stream.
@@ -131,9 +126,10 @@ export interface Echoer {
131
126
  * @generated from rpc echo.Echoer.RpcStream
132
127
  */
133
128
  RpcStream(
134
- request: MessageStream<RpcStreamPacket>,
135
- abortSignal?: AbortSignal,
136
- ): MessageStream<RpcStreamPacket>
129
+ request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
130
+ ):
131
+ MessageStream<RpcStreamPacket>
132
+
137
133
  }
138
134
 
139
135
  export const EchoerServiceName = EchoerDefinition.typeName
@@ -156,9 +152,9 @@ export class EchoerClient implements Echoer {
156
152
  * @generated from rpc echo.Echoer.Echo
157
153
  */
158
154
  async Echo(
159
- request: PartialMessage<EchoMsg>,
160
- abortSignal?: AbortSignal,
161
- ): Promise<PartialMessage<EchoMsg>> {
155
+ request: PartialMessage<EchoMsg>, abortSignal?: AbortSignal
156
+ ):
157
+ Promise<PartialMessage<EchoMsg>> {
162
158
  const requestMsg = new EchoMsg(request)
163
159
  const result = await this.rpc.request(
164
160
  this.service,
@@ -175,9 +171,9 @@ export class EchoerClient implements Echoer {
175
171
  * @generated from rpc echo.Echoer.EchoServerStream
176
172
  */
177
173
  EchoServerStream(
178
- request: PartialMessage<EchoMsg>,
179
- abortSignal?: AbortSignal,
180
- ): MessageStream<EchoMsg> {
174
+ request: PartialMessage<EchoMsg>, abortSignal?: AbortSignal
175
+ ):
176
+ MessageStream<EchoMsg> {
181
177
  const requestMsg = new EchoMsg(request)
182
178
  const result = this.rpc.serverStreamingRequest(
183
179
  this.service,
@@ -194,9 +190,9 @@ export class EchoerClient implements Echoer {
194
190
  * @generated from rpc echo.Echoer.EchoClientStream
195
191
  */
196
192
  async EchoClientStream(
197
- request: MessageStream<EchoMsg>,
198
- abortSignal?: AbortSignal,
199
- ): Promise<PartialMessage<EchoMsg>> {
193
+ request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
194
+ ):
195
+ Promise<PartialMessage<EchoMsg>> {
200
196
  const result = await this.rpc.clientStreamingRequest(
201
197
  this.service,
202
198
  EchoerDefinition.methods.EchoClientStream.name,
@@ -212,9 +208,9 @@ export class EchoerClient implements Echoer {
212
208
  * @generated from rpc echo.Echoer.EchoBidiStream
213
209
  */
214
210
  EchoBidiStream(
215
- request: MessageStream<EchoMsg>,
216
- abortSignal?: AbortSignal,
217
- ): MessageStream<EchoMsg> {
211
+ request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
212
+ ):
213
+ MessageStream<EchoMsg> {
218
214
  const result = this.rpc.bidirectionalStreamingRequest(
219
215
  this.service,
220
216
  EchoerDefinition.methods.EchoBidiStream.name,
@@ -230,9 +226,9 @@ export class EchoerClient implements Echoer {
230
226
  * @generated from rpc echo.Echoer.RpcStream
231
227
  */
232
228
  RpcStream(
233
- request: MessageStream<RpcStreamPacket>,
234
- abortSignal?: AbortSignal,
235
- ): MessageStream<RpcStreamPacket> {
229
+ request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
230
+ ):
231
+ MessageStream<RpcStreamPacket> {
236
232
  const result = this.rpc.bidirectionalStreamingRequest(
237
233
  this.service,
238
234
  EchoerDefinition.methods.RpcStream.name,
@@ -241,4 +237,5 @@ export class EchoerClient implements Echoer {
241
237
  )
242
238
  return buildDecodeMessageTransform(RpcStreamPacket)(result)
243
239
  }
240
+
244
241
  }
package/go.mod CHANGED
@@ -3,7 +3,7 @@ module github.com/aperturerobotics/starpc
3
3
  go 1.22
4
4
 
5
5
  require (
6
- github.com/aperturerobotics/protobuf-go-lite v0.4.9-0.20240422083358-2771ae1ac3df // latest
6
+ github.com/aperturerobotics/protobuf-go-lite v0.5.0 // latest
7
7
  github.com/aperturerobotics/util v1.18.1 // latest
8
8
  )
9
9
 
package/go.sum CHANGED
@@ -1,5 +1,5 @@
1
- github.com/aperturerobotics/protobuf-go-lite v0.4.9-0.20240422083358-2771ae1ac3df h1:SlYdOqyFpokRWmi4NJZms3RJ2ldebcGphLQ+mh+0u7g=
2
- github.com/aperturerobotics/protobuf-go-lite v0.4.9-0.20240422083358-2771ae1ac3df/go.mod h1:wRZn4YydbTn8Bdx4NB6ms0doF19llgim+0SNBvQ7M9c=
1
+ github.com/aperturerobotics/protobuf-go-lite v0.5.0 h1:JmTfiOeTQv06EYIFyVkjkmGXxI7JoCRuokVK2SOvo3I=
2
+ github.com/aperturerobotics/protobuf-go-lite v0.5.0/go.mod h1:/EduuzDxtr5s0e9s10XYG35+pPgvrgg3UmBliivOaSs=
3
3
  github.com/aperturerobotics/util v1.18.1 h1:Iu8toMYRKs3d0TH8JkAMwfEYY8bEekDaTEvLOVVqh44=
4
4
  github.com/aperturerobotics/util v1.18.1/go.mod h1:Oz7Rmq5sKS1UgTRJkDWYfyf1LiA2rIRbnO341Xd91bU=
5
5
  github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starpc",
3
- "version": "0.31.3",
3
+ "version": "0.31.5",
4
4
  "description": "Streaming protobuf RPC service protocol over any two-way channel.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -67,12 +67,12 @@
67
67
  "singleQuote": true
68
68
  },
69
69
  "devDependencies": {
70
- "@bufbuild/protoc-gen-es": "^1.8.0",
71
- "@typescript-eslint/eslint-plugin": "^7.7.0",
72
- "@typescript-eslint/parser": "^7.7.0",
70
+ "@bufbuild/protoc-gen-es": "^1.9.0",
71
+ "@typescript-eslint/eslint-plugin": "^7.7.1",
72
+ "@typescript-eslint/parser": "^7.7.1",
73
73
  "depcheck": "^1.4.6",
74
74
  "esbuild": "^0.20.0",
75
- "eslint": "^9.1.0",
75
+ "eslint": "^9.1.1",
76
76
  "eslint-config-prettier": "^9.1.0",
77
77
  "prettier": "^3.2.4",
78
78
  "rimraf": "^5.0.1",
@@ -81,8 +81,7 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "@aptre/it-ws": "^1.0.0",
84
- "@bufbuild/protobuf": "^1.8.0",
85
- "@bufbuild/protoplugin": "^1.8.0",
84
+ "@bufbuild/protoplugin": "^1.9.0",
86
85
  "@chainsafe/libp2p-yamux": "^6.0.2",
87
86
  "@libp2p/interface": "^1.1.3",
88
87
  "@libp2p/logger": "^4.0.6",
@@ -95,5 +94,8 @@
95
94
  "memoize-one": "^6.0.0",
96
95
  "uint8arraylist": "^2.4.7",
97
96
  "ws": "^8.15.1"
97
+ },
98
+ "peerDependencies": {
99
+ "@bufbuild/protobuf": "1.9.0"
98
100
  }
99
101
  }
@@ -1,11 +1,14 @@
1
1
  // Code generated by protoc-gen-go-lite. DO NOT EDIT.
2
- // protoc-gen-go-lite version: v0.4.9-0.20240422083358-2771ae1ac3df
2
+ // protoc-gen-go-lite version: v0.5.0
3
3
  // source: github.com/aperturerobotics/starpc/srpc/rpcproto.proto
4
4
 
5
5
  package srpc
6
6
 
7
7
  import (
8
+ base64 "encoding/base64"
8
9
  io "io"
10
+ strconv "strconv"
11
+ strings "strings"
9
12
 
10
13
  protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
11
14
  json "github.com/aperturerobotics/protobuf-go-lite/json"
@@ -966,6 +969,86 @@ func (m *CallData) SizeVT() (n int) {
966
969
  return n
967
970
  }
968
971
 
972
+ func (x *Packet) MarshalProtoText() string {
973
+ var sb strings.Builder
974
+ sb.WriteString("Packet { ")
975
+ switch body := x.Body.(type) {
976
+ case *Packet_CallStart:
977
+ if body.CallStart != nil {
978
+ sb.WriteString(" call_start: ")
979
+ sb.WriteString(body.CallStart.MarshalProtoText())
980
+ }
981
+ case *Packet_CallData:
982
+ if body.CallData != nil {
983
+ sb.WriteString(" call_data: ")
984
+ sb.WriteString(body.CallData.MarshalProtoText())
985
+ }
986
+ case *Packet_CallCancel:
987
+ if body.CallCancel {
988
+ sb.WriteString(" call_cancel: ")
989
+ sb.WriteString(strconv.FormatBool(body.CallCancel))
990
+ }
991
+ }
992
+ sb.WriteString("}")
993
+ return sb.String()
994
+ }
995
+ func (x *Packet) String() string {
996
+ return x.MarshalProtoText()
997
+ }
998
+ func (x *CallStart) MarshalProtoText() string {
999
+ var sb strings.Builder
1000
+ sb.WriteString("CallStart { ")
1001
+ if x.RpcService != "" {
1002
+ sb.WriteString(" rpc_service: ")
1003
+ sb.WriteString(strconv.Quote(x.RpcService))
1004
+ }
1005
+ if x.RpcMethod != "" {
1006
+ sb.WriteString(" rpc_method: ")
1007
+ sb.WriteString(strconv.Quote(x.RpcMethod))
1008
+ }
1009
+ if len(x.Data) > 0 {
1010
+ sb.WriteString(" data: ")
1011
+ sb.WriteString("\"")
1012
+ sb.WriteString(base64.StdEncoding.EncodeToString(x.Data))
1013
+ sb.WriteString("\"")
1014
+ }
1015
+ if x.DataIsZero {
1016
+ sb.WriteString(" data_is_zero: ")
1017
+ sb.WriteString(strconv.FormatBool(x.DataIsZero))
1018
+ }
1019
+ sb.WriteString("}")
1020
+ return sb.String()
1021
+ }
1022
+ func (x *CallStart) String() string {
1023
+ return x.MarshalProtoText()
1024
+ }
1025
+ func (x *CallData) MarshalProtoText() string {
1026
+ var sb strings.Builder
1027
+ sb.WriteString("CallData { ")
1028
+ if len(x.Data) > 0 {
1029
+ sb.WriteString(" data: ")
1030
+ sb.WriteString("\"")
1031
+ sb.WriteString(base64.StdEncoding.EncodeToString(x.Data))
1032
+ sb.WriteString("\"")
1033
+ }
1034
+ if x.DataIsZero {
1035
+ sb.WriteString(" data_is_zero: ")
1036
+ sb.WriteString(strconv.FormatBool(x.DataIsZero))
1037
+ }
1038
+ if x.Complete {
1039
+ sb.WriteString(" complete: ")
1040
+ sb.WriteString(strconv.FormatBool(x.Complete))
1041
+ }
1042
+ if x.Error != "" {
1043
+ sb.WriteString(" error: ")
1044
+ sb.WriteString(strconv.Quote(x.Error))
1045
+ }
1046
+ sb.WriteString("}")
1047
+ return sb.String()
1048
+ }
1049
+ func (x *CallData) String() string {
1050
+ return x.MarshalProtoText()
1051
+ }
969
1052
  func (m *Packet) UnmarshalVT(dAtA []byte) error {
970
1053
  l := len(dAtA)
971
1054
  iNdEx := 0
@@ -1,4 +1,4 @@
1
- // @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false"
1
+ // @generated by protoc-gen-es v1.9.0 with parameter "target=ts,ts_nocheck=false"
2
2
  // @generated from file github.com/aperturerobotics/starpc/srpc/rpcproto.proto (package srpc, syntax proto3)
3
3
  /* eslint-disable */
4
4