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

deps(dev): bump protons from 6.1.3 to 7.0.2 #60

Merged
merged 4 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-pipe": "^2.0.3",
"mortice": "^3.0.0",
"multiformats": "^11.0.0",
"protons-runtime": "^4.0.1",
"protons-runtime": "^5.0.0",
"uint8arraylist": "^2.1.1",
"uint8arrays": "^4.0.2"
},
Expand All @@ -174,7 +174,7 @@
"delay": "^5.0.0",
"p-defer": "^4.0.0",
"p-wait-for": "^5.0.0",
"protons": "^6.0.0",
"protons": "^7.0.2",
"sinon": "^15.0.1"
}
}
23 changes: 10 additions & 13 deletions src/pb/peer.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 Peer {
addresses: Address[]
Expand All @@ -28,9 +29,7 @@ export namespace Peer {
if (obj.addresses != null) {
for (const value of obj.addresses) {
w.uint32(10)
Address.codec().encode(value, w, {
writeDefaults: true
})
Address.codec().encode(value, w)
}
}

Expand All @@ -44,9 +43,7 @@ export namespace Peer {
if (obj.metadata != null) {
for (const value of obj.metadata) {
w.uint32(26)
Metadata.codec().encode(value, w, {
writeDefaults: true
})
Metadata.codec().encode(value, w)
}
}

Expand Down Expand Up @@ -104,7 +101,7 @@ export namespace Peer {
return _codec
}

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

Expand All @@ -128,7 +125,7 @@ export namespace Address {
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 @@ -171,7 +168,7 @@ export namespace Address {
return _codec
}

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

Expand All @@ -195,12 +192,12 @@ export namespace Metadata {
w.fork()
}

if (opts.writeDefaults === true || obj.key !== '') {
if ((obj.key != null && obj.key !== '')) {
w.uint32(10)
w.string(obj.key)
}

if (opts.writeDefaults === true || (obj.value != null && obj.value.byteLength > 0)) {
if ((obj.value != null && obj.value.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.value)
}
Expand Down Expand Up @@ -239,7 +236,7 @@ export namespace Metadata {
return _codec
}

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

Expand Down
13 changes: 6 additions & 7 deletions src/pb/tags.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 Tags {
tags: Tag[]
Expand All @@ -24,9 +25,7 @@ export namespace Tags {
if (obj.tags != null) {
for (const value of obj.tags) {
w.uint32(10)
Tag.codec().encode(value, w, {
writeDefaults: true
})
Tag.codec().encode(value, w)
}
}

Expand Down Expand Up @@ -60,7 +59,7 @@ export namespace Tags {
return _codec
}

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

Expand All @@ -85,7 +84,7 @@ export namespace Tag {
w.fork()
}

if (opts.writeDefaults === true || obj.name !== '') {
if ((obj.name != null && obj.name !== '')) {
w.uint32(10)
w.string(obj.name)
}
Expand Down Expand Up @@ -136,7 +135,7 @@ export namespace Tag {
return _codec
}

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

Expand Down