@libp2p/pubsub 1.2.5 → 1.2.8
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/src/errors.d.ts +4 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +4 -0
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +24 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +139 -97
- package/dist/src/index.js.map +1 -1
- package/dist/src/message/rpc.d.ts +586 -175
- package/dist/src/message/rpc.js +1238 -67
- package/dist/src/message/sign.d.ts +1 -1
- package/dist/src/message/sign.d.ts.map +1 -1
- package/dist/src/message/sign.js +4 -8
- package/dist/src/message/sign.js.map +1 -1
- package/dist/src/utils.d.ts +2 -6
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +10 -17
- package/dist/src/utils.js.map +1 -1
- package/package.json +13 -17
- package/src/errors.ts +4 -0
- package/src/index.ts +169 -104
- package/src/message/rpc.d.ts +586 -175
- package/src/message/rpc.js +1238 -67
- package/src/message/rpc.proto +38 -4
- package/src/message/sign.ts +6 -9
- package/src/utils.ts +11 -20
package/src/message/rpc.js
CHANGED
@@ -14,7 +14,8 @@ export const RPC = $root.RPC = (() => {
|
|
14
14
|
* @exports IRPC
|
15
15
|
* @interface IRPC
|
16
16
|
* @property {Array.<RPC.ISubOpts>|null} [subscriptions] RPC subscriptions
|
17
|
-
* @property {Array.<RPC.IMessage>|null} [
|
17
|
+
* @property {Array.<RPC.IMessage>|null} [messages] RPC messages
|
18
|
+
* @property {IControlMessage|null} [control] RPC control
|
18
19
|
*/
|
19
20
|
|
20
21
|
/**
|
@@ -27,7 +28,7 @@ export const RPC = $root.RPC = (() => {
|
|
27
28
|
*/
|
28
29
|
function RPC(p) {
|
29
30
|
this.subscriptions = [];
|
30
|
-
this.
|
31
|
+
this.messages = [];
|
31
32
|
if (p)
|
32
33
|
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
33
34
|
if (p[ks[i]] != null)
|
@@ -43,12 +44,34 @@ export const RPC = $root.RPC = (() => {
|
|
43
44
|
RPC.prototype.subscriptions = $util.emptyArray;
|
44
45
|
|
45
46
|
/**
|
46
|
-
* RPC
|
47
|
-
* @member {Array.<RPC.IMessage>}
|
47
|
+
* RPC messages.
|
48
|
+
* @member {Array.<RPC.IMessage>} messages
|
48
49
|
* @memberof RPC
|
49
50
|
* @instance
|
50
51
|
*/
|
51
|
-
RPC.prototype.
|
52
|
+
RPC.prototype.messages = $util.emptyArray;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* RPC control.
|
56
|
+
* @member {IControlMessage|null|undefined} control
|
57
|
+
* @memberof RPC
|
58
|
+
* @instance
|
59
|
+
*/
|
60
|
+
RPC.prototype.control = null;
|
61
|
+
|
62
|
+
// OneOf field names bound to virtual getters and setters
|
63
|
+
let $oneOfFields;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* RPC _control.
|
67
|
+
* @member {"control"|undefined} _control
|
68
|
+
* @memberof RPC
|
69
|
+
* @instance
|
70
|
+
*/
|
71
|
+
Object.defineProperty(RPC.prototype, "_control", {
|
72
|
+
get: $util.oneOfGetter($oneOfFields = ["control"]),
|
73
|
+
set: $util.oneOfSetter($oneOfFields)
|
74
|
+
});
|
52
75
|
|
53
76
|
/**
|
54
77
|
* Encodes the specified RPC message. Does not implicitly {@link RPC.verify|verify} messages.
|
@@ -66,10 +89,12 @@ export const RPC = $root.RPC = (() => {
|
|
66
89
|
for (var i = 0; i < m.subscriptions.length; ++i)
|
67
90
|
$root.RPC.SubOpts.encode(m.subscriptions[i], w.uint32(10).fork()).ldelim();
|
68
91
|
}
|
69
|
-
if (m.
|
70
|
-
for (var i = 0; i < m.
|
71
|
-
$root.RPC.Message.encode(m.
|
92
|
+
if (m.messages != null && m.messages.length) {
|
93
|
+
for (var i = 0; i < m.messages.length; ++i)
|
94
|
+
$root.RPC.Message.encode(m.messages[i], w.uint32(18).fork()).ldelim();
|
72
95
|
}
|
96
|
+
if (m.control != null && Object.hasOwnProperty.call(m, "control"))
|
97
|
+
$root.ControlMessage.encode(m.control, w.uint32(26).fork()).ldelim();
|
73
98
|
return w;
|
74
99
|
};
|
75
100
|
|
@@ -97,9 +122,12 @@ export const RPC = $root.RPC = (() => {
|
|
97
122
|
m.subscriptions.push($root.RPC.SubOpts.decode(r, r.uint32()));
|
98
123
|
break;
|
99
124
|
case 2:
|
100
|
-
if (!(m.
|
101
|
-
m.
|
102
|
-
m.
|
125
|
+
if (!(m.messages && m.messages.length))
|
126
|
+
m.messages = [];
|
127
|
+
m.messages.push($root.RPC.Message.decode(r, r.uint32()));
|
128
|
+
break;
|
129
|
+
case 3:
|
130
|
+
m.control = $root.ControlMessage.decode(r, r.uint32());
|
103
131
|
break;
|
104
132
|
default:
|
105
133
|
r.skipType(t & 7);
|
@@ -131,16 +159,21 @@ export const RPC = $root.RPC = (() => {
|
|
131
159
|
m.subscriptions[i] = $root.RPC.SubOpts.fromObject(d.subscriptions[i]);
|
132
160
|
}
|
133
161
|
}
|
134
|
-
if (d.
|
135
|
-
if (!Array.isArray(d.
|
136
|
-
throw TypeError(".RPC.
|
137
|
-
m.
|
138
|
-
for (var i = 0; i < d.
|
139
|
-
if (typeof d.
|
140
|
-
throw TypeError(".RPC.
|
141
|
-
m.
|
162
|
+
if (d.messages) {
|
163
|
+
if (!Array.isArray(d.messages))
|
164
|
+
throw TypeError(".RPC.messages: array expected");
|
165
|
+
m.messages = [];
|
166
|
+
for (var i = 0; i < d.messages.length; ++i) {
|
167
|
+
if (typeof d.messages[i] !== "object")
|
168
|
+
throw TypeError(".RPC.messages: object expected");
|
169
|
+
m.messages[i] = $root.RPC.Message.fromObject(d.messages[i]);
|
142
170
|
}
|
143
171
|
}
|
172
|
+
if (d.control != null) {
|
173
|
+
if (typeof d.control !== "object")
|
174
|
+
throw TypeError(".RPC.control: object expected");
|
175
|
+
m.control = $root.ControlMessage.fromObject(d.control);
|
176
|
+
}
|
144
177
|
return m;
|
145
178
|
};
|
146
179
|
|
@@ -159,7 +192,7 @@ export const RPC = $root.RPC = (() => {
|
|
159
192
|
var d = {};
|
160
193
|
if (o.arrays || o.defaults) {
|
161
194
|
d.subscriptions = [];
|
162
|
-
d.
|
195
|
+
d.messages = [];
|
163
196
|
}
|
164
197
|
if (m.subscriptions && m.subscriptions.length) {
|
165
198
|
d.subscriptions = [];
|
@@ -167,12 +200,17 @@ export const RPC = $root.RPC = (() => {
|
|
167
200
|
d.subscriptions[j] = $root.RPC.SubOpts.toObject(m.subscriptions[j], o);
|
168
201
|
}
|
169
202
|
}
|
170
|
-
if (m.
|
171
|
-
d.
|
172
|
-
for (var j = 0; j < m.
|
173
|
-
d.
|
203
|
+
if (m.messages && m.messages.length) {
|
204
|
+
d.messages = [];
|
205
|
+
for (var j = 0; j < m.messages.length; ++j) {
|
206
|
+
d.messages[j] = $root.RPC.Message.toObject(m.messages[j], o);
|
174
207
|
}
|
175
208
|
}
|
209
|
+
if (m.control != null && m.hasOwnProperty("control")) {
|
210
|
+
d.control = $root.ControlMessage.toObject(m.control, o);
|
211
|
+
if (o.oneofs)
|
212
|
+
d._control = "control";
|
213
|
+
}
|
176
214
|
return d;
|
177
215
|
};
|
178
216
|
|
@@ -194,7 +232,7 @@ export const RPC = $root.RPC = (() => {
|
|
194
232
|
* @memberof RPC
|
195
233
|
* @interface ISubOpts
|
196
234
|
* @property {boolean|null} [subscribe] SubOpts subscribe
|
197
|
-
* @property {string|null} [
|
235
|
+
* @property {string|null} [topic] SubOpts topic
|
198
236
|
*/
|
199
237
|
|
200
238
|
/**
|
@@ -221,12 +259,12 @@ export const RPC = $root.RPC = (() => {
|
|
221
259
|
SubOpts.prototype.subscribe = null;
|
222
260
|
|
223
261
|
/**
|
224
|
-
* SubOpts
|
225
|
-
* @member {string|null|undefined}
|
262
|
+
* SubOpts topic.
|
263
|
+
* @member {string|null|undefined} topic
|
226
264
|
* @memberof RPC.SubOpts
|
227
265
|
* @instance
|
228
266
|
*/
|
229
|
-
SubOpts.prototype.
|
267
|
+
SubOpts.prototype.topic = null;
|
230
268
|
|
231
269
|
// OneOf field names bound to virtual getters and setters
|
232
270
|
let $oneOfFields;
|
@@ -243,13 +281,13 @@ export const RPC = $root.RPC = (() => {
|
|
243
281
|
});
|
244
282
|
|
245
283
|
/**
|
246
|
-
* SubOpts
|
247
|
-
* @member {"
|
284
|
+
* SubOpts _topic.
|
285
|
+
* @member {"topic"|undefined} _topic
|
248
286
|
* @memberof RPC.SubOpts
|
249
287
|
* @instance
|
250
288
|
*/
|
251
|
-
Object.defineProperty(SubOpts.prototype, "
|
252
|
-
get: $util.oneOfGetter($oneOfFields = ["
|
289
|
+
Object.defineProperty(SubOpts.prototype, "_topic", {
|
290
|
+
get: $util.oneOfGetter($oneOfFields = ["topic"]),
|
253
291
|
set: $util.oneOfSetter($oneOfFields)
|
254
292
|
});
|
255
293
|
|
@@ -267,8 +305,8 @@ export const RPC = $root.RPC = (() => {
|
|
267
305
|
w = $Writer.create();
|
268
306
|
if (m.subscribe != null && Object.hasOwnProperty.call(m, "subscribe"))
|
269
307
|
w.uint32(8).bool(m.subscribe);
|
270
|
-
if (m.
|
271
|
-
w.uint32(18).string(m.
|
308
|
+
if (m.topic != null && Object.hasOwnProperty.call(m, "topic"))
|
309
|
+
w.uint32(18).string(m.topic);
|
272
310
|
return w;
|
273
311
|
};
|
274
312
|
|
@@ -294,7 +332,7 @@ export const RPC = $root.RPC = (() => {
|
|
294
332
|
m.subscribe = r.bool();
|
295
333
|
break;
|
296
334
|
case 2:
|
297
|
-
m.
|
335
|
+
m.topic = r.string();
|
298
336
|
break;
|
299
337
|
default:
|
300
338
|
r.skipType(t & 7);
|
@@ -319,8 +357,8 @@ export const RPC = $root.RPC = (() => {
|
|
319
357
|
if (d.subscribe != null) {
|
320
358
|
m.subscribe = Boolean(d.subscribe);
|
321
359
|
}
|
322
|
-
if (d.
|
323
|
-
m.
|
360
|
+
if (d.topic != null) {
|
361
|
+
m.topic = String(d.topic);
|
324
362
|
}
|
325
363
|
return m;
|
326
364
|
};
|
@@ -343,10 +381,10 @@ export const RPC = $root.RPC = (() => {
|
|
343
381
|
if (o.oneofs)
|
344
382
|
d._subscribe = "subscribe";
|
345
383
|
}
|
346
|
-
if (m.
|
347
|
-
d.
|
384
|
+
if (m.topic != null && m.hasOwnProperty("topic")) {
|
385
|
+
d.topic = m.topic;
|
348
386
|
if (o.oneofs)
|
349
|
-
d.
|
387
|
+
d._topic = "topic";
|
350
388
|
}
|
351
389
|
return d;
|
352
390
|
};
|
@@ -374,7 +412,7 @@ export const RPC = $root.RPC = (() => {
|
|
374
412
|
* @property {Uint8Array|null} [from] Message from
|
375
413
|
* @property {Uint8Array|null} [data] Message data
|
376
414
|
* @property {Uint8Array|null} [seqno] Message seqno
|
377
|
-
* @property {
|
415
|
+
* @property {string|null} [topic] Message topic
|
378
416
|
* @property {Uint8Array|null} [signature] Message signature
|
379
417
|
* @property {Uint8Array|null} [key] Message key
|
380
418
|
*/
|
@@ -388,7 +426,6 @@ export const RPC = $root.RPC = (() => {
|
|
388
426
|
* @param {RPC.IMessage=} [p] Properties to set
|
389
427
|
*/
|
390
428
|
function Message(p) {
|
391
|
-
this.topicIDs = [];
|
392
429
|
if (p)
|
393
430
|
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
394
431
|
if (p[ks[i]] != null)
|
@@ -420,12 +457,12 @@ export const RPC = $root.RPC = (() => {
|
|
420
457
|
Message.prototype.seqno = null;
|
421
458
|
|
422
459
|
/**
|
423
|
-
* Message
|
424
|
-
* @member {
|
460
|
+
* Message topic.
|
461
|
+
* @member {string|null|undefined} topic
|
425
462
|
* @memberof RPC.Message
|
426
463
|
* @instance
|
427
464
|
*/
|
428
|
-
Message.prototype.
|
465
|
+
Message.prototype.topic = null;
|
429
466
|
|
430
467
|
/**
|
431
468
|
* Message signature.
|
@@ -479,6 +516,17 @@ export const RPC = $root.RPC = (() => {
|
|
479
516
|
set: $util.oneOfSetter($oneOfFields)
|
480
517
|
});
|
481
518
|
|
519
|
+
/**
|
520
|
+
* Message _topic.
|
521
|
+
* @member {"topic"|undefined} _topic
|
522
|
+
* @memberof RPC.Message
|
523
|
+
* @instance
|
524
|
+
*/
|
525
|
+
Object.defineProperty(Message.prototype, "_topic", {
|
526
|
+
get: $util.oneOfGetter($oneOfFields = ["topic"]),
|
527
|
+
set: $util.oneOfSetter($oneOfFields)
|
528
|
+
});
|
529
|
+
|
482
530
|
/**
|
483
531
|
* Message _signature.
|
484
532
|
* @member {"signature"|undefined} _signature
|
@@ -519,10 +567,8 @@ export const RPC = $root.RPC = (() => {
|
|
519
567
|
w.uint32(18).bytes(m.data);
|
520
568
|
if (m.seqno != null && Object.hasOwnProperty.call(m, "seqno"))
|
521
569
|
w.uint32(26).bytes(m.seqno);
|
522
|
-
if (m.
|
523
|
-
|
524
|
-
w.uint32(34).string(m.topicIDs[i]);
|
525
|
-
}
|
570
|
+
if (m.topic != null && Object.hasOwnProperty.call(m, "topic"))
|
571
|
+
w.uint32(34).string(m.topic);
|
526
572
|
if (m.signature != null && Object.hasOwnProperty.call(m, "signature"))
|
527
573
|
w.uint32(42).bytes(m.signature);
|
528
574
|
if (m.key != null && Object.hasOwnProperty.call(m, "key"))
|
@@ -558,9 +604,7 @@ export const RPC = $root.RPC = (() => {
|
|
558
604
|
m.seqno = r.bytes();
|
559
605
|
break;
|
560
606
|
case 4:
|
561
|
-
|
562
|
-
m.topicIDs = [];
|
563
|
-
m.topicIDs.push(r.string());
|
607
|
+
m.topic = r.string();
|
564
608
|
break;
|
565
609
|
case 5:
|
566
610
|
m.signature = r.bytes();
|
@@ -606,13 +650,8 @@ export const RPC = $root.RPC = (() => {
|
|
606
650
|
else if (d.seqno.length)
|
607
651
|
m.seqno = d.seqno;
|
608
652
|
}
|
609
|
-
if (d.
|
610
|
-
|
611
|
-
throw TypeError(".RPC.Message.topicIDs: array expected");
|
612
|
-
m.topicIDs = [];
|
613
|
-
for (var i = 0; i < d.topicIDs.length; ++i) {
|
614
|
-
m.topicIDs[i] = String(d.topicIDs[i]);
|
615
|
-
}
|
653
|
+
if (d.topic != null) {
|
654
|
+
m.topic = String(d.topic);
|
616
655
|
}
|
617
656
|
if (d.signature != null) {
|
618
657
|
if (typeof d.signature === "string")
|
@@ -642,9 +681,6 @@ export const RPC = $root.RPC = (() => {
|
|
642
681
|
if (!o)
|
643
682
|
o = {};
|
644
683
|
var d = {};
|
645
|
-
if (o.arrays || o.defaults) {
|
646
|
-
d.topicIDs = [];
|
647
|
-
}
|
648
684
|
if (m.from != null && m.hasOwnProperty("from")) {
|
649
685
|
d.from = o.bytes === String ? $util.base64.encode(m.from, 0, m.from.length) : o.bytes === Array ? Array.prototype.slice.call(m.from) : m.from;
|
650
686
|
if (o.oneofs)
|
@@ -660,11 +696,10 @@ export const RPC = $root.RPC = (() => {
|
|
660
696
|
if (o.oneofs)
|
661
697
|
d._seqno = "seqno";
|
662
698
|
}
|
663
|
-
if (m.
|
664
|
-
d.
|
665
|
-
|
666
|
-
d.
|
667
|
-
}
|
699
|
+
if (m.topic != null && m.hasOwnProperty("topic")) {
|
700
|
+
d.topic = m.topic;
|
701
|
+
if (o.oneofs)
|
702
|
+
d._topic = "topic";
|
668
703
|
}
|
669
704
|
if (m.signature != null && m.hasOwnProperty("signature")) {
|
670
705
|
d.signature = o.bytes === String ? $util.base64.encode(m.signature, 0, m.signature.length) : o.bytes === Array ? Array.prototype.slice.call(m.signature) : m.signature;
|
@@ -696,4 +731,1140 @@ export const RPC = $root.RPC = (() => {
|
|
696
731
|
return RPC;
|
697
732
|
})();
|
698
733
|
|
734
|
+
export const ControlMessage = $root.ControlMessage = (() => {
|
735
|
+
|
736
|
+
/**
|
737
|
+
* Properties of a ControlMessage.
|
738
|
+
* @exports IControlMessage
|
739
|
+
* @interface IControlMessage
|
740
|
+
* @property {Array.<IControlIHave>|null} [ihave] ControlMessage ihave
|
741
|
+
* @property {Array.<IControlIWant>|null} [iwant] ControlMessage iwant
|
742
|
+
* @property {Array.<IControlGraft>|null} [graft] ControlMessage graft
|
743
|
+
* @property {Array.<IControlPrune>|null} [prune] ControlMessage prune
|
744
|
+
*/
|
745
|
+
|
746
|
+
/**
|
747
|
+
* Constructs a new ControlMessage.
|
748
|
+
* @exports ControlMessage
|
749
|
+
* @classdesc Represents a ControlMessage.
|
750
|
+
* @implements IControlMessage
|
751
|
+
* @constructor
|
752
|
+
* @param {IControlMessage=} [p] Properties to set
|
753
|
+
*/
|
754
|
+
function ControlMessage(p) {
|
755
|
+
this.ihave = [];
|
756
|
+
this.iwant = [];
|
757
|
+
this.graft = [];
|
758
|
+
this.prune = [];
|
759
|
+
if (p)
|
760
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
761
|
+
if (p[ks[i]] != null)
|
762
|
+
this[ks[i]] = p[ks[i]];
|
763
|
+
}
|
764
|
+
|
765
|
+
/**
|
766
|
+
* ControlMessage ihave.
|
767
|
+
* @member {Array.<IControlIHave>} ihave
|
768
|
+
* @memberof ControlMessage
|
769
|
+
* @instance
|
770
|
+
*/
|
771
|
+
ControlMessage.prototype.ihave = $util.emptyArray;
|
772
|
+
|
773
|
+
/**
|
774
|
+
* ControlMessage iwant.
|
775
|
+
* @member {Array.<IControlIWant>} iwant
|
776
|
+
* @memberof ControlMessage
|
777
|
+
* @instance
|
778
|
+
*/
|
779
|
+
ControlMessage.prototype.iwant = $util.emptyArray;
|
780
|
+
|
781
|
+
/**
|
782
|
+
* ControlMessage graft.
|
783
|
+
* @member {Array.<IControlGraft>} graft
|
784
|
+
* @memberof ControlMessage
|
785
|
+
* @instance
|
786
|
+
*/
|
787
|
+
ControlMessage.prototype.graft = $util.emptyArray;
|
788
|
+
|
789
|
+
/**
|
790
|
+
* ControlMessage prune.
|
791
|
+
* @member {Array.<IControlPrune>} prune
|
792
|
+
* @memberof ControlMessage
|
793
|
+
* @instance
|
794
|
+
*/
|
795
|
+
ControlMessage.prototype.prune = $util.emptyArray;
|
796
|
+
|
797
|
+
/**
|
798
|
+
* Encodes the specified ControlMessage message. Does not implicitly {@link ControlMessage.verify|verify} messages.
|
799
|
+
* @function encode
|
800
|
+
* @memberof ControlMessage
|
801
|
+
* @static
|
802
|
+
* @param {IControlMessage} m ControlMessage message or plain object to encode
|
803
|
+
* @param {$protobuf.Writer} [w] Writer to encode to
|
804
|
+
* @returns {$protobuf.Writer} Writer
|
805
|
+
*/
|
806
|
+
ControlMessage.encode = function encode(m, w) {
|
807
|
+
if (!w)
|
808
|
+
w = $Writer.create();
|
809
|
+
if (m.ihave != null && m.ihave.length) {
|
810
|
+
for (var i = 0; i < m.ihave.length; ++i)
|
811
|
+
$root.ControlIHave.encode(m.ihave[i], w.uint32(10).fork()).ldelim();
|
812
|
+
}
|
813
|
+
if (m.iwant != null && m.iwant.length) {
|
814
|
+
for (var i = 0; i < m.iwant.length; ++i)
|
815
|
+
$root.ControlIWant.encode(m.iwant[i], w.uint32(18).fork()).ldelim();
|
816
|
+
}
|
817
|
+
if (m.graft != null && m.graft.length) {
|
818
|
+
for (var i = 0; i < m.graft.length; ++i)
|
819
|
+
$root.ControlGraft.encode(m.graft[i], w.uint32(26).fork()).ldelim();
|
820
|
+
}
|
821
|
+
if (m.prune != null && m.prune.length) {
|
822
|
+
for (var i = 0; i < m.prune.length; ++i)
|
823
|
+
$root.ControlPrune.encode(m.prune[i], w.uint32(34).fork()).ldelim();
|
824
|
+
}
|
825
|
+
return w;
|
826
|
+
};
|
827
|
+
|
828
|
+
/**
|
829
|
+
* Decodes a ControlMessage message from the specified reader or buffer.
|
830
|
+
* @function decode
|
831
|
+
* @memberof ControlMessage
|
832
|
+
* @static
|
833
|
+
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
834
|
+
* @param {number} [l] Message length if known beforehand
|
835
|
+
* @returns {ControlMessage} ControlMessage
|
836
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
837
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
838
|
+
*/
|
839
|
+
ControlMessage.decode = function decode(r, l) {
|
840
|
+
if (!(r instanceof $Reader))
|
841
|
+
r = $Reader.create(r);
|
842
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.ControlMessage();
|
843
|
+
while (r.pos < c) {
|
844
|
+
var t = r.uint32();
|
845
|
+
switch (t >>> 3) {
|
846
|
+
case 1:
|
847
|
+
if (!(m.ihave && m.ihave.length))
|
848
|
+
m.ihave = [];
|
849
|
+
m.ihave.push($root.ControlIHave.decode(r, r.uint32()));
|
850
|
+
break;
|
851
|
+
case 2:
|
852
|
+
if (!(m.iwant && m.iwant.length))
|
853
|
+
m.iwant = [];
|
854
|
+
m.iwant.push($root.ControlIWant.decode(r, r.uint32()));
|
855
|
+
break;
|
856
|
+
case 3:
|
857
|
+
if (!(m.graft && m.graft.length))
|
858
|
+
m.graft = [];
|
859
|
+
m.graft.push($root.ControlGraft.decode(r, r.uint32()));
|
860
|
+
break;
|
861
|
+
case 4:
|
862
|
+
if (!(m.prune && m.prune.length))
|
863
|
+
m.prune = [];
|
864
|
+
m.prune.push($root.ControlPrune.decode(r, r.uint32()));
|
865
|
+
break;
|
866
|
+
default:
|
867
|
+
r.skipType(t & 7);
|
868
|
+
break;
|
869
|
+
}
|
870
|
+
}
|
871
|
+
return m;
|
872
|
+
};
|
873
|
+
|
874
|
+
/**
|
875
|
+
* Creates a ControlMessage message from a plain object. Also converts values to their respective internal types.
|
876
|
+
* @function fromObject
|
877
|
+
* @memberof ControlMessage
|
878
|
+
* @static
|
879
|
+
* @param {Object.<string,*>} d Plain object
|
880
|
+
* @returns {ControlMessage} ControlMessage
|
881
|
+
*/
|
882
|
+
ControlMessage.fromObject = function fromObject(d) {
|
883
|
+
if (d instanceof $root.ControlMessage)
|
884
|
+
return d;
|
885
|
+
var m = new $root.ControlMessage();
|
886
|
+
if (d.ihave) {
|
887
|
+
if (!Array.isArray(d.ihave))
|
888
|
+
throw TypeError(".ControlMessage.ihave: array expected");
|
889
|
+
m.ihave = [];
|
890
|
+
for (var i = 0; i < d.ihave.length; ++i) {
|
891
|
+
if (typeof d.ihave[i] !== "object")
|
892
|
+
throw TypeError(".ControlMessage.ihave: object expected");
|
893
|
+
m.ihave[i] = $root.ControlIHave.fromObject(d.ihave[i]);
|
894
|
+
}
|
895
|
+
}
|
896
|
+
if (d.iwant) {
|
897
|
+
if (!Array.isArray(d.iwant))
|
898
|
+
throw TypeError(".ControlMessage.iwant: array expected");
|
899
|
+
m.iwant = [];
|
900
|
+
for (var i = 0; i < d.iwant.length; ++i) {
|
901
|
+
if (typeof d.iwant[i] !== "object")
|
902
|
+
throw TypeError(".ControlMessage.iwant: object expected");
|
903
|
+
m.iwant[i] = $root.ControlIWant.fromObject(d.iwant[i]);
|
904
|
+
}
|
905
|
+
}
|
906
|
+
if (d.graft) {
|
907
|
+
if (!Array.isArray(d.graft))
|
908
|
+
throw TypeError(".ControlMessage.graft: array expected");
|
909
|
+
m.graft = [];
|
910
|
+
for (var i = 0; i < d.graft.length; ++i) {
|
911
|
+
if (typeof d.graft[i] !== "object")
|
912
|
+
throw TypeError(".ControlMessage.graft: object expected");
|
913
|
+
m.graft[i] = $root.ControlGraft.fromObject(d.graft[i]);
|
914
|
+
}
|
915
|
+
}
|
916
|
+
if (d.prune) {
|
917
|
+
if (!Array.isArray(d.prune))
|
918
|
+
throw TypeError(".ControlMessage.prune: array expected");
|
919
|
+
m.prune = [];
|
920
|
+
for (var i = 0; i < d.prune.length; ++i) {
|
921
|
+
if (typeof d.prune[i] !== "object")
|
922
|
+
throw TypeError(".ControlMessage.prune: object expected");
|
923
|
+
m.prune[i] = $root.ControlPrune.fromObject(d.prune[i]);
|
924
|
+
}
|
925
|
+
}
|
926
|
+
return m;
|
927
|
+
};
|
928
|
+
|
929
|
+
/**
|
930
|
+
* Creates a plain object from a ControlMessage message. Also converts values to other types if specified.
|
931
|
+
* @function toObject
|
932
|
+
* @memberof ControlMessage
|
933
|
+
* @static
|
934
|
+
* @param {ControlMessage} m ControlMessage
|
935
|
+
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
936
|
+
* @returns {Object.<string,*>} Plain object
|
937
|
+
*/
|
938
|
+
ControlMessage.toObject = function toObject(m, o) {
|
939
|
+
if (!o)
|
940
|
+
o = {};
|
941
|
+
var d = {};
|
942
|
+
if (o.arrays || o.defaults) {
|
943
|
+
d.ihave = [];
|
944
|
+
d.iwant = [];
|
945
|
+
d.graft = [];
|
946
|
+
d.prune = [];
|
947
|
+
}
|
948
|
+
if (m.ihave && m.ihave.length) {
|
949
|
+
d.ihave = [];
|
950
|
+
for (var j = 0; j < m.ihave.length; ++j) {
|
951
|
+
d.ihave[j] = $root.ControlIHave.toObject(m.ihave[j], o);
|
952
|
+
}
|
953
|
+
}
|
954
|
+
if (m.iwant && m.iwant.length) {
|
955
|
+
d.iwant = [];
|
956
|
+
for (var j = 0; j < m.iwant.length; ++j) {
|
957
|
+
d.iwant[j] = $root.ControlIWant.toObject(m.iwant[j], o);
|
958
|
+
}
|
959
|
+
}
|
960
|
+
if (m.graft && m.graft.length) {
|
961
|
+
d.graft = [];
|
962
|
+
for (var j = 0; j < m.graft.length; ++j) {
|
963
|
+
d.graft[j] = $root.ControlGraft.toObject(m.graft[j], o);
|
964
|
+
}
|
965
|
+
}
|
966
|
+
if (m.prune && m.prune.length) {
|
967
|
+
d.prune = [];
|
968
|
+
for (var j = 0; j < m.prune.length; ++j) {
|
969
|
+
d.prune[j] = $root.ControlPrune.toObject(m.prune[j], o);
|
970
|
+
}
|
971
|
+
}
|
972
|
+
return d;
|
973
|
+
};
|
974
|
+
|
975
|
+
/**
|
976
|
+
* Converts this ControlMessage to JSON.
|
977
|
+
* @function toJSON
|
978
|
+
* @memberof ControlMessage
|
979
|
+
* @instance
|
980
|
+
* @returns {Object.<string,*>} JSON object
|
981
|
+
*/
|
982
|
+
ControlMessage.prototype.toJSON = function toJSON() {
|
983
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
984
|
+
};
|
985
|
+
|
986
|
+
return ControlMessage;
|
987
|
+
})();
|
988
|
+
|
989
|
+
export const ControlIHave = $root.ControlIHave = (() => {
|
990
|
+
|
991
|
+
/**
|
992
|
+
* Properties of a ControlIHave.
|
993
|
+
* @exports IControlIHave
|
994
|
+
* @interface IControlIHave
|
995
|
+
* @property {string|null} [topicID] ControlIHave topicID
|
996
|
+
* @property {Array.<string>|null} [messageIDs] ControlIHave messageIDs
|
997
|
+
*/
|
998
|
+
|
999
|
+
/**
|
1000
|
+
* Constructs a new ControlIHave.
|
1001
|
+
* @exports ControlIHave
|
1002
|
+
* @classdesc Represents a ControlIHave.
|
1003
|
+
* @implements IControlIHave
|
1004
|
+
* @constructor
|
1005
|
+
* @param {IControlIHave=} [p] Properties to set
|
1006
|
+
*/
|
1007
|
+
function ControlIHave(p) {
|
1008
|
+
this.messageIDs = [];
|
1009
|
+
if (p)
|
1010
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
1011
|
+
if (p[ks[i]] != null)
|
1012
|
+
this[ks[i]] = p[ks[i]];
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
/**
|
1016
|
+
* ControlIHave topicID.
|
1017
|
+
* @member {string|null|undefined} topicID
|
1018
|
+
* @memberof ControlIHave
|
1019
|
+
* @instance
|
1020
|
+
*/
|
1021
|
+
ControlIHave.prototype.topicID = null;
|
1022
|
+
|
1023
|
+
/**
|
1024
|
+
* ControlIHave messageIDs.
|
1025
|
+
* @member {Array.<string>} messageIDs
|
1026
|
+
* @memberof ControlIHave
|
1027
|
+
* @instance
|
1028
|
+
*/
|
1029
|
+
ControlIHave.prototype.messageIDs = $util.emptyArray;
|
1030
|
+
|
1031
|
+
// OneOf field names bound to virtual getters and setters
|
1032
|
+
let $oneOfFields;
|
1033
|
+
|
1034
|
+
/**
|
1035
|
+
* ControlIHave _topicID.
|
1036
|
+
* @member {"topicID"|undefined} _topicID
|
1037
|
+
* @memberof ControlIHave
|
1038
|
+
* @instance
|
1039
|
+
*/
|
1040
|
+
Object.defineProperty(ControlIHave.prototype, "_topicID", {
|
1041
|
+
get: $util.oneOfGetter($oneOfFields = ["topicID"]),
|
1042
|
+
set: $util.oneOfSetter($oneOfFields)
|
1043
|
+
});
|
1044
|
+
|
1045
|
+
/**
|
1046
|
+
* Encodes the specified ControlIHave message. Does not implicitly {@link ControlIHave.verify|verify} messages.
|
1047
|
+
* @function encode
|
1048
|
+
* @memberof ControlIHave
|
1049
|
+
* @static
|
1050
|
+
* @param {IControlIHave} m ControlIHave message or plain object to encode
|
1051
|
+
* @param {$protobuf.Writer} [w] Writer to encode to
|
1052
|
+
* @returns {$protobuf.Writer} Writer
|
1053
|
+
*/
|
1054
|
+
ControlIHave.encode = function encode(m, w) {
|
1055
|
+
if (!w)
|
1056
|
+
w = $Writer.create();
|
1057
|
+
if (m.topicID != null && Object.hasOwnProperty.call(m, "topicID"))
|
1058
|
+
w.uint32(10).string(m.topicID);
|
1059
|
+
if (m.messageIDs != null && m.messageIDs.length) {
|
1060
|
+
for (var i = 0; i < m.messageIDs.length; ++i)
|
1061
|
+
w.uint32(18).string(m.messageIDs[i]);
|
1062
|
+
}
|
1063
|
+
return w;
|
1064
|
+
};
|
1065
|
+
|
1066
|
+
/**
|
1067
|
+
* Decodes a ControlIHave message from the specified reader or buffer.
|
1068
|
+
* @function decode
|
1069
|
+
* @memberof ControlIHave
|
1070
|
+
* @static
|
1071
|
+
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
1072
|
+
* @param {number} [l] Message length if known beforehand
|
1073
|
+
* @returns {ControlIHave} ControlIHave
|
1074
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
1075
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
1076
|
+
*/
|
1077
|
+
ControlIHave.decode = function decode(r, l) {
|
1078
|
+
if (!(r instanceof $Reader))
|
1079
|
+
r = $Reader.create(r);
|
1080
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.ControlIHave();
|
1081
|
+
while (r.pos < c) {
|
1082
|
+
var t = r.uint32();
|
1083
|
+
switch (t >>> 3) {
|
1084
|
+
case 1:
|
1085
|
+
m.topicID = r.string();
|
1086
|
+
break;
|
1087
|
+
case 2:
|
1088
|
+
if (!(m.messageIDs && m.messageIDs.length))
|
1089
|
+
m.messageIDs = [];
|
1090
|
+
m.messageIDs.push(r.string());
|
1091
|
+
break;
|
1092
|
+
default:
|
1093
|
+
r.skipType(t & 7);
|
1094
|
+
break;
|
1095
|
+
}
|
1096
|
+
}
|
1097
|
+
return m;
|
1098
|
+
};
|
1099
|
+
|
1100
|
+
/**
|
1101
|
+
* Creates a ControlIHave message from a plain object. Also converts values to their respective internal types.
|
1102
|
+
* @function fromObject
|
1103
|
+
* @memberof ControlIHave
|
1104
|
+
* @static
|
1105
|
+
* @param {Object.<string,*>} d Plain object
|
1106
|
+
* @returns {ControlIHave} ControlIHave
|
1107
|
+
*/
|
1108
|
+
ControlIHave.fromObject = function fromObject(d) {
|
1109
|
+
if (d instanceof $root.ControlIHave)
|
1110
|
+
return d;
|
1111
|
+
var m = new $root.ControlIHave();
|
1112
|
+
if (d.topicID != null) {
|
1113
|
+
m.topicID = String(d.topicID);
|
1114
|
+
}
|
1115
|
+
if (d.messageIDs) {
|
1116
|
+
if (!Array.isArray(d.messageIDs))
|
1117
|
+
throw TypeError(".ControlIHave.messageIDs: array expected");
|
1118
|
+
m.messageIDs = [];
|
1119
|
+
for (var i = 0; i < d.messageIDs.length; ++i) {
|
1120
|
+
m.messageIDs[i] = String(d.messageIDs[i]);
|
1121
|
+
}
|
1122
|
+
}
|
1123
|
+
return m;
|
1124
|
+
};
|
1125
|
+
|
1126
|
+
/**
|
1127
|
+
* Creates a plain object from a ControlIHave message. Also converts values to other types if specified.
|
1128
|
+
* @function toObject
|
1129
|
+
* @memberof ControlIHave
|
1130
|
+
* @static
|
1131
|
+
* @param {ControlIHave} m ControlIHave
|
1132
|
+
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
1133
|
+
* @returns {Object.<string,*>} Plain object
|
1134
|
+
*/
|
1135
|
+
ControlIHave.toObject = function toObject(m, o) {
|
1136
|
+
if (!o)
|
1137
|
+
o = {};
|
1138
|
+
var d = {};
|
1139
|
+
if (o.arrays || o.defaults) {
|
1140
|
+
d.messageIDs = [];
|
1141
|
+
}
|
1142
|
+
if (m.topicID != null && m.hasOwnProperty("topicID")) {
|
1143
|
+
d.topicID = m.topicID;
|
1144
|
+
if (o.oneofs)
|
1145
|
+
d._topicID = "topicID";
|
1146
|
+
}
|
1147
|
+
if (m.messageIDs && m.messageIDs.length) {
|
1148
|
+
d.messageIDs = [];
|
1149
|
+
for (var j = 0; j < m.messageIDs.length; ++j) {
|
1150
|
+
d.messageIDs[j] = m.messageIDs[j];
|
1151
|
+
}
|
1152
|
+
}
|
1153
|
+
return d;
|
1154
|
+
};
|
1155
|
+
|
1156
|
+
/**
|
1157
|
+
* Converts this ControlIHave to JSON.
|
1158
|
+
* @function toJSON
|
1159
|
+
* @memberof ControlIHave
|
1160
|
+
* @instance
|
1161
|
+
* @returns {Object.<string,*>} JSON object
|
1162
|
+
*/
|
1163
|
+
ControlIHave.prototype.toJSON = function toJSON() {
|
1164
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
1165
|
+
};
|
1166
|
+
|
1167
|
+
return ControlIHave;
|
1168
|
+
})();
|
1169
|
+
|
1170
|
+
export const ControlIWant = $root.ControlIWant = (() => {
|
1171
|
+
|
1172
|
+
/**
|
1173
|
+
* Properties of a ControlIWant.
|
1174
|
+
* @exports IControlIWant
|
1175
|
+
* @interface IControlIWant
|
1176
|
+
* @property {Array.<string>|null} [messageIDs] ControlIWant messageIDs
|
1177
|
+
*/
|
1178
|
+
|
1179
|
+
/**
|
1180
|
+
* Constructs a new ControlIWant.
|
1181
|
+
* @exports ControlIWant
|
1182
|
+
* @classdesc Represents a ControlIWant.
|
1183
|
+
* @implements IControlIWant
|
1184
|
+
* @constructor
|
1185
|
+
* @param {IControlIWant=} [p] Properties to set
|
1186
|
+
*/
|
1187
|
+
function ControlIWant(p) {
|
1188
|
+
this.messageIDs = [];
|
1189
|
+
if (p)
|
1190
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
1191
|
+
if (p[ks[i]] != null)
|
1192
|
+
this[ks[i]] = p[ks[i]];
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
/**
|
1196
|
+
* ControlIWant messageIDs.
|
1197
|
+
* @member {Array.<string>} messageIDs
|
1198
|
+
* @memberof ControlIWant
|
1199
|
+
* @instance
|
1200
|
+
*/
|
1201
|
+
ControlIWant.prototype.messageIDs = $util.emptyArray;
|
1202
|
+
|
1203
|
+
/**
|
1204
|
+
* Encodes the specified ControlIWant message. Does not implicitly {@link ControlIWant.verify|verify} messages.
|
1205
|
+
* @function encode
|
1206
|
+
* @memberof ControlIWant
|
1207
|
+
* @static
|
1208
|
+
* @param {IControlIWant} m ControlIWant message or plain object to encode
|
1209
|
+
* @param {$protobuf.Writer} [w] Writer to encode to
|
1210
|
+
* @returns {$protobuf.Writer} Writer
|
1211
|
+
*/
|
1212
|
+
ControlIWant.encode = function encode(m, w) {
|
1213
|
+
if (!w)
|
1214
|
+
w = $Writer.create();
|
1215
|
+
if (m.messageIDs != null && m.messageIDs.length) {
|
1216
|
+
for (var i = 0; i < m.messageIDs.length; ++i)
|
1217
|
+
w.uint32(10).string(m.messageIDs[i]);
|
1218
|
+
}
|
1219
|
+
return w;
|
1220
|
+
};
|
1221
|
+
|
1222
|
+
/**
|
1223
|
+
* Decodes a ControlIWant message from the specified reader or buffer.
|
1224
|
+
* @function decode
|
1225
|
+
* @memberof ControlIWant
|
1226
|
+
* @static
|
1227
|
+
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
1228
|
+
* @param {number} [l] Message length if known beforehand
|
1229
|
+
* @returns {ControlIWant} ControlIWant
|
1230
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
1231
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
1232
|
+
*/
|
1233
|
+
ControlIWant.decode = function decode(r, l) {
|
1234
|
+
if (!(r instanceof $Reader))
|
1235
|
+
r = $Reader.create(r);
|
1236
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.ControlIWant();
|
1237
|
+
while (r.pos < c) {
|
1238
|
+
var t = r.uint32();
|
1239
|
+
switch (t >>> 3) {
|
1240
|
+
case 1:
|
1241
|
+
if (!(m.messageIDs && m.messageIDs.length))
|
1242
|
+
m.messageIDs = [];
|
1243
|
+
m.messageIDs.push(r.string());
|
1244
|
+
break;
|
1245
|
+
default:
|
1246
|
+
r.skipType(t & 7);
|
1247
|
+
break;
|
1248
|
+
}
|
1249
|
+
}
|
1250
|
+
return m;
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
/**
|
1254
|
+
* Creates a ControlIWant message from a plain object. Also converts values to their respective internal types.
|
1255
|
+
* @function fromObject
|
1256
|
+
* @memberof ControlIWant
|
1257
|
+
* @static
|
1258
|
+
* @param {Object.<string,*>} d Plain object
|
1259
|
+
* @returns {ControlIWant} ControlIWant
|
1260
|
+
*/
|
1261
|
+
ControlIWant.fromObject = function fromObject(d) {
|
1262
|
+
if (d instanceof $root.ControlIWant)
|
1263
|
+
return d;
|
1264
|
+
var m = new $root.ControlIWant();
|
1265
|
+
if (d.messageIDs) {
|
1266
|
+
if (!Array.isArray(d.messageIDs))
|
1267
|
+
throw TypeError(".ControlIWant.messageIDs: array expected");
|
1268
|
+
m.messageIDs = [];
|
1269
|
+
for (var i = 0; i < d.messageIDs.length; ++i) {
|
1270
|
+
m.messageIDs[i] = String(d.messageIDs[i]);
|
1271
|
+
}
|
1272
|
+
}
|
1273
|
+
return m;
|
1274
|
+
};
|
1275
|
+
|
1276
|
+
/**
|
1277
|
+
* Creates a plain object from a ControlIWant message. Also converts values to other types if specified.
|
1278
|
+
* @function toObject
|
1279
|
+
* @memberof ControlIWant
|
1280
|
+
* @static
|
1281
|
+
* @param {ControlIWant} m ControlIWant
|
1282
|
+
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
1283
|
+
* @returns {Object.<string,*>} Plain object
|
1284
|
+
*/
|
1285
|
+
ControlIWant.toObject = function toObject(m, o) {
|
1286
|
+
if (!o)
|
1287
|
+
o = {};
|
1288
|
+
var d = {};
|
1289
|
+
if (o.arrays || o.defaults) {
|
1290
|
+
d.messageIDs = [];
|
1291
|
+
}
|
1292
|
+
if (m.messageIDs && m.messageIDs.length) {
|
1293
|
+
d.messageIDs = [];
|
1294
|
+
for (var j = 0; j < m.messageIDs.length; ++j) {
|
1295
|
+
d.messageIDs[j] = m.messageIDs[j];
|
1296
|
+
}
|
1297
|
+
}
|
1298
|
+
return d;
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
/**
|
1302
|
+
* Converts this ControlIWant to JSON.
|
1303
|
+
* @function toJSON
|
1304
|
+
* @memberof ControlIWant
|
1305
|
+
* @instance
|
1306
|
+
* @returns {Object.<string,*>} JSON object
|
1307
|
+
*/
|
1308
|
+
ControlIWant.prototype.toJSON = function toJSON() {
|
1309
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
1310
|
+
};
|
1311
|
+
|
1312
|
+
return ControlIWant;
|
1313
|
+
})();
|
1314
|
+
|
1315
|
+
export const ControlGraft = $root.ControlGraft = (() => {
|
1316
|
+
|
1317
|
+
/**
|
1318
|
+
* Properties of a ControlGraft.
|
1319
|
+
* @exports IControlGraft
|
1320
|
+
* @interface IControlGraft
|
1321
|
+
* @property {string|null} [topicID] ControlGraft topicID
|
1322
|
+
*/
|
1323
|
+
|
1324
|
+
/**
|
1325
|
+
* Constructs a new ControlGraft.
|
1326
|
+
* @exports ControlGraft
|
1327
|
+
* @classdesc Represents a ControlGraft.
|
1328
|
+
* @implements IControlGraft
|
1329
|
+
* @constructor
|
1330
|
+
* @param {IControlGraft=} [p] Properties to set
|
1331
|
+
*/
|
1332
|
+
function ControlGraft(p) {
|
1333
|
+
if (p)
|
1334
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
1335
|
+
if (p[ks[i]] != null)
|
1336
|
+
this[ks[i]] = p[ks[i]];
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
/**
|
1340
|
+
* ControlGraft topicID.
|
1341
|
+
* @member {string|null|undefined} topicID
|
1342
|
+
* @memberof ControlGraft
|
1343
|
+
* @instance
|
1344
|
+
*/
|
1345
|
+
ControlGraft.prototype.topicID = null;
|
1346
|
+
|
1347
|
+
// OneOf field names bound to virtual getters and setters
|
1348
|
+
let $oneOfFields;
|
1349
|
+
|
1350
|
+
/**
|
1351
|
+
* ControlGraft _topicID.
|
1352
|
+
* @member {"topicID"|undefined} _topicID
|
1353
|
+
* @memberof ControlGraft
|
1354
|
+
* @instance
|
1355
|
+
*/
|
1356
|
+
Object.defineProperty(ControlGraft.prototype, "_topicID", {
|
1357
|
+
get: $util.oneOfGetter($oneOfFields = ["topicID"]),
|
1358
|
+
set: $util.oneOfSetter($oneOfFields)
|
1359
|
+
});
|
1360
|
+
|
1361
|
+
/**
|
1362
|
+
* Encodes the specified ControlGraft message. Does not implicitly {@link ControlGraft.verify|verify} messages.
|
1363
|
+
* @function encode
|
1364
|
+
* @memberof ControlGraft
|
1365
|
+
* @static
|
1366
|
+
* @param {IControlGraft} m ControlGraft message or plain object to encode
|
1367
|
+
* @param {$protobuf.Writer} [w] Writer to encode to
|
1368
|
+
* @returns {$protobuf.Writer} Writer
|
1369
|
+
*/
|
1370
|
+
ControlGraft.encode = function encode(m, w) {
|
1371
|
+
if (!w)
|
1372
|
+
w = $Writer.create();
|
1373
|
+
if (m.topicID != null && Object.hasOwnProperty.call(m, "topicID"))
|
1374
|
+
w.uint32(10).string(m.topicID);
|
1375
|
+
return w;
|
1376
|
+
};
|
1377
|
+
|
1378
|
+
/**
|
1379
|
+
* Decodes a ControlGraft message from the specified reader or buffer.
|
1380
|
+
* @function decode
|
1381
|
+
* @memberof ControlGraft
|
1382
|
+
* @static
|
1383
|
+
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
1384
|
+
* @param {number} [l] Message length if known beforehand
|
1385
|
+
* @returns {ControlGraft} ControlGraft
|
1386
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
1387
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
1388
|
+
*/
|
1389
|
+
ControlGraft.decode = function decode(r, l) {
|
1390
|
+
if (!(r instanceof $Reader))
|
1391
|
+
r = $Reader.create(r);
|
1392
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.ControlGraft();
|
1393
|
+
while (r.pos < c) {
|
1394
|
+
var t = r.uint32();
|
1395
|
+
switch (t >>> 3) {
|
1396
|
+
case 1:
|
1397
|
+
m.topicID = r.string();
|
1398
|
+
break;
|
1399
|
+
default:
|
1400
|
+
r.skipType(t & 7);
|
1401
|
+
break;
|
1402
|
+
}
|
1403
|
+
}
|
1404
|
+
return m;
|
1405
|
+
};
|
1406
|
+
|
1407
|
+
/**
|
1408
|
+
* Creates a ControlGraft message from a plain object. Also converts values to their respective internal types.
|
1409
|
+
* @function fromObject
|
1410
|
+
* @memberof ControlGraft
|
1411
|
+
* @static
|
1412
|
+
* @param {Object.<string,*>} d Plain object
|
1413
|
+
* @returns {ControlGraft} ControlGraft
|
1414
|
+
*/
|
1415
|
+
ControlGraft.fromObject = function fromObject(d) {
|
1416
|
+
if (d instanceof $root.ControlGraft)
|
1417
|
+
return d;
|
1418
|
+
var m = new $root.ControlGraft();
|
1419
|
+
if (d.topicID != null) {
|
1420
|
+
m.topicID = String(d.topicID);
|
1421
|
+
}
|
1422
|
+
return m;
|
1423
|
+
};
|
1424
|
+
|
1425
|
+
/**
|
1426
|
+
* Creates a plain object from a ControlGraft message. Also converts values to other types if specified.
|
1427
|
+
* @function toObject
|
1428
|
+
* @memberof ControlGraft
|
1429
|
+
* @static
|
1430
|
+
* @param {ControlGraft} m ControlGraft
|
1431
|
+
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
1432
|
+
* @returns {Object.<string,*>} Plain object
|
1433
|
+
*/
|
1434
|
+
ControlGraft.toObject = function toObject(m, o) {
|
1435
|
+
if (!o)
|
1436
|
+
o = {};
|
1437
|
+
var d = {};
|
1438
|
+
if (m.topicID != null && m.hasOwnProperty("topicID")) {
|
1439
|
+
d.topicID = m.topicID;
|
1440
|
+
if (o.oneofs)
|
1441
|
+
d._topicID = "topicID";
|
1442
|
+
}
|
1443
|
+
return d;
|
1444
|
+
};
|
1445
|
+
|
1446
|
+
/**
|
1447
|
+
* Converts this ControlGraft to JSON.
|
1448
|
+
* @function toJSON
|
1449
|
+
* @memberof ControlGraft
|
1450
|
+
* @instance
|
1451
|
+
* @returns {Object.<string,*>} JSON object
|
1452
|
+
*/
|
1453
|
+
ControlGraft.prototype.toJSON = function toJSON() {
|
1454
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
1455
|
+
};
|
1456
|
+
|
1457
|
+
return ControlGraft;
|
1458
|
+
})();
|
1459
|
+
|
1460
|
+
export const ControlPrune = $root.ControlPrune = (() => {
|
1461
|
+
|
1462
|
+
/**
|
1463
|
+
* Properties of a ControlPrune.
|
1464
|
+
* @exports IControlPrune
|
1465
|
+
* @interface IControlPrune
|
1466
|
+
* @property {string|null} [topicID] ControlPrune topicID
|
1467
|
+
* @property {Array.<IPeerInfo>|null} [peers] ControlPrune peers
|
1468
|
+
* @property {number|null} [backoff] ControlPrune backoff
|
1469
|
+
*/
|
1470
|
+
|
1471
|
+
/**
|
1472
|
+
* Constructs a new ControlPrune.
|
1473
|
+
* @exports ControlPrune
|
1474
|
+
* @classdesc Represents a ControlPrune.
|
1475
|
+
* @implements IControlPrune
|
1476
|
+
* @constructor
|
1477
|
+
* @param {IControlPrune=} [p] Properties to set
|
1478
|
+
*/
|
1479
|
+
function ControlPrune(p) {
|
1480
|
+
this.peers = [];
|
1481
|
+
if (p)
|
1482
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
1483
|
+
if (p[ks[i]] != null)
|
1484
|
+
this[ks[i]] = p[ks[i]];
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
/**
|
1488
|
+
* ControlPrune topicID.
|
1489
|
+
* @member {string|null|undefined} topicID
|
1490
|
+
* @memberof ControlPrune
|
1491
|
+
* @instance
|
1492
|
+
*/
|
1493
|
+
ControlPrune.prototype.topicID = null;
|
1494
|
+
|
1495
|
+
/**
|
1496
|
+
* ControlPrune peers.
|
1497
|
+
* @member {Array.<IPeerInfo>} peers
|
1498
|
+
* @memberof ControlPrune
|
1499
|
+
* @instance
|
1500
|
+
*/
|
1501
|
+
ControlPrune.prototype.peers = $util.emptyArray;
|
1502
|
+
|
1503
|
+
/**
|
1504
|
+
* ControlPrune backoff.
|
1505
|
+
* @member {number|null|undefined} backoff
|
1506
|
+
* @memberof ControlPrune
|
1507
|
+
* @instance
|
1508
|
+
*/
|
1509
|
+
ControlPrune.prototype.backoff = null;
|
1510
|
+
|
1511
|
+
// OneOf field names bound to virtual getters and setters
|
1512
|
+
let $oneOfFields;
|
1513
|
+
|
1514
|
+
/**
|
1515
|
+
* ControlPrune _topicID.
|
1516
|
+
* @member {"topicID"|undefined} _topicID
|
1517
|
+
* @memberof ControlPrune
|
1518
|
+
* @instance
|
1519
|
+
*/
|
1520
|
+
Object.defineProperty(ControlPrune.prototype, "_topicID", {
|
1521
|
+
get: $util.oneOfGetter($oneOfFields = ["topicID"]),
|
1522
|
+
set: $util.oneOfSetter($oneOfFields)
|
1523
|
+
});
|
1524
|
+
|
1525
|
+
/**
|
1526
|
+
* ControlPrune _backoff.
|
1527
|
+
* @member {"backoff"|undefined} _backoff
|
1528
|
+
* @memberof ControlPrune
|
1529
|
+
* @instance
|
1530
|
+
*/
|
1531
|
+
Object.defineProperty(ControlPrune.prototype, "_backoff", {
|
1532
|
+
get: $util.oneOfGetter($oneOfFields = ["backoff"]),
|
1533
|
+
set: $util.oneOfSetter($oneOfFields)
|
1534
|
+
});
|
1535
|
+
|
1536
|
+
/**
|
1537
|
+
* Encodes the specified ControlPrune message. Does not implicitly {@link ControlPrune.verify|verify} messages.
|
1538
|
+
* @function encode
|
1539
|
+
* @memberof ControlPrune
|
1540
|
+
* @static
|
1541
|
+
* @param {IControlPrune} m ControlPrune message or plain object to encode
|
1542
|
+
* @param {$protobuf.Writer} [w] Writer to encode to
|
1543
|
+
* @returns {$protobuf.Writer} Writer
|
1544
|
+
*/
|
1545
|
+
ControlPrune.encode = function encode(m, w) {
|
1546
|
+
if (!w)
|
1547
|
+
w = $Writer.create();
|
1548
|
+
if (m.topicID != null && Object.hasOwnProperty.call(m, "topicID"))
|
1549
|
+
w.uint32(10).string(m.topicID);
|
1550
|
+
if (m.peers != null && m.peers.length) {
|
1551
|
+
for (var i = 0; i < m.peers.length; ++i)
|
1552
|
+
$root.PeerInfo.encode(m.peers[i], w.uint32(18).fork()).ldelim();
|
1553
|
+
}
|
1554
|
+
if (m.backoff != null && Object.hasOwnProperty.call(m, "backoff"))
|
1555
|
+
w.uint32(24).uint64(m.backoff);
|
1556
|
+
return w;
|
1557
|
+
};
|
1558
|
+
|
1559
|
+
/**
|
1560
|
+
* Decodes a ControlPrune message from the specified reader or buffer.
|
1561
|
+
* @function decode
|
1562
|
+
* @memberof ControlPrune
|
1563
|
+
* @static
|
1564
|
+
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
1565
|
+
* @param {number} [l] Message length if known beforehand
|
1566
|
+
* @returns {ControlPrune} ControlPrune
|
1567
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
1568
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
1569
|
+
*/
|
1570
|
+
ControlPrune.decode = function decode(r, l) {
|
1571
|
+
if (!(r instanceof $Reader))
|
1572
|
+
r = $Reader.create(r);
|
1573
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.ControlPrune();
|
1574
|
+
while (r.pos < c) {
|
1575
|
+
var t = r.uint32();
|
1576
|
+
switch (t >>> 3) {
|
1577
|
+
case 1:
|
1578
|
+
m.topicID = r.string();
|
1579
|
+
break;
|
1580
|
+
case 2:
|
1581
|
+
if (!(m.peers && m.peers.length))
|
1582
|
+
m.peers = [];
|
1583
|
+
m.peers.push($root.PeerInfo.decode(r, r.uint32()));
|
1584
|
+
break;
|
1585
|
+
case 3:
|
1586
|
+
m.backoff = r.uint64();
|
1587
|
+
break;
|
1588
|
+
default:
|
1589
|
+
r.skipType(t & 7);
|
1590
|
+
break;
|
1591
|
+
}
|
1592
|
+
}
|
1593
|
+
return m;
|
1594
|
+
};
|
1595
|
+
|
1596
|
+
/**
|
1597
|
+
* Creates a ControlPrune message from a plain object. Also converts values to their respective internal types.
|
1598
|
+
* @function fromObject
|
1599
|
+
* @memberof ControlPrune
|
1600
|
+
* @static
|
1601
|
+
* @param {Object.<string,*>} d Plain object
|
1602
|
+
* @returns {ControlPrune} ControlPrune
|
1603
|
+
*/
|
1604
|
+
ControlPrune.fromObject = function fromObject(d) {
|
1605
|
+
if (d instanceof $root.ControlPrune)
|
1606
|
+
return d;
|
1607
|
+
var m = new $root.ControlPrune();
|
1608
|
+
if (d.topicID != null) {
|
1609
|
+
m.topicID = String(d.topicID);
|
1610
|
+
}
|
1611
|
+
if (d.peers) {
|
1612
|
+
if (!Array.isArray(d.peers))
|
1613
|
+
throw TypeError(".ControlPrune.peers: array expected");
|
1614
|
+
m.peers = [];
|
1615
|
+
for (var i = 0; i < d.peers.length; ++i) {
|
1616
|
+
if (typeof d.peers[i] !== "object")
|
1617
|
+
throw TypeError(".ControlPrune.peers: object expected");
|
1618
|
+
m.peers[i] = $root.PeerInfo.fromObject(d.peers[i]);
|
1619
|
+
}
|
1620
|
+
}
|
1621
|
+
if (d.backoff != null) {
|
1622
|
+
if ($util.Long)
|
1623
|
+
(m.backoff = $util.Long.fromValue(d.backoff)).unsigned = true;
|
1624
|
+
else if (typeof d.backoff === "string")
|
1625
|
+
m.backoff = parseInt(d.backoff, 10);
|
1626
|
+
else if (typeof d.backoff === "number")
|
1627
|
+
m.backoff = d.backoff;
|
1628
|
+
else if (typeof d.backoff === "object")
|
1629
|
+
m.backoff = new $util.LongBits(d.backoff.low >>> 0, d.backoff.high >>> 0).toNumber(true);
|
1630
|
+
}
|
1631
|
+
return m;
|
1632
|
+
};
|
1633
|
+
|
1634
|
+
/**
|
1635
|
+
* Creates a plain object from a ControlPrune message. Also converts values to other types if specified.
|
1636
|
+
* @function toObject
|
1637
|
+
* @memberof ControlPrune
|
1638
|
+
* @static
|
1639
|
+
* @param {ControlPrune} m ControlPrune
|
1640
|
+
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
1641
|
+
* @returns {Object.<string,*>} Plain object
|
1642
|
+
*/
|
1643
|
+
ControlPrune.toObject = function toObject(m, o) {
|
1644
|
+
if (!o)
|
1645
|
+
o = {};
|
1646
|
+
var d = {};
|
1647
|
+
if (o.arrays || o.defaults) {
|
1648
|
+
d.peers = [];
|
1649
|
+
}
|
1650
|
+
if (m.topicID != null && m.hasOwnProperty("topicID")) {
|
1651
|
+
d.topicID = m.topicID;
|
1652
|
+
if (o.oneofs)
|
1653
|
+
d._topicID = "topicID";
|
1654
|
+
}
|
1655
|
+
if (m.peers && m.peers.length) {
|
1656
|
+
d.peers = [];
|
1657
|
+
for (var j = 0; j < m.peers.length; ++j) {
|
1658
|
+
d.peers[j] = $root.PeerInfo.toObject(m.peers[j], o);
|
1659
|
+
}
|
1660
|
+
}
|
1661
|
+
if (m.backoff != null && m.hasOwnProperty("backoff")) {
|
1662
|
+
if (typeof m.backoff === "number")
|
1663
|
+
d.backoff = o.longs === String ? String(m.backoff) : m.backoff;
|
1664
|
+
else
|
1665
|
+
d.backoff = o.longs === String ? $util.Long.prototype.toString.call(m.backoff) : o.longs === Number ? new $util.LongBits(m.backoff.low >>> 0, m.backoff.high >>> 0).toNumber(true) : m.backoff;
|
1666
|
+
if (o.oneofs)
|
1667
|
+
d._backoff = "backoff";
|
1668
|
+
}
|
1669
|
+
return d;
|
1670
|
+
};
|
1671
|
+
|
1672
|
+
/**
|
1673
|
+
* Converts this ControlPrune to JSON.
|
1674
|
+
* @function toJSON
|
1675
|
+
* @memberof ControlPrune
|
1676
|
+
* @instance
|
1677
|
+
* @returns {Object.<string,*>} JSON object
|
1678
|
+
*/
|
1679
|
+
ControlPrune.prototype.toJSON = function toJSON() {
|
1680
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
1681
|
+
};
|
1682
|
+
|
1683
|
+
return ControlPrune;
|
1684
|
+
})();
|
1685
|
+
|
1686
|
+
export const PeerInfo = $root.PeerInfo = (() => {
|
1687
|
+
|
1688
|
+
/**
|
1689
|
+
* Properties of a PeerInfo.
|
1690
|
+
* @exports IPeerInfo
|
1691
|
+
* @interface IPeerInfo
|
1692
|
+
* @property {Uint8Array|null} [peerID] PeerInfo peerID
|
1693
|
+
* @property {Uint8Array|null} [signedPeerRecord] PeerInfo signedPeerRecord
|
1694
|
+
*/
|
1695
|
+
|
1696
|
+
/**
|
1697
|
+
* Constructs a new PeerInfo.
|
1698
|
+
* @exports PeerInfo
|
1699
|
+
* @classdesc Represents a PeerInfo.
|
1700
|
+
* @implements IPeerInfo
|
1701
|
+
* @constructor
|
1702
|
+
* @param {IPeerInfo=} [p] Properties to set
|
1703
|
+
*/
|
1704
|
+
function PeerInfo(p) {
|
1705
|
+
if (p)
|
1706
|
+
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
1707
|
+
if (p[ks[i]] != null)
|
1708
|
+
this[ks[i]] = p[ks[i]];
|
1709
|
+
}
|
1710
|
+
|
1711
|
+
/**
|
1712
|
+
* PeerInfo peerID.
|
1713
|
+
* @member {Uint8Array|null|undefined} peerID
|
1714
|
+
* @memberof PeerInfo
|
1715
|
+
* @instance
|
1716
|
+
*/
|
1717
|
+
PeerInfo.prototype.peerID = null;
|
1718
|
+
|
1719
|
+
/**
|
1720
|
+
* PeerInfo signedPeerRecord.
|
1721
|
+
* @member {Uint8Array|null|undefined} signedPeerRecord
|
1722
|
+
* @memberof PeerInfo
|
1723
|
+
* @instance
|
1724
|
+
*/
|
1725
|
+
PeerInfo.prototype.signedPeerRecord = null;
|
1726
|
+
|
1727
|
+
// OneOf field names bound to virtual getters and setters
|
1728
|
+
let $oneOfFields;
|
1729
|
+
|
1730
|
+
/**
|
1731
|
+
* PeerInfo _peerID.
|
1732
|
+
* @member {"peerID"|undefined} _peerID
|
1733
|
+
* @memberof PeerInfo
|
1734
|
+
* @instance
|
1735
|
+
*/
|
1736
|
+
Object.defineProperty(PeerInfo.prototype, "_peerID", {
|
1737
|
+
get: $util.oneOfGetter($oneOfFields = ["peerID"]),
|
1738
|
+
set: $util.oneOfSetter($oneOfFields)
|
1739
|
+
});
|
1740
|
+
|
1741
|
+
/**
|
1742
|
+
* PeerInfo _signedPeerRecord.
|
1743
|
+
* @member {"signedPeerRecord"|undefined} _signedPeerRecord
|
1744
|
+
* @memberof PeerInfo
|
1745
|
+
* @instance
|
1746
|
+
*/
|
1747
|
+
Object.defineProperty(PeerInfo.prototype, "_signedPeerRecord", {
|
1748
|
+
get: $util.oneOfGetter($oneOfFields = ["signedPeerRecord"]),
|
1749
|
+
set: $util.oneOfSetter($oneOfFields)
|
1750
|
+
});
|
1751
|
+
|
1752
|
+
/**
|
1753
|
+
* Encodes the specified PeerInfo message. Does not implicitly {@link PeerInfo.verify|verify} messages.
|
1754
|
+
* @function encode
|
1755
|
+
* @memberof PeerInfo
|
1756
|
+
* @static
|
1757
|
+
* @param {IPeerInfo} m PeerInfo message or plain object to encode
|
1758
|
+
* @param {$protobuf.Writer} [w] Writer to encode to
|
1759
|
+
* @returns {$protobuf.Writer} Writer
|
1760
|
+
*/
|
1761
|
+
PeerInfo.encode = function encode(m, w) {
|
1762
|
+
if (!w)
|
1763
|
+
w = $Writer.create();
|
1764
|
+
if (m.peerID != null && Object.hasOwnProperty.call(m, "peerID"))
|
1765
|
+
w.uint32(10).bytes(m.peerID);
|
1766
|
+
if (m.signedPeerRecord != null && Object.hasOwnProperty.call(m, "signedPeerRecord"))
|
1767
|
+
w.uint32(18).bytes(m.signedPeerRecord);
|
1768
|
+
return w;
|
1769
|
+
};
|
1770
|
+
|
1771
|
+
/**
|
1772
|
+
* Decodes a PeerInfo message from the specified reader or buffer.
|
1773
|
+
* @function decode
|
1774
|
+
* @memberof PeerInfo
|
1775
|
+
* @static
|
1776
|
+
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
1777
|
+
* @param {number} [l] Message length if known beforehand
|
1778
|
+
* @returns {PeerInfo} PeerInfo
|
1779
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
1780
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
1781
|
+
*/
|
1782
|
+
PeerInfo.decode = function decode(r, l) {
|
1783
|
+
if (!(r instanceof $Reader))
|
1784
|
+
r = $Reader.create(r);
|
1785
|
+
var c = l === undefined ? r.len : r.pos + l, m = new $root.PeerInfo();
|
1786
|
+
while (r.pos < c) {
|
1787
|
+
var t = r.uint32();
|
1788
|
+
switch (t >>> 3) {
|
1789
|
+
case 1:
|
1790
|
+
m.peerID = r.bytes();
|
1791
|
+
break;
|
1792
|
+
case 2:
|
1793
|
+
m.signedPeerRecord = r.bytes();
|
1794
|
+
break;
|
1795
|
+
default:
|
1796
|
+
r.skipType(t & 7);
|
1797
|
+
break;
|
1798
|
+
}
|
1799
|
+
}
|
1800
|
+
return m;
|
1801
|
+
};
|
1802
|
+
|
1803
|
+
/**
|
1804
|
+
* Creates a PeerInfo message from a plain object. Also converts values to their respective internal types.
|
1805
|
+
* @function fromObject
|
1806
|
+
* @memberof PeerInfo
|
1807
|
+
* @static
|
1808
|
+
* @param {Object.<string,*>} d Plain object
|
1809
|
+
* @returns {PeerInfo} PeerInfo
|
1810
|
+
*/
|
1811
|
+
PeerInfo.fromObject = function fromObject(d) {
|
1812
|
+
if (d instanceof $root.PeerInfo)
|
1813
|
+
return d;
|
1814
|
+
var m = new $root.PeerInfo();
|
1815
|
+
if (d.peerID != null) {
|
1816
|
+
if (typeof d.peerID === "string")
|
1817
|
+
$util.base64.decode(d.peerID, m.peerID = $util.newBuffer($util.base64.length(d.peerID)), 0);
|
1818
|
+
else if (d.peerID.length)
|
1819
|
+
m.peerID = d.peerID;
|
1820
|
+
}
|
1821
|
+
if (d.signedPeerRecord != null) {
|
1822
|
+
if (typeof d.signedPeerRecord === "string")
|
1823
|
+
$util.base64.decode(d.signedPeerRecord, m.signedPeerRecord = $util.newBuffer($util.base64.length(d.signedPeerRecord)), 0);
|
1824
|
+
else if (d.signedPeerRecord.length)
|
1825
|
+
m.signedPeerRecord = d.signedPeerRecord;
|
1826
|
+
}
|
1827
|
+
return m;
|
1828
|
+
};
|
1829
|
+
|
1830
|
+
/**
|
1831
|
+
* Creates a plain object from a PeerInfo message. Also converts values to other types if specified.
|
1832
|
+
* @function toObject
|
1833
|
+
* @memberof PeerInfo
|
1834
|
+
* @static
|
1835
|
+
* @param {PeerInfo} m PeerInfo
|
1836
|
+
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
1837
|
+
* @returns {Object.<string,*>} Plain object
|
1838
|
+
*/
|
1839
|
+
PeerInfo.toObject = function toObject(m, o) {
|
1840
|
+
if (!o)
|
1841
|
+
o = {};
|
1842
|
+
var d = {};
|
1843
|
+
if (m.peerID != null && m.hasOwnProperty("peerID")) {
|
1844
|
+
d.peerID = o.bytes === String ? $util.base64.encode(m.peerID, 0, m.peerID.length) : o.bytes === Array ? Array.prototype.slice.call(m.peerID) : m.peerID;
|
1845
|
+
if (o.oneofs)
|
1846
|
+
d._peerID = "peerID";
|
1847
|
+
}
|
1848
|
+
if (m.signedPeerRecord != null && m.hasOwnProperty("signedPeerRecord")) {
|
1849
|
+
d.signedPeerRecord = o.bytes === String ? $util.base64.encode(m.signedPeerRecord, 0, m.signedPeerRecord.length) : o.bytes === Array ? Array.prototype.slice.call(m.signedPeerRecord) : m.signedPeerRecord;
|
1850
|
+
if (o.oneofs)
|
1851
|
+
d._signedPeerRecord = "signedPeerRecord";
|
1852
|
+
}
|
1853
|
+
return d;
|
1854
|
+
};
|
1855
|
+
|
1856
|
+
/**
|
1857
|
+
* Converts this PeerInfo to JSON.
|
1858
|
+
* @function toJSON
|
1859
|
+
* @memberof PeerInfo
|
1860
|
+
* @instance
|
1861
|
+
* @returns {Object.<string,*>} JSON object
|
1862
|
+
*/
|
1863
|
+
PeerInfo.prototype.toJSON = function toJSON() {
|
1864
|
+
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
1865
|
+
};
|
1866
|
+
|
1867
|
+
return PeerInfo;
|
1868
|
+
})();
|
1869
|
+
|
699
1870
|
export { $root as default };
|