Skip to content

Commit

Permalink
deps: bump it-length-prefixed from 8.0.4 to 9.0.0 (#1672)
Browse files Browse the repository at this point in the history
* deps: bump it-length-prefixed from 8.0.4 to 9.0.0

Bumps [it-length-prefixed](https://github.com/alanshaw/it-length-prefixed) from 8.0.4 to 9.0.0.
- [Release notes](https://github.com/alanshaw/it-length-prefixed/releases)
- [Changelog](https://github.com/alanshaw/it-length-prefixed/blob/master/CHANGELOG.md)
- [Commits](alanshaw/it-length-prefixed@v8.0.4...v9.0.0)

---
updated-dependencies:
- dependency-name: it-length-prefixed
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: fix build

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: achingbrain <[email protected]>
  • Loading branch information
dependabot[bot] and achingbrain authored Apr 14, 2023
1 parent 4cce632 commit 190de42
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"it-filter": "^3.0.1",
"it-first": "^3.0.1",
"it-handshake": "^4.1.2",
"it-length-prefixed": "^8.0.2",
"it-length-prefixed": "^9.0.0",
"it-map": "^3.0.2",
"it-merge": "^3.0.0",
"it-pair": "^2.0.2",
Expand Down
8 changes: 4 additions & 4 deletions src/autonat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class AutonatService implements Startable {

await pipe(
source,
lp.decode(),
(source) => lp.decode(source),
async function * (stream) {
const buf = await first(stream)

Expand Down Expand Up @@ -357,7 +357,7 @@ export class AutonatService implements Startable {
}
})
},
lp.encode(),
(source) => lp.encode(source),
// pipe to the stream, not the abortable source other wise we
// can't tell the remote when a dial timed out..
data.stream
Expand Down Expand Up @@ -446,9 +446,9 @@ export class AutonatService implements Startable {

const buf = await pipe(
[request],
lp.encode(),
(source) => lp.encode(source),
source,
lp.decode(),
(source) => lp.decode(source),
async (stream) => await first(stream)
)
if (buf == null) {
Expand Down
8 changes: 4 additions & 4 deletions src/fetch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ export class FetchService implements Startable {

const result = await pipe(
[FetchRequest.encode({ identifier: key })],
lp.encode(),
(source) => lp.encode(source),
source,
lp.decode(),
(source) => lp.decode(source),
async function (source) {
const buf = await first(source)

Expand Down Expand Up @@ -184,7 +184,7 @@ export class FetchService implements Startable {

await pipe(
stream,
lp.decode(),
(source) => lp.decode(source),
async function * (source) {
const buf = await first(source)

Expand Down Expand Up @@ -215,7 +215,7 @@ export class FetchService implements Startable {

yield FetchResponse.encode(response)
},
lp.encode(),
(source) => lp.encode(source),
stream
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/identify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class IdentifyService implements Startable {
signedPeerRecord,
protocols
})],
lp.encode()
(source) => lp.encode(source)
))
} catch (err: any) {
// Just log errors
Expand Down Expand Up @@ -266,7 +266,7 @@ export class IdentifyService implements Startable {
const data = await pipe(
[],
source,
lp.decode({
(source) => lp.decode(source, {
maxDataLength: this.init.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE
}),
async (source) => await first(source)
Expand Down Expand Up @@ -431,7 +431,7 @@ export class IdentifyService implements Startable {
// make stream abortable
const source = abortableDuplex(stream, timeoutController.signal)

const msgWithLenPrefix = pipe([message], lp.encode())
const msgWithLenPrefix = pipe([message], (source) => lp.encode(source))
await source.sink(msgWithLenPrefix)
} catch (err: any) {
log.error('could not respond to identify request', err)
Expand Down Expand Up @@ -461,7 +461,7 @@ export class IdentifyService implements Startable {
const data = await pipe(
[],
source,
lp.decode({
(source) => lp.decode(source, {
maxDataLength: this.init.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE
}),
async (source) => await first(source)
Expand Down
6 changes: 5 additions & 1 deletion src/insecure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ async function encrypt (localId: PeerId, conn: Duplex<Uint8Array>, remoteId?: Pe
log('write pubkey exchange to peer %p', remoteId)

// Get the Exchange message
// @ts-expect-error needs to be generator
const response = (await lp.decode.fromReader(shake.reader).next()).value

if (response == null) {
throw new Error('Did not read response')
}

const id = Exchange.decode(response)
log('read pubkey exchange from peer %p', remoteId)

Expand Down
2 changes: 1 addition & 1 deletion test/autonat/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ describe('autonat', () => {

const slice = await pipe(
sink,
lp.decode(),
(source) => lp.decode(source),
async source => await all(source)
)

Expand Down
6 changes: 3 additions & 3 deletions test/identify/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe('identify', () => {

await pipe(
[message],
lp.encode(),
(source) => lp.encode(source),
stream,
drain
)
Expand Down Expand Up @@ -305,7 +305,7 @@ describe('identify', () => {
void Promise.resolve().then(async () => {
await pipe(
[data],
lp.encode(),
(source) => lp.encode(source),
stream,
async (source) => { await drain(source) }
)
Expand Down Expand Up @@ -351,7 +351,7 @@ describe('identify', () => {
void Promise.resolve().then(async () => {
await pipe(
[data],
lp.encode(),
(source) => lp.encode(source),
async (source) => {
await stream.sink(async function * () {
for await (const buf of source) {
Expand Down

0 comments on commit 190de42

Please sign in to comment.