From 4cdba4fda743e7805725f4155242b93bc74ba4ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 May 2023 12:30:38 +0100 Subject: [PATCH] deps: update all deps and fix linting * deps(dev): bump aegir from 38.1.8 to 39.0.8 Bumps [aegir](https://github.com/ipfs/aegir) from 38.1.8 to 39.0.8. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md) - [Commits](https://github.com/ipfs/aegir/compare/v38.1.8...v39.0.8) --- updated-dependencies: - dependency-name: aegir dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * chore: update all deps and fix linting --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: achingbrain --- package.json | 2 +- packages/interop/package.json | 24 ++++---- packages/interop/test/dht.spec.ts | 61 +++++++++++-------- .../test/fixtures/create-helia.browser.ts | 31 +++------- .../interop/test/fixtures/create-helia.ts | 11 ++-- packages/interop/test/fixtures/create-kubo.ts | 6 +- .../interop/test/fixtures/create-peer-ids.ts | 8 +-- packages/interop/test/pubsub.spec.ts | 42 +++++++------ packages/ipns/package.json | 5 +- packages/ipns/src/index.ts | 30 ++++----- packages/ipns/src/routing/dht.ts | 4 +- packages/ipns/src/routing/index.ts | 4 +- packages/ipns/src/routing/local-store.ts | 8 +-- packages/ipns/src/routing/pubsub.ts | 22 ++++--- .../src/utils/resolve-dns-link.browser.ts | 4 +- packages/ipns/src/utils/resolve-dns-link.ts | 6 +- packages/ipns/test/publish.spec.ts | 8 +-- packages/ipns/test/resolve.spec.ts | 16 ++--- 18 files changed, 147 insertions(+), 145 deletions(-) diff --git a/package.json b/package.json index 46be185..059fda1 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "release": "npm run docs:no-publish && aegir run release && npm run docs" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.8" }, "type": "module", "workspaces": [ diff --git a/packages/interop/package.json b/packages/interop/package.json index 6915127..edc05fd 100644 --- a/packages/interop/package.json +++ b/packages/interop/package.json @@ -52,29 +52,31 @@ "test:electron-main": "aegir test -t electron-main" }, "devDependencies": { - "@chainsafe/libp2p-gossipsub": "^6.1.0", - "@chainsafe/libp2p-noise": "^11.0.0", - "@chainsafe/libp2p-yamux": "^3.0.5", + "@chainsafe/libp2p-gossipsub": "^8.0.0", + "@chainsafe/libp2p-noise": "^12.0.1", + "@chainsafe/libp2p-yamux": "^4.0.2", "@helia/interface": "^1.0.0", "@helia/ipns": "^1.0.0", + "@libp2p/interface-libp2p": "^3.2.0", "@libp2p/interface-peer-id": "^2.0.1", - "@libp2p/kad-dht": "^8.0.0", + "@libp2p/interface-pubsub": "^4.0.1", + "@libp2p/kad-dht": "^9.3.4", "@libp2p/peer-id": "^2.0.1", "@libp2p/peer-id-factory": "^2.0.1", - "@libp2p/tcp": "^6.1.2", - "@libp2p/websockets": "^5.0.3", - "aegir": "^38.1.0", + "@libp2p/tcp": "^7.0.1", + "@libp2p/websockets": "^6.0.1", + "aegir": "^39.0.8", "blockstore-core": "^4.0.1", "datastore-core": "^9.0.3", - "go-ipfs": "^0.19.0", + "go-ipfs": "^0.20.0", "helia": "^1.0.0", "ipfsd-ctl": "^13.0.0", "ipns": "^6.0.0", - "it-all": "^2.0.0", + "it-all": "^3.0.2", "it-last": "^3.0.1", - "it-map": "^2.0.0", + "it-map": "^3.0.3", "kubo-rpc-client": "^3.0.0", - "libp2p": "^0.43.2", + "libp2p": "^0.45.3", "merge-options": "^3.0.4", "multiformats": "^11.0.1", "uint8arrays": "^4.0.3", diff --git a/packages/interop/test/dht.spec.ts b/packages/interop/test/dht.spec.ts index 053424d..638d15c 100644 --- a/packages/interop/test/dht.spec.ts +++ b/packages/interop/test/dht.spec.ts @@ -1,31 +1,33 @@ /* eslint-env mocha */ -import { expect } from 'aegir/chai' -import { createHeliaNode } from './fixtures/create-helia.js' -import { createKuboNode } from './fixtures/create-kubo.js' -import type { Helia } from '@helia/interface' -import type { Controller } from 'ipfsd-ctl' -import { sha256 } from 'multiformats/hashes/sha2' -import { CID } from 'multiformats/cid' -import * as raw from 'multiformats/codecs/raw' -import type { IPNS } from '@helia/ipns' import { ipns } from '@helia/ipns' import { dht } from '@helia/ipns/routing' -import last from 'it-last' -import { kadDHT } from '@libp2p/kad-dht' -import { ipnsValidator } from 'ipns/validator' -import { ipnsSelector } from 'ipns/selector' +import { type KadDHT, kadDHT } from '@libp2p/kad-dht' import { createEd25519PeerId } from '@libp2p/peer-id-factory' -import { sortClosestPeers } from './fixtures/create-peer-ids.js' -import type { PeerId } from 'kubo-rpc-client/dist/src/types.js' +import { expect } from 'aegir/chai' +import { ipnsSelector } from 'ipns/selector' +import { ipnsValidator } from 'ipns/validator' +import last from 'it-last' +import { identifyService } from 'libp2p/identify' +import { CID } from 'multiformats/cid' +import * as raw from 'multiformats/codecs/raw' +import { sha256 } from 'multiformats/hashes/sha2' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { waitFor } from './fixtures/wait-for.js' -import { connect } from './fixtures/connect.js' import { isElectronMain } from 'wherearewe' +import { connect } from './fixtures/connect.js' +import { createHeliaNode } from './fixtures/create-helia.js' +import { createKuboNode } from './fixtures/create-kubo.js' +import { sortClosestPeers } from './fixtures/create-peer-ids.js' +import { waitFor } from './fixtures/wait-for.js' +import type { Helia } from '@helia/interface' +import type { IPNS } from '@helia/ipns' +import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Controller } from 'ipfsd-ctl' +import type { PeerId } from 'kubo-rpc-client/dist/src/types.js' describe('dht routing', () => { - let helia: Helia + let helia: Helia> let kubo: Controller let name: IPNS @@ -46,14 +48,19 @@ describe('dht routing', () => { value = CID.createV1(raw.code, digest) helia = await createHeliaNode({ - dht: kadDHT({ - validators: { - ipns: ipnsValidator - }, - selectors: { - ipns: ipnsSelector - } - }) + services: { + identify: identifyService(), + dht: kadDHT({ + validators: { + ipns: ipnsValidator + }, + selectors: { + ipns: ipnsSelector + }, + // skips waiting for the initial self-query to find peers + allowQueryWithZeroPeers: true + }) + } }) kubo = await createKuboNode() @@ -86,7 +93,7 @@ describe('dht routing', () => { await waitFor(async () => { let found = false - for await (const event of helia.libp2p.dht.findPeer(kubo.peer.id)) { + for await (const event of helia.libp2p.services.dht.findPeer(kubo.peer.id)) { if (event.name === 'FINAL_PEER') { found = true } diff --git a/packages/interop/test/fixtures/create-helia.browser.ts b/packages/interop/test/fixtures/create-helia.browser.ts index 62eb470..f24c351 100644 --- a/packages/interop/test/fixtures/create-helia.browser.ts +++ b/packages/interop/test/fixtures/create-helia.browser.ts @@ -1,18 +1,15 @@ -import { createHelia } from 'helia' -import { createLibp2p } from 'libp2p' -import { webSockets } from '@libp2p/websockets' -import { all } from '@libp2p/websockets/filters' import { noise } from '@chainsafe/libp2p-noise' import { yamux } from '@chainsafe/libp2p-yamux' +import { webSockets } from '@libp2p/websockets' +import { all } from '@libp2p/websockets/filters' import { MemoryBlockstore } from 'blockstore-core' import { MemoryDatastore } from 'datastore-core' +import { createHelia } from 'helia' +import { createLibp2p, type Libp2pOptions } from 'libp2p' import type { Helia } from '@helia/interface' -import { kadDHT } from '@libp2p/kad-dht' -import { gossipsub } from '@chainsafe/libp2p-gossipsub' -import { ipnsValidator } from 'ipns/validator' -import { ipnsSelector } from 'ipns/selector' +import type { Libp2p } from '@libp2p/interface-libp2p' -export async function createHeliaNode (): Promise { +export async function createHeliaNode (config: Libp2pOptions = {}): Promise>> { const blockstore = new MemoryBlockstore() const datastore = new MemoryDatastore() @@ -29,19 +26,11 @@ export async function createHeliaNode (): Promise { streamMuxers: [ yamux() ], - dht: kadDHT({ - validators: { - ipns: ipnsValidator - }, - selectors: { - ipns: ipnsSelector - } - }), - pubsub: gossipsub(), datastore, - nat: { - enabled: false - } + connectionGater: { + denyDialMultiaddr: async () => false + }, + ...config }) const helia = await createHelia({ diff --git a/packages/interop/test/fixtures/create-helia.ts b/packages/interop/test/fixtures/create-helia.ts index e2076c5..9ffe4c7 100644 --- a/packages/interop/test/fixtures/create-helia.ts +++ b/packages/interop/test/fixtures/create-helia.ts @@ -1,13 +1,13 @@ -import { createHelia } from 'helia' -import { createLibp2p, Libp2pOptions } from 'libp2p' -import { tcp } from '@libp2p/tcp' import { noise } from '@chainsafe/libp2p-noise' import { yamux } from '@chainsafe/libp2p-yamux' +import { tcp } from '@libp2p/tcp' import { MemoryBlockstore } from 'blockstore-core' import { MemoryDatastore } from 'datastore-core' +import { createHelia } from 'helia' +import { createLibp2p, type Libp2p, type Libp2pOptions } from 'libp2p' import type { Helia } from '@helia/interface' -export async function createHeliaNode (config: Libp2pOptions = {}): Promise { +export async function createHeliaNode (config: Libp2pOptions = {}): Promise>> { const blockstore = new MemoryBlockstore() const datastore = new MemoryDatastore() @@ -27,9 +27,6 @@ export async function createHeliaNode (config: Libp2pOptions = {}): Promise = {}): Promise { const opts = mergeOptions({ @@ -24,5 +24,5 @@ export async function createKuboNode (options: ControllerOptions<'go'> = {}): Pr } }, options) - return await createController(opts) + return createController(opts) } diff --git a/packages/interop/test/fixtures/create-peer-ids.ts b/packages/interop/test/fixtures/create-peer-ids.ts index c38834e..36403d8 100644 --- a/packages/interop/test/fixtures/create-peer-ids.ts +++ b/packages/interop/test/fixtures/create-peer-ids.ts @@ -1,9 +1,9 @@ -import { xor as uint8ArrayXor } from 'uint8arrays/xor' -import { compare as uint8ArrayCompare } from 'uint8arrays/compare' import all from 'it-all' import map from 'it-map' -import type { PeerId } from '@libp2p/interface-peer-id' import { sha256 } from 'multiformats/hashes/sha2' +import { compare as uint8ArrayCompare } from 'uint8arrays/compare' +import { xor as uint8ArrayXor } from 'uint8arrays/xor' +import type { PeerId } from '@libp2p/interface-peer-id' /** * Sort peers by distance to the KadID of the passed buffer @@ -33,7 +33,7 @@ export async function sortClosestPeers (buf: Uint8Array, peers: PeerId[]): Promi * Creates a DHT ID by hashing a Peer ID */ export async function convertPeerId (peerId: PeerId): Promise { - return await convertBuffer(peerId.toBytes()) + return convertBuffer(peerId.toBytes()) } /** diff --git a/packages/interop/test/pubsub.spec.ts b/packages/interop/test/pubsub.spec.ts index 0245383..5e31573 100644 --- a/packages/interop/test/pubsub.spec.ts +++ b/packages/interop/test/pubsub.spec.ts @@ -1,37 +1,43 @@ /* eslint-env mocha */ +import { gossipsub } from '@chainsafe/libp2p-gossipsub' +import { ipns } from '@helia/ipns' +import { pubsub } from '@helia/ipns/routing' +import { peerIdFromKeys } from '@libp2p/peer-id' import { expect } from 'aegir/chai' -import { createHeliaNode } from './fixtures/create-helia.js' -import { createKuboNode } from './fixtures/create-kubo.js' -import type { Helia } from '@helia/interface' -import type { Controller } from 'ipfsd-ctl' -import { sha256 } from 'multiformats/hashes/sha2' +import last from 'it-last' +import { identifyService } from 'libp2p/identify' +import { base36 } from 'multiformats/bases/base36' import { CID } from 'multiformats/cid' import * as raw from 'multiformats/codecs/raw' import { identity } from 'multiformats/hashes/identity' -import { base36 } from 'multiformats/bases/base36' -import type { IPNS } from '@helia/ipns' -import { ipns } from '@helia/ipns' -import { pubsub } from '@helia/ipns/routing' -import last from 'it-last' -import { peerIdFromKeys } from '@libp2p/peer-id' -import { gossipsub } from '@chainsafe/libp2p-gossipsub' -import { waitFor } from './fixtures/wait-for.js' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { sha256 } from 'multiformats/hashes/sha2' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { connect } from './fixtures/connect.js' +import { createHeliaNode } from './fixtures/create-helia.js' +import { createKuboNode } from './fixtures/create-kubo.js' +import { waitFor } from './fixtures/wait-for.js' +import type { Helia } from '@helia/interface' +import type { IPNS } from '@helia/ipns' +import type { PubSub } from '@libp2p/interface-pubsub' +import type { Controller } from 'ipfsd-ctl' +import type { Libp2p } from 'libp2p' const LIBP2P_KEY_CODEC = 0x72 describe('pubsub routing', () => { - let helia: Helia + let helia: Helia> let kubo: Controller let name: IPNS beforeEach(async () => { helia = await createHeliaNode({ - pubsub: gossipsub() + services: { + identify: identifyService(), + pubsub: gossipsub() + } }) kubo = await createKuboNode({ ipfsOptions: { @@ -130,7 +136,7 @@ describe('pubsub routing', () => { // wait for helia to be subscribed to the topic for record updates await waitFor(async () => { - return helia.libp2p.pubsub.getTopics().includes(subscriptionName) + return helia.libp2p.services.pubsub.getTopics().includes(subscriptionName) }, { timeout: 30000, message: 'Helia did not register for record updates' diff --git a/packages/ipns/package.json b/packages/ipns/package.json index 07327db..86fb344 100644 --- a/packages/ipns/package.json +++ b/packages/ipns/package.json @@ -160,9 +160,8 @@ }, "dependencies": { "@libp2p/interface-content-routing": "^2.1.0", - "@libp2p/interface-dht": "^2.0.1", "@libp2p/interface-peer-id": "^2.0.1", - "@libp2p/interface-pubsub": "^3.0.6", + "@libp2p/interface-pubsub": "^4.0.1", "@libp2p/interfaces": "^3.3.1", "@libp2p/logger": "^2.0.6", "@libp2p/peer-id": "^2.0.1", @@ -178,7 +177,7 @@ }, "devDependencies": { "@libp2p/peer-id-factory": "^2.0.1", - "aegir": "^38.1.0", + "aegir": "^39.0.8", "datastore-core": "^9.0.3", "sinon": "^15.0.1", "sinon-ts": "^1.0.0" diff --git a/packages/ipns/src/index.ts b/packages/ipns/src/index.ts index 932361b..9d89b63 100644 --- a/packages/ipns/src/index.ts +++ b/packages/ipns/src/index.ts @@ -62,24 +62,24 @@ * ``` */ -import type { AbortOptions } from '@libp2p/interfaces' -import { isPeerId, PeerId } from '@libp2p/interface-peer-id' +import { isPeerId, type PeerId } from '@libp2p/interface-peer-id' +import { CodeError } from '@libp2p/interfaces/errors' +import { logger } from '@libp2p/logger' +import { peerIdFromString } from '@libp2p/peer-id' import { create, marshal, peerIdToRoutingKey, unmarshal } from 'ipns' -import type { IPNSEntry } from 'ipns' -import type { IPNSRouting, IPNSRoutingEvents } from './routing/index.js' -import { ipnsValidator } from 'ipns/validator' import { ipnsSelector } from 'ipns/selector' +import { ipnsValidator } from 'ipns/validator' import { CID } from 'multiformats/cid' -import { resolveDnslink } from './utils/resolve-dns-link.js' -import { logger } from '@libp2p/logger' -import { peerIdFromString } from '@libp2p/peer-id' -import type { ProgressEvent, ProgressOptions } from 'progress-events' import { CustomProgressEvent } from 'progress-events' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import { localStore, type LocalStore } from './routing/local-store.js' +import { resolveDnslink } from './utils/resolve-dns-link.js' +import type { IPNSRouting, IPNSRoutingEvents } from './routing/index.js' +import type { AbortOptions } from '@libp2p/interfaces' import type { Datastore } from 'interface-datastore' -import { localStore, LocalStore } from './routing/local-store.js' -import { CodeError } from '@libp2p/interfaces/errors' +import type { IPNSEntry } from 'ipns' +import type { ProgressEvent, ProgressOptions } from 'progress-events' const log = logger('helia:ipns') @@ -223,13 +223,13 @@ class DefaultIPNS implements IPNS { const record = await this.#findIpnsRecord(routingKey, options) const str = uint8ArrayToString(record.value) - return await this.#resolve(str, options) + return this.#resolve(str, options) } async resolveDns (domain: string, options: ResolveDNSOptions = {}): Promise { const dnslink = await resolveDnslink(domain, options) - return await this.#resolve(dnslink, options) + return this.#resolve(dnslink, options) } republish (options: RepublishOptions = {}): void { @@ -275,7 +275,7 @@ class DefaultIPNS implements IPNS { const scheme = parts[1] if (scheme === 'ipns') { - return await this.resolve(peerIdFromString(parts[2]), options) + return this.resolve(peerIdFromString(parts[2]), options) } else if (scheme === 'ipfs') { return CID.parse(parts[2]) } diff --git a/packages/ipns/src/routing/dht.ts b/packages/ipns/src/routing/dht.ts index 93215f9..2b970cb 100644 --- a/packages/ipns/src/routing/dht.ts +++ b/packages/ipns/src/routing/dht.ts @@ -1,6 +1,6 @@ -import type { IPNSRouting } from '../index.js' +import { CustomProgressEvent, type ProgressEvent } from 'progress-events' import type { GetOptions, PutOptions } from './index.js' -import { CustomProgressEvent, ProgressEvent } from 'progress-events' +import type { IPNSRouting } from '../index.js' import type { ContentRouting } from '@libp2p/interface-content-routing' export interface DHTRoutingComponents { diff --git a/packages/ipns/src/routing/index.ts b/packages/ipns/src/routing/index.ts index 3837487..bc0659b 100644 --- a/packages/ipns/src/routing/index.ts +++ b/packages/ipns/src/routing/index.ts @@ -1,8 +1,8 @@ -import type { ProgressOptions } from 'progress-events' -import type { AbortOptions } from '@libp2p/interfaces' import type { DHTProgressEvents } from './dht.js' import type { DatastoreProgressEvents } from './local-store.js' import type { PubSubProgressEvents } from './pubsub.js' +import type { AbortOptions } from '@libp2p/interfaces' +import type { ProgressOptions } from 'progress-events' export interface PutOptions extends AbortOptions, ProgressOptions { diff --git a/packages/ipns/src/routing/local-store.ts b/packages/ipns/src/routing/local-store.ts index f9c1dbc..eef3f41 100644 --- a/packages/ipns/src/routing/local-store.ts +++ b/packages/ipns/src/routing/local-store.ts @@ -1,9 +1,9 @@ -import { CustomProgressEvent, ProgressEvent } from 'progress-events' -import type { AbortOptions } from '@libp2p/interfaces' import { Libp2pRecord } from '@libp2p/record' -import { Datastore, Key } from 'interface-datastore' +import { type Datastore, Key } from 'interface-datastore' +import { CustomProgressEvent, type ProgressEvent } from 'progress-events' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import type { GetOptions, IPNSRouting, PutOptions } from '../routing' +import type { AbortOptions } from '@libp2p/interfaces' function dhtRoutingKey (key: Uint8Array): Key { return new Key('/dht/record/' + uint8ArrayToString(key, 'base32'), false) @@ -57,7 +57,7 @@ export function localStore (datastore: Datastore): LocalStore { }, async has (routingKey: Uint8Array, options: AbortOptions = {}): Promise { const key = dhtRoutingKey(routingKey) - return await datastore.has(key, options) + return datastore.has(key, options) } } } diff --git a/packages/ipns/src/routing/pubsub.ts b/packages/ipns/src/routing/pubsub.ts index bb10e30..83a57e4 100644 --- a/packages/ipns/src/routing/pubsub.ts +++ b/packages/ipns/src/routing/pubsub.ts @@ -1,17 +1,17 @@ +import { CodeError } from '@libp2p/interfaces/errors' +import { logger } from '@libp2p/logger' import { peerIdToRoutingKey } from 'ipns' +import { ipnsSelector } from 'ipns/selector' +import { ipnsValidator } from 'ipns/validator' +import { CustomProgressEvent, type ProgressEvent } from 'progress-events' +import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { logger } from '@libp2p/logger' +import { localStore, type LocalStore } from './local-store.js' +import type { GetOptions, IPNSRouting, PutOptions } from './index.js' import type { PeerId } from '@libp2p/interface-peer-id' import type { Message, PublishResult, PubSub } from '@libp2p/interface-pubsub' import type { Datastore } from 'interface-datastore' -import type { GetOptions, IPNSRouting, PutOptions } from './index.js' -import { CodeError } from '@libp2p/interfaces/errors' -import { localStore, LocalStore } from './local-store.js' -import { ipnsValidator } from 'ipns/validator' -import { ipnsSelector } from 'ipns/selector' -import { equals as uint8ArrayEquals } from 'uint8arrays/equals' -import { CustomProgressEvent, ProgressEvent } from 'progress-events' const log = logger('helia:ipns:routing:pubsub') @@ -19,7 +19,9 @@ export interface PubsubRoutingComponents { datastore: Datastore libp2p: { peerId: PeerId - pubsub: PubSub + services: { + pubsub: PubSub + } } } @@ -46,7 +48,7 @@ class PubSubRouting implements IPNSRouting { this.subscriptions = [] this.localStore = localStore(components.datastore) this.peerId = components.libp2p.peerId - this.pubsub = components.libp2p.pubsub + this.pubsub = components.libp2p.services.pubsub this.pubsub.addEventListener('message', (evt) => { const message = evt.detail diff --git a/packages/ipns/src/utils/resolve-dns-link.browser.ts b/packages/ipns/src/utils/resolve-dns-link.browser.ts index 459f387..4035ca6 100644 --- a/packages/ipns/src/utils/resolve-dns-link.browser.ts +++ b/packages/ipns/src/utils/resolve-dns-link.browser.ts @@ -1,7 +1,7 @@ /* eslint-env browser */ -import { TLRU } from './tlru.js' import PQueue from 'p-queue' +import { TLRU } from './tlru.js' import type { AbortOptions } from '@libp2p/interfaces' // Avoid sending multiple queries for the same hostname by caching results @@ -57,5 +57,5 @@ export async function resolveDnslink (fqdn: string, opts: ResolveDnsLinkOptions return ipfsPath(response) } - return await resolve(fqdn, opts) + return resolve(fqdn, opts) } diff --git a/packages/ipns/src/utils/resolve-dns-link.ts b/packages/ipns/src/utils/resolve-dns-link.ts index 34ec034..d77cf2d 100644 --- a/packages/ipns/src/utils/resolve-dns-link.ts +++ b/packages/ipns/src/utils/resolve-dns-link.ts @@ -1,12 +1,12 @@ import dns from 'dns' import { promisify } from 'util' -import type { AbortOptions } from '@libp2p/interfaces' import * as isIPFS from 'is-ipfs' +import type { AbortOptions } from '@libp2p/interfaces' const MAX_RECURSIVE_DEPTH = 32 export async function resolveDnslink (domain: string, options: AbortOptions = {}): Promise { - return await recursiveResolveDnslink(domain, MAX_RECURSIVE_DEPTH, options) + return recursiveResolveDnslink(domain, MAX_RECURSIVE_DEPTH, options) } async function recursiveResolveDnslink (domain: string, depth: number, options: AbortOptions = {}): Promise { @@ -44,7 +44,7 @@ async function recursiveResolveDnslink (domain: string, depth: number, options: return result } - return await recursiveResolveDnslink(domainOrCID, depth - 1, options) + return recursiveResolveDnslink(domainOrCID, depth - 1, options) } async function resolve (domain: string, options: AbortOptions = {}): Promise { diff --git a/packages/ipns/test/publish.spec.ts b/packages/ipns/test/publish.spec.ts index 3e8b7aa..184e835 100644 --- a/packages/ipns/test/publish.spec.ts +++ b/packages/ipns/test/publish.spec.ts @@ -1,13 +1,13 @@ /* eslint-env mocha */ +import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core' -import type { IPNS, IPNSRouting } from '../src/index.js' -import { ipns } from '../src/index.js' import { CID } from 'multiformats/cid' -import { createEd25519PeerId } from '@libp2p/peer-id-factory' import Sinon from 'sinon' -import { StubbedInstance, stubInterface } from 'sinon-ts' +import { type StubbedInstance, stubInterface } from 'sinon-ts' +import { ipns } from '../src/index.js' +import type { IPNS, IPNSRouting } from '../src/index.js' const cid = CID.parse('QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn') diff --git a/packages/ipns/test/resolve.spec.ts b/packages/ipns/test/resolve.spec.ts index 051e68b..f3b23e1 100644 --- a/packages/ipns/test/resolve.spec.ts +++ b/packages/ipns/test/resolve.spec.ts @@ -1,18 +1,18 @@ /* eslint-env mocha */ +import { createEd25519PeerId } from '@libp2p/peer-id-factory' +import { Libp2pRecord } from '@libp2p/record' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core' -import type { IPNS, IPNSRouting } from '../src/index.js' -import { ipns } from '../src/index.js' +import { type Datastore, Key } from 'interface-datastore' +import { create, marshal, peerIdToRoutingKey } from 'ipns' import { CID } from 'multiformats/cid' -import { createEd25519PeerId } from '@libp2p/peer-id-factory' import Sinon from 'sinon' -import { StubbedInstance, stubInterface } from 'sinon-ts' -import { create, marshal, peerIdToRoutingKey } from 'ipns' -import { Datastore, Key } from 'interface-datastore' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import { type StubbedInstance, stubInterface } from 'sinon-ts' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { Libp2pRecord } from '@libp2p/record' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import { ipns } from '../src/index.js' +import type { IPNS, IPNSRouting } from '../src/index.js' const cid = CID.parse('QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn')