diff --git a/package.json b/package.json index a5c5ea898..1a72b1c26 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "dirty-chai": "^2.0.1", "eslint-plugin-react": "^7.4.0", "gulp": "^3.9.1", - "interface-ipfs-core": "~0.32.1", + "interface-ipfs-core": "~0.33.0", "hapi": "^16.6.2", "ipfsd-ctl": "~0.24.0", "pre-commit": "^1.2.2", diff --git a/src/pin/add.js b/src/pin/add.js index 946d32a3b..7ef730eec 100644 --- a/src/pin/add.js +++ b/src/pin/add.js @@ -16,7 +16,7 @@ module.exports = (send) => { if (err) { return callback(err) } - callback(null, res.Pins) + callback(null, res.Pins.map((hash) => ({ hash: hash }))) }) }) } diff --git a/src/pin/ls.js b/src/pin/ls.js index 5b919a673..45f6d600f 100644 --- a/src/pin/ls.js +++ b/src/pin/ls.js @@ -1,23 +1,23 @@ 'use strict' const promisify = require('promisify-es6') +const _ = require('lodash') module.exports = (send) => { return promisify((hash, opts, callback) => { + if (typeof hash === 'function') { + callback = hash + opts = null + hash = null + } if (typeof opts === 'function') { callback = opts - opts = {} } - - if (typeof hash === 'object') { + if (hash && hash.type) { opts = hash - hash = undefined - } - - if (typeof hash === 'function') { - callback = hash - hash = undefined - opts = {} + hash = null + } else { + opts = null } send({ @@ -28,7 +28,9 @@ module.exports = (send) => { if (err) { return callback(err) } - callback(null, res.Keys) + callback(null, _.keys(res.Keys).map(hash => ( + { hash, type: res.Keys[hash].Type } + ))) }) }) } diff --git a/src/pin/rm.js b/src/pin/rm.js index 82abb69ad..05aada109 100644 --- a/src/pin/rm.js +++ b/src/pin/rm.js @@ -16,7 +16,7 @@ module.exports = (send) => { if (err) { return callback(err) } - callback(null, res.Pins) + callback(null, res.Pins.map((hash) => ({ hash: hash }))) }) }) }