diff --git a/creator-node/package-lock.json b/creator-node/package-lock.json index c3f12555e17..9652b34f1d8 100644 --- a/creator-node/package-lock.json +++ b/creator-node/package-lock.json @@ -261,9 +261,9 @@ "integrity": "sha512-3FgFARf7RupsZETQ1nHnhLUUvpcttcCq1iZCaVAbJZbCZ5VNRrNyvpDyHTOb0KC3llFcsyOT/a99NZcCbeiEsA==" }, "asn1.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.1.1.tgz", - "integrity": "sha512-kkj0MRSG9Yo3B2BpnLwEk/Sc7oiLu3jmEPaxiwOb219+1j8q6zZocqQYncLlSjMGhAw+OCVks5iIwnFAHudczw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.2.0.tgz", + "integrity": "sha512-Q7hnYGGNYbcmGrCPulXfkEw7oW7qjWeM4ZTALmgpuIcZLxyqqKYWxCZg2UBm8bklrnB4m2mGyJPWfoktdORD8A==", "requires": { "bn.js": "^4.0.0", "inherits": "^2.0.1", @@ -277,11 +277,18 @@ "dev": true }, "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", + "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==", "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.14" + }, + "dependencies": { + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" + } } }, "async-each": { @@ -435,9 +442,9 @@ } }, "base-x": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.5.tgz", - "integrity": "sha512-C3picSgzPSLE+jW3tcBzJoGwitOtazb5B+5YmAxZm2ybmTi9LNgAtDO/jjVEBZwHoXmDBZ9m/IELj3elJVRBcA==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.6.tgz", + "integrity": "sha512-4PaF8u2+AlViJxRVjurkLTxpp7CaFRD/jo5rPT9ONnKxyhQ8f59yzamEvq7EkriG56yn5On4ONyaG75HLqr46w==", "requires": { "safe-buffer": "^5.0.1" } @@ -452,15 +459,10 @@ "resolved": "https://registry.npmjs.org/base64-url/-/base64-url-2.2.2.tgz", "integrity": "sha512-JMAkNo3MJ7GG2CHPVMiGPrzGQizUcVE9qvCU6pxQln4aYZZgYM6BJHXbawDegSoryvsKGrK3FuBO9IuGWErRLQ==" }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" - }, "bignumber.js": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-8.1.1.tgz", - "integrity": "sha512-QD46ppGintwPGuL1KqmwhR0O+N2cZUg8JG/VzwI2e28sM9TqHjQB10lI4QAaMHVbLzwVLLAwEglpKPViWX+5NQ==" + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==" }, "binary-extensions": { "version": "1.13.1", @@ -535,11 +537,11 @@ } }, "borc": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/borc/-/borc-2.1.0.tgz", - "integrity": "sha512-hKTxeYt3AIzIG45epJHv8xJYSF0ktp7nZgFsqi5cPzoL3T8qKMPeUlqydORy6j3NWZvRDANx30PjpTmGho69Gw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/borc/-/borc-2.1.1.tgz", + "integrity": "sha512-vPLLC2/gS0QN4O3cnPh+8jLshkMMD4qIfs+B1TPGPh30WrtcfItaO6j4k9alsqu/hIgKi8dVdmMvTcbq4tIF7A==", "requires": { - "bignumber.js": "^8.0.1", + "bignumber.js": "^9.0.0", "commander": "^2.15.0", "ieee754": "^1.1.8", "iso-url": "~0.4.4", @@ -689,25 +691,6 @@ "isarray": "^1.0.0" } }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", @@ -858,32 +841,14 @@ "dev": true }, "cids": { - "version": "0.5.8", - "resolved": "https://registry.npmjs.org/cids/-/cids-0.5.8.tgz", - "integrity": "sha512-Ye8TZP3YQfy0j+i5k+LPHdTY3JOvTwN1pxds44p6BRUv8PTMOAF/Vt4Bc+oiIQ0Sktn0iftkUHgqKNHIMwhshA==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.1.tgz", + "integrity": "sha512-qEM4j2GKE/BiT6WdUi6cfW8dairhSLTUE8tIdxJG6SvY33Mp/UPjw+xcO0n1zsllgo72BupzKF/44v+Bg8YPPg==", "requires": { "class-is": "^1.1.0", "multibase": "~0.6.0", - "multicodec": "~0.5.0", + "multicodec": "~0.5.1", "multihashes": "~0.4.14" - }, - "dependencies": { - "base-x": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz", - "integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "multibase": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.0.tgz", - "integrity": "sha512-R9bNLQhbD7MsitPm1NeY7w9sDgu6d7cuj25snAWH7k5PSNPSwIQQBpcpj8jx1W96dLbdigZqmUWOdQRMnAmgjA==", - "requires": { - "base-x": "3.0.4" - } - } } }, "cipher-base": { @@ -1565,6 +1530,11 @@ "once": "^1.4.0" } }, + "err-code": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", + "integrity": "sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=" + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -3464,16 +3434,6 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" }, - "ip-address": { - "version": "5.9.2", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-5.9.2.tgz", - "integrity": "sha512-7aeFm/7oqo0mMhubTSjZ2Juw/F+WJ3hyfCScNVRQdz5RSRhw1Rj4ZlBFsmEajeKgQDI8asqVs31h8DpxEv7IfQ==", - "requires": { - "jsbn": "1.1.0", - "lodash": "^4.17.11", - "sprintf-js": "1.1.2" - } - }, "ip-regex": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", @@ -3484,76 +3444,82 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" }, - "ipfs-api": { - "version": "26.1.2", - "resolved": "https://registry.npmjs.org/ipfs-api/-/ipfs-api-26.1.2.tgz", - "integrity": "sha512-HkM6vQOHL9z9ZCXIrbDXvAOsIzfWPaAac9kY+SjUuVqMydWHzP8qTxfv5jaXResGbmLcbwcROhuqgJU+HrclSg==", + "ipfs-block": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/ipfs-block/-/ipfs-block-0.8.1.tgz", + "integrity": "sha512-0FaCpmij+jZBoUYhjoB5ptjdl9QzvrdRIoBmUU5JiBnK2GA+4YM/ifklaB8ePRhA/rRzhd+KYBjvMFMAL4NrVQ==", + "requires": { + "cids": "~0.7.0", + "class-is": "^1.1.0" + } + }, + "ipfs-http-client": { + "version": "33.1.1", + "resolved": "https://registry.npmjs.org/ipfs-http-client/-/ipfs-http-client-33.1.1.tgz", + "integrity": "sha512-iwtLL3lOIzxXJFwLnOEtFUv1cYTuWJ0NauD7rpMEd/y4C7z6fuN6TSF4h547lxMh7sJWv+6Z0PmOA5N8FzUHJw==", "requires": { "async": "^2.6.1", - "big.js": "^5.2.2", - "bl": "^2.1.2", + "bignumber.js": "^9.0.0", + "bl": "^3.0.0", "bs58": "^4.0.1", - "cids": "~0.5.5", - "concat-stream": "^1.6.2", + "buffer": "^5.2.1", + "cids": "~0.7.1", + "concat-stream": "github:hugomrdias/concat-stream#feat/smaller", "debug": "^4.1.0", "detect-node": "^2.0.4", "end-of-stream": "^1.4.1", + "err-code": "^1.1.2", "flatmap": "0.0.3", "glob": "^7.1.3", - "ipfs-block": "~0.8.0", - "ipfs-unixfs": "~0.1.16", - "ipld-dag-cbor": "~0.13.0", - "ipld-dag-pb": "~0.14.11", - "is-ipfs": "~0.4.7", + "ipfs-block": "~0.8.1", + "ipfs-utils": "~0.0.3", + "ipld-dag-cbor": "~0.15.0", + "ipld-dag-pb": "~0.17.3", + "ipld-raw": "^4.0.0", + "is-ipfs": "~0.6.1", "is-pull-stream": "0.0.0", - "is-stream": "^1.1.0", - "libp2p-crypto": "~0.14.0", - "lodash": "^4.17.11", - "lru-cache": "^4.1.3", - "multiaddr": "^5.0.0", - "multibase": "~0.5.0", + "is-stream": "^2.0.0", + "iso-stream-http": "~0.1.2", + "iso-url": "~0.4.6", + "just-kebab-case": "^1.1.0", + "just-map-keys": "^1.1.0", + "kind-of": "^6.0.2", + "lru-cache": "^5.1.1", + "multiaddr": "^6.0.6", + "multibase": "~0.6.0", + "multicodec": "~0.5.1", "multihashes": "~0.4.14", - "ndjson": "^1.5.0", + "ndjson": "github:hugomrdias/ndjson#feat/readable-stream3", "once": "^1.4.0", - "peer-id": "~0.12.0", - "peer-info": "~0.14.1", + "peer-id": "~0.12.2", + "peer-info": "~0.15.1", "promisify-es6": "^1.0.3", "pull-defer": "~0.2.3", - "pull-pushable": "^2.2.0", - "pull-stream-to-stream": "^1.3.4", + "pull-stream": "^3.6.9", + "pull-to-stream": "~0.1.1", "pump": "^3.0.0", "qs": "^6.5.2", - "readable-stream": "^3.0.6", - "stream-http": "^3.0.0", + "readable-stream": "^3.1.1", "stream-to-pull-stream": "^1.7.2", - "streamifier": "~0.1.1", - "tar-stream": "^1.6.2", - "through2": "^2.0.3" + "tar-stream": "^2.0.1", + "through2": "^3.0.1" }, "dependencies": { - "bl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz", - "integrity": "sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==", + "buffer": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.3.0.tgz", + "integrity": "sha512-XykNc84nIOC32vZ9euOKbmGAP69JUkXDtBQfLq88c8/6J/gZi/t14A+l/p/9EM2TcT5xNC1MKPCrvO3LVUpVPw==", "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - } + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "concat-stream": { + "version": "github:hugomrdias/concat-stream#057bc7b5d6d8df26c8cf00a3f151b6721a0a8034", + "from": "github:hugomrdias/concat-stream#feat/smaller", + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^3.0.2" } }, "debug": { @@ -3577,98 +3543,96 @@ "path-is-absolute": "^1.0.0" } }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "requires": { + "yallist": "^3.0.2" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } + "yallist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", + "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" } } }, - "ipfs-block": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/ipfs-block/-/ipfs-block-0.8.1.tgz", - "integrity": "sha512-0FaCpmij+jZBoUYhjoB5ptjdl9QzvrdRIoBmUU5JiBnK2GA+4YM/ifklaB8ePRhA/rRzhd+KYBjvMFMAL4NrVQ==", + "ipfs-utils": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/ipfs-utils/-/ipfs-utils-0.0.4.tgz", + "integrity": "sha512-7cZf6aGj2FG3XJWhCNwn4mS93Q0GEWjtBZvEHqzgI43U2qzNDCyzfS1pei1Y5F+tw/zDJ5U4XG0G9reJxR53Ig==", "requires": { - "cids": "~0.7.0", - "class-is": "^1.1.0" + "buffer": "^5.2.1", + "is-buffer": "^2.0.3", + "is-electron": "^2.2.0", + "is-pull-stream": "0.0.0", + "is-stream": "^2.0.0", + "kind-of": "^6.0.2", + "readable-stream": "^3.4.0" }, "dependencies": { - "base-x": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz", - "integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "cids": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/cids/-/cids-0.7.1.tgz", - "integrity": "sha512-qEM4j2GKE/BiT6WdUi6cfW8dairhSLTUE8tIdxJG6SvY33Mp/UPjw+xcO0n1zsllgo72BupzKF/44v+Bg8YPPg==", + "buffer": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.3.0.tgz", + "integrity": "sha512-XykNc84nIOC32vZ9euOKbmGAP69JUkXDtBQfLq88c8/6J/gZi/t14A+l/p/9EM2TcT5xNC1MKPCrvO3LVUpVPw==", "requires": { - "class-is": "^1.1.0", - "multibase": "~0.6.0", - "multicodec": "~0.5.1", - "multihashes": "~0.4.14" + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" } }, - "multibase": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.0.tgz", - "integrity": "sha512-R9bNLQhbD7MsitPm1NeY7w9sDgu6d7cuj25snAWH7k5PSNPSwIQQBpcpj8jx1W96dLbdigZqmUWOdQRMnAmgjA==", - "requires": { - "base-x": "3.0.4" - } + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" } } }, - "ipfs-unixfs": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/ipfs-unixfs/-/ipfs-unixfs-0.1.16.tgz", - "integrity": "sha512-TX9Dyu77MxpLzGh/LcQne95TofOyvOeW0oOi72aBMMcV1ItP3684e6NTG9KY1qzdrC+ZUR8kT7y18J058n8KXg==", - "requires": { - "protons": "^1.0.1" - } - }, "ipld-dag-cbor": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/ipld-dag-cbor/-/ipld-dag-cbor-0.13.1.tgz", - "integrity": "sha512-96KKh5XUq9LrWE/TQ/BOJ5FcQx7UZ892N76ufDdovq+fIwZ4/YpPRTAVssLUuN3crATHoGu80TVZMgevsuTCdQ==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/ipld-dag-cbor/-/ipld-dag-cbor-0.15.0.tgz", + "integrity": "sha512-wc9nrDtV4Le76UUhG4LXX57NVi5d7JS2kLid2nOYZAcr0SFhiXZL2ZyV3bfmNohO50KvgPEessSaBBSm9bflGA==", "requires": { "borc": "^2.1.0", - "bs58": "^4.0.1", - "cids": "~0.5.5", + "cids": "~0.7.0", "is-circular": "^1.0.2", - "multihashes": "~0.4.14", - "multihashing-async": "~0.5.1", - "traverse": "~0.6.6" + "multicodec": "~0.5.0", + "multihashing-async": "~0.7.0" } }, "ipld-dag-pb": { - "version": "0.14.11", - "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.14.11.tgz", - "integrity": "sha512-ja4FH6elDprVuJBkNObFlq7+9h1Q3aoQx5SSG/v3I9e7j19nwyuMhLJYwBhdv29LiqpyD2cEqNrJLm8lWn0lJg==", + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.17.4.tgz", + "integrity": "sha512-YwCxETEMuXVspOKOhjIOHJvKvB/OZfCDkpSFiYBQN2/JQjM9y/RFCYzIQGm0wg7dCFLrhvfjAZLTSaKs65jzWA==", "requires": { - "async": "^2.6.1", - "bs58": "^4.0.1", - "cids": "~0.5.4", + "cids": "~0.7.0", "class-is": "^1.1.0", - "is-ipfs": "~0.4.2", - "multihashing-async": "~0.5.1", + "multicodec": "~0.5.1", + "multihashing-async": "~0.7.0", "protons": "^1.0.1", - "pull-stream": "^3.6.9", - "pull-traverse": "^1.0.3", "stable": "~0.1.8" } }, + "ipld-raw": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ipld-raw/-/ipld-raw-4.0.0.tgz", + "integrity": "sha512-yNQG5zQqm/RH8aNQxcvcsAdHJW4q+LJ3cPfFzHOtujEa/PRlT5YCOVpAFh61HfpsWFm2GJrb2G+HHgtDDlFSMw==", + "requires": { + "cids": "~0.7.0", + "multicodec": "~0.5.0", + "multihashing-async": "~0.7.0" + } + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -3791,6 +3755,11 @@ } } }, + "is-electron": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-electron/-/is-electron-2.2.0.tgz", + "integrity": "sha512-SpMppC2XR3YdxSzczXReBjqs2zGscWQpBIKqwXYBFic0ERaxNVgwLCHwOLZeESfdJQjX0RDvrJ1lBXX2ij+G1Q==" + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -3836,32 +3805,16 @@ } }, "is-ipfs": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/is-ipfs/-/is-ipfs-0.4.8.tgz", - "integrity": "sha512-xIKUeA24IFMfkmeAPEOZL448X7a08c/KzAGQp1e/QxC9bx/NNEdT/ohob3SW6eJO2UwJNjsbfMeNZ2B+Dk2Fdg==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/is-ipfs/-/is-ipfs-0.6.1.tgz", + "integrity": "sha512-WhqQylam6pODS2RyqT/u0PR5KWtBZNCgPjgargFOVQjzw/3+6d0midXenzU65klM4LH13IUiCC6ObhDUdXZ7Nw==", "requires": { - "bs58": "4.0.1", - "cids": "~0.5.6", + "bs58": "^4.0.1", + "cids": "~0.7.0", + "mafmt": "^6.0.7", + "multiaddr": "^6.0.4", "multibase": "~0.6.0", "multihashes": "~0.4.13" - }, - "dependencies": { - "base-x": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.4.tgz", - "integrity": "sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA==", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "multibase": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.0.tgz", - "integrity": "sha512-R9bNLQhbD7MsitPm1NeY7w9sDgu6d7cuj25snAWH7k5PSNPSwIQQBpcpj8jx1W96dLbdigZqmUWOdQRMnAmgjA==", - "requires": { - "base-x": "3.0.4" - } - } } }, "is-npm": { @@ -3960,7 +3913,8 @@ "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true }, "is-symbol": { "version": "1.0.2", @@ -3993,6 +3947,16 @@ "resolved": "https://registry.npmjs.org/iso-random-stream/-/iso-random-stream-1.1.0.tgz", "integrity": "sha512-ywSWt0KrWcsaK0jVoVJIR30rLyjg9Rw3k2Sm/qp+3tdtSV0SNH7L7KilKnENcENOSoJxDFvpt2idvuMMQohdCQ==" }, + "iso-stream-http": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/iso-stream-http/-/iso-stream-http-0.1.2.tgz", + "integrity": "sha512-oHEDNOysIMTNypbg2f1SlydqRBvjl4ZbSE9+0awVxnkx3K2stGTFwB/kpVqnB6UEfF8QD36kAjDwZvqyXBLMnQ==", + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, "iso-url": { "version": "0.4.6", "resolved": "https://registry.npmjs.org/iso-url/-/iso-url-0.4.6.tgz", @@ -4069,11 +4033,6 @@ "esprima": "^4.0.0" } }, - "jsbn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", - "integrity": "sha1-sBMHyym2GKHtJux56RH4A8TaAEA=" - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -4149,6 +4108,16 @@ "integrity": "sha512-FrLwOgm+iXrPV+5zDU6Jqu4gCRXbWEQg2O3SKONsWE4w7AXFRkryS53bpWdaL9cNol+AmR3AEYz6kn+o0fCPnw==", "dev": true }, + "just-kebab-case": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/just-kebab-case/-/just-kebab-case-1.1.0.tgz", + "integrity": "sha512-QkuwuBMQ9BQHMUEkAtIA4INLrkmnnveqlFB1oFi09gbU0wBdZo6tTnyxNWMR84zHxBuwK7GLAwqN8nrvVxOLTA==" + }, + "just-map-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/just-map-keys/-/just-map-keys-1.1.0.tgz", + "integrity": "sha512-oNKi+4y7fr8lXnhKYpBbCkiwHRVkAnx0VDkCeTDtKKMzGr1Lz1Yym+RSieKUTKim68emC5Yxrb4YmiF9STDO+g==" + }, "keccak": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", @@ -4177,8 +4146,7 @@ "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" }, "latest-version": { "version": "3.1.0", @@ -4200,36 +4168,77 @@ } }, "libp2p-crypto": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.14.1.tgz", - "integrity": "sha512-JP3bfEzNik76fFIWOeU909+v76tjj5BMukbPCc61bgh1ixftcHkr4bH79duz+oSxRpGA+orCLxvkhgALV+pfwg==", + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.1.tgz", + "integrity": "sha512-+fxqy+cDjwOKK4KTj44WQmjPE5ep2eR5uAIQWHl/+RKvRSor3+RAY53VWkAecgAEvjX2AswxBsoCIJK1Qk5aIQ==", "requires": { + "asmcrypto.js": "^2.3.2", "asn1.js": "^5.0.1", "async": "^2.6.1", + "bn.js": "^4.11.8", "browserify-aes": "^1.2.0", "bs58": "^4.0.1", + "iso-random-stream": "^1.1.0", "keypair": "^1.0.1", - "libp2p-crypto-secp256k1": "~0.2.2", + "libp2p-crypto-secp256k1": "~0.3.0", "multihashing-async": "~0.5.1", "node-forge": "~0.7.6", - "pem-jwk": "^1.5.1", + "pem-jwk": "^2.0.0", "protons": "^1.0.1", "rsa-pem-to-jwk": "^1.1.3", "tweetnacl": "^1.0.0", - "ursa-optional": "~0.9.9", - "webcrypto-shim": "github:dignifiedquire/webcrypto-shim#master" + "ursa-optional": "~0.9.10" + }, + "dependencies": { + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "multihashing-async": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.5.2.tgz", + "integrity": "sha512-mmyG6M/FKxrpBh9xQDUvuJ7BbqT93ZeEeH5X6LeMYKoYshYLr9BDdCsvDtZvn+Egf+/Xi+aOznrWL4vp3s+p0Q==", + "requires": { + "blakejs": "^1.1.0", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js": "^3.0.1", + "nodeify": "^1.0.1" + } + } } }, "libp2p-crypto-secp256k1": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.2.3.tgz", - "integrity": "sha512-DFrK89VdboacqM3vqWV8yt8FH9Ni181JJAOU2tRkJfUN9tNEV7VfZEg390NJxEQQbLsyH4HZ7on3QTpPHMHQZQ==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.3.1.tgz", + "integrity": "sha512-evrfK/CeUSd/lcELUdDruyPBvxDmLairth75S32OLl3H+++2m2fV24JEtxzdFS9JH3xEFw0h6JFO8DBa1bP9dA==", "requires": { - "async": "^2.6.1", - "multihashing-async": "~0.5.1", + "async": "^2.6.2", + "bs58": "^4.0.1", + "multihashing-async": "~0.6.0", "nodeify": "^1.0.1", "safe-buffer": "^5.1.2", - "secp256k1": "^3.6.1" + "secp256k1": "^3.6.2" + }, + "dependencies": { + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "multihashing-async": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.6.0.tgz", + "integrity": "sha512-Qv8pgg99Lewc191A5nlXy0bSd2amfqlafNJZmarU6Sj7MZVjpR94SCxQjf4DwPtgWZkiLqsjUQBXA2RSq+hYyA==", + "requires": { + "blakejs": "^1.1.0", + "js-sha3": "~0.8.0", + "multihashes": "~0.4.13", + "murmurhash3js": "^3.0.1", + "nodeify": "^1.0.1" + } + } } }, "load-json-file": { @@ -4277,26 +4286,11 @@ "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" }, - "lodash.filter": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", - "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" - }, "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" }, - "lodash.map": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", - "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" - }, - "lodash.uniqby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", - "integrity": "sha1-2ZwHpmnp5tJOE2Lf4mbGdhavEwI=" - }, "lolex": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.1.0.tgz", @@ -4327,6 +4321,7 @@ "version": "4.1.5", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, "requires": { "pseudomap": "^1.0.2", "yallist": "^2.1.2" @@ -4342,26 +4337,11 @@ } }, "mafmt": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-6.0.7.tgz", - "integrity": "sha512-2OG/EGAJZmpZBl7YRT1hD83sZa2gKsUEdegRuURreIOe7B4VeHU1rYYmhgk7BkLzknGL3xGYsDx3bbSgEEzE7g==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/mafmt/-/mafmt-6.0.8.tgz", + "integrity": "sha512-6oRO2fwNiqXXiby8Anq9ULLQpcrZUsfR3Bs+Yn1DWd/Zd65xGS9fobKzzSsnM9nqUdUA3IggG0b1R3WamVsatA==", "requires": { - "multiaddr": "^6.0.4" - }, - "dependencies": { - "multiaddr": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-6.1.0.tgz", - "integrity": "sha512-+XTP3OzG2m6JVcjxA9QBmGDr0Vk8WwnohC/fCC3puXb5qJqfJwLVJLEtdTc6vK7ri/hw+Nn4wyT4LkZaPnvGfQ==", - "requires": { - "bs58": "^4.0.1", - "class-is": "^1.1.0", - "hi-base32": "~0.5.0", - "ip": "^1.1.5", - "is-ip": "^2.0.0", - "varint": "^5.0.0" - } - } + "multiaddr": "^6.1.0" } }, "make-dir": { @@ -4629,24 +4609,22 @@ } }, "multiaddr": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-5.0.2.tgz", - "integrity": "sha512-dXz1chaUHV6L6okujDLS7uRA6NmCbitpikOJA0vMMnrwVyai5kC3ot2CSLrSfj3B8XIgNzpe/j5auSYrnbGGzA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-6.1.0.tgz", + "integrity": "sha512-+XTP3OzG2m6JVcjxA9QBmGDr0Vk8WwnohC/fCC3puXb5qJqfJwLVJLEtdTc6vK7ri/hw+Nn4wyT4LkZaPnvGfQ==", "requires": { "bs58": "^4.0.1", "class-is": "^1.1.0", + "hi-base32": "~0.5.0", "ip": "^1.1.5", - "ip-address": "^5.8.9", - "lodash.filter": "^4.6.0", - "lodash.map": "^4.6.0", - "varint": "^5.0.0", - "xtend": "^4.0.1" + "is-ip": "^2.0.0", + "varint": "^5.0.0" } }, "multibase": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.5.0.tgz", - "integrity": "sha512-7epKiK8/UBzraYZvOuZa8FH/00hMfTnzTy1OQol1YBU2csAYA7rwWh+iue9plXRmVFBGvmVKMuo0oq5sD47kvw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-0.6.0.tgz", + "integrity": "sha512-R9bNLQhbD7MsitPm1NeY7w9sDgu6d7cuj25snAWH7k5PSNPSwIQQBpcpj8jx1W96dLbdigZqmUWOdQRMnAmgjA==", "requires": { "base-x": "3.0.4" }, @@ -4662,34 +4640,44 @@ } }, "multicodec": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.3.tgz", - "integrity": "sha512-TUId9mavSh7q4ui5nUYiC0U10XVrMhsoMLPoG6nAAaFt2GKqZKK3aB2AeFk58aqEnLhmTSdRkmNrlty4jjOxzg==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.5.tgz", + "integrity": "sha512-1kOifvwAqp9IdiiTKmpK2tS+LY6GHZdKpk3S2EvW4T32vlwDyA3hJoZtGauzqdedUPVNGChnTksEotVOCVlC+Q==", "requires": { "varint": "^5.0.0" } }, "multihashes": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.14.tgz", - "integrity": "sha512-V/g/EIN6nALXfS/xHUAgtfPP3mn3sPIF/i9beuGKf25QXS2QZYCpeVJbDPEannkz32B2fihzCe2D/KMrbcmefg==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/multihashes/-/multihashes-0.4.15.tgz", + "integrity": "sha512-G/Smj1GWqw1RQP3dRuRRPe3oyLqvPqUaEDIaoi7JF7Loxl4WAWvhJNk84oyDEodSucv0MmSW/ZT0RKUrsIFD3g==", "requires": { "bs58": "^4.0.1", "varint": "^5.0.0" } }, "multihashing-async": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.5.2.tgz", - "integrity": "sha512-mmyG6M/FKxrpBh9xQDUvuJ7BbqT93ZeEeH5X6LeMYKoYshYLr9BDdCsvDtZvn+Egf+/Xi+aOznrWL4vp3s+p0Q==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.7.0.tgz", + "integrity": "sha512-SCbfl3f+DzJh+/5piukga9ofIOxwfT05t8R4jfzZIJ88YE9zU9+l3K2X+XB19MYyxqvyK9UJRNWbmQpZqQlbRA==", "requires": { "blakejs": "^1.1.0", + "buffer": "^5.2.1", + "err-code": "^1.1.2", "js-sha3": "~0.8.0", "multihashes": "~0.4.13", - "murmurhash3js": "^3.0.1", - "nodeify": "^1.0.1" + "murmurhash3js-revisited": "^3.0.0" }, "dependencies": { + "buffer": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.3.0.tgz", + "integrity": "sha512-XykNc84nIOC32vZ9euOKbmGAP69JUkXDtBQfLq88c8/6J/gZi/t14A+l/p/9EM2TcT5xNC1MKPCrvO3LVUpVPw==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -4702,6 +4690,11 @@ "resolved": "https://registry.npmjs.org/murmurhash3js/-/murmurhash3js-3.0.1.tgz", "integrity": "sha1-Ppg+W0fCoG9DpxMXTn5DXKBEuZg=" }, + "murmurhash3js-revisited": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz", + "integrity": "sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g==" + }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -4766,14 +4759,13 @@ "optional": true }, "ndjson": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/ndjson/-/ndjson-1.5.0.tgz", - "integrity": "sha1-rmA7NrE0vOw0e0UkIrC/mNWDLsg=", + "version": "github:hugomrdias/ndjson#4db16da6b42e5b39bf300c3a7cde62abb3fa3a11", + "from": "github:hugomrdias/ndjson#feat/readable-stream3", "requires": { "json-stringify-safe": "^5.0.1", "minimist": "^1.2.0", - "split2": "^2.1.0", - "through2": "^2.0.3" + "split2": "^3.1.0", + "through2": "^3.0.0" }, "dependencies": { "minimist": { @@ -5202,163 +5194,33 @@ } }, "peer-id": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.12.2.tgz", - "integrity": "sha512-pked3yPLcOcprH21OnYbJAzk9OgI/TDEqjJ0IfRJSVB/61ZyqU5VKO7cw7hul+YD8nTD79wM79xFRWN3f6otNg==", + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.12.4.tgz", + "integrity": "sha512-AIAwL/6CmVc/VKbUhpA1rY3A/VJ3Z9ELvtvDQfl5cIi0A74L7lvsJ6LxQn5JSJVHM5Us2Ng9zMO523dO3FFnnw==", "requires": { - "async": "^2.6.1", + "async": "^2.6.3", "class-is": "^1.1.0", - "libp2p-crypto": "~0.16.0", - "multihashes": "~0.4.13" - }, - "dependencies": { - "libp2p-crypto": { - "version": "0.16.1", - "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.16.1.tgz", - "integrity": "sha512-+fxqy+cDjwOKK4KTj44WQmjPE5ep2eR5uAIQWHl/+RKvRSor3+RAY53VWkAecgAEvjX2AswxBsoCIJK1Qk5aIQ==", - "requires": { - "asmcrypto.js": "^2.3.2", - "asn1.js": "^5.0.1", - "async": "^2.6.1", - "bn.js": "^4.11.8", - "browserify-aes": "^1.2.0", - "bs58": "^4.0.1", - "iso-random-stream": "^1.1.0", - "keypair": "^1.0.1", - "libp2p-crypto-secp256k1": "~0.3.0", - "multihashing-async": "~0.5.1", - "node-forge": "~0.7.6", - "pem-jwk": "^2.0.0", - "protons": "^1.0.1", - "rsa-pem-to-jwk": "^1.1.3", - "tweetnacl": "^1.0.0", - "ursa-optional": "~0.9.10" - } - }, - "libp2p-crypto-secp256k1": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.3.0.tgz", - "integrity": "sha512-+rF3S5p2pzS4JLDwVE6gLWZeaKkpl4NkYwG+0knV6ot29UcRSb73OyCWl07r1h5+g9E3KZC3wpsu+RIK5w8zQA==", - "requires": { - "async": "^2.6.1", - "bs58": "^4.0.1", - "multihashing-async": "~0.5.1", - "nodeify": "^1.0.1", - "safe-buffer": "^5.1.2", - "secp256k1": "^3.6.1" - } - }, - "pem-jwk": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pem-jwk/-/pem-jwk-2.0.0.tgz", - "integrity": "sha512-rFxu7rVoHgQ5H9YsP50dDWf0rHjreVA2z0yPiWr5WdH/UHb29hKtF7h6l8vNd1cbYR1t0QL+JKhW55a2ZV4KtA==", - "requires": { - "asn1.js": "^5.0.1" - } - } + "libp2p-crypto": "~0.16.1", + "multihashes": "~0.4.15" } }, "peer-info": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/peer-info/-/peer-info-0.14.1.tgz", - "integrity": "sha512-I9K+q7sisU0gg5ej6ekbhgolwlcm1tc2wDtLmumptoLYx0DkIT8WVHtgoTnupYwRRqcYADtwddFdiXfb8QFqzg==", - "requires": { - "lodash.uniqby": "^4.7.0", - "mafmt": "^6.0.0", - "multiaddr": "^4.0.0", - "peer-id": "~0.10.7" - }, - "dependencies": { - "js-sha3": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.7.0.tgz", - "integrity": "sha512-Wpks3yBDm0UcL5qlVhwW9Jr9n9i4FfeWBFOOXP5puDS/SiudJGhw7DPyBqn3487qD4F0lsC0q3zxink37f7zeA==" - }, - "libp2p-crypto": { - "version": "0.12.1", - "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.12.1.tgz", - "integrity": "sha512-1/z8rxZ0DcQNreZhEsl7PnLr7DWOioSvYbKBLGkRwNRiNh1JJLgh0PdTySBb44wkrOGT+TxcGRd7iq3/X6Wxwg==", - "requires": { - "asn1.js": "^5.0.0", - "async": "^2.6.0", - "browserify-aes": "^1.1.1", - "bs58": "^4.0.1", - "keypair": "^1.0.1", - "libp2p-crypto-secp256k1": "~0.2.2", - "multihashing-async": "~0.4.7", - "node-forge": "^0.7.1", - "pem-jwk": "^1.5.1", - "protons": "^1.0.1", - "rsa-pem-to-jwk": "^1.1.3", - "tweetnacl": "^1.0.0", - "webcrypto-shim": "github:dignifiedquire/webcrypto-shim#master" - } - }, - "multiaddr": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/multiaddr/-/multiaddr-4.0.0.tgz", - "integrity": "sha512-zUatrOCfBd/tJNOSoJ10d2EI2FDXB9PyPZhqUMdXE9mOyR3C+HLuOjga2Ga/eChwvEHIpTYRMoIKF2Nv7af2qQ==", - "requires": { - "bs58": "^4.0.1", - "class-is": "^1.1.0", - "ip": "^1.1.5", - "ip-address": "^5.8.9", - "lodash.filter": "^4.6.0", - "lodash.map": "^4.6.0", - "varint": "^5.0.0", - "xtend": "^4.0.1" - } - }, - "multihashing-async": { - "version": "0.4.8", - "resolved": "https://registry.npmjs.org/multihashing-async/-/multihashing-async-0.4.8.tgz", - "integrity": "sha512-LCc4lfxmTJOHKIjZjFNgvmfB6nXS/ErLInT9uwU8udFrRm2PH+aTPk3mfCREKmCiSHOlCWiv2O8rlnBx+OjlMw==", - "requires": { - "async": "^2.6.0", - "blakejs": "^1.1.0", - "js-sha3": "^0.7.0", - "multihashes": "~0.4.13", - "murmurhash3js": "^3.0.1", - "nodeify": "^1.0.1" - } - }, - "peer-id": { - "version": "0.10.7", - "resolved": "https://registry.npmjs.org/peer-id/-/peer-id-0.10.7.tgz", - "integrity": "sha512-VEpMFcL9q0NQijmR0jsj38OGbY4yzaWMEareVkDahopmlNT+Cpsot8btPgsgBBApP9NiZj2Enwvh8rZN30ocQw==", - "requires": { - "async": "^2.6.0", - "libp2p-crypto": "~0.12.1", - "lodash": "^4.17.5", - "multihashes": "~0.4.13" - } - } + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/peer-info/-/peer-info-0.15.1.tgz", + "integrity": "sha512-Y91Q2tZRC0CpSTPd1UebhGqniOrOAk/aj60uYUcWJXCoLTAnGu+4LJGoiay8ayudS6ice7l3SKhgL/cS62QacA==", + "requires": { + "mafmt": "^6.0.2", + "multiaddr": "^6.0.3", + "peer-id": "~0.12.2", + "unique-by": "^1.0.0" } }, "pem-jwk": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pem-jwk/-/pem-jwk-1.5.1.tgz", - "integrity": "sha1-eoY3/S9nqCflfAxC4cI8P9Us+wE=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pem-jwk/-/pem-jwk-2.0.0.tgz", + "integrity": "sha512-rFxu7rVoHgQ5H9YsP50dDWf0rHjreVA2z0yPiWr5WdH/UHb29hKtF7h6l8vNd1cbYR1t0QL+JKhW55a2ZV4KtA==", "requires": { - "asn1.js": "1.0.3" - }, - "dependencies": { - "asn1.js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-1.0.3.tgz", - "integrity": "sha1-KBuj7B8kSP52X5Kk7s+IP+E2S1Q=", - "requires": { - "bn.js": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "bn.js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-1.3.0.tgz", - "integrity": "sha1-DbTL+W+PI7dC9by50ap6mZSgXoM=", - "optional": true - } + "asn1.js": "^5.0.1" } }, "pg": { @@ -5674,7 +5536,8 @@ "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true }, "pstree.remy": { "version": "1.1.7", @@ -5687,25 +5550,18 @@ "resolved": "https://registry.npmjs.org/pull-defer/-/pull-defer-0.2.3.tgz", "integrity": "sha512-/An3KE7mVjZCqNhZsr22k1Tx8MACnUnHZZNPSJ0S62td8JtYr/AiRG42Vz7Syu31SoTLUzVIe61jtT/pNdjVYA==" }, - "pull-pushable": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pull-pushable/-/pull-pushable-2.2.0.tgz", - "integrity": "sha1-Xy867UethpGfAbEqLpnW8b13ZYE=" - }, "pull-stream": { - "version": "3.6.12", - "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.12.tgz", - "integrity": "sha512-+LO1XIVyTMmeoH26UHznpgrgX2npTVYccTkMpgk/EyiQjFt1FmoNm+w+/zMLuz9U3bpvT5sSUicMKEe/2JjgEA==" - }, - "pull-stream-to-stream": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/pull-stream-to-stream/-/pull-stream-to-stream-1.3.4.tgz", - "integrity": "sha1-P4HYIWvRjSv9GhmBkEcRgOJzg5k=" + "version": "3.6.14", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-3.6.14.tgz", + "integrity": "sha512-KIqdvpqHHaTUA2mCYcLG1ibEbu/LCKoJZsBWyv9lSYtPkJPBq8m3Hxa103xHi6D2thj5YXa0TqK3L3GUkwgnew==" }, - "pull-traverse": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pull-traverse/-/pull-traverse-1.0.3.tgz", - "integrity": "sha1-dPtde+f6a9enjpeTPhmbeUWGaTg=" + "pull-to-stream": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pull-to-stream/-/pull-to-stream-0.1.1.tgz", + "integrity": "sha512-thZkMv6F9PILt9zdvpI2gxs19mkDrlixYKX6cOBxAW16i1NZH+yLAmF4r8QfJ69zuQh27e01JZP9y27tsH021w==", + "requires": { + "readable-stream": "^3.1.1" + } }, "pump": { "version": "3.0.0", @@ -6812,18 +6668,13 @@ } }, "split2": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/split2/-/split2-3.1.1.tgz", + "integrity": "sha512-emNzr1s7ruq4N+1993yht631/JH+jaj0NYBosuKmLcq+JkGQ9MmTw1RB1fGaTCzUuseRIClrlSLHRNYGwWQ58Q==", "requires": { - "through2": "^2.0.2" + "readable-stream": "^3.0.0" } }, - "sprintf-js": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", - "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==" - }, "stable": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", @@ -6897,17 +6748,6 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, - "stream-http": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.0.0.tgz", - "integrity": "sha512-JELJfd+btL9GHtxU3+XXhg9NLYrKFnhybfvRuDghtyVkOFydz3PKNT1df07AMr88qW03WHF+FSV0PySpXignCA==", - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^3.0.6", - "xtend": "^4.0.0" - } - }, "stream-to-pull-stream": { "version": "1.7.3", "resolved": "https://registry.npmjs.org/stream-to-pull-stream/-/stream-to-pull-stream-1.7.3.tgz", @@ -6917,11 +6757,6 @@ "pull-stream": "^3.2.3" } }, - "streamifier": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", - "integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=" - }, "streamsearch": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", @@ -7087,50 +6922,15 @@ } }, "tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.0.tgz", + "integrity": "sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw==", "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", + "bl": "^3.0.0", + "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - }, - "dependencies": { - "bl": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", - "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" } }, "term-size": { @@ -7171,36 +6971,11 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", + "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } + "readable-stream": "2 || 3" } }, "timed-out": { @@ -7228,11 +7003,6 @@ "os-tmpdir": "~1.0.2" } }, - "to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" - }, "to-object-path": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", @@ -7300,11 +7070,6 @@ "nopt": "~1.0.10" } }, - "traverse": { - "version": "0.6.6", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" - }, "tweetnacl": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz", @@ -7420,6 +7185,11 @@ "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", "dev": true }, + "unique-by": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-by/-/unique-by-1.0.0.tgz", + "integrity": "sha1-UiDIa6e8Vy+3E610ZRRwy2RCEr0=" + }, "unique-string": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", @@ -7606,10 +7376,6 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, - "webcrypto-shim": { - "version": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8", - "from": "github:dignifiedquire/webcrypto-shim#master" - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -7733,7 +7499,8 @@ "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true }, "yargs-parser": { "version": "13.1.1", diff --git a/creator-node/package.json b/creator-node/package.json index 1eead428323..218b9b8be08 100644 --- a/creator-node/package.json +++ b/creator-node/package.json @@ -32,7 +32,7 @@ "ffmpeg-static": "^2.4.0", "ffprobe-static": "^3.0.0", "ioredis": "^4.9.3", - "ipfs-api": "^26.1.2", + "ipfs-http-client": "^33.1.1", "multer": "^1.4.0", "pg": "^7.6.1", "rate-limit-redis": "^1.6.0", diff --git a/creator-node/src/ffprobe.js b/creator-node/src/ffprobe.js index 536a20df99a..fad0a666609 100644 --- a/creator-node/src/ffprobe.js +++ b/creator-node/src/ffprobe.js @@ -6,9 +6,10 @@ var spawn = require('child_process').spawn async function getTrackDuration (fileDir) { try { - const info = await getInfo(fileDir, { path: ffprobeStatic.path }) - // TODO - data validation - return info.streams[0].duration + const resp = await getInfo(fileDir, { path: ffprobeStatic.path }) + const duration = Number(resp.streams[0].duration) + if (isNaN(duration)) throw new Error(`Invalid return value from FFProbe: ${duration}`) + return duration } catch (e) { // If the error is the text below, it means the segment doesn't have any // data. In that case, just return null so we skip adding the segment diff --git a/creator-node/src/fileManager.js b/creator-node/src/fileManager.js index 9e398b633ce..18de31441ec 100644 --- a/creator-node/src/fileManager.js +++ b/creator-node/src/fileManager.js @@ -15,10 +15,13 @@ const maxMemoryFileSize = parseInt(config.get('maxMemoryFileSizeBytes')) // Defa const ALLOWED_UPLOAD_FILE_EXTENSIONS = config.get('allowedUploadFileExtensions') // default set in config.json const AUDIO_MIME_TYPE_REGEX = /audio\/(.*)/ -/** (1) Add file to IPFS; (2) save file to disk; - * (3) pin file via IPFS; (4) save file ref to DB +/** + * (1) Add file to IPFS; (2) save file to disk; + * (3) pin file via IPFS; (4) save file ref to DB + * @dev - only call this function when file is not already stored to disk + * - if it is, then use saveFileToIPFSFromFS() */ -async function saveFile (req, buffer) { +async function saveFileFromBuffer (req, buffer) { // make sure user has authenticated before saving file if (!req.userId) { throw new Error('User must be authenticated to save a file') @@ -26,15 +29,13 @@ async function saveFile (req, buffer) { const ipfs = req.app.get('ipfsAPI') - let multihash = await ipfs.files.add(buffer, { onlyHash: true }) - multihash = multihash[0].hash + const multihash = (await ipfs.add(buffer))[0].hash - const fileLocation = path.join(req.app.get('storagePath'), '/' + multihash) - await writeFile(fileLocation, buffer) + const dstPath = path.join(req.app.get('storagePath'), multihash) - // TODO(roneilr): switch to using the IPFS filestore below to avoid duplicating content - const filesAdded = await ipfs.files.add(buffer) - assert.strictEqual(multihash, filesAdded[0].hash) + await writeFile(dstPath, buffer) + + // TODO: switch to using the IPFS filestore below to avoid duplicating content await ipfs.pin.add(multihash) // add reference to file to database @@ -43,7 +44,7 @@ async function saveFile (req, buffer) { cnodeUserUUID: req.userId, multihash: multihash, sourceFile: req.fileName, - storagePath: fileLocation + storagePath: dstPath } }) @@ -53,6 +54,41 @@ async function saveFile (req, buffer) { return { multihash: multihash, fileUUID: file.fileUUID } } +/** + * Save file to IPFS given file path. + * - Add and pin file to IPFS. + * - Re-save file to disk under multihash. + * - Save reference to file in DB. + */ +async function saveFileToIPFSFromFS (req, srcPath) { + // make sure user has authenticated before saving file + if (!req.userId) throw new Error('User must be authenticated to save a file') + + const ipfs = req.app.get('ipfsAPI') + + const multihash = (await ipfs.addFromFs(srcPath))[0].hash + const dstPath = path.join(req.app.get('storagePath'), multihash) + + // store segment file copy under multihash for easy future retrieval + fs.copyFileSync(srcPath, dstPath) + + // TODO: switch to using the IPFS filestore below to avoid duplicating content + await ipfs.pin.add(multihash) + + // add reference to file to database + const file = (await models.File.findOrCreate({ where: + { + cnodeUserUUID: req.userId, + multihash: multihash, + sourceFile: req.fileName, + storagePath: dstPath + } + }))[0].dataValues + + req.logger.info(`\nAdded file: ${multihash} for fileUUID ${file.fileUUID} from sourceFile ${req.fileName}`) + return { multihash: multihash, fileUUID: file.fileUUID } +} + /** Save file to disk given IPFS multihash, and ensure is pinned. * Steps: * - If file already stored on disk, return immediately. @@ -168,7 +204,7 @@ const trackDiskStorage = multer.diskStorage({ destination: function (req, file, cb) { // save file under randomly named folders to avoid collisions const randomFileName = getUuid() - const fileDir = req.app.get('storagePath') + '/' + randomFileName + const fileDir = path.join(req.app.get('storagePath'), randomFileName) // create directories for original file and segments fs.mkdirSync(fileDir) @@ -207,4 +243,4 @@ function getFileExtension (fileName) { return (fileName.lastIndexOf('.') >= 0) ? fileName.substr(fileName.lastIndexOf('.')) : '' } -module.exports = { saveFile, saveFileForMultihash, removeTrackFolder, upload, trackFileUpload } +module.exports = { saveFileFromBuffer, saveFileToIPFSFromFS, saveFileForMultihash, removeTrackFolder, upload, trackFileUpload } diff --git a/creator-node/src/index.js b/creator-node/src/index.js index 3f899b5fc2a..83b94fde720 100644 --- a/creator-node/src/index.js +++ b/creator-node/src/index.js @@ -2,7 +2,7 @@ const S3 = require('aws-sdk').S3 const ON_DEATH = require('death') -const ipfsAPI = require('ipfs-api') +const ipfsClient = require('ipfs-http-client') const path = require('path') const initializeApp = require('./app') @@ -53,7 +53,7 @@ if (!ipfsAddr) { logger.error('Must set ipfsAddr') process.exit(1) } -let ipfs = ipfsAPI(ipfsAddr, config.get('ipfsPort')) +let ipfs = ipfsClient(ipfsAddr, config.get('ipfsPort')) // run all migrations logger.info('Executing database migrations...') diff --git a/creator-node/src/redis.js b/creator-node/src/redis.js index 11c56d9d0ff..1b7729217b9 100644 --- a/creator-node/src/redis.js +++ b/creator-node/src/redis.js @@ -28,7 +28,6 @@ module.exports.lock = RedisLock /** Ensure resource write access */ async function nodeSyncMiddleware (req, res, next) { - req.logger.info('before nodeysnc middleware') if (req.session && req.session.wallet) { const redisKey = getNodeSyncRedisKey(req.session.wallet) const lockHeld = await RedisLock.getLock(redisKey) @@ -38,7 +37,6 @@ async function nodeSyncMiddleware (req, res, next) { )) } } - req.logger.info('after nodeysnc middleware') next() } diff --git a/creator-node/src/routes/audiusUsers.js b/creator-node/src/routes/audiusUsers.js index fed52ad899c..34629f4e4fc 100644 --- a/creator-node/src/routes/audiusUsers.js +++ b/creator-node/src/routes/audiusUsers.js @@ -1,19 +1,19 @@ +const { Buffer } = require('ipfs-http-client') + const models = require('../models') const authMiddleware = require('../authMiddleware') const nodeSyncMiddleware = require('../redis').nodeSyncMiddleware -const { saveFile } = require('../fileManager') +const { saveFileFromBuffer } = require('../fileManager') const { handleResponse, successResponse, errorResponseBadRequest } = require('../apiHelpers') module.exports = function (app) { // create AudiusUser from provided metadata, and make metadata available to network app.post('/audius_users', authMiddleware, nodeSyncMiddleware, handleResponse(async (req, res) => { - const ipfs = req.app.get('ipfsAPI') - - // TODO(roneilr): do some validation on metadata given + // TODO: do some validation on metadata given const metadataJSON = req.body - const metadataBuffer = ipfs.types.Buffer.from(JSON.stringify(metadataJSON)) - const { multihash, fileUUID } = await saveFile(req, metadataBuffer) + const metadataBuffer = Buffer.from(JSON.stringify(metadataJSON)) + const { multihash, fileUUID } = await saveFileFromBuffer(req, metadataBuffer) const audiusUserObj = { cnodeUserUUID: req.userId, @@ -58,7 +58,6 @@ module.exports = function (app) { // update a AudiusUser app.put('/audius_users/:blockchainId', authMiddleware, nodeSyncMiddleware, handleResponse(async (req, res) => { - const ipfs = req.app.get('ipfsAPI') const blockchainId = req.params.blockchainId const audiusUser = await models.AudiusUser.findOne({ where: { blockchainId, cnodeUserUUID: req.userId } }) @@ -67,13 +66,12 @@ module.exports = function (app) { return errorResponseBadRequest(`Audius User doesn't exist for that blockchainId`) } - // TODO(roneilr, dmanjunath): do some validation on metadata given + // TODO: do some validation on metadata given const metadataJSON = req.body - - const metadataBuffer = ipfs.types.Buffer.from(JSON.stringify(metadataJSON)) + const metadataBuffer = Buffer.from(JSON.stringify(metadataJSON)) // write to a new file so there's still a record of the old file - const { multihash, fileUUID } = await saveFile(req, metadataBuffer) + const { multihash, fileUUID } = await saveFileFromBuffer(req, metadataBuffer) // Update the file to the new fileId and write the metadata blob in the json field let updateObj = { diff --git a/creator-node/src/routes/files.js b/creator-node/src/routes/files.js index f625f136c9d..1356003504b 100644 --- a/creator-node/src/routes/files.js +++ b/creator-node/src/routes/files.js @@ -1,4 +1,6 @@ -const { saveFile, upload } = require('../fileManager') +const { Buffer } = require('ipfs-http-client') + +const { saveFileFromBuffer, upload } = require('../fileManager') const { handleResponse, sendResponse, successResponse, errorResponseBadRequest, errorResponseServerError, errorResponseNotFound } = require('../apiHelpers') const models = require('../models') @@ -10,19 +12,19 @@ let Redis = require('ioredis') let client = new Redis(config.get('redisPort'), config.get('redisHost')) module.exports = function (app) { - // upload image file and make avail - // TODO(ss) - input validation + /** Store image on disk + DB and make available via IPFS */ app.post('/image_upload', authMiddleware, nodeSyncMiddleware, upload.single('file'), handleResponse(async (req, res) => { - const { multihash } = await saveFile(req, req.file.buffer) + // TODO: input validation + // TODO: switch to saveFileToIPFSFromFS + const { multihash } = await saveFileFromBuffer(req, req.file.buffer) return successResponse({ 'image_file_multihash': multihash }) })) - // upload metadata to IPFS and save in Files table + /** upload metadata to IPFS and save in Files table */ app.post('/metadata', authMiddleware, nodeSyncMiddleware, handleResponse(async (req, res) => { - const ipfs = req.app.get('ipfsAPI') const metadataJSON = req.body - const metadataBuffer = ipfs.types.Buffer.from(JSON.stringify(metadataJSON)) - const { multihash } = await saveFile(req, metadataBuffer) + const metadataBuffer = Buffer.from(JSON.stringify(metadataJSON)) + const { multihash } = await saveFileFromBuffer(req, metadataBuffer) return successResponse({ 'metadataMultihash': multihash }) })) diff --git a/creator-node/src/routes/tracks.js b/creator-node/src/routes/tracks.js index bbb06cfe7af..0a225db5ff0 100644 --- a/creator-node/src/routes/tracks.js +++ b/creator-node/src/routes/tracks.js @@ -1,22 +1,25 @@ -const fs = require('fs') +const path = require('path') +const { Buffer } = require('ipfs-http-client') + const ffmpeg = require('../ffmpeg') const ffprobe = require('../ffprobe') const models = require('../models') const authMiddleware = require('../authMiddleware') const nodeSyncMiddleware = require('../redis').nodeSyncMiddleware -const { saveFile, removeTrackFolder, trackFileUpload } = require('../fileManager') +const { saveFileFromBuffer, saveFileToIPFSFromFS, removeTrackFolder, trackFileUpload } = require('../fileManager') const { handleResponse, successResponse, errorResponseBadRequest, errorResponseServerError } = require('../apiHelpers') module.exports = function (app) { - // upload track segment files and make avail - will later be associated with Audius track + /** + * upload track segment files and make avail - will later be associated with Audius track + * @dev - currently stores each segment twice, once under random file UUID & once under IPFS multihash + * - this should be addressed eventually + */ app.post('/track_content', authMiddleware, nodeSyncMiddleware, trackFileUpload.single('file'), handleResponse(async (req, res) => { - if (req.fileFilterError) { - // POST body is not a valid file type - return errorResponseBadRequest(req.fileFilterError) - } + if (req.fileFilterError) return errorResponseBadRequest(req.fileFilterError) - // create and save segments to disk + // create and save track file segments to disk let segmentFilePaths try { segmentFilePaths = await ffmpeg.segmentFile(req, req.fileDir, req.fileName) @@ -25,17 +28,28 @@ module.exports = function (app) { return errorResponseServerError(err) } - // for each path, read file into buffer and pass to saveFile - const files = [] - for (let path of segmentFilePaths) { - let absolutePath = req.fileDir + '/segments/' + path - let fileBuffer = fs.readFileSync(absolutePath) - let { multihash } = await saveFile(req, fileBuffer) - const duration = await ffprobe.getTrackDuration(absolutePath) - if (duration) files.push({ 'multihash': multihash, duration: duration }) + // for each path, call saveFile and get back multihash; return multihash + segment duration + // run all async ops in parallel as they are not independent + let saveFileProms = [] + let durationProms = [] + for (let filePath of segmentFilePaths) { + const absolutePath = path.join(req.fileDir, 'segments', filePath) + const saveFileProm = saveFileToIPFSFromFS(req, absolutePath) + const durationProm = ffprobe.getTrackDuration(absolutePath) + saveFileProms.push(saveFileProm) + durationProms.push(durationProm) } + // Resolve all promises + process responses + const [saveFilePromResps, durationPromResps] = await Promise.all( + [saveFileProms, durationProms].map(promiseArray => Promise.all(promiseArray)) + ) + let trackSegments = saveFilePromResps.map((saveFileResp, i) => { + return { 'multihash': saveFileResp.multihash, 'duration': durationPromResps[i] } + }) + // exclude 0-length segments that are sometimes outputted by ffmpeg segmentation + trackSegments = trackSegments.filter(trackSegment => trackSegment.duration) - return successResponse({ 'track_segments': files }) + return successResponse({ 'track_segments': trackSegments }) })) /** given track metadata object, create track and share track metadata with network @@ -43,8 +57,6 @@ module.exports = function (app) { * - return on failure: error if linked segments have not already been created via POST /track_content */ app.post('/tracks', authMiddleware, nodeSyncMiddleware, handleResponse(async (req, res) => { - const ipfs = req.app.get('ipfsAPI') - // TODO - input validation const metadataJSON = req.body @@ -78,8 +90,8 @@ module.exports = function (app) { } // store metadata multihash - const metadataBuffer = ipfs.types.Buffer.from(JSON.stringify(metadataJSON)) - const { multihash, fileUUID } = await saveFile(req, metadataBuffer) + const metadataBuffer = Buffer.from(JSON.stringify(metadataJSON)) + const { multihash, fileUUID } = await saveFileFromBuffer(req, metadataBuffer) // build track object for db storage const trackObj = { @@ -131,7 +143,7 @@ module.exports = function (app) { return errorResponseBadRequest('Invalid track ID') } - // TODO(roneilr): validate that provided blockchain ID is indeed associated with + // TODO: validate that provided blockchain ID is indeed associated with // user wallet and metadata CID await track.update({ blockchainId: blockchainId @@ -152,7 +164,6 @@ module.exports = function (app) { // update a track app.put('/tracks/:blockchainId', authMiddleware, nodeSyncMiddleware, handleResponse(async (req, res) => { - const ipfs = req.app.get('ipfsAPI') const blockchainId = req.params.blockchainId const cnodeUserUUID = req.userId @@ -160,13 +171,12 @@ module.exports = function (app) { if (!track) return errorResponseBadRequest(`Could not find track with id ${blockchainId} owned by calling user`) - // TODO(roneilr, dmanjunath): do some validation on metadata given + // TODO: do some validation on metadata given const metadataJSON = req.body - - const metadataBuffer = ipfs.types.Buffer.from(JSON.stringify(metadataJSON)) + const metadataBuffer = Buffer.from(JSON.stringify(metadataJSON)) // write to a new file so there's still a record of the old file - const { multihash, fileUUID } = await saveFile(req, metadataBuffer) + const { multihash, fileUUID } = await saveFileFromBuffer(req, metadataBuffer) const coverArtFileMultihash = metadataJSON.cover_art let coverArtFileUUID = null diff --git a/creator-node/test/audiusUsers.js b/creator-node/test/audiusUsers.js index 2b8fa6e85f8..d3bb6d46785 100644 --- a/creator-node/test/audiusUsers.js +++ b/creator-node/test/audiusUsers.js @@ -21,7 +21,7 @@ describe('test AudiusUsers', function () { const metadata = { test: 'field1' } - ipfsMock.files.add.twice().withArgs(Buffer.from(JSON.stringify(metadata))) + ipfsMock.add.twice().withArgs(Buffer.from(JSON.stringify(metadata))) ipfsMock.pin.add.once().withArgs('testCIDLink') request(app) @@ -44,7 +44,7 @@ describe('test AudiusUsers', function () { const metadata = { test: 'field1' } - ipfsMock.files.add.twice().withArgs(Buffer.from(JSON.stringify(metadata))) + ipfsMock.add.twice().withArgs(Buffer.from(JSON.stringify(metadata))) ipfsMock.pin.add.once().withArgs('testCIDLink') request(app) diff --git a/creator-node/test/lib/ipfsMock.js b/creator-node/test/lib/ipfsMock.js index 32a17f1940b..019b6d2293a 100644 --- a/creator-node/test/lib/ipfsMock.js +++ b/creator-node/test/lib/ipfsMock.js @@ -2,17 +2,14 @@ const sinon = require('sinon') function getIPFSMock () { const ipfsMock = { - types: { - Buffer: Buffer - }, - files: { - add: sinon.mock() - }, + add: sinon.mock(), + addFromFs: sinon.mock(), pin: { add: sinon.mock() } } - ipfsMock.files.add.returns([{ hash: 'testCIDLink' }]) + ipfsMock.add.returns([{ hash: 'testCIDLink' }]) + ipfsMock.addFromFs.returns([{ hash: 'testCIDLink' }]) return ipfsMock } diff --git a/creator-node/test/tracks.js b/creator-node/test/tracks.js index 2de57715f63..a9269186662 100644 --- a/creator-node/test/tracks.js +++ b/creator-node/test/tracks.js @@ -47,7 +47,7 @@ describe('test Tracks', function () { server = appInfo.server session = await createStarterCNodeUser() - ipfsMock.files.add.exactly(64) + ipfsMock.add.exactly(64) ipfsMock.pin.add.exactly(32) // Confirm max audio file size is respected by multer @@ -76,7 +76,7 @@ describe('test Tracks', function () { server = appInfo.server session = await createStarterCNodeUser() - ipfsMock.files.add.exactly(64) + ipfsMock.add.exactly(64) ipfsMock.pin.add.exactly(32) // Confirm max audio file size is respected by multer @@ -96,7 +96,7 @@ describe('test Tracks', function () { it('uploads file to IPFS', async function () { const file = fs.readFileSync(testAudioFilePath) - ipfsMock.files.add.exactly(64) + ipfsMock.addFromFs.exactly(32) ipfsMock.pin.add.exactly(32) const resp1 = await request(app) @@ -116,7 +116,7 @@ describe('test Tracks', function () { it('creates Audius track', async function () { const file = fs.readFileSync(testAudioFilePath) - ipfsMock.files.add.exactly(66) + ipfsMock.addFromFs.exactly(34) ipfsMock.pin.add.exactly(34) const resp1 = await request(app) @@ -153,7 +153,7 @@ describe('test Tracks', function () { it('fails to create Audius track when segments not provided', async function () { const file = fs.readFileSync(testAudioFilePath) - ipfsMock.files.add.exactly(66) + ipfsMock.addFromFs.exactly(34) ipfsMock.pin.add.exactly(34) const resp1 = await request(app) @@ -185,7 +185,7 @@ describe('test Tracks', function () { it('fails to create Audius track when invalid segment multihashes are provided', async function () { const file = fs.readFileSync(testAudioFilePath) - ipfsMock.files.add.exactly(66) + ipfsMock.addFromFs.exactly(34) ipfsMock.pin.add.exactly(34) const resp1 = await request(app) @@ -218,7 +218,7 @@ describe('test Tracks', function () { it('fails to create Audius track when owner_id is not provided', async function () { const file = fs.readFileSync(testAudioFilePath) - ipfsMock.files.add.exactly(66) + ipfsMock.addFromFs.exactly(34) ipfsMock.pin.add.exactly(34) const resp1 = await request(app) @@ -250,7 +250,7 @@ describe('test Tracks', function () { it('completes Audius track creation', async function () { const file = fs.readFileSync(testAudioFilePath) - ipfsMock.files.add.exactly(66) + ipfsMock.addFromFs.exactly(34) ipfsMock.pin.add.exactly(34) const resp1 = await request(app)