From 43b7a4482eca51a75a1a276519f9deda4d5d03d9 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 1 Apr 2021 17:12:56 +0100 Subject: [PATCH 01/24] chore: update buffer deps Updates deps to pull in Buffer@6.x.x Refs #3604 --- packages/ipfs-http-client/package.json | 2 +- packages/ipfs-http-server/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index f00443eb66..3877fcd54e 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -60,7 +60,7 @@ "ipld-raw": "^7.0.0", "it-last": "^1.0.4", "it-map": "^1.0.4", - "it-tar": "^1.2.2", + "it-tar": "^2.0.0", "it-to-stream": "^0.1.2", "merge-options": "^3.0.4", "multiaddr": "^8.0.0", diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index 577bc560d0..0e6d2c7ccb 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -51,7 +51,7 @@ "it-map": "^1.0.4", "it-multipart": "^1.0.8", "it-pipe": "^1.1.0", - "it-tar": "^1.2.2", + "it-tar": "^2.0.0", "it-to-stream": "^0.1.2", "iterable-ndjson": "^1.1.0", "joi": "^17.2.1", From 103f4f86346ee88eef842ad685845e38c9b05e4e Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 9 Apr 2021 15:49:57 +0100 Subject: [PATCH 02/24] chore: dep updates --- examples/browser-browserify/package.json | 2 +- examples/browser-exchange-files/package.json | 2 +- examples/browser-ipns-publish/package.json | 2 +- examples/browser-readablestream/package.json | 2 +- examples/custom-ipfs-repo/package.json | 2 +- examples/explore-ethereum-blockchain/package.json | 4 ++-- examples/http-client-browser-pubsub/package.json | 2 +- examples/http-client-bundle-webpack/package.json | 2 +- examples/http-client-name-api/package.json | 2 +- examples/ipfs-client-add-files/package.json | 2 +- examples/run-in-electron/package.json | 2 +- examples/traverse-ipld-graphs/package.json | 2 +- examples/types-use-ipfs-from-ts/package.json | 2 +- examples/types-use-ipfs-from-typed-js/package.json | 2 +- packages/interface-ipfs-core/package.json | 6 +++--- packages/ipfs-cli/package.json | 10 +++++----- packages/ipfs-client/package.json | 2 +- packages/ipfs-core-types/package.json | 4 ++-- packages/ipfs-core-utils/package.json | 6 +++--- packages/ipfs-core/package.json | 10 +++++----- packages/ipfs-daemon/package.json | 4 ++-- packages/ipfs-grpc-client/package.json | 8 ++++---- packages/ipfs-grpc-server/package.json | 6 +++--- packages/ipfs-http-client/package.json | 10 +++++----- packages/ipfs-http-gateway/package.json | 6 +++--- packages/ipfs-http-server/package.json | 12 ++++++------ packages/ipfs-message-port-client/package.json | 2 +- packages/ipfs-message-port-protocol/package.json | 2 +- packages/ipfs-message-port-server/package.json | 2 +- packages/ipfs/package.json | 8 ++++---- 30 files changed, 64 insertions(+), 64 deletions(-) diff --git a/examples/browser-browserify/package.json b/examples/browser-browserify/package.json index 5d2e005340..3260f36dd9 100644 --- a/examples/browser-browserify/package.json +++ b/examples/browser-browserify/package.json @@ -14,7 +14,7 @@ "keywords": [], "license": "MIT", "devDependencies": { - "browserify": "^16.2.3", + "browserify": "^17.0.0", "concat-stream": "^2.0.0", "execa": "^5.0.0", "http-server": "^0.12.3", diff --git a/examples/browser-exchange-files/package.json b/examples/browser-exchange-files/package.json index 0e55f015da..2190012a42 100644 --- a/examples/browser-exchange-files/package.json +++ b/examples/browser-exchange-files/package.json @@ -11,7 +11,7 @@ }, "license": "MIT", "devDependencies": { - "browserify": "^16.2.3", + "browserify": "^17.0.0", "execa": "^5.0.0", "http-server": "^0.12.3", "ipfs-http-client": "^49.0.4", diff --git a/examples/browser-ipns-publish/package.json b/examples/browser-ipns-publish/package.json index 2b60a4cbcd..bcb2a080d0 100644 --- a/examples/browser-ipns-publish/package.json +++ b/examples/browser-ipns-publish/package.json @@ -27,7 +27,7 @@ "devDependencies": { "delay": "^5.0.0", "execa": "^5.0.0", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "go-ipfs": "0.8.0", "parcel": "2.0.0-beta.2", "path": "^0.12.7", diff --git a/examples/browser-readablestream/package.json b/examples/browser-readablestream/package.json index 6a8b79a26a..e73d557fd2 100644 --- a/examples/browser-readablestream/package.json +++ b/examples/browser-readablestream/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "ipfs": "^0.54.4", - "it-to-stream": "^0.1.2", + "it-to-stream": "^1.0.0", "videostream": "^3.2.0" } } diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json index ad4dbb7251..73aa60fb02 100644 --- a/examples/custom-ipfs-repo/package.json +++ b/examples/custom-ipfs-repo/package.json @@ -10,7 +10,7 @@ }, "license": "MIT", "dependencies": { - "datastore-fs": "^2.0.0", + "datastore-fs": "^3.0.1", "ipfs": "^0.54.4", "ipfs-repo": "^9.0.0", "it-all": "^1.0.4" diff --git a/examples/explore-ethereum-blockchain/package.json b/examples/explore-ethereum-blockchain/package.json index ece0624d83..38d5ec94d6 100644 --- a/examples/explore-ethereum-blockchain/package.json +++ b/examples/explore-ethereum-blockchain/package.json @@ -12,8 +12,8 @@ "devDependencies": { "ipfs": "^0.54.4", "ipfs-http-client": "^49.0.4", - "ipfsd-ctl": "^8.0.0", - "ipld-ethereum": "^5.0.1", + "ipfsd-ctl": "^8.0.1", + "ipld-ethereum": "^6.0.0", "test-ipfs-example": "^3.0.0" } } diff --git a/examples/http-client-browser-pubsub/package.json b/examples/http-client-browser-pubsub/package.json index fac560f9f6..da1ead9ab7 100644 --- a/examples/http-client-browser-pubsub/package.json +++ b/examples/http-client-browser-pubsub/package.json @@ -21,7 +21,7 @@ "execa": "^5.0.0", "go-ipfs": "0.8.0", "ipfs": "^0.54.4", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "parcel": "2.0.0-beta.2", "test-ipfs-example": "^3.0.0" } diff --git a/examples/http-client-bundle-webpack/package.json b/examples/http-client-bundle-webpack/package.json index f27f147c7c..3716a03482 100644 --- a/examples/http-client-bundle-webpack/package.json +++ b/examples/http-client-bundle-webpack/package.json @@ -25,7 +25,7 @@ "copy-webpack-plugin": "^8.1.0", "execa": "^5.0.0", "ipfs": "^0.54.4", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "react-hot-loader": "^4.12.21", "rimraf": "^3.0.2", "test-ipfs-example": "^3.0.0", diff --git a/examples/http-client-name-api/package.json b/examples/http-client-name-api/package.json index 3d291d9e39..426551a790 100644 --- a/examples/http-client-name-api/package.json +++ b/examples/http-client-name-api/package.json @@ -18,7 +18,7 @@ "devDependencies": { "execa": "^5.0.0", "go-ipfs": "0.8.0", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "parcel": "2.0.0-beta.2", "rimraf": "^3.0.2", "test-ipfs-example": "^3.0.0" diff --git a/examples/ipfs-client-add-files/package.json b/examples/ipfs-client-add-files/package.json index 1b5dbb2fe1..b53d803749 100644 --- a/examples/ipfs-client-add-files/package.json +++ b/examples/ipfs-client-add-files/package.json @@ -16,7 +16,7 @@ "devDependencies": { "execa": "^5.0.0", "ipfs": "^0.54.4", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "parcel": "2.0.0-beta.2", "rimraf": "^3.0.2", "test-ipfs-example": "^3.0.0" diff --git a/examples/run-in-electron/package.json b/examples/run-in-electron/package.json index a0fa3ffc1a..6e69f215b0 100644 --- a/examples/run-in-electron/package.json +++ b/examples/run-in-electron/package.json @@ -16,7 +16,7 @@ "author": "David Dias ", "license": "MIT", "devDependencies": { - "electron": "^11.2.1", + "electron": "^12.0.2", "electron-rebuild": "^2.3.4", "ipfs": "^0.54.4", "test-ipfs-example": "^3.0.0" diff --git a/examples/traverse-ipld-graphs/package.json b/examples/traverse-ipld-graphs/package.json index 95e068a8bd..ad002d1bf4 100644 --- a/examples/traverse-ipld-graphs/package.json +++ b/examples/traverse-ipld-graphs/package.json @@ -18,7 +18,7 @@ "ipld-block": "^0.11.0", "ipld-dag-pb": "^0.22.1", "ipld-git": "^0.6.1", - "ipld-ethereum": "^5.0.1", + "ipld-ethereum": "^6.0.0", "multihashing-async": "^2.1.2" } } diff --git a/examples/types-use-ipfs-from-ts/package.json b/examples/types-use-ipfs-from-ts/package.json index 91dad859c8..7caab49abb 100644 --- a/examples/types-use-ipfs-from-ts/package.json +++ b/examples/types-use-ipfs-from-ts/package.json @@ -5,7 +5,7 @@ "ipfs": "^0.54.4" }, "devDependencies": { - "typescript": "4.1.x" + "typescript": "4.2.x" }, "scripts": { "test": "tsc --noEmit" diff --git a/examples/types-use-ipfs-from-typed-js/package.json b/examples/types-use-ipfs-from-typed-js/package.json index fba48fc6cf..54f9ded620 100644 --- a/examples/types-use-ipfs-from-typed-js/package.json +++ b/examples/types-use-ipfs-from-typed-js/package.json @@ -5,7 +5,7 @@ "ipfs": "^0.54.4" }, "devDependencies": { - "typescript": "4.1.x" + "typescript": "4.2.x" }, "scripts": { "test": "tsc --noEmit" diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index 1493d99773..bbe8cd91ba 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "abort-controller": "^3.0.0", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "chai-subset": "^1.6.0", @@ -53,7 +53,7 @@ "ipld-dag-pb": "^0.22.1", "ipns": "^0.10.0", "is-ipfs": "^4.0.0", - "iso-random-stream": "^1.1.1", + "iso-random-stream": "^2.0.0", "it-all": "^1.0.4", "it-buffer-stream": "^2.0.0", "it-concat": "^1.0.3", @@ -64,7 +64,7 @@ "it-pushable": "^1.4.0", "libp2p-crypto": "^0.19.0", "libp2p-websockets": "^0.15.1", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multibase": "^4.0.2", "multihashing-async": "^2.1.2", "nanoid": "^3.1.12", diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index 4359a3ecf0..945e9f49a7 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "byteman": "^1.3.5", - "cid-tool": "^1.0.0", + "cid-tool": "^3.0.0", "cids": "^1.1.6", "debug": "^4.1.1", "err-code": "^3.0.1", @@ -54,11 +54,11 @@ "jsondiffpatch": "^0.4.1", "libp2p-crypto": "^0.19.0", "mafmt": "^8.0.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multiaddr-to-uri": "^6.0.0", "multibase": "^4.0.2", "multihashing-async": "^2.1.2", - "parse-duration": "^0.4.4", + "parse-duration": "^1.0.0", "pretty-bytes": "^5.4.1", "progress": "^2.0.3", "stream-to-it": "^0.2.2", @@ -70,12 +70,12 @@ "@types/get-folder-size": "^2.0.0", "@types/progress": "^2.0.3", "@types/yargs": "^16.0.0", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "nanoid": "^3.1.12", "ncp": "^2.0.0", "peer-id": "^0.14.1", "rimraf": "^3.0.2", - "sinon": "^9.0.3", + "sinon": "^10.0.1", "string-argv": "^0.3.1", "temp-write": "^4.0.0" } diff --git a/packages/ipfs-client/package.json b/packages/ipfs-client/package.json index 8cbce7067e..8d43aa35d9 100644 --- a/packages/ipfs-client/package.json +++ b/packages/ipfs-client/package.json @@ -37,7 +37,7 @@ "merge-options": "^3.0.4" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "rimraf": "^3.0.2" } } diff --git a/packages/ipfs-core-types/package.json b/packages/ipfs-core-types/package.json index a57b69dfac..fe9289074c 100644 --- a/packages/ipfs-core-types/package.json +++ b/packages/ipfs-core-types/package.json @@ -30,11 +30,11 @@ "dependencies": { "cids": "^1.1.6", "ipld": "^0.29.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multibase": "^4.0.2" }, "devDependencies": { - "aegir": "^32.1.0" + "aegir": "^33.0.0" }, "contributors": [ "Irakli Gozalishvili " diff --git a/packages/ipfs-core-utils/package.json b/packages/ipfs-core-utils/package.json index 7b7e89a6fe..dbe1f4c5a7 100644 --- a/packages/ipfs-core-utils/package.json +++ b/packages/ipfs-core-utils/package.json @@ -52,14 +52,14 @@ "it-all": "^1.0.4", "it-map": "^1.0.4", "it-peekable": "^1.0.1", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multiaddr-to-uri": "^6.0.0", - "parse-duration": "^0.4.4", + "parse-duration": "^1.0.0", "timeout-abort-controller": "^1.1.1", "uint8arrays": "^2.1.3" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "rimraf": "^3.0.2" } } diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 8f26e64c8e..732ca77d4c 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -109,29 +109,29 @@ "mafmt": "^8.0.0", "merge-options": "^3.0.4", "mortice": "^2.0.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multiaddr-to-uri": "^6.0.0", "multibase": "^4.0.2", "multicodec": "^3.0.1", "multihashing-async": "^2.1.2", "native-abort-controller": "^1.0.3", "p-queue": "^6.6.1", - "parse-duration": "^0.4.4", + "parse-duration": "^1.0.0", "peer-id": "^0.14.1", "streaming-iterables": "^5.0.2", "uint8arrays": "^2.1.3" }, "devDependencies": { "@types/dlv": "^1.1.2", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "delay": "^5.0.0", "go-ipfs": "0.8.0", "interface-ipfs-core": "^0.144.2", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "ipld-git": "^0.6.1", "iso-url": "^1.0.0", "nanoid": "^3.1.12", "rimraf": "^3.0.2", - "sinon": "^9.0.3" + "sinon": "^10.0.1" } } diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index 178f81c0cf..a60db65ef7 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -44,10 +44,10 @@ "libp2p-delegated-content-routing": "^0.9.0", "libp2p-delegated-peer-routing": "^0.8.0", "libp2p-webrtc-star": "^0.21.0", - "multiaddr": "^8.0.0" + "multiaddr": "^9.0.1" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "node-fetch": "^2.6.1", "ws": "^7.3.1" }, diff --git a/packages/ipfs-grpc-client/package.json b/packages/ipfs-grpc-client/package.json index 5017992e13..c7ab3e3647 100644 --- a/packages/ipfs-grpc-client/package.json +++ b/packages/ipfs-grpc-client/package.json @@ -32,7 +32,7 @@ "dep-check": "aegir dep-check -i aegir -i rimraf -i ipfs-grpc-protocol -i ipfs-core-types" }, "dependencies": { - "@improbable-eng/grpc-web": "^0.13.0", + "@improbable-eng/grpc-web": "^0.14.0", "change-case": "^4.1.1", "cids": "^1.1.6", "debug": "^4.1.1", @@ -43,16 +43,16 @@ "ipfs-unixfs": "^4.0.1", "it-first": "^1.0.4", "it-pushable": "^1.4.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "protobufjs": "^6.10.2", "wherearewe": "1.0.0", "ws": "^7.3.1" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "it-all": "^1.0.4", "rimraf": "^3.0.2", - "sinon": "^9.0.3" + "sinon": "^10.0.1" }, "eslintConfig": { "extends": "ipfs" diff --git a/packages/ipfs-grpc-server/package.json b/packages/ipfs-grpc-server/package.json index 506ffd055e..32d372d657 100644 --- a/packages/ipfs-grpc-server/package.json +++ b/packages/ipfs-grpc-server/package.json @@ -41,18 +41,18 @@ "it-peekable": "^1.0.1", "it-pipe": "^1.1.0", "it-pushable": "^1.4.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "protobufjs": "^6.10.2", "ws": "^7.3.1" }, "devDependencies": { "@types/ws": "^7.4.0", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "ipfs-core": "^0.5.4", "it-all": "^1.0.4", "it-drain": "^1.0.3", "rimraf": "^3.0.2", - "sinon": "^9.0.3", + "sinon": "^10.0.1", "uint8arrays": "^2.1.3" } } diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index 3877fcd54e..c3fae79610 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -61,23 +61,23 @@ "it-last": "^1.0.4", "it-map": "^1.0.4", "it-tar": "^2.0.0", - "it-to-stream": "^0.1.2", + "it-to-stream": "^1.0.0", "merge-options": "^3.0.4", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multibase": "^4.0.2", "multicodec": "^3.0.1", "multihashes": "^4.0.2", "nanoid": "^3.1.12", "native-abort-controller": "^1.0.3", - "parse-duration": "^0.4.4", + "parse-duration": "^1.0.0", "stream-to-it": "^0.2.2", "uint8arrays": "^2.1.3" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "delay": "^5.0.0", "go-ipfs": "0.8.0", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "it-all": "^1.0.4", "it-concat": "^1.0.3", "it-first": "^1.0.4", diff --git a/packages/ipfs-http-gateway/package.json b/packages/ipfs-http-gateway/package.json index 3f529e89ce..1f2df38340 100644 --- a/packages/ipfs-http-gateway/package.json +++ b/packages/ipfs-http-gateway/package.json @@ -52,7 +52,7 @@ "ipfs-http-response": "^0.6.0", "is-ipfs": "^4.0.0", "it-last": "^1.0.4", - "it-to-stream": "^0.1.2", + "it-to-stream": "^1.0.0", "joi": "^17.2.1", "multibase": "^4.0.2", "uint8arrays": "^2.1.3", @@ -61,9 +61,9 @@ "devDependencies": { "@types/hapi__hapi": "^20.0.5", "@types/hapi-pino": "^8.0.1", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "file-type": "^16.0.0", "rimraf": "^3.0.2", - "sinon": "^9.0.3" + "sinon": "^10.0.1" } } diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index 0e6d2c7ccb..f5e15ff4e6 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -52,16 +52,16 @@ "it-multipart": "^1.0.8", "it-pipe": "^1.1.0", "it-tar": "^2.0.0", - "it-to-stream": "^0.1.2", + "it-to-stream": "^1.0.0", "iterable-ndjson": "^1.1.0", "joi": "^17.2.1", "just-safe-set": "^2.1.0", - "multiaddr": "^8.0.0", + "multiaddr": "^9.0.1", "multibase": "^4.0.2", "multicodec": "^3.0.1", "multihashing-async": "^2.1.2", "native-abort-controller": "^1.0.3", - "parse-duration": "^0.4.4", + "parse-duration": "^1.0.0", "stream-to-it": "^0.2.2", "streaming-iterables": "^5.0.2", "uint8arrays": "^2.1.3", @@ -71,14 +71,14 @@ "@types/hapi__hapi": "^20.0.5", "@types/hapi-pino": "^8.0.1", "@types/just-safe-set": "^2.1.0", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "form-data": "^4.0.0", "ipfs-http-client": "^49.0.4", - "iso-random-stream": "^1.1.1", + "iso-random-stream": "^2.0.0", "it-to-buffer": "^2.0.0", "qs": "^6.9.4", "rimraf": "^3.0.2", - "sinon": "^9.0.3", + "sinon": "^10.0.1", "stream-to-promise": "^3.0.0" }, "optionalDependencies": { diff --git a/packages/ipfs-message-port-client/package.json b/packages/ipfs-message-port-client/package.json index fca157b1c3..3d0dd6ab5d 100644 --- a/packages/ipfs-message-port-client/package.json +++ b/packages/ipfs-message-port-client/package.json @@ -40,7 +40,7 @@ "ipfs-unixfs": "^4.0.1" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "interface-ipfs-core": "^0.144.2", "ipfs-core": "^0.5.4", "ipfs-message-port-server": "^0.6.3", diff --git a/packages/ipfs-message-port-protocol/package.json b/packages/ipfs-message-port-protocol/package.json index 65bae65635..6d62f77113 100644 --- a/packages/ipfs-message-port-protocol/package.json +++ b/packages/ipfs-message-port-protocol/package.json @@ -51,7 +51,7 @@ "ipld-block": "^0.11.0" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "rimraf": "^3.0.2", "uint8arrays": "^2.1.3" }, diff --git a/packages/ipfs-message-port-server/package.json b/packages/ipfs-message-port-server/package.json index cf37bded06..ff3956fb98 100644 --- a/packages/ipfs-message-port-server/package.json +++ b/packages/ipfs-message-port-server/package.json @@ -43,7 +43,7 @@ "it-all": "^1.0.4" }, "devDependencies": { - "aegir": "^32.1.0", + "aegir": "^33.0.0", "cids": "^1.1.6", "rimraf": "^3.0.2" }, diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index b34c94a801..7effc7859e 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -47,7 +47,7 @@ "devDependencies": { "@types/semver": "^7.3.4", "@types/update-notifier": "^5.0.0", - "aegir": "^32.1.0", + "aegir": "^33.0.0", "assert": "^2.0.0", "cross-env": "^7.0.0", "electron-webrtc": "^0.3.0", @@ -56,13 +56,13 @@ "ipfs-client": "^0.3.4", "ipfs-core-types": "^0.3.1", "ipfs-http-client": "^49.0.4", - "ipfs-interop": "^5.0.0", + "ipfs-interop": "^5.0.1", "ipfs-utils": "^6.0.4", - "ipfsd-ctl": "^8.0.0", + "ipfsd-ctl": "^8.0.1", "iso-url": "^1.0.0", "libp2p-webrtc-star": "^0.21.0", "merge-options": "^3.0.4", - "mock-ipfs-pinning-service": "^0.1.2", + "mock-ipfs-pinning-service": "^0.2.0", "rimraf": "^3.0.2", "url": "^0.11.0", "wrtc": "^0.4.6" From 8282424e62520f45f068916144d10d546b10768e Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 9 Apr 2021 20:34:22 +0100 Subject: [PATCH 03/24] chore: switch to multiaddr named export --- packages/interface-ipfs-core/src/bootstrap/add.js | 2 +- packages/interface-ipfs-core/src/bootstrap/clear.js | 2 +- packages/interface-ipfs-core/src/bootstrap/list.js | 2 +- packages/interface-ipfs-core/src/bootstrap/reset.js | 2 +- packages/interface-ipfs-core/src/bootstrap/rm.js | 2 +- packages/interface-ipfs-core/src/miscellaneous/id.js | 2 +- packages/interface-ipfs-core/src/swarm/addrs.js | 2 +- packages/interface-ipfs-core/src/swarm/peers.js | 2 +- packages/ipfs-cli/src/commands/swarm/peers.js | 4 ++-- packages/ipfs-cli/src/utils.js | 2 +- packages/ipfs-cli/test/bootstrap.js | 4 ++-- packages/ipfs-core-types/src/bootstrap/index.ts | 2 +- packages/ipfs-core-types/src/dht/index.d.ts | 2 +- packages/ipfs-core-types/src/pin/remote/index.d.ts | 2 +- packages/ipfs-core-types/src/root.d.ts | 2 +- packages/ipfs-core-types/src/swarm/index.d.ts | 2 +- packages/ipfs-core-utils/src/to-url-string.js | 8 ++------ packages/ipfs-core/src/components/bootstrap/clear.js | 2 +- packages/ipfs-core/src/components/bootstrap/list.js | 2 +- packages/ipfs-core/src/components/bootstrap/reset.js | 2 +- packages/ipfs-core/src/components/id.js | 8 ++++---- packages/ipfs-core/src/components/network.js | 4 ++-- packages/ipfs-core/src/index.js | 2 +- packages/ipfs-core/test/config.spec.js | 4 ++-- packages/ipfs-core/test/exports.spec.js | 2 +- packages/ipfs-daemon/src/index.js | 4 ++-- packages/ipfs-grpc-client/src/core-api/id.js | 4 ++-- packages/ipfs-grpc-client/src/types.d.ts | 2 +- packages/ipfs-http-client/src/bootstrap/add.js | 2 +- packages/ipfs-http-client/src/bootstrap/clear.js | 2 +- packages/ipfs-http-client/src/bootstrap/list.js | 2 +- packages/ipfs-http-client/src/bootstrap/reset.js | 2 +- packages/ipfs-http-client/src/bootstrap/rm.js | 2 +- packages/ipfs-http-client/src/dht/find-peer.js | 4 ++-- packages/ipfs-http-client/src/dht/find-provs.js | 4 ++-- packages/ipfs-http-client/src/dht/provide.js | 4 ++-- packages/ipfs-http-client/src/dht/put.js | 4 ++-- packages/ipfs-http-client/src/dht/query.js | 4 ++-- packages/ipfs-http-client/src/id.js | 4 ++-- packages/ipfs-http-client/src/index.js | 2 +- packages/ipfs-http-client/src/lib/core.js | 2 +- packages/ipfs-http-client/src/swarm/addrs.js | 4 ++-- packages/ipfs-http-client/src/swarm/localAddrs.js | 4 ++-- packages/ipfs-http-client/src/swarm/peers.js | 4 ++-- packages/ipfs-http-client/src/types.d.ts | 2 +- packages/ipfs-http-client/test/constructor.spec.js | 8 ++++---- packages/ipfs-http-client/test/exports.spec.js | 2 +- packages/ipfs-http-server/src/index.js | 4 ++-- packages/ipfs-http-server/src/utils/joi.js | 4 ++-- 49 files changed, 73 insertions(+), 77 deletions(-) diff --git a/packages/interface-ipfs-core/src/bootstrap/add.js b/packages/interface-ipfs-core/src/bootstrap/add.js index 162483bced..a9ec9e1ef4 100644 --- a/packages/interface-ipfs-core/src/bootstrap/add.js +++ b/packages/interface-ipfs-core/src/bootstrap/add.js @@ -3,7 +3,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const testTimeout = require('../utils/test-timeout') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const invalidArg = 'this/Is/So/Invalid/' const validIp4 = new Multiaddr('/ip4/104.236.176.52/tcp/4001/p2p/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z') diff --git a/packages/interface-ipfs-core/src/bootstrap/clear.js b/packages/interface-ipfs-core/src/bootstrap/clear.js index 374eed4194..f599999503 100644 --- a/packages/interface-ipfs-core/src/bootstrap/clear.js +++ b/packages/interface-ipfs-core/src/bootstrap/clear.js @@ -3,7 +3,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const testTimeout = require('../utils/test-timeout') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** diff --git a/packages/interface-ipfs-core/src/bootstrap/list.js b/packages/interface-ipfs-core/src/bootstrap/list.js index 868b1191b2..72ffa6d7f4 100644 --- a/packages/interface-ipfs-core/src/bootstrap/list.js +++ b/packages/interface-ipfs-core/src/bootstrap/list.js @@ -3,7 +3,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const testTimeout = require('../utils/test-timeout') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** diff --git a/packages/interface-ipfs-core/src/bootstrap/reset.js b/packages/interface-ipfs-core/src/bootstrap/reset.js index fe0c78bd7e..628b8113be 100644 --- a/packages/interface-ipfs-core/src/bootstrap/reset.js +++ b/packages/interface-ipfs-core/src/bootstrap/reset.js @@ -3,7 +3,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const testTimeout = require('../utils/test-timeout') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** diff --git a/packages/interface-ipfs-core/src/bootstrap/rm.js b/packages/interface-ipfs-core/src/bootstrap/rm.js index ec0b5e59a8..51cb08d9de 100644 --- a/packages/interface-ipfs-core/src/bootstrap/rm.js +++ b/packages/interface-ipfs-core/src/bootstrap/rm.js @@ -3,7 +3,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const testTimeout = require('../utils/test-timeout') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** diff --git a/packages/interface-ipfs-core/src/miscellaneous/id.js b/packages/interface-ipfs-core/src/miscellaneous/id.js index edbf65f4c9..feb9d9ef30 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/id.js +++ b/packages/interface-ipfs-core/src/miscellaneous/id.js @@ -2,7 +2,7 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const CID = require('cids') const testTimeout = require('../utils/test-timeout') const { isWebWorker } = require('ipfs-utils/src/env') diff --git a/packages/interface-ipfs-core/src/swarm/addrs.js b/packages/interface-ipfs-core/src/swarm/addrs.js index d6d2889004..372a628642 100644 --- a/packages/interface-ipfs-core/src/swarm/addrs.js +++ b/packages/interface-ipfs-core/src/swarm/addrs.js @@ -2,7 +2,7 @@ 'use strict' const CID = require('cids') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const { getDescribe, getIt, expect } = require('../utils/mocha') const { isWebWorker } = require('ipfs-utils/src/env') const testTimeout = require('../utils/test-timeout') diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index ad36c7c623..4f8881080c 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -1,7 +1,7 @@ /* eslint-env mocha */ 'use strict' -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const CID = require('cids') const delay = require('delay') const { isBrowser, isWebWorker } = require('ipfs-utils/src/env') diff --git a/packages/ipfs-cli/src/commands/swarm/peers.js b/packages/ipfs-cli/src/commands/swarm/peers.js index bf438a3fb1..b192083642 100644 --- a/packages/ipfs-cli/src/commands/swarm/peers.js +++ b/packages/ipfs-cli/src/commands/swarm/peers.js @@ -1,7 +1,7 @@ 'use strict' const mafmt = require('mafmt') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const { default: parseDuration } = require('parse-duration') module.exports = { @@ -31,7 +31,7 @@ module.exports = { }) result.forEach((item) => { - let ma = multiaddr(`${item.addr}`) + let ma = new Multiaddr(`${item.addr}`) if (!mafmt.IPFS.matches(ma)) { ma = ma.encapsulate(`/ipfs/${item.peer}`) diff --git a/packages/ipfs-cli/src/utils.js b/packages/ipfs-cli/src/utils.js index 066a14c256..74702bd2a2 100644 --- a/packages/ipfs-cli/src/utils.js +++ b/packages/ipfs-cli/src/utils.js @@ -9,7 +9,7 @@ const Progress = require('progress') const byteman = require('byteman') const IPFS = require('ipfs-core') const CID = require('cids') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const { cidToString } = require('ipfs-core-utils/src/cid') const uint8ArrayFromString = require('uint8arrays/from-string') diff --git a/packages/ipfs-cli/test/bootstrap.js b/packages/ipfs-cli/test/bootstrap.js index e0bba5cf00..b240b8b055 100644 --- a/packages/ipfs-cli/test/bootstrap.js +++ b/packages/ipfs-cli/test/bootstrap.js @@ -4,10 +4,10 @@ const { expect } = require('aegir/utils/chai') const cli = require('./utils/cli') const sinon = require('sinon') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') describe('bootstrap', () => { - const peer = multiaddr('/ip4/111.111.111.111/tcp/1001/p2p/QmcyFFKfLDGJKwufn2GeitxvhricsBQyNKTkrD14psikoD') + const peer = new Multiaddr('/ip4/111.111.111.111/tcp/1001/p2p/QmcyFFKfLDGJKwufn2GeitxvhricsBQyNKTkrD14psikoD') let ipfs before(() => { diff --git a/packages/ipfs-core-types/src/bootstrap/index.ts b/packages/ipfs-core-types/src/bootstrap/index.ts index b9be74e76e..cc2c0a6257 100644 --- a/packages/ipfs-core-types/src/bootstrap/index.ts +++ b/packages/ipfs-core-types/src/bootstrap/index.ts @@ -1,5 +1,5 @@ import type { AbortOptions } from '../utils' -import type Multiaddr from 'multiaddr' +import type { Multiaddr } from 'multiaddr' export interface API { /** diff --git a/packages/ipfs-core-types/src/dht/index.d.ts b/packages/ipfs-core-types/src/dht/index.d.ts index 1e1db25d50..00c4aeaea1 100644 --- a/packages/ipfs-core-types/src/dht/index.d.ts +++ b/packages/ipfs-core-types/src/dht/index.d.ts @@ -1,5 +1,5 @@ import type { AbortOptions } from '../utils' -import type Multiaddr from 'multiaddr' +import type { Multiaddr } from 'multiaddr' import type CID from 'cids' export interface API { diff --git a/packages/ipfs-core-types/src/pin/remote/index.d.ts b/packages/ipfs-core-types/src/pin/remote/index.d.ts index 5fe9265b04..63395c350a 100644 --- a/packages/ipfs-core-types/src/pin/remote/index.d.ts +++ b/packages/ipfs-core-types/src/pin/remote/index.d.ts @@ -1,5 +1,5 @@ import CID from 'cids' -import Multiaddr from 'multiaddr' +import { Multiaddr } from 'multiaddr' import { API as Service } from './service' import { AbortOptions } from '../../utils' diff --git a/packages/ipfs-core-types/src/root.d.ts b/packages/ipfs-core-types/src/root.d.ts index f6293a6374..dba7e3e22f 100644 --- a/packages/ipfs-core-types/src/root.d.ts +++ b/packages/ipfs-core-types/src/root.d.ts @@ -1,7 +1,7 @@ import { AbortOptions, PreloadOptions, IPFSPath, ImportSource, ToEntry } from './utils' import CID, { CIDVersion } from 'cids' import { Mtime } from 'ipfs-unixfs' -import Multiaddr from 'multiaddr' +import { Multiaddr } from 'multiaddr' import { BaseName } from 'multibase' export interface API { diff --git a/packages/ipfs-core-types/src/swarm/index.d.ts b/packages/ipfs-core-types/src/swarm/index.d.ts index ea2508f2bd..69b1ba872b 100644 --- a/packages/ipfs-core-types/src/swarm/index.d.ts +++ b/packages/ipfs-core-types/src/swarm/index.d.ts @@ -2,7 +2,7 @@ import type { AbortOptions } from '../utils' import { API as BitswapAPI } from '../bitswap' import { API as RepoAPI } from '../repo' import type CID from 'cids' -import type Multiaddr from 'multiaddr' +import type { Multiaddr } from 'multiaddr' export interface API { /** diff --git a/packages/ipfs-core-utils/src/to-url-string.js b/packages/ipfs-core-utils/src/to-url-string.js index 877b1f5a0c..198175828a 100644 --- a/packages/ipfs-core-utils/src/to-url-string.js +++ b/packages/ipfs-core-utils/src/to-url-string.js @@ -1,6 +1,6 @@ 'use strict' -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') // @ts-ignore no types const multiAddrToUri = require('multiaddr-to-uri') @@ -11,14 +11,10 @@ const multiAddrToUri = require('multiaddr-to-uri') module.exports = (url) => { try { // @ts-expect-error - url = multiAddrToUri(multiaddr(url)) + url = multiAddrToUri(new Multiaddr(url)) } catch (err) { } url = url.toString() return url } - -/** - * @typedef {import('multiaddr')} Multiaddr - */ diff --git a/packages/ipfs-core/src/components/bootstrap/clear.js b/packages/ipfs-core/src/components/bootstrap/clear.js index f4a8e672a9..eea3666444 100644 --- a/packages/ipfs-core/src/components/bootstrap/clear.js +++ b/packages/ipfs-core/src/components/bootstrap/clear.js @@ -1,7 +1,7 @@ 'use strict' const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @param {Object} config diff --git a/packages/ipfs-core/src/components/bootstrap/list.js b/packages/ipfs-core/src/components/bootstrap/list.js index 3bd9d3c06f..4501a38aec 100644 --- a/packages/ipfs-core/src/components/bootstrap/list.js +++ b/packages/ipfs-core/src/components/bootstrap/list.js @@ -1,7 +1,7 @@ 'use strict' const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @param {Object} config diff --git a/packages/ipfs-core/src/components/bootstrap/reset.js b/packages/ipfs-core/src/components/bootstrap/reset.js index c1bcf951b5..f8d1a134bd 100644 --- a/packages/ipfs-core/src/components/bootstrap/reset.js +++ b/packages/ipfs-core/src/components/bootstrap/reset.js @@ -2,7 +2,7 @@ const defaultConfig = require('../../runtime/config-nodejs.js') const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @param {Object} config diff --git a/packages/ipfs-core/src/components/id.js b/packages/ipfs-core/src/components/id.js index 88a94ff3ec..e4ad10338b 100644 --- a/packages/ipfs-core/src/components/id.js +++ b/packages/ipfs-core/src/components/id.js @@ -1,7 +1,7 @@ 'use strict' const pkgversion = require('../../package.json').version -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') const uint8ArrayToString = require('uint8arrays/to-string') @@ -16,7 +16,7 @@ module.exports = ({ peerId, network }) => { */ async function id (_options = {}) { // eslint-disable-line require-await const id = peerId.toB58String() - /** @type {import('multiaddr')[]} */ + /** @type {Multiaddr[]} */ let addresses = [] /** @type {string[]} */ let protocols = [] @@ -46,7 +46,7 @@ module.exports = ({ peerId, network }) => { return `${str}/p2p/${id}` }) .sort() - .map(ma => multiaddr(ma)), + .map(ma => new Multiaddr(ma)), agentVersion: `js-ipfs/${pkgversion}`, protocolVersion: '9000', protocols: protocols.sort() @@ -60,7 +60,7 @@ module.exports = ({ peerId, network }) => { * The Peer identity * @property {string} id - the Peer ID * @property {string} publicKey - the public key of the peer as a base64 encoded string - * @property {import('multiaddr')[]} addresses - A list of multiaddrs this node is listening on + * @property {Multiaddr[]} addresses - A list of multiaddrs this node is listening on * @property {string} agentVersion - The agent version * @property {string} protocolVersion - The supported protocol version * @property {string[]} protocols - The supported protocols diff --git a/packages/ipfs-core/src/components/network.js b/packages/ipfs-core/src/components/network.js index a1a940bf70..2690726920 100644 --- a/packages/ipfs-core/src/components/network.js +++ b/packages/ipfs-core/src/components/network.js @@ -2,7 +2,7 @@ const IPFSBitswap = require('ipfs-bitswap') const createLibP2P = require('./libp2p') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const errCode = require('err-code') /** @@ -101,7 +101,7 @@ const readAddrs = (peerId, config) => { const addrs = [] const swarm = (config.Addresses && config.Addresses.Swarm) || [] for (const addr of swarm) { - let ma = Multiaddr(addr) + let ma = new Multiaddr(addr) // Temporary error for users migrating using websocket-star multiaddrs for listenning on libp2p // websocket-star support was removed from ipfs and libp2p diff --git a/packages/ipfs-core/src/index.js b/packages/ipfs-core/src/index.js index d437622a81..02dd242be5 100644 --- a/packages/ipfs-core/src/index.js +++ b/packages/ipfs-core/src/index.js @@ -5,7 +5,7 @@ const urlSource = require('ipfs-utils/src/files/url-source') const PeerId = require('peer-id') const crypto = require('libp2p-crypto') const isIPFS = require('is-ipfs') -const multiaddr = require('multiaddr') +const { multiaddr } = require('multiaddr') const multibase = require('multibase') const multicodec = require('multicodec') const multihashing = require('multihashing-async') diff --git a/packages/ipfs-core/test/config.spec.js b/packages/ipfs-core/test/config.spec.js index df41bf2e43..3bd9196694 100644 --- a/packages/ipfs-core/test/config.spec.js +++ b/packages/ipfs-core/test/config.spec.js @@ -3,7 +3,7 @@ 'use strict' const { expect } = require('aegir/utils/chai') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const { isBrowser, isWebWorker } = require('ipfs-utils/src/env') const createNode = require('./utils/create-node') const bootstrapList = require('../src/runtime/config-nodejs.js')().Bootstrap @@ -36,7 +36,7 @@ describe('config', function () { return acc } - const ma = multiaddr(curr) + const ma = new Multiaddr(curr) return ma.protos().some(proto => proto.name === 'wss' || proto.resolvable) }, true) diff --git a/packages/ipfs-core/test/exports.spec.js b/packages/ipfs-core/test/exports.spec.js index f0be187418..57834aec43 100644 --- a/packages/ipfs-core/test/exports.spec.js +++ b/packages/ipfs-core/test/exports.spec.js @@ -4,7 +4,7 @@ const crypto = require('libp2p-crypto') const isIPFS = require('is-ipfs') const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const multibase = require('multibase') const multihashing = require('multihashing-async') const multihash = multihashing.multihash diff --git a/packages/ipfs-daemon/src/index.js b/packages/ipfs-daemon/src/index.js index f0afad9dfd..44c33dee30 100644 --- a/packages/ipfs-daemon/src/index.js +++ b/packages/ipfs-daemon/src/index.js @@ -3,7 +3,7 @@ const log = require('debug')('ipfs:daemon') const get = require('dlv') const set = require('just-safe-set') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') // @ts-ignore - no types const WebRTCStar = require('libp2p-webrtc-star') // @ts-ignore - no types @@ -128,7 +128,7 @@ function getLibp2p ({ libp2pOptions, options, config, peerId }) { if (delegateHosts.length > 0) { // Pick a random delegate host const delegateString = delegateHosts[Math.floor(Math.random() * delegateHosts.length)] - const delegateAddr = Multiaddr(delegateString).toOptions() + const delegateAddr = new Multiaddr(delegateString).toOptions() const delegateApiOptions = { host: delegateAddr.host, // port is a string atm, so we need to convert for the check diff --git a/packages/ipfs-grpc-client/src/core-api/id.js b/packages/ipfs-grpc-client/src/core-api/id.js index 185bbd9d31..6396858131 100644 --- a/packages/ipfs-grpc-client/src/core-api/id.js +++ b/packages/ipfs-grpc-client/src/core-api/id.js @@ -3,7 +3,7 @@ const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') const toHeaders = require('../utils/to-headers') const unaryToPromise = require('../utils/unary-to-promise') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @param {import('@improbable-eng/grpc-web').grpc} grpc @@ -25,7 +25,7 @@ module.exports = function grpcId (grpc, service, opts) { return { ...res, - addresses: (res.addresses || []).map(multiaddr) + addresses: (res.addresses || []).map((/** @type {string} */ str) => new Multiaddr(str)) } } diff --git a/packages/ipfs-grpc-client/src/types.d.ts b/packages/ipfs-grpc-client/src/types.d.ts index 866850b41d..082c6da0fc 100644 --- a/packages/ipfs-grpc-client/src/types.d.ts +++ b/packages/ipfs-grpc-client/src/types.d.ts @@ -1,6 +1,6 @@ import { agent as HttpAgent } from 'http' import { agent as HttpsAgent } from 'https' -import Multiaddr from 'multiaddr' +import { Multiaddr } from 'multiaddr' export interface Options { url: string | URL | Multiaddr diff --git a/packages/ipfs-http-client/src/bootstrap/add.js b/packages/ipfs-http-client/src/bootstrap/add.js index 35afcc4bfe..6caa170a85 100644 --- a/packages/ipfs-http-client/src/bootstrap/add.js +++ b/packages/ipfs-http-client/src/bootstrap/add.js @@ -2,7 +2,7 @@ const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions diff --git a/packages/ipfs-http-client/src/bootstrap/clear.js b/packages/ipfs-http-client/src/bootstrap/clear.js index 930b258bcb..26355bbb55 100644 --- a/packages/ipfs-http-client/src/bootstrap/clear.js +++ b/packages/ipfs-http-client/src/bootstrap/clear.js @@ -2,7 +2,7 @@ const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions diff --git a/packages/ipfs-http-client/src/bootstrap/list.js b/packages/ipfs-http-client/src/bootstrap/list.js index 9c0ac38d78..aad38554b1 100644 --- a/packages/ipfs-http-client/src/bootstrap/list.js +++ b/packages/ipfs-http-client/src/bootstrap/list.js @@ -2,7 +2,7 @@ const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions diff --git a/packages/ipfs-http-client/src/bootstrap/reset.js b/packages/ipfs-http-client/src/bootstrap/reset.js index 2959a53855..b958d78700 100644 --- a/packages/ipfs-http-client/src/bootstrap/reset.js +++ b/packages/ipfs-http-client/src/bootstrap/reset.js @@ -2,7 +2,7 @@ const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions diff --git a/packages/ipfs-http-client/src/bootstrap/rm.js b/packages/ipfs-http-client/src/bootstrap/rm.js index f09c15cb89..13cea8dbe0 100644 --- a/packages/ipfs-http-client/src/bootstrap/rm.js +++ b/packages/ipfs-http-client/src/bootstrap/rm.js @@ -2,7 +2,7 @@ const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @typedef {import('../types').HTTPClientExtraOptions} HTTPClientExtraOptions diff --git a/packages/ipfs-http-client/src/dht/find-peer.js b/packages/ipfs-http-client/src/dht/find-peer.js index 6a70e9cc44..f4eabe5370 100644 --- a/packages/ipfs-http-client/src/dht/find-peer.js +++ b/packages/ipfs-http-client/src/dht/find-peer.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') const { FinalPeer } = require('./response-types') @@ -31,7 +31,7 @@ module.exports = configure(api => { const { ID, Addrs } = data.Responses[0] return { id: ID, - addrs: (Addrs || []).map((/** @type {string} **/ a) => multiaddr(a)) + addrs: (Addrs || []).map((/** @type {string} **/ a) => new Multiaddr(a)) } } } diff --git a/packages/ipfs-http-client/src/dht/find-provs.js b/packages/ipfs-http-client/src/dht/find-provs.js index c5175a6cd9..c431648ae6 100644 --- a/packages/ipfs-http-client/src/dht/find-provs.js +++ b/packages/ipfs-http-client/src/dht/find-provs.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') const { Provider } = require('./response-types') @@ -31,7 +31,7 @@ module.exports = configure(api => { for (const { ID, Addrs } of message.Responses) { yield { id: ID, - addrs: (Addrs || []).map((/** @type {string} **/ a) => multiaddr(a)) + addrs: (Addrs || []).map((/** @type {string} **/ a) => new Multiaddr(a)) } } } diff --git a/packages/ipfs-http-client/src/dht/provide.js b/packages/ipfs-http-client/src/dht/provide.js index 9ef17a394c..878880398f 100644 --- a/packages/ipfs-http-client/src/dht/provide.js +++ b/packages/ipfs-http-client/src/dht/provide.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const toCamel = require('../lib/object-to-camel') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') @@ -34,7 +34,7 @@ module.exports = configure(api => { if (message.responses) { message.responses = message.responses.map((/** @type {{ ID: string, Addrs: string[] }} */ { ID, Addrs }) => ({ id: ID, - addrs: (Addrs || []).map((/** @type {string} **/ a) => multiaddr(a)) + addrs: (Addrs || []).map((/** @type {string} **/ a) => new Multiaddr(a)) })) } else { message.responses = [] diff --git a/packages/ipfs-http-client/src/dht/put.js b/packages/ipfs-http-client/src/dht/put.js index 949bc3f446..d2b88aa89a 100644 --- a/packages/ipfs-http-client/src/dht/put.js +++ b/packages/ipfs-http-client/src/dht/put.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const toCamel = require('../lib/object-to-camel') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') @@ -42,7 +42,7 @@ module.exports = configure(api => { if (message.responses) { message.responses = message.responses.map((/** @type {{ ID: string, Addrs: string[] }} */ { ID, Addrs }) => ({ id: ID, - addrs: (Addrs || []).map(a => multiaddr(a)) + addrs: (Addrs || []).map(a => new Multiaddr(a)) })) } yield message diff --git a/packages/ipfs-http-client/src/dht/query.js b/packages/ipfs-http-client/src/dht/query.js index 4193970f9e..429f487ef2 100644 --- a/packages/ipfs-http-client/src/dht/query.js +++ b/packages/ipfs-http-client/src/dht/query.js @@ -1,7 +1,7 @@ 'use strict' const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const toCamel = require('../lib/object-to-camel') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') @@ -31,7 +31,7 @@ module.exports = configure(api => { message.id = new CID(message.id) message.responses = (message.responses || []).map((/** @type {{ ID: string, Addrs: string[] }} */ { ID, Addrs }) => ({ id: ID, - addrs: (Addrs || []).map((/** @type {string} **/ a) => multiaddr(a)) + addrs: (Addrs || []).map((/** @type {string} **/ a) => new Multiaddr(a)) })) yield message } diff --git a/packages/ipfs-http-client/src/id.js b/packages/ipfs-http-client/src/id.js index c7d19610ed..6b9c439d5b 100644 --- a/packages/ipfs-http-client/src/id.js +++ b/packages/ipfs-http-client/src/id.js @@ -1,7 +1,7 @@ 'use strict' const toCamel = require('./lib/object-to-camel') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const configure = require('./lib/configure') const toUrlSearchParams = require('./lib/to-url-search-params') @@ -28,7 +28,7 @@ module.exports = configure(api => { } if (output.addresses) { - output.addresses = output.addresses.map((/** @type {string} */ ma) => multiaddr(ma)) + output.addresses = output.addresses.map((/** @type {string} */ ma) => new Multiaddr(ma)) } // @ts-ignore server output is not typed diff --git a/packages/ipfs-http-client/src/index.js b/packages/ipfs-http-client/src/index.js index 5172ceec27..c9c9551b29 100644 --- a/packages/ipfs-http-client/src/index.js +++ b/packages/ipfs-http-client/src/index.js @@ -2,7 +2,7 @@ /* eslint-env browser */ const CID = require('cids') -const multiaddr = require('multiaddr') +const { multiaddr } = require('multiaddr') const multibase = require('multibase') const multicodec = require('multicodec') const multihash = require('multihashes') diff --git a/packages/ipfs-http-client/src/lib/core.js b/packages/ipfs-http-client/src/lib/core.js index 2aafe8149c..eb1340716a 100644 --- a/packages/ipfs-http-client/src/lib/core.js +++ b/packages/ipfs-http-client/src/lib/core.js @@ -1,6 +1,6 @@ 'use strict' /* eslint-env browser */ -const Multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const { isBrowser, isWebWorker, isNode } = require('ipfs-utils/src/env') const { default: parseDuration } = require('parse-duration') const log = require('debug')('ipfs-http-client:lib:error-handler') diff --git a/packages/ipfs-http-client/src/swarm/addrs.js b/packages/ipfs-http-client/src/swarm/addrs.js index acd0242556..e0880e5549 100644 --- a/packages/ipfs-http-client/src/swarm/addrs.js +++ b/packages/ipfs-http-client/src/swarm/addrs.js @@ -1,6 +1,6 @@ 'use strict' -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') @@ -26,7 +26,7 @@ module.exports = configure(api => { return Object.keys(Addrs).map(id => ({ id, - addrs: (Addrs[id] || []).map(a => multiaddr(a)) + addrs: (Addrs[id] || []).map(a => new Multiaddr(a)) })) } return addrs diff --git a/packages/ipfs-http-client/src/swarm/localAddrs.js b/packages/ipfs-http-client/src/swarm/localAddrs.js index 55f3927b1e..c1b3ae91bd 100644 --- a/packages/ipfs-http-client/src/swarm/localAddrs.js +++ b/packages/ipfs-http-client/src/swarm/localAddrs.js @@ -1,6 +1,6 @@ 'use strict' -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') @@ -24,7 +24,7 @@ module.exports = configure(api => { /** @type {{ Strings: string[] }} */ const { Strings } = await res.json() - return (Strings || []).map(a => multiaddr(a)) + return (Strings || []).map(a => new Multiaddr(a)) } return localAddrs }) diff --git a/packages/ipfs-http-client/src/swarm/peers.js b/packages/ipfs-http-client/src/swarm/peers.js index e85bbb3b08..cb68ac5c5b 100644 --- a/packages/ipfs-http-client/src/swarm/peers.js +++ b/packages/ipfs-http-client/src/swarm/peers.js @@ -1,6 +1,6 @@ 'use strict' -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const configure = require('../lib/configure') const toUrlSearchParams = require('../lib/to-url-search-params') @@ -26,7 +26,7 @@ module.exports = configure(api => { return (Peers || []).map(peer => { return { - addr: multiaddr(peer.Addr), + addr: new Multiaddr(peer.Addr), peer: peer.Peer, muxer: peer.Muxer, latency: peer.Latency, diff --git a/packages/ipfs-http-client/src/types.d.ts b/packages/ipfs-http-client/src/types.d.ts index 037fa68b01..b6d9e45527 100644 --- a/packages/ipfs-http-client/src/types.d.ts +++ b/packages/ipfs-http-client/src/types.d.ts @@ -2,7 +2,7 @@ import { Format as IPLDFormat } from 'interface-ipld-format' import { LoadFormatFn } from 'ipld' import { Agent as HttpAgent } from 'http' import { Agent as HttpsAgent } from 'https' -import Multiaddr from 'multiaddr' +import { Multiaddr } from 'multiaddr' export interface Options { host?: string diff --git a/packages/ipfs-http-client/test/constructor.spec.js b/packages/ipfs-http-client/test/constructor.spec.js index 1c74af9c61..c1f4a7f7ca 100644 --- a/packages/ipfs-http-client/test/constructor.spec.js +++ b/packages/ipfs-http-client/test/constructor.spec.js @@ -1,7 +1,7 @@ /* eslint-env mocha, browser */ 'use strict' -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const { expect } = require('aegir/utils/chai') const f = require('./utils/factory')() const { create: ipfsClient } = require('../src/index.js') @@ -75,7 +75,7 @@ describe('ipfs-http-client constructor tests', () => { it('multiaddr instance', () => { const host = 'ace.place' const port = '1001' - const addr = multiaddr(`/dns4/${host}/tcp/${port}`) + const addr = new Multiaddr(`/dns4/${host}/tcp/${port}`) const ipfs = ipfsClient(addr) expectConfig(ipfs, { host, port }) }) @@ -132,7 +132,7 @@ describe('ipfs-http-client constructor tests', () => { const port = '1001' const protocol = 'http' // default to http if not specified in multiaddr const addr = `/dns4/${host}/tcp/${port}` - const ipfs = ipfsClient({ url: multiaddr(addr) }) + const ipfs = ipfsClient({ url: new Multiaddr(addr) }) expectConfig(ipfs, { host, port, protocol }) }) @@ -141,7 +141,7 @@ describe('ipfs-http-client constructor tests', () => { const port = '1001' const protocol = 'https' const addr = `/dns4/${host}/tcp/${port}/https` - const ipfs = ipfsClient({ url: multiaddr(addr) }) + const ipfs = ipfsClient({ url: new Multiaddr(addr) }) expectConfig(ipfs, { host, port, protocol }) }) diff --git a/packages/ipfs-http-client/test/exports.spec.js b/packages/ipfs-http-client/test/exports.spec.js index 1cc99c946f..5ec4c9c336 100644 --- a/packages/ipfs-http-client/test/exports.spec.js +++ b/packages/ipfs-http-client/test/exports.spec.js @@ -2,7 +2,7 @@ 'use strict' const CID = require('cids') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const multibase = require('multibase') const multicodec = require('multicodec') const multihash = require('multihashes') diff --git a/packages/ipfs-http-server/src/index.js b/packages/ipfs-http-server/src/index.js index 30f1805ff1..fb0d99f8c7 100644 --- a/packages/ipfs-http-server/src/index.js +++ b/packages/ipfs-http-server/src/index.js @@ -3,7 +3,7 @@ const Hapi = require('@hapi/hapi') const Pino = require('hapi-pino') const debug = require('debug') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') // @ts-ignore no types const toMultiaddr = require('uri-to-multiaddr') const Boom = require('@hapi/boom') @@ -228,7 +228,7 @@ class HttpApi { if (!this._apiServers || !this._apiServers.length) { throw new Error('API address unavailable - server is not started') } - return multiaddr('/ip4/127.0.0.1/tcp/' + this._apiServers[0].info.port) + return new Multiaddr('/ip4/127.0.0.1/tcp/' + this._apiServers[0].info.port) } async stop () { diff --git a/packages/ipfs-http-server/src/utils/joi.js b/packages/ipfs-http-server/src/utils/joi.js index 2db2dcf281..9488068fb5 100644 --- a/packages/ipfs-http-server/src/utils/joi.js +++ b/packages/ipfs-http-server/src/utils/joi.js @@ -3,7 +3,7 @@ const Joi = require('joi') const CID = require('cids') const { default: parseDuration } = require('parse-duration') -const multiaddr = require('multiaddr') +const { Multiaddr } = require('multiaddr') const multibase = require('multibase') const toCidAndPath = require('ipfs-core-utils/src/to-cid-and-path') @@ -95,7 +95,7 @@ module.exports = Joi return } - return { value: multiaddr(value).toString() } + return { value: new Multiaddr(value).toString() } } } }, From f780d96158748956f5f6daecaea659d304a88f93 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 12 Apr 2021 15:19:55 +0100 Subject: [PATCH 04/24] chore: update more deps --- packages/ipfs-cli/package.json | 2 +- packages/ipfs-core/package.json | 2 +- packages/ipfs-daemon/package.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index 945e9f49a7..2df0582c75 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -53,7 +53,7 @@ "it-pipe": "^1.1.0", "jsondiffpatch": "^0.4.1", "libp2p-crypto": "^0.19.0", - "mafmt": "^8.0.0", + "mafmt": "^9.0.0", "multiaddr": "^9.0.1", "multiaddr-to-uri": "^6.0.0", "multibase": "^4.0.2", diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 732ca77d4c..bef6b9335a 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -106,7 +106,7 @@ "libp2p-tcp": "^0.15.1", "libp2p-webrtc-star": "^0.21.0", "libp2p-websockets": "^0.15.1", - "mafmt": "^8.0.0", + "mafmt": "^9.0.0", "merge-options": "^3.0.4", "mortice": "^2.0.0", "multiaddr": "^9.0.1", diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index a60db65ef7..cc128b16b4 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -41,8 +41,8 @@ "ipfs-utils": "^6.0.4", "just-safe-set": "^2.1.0", "libp2p": "^0.30.12", - "libp2p-delegated-content-routing": "^0.9.0", - "libp2p-delegated-peer-routing": "^0.8.0", + "libp2p-delegated-content-routing": "^0.10.0", + "libp2p-delegated-peer-routing": "^0.9.0", "libp2p-webrtc-star": "^0.21.0", "multiaddr": "^9.0.1" }, From c6381a4b9d84555beca3028102a7ebd5ba5e105e Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 16 Apr 2021 16:25:08 +0100 Subject: [PATCH 05/24] chore: update types --- examples/browser-exchange-files/package.json | 2 +- examples/circuit-relaying/package.json | 2 +- examples/custom-ipfs-repo/package.json | 4 +- examples/custom-libp2p/package.json | 12 ++--- packages/interface-ipfs-core/package.json | 6 +-- packages/ipfs-cli/package.json | 11 ++-- packages/ipfs-cli/src/commands/add.js | 4 +- .../ipfs-cli/src/commands/bootstrap/add.js | 2 +- .../ipfs-cli/src/commands/bootstrap/rm.js | 2 +- .../ipfs-cli/src/commands/swarm/connect.js | 2 +- .../ipfs-cli/src/commands/swarm/disconnect.js | 2 +- packages/ipfs-cli/test/swarm.js | 18 +++---- packages/ipfs-client/src/index.js | 2 +- .../ipfs-core-types/src/config/index.d.ts | 34 ++++++++---- packages/ipfs-core-types/src/utils.d.ts | 54 +++++++++++++++++++ packages/ipfs-core-utils/package.json | 2 +- packages/ipfs-core/package.json | 35 ++++++------ packages/ipfs-core/src/components/config.js | 49 ++++++++--------- packages/ipfs-core/src/components/libp2p.js | 2 +- packages/ipfs-core/src/components/repo/gc.js | 2 +- packages/ipfs-daemon/package.json | 6 +-- .../src/utils/web-socket-server.js | 10 ++-- packages/ipfs-http-client/package.json | 2 +- packages/ipfs-http-gateway/src/index.js | 4 +- packages/ipfs-http-server/package.json | 3 +- .../ipfs-http-server/src/api/resources/dht.js | 2 +- packages/ipfs/package.json | 4 +- 27 files changed, 174 insertions(+), 104 deletions(-) diff --git a/examples/browser-exchange-files/package.json b/examples/browser-exchange-files/package.json index 2190012a42..67fe48e18e 100644 --- a/examples/browser-exchange-files/package.json +++ b/examples/browser-exchange-files/package.json @@ -20,7 +20,7 @@ "dependencies": { "ipfs": "^0.54.4", "it-all": "^1.0.4", - "libp2p-websockets": "^0.15.1", + "libp2p-websockets": "^0.15.5", "rimraf": "^3.0.2", "test-ipfs-example": "^3.0.0" } diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json index fcc17438f6..65f2b774e4 100644 --- a/examples/circuit-relaying/package.json +++ b/examples/circuit-relaying/package.json @@ -17,7 +17,7 @@ "delay": "^5.0.0", "ipfs": "^0.54.4", "ipfs-pubsub-room": "^2.0.1", - "libp2p-websockets": "^0.15.1", + "libp2p-websockets": "^0.15.5", "uint8arrays": "^2.1.3" }, "devDependencies": { diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json index 73aa60fb02..058fb84ade 100644 --- a/examples/custom-ipfs-repo/package.json +++ b/examples/custom-ipfs-repo/package.json @@ -10,9 +10,9 @@ }, "license": "MIT", "dependencies": { - "datastore-fs": "^3.0.1", + "datastore-fs": "4.0.0", "ipfs": "^0.54.4", - "ipfs-repo": "^9.0.0", + "ipfs-repo": "^9.1.0", "it-all": "^1.0.4" }, "devDependencies": { diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index 1c0095b8e2..c648d60a2a 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -11,13 +11,13 @@ "license": "MIT", "dependencies": { "ipfs": "^0.54.4", - "libp2p": "^0.30.12", - "libp2p-bootstrap": "^0.12.1", + "libp2p": "0.31.0-rc.2", + "libp2p-bootstrap": "^0.12.3", "libp2p-kad-dht": "^0.21.0", - "libp2p-mdns": "^0.15.0", - "libp2p-mplex": "^0.10.0", - "libp2p-noise": "^2.0.1", - "libp2p-tcp": "^0.15.1" + "libp2p-mdns": "^0.16.0", + "libp2p-mplex": "^0.10.2", + "libp2p-noise": "^2.0.5", + "libp2p-tcp": "^0.15.4" }, "devDependencies": { "execa": "^5.0.0", diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index bbe8cd91ba..25514d56ba 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -56,14 +56,14 @@ "iso-random-stream": "^2.0.0", "it-all": "^1.0.4", "it-buffer-stream": "^2.0.0", - "it-concat": "^1.0.3", + "it-concat": "^2.0.0", "it-drain": "^1.0.3", "it-first": "^1.0.4", "it-last": "^1.0.4", "it-map": "^1.0.4", "it-pushable": "^1.4.0", - "libp2p-crypto": "^0.19.0", - "libp2p-websockets": "^0.15.1", + "libp2p-crypto": "^0.19.3", + "libp2p-websockets": "^0.15.5", "multiaddr": "^9.0.1", "multibase": "^4.0.2", "multihashing-async": "^2.1.2", diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index 2df0582c75..d15cc7c0a9 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -36,26 +36,26 @@ "debug": "^4.1.1", "err-code": "^3.0.1", "execa": "^5.0.0", - "get-folder-size": "^2.0.1", + "get-folder-size": "^3.0.0", "ipfs-core": "^0.5.4", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", "ipfs-daemon": "^0.5.4", "ipfs-http-client": "^49.0.4", - "ipfs-repo": "^9.0.0", + "ipfs-repo": "^9.1.0", "ipfs-utils": "^6.0.4", "ipld-dag-cbor": "^0.18.0", "ipld-dag-pb": "^0.22.1", "it-all": "^1.0.4", - "it-concat": "^1.0.3", + "it-concat": "^2.0.0", "it-first": "^1.0.4", "it-glob": "0.0.11", "it-pipe": "^1.1.0", "jsondiffpatch": "^0.4.1", - "libp2p-crypto": "^0.19.0", + "libp2p-crypto": "^0.19.3", "mafmt": "^9.0.0", "multiaddr": "^9.0.1", - "multiaddr-to-uri": "^6.0.0", + "multiaddr-to-uri": "^7.0.0", "multibase": "^4.0.2", "multihashing-async": "^2.1.2", "parse-duration": "^1.0.0", @@ -67,7 +67,6 @@ "yargs": "^16.0.3" }, "devDependencies": { - "@types/get-folder-size": "^2.0.0", "@types/progress": "^2.0.3", "@types/yargs": "^16.0.0", "aegir": "^33.0.0", diff --git a/packages/ipfs-cli/src/commands/add.js b/packages/ipfs-cli/src/commands/add.js index f3672910a3..4a73cc5111 100644 --- a/packages/ipfs-cli/src/commands/add.js +++ b/packages/ipfs-cli/src/commands/add.js @@ -1,8 +1,8 @@ /* eslint-disable complexity */ 'use strict' -const { promisify } = require('util') -const getFolderSize = promisify(require('get-folder-size')) +// @ts-ignore no types +const getFolderSize = require('get-folder-size') // @ts-ignore no types const byteman = require('byteman') const mh = require('multihashing-async').multihash diff --git a/packages/ipfs-cli/src/commands/bootstrap/add.js b/packages/ipfs-cli/src/commands/bootstrap/add.js index bfc97b9fb5..dade7eb41a 100644 --- a/packages/ipfs-cli/src/commands/bootstrap/add.js +++ b/packages/ipfs-cli/src/commands/bootstrap/add.js @@ -27,7 +27,7 @@ module.exports = { /** * @param {object} argv * @param {import('../../types').Context} argv.ctx - * @param {import('multiaddr')} argv.peer + * @param {import('multiaddr').Multiaddr} argv.peer * @param {boolean} argv.default * @param {number} argv.timeout */ diff --git a/packages/ipfs-cli/src/commands/bootstrap/rm.js b/packages/ipfs-cli/src/commands/bootstrap/rm.js index 27bb6b73d2..3756fb6aee 100644 --- a/packages/ipfs-cli/src/commands/bootstrap/rm.js +++ b/packages/ipfs-cli/src/commands/bootstrap/rm.js @@ -27,7 +27,7 @@ module.exports = { /** * @param {object} argv * @param {import('../../types').Context} argv.ctx - * @param {import('multiaddr')} argv.peer + * @param {import('multiaddr').Multiaddr} argv.peer * @param {boolean} argv.all * @param {number} argv.timeout */ diff --git a/packages/ipfs-cli/src/commands/swarm/connect.js b/packages/ipfs-cli/src/commands/swarm/connect.js index 23a22ccb75..7460254fa5 100644 --- a/packages/ipfs-cli/src/commands/swarm/connect.js +++ b/packages/ipfs-cli/src/commands/swarm/connect.js @@ -24,7 +24,7 @@ module.exports = { /** * @param {object} argv * @param {import('../../types').Context} argv.ctx - * @param {import('multiaddr')} argv.address + * @param {import('multiaddr').Multiaddr} argv.address * @param {number} argv.timeout */ async handler ({ ctx: { ipfs, isDaemon, print }, address, timeout }) { diff --git a/packages/ipfs-cli/src/commands/swarm/disconnect.js b/packages/ipfs-cli/src/commands/swarm/disconnect.js index d08b5164b6..f25c020191 100644 --- a/packages/ipfs-cli/src/commands/swarm/disconnect.js +++ b/packages/ipfs-cli/src/commands/swarm/disconnect.js @@ -24,7 +24,7 @@ module.exports = { /** * @param {object} argv * @param {import('../../types').Context} argv.ctx - * @param {import('multiaddr')} argv.address + * @param {import('multiaddr').Multiaddr} argv.address * @param {number} argv.timeout */ async handler ({ ctx: { ipfs, isDaemon, print }, address, timeout }) { diff --git a/packages/ipfs-cli/test/swarm.js b/packages/ipfs-cli/test/swarm.js index e173d3a555..4509b48831 100644 --- a/packages/ipfs-cli/test/swarm.js +++ b/packages/ipfs-cli/test/swarm.js @@ -5,7 +5,7 @@ const { expect } = require('aegir/utils/chai') const cli = require('./utils/cli') const sinon = require('sinon') -const ma = require('multiaddr') +const { Multiaddr } = require('multiaddr') describe('swarm', () => { let ipfs @@ -28,7 +28,7 @@ describe('swarm', () => { } it('connect online', async () => { - const multiaddr = ma('/ip4/123.123.123.123/tcp/482') + const multiaddr = new Multiaddr('/ip4/123.123.123.123/tcp/482') ipfs.swarm.connect.withArgs(multiaddr, defaultOptions).resolves() @@ -37,7 +37,7 @@ describe('swarm', () => { }) it('connect offline', async () => { - const multiaddr = ma('/ip4/123.123.123.123/tcp/482') + const multiaddr = new Multiaddr('/ip4/123.123.123.123/tcp/482') const out = await cli.fail(`swarm connect ${multiaddr}`, { ipfs, isDaemon: false }) expect(out).to.include('This command must be run in online mode') @@ -46,7 +46,7 @@ describe('swarm', () => { }) it('connect with timeout', async () => { - const multiaddr = ma('/ip4/123.123.123.123/tcp/482') + const multiaddr = new Multiaddr('/ip4/123.123.123.123/tcp/482') ipfs.swarm.connect.withArgs(multiaddr, { ...defaultOptions, @@ -110,7 +110,7 @@ describe('swarm', () => { ipfs.swarm.addrs.withArgs(defaultOptions).resolves([{ id: peer, addrs: [ - ma(addr) + new Multiaddr(addr) ] }]) @@ -128,7 +128,7 @@ describe('swarm', () => { }).resolves([{ id: peer, addrs: [ - ma(addr) + new Multiaddr(addr) ] }]) @@ -175,20 +175,20 @@ describe('swarm', () => { } it('disconnect online', async () => { - const multiaddr = ma('/ip4/123.123.123.123/tcp/482') + const multiaddr = new Multiaddr('/ip4/123.123.123.123/tcp/482') ipfs.swarm.disconnect.withArgs(multiaddr, defaultOptions).resolves() const out = await cli(`swarm disconnect ${multiaddr}`, { ipfs, isDaemon: true }) expect(out).to.equal(`${multiaddr}\n`) }) it('disconnect offline', async () => { - const multiaddr = ma('/ip4/123.123.123.123/tcp/482') + const multiaddr = new Multiaddr('/ip4/123.123.123.123/tcp/482') const out = await cli.fail(`swarm disconnect ${multiaddr}`, { ipfs, isDaemon: false }) expect(out).to.include('This command must be run in online mode') }) it('disconnect with timeout', async () => { - const multiaddr = ma('/ip4/123.123.123.123/tcp/482') + const multiaddr = new Multiaddr('/ip4/123.123.123.123/tcp/482') ipfs.swarm.disconnect.withArgs(multiaddr, { ...defaultOptions, timeout: 1000 diff --git a/packages/ipfs-client/src/index.js b/packages/ipfs-client/src/index.js index e4e14466cd..4fe4fd57ba 100644 --- a/packages/ipfs-client/src/index.js +++ b/packages/ipfs-client/src/index.js @@ -7,7 +7,7 @@ const mergeOptions = require('merge-options') /** * @typedef {import('ipfs-http-client').Options} HTTPOptions * @typedef {import('ipfs-grpc-client').Options} GRPCOptions - * @typedef {string|URL|import('multiaddr')} Address + * @typedef {string|URL|import('multiaddr').Multiaddr} Address * @typedef {{http?: Address, grpc?: Address} & Partial} Options * * @param {Options} [opts] diff --git a/packages/ipfs-core-types/src/config/index.d.ts b/packages/ipfs-core-types/src/config/index.d.ts index a1de611046..0c21ea3936 100644 --- a/packages/ipfs-core-types/src/config/index.d.ts +++ b/packages/ipfs-core-types/src/config/index.d.ts @@ -30,11 +30,11 @@ export interface API { } export interface Config { - Addresses: AddressConfig + Addresses?: AddressConfig API?: APIConfig, Profiles?: string - Bootstrap: string[] - Discovery: DiscoveryConfig + Bootstrap?: string[] + Discovery?: DiscoveryConfig Datastore?: DatastoreConfig Identity?: IdentityConfig Keychain?: KeychainConfig @@ -51,7 +51,7 @@ export interface AddressConfig { RPC?: string Delegates?: string[] Gateway?: string - Swarm: string[] + Swarm?: string[] } export interface APIConfig { @@ -59,8 +59,8 @@ export interface APIConfig { } export interface DiscoveryConfig { - MDNS: MDNSDiscovery - webRTCStar: WebRTCStarDiscovery + MDNS?: MDNSDiscovery + webRTCStar?: WebRTCStarDiscovery } export interface MDNSDiscovery { @@ -76,15 +76,31 @@ export interface DatastoreConfig { Spec?: DatastoreSpec } -export interface DatastoreSpec { +export interface DatastoreType { + type: string, + path: string, + sync?: boolean, + shardFunc?: string, + compression?: string +} +export interface DatastoreMountPoint { + mountpoint: string, + type: string, + prefix: string, + child: DatastoreType +} + +export interface DatastoreSpec { + type?: string, + mounts?: DatastoreMountPoint[] } export interface IdentityConfig { /** * The unique PKI identity label for this configs peer. Set on init and never - * read, its merely here for convenience. IPFS will always generate the peerID - * from its keypair at runtime. + * read, its merely here for convenience. IPFS will always generate the peerID + * from its keypair at runtime. */ PeerID: string diff --git a/packages/ipfs-core-types/src/utils.d.ts b/packages/ipfs-core-types/src/utils.d.ts index 67540e17bc..1ff3a28fdf 100644 --- a/packages/ipfs-core-types/src/utils.d.ts +++ b/packages/ipfs-core-types/src/utils.d.ts @@ -131,3 +131,57 @@ export interface BufferStore { get: (key: Uint8Array) => Promise stores: any[] } + +export interface Blockstore { + open: () => Promise + + /** + * Query the store + */ + query: (Query, options?: DatastoreOptions) => AsyncIterable + + /** + * Query the store, returning only keys + */ + queryKeys: (query: KeyQuery, options?: DatastoreOptions) => AsyncIterable + + /** + * Get a single block by CID + */ + get: (cid: CID, options?: DatastoreOptions) => Promise + + /** + * Like get, but for more + */ + getMany: (cids: AwaitIterable, options?: DatastoreOptions) => AsyncIterable + + /** + * Write a single block to the store + */ + put: (block: Block, options?: DatastoreOptions) => Promise + + /** + * Like put, but for more + */ + putMany: (blocks: AwaitIterable, options?: DatastoreOptions) => AsyncIterable + + /** + * Does the store contain block with this CID? + */ + has: (cid: CID, options?: DatastoreOptions) => Promise + + /** + * Delete a block from the store + */ + delete: (cid: CID, options?: DatastoreOptions) => Promise + + /** + * Delete a block from the store + */ + deleteMany: (cids: AwaitIterable, options?: DatastoreOptions) => AsyncIterable + + /** + * Close the store + */ + close: () => Promise +} diff --git a/packages/ipfs-core-utils/package.json b/packages/ipfs-core-utils/package.json index dbe1f4c5a7..a3f383462a 100644 --- a/packages/ipfs-core-utils/package.json +++ b/packages/ipfs-core-utils/package.json @@ -53,7 +53,7 @@ "it-map": "^1.0.4", "it-peekable": "^1.0.1", "multiaddr": "^9.0.1", - "multiaddr-to-uri": "^6.0.0", + "multiaddr-to-uri": "^7.0.0", "parse-duration": "^1.0.0", "timeout-abort-controller": "^1.1.1", "uint8arrays": "^2.1.3" diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index bef6b9335a..c448463eac 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -62,19 +62,19 @@ "cborg": "^1.2.1", "cids": "^1.1.6", "dag-cbor-links": "^2.0.0", - "datastore-core": "^3.0.0", + "datastore-core": "^4.0.0", "datastore-pubsub": "^0.5.0", "debug": "^4.1.1", "dlv": "^1.1.3", "err-code": "^3.0.1", "hamt-sharding": "^2.0.0", "hashlru": "^2.3.0", - "interface-datastore": "^3.0.3", - "ipfs-bitswap": "^5.0.1", + "interface-datastore": "^4.0.0", + "ipfs-bitswap": "^5.0.2", "ipfs-block-service": "^0.19.0", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", - "ipfs-repo": "^9.0.0", + "ipfs-repo": "^9.1.0", "ipfs-unixfs": "^4.0.1", "ipfs-unixfs-exporter": "^5.0.1", "ipfs-unixfs-importer": "^7.0.1", @@ -93,24 +93,25 @@ "it-last": "^1.0.4", "it-map": "^1.0.4", "it-pipe": "^1.1.0", - "libp2p": "^0.30.12", - "libp2p-bootstrap": "^0.12.1", - "libp2p-crypto": "^0.19.0", - "libp2p-floodsub": "^0.24.1", - "libp2p-gossipsub": "^0.8.0", + "just-safe-set": "^2.2.1", + "libp2p": "0.31.0-rc.2", + "libp2p-bootstrap": "^0.12.3", + "libp2p-crypto": "^0.19.3", + "libp2p-floodsub": "^0.25.1", + "libp2p-gossipsub": "ChainSafe/js-libp2p-gossipsub#chore/update-deps-and-remove-protons", "libp2p-kad-dht": "^0.21.0", - "libp2p-mdns": "^0.15.0", - "libp2p-mplex": "^0.10.0", - "libp2p-noise": "^2.0.1", - "libp2p-record": "^0.10.0", - "libp2p-tcp": "^0.15.1", - "libp2p-webrtc-star": "^0.21.0", - "libp2p-websockets": "^0.15.1", + "libp2p-mdns": "^0.16.0", + "libp2p-mplex": "^0.10.2", + "libp2p-noise": "^2.0.5", + "libp2p-record": "^0.10.1", + "libp2p-tcp": "^0.15.4", + "libp2p-webrtc-star": "^0.22.0", + "libp2p-websockets": "^0.15.5", "mafmt": "^9.0.0", "merge-options": "^3.0.4", "mortice": "^2.0.0", "multiaddr": "^9.0.1", - "multiaddr-to-uri": "^6.0.0", + "multiaddr-to-uri": "^7.0.0", "multibase": "^4.0.2", "multicodec": "^3.0.1", "multihashing-async": "^2.1.2", diff --git a/packages/ipfs-core/src/components/config.js b/packages/ipfs-core/src/components/config.js index c20169573e..6fc3e3455b 100644 --- a/packages/ipfs-core/src/components/config.js +++ b/packages/ipfs-core/src/components/config.js @@ -1,5 +1,6 @@ 'use strict' +const set = require('just-safe-set') const getDefaultConfig = require('../runtime/config-nodejs.js') const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') const log = require('debug')('ipfs:core:config') @@ -115,8 +116,8 @@ const profiles = { server: { description: 'Recommended for nodes with public IPv4 address (servers, VPSes, etc.), disables host and content discovery and UPnP in local networks.', transform: (config) => { - config.Discovery.MDNS.Enabled = false - config.Discovery.webRTCStar.Enabled = false + set(config, 'Discovery.MDNS.Enabled', false) + set(config, 'Discovery.webRTCStar.Enabled', false) config.Swarm = { ...(config.Swarm || {}), DisableNatPortMap: true @@ -128,12 +129,12 @@ const profiles = { 'local-discovery': { description: 'Sets default values to fields affected by `server` profile, enables discovery and UPnP in local networks.', transform: (config) => { - config.Discovery.MDNS.Enabled = true - config.Discovery.webRTCStar.Enabled = true - config.Swarm = { + set(config, 'Discovery.MDNS.Enabled', true) + set(config, 'Discovery.webRTCStar.Enabled', true) + set(config, 'Swarm', { ...(config.Swarm || {}), DisableNatPortMap: false - } + }) return config } @@ -143,17 +144,17 @@ const profiles = { transform: (config) => { const defaultConfig = getDefaultConfig() - config.Addresses.API = defaultConfig.Addresses.API ? '/ip4/127.0.0.1/tcp/0' : '' - config.Addresses.Gateway = defaultConfig.Addresses.Gateway ? '/ip4/127.0.0.1/tcp/0' : '' - config.Addresses.Swarm = defaultConfig.Addresses.Swarm.length ? ['/ip4/127.0.0.1/tcp/0'] : [] - config.Addresses.Delegates = [] - config.Bootstrap = [] - config.Discovery.MDNS.Enabled = false - config.Discovery.webRTCStar.Enabled = false - config.Swarm = { + set(config, 'Addresses.API', defaultConfig.Addresses.API ? '/ip4/127.0.0.1/tcp/0' : '') + set(config, 'Addresses.Gateway', defaultConfig.Addresses.Gateway ? '/ip4/127.0.0.1/tcp/0' : '') + set(config, 'Addresses.Swarm', defaultConfig.Addresses.Swarm.length ? ['/ip4/127.0.0.1/tcp/0'] : []) + set(config, 'Addresses.Delegates', []) + set(config, 'Bootstrap', []) + set(config, 'Discovery.MDNS.Enabled', false) + set(config, 'Discovery.webRTCStar.Enabled', false) + set(config, 'Swarm', { ...(config.Swarm || {}), DisableNatPortMap: true - } + }) return config } @@ -163,17 +164,17 @@ const profiles = { transform: (config) => { const defaultConfig = getDefaultConfig() - config.Addresses.API = defaultConfig.Addresses.API - config.Addresses.Gateway = defaultConfig.Addresses.Gateway - config.Addresses.Swarm = defaultConfig.Addresses.Swarm - config.Addresses.Delegates = defaultConfig.Addresses.Delegates - config.Bootstrap = defaultConfig.Bootstrap - config.Discovery.MDNS.Enabled = defaultConfig.Discovery.MDNS.Enabled - config.Discovery.webRTCStar.Enabled = defaultConfig.Discovery.webRTCStar.Enabled - config.Swarm = { + set(config, 'Addresses.API', defaultConfig.Addresses.API) + set(config, 'Addresses.Gateway', defaultConfig.Addresses.Gateway) + set(config, 'Addresses.Swarm', defaultConfig.Addresses.Swarm) + set(config, 'Addresses.Delegates', defaultConfig.Addresses.Delegates) + set(config, 'Bootstrap', defaultConfig.Bootstrap) + set(config, 'Discovery.MDNS.Enabled', defaultConfig.Discovery.MDNS.Enabled) + set(config, 'Discovery.webRTCStar.Enabled', defaultConfig.Discovery.webRTCStar.Enabled) + set(config, 'Swarm', { ...(config.Swarm || {}), DisableNatPortMap: false - } + }) return config } diff --git a/packages/ipfs-core/src/components/libp2p.js b/packages/ipfs-core/src/components/libp2p.js index 236ddaa726..003277e016 100644 --- a/packages/ipfs-core/src/components/libp2p.js +++ b/packages/ipfs-core/src/components/libp2p.js @@ -10,7 +10,7 @@ const PubsubRouters = require('../runtime/libp2p-pubsub-routers-nodejs') * @property {string} [pass] * * @typedef {import('ipfs-repo')} Repo - * @typedef {import('multiaddr')} Multiaddr + * @typedef {import('multiaddr').Multiaddr} Multiaddr * @typedef {import('peer-id')} PeerId * @typedef {import('../types').Options} IPFSOptions * @typedef {import('libp2p')} LibP2P diff --git a/packages/ipfs-core/src/components/repo/gc.js b/packages/ipfs-core/src/components/repo/gc.js index 206091da7e..060979decc 100644 --- a/packages/ipfs-core/src/components/repo/gc.js +++ b/packages/ipfs-core/src/components/repo/gc.js @@ -43,7 +43,7 @@ module.exports = ({ gcLock, pin, refs, repo }) => { const markedSet = await createMarkedSet({ pin, refs, repo }) // Get all blocks keys from the blockstore // @ts-ignore - TS is not aware of keysOnly overload - const blockKeys = repo.blocks.query({ keysOnly: true }) + const blockKeys = repo.blocks.queryKeys() // Delete blocks that are not being used yield * deleteUnmarkedBlocks({ repo }, markedSet, blockKeys) diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index cc128b16b4..9dbb860f67 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -39,11 +39,11 @@ "ipfs-http-gateway": "^0.3.2", "ipfs-http-server": "^0.3.4", "ipfs-utils": "^6.0.4", - "just-safe-set": "^2.1.0", - "libp2p": "^0.30.12", + "just-safe-set": "^2.2.1", + "libp2p": "0.31.0-rc.2", "libp2p-delegated-content-routing": "^0.10.0", "libp2p-delegated-peer-routing": "^0.9.0", - "libp2p-webrtc-star": "^0.21.0", + "libp2p-webrtc-star": "^0.22.0", "multiaddr": "^9.0.1" }, "devDependencies": { diff --git a/packages/ipfs-grpc-server/src/utils/web-socket-server.js b/packages/ipfs-grpc-server/src/utils/web-socket-server.js index d08f4d2dfc..d5f9c4a0bf 100644 --- a/packages/ipfs-grpc-server/src/utils/web-socket-server.js +++ b/packages/ipfs-grpc-server/src/utils/web-socket-server.js @@ -7,7 +7,7 @@ const debug = require('debug')('ipfs:grpc-server:utils:web-socket-server') // @ts-ignore - no types const coerce = require('coercer') const { camelCase } = require('change-case') -const ma = require('multiaddr') +const { Multiaddr } = require('multiaddr') /** * @param {Buffer} buf - e.g. `Buffer.from('foo-bar: baz\r\n')` @@ -82,14 +82,14 @@ class Messages extends EventEmitter { // which is not how this server runs: https://nodejs.org/dist/latest-v15.x/docs/api/net.html#net_server_address this.info = { uri: info, - ma: ma(info) + ma: new Multiaddr(info) } } else { this.info = { address: info.address, port: info.port, uri: `http://${info.address}:${info.port}`, - ma: ma(`/ip4/${info.address}/tcp/${info.port}/ws`) + ma: new Multiaddr(`/ip4/${info.address}/tcp/${info.port}/ws`) } } @@ -106,10 +106,10 @@ class Messages extends EventEmitter { */ module.exports = async (ipfs, options = {}) => { const config = await ipfs.config.getAll() - const grpcAddr = config.Addresses.RPC + const grpcAddr = config.Addresses?.RPC if (!grpcAddr) { - throw new Error('No gRPC address configured, please set an Adresses.RPC key in your IPFS config') + throw new Error('No gRPC address configured, please set an Addresses.RPC key in your IPFS config') } const [,, host, , port] = grpcAddr.split('/') diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index c3fae79610..d64734b3ec 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -79,7 +79,7 @@ "go-ipfs": "0.8.0", "ipfsd-ctl": "^8.0.1", "it-all": "^1.0.4", - "it-concat": "^1.0.3", + "it-concat": "^2.0.0", "it-first": "^1.0.4", "nock": "^13.0.2", "rimraf": "^3.0.2" diff --git a/packages/ipfs-http-gateway/src/index.js b/packages/ipfs-http-gateway/src/index.js index 74df014088..e3a0229a12 100644 --- a/packages/ipfs-http-gateway/src/index.js +++ b/packages/ipfs-http-gateway/src/index.js @@ -71,8 +71,8 @@ class HttpGateway { // @ts-ignore TODO: move config typedefs to repo const config = await ipfs.config.getAll() - config.Addresses = config.Addresses || { Swarm: [], Gateway: [] } - const gatewayAddrs = config.Addresses.Gateway || [] + const addresses = config.Addresses || { Swarm: [], Gateway: [] } + const gatewayAddrs = addresses?.Gateway || [] this._gatewayServers = await serverCreator(gatewayAddrs, this._createGatewayServer, ipfs) diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index f5e15ff4e6..1bd20cf31c 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -55,7 +55,7 @@ "it-to-stream": "^1.0.0", "iterable-ndjson": "^1.1.0", "joi": "^17.2.1", - "just-safe-set": "^2.1.0", + "just-safe-set": "^2.2.1", "multiaddr": "^9.0.1", "multibase": "^4.0.2", "multicodec": "^3.0.1", @@ -70,7 +70,6 @@ "devDependencies": { "@types/hapi__hapi": "^20.0.5", "@types/hapi-pino": "^8.0.1", - "@types/just-safe-set": "^2.1.0", "aegir": "^33.0.0", "form-data": "^4.0.0", "ipfs-http-client": "^49.0.4", diff --git a/packages/ipfs-http-server/src/api/resources/dht.js b/packages/ipfs-http-server/src/api/resources/dht.js index 85dc418115..f498a3d319 100644 --- a/packages/ipfs-http-server/src/api/resources/dht.js +++ b/packages/ipfs-http-server/src/api/resources/dht.js @@ -138,7 +138,7 @@ exports.findProvs = { return { Responses: [{ ID: id.toString(), - Addrs: (addrs || []).map((/** @type {import('multiaddr')} */ a) => a.toString()) + Addrs: (addrs || []).map((/** @type {import('multiaddr').Multiaddr} */ a) => a.toString()) }], Type: 4 } diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index 7effc7859e..039595307e 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -56,11 +56,11 @@ "ipfs-client": "^0.3.4", "ipfs-core-types": "^0.3.1", "ipfs-http-client": "^49.0.4", - "ipfs-interop": "^5.0.1", + "ipfs-interop": "^5.0.2", "ipfs-utils": "^6.0.4", "ipfsd-ctl": "^8.0.1", "iso-url": "^1.0.0", - "libp2p-webrtc-star": "^0.21.0", + "libp2p-webrtc-star": "^0.22.0", "merge-options": "^3.0.4", "mock-ipfs-pinning-service": "^0.2.0", "rimraf": "^3.0.2", From 46a76be43892279929668b8be770b03727620cbe Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 16 Apr 2021 16:40:26 +0100 Subject: [PATCH 06/24] chore: linting --- packages/interface-ipfs-core/src/swarm/peers.js | 4 ++-- packages/ipfs-core/test/exports.spec.js | 2 +- packages/ipfs-http-client/test/exports.spec.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index 4f8881080c..1d4c5197a9 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -49,7 +49,7 @@ module.exports = (common, options) => { const peer = peers[0] expect(peer).to.have.a.property('addr') - expect(multiaddr.isMultiaddr(peer.addr)).to.equal(true) + expect(Multiaddr.isMultiaddr(peer.addr)).to.equal(true) expect(peer).to.have.a.property('peer').that.is.a('string') expect(CID.isCID(new CID(peer.peer))).to.equal(true) expect(peer).to.not.have.a.property('latency') @@ -66,7 +66,7 @@ module.exports = (common, options) => { const peer = peers[0] expect(peer).to.have.a.property('addr') - expect(multiaddr.isMultiaddr(peer.addr)).to.equal(true) + expect(Multiaddr.isMultiaddr(peer.addr)).to.equal(true) expect(peer).to.have.a.property('peer') expect(peer).to.have.a.property('latency') expect(peer.latency).to.match(/n\/a|[0-9]+[mµ]?s/) // n/a or 3ms or 3µs or 3s diff --git a/packages/ipfs-core/test/exports.spec.js b/packages/ipfs-core/test/exports.spec.js index 57834aec43..e4b63d24f7 100644 --- a/packages/ipfs-core/test/exports.spec.js +++ b/packages/ipfs-core/test/exports.spec.js @@ -4,7 +4,7 @@ const crypto = require('libp2p-crypto') const isIPFS = require('is-ipfs') const CID = require('cids') -const { Multiaddr } = require('multiaddr') +const { multiaddr } = require('multiaddr') const multibase = require('multibase') const multihashing = require('multihashing-async') const multihash = multihashing.multihash diff --git a/packages/ipfs-http-client/test/exports.spec.js b/packages/ipfs-http-client/test/exports.spec.js index 5ec4c9c336..b13008847e 100644 --- a/packages/ipfs-http-client/test/exports.spec.js +++ b/packages/ipfs-http-client/test/exports.spec.js @@ -2,7 +2,7 @@ 'use strict' const CID = require('cids') -const { Multiaddr } = require('multiaddr') +const { multiaddr } = require('multiaddr') const multibase = require('multibase') const multicodec = require('multicodec') const multihash = require('multihashes') From 58def596812744fb90da31381a50d1f9fda225d3 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Sat, 17 Apr 2021 06:33:59 +0100 Subject: [PATCH 07/24] chore: update deps --- packages/ipfs-http-gateway/package.json | 2 +- packages/ipfs-http-server/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ipfs-http-gateway/package.json b/packages/ipfs-http-gateway/package.json index 1f2df38340..18d2e35f06 100644 --- a/packages/ipfs-http-gateway/package.json +++ b/packages/ipfs-http-gateway/package.json @@ -56,7 +56,7 @@ "joi": "^17.2.1", "multibase": "^4.0.2", "uint8arrays": "^2.1.3", - "uri-to-multiaddr": "^4.0.0" + "uri-to-multiaddr": "^5.0.0" }, "devDependencies": { "@types/hapi__hapi": "^20.0.5", diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index 1bd20cf31c..217272cbd8 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -51,7 +51,7 @@ "it-map": "^1.0.4", "it-multipart": "^1.0.8", "it-pipe": "^1.1.0", - "it-tar": "^2.0.0", + "it-tar": "^3.0.0", "it-to-stream": "^1.0.0", "iterable-ndjson": "^1.1.0", "joi": "^17.2.1", @@ -65,7 +65,7 @@ "stream-to-it": "^0.2.2", "streaming-iterables": "^5.0.2", "uint8arrays": "^2.1.3", - "uri-to-multiaddr": "^4.0.0" + "uri-to-multiaddr": "^5.0.0" }, "devDependencies": { "@types/hapi__hapi": "^20.0.5", From 7bef78dc53a201d0ae7e4843c2ae9b6d4b2bbfe7 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 21 Apr 2021 16:37:47 +0100 Subject: [PATCH 08/24] chore: update deps --- examples/browser-exchange-files/package.json | 2 +- examples/browser-exchange-files/public/app.js | 1 + .../package.json | 2 +- examples/browser-ipns-publish/package.json | 3 ++- examples/browser-parceljs/package.json | 2 +- examples/circuit-relaying/package.json | 2 +- examples/custom-libp2p/index.js | 2 +- examples/custom-libp2p/package.json | 4 ++-- examples/custom-libp2p/test.js | 2 +- .../http-client-browser-pubsub/package.json | 1 + examples/http-client-name-api/package.json | 2 +- examples/ipfs-client-add-files/package.json | 2 +- examples/test-ipfs-example/nightwatch.conf.js | 2 +- packages/interface-ipfs-core/package.json | 10 +++++----- packages/ipfs-cli/package.json | 2 +- packages/ipfs-cli/src/commands/add.js | 3 ++- packages/ipfs-core-utils/package.json | 2 +- packages/ipfs-core/package.json | 19 ++++++++++--------- packages/ipfs-core/src/components/libp2p.js | 19 ++++++++++--------- packages/ipfs-core/src/components/network.js | 2 +- packages/ipfs-core/src/components/storage.js | 5 +++-- .../src/ipns/routing/pubsub-datastore.js | 2 ++ .../ipfs-core/src/runtime/libp2p-browser.js | 5 ++++- .../ipfs-core/src/runtime/libp2p-nodejs.js | 5 ++++- packages/ipfs-core/test/libp2p.spec.js | 4 ++-- packages/ipfs-daemon/package.json | 2 +- packages/ipfs-grpc-client/package.json | 2 +- packages/ipfs-http-client/package.json | 2 +- packages/ipfs-http-gateway/package.json | 2 +- packages/ipfs-http-server/package.json | 2 +- .../ipfs-message-port-client/package.json | 2 +- 31 files changed, 66 insertions(+), 51 deletions(-) diff --git a/examples/browser-exchange-files/package.json b/examples/browser-exchange-files/package.json index 67fe48e18e..b880239522 100644 --- a/examples/browser-exchange-files/package.json +++ b/examples/browser-exchange-files/package.json @@ -20,7 +20,7 @@ "dependencies": { "ipfs": "^0.54.4", "it-all": "^1.0.4", - "libp2p-websockets": "^0.15.5", + "libp2p-websockets": "^0.15.6", "rimraf": "^3.0.2", "test-ipfs-example": "^3.0.0" } diff --git a/examples/browser-exchange-files/public/app.js b/examples/browser-exchange-files/public/app.js index 5f42c7b309..5b20d82f84 100644 --- a/examples/browser-exchange-files/public/app.js +++ b/examples/browser-exchange-files/public/app.js @@ -41,6 +41,7 @@ let workspace = (location.hash || 'default-workspace').replace(/^#/, '') let fileSize = 0 +/** @type {import('ipfs').IPFS} */ let node let info diff --git a/examples/browser-http-client-upload-file/package.json b/examples/browser-http-client-upload-file/package.json index cab2f0dbc9..b0557692b5 100644 --- a/examples/browser-http-client-upload-file/package.json +++ b/examples/browser-http-client-upload-file/package.json @@ -4,7 +4,7 @@ "description": "Upload file to IPFS via browser using js-ipfs-http-client with Webpack", "private": true, "scripts": { - "clean": "rimraf ./dist", + "clean": "rimraf ./dist ./.cache ./.parcel-cache", "build": "parcel build index.html --no-scope-hoist", "start": "parcel index.html", "test": "test-ipfs-example" diff --git a/examples/browser-ipns-publish/package.json b/examples/browser-ipns-publish/package.json index bcb2a080d0..c111149010 100644 --- a/examples/browser-ipns-publish/package.json +++ b/examples/browser-ipns-publish/package.json @@ -5,6 +5,7 @@ "private": true, "main": "index.js", "scripts": { + "clean": "rimraf ./dist ./.cache ./.parcel-cache", "build": "parcel build index.html --no-scope-hoist", "start": "parcel index.html", "test": "test-ipfs-example" @@ -16,7 +17,7 @@ "ipfs": "^0.54.4", "ipfs-http-client": "^49.0.4", "ipfs-utils": "^6.0.4", - "ipns": "^0.10.0", + "ipns": "^0.11.0", "it-last": "^1.0.4", "p-retry": "^4.2.0", "uint8arrays": "^2.1.3" diff --git a/examples/browser-parceljs/package.json b/examples/browser-parceljs/package.json index 4eea6d5870..6bfa873b6d 100644 --- a/examples/browser-parceljs/package.json +++ b/examples/browser-parceljs/package.json @@ -8,7 +8,7 @@ "last 2 versions and not dead and > 2%" ], "scripts": { - "clean": "rimraf ./dist", + "clean": "rimraf ./dist ./.cache ./.parcel-cache", "lint": "standard public/**/*.js", "start": "parcel public/index.html", "build": "parcel build public/index.html --no-scope-hoist", diff --git a/examples/circuit-relaying/package.json b/examples/circuit-relaying/package.json index 65f2b774e4..7305a63911 100644 --- a/examples/circuit-relaying/package.json +++ b/examples/circuit-relaying/package.json @@ -17,7 +17,7 @@ "delay": "^5.0.0", "ipfs": "^0.54.4", "ipfs-pubsub-room": "^2.0.1", - "libp2p-websockets": "^0.15.5", + "libp2p-websockets": "^0.15.6", "uint8arrays": "^2.1.3" }, "devDependencies": { diff --git a/examples/custom-libp2p/index.js b/examples/custom-libp2p/index.js index 5ca0a0d1bf..aebc92bcbb 100644 --- a/examples/custom-libp2p/index.js +++ b/examples/custom-libp2p/index.js @@ -30,7 +30,7 @@ const libp2pBundle = (opts) => { // Build and return our libp2p node // n.b. for full configuration options, see https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md - return new Libp2p({ + return Libp2p.create({ peerId, addresses: { listen: ['/ip4/127.0.0.1/tcp/0'] diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index c648d60a2a..cb59faa132 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -11,9 +11,9 @@ "license": "MIT", "dependencies": { "ipfs": "^0.54.4", - "libp2p": "0.31.0-rc.2", + "libp2p": "^0.31.0-rc.5", "libp2p-bootstrap": "^0.12.3", - "libp2p-kad-dht": "^0.21.0", + "libp2p-kad-dht": "libp2p/js-libp2p-kad-dht#chore/update-deps-12-04-2021", "libp2p-mdns": "^0.16.0", "libp2p-mplex": "^0.10.2", "libp2p-noise": "^2.0.5", diff --git a/examples/custom-libp2p/test.js b/examples/custom-libp2p/test.js index fbed8f8cb5..c1d1f7a6ac 100644 --- a/examples/custom-libp2p/test.js +++ b/examples/custom-libp2p/test.js @@ -28,7 +28,7 @@ async function test () { console.info('Dialling', address) const peerId = await PeerId.create() - const libp2p = new Libp2p({ + const libp2p = Libp2p.create({ peerId, addresses: { listen: ['/ip4/127.0.0.1/tcp/0'] diff --git a/examples/http-client-browser-pubsub/package.json b/examples/http-client-browser-pubsub/package.json index da1ead9ab7..b2f655a2d3 100644 --- a/examples/http-client-browser-pubsub/package.json +++ b/examples/http-client-browser-pubsub/package.json @@ -5,6 +5,7 @@ "private": true, "main": "dist/index.html", "scripts": { + "clean": "rimraf ./dist ./.cache ./.parcel-cache", "build": "parcel build index.html --no-scope-hoist", "start": "parcel index.html -p 8888", "test": "test-ipfs-example" diff --git a/examples/http-client-name-api/package.json b/examples/http-client-name-api/package.json index 426551a790..34beae6eb8 100644 --- a/examples/http-client-name-api/package.json +++ b/examples/http-client-name-api/package.json @@ -5,7 +5,7 @@ "main": "dist/index.html", "private": true, "scripts": { - "clean": "rimraf ./dist", + "clean": "rimraf ./dist ./.cache ./.parcel-cache", "build": "parcel build index.html", "start": "parcel index.html -p 8888", "test": "test-ipfs-example" diff --git a/examples/ipfs-client-add-files/package.json b/examples/ipfs-client-add-files/package.json index b53d803749..5011c88ce3 100644 --- a/examples/ipfs-client-add-files/package.json +++ b/examples/ipfs-client-add-files/package.json @@ -5,7 +5,7 @@ "main": "dist/index.html", "private": true, "scripts": { - "clean": "rimraf ./dist", + "clean": "rimraf ./dist ./.cache ./.parcel-cache", "build": "parcel build index.html", "start": "parcel index.html -p 8888", "test": "test-ipfs-example" diff --git a/examples/test-ipfs-example/nightwatch.conf.js b/examples/test-ipfs-example/nightwatch.conf.js index 524dc76a6b..f204609075 100644 --- a/examples/test-ipfs-example/nightwatch.conf.js +++ b/examples/test-ipfs-example/nightwatch.conf.js @@ -24,7 +24,7 @@ module.exports = { desiredCapabilities: { browserName: 'chrome', chromeOptions: { - args: ['headless'] + //args: ['headless'] } } } diff --git a/packages/interface-ipfs-core/package.json b/packages/interface-ipfs-core/package.json index 25514d56ba..03fdfd946f 100644 --- a/packages/interface-ipfs-core/package.json +++ b/packages/interface-ipfs-core/package.json @@ -45,14 +45,14 @@ "delay": "^5.0.0", "dirty-chai": "^2.0.1", "err-code": "^3.0.1", - "ipfs-unixfs": "^4.0.1", - "ipfs-unixfs-importer": "^7.0.1", + "ipfs-unixfs": "^4.0.3", + "ipfs-unixfs-importer": "^7.0.3", "ipfs-utils": "^6.0.4", "ipld-block": "^0.11.0", "ipld-dag-cbor": "^0.18.0", "ipld-dag-pb": "^0.22.1", - "ipns": "^0.10.0", - "is-ipfs": "^4.0.0", + "ipns": "^0.11.0", + "is-ipfs": "^5.0.0", "iso-random-stream": "^2.0.0", "it-all": "^1.0.4", "it-buffer-stream": "^2.0.0", @@ -63,7 +63,7 @@ "it-map": "^1.0.4", "it-pushable": "^1.4.0", "libp2p-crypto": "^0.19.3", - "libp2p-websockets": "^0.15.5", + "libp2p-websockets": "^0.15.6", "multiaddr": "^9.0.1", "multibase": "^4.0.2", "multihashing-async": "^2.1.2", diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index d15cc7c0a9..eef41fab52 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -36,7 +36,7 @@ "debug": "^4.1.1", "err-code": "^3.0.1", "execa": "^5.0.0", - "get-folder-size": "^3.0.0", + "get-folder-size": "^2.0.1", "ipfs-core": "^0.5.4", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", diff --git a/packages/ipfs-cli/src/commands/add.js b/packages/ipfs-cli/src/commands/add.js index 4a73cc5111..fa914cff09 100644 --- a/packages/ipfs-cli/src/commands/add.js +++ b/packages/ipfs-cli/src/commands/add.js @@ -1,8 +1,9 @@ /* eslint-disable complexity */ 'use strict' +const { promisify } = require('util') // @ts-ignore no types -const getFolderSize = require('get-folder-size') +const getFolderSize = promisify(require('get-folder-size')) // @ts-ignore no types const byteman = require('byteman') const mh = require('multihashing-async').multihash diff --git a/packages/ipfs-core-utils/package.json b/packages/ipfs-core-utils/package.json index a3f383462a..2755a324ef 100644 --- a/packages/ipfs-core-utils/package.json +++ b/packages/ipfs-core-utils/package.json @@ -47,7 +47,7 @@ "cids": "^1.1.6", "err-code": "^3.0.1", "ipfs-core-types": "^0.3.1", - "ipfs-unixfs": "^4.0.1", + "ipfs-unixfs": "^4.0.3", "ipfs-utils": "^6.0.4", "it-all": "^1.0.4", "it-map": "^1.0.4", diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index c448463eac..5a275781eb 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -70,23 +70,24 @@ "hamt-sharding": "^2.0.0", "hashlru": "^2.3.0", "interface-datastore": "^4.0.0", - "ipfs-bitswap": "^5.0.2", + "ipfs-bitswap": "^5.0.3", "ipfs-block-service": "^0.19.0", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", + "ipfs-http-client": "^49.0.4", "ipfs-repo": "^9.1.0", - "ipfs-unixfs": "^4.0.1", - "ipfs-unixfs-exporter": "^5.0.1", - "ipfs-unixfs-importer": "^7.0.1", + "ipfs-unixfs": "^4.0.3", + "ipfs-unixfs-exporter": "^5.0.3", + "ipfs-unixfs-importer": "^7.0.3", "ipfs-utils": "^6.0.4", "ipld": "^0.29.0", "ipld-block": "^0.11.0", "ipld-dag-cbor": "^0.18.0", "ipld-dag-pb": "^0.22.1", "ipld-raw": "^7.0.0", - "ipns": "^0.10.0", + "ipns": "^0.11.0", "is-domain-name": "^1.0.1", - "is-ipfs": "^4.0.0", + "is-ipfs": "^5.0.0", "it-all": "^1.0.4", "it-drain": "^1.0.3", "it-first": "^1.0.4", @@ -94,19 +95,19 @@ "it-map": "^1.0.4", "it-pipe": "^1.1.0", "just-safe-set": "^2.2.1", - "libp2p": "0.31.0-rc.2", + "libp2p": "^0.31.0-rc.5", "libp2p-bootstrap": "^0.12.3", "libp2p-crypto": "^0.19.3", "libp2p-floodsub": "^0.25.1", "libp2p-gossipsub": "ChainSafe/js-libp2p-gossipsub#chore/update-deps-and-remove-protons", - "libp2p-kad-dht": "^0.21.0", + "libp2p-kad-dht": "libp2p/js-libp2p-kad-dht#chore/update-deps-12-04-2021", "libp2p-mdns": "^0.16.0", "libp2p-mplex": "^0.10.2", "libp2p-noise": "^2.0.5", "libp2p-record": "^0.10.1", "libp2p-tcp": "^0.15.4", "libp2p-webrtc-star": "^0.22.0", - "libp2p-websockets": "^0.15.5", + "libp2p-websockets": "^0.15.6", "mafmt": "^9.0.0", "merge-options": "^3.0.4", "mortice": "^2.0.0", diff --git a/packages/ipfs-core/src/components/libp2p.js b/packages/ipfs-core/src/components/libp2p.js index 003277e016..648b3f2ddb 100644 --- a/packages/ipfs-core/src/components/libp2p.js +++ b/packages/ipfs-core/src/components/libp2p.js @@ -1,5 +1,6 @@ 'use strict' +const { Multiaddr } = require('multiaddr') const get = require('dlv') const mergeOptions = require('merge-options') const errCode = require('err-code') @@ -10,7 +11,6 @@ const PubsubRouters = require('../runtime/libp2p-pubsub-routers-nodejs') * @property {string} [pass] * * @typedef {import('ipfs-repo')} Repo - * @typedef {import('multiaddr').Multiaddr} Multiaddr * @typedef {import('peer-id')} PeerId * @typedef {import('../types').Options} IPFSOptions * @typedef {import('libp2p')} LibP2P @@ -54,7 +54,7 @@ module.exports = ({ // Required inline to reduce startup time const Libp2p = require('libp2p') - return new Libp2p(libp2pOptions) + return Libp2p.create(libp2pOptions) } /** @@ -124,18 +124,18 @@ function getLibp2pOptions ({ options, config, datastore, keys, keychainConfig, p get(config, 'Pubsub.Enabled', true)) }, nat: { - enabled: get(options, 'nat.enabled', !get(config, 'Swarm.DisableNatPortMap', false)), - ttl: get(options, 'nat.ttl', 7200), - autoUpdate: get(options, 'nat.autoUpdate', true), - gateway: get(options, 'nat.gateway'), - externalIp: get(options, 'nat.externalIp'), + enabled: get(options, 'libp2p.config.nat.enabled', !get(config, 'Swarm.DisableNatPortMap', false)), + ttl: get(options, 'libp2p.config.nat.ttl', 7200), + keepAlive: get(options, 'libp2p.config.nat.keepAlive', true), + gateway: get(options, 'libp2p.config.nat.gateway'), + externalIp: get(options, 'libp2p.config.nat.externalIp'), pmp: { - enabled: get(options, 'nat.pmp.enabled', false) + enabled: get(options, 'libp2p.config.nat.pmp.enabled', false) } } }, addresses: { - listen: multiaddrs, + listen: multiaddrs.map(ma => ma.toString()), announce: get(options, 'addresses.announce', get(config, 'Addresses.Announce', [])) }, @@ -145,6 +145,7 @@ function getLibp2pOptions ({ options, config, datastore, keys, keychainConfig, p minConnections: get(options, 'config.Swarm.ConnMgr.LowWater', get(config, 'Swarm.ConnMgr.LowWater')) }), + // @ts-ignore pass will be made optional in a follow up PR keychain: { datastore: keys, ...keychainConfig diff --git a/packages/ipfs-core/src/components/network.js b/packages/ipfs-core/src/components/network.js index 2690726920..5f8d05dd9d 100644 --- a/packages/ipfs-core/src/components/network.js +++ b/packages/ipfs-core/src/components/network.js @@ -50,7 +50,7 @@ class Network { const config = await repo.config.getAll() - const libp2p = createLibP2P({ + const libp2p = await createLibP2P({ options, repo, peerId, diff --git a/packages/ipfs-core/src/components/storage.js b/packages/ipfs-core/src/components/storage.js index c8b50b5af1..e6d47fb71a 100644 --- a/packages/ipfs-core/src/components/storage.js +++ b/packages/ipfs-core/src/components/storage.js @@ -126,13 +126,14 @@ const initRepo = async (print, repo, options) => { log('repo opened') // Create libp2p for Keychain creation - const libp2p = createLibP2P({ + const libp2p = await createLibP2P({ options: undefined, multiaddrs: undefined, peerId, repo, config, keychainConfig: { + // @ts-ignore pass will be made optional in a follow up PR pass: options.pass } }) @@ -207,7 +208,7 @@ const configureRepo = async (repo, options) => { // @ts-ignore - Identity may not be present const peerId = await PeerId.createFromPrivKey(changed.Identity.PrivKey) - const libp2p = createLibP2P({ + const libp2p = await createLibP2P({ options: undefined, multiaddrs: undefined, peerId, diff --git a/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js b/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js index 925725ee59..5307e3477f 100644 --- a/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js +++ b/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js @@ -25,6 +25,8 @@ class IpnsPubsubDatastore { // Bind _handleSubscriptionKey function, which is called by PubsubDatastore. this._handleSubscriptionKey = this._handleSubscriptionKey.bind(this) + + // @ts-ignore will be fixed this._pubsubDs = new PubsubDatastore(pubsub, localDatastore, peerId, ipns.validator, this._handleSubscriptionKey) } diff --git a/packages/ipfs-core/src/runtime/libp2p-browser.js b/packages/ipfs-core/src/runtime/libp2p-browser.js index 48d4cab843..e3801398ab 100644 --- a/packages/ipfs-core/src/runtime/libp2p-browser.js +++ b/packages/ipfs-core/src/runtime/libp2p-browser.js @@ -12,7 +12,8 @@ const GossipSub = require('libp2p-gossipsub') const ipnsUtils = require('../ipns/routing/utils') module.exports = () => { - return { + /** @type {import('libp2p').Libp2pOptions} */ + const options = { dialer: { maxParallelDials: 150, // 150 total parallel multiaddr dials maxDialsPerPeer: 4, // Allow 4 multiaddrs to be dialed per peer in parallel @@ -75,4 +76,6 @@ module.exports = () => { threshold: 1 } } + + return options } diff --git a/packages/ipfs-core/src/runtime/libp2p-nodejs.js b/packages/ipfs-core/src/runtime/libp2p-nodejs.js index 6336d2455b..9cac4a8063 100644 --- a/packages/ipfs-core/src/runtime/libp2p-nodejs.js +++ b/packages/ipfs-core/src/runtime/libp2p-nodejs.js @@ -15,7 +15,8 @@ const ipnsUtils = require('../ipns/routing/utils') const os = require('os') module.exports = () => { - return { + /** @type {import('libp2p').Libp2pOptions} */ + const options = { dialer: { maxParallelDials: 150, // 150 total parallel multiaddr dials maxDialsPerPeer: 4, // Allow 4 multiaddrs to be dialed per peer in parallel @@ -81,4 +82,6 @@ module.exports = () => { persistence: true } } + + return options } diff --git a/packages/ipfs-core/test/libp2p.spec.js b/packages/ipfs-core/test/libp2p.spec.js index e347f29b9e..2ada06a2ba 100644 --- a/packages/ipfs-core/test/libp2p.spec.js +++ b/packages/ipfs-core/test/libp2p.spec.js @@ -76,7 +76,7 @@ describe('libp2p customization', function () { libp2p = libp2pComponent({ options: { libp2p: (opts) => { - return new Libp2p({ + return Libp2p.create({ peerId: opts.peerId, modules: { transport: [DummyTransport], connEncryption: [Crypto] }, config: { relay: { enabled: false } } @@ -100,7 +100,7 @@ describe('libp2p customization', function () { libp2p = libp2pComponent({ options: { libp2p: (opts) => { - return new Libp2p({ + return Libp2p.create({ peerId: opts.peerId, modules: { transport: [DummyTransport], connEncryption: [Crypto] }, config: { relay: { enabled: false } } diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index 9dbb860f67..6edcbc4df3 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -40,7 +40,7 @@ "ipfs-http-server": "^0.3.4", "ipfs-utils": "^6.0.4", "just-safe-set": "^2.2.1", - "libp2p": "0.31.0-rc.2", + "libp2p": "^0.31.0-rc.5", "libp2p-delegated-content-routing": "^0.10.0", "libp2p-delegated-peer-routing": "^0.9.0", "libp2p-webrtc-star": "^0.22.0", diff --git a/packages/ipfs-grpc-client/package.json b/packages/ipfs-grpc-client/package.json index c7ab3e3647..c3534e6b47 100644 --- a/packages/ipfs-grpc-client/package.json +++ b/packages/ipfs-grpc-client/package.json @@ -40,7 +40,7 @@ "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", "ipfs-grpc-protocol": "^0.2.0", - "ipfs-unixfs": "^4.0.1", + "ipfs-unixfs": "^4.0.3", "it-first": "^1.0.4", "it-pushable": "^1.4.0", "multiaddr": "^9.0.1", diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index d64734b3ec..f90deee443 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -51,7 +51,7 @@ "form-data": "^4.0.0", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", - "ipfs-unixfs": "^4.0.1", + "ipfs-unixfs": "^4.0.3", "ipfs-utils": "^6.0.4", "ipld": "^0.29.0", "ipld-block": "^0.11.0", diff --git a/packages/ipfs-http-gateway/package.json b/packages/ipfs-http-gateway/package.json index 18d2e35f06..a6213167e4 100644 --- a/packages/ipfs-http-gateway/package.json +++ b/packages/ipfs-http-gateway/package.json @@ -50,7 +50,7 @@ "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", "ipfs-http-response": "^0.6.0", - "is-ipfs": "^4.0.0", + "is-ipfs": "^5.0.0", "it-last": "^1.0.4", "it-to-stream": "^1.0.0", "joi": "^17.2.1", diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index 217272cbd8..f53febdb89 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -42,7 +42,7 @@ "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", "ipfs-http-gateway": "^0.3.2", - "ipfs-unixfs": "^4.0.1", + "ipfs-unixfs": "^4.0.3", "ipld-dag-pb": "^0.22.1", "it-all": "^1.0.4", "it-drain": "^1.0.3", diff --git a/packages/ipfs-message-port-client/package.json b/packages/ipfs-message-port-client/package.json index 3d0dd6ab5d..59b68df236 100644 --- a/packages/ipfs-message-port-client/package.json +++ b/packages/ipfs-message-port-client/package.json @@ -37,7 +37,7 @@ "cids": "^1.1.6", "ipfs-core-types": "^0.3.1", "ipfs-message-port-protocol": "^0.6.1", - "ipfs-unixfs": "^4.0.1" + "ipfs-unixfs": "^4.0.3" }, "devDependencies": { "aegir": "^33.0.0", From 302f0c3b524fc0df05071f867702affbdf3a14c5 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 21 Apr 2021 17:47:39 +0100 Subject: [PATCH 09/24] chore: fix up tests --- examples/custom-libp2p/test.js | 2 +- packages/ipfs-core/test/libp2p.spec.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/custom-libp2p/test.js b/examples/custom-libp2p/test.js index c1d1f7a6ac..3c8b099859 100644 --- a/examples/custom-libp2p/test.js +++ b/examples/custom-libp2p/test.js @@ -28,7 +28,7 @@ async function test () { console.info('Dialling', address) const peerId = await PeerId.create() - const libp2p = Libp2p.create({ + const libp2p = await Libp2p.create({ peerId, addresses: { listen: ['/ip4/127.0.0.1/tcp/0'] diff --git a/packages/ipfs-core/test/libp2p.spec.js b/packages/ipfs-core/test/libp2p.spec.js index 2ada06a2ba..0fc25dc610 100644 --- a/packages/ipfs-core/test/libp2p.spec.js +++ b/packages/ipfs-core/test/libp2p.spec.js @@ -73,7 +73,7 @@ describe('libp2p customization', function () { describe('bundle', () => { it('should allow for using a libp2p bundle', async () => { - libp2p = libp2pComponent({ + libp2p = await libp2pComponent({ options: { libp2p: (opts) => { return Libp2p.create({ @@ -97,7 +97,7 @@ describe('libp2p customization', function () { }) it('should pass libp2p options to libp2p bundle function', async () => { - libp2p = libp2pComponent({ + libp2p = await libp2pComponent({ options: { libp2p: (opts) => { return Libp2p.create({ @@ -123,7 +123,7 @@ describe('libp2p customization', function () { describe('options', () => { it('should use options by default', async () => { - libp2p = libp2pComponent({ + libp2p = await libp2pComponent({ peerId, repo: { datastore }, print: console.log, // eslint-disable-line no-console @@ -158,7 +158,7 @@ describe('libp2p customization', function () { it('should allow for overriding via options', async () => { const annAddr = '/dns4/test.ipfs.io/tcp/443/wss' - libp2p = libp2pComponent({ + libp2p = await libp2pComponent({ peerId, repo: { datastore }, print: console.log, // eslint-disable-line no-console @@ -195,7 +195,7 @@ describe('libp2p customization', function () { it('should be able to specify Announce addresses', async () => { const annAddr = '/dns4/test.ipfs.io/tcp/443/wss' - libp2p = libp2pComponent({ + libp2p = await libp2pComponent({ peerId, repo: { datastore }, print: console.log, // eslint-disable-line no-console @@ -214,7 +214,7 @@ describe('libp2p customization', function () { }) it('should select gossipsub as pubsub router', async () => { - libp2p = libp2pComponent({ + libp2p = await libp2pComponent({ peerId, repo: { datastore }, print: console.log, // eslint-disable-line no-console From 3ac0bf9e01c47c930dfef89a25ba55a1c65aa477 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 22 Apr 2021 11:43:37 +0100 Subject: [PATCH 10/24] chore: update deps, remove ts-ignores, fix linting --- examples/custom-libp2p/package.json | 2 +- packages/ipfs-core/package.json | 3 +-- packages/ipfs-core/src/components/libp2p.js | 3 +-- packages/ipfs-core/src/components/storage.js | 3 +-- packages/ipfs-core/src/ipns/routing/pubsub-datastore.js | 2 +- packages/ipfs-daemon/package.json | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index cb59faa132..527fc70d33 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -11,7 +11,7 @@ "license": "MIT", "dependencies": { "ipfs": "^0.54.4", - "libp2p": "^0.31.0-rc.5", + "libp2p": "^0.31.0-rc.6", "libp2p-bootstrap": "^0.12.3", "libp2p-kad-dht": "libp2p/js-libp2p-kad-dht#chore/update-deps-12-04-2021", "libp2p-mdns": "^0.16.0", diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 5a275781eb..b1659c11fc 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -74,7 +74,6 @@ "ipfs-block-service": "^0.19.0", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", - "ipfs-http-client": "^49.0.4", "ipfs-repo": "^9.1.0", "ipfs-unixfs": "^4.0.3", "ipfs-unixfs-exporter": "^5.0.3", @@ -95,7 +94,7 @@ "it-map": "^1.0.4", "it-pipe": "^1.1.0", "just-safe-set": "^2.2.1", - "libp2p": "^0.31.0-rc.5", + "libp2p": "^0.31.0-rc.6", "libp2p-bootstrap": "^0.12.3", "libp2p-crypto": "^0.19.3", "libp2p-floodsub": "^0.25.1", diff --git a/packages/ipfs-core/src/components/libp2p.js b/packages/ipfs-core/src/components/libp2p.js index 648b3f2ddb..2fa457bf8c 100644 --- a/packages/ipfs-core/src/components/libp2p.js +++ b/packages/ipfs-core/src/components/libp2p.js @@ -1,6 +1,5 @@ 'use strict' -const { Multiaddr } = require('multiaddr') const get = require('dlv') const mergeOptions = require('merge-options') const errCode = require('err-code') @@ -16,6 +15,7 @@ const PubsubRouters = require('../runtime/libp2p-pubsub-routers-nodejs') * @typedef {import('libp2p')} LibP2P * @typedef {import('libp2p').Libp2pOptions & import('libp2p').constructorOptions} Options * @typedef {import('ipfs-core-types/src/config').Config} IPFSConfig + * @typedef {import('multiaddr').Multiaddr} Multiaddr */ /** @@ -145,7 +145,6 @@ function getLibp2pOptions ({ options, config, datastore, keys, keychainConfig, p minConnections: get(options, 'config.Swarm.ConnMgr.LowWater', get(config, 'Swarm.ConnMgr.LowWater')) }), - // @ts-ignore pass will be made optional in a follow up PR keychain: { datastore: keys, ...keychainConfig diff --git a/packages/ipfs-core/src/components/storage.js b/packages/ipfs-core/src/components/storage.js index e6d47fb71a..1c5f7ae027 100644 --- a/packages/ipfs-core/src/components/storage.js +++ b/packages/ipfs-core/src/components/storage.js @@ -120,7 +120,7 @@ const initRepo = async (print, repo, options) => { } await repo.init(config) - // 4. Open initalized repo. + // 4. Open initialized repo. await repo.open() log('repo opened') @@ -133,7 +133,6 @@ const initRepo = async (print, repo, options) => { repo, config, keychainConfig: { - // @ts-ignore pass will be made optional in a follow up PR pass: options.pass } }) diff --git a/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js b/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js index 5307e3477f..f6d4da49bc 100644 --- a/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js +++ b/packages/ipfs-core/src/ipns/routing/pubsub-datastore.js @@ -26,7 +26,7 @@ class IpnsPubsubDatastore { // Bind _handleSubscriptionKey function, which is called by PubsubDatastore. this._handleSubscriptionKey = this._handleSubscriptionKey.bind(this) - // @ts-ignore will be fixed + // @ts-ignore will be fixed by https://github.com/ipfs/js-datastore-pubsub/pull/74 this._pubsubDs = new PubsubDatastore(pubsub, localDatastore, peerId, ipns.validator, this._handleSubscriptionKey) } diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index 6edcbc4df3..438f6986a3 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -40,7 +40,7 @@ "ipfs-http-server": "^0.3.4", "ipfs-utils": "^6.0.4", "just-safe-set": "^2.2.1", - "libp2p": "^0.31.0-rc.5", + "libp2p": "^0.31.0-rc.6", "libp2p-delegated-content-routing": "^0.10.0", "libp2p-delegated-peer-routing": "^0.9.0", "libp2p-webrtc-star": "^0.22.0", From e178955458d8629411aa18ee072f8f5f28c565e8 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 22 Apr 2021 12:16:52 +0100 Subject: [PATCH 11/24] chore: downgrade mock-ipfs-pinning-service --- packages/ipfs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index 039595307e..c520761d8f 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -62,7 +62,7 @@ "iso-url": "^1.0.0", "libp2p-webrtc-star": "^0.22.0", "merge-options": "^3.0.4", - "mock-ipfs-pinning-service": "^0.2.0", + "mock-ipfs-pinning-service": "^0.1.2", "rimraf": "^3.0.2", "url": "^0.11.0", "wrtc": "^0.4.6" From de303dd42e8717cef8258bc0acd105b439967aef Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 22 Apr 2021 14:57:50 +0100 Subject: [PATCH 12/24] chore: fix up interface tests --- packages/interface-ipfs-core/src/bitswap/transfer.js | 2 +- packages/interface-ipfs-core/src/files/cp.js | 2 +- packages/interface-ipfs-core/src/files/ls.js | 2 +- packages/interface-ipfs-core/src/files/mv.js | 2 +- packages/interface-ipfs-core/src/files/read.js | 2 +- packages/interface-ipfs-core/src/files/rm.js | 2 +- packages/interface-ipfs-core/src/files/stat.js | 2 +- packages/interface-ipfs-core/src/files/write.js | 4 ++-- packages/interface-ipfs-core/src/object/get.js | 2 +- packages/ipfs-core/package.json | 4 ++-- packages/ipfs-core/src/components/refs/local.js | 3 +-- packages/ipfs-core/src/components/repo/gc.js | 3 +-- packages/ipfs-http-server/test/inject/files.js | 2 +- packages/ipfs-http-server/test/inject/pubsub.js | 2 +- 14 files changed, 16 insertions(+), 18 deletions(-) diff --git a/packages/interface-ipfs-core/src/bitswap/transfer.js b/packages/interface-ipfs-core/src/bitswap/transfer.js index c1cb73b3c9..88755d1bfa 100644 --- a/packages/interface-ipfs-core/src/bitswap/transfer.js +++ b/packages/interface-ipfs-core/src/bitswap/transfer.js @@ -4,7 +4,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { isWebWorker } = require('ipfs-utils/src/env') const CID = require('cids') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const Block = require('ipld-block') const concat = require('it-concat') const { nanoid } = require('nanoid') diff --git a/packages/interface-ipfs-core/src/files/cp.js b/packages/interface-ipfs-core/src/files/cp.js index a60b22d0f3..b2cbfd31cf 100644 --- a/packages/interface-ipfs-core/src/files/cp.js +++ b/packages/interface-ipfs-core/src/files/cp.js @@ -10,7 +10,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const mh = require('multihashing-async').multihash const Block = require('ipld-block') const CID = require('cids') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const createShardedDirectory = require('../utils/create-sharded-directory') const isShardAtPath = require('../utils/is-shard-at-path') const testTimeout = require('../utils/test-timeout') diff --git a/packages/interface-ipfs-core/src/files/ls.js b/packages/interface-ipfs-core/src/files/ls.js index e0e02e95ae..d266103262 100644 --- a/packages/interface-ipfs-core/src/files/ls.js +++ b/packages/interface-ipfs-core/src/files/ls.js @@ -7,7 +7,7 @@ const CID = require('cids') const createShardedDirectory = require('../utils/create-sharded-directory') const all = require('it-all') const drain = require('it-drain') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ diff --git a/packages/interface-ipfs-core/src/files/mv.js b/packages/interface-ipfs-core/src/files/mv.js index aada231394..c5b46a37a1 100644 --- a/packages/interface-ipfs-core/src/files/mv.js +++ b/packages/interface-ipfs-core/src/files/mv.js @@ -5,7 +5,7 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const uint8ArrayConcat = require('uint8arrays/concat') const { getDescribe, getIt, expect } = require('../utils/mocha') const createShardedDirectory = require('../utils/create-sharded-directory') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const isShardAtPath = require('../utils/is-shard-at-path') const testTimeout = require('../utils/test-timeout') const all = require('it-all') diff --git a/packages/interface-ipfs-core/src/files/read.js b/packages/interface-ipfs-core/src/files/read.js index 124cd6aad0..b5bde760a9 100644 --- a/packages/interface-ipfs-core/src/files/read.js +++ b/packages/interface-ipfs-core/src/files/read.js @@ -7,7 +7,7 @@ const all = require('it-all') const { fixtures } = require('../utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const createShardedDirectory = require('../utils/create-sharded-directory') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ diff --git a/packages/interface-ipfs-core/src/files/rm.js b/packages/interface-ipfs-core/src/files/rm.js index 41c640828a..e44b5e7ddb 100644 --- a/packages/interface-ipfs-core/src/files/rm.js +++ b/packages/interface-ipfs-core/src/files/rm.js @@ -5,7 +5,7 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') const createShardedDirectory = require('../utils/create-sharded-directory') const createTwoShards = require('../utils/create-two-shards') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const isShardAtPath = require('../utils/is-shard-at-path') const testTimeout = require('../utils/test-timeout') diff --git a/packages/interface-ipfs-core/src/files/stat.js b/packages/interface-ipfs-core/src/files/stat.js index e8f5a272f9..d20a65df86 100644 --- a/packages/interface-ipfs-core/src/files/stat.js +++ b/packages/interface-ipfs-core/src/files/stat.js @@ -9,7 +9,7 @@ const createShardedDirectory = require('../utils/create-sharded-directory') const CID = require('cids') const mh = require('multihashing-async').multihash const Block = require('ipld-block') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const isShardAtPath = require('../utils/is-shard-at-path') const testTimeout = require('../utils/test-timeout') diff --git a/packages/interface-ipfs-core/src/files/write.js b/packages/interface-ipfs-core/src/files/write.js index d35e0ed9d7..dd553eb26f 100644 --- a/packages/interface-ipfs-core/src/files/write.js +++ b/packages/interface-ipfs-core/src/files/write.js @@ -10,8 +10,8 @@ const multihash = require('multihashing-async').multihash const traverseLeafNodes = require('../utils/traverse-leaf-nodes') const createShardedDirectory = require('../utils/create-sharded-directory') const createTwoShards = require('../utils/create-two-shards') -const randomBytes = require('iso-random-stream/src/random') -const randomStream = require('iso-random-stream') +const { randomBytes } = require('iso-random-stream') +const { randomStream } = require('iso-random-stream') const all = require('it-all') const isShardAtPath = require('../utils/is-shard-at-path') const testTimeout = require('../utils/test-timeout') diff --git a/packages/interface-ipfs-core/src/object/get.js b/packages/interface-ipfs-core/src/object/get.js index b81ddb6a82..98d8cc25a5 100644 --- a/packages/interface-ipfs-core/src/object/get.js +++ b/packages/interface-ipfs-core/src/object/get.js @@ -6,7 +6,7 @@ const DAGNode = dagPB.DAGNode const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') const { UnixFS } = require('ipfs-unixfs') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const { asDAGLink } = require('./utils') const testTimeout = require('../utils/test-timeout') const CID = require('cids') diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index b1659c11fc..114f0c5647 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -63,7 +63,7 @@ "cids": "^1.1.6", "dag-cbor-links": "^2.0.0", "datastore-core": "^4.0.0", - "datastore-pubsub": "^0.5.0", + "datastore-pubsub": "^0.6.0", "debug": "^4.1.1", "dlv": "^1.1.3", "err-code": "^3.0.1", @@ -103,7 +103,7 @@ "libp2p-mdns": "^0.16.0", "libp2p-mplex": "^0.10.2", "libp2p-noise": "^2.0.5", - "libp2p-record": "^0.10.1", + "libp2p-record": "^0.10.3", "libp2p-tcp": "^0.15.4", "libp2p-webrtc-star": "^0.22.0", "libp2p-websockets": "^0.15.6", diff --git a/packages/ipfs-core/src/components/refs/local.js b/packages/ipfs-core/src/components/refs/local.js index e8a87bdd63..0f0d076e83 100644 --- a/packages/ipfs-core/src/components/refs/local.js +++ b/packages/ipfs-core/src/components/refs/local.js @@ -11,8 +11,7 @@ module.exports = function ({ repo }) { * @type {import('ipfs-core-types/src/refs').API["local"]} */ async function * refsLocal (options = {}) { - // @ts-ignore - TS is not aware of keysOnly - for await (const cid of repo.blocks.query({ keysOnly: true, signal: options.signal })) { + for await (const cid of repo.blocks.queryKeys({ signal: options.signal })) { yield { ref: cid.toString() } } } diff --git a/packages/ipfs-core/src/components/repo/gc.js b/packages/ipfs-core/src/components/repo/gc.js index 060979decc..cc3fdfd138 100644 --- a/packages/ipfs-core/src/components/repo/gc.js +++ b/packages/ipfs-core/src/components/repo/gc.js @@ -42,8 +42,7 @@ module.exports = ({ gcLock, pin, refs, repo }) => { // Mark all blocks that are being used const markedSet = await createMarkedSet({ pin, refs, repo }) // Get all blocks keys from the blockstore - // @ts-ignore - TS is not aware of keysOnly overload - const blockKeys = repo.blocks.queryKeys() + const blockKeys = repo.blocks.queryKeys({}) // Delete blocks that are not being used yield * deleteUnmarkedBlocks({ repo }, markedSet, blockKeys) diff --git a/packages/ipfs-http-server/test/inject/files.js b/packages/ipfs-http-server/test/inject/files.js index f2ba06c9f3..47b2f4a3e0 100644 --- a/packages/ipfs-http-server/test/inject/files.js +++ b/packages/ipfs-http-server/test/inject/files.js @@ -2,7 +2,7 @@ /* eslint-env mocha */ 'use strict' -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const { expect } = require('aegir/utils/chai') const FormData = require('form-data') const streamToPromise = require('stream-to-promise') diff --git a/packages/ipfs-http-server/test/inject/pubsub.js b/packages/ipfs-http-server/test/inject/pubsub.js index 7570b35acc..3b0484c6e9 100644 --- a/packages/ipfs-http-server/test/inject/pubsub.js +++ b/packages/ipfs-http-server/test/inject/pubsub.js @@ -8,7 +8,7 @@ const http = require('../utils/http') const FormData = require('form-data') const sinon = require('sinon') const { AbortSignal } = require('native-abort-controller') -const randomBytes = require('iso-random-stream/src/random') +const { randomBytes } = require('iso-random-stream') const streamToPromise = require('stream-to-promise') const sendData = async (data) => { From e842b5e51965d5b635243f449e04221c52ed295b Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 22 Apr 2021 15:55:18 +0100 Subject: [PATCH 13/24] chore: demand non-broken datastore-pubsub --- packages/ipfs-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 114f0c5647..768b4b5056 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -63,7 +63,7 @@ "cids": "^1.1.6", "dag-cbor-links": "^2.0.0", "datastore-core": "^4.0.0", - "datastore-pubsub": "^0.6.0", + "datastore-pubsub": "^0.6.1", "debug": "^4.1.1", "dlv": "^1.1.3", "err-code": "^3.0.1", From 76067b73cfadac339517e4457d6198c1c65014f4 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Thu, 22 Apr 2021 18:08:43 +0100 Subject: [PATCH 14/24] chore: types --- examples/custom-ipfs-repo/package.json | 2 +- packages/ipfs-cli/package.json | 2 +- packages/ipfs-core/package.json | 2 +- packages/ipfs-core/src/components/refs/local.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/custom-ipfs-repo/package.json b/examples/custom-ipfs-repo/package.json index 058fb84ade..6ddb416f46 100644 --- a/examples/custom-ipfs-repo/package.json +++ b/examples/custom-ipfs-repo/package.json @@ -12,7 +12,7 @@ "dependencies": { "datastore-fs": "4.0.0", "ipfs": "^0.54.4", - "ipfs-repo": "^9.1.0", + "ipfs-repo": "^9.1.1", "it-all": "^1.0.4" }, "devDependencies": { diff --git a/packages/ipfs-cli/package.json b/packages/ipfs-cli/package.json index eef41fab52..edb4951ee9 100644 --- a/packages/ipfs-cli/package.json +++ b/packages/ipfs-cli/package.json @@ -42,7 +42,7 @@ "ipfs-core-utils": "^0.7.2", "ipfs-daemon": "^0.5.4", "ipfs-http-client": "^49.0.4", - "ipfs-repo": "^9.1.0", + "ipfs-repo": "^9.1.1", "ipfs-utils": "^6.0.4", "ipld-dag-cbor": "^0.18.0", "ipld-dag-pb": "^0.22.1", diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 768b4b5056..48f8743167 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -74,7 +74,7 @@ "ipfs-block-service": "^0.19.0", "ipfs-core-types": "^0.3.1", "ipfs-core-utils": "^0.7.2", - "ipfs-repo": "^9.1.0", + "ipfs-repo": "^9.1.1", "ipfs-unixfs": "^4.0.3", "ipfs-unixfs-exporter": "^5.0.3", "ipfs-unixfs-importer": "^7.0.3", diff --git a/packages/ipfs-core/src/components/refs/local.js b/packages/ipfs-core/src/components/refs/local.js index 0f0d076e83..8c03835080 100644 --- a/packages/ipfs-core/src/components/refs/local.js +++ b/packages/ipfs-core/src/components/refs/local.js @@ -11,7 +11,7 @@ module.exports = function ({ repo }) { * @type {import('ipfs-core-types/src/refs').API["local"]} */ async function * refsLocal (options = {}) { - for await (const cid of repo.blocks.queryKeys({ signal: options.signal })) { + for await (const cid of repo.blocks.queryKeys({}, { signal: options.signal })) { yield { ref: cid.toString() } } } From 47780acda77d4dd7dee14bc5281124b66fb0bea7 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 23 Apr 2021 09:12:46 +0100 Subject: [PATCH 15/24] chore: fix examples --- examples/http-client-name-api/package.json | 2 +- examples/ipfs-101/1.js | 3 ++- examples/ipfs-101/test.js | 2 +- examples/ipfs-client-add-files/package.json | 2 +- examples/test-ipfs-example/nightwatch.conf.js | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/http-client-name-api/package.json b/examples/http-client-name-api/package.json index 34beae6eb8..ebe8d1ea3e 100644 --- a/examples/http-client-name-api/package.json +++ b/examples/http-client-name-api/package.json @@ -6,7 +6,7 @@ "private": true, "scripts": { "clean": "rimraf ./dist ./.cache ./.parcel-cache", - "build": "parcel build index.html", + "build": "parcel build index.html --no-scope-hoist", "start": "parcel index.html -p 8888", "test": "test-ipfs-example" }, diff --git a/examples/ipfs-101/1.js b/examples/ipfs-101/1.js index 9f78faf8ae..1850df48ab 100644 --- a/examples/ipfs-101/1.js +++ b/examples/ipfs-101/1.js @@ -4,6 +4,7 @@ const IPFS = require('ipfs') const all = require('it-all') const uint8ArrayConcat = require('uint8arrays/concat') const uint8ArrayFromString = require('uint8arrays/from-string') +const uint8ArrayToString = require('uint8arrays/to-string') async function main () { const node = await IPFS.create() @@ -20,7 +21,7 @@ async function main () { const data = uint8ArrayConcat(await all(node.cat(file.cid))) - console.log('Added file contents:', data.toString()) + console.log('Added file contents:', uint8ArrayToString(data)) } main() diff --git a/examples/ipfs-101/test.js b/examples/ipfs-101/test.js index 5599e0fbed..6c0c70f1bc 100644 --- a/examples/ipfs-101/test.js +++ b/examples/ipfs-101/test.js @@ -6,7 +6,7 @@ const { } = require('test-ipfs-example/utils') async function runTest () { - await waitForOutput('Added file contents:', path.resolve(__dirname, '1.js')) + await waitForOutput('Added file contents: Hello World 101', path.resolve(__dirname, '1.js')) } module.exports = runTest diff --git a/examples/ipfs-client-add-files/package.json b/examples/ipfs-client-add-files/package.json index 5011c88ce3..70afb111f3 100644 --- a/examples/ipfs-client-add-files/package.json +++ b/examples/ipfs-client-add-files/package.json @@ -6,7 +6,7 @@ "private": true, "scripts": { "clean": "rimraf ./dist ./.cache ./.parcel-cache", - "build": "parcel build index.html", + "build": "parcel build index.html --no-scope-hoist", "start": "parcel index.html -p 8888", "test": "test-ipfs-example" }, diff --git a/examples/test-ipfs-example/nightwatch.conf.js b/examples/test-ipfs-example/nightwatch.conf.js index f204609075..524dc76a6b 100644 --- a/examples/test-ipfs-example/nightwatch.conf.js +++ b/examples/test-ipfs-example/nightwatch.conf.js @@ -24,7 +24,7 @@ module.exports = { desiredCapabilities: { browserName: 'chrome', chromeOptions: { - //args: ['headless'] + args: ['headless'] } } } From 5cf6f5bbfc41297f28f18d791866db7b3f18125b Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Fri, 23 Apr 2021 16:21:24 +0200 Subject: [PATCH 16/24] fix: interface core test swarm peers with webrtc does not dial the correct address (#3633) Error in CI: https://travis-ci.com/github/ipfs/js-ipfs/jobs/500525900 In the past webrtc did not proper support multiple listeners. This basically mean that if trying to listen on multiple addresses the webrtc sdp offers could end up with wrong signal server address throwing random errors in CI. https://github.com/libp2p/js-libp2p-webrtc-star/pull/330 fixed this and now a libp2p node allows multiple listeners. When a peer with multiple webrtc-star listeners attempts to dial another peer via a star signalling server, the signal server of the target peers is identified among the listeners and used for starting the dial. In the test changed in this PR (note that ports might change): ``` nodeA: ['/ip4/127.0.0.1/tcp/53466/ws/p2p-webrtcstar/p2p/QmPqSo3Kqf9XtWG6g3WKVrx2PZ2q3BoFZssVjixaweABNW'] nodeB: [ '/ip4/127.0.0.1/tcp/53466/ws/p2p-webrtc-star/p2p/QmNLojvkVdRTD2bmy7Yzpc7vUBv6bUDEpamrgQeRwPQAg1', '/ip4/127.0.0.1/tcp/53467/ws/p2p-webrtc-star/p2p/QmNLojvkVdRTD2bmy7Yzpc7vUBv6bUDEpamrgQeRwPQAg1' ] ``` and the test did: ``` await nodeA.swarm.connect(nodeB.peerId.addresses[isBrowser ? 1 : 0]) ``` We were using nodeA to dial nodeB with an address of a signalServer it does not use, which obviously failed. The solution here is to either have nodeB dial nodeA address (has same signalServer), or we need to do in the test a match function to understand what address of nodeB we should use (with the same signalServer). The error in CI is poor and webrtc-star should validate we actually have the listener for the signalServer and throw a proper error if not instead of the Cannot read property 'listener' of undefined. This will be fixed shortly in a new PR --- packages/interface-ipfs-core/src/swarm/peers.js | 5 +---- packages/ipfs-core/package.json | 2 +- packages/ipfs-daemon/package.json | 2 +- packages/ipfs/package.json | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index 1d4c5197a9..c26f21d68a 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -126,10 +126,7 @@ module.exports = (common, options) => { } })).api - // TODO: the webrtc-star transport only keeps the last listened on address around - // so the browser has to use 1 as the array index - // await nodeA.swarm.connect(nodeB.peerId.addresses[0]) - await nodeA.swarm.connect(nodeB.peerId.addresses[isBrowser ? 1 : 0]) + await nodeB.swarm.connect(nodeA.peerId.addresses[0]) await delay(1000) const peersA = await nodeA.swarm.peers() diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index 48f8743167..fd49716f4c 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -105,7 +105,7 @@ "libp2p-noise": "^2.0.5", "libp2p-record": "^0.10.3", "libp2p-tcp": "^0.15.4", - "libp2p-webrtc-star": "^0.22.0", + "libp2p-webrtc-star": "^0.22.2", "libp2p-websockets": "^0.15.6", "mafmt": "^9.0.0", "merge-options": "^3.0.4", diff --git a/packages/ipfs-daemon/package.json b/packages/ipfs-daemon/package.json index 438f6986a3..351fa31abd 100644 --- a/packages/ipfs-daemon/package.json +++ b/packages/ipfs-daemon/package.json @@ -43,7 +43,7 @@ "libp2p": "^0.31.0-rc.6", "libp2p-delegated-content-routing": "^0.10.0", "libp2p-delegated-peer-routing": "^0.9.0", - "libp2p-webrtc-star": "^0.22.0", + "libp2p-webrtc-star": "^0.22.2", "multiaddr": "^9.0.1" }, "devDependencies": { diff --git a/packages/ipfs/package.json b/packages/ipfs/package.json index c520761d8f..69ae0b8dd5 100644 --- a/packages/ipfs/package.json +++ b/packages/ipfs/package.json @@ -60,7 +60,7 @@ "ipfs-utils": "^6.0.4", "ipfsd-ctl": "^8.0.1", "iso-url": "^1.0.0", - "libp2p-webrtc-star": "^0.22.0", + "libp2p-webrtc-star": "^0.22.2", "merge-options": "^3.0.4", "mock-ipfs-pinning-service": "^0.1.2", "rimraf": "^3.0.2", From 7ddd62023b045f40861223575b309fd0ec4c66a3 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 23 Apr 2021 19:17:47 +0100 Subject: [PATCH 17/24] chore: update it-multipart and it-tar --- packages/ipfs-http-client/package.json | 2 +- packages/ipfs-http-server/package.json | 2 +- .../src/utils/multipart-request-parser.js | 16 +++------------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/ipfs-http-client/package.json b/packages/ipfs-http-client/package.json index f90deee443..98bcdeb066 100644 --- a/packages/ipfs-http-client/package.json +++ b/packages/ipfs-http-client/package.json @@ -60,7 +60,7 @@ "ipld-raw": "^7.0.0", "it-last": "^1.0.4", "it-map": "^1.0.4", - "it-tar": "^2.0.0", + "it-tar": "^3.0.0", "it-to-stream": "^1.0.0", "merge-options": "^3.0.4", "multiaddr": "^9.0.1", diff --git a/packages/ipfs-http-server/package.json b/packages/ipfs-http-server/package.json index f53febdb89..4cb4115209 100644 --- a/packages/ipfs-http-server/package.json +++ b/packages/ipfs-http-server/package.json @@ -49,7 +49,7 @@ "it-first": "^1.0.4", "it-last": "^1.0.4", "it-map": "^1.0.4", - "it-multipart": "^1.0.8", + "it-multipart": "^2.0.0", "it-pipe": "^1.1.0", "it-tar": "^3.0.0", "it-to-stream": "^1.0.0", diff --git a/packages/ipfs-http-server/src/utils/multipart-request-parser.js b/packages/ipfs-http-server/src/utils/multipart-request-parser.js index 49f4b41578..b48c842d76 100644 --- a/packages/ipfs-http-server/src/utils/multipart-request-parser.js +++ b/packages/ipfs-http-server/src/utils/multipart-request-parser.js @@ -77,13 +77,6 @@ async function * parseEntry (stream) { const type = Content.type(part.headers['content-type']) - if (type.boundary) { - // recursively parse nested multiparts - yield * parseEntry(multipart(part.body, type.boundary)) - - continue - } - if (!part.headers['content-disposition']) { throw new Error('No content disposition in multipart part') } @@ -131,11 +124,10 @@ const readQueryParam = value => Array.isArray(value) ? value[0] : value /** * @param {AsyncIterable} stream - * @param {string} boundary * @returns {AsyncGenerator} */ -async function * parser (stream, boundary) { - for await (const entry of parseEntry(multipart(stream, boundary))) { +async function * parser (stream) { + for await (const entry of parseEntry(multipart(stream))) { if (entry.type === 'directory') { /** @type {import('../types').MultipartDirectory} */ yield { @@ -178,7 +170,5 @@ async function * parser (stream, boundary) { * @param {IncomingMessage} req */ module.exports = (req) => { - const boundary = Content.type(req.headers['content-type']).boundary - - return parser(req, boundary) + return parser(req) } From a76d301838e74d29e9cf7c119590d300947bedd6 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 23 Apr 2021 19:25:03 +0100 Subject: [PATCH 18/24] chore: fix up types --- .../src/utils/multipart-request-parser.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/ipfs-http-server/src/utils/multipart-request-parser.js b/packages/ipfs-http-server/src/utils/multipart-request-parser.js index b48c842d76..e9e349a654 100644 --- a/packages/ipfs-http-server/src/utils/multipart-request-parser.js +++ b/packages/ipfs-http-server/src/utils/multipart-request-parser.js @@ -123,7 +123,7 @@ async function * parseEntry (stream) { const readQueryParam = value => Array.isArray(value) ? value[0] : value /** - * @param {AsyncIterable} stream + * @param {IncomingMessage} stream * @returns {AsyncGenerator} */ async function * parser (stream) { @@ -164,11 +164,4 @@ async function * parser (stream) { } } -/** - * Request Parser - * - * @param {IncomingMessage} req - */ -module.exports = (req) => { - return parser(req) -} +module.exports = parser From e2a91affb6cfd360aba0bb68494452b7166f66d5 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 26 Apr 2021 15:14:47 +0100 Subject: [PATCH 19/24] chore: update bundle sizes, skip tests with playwright bug --- examples/custom-libp2p/package.json | 2 +- .../src/bitswap/transfer.js | 2 +- packages/ipfs-client/.aegir.js | 2 +- packages/ipfs-core/.aegir.js | 2 +- packages/ipfs-core/package.json | 2 +- packages/ipfs-grpc-client/.aegir.js | 2 +- packages/ipfs-http-client/.aegir.js | 2 +- packages/ipfs-message-port-client/.aegir.js | 2 +- packages/ipfs-message-port-server/.aegir.js | 2 +- packages/ipfs/.aegir.js | 2 +- packages/ipfs/test/interface-http-go.js | 46 ++++++++++++++++- packages/ipfs/test/interface-http-js.js | 50 +++++++++++++++++-- 12 files changed, 101 insertions(+), 15 deletions(-) diff --git a/examples/custom-libp2p/package.json b/examples/custom-libp2p/package.json index 527fc70d33..5b73f6c230 100644 --- a/examples/custom-libp2p/package.json +++ b/examples/custom-libp2p/package.json @@ -16,7 +16,7 @@ "libp2p-kad-dht": "libp2p/js-libp2p-kad-dht#chore/update-deps-12-04-2021", "libp2p-mdns": "^0.16.0", "libp2p-mplex": "^0.10.2", - "libp2p-noise": "^2.0.5", + "libp2p-noise": "^3.0.0", "libp2p-tcp": "^0.15.4" }, "devDependencies": { diff --git a/packages/interface-ipfs-core/src/bitswap/transfer.js b/packages/interface-ipfs-core/src/bitswap/transfer.js index 88755d1bfa..1af720055c 100644 --- a/packages/interface-ipfs-core/src/bitswap/transfer.js +++ b/packages/interface-ipfs-core/src/bitswap/transfer.js @@ -75,7 +75,7 @@ module.exports = (factory, options) => { describe('transfer a file between', () => { it('2 peers', async () => { - const content = randomBytes(1024 * 1024 * 10) + const content = randomBytes(1024) const remote = (await factory.spawn({ type: isWebWorker ? 'go' : undefined })).api const local = (await factory.spawn({ type: 'proc', ipfsOptions })).api local.swarm.connect(remote.peerId.addresses[0]) diff --git a/packages/ipfs-client/.aegir.js b/packages/ipfs-client/.aegir.js index 358a154f0b..3e94bf32cf 100644 --- a/packages/ipfs-client/.aegir.js +++ b/packages/ipfs-client/.aegir.js @@ -3,6 +3,6 @@ /** @type {import('aegir').PartialOptions} */ module.exports = { build: { - bundlesizeMax: '137kB' + bundlesizeMax: '127kB' } } diff --git a/packages/ipfs-core/.aegir.js b/packages/ipfs-core/.aegir.js index 73bad951ae..35c38a3a8c 100644 --- a/packages/ipfs-core/.aegir.js +++ b/packages/ipfs-core/.aegir.js @@ -70,7 +70,7 @@ module.exports = { } }, build: { - bundlesizeMax: '614kB', + bundlesizeMax: '542KB', config: esbuild } } diff --git a/packages/ipfs-core/package.json b/packages/ipfs-core/package.json index fd49716f4c..c13b62e3d3 100644 --- a/packages/ipfs-core/package.json +++ b/packages/ipfs-core/package.json @@ -102,7 +102,7 @@ "libp2p-kad-dht": "libp2p/js-libp2p-kad-dht#chore/update-deps-12-04-2021", "libp2p-mdns": "^0.16.0", "libp2p-mplex": "^0.10.2", - "libp2p-noise": "^2.0.5", + "libp2p-noise": "^3.0.0", "libp2p-record": "^0.10.3", "libp2p-tcp": "^0.15.4", "libp2p-webrtc-star": "^0.22.2", diff --git a/packages/ipfs-grpc-client/.aegir.js b/packages/ipfs-grpc-client/.aegir.js index 9549fd1c7a..4dc0a9fba2 100644 --- a/packages/ipfs-grpc-client/.aegir.js +++ b/packages/ipfs-grpc-client/.aegir.js @@ -3,6 +3,6 @@ /** @type {import('aegir').PartialOptions} */ module.exports = { build: { - bundlesizeMax: '65KB' + bundlesizeMax: '56KB' } } diff --git a/packages/ipfs-http-client/.aegir.js b/packages/ipfs-http-client/.aegir.js index 63eb11ed9d..149fff9487 100644 --- a/packages/ipfs-http-client/.aegir.js +++ b/packages/ipfs-http-client/.aegir.js @@ -6,7 +6,7 @@ const getPort = require('aegir/utils/get-port') /** @type {import('aegir').PartialOptions} */ module.exports = { build: { - bundlesizeMax: '106kB' + bundlesizeMax: '96KB' }, test: { async before (options) { diff --git a/packages/ipfs-message-port-client/.aegir.js b/packages/ipfs-message-port-client/.aegir.js index ab363f4a28..26fecf0923 100644 --- a/packages/ipfs-message-port-client/.aegir.js +++ b/packages/ipfs-message-port-client/.aegir.js @@ -21,7 +21,7 @@ const buildConfig = { /** @type {import('aegir').PartialOptions} */ module.exports = { build: { - bundlesizeMax: '47kB', + bundlesizeMax: '32KB', config: buildConfig }, test: { diff --git a/packages/ipfs-message-port-server/.aegir.js b/packages/ipfs-message-port-server/.aegir.js index bafbe7e4db..7309e2a5d4 100644 --- a/packages/ipfs-message-port-server/.aegir.js +++ b/packages/ipfs-message-port-server/.aegir.js @@ -3,6 +3,6 @@ /** @type {import('aegir').PartialOptions} */ module.exports = { build: { - bundlesizeMax: '22kB' + bundlesizeMax: '13KB' } } diff --git a/packages/ipfs/.aegir.js b/packages/ipfs/.aegir.js index 03566736d0..28b69a93f5 100644 --- a/packages/ipfs/.aegir.js +++ b/packages/ipfs/.aegir.js @@ -118,7 +118,7 @@ module.exports = { } }, build: { - bundlesizeMax: '614kB', + bundlesizeMax: '542KB', config: esbuild }, dependencyCheck: { diff --git a/packages/ipfs/test/interface-http-go.js b/packages/ipfs/test/interface-http-go.js index add166de8b..e52bc7e9d4 100644 --- a/packages/ipfs/test/interface-http-go.js +++ b/packages/ipfs/test/interface-http-go.js @@ -3,7 +3,8 @@ const tests = require('interface-ipfs-core') const factory = require('./utils/factory') -const isWindows = global.process && global.process.platform && global.process.platform === 'win32' +const isWindows = globalThis.process && globalThis.process.platform && globalThis.process.platform === 'win32' +const isFirefox = globalThis.navigator?.userAgent?.toLowerCase().includes('firefox') /** @typedef {import("ipfsd-ctl").ControllerOptions} ControllerOptions */ @@ -70,7 +71,18 @@ describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () = name: 'should error during add-all stream', reason: 'Not supported by http' } - ] + ].concat(isFirefox + ? [{ + name: 'should add a BIG Uint8Array', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'should add a BIG Uint8Array with progress enabled', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'should add big files', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }] + : []) }) tests.bitswap(commonFactory, { @@ -461,6 +473,30 @@ describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () = reason: 'TODO go-ipfs drops the connection' } ] + .concat(isFirefox + ? [{ + name: 'overwrites start of a file without truncating (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'limits how many bytes to write to a file (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'pads the start of a new file when an offset is specified (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'expands a file when an offset is specified (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'expands a file when an offset is specified and the offset is longer than the file (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'truncates a file after writing (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'writes a file with raw blocks for newly created leaf nodes (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }] + : []) }) tests.key(commonFactory, { @@ -575,6 +611,12 @@ describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () = reason: 'FIXME go-ipfs throws invalid encoding: protobuf' } ] + .concat(isFirefox + ? [{ + name: 'should supply unaltered data', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }] + : []) }) tests.pin(commonFactory, { diff --git a/packages/ipfs/test/interface-http-js.js b/packages/ipfs/test/interface-http-js.js index 912d854388..5749d77c86 100644 --- a/packages/ipfs/test/interface-http-js.js +++ b/packages/ipfs/test/interface-http-js.js @@ -4,6 +4,7 @@ const tests = require('interface-ipfs-core') const { isNode, isBrowser, isWebWorker } = require('ipfs-utils/src/env') const factory = require('./utils/factory') +const isFirefox = globalThis.navigator?.userAgent?.toLowerCase().includes('firefox') /** @typedef { import("ipfsd-ctl").ControllerOptions } ControllerOptions */ @@ -36,6 +37,18 @@ describe('interface-ipfs-core over ipfs-http-client tests against js-ipfs', func name: 'should add with mtime as hrtime', reason: 'Not designed to run in the browser' }]) + .concat(isFirefox + ? [{ + name: 'should add a BIG Uint8Array', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'should add a BIG Uint8Array with progress enabled', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'should add big files', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }] + : []) }) tests.bitswap(commonFactory) @@ -63,7 +76,7 @@ describe('interface-ipfs-core over ipfs-http-client tests against js-ipfs', func }) tests.files(commonFactory, { - skip: isBrowser || isWebWorker + skip: (isBrowser || isWebWorker ? [{ name: 'should make directory and specify mtime as hrtime', reason: 'Not designed to run in the browser' @@ -74,7 +87,31 @@ describe('interface-ipfs-core over ipfs-http-client tests against js-ipfs', func name: 'should set mtime as hrtime', reason: 'Not designed to run in the browser' }] - : [] + : []) + .concat(isFirefox + ? [{ + name: 'overwrites start of a file without truncating (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'limits how many bytes to write to a file (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'pads the start of a new file when an offset is specified (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'expands a file when an offset is specified (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'expands a file when an offset is specified and the offset is longer than the file (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'truncates a file after writing (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }, { + name: 'writes a file with raw blocks for newly created leaf nodes (Really large file)', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }] + : []) }) tests.key(commonFactory) @@ -98,7 +135,14 @@ describe('interface-ipfs-core over ipfs-http-client tests against js-ipfs', func } })) - tests.object(commonFactory) + tests.object(commonFactory, { + skip: isFirefox + ? [{ + name: 'should supply unaltered data', + reason: 'https://github.com/microsoft/playwright/issues/4704#issuecomment-826782602' + }] + : [] + }) tests.pin(commonFactory, { skip: [{ From 3b6bb578f898da5f8898fe04d28a8a231ee4ce16 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 26 Apr 2021 16:05:35 +0100 Subject: [PATCH 20/24] chore: fix tests and make peer ids cids again --- docs/core-api/BITSWAP.md | 2 +- packages/interface-ipfs-core/src/swarm/peers.js | 9 ++++++++- packages/ipfs-core-types/src/bitswap/index.d.ts | 2 +- packages/ipfs-core/src/components/bitswap/stat.js | 3 +-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/core-api/BITSWAP.md b/docs/core-api/BITSWAP.md index b882f55367..8c4eb0c62f 100644 --- a/docs/core-api/BITSWAP.md +++ b/docs/core-api/BITSWAP.md @@ -159,7 +159,7 @@ The returned object contains the following keys: - `provideBufLen` is an integer. - `wantlist` (array of [CID][cid]s) -- `peers` (array of peer IDs represented by CIDs) +- `peers` (array of peer IDs represented by strings) - `blocksReceived` is a [BigInt][1] - `dataReceived` is a [BigInt][1] - `blocksSent` is a [BigInt][1] diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index c26f21d68a..bd206d98f5 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -118,7 +118,12 @@ module.exports = (common, options) => { '/ip4/127.0.0.1/tcp/26546/ws' ]) - const nodeA = (await common.spawn({ type: 'proc', ipfsOptions })).api + const nodeA = (await common.spawn({ + // browser nodes have webrtc-star addresses which can't be dialled by go so make the other + // peer a js-ipfs node to get a tcp address that can be dialled + type: isBrowser && common.opts.type === 'go' ? 'js' : 'proc', + ipfsOptions + })).api const nodeB = (await common.spawn({ type: isWebWorker ? 'go' : undefined, ipfsOptions: { @@ -126,6 +131,8 @@ module.exports = (common, options) => { } })).api + console.info(nodeA.peerId.addresses.map(addr => addr.toString())) + await nodeB.swarm.connect(nodeA.peerId.addresses[0]) await delay(1000) diff --git a/packages/ipfs-core-types/src/bitswap/index.d.ts b/packages/ipfs-core-types/src/bitswap/index.d.ts index 7737cb222b..e5cf40e119 100644 --- a/packages/ipfs-core-types/src/bitswap/index.d.ts +++ b/packages/ipfs-core-types/src/bitswap/index.d.ts @@ -60,7 +60,7 @@ export interface API { export interface Stats { provideBufLen: number wantlist: CID[] - peers: CID[] + peers: string[] blocksReceived: BigInt dataReceived: BigInt blocksSent: BigInt diff --git a/packages/ipfs-core/src/components/bitswap/stat.js b/packages/ipfs-core/src/components/bitswap/stat.js index fae73a9cff..5301c41005 100644 --- a/packages/ipfs-core/src/components/bitswap/stat.js +++ b/packages/ipfs-core/src/components/bitswap/stat.js @@ -1,6 +1,5 @@ 'use strict' -const CID = require('cids') const withTimeoutOption = require('ipfs-core-utils/src/with-timeout-option') /** @@ -20,7 +19,7 @@ module.exports = ({ network }) => { provideBufLen: parseInt(snapshot.providesBufferLength.toString()), blocksReceived: BigInt(snapshot.blocksReceived.toString()), wantlist: Array.from(bitswap.getWantlist()).map(e => e[1].cid), - peers: bitswap.peers().map(id => new CID(id.toB58String())), + peers: bitswap.peers().map(id => id.toB58String()), dupBlksReceived: BigInt(snapshot.dupBlksReceived.toString()), dupDataReceived: BigInt(snapshot.dupDataReceived.toString()), dataReceived: BigInt(snapshot.dataReceived.toString()), From 68a659ebb7daa1d233cc64ff86785633d159d28b Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 26 Apr 2021 16:24:25 +0100 Subject: [PATCH 21/24] chore: fix linting and reduce number of timeout tests --- packages/interface-ipfs-core/src/add-all.js | 7 ------- packages/interface-ipfs-core/src/add.js | 7 ------- packages/interface-ipfs-core/src/bitswap/stat.js | 7 ------- .../src/bitswap/wantlist-for-peer.js | 7 ------- packages/interface-ipfs-core/src/block/put.js | 7 ------- packages/interface-ipfs-core/src/bootstrap/add.js | 7 ------- .../interface-ipfs-core/src/bootstrap/clear.js | 7 ------- .../interface-ipfs-core/src/bootstrap/list.js | 7 ------- .../interface-ipfs-core/src/bootstrap/reset.js | 7 ------- packages/interface-ipfs-core/src/bootstrap/rm.js | 7 ------- packages/interface-ipfs-core/src/config/get.js | 13 ------------- .../src/config/profiles/apply.js | 7 ------- .../src/config/profiles/list.js | 7 ------- .../interface-ipfs-core/src/config/replace.js | 7 ------- packages/interface-ipfs-core/src/config/set.js | 7 ------- packages/interface-ipfs-core/src/dag/put.js | 9 --------- packages/interface-ipfs-core/src/dht/provide.js | 9 --------- packages/interface-ipfs-core/src/dht/put.js | 11 ----------- packages/interface-ipfs-core/src/files/chmod.js | 13 ------------- packages/interface-ipfs-core/src/files/cp.js | 7 ------- packages/interface-ipfs-core/src/files/flush.js | 7 ------- packages/interface-ipfs-core/src/files/ls.js | 8 -------- packages/interface-ipfs-core/src/files/mkdir.js | 7 ------- packages/interface-ipfs-core/src/files/mv.js | 15 --------------- packages/interface-ipfs-core/src/files/read.js | 14 -------------- packages/interface-ipfs-core/src/files/rm.js | 14 -------------- packages/interface-ipfs-core/src/files/stat.js | 10 ---------- packages/interface-ipfs-core/src/files/touch.js | 7 ------- packages/interface-ipfs-core/src/files/write.js | 8 -------- packages/interface-ipfs-core/src/key/gen.js | 9 --------- packages/interface-ipfs-core/src/key/import.js | 12 ------------ packages/interface-ipfs-core/src/key/list.js | 7 ------- packages/interface-ipfs-core/src/key/rename.js | 11 ----------- packages/interface-ipfs-core/src/key/rm.js | 10 ---------- .../interface-ipfs-core/src/miscellaneous/dns.js | 7 ------- .../interface-ipfs-core/src/miscellaneous/id.js | 7 ------- .../src/miscellaneous/resolve.js | 7 ------- .../interface-ipfs-core/src/miscellaneous/stop.js | 7 ------- .../src/miscellaneous/version.js | 7 ------- .../interface-ipfs-core/src/name-pubsub/cancel.js | 7 ------- .../interface-ipfs-core/src/name-pubsub/state.js | 7 ------- .../interface-ipfs-core/src/name-pubsub/subs.js | 7 ------- packages/interface-ipfs-core/src/name/publish.js | 8 -------- packages/interface-ipfs-core/src/object/data.js | 8 -------- packages/interface-ipfs-core/src/object/get.js | 8 -------- packages/interface-ipfs-core/src/object/links.js | 8 -------- packages/interface-ipfs-core/src/object/new.js | 7 ------- .../src/object/patch/add-link.js | 8 -------- .../src/object/patch/append-data.js | 8 -------- .../src/object/patch/rm-link.js | 8 -------- .../src/object/patch/set-data.js | 8 -------- packages/interface-ipfs-core/src/object/put.js | 7 ------- packages/interface-ipfs-core/src/object/stat.js | 8 -------- packages/interface-ipfs-core/src/pin/add-all.js | 8 -------- packages/interface-ipfs-core/src/pin/add.js | 8 -------- packages/interface-ipfs-core/src/pin/ls.js | 7 ------- .../interface-ipfs-core/src/pin/remote/add.js | 9 --------- packages/interface-ipfs-core/src/pin/remote/ls.js | 8 -------- .../interface-ipfs-core/src/pin/remote/rm-all.js | 8 -------- packages/interface-ipfs-core/src/pin/remote/rm.js | 8 -------- packages/interface-ipfs-core/src/pin/rm-all.js | 10 ---------- packages/interface-ipfs-core/src/pin/rm.js | 10 ---------- packages/interface-ipfs-core/src/ping/ping.js | 8 -------- packages/interface-ipfs-core/src/pubsub/ls.js | 7 ------- packages/interface-ipfs-core/src/pubsub/peers.js | 7 ------- .../interface-ipfs-core/src/pubsub/publish.js | 7 ------- packages/interface-ipfs-core/src/refs-local.js | 7 ------- packages/interface-ipfs-core/src/repo/gc.js | 7 ------- packages/interface-ipfs-core/src/repo/stat.js | 7 ------- packages/interface-ipfs-core/src/repo/version.js | 7 ------- packages/interface-ipfs-core/src/stats/bitswap.js | 7 ------- packages/interface-ipfs-core/src/stats/bw.js | 7 ------- packages/interface-ipfs-core/src/stats/repo.js | 7 ------- packages/interface-ipfs-core/src/swarm/addrs.js | 7 ------- packages/interface-ipfs-core/src/swarm/connect.js | 7 ------- .../interface-ipfs-core/src/swarm/disconnect.js | 7 ------- .../interface-ipfs-core/src/swarm/local-addrs.js | 7 ------- packages/interface-ipfs-core/src/swarm/peers.js | 9 --------- packages/ipfs/test/interface-http-go.js | 12 ------------ 79 files changed, 644 deletions(-) diff --git a/packages/interface-ipfs-core/src/add-all.js b/packages/interface-ipfs-core/src/add-all.js index b83abc55b7..84667f2c8c 100644 --- a/packages/interface-ipfs-core/src/add-all.js +++ b/packages/interface-ipfs-core/src/add-all.js @@ -13,7 +13,6 @@ const { supportsFileReader } = require('ipfs-utils/src/supports') const globSource = require('ipfs-utils/src/files/glob-source') const { isNode } = require('ipfs-utils/src/env') const { getDescribe, getIt, expect } = require('./utils/mocha') -const testTimeout = require('./utils/test-timeout') const uint8ArrayFromString = require('uint8arrays/from-string') const bufferStream = require('it-buffer-stream') @@ -61,12 +60,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when adding files', () => { - return testTimeout(() => drain(ipfs.addAll(uint8ArrayFromString('Hello'), { - timeout: 1 - }))) - }) - it('should add a File as array of tuples', async function () { if (!supportsFileReader) return this.skip('skip in node') diff --git a/packages/interface-ipfs-core/src/add.js b/packages/interface-ipfs-core/src/add.js index 4be482f5ac..d62af444dc 100644 --- a/packages/interface-ipfs-core/src/add.js +++ b/packages/interface-ipfs-core/src/add.js @@ -7,7 +7,6 @@ const { supportsFileReader } = require('ipfs-utils/src/supports') const urlSource = require('ipfs-utils/src/files/url-source') const { isNode } = require('ipfs-utils/src/env') const { getDescribe, getIt, expect } = require('./utils/mocha') -const testTimeout = require('./utils/test-timeout') const echoUrl = (text) => `${process.env.ECHO_SERVER}/download?data=${encodeURIComponent(text)}` const redirectUrl = (url) => `${process.env.ECHO_SERVER}/redirect?to=${encodeURI(url)}` const uint8ArrayFromString = require('uint8arrays/from-string') @@ -55,12 +54,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when adding a file', () => { - return testTimeout(() => ipfs.add('Hello', { - timeout: 1 - })) - }) - it('should add a File', async function () { if (!supportsFileReader) return this.skip('skip in node') diff --git a/packages/interface-ipfs-core/src/bitswap/stat.js b/packages/interface-ipfs-core/src/bitswap/stat.js index bb1386fe13..7dd1264238 100644 --- a/packages/interface-ipfs-core/src/bitswap/stat.js +++ b/packages/interface-ipfs-core/src/bitswap/stat.js @@ -3,7 +3,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { expectIsBitswap } = require('../stats/utils') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -24,12 +23,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting bitswap stats', () => { - return testTimeout(() => ipfs.bitswap.stat({ - timeout: 1 - })) - }) - it('should get bitswap stats', async () => { const res = await ipfs.bitswap.stat() expectIsBitswap(null, res) diff --git a/packages/interface-ipfs-core/src/bitswap/wantlist-for-peer.js b/packages/interface-ipfs-core/src/bitswap/wantlist-for-peer.js index 47e5ceb0ab..1ca5dce2b9 100644 --- a/packages/interface-ipfs-core/src/bitswap/wantlist-for-peer.js +++ b/packages/interface-ipfs-core/src/bitswap/wantlist-for-peer.js @@ -4,7 +4,6 @@ const { getDescribe, getIt } = require('../utils/mocha') const { waitForWantlistKey } = require('./utils') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -36,12 +35,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting bitswap wantlist by peer', () => { - return testTimeout(() => ipfsA.bitswap.wantlistForPeer(ipfsB.peerId.id, { - timeout: 1 - })) - }) - it('should get the wantlist by peer ID for a different node', function () { return waitForWantlistKey(ipfsA, key, { peerId: ipfsB.peerId.id, diff --git a/packages/interface-ipfs-core/src/block/put.js b/packages/interface-ipfs-core/src/block/put.js index 43a14216b1..3be1ca96a8 100644 --- a/packages/interface-ipfs-core/src/block/put.js +++ b/packages/interface-ipfs-core/src/block/put.js @@ -6,7 +6,6 @@ const Block = require('ipld-block') const multihash = require('multihashing-async').multihash const CID = require('cids') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const all = require('it-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -27,12 +26,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when putting a block', () => { - return testTimeout(() => ipfs.block.put(uint8ArrayFromString('derp'), { - timeout: 1 - })) - }) - it('should put a buffer, using defaults', async () => { const expectedHash = 'QmPv52ekjS75L4JmHpXVeuJ5uX2ecSfSZo88NSyxwA3rAQ' const blob = uint8ArrayFromString('blorb') diff --git a/packages/interface-ipfs-core/src/bootstrap/add.js b/packages/interface-ipfs-core/src/bootstrap/add.js index a9ec9e1ef4..2b931bd98e 100644 --- a/packages/interface-ipfs-core/src/bootstrap/add.js +++ b/packages/interface-ipfs-core/src/bootstrap/add.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const { Multiaddr } = require('multiaddr') const invalidArg = 'this/Is/So/Invalid/' @@ -28,12 +27,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when adding bootstrap nodes', () => { - return testTimeout(() => ipfs.bootstrap.add(validIp4, { - timeout: 1 - })) - }) - it('should return an error when called with an invalid arg', () => { return expect(ipfs.bootstrap.add(invalidArg)).to.eventually.be.rejected .and.be.an.instanceOf(Error) diff --git a/packages/interface-ipfs-core/src/bootstrap/clear.js b/packages/interface-ipfs-core/src/bootstrap/clear.js index f599999503..6fd49162d6 100644 --- a/packages/interface-ipfs-core/src/bootstrap/clear.js +++ b/packages/interface-ipfs-core/src/bootstrap/clear.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -25,12 +24,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when removing bootstrap nodes', () => { - return testTimeout(() => ipfs.bootstrap.clear({ - timeout: 1 - })) - }) - it('should return a list containing the peer removed when called with a valid arg (ip4)', async () => { await ipfs.bootstrap.clear() diff --git a/packages/interface-ipfs-core/src/bootstrap/list.js b/packages/interface-ipfs-core/src/bootstrap/list.js index 72ffa6d7f4..53d30b88d1 100644 --- a/packages/interface-ipfs-core/src/bootstrap/list.js +++ b/packages/interface-ipfs-core/src/bootstrap/list.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option listing bootstrap nodes', () => { - return testTimeout(() => ipfs.bootstrap.list({ - timeout: 1 - })) - }) - it('should return a list of peers', async () => { const res = await ipfs.bootstrap.list() diff --git a/packages/interface-ipfs-core/src/bootstrap/reset.js b/packages/interface-ipfs-core/src/bootstrap/reset.js index 628b8113be..334c6922c4 100644 --- a/packages/interface-ipfs-core/src/bootstrap/reset.js +++ b/packages/interface-ipfs-core/src/bootstrap/reset.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -25,12 +24,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when resetting the bootstrap nodes', () => { - return testTimeout(() => ipfs.bootstrap.reset({ - timeout: 1 - })) - }) - it('should return a list of bootstrap peers when resetting the bootstrap nodes', async () => { const res = await ipfs.bootstrap.reset() diff --git a/packages/interface-ipfs-core/src/bootstrap/rm.js b/packages/interface-ipfs-core/src/bootstrap/rm.js index 51cb08d9de..cb8e22af0f 100644 --- a/packages/interface-ipfs-core/src/bootstrap/rm.js +++ b/packages/interface-ipfs-core/src/bootstrap/rm.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const { Multiaddr } = require('multiaddr') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -26,12 +25,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when removing bootstrap nodes', () => { - return testTimeout(() => ipfs.bootstrap.rm(validIp4, { - timeout: 1 - })) - }) - it('should return an error when called with an invalid arg', () => { return expect(ipfs.bootstrap.rm(invalidArg)).to.eventually.be.rejected .and.be.an.instanceOf(Error) diff --git a/packages/interface-ipfs-core/src/config/get.js b/packages/interface-ipfs-core/src/config/get.js index 5071e6f93c..f65521af91 100644 --- a/packages/interface-ipfs-core/src/config/get.js +++ b/packages/interface-ipfs-core/src/config/get.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -21,12 +20,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting config values', () => { - return testTimeout(() => ipfs.config.get('Identity.PeerID', { - timeout: 1 - })) - }) - it('should fail with error', async () => { await expect(ipfs.config.get()).to.eventually.rejectedWith('key argument is required') }) @@ -58,12 +51,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting config values', () => { - return testTimeout(() => ipfs.config.getAll({ - timeout: 1 - })) - }) - it('should retrieve the whole config', async () => { const config = await ipfs.config.getAll() diff --git a/packages/interface-ipfs-core/src/config/profiles/apply.js b/packages/interface-ipfs-core/src/config/profiles/apply.js index d0980cd4d9..2e05dfa4b9 100644 --- a/packages/interface-ipfs-core/src/config/profiles/apply.js +++ b/packages/interface-ipfs-core/src/config/profiles/apply.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when applying a config profile', () => { - return testTimeout(() => ipfs.config.profiles.apply('server', { - timeout: 1 - })) - }) - it('should apply a config profile', async () => { const diff = await ipfs.config.profiles.apply('lowpower') expect(diff.original.Swarm.ConnMgr.LowWater).to.not.equal(diff.updated.Swarm.ConnMgr.LowWater) diff --git a/packages/interface-ipfs-core/src/config/profiles/list.js b/packages/interface-ipfs-core/src/config/profiles/list.js index b46c1d5c70..9cbe56219e 100644 --- a/packages/interface-ipfs-core/src/config/profiles/list.js +++ b/packages/interface-ipfs-core/src/config/profiles/list.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing config profiles', () => { - return testTimeout(() => ipfs.config.profiles.list({ - timeout: 1 - })) - }) - it('should list config profiles', async () => { const profiles = await ipfs.config.profiles.list() diff --git a/packages/interface-ipfs-core/src/config/replace.js b/packages/interface-ipfs-core/src/config/replace.js index d532e64019..847e9f0a83 100644 --- a/packages/interface-ipfs-core/src/config/replace.js +++ b/packages/interface-ipfs-core/src/config/replace.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -27,12 +26,6 @@ module.exports = (common, options) => { Fruit: 'Bananas' } - it('should respect timeout option when replacing config', () => { - return testTimeout(() => ipfs.config.replace(config, { - timeout: 1 - })) - }) - it('should replace the whole config', async () => { await ipfs.config.replace(config) diff --git a/packages/interface-ipfs-core/src/config/set.js b/packages/interface-ipfs-core/src/config/set.js index 82151bea6f..38ad9ae339 100644 --- a/packages/interface-ipfs-core/src/config/set.js +++ b/packages/interface-ipfs-core/src/config/set.js @@ -3,7 +3,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -24,12 +23,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when setting config values', () => { - return testTimeout(() => ipfs.config.set('Fruit', 'banana', { - timeout: 1 - })) - }) - it('should set a new key', async () => { await ipfs.config.set('Fruit', 'banana') diff --git a/packages/interface-ipfs-core/src/dag/put.js b/packages/interface-ipfs-core/src/dag/put.js index 0e22946275..ea8fe7ea21 100644 --- a/packages/interface-ipfs-core/src/dag/put.js +++ b/packages/interface-ipfs-core/src/dag/put.js @@ -8,7 +8,6 @@ const dagCBOR = require('ipld-dag-cbor') const CID = require('cids') const multihash = require('multihashing-async').multihash const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -45,14 +44,6 @@ module.exports = (common, options) => { done() }) - it('should respect timeout option when putting a DAG node', () => { - return testTimeout(() => ipfs.dag.put(pbNode, { - format: 'dag-pb', - hashAlg: 'sha2-256', - timeout: 1 - })) - }) - it('should put dag-pb with default hash func (sha2-256)', () => { return ipfs.dag.put(pbNode, { format: 'dag-pb', diff --git a/packages/interface-ipfs-core/src/dht/provide.js b/packages/interface-ipfs-core/src/dht/provide.js index 2b729f45d4..bcf18ae8ad 100644 --- a/packages/interface-ipfs-core/src/dht/provide.js +++ b/packages/interface-ipfs-core/src/dht/provide.js @@ -5,7 +5,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const CID = require('cids') const all = require('it-all') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -29,14 +28,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when providing a value on the DHT', async () => { - const res = await ipfs.add(uint8ArrayFromString('test')) - - await testTimeout(() => ipfs.dht.provide(res.cid, { - timeout: 1 - })) - }) - it('should provide local CID', async () => { const res = await ipfs.add(uint8ArrayFromString('test')) diff --git a/packages/interface-ipfs-core/src/dht/put.js b/packages/interface-ipfs-core/src/dht/put.js index 4721fd3a28..d059e8950c 100644 --- a/packages/interface-ipfs-core/src/dht/put.js +++ b/packages/interface-ipfs-core/src/dht/put.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const all = require('it-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -26,16 +25,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when putting a value into the DHT', async () => { - const { cid } = await nodeA.add('should respect timeout option when putting a value into the DH') - const publish = await nodeA.name.publish(cid) - const record = await nodeA.dht.get(`/ipns/${publish.name}`) - - await testTimeout(() => nodeA.dht.put(`/ipns/${publish.name}`, record, { - timeout: 1 - })) - }) - it('should put a value to the DHT', async function () { const { cid } = await nodeA.add('should put a value to the DHT') const publish = await nodeA.name.publish(cid) diff --git a/packages/interface-ipfs-core/src/files/chmod.js b/packages/interface-ipfs-core/src/files/chmod.js index a3a1e9d811..84ae5837ec 100644 --- a/packages/interface-ipfs-core/src/files/chmod.js +++ b/packages/interface-ipfs-core/src/files/chmod.js @@ -5,7 +5,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') module.exports = (common, options) => { const describe = getDescribe(options) @@ -331,17 +330,5 @@ module.exports = (common, options) => { // files with prior execute bit should now be user and group executable await expect(ipfs.files.stat(bin)).to.eventually.have.property('mode', 0o754) }) - - it('should respect timeout option when changing the mode of a file', async () => { - const path = `/foo-${Math.random()}` - - await ipfs.files.write(path, uint8ArrayFromString('Hello world'), { - create: true - }) - - await testTimeout(() => ipfs.files.chmod(path, '0777', { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/files/cp.js b/packages/interface-ipfs-core/src/files/cp.js index b2cbfd31cf..0ad20e99fc 100644 --- a/packages/interface-ipfs-core/src/files/cp.js +++ b/packages/interface-ipfs-core/src/files/cp.js @@ -13,7 +13,6 @@ const CID = require('cids') const { randomBytes } = require('iso-random-stream') const createShardedDirectory = require('../utils/create-sharded-directory') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -337,12 +336,6 @@ module.exports = (common, options) => { expect(stats).to.have.property('mode', mode) }) - it('should respect timeout option when copying a file', async () => { - await testTimeout(() => ipfs.files.cp('/ipfs/QmaWLMK8yg36wMZX4Ybz7PAbKi1z5FzEtg5iEVeXHtNBqa', '/derp', { - timeout: 1 - })) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/files/flush.js b/packages/interface-ipfs-core/src/files/flush.js index b8dd57cb77..c1471a8ffe 100644 --- a/packages/interface-ipfs-core/src/files/flush.js +++ b/packages/interface-ipfs-core/src/files/flush.js @@ -3,7 +3,6 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -54,11 +53,5 @@ module.exports = (common, options) => { expect(dirStats.cid.toString()).to.equal(flushed.toString()) }) - - it('should respect timeout option when flushing changes', async () => { - await testTimeout(() => ipfs.files.flush('/', { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/files/ls.js b/packages/interface-ipfs-core/src/files/ls.js index d266103262..7c272a9363 100644 --- a/packages/interface-ipfs-core/src/files/ls.js +++ b/packages/interface-ipfs-core/src/files/ls.js @@ -6,9 +6,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const CID = require('cids') const createShardedDirectory = require('../utils/create-sharded-directory') const all = require('it-all') -const drain = require('it-drain') const { randomBytes } = require('iso-random-stream') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -158,12 +156,6 @@ module.exports = (common, options) => { }]) }) - it('should respect timeout option when listing files', async () => { - await testTimeout(() => drain(ipfs.files.ls('/', { - timeout: 1 - }))) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/files/mkdir.js b/packages/interface-ipfs-core/src/files/mkdir.js index bd6b133653..b55f200c20 100644 --- a/packages/interface-ipfs-core/src/files/mkdir.js +++ b/packages/interface-ipfs-core/src/files/mkdir.js @@ -7,7 +7,6 @@ const multihash = require('multihashing-async').multihash const createShardedDirectory = require('../utils/create-sharded-directory') const all = require('it-all') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -213,12 +212,6 @@ module.exports = (common, options) => { }) }) - it('should respect timeout option when making a directory', async () => { - await testTimeout(() => ipfs.files.mkdir('/dir-to-make', { - timeout: 1 - })) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/files/mv.js b/packages/interface-ipfs-core/src/files/mv.js index c5b46a37a1..027b2319a3 100644 --- a/packages/interface-ipfs-core/src/files/mv.js +++ b/packages/interface-ipfs-core/src/files/mv.js @@ -7,7 +7,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const createShardedDirectory = require('../utils/create-sharded-directory') const { randomBytes } = require('iso-random-stream') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') const all = require('it-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -103,20 +102,6 @@ module.exports = (common, options) => { } }) - it('should respect timeout option when moving files', async () => { - const source = `/source-file-${Math.random()}.txt` - const destination = `/dest-file-${Math.random()}.txt` - const data = randomBytes(500) - - await ipfs.files.write(source, data, { - create: true - }) - - await testTimeout(() => ipfs.files.mv(source, destination, { - timeout: 1 - })) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/files/read.js b/packages/interface-ipfs-core/src/files/read.js index b5bde760a9..9de211bfe4 100644 --- a/packages/interface-ipfs-core/src/files/read.js +++ b/packages/interface-ipfs-core/src/files/read.js @@ -8,7 +8,6 @@ const { fixtures } = require('../utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const createShardedDirectory = require('../utils/create-sharded-directory') const { randomBytes } = require('iso-random-stream') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -109,19 +108,6 @@ module.exports = (common, options) => { expect(testFileData).to.eql(fixtures.smallFile.data) }) - it('should respect timeout option when reading files', async () => { - const path = `/some-file-${Math.random()}.txt` - const data = randomBytes(100) - - await ipfs.files.write(path, data, { - create: true - }) - - await testTimeout(() => drain(ipfs.files.read(path, { - timeout: 1 - }))) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/files/rm.js b/packages/interface-ipfs-core/src/files/rm.js index e44b5e7ddb..99465f5d8b 100644 --- a/packages/interface-ipfs-core/src/files/rm.js +++ b/packages/interface-ipfs-core/src/files/rm.js @@ -7,7 +7,6 @@ const createShardedDirectory = require('../utils/create-sharded-directory') const createTwoShards = require('../utils/create-two-shards') const { randomBytes } = require('iso-random-stream') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -271,18 +270,5 @@ module.exports = (common, options) => { expect((await ipfs.files.stat(dirPath)).type).to.equal('directory') expect(updatedDirCid.toString()).to.deep.equal(dirWithSomeFiles.toString()) }) - - it('should respect timeout option when removing files', async () => { - const file = `/some-file-${Math.random()}.txt` - - await ipfs.files.write(file, randomBytes(100), { - create: true, - parents: true - }) - - await testTimeout(() => ipfs.files.rm(file, { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/files/stat.js b/packages/interface-ipfs-core/src/files/stat.js index d20a65df86..ee39e44e07 100644 --- a/packages/interface-ipfs-core/src/files/stat.js +++ b/packages/interface-ipfs-core/src/files/stat.js @@ -11,7 +11,6 @@ const mh = require('multihashing-async').multihash const Block = require('ipld-block') const { randomBytes } = require('iso-random-stream') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -359,15 +358,6 @@ module.exports = (common, options) => { expect(stat.sizeLocal).to.be.undefined() }) - it('should respect timeout option when statting files', async () => { - const path = `/directory-${Math.random()}` - await ipfs.files.mkdir(path) - - await testTimeout(() => ipfs.files.stat(path, { - timeout: 1 - })) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/files/touch.js b/packages/interface-ipfs-core/src/files/touch.js index 4dcd99e106..e8a71900f7 100644 --- a/packages/interface-ipfs-core/src/files/touch.js +++ b/packages/interface-ipfs-core/src/files/touch.js @@ -6,7 +6,6 @@ const uint8ArrayConcat = require('uint8arrays/concat') const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -const testTimeout = require('../utils/test-timeout') const all = require('it-all') module.exports = (common, options) => { @@ -158,11 +157,5 @@ module.exports = (common, options) => { nsecs: mtime[1] }) }) - - it('should respect timeout option when updating the modification time of files', async () => { - await testTimeout(() => ipfs.files.touch('/derp', { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/files/write.js b/packages/interface-ipfs-core/src/files/write.js index dd553eb26f..f6ef1a8fbb 100644 --- a/packages/interface-ipfs-core/src/files/write.js +++ b/packages/interface-ipfs-core/src/files/write.js @@ -14,7 +14,6 @@ const { randomBytes } = require('iso-random-stream') const { randomStream } = require('iso-random-stream') const all = require('it-all') const isShardAtPath = require('../utils/is-shard-at-path') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -627,13 +626,6 @@ module.exports = (common, options) => { }) }) - it('should respect timeout option when writing files', async () => { - await testTimeout(() => ipfs.files.write('/derp', [], { - create: true, - timeout: 1 - })) - }) - describe('with sharding', () => { let ipfs diff --git a/packages/interface-ipfs-core/src/key/gen.js b/packages/interface-ipfs-core/src/key/gen.js index 9b3257eb00..d3241b1382 100644 --- a/packages/interface-ipfs-core/src/key/gen.js +++ b/packages/interface-ipfs-core/src/key/gen.js @@ -3,7 +3,6 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -27,14 +26,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when generating a key', () => { - return testTimeout(() => ipfs.key.gen(nanoid(), { - type: 'rsa', - size: 2048, - timeout: 1 - })) - }) - keyTypes.forEach((kt) => { it(`should generate a new ${kt.type} key`, async function () { this.timeout(20 * 1000) diff --git a/packages/interface-ipfs-core/src/key/import.js b/packages/interface-ipfs-core/src/key/import.js index 9c7721ad65..0bb9933fd1 100644 --- a/packages/interface-ipfs-core/src/key/import.js +++ b/packages/interface-ipfs-core/src/key/import.js @@ -4,7 +4,6 @@ const { nanoid } = require('nanoid') const keys = require('libp2p-crypto/src/keys') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -24,17 +23,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when importing a key', async () => { - const password = nanoid() - - const key = await keys.generateKeyPair('ed25519') - const exported = key.export(password) - - await testTimeout(() => ipfs.key.import('derp', exported, password, { - timeout: 1 - })) - }) - it('should import an exported key', async () => { const password = nanoid() diff --git a/packages/interface-ipfs-core/src/key/list.js b/packages/interface-ipfs-core/src/key/list.js index c90c53f82f..a965b80c5a 100644 --- a/packages/interface-ipfs-core/src/key/list.js +++ b/packages/interface-ipfs-core/src/key/list.js @@ -3,7 +3,6 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing keys', () => { - return testTimeout(() => ipfs.key.list({ - timeout: 1 - })) - }) - it('should list all the keys', async function () { this.timeout(60 * 1000) diff --git a/packages/interface-ipfs-core/src/key/rename.js b/packages/interface-ipfs-core/src/key/rename.js index 5ccb6a9ec4..9eafa9d622 100644 --- a/packages/interface-ipfs-core/src/key/rename.js +++ b/packages/interface-ipfs-core/src/key/rename.js @@ -3,7 +3,6 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,16 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when renaming keys', async () => { - const oldName = nanoid() - const newName = nanoid() - await ipfs.key.gen(oldName, { type: 'rsa', size: 2048 }) - - await testTimeout(() => ipfs.key.rename(oldName, newName, { - timeout: 1 - })) - }) - it('should rename a key', async function () { this.timeout(30 * 1000) diff --git a/packages/interface-ipfs-core/src/key/rm.js b/packages/interface-ipfs-core/src/key/rm.js index 0f8338aa68..df8f7ed143 100644 --- a/packages/interface-ipfs-core/src/key/rm.js +++ b/packages/interface-ipfs-core/src/key/rm.js @@ -3,7 +3,6 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,15 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when removing keys', async () => { - const name = nanoid() - await ipfs.key.gen(name, { type: 'rsa', size: 2048 }) - - await testTimeout(() => ipfs.key.rm(name, { - timeout: 1 - })) - }) - it('should rm a key', async function () { this.timeout(30 * 1000) diff --git a/packages/interface-ipfs-core/src/miscellaneous/dns.js b/packages/interface-ipfs-core/src/miscellaneous/dns.js index 17653da145..a4e54151d3 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/dns.js +++ b/packages/interface-ipfs-core/src/miscellaneous/dns.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -24,12 +23,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when resolving a DNS name', () => { - return testTimeout(() => ipfs.dns('derp.io', { - timeout: 1 - })) - }) - it('should non-recursively resolve ipfs.io', async function () { try { const res = await ipfs.dns('ipfs.io', { recursive: false }) diff --git a/packages/interface-ipfs-core/src/miscellaneous/id.js b/packages/interface-ipfs-core/src/miscellaneous/id.js index feb9d9ef30..a0ffc8d769 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/id.js +++ b/packages/interface-ipfs-core/src/miscellaneous/id.js @@ -4,7 +4,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { Multiaddr } = require('multiaddr') const CID = require('cids') -const testTimeout = require('../utils/test-timeout') const { isWebWorker } = require('ipfs-utils/src/env') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -26,12 +25,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting the node id', () => { - return testTimeout(() => ipfs.id({ - timeout: 1 - })) - }) - it('should get the node ID', async () => { const res = await ipfs.id() expect(res).to.have.a.property('id').that.is.a('string') diff --git a/packages/interface-ipfs-core/src/miscellaneous/resolve.js b/packages/interface-ipfs-core/src/miscellaneous/resolve.js index 7a69854e55..4700756a2b 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/resolve.js +++ b/packages/interface-ipfs-core/src/miscellaneous/resolve.js @@ -8,7 +8,6 @@ const multibase = require('multibase') const { getDescribe, getIt, expect } = require('../utils/mocha') const all = require('it-all') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -31,12 +30,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when resoving an ipfs path', () => { - return testTimeout(() => ipfs.resolve('/ipfs/Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ/herp/derp', { - timeout: 1 - })) - }) - it('should resolve an IPFS hash', async () => { const content = uint8ArrayFromString('Hello world') diff --git a/packages/interface-ipfs-core/src/miscellaneous/stop.js b/packages/interface-ipfs-core/src/miscellaneous/stop.js index 44f9997dbf..80ab85199b 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/stop.js +++ b/packages/interface-ipfs-core/src/miscellaneous/stop.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -29,12 +28,6 @@ module.exports = (common, options) => { common.controllers = [] }) - it('should respect timeout option when stopping the node', () => { - return testTimeout(() => ipfs.api.stop({ - timeout: 1 - })) - }) - it('should stop the node', async () => { // Should succeed because node is started await ipfs.api.swarm.peers() diff --git a/packages/interface-ipfs-core/src/miscellaneous/version.js b/packages/interface-ipfs-core/src/miscellaneous/version.js index 2a58bd801d..d7b4bb874e 100644 --- a/packages/interface-ipfs-core/src/miscellaneous/version.js +++ b/packages/interface-ipfs-core/src/miscellaneous/version.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -22,12 +21,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting the node version', () => { - return testTimeout(() => ipfs.version({ - timeout: 1 - })) - }) - it('should get the node version', async () => { const result = await ipfs.version() expect(result).to.have.a.property('version') diff --git a/packages/interface-ipfs-core/src/name-pubsub/cancel.js b/packages/interface-ipfs-core/src/name-pubsub/cancel.js index 7b00a5cd6a..d0ab76b495 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/cancel.js +++ b/packages/interface-ipfs-core/src/name-pubsub/cancel.js @@ -4,7 +4,6 @@ const PeerId = require('peer-id') const all = require('it-all') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -26,12 +25,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when cancelling an IPNS pubsub subscription', () => { - return testTimeout(() => ipfs.name.pubsub.cancel(nodeId, { - timeout: 1 - })) - }) - it('should return false when the name that is intended to cancel is not subscribed', async function () { this.timeout(60 * 1000) diff --git a/packages/interface-ipfs-core/src/name-pubsub/state.js b/packages/interface-ipfs-core/src/name-pubsub/state.js index 81f972a70d..01da8dbaac 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/state.js +++ b/packages/interface-ipfs-core/src/name-pubsub/state.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -22,12 +21,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting the IPNS pubsub state', () => { - return testTimeout(() => ipfs.name.pubsub.state({ - timeout: 1 - })) - }) - it('should get the current state of pubsub', async function () { this.timeout(50 * 1000) diff --git a/packages/interface-ipfs-core/src/name-pubsub/subs.js b/packages/interface-ipfs-core/src/name-pubsub/subs.js index 7b1d0778aa..f6a555d054 100644 --- a/packages/interface-ipfs-core/src/name-pubsub/subs.js +++ b/packages/interface-ipfs-core/src/name-pubsub/subs.js @@ -3,7 +3,6 @@ const all = require('it-all') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting IPNS pubsub subscriptions', () => { - return testTimeout(() => ipfs.name.pubsub.subs({ - timeout: 1 - })) - }) - it('should get an empty array as a result of subscriptions before any resolve', async function () { this.timeout(60 * 1000) diff --git a/packages/interface-ipfs-core/src/name/publish.js b/packages/interface-ipfs-core/src/name/publish.js index fe0e097687..68fe8b65ba 100644 --- a/packages/interface-ipfs-core/src/name/publish.js +++ b/packages/interface-ipfs-core/src/name/publish.js @@ -6,7 +6,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { fixture } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const last = require('it-last') -const testTimeout = require('../utils/test-timeout') const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -31,13 +30,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when publishing an IPNS name', () => { - return testTimeout(() => ipfs.name.publish(fixture.cid, { - allowOffline: true, - timeout: 1 - })) - }) - it('should publish an IPNS record with the default params', async function () { this.timeout(50 * 1000) diff --git a/packages/interface-ipfs-core/src/object/data.js b/packages/interface-ipfs-core/src/object/data.js index fab08955c1..ab89b44239 100644 --- a/packages/interface-ipfs-core/src/object/data.js +++ b/packages/interface-ipfs-core/src/object/data.js @@ -3,8 +3,6 @@ const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') -const CID = require('cids') const uint8ArrayFromString = require('uint8arrays/from-string') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -27,12 +25,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting the data from an object', () => { - return testTimeout(() => ipfs.object.data(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { - timeout: 1 - })) - }) - it('should get data by multihash', async () => { const testObj = { Data: uint8ArrayFromString(nanoid()), diff --git a/packages/interface-ipfs-core/src/object/get.js b/packages/interface-ipfs-core/src/object/get.js index 98d8cc25a5..6b5f941a80 100644 --- a/packages/interface-ipfs-core/src/object/get.js +++ b/packages/interface-ipfs-core/src/object/get.js @@ -8,8 +8,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { UnixFS } = require('ipfs-unixfs') const { randomBytes } = require('iso-random-stream') const { asDAGLink } = require('./utils') -const testTimeout = require('../utils/test-timeout') -const CID = require('cids') const uint8ArrayFromString = require('uint8arrays/from-string') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -32,12 +30,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting an object', () => { - return testTimeout(() => ipfs.object.get(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { - timeout: 1 - })) - }) - it('should get object by multihash', async () => { const obj = { Data: uint8ArrayFromString(nanoid()), diff --git a/packages/interface-ipfs-core/src/object/links.js b/packages/interface-ipfs-core/src/object/links.js index c394270920..d37a1e786d 100644 --- a/packages/interface-ipfs-core/src/object/links.js +++ b/packages/interface-ipfs-core/src/object/links.js @@ -7,8 +7,6 @@ const DAGNode = dagPB.DAGNode const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -const testTimeout = require('../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -30,12 +28,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting the links from an object', () => { - return testTimeout(() => ipfs.object.links(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { - timeout: 1 - })) - }) - it('should get empty links by multihash', async () => { const testObj = { Data: uint8ArrayFromString(nanoid()), diff --git a/packages/interface-ipfs-core/src/object/new.js b/packages/interface-ipfs-core/src/object/new.js index 9788218d01..0b3116f564 100644 --- a/packages/interface-ipfs-core/src/object/new.js +++ b/packages/interface-ipfs-core/src/object/new.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -24,12 +23,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when creating a new object', () => { - return testTimeout(() => ipfs.object.new({ - timeout: 1 - })) - }) - it('should create a new object with no template', async () => { const cid = await ipfs.object.new() expect(cid.toBaseEncodedString()).to.equal('QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n') diff --git a/packages/interface-ipfs-core/src/object/patch/add-link.js b/packages/interface-ipfs-core/src/object/patch/add-link.js index 5e1d34f6b2..82747319c7 100644 --- a/packages/interface-ipfs-core/src/object/patch/add-link.js +++ b/packages/interface-ipfs-core/src/object/patch/add-link.js @@ -6,8 +6,6 @@ const dagPB = require('ipld-dag-pb') const DAGNode = dagPB.DAGNode const { getDescribe, getIt, expect } = require('../../utils/mocha') const { asDAGLink } = require('../utils') -const CID = require('cids') -const testTimeout = require('../../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -29,12 +27,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when adding a link to an object', () => { - return testTimeout(() => ipfs.object.patch.addLink(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { name: '', size: 37, cid: new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxaZ') }, { - timeout: 1 - })) - }) - it('should add a link to an existing node', async () => { const obj = { Data: uint8ArrayFromString('patch test object'), diff --git a/packages/interface-ipfs-core/src/object/patch/append-data.js b/packages/interface-ipfs-core/src/object/patch/append-data.js index 26bf929208..b6672166ff 100644 --- a/packages/interface-ipfs-core/src/object/patch/append-data.js +++ b/packages/interface-ipfs-core/src/object/patch/append-data.js @@ -3,8 +3,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -26,12 +24,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when appending data to an object', () => { - return testTimeout(() => ipfs.object.patch.appendData(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), uint8ArrayFromString('derp'), { - timeout: 1 - })) - }) - it('should append data to an existing node', async () => { const obj = { Data: uint8ArrayFromString('patch test object'), diff --git a/packages/interface-ipfs-core/src/object/patch/rm-link.js b/packages/interface-ipfs-core/src/object/patch/rm-link.js index 653a53c84b..b9184abc02 100644 --- a/packages/interface-ipfs-core/src/object/patch/rm-link.js +++ b/packages/interface-ipfs-core/src/object/patch/rm-link.js @@ -4,8 +4,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { getDescribe, getIt, expect } = require('../../utils/mocha') const { asDAGLink } = require('../utils') -const testTimeout = require('../../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -27,12 +25,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when removing a link from an object', () => { - return testTimeout(() => ipfs.object.patch.rmLink(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { name: 'link' }, { - timeout: 1 - })) - }) - it('should remove a link from an existing node', async () => { const obj1 = { Data: uint8ArrayFromString('patch test object 1'), diff --git a/packages/interface-ipfs-core/src/object/patch/set-data.js b/packages/interface-ipfs-core/src/object/patch/set-data.js index 7c80a67fd0..8f610116d7 100644 --- a/packages/interface-ipfs-core/src/object/patch/set-data.js +++ b/packages/interface-ipfs-core/src/object/patch/set-data.js @@ -3,8 +3,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -26,12 +24,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when setting the data of an object', () => { - return testTimeout(() => ipfs.object.patch.setData(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), uint8ArrayFromString('derp'), { - timeout: 1 - })) - }) - it('should set data for an existing node', async () => { const obj = { Data: uint8ArrayFromString('patch test object'), diff --git a/packages/interface-ipfs-core/src/object/put.js b/packages/interface-ipfs-core/src/object/put.js index 5d1483306b..44aa25058f 100644 --- a/packages/interface-ipfs-core/src/object/put.js +++ b/packages/interface-ipfs-core/src/object/put.js @@ -7,7 +7,6 @@ const DAGNode = dagPB.DAGNode const { nanoid } = require('nanoid') const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -29,12 +28,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when putting an object', () => { - return testTimeout(() => ipfs.object.put({ Data: uint8ArrayFromString('derp') }, { - timeout: 1 - })) - }) - it('should put an object', async () => { const obj = { Data: uint8ArrayFromString(nanoid()), diff --git a/packages/interface-ipfs-core/src/object/stat.js b/packages/interface-ipfs-core/src/object/stat.js index cad848accd..f312eeaf33 100644 --- a/packages/interface-ipfs-core/src/object/stat.js +++ b/packages/interface-ipfs-core/src/object/stat.js @@ -6,8 +6,6 @@ const dagPB = require('ipld-dag-pb') const DAGNode = dagPB.DAGNode const { getDescribe, getIt, expect } = require('../utils/mocha') const { asDAGLink } = require('./utils') -const testTimeout = require('../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -29,12 +27,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when statting an object', () => { - return testTimeout(() => ipfs.object.stat(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { - timeout: 1 - })) - }) - it('should get stats by multihash', async () => { const testObj = { Data: uint8ArrayFromString('get test object'), diff --git a/packages/interface-ipfs-core/src/pin/add-all.js b/packages/interface-ipfs-core/src/pin/add-all.js index 138b9e2f9b..aa318358ac 100644 --- a/packages/interface-ipfs-core/src/pin/add-all.js +++ b/packages/interface-ipfs-core/src/pin/add-all.js @@ -5,8 +5,6 @@ const { fixtures, clearPins } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const all = require('it-all') const drain = require('it-drain') -const testTimeout = require('../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -118,11 +116,5 @@ module.exports = (common, options) => { } }()) }) - - it('should respect timeout option when pinning a block', () => { - return testTimeout(() => ipfs.pin.addAll([new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ')], { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/pin/add.js b/packages/interface-ipfs-core/src/pin/add.js index 32f2d46cdf..7b4ce227fa 100644 --- a/packages/interface-ipfs-core/src/pin/add.js +++ b/packages/interface-ipfs-core/src/pin/add.js @@ -9,8 +9,6 @@ const drain = require('it-drain') const { DAGNode } = require('ipld-dag-pb') -const testTimeout = require('../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -181,11 +179,5 @@ module.exports = (common, options) => { type: 'indirect' }) }) - - it('should respect timeout option when pinning a block', () => { - return testTimeout(() => ipfs.pin.add(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/pin/ls.js b/packages/interface-ipfs-core/src/pin/ls.js index 111d84459b..4e02b08251 100644 --- a/packages/interface-ipfs-core/src/pin/ls.js +++ b/packages/interface-ipfs-core/src/pin/ls.js @@ -4,7 +4,6 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const all = require('it-all') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -36,12 +35,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing pins', () => { - return testTimeout(() => ipfs.pin.ls({ - timeout: 1 - })) - }) - // 1st, because ipfs.add pins automatically it('should list all recursive pins', async () => { const pinset = await all(ipfs.pin.ls({ type: 'recursive' })) diff --git a/packages/interface-ipfs-core/src/pin/remote/add.js b/packages/interface-ipfs-core/src/pin/remote/add.js index 78457490f9..3607777771 100644 --- a/packages/interface-ipfs-core/src/pin/remote/add.js +++ b/packages/interface-ipfs-core/src/pin/remote/add.js @@ -3,8 +3,6 @@ const { fixtures, clearRemotePins, clearServices } = require('../utils') const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') -const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -138,12 +136,5 @@ module.exports = (common, options) => { name: '' }) }) - - it('should respect timeout option when pinning a block', () => { - return testTimeout(() => ipfs.pin.remote.add(new CID('Qmd7qZS4T7xXtsNFdRoK1trfMs5zU94EpokQ9WFtxdPxsZ'), { - timeout: 1, - service: SERVICE - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/pin/remote/ls.js b/packages/interface-ipfs-core/src/pin/remote/ls.js index b3a92f4177..d76654361c 100644 --- a/packages/interface-ipfs-core/src/pin/remote/ls.js +++ b/packages/interface-ipfs-core/src/pin/remote/ls.js @@ -4,7 +4,6 @@ const { clearRemotePins, addRemotePins, clearServices } = require('../utils') const { getDescribe, getIt, expect } = require('../../utils/mocha') const all = require('it-all') -const testTimeout = require('../../utils/test-timeout') const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -421,13 +420,6 @@ module.exports = (common, options) => { ]) }) }) - - it('should respect timeout option', () => { - return testTimeout(() => all(ipfs.pin.remote.ls({ - timeout: 1, - service: SERVICE - }))) - }) }) } diff --git a/packages/interface-ipfs-core/src/pin/remote/rm-all.js b/packages/interface-ipfs-core/src/pin/remote/rm-all.js index 9b80f37921..5036792e87 100644 --- a/packages/interface-ipfs-core/src/pin/remote/rm-all.js +++ b/packages/interface-ipfs-core/src/pin/remote/rm-all.js @@ -3,7 +3,6 @@ const { clearRemotePins, addRemotePins, clearServices } = require('../utils') const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') const CID = require('cids') const all = require('it-all') @@ -151,13 +150,6 @@ module.exports = (common, options) => { } ].sort(byCID)) }) - - it('should respect timeout option', () => { - return testTimeout(() => ipfs.pin.remote.rmAll({ - timeout: 1, - service: SERVICE - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/pin/remote/rm.js b/packages/interface-ipfs-core/src/pin/remote/rm.js index 4dead16588..32b8ba7ea0 100644 --- a/packages/interface-ipfs-core/src/pin/remote/rm.js +++ b/packages/interface-ipfs-core/src/pin/remote/rm.js @@ -3,7 +3,6 @@ const { clearRemotePins, addRemotePins, clearServices } = require('../utils') const { getDescribe, getIt, expect } = require('../../utils/mocha') -const testTimeout = require('../../utils/test-timeout') const CID = require('cids') const all = require('it-all') @@ -169,13 +168,6 @@ module.exports = (common, options) => { } ].sort(byCID)) }) - - it('should respect timeout option', () => { - return testTimeout(() => ipfs.pin.remote.rm({ - timeout: 1, - service: SERVICE - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/pin/rm-all.js b/packages/interface-ipfs-core/src/pin/rm-all.js index b2f319ac7e..f0ad36408f 100644 --- a/packages/interface-ipfs-core/src/pin/rm-all.js +++ b/packages/interface-ipfs-core/src/pin/rm-all.js @@ -5,7 +5,6 @@ const { fixtures, clearPins } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const all = require('it-all') const drain = require('it-drain') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -36,15 +35,6 @@ module.exports = (common, options) => { return clearPins(ipfs) }) - it('should respect timeout option when unpinning a block', async () => { - await ipfs.pin.add(fixtures.files[0].cid, { recursive: true }) - - await testTimeout(() => ipfs.pin.rmAll([fixtures.files[0].cid], { - recursive: true, - timeout: 1 - })) - }) - it('should pipe the output of ls to rm', async () => { await ipfs.pin.add(fixtures.directory.cid) diff --git a/packages/interface-ipfs-core/src/pin/rm.js b/packages/interface-ipfs-core/src/pin/rm.js index 7ae804518f..59f1ae2642 100644 --- a/packages/interface-ipfs-core/src/pin/rm.js +++ b/packages/interface-ipfs-core/src/pin/rm.js @@ -4,7 +4,6 @@ const { fixtures, expectPinned, clearPins } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const all = require('it-all') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -34,15 +33,6 @@ module.exports = (common, options) => { return clearPins(ipfs) }) - it('should respect timeout option when unpinning a block', async () => { - await ipfs.pin.add(fixtures.files[0].cid, { recursive: true }) - - await testTimeout(() => ipfs.pin.rm(fixtures.files[0].cid, { - recursive: true, - timeout: 1 - })) - }) - it('should remove a recursive pin', async () => { await ipfs.pin.add(fixtures.directory.cid) diff --git a/packages/interface-ipfs-core/src/ping/ping.js b/packages/interface-ipfs-core/src/ping/ping.js index 8bdae916d4..71dbbbccd0 100644 --- a/packages/interface-ipfs-core/src/ping/ping.js +++ b/packages/interface-ipfs-core/src/ping/ping.js @@ -4,9 +4,7 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { expectIsPingResponse, isPong } = require('./utils') const all = require('it-all') -const drain = require('it-drain') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -34,12 +32,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when pinging a peer', () => { - return testTimeout(() => drain(ipfsA.ping(ipfsB.peerId.id, { - timeout: 1 - }))) - }) - it('should send the specified number of packets', async () => { const count = 3 const responses = await all(ipfsA.ping(ipfsB.peerId.id, { count })) diff --git a/packages/interface-ipfs-core/src/pubsub/ls.js b/packages/interface-ipfs-core/src/pubsub/ls.js index fbc918b32e..85449bf02c 100644 --- a/packages/interface-ipfs-core/src/pubsub/ls.js +++ b/packages/interface-ipfs-core/src/pubsub/ls.js @@ -4,7 +4,6 @@ const { getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -34,12 +33,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing pubsub subscriptions', () => { - return testTimeout(() => ipfs.pubsub.ls({ - timeout: 1 - })) - }) - it('should return an empty list when no topics are subscribed', async () => { const topics = await ipfs.pubsub.ls() expect(topics.length).to.equal(0) diff --git a/packages/interface-ipfs-core/src/pubsub/peers.js b/packages/interface-ipfs-core/src/pubsub/peers.js index 5d1bc25f9d..8bdcb1c97f 100644 --- a/packages/interface-ipfs-core/src/pubsub/peers.js +++ b/packages/interface-ipfs-core/src/pubsub/peers.js @@ -5,7 +5,6 @@ const { waitForPeers, getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const delay = require('delay') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -54,12 +53,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing pubsub peers', () => { - return testTimeout(() => ipfs1.pubsub.peers(getTopic(), { - timeout: 1 - })) - }) - it('should not error when not subscribed to a topic', async () => { const topic = getTopic() const peers = await ipfs1.pubsub.peers(topic) diff --git a/packages/interface-ipfs-core/src/pubsub/publish.js b/packages/interface-ipfs-core/src/pubsub/publish.js index 27e048eb97..cab0494ae9 100644 --- a/packages/interface-ipfs-core/src/pubsub/publish.js +++ b/packages/interface-ipfs-core/src/pubsub/publish.js @@ -5,7 +5,6 @@ const uint8ArrayFromString = require('uint8arrays/from-string') const { nanoid } = require('nanoid') const { getTopic } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -27,12 +26,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when publishing a pubsub message', () => { - return testTimeout(() => ipfs.pubsub.publish(getTopic(), 'derp', { - timeout: 1 - })) - }) - it('should publish message from string', () => { const topic = getTopic() return ipfs.pubsub.publish(topic, 'hello friend') diff --git a/packages/interface-ipfs-core/src/refs-local.js b/packages/interface-ipfs-core/src/refs-local.js index 6824fbbdf6..6942f88afb 100644 --- a/packages/interface-ipfs-core/src/refs-local.js +++ b/packages/interface-ipfs-core/src/refs-local.js @@ -6,7 +6,6 @@ const { getDescribe, getIt, expect } = require('./utils/mocha') const all = require('it-all') const { importer } = require('ipfs-unixfs-importer') const drain = require('it-drain') -const testTimeout = require('./utils/test-timeout') const CID = require('cids') const uint8ArrayEquals = require('uint8arrays/equals') @@ -30,12 +29,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing local refs', () => { - return testTimeout(() => drain(ipfs.refs.local({ - timeout: 1 - }))) - }) - it('should get local refs', async function () { const content = (name) => ({ path: `test-folder/${name}`, diff --git a/packages/interface-ipfs-core/src/repo/gc.js b/packages/interface-ipfs-core/src/repo/gc.js index 6ab8a46c96..50252a0dc1 100644 --- a/packages/interface-ipfs-core/src/repo/gc.js +++ b/packages/interface-ipfs-core/src/repo/gc.js @@ -6,7 +6,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { DAGNode } = require('ipld-dag-pb') const all = require('it-all') const drain = require('it-drain') -const testTimeout = require('../utils/test-timeout') const CID = require('cids') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -27,12 +26,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when garbage collecting', () => { - return testTimeout(() => ipfs.repo.gc({ - timeout: 1 - })) - }) - it('should run garbage collection', async () => { const res = await ipfs.add(uint8ArrayFromString('apples')) diff --git a/packages/interface-ipfs-core/src/repo/stat.js b/packages/interface-ipfs-core/src/repo/stat.js index b766c7b219..ae9a002633 100644 --- a/packages/interface-ipfs-core/src/repo/stat.js +++ b/packages/interface-ipfs-core/src/repo/stat.js @@ -3,7 +3,6 @@ const { expectIsRepo } = require('../stats/utils') const { getDescribe, getIt } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting repo stats', () => { - return testTimeout(() => ipfs.repo.stat({ - timeout: 1 - })) - }) - it('should get repo stats', async () => { const res = await ipfs.repo.stat() expectIsRepo(null, res) diff --git a/packages/interface-ipfs-core/src/repo/version.js b/packages/interface-ipfs-core/src/repo/version.js index d431e434ee..3010424c82 100644 --- a/packages/interface-ipfs-core/src/repo/version.js +++ b/packages/interface-ipfs-core/src/repo/version.js @@ -2,7 +2,6 @@ 'use strict' const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -22,12 +21,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting the repo version', () => { - return testTimeout(() => ipfs.repo.version({ - timeout: 1 - })) - }) - it('should get the repo version', async () => { const version = await ipfs.repo.version() expect(version).to.exist() diff --git a/packages/interface-ipfs-core/src/stats/bitswap.js b/packages/interface-ipfs-core/src/stats/bitswap.js index ad1da81f56..3189cf225a 100644 --- a/packages/interface-ipfs-core/src/stats/bitswap.js +++ b/packages/interface-ipfs-core/src/stats/bitswap.js @@ -3,7 +3,6 @@ const { getDescribe, getIt } = require('../utils/mocha') const { expectIsBitswap } = require('./utils') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting bitswap stats', () => { - return testTimeout(() => ipfs.stats.bitswap({ - timeout: 1 - })) - }) - it('should get bitswap stats', async () => { const res = await ipfs.stats.bitswap() expectIsBitswap(null, res) diff --git a/packages/interface-ipfs-core/src/stats/bw.js b/packages/interface-ipfs-core/src/stats/bw.js index 64c09515cb..2b3a2d5479 100644 --- a/packages/interface-ipfs-core/src/stats/bw.js +++ b/packages/interface-ipfs-core/src/stats/bw.js @@ -4,7 +4,6 @@ const { expectIsBandwidth } = require('./utils') const { getDescribe, getIt, expect } = require('../utils/mocha') const last = require('it-last') -const testTimeout = require('../utils/test-timeout') const all = require('it-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -25,12 +24,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting bandwith stats', () => { - return testTimeout(() => ipfs.stats.bw({ - timeout: 1 - })) - }) - it('should get bandwidth stats ', async () => { const res = await last(ipfs.stats.bw()) expectIsBandwidth(null, res) diff --git a/packages/interface-ipfs-core/src/stats/repo.js b/packages/interface-ipfs-core/src/stats/repo.js index cc7d40e802..d6972d5399 100644 --- a/packages/interface-ipfs-core/src/stats/repo.js +++ b/packages/interface-ipfs-core/src/stats/repo.js @@ -3,7 +3,6 @@ const { expectIsRepo } = require('./utils') const { getDescribe, getIt } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -23,12 +22,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when getting repo stats', () => { - return testTimeout(() => ipfs.stats.repo({ - timeout: 1 - })) - }) - it('should get repo stats', async () => { const res = await ipfs.stats.repo() expectIsRepo(null, res) diff --git a/packages/interface-ipfs-core/src/swarm/addrs.js b/packages/interface-ipfs-core/src/swarm/addrs.js index 372a628642..810f80027e 100644 --- a/packages/interface-ipfs-core/src/swarm/addrs.js +++ b/packages/interface-ipfs-core/src/swarm/addrs.js @@ -5,7 +5,6 @@ const CID = require('cids') const { Multiaddr } = require('multiaddr') const { getDescribe, getIt, expect } = require('../utils/mocha') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -33,12 +32,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing swarm addresses', () => { - return testTimeout(() => ipfsA.swarm.addrs({ - timeout: 1 - })) - }) - it('should get a list of node addresses', async () => { const peers = await ipfsA.swarm.addrs() expect(peers).to.not.be.empty() diff --git a/packages/interface-ipfs-core/src/swarm/connect.js b/packages/interface-ipfs-core/src/swarm/connect.js index 76f92c3c5d..2dae4cacb9 100644 --- a/packages/interface-ipfs-core/src/swarm/connect.js +++ b/packages/interface-ipfs-core/src/swarm/connect.js @@ -3,7 +3,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -40,11 +39,5 @@ module.exports = (common, options) => { peers = await ipfsA.swarm.peers() expect(peers).to.have.length.above(0) }) - - it('should respect timeout option when connecting to a remote peer', () => { - return testTimeout(() => ipfsA.swarm.connect(ipfsB.peerId.addresses[0], { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/swarm/disconnect.js b/packages/interface-ipfs-core/src/swarm/disconnect.js index 09230535e9..d70c6edd76 100644 --- a/packages/interface-ipfs-core/src/swarm/disconnect.js +++ b/packages/interface-ipfs-core/src/swarm/disconnect.js @@ -3,7 +3,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -45,11 +44,5 @@ module.exports = (common, options) => { peers = await ipfsA.swarm.peers() expect(peers).to.have.length(0) }) - - it('should respect timeout option when disconnecting from a remote peer', () => { - return testTimeout(() => ipfsA.swarm.disconnect(ipfsB.peerId.addresses[0], { - timeout: 1 - })) - }) }) } diff --git a/packages/interface-ipfs-core/src/swarm/local-addrs.js b/packages/interface-ipfs-core/src/swarm/local-addrs.js index 434bcb213e..45da62461d 100644 --- a/packages/interface-ipfs-core/src/swarm/local-addrs.js +++ b/packages/interface-ipfs-core/src/swarm/local-addrs.js @@ -3,7 +3,6 @@ const { getDescribe, getIt, expect } = require('../utils/mocha') const { isWebWorker } = require('ipfs-utils/src/env') -const testTimeout = require('../utils/test-timeout') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ /** @@ -25,12 +24,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing local addresses', () => { - return testTimeout(() => ipfs.swarm.localAddrs({ - timeout: 1 - })) - }) - it('should list local addresses the node is listening on', async () => { const multiaddrs = await ipfs.swarm.localAddrs() diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index bd206d98f5..97c04d51e6 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -6,7 +6,6 @@ const CID = require('cids') const delay = require('delay') const { isBrowser, isWebWorker } = require('ipfs-utils/src/env') const { getDescribe, getIt, expect } = require('../utils/mocha') -const testTimeout = require('../utils/test-timeout') const getIpfsOptions = require('../utils/ipfs-options-websockets-filter-all') /** @typedef { import("ipfsd-ctl/src/factory") } Factory */ @@ -36,12 +35,6 @@ module.exports = (common, options) => { after(() => common.clean()) - it('should respect timeout option when listing swarm peers', () => { - return testTimeout(() => ipfsA.swarm.peers({ - timeout: 1 - })) - }) - it('should list peers this node is connected to', async () => { const peers = await ipfsA.swarm.peers() expect(peers).to.have.length.above(0) @@ -131,8 +124,6 @@ module.exports = (common, options) => { } })).api - console.info(nodeA.peerId.addresses.map(addr => addr.toString())) - await nodeB.swarm.connect(nodeA.peerId.addresses[0]) await delay(1000) diff --git a/packages/ipfs/test/interface-http-go.js b/packages/ipfs/test/interface-http-go.js index e52bc7e9d4..f297424b08 100644 --- a/packages/ipfs/test/interface-http-go.js +++ b/packages/ipfs/test/interface-http-go.js @@ -110,10 +110,6 @@ describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () = name: 'replace', reason: 'FIXME Waiting for fix on go-ipfs https://github.com/ipfs/js-ipfs-http-client/pull/307#discussion_r69281789 and https://github.com/ipfs/go-ipfs/issues/2927' }, - { - name: 'should respect timeout option when listing config profiles', - reason: 'TODO: Not implemented in go-ipfs' - }, { name: 'should list config profiles', reason: 'TODO: Not implemented in go-ipfs' @@ -176,10 +172,6 @@ describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () = name: 'should ls from outside of mfs', reason: 'TODO not implemented in go-ipfs yet' }, - { - name: 'should respect timeout option when changing the mode of a file', - reason: 'TODO not implemented in go-ipfs yet' - }, { name: 'should update the mode for a file', reason: 'TODO not implemented in go-ipfs yet' @@ -272,10 +264,6 @@ describe('interface-ipfs-core over ipfs-http-client tests against go-ipfs', () = name: 'should respect metadata when copying from outside of mfs', reason: 'TODO not implemented in go-ipfs yet' }, - { - name: 'should respect timeout option when updating the modification time of files', - reason: 'TODO not implemented in go-ipfs yet' - }, { name: 'should have default mtime', reason: 'TODO not implemented in go-ipfs yet' From 3d50ca0472fd0b5b81a31cda3c121bb962d78c6c Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 26 Apr 2021 16:54:20 +0100 Subject: [PATCH 22/24] chore: fix up test for webworkers --- packages/interface-ipfs-core/src/swarm/peers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index 97c04d51e6..30bc30ac2f 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -113,8 +113,9 @@ module.exports = (common, options) => { const nodeA = (await common.spawn({ // browser nodes have webrtc-star addresses which can't be dialled by go so make the other - // peer a js-ipfs node to get a tcp address that can be dialled - type: isBrowser && common.opts.type === 'go' ? 'js' : 'proc', + // peer a js-ipfs node to get a tcp address that can be dialled. Also, webworkers are not + // diable so don't use a in-proc node for webworkers + type: (isBrowser && common.opts.type === 'go' || isWebWorker) ? 'js' : 'proc', ipfsOptions })).api const nodeB = (await common.spawn({ From 95e470335e2563d5cde24a63d70739ee912f7d0a Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 26 Apr 2021 17:07:01 +0100 Subject: [PATCH 23/24] chore: linting --- packages/interface-ipfs-core/src/swarm/peers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/interface-ipfs-core/src/swarm/peers.js b/packages/interface-ipfs-core/src/swarm/peers.js index 30bc30ac2f..08b08c8f26 100644 --- a/packages/interface-ipfs-core/src/swarm/peers.js +++ b/packages/interface-ipfs-core/src/swarm/peers.js @@ -115,7 +115,7 @@ module.exports = (common, options) => { // browser nodes have webrtc-star addresses which can't be dialled by go so make the other // peer a js-ipfs node to get a tcp address that can be dialled. Also, webworkers are not // diable so don't use a in-proc node for webworkers - type: (isBrowser && common.opts.type === 'go' || isWebWorker) ? 'js' : 'proc', + type: ((isBrowser && common.opts.type === 'go') || isWebWorker) ? 'js' : 'proc', ipfsOptions })).api const nodeB = (await common.spawn({ From 3ff9d049a832688dda788575a5fd754ab32f04a1 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 26 Apr 2021 18:17:49 +0100 Subject: [PATCH 24/24] chore: fix timeout test --- packages/interface-ipfs-core/src/ls.js | 5 ++--- packages/ipfs-http-server/src/api/resources/files-regular.js | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/interface-ipfs-core/src/ls.js b/packages/interface-ipfs-core/src/ls.js index 7a1bf59015..63b11dd383 100644 --- a/packages/interface-ipfs-core/src/ls.js +++ b/packages/interface-ipfs-core/src/ls.js @@ -4,7 +4,6 @@ const { fixtures } = require('./utils') const { getDescribe, getIt, expect } = require('./utils/mocha') const all = require('it-all') -const drain = require('it-drain') const CID = require('cids') const testTimeout = require('./utils/test-timeout') @@ -31,9 +30,9 @@ module.exports = (common, options) => { after(() => common.clean()) it('should respect timeout option when listing files', () => { - return testTimeout(() => drain(ipfs.ls(new CID('QmNonExistentCiD8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXg'), { + return testTimeout(() => ipfs.ls(new CID('QmNonExistentCiD8Hrf4MHo5ABDtb5AbX6hWbD3Y42bXg'), { timeout: 1 - }))) + })) }) it('should ls with a base58 encoded CID', async function () { diff --git a/packages/ipfs-http-server/src/api/resources/files-regular.js b/packages/ipfs-http-server/src/api/resources/files-regular.js index 934a8c0bcb..b57da354a2 100644 --- a/packages/ipfs-http-server/src/api/resources/files-regular.js +++ b/packages/ipfs-http-server/src/api/resources/files-regular.js @@ -438,7 +438,10 @@ exports.ls = { } } - const stat = await ipfs.files.stat(path.startsWith('/ipfs/') ? path : `/ipfs/${path}`) + const stat = await ipfs.files.stat(path.startsWith('/ipfs/') ? path : `/ipfs/${path}`, { + signal, + timeout + }) if (stat.type === 'file') { // return single object with metadata