starpc 0.32.3 → 0.32.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/dist/e2e/mock/mock.pb.d.ts +2 -2
- package/dist/e2e/mock/mock.pb.js +4 -4
- package/dist/e2e/mock/mock_srpc.pb.d.ts +3 -3
- package/dist/e2e/mock/mock_srpc.pb.js +5 -5
- package/dist/echo/echo.pb.d.ts +2 -2
- package/dist/echo/echo.pb.js +4 -4
- package/dist/echo/echo_srpc.pb.d.ts +4 -4
- package/dist/echo/echo_srpc.pb.js +11 -11
- package/dist/rpcstream/rpcstream.pb.d.ts +5 -5
- package/dist/rpcstream/rpcstream.pb.js +10 -16
- package/dist/srpc/rpcproto.pb.d.ts +5 -5
- package/dist/srpc/rpcproto.pb.js +16 -34
- package/e2e/mock/mock.pb.go +1 -1
- package/e2e/mock/mock.pb.ts +13 -11
- package/e2e/mock/mock_srpc.pb.ts +15 -13
- package/echo/echo.pb.go +1 -1
- package/echo/echo.pb.ts +13 -11
- package/echo/echo_srpc.pb.ts +44 -47
- package/go.mod +8 -5
- package/go.sum +10 -12
- package/package.json +7 -7
- package/srpc/rpcproto.pb.go +1 -1
- package/srpc/rpcproto.pb.ts +73 -90
- package/srpc/server-http.go +5 -1
- package/srpc/server-http_js.go +18 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
1
|
+
import type { MessageType } from "@aptre/protobuf-es-lite";
|
|
2
|
+
import { Message } from "@aptre/protobuf-es-lite";
|
|
3
3
|
export declare const protobufPackage = "e2e.mock";
|
|
4
4
|
/**
|
|
5
5
|
* MockMsg is the mock message body.
|
package/dist/e2e/mock/mock.pb.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @generated by protoc-gen-es-lite unknown 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 { createMessageType, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from "@aptre/protobuf-es-lite";
|
|
5
|
+
export const protobufPackage = "e2e.mock";
|
|
6
6
|
// MockMsg contains the message type declaration for MockMsg.
|
|
7
7
|
export const MockMsg = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: "e2e.mock.MockMsg",
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
10
|
+
{ no: 1, name: "body", kind: "scalar", T: ScalarType.STRING },
|
|
11
11
|
],
|
|
12
12
|
packedByDefault: true,
|
|
13
13
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MockMsg } from
|
|
2
|
-
import { Message, MethodKind } from
|
|
3
|
-
import { ProtoRpc } from
|
|
1
|
+
import { MockMsg } from "./mock.pb.js";
|
|
2
|
+
import { Message, MethodKind } from "@aptre/protobuf-es-lite";
|
|
3
|
+
import { ProtoRpc } from "starpc";
|
|
4
4
|
/**
|
|
5
5
|
* Mock service mocks some RPCs for the e2e tests.
|
|
6
6
|
*
|
|
@@ -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 "@aptre/protobuf-es-lite";
|
|
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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
1
|
+
import type { MessageType } from "@aptre/protobuf-es-lite";
|
|
2
|
+
import { Message } from "@aptre/protobuf-es-lite";
|
|
3
3
|
export declare const protobufPackage = "echo";
|
|
4
4
|
/**
|
|
5
5
|
* EchoMsg is the message body for Echo.
|
package/dist/echo/echo.pb.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @generated by protoc-gen-es-lite unknown 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 { createMessageType, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from "@aptre/protobuf-es-lite";
|
|
5
|
+
export const protobufPackage = "echo";
|
|
6
6
|
// EchoMsg contains the message type declaration for EchoMsg.
|
|
7
7
|
export const EchoMsg = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: "echo.EchoMsg",
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
10
|
+
{ no: 1, name: "body", kind: "scalar", T: ScalarType.STRING },
|
|
11
11
|
],
|
|
12
12
|
packedByDefault: true,
|
|
13
13
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EchoMsg } from
|
|
2
|
-
import { Message, MethodKind } from
|
|
3
|
-
import { RpcStreamPacket } from
|
|
4
|
-
import { MessageStream, ProtoRpc } from
|
|
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";
|
|
5
5
|
/**
|
|
6
6
|
* Echoer service returns the given message.
|
|
7
7
|
*
|
|
@@ -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 "@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:
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
1
|
+
import type { MessageType } from "@aptre/protobuf-es-lite";
|
|
2
|
+
import { Message } from "@aptre/protobuf-es-lite";
|
|
3
3
|
export declare const protobufPackage = "rpcstream";
|
|
4
4
|
/**
|
|
5
5
|
* RpcStreamInit is the first message in a RPC stream.
|
|
@@ -49,7 +49,7 @@ export type RpcStreamPacket = Message<{
|
|
|
49
49
|
* @generated from field: rpcstream.RpcStreamInit init = 1;
|
|
50
50
|
*/
|
|
51
51
|
value: RpcStreamInit;
|
|
52
|
-
case:
|
|
52
|
+
case: "init";
|
|
53
53
|
} | {
|
|
54
54
|
/**
|
|
55
55
|
* Ack is sent in response to Init.
|
|
@@ -58,7 +58,7 @@ export type RpcStreamPacket = Message<{
|
|
|
58
58
|
* @generated from field: rpcstream.RpcAck ack = 2;
|
|
59
59
|
*/
|
|
60
60
|
value: RpcAck;
|
|
61
|
-
case:
|
|
61
|
+
case: "ack";
|
|
62
62
|
} | {
|
|
63
63
|
/**
|
|
64
64
|
* Data is the encapsulated data packet.
|
|
@@ -66,7 +66,7 @@ export type RpcStreamPacket = Message<{
|
|
|
66
66
|
* @generated from field: bytes data = 3;
|
|
67
67
|
*/
|
|
68
68
|
value: Uint8Array;
|
|
69
|
-
case:
|
|
69
|
+
case: "data";
|
|
70
70
|
};
|
|
71
71
|
}>;
|
|
72
72
|
export declare const RpcStreamPacket: MessageType<RpcStreamPacket>;
|
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
// @generated by protoc-gen-es-lite unknown 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
|
-
import { createMessageType, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from "@aptre/protobuf-es-lite";
|
|
5
|
+
export const protobufPackage = "rpcstream";
|
|
6
6
|
// RpcStreamInit contains the message type declaration for RpcStreamInit.
|
|
7
7
|
export const RpcStreamInit = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: "rpcstream.RpcStreamInit",
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
10
|
+
{ no: 1, name: "component_id", kind: "scalar", T: ScalarType.STRING },
|
|
11
11
|
],
|
|
12
12
|
packedByDefault: true,
|
|
13
13
|
});
|
|
14
14
|
// RpcAck contains the message type declaration for RpcAck.
|
|
15
15
|
export const RpcAck = createMessageType({
|
|
16
|
-
typeName:
|
|
16
|
+
typeName: "rpcstream.RpcAck",
|
|
17
17
|
fields: [
|
|
18
|
-
{ no: 1, name:
|
|
18
|
+
{ no: 1, name: "error", kind: "scalar", T: ScalarType.STRING },
|
|
19
19
|
],
|
|
20
20
|
packedByDefault: true,
|
|
21
21
|
});
|
|
22
22
|
// RpcStreamPacket contains the message type declaration for RpcStreamPacket.
|
|
23
23
|
export const RpcStreamPacket = createMessageType({
|
|
24
|
-
typeName:
|
|
24
|
+
typeName: "rpcstream.RpcStreamPacket",
|
|
25
25
|
fields: [
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
kind: 'message',
|
|
30
|
-
T: () => RpcStreamInit,
|
|
31
|
-
oneof: 'body',
|
|
32
|
-
},
|
|
33
|
-
{ no: 2, name: 'ack', kind: 'message', T: () => RpcAck, oneof: 'body' },
|
|
34
|
-
{ no: 3, name: 'data', kind: 'scalar', T: ScalarType.BYTES, oneof: 'body' },
|
|
26
|
+
{ no: 1, name: "init", kind: "message", T: () => RpcStreamInit, oneof: "body" },
|
|
27
|
+
{ no: 2, name: "ack", kind: "message", T: () => RpcAck, oneof: "body" },
|
|
28
|
+
{ no: 3, name: "data", kind: "scalar", T: ScalarType.BYTES, oneof: "body" },
|
|
35
29
|
],
|
|
36
30
|
packedByDefault: true,
|
|
37
31
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MessageType } from
|
|
2
|
-
import { Message } from
|
|
1
|
+
import type { MessageType } from "@aptre/protobuf-es-lite";
|
|
2
|
+
import { Message } from "@aptre/protobuf-es-lite";
|
|
3
3
|
export declare const protobufPackage = "srpc";
|
|
4
4
|
/**
|
|
5
5
|
* CallStart requests starting a new RPC call.
|
|
@@ -90,7 +90,7 @@ export type Packet = Message<{
|
|
|
90
90
|
* @generated from field: srpc.CallStart call_start = 1;
|
|
91
91
|
*/
|
|
92
92
|
value: CallStart;
|
|
93
|
-
case:
|
|
93
|
+
case: "callStart";
|
|
94
94
|
} | {
|
|
95
95
|
/**
|
|
96
96
|
* CallData is a message in a streaming RPC sequence.
|
|
@@ -98,7 +98,7 @@ export type Packet = Message<{
|
|
|
98
98
|
* @generated from field: srpc.CallData call_data = 2;
|
|
99
99
|
*/
|
|
100
100
|
value: CallData;
|
|
101
|
-
case:
|
|
101
|
+
case: "callData";
|
|
102
102
|
} | {
|
|
103
103
|
/**
|
|
104
104
|
* CallCancel cancels the call.
|
|
@@ -106,7 +106,7 @@ export type Packet = Message<{
|
|
|
106
106
|
* @generated from field: bool call_cancel = 3;
|
|
107
107
|
*/
|
|
108
108
|
value: boolean;
|
|
109
|
-
case:
|
|
109
|
+
case: "callCancel";
|
|
110
110
|
};
|
|
111
111
|
}>;
|
|
112
112
|
export declare const Packet: MessageType<Packet>;
|
package/dist/srpc/rpcproto.pb.js
CHANGED
|
@@ -1,55 +1,37 @@
|
|
|
1
1
|
// @generated by protoc-gen-es-lite unknown 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
|
-
import { createMessageType, ScalarType } from
|
|
5
|
-
export const protobufPackage =
|
|
4
|
+
import { createMessageType, ScalarType } from "@aptre/protobuf-es-lite";
|
|
5
|
+
export const protobufPackage = "srpc";
|
|
6
6
|
// CallStart contains the message type declaration for CallStart.
|
|
7
7
|
export const CallStart = createMessageType({
|
|
8
|
-
typeName:
|
|
8
|
+
typeName: "srpc.CallStart",
|
|
9
9
|
fields: [
|
|
10
|
-
{ no: 1, name:
|
|
11
|
-
{ no: 2, name:
|
|
12
|
-
{ no: 3, name:
|
|
13
|
-
{ no: 4, name:
|
|
10
|
+
{ no: 1, name: "rpc_service", kind: "scalar", T: ScalarType.STRING },
|
|
11
|
+
{ no: 2, name: "rpc_method", kind: "scalar", T: ScalarType.STRING },
|
|
12
|
+
{ no: 3, name: "data", kind: "scalar", T: ScalarType.BYTES },
|
|
13
|
+
{ no: 4, name: "data_is_zero", kind: "scalar", T: ScalarType.BOOL },
|
|
14
14
|
],
|
|
15
15
|
packedByDefault: true,
|
|
16
16
|
});
|
|
17
17
|
// CallData contains the message type declaration for CallData.
|
|
18
18
|
export const CallData = createMessageType({
|
|
19
|
-
typeName:
|
|
19
|
+
typeName: "srpc.CallData",
|
|
20
20
|
fields: [
|
|
21
|
-
{ no: 1, name:
|
|
22
|
-
{ no: 2, name:
|
|
23
|
-
{ no: 3, name:
|
|
24
|
-
{ no: 4, name:
|
|
21
|
+
{ no: 1, name: "data", kind: "scalar", T: ScalarType.BYTES },
|
|
22
|
+
{ no: 2, name: "data_is_zero", kind: "scalar", T: ScalarType.BOOL },
|
|
23
|
+
{ no: 3, name: "complete", kind: "scalar", T: ScalarType.BOOL },
|
|
24
|
+
{ no: 4, name: "error", kind: "scalar", T: ScalarType.STRING },
|
|
25
25
|
],
|
|
26
26
|
packedByDefault: true,
|
|
27
27
|
});
|
|
28
28
|
// Packet contains the message type declaration for Packet.
|
|
29
29
|
export const Packet = createMessageType({
|
|
30
|
-
typeName:
|
|
30
|
+
typeName: "srpc.Packet",
|
|
31
31
|
fields: [
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
kind: 'message',
|
|
36
|
-
T: () => CallStart,
|
|
37
|
-
oneof: 'body',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
no: 2,
|
|
41
|
-
name: 'call_data',
|
|
42
|
-
kind: 'message',
|
|
43
|
-
T: () => CallData,
|
|
44
|
-
oneof: 'body',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
no: 3,
|
|
48
|
-
name: 'call_cancel',
|
|
49
|
-
kind: 'scalar',
|
|
50
|
-
T: ScalarType.BOOL,
|
|
51
|
-
oneof: 'body',
|
|
52
|
-
},
|
|
32
|
+
{ no: 1, name: "call_start", kind: "message", T: () => CallStart, oneof: "body" },
|
|
33
|
+
{ no: 2, name: "call_data", kind: "message", T: () => CallData, oneof: "body" },
|
|
34
|
+
{ no: 3, name: "call_cancel", kind: "scalar", T: ScalarType.BOOL, oneof: "body" },
|
|
53
35
|
],
|
|
54
36
|
packedByDefault: true,
|
|
55
37
|
});
|
package/e2e/mock/mock.pb.go
CHANGED
package/e2e/mock/mock.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 type { MessageType, PartialFieldInfo } from
|
|
6
|
-
import { createMessageType, Message, ScalarType } from
|
|
5
|
+
import type { MessageType, PartialFieldInfo } from "@aptre/protobuf-es-lite";
|
|
6
|
+
import { createMessageType, Message, ScalarType } from "@aptre/protobuf-es-lite";
|
|
7
7
|
|
|
8
|
-
export const protobufPackage =
|
|
8
|
+
export const protobufPackage = "e2e.mock";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* MockMsg is the mock message body.
|
|
@@ -16,14 +16,16 @@ export type MockMsg = Message<{
|
|
|
16
16
|
/**
|
|
17
17
|
* @generated from field: string body = 1;
|
|
18
18
|
*/
|
|
19
|
-
body?: string
|
|
20
|
-
|
|
19
|
+
body?: string;
|
|
20
|
+
|
|
21
|
+
}>;
|
|
21
22
|
|
|
22
23
|
// MockMsg contains the message type declaration for MockMsg.
|
|
23
24
|
export const MockMsg: MessageType<MockMsg> = createMessageType({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
25
|
+
typeName: "e2e.mock.MockMsg",
|
|
26
|
+
fields: [
|
|
27
|
+
{ no: 1, name: "body", kind: "scalar", T: ScalarType.STRING },
|
|
28
|
+
] as readonly PartialFieldInfo[],
|
|
29
|
+
packedByDefault: true,
|
|
30
|
+
});
|
|
31
|
+
|
package/e2e/mock/mock_srpc.pb.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
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 { Message, MethodKind } from
|
|
7
|
-
import { ProtoRpc } from
|
|
5
|
+
import { MockMsg } from "./mock.pb.js";
|
|
6
|
+
import { Message, MethodKind } from "@aptre/protobuf-es-lite";
|
|
7
|
+
import { ProtoRpc } from "starpc";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Mock service mocks some RPCs for the e2e tests.
|
|
@@ -12,7 +12,7 @@ import { ProtoRpc } from 'starpc'
|
|
|
12
12
|
* @generated from service e2e.mock.Mock
|
|
13
13
|
*/
|
|
14
14
|
export const MockDefinition = {
|
|
15
|
-
typeName:
|
|
15
|
+
typeName: "e2e.mock.Mock",
|
|
16
16
|
methods: {
|
|
17
17
|
/**
|
|
18
18
|
* MockRequest runs a mock unary request.
|
|
@@ -20,13 +20,13 @@ export const MockDefinition = {
|
|
|
20
20
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
21
21
|
*/
|
|
22
22
|
MockRequest: {
|
|
23
|
-
name:
|
|
23
|
+
name: "MockRequest",
|
|
24
24
|
I: MockMsg,
|
|
25
25
|
O: MockMsg,
|
|
26
26
|
kind: MethodKind.Unary,
|
|
27
27
|
},
|
|
28
|
-
}
|
|
29
|
-
} as const
|
|
28
|
+
}
|
|
29
|
+
} as const;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Mock service mocks some RPCs for the e2e tests.
|
|
@@ -40,9 +40,10 @@ export interface Mock {
|
|
|
40
40
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
41
41
|
*/
|
|
42
42
|
MockRequest(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
request: Message<MockMsg>, abortSignal?: AbortSignal
|
|
44
|
+
):
|
|
45
|
+
Promise<Message<MockMsg>>
|
|
46
|
+
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
export const MockServiceName = MockDefinition.typeName
|
|
@@ -61,9 +62,9 @@ export class MockClient implements Mock {
|
|
|
61
62
|
* @generated from rpc e2e.mock.Mock.MockRequest
|
|
62
63
|
*/
|
|
63
64
|
async MockRequest(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
request: Message<MockMsg>, abortSignal?: AbortSignal
|
|
66
|
+
):
|
|
67
|
+
Promise<Message<MockMsg>> {
|
|
67
68
|
const requestMsg = MockMsg.create(request)
|
|
68
69
|
const result = await this.rpc.request(
|
|
69
70
|
this.service,
|
|
@@ -73,4 +74,5 @@ export class MockClient implements Mock {
|
|
|
73
74
|
)
|
|
74
75
|
return MockMsg.fromBinary(result)
|
|
75
76
|
}
|
|
77
|
+
|
|
76
78
|
}
|
package/echo/echo.pb.go
CHANGED
package/echo/echo.pb.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// @generated from file github.com/aperturerobotics/starpc/echo/echo.proto (package echo, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import type { MessageType, PartialFieldInfo } from
|
|
6
|
-
import { createMessageType, Message, ScalarType } from
|
|
5
|
+
import type { MessageType, PartialFieldInfo } from "@aptre/protobuf-es-lite";
|
|
6
|
+
import { createMessageType, Message, ScalarType } from "@aptre/protobuf-es-lite";
|
|
7
7
|
|
|
8
|
-
export const protobufPackage =
|
|
8
|
+
export const protobufPackage = "echo";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* EchoMsg is the message body for Echo.
|
|
@@ -16,14 +16,16 @@ export type EchoMsg = Message<{
|
|
|
16
16
|
/**
|
|
17
17
|
* @generated from field: string body = 1;
|
|
18
18
|
*/
|
|
19
|
-
body?: string
|
|
20
|
-
|
|
19
|
+
body?: string;
|
|
20
|
+
|
|
21
|
+
}>;
|
|
21
22
|
|
|
22
23
|
// EchoMsg contains the message type declaration for EchoMsg.
|
|
23
24
|
export const EchoMsg: MessageType<EchoMsg> = createMessageType({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
25
|
+
typeName: "echo.EchoMsg",
|
|
26
|
+
fields: [
|
|
27
|
+
{ no: 1, name: "body", kind: "scalar", T: ScalarType.STRING },
|
|
28
|
+
] as readonly PartialFieldInfo[],
|
|
29
|
+
packedByDefault: true,
|
|
30
|
+
});
|
|
31
|
+
|
package/echo/echo_srpc.pb.ts
CHANGED
|
@@ -2,15 +2,10 @@
|
|
|
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 { Message, MethodKind } from
|
|
7
|
-
import { RpcStreamPacket } from
|
|
8
|
-
import {
|
|
9
|
-
buildDecodeMessageTransform,
|
|
10
|
-
buildEncodeMessageTransform,
|
|
11
|
-
MessageStream,
|
|
12
|
-
ProtoRpc,
|
|
13
|
-
} from 'starpc'
|
|
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";
|
|
14
9
|
|
|
15
10
|
/**
|
|
16
11
|
* Echoer service returns the given message.
|
|
@@ -18,7 +13,7 @@ import {
|
|
|
18
13
|
* @generated from service echo.Echoer
|
|
19
14
|
*/
|
|
20
15
|
export const EchoerDefinition = {
|
|
21
|
-
typeName:
|
|
16
|
+
typeName: "echo.Echoer",
|
|
22
17
|
methods: {
|
|
23
18
|
/**
|
|
24
19
|
* Echo returns the given message.
|
|
@@ -26,7 +21,7 @@ export const EchoerDefinition = {
|
|
|
26
21
|
* @generated from rpc echo.Echoer.Echo
|
|
27
22
|
*/
|
|
28
23
|
Echo: {
|
|
29
|
-
name:
|
|
24
|
+
name: "Echo",
|
|
30
25
|
I: EchoMsg,
|
|
31
26
|
O: EchoMsg,
|
|
32
27
|
kind: MethodKind.Unary,
|
|
@@ -37,7 +32,7 @@ export const EchoerDefinition = {
|
|
|
37
32
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
38
33
|
*/
|
|
39
34
|
EchoServerStream: {
|
|
40
|
-
name:
|
|
35
|
+
name: "EchoServerStream",
|
|
41
36
|
I: EchoMsg,
|
|
42
37
|
O: EchoMsg,
|
|
43
38
|
kind: MethodKind.ServerStreaming,
|
|
@@ -48,7 +43,7 @@ export const EchoerDefinition = {
|
|
|
48
43
|
* @generated from rpc echo.Echoer.EchoClientStream
|
|
49
44
|
*/
|
|
50
45
|
EchoClientStream: {
|
|
51
|
-
name:
|
|
46
|
+
name: "EchoClientStream",
|
|
52
47
|
I: EchoMsg,
|
|
53
48
|
O: EchoMsg,
|
|
54
49
|
kind: MethodKind.ClientStreaming,
|
|
@@ -59,7 +54,7 @@ export const EchoerDefinition = {
|
|
|
59
54
|
* @generated from rpc echo.Echoer.EchoBidiStream
|
|
60
55
|
*/
|
|
61
56
|
EchoBidiStream: {
|
|
62
|
-
name:
|
|
57
|
+
name: "EchoBidiStream",
|
|
63
58
|
I: EchoMsg,
|
|
64
59
|
O: EchoMsg,
|
|
65
60
|
kind: MethodKind.BiDiStreaming,
|
|
@@ -70,13 +65,13 @@ export const EchoerDefinition = {
|
|
|
70
65
|
* @generated from rpc echo.Echoer.RpcStream
|
|
71
66
|
*/
|
|
72
67
|
RpcStream: {
|
|
73
|
-
name:
|
|
68
|
+
name: "RpcStream",
|
|
74
69
|
I: RpcStreamPacket,
|
|
75
70
|
O: RpcStreamPacket,
|
|
76
71
|
kind: MethodKind.BiDiStreaming,
|
|
77
72
|
},
|
|
78
|
-
}
|
|
79
|
-
} as const
|
|
73
|
+
}
|
|
74
|
+
} as const;
|
|
80
75
|
|
|
81
76
|
/**
|
|
82
77
|
* Echoer service returns the given message.
|
|
@@ -90,9 +85,9 @@ export interface Echoer {
|
|
|
90
85
|
* @generated from rpc echo.Echoer.Echo
|
|
91
86
|
*/
|
|
92
87
|
Echo(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
request: Message<EchoMsg>, abortSignal?: AbortSignal
|
|
89
|
+
):
|
|
90
|
+
Promise<Message<EchoMsg>>
|
|
96
91
|
|
|
97
92
|
/**
|
|
98
93
|
* EchoServerStream is an example of a server -> client one-way stream.
|
|
@@ -100,9 +95,9 @@ export interface Echoer {
|
|
|
100
95
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
101
96
|
*/
|
|
102
97
|
EchoServerStream(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
request: Message<EchoMsg>, abortSignal?: AbortSignal
|
|
99
|
+
):
|
|
100
|
+
MessageStream<EchoMsg>
|
|
106
101
|
|
|
107
102
|
/**
|
|
108
103
|
* EchoClientStream is an example of client->server one-way stream.
|
|
@@ -110,9 +105,9 @@ export interface Echoer {
|
|
|
110
105
|
* @generated from rpc echo.Echoer.EchoClientStream
|
|
111
106
|
*/
|
|
112
107
|
EchoClientStream(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
|
|
109
|
+
):
|
|
110
|
+
Promise<Message<EchoMsg>>
|
|
116
111
|
|
|
117
112
|
/**
|
|
118
113
|
* EchoBidiStream is an example of a two-way stream.
|
|
@@ -120,9 +115,9 @@ export interface Echoer {
|
|
|
120
115
|
* @generated from rpc echo.Echoer.EchoBidiStream
|
|
121
116
|
*/
|
|
122
117
|
EchoBidiStream(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
|
|
119
|
+
):
|
|
120
|
+
MessageStream<EchoMsg>
|
|
126
121
|
|
|
127
122
|
/**
|
|
128
123
|
* RpcStream opens a nested rpc call stream.
|
|
@@ -130,9 +125,10 @@ export interface Echoer {
|
|
|
130
125
|
* @generated from rpc echo.Echoer.RpcStream
|
|
131
126
|
*/
|
|
132
127
|
RpcStream(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
|
|
129
|
+
):
|
|
130
|
+
MessageStream<RpcStreamPacket>
|
|
131
|
+
|
|
136
132
|
}
|
|
137
133
|
|
|
138
134
|
export const EchoerServiceName = EchoerDefinition.typeName
|
|
@@ -155,9 +151,9 @@ export class EchoerClient implements Echoer {
|
|
|
155
151
|
* @generated from rpc echo.Echoer.Echo
|
|
156
152
|
*/
|
|
157
153
|
async Echo(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
request: Message<EchoMsg>, abortSignal?: AbortSignal
|
|
155
|
+
):
|
|
156
|
+
Promise<Message<EchoMsg>> {
|
|
161
157
|
const requestMsg = EchoMsg.create(request)
|
|
162
158
|
const result = await this.rpc.request(
|
|
163
159
|
this.service,
|
|
@@ -174,9 +170,9 @@ export class EchoerClient implements Echoer {
|
|
|
174
170
|
* @generated from rpc echo.Echoer.EchoServerStream
|
|
175
171
|
*/
|
|
176
172
|
EchoServerStream(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
request: Message<EchoMsg>, abortSignal?: AbortSignal
|
|
174
|
+
):
|
|
175
|
+
MessageStream<EchoMsg> {
|
|
180
176
|
const requestMsg = EchoMsg.create(request)
|
|
181
177
|
const result = this.rpc.serverStreamingRequest(
|
|
182
178
|
this.service,
|
|
@@ -193,9 +189,9 @@ export class EchoerClient implements Echoer {
|
|
|
193
189
|
* @generated from rpc echo.Echoer.EchoClientStream
|
|
194
190
|
*/
|
|
195
191
|
async EchoClientStream(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
192
|
+
request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
|
|
193
|
+
):
|
|
194
|
+
Promise<Message<EchoMsg>> {
|
|
199
195
|
const result = await this.rpc.clientStreamingRequest(
|
|
200
196
|
this.service,
|
|
201
197
|
EchoerDefinition.methods.EchoClientStream.name,
|
|
@@ -211,9 +207,9 @@ export class EchoerClient implements Echoer {
|
|
|
211
207
|
* @generated from rpc echo.Echoer.EchoBidiStream
|
|
212
208
|
*/
|
|
213
209
|
EchoBidiStream(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
request: MessageStream<EchoMsg>, abortSignal?: AbortSignal
|
|
211
|
+
):
|
|
212
|
+
MessageStream<EchoMsg> {
|
|
217
213
|
const result = this.rpc.bidirectionalStreamingRequest(
|
|
218
214
|
this.service,
|
|
219
215
|
EchoerDefinition.methods.EchoBidiStream.name,
|
|
@@ -229,9 +225,9 @@ export class EchoerClient implements Echoer {
|
|
|
229
225
|
* @generated from rpc echo.Echoer.RpcStream
|
|
230
226
|
*/
|
|
231
227
|
RpcStream(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
request: MessageStream<RpcStreamPacket>, abortSignal?: AbortSignal
|
|
229
|
+
):
|
|
230
|
+
MessageStream<RpcStreamPacket> {
|
|
235
231
|
const result = this.rpc.bidirectionalStreamingRequest(
|
|
236
232
|
this.service,
|
|
237
233
|
EchoerDefinition.methods.RpcStream.name,
|
|
@@ -240,4 +236,5 @@ export class EchoerClient implements Echoer {
|
|
|
240
236
|
)
|
|
241
237
|
return buildDecodeMessageTransform(RpcStreamPacket)(result)
|
|
242
238
|
}
|
|
239
|
+
|
|
243
240
|
}
|
package/go.mod
CHANGED
|
@@ -2,19 +2,22 @@ module github.com/aperturerobotics/starpc
|
|
|
2
2
|
|
|
3
3
|
go 1.22
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// Optional: this fork uses go-protobuf-lite.
|
|
6
6
|
replace github.com/libp2p/go-libp2p => github.com/aperturerobotics/go-libp2p v0.33.1-0.20240504075939-591fc65373be // aperture
|
|
7
7
|
|
|
8
|
+
// Optional: this fork avoids importing net/http on wasm.
|
|
9
|
+
replace nhooyr.io/websocket => github.com/paralin/nhooyr-websocket v1.8.12-0.20240504231911-2358de657064 // aperture-1
|
|
10
|
+
|
|
8
11
|
require (
|
|
9
|
-
github.com/aperturerobotics/protobuf-go-lite v0.6.
|
|
10
|
-
github.com/aperturerobotics/util v1.23.
|
|
12
|
+
github.com/aperturerobotics/protobuf-go-lite v0.6.2 // latest
|
|
13
|
+
github.com/aperturerobotics/util v1.23.1 // latest
|
|
11
14
|
)
|
|
12
15
|
|
|
13
16
|
require (
|
|
14
17
|
github.com/libp2p/go-libp2p v0.33.2 // latest
|
|
15
18
|
github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48 // master
|
|
16
19
|
github.com/sirupsen/logrus v1.9.3 // latest
|
|
17
|
-
google.golang.org/protobuf v1.34.
|
|
20
|
+
google.golang.org/protobuf v1.34.1 // latest
|
|
18
21
|
nhooyr.io/websocket v1.8.11 // latest
|
|
19
22
|
)
|
|
20
23
|
|
|
@@ -38,7 +41,7 @@ require (
|
|
|
38
41
|
github.com/multiformats/go-varint v0.0.7 // indirect
|
|
39
42
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
|
40
43
|
golang.org/x/crypto v0.19.0 // indirect
|
|
41
|
-
golang.org/x/exp v0.0.0-
|
|
44
|
+
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
|
|
42
45
|
golang.org/x/sys v0.18.0 // indirect
|
|
43
46
|
lukechampine.com/blake3 v1.2.1 // indirect
|
|
44
47
|
)
|
package/go.sum
CHANGED
|
@@ -2,10 +2,10 @@ github.com/aperturerobotics/go-libp2p v0.33.1-0.20240504075939-591fc65373be h1:P
|
|
|
2
2
|
github.com/aperturerobotics/go-libp2p v0.33.1-0.20240504075939-591fc65373be/go.mod h1:gA6iEEVpQcx0xpygG/U0wkm+DfII4zoPc3EWViXC5b0=
|
|
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.
|
|
6
|
-
github.com/aperturerobotics/protobuf-go-lite v0.6.
|
|
7
|
-
github.com/aperturerobotics/util v1.23.
|
|
8
|
-
github.com/aperturerobotics/util v1.23.
|
|
5
|
+
github.com/aperturerobotics/protobuf-go-lite v0.6.2 h1:ee0+7IAh11lneWhR1R61prV2/7Nb/1x8muuHnqOKK7E=
|
|
6
|
+
github.com/aperturerobotics/protobuf-go-lite v0.6.2/go.mod h1:YTbfnUj3feSULhs8VgepAHFnF3wUc0CPj4jd2axy21I=
|
|
7
|
+
github.com/aperturerobotics/util v1.23.1 h1:pEeBrN5UUNy83OFyv9d7BQod8O++j5ZwIkEuYGdpRXw=
|
|
8
|
+
github.com/aperturerobotics/util v1.23.1/go.mod h1:dO8P8Ut5xNPpLrPPpn7kM/aJL+qT20C5Ppcs1GE0VNg=
|
|
9
9
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
10
10
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
11
11
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
@@ -45,6 +45,8 @@ github.com/multiformats/go-multistream v0.5.0 h1:5htLSLl7lvJk3xx3qT/8Zm9J4K8vEOf
|
|
|
45
45
|
github.com/multiformats/go-multistream v0.5.0/go.mod h1:n6tMZiwiP2wUsR8DgfDWw1dydlEqV3l6N3/GBsX6ILA=
|
|
46
46
|
github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
|
|
47
47
|
github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
|
|
48
|
+
github.com/paralin/nhooyr-websocket v1.8.12-0.20240504231911-2358de657064 h1:JV7i3sVQ6S4YhpBmTTPuRVH9WUM1xmqApX4Ffb5rOZQ=
|
|
49
|
+
github.com/paralin/nhooyr-websocket v1.8.12-0.20240504231911-2358de657064/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=
|
|
48
50
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
49
51
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
50
52
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
@@ -59,21 +61,17 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
|
|
|
59
61
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
|
60
62
|
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
|
|
61
63
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
|
62
|
-
golang.org/x/exp v0.0.0-
|
|
63
|
-
golang.org/x/exp v0.0.0-
|
|
64
|
+
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
|
|
65
|
+
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
|
|
64
66
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
65
67
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
66
68
|
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
|
67
69
|
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
68
|
-
google.golang.org/protobuf v1.
|
|
69
|
-
google.golang.org/protobuf v1.
|
|
70
|
-
google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4=
|
|
71
|
-
google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
|
70
|
+
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
|
71
|
+
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
|
72
72
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
73
73
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
74
74
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
75
75
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
76
76
|
lukechampine.com/blake3 v1.2.1 h1:YuqqRuaqsGV71BV/nm9xlI0MKUv4QC54jQnBChWbGnI=
|
|
77
77
|
lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k=
|
|
78
|
-
nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0=
|
|
79
|
-
nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "starpc",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.6",
|
|
4
4
|
"description": "Streaming protobuf RPC service protocol over any two-way channel.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.cjs --ignore-pattern *.js --ignore-pattern *.d.ts ./",
|
|
67
67
|
"prepare": "go mod vendor && rimraf ./hack/bin",
|
|
68
68
|
"precommit": "lint-staged",
|
|
69
|
+
"release": "npm run release:version && npm run release:commit",
|
|
70
|
+
"release:minor": "npm run release:version:minor && npm run release:commit",
|
|
69
71
|
"release:version": "npm version patch -m \"release: v%s\" --no-git-tag-version",
|
|
70
72
|
"release:version:minor": "npm version minor -m \"release: v%s\" --no-git-tag-version",
|
|
71
73
|
"release:commit": "git reset && git add package.json && git commit -s -m \"release: v$npm_package_version\" && git tag v$npm_package_version",
|
|
72
|
-
"release:publish": "git push && git push --tags && npm run build && npm publish"
|
|
73
|
-
"release": "npm run release:version && npm run release:commit",
|
|
74
|
-
"release:minor": "npm run release:version:minor && npm run release:commit"
|
|
74
|
+
"release:publish": "git push && git push --tags && npm run build && npm publish"
|
|
75
75
|
},
|
|
76
76
|
"preferUnplugged": true,
|
|
77
77
|
"pre-commit": [
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
86
86
|
"@typescript-eslint/parser": "^7.8.0",
|
|
87
87
|
"depcheck": "^1.4.6",
|
|
88
|
-
"esbuild": "^0.
|
|
88
|
+
"esbuild": "^0.21.0",
|
|
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.
|
|
95
|
-
"tsx": "^4.
|
|
94
|
+
"rimraf": "^5.0.6",
|
|
95
|
+
"tsx": "^4.9.4",
|
|
96
96
|
"typescript": "^5.3.2"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
package/srpc/rpcproto.pb.go
CHANGED
package/srpc/rpcproto.pb.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// @generated from file github.com/aperturerobotics/starpc/srpc/rpcproto.proto (package srpc, syntax proto3)
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
|
-
import type { MessageType, PartialFieldInfo } from
|
|
6
|
-
import { createMessageType, Message, ScalarType } from
|
|
5
|
+
import type { MessageType, PartialFieldInfo } from "@aptre/protobuf-es-lite";
|
|
6
|
+
import { createMessageType, Message, ScalarType } from "@aptre/protobuf-es-lite";
|
|
7
7
|
|
|
8
|
-
export const protobufPackage =
|
|
8
|
+
export const protobufPackage = "srpc";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* CallStart requests starting a new RPC call.
|
|
@@ -19,40 +19,41 @@ export type CallStart = Message<{
|
|
|
19
19
|
*
|
|
20
20
|
* @generated from field: string rpc_service = 1;
|
|
21
21
|
*/
|
|
22
|
-
rpcService?: string
|
|
22
|
+
rpcService?: string;
|
|
23
23
|
/**
|
|
24
24
|
* RpcMethod is the RPC method to call.
|
|
25
25
|
* Must be set.
|
|
26
26
|
*
|
|
27
27
|
* @generated from field: string rpc_method = 2;
|
|
28
28
|
*/
|
|
29
|
-
rpcMethod?: string
|
|
29
|
+
rpcMethod?: string;
|
|
30
30
|
/**
|
|
31
31
|
* Data contains the request or the first message in the stream.
|
|
32
32
|
* Optional if streaming.
|
|
33
33
|
*
|
|
34
34
|
* @generated from field: bytes data = 3;
|
|
35
35
|
*/
|
|
36
|
-
data?: Uint8Array
|
|
36
|
+
data?: Uint8Array;
|
|
37
37
|
/**
|
|
38
38
|
* DataIsZero indicates Data is set with an empty message.
|
|
39
39
|
*
|
|
40
40
|
* @generated from field: bool data_is_zero = 4;
|
|
41
41
|
*/
|
|
42
|
-
dataIsZero?: boolean
|
|
43
|
-
|
|
42
|
+
dataIsZero?: boolean;
|
|
43
|
+
|
|
44
|
+
}>;
|
|
44
45
|
|
|
45
46
|
// CallStart contains the message type declaration for CallStart.
|
|
46
47
|
export const CallStart: MessageType<CallStart> = createMessageType({
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
48
|
+
typeName: "srpc.CallStart",
|
|
49
|
+
fields: [
|
|
50
|
+
{ no: 1, name: "rpc_service", kind: "scalar", T: ScalarType.STRING },
|
|
51
|
+
{ no: 2, name: "rpc_method", kind: "scalar", T: ScalarType.STRING },
|
|
52
|
+
{ no: 3, name: "data", kind: "scalar", T: ScalarType.BYTES },
|
|
53
|
+
{ no: 4, name: "data_is_zero", kind: "scalar", T: ScalarType.BOOL },
|
|
54
|
+
] as readonly PartialFieldInfo[],
|
|
55
|
+
packedByDefault: true,
|
|
56
|
+
});
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* CallData contains a message in a streaming RPC sequence.
|
|
@@ -65,39 +66,40 @@ export type CallData = Message<{
|
|
|
65
66
|
*
|
|
66
67
|
* @generated from field: bytes data = 1;
|
|
67
68
|
*/
|
|
68
|
-
data?: Uint8Array
|
|
69
|
+
data?: Uint8Array;
|
|
69
70
|
/**
|
|
70
71
|
* DataIsZero indicates Data is set with an empty message.
|
|
71
72
|
*
|
|
72
73
|
* @generated from field: bool data_is_zero = 2;
|
|
73
74
|
*/
|
|
74
|
-
dataIsZero?: boolean
|
|
75
|
+
dataIsZero?: boolean;
|
|
75
76
|
/**
|
|
76
77
|
* Complete indicates the RPC call is completed.
|
|
77
78
|
*
|
|
78
79
|
* @generated from field: bool complete = 3;
|
|
79
80
|
*/
|
|
80
|
-
complete?: boolean
|
|
81
|
+
complete?: boolean;
|
|
81
82
|
/**
|
|
82
83
|
* Error contains any error that caused the RPC to fail.
|
|
83
84
|
* If set, implies complete=true.
|
|
84
85
|
*
|
|
85
86
|
* @generated from field: string error = 4;
|
|
86
87
|
*/
|
|
87
|
-
error?: string
|
|
88
|
-
|
|
88
|
+
error?: string;
|
|
89
|
+
|
|
90
|
+
}>;
|
|
89
91
|
|
|
90
92
|
// CallData contains the message type declaration for CallData.
|
|
91
93
|
export const CallData: MessageType<CallData> = createMessageType({
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
94
|
+
typeName: "srpc.CallData",
|
|
95
|
+
fields: [
|
|
96
|
+
{ no: 1, name: "data", kind: "scalar", T: ScalarType.BYTES },
|
|
97
|
+
{ no: 2, name: "data_is_zero", kind: "scalar", T: ScalarType.BOOL },
|
|
98
|
+
{ no: 3, name: "complete", kind: "scalar", T: ScalarType.BOOL },
|
|
99
|
+
{ no: 4, name: "error", kind: "scalar", T: ScalarType.STRING },
|
|
100
|
+
] as readonly PartialFieldInfo[],
|
|
101
|
+
packedByDefault: true,
|
|
102
|
+
});
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* Packet is a message sent over a srpc packet connection.
|
|
@@ -105,70 +107,51 @@ export const CallData: MessageType<CallData> = createMessageType({
|
|
|
105
107
|
* @generated from message srpc.Packet
|
|
106
108
|
*/
|
|
107
109
|
export type Packet = Message<{
|
|
110
|
+
|
|
108
111
|
/**
|
|
109
112
|
* Body is the packet body.
|
|
110
113
|
*
|
|
111
114
|
* @generated from oneof srpc.Packet.body
|
|
112
115
|
*/
|
|
113
|
-
body?:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
case: 'callCancel'
|
|
144
|
-
}
|
|
145
|
-
}>
|
|
116
|
+
body?: {
|
|
117
|
+
value?: undefined,
|
|
118
|
+
case: undefined
|
|
119
|
+
} | {
|
|
120
|
+
/**
|
|
121
|
+
* CallStart initiates a new call.
|
|
122
|
+
*
|
|
123
|
+
* @generated from field: srpc.CallStart call_start = 1;
|
|
124
|
+
*/
|
|
125
|
+
value: CallStart;
|
|
126
|
+
case: "callStart";
|
|
127
|
+
} | {
|
|
128
|
+
/**
|
|
129
|
+
* CallData is a message in a streaming RPC sequence.
|
|
130
|
+
*
|
|
131
|
+
* @generated from field: srpc.CallData call_data = 2;
|
|
132
|
+
*/
|
|
133
|
+
value: CallData;
|
|
134
|
+
case: "callData";
|
|
135
|
+
} | {
|
|
136
|
+
/**
|
|
137
|
+
* CallCancel cancels the call.
|
|
138
|
+
*
|
|
139
|
+
* @generated from field: bool call_cancel = 3;
|
|
140
|
+
*/
|
|
141
|
+
value: boolean;
|
|
142
|
+
case: "callCancel";
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
}>;
|
|
146
146
|
|
|
147
147
|
// Packet contains the message type declaration for Packet.
|
|
148
148
|
export const Packet: MessageType<Packet> = createMessageType({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
no: 2,
|
|
160
|
-
name: 'call_data',
|
|
161
|
-
kind: 'message',
|
|
162
|
-
T: () => CallData,
|
|
163
|
-
oneof: 'body',
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
no: 3,
|
|
167
|
-
name: 'call_cancel',
|
|
168
|
-
kind: 'scalar',
|
|
169
|
-
T: ScalarType.BOOL,
|
|
170
|
-
oneof: 'body',
|
|
171
|
-
},
|
|
172
|
-
] as readonly PartialFieldInfo[],
|
|
173
|
-
packedByDefault: true,
|
|
174
|
-
})
|
|
149
|
+
typeName: "srpc.Packet",
|
|
150
|
+
fields: [
|
|
151
|
+
{ no: 1, name: "call_start", kind: "message", T: () => CallStart, oneof: "body" },
|
|
152
|
+
{ no: 2, name: "call_data", kind: "message", T: () => CallData, oneof: "body" },
|
|
153
|
+
{ no: 3, name: "call_cancel", kind: "scalar", T: ScalarType.BOOL, oneof: "body" },
|
|
154
|
+
] as readonly PartialFieldInfo[],
|
|
155
|
+
packedByDefault: true,
|
|
156
|
+
});
|
|
157
|
+
|
package/srpc/server-http.go
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
//go:build !js
|
|
2
|
+
|
|
1
3
|
package srpc
|
|
2
4
|
|
|
3
5
|
import (
|
|
@@ -8,7 +10,9 @@ import (
|
|
|
8
10
|
"nhooyr.io/websocket"
|
|
9
11
|
)
|
|
10
12
|
|
|
11
|
-
// HTTPServer implements the SRPC server.
|
|
13
|
+
// HTTPServer implements the SRPC HTTP/WebSocket server.
|
|
14
|
+
//
|
|
15
|
+
// NOTE: accepting websocket connections is stubbed out on GOOS=js!
|
|
12
16
|
type HTTPServer struct {
|
|
13
17
|
mux Mux
|
|
14
18
|
srpc *Server
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//go:build js
|
|
2
|
+
|
|
3
|
+
package srpc
|
|
4
|
+
|
|
5
|
+
import "errors"
|
|
6
|
+
|
|
7
|
+
// HTTPServer implements the SRPC HTTP/WebSocket server.
|
|
8
|
+
//
|
|
9
|
+
// NOTE: accepting websocket connections is stubbed out on GOOS=js!
|
|
10
|
+
type HTTPServer struct{}
|
|
11
|
+
|
|
12
|
+
// NewHTTPServer builds a http server / handler.
|
|
13
|
+
func NewHTTPServer(mux Mux, path string) (*HTTPServer, error) {
|
|
14
|
+
return nil, errors.New("srpc: http server not implemented on js")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// stub for js
|
|
18
|
+
func (s *HTTPServer) ServeHTTP(w any, r any) {}
|