Skip to content

Commit 7ebf172

Browse files
deps: bump protons-runtime from 4.0.2 to 5.0.0 (libp2p#416)
* deps: bump protons-runtime from 4.0.2 to 5.0.0 Bumps [protons-runtime](https://github.com/ipfs/protons) from 4.0.2 to 5.0.0. - [Release notes](https://github.com/ipfs/protons/releases) - [Commits](ipfs/protons@protons-runtime-v4.0.2...protons-runtime-v5.0.0) --- updated-dependencies: - dependency-name: protons-runtime dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * deps(dev): bump protons from 6.1.3 to 7.0.2 Bumps [protons](https://github.com/ipfs/protons) from 6.1.3 to 7.0.2. - [Release notes](https://github.com/ipfs/protons/releases) - [Commits](ipfs/protons@protons-v6.1.3...protons-v7.0.2) --- updated-dependencies: - dependency-name: protons dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * chore: regenerate protobuf --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Potsides <[email protected]>
1 parent 04124d4 commit 7ebf172

File tree

2 files changed

+46
-49
lines changed

2 files changed

+46
-49
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"p-defer": "^4.0.0",
182182
"p-queue": "^7.2.0",
183183
"private-ip": "^3.0.0",
184-
"protons-runtime": "^4.0.1",
184+
"protons-runtime": "^5.0.0",
185185
"timeout-abort-controller": "^3.0.0",
186186
"uint8arraylist": "^2.0.0",
187187
"uint8arrays": "^4.0.2",
@@ -205,7 +205,7 @@
205205
"lodash.range": "^3.2.0",
206206
"p-retry": "^5.0.0",
207207
"p-wait-for": "^5.0.0",
208-
"protons": "^6.0.0",
208+
"protons": "^7.0.2",
209209
"sinon": "^15.0.0",
210210
"ts-sinon": "^2.0.2",
211211
"which": "^3.0.0"

src/message/dht.ts

+44-47
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/* eslint-disable import/export */
2+
/* eslint-disable complexity */
23
/* eslint-disable @typescript-eslint/no-namespace */
4+
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
5+
/* eslint-disable @typescript-eslint/no-empty-interface */
36

47
import { encodeMessage, decodeMessage, message, enumeration } from 'protons-runtime'
5-
import type { Uint8ArrayList } from 'uint8arraylist'
68
import type { Codec } from 'protons-runtime'
9+
import type { Uint8ArrayList } from 'uint8arraylist'
710

811
export interface Record {
912
key?: Uint8Array
@@ -18,38 +21,38 @@ export namespace Record {
1821

1922
export const codec = (): Codec<Record> => {
2023
if (_codec == null) {
21-
_codec = message<Record>((obj, writer, opts = {}) => {
24+
_codec = message<Record>((obj, w, opts = {}) => {
2225
if (opts.lengthDelimited !== false) {
23-
writer.fork()
26+
w.fork()
2427
}
2528

2629
if (obj.key != null) {
27-
writer.uint32(10)
28-
writer.bytes(obj.key)
30+
w.uint32(10)
31+
w.bytes(obj.key)
2932
}
3033

3134
if (obj.value != null) {
32-
writer.uint32(18)
33-
writer.bytes(obj.value)
35+
w.uint32(18)
36+
w.bytes(obj.value)
3437
}
3538

3639
if (obj.author != null) {
37-
writer.uint32(26)
38-
writer.bytes(obj.author)
40+
w.uint32(26)
41+
w.bytes(obj.author)
3942
}
4043

4144
if (obj.signature != null) {
42-
writer.uint32(34)
43-
writer.bytes(obj.signature)
45+
w.uint32(34)
46+
w.bytes(obj.signature)
4447
}
4548

4649
if (obj.timeReceived != null) {
47-
writer.uint32(42)
48-
writer.string(obj.timeReceived)
50+
w.uint32(42)
51+
w.string(obj.timeReceived)
4952
}
5053

5154
if (opts.lengthDelimited !== false) {
52-
writer.ldelim()
55+
w.ldelim()
5356
}
5457
}, (reader, length) => {
5558
const obj: any = {}
@@ -88,7 +91,7 @@ export namespace Record {
8891
return _codec
8992
}
9093

91-
export const encode = (obj: Record): Uint8Array => {
94+
export const encode = (obj: Partial<Record>): Uint8Array => {
9295
return encodeMessage(obj, Record.codec())
9396
}
9497

@@ -162,32 +165,30 @@ export namespace Message {
162165

163166
export const codec = (): Codec<Peer> => {
164167
if (_codec == null) {
165-
_codec = message<Peer>((obj, writer, opts = {}) => {
168+
_codec = message<Peer>((obj, w, opts = {}) => {
166169
if (opts.lengthDelimited !== false) {
167-
writer.fork()
170+
w.fork()
168171
}
169172

170173
if (obj.id != null) {
171-
writer.uint32(10)
172-
writer.bytes(obj.id)
174+
w.uint32(10)
175+
w.bytes(obj.id)
173176
}
174177

175178
if (obj.addrs != null) {
176179
for (const value of obj.addrs) {
177-
writer.uint32(18)
178-
writer.bytes(value)
180+
w.uint32(18)
181+
w.bytes(value)
179182
}
180-
} else {
181-
throw new Error('Protocol error: required field "addrs" was not found in object')
182183
}
183184

184185
if (obj.connection != null) {
185-
writer.uint32(24)
186-
Message.ConnectionType.codec().encode(obj.connection, writer)
186+
w.uint32(24)
187+
Message.ConnectionType.codec().encode(obj.connection, w)
187188
}
188189

189190
if (opts.lengthDelimited !== false) {
190-
writer.ldelim()
191+
w.ldelim()
191192
}
192193
}, (reader, length) => {
193194
const obj: any = {
@@ -222,7 +223,7 @@ export namespace Message {
222223
return _codec
223224
}
224225

225-
export const encode = (obj: Peer): Uint8Array => {
226+
export const encode = (obj: Partial<Peer>): Uint8Array => {
226227
return encodeMessage(obj, Peer.codec())
227228
}
228229

@@ -235,51 +236,47 @@ export namespace Message {
235236

236237
export const codec = (): Codec<Message> => {
237238
if (_codec == null) {
238-
_codec = message<Message>((obj, writer, opts = {}) => {
239+
_codec = message<Message>((obj, w, opts = {}) => {
239240
if (opts.lengthDelimited !== false) {
240-
writer.fork()
241+
w.fork()
241242
}
242243

243244
if (obj.type != null) {
244-
writer.uint32(8)
245-
Message.MessageType.codec().encode(obj.type, writer)
245+
w.uint32(8)
246+
Message.MessageType.codec().encode(obj.type, w)
246247
}
247248

248249
if (obj.clusterLevelRaw != null) {
249-
writer.uint32(80)
250-
writer.int32(obj.clusterLevelRaw)
250+
w.uint32(80)
251+
w.int32(obj.clusterLevelRaw)
251252
}
252253

253254
if (obj.key != null) {
254-
writer.uint32(18)
255-
writer.bytes(obj.key)
255+
w.uint32(18)
256+
w.bytes(obj.key)
256257
}
257258

258259
if (obj.record != null) {
259-
writer.uint32(26)
260-
writer.bytes(obj.record)
260+
w.uint32(26)
261+
w.bytes(obj.record)
261262
}
262263

263264
if (obj.closerPeers != null) {
264265
for (const value of obj.closerPeers) {
265-
writer.uint32(66)
266-
Message.Peer.codec().encode(value, writer)
266+
w.uint32(66)
267+
Message.Peer.codec().encode(value, w)
267268
}
268-
} else {
269-
throw new Error('Protocol error: required field "closerPeers" was not found in object')
270269
}
271270

272271
if (obj.providerPeers != null) {
273272
for (const value of obj.providerPeers) {
274-
writer.uint32(74)
275-
Message.Peer.codec().encode(value, writer)
273+
w.uint32(74)
274+
Message.Peer.codec().encode(value, w)
276275
}
277-
} else {
278-
throw new Error('Protocol error: required field "providerPeers" was not found in object')
279276
}
280277

281278
if (opts.lengthDelimited !== false) {
282-
writer.ldelim()
279+
w.ldelim()
283280
}
284281
}, (reader, length) => {
285282
const obj: any = {
@@ -324,7 +321,7 @@ export namespace Message {
324321
return _codec
325322
}
326323

327-
export const encode = (obj: Message): Uint8Array => {
324+
export const encode = (obj: Partial<Message>): Uint8Array => {
328325
return encodeMessage(obj, Message.codec())
329326
}
330327

0 commit comments

Comments
 (0)