From fbec4dcc0b0760186814f6eefccdbe48142b0a95 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 25 Jun 2020 17:03:59 +0100 Subject: [PATCH 01/12] feat: store blocks by multihash instead of CID Updates the `ipfs-repo` dep to a version that stores blocks by multihash instead of CID to support CIDv1 and CIDv0 access to the same block. --- docs/core-api/REFS.md | 2 +- examples/custom-ipfs-repo/package.json | 2 +- packages/interface-ipfs-core/src/block/rm.js | 4 ++-- .../interface-ipfs-core/src/refs-local.js | 7 ++++-- packages/ipfs/package.json | 2 +- packages/ipfs/src/cli/commands/refs-local.js | 22 ++++++++++++++----- packages/ipfs/src/cli/commands/refs.js | 8 +++---- .../ipfs/src/core/components/refs/local.js | 13 ++--------- packages/ipfs/src/core/components/repo/gc.js | 6 ++--- 9 files changed, 35 insertions(+), 31 deletions(-) diff --git a/docs/core-api/REFS.md b/docs/core-api/REFS.md index 81b6923f92..d3daaca39c 100644 --- a/docs/core-api/REFS.md +++ b/docs/core-api/REFS.md @@ -65,7 +65,7 @@ for await (const ref of ipfs.refs(ipfsPath, { recursive: true })) { ## `ipfs.refs.local([options])` -> Output all local references (CIDs of all blocks in the blockstore) +> Output all local references (base32 encoded multihashes of all blocks in the blockstore) ### Parameters diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json index 3123d0a4ca..4b96bf63d6 100644 --- a/examples/custom-ipfs-repo/package.json +++ b/examples/custom-ipfs-repo/package.json @@ -12,7 +12,7 @@ "dependencies": { "datastore-fs": "^1.1.0", "ipfs": "^0.47.0", - "ipfs-repo": "^3.0.0", + "ipfs-repo": "^4.0.0", "it-all": "^1.0.1" }, "devDependencies": { diff --git a/packages/interface-ipfs-core/src/block/rm.js b/packages/interface-ipfs-core/src/block/rm.js index 6b7a9630e3..13ddcb367b 100644 --- a/packages/interface-ipfs-core/src/block/rm.js +++ b/packages/interface-ipfs-core/src/block/rm.js @@ -40,7 +40,7 @@ module.exports = (common, options) => { // block should be present in the local store const localRefs = await all(ipfs.refs.local()) expect(localRefs).to.have.property('length').that.is.greaterThan(0) - expect(localRefs.find(ref => ref.ref === cid.toString())).to.be.ok() + expect(localRefs.find(ref => ref.ref === new CID(1, 'raw', cid.multihash).toString())).to.be.ok() const result = await all(ipfs.block.rm(cid)) expect(result).to.be.an('array').and.to.have.lengthOf(1) @@ -49,7 +49,7 @@ module.exports = (common, options) => { // did we actually remove the block? const localRefsAfterRemove = await all(ipfs.refs.local()) - expect(localRefsAfterRemove.find(ref => ref.ref === cid.toString())).to.not.be.ok() + expect(localRefsAfterRemove.find(ref => ref.ref === new CID(1, 'raw', cid.multihash).toString())).to.not.be.ok() }) it('should remove by CID in string', async () => { diff --git a/packages/interface-ipfs-core/src/refs-local.js b/packages/interface-ipfs-core/src/refs-local.js index d20851dee8..c5e3dd7f7d 100644 --- a/packages/interface-ipfs-core/src/refs-local.js +++ b/packages/interface-ipfs-core/src/refs-local.js @@ -7,6 +7,8 @@ const all = require('it-all') const importer = require('ipfs-unixfs-importer') const drain = require('it-drain') const testTimeout = require('./utils/test-timeout') +const multibase = require('multibase') +const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -54,8 +56,9 @@ module.exports = (common, options) => { const refs = await all(ipfs.refs.local()) const cids = refs.map(r => r.ref) - expect(cids).to.include('QmVwdDCY4SPGVFnNCiZnX5CtzwWDn6kAM98JXzKxE3kCmn') - expect(cids).to.include('QmR4nFjTu18TyANgC65ArNWp5Yaab1gPzQ4D8zp7Kx3vhr') + + expect(cids).to.deep.include(new CID(1, 'raw', imported[0].cid.multihash).toString()) + expect(cids).to.deep.include(new CID(1, 'raw', imported[1].cid.multihash).toString()) }) }) } diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index 7ae377017c..ed0f1cb75f 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -96,7 +96,7 @@ "ipfs-core-utils": "^0.2.4", "ipfs-http-client": "^44.3.0", "ipfs-http-response": "^0.5.0", - "ipfs-repo": "^3.0.0", + "ipfs-repo": "^4.0.0", "ipfs-unixfs": "^1.0.3", "ipfs-unixfs-exporter": "^2.0.2", "ipfs-unixfs-importer": "^2.0.2", diff --git a/packages/ipfs/src/cli/commands/refs-local.js b/packages/ipfs/src/cli/commands/refs-local.js index 5239251578..84d7daa286 100644 --- a/packages/ipfs/src/cli/commands/refs-local.js +++ b/packages/ipfs/src/cli/commands/refs-local.js @@ -1,27 +1,39 @@ 'use strict' const parseDuration = require('parse-duration') +const multibase = require('multibase') module.exports = { command: 'refs-local', describe: 'List all local references.', + epilog: 'CIDs are reconstructed therefore they might differ from those under which the blocks were originally stored.', + builder: { timeout: { type: 'string', coerce: parseDuration + }, + multihash: { + type: 'boolean', + default: false, + desc: 'Shows base32 encoded multihashes instead of reconstructed CIDs' } }, - async handler ({ ctx: { ipfs, print }, timeout }) { - for await (const ref of ipfs.refs.local({ + async handler ({ ctx: { ipfs, print }, timeout, cidBase, multihash }) { + for await (const { ref, err } of ipfs.refs.local({ timeout })) { - if (ref.err) { - print(ref.err, true, true) + if (err) { + print(err, true, true) } else { - print(ref.ref) + if (multihash) { + print(multibase.encode('base32', Buffer.from(ref)).toString().substring(1).toUpperCase()) + } else { + print(ref) + } } } } diff --git a/packages/ipfs/src/cli/commands/refs.js b/packages/ipfs/src/cli/commands/refs.js index b5c9eaf949..7178488816 100644 --- a/packages/ipfs/src/cli/commands/refs.js +++ b/packages/ipfs/src/cli/commands/refs.js @@ -48,11 +48,11 @@ module.exports = { const k = [key].concat(keys) - for await (const ref of ipfs.refs(k, { recursive, format, edges, unique, maxDepth, timeout })) { - if (ref.err) { - print(ref.err, true, true) + for await (const { err, ref } of ipfs.refs(k, { recursive, format, edges, unique, maxDepth, timeout })) { + if (err) { + print(err, true, true) } else { - print(ref.ref) + print(ref) } } } diff --git a/packages/ipfs/src/core/components/refs/local.js b/packages/ipfs/src/core/components/refs/local.js index 98805d5c07..871c5440dd 100644 --- a/packages/ipfs/src/core/components/refs/local.js +++ b/packages/ipfs/src/core/components/refs/local.js @@ -1,20 +1,11 @@ 'use strict' -const Repo = require('ipfs-repo') const { withTimeoutOption } = require('../../utils') module.exports = function ({ repo }) { return withTimeoutOption(async function * refsLocal (options = {}) { - for await (const result of repo.blocks.query({ keysOnly: true, signal: options.signal })) { - yield dsKeyToRef(result.key) + for await (const cid of repo.blocks.query({ keysOnly: true, signal: options.signal })) { + yield { ref: cid.toString() } } }) } - -function dsKeyToRef (key) { - try { - return { ref: Repo.utils.blockstore.keyToCid(key).toString() } - } catch (err) { - return { err: `Could not convert block with key '${key}' to CID: ${err.message}` } - } -} diff --git a/packages/ipfs/src/core/components/repo/gc.js b/packages/ipfs/src/core/components/repo/gc.js index 6b5fb33cb6..cb64ab3924 100644 --- a/packages/ipfs/src/core/components/repo/gc.js +++ b/packages/ipfs/src/core/components/repo/gc.js @@ -4,7 +4,6 @@ const CID = require('cids') const { cidToString } = require('../../../utils/cid') const log = require('debug')('ipfs:repo:gc') const { MFS_ROOT_KEY, withTimeoutOption } = require('../../utils') -const Repo = require('ipfs-repo') const { Errors } = require('interface-datastore') const ERR_NOT_FOUND = Errors.notFoundError().code const { parallelMerge, transform, map } = require('streaming-iterables') @@ -79,11 +78,10 @@ async function * deleteUnmarkedBlocks ({ repo, refs }, markedSet, blockKeys) { let blocksCount = 0 let removedBlocksCount = 0 - const removeBlock = async ({ key: k }) => { + const removeBlock = async (cid) => { blocksCount++ try { - const cid = Repo.utils.blockstore.keyToCid(k) const b32 = cid.toV1().toString('base32') if (markedSet.has(b32)) return null const res = { cid } @@ -97,7 +95,7 @@ async function * deleteUnmarkedBlocks ({ repo, refs }, markedSet, blockKeys) { return res } catch (err) { - const msg = `Could not convert block with key '${k}' to CID` + const msg = `Could delete block with CID ${cid}` log(msg, err) return { err: new Error(msg + `: ${err.message}`) } } From 5bfedda3bfe138901c8155f96a6560e5e4111e1f Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 25 Jun 2020 17:27:19 +0100 Subject: [PATCH 02/12] fix: linting --- packages/interface-ipfs-core/src/refs-local.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/interface-ipfs-core/src/refs-local.js b/packages/interface-ipfs-core/src/refs-local.js index c5e3dd7f7d..f75a041e80 100644 --- a/packages/interface-ipfs-core/src/refs-local.js +++ b/packages/interface-ipfs-core/src/refs-local.js @@ -7,7 +7,6 @@ const all = require('it-all') const importer = require('ipfs-unixfs-importer') const drain = require('it-drain') const testTimeout = require('./utils/test-timeout') -const multibase = require('multibase') const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ From dc8de124c69de997d2b32237c744e75ce966bbd8 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 25 Jun 2020 18:11:19 +0100 Subject: [PATCH 03/12] fix: test for multihash equality --- packages/interface-ipfs-core/src/refs-local.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/interface-ipfs-core/src/refs-local.js b/packages/interface-ipfs-core/src/refs-local.js index f75a041e80..78d004decd 100644 --- a/packages/interface-ipfs-core/src/refs-local.js +++ b/packages/interface-ipfs-core/src/refs-local.js @@ -56,8 +56,21 @@ module.exports = (common, options) => { const refs = await all(ipfs.refs.local()) const cids = refs.map(r => r.ref) - expect(cids).to.deep.include(new CID(1, 'raw', imported[0].cid.multihash).toString()) - expect(cids).to.deep.include(new CID(1, 'raw', imported[1].cid.multihash).toString()) + expect( + cids.find(cid => { + const multihash = new CID(cid).multihash + + return imported[0].cid.multihash.equals(multihash) + }) + ).to.be.ok() + + expect( + cids.find(cid => { + const multihash = new CID(cid).multihash + + return imported[1].cid.multihash.equals(multihash) + }) + ).to.be.ok() }) }) } From 8f8b7d20be0427a03d8ab36c3cfa184f308b97bd Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 25 Jun 2020 22:32:16 +0100 Subject: [PATCH 04/12] fix: gc tests --- packages/interface-ipfs-core/src/repo/gc.js | 42 +++++++++----------- packages/ipfs/src/core/components/repo/gc.js | 8 ++-- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/packages/interface-ipfs-core/src/repo/gc.js b/packages/interface-ipfs-core/src/repo/gc.js index 0c592379d2..ce305573b5 100644 --- a/packages/interface-ipfs-core/src/repo/gc.js +++ b/packages/interface-ipfs-core/src/repo/gc.js @@ -6,6 +6,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { DAGNode } = require('ipld-dag-pb') const all = require('it-all') const testTimeout = require('../utils/test-timeout') +const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -58,7 +59,7 @@ module.exports = (common, options) => { // the initial list and contain hash const refsAfterAdd = await all(ipfs.refs.local()) expect(refsAfterAdd.length).to.be.gt(refsBeforeAdd.length) - expect(refsAfterAdd.map(r => r.ref)).includes(cid.toString()) + expect(refsAfterAdd.map(r => new CID(r.ref).multihash)).deep.includes(cid.multihash) // Run garbage collection await all(ipfs.repo.gc()) @@ -66,7 +67,7 @@ module.exports = (common, options) => { // Get the list of local blocks after GC, should still contain the hash, // because the file is still pinned const refsAfterGc = await all(ipfs.refs.local()) - expect(refsAfterGc.map(r => r.ref)).includes(cid.toString()) + expect(refsAfterGc.map(r => new CID(r.ref).multihash)).deep.includes(cid.multihash) // Unpin the data await ipfs.pin.rm(cid) @@ -76,7 +77,7 @@ module.exports = (common, options) => { // The list of local blocks should no longer contain the hash const refsAfterUnpinAndGc = await all(ipfs.refs.local()) - expect(refsAfterUnpinAndGc.map(r => r.ref)).not.includes(cid.toString()) + expect(refsAfterUnpinAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(cid.multihash) }) it('should clean up removed MFS files', async () => { @@ -87,13 +88,12 @@ module.exports = (common, options) => { await ipfs.files.write('/test', Buffer.from('oranges'), { create: true }) const stats = await ipfs.files.stat('/test') expect(stats.type).to.equal('file') - const hash = stats.cid.toString() // Get the list of local blocks after the add, should be bigger than // the initial list and contain hash const refsAfterAdd = await all(ipfs.refs.local()) expect(refsAfterAdd.length).to.be.gt(refsBeforeAdd.length) - expect(refsAfterAdd.map(r => r.ref)).includes(hash) + expect(refsAfterAdd.map(r => new CID(r.ref).multihash)).deep.includes(stats.cid.multihash) // Run garbage collection await all(ipfs.repo.gc()) @@ -101,7 +101,7 @@ module.exports = (common, options) => { // Get the list of local blocks after GC, should still contain the hash, // because the file is in MFS const refsAfterGc = await all(ipfs.refs.local()) - expect(refsAfterGc.map(r => r.ref)).includes(hash) + expect(refsAfterGc.map(r => new CID(r.ref).multihash)).deep.includes(stats.cid.multihash) // Remove the file await ipfs.files.rm('/test') @@ -111,7 +111,7 @@ module.exports = (common, options) => { // The list of local blocks should no longer contain the hash const refsAfterUnpinAndGc = await all(ipfs.refs.local()) - expect(refsAfterUnpinAndGc.map(r => r.ref)).not.includes(hash) + expect(refsAfterUnpinAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(stats.cid.multihash) }) it('should clean up block only after unpinned and removed from MFS', async () => { @@ -135,8 +135,7 @@ module.exports = (common, options) => { // the initial list and contain the data hash const refsAfterAdd = await all(ipfs.refs.local()) expect(refsAfterAdd.length).to.be.gt(refsBeforeAdd.length) - const hashesAfterAdd = refsAfterAdd.map(r => r.ref) - expect(hashesAfterAdd).includes(dataCid.toString()) + expect(refsAfterAdd.map(r => new CID(r.ref).multihash)).deep.includes(dataCid.multihash) // Run garbage collection await all(ipfs.repo.gc()) @@ -144,8 +143,7 @@ module.exports = (common, options) => { // Get the list of local blocks after GC, should still contain the hash, // because the file is pinned and in MFS const refsAfterGc = await all(ipfs.refs.local()) - const hashesAfterGc = refsAfterGc.map(r => r.ref) - expect(hashesAfterGc).includes(dataCid.toString()) + expect(refsAfterGc.map(r => new CID(r.ref).multihash)).deep.includes(dataCid.multihash) // Remove the file await ipfs.files.rm('/test') @@ -156,9 +154,8 @@ module.exports = (common, options) => { // Get the list of local blocks after GC, should still contain the hash, // because the file is still pinned const refsAfterRmAndGc = await all(ipfs.refs.local()) - const hashesAfterRmAndGc = refsAfterRmAndGc.map(r => r.ref) - expect(hashesAfterRmAndGc).not.includes(mfsFileCid.toString()) - expect(hashesAfterRmAndGc).includes(dataCid.toString()) + expect(refsAfterRmAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(mfsFileCid.multihash) + expect(refsAfterRmAndGc.map(r => new CID(r.ref).multihash)).deep.includes(dataCid.multihash) // Unpin the data await ipfs.pin.rm(dataCid) @@ -168,9 +165,8 @@ module.exports = (common, options) => { // The list of local blocks should no longer contain the hashes const refsAfterUnpinAndGc = await all(ipfs.refs.local()) - const hashesAfterUnpinAndGc = refsAfterUnpinAndGc.map(r => r.ref) - expect(hashesAfterUnpinAndGc).not.includes(mfsFileCid.toString()) - expect(hashesAfterUnpinAndGc).not.includes(dataCid.toString()) + expect(refsAfterUnpinAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(mfsFileCid.multihash) + expect(refsAfterUnpinAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(dataCid.multihash) }) it('should clean up indirectly pinned data after recursive pin removal', async () => { @@ -201,9 +197,8 @@ module.exports = (common, options) => { // the initial list and contain data and object hash const refsAfterAdd = await all(ipfs.refs.local()) expect(refsAfterAdd.length).to.be.gt(refsBeforeAdd.length) - const hashesAfterAdd = refsAfterAdd.map(r => r.ref) - expect(hashesAfterAdd).includes(objCid.toString()) - expect(hashesAfterAdd).includes(dataCid.toString()) + expect(refsAfterAdd.map(r => new CID(r.ref).multihash)).deep.includes(objCid.multihash) + expect(refsAfterAdd.map(r => new CID(r.ref).multihash)).deep.includes(dataCid.multihash) // Recursively pin the object await ipfs.pin.add(objCid, { recursive: true }) @@ -218,7 +213,7 @@ module.exports = (common, options) => { // Get the list of local blocks after GC, should still contain the data // hash, because the data is still (indirectly) pinned const refsAfterGc = await all(ipfs.refs.local()) - expect(refsAfterGc.map(r => r.ref)).includes(dataCid.toString()) + expect(refsAfterGc.map(r => new CID(r.ref).multihash)).deep.includes(dataCid.multihash) // Recursively unpin the object await ipfs.pin.rm(objCid.toString()) @@ -228,9 +223,8 @@ module.exports = (common, options) => { // The list of local blocks should no longer contain the hashes const refsAfterUnpinAndGc = await all(ipfs.refs.local()) - const hashesAfterUnpinAndGc = refsAfterUnpinAndGc.map(r => r.ref) - expect(hashesAfterUnpinAndGc).not.includes(objCid.toString()) - expect(hashesAfterUnpinAndGc).not.includes(dataCid.toString()) + expect(refsAfterUnpinAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(objCid.multihash) + expect(refsAfterUnpinAndGc.map(r => new CID(r.ref).multihash)).not.deep.includes(dataCid.multihash) }) }) } diff --git a/packages/ipfs/src/core/components/repo/gc.js b/packages/ipfs/src/core/components/repo/gc.js index cb64ab3924..f840999225 100644 --- a/packages/ipfs/src/core/components/repo/gc.js +++ b/packages/ipfs/src/core/components/repo/gc.js @@ -1,12 +1,12 @@ 'use strict' const CID = require('cids') -const { cidToString } = require('../../../utils/cid') const log = require('debug')('ipfs:repo:gc') const { MFS_ROOT_KEY, withTimeoutOption } = require('../../utils') const { Errors } = require('interface-datastore') const ERR_NOT_FOUND = Errors.notFoundError().code const { parallelMerge, transform, map } = require('streaming-iterables') +const multibase = require('multibase') // Limit on the number of parallel block remove operations const BLOCK_RM_CONCURRENCY = 256 @@ -35,7 +35,7 @@ module.exports = ({ gcLock, pin, pinManager, refs, repo }) => { }) } -// Get Set of CIDs of blocks to keep +// Get Set of multihashes of blocks to keep async function createMarkedSet ({ pin, pinManager, refs, repo }) { const pinsSource = map(({ cid }) => cid, pin.ls()) @@ -66,7 +66,7 @@ async function createMarkedSet ({ pin, pinManager, refs, repo }) { const output = new Set() for await (const cid of parallelMerge(pinsSource, pinInternalsSource, mfsSource)) { - output.add(cidToString(cid, { base: 'base32' })) + output.add(multibase.encode('base32', cid.multihash).toString()) } return output } @@ -82,7 +82,7 @@ async function * deleteUnmarkedBlocks ({ repo, refs }, markedSet, blockKeys) { blocksCount++ try { - const b32 = cid.toV1().toString('base32') + const b32 = multibase.encode('base32', cid.multihash).toString() if (markedSet.has(b32)) return null const res = { cid } From dabb5c829a9786036f761dad4a6aab10a3a64810 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 26 Jun 2020 07:55:14 +0100 Subject: [PATCH 05/12] chore: update docs --- docs/core-api/REFS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/core-api/REFS.md b/docs/core-api/REFS.md index d3daaca39c..8a302fece3 100644 --- a/docs/core-api/REFS.md +++ b/docs/core-api/REFS.md @@ -65,7 +65,9 @@ for await (const ref of ipfs.refs(ipfsPath, { recursive: true })) { ## `ipfs.refs.local([options])` -> Output all local references (base32 encoded multihashes of all blocks in the blockstore) +> Output all local references (CIDs of all blocks in the blockstore) + +Blocks in the blockstore are stored by multihash and not CID so yielded CIDs are v1 CIDs with the 'raw' codec. These may not match the CID originally used to store a given block, though the multihash contained within the CID will. ### Parameters From 34c34a29694150dd61101f9a1db7e8836359119d Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 26 Jun 2020 08:14:38 +0100 Subject: [PATCH 06/12] chore: add test for multihash flag --- packages/ipfs/src/cli/commands/refs-local.js | 1 + packages/ipfs/test/cli/refs-local.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/packages/ipfs/src/cli/commands/refs-local.js b/packages/ipfs/src/cli/commands/refs-local.js index 84d7daa286..4c58e8238b 100644 --- a/packages/ipfs/src/cli/commands/refs-local.js +++ b/packages/ipfs/src/cli/commands/refs-local.js @@ -2,6 +2,7 @@ const parseDuration = require('parse-duration') const multibase = require('multibase') +const { Buffer } = require('buffer') module.exports = { command: 'refs-local', diff --git a/packages/ipfs/test/cli/refs-local.js b/packages/ipfs/test/cli/refs-local.js index 03da31f603..e655163c32 100644 --- a/packages/ipfs/test/cli/refs-local.js +++ b/packages/ipfs/test/cli/refs-local.js @@ -4,6 +4,8 @@ const { expect } = require('interface-ipfs-core/src/utils/mocha') const cli = require('../utils/cli') const sinon = require('sinon') +const multibase = require('multibase') +const { Buffer } = require('buffer') const defaultOptions = { timeout: undefined @@ -37,6 +39,23 @@ describe('refs local', () => { expect(lines.includes(err)).to.be.true() }) + it('prints multihash of all blocks', async () => { + const ref = 'ref' + const err = 'err' + + ipfs.refs.local.withArgs(defaultOptions).returns([{ + ref + }, { + err + }]) + + const out = await cli('refs local --multihash', { ipfs }) + const lines = out.split('\n') + + expect(lines.includes(multibase.encode('base32', Buffer.from(ref)).toString().substring(1).toUpperCase())).to.be.true() + expect(lines.includes(err)).to.be.true() + }) + it('prints CID of all blocks with timeout', async () => { const ref = 'ref' const err = 'err' From b9793eeec32f5e43b3aaf24a17e4fb00bf780374 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Wed, 1 Jul 2020 16:25:59 +0100 Subject: [PATCH 07/12] chore: apply suggestions from code review Co-authored-by: Hugo Dias --- packages/ipfs/src/cli/commands/refs-local.js | 2 +- packages/ipfs/test/cli/refs-local.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ipfs/src/cli/commands/refs-local.js b/packages/ipfs/src/cli/commands/refs-local.js index 4c58e8238b..4855a1b8b2 100644 --- a/packages/ipfs/src/cli/commands/refs-local.js +++ b/packages/ipfs/src/cli/commands/refs-local.js @@ -31,7 +31,7 @@ module.exports = { print(err, true, true) } else { if (multihash) { - print(multibase.encode('base32', Buffer.from(ref)).toString().substring(1).toUpperCase()) + print(multibase.encoding('base32upper').encode(Buffer.from(ref))) } else { print(ref) } diff --git a/packages/ipfs/test/cli/refs-local.js b/packages/ipfs/test/cli/refs-local.js index e655163c32..1ff1865124 100644 --- a/packages/ipfs/test/cli/refs-local.js +++ b/packages/ipfs/test/cli/refs-local.js @@ -52,7 +52,7 @@ describe('refs local', () => { const out = await cli('refs local --multihash', { ipfs }) const lines = out.split('\n') - expect(lines.includes(multibase.encode('base32', Buffer.from(ref)).toString().substring(1).toUpperCase())).to.be.true() + expect(lines.includes(multibase.encoding('base32upper').encode(Buffer.from(ref))).to.be.true() expect(lines.includes(err)).to.be.true() }) From f5f45c959085714e4099bdb832d5f95e927ca5ac Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 2 Jul 2020 09:37:11 +0100 Subject: [PATCH 08/12] chore: fix typo --- packages/ipfs/test/cli/refs-local.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs/test/cli/refs-local.js b/packages/ipfs/test/cli/refs-local.js index 1ff1865124..98da66970f 100644 --- a/packages/ipfs/test/cli/refs-local.js +++ b/packages/ipfs/test/cli/refs-local.js @@ -52,7 +52,7 @@ describe('refs local', () => { const out = await cli('refs local --multihash', { ipfs }) const lines = out.split('\n') - expect(lines.includes(multibase.encoding('base32upper').encode(Buffer.from(ref))).to.be.true() + expect(lines.includes(multibase.encoding('base32upper').encode(Buffer.from(ref)))).to.be.true() expect(lines.includes(err)).to.be.true() }) From fe22a0e6ee97e08ed9828c65de6d9941c29bcdec Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 2 Jul 2020 10:53:25 +0100 Subject: [PATCH 09/12] chore: update deps --- packages/interface-ipfs-core/package.json | 4 ++-- packages/ipfs-core-utils/package.json | 2 +- packages/ipfs-http-client/package.json | 6 +++--- packages/ipfs/package.json | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index b67342c79d..28af7b6eed 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -53,7 +53,7 @@ "it-last": "^1.0.1", "it-pushable": "^1.3.1", "multiaddr": "^7.4.3", - "multibase": "^0.7.0", + "multibase": "^1.0.1", "multihashing-async": "^1.0.0", "nanoid": "^3.0.2", "peer-id": "^0.13.12", @@ -61,7 +61,7 @@ "temp-write": "^4.0.0" }, "devDependencies": { - "aegir": "^22.1.0", + "aegir": "^23.0.0", "ipfsd-ctl": "^4.1.1" }, "contributors": [ diff --git a/packages/ipfs-core-utils/package.json b/packages/ipfs-core-utils/package.json index cca9645f9f..bf675a47a5 100644 --- a/packages/ipfs-core-utils/package.json +++ b/packages/ipfs-core-utils/package.json @@ -33,7 +33,7 @@ "ipfs-utils": "^2.2.2" }, "devDependencies": { - "aegir": "^22.1.0", + "aegir": "^23.0.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "delay": "^4.3.0", diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index 067f9a3156..31d37a466f 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -59,16 +59,16 @@ "merge-options": "^2.0.0", "multiaddr": "^7.4.3", "multiaddr-to-uri": "^5.1.0", - "multibase": "^0.7.0", + "multibase": "^1.0.1", "multicodec": "^1.0.0", "multihashes": "^1.0.1", "nanoid": "^3.0.2", "node-fetch": "^2.6.0", - "parse-duration": "^0.1.2", + "parse-duration": "^0.4.4", "stream-to-it": "^0.2.0" }, "devDependencies": { - "aegir": "^22.1.0", + "aegir": "^23.0.0", "cross-env": "^7.0.0", "go-ipfs-dep": "^0.5.1", "interface-ipfs-core": "^0.137.0", diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index ed0f1cb75f..ed14eca677 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -117,7 +117,7 @@ "it-all": "^1.0.1", "it-concat": "^1.0.0", "it-drain": "^1.0.1", - "it-glob": "0.0.7", + "it-glob": "0.0.8", "it-last": "^1.0.1", "it-map": "^1.0.0", "it-multipart": "^1.0.1", @@ -148,19 +148,19 @@ "mortice": "^2.0.0", "multiaddr": "^7.4.3", "multiaddr-to-uri": "^5.1.0", - "multibase": "^0.7.0", + "multibase": "^1.0.1", "multicodec": "^1.0.0", "multihashing-async": "^1.0.0", "p-defer": "^3.0.0", "p-queue": "^6.1.0", - "parse-duration": "^0.1.2", + "parse-duration": "^0.4.4", "peer-id": "^0.13.12", "pretty-bytes": "^5.3.0", "progress": "^2.0.1", "protons": "^1.2.0", "semver": "^7.3.2", "stream-to-it": "^0.2.0", - "streaming-iterables": "^4.1.1", + "streaming-iterables": "^5.0.0", "temp": "^0.9.0", "timeout-abort-controller": "^1.1.0", "update-notifier": "^4.0.0", @@ -170,7 +170,7 @@ "yargs-promise": "^1.1.0" }, "devDependencies": { - "aegir": "^22.1.0", + "aegir": "^23.0.0", "base64url": "^3.0.1", "clear-module": "^4.0.0", "cross-env": "^7.0.0", @@ -191,7 +191,7 @@ "qs": "^6.9.3", "rimraf": "^3.0.0", "sinon": "^9.0.1", - "stream-to-promise": "^2.2.0", + "stream-to-promise": "^3.0.0", "string-argv": "^0.3.1", "temp-write": "^4.0.0", "wrtc": "^0.4.4" From 9f9aa8e01f3b966f19a993e7e3e1fb5eb8e88637 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 2 Jul 2020 11:24:48 +0100 Subject: [PATCH 10/12] chore: upgraded multibase --- packages/ipfs/src/cli/commands/add.js | 2 +- packages/ipfs/src/cli/commands/bitswap/stat.js | 2 +- packages/ipfs/src/cli/commands/bitswap/unwant.js | 2 +- packages/ipfs/src/cli/commands/bitswap/wantlist.js | 2 +- packages/ipfs/src/cli/commands/block/put.js | 2 +- packages/ipfs/src/cli/commands/block/stat.js | 2 +- packages/ipfs/src/cli/commands/dag/put.js | 2 +- packages/ipfs/src/cli/commands/ls.js | 2 +- packages/ipfs/src/cli/commands/object/get.js | 2 +- packages/ipfs/src/cli/commands/object/links.js | 2 +- packages/ipfs/src/cli/commands/object/new.js | 2 +- packages/ipfs/src/cli/commands/object/patch/add-link.js | 2 +- packages/ipfs/src/cli/commands/object/patch/append-data.js | 2 +- packages/ipfs/src/cli/commands/object/patch/rm-link.js | 2 +- packages/ipfs/src/cli/commands/object/patch/set-data.js | 2 +- packages/ipfs/src/cli/commands/object/put.js | 2 +- packages/ipfs/src/cli/commands/pin/add.js | 2 +- packages/ipfs/src/cli/commands/pin/ls.js | 2 +- packages/ipfs/src/cli/commands/pin/rm.js | 2 +- packages/ipfs/src/cli/commands/resolve.js | 2 +- packages/ipfs/src/core/components/pin/rm.js | 2 +- packages/ipfs/src/http/api/resources/object.js | 2 +- packages/ipfs/src/http/utils/joi.js | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/packages/ipfs/src/cli/commands/add.js b/packages/ipfs/src/cli/commands/add.js index 91c529a38c..657456b933 100644 --- a/packages/ipfs/src/cli/commands/add.js +++ b/packages/ipfs/src/cli/commands/add.js @@ -90,7 +90,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, hash: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/bitswap/stat.js b/packages/ipfs/src/cli/commands/bitswap/stat.js index c6580b807f..85346e08d7 100644 --- a/packages/ipfs/src/cli/commands/bitswap/stat.js +++ b/packages/ipfs/src/cli/commands/bitswap/stat.js @@ -14,7 +14,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, human: { type: 'boolean', diff --git a/packages/ipfs/src/cli/commands/bitswap/unwant.js b/packages/ipfs/src/cli/commands/bitswap/unwant.js index 5aef62a73b..e29e27e8c5 100644 --- a/packages/ipfs/src/cli/commands/bitswap/unwant.js +++ b/packages/ipfs/src/cli/commands/bitswap/unwant.js @@ -18,7 +18,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/bitswap/wantlist.js b/packages/ipfs/src/cli/commands/bitswap/wantlist.js index d769e384fc..1f1da61dd0 100644 --- a/packages/ipfs/src/cli/commands/bitswap/wantlist.js +++ b/packages/ipfs/src/cli/commands/bitswap/wantlist.js @@ -18,7 +18,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/block/put.js b/packages/ipfs/src/cli/commands/block/put.js index d29c5e5deb..932e54ae5f 100644 --- a/packages/ipfs/src/cli/commands/block/put.js +++ b/packages/ipfs/src/cli/commands/block/put.js @@ -33,7 +33,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, pin: { describe: 'Pin this block recursively', diff --git a/packages/ipfs/src/cli/commands/block/stat.js b/packages/ipfs/src/cli/commands/block/stat.js index f02afb0f83..fabb9a8e91 100644 --- a/packages/ipfs/src/cli/commands/block/stat.js +++ b/packages/ipfs/src/cli/commands/block/stat.js @@ -13,7 +13,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/dag/put.js b/packages/ipfs/src/cli/commands/dag/put.js index 4c12ffdfbe..b98c96142a 100644 --- a/packages/ipfs/src/cli/commands/dag/put.js +++ b/packages/ipfs/src/cli/commands/dag/put.js @@ -67,7 +67,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, preload: { type: 'boolean', diff --git a/packages/ipfs/src/cli/commands/ls.js b/packages/ipfs/src/cli/commands/ls.js index 330030b7f2..907a90500e 100644 --- a/packages/ipfs/src/cli/commands/ls.js +++ b/packages/ipfs/src/cli/commands/ls.js @@ -33,7 +33,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/get.js b/packages/ipfs/src/cli/commands/object/get.js index d1f5b70c0a..9fa4bd33b2 100644 --- a/packages/ipfs/src/cli/commands/object/get.js +++ b/packages/ipfs/src/cli/commands/object/get.js @@ -18,7 +18,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/links.js b/packages/ipfs/src/cli/commands/object/links.js index d2704b489b..ac13cc7ca5 100644 --- a/packages/ipfs/src/cli/commands/object/links.js +++ b/packages/ipfs/src/cli/commands/object/links.js @@ -13,7 +13,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/new.js b/packages/ipfs/src/cli/commands/object/new.js index f03a1dc2da..bfa88b6cf4 100644 --- a/packages/ipfs/src/cli/commands/object/new.js +++ b/packages/ipfs/src/cli/commands/object/new.js @@ -13,7 +13,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/patch/add-link.js b/packages/ipfs/src/cli/commands/object/patch/add-link.js index a536271ce4..54b7bf0a28 100644 --- a/packages/ipfs/src/cli/commands/object/patch/add-link.js +++ b/packages/ipfs/src/cli/commands/object/patch/add-link.js @@ -15,7 +15,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, 'cid-version': { describe: 'The CID version of the DAGNode to link to', diff --git a/packages/ipfs/src/cli/commands/object/patch/append-data.js b/packages/ipfs/src/cli/commands/object/patch/append-data.js index 6c4e483a7c..925f4a7a16 100644 --- a/packages/ipfs/src/cli/commands/object/patch/append-data.js +++ b/packages/ipfs/src/cli/commands/object/patch/append-data.js @@ -15,7 +15,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/patch/rm-link.js b/packages/ipfs/src/cli/commands/object/patch/rm-link.js index 5761a81784..9321b41508 100644 --- a/packages/ipfs/src/cli/commands/object/patch/rm-link.js +++ b/packages/ipfs/src/cli/commands/object/patch/rm-link.js @@ -13,7 +13,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/patch/set-data.js b/packages/ipfs/src/cli/commands/object/patch/set-data.js index b6b9c6a0f3..8108f2fd03 100644 --- a/packages/ipfs/src/cli/commands/object/patch/set-data.js +++ b/packages/ipfs/src/cli/commands/object/patch/set-data.js @@ -15,7 +15,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/object/put.js b/packages/ipfs/src/cli/commands/object/put.js index d6d61e1ed3..b4251918e1 100644 --- a/packages/ipfs/src/cli/commands/object/put.js +++ b/packages/ipfs/src/cli/commands/object/put.js @@ -19,7 +19,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in. Note: specifying a CID base for v0 CIDs will have no effect.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/pin/add.js b/packages/ipfs/src/cli/commands/pin/add.js index 44e8148406..48536ea739 100644 --- a/packages/ipfs/src/cli/commands/pin/add.js +++ b/packages/ipfs/src/cli/commands/pin/add.js @@ -19,7 +19,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/pin/ls.js b/packages/ipfs/src/cli/commands/pin/ls.js index 0977732297..74824e20e1 100644 --- a/packages/ipfs/src/cli/commands/pin/ls.js +++ b/packages/ipfs/src/cli/commands/pin/ls.js @@ -28,7 +28,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, stream: { type: 'boolean', diff --git a/packages/ipfs/src/cli/commands/pin/rm.js b/packages/ipfs/src/cli/commands/pin/rm.js index 11add6d4ca..3b75b39347 100644 --- a/packages/ipfs/src/cli/commands/pin/rm.js +++ b/packages/ipfs/src/cli/commands/pin/rm.js @@ -19,7 +19,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/cli/commands/resolve.js b/packages/ipfs/src/cli/commands/resolve.js index cf8dcb8312..114dff050b 100644 --- a/packages/ipfs/src/cli/commands/resolve.js +++ b/packages/ipfs/src/cli/commands/resolve.js @@ -17,7 +17,7 @@ module.exports = { 'cid-base': { describe: 'Number base to display CIDs in.', type: 'string', - choices: multibase.names + choices: Object.keys(multibase.names) }, timeout: { type: 'string', diff --git a/packages/ipfs/src/core/components/pin/rm.js b/packages/ipfs/src/core/components/pin/rm.js index 98133fb8fd..376b704e75 100644 --- a/packages/ipfs/src/core/components/pin/rm.js +++ b/packages/ipfs/src/core/components/pin/rm.js @@ -15,7 +15,7 @@ module.exports = ({ pinManager, gcLock, dag }) => { const recursive = options.recursive !== false - if (options.cidBase && !multibase.names.includes(options.cidBase)) { + if (options.cidBase && !multibase.names[options.cidBase]) { throw errCode(new Error('invalid multibase'), 'ERR_INVALID_MULTIBASE') } diff --git a/packages/ipfs/src/http/api/resources/object.js b/packages/ipfs/src/http/api/resources/object.js index d629a9458c..506aa4c6e2 100644 --- a/packages/ipfs/src/http/api/resources/object.js +++ b/packages/ipfs/src/http/api/resources/object.js @@ -210,7 +210,7 @@ exports.put = { stripUnknown: true }, query: Joi.object().keys({ - cidBase: Joi.string().valid(...multibase.names), + cidBase: Joi.string().valid(...Object.keys(multibase.names)), enc: Joi.string().valid('json', 'protobuf'), timeout: Joi.timeout() }) diff --git a/packages/ipfs/src/http/utils/joi.js b/packages/ipfs/src/http/utils/joi.js index 31775f5abc..f4de2b1c0e 100644 --- a/packages/ipfs/src/http/utils/joi.js +++ b/packages/ipfs/src/http/utils/joi.js @@ -137,7 +137,7 @@ module.exports = Joi return } - if (!multibase.names.includes(value)) { + if (!multibase.names[value]) { throw new Error('Invalid base name') } From 91c703b99b0d46fe90b4acf6154ede73e1456905 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 2 Jul 2020 11:57:50 +0100 Subject: [PATCH 11/12] chore: time requires unit --- packages/ipfs/test/cli/object.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs/test/cli/object.js b/packages/ipfs/test/cli/object.js index 2f46bc468e..051009c03c 100644 --- a/packages/ipfs/test/cli/object.js +++ b/packages/ipfs/test/cli/object.js @@ -321,7 +321,7 @@ describe('object', () => { new DAGLink('some link', 8, new CID('QmXg9Pp2ytZ14xgmQjYEiHjVjMFXzCVVEcRTWJBmLgR39V')) ]) - const out = await cli(`object links ${cid} --timeout=1000`, { ipfs }) + const out = await cli(`object links ${cid} --timeout=1s`, { ipfs }) expect(out).to.equal( 'QmXg9Pp2ytZ14xgmQjYEiHjVjMFXzCVVEcRTWJBmLgR39V 8 some link\n' ) From ae75d90268f0ac20b1622766e94518fcc592b19b Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 2 Jul 2020 12:21:21 +0100 Subject: [PATCH 12/12] chore: use default export for browser compatibility --- packages/ipfs-http-client/src/lib/core.js | 2 +- packages/ipfs/src/cli/commands/add.js | 2 +- packages/ipfs/src/cli/commands/bitswap/stat.js | 2 +- packages/ipfs/src/cli/commands/bitswap/unwant.js | 2 +- packages/ipfs/src/cli/commands/bitswap/wantlist.js | 2 +- packages/ipfs/src/cli/commands/block/get.js | 2 +- packages/ipfs/src/cli/commands/block/put.js | 2 +- packages/ipfs/src/cli/commands/block/rm.js | 2 +- packages/ipfs/src/cli/commands/block/stat.js | 2 +- packages/ipfs/src/cli/commands/bootstrap/add.js | 2 +- packages/ipfs/src/cli/commands/bootstrap/list.js | 2 +- packages/ipfs/src/cli/commands/bootstrap/rm.js | 2 +- packages/ipfs/src/cli/commands/cat.js | 2 +- packages/ipfs/src/cli/commands/config.js | 2 +- packages/ipfs/src/cli/commands/config/profile/apply.js | 2 +- packages/ipfs/src/cli/commands/config/profile/ls.js | 2 +- packages/ipfs/src/cli/commands/config/replace.js | 2 +- packages/ipfs/src/cli/commands/config/show.js | 2 +- packages/ipfs/src/cli/commands/dag/get.js | 2 +- packages/ipfs/src/cli/commands/dag/put.js | 2 +- packages/ipfs/src/cli/commands/dag/resolve.js | 2 +- packages/ipfs/src/cli/commands/dht/find-peer.js | 2 +- packages/ipfs/src/cli/commands/dht/find-providers.js | 2 +- packages/ipfs/src/cli/commands/dht/get.js | 2 +- packages/ipfs/src/cli/commands/dht/provide.js | 2 +- packages/ipfs/src/cli/commands/dht/put.js | 2 +- packages/ipfs/src/cli/commands/dht/query.js | 2 +- packages/ipfs/src/cli/commands/dns.js | 2 +- packages/ipfs/src/cli/commands/files/chmod.js | 2 +- packages/ipfs/src/cli/commands/files/cp.js | 2 +- packages/ipfs/src/cli/commands/files/flush.js | 2 +- packages/ipfs/src/cli/commands/files/ls.js | 2 +- packages/ipfs/src/cli/commands/files/mkdir.js | 2 +- packages/ipfs/src/cli/commands/files/mv.js | 2 +- packages/ipfs/src/cli/commands/files/read.js | 2 +- packages/ipfs/src/cli/commands/files/rm.js | 2 +- packages/ipfs/src/cli/commands/files/stat.js | 2 +- packages/ipfs/src/cli/commands/files/touch.js | 2 +- packages/ipfs/src/cli/commands/files/write.js | 2 +- packages/ipfs/src/cli/commands/get.js | 2 +- packages/ipfs/src/cli/commands/id.js | 2 +- packages/ipfs/src/cli/commands/key/export.js | 2 +- packages/ipfs/src/cli/commands/key/gen.js | 2 +- packages/ipfs/src/cli/commands/key/import.js | 2 +- packages/ipfs/src/cli/commands/key/list.js | 2 +- packages/ipfs/src/cli/commands/key/rename.js | 2 +- packages/ipfs/src/cli/commands/key/rm.js | 2 +- packages/ipfs/src/cli/commands/ls.js | 2 +- packages/ipfs/src/cli/commands/name/publish.js | 2 +- packages/ipfs/src/cli/commands/name/pubsub/cancel.js | 2 +- packages/ipfs/src/cli/commands/name/pubsub/state.js | 2 +- packages/ipfs/src/cli/commands/name/pubsub/subs.js | 2 +- packages/ipfs/src/cli/commands/name/resolve.js | 2 +- packages/ipfs/src/cli/commands/object/data.js | 2 +- packages/ipfs/src/cli/commands/object/get.js | 2 +- packages/ipfs/src/cli/commands/object/links.js | 2 +- packages/ipfs/src/cli/commands/object/new.js | 2 +- packages/ipfs/src/cli/commands/object/patch/add-link.js | 2 +- packages/ipfs/src/cli/commands/object/patch/append-data.js | 2 +- packages/ipfs/src/cli/commands/object/patch/rm-link.js | 2 +- packages/ipfs/src/cli/commands/object/patch/set-data.js | 2 +- packages/ipfs/src/cli/commands/object/put.js | 2 +- packages/ipfs/src/cli/commands/object/stat.js | 2 +- packages/ipfs/src/cli/commands/pin/add.js | 2 +- packages/ipfs/src/cli/commands/pin/ls.js | 2 +- packages/ipfs/src/cli/commands/pin/rm.js | 2 +- packages/ipfs/src/cli/commands/ping.js | 2 +- packages/ipfs/src/cli/commands/pubsub/ls.js | 2 +- packages/ipfs/src/cli/commands/pubsub/peers.js | 2 +- packages/ipfs/src/cli/commands/pubsub/pub.js | 2 +- packages/ipfs/src/cli/commands/pubsub/sub.js | 2 +- packages/ipfs/src/cli/commands/refs-local.js | 2 +- packages/ipfs/src/cli/commands/refs.js | 2 +- packages/ipfs/src/cli/commands/repo/gc.js | 2 +- packages/ipfs/src/cli/commands/repo/stat.js | 2 +- packages/ipfs/src/cli/commands/repo/version.js | 2 +- packages/ipfs/src/cli/commands/resolve.js | 2 +- packages/ipfs/src/cli/commands/shutdown.js | 2 +- packages/ipfs/src/cli/commands/stats/bw.js | 2 +- packages/ipfs/src/cli/commands/stats/repo.js | 2 +- packages/ipfs/src/cli/commands/swarm/addrs.js | 2 +- packages/ipfs/src/cli/commands/swarm/addrs/local.js | 2 +- packages/ipfs/src/cli/commands/swarm/connect.js | 2 +- packages/ipfs/src/cli/commands/swarm/disconnect.js | 2 +- packages/ipfs/src/cli/commands/swarm/peers.js | 2 +- packages/ipfs/src/cli/commands/version.js | 2 +- packages/ipfs/src/core/components/name/publish.js | 2 +- packages/ipfs/src/core/components/stats/bw.js | 2 +- packages/ipfs/src/core/utils.js | 2 +- packages/ipfs/src/http/utils/joi.js | 2 +- 90 files changed, 90 insertions(+), 90 deletions(-) diff --git a/packages/ipfs-http-client/src/lib/core.js b/packages/ipfs-http-client/src/lib/core.js index 22389c1063..fb6b51ebc8 100644 --- a/packages/ipfs-http-client/src/lib/core.js +++ b/packages/ipfs-http-client/src/lib/core.js @@ -4,7 +4,7 @@ const Multiaddr = require('multiaddr') const toUri = require('multiaddr-to-uri') const { isBrowser, isWebWorker } = require('ipfs-utils/src/env') const { URL } = require('iso-url') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default const log = require('debug')('ipfs-http-client:lib:error-handler') const HTTP = require('ipfs-utils/src/http') const merge = require('merge-options') diff --git a/packages/ipfs/src/cli/commands/add.js b/packages/ipfs/src/cli/commands/add.js index 657456b933..e764e3f30c 100644 --- a/packages/ipfs/src/cli/commands/add.js +++ b/packages/ipfs/src/cli/commands/add.js @@ -13,7 +13,7 @@ const { } = require('../utils') const { cidToString } = require('../../utils/cid') const globSource = require('ipfs-utils/src/files/glob-source') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default async function getTotalBytes (paths) { const sizes = await Promise.all(paths.map(p => getFolderSize(p))) diff --git a/packages/ipfs/src/cli/commands/bitswap/stat.js b/packages/ipfs/src/cli/commands/bitswap/stat.js index 85346e08d7..4afeee6543 100644 --- a/packages/ipfs/src/cli/commands/bitswap/stat.js +++ b/packages/ipfs/src/cli/commands/bitswap/stat.js @@ -3,7 +3,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') const prettyBytes = require('pretty-bytes') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'stat', diff --git a/packages/ipfs/src/cli/commands/bitswap/unwant.js b/packages/ipfs/src/cli/commands/bitswap/unwant.js index e29e27e8c5..6ace174313 100644 --- a/packages/ipfs/src/cli/commands/bitswap/unwant.js +++ b/packages/ipfs/src/cli/commands/bitswap/unwant.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'unwant ', diff --git a/packages/ipfs/src/cli/commands/bitswap/wantlist.js b/packages/ipfs/src/cli/commands/bitswap/wantlist.js index 1f1da61dd0..09991fea77 100644 --- a/packages/ipfs/src/cli/commands/bitswap/wantlist.js +++ b/packages/ipfs/src/cli/commands/bitswap/wantlist.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'wantlist [peer]', diff --git a/packages/ipfs/src/cli/commands/block/get.js b/packages/ipfs/src/cli/commands/block/get.js index 2282cc2a56..eeb36a5bdd 100644 --- a/packages/ipfs/src/cli/commands/block/get.js +++ b/packages/ipfs/src/cli/commands/block/get.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'get ', diff --git a/packages/ipfs/src/cli/commands/block/put.js b/packages/ipfs/src/cli/commands/block/put.js index 932e54ae5f..96c10083a2 100644 --- a/packages/ipfs/src/cli/commands/block/put.js +++ b/packages/ipfs/src/cli/commands/block/put.js @@ -4,7 +4,7 @@ const fs = require('fs') const multibase = require('multibase') const concat = require('it-concat') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'put [block]', diff --git a/packages/ipfs/src/cli/commands/block/rm.js b/packages/ipfs/src/cli/commands/block/rm.js index 4efd88def5..6f5f32ccb7 100644 --- a/packages/ipfs/src/cli/commands/block/rm.js +++ b/packages/ipfs/src/cli/commands/block/rm.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'rm ', diff --git a/packages/ipfs/src/cli/commands/block/stat.js b/packages/ipfs/src/cli/commands/block/stat.js index fabb9a8e91..41539898d9 100644 --- a/packages/ipfs/src/cli/commands/block/stat.js +++ b/packages/ipfs/src/cli/commands/block/stat.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'stat ', diff --git a/packages/ipfs/src/cli/commands/bootstrap/add.js b/packages/ipfs/src/cli/commands/bootstrap/add.js index ea84d24e4e..ec6c9a14e5 100644 --- a/packages/ipfs/src/cli/commands/bootstrap/add.js +++ b/packages/ipfs/src/cli/commands/bootstrap/add.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'add []', diff --git a/packages/ipfs/src/cli/commands/bootstrap/list.js b/packages/ipfs/src/cli/commands/bootstrap/list.js index 70ced1eb6f..6a5342e8dc 100644 --- a/packages/ipfs/src/cli/commands/bootstrap/list.js +++ b/packages/ipfs/src/cli/commands/bootstrap/list.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'list', diff --git a/packages/ipfs/src/cli/commands/bootstrap/rm.js b/packages/ipfs/src/cli/commands/bootstrap/rm.js index b19dfdf527..60073504c4 100644 --- a/packages/ipfs/src/cli/commands/bootstrap/rm.js +++ b/packages/ipfs/src/cli/commands/bootstrap/rm.js @@ -3,7 +3,7 @@ const debug = require('debug') const log = debug('cli:bootstrap') log.error = debug('cli:bootstrap:error') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'rm []', diff --git a/packages/ipfs/src/cli/commands/cat.js b/packages/ipfs/src/cli/commands/cat.js index 5f9887b6e0..2465182ffb 100644 --- a/packages/ipfs/src/cli/commands/cat.js +++ b/packages/ipfs/src/cli/commands/cat.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'cat ', diff --git a/packages/ipfs/src/cli/commands/config.js b/packages/ipfs/src/cli/commands/config.js index b8e851ddb5..fc9514dad3 100644 --- a/packages/ipfs/src/cli/commands/config.js +++ b/packages/ipfs/src/cli/commands/config.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'config [value]', diff --git a/packages/ipfs/src/cli/commands/config/profile/apply.js b/packages/ipfs/src/cli/commands/config/profile/apply.js index 353d91b07f..82a3c9c223 100644 --- a/packages/ipfs/src/cli/commands/config/profile/apply.js +++ b/packages/ipfs/src/cli/commands/config/profile/apply.js @@ -1,7 +1,7 @@ 'use strict' const JSONDiff = require('jsondiffpatch') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'apply ', diff --git a/packages/ipfs/src/cli/commands/config/profile/ls.js b/packages/ipfs/src/cli/commands/config/profile/ls.js index a38f03700e..1ed768e99e 100644 --- a/packages/ipfs/src/cli/commands/config/profile/ls.js +++ b/packages/ipfs/src/cli/commands/config/profile/ls.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'ls', diff --git a/packages/ipfs/src/cli/commands/config/replace.js b/packages/ipfs/src/cli/commands/config/replace.js index bfe9bc3756..4fd5ea956e 100644 --- a/packages/ipfs/src/cli/commands/config/replace.js +++ b/packages/ipfs/src/cli/commands/config/replace.js @@ -2,7 +2,7 @@ const path = require('path') const fs = require('fs') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'replace ', diff --git a/packages/ipfs/src/cli/commands/config/show.js b/packages/ipfs/src/cli/commands/config/show.js index 7a4b3835cc..b9cd53c667 100644 --- a/packages/ipfs/src/cli/commands/config/show.js +++ b/packages/ipfs/src/cli/commands/config/show.js @@ -3,7 +3,7 @@ const debug = require('debug') const log = debug('cli:config') log.error = debug('cli:config:error') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'show', diff --git a/packages/ipfs/src/cli/commands/dag/get.js b/packages/ipfs/src/cli/commands/dag/get.js index 9d7f90d6fa..b2d3a5adc6 100644 --- a/packages/ipfs/src/cli/commands/dag/get.js +++ b/packages/ipfs/src/cli/commands/dag/get.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default const { Buffer } = require('buffer') module.exports = { diff --git a/packages/ipfs/src/cli/commands/dag/put.js b/packages/ipfs/src/cli/commands/dag/put.js index b98c96142a..f2d4edf182 100644 --- a/packages/ipfs/src/cli/commands/dag/put.js +++ b/packages/ipfs/src/cli/commands/dag/put.js @@ -7,7 +7,7 @@ const dagPB = require('ipld-dag-pb') const concat = require('it-concat') const CID = require('cids') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default const inputDecoders = { json: (buf) => JSON.parse(buf.toString()), diff --git a/packages/ipfs/src/cli/commands/dag/resolve.js b/packages/ipfs/src/cli/commands/dag/resolve.js index e5a183357e..d78de895b9 100644 --- a/packages/ipfs/src/cli/commands/dag/resolve.js +++ b/packages/ipfs/src/cli/commands/dag/resolve.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'resolve ', diff --git a/packages/ipfs/src/cli/commands/dht/find-peer.js b/packages/ipfs/src/cli/commands/dht/find-peer.js index 7dcc57dd48..6151e5b936 100644 --- a/packages/ipfs/src/cli/commands/dht/find-peer.js +++ b/packages/ipfs/src/cli/commands/dht/find-peer.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'findpeer ', diff --git a/packages/ipfs/src/cli/commands/dht/find-providers.js b/packages/ipfs/src/cli/commands/dht/find-providers.js index 0061b25972..79ebce2b87 100644 --- a/packages/ipfs/src/cli/commands/dht/find-providers.js +++ b/packages/ipfs/src/cli/commands/dht/find-providers.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'findprovs ', diff --git a/packages/ipfs/src/cli/commands/dht/get.js b/packages/ipfs/src/cli/commands/dht/get.js index 712dced4c8..0fd90f3009 100644 --- a/packages/ipfs/src/cli/commands/dht/get.js +++ b/packages/ipfs/src/cli/commands/dht/get.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'get ', diff --git a/packages/ipfs/src/cli/commands/dht/provide.js b/packages/ipfs/src/cli/commands/dht/provide.js index 5001f028af..31d20dcd41 100644 --- a/packages/ipfs/src/cli/commands/dht/provide.js +++ b/packages/ipfs/src/cli/commands/dht/provide.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'provide ', diff --git a/packages/ipfs/src/cli/commands/dht/put.js b/packages/ipfs/src/cli/commands/dht/put.js index ce078c5a39..da3b2624e6 100644 --- a/packages/ipfs/src/cli/commands/dht/put.js +++ b/packages/ipfs/src/cli/commands/dht/put.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'put ', diff --git a/packages/ipfs/src/cli/commands/dht/query.js b/packages/ipfs/src/cli/commands/dht/query.js index 2c5a6d43f1..a0cef2a411 100644 --- a/packages/ipfs/src/cli/commands/dht/query.js +++ b/packages/ipfs/src/cli/commands/dht/query.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'query ', diff --git a/packages/ipfs/src/cli/commands/dns.js b/packages/ipfs/src/cli/commands/dns.js index baaf34b3e4..0b9326d2ed 100644 --- a/packages/ipfs/src/cli/commands/dns.js +++ b/packages/ipfs/src/cli/commands/dns.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'dns ', diff --git a/packages/ipfs/src/cli/commands/files/chmod.js b/packages/ipfs/src/cli/commands/files/chmod.js index a78c538110..d90c7680a9 100644 --- a/packages/ipfs/src/cli/commands/files/chmod.js +++ b/packages/ipfs/src/cli/commands/files/chmod.js @@ -4,7 +4,7 @@ const { asBoolean, asOctal } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'chmod [mode] [path]', diff --git a/packages/ipfs/src/cli/commands/files/cp.js b/packages/ipfs/src/cli/commands/files/cp.js index 4e527b0a50..77c9a2f595 100644 --- a/packages/ipfs/src/cli/commands/files/cp.js +++ b/packages/ipfs/src/cli/commands/files/cp.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'cp ', diff --git a/packages/ipfs/src/cli/commands/files/flush.js b/packages/ipfs/src/cli/commands/files/flush.js index 01ad738364..89915e9e35 100644 --- a/packages/ipfs/src/cli/commands/files/flush.js +++ b/packages/ipfs/src/cli/commands/files/flush.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'flush [path]', diff --git a/packages/ipfs/src/cli/commands/files/ls.js b/packages/ipfs/src/cli/commands/files/ls.js index 8248f205fb..8b2cf2a584 100644 --- a/packages/ipfs/src/cli/commands/files/ls.js +++ b/packages/ipfs/src/cli/commands/files/ls.js @@ -5,7 +5,7 @@ const { } = require('../../utils') const formatMode = require('ipfs-core-utils/src/files/format-mode') const formatMtime = require('ipfs-core-utils/src/files/format-mtime') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'ls [path]', diff --git a/packages/ipfs/src/cli/commands/files/mkdir.js b/packages/ipfs/src/cli/commands/files/mkdir.js index cfc18078fe..def58ed781 100644 --- a/packages/ipfs/src/cli/commands/files/mkdir.js +++ b/packages/ipfs/src/cli/commands/files/mkdir.js @@ -7,7 +7,7 @@ const { coerceMtime, coerceMtimeNsecs } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'mkdir ', diff --git a/packages/ipfs/src/cli/commands/files/mv.js b/packages/ipfs/src/cli/commands/files/mv.js index 9add4cae6f..9f6fa2957d 100644 --- a/packages/ipfs/src/cli/commands/files/mv.js +++ b/packages/ipfs/src/cli/commands/files/mv.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'mv ', diff --git a/packages/ipfs/src/cli/commands/files/read.js b/packages/ipfs/src/cli/commands/files/read.js index e46a5ed176..7e44484a80 100644 --- a/packages/ipfs/src/cli/commands/files/read.js +++ b/packages/ipfs/src/cli/commands/files/read.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'read ', diff --git a/packages/ipfs/src/cli/commands/files/rm.js b/packages/ipfs/src/cli/commands/files/rm.js index 480d8e6cc6..6a13f51666 100644 --- a/packages/ipfs/src/cli/commands/files/rm.js +++ b/packages/ipfs/src/cli/commands/files/rm.js @@ -3,7 +3,7 @@ const { asBoolean } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'rm ', diff --git a/packages/ipfs/src/cli/commands/files/stat.js b/packages/ipfs/src/cli/commands/files/stat.js index a4723891dc..177d6c8a13 100644 --- a/packages/ipfs/src/cli/commands/files/stat.js +++ b/packages/ipfs/src/cli/commands/files/stat.js @@ -5,7 +5,7 @@ const { } = require('../../utils') const formatMode = require('ipfs-core-utils/src/files/format-mode') const formatMtime = require('ipfs-core-utils/src/files/format-mtime') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'stat [path]', diff --git a/packages/ipfs/src/cli/commands/files/touch.js b/packages/ipfs/src/cli/commands/files/touch.js index 7eb017a9a4..1ac5de6560 100644 --- a/packages/ipfs/src/cli/commands/files/touch.js +++ b/packages/ipfs/src/cli/commands/files/touch.js @@ -6,7 +6,7 @@ const { coerceMtime, coerceMtimeNsecs } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'touch [path]', diff --git a/packages/ipfs/src/cli/commands/files/write.js b/packages/ipfs/src/cli/commands/files/write.js index cb2213324e..054c2126b1 100644 --- a/packages/ipfs/src/cli/commands/files/write.js +++ b/packages/ipfs/src/cli/commands/files/write.js @@ -7,7 +7,7 @@ const { coerceMtime, coerceMtimeNsecs } = require('../../utils') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'write ', diff --git a/packages/ipfs/src/cli/commands/get.js b/packages/ipfs/src/cli/commands/get.js index 8a4a2b0493..fc19986f02 100644 --- a/packages/ipfs/src/cli/commands/get.js +++ b/packages/ipfs/src/cli/commands/get.js @@ -5,7 +5,7 @@ const path = require('path') const toIterable = require('stream-to-it') const pipe = require('it-pipe') const { map } = require('streaming-iterables') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'get ', diff --git a/packages/ipfs/src/cli/commands/id.js b/packages/ipfs/src/cli/commands/id.js index bef5c472c4..42ad74a1eb 100644 --- a/packages/ipfs/src/cli/commands/id.js +++ b/packages/ipfs/src/cli/commands/id.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'id', diff --git a/packages/ipfs/src/cli/commands/key/export.js b/packages/ipfs/src/cli/commands/key/export.js index 3c65586be9..1c43877318 100644 --- a/packages/ipfs/src/cli/commands/key/export.js +++ b/packages/ipfs/src/cli/commands/key/export.js @@ -1,7 +1,7 @@ 'use strict' const fs = require('fs') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'export ', diff --git a/packages/ipfs/src/cli/commands/key/gen.js b/packages/ipfs/src/cli/commands/key/gen.js index 4f90f43bc4..1822432e55 100644 --- a/packages/ipfs/src/cli/commands/key/gen.js +++ b/packages/ipfs/src/cli/commands/key/gen.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'gen ', diff --git a/packages/ipfs/src/cli/commands/key/import.js b/packages/ipfs/src/cli/commands/key/import.js index 724ed8f120..8b81c5b4d1 100644 --- a/packages/ipfs/src/cli/commands/key/import.js +++ b/packages/ipfs/src/cli/commands/key/import.js @@ -1,7 +1,7 @@ 'use strict' const fs = require('fs') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'import ', diff --git a/packages/ipfs/src/cli/commands/key/list.js b/packages/ipfs/src/cli/commands/key/list.js index 063f73fbd5..1f1108900f 100644 --- a/packages/ipfs/src/cli/commands/key/list.js +++ b/packages/ipfs/src/cli/commands/key/list.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'list', diff --git a/packages/ipfs/src/cli/commands/key/rename.js b/packages/ipfs/src/cli/commands/key/rename.js index 8eb31a46ca..e610a7be15 100644 --- a/packages/ipfs/src/cli/commands/key/rename.js +++ b/packages/ipfs/src/cli/commands/key/rename.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'rename ', diff --git a/packages/ipfs/src/cli/commands/key/rm.js b/packages/ipfs/src/cli/commands/key/rm.js index 65e7c5e908..f42083ae67 100644 --- a/packages/ipfs/src/cli/commands/key/rm.js +++ b/packages/ipfs/src/cli/commands/key/rm.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'rm ', diff --git a/packages/ipfs/src/cli/commands/ls.js b/packages/ipfs/src/cli/commands/ls.js index 907a90500e..ccbba75660 100644 --- a/packages/ipfs/src/cli/commands/ls.js +++ b/packages/ipfs/src/cli/commands/ls.js @@ -5,7 +5,7 @@ const { rightpad } = require('../utils') const { cidToString } = require('../../utils/cid') const formatMode = require('ipfs-core-utils/src/files/format-mode') const formatMtime = require('ipfs-core-utils/src/files/format-mtime') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'ls ', diff --git a/packages/ipfs/src/cli/commands/name/publish.js b/packages/ipfs/src/cli/commands/name/publish.js index a8f82c6dca..d72d1e7574 100644 --- a/packages/ipfs/src/cli/commands/name/publish.js +++ b/packages/ipfs/src/cli/commands/name/publish.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'publish ', diff --git a/packages/ipfs/src/cli/commands/name/pubsub/cancel.js b/packages/ipfs/src/cli/commands/name/pubsub/cancel.js index 29da84b925..fc874e7770 100644 --- a/packages/ipfs/src/cli/commands/name/pubsub/cancel.js +++ b/packages/ipfs/src/cli/commands/name/pubsub/cancel.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'cancel ', diff --git a/packages/ipfs/src/cli/commands/name/pubsub/state.js b/packages/ipfs/src/cli/commands/name/pubsub/state.js index ef08aed8fb..14d73a63ac 100644 --- a/packages/ipfs/src/cli/commands/name/pubsub/state.js +++ b/packages/ipfs/src/cli/commands/name/pubsub/state.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'state', diff --git a/packages/ipfs/src/cli/commands/name/pubsub/subs.js b/packages/ipfs/src/cli/commands/name/pubsub/subs.js index c5b77000d6..c4235b6dd9 100644 --- a/packages/ipfs/src/cli/commands/name/pubsub/subs.js +++ b/packages/ipfs/src/cli/commands/name/pubsub/subs.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'subs', diff --git a/packages/ipfs/src/cli/commands/name/resolve.js b/packages/ipfs/src/cli/commands/name/resolve.js index 4affef1f2a..e0fc274865 100644 --- a/packages/ipfs/src/cli/commands/name/resolve.js +++ b/packages/ipfs/src/cli/commands/name/resolve.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'resolve []', diff --git a/packages/ipfs/src/cli/commands/object/data.js b/packages/ipfs/src/cli/commands/object/data.js index e28c3b61bb..48aee8038c 100644 --- a/packages/ipfs/src/cli/commands/object/data.js +++ b/packages/ipfs/src/cli/commands/object/data.js @@ -1,6 +1,6 @@ 'use strict' -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'data ', diff --git a/packages/ipfs/src/cli/commands/object/get.js b/packages/ipfs/src/cli/commands/object/get.js index 9fa4bd33b2..ee4b0c83c0 100644 --- a/packages/ipfs/src/cli/commands/object/get.js +++ b/packages/ipfs/src/cli/commands/object/get.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default const { Buffer } = require('buffer') module.exports = { diff --git a/packages/ipfs/src/cli/commands/object/links.js b/packages/ipfs/src/cli/commands/object/links.js index ac13cc7ca5..7b8e3cb918 100644 --- a/packages/ipfs/src/cli/commands/object/links.js +++ b/packages/ipfs/src/cli/commands/object/links.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'links ', diff --git a/packages/ipfs/src/cli/commands/object/new.js b/packages/ipfs/src/cli/commands/object/new.js index bfa88b6cf4..db4b090fb4 100644 --- a/packages/ipfs/src/cli/commands/object/new.js +++ b/packages/ipfs/src/cli/commands/object/new.js @@ -2,7 +2,7 @@ const multibase = require('multibase') const { cidToString } = require('../../../utils/cid') -const parseDuration = require('parse-duration') +const parseDuration = require('parse-duration').default module.exports = { command: 'new [