diff --git a/package.json b/package.json index 935b6948..47f289ad 100644 --- a/package.json +++ b/package.json @@ -155,24 +155,24 @@ "@hapi/hapi": "^20.0.0", "@libp2p/interface-peer-id": "^1.0.4", "@libp2p/logger": "^2.0.0", - "@multiformats/multiaddr": "^10.1.8", + "@multiformats/multiaddr": "^11.0.0", "execa": "^6.1.0", "ipfs-utils": "^9.0.1", "joi": "^17.2.1", "merge-options": "^3.0.1", "nanoid": "^4.0.0", - "p-wait-for": "^4.1.0", + "p-wait-for": "^5.0.0", "temp-write": "^5.0.0", "wherearewe": "^2.0.1" }, "devDependencies": { "@types/hapi__hapi": "^20.0.9", "aegir": "^37.0.15", - "go-ipfs": "^0.13.0", - "ipfs": "^0.63.5", - "ipfs-client": "^0.8.3", - "ipfs-core-types": "^0.11.1", - "ipfs-http-client": "^57.0.3", + "go-ipfs": "^0.15.0", + "ipfs": "^0.64.0", + "ipfs-client": "^0.9.0", + "ipfs-core-types": "^0.12.0", + "ipfs-http-client": "^58.0.0", "util": "^0.12.4" }, "browser": { diff --git a/src/factory.js b/src/factory.js index 0c2958f6..198cd957 100644 --- a/src/factory.js +++ b/src/factory.js @@ -10,9 +10,9 @@ import testsConfig from './config.js' const merge = mergeOptions.bind({ ignoreUndefined: true }) /** - * @typedef {import("./types").ControllerOptions} ControllerOptions - * @typedef {import("./types").ControllerOptionsOverrides} ControllerOptionsOverrides - * @typedef {import("./types").IPFSOptions} IPFSOptions + * @typedef {import('./types').ControllerOptions} ControllerOptions + * @typedef {import('./types').ControllerOptionsOverrides} ControllerOptionsOverrides + * @typedef {import('./types').IPFSOptions} IPFSOptions * @typedef {import('./types').Controller} Controller */ diff --git a/src/ipfsd-client.js b/src/ipfsd-client.js index 528ab016..438991f6 100644 --- a/src/ipfsd-client.js +++ b/src/ipfsd-client.js @@ -1,4 +1,4 @@ -import { Multiaddr } from '@multiformats/multiaddr' +import { multiaddr } from '@multiformats/multiaddr' import http from 'ipfs-utils/src/http.js' import mergeOptions from 'merge-options' import { logger } from '@libp2p/logger' @@ -10,7 +10,10 @@ const daemonLog = { err: logger('ipfsd-ctl:client:stderr') } -/** @typedef {import("./index").ControllerOptions} ControllerOptions */ +/** + * @typedef {import('./index').ControllerOptions} ControllerOptions + * @typedef {import('@multiformats/multiaddr').Multiaddr} Multiaddr + */ /** * Controller for remote nodes @@ -61,7 +64,7 @@ class Client { */ _setApi (addr) { if (addr) { - this.apiAddr = new Multiaddr(addr) + this.apiAddr = multiaddr(addr) } } @@ -71,7 +74,7 @@ class Client { */ _setGateway (addr) { if (addr) { - this.gatewayAddr = new Multiaddr(addr) + this.gatewayAddr = multiaddr(addr) } } @@ -81,7 +84,7 @@ class Client { */ _setGrpc (addr) { if (addr) { - this.grpcAddr = new Multiaddr(addr) + this.grpcAddr = multiaddr(addr) } } diff --git a/src/ipfsd-daemon.js b/src/ipfsd-daemon.js index 9ad655f6..835af609 100644 --- a/src/ipfsd-daemon.js +++ b/src/ipfsd-daemon.js @@ -1,4 +1,4 @@ -import { Multiaddr } from '@multiformats/multiaddr' +import { multiaddr } from '@multiformats/multiaddr' import fs from 'fs/promises' import mergeOptions from 'merge-options' import { logger } from '@libp2p/logger' @@ -9,6 +9,10 @@ import os from 'os' import { checkForRunningApi, repoExists, tmpDir, defaultRepo, buildInitArgs, buildStartArgs } from './utils.js' import waitFor from 'p-wait-for' +/** + * @typedef {import('@multiformats/multiaddr').Multiaddr} Multiaddr + */ + const merge = mergeOptions.bind({ ignoreUndefined: true }) const daemonLog = { @@ -27,8 +31,8 @@ function translateError (err) { } /** - * @typedef {import("./types").ControllerOptions} ControllerOptions - * @typedef {import("./types").Controller} Controller + * @typedef {import('./types').ControllerOptions} ControllerOptions + * @typedef {import('./types').Controller} Controller */ /** @@ -74,7 +78,7 @@ class Daemon { * @param {string} addr */ _setApi (addr) { - this.apiAddr = new Multiaddr(addr) + this.apiAddr = multiaddr(addr) } /** @@ -82,7 +86,7 @@ class Daemon { * @param {string} addr */ _setGrpc (addr) { - this.grpcAddr = new Multiaddr(addr) + this.grpcAddr = multiaddr(addr) } /** @@ -90,7 +94,7 @@ class Daemon { * @param {string} addr */ _setGateway (addr) { - this.gatewayAddr = new Multiaddr(addr) + this.gatewayAddr = multiaddr(addr) } _createApi () { diff --git a/src/ipfsd-in-proc.js b/src/ipfsd-in-proc.js index 15a6970e..c2ee70ce 100644 --- a/src/ipfsd-in-proc.js +++ b/src/ipfsd-in-proc.js @@ -1,4 +1,4 @@ -import { Multiaddr } from '@multiformats/multiaddr' +import { multiaddr } from '@multiformats/multiaddr' import mergeOptions from 'merge-options' import { repoExists, removeRepo, checkForRunningApi, tmpDir, defaultRepo } from './utils.js' import { logger } from '@libp2p/logger' @@ -10,8 +10,9 @@ const daemonLog = { err: logger('ipfsd-ctl:proc:stderr') } /** - * @typedef {import("./types").ControllerOptions} ControllerOptions - * @typedef {import("./types").InitOptions} InitOptions + * @typedef {import('./types').ControllerOptions} ControllerOptions + * @typedef {import('./types').InitOptions} InitOptions + * @typedef {import('@multiformats/multiaddr').Multiaddr} Multiaddr */ /** @@ -66,7 +67,7 @@ class InProc { * @param {string} addr */ _setApi (addr) { - this.apiAddr = new Multiaddr(addr) + this.apiAddr = multiaddr(addr) this.api = this.opts.ipfsHttpModule.create(addr) this.api.apiHost = this.apiAddr.nodeAddress().address this.api.apiPort = this.apiAddr.nodeAddress().port diff --git a/test/controller.spec.js b/test/controller.spec.js index 2e3ba1d0..80b539b2 100644 --- a/test/controller.spec.js +++ b/test/controller.spec.js @@ -12,7 +12,7 @@ import * as ipfsHttpModule from 'ipfs-http-client' import * as goIpfsModule from 'go-ipfs' /** - * @typedef {import("../src/types").ControllerOptions} ControllerOptions + * @typedef {import('../src/types').ControllerOptions} ControllerOptions */ /**