Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 8e7e186

Browse files
dependabot[bot]achingbrain
andauthoredMar 10, 2023
deps: bump protons-runtime from 4.0.2 to 5.0.0 (#207)
* 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] <support@github.com> * 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] <support@github.com> * chore: update proto code --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain <alex@achingbrain.net>
1 parent 1152198 commit 8e7e186

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed
 

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"@libp2p/interface-pubsub": "^3.0.0",
152152
"@libp2p/logger": "^2.0.0",
153153
"@libp2p/pubsub": "^6.0.0",
154-
"protons-runtime": "^4.0.1",
154+
"protons-runtime": "^5.0.0",
155155
"uint8arraylist": "^2.1.1",
156156
"uint8arrays": "^4.0.3"
157157
},
@@ -164,7 +164,7 @@
164164
"aegir": "^38.1.7",
165165
"multiformats": "^11.0.0",
166166
"p-wait-for": "^5.0.0",
167-
"protons": "^6.0.0",
167+
"protons": "^7.0.2",
168168
"sinon": "^15.0.1"
169169
}
170170
}

‎src/message/rpc.ts

+19-34
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
/* eslint-disable complexity */
33
/* eslint-disable @typescript-eslint/no-namespace */
44
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
5+
/* eslint-disable @typescript-eslint/no-empty-interface */
56

67
import { encodeMessage, decodeMessage, message } from 'protons-runtime'
7-
import type { Uint8ArrayList } from 'uint8arraylist'
88
import type { Codec } from 'protons-runtime'
9+
import type { Uint8ArrayList } from 'uint8arraylist'
910

1011
export interface RPC {
1112
subscriptions: RPC.SubOpts[]
@@ -70,7 +71,7 @@ export namespace RPC {
7071
return _codec
7172
}
7273

73-
export const encode = (obj: SubOpts): Uint8Array => {
74+
export const encode = (obj: Partial<SubOpts>): Uint8Array => {
7475
return encodeMessage(obj, SubOpts.codec())
7576
}
7677

@@ -171,7 +172,7 @@ export namespace RPC {
171172
return _codec
172173
}
173174

174-
export const encode = (obj: Message): Uint8Array => {
175+
export const encode = (obj: Partial<Message>): Uint8Array => {
175176
return encodeMessage(obj, Message.codec())
176177
}
177178

@@ -192,26 +193,20 @@ export namespace RPC {
192193
if (obj.subscriptions != null) {
193194
for (const value of obj.subscriptions) {
194195
w.uint32(10)
195-
RPC.SubOpts.codec().encode(value, w, {
196-
writeDefaults: true
197-
})
196+
RPC.SubOpts.codec().encode(value, w)
198197
}
199198
}
200199

201200
if (obj.messages != null) {
202201
for (const value of obj.messages) {
203202
w.uint32(18)
204-
RPC.Message.codec().encode(value, w, {
205-
writeDefaults: true
206-
})
203+
RPC.Message.codec().encode(value, w)
207204
}
208205
}
209206

210207
if (obj.control != null) {
211208
w.uint32(26)
212-
ControlMessage.codec().encode(obj.control, w, {
213-
writeDefaults: false
214-
})
209+
ControlMessage.codec().encode(obj.control, w)
215210
}
216211

217212
if (opts.lengthDelimited !== false) {
@@ -251,7 +246,7 @@ export namespace RPC {
251246
return _codec
252247
}
253248

254-
export const encode = (obj: RPC): Uint8Array => {
249+
export const encode = (obj: Partial<RPC>): Uint8Array => {
255250
return encodeMessage(obj, RPC.codec())
256251
}
257252

@@ -280,36 +275,28 @@ export namespace ControlMessage {
280275
if (obj.ihave != null) {
281276
for (const value of obj.ihave) {
282277
w.uint32(10)
283-
ControlIHave.codec().encode(value, w, {
284-
writeDefaults: true
285-
})
278+
ControlIHave.codec().encode(value, w)
286279
}
287280
}
288281

289282
if (obj.iwant != null) {
290283
for (const value of obj.iwant) {
291284
w.uint32(18)
292-
ControlIWant.codec().encode(value, w, {
293-
writeDefaults: true
294-
})
285+
ControlIWant.codec().encode(value, w)
295286
}
296287
}
297288

298289
if (obj.graft != null) {
299290
for (const value of obj.graft) {
300291
w.uint32(26)
301-
ControlGraft.codec().encode(value, w, {
302-
writeDefaults: true
303-
})
292+
ControlGraft.codec().encode(value, w)
304293
}
305294
}
306295

307296
if (obj.prune != null) {
308297
for (const value of obj.prune) {
309298
w.uint32(34)
310-
ControlPrune.codec().encode(value, w, {
311-
writeDefaults: true
312-
})
299+
ControlPrune.codec().encode(value, w)
313300
}
314301
}
315302

@@ -355,7 +342,7 @@ export namespace ControlMessage {
355342
return _codec
356343
}
357344

358-
export const encode = (obj: ControlMessage): Uint8Array => {
345+
export const encode = (obj: Partial<ControlMessage>): Uint8Array => {
359346
return encodeMessage(obj, ControlMessage.codec())
360347
}
361348

@@ -424,7 +411,7 @@ export namespace ControlIHave {
424411
return _codec
425412
}
426413

427-
export const encode = (obj: ControlIHave): Uint8Array => {
414+
export const encode = (obj: Partial<ControlIHave>): Uint8Array => {
428415
return encodeMessage(obj, ControlIHave.codec())
429416
}
430417

@@ -484,7 +471,7 @@ export namespace ControlIWant {
484471
return _codec
485472
}
486473

487-
export const encode = (obj: ControlIWant): Uint8Array => {
474+
export const encode = (obj: Partial<ControlIWant>): Uint8Array => {
488475
return encodeMessage(obj, ControlIWant.codec())
489476
}
490477

@@ -540,7 +527,7 @@ export namespace ControlGraft {
540527
return _codec
541528
}
542529

543-
export const encode = (obj: ControlGraft): Uint8Array => {
530+
export const encode = (obj: Partial<ControlGraft>): Uint8Array => {
544531
return encodeMessage(obj, ControlGraft.codec())
545532
}
546533

@@ -573,9 +560,7 @@ export namespace ControlPrune {
573560
if (obj.peers != null) {
574561
for (const value of obj.peers) {
575562
w.uint32(18)
576-
PeerInfo.codec().encode(value, w, {
577-
writeDefaults: true
578-
})
563+
PeerInfo.codec().encode(value, w)
579564
}
580565
}
581566

@@ -620,7 +605,7 @@ export namespace ControlPrune {
620605
return _codec
621606
}
622607

623-
export const encode = (obj: ControlPrune): Uint8Array => {
608+
export const encode = (obj: Partial<ControlPrune>): Uint8Array => {
624609
return encodeMessage(obj, ControlPrune.codec())
625610
}
626611

@@ -685,7 +670,7 @@ export namespace PeerInfo {
685670
return _codec
686671
}
687672

688-
export const encode = (obj: PeerInfo): Uint8Array => {
673+
export const encode = (obj: Partial<PeerInfo>): Uint8Array => {
689674
return encodeMessage(obj, PeerInfo.codec())
690675
}
691676

0 commit comments

Comments
 (0)
This repository has been archived.