2
2
/* eslint-disable complexity */
3
3
/* eslint-disable @typescript-eslint/no-namespace */
4
4
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
5
+ /* eslint-disable @typescript-eslint/no-empty-interface */
5
6
6
7
import { encodeMessage , decodeMessage , message } from 'protons-runtime'
7
- import type { Uint8ArrayList } from 'uint8arraylist'
8
8
import type { Codec } from 'protons-runtime'
9
+ import type { Uint8ArrayList } from 'uint8arraylist'
9
10
10
11
export interface RPC {
11
12
subscriptions : RPC . SubOpts [ ]
@@ -70,7 +71,7 @@ export namespace RPC {
70
71
return _codec
71
72
}
72
73
73
- export const encode = ( obj : SubOpts ) : Uint8Array => {
74
+ export const encode = ( obj : Partial < SubOpts > ) : Uint8Array => {
74
75
return encodeMessage ( obj , SubOpts . codec ( ) )
75
76
}
76
77
@@ -171,7 +172,7 @@ export namespace RPC {
171
172
return _codec
172
173
}
173
174
174
- export const encode = ( obj : Message ) : Uint8Array => {
175
+ export const encode = ( obj : Partial < Message > ) : Uint8Array => {
175
176
return encodeMessage ( obj , Message . codec ( ) )
176
177
}
177
178
@@ -192,26 +193,20 @@ export namespace RPC {
192
193
if ( obj . subscriptions != null ) {
193
194
for ( const value of obj . subscriptions ) {
194
195
w . uint32 ( 10 )
195
- RPC . SubOpts . codec ( ) . encode ( value , w , {
196
- writeDefaults : true
197
- } )
196
+ RPC . SubOpts . codec ( ) . encode ( value , w )
198
197
}
199
198
}
200
199
201
200
if ( obj . messages != null ) {
202
201
for ( const value of obj . messages ) {
203
202
w . uint32 ( 18 )
204
- RPC . Message . codec ( ) . encode ( value , w , {
205
- writeDefaults : true
206
- } )
203
+ RPC . Message . codec ( ) . encode ( value , w )
207
204
}
208
205
}
209
206
210
207
if ( obj . control != null ) {
211
208
w . uint32 ( 26 )
212
- ControlMessage . codec ( ) . encode ( obj . control , w , {
213
- writeDefaults : false
214
- } )
209
+ ControlMessage . codec ( ) . encode ( obj . control , w )
215
210
}
216
211
217
212
if ( opts . lengthDelimited !== false ) {
@@ -251,7 +246,7 @@ export namespace RPC {
251
246
return _codec
252
247
}
253
248
254
- export const encode = ( obj : RPC ) : Uint8Array => {
249
+ export const encode = ( obj : Partial < RPC > ) : Uint8Array => {
255
250
return encodeMessage ( obj , RPC . codec ( ) )
256
251
}
257
252
@@ -280,36 +275,28 @@ export namespace ControlMessage {
280
275
if ( obj . ihave != null ) {
281
276
for ( const value of obj . ihave ) {
282
277
w . uint32 ( 10 )
283
- ControlIHave . codec ( ) . encode ( value , w , {
284
- writeDefaults : true
285
- } )
278
+ ControlIHave . codec ( ) . encode ( value , w )
286
279
}
287
280
}
288
281
289
282
if ( obj . iwant != null ) {
290
283
for ( const value of obj . iwant ) {
291
284
w . uint32 ( 18 )
292
- ControlIWant . codec ( ) . encode ( value , w , {
293
- writeDefaults : true
294
- } )
285
+ ControlIWant . codec ( ) . encode ( value , w )
295
286
}
296
287
}
297
288
298
289
if ( obj . graft != null ) {
299
290
for ( const value of obj . graft ) {
300
291
w . uint32 ( 26 )
301
- ControlGraft . codec ( ) . encode ( value , w , {
302
- writeDefaults : true
303
- } )
292
+ ControlGraft . codec ( ) . encode ( value , w )
304
293
}
305
294
}
306
295
307
296
if ( obj . prune != null ) {
308
297
for ( const value of obj . prune ) {
309
298
w . uint32 ( 34 )
310
- ControlPrune . codec ( ) . encode ( value , w , {
311
- writeDefaults : true
312
- } )
299
+ ControlPrune . codec ( ) . encode ( value , w )
313
300
}
314
301
}
315
302
@@ -355,7 +342,7 @@ export namespace ControlMessage {
355
342
return _codec
356
343
}
357
344
358
- export const encode = ( obj : ControlMessage ) : Uint8Array => {
345
+ export const encode = ( obj : Partial < ControlMessage > ) : Uint8Array => {
359
346
return encodeMessage ( obj , ControlMessage . codec ( ) )
360
347
}
361
348
@@ -424,7 +411,7 @@ export namespace ControlIHave {
424
411
return _codec
425
412
}
426
413
427
- export const encode = ( obj : ControlIHave ) : Uint8Array => {
414
+ export const encode = ( obj : Partial < ControlIHave > ) : Uint8Array => {
428
415
return encodeMessage ( obj , ControlIHave . codec ( ) )
429
416
}
430
417
@@ -484,7 +471,7 @@ export namespace ControlIWant {
484
471
return _codec
485
472
}
486
473
487
- export const encode = ( obj : ControlIWant ) : Uint8Array => {
474
+ export const encode = ( obj : Partial < ControlIWant > ) : Uint8Array => {
488
475
return encodeMessage ( obj , ControlIWant . codec ( ) )
489
476
}
490
477
@@ -540,7 +527,7 @@ export namespace ControlGraft {
540
527
return _codec
541
528
}
542
529
543
- export const encode = ( obj : ControlGraft ) : Uint8Array => {
530
+ export const encode = ( obj : Partial < ControlGraft > ) : Uint8Array => {
544
531
return encodeMessage ( obj , ControlGraft . codec ( ) )
545
532
}
546
533
@@ -573,9 +560,7 @@ export namespace ControlPrune {
573
560
if ( obj . peers != null ) {
574
561
for ( const value of obj . peers ) {
575
562
w . uint32 ( 18 )
576
- PeerInfo . codec ( ) . encode ( value , w , {
577
- writeDefaults : true
578
- } )
563
+ PeerInfo . codec ( ) . encode ( value , w )
579
564
}
580
565
}
581
566
@@ -620,7 +605,7 @@ export namespace ControlPrune {
620
605
return _codec
621
606
}
622
607
623
- export const encode = ( obj : ControlPrune ) : Uint8Array => {
608
+ export const encode = ( obj : Partial < ControlPrune > ) : Uint8Array => {
624
609
return encodeMessage ( obj , ControlPrune . codec ( ) )
625
610
}
626
611
@@ -685,7 +670,7 @@ export namespace PeerInfo {
685
670
return _codec
686
671
}
687
672
688
- export const encode = ( obj : PeerInfo ) : Uint8Array => {
673
+ export const encode = ( obj : Partial < PeerInfo > ) : Uint8Array => {
689
674
return encodeMessage ( obj , PeerInfo . codec ( ) )
690
675
}
691
676
0 commit comments