From 83958a5b1cae2b33cbeee4bb998c790c973db776 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Mar 2023 10:36:17 +0100 Subject: [PATCH] deps: bump protons-runtime from 4.0.2 to 5.0.0 (#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](https://github.com/ipfs/protons/compare/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] * 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](https://github.com/ipfs/protons/compare/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] * chore: regenerate proto files --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain --- package.json | 4 ++-- src/envelope/envelope.ts | 13 +++++++------ src/peer-record/peer-record.ts | 17 ++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 5d94ded..4339458 100644 --- a/package.json +++ b/package.json @@ -161,7 +161,7 @@ "it-map": "^2.0.0", "it-pipe": "^2.0.3", "multiformats": "^11.0.0", - "protons-runtime": "^4.0.1", + "protons-runtime": "^5.0.0", "uint8-varint": "^1.0.2", "uint8arraylist": "^2.1.0", "uint8arrays": "^4.0.2", @@ -172,7 +172,7 @@ "@libp2p/peer-id-factory": "^2.0.0", "@types/varint": "^6.0.0", "aegir": "^38.1.2", - "protons": "^6.0.0", + "protons": "^7.0.2", "sinon": "^15.0.0" } } diff --git a/src/envelope/envelope.ts b/src/envelope/envelope.ts index fdd22ad..5a5d6e6 100644 --- a/src/envelope/envelope.ts +++ b/src/envelope/envelope.ts @@ -2,10 +2,11 @@ /* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Uint8ArrayList } from 'uint8arraylist' import type { Codec } from 'protons-runtime' +import type { Uint8ArrayList } from 'uint8arraylist' export interface Envelope { publicKey: Uint8Array @@ -24,22 +25,22 @@ export namespace Envelope { w.fork() } - if (opts.writeDefaults === true || (obj.publicKey != null && obj.publicKey.byteLength > 0)) { + if ((obj.publicKey != null && obj.publicKey.byteLength > 0)) { w.uint32(10) w.bytes(obj.publicKey) } - if (opts.writeDefaults === true || (obj.payloadType != null && obj.payloadType.byteLength > 0)) { + if ((obj.payloadType != null && obj.payloadType.byteLength > 0)) { w.uint32(18) w.bytes(obj.payloadType) } - if (opts.writeDefaults === true || (obj.payload != null && obj.payload.byteLength > 0)) { + if ((obj.payload != null && obj.payload.byteLength > 0)) { w.uint32(26) w.bytes(obj.payload) } - if (opts.writeDefaults === true || (obj.signature != null && obj.signature.byteLength > 0)) { + if ((obj.signature != null && obj.signature.byteLength > 0)) { w.uint32(42) w.bytes(obj.signature) } @@ -86,7 +87,7 @@ export namespace Envelope { return _codec } - export const encode = (obj: Envelope): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, Envelope.codec()) } diff --git a/src/peer-record/peer-record.ts b/src/peer-record/peer-record.ts index 5ff83fe..0e3e981 100644 --- a/src/peer-record/peer-record.ts +++ b/src/peer-record/peer-record.ts @@ -2,10 +2,11 @@ /* eslint-disable complexity */ /* eslint-disable @typescript-eslint/no-namespace */ /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ +/* eslint-disable @typescript-eslint/no-empty-interface */ import { encodeMessage, decodeMessage, message } from 'protons-runtime' -import type { Uint8ArrayList } from 'uint8arraylist' import type { Codec } from 'protons-runtime' +import type { Uint8ArrayList } from 'uint8arraylist' export interface PeerRecord { peerId: Uint8Array @@ -28,7 +29,7 @@ export namespace PeerRecord { w.fork() } - if (opts.writeDefaults === true || (obj.multiaddr != null && obj.multiaddr.byteLength > 0)) { + if ((obj.multiaddr != null && obj.multiaddr.byteLength > 0)) { w.uint32(10) w.bytes(obj.multiaddr) } @@ -63,7 +64,7 @@ export namespace PeerRecord { return _codec } - export const encode = (obj: AddressInfo): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, AddressInfo.codec()) } @@ -81,12 +82,12 @@ export namespace PeerRecord { w.fork() } - if (opts.writeDefaults === true || (obj.peerId != null && obj.peerId.byteLength > 0)) { + if ((obj.peerId != null && obj.peerId.byteLength > 0)) { w.uint32(10) w.bytes(obj.peerId) } - if (opts.writeDefaults === true || obj.seq !== 0n) { + if ((obj.seq != null && obj.seq !== 0n)) { w.uint32(16) w.uint64(obj.seq) } @@ -94,9 +95,7 @@ export namespace PeerRecord { if (obj.addresses != null) { for (const value of obj.addresses) { w.uint32(26) - PeerRecord.AddressInfo.codec().encode(value, w, { - writeDefaults: true - }) + PeerRecord.AddressInfo.codec().encode(value, w) } } @@ -138,7 +137,7 @@ export namespace PeerRecord { return _codec } - export const encode = (obj: PeerRecord): Uint8Array => { + export const encode = (obj: Partial): Uint8Array => { return encodeMessage(obj, PeerRecord.codec()) }