starpc 0.5.0 → 0.6.0
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/echo/echo.pb.d.ts +8 -9
- package/dist/echo/echo.pb.js +16 -17
- package/dist/echo/server.js +1 -1
- package/dist/rpcstream/rpcstream.d.ts +3 -3
- package/dist/rpcstream/rpcstream.js +7 -5
- package/dist/rpcstream/rpcstream.pb.d.ts +2 -3
- package/dist/rpcstream/rpcstream.pb.js +10 -11
- package/dist/srpc/index.d.ts +1 -1
- package/dist/srpc/index.js +1 -1
- package/dist/srpc/rpcproto.pb.d.ts +6 -7
- package/dist/srpc/rpcproto.pb.js +10 -11
- package/dist/srpc/server.d.ts +2 -0
- package/dist/srpc/server.js +4 -0
- package/echo/echo.pb.ts +24 -25
- package/echo/server.ts +3 -3
- package/package.json +9 -7
- package/patches/{ts-poet+4.14.0.patch → ts-poet+4.15.0.patch} +1 -1
- package/srpc/index.ts +1 -1
- package/srpc/rpcproto.pb.ts +12 -16
- package/srpc/server.ts +6 -0
- package/patches/ts-proto+1.115.5.patch +0 -1339
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
diff --git a/node_modules/ts-poet/build/Import.js b/node_modules/ts-poet/build/Import.js
|
|
2
|
-
index
|
|
2
|
+
index b92bea3..608add9 100644
|
|
3
3
|
--- a/node_modules/ts-poet/build/Import.js
|
|
4
4
|
+++ b/node_modules/ts-poet/build/Import.js
|
|
5
5
|
@@ -293,6 +293,14 @@ function emitImports(imports, ourModulePath, importMappings) {
|
package/srpc/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { Server } from './server.js'
|
|
|
4
4
|
export { Conn, ConnParams } from './conn.js'
|
|
5
5
|
export { Handler, InvokeFn, createHandler, createInvokeFn } from './handler.js'
|
|
6
6
|
export { Packet, CallStart, CallData } from './rpcproto.pb.js'
|
|
7
|
-
export { Mux, createMux } from './mux.js'
|
|
7
|
+
export { Mux, StaticMux, createMux } from './mux.js'
|
|
8
8
|
export {
|
|
9
9
|
BroadcastChannelDuplex,
|
|
10
10
|
newBroadcastChannelDuplex,
|
package/srpc/rpcproto.pb.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import Long from 'long'
|
|
3
3
|
import * as _m0 from 'protobufjs/minimal'
|
|
4
|
-
import {
|
|
5
|
-
CallStart as CallStart1,
|
|
6
|
-
CallData as CallData2,
|
|
7
|
-
} from './rpcproto.pb.js'
|
|
8
4
|
|
|
9
5
|
export const protobufPackage = 'srpc'
|
|
10
6
|
|
|
11
7
|
/** Packet is a message sent over a srpc packet connection. */
|
|
12
8
|
export interface Packet {
|
|
13
9
|
body?:
|
|
14
|
-
| { $case: 'callStart'; callStart:
|
|
15
|
-
| { $case: 'callData'; callData:
|
|
10
|
+
| { $case: 'callStart'; callStart: CallStart }
|
|
11
|
+
| { $case: 'callData'; callData: CallData }
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
/** CallStart requests starting a new RPC call. */
|
|
@@ -61,13 +57,13 @@ export const Packet = {
|
|
|
61
57
|
writer: _m0.Writer = _m0.Writer.create()
|
|
62
58
|
): _m0.Writer {
|
|
63
59
|
if (message.body?.$case === 'callStart') {
|
|
64
|
-
|
|
60
|
+
CallStart.encode(
|
|
65
61
|
message.body.callStart,
|
|
66
62
|
writer.uint32(10).fork()
|
|
67
63
|
).ldelim()
|
|
68
64
|
}
|
|
69
65
|
if (message.body?.$case === 'callData') {
|
|
70
|
-
|
|
66
|
+
CallData.encode(message.body.callData, writer.uint32(18).fork()).ldelim()
|
|
71
67
|
}
|
|
72
68
|
return writer
|
|
73
69
|
},
|
|
@@ -82,13 +78,13 @@ export const Packet = {
|
|
|
82
78
|
case 1:
|
|
83
79
|
message.body = {
|
|
84
80
|
$case: 'callStart',
|
|
85
|
-
callStart:
|
|
81
|
+
callStart: CallStart.decode(reader, reader.uint32()),
|
|
86
82
|
}
|
|
87
83
|
break
|
|
88
84
|
case 2:
|
|
89
85
|
message.body = {
|
|
90
86
|
$case: 'callData',
|
|
91
|
-
callData:
|
|
87
|
+
callData: CallData.decode(reader, reader.uint32()),
|
|
92
88
|
}
|
|
93
89
|
break
|
|
94
90
|
default:
|
|
@@ -138,10 +134,10 @@ export const Packet = {
|
|
|
138
134
|
body: isSet(object.callStart)
|
|
139
135
|
? {
|
|
140
136
|
$case: 'callStart',
|
|
141
|
-
callStart:
|
|
137
|
+
callStart: CallStart.fromJSON(object.callStart),
|
|
142
138
|
}
|
|
143
139
|
: isSet(object.callData)
|
|
144
|
-
? { $case: 'callData', callData:
|
|
140
|
+
? { $case: 'callData', callData: CallData.fromJSON(object.callData) }
|
|
145
141
|
: undefined,
|
|
146
142
|
}
|
|
147
143
|
},
|
|
@@ -150,11 +146,11 @@ export const Packet = {
|
|
|
150
146
|
const obj: any = {}
|
|
151
147
|
message.body?.$case === 'callStart' &&
|
|
152
148
|
(obj.callStart = message.body?.callStart
|
|
153
|
-
?
|
|
149
|
+
? CallStart.toJSON(message.body?.callStart)
|
|
154
150
|
: undefined)
|
|
155
151
|
message.body?.$case === 'callData' &&
|
|
156
152
|
(obj.callData = message.body?.callData
|
|
157
|
-
?
|
|
153
|
+
? CallData.toJSON(message.body?.callData)
|
|
158
154
|
: undefined)
|
|
159
155
|
return obj
|
|
160
156
|
},
|
|
@@ -168,7 +164,7 @@ export const Packet = {
|
|
|
168
164
|
) {
|
|
169
165
|
message.body = {
|
|
170
166
|
$case: 'callStart',
|
|
171
|
-
callStart:
|
|
167
|
+
callStart: CallStart.fromPartial(object.body.callStart),
|
|
172
168
|
}
|
|
173
169
|
}
|
|
174
170
|
if (
|
|
@@ -178,7 +174,7 @@ export const Packet = {
|
|
|
178
174
|
) {
|
|
179
175
|
message.body = {
|
|
180
176
|
$case: 'callData',
|
|
181
|
-
callData:
|
|
177
|
+
callData: CallData.fromPartial(object.body.callData),
|
|
182
178
|
}
|
|
183
179
|
}
|
|
184
180
|
return message
|
package/srpc/server.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
encodePacketSource,
|
|
13
13
|
} from './packet.js'
|
|
14
14
|
import { StreamHandler } from './conn.js'
|
|
15
|
+
import { RpcStreamHandler } from '../rpcstream/rpcstream.js'
|
|
15
16
|
|
|
16
17
|
// Server implements the SRPC server in TypeScript with a Mux.
|
|
17
18
|
export class Server implements StreamHandler {
|
|
@@ -22,6 +23,11 @@ export class Server implements StreamHandler {
|
|
|
22
23
|
this.mux = mux
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
// rpcStreamHandler implements the RpcStreamHandler interface.
|
|
27
|
+
public get rpcStreamHandler(): RpcStreamHandler {
|
|
28
|
+
return this.handleDuplex.bind(this)
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
// startRpc starts a new server-side RPC.
|
|
26
32
|
// the returned RPC handles incoming Packets.
|
|
27
33
|
public startRpc(): ServerRPC {
|