From 876ae7ca685d5e97a2ed3337f2f38d08e5d8c560 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Fri, 22 Nov 2019 14:42:51 +0000 Subject: [PATCH 1/6] docs: tweak formatting in changelog for v40 --- CHANGELOG.md | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0de1f04..cb5bff527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,34 +22,26 @@ ### BREAKING CHANGES * The `log.tail` method now returns an async iterator that yields log messages. Use it like: - -```js -for await (const message of ipfs.log.tail()) { - console.log(message) -} -``` + ```js + for await (const message of ipfs.log.tail()) { + console.log(message) + } + ``` * The response to a call to `log.level` now returns an object that has camel cased keys. i.e. `Message` and `Error` properties have changed to `message` and `error`. * Dropped support for go-ipfs <= 0.4.4 in `swarm.peers` response. * The signature for `ipfs.mount` has changed from `ipfs.mount([ipfsPath], [ipnsPath])` to `ipfs.mount([options])`. Where `options` is an optional object that may contain two boolean properties `ipfsPath` and `ipnsPath`. The response object has also changed to be camel case. See https://docs.ipfs.io/reference/api/http/#api-v0-mount. * Default ping `count` of 1 in client has been removed. The default ping count is now whatever the IPFS node defaults it to (currently 10). If you specifically need 1 ping message then please pass `count: 1` in options for `ipfs.ping()`. * Multi parameter constructor options are no longer supported. To create a new IPFS HTTP client, pass a single parameter to the constructor. The parameter can be one of: - -* String, formatted as one of: - * Multiaddr e.g. /ip4/127.0.0.1/tcp/5001 - * URL e.g. http://127.0.0.1:5001 -* [Multiaddr](https://www.npmjs.com/package/multiaddr) instance -* Object, in format of either: - * Address and path e.g. `{ apiAddr: '/ip4/127.0.0.1/tcp/5001': apiPath: '/api/v0' }` (Note: `apiAddr` can also be a string in URL form or a Multiaddr instance) - * Node.js style address e.g. `{ host: '127.0.0.1', port: 5001, protocol: 'http' }` + * String, formatted as one of: + * Multiaddr e.g. /ip4/127.0.0.1/tcp/5001 + * URL e.g. http://127.0.0.1:5001 + * [Multiaddr](https://www.npmjs.com/package/multiaddr) instance + * Object, in format of either: + * Address and path e.g. `{ apiAddr: '/ip4/127.0.0.1/tcp/5001': apiPath: '/api/v0' }` (Note: `apiAddr` can also be a string in URL form or a Multiaddr instance) + * Node.js style address e.g. `{ host: '127.0.0.1', port: 5001, protocol: 'http' }` * Errors returned from request failures are now all [`HTTPError`](https://github.com/sindresorhus/ky/blob/c0d9d2bb07e4c122a08f019b39e9c55a4c9324f3/index.js#L117-L123)s which carry a `response` property. This is a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) that can be used to inspect _all_ information relating to the HTTP response. This means that the `err.status` or `err.statusCode` property should now be accessed via `err.response.status`. - -License: MIT -Signed-off-by: Alan Shaw * files in `src/files-regular` have moved to `src`. The `src/files-mfs` directory has been renamed to `src/files`. If you were previously requiring files from these directories e.g. `require('ipfs-http-client/src/files-regular/add')` then please be aware that they have moved. -License: MIT -Signed-off-by: Alan Shaw - From 64a44f5ce63a4d97a787753a47ffef3f5e740ed8 Mon Sep 17 00:00:00 2001 From: Pedro Santos Date: Wed, 27 Nov 2019 06:41:14 +0000 Subject: [PATCH 2/6] chore: change interface tests to async node creation (#1176) * chore: change interface tests to async node creation * chore: update interface-ipfs-core dep * chore: code review changes --- package.json | 2 +- test/interface.spec.js | 11 +++++------ test/utils/interface-common-factory.js | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 423109411..955cb94af 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "cross-env": "^6.0.0", "detect-node": "^2.0.4", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.121.0", + "interface-ipfs-core": "^0.122.0", "ipfsd-ctl": "^0.47.1", "ndjson": "^1.5.0", "nock": "^11.4.0", diff --git a/test/interface.spec.js b/test/interface.spec.js index 760962b38..dc41ec325 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -7,7 +7,7 @@ const CommonFactory = require('./utils/interface-common-factory') const isWindows = process.platform && process.platform === 'win32' describe('interface-ipfs-core tests', () => { - const defaultCommonFactory = CommonFactory.create() + const defaultCommonFactory = CommonFactory.createAsync() tests.bitswap(defaultCommonFactory, { skip: [ @@ -172,7 +172,7 @@ describe('interface-ipfs-core tests', () => { ] }) - tests.name(CommonFactory.create({ + tests.name(CommonFactory.createAsync({ spawnOptions: { args: ['--offline'] } @@ -186,8 +186,7 @@ describe('interface-ipfs-core tests', () => { ] }) - // TODO: uncomment after https://github.com/ipfs/interface-ipfs-core/pull/361 being merged and a new release - tests.namePubsub(CommonFactory.create({ + tests.namePubsub(CommonFactory.createAsync({ spawnOptions: { args: ['--enable-namesys-pubsub'], initOptions: { bits: 1024, profile: 'test' } @@ -228,7 +227,7 @@ describe('interface-ipfs-core tests', () => { ] }) - tests.pubsub(CommonFactory.create({ + tests.pubsub(CommonFactory.createAsync({ spawnOptions: { args: ['--enable-pubsub-experiment'], initOptions: { bits: 1024, profile: 'test' } @@ -251,5 +250,5 @@ describe('interface-ipfs-core tests', () => { tests.stats(defaultCommonFactory) - tests.swarm(CommonFactory.createAsync()) + tests.swarm(defaultCommonFactory) }) diff --git a/test/utils/interface-common-factory.js b/test/utils/interface-common-factory.js index 4a47fda42..bd4720b6e 100644 --- a/test/utils/interface-common-factory.js +++ b/test/utils/interface-common-factory.js @@ -6,10 +6,14 @@ const IPFSFactory = require('ipfsd-ctl') const ipfsClient = require('../../src') const merge = require('merge-options') +const DEFAULT_FACTORY_OPTIONS = { + IpfsClient: ipfsClient +} + function createFactory (options) { options = options || {} - options.factoryOptions = options.factoryOptions || { IpfsClient: ipfsClient } + options.factoryOptions = options.factoryOptions || { ...DEFAULT_FACTORY_OPTIONS } options.spawnOptions = options.spawnOptions || { initOptions: { bits: 1024, profile: 'test' } } const ipfsFactory = IPFSFactory.create(options.factoryOptions) @@ -52,19 +56,18 @@ function createFactory (options) { } } -function createAsync (createFactoryOptions, createSpawnOptions) { +function createAsync (options = {}) { return () => { const nodes = [] - const setup = async (factoryOptions = {}, spawnOptions) => { + const setup = async (setupOptions = {}) => { const ipfsFactory = IPFSFactory.create(merge( - { IpfsClient: ipfsClient }, - factoryOptions, - createFactoryOptions + options.factoryOptions ? {} : { ...DEFAULT_FACTORY_OPTIONS }, + setupOptions.factoryOptions, + options.factoryOptions )) const node = await ipfsFactory.spawn(merge( - { initOptions: { profile: 'test' } }, - spawnOptions, - createSpawnOptions + setupOptions.spawnOptions, + options.spawnOptions || { initOptions: { profile: 'test' } } )) nodes.push(node) From cb39a69ca527c452d9a104bdc4bd331969c61a9c Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" <23040076+greenkeeper[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2019 06:41:54 +0000 Subject: [PATCH 3/6] chore(package): update it-glob to version 0.0.7 (#1182) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 955cb94af..7d562b413 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "ipld-dag-pb": "^0.18.1", "ipld-raw": "^4.0.0", "is-ipfs": "~0.6.1", - "it-glob": "0.0.6", + "it-glob": "0.0.7", "it-tar": "^1.1.1", "it-to-stream": "^0.1.1", "iterable-ndjson": "^1.1.0", From 2f3763f682eb4cbca5c1cd773d363491063a7483 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 27 Nov 2019 15:51:06 +0000 Subject: [PATCH 4/6] fix: pin ls with multiple CIDs (#1184) Fixes `pin.ls` with multiple CIDs, which was inadvertently unsupported since it wasn't documented but was being tested for in js-ipfs CLI tests. https://github.com/ipfs/interface-js-ipfs-core/pull/563 adds a test and documents the feature. --- package.json | 2 +- src/pin/ls.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7d562b413..1b7d098b4 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "cross-env": "^6.0.0", "detect-node": "^2.0.4", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.122.0", + "interface-ipfs-core": "^0.123.0", "ipfsd-ctl": "^0.47.1", "ndjson": "^1.5.0", "nock": "^11.4.0", diff --git a/src/pin/ls.js b/src/pin/ls.js index cd1cc07f1..9c42fd71d 100644 --- a/src/pin/ls.js +++ b/src/pin/ls.js @@ -9,10 +9,12 @@ module.exports = configure(({ ky }) => { path = null } + path = path || [] + path = Array.isArray(path) ? path : [path] options = options || {} const searchParams = new URLSearchParams(options.searchParams) - if (path) searchParams.set('arg', `${path}`) + path.forEach(p => searchParams.append('arg', `${p}`)) if (options.type) searchParams.set('type', options.type) const { Keys } = await ky.post('pin/ls', { From fd7cc4c26e6ad22311a6dc3f66ecb0e744f37608 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 27 Nov 2019 15:54:41 +0000 Subject: [PATCH 5/6] chore: update contributors --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1b7d098b4..99103fa69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipfs-http-client", - "version": "40.0.0", + "version": "40.0.1", "description": "A client library for the IPFS HTTP API", "keywords": [ "ipfs" @@ -157,6 +157,7 @@ "Níckolas Goline ", "Oli Evans ", "Orie Steele ", + "Pedro Santos ", "Pedro Teixeira ", "Pete Thomas ", "Richard Littauer ", From d95b8f16a6060c501e217ccb2835feba670ed9ce Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 27 Nov 2019 15:54:42 +0000 Subject: [PATCH 6/6] chore: release version v40.0.1 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb5bff527..0d8658a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [40.0.1](https://github.com/ipfs/js-ipfs-http-client/compare/v40.0.0...v40.0.1) (2019-11-27) + + +### Bug Fixes + +* pin ls with multiple CIDs ([#1184](https://github.com/ipfs/js-ipfs-http-client/issues/1184)) ([2f3763f](https://github.com/ipfs/js-ipfs-http-client/commit/2f3763f)) + + + # [40.0.0](https://github.com/ipfs/js-ipfs-http-client/compare/v39.0.2...v40.0.0) (2019-11-22)