Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 5f0c424

Browse files
committed
Merge remote-tracking branch 'origin/master' into test/outside-of-mfs
2 parents 8d78eec + 04481c9 commit 5f0c424

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1164
-1062
lines changed

CHANGELOG.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,103 @@
1+
# [0.116.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.115.3...v0.116.0) (2019-10-04)
2+
3+
4+
### Features
5+
6+
* add test for listing config profiles ([142a373](https://github.com/ipfs/interface-ipfs-core/commit/142a373))
7+
8+
9+
10+
## [0.115.3](https://github.com/ipfs/interface-ipfs-core/compare/v0.115.2...v0.115.3) (2019-10-04)
11+
12+
13+
14+
## [0.115.2](https://github.com/ipfs/interface-ipfs-core/compare/v0.115.1...v0.115.2) (2019-10-04)
15+
16+
17+
### Bug Fixes
18+
19+
* configure chai for use by other modules ([77c8be9](https://github.com/ipfs/interface-ipfs-core/commit/77c8be9))
20+
* make invalid url actually invalid ([30a84fb](https://github.com/ipfs/interface-ipfs-core/commit/30a84fb))
21+
* test setting boolean configs keys on boolean fields ([d937fc1](https://github.com/ipfs/interface-ipfs-core/commit/d937fc1))
22+
23+
24+
25+
<a name="0.115.1"></a>
26+
## [0.115.1](https://github.com/ipfs/interface-ipfs-core/compare/v0.115.0...v0.115.1) (2019-10-01)
27+
28+
29+
30+
<a name="0.115.0"></a>
31+
# [0.115.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.114.0...v0.115.0) (2019-09-25)
32+
33+
34+
35+
<a name="0.114.0"></a>
36+
# [0.114.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.113.1...v0.114.0) (2019-09-16)
37+
38+
39+
### Bug Fixes
40+
41+
* change swarm test ([00341f9](https://github.com/ipfs/interface-ipfs-core/commit/00341f9))
42+
* new setup ([b724e65](https://github.com/ipfs/interface-ipfs-core/commit/b724e65))
43+
44+
45+
46+
<a name="0.113.1"></a>
47+
## [0.113.1](https://github.com/ipfs/interface-ipfs-core/compare/v0.113.0...v0.113.1) (2019-09-13)
48+
49+
50+
### Bug Fixes
51+
52+
* make pubsub unsubscribe tests work in electron renderer ([eedfe3d](https://github.com/ipfs/interface-ipfs-core/commit/eedfe3d))
53+
54+
55+
56+
<a name="0.113.0"></a>
57+
# [0.113.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.112.0...v0.113.0) (2019-09-05)
58+
59+
60+
### Bug Fixes
61+
62+
* **package:** update ipfs-utils to version 0.1.0 ([#521](https://github.com/ipfs/interface-ipfs-core/issues/521)) ([56caa89](https://github.com/ipfs/interface-ipfs-core/commit/56caa89))
63+
64+
65+
66+
<a name="0.112.0"></a>
67+
# [0.112.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.111.1...v0.112.0) (2019-09-03)
68+
69+
70+
### Bug Fixes
71+
72+
* supported add inputs ([#519](https://github.com/ipfs/interface-ipfs-core/issues/519)) ([ddc4fe7](https://github.com/ipfs/interface-ipfs-core/commit/ddc4fe7))
73+
74+
75+
76+
<a name="0.111.1"></a>
77+
## [0.111.1](https://github.com/ipfs/interface-ipfs-core/compare/v0.111.0...v0.111.1) (2019-08-30)
78+
79+
80+
### Bug Fixes
81+
82+
* change `cp` and `mv` tests to the current spec ([#515](https://github.com/ipfs/interface-ipfs-core/issues/515)) ([b107e57](https://github.com/ipfs/interface-ipfs-core/commit/b107e57))
83+
84+
85+
86+
<a name="0.111.0"></a>
87+
# [0.111.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.110.0...v0.111.0) (2019-08-28)
88+
89+
90+
91+
<a name="0.110.0"></a>
92+
# [0.110.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.109.1...v0.110.0) (2019-08-27)
93+
94+
95+
### Bug Fixes
96+
97+
* reduce the number of concurrent requests in browser ([#505](https://github.com/ipfs/interface-ipfs-core/issues/505)) ([7596634](https://github.com/ipfs/interface-ipfs-core/commit/7596634))
98+
99+
100+
1101
<a name="0.109.1"></a>
2102
## [0.109.1](https://github.com/ipfs/interface-ipfs-core/compare/v0.109.0...v0.109.1) (2019-08-06)
3103

SPEC/CONFIG.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* [config.get](#configget)
44
* [config.set](#configset)
55
* [config.replace](#configreplace)
6+
* [config.profiles.list](#configprofileslist)
7+
* [config.profiles.apply](#configprofilesapply)
68

79
#### `config.get`
810

@@ -85,5 +87,62 @@ ipfs.config.replace(newConfig, (err) => {
8587

8688
A great source of [examples][] can be found in the tests for this API.
8789

90+
#### `config.profiles.list`
91+
92+
> List available config profiles
93+
94+
##### `ipfs.config.profiles.list([options], [callback])`
95+
96+
`options` is a object.
97+
`callback` must follow `function (err, result) {}` signature, where `err` is an error if the operation was not successful.
98+
99+
If no callback is passed, a [promise][] is returned
100+
101+
**Example:**
102+
103+
```JavaScript
104+
ipfs.config.profiles.list(newConfig, (err, profiles) => {
105+
if (err) {
106+
throw err
107+
}
108+
109+
profiles.forEach(profile => {
110+
console.info(profile.name, profile.description)
111+
})
112+
})
113+
```
114+
115+
A great source of [examples][] can be found in the tests for this API.
116+
117+
#### `config.profiles.apply`
118+
119+
> Apply a config profile
120+
121+
##### `ipfs.config.profiles.apply(name, [options], [callback])`
122+
123+
`name` is a string. Call `config.profiles.list()` for a list of valid profile names.
124+
`options` an object that might contain the following values:
125+
- `dryRun` is a boolean which if true does not apply the profile
126+
`callback` must follow the `function (err, result) {}` signature, where `err` is an error if the operation was not successful.
127+
128+
If no callback is passed, a [promise][] is returned
129+
130+
**Example:**
131+
132+
```JavaScript
133+
ipfs.config.profiles.apply('lowpower', (err, diff) => {
134+
if (err) {
135+
throw err
136+
}
137+
138+
console.info(diff.old)
139+
console.info(diff.new)
140+
})
141+
```
142+
143+
Note that you will need to restart your node for config changes to take effect.
144+
145+
A great source of [examples][] can be found in the tests for this API.
146+
88147
[promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
89148
[examples]: https://github.com/ipfs/interface-ipfs-core/blob/master/src/config

SPEC/PUBSUB.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ A great source of [examples][] can be found in the tests for this API.
106106
##### `ipfs.pubsub.publish(topic, data, [callback])`
107107

108108
- `topic: String`
109-
- `data: Buffer` - The message to send
109+
- `data: Buffer|String` - The message to send
110110
- `callback: (Error) => {}` - (Optional) Calls back with an error or nothing if the publish was successful.
111111

112112
If no `callback` is passed, a promise is returned.

SPEC/STATS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Note: `stats.repo` and `repo.stat` can be used interchangeably. See [`repo.stat`
2626

2727
Where:
2828

29-
- `options` is an opcional object that might contain the following keys:
29+
- `options` is an optional object that might contain the following keys:
3030
- `peer` specifies a peer to print bandwidth for.
3131
- `proto` specifies a protocol to print bandwidth for.
3232
- `poll` is used to print bandwidth at an interval.

package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "interface-ipfs-core",
3-
"version": "0.109.1",
3+
"version": "0.116.0",
44
"description": "A test suite and interface you can use to implement a IPFS core interface.",
55
"leadMaintainer": "Alan Shaw <[email protected]>",
66
"main": "src/index.js",
@@ -39,20 +39,23 @@
3939
"async": "^2.6.2",
4040
"bl": "^3.0.0",
4141
"bs58": "^4.0.1",
42+
"callbackify": "^1.1.0",
4243
"chai": "^4.2.0",
44+
"chai-as-promised": "^7.1.1",
4345
"cids": "~0.7.1",
4446
"concat-stream": "^2.0.0",
47+
"delay": "^4.3.0",
4548
"dirty-chai": "^2.0.1",
4649
"es6-promisify": "^6.0.1",
4750
"hat": "0.0.3",
48-
"into-stream": "^5.1.0",
4951
"ipfs-block": "~0.8.0",
5052
"ipfs-unixfs": "~0.1.16",
51-
"ipfs-utils": "~0.0.3",
53+
"ipfs-utils": "~0.4.0",
5254
"ipld-dag-cbor": "~0.15.0",
53-
"ipld-dag-pb": "~0.17.3",
55+
"ipld-dag-pb": "^0.18.1",
5456
"is-ipfs": "~0.6.1",
5557
"is-plain-object": "^3.0.0",
58+
"it-pushable": "^1.2.1",
5659
"libp2p-crypto": "~0.16.0",
5760
"multiaddr": "^6.0.0",
5861
"multibase": "~0.6.0",
@@ -63,6 +66,7 @@
6366
"pull-stream": "^3.6.11",
6467
"pump": "^3.0.0",
6568
"readable-stream": "^3.1.1",
69+
"streaming-iterables": "^4.1.0",
6670
"through2": "^3.0.0"
6771
},
6872
"devDependencies": {
@@ -71,7 +75,6 @@
7175
"contributors": [
7276
"Alan Shaw <[email protected]>",
7377
"Alan Shaw <[email protected]>",
74-
"Alex Potsides <[email protected]>",
7578
"Andrey <[email protected]>",
7679
"Dan Ordille <[email protected]>",
7780
"Dan Shields <[email protected]>",
@@ -87,6 +90,7 @@
8790
"Jacob Heun <[email protected]>",
8891
"Jacob Karlsson <[email protected]>",
8992
"Jason Papakostas <[email protected]>",
93+
"Jim Pick <[email protected]>",
9094
"Joel Gustafson <[email protected]>",
9195
"Jonathan <[email protected]>",
9296
"Kevin Simper <[email protected]>",
@@ -114,10 +118,11 @@
114118
"Thiago Delgado <[email protected]>",
115119
"Travis Person <[email protected]>",
116120
"Travis Person <[email protected]>",
117-
"Vasco Santos <[email protected]>",
118121
"Vasco Santos <[email protected]>",
122+
"Vasco Santos <[email protected]>",
119123
"Volker Mische <[email protected]>",
120124
"Vutsal Singhal <[email protected]>",
125+
"achingbrain <[email protected]>",
121126
"dirkmc <[email protected]>",
122127
"greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com>",
123128
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>",

src/block/get.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,13 @@ module.exports = (createCommon, options) => {
107107
})
108108
})
109109
})
110+
111+
it('should return an error for an invalid CID', () => {
112+
return ipfs.block.get('invalid')
113+
.then(
114+
() => expect.fail('should have returned an error for invalid argument'),
115+
(err) => expect(err).to.be.an.instanceof(Error)
116+
)
117+
})
110118
})
111119
}

src/block/stat.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,21 @@ module.exports = (createCommon, options) => {
4343
done()
4444
})
4545
})
46+
47+
it('should return error for missing argument', () => {
48+
return ipfs.block.stat(null)
49+
.then(
50+
() => expect.fail('should have thrown for missing parameter'),
51+
(err) => expect(err).to.be.an.instanceof(Error)
52+
)
53+
})
54+
55+
it('should return error for invalid argument', () => {
56+
return ipfs.block.stat('invalid')
57+
.then(
58+
() => expect.fail('should have thrown for invalid parameter'),
59+
(err) => expect(err).to.be.an.instanceof(Error)
60+
)
61+
})
4662
})
4763
}

src/bootstrap/add.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,18 @@ module.exports = (createCommon, options) => {
6060
done()
6161
})
6262
})
63+
64+
it('should prevent duplicate inserts of bootstrap peers', async () => {
65+
await ipfs.bootstrap.rm(null, { all: true })
66+
67+
const added = await ipfs.bootstrap.add(validIp4)
68+
expect(added).to.have.property('Peers').that.deep.equals([validIp4])
69+
70+
const addedAgain = await ipfs.bootstrap.add(validIp4)
71+
expect(addedAgain).to.have.property('Peers').that.deep.equals([validIp4])
72+
73+
const list = await ipfs.bootstrap.list()
74+
expect(list).to.have.property('Peers').that.deep.equals([validIp4])
75+
})
6376
})
6477
}

src/config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const tests = {
55
get: require('./get'),
66
set: require('./set'),
77
replace: require('./replace'),
8-
profile: require('./profile')
8+
profiles: require('./profiles')
99
}
1010

1111
module.exports = createSuite(tests)

src/config/profile.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)