diff --git a/.aegir.js b/.aegir.js index 847d73a9b..793c4eb13 100644 --- a/.aegir.js +++ b/.aegir.js @@ -1,15 +1,19 @@ 'use strict' -const promisify = require('promisify-es6') const createServer = require('ipfsd-ctl').createServer const EchoServer = require('interface-ipfs-core/src/utils/echo-http-server') -const server = createServer() +const server = createServer({ + host: '127.0.0.1', + port: 43134 +}, { + type: 'go', + ipfsHttpModule: require('./'), + ipfsBin: require('go-ipfs-dep').path() +}) const echoServer = EchoServer.createServer() -const echoServerStart = promisify(echoServer.start) -const echoServerStop = promisify(echoServer.stop) module.exports = { - bundlesize: { maxSize: '246kB' }, + bundlesize: { maxSize: '90kB' }, webpack: { resolve: { mainFields: ['browser', 'main'] @@ -27,20 +31,20 @@ module.exports = { }, hooks: { node: { - pre: () => echoServerStart(), - post: () => echoServerStop() + pre: () => echoServer.start(), + post: () => echoServer.stop() }, browser: { pre: () => { return Promise.all([ server.start(), - echoServerStart() + echoServer.start() ]) }, post: () => { return Promise.all([ server.stop(), - echoServerStop() + echoServer.stop() ]) } } diff --git a/.travis.yml b/.travis.yml index 802efe943..0509e5a96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,13 +35,25 @@ jobs: name: chrome addons: chrome: stable - script: npx aegir test -t browser -t webworker + script: npx aegir test -t browser + + - stage: test + name: chrome webworker + addons: + chrome: stable + script: npx aegir test -t webworker - stage: test name: firefox addons: firefox: latest - script: npx aegir test -t browser -t webworker -- --browsers FirefoxHeadless + script: npx aegir test -t browser -- --browsers FirefoxHeadless + + - stage: test + name: firefox webworker + addons: + firefox: latest + script: npx aegir test -t webworker -- --browsers FirefoxHeadless - stage: test name: electron-main diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d8658a5f..a40976f0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,181 @@ + +# [42.0.0](https://github.com/ipfs/js-ipfs-http-client/compare/v42.0.0-pre.2...v42.0.0) (2020-02-04) + +There are significant and breaking API changes in this release. Please see the [migration guide](https://gist.github.com/alanshaw/04b2ddc35a6fff25c040c011ac6acf26). + +### Bug Fixes + +* interface tests ([#1233](https://github.com/ipfs/js-ipfs-http-client/issues/1233)) ([d3eee0d](https://github.com/ipfs/js-ipfs-http-client/commit/d3eee0d)) + +### Features + +* `add` results now include `mode` and `mtime` properties if they were set. + +* `files.chmod` has been added. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#fileschmod) for info. + +* `files.flush` now returns the root CID for the path that was flushed (`/` by default) + +* `files.ls` results now include `mode` and `mtime` properties if they were set. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#ls) for more info. + +* `files.mkdir` now accepts `mode` and `mtime` options to allow setting mode and mtime metadata. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#filesmkdir) for more info. + +* `files.stat` result now includes `mode` and `mtime` properties if they were set. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#filesstat) for more info. + +* `files.touch` has been added. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#filestouch) for info. + +* `files.write` now accepts `mode` and `mtime` options to allow setting mode and mtime metadata. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#fileswrite) for more info. + +* `object.get` now accepts a `timeout` option. It will cause the method to throw with a `TimeoutError` if no data is received within the timeout window. It can be passed as a `number` or a `string`. If a `number` is passed it is interpreted as milliseconds, if a string is passed it is interpreted as a [human readable duration](https://www.npmjs.com/package/parse-duration). + +* `pin.add` now accepts a `timeout` option. It will cause the method to throw with a `TimeoutError` if no data is received within the timeout window. It can be passed as a `number` or a `string`. If a `number` is passed it is interpreted as milliseconds, if a string is passed it is interpreted as a [human readable duration](https://www.npmjs.com/package/parse-duration). + +* `refs` now accepts a `timeout` option. It will cause the method to throw with a `TimeoutError` if no data is received within the timeout window. It can be passed as a `number` or a `string`. If a `number` is passed it is interpreted as milliseconds, if a string is passed it is interpreted as a [human readable duration](https://www.npmjs.com/package/parse-duration). + +### BREAKING CHANGES + +* Callbacks are no longer supported on any API methods. Please use a utility such as [`callbackify`](https://www.npmjs.com/package/callbackify) on API methods that return Promises to emulate previous behaviour. See the [migration guide](https://gist.github.com/alanshaw/04b2ddc35a6fff25c040c011ac6acf26#migrating-from-callbacks) for more info. + +* `add` now returns an async iterable. + +* `add` now accepts `mode` and `mtime` options on inputs to allow setting mode and mtime metadata for added files. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#add) for more info. + +* `add` results now contain a `cid` property (a [CID instance](https://github.com/multiformats/js-cid)) instead of a string `hash` property. + +* `addReadableStream`, `addPullStream` have been removed. Please see the [migration guide](https://gist.github.com/alanshaw/04b2ddc35a6fff25c040c011ac6acf26#migrating-to-async-iterables) for more info. + +* `addFromStream` has been removed. Use `add` instead. + +* `addFromFs` has been removed. Please use the exported `globSource` utility and pass the result to `add`. See the [glob source documentation](https://github.com/ipfs/js-ipfs-http-client#glob-source) for more details and an example. + +* `addFromURL` has been removed. Please use the exported `urlSource` utility and pass the result to `add`. See the [URL source documentation](https://github.com/ipfs/js-ipfs-http-client#url-source) for more details and an example. + +* `bitswap.stat` result has changed - `wantlist` and values are now an array of [CID](https://github.com/multiformats/js-cid) instances and `peers` is now a `string[]` of peer IDs. + +* `bitswap.wantlist` now returns an array of [CID](https://github.com/multiformats/js-cid) instances. + +* `block.rm` now returns an async iterable. + +* `block.rm` now yields objects of `{ cid: CID, error: Error }`. + +* `block.stat` result now contains a `cid` property (whose value is a [CID instance](https://github.com/multiformats/js-cid)) instead of a `key` property. + +* `dht.findProvs`, `dht.provide`, `dht.put` and `dht.query` now all return an async iterable. + +* `dht.findPeer`, `dht.findProvs`, `dht.provide`, `dht.put` and `dht.query` now yield/return an object `{ id: string, addrs: Multiaddr[] }` instead of a `PeerInfo` instance(s). + +* `files.lsPullStream` and `files.lsReadableStream` have been removed. Please see the [migration guide](https://gist.github.com/alanshaw/04b2ddc35a6fff25c040c011ac6acf26#migrating-to-async-iterables) for more info. + +* `files.ls` now returns an async iterable. + +* `files.ls` results now contain a `cid` property (whose value is a [CID instance](https://github.com/multiformats/js-cid)) instead of a `hash` property. + +* `files.ls` no longer takes a `long` option (in core) - you will receive all data by default. + +* `files.readPullStream` and `files.readReadableStream` have been removed. Please see the [migration guide](https://gist.github.com/alanshaw/04b2ddc35a6fff25c040c011ac6acf26#migrating-to-async-iterables) for more info. + +* `files.read` now returns an async iterable. + +* `files.stat` result now contains a `cid` property (whose value is a [CID instance](https://github.com/multiformats/js-cid)) instead of a `hash` property. + +* `get` now returns an async iterable. The `content` property value for objects yielded from the iterator is now an async iterable that yields [`BufferList`](https://github.com/rvagg/bl) objects. + +* `id` result has changed, the `addresses` property is now a `Multiaddr[]` + +* `name.resolve` now returns an async iterable. It yields increasingly more accurate resolved values as they are discovered until the best value is selected from the quorum of 16. The "best" resolved value is the last item yielded from the iterator. If you are interested only in this best value you could use `it-last` to extract it like so: + + ```js + const last = require('it-last') + await last(ipfs.name.resolve('/ipns/QmHash')) + ``` + +* `ls` now returns an async iterable. + +* `ls` results now contain a `cid` property (whose value is a [CID instance](https://github.com/multiformats/js-cid)) instead of a `hash` property. + +* `ls` results now include `mode` and `mtime` properties if they were set. See the [core interface docs](https://github.com/ipfs/interface-js-ipfs-core/blob/master/SPEC/FILES.md#ls) for more info. + +* `pin.add` results now contain a `cid` property (a [CID instance](https://github.com/multiformats/js-cid)) instead of a string `hash` property. + +* `pin.ls` now returns an async iterable. + +* `pin.ls` results now contain a `cid` property (a [CID instance](https://github.com/multiformats/js-cid)) instead of a string `hash` property. + +* `pin.rm` results now contain a `cid` property (a [CID instance](https://github.com/multiformats/js-cid)) instead of a string `hash` property. + +* `ping` now returns an async iterable. + +* `refs` and `refs.local` now return an async iterable. + +* `repo.gc` now returns an async iterable. + +* `stats.bw` now returns an async iterable. + +* `swarm.peers` now returns an array of objects with a `peer` property that is a `string`, instead of a `PeerId` instance. + +* `swarm.addrs` now returns an array of objects `{ id: string, addrs: Multiaddr[] }` instead of `PeerInfo` instances. + +* The protocol _name_ for peer IDs in multiaddrs has changed from 'ipfs' to 'p2p'. There's no changes to data on the wire but this change is seen when multiaddrs are converted to strings. + + + + +# [42.0.0-pre.0](https://github.com/ipfs/js-ipfs-http-client/compare/v41.0.1...v42.0.0-pre.0) (2020-01-23) + + + + +## [41.0.1](https://github.com/ipfs/js-ipfs-http-client/compare/v41.0.0...v41.0.1) (2020-01-23) + + + + +# [41.0.0](https://github.com/ipfs/js-ipfs-http-client/compare/v40.2.1...v41.0.0) (2020-01-12) + + +### Bug Fixes + +* return CIDs from files.flush ([#1216](https://github.com/ipfs/js-ipfs-http-client/issues/1216)) ([13f8d7a](https://github.com/ipfs/js-ipfs-http-client/commit/13f8d7a)) + + +### Code Refactoring + +* removes format option ([#1218](https://github.com/ipfs/js-ipfs-http-client/issues/1218)) ([4ef26cd](https://github.com/ipfs/js-ipfs-http-client/commit/4ef26cd)) + + +### BREAKING CHANGES + +* `format` option is no longer supported as everything is `dag-pb` all +of the time. + +Follows on from https://github.com/ipfs/js-ipfs-mfs/pull/69 + + + + +## [40.2.1](https://github.com/ipfs/js-ipfs-http-client/compare/v40.2.0...v40.2.1) (2020-01-09) + + + + +# [40.2.0](https://github.com/ipfs/js-ipfs-http-client/compare/v40.1.0...v40.2.0) (2020-01-09) + + +### Features + +* support UnixFSv1.5 metadata ([#1186](https://github.com/ipfs/js-ipfs-http-client/issues/1186)) ([da9d17a](https://github.com/ipfs/js-ipfs-http-client/commit/da9d17a)) + + + + +# [40.1.0](https://github.com/ipfs/js-ipfs-http-client/compare/v40.0.1...v40.1.0) (2019-12-10) + + +### Features + +* expose import concurrency controls ([#1187](https://github.com/ipfs/js-ipfs-http-client/issues/1187)) ([47093d5](https://github.com/ipfs/js-ipfs-http-client/commit/47093d5)) + + + ## [40.0.1](https://github.com/ipfs/js-ipfs-http-client/compare/v40.0.0...v40.0.1) (2019-11-27) @@ -51,6 +229,8 @@ * 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`. * 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. +* Kebab case options are no longer supported. Please use camel case option names as defined in the [`interface-ipfs-core`](https://github.com/ipfs/interface-js-ipfs-core/tree/master/SPEC) docs. e.g. the `allow-offline` option to `name.publish` should be passed as `allowOffline`. + * Note that you can pass [additional query string parameters](https://github.com/ipfs/js-ipfs-http-client#additional-options) in the `searchParams` option available to all API methods. diff --git a/COPYRIGHT b/COPYRIGHT new file mode 100644 index 000000000..b8b0a702d --- /dev/null +++ b/COPYRIGHT @@ -0,0 +1,5 @@ +This project is transitioning from an MIT-only license to a dual MIT/Apache-2.0 license. +Unless otherwise noted, all code contributed prior to 2019-11-26 and not contributed by +a user listed in [this signoff issue](https://github.com/ipfs/js-ipfs-http-client/issues/1189) is +licensed under MIT-only. All new contributions (and past contributions since 2019-11-29) +are licensed under a dual MIT/Apache-2.0 license. diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 000000000..14478a3b6 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,5 @@ +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/LICENSE b/LICENSE-MIT similarity index 100% rename from LICENSE rename to LICENSE-MIT diff --git a/README.md b/README.md index 5c6a00070..bd40851aa 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +# 🔒 Archived + +The contents of this repo have been merged into [ipfs/js-ipfs](https://github.com/ipfs/js-ipfs). + +Please open [issues](https://github.com/ipfs/js-ipfs/issues) or submit [PRs](https://github.com/ipfs/js-ipfs/pulls) there. +