From 36cf4422c548c1730de0bf3165de5a48817bedd1 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 28 Nov 2018 21:01:46 +0000 Subject: [PATCH 1/5] fix: code blocks for the code License: MIT Signed-off-by: Alan Shaw --- SPEC/BITSWAP.md | 8 +-- SPEC/BLOCK.md | 12 ++--- SPEC/BOOTSTRAP.md | 16 +++--- SPEC/CONFIG.md | 12 ++--- SPEC/DAG.md | 12 ++--- SPEC/DHT.md | 24 ++++----- SPEC/FILES.md | 114 +++++++++++++++++++++--------------------- SPEC/KEY.md | 28 +++++------ SPEC/MISCELLANEOUS.md | 32 ++++++------ SPEC/NAME.md | 20 ++++---- SPEC/OBJECT.md | 40 +++++++-------- SPEC/PIN.md | 12 ++--- SPEC/PUBSUB.md | 20 ++++---- SPEC/REPO.md | 12 ++--- SPEC/STATS.md | 12 ++--- SPEC/SWARM.md | 30 +++++------ 16 files changed, 203 insertions(+), 201 deletions(-) diff --git a/SPEC/BITSWAP.md b/SPEC/BITSWAP.md index c50093e41..5f42db305 100644 --- a/SPEC/BITSWAP.md +++ b/SPEC/BITSWAP.md @@ -7,9 +7,9 @@ > Returns the wantlist, optionally filtered by peer ID -#### `Go` **WIP** +#### Go **WIP** -#### `JavaScript` - ipfs.bitswap.wantlist([peerId], [callback]) +#### JavaScript - `ipfs.bitswap.wantlist([peerId], [callback])` `callback` must follow `function (err, list) {}` signature, where `err` is an error if the operation was not successful. `list` is an Object containing the following keys: @@ -34,9 +34,9 @@ ipfs.bitswap.wantlist(peerId, (err, list) => console.log(list)) > Show diagnostic information on the bitswap agent. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.bitswap.stat([callback]) +##### JavaScript - `ipfs.bitswap.stat([callback])` Note: `bitswap.stat` and `stats.bitswap` can be used interchangeably. diff --git a/SPEC/BLOCK.md b/SPEC/BLOCK.md index c6f6b56ca..82caa10f5 100644 --- a/SPEC/BLOCK.md +++ b/SPEC/BLOCK.md @@ -8,9 +8,9 @@ > Get a raw IPFS block. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.block.get(cid, [options, callback]) +##### JavaScript - `ipfs.block.get(cid, [options], [callback])` `cid` is a [cid][cid] which can be passed as: @@ -44,9 +44,9 @@ A great source of [examples][] can be found in the tests for this API. > Stores input as an IPFS block. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.block.put(block [, options], [callback]) +##### JavaScript - `ipfs.block.put(block, [options], [callback])` Where `block` can be: @@ -114,9 +114,9 @@ A great source of [examples][] can be found in the tests for this API. > Print information of a raw IPFS block. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.block.stat(cid, [callback]) +##### JavaScript - `ipfs.block.stat(cid, [callback])` `cid` is a [cid][cid] which can be passed as: diff --git a/SPEC/BOOTSTRAP.md b/SPEC/BOOTSTRAP.md index 4c8280b45..ac5e91ab4 100644 --- a/SPEC/BOOTSTRAP.md +++ b/SPEC/BOOTSTRAP.md @@ -14,21 +14,21 @@ > Add a peer address to the bootstrap list -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.bootstrap.add(addr, [opts,] callback) +##### JavaScript - `ipfs.bootstrap.add(addr, [options], [callback])` - `addr` is a [multiaddr](https://github.com/multiformats/js-multiaddr) to a peer node -- `opts.default` if true, add the default peers to the list +- `options.default` if true, add the default peers to the list - `callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. `res.Peers` is an array of added addresses. #### `bootstrap.list` > List all peer addresses in the bootstrap list -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.bootstrap.list(callback) +##### JavaScript - `ipfs.bootstrap.list([callback])`` - `callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. `res.Peers` is an array of addresses. @@ -37,10 +37,10 @@ > Remove a peer address from the bootstrap list -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.bootstrap.rm(peer, [opt,] callback) +##### JavaScript - `ipfs.bootstrap.rm(peer, [options], [callback])` - `addr` is a [multiaddr](https://github.com/multiformats/js-multiaddr) to a peer node -- `opts.all` if true, remove all peers from the list +- `options.all` if true, remove all peers from the list - `callback` must follow `function (err, res) {}` signature, where `err` is an error if the operation was not successful. `res.Peers` is an array of removed addresses. diff --git a/SPEC/CONFIG.md b/SPEC/CONFIG.md index d9fec06e8..38490ff17 100644 --- a/SPEC/CONFIG.md +++ b/SPEC/CONFIG.md @@ -8,9 +8,9 @@ > Returns the currently being used config. If the daemon is off, it returns the stored config. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.config.get([key, callback]) +##### JavaScript - `ipfs.config.get([key], [callback])` `key` is the key of the value that should be fetched from the config file. If no key is passed, then the whole config should be returned. `key` should be of type String. @@ -35,9 +35,9 @@ A great source of [examples][] can be found in the tests for this API. > Adds or replaces a config value. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.config.set(key, value, [callback]) +##### JavaScript - `ipfs.config.set(key, value, [callback])` `key` is the key value that will be added or replaced (in case of the value already). `key` should be of type String. @@ -66,9 +66,9 @@ A great source of [examples][] can be found in the tests for this API. > Adds or replaces a config file. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.config.replace(config, [callback]) +##### JavaScript - `ipfs.config.replace(config, [callback])` `config` is a JSON object that contains the new config. diff --git a/SPEC/DAG.md b/SPEC/DAG.md index 999a0d2db..0160013ae 100644 --- a/SPEC/DAG.md +++ b/SPEC/DAG.md @@ -10,9 +10,9 @@ > Store an IPLD format node -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dag.put(dagNode, [options], [callback]) +##### JavaScript - `ipfs.dag.put(dagNode, [options], [callback])` - `dagNode` - a DAG node that follows one of the supported IPLD formats. - `options` - a object that might contain the following values: @@ -46,9 +46,9 @@ A great source of [examples][] can be found in the tests for this API. > Retrieve an IPLD format node -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dag.get(cid, [path], [options], [callback]) +##### JavaScript - `ipfs.dag.get(cid, [path], [options], [callback])` - `cid` - can be one of the following: - a [CID](https://github.com/ipfs/js-cid) instance. @@ -117,9 +117,9 @@ A great source of [examples][] can be found in the tests for this API. > Enumerate all the entries in a graph -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dag.tree(cid, [path], [options], [callback]) +##### JavaScript - `ipfs.dag.tree(cid, [path], [options], [callback])` - `cid` - can be one of the following: - a [CID](https://github.com/ipfs/js-cid) instance. diff --git a/SPEC/DHT.md b/SPEC/DHT.md index 7be88b09c..ac77b91f2 100644 --- a/SPEC/DHT.md +++ b/SPEC/DHT.md @@ -11,9 +11,9 @@ > Retrieve the Peer Info of a reachable node in the network. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dht.findpeer(peerId, [callback]) +##### JavaScript - `ipfs.dht.findpeer(peerId, [callback])` Where `peerId` is a IPFS/libp2p Id of type [PeerId](https://github.com/libp2p/js-peer-id). @@ -37,9 +37,9 @@ A great source of [examples][] can be found in the tests for this API. > Retrieve the providers for content that is addressed by an hash. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dht.findprovs(hash, [options], callback]) +##### JavaScript - `ipfs.dht.findprovs(hash, [options], [callback])` Where `hash` is a multihash. @@ -64,9 +64,9 @@ A great source of [examples][] can be found in the tests for this API. > Retrieve a value from DHT -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dht.get(key, [callback]) +##### JavaScript - `ipfs.dht.get(key, [callback])` Where `key` is a string. @@ -86,9 +86,9 @@ A great source of [examples][] can be found in the tests for this API. > Announce to the network that you are providing given values. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dht.provide(cid, [callback]) +##### JavaScript - `ipfs.dht.provide(cid, [callback])` Where `cid` is a CID or array of CIDs. @@ -108,9 +108,9 @@ A great source of [examples][] can be found in the tests for this API. > Store a value on the DHT -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dht.put(key, value, [callback]) +##### JavaScript - `ipfs.dht.put(key, value, [callback])` Where `key` is a string and `value` can be of any type. @@ -130,9 +130,9 @@ A great source of [examples][] can be found in the tests for this API. > Queries the network for the 'closest peers' to a given key. 'closest' is defined by the rules of the underlying Peer Routing mechanism. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dht.query(peerId, [callback]) +##### JavaScript - `ipfs.dht.query(peerId, [callback])` Where `peerId` is a IPFS/libp2p Id of type [PeerId](https://github.com/libp2p/js-peer-id). diff --git a/SPEC/FILES.md b/SPEC/FILES.md index 10a6e2a73..05ad04941 100644 --- a/SPEC/FILES.md +++ b/SPEC/FILES.md @@ -35,9 +35,9 @@ > Add files and data to IPFS. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.add(data, [options], [callback]) +##### JavaScript - `ipfs.add(data, [options], [callback])` Where `data` may be: @@ -130,9 +130,9 @@ A great source of [examples][] can be found in the tests for this API. > Add files and data to IPFS using a [Readable Stream][rs] of class Duplex. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.addReadableStream([options]) -> [Readable Stream][rs] +##### JavaScript - `ipfs.addReadableStream([options])` -> [Readable Stream][rs] Returns a Readable Stream of class Duplex, where objects can be written of the forms @@ -180,9 +180,9 @@ A great source of [examples][] can be found in the tests for this API. > Add files and data to IPFS using a [Pull Stream][ps]. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.addPullStream([options]) -> [Pull Stream][ps] +##### JavaScript - `ipfs.addPullStream([options])` -> [Pull Stream][ps] Returns a Pull Stream, where objects can be written of the forms @@ -226,13 +226,15 @@ pull( > Add files or entire directories from the FileSystem to IPFS -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.addFromFs(path, [option], [callback]) +##### JavaScript - `ipfs.addFromFs(path, [options], [callback])` -Reads a file or folder from `path` on the filesystem and adds it to IPFS. Options: -- **recursive**: If `path` is a directory, use option `{ recursive: true }` to add the directory and all its sub-directories. - - **ignore**: To exclude fileglobs from the directory, use option `{ ignore: ['ignore/this/folder/**', 'and/this/file'] }`. +Reads a file or folder from `path` on the filesystem and adds it to IPFS. + +Options: + - **recursive**: If `path` is a directory, use option `{ recursive: true }` to add the directory and all its sub-directories. + - **ignore**: To exclude file globs from the directory, use option `{ ignore: ['ignore/this/folder/**', 'and/this/file'] }`. - **hidden**: hidden/dot files (files or folders starting with a `.`, for example, `.git/`) are not included by default. To add them, use the option `{ hidden: true }`. ```JavaScript @@ -259,9 +261,9 @@ ipfs.addFromFs('path/to/a/folder', { recursive: true , ignore: ['subfolder/to/ig > Add a file from a URL to IPFS -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.addFromURL(url, callback) +##### JavaScript - `ipfs.addFromURL(url, [callback])` ```JavaScript ipfs.addFromURL('http://example.com/', (err, result) => { @@ -276,11 +278,11 @@ ipfs.addFromURL('http://example.com/', (err, result) => { > Add a file from a stream to IPFS -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.addFromStream(stream, callback) +##### JavaScript - `ipfs.addFromStream(stream, [callback])` -This is very similar to `ipfs.files.add({path:'', content: stream})`. It is like the reverse of cat. +This is very similar to `ipfs.files.add({ path:'', content: stream })`. It is like the reverse of cat. ```JavaScript ipfs.addFromStream(, (err, result) => { @@ -295,9 +297,9 @@ ipfs.addFromStream(, (err, result) => { > Returns a file addressed by a valid IPFS Path. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.cat(ipfsPath, [options], [callback]) +##### JavaScript - `ipfs.cat(ipfsPath, [options], [callback])` `ipfsPath` can be of type: @@ -336,9 +338,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns a [Readable Stream][rs] containing the contents of a file addressed by a valid IPFS Path. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.catReadableStream(ipfsPath, [options]) -> [Readable Stream][rs] +##### JavaScript - `ipfs.catReadableStream(ipfsPath, [options])` -> [Readable Stream][rs] `ipfsPath` can be of type: @@ -369,9 +371,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns a [Pull Stream][ps] containing the contents of a file addressed by a valid IPFS Path. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.catPullStream(ipfsPath, [options]) -> [Pull Stream][rs] +##### JavaScript - `ipfs.catPullStream(ipfsPath, [options])` -> [Pull Stream][rs] `ipfsPath` can be of type: @@ -401,9 +403,9 @@ A great source of [examples][] can be found in the tests for this API. > Fetch a file or an entire directory tree from IPFS that is addressed by a valid IPFS Path. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.get(ipfsPath, [callback]) +##### JavaScript - `ipfs.get(ipfsPath, [callback])` ipfsPath can be of type: @@ -447,9 +449,9 @@ A great source of [examples][] can be found in the tests for this API. > Fetch a file or an entire directory tree from IPFS that is addressed by a valid IPFS Path. The files will be yielded as Readable Streams. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.getReadableStream(ipfsPath) -> [Readable Stream][rs] +##### JavaScript - `ipfs.getReadableStream(ipfsPath)` -> [Readable Stream][rs] ipfsPath can be of type: @@ -495,9 +497,9 @@ A great source of [examples][] can be found in the tests for this API. > Fetch a file or an entire directory tree from IPFS that is addressed by a valid IPFS Path. The files will be yielded as Readable Streams. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.getPullStream(ipfsPath) -> [Pull Stream][ps] +##### JavaScript - `ipfs.getPullStream(ipfsPath)` -> [Pull Stream][ps] ipfsPath can be of type: @@ -546,9 +548,9 @@ A great source of [examples][] can be found in the tests for this API. > Lists a directory from IPFS that is addressed by a valid IPFS Path. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.ls(ipfsPath, [callback]) +##### JavaScript - `ipfs.ls(ipfsPath, [callback])` > **Note:** ipfs.files.ls is currently only for MFS directories. The goal is to converge both functionality. @@ -595,9 +597,9 @@ A great source of [examples][] can be found in the tests for this API. > Lists a directory from IPFS that is addressed by a valid IPFS Path. The list will be yielded as Readable Streams. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.lsReadableStream(ipfsPath) -> [Readable Stream][rs] +##### JavaScript - `ipfs.lsReadableStream(ipfsPath)` -> [Readable Stream][rs] > **Note:** ipfs.files.ls is currently only for MFS directories. The goal is to converge both functionality. @@ -643,9 +645,9 @@ A great source of [examples][] can be found in the tests for this API. > Fetch a file or an entire directory tree from IPFS that is addressed by a valid IPFS Path. The files will be yielded through a Pull Stream. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.lsPullStream(ipfsPath) -> [Pull Stream][ps] +##### JavaScript - `ipfs.lsPullStream(ipfsPath)` -> [Pull Stream][ps] > **Note:** ipfs.files.ls is currently only for MFS directories. The goal is to converge both functionality. @@ -705,9 +707,9 @@ The Mutable File System (MFS) is a virtual file system on top of IPFS that expos > Copy files. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.cp(...from, to, [options], [callback]) +##### JavaScript - `ipfs.files.cp(...from, to, [options], [callback])` Where: @@ -761,9 +763,9 @@ ipfs.files.cp('/src-file1', '/src-file2', '/dst-dir', (err) => { > Make a directory. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.mkdir(path, [options], [callback]) +##### JavaScript - `ipfs.files.mkdir(path, [options], [callback])` Where: @@ -791,9 +793,9 @@ ipfs.files.mkdir('/my/beautiful/directory', (err) => { > Get file or directory status. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.stat(path, [options], [callback]) +##### JavaScript - `ipfs.files.stat(path, [options], [callback])` Where: @@ -836,9 +838,9 @@ ipfs.files.stat('/file.txt', (err, stats) => { > Remove a file or directory. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.rm(...paths, [options], [callback]) +##### JavaScript - `ipfs.files.rm(...paths, [options], [callback])` Where: @@ -878,9 +880,9 @@ ipfs.files.rm('/my/beautiful/directory', { recursive: true }, (err) => { > Read a file into a [`Buffer`][b]. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.read(path, [options], [callback]) +##### JavaScript - `ipfs.files.read(path, [options], [callback])` Where: @@ -908,9 +910,9 @@ ipfs.files.read('/hello-world', (error, buf) => { > Read a file into a [`ReadableStream`][rs]. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.readReadableStream(path, [options]) +##### JavaScript - `ipfs.files.readReadableStream(path, [options])` Where: @@ -934,9 +936,9 @@ stream.on('data', (buf) => console.log(buf.toString('utf8'))) > Read a file into a [`PullStream`][ps]. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.readPullStream(path, [options]) +##### JavaScript - `ipfs.files.readPullStream(path, [options])` Where: @@ -963,9 +965,9 @@ pull( > Write to a file. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.write(path, content, [options], [callback]) +##### JavaScript - `ipfs.files.write(path, content, [options], [callback])` Where: @@ -1000,9 +1002,9 @@ ipfs.files.write('/hello-world', Buffer.from('Hello, world!'), (err) => { > Move files. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.mv(...from, to, [options], [callback]) +##### JavaScript - `ipfs.files.mv(...from, to, [options], [callback])` Where: @@ -1053,9 +1055,9 @@ ipfs.files.mv('/src-file1', '/src-file2', '/dst-dir', (err) => { > Flush a given path's data to the disk -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.flush([...paths], [callback]) +##### JavaScript - `ipfs.files.flush([...paths], [callback])` Where: @@ -1078,9 +1080,9 @@ ipfs.files.flush('/', (err) => { > List directories in the local mutable namespace. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.files.ls([path], [options], [callback]) +##### JavaScript - `ipfs.files.ls([path], [options], [callback])` Where: diff --git a/SPEC/KEY.md b/SPEC/KEY.md index 238511993..3f0e6d662 100644 --- a/SPEC/KEY.md +++ b/SPEC/KEY.md @@ -11,9 +11,9 @@ > Generate a new key -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.key.gen(name, options, [callback]) +##### JavaScript - `ipfs.key.gen(name, options, [callback])` Where: @@ -42,13 +42,13 @@ ipfs.key.gen('my-key', { > List all the keys -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.key.list([callback]) +##### JavaScript - `ipfs.key.list([callback])` `callback` must follow `function (err, keys) {}` signature, where `err` is an Error if the operation was not successful. `keys` is an array of: -``` +```js { id: 'hash', // string - the hash of the key name: 'self' // string - the name of the key @@ -74,16 +74,16 @@ ipfs.key.list((err, keys) => console.log(keys)) > Remove a key -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.key.rm(name, [callback]) +##### JavaScript - `ipfs.key.rm(name, [callback])` Where: - `name` is the local name for the key `callback` must follow `function (err, key) {}` signature, where `err` is an Error if the operation was not successful. `key` is an object that describes the removed key: -``` +```js { id: 'hash', // string - the hash of the key name: 'self' // string - the name of the key @@ -105,9 +105,9 @@ ipfs.key.rm('my-key', (err, key) => console.log(key)) > Rename a key -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.key.rename(oldName, newName, [callback]) +##### JavaScript - `ipfs.key.rename(oldName, newName, [callback])` Where: - `oldName` is the local name for the key @@ -132,9 +132,9 @@ ipfs.key.rename('my-key', 'my-new-key', (err, key) => console.log(key)) > Export a key in a PEM encoded password protected PKCS #8 -##### `Go` **NYI** +##### Go **NYI** -##### `JavaScript` - ipfs.key.export(name, password, [callback]) +##### JavaScript - `ipfs.key.export(name, password, [callback])` Where: - `name` is the local name for the key @@ -160,9 +160,9 @@ ipfs.key.export('self', 'password', (err, pem) => console.log(pem)) > Import a PEM encoded password protected PKCS #8 key -##### `Go` **NYI** +##### Go **NYI** -##### `JavaScript` - ipfs.key.import(name, pem, password, [callback]) +##### JavaScript - `ipfs.key.import(name, pem, password, [callback])` Where: - `name` is a local name for the key diff --git a/SPEC/MISCELLANEOUS.md b/SPEC/MISCELLANEOUS.md index 4cd9c7b37..91fe5884a 100644 --- a/SPEC/MISCELLANEOUS.md +++ b/SPEC/MISCELLANEOUS.md @@ -13,9 +13,9 @@ > Returns the identity of the Peer -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.id([callback]) +##### JavaScript - `ipfs.id([callback])` `callback` must follow `function (err, identity) {}` signature, where `err` is an error if the operation was not successful. `identity` is an object with the Peer identity. @@ -38,9 +38,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/blob/ma > Returns the implementation version -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.version([callback]) +##### JavaScript - `ipfs.version([callback])` `callback` must follow `function (err, version) {}` signature, where `err` is an error if the operation was not successful. `version` is an object with the version of the implementation, the commit and the Repo. @@ -63,9 +63,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/blob/ma > Resolve DNS links -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.dns(domain, [callback]) +##### JavaScript - `ipfs.dns(domain, [callback])` `callback` must follow `function (err, path) {}` signature, where `err` is an error if the operation was not successful. `path` is the IPFS path for that domain. @@ -88,9 +88,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/blob/ma > Stops the IPFS node and in case of talking with an IPFS Daemon, it stops the process. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.stop([callback]) +##### JavaScript - `ipfs.stop([callback])` `callback` must follow `function (err) {}` signature, where `err` is an error if the operation was not successful. If no `callback` is passed, a promise is returned. @@ -111,9 +111,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/blob/ma > Send echo request packets to IPFS hosts -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.ping(peerId, [options], [callback]) +##### JavaScript - `ipfs.ping(peerId, [options], [callback])` Where: @@ -158,9 +158,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/tree/ma > Stream echo request packets to IPFS hosts -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pingPullStream(peerId, [options], [callback]) +##### JavaScript - `ipfs.pingPullStream(peerId, [options], [callback])` Where: @@ -203,9 +203,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/tree/ma > Stream echo request packets to IPFS hosts -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pingReadableStream(peerId, [options], [callback]) +##### JavaScript - `ipfs.pingReadableStream(peerId, [options], [callback])` Where: @@ -247,9 +247,9 @@ A great source of [examples](https://github.com/ipfs/interface-ipfs-core/tree/ma There are a number of mutable name protocols that can link among themselves and into IPNS. For example IPNS references can (currently) point at an IPFS object, and DNS links can point at other DNS links, IPNS entries, or IPFS objects. This command accepts any of these identifiers and resolves them to the referenced item. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.resolve(name, [options], [callback]) +##### JavaScript - `ipfs.resolve(name, [options], [callback])` Where: diff --git a/SPEC/NAME.md b/SPEC/NAME.md index 7b459522f..5b96e398e 100644 --- a/SPEC/NAME.md +++ b/SPEC/NAME.md @@ -10,9 +10,9 @@ > Publish an IPNS name with a given value. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.name.publish(value, [options, callback]) +##### JavaScript - `ipfs.name.publish(value, [options], [callback])` `value` is a base58 encoded IPFS multihash, such as: `/ipfs/QmbezGequPwcsWo8UL4wDF6a8hYwM1hmbzYv2mnKkEWaUp`. @@ -62,9 +62,9 @@ This way, you can republish a new version of your website under the same address > Cancel a name subscription. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.name.pubsub.cancel(arg, [callback]) +##### JavaScript - `ipfs.name.pubsub.cancel(arg, [callback])` `arg` is the name of the subscription to cancel. @@ -93,9 +93,9 @@ ipfs.name.pubsub.cancel(name, function (err, result) { > Query the state of IPNS pubsub. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.name.pubsub.state([callback]) +##### JavaScript - `ipfs.name.pubsub.state([callback])` `callback` must follow `function (err, result) {}` signature, where `err` is an error if the operation was not successful. `result` is an object that contains the result of the operation, such as: @@ -120,9 +120,9 @@ ipfs.name.pubsub.state(function (err, result) { > Show current name subscriptions. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.name.pubsub.subs([callback]) +##### JavaScript - `ipfs.name.pubsub.subs([callback])` `callback` must follow `function (err, result) {}` signature, where `err` is an error if the operation was not successful. `result` is an array of subscriptions, such as: @@ -145,9 +145,9 @@ ipfs.name.pubsub.subs(function (err, result) { > Resolve an IPNS name. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.name.resolve(value, [options, callback]) +##### JavaScript - `ipfs.name.resolve(value, [options], [callback])` `value` is a IPNS address, such as: `/ipns/ipfs.io`. diff --git a/SPEC/OBJECT.md b/SPEC/OBJECT.md index 062b5112b..3f6eea2a2 100644 --- a/SPEC/OBJECT.md +++ b/SPEC/OBJECT.md @@ -15,9 +15,9 @@ > Create a new MerkleDAG node, using a specific layout. Caveat: So far, only UnixFS object layouts are supported. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.object.new([template], [callback]) +##### JavaScript - `ipfs.object.new([template], [callback])` `template` if defined, must be a string `unixfs-dir` and if that is passed, the created node will be an empty unixfs style directory. @@ -44,9 +44,9 @@ A great source of [examples][] can be found in the tests for this API. > Store an MerkleDAG node. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.object.put(obj, [options], [callback]) +##### JavaScript - `ipfs.object.put(obj, [options], [callback])` `obj` is the MerkleDAG Node to be stored. Can of type: @@ -86,9 +86,9 @@ A great source of [examples][] can be found in the tests for this API. > Fetch a MerkleDAG node -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.object.get(multihash, [options], [callback]) +##### JavaScript - `ipfs.object.get(multihash, [options], [callback])` `multihash` is a [multihash][] which can be passed as: @@ -124,9 +124,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns the Data field of an object -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.object.data(multihash, [options], [callback]) +##### JavaScript - `ipfs.object.data(multihash, [options], [callback])` `multihash` is a [multihash][] which can be passed as: - Buffer, the raw Buffer of the multihash (or of and encoded version) @@ -161,9 +161,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns the Links field of an object -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.object.links(multihash, [options], [callback]) +##### JavaScript - `ipfs.object.links(multihash, [options], [callback])` `multihash` is a [multihash][] which can be passed as: @@ -199,9 +199,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns stats about an Object -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.object.stat(multihash, [options], [callback]) +##### JavaScript - `ipfs.object.stat(multihash, [options], [callback])` `multihash` is a [multihash][] which can be passed as: @@ -259,9 +259,9 @@ A great source of [examples][] can be found in the tests for this API. > Add a Link to an existing MerkleDAG Object -###### `Go` **WIP** +###### Go **WIP** -###### `JavaScript` - ipfs.object.patch.addLink(multihash, link, [options], [callback]) +###### JavaScript - `ipfs.object.patch.addLink(multihash, link, [options], [callback])` `multihash` is a [multihash][] which can be passed as: @@ -315,9 +315,9 @@ A great source of [examples][] can be found in the tests for this API. > Remove a Link from an existing MerkleDAG Object -###### `Go` **WIP** +###### Go **WIP** -###### `JavaScript` - ipfs.object.patch.rmLink(multihash, link, [options], [callback]) +###### JavaScript - `ipfs.object.patch.rmLink(multihash, link, [options], [callback])` `multihash` is a [multihash][] which can be passed as: @@ -359,9 +359,9 @@ A great source of [examples][] can be found in the tests for this API. > Append Data to the Data field of an existing node. -###### `Go` **WIP** +###### Go **WIP** -###### `JavaScript` - ipfs.object.patch.appendData(multihash, data, [options], [callback]) +###### JavaScript - `ipfs.object.patch.appendData(multihash, data, [options], [callback])` `multihash` is a [multihash][] which can be passed as: @@ -394,9 +394,9 @@ A great source of [examples][] can be found in the tests for this API. > Reset the Data field of a MerkleDAG Node to new Data -###### `Go` **WIP** +###### Go **WIP** -###### `JavaScript` - ipfs.object.patch.setData(multihash, data, [options], [callback]) +###### JavaScript - `ipfs.object.patch.setData(multihash, data, [options], [callback])` `multihash` is a [multihash][] which can be passed as: diff --git a/SPEC/PIN.md b/SPEC/PIN.md index 4ce6a77e6..d44b27c87 100644 --- a/SPEC/PIN.md +++ b/SPEC/PIN.md @@ -8,9 +8,9 @@ > Adds an IPFS object to the pinset and also stores it to the IPFS repo. pinset is the set of hashes currently pinned (not gc'able). -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pin.add(hash, [options], [callback]) +##### JavaScript - `ipfs.pin.add(hash, [options], [callback])` Where: @@ -38,9 +38,9 @@ ipfs.pin.add(hash, function (err) {}) > List all the objects pinned to local storage or under a specific hash. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pin.ls([hash], [options], [callback]) +##### JavaScript - `ipfs.pin.ls([hash], [options], [callback])` Where: @@ -69,9 +69,9 @@ A great source of [examples][] can be found in the tests for this API. > Remove a hash from the pinset -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pin.rm(hash, [options], [callback]) +##### JavaScript - `ipfs.pin.rm(hash, [options], [callback])` Where: - `hash` is a multihash. diff --git a/SPEC/PUBSUB.md b/SPEC/PUBSUB.md index 424f50c78..db830aafd 100644 --- a/SPEC/PUBSUB.md +++ b/SPEC/PUBSUB.md @@ -10,9 +10,9 @@ > Subscribe to a pubsub topic. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pubsub.subscribe(topic, handler, [options], [callback]) +##### JavaScript - `ipfs.pubsub.subscribe(topic, handler, [options], [callback])` - `topic: String` - `handler: (msg) => {}` - Event handler which will be called with a message object everytime one is received. The `msg` has the format `{from: String, seqno: Buffer, data: Buffer, topicIDs: Array}`. @@ -44,9 +44,9 @@ A great source of [examples][] can be found in the tests for this API. > Unsubscribes from a pubsub topic. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - `ipfs.pubsub.unsubscribe(topic, handler, [callback])` +##### JavaScript - `ipfs.pubsub.unsubscribe(topic, handler, [callback])` - `topic: String` - The topic to unsubscribe from - `handler: (msg) => {}` - The handler to remove. @@ -88,9 +88,9 @@ A great source of [examples][] can be found in the tests for this API. > Publish a data message to a pubsub topic. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pubsub.publish(topic, data, [callback]) +##### JavaScript - `ipfs.pubsub.publish(topic, data, [callback])` - `topic: String` - `data: Buffer` - The message to send @@ -119,9 +119,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns the list of subscriptions the peer is subscribed to. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pubsub.ls([callback]) +##### JavaScript - `ipfs.pubsub.ls([callback])` - `callback: (Error, Array) => {}` - (Optional) Calls back with an error or a list of topicIDs that this peer is subscribed to. @@ -144,9 +144,9 @@ A great source of [examples][] can be found in the tests for this API. > Returns the peers that are subscribed to one topic. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.pubsub.peers(topic, [callback]) +##### JavaScript - `ipfs.pubsub.peers(topic, [callback])` - `topic: String` - `callback: (Error, Array) => {}` - (Optional) Calls back with an error or a list of peer IDs subscribed to the `topic`. diff --git a/SPEC/REPO.md b/SPEC/REPO.md index 9eb88ba05..4ce638ba8 100644 --- a/SPEC/REPO.md +++ b/SPEC/REPO.md @@ -8,9 +8,9 @@ > Perform a garbage collection sweep on the repo. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.repo.gc([options, callback]) +##### JavaScript - `ipfs.repo.gc([options], [callback])` Where: @@ -32,9 +32,9 @@ ipfs.repo.gc((err, res) => console.log(res)) > Get stats for the currently used repo. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.repo.stat([options, callback]) +##### JavaScript - `ipfs.repo.stat([options], [callback])` `stats.repo` and `repo.stat` can be used interchangeably. @@ -69,9 +69,9 @@ ipfs.repo.stat((err, stats) => console.log(stats)) > Show the repo version. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.repo.version([callback]) +##### JavaScript - `ipfs.repo.version([callback])` `callback` must follow `function (err, version) {}` signature, where `err` is an Error if the operation was not successful and `version` is a String containing the version. diff --git a/SPEC/STATS.md b/SPEC/STATS.md index 58b0c7370..295a4aa95 100644 --- a/SPEC/STATS.md +++ b/SPEC/STATS.md @@ -22,9 +22,9 @@ Note: `stats.repo` and `repo.stat` can be used interchangeably. See [`repo.stat` > Get IPFS bandwidth information as an object. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.stats.bw([options, callback]) +##### JavaScript - `ipfs.stats.bw([options], [callback])` Where: @@ -60,9 +60,9 @@ ipfs.stats.bw((err, stats) => console.log(stats)) > Get IPFS bandwidth information as a [Pull Stream][ps]. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.stats.bwPullStream([options]) -> [Pull Stream][ps] +##### JavaScript - `ipfs.stats.bwPullStream([options])` -> [Pull Stream][ps] Options are described on [`ipfs.stats.bw`](#bw). @@ -91,9 +91,9 @@ pull( > Get IPFS bandwidth information as a [Readable Stream][rs]. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.stats.bwReadableStream([options]) -> [Readable Stream][rs] +##### JavaScript - `ipfs.stats.bwReadableStream([options])` -> [Readable Stream][rs] Options are described on [`ipfs.stats.bw`](#bw). diff --git a/SPEC/SWARM.md b/SPEC/SWARM.md index cd0574338..57d07e9d0 100644 --- a/SPEC/SWARM.md +++ b/SPEC/SWARM.md @@ -11,9 +11,9 @@ > List of known addresses of each peer connected. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.addrs([callback]) +##### JavaScript - `ipfs.swarm.addrs([callback])` `callback` must follow `function (err, addrs) {}` signature, where `err` is an error if the operation was not successful. `addrs` will be an array of [`PeerInfo`](https://github.com/libp2p/js-peer-info)s. @@ -36,9 +36,9 @@ A great source of [examples][] can be found in the tests for this API. > Open a connection to a given address. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.connect(addr, [callback]) +##### JavaScript - `ipfs.swarm.connect(addr, [callback])` Where `addr` is of type [multiaddr](https://github.com/multiformats/js-multiaddr) @@ -63,9 +63,9 @@ A great source of [examples][] can be found in the tests for this API. > Close a connection on a given address. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.disconnect(addr, [callback]) +##### JavaScript - `ipfs.swarm.disconnect(addr, [callback])` Where `addr` is of type [multiaddr](https://github.com/multiformats/js-multiaddr) @@ -85,11 +85,11 @@ A great source of [examples][] can be found in the tests for this API. > List out the peers that we have connections with. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.peers([opts] [, callback]) +##### JavaScript - `ipfs.swarm.peers([options], [callback])` -If `opts.verbose` is set to `true` additional information, such as `latency` is provided. +If `options.verbose` is set to `true` additional information, such as `latency` is provided. `callback` must follow `function (err, peerInfos) {}` signature, where `err` is an error if the operation was not successful. `peerInfos` will be an array of the form @@ -132,9 +132,9 @@ A great source of [examples][] can be found in the tests for this API. > Display current multiaddr filters. Filters are a way to set up rules for the network connections established. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.filters([callback]) +##### JavaScript - `ipfs.swarm.filters([callback])` `callback` must follow `function (err, filters) {}` signature, where `err` is an error if the operation was not successful. `filters` is an array of multiaddrs that represent the filters being applied. @@ -150,9 +150,9 @@ ipfs.swarm.filters(function (err, filters) {}) > Add another filter. -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.filters.add(filter, [callback]) +##### JavaScript - `ipfs.swarm.filters.add(filter, [callback])` Where `filter` is of type [multiaddr]() @@ -170,9 +170,9 @@ ipfs.swarm.filters.add(filter, function (err) {}) > Remove a filter -##### `Go` **WIP** +##### Go **WIP** -##### `JavaScript` - ipfs.swarm.filters.rm(filter, [callback]) +##### JavaScript - `ipfs.swarm.filters.rm(filter, [callback])` Where `filter` is of type [multiaddr]() From 0d7b447788d0f97300af1bbe9f72920ee217d2ed Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Thu, 29 Nov 2018 09:21:22 +0000 Subject: [PATCH 2/5] chore: increase ping timeouts (#400) This takes around 15s locally and can sometimes take take significantly longer https://github.com/ipfs/go-ipfs/issues/5799 License: MIT Signed-off-by: Alan Shaw --- js/src/ping/ping-pull-stream.js | 3 ++- js/src/ping/ping-readable-stream.js | 3 ++- js/src/ping/ping.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/src/ping/ping-pull-stream.js b/js/src/ping/ping-pull-stream.js index 3048c732a..28b8d056f 100644 --- a/js/src/ping/ping-pull-stream.js +++ b/js/src/ping/ping-pull-stream.js @@ -14,7 +14,8 @@ module.exports = (createCommon, options) => { const common = createCommon() describe('.pingPullStream', function () { - this.timeout(60 * 1000) + // TODO revisit when https://github.com/ipfs/go-ipfs/issues/5799 is resolved + this.timeout(2 * 60 * 1000) let ipfsA let ipfsB diff --git a/js/src/ping/ping-readable-stream.js b/js/src/ping/ping-readable-stream.js index 8f9da6e21..4d057fb61 100644 --- a/js/src/ping/ping-readable-stream.js +++ b/js/src/ping/ping-readable-stream.js @@ -15,7 +15,8 @@ module.exports = (createCommon, options) => { const common = createCommon() describe('.pingReadableStream', function () { - this.timeout(60 * 1000) + // TODO revisit when https://github.com/ipfs/go-ipfs/issues/5799 is resolved + this.timeout(2 * 60 * 1000) let ipfsA let ipfsB diff --git a/js/src/ping/ping.js b/js/src/ping/ping.js index a485c982c..2a4f1b913 100644 --- a/js/src/ping/ping.js +++ b/js/src/ping/ping.js @@ -13,7 +13,8 @@ module.exports = (createCommon, options) => { const common = createCommon() describe('.ping', function () { - this.timeout(60 * 1000) + // TODO revisit when https://github.com/ipfs/go-ipfs/issues/5799 is resolved + this.timeout(2 * 60 * 1000) let ipfsA let ipfsB From e872b8a632eaadbd8fcffa284f061d2fa90c9069 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Mon, 3 Dec 2018 19:03:49 +0000 Subject: [PATCH 3/5] fix: ipns over pubsub tests (#395) --- js/src/name-pubsub/cancel.js | 59 ++++++++++++++++++------------------ js/src/name-pubsub/subs.js | 41 +++++++++---------------- 2 files changed, 44 insertions(+), 56 deletions(-) diff --git a/js/src/name-pubsub/cancel.js b/js/src/name-pubsub/cancel.js index ba7fd2cce..b46dcb827 100644 --- a/js/src/name-pubsub/cancel.js +++ b/js/src/name-pubsub/cancel.js @@ -2,16 +2,12 @@ /* eslint-env mocha */ 'use strict' -const series = require('async/series') -const loadFixture = require('aegir/fixtures') +const auto = require('async/auto') +const PeerId = require('peer-id') const { spawnNodeWithId } = require('../utils/spawn') const { getDescribe, getIt, expect } = require('../utils/mocha') -const fixture = Object.freeze({ - data: loadFixture('js/test/fixtures/testfile.txt', 'interface-ipfs-core') -}) - module.exports = (createCommon, options) => { const describe = getDescribe(options) const it = getIt(options) @@ -20,7 +16,6 @@ module.exports = (createCommon, options) => { describe('.name.pubsub.cancel', function () { let ipfs let nodeId - let value before(function (done) { // CI takes longer to instantiate the daemon, so we need to increase the @@ -36,12 +31,7 @@ module.exports = (createCommon, options) => { ipfs = node nodeId = node.peerId.id - ipfs.add(fixture.data, { pin: false }, (err, res) => { - expect(err).to.not.exist() - - value = res[0].path - done() - }) + done() }) }) }) @@ -63,24 +53,35 @@ module.exports = (createCommon, options) => { it('should cancel a subscription correctly returning true', function (done) { this.timeout(300 * 1000) - const ipnsPath = `/ipns/${nodeId}` - - series([ - (cb) => ipfs.name.pubsub.subs(cb), - (cb) => ipfs.name.publish(value, { resolve: false }, cb), - (cb) => ipfs.name.resolve(nodeId, cb), - (cb) => ipfs.name.pubsub.subs(cb), - (cb) => ipfs.name.pubsub.cancel(ipnsPath, cb), - (cb) => ipfs.name.pubsub.subs(cb) - ], (err, res) => { + + PeerId.create({ bits: 512 }, (err, peerId) => { expect(err).to.not.exist() - expect(res).to.exist() - expect(res[0]).to.eql([]) // initally empty - expect(res[4]).to.have.property('canceled') - expect(res[4].canceled).to.eql(true) - expect(res[5]).to.be.an('array').that.does.not.include(ipnsPath) - done() + const id = peerId.toB58String() + const ipnsPath = `/ipns/${id}` + + ipfs.name.pubsub.subs((err, res) => { + expect(err).to.not.exist() + expect(res).to.be.an('array').that.does.not.include(ipnsPath) + + ipfs.name.resolve(id, (err) => { + expect(err).to.exist() + auto({ + subs1: (cb) => ipfs.name.pubsub.subs(cb), + cancel: ['subs1', (_, cb) => ipfs.name.pubsub.cancel(ipnsPath, cb)], + subs2: ['cancel', (_, cb) => ipfs.name.pubsub.subs(cb)] + }, (err, res) => { + expect(err).to.not.exist() + expect(res).to.exist() + expect(res.subs1).to.be.an('array').that.does.include(ipnsPath) + expect(res.cancel).to.have.property('canceled') + expect(res.cancel.canceled).to.eql(true) + expect(res.subs2).to.be.an('array').that.does.not.include(ipnsPath) + + done() + }) + }) + }) }) }) }) diff --git a/js/src/name-pubsub/subs.js b/js/src/name-pubsub/subs.js index 44db46ea8..d7a529370 100644 --- a/js/src/name-pubsub/subs.js +++ b/js/src/name-pubsub/subs.js @@ -2,16 +2,9 @@ /* eslint-env mocha */ 'use strict' -const series = require('async/series') -const loadFixture = require('aegir/fixtures') - const { spawnNodeWithId } = require('../utils/spawn') const { getDescribe, getIt, expect } = require('../utils/mocha') -const fixture = Object.freeze({ - data: loadFixture('js/test/fixtures/testfile.txt', 'interface-ipfs-core') -}) - module.exports = (createCommon, options) => { const describe = getDescribe(options) const it = getIt(options) @@ -19,8 +12,6 @@ module.exports = (createCommon, options) => { describe('.name.pubsub.subs', function () { let ipfs - let nodeId - let value before(function (done) { // CI takes longer to instantiate the daemon, so we need to increase the @@ -34,14 +25,7 @@ module.exports = (createCommon, options) => { expect(err).to.not.exist() ipfs = node - nodeId = node.peerId.id - - ipfs.add(fixture.data, { pin: false }, (err, res) => { - expect(err).to.not.exist() - - value = res[0].path - done() - }) + done() }) }) }) @@ -62,19 +46,22 @@ module.exports = (createCommon, options) => { it('should get the list of subscriptions updated after a resolve', function (done) { this.timeout(300 * 1000) + const id = 'QmNP1ASen5ZREtiJTtVD3jhMKhoPb1zppET1tgpjHx2NGA' - series([ - (cb) => ipfs.name.pubsub.subs(cb), - (cb) => ipfs.name.publish(value, { resolve: false }, cb), - (cb) => ipfs.name.resolve(nodeId, cb), - (cb) => ipfs.name.pubsub.subs(cb) - ], (err, res) => { + ipfs.name.pubsub.subs((err, res) => { expect(err).to.not.exist() - expect(res).to.exist() - expect(res[0]).to.eql([]) // initally empty - expect(res[3]).to.be.an('array').that.does.include(`/ipns/${nodeId}`) + expect(res).to.eql([]) // initally empty - done() + ipfs.name.resolve(id, (err) => { + expect(err).to.exist() + + ipfs.name.pubsub.subs((err, res) => { + expect(err).to.not.exist() + expect(res).to.be.an('array').that.does.include(`/ipns/${id}`) + + done() + }) + }) }) }) }) From 0ed5894eca2146820f1d037fd62747a1d13826e5 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 3 Dec 2018 19:04:39 +0000 Subject: [PATCH 4/5] chore: update contributors --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c7fd7e8d..d02f41058 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "interface-ipfs-core", - "version": "0.88.0", + "version": "0.89.0", "description": "A test suite and interface you can use to implement a IPFS core interface.", "leadMaintainer": "Alan Shaw ", "main": "js/src/index.js", From 9959d029da007695e383d9bf8b7a782d5fd4a2da Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 3 Dec 2018 19:04:39 +0000 Subject: [PATCH 5/5] chore: release version v0.89.0 --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3892c4795..bef37a7ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +# [0.89.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.88.0...v0.89.0) (2018-12-03) + + +### Bug Fixes + +* code blocks for the code ([36cf442](https://github.com/ipfs/interface-ipfs-core/commit/36cf442)) +* ipns over pubsub tests ([#395](https://github.com/ipfs/interface-ipfs-core/issues/395)) ([e872b8a](https://github.com/ipfs/interface-ipfs-core/commit/e872b8a)) + + + # [0.88.0](https://github.com/ipfs/interface-ipfs-core/compare/v0.87.0...v0.88.0) (2018-11-27)