starpc 0.31.4 → 0.31.6
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 +29 -18
- package/dist/e2e/mock/mock_pb.js +1 -1
- package/dist/e2e/mock/mock_srpc.pb.d.ts +4 -4
- package/dist/e2e/mock/mock_srpc.pb.js +5 -5
- package/dist/echo/echo_pb.js +1 -1
- package/dist/echo/echo_srpc.pb.d.ts +5 -5
- package/dist/echo/echo_srpc.pb.js +11 -11
- package/dist/rpcstream/rpcstream_pb.js +1 -1
- package/dist/srpc/rpcproto_pb.js +1 -1
- package/e2e/mock/mock.pb.go +6 -6
- package/e2e/mock/mock_pb.ts +1 -1
- package/e2e/mock/mock_srpc.pb.ts +16 -14
- package/echo/echo.pb.go +6 -6
- package/echo/echo_pb.ts +1 -1
- package/echo/echo_srpc.pb.ts +45 -48
- package/go.mod +5 -6
- package/go.sum +6 -12
- package/package.json +9 -7
- package/srpc/rpcproto.pb.go +22 -22
- package/srpc/rpcproto_pb.ts +1 -1
package/Makefile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# https://github.com/aperturerobotics/
|
|
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,11 +70,12 @@ 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
|
|
73
|
+
export OUT=./vendor; \
|
|
81
74
|
mkdir -p $${OUT}/$$(dirname $${PROJECT}); \
|
|
82
|
-
rm
|
|
83
|
-
ln -s $$(pwd)
|
|
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 \
|
|
@@ -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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
|
120
|
+
rm -f ./vendor/$${PROJECT}
|
|
109
121
|
$(GOIMPORTS) -w ./
|
|
110
|
-
npm run format:js
|
|
111
122
|
|
|
112
123
|
.PHONY: gen
|
|
113
124
|
gen: genproto
|
package/dist/e2e/mock/mock_pb.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
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
|
|
2
|
-
import type { PartialMessage } from
|
|
3
|
-
import { MethodKind } from
|
|
4
|
-
import { ProtoRpc } from
|
|
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
|
|
5
|
-
import { MethodKind } from
|
|
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:
|
|
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:
|
|
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 {
|
package/dist/echo/echo_pb.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
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
|
|
2
|
-
import type { PartialMessage } from
|
|
3
|
-
import { MethodKind } from
|
|
4
|
-
import { RpcStreamPacket } from
|
|
5
|
-
import { MessageStream, ProtoRpc } from
|
|
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
|
|
5
|
-
import { MethodKind } from
|
|
6
|
-
import { RpcStreamPacket } from
|
|
7
|
-
import { buildDecodeMessageTransform, buildEncodeMessageTransform
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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.
|
|
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';
|
package/dist/srpc/rpcproto_pb.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
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';
|
package/e2e/mock/mock.pb.go
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
|
|
2
|
-
// protoc-gen-go-lite version: v0.
|
|
2
|
+
// protoc-gen-go-lite version: v0.6.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
|
+
fmt "fmt"
|
|
8
9
|
io "io"
|
|
9
10
|
strconv "strconv"
|
|
10
11
|
strings "strings"
|
|
11
12
|
|
|
12
13
|
protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
|
|
13
14
|
json "github.com/aperturerobotics/protobuf-go-lite/json"
|
|
14
|
-
errors "github.com/pkg/errors"
|
|
15
15
|
)
|
|
16
16
|
|
|
17
17
|
// MockMsg is the mock message body.
|
|
@@ -99,7 +99,7 @@ func (x *MockMsg) UnmarshalProtoJSON(s *json.UnmarshalState) {
|
|
|
99
99
|
s.ReadObject(func(key string) {
|
|
100
100
|
switch key {
|
|
101
101
|
default:
|
|
102
|
-
s.
|
|
102
|
+
s.Skip() // ignore unknown field
|
|
103
103
|
case "body":
|
|
104
104
|
s.AddField("body")
|
|
105
105
|
x.Body = s.ReadString()
|
|
@@ -202,15 +202,15 @@ func (m *MockMsg) UnmarshalVT(dAtA []byte) error {
|
|
|
202
202
|
fieldNum := int32(wire >> 3)
|
|
203
203
|
wireType := int(wire & 0x7)
|
|
204
204
|
if wireType == 4 {
|
|
205
|
-
return
|
|
205
|
+
return fmt.Errorf("proto: MockMsg: wiretype end group for non-group")
|
|
206
206
|
}
|
|
207
207
|
if fieldNum <= 0 {
|
|
208
|
-
return
|
|
208
|
+
return fmt.Errorf("proto: MockMsg: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
209
209
|
}
|
|
210
210
|
switch fieldNum {
|
|
211
211
|
case 1:
|
|
212
212
|
if wireType != 2 {
|
|
213
|
-
return
|
|
213
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
|
|
214
214
|
}
|
|
215
215
|
var stringLen uint64
|
|
216
216
|
for shift := uint(0); ; shift += 7 {
|
package/e2e/mock/mock_pb.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
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
|
|
package/e2e/mock/mock_srpc.pb.ts
CHANGED
|
@@ -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
|
|
6
|
-
import type { PartialMessage } from
|
|
7
|
-
import { MethodKind } from
|
|
8
|
-
import { ProtoRpc } from
|
|
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:
|
|
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:
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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,10 +1,11 @@
|
|
|
1
1
|
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
|
|
2
|
-
// protoc-gen-go-lite version: v0.
|
|
2
|
+
// protoc-gen-go-lite version: v0.6.0
|
|
3
3
|
// source: github.com/aperturerobotics/starpc/echo/echo.proto
|
|
4
4
|
|
|
5
5
|
package echo
|
|
6
6
|
|
|
7
7
|
import (
|
|
8
|
+
fmt "fmt"
|
|
8
9
|
io "io"
|
|
9
10
|
strconv "strconv"
|
|
10
11
|
strings "strings"
|
|
@@ -12,7 +13,6 @@ import (
|
|
|
12
13
|
protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
|
|
13
14
|
json "github.com/aperturerobotics/protobuf-go-lite/json"
|
|
14
15
|
_ "github.com/aperturerobotics/starpc/rpcstream"
|
|
15
|
-
errors "github.com/pkg/errors"
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
// EchoMsg is the message body for Echo.
|
|
@@ -100,7 +100,7 @@ func (x *EchoMsg) UnmarshalProtoJSON(s *json.UnmarshalState) {
|
|
|
100
100
|
s.ReadObject(func(key string) {
|
|
101
101
|
switch key {
|
|
102
102
|
default:
|
|
103
|
-
s.
|
|
103
|
+
s.Skip() // ignore unknown field
|
|
104
104
|
case "body":
|
|
105
105
|
s.AddField("body")
|
|
106
106
|
x.Body = s.ReadString()
|
|
@@ -203,15 +203,15 @@ func (m *EchoMsg) UnmarshalVT(dAtA []byte) error {
|
|
|
203
203
|
fieldNum := int32(wire >> 3)
|
|
204
204
|
wireType := int(wire & 0x7)
|
|
205
205
|
if wireType == 4 {
|
|
206
|
-
return
|
|
206
|
+
return fmt.Errorf("proto: EchoMsg: wiretype end group for non-group")
|
|
207
207
|
}
|
|
208
208
|
if fieldNum <= 0 {
|
|
209
|
-
return
|
|
209
|
+
return fmt.Errorf("proto: EchoMsg: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
210
210
|
}
|
|
211
211
|
switch fieldNum {
|
|
212
212
|
case 1:
|
|
213
213
|
if wireType != 2 {
|
|
214
|
-
return
|
|
214
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
|
|
215
215
|
}
|
|
216
216
|
var stringLen uint64
|
|
217
217
|
for shift := uint(0); ; shift += 7 {
|
package/echo/echo_pb.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
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
|
|
package/echo/echo_srpc.pb.ts
CHANGED
|
@@ -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
|
|
6
|
-
import type { PartialMessage } from
|
|
7
|
-
import { MethodKind } from
|
|
8
|
-
import { RpcStreamPacket } from
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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,28 +3,27 @@ module github.com/aperturerobotics/starpc
|
|
|
3
3
|
go 1.22
|
|
4
4
|
|
|
5
5
|
require (
|
|
6
|
-
github.com/aperturerobotics/protobuf-go-lite v0.
|
|
7
|
-
github.com/aperturerobotics/util v1.
|
|
6
|
+
github.com/aperturerobotics/protobuf-go-lite v0.6.0 // latest
|
|
7
|
+
github.com/aperturerobotics/util v1.20.1 // latest
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
require (
|
|
11
11
|
github.com/libp2p/go-libp2p v0.33.2 // latest
|
|
12
12
|
github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48 // master
|
|
13
|
-
github.com/pkg/errors v0.9.1 // latest
|
|
14
13
|
github.com/sirupsen/logrus v1.9.3 // latest
|
|
15
14
|
google.golang.org/protobuf v1.33.0 // latest
|
|
16
15
|
nhooyr.io/websocket v1.8.11 // latest
|
|
17
16
|
)
|
|
18
17
|
|
|
18
|
+
require github.com/pkg/errors v0.9.1
|
|
19
|
+
|
|
19
20
|
require (
|
|
21
|
+
github.com/aperturerobotics/json-iterator-lite v1.0.0 // indirect
|
|
20
22
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
|
21
23
|
github.com/ipfs/go-cid v0.4.1 // indirect
|
|
22
|
-
github.com/json-iterator/go v1.1.12 // indirect
|
|
23
24
|
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
|
24
25
|
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
|
25
26
|
github.com/minio/sha256-simd v1.0.1 // indirect
|
|
26
|
-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
|
27
|
-
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
28
27
|
github.com/mr-tron/base58 v1.2.0 // indirect
|
|
29
28
|
github.com/multiformats/go-base32 v0.1.0 // indirect
|
|
30
29
|
github.com/multiformats/go-base36 v0.2.0 // indirect
|
package/go.sum
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
github.com/aperturerobotics/
|
|
2
|
-
github.com/aperturerobotics/
|
|
3
|
-
github.com/aperturerobotics/
|
|
4
|
-
github.com/aperturerobotics/
|
|
1
|
+
github.com/aperturerobotics/json-iterator-lite v1.0.0 h1:cihbrYWoK/S2RYXhJLpDZd+GUjVvFJN+D3w1VOqqHRI=
|
|
2
|
+
github.com/aperturerobotics/json-iterator-lite v1.0.0/go.mod h1:snaApCEDtrHHP6UWSLKiYNOZU9A5NyzccKenx9oZEzg=
|
|
3
|
+
github.com/aperturerobotics/protobuf-go-lite v0.6.0 h1:EE168e2oov6wmDv8AdSAlz2G1nHbf0HlYG917CgJ+ug=
|
|
4
|
+
github.com/aperturerobotics/protobuf-go-lite v0.6.0/go.mod h1:6Bp+C+fI1uh0NmIKpxlxyHMkKtCP9Kb3PHkhOzxG4B8=
|
|
5
|
+
github.com/aperturerobotics/util v1.20.1 h1:A4lcyULNtpID2pykIBLr7putGXFjjGi5EX0BpaVcdtY=
|
|
6
|
+
github.com/aperturerobotics/util v1.20.1/go.mod h1:m6rsllH5ubGZvwFmdY3Tvm6LMgBtghqxPTynimEevl0=
|
|
5
7
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
6
8
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
7
9
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
@@ -11,11 +13,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly
|
|
|
11
13
|
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
|
|
12
14
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
|
13
15
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
|
14
|
-
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
15
16
|
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
|
|
16
17
|
github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk=
|
|
17
|
-
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
|
18
|
-
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
|
19
18
|
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
|
20
19
|
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
|
21
20
|
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
|
|
@@ -28,10 +27,6 @@ github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48 h1:KI65sCCL2h
|
|
|
28
27
|
github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48/go.mod h1:PGP+3py2ZWDKABvqstBZtMnixEHNC7U/odnGylzur5o=
|
|
29
28
|
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
|
|
30
29
|
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
|
|
31
|
-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
|
32
|
-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
33
|
-
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
|
34
|
-
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
|
35
30
|
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
|
|
36
31
|
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
|
37
32
|
github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE=
|
|
@@ -59,7 +54,6 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
|
|
|
59
54
|
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
|
60
55
|
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
|
61
56
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
62
|
-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
63
57
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
64
58
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
|
65
59
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.6",
|
|
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.
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^7.7.
|
|
72
|
-
"@typescript-eslint/parser": "^7.7.
|
|
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.
|
|
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/
|
|
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
|
}
|
package/srpc/rpcproto.pb.go
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
|
|
2
|
-
// protoc-gen-go-lite version: v0.
|
|
2
|
+
// protoc-gen-go-lite version: v0.6.0
|
|
3
3
|
// source: github.com/aperturerobotics/starpc/srpc/rpcproto.proto
|
|
4
4
|
|
|
5
5
|
package srpc
|
|
6
6
|
|
|
7
7
|
import (
|
|
8
8
|
base64 "encoding/base64"
|
|
9
|
+
fmt "fmt"
|
|
9
10
|
io "io"
|
|
10
11
|
strconv "strconv"
|
|
11
12
|
strings "strings"
|
|
12
13
|
|
|
13
14
|
protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
|
|
14
15
|
json "github.com/aperturerobotics/protobuf-go-lite/json"
|
|
15
|
-
errors "github.com/pkg/errors"
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
// Packet is a message sent over a srpc packet connection.
|
|
@@ -469,7 +469,7 @@ func (x *Packet) UnmarshalProtoJSON(s *json.UnmarshalState) {
|
|
|
469
469
|
s.ReadObject(func(key string) {
|
|
470
470
|
switch key {
|
|
471
471
|
default:
|
|
472
|
-
s.
|
|
472
|
+
s.Skip() // ignore unknown field
|
|
473
473
|
case "call_start", "callStart":
|
|
474
474
|
ov := &Packet_CallStart{}
|
|
475
475
|
x.Body = ov
|
|
@@ -546,7 +546,7 @@ func (x *CallStart) UnmarshalProtoJSON(s *json.UnmarshalState) {
|
|
|
546
546
|
s.ReadObject(func(key string) {
|
|
547
547
|
switch key {
|
|
548
548
|
default:
|
|
549
|
-
s.
|
|
549
|
+
s.Skip() // ignore unknown field
|
|
550
550
|
case "rpc_service", "rpcService":
|
|
551
551
|
s.AddField("rpc_service")
|
|
552
552
|
x.RpcService = s.ReadString()
|
|
@@ -612,7 +612,7 @@ func (x *CallData) UnmarshalProtoJSON(s *json.UnmarshalState) {
|
|
|
612
612
|
s.ReadObject(func(key string) {
|
|
613
613
|
switch key {
|
|
614
614
|
default:
|
|
615
|
-
s.
|
|
615
|
+
s.Skip() // ignore unknown field
|
|
616
616
|
case "data":
|
|
617
617
|
s.AddField("data")
|
|
618
618
|
x.Data = s.ReadBytes()
|
|
@@ -1072,15 +1072,15 @@ func (m *Packet) UnmarshalVT(dAtA []byte) error {
|
|
|
1072
1072
|
fieldNum := int32(wire >> 3)
|
|
1073
1073
|
wireType := int(wire & 0x7)
|
|
1074
1074
|
if wireType == 4 {
|
|
1075
|
-
return
|
|
1075
|
+
return fmt.Errorf("proto: Packet: wiretype end group for non-group")
|
|
1076
1076
|
}
|
|
1077
1077
|
if fieldNum <= 0 {
|
|
1078
|
-
return
|
|
1078
|
+
return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
1079
1079
|
}
|
|
1080
1080
|
switch fieldNum {
|
|
1081
1081
|
case 1:
|
|
1082
1082
|
if wireType != 2 {
|
|
1083
|
-
return
|
|
1083
|
+
return fmt.Errorf("proto: wrong wireType = %d for field CallStart", wireType)
|
|
1084
1084
|
}
|
|
1085
1085
|
var msglen int
|
|
1086
1086
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1121,7 +1121,7 @@ func (m *Packet) UnmarshalVT(dAtA []byte) error {
|
|
|
1121
1121
|
iNdEx = postIndex
|
|
1122
1122
|
case 2:
|
|
1123
1123
|
if wireType != 2 {
|
|
1124
|
-
return
|
|
1124
|
+
return fmt.Errorf("proto: wrong wireType = %d for field CallData", wireType)
|
|
1125
1125
|
}
|
|
1126
1126
|
var msglen int
|
|
1127
1127
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1162,7 +1162,7 @@ func (m *Packet) UnmarshalVT(dAtA []byte) error {
|
|
|
1162
1162
|
iNdEx = postIndex
|
|
1163
1163
|
case 3:
|
|
1164
1164
|
if wireType != 0 {
|
|
1165
|
-
return
|
|
1165
|
+
return fmt.Errorf("proto: wrong wireType = %d for field CallCancel", wireType)
|
|
1166
1166
|
}
|
|
1167
1167
|
var v int
|
|
1168
1168
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1226,15 +1226,15 @@ func (m *CallStart) UnmarshalVT(dAtA []byte) error {
|
|
|
1226
1226
|
fieldNum := int32(wire >> 3)
|
|
1227
1227
|
wireType := int(wire & 0x7)
|
|
1228
1228
|
if wireType == 4 {
|
|
1229
|
-
return
|
|
1229
|
+
return fmt.Errorf("proto: CallStart: wiretype end group for non-group")
|
|
1230
1230
|
}
|
|
1231
1231
|
if fieldNum <= 0 {
|
|
1232
|
-
return
|
|
1232
|
+
return fmt.Errorf("proto: CallStart: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
1233
1233
|
}
|
|
1234
1234
|
switch fieldNum {
|
|
1235
1235
|
case 1:
|
|
1236
1236
|
if wireType != 2 {
|
|
1237
|
-
return
|
|
1237
|
+
return fmt.Errorf("proto: wrong wireType = %d for field RpcService", wireType)
|
|
1238
1238
|
}
|
|
1239
1239
|
var stringLen uint64
|
|
1240
1240
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1266,7 +1266,7 @@ func (m *CallStart) UnmarshalVT(dAtA []byte) error {
|
|
|
1266
1266
|
iNdEx = postIndex
|
|
1267
1267
|
case 2:
|
|
1268
1268
|
if wireType != 2 {
|
|
1269
|
-
return
|
|
1269
|
+
return fmt.Errorf("proto: wrong wireType = %d for field RpcMethod", wireType)
|
|
1270
1270
|
}
|
|
1271
1271
|
var stringLen uint64
|
|
1272
1272
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1298,7 +1298,7 @@ func (m *CallStart) UnmarshalVT(dAtA []byte) error {
|
|
|
1298
1298
|
iNdEx = postIndex
|
|
1299
1299
|
case 3:
|
|
1300
1300
|
if wireType != 2 {
|
|
1301
|
-
return
|
|
1301
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
|
|
1302
1302
|
}
|
|
1303
1303
|
var byteLen int
|
|
1304
1304
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1332,7 +1332,7 @@ func (m *CallStart) UnmarshalVT(dAtA []byte) error {
|
|
|
1332
1332
|
iNdEx = postIndex
|
|
1333
1333
|
case 4:
|
|
1334
1334
|
if wireType != 0 {
|
|
1335
|
-
return
|
|
1335
|
+
return fmt.Errorf("proto: wrong wireType = %d for field DataIsZero", wireType)
|
|
1336
1336
|
}
|
|
1337
1337
|
var v int
|
|
1338
1338
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1395,15 +1395,15 @@ func (m *CallData) UnmarshalVT(dAtA []byte) error {
|
|
|
1395
1395
|
fieldNum := int32(wire >> 3)
|
|
1396
1396
|
wireType := int(wire & 0x7)
|
|
1397
1397
|
if wireType == 4 {
|
|
1398
|
-
return
|
|
1398
|
+
return fmt.Errorf("proto: CallData: wiretype end group for non-group")
|
|
1399
1399
|
}
|
|
1400
1400
|
if fieldNum <= 0 {
|
|
1401
|
-
return
|
|
1401
|
+
return fmt.Errorf("proto: CallData: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
1402
1402
|
}
|
|
1403
1403
|
switch fieldNum {
|
|
1404
1404
|
case 1:
|
|
1405
1405
|
if wireType != 2 {
|
|
1406
|
-
return
|
|
1406
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
|
|
1407
1407
|
}
|
|
1408
1408
|
var byteLen int
|
|
1409
1409
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1437,7 +1437,7 @@ func (m *CallData) UnmarshalVT(dAtA []byte) error {
|
|
|
1437
1437
|
iNdEx = postIndex
|
|
1438
1438
|
case 2:
|
|
1439
1439
|
if wireType != 0 {
|
|
1440
|
-
return
|
|
1440
|
+
return fmt.Errorf("proto: wrong wireType = %d for field DataIsZero", wireType)
|
|
1441
1441
|
}
|
|
1442
1442
|
var v int
|
|
1443
1443
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1457,7 +1457,7 @@ func (m *CallData) UnmarshalVT(dAtA []byte) error {
|
|
|
1457
1457
|
m.DataIsZero = bool(v != 0)
|
|
1458
1458
|
case 3:
|
|
1459
1459
|
if wireType != 0 {
|
|
1460
|
-
return
|
|
1460
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Complete", wireType)
|
|
1461
1461
|
}
|
|
1462
1462
|
var v int
|
|
1463
1463
|
for shift := uint(0); ; shift += 7 {
|
|
@@ -1477,7 +1477,7 @@ func (m *CallData) UnmarshalVT(dAtA []byte) error {
|
|
|
1477
1477
|
m.Complete = bool(v != 0)
|
|
1478
1478
|
case 4:
|
|
1479
1479
|
if wireType != 2 {
|
|
1480
|
-
return
|
|
1480
|
+
return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType)
|
|
1481
1481
|
}
|
|
1482
1482
|
var stringLen uint64
|
|
1483
1483
|
for shift := uint(0); ; shift += 7 {
|
package/srpc/rpcproto_pb.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by protoc-gen-es v1.
|
|
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
|
|