starpc 0.13.2 → 0.14.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/e2e/mock/mock.pb.d.ts +94 -0
- package/dist/e2e/mock/mock.pb.js +107 -0
- package/dist/echo/echo.pb.d.ts +5 -5
- package/dist/echo/echo.pb.js +21 -21
- package/dist/rpcstream/rpcstream.pb.d.ts +7 -7
- package/dist/rpcstream/rpcstream.pb.js +64 -39
- package/dist/srpc/common-rpc.d.ts +1 -0
- package/dist/srpc/common-rpc.js +19 -4
- package/dist/srpc/rpcproto.pb.d.ts +22 -8
- package/dist/srpc/rpcproto.pb.js +91 -39
- package/e2e/e2e_test.go +65 -15
- package/e2e/mock/mock.go +29 -0
- package/e2e/mock/mock.pb.go +151 -0
- package/e2e/mock/mock.pb.ts +182 -0
- package/e2e/mock/mock.proto +13 -0
- package/e2e/mock/mock_srpc.pb.go +128 -0
- package/e2e/mock/mock_vtproto.pb.go +290 -0
- package/echo/echo.pb.ts +146 -90
- package/go.mod +10 -10
- package/go.sum +20 -20
- package/package.json +3 -3
- package/srpc/client-rpc.go +6 -0
- package/srpc/client.go +3 -0
- package/srpc/common-rpc.ts +21 -4
- package/srpc/msg-stream.go +8 -11
- package/srpc/muxed-conn.go +0 -1
- package/srpc/packet-rw.go +2 -3
- package/srpc/packet.go +7 -0
- package/srpc/rpcproto.pb.go +43 -25
- package/srpc/rpcproto.pb.ts +294 -183
- package/srpc/rpcproto.proto +2 -0
- package/srpc/rpcproto_vtproto.pb.go +74 -0
- package/srpc/server-http.go +1 -1
- package/srpc/server-rpc.go +5 -0
- package/srpc/stream.go +1 -1
- package/srpc/websocket.go +5 -1
- package/srpc/websocket.ts +1 -1
package/srpc/rpcproto.pb.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import Long from
|
|
3
|
-
import _m0 from
|
|
2
|
+
import Long from 'long'
|
|
3
|
+
import _m0 from 'protobufjs/minimal.js'
|
|
4
4
|
|
|
5
|
-
export const protobufPackage =
|
|
5
|
+
export const protobufPackage = 'srpc'
|
|
6
6
|
|
|
7
7
|
/** Packet is a message sent over a srpc packet connection. */
|
|
8
8
|
export interface Packet {
|
|
9
|
-
body?:
|
|
9
|
+
body?:
|
|
10
|
+
| { $case: 'callStart'; callStart: CallStart }
|
|
11
|
+
| { $case: 'callData'; callData: CallData }
|
|
12
|
+
| {
|
|
13
|
+
$case: 'callCancel'
|
|
14
|
+
callCancel: boolean
|
|
15
|
+
}
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
/** CallStart requests starting a new RPC call. */
|
|
@@ -15,84 +21,102 @@ export interface CallStart {
|
|
|
15
21
|
* RpcService is the service to contact.
|
|
16
22
|
* Must be set.
|
|
17
23
|
*/
|
|
18
|
-
rpcService: string
|
|
24
|
+
rpcService: string
|
|
19
25
|
/**
|
|
20
26
|
* RpcMethod is the RPC method to call.
|
|
21
27
|
* Must be set.
|
|
22
28
|
*/
|
|
23
|
-
rpcMethod: string
|
|
29
|
+
rpcMethod: string
|
|
24
30
|
/**
|
|
25
31
|
* Data contains the request or the first message in the stream.
|
|
26
32
|
* Optional if streaming.
|
|
27
33
|
*/
|
|
28
|
-
data: Uint8Array
|
|
34
|
+
data: Uint8Array
|
|
29
35
|
/** DataIsZero indicates Data is set with an empty message. */
|
|
30
|
-
dataIsZero: boolean
|
|
36
|
+
dataIsZero: boolean
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
/** CallData contains a message in a streaming RPC sequence. */
|
|
34
40
|
export interface CallData {
|
|
35
41
|
/** Data contains the packet in the sequence. */
|
|
36
|
-
data: Uint8Array
|
|
42
|
+
data: Uint8Array
|
|
37
43
|
/** DataIsZero indicates Data is set with an empty message. */
|
|
38
|
-
dataIsZero: boolean
|
|
44
|
+
dataIsZero: boolean
|
|
39
45
|
/** Complete indicates the RPC call is completed. */
|
|
40
|
-
complete: boolean
|
|
46
|
+
complete: boolean
|
|
41
47
|
/**
|
|
42
48
|
* Error contains any error that caused the RPC to fail.
|
|
43
49
|
* If set, implies complete=true.
|
|
44
50
|
*/
|
|
45
|
-
error: string
|
|
51
|
+
error: string
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
function createBasePacket(): Packet {
|
|
49
|
-
return { body: undefined }
|
|
55
|
+
return { body: undefined }
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
export const Packet = {
|
|
53
|
-
encode(
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
encode(
|
|
60
|
+
message: Packet,
|
|
61
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
62
|
+
): _m0.Writer {
|
|
63
|
+
if (message.body?.$case === 'callStart') {
|
|
64
|
+
CallStart.encode(
|
|
65
|
+
message.body.callStart,
|
|
66
|
+
writer.uint32(10).fork()
|
|
67
|
+
).ldelim()
|
|
68
|
+
}
|
|
69
|
+
if (message.body?.$case === 'callData') {
|
|
70
|
+
CallData.encode(message.body.callData, writer.uint32(18).fork()).ldelim()
|
|
56
71
|
}
|
|
57
|
-
if (message.body?.$case ===
|
|
58
|
-
|
|
72
|
+
if (message.body?.$case === 'callCancel') {
|
|
73
|
+
writer.uint32(24).bool(message.body.callCancel)
|
|
59
74
|
}
|
|
60
|
-
return writer
|
|
75
|
+
return writer
|
|
61
76
|
},
|
|
62
77
|
|
|
63
78
|
decode(input: _m0.Reader | Uint8Array, length?: number): Packet {
|
|
64
|
-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
|
65
|
-
let end = length === undefined ? reader.len : reader.pos + length
|
|
66
|
-
const message = createBasePacket()
|
|
79
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
|
80
|
+
let end = length === undefined ? reader.len : reader.pos + length
|
|
81
|
+
const message = createBasePacket()
|
|
67
82
|
while (reader.pos < end) {
|
|
68
|
-
const tag = reader.uint32()
|
|
83
|
+
const tag = reader.uint32()
|
|
69
84
|
switch (tag >>> 3) {
|
|
70
85
|
case 1:
|
|
71
|
-
message.body = {
|
|
72
|
-
|
|
86
|
+
message.body = {
|
|
87
|
+
$case: 'callStart',
|
|
88
|
+
callStart: CallStart.decode(reader, reader.uint32()),
|
|
89
|
+
}
|
|
90
|
+
break
|
|
73
91
|
case 2:
|
|
74
|
-
message.body = {
|
|
75
|
-
|
|
92
|
+
message.body = {
|
|
93
|
+
$case: 'callData',
|
|
94
|
+
callData: CallData.decode(reader, reader.uint32()),
|
|
95
|
+
}
|
|
96
|
+
break
|
|
97
|
+
case 3:
|
|
98
|
+
message.body = { $case: 'callCancel', callCancel: reader.bool() }
|
|
99
|
+
break
|
|
76
100
|
default:
|
|
77
|
-
reader.skipType(tag & 7)
|
|
78
|
-
break
|
|
101
|
+
reader.skipType(tag & 7)
|
|
102
|
+
break
|
|
79
103
|
}
|
|
80
104
|
}
|
|
81
|
-
return message
|
|
105
|
+
return message
|
|
82
106
|
},
|
|
83
107
|
|
|
84
108
|
// encodeTransform encodes a source of message objects.
|
|
85
109
|
// Transform<Packet, Uint8Array>
|
|
86
110
|
async *encodeTransform(
|
|
87
|
-
source: AsyncIterable<Packet | Packet[]> | Iterable<Packet | Packet[]
|
|
111
|
+
source: AsyncIterable<Packet | Packet[]> | Iterable<Packet | Packet[]>
|
|
88
112
|
): AsyncIterable<Uint8Array> {
|
|
89
113
|
for await (const pkt of source) {
|
|
90
114
|
if (Array.isArray(pkt)) {
|
|
91
115
|
for (const p of pkt) {
|
|
92
|
-
yield* [Packet.encode(p).finish()]
|
|
116
|
+
yield* [Packet.encode(p).finish()]
|
|
93
117
|
}
|
|
94
118
|
} else {
|
|
95
|
-
yield* [Packet.encode(pkt).finish()]
|
|
119
|
+
yield* [Packet.encode(pkt).finish()]
|
|
96
120
|
}
|
|
97
121
|
}
|
|
98
122
|
},
|
|
@@ -100,15 +124,17 @@ export const Packet = {
|
|
|
100
124
|
// decodeTransform decodes a source of encoded messages.
|
|
101
125
|
// Transform<Uint8Array, Packet>
|
|
102
126
|
async *decodeTransform(
|
|
103
|
-
source:
|
|
127
|
+
source:
|
|
128
|
+
| AsyncIterable<Uint8Array | Uint8Array[]>
|
|
129
|
+
| Iterable<Uint8Array | Uint8Array[]>
|
|
104
130
|
): AsyncIterable<Packet> {
|
|
105
131
|
for await (const pkt of source) {
|
|
106
132
|
if (Array.isArray(pkt)) {
|
|
107
133
|
for (const p of pkt) {
|
|
108
|
-
yield* [Packet.decode(p)]
|
|
134
|
+
yield* [Packet.decode(p)]
|
|
109
135
|
}
|
|
110
136
|
} else {
|
|
111
|
-
yield* [Packet.decode(pkt)]
|
|
137
|
+
yield* [Packet.decode(pkt)]
|
|
112
138
|
}
|
|
113
139
|
}
|
|
114
140
|
},
|
|
@@ -116,94 +142,136 @@ export const Packet = {
|
|
|
116
142
|
fromJSON(object: any): Packet {
|
|
117
143
|
return {
|
|
118
144
|
body: isSet(object.callStart)
|
|
119
|
-
? {
|
|
145
|
+
? {
|
|
146
|
+
$case: 'callStart',
|
|
147
|
+
callStart: CallStart.fromJSON(object.callStart),
|
|
148
|
+
}
|
|
120
149
|
: isSet(object.callData)
|
|
121
|
-
? { $case:
|
|
150
|
+
? { $case: 'callData', callData: CallData.fromJSON(object.callData) }
|
|
151
|
+
: isSet(object.callCancel)
|
|
152
|
+
? { $case: 'callCancel', callCancel: Boolean(object.callCancel) }
|
|
122
153
|
: undefined,
|
|
123
|
-
}
|
|
154
|
+
}
|
|
124
155
|
},
|
|
125
156
|
|
|
126
157
|
toJSON(message: Packet): unknown {
|
|
127
|
-
const obj: any = {}
|
|
128
|
-
message.body?.$case ===
|
|
129
|
-
(obj.callStart = message.body?.callStart
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
158
|
+
const obj: any = {}
|
|
159
|
+
message.body?.$case === 'callStart' &&
|
|
160
|
+
(obj.callStart = message.body?.callStart
|
|
161
|
+
? CallStart.toJSON(message.body?.callStart)
|
|
162
|
+
: undefined)
|
|
163
|
+
message.body?.$case === 'callData' &&
|
|
164
|
+
(obj.callData = message.body?.callData
|
|
165
|
+
? CallData.toJSON(message.body?.callData)
|
|
166
|
+
: undefined)
|
|
167
|
+
message.body?.$case === 'callCancel' &&
|
|
168
|
+
(obj.callCancel = message.body?.callCancel)
|
|
169
|
+
return obj
|
|
133
170
|
},
|
|
134
171
|
|
|
135
172
|
fromPartial<I extends Exact<DeepPartial<Packet>, I>>(object: I): Packet {
|
|
136
|
-
const message = createBasePacket()
|
|
137
|
-
if (
|
|
138
|
-
|
|
173
|
+
const message = createBasePacket()
|
|
174
|
+
if (
|
|
175
|
+
object.body?.$case === 'callStart' &&
|
|
176
|
+
object.body?.callStart !== undefined &&
|
|
177
|
+
object.body?.callStart !== null
|
|
178
|
+
) {
|
|
179
|
+
message.body = {
|
|
180
|
+
$case: 'callStart',
|
|
181
|
+
callStart: CallStart.fromPartial(object.body.callStart),
|
|
182
|
+
}
|
|
139
183
|
}
|
|
140
|
-
if (
|
|
141
|
-
|
|
184
|
+
if (
|
|
185
|
+
object.body?.$case === 'callData' &&
|
|
186
|
+
object.body?.callData !== undefined &&
|
|
187
|
+
object.body?.callData !== null
|
|
188
|
+
) {
|
|
189
|
+
message.body = {
|
|
190
|
+
$case: 'callData',
|
|
191
|
+
callData: CallData.fromPartial(object.body.callData),
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (
|
|
195
|
+
object.body?.$case === 'callCancel' &&
|
|
196
|
+
object.body?.callCancel !== undefined &&
|
|
197
|
+
object.body?.callCancel !== null
|
|
198
|
+
) {
|
|
199
|
+
message.body = { $case: 'callCancel', callCancel: object.body.callCancel }
|
|
142
200
|
}
|
|
143
|
-
return message
|
|
201
|
+
return message
|
|
144
202
|
},
|
|
145
|
-
}
|
|
203
|
+
}
|
|
146
204
|
|
|
147
205
|
function createBaseCallStart(): CallStart {
|
|
148
|
-
return {
|
|
206
|
+
return {
|
|
207
|
+
rpcService: '',
|
|
208
|
+
rpcMethod: '',
|
|
209
|
+
data: new Uint8Array(),
|
|
210
|
+
dataIsZero: false,
|
|
211
|
+
}
|
|
149
212
|
}
|
|
150
213
|
|
|
151
214
|
export const CallStart = {
|
|
152
|
-
encode(
|
|
153
|
-
|
|
154
|
-
|
|
215
|
+
encode(
|
|
216
|
+
message: CallStart,
|
|
217
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
218
|
+
): _m0.Writer {
|
|
219
|
+
if (message.rpcService !== '') {
|
|
220
|
+
writer.uint32(10).string(message.rpcService)
|
|
155
221
|
}
|
|
156
|
-
if (message.rpcMethod !==
|
|
157
|
-
writer.uint32(18).string(message.rpcMethod)
|
|
222
|
+
if (message.rpcMethod !== '') {
|
|
223
|
+
writer.uint32(18).string(message.rpcMethod)
|
|
158
224
|
}
|
|
159
225
|
if (message.data.length !== 0) {
|
|
160
|
-
writer.uint32(26).bytes(message.data)
|
|
226
|
+
writer.uint32(26).bytes(message.data)
|
|
161
227
|
}
|
|
162
228
|
if (message.dataIsZero === true) {
|
|
163
|
-
writer.uint32(32).bool(message.dataIsZero)
|
|
229
|
+
writer.uint32(32).bool(message.dataIsZero)
|
|
164
230
|
}
|
|
165
|
-
return writer
|
|
231
|
+
return writer
|
|
166
232
|
},
|
|
167
233
|
|
|
168
234
|
decode(input: _m0.Reader | Uint8Array, length?: number): CallStart {
|
|
169
|
-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
|
170
|
-
let end = length === undefined ? reader.len : reader.pos + length
|
|
171
|
-
const message = createBaseCallStart()
|
|
235
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
|
236
|
+
let end = length === undefined ? reader.len : reader.pos + length
|
|
237
|
+
const message = createBaseCallStart()
|
|
172
238
|
while (reader.pos < end) {
|
|
173
|
-
const tag = reader.uint32()
|
|
239
|
+
const tag = reader.uint32()
|
|
174
240
|
switch (tag >>> 3) {
|
|
175
241
|
case 1:
|
|
176
|
-
message.rpcService = reader.string()
|
|
177
|
-
break
|
|
242
|
+
message.rpcService = reader.string()
|
|
243
|
+
break
|
|
178
244
|
case 2:
|
|
179
|
-
message.rpcMethod = reader.string()
|
|
180
|
-
break
|
|
245
|
+
message.rpcMethod = reader.string()
|
|
246
|
+
break
|
|
181
247
|
case 3:
|
|
182
|
-
message.data = reader.bytes()
|
|
183
|
-
break
|
|
248
|
+
message.data = reader.bytes()
|
|
249
|
+
break
|
|
184
250
|
case 4:
|
|
185
|
-
message.dataIsZero = reader.bool()
|
|
186
|
-
break
|
|
251
|
+
message.dataIsZero = reader.bool()
|
|
252
|
+
break
|
|
187
253
|
default:
|
|
188
|
-
reader.skipType(tag & 7)
|
|
189
|
-
break
|
|
254
|
+
reader.skipType(tag & 7)
|
|
255
|
+
break
|
|
190
256
|
}
|
|
191
257
|
}
|
|
192
|
-
return message
|
|
258
|
+
return message
|
|
193
259
|
},
|
|
194
260
|
|
|
195
261
|
// encodeTransform encodes a source of message objects.
|
|
196
262
|
// Transform<CallStart, Uint8Array>
|
|
197
263
|
async *encodeTransform(
|
|
198
|
-
source:
|
|
264
|
+
source:
|
|
265
|
+
| AsyncIterable<CallStart | CallStart[]>
|
|
266
|
+
| Iterable<CallStart | CallStart[]>
|
|
199
267
|
): AsyncIterable<Uint8Array> {
|
|
200
268
|
for await (const pkt of source) {
|
|
201
269
|
if (Array.isArray(pkt)) {
|
|
202
270
|
for (const p of pkt) {
|
|
203
|
-
yield* [CallStart.encode(p).finish()]
|
|
271
|
+
yield* [CallStart.encode(p).finish()]
|
|
204
272
|
}
|
|
205
273
|
} else {
|
|
206
|
-
yield* [CallStart.encode(pkt).finish()]
|
|
274
|
+
yield* [CallStart.encode(pkt).finish()]
|
|
207
275
|
}
|
|
208
276
|
}
|
|
209
277
|
},
|
|
@@ -211,108 +279,126 @@ export const CallStart = {
|
|
|
211
279
|
// decodeTransform decodes a source of encoded messages.
|
|
212
280
|
// Transform<Uint8Array, CallStart>
|
|
213
281
|
async *decodeTransform(
|
|
214
|
-
source:
|
|
282
|
+
source:
|
|
283
|
+
| AsyncIterable<Uint8Array | Uint8Array[]>
|
|
284
|
+
| Iterable<Uint8Array | Uint8Array[]>
|
|
215
285
|
): AsyncIterable<CallStart> {
|
|
216
286
|
for await (const pkt of source) {
|
|
217
287
|
if (Array.isArray(pkt)) {
|
|
218
288
|
for (const p of pkt) {
|
|
219
|
-
yield* [CallStart.decode(p)]
|
|
289
|
+
yield* [CallStart.decode(p)]
|
|
220
290
|
}
|
|
221
291
|
} else {
|
|
222
|
-
yield* [CallStart.decode(pkt)]
|
|
292
|
+
yield* [CallStart.decode(pkt)]
|
|
223
293
|
}
|
|
224
294
|
}
|
|
225
295
|
},
|
|
226
296
|
|
|
227
297
|
fromJSON(object: any): CallStart {
|
|
228
298
|
return {
|
|
229
|
-
rpcService: isSet(object.rpcService) ? String(object.rpcService) :
|
|
230
|
-
rpcMethod: isSet(object.rpcMethod) ? String(object.rpcMethod) :
|
|
231
|
-
data: isSet(object.data)
|
|
299
|
+
rpcService: isSet(object.rpcService) ? String(object.rpcService) : '',
|
|
300
|
+
rpcMethod: isSet(object.rpcMethod) ? String(object.rpcMethod) : '',
|
|
301
|
+
data: isSet(object.data)
|
|
302
|
+
? bytesFromBase64(object.data)
|
|
303
|
+
: new Uint8Array(),
|
|
232
304
|
dataIsZero: isSet(object.dataIsZero) ? Boolean(object.dataIsZero) : false,
|
|
233
|
-
}
|
|
305
|
+
}
|
|
234
306
|
},
|
|
235
307
|
|
|
236
308
|
toJSON(message: CallStart): unknown {
|
|
237
|
-
const obj: any = {}
|
|
238
|
-
message.rpcService !== undefined && (obj.rpcService = message.rpcService)
|
|
239
|
-
message.rpcMethod !== undefined && (obj.rpcMethod = message.rpcMethod)
|
|
309
|
+
const obj: any = {}
|
|
310
|
+
message.rpcService !== undefined && (obj.rpcService = message.rpcService)
|
|
311
|
+
message.rpcMethod !== undefined && (obj.rpcMethod = message.rpcMethod)
|
|
240
312
|
message.data !== undefined &&
|
|
241
|
-
(obj.data = base64FromBytes(
|
|
242
|
-
|
|
243
|
-
|
|
313
|
+
(obj.data = base64FromBytes(
|
|
314
|
+
message.data !== undefined ? message.data : new Uint8Array()
|
|
315
|
+
))
|
|
316
|
+
message.dataIsZero !== undefined && (obj.dataIsZero = message.dataIsZero)
|
|
317
|
+
return obj
|
|
244
318
|
},
|
|
245
319
|
|
|
246
|
-
fromPartial<I extends Exact<DeepPartial<CallStart>, I>>(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
message
|
|
250
|
-
message.
|
|
251
|
-
message.
|
|
252
|
-
|
|
320
|
+
fromPartial<I extends Exact<DeepPartial<CallStart>, I>>(
|
|
321
|
+
object: I
|
|
322
|
+
): CallStart {
|
|
323
|
+
const message = createBaseCallStart()
|
|
324
|
+
message.rpcService = object.rpcService ?? ''
|
|
325
|
+
message.rpcMethod = object.rpcMethod ?? ''
|
|
326
|
+
message.data = object.data ?? new Uint8Array()
|
|
327
|
+
message.dataIsZero = object.dataIsZero ?? false
|
|
328
|
+
return message
|
|
253
329
|
},
|
|
254
|
-
}
|
|
330
|
+
}
|
|
255
331
|
|
|
256
332
|
function createBaseCallData(): CallData {
|
|
257
|
-
return {
|
|
333
|
+
return {
|
|
334
|
+
data: new Uint8Array(),
|
|
335
|
+
dataIsZero: false,
|
|
336
|
+
complete: false,
|
|
337
|
+
error: '',
|
|
338
|
+
}
|
|
258
339
|
}
|
|
259
340
|
|
|
260
341
|
export const CallData = {
|
|
261
|
-
encode(
|
|
342
|
+
encode(
|
|
343
|
+
message: CallData,
|
|
344
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
345
|
+
): _m0.Writer {
|
|
262
346
|
if (message.data.length !== 0) {
|
|
263
|
-
writer.uint32(10).bytes(message.data)
|
|
347
|
+
writer.uint32(10).bytes(message.data)
|
|
264
348
|
}
|
|
265
349
|
if (message.dataIsZero === true) {
|
|
266
|
-
writer.uint32(16).bool(message.dataIsZero)
|
|
350
|
+
writer.uint32(16).bool(message.dataIsZero)
|
|
267
351
|
}
|
|
268
352
|
if (message.complete === true) {
|
|
269
|
-
writer.uint32(24).bool(message.complete)
|
|
353
|
+
writer.uint32(24).bool(message.complete)
|
|
270
354
|
}
|
|
271
|
-
if (message.error !==
|
|
272
|
-
writer.uint32(34).string(message.error)
|
|
355
|
+
if (message.error !== '') {
|
|
356
|
+
writer.uint32(34).string(message.error)
|
|
273
357
|
}
|
|
274
|
-
return writer
|
|
358
|
+
return writer
|
|
275
359
|
},
|
|
276
360
|
|
|
277
361
|
decode(input: _m0.Reader | Uint8Array, length?: number): CallData {
|
|
278
|
-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
|
279
|
-
let end = length === undefined ? reader.len : reader.pos + length
|
|
280
|
-
const message = createBaseCallData()
|
|
362
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
|
|
363
|
+
let end = length === undefined ? reader.len : reader.pos + length
|
|
364
|
+
const message = createBaseCallData()
|
|
281
365
|
while (reader.pos < end) {
|
|
282
|
-
const tag = reader.uint32()
|
|
366
|
+
const tag = reader.uint32()
|
|
283
367
|
switch (tag >>> 3) {
|
|
284
368
|
case 1:
|
|
285
|
-
message.data = reader.bytes()
|
|
286
|
-
break
|
|
369
|
+
message.data = reader.bytes()
|
|
370
|
+
break
|
|
287
371
|
case 2:
|
|
288
|
-
message.dataIsZero = reader.bool()
|
|
289
|
-
break
|
|
372
|
+
message.dataIsZero = reader.bool()
|
|
373
|
+
break
|
|
290
374
|
case 3:
|
|
291
|
-
message.complete = reader.bool()
|
|
292
|
-
break
|
|
375
|
+
message.complete = reader.bool()
|
|
376
|
+
break
|
|
293
377
|
case 4:
|
|
294
|
-
message.error = reader.string()
|
|
295
|
-
break
|
|
378
|
+
message.error = reader.string()
|
|
379
|
+
break
|
|
296
380
|
default:
|
|
297
|
-
reader.skipType(tag & 7)
|
|
298
|
-
break
|
|
381
|
+
reader.skipType(tag & 7)
|
|
382
|
+
break
|
|
299
383
|
}
|
|
300
384
|
}
|
|
301
|
-
return message
|
|
385
|
+
return message
|
|
302
386
|
},
|
|
303
387
|
|
|
304
388
|
// encodeTransform encodes a source of message objects.
|
|
305
389
|
// Transform<CallData, Uint8Array>
|
|
306
390
|
async *encodeTransform(
|
|
307
|
-
source:
|
|
391
|
+
source:
|
|
392
|
+
| AsyncIterable<CallData | CallData[]>
|
|
393
|
+
| Iterable<CallData | CallData[]>
|
|
308
394
|
): AsyncIterable<Uint8Array> {
|
|
309
395
|
for await (const pkt of source) {
|
|
310
396
|
if (Array.isArray(pkt)) {
|
|
311
397
|
for (const p of pkt) {
|
|
312
|
-
yield* [CallData.encode(p).finish()]
|
|
398
|
+
yield* [CallData.encode(p).finish()]
|
|
313
399
|
}
|
|
314
400
|
} else {
|
|
315
|
-
yield* [CallData.encode(pkt).finish()]
|
|
401
|
+
yield* [CallData.encode(pkt).finish()]
|
|
316
402
|
}
|
|
317
403
|
}
|
|
318
404
|
},
|
|
@@ -320,110 +406,135 @@ export const CallData = {
|
|
|
320
406
|
// decodeTransform decodes a source of encoded messages.
|
|
321
407
|
// Transform<Uint8Array, CallData>
|
|
322
408
|
async *decodeTransform(
|
|
323
|
-
source:
|
|
409
|
+
source:
|
|
410
|
+
| AsyncIterable<Uint8Array | Uint8Array[]>
|
|
411
|
+
| Iterable<Uint8Array | Uint8Array[]>
|
|
324
412
|
): AsyncIterable<CallData> {
|
|
325
413
|
for await (const pkt of source) {
|
|
326
414
|
if (Array.isArray(pkt)) {
|
|
327
415
|
for (const p of pkt) {
|
|
328
|
-
yield* [CallData.decode(p)]
|
|
416
|
+
yield* [CallData.decode(p)]
|
|
329
417
|
}
|
|
330
418
|
} else {
|
|
331
|
-
yield* [CallData.decode(pkt)]
|
|
419
|
+
yield* [CallData.decode(pkt)]
|
|
332
420
|
}
|
|
333
421
|
}
|
|
334
422
|
},
|
|
335
423
|
|
|
336
424
|
fromJSON(object: any): CallData {
|
|
337
425
|
return {
|
|
338
|
-
data: isSet(object.data)
|
|
426
|
+
data: isSet(object.data)
|
|
427
|
+
? bytesFromBase64(object.data)
|
|
428
|
+
: new Uint8Array(),
|
|
339
429
|
dataIsZero: isSet(object.dataIsZero) ? Boolean(object.dataIsZero) : false,
|
|
340
430
|
complete: isSet(object.complete) ? Boolean(object.complete) : false,
|
|
341
|
-
error: isSet(object.error) ? String(object.error) :
|
|
342
|
-
}
|
|
431
|
+
error: isSet(object.error) ? String(object.error) : '',
|
|
432
|
+
}
|
|
343
433
|
},
|
|
344
434
|
|
|
345
435
|
toJSON(message: CallData): unknown {
|
|
346
|
-
const obj: any = {}
|
|
436
|
+
const obj: any = {}
|
|
347
437
|
message.data !== undefined &&
|
|
348
|
-
(obj.data = base64FromBytes(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
message.
|
|
352
|
-
|
|
438
|
+
(obj.data = base64FromBytes(
|
|
439
|
+
message.data !== undefined ? message.data : new Uint8Array()
|
|
440
|
+
))
|
|
441
|
+
message.dataIsZero !== undefined && (obj.dataIsZero = message.dataIsZero)
|
|
442
|
+
message.complete !== undefined && (obj.complete = message.complete)
|
|
443
|
+
message.error !== undefined && (obj.error = message.error)
|
|
444
|
+
return obj
|
|
353
445
|
},
|
|
354
446
|
|
|
355
447
|
fromPartial<I extends Exact<DeepPartial<CallData>, I>>(object: I): CallData {
|
|
356
|
-
const message = createBaseCallData()
|
|
357
|
-
message.data = object.data ?? new Uint8Array()
|
|
358
|
-
message.dataIsZero = object.dataIsZero ?? false
|
|
359
|
-
message.complete = object.complete ?? false
|
|
360
|
-
message.error = object.error ??
|
|
361
|
-
return message
|
|
448
|
+
const message = createBaseCallData()
|
|
449
|
+
message.data = object.data ?? new Uint8Array()
|
|
450
|
+
message.dataIsZero = object.dataIsZero ?? false
|
|
451
|
+
message.complete = object.complete ?? false
|
|
452
|
+
message.error = object.error ?? ''
|
|
453
|
+
return message
|
|
362
454
|
},
|
|
363
|
-
}
|
|
455
|
+
}
|
|
364
456
|
|
|
365
|
-
declare var self: any | undefined
|
|
366
|
-
declare var window: any | undefined
|
|
367
|
-
declare var global: any | undefined
|
|
457
|
+
declare var self: any | undefined
|
|
458
|
+
declare var window: any | undefined
|
|
459
|
+
declare var global: any | undefined
|
|
368
460
|
var globalThis: any = (() => {
|
|
369
|
-
if (typeof globalThis !==
|
|
370
|
-
return globalThis
|
|
461
|
+
if (typeof globalThis !== 'undefined') {
|
|
462
|
+
return globalThis
|
|
371
463
|
}
|
|
372
|
-
if (typeof self !==
|
|
373
|
-
return self
|
|
464
|
+
if (typeof self !== 'undefined') {
|
|
465
|
+
return self
|
|
374
466
|
}
|
|
375
|
-
if (typeof window !==
|
|
376
|
-
return window
|
|
467
|
+
if (typeof window !== 'undefined') {
|
|
468
|
+
return window
|
|
377
469
|
}
|
|
378
|
-
if (typeof global !==
|
|
379
|
-
return global
|
|
470
|
+
if (typeof global !== 'undefined') {
|
|
471
|
+
return global
|
|
380
472
|
}
|
|
381
|
-
throw
|
|
382
|
-
})()
|
|
473
|
+
throw 'Unable to locate global object'
|
|
474
|
+
})()
|
|
383
475
|
|
|
384
476
|
function bytesFromBase64(b64: string): Uint8Array {
|
|
385
477
|
if (globalThis.Buffer) {
|
|
386
|
-
return Uint8Array.from(globalThis.Buffer.from(b64,
|
|
478
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, 'base64'))
|
|
387
479
|
} else {
|
|
388
|
-
const bin = globalThis.atob(b64)
|
|
389
|
-
const arr = new Uint8Array(bin.length)
|
|
480
|
+
const bin = globalThis.atob(b64)
|
|
481
|
+
const arr = new Uint8Array(bin.length)
|
|
390
482
|
for (let i = 0; i < bin.length; ++i) {
|
|
391
|
-
arr[i] = bin.charCodeAt(i)
|
|
483
|
+
arr[i] = bin.charCodeAt(i)
|
|
392
484
|
}
|
|
393
|
-
return arr
|
|
485
|
+
return arr
|
|
394
486
|
}
|
|
395
487
|
}
|
|
396
488
|
|
|
397
489
|
function base64FromBytes(arr: Uint8Array): string {
|
|
398
490
|
if (globalThis.Buffer) {
|
|
399
|
-
return globalThis.Buffer.from(arr).toString(
|
|
491
|
+
return globalThis.Buffer.from(arr).toString('base64')
|
|
400
492
|
} else {
|
|
401
|
-
const bin: string[] = []
|
|
493
|
+
const bin: string[] = []
|
|
402
494
|
arr.forEach((byte) => {
|
|
403
|
-
bin.push(String.fromCharCode(byte))
|
|
404
|
-
})
|
|
405
|
-
return globalThis.btoa(bin.join(
|
|
495
|
+
bin.push(String.fromCharCode(byte))
|
|
496
|
+
})
|
|
497
|
+
return globalThis.btoa(bin.join(''))
|
|
406
498
|
}
|
|
407
499
|
}
|
|
408
500
|
|
|
409
|
-
type Builtin =
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
type
|
|
419
|
-
|
|
420
|
-
:
|
|
501
|
+
type Builtin =
|
|
502
|
+
| Date
|
|
503
|
+
| Function
|
|
504
|
+
| Uint8Array
|
|
505
|
+
| string
|
|
506
|
+
| number
|
|
507
|
+
| boolean
|
|
508
|
+
| undefined
|
|
509
|
+
|
|
510
|
+
export type DeepPartial<T> = T extends Builtin
|
|
511
|
+
? T
|
|
512
|
+
: T extends Long
|
|
513
|
+
? string | number | Long
|
|
514
|
+
: T extends Array<infer U>
|
|
515
|
+
? Array<DeepPartial<U>>
|
|
516
|
+
: T extends ReadonlyArray<infer U>
|
|
517
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
518
|
+
: T extends { $case: string }
|
|
519
|
+
? { [K in keyof Omit<T, '$case'>]?: DeepPartial<T[K]> } & {
|
|
520
|
+
$case: T['$case']
|
|
521
|
+
}
|
|
522
|
+
: T extends {}
|
|
523
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
524
|
+
: Partial<T>
|
|
525
|
+
|
|
526
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never
|
|
527
|
+
export type Exact<P, I extends P> = P extends Builtin
|
|
528
|
+
? P
|
|
529
|
+
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
|
530
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never
|
|
531
|
+
}
|
|
421
532
|
|
|
422
533
|
if (_m0.util.Long !== Long) {
|
|
423
|
-
_m0.util.Long = Long as any
|
|
424
|
-
_m0.configure()
|
|
534
|
+
_m0.util.Long = Long as any
|
|
535
|
+
_m0.configure()
|
|
425
536
|
}
|
|
426
537
|
|
|
427
538
|
function isSet(value: any): boolean {
|
|
428
|
-
return value !== null && value !== undefined
|
|
539
|
+
return value !== null && value !== undefined
|
|
429
540
|
}
|