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

Commit

Permalink
deps: bump uint8arrays, protons and multiformats (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Oct 12, 2022
1 parent 92044b6 commit 9106a6a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@
"dependencies": {
"@libp2p/interface-dht": "^1.0.0",
"err-code": "^3.0.1",
"multiformats": "^9.4.5",
"protons-runtime": "^3.1.0",
"multiformats": "^10.0.0",
"protons-runtime": "^4.0.1",
"uint8arraylist": "^2.1.1",
"uint8arrays": "^3.0.0"
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"@libp2p/crypto": "^1.0.2",
"aegir": "^37.0.13",
"protons": "^5.1.0"
"protons": "^6.0.0"
}
}
44 changes: 14 additions & 30 deletions src/record.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-disable import/export */
/* eslint-disable complexity */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */

import { encodeMessage, decodeMessage, message } from 'protons-runtime'
import type { Uint8ArrayList } from 'uint8arraylist'
Expand All @@ -16,34 +18,28 @@ export namespace Record {

export const codec = (): Codec<Record> => {
if (_codec == null) {
_codec = message<Record>((obj, writer, opts = {}) => {
_codec = message<Record>((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork()
w.fork()
}

if (obj.key != null) {
writer.uint32(10)
writer.bytes(obj.key)
} else {
throw new Error('Protocol error: required field "key" was not found in object')
if (opts.writeDefaults === true || (obj.key != null && obj.key.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.key)
}

if (obj.value != null) {
writer.uint32(18)
writer.bytes(obj.value)
} else {
throw new Error('Protocol error: required field "value" was not found in object')
if (opts.writeDefaults === true || (obj.value != null && obj.value.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.value)
}

if (obj.timeReceived != null) {
writer.uint32(42)
writer.string(obj.timeReceived)
} else {
throw new Error('Protocol error: required field "timeReceived" was not found in object')
if (opts.writeDefaults === true || obj.timeReceived !== '') {
w.uint32(42)
w.string(obj.timeReceived)
}

if (opts.lengthDelimited !== false) {
writer.ldelim()
w.ldelim()
}
}, (reader, length) => {
const obj: any = {
Expand Down Expand Up @@ -73,18 +69,6 @@ export namespace Record {
}
}

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

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

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

return obj
})
}
Expand Down

0 comments on commit 9106a6a

Please sign in to comment.