@libp2p/daemon-protocol 3.0.1 → 3.0.3
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 +3 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +235 -334
- package/dist/src/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +235 -323
package/dist/src/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
|
+
/* eslint-disable complexity */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
|
|
3
5
|
import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime';
|
|
4
6
|
export var Request;
|
|
5
7
|
(function (Request) {
|
|
@@ -37,51 +39,64 @@ export var Request;
|
|
|
37
39
|
let _codec;
|
|
38
40
|
Request.codec = () => {
|
|
39
41
|
if (_codec == null) {
|
|
40
|
-
_codec = message((obj,
|
|
42
|
+
_codec = message((obj, w, opts = {}) => {
|
|
41
43
|
if (opts.lengthDelimited !== false) {
|
|
42
|
-
|
|
44
|
+
w.fork();
|
|
43
45
|
}
|
|
44
|
-
if (obj.type != null) {
|
|
45
|
-
|
|
46
|
-
Request.Type.codec().encode(obj.type,
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
46
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
47
|
+
w.uint32(8);
|
|
48
|
+
Request.Type.codec().encode(obj.type, w);
|
|
50
49
|
}
|
|
51
50
|
if (obj.connect != null) {
|
|
52
|
-
|
|
53
|
-
ConnectRequest.codec().encode(obj.connect,
|
|
51
|
+
w.uint32(18);
|
|
52
|
+
ConnectRequest.codec().encode(obj.connect, w, {
|
|
53
|
+
writeDefaults: false
|
|
54
|
+
});
|
|
54
55
|
}
|
|
55
56
|
if (obj.streamOpen != null) {
|
|
56
|
-
|
|
57
|
-
StreamOpenRequest.codec().encode(obj.streamOpen,
|
|
57
|
+
w.uint32(26);
|
|
58
|
+
StreamOpenRequest.codec().encode(obj.streamOpen, w, {
|
|
59
|
+
writeDefaults: false
|
|
60
|
+
});
|
|
58
61
|
}
|
|
59
62
|
if (obj.streamHandler != null) {
|
|
60
|
-
|
|
61
|
-
StreamHandlerRequest.codec().encode(obj.streamHandler,
|
|
63
|
+
w.uint32(34);
|
|
64
|
+
StreamHandlerRequest.codec().encode(obj.streamHandler, w, {
|
|
65
|
+
writeDefaults: false
|
|
66
|
+
});
|
|
62
67
|
}
|
|
63
68
|
if (obj.dht != null) {
|
|
64
|
-
|
|
65
|
-
DHTRequest.codec().encode(obj.dht,
|
|
69
|
+
w.uint32(42);
|
|
70
|
+
DHTRequest.codec().encode(obj.dht, w, {
|
|
71
|
+
writeDefaults: false
|
|
72
|
+
});
|
|
66
73
|
}
|
|
67
74
|
if (obj.connManager != null) {
|
|
68
|
-
|
|
69
|
-
ConnManagerRequest.codec().encode(obj.connManager,
|
|
75
|
+
w.uint32(50);
|
|
76
|
+
ConnManagerRequest.codec().encode(obj.connManager, w, {
|
|
77
|
+
writeDefaults: false
|
|
78
|
+
});
|
|
70
79
|
}
|
|
71
80
|
if (obj.disconnect != null) {
|
|
72
|
-
|
|
73
|
-
DisconnectRequest.codec().encode(obj.disconnect,
|
|
81
|
+
w.uint32(58);
|
|
82
|
+
DisconnectRequest.codec().encode(obj.disconnect, w, {
|
|
83
|
+
writeDefaults: false
|
|
84
|
+
});
|
|
74
85
|
}
|
|
75
86
|
if (obj.pubsub != null) {
|
|
76
|
-
|
|
77
|
-
PSRequest.codec().encode(obj.pubsub,
|
|
87
|
+
w.uint32(66);
|
|
88
|
+
PSRequest.codec().encode(obj.pubsub, w, {
|
|
89
|
+
writeDefaults: false
|
|
90
|
+
});
|
|
78
91
|
}
|
|
79
92
|
if (obj.peerStore != null) {
|
|
80
|
-
|
|
81
|
-
PeerstoreRequest.codec().encode(obj.peerStore,
|
|
93
|
+
w.uint32(74);
|
|
94
|
+
PeerstoreRequest.codec().encode(obj.peerStore, w, {
|
|
95
|
+
writeDefaults: false
|
|
96
|
+
});
|
|
82
97
|
}
|
|
83
98
|
if (opts.lengthDelimited !== false) {
|
|
84
|
-
|
|
99
|
+
w.ldelim();
|
|
85
100
|
}
|
|
86
101
|
}, (reader, length) => {
|
|
87
102
|
const obj = {
|
|
@@ -123,9 +138,6 @@ export var Request;
|
|
|
123
138
|
break;
|
|
124
139
|
}
|
|
125
140
|
}
|
|
126
|
-
if (obj.type == null) {
|
|
127
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
128
|
-
}
|
|
129
141
|
return obj;
|
|
130
142
|
});
|
|
131
143
|
}
|
|
@@ -158,52 +170,60 @@ export var Response;
|
|
|
158
170
|
let _codec;
|
|
159
171
|
Response.codec = () => {
|
|
160
172
|
if (_codec == null) {
|
|
161
|
-
_codec = message((obj,
|
|
173
|
+
_codec = message((obj, w, opts = {}) => {
|
|
162
174
|
if (opts.lengthDelimited !== false) {
|
|
163
|
-
|
|
175
|
+
w.fork();
|
|
164
176
|
}
|
|
165
|
-
if (obj.type != null) {
|
|
166
|
-
|
|
167
|
-
Response.Type.codec().encode(obj.type,
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
177
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
178
|
+
w.uint32(8);
|
|
179
|
+
Response.Type.codec().encode(obj.type, w);
|
|
171
180
|
}
|
|
172
181
|
if (obj.error != null) {
|
|
173
|
-
|
|
174
|
-
ErrorResponse.codec().encode(obj.error,
|
|
182
|
+
w.uint32(18);
|
|
183
|
+
ErrorResponse.codec().encode(obj.error, w, {
|
|
184
|
+
writeDefaults: false
|
|
185
|
+
});
|
|
175
186
|
}
|
|
176
187
|
if (obj.streamInfo != null) {
|
|
177
|
-
|
|
178
|
-
StreamInfo.codec().encode(obj.streamInfo,
|
|
188
|
+
w.uint32(26);
|
|
189
|
+
StreamInfo.codec().encode(obj.streamInfo, w, {
|
|
190
|
+
writeDefaults: false
|
|
191
|
+
});
|
|
179
192
|
}
|
|
180
193
|
if (obj.identify != null) {
|
|
181
|
-
|
|
182
|
-
IdentifyResponse.codec().encode(obj.identify,
|
|
194
|
+
w.uint32(34);
|
|
195
|
+
IdentifyResponse.codec().encode(obj.identify, w, {
|
|
196
|
+
writeDefaults: false
|
|
197
|
+
});
|
|
183
198
|
}
|
|
184
199
|
if (obj.dht != null) {
|
|
185
|
-
|
|
186
|
-
DHTResponse.codec().encode(obj.dht,
|
|
200
|
+
w.uint32(42);
|
|
201
|
+
DHTResponse.codec().encode(obj.dht, w, {
|
|
202
|
+
writeDefaults: false
|
|
203
|
+
});
|
|
187
204
|
}
|
|
188
205
|
if (obj.peers != null) {
|
|
189
206
|
for (const value of obj.peers) {
|
|
190
|
-
|
|
191
|
-
PeerInfo.codec().encode(value,
|
|
207
|
+
w.uint32(50);
|
|
208
|
+
PeerInfo.codec().encode(value, w, {
|
|
209
|
+
writeDefaults: true
|
|
210
|
+
});
|
|
192
211
|
}
|
|
193
212
|
}
|
|
194
|
-
else {
|
|
195
|
-
throw new Error('Protocol error: required field "peers" was not found in object');
|
|
196
|
-
}
|
|
197
213
|
if (obj.pubsub != null) {
|
|
198
|
-
|
|
199
|
-
PSResponse.codec().encode(obj.pubsub,
|
|
214
|
+
w.uint32(58);
|
|
215
|
+
PSResponse.codec().encode(obj.pubsub, w, {
|
|
216
|
+
writeDefaults: false
|
|
217
|
+
});
|
|
200
218
|
}
|
|
201
219
|
if (obj.peerStore != null) {
|
|
202
|
-
|
|
203
|
-
PeerstoreResponse.codec().encode(obj.peerStore,
|
|
220
|
+
w.uint32(66);
|
|
221
|
+
PeerstoreResponse.codec().encode(obj.peerStore, w, {
|
|
222
|
+
writeDefaults: false
|
|
223
|
+
});
|
|
204
224
|
}
|
|
205
225
|
if (opts.lengthDelimited !== false) {
|
|
206
|
-
|
|
226
|
+
w.ldelim();
|
|
207
227
|
}
|
|
208
228
|
}, (reader, length) => {
|
|
209
229
|
const obj = {
|
|
@@ -243,9 +263,6 @@ export var Response;
|
|
|
243
263
|
break;
|
|
244
264
|
}
|
|
245
265
|
}
|
|
246
|
-
if (obj.type == null) {
|
|
247
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
248
|
-
}
|
|
249
266
|
return obj;
|
|
250
267
|
});
|
|
251
268
|
}
|
|
@@ -263,28 +280,22 @@ export var IdentifyResponse;
|
|
|
263
280
|
let _codec;
|
|
264
281
|
IdentifyResponse.codec = () => {
|
|
265
282
|
if (_codec == null) {
|
|
266
|
-
_codec = message((obj,
|
|
283
|
+
_codec = message((obj, w, opts = {}) => {
|
|
267
284
|
if (opts.lengthDelimited !== false) {
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
if (obj.id != null) {
|
|
271
|
-
writer.uint32(10);
|
|
272
|
-
writer.bytes(obj.id);
|
|
285
|
+
w.fork();
|
|
273
286
|
}
|
|
274
|
-
|
|
275
|
-
|
|
287
|
+
if (opts.writeDefaults === true || (obj.id != null && obj.id.byteLength > 0)) {
|
|
288
|
+
w.uint32(10);
|
|
289
|
+
w.bytes(obj.id);
|
|
276
290
|
}
|
|
277
291
|
if (obj.addrs != null) {
|
|
278
292
|
for (const value of obj.addrs) {
|
|
279
|
-
|
|
280
|
-
|
|
293
|
+
w.uint32(18);
|
|
294
|
+
w.bytes(value);
|
|
281
295
|
}
|
|
282
296
|
}
|
|
283
|
-
else {
|
|
284
|
-
throw new Error('Protocol error: required field "addrs" was not found in object');
|
|
285
|
-
}
|
|
286
297
|
if (opts.lengthDelimited !== false) {
|
|
287
|
-
|
|
298
|
+
w.ldelim();
|
|
288
299
|
}
|
|
289
300
|
}, (reader, length) => {
|
|
290
301
|
const obj = {
|
|
@@ -306,9 +317,6 @@ export var IdentifyResponse;
|
|
|
306
317
|
break;
|
|
307
318
|
}
|
|
308
319
|
}
|
|
309
|
-
if (obj.id == null) {
|
|
310
|
-
throw new Error('Protocol error: value for required field "id" was not found in protobuf');
|
|
311
|
-
}
|
|
312
320
|
return obj;
|
|
313
321
|
});
|
|
314
322
|
}
|
|
@@ -326,32 +334,26 @@ export var ConnectRequest;
|
|
|
326
334
|
let _codec;
|
|
327
335
|
ConnectRequest.codec = () => {
|
|
328
336
|
if (_codec == null) {
|
|
329
|
-
_codec = message((obj,
|
|
337
|
+
_codec = message((obj, w, opts = {}) => {
|
|
330
338
|
if (opts.lengthDelimited !== false) {
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
if (obj.peer != null) {
|
|
334
|
-
writer.uint32(10);
|
|
335
|
-
writer.bytes(obj.peer);
|
|
339
|
+
w.fork();
|
|
336
340
|
}
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
342
|
+
w.uint32(10);
|
|
343
|
+
w.bytes(obj.peer);
|
|
339
344
|
}
|
|
340
345
|
if (obj.addrs != null) {
|
|
341
346
|
for (const value of obj.addrs) {
|
|
342
|
-
|
|
343
|
-
|
|
347
|
+
w.uint32(18);
|
|
348
|
+
w.bytes(value);
|
|
344
349
|
}
|
|
345
350
|
}
|
|
346
|
-
else {
|
|
347
|
-
throw new Error('Protocol error: required field "addrs" was not found in object');
|
|
348
|
-
}
|
|
349
351
|
if (obj.timeout != null) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
w.uint32(24);
|
|
353
|
+
w.int64(obj.timeout);
|
|
352
354
|
}
|
|
353
355
|
if (opts.lengthDelimited !== false) {
|
|
354
|
-
|
|
356
|
+
w.ldelim();
|
|
355
357
|
}
|
|
356
358
|
}, (reader, length) => {
|
|
357
359
|
const obj = {
|
|
@@ -376,9 +378,6 @@ export var ConnectRequest;
|
|
|
376
378
|
break;
|
|
377
379
|
}
|
|
378
380
|
}
|
|
379
|
-
if (obj.peer == null) {
|
|
380
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
381
|
-
}
|
|
382
381
|
return obj;
|
|
383
382
|
});
|
|
384
383
|
}
|
|
@@ -396,32 +395,26 @@ export var StreamOpenRequest;
|
|
|
396
395
|
let _codec;
|
|
397
396
|
StreamOpenRequest.codec = () => {
|
|
398
397
|
if (_codec == null) {
|
|
399
|
-
_codec = message((obj,
|
|
398
|
+
_codec = message((obj, w, opts = {}) => {
|
|
400
399
|
if (opts.lengthDelimited !== false) {
|
|
401
|
-
|
|
400
|
+
w.fork();
|
|
402
401
|
}
|
|
403
|
-
if (obj.peer != null) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
else {
|
|
408
|
-
throw new Error('Protocol error: required field "peer" was not found in object');
|
|
402
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
403
|
+
w.uint32(10);
|
|
404
|
+
w.bytes(obj.peer);
|
|
409
405
|
}
|
|
410
406
|
if (obj.proto != null) {
|
|
411
407
|
for (const value of obj.proto) {
|
|
412
|
-
|
|
413
|
-
|
|
408
|
+
w.uint32(18);
|
|
409
|
+
w.string(value);
|
|
414
410
|
}
|
|
415
411
|
}
|
|
416
|
-
else {
|
|
417
|
-
throw new Error('Protocol error: required field "proto" was not found in object');
|
|
418
|
-
}
|
|
419
412
|
if (obj.timeout != null) {
|
|
420
|
-
|
|
421
|
-
|
|
413
|
+
w.uint32(24);
|
|
414
|
+
w.int64(obj.timeout);
|
|
422
415
|
}
|
|
423
416
|
if (opts.lengthDelimited !== false) {
|
|
424
|
-
|
|
417
|
+
w.ldelim();
|
|
425
418
|
}
|
|
426
419
|
}, (reader, length) => {
|
|
427
420
|
const obj = {
|
|
@@ -446,9 +439,6 @@ export var StreamOpenRequest;
|
|
|
446
439
|
break;
|
|
447
440
|
}
|
|
448
441
|
}
|
|
449
|
-
if (obj.peer == null) {
|
|
450
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
451
|
-
}
|
|
452
442
|
return obj;
|
|
453
443
|
});
|
|
454
444
|
}
|
|
@@ -466,28 +456,22 @@ export var StreamHandlerRequest;
|
|
|
466
456
|
let _codec;
|
|
467
457
|
StreamHandlerRequest.codec = () => {
|
|
468
458
|
if (_codec == null) {
|
|
469
|
-
_codec = message((obj,
|
|
459
|
+
_codec = message((obj, w, opts = {}) => {
|
|
470
460
|
if (opts.lengthDelimited !== false) {
|
|
471
|
-
|
|
461
|
+
w.fork();
|
|
472
462
|
}
|
|
473
|
-
if (obj.addr != null) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
throw new Error('Protocol error: required field "addr" was not found in object');
|
|
463
|
+
if (opts.writeDefaults === true || (obj.addr != null && obj.addr.byteLength > 0)) {
|
|
464
|
+
w.uint32(10);
|
|
465
|
+
w.bytes(obj.addr);
|
|
479
466
|
}
|
|
480
467
|
if (obj.proto != null) {
|
|
481
468
|
for (const value of obj.proto) {
|
|
482
|
-
|
|
483
|
-
|
|
469
|
+
w.uint32(18);
|
|
470
|
+
w.string(value);
|
|
484
471
|
}
|
|
485
472
|
}
|
|
486
|
-
else {
|
|
487
|
-
throw new Error('Protocol error: required field "proto" was not found in object');
|
|
488
|
-
}
|
|
489
473
|
if (opts.lengthDelimited !== false) {
|
|
490
|
-
|
|
474
|
+
w.ldelim();
|
|
491
475
|
}
|
|
492
476
|
}, (reader, length) => {
|
|
493
477
|
const obj = {
|
|
@@ -509,9 +493,6 @@ export var StreamHandlerRequest;
|
|
|
509
493
|
break;
|
|
510
494
|
}
|
|
511
495
|
}
|
|
512
|
-
if (obj.addr == null) {
|
|
513
|
-
throw new Error('Protocol error: value for required field "addr" was not found in protobuf');
|
|
514
|
-
}
|
|
515
496
|
return obj;
|
|
516
497
|
});
|
|
517
498
|
}
|
|
@@ -529,19 +510,16 @@ export var ErrorResponse;
|
|
|
529
510
|
let _codec;
|
|
530
511
|
ErrorResponse.codec = () => {
|
|
531
512
|
if (_codec == null) {
|
|
532
|
-
_codec = message((obj,
|
|
513
|
+
_codec = message((obj, w, opts = {}) => {
|
|
533
514
|
if (opts.lengthDelimited !== false) {
|
|
534
|
-
|
|
515
|
+
w.fork();
|
|
535
516
|
}
|
|
536
|
-
if (obj.msg
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
throw new Error('Protocol error: required field "msg" was not found in object');
|
|
517
|
+
if (opts.writeDefaults === true || obj.msg !== '') {
|
|
518
|
+
w.uint32(10);
|
|
519
|
+
w.string(obj.msg);
|
|
542
520
|
}
|
|
543
521
|
if (opts.lengthDelimited !== false) {
|
|
544
|
-
|
|
522
|
+
w.ldelim();
|
|
545
523
|
}
|
|
546
524
|
}, (reader, length) => {
|
|
547
525
|
const obj = {
|
|
@@ -559,9 +537,6 @@ export var ErrorResponse;
|
|
|
559
537
|
break;
|
|
560
538
|
}
|
|
561
539
|
}
|
|
562
|
-
if (obj.msg == null) {
|
|
563
|
-
throw new Error('Protocol error: value for required field "msg" was not found in protobuf');
|
|
564
|
-
}
|
|
565
540
|
return obj;
|
|
566
541
|
});
|
|
567
542
|
}
|
|
@@ -579,33 +554,24 @@ export var StreamInfo;
|
|
|
579
554
|
let _codec;
|
|
580
555
|
StreamInfo.codec = () => {
|
|
581
556
|
if (_codec == null) {
|
|
582
|
-
_codec = message((obj,
|
|
557
|
+
_codec = message((obj, w, opts = {}) => {
|
|
583
558
|
if (opts.lengthDelimited !== false) {
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
if (obj.peer != null) {
|
|
587
|
-
writer.uint32(10);
|
|
588
|
-
writer.bytes(obj.peer);
|
|
589
|
-
}
|
|
590
|
-
else {
|
|
591
|
-
throw new Error('Protocol error: required field "peer" was not found in object');
|
|
592
|
-
}
|
|
593
|
-
if (obj.addr != null) {
|
|
594
|
-
writer.uint32(18);
|
|
595
|
-
writer.bytes(obj.addr);
|
|
559
|
+
w.fork();
|
|
596
560
|
}
|
|
597
|
-
|
|
598
|
-
|
|
561
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
562
|
+
w.uint32(10);
|
|
563
|
+
w.bytes(obj.peer);
|
|
599
564
|
}
|
|
600
|
-
if (obj.
|
|
601
|
-
|
|
602
|
-
|
|
565
|
+
if (opts.writeDefaults === true || (obj.addr != null && obj.addr.byteLength > 0)) {
|
|
566
|
+
w.uint32(18);
|
|
567
|
+
w.bytes(obj.addr);
|
|
603
568
|
}
|
|
604
|
-
|
|
605
|
-
|
|
569
|
+
if (opts.writeDefaults === true || obj.proto !== '') {
|
|
570
|
+
w.uint32(26);
|
|
571
|
+
w.string(obj.proto);
|
|
606
572
|
}
|
|
607
573
|
if (opts.lengthDelimited !== false) {
|
|
608
|
-
|
|
574
|
+
w.ldelim();
|
|
609
575
|
}
|
|
610
576
|
}, (reader, length) => {
|
|
611
577
|
const obj = {
|
|
@@ -631,15 +597,6 @@ export var StreamInfo;
|
|
|
631
597
|
break;
|
|
632
598
|
}
|
|
633
599
|
}
|
|
634
|
-
if (obj.peer == null) {
|
|
635
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
636
|
-
}
|
|
637
|
-
if (obj.addr == null) {
|
|
638
|
-
throw new Error('Protocol error: value for required field "addr" was not found in protobuf');
|
|
639
|
-
}
|
|
640
|
-
if (obj.proto == null) {
|
|
641
|
-
throw new Error('Protocol error: value for required field "proto" was not found in protobuf');
|
|
642
|
-
}
|
|
643
600
|
return obj;
|
|
644
601
|
});
|
|
645
602
|
}
|
|
@@ -686,43 +643,40 @@ export var DHTRequest;
|
|
|
686
643
|
let _codec;
|
|
687
644
|
DHTRequest.codec = () => {
|
|
688
645
|
if (_codec == null) {
|
|
689
|
-
_codec = message((obj,
|
|
646
|
+
_codec = message((obj, w, opts = {}) => {
|
|
690
647
|
if (opts.lengthDelimited !== false) {
|
|
691
|
-
|
|
648
|
+
w.fork();
|
|
692
649
|
}
|
|
693
|
-
if (obj.type != null) {
|
|
694
|
-
|
|
695
|
-
DHTRequest.Type.codec().encode(obj.type,
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
650
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
651
|
+
w.uint32(8);
|
|
652
|
+
DHTRequest.Type.codec().encode(obj.type, w);
|
|
699
653
|
}
|
|
700
654
|
if (obj.peer != null) {
|
|
701
|
-
|
|
702
|
-
|
|
655
|
+
w.uint32(18);
|
|
656
|
+
w.bytes(obj.peer);
|
|
703
657
|
}
|
|
704
658
|
if (obj.cid != null) {
|
|
705
|
-
|
|
706
|
-
|
|
659
|
+
w.uint32(26);
|
|
660
|
+
w.bytes(obj.cid);
|
|
707
661
|
}
|
|
708
662
|
if (obj.key != null) {
|
|
709
|
-
|
|
710
|
-
|
|
663
|
+
w.uint32(34);
|
|
664
|
+
w.bytes(obj.key);
|
|
711
665
|
}
|
|
712
666
|
if (obj.value != null) {
|
|
713
|
-
|
|
714
|
-
|
|
667
|
+
w.uint32(42);
|
|
668
|
+
w.bytes(obj.value);
|
|
715
669
|
}
|
|
716
670
|
if (obj.count != null) {
|
|
717
|
-
|
|
718
|
-
|
|
671
|
+
w.uint32(48);
|
|
672
|
+
w.int32(obj.count);
|
|
719
673
|
}
|
|
720
674
|
if (obj.timeout != null) {
|
|
721
|
-
|
|
722
|
-
|
|
675
|
+
w.uint32(56);
|
|
676
|
+
w.int64(obj.timeout);
|
|
723
677
|
}
|
|
724
678
|
if (opts.lengthDelimited !== false) {
|
|
725
|
-
|
|
679
|
+
w.ldelim();
|
|
726
680
|
}
|
|
727
681
|
}, (reader, length) => {
|
|
728
682
|
const obj = {
|
|
@@ -758,9 +712,6 @@ export var DHTRequest;
|
|
|
758
712
|
break;
|
|
759
713
|
}
|
|
760
714
|
}
|
|
761
|
-
if (obj.type == null) {
|
|
762
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
763
|
-
}
|
|
764
715
|
return obj;
|
|
765
716
|
});
|
|
766
717
|
}
|
|
@@ -795,27 +746,26 @@ export var DHTResponse;
|
|
|
795
746
|
let _codec;
|
|
796
747
|
DHTResponse.codec = () => {
|
|
797
748
|
if (_codec == null) {
|
|
798
|
-
_codec = message((obj,
|
|
749
|
+
_codec = message((obj, w, opts = {}) => {
|
|
799
750
|
if (opts.lengthDelimited !== false) {
|
|
800
|
-
|
|
801
|
-
}
|
|
802
|
-
if (obj.type != null) {
|
|
803
|
-
writer.uint32(8);
|
|
804
|
-
DHTResponse.Type.codec().encode(obj.type, writer);
|
|
751
|
+
w.fork();
|
|
805
752
|
}
|
|
806
|
-
|
|
807
|
-
|
|
753
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
754
|
+
w.uint32(8);
|
|
755
|
+
DHTResponse.Type.codec().encode(obj.type, w);
|
|
808
756
|
}
|
|
809
757
|
if (obj.peer != null) {
|
|
810
|
-
|
|
811
|
-
PeerInfo.codec().encode(obj.peer,
|
|
758
|
+
w.uint32(18);
|
|
759
|
+
PeerInfo.codec().encode(obj.peer, w, {
|
|
760
|
+
writeDefaults: false
|
|
761
|
+
});
|
|
812
762
|
}
|
|
813
763
|
if (obj.value != null) {
|
|
814
|
-
|
|
815
|
-
|
|
764
|
+
w.uint32(26);
|
|
765
|
+
w.bytes(obj.value);
|
|
816
766
|
}
|
|
817
767
|
if (opts.lengthDelimited !== false) {
|
|
818
|
-
|
|
768
|
+
w.ldelim();
|
|
819
769
|
}
|
|
820
770
|
}, (reader, length) => {
|
|
821
771
|
const obj = {
|
|
@@ -839,9 +789,6 @@ export var DHTResponse;
|
|
|
839
789
|
break;
|
|
840
790
|
}
|
|
841
791
|
}
|
|
842
|
-
if (obj.type == null) {
|
|
843
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
844
|
-
}
|
|
845
792
|
return obj;
|
|
846
793
|
});
|
|
847
794
|
}
|
|
@@ -859,28 +806,22 @@ export var PeerInfo;
|
|
|
859
806
|
let _codec;
|
|
860
807
|
PeerInfo.codec = () => {
|
|
861
808
|
if (_codec == null) {
|
|
862
|
-
_codec = message((obj,
|
|
809
|
+
_codec = message((obj, w, opts = {}) => {
|
|
863
810
|
if (opts.lengthDelimited !== false) {
|
|
864
|
-
|
|
865
|
-
}
|
|
866
|
-
if (obj.id != null) {
|
|
867
|
-
writer.uint32(10);
|
|
868
|
-
writer.bytes(obj.id);
|
|
811
|
+
w.fork();
|
|
869
812
|
}
|
|
870
|
-
|
|
871
|
-
|
|
813
|
+
if (opts.writeDefaults === true || (obj.id != null && obj.id.byteLength > 0)) {
|
|
814
|
+
w.uint32(10);
|
|
815
|
+
w.bytes(obj.id);
|
|
872
816
|
}
|
|
873
817
|
if (obj.addrs != null) {
|
|
874
818
|
for (const value of obj.addrs) {
|
|
875
|
-
|
|
876
|
-
|
|
819
|
+
w.uint32(18);
|
|
820
|
+
w.bytes(value);
|
|
877
821
|
}
|
|
878
822
|
}
|
|
879
|
-
else {
|
|
880
|
-
throw new Error('Protocol error: required field "addrs" was not found in object');
|
|
881
|
-
}
|
|
882
823
|
if (opts.lengthDelimited !== false) {
|
|
883
|
-
|
|
824
|
+
w.ldelim();
|
|
884
825
|
}
|
|
885
826
|
}, (reader, length) => {
|
|
886
827
|
const obj = {
|
|
@@ -902,9 +843,6 @@ export var PeerInfo;
|
|
|
902
843
|
break;
|
|
903
844
|
}
|
|
904
845
|
}
|
|
905
|
-
if (obj.id == null) {
|
|
906
|
-
throw new Error('Protocol error: value for required field "id" was not found in protobuf');
|
|
907
|
-
}
|
|
908
846
|
return obj;
|
|
909
847
|
});
|
|
910
848
|
}
|
|
@@ -939,31 +877,28 @@ export var ConnManagerRequest;
|
|
|
939
877
|
let _codec;
|
|
940
878
|
ConnManagerRequest.codec = () => {
|
|
941
879
|
if (_codec == null) {
|
|
942
|
-
_codec = message((obj,
|
|
880
|
+
_codec = message((obj, w, opts = {}) => {
|
|
943
881
|
if (opts.lengthDelimited !== false) {
|
|
944
|
-
|
|
945
|
-
}
|
|
946
|
-
if (obj.type != null) {
|
|
947
|
-
writer.uint32(8);
|
|
948
|
-
ConnManagerRequest.Type.codec().encode(obj.type, writer);
|
|
882
|
+
w.fork();
|
|
949
883
|
}
|
|
950
|
-
|
|
951
|
-
|
|
884
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
885
|
+
w.uint32(8);
|
|
886
|
+
ConnManagerRequest.Type.codec().encode(obj.type, w);
|
|
952
887
|
}
|
|
953
888
|
if (obj.peer != null) {
|
|
954
|
-
|
|
955
|
-
|
|
889
|
+
w.uint32(18);
|
|
890
|
+
w.bytes(obj.peer);
|
|
956
891
|
}
|
|
957
892
|
if (obj.tag != null) {
|
|
958
|
-
|
|
959
|
-
|
|
893
|
+
w.uint32(26);
|
|
894
|
+
w.string(obj.tag);
|
|
960
895
|
}
|
|
961
896
|
if (obj.weight != null) {
|
|
962
|
-
|
|
963
|
-
|
|
897
|
+
w.uint32(32);
|
|
898
|
+
w.int64(obj.weight);
|
|
964
899
|
}
|
|
965
900
|
if (opts.lengthDelimited !== false) {
|
|
966
|
-
|
|
901
|
+
w.ldelim();
|
|
967
902
|
}
|
|
968
903
|
}, (reader, length) => {
|
|
969
904
|
const obj = {
|
|
@@ -990,9 +925,6 @@ export var ConnManagerRequest;
|
|
|
990
925
|
break;
|
|
991
926
|
}
|
|
992
927
|
}
|
|
993
|
-
if (obj.type == null) {
|
|
994
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
995
|
-
}
|
|
996
928
|
return obj;
|
|
997
929
|
});
|
|
998
930
|
}
|
|
@@ -1010,19 +942,16 @@ export var DisconnectRequest;
|
|
|
1010
942
|
let _codec;
|
|
1011
943
|
DisconnectRequest.codec = () => {
|
|
1012
944
|
if (_codec == null) {
|
|
1013
|
-
_codec = message((obj,
|
|
945
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1014
946
|
if (opts.lengthDelimited !== false) {
|
|
1015
|
-
|
|
1016
|
-
}
|
|
1017
|
-
if (obj.peer != null) {
|
|
1018
|
-
writer.uint32(10);
|
|
1019
|
-
writer.bytes(obj.peer);
|
|
947
|
+
w.fork();
|
|
1020
948
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
949
|
+
if (opts.writeDefaults === true || (obj.peer != null && obj.peer.byteLength > 0)) {
|
|
950
|
+
w.uint32(10);
|
|
951
|
+
w.bytes(obj.peer);
|
|
1023
952
|
}
|
|
1024
953
|
if (opts.lengthDelimited !== false) {
|
|
1025
|
-
|
|
954
|
+
w.ldelim();
|
|
1026
955
|
}
|
|
1027
956
|
}, (reader, length) => {
|
|
1028
957
|
const obj = {
|
|
@@ -1040,9 +969,6 @@ export var DisconnectRequest;
|
|
|
1040
969
|
break;
|
|
1041
970
|
}
|
|
1042
971
|
}
|
|
1043
|
-
if (obj.peer == null) {
|
|
1044
|
-
throw new Error('Protocol error: value for required field "peer" was not found in protobuf');
|
|
1045
|
-
}
|
|
1046
972
|
return obj;
|
|
1047
973
|
});
|
|
1048
974
|
}
|
|
@@ -1079,27 +1005,24 @@ export var PSRequest;
|
|
|
1079
1005
|
let _codec;
|
|
1080
1006
|
PSRequest.codec = () => {
|
|
1081
1007
|
if (_codec == null) {
|
|
1082
|
-
_codec = message((obj,
|
|
1008
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1083
1009
|
if (opts.lengthDelimited !== false) {
|
|
1084
|
-
|
|
1010
|
+
w.fork();
|
|
1085
1011
|
}
|
|
1086
|
-
if (obj.type != null) {
|
|
1087
|
-
|
|
1088
|
-
PSRequest.Type.codec().encode(obj.type,
|
|
1089
|
-
}
|
|
1090
|
-
else {
|
|
1091
|
-
throw new Error('Protocol error: required field "type" was not found in object');
|
|
1012
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
1013
|
+
w.uint32(8);
|
|
1014
|
+
PSRequest.Type.codec().encode(obj.type, w);
|
|
1092
1015
|
}
|
|
1093
1016
|
if (obj.topic != null) {
|
|
1094
|
-
|
|
1095
|
-
|
|
1017
|
+
w.uint32(18);
|
|
1018
|
+
w.string(obj.topic);
|
|
1096
1019
|
}
|
|
1097
1020
|
if (obj.data != null) {
|
|
1098
|
-
|
|
1099
|
-
|
|
1021
|
+
w.uint32(26);
|
|
1022
|
+
w.bytes(obj.data);
|
|
1100
1023
|
}
|
|
1101
1024
|
if (opts.lengthDelimited !== false) {
|
|
1102
|
-
|
|
1025
|
+
w.ldelim();
|
|
1103
1026
|
}
|
|
1104
1027
|
}, (reader, length) => {
|
|
1105
1028
|
const obj = {
|
|
@@ -1123,9 +1046,6 @@ export var PSRequest;
|
|
|
1123
1046
|
break;
|
|
1124
1047
|
}
|
|
1125
1048
|
}
|
|
1126
|
-
if (obj.type == null) {
|
|
1127
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
1128
|
-
}
|
|
1129
1049
|
return obj;
|
|
1130
1050
|
});
|
|
1131
1051
|
}
|
|
@@ -1143,41 +1063,38 @@ export var PSMessage;
|
|
|
1143
1063
|
let _codec;
|
|
1144
1064
|
PSMessage.codec = () => {
|
|
1145
1065
|
if (_codec == null) {
|
|
1146
|
-
_codec = message((obj,
|
|
1066
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1147
1067
|
if (opts.lengthDelimited !== false) {
|
|
1148
|
-
|
|
1068
|
+
w.fork();
|
|
1149
1069
|
}
|
|
1150
1070
|
if (obj.from != null) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1071
|
+
w.uint32(10);
|
|
1072
|
+
w.bytes(obj.from);
|
|
1153
1073
|
}
|
|
1154
1074
|
if (obj.data != null) {
|
|
1155
|
-
|
|
1156
|
-
|
|
1075
|
+
w.uint32(18);
|
|
1076
|
+
w.bytes(obj.data);
|
|
1157
1077
|
}
|
|
1158
1078
|
if (obj.seqno != null) {
|
|
1159
|
-
|
|
1160
|
-
|
|
1079
|
+
w.uint32(26);
|
|
1080
|
+
w.bytes(obj.seqno);
|
|
1161
1081
|
}
|
|
1162
1082
|
if (obj.topicIDs != null) {
|
|
1163
1083
|
for (const value of obj.topicIDs) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1084
|
+
w.uint32(34);
|
|
1085
|
+
w.string(value);
|
|
1166
1086
|
}
|
|
1167
1087
|
}
|
|
1168
|
-
else {
|
|
1169
|
-
throw new Error('Protocol error: required field "topicIDs" was not found in object');
|
|
1170
|
-
}
|
|
1171
1088
|
if (obj.signature != null) {
|
|
1172
|
-
|
|
1173
|
-
|
|
1089
|
+
w.uint32(42);
|
|
1090
|
+
w.bytes(obj.signature);
|
|
1174
1091
|
}
|
|
1175
1092
|
if (obj.key != null) {
|
|
1176
|
-
|
|
1177
|
-
|
|
1093
|
+
w.uint32(50);
|
|
1094
|
+
w.bytes(obj.key);
|
|
1178
1095
|
}
|
|
1179
1096
|
if (opts.lengthDelimited !== false) {
|
|
1180
|
-
|
|
1097
|
+
w.ldelim();
|
|
1181
1098
|
}
|
|
1182
1099
|
}, (reader, length) => {
|
|
1183
1100
|
const obj = {
|
|
@@ -1227,30 +1144,24 @@ export var PSResponse;
|
|
|
1227
1144
|
let _codec;
|
|
1228
1145
|
PSResponse.codec = () => {
|
|
1229
1146
|
if (_codec == null) {
|
|
1230
|
-
_codec = message((obj,
|
|
1147
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1231
1148
|
if (opts.lengthDelimited !== false) {
|
|
1232
|
-
|
|
1149
|
+
w.fork();
|
|
1233
1150
|
}
|
|
1234
1151
|
if (obj.topics != null) {
|
|
1235
1152
|
for (const value of obj.topics) {
|
|
1236
|
-
|
|
1237
|
-
|
|
1153
|
+
w.uint32(10);
|
|
1154
|
+
w.string(value);
|
|
1238
1155
|
}
|
|
1239
1156
|
}
|
|
1240
|
-
else {
|
|
1241
|
-
throw new Error('Protocol error: required field "topics" was not found in object');
|
|
1242
|
-
}
|
|
1243
1157
|
if (obj.peerIDs != null) {
|
|
1244
1158
|
for (const value of obj.peerIDs) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1159
|
+
w.uint32(18);
|
|
1160
|
+
w.bytes(value);
|
|
1247
1161
|
}
|
|
1248
1162
|
}
|
|
1249
|
-
else {
|
|
1250
|
-
throw new Error('Protocol error: required field "peerIDs" was not found in object');
|
|
1251
|
-
}
|
|
1252
1163
|
if (opts.lengthDelimited !== false) {
|
|
1253
|
-
|
|
1164
|
+
w.ldelim();
|
|
1254
1165
|
}
|
|
1255
1166
|
}, (reader, length) => {
|
|
1256
1167
|
const obj = {
|
|
@@ -1306,32 +1217,26 @@ export var PeerstoreRequest;
|
|
|
1306
1217
|
let _codec;
|
|
1307
1218
|
PeerstoreRequest.codec = () => {
|
|
1308
1219
|
if (_codec == null) {
|
|
1309
|
-
_codec = message((obj,
|
|
1220
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1310
1221
|
if (opts.lengthDelimited !== false) {
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
if (obj.type != null) {
|
|
1314
|
-
writer.uint32(8);
|
|
1315
|
-
PeerstoreRequest.Type.codec().encode(obj.type, writer);
|
|
1222
|
+
w.fork();
|
|
1316
1223
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1224
|
+
if (opts.writeDefaults === true || (obj.type != null && __TypeValues[obj.type] !== 0)) {
|
|
1225
|
+
w.uint32(8);
|
|
1226
|
+
PeerstoreRequest.Type.codec().encode(obj.type, w);
|
|
1319
1227
|
}
|
|
1320
1228
|
if (obj.id != null) {
|
|
1321
|
-
|
|
1322
|
-
|
|
1229
|
+
w.uint32(18);
|
|
1230
|
+
w.bytes(obj.id);
|
|
1323
1231
|
}
|
|
1324
1232
|
if (obj.protos != null) {
|
|
1325
1233
|
for (const value of obj.protos) {
|
|
1326
|
-
|
|
1327
|
-
|
|
1234
|
+
w.uint32(26);
|
|
1235
|
+
w.string(value);
|
|
1328
1236
|
}
|
|
1329
1237
|
}
|
|
1330
|
-
else {
|
|
1331
|
-
throw new Error('Protocol error: required field "protos" was not found in object');
|
|
1332
|
-
}
|
|
1333
1238
|
if (opts.lengthDelimited !== false) {
|
|
1334
|
-
|
|
1239
|
+
w.ldelim();
|
|
1335
1240
|
}
|
|
1336
1241
|
}, (reader, length) => {
|
|
1337
1242
|
const obj = {
|
|
@@ -1356,9 +1261,6 @@ export var PeerstoreRequest;
|
|
|
1356
1261
|
break;
|
|
1357
1262
|
}
|
|
1358
1263
|
}
|
|
1359
|
-
if (obj.type == null) {
|
|
1360
|
-
throw new Error('Protocol error: value for required field "type" was not found in protobuf');
|
|
1361
|
-
}
|
|
1362
1264
|
return obj;
|
|
1363
1265
|
});
|
|
1364
1266
|
}
|
|
@@ -1376,25 +1278,24 @@ export var PeerstoreResponse;
|
|
|
1376
1278
|
let _codec;
|
|
1377
1279
|
PeerstoreResponse.codec = () => {
|
|
1378
1280
|
if (_codec == null) {
|
|
1379
|
-
_codec = message((obj,
|
|
1281
|
+
_codec = message((obj, w, opts = {}) => {
|
|
1380
1282
|
if (opts.lengthDelimited !== false) {
|
|
1381
|
-
|
|
1283
|
+
w.fork();
|
|
1382
1284
|
}
|
|
1383
1285
|
if (obj.peer != null) {
|
|
1384
|
-
|
|
1385
|
-
PeerInfo.codec().encode(obj.peer,
|
|
1286
|
+
w.uint32(10);
|
|
1287
|
+
PeerInfo.codec().encode(obj.peer, w, {
|
|
1288
|
+
writeDefaults: false
|
|
1289
|
+
});
|
|
1386
1290
|
}
|
|
1387
1291
|
if (obj.protos != null) {
|
|
1388
1292
|
for (const value of obj.protos) {
|
|
1389
|
-
|
|
1390
|
-
|
|
1293
|
+
w.uint32(18);
|
|
1294
|
+
w.string(value);
|
|
1391
1295
|
}
|
|
1392
1296
|
}
|
|
1393
|
-
else {
|
|
1394
|
-
throw new Error('Protocol error: required field "protos" was not found in object');
|
|
1395
|
-
}
|
|
1396
1297
|
if (opts.lengthDelimited !== false) {
|
|
1397
|
-
|
|
1298
|
+
w.ldelim();
|
|
1398
1299
|
}
|
|
1399
1300
|
}, (reader, length) => {
|
|
1400
1301
|
const obj = {
|