@libp2p/peer-store 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/pb/peer.d.ts +4 -4
- package/dist/src/pb/peer.d.ts.map +1 -1
- package/dist/src/pb/peer.js +178 -16
- package/dist/src/pb/peer.js.map +1 -1
- package/dist/src/pb/tags.d.ts +3 -3
- package/dist/src/pb/tags.d.ts.map +1 -1
- package/dist/src/pb/tags.js +92 -9
- package/dist/src/pb/tags.js.map +1 -1
- package/package.json +4 -4
- package/src/pb/peer.ts +209 -20
- package/src/pb/tags.ts +112 -12
package/dist/src/pb/peer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Codec } from 'protons-runtime';
|
|
2
1
|
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
2
|
+
import type { Codec } from 'protons-runtime';
|
|
3
3
|
export interface Peer {
|
|
4
4
|
addresses: Address[];
|
|
5
5
|
protocols: string[];
|
|
@@ -9,7 +9,7 @@ export interface Peer {
|
|
|
9
9
|
}
|
|
10
10
|
export declare namespace Peer {
|
|
11
11
|
const codec: () => Codec<Peer>;
|
|
12
|
-
const encode: (obj: Peer) =>
|
|
12
|
+
const encode: (obj: Peer) => Uint8Array;
|
|
13
13
|
const decode: (buf: Uint8Array | Uint8ArrayList) => Peer;
|
|
14
14
|
}
|
|
15
15
|
export interface Address {
|
|
@@ -18,7 +18,7 @@ export interface Address {
|
|
|
18
18
|
}
|
|
19
19
|
export declare namespace Address {
|
|
20
20
|
const codec: () => Codec<Address>;
|
|
21
|
-
const encode: (obj: Address) =>
|
|
21
|
+
const encode: (obj: Address) => Uint8Array;
|
|
22
22
|
const decode: (buf: Uint8Array | Uint8ArrayList) => Address;
|
|
23
23
|
}
|
|
24
24
|
export interface Metadata {
|
|
@@ -27,7 +27,7 @@ export interface Metadata {
|
|
|
27
27
|
}
|
|
28
28
|
export declare namespace Metadata {
|
|
29
29
|
const codec: () => Codec<Metadata>;
|
|
30
|
-
const encode: (obj: Metadata) =>
|
|
30
|
+
const encode: (obj: Metadata) => Uint8Array;
|
|
31
31
|
const decode: (buf: Uint8Array | Uint8ArrayList) => Metadata;
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=peer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../../src/pb/peer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../../src/pb/peer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,IAAI;IACnB,SAAS,EAAE,OAAO,EAAE,CAAA;IACpB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,QAAQ,EAAE,QAAQ,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,kBAAkB,CAAC,EAAE,UAAU,CAAA;CAChC;AAED,yBAAiB,IAAI,CAAC;IAGb,MAAM,KAAK,QAAO,MAAM,IAAI,CAsFlC,CAAA;IAEM,MAAM,MAAM,QAAS,IAAI,KAAG,UAElC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,IAEzD,CAAA;CACF;AAED,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,UAAU,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,yBAAiB,OAAO,CAAC;IAGhB,MAAM,KAAK,QAAO,MAAM,OAAO,CAsDrC,CAAA;IAEM,MAAM,MAAM,QAAS,OAAO,KAAG,UAErC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,OAEzD,CAAA;CACF;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,yBAAiB,QAAQ,CAAC;IAGjB,MAAM,KAAK,QAAO,MAAM,QAAQ,CA6DtC,CAAA;IAEM,MAAM,MAAM,QAAS,QAAQ,KAAG,UAEtC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,QAEzD,CAAA;CACF"}
|
package/dist/src/pb/peer.js
CHANGED
|
@@ -1,16 +1,87 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
|
-
import { encodeMessage, decodeMessage, message
|
|
3
|
+
import { encodeMessage, decodeMessage, message } from 'protons-runtime';
|
|
4
4
|
export var Peer;
|
|
5
5
|
(function (Peer) {
|
|
6
|
+
let _codec;
|
|
6
7
|
Peer.codec = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
if (_codec == null) {
|
|
9
|
+
_codec = message((obj, writer, opts = {}) => {
|
|
10
|
+
if (opts.lengthDelimited !== false) {
|
|
11
|
+
writer.fork();
|
|
12
|
+
}
|
|
13
|
+
if (obj.addresses != null) {
|
|
14
|
+
for (const value of obj.addresses) {
|
|
15
|
+
writer.uint32(10);
|
|
16
|
+
Address.codec().encode(value, writer);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
throw new Error('Protocol error: required field "addresses" was not found in object');
|
|
21
|
+
}
|
|
22
|
+
if (obj.protocols != null) {
|
|
23
|
+
for (const value of obj.protocols) {
|
|
24
|
+
writer.uint32(18);
|
|
25
|
+
writer.string(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error('Protocol error: required field "protocols" was not found in object');
|
|
30
|
+
}
|
|
31
|
+
if (obj.metadata != null) {
|
|
32
|
+
for (const value of obj.metadata) {
|
|
33
|
+
writer.uint32(26);
|
|
34
|
+
Metadata.codec().encode(value, writer);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
throw new Error('Protocol error: required field "metadata" was not found in object');
|
|
39
|
+
}
|
|
40
|
+
if (obj.pubKey != null) {
|
|
41
|
+
writer.uint32(34);
|
|
42
|
+
writer.bytes(obj.pubKey);
|
|
43
|
+
}
|
|
44
|
+
if (obj.peerRecordEnvelope != null) {
|
|
45
|
+
writer.uint32(42);
|
|
46
|
+
writer.bytes(obj.peerRecordEnvelope);
|
|
47
|
+
}
|
|
48
|
+
if (opts.lengthDelimited !== false) {
|
|
49
|
+
writer.ldelim();
|
|
50
|
+
}
|
|
51
|
+
}, (reader, length) => {
|
|
52
|
+
const obj = {
|
|
53
|
+
addresses: [],
|
|
54
|
+
protocols: [],
|
|
55
|
+
metadata: []
|
|
56
|
+
};
|
|
57
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
58
|
+
while (reader.pos < end) {
|
|
59
|
+
const tag = reader.uint32();
|
|
60
|
+
switch (tag >>> 3) {
|
|
61
|
+
case 1:
|
|
62
|
+
obj.addresses.push(Address.codec().decode(reader, reader.uint32()));
|
|
63
|
+
break;
|
|
64
|
+
case 2:
|
|
65
|
+
obj.protocols.push(reader.string());
|
|
66
|
+
break;
|
|
67
|
+
case 3:
|
|
68
|
+
obj.metadata.push(Metadata.codec().decode(reader, reader.uint32()));
|
|
69
|
+
break;
|
|
70
|
+
case 4:
|
|
71
|
+
obj.pubKey = reader.bytes();
|
|
72
|
+
break;
|
|
73
|
+
case 5:
|
|
74
|
+
obj.peerRecordEnvelope = reader.bytes();
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
reader.skipType(tag & 7);
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return obj;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return _codec;
|
|
14
85
|
};
|
|
15
86
|
Peer.encode = (obj) => {
|
|
16
87
|
return encodeMessage(obj, Peer.codec());
|
|
@@ -21,11 +92,53 @@ export var Peer;
|
|
|
21
92
|
})(Peer || (Peer = {}));
|
|
22
93
|
export var Address;
|
|
23
94
|
(function (Address) {
|
|
95
|
+
let _codec;
|
|
24
96
|
Address.codec = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
97
|
+
if (_codec == null) {
|
|
98
|
+
_codec = message((obj, writer, opts = {}) => {
|
|
99
|
+
if (opts.lengthDelimited !== false) {
|
|
100
|
+
writer.fork();
|
|
101
|
+
}
|
|
102
|
+
if (obj.multiaddr != null) {
|
|
103
|
+
writer.uint32(10);
|
|
104
|
+
writer.bytes(obj.multiaddr);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
throw new Error('Protocol error: required field "multiaddr" was not found in object');
|
|
108
|
+
}
|
|
109
|
+
if (obj.isCertified != null) {
|
|
110
|
+
writer.uint32(16);
|
|
111
|
+
writer.bool(obj.isCertified);
|
|
112
|
+
}
|
|
113
|
+
if (opts.lengthDelimited !== false) {
|
|
114
|
+
writer.ldelim();
|
|
115
|
+
}
|
|
116
|
+
}, (reader, length) => {
|
|
117
|
+
const obj = {
|
|
118
|
+
multiaddr: new Uint8Array(0)
|
|
119
|
+
};
|
|
120
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
121
|
+
while (reader.pos < end) {
|
|
122
|
+
const tag = reader.uint32();
|
|
123
|
+
switch (tag >>> 3) {
|
|
124
|
+
case 1:
|
|
125
|
+
obj.multiaddr = reader.bytes();
|
|
126
|
+
break;
|
|
127
|
+
case 2:
|
|
128
|
+
obj.isCertified = reader.bool();
|
|
129
|
+
break;
|
|
130
|
+
default:
|
|
131
|
+
reader.skipType(tag & 7);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (obj.multiaddr == null) {
|
|
136
|
+
throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf');
|
|
137
|
+
}
|
|
138
|
+
return obj;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return _codec;
|
|
29
142
|
};
|
|
30
143
|
Address.encode = (obj) => {
|
|
31
144
|
return encodeMessage(obj, Address.codec());
|
|
@@ -36,11 +149,60 @@ export var Address;
|
|
|
36
149
|
})(Address || (Address = {}));
|
|
37
150
|
export var Metadata;
|
|
38
151
|
(function (Metadata) {
|
|
152
|
+
let _codec;
|
|
39
153
|
Metadata.codec = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
154
|
+
if (_codec == null) {
|
|
155
|
+
_codec = message((obj, writer, opts = {}) => {
|
|
156
|
+
if (opts.lengthDelimited !== false) {
|
|
157
|
+
writer.fork();
|
|
158
|
+
}
|
|
159
|
+
if (obj.key != null) {
|
|
160
|
+
writer.uint32(10);
|
|
161
|
+
writer.string(obj.key);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
throw new Error('Protocol error: required field "key" was not found in object');
|
|
165
|
+
}
|
|
166
|
+
if (obj.value != null) {
|
|
167
|
+
writer.uint32(18);
|
|
168
|
+
writer.bytes(obj.value);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
throw new Error('Protocol error: required field "value" was not found in object');
|
|
172
|
+
}
|
|
173
|
+
if (opts.lengthDelimited !== false) {
|
|
174
|
+
writer.ldelim();
|
|
175
|
+
}
|
|
176
|
+
}, (reader, length) => {
|
|
177
|
+
const obj = {
|
|
178
|
+
key: '',
|
|
179
|
+
value: new Uint8Array(0)
|
|
180
|
+
};
|
|
181
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
182
|
+
while (reader.pos < end) {
|
|
183
|
+
const tag = reader.uint32();
|
|
184
|
+
switch (tag >>> 3) {
|
|
185
|
+
case 1:
|
|
186
|
+
obj.key = reader.string();
|
|
187
|
+
break;
|
|
188
|
+
case 2:
|
|
189
|
+
obj.value = reader.bytes();
|
|
190
|
+
break;
|
|
191
|
+
default:
|
|
192
|
+
reader.skipType(tag & 7);
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (obj.key == null) {
|
|
197
|
+
throw new Error('Protocol error: value for required field "key" was not found in protobuf');
|
|
198
|
+
}
|
|
199
|
+
if (obj.value == null) {
|
|
200
|
+
throw new Error('Protocol error: value for required field "value" was not found in protobuf');
|
|
201
|
+
}
|
|
202
|
+
return obj;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
return _codec;
|
|
44
206
|
};
|
|
45
207
|
Metadata.encode = (obj) => {
|
|
46
208
|
return encodeMessage(obj, Metadata.codec());
|
package/dist/src/pb/peer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../../src/pb/peer.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../../src/pb/peer.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAYvE,MAAM,KAAW,IAAI,CAkGpB;AAlGD,WAAiB,IAAI;IACnB,IAAI,MAAmB,CAAA;IAEV,UAAK,GAAG,GAAgB,EAAE;QACrC,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,OAAO,CAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;gBAChD,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;oBAClC,MAAM,CAAC,IAAI,EAAE,CAAA;iBACd;gBAED,IAAI,GAAG,CAAC,SAAS,IAAI,IAAI,EAAE;oBACzB,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,SAA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AAQ,GAAG,KAAK,CAAC,EAAE;wBACjB,KAAK,CAAC;4BACJ,GAAG,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;4BACzB,MAAK;wBACP,KAAK,CAAC;4BACJ,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;4BAC1B,MAAK;wBACP;4BACE,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;4BACxB,MAAK;qBACR;iBACF;gBAED,IAAI,GAAG,CAAC,GAAG,IAAI,IAAI,EAAE;oBACnB,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAA;iBAC5F;gBAED,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,EAAE;oBACrB,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAA;iBAC9F;gBAED,OAAO,GAAG,CAAA;YACZ,CAAC,CAAC,CAAA;SACH;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAEY,eAAM,GAAG,CAAC,GAAa,EAAc,EAAE;QAClD,OAAO,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;IAEY,eAAM,GAAG,CAAC,GAAgC,EAAY,EAAE;QACnE,OAAO,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IAC7C,CAAC,CAAA;AACH,CAAC,EAzEgB,QAAQ,KAAR,QAAQ,QAyExB"}
|
package/dist/src/pb/tags.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Codec } from 'protons-runtime';
|
|
2
1
|
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
2
|
+
import type { Codec } from 'protons-runtime';
|
|
3
3
|
export interface Tags {
|
|
4
4
|
tags: Tag[];
|
|
5
5
|
}
|
|
6
6
|
export declare namespace Tags {
|
|
7
7
|
const codec: () => Codec<Tags>;
|
|
8
|
-
const encode: (obj: Tags) =>
|
|
8
|
+
const encode: (obj: Tags) => Uint8Array;
|
|
9
9
|
const decode: (buf: Uint8Array | Uint8ArrayList) => Tags;
|
|
10
10
|
}
|
|
11
11
|
export interface Tag {
|
|
@@ -15,7 +15,7 @@ export interface Tag {
|
|
|
15
15
|
}
|
|
16
16
|
export declare namespace Tag {
|
|
17
17
|
const codec: () => Codec<Tag>;
|
|
18
|
-
const encode: (obj: Tag) =>
|
|
18
|
+
const encode: (obj: Tag) => Uint8Array;
|
|
19
19
|
const decode: (buf: Uint8Array | Uint8ArrayList) => Tag;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../../src/pb/tags.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../../src/pb/tags.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,GAAG,EAAE,CAAA;CACZ;AAED,yBAAiB,IAAI,CAAC;IAGb,MAAM,KAAK,QAAO,MAAM,IAAI,CA4ClC,CAAA;IAEM,MAAM,MAAM,QAAS,IAAI,KAAG,UAElC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,IAEzD,CAAA;CACF;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,yBAAiB,GAAG,CAAC;IAGZ,MAAM,KAAK,QAAO,MAAM,GAAG,CA8DjC,CAAA;IAEM,MAAM,MAAM,QAAS,GAAG,KAAG,UAEjC,CAAA;IAEM,MAAM,MAAM,QAAS,UAAU,GAAG,cAAc,KAAG,GAEzD,CAAA;CACF"}
|
package/dist/src/pb/tags.js
CHANGED
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
|
-
import { encodeMessage, decodeMessage, message
|
|
3
|
+
import { encodeMessage, decodeMessage, message } from 'protons-runtime';
|
|
4
4
|
export var Tags;
|
|
5
5
|
(function (Tags) {
|
|
6
|
+
let _codec;
|
|
6
7
|
Tags.codec = () => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (_codec == null) {
|
|
9
|
+
_codec = message((obj, writer, opts = {}) => {
|
|
10
|
+
if (opts.lengthDelimited !== false) {
|
|
11
|
+
writer.fork();
|
|
12
|
+
}
|
|
13
|
+
if (obj.tags != null) {
|
|
14
|
+
for (const value of obj.tags) {
|
|
15
|
+
writer.uint32(10);
|
|
16
|
+
Tag.codec().encode(value, writer);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
throw new Error('Protocol error: required field "tags" was not found in object');
|
|
21
|
+
}
|
|
22
|
+
if (opts.lengthDelimited !== false) {
|
|
23
|
+
writer.ldelim();
|
|
24
|
+
}
|
|
25
|
+
}, (reader, length) => {
|
|
26
|
+
const obj = {
|
|
27
|
+
tags: []
|
|
28
|
+
};
|
|
29
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
30
|
+
while (reader.pos < end) {
|
|
31
|
+
const tag = reader.uint32();
|
|
32
|
+
switch (tag >>> 3) {
|
|
33
|
+
case 1:
|
|
34
|
+
obj.tags.push(Tag.codec().decode(reader, reader.uint32()));
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
reader.skipType(tag & 7);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return obj;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return _codec;
|
|
10
45
|
};
|
|
11
46
|
Tags.encode = (obj) => {
|
|
12
47
|
return encodeMessage(obj, Tags.codec());
|
|
@@ -17,12 +52,60 @@ export var Tags;
|
|
|
17
52
|
})(Tags || (Tags = {}));
|
|
18
53
|
export var Tag;
|
|
19
54
|
(function (Tag) {
|
|
55
|
+
let _codec;
|
|
20
56
|
Tag.codec = () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
57
|
+
if (_codec == null) {
|
|
58
|
+
_codec = message((obj, writer, opts = {}) => {
|
|
59
|
+
if (opts.lengthDelimited !== false) {
|
|
60
|
+
writer.fork();
|
|
61
|
+
}
|
|
62
|
+
if (obj.name != null) {
|
|
63
|
+
writer.uint32(10);
|
|
64
|
+
writer.string(obj.name);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
throw new Error('Protocol error: required field "name" was not found in object');
|
|
68
|
+
}
|
|
69
|
+
if (obj.value != null) {
|
|
70
|
+
writer.uint32(16);
|
|
71
|
+
writer.uint32(obj.value);
|
|
72
|
+
}
|
|
73
|
+
if (obj.expiry != null) {
|
|
74
|
+
writer.uint32(24);
|
|
75
|
+
writer.uint64(obj.expiry);
|
|
76
|
+
}
|
|
77
|
+
if (opts.lengthDelimited !== false) {
|
|
78
|
+
writer.ldelim();
|
|
79
|
+
}
|
|
80
|
+
}, (reader, length) => {
|
|
81
|
+
const obj = {
|
|
82
|
+
name: ''
|
|
83
|
+
};
|
|
84
|
+
const end = length == null ? reader.len : reader.pos + length;
|
|
85
|
+
while (reader.pos < end) {
|
|
86
|
+
const tag = reader.uint32();
|
|
87
|
+
switch (tag >>> 3) {
|
|
88
|
+
case 1:
|
|
89
|
+
obj.name = reader.string();
|
|
90
|
+
break;
|
|
91
|
+
case 2:
|
|
92
|
+
obj.value = reader.uint32();
|
|
93
|
+
break;
|
|
94
|
+
case 3:
|
|
95
|
+
obj.expiry = reader.uint64();
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
reader.skipType(tag & 7);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (obj.name == null) {
|
|
103
|
+
throw new Error('Protocol error: value for required field "name" was not found in protobuf');
|
|
104
|
+
}
|
|
105
|
+
return obj;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return _codec;
|
|
26
109
|
};
|
|
27
110
|
Tag.encode = (obj) => {
|
|
28
111
|
return encodeMessage(obj, Tag.codec());
|
package/dist/src/pb/tags.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/pb/tags.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../src/pb/tags.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,oDAAoD;AAEpD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAQvE,MAAM,KAAW,IAAI,CAwDpB;AAxDD,WAAiB,IAAI;IACnB,IAAI,MAAmB,CAAA;IAEV,UAAK,GAAG,GAAgB,EAAE;QACrC,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,MAAM,GAAG,OAAO,CAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;gBAChD,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE;oBAClC,MAAM,CAAC,IAAI,EAAE,CAAA;iBACd;gBAED,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE;oBACpB,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE;wBAC5B,MAAM,CAAC,MAAM,CAA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
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Stores information about peers libp2p knows on the network",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p-peer-store#readme",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"@libp2p/interfaces": "^3.0.2",
|
|
152
152
|
"@libp2p/logger": "^2.0.0",
|
|
153
153
|
"@libp2p/peer-id": "^1.1.0",
|
|
154
|
-
"@libp2p/peer-record": "^4.0.
|
|
154
|
+
"@libp2p/peer-record": "^4.0.1",
|
|
155
155
|
"@multiformats/multiaddr": "^10.2.0",
|
|
156
156
|
"err-code": "^3.0.1",
|
|
157
157
|
"interface-datastore": "^6.1.0",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"it-pipe": "^2.0.3",
|
|
163
163
|
"mortice": "^3.0.0",
|
|
164
164
|
"multiformats": "^9.6.3",
|
|
165
|
-
"protons-runtime": "^
|
|
165
|
+
"protons-runtime": "^3.1.0",
|
|
166
166
|
"uint8arraylist": "^2.1.1",
|
|
167
167
|
"uint8arrays": "^3.1.0"
|
|
168
168
|
},
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
"delay": "^5.0.0",
|
|
176
176
|
"p-defer": "^4.0.0",
|
|
177
177
|
"p-wait-for": "^5.0.0",
|
|
178
|
-
"protons": "^
|
|
178
|
+
"protons": "^5.1.0",
|
|
179
179
|
"sinon": "^14.0.0"
|
|
180
180
|
}
|
|
181
181
|
}
|
package/src/pb/peer.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
3
|
|
|
4
|
-
import { encodeMessage, decodeMessage, message
|
|
5
|
-
import type { Codec } from 'protons-runtime'
|
|
4
|
+
import { encodeMessage, decodeMessage, message } from 'protons-runtime'
|
|
6
5
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
6
|
+
import type { Codec } from 'protons-runtime'
|
|
7
7
|
|
|
8
8
|
export interface Peer {
|
|
9
9
|
addresses: Address[]
|
|
@@ -14,17 +14,97 @@ export interface Peer {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export namespace Peer {
|
|
17
|
+
let _codec: Codec<Peer>
|
|
18
|
+
|
|
17
19
|
export const codec = (): Codec<Peer> => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (_codec == null) {
|
|
21
|
+
_codec = message<Peer>((obj, writer, opts = {}) => {
|
|
22
|
+
if (opts.lengthDelimited !== false) {
|
|
23
|
+
writer.fork()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (obj.addresses != null) {
|
|
27
|
+
for (const value of obj.addresses) {
|
|
28
|
+
writer.uint32(10)
|
|
29
|
+
Address.codec().encode(value, writer)
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
throw new Error('Protocol error: required field "addresses" was not found in object')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (obj.protocols != null) {
|
|
36
|
+
for (const value of obj.protocols) {
|
|
37
|
+
writer.uint32(18)
|
|
38
|
+
writer.string(value)
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
throw new Error('Protocol error: required field "protocols" was not found in object')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (obj.metadata != null) {
|
|
45
|
+
for (const value of obj.metadata) {
|
|
46
|
+
writer.uint32(26)
|
|
47
|
+
Metadata.codec().encode(value, writer)
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
throw new Error('Protocol error: required field "metadata" was not found in object')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (obj.pubKey != null) {
|
|
54
|
+
writer.uint32(34)
|
|
55
|
+
writer.bytes(obj.pubKey)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (obj.peerRecordEnvelope != null) {
|
|
59
|
+
writer.uint32(42)
|
|
60
|
+
writer.bytes(obj.peerRecordEnvelope)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (opts.lengthDelimited !== false) {
|
|
64
|
+
writer.ldelim()
|
|
65
|
+
}
|
|
66
|
+
}, (reader, length) => {
|
|
67
|
+
const obj: any = {
|
|
68
|
+
addresses: [],
|
|
69
|
+
protocols: [],
|
|
70
|
+
metadata: []
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
74
|
+
|
|
75
|
+
while (reader.pos < end) {
|
|
76
|
+
const tag = reader.uint32()
|
|
77
|
+
|
|
78
|
+
switch (tag >>> 3) {
|
|
79
|
+
case 1:
|
|
80
|
+
obj.addresses.push(Address.codec().decode(reader, reader.uint32()))
|
|
81
|
+
break
|
|
82
|
+
case 2:
|
|
83
|
+
obj.protocols.push(reader.string())
|
|
84
|
+
break
|
|
85
|
+
case 3:
|
|
86
|
+
obj.metadata.push(Metadata.codec().decode(reader, reader.uint32()))
|
|
87
|
+
break
|
|
88
|
+
case 4:
|
|
89
|
+
obj.pubKey = reader.bytes()
|
|
90
|
+
break
|
|
91
|
+
case 5:
|
|
92
|
+
obj.peerRecordEnvelope = reader.bytes()
|
|
93
|
+
break
|
|
94
|
+
default:
|
|
95
|
+
reader.skipType(tag & 7)
|
|
96
|
+
break
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return obj
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return _codec
|
|
25
105
|
}
|
|
26
106
|
|
|
27
|
-
export const encode = (obj: Peer):
|
|
107
|
+
export const encode = (obj: Peer): Uint8Array => {
|
|
28
108
|
return encodeMessage(obj, Peer.codec())
|
|
29
109
|
}
|
|
30
110
|
|
|
@@ -39,14 +119,65 @@ export interface Address {
|
|
|
39
119
|
}
|
|
40
120
|
|
|
41
121
|
export namespace Address {
|
|
122
|
+
let _codec: Codec<Address>
|
|
123
|
+
|
|
42
124
|
export const codec = (): Codec<Address> => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
125
|
+
if (_codec == null) {
|
|
126
|
+
_codec = message<Address>((obj, writer, opts = {}) => {
|
|
127
|
+
if (opts.lengthDelimited !== false) {
|
|
128
|
+
writer.fork()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (obj.multiaddr != null) {
|
|
132
|
+
writer.uint32(10)
|
|
133
|
+
writer.bytes(obj.multiaddr)
|
|
134
|
+
} else {
|
|
135
|
+
throw new Error('Protocol error: required field "multiaddr" was not found in object')
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (obj.isCertified != null) {
|
|
139
|
+
writer.uint32(16)
|
|
140
|
+
writer.bool(obj.isCertified)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (opts.lengthDelimited !== false) {
|
|
144
|
+
writer.ldelim()
|
|
145
|
+
}
|
|
146
|
+
}, (reader, length) => {
|
|
147
|
+
const obj: any = {
|
|
148
|
+
multiaddr: new Uint8Array(0)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
152
|
+
|
|
153
|
+
while (reader.pos < end) {
|
|
154
|
+
const tag = reader.uint32()
|
|
155
|
+
|
|
156
|
+
switch (tag >>> 3) {
|
|
157
|
+
case 1:
|
|
158
|
+
obj.multiaddr = reader.bytes()
|
|
159
|
+
break
|
|
160
|
+
case 2:
|
|
161
|
+
obj.isCertified = reader.bool()
|
|
162
|
+
break
|
|
163
|
+
default:
|
|
164
|
+
reader.skipType(tag & 7)
|
|
165
|
+
break
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (obj.multiaddr == null) {
|
|
170
|
+
throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf')
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return obj
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return _codec
|
|
47
178
|
}
|
|
48
179
|
|
|
49
|
-
export const encode = (obj: Address):
|
|
180
|
+
export const encode = (obj: Address): Uint8Array => {
|
|
50
181
|
return encodeMessage(obj, Address.codec())
|
|
51
182
|
}
|
|
52
183
|
|
|
@@ -61,14 +192,72 @@ export interface Metadata {
|
|
|
61
192
|
}
|
|
62
193
|
|
|
63
194
|
export namespace Metadata {
|
|
195
|
+
let _codec: Codec<Metadata>
|
|
196
|
+
|
|
64
197
|
export const codec = (): Codec<Metadata> => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
198
|
+
if (_codec == null) {
|
|
199
|
+
_codec = message<Metadata>((obj, writer, opts = {}) => {
|
|
200
|
+
if (opts.lengthDelimited !== false) {
|
|
201
|
+
writer.fork()
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (obj.key != null) {
|
|
205
|
+
writer.uint32(10)
|
|
206
|
+
writer.string(obj.key)
|
|
207
|
+
} else {
|
|
208
|
+
throw new Error('Protocol error: required field "key" was not found in object')
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (obj.value != null) {
|
|
212
|
+
writer.uint32(18)
|
|
213
|
+
writer.bytes(obj.value)
|
|
214
|
+
} else {
|
|
215
|
+
throw new Error('Protocol error: required field "value" was not found in object')
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (opts.lengthDelimited !== false) {
|
|
219
|
+
writer.ldelim()
|
|
220
|
+
}
|
|
221
|
+
}, (reader, length) => {
|
|
222
|
+
const obj: any = {
|
|
223
|
+
key: '',
|
|
224
|
+
value: new Uint8Array(0)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
228
|
+
|
|
229
|
+
while (reader.pos < end) {
|
|
230
|
+
const tag = reader.uint32()
|
|
231
|
+
|
|
232
|
+
switch (tag >>> 3) {
|
|
233
|
+
case 1:
|
|
234
|
+
obj.key = reader.string()
|
|
235
|
+
break
|
|
236
|
+
case 2:
|
|
237
|
+
obj.value = reader.bytes()
|
|
238
|
+
break
|
|
239
|
+
default:
|
|
240
|
+
reader.skipType(tag & 7)
|
|
241
|
+
break
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (obj.key == null) {
|
|
246
|
+
throw new Error('Protocol error: value for required field "key" was not found in protobuf')
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (obj.value == null) {
|
|
250
|
+
throw new Error('Protocol error: value for required field "value" was not found in protobuf')
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return obj
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return _codec
|
|
69
258
|
}
|
|
70
259
|
|
|
71
|
-
export const encode = (obj: Metadata):
|
|
260
|
+
export const encode = (obj: Metadata): Uint8Array => {
|
|
72
261
|
return encodeMessage(obj, Metadata.codec())
|
|
73
262
|
}
|
|
74
263
|
|
package/src/pb/tags.ts
CHANGED
|
@@ -1,22 +1,64 @@
|
|
|
1
1
|
/* eslint-disable import/export */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
3
3
|
|
|
4
|
-
import { encodeMessage, decodeMessage, message
|
|
5
|
-
import type { Codec } from 'protons-runtime'
|
|
4
|
+
import { encodeMessage, decodeMessage, message } from 'protons-runtime'
|
|
6
5
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
6
|
+
import type { Codec } from 'protons-runtime'
|
|
7
7
|
|
|
8
8
|
export interface Tags {
|
|
9
9
|
tags: Tag[]
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export namespace Tags {
|
|
13
|
+
let _codec: Codec<Tags>
|
|
14
|
+
|
|
13
15
|
export const codec = (): Codec<Tags> => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
if (_codec == null) {
|
|
17
|
+
_codec = message<Tags>((obj, writer, opts = {}) => {
|
|
18
|
+
if (opts.lengthDelimited !== false) {
|
|
19
|
+
writer.fork()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (obj.tags != null) {
|
|
23
|
+
for (const value of obj.tags) {
|
|
24
|
+
writer.uint32(10)
|
|
25
|
+
Tag.codec().encode(value, writer)
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error('Protocol error: required field "tags" was not found in object')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (opts.lengthDelimited !== false) {
|
|
32
|
+
writer.ldelim()
|
|
33
|
+
}
|
|
34
|
+
}, (reader, length) => {
|
|
35
|
+
const obj: any = {
|
|
36
|
+
tags: []
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
40
|
+
|
|
41
|
+
while (reader.pos < end) {
|
|
42
|
+
const tag = reader.uint32()
|
|
43
|
+
|
|
44
|
+
switch (tag >>> 3) {
|
|
45
|
+
case 1:
|
|
46
|
+
obj.tags.push(Tag.codec().decode(reader, reader.uint32()))
|
|
47
|
+
break
|
|
48
|
+
default:
|
|
49
|
+
reader.skipType(tag & 7)
|
|
50
|
+
break
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return obj
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return _codec
|
|
17
59
|
}
|
|
18
60
|
|
|
19
|
-
export const encode = (obj: Tags):
|
|
61
|
+
export const encode = (obj: Tags): Uint8Array => {
|
|
20
62
|
return encodeMessage(obj, Tags.codec())
|
|
21
63
|
}
|
|
22
64
|
|
|
@@ -32,15 +74,73 @@ export interface Tag {
|
|
|
32
74
|
}
|
|
33
75
|
|
|
34
76
|
export namespace Tag {
|
|
77
|
+
let _codec: Codec<Tag>
|
|
78
|
+
|
|
35
79
|
export const codec = (): Codec<Tag> => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
80
|
+
if (_codec == null) {
|
|
81
|
+
_codec = message<Tag>((obj, writer, opts = {}) => {
|
|
82
|
+
if (opts.lengthDelimited !== false) {
|
|
83
|
+
writer.fork()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (obj.name != null) {
|
|
87
|
+
writer.uint32(10)
|
|
88
|
+
writer.string(obj.name)
|
|
89
|
+
} else {
|
|
90
|
+
throw new Error('Protocol error: required field "name" was not found in object')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (obj.value != null) {
|
|
94
|
+
writer.uint32(16)
|
|
95
|
+
writer.uint32(obj.value)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (obj.expiry != null) {
|
|
99
|
+
writer.uint32(24)
|
|
100
|
+
writer.uint64(obj.expiry)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (opts.lengthDelimited !== false) {
|
|
104
|
+
writer.ldelim()
|
|
105
|
+
}
|
|
106
|
+
}, (reader, length) => {
|
|
107
|
+
const obj: any = {
|
|
108
|
+
name: ''
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const end = length == null ? reader.len : reader.pos + length
|
|
112
|
+
|
|
113
|
+
while (reader.pos < end) {
|
|
114
|
+
const tag = reader.uint32()
|
|
115
|
+
|
|
116
|
+
switch (tag >>> 3) {
|
|
117
|
+
case 1:
|
|
118
|
+
obj.name = reader.string()
|
|
119
|
+
break
|
|
120
|
+
case 2:
|
|
121
|
+
obj.value = reader.uint32()
|
|
122
|
+
break
|
|
123
|
+
case 3:
|
|
124
|
+
obj.expiry = reader.uint64()
|
|
125
|
+
break
|
|
126
|
+
default:
|
|
127
|
+
reader.skipType(tag & 7)
|
|
128
|
+
break
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (obj.name == null) {
|
|
133
|
+
throw new Error('Protocol error: value for required field "name" was not found in protobuf')
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return obj
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return _codec
|
|
41
141
|
}
|
|
42
142
|
|
|
43
|
-
export const encode = (obj: Tag):
|
|
143
|
+
export const encode = (obj: Tag): Uint8Array => {
|
|
44
144
|
return encodeMessage(obj, Tag.codec())
|
|
45
145
|
}
|
|
46
146
|
|