Skip to content

Commit

Permalink
deps(dev): update protons to 5.1.0 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Aug 11, 2022
1 parent 8b01d5f commit aa6dc45
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 66 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@
"it-pair": "^2.0.2",
"p-defer": "^4.0.0",
"p-wait-for": "^5.0.0",
"protons": "^5.0.0",
"protons-runtime": "^3.0.1",
"protons": "^5.1.0",
"protons-runtime": "^3.1.0",
"sinon": "^14.0.0",
"util": "^0.12.4"
}
Expand Down
83 changes: 19 additions & 64 deletions test/message/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ export namespace RPC {
writer.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const obj: any = {
subscriptions: [],
messages: []
}

const end = length == null ? reader.len : reader.pos + length

Expand All @@ -223,11 +226,9 @@ export namespace RPC {

switch (tag >>> 3) {
case 1:
obj.subscriptions = obj.subscriptions ?? []
obj.subscriptions.push(RPC.SubOpts.codec().decode(reader, reader.uint32()))
break
case 2:
obj.messages = obj.messages ?? []
obj.messages.push(RPC.Message.codec().decode(reader, reader.uint32()))
break
case 3:
Expand All @@ -239,17 +240,6 @@ export namespace RPC {
}
}

obj.subscriptions = obj.subscriptions ?? []
obj.messages = obj.messages ?? []

if (obj.subscriptions == null) {
throw new Error('Protocol error: value for required field "subscriptions" was not found in protobuf')
}

if (obj.messages == null) {
throw new Error('Protocol error: value for required field "messages" was not found in protobuf')
}

return obj
})
}
Expand Down Expand Up @@ -323,7 +313,12 @@ export namespace ControlMessage {
writer.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const obj: any = {
ihave: [],
iwant: [],
graft: [],
prune: []
}

const end = length == null ? reader.len : reader.pos + length

Expand All @@ -332,19 +327,15 @@ export namespace ControlMessage {

switch (tag >>> 3) {
case 1:
obj.ihave = obj.ihave ?? []
obj.ihave.push(ControlIHave.codec().decode(reader, reader.uint32()))
break
case 2:
obj.iwant = obj.iwant ?? []
obj.iwant.push(ControlIWant.codec().decode(reader, reader.uint32()))
break
case 3:
obj.graft = obj.graft ?? []
obj.graft.push(ControlGraft.codec().decode(reader, reader.uint32()))
break
case 4:
obj.prune = obj.prune ?? []
obj.prune.push(ControlPrune.codec().decode(reader, reader.uint32()))
break
default:
Expand All @@ -353,27 +344,6 @@ export namespace ControlMessage {
}
}

obj.ihave = obj.ihave ?? []
obj.iwant = obj.iwant ?? []
obj.graft = obj.graft ?? []
obj.prune = obj.prune ?? []

if (obj.ihave == null) {
throw new Error('Protocol error: value for required field "ihave" was not found in protobuf')
}

if (obj.iwant == null) {
throw new Error('Protocol error: value for required field "iwant" was not found in protobuf')
}

if (obj.graft == null) {
throw new Error('Protocol error: value for required field "graft" was not found in protobuf')
}

if (obj.prune == null) {
throw new Error('Protocol error: value for required field "prune" was not found in protobuf')
}

return obj
})
}
Expand Down Expand Up @@ -423,7 +393,9 @@ export namespace ControlIHave {
writer.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const obj: any = {
messageIDs: []
}

const end = length == null ? reader.len : reader.pos + length

Expand All @@ -435,7 +407,6 @@ export namespace ControlIHave {
obj.topic = reader.string()
break
case 2:
obj.messageIDs = obj.messageIDs ?? []
obj.messageIDs.push(reader.bytes())
break
default:
Expand All @@ -444,12 +415,6 @@ export namespace ControlIHave {
}
}

obj.messageIDs = obj.messageIDs ?? []

if (obj.messageIDs == null) {
throw new Error('Protocol error: value for required field "messageIDs" was not found in protobuf')
}

return obj
})
}
Expand Down Expand Up @@ -493,7 +458,9 @@ export namespace ControlIWant {
writer.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const obj: any = {
messageIDs: []
}

const end = length == null ? reader.len : reader.pos + length

Expand All @@ -502,7 +469,6 @@ export namespace ControlIWant {

switch (tag >>> 3) {
case 1:
obj.messageIDs = obj.messageIDs ?? []
obj.messageIDs.push(reader.bytes())
break
default:
Expand All @@ -511,12 +477,6 @@ export namespace ControlIWant {
}
}

obj.messageIDs = obj.messageIDs ?? []

if (obj.messageIDs == null) {
throw new Error('Protocol error: value for required field "messageIDs" was not found in protobuf')
}

return obj
})
}
Expand Down Expand Up @@ -628,7 +588,9 @@ export namespace ControlPrune {
writer.ldelim()
}
}, (reader, length) => {
const obj: any = {}
const obj: any = {
peers: []
}

const end = length == null ? reader.len : reader.pos + length

Expand All @@ -640,7 +602,6 @@ export namespace ControlPrune {
obj.topic = reader.string()
break
case 2:
obj.peers = obj.peers ?? []
obj.peers.push(PeerInfo.codec().decode(reader, reader.uint32()))
break
case 3:
Expand All @@ -652,12 +613,6 @@ export namespace ControlPrune {
}
}

obj.peers = obj.peers ?? []

if (obj.peers == null) {
throw new Error('Protocol error: value for required field "peers" was not found in protobuf')
}

return obj
})
}
Expand Down

0 comments on commit aa6dc45

Please sign in to comment.