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

deps(dev): bump aegir from 38.1.8 to 39.0.10 #70

Merged
merged 2 commits into from
Jun 15, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
},
"devDependencies": {
"@types/varint": "^6.0.0",
"aegir": "^38.1.8",
"aegir": "^39.0.10",
"iso-random-stream": "^2.0.2",
"it-all": "^3.0.1",
"it-map": "^3.0.2",
Expand Down
8 changes: 4 additions & 4 deletions src/handle.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { logger } from '@libp2p/logger'
import * as multistream from './multistream.js'
import { handshake } from 'it-handshake'
import { PROTOCOL_ID } from './constants.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { Uint8ArrayList } from 'uint8arraylist'
import type { Duplex, Source } from 'it-stream-types'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { PROTOCOL_ID } from './constants.js'
import * as multistream from './multistream.js'
import type { ByteArrayInit, ByteListInit, MultistreamSelectInit, ProtocolStream } from './index.js'
import type { Duplex, Source } from 'it-stream-types'

const log = logger('libp2p:mss:handle')

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PROTOCOL_ID } from './constants.js'
import type { Duplex, Source } from 'it-stream-types'
import type { AbortOptions } from '@libp2p/interfaces'
import type { Duplex, Source } from 'it-stream-types'

export { PROTOCOL_ID }

Expand Down
22 changes: 11 additions & 11 deletions src/multistream.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

import { Uint8ArrayList } from 'uint8arraylist'
import { CodeError } from '@libp2p/interfaces/errors'
import { logger } from '@libp2p/logger'
import { abortableSource } from 'abortable-iterator'
import first from 'it-first'
import * as lp from 'it-length-prefixed'
import { pipe } from 'it-pipe'
import { CodeError } from '@libp2p/interfaces/errors'
import { Uint8ArrayList } from 'uint8arraylist'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import first from 'it-first'
import { abortableSource } from 'abortable-iterator'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import type { Pushable } from 'it-pushable'
import { MAX_PROTOCOL_LENGTH } from './constants.js'
import type { MultistreamSelectInit } from '.'
import type { AbortOptions } from '@libp2p/interfaces'
import type { Source } from 'it-stream-types'
import type { Pushable } from 'it-pushable'
import type { Reader } from 'it-reader'
import type { MultistreamSelectInit } from '.'
import { MAX_PROTOCOL_LENGTH } from './constants.js'
import { logger } from '@libp2p/logger'
import type { Source } from 'it-stream-types'

const log = logger('libp2p:mss')

Expand Down Expand Up @@ -59,7 +59,7 @@ export async function read (reader: Reader, options?: AbortOptions): Promise<Uin
let byteLength = 1 // Read single byte chunks until the length is known
const varByteSource = { // No return impl - we want the reader to remain readable
[Symbol.asyncIterator]: () => varByteSource,
next: async () => await reader.next(byteLength)
next: async () => reader.next(byteLength)
}

let input: Source<Uint8ArrayList> = varByteSource
Expand All @@ -78,7 +78,7 @@ export async function read (reader: Reader, options?: AbortOptions): Promise<Uin
const buf = await pipe(
input,
(source) => lp.decode(source, { onLength, maxDataLength: MAX_PROTOCOL_LENGTH }),
async (source) => await first(source)
async (source) => first(source)
)

