@libp2p/pubsub 1.2.7 → 1.2.10
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/README.md +2 -2
- package/dist/src/index.d.ts +34 -25
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +86 -93
- package/dist/src/index.js.map +1 -1
- package/dist/src/peer-streams.d.ts +2 -2
- package/dist/src/peer-streams.d.ts.map +1 -1
- package/dist/src/peer-streams.js +3 -3
- package/dist/src/peer-streams.js.map +1 -1
- package/dist/src/{message/sign.d.ts → sign.d.ts} +3 -3
- package/dist/src/sign.d.ts.map +1 -0
- package/dist/src/{message/sign.js → sign.js} +6 -7
- package/dist/src/sign.js.map +1 -0
- package/dist/src/utils.d.ts +3 -4
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +2 -2
- package/dist/src/utils.js.map +1 -1
- package/package.json +21 -28
- package/src/index.ts +120 -109
- package/src/peer-streams.ts +4 -4
- package/src/{message/sign.ts → sign.ts} +7 -8
- package/src/utils.ts +5 -6
- package/dist/src/message/rpc.d.ts +0 -669
- package/dist/src/message/rpc.js +0 -1870
- package/dist/src/message/sign.d.ts.map +0 -1
- package/dist/src/message/sign.js.map +0 -1
- package/dist/src/message/topic-descriptor.d.ts +0 -254
- package/dist/src/message/topic-descriptor.js +0 -647
- package/src/message/rpc.d.ts +0 -669
- package/src/message/rpc.js +0 -1870
- package/src/message/rpc.proto +0 -54
- package/src/message/topic-descriptor.d.ts +0 -254
- package/src/message/topic-descriptor.js +0 -647
- package/src/message/topic-descriptor.proto +0 -30
package/dist/src/message/rpc.js
DELETED
@@ -1,1870 +0,0 @@
|
|
1
|
-
/*eslint-disable*/
|
2
|
-
import $protobuf from "protobufjs/minimal.js";
|
3
|
-
|
4
|
-
// Common aliases
|
5
|
-
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
|
6
|
-
|
7
|
-
// Exported root namespace
|
8
|
-
const $root = $protobuf.roots["libp2p-pubsub-rpc"] || ($protobuf.roots["libp2p-pubsub-rpc"] = {});
|
9
|
-
|
10
|
-
export const RPC = $root.RPC = (() => {
|
11
|
-
|
12
|
-
/**
|
13
|
-
* Properties of a RPC.
|
14
|
-
* @exports IRPC
|
15
|
-
* @interface IRPC
|
16
|
-
* @property {Array.<RPC.ISubOpts>|null} [subscriptions] RPC subscriptions
|
17
|
-
* @property {Array.<RPC.IMessage>|null} [messages] RPC messages
|
18
|
-
* @property {IControlMessage|null} [control] RPC control
|
19
|
-
*/
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Constructs a new RPC.
|
23
|
-
* @exports RPC
|
24
|
-
* @classdesc Represents a RPC.
|
25
|
-
* @implements IRPC
|
26
|
-
* @constructor
|
27
|
-
* @param {IRPC=} [p] Properties to set
|
28
|
-
*/
|
29
|
-
function RPC(p) {
|
30
|
-
this.subscriptions = [];
|
31
|
-
this.messages = [];
|
32
|
-
if (p)
|
33
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
34
|
-
if (p[ks[i]] != null)
|
35
|
-
this[ks[i]] = p[ks[i]];
|
36
|
-
}
|
37
|
-
|
38
|
-
/**
|
39
|
-
* RPC subscriptions.
|
40
|
-
* @member {Array.<RPC.ISubOpts>} subscriptions
|
41
|
-
* @memberof RPC
|
42
|
-
* @instance
|
43
|
-
*/
|
44
|
-
RPC.prototype.subscriptions = $util.emptyArray;
|
45
|
-
|
46
|
-
/**
|
47
|
-
* RPC messages.
|
48
|
-
* @member {Array.<RPC.IMessage>} messages
|
49
|
-
* @memberof RPC
|
50
|
-
* @instance
|
51
|
-
*/
|
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
|
-
});
|
75
|
-
|
76
|
-
/**
|
77
|
-
* Encodes the specified RPC message. Does not implicitly {@link RPC.verify|verify} messages.
|
78
|
-
* @function encode
|
79
|
-
* @memberof RPC
|
80
|
-
* @static
|
81
|
-
* @param {IRPC} m RPC message or plain object to encode
|
82
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
83
|
-
* @returns {$protobuf.Writer} Writer
|
84
|
-
*/
|
85
|
-
RPC.encode = function encode(m, w) {
|
86
|
-
if (!w)
|
87
|
-
w = $Writer.create();
|
88
|
-
if (m.subscriptions != null && m.subscriptions.length) {
|
89
|
-
for (var i = 0; i < m.subscriptions.length; ++i)
|
90
|
-
$root.RPC.SubOpts.encode(m.subscriptions[i], w.uint32(10).fork()).ldelim();
|
91
|
-
}
|
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();
|
95
|
-
}
|
96
|
-
if (m.control != null && Object.hasOwnProperty.call(m, "control"))
|
97
|
-
$root.ControlMessage.encode(m.control, w.uint32(26).fork()).ldelim();
|
98
|
-
return w;
|
99
|
-
};
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Decodes a RPC message from the specified reader or buffer.
|
103
|
-
* @function decode
|
104
|
-
* @memberof RPC
|
105
|
-
* @static
|
106
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
107
|
-
* @param {number} [l] Message length if known beforehand
|
108
|
-
* @returns {RPC} RPC
|
109
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
110
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
111
|
-
*/
|
112
|
-
RPC.decode = function decode(r, l) {
|
113
|
-
if (!(r instanceof $Reader))
|
114
|
-
r = $Reader.create(r);
|
115
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC();
|
116
|
-
while (r.pos < c) {
|
117
|
-
var t = r.uint32();
|
118
|
-
switch (t >>> 3) {
|
119
|
-
case 1:
|
120
|
-
if (!(m.subscriptions && m.subscriptions.length))
|
121
|
-
m.subscriptions = [];
|
122
|
-
m.subscriptions.push($root.RPC.SubOpts.decode(r, r.uint32()));
|
123
|
-
break;
|
124
|
-
case 2:
|
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());
|
131
|
-
break;
|
132
|
-
default:
|
133
|
-
r.skipType(t & 7);
|
134
|
-
break;
|
135
|
-
}
|
136
|
-
}
|
137
|
-
return m;
|
138
|
-
};
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Creates a RPC message from a plain object. Also converts values to their respective internal types.
|
142
|
-
* @function fromObject
|
143
|
-
* @memberof RPC
|
144
|
-
* @static
|
145
|
-
* @param {Object.<string,*>} d Plain object
|
146
|
-
* @returns {RPC} RPC
|
147
|
-
*/
|
148
|
-
RPC.fromObject = function fromObject(d) {
|
149
|
-
if (d instanceof $root.RPC)
|
150
|
-
return d;
|
151
|
-
var m = new $root.RPC();
|
152
|
-
if (d.subscriptions) {
|
153
|
-
if (!Array.isArray(d.subscriptions))
|
154
|
-
throw TypeError(".RPC.subscriptions: array expected");
|
155
|
-
m.subscriptions = [];
|
156
|
-
for (var i = 0; i < d.subscriptions.length; ++i) {
|
157
|
-
if (typeof d.subscriptions[i] !== "object")
|
158
|
-
throw TypeError(".RPC.subscriptions: object expected");
|
159
|
-
m.subscriptions[i] = $root.RPC.SubOpts.fromObject(d.subscriptions[i]);
|
160
|
-
}
|
161
|
-
}
|
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]);
|
170
|
-
}
|
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
|
-
}
|
177
|
-
return m;
|
178
|
-
};
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Creates a plain object from a RPC message. Also converts values to other types if specified.
|
182
|
-
* @function toObject
|
183
|
-
* @memberof RPC
|
184
|
-
* @static
|
185
|
-
* @param {RPC} m RPC
|
186
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
187
|
-
* @returns {Object.<string,*>} Plain object
|
188
|
-
*/
|
189
|
-
RPC.toObject = function toObject(m, o) {
|
190
|
-
if (!o)
|
191
|
-
o = {};
|
192
|
-
var d = {};
|
193
|
-
if (o.arrays || o.defaults) {
|
194
|
-
d.subscriptions = [];
|
195
|
-
d.messages = [];
|
196
|
-
}
|
197
|
-
if (m.subscriptions && m.subscriptions.length) {
|
198
|
-
d.subscriptions = [];
|
199
|
-
for (var j = 0; j < m.subscriptions.length; ++j) {
|
200
|
-
d.subscriptions[j] = $root.RPC.SubOpts.toObject(m.subscriptions[j], o);
|
201
|
-
}
|
202
|
-
}
|
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);
|
207
|
-
}
|
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
|
-
}
|
214
|
-
return d;
|
215
|
-
};
|
216
|
-
|
217
|
-
/**
|
218
|
-
* Converts this RPC to JSON.
|
219
|
-
* @function toJSON
|
220
|
-
* @memberof RPC
|
221
|
-
* @instance
|
222
|
-
* @returns {Object.<string,*>} JSON object
|
223
|
-
*/
|
224
|
-
RPC.prototype.toJSON = function toJSON() {
|
225
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
226
|
-
};
|
227
|
-
|
228
|
-
RPC.SubOpts = (function() {
|
229
|
-
|
230
|
-
/**
|
231
|
-
* Properties of a SubOpts.
|
232
|
-
* @memberof RPC
|
233
|
-
* @interface ISubOpts
|
234
|
-
* @property {boolean|null} [subscribe] SubOpts subscribe
|
235
|
-
* @property {string|null} [topic] SubOpts topic
|
236
|
-
*/
|
237
|
-
|
238
|
-
/**
|
239
|
-
* Constructs a new SubOpts.
|
240
|
-
* @memberof RPC
|
241
|
-
* @classdesc Represents a SubOpts.
|
242
|
-
* @implements ISubOpts
|
243
|
-
* @constructor
|
244
|
-
* @param {RPC.ISubOpts=} [p] Properties to set
|
245
|
-
*/
|
246
|
-
function SubOpts(p) {
|
247
|
-
if (p)
|
248
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
249
|
-
if (p[ks[i]] != null)
|
250
|
-
this[ks[i]] = p[ks[i]];
|
251
|
-
}
|
252
|
-
|
253
|
-
/**
|
254
|
-
* SubOpts subscribe.
|
255
|
-
* @member {boolean|null|undefined} subscribe
|
256
|
-
* @memberof RPC.SubOpts
|
257
|
-
* @instance
|
258
|
-
*/
|
259
|
-
SubOpts.prototype.subscribe = null;
|
260
|
-
|
261
|
-
/**
|
262
|
-
* SubOpts topic.
|
263
|
-
* @member {string|null|undefined} topic
|
264
|
-
* @memberof RPC.SubOpts
|
265
|
-
* @instance
|
266
|
-
*/
|
267
|
-
SubOpts.prototype.topic = null;
|
268
|
-
|
269
|
-
// OneOf field names bound to virtual getters and setters
|
270
|
-
let $oneOfFields;
|
271
|
-
|
272
|
-
/**
|
273
|
-
* SubOpts _subscribe.
|
274
|
-
* @member {"subscribe"|undefined} _subscribe
|
275
|
-
* @memberof RPC.SubOpts
|
276
|
-
* @instance
|
277
|
-
*/
|
278
|
-
Object.defineProperty(SubOpts.prototype, "_subscribe", {
|
279
|
-
get: $util.oneOfGetter($oneOfFields = ["subscribe"]),
|
280
|
-
set: $util.oneOfSetter($oneOfFields)
|
281
|
-
});
|
282
|
-
|
283
|
-
/**
|
284
|
-
* SubOpts _topic.
|
285
|
-
* @member {"topic"|undefined} _topic
|
286
|
-
* @memberof RPC.SubOpts
|
287
|
-
* @instance
|
288
|
-
*/
|
289
|
-
Object.defineProperty(SubOpts.prototype, "_topic", {
|
290
|
-
get: $util.oneOfGetter($oneOfFields = ["topic"]),
|
291
|
-
set: $util.oneOfSetter($oneOfFields)
|
292
|
-
});
|
293
|
-
|
294
|
-
/**
|
295
|
-
* Encodes the specified SubOpts message. Does not implicitly {@link RPC.SubOpts.verify|verify} messages.
|
296
|
-
* @function encode
|
297
|
-
* @memberof RPC.SubOpts
|
298
|
-
* @static
|
299
|
-
* @param {RPC.ISubOpts} m SubOpts message or plain object to encode
|
300
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
301
|
-
* @returns {$protobuf.Writer} Writer
|
302
|
-
*/
|
303
|
-
SubOpts.encode = function encode(m, w) {
|
304
|
-
if (!w)
|
305
|
-
w = $Writer.create();
|
306
|
-
if (m.subscribe != null && Object.hasOwnProperty.call(m, "subscribe"))
|
307
|
-
w.uint32(8).bool(m.subscribe);
|
308
|
-
if (m.topic != null && Object.hasOwnProperty.call(m, "topic"))
|
309
|
-
w.uint32(18).string(m.topic);
|
310
|
-
return w;
|
311
|
-
};
|
312
|
-
|
313
|
-
/**
|
314
|
-
* Decodes a SubOpts message from the specified reader or buffer.
|
315
|
-
* @function decode
|
316
|
-
* @memberof RPC.SubOpts
|
317
|
-
* @static
|
318
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
319
|
-
* @param {number} [l] Message length if known beforehand
|
320
|
-
* @returns {RPC.SubOpts} SubOpts
|
321
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
322
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
323
|
-
*/
|
324
|
-
SubOpts.decode = function decode(r, l) {
|
325
|
-
if (!(r instanceof $Reader))
|
326
|
-
r = $Reader.create(r);
|
327
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.SubOpts();
|
328
|
-
while (r.pos < c) {
|
329
|
-
var t = r.uint32();
|
330
|
-
switch (t >>> 3) {
|
331
|
-
case 1:
|
332
|
-
m.subscribe = r.bool();
|
333
|
-
break;
|
334
|
-
case 2:
|
335
|
-
m.topic = r.string();
|
336
|
-
break;
|
337
|
-
default:
|
338
|
-
r.skipType(t & 7);
|
339
|
-
break;
|
340
|
-
}
|
341
|
-
}
|
342
|
-
return m;
|
343
|
-
};
|
344
|
-
|
345
|
-
/**
|
346
|
-
* Creates a SubOpts message from a plain object. Also converts values to their respective internal types.
|
347
|
-
* @function fromObject
|
348
|
-
* @memberof RPC.SubOpts
|
349
|
-
* @static
|
350
|
-
* @param {Object.<string,*>} d Plain object
|
351
|
-
* @returns {RPC.SubOpts} SubOpts
|
352
|
-
*/
|
353
|
-
SubOpts.fromObject = function fromObject(d) {
|
354
|
-
if (d instanceof $root.RPC.SubOpts)
|
355
|
-
return d;
|
356
|
-
var m = new $root.RPC.SubOpts();
|
357
|
-
if (d.subscribe != null) {
|
358
|
-
m.subscribe = Boolean(d.subscribe);
|
359
|
-
}
|
360
|
-
if (d.topic != null) {
|
361
|
-
m.topic = String(d.topic);
|
362
|
-
}
|
363
|
-
return m;
|
364
|
-
};
|
365
|
-
|
366
|
-
/**
|
367
|
-
* Creates a plain object from a SubOpts message. Also converts values to other types if specified.
|
368
|
-
* @function toObject
|
369
|
-
* @memberof RPC.SubOpts
|
370
|
-
* @static
|
371
|
-
* @param {RPC.SubOpts} m SubOpts
|
372
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
373
|
-
* @returns {Object.<string,*>} Plain object
|
374
|
-
*/
|
375
|
-
SubOpts.toObject = function toObject(m, o) {
|
376
|
-
if (!o)
|
377
|
-
o = {};
|
378
|
-
var d = {};
|
379
|
-
if (m.subscribe != null && m.hasOwnProperty("subscribe")) {
|
380
|
-
d.subscribe = m.subscribe;
|
381
|
-
if (o.oneofs)
|
382
|
-
d._subscribe = "subscribe";
|
383
|
-
}
|
384
|
-
if (m.topic != null && m.hasOwnProperty("topic")) {
|
385
|
-
d.topic = m.topic;
|
386
|
-
if (o.oneofs)
|
387
|
-
d._topic = "topic";
|
388
|
-
}
|
389
|
-
return d;
|
390
|
-
};
|
391
|
-
|
392
|
-
/**
|
393
|
-
* Converts this SubOpts to JSON.
|
394
|
-
* @function toJSON
|
395
|
-
* @memberof RPC.SubOpts
|
396
|
-
* @instance
|
397
|
-
* @returns {Object.<string,*>} JSON object
|
398
|
-
*/
|
399
|
-
SubOpts.prototype.toJSON = function toJSON() {
|
400
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
401
|
-
};
|
402
|
-
|
403
|
-
return SubOpts;
|
404
|
-
})();
|
405
|
-
|
406
|
-
RPC.Message = (function() {
|
407
|
-
|
408
|
-
/**
|
409
|
-
* Properties of a Message.
|
410
|
-
* @memberof RPC
|
411
|
-
* @interface IMessage
|
412
|
-
* @property {Uint8Array|null} [from] Message from
|
413
|
-
* @property {Uint8Array|null} [data] Message data
|
414
|
-
* @property {Uint8Array|null} [seqno] Message seqno
|
415
|
-
* @property {string|null} [topic] Message topic
|
416
|
-
* @property {Uint8Array|null} [signature] Message signature
|
417
|
-
* @property {Uint8Array|null} [key] Message key
|
418
|
-
*/
|
419
|
-
|
420
|
-
/**
|
421
|
-
* Constructs a new Message.
|
422
|
-
* @memberof RPC
|
423
|
-
* @classdesc Represents a Message.
|
424
|
-
* @implements IMessage
|
425
|
-
* @constructor
|
426
|
-
* @param {RPC.IMessage=} [p] Properties to set
|
427
|
-
*/
|
428
|
-
function Message(p) {
|
429
|
-
if (p)
|
430
|
-
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
|
431
|
-
if (p[ks[i]] != null)
|
432
|
-
this[ks[i]] = p[ks[i]];
|
433
|
-
}
|
434
|
-
|
435
|
-
/**
|
436
|
-
* Message from.
|
437
|
-
* @member {Uint8Array|null|undefined} from
|
438
|
-
* @memberof RPC.Message
|
439
|
-
* @instance
|
440
|
-
*/
|
441
|
-
Message.prototype.from = null;
|
442
|
-
|
443
|
-
/**
|
444
|
-
* Message data.
|
445
|
-
* @member {Uint8Array|null|undefined} data
|
446
|
-
* @memberof RPC.Message
|
447
|
-
* @instance
|
448
|
-
*/
|
449
|
-
Message.prototype.data = null;
|
450
|
-
|
451
|
-
/**
|
452
|
-
* Message seqno.
|
453
|
-
* @member {Uint8Array|null|undefined} seqno
|
454
|
-
* @memberof RPC.Message
|
455
|
-
* @instance
|
456
|
-
*/
|
457
|
-
Message.prototype.seqno = null;
|
458
|
-
|
459
|
-
/**
|
460
|
-
* Message topic.
|
461
|
-
* @member {string|null|undefined} topic
|
462
|
-
* @memberof RPC.Message
|
463
|
-
* @instance
|
464
|
-
*/
|
465
|
-
Message.prototype.topic = null;
|
466
|
-
|
467
|
-
/**
|
468
|
-
* Message signature.
|
469
|
-
* @member {Uint8Array|null|undefined} signature
|
470
|
-
* @memberof RPC.Message
|
471
|
-
* @instance
|
472
|
-
*/
|
473
|
-
Message.prototype.signature = null;
|
474
|
-
|
475
|
-
/**
|
476
|
-
* Message key.
|
477
|
-
* @member {Uint8Array|null|undefined} key
|
478
|
-
* @memberof RPC.Message
|
479
|
-
* @instance
|
480
|
-
*/
|
481
|
-
Message.prototype.key = null;
|
482
|
-
|
483
|
-
// OneOf field names bound to virtual getters and setters
|
484
|
-
let $oneOfFields;
|
485
|
-
|
486
|
-
/**
|
487
|
-
* Message _from.
|
488
|
-
* @member {"from"|undefined} _from
|
489
|
-
* @memberof RPC.Message
|
490
|
-
* @instance
|
491
|
-
*/
|
492
|
-
Object.defineProperty(Message.prototype, "_from", {
|
493
|
-
get: $util.oneOfGetter($oneOfFields = ["from"]),
|
494
|
-
set: $util.oneOfSetter($oneOfFields)
|
495
|
-
});
|
496
|
-
|
497
|
-
/**
|
498
|
-
* Message _data.
|
499
|
-
* @member {"data"|undefined} _data
|
500
|
-
* @memberof RPC.Message
|
501
|
-
* @instance
|
502
|
-
*/
|
503
|
-
Object.defineProperty(Message.prototype, "_data", {
|
504
|
-
get: $util.oneOfGetter($oneOfFields = ["data"]),
|
505
|
-
set: $util.oneOfSetter($oneOfFields)
|
506
|
-
});
|
507
|
-
|
508
|
-
/**
|
509
|
-
* Message _seqno.
|
510
|
-
* @member {"seqno"|undefined} _seqno
|
511
|
-
* @memberof RPC.Message
|
512
|
-
* @instance
|
513
|
-
*/
|
514
|
-
Object.defineProperty(Message.prototype, "_seqno", {
|
515
|
-
get: $util.oneOfGetter($oneOfFields = ["seqno"]),
|
516
|
-
set: $util.oneOfSetter($oneOfFields)
|
517
|
-
});
|
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
|
-
|
530
|
-
/**
|
531
|
-
* Message _signature.
|
532
|
-
* @member {"signature"|undefined} _signature
|
533
|
-
* @memberof RPC.Message
|
534
|
-
* @instance
|
535
|
-
*/
|
536
|
-
Object.defineProperty(Message.prototype, "_signature", {
|
537
|
-
get: $util.oneOfGetter($oneOfFields = ["signature"]),
|
538
|
-
set: $util.oneOfSetter($oneOfFields)
|
539
|
-
});
|
540
|
-
|
541
|
-
/**
|
542
|
-
* Message _key.
|
543
|
-
* @member {"key"|undefined} _key
|
544
|
-
* @memberof RPC.Message
|
545
|
-
* @instance
|
546
|
-
*/
|
547
|
-
Object.defineProperty(Message.prototype, "_key", {
|
548
|
-
get: $util.oneOfGetter($oneOfFields = ["key"]),
|
549
|
-
set: $util.oneOfSetter($oneOfFields)
|
550
|
-
});
|
551
|
-
|
552
|
-
/**
|
553
|
-
* Encodes the specified Message message. Does not implicitly {@link RPC.Message.verify|verify} messages.
|
554
|
-
* @function encode
|
555
|
-
* @memberof RPC.Message
|
556
|
-
* @static
|
557
|
-
* @param {RPC.IMessage} m Message message or plain object to encode
|
558
|
-
* @param {$protobuf.Writer} [w] Writer to encode to
|
559
|
-
* @returns {$protobuf.Writer} Writer
|
560
|
-
*/
|
561
|
-
Message.encode = function encode(m, w) {
|
562
|
-
if (!w)
|
563
|
-
w = $Writer.create();
|
564
|
-
if (m.from != null && Object.hasOwnProperty.call(m, "from"))
|
565
|
-
w.uint32(10).bytes(m.from);
|
566
|
-
if (m.data != null && Object.hasOwnProperty.call(m, "data"))
|
567
|
-
w.uint32(18).bytes(m.data);
|
568
|
-
if (m.seqno != null && Object.hasOwnProperty.call(m, "seqno"))
|
569
|
-
w.uint32(26).bytes(m.seqno);
|
570
|
-
if (m.topic != null && Object.hasOwnProperty.call(m, "topic"))
|
571
|
-
w.uint32(34).string(m.topic);
|
572
|
-
if (m.signature != null && Object.hasOwnProperty.call(m, "signature"))
|
573
|
-
w.uint32(42).bytes(m.signature);
|
574
|
-
if (m.key != null && Object.hasOwnProperty.call(m, "key"))
|
575
|
-
w.uint32(50).bytes(m.key);
|
576
|
-
return w;
|
577
|
-
};
|
578
|
-
|
579
|
-
/**
|
580
|
-
* Decodes a Message message from the specified reader or buffer.
|
581
|
-
* @function decode
|
582
|
-
* @memberof RPC.Message
|
583
|
-
* @static
|
584
|
-
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
|
585
|
-
* @param {number} [l] Message length if known beforehand
|
586
|
-
* @returns {RPC.Message} Message
|
587
|
-
* @throws {Error} If the payload is not a reader or valid buffer
|
588
|
-
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
589
|
-
*/
|
590
|
-
Message.decode = function decode(r, l) {
|
591
|
-
if (!(r instanceof $Reader))
|
592
|
-
r = $Reader.create(r);
|
593
|
-
var c = l === undefined ? r.len : r.pos + l, m = new $root.RPC.Message();
|
594
|
-
while (r.pos < c) {
|
595
|
-
var t = r.uint32();
|
596
|
-
switch (t >>> 3) {
|
597
|
-
case 1:
|
598
|
-
m.from = r.bytes();
|
599
|
-
break;
|
600
|
-
case 2:
|
601
|
-
m.data = r.bytes();
|
602
|
-
break;
|
603
|
-
case 3:
|
604
|
-
m.seqno = r.bytes();
|
605
|
-
break;
|
606
|
-
case 4:
|
607
|
-
m.topic = r.string();
|
608
|
-
break;
|
609
|
-
case 5:
|
610
|
-
m.signature = r.bytes();
|
611
|
-
break;
|
612
|
-
case 6:
|
613
|
-
m.key = r.bytes();
|
614
|
-
break;
|
615
|
-
default:
|
616
|
-
r.skipType(t & 7);
|
617
|
-
break;
|
618
|
-
}
|
619
|
-
}
|
620
|
-
return m;
|
621
|
-
};
|
622
|
-
|
623
|
-
/**
|
624
|
-
* Creates a Message message from a plain object. Also converts values to their respective internal types.
|
625
|
-
* @function fromObject
|
626
|
-
* @memberof RPC.Message
|
627
|
-
* @static
|
628
|
-
* @param {Object.<string,*>} d Plain object
|
629
|
-
* @returns {RPC.Message} Message
|
630
|
-
*/
|
631
|
-
Message.fromObject = function fromObject(d) {
|
632
|
-
if (d instanceof $root.RPC.Message)
|
633
|
-
return d;
|
634
|
-
var m = new $root.RPC.Message();
|
635
|
-
if (d.from != null) {
|
636
|
-
if (typeof d.from === "string")
|
637
|
-
$util.base64.decode(d.from, m.from = $util.newBuffer($util.base64.length(d.from)), 0);
|
638
|
-
else if (d.from.length)
|
639
|
-
m.from = d.from;
|
640
|
-
}
|
641
|
-
if (d.data != null) {
|
642
|
-
if (typeof d.data === "string")
|
643
|
-
$util.base64.decode(d.data, m.data = $util.newBuffer($util.base64.length(d.data)), 0);
|
644
|
-
else if (d.data.length)
|
645
|
-
m.data = d.data;
|
646
|
-
}
|
647
|
-
if (d.seqno != null) {
|
648
|
-
if (typeof d.seqno === "string")
|
649
|
-
$util.base64.decode(d.seqno, m.seqno = $util.newBuffer($util.base64.length(d.seqno)), 0);
|
650
|
-
else if (d.seqno.length)
|
651
|
-
m.seqno = d.seqno;
|
652
|
-
}
|
653
|
-
if (d.topic != null) {
|
654
|
-
m.topic = String(d.topic);
|
655
|
-
}
|
656
|
-
if (d.signature != null) {
|
657
|
-
if (typeof d.signature === "string")
|
658
|
-
$util.base64.decode(d.signature, m.signature = $util.newBuffer($util.base64.length(d.signature)), 0);
|
659
|
-
else if (d.signature.length)
|
660
|
-
m.signature = d.signature;
|
661
|
-
}
|
662
|
-
if (d.key != null) {
|
663
|
-
if (typeof d.key === "string")
|
664
|
-
$util.base64.decode(d.key, m.key = $util.newBuffer($util.base64.length(d.key)), 0);
|
665
|
-
else if (d.key.length)
|
666
|
-
m.key = d.key;
|
667
|
-
}
|
668
|
-
return m;
|
669
|
-
};
|
670
|
-
|
671
|
-
/**
|
672
|
-
* Creates a plain object from a Message message. Also converts values to other types if specified.
|
673
|
-
* @function toObject
|
674
|
-
* @memberof RPC.Message
|
675
|
-
* @static
|
676
|
-
* @param {RPC.Message} m Message
|
677
|
-
* @param {$protobuf.IConversionOptions} [o] Conversion options
|
678
|
-
* @returns {Object.<string,*>} Plain object
|
679
|
-
*/
|
680
|
-
Message.toObject = function toObject(m, o) {
|
681
|
-
if (!o)
|
682
|
-
o = {};
|
683
|
-
var d = {};
|
684
|
-
if (m.from != null && m.hasOwnProperty("from")) {
|
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;
|
686
|
-
if (o.oneofs)
|
687
|
-
d._from = "from";
|
688
|
-
}
|
689
|
-
if (m.data != null && m.hasOwnProperty("data")) {
|
690
|
-
d.data = o.bytes === String ? $util.base64.encode(m.data, 0, m.data.length) : o.bytes === Array ? Array.prototype.slice.call(m.data) : m.data;
|
691
|
-
if (o.oneofs)
|
692
|
-
d._data = "data";
|
693
|
-
}
|
694
|
-
if (m.seqno != null && m.hasOwnProperty("seqno")) {
|
695
|
-
d.seqno = o.bytes === String ? $util.base64.encode(m.seqno, 0, m.seqno.length) : o.bytes === Array ? Array.prototype.slice.call(m.seqno) : m.seqno;
|
696
|
-
if (o.oneofs)
|
697
|
-
d._seqno = "seqno";
|
698
|
-
}
|
699
|
-
if (m.topic != null && m.hasOwnProperty("topic")) {
|
700
|
-
d.topic = m.topic;
|
701
|
-
if (o.oneofs)
|
702
|
-
d._topic = "topic";
|
703
|
-
}
|
704
|
-
if (m.signature != null && m.hasOwnProperty("signature")) {
|
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;
|
706
|
-
if (o.oneofs)
|
707
|
-
d._signature = "signature";
|
708
|
-
}
|
709
|
-
if (m.key != null && m.hasOwnProperty("key")) {
|
710
|
-
d.key = o.bytes === String ? $util.base64.encode(m.key, 0, m.key.length) : o.bytes === Array ? Array.prototype.slice.call(m.key) : m.key;
|
711
|
-
if (o.oneofs)
|
712
|
-
d._key = "key";
|
713
|
-
}
|
714
|
-
return d;
|
715
|
-
};
|
716
|
-
|
717
|
-
/**
|
718
|
-
* Converts this Message to JSON.
|
719
|
-
* @function toJSON
|
720
|
-
* @memberof RPC.Message
|
721
|
-
* @instance
|
722
|
-
* @returns {Object.<string,*>} JSON object
|
723
|
-
*/
|
724
|
-
Message.prototype.toJSON = function toJSON() {
|
725
|
-
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
|
726
|
-
};
|
727
|
-
|
728
|
-
return Message;
|
729
|
-
})();
|
730
|
-
|
731
|
-
return RPC;
|
732
|
-
})();
|
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
|
-
|
1870
|
-
export { $root as default };
|