Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
deps: bump protons-runtime from 4.0.2 to 5.0.0 (#45)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
dependabot[bot] and achingbrain authored Mar 10, 2023
1 parent 157d49d commit 83958a5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
13 changes: 7 additions & 6 deletions src/envelope/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down Expand Up @@ -86,7 +87,7 @@ export namespace Envelope {
return _codec
}

export const encode = (obj: Envelope): Uint8Array => {
export const encode = (obj: Partial<Envelope>): Uint8Array => {
return encodeMessage(obj, Envelope.codec())
}

Expand Down
17 changes: 8 additions & 9 deletions src/peer-record/peer-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down Expand Up @@ -63,7 +64,7 @@ export namespace PeerRecord {
return _codec
}

export const encode = (obj: AddressInfo): Uint8Array => {
export const encode = (obj: Partial<AddressInfo>): Uint8Array => {
return encodeMessage(obj, AddressInfo.codec())
}

Expand All @@ -81,22 +82,20 @@ 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)
}

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)
}
}

Expand Down Expand Up @@ -138,7 +137,7 @@ export namespace PeerRecord {
return _codec
}

export const encode = (obj: PeerRecord): Uint8Array => {
export const encode = (obj: Partial<PeerRecord>): Uint8Array => {
return encodeMessage(obj, PeerRecord.codec())
}

Expand Down

0 comments on commit 83958a5

Please sign in to comment.