@@ -214,7 +214,10 @@ export namespace RPC {
214
214
writer . ldelim ( )
215
215
}
216
216
} , ( reader , length ) => {
217
- const obj : any = { }
217
+ const obj : any = {
218
+ subscriptions : [ ] ,
219
+ messages : [ ]
220
+ }
218
221
219
222
const end = length == null ? reader . len : reader . pos + length
220
223
@@ -223,11 +226,9 @@ export namespace RPC {
223
226
224
227
switch ( tag >>> 3 ) {
225
228
case 1 :
226
- obj . subscriptions = obj . subscriptions ?? [ ]
227
229
obj . subscriptions . push ( RPC . SubOpts . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
228
230
break
229
231
case 2 :
230
- obj . messages = obj . messages ?? [ ]
231
232
obj . messages . push ( RPC . Message . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
232
233
break
233
234
case 3 :
@@ -239,17 +240,6 @@ export namespace RPC {
239
240
}
240
241
}
241
242
242
- obj . subscriptions = obj . subscriptions ?? [ ]
243
- obj . messages = obj . messages ?? [ ]
244
-
245
- if ( obj . subscriptions == null ) {
246
- throw new Error ( 'Protocol error: value for required field "subscriptions" was not found in protobuf' )
247
- }
248
-
249
- if ( obj . messages == null ) {
250
- throw new Error ( 'Protocol error: value for required field "messages" was not found in protobuf' )
251
- }
252
-
253
243
return obj
254
244
} )
255
245
}
@@ -323,7 +313,12 @@ export namespace ControlMessage {
323
313
writer . ldelim ( )
324
314
}
325
315
} , ( reader , length ) => {
326
- const obj : any = { }
316
+ const obj : any = {
317
+ ihave : [ ] ,
318
+ iwant : [ ] ,
319
+ graft : [ ] ,
320
+ prune : [ ]
321
+ }
327
322
328
323
const end = length == null ? reader . len : reader . pos + length
329
324
@@ -332,19 +327,15 @@ export namespace ControlMessage {
332
327
333
328
switch ( tag >>> 3 ) {
334
329
case 1 :
335
- obj . ihave = obj . ihave ?? [ ]
336
330
obj . ihave . push ( ControlIHave . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
337
331
break
338
332
case 2 :
339
- obj . iwant = obj . iwant ?? [ ]
340
333
obj . iwant . push ( ControlIWant . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
341
334
break
342
335
case 3 :
343
- obj . graft = obj . graft ?? [ ]
344
336
obj . graft . push ( ControlGraft . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
345
337
break
346
338
case 4 :
347
- obj . prune = obj . prune ?? [ ]
348
339
obj . prune . push ( ControlPrune . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
349
340
break
350
341
default :
@@ -353,27 +344,6 @@ export namespace ControlMessage {
353
344
}
354
345
}
355
346
356
- obj . ihave = obj . ihave ?? [ ]
357
- obj . iwant = obj . iwant ?? [ ]
358
- obj . graft = obj . graft ?? [ ]
359
- obj . prune = obj . prune ?? [ ]
360
-
361
- if ( obj . ihave == null ) {
362
- throw new Error ( 'Protocol error: value for required field "ihave" was not found in protobuf' )
363
- }
364
-
365
- if ( obj . iwant == null ) {
366
- throw new Error ( 'Protocol error: value for required field "iwant" was not found in protobuf' )
367
- }
368
-
369
- if ( obj . graft == null ) {
370
- throw new Error ( 'Protocol error: value for required field "graft" was not found in protobuf' )
371
- }
372
-
373
- if ( obj . prune == null ) {
374
- throw new Error ( 'Protocol error: value for required field "prune" was not found in protobuf' )
375
- }
376
-
377
347
return obj
378
348
} )
379
349
}
@@ -423,7 +393,9 @@ export namespace ControlIHave {
423
393
writer . ldelim ( )
424
394
}
425
395
} , ( reader , length ) => {
426
- const obj : any = { }
396
+ const obj : any = {
397
+ messageIDs : [ ]
398
+ }
427
399
428
400
const end = length == null ? reader . len : reader . pos + length
429
401
@@ -435,7 +407,6 @@ export namespace ControlIHave {
435
407
obj . topic = reader . string ( )
436
408
break
437
409
case 2 :
438
- obj . messageIDs = obj . messageIDs ?? [ ]
439
410
obj . messageIDs . push ( reader . bytes ( ) )
440
411
break
441
412
default :
@@ -444,12 +415,6 @@ export namespace ControlIHave {
444
415
}
445
416
}
446
417
447
- obj . messageIDs = obj . messageIDs ?? [ ]
448
-
449
- if ( obj . messageIDs == null ) {
450
- throw new Error ( 'Protocol error: value for required field "messageIDs" was not found in protobuf' )
451
- }
452
-
453
418
return obj
454
419
} )
455
420
}
@@ -493,7 +458,9 @@ export namespace ControlIWant {
493
458
writer . ldelim ( )
494
459
}
495
460
} , ( reader , length ) => {
496
- const obj : any = { }
461
+ const obj : any = {
462
+ messageIDs : [ ]
463
+ }
497
464
498
465
const end = length == null ? reader . len : reader . pos + length
499
466
@@ -502,7 +469,6 @@ export namespace ControlIWant {
502
469
503
470
switch ( tag >>> 3 ) {
504
471
case 1 :
505
- obj . messageIDs = obj . messageIDs ?? [ ]
506
472
obj . messageIDs . push ( reader . bytes ( ) )
507
473
break
508
474
default :
@@ -511,12 +477,6 @@ export namespace ControlIWant {
511
477
}
512
478
}
513
479
514
- obj . messageIDs = obj . messageIDs ?? [ ]
515
-
516
- if ( obj . messageIDs == null ) {
517
- throw new Error ( 'Protocol error: value for required field "messageIDs" was not found in protobuf' )
518
- }
519
-
520
480
return obj
521
481
} )
522
482
}
@@ -628,7 +588,9 @@ export namespace ControlPrune {
628
588
writer . ldelim ( )
629
589
}
630
590
} , ( reader , length ) => {
631
- const obj : any = { }
591
+ const obj : any = {
592
+ peers : [ ]
593
+ }
632
594
633
595
const end = length == null ? reader . len : reader . pos + length
634
596
@@ -640,7 +602,6 @@ export namespace ControlPrune {
640
602
obj . topic = reader . string ( )
641
603
break
642
604
case 2 :
643
- obj . peers = obj . peers ?? [ ]
644
605
obj . peers . push ( PeerInfo . codec ( ) . decode ( reader , reader . uint32 ( ) ) )
645
606
break
646
607
case 3 :
@@ -652,12 +613,6 @@ export namespace ControlPrune {
652
613
}
653
614
}
654
615
655
- obj . peers = obj . peers ?? [ ]
656
-
657
- if ( obj . peers == null ) {
658
- throw new Error ( 'Protocol error: value for required field "peers" was not found in protobuf' )
659
- }
660
-
661
616
return obj
662
617
} )
663
618
}
0 commit comments