if (buf == null || buf.length === 0) {
Expand Down
14 changes: 7 additions & 7 deletions src/select.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { logger } from '@libp2p/logger'
import { CodeError } from '@libp2p/interfaces/errors'
import * as multistream from './multistream.js'
import { logger } from '@libp2p/logger'
import { handshake } from 'it-handshake'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { PROTOCOL_ID } from './index.js'
import type { Duplex, Source } from 'it-stream-types'
import { Uint8ArrayList } from 'uint8arraylist'
import { pushable } from 'it-pushable'
import merge from 'it-merge'
import { pushable } from 'it-pushable'
import { reader } from 'it-reader'
import { Uint8ArrayList } from 'uint8arraylist'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import * as multistream from './multistream.js'
import { PROTOCOL_ID } from './index.js'
import type { ByteArrayInit, ByteListInit, MultistreamSelectInit, ProtocolStream } from './index.js'
import type { Duplex, Source } from 'it-stream-types'

const log = logger('libp2p:mss:select')

Expand Down
16 changes: 8 additions & 8 deletions test/dialer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
/* eslint max-nested-callbacks: ["error", 5] */

import { expect } from 'aegir/chai'
import { pipe } from 'it-pipe'
import randomBytes from 'iso-random-stream/src/random.js'
import all from 'it-all'
import { Uint8ArrayList } from 'uint8arraylist'
import { pair } from 'it-pair'
import { pipe } from 'it-pipe'
import { reader } from 'it-reader'
import pTimeout from 'p-timeout'
import randomBytes from 'iso-random-stream/src/random.js'
import * as Multistream from '../src/multistream.js'
import * as mss from '../src/index.js'
import { Uint8ArrayList } from 'uint8arraylist'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import * as mss from '../src/index.js'
import * as Multistream from '../src/multistream.js'

describe('Dialer', () => {
describe('dialer.select', () => {
Expand All @@ -26,7 +26,7 @@ describe('Dialer', () => {

// Ensure stream is usable after selection
const input = [randomBytes(10), randomBytes(64), randomBytes(3)]
const output = await pipe(input, selection.stream, async (source) => await all(source))
const output = await pipe(input, selection.stream, async (source) => all(source))
expect(new Uint8ArrayList(...output).slice()).to.eql(new Uint8ArrayList(...input).slice())
})

Expand Down Expand Up @@ -90,7 +90,7 @@ describe('Dialer', () => {

// Ensure stream is usable after selection
const input = [new Uint8ArrayList(randomBytes(10), randomBytes(64), randomBytes(3))]
const output = await pipe(input, selection.stream, async (source) => await all(source))
const output = await pipe(input, selection.stream, async (source) => all(source))
expect(new Uint8ArrayList(...output).slice()).to.eql(new Uint8ArrayList(...input).slice())
})

Expand Down Expand Up @@ -132,7 +132,7 @@ describe('Dialer', () => {

// Ensure stream is usable after selection
const input = [randomBytes(10), randomBytes(64), randomBytes(3)]
const output = await pipe(input, selection.stream, async (source) => await all(source))
const output = await pipe(input, selection.stream, async (source) => all(source))
expect(new Uint8ArrayList(...output).slice()).to.eql(new Uint8ArrayList(...input).slice())
})
})
Expand Down
18 changes: 9 additions & 9 deletions test/integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import { pipe } from 'it-pipe'
import randomBytes from 'iso-random-stream/src/random.js'
import all from 'it-all'
import { duplexPair } from 'it-pair/duplex'
import { pipe } from 'it-pipe'
import { Uint8ArrayList } from 'uint8arraylist'
import randomBytes from 'iso-random-stream/src/random.js'
import * as mss from '../src/index.js'
import { duplexPair } from 'it-pair/duplex'

describe('Dialer and Listener integration', () => {
it('should handle and select', async () => {
Expand All @@ -25,7 +25,7 @@ describe('Dialer and Listener integration', () => {
// Ensure stream is usable after selection
const input = [new Uint8ArrayList(randomBytes(10), randomBytes(64), randomBytes(3))]
const output = await Promise.all([
pipe(input, dialerSelection.stream, async (source) => await all(source)),
pipe(input, dialerSelection.stream, async (source) => all(source)),
pipe(listenerSelection.stream, listenerSelection.stream)
])
expect(new Uint8ArrayList(...output[0]).slice()).to.eql(new Uint8ArrayList(...input).slice())
Expand All @@ -38,7 +38,7 @@ describe('Dialer and Listener integration', () => {

const [listenerSelection, dialerSelection] = await Promise.all([
mss.handle(pair[1], selectedProtocol),
(async () => await mss.select(pair[0], selectedProtocol))()
(async () => mss.select(pair[0], selectedProtocol))()
])

expect(dialerSelection.protocol).to.equal(selectedProtocol)
Expand All @@ -47,7 +47,7 @@ describe('Dialer and Listener integration', () => {
// Ensure stream is usable after selection
const input = [new Uint8ArrayList(randomBytes(10), randomBytes(64), randomBytes(3))]
const output = await Promise.all([
pipe(input, dialerSelection.stream, async (source) => await all(source)),
pipe(input, dialerSelection.stream, async (source) => all(source)),
pipe(listenerSelection.stream, listenerSelection.stream)
])
expect(new Uint8ArrayList(...output[0]).slice()).to.eql(new Uint8ArrayList(...input).slice())
Expand All @@ -69,7 +69,7 @@ describe('Dialer and Listener integration', () => {
// Ensure stream is usable after selection
const input = [randomBytes(10), randomBytes(64), randomBytes(3)]
const output = await Promise.all([
pipe(input, dialerSelection.stream, async (source) => await all(source)),
pipe(input, dialerSelection.stream, async (source) => all(source)),
pipe(listenerSelection.stream, listenerSelection.stream)
])
expect(new Uint8ArrayList(...output[0]).slice()).to.eql(new Uint8ArrayList(...input).slice())
Expand All @@ -85,7 +85,7 @@ describe('Dialer and Listener integration', () => {
// Ensure stream is usable after selection
const input = [new Uint8ArrayList(randomBytes(10), randomBytes(64), randomBytes(3))]
// Since the stream is lazy, we need to write to it before handling
const dialerOutPromise = pipe(input, dialerSelection.stream, async source => await all(source))
const dialerOutPromise = pipe(input, dialerSelection.stream, async source => all(source))

const listenerSelection = await mss.handle(pair[1], protocol)
expect(listenerSelection.protocol).to.equal(protocol)
Expand All @@ -106,7 +106,7 @@ describe('Dialer and Listener integration', () => {
// Ensure stream is usable after selection
const input = [new Uint8ArrayList(randomBytes(10), randomBytes(64), randomBytes(3))]
// Since the stream is lazy, we need to write to it before handling
const dialerResultPromise = pipe(input, dialerSelection.stream, async source => await all(source))
const dialerResultPromise = pipe(input, dialerSelection.stream, async source => all(source))

// The error message from this varies depending on how much data got
// written when the dialer receives the `na` response and closes the
Expand Down
14 changes: 7 additions & 7 deletions test/listener.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/* eslint-env mocha */

import { expect } from 'aegir/chai'
import { pipe } from 'it-pipe'
import { Uint8ArrayList } from 'uint8arraylist'
import { reader } from 'it-reader'
import randomBytes from 'iso-random-stream/src/random.js'
import all from 'it-all'
import * as Lp from 'it-length-prefixed'
import * as Multistream from '../src/multistream.js'
import randomBytes from 'iso-random-stream/src/random.js'
import map from 'it-map'
import { pipe } from 'it-pipe'
import { reader } from 'it-reader'
import { Uint8ArrayList } from 'uint8arraylist'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
import * as mss from '../src/index.js'
import map from 'it-map'
import * as Multistream from '../src/multistream.js'
import type { Duplex, Source } from 'it-stream-types'

describe('Listener', () => {
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Listener', () => {
(source) => Lp.decode(source),
// Stringify and remove the newline
(source) => map(source, (buf) => uint8ArrayToString(buf.subarray()).trim()),
async (source) => await all(source)
async (source) => all(source)
)

expect(lsProtocols).to.deep.equal(handledProtocols)
Expand Down
12 changes: 6 additions & 6 deletions test/multistream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* eslint max-nested-callbacks: ["error", 6] */

import { expect } from 'aegir/chai'
import * as Varint from 'varint'
import { Uint8ArrayList } from 'uint8arraylist'
import all from 'it-all'
import { pushable } from 'it-pushable'
import { reader } from 'it-reader'
import * as Multistream from '../src/multistream.js'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import { Uint8ArrayList } from 'uint8arraylist'
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
import { pushable } from 'it-pushable'
import all from 'it-all'
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
import * as Varint from 'varint'
import * as Multistream from '../src/multistream.js'

describe('Multistream', () => {
describe('Multistream.encode', () => {
Expand Down