Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

chore: move mfs and multipart files into core #2811

Merged
merged 23 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
28fea6a
chore: move mfs files into core
achingbrain Feb 29, 2020
25d9a05
chore: start to fix up http tests
achingbrain Mar 13, 2020
11a15cd
chore: fix paths
achingbrain Mar 13, 2020
70e02a5
fix: http interface tests passing against js-ipfs
achingbrain Mar 14, 2020
88c6b0d
chore: almost all the http tests passing against go-ipfs
achingbrain Mar 14, 2020
57180ba
fix: tests passing against go-ipfs
achingbrain Mar 14, 2020
bc9d702
fix: interop tests passing with js-ipfs too
achingbrain Mar 15, 2020
0812670
fix: fix up tests
achingbrain Mar 16, 2020
35d285f
fix: skip test that breaks go-ipfs
achingbrain Mar 16, 2020
dcd5b9b
chore: make multipart parser one file
achingbrain Mar 17, 2020
78a3d80
chore: move parser into core
achingbrain Mar 17, 2020
803873c
chore: merge multipart into core
achingbrain Mar 17, 2020
ca118e3
chore: add missing dep
achingbrain Mar 17, 2020
aa6b3de
chore: update packages/ipfs-utils/src/http.js
achingbrain Mar 18, 2020
ee6f28f
chore: replace hat with nanoid
achingbrain Mar 18, 2020
45f6b6f
chore: replace crypto with iso-random-stream
achingbrain Mar 18, 2020
fc3fa4e
chore: remove use of assert
achingbrain Mar 18, 2020
566d106
fix: abort request on request body error
achingbrain Mar 18, 2020
064cacb
chore: add missing deps and fix linting
achingbrain Mar 18, 2020
1555443
chore: revert streaming body error handling
achingbrain Mar 18, 2020
f912060
fix: remove unused dep
achingbrain Mar 19, 2020
36193d8
fix: pin aegir version until ipfs/aegir#533 is fixed
achingbrain Mar 19, 2020
3d0c8a2
fix skip tests broken by node-fetch
achingbrain Mar 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/circuit-relaying/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"ipfs-pubsub-room": "^2.0.1"
},
"devDependencies": {
"aegir": "^21.3.0",
"aegir": "21.3.0",
"execa": "^3.2.0",
"ipfs-css": "^0.13.1",
"ipfs-http-client": "^42.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/running-multiple-nodes/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const IPFS = require('ipfs')
const execa = require('execa')
const os = require('os')
const path = require('path')
const hat = require('hat')
const nanoid = require('nanoid')
const {
waitForOutput
} = require('test-ipfs-example/utils')
Expand All @@ -18,7 +18,7 @@ async function testCli () {
}

async function startCliNode () {
const repoDir = path.join(os.tmpdir(), `repo-${hat()}`)
const repoDir = path.join(os.tmpdir(), `repo-${nanoid()}`)
const opts = {
env: {
...process.env,
Expand All @@ -43,7 +43,7 @@ async function testProgramatically () {
}

async function startProgramaticNode () {
const repoDir = path.join(os.tmpdir(), `repo-${hat()}`)
const repoDir = path.join(os.tmpdir(), `repo-${nanoid()}`)
const node = await IPFS.create({
repo: repoDir,
config: {
Expand Down
10 changes: 6 additions & 4 deletions packages/interface-ipfs-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"dependencies": {
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-things": "^0.2.0",
"chai-subset": "^1.6.0",
"cids": "^0.7.3",
"delay": "^4.3.0",
"dirty-chai": "^2.0.1",
"hat": "0.0.3",
"ipfs-block": "^0.8.1",
"ipfs-unixfs": "^1.0.0",
"ipfs-utils": "^0.7.2",
"ipld-dag-cbor": "^0.15.1",
"ipld-dag-pb": "^0.18.3",
"is-ipfs": "^0.6.1",
"iso-random-stream": "^1.1.1",
"it-all": "^1.0.1",
"it-concat": "^1.0.0",
"it-last": "^1.0.1",
Expand All @@ -51,11 +51,13 @@
"multibase": "^0.6.0",
"multihashes": "^0.4.14",
"multihashing-async": "^0.8.0",
"nanoid": "^2.1.11",
"peer-id": "^0.13.5",
"readable-stream": "^3.4.0"
"readable-stream": "^3.4.0",
"temp-write": "^4.0.0"
},
"devDependencies": {
"aegir": "^21.3.0",
"aegir": "21.3.0",
"ipfsd-ctl": "^3.0.0"
},
"contributors": [
Expand Down
13 changes: 5 additions & 8 deletions packages/interface-ipfs-core/src/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const { fixtures } = require('./utils')
const { Readable } = require('readable-stream')
const all = require('it-all')
const last = require('it-last')
const fs = require('fs')
const os = require('os')
const path = require('path')
Expand All @@ -13,7 +14,6 @@ const urlSource = require('ipfs-utils/src/files/url-source')
const { isNode } = require('ipfs-utils/src/env')
const { getDescribe, getIt, expect } = require('./utils/mocha')
const { echoUrl, redirectUrl } = require('./utils/echo-http-server')

const fixturesPath = path.join(__dirname, '..', 'test', 'fixtures')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
Expand Down Expand Up @@ -221,9 +221,8 @@ module.exports = (common, options) => {
emptyDir('files/empty')
]

const res = await all(ipfs.add(dirs))
const root = await last(ipfs.add(dirs))

const root = res[res.length - 1]
expect(root.path).to.equal('test-folder')
expect(root.cid.toString()).to.equal(fixtures.directory.cid)
})
Expand Down Expand Up @@ -258,9 +257,7 @@ module.exports = (common, options) => {
accumProgress += p
}

const filesAdded = await all(ipfs.add(dirs, { progress: handler }))

const root = filesAdded[filesAdded.length - 1]
const root = await last(ipfs.add(dirs, { progress: handler }))
expect(progCalled).to.be.true()
expect(accumProgress).to.be.at.least(total)
expect(root.path).to.equal('test-folder')
Expand Down Expand Up @@ -289,10 +286,10 @@ module.exports = (common, options) => {
expect(nonSeqDirFilePaths.every(p => filesAddedPaths.includes(p))).to.be.true()
})

it('should fail when passed invalid input', () => {
it('should fail when passed invalid input', async () => {
const nonValid = 138

return expect(all(ipfs.add(nonValid))).to.eventually.be.rejected()
await expect(all(ipfs.add(nonValid))).to.eventually.be.rejected()
})

it('should wrap content in a directory', async () => {
Expand Down
22 changes: 11 additions & 11 deletions packages/interface-ipfs-core/src/block/rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'use strict'

const { getDescribe, getIt, expect } = require('../utils/mocha')
const hat = require('hat')
const nanoid = require('nanoid')
const all = require('it-all')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
Expand All @@ -22,7 +22,7 @@ module.exports = (common, options) => {
after(() => common.clean())

it('should remove by CID object', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -44,7 +44,7 @@ module.exports = (common, options) => {
})

it('should remove by CID in string', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -56,7 +56,7 @@ module.exports = (common, options) => {
})

it('should remove by CID in buffer', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -69,15 +69,15 @@ module.exports = (common, options) => {

it('should remove multiple CIDs', async () => {
const cids = [
await ipfs.dag.put(Buffer.from(hat()), {
await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
}),
await ipfs.dag.put(Buffer.from(hat()), {
await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
}),
await ipfs.dag.put(Buffer.from(hat()), {
await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -94,7 +94,7 @@ module.exports = (common, options) => {
})

it('should error when removing non-existent blocks', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -111,7 +111,7 @@ module.exports = (common, options) => {
})

it('should not error when force removing non-existent blocks', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -128,7 +128,7 @@ module.exports = (common, options) => {
})

it('should return empty output when removing blocks quietly', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand All @@ -138,7 +138,7 @@ module.exports = (common, options) => {
})

it('should error when removing pinned blocks', async () => {
const cid = await ipfs.dag.put(Buffer.from(hat()), {
const cid = await ipfs.dag.put(Buffer.from(nanoid()), {
format: 'raw',
hashAlg: 'sha2-256'
})
Expand Down
6 changes: 3 additions & 3 deletions packages/interface-ipfs-core/src/dht/get.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const hat = require('hat')
const nanoid = require('nanoid')
const { getDescribe, getIt, expect } = require('../utils/mocha')

/** @typedef { import("ipfsd-ctl/src/factory") } Factory */
Expand Down Expand Up @@ -36,8 +36,8 @@ module.exports = (common, options) => {
// "invalid record keytype" - it needs to put a valid key and value for it to
// be a useful test.
it.skip('should get a value after it was put on another node', async () => {
const key = Buffer.from(hat())
const value = Buffer.from(hat())
const key = Buffer.from(nanoid())
const value = Buffer.from(nanoid())

await nodeB.dht.put(key, value)
const result = await nodeA.dht.get(key)
Expand Down
Loading