@libp2p/gossipsub 15.0.15 → 15.0.16-709b3fa2e
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 +0 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/message/rpc.d.ts +241 -20
- package/dist/src/message/rpc.d.ts.map +1 -1
- package/dist/src/message/rpc.js +516 -64
- package/dist/src/message/rpc.js.map +1 -1
- package/package.json +11 -11
- package/src/message/rpc.ts +792 -45
- package/dist/typedoc-urls.json +0 -149
package/dist/src/message/rpc.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { decodeMessage, encodeMessage, MaxLengthError, message } from 'protons-runtime';
|
|
1
|
+
import { decodeMessage, encodeMessage, MaxLengthError, message, streamMessage } from 'protons-runtime';
|
|
3
2
|
export var RPC;
|
|
4
3
|
(function (RPC) {
|
|
5
4
|
let SubOpts;
|
|
@@ -43,16 +42,47 @@ export var RPC;
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
return obj;
|
|
45
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
46
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
47
|
+
while (reader.pos < end) {
|
|
48
|
+
const tag = reader.uint32();
|
|
49
|
+
switch (tag >>> 3) {
|
|
50
|
+
case 1: {
|
|
51
|
+
yield {
|
|
52
|
+
field: `${prefix}.subscribe`,
|
|
53
|
+
value: reader.bool()
|
|
54
|
+
};
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case 2: {
|
|
58
|
+
yield {
|
|
59
|
+
field: `${prefix}.topic`,
|
|
60
|
+
value: reader.string()
|
|
61
|
+
};
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
default: {
|
|
65
|
+
reader.skipType(tag & 7);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
46
70
|
});
|
|
47
71
|
}
|
|
48
72
|
return _codec;
|
|
49
73
|
};
|
|
50
|
-
|
|
74
|
+
function encode(obj) {
|
|
51
75
|
return encodeMessage(obj, SubOpts.codec());
|
|
52
|
-
}
|
|
53
|
-
SubOpts.
|
|
76
|
+
}
|
|
77
|
+
SubOpts.encode = encode;
|
|
78
|
+
function decode(buf, opts) {
|
|
54
79
|
return decodeMessage(buf, SubOpts.codec(), opts);
|
|
55
|
-
}
|
|
80
|
+
}
|
|
81
|
+
SubOpts.decode = decode;
|
|
82
|
+
function stream(buf, opts) {
|
|
83
|
+
return streamMessage(buf, SubOpts.codec(), opts);
|
|
84
|
+
}
|
|
85
|
+
SubOpts.stream = stream;
|
|
56
86
|
})(SubOpts = RPC.SubOpts || (RPC.SubOpts = {}));
|
|
57
87
|
let Message;
|
|
58
88
|
(function (Message) {
|
|
@@ -129,16 +159,75 @@ export var RPC;
|
|
|
129
159
|
}
|
|
130
160
|
}
|
|
131
161
|
return obj;
|
|
162
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
163
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
164
|
+
while (reader.pos < end) {
|
|
165
|
+
const tag = reader.uint32();
|
|
166
|
+
switch (tag >>> 3) {
|
|
167
|
+
case 1: {
|
|
168
|
+
yield {
|
|
169
|
+
field: `${prefix}.from`,
|
|
170
|
+
value: reader.bytes()
|
|
171
|
+
};
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
case 2: {
|
|
175
|
+
yield {
|
|
176
|
+
field: `${prefix}.data`,
|
|
177
|
+
value: reader.bytes()
|
|
178
|
+
};
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 3: {
|
|
182
|
+
yield {
|
|
183
|
+
field: `${prefix}.seqno`,
|
|
184
|
+
value: reader.bytes()
|
|
185
|
+
};
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
case 4: {
|
|
189
|
+
yield {
|
|
190
|
+
field: `${prefix}.topic`,
|
|
191
|
+
value: reader.string()
|
|
192
|
+
};
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
case 5: {
|
|
196
|
+
yield {
|
|
197
|
+
field: `${prefix}.signature`,
|
|
198
|
+
value: reader.bytes()
|
|
199
|
+
};
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case 6: {
|
|
203
|
+
yield {
|
|
204
|
+
field: `${prefix}.key`,
|
|
205
|
+
value: reader.bytes()
|
|
206
|
+
};
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
default: {
|
|
210
|
+
reader.skipType(tag & 7);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
132
215
|
});
|
|
133
216
|
}
|
|
134
217
|
return _codec;
|
|
135
218
|
};
|
|
136
|
-
|
|
219
|
+
function encode(obj) {
|
|
137
220
|
return encodeMessage(obj, Message.codec());
|
|
138
|
-
}
|
|
139
|
-
Message.
|
|
221
|
+
}
|
|
222
|
+
Message.encode = encode;
|
|
223
|
+
function decode(buf, opts) {
|
|
140
224
|
return decodeMessage(buf, Message.codec(), opts);
|
|
141
|
-
}
|
|
225
|
+
}
|
|
226
|
+
Message.decode = decode;
|
|
227
|
+
function stream(buf, opts) {
|
|
228
|
+
return streamMessage(buf, Message.codec(), opts);
|
|
229
|
+
}
|
|
230
|
+
Message.stream = stream;
|
|
142
231
|
})(Message = RPC.Message || (RPC.Message = {}));
|
|
143
232
|
let ControlMessage;
|
|
144
233
|
(function (ControlMessage) {
|
|
@@ -149,31 +238,31 @@ export var RPC;
|
|
|
149
238
|
if (opts.lengthDelimited !== false) {
|
|
150
239
|
w.fork();
|
|
151
240
|
}
|
|
152
|
-
if (obj.ihave != null) {
|
|
241
|
+
if (obj.ihave != null && obj.ihave.length > 0) {
|
|
153
242
|
for (const value of obj.ihave) {
|
|
154
243
|
w.uint32(10);
|
|
155
244
|
RPC.ControlIHave.codec().encode(value, w);
|
|
156
245
|
}
|
|
157
246
|
}
|
|
158
|
-
if (obj.iwant != null) {
|
|
247
|
+
if (obj.iwant != null && obj.iwant.length > 0) {
|
|
159
248
|
for (const value of obj.iwant) {
|
|
160
249
|
w.uint32(18);
|
|
161
250
|
RPC.ControlIWant.codec().encode(value, w);
|
|
162
251
|
}
|
|
163
252
|
}
|
|
164
|
-
if (obj.graft != null) {
|
|
253
|
+
if (obj.graft != null && obj.graft.length > 0) {
|
|
165
254
|
for (const value of obj.graft) {
|
|
166
255
|
w.uint32(26);
|
|
167
256
|
RPC.ControlGraft.codec().encode(value, w);
|
|
168
257
|
}
|
|
169
258
|
}
|
|
170
|
-
if (obj.prune != null) {
|
|
259
|
+
if (obj.prune != null && obj.prune.length > 0) {
|
|
171
260
|
for (const value of obj.prune) {
|
|
172
261
|
w.uint32(34);
|
|
173
262
|
RPC.ControlPrune.codec().encode(value, w);
|
|
174
263
|
}
|
|
175
264
|
}
|
|
176
|
-
if (obj.idontwant != null) {
|
|
265
|
+
if (obj.idontwant != null && obj.idontwant.length > 0) {
|
|
177
266
|
for (const value of obj.idontwant) {
|
|
178
267
|
w.uint32(42);
|
|
179
268
|
RPC.ControlIDontWant.codec().encode(value, w);
|
|
@@ -196,7 +285,7 @@ export var RPC;
|
|
|
196
285
|
switch (tag >>> 3) {
|
|
197
286
|
case 1: {
|
|
198
287
|
if (opts.limits?.ihave != null && obj.ihave.length === opts.limits.ihave) {
|
|
199
|
-
throw new MaxLengthError('Decode error -
|
|
288
|
+
throw new MaxLengthError('Decode error - repeated field "ihave" had too many elements');
|
|
200
289
|
}
|
|
201
290
|
obj.ihave.push(RPC.ControlIHave.codec().decode(reader, reader.uint32(), {
|
|
202
291
|
limits: opts.limits?.ihave$
|
|
@@ -205,7 +294,7 @@ export var RPC;
|
|
|
205
294
|
}
|
|
206
295
|
case 2: {
|
|
207
296
|
if (opts.limits?.iwant != null && obj.iwant.length === opts.limits.iwant) {
|
|
208
|
-
throw new MaxLengthError('Decode error -
|
|
297
|
+
throw new MaxLengthError('Decode error - repeated field "iwant" had too many elements');
|
|
209
298
|
}
|
|
210
299
|
obj.iwant.push(RPC.ControlIWant.codec().decode(reader, reader.uint32(), {
|
|
211
300
|
limits: opts.limits?.iwant$
|
|
@@ -214,7 +303,7 @@ export var RPC;
|
|
|
214
303
|
}
|
|
215
304
|
case 3: {
|
|
216
305
|
if (opts.limits?.graft != null && obj.graft.length === opts.limits.graft) {
|
|
217
|
-
throw new MaxLengthError('Decode error -
|
|
306
|
+
throw new MaxLengthError('Decode error - repeated field "graft" had too many elements');
|
|
218
307
|
}
|
|
219
308
|
obj.graft.push(RPC.ControlGraft.codec().decode(reader, reader.uint32(), {
|
|
220
309
|
limits: opts.limits?.graft$
|
|
@@ -223,7 +312,7 @@ export var RPC;
|
|
|
223
312
|
}
|
|
224
313
|
case 4: {
|
|
225
314
|
if (opts.limits?.prune != null && obj.prune.length === opts.limits.prune) {
|
|
226
|
-
throw new MaxLengthError('Decode error -
|
|
315
|
+
throw new MaxLengthError('Decode error - repeated field "prune" had too many elements');
|
|
227
316
|
}
|
|
228
317
|
obj.prune.push(RPC.ControlPrune.codec().decode(reader, reader.uint32(), {
|
|
229
318
|
limits: opts.limits?.prune$
|
|
@@ -232,7 +321,7 @@ export var RPC;
|
|
|
232
321
|
}
|
|
233
322
|
case 5: {
|
|
234
323
|
if (opts.limits?.idontwant != null && obj.idontwant.length === opts.limits.idontwant) {
|
|
235
|
-
throw new MaxLengthError('Decode error -
|
|
324
|
+
throw new MaxLengthError('Decode error - repeated field "idontwant" had too many elements');
|
|
236
325
|
}
|
|
237
326
|
obj.idontwant.push(RPC.ControlIDontWant.codec().decode(reader, reader.uint32(), {
|
|
238
327
|
limits: opts.limits?.idontwant$
|
|
@@ -246,16 +335,115 @@ export var RPC;
|
|
|
246
335
|
}
|
|
247
336
|
}
|
|
248
337
|
return obj;
|
|
338
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
339
|
+
const obj = {
|
|
340
|
+
ihave: 0,
|
|
341
|
+
iwant: 0,
|
|
342
|
+
graft: 0,
|
|
343
|
+
prune: 0,
|
|
344
|
+
idontwant: 0
|
|
345
|
+
};
|
|
346
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
347
|
+
while (reader.pos < end) {
|
|
348
|
+
const tag = reader.uint32();
|
|
349
|
+
switch (tag >>> 3) {
|
|
350
|
+
case 1: {
|
|
351
|
+
if (opts.limits?.ihave != null && obj.ihave === opts.limits.ihave) {
|
|
352
|
+
throw new MaxLengthError('Streaming decode error - repeated field "ihave" had too many elements');
|
|
353
|
+
}
|
|
354
|
+
for (const evt of RPC.ControlIHave.codec().stream(reader, reader.uint32(), `${prefix}.ihave[]`, {
|
|
355
|
+
limits: opts.limits?.ihave$
|
|
356
|
+
})) {
|
|
357
|
+
yield {
|
|
358
|
+
...evt,
|
|
359
|
+
index: obj.ihave
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
obj.ihave++;
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
case 2: {
|
|
366
|
+
if (opts.limits?.iwant != null && obj.iwant === opts.limits.iwant) {
|
|
367
|
+
throw new MaxLengthError('Streaming decode error - repeated field "iwant" had too many elements');
|
|
368
|
+
}
|
|
369
|
+
for (const evt of RPC.ControlIWant.codec().stream(reader, reader.uint32(), `${prefix}.iwant[]`, {
|
|
370
|
+
limits: opts.limits?.iwant$
|
|
371
|
+
})) {
|
|
372
|
+
yield {
|
|
373
|
+
...evt,
|
|
374
|
+
index: obj.iwant
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
obj.iwant++;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
case 3: {
|
|
381
|
+
if (opts.limits?.graft != null && obj.graft === opts.limits.graft) {
|
|
382
|
+
throw new MaxLengthError('Streaming decode error - repeated field "graft" had too many elements');
|
|
383
|
+
}
|
|
384
|
+
for (const evt of RPC.ControlGraft.codec().stream(reader, reader.uint32(), `${prefix}.graft[]`, {
|
|
385
|
+
limits: opts.limits?.graft$
|
|
386
|
+
})) {
|
|
387
|
+
yield {
|
|
388
|
+
...evt,
|
|
389
|
+
index: obj.graft
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
obj.graft++;
|
|
393
|
+
break;
|
|
394
|
+
}
|
|
395
|
+
case 4: {
|
|
396
|
+
if (opts.limits?.prune != null && obj.prune === opts.limits.prune) {
|
|
397
|
+
throw new MaxLengthError('Streaming decode error - repeated field "prune" had too many elements');
|
|
398
|
+
}
|
|
399
|
+
for (const evt of RPC.ControlPrune.codec().stream(reader, reader.uint32(), `${prefix}.prune[]`, {
|
|
400
|
+
limits: opts.limits?.prune$
|
|
401
|
+
})) {
|
|
402
|
+
yield {
|
|
403
|
+
...evt,
|
|
404
|
+
index: obj.prune
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
obj.prune++;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
case 5: {
|
|
411
|
+
if (opts.limits?.idontwant != null && obj.idontwant === opts.limits.idontwant) {
|
|
412
|
+
throw new MaxLengthError('Streaming decode error - repeated field "idontwant" had too many elements');
|
|
413
|
+
}
|
|
414
|
+
for (const evt of RPC.ControlIDontWant.codec().stream(reader, reader.uint32(), `${prefix}.idontwant[]`, {
|
|
415
|
+
limits: opts.limits?.idontwant$
|
|
416
|
+
})) {
|
|
417
|
+
yield {
|
|
418
|
+
...evt,
|
|
419
|
+
index: obj.idontwant
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
obj.idontwant++;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
default: {
|
|
426
|
+
reader.skipType(tag & 7);
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
249
431
|
});
|
|
250
432
|
}
|
|
251
433
|
return _codec;
|
|
252
434
|
};
|
|
253
|
-
|
|
435
|
+
function encode(obj) {
|
|
254
436
|
return encodeMessage(obj, ControlMessage.codec());
|
|
255
|
-
}
|
|
256
|
-
ControlMessage.
|
|
437
|
+
}
|
|
438
|
+
ControlMessage.encode = encode;
|
|
439
|
+
function decode(buf, opts) {
|
|
257
440
|
return decodeMessage(buf, ControlMessage.codec(), opts);
|
|
258
|
-
}
|
|
441
|
+
}
|
|
442
|
+
ControlMessage.decode = decode;
|
|
443
|
+
function stream(buf, opts) {
|
|
444
|
+
return streamMessage(buf, ControlMessage.codec(), opts);
|
|
445
|
+
}
|
|
446
|
+
ControlMessage.stream = stream;
|
|
259
447
|
})(ControlMessage = RPC.ControlMessage || (RPC.ControlMessage = {}));
|
|
260
448
|
let ControlIHave;
|
|
261
449
|
(function (ControlIHave) {
|
|
@@ -270,7 +458,7 @@ export var RPC;
|
|
|
270
458
|
w.uint32(10);
|
|
271
459
|
w.string(obj.topicID);
|
|
272
460
|
}
|
|
273
|
-
if (obj.messageIDs != null) {
|
|
461
|
+
if (obj.messageIDs != null && obj.messageIDs.length > 0) {
|
|
274
462
|
for (const value of obj.messageIDs) {
|
|
275
463
|
w.uint32(18);
|
|
276
464
|
w.bytes(value);
|
|
@@ -293,7 +481,7 @@ export var RPC;
|
|
|
293
481
|
}
|
|
294
482
|
case 2: {
|
|
295
483
|
if (opts.limits?.messageIDs != null && obj.messageIDs.length === opts.limits.messageIDs) {
|
|
296
|
-
throw new MaxLengthError('Decode error -
|
|
484
|
+
throw new MaxLengthError('Decode error - repeated field "messageIDs" had too many elements');
|
|
297
485
|
}
|
|
298
486
|
obj.messageIDs.push(reader.bytes());
|
|
299
487
|
break;
|
|
@@ -305,16 +493,55 @@ export var RPC;
|
|
|
305
493
|
}
|
|
306
494
|
}
|
|
307
495
|
return obj;
|
|
496
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
497
|
+
const obj = {
|
|
498
|
+
messageIDs: 0
|
|
499
|
+
};
|
|
500
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
501
|
+
while (reader.pos < end) {
|
|
502
|
+
const tag = reader.uint32();
|
|
503
|
+
switch (tag >>> 3) {
|
|
504
|
+
case 1: {
|
|
505
|
+
yield {
|
|
506
|
+
field: `${prefix}.topicID`,
|
|
507
|
+
value: reader.string()
|
|
508
|
+
};
|
|
509
|
+
break;
|
|
510
|
+
}
|
|
511
|
+
case 2: {
|
|
512
|
+
if (opts.limits?.messageIDs != null && obj.messageIDs === opts.limits.messageIDs) {
|
|
513
|
+
throw new MaxLengthError('Streaming decode error - repeated field "messageIDs" had too many elements');
|
|
514
|
+
}
|
|
515
|
+
yield {
|
|
516
|
+
field: `${prefix}.messageIDs[]`,
|
|
517
|
+
index: obj.messageIDs,
|
|
518
|
+
value: reader.bytes()
|
|
519
|
+
};
|
|
520
|
+
obj.messageIDs++;
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
default: {
|
|
524
|
+
reader.skipType(tag & 7);
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
308
529
|
});
|
|
309
530
|
}
|
|
310
531
|
return _codec;
|
|
311
532
|
};
|
|
312
|
-
|
|
533
|
+
function encode(obj) {
|
|
313
534
|
return encodeMessage(obj, ControlIHave.codec());
|
|
314
|
-
}
|
|
315
|
-
ControlIHave.
|
|
535
|
+
}
|
|
536
|
+
ControlIHave.encode = encode;
|
|
537
|
+
function decode(buf, opts) {
|
|
316
538
|
return decodeMessage(buf, ControlIHave.codec(), opts);
|
|
317
|
-
}
|
|
539
|
+
}
|
|
540
|
+
ControlIHave.decode = decode;
|
|
541
|
+
function stream(buf, opts) {
|
|
542
|
+
return streamMessage(buf, ControlIHave.codec(), opts);
|
|
543
|
+
}
|
|
544
|
+
ControlIHave.stream = stream;
|
|
318
545
|
})(ControlIHave = RPC.ControlIHave || (RPC.ControlIHave = {}));
|
|
319
546
|
let ControlIWant;
|
|
320
547
|
(function (ControlIWant) {
|
|
@@ -325,7 +552,7 @@ export var RPC;
|
|
|
325
552
|
if (opts.lengthDelimited !== false) {
|
|
326
553
|
w.fork();
|
|
327
554
|
}
|
|
328
|
-
if (obj.messageIDs != null) {
|
|
555
|
+
if (obj.messageIDs != null && obj.messageIDs.length > 0) {
|
|
329
556
|
for (const value of obj.messageIDs) {
|
|
330
557
|
w.uint32(10);
|
|
331
558
|
w.bytes(value);
|
|
@@ -344,7 +571,7 @@ export var RPC;
|
|
|
344
571
|
switch (tag >>> 3) {
|
|
345
572
|
case 1: {
|
|
346
573
|
if (opts.limits?.messageIDs != null && obj.messageIDs.length === opts.limits.messageIDs) {
|
|
347
|
-
throw new MaxLengthError('Decode error -
|
|
574
|
+
throw new MaxLengthError('Decode error - repeated field "messageIDs" had too many elements');
|
|
348
575
|
}
|
|
349
576
|
obj.messageIDs.push(reader.bytes());
|
|
350
577
|
break;
|
|
@@ -356,16 +583,48 @@ export var RPC;
|
|
|
356
583
|
}
|
|
357
584
|
}
|
|
358
585
|
return obj;
|
|
586
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
587
|
+
const obj = {
|
|
588
|
+
messageIDs: 0
|
|
589
|
+
};
|
|
590
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
591
|
+
while (reader.pos < end) {
|
|
592
|
+
const tag = reader.uint32();
|
|
593
|
+
switch (tag >>> 3) {
|
|
594
|
+
case 1: {
|
|
595
|
+
if (opts.limits?.messageIDs != null && obj.messageIDs === opts.limits.messageIDs) {
|
|
596
|
+
throw new MaxLengthError('Streaming decode error - repeated field "messageIDs" had too many elements');
|
|
597
|
+
}
|
|
598
|
+
yield {
|
|
599
|
+
field: `${prefix}.messageIDs[]`,
|
|
600
|
+
index: obj.messageIDs,
|
|
601
|
+
value: reader.bytes()
|
|
602
|
+
};
|
|
603
|
+
obj.messageIDs++;
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
default: {
|
|
607
|
+
reader.skipType(tag & 7);
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
359
612
|
});
|
|
360
613
|
}
|
|
361
614
|
return _codec;
|
|
362
615
|
};
|
|
363
|
-
|
|
616
|
+
function encode(obj) {
|
|
364
617
|
return encodeMessage(obj, ControlIWant.codec());
|
|
365
|
-
}
|
|
366
|
-
ControlIWant.
|
|
618
|
+
}
|
|
619
|
+
ControlIWant.encode = encode;
|
|
620
|
+
function decode(buf, opts) {
|
|
367
621
|
return decodeMessage(buf, ControlIWant.codec(), opts);
|
|
368
|
-
}
|
|
622
|
+
}
|
|
623
|
+
ControlIWant.decode = decode;
|
|
624
|
+
function stream(buf, opts) {
|
|
625
|
+
return streamMessage(buf, ControlIWant.codec(), opts);
|
|
626
|
+
}
|
|
627
|
+
ControlIWant.stream = stream;
|
|
369
628
|
})(ControlIWant = RPC.ControlIWant || (RPC.ControlIWant = {}));
|
|
370
629
|
let ControlGraft;
|
|
371
630
|
(function (ControlGraft) {
|
|
@@ -400,16 +659,40 @@ export var RPC;
|
|
|
400
659
|
}
|
|
401
660
|
}
|
|
402
661
|
return obj;
|
|
662
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
663
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
664
|
+
while (reader.pos < end) {
|
|
665
|
+
const tag = reader.uint32();
|
|
666
|
+
switch (tag >>> 3) {
|
|
667
|
+
case 1: {
|
|
668
|
+
yield {
|
|
669
|
+
field: `${prefix}.topicID`,
|
|
670
|
+
value: reader.string()
|
|
671
|
+
};
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
default: {
|
|
675
|
+
reader.skipType(tag & 7);
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
403
680
|
});
|
|
404
681
|
}
|
|
405
682
|
return _codec;
|
|
406
683
|
};
|
|
407
|
-
|
|
684
|
+
function encode(obj) {
|
|
408
685
|
return encodeMessage(obj, ControlGraft.codec());
|
|
409
|
-
}
|
|
410
|
-
ControlGraft.
|
|
686
|
+
}
|
|
687
|
+
ControlGraft.encode = encode;
|
|
688
|
+
function decode(buf, opts) {
|
|
411
689
|
return decodeMessage(buf, ControlGraft.codec(), opts);
|
|
412
|
-
}
|
|
690
|
+
}
|
|
691
|
+
ControlGraft.decode = decode;
|
|
692
|
+
function stream(buf, opts) {
|
|
693
|
+
return streamMessage(buf, ControlGraft.codec(), opts);
|
|
694
|
+
}
|
|
695
|
+
ControlGraft.stream = stream;
|
|
413
696
|
})(ControlGraft = RPC.ControlGraft || (RPC.ControlGraft = {}));
|
|
414
697
|
let ControlPrune;
|
|
415
698
|
(function (ControlPrune) {
|
|
@@ -424,7 +707,7 @@ export var RPC;
|
|
|
424
707
|
w.uint32(10);
|
|
425
708
|
w.string(obj.topicID);
|
|
426
709
|
}
|
|
427
|
-
if (obj.peers != null) {
|
|
710
|
+
if (obj.peers != null && obj.peers.length > 0) {
|
|
428
711
|
for (const value of obj.peers) {
|
|
429
712
|
w.uint32(18);
|
|
430
713
|
RPC.PeerInfo.codec().encode(value, w);
|
|
@@ -451,7 +734,7 @@ export var RPC;
|
|
|
451
734
|
}
|
|
452
735
|
case 2: {
|
|
453
736
|
if (opts.limits?.peers != null && obj.peers.length === opts.limits.peers) {
|
|
454
|
-
throw new MaxLengthError('Decode error -
|
|
737
|
+
throw new MaxLengthError('Decode error - repeated field "peers" had too many elements');
|
|
455
738
|
}
|
|
456
739
|
obj.peers.push(RPC.PeerInfo.codec().decode(reader, reader.uint32(), {
|
|
457
740
|
limits: opts.limits?.peers$
|
|
@@ -469,16 +752,65 @@ export var RPC;
|
|
|
469
752
|
}
|
|
470
753
|
}
|
|
471
754
|
return obj;
|
|
755
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
756
|
+
const obj = {
|
|
757
|
+
peers: 0
|
|
758
|
+
};
|
|
759
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
760
|
+
while (reader.pos < end) {
|
|
761
|
+
const tag = reader.uint32();
|
|
762
|
+
switch (tag >>> 3) {
|
|
763
|
+
case 1: {
|
|
764
|
+
yield {
|
|
765
|
+
field: `${prefix}.topicID`,
|
|
766
|
+
value: reader.string()
|
|
767
|
+
};
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
case 2: {
|
|
771
|
+
if (opts.limits?.peers != null && obj.peers === opts.limits.peers) {
|
|
772
|
+
throw new MaxLengthError('Streaming decode error - repeated field "peers" had too many elements');
|
|
773
|
+
}
|
|
774
|
+
for (const evt of RPC.PeerInfo.codec().stream(reader, reader.uint32(), `${prefix}.peers[]`, {
|
|
775
|
+
limits: opts.limits?.peers$
|
|
776
|
+
})) {
|
|
777
|
+
yield {
|
|
778
|
+
...evt,
|
|
779
|
+
index: obj.peers
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
obj.peers++;
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
case 3: {
|
|
786
|
+
yield {
|
|
787
|
+
field: `${prefix}.backoff`,
|
|
788
|
+
value: reader.uint64Number()
|
|
789
|
+
};
|
|
790
|
+
break;
|
|
791
|
+
}
|
|
792
|
+
default: {
|
|
793
|
+
reader.skipType(tag & 7);
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
472
798
|
});
|
|
473
799
|
}
|
|
474
800
|
return _codec;
|
|
475
801
|
};
|
|
476
|
-
|
|
802
|
+
function encode(obj) {
|
|
477
803
|
return encodeMessage(obj, ControlPrune.codec());
|
|
478
|
-
}
|
|
479
|
-
ControlPrune.
|
|
804
|
+
}
|
|
805
|
+
ControlPrune.encode = encode;
|
|
806
|
+
function decode(buf, opts) {
|
|
480
807
|
return decodeMessage(buf, ControlPrune.codec(), opts);
|
|
481
|
-
}
|
|
808
|
+
}
|
|
809
|
+
ControlPrune.decode = decode;
|
|
810
|
+
function stream(buf, opts) {
|
|
811
|
+
return streamMessage(buf, ControlPrune.codec(), opts);
|
|
812
|
+
}
|
|
813
|
+
ControlPrune.stream = stream;
|
|
482
814
|
})(ControlPrune = RPC.ControlPrune || (RPC.ControlPrune = {}));
|
|
483
815
|
let PeerInfo;
|
|
484
816
|
(function (PeerInfo) {
|
|
@@ -521,16 +853,47 @@ export var RPC;
|
|
|
521
853
|
}
|
|
522
854
|
}
|
|
523
855
|
return obj;
|
|
856
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
857
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
858
|
+
while (reader.pos < end) {
|
|
859
|
+
const tag = reader.uint32();
|
|
860
|
+
switch (tag >>> 3) {
|
|
861
|
+
case 1: {
|
|
862
|
+
yield {
|
|
863
|
+
field: `${prefix}.peerID`,
|
|
864
|
+
value: reader.bytes()
|
|
865
|
+
};
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
case 2: {
|
|
869
|
+
yield {
|
|
870
|
+
field: `${prefix}.signedPeerRecord`,
|
|
871
|
+
value: reader.bytes()
|
|
872
|
+
};
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
default: {
|
|
876
|
+
reader.skipType(tag & 7);
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
524
881
|
});
|
|
525
882
|
}
|
|
526
883
|
return _codec;
|
|
527
884
|
};
|
|
528
|
-
|
|
885
|
+
function encode(obj) {
|
|
529
886
|
return encodeMessage(obj, PeerInfo.codec());
|
|
530
|
-
}
|
|
531
|
-
PeerInfo.
|
|
887
|
+
}
|
|
888
|
+
PeerInfo.encode = encode;
|
|
889
|
+
function decode(buf, opts) {
|
|
532
890
|
return decodeMessage(buf, PeerInfo.codec(), opts);
|
|
533
|
-
}
|
|
891
|
+
}
|
|
892
|
+
PeerInfo.decode = decode;
|
|
893
|
+
function stream(buf, opts) {
|
|
894
|
+
return streamMessage(buf, PeerInfo.codec(), opts);
|
|
895
|
+
}
|
|
896
|
+
PeerInfo.stream = stream;
|
|
534
897
|
})(PeerInfo = RPC.PeerInfo || (RPC.PeerInfo = {}));
|
|
535
898
|
let ControlIDontWant;
|
|
536
899
|
(function (ControlIDontWant) {
|
|
@@ -541,7 +904,7 @@ export var RPC;
|
|
|
541
904
|
if (opts.lengthDelimited !== false) {
|
|
542
905
|
w.fork();
|
|
543
906
|
}
|
|
544
|
-
if (obj.messageIDs != null) {
|
|
907
|
+
if (obj.messageIDs != null && obj.messageIDs.length > 0) {
|
|
545
908
|
for (const value of obj.messageIDs) {
|
|
546
909
|
w.uint32(10);
|
|
547
910
|
w.bytes(value);
|
|
@@ -560,7 +923,7 @@ export var RPC;
|
|
|
560
923
|
switch (tag >>> 3) {
|
|
561
924
|
case 1: {
|
|
562
925
|
if (opts.limits?.messageIDs != null && obj.messageIDs.length === opts.limits.messageIDs) {
|
|
563
|
-
throw new MaxLengthError('Decode error -
|
|
926
|
+
throw new MaxLengthError('Decode error - repeated field "messageIDs" had too many elements');
|
|
564
927
|
}
|
|
565
928
|
obj.messageIDs.push(reader.bytes());
|
|
566
929
|
break;
|
|
@@ -572,16 +935,48 @@ export var RPC;
|
|
|
572
935
|
}
|
|
573
936
|
}
|
|
574
937
|
return obj;
|
|
938
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
939
|
+
const obj = {
|
|
940
|
+
messageIDs: 0
|
|
941
|
+
};
|
|
942
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
943
|
+
while (reader.pos < end) {
|
|
944
|
+
const tag = reader.uint32();
|
|
945
|
+
switch (tag >>> 3) {
|
|
946
|
+
case 1: {
|
|
947
|
+
if (opts.limits?.messageIDs != null && obj.messageIDs === opts.limits.messageIDs) {
|
|
948
|
+
throw new MaxLengthError('Streaming decode error - repeated field "messageIDs" had too many elements');
|
|
949
|
+
}
|
|
950
|
+
yield {
|
|
951
|
+
field: `${prefix}.messageIDs[]`,
|
|
952
|
+
index: obj.messageIDs,
|
|
953
|
+
value: reader.bytes()
|
|
954
|
+
};
|
|
955
|
+
obj.messageIDs++;
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
default: {
|
|
959
|
+
reader.skipType(tag & 7);
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
575
964
|
});
|
|
576
965
|
}
|
|
577
966
|
return _codec;
|
|
578
967
|
};
|
|
579
|
-
|
|
968
|
+
function encode(obj) {
|
|
580
969
|
return encodeMessage(obj, ControlIDontWant.codec());
|
|
581
|
-
}
|
|
582
|
-
ControlIDontWant.
|
|
970
|
+
}
|
|
971
|
+
ControlIDontWant.encode = encode;
|
|
972
|
+
function decode(buf, opts) {
|
|
583
973
|
return decodeMessage(buf, ControlIDontWant.codec(), opts);
|
|
584
|
-
}
|
|
974
|
+
}
|
|
975
|
+
ControlIDontWant.decode = decode;
|
|
976
|
+
function stream(buf, opts) {
|
|
977
|
+
return streamMessage(buf, ControlIDontWant.codec(), opts);
|
|
978
|
+
}
|
|
979
|
+
ControlIDontWant.stream = stream;
|
|
585
980
|
})(ControlIDontWant = RPC.ControlIDontWant || (RPC.ControlIDontWant = {}));
|
|
586
981
|
let _codec;
|
|
587
982
|
RPC.codec = () => {
|
|
@@ -590,13 +985,13 @@ export var RPC;
|
|
|
590
985
|
if (opts.lengthDelimited !== false) {
|
|
591
986
|
w.fork();
|
|
592
987
|
}
|
|
593
|
-
if (obj.subscriptions != null) {
|
|
988
|
+
if (obj.subscriptions != null && obj.subscriptions.length > 0) {
|
|
594
989
|
for (const value of obj.subscriptions) {
|
|
595
990
|
w.uint32(10);
|
|
596
991
|
RPC.SubOpts.codec().encode(value, w);
|
|
597
992
|
}
|
|
598
993
|
}
|
|
599
|
-
if (obj.messages != null) {
|
|
994
|
+
if (obj.messages != null && obj.messages.length > 0) {
|
|
600
995
|
for (const value of obj.messages) {
|
|
601
996
|
w.uint32(18);
|
|
602
997
|
RPC.Message.codec().encode(value, w);
|
|
@@ -620,7 +1015,7 @@ export var RPC;
|
|
|
620
1015
|
switch (tag >>> 3) {
|
|
621
1016
|
case 1: {
|
|
622
1017
|
if (opts.limits?.subscriptions != null && obj.subscriptions.length === opts.limits.subscriptions) {
|
|
623
|
-
throw new MaxLengthError('Decode error -
|
|
1018
|
+
throw new MaxLengthError('Decode error - repeated field "subscriptions" had too many elements');
|
|
624
1019
|
}
|
|
625
1020
|
obj.subscriptions.push(RPC.SubOpts.codec().decode(reader, reader.uint32(), {
|
|
626
1021
|
limits: opts.limits?.subscriptions$
|
|
@@ -629,7 +1024,7 @@ export var RPC;
|
|
|
629
1024
|
}
|
|
630
1025
|
case 2: {
|
|
631
1026
|
if (opts.limits?.messages != null && obj.messages.length === opts.limits.messages) {
|
|
632
|
-
throw new MaxLengthError('Decode error -
|
|
1027
|
+
throw new MaxLengthError('Decode error - repeated field "messages" had too many elements');
|
|
633
1028
|
}
|
|
634
1029
|
obj.messages.push(RPC.Message.codec().decode(reader, reader.uint32(), {
|
|
635
1030
|
limits: opts.limits?.messages$
|
|
@@ -649,15 +1044,72 @@ export var RPC;
|
|
|
649
1044
|
}
|
|
650
1045
|
}
|
|
651
1046
|
return obj;
|
|
1047
|
+
}, function* (reader, length, prefix, opts = {}) {
|
|
1048
|
+
const obj = {
|
|
1049
|
+
subscriptions: 0,
|
|
1050
|
+
messages: 0
|
|
1051
|
+
};
|
|
1052
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
1053
|
+
while (reader.pos < end) {
|
|
1054
|
+
const tag = reader.uint32();
|
|
1055
|
+
switch (tag >>> 3) {
|
|
1056
|
+
case 1: {
|
|
1057
|
+
if (opts.limits?.subscriptions != null && obj.subscriptions === opts.limits.subscriptions) {
|
|
1058
|
+
throw new MaxLengthError('Streaming decode error - repeated field "subscriptions" had too many elements');
|
|
1059
|
+
}
|
|
1060
|
+
for (const evt of RPC.SubOpts.codec().stream(reader, reader.uint32(), `${prefix}.subscriptions[]`, {
|
|
1061
|
+
limits: opts.limits?.subscriptions$
|
|
1062
|
+
})) {
|
|
1063
|
+
yield {
|
|
1064
|
+
...evt,
|
|
1065
|
+
index: obj.subscriptions
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
obj.subscriptions++;
|
|
1069
|
+
break;
|
|
1070
|
+
}
|
|
1071
|
+
case 2: {
|
|
1072
|
+
if (opts.limits?.messages != null && obj.messages === opts.limits.messages) {
|
|
1073
|
+
throw new MaxLengthError('Streaming decode error - repeated field "messages" had too many elements');
|
|
1074
|
+
}
|
|
1075
|
+
for (const evt of RPC.Message.codec().stream(reader, reader.uint32(), `${prefix}.messages[]`, {
|
|
1076
|
+
limits: opts.limits?.messages$
|
|
1077
|
+
})) {
|
|
1078
|
+
yield {
|
|
1079
|
+
...evt,
|
|
1080
|
+
index: obj.messages
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
obj.messages++;
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
case 3: {
|
|
1087
|
+
yield* RPC.ControlMessage.codec().stream(reader, reader.uint32(), `${prefix}.control`, {
|
|
1088
|
+
limits: opts.limits?.control
|
|
1089
|
+
});
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
default: {
|
|
1093
|
+
reader.skipType(tag & 7);
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
652
1098
|
});
|
|
653
1099
|
}
|
|
654
1100
|
return _codec;
|
|
655
1101
|
};
|
|
656
|
-
|
|
1102
|
+
function encode(obj) {
|
|
657
1103
|
return encodeMessage(obj, RPC.codec());
|
|
658
|
-
}
|
|
659
|
-
RPC.
|
|
1104
|
+
}
|
|
1105
|
+
RPC.encode = encode;
|
|
1106
|
+
function decode(buf, opts) {
|
|
660
1107
|
return decodeMessage(buf, RPC.codec(), opts);
|
|
661
|
-
}
|
|
1108
|
+
}
|
|
1109
|
+
RPC.decode = decode;
|
|
1110
|
+
function stream(buf, opts) {
|
|
1111
|
+
return streamMessage(buf, RPC.codec(), opts);
|
|
1112
|
+
}
|
|
1113
|
+
RPC.stream = stream;
|
|
662
1114
|
})(RPC || (RPC = {}));
|
|
663
1115
|
//# sourceMappingURL=rpc.js.map
|