Skip to content

Commit 83958a5

Browse files
dependabot[bot]achingbrain
andauthoredMar 10, 2023
deps: bump protons-runtime from 4.0.2 to 5.0.0 (libp2p#45)
* 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: regenerate proto files --------- 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 157d49d commit 83958a5

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed
 

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"it-map": "^2.0.0",
162162
"it-pipe": "^2.0.3",
163163
"multiformats": "^11.0.0",
164-
"protons-runtime": "^4.0.1",
164+
"protons-runtime": "^5.0.0",
165165
"uint8-varint": "^1.0.2",
166166
"uint8arraylist": "^2.1.0",
167167
"uint8arrays": "^4.0.2",
@@ -172,7 +172,7 @@
172172
"@libp2p/peer-id-factory": "^2.0.0",
173173
"@types/varint": "^6.0.0",
174174
"aegir": "^38.1.2",
175-
"protons": "^6.0.0",
175+
"protons": "^7.0.2",
176176
"sinon": "^15.0.0"
177177
}
178178
}

‎src/envelope/envelope.ts

+7-6
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 Envelope {
1112
publicKey: Uint8Array
@@ -24,22 +25,22 @@ export namespace Envelope {
2425
w.fork()
2526
}
2627

27-
if (opts.writeDefaults === true || (obj.publicKey != null && obj.publicKey.byteLength > 0)) {
28+
if ((obj.publicKey != null && obj.publicKey.byteLength > 0)) {
2829
w.uint32(10)
2930
w.bytes(obj.publicKey)
3031
}
3132

32-
if (opts.writeDefaults === true || (obj.payloadType != null && obj.payloadType.byteLength > 0)) {
33+
if ((obj.payloadType != null && obj.payloadType.byteLength > 0)) {
3334
w.uint32(18)
3435
w.bytes(obj.payloadType)
3536
}
3637

37-
if (opts.writeDefaults === true || (obj.payload != null && obj.payload.byteLength > 0)) {
38+
if ((obj.payload != null && obj.payload.byteLength > 0)) {
3839
w.uint32(26)
3940
w.bytes(obj.payload)
4041
}
4142

42-
if (opts.writeDefaults === true || (obj.signature != null && obj.signature.byteLength > 0)) {
43+
if ((obj.signature != null && obj.signature.byteLength > 0)) {
4344
w.uint32(42)
4445
w.bytes(obj.signature)
4546
}
@@ -86,7 +87,7 @@ export namespace Envelope {
8687
return _codec
8788
}
8889

89-
export const encode = (obj: Envelope): Uint8Array => {
90+
export const encode = (obj: Partial<Envelope>): Uint8Array => {
9091
return encodeMessage(obj, Envelope.codec())
9192
}
9293

‎src/peer-record/peer-record.ts

+8-9
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 PeerRecord {
1112
peerId: Uint8Array
@@ -28,7 +29,7 @@ export namespace PeerRecord {
2829
w.fork()
2930
}
3031

31-
if (opts.writeDefaults === true || (obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {
32+
if ((obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {
3233
w.uint32(10)
3334
w.bytes(obj.multiaddr)
3435
}
@@ -63,7 +64,7 @@ export namespace PeerRecord {
6364
return _codec
6465
}
6566

66-
export const encode = (obj: AddressInfo): Uint8Array => {
67+
export const encode = (obj: Partial<AddressInfo>): Uint8Array => {
6768
return encodeMessage(obj, AddressInfo.codec())
6869
}
6970

@@ -81,22 +82,20 @@ export namespace PeerRecord {
8182
w.fork()
8283
}
8384

84-
if (opts.writeDefaults === true || (obj.peerId != null && obj.peerId.byteLength > 0)) {
85+
if ((obj.peerId != null && obj.peerId.byteLength > 0)) {
8586
w.uint32(10)
8687
w.bytes(obj.peerId)
8788
}
8889

89-
if (opts.writeDefaults === true || obj.seq !== 0n) {
90+
if ((obj.seq != null && obj.seq !== 0n)) {
9091
w.uint32(16)
9192
w.uint64(obj.seq)
9293
}
9394

9495
if (obj.addresses != null) {
9596
for (const value of obj.addresses) {
9697
w.uint32(26)
97-
PeerRecord.AddressInfo.codec().encode(value, w, {
98-
writeDefaults: true
99-
})
98+
PeerRecord.AddressInfo.codec().encode(value, w)
10099
}
101100
}
102101

@@ -138,7 +137,7 @@ export namespace PeerRecord {
138137
return _codec
139138
}
140139

141-
export const encode = (obj: PeerRecord): Uint8Array => {
140+
export const encode = (obj: Partial<PeerRecord>): Uint8Array => {
142141
return encodeMessage(obj, PeerRecord.codec())
143142
}
144143

0 commit comments

Comments
 (0)
Please sign in to comment